@medplum/app 3.0.13 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,555 @@
1
+ function mS(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 R0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jm(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gS={exports:{}},Yd={},yS={exports:{}},ze={};/**
2
+ * @license React
3
+ * react.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var yc=Symbol.for("react.element"),iR=Symbol.for("react.portal"),sR=Symbol.for("react.fragment"),aR=Symbol.for("react.strict_mode"),lR=Symbol.for("react.profiler"),cR=Symbol.for("react.provider"),uR=Symbol.for("react.context"),dR=Symbol.for("react.forward_ref"),fR=Symbol.for("react.suspense"),hR=Symbol.for("react.memo"),pR=Symbol.for("react.lazy"),_0=Symbol.iterator;function mR(e){return e===null||typeof e!="object"?null:(e=_0&&e[_0]||e["@@iterator"],typeof e=="function"?e:null)}var vS={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},xS=Object.assign,wS={};function Na(e,t,n){this.props=e,this.context=t,this.refs=wS,this.updater=n||vS}Na.prototype.isReactComponent={};Na.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")};Na.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function SS(){}SS.prototype=Na.prototype;function Zm(e,t,n){this.props=e,this.context=t,this.refs=wS,this.updater=n||vS}var eg=Zm.prototype=new SS;eg.constructor=Zm;xS(eg,Na.prototype);eg.isPureReactComponent=!0;var I0=Array.isArray,bS=Object.prototype.hasOwnProperty,tg={current:null},CS={key:!0,ref:!0,__self:!0,__source:!0};function ES(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)bS.call(t,r)&&!CS.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:yc,type:e,key:i,ref:s,props:o,_owner:tg.current}}function gR(e,t){return{$$typeof:yc,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}function ng(e){return typeof e=="object"&&e!==null&&e.$$typeof===yc}function yR(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var D0=/\/+/g;function yh(e,t){return typeof e=="object"&&e!==null&&e.key!=null?yR(""+e.key):t.toString(36)}function $u(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 yc:case iR:s=!0}}if(s)return s=e,o=o(s),e=r===""?"."+yh(s,0):r,I0(o)?(n="",e!=null&&(n=e.replace(D0,"$&/")+"/"),$u(o,t,n,"",function(u){return u})):o!=null&&(ng(o)&&(o=gR(o,n+(!o.key||s&&s.key===o.key?"":(""+o.key).replace(D0,"$&/")+"/")+e)),t.push(o)),1;if(s=0,r=r===""?".":r+":",I0(e))for(var l=0;l<e.length;l++){i=e[l];var c=r+yh(i,l);s+=$u(i,t,n,c,o)}else if(c=mR(e),typeof c=="function")for(e=c.call(e),l=0;!(i=e.next()).done;)i=i.value,c=r+yh(i,l++),s+=$u(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 au(e,t,n){if(e==null)return e;var r=[],o=0;return $u(e,r,"","",function(i){return t.call(n,i,o++)}),r}function vR(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 jn={current:null},Lu={transition:null},xR={ReactCurrentDispatcher:jn,ReactCurrentBatchConfig:Lu,ReactCurrentOwner:tg};ze.Children={map:au,forEach:function(e,t,n){au(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return au(e,function(){t++}),t},toArray:function(e){return au(e,function(t){return t})||[]},only:function(e){if(!ng(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};ze.Component=Na;ze.Fragment=sR;ze.Profiler=lR;ze.PureComponent=Zm;ze.StrictMode=aR;ze.Suspense=fR;ze.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=xR;ze.cloneElement=function(e,t,n){if(e==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var r=xS({},e.props),o=e.key,i=e.ref,s=e._owner;if(t!=null){if(t.ref!==void 0&&(i=t.ref,s=tg.current),t.key!==void 0&&(o=""+t.key),e.type&&e.type.defaultProps)var l=e.type.defaultProps;for(c in t)bS.call(t,c)&&!CS.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:yc,type:e.type,key:o,ref:i,props:r,_owner:s}};ze.createContext=function(e){return e={$$typeof:uR,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},e.Provider={$$typeof:cR,_context:e},e.Consumer=e};ze.createElement=ES;ze.createFactory=function(e){var t=ES.bind(null,e);return t.type=e,t};ze.createRef=function(){return{current:null}};ze.forwardRef=function(e){return{$$typeof:dR,render:e}};ze.isValidElement=ng;ze.lazy=function(e){return{$$typeof:pR,_payload:{_status:-1,_result:e},_init:vR}};ze.memo=function(e,t){return{$$typeof:hR,type:e,compare:t===void 0?null:t}};ze.startTransition=function(e){var t=Lu.transition;Lu.transition={};try{e()}finally{Lu.transition=t}};ze.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};ze.useCallback=function(e,t){return jn.current.useCallback(e,t)};ze.useContext=function(e){return jn.current.useContext(e)};ze.useDebugValue=function(){};ze.useDeferredValue=function(e){return jn.current.useDeferredValue(e)};ze.useEffect=function(e,t){return jn.current.useEffect(e,t)};ze.useId=function(){return jn.current.useId()};ze.useImperativeHandle=function(e,t,n){return jn.current.useImperativeHandle(e,t,n)};ze.useInsertionEffect=function(e,t){return jn.current.useInsertionEffect(e,t)};ze.useLayoutEffect=function(e,t){return jn.current.useLayoutEffect(e,t)};ze.useMemo=function(e,t){return jn.current.useMemo(e,t)};ze.useReducer=function(e,t,n){return jn.current.useReducer(e,t,n)};ze.useRef=function(e){return jn.current.useRef(e)};ze.useState=function(e){return jn.current.useState(e)};ze.useSyncExternalStore=function(e,t,n){return jn.current.useSyncExternalStore(e,t,n)};ze.useTransition=function(){return jn.current.useTransition()};ze.version="18.2.0";yS.exports=ze;var p=yS.exports;const C=Jm(p),rg=mS({__proto__:null,default:C},[p]);/**
10
+ * @license React
11
+ * react-jsx-runtime.production.min.js
12
+ *
13
+ * Copyright (c) Facebook, Inc. and its affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var wR=p,SR=Symbol.for("react.element"),bR=Symbol.for("react.fragment"),CR=Object.prototype.hasOwnProperty,ER=wR.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,jR={key:!0,ref:!0,__self:!0,__source:!0};function jS(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)CR.call(t,r)&&!jR.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:SR,type:e,key:i,ref:s,props:o,_owner:ER.current}}Yd.Fragment=bR;Yd.jsx=jS;Yd.jsxs=jS;gS.exports=Yd;var a=gS.exports,Jr=function(){return Jr=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},Jr.apply(this,arguments)};function PS(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 PR(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 Fu="right-scroll-bar-position",zu="width-before-scroll-bar",TR="with-scroll-bars-hidden",kR="--removed-body-scroll-bar-size";function vh(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function RR(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 _R=typeof window<"u"?p.useLayoutEffect:p.useEffect,A0=new WeakMap;function IR(e,t){var n=RR(t||null,function(r){return e.forEach(function(o){return vh(o,r)})});return _R(function(){var r=A0.get(n);if(r){var o=new Set(r),i=new Set(e),s=n.current;o.forEach(function(l){i.has(l)||vh(l,null)}),i.forEach(function(l){o.has(l)||vh(l,s)})}A0.set(n,e)},[e]),n}function DR(e){return e}function AR(e,t){t===void 0&&(t=DR);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 NR(e){e===void 0&&(e={});var t=AR(null);return t.options=Jr({async:!0,ssr:!1},e),t}var TS=function(e){var t=e.sideCar,n=PS(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,Jr({},n))};TS.isSideCarExport=!0;function OR(e,t){return e.useMedium(t),TS}var kS=NR(),xh=function(){},Xd=p.forwardRef(function(e,t){var n=p.useRef(null),r=p.useState({onScrollCapture:xh,onWheelCapture:xh,onTouchMoveCapture:xh}),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,S=e.as,v=S===void 0?"div":S,x=e.gapMode,w=PS(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),b=h,j=IR([n,t]),E=Jr(Jr({},w),o);return p.createElement(p.Fragment,null,d&&p.createElement(b,{sideCar:kS,removeScrollBar:u,shards:f,noIsolation:m,inert:g,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:x}),s?p.cloneElement(p.Children.only(l),Jr(Jr({},E),{ref:j})):p.createElement(v,Jr({},E,{className:c,ref:j}),l))});Xd.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Xd.classNames={fullWidth:zu,zeroRight:Fu};var MR=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function $R(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=MR();return t&&e.setAttribute("nonce",t),e}function LR(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function FR(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var zR=function(){var e=0,t=null;return{add:function(n){e==0&&(t=$R())&&(LR(t,n),FR(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},BR=function(){var e=zR();return function(t,n){p.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},RS=function(){var e=BR(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},UR={left:0,top:0,right:0,gap:0},wh=function(e){return parseInt(e||"",10)||0},VR=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[wh(n),wh(r),wh(o)]},HR=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return UR;var t=VR(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])}},WR=RS(),aa="data-scroll-locked",qR=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(TR,` {
19
+ overflow: hidden `).concat(r,`;
20
+ padding-right: `).concat(l,"px ").concat(r,`;
21
+ }
22
+ body[`).concat(aa,`] {
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(Fu,` {
36
+ right: `).concat(l,"px ").concat(r,`;
37
+ }
38
+
39
+ .`).concat(zu,` {
40
+ margin-right: `).concat(l,"px ").concat(r,`;
41
+ }
42
+
43
+ .`).concat(Fu," .").concat(Fu,` {
44
+ right: 0 `).concat(r,`;
45
+ }
46
+
47
+ .`).concat(zu," .").concat(zu,` {
48
+ margin-right: 0 `).concat(r,`;
49
+ }
50
+
51
+ body[`).concat(aa,`] {
52
+ `).concat(kR,": ").concat(l,`px;
53
+ }
54
+ `)},N0=function(){var e=parseInt(document.body.getAttribute(aa)||"0",10);return isFinite(e)?e:0},GR=function(){p.useEffect(function(){return document.body.setAttribute(aa,(N0()+1).toString()),function(){var e=N0()-1;e<=0?document.body.removeAttribute(aa):document.body.setAttribute(aa,e.toString())}},[])},QR=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;GR();var i=p.useMemo(function(){return HR(o)},[o]);return p.createElement(WR,{styles:qR(i,!t,o,n?"":"!important")})},wp=!1;if(typeof window<"u")try{var lu=Object.defineProperty({},"passive",{get:function(){return wp=!0,!0}});window.addEventListener("test",lu,lu),window.removeEventListener("test",lu,lu)}catch{wp=!1}var Is=wp?{passive:!1}:!1,KR=function(e){return e.tagName==="TEXTAREA"},_S=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!KR(e)&&n[t]==="visible")},YR=function(e){return _S(e,"overflowY")},XR=function(e){return _S(e,"overflowX")},O0=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=IS(e,r);if(o){var i=DS(e,r),s=i[1],l=i[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},JR=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},ZR=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},IS=function(e,t){return e==="v"?YR(t):XR(t)},DS=function(e,t){return e==="v"?JR(t):ZR(t)},e2=function(e,t){return e==="h"&&t==="rtl"?-1:1},t2=function(e,t,n,r,o){var i=e2(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=DS(e,l),g=m[0],y=m[1],S=m[2],v=y-S-i*g;(g||v)&&IS(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},cu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},M0=function(e){return[e.deltaX,e.deltaY]},$0=function(e){return e&&"current"in e?e.current:e},n2=function(e,t){return e[0]===t[0]&&e[1]===t[1]},r2=function(e){return`
55
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
56
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
57
+ `)},o2=0,Ds=[];function i2(e){var t=p.useRef([]),n=p.useRef([0,0]),r=p.useRef(),o=p.useState(o2++)[0],i=p.useState(RS)[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=PR([e.lockRef.current],(e.shards||[]).map($0),!0).filter(Boolean);return y.forEach(function(S){return S.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),y.forEach(function(S){return S.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=p.useCallback(function(y,S){if("touches"in y&&y.touches.length===2)return!s.current.allowPinchZoom;var v=cu(y),x=n.current,w="deltaX"in y?y.deltaX:x[0]-v[0],b="deltaY"in y?y.deltaY:x[1]-v[1],j,E=y.target,P=Math.abs(w)>Math.abs(b)?"h":"v";if("touches"in y&&P==="h"&&E.type==="range")return!1;var T=O0(P,E);if(!T)return!0;if(T?j=P:(j=P==="v"?"h":"v",T=O0(P,E)),!T)return!1;if(!r.current&&"changedTouches"in y&&(w||b)&&(r.current=j),!j)return!0;var _=r.current||j;return t2(_,S,y,_==="h"?w:b,!0)},[]),c=p.useCallback(function(y){var S=y;if(!(!Ds.length||Ds[Ds.length-1]!==i)){var v="deltaY"in S?M0(S):cu(S),x=t.current.filter(function(j){return j.name===S.type&&(j.target===S.target||S.target===j.shadowParent)&&n2(j.delta,v)})[0];if(x&&x.should){S.cancelable&&S.preventDefault();return}if(!x){var w=(s.current.shards||[]).map($0).filter(Boolean).filter(function(j){return j.contains(S.target)}),b=w.length>0?l(S,w[0]):!s.current.noIsolation;b&&S.cancelable&&S.preventDefault()}}},[]),u=p.useCallback(function(y,S,v,x){var w={name:y,delta:S,target:v,should:x,shadowParent:s2(v)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(b){return b!==w})},1)},[]),d=p.useCallback(function(y){n.current=cu(y),r.current=void 0},[]),f=p.useCallback(function(y){u(y.type,M0(y),y.target,l(y,e.lockRef.current))},[]),h=p.useCallback(function(y){u(y.type,cu(y),y.target,l(y,e.lockRef.current))},[]);p.useEffect(function(){return Ds.push(i),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:h}),document.addEventListener("wheel",c,Is),document.addEventListener("touchmove",c,Is),document.addEventListener("touchstart",d,Is),function(){Ds=Ds.filter(function(y){return y!==i}),document.removeEventListener("wheel",c,Is),document.removeEventListener("touchmove",c,Is),document.removeEventListener("touchstart",d,Is)}},[]);var m=e.removeScrollBar,g=e.inert;return p.createElement(p.Fragment,null,g?p.createElement(i,{styles:r2(o)}):null,m?p.createElement(QR,{gapMode:e.gapMode}):null)}function s2(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const a2=OR(kS,i2);var Jd=p.forwardRef(function(e,t){return p.createElement(Xd,Jr({},e,{ref:t,sideCar:a2}))});Jd.classNames=Xd.classNames;function pt(e){return Object.keys(e)}function Sh(e){return e&&typeof e=="object"&&!Array.isArray(e)}function og(e,t){const n={...e},r=t;return Sh(e)&&Sh(t)&&Object.keys(t).forEach(o=>{Sh(r[o])&&o in e?n[o]=og(n[o],r[o]):n[o]=r[o]}),n}function l2(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function c2(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 Sp(e){const t=c2(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 bh(e){return`calc(${e} * var(--mantine-scale))`}function AS(e,{shouldScale:t=!1}={}){function n(r){if(r===0||r==="0")return`0${e}`;if(typeof r=="number"){const o=`${r/16}${e}`;return t?bh(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?bh(r):r;const o=r.replace("px","");if(!Number.isNaN(Number(o))){const i=`${Number(o)/16}${e}`;return t?bh(i):i}}return r}return n}const B=AS("rem",{shouldScale:!0}),nd=AS("em");function fs(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function NS(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 Ao(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==C.Fragment:!1}function Pn(e){const t=p.createContext(null);return[({children:o,value:i})=>C.createElement(t.Provider,{value:i},o),()=>{const o=p.useContext(t);if(o===null)throw new Error(e);return o}]}function vc(e=null){const t=p.createContext(e);return[({children:o,value:i})=>C.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 rd(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function u2(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 d2(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 f2(e,t,n){return rd(e,n)===rd(t,n)}function OS({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=rd(l.currentTarget,e))==null?void 0:g.querySelectorAll(t))||[]).filter(y=>f2(l.currentTarget,y,e)),u=c.findIndex(y=>l.currentTarget===y),d=d2(u,c,r),f=u2(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 h2={app:100,modal:200,popover:300,overlay:400,max:9999};function zr(e){return h2[e]}const p2=()=>{};function m2(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||p2:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function ke(e,t="size",n=!0){if(e!==void 0)return NS(e)?n?B(e):e:`var(--${t}-${e})`}function rn(e){return ke(e,"mantine-spacing")}function gt(e){return e===void 0?"var(--mantine-radius-default)":ke(e,"mantine-radius")}function Xt(e){return ke(e,"mantine-font-size")}function MS(e){return ke(e,"mantine-line-height",!1)}function ig(e){if(e)return ke(e,"mantine-shadow",!1)}function qn(e,t){return n=>{e==null||e(n),t==null||t(n)}}function sg(e,t){return e in t.breakpoints?Sp(t.breakpoints[e]):Sp(e)}function Ll(e,t){const n=e.map(r=>({value:r,px:sg(r,t)}));return n.sort((r,o)=>r.px-o.px),n}function ri(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function g2(e,t,n){var r;return n?Array.from(((r=rd(n,t))==null?void 0:r.querySelectorAll(e))||[]).findIndex(o=>o===n):null}function y2(){const[e,t]=p.useState(-1);return[e,{setHovered:t,resetHovered:()=>t(-1)}]}function ag(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function F0(e){return typeof e!="string"?"":e.charAt(0).toUpperCase()+e.slice(1)}function Fi(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 Zd(e,t){const n=Fi(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 z0=["mousedown","touchstart"];function v2(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||z0).forEach(i=>document.addEventListener(i,o)),()=>{(t||z0).forEach(i=>document.removeEventListener(i,o))}},[r,e,n]),r}function $S({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 x2(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function w2(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function LS(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=p.useState(n?t:w2(e)),i=p.useRef();return p.useEffect(()=>{if("matchMedia"in window)return i.current=window.matchMedia(e),o(i.current.matches),x2(i.current,s=>o(s.matches))},[e]),r}function S2(e,t){return LS("(prefers-color-scheme: dark)",e==="dark",t)?"dark":"light"}const Oa=typeof document<"u"?p.useLayoutEffect:p.useEffect;function Co(e,t){const n=p.useRef(!1);p.useEffect(()=>()=>{n.current=!1},[]),p.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function FS({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 Co(()=>{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 b2(e,t="body > :not(script)"){const n=ag(),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 C2=/input|select|textarea|button|object/,zS="a, input, select, textarea, button, object, [tabindex]";function E2(e){return e.style.display==="none"}function j2(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 BS(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function bp(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(BS(e));return(C2.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&j2(e)}function US(e){const t=BS(e);return(Number.isNaN(t)||t>=0)&&bp(e)}function P2(e){return Array.from(e.querySelectorAll(zS)).filter(US)}function T2(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 k2(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(zS));s=l.find(US)||l.find(bp)||null,!s&&bp(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=b2(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&&T2(t.current,s)};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i),n.current&&n.current()}},[e]),o}const R2=e=>(e+1)%1e6;function _2(){const[,e]=p.useReducer(R2,0);return e}const I2=C.useId||(()=>{});function D2(){const e=I2();return e?`mantine-${e.replace(/:/g,"")}`:""}function Tn(e){const t=D2(),[n,r]=p.useState(t);return Oa(()=>{r(ag())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function VS(e,t,n){p.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function lg(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function A2(...e){return t=>{e.forEach(n=>lg(n,t))}}function Qt(...e){return p.useCallback(A2(...e),e)}function mn({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,i]=p.useState(t!==void 0?t:n),s=(l,...c)=>{i(l),r==null||r(l,...c)};return e!==void 0?[e,r,!0]:[o,s,!1]}function Go(e,t){const n=t-e+1;return Array.from({length:n},(r,o)=>o+e)}const uu="dots";function N2({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]=mn({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 Go(1,s);const S=Math.max(l-t,n),v=Math.min(l+t,s-n),x=S>n+2,w=v<s-(n+1);if(!x&&w){const b=t*2+n+2;return[...Go(1,b),uu,...Go(s-(n-1),s)]}if(x&&!w){const b=n+1+2*t;return[...Go(1,n),uu,...Go(s-b,s)]}return[...Go(1,n),uu,...Go(S,v),uu,...Go(s-n+1,s)]},[s,t,l]),active:l,setPage:u,next:d,previous:f,first:h,last:m}}function cg(e,t){return LS("(prefers-reduced-motion: reduce)",e,t)}function O2(e=!1,t){const{onOpen:n,onClose:r}=t||{},[o,i]=p.useState(e),s=p.useCallback(()=>{i(u=>u||(n==null||n(),!0))},[n]),l=p.useCallback(()=>{i(u=>u&&(r==null||r(),!1))},[r]),c=p.useCallback(()=>{o?l():s()},[l,s,o]);return[o,{open:s,close:l,toggle:c}]}function M2(e,t,n={autoInvoke:!1}){const r=p.useRef(null),o=p.useCallback((...s)=>{r.current||(r.current=window.setTimeout(()=>{e(s),r.current=null},t))},[t]),i=p.useCallback(()=>{r.current&&(window.clearTimeout(r.current),r.current=null)},[]);return p.useEffect(()=>(n.autoInvoke&&o(),i),[i,o]),{start:o,clear:i}}function $2(e,t,n){const r=p.useRef(),o=p.useRef(null);return p.useEffect(()=>{const i=typeof n=="function"?n():n;return(i||o.current)&&(r.current=new MutationObserver(e),r.current.observe(i||o.current,t)),()=>{var s;(s=r.current)==null||s.disconnect()}},[e,t]),o}function L2(){const[e,t]=p.useState(!1);return p.useEffect(()=>t(!0),[]),e}var F2={};function HS(){return typeof process<"u"&&F2?"production":"development"}function WS(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=WS(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function et(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=WS(e))&&(r&&(r+=" "),r+=t);return r}const z2={};function B2(e){const t={};return e.forEach(n=>{Object.entries(n).forEach(([r,o])=>{t[r]?t[r]=et(t[r],o):t[r]=o})}),t}function ef({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||z2);return B2(i)}function od({theme:e,styles:t,props:n,stylesCtx:r}){return(Array.isArray(t)?t:[t]).reduce((i,s)=>typeof s=="function"?{...i,...s(e,n,r)}:{...i,...s},{})}const ug=p.createContext(null);function Ma(){const e=p.useContext(ug);if(!e)throw new Error("[@mantine/core] MantineProvider was not found in tree");return e}function U2(){return Ma().cssVariablesResolver}function V2(){return Ma().classNamesPrefix}function dg(){return Ma().getStyleNonce}function H2(){return Ma().withStaticClasses}function W2(){return Ma().headless}function q2(e){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(e)}function G2(e){let t=e.replace("#","");if(t.length===3){const s=t.split("");t=[s[0],s[0],s[1],s[1],s[2],s[2]].join("")}if(t.length===8){const s=parseInt(t.slice(6,8),16)/255;return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:s}}const n=parseInt(t,16),r=n>>16&255,o=n>>8&255,i=n&255;return{r,g:o,b:i,a:1}}function Q2(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 K2(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 fg(e){return q2(e)?G2(e):e.startsWith("rgb")?Q2(e):e.startsWith("hsl")?K2(e):{r:0,g:0,b:0,a:1}}function du(e,t){if(e.startsWith("var("))return`color-mix(in srgb, ${e}, black ${t*100}%)`;const{r:n,g:r,b:o,a:i}=fg(e),s=1-t,l=c=>Math.round(c*s);return`rgba(${l(n)}, ${l(r)}, ${l(o)}, ${i})`}function Fl(e,t){return typeof e.primaryShade=="number"?e.primaryShade:t==="dark"?e.primaryShade.dark:e.primaryShade.light}function Ch(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function Y2(e){const t=e.match(/oklch\((.*?)%\s/);return t?parseFloat(t[1]):null}function X2(e){if(e.startsWith("oklch("))return(Y2(e)||0)/100;const{r:t,g:n,b:r}=fg(e),o=t/255,i=n/255,s=r/255,l=Ch(o),c=Ch(i),u=Ch(s);return .2126*l+.7152*c+.0722*u}function nl(e,t=.179){return e.startsWith("var(")?!1:X2(e)>t}function io({color:e,theme:t,colorScheme:n}){if(typeof e!="string")throw new Error(`[@mantine/core] Failed to parse color. Expected color to be a string, instead got ${typeof e}`);if(e==="bright")return{color:e,value:n==="dark"?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:nl(n==="dark"?t.white:t.black,t.luminanceThreshold),variable:"--mantine-color-bright"};if(e==="dimmed")return{color:e,value:n==="dark"?t.colors.dark[2]:t.colors.gray[7],shade:void 0,isThemeColor:!1,isLight:nl(n==="dark"?t.colors.dark[2]:t.colors.gray[6],t.luminanceThreshold),variable:"--mantine-color-dimmed"};if(e==="white"||e==="black")return{color:e,value:e==="white"?t.white:t.black,shade:void 0,isThemeColor:!1,isLight:nl(e==="white"?t.white:t.black,t.luminanceThreshold),variable:`--mantine-color-${e}`};const[r,o]=e.split("."),i=o?Number(o):void 0,s=r in t.colors;if(s){const l=i!==void 0?t.colors[r][i]:t.colors[r][Fl(t,n||"light")];return{color:r,value:l,shade:i,isThemeColor:s,isLight:nl(l,t.luminanceThreshold),variable:o?`--mantine-color-${r}-${i}`:`--mantine-color-${r}-filled`}}return{color:e,value:e,isThemeColor:s,isLight:nl(e,t.luminanceThreshold),shade:i,variable:void 0}}function mt(e,t){const n=io({color:e||t.primaryColor,theme:t});return n.variable?`var(${n.variable})`:e}function Cp(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=mt(n.from,t),o=mt(n.to,t);return`linear-gradient(${n.deg}deg, ${r} 0%, ${o} 100%)`}function ar(e,t){if(typeof e!="string"||t>1||t<0)return"rgba(0, 0, 0, 1)";if(e.startsWith("var(")){const i=(1-t)*100;return`color-mix(in srgb, ${e}, transparent ${i}%)`}if(e.startsWith("oklch"))return e.includes("/")?e.replace(/\/\s*[\d.]+\s*\)/,`/ ${t})`):e.replace(")",` / ${t})`);const{r:n,g:r,b:o}=fg(e);return`rgba(${n}, ${r}, ${o}, ${t})`}const As=ar,J2=({color:e,theme:t,variant:n,gradient:r,autoContrast:o})=>{const i=io({color:e,theme:t}),s=typeof o=="boolean"?o:t.autoContrast;if(n==="filled"){const l=s&&i.isLight?"var(--mantine-color-black)":"var(--mantine-color-white)";return i.isThemeColor?i.shade===void 0?{background:`var(--mantine-color-${e}-filled)`,hover:`var(--mantine-color-${e}-filled-hover)`,color:l,border:`${B(1)} solid transparent`}:{background:`var(--mantine-color-${i.color}-${i.shade})`,hover:`var(--mantine-color-${i.color}-${i.shade===9?8:i.shade+1})`,color:l,border:`${B(1)} solid transparent`}:{background:e,hover:du(e,.1),color:l,border:`${B(1)} solid transparent`}}if(n==="light"){if(i.isThemeColor){if(i.shade===void 0)return{background:`var(--mantine-color-${e}-light)`,hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${B(1)} solid transparent`};const l=t.colors[i.color][i.shade];return{background:ar(l,.1),hover:ar(l,.12),color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${B(1)} solid transparent`}}return{background:ar(e,.1),hover:ar(e,.12),color:e,border:`${B(1)} solid transparent`}}if(n==="outline")return i.isThemeColor?i.shade===void 0?{background:"transparent",hover:`var(--mantine-color-${e}-outline-hover)`,color:`var(--mantine-color-${e}-outline)`,border:`${B(1)} solid var(--mantine-color-${e}-outline)`}:{background:"transparent",hover:ar(t.colors[i.color][i.shade],.05),color:`var(--mantine-color-${i.color}-${i.shade})`,border:`${B(1)} solid var(--mantine-color-${i.color}-${i.shade})`}:{background:"transparent",hover:ar(e,.05),color:e,border:`${B(1)} solid ${e}`};if(n==="subtle"){if(i.isThemeColor){if(i.shade===void 0)return{background:"transparent",hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${B(1)} solid transparent`};const l=t.colors[i.color][i.shade];return{background:"transparent",hover:ar(l,.12),color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${B(1)} solid transparent`}}return{background:"transparent",hover:ar(e,.12),color:e,border:`${B(1)} solid transparent`}}return n==="transparent"?i.isThemeColor?i.shade===void 0?{background:"transparent",hover:"transparent",color:`var(--mantine-color-${e}-light-color)`,border:`${B(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:`var(--mantine-color-${i.color}-${Math.min(i.shade,6)})`,border:`${B(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:e,border:`${B(1)} solid transparent`}:n==="white"?i.isThemeColor?i.shade===void 0?{background:"var(--mantine-color-white)",hover:du(t.white,.01),color:`var(--mantine-color-${e}-filled)`,border:`${B(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:du(t.white,.01),color:`var(--mantine-color-${i.color}-${i.shade})`,border:`${B(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:du(t.white,.01),color:e,border:`${B(1)} solid transparent`}:n==="gradient"?{background:Cp(r,t),hover:Cp(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:`${B(1)} solid var(--mantine-color-default-border)`}:{}},Z2={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"]},B0="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",hg={scale:1,fontSmoothing:!0,focusRing:"auto",white:"#fff",black:"#000",colors:Z2,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:J2,autoContrast:!1,luminanceThreshold:.3,fontFamily:B0,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:B0,fontWeight:"700",textWrap:"wrap",sizes:{h1:{fontSize:B(34),lineHeight:"1.3"},h2:{fontSize:B(26),lineHeight:"1.35"},h3:{fontSize:B(22),lineHeight:"1.4"},h4:{fontSize:B(18),lineHeight:"1.45"},h5:{fontSize:B(16),lineHeight:"1.5"},h6:{fontSize:B(14),lineHeight:"1.5"}}},fontSizes:{xs:B(12),sm:B(14),md:B(16),lg:B(18),xl:B(20)},lineHeights:{xs:"1.4",sm:"1.45",md:"1.55",lg:"1.6",xl:"1.65"},radius:{xs:B(2),sm:B(4),md:B(8),lg:B(16),xl:B(32)},spacing:{xs:B(10),sm:B(12),md:B(16),lg:B(20),xl:B(32)},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},shadows:{xs:`0 ${B(1)} ${B(3)} rgba(0, 0, 0, 0.05), 0 ${B(1)} ${B(2)} rgba(0, 0, 0, 0.1)`,sm:`0 ${B(1)} ${B(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${B(10)} ${B(15)} ${B(-5)}, rgba(0, 0, 0, 0.04) 0 ${B(7)} ${B(7)} ${B(-5)}`,md:`0 ${B(1)} ${B(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${B(20)} ${B(25)} ${B(-5)}, rgba(0, 0, 0, 0.04) 0 ${B(10)} ${B(10)} ${B(-5)}`,lg:`0 ${B(1)} ${B(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${B(28)} ${B(23)} ${B(-7)}, rgba(0, 0, 0, 0.04) 0 ${B(12)} ${B(12)} ${B(-7)}`,xl:`0 ${B(1)} ${B(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${B(36)} ${B(28)} ${B(-7)}, rgba(0, 0, 0, 0.04) 0 ${B(17)} ${B(17)} ${B(-7)}`},other:{},components:{}};function U0(e){return e==="auto"||e==="dark"||e==="light"}function e_({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 U0(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&&U0(r.newValue)&&n(r.newValue)},window.addEventListener("storage",t)},unsubscribe:()=>{window.removeEventListener("storage",t)},clear:()=>{window.localStorage.removeItem(e)}}}const t_="[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color",V0="[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }";function Eh(e){return e<0||e>9?!1:parseInt(e.toString(),10)===e}function H0(e){if(!(e.primaryColor in e.colors))throw new Error(t_);if(typeof e.primaryShade=="object"&&(!Eh(e.primaryShade.dark)||!Eh(e.primaryShade.light)))throw new Error(V0);if(typeof e.primaryShade=="number"&&!Eh(e.primaryShade))throw new Error(V0)}function n_(e,t){var r;if(!t)return H0(e),e;const n=og(e,t);return t.fontFamily&&!((r=t.headings)!=null&&r.fontFamily)&&(n.headings.fontFamily=t.fontFamily),H0(n),n}const pg=p.createContext(null),r_=()=>p.useContext(pg)||hg;function Tt(){const e=p.useContext(pg);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 qS({theme:e,children:t,inherit:n=!0}){const r=r_(),o=p.useMemo(()=>n_(n?r:hg,e),[e,r,n]);return C.createElement(pg.Provider,{value:o},t)}qS.displayName="@mantine/core/MantineThemeProvider";function o_(){const e=Tt(),t=dg(),n=pt(e.breakpoints).reduce((r,o)=>{const i=e.breakpoints[o].includes("px"),s=Sp(e.breakpoints[o]),l=i?`${s-.1}px`:nd(s-.1),c=i?`${s}px`:nd(s);return`${r}@media (max-width: ${l}) {.mantine-visible-from-${o} {display: none !important;}}@media (min-width: ${c}) {.mantine-hidden-from-${o} {display: none !important;}}`},"");return C.createElement("style",{"data-mantine-styles":"classes",nonce:t==null?void 0:t(),dangerouslySetInnerHTML:{__html:n}})}function jh(e){return Object.entries(e).map(([t,n])=>`${t}: ${n};`).join("")}function Ph(e,t){return(Array.isArray(e)?e:[e]).reduce((r,o)=>`${o}{${r}}`,t)}function i_(e,t){const n=jh(e.variables),r=n?Ph(t,n):"",o=jh(e.dark),i=o?Ph(`${t}[data-mantine-color-scheme="dark"]`,o):"",s=jh(e.light),l=s?Ph(`${t}[data-mantine-color-scheme="light"]`,s):"";return`${r}${i}${l}`}function hs({color:e,theme:t,autoContrast:n}){return(typeof n=="boolean"?n:t.autoContrast)&&io({color:e||t.primaryColor,theme:t}).isLight?"var(--mantine-color-black)":"var(--mantine-color-white)"}function W0(e,t){return hs({color:e.colors[e.primaryColor][Fl(e,t)],theme:e,autoContrast:null})}function fu({theme:e,color:t,colorScheme:n,name:r=t,withColorValues:o=!0}){if(!e.colors[t])return{};if(n==="light"){const l=Fl(e,"light"),c={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-filled)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${l})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${l===9?8:l+1})`,[`--mantine-color-${r}-light`]:As(e.colors[t][l],.1),[`--mantine-color-${r}-light-hover`]:As(e.colors[t][l],.12),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-${l})`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${l})`,[`--mantine-color-${r}-outline-hover`]:As(e.colors[t][l],.05)};return o?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...c}:c}const i=Fl(e,"dark"),s={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-4)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${i})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${i===9?8:i+1})`,[`--mantine-color-${r}-light`]:As(e.colors[t][Math.max(0,i-2)],.15),[`--mantine-color-${r}-light-hover`]:As(e.colors[t][Math.max(0,i-2)],.2),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-${Math.max(i-5,0)})`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${Math.max(i-4,0)})`,[`--mantine-color-${r}-outline-hover`]:As(e.colors[t][Math.max(i-4,0)],.05)};return o?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...s}:s}function s_(e){return!!e&&typeof e=="object"&&"mantine-virtual-color"in e}function Ns(e,t,n){pt(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}const GS=e=>{const t=Fl(e,"light"),n=e.defaultRadius in e.radius?e.radius[e.defaultRadius]:B(e.defaultRadius),r={variables:{"--mantine-scale":e.scale.toString(),"--mantine-cursor-type":e.cursorType,"--mantine-color-scheme":"light dark","--mantine-webkit-font-smoothing":e.fontSmoothing?"antialiased":"unset","--mantine-moz-font-smoothing":e.fontSmoothing?"grayscale":"unset","--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-line-height":e.lineHeights.md,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":e.headings.fontWeight,"--mantine-heading-text-wrap":e.headings.textWrap,"--mantine-radius-default":n,"--mantine-primary-color-filled":`var(--mantine-color-${e.primaryColor}-filled)`,"--mantine-primary-color-filled-hover":`var(--mantine-color-${e.primaryColor}-filled-hover)`,"--mantine-primary-color-light":`var(--mantine-color-${e.primaryColor}-light)`,"--mantine-primary-color-light-hover":`var(--mantine-color-${e.primaryColor}-light-hover)`,"--mantine-primary-color-light-color":`var(--mantine-color-${e.primaryColor}-light-color)`},light:{"--mantine-primary-color-contrast":W0(e,"light"),"--mantine-color-bright":"var(--mantine-color-black)","--mantine-color-text":e.black,"--mantine-color-body":e.white,"--mantine-color-error":"var(--mantine-color-red-6)","--mantine-color-placeholder":"var(--mantine-color-gray-5)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-${t})`,"--mantine-color-default":"var(--mantine-color-white)","--mantine-color-default-hover":"var(--mantine-color-gray-0)","--mantine-color-default-color":"var(--mantine-color-black)","--mantine-color-default-border":"var(--mantine-color-gray-4)","--mantine-color-dimmed":"var(--mantine-color-gray-6)"},dark:{"--mantine-primary-color-contrast":W0(e,"dark"),"--mantine-color-bright":"var(--mantine-color-white)","--mantine-color-text":"var(--mantine-color-dark-0)","--mantine-color-body":"var(--mantine-color-dark-7)","--mantine-color-error":"var(--mantine-color-red-8)","--mantine-color-placeholder":"var(--mantine-color-dark-3)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-4)`,"--mantine-color-default":"var(--mantine-color-dark-6)","--mantine-color-default-hover":"var(--mantine-color-dark-5)","--mantine-color-default-color":"var(--mantine-color-white)","--mantine-color-default-border":"var(--mantine-color-dark-4)","--mantine-color-dimmed":"var(--mantine-color-dark-2)"}};Ns(r.variables,e.breakpoints,"breakpoint"),Ns(r.variables,e.spacing,"spacing"),Ns(r.variables,e.fontSizes,"font-size"),Ns(r.variables,e.lineHeights,"line-height"),Ns(r.variables,e.shadows,"shadow"),Ns(r.variables,e.radius,"radius"),e.colors[e.primaryColor].forEach((i,s)=>{r.variables[`--mantine-primary-color-${s}`]=`var(--mantine-color-${e.primaryColor}-${s})`}),pt(e.colors).forEach(i=>{const s=e.colors[i];if(s_(s)){Object.assign(r.light,fu({theme:e,name:s.name,color:s.light,colorScheme:"light",withColorValues:!0})),Object.assign(r.dark,fu({theme:e,name:s.name,color:s.dark,colorScheme:"dark",withColorValues:!0}));return}s.forEach((l,c)=>{r.variables[`--mantine-color-${i}-${c}`]=l}),Object.assign(r.light,fu({theme:e,color:i,colorScheme:"light",withColorValues:!1})),Object.assign(r.dark,fu({theme:e,color:i,colorScheme:"dark",withColorValues:!1}))});const o=e.headings.sizes;return pt(o).forEach(i=>{r.variables[`--mantine-${i}-font-size`]=o[i].fontSize,r.variables[`--mantine-${i}-line-height`]=o[i].lineHeight,r.variables[`--mantine-${i}-font-weight`]=o[i].fontWeight||e.headings.fontWeight}),r};function a_({theme:e,generator:t}){const n=GS(e),r=t==null?void 0:t(e);return r?og(n,r):n}const Th=GS(hg);function l_(e){const t={variables:{},light:{},dark:{}};return pt(e.variables).forEach(n=>{Th.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),pt(e.light).forEach(n=>{Th.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),pt(e.dark).forEach(n=>{Th.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function c_(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 QS({cssVariablesSelector:e,deduplicateCssVariables:t}){const n=Tt(),r=dg(),o=U2(),i=a_({theme:n,generator:o}),s=e===":root"&&t,l=s?l_(i):i,c=i_(l,e);return c?C.createElement("style",{"data-mantine-styles":!0,nonce:r==null?void 0:r(),dangerouslySetInnerHTML:{__html:`${c}${s?"":c_(e)}`}}):null}QS.displayName="@mantine/CssVariables";function u_(){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 Os(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 d_({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||(Os(d,n),s(d),e.set(d))},[e.set,l,r]),u=p.useCallback(()=>{s(t),Os(t,n),e.clear()},[e.clear,t]);return p.useEffect(()=>(e.subscribe(c),e.unsubscribe),[e.subscribe,e.unsubscribe]),Oa(()=>{Os(e.get(t),n)},[]),p.useEffect(()=>{var f;if(r)return Os(r,n),()=>{};r===void 0&&Os(i,n),o.current=window.matchMedia("(prefers-color-scheme: dark)");const d=h=>{i==="auto"&&Os(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 f_({respectReducedMotion:e,getRootElement:t}){Oa(()=>{var n;e&&((n=t())==null||n.setAttribute("data-respect-reduced-motion","true"))},[e])}u_();function KS({theme:e,children:t,getStyleNonce:n,withStaticClasses:r=!0,withGlobalClasses:o=!0,deduplicateCssVariables:i=!0,withCssVariables:s=!0,cssVariablesSelector:l=":root",classNamesPrefix:c="mantine",colorSchemeManager:u=e_(),defaultColorScheme:d="light",getRootElement:f=()=>document.documentElement,cssVariablesResolver:h,forceColorScheme:m}){const{colorScheme:g,setColorScheme:y,clearColorScheme:S}=d_({defaultColorScheme:d,forceColorScheme:m,manager:u,getRootElement:f});return f_({respectReducedMotion:(e==null?void 0:e.respectReducedMotion)||!1,getRootElement:f}),C.createElement(ug.Provider,{value:{colorScheme:g,setColorScheme:y,clearColorScheme:S,getRootElement:f,classNamesPrefix:c,getStyleNonce:n,cssVariablesResolver:h,cssVariablesSelector:l,withStaticClasses:r}},C.createElement(qS,{theme:e},s&&C.createElement(QS,{cssVariablesSelector:l,deduplicateCssVariables:i}),o&&C.createElement(o_,null),t))}KS.displayName="@mantine/core/MantineProvider";function tf({classNames:e,styles:t,props:n,stylesCtx:r}){const o=Tt();return{resolvedClassNames:ef({theme:o,classNames:e,props:n,stylesCtx:r||void 0}),resolvedStyles:od({theme:o,styles:t,props:n,stylesCtx:r||void 0})}}const h_={always:"mantine-focus-always",auto:"mantine-focus-auto",never:"mantine-focus-never"};function p_({theme:e,options:t,unstyled:n}){return et((t==null?void 0:t.focusable)&&!n&&(e.focusClassName||h_[e.focusRing]),(t==null?void 0:t.active)&&!n&&e.activeClassName)}function m_({selector:e,stylesCtx:t,options:n,props:r,theme:o}){return ef({theme:o,classNames:n==null?void 0:n.classNames,props:(n==null?void 0:n.props)||r,stylesCtx:t})[e]}function g_({selector:e,stylesCtx:t,theme:n,classNames:r,props:o}){return ef({theme:n,classNames:r,props:o,stylesCtx:t})[e]}function y_({rootSelector:e,selector:t,className:n}){return e===t?n:void 0}function v_({selector:e,classes:t,unstyled:n}){return n?void 0:t[e]}function x_({themeName:e,classNamesPrefix:t,selector:n,withStaticClass:r}){return r===!1?[]:e.map(o=>`${t}-${o}-${n}`)}function w_({themeName:e,theme:t,selector:n,props:r,stylesCtx:o}){return e.map(i=>{var s,l;return(l=ef({theme:t,classNames:(s=t.components[i])==null?void 0:s.classNames,props:r,stylesCtx:o}))==null?void 0:l[n]})}function S_({options:e,classes:t,selector:n,unstyled:r}){return e!=null&&e.variant&&!r?t[`${n}--${e.variant}`]:void 0}function b_({theme:e,options:t,themeName:n,selector:r,classNamesPrefix:o,classNames:i,classes:s,unstyled:l,className:c,rootSelector:u,props:d,stylesCtx:f,withStaticClasses:h,headless:m}){return et(p_({theme:e,options:t,unstyled:l||m}),w_({theme:e,themeName:n,selector:r,props:d,stylesCtx:f}),S_({options:t,classes:s,selector:r,unstyled:l}),g_({selector:r,stylesCtx:f,theme:e,classNames:i,props:d}),m_({selector:r,stylesCtx:f,options:t,props:d,theme:e}),y_({rootSelector:u,selector:r,className:c}),v_({selector:r,classes:s,unstyled:l||m}),h&&!m&&x_({themeName:n,classNamesPrefix:o,selector:r,withStaticClass:t==null?void 0:t.withStaticClass}),t==null?void 0:t.className)}function C_({theme:e,themeName:t,props:n,stylesCtx:r,selector:o}){return t.map(i=>{var s;return od({theme:e,styles:(s=e.components[i])==null?void 0:s.styles,props:n,stylesCtx:r})[o]}).reduce((i,s)=>({...i,...s}),{})}function Ep({style:e,theme:t}){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...Ep({style:r,theme:t})}),{}):typeof e=="function"?e(t):e??{}}function E_(e){return e.reduce((t,n)=>(n&&Object.keys(n).forEach(r=>{t[r]={...t[r],...fs(n[r])}}),t),{})}function j_({vars:e,varsResolver:t,theme:n,props:r,stylesCtx:o,selector:i,themeName:s,headless:l}){var c;return(c=E_([l?{}:t==null?void 0:t(n,r,o),...s.map(u=>{var d,f,h;return(h=(f=(d=n.components)==null?void 0:d[u])==null?void 0:f.vars)==null?void 0:h.call(f,n,r,o)}),e==null?void 0:e(n,r,o)]))==null?void 0:c[i]}function P_({theme:e,themeName:t,selector:n,options:r,props:o,stylesCtx:i,rootSelector:s,styles:l,style:c,vars:u,varsResolver:d,headless:f}){return{...C_({theme:e,themeName:t,props:o,stylesCtx:i,selector:n}),...od({theme:e,styles:l,props:o,stylesCtx:i})[n],...od({theme:e,styles:r==null?void 0:r.styles,props:(r==null?void 0:r.props)||o,stylesCtx:i})[n],...j_({theme:e,props:o,stylesCtx:i,vars:u,varsResolver:d,selector:n,themeName:t,headless:f}),...s===n?Ep({style:c,theme:e}):null,...Ep({style:r==null?void 0:r.style,theme:e})}}function ce({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=Tt(),m=V2(),g=H2(),y=W2(),S=(Array.isArray(e)?e:[e]).filter(v=>v);return(v,x)=>({className:b_({theme:h,options:x,themeName:S,selector:v,classNamesPrefix:m,classNames:c,classes:t,unstyled:l,className:o,rootSelector:s,props:n,stylesCtx:r,withStaticClasses:g,headless:y}),style:P_({theme:h,themeName:S,selector:v,options:x,props:n,stylesCtx:r,rootSelector:s,styles:u,style:i,vars:d,varsResolver:f,headless:y})})}function xc(e,t){return typeof e=="boolean"?e:t.autoContrast}function q0(){const e=document.createElement("style");return e.innerHTML="*, *::before, *::after {transition: none !important;}",e.setAttribute("data-mantine-disable-transition","true"),document.head.appendChild(e),()=>document.querySelectorAll("[data-mantine-disable-transition]").forEach(n=>n.remove())}function T_({keepTransitions:e}={}){const t=p.useRef(),n=p.useRef(),r=p.useContext(ug);if(!r)throw new Error("[@mantine/core] MantineProvider was not found in tree");const o=u=>{r.setColorScheme(u),t.current=e?()=>{}:q0(),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{var d;(d=t.current)==null||d.call(t)},10)},i=()=>{r.clearColorScheme(),t.current=e?()=>{}:q0(),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{var u;(u=t.current)==null||u.call(t)},10)},s=S2("light",{getInitialValueInEffect:!1}),l=r.colorScheme==="auto"?s:r.colorScheme,c=p.useCallback(()=>o(l==="light"?"dark":"light"),[o,l]);return p.useEffect(()=>()=>{var u;(u=t.current)==null||u.call(t),window.clearTimeout(n.current)},[]),{colorScheme:r.colorScheme,setColorScheme:o,clearColorScheme:i,toggleColorScheme:c}}function U(e,t,n){var s;const r=Tt(),o=(s=r.components[e])==null?void 0:s.defaultProps,i=typeof o=="function"?o(r):o;return{...t,...i,...fs(n)}}function G0(e){return pt(e).reduce((t,n)=>e[n]!==void 0?`${t}${l2(n)}:${e[n]};`:t,"").trim()}function k_({selector:e,styles:t,media:n}){const r=t?G0(t):"",o=Array.isArray(n)?n.map(i=>`@media${i.query}{${e}{${G0(i.styles)}}}`):[];return`${r?`${e}{${r}}`:""}${o.join("")}`.trim()}function $a({selector:e,styles:t,media:n}){const r=dg();return C.createElement("style",{"data-mantine-styles":"inline",nonce:r==null?void 0:r(),dangerouslySetInnerHTML:{__html:k_({selector:e,styles:t,media:n})}})}function No(e){const{m:t,mx:n,my:r,mt:o,mb:i,ml:s,mr:l,me:c,ms:u,p:d,px:f,py:h,pt:m,pb:g,pl:y,pr:S,pe:v,ps:x,bg:w,c:b,opacity:j,ff:E,fz:P,fw:T,lts:_,ta:D,lh:O,fs:I,tt:L,td:N,w:M,miw:$,maw:R,h:k,mih:F,mah:q,bgsz:G,bgp:ne,bgr:xe,bga:ge,pos:Pe,top:Te,left:Le,bottom:pe,right:Ge,inset:Ot,display:me,flex:Fe,hiddenFrom:ct,visibleFrom:Oe,lightHidden:Qe,darkHidden:Bt,..._n}=e;return{styleProps:fs({m:t,mx:n,my:r,mt:o,mb:i,ml:s,mr:l,me:c,ms:u,p:d,px:f,py:h,pt:m,pb:g,pl:y,pr:S,pe:v,ps:x,bg:w,c:b,opacity:j,ff:E,fz:P,fw:T,lts:_,ta:D,lh:O,fs:I,tt:L,td:N,w:M,miw:$,maw:R,h:k,mih:F,mah:q,bgsz:G,bgp:ne,bgr:xe,bga:ge,pos:Pe,top:Te,left:Le,bottom:pe,right:Ge,inset:Ot,display:me,flex:Fe,hiddenFrom:ct,visibleFrom:Oe,lightHidden:Qe,darkHidden:Bt}),rest:_n}}const R_={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},ms:{type:"spacing",property:"marginInlineStart"},me:{type:"spacing",property:"marginInlineEnd"},mx:{type:"spacing",property:"marginInline"},my:{type:"spacing",property:"marginBlock"},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},ps:{type:"spacing",property:"paddingInlineStart"},pe:{type:"spacing",property:"paddingInlineEnd"},px:{type:"spacing",property:"paddingInline"},py:{type:"spacing",property:"paddingBlock"},bg:{type:"color",property:"background"},c:{type:"textColor",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"fontFamily",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"lineHeight",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"identity",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"},flex:{type:"identity",property:"flex"}};function YS(e,t){const n=io({color:e,theme:t});return n.color==="dimmed"?"var(--mantine-color-dimmed)":n.color==="bright"?"var(--mantine-color-bright)":n.variable?`var(${n.variable})`:n.color}function __(e,t){const n=io({color:e,theme:t});return n.isThemeColor&&n.shade===void 0?`var(--mantine-color-${n.color}-text)`:YS(e,t)}const Q0={text:"var(--mantine-font-family)",mono:"var(--mantine-font-family-monospace)",monospace:"var(--mantine-font-family-monospace)",heading:"var(--mantine-font-family-headings)",headings:"var(--mantine-font-family-headings)"};function I_(e){return typeof e=="string"&&e in Q0?Q0[e]:e}const D_=["h1","h2","h3","h4","h5","h6"];function A_(e,t){return typeof e=="string"&&e in t.fontSizes?`var(--mantine-font-size-${e})`:typeof e=="string"&&D_.includes(e)?`var(--mantine-${e}-font-size)`:typeof e=="number"||typeof e=="string"?B(e):e}function N_(e){return e}const O_=["h1","h2","h3","h4","h5","h6"];function M_(e,t){return typeof e=="string"&&e in t.lineHeights?`var(--mantine-line-height-${e})`:typeof e=="string"&&O_.includes(e)?`var(--mantine-${e}-line-height)`:e}function $_(e){return typeof e=="number"?B(e):e}function L_(e,t){if(typeof e=="number")return B(e);if(typeof e=="string"){const n=e.replace("-","");if(!(n in t.spacing))return B(e);const r=`--mantine-spacing-${n}`;return e.startsWith("-")?`calc(var(${r}) * -1)`:`var(${r})`}return e}const kh={color:YS,textColor:__,fontSize:A_,spacing:L_,identity:N_,size:$_,lineHeight:M_,fontFamily:I_};function K0(e){return e.replace("(min-width: ","").replace("em)","")}function F_({media:e,...t}){const r=Object.keys(e).sort((o,i)=>Number(K0(o))-Number(K0(i))).map(o=>({query:o,styles:e[o]}));return{...t,media:r}}function z_(e){if(typeof e!="object"||e===null)return!1;const t=Object.keys(e);return!(t.length===1&&t[0]==="base")}function B_(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function U_(e){return typeof e=="object"&&e!==null?pt(e).filter(t=>t!=="base"):[]}function V_(e,t){return typeof e=="object"&&e!==null&&t in e?e[t]:e}function XS({styleProps:e,data:t,theme:n}){return F_(pt(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=B_(e[o]);if(!z_(e[o]))return s.forEach(u=>{r.inlineStyles[u]=kh[i.type](l,n)}),r;r.hasResponsiveStyles=!0;const c=U_(e[o]);return s.forEach(u=>{l&&(r.styles[u]=kh[i.type](l,n)),c.forEach(d=>{const f=`(min-width: ${n.breakpoints[d]})`;r.media[f]={...r.media[f],[u]:kh[i.type](V_(e[o],d),n)}})}),r},{hasResponsiveStyles:!1,styles:{},inlineStyles:{},media:{}}))}function wc(){return`__m__-${p.useId().replace(/:/g,"")}`}function JS(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...JS(r,t)}),{}):typeof e=="function"?e(t):e??{}}function ZS(e){return e.startsWith("data-")?e:`data-${e}`}function H_(e){return Object.keys(e).reduce((t,n)=>{const r=e[n];return r===void 0||r===""||r===!1||r===null||(t[ZS(n)]=e[n]),t},{})}function eb(e){return e?typeof e=="string"?{[ZS(e)]:!0}:Array.isArray(e)?[...e].reduce((t,n)=>({...t,...eb(n)}),{}):H_(e):null}function jp(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...jp(r,t)}),{}):typeof e=="function"?e(t):e??{}}function W_({theme:e,style:t,vars:n,styleProps:r}){const o=jp(t,e),i=jp(n,e);return{...o,...i,...r}}const tb=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=Tt(),y=e||"div",{styleProps:S,rest:v}=No(h),x=wc(),w=XS({styleProps:S,theme:g,data:R_}),b={ref:m,style:W_({theme:g,style:t,vars:n,styleProps:w.inlineStyles}),className:et(r,{[x]:w.hasResponsiveStyles,"mantine-light-hidden":u,"mantine-dark-hidden":d,[`mantine-hidden-from-${l}`]:l,[`mantine-visible-from-${c}`]:c}),"data-variant":o,"data-size":NS(s)?void 0:s||void 0,...eb(i),...v};return C.createElement(C.Fragment,null,w.hasResponsiveStyles&&C.createElement($a,{selector:`.${x}`,styles:w.styles,media:w.media}),typeof f=="function"?f(b):C.createElement(y,{...b}))});tb.displayName="@mantine/core/Box";const H=tb;function nb(e){return e}function Q(e){const t=p.forwardRef(e);return t.extend=nb,t}function yn(e){const t=p.forwardRef(e);return t.extend=nb,t}const q_=p.createContext({dir:"ltr",toggleDirection:()=>{},setDirection:()=>{}});function La(){return p.useContext(q_)}var rb={exports:{}},tr={},ob={exports:{}},ib={};/**
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,F){var q=k.length;k.push(F);e:for(;0<q;){var G=q-1>>>1,ne=k[G];if(0<o(ne,F))k[G]=F,k[q]=ne,q=G;else break e}}function n(k){return k.length===0?null:k[0]}function r(k){if(k.length===0)return null;var F=k[0],q=k.pop();if(q!==F){k[0]=q;e:for(var G=0,ne=k.length,xe=ne>>>1;G<xe;){var ge=2*(G+1)-1,Pe=k[ge],Te=ge+1,Le=k[Te];if(0>o(Pe,q))Te<ne&&0>o(Le,Pe)?(k[G]=Le,k[Te]=q,G=Te):(k[G]=Pe,k[ge]=q,G=ge);else if(Te<ne&&0>o(Le,q))k[G]=Le,k[Te]=q,G=Te;else break e}}return F}function o(k,F){var q=k.sortIndex-F.sortIndex;return q!==0?q:k.id-F.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var c=[],u=[],d=1,f=null,h=3,m=!1,g=!1,y=!1,S=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(k){for(var F=n(u);F!==null;){if(F.callback===null)r(u);else if(F.startTime<=k)r(u),F.sortIndex=F.expirationTime,t(c,F);else break;F=n(u)}}function b(k){if(y=!1,w(k),!g)if(n(c)!==null)g=!0,$(j);else{var F=n(u);F!==null&&R(b,F.startTime-k)}}function j(k,F){g=!1,y&&(y=!1,v(T),T=-1),m=!0;var q=h;try{for(w(F),f=n(c);f!==null&&(!(f.expirationTime>F)||k&&!O());){var G=f.callback;if(typeof G=="function"){f.callback=null,h=f.priorityLevel;var ne=G(f.expirationTime<=F);F=e.unstable_now(),typeof ne=="function"?f.callback=ne:f===n(c)&&r(c),w(F)}else r(c);f=n(c)}if(f!==null)var xe=!0;else{var ge=n(u);ge!==null&&R(b,ge.startTime-F),xe=!1}return xe}finally{f=null,h=q,m=!1}}var E=!1,P=null,T=-1,_=5,D=-1;function O(){return!(e.unstable_now()-D<_)}function I(){if(P!==null){var k=e.unstable_now();D=k;var F=!0;try{F=P(!0,k)}finally{F?L():(E=!1,P=null)}}else E=!1}var L;if(typeof x=="function")L=function(){x(I)};else if(typeof MessageChannel<"u"){var N=new MessageChannel,M=N.port2;N.port1.onmessage=I,L=function(){M.postMessage(null)}}else L=function(){S(I,0)};function $(k){P=k,E||(E=!0,L())}function R(k,F){T=S(function(){k(e.unstable_now())},F)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(k){k.callback=null},e.unstable_continueExecution=function(){g||m||(g=!0,$(j))},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"):_=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 F=3;break;default:F=h}var q=h;h=F;try{return k()}finally{h=q}},e.unstable_pauseExecution=function(){},e.unstable_requestPaint=function(){},e.unstable_runWithPriority=function(k,F){switch(k){case 1:case 2:case 3:case 4:case 5:break;default:k=3}var q=h;h=k;try{return F()}finally{h=q}},e.unstable_scheduleCallback=function(k,F,q){var G=e.unstable_now();switch(typeof q=="object"&&q!==null?(q=q.delay,q=typeof q=="number"&&0<q?G+q:G):q=G,k){case 1:var ne=-1;break;case 2:ne=250;break;case 5:ne=1073741823;break;case 4:ne=1e4;break;default:ne=5e3}return ne=q+ne,k={id:d++,callback:F,priorityLevel:k,startTime:q,expirationTime:ne,sortIndex:-1},q>G?(k.sortIndex=q,t(u,k),n(c)===null&&k===n(u)&&(y?(v(T),T=-1):y=!0,R(b,q-G))):(k.sortIndex=ne,t(c,k),g||m||(g=!0,$(j))),k},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(k){var F=h;return function(){var q=h;h=F;try{return k.apply(this,arguments)}finally{h=q}}}})(ib);ob.exports=ib;var G_=ob.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 sb=p,Yn=G_;function K(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n<arguments.length;n++)t+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var ab=new Set,zl={};function ps(e,t){ga(e,t),ga(e+"Capture",t)}function ga(e,t){for(zl[e]=t,e=0;e<t.length;e++)ab.add(t[e])}var Eo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pp=Object.prototype.hasOwnProperty,Q_=/^[: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={},X0={};function K_(e){return Pp.call(X0,e)?!0:Pp.call(Y0,e)?!1:Q_.test(e)?X0[e]=!0:(Y0[e]=!0,!1)}function Y_(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 X_(e,t,n,r){if(t===null||typeof t>"u"||Y_(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 kn(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 ln={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ln[e]=new kn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ln[t]=new kn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ln[e]=new kn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ln[e]=new kn(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){ln[e]=new kn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ln[e]=new kn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ln[e]=new kn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ln[e]=new kn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ln[e]=new kn(e,5,!1,e.toLowerCase(),null,!1,!1)});var mg=/[\-:]([a-z])/g;function gg(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(mg,gg);ln[t]=new kn(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(mg,gg);ln[t]=new kn(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(mg,gg);ln[t]=new kn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ln[e]=new kn(e,1,!1,e.toLowerCase(),null,!1,!1)});ln.xlinkHref=new kn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ln[e]=new kn(e,1,!1,e.toLowerCase(),null,!0,!0)});function yg(e,t,n,r){var o=ln.hasOwnProperty(t)?ln[t]:null;(o!==null?o.type!==0:r||!(2<t.length)||t[0]!=="o"&&t[0]!=="O"||t[1]!=="n"&&t[1]!=="N")&&(X_(t,n,o,r)&&(n=null),r||o===null?K_(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 Oo=sb.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,hu=Symbol.for("react.element"),Hs=Symbol.for("react.portal"),Ws=Symbol.for("react.fragment"),vg=Symbol.for("react.strict_mode"),Tp=Symbol.for("react.profiler"),lb=Symbol.for("react.provider"),cb=Symbol.for("react.context"),xg=Symbol.for("react.forward_ref"),kp=Symbol.for("react.suspense"),Rp=Symbol.for("react.suspense_list"),wg=Symbol.for("react.memo"),Yo=Symbol.for("react.lazy"),ub=Symbol.for("react.offscreen"),J0=Symbol.iterator;function rl(e){return e===null||typeof e!="object"?null:(e=J0&&e[J0]||e["@@iterator"],typeof e=="function"?e:null)}var Pt=Object.assign,Rh;function Sl(e){if(Rh===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);Rh=t&&t[1]||""}return`
77
+ `+Rh+e}var _h=!1;function Ih(e,t){if(!e||_h)return"";_h=!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{_h=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Sl(e):""}function J_(e){switch(e.tag){case 5:return Sl(e.type);case 16:return Sl("Lazy");case 13:return Sl("Suspense");case 19:return Sl("SuspenseList");case 0:case 2:case 15:return e=Ih(e.type,!1),e;case 11:return e=Ih(e.type.render,!1),e;case 1:return e=Ih(e.type,!0),e;default:return""}}function _p(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 Ws:return"Fragment";case Hs:return"Portal";case Tp:return"Profiler";case vg:return"StrictMode";case kp:return"Suspense";case Rp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case cb:return(e.displayName||"Context")+".Consumer";case lb:return(e._context.displayName||"Context")+".Provider";case xg:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case wg:return t=e.displayName||null,t!==null?t:_p(e.type)||"Memo";case Yo:t=e._payload,e=e._init;try{return _p(e(t))}catch{}}return null}function Z_(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 _p(t);case 8:return t===vg?"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 yi(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function db(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function eI(e){var t=db(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 pu(e){e._valueTracker||(e._valueTracker=eI(e))}function fb(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=db(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function id(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 Ip(e,t){var n=t.checked;return Pt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Z0(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=yi(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 hb(e,t){t=t.checked,t!=null&&yg(e,"checked",t,!1)}function Dp(e,t){hb(e,t);var n=yi(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")?Ap(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ap(e,t.type,yi(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function ex(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 Ap(e,t,n){(t!=="number"||id(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var bl=Array.isArray;function la(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=""+yi(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 Np(e,t){if(t.dangerouslySetInnerHTML!=null)throw Error(K(91));return Pt({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function tx(e,t){var n=t.value;if(n==null){if(n=t.children,t=t.defaultValue,n!=null){if(t!=null)throw Error(K(92));if(bl(n)){if(1<n.length)throw Error(K(93));n=n[0]}t=n}t==null&&(t=""),n=t}e._wrapperState={initialValue:yi(n)}}function pb(e,t){var n=yi(t.value),r=yi(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 nx(e){var t=e.textContent;t===e._wrapperState.initialValue&&t!==""&&t!==null&&(e.value=t)}function mb(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 Op(e,t){return e==null||e==="http://www.w3.org/1999/xhtml"?mb(t):e==="http://www.w3.org/2000/svg"&&t==="foreignObject"?"http://www.w3.org/1999/xhtml":e}var mu,gb=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(mu=mu||document.createElement("div"),mu.innerHTML="<svg>"+t.valueOf().toString()+"</svg>",t=mu.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Bl(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Tl={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},tI=["Webkit","ms","Moz","O"];Object.keys(Tl).forEach(function(e){tI.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Tl[t]=Tl[e]})});function yb(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Tl.hasOwnProperty(e)&&Tl[e]?(""+t).trim():t+"px"}function vb(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=yb(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var nI=Pt({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(nI[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(K(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(K(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(K(61))}if(t.style!=null&&typeof t.style!="object")throw Error(K(62))}}function $p(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Lp=null;function Sg(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Fp=null,ca=null,ua=null;function rx(e){if(e=Cc(e)){if(typeof Fp!="function")throw Error(K(280));var t=e.stateNode;t&&(t=af(t),Fp(e.stateNode,e.type,t))}}function xb(e){ca?ua?ua.push(e):ua=[e]:ca=e}function wb(){if(ca){var e=ca,t=ua;if(ua=ca=null,rx(e),t)for(e=0;e<t.length;e++)rx(t[e])}}function Sb(e,t){return e(t)}function bb(){}var Dh=!1;function Cb(e,t,n){if(Dh)return e(t,n);Dh=!0;try{return Sb(e,t,n)}finally{Dh=!1,(ca!==null||ua!==null)&&(bb(),wb())}}function Ul(e,t){var n=e.stateNode;if(n===null)return null;var r=af(n);if(r===null)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(n&&typeof n!="function")throw Error(K(231,t,typeof n));return n}var zp=!1;if(Eo)try{var ol={};Object.defineProperty(ol,"passive",{get:function(){zp=!0}}),window.addEventListener("test",ol,ol),window.removeEventListener("test",ol,ol)}catch{zp=!1}function rI(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 kl=!1,sd=null,ad=!1,Bp=null,oI={onError:function(e){kl=!0,sd=e}};function iI(e,t,n,r,o,i,s,l,c){kl=!1,sd=null,rI.apply(oI,arguments)}function sI(e,t,n,r,o,i,s,l,c){if(iI.apply(this,arguments),kl){if(kl){var u=sd;kl=!1,sd=null}else throw Error(K(198));ad||(ad=!0,Bp=u)}}function ms(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 Eb(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 ox(e){if(ms(e)!==e)throw Error(K(188))}function aI(e){var t=e.alternate;if(!t){if(t=ms(e),t===null)throw Error(K(188));return t!==e?null:e}for(var n=e,r=t;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return ox(o),e;if(i===r)return ox(o),t;i=i.sibling}throw Error(K(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,l=o.child;l;){if(l===n){s=!0,n=o,r=i;break}if(l===r){s=!0,r=o,n=i;break}l=l.sibling}if(!s){for(l=i.child;l;){if(l===n){s=!0,n=i,r=o;break}if(l===r){s=!0,r=i,n=o;break}l=l.sibling}if(!s)throw Error(K(189))}}if(n.alternate!==r)throw Error(K(190))}if(n.tag!==3)throw Error(K(188));return n.stateNode.current===n?e:t}function jb(e){return e=aI(e),e!==null?Pb(e):null}function Pb(e){if(e.tag===5||e.tag===6)return e;for(e=e.child;e!==null;){var t=Pb(e);if(t!==null)return t;e=e.sibling}return null}var Tb=Yn.unstable_scheduleCallback,ix=Yn.unstable_cancelCallback,lI=Yn.unstable_shouldYield,cI=Yn.unstable_requestPaint,zt=Yn.unstable_now,uI=Yn.unstable_getCurrentPriorityLevel,bg=Yn.unstable_ImmediatePriority,kb=Yn.unstable_UserBlockingPriority,ld=Yn.unstable_NormalPriority,dI=Yn.unstable_LowPriority,Rb=Yn.unstable_IdlePriority,nf=null,eo=null;function fI(e){if(eo&&typeof eo.onCommitFiberRoot=="function")try{eo.onCommitFiberRoot(nf,e,void 0,(e.current.flags&128)===128)}catch{}}var Dr=Math.clz32?Math.clz32:mI,hI=Math.log,pI=Math.LN2;function mI(e){return e>>>=0,e===0?32:31-(hI(e)/pI|0)|0}var gu=64,yu=4194304;function Cl(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 cd(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=Cl(l):(i&=s,i!==0&&(r=Cl(i)))}else s=n&~o,s!==0?r=Cl(s):i!==0&&(r=Cl(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-Dr(t),o=1<<n,r|=e[n],t&=~o;return r}function gI(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 yI(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,i=e.pendingLanes;0<i;){var s=31-Dr(i),l=1<<s,c=o[s];c===-1?(!(l&n)||l&r)&&(o[s]=gI(l,t)):c<=t&&(e.expiredLanes|=l),i&=~l}}function Up(e){return e=e.pendingLanes&-1073741825,e!==0?e:e&1073741824?1073741824:0}function _b(){var e=gu;return gu<<=1,!(gu&4194240)&&(gu=64),e}function Ah(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Sc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Dr(t),e[t]=n}function vI(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-Dr(n),i=1<<o;t[o]=0,r[o]=-1,e[o]=-1,n&=~i}}function Cg(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Dr(n),o=1<<r;o&t|e[r]&t&&(e[r]|=t),n&=~o}}var Ze=0;function Ib(e){return e&=-e,1<e?4<e?e&268435455?16:536870912:4:1}var Db,Eg,Ab,Nb,Ob,Vp=!1,vu=[],ai=null,li=null,ci=null,Vl=new Map,Hl=new Map,ti=[],xI="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 sx(e,t){switch(e){case"focusin":case"focusout":ai=null;break;case"dragenter":case"dragleave":li=null;break;case"mouseover":case"mouseout":ci=null;break;case"pointerover":case"pointerout":Vl.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Hl.delete(t.pointerId)}}function il(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=Cc(t),t!==null&&Eg(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function wI(e,t,n,r,o){switch(t){case"focusin":return ai=il(ai,e,t,n,r,o),!0;case"dragenter":return li=il(li,e,t,n,r,o),!0;case"mouseover":return ci=il(ci,e,t,n,r,o),!0;case"pointerover":var i=o.pointerId;return Vl.set(i,il(Vl.get(i)||null,e,t,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Hl.set(i,il(Hl.get(i)||null,e,t,n,r,o)),!0}return!1}function Mb(e){var t=Bi(e.target);if(t!==null){var n=ms(t);if(n!==null){if(t=n.tag,t===13){if(t=Eb(n),t!==null){e.blockedOn=t,Ob(e.priority,function(){Ab(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 Bu(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=Hp(e.domEventName,e.eventSystemFlags,t[0],e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Lp=r,n.target.dispatchEvent(r),Lp=null}else return t=Cc(n),t!==null&&Eg(t),e.blockedOn=n,!1;t.shift()}return!0}function ax(e,t,n){Bu(e)&&n.delete(t)}function SI(){Vp=!1,ai!==null&&Bu(ai)&&(ai=null),li!==null&&Bu(li)&&(li=null),ci!==null&&Bu(ci)&&(ci=null),Vl.forEach(ax),Hl.forEach(ax)}function sl(e,t){e.blockedOn===t&&(e.blockedOn=null,Vp||(Vp=!0,Yn.unstable_scheduleCallback(Yn.unstable_NormalPriority,SI)))}function Wl(e){function t(o){return sl(o,e)}if(0<vu.length){sl(vu[0],e);for(var n=1;n<vu.length;n++){var r=vu[n];r.blockedOn===e&&(r.blockedOn=null)}}for(ai!==null&&sl(ai,e),li!==null&&sl(li,e),ci!==null&&sl(ci,e),Vl.forEach(t),Hl.forEach(t),n=0;n<ti.length;n++)r=ti[n],r.blockedOn===e&&(r.blockedOn=null);for(;0<ti.length&&(n=ti[0],n.blockedOn===null);)Mb(n),n.blockedOn===null&&ti.shift()}var da=Oo.ReactCurrentBatchConfig,ud=!0;function bI(e,t,n,r){var o=Ze,i=da.transition;da.transition=null;try{Ze=1,jg(e,t,n,r)}finally{Ze=o,da.transition=i}}function CI(e,t,n,r){var o=Ze,i=da.transition;da.transition=null;try{Ze=4,jg(e,t,n,r)}finally{Ze=o,da.transition=i}}function jg(e,t,n,r){if(ud){var o=Hp(e,t,n,r);if(o===null)Vh(e,t,r,dd,n),sx(e,r);else if(wI(o,e,t,n,r))r.stopPropagation();else if(sx(e,r),t&4&&-1<xI.indexOf(e)){for(;o!==null;){var i=Cc(o);if(i!==null&&Db(i),i=Hp(e,t,n,r),i===null&&Vh(e,t,r,dd,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else Vh(e,t,r,null,n)}}var dd=null;function Hp(e,t,n,r){if(dd=null,e=Sg(r),e=Bi(e),e!==null)if(t=ms(e),t===null)e=null;else if(n=t.tag,n===13){if(e=Eb(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 dd=e,null}function $b(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(uI()){case bg:return 1;case kb:return 4;case ld:case dI:return 16;case Rb:return 536870912;default:return 16}default:return 16}}var oi=null,Pg=null,Uu=null;function Lb(){if(Uu)return Uu;var e,t=Pg,n=t.length,r,o="value"in oi?oi.value:oi.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 Uu=o.slice(e,1<r?1-r:void 0)}function Vu(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 xu(){return!0}function lx(){return!1}function nr(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)?xu:lx,this.isPropagationStopped=lx,this}return Pt(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=xu)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=xu)},persist:function(){},isPersistent:xu}),t}var Fa={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Tg=nr(Fa),bc=Pt({},Fa,{view:0,detail:0}),EI=nr(bc),Nh,Oh,al,rf=Pt({},bc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:kg,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!==al&&(al&&e.type==="mousemove"?(Nh=e.screenX-al.screenX,Oh=e.screenY-al.screenY):Oh=Nh=0,al=e),Nh)},movementY:function(e){return"movementY"in e?e.movementY:Oh}}),cx=nr(rf),jI=Pt({},rf,{dataTransfer:0}),PI=nr(jI),TI=Pt({},bc,{relatedTarget:0}),Mh=nr(TI),kI=Pt({},Fa,{animationName:0,elapsedTime:0,pseudoElement:0}),RI=nr(kI),_I=Pt({},Fa,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),II=nr(_I),DI=Pt({},Fa,{data:0}),ux=nr(DI),AI={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},NI={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"},OI={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function MI(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=OI[e])?!!t[e]:!1}function kg(){return MI}var $I=Pt({},bc,{key:function(e){if(e.key){var t=AI[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Vu(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?NI[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:kg,charCode:function(e){return e.type==="keypress"?Vu(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Vu(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),LI=nr($I),FI=Pt({},rf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),dx=nr(FI),zI=Pt({},bc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:kg}),BI=nr(zI),UI=Pt({},Fa,{propertyName:0,elapsedTime:0,pseudoElement:0}),VI=nr(UI),HI=Pt({},rf,{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}),WI=nr(HI),qI=[9,13,27,32],Rg=Eo&&"CompositionEvent"in window,Rl=null;Eo&&"documentMode"in document&&(Rl=document.documentMode);var GI=Eo&&"TextEvent"in window&&!Rl,Fb=Eo&&(!Rg||Rl&&8<Rl&&11>=Rl),fx=" ",hx=!1;function zb(e,t){switch(e){case"keyup":return qI.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Bb(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var qs=!1;function QI(e,t){switch(e){case"compositionend":return Bb(t);case"keypress":return t.which!==32?null:(hx=!0,fx);case"textInput":return e=t.data,e===fx&&hx?null:e;default:return null}}function KI(e,t){if(qs)return e==="compositionend"||!Rg&&zb(e,t)?(e=Lb(),Uu=Pg=oi=null,qs=!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 Fb&&t.locale!=="ko"?null:t.data;default:return null}}var YI={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 px(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!YI[e.type]:t==="textarea"}function Ub(e,t,n,r){xb(r),t=fd(t,"onChange"),0<t.length&&(n=new Tg("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var _l=null,ql=null;function XI(e){Zb(e,0)}function of(e){var t=Ks(e);if(fb(t))return e}function JI(e,t){if(e==="change")return t}var Vb=!1;if(Eo){var $h;if(Eo){var Lh="oninput"in document;if(!Lh){var mx=document.createElement("div");mx.setAttribute("oninput","return;"),Lh=typeof mx.oninput=="function"}$h=Lh}else $h=!1;Vb=$h&&(!document.documentMode||9<document.documentMode)}function gx(){_l&&(_l.detachEvent("onpropertychange",Hb),ql=_l=null)}function Hb(e){if(e.propertyName==="value"&&of(ql)){var t=[];Ub(t,ql,e,Sg(e)),Cb(XI,t)}}function ZI(e,t,n){e==="focusin"?(gx(),_l=t,ql=n,_l.attachEvent("onpropertychange",Hb)):e==="focusout"&&gx()}function eD(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return of(ql)}function tD(e,t){if(e==="click")return of(t)}function nD(e,t){if(e==="input"||e==="change")return of(t)}function rD(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Or=typeof Object.is=="function"?Object.is:rD;function Gl(e,t){if(Or(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(!Pp.call(t,o)||!Or(e[o],t[o]))return!1}return!0}function yx(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vx(e,t){var n=yx(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=yx(n)}}function Wb(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Wb(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function qb(){for(var e=window,t=id();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=id(e.document)}return t}function _g(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 oD(e){var t=qb(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Wb(n.ownerDocument.documentElement,n)){if(r!==null&&_g(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=vx(n,i);var s=vx(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 iD=Eo&&"documentMode"in document&&11>=document.documentMode,Gs=null,Wp=null,Il=null,qp=!1;function xx(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;qp||Gs==null||Gs!==id(r)||(r=Gs,"selectionStart"in r&&_g(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}),Il&&Gl(Il,r)||(Il=r,r=fd(Wp,"onSelect"),0<r.length&&(t=new Tg("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=Gs)))}function wu(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Qs={animationend:wu("Animation","AnimationEnd"),animationiteration:wu("Animation","AnimationIteration"),animationstart:wu("Animation","AnimationStart"),transitionend:wu("Transition","TransitionEnd")},Fh={},Gb={};Eo&&(Gb=document.createElement("div").style,"AnimationEvent"in window||(delete Qs.animationend.animation,delete Qs.animationiteration.animation,delete Qs.animationstart.animation),"TransitionEvent"in window||delete Qs.transitionend.transition);function sf(e){if(Fh[e])return Fh[e];if(!Qs[e])return e;var t=Qs[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in Gb)return Fh[e]=t[n];return e}var Qb=sf("animationend"),Kb=sf("animationiteration"),Yb=sf("animationstart"),Xb=sf("transitionend"),Jb=new Map,wx="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 Ci(e,t){Jb.set(e,t),ps(t,[e])}for(var zh=0;zh<wx.length;zh++){var Bh=wx[zh],sD=Bh.toLowerCase(),aD=Bh[0].toUpperCase()+Bh.slice(1);Ci(sD,"on"+aD)}Ci(Qb,"onAnimationEnd");Ci(Kb,"onAnimationIteration");Ci(Yb,"onAnimationStart");Ci("dblclick","onDoubleClick");Ci("focusin","onFocus");Ci("focusout","onBlur");Ci(Xb,"onTransitionEnd");ga("onMouseEnter",["mouseout","mouseover"]);ga("onMouseLeave",["mouseout","mouseover"]);ga("onPointerEnter",["pointerout","pointerover"]);ga("onPointerLeave",["pointerout","pointerover"]);ps("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));ps("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));ps("onBeforeInput",["compositionend","keypress","textInput","paste"]);ps("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));ps("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));ps("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var El="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(" "),lD=new Set("cancel close invalid load scroll toggle".split(" ").concat(El));function Sx(e,t,n){var r=e.type||"unknown-event";e.currentTarget=n,sI(r,t,void 0,e),e.currentTarget=null}function Zb(e,t){t=(t&4)!==0;for(var n=0;n<e.length;n++){var r=e[n],o=r.event;r=r.listeners;e:{var i=void 0;if(t)for(var s=r.length-1;0<=s;s--){var l=r[s],c=l.instance,u=l.currentTarget;if(l=l.listener,c!==i&&o.isPropagationStopped())break e;Sx(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;Sx(o,l,u),i=c}}}if(ad)throw e=Bp,ad=!1,Bp=null,e}function yt(e,t){var n=t[Xp];n===void 0&&(n=t[Xp]=new Set);var r=e+"__bubble";n.has(r)||(eC(t,e,2,!1),n.add(r))}function Uh(e,t,n){var r=0;t&&(r|=4),eC(n,e,r,t)}var Su="_reactListening"+Math.random().toString(36).slice(2);function Ql(e){if(!e[Su]){e[Su]=!0,ab.forEach(function(n){n!=="selectionchange"&&(lD.has(n)||Uh(n,!1,e),Uh(n,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Su]||(t[Su]=!0,Uh("selectionchange",!1,t))}}function eC(e,t,n,r){switch($b(t)){case 1:var o=bI;break;case 4:o=CI;break;default:o=jg}n=o.bind(null,t,n,e),o=void 0,!zp||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 Vh(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=Bi(l),s===null)return;if(c=s.tag,c===5||c===6){r=i=s;continue e}l=l.parentNode}}r=r.return}Cb(function(){var u=i,d=Sg(n),f=[];e:{var h=Jb.get(e);if(h!==void 0){var m=Tg,g=e;switch(e){case"keypress":if(Vu(n)===0)break e;case"keydown":case"keyup":m=LI;break;case"focusin":g="focus",m=Mh;break;case"focusout":g="blur",m=Mh;break;case"beforeblur":case"afterblur":m=Mh;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=cx;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":m=PI;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":m=BI;break;case Qb:case Kb:case Yb:m=RI;break;case Xb:m=VI;break;case"scroll":m=EI;break;case"wheel":m=WI;break;case"copy":case"cut":case"paste":m=II;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":m=dx}var y=(t&4)!==0,S=!y&&e==="scroll",v=y?h!==null?h+"Capture":null:h;y=[];for(var x=u,w;x!==null;){w=x;var b=w.stateNode;if(w.tag===5&&b!==null&&(w=b,v!==null&&(b=Ul(x,v),b!=null&&y.push(Kl(x,b,w)))),S)break;x=x.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!==Lp&&(g=n.relatedTarget||n.fromElement)&&(Bi(g)||g[jo]))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?Bi(g):null,g!==null&&(S=ms(g),g!==S||g.tag!==5&&g.tag!==6)&&(g=null)):(m=null,g=u),m!==g)){if(y=cx,b="onMouseLeave",v="onMouseEnter",x="mouse",(e==="pointerout"||e==="pointerover")&&(y=dx,b="onPointerLeave",v="onPointerEnter",x="pointer"),S=m==null?h:Ks(m),w=g==null?h:Ks(g),h=new y(b,x+"leave",m,n,d),h.target=S,h.relatedTarget=w,b=null,Bi(d)===u&&(y=new y(v,x+"enter",g,n,d),y.target=w,y.relatedTarget=S,b=y),S=b,m&&g)t:{for(y=m,v=g,x=0,w=y;w;w=Ms(w))x++;for(w=0,b=v;b;b=Ms(b))w++;for(;0<x-w;)y=Ms(y),x--;for(;0<w-x;)v=Ms(v),w--;for(;x--;){if(y===v||v!==null&&y===v.alternate)break t;y=Ms(y),v=Ms(v)}y=null}else y=null;m!==null&&bx(f,h,m,y,!1),g!==null&&S!==null&&bx(f,S,g,y,!0)}}e:{if(h=u?Ks(u):window,m=h.nodeName&&h.nodeName.toLowerCase(),m==="select"||m==="input"&&h.type==="file")var j=JI;else if(px(h))if(Vb)j=nD;else{j=eD;var E=ZI}else(m=h.nodeName)&&m.toLowerCase()==="input"&&(h.type==="checkbox"||h.type==="radio")&&(j=tD);if(j&&(j=j(e,u))){Ub(f,j,n,d);break e}E&&E(e,h,u),e==="focusout"&&(E=h._wrapperState)&&E.controlled&&h.type==="number"&&Ap(h,"number",h.value)}switch(E=u?Ks(u):window,e){case"focusin":(px(E)||E.contentEditable==="true")&&(Gs=E,Wp=u,Il=null);break;case"focusout":Il=Wp=Gs=null;break;case"mousedown":qp=!0;break;case"contextmenu":case"mouseup":case"dragend":qp=!1,xx(f,n,d);break;case"selectionchange":if(iD)break;case"keydown":case"keyup":xx(f,n,d)}var P;if(Rg)e:{switch(e){case"compositionstart":var T="onCompositionStart";break e;case"compositionend":T="onCompositionEnd";break e;case"compositionupdate":T="onCompositionUpdate";break e}T=void 0}else qs?zb(e,n)&&(T="onCompositionEnd"):e==="keydown"&&n.keyCode===229&&(T="onCompositionStart");T&&(Fb&&n.locale!=="ko"&&(qs||T!=="onCompositionStart"?T==="onCompositionEnd"&&qs&&(P=Lb()):(oi=d,Pg="value"in oi?oi.value:oi.textContent,qs=!0)),E=fd(u,T),0<E.length&&(T=new ux(T,e,null,n,d),f.push({event:T,listeners:E}),P?T.data=P:(P=Bb(n),P!==null&&(T.data=P)))),(P=GI?QI(e,n):KI(e,n))&&(u=fd(u,"onBeforeInput"),0<u.length&&(d=new ux("onBeforeInput","beforeinput",null,n,d),f.push({event:d,listeners:u}),d.data=P))}Zb(f,t)})}function Kl(e,t,n){return{instance:e,listener:t,currentTarget:n}}function fd(e,t){for(var n=t+"Capture",r=[];e!==null;){var o=e,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Ul(e,n),i!=null&&r.unshift(Kl(e,i,o)),i=Ul(e,t),i!=null&&r.push(Kl(e,i,o))),e=e.return}return r}function Ms(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5);return e||null}function bx(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=Ul(n,i),c!=null&&s.unshift(Kl(n,c,l))):o||(c=Ul(n,i),c!=null&&s.push(Kl(n,c,l)))),n=n.return}s.length!==0&&e.push({event:t,listeners:s})}var cD=/\r\n?/g,uD=/\u0000|\uFFFD/g;function Cx(e){return(typeof e=="string"?e:""+e).replace(cD,`
81
+ `).replace(uD,"")}function bu(e,t,n){if(t=Cx(t),Cx(e)!==t&&n)throw Error(K(425))}function hd(){}var Gp=null,Qp=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 Yp=typeof setTimeout=="function"?setTimeout:void 0,dD=typeof clearTimeout=="function"?clearTimeout:void 0,Ex=typeof Promise=="function"?Promise:void 0,fD=typeof queueMicrotask=="function"?queueMicrotask:typeof Ex<"u"?function(e){return Ex.resolve(null).then(e).catch(hD)}:Yp;function hD(e){setTimeout(function(){throw e})}function Hh(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),Wl(t);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=o}while(n);Wl(t)}function ui(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 jx(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 za=Math.random().toString(36).slice(2),Zr="__reactFiber$"+za,Yl="__reactProps$"+za,jo="__reactContainer$"+za,Xp="__reactEvents$"+za,pD="__reactListeners$"+za,mD="__reactHandles$"+za;function Bi(e){var t=e[Zr];if(t)return t;for(var n=e.parentNode;n;){if(t=n[jo]||n[Zr]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=jx(e);e!==null;){if(n=e[Zr])return n;e=jx(e)}return t}e=n,n=e.parentNode}return null}function Cc(e){return e=e[Zr]||e[jo],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function Ks(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(K(33))}function af(e){return e[Yl]||null}var Jp=[],Ys=-1;function Ei(e){return{current:e}}function xt(e){0>Ys||(e.current=Jp[Ys],Jp[Ys]=null,Ys--)}function dt(e,t){Ys++,Jp[Ys]=e.current,e.current=t}var vi={},gn=Ei(vi),Mn=Ei(!1),Xi=vi;function ya(e,t){var n=e.type.contextTypes;if(!n)return vi;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 $n(e){return e=e.childContextTypes,e!=null}function pd(){xt(Mn),xt(gn)}function Px(e,t,n){if(gn.current!==vi)throw Error(K(168));dt(gn,t),dt(Mn,n)}function tC(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(K(108,Z_(e)||"Unknown",o));return Pt({},n,r)}function md(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||vi,Xi=gn.current,dt(gn,e),dt(Mn,Mn.current),!0}function Tx(e,t,n){var r=e.stateNode;if(!r)throw Error(K(169));n?(e=tC(e,t,Xi),r.__reactInternalMemoizedMergedChildContext=e,xt(Mn),xt(gn),dt(gn,e)):xt(Mn),dt(Mn,n)}var go=null,lf=!1,Wh=!1;function nC(e){go===null?go=[e]:go.push(e)}function gD(e){lf=!0,nC(e)}function ji(){if(!Wh&&go!==null){Wh=!0;var e=0,t=Ze;try{var n=go;for(Ze=1;e<n.length;e++){var r=n[e];do r=r(!0);while(r!==null)}go=null,lf=!1}catch(o){throw go!==null&&(go=go.slice(e+1)),Tb(bg,ji),o}finally{Ze=t,Wh=!1}}return null}var Xs=[],Js=0,gd=null,yd=0,cr=[],ur=0,Ji=null,yo=1,vo="";function Oi(e,t){Xs[Js++]=yd,Xs[Js++]=gd,gd=e,yd=t}function rC(e,t,n){cr[ur++]=yo,cr[ur++]=vo,cr[ur++]=Ji,Ji=e;var r=yo;e=vo;var o=32-Dr(r)-1;r&=~(1<<o),n+=1;var i=32-Dr(t)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,yo=1<<32-Dr(t)+o|n<<o|r,vo=i+e}else yo=1<<i|n<<o|r,vo=e}function Ig(e){e.return!==null&&(Oi(e,1),rC(e,1,0))}function Dg(e){for(;e===gd;)gd=Xs[--Js],Xs[Js]=null,yd=Xs[--Js],Xs[Js]=null;for(;e===Ji;)Ji=cr[--ur],cr[ur]=null,vo=cr[--ur],cr[ur]=null,yo=cr[--ur],cr[ur]=null}var Kn=null,Gn=null,St=!1,_r=null;function oC(e,t){var n=dr(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 kx(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,Kn=e,Gn=ui(t.firstChild),!0):!1;case 6:return t=e.pendingProps===""||t.nodeType!==3?null:t,t!==null?(e.stateNode=t,Kn=e,Gn=null,!0):!1;case 13:return t=t.nodeType!==8?null:t,t!==null?(n=Ji!==null?{id:yo,overflow:vo}:null,e.memoizedState={dehydrated:t,treeContext:n,retryLane:1073741824},n=dr(18,null,null,0),n.stateNode=t,n.return=e,e.child=n,Kn=e,Gn=null,!0):!1;default:return!1}}function Zp(e){return(e.mode&1)!==0&&(e.flags&128)===0}function em(e){if(St){var t=Gn;if(t){var n=t;if(!kx(e,t)){if(Zp(e))throw Error(K(418));t=ui(n.nextSibling);var r=Kn;t&&kx(e,t)?oC(r,n):(e.flags=e.flags&-4097|2,St=!1,Kn=e)}}else{if(Zp(e))throw Error(K(418));e.flags=e.flags&-4097|2,St=!1,Kn=e}}}function Rx(e){for(e=e.return;e!==null&&e.tag!==5&&e.tag!==3&&e.tag!==13;)e=e.return;Kn=e}function Cu(e){if(e!==Kn)return!1;if(!St)return Rx(e),St=!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=Gn)){if(Zp(e))throw iC(),Error(K(418));for(;t;)oC(e,t),t=ui(t.nextSibling)}if(Rx(e),e.tag===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(K(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8){var n=e.data;if(n==="/$"){if(t===0){Gn=ui(e.nextSibling);break e}t--}else n!=="$"&&n!=="$!"&&n!=="$?"||t++}e=e.nextSibling}Gn=null}}else Gn=Kn?ui(e.stateNode.nextSibling):null;return!0}function iC(){for(var e=Gn;e;)e=ui(e.nextSibling)}function va(){Gn=Kn=null,St=!1}function Ag(e){_r===null?_r=[e]:_r.push(e)}var yD=Oo.ReactCurrentBatchConfig;function Tr(e,t){if(e&&e.defaultProps){t=Pt({},t),e=e.defaultProps;for(var n in e)t[n]===void 0&&(t[n]=e[n]);return t}return t}var vd=Ei(null),xd=null,Zs=null,Ng=null;function Og(){Ng=Zs=xd=null}function Mg(e){var t=vd.current;xt(vd),e._currentValue=t}function tm(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 fa(e,t){xd=e,Ng=Zs=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(On=!0),e.firstContext=null)}function pr(e){var t=e._currentValue;if(Ng!==e)if(e={context:e,memoizedValue:t,next:null},Zs===null){if(xd===null)throw Error(K(308));Zs=e,xd.dependencies={lanes:0,firstContext:e}}else Zs=Zs.next=e;return t}var Ui=null;function $g(e){Ui===null?Ui=[e]:Ui.push(e)}function sC(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,$g(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 Xo=!1;function Lg(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function aC(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 xo(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function di(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,qe&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,$g(r)):(t.next=o.next,o.next=t),r.interleaved=t,Po(e,n)}function Hu(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,Cg(e,n)}}function _x(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 wd(e,t,n,r){var o=e.updateQueue;Xo=!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=Pt({},f,h);break e;case 2:Xo=!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);es|=s,e.lanes=s,e.memoizedState=f}}function Ix(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;t<e.length;t++){var r=e[t],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(K(191,o));o.call(r)}}}var lC=new sb.Component().refs;function nm(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:Pt({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var cf={isMounted:function(e){return(e=e._reactInternals)?ms(e)===e:!1},enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Cn(),o=hi(e),i=xo(r,o);i.payload=t,n!=null&&(i.callback=n),t=di(e,i,o),t!==null&&(Ar(t,e,o,r),Hu(t,e,o))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Cn(),o=hi(e),i=xo(r,o);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=di(e,i,o),t!==null&&(Ar(t,e,o,r),Hu(t,e,o))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Cn(),r=hi(e),o=xo(n,r);o.tag=2,t!=null&&(o.callback=t),t=di(e,o,r),t!==null&&(Ar(t,e,r,n),Hu(t,e,r))}};function Dx(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?!Gl(n,r)||!Gl(o,i):!0}function cC(e,t,n){var r=!1,o=vi,i=t.contextType;return typeof i=="object"&&i!==null?i=pr(i):(o=$n(t)?Xi:gn.current,r=t.contextTypes,i=(r=r!=null)?ya(e,o):vi),t=new t(n,i),e.memoizedState=t.state!==null&&t.state!==void 0?t.state:null,t.updater=cf,e.stateNode=t,t._reactInternals=e,r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=o,e.__reactInternalMemoizedMaskedChildContext=i),t}function Ax(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&&cf.enqueueReplaceState(t,t.state,null)}function rm(e,t,n,r){var o=e.stateNode;o.props=n,o.state=e.memoizedState,o.refs=lC,Lg(e);var i=t.contextType;typeof i=="object"&&i!==null?o.context=pr(i):(i=$n(t)?Xi:gn.current,o.context=ya(e,i)),o.state=e.memoizedState,i=t.getDerivedStateFromProps,typeof i=="function"&&(nm(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&&cf.enqueueReplaceState(o,o.state,null),wd(e,n,o,r),o.state=e.memoizedState),typeof o.componentDidMount=="function"&&(e.flags|=4194308)}function ll(e,t,n){if(e=n.ref,e!==null&&typeof e!="function"&&typeof e!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(K(309));var r=n.stateNode}if(!r)throw Error(K(147,e));var o=r,i=""+e;return t!==null&&t.ref!==null&&typeof t.ref=="function"&&t.ref._stringRef===i?t.ref:(t=function(s){var l=o.refs;l===lC&&(l=o.refs={}),s===null?delete l[i]:l[i]=s},t._stringRef=i,t)}if(typeof e!="string")throw Error(K(284));if(!n._owner)throw Error(K(290,e))}return e}function Eu(e,t){throw e=Object.prototype.toString.call(t),Error(K(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e))}function Nx(e){var t=e._init;return t(e._payload)}function uC(e){function t(v,x){if(e){var w=v.deletions;w===null?(v.deletions=[x],v.flags|=16):w.push(x)}}function n(v,x){if(!e)return null;for(;x!==null;)t(v,x),x=x.sibling;return null}function r(v,x){for(v=new Map;x!==null;)x.key!==null?v.set(x.key,x):v.set(x.index,x),x=x.sibling;return v}function o(v,x){return v=pi(v,x),v.index=0,v.sibling=null,v}function i(v,x,w){return v.index=w,e?(w=v.alternate,w!==null?(w=w.index,w<x?(v.flags|=2,x):w):(v.flags|=2,x)):(v.flags|=1048576,x)}function s(v){return e&&v.alternate===null&&(v.flags|=2),v}function l(v,x,w,b){return x===null||x.tag!==6?(x=Jh(w,v.mode,b),x.return=v,x):(x=o(x,w),x.return=v,x)}function c(v,x,w,b){var j=w.type;return j===Ws?d(v,x,w.props.children,b,w.key):x!==null&&(x.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Yo&&Nx(j)===x.type)?(b=o(x,w.props),b.ref=ll(v,x,w),b.return=v,b):(b=Yu(w.type,w.key,w.props,null,v.mode,b),b.ref=ll(v,x,w),b.return=v,b)}function u(v,x,w,b){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=Zh(w,v.mode,b),x.return=v,x):(x=o(x,w.children||[]),x.return=v,x)}function d(v,x,w,b,j){return x===null||x.tag!==7?(x=Ki(w,v.mode,b,j),x.return=v,x):(x=o(x,w),x.return=v,x)}function f(v,x,w){if(typeof x=="string"&&x!==""||typeof x=="number")return x=Jh(""+x,v.mode,w),x.return=v,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case hu:return w=Yu(x.type,x.key,x.props,null,v.mode,w),w.ref=ll(v,null,x),w.return=v,w;case Hs:return x=Zh(x,v.mode,w),x.return=v,x;case Yo:var b=x._init;return f(v,b(x._payload),w)}if(bl(x)||rl(x))return x=Ki(x,v.mode,w,null),x.return=v,x;Eu(v,x)}return null}function h(v,x,w,b){var j=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return j!==null?null:l(v,x,""+w,b);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case hu:return w.key===j?c(v,x,w,b):null;case Hs:return w.key===j?u(v,x,w,b):null;case Yo:return j=w._init,h(v,x,j(w._payload),b)}if(bl(w)||rl(w))return j!==null?null:d(v,x,w,b,null);Eu(v,w)}return null}function m(v,x,w,b,j){if(typeof b=="string"&&b!==""||typeof b=="number")return v=v.get(w)||null,l(x,v,""+b,j);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case hu:return v=v.get(b.key===null?w:b.key)||null,c(x,v,b,j);case Hs:return v=v.get(b.key===null?w:b.key)||null,u(x,v,b,j);case Yo:var E=b._init;return m(v,x,w,E(b._payload),j)}if(bl(b)||rl(b))return v=v.get(w)||null,d(x,v,b,j,null);Eu(x,b)}return null}function g(v,x,w,b){for(var j=null,E=null,P=x,T=x=0,_=null;P!==null&&T<w.length;T++){P.index>T?(_=P,P=null):_=P.sibling;var D=h(v,P,w[T],b);if(D===null){P===null&&(P=_);break}e&&P&&D.alternate===null&&t(v,P),x=i(D,x,T),E===null?j=D:E.sibling=D,E=D,P=_}if(T===w.length)return n(v,P),St&&Oi(v,T),j;if(P===null){for(;T<w.length;T++)P=f(v,w[T],b),P!==null&&(x=i(P,x,T),E===null?j=P:E.sibling=P,E=P);return St&&Oi(v,T),j}for(P=r(v,P);T<w.length;T++)_=m(P,v,T,w[T],b),_!==null&&(e&&_.alternate!==null&&P.delete(_.key===null?T:_.key),x=i(_,x,T),E===null?j=_:E.sibling=_,E=_);return e&&P.forEach(function(O){return t(v,O)}),St&&Oi(v,T),j}function y(v,x,w,b){var j=rl(w);if(typeof j!="function")throw Error(K(150));if(w=j.call(w),w==null)throw Error(K(151));for(var E=j=null,P=x,T=x=0,_=null,D=w.next();P!==null&&!D.done;T++,D=w.next()){P.index>T?(_=P,P=null):_=P.sibling;var O=h(v,P,D.value,b);if(O===null){P===null&&(P=_);break}e&&P&&O.alternate===null&&t(v,P),x=i(O,x,T),E===null?j=O:E.sibling=O,E=O,P=_}if(D.done)return n(v,P),St&&Oi(v,T),j;if(P===null){for(;!D.done;T++,D=w.next())D=f(v,D.value,b),D!==null&&(x=i(D,x,T),E===null?j=D:E.sibling=D,E=D);return St&&Oi(v,T),j}for(P=r(v,P);!D.done;T++,D=w.next())D=m(P,v,T,D.value,b),D!==null&&(e&&D.alternate!==null&&P.delete(D.key===null?T:D.key),x=i(D,x,T),E===null?j=D:E.sibling=D,E=D);return e&&P.forEach(function(I){return t(v,I)}),St&&Oi(v,T),j}function S(v,x,w,b){if(typeof w=="object"&&w!==null&&w.type===Ws&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case hu:e:{for(var j=w.key,E=x;E!==null;){if(E.key===j){if(j=w.type,j===Ws){if(E.tag===7){n(v,E.sibling),x=o(E,w.props.children),x.return=v,v=x;break e}}else if(E.elementType===j||typeof j=="object"&&j!==null&&j.$$typeof===Yo&&Nx(j)===E.type){n(v,E.sibling),x=o(E,w.props),x.ref=ll(v,E,w),x.return=v,v=x;break e}n(v,E);break}else t(v,E);E=E.sibling}w.type===Ws?(x=Ki(w.props.children,v.mode,b,w.key),x.return=v,v=x):(b=Yu(w.type,w.key,w.props,null,v.mode,b),b.ref=ll(v,x,w),b.return=v,v=b)}return s(v);case Hs:e:{for(E=w.key;x!==null;){if(x.key===E)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(v,x.sibling),x=o(x,w.children||[]),x.return=v,v=x;break e}else{n(v,x);break}else t(v,x);x=x.sibling}x=Zh(w,v.mode,b),x.return=v,v=x}return s(v);case Yo:return E=w._init,S(v,x,E(w._payload),b)}if(bl(w))return g(v,x,w,b);if(rl(w))return y(v,x,w,b);Eu(v,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(v,x.sibling),x=o(x,w),x.return=v,v=x):(n(v,x),x=Jh(w,v.mode,b),x.return=v,v=x),s(v)):n(v,x)}return S}var xa=uC(!0),dC=uC(!1),Ec={},to=Ei(Ec),Xl=Ei(Ec),Jl=Ei(Ec);function Vi(e){if(e===Ec)throw Error(K(174));return e}function Fg(e,t){switch(dt(Jl,t),dt(Xl,e),dt(to,Ec),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Op(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Op(t,e)}xt(to),dt(to,t)}function wa(){xt(to),xt(Xl),xt(Jl)}function fC(e){Vi(Jl.current);var t=Vi(to.current),n=Op(t,e.type);t!==n&&(dt(Xl,e),dt(to,n))}function zg(e){Xl.current===e&&(xt(to),xt(Xl))}var Ct=Ei(0);function Sd(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 qh=[];function Bg(){for(var e=0;e<qh.length;e++)qh[e]._workInProgressVersionPrimary=null;qh.length=0}var Wu=Oo.ReactCurrentDispatcher,Gh=Oo.ReactCurrentBatchConfig,Zi=0,jt=null,Wt=null,Yt=null,bd=!1,Dl=!1,Zl=0,vD=0;function cn(){throw Error(K(321))}function Ug(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Or(e[n],t[n]))return!1;return!0}function Vg(e,t,n,r,o,i){if(Zi=i,jt=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,Wu.current=e===null||e.memoizedState===null?bD:CD,e=n(r,o),Dl){i=0;do{if(Dl=!1,Zl=0,25<=i)throw Error(K(301));i+=1,Yt=Wt=null,t.updateQueue=null,Wu.current=ED,e=n(r,o)}while(Dl)}if(Wu.current=Cd,t=Wt!==null&&Wt.next!==null,Zi=0,Yt=Wt=jt=null,bd=!1,t)throw Error(K(300));return e}function Hg(){var e=Zl!==0;return Zl=0,e}function Yr(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Yt===null?jt.memoizedState=Yt=e:Yt=Yt.next=e,Yt}function mr(){if(Wt===null){var e=jt.alternate;e=e!==null?e.memoizedState:null}else e=Wt.next;var t=Yt===null?jt.memoizedState:Yt.next;if(t!==null)Yt=t,Wt=e;else{if(e===null)throw Error(K(310));Wt=e,e={memoizedState:Wt.memoizedState,baseState:Wt.baseState,baseQueue:Wt.baseQueue,queue:Wt.queue,next:null},Yt===null?jt.memoizedState=Yt=e:Yt=Yt.next=e}return Yt}function ec(e,t){return typeof t=="function"?t(e):t}function Qh(e){var t=mr(),n=t.queue;if(n===null)throw Error(K(311));n.lastRenderedReducer=e;var r=Wt,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((Zi&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,jt.lanes|=d,es|=d}u=u.next}while(u!==null&&u!==i);c===null?s=r:c.next=l,Or(r,t.memoizedState)||(On=!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,jt.lanes|=i,es|=i,o=o.next;while(o!==e)}else o===null&&(n.lanes=0);return[t.memoizedState,n.dispatch]}function Kh(e){var t=mr(),n=t.queue;if(n===null)throw Error(K(311));n.lastRenderedReducer=e;var r=n.dispatch,o=n.pending,i=t.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=e(i,s.action),s=s.next;while(s!==o);Or(i,t.memoizedState)||(On=!0),t.memoizedState=i,t.baseQueue===null&&(t.baseState=i),n.lastRenderedState=i}return[i,r]}function hC(){}function pC(e,t){var n=jt,r=mr(),o=t(),i=!Or(r.memoizedState,o);if(i&&(r.memoizedState=o,On=!0),r=r.queue,Wg(yC.bind(null,n,r,e),[e]),r.getSnapshot!==t||i||Yt!==null&&Yt.memoizedState.tag&1){if(n.flags|=2048,tc(9,gC.bind(null,n,r,o,t),void 0,null),Jt===null)throw Error(K(349));Zi&30||mC(n,t,o)}return o}function mC(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=jt.updateQueue,t===null?(t={lastEffect:null,stores:null},jt.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function gC(e,t,n,r){t.value=n,t.getSnapshot=r,vC(t)&&xC(e)}function yC(e,t,n){return n(function(){vC(t)&&xC(e)})}function vC(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Or(e,n)}catch{return!0}}function xC(e){var t=Po(e,1);t!==null&&Ar(t,e,1,-1)}function Ox(e){var t=Yr();return typeof e=="function"&&(e=e()),t.memoizedState=t.baseState=e,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ec,lastRenderedState:e},t.queue=e,e=e.dispatch=SD.bind(null,jt,e),[t.memoizedState,e]}function tc(e,t,n,r){return e={tag:e,create:t,destroy:n,deps:r,next:null},t=jt.updateQueue,t===null?(t={lastEffect:null,stores:null},jt.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 wC(){return mr().memoizedState}function qu(e,t,n,r){var o=Yr();jt.flags|=e,o.memoizedState=tc(1|t,n,void 0,r===void 0?null:r)}function uf(e,t,n,r){var o=mr();r=r===void 0?null:r;var i=void 0;if(Wt!==null){var s=Wt.memoizedState;if(i=s.destroy,r!==null&&Ug(r,s.deps)){o.memoizedState=tc(t,n,i,r);return}}jt.flags|=e,o.memoizedState=tc(1|t,n,i,r)}function Mx(e,t){return qu(8390656,8,e,t)}function Wg(e,t){return uf(2048,8,e,t)}function SC(e,t){return uf(4,2,e,t)}function bC(e,t){return uf(4,4,e,t)}function CC(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 EC(e,t,n){return n=n!=null?n.concat([e]):null,uf(4,4,CC.bind(null,t,e),n)}function qg(){}function jC(e,t){var n=mr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ug(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function PC(e,t){var n=mr();t=t===void 0?null:t;var r=n.memoizedState;return r!==null&&t!==null&&Ug(t,r[1])?r[0]:(e=e(),n.memoizedState=[e,t],e)}function TC(e,t,n){return Zi&21?(Or(n,t)||(n=_b(),jt.lanes|=n,es|=n,e.baseState=!0),t):(e.baseState&&(e.baseState=!1,On=!0),e.memoizedState=n)}function xD(e,t){var n=Ze;Ze=n!==0&&4>n?n:4,e(!0);var r=Gh.transition;Gh.transition={};try{e(!1),t()}finally{Ze=n,Gh.transition=r}}function kC(){return mr().memoizedState}function wD(e,t,n){var r=hi(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},RC(e))_C(t,n);else if(n=sC(e,t,n,r),n!==null){var o=Cn();Ar(n,e,r,o),IC(n,t,r)}}function SD(e,t,n){var r=hi(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(RC(e))_C(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,Or(l,s)){var c=t.interleaved;c===null?(o.next=o,$g(t)):(o.next=c.next,c.next=o),t.interleaved=o;return}}catch{}finally{}n=sC(e,t,o,r),n!==null&&(o=Cn(),Ar(n,e,r,o),IC(n,t,r))}}function RC(e){var t=e.alternate;return e===jt||t!==null&&t===jt}function _C(e,t){Dl=bd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function IC(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Cg(e,n)}}var Cd={readContext:pr,useCallback:cn,useContext:cn,useEffect:cn,useImperativeHandle:cn,useInsertionEffect:cn,useLayoutEffect:cn,useMemo:cn,useReducer:cn,useRef:cn,useState:cn,useDebugValue:cn,useDeferredValue:cn,useTransition:cn,useMutableSource:cn,useSyncExternalStore:cn,useId:cn,unstable_isNewReconciler:!1},bD={readContext:pr,useCallback:function(e,t){return Yr().memoizedState=[e,t===void 0?null:t],e},useContext:pr,useEffect:Mx,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,qu(4194308,4,CC.bind(null,t,e),n)},useLayoutEffect:function(e,t){return qu(4194308,4,e,t)},useInsertionEffect:function(e,t){return qu(4,2,e,t)},useMemo:function(e,t){var n=Yr();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Yr();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=wD.bind(null,jt,e),[r.memoizedState,e]},useRef:function(e){var t=Yr();return e={current:e},t.memoizedState=e},useState:Ox,useDebugValue:qg,useDeferredValue:function(e){return Yr().memoizedState=e},useTransition:function(){var e=Ox(!1),t=e[0];return e=xD.bind(null,e[1]),Yr().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=jt,o=Yr();if(St){if(n===void 0)throw Error(K(407));n=n()}else{if(n=t(),Jt===null)throw Error(K(349));Zi&30||mC(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,Mx(yC.bind(null,r,i,e),[e]),r.flags|=2048,tc(9,gC.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=Yr(),t=Jt.identifierPrefix;if(St){var n=vo,r=yo;n=(r&~(1<<32-Dr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Zl++,0<n&&(t+="H"+n.toString(32)),t+=":"}else n=vD++,t=":"+t+"r"+n.toString(32)+":";return e.memoizedState=t},unstable_isNewReconciler:!1},CD={readContext:pr,useCallback:jC,useContext:pr,useEffect:Wg,useImperativeHandle:EC,useInsertionEffect:SC,useLayoutEffect:bC,useMemo:PC,useReducer:Qh,useRef:wC,useState:function(){return Qh(ec)},useDebugValue:qg,useDeferredValue:function(e){var t=mr();return TC(t,Wt.memoizedState,e)},useTransition:function(){var e=Qh(ec)[0],t=mr().memoizedState;return[e,t]},useMutableSource:hC,useSyncExternalStore:pC,useId:kC,unstable_isNewReconciler:!1},ED={readContext:pr,useCallback:jC,useContext:pr,useEffect:Wg,useImperativeHandle:EC,useInsertionEffect:SC,useLayoutEffect:bC,useMemo:PC,useReducer:Kh,useRef:wC,useState:function(){return Kh(ec)},useDebugValue:qg,useDeferredValue:function(e){var t=mr();return Wt===null?t.memoizedState=e:TC(t,Wt.memoizedState,e)},useTransition:function(){var e=Kh(ec)[0],t=mr().memoizedState;return[e,t]},useMutableSource:hC,useSyncExternalStore:pC,useId:kC,unstable_isNewReconciler:!1};function Sa(e,t){try{var n="",r=t;do n+=J_(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 Yh(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function om(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var jD=typeof WeakMap=="function"?WeakMap:Map;function DC(e,t,n){n=xo(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){jd||(jd=!0,pm=r),om(e,t)},n}function AC(e,t,n){n=xo(-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(){om(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){om(e,t),typeof r!="function"&&(fi===null?fi=new Set([this]):fi.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function $x(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new jD;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=FD.bind(null,e,t,n),t.then(e,e))}function Lx(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 Fx(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=xo(-1,1),t.tag=2,di(n,t,1))),n.lanes|=1),e)}var PD=Oo.ReactCurrentOwner,On=!1;function xn(e,t,n,r){t.child=e===null?dC(t,null,n,r):xa(t,e.child,n,r)}function zx(e,t,n,r,o){n=n.render;var i=t.ref;return fa(t,o),r=Vg(e,t,n,r,i,o),n=Hg(),e!==null&&!On?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,To(e,t,o)):(St&&n&&Ig(t),t.flags|=1,xn(e,t,r,o),t.child)}function Bx(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!ey(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,NC(e,t,i,r,o)):(e=Yu(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:Gl,n(s,r)&&e.ref===t.ref)return To(e,t,o)}return t.flags|=1,e=pi(i,r),e.ref=t.ref,e.return=t,t.child=e}function NC(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(Gl(i,r)&&e.ref===t.ref)if(On=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(On=!0);else return t.lanes=e.lanes,To(e,t,o)}return im(e,t,n,r,o)}function OC(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},dt(ta,Wn),Wn|=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,dt(ta,Wn),Wn|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,dt(ta,Wn),Wn|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,dt(ta,Wn),Wn|=r;return xn(e,t,o,n),t.child}function MC(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function im(e,t,n,r,o){var i=$n(n)?Xi:gn.current;return i=ya(t,i),fa(t,o),n=Vg(e,t,n,r,i,o),r=Hg(),e!==null&&!On?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,To(e,t,o)):(St&&r&&Ig(t),t.flags|=1,xn(e,t,n,o),t.child)}function Ux(e,t,n,r,o){if($n(n)){var i=!0;md(t)}else i=!1;if(fa(t,o),t.stateNode===null)Gu(e,t),cC(t,n,r),rm(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=pr(u):(u=$n(n)?Xi:gn.current,u=ya(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)&&Ax(t,s,r,u),Xo=!1;var h=t.memoizedState;s.state=h,wd(t,r,s,o),c=t.memoizedState,l!==r||h!==c||Mn.current||Xo?(typeof d=="function"&&(nm(t,n,d,r),c=t.memoizedState),(l=Xo||Dx(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,aC(e,t),l=t.memoizedProps,u=t.type===t.elementType?l:Tr(t.type,l),s.props=u,f=t.pendingProps,h=s.context,c=n.contextType,typeof c=="object"&&c!==null?c=pr(c):(c=$n(n)?Xi:gn.current,c=ya(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)&&Ax(t,s,r,c),Xo=!1,h=t.memoizedState,s.state=h,wd(t,r,s,o);var g=t.memoizedState;l!==f||h!==g||Mn.current||Xo?(typeof m=="function"&&(nm(t,n,m,r),g=t.memoizedState),(u=Xo||Dx(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 sm(e,t,n,r,i,o)}function sm(e,t,n,r,o,i){MC(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&Tx(t,n,!1),To(e,t,i);r=t.stateNode,PD.current=t;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=xa(t,e.child,null,i),t.child=xa(t,null,l,i)):xn(e,t,l,i),t.memoizedState=r.state,o&&Tx(t,n,!0),t.child}function $C(e){var t=e.stateNode;t.pendingContext?Px(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Px(e,t.context,!1),Fg(e,t.containerInfo)}function Vx(e,t,n,r,o){return va(),Ag(o),t.flags|=256,xn(e,t,n,r),t.child}var am={dehydrated:null,treeContext:null,retryLane:0};function lm(e){return{baseLanes:e,cachePool:null,transitions:null}}function LC(e,t,n){var r=t.pendingProps,o=Ct.current,i=!1,s=(t.flags&128)!==0,l;if((l=s)||(l=e!==null&&e.memoizedState===null?!1:(o&2)!==0),l?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),dt(Ct,o&1),e===null)return em(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=hf(s,r,0,null),e=Ki(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=lm(n),t.memoizedState=am,e):Gg(t,s));if(o=e.memoizedState,o!==null&&(l=o.dehydrated,l!==null))return TD(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=pi(o,c),r.subtreeFlags=o.subtreeFlags&14680064),l!==null?i=pi(l,i):(i=Ki(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?lm(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=am,r}return i=e.child,e=i.sibling,r=pi(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 Gg(e,t){return t=hf({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ju(e,t,n,r){return r!==null&&Ag(r),xa(t,e.child,null,n),e=Gg(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function TD(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=Yh(Error(K(422))),ju(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=hf({mode:"visible",children:r.children},o,0,null),i=Ki(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&xa(t,e.child,null,s),t.child.memoizedState=lm(s),t.memoizedState=am,i);if(!(t.mode&1))return ju(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(K(419)),r=Yh(i,r,void 0),ju(e,t,s,r)}if(l=(s&e.childLanes)!==0,On||l){if(r=Jt,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),Ar(r,e,o,-1))}return Zg(),r=Yh(Error(K(421))),ju(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=zD.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Gn=ui(o.nextSibling),Kn=t,St=!0,_r=null,e!==null&&(cr[ur++]=yo,cr[ur++]=vo,cr[ur++]=Ji,yo=e.id,vo=e.overflow,Ji=t),t=Gg(t,r.children),t.flags|=4096,t)}function Hx(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),tm(e.return,t,n)}function Xh(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 FC(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(xn(e,t,r.children,n),r=Ct.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Hx(e,n,t);else if(e.tag===19)Hx(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(dt(Ct,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&Sd(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),Xh(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&&Sd(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}Xh(t,!0,n,null,i);break;case"together":Xh(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Gu(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function To(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),es|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(K(153));if(t.child!==null){for(e=t.child,n=pi(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=pi(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function kD(e,t,n){switch(t.tag){case 3:$C(t),va();break;case 5:fC(t);break;case 1:$n(t.type)&&md(t);break;case 4:Fg(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;dt(vd,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(dt(Ct,Ct.current&1),t.flags|=128,null):n&t.child.childLanes?LC(e,t,n):(dt(Ct,Ct.current&1),e=To(e,t,n),e!==null?e.sibling:null);dt(Ct,Ct.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return FC(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),dt(Ct,Ct.current),r)break;return null;case 22:case 23:return t.lanes=0,OC(e,t,n)}return To(e,t,n)}var zC,cm,BC,UC;zC=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}};cm=function(){};BC=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,Vi(to.current);var i=null;switch(n){case"input":o=Ip(e,o),r=Ip(e,r),i=[];break;case"select":o=Pt({},o,{value:void 0}),r=Pt({},r,{value:void 0}),i=[];break;case"textarea":o=Np(e,o),r=Np(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=hd)}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"&&(zl.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"&&(zl.hasOwnProperty(u)?(c!=null&&u==="onScroll"&&yt("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)}};UC=function(e,t,n,r){n!==r&&(t.flags|=4)};function cl(e,t){if(!St)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function un(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 RD(e,t,n){var r=t.pendingProps;switch(Dg(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return un(t),null;case 1:return $n(t.type)&&pd(),un(t),null;case 3:return r=t.stateNode,wa(),xt(Mn),xt(gn),Bg(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(Cu(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,_r!==null&&(ym(_r),_r=null))),cm(e,t),un(t),null;case 5:zg(t);var o=Vi(Jl.current);if(n=t.type,e!==null&&t.stateNode!=null)BC(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(K(166));return un(t),null}if(e=Vi(to.current),Cu(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[Zr]=t,r[Yl]=i,e=(t.mode&1)!==0,n){case"dialog":yt("cancel",r),yt("close",r);break;case"iframe":case"object":case"embed":yt("load",r);break;case"video":case"audio":for(o=0;o<El.length;o++)yt(El[o],r);break;case"source":yt("error",r);break;case"img":case"image":case"link":yt("error",r),yt("load",r);break;case"details":yt("toggle",r);break;case"input":Z0(r,i),yt("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},yt("invalid",r);break;case"textarea":tx(r,i),yt("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&&bu(r.textContent,l,e),o=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&bu(r.textContent,l,e),o=["children",""+l]):zl.hasOwnProperty(s)&&l!=null&&s==="onScroll"&&yt("scroll",r)}switch(n){case"input":pu(r),ex(r,i,!0);break;case"textarea":pu(r),nx(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=hd)}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=mb(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[Zr]=t,e[Yl]=r,zC(e,t,!1,!1),t.stateNode=e;e:{switch(s=$p(n,r),n){case"dialog":yt("cancel",e),yt("close",e),o=r;break;case"iframe":case"object":case"embed":yt("load",e),o=r;break;case"video":case"audio":for(o=0;o<El.length;o++)yt(El[o],e);o=r;break;case"source":yt("error",e),o=r;break;case"img":case"image":case"link":yt("error",e),yt("load",e),o=r;break;case"details":yt("toggle",e),o=r;break;case"input":Z0(e,r),o=Ip(e,r),yt("invalid",e);break;case"option":o=r;break;case"select":e._wrapperState={wasMultiple:!!r.multiple},o=Pt({},r,{value:void 0}),yt("invalid",e);break;case"textarea":tx(e,r),o=Np(e,r),yt("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"?vb(e,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&gb(e,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Bl(e,c):typeof c=="number"&&Bl(e,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(zl.hasOwnProperty(i)?c!=null&&i==="onScroll"&&yt("scroll",e):c!=null&&yg(e,i,c,s))}switch(n){case"input":pu(e),ex(e,r,!1);break;case"textarea":pu(e),nx(e);break;case"option":r.value!=null&&e.setAttribute("value",""+yi(r.value));break;case"select":e.multiple=!!r.multiple,i=r.value,i!=null?la(e,!!r.multiple,i,!1):r.defaultValue!=null&&la(e,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(e.onclick=hd)}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 un(t),null;case 6:if(e&&t.stateNode!=null)UC(e,t,e.memoizedProps,r);else{if(typeof r!="string"&&t.stateNode===null)throw Error(K(166));if(n=Vi(Jl.current),Vi(to.current),Cu(t)){if(r=t.stateNode,n=t.memoizedProps,r[Zr]=t,(i=r.nodeValue!==n)&&(e=Kn,e!==null))switch(e.tag){case 3:bu(r.nodeValue,n,(e.mode&1)!==0);break;case 5:e.memoizedProps.suppressHydrationWarning!==!0&&bu(r.nodeValue,n,(e.mode&1)!==0)}i&&(t.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Zr]=t,t.stateNode=r}return un(t),null;case 13:if(xt(Ct),r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(St&&Gn!==null&&t.mode&1&&!(t.flags&128))iC(),va(),t.flags|=98560,i=!1;else if(i=Cu(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(K(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(K(317));i[Zr]=t}else va(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;un(t),i=!1}else _r!==null&&(ym(_r),_r=null),i=!0;if(!i)return t.flags&65536?t:null}return t.flags&128?(t.lanes=n,t):(r=r!==null,r!==(e!==null&&e.memoizedState!==null)&&r&&(t.child.flags|=8192,t.mode&1&&(e===null||Ct.current&1?qt===0&&(qt=3):Zg())),t.updateQueue!==null&&(t.flags|=4),un(t),null);case 4:return wa(),cm(e,t),e===null&&Ql(t.stateNode.containerInfo),un(t),null;case 10:return Mg(t.type._context),un(t),null;case 17:return $n(t.type)&&pd(),un(t),null;case 19:if(xt(Ct),i=t.memoizedState,i===null)return un(t),null;if(r=(t.flags&128)!==0,s=i.rendering,s===null)if(r)cl(i,!1);else{if(qt!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(s=Sd(e),s!==null){for(t.flags|=128,cl(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 dt(Ct,Ct.current&1|2),t.child}e=e.sibling}i.tail!==null&&zt()>ba&&(t.flags|=128,r=!0,cl(i,!1),t.lanes=4194304)}else{if(!r)if(e=Sd(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),cl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!St)return un(t),null}else 2*zt()-i.renderingStartTime>ba&&n!==1073741824&&(t.flags|=128,r=!0,cl(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=zt(),t.sibling=null,n=Ct.current,dt(Ct,r?n&1|2:n&1),t):(un(t),null);case 22:case 23:return Jg(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Wn&1073741824&&(un(t),t.subtreeFlags&6&&(t.flags|=8192)):un(t),null;case 24:return null;case 25:return null}throw Error(K(156,t.tag))}function _D(e,t){switch(Dg(t),t.tag){case 1:return $n(t.type)&&pd(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return wa(),xt(Mn),xt(gn),Bg(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return zg(t),null;case 13:if(xt(Ct),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(K(340));va()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return xt(Ct),null;case 4:return wa(),null;case 10:return Mg(t.type._context),null;case 22:case 23:return Jg(),null;case 24:return null;default:return null}}var Pu=!1,fn=!1,ID=typeof WeakSet=="function"?WeakSet:Set,ae=null;function ea(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){_t(e,t,r)}else n.current=null}function um(e,t,n){try{n()}catch(r){_t(e,t,r)}}var Wx=!1;function DD(e,t){if(Gp=ud,e=qb(),_g(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(Qp={focusedElem:e,selectionRange:n},ud=!1,ae=t;ae!==null;)if(t=ae,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ae=e;else for(;ae!==null;){t=ae;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,S=g.memoizedState,v=t.stateNode,x=v.getSnapshotBeforeUpdate(t.elementType===t.type?y:Tr(t.type,y),S);v.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=t.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(K(163))}}catch(b){_t(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,ae=e;break}ae=t.return}return g=Wx,Wx=!1,g}function Al(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&&um(t,n,i)}o=o.next}while(o!==r)}}function df(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 dm(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 VC(e){var t=e.alternate;t!==null&&(e.alternate=null,VC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Zr],delete t[Yl],delete t[Xp],delete t[pD],delete t[mD])),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 HC(e){return e.tag===5||e.tag===3||e.tag===4}function qx(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||HC(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 fm(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=hd));else if(r!==4&&(e=e.child,e!==null))for(fm(e,t,n),e=e.sibling;e!==null;)fm(e,t,n),e=e.sibling}function hm(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(hm(e,t,n),e=e.sibling;e!==null;)hm(e,t,n),e=e.sibling}var nn=null,kr=!1;function Qo(e,t,n){for(n=n.child;n!==null;)WC(e,t,n),n=n.sibling}function WC(e,t,n){if(eo&&typeof eo.onCommitFiberUnmount=="function")try{eo.onCommitFiberUnmount(nf,n)}catch{}switch(n.tag){case 5:fn||ea(n,t);case 6:var r=nn,o=kr;nn=null,Qo(e,t,n),nn=r,kr=o,nn!==null&&(kr?(e=nn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):nn.removeChild(n.stateNode));break;case 18:nn!==null&&(kr?(e=nn,n=n.stateNode,e.nodeType===8?Hh(e.parentNode,n):e.nodeType===1&&Hh(e,n),Wl(e)):Hh(nn,n.stateNode));break;case 4:r=nn,o=kr,nn=n.stateNode.containerInfo,kr=!0,Qo(e,t,n),nn=r,kr=o;break;case 0:case 11:case 14:case 15:if(!fn&&(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)&&um(n,t,s),o=o.next}while(o!==r)}Qo(e,t,n);break;case 1:if(!fn&&(ea(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){_t(n,t,l)}Qo(e,t,n);break;case 21:Qo(e,t,n);break;case 22:n.mode&1?(fn=(r=fn)||n.memoizedState!==null,Qo(e,t,n),fn=r):Qo(e,t,n);break;default:Qo(e,t,n)}}function Gx(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new ID),t.forEach(function(r){var o=BD.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Er(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:nn=l.stateNode,kr=!1;break e;case 3:nn=l.stateNode.containerInfo,kr=!0;break e;case 4:nn=l.stateNode.containerInfo,kr=!0;break e}l=l.return}if(nn===null)throw Error(K(160));WC(i,s,o),nn=null,kr=!1;var c=o.alternate;c!==null&&(c.return=null),o.return=null}catch(u){_t(o,t,u)}}if(t.subtreeFlags&12854)for(t=t.child;t!==null;)qC(t,e),t=t.sibling}function qC(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(Er(t,e),Gr(e),r&4){try{Al(3,e,e.return),df(3,e)}catch(y){_t(e,e.return,y)}try{Al(5,e,e.return)}catch(y){_t(e,e.return,y)}}break;case 1:Er(t,e),Gr(e),r&512&&n!==null&&ea(n,n.return);break;case 5:if(Er(t,e),Gr(e),r&512&&n!==null&&ea(n,n.return),e.flags&32){var o=e.stateNode;try{Bl(o,"")}catch(y){_t(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&&hb(o,i),$p(l,s);var u=$p(l,i);for(s=0;s<c.length;s+=2){var d=c[s],f=c[s+1];d==="style"?vb(o,f):d==="dangerouslySetInnerHTML"?gb(o,f):d==="children"?Bl(o,f):yg(o,d,f,u)}switch(l){case"input":Dp(o,i);break;case"textarea":pb(o,i);break;case"select":var h=o._wrapperState.wasMultiple;o._wrapperState.wasMultiple=!!i.multiple;var m=i.value;m!=null?la(o,!!i.multiple,m,!1):h!==!!i.multiple&&(i.defaultValue!=null?la(o,!!i.multiple,i.defaultValue,!0):la(o,!!i.multiple,i.multiple?[]:"",!1))}o[Yl]=i}catch(y){_t(e,e.return,y)}}break;case 6:if(Er(t,e),Gr(e),r&4){if(e.stateNode===null)throw Error(K(162));o=e.stateNode,i=e.memoizedProps;try{o.nodeValue=i}catch(y){_t(e,e.return,y)}}break;case 3:if(Er(t,e),Gr(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Wl(t.containerInfo)}catch(y){_t(e,e.return,y)}break;case 4:Er(t,e),Gr(e);break;case 13:Er(t,e),Gr(e),o=e.child,o.flags&8192&&(i=o.memoizedState!==null,o.stateNode.isHidden=i,!i||o.alternate!==null&&o.alternate.memoizedState!==null||(Yg=zt())),r&4&&Gx(e);break;case 22:if(d=n!==null&&n.memoizedState!==null,e.mode&1?(fn=(u=fn)||d,Er(t,e),fn=u):Er(t,e),Gr(e),r&8192){if(u=e.memoizedState!==null,(e.stateNode.isHidden=u)&&!d&&e.mode&1)for(ae=e,d=e.child;d!==null;){for(f=ae=d;ae!==null;){switch(h=ae,m=h.child,h.tag){case 0:case 11:case 14:case 15:Al(4,h,h.return);break;case 1:ea(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){_t(r,n,y)}}break;case 5:ea(h,h.return);break;case 22:if(h.memoizedState!==null){Kx(f);continue}}m!==null?(m.return=h,ae=m):Kx(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=yb("display",s))}catch(y){_t(e,e.return,y)}}}else if(f.tag===6){if(d===null)try{f.stateNode.nodeValue=u?"":f.memoizedProps}catch(y){_t(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:Er(t,e),Gr(e),r&4&&Gx(e);break;case 21:break;default:Er(t,e),Gr(e)}}function Gr(e){var t=e.flags;if(t&2){try{e:{for(var n=e.return;n!==null;){if(HC(n)){var r=n;break e}n=n.return}throw Error(K(160))}switch(r.tag){case 5:var o=r.stateNode;r.flags&32&&(Bl(o,""),r.flags&=-33);var i=qx(e);hm(e,i,o);break;case 3:case 4:var s=r.stateNode.containerInfo,l=qx(e);fm(e,l,s);break;default:throw Error(K(161))}}catch(c){_t(e,e.return,c)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function AD(e,t,n){ae=e,GC(e)}function GC(e,t,n){for(var r=(e.mode&1)!==0;ae!==null;){var o=ae,i=o.child;if(o.tag===22&&r){var s=o.memoizedState!==null||Pu;if(!s){var l=o.alternate,c=l!==null&&l.memoizedState!==null||fn;l=Pu;var u=fn;if(Pu=s,(fn=c)&&!u)for(ae=o;ae!==null;)s=ae,c=s.child,s.tag===22&&s.memoizedState!==null?Yx(o):c!==null?(c.return=s,ae=c):Yx(o);for(;i!==null;)ae=i,GC(i),i=i.sibling;ae=o,Pu=l,fn=u}Qx(e)}else o.subtreeFlags&8772&&i!==null?(i.return=o,ae=i):Qx(e)}}function Qx(e){for(;ae!==null;){var t=ae;if(t.flags&8772){var n=t.alternate;try{if(t.flags&8772)switch(t.tag){case 0:case 11:case 15:fn||df(5,t);break;case 1:var r=t.stateNode;if(t.flags&4&&!fn)if(n===null)r.componentDidMount();else{var o=t.elementType===t.type?n.memoizedProps:Tr(t.type,n.memoizedProps);r.componentDidUpdate(o,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=t.updateQueue;i!==null&&Ix(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}Ix(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&&Wl(f)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(K(163))}fn||t.flags&512&&dm(t)}catch(h){_t(t,t.return,h)}}if(t===e){ae=null;break}if(n=t.sibling,n!==null){n.return=t.return,ae=n;break}ae=t.return}}function Kx(e){for(;ae!==null;){var t=ae;if(t===e){ae=null;break}var n=t.sibling;if(n!==null){n.return=t.return,ae=n;break}ae=t.return}}function Yx(e){for(;ae!==null;){var t=ae;try{switch(t.tag){case 0:case 11:case 15:var n=t.return;try{df(4,t)}catch(c){_t(t,n,c)}break;case 1:var r=t.stateNode;if(typeof r.componentDidMount=="function"){var o=t.return;try{r.componentDidMount()}catch(c){_t(t,o,c)}}var i=t.return;try{dm(t)}catch(c){_t(t,i,c)}break;case 5:var s=t.return;try{dm(t)}catch(c){_t(t,s,c)}}}catch(c){_t(t,t.return,c)}if(t===e){ae=null;break}var l=t.sibling;if(l!==null){l.return=t.return,ae=l;break}ae=t.return}}var ND=Math.ceil,Ed=Oo.ReactCurrentDispatcher,Qg=Oo.ReactCurrentOwner,fr=Oo.ReactCurrentBatchConfig,qe=0,Jt=null,Ut=null,sn=0,Wn=0,ta=Ei(0),qt=0,nc=null,es=0,ff=0,Kg=0,Nl=null,Nn=null,Yg=0,ba=1/0,mo=null,jd=!1,pm=null,fi=null,Tu=!1,ii=null,Pd=0,Ol=0,mm=null,Qu=-1,Ku=0;function Cn(){return qe&6?zt():Qu!==-1?Qu:Qu=zt()}function hi(e){return e.mode&1?qe&2&&sn!==0?sn&-sn:yD.transition!==null?(Ku===0&&(Ku=_b()),Ku):(e=Ze,e!==0||(e=window.event,e=e===void 0?16:$b(e.type)),e):1}function Ar(e,t,n,r){if(50<Ol)throw Ol=0,mm=null,Error(K(185));Sc(e,n,r),(!(qe&2)||e!==Jt)&&(e===Jt&&(!(qe&2)&&(ff|=n),qt===4&&ni(e,sn)),Ln(e,r),n===1&&qe===0&&!(t.mode&1)&&(ba=zt()+500,lf&&ji()))}function Ln(e,t){var n=e.callbackNode;yI(e,t);var r=cd(e,e===Jt?sn:0);if(r===0)n!==null&&ix(n),e.callbackNode=null,e.callbackPriority=0;else if(t=r&-r,e.callbackPriority!==t){if(n!=null&&ix(n),t===1)e.tag===0?gD(Xx.bind(null,e)):nC(Xx.bind(null,e)),fD(function(){!(qe&6)&&ji()}),n=null;else{switch(Ib(r)){case 1:n=bg;break;case 4:n=kb;break;case 16:n=ld;break;case 536870912:n=Rb;break;default:n=ld}n=tE(n,QC.bind(null,e))}e.callbackPriority=t,e.callbackNode=n}}function QC(e,t){if(Qu=-1,Ku=0,qe&6)throw Error(K(327));var n=e.callbackNode;if(ha()&&e.callbackNode!==n)return null;var r=cd(e,e===Jt?sn:0);if(r===0)return null;if(r&30||r&e.expiredLanes||t)t=Td(e,r);else{t=r;var o=qe;qe|=2;var i=YC();(Jt!==e||sn!==t)&&(mo=null,ba=zt()+500,Qi(e,t));do try{$D();break}catch(l){KC(e,l)}while(!0);Og(),Ed.current=i,qe=o,Ut!==null?t=0:(Jt=null,sn=0,t=qt)}if(t!==0){if(t===2&&(o=Up(e),o!==0&&(r=o,t=gm(e,o))),t===1)throw n=nc,Qi(e,0),ni(e,r),Ln(e,zt()),n;if(t===6)ni(e,r);else{if(o=e.current.alternate,!(r&30)&&!OD(o)&&(t=Td(e,r),t===2&&(i=Up(e),i!==0&&(r=i,t=gm(e,i))),t===1))throw n=nc,Qi(e,0),ni(e,r),Ln(e,zt()),n;switch(e.finishedWork=o,e.finishedLanes=r,t){case 0:case 1:throw Error(K(345));case 2:Mi(e,Nn,mo);break;case 3:if(ni(e,r),(r&130023424)===r&&(t=Yg+500-zt(),10<t)){if(cd(e,0)!==0)break;if(o=e.suspendedLanes,(o&r)!==r){Cn(),e.pingedLanes|=e.suspendedLanes&o;break}e.timeoutHandle=Yp(Mi.bind(null,e,Nn,mo),t);break}Mi(e,Nn,mo);break;case 4:if(ni(e,r),(r&4194240)===r)break;for(t=e.eventTimes,o=-1;0<r;){var s=31-Dr(r);i=1<<s,s=t[s],s>o&&(o=s),r&=~i}if(r=o,r=zt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ND(r/1960))-r,10<r){e.timeoutHandle=Yp(Mi.bind(null,e,Nn,mo),r);break}Mi(e,Nn,mo);break;case 5:Mi(e,Nn,mo);break;default:throw Error(K(329))}}}return Ln(e,zt()),e.callbackNode===n?QC.bind(null,e):null}function gm(e,t){var n=Nl;return e.current.memoizedState.isDehydrated&&(Qi(e,t).flags|=256),e=Td(e,t),e!==2&&(t=Nn,Nn=n,t!==null&&ym(t)),e}function ym(e){Nn===null?Nn=e:Nn.push.apply(Nn,e)}function OD(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(!Or(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 ni(e,t){for(t&=~Kg,t&=~ff,e.suspendedLanes|=t,e.pingedLanes&=~t,e=e.expirationTimes;0<t;){var n=31-Dr(t),r=1<<n;e[n]=-1,t&=~r}}function Xx(e){if(qe&6)throw Error(K(327));ha();var t=cd(e,0);if(!(t&1))return Ln(e,zt()),null;var n=Td(e,t);if(e.tag!==0&&n===2){var r=Up(e);r!==0&&(t=r,n=gm(e,r))}if(n===1)throw n=nc,Qi(e,0),ni(e,t),Ln(e,zt()),n;if(n===6)throw Error(K(345));return e.finishedWork=e.current.alternate,e.finishedLanes=t,Mi(e,Nn,mo),Ln(e,zt()),null}function Xg(e,t){var n=qe;qe|=1;try{return e(t)}finally{qe=n,qe===0&&(ba=zt()+500,lf&&ji())}}function ts(e){ii!==null&&ii.tag===0&&!(qe&6)&&ha();var t=qe;qe|=1;var n=fr.transition,r=Ze;try{if(fr.transition=null,Ze=1,e)return e()}finally{Ze=r,fr.transition=n,qe=t,!(qe&6)&&ji()}}function Jg(){Wn=ta.current,xt(ta)}function Qi(e,t){e.finishedWork=null,e.finishedLanes=0;var n=e.timeoutHandle;if(n!==-1&&(e.timeoutHandle=-1,dD(n)),Ut!==null)for(n=Ut.return;n!==null;){var r=n;switch(Dg(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&pd();break;case 3:wa(),xt(Mn),xt(gn),Bg();break;case 5:zg(r);break;case 4:wa();break;case 13:xt(Ct);break;case 19:xt(Ct);break;case 10:Mg(r.type._context);break;case 22:case 23:Jg()}n=n.return}if(Jt=e,Ut=e=pi(e.current,null),sn=Wn=t,qt=0,nc=null,Kg=ff=es=0,Nn=Nl=null,Ui!==null){for(t=0;t<Ui.length;t++)if(n=Ui[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}Ui=null}return e}function KC(e,t){do{var n=Ut;try{if(Og(),Wu.current=Cd,bd){for(var r=jt.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}bd=!1}if(Zi=0,Yt=Wt=jt=null,Dl=!1,Zl=0,Qg.current=null,n===null||n.return===null){qt=1,nc=t,Ut=null;break}e:{var i=e,s=n.return,l=n,c=t;if(t=sn,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=Lx(s);if(m!==null){m.flags&=-257,Fx(m,s,l,i,t),m.mode&1&&$x(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)){$x(i,u,t),Zg();break e}c=Error(K(426))}}else if(St&&l.mode&1){var S=Lx(s);if(S!==null){!(S.flags&65536)&&(S.flags|=256),Fx(S,s,l,i,t),Ag(Sa(c,l));break e}}i=c=Sa(c,l),qt!==4&&(qt=2),Nl===null?Nl=[i]:Nl.push(i),i=s;do{switch(i.tag){case 3:i.flags|=65536,t&=-t,i.lanes|=t;var v=DC(i,c,t);_x(i,v);break e;case 1:l=c;var x=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof x.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(fi===null||!fi.has(w)))){i.flags|=65536,t&=-t,i.lanes|=t;var b=AC(i,l,t);_x(i,b);break e}}i=i.return}while(i!==null)}JC(n)}catch(j){t=j,Ut===n&&n!==null&&(Ut=n=n.return);continue}break}while(!0)}function YC(){var e=Ed.current;return Ed.current=Cd,e===null?Cd:e}function Zg(){(qt===0||qt===3||qt===2)&&(qt=4),Jt===null||!(es&268435455)&&!(ff&268435455)||ni(Jt,sn)}function Td(e,t){var n=qe;qe|=2;var r=YC();(Jt!==e||sn!==t)&&(mo=null,Qi(e,t));do try{MD();break}catch(o){KC(e,o)}while(!0);if(Og(),qe=n,Ed.current=r,Ut!==null)throw Error(K(261));return Jt=null,sn=0,qt}function MD(){for(;Ut!==null;)XC(Ut)}function $D(){for(;Ut!==null&&!lI();)XC(Ut)}function XC(e){var t=eE(e.alternate,e,Wn);e.memoizedProps=e.pendingProps,t===null?JC(e):Ut=t,Qg.current=null}function JC(e){var t=e;do{var n=t.alternate;if(e=t.return,t.flags&32768){if(n=_D(n,t),n!==null){n.flags&=32767,Ut=n;return}if(e!==null)e.flags|=32768,e.subtreeFlags=0,e.deletions=null;else{qt=6,Ut=null;return}}else if(n=RD(n,t,Wn),n!==null){Ut=n;return}if(t=t.sibling,t!==null){Ut=t;return}Ut=t=e}while(t!==null);qt===0&&(qt=5)}function Mi(e,t,n){var r=Ze,o=fr.transition;try{fr.transition=null,Ze=1,LD(e,t,n,r)}finally{fr.transition=o,Ze=r}return null}function LD(e,t,n,r){do ha();while(ii!==null);if(qe&6)throw Error(K(327));n=e.finishedWork;var o=e.finishedLanes;if(n===null)return null;if(e.finishedWork=null,e.finishedLanes=0,n===e.current)throw Error(K(177));e.callbackNode=null,e.callbackPriority=0;var i=n.lanes|n.childLanes;if(vI(e,i),e===Jt&&(Ut=Jt=null,sn=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Tu||(Tu=!0,tE(ld,function(){return ha(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=fr.transition,fr.transition=null;var s=Ze;Ze=1;var l=qe;qe|=4,Qg.current=null,DD(e,n),qC(n,e),oD(Qp),ud=!!Gp,Qp=Gp=null,e.current=n,AD(n),cI(),qe=l,Ze=s,fr.transition=i}else e.current=n;if(Tu&&(Tu=!1,ii=e,Pd=o),i=e.pendingLanes,i===0&&(fi=null),fI(n.stateNode),Ln(e,zt()),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(jd)throw jd=!1,e=pm,pm=null,e;return Pd&1&&e.tag!==0&&ha(),i=e.pendingLanes,i&1?e===mm?Ol++:(Ol=0,mm=e):Ol=0,ji(),null}function ha(){if(ii!==null){var e=Ib(Pd),t=fr.transition,n=Ze;try{if(fr.transition=null,Ze=16>e?16:e,ii===null)var r=!1;else{if(e=ii,ii=null,Pd=0,qe&6)throw Error(K(331));var o=qe;for(qe|=4,ae=e.current;ae!==null;){var i=ae,s=i.child;if(ae.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var u=l[c];for(ae=u;ae!==null;){var d=ae;switch(d.tag){case 0:case 11:case 15:Al(8,d,i)}var f=d.child;if(f!==null)f.return=d,ae=f;else for(;ae!==null;){d=ae;var h=d.sibling,m=d.return;if(VC(d),d===u){ae=null;break}if(h!==null){h.return=m,ae=h;break}ae=m}}}var g=i.alternate;if(g!==null){var y=g.child;if(y!==null){g.child=null;do{var S=y.sibling;y.sibling=null,y=S}while(y!==null)}}ae=i}}if(i.subtreeFlags&2064&&s!==null)s.return=i,ae=s;else e:for(;ae!==null;){if(i=ae,i.flags&2048)switch(i.tag){case 0:case 11:case 15:Al(9,i,i.return)}var v=i.sibling;if(v!==null){v.return=i.return,ae=v;break e}ae=i.return}}var x=e.current;for(ae=x;ae!==null;){s=ae;var w=s.child;if(s.subtreeFlags&2064&&w!==null)w.return=s,ae=w;else e:for(s=x;ae!==null;){if(l=ae,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:df(9,l)}}catch(j){_t(l,l.return,j)}if(l===s){ae=null;break e}var b=l.sibling;if(b!==null){b.return=l.return,ae=b;break e}ae=l.return}}if(qe=o,ji(),eo&&typeof eo.onPostCommitFiberRoot=="function")try{eo.onPostCommitFiberRoot(nf,e)}catch{}r=!0}return r}finally{Ze=n,fr.transition=t}}return!1}function Jx(e,t,n){t=Sa(n,t),t=DC(e,t,1),e=di(e,t,1),t=Cn(),e!==null&&(Sc(e,1,t),Ln(e,t))}function _t(e,t,n){if(e.tag===3)Jx(e,e,n);else for(;t!==null;){if(t.tag===3){Jx(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(fi===null||!fi.has(r))){e=Sa(n,e),e=AC(t,e,1),t=di(t,e,1),e=Cn(),t!==null&&(Sc(t,1,e),Ln(t,e));break}}t=t.return}}function FD(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),t=Cn(),e.pingedLanes|=e.suspendedLanes&n,Jt===e&&(sn&n)===n&&(qt===4||qt===3&&(sn&130023424)===sn&&500>zt()-Yg?Qi(e,0):Kg|=n),Ln(e,t)}function ZC(e,t){t===0&&(e.mode&1?(t=yu,yu<<=1,!(yu&130023424)&&(yu=4194304)):t=1);var n=Cn();e=Po(e,t),e!==null&&(Sc(e,t,n),Ln(e,n))}function zD(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ZC(e,n)}function BD(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(K(314))}r!==null&&r.delete(t),ZC(e,n)}var eE;eE=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Mn.current)On=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return On=!1,kD(e,t,n);On=!!(e.flags&131072)}else On=!1,St&&t.flags&1048576&&rC(t,yd,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Gu(e,t),e=t.pendingProps;var o=ya(t,gn.current);fa(t,n),o=Vg(null,t,r,e,o,n);var i=Hg();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,$n(r)?(i=!0,md(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Lg(t),o.updater=cf,t.stateNode=o,o._reactInternals=t,rm(t,r,e,n),t=sm(null,t,r,!0,i,n)):(t.tag=0,St&&i&&Ig(t),xn(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Gu(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=VD(r),e=Tr(r,e),o){case 0:t=im(null,t,r,e,n);break e;case 1:t=Ux(null,t,r,e,n);break e;case 11:t=zx(null,t,r,e,n);break e;case 14:t=Bx(null,t,r,Tr(r.type,e),n);break e}throw Error(K(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Tr(r,o),im(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Tr(r,o),Ux(e,t,r,o,n);case 3:e:{if($C(t),e===null)throw Error(K(387));r=t.pendingProps,i=t.memoizedState,o=i.element,aC(e,t),wd(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=Sa(Error(K(423)),t),t=Vx(e,t,r,n,o);break e}else if(r!==o){o=Sa(Error(K(424)),t),t=Vx(e,t,r,n,o);break e}else for(Gn=ui(t.stateNode.containerInfo.firstChild),Kn=t,St=!0,_r=null,n=dC(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(va(),r===o){t=To(e,t,n);break e}xn(e,t,r,n)}t=t.child}return t;case 5:return fC(t),e===null&&em(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),MC(e,t),xn(e,t,s,n),t.child;case 6:return e===null&&em(t),null;case 13:return LC(e,t,n);case 4:return Fg(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=xa(t,null,r,n):xn(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Tr(r,o),zx(e,t,r,o,n);case 7:return xn(e,t,t.pendingProps,n),t.child;case 8:return xn(e,t,t.pendingProps.children,n),t.child;case 12:return xn(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,dt(vd,r._currentValue),r._currentValue=s,i!==null)if(Or(i.value,s)){if(i.children===o.children&&!Mn.current){t=To(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=xo(-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),tm(i.return,n,t),l.lanes|=n;break}c=c.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(K(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),tm(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}xn(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,fa(t,n),o=pr(o),r=r(o),t.flags|=1,xn(e,t,r,n),t.child;case 14:return r=t.type,o=Tr(r,t.pendingProps),o=Tr(r.type,o),Bx(e,t,r,o,n);case 15:return NC(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:Tr(r,o),Gu(e,t),t.tag=1,$n(r)?(e=!0,md(t)):e=!1,fa(t,n),cC(t,r,o),rm(t,r,o,n),sm(null,t,r,!0,e,n);case 19:return FC(e,t,n);case 22:return OC(e,t,n)}throw Error(K(156,t.tag))};function tE(e,t){return Tb(e,t)}function UD(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 dr(e,t,n,r){return new UD(e,t,n,r)}function ey(e){return e=e.prototype,!(!e||!e.isReactComponent)}function VD(e){if(typeof e=="function")return ey(e)?1:0;if(e!=null){if(e=e.$$typeof,e===xg)return 11;if(e===wg)return 14}return 2}function pi(e,t){var n=e.alternate;return n===null?(n=dr(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 Yu(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")ey(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case Ws:return Ki(n.children,o,i,t);case vg:s=8,o|=8;break;case Tp:return e=dr(12,n,t,o|2),e.elementType=Tp,e.lanes=i,e;case kp:return e=dr(13,n,t,o),e.elementType=kp,e.lanes=i,e;case Rp:return e=dr(19,n,t,o),e.elementType=Rp,e.lanes=i,e;case ub:return hf(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case lb:s=10;break e;case cb:s=9;break e;case xg:s=11;break e;case wg:s=14;break e;case Yo:s=16,r=null;break e}throw Error(K(130,e==null?e:typeof e,""))}return t=dr(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Ki(e,t,n,r){return e=dr(7,e,r,t),e.lanes=n,e}function hf(e,t,n,r){return e=dr(22,e,r,t),e.elementType=ub,e.lanes=n,e.stateNode={isHidden:!1},e}function Jh(e,t,n){return e=dr(6,e,null,t),e.lanes=n,e}function Zh(e,t,n){return t=dr(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function HD(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=Ah(0),this.expirationTimes=Ah(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ah(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function ty(e,t,n,r,o,i,s,l,c){return e=new HD(e,t,n,l,c),t===1?(t=1,i===!0&&(t|=8)):t=0,i=dr(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Lg(i),e}function WD(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Hs,key:r==null?null:""+r,children:e,containerInfo:t,implementation:n}}function nE(e){if(!e)return vi;e=e._reactInternals;e:{if(ms(e)!==e||e.tag!==1)throw Error(K(170));var t=e;do{switch(t.tag){case 3:t=t.stateNode.context;break e;case 1:if($n(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(t!==null);throw Error(K(171))}if(e.tag===1){var n=e.type;if($n(n))return tC(e,n,t)}return t}function rE(e,t,n,r,o,i,s,l,c){return e=ty(n,r,!0,e,o,i,s,l,c),e.context=nE(null),n=e.current,r=Cn(),o=hi(n),i=xo(r,o),i.callback=t??null,di(n,i,o),e.current.lanes=o,Sc(e,o,r),Ln(e,r),e}function pf(e,t,n,r){var o=t.current,i=Cn(),s=hi(o);return n=nE(n),t.context===null?t.context=n:t.pendingContext=n,t=xo(i,s),t.payload={element:e},r=r===void 0?null:r,r!==null&&(t.callback=r),e=di(o,t,s),e!==null&&(Ar(e,o,s,i),Hu(e,o,s)),s}function kd(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 Zx(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function ny(e,t){Zx(e,t),(e=e.alternate)&&Zx(e,t)}function qD(){return null}var oE=typeof reportError=="function"?reportError:function(e){console.error(e)};function ry(e){this._internalRoot=e}mf.prototype.render=ry.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(K(409));pf(e,t,null,null)};mf.prototype.unmount=ry.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;ts(function(){pf(null,e,null,null)}),t[jo]=null}};function mf(e){this._internalRoot=e}mf.prototype.unstable_scheduleHydration=function(e){if(e){var t=Nb();e={blockedOn:null,target:e,priority:t};for(var n=0;n<ti.length&&t!==0&&t<ti[n].priority;n++);ti.splice(n,0,e),n===0&&Mb(e)}};function oy(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function gf(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11&&(e.nodeType!==8||e.nodeValue!==" react-mount-point-unstable "))}function e1(){}function GD(e,t,n,r,o){if(o){if(typeof r=="function"){var i=r;r=function(){var u=kd(s);i.call(u)}}var s=rE(t,r,e,0,null,!1,!1,"",e1);return e._reactRootContainer=s,e[jo]=s.current,Ql(e.nodeType===8?e.parentNode:e),ts(),s}for(;o=e.lastChild;)e.removeChild(o);if(typeof r=="function"){var l=r;r=function(){var u=kd(c);l.call(u)}}var c=ty(e,0,!1,null,null,!1,!1,"",e1);return e._reactRootContainer=c,e[jo]=c.current,Ql(e.nodeType===8?e.parentNode:e),ts(function(){pf(t,c,n,r)}),c}function yf(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=kd(s);l.call(c)}}pf(t,s,e,o)}else s=GD(n,t,e,o,r);return kd(s)}Db=function(e){switch(e.tag){case 3:var t=e.stateNode;if(t.current.memoizedState.isDehydrated){var n=Cl(t.pendingLanes);n!==0&&(Cg(t,n|1),Ln(t,zt()),!(qe&6)&&(ba=zt()+500,ji()))}break;case 13:ts(function(){var r=Po(e,1);if(r!==null){var o=Cn();Ar(r,e,1,o)}}),ny(e,1)}};Eg=function(e){if(e.tag===13){var t=Po(e,134217728);if(t!==null){var n=Cn();Ar(t,e,134217728,n)}ny(e,134217728)}};Ab=function(e){if(e.tag===13){var t=hi(e),n=Po(e,t);if(n!==null){var r=Cn();Ar(n,e,t,r)}ny(e,t)}};Nb=function(){return Ze};Ob=function(e,t){var n=Ze;try{return Ze=e,t()}finally{Ze=n}};Fp=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=af(r);if(!o)throw Error(K(90));fb(r),Dp(r,o)}}}break;case"textarea":pb(e,n);break;case"select":t=n.value,t!=null&&la(e,!!n.multiple,t,!1)}};Sb=Xg;bb=ts;var QD={usingClientEntryPoint:!1,Events:[Cc,Ks,af,xb,wb,Xg]},ul={findFiberByHostInstance:Bi,bundleType:0,version:"18.2.0",rendererPackageName:"react-dom"},KD={bundleType:ul.bundleType,version:ul.version,rendererPackageName:ul.rendererPackageName,rendererConfig:ul.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Oo.ReactCurrentDispatcher,findHostInstanceByFiber:function(e){return e=jb(e),e===null?null:e.stateNode},findFiberByHostInstance:ul.findFiberByHostInstance||qD,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 ku=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ku.isDisabled&&ku.supportsFiber)try{nf=ku.inject(KD),eo=ku}catch{}}tr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=QD;tr.createPortal=function(e,t){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!oy(t))throw Error(K(200));return WD(e,t,null,n)};tr.createRoot=function(e,t){if(!oy(e))throw Error(K(299));var n=!1,r="",o=oE;return t!=null&&(t.unstable_strictMode===!0&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onRecoverableError!==void 0&&(o=t.onRecoverableError)),t=ty(e,1,!1,null,null,n,!1,r,o),e[jo]=t.current,Ql(e.nodeType===8?e.parentNode:e),new ry(t)};tr.findDOMNode=function(e){if(e==null)return null;if(e.nodeType===1)return e;var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(K(188)):(e=Object.keys(e).join(","),Error(K(268,e)));return e=jb(t),e=e===null?null:e.stateNode,e};tr.flushSync=function(e){return ts(e)};tr.hydrate=function(e,t,n){if(!gf(t))throw Error(K(200));return yf(null,e,t,!0,n)};tr.hydrateRoot=function(e,t,n){if(!oy(e))throw Error(K(405));var r=n!=null&&n.hydratedSources||null,o=!1,i="",s=oE;if(n!=null&&(n.unstable_strictMode===!0&&(o=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(s=n.onRecoverableError)),t=rE(t,null,e,1,n??null,o,!1,i,s),e[jo]=t.current,Ql(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 mf(t)};tr.render=function(e,t,n){if(!gf(t))throw Error(K(200));return yf(null,e,t,!1,n)};tr.unmountComponentAtNode=function(e){if(!gf(e))throw Error(K(40));return e._reactRootContainer?(ts(function(){yf(null,null,e,!1,function(){e._reactRootContainer=null,e[jo]=null})}),!0):!1};tr.unstable_batchedUpdates=Xg;tr.unstable_renderSubtreeIntoContainer=function(e,t,n,r){if(!gf(n))throw Error(K(200));if(e==null||e._reactInternals===void 0)throw Error(K(38));return yf(e,t,n,!1,r)};tr.version="18.2.0-next-9e3b772b8-20220608";function iE(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(iE)}catch(e){console.error(e)}}iE(),rb.exports=tr;var jc=rb.exports;const na=Jm(jc),YD=mS({__proto__:null,default:na},[jc]),[XD,yr]=Pn("ScrollArea.Root component was not found in tree");function Ca(e,t){const n=Fi(t);Oa(()=>{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 JD=C.forwardRef((e,t)=>{const{style:n,...r}=e,o=yr(),[i,s]=C.useState(0),[l,c]=C.useState(0),u=!!(i&&l);return Ca(o.scrollbarX,()=>{var f;const d=((f=o.scrollbarX)==null?void 0:f.offsetHeight)||0;o.onCornerHeightChange(d),c(d)}),Ca(o.scrollbarY,()=>{var f;const d=((f=o.scrollbarY)==null?void 0:f.offsetWidth)||0;o.onCornerWidthChange(d),s(d)}),u?C.createElement("div",{...r,ref:t,style:{...n,width:i,height:l}}):null}),ZD=C.forwardRef((e,t)=>{const n=yr(),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?C.createElement(JD,{...e,ref:t}):null}),eA={scrollHideDelay:1e3,type:"hover"},sE=p.forwardRef((e,t)=>{const n=U("ScrollAreaRoot",eA,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,S]=p.useState(null),[v,x]=p.useState(0),[w,b]=p.useState(0),[j,E]=p.useState(!1),[P,T]=p.useState(!1),_=Qt(t,D=>c(D));return C.createElement(XD,{value:{type:r,scrollHideDelay:o,scrollArea:l,viewport:u,onViewportChange:d,content:f,onContentChange:h,scrollbarX:m,onScrollbarXChange:g,scrollbarXEnabled:j,onScrollbarXEnabledChange:E,scrollbarY:y,onScrollbarYChange:S,scrollbarYEnabled:P,onScrollbarYEnabledChange:T,onCornerWidthChange:x,onCornerHeightChange:b}},C.createElement(H,{...s,ref:_,__vars:{"--sa-corner-width":i!=="xy"?"0px":`${v}px`,"--sa-corner-height":i!=="xy"?"0px":`${w}px`}}))});sE.displayName="@mantine/core/ScrollAreaRoot";function aE(e,t){const n=e/t;return Number.isNaN(n)?0:n}function vf(e){const t=aE(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function lE(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 tA(e,[t,n]){return Math.min(n,Math.max(t,e))}function t1(e,t,n="ltr"){const r=vf(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=tA(e,c);return lE([0,s],[0,l])(u)}function nA(e,t,n,r="ltr"){const o=vf(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 lE([c,u],f)(e)}function cE(e,t){return e>0&&e<t}function Rd(e){return e?parseInt(e,10):0}function Yi(e,t,{checkForDefaultPrevented:n=!0}={}){return r=>{e==null||e(r),(n===!1||!r.defaultPrevented)&&(t==null||t(r))}}const[rA,uE]=Pn("ScrollAreaScrollbar was not found in tree"),dE=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=yr(),[m,g]=C.useState(null),y=Qt(t,T=>g(T)),S=C.useRef(null),v=C.useRef(""),{viewport:x}=h,w=n.content-n.viewport,b=Fi(u),j=Fi(l),E=Zd(d,10),P=T=>{if(S.current){const _=T.clientX-S.current.left,D=T.clientY-S.current.top;c({x:_,y:D})}};return p.useEffect(()=>{const T=_=>{const D=_.target;(m==null?void 0:m.contains(D))&&b(_,w)};return document.addEventListener("wheel",T,{passive:!1}),()=>document.removeEventListener("wheel",T,{passive:!1})},[x,m,w,b]),p.useEffect(j,[n,j]),Ca(m,E),Ca(h.content,E),C.createElement(rA,{value:{scrollbar:m,hasThumb:r,onThumbChange:Fi(o),onThumbPointerUp:Fi(i),onThumbPositionChange:j,onThumbPointerDown:Fi(s)}},C.createElement("div",{...f,ref:y,style:{position:"absolute",...f.style},onPointerDown:Yi(e.onPointerDown,T=>{T.button===0&&(T.target.setPointerCapture(T.pointerId),S.current=m.getBoundingClientRect(),v.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",P(T))}),onPointerMove:Yi(e.onPointerMove,P),onPointerUp:Yi(e.onPointerUp,T=>{const _=T.target;_.hasPointerCapture(T.pointerId)&&_.releasePointerCapture(T.pointerId),document.body.style.webkitUserSelect=v.current,S.current=null})}))}),oA=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...i}=e,s=yr(),[l,c]=p.useState(),u=p.useRef(null),d=Qt(t,u,s.onScrollbarXChange);return p.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),C.createElement(dE,{"data-orientation":"horizontal",...i,ref:d,sizes:n,style:{...o,"--sa-thumb-width":`${vf(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),cE(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)}})}})}),iA=p.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...i}=e,s=yr(),[l,c]=C.useState(),u=p.useRef(null),d=Qt(t,u,s.onScrollbarYChange);return p.useEffect(()=>{u.current&&c(getComputedStyle(u.current))},[u]),C.createElement(dE,{...i,"data-orientation":"vertical",ref:d,sizes:n,style:{"--sa-thumb-height":`${vf(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),cE(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)}})}})}),iy=p.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,{dir:o}=La(),i=yr(),s=p.useRef(null),l=p.useRef(0),[c,u]=p.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=aE(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)=>nA(m,l.current,c,g);return n==="horizontal"?C.createElement(oA,{...f,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollLeft,g=t1(m,c,o);s.current.style.transform=`translate3d(${g}px, 0, 0)`}},onWheelScroll:m=>{i.viewport&&(i.viewport.scrollLeft=m)},onDragScroll:m=>{i.viewport&&(i.viewport.scrollLeft=h(m,o))}}):n==="vertical"?C.createElement(iA,{...f,ref:t,onThumbPositionChange:()=>{if(i.viewport&&s.current){const m=i.viewport.scrollTop,g=t1(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}),fE=p.forwardRef((e,t)=>{const n=yr(),{forceMount:r,...o}=e,[i,s]=p.useState(!1),l=e.orientation==="horizontal",c=Zd(()=>{if(n.viewport){const u=n.viewport.offsetWidth<n.viewport.scrollWidth,d=n.viewport.offsetHeight<n.viewport.scrollHeight;s(l?u:d)}},10);return Ca(n.viewport,c),Ca(n.content,c),r||i?C.createElement(iy,{"data-state":i?"visible":"hidden",...o,ref:t}):null}),sA=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=yr(),[i,s]=p.useState(!1);return p.useEffect(()=>{const{scrollArea:l}=o;let c=0;if(l){const u=()=>{window.clearTimeout(c),s(!0)},d=()=>{c=window.setTimeout(()=>s(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",u),l.addEventListener("pointerleave",d),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",u),l.removeEventListener("pointerleave",d)}}},[o.scrollArea,o.scrollHideDelay]),n||i?C.createElement(fE,{"data-state":i?"visible":"hidden",...r,ref:t}):null}),aA=p.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=yr(),i=e.orientation==="horizontal",[s,l]=p.useState("hidden"),c=Zd(()=>l("idle"),100);return p.useEffect(()=>{if(s==="idle"){const u=window.setTimeout(()=>l("hidden"),o.scrollHideDelay);return()=>window.clearTimeout(u)}},[s,o.scrollHideDelay]),p.useEffect(()=>{const{viewport:u}=o,d=i?"scrollLeft":"scrollTop";if(u){let f=u[d];const h=()=>{const m=u[d];f!==m&&(l("scrolling"),c()),f=m};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[o.viewport,i,c]),n||s!=="hidden"?C.createElement(iy,{"data-state":s==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:Yi(e.onPointerEnter,()=>l("interacting")),onPointerLeave:Yi(e.onPointerLeave,()=>l("idle"))}):null}),n1=C.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=yr(),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:s}=o,l=e.orientation==="horizontal";return C.useEffect(()=>(l?i(!0):s(!0),()=>{l?i(!1):s(!1)}),[l,i,s]),o.type==="hover"?C.createElement(sA,{...r,ref:t,forceMount:n}):o.type==="scroll"?C.createElement(aA,{...r,ref:t,forceMount:n}):o.type==="auto"?C.createElement(fE,{...r,ref:t,forceMount:n}):o.type==="always"?C.createElement(iy,{...r,ref:t}):null});function lA(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 cA=p.forwardRef((e,t)=>{const{style:n,...r}=e,o=yr(),i=uE(),{onThumbPositionChange:s}=i,l=Qt(t,d=>i.onThumbChange(d)),c=p.useRef(),u=Zd(()=>{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=lA(d,s);c.current=h,s()}};return s(),d.addEventListener("scroll",f),()=>d.removeEventListener("scroll",f)}},[o.viewport,u,s]),C.createElement("div",{"data-state":i.hasThumb?"visible":"hidden",...r,ref:l,style:{width:"var(--sa-thumb-width)",height:"var(--sa-thumb-height)",...n},onPointerDownCapture:Yi(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:Yi(e.onPointerUp,i.onThumbPointerUp)})}),r1=C.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=uE();return n||o.hasThumb?C.createElement(cA,{ref:t,...r}):null}),hE=p.forwardRef(({children:e,style:t,...n},r)=>{const o=yr(),i=Qt(r,o.onViewportChange);return C.createElement(H,{...n,ref:i,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t}},C.createElement("div",{style:{minWidth:"100%",display:"table"},ref:o.onContentChange},e))});hE.displayName="@mantine/core/ScrollAreaViewport";var sy={root:"m_d57069b5",viewport:"m_c0783ff9",viewportInner:"m_f8f631dd",scrollbar:"m_c44ba933",thumb:"m_d8b5e363",corner:"m_21657268"};const pE={scrollHideDelay:1e3,type:"hover",scrollbars:"xy"},uA=(e,{scrollbarSize:t})=>({root:{"--scrollarea-scrollbar-size":B(t)}}),vr=Q((e,t)=>{const n=U("ScrollArea",pE,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:S,scrollbars:v,...x}=n,[w,b]=p.useState(!1),j=ce({name:"ScrollArea",props:n,classes:sy,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:u,varsResolver:uA});return C.createElement(sE,{type:d==="never"?"always":d,scrollHideDelay:f,ref:t,scrollbars:v,...j("root"),...x},C.createElement(hE,{...h,...j("viewport",{style:h==null?void 0:h.style}),ref:m,"data-offset-scrollbars":S===!0?"xy":S||void 0,"data-scrollbars":v||void 0,onScroll:typeof g=="function"?({currentTarget:E})=>g({x:E.scrollLeft,y:E.scrollTop}):void 0},y),(v==="xy"||v==="x")&&C.createElement(n1,{...j("scrollbar"),orientation:"horizontal","data-hidden":d==="never"||void 0,forceMount:!0,onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1)},C.createElement(r1,{...j("thumb")})),(v==="xy"||v==="y")&&C.createElement(n1,{...j("scrollbar"),orientation:"vertical","data-hidden":d==="never"||void 0,forceMount:!0,onMouseEnter:()=>b(!0),onMouseLeave:()=>b(!1)},C.createElement(r1,{...j("thumb")})),C.createElement(ZD,{...j("corner"),"data-hovered":w||void 0,"data-hidden":d==="never"||void 0}))});vr.displayName="@mantine/core/ScrollArea";const ay=Q((e,t)=>{const{children:n,classNames:r,styles:o,scrollbarSize:i,scrollHideDelay:s,type:l,dir:c,offsetScrollbars:u,viewportRef:d,onScrollPositionChange:f,unstyled:h,variant:m,viewportProps:g,scrollbars:y,style:S,vars:v,...x}=U("ScrollAreaAutosize",pE,e);return C.createElement(H,{...x,ref:t,style:[{display:"flex",overflow:"auto"},S]},C.createElement(H,{style:{display:"flex",flexDirection:"column",flex:1}},C.createElement(vr,{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)))});vr.classes=sy;ay.displayName="@mantine/core/ScrollAreaAutosize";ay.classes=sy;vr.Autosize=ay;var mE={root:"m_87cf2631"};const dA={__staticSelector:"UnstyledButton"},Xn=yn((e,t)=>{const n=U("UnstyledButton",dA,e),{className:r,component:o="button",__staticSelector:i,unstyled:s,classNames:l,styles:c,style:u,...d}=n,f=ce({name:i,props:n,classes:mE,className:r,style:u,classNames:l,styles:c,unstyled:s});return C.createElement(H,{...f("root",{focusable:!0}),component:o,ref:t,type:o==="button"?"button":void 0,...d})});Xn.classes=mE;Xn.displayName="@mantine/core/UnstyledButton";var gE={root:"m_515a97f8"};const fA={},ly=Q((e,t)=>{const n=U("VisuallyHidden",fA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,...u}=n,d=ce({name:"VisuallyHidden",classes:gE,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l});return C.createElement(H,{component:"span",ref:t,...d("root"),...u})});ly.classes=gE;ly.displayName="@mantine/core/VisuallyHidden";var yE={root:"m_1b7284a3"};const hA={},pA=(e,{radius:t,shadow:n})=>({root:{"--paper-radius":t===void 0?void 0:gt(t),"--paper-shadow":ig(n)}}),Fn=yn((e,t)=>{const n=U("Paper",hA,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,withBorder:c,vars:u,radius:d,shadow:f,variant:h,mod:m,...g}=n,y=ce({name:"Paper",props:n,classes:yE,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:u,varsResolver:pA});return C.createElement(H,{ref:t,mod:[{"data-with-border":c},m],...y("root"),variant:h,...g})});Fn.classes=yE;Fn.displayName="@mantine/core/Paper";function xi(e){return vE(e)?(e.nodeName||"").toLowerCase():"#document"}function zn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mo(e){var t;return(t=(vE(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function vE(e){return e instanceof Node||e instanceof zn(e).Node}function Et(e){return e instanceof Element||e instanceof zn(e).Element}function Jn(e){return e instanceof HTMLElement||e instanceof zn(e).HTMLElement}function vm(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof zn(e).ShadowRoot}function Pc(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Zn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function mA(e){return["table","td","th"].includes(xi(e))}function cy(e){const t=uy(),n=Zn(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 gA(e){let t=ns(e);for(;Jn(t)&&!Ea(t);){if(cy(t))return t;t=ns(t)}return null}function uy(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ea(e){return["html","body","#document"].includes(xi(e))}function Zn(e){return zn(e).getComputedStyle(e)}function xf(e){return Et(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ns(e){if(xi(e)==="html")return e;const t=e.assignedSlot||e.parentNode||vm(e)&&e.host||Mo(e);return vm(t)?t.host:t}function xE(e){const t=ns(e);return Ea(t)?e.ownerDocument?e.ownerDocument.body:e.body:Jn(t)&&Pc(t)?t:xE(t)}function wo(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=xE(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=zn(o);return i?t.concat(s,s.visualViewport||[],Pc(o)?o:[],s.frameElement&&n?wo(s.frameElement):[]):t.concat(o,wo(o,[],n))}function o1(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function rc(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&vm(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function wE(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function SE(){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 yA(e){return wA()?!1:!i1()&&e.width===0&&e.height===0||i1()&&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&&e.pointerType==="touch"}function vA(){return/apple/i.test(navigator.vendor)}function i1(){const e=/android/i;return e.test(wE())||e.test(SE())}function xA(){return wE().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function wA(){return SE().includes("jsdom/")}function bE(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function SA(e){return"nativeEvent"in e}function bA(e){return e.matches("html,body")}function Hi(e){return(e==null?void 0:e.ownerDocument)||document}function ep(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Bs(e){return"composedPath"in e?e.composedPath()[0]:e.target}const CA="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function EA(e){return Jn(e)&&e.matches(CA)}const Mr=Math.min,hn=Math.max,_d=Math.round,Ru=Math.floor,wi=e=>({x:e,y:e}),jA={left:"right",right:"left",bottom:"top",top:"bottom"},PA={start:"end",end:"start"};function xm(e,t,n){return hn(e,Mr(t,n))}function ko(e,t){return typeof e=="function"?e(t):e}function $r(e){return e.split("-")[0]}function Ba(e){return e.split("-")[1]}function dy(e){return e==="x"?"y":"x"}function fy(e){return e==="y"?"height":"width"}function gs(e){return["top","bottom"].includes($r(e))?"y":"x"}function hy(e){return dy(gs(e))}function TA(e,t,n){n===void 0&&(n=!1);const r=Ba(e),o=hy(e),i=fy(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 kA(e){const t=Id(e);return[wm(e),t,wm(t)]}function wm(e){return e.replace(/start|end/g,t=>PA[t])}function RA(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 _A(e,t,n,r){const o=Ba(e);let i=RA($r(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(wm)))),i}function Id(e){return e.replace(/left|right|bottom|top/g,t=>jA[t])}function IA(e){return{top:0,right:0,bottom:0,left:0,...e}}function py(e){return typeof e!="number"?IA(e):{top:e,right:e,bottom:e,left:e}}function ja(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function s1(e,t,n){let{reference:r,floating:o}=e;const i=gs(t),s=hy(t),l=fy(s),c=$r(t),u=i==="y",d=r.x+r.width/2-o.width/2,f=r.y+r.height/2-o.height/2,h=r[l]/2-o[l]/2;let m;switch(c){case"top":m={x:d,y:r.y-o.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-o.width,y:f};break;default:m={x:r.x,y:r.y}}switch(Ba(t)){case"start":m[s]-=h*(n&&u?-1:1);break;case"end":m[s]+=h*(n&&u?-1:1);break}return m}const DA=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}=s1(u,r,c),h=r,m={},g=0;for(let y=0;y<l.length;y++){const{name:S,fn:v}=l[y],{x,y:w,data:b,reset:j}=await v({x:d,y:f,initialPlacement:r,placement:h,strategy:o,middlewareData:m,rects:u,platform:s,elements:{reference:e,floating:t}});d=x??d,f=w??f,m={...m,[S]:{...m[S],...b}},j&&g<=50&&(g++,typeof j=="object"&&(j.placement&&(h=j.placement),j.rects&&(u=j.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):j.rects),{x:d,y:f}=s1(u,h,c)),y=-1)}return{x:d,y:f,placement:h,strategy:o,middlewareData:m}};async function my(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}=ko(t,e),g=py(m),S=l[h?f==="floating"?"reference":"floating":f],v=ja(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(S)))==null||n?S:S.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:c})),x=f==="floating"?{...s.floating,x:r,y:o}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),b=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},j=ja(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:w,strategy:c}):x);return{top:(v.top-j.top+g.top)/b.y,bottom:(j.bottom-v.bottom+g.bottom)/b.y,left:(v.left-j.left+g.left)/b.x,right:(j.right-v.right+g.right)/b.x}}const AA=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}=ko(e,t)||{};if(u==null)return{};const f=py(d),h={x:n,y:r},m=hy(o),g=fy(m),y=await s.getDimensions(u),S=m==="y",v=S?"top":"left",x=S?"bottom":"right",w=S?"clientHeight":"clientWidth",b=i.reference[g]+i.reference[m]-h[m]-i.floating[g],j=h[m]-i.reference[m],E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let P=E?E[w]:0;(!P||!await(s.isElement==null?void 0:s.isElement(E)))&&(P=l.floating[w]||i.floating[g]);const T=b/2-j/2,_=P/2-y[g]/2-1,D=Mr(f[v],_),O=Mr(f[x],_),I=D,L=P-y[g]-O,N=P/2-y[g]/2+T,M=xm(I,N,L),$=!c.arrow&&Ba(o)!=null&&N!==M&&i.reference[g]/2-(N<I?D:O)-y[g]/2<0,R=$?N<I?N-I:N-L:0;return{[m]:h[m]+R,data:{[m]:M,centerOffset:N-M-R,...$&&{alignmentOffset:R}},reset:$}}}),NA=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,...S}=ko(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const v=$r(o),x=$r(l)===l,w=await(c.isRTL==null?void 0:c.isRTL(u.floating)),b=h||(x||!y?[Id(l)]:kA(l));!h&&g!=="none"&&b.push(..._A(l,y,g,w));const j=[l,...b],E=await my(t,S),P=[];let T=((r=i.flip)==null?void 0:r.overflows)||[];if(d&&P.push(E[v]),f){const I=TA(o,s,w);P.push(E[I[0]],E[I[1]])}if(T=[...T,{placement:o,overflows:P}],!P.every(I=>I<=0)){var _,D;const I=(((_=i.flip)==null?void 0:_.index)||0)+1,L=j[I];if(L)return{data:{index:I,overflows:T},reset:{placement:L}};let N=(D=T.filter(M=>M.overflows[0]<=0).sort((M,$)=>M.overflows[1]-$.overflows[1])[0])==null?void 0:D.placement;if(!N)switch(m){case"bestFit":{var O;const M=(O=T.map($=>[$.placement,$.overflows.filter(R=>R>0).reduce((R,k)=>R+k,0)]).sort(($,R)=>$[1]-R[1])[0])==null?void 0:O[0];M&&(N=M);break}case"initialPlacement":N=l;break}if(o!==N)return{reset:{placement:N}}}return{}}}};function CE(e){const t=Mr(...e.map(i=>i.left)),n=Mr(...e.map(i=>i.top)),r=hn(...e.map(i=>i.right)),o=hn(...e.map(i=>i.bottom));return{x:t,y:n,width:r-t,height:o-n}}function OA(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=>ja(CE(o)))}const MA=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}=ko(e,t),d=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(r.reference))||[]),f=OA(d),h=ja(CE(d)),m=py(l);function g(){if(f.length===2&&f[0].left>f[1].right&&c!=null&&u!=null)return f.find(S=>c>S.left-m.left&&c<S.right+m.right&&u>S.top-m.top&&u<S.bottom+m.bottom)||h;if(f.length>=2){if(gs(n)==="y"){const D=f[0],O=f[f.length-1],I=$r(n)==="top",L=D.top,N=O.bottom,M=I?D.left:O.left,$=I?D.right:O.right,R=$-M,k=N-L;return{top:L,bottom:N,left:M,right:$,width:R,height:k,x:M,y:L}}const S=$r(n)==="left",v=hn(...f.map(D=>D.right)),x=Mr(...f.map(D=>D.left)),w=f.filter(D=>S?D.left===x:D.right===v),b=w[0].top,j=w[w.length-1].bottom,E=x,P=v,T=P-E,_=j-b;return{top:b,bottom:j,left:E,right:P,width:T,height:_,x:E,y:b}}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 $A(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=$r(n),l=Ba(n),c=gs(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&c?-1:1,f=ko(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 EE=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 $A(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}}}}},LA=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:S=>{let{x:v,y:x}=S;return{x:v,y:x}}},...c}=ko(e,t),u={x:n,y:r},d=await my(t,c),f=gs($r(o)),h=dy(f);let m=u[h],g=u[f];if(i){const S=h==="y"?"top":"left",v=h==="y"?"bottom":"right",x=m+d[S],w=m-d[v];m=xm(x,m,w)}if(s){const S=f==="y"?"top":"left",v=f==="y"?"bottom":"right",x=g+d[S],w=g-d[v];g=xm(x,g,w)}const y=l.fn({...t,[h]:m,[f]:g});return{...y,data:{x:y.x-n,y:y.y-r}}}}},FA=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}=ko(e,t),d={x:n,y:r},f=gs(o),h=dy(f);let m=d[h],g=d[f];const y=ko(l,t),S=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){const w=h==="y"?"height":"width",b=i.reference[h]-i.floating[w]+S.mainAxis,j=i.reference[h]+i.reference[w]-S.mainAxis;m<b?m=b:m>j&&(m=j)}if(u){var v,x;const w=h==="y"?"width":"height",b=["top","left"].includes($r(o)),j=i.reference[f]-i.floating[w]+(b&&((v=s.offset)==null?void 0:v[f])||0)+(b?0:S.crossAxis),E=i.reference[f]+i.reference[w]+(b?0:((x=s.offset)==null?void 0:x[f])||0)-(b?S.crossAxis:0);g<j?g=j:g>E&&(g=E)}return{[h]:m,[f]:g}}}},zA=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}=ko(e,t),c=await my(t,l),u=$r(n),d=Ba(n),f=gs(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 S=m-c[g],v=h-c[y],x=!t.middlewareData.shift;let w=S,b=v;if(f){const E=h-c.left-c.right;b=d||x?Mr(v,E):E}else{const E=m-c.top-c.bottom;w=d||x?Mr(S,E):E}if(x&&!d){const E=hn(c.left,0),P=hn(c.right,0),T=hn(c.top,0),_=hn(c.bottom,0);f?b=h-2*(E!==0||P!==0?E+P:hn(c.left,c.right)):w=m-2*(T!==0||_!==0?T+_:hn(c.top,c.bottom))}await s({...t,availableWidth:b,availableHeight:w});const j=await o.getDimensions(i.floating);return h!==j.width||m!==j.height?{reset:{rects:!0}}:{}}}};function jE(e){const t=Zn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Jn(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,l=_d(n)!==i||_d(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function gy(e){return Et(e)?e:e.contextElement}function pa(e){const t=gy(e);if(!Jn(t))return wi(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=jE(t);let s=(i?_d(n.width):n.width)/r,l=(i?_d(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const BA=wi(0);function PE(e){const t=zn(e);return!uy()||!t.visualViewport?BA:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function UA(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==zn(e)?!1:t}function rs(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=gy(e);let s=wi(1);t&&(r?Et(r)&&(s=pa(r)):s=pa(e));const l=UA(i,n,r)?PE(i):wi(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=zn(i),m=r&&Et(r)?zn(r):r;let g=h,y=g.frameElement;for(;y&&r&&m!==g;){const S=pa(y),v=y.getBoundingClientRect(),x=Zn(y),w=v.left+(y.clientLeft+parseFloat(x.paddingLeft))*S.x,b=v.top+(y.clientTop+parseFloat(x.paddingTop))*S.y;c*=S.x,u*=S.y,d*=S.x,f*=S.y,c+=w,u+=b,g=zn(y),y=g.frameElement}}return ja({width:d,height:f,x:c,y:u})}const VA=[":popover-open",":modal"];function TE(e){return VA.some(t=>{try{return e.matches(t)}catch{return!1}})}function HA(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Mo(r),l=t?TE(t.floating):!1;if(r===s||l&&i)return n;let c={scrollLeft:0,scrollTop:0},u=wi(1);const d=wi(0),f=Jn(r);if((f||!f&&!i)&&((xi(r)!=="body"||Pc(s))&&(c=xf(r)),Jn(r))){const h=rs(r);u=pa(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-c.scrollLeft*u.x+d.x,y:n.y*u.y-c.scrollTop*u.y+d.y}}function WA(e){return Array.from(e.getClientRects())}function kE(e){return rs(Mo(e)).left+xf(e).scrollLeft}function qA(e){const t=Mo(e),n=xf(e),r=e.ownerDocument.body,o=hn(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=hn(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+kE(e);const l=-n.scrollTop;return Zn(r).direction==="rtl"&&(s+=hn(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:l}}function GA(e,t){const n=zn(e),r=Mo(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=uy();(!u||u&&t==="fixed")&&(l=o.offsetLeft,c=o.offsetTop)}return{width:i,height:s,x:l,y:c}}function QA(e,t){const n=rs(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=Jn(e)?pa(e):wi(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 a1(e,t,n){let r;if(t==="viewport")r=GA(e,n);else if(t==="document")r=qA(Mo(e));else if(Et(t))r=QA(t,n);else{const o=PE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return ja(r)}function RE(e,t){const n=ns(e);return n===t||!Et(n)||Ea(n)?!1:Zn(n).position==="fixed"||RE(n,t)}function KA(e,t){const n=t.get(e);if(n)return n;let r=wo(e,[],!1).filter(l=>Et(l)&&xi(l)!=="body"),o=null;const i=Zn(e).position==="fixed";let s=i?ns(e):e;for(;Et(s)&&!Ea(s);){const l=Zn(s),c=cy(s);!c&&l.position==="fixed"&&(o=null),(i?!c&&!o:!c&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Pc(s)&&!c&&RE(e,s))?r=r.filter(d=>d!==s):o=l,s=ns(s)}return t.set(e,r),r}function YA(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?KA(t,this._c):[].concat(n),r],l=s[0],c=s.reduce((u,d)=>{const f=a1(t,d,o);return u.top=hn(f.top,u.top),u.right=Mr(f.right,u.right),u.bottom=Mr(f.bottom,u.bottom),u.left=hn(f.left,u.left),u},a1(t,l,o));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function XA(e){const{width:t,height:n}=jE(e);return{width:t,height:n}}function JA(e,t,n){const r=Jn(t),o=Mo(t),i=n==="fixed",s=rs(e,!0,i,t);let l={scrollLeft:0,scrollTop:0};const c=wi(0);if(r||!r&&!i)if((xi(t)!=="body"||Pc(o))&&(l=xf(t)),r){const f=rs(t,!0,i,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else o&&(c.x=kE(o));const u=s.left+l.scrollLeft-c.x,d=s.top+l.scrollTop-c.y;return{x:u,y:d,width:s.width,height:s.height}}function l1(e,t){return!Jn(e)||Zn(e).position==="fixed"?null:t?t(e):e.offsetParent}function _E(e,t){const n=zn(e);if(!Jn(e)||TE(e))return n;let r=l1(e,t);for(;r&&mA(r)&&Zn(r).position==="static";)r=l1(r,t);return r&&(xi(r)==="html"||xi(r)==="body"&&Zn(r).position==="static"&&!cy(r))?n:r||gA(e)||n}const ZA=async function(e){const t=this.getOffsetParent||_E,n=this.getDimensions;return{reference:JA(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,...await n(e.floating)}}};function e4(e){return Zn(e).direction==="rtl"}const t4={convertOffsetParentRelativeRectToViewportRelativeRect:HA,getDocumentElement:Mo,getClippingRect:YA,getOffsetParent:_E,getElementRects:ZA,getClientRects:WA,getDimensions:XA,getScale:pa,isElement:Et,isRTL:e4};function n4(e,t){let n=null,r;const o=Mo(e);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const{left:u,top:d,width:f,height:h}=e.getBoundingClientRect();if(l||t(),!f||!h)return;const m=Ru(d),g=Ru(o.clientWidth-(u+f)),y=Ru(o.clientHeight-(d+h)),S=Ru(u),x={rootMargin:-m+"px "+-g+"px "+-y+"px "+-S+"px",threshold:hn(0,Mr(1,c))||1};let w=!0;function b(j){const E=j[0].intersectionRatio;if(E!==c){if(!w)return s();E?s(!1,E):r=setTimeout(()=>{s(!1,1e-7)},100)}w=!1}try{n=new IntersectionObserver(b,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(b,x)}n.observe(e)}return s(!0),i}function r4(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=gy(e),d=o||i?[...u?wo(u):[],...wo(t)]:[];d.forEach(v=>{o&&v.addEventListener("scroll",n,{passive:!0}),i&&v.addEventListener("resize",n)});const f=u&&l?n4(u,n):null;let h=-1,m=null;s&&(m=new ResizeObserver(v=>{let[x]=v;x&&x.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(t)})),n()}),u&&!c&&m.observe(u),m.observe(t));let g,y=c?rs(e):null;c&&S();function S(){const v=rs(e);y&&(v.x!==y.x||v.y!==y.y||v.width!==y.width||v.height!==y.height)&&n(),y=v,g=requestAnimationFrame(S)}return n(),()=>{var v;d.forEach(x=>{o&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),f==null||f(),(v=m)==null||v.disconnect(),m=null,c&&cancelAnimationFrame(g)}}const yy=LA,IE=NA,o4=zA,c1=AA,DE=MA,i4=FA,s4=(e,t,n)=>{const r=new Map,o={platform:t4,...n},i={...o.platform,_c:r};return DA(e,t,{...o,platform:i})},AE=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?c1({element:r.current,padding:o}).fn(n):{}:r?c1({element:r,padding:o}).fn(n):{}}}};var Xu=typeof document<"u"?p.useLayoutEffect:p.useEffect;function Dd(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(!Dd(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)&&!Dd(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function NE(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function u1(e,t){const n=NE(e);return Math.round(t*n)/n}function d1(e){const t=p.useRef(e);return Xu(()=>{t.current=e}),t}function a4(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);Dd(h,r)||m(r);const[g,y]=p.useState(null),[S,v]=p.useState(null),x=p.useCallback(R=>{R!==E.current&&(E.current=R,y(R))},[]),w=p.useCallback(R=>{R!==P.current&&(P.current=R,v(R))},[]),b=i||g,j=s||S,E=p.useRef(null),P=p.useRef(null),T=p.useRef(d),_=c!=null,D=d1(c),O=d1(o),I=p.useCallback(()=>{if(!E.current||!P.current)return;const R={placement:t,strategy:n,middleware:h};O.current&&(R.platform=O.current),s4(E.current,P.current,R).then(k=>{const F={...k,isPositioned:!0};L.current&&!Dd(T.current,F)&&(T.current=F,jc.flushSync(()=>{f(F)}))})},[h,t,n,O]);Xu(()=>{u===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,f(R=>({...R,isPositioned:!1})))},[u]);const L=p.useRef(!1);Xu(()=>(L.current=!0,()=>{L.current=!1}),[]),Xu(()=>{if(b&&(E.current=b),j&&(P.current=j),b&&j){if(D.current)return D.current(b,j,I);I()}},[b,j,I,D,_]);const N=p.useMemo(()=>({reference:E,floating:P,setReference:x,setFloating:w}),[x,w]),M=p.useMemo(()=>({reference:b,floating:j}),[b,j]),$=p.useMemo(()=>{const R={position:n,left:0,top:0};if(!M.floating)return R;const k=u1(M.floating,d.x),F=u1(M.floating,d.y);return l?{...R,transform:"translate("+k+"px, "+F+"px)",...NE(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:F}},[n,l,M.floating,d.x,d.y]);return p.useMemo(()=>({...d,update:I,refs:N,elements:M,floatingStyles:$}),[d,I,N,M,$])}const l4=rg.useInsertionEffect,c4=l4||(e=>e());function Us(e){const t=p.useRef(()=>{});return c4(()=>{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)},[])}var So=typeof document<"u"?p.useLayoutEffect:p.useEffect;let tp=!1,u4=0;const f1=()=>"floating-ui-"+u4++;function d4(){const[e,t]=p.useState(()=>tp?f1():void 0);return So(()=>{e==null&&t(f1())},[]),p.useEffect(()=>{tp||(tp=!0)},[]),e}const f4=rg.useId,OE=f4||d4;function h4(){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 p4=p.createContext(null),m4=p.createContext(null),vy=()=>{var e;return((e=p.useContext(p4))==null?void 0:e.id)||null},xy=()=>p.useContext(m4);function wy(e){return"data-floating-ui-"+e}function h1(e){const t=p.useRef(e);return So(()=>{t.current=e}),t}const p1=wy("safe-polygon");function Ju(e,t,n){return n&&!bE(n)?0:typeof e=="number"?e:e==null?void 0:e[t]}function g4(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=xy(),S=vy(),v=h1(f),x=h1(d),w=p.useRef(),b=p.useRef(),j=p.useRef(),E=p.useRef(),P=p.useRef(!0),T=p.useRef(!1),_=p.useRef(()=>{}),D=p.useCallback(()=>{var N;const M=(N=o.current.openEvent)==null?void 0:N.type;return(M==null?void 0:M.includes("mouse"))&&M!=="mousedown"},[o]);p.useEffect(()=>{if(!u)return;function N(M){let{open:$}=M;$||(clearTimeout(b.current),clearTimeout(E.current),P.current=!0)}return i.on("openchange",N),()=>{i.off("openchange",N)}},[u,i]),p.useEffect(()=>{if(!u||!v.current||!n)return;function N($){D()&&r(!1,$,"hover")}const M=Hi(l).documentElement;return M.addEventListener("mouseleave",N),()=>{M.removeEventListener("mouseleave",N)}},[l,n,r,u,v,D]);const O=p.useCallback(function(N,M,$){M===void 0&&(M=!0),$===void 0&&($="hover");const R=Ju(x.current,"close",w.current);R&&!j.current?(clearTimeout(b.current),b.current=setTimeout(()=>r(!1,N,$),R)):M&&(clearTimeout(b.current),r(!1,N,$))},[x,r]),I=p.useCallback(()=>{_.current(),j.current=void 0},[]),L=p.useCallback(()=>{if(T.current){const N=Hi(c.floating.current).body;N.style.pointerEvents="",N.removeAttribute(p1),T.current=!1}},[c]);return p.useEffect(()=>{if(!u)return;function N(){return o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1}function M(k){if(clearTimeout(b.current),P.current=!1,h&&!bE(w.current)||m>0&&Ju(x.current,"open")===0)return;const F=Ju(x.current,"open",w.current);F?b.current=setTimeout(()=>{r(!0,k,"hover")},F):r(!0,k,"hover")}function $(k){if(N())return;_.current();const F=Hi(l);if(clearTimeout(E.current),v.current){n||clearTimeout(b.current),j.current=v.current({...e,tree:y,x:k.clientX,y:k.clientY,onClose(){L(),I(),O(k,!0,"safe-polygon")}});const G=j.current;F.addEventListener("mousemove",G),_.current=()=>{F.removeEventListener("mousemove",G)};return}(w.current==="touch"?!rc(l,k.relatedTarget):!0)&&O(k)}function R(k){N()||v.current==null||v.current({...e,tree:y,x:k.clientX,y:k.clientY,onClose(){L(),I(),O(k)}})(k)}if(Et(s)){const k=s;return n&&k.addEventListener("mouseleave",R),l==null||l.addEventListener("mouseleave",R),g&&k.addEventListener("mousemove",M,{once:!0}),k.addEventListener("mouseenter",M),k.addEventListener("mouseleave",$),()=>{n&&k.removeEventListener("mouseleave",R),l==null||l.removeEventListener("mouseleave",R),g&&k.removeEventListener("mousemove",M),k.removeEventListener("mouseenter",M),k.removeEventListener("mouseleave",$)}}},[s,l,u,e,h,m,g,O,I,L,r,n,y,x,v,o]),So(()=>{var N;if(u&&n&&(N=v.current)!=null&&N.__options.blockPointerEvents&&D()){const $=Hi(l).body;if($.setAttribute(p1,""),$.style.pointerEvents="none",T.current=!0,Et(s)&&l){var M;const R=s,k=y==null||(M=y.nodesRef.current.find(F=>F.id===S))==null||(M=M.context)==null?void 0:M.elements.floating;return k&&(k.style.pointerEvents=""),R.style.pointerEvents="auto",l.style.pointerEvents="auto",()=>{R.style.pointerEvents="",l.style.pointerEvents=""}}}},[u,n,S,l,s,y,v,D]),So(()=>{n||(w.current=void 0,I(),L())},[n,I,L]),p.useEffect(()=>()=>{I(),clearTimeout(b.current),clearTimeout(E.current),L()},[u,s,I,L]),p.useMemo(()=>{if(!u)return{};function N(M){w.current=M.pointerType}return{reference:{onPointerDown:N,onPointerEnter:N,onMouseMove(M){n||m===0||(clearTimeout(E.current),E.current=setTimeout(()=>{P.current||r(!0,M.nativeEvent,"hover")},m))}},floating:{onMouseEnter(){clearTimeout(b.current)},onMouseLeave(M){O(M.nativeEvent,!1)}}}},[u,m,n,r,O])}const ME=p.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:()=>{},setState:()=>{},isInstantPhase:!1}),$E=()=>p.useContext(ME),y4=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 So(()=>{o.currentId?s.current===null?s.current=o.currentId:i({isInstantPhase:!0}):(i({isInstantPhase:!1}),s.current=null)},[o.currentId]),p.createElement(ME.Provider,{value:p.useMemo(()=>({...o,setState:i,setCurrentId:l}),[o,l])},t)},v4=(e,t)=>{let{open:n,onOpenChange:r}=e,{id:o}=t;const{currentId:i,setCurrentId:s,initialDelay:l,setState:c,timeoutMs:u}=$E();So(()=>{i&&(c({delay:{open:1,close:Ju(l,"close")}}),i!==o&&r(!1))},[o,r,c,i,l]),So(()=>{function d(){r(!1),c({delay:l,currentId:null})}if(!n&&i===o){if(u){const f=window.setTimeout(d,u);return()=>{clearTimeout(f)}}d()}},[n,c,i,o,r,l,u]),So(()=>{n&&s(o)},[n,s,o])};function np(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}const x4={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},w4={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},m1=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress: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,nodeId:o,elements:{reference:i,domReference:s,floating:l},dataRef:c}=e,{enabled:u=!0,escapeKey:d=!0,outsidePress:f=!0,outsidePressEvent:h="pointerdown",referencePress:m=!1,referencePressEvent:g="pointerdown",ancestorScroll:y=!1,bubbles:S,capture:v}=t,x=xy(),w=Us(typeof f=="function"?f:()=>!1),b=typeof f=="function"?w:f,j=p.useRef(!1),E=p.useRef(!1),{escapeKey:P,outsidePress:T}=m1(S),{escapeKey:_,outsidePress:D}=m1(v),O=Us(M=>{if(!n||!u||!d||M.key!=="Escape")return;const $=x?np(x.nodesRef.current,o):[];if(!P&&(M.stopPropagation(),$.length>0)){let R=!0;if($.forEach(k=>{var F;if((F=k.context)!=null&&F.open&&!k.context.dataRef.current.__escapeKeyBubbles){R=!1;return}}),!R)return}r(!1,SA(M)?M.nativeEvent:M,"escape-key")}),I=Us(M=>{var $;const R=()=>{var k;O(M),(k=Bs(M))==null||k.removeEventListener("keydown",R)};($=Bs(M))==null||$.addEventListener("keydown",R)}),L=Us(M=>{const $=j.current;j.current=!1;const R=E.current;if(E.current=!1,h==="click"&&R||$||typeof b=="function"&&!b(M))return;const k=Bs(M),F="["+wy("inert")+"]",q=Hi(l).querySelectorAll(F);let G=Et(k)?k:null;for(;G&&!Ea(G);){const ge=ns(G);if(Ea(ge)||!Et(ge))break;G=ge}if(q.length&&Et(k)&&!bA(k)&&!rc(k,l)&&Array.from(q).every(ge=>!rc(G,ge)))return;if(Jn(k)&&l){const ge=k.clientWidth>0&&k.scrollWidth>k.clientWidth,Pe=k.clientHeight>0&&k.scrollHeight>k.clientHeight;let Te=Pe&&M.offsetX>k.clientWidth;if(Pe&&Zn(k).direction==="rtl"&&(Te=M.offsetX<=k.offsetWidth-k.clientWidth),Te||ge&&M.offsetY>k.clientHeight)return}const ne=x&&np(x.nodesRef.current,o).some(ge=>{var Pe;return ep(M,(Pe=ge.context)==null?void 0:Pe.elements.floating)});if(ep(M,l)||ep(M,s)||ne)return;const xe=x?np(x.nodesRef.current,o):[];if(xe.length>0){let ge=!0;if(xe.forEach(Pe=>{var Te;if((Te=Pe.context)!=null&&Te.open&&!Pe.context.dataRef.current.__outsidePressBubbles){ge=!1;return}}),!ge)return}r(!1,M,"outside-press")}),N=Us(M=>{var $;const R=()=>{var k;L(M),(k=Bs(M))==null||k.removeEventListener(h,R)};($=Bs(M))==null||$.addEventListener(h,R)});return p.useEffect(()=>{if(!n||!u)return;c.current.__escapeKeyBubbles=P,c.current.__outsidePressBubbles=T;function M(k){r(!1,k,"ancestor-scroll")}const $=Hi(l);d&&$.addEventListener("keydown",_?I:O,_),b&&$.addEventListener(h,D?N:L,D);let R=[];return y&&(Et(s)&&(R=wo(s)),Et(l)&&(R=R.concat(wo(l))),!Et(i)&&i&&i.contextElement&&(R=R.concat(wo(i.contextElement)))),R=R.filter(k=>{var F;return k!==((F=$.defaultView)==null?void 0:F.visualViewport)}),R.forEach(k=>{k.addEventListener("scroll",M,{passive:!0})}),()=>{d&&$.removeEventListener("keydown",_?I:O,_),b&&$.removeEventListener(h,D?N:L,D),R.forEach(k=>{k.removeEventListener("scroll",M)})}},[c,l,s,i,d,b,h,n,r,y,u,P,T,O,_,I,L,D,N]),p.useEffect(()=>{j.current=!1},[b,h]),p.useMemo(()=>u?{reference:{onKeyDown:O,[x4[g]]:M=>{m&&r(!1,M.nativeEvent,"reference-press")}},floating:{onKeyDown:O,onMouseDown(){E.current=!0},onMouseUp(){E.current=!0},[w4[h]]:()=>{j.current=!0}}}:{},[u,m,h,g,r,O])}function Sy(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=a4(e),u=xy(),d=vy()!=null,f=Us((j,E,P)=>{j&&(m.current.openEvent=E),g.emit("openchange",{open:j,event:E,reason:P,nested:d}),r==null||r(j,E,P)}),h=p.useRef(null),m=p.useRef({}),g=p.useState(()=>h4())[0],y=OE(),S=p.useCallback(j=>{const E=Et(j)?{getBoundingClientRect:()=>j.getBoundingClientRect(),contextElement:j}:j;c.refs.setReference(E)},[c.refs]),v=p.useCallback(j=>{(Et(j)||j===null)&&(h.current=j,s(j)),(Et(c.refs.reference.current)||c.refs.reference.current===null||j!==null&&!Et(j))&&c.refs.setReference(j)},[c.refs]),x=p.useMemo(()=>({...c.refs,setReference:v,setPositionReference:S,domReference:h}),[c.refs,v,S]),w=p.useMemo(()=>({...c.elements,domReference:l}),[c.elements,l]),b=p.useMemo(()=>({...c,refs:x,elements:w,dataRef:m,nodeId:o,floatingId:y,events:g,open:n,onOpenChange:f}),[c,o,y,g,n,f,x,w]);return So(()=>{const j=u==null?void 0:u.nodesRef.current.find(E=>E.id===o);j&&(j.context=b)}),p.useMemo(()=>({...c,context:b,refs:x,elements:w}),[c,x,w,b])}function b4(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,refs:i,elements:{domReference:s}}=e,{enabled:l=!0,visibleOnly:c=!0}=t,u=p.useRef(!1),d=p.useRef(),f=p.useRef(!0);return p.useEffect(()=>{if(!l)return;const h=zn(s);function m(){!n&&Jn(s)&&s===o1(Hi(s))&&(u.current=!0)}function g(){f.current=!0}return h.addEventListener("blur",m),h.addEventListener("keydown",g,!0),()=>{h.removeEventListener("blur",m),h.removeEventListener("keydown",g,!0)}},[s,n,l]),p.useEffect(()=>{if(!l)return;function h(m){let{reason:g}=m;(g==="reference-press"||g==="escape-key")&&(u.current=!0)}return o.on("openchange",h),()=>{o.off("openchange",h)}},[o,l]),p.useEffect(()=>()=>{clearTimeout(d.current)},[]),p.useMemo(()=>l?{reference:{onPointerDown(h){yA(h.nativeEvent)||(f.current=!1)},onMouseLeave(){u.current=!1},onFocus(h){if(u.current)return;const m=Bs(h.nativeEvent);if(c&&Et(m))try{if(vA()&&xA())throw Error();if(!m.matches(":focus-visible"))return}catch{if(!f.current&&!EA(m))return}r(!0,h.nativeEvent,"focus")},onBlur(h){u.current=!1;const m=h.relatedTarget,g=Et(m)&&m.hasAttribute(wy("focus-guard"))&&m.getAttribute("data-type")==="outside";d.current=window.setTimeout(()=>{const y=o1(s?s.ownerDocument:document);!m&&y===s||rc(i.floating.current,y)||rc(s,y)||g||r(!1,h.nativeEvent,"focus")})}}}:{},[l,c,s,i,r])}const g1="active",y1="selected";function rp(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[g1]:s,[y1]:l,...c}=e;i=c}return{...n==="floating"&&{tabIndex:-1},...i,...t.map(s=>{const l=s?s[n]:null;return typeof l=="function"?e?l(e):null:l}).concat(e).reduce((s,l)=>(l&&Object.entries(l).forEach(c=>{let[u,d]=c;if(!(o&&[g1,y1].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof d=="function"){var f;(f=r.get(u))==null||f.push(d),s[u]=function(){for(var h,m=arguments.length,g=new Array(m),y=0;y<m;y++)g[y]=arguments[y];return(h=r.get(u))==null?void 0:h.map(S=>S(...g)).find(S=>S!==void 0)}}}else s[u]=d}),s),{})}}function C4(e){e===void 0&&(e=[]);const t=e,n=p.useCallback(i=>rp(i,e,"reference"),t),r=p.useCallback(i=>rp(i,e,"floating"),t),o=p.useCallback(i=>rp(i,e,"item"),e.map(i=>i==null?void 0:i.item));return p.useMemo(()=>({getReferenceProps:n,getFloatingProps:r,getItemProps:o}),[n,r,o])}const E4=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function j4(e,t){var n;t===void 0&&(t={});const{open:r,floatingId:o}=e,{enabled:i=!0,role:s="dialog"}=t,l=(n=E4.get(s))!=null?n:s,c=OE(),d=vy()!=null;return p.useMemo(()=>{if(!i)return{};const f={id:o,...l&&{role:l}};return l==="tooltip"||s==="label"?{reference:{["aria-"+(s==="label"?"labelledby":"describedby")]:r?o:void 0},floating:f}:{reference:{"aria-expanded":r?"true":"false","aria-haspopup":l==="alertdialog"?"dialog":l,"aria-controls":r?o:void 0,...l==="listbox"&&{role:"combobox"},...l==="menu"&&{id:c},...l==="menu"&&d&&{role:"menuitem"},...s==="select"&&{"aria-autocomplete":"none"},...s==="combobox"&&{"aria-autocomplete":"list"}},floating:{...f,...l==="menu"&&{"aria-labelledby":c}},item(h){let{active:m,selected:g}=h;const y={role:"option",...m&&{id:o+"-option"}};switch(s){case"select":return{...y,"aria-selected":m&&g};case"combobox":return{...y,...m&&{"aria-selected":!0}}}return{}}}},[i,s,l,r,o,c,d])}function LE(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 v1(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function x1(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 P4={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function T4({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:i,arrowY:s,dir:l}){const[c,u="center"]=e.split("-"),d={width:B(t),height:B(t),transform:"rotate(45deg)",position:"absolute",[P4[c]]:B(r)},f=B(-t/2);return c==="left"?{...d,...v1(u,s,n,o),right:f,borderLeftColor:"transparent",borderBottomColor:"transparent"}:c==="right"?{...d,...v1(u,s,n,o),left:f,borderRightColor:"transparent",borderTopColor:"transparent"}:c==="top"?{...d,...x1(u,i,n,o,l),bottom:f,borderTopColor:"transparent",borderLeftColor:"transparent"}:c==="bottom"?{...d,...x1(u,i,n,o,l),top:f,borderBottomColor:"transparent",borderRightColor:"transparent"}:{}}const by=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}=La();return i?C.createElement("div",{...u,ref:d,style:{...c,...T4({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,dir:f,arrowX:s,arrowY:l})}}):null});by.displayName="@mantine/core/FloatingArrow";const[k4,FE]=Pn("Popover component was not found in the tree");function wf({children:e,active:t=!0,refProp:n="ref"}){const r=k2(t),o=Qt(r,e==null?void 0:e.ref);return Ao(e)?p.cloneElement(e,{[n]:o}):e}function zE(e){return C.createElement(ly,{tabIndex:-1,"data-autofocus":!0,...e})}wf.displayName="@mantine/core/FocusTrap";zE.displayName="@mantine/core/FocusTrapInitialFocus";wf.InitialFocus=zE;function R4(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 _4={},BE=p.forwardRef((e,t)=>{const{children:n,target:r,...o}=U("Portal",_4,e),[i,s]=p.useState(!1),l=p.useRef(null);return Oa(()=>(s(!0),l.current=r?typeof r=="string"?document.querySelector(r):r:R4(o),lg(t,l.current),!r&&l.current&&document.body.appendChild(l.current),()=>{!r&&l.current&&document.body.removeChild(l.current)}),[r]),!i||!l.current?null:jc.createPortal(C.createElement(C.Fragment,null,n),l.current)});BE.displayName="@mantine/core/Portal";function ys({withinPortal:e=!0,children:t,...n}){return e?C.createElement(BE,{...n},t):C.createElement(C.Fragment,null,t)}ys.displayName="@mantine/core/OptionalPortal";const dl=e=>({in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${B(e==="bottom"?10:-10)})`},transitionProperty:"transform, opacity"}),_u={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},"fade-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:`translateY(${B(30)}`},transitionProperty:"opacity, transform"},"fade-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:`translateY(${B(-30)}`},transitionProperty:"opacity, transform"},"fade-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:`translateX(${B(30)}`},transitionProperty:"opacity, transform"},"fade-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:`translateX(${B(-30)}`},transitionProperty:"opacity, transform"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(${B(-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(${B(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(${B(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${B(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:{...dl("bottom"),common:{transformOrigin:"center center"}},"pop-bottom-left":{...dl("bottom"),common:{transformOrigin:"bottom left"}},"pop-bottom-right":{...dl("bottom"),common:{transformOrigin:"bottom right"}},"pop-top-left":{...dl("top"),common:{transformOrigin:"top left"}},"pop-top-right":{...dl("top"),common:{transformOrigin:"top right"}}},w1={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function I4({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in _u?{transitionProperty:_u[e].transitionProperty,...o,..._u[e].common,..._u[e][w1[t]]}:{}:{transitionProperty:e.transitionProperty,...o,...e.common,...e[w1[t]]}}function D4({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:i,onEntered:s,onExited:l}){const c=Tt(),u=cg(),d=c.respectReducedMotion?u:!1,[f,h]=p.useState(d?0:e),[m,g]=p.useState(r?"entered":"exited"),y=p.useRef(-1),S=p.useRef(-1),v=x=>{const w=x?o:i,b=x?s:l;window.clearTimeout(y.current);const j=d?0:x?e:t;h(j),j===0?(typeof w=="function"&&w(),typeof b=="function"&&b(),g(x?"entered":"exited")):S.current=requestAnimationFrame(()=>{na.flushSync(()=>{g(x?"pre-entering":"pre-exiting")}),S.current=requestAnimationFrame(()=>{typeof w=="function"&&w(),g(x?"entering":"exiting"),y.current=window.setTimeout(()=>{typeof b=="function"&&b(),g(x?"entered":"exited")},j)})})};return Co(()=>{v(r)},[r]),p.useEffect(()=>()=>{window.clearTimeout(y.current),cancelAnimationFrame(S.current)},[]),{transitionDuration:f,transitionStatus:m,transitionTimingFunction:n||"ease"}}function $o({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}=D4({mounted:o,exitDuration:r,duration:n,timingFunction:s,onExit:l,onEntered:c,onEnter:u,onExited:d});return f===0?o?C.createElement(C.Fragment,null,i({})):e?i({display:"none"}):null:h==="exited"?e?i({display:"none"}):null:C.createElement(C.Fragment,null,i(I4({transition:t,duration:f,state:h,timingFunction:m})))}$o.displayName="@mantine/core/Transition";var UE={dropdown:"m_38a85659",arrow:"m_a31dc6c1"};const A4={},Cy=Q((e,t)=>{var S,v,x,w;const n=U("PopoverDropdown",A4,e),{className:r,style:o,vars:i,children:s,onKeyDownCapture:l,variant:c,classNames:u,styles:d,...f}=n,h=FE(),m=FS({opened:h.opened,shouldReturnFocus:h.returnFocus}),g=h.withRoles?{"aria-labelledby":h.getTargetId(),id:h.getDropdownId(),role:"dialog",tabIndex:-1}:{},y=Qt(t,h.floating);return h.disabled?null:C.createElement(ys,{...h.portalProps,withinPortal:h.withinPortal},C.createElement($o,{mounted:h.opened,...h.transitionProps,transition:((S=h.transitionProps)==null?void 0:S.transition)||"fade",duration:((v=h.transitionProps)==null?void 0:v.duration)??150,keepMounted:h.keepMounted,exitDuration:typeof((x=h.transitionProps)==null?void 0:x.exitDuration)=="number"?h.transitionProps.exitDuration:(w=h.transitionProps)==null?void 0:w.duration},b=>C.createElement(wf,{active:h.trapFocus},C.createElement(H,{...g,...f,variant:c,ref:y,onKeyDownCapture:m2(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:[{...b,zIndex:h.zIndex,top:h.y??0,left:h.x??0,width:h.width==="target"?void 0:B(h.width)},o]})},s,C.createElement(by,{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})})))))});Cy.classes=UE;Cy.displayName="@mantine/core/PopoverDropdown";const N4={refProp:"ref",popupType:"dialog"},VE=Q((e,t)=>{const{children:n,refProp:r,popupType:o,...i}=U("PopoverTarget",N4,e);if(!Ao(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=FE(),c=Qt(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:et(l.targetProps.className,s.className,n.props.className),[r]:c,...l.controlled?null:{onClick:l.onToggle}})});VE.displayName="@mantine/core/PopoverTarget";function HE({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 r4(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),Co(()=>{t.update()},r),Co(()=>{i(s=>s+1)},[e])}function O4(e,t){var r,o,i,s;const n=[EE(e.offset)];return(r=e.middlewares)!=null&&r.shift&&n.push(yy({limiter:i4()})),(o=e.middlewares)!=null&&o.flip&&n.push(IE()),(i=e.middlewares)!=null&&i.inline&&n.push(DE()),n.push(AE({element:e.arrowRef,padding:e.arrowOffset})),((s=e.middlewares)!=null&&s.size||e.width==="target")&&n.push(o4({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 M4(e){const[t,n]=mn({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=Sy({strategy:e.strategy,placement:e.position,middleware:O4(e,()=>i)});return HE({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies||[],floating:i}),Co(()=>{var s;(s=e.onPositionChange)==null||s.call(e,i.placement)},[i.placement]),Co(()=>{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 $4={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:zr("popover"),__staticSelector:"Popover",width:"max-content"},L4=(e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:gt(t),"--popover-shadow":ig(n)}});function Br(e){var _n,lo,en,co,te,_e;const t=U("Popover",$4,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:S,classNames:v,styles:x,closeOnClickOutside:w,withinPortal:b,portalProps:j,closeOnEscape:E,clickOutsideEvents:P,trapFocus:T,onClose:_,onOpen:D,onChange:O,zIndex:I,radius:L,shadow:N,id:M,defaultOpened:$,__staticSelector:R,withRoles:k,disabled:F,returnFocus:q,variant:G,keepMounted:ne,vars:xe,floatingStrategy:ge,...Pe}=t,Te=ce({name:R,props:t,classes:UE,classNames:v,styles:x,unstyled:S,rootSelector:"dropdown",vars:xe,varsResolver:L4}),Le=p.useRef(null),[pe,Ge]=p.useState(null),[Ot,me]=p.useState(null),{dir:Fe}=La(),ct=Tn(M),Oe=M4({middlewares:d,width:u,position:LE(Fe,r),offset:typeof o=="number"?o+(f?h/2:0):o,arrowRef:Le,arrowOffset:m,onPositionChange:i,positionDependencies:s,opened:l,defaultOpened:$,onChange:O,onOpen:D,onClose:_,strategy:ge});v2(()=>w&&Oe.onClose(),P,[pe,Ot]);const Qe=p.useCallback(He=>{Ge(He),Oe.floating.refs.setReference(He)},[Oe.floating.refs.setReference]),Bt=p.useCallback(He=>{me(He),Oe.floating.refs.setFloating(He)},[Oe.floating.refs.setFloating]);return C.createElement(k4,{value:{returnFocus:q,disabled:F,controlled:Oe.controlled,reference:Qe,floating:Bt,x:Oe.floating.x,y:Oe.floating.y,arrowX:(en=(lo=(_n=Oe.floating)==null?void 0:_n.middlewareData)==null?void 0:lo.arrow)==null?void 0:en.x,arrowY:(_e=(te=(co=Oe.floating)==null?void 0:co.middlewareData)==null?void 0:te.arrow)==null?void 0:_e.y,opened:Oe.opened,arrowRef:Le,transitionProps:c,width:u,withArrow:f,arrowSize:h,arrowOffset:m,arrowRadius:g,arrowPosition:y,placement:Oe.floating.placement,trapFocus:T,withinPortal:b,portalProps:j,zIndex:I,radius:L,shadow:N,closeOnEscape:E,onClose:Oe.onClose,onToggle:Oe.onToggle,getTargetId:()=>`${ct}-target`,getDropdownId:()=>`${ct}-dropdown`,withRoles:k,targetProps:Pe,__staticSelector:R,classNames:v,styles:x,unstyled:S,variant:G,keepMounted:ne,getStyles:Te}},n)}Br.Target=VE;Br.Dropdown=Cy;Br.displayName="@mantine/core/Popover";Br.extend=e=>e;var Ir={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 F4=p.forwardRef(({className:e,...t},n)=>C.createElement(H,{component:"span",className:et(Ir.barsLoader,e),...t,ref:n},C.createElement("span",{className:Ir.bar}),C.createElement("span",{className:Ir.bar}),C.createElement("span",{className:Ir.bar}))),z4=p.forwardRef(({className:e,...t},n)=>C.createElement(H,{component:"span",className:et(Ir.dotsLoader,e),...t,ref:n},C.createElement("span",{className:Ir.dot}),C.createElement("span",{className:Ir.dot}),C.createElement("span",{className:Ir.dot}))),B4=p.forwardRef(({className:e,...t},n)=>C.createElement(H,{component:"span",className:et(Ir.ovalLoader,e),...t,ref:n})),WE={bars:F4,oval:B4,dots:z4},U4={loaders:WE,type:"oval"},V4=(e,{size:t,color:n})=>({root:{"--loader-size":ke(t,"loader-size"),"--loader-color":n?mt(n,e):void 0}}),Un=Q((e,t)=>{const n=U("Loader",U4,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,S=ce({name:"Loader",props:n,classes:Ir,className:l,style:c,classNames:u,styles:d,unstyled:f,vars:s,varsResolver:V4});return g?C.createElement(H,{...S("root"),ref:t,...y},g):C.createElement(H,{...S("root"),ref:t,component:h[i],variant:m,size:r,...y})});Un.defaultLoaders=WE;Un.classes=Ir;Un.displayName="@mantine/core/Loader";var Sf={root:"m_8d3f4000",icon:"m_8d3afb97",loader:"m_302b9fb1",group:"m_1a0f1b21"};const S1={orientation:"horizontal"},H4=(e,{borderWidth:t})=>({group:{"--ai-border-width":B(t)}}),Ey=Q((e,t)=>{const n=U("ActionIconGroup",S1,e),{className:r,style:o,classNames:i,styles:s,unstyled:l,orientation:c,vars:u,borderWidth:d,variant:f,mod:h,...m}=U("ActionIconGroup",S1,e),g=ce({name:"ActionIconGroup",props:n,classes:Sf,className:r,style:o,classNames:i,styles:s,unstyled:l,vars:u,varsResolver:H4,rootSelector:"group"});return C.createElement(H,{...g("group"),ref:t,variant:f,mod:[{"data-orientation":c},h],role:"group",...m})});Ey.classes=Sf;Ey.displayName="@mantine/core/ActionIconGroup";const W4={},q4=(e,{size:t,radius:n,variant:r,gradient:o,color:i,autoContrast:s})=>{const l=e.variantColorResolver({color:i||e.primaryColor,theme:e,gradient:o,variant:r||"filled",autoContrast:s});return{root:{"--ai-size":ke(t,"ai-size"),"--ai-radius":n===void 0?void 0:gt(n),"--ai-bg":i||r?l.background:void 0,"--ai-hover":i||r?l.hover:void 0,"--ai-hover-color":i||r?l.hoverColor:void 0,"--ai-color":l.color,"--ai-bd":i||r?l.border:void 0}}},Gt=yn((e,t)=>{const n=U("ActionIcon",W4,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:S,children:v,disabled:x,"data-disabled":w,autoContrast:b,mod:j,...E}=n,P=ce({name:["ActionIcon",g],props:n,className:r,style:c,classes:Sf,classNames:s,styles:l,unstyled:o,vars:S,varsResolver:q4});return C.createElement(Xn,{...P("root",{active:!x&&!u&&!w}),...E,unstyled:o,variant:i,size:f,disabled:x||u,ref:t,mod:[{loading:u,disabled:x||w},j]},C.createElement($o,{mounted:!!u,transition:"slide-down",duration:150},T=>C.createElement(H,{component:"span",...P("loader",{style:T}),"aria-hidden":!0},C.createElement(Un,{color:"var(--ai-color)",size:"calc(var(--ai-size) * 0.55)",...d}))),C.createElement(H,{component:"span",mod:{loading:u},...P("icon")},v))});Gt.classes=Sf;Gt.displayName="@mantine/core/ActionIcon";Gt.Group=Ey;const qE=p.forwardRef(({size:e="var(--cb-icon-size, 70%)",style:t,...n},r)=>C.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...t,width:e,height:e},ref:r,...n},C.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})));qE.displayName="@mantine/core/CloseIcon";var GE={root:"m_86a44da5","root--subtle":"m_220c80f2"};const G4={variant:"subtle"},Q4=(e,{size:t,radius:n,iconSize:r})=>({root:{"--cb-size":ke(t,"cb-size"),"--cb-radius":n===void 0?void 0:gt(n),"--cb-icon-size":B(r)}}),vs=yn((e,t)=>{const n=U("CloseButton",G4,e),{iconSize:r,children:o,vars:i,radius:s,className:l,classNames:c,style:u,styles:d,unstyled:f,"data-disabled":h,disabled:m,variant:g,icon:y,mod:S,...v}=n,x=ce({name:"CloseButton",props:n,className:l,style:u,classes:GE,classNames:c,styles:d,unstyled:f,vars:i,varsResolver:Q4});return C.createElement(Xn,{ref:t,...v,unstyled:f,variant:g,disabled:m,mod:[{disabled:m||h},S],...x("root",{variant:g,active:!0})},y||C.createElement(qE,null),o)});vs.classes=GE;vs.displayName="@mantine/core/CloseButton";function K4(e){return p.Children.toArray(e).filter(Boolean)}var QE={root:"m_4081bf90"};const Y4={preventGrowOverflow:!0,gap:"md",align:"center",justify:"flex-start",wrap:"wrap"},X4=(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":rn(r),"--group-align":o,"--group-justify":i,"--group-wrap":s}}),Y=Q((e,t)=>{const n=U("Group",Y4,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:S,__size:v,mod:x,...w}=n,b=K4(c),j=b.length,E=rn(u??"md"),T={childWidth:`calc(${100/j}% - (${E} - ${E} / ${j}))`},_=ce({name:"Group",props:n,stylesCtx:T,className:o,style:i,classes:QE,classNames:r,styles:s,unstyled:l,vars:y,varsResolver:X4});return C.createElement(H,{..._("root"),ref:t,variant:S,mod:[{grow:m},x],size:v,...w},b)});Y.classes=QE;Y.displayName="@mantine/core/Group";var KE={root:"m_9814e45f"};const J4={zIndex:zr("modal")},Z4=(e,{gradient:t,color:n,backgroundOpacity:r,blur:o,radius:i,zIndex:s})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&ar(n||"#000",r??.6)||void 0,"--overlay-filter":o?`blur(${B(o)})`:void 0,"--overlay-radius":i===void 0?void 0:gt(i),"--overlay-z-index":s==null?void 0:s.toString()}}),oc=yn((e,t)=>{const n=U("Overlay",J4,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:S,backgroundOpacity:v,mod:x,...w}=n,b=ce({name:"Overlay",props:n,classes:KE,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:Z4});return C.createElement(H,{ref:t,...b("root"),mod:[{center:d,fixed:u},x],...w},f)});oc.classes=KE;oc.displayName="@mantine/core/Overlay";const[eN,Lo]=Pn("ModalBase component was not found in tree");function tN({opened:e,transitionDuration:t}){const[n,r]=p.useState(e),o=p.useRef(),s=cg()?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 nN({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:o,onClose:i,returnFocus:s}){const l=Tn(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=tN({opened:n,transitionDuration:h});return VS("keydown",g=>{var y;g.key==="Escape"&&o&&((y=g.target)==null?void 0:y.getAttribute("data-mantine-stop-propagation"))!=="true"&&i()},{capture:!0}),FS({opened:n,shouldReturnFocus:r&&s}),{_id:l,titleMounted:c,bodyMounted:d,shouldLockScroll:m,setTitleMounted:u,setBodyMounted:f}}const rN=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:S,unstyled:v,removeScrollProps:x,...w},b)=>{const{_id:j,titleMounted:E,bodyMounted:P,shouldLockScroll:T,setTitleMounted:_,setBodyMounted:D}=nN({id:r,transitionProps:o,opened:t,trapFocus:i,closeOnEscape:s,onClose:n,returnFocus:l});return C.createElement(ys,{...d,withinPortal:u},C.createElement(eN,{value:{opened:t,onClose:n,closeOnClickOutside:c,transitionProps:{...o,keepMounted:e},getTitleId:()=>`${j}-title`,getBodyId:()=>`${j}-body`,titleMounted:E,bodyMounted:P,setTitleMounted:_,setBodyMounted:D,trapFocus:i,closeOnEscape:s,zIndex:m,unstyled:v}},C.createElement(Jd,{enabled:T&&f,...x},C.createElement(H,{ref:b,...w,__vars:{...S,"--mb-z-index":(m||zr("modal")).toString(),"--mb-shadow":ig(g),"--mb-padding":rn(y)}},h))))});function oN(){const e=Lo();return p.useEffect(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}var Pa={title:"m_615af6c9",header:"m_b5489c3c",inner:"m_60c222c7",content:"m_fd1ab0aa",close:"m_606cb269",body:"m_5df29311"};const YE=p.forwardRef(({className:e,...t},n)=>{const r=oN(),o=Lo();return C.createElement(H,{ref:n,...t,id:r,className:et({[Pa.body]:!o.unstyled},e)})});YE.displayName="@mantine/core/ModalBaseBody";const XE=p.forwardRef(({className:e,onClick:t,...n},r)=>{const o=Lo();return C.createElement(vs,{ref:r,...n,onClick:i=>{o.onClose(),t==null||t(i)},className:et({[Pa.close]:!o.unstyled},e),unstyled:o.unstyled})});XE.displayName="@mantine/core/ModalBaseCloseButton";const iN=p.forwardRef(({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:o,...i},s)=>{const l=Lo();return C.createElement($o,{mounted:l.opened,transition:"pop",...l.transitionProps,...e},c=>C.createElement("div",{...n,className:et({[Pa.inner]:!l.unstyled},n.className)},C.createElement(wf,{active:l.opened&&l.trapFocus},C.createElement(Fn,{...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,ref:s,style:[o,c],className:et({[Pa.content]:!l.unstyled},t),unstyled:l.unstyled},i.children))))}),JE=p.forwardRef(({className:e,...t},n)=>{const r=Lo();return C.createElement(H,{component:"header",ref:n,className:et({[Pa.header]:!r.unstyled},e),...t})});JE.displayName="@mantine/core/ModalBaseHeader";const sN={duration:200,timingFunction:"ease",transition:"fade"};function aN(e){const t=Lo();return{...sN,...t.transitionProps,...e}}const ZE=p.forwardRef(({onClick:e,transitionProps:t,style:n,...r},o)=>{const i=Lo(),s=aN(t);return C.createElement($o,{mounted:i.opened,...s,transition:"fade"},l=>C.createElement(oc,{ref:o,fixed:!0,style:[n,l],zIndex:i.zIndex,unstyled:i.unstyled,onClick:c=>{e==null||e(c),i.closeOnClickOutside&&i.onClose()},...r}))});ZE.displayName="@mantine/core/ModalBaseOverlay";function lN(){const e=Lo();return p.useEffect(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}const ej=p.forwardRef(({className:e,...t},n)=>{const r=lN(),o=Lo();return C.createElement(H,{component:"h2",ref:n,className:et({[Pa.title]:!o.unstyled},e),...t,id:r})});ej.displayName="@mantine/core/ModalBaseTitle";function cN({children:e}){return C.createElement(C.Fragment,null,e)}const[uN,Ua]=vc({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0});var xr={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 b1={},dN=(e,{size:t})=>({description:{"--input-description-size":t===void 0?void 0:`calc(${Xt(t)} - ${B(2)})`}}),bf=Q((e,t)=>{const n=U("InputDescription",b1,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,__staticSelector:d,__inheritStyles:f=!0,variant:h,...m}=U("InputDescription",b1,n),g=Ua(),y=ce({name:["InputWrapper",d],props:n,classes:xr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"description",vars:c,varsResolver:dN}),S=f&&(g==null?void 0:g.getStyles)||y;return C.createElement(H,{component:"p",ref:t,variant:h,size:u,...S("description",g!=null&&g.getStyles?{className:o,style:i}:void 0),...m})});bf.classes=xr;bf.displayName="@mantine/core/InputDescription";const fN={},hN=(e,{size:t})=>({error:{"--input-error-size":t===void 0?void 0:`calc(${Xt(t)} - ${B(2)})`}}),Cf=Q((e,t)=>{const n=U("InputError",fN,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=ce({name:["InputWrapper",d],props:n,classes:xr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"error",vars:c,varsResolver:hN}),y=Ua(),S=f&&(y==null?void 0:y.getStyles)||g;return C.createElement(H,{component:"p",ref:t,variant:h,size:u,...S("error",y!=null&&y.getStyles?{className:o,style:i}:void 0),...m})});Cf.classes=xr;Cf.displayName="@mantine/core/InputError";const C1={labelElement:"label"},pN=(e,{size:t})=>({label:{"--input-label-size":Xt(t),"--input-asterisk-color":void 0}}),Ef=Q((e,t)=>{const n=U("InputLabel",C1,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:S,mod:v,...x}=U("InputLabel",C1,n),w=ce({name:["InputWrapper",y],props:n,classes:xr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"label",vars:c,varsResolver:pN}),b=Ua(),j=(b==null?void 0:b.getStyles)||w;return C.createElement(H,{...j("label",b!=null&&b.getStyles?{className:o,style:i}:void 0),component:u,variant:S,size:d,ref:t,htmlFor:u==="label"?h:void 0,mod:[{required:f},v],onMouseDown:E=>{m==null||m(E),!E.defaultPrevented&&E.detail>1&&E.preventDefault()},...x},g,f&&C.createElement("span",{...j("required"),"aria-hidden":!0}," *"))});Ef.classes=xr;Ef.displayName="@mantine/core/InputLabel";const E1={},jy=Q((e,t)=>{const n=U("InputPlaceholder",E1,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,__staticSelector:u,variant:d,error:f,mod:h,...m}=U("InputPlaceholder",E1,n),g=ce({name:["InputPlaceholder",u],props:n,classes:xr,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"placeholder"});return C.createElement(H,{...g("placeholder"),mod:[{error:!!f},h],component:"span",variant:d,ref:t,...m})});jy.classes=xr;jy.displayName="@mantine/core/InputPlaceholder";function mN(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 gN={labelElement:"label",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},yN=(e,{size:t})=>({label:{"--input-label-size":Xt(t),"--input-asterisk-color":void 0},error:{"--input-error-size":t===void 0?void 0:`calc(${Xt(t)} - ${B(2)})`},description:{"--input-description-size":t===void 0?void 0:`calc(${Xt(t)} - ${B(2)})`}}),Py=Q((e,t)=>{const n=U("InputWrapper",gN,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:S,labelProps:v,descriptionProps:x,errorProps:w,labelElement:b,children:j,withAsterisk:E,id:P,required:T,__stylesApiProps:_,mod:D,...O}=n,I=ce({name:["InputWrapper",f],props:_||n,classes:xr,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:yN}),L={size:u,variant:d,__staticSelector:f},N=Tn(P),M=typeof E=="boolean"?E:T,$=(w==null?void 0:w.id)||`${N}-error`,R=(x==null?void 0:x.id)||`${N}-description`,k=N,F=!!y&&typeof y!="boolean",q=!!S,G=`${F?$:""} ${q?R:""}`,ne=G.trim().length>0?G.trim():void 0,xe=(v==null?void 0:v.id)||`${N}-label`,ge=g&&C.createElement(Ef,{key:"label",labelElement:b,id:xe,htmlFor:k,required:M,...L,...v},g),Pe=q&&C.createElement(bf,{key:"description",...x,...L,size:(x==null?void 0:x.size)||L.size,id:(x==null?void 0:x.id)||R},S),Te=C.createElement(C.Fragment,{key:"input"},h(j)),Le=F&&C.createElement(Cf,{...w,...L,size:(w==null?void 0:w.size)||L.size,key:"error",id:(w==null?void 0:w.id)||$},y),pe=m.map(Ge=>{switch(Ge){case"label":return ge;case"input":return Te;case"description":return Pe;case"error":return Le;default:return null}});return C.createElement(uN,{value:{getStyles:I,describedBy:ne,inputId:k,labelId:xe,...mN(m,{hasDescription:q,hasError:F})}},C.createElement(H,{ref:t,variant:d,size:u,mod:[{error:!!y},D],...I("root"),...O},pe))});Py.classes=xr;Py.displayName="@mantine/core/InputWrapper";const vN={variant:"default",leftSectionPointerEvents:"none",rightSectionPointerEvents:"none",withAria:!0,withErrorStyles:!0},xN=(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":ke(t.size,"input-height"),"--input-fz":Xt(t.size),"--input-radius":t.radius===void 0?void 0:gt(t.radius),"--input-left-section-width":t.leftSectionWidth!==void 0?B(t.leftSectionWidth):void 0,"--input-right-section-width":t.rightSectionWidth!==void 0?B(t.rightSectionWidth):void 0,"--input-padding-y":t.multiline?ke(t.size,"input-padding-y"):void 0,"--input-left-section-pointer-events":t.leftSectionPointerEvents,"--input-right-section-pointer-events":t.rightSectionPointerEvents}}),bt=yn((e,t)=>{const n=U("Input",vN,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:S,leftSectionWidth:v,rightSection:x,rightSectionProps:w,rightSectionWidth:b,rightSectionPointerEvents:j,leftSectionPointerEvents:E,variant:P,vars:T,pointer:_,multiline:D,radius:O,id:I,withAria:L,withErrorStyles:N,mod:M,...$}=n,{styleProps:R,rest:k}=No($),F=Ua(),q={offsetBottom:F==null?void 0:F.offsetBottom,offsetTop:F==null?void 0:F.offsetTop},G=ce({name:["Input",u],props:d||n,classes:xr,className:o,style:i,classNames:r,styles:s,unstyled:l,stylesCtx:q,rootSelector:"wrapper",vars:T,varsResolver:xN}),ne=L?{required:c,disabled:g,"aria-invalid":!!m,"aria-describedby":F==null?void 0:F.describedBy,id:(F==null?void 0:F.inputId)||I}:{};return C.createElement(H,{...G("wrapper"),...R,...h,mod:[{error:!!m&&N,pointer:_,disabled:g,multiline:D,"data-with-right-section":!!x,"data-with-left-section":!!y},M],variant:P,size:f},y&&C.createElement("div",{...S,"data-position":"left",...G("section",{className:S==null?void 0:S.className,style:S==null?void 0:S.style})},y),C.createElement(H,{component:"input",...k,...ne,ref:t,required:c,mod:{disabled:g,error:!!m&&N},variant:P,...G("input")}),x&&C.createElement("div",{...w,"data-position":"right",...G("section",{className:w==null?void 0:w.className,style:w==null?void 0:w.style})},x))});bt.classes=xr;bt.Wrapper=Py;bt.Label=Ef;bt.Error=Cf;bt.Description=bf;bt.Placeholder=jy;bt.displayName="@mantine/core/Input";function wN(e,t,n){const r=U(e,t,n),{label:o,description:i,error:s,required:l,classNames:c,styles:u,className:d,unstyled:f,__staticSelector:h,__stylesApiProps:m,errorProps:g,labelProps:y,descriptionProps:S,wrapperProps:v,id:x,size:w,style:b,inputContainer:j,inputWrapperOrder:E,withAsterisk:P,variant:T,vars:_,mod:D,...O}=r,{styleProps:I,rest:L}=No(O),N={label:o,description:i,error:s,required:l,classNames:c,className:d,__staticSelector:h,__stylesApiProps:m||r,errorProps:g,labelProps:y,descriptionProps:S,unstyled:f,styles:u,size:w,style:b,inputContainer:j,inputWrapperOrder:E,withAsterisk:P,variant:T,id:x,mod:D,...v};return{...L,classNames:c,styles:u,unstyled:f,wrapperProps:{...N,...I},inputProps:{required:l,classNames:c,styles:u,unstyled:f,size:w,__staticSelector:h,__stylesApiProps:m||r,error:s,variant:T,id:x}}}const SN={__staticSelector:"InputBase",withAria:!0},wr=yn((e,t)=>{const{inputProps:n,wrapperProps:r,...o}=wN("InputBase",SN,e);return C.createElement(bt.Wrapper,{...r},C.createElement(bt,{...n,...o,ref:t}))});wr.classes={...bt.classes,...bt.Wrapper.classes};wr.displayName="@mantine/core/InputBase";const bN={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 tj={root:"m_8bffd616"};const CN={},os=yn((e,t)=>{const n=U("Flex",CN,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,...S}=n,v=ce({name:"Flex",classes:tj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c}),x=Tt(),w=wc(),b=XS({styleProps:{gap:u,rowGap:d,columnGap:f,align:h,justify:m,wrap:g,direction:y},theme:x,data:bN});return C.createElement(C.Fragment,null,b.hasResponsiveStyles&&C.createElement($a,{selector:`.${w}`,styles:b.styles,media:b.media}),C.createElement(H,{ref:t,...v("root",{className:w,style:fs(b.inlineStyles)}),...S}))});os.classes=tj;os.displayName="@mantine/core/Flex";function EN(e,t){if(!t||!e)return!1;let n=t.parentNode;for(;n!=null;){if(n===e)return!0;n=n.parentNode}return!1}function jN({target:e,parent:t,ref:n,displayAfterTransitionEnd:r}){const o=p.useRef(),[i,s]=p.useState(!1),[l,c]=p.useState(typeof r=="boolean"?r:!1),u=()=>{if(!e||!t)return;const m=e.getBoundingClientRect(),g=t.getBoundingClientRect(),y={top:m.top-g.top,left:m.left-g.left,width:m.width,height:m.height};n.current&&(n.current.style.transform=`translateY(${y.top}px) translateX(${y.left}px)`,n.current.style.width=`${y.width}px`,n.current.style.height=`${y.height}px`)},d=()=>{window.clearTimeout(o.current),n.current&&(n.current.style.transitionDuration="0ms"),u(),o.current=window.setTimeout(()=>{n.current&&(n.current.style.transitionDuration="")},30)},f=p.useRef(),h=p.useRef();return p.useEffect(()=>{if(u(),e)return f.current=new ResizeObserver(d),f.current.observe(e),h.current=new ResizeObserver(d),h.current.observe(t),()=>{var m,g;(m=f.current)==null||m.disconnect(),(g=h.current)==null||g.disconnect()}},[t,e]),p.useEffect(()=>{if(t){const m=g=>{EN(g.target,t)&&(d(),c(!1))};return document.addEventListener("transitionend",m),()=>{document.removeEventListener("transitionend",m)}}},[t]),M2(()=>{HS()!=="test"&&s(!0)},20,{autoInvoke:!0}),$2(m=>{m.forEach(g=>{g.type==="attributes"&&g.attributeName==="dir"&&d()})},{attributes:!0,attributeFilter:["dir"]},()=>document.documentElement),{initialized:i,hidden:l}}var nj={root:"m_96b553a6"};const PN={},TN=(e,{transitionDuration:t})=>({root:{"--transition-duration":typeof t=="number"?`${t}ms`:t}}),Ty=Q((e,t)=>{const n=U("FloatingIndicator",PN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,target:u,parent:d,transitionDuration:f,mod:h,displayAfterTransitionEnd:m,...g}=n,y=ce({name:"FloatingIndicator",classes:nj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:TN}),S=p.useRef(null),{initialized:v,hidden:x}=jN({target:u,parent:d,ref:S,displayAfterTransitionEnd:m}),w=Qt(t,S);return!u||!d?null:C.createElement(H,{ref:w,mod:[{initialized:v,hidden:x},h],...y("root"),...g})});Ty.displayName="@mantine/core/FloatingIndicator";Ty.classes=nj;var rj={root:"m_66836ed3",wrapper:"m_a5d60502",body:"m_667c2793",title:"m_6a03f287",label:"m_698f4f23",icon:"m_667f2a6a",message:"m_7fa78076",closeButton:"m_87f54839"};const kN={},RN=(e,{radius:t,color:n,variant:r,autoContrast:o})=>{const i=e.variantColorResolver({color:n||e.primaryColor,theme:e,variant:r||"light",autoContrast:o});return{root:{"--alert-radius":t===void 0?void 0:gt(t),"--alert-bg":n||r?i.background:void 0,"--alert-color":i.color,"--alert-bd":n||r?i.border:void 0}}},xs=Q((e,t)=>{const n=U("Alert",kN,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:S,closeButtonLabel:v,variant:x,autoContrast:w,...b}=n,j=ce({name:"Alert",classes:rj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:RN}),E=Tn(m),P=f&&`${E}-title`||void 0,T=`${E}-body`;return C.createElement(H,{id:E,...j("root",{variant:x}),variant:x,ref:t,...b,role:"alert","aria-describedby":T,"aria-labelledby":P},C.createElement("div",{...j("wrapper")},g&&C.createElement("div",{...j("icon")},g),C.createElement("div",{...j("body")},f&&C.createElement("div",{...j("title"),"data-with-close-button":y||void 0},C.createElement("span",{id:P,...j("label")},f)),h&&C.createElement("div",{id:T,...j("message"),"data-variant":x},h)),y&&C.createElement(vs,{...j("closeButton"),onClick:S,variant:"transparent",size:16,iconSize:16,"aria-label":v,unstyled:l})))});xs.classes=rj;xs.displayName="@mantine/core/Alert";var oj={root:"m_b6d8b162"};function _N(e){if(e==="start")return"start";if(e==="end"||e)return"end"}const IN={inherit:!1},DN=(e,{variant:t,lineClamp:n,gradient:r,size:o,color:i})=>({root:{"--text-fz":Xt(o),"--text-lh":MS(o),"--text-gradient":t==="gradient"?Cp(r,e):void 0,"--text-line-clamp":typeof n=="number"?n.toString():void 0,"--text-color":i?mt(i,e):void 0}}),oe=yn((e,t)=>{const n=U("Text",IN,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:S,mod:v,size:x,...w}=n,b=ce({name:["Text",u],props:n,classes:oj,className:f,style:h,classNames:m,styles:g,unstyled:y,vars:d,varsResolver:DN});return C.createElement(H,{...b("root",{focusable:!0}),ref:t,component:c?"span":"p",variant:S,mod:[{"data-truncate":_N(o),"data-line-clamp":typeof r=="number","data-inline":i,"data-inherit":s},v],size:x,...w})});oe.classes=oj;oe.displayName="@mantine/core/Text";var ij={root:"m_849cf0da"};const AN={underline:"hover"},Ve=yn((e,t)=>{const{underline:n,className:r,unstyled:o,mod:i,...s}=U("Anchor",AN,e);return C.createElement(oe,{component:"a",ref:t,className:et({[ij.root]:!o},r),...s,mod:[{underline:n},i],__staticSelector:"Anchor",unstyled:o})});Ve.classes=ij;Ve.displayName="@mantine/core/Anchor";const[NN,Va]=Pn("AppShell was not found in tree");var Pi={root:"m_89ab340",navbar:"m_45252eee",aside:"m_9cdde9a",header:"m_3b16f56b",main:"m_8983817",footer:"m_3840c879",section:"m_6dcfc7c7"};const ON={},ky=Q((e,t)=>{const n=U("AppShellAside",ON,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,mod:f,...h}=n,m=Va();return m.disabled?null:C.createElement(H,{component:"aside",ref:t,mod:[{"with-border":u??m.withBorder},f],...m.getStyles("aside",{className:o,classNames:r,styles:s,style:i}),...h,__vars:{"--app-shell-aside-z-index":`calc(${d??m.zIndex} + 1)`}})});ky.classes=Pi;ky.displayName="@mantine/core/AppShellAside";const MN={},Ry=Q((e,t)=>{var g;const n=U("AppShellFooter",MN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,mod:f,...h}=n,m=Va();return m.disabled?null:C.createElement(H,{component:"footer",ref:t,mod:[{"with-border":u??m.withBorder},f],...m.getStyles("footer",{className:et({[Jd.classNames.zeroRight]:m.offsetScrollbars},o),classNames:r,styles:s,style:i}),...h,__vars:{"--app-shell-footer-z-index":(g=d??m.zIndex)==null?void 0:g.toString()}})});Ry.classes=Pi;Ry.displayName="@mantine/core/AppShellFooter";const $N={},_y=Q((e,t)=>{var g;const n=U("AppShellHeader",$N,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,mod:f,...h}=n,m=Va();return m.disabled?null:C.createElement(H,{component:"header",ref:t,mod:[{"with-border":u??m.withBorder},f],...m.getStyles("header",{className:et({[Jd.classNames.zeroRight]:m.offsetScrollbars},o),classNames:r,styles:s,style:i}),...h,__vars:{"--app-shell-header-z-index":(g=d??m.zIndex)==null?void 0:g.toString()}})});_y.classes=Pi;_y.displayName="@mantine/core/AppShellHeader";const LN={},Iy=Q((e,t)=>{const n=U("AppShellMain",LN,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=Va();return C.createElement(H,{component:"main",ref:t,...u.getStyles("main",{className:o,style:i,classNames:r,styles:s}),...c})});Iy.classes=Pi;Iy.displayName="@mantine/core/AppShellMain";function Tc(e){return typeof e=="object"?e.base:e}function kc(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 Rc(e){return!(typeof e!="object"||e===null||Object.keys(e).length===1&&"base"in e)}function FN({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"),kc(i)){const f=B(Tc(i));e["--app-shell-aside-width"]=f,e["--app-shell-aside-offset"]=f}if(Rc(i)&&(typeof i.base<"u"&&(e["--app-shell-aside-width"]=B(i.base),e["--app-shell-aside-offset"]=B(i.base)),pt(i).forEach(f=>{f!=="base"&&(t[f]=t[f]||{},t[f]["--app-shell-aside-width"]=B(i[f]),t[f]["--app-shell-aside-offset"]=B(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=sg(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 zN({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(kc(r)){const s=B(Tc(r));e["--app-shell-footer-height"]=s,i&&(e["--app-shell-footer-offset"]=s)}Rc(r)&&(typeof r.base<"u"&&(e["--app-shell-footer-height"]=B(r.base),i&&(e["--app-shell-footer-offset"]=B(r.base))),pt(r).forEach(s=>{s!=="base"&&(t[s]=t[s]||{},t[s]["--app-shell-footer-height"]=B(r[s]),i&&(t[s]["--app-shell-footer-offset"]=B(r[s])))})),n!=null&&n.collapsed&&(e["--app-shell-footer-transform"]=o,e["--app-shell-footer-offset"]="0px !important")}function BN({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(kc(r)){const s=B(Tc(r));e["--app-shell-header-height"]=s,i&&(e["--app-shell-header-offset"]=s)}Rc(r)&&(typeof r.base<"u"&&(e["--app-shell-header-height"]=B(r.base),i&&(e["--app-shell-header-offset"]=B(r.base))),pt(r).forEach(s=>{s!=="base"&&(t[s]=t[s]||{},t[s]["--app-shell-header-height"]=B(r[s]),i&&(t[s]["--app-shell-header-offset"]=B(r[s])))})),n!=null&&n.collapsed&&(e["--app-shell-header-transform"]=o,e["--app-shell-header-offset"]="0px !important")}function UN({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"),kc(i)){const f=B(Tc(i));e["--app-shell-navbar-width"]=f,e["--app-shell-navbar-offset"]=f}if(Rc(i)&&(typeof i.base<"u"&&(e["--app-shell-navbar-width"]=B(i.base),e["--app-shell-navbar-offset"]=B(i.base)),pt(i).forEach(f=>{f!=="base"&&(t[f]=t[f]||{},t[f]["--app-shell-navbar-width"]=B(i[f]),t[f]["--app-shell-navbar-offset"]=B(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=sg(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 op(e){return Number(e)===0?"0px":rn(e)}function VN({padding:e,baseStyles:t,minMediaStyles:n}){kc(e)&&(t["--app-shell-padding"]=op(Tc(e))),Rc(e)&&(e.base&&(t["--app-shell-padding"]=op(e.base)),pt(e).forEach(r=>{r!=="base"&&(n[r]=n[r]||{},n[r]["--app-shell-padding"]=op(e[r]))}))}function HN({navbar:e,header:t,footer:n,aside:r,padding:o,theme:i}){const s={},l={},c={};UN({baseStyles:c,minMediaStyles:s,maxMediaStyles:l,navbar:e,theme:i}),FN({baseStyles:c,minMediaStyles:s,maxMediaStyles:l,aside:r,theme:i}),BN({baseStyles:c,minMediaStyles:s,header:t}),zN({baseStyles:c,minMediaStyles:s,footer:n}),VN({baseStyles:c,minMediaStyles:s,padding:o});const u=Ll(pt(s),i).map(h=>({query:`(min-width: ${nd(h.px)})`,styles:s[h.value]})),d=Ll(pt(l),i).map(h=>({query:`(max-width: ${nd(h.px)})`,styles:l[h.value]})),f=[...u,...d];return{baseStyles:c,media:f}}function WN({navbar:e,header:t,aside:n,footer:r,padding:o}){const i=Tt(),s=Ma(),{media:l,baseStyles:c}=HN({navbar:e,header:t,footer:r,aside:n,padding:o,theme:i});return C.createElement($a,{media:l,styles:c,selector:s.cssVariablesSelector})}const qN={},Dy=Q((e,t)=>{const n=U("AppShellNavbar",qN,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,withBorder:u,zIndex:d,mod:f,...h}=n,m=Va();return m.disabled?null:C.createElement(H,{component:"nav",ref:t,mod:[{"with-border":u??m.withBorder},f],...m.getStyles("navbar",{className:o,classNames:r,styles:s,style:i}),...h,__vars:{"--app-shell-navbar-z-index":`calc(${d??m.zIndex} + 1)`}})});Dy.classes=Pi;Dy.displayName="@mantine/core/AppShellNavbar";const GN={},Ay=yn((e,t)=>{const n=U("AppShellSection",GN,e),{classNames:r,className:o,style:i,styles:s,vars:l,grow:c,mod:u,...d}=n,f=Va();return C.createElement(H,{ref:t,mod:[{grow:c},u],...f.getStyles("section",{className:o,style:i,classNames:r,styles:s}),...d})});Ay.classes=Pi;Ay.displayName="@mantine/core/AppShellSection";function QN({transitionDuration:e,disabled:t}){const[n,r]=p.useState(!0),o=p.useRef(),i=p.useRef();return VS("resize",()=>{r(!0),clearTimeout(o.current),o.current=window.setTimeout(()=>r(!1),200)}),Oa(()=>{p.startTransition(()=>{r(!0),clearTimeout(i.current),i.current=window.setTimeout(()=>r(!1),e||0)})},[t,e]),n}const KN={withBorder:!0,offsetScrollbars:!0,padding:0,transitionDuration:200,transitionTimingFunction:"ease",zIndex:zr("app")},YN=(e,{transitionDuration:t,transitionTimingFunction:n})=>({root:{"--app-shell-transition-duration":`${t}ms`,"--app-shell-transition-timing-function":n}}),Bn=Q((e,t)=>{const n=U("AppShell",KN,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:S,disabled:v,aside:x,footer:w,offsetScrollbars:b,mod:j,...E}=n,P=ce({name:"AppShell",classes:Pi,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:YN}),T=QN({disabled:v,transitionDuration:h});return C.createElement(NN,{value:{getStyles:P,withBorder:d,zIndex:y,disabled:v,offsetScrollbars:b}},C.createElement(WN,{navbar:u,header:g,aside:x,footer:w,padding:f}),C.createElement(H,{ref:t,...P("root"),mod:[{resizing:T,layout:S,disabled:v},j],...E}))});Bn.classes=Pi;Bn.displayName="@mantine/core/AppShell";Bn.Navbar=Dy;Bn.Header=_y;Bn.Main=Iy;Bn.Aside=ky;Bn.Footer=Ry;Bn.Section=Ay;function sj(e){return typeof e=="string"?{value:e,label:e}:"value"in e&&!("label"in e)?{value:e.value,label:e.value,disabled:e.disabled}:typeof e=="number"?{value:e.toString(),label:e.toString()}:"group"in e?{group:e.group,items:e.items.map(t=>sj(t))}:e}function aj(e){return e?e.map(t=>sj(t)):[]}function lj(e){return e.reduce((t,n)=>"group"in n?{...t,...lj(n.items)}:(t[n.value]=n,t),{})}var Vn={dropdown:"m_88b62a41",options:"m_b2821a6e",option:"m_92253aa5",search:"m_985517d8",empty:"m_2530cd1d",header:"m_858f94bd",footer:"m_82b967cb",group:"m_254f3e4f",groupLabel:"m_2bb2e9e5",chevron:"m_2943220b",optionsDropdownOption:"m_390b5f4",optionsDropdownCheckIcon:"m_8ee53fc2"};const XN={error:null},JN=(e,{size:t})=>({chevron:{"--combobox-chevron-size":ke(t,"combobox-chevron-size")}}),jf=Q((e,t)=>{const n=U("ComboboxChevron",XN,e),{size:r,error:o,style:i,className:s,classNames:l,styles:c,unstyled:u,vars:d,mod:f,...h}=n,m=ce({name:"ComboboxChevron",classes:Vn,props:n,style:i,className:s,classNames:l,styles:c,unstyled:u,vars:d,varsResolver:JN,rootSelector:"chevron"});return C.createElement(H,{component:"svg",...h,...m("chevron"),size:r,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",mod:["combobox-chevron",{error:o},f],ref:t},C.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))});jf.classes=Vn;jf.displayName="@mantine/core/ComboboxChevron";const[ZN,Sr]=Pn("Combobox component was not found in tree"),cj=p.forwardRef(({size:e,onMouseDown:t,onClick:n,onClear:r,...o},i)=>C.createElement(vs,{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)}}));cj.displayName="@mantine/core/ComboboxClearButton";const e3={},Ny=Q((e,t)=>{const{classNames:n,styles:r,className:o,style:i,hidden:s,...l}=U("ComboboxDropdown",e3,e),c=Sr();return C.createElement(Br.Dropdown,{...l,ref:t,role:"presentation","data-hidden":s||void 0,...c.getStyles("dropdown",{className:o,style:i,classNames:n,styles:r})})});Ny.classes=Vn;Ny.displayName="@mantine/core/ComboboxDropdown";const t3={refProp:"ref"},uj=Q((e,t)=>{const{children:n,refProp:r}=U("ComboboxDropdownTarget",t3,e);if(Sr(),!Ao(n))throw new Error("Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");return C.createElement(Br.Target,{ref:t,refProp:r},n)});uj.displayName="@mantine/core/ComboboxDropdownTarget";const n3={},Oy=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=U("ComboboxEmpty",n3,e),c=Sr();return C.createElement(H,{ref:t,...c.getStyles("empty",{className:r,classNames:n,styles:i,style:o}),...l})});Oy.classes=Vn;Oy.displayName="@mantine/core/ComboboxEmpty";function My({onKeyDown:e,withKeyboardNavigation:t,withAriaAttributes:n,withExpandedAttribute:r,targetType:o,autoComplete:i}){const s=Sr(),[l,c]=p.useState(null),u=f=>{if(e==null||e(f),!s.readOnly&&t){if(f.nativeEvent.isComposing)return;if(f.nativeEvent.code==="ArrowDown"&&(f.preventDefault(),s.store.dropdownOpened?c(s.store.selectNextOption()):(s.store.openDropdown("keyboard"),c(s.store.selectActiveOption()))),f.nativeEvent.code==="ArrowUp"&&(f.preventDefault(),s.store.dropdownOpened?c(s.store.selectPreviousOption()):(s.store.openDropdown("keyboard"),c(s.store.selectActiveOption()))),f.nativeEvent.code==="Enter"||f.nativeEvent.code==="NumpadEnter"){if(f.nativeEvent.keyCode===229)return;const h=s.store.getSelectedOptionIndex();s.store.dropdownOpened&&h!==-1?(f.preventDefault(),s.store.clickSelectedOption()):o==="button"&&(f.preventDefault(),s.store.openDropdown("keyboard"))}f.nativeEvent.code==="Escape"&&s.store.closeDropdown("keyboard"),f.nativeEvent.code==="Space"&&o==="button"&&(f.preventDefault(),s.store.toggleDropdown("keyboard"))}};return{...n?{"aria-haspopup":"listbox","aria-expanded":r&&!!(s.store.listId&&s.store.dropdownOpened)||void 0,"aria-controls":s.store.listId,"aria-activedescendant":s.store.dropdownOpened&&l||void 0,autoComplete:i,"data-expanded":s.store.dropdownOpened||void 0,"data-mantine-stop-propagation":s.store.dropdownOpened||void 0}:{},onKeyDown:u}}const r3={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},dj=Q((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:i,withExpandedAttribute:s,targetType:l,autoComplete:c,...u}=U("ComboboxEventsTarget",r3,e);if(!Ao(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 d=Sr(),f=My({targetType:l,withAriaAttributes:i,withKeyboardNavigation:o,withExpandedAttribute:s,onKeyDown:n.props.onKeyDown,autoComplete:c});return p.cloneElement(n,{...f,...u,[r]:Qt(t,d.store.targetRef,n==null?void 0:n.ref)})});dj.displayName="@mantine/core/ComboboxEventsTarget";const o3={},$y=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=U("ComboboxFooter",o3,e),c=Sr();return C.createElement(H,{ref:t,...c.getStyles("footer",{className:r,classNames:n,style:o,styles:i}),...l})});$y.classes=Vn;$y.displayName="@mantine/core/ComboboxFooter";const i3={},Ly=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,children:l,label:c,...u}=U("ComboboxGroup",i3,e),d=Sr();return C.createElement(H,{ref:t,...d.getStyles("group",{className:r,classNames:n,style:o,styles:i}),...u},c&&C.createElement("div",{...d.getStyles("groupLabel",{classNames:n,styles:i})},c),l)});Ly.classes=Vn;Ly.displayName="@mantine/core/ComboboxGroup";const s3={},Fy=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=U("ComboboxHeader",s3,e),c=Sr();return C.createElement(H,{ref:t,...c.getStyles("header",{className:r,classNames:n,style:o,styles:i}),...l})});Fy.classes=Vn;Fy.displayName="@mantine/core/ComboboxHeader";function fj({value:e,valuesDivider:t=",",...n}){return C.createElement("input",{type:"hidden",value:Array.isArray(e)?e.join(t):e||"",...n})}fj.displayName="@mantine/core/ComboboxHiddenInput";const a3={},zy=Q((e,t)=>{const n=U("ComboboxOption",a3,e),{classNames:r,className:o,style:i,styles:s,vars:l,onClick:c,id:u,active:d,onMouseDown:f,onMouseOver:h,disabled:m,selected:g,mod:y,...S}=n,v=Sr(),x=p.useId(),w=u||x;return C.createElement(H,{...v.getStyles("option",{className:o,classNames:r,styles:s,style:i}),...S,ref:t,id:w,mod:["combobox-option",{"combobox-active":d,"combobox-disabled":m,"combobox-selected":g},y],role:"option",onClick:b=>{var j;m?b.preventDefault():((j=v.onOptionSubmit)==null||j.call(v,n.value,n),c==null||c(b))},onMouseDown:b=>{b.preventDefault(),f==null||f(b)},onMouseOver:b=>{v.resetSelectionOnOptionHover&&v.store.resetSelectedOption(),h==null||h(b)}})});zy.classes=Vn;zy.displayName="@mantine/core/ComboboxOption";const l3={},By=Q((e,t)=>{const n=U("ComboboxOptions",l3,e),{classNames:r,className:o,style:i,styles:s,id:l,onMouseDown:c,labelledBy:u,...d}=n,f=Sr(),h=Tn(l);return p.useEffect(()=>{f.store.setListId(h)},[h]),C.createElement(H,{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)}})});By.classes=Vn;By.displayName="@mantine/core/ComboboxOptions";const c3={withAriaAttributes:!0,withKeyboardNavigation:!0},Uy=Q((e,t)=>{const n=U("ComboboxSearch",c3,e),{classNames:r,styles:o,unstyled:i,vars:s,withAriaAttributes:l,onKeyDown:c,withKeyboardNavigation:u,size:d,...f}=n,h=Sr(),m=h.getStyles("search"),g=My({targetType:"input",withAriaAttributes:l,withKeyboardNavigation:u,withExpandedAttribute:!1,onKeyDown:c,autoComplete:"off"});return C.createElement(bt,{ref:Qt(t,h.store.searchRef),classNames:[{input:m.className},r],styles:[{input:m.style},o],size:d||h.size,...g,...f,__staticSelector:"Combobox"})});Uy.classes=Vn;Uy.displayName="@mantine/core/ComboboxSearch";const u3={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},hj=Q((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:i,withExpandedAttribute:s,targetType:l,autoComplete:c,...u}=U("ComboboxTarget",u3,e);if(!Ao(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 d=Sr(),f=My({targetType:l,withAriaAttributes:i,withKeyboardNavigation:o,withExpandedAttribute:s,onKeyDown:n.props.onKeyDown,autoComplete:c}),h=p.cloneElement(n,{...f,...u});return C.createElement(Br.Target,{ref:Qt(t,d.store.targetRef)},h)});hj.displayName="@mantine/core/ComboboxTarget";function d3(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 f3(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 h3(e){for(let t=0;t<e.length;t+=1)if(!e[t].hasAttribute("data-combobox-disabled"))return t;return-1}function _c({defaultOpened:e,opened:t,onOpenedChange:n,onDropdownClose:r,onDropdownOpen:o,loop:i=!0,scrollBehavior:s="instant"}={}){const[l,c]=mn({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),S=p.useCallback(($="unknown")=>{l||(c(!0),o==null||o($))},[c,o,l]),v=p.useCallback(($="unknown")=>{l&&(c(!1),r==null||r($))},[c,r,l]),x=p.useCallback(($="unknown")=>{l?v($):S($)},[v,S,l]),w=p.useCallback(()=>{const $=document.querySelector(`#${u.current} [data-combobox-selected]`);$==null||$.removeAttribute("data-combobox-selected"),$==null||$.removeAttribute("aria-selected")},[]),b=p.useCallback($=>{const R=document.getElementById(u.current),k=R==null?void 0:R.querySelectorAll("[data-combobox-option]");if(!k)return null;const F=$>=k.length?0:$<0?k.length-1:$;return d.current=F,k!=null&&k[F]&&!k[F].hasAttribute("data-combobox-disabled")?(w(),k[F].setAttribute("data-combobox-selected","true"),k[F].setAttribute("aria-selected","true"),k[F].scrollIntoView({block:"nearest",behavior:s}),k[F].id):null},[s,w]),j=p.useCallback(()=>{const $=document.querySelector(`#${u.current} [data-combobox-active]`);if($){const R=document.querySelectorAll(`#${u.current} [data-combobox-option]`),k=Array.from(R).findIndex(F=>F===$);return b(k)}return b(0)},[b]),E=p.useCallback(()=>b(f3(d.current,document.querySelectorAll(`#${u.current} [data-combobox-option]`),i)),[b,i]),P=p.useCallback(()=>b(d3(d.current,document.querySelectorAll(`#${u.current} [data-combobox-option]`),i)),[b,i]),T=p.useCallback(()=>b(h3(document.querySelectorAll(`#${u.current} [data-combobox-option]`))),[b]),_=p.useCallback(($="selected",R)=>{y.current=window.setTimeout(()=>{var q;const k=document.querySelectorAll(`#${u.current} [data-combobox-option]`),F=Array.from(k).findIndex(G=>G.hasAttribute(`data-combobox-${$}`));d.current=F,R!=null&&R.scrollIntoView&&((q=k[F])==null||q.scrollIntoView({block:"nearest",behavior:s}))},0)},[]),D=p.useCallback(()=>{d.current=-1,w()},[w]),O=p.useCallback(()=>{const $=document.querySelectorAll(`#${u.current} [data-combobox-option]`),R=$==null?void 0:$[d.current];R==null||R.click()},[]),I=p.useCallback($=>{u.current=$},[]),L=p.useCallback(()=>{m.current=window.setTimeout(()=>f.current.focus(),0)},[]),N=p.useCallback(()=>{g.current=window.setTimeout(()=>h.current.focus(),0)},[]),M=p.useCallback(()=>d.current,[]);return p.useEffect(()=>()=>{window.clearTimeout(m.current),window.clearTimeout(g.current),window.clearTimeout(y.current)},[]),{dropdownOpened:l,openDropdown:S,closeDropdown:v,toggleDropdown:x,selectedOptionIndex:d.current,getSelectedOptionIndex:M,selectOption:b,selectFirstOption:T,selectActiveOption:j,selectNextOption:E,selectPreviousOption:P,resetSelectedOption:D,updateSelectedOptionIndex:_,listId:u.current,setListId:I,clickSelectedOption:O,searchRef:f,focusSearchInput:L,targetRef:h,focusTarget:N}}const p3={keepMounted:!0,withinPortal:!0,resetSelectionOnOptionHover:!1,width:"target",transitionProps:{transition:"fade",duration:0}},m3=(e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":Xt(t),"--combobox-option-padding":ke(t,"combobox-option-padding")},dropdown:{"--combobox-padding":n===void 0?void 0:B(n),"--combobox-option-fz":Xt(t),"--combobox-option-padding":ke(t,"combobox-option-padding")}});function Ee(e){const t=U("Combobox",p3,e),{classNames:n,styles:r,unstyled:o,children:i,store:s,vars:l,onOptionSubmit:c,onClose:u,size:d,dropdownPadding:f,resetSelectionOnOptionHover:h,__staticSelector:m,readOnly:g,...y}=t,S=_c(),v=s||S,x=ce({name:m||"Combobox",classes:Vn,props:t,classNames:n,styles:r,unstyled:o,vars:l,varsResolver:m3}),w=()=>{u==null||u(),v.closeDropdown()};return C.createElement(ZN,{value:{getStyles:x,store:v,onOptionSubmit:c,size:d,resetSelectionOnOptionHover:h,readOnly:g}},C.createElement(Br,{opened:v.dropdownOpened,...y,onClose:w,withRoles:!1,unstyled:o},i))}const g3=e=>e;Ee.extend=g3;Ee.classes=Vn;Ee.displayName="@mantine/core/Combobox";Ee.Target=hj;Ee.Dropdown=Ny;Ee.Options=By;Ee.Option=zy;Ee.Search=Uy;Ee.Empty=Oy;Ee.Chevron=jf;Ee.Footer=$y;Ee.Header=Fy;Ee.EventsTarget=dj;Ee.DropdownTarget=uj;Ee.Group=Ly;Ee.ClearButton=cj;Ee.HiddenInput=fj;var pj={root:"m_5f75b09e",body:"m_5f6e695e",labelWrapper:"m_d3ea56bb",label:"m_8ee546b8",description:"m_328f68c0",error:"m_8e8a99cc"};const mj=pj,Pf=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",bodyElement:g="div",labelElement:y="label",variant:S,style:v,vars:x,mod:w,...b},j)=>{const E=ce({name:e,props:t,className:n,style:v,classes:pj,classNames:r,styles:o,unstyled:i});return C.createElement(H,{...E("root"),ref:j,__vars:{"--label-fz":Xt(h),"--label-lh":ke(h,"label-lh")},mod:[{"label-position":m},w],variant:S,size:h,...b},C.createElement(H,{component:g,htmlFor:g==="label"?u:void 0,...E("body")},s,C.createElement("div",{...E("labelWrapper"),"data-disabled":d||void 0},l&&C.createElement(H,{component:y,htmlFor:y==="label"?u:void 0,...E("label"),"data-disabled":d||void 0},l),c&&C.createElement(bt.Description,{size:h,__inheritStyles:!1,...E("description")},c),f&&f!=="boolean"&&C.createElement(bt.Error,{size:h,__inheritStyles:!1,...E("error")},f))))});Pf.displayName="@mantine/core/InlineInput";const gj=p.createContext(null),y3=gj.Provider,v3=()=>p.useContext(gj);function Vy({children:e,role:t}){const n=Ua();return n?C.createElement("div",{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy},e):C.createElement(C.Fragment,null,e)}const x3={},Hy=Q((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:l,readOnly:c,...u}=U("CheckboxGroup",x3,e),[d,f]=mn({value:n,defaultValue:r,finalValue:[],onChange:o}),h=m=>{const g=m.currentTarget.value;!c&&f(d.includes(g)?d.filter(y=>y!==g):[...d,g])};return C.createElement(y3,{value:{value:d,onChange:h,size:i}},C.createElement(bt.Wrapper,{size:i,ref:t,...s,...u,labelElement:"div",__staticSelector:"CheckboxGroup"},C.createElement(Vy,{role:"group"},l)))});Hy.classes=bt.Wrapper.classes;Hy.displayName="@mantine/core/CheckboxGroup";function Tf({size:e,style:t,...n}){const r=e!==void 0?{width:B(e),height:B(e),...t}:t;return C.createElement("svg",{viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:r,"aria-hidden":!0,...n},C.createElement("path",{d:"M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}function w3({indeterminate:e,...t}){return e?C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 6","aria-hidden":!0,...t},C.createElement("rect",{width:"32",height:"6",fill:"currentColor",rx:"3"})):C.createElement(Tf,{...t})}var yj={root:"m_bf2d988c",inner:"m_26062bec",input:"m_26063560",icon:"m_bf295423","input--outline":"m_215c4542"};const S3={labelPosition:"right",icon:w3},b3=(e,{radius:t,color:n,size:r,iconColor:o,variant:i,autoContrast:s})=>{const l=io({color:n||e.primaryColor,theme:e}),c=l.isThemeColor&&l.shade===void 0?`var(--mantine-color-${l.color}-outline)`:l.color;return{root:{"--checkbox-size":ke(r,"checkbox-size"),"--checkbox-radius":t===void 0?void 0:gt(t),"--checkbox-color":i==="outline"?c:mt(n,e),"--checkbox-icon-color":o?mt(o,e):xc(s,e)?hs({color:n,theme:e}):void 0}}},gr=Q((e,t)=>{const n=U("Checkbox",S3,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:S,labelPosition:v,description:x,error:w,disabled:b,variant:j,indeterminate:E,icon:P,rootRef:T,iconColor:_,onChange:D,autoContrast:O,mod:I,...L}=n,N=v3(),M=h||(N==null?void 0:N.size),$=P,R=ce({name:"Checkbox",props:n,classes:yj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:b3}),{styleProps:k,rest:F}=No(L),q=Tn(f),G=N?{checked:N.value.includes(F.value),onChange:ne=>{N.onChange(ne),D==null||D(ne)}}:{};return C.createElement(Pf,{...R("root"),__staticSelector:"Checkbox",__stylesApiProps:n,id:q,size:M,labelPosition:v,label:d,description:x,error:w,disabled:b,classNames:r,styles:s,unstyled:l,"data-checked":G.checked||S||void 0,variant:j,ref:T,mod:I,...k,...g},C.createElement(H,{...R("inner"),mod:{"data-label-position":v}},C.createElement(H,{component:"input",id:q,ref:t,checked:S,disabled:b,mod:{error:!!w,indeterminate:E},...R("input",{focusable:!0,variant:j}),onChange:D,...F,...G,type:"checkbox"}),C.createElement($,{indeterminate:E,...R("icon")})))});gr.classes={...yj,...mj};gr.displayName="@mantine/core/Checkbox";gr.Group=Hy;function Ta(e){return"group"in e}function vj({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;Ta(s)&&o.push({group:s.group,items:vj({options:s.items,search:t,limit:n-o.length})}),Ta(s)||s.label.toLowerCase().includes(r)&&o.push(s)}return o}function C3(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 xj(e,t=new Set){if(Array.isArray(e))for(const n of e)if(Ta(n))xj(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 E3(e,t){return Array.isArray(e)?e.includes(t):e===t}function wj({data:e,withCheckIcon:t,value:n,checkIconPosition:r,unstyled:o,renderOption:i}){if(!Ta(e)){const l=E3(n,e.value),c=t&&l&&C.createElement(Tf,{className:Vn.optionsDropdownCheckIcon}),u=C.createElement(C.Fragment,null,r==="left"&&c,C.createElement("span",null,e.label),r==="right"&&c);return C.createElement(Ee.Option,{value:e.value,disabled:e.disabled,className:et({[Vn.optionsDropdownOption]:!o}),"data-reverse":r==="right"||void 0,"data-checked":l||void 0,"aria-selected":l,active:l},typeof i=="function"?i({option:e,checked:l}):u)}const s=e.items.map(l=>C.createElement(wj,{data:l,value:n,key:l.value,unstyled:o,withCheckIcon:t,checkIconPosition:r,renderOption:i}));return C.createElement(Ee.Group,{label:e.group},s)}function j3({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,renderOption:y,scrollAreaProps:S}){xj(e);const x=typeof o=="string"?(r||vj)({options:e,search:c?o:"",limit:i??1/0}):e,w=C3(x),b=x.map(j=>C.createElement(wj,{data:j,key:Ta(j)?j.group:j.value,withCheckIcon:u,value:d,checkIconPosition:f,unstyled:m,renderOption:y}));return C.createElement(Ee.Dropdown,{hidden:t||n&&w},C.createElement(Ee.Options,{labelledBy:g},l?C.createElement(vr.Autosize,{mah:s??220,type:"scroll",scrollbarSize:"var(--combobox-padding)",offsetScrollbars:"y",...S},b):b,w&&h&&C.createElement(Ee.Empty,null,h)))}const Sj=p.createContext(null),P3=Sj.Provider;function T3(){return{withinGroup:!!p.useContext(Sj)}}var kf={group:"m_11def92b",root:"m_f85678b6",image:"m_11f8ac07",placeholder:"m_104cd71f"};const k3={},R3=(e,{spacing:t})=>({group:{"--ag-spacing":rn(t)}}),Wy=Q((e,t)=>{const n=U("AvatarGroup",k3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,spacing:u,...d}=n,f=ce({name:"AvatarGroup",classes:kf,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:R3,rootSelector:"group"});return C.createElement(P3,{value:!0},C.createElement(H,{ref:t,...f("group"),...d}))});Wy.classes=kf;Wy.displayName="@mantine/core/AvatarGroup";function _3(e){return C.createElement("svg",{...e,"data-avatar-placeholder-icon":!0,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},C.createElement("path",{d:"M0.877014 7.49988C0.877014 3.84219 3.84216 0.877045 7.49985 0.877045C11.1575 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1575 14.1227 7.49985 14.1227C3.84216 14.1227 0.877014 11.1575 0.877014 7.49988ZM7.49985 1.82704C4.36683 1.82704 1.82701 4.36686 1.82701 7.49988C1.82701 8.97196 2.38774 10.3131 3.30727 11.3213C4.19074 9.94119 5.73818 9.02499 7.50023 9.02499C9.26206 9.02499 10.8093 9.94097 11.6929 11.3208C12.6121 10.3127 13.1727 8.97172 13.1727 7.49988C13.1727 4.36686 10.6328 1.82704 7.49985 1.82704ZM10.9818 11.9787C10.2839 10.7795 8.9857 9.97499 7.50023 9.97499C6.01458 9.97499 4.71624 10.7797 4.01845 11.9791C4.97952 12.7272 6.18765 13.1727 7.49985 13.1727C8.81227 13.1727 10.0206 12.727 10.9818 11.9787ZM5.14999 6.50487C5.14999 5.207 6.20212 4.15487 7.49999 4.15487C8.79786 4.15487 9.84999 5.207 9.84999 6.50487C9.84999 7.80274 8.79786 8.85487 7.49999 8.85487C6.20212 8.85487 5.14999 7.80274 5.14999 6.50487ZM7.49999 5.10487C6.72679 5.10487 6.09999 5.73167 6.09999 6.50487C6.09999 7.27807 6.72679 7.90487 7.49999 7.90487C8.27319 7.90487 8.89999 7.27807 8.89999 6.50487C8.89999 5.73167 8.27319 5.10487 7.49999 5.10487Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}const I3={},D3=(e,{size:t,radius:n,variant:r,gradient:o,color:i,autoContrast:s})=>{const l=e.variantColorResolver({color:i||"gray",theme:e,gradient:o,variant:r||"light",autoContrast:s});return{root:{"--avatar-size":ke(t,"avatar-size"),"--avatar-radius":n===void 0?void 0:gt(n),"--avatar-bg":i||r?l.background:void 0,"--avatar-color":i||r?l.color:void 0,"--avatar-bd":i||r?l.border:void 0}}},is=yn((e,t)=>{const n=U("Avatar",I3,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,autoContrast:S,mod:v,...x}=n,w=T3(),[b,j]=p.useState(!u),E=ce({name:"Avatar",props:n,classes:kf,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:D3});return p.useEffect(()=>j(!u),[u]),C.createElement(H,{...E("root"),mod:[{"within-group":w.withinGroup},v],ref:t,...x},b?C.createElement("span",{...E("placeholder"),title:d},y||C.createElement(_3,null)):C.createElement("img",{...g,...E("image"),src:u,alt:d,onError:P=>{var T;j(!0),(T=g==null?void 0:g.onError)==null||T.call(g,P)}}))});is.classes=kf;is.displayName="@mantine/core/Avatar";is.Group=Wy;var bj={root:"m_347db0ec","root--dot":"m_fbd81e3d",label:"m_5add502a",section:"m_91fdda9b"};const A3={},N3=(e,{radius:t,color:n,gradient:r,variant:o,size:i,autoContrast:s})=>{const l=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:s});return{root:{"--badge-height":ke(i,"badge-height"),"--badge-padding-x":ke(i,"badge-padding-x"),"--badge-fz":ke(i,"badge-fz"),"--badge-radius":t===void 0?void 0:gt(t),"--badge-bg":n||o?l.background:void 0,"--badge-color":n||o?l.color:void 0,"--badge-bd":n||o?l.border:void 0,"--badge-dot-color":o==="dot"?mt(n,e):void 0}}},Ic=yn((e,t)=>{const n=U("Badge",A3,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:S,autoContrast:v,circle:x,mod:w,...b}=n,j=ce({name:"Badge",props:n,classes:bj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:N3});return C.createElement(H,{variant:y,mod:[{block:S,circle:x},w],...j("root",{variant:y}),ref:t,...b},h&&C.createElement("span",{...j("section"),"data-position":"left"},h),C.createElement("span",{...j("label")},g),m&&C.createElement("span",{...j("section"),"data-position":"right"},m))});Ic.classes=bj;Ic.displayName="@mantine/core/Badge";var Cj={root:"m_ddec01c0",icon:"m_dde7bd57",cite:"m_dde51a35"};const O3={iconSize:48},M3=(e,{color:t,iconSize:n,radius:r})=>{const o=io({color:t||e.primaryColor,theme:e,colorScheme:"dark"}),i=io({color:t||e.primaryColor,theme:e,colorScheme:"light"});return{root:{"--bq-bg-light":ar(i.value,.07),"--bq-bg-dark":ar(o.value,.06),"--bq-bd":mt(t,e),"--bq-icon-size":B(n),"--bq-radius":gt(r)}}},qy=Q((e,t)=>{const n=U("Blockquote",O3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,children:u,icon:d,iconSize:f,cite:h,...m}=n,g=ce({name:"Blockquote",classes:Cj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:M3});return C.createElement(H,{component:"blockquote",ref:t,...g("root"),...m},d&&C.createElement("span",{...g("icon")},d),u,h&&C.createElement("cite",{...g("cite")},h))});qy.classes=Cj;qy.displayName="@mantine/core/Blockquote";var Rf={root:"m_77c9d27d",inner:"m_80f1301b",label:"m_811560b9",section:"m_a74036a",loader:"m_a25b86ee",group:"m_80d6d844"};const j1={orientation:"horizontal"},$3=(e,{borderWidth:t})=>({group:{"--button-border-width":B(t)}}),Gy=Q((e,t)=>{const n=U("ButtonGroup",j1,e),{className:r,style:o,classNames:i,styles:s,unstyled:l,orientation:c,vars:u,borderWidth:d,variant:f,mod:h,...m}=U("ButtonGroup",j1,e),g=ce({name:"ButtonGroup",props:n,classes:Rf,className:r,style:o,classNames:i,styles:s,unstyled:l,vars:u,varsResolver:$3,rootSelector:"group"});return C.createElement(H,{...g("group"),ref:t,variant:f,mod:[{"data-orientation":c},h],role:"group",...m})});Gy.classes=Rf;Gy.displayName="@mantine/core/ButtonGroup";const L3={in:{opacity:1,transform:`translate(-50%, calc(-50% + ${B(1)}))`},out:{opacity:0,transform:"translate(-50%, -200%)"},common:{transformOrigin:"center"},transitionProperty:"transform, opacity"},F3={},z3=(e,{radius:t,color:n,gradient:r,variant:o,size:i,justify:s,autoContrast:l})=>{const c=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:l});return{root:{"--button-justify":s,"--button-height":ke(i,"button-height"),"--button-padding-x":ke(i,"button-padding-x"),"--button-fz":i!=null&&i.includes("compact")?Xt(i.replace("compact-","")):Xt(i),"--button-radius":t===void 0?void 0:gt(t),"--button-bg":n||o?c.background:void 0,"--button-hover":n||o?c.hover:void 0,"--button-color":c.color,"--button-bd":n||o?c.border:void 0,"--button-hover-color":n||o?c.hoverColor:void 0}}},Z=yn((e,t)=>{const n=U("Button",F3,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:S,classNames:v,styles:x,unstyled:w,"data-disabled":b,autoContrast:j,mod:E,...P}=n,T=ce({name:"Button",props:n,classes:Rf,className:i,style:r,classNames:v,styles:x,unstyled:w,vars:o,varsResolver:z3}),_=!!u,D=!!d;return C.createElement(Xn,{ref:t,...T("root",{active:!l&&!g&&!b}),unstyled:w,variant:h,disabled:l||g,mod:[{disabled:l||b,loading:g,block:f,"with-left-section":_,"with-right-section":D},E],...P},C.createElement($o,{mounted:!!g,transition:L3,duration:150},O=>C.createElement(H,{component:"span",...T("loader",{style:O}),"aria-hidden":!0},C.createElement(Un,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...y}))),C.createElement("span",{...T("inner")},u&&C.createElement(H,{component:"span",...T("section"),mod:{position:"left"}},u),C.createElement(H,{component:"span",mod:{loading:g},...T("label")},c),d&&C.createElement(H,{component:"span",...T("section"),mod:{position:"right"}},d)))});Z.classes=Rf;Z.displayName="@mantine/core/Button";Z.Group=Gy;var Ej={root:"m_4451eb3a"};const B3={},on=yn((e,t)=>{const n=U("Center",B3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,inline:u,mod:d,...f}=n,h=ce({name:"Center",props:n,classes:Ej,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c});return C.createElement(H,{ref:t,mod:[{inline:u},d],...h("root"),...f})});on.classes=Ej;on.displayName="@mantine/core/Center";const[U3,V3]=vc(),H3={};function jj(e){const{value:t,defaultValue:n,onChange:r,multiple:o,children:i}=U("ChipGroup",H3,e),[s,l]=mn({value:t,defaultValue:n,finalValue:o?[]:null,onChange:r}),c=d=>Array.isArray(s)?s.includes(d):d===s,u=d=>{const f=d.currentTarget.value;Array.isArray(s)?l(s.includes(f)?s.filter(h=>h!==f):[...s,f]):l(f)};return C.createElement(U3,{value:{isChipSelected:c,onChange:u,multiple:o}},i)}jj.displayName="@mantine/core/ChipGroup";var Pj={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 W3={type:"checkbox"},q3=(e,{size:t,radius:n,variant:r,color:o,autoContrast:i})=>{const s=e.variantColorResolver({color:o||e.primaryColor,theme:e,variant:r||"filled",autoContrast:i});return{root:{"--chip-fz":Xt(t),"--chip-size":ke(t,"chip-size"),"--chip-radius":n===void 0?void 0:gt(n),"--chip-checked-padding":ke(t,"chip-checked-padding"),"--chip-padding":ke(t,"chip-padding"),"--chip-icon-size":ke(t,"chip-icon-size"),"--chip-bg":o||r?s.background:void 0,"--chip-hover":o||r?s.hover:void 0,"--chip-color":o||r?s.color:void 0,"--chip-bd":o||r?s.border:void 0,"--chip-spacing":ke(t,"chip-spacing")}}},ic=Q((e,t)=>{const n=U("Chip",W3,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:S,children:v,size:x,variant:w,icon:b,rootRef:j,autoContrast:E,mod:P,...T}=n,_=ce({name:"Chip",classes:Pj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:q3}),D=V3(),O=Tn(u),{styleProps:I,rest:L}=No(T),[N,M]=mn({value:d,defaultValue:f,finalValue:!1,onChange:h}),$=D?{checked:D.isChipSelected(m),onChange:k=>{D.onChange(k),h==null||h(k.currentTarget.checked)},type:D.multiple?"checkbox":"radio"}:{},R=$.checked||N;return C.createElement(H,{size:x,variant:w,ref:j,mod:P,..._("root"),...I,...g},C.createElement("input",{type:y,..._("input"),checked:R,onChange:k=>M(k.currentTarget.checked),id:O,disabled:S,ref:t,value:m,...$,...L}),C.createElement("label",{htmlFor:O,"data-checked":R||void 0,"data-disabled":S||void 0,..._("label",{variant:w||"filled"})},R&&C.createElement("span",{..._("iconWrapper")},b||C.createElement(Tf,{..._("checkIcon")})),C.createElement("span",null,v)))});ic.classes=Pj;ic.displayName="@mantine/core/Chip";ic.Group=jj;var Tj={root:"m_b183c0a2"};const G3={},Q3=(e,{color:t})=>({root:{"--code-bg":t?mt(t,e):void 0}}),Qy=Q((e,t)=>{const n=U("Code",G3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,color:u,block:d,variant:f,mod:h,...m}=n,g=ce({name:"Code",props:n,classes:Tj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:Q3});return C.createElement(H,{component:d?"pre":"code",variant:f,ref:t,mod:[{block:d},h],...g("root"),...m,dir:"ltr"})});Qy.classes=Tj;Qy.displayName="@mantine/core/Code";var kj={root:"m_7485cace"};const K3={},Y3=(e,{size:t,fluid:n})=>({root:{"--container-size":n?void 0:ke(t,"container-size")}}),Ky=Q((e,t)=>{const n=U("Container",K3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,fluid:u,mod:d,...f}=n,h=ce({name:"Container",classes:kj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:Y3});return C.createElement(H,{ref:t,mod:[{fluid:u},d],...h("root"),...f})});Ky.classes=kj;Ky.displayName="@mantine/core/Container";const X3={timeout:1e3};function Rj(e){const{children:t,timeout:n,value:r,...o}=U("CopyButton",X3,e),i=$S({timeout:n}),s=()=>i.copy(r);return C.createElement(C.Fragment,null,t({copy:s,copied:i.copied,...o}))}Rj.displayName="@mantine/core/CopyButton";var _j={root:"m_3eebeb36",label:"m_9e365f20"};const J3={orientation:"horizontal"},Z3=(e,{color:t,variant:n,size:r})=>({root:{"--divider-color":t?mt(t,e):void 0,"--divider-border-style":n,"--divider-size":ke(r,"divider-size")}}),dn=Q((e,t)=>{const n=U("Divider",J3,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,color:u,orientation:d,label:f,labelPosition:h,mod:m,...g}=n,y=ce({name:"Divider",classes:_j,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:Z3});return C.createElement(H,{ref:t,mod:[{orientation:d,"with-label":!!f},m],...y("root"),...g,role:"separator"},f&&C.createElement(H,{component:"span",mod:{position:h},...y("label")},f))});dn.classes=_j;dn.displayName="@mantine/core/Divider";function e9({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[t9,Ij]=Pn("Grid component was not found in tree"),Sm=(e,t)=>e==="content"?"auto":e==="auto"?"0rem":e?`${100/(t/e)}%`:void 0,P1=(e,t,n)=>n||e==="auto"?"100%":e==="content"?"unset":Sm(e,t),T1=(e,t)=>{if(e)return e==="auto"||t?"1":"auto"},k1=(e,t)=>e===0?"0":e?`${100/(t/e)}%`:void 0;function n9({span:e,order:t,offset:n,selector:r}){var h;const o=Tt(),i=Ij(),l=ri(e)===void 0?12:ri(e),c=fs({"--col-order":(h=ri(t))==null?void 0:h.toString(),"--col-flex-grow":T1(l,i.grow),"--col-flex-basis":Sm(l,i.columns),"--col-width":l==="content"?"auto":void 0,"--col-max-width":P1(l,i.columns,i.grow),"--col-offset":k1(ri(n),i.columns)}),u=pt(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"]=T1(e[g],i.grow),m[g]["--col-flex-basis"]=Sm(e[g],i.columns),m[g]["--col-width"]=e[g]==="content"?"auto":void 0,m[g]["--col-max-width"]=P1(e[g],i.columns,i.grow)),typeof n=="object"&&n[g]!==void 0&&(m[g]["--col-offset"]=k1(n[g],i.columns)),m},{}),f=Ll(pt(u),o).filter(m=>pt(u[m.value]).length>0).map(m=>({query:`(min-width: ${o.breakpoints[m.value]})`,styles:u[m.value]}));return C.createElement($a,{styles:c,media:f,selector:r})}var Yy={root:"m_410352e9",inner:"m_dee7bd2f",col:"m_96bdd299"};const r9={span:12},Xy=Q((e,t)=>{const n=U("GridCol",r9,e),{classNames:r,className:o,style:i,styles:s,vars:l,span:c,order:u,offset:d,...f}=n,h=Ij(),m=wc();return C.createElement(C.Fragment,null,C.createElement(n9,{selector:`.${m}`,span:c,order:u,offset:d}),C.createElement(H,{ref:t,...h.getStyles("col",{className:et(o,m),style:i,classNames:r,styles:s}),...f}))});Xy.classes=Yy;Xy.displayName="@mantine/core/GridCol";function o9({gutter:e,selector:t}){const n=Tt(),r=fs({"--grid-gutter":rn(ri(e))}),o=pt(n.breakpoints).reduce((l,c)=>(l[c]||(l[c]={}),typeof e=="object"&&e[c]!==void 0&&(l[c]["--grid-gutter"]=rn(e[c])),l),{}),s=Ll(pt(o),n).filter(l=>pt(o[l.value]).length>0).map(l=>({query:`(min-width: ${n.breakpoints[l.value]})`,styles:o[l.value]}));return C.createElement($a,{styles:r,media:s,selector:t})}const i9={gutter:"md",grow:!1,columns:12},s9=(e,{justify:t,align:n,overflow:r})=>({root:{"--grid-justify":t,"--grid-align":n,"--grid-overflow":r}}),Qn=Q((e,t)=>{const n=U("Grid",i9,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,S=ce({name:"Grid",classes:Yy,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:s9}),v=wc();return C.createElement(t9,{value:{getStyles:S,grow:u,columns:f}},C.createElement(o9,{selector:`.${v}`,...n}),C.createElement(H,{ref:t,...S("root",{className:v}),...y},C.createElement("div",{...S("inner")},g)))});Qn.classes=Yy;Qn.displayName="@mantine/core/Grid";Qn.Col=Xy;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 Jy(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 a9=p.useLayoutEffect,l9=function(t){var n=p.useRef(t);return a9(function(){n.current=t}),n},R1=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},c9=function(t,n){var r=p.useRef();return p.useCallback(function(o){t.current=o,r.current&&R1(r.current,null),r.current=n,n&&R1(n,o)},[n])},_1={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0"},u9=function(t){Object.keys(_1).forEach(function(n){t.style.setProperty(n,_1[n],"important")})},I1=u9,vn=null,D1=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function d9(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),vn||(vn=document.createElement("textarea"),vn.setAttribute("tabindex","-1"),vn.setAttribute("aria-hidden","true"),I1(vn)),vn.parentNode===null&&document.body.appendChild(vn);var o=e.paddingSize,i=e.borderSize,s=e.sizingStyle,l=s.boxSizing;Object.keys(s).forEach(function(h){var m=h;vn.style[m]=s[m]}),I1(vn),vn.value=t;var c=D1(vn,e);vn.value=t,c=D1(vn,e),vn.value="x";var u=vn.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 A1=function(){},f9=function(t,n){return t.reduce(function(r,o){return r[o]=n[o],r},{})},h9=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak"],p9=!!document.documentElement.currentStyle,m9=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=f9(h9,n),o=r.boxSizing;if(o==="")return null;p9&&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}},g9=m9;function Dj(e,t,n){var r=l9(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 y9=function(t){Dj(window,"resize",t)},v9=function(t){Dj(document.fonts,"loadingdone",t)},x9=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],w9=function(t,n){var r=t.cacheMeasurements,o=t.maxRows,i=t.minRows,s=t.onChange,l=s===void 0?A1:s,c=t.onHeightChange,u=c===void 0?A1:c,d=Jy(t,x9),f=d.value!==void 0,h=p.useRef(null),m=c9(h,n),g=p.useRef(0),y=p.useRef(),S=function(){var w=h.current,b=r&&y.current?y.current:g9(w);if(b){y.current=b;var j=d9(b,w.value||w.placeholder||"x",i,o),E=j[0],P=j[1];g.current!==E&&(g.current=E,w.style.setProperty("height",E+"px","important"),u(E,{rowHeight:P}))}},v=function(w){f||S(),l(w)};return p.useLayoutEffect(S),y9(S),v9(S),p.createElement("textarea",Ad({},d,{onChange:v,ref:m}))},S9=p.forwardRef(w9);const b9={},ws=Q((e,t)=>{const{autosize:n,maxRows:r,minRows:o,__staticSelector:i,resize:s,...l}=U("Textarea",b9,e),c=n&&HS()!=="test",u=c?{maxRows:r,minRows:o}:{};return C.createElement(wr,{component:c?S9:"textarea",ref:t,...l,__staticSelector:i||"Textarea",multiline:!0,"data-no-overflow":n&&r===void 0||void 0,__vars:{"--input-resize":s},...u})});ws.classes=wr.classes;ws.displayName="@mantine/core/Textarea";function N1(e,t){if(typeof e=="string"&&e.trim().length===0)return!0;try{return t(e),!0}catch{return!1}}const C9={serialize:JSON.stringify,deserialize:JSON.parse},Ha=Q((e,t)=>{const{value:n,defaultValue:r,onChange:o,formatOnBlur:i,validationError:s,serialize:l,deserialize:c,onFocus:u,onBlur:d,readOnly:f,error:h,...m}=U("JsonInput",C9,e),[g,y]=mn({value:n,defaultValue:r,finalValue:"",onChange:o}),[S,v]=p.useState(N1(g,c)),x=b=>{u==null||u(b),v(!0)},w=b=>{typeof d=="function"&&d(b);const j=N1(b.currentTarget.value,c);i&&!f&&j&&b.currentTarget.value.trim()!==""&&y(l(c(b.currentTarget.value),null,2)),v(j)};return C.createElement(ws,{value:g,onChange:b=>y(b.currentTarget.value),onFocus:x,onBlur:w,ref:t,readOnly:f,...m,autoComplete:"off",__staticSelector:"JsonInput",error:S?h:s||!0,"data-monospace":!0})});Ha.classes=wr.classes;Ha.displayName="@mantine/core/JsonInput";const[E9,j9]=Pn("List component was not found in tree");var Zy={root:"m_abbac491",item:"m_abb6bec2",itemWrapper:"m_75cd9f71",itemIcon:"m_60f83e5b"};const P9={},ev=Q((e,t)=>{const n=U("ListItem",P9,e),{classNames:r,className:o,style:i,styles:s,vars:l,icon:c,children:u,mod:d,...f}=n,h=j9(),m=c||h.icon,g={classNames:r,styles:s};return C.createElement(H,{...h.getStyles("item",{...g,className:o,style:i}),component:"li",mod:[{"with-icon":!!m,centered:h.center},d],ref:t,...f},C.createElement("div",{...h.getStyles("itemWrapper",g)},m&&C.createElement("span",{...h.getStyles("itemIcon",g)},m),C.createElement("span",{...h.getStyles("itemLabel",g)},u)))});ev.classes=Zy;ev.displayName="@mantine/core/ListItem";const T9={type:"unordered"},k9=(e,{size:t,spacing:n})=>({root:{"--list-fz":Xt(t),"--list-lh":MS(t),"--list-spacing":rn(n)}}),bn=Q((e,t)=>{const n=U("List",T9,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,mod:S,...v}=n,x=ce({name:"List",classes:Zy,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:k9});return C.createElement(E9,{value:{center:g,icon:h,getStyles:x}},C.createElement(H,{...x("root",{style:{listStyleType:y}}),component:d==="unordered"?"ul":"ol",mod:[{"with-padding":f},S],ref:t,...v},u))});bn.classes=Zy;bn.displayName="@mantine/core/List";bn.Item=ev;var Aj={root:"m_6e45937b",loader:"m_e8eb006c",overlay:"m_df587f17"};const O1={transitionProps:{transition:"fade",duration:0},overlayProps:{backgroundOpacity:.75},zIndex:zr("overlay")},R9=(e,{zIndex:t})=>({root:{"--lo-z-index":t==null?void 0:t.toString()}}),tv=Q((e,t)=>{const n=U("LoadingOverlay",O1,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=Tt(),S=ce({name:"LoadingOverlay",classes:Aj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:R9}),v={...O1.overlayProps,...f};return C.createElement($o,{transition:"fade",...u,mounted:!!h},x=>C.createElement(H,{...S("root",{style:x}),ref:t,...g},C.createElement(Un,{...S("loader"),unstyled:l,...d}),C.createElement(oc,{...v,...S("overlay"),darkHidden:!0,unstyled:l,color:(f==null?void 0:f.color)||y.white}),C.createElement(oc,{...v,...S("overlay"),lightHidden:!0,unstyled:l,color:(f==null?void 0:f.color)||y.colors.dark[5]})))});tv.classes=Aj;tv.displayName="@mantine/core/LoadingOverlay";const[_9,Dc]=Pn("Menu component was not found in the tree");var Wa={dropdown:"m_dc9b7c9f",label:"m_9bfac126",divider:"m_efdf90cb",item:"m_99ac2aa1",itemLabel:"m_5476e0d3",itemSection:"m_8b75e504"};const I9={},nv=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=U("MenuDivider",I9,e),c=Dc();return C.createElement(H,{ref:t,...c.getStyles("divider",{className:r,style:o,styles:i,classNames:n}),...l})});nv.classes=Wa;nv.displayName="@mantine/core/MenuDivider";const D9={},rv=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,onMouseEnter:l,onMouseLeave:c,children:u,...d}=U("MenuDropdown",D9,e),f=p.useRef(null),h=Dc(),m=S=>{var v,x;(S.key==="ArrowUp"||S.key==="ArrowDown")&&(S.preventDefault(),(x=(v=f.current)==null?void 0:v.querySelectorAll("[data-menu-item]:not(:disabled)")[0])==null||x.focus())},g=qn(l,()=>(h.trigger==="hover"||h.trigger==="click-hover")&&h.openDropdown()),y=qn(c,()=>(h.trigger==="hover"||h.trigger==="click-hover")&&h.closeDropdown());return C.createElement(Br.Dropdown,{...d,onMouseEnter:g,onMouseLeave:y,role:"menu","aria-orientation":"vertical",ref:Qt(t,f),...h.getStyles("dropdown",{className:r,style:o,styles:i,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:m},C.createElement("div",{tabIndex:-1,"data-autofocus":!0,"aria-hidden":!0,style:{outline:0}}),u)});rv.classes=Wa;rv.displayName="@mantine/core/MenuDropdown";const A9={},ov=yn((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,color:l,closeMenuOnClick:c,leftSection:u,rightSection:d,children:f,disabled:h,...m}=U("MenuItem",A9,e),g=Dc(),y=Tt(),{dir:S}=La(),v=p.useRef(),x=g.getItemIndex(v.current),w=m,b=qn(w.onMouseLeave,()=>g.setHovered(-1)),j=qn(w.onMouseEnter,()=>g.setHovered(g.getItemIndex(v.current))),E=qn(w.onClick,()=>{typeof c=="boolean"?c&&g.closeDropdownImmediately():g.closeOnItemClick&&g.closeDropdownImmediately()}),P=qn(w.onFocus,()=>g.setHovered(g.getItemIndex(v.current))),T=l?y.variantColorResolver({color:l,theme:y,variant:"light"}):void 0,_=l?io({color:l,theme:y}):null;return C.createElement(Xn,{...m,unstyled:g.unstyled,tabIndex:g.menuItemTabIndex,onFocus:P,...g.getStyles("item",{className:r,style:o,styles:i,classNames:n}),ref:Qt(v,t),role:"menuitem",disabled:h,"data-menu-item":!0,"data-disabled":h||void 0,"data-hovered":g.hovered===x?!0:void 0,onMouseEnter:j,onMouseLeave:b,onClick:E,onKeyDown:OS({siblingSelector:"[data-menu-item]",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:g.loop,dir:S,orientation:"vertical",onKeyDown:w.onKeydown}),__vars:{"--menu-item-color":_!=null&&_.isThemeColor&&(_==null?void 0:_.shade)===void 0?`var(--mantine-color-${_.color}-6)`:T==null?void 0:T.color,"--menu-item-hover":T==null?void 0:T.hover}},u&&C.createElement("div",{...g.getStyles("itemSection",{styles:i,classNames:n}),"data-position":"left"},u),f&&C.createElement("div",{...g.getStyles("itemLabel",{styles:i,classNames:n})},f),d&&C.createElement("div",{...g.getStyles("itemSection",{styles:i,classNames:n}),"data-position":"right"},d))});ov.classes=Wa;ov.displayName="@mantine/core/MenuItem";const N9={},iv=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,...l}=U("MenuLabel",N9,e),c=Dc();return C.createElement(H,{ref:t,...c.getStyles("label",{className:r,style:o,styles:i,classNames:n}),...l})});iv.classes=Wa;iv.displayName="@mantine/core/MenuLabel";const O9={refProp:"ref"},Nj=p.forwardRef((e,t)=>{const{children:n,refProp:r,...o}=U("MenuTarget",O9,e);if(!Ao(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=Dc(),s=qn(n.props.onClick,()=>{i.trigger==="click"?i.toggleDropdown():i.trigger==="click-hover"&&(i.setOpenedViaClick(!0),i.opened||i.openDropdown())}),l=qn(n.props.onMouseEnter,()=>(i.trigger==="hover"||i.trigger==="click-hover")&&i.openDropdown()),c=qn(n.props.onMouseLeave,()=>{(i.trigger==="hover"||i.trigger==="click-hover"&&!i.openedViaClick)&&i.closeDropdown()});return C.createElement(Br.Target,{refProp:r,popupType:"menu",ref:t,...o},p.cloneElement(n,{onClick:s,onMouseEnter:l,onMouseLeave:c,"data-expanded":i.opened?!0:void 0}))});Nj.displayName="@mantine/core/MenuTarget";const M9={trapFocus:!0,closeOnItemClick:!0,clickOutsideEvents:["mousedown","touchstart","keydown"],loop:!0,trigger:"click",openDelay:0,closeDelay:100,menuItemTabIndex:-1};function J(e){const t=U("Menu",M9,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:S,unstyled:v,variant:x,vars:w,menuItemTabIndex:b,keepMounted:j,...E}=t,P=ce({name:"Menu",classes:Wa,props:t,classNames:y,styles:S,unstyled:v}),[T,{setHovered:_,resetHovered:D}]=y2(),[O,I]=mn({value:i,defaultValue:s,finalValue:!1,onChange:c}),[L,N]=p.useState(!1),M=()=>{I(!1),N(!1),O&&(o==null||o())},$=()=>{I(!0),!O&&(r==null||r())},R=()=>{O?M():$()},{openDropdown:k,closeDropdown:F}=e9({open:$,close:M,closeDelay:g,openDelay:m}),q=xe=>g2("[data-menu-item]","[data-menu-dropdown]",xe),{resolvedClassNames:G,resolvedStyles:ne}=tf({classNames:y,styles:S,props:t});return Co(()=>{D()},[O]),C.createElement(_9,{value:{getStyles:P,opened:O,toggleDropdown:R,getItemIndex:q,hovered:T,setHovered:_,openedViaClick:L,setOpenedViaClick:N,closeOnItemClick:u,closeDropdown:h==="click"?M:F,openDropdown:h==="click"?$:k,closeDropdownImmediately:M,loop:d,trigger:h,unstyled:v,menuItemTabIndex:b}},C.createElement(Br,{...E,opened:O,onChange:R,defaultOpened:s,trapFocus:j?!1:l,closeOnEscape:f,__staticSelector:"Menu",classNames:G,styles:ne,unstyled:v,variant:x,keepMounted:j},n))}J.extend=e=>e;J.classes=Wa;J.displayName="@mantine/core/Menu";J.Item=ov;J.Label=iv;J.Dropdown=rv;J.Target=Nj;J.Divider=nv;const[$9,qa]=Pn("Modal component was not found in tree");var Fo={root:"m_9df02822",content:"m_54c44539",inner:"m_1f958f16",header:"m_d0e2b9cd"};const L9={},_f=Q((e,t)=>{const n=U("ModalBody",L9,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=qa();return C.createElement(YE,{ref:t,...u.getStyles("body",{classNames:r,style:i,styles:s,className:o}),...c})});_f.classes=Fo;_f.displayName="@mantine/core/ModalBody";const F9={},If=Q((e,t)=>{const n=U("ModalCloseButton",F9,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=qa();return C.createElement(XE,{ref:t,...u.getStyles("close",{classNames:r,style:i,styles:s,className:o}),...c})});If.classes=Fo;If.displayName="@mantine/core/ModalCloseButton";const z9={},Df=Q((e,t)=>{const n=U("ModalContent",z9,e),{classNames:r,className:o,style:i,styles:s,vars:l,children:c,...u}=n,d=qa(),f=d.scrollAreaComponent||cN;return C.createElement(iN,{...d.getStyles("content",{className:o,style:i,styles:s,classNames:r}),innerProps:d.getStyles("inner",{className:o,style:i,styles:s,classNames:r}),"data-full-screen":d.fullScreen||void 0,"data-modal-content":!0,ref:t,...u},C.createElement(f,{style:{maxHeight:d.fullScreen?"100dvh":`calc(100dvh - (${B(d.yOffset)} * 2))`}},c))});Df.classes=Fo;Df.displayName="@mantine/core/ModalContent";const B9={},Af=Q((e,t)=>{const n=U("ModalHeader",B9,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=qa();return C.createElement(JE,{ref:t,...u.getStyles("header",{classNames:r,style:i,styles:s,className:o}),...c})});Af.classes=Fo;Af.displayName="@mantine/core/ModalHeader";const U9={},Nf=Q((e,t)=>{const n=U("ModalOverlay",U9,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=qa();return C.createElement(ZE,{ref:t,...u.getStyles("overlay",{classNames:r,style:i,styles:s,className:o}),...c})});Nf.classes=Fo;Nf.displayName="@mantine/core/ModalOverlay";const V9={__staticSelector:"Modal",closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:zr("modal"),transitionProps:{duration:200,transition:"pop"},yOffset:"5dvh"},H9=(e,{radius:t,size:n,yOffset:r,xOffset:o})=>({root:{"--modal-radius":t===void 0?void 0:gt(t),"--modal-size":ke(n,"modal-size"),"--modal-y-offset":B(r),"--modal-x-offset":B(o)}}),Of=Q((e,t)=>{const n=U("ModalRoot",V9,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,...S}=n,v=ce({name:y,classes:Fo,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:H9});return C.createElement($9,{value:{yOffset:u,scrollAreaComponent:d,getStyles:v,fullScreen:h}},C.createElement(rN,{ref:t,...v("root"),"data-full-screen":h||void 0,"data-centered":m||void 0,unstyled:l,...S}))});Of.classes=Fo;Of.displayName="@mantine/core/ModalRoot";const W9={},Mf=Q((e,t)=>{const n=U("ModalTitle",W9,e),{classNames:r,className:o,style:i,styles:s,vars:l,...c}=n,u=qa();return C.createElement(ej,{ref:t,...u.getStyles("title",{classNames:r,style:i,styles:s,className:o}),...c})});Mf.classes=Fo;Mf.displayName="@mantine/core/ModalTitle";const q9={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:zr("modal"),transitionProps:{duration:200,transition:"fade-down"},withOverlay:!0,withCloseButton:!0},Rn=Q((e,t)=>{const{title:n,withOverlay:r,overlayProps:o,withCloseButton:i,closeButtonProps:s,children:l,radius:c,...u}=U("Modal",q9,e),d=!!n||i;return C.createElement(Of,{ref:t,radius:c,...u},r&&C.createElement(Nf,{...o}),C.createElement(Df,{radius:c},d&&C.createElement(Af,null,n&&C.createElement(Mf,null,n),i&&C.createElement(If,{...s})),C.createElement(_f,null,l)))});Rn.classes=Fo;Rn.displayName="@mantine/core/Modal";Rn.Root=Of;Rn.Overlay=Nf;Rn.Content=Df;Rn.Body=_f;Rn.Header=Af;Rn.Title=Mf;Rn.CloseButton=If;const[G9,sv]=vc(),[Q9,K9]=vc();var $f={root:"m_7cda1cd6","root--default":"m_44da308b","root--contrast":"m_e3a01f8",label:"m_1e0e6180",remove:"m_ae386778",group:"m_1dcfd90b"};const Y9={},X9=(e,{gap:t},{size:n})=>({group:{"--pg-gap":t!==void 0?ke(t):ke(n,"pg-gap")}}),av=Q((e,t)=>{const n=U("PillGroup",Y9,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,size:u,disabled:d,...f}=n,h=sv(),m=(h==null?void 0:h.size)||u||void 0,g=ce({name:"PillGroup",classes:$f,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:X9,stylesCtx:{size:m},rootSelector:"group"});return C.createElement(Q9,{value:{size:m,disabled:d}},C.createElement(H,{ref:t,size:m,...g("group"),...f}))});av.classes=$f;av.displayName="@mantine/core/PillGroup";const J9={variant:"default"},Z9=(e,{radius:t},{size:n})=>({root:{"--pill-fz":ke(n,"pill-fz"),"--pill-height":ke(n,"pill-height"),"--pill-radius":t===void 0?void 0:gt(t)}}),ss=Q((e,t)=>{const n=U("Pill",J9,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:S,mod:v,...x}=n,w=K9(),b=sv(),j=y||(w==null?void 0:w.size)||void 0,E=(b==null?void 0:b.variant)==="filled"?"contrast":u||"default",P=ce({name:"Pill",classes:$f,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:Z9,stylesCtx:{size:j}});return C.createElement(H,{component:"span",ref:t,variant:E,size:j,...P("root",{variant:E}),mod:[{"with-remove":f&&!S,disabled:S||(w==null?void 0:w.disabled)},v],...x},C.createElement("span",{...P("label")},d),f&&C.createElement(vs,{variant:"transparent",radius:g,tabIndex:-1,"aria-hidden":!0,unstyled:l,...m,...P("remove",{className:m==null?void 0:m.className,style:m==null?void 0:m.style}),onMouseDown:T=>{var _;T.preventDefault(),T.stopPropagation(),(_=m==null?void 0:m.onMouseDown)==null||_.call(m,T)},onClick:T=>{var _;T.stopPropagation(),h==null||h(),(_=m==null?void 0:m.onClick)==null||_.call(m,T)}}))});ss.classes=$f;ss.displayName="@mantine/core/Pill";ss.Group=av;var Oj={field:"m_45c4369d"};const e5={type:"visible"},lv=Q((e,t)=>{const n=U("PillsInputField",e5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,type:u,disabled:d,id:f,pointer:h,mod:m,...g}=n,y=sv(),S=Ua(),v=ce({name:"PillsInputField",classes:Oj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"field"}),x=d||(y==null?void 0:y.disabled);return C.createElement(H,{component:"input",ref:Qt(t,y==null?void 0:y.fieldRef),"data-type":u,disabled:x,mod:[{disabled:x,pointer:h},m],...v("field"),...g,id:(S==null?void 0:S.inputId)||f,"aria-invalid":y==null?void 0:y.hasError,"aria-describedby":S==null?void 0:S.describedBy,type:"text",onMouseDown:w=>!h&&w.stopPropagation()})});lv.classes=Oj;lv.displayName="@mantine/core/PillsInputField";const t5={},ka=Q((e,t)=>{const n=U("PillsInput",t5,e),{children:r,onMouseDown:o,onClick:i,size:s,disabled:l,__staticSelector:c,error:u,variant:d,...f}=n,h=p.useRef();return C.createElement(G9,{value:{fieldRef:h,size:s,disabled:l,hasError:!!u,variant:d}},C.createElement(wr,{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))});ka.displayName="@mantine/core/PillsInput";ka.Field=lv;function n5({data:e,value:t}){const n=t.map(o=>o.trim().toLowerCase());return e.reduce((o,i)=>(Ta(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 r5={maxValues:1/0,withCheckIcon:!0,checkIconPosition:"left",hiddenInputValuesDivider:","},Lf=Q((e,t)=>{const n=U("MultiSelect",r5,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:S,defaultDropdownOpened:v,onDropdownOpen:x,onDropdownClose:w,selectFirstOptionOnChange:b,onOptionSubmit:j,comboboxProps:E,filter:P,limit:T,withScrollArea:_,maxDropdownHeight:D,searchValue:O,defaultSearchValue:I,onSearchChange:L,readOnly:N,disabled:M,onFocus:$,onBlur:R,onPaste:k,radius:F,rightSection:q,rightSectionWidth:G,rightSectionPointerEvents:ne,rightSectionProps:xe,leftSection:ge,leftSectionWidth:Pe,leftSectionPointerEvents:Te,leftSectionProps:Le,inputContainer:pe,inputWrapperOrder:Ge,withAsterisk:Ot,labelProps:me,descriptionProps:Fe,errorProps:ct,wrapperProps:Oe,description:Qe,label:Bt,error:_n,maxValues:lo,searchable:en,nothingFoundMessage:co,withCheckIcon:te,checkIconPosition:_e,hidePickedOptions:He,withErrorStyles:tt,name:Mt,form:Wr,id:rr,clearable:Ii,clearButtonProps:In,hiddenInputProps:qr,placeholder:br,hiddenInputValuesDivider:Wo,required:Za,mod:ru,renderOption:ks,onRemove:or,onClear:Di,scrollAreaProps:ph,...ou}=n,el=Tn(rr),Rs=aj(y),qo=lj(Rs),A=_c({opened:S,defaultOpened:v,onDropdownOpen:x,onDropdownClose:()=>{w==null||w(),A.resetSelectedOption()}}),{styleProps:z,rest:{type:W,autoComplete:X,...de}}=No(ou),[ve,be]=mn({value:d,defaultValue:f,finalValue:[],onChange:h}),[we,ye]=mn({value:O,defaultValue:I,finalValue:"",onChange:L}),Ae=ce({name:"MultiSelect",classes:{},props:n,classNames:r,styles:s,unstyled:l}),{resolvedClassNames:$t,resolvedStyles:Ie}=tf({props:n,styles:s,classNames:r}),nt=Ye=>{m==null||m(Ye),Ye.key===" "&&!en&&(Ye.preventDefault(),A.toggleDropdown()),Ye.key==="Backspace"&&we.length===0&&ve.length>0&&(or==null||or(ve[ve.length-1]),be(ve.slice(0,ve.length-1)))},Ht=ve.map((Ye,Ai)=>{var uo,Cr;return C.createElement(ss,{key:`${Ye}-${Ai}`,withRemoveButton:!N&&!((uo=qo[Ye])!=null&&uo.disabled),onRemove:()=>{be(ve.filter(fo=>Ye!==fo)),or==null||or(Ye)},unstyled:l,disabled:M,...Ae("pill")},((Cr=qo[Ye])==null?void 0:Cr.label)||Ye)});p.useEffect(()=>{b&&A.selectFirstOption()},[b,ve]);const tn=Ii&&ve.length>0&&!M&&!N&&C.createElement(Ee.ClearButton,{size:u,...In,onClear:()=>{Di==null||Di(),be([]),ye("")}}),Lt=n5({data:Rs,value:ve});return C.createElement(C.Fragment,null,C.createElement(Ee,{store:A,classNames:$t,styles:Ie,unstyled:l,size:u,readOnly:N,__staticSelector:"MultiSelect",onOptionSubmit:Ye=>{j==null||j(Ye),ye(""),A.updateSelectedOptionIndex("selected"),ve.includes(qo[Ye].value)?(be(ve.filter(Ai=>Ai!==qo[Ye].value)),or==null||or(qo[Ye].value)):ve.length<lo&&be([...ve,qo[Ye].value])},...E},C.createElement(Ee.DropdownTarget,null,C.createElement(ka,{...z,__staticSelector:"MultiSelect",classNames:$t,styles:Ie,unstyled:l,size:u,className:o,style:i,variant:g,disabled:M,radius:F,rightSection:q||tn||C.createElement(Ee.Chevron,{size:u,error:_n,unstyled:l}),rightSectionPointerEvents:ne||(tn?"all":"none"),rightSectionWidth:G,rightSectionProps:xe,leftSection:ge,leftSectionWidth:Pe,leftSectionPointerEvents:Te,leftSectionProps:Le,inputContainer:pe,inputWrapperOrder:Ge,withAsterisk:Ot,labelProps:me,descriptionProps:Fe,errorProps:ct,wrapperProps:Oe,description:Qe,label:Bt,error:_n,multiline:!0,withErrorStyles:tt,__stylesApiProps:{...n,rightSectionPointerEvents:ne||(tn?"all":"none"),multiline:!0},pointer:!en,onClick:()=>en?A.openDropdown():A.toggleDropdown(),"data-expanded":A.dropdownOpened||void 0,id:el,required:Za,mod:ru},C.createElement(ss.Group,{disabled:M,unstyled:l,...Ae("pillsList")},Ht,C.createElement(Ee.EventsTarget,{autoComplete:X},C.createElement(ka.Field,{...de,ref:t,id:el,placeholder:br,type:!en&&!br?"hidden":"visible",...Ae("inputField"),unstyled:l,onFocus:Ye=>{$==null||$(Ye),en&&A.openDropdown()},onBlur:Ye=>{R==null||R(Ye),A.closeDropdown(),ye("")},onKeyDown:nt,value:we,onChange:Ye=>{ye(Ye.currentTarget.value),en&&A.openDropdown(),b&&A.selectFirstOption()},disabled:M,readOnly:N||!en,pointer:!en}))))),C.createElement(j3,{data:He?Lt:Rs,hidden:N||M,filter:P,search:we,limit:T,hiddenWhenEmpty:!en||!co||He&&Lt.length===0&&we.trim().length===0,withScrollArea:_,maxDropdownHeight:D,filterOptions:en,value:ve,checkIconPosition:_e,withCheckIcon:te,nothingFoundMessage:co,unstyled:l,labelId:`${el}-label`,renderOption:ks,scrollAreaProps:ph})),C.createElement(Ee.HiddenInput,{name:Mt,valuesDivider:Wo,value:ve,form:Wr,disabled:M,...qr}))});Lf.classes={...wr.classes,...Ee.classes};Lf.displayName="@mantine/core/MultiSelect";function o5(e){return"group"in e}function cv({data:e}){if(o5(e)){const o=e.items.map(i=>C.createElement(cv,{key:i.value,data:i}));return C.createElement("optgroup",{label:e.group},o)}const{value:t,label:n,...r}=e;return C.createElement("option",{key:e.value,value:e.value,...r},e.label)}cv.displayName="@mantine/core/NativeSelectOption";const i5={rightSectionPointerEvents:"none"},wt=Q((e,t)=>{const{data:n,children:r,size:o,error:i,rightSection:s,unstyled:l,...c}=U("NativeSelect",i5,e),u=aj(n).map((d,f)=>C.createElement(cv,{key:f,data:d}));return C.createElement(wr,{component:"select",ref:t,...c,__staticSelector:"NativeSelect",size:o,pointer:!0,error:i,unstyled:l,rightSection:s||C.createElement(jf,{size:o,error:i,unstyled:l})},r||u)});wt.classes=wr.classes;wt.displayName="@mantine/core/NativeSelect";var Mj={root:"m_a513464",icon:"m_a4ceffb",loader:"m_b0920b15",body:"m_a49ed24",title:"m_3feedf16",description:"m_3d733a3a",closeButton:"m_919a4d88"};const s5={withCloseButton:!0},a5=(e,{radius:t,color:n})=>({root:{"--notification-radius":t===void 0?void 0:gt(t),"--notification-color":n?mt(n,e):void 0}}),uv=Q((e,t)=>{const n=U("Notification",s5,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:S,unstyled:v,variant:x,vars:w,mod:b,...j}=n,E=ce({name:"Notification",classes:Mj,props:n,className:r,style:y,classNames:g,styles:S,unstyled:v,vars:w,varsResolver:a5});return C.createElement(H,{...E("root"),mod:[{"data-with-icon":!!d||s,"data-with-border":c},b],ref:t,variant:x,...j,role:"alert"},d&&!s&&C.createElement("div",{...E("icon")},d),s&&C.createElement(Un,{size:28,color:o,...E("loader")}),C.createElement("div",{...E("body")},u&&C.createElement("div",{...E("title")},u),C.createElement(H,{...E("description"),mod:{"data-with-title":!!u}},f)),l&&C.createElement(vs,{iconSize:16,color:"gray",...m,unstyled:v,onClick:h,...E("closeButton")}))});uv.classes=Mj;uv.displayName="@mantine/core/Notification";const[l5,Ff]=Pn("Pagination.Root component was not found in tree");var Ac={root:"m_4addd315",control:"m_326d024a",dots:"m_4ad7767d"};const c5={withPadding:!0},Nc=Q((e,t)=>{const n=U("PaginationControl",c5,e),{classNames:r,className:o,style:i,styles:s,vars:l,active:c,disabled:u,withPadding:d,mod:f,...h}=n,m=Ff(),g=u||m.disabled;return C.createElement(Xn,{ref:t,disabled:g,mod:[{active:c,disabled:g,"with-padding":d},f],...m.getStyles("control",{className:o,style:i,classNames:r,styles:s,active:!g}),...h})});Nc.classes=Ac;Nc.displayName="@mantine/core/PaginationControl";function Oc({style:e,children:t,path:n,...r}){return C.createElement("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)",...e},...r},C.createElement("path",{d:n,fill:"currentColor"}))}const u5=e=>C.createElement(Oc,{...e,path:"M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z"}),d5=e=>C.createElement(Oc,{...e,path:"M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z"}),f5=e=>C.createElement(Oc,{...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"}),h5=e=>C.createElement(Oc,{...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"}),p5=e=>C.createElement(Oc,{...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"}),m5={icon:p5},zf=Q((e,t)=>{const n=U("PaginationDots",m5,e),{classNames:r,className:o,style:i,styles:s,vars:l,icon:c,...u}=n,d=Ff(),f=c;return C.createElement(H,{ref:t,...d.getStyles("dots",{className:o,style:i,styles:s,classNames:r}),...u},C.createElement(f,{style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}}))});zf.classes=Ac;zf.displayName="@mantine/core/PaginationDots";function Bf({icon:e,name:t,action:n,type:r}){const o={icon:e},i=p.forwardRef((s,l)=>{const{icon:c,...u}=U(t,o,s),d=c,f=Ff(),h=r==="next"?f.active===f.total:f.active===1;return C.createElement(Nc,{disabled:f.disabled||h,ref:l,onClick:f[n],withPadding:!1,...u},C.createElement(d,{className:"mantine-rotate-rtl",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 $j=Bf({icon:u5,name:"PaginationNext",action:"onNext",type:"next"}),Lj=Bf({icon:d5,name:"PaginationPrevious",action:"onPrevious",type:"previous"}),Fj=Bf({icon:f5,name:"PaginationFirst",action:"onFirst",type:"previous"}),zj=Bf({icon:h5,name:"PaginationLast",action:"onLast",type:"next"});function dv({dotsIcon:e}){const t=Ff(),n=t.range.map((r,o)=>{var i;return r==="dots"?C.createElement(zf,{icon:e,key:o}):C.createElement(Nc,{key:o,active:r===t.active,"aria-current":r===t.active?"page":void 0,onClick:()=>t.onChange(r),disabled:t.disabled,...(i=t.getItemProps)==null?void 0:i.call(t,r)},r)});return C.createElement(C.Fragment,null,n)}dv.displayName="@mantine/core/PaginationItems";const g5={siblings:1,boundaries:1},y5=(e,{size:t,radius:n,color:r,autoContrast:o})=>({root:{"--pagination-control-radius":n===void 0?void 0:gt(n),"--pagination-control-size":ke(t,"pagination-control-size"),"--pagination-control-fz":Xt(t),"--pagination-active-bg":r?mt(r,e):void 0,"--pagination-active-color":xc(o,e)?hs({color:r,theme:e}):void 0}}),Uf=Q((e,t)=>{const n=U("PaginationRoot",g5,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:S,radius:v,onNextPage:x,onPreviousPage:w,onFirstPage:b,onLastPage:j,getItemProps:E,autoContrast:P,...T}=n,_=ce({name:"Pagination",classes:Ac,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:y5}),{range:D,setPage:O,next:I,previous:L,active:N,first:M,last:$}=N2({page:d,initialPage:f,onChange:h,total:u,siblings:g,boundaries:y}),R=qn(x,I),k=qn(w,L),F=qn(b,M),q=qn(j,$);return C.createElement(l5,{value:{total:u,range:D,active:N,disabled:m,getItemProps:E,onChange:O,onNext:R,onPrevious:k,onFirst:F,onLast:q,getStyles:_}},C.createElement(H,{ref:t,..._("root"),...T}))});Uf.classes=Ac;Uf.displayName="@mantine/core/PaginationRoot";const v5={withControls:!0,siblings:1,boundaries:1,gap:8},Ur=Q((e,t)=>{const n=U("Pagination",v5,e),{withEdges:r,withControls:o,getControlProps:i,nextIcon:s,previousIcon:l,lastIcon:c,firstIcon:u,dotsIcon:d,total:f,gap:h,...m}=n;return f<=0?null:C.createElement(Uf,{ref:t,total:f,...m},C.createElement(Y,{gap:h},r&&C.createElement(Fj,{icon:u,...i==null?void 0:i("first")}),o&&C.createElement(Lj,{icon:l,...i==null?void 0:i("previous")}),C.createElement(dv,{dotsIcon:d}),o&&C.createElement($j,{icon:s,...i==null?void 0:i("next")}),r&&C.createElement(zj,{icon:c,...i==null?void 0:i("last")})))});Ur.classes=Ac;Ur.displayName="@mantine/core/Pagination";Ur.Root=Uf;Ur.Control=Nc;Ur.Dots=zf;Ur.First=Fj;Ur.Last=zj;Ur.Next=$j;Ur.Previous=Lj;Ur.Items=dv;const x5=({reveal:e})=>C.createElement("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:"var(--psi-icon-size)",height:"var(--psi-icon-size)"}},C.createElement("path",{d:e?"M13.3536 2.35355C13.5488 2.15829 13.5488 1.84171 13.3536 1.64645C13.1583 1.45118 12.8417 1.45118 12.6464 1.64645L10.6828 3.61012C9.70652 3.21671 8.63759 3 7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C0.902945 9.08812 2.02314 10.1861 3.36061 10.9323L1.64645 12.6464C1.45118 12.8417 1.45118 13.1583 1.64645 13.3536C1.84171 13.5488 2.15829 13.5488 2.35355 13.3536L4.31723 11.3899C5.29348 11.7833 6.36241 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C14.0971 5.9119 12.9769 4.81391 11.6394 4.06771L13.3536 2.35355ZM9.90428 4.38861C9.15332 4.1361 8.34759 4 7.5 4C4.80285 4 2.52952 5.37816 1.09622 7.50001C1.87284 8.6497 2.89609 9.58106 4.09974 10.1931L9.90428 4.38861ZM5.09572 10.6114L10.9003 4.80685C12.1039 5.41894 13.1272 6.35031 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11C6.65241 11 5.84668 10.8639 5.09572 10.6114Z":"M7.5 11C4.80285 11 2.52952 9.62184 1.09622 7.50001C2.52952 5.37816 4.80285 4 7.5 4C10.1971 4 12.4705 5.37816 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11ZM7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C1.65639 10.2936 4.30786 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C13.3436 4.70638 10.6921 3 7.5 3ZM7.5 9.5C8.60457 9.5 9.5 8.60457 9.5 7.5C9.5 6.39543 8.60457 5.5 7.5 5.5C6.39543 5.5 5.5 6.39543 5.5 7.5C5.5 8.60457 6.39543 9.5 7.5 9.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}));var bm={root:"m_f61ca620",input:"m_ccf8da4c",innerInput:"m_f2d85dd2",visibilityToggle:"m_b1072d44"};const w5={visibilityToggleIcon:x5},S5=(e,{size:t})=>({root:{"--psi-icon-size":ke(t,"psi-icon-size"),"--psi-button-size":ke(t,"psi-button-size")}}),Nr=Q((e,t)=>{const n=U("PasswordInput",w5,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:S,label:v,size:x,errorProps:w,descriptionProps:b,labelProps:j,withAsterisk:E,inputWrapperOrder:P,wrapperProps:T,radius:_,rightSection:D,rightSectionWidth:O,rightSectionPointerEvents:I,leftSectionWidth:L,visible:N,defaultVisible:M,onVisibilityChange:$,visibilityToggleIcon:R,visibilityToggleButtonProps:k,rightSectionProps:F,leftSectionProps:q,leftSectionPointerEvents:G,mod:ne,...xe}=n,ge=Tn(m),[Pe,Te]=mn({value:N,defaultValue:M,finalValue:!1,onChange:$}),Le=()=>Te(!Pe),pe=ce({name:"PasswordInput",classes:bm,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:S5}),{resolvedClassNames:Ge,resolvedStyles:Ot}=tf({classNames:r,styles:s,props:n}),{styleProps:me,rest:Fe}=No(xe),ct=R,Oe=C.createElement(Gt,{...pe("visibilityToggle"),disabled:h,radius:_,"aria-hidden":!k,tabIndex:-1,...k,variant:"subtle",color:"gray",unstyled:l,onMouseDown:Qe=>{var Bt;Qe.preventDefault(),(Bt=k==null?void 0:k.onMouseDown)==null||Bt.call(k,Qe),Le()},onKeyDown:Qe=>{var Bt;(Bt=k==null?void 0:k.onKeyDown)==null||Bt.call(k,Qe),Qe.key===" "&&(Qe.preventDefault(),Le())}},C.createElement(ct,{reveal:Pe}));return C.createElement(bt.Wrapper,{required:u,id:ge,label:v,error:d,description:S,size:x,classNames:Ge,styles:Ot,__staticSelector:"PasswordInput",errorProps:w,descriptionProps:b,unstyled:l,withAsterisk:E,inputWrapperOrder:P,inputContainer:y,variant:g,labelProps:{...j,htmlFor:ge},mod:ne,...pe("root"),...me,...T},C.createElement(bt,{component:"div",error:d,leftSection:f,size:x,classNames:{...Ge,input:et(bm.input,Ge.input)},styles:Ot,radius:_,disabled:h,__staticSelector:"PasswordInput",rightSectionWidth:O,rightSection:D??Oe,variant:g,unstyled:l,leftSectionWidth:L,rightSectionPointerEvents:I||"all",rightSectionProps:F,leftSectionProps:q,leftSectionPointerEvents:G,withAria:!1},C.createElement("input",{required:u,"data-invalid":!!d||void 0,"data-with-left-section":!!f||void 0,...pe("innerInput"),disabled:h,id:ge,ref:t,...Fe,autoComplete:Fe.autoComplete||"off",type:Pe?"text":"password"})))});Nr.classes={...wr.classes,...bm};Nr.displayName="@mantine/core/PasswordInput";const[b5,C5]=vc(),E5={},fv=Q((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:l,name:c,readOnly:u,...d}=U("RadioGroup",E5,e),f=Tn(c),[h,m]=mn({value:n,defaultValue:r,finalValue:"",onChange:o}),g=y=>!u&&m(y.currentTarget.value);return C.createElement(b5,{value:{value:h,onChange:g,size:i,name:f}},C.createElement(bt.Wrapper,{size:i,ref:t,...s,...d,labelElement:"div",__staticSelector:"RadioGroup"},C.createElement(Vy,{role:"radiogroup"},l)))});fv.classes=bt.Wrapper.classes;fv.displayName="@mantine/core/RadioGroup";function j5({size:e,style:t,...n}){return C.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 5 5",style:{width:B(e),height:B(e),...t},"aria-hidden":!0,...n},C.createElement("circle",{cx:"2.5",cy:"2.5",r:"2.5",fill:"currentColor"}))}var Bj={root:"m_f3f1af94",inner:"m_89c4f5e4",icon:"m_f3ed6b2b",radio:"m_8a3dbb89","radio--outline":"m_1bfe9d39"};const P5={labelPosition:"right"},T5=(e,{size:t,radius:n,color:r,iconColor:o,variant:i,autoContrast:s})=>{const l=io({color:r||e.primaryColor,theme:e}),c=l.isThemeColor&&l.shade===void 0?`var(--mantine-color-${l.color}-outline)`:l.color;return{root:{"--radio-size":ke(t,"radio-size"),"--radio-radius":n===void 0?void 0:gt(n),"--radio-color":i==="outline"?c:mt(r,e),"--radio-icon-color":o?mt(o,e):xc(s,e)?hs({color:r,theme:e}):void 0,"--radio-icon-size":ke(t,"radio-icon-size")}}},sc=Q((e,t)=>{const n=U("Radio",P5,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:S,variant:v,disabled:x,wrapperProps:w,icon:b=j5,rootRef:j,iconColor:E,onChange:P,mod:T,..._}=n,D=ce({name:"Radio",classes:Bj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:T5}),O=C5(),I=(O==null?void 0:O.size)??d,L=n.size?d:I,{styleProps:N,rest:M}=No(_),$=Tn(u),R=O?{checked:O.value===M.value,name:M.name??O.name,onChange:k=>{O.onChange(k),P==null||P(k)}}:{};return C.createElement(Pf,{...D("root"),__staticSelector:"Radio",__stylesApiProps:n,id:$,size:L,labelPosition:h,label:f,description:m,error:g,disabled:x,classNames:r,styles:s,unstyled:l,"data-checked":R.checked||void 0,variant:v,ref:j,mod:T,...N,...w},C.createElement(H,{...D("inner"),mod:{"label-position":h}},C.createElement(H,{...D("radio",{focusable:!0,variant:v}),onChange:P,...M,...R,component:"input",mod:{error:!!g},ref:t,id:$,disabled:x,type:"radio"}),C.createElement(b,{...D("icon"),"aria-hidden":!0})))});sc.classes=Bj;sc.displayName="@mantine/core/Radio";sc.Group=fv;const k5={duration:100,transition:"fade"};function R5(e,t){return{...k5,...t,...e}}function _5({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}=Sy({placement:t,middleware:[yy({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=wo(c.floating.current);return y.forEach(S=>{S.addEventListener("scroll",u)}),()=>{g.removeEventListener("mousemove",m),y.forEach(S=>{S.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 Vf={tooltip:"m_1b3c8819",arrow:"m_f898399f"};const I5={refProp:"ref",withinPortal:!0,offset:10,position:"right",zIndex:zr("popover")},D5=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:gt(t),"--tooltip-bg":n?mt(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),hv=Q((e,t)=>{const n=U("TooltipFloating",I5,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:S,zIndex:v,disabled:x,variant:w,vars:b,portalProps:j,...E}=n,P=Tt(),T=ce({name:"TooltipFloating",props:n,classes:Vf,className:l,style:s,classNames:c,styles:u,unstyled:d,rootSelector:"tooltip",vars:b,varsResolver:D5}),{handleMouseMove:_,x:D,y:O,opened:I,boundaryRef:L,floating:N,setOpened:M}=_5({offset:g,position:y});if(!Ao(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 $=Qt(L,r.ref,t),R=F=>{var q,G;(G=(q=r.props).onMouseEnter)==null||G.call(q,F),_(F),M(!0)},k=F=>{var q,G;(G=(q=r.props).onMouseLeave)==null||G.call(q,F),M(!1)};return C.createElement(C.Fragment,null,C.createElement(ys,{...j,withinPortal:i},C.createElement(H,{...E,...T("tooltip",{style:{...JS(s,P),zIndex:v,display:!x&&I?"block":"none",top:(O&&Math.round(O))??"",left:(D&&Math.round(D))??""}}),variant:w,ref:N,mod:{multiline:S}},m)),p.cloneElement(r,{...r.props,[o]:$,onMouseEnter:R,onMouseLeave:k}))});hv.classes=Vf;hv.displayName="@mantine/core/TooltipFloating";const Uj=p.createContext(!1),A5=Uj.Provider,N5=()=>p.useContext(Uj),O5={openDelay:0,closeDelay:0};function Vj(e){const{openDelay:t,closeDelay:n,children:r}=U("TooltipGroup",O5,e);return C.createElement(A5,{value:!0},C.createElement(y4,{delay:{open:t,close:n}},r))}Vj.displayName="@mantine/core/TooltipGroup";function M5(e){var E,P,T;const[t,n]=p.useState(!1),o=typeof e.opened=="boolean"?e.opened:t,i=N5(),s=Tn(),{delay:l,currentId:c,setCurrentId:u}=$E(),d=p.useCallback(_=>{n(_),_&&u(s)},[u,s]),{x:f,y:h,context:m,refs:g,update:y,placement:S,middlewareData:{arrow:{x:v,y:x}={}}}=Sy({strategy:e.strategy,placement:e.position,open:o,onOpenChange:d,middleware:[EE(e.offset),yy({padding:8}),IE(),AE({element:e.arrowRef,padding:e.arrowOffset}),...e.inline?[DE()]:[]]}),{getReferenceProps:w,getFloatingProps:b}=C4([g4(m,{enabled:(E=e.events)==null?void 0:E.hover,delay:i?l:{open:e.openDelay,close:e.closeDelay},mouseOnly:!((P=e.events)!=null&&P.touch)}),b4(m,{enabled:(T=e.events)==null?void 0:T.focus,visibleOnly:!0}),j4(m,{role:"tooltip"}),S4(m,{enabled:typeof e.opened>"u"}),v4(m,{id:s})]);HE({opened:o,position:e.position,positionDependencies:e.positionDependencies,floating:{refs:g,update:y}}),Co(()=>{var _;(_=e.onPositionChange)==null||_.call(e,S)},[S]);const j=o&&c&&c!==s;return{x:f,y:h,arrowX:v,arrowY:x,reference:g.setReference,floating:g.setFloating,getFloatingProps:b,getReferenceProps:w,isGroupPhase:j,opened:o,placement:S}}const M1={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:zr("popover"),positionDependencies:[]},$5=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:gt(t),"--tooltip-bg":n?mt(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),Ga=Q((e,t)=>{const n=U("Tooltip",M1,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:S,style:v,className:x,withArrow:w,arrowSize:b,arrowOffset:j,arrowRadius:E,arrowPosition:P,offset:T,transitionProps:_,multiline:D,events:O,zIndex:I,disabled:L,positionDependencies:N,onClick:M,onMouseEnter:$,onMouseLeave:R,inline:k,variant:F,keepMounted:q,vars:G,portalProps:ne,mod:xe,floatingStrategy:ge,...Pe}=U("Tooltip",M1,n),{dir:Te}=La(),Le=p.useRef(null),pe=M5({position:LE(Te,o),closeDelay:c,openDelay:l,onPositionChange:u,opened:d,events:O,arrowRef:Le,arrowOffset:j,offset:typeof T=="number"?T+(w?b/2:0):T,positionDependencies:[...N,r],inline:k,strategy:ge}),Ge=ce({name:"Tooltip",props:n,classes:Vf,className:x,style:v,classNames:g,styles:y,unstyled:S,rootSelector:"tooltip",vars:G,varsResolver:$5});if(!Ao(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 Ot=Qt(pe.reference,r.ref,t),me=R5(_,{duration:100,transition:"fade"});return C.createElement(C.Fragment,null,C.createElement(ys,{...ne,withinPortal:f},C.createElement($o,{...me,keepMounted:q,mounted:!L&&!!pe.opened,duration:pe.isGroupPhase?10:me.duration},Fe=>C.createElement(H,{...Pe,variant:F,mod:[{multiline:D},xe],...pe.getFloatingProps({ref:pe.floating,className:Ge("tooltip").className,style:{...Ge("tooltip").style,...Fe,zIndex:I,top:pe.y??0,left:pe.x??0}})},s,C.createElement(by,{ref:Le,arrowX:pe.arrowX,arrowY:pe.arrowY,visible:w,position:pe.placement,arrowSize:b,arrowOffset:j,arrowRadius:E,arrowPosition:P,...Ge("arrow")})))),p.cloneElement(r,pe.getReferenceProps({onClick:M,onMouseEnter:$,onMouseLeave:R,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,[i]:Ot,className:et(x,r.props.className),...r.props})))});Ga.classes=Vf;Ga.displayName="@mantine/core/Tooltip";Ga.Floating=hv;Ga.Group=Vj;function L5({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 Hj({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=Tt();return C.createElement(Ga.Floating,{disabled:!c,label:c},C.createElement(H,{component:"circle",...f,...u("curve"),__vars:{"--curve-color":s?mt(s,h):void 0},fill:"none",strokeLinecap:l?"round":"butt",...L5({sum:r,size:e,thickness:o,value:t,offset:n,root:i})}))}Hj.displayName="@mantine/core/Curve";function F5({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 Wj={root:"m_b32e4812",svg:"m_d43b5134",curve:"m_b1ca1fbf",label:"m_b23f9dc4"};function z5(e,t){return Math.min(e||12,(t||120)/4)}const B5={size:120,thickness:12},U5=(e,{size:t,thickness:n})=>({root:{"--rp-size":B(t),"--rp-label-offset":B(n*2)}}),Hf=Q((e,t)=>{const n=U("RingProgress",B5,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,S=ce({name:"RingProgress",classes:Wj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:U5}),v=z5(h,f),x=F5({size:f,thickness:v,sections:d,renderRoundedLineCaps:m,rootColor:g}).map(({data:w,sum:b,root:j,lineRoundCaps:E,offset:P},T)=>C.createElement(Hj,{...w,key:T,size:f,thickness:v,sum:b,offset:P,color:w==null?void 0:w.color,root:j,lineRoundCaps:E,getStyles:S}));return C.createElement(H,{...S("root"),size:f,ref:t,...y},C.createElement("svg",{...S("svg")},x),u&&C.createElement("div",{...S("label")},u))});Hf.classes=Wj;Hf.displayName="@mantine/core/RingProgress";var qj={root:"m_cf365364",indicator:"m_9e182ccd",label:"m_1738fcb2",input:"m_1714d588",control:"m_69686b9b",innerLabel:"m_78882f40"};const V5={withItemsBorders:!0},H5=(e,{radius:t,color:n,transitionDuration:r,size:o,transitionTimingFunction:i})=>({root:{"--sc-radius":t===void 0?void 0:gt(t),"--sc-color":n?mt(n,e):void 0,"--sc-shadow":n?void 0:"var(--mantine-shadow-xs)","--sc-transition-duration":r===void 0?void 0:`${r}ms`,"--sc-transition-timing-function":i,"--sc-padding":ke(o,"sc-padding"),"--sc-font-size":Xt(o)}}),pv=Q((e,t)=>{var Te,Le;const n=U("SegmentedControl",V5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,data:u,value:d,defaultValue:f,onChange:h,size:m,name:g,disabled:y,readOnly:S,fullWidth:v,orientation:x,radius:w,color:b,transitionDuration:j,transitionTimingFunction:E,variant:P,autoContrast:T,withItemsBorders:_,mod:D,...O}=n,I=ce({name:"SegmentedControl",props:n,classes:qj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:H5}),L=Tt(),N=u.map(pe=>typeof pe=="string"?{label:pe,value:pe}:pe),M=L2(),[$,R]=p.useState(null),[k,F]=p.useState({}),q=(pe,Ge)=>{k[Ge]=pe,F(k)},[G,ne]=mn({value:d,defaultValue:f,finalValue:Array.isArray(u)?((Te=N.find(pe=>!pe.disabled))==null?void 0:Te.value)??((Le=u[0])==null?void 0:Le.value)??null:null,onChange:h}),xe=Tn(g),ge=N.map(pe=>C.createElement(H,{...I("control"),mod:{active:G===pe.value,orientation:x},key:pe.value},C.createElement("input",{...I("input"),disabled:y||pe.disabled,type:"radio",name:xe,value:pe.value,id:`${xe}-${pe.value}`,checked:G===pe.value,onChange:()=>!S&&ne(pe.value),"data-focus-ring":L.focusRing}),C.createElement(H,{component:"label",...I("label"),mod:{active:G===pe.value&&!(y||pe.disabled),disabled:y||pe.disabled,"read-only":S},htmlFor:`${xe}-${pe.value}`,ref:Ge=>q(Ge,pe.value),__vars:{"--sc-label-color":b!==void 0?hs({color:b,theme:L,autoContrast:T}):void 0}},C.createElement("span",{...I("innerLabel")},pe.label)))),Pe=Qt(t,pe=>R(pe));return u.length===0?null:C.createElement(H,{...I("root"),variant:P,size:m,ref:Pe,mod:[{"full-width":v,orientation:x,initialized:M,"with-items-borders":_},D],...O,role:"radiogroup"},typeof G=="string"&&C.createElement(Ty,{target:k[G],parent:$,component:"span",transitionDuration:"var(--sc-transition-duration)",...I("indicator")}),ge)});pv.classes=qj;pv.displayName="@mantine/core/SegmentedControl";function W5({spacing:e,verticalSpacing:t,cols:n,selector:r}){var d;const o=Tt(),i=t===void 0?e:t,s=fs({"--sg-spacing-x":rn(ri(e)),"--sg-spacing-y":rn(ri(i)),"--sg-cols":(d=ri(n))==null?void 0:d.toString()}),l=pt(o.breakpoints).reduce((f,h)=>(f[h]||(f[h]={}),typeof e=="object"&&e[h]!==void 0&&(f[h]["--sg-spacing-x"]=rn(e[h])),typeof i=="object"&&i[h]!==void 0&&(f[h]["--sg-spacing-y"]=rn(i[h])),typeof n=="object"&&n[h]!==void 0&&(f[h]["--sg-cols"]=n[h]),f),{}),u=Ll(pt(l),o).filter(f=>pt(l[f.value]).length>0).map(f=>({query:`(min-width: ${o.breakpoints[f.value]})`,styles:l[f.value]}));return C.createElement($a,{styles:s,media:u,selector:r})}var Gj={root:"m_2415a157"};const q5={cols:1,spacing:"md"},mv=Q((e,t)=>{const n=U("SimpleGrid",q5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,cols:u,verticalSpacing:d,spacing:f,...h}=n,m=ce({name:"SimpleGrid",classes:Gj,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c}),g=wc();return C.createElement(C.Fragment,null,C.createElement(W5,{...n,selector:`.${g}`}),C.createElement(H,{ref:t,...m("root",{className:g}),...h}))});mv.classes=Gj;mv.displayName="@mantine/core/SimpleGrid";const G5={},Wf=Q((e,t)=>{const{w:n,h:r,miw:o,mih:i,...s}=U("Space",G5,e);return C.createElement(H,{ref:t,...s,w:n,miw:o??n,h:r,mih:i??r})});Wf.displayName="@mantine/core/Space";var Qj={root:"m_6d731127"};const Q5={gap:"md",align:"stretch",justify:"flex-start"},K5=(e,{gap:t,align:n,justify:r})=>({root:{"--stack-gap":rn(t),"--stack-align":n,"--stack-justify":r}}),je=Q((e,t)=>{const n=U("Stack",Q5,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,align:u,justify:d,gap:f,variant:h,...m}=n,g=ce({name:"Stack",props:n,classes:Qj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:K5});return C.createElement(H,{ref:t,...g("root"),variant:h,...m})});je.classes=Qj;je.displayName="@mantine/core/Stack";const[Y5,X5]=Pn("Stepper component was not found in tree"),Nd=()=>null;Nd.displayName="@mantine/core/StepperCompleted";var gv={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 Iu=(e,t)=>typeof e=="function"?C.createElement(e,{step:t||0}):e,J5={withIcon:!0,allowStepClick:!0,iconPosition:"left"},yv=Q((e,t)=>{const{classNames:n,className:r,style:o,styles:i,vars:s,step:l,state:c,color:u,icon:d,completedIcon:f,progressIcon:h,label:m,description:g,withIcon:y,iconSize:S,loading:v,allowStepClick:x,allowStepSelect:w,iconPosition:b,orientation:j,mod:E,...P}=U("StepperStep",J5,e),T=X5(),_=Tt(),D={classNames:n,styles:i},O=c==="stepCompleted"?null:c==="stepProgress"?h:d,I={"data-progress":c==="stepProgress"||void 0,"data-completed":c==="stepCompleted"||void 0};return C.createElement(Xn,{...T.getStyles("step",{className:r,style:o,variant:T.orientation,...D}),mod:[{"icon-position":b||T.iconPosition,"allow-click":x},E],ref:t,...I,...P,__vars:{"--step-color":u?mt(u,_):void 0},tabIndex:x?0:-1},y&&C.createElement("span",{...T.getStyles("stepWrapper",D)},C.createElement("span",{...T.getStyles("stepIcon",D),...I},C.createElement($o,{mounted:c==="stepCompleted",transition:"pop",duration:200},L=>C.createElement("span",{...T.getStyles("stepCompletedIcon",{style:L,...D})},v?C.createElement(Un,{color:"var(--mantine-color-white)",size:"calc(var(--stepper-icon-size) / 2)",...T.getStyles("stepLoader",D)}):Iu(f,l)||C.createElement(Tf,{size:"60%"}))),c!=="stepCompleted"?v?C.createElement(Un,{...T.getStyles("stepLoader",D),size:"calc(var(--stepper-icon-size) / 2)",color:u}):Iu(O||d,l):null),j==="vertical"&&C.createElement("span",{...T.getStyles("verticalSeparator",D),"data-active":c==="stepCompleted"||void 0})),(m||g)&&C.createElement("span",{...T.getStyles("stepBody",D),"data-orientation":T.orientation,"data-icon-position":b||T.iconPosition},m&&C.createElement("span",{...T.getStyles("stepLabel",D)},Iu(m,l)),g&&C.createElement("span",{...T.getStyles("stepDescription",D)},Iu(g,l))))});yv.classes=gv;yv.displayName="@mantine/core/StepperStep";const Z5={orientation:"horizontal",iconPosition:"left",allowNextStepsSelect:!0,wrap:!0},eO=(e,{color:t,iconSize:n,size:r,contentPadding:o,radius:i,autoContrast:s})=>({root:{"--stepper-color":t?mt(t,e):void 0,"--stepper-icon-color":xc(s,e)?hs({color:t,theme:e}):void 0,"--stepper-icon-size":n===void 0?ke(r,"stepper-icon-size"):B(n),"--stepper-content-padding":rn(o),"--stepper-radius":i===void 0?void 0:gt(i),"--stepper-fz":Xt(r),"--stepper-spacing":rn(r)}}),Ra=Q((e,t)=>{var R,k,F;const n=U("Stepper",Z5,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:S,contentPadding:v,orientation:x,iconPosition:w,size:b,radius:j,allowNextStepsSelect:E,wrap:P,...T}=n,_=ce({name:"Stepper",classes:gv,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:eO}),D=p.Children.toArray(u),O=D.filter(q=>q.type!==Nd),I=D.find(q=>q.type===Nd),L=O.reduce((q,G,ne)=>{const xe=f===ne?"stepProgress":f>ne?"stepCompleted":"stepInactive",Pe=typeof d!="function"?!1:typeof G.props.allowStepSelect=="boolean"?G.props.allowStepSelect:xe==="stepCompleted"||E;return q.push(p.cloneElement(G,{icon:G.props.icon||h||ne+1,key:ne,step:ne,state:xe,onClick:()=>Pe&&(d==null?void 0:d(ne)),allowStepClick:Pe,completedIcon:G.props.completedIcon||m,progressIcon:G.props.progressIcon||g,color:G.props.color||y,iconSize:S,radius:j,iconPosition:G.props.iconPosition||w,orientation:x,unstyled:l})),x==="horizontal"&&ne!==O.length-1&&q.push(C.createElement("div",{..._("separator"),"data-active":ne<f||void 0,"data-orientation":x,key:`separator-${ne}`})),q},[]),N=(k=(R=O[f])==null?void 0:R.props)==null?void 0:k.children,M=(F=I==null?void 0:I.props)==null?void 0:F.children,$=f>O.length-1?M:N;return C.createElement(Y5,{value:{getStyles:_,orientation:x,iconPosition:w}},C.createElement(H,{..._("root"),ref:t,size:b,...T},C.createElement(H,{..._("steps"),mod:{orientation:x,"icon-position":w,wrap:P&&x!=="vertical"}},L),$&&C.createElement("div",{..._("content")},$)))});Ra.classes=gv;Ra.displayName="@mantine/core/Stepper";Ra.Completed=Nd;Ra.Step=yv;const Kj=p.createContext(null),tO=Kj.Provider,nO=()=>p.useContext(Kj),rO={},vv=Q((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:i,wrapperProps:s,children:l,readOnly:c,...u}=U("SwitchGroup",rO,e),[d,f]=mn({value:n,defaultValue:r,finalValue:[],onChange:o}),h=m=>{const g=m.currentTarget.value;!c&&f(d.includes(g)?d.filter(y=>y!==g):[...d,g])};return C.createElement(tO,{value:{value:d,onChange:h,size:i}},C.createElement(bt.Wrapper,{size:i,ref:t,...s,...u,labelElement:"div",__staticSelector:"SwitchGroup"},C.createElement(Vy,{role:"group"},l)))});vv.classes=bt.Wrapper.classes;vv.displayName="@mantine/core/SwitchGroup";var Yj={root:"m_5f93f3bb",input:"m_926b4011",track:"m_9307d992",thumb:"m_93039a1d",trackLabel:"m_8277e082"};const oO={labelPosition:"right"},iO=(e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:gt(t),"--switch-height":ke(r,"switch-height"),"--switch-width":ke(r,"switch-width"),"--switch-thumb-size":ke(r,"switch-thumb-size"),"--switch-label-font-size":ke(r,"switch-label-font-size"),"--switch-track-label-padding":ke(r,"switch-track-label-padding"),"--switch-color":n?mt(n,e):void 0}}),Mc=Q((e,t)=>{const n=U("Switch",oO,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:S,children:v,thumbIcon:x,checked:w,defaultChecked:b,onChange:j,labelPosition:E,description:P,error:T,disabled:_,variant:D,rootRef:O,mod:I,...L}=n,N=nO(),M=g||(N==null?void 0:N.size),$=ce({name:"Switch",props:n,classes:Yj,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:iO}),{styleProps:R,rest:k}=No(L),F=Tn(m),q=N?{checked:N.value.includes(k.value),onChange:N.onChange}:{},[G,ne]=mn({value:q.checked??w,defaultValue:b,finalValue:!1});return C.createElement(Pf,{...$("root"),__staticSelector:"Switch",__stylesApiProps:n,id:F,size:M,labelPosition:E,label:d,description:P,error:T,disabled:_,bodyElement:"label",labelElement:"span",classNames:r,styles:s,unstyled:l,"data-checked":q.checked||void 0,variant:D,ref:O,mod:I,...R,...S},C.createElement("input",{...k,disabled:_,checked:G,onChange:xe=>{var ge;N?(ge=q.onChange)==null||ge.call(q,xe):j==null||j(xe),ne(xe.currentTarget.checked)},id:F,ref:t,type:"checkbox",role:"switch",...$("input")}),C.createElement(H,{"aria-hidden":"true",mod:{error:T,"label-position":E},...$("track")},C.createElement(H,{component:"span",mod:"reduce-motion",...$("thumb")},x),C.createElement("span",{...$("trackLabel")},G?h:f)))});Mc.classes={...Yj,...mj};Mc.displayName="@mantine/core/Switch";Mc.Group=vv;const[sO,aO]=Pn("Table component was not found in the tree");var $c={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 lO(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 Ss(e,t){const n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=Q((o,i)=>{const s=U(n,{},o),{classNames:l,className:c,style:u,styles:d,...f}=s,h=aO();return C.createElement(H,{component:e,ref:i,...lO(h,t),...h.getStyles(e,{className:c,classNames:l,style:u,styles:d,props:s}),...f})});return r.displayName=`@mantine/core/${n}`,r.classes=$c,r}const Cm=Ss("th",{columnBorder:!0}),Xj=Ss("td",{columnBorder:!0}),Zu=Ss("tr",{rowBorder:!0,striped:!0,highlightOnHover:!0}),Jj=Ss("thead",{stickyHeader:!0}),Zj=Ss("tbody"),eP=Ss("tfoot"),tP=Ss("caption",{captionSide:!0});function xv({data:e}){return C.createElement(C.Fragment,null,e.caption&&C.createElement(tP,null,e.caption),e.head&&C.createElement(Jj,null,C.createElement(Zu,null,e.head.map((t,n)=>C.createElement(Cm,{key:n},t)))),e.body&&C.createElement(Zj,null,e.body.map((t,n)=>C.createElement(Zu,{key:n},t.map((r,o)=>C.createElement(Xj,{key:o},r))))),e.foot&&C.createElement(eP,null,C.createElement(Zu,null,e.foot.map((t,n)=>C.createElement(Cm,{key:n},t)))))}xv.displayName="@mantine/core/TableDataRenderer";const cO={type:"scrollarea"},uO=(e,{minWidth:t,type:n})=>({scrollContainer:{"--table-min-width":B(t),"--table-overflow":n==="native"?"auto":void 0}}),wv=Q((e,t)=>{const n=U("TableScrollContainer",cO,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,children:u,minWidth:d,type:f,...h}=n,m=ce({name:"TableScrollContainer",classes:$c,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:uO,rootSelector:"scrollContainer"});return C.createElement(H,{component:f==="scrollarea"?vr:"div",...f==="scrollarea"?{offsetScrollbars:"x"}:{},ref:t,...m("scrollContainer"),...h},C.createElement("div",{...m("scrollContainerInner")},u))});wv.classes=$c;wv.displayName="@mantine/core/TableScrollContainer";const dO={withRowBorders:!0,verticalSpacing:7},fO=(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":rn(r),"--table-vertical-spacing":rn(o),"--table-border-color":i?mt(i,e):void 0,"--table-striped-color":c&&s?mt(s,e):void 0,"--table-highlight-on-hover-color":u&&l?mt(l,e):void 0,"--table-sticky-header-offset":f?B(d):void 0}}),se=Q((e,t)=>{const n=U("Table",dO,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:S,withRowBorders:v,withTableBorder:x,borderColor:w,layout:b,variant:j,data:E,children:P,stickyHeader:T,stickyHeaderOffset:_,mod:D,...O}=n,I=ce({name:"Table",props:n,className:o,style:i,classes:$c,classNames:r,styles:s,unstyled:l,rootSelector:"table",vars:c,varsResolver:fO});return C.createElement(sO,{value:{getStyles:I,stickyHeader:T,striped:g===!0?"odd":g||void 0,highlightOnHover:y,withColumnBorders:S,withRowBorders:v,captionSide:f||"bottom"}},C.createElement(H,{component:"table",variant:j,ref:t,mod:[{"data-with-table-border":x},D],...I("table"),...O},P||!!E&&C.createElement(xv,{data:E})))});se.classes=$c;se.displayName="@mantine/core/Table";se.Td=Xj;se.Th=Cm;se.Tr=Zu;se.Thead=Jj;se.Tbody=Zj;se.Tfoot=eP;se.Caption=tP;se.ScrollContainer=wv;se.DataRenderer=xv;const[hO,Sv]=Pn("Tabs component was not found in the tree");var Lc={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 pO={},bv=Q((e,t)=>{const n=U("TabsList",pO,e),{children:r,className:o,grow:i,justify:s,classNames:l,styles:c,style:u,mod:d,...f}=n,h=Sv();return C.createElement(H,{...f,...h.getStyles("list",{className:o,style:u,classNames:l,styles:c,props:n,variant:h.variant}),ref:t,role:"tablist",variant:h.variant,mod:[{grow:i,orientation:h.orientation,placement:h.orientation==="vertical"&&h.placement,inverted:h.inverted},d],"aria-orientation":h.orientation,__vars:{"--tabs-justify":s}},r)});bv.classes=Lc;bv.displayName="@mantine/core/TabsList";const mO={},Cv=Q((e,t)=>{const n=U("TabsPanel",mO,e),{children:r,className:o,value:i,classNames:s,styles:l,style:c,mod:u,...d}=n,f=Sv(),h=f.value===i,m=f.keepMounted||n.keepMounted||h?r:null;return C.createElement(H,{...d,...f.getStyles("panel",{className:o,classNames:s,styles:l,style:[c,h?void 0:{display:"none"}],props:n}),ref:t,mod:[{orientation:f.orientation},u],role:"tabpanel",id:f.getPanelId(i),"aria-labelledby":f.getTabId(i)},m)});Cv.classes=Lc;Cv.displayName="@mantine/core/TabsPanel";const gO={},Ev=Q((e,t)=>{const n=U("TabsTab",gO,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,mod:S,...v}=n,x=Tt(),{dir:w}=La(),b=Sv(),j=l===b.value,E=T=>{b.onChange(b.allowTabDeactivation&&l===b.value?null:l),c==null||c(T)},P={classNames:m,styles:g,props:n};return C.createElement(Xn,{...v,...b.getStyles("tab",{className:r,style:h,variant:b.variant,...P}),disabled:d,unstyled:b.unstyled,variant:b.variant,mod:[{active:j,disabled:d,orientation:b.orientation,inverted:b.inverted,placement:b.orientation==="vertical"&&b.placement},S],ref:t,role:"tab",id:b.getTabId(l),"aria-selected":j,tabIndex:j||b.value===null?0:-1,"aria-controls":b.getPanelId(l),onClick:E,__vars:{"--tabs-color":f?mt(f,x):void 0},onKeyDown:OS({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:b.activateTabWithKeyboard,loop:b.loop,orientation:b.orientation||"horizontal",dir:w,onKeyDown:u})},s&&C.createElement("span",{...b.getStyles("tabSection",P),"data-position":"left"},s),o&&C.createElement("span",{...b.getStyles("tabLabel",P)},o),i&&C.createElement("span",{...b.getStyles("tabSection",P),"data-position":"right"},i))});Ev.classes=Lc;Ev.displayName="@mantine/core/TabsTab";const $1="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",yO={keepMounted:!0,orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,allowTabDeactivation:!1,unstyled:!1,inverted:!1,variant:"default",placement:"left"},vO=(e,{radius:t,color:n,autoContrast:r})=>({root:{"--tabs-radius":gt(t),"--tabs-color":mt(n,e),"--tabs-text-color":xc(r,e)?hs({color:n,theme:e}):void 0}}),We=Q((e,t)=>{const n=U("Tabs",yO,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:S,keepMounted:v,classNames:x,styles:w,unstyled:b,className:j,style:E,vars:P,autoContrast:T,mod:_,...D}=n,O=Tn(u),[I,L]=mn({value:o,defaultValue:r,finalValue:null,onChange:i}),N=ce({name:"Tabs",props:n,classes:Lc,className:j,style:E,classNames:x,styles:w,unstyled:b,vars:P,varsResolver:vO});return C.createElement(hO,{value:{placement:S,value:I,orientation:s,id:O,loop:c,activateTabWithKeyboard:d,getTabId:L0(`${O}-tab`,$1),getPanelId:L0(`${O}-panel`,$1),onChange:L,allowTabDeactivation:f,variant:h,color:m,radius:g,inverted:y,keepMounted:v,unstyled:b,getStyles:N}},C.createElement(H,{ref:t,id:O,variant:h,mod:[{orientation:s,inverted:s==="horizontal"&&y,placement:s==="vertical"&&S},_],...N("root"),...D},l))});We.classes=Lc;We.displayName="@mantine/core/Tabs";We.Tab=Ev;We.Panel=Cv;We.List=bv;const xO={},ie=Q((e,t)=>{const n=U("TextInput",xO,e);return C.createElement(wr,{component:"input",ref:t,...n,__staticSelector:"TextInput"})});ie.classes=wr.classes;ie.displayName="@mantine/core/TextInput";var nP={root:"m_7341320d"};const wO={},SO=(e,{size:t,radius:n,variant:r,gradient:o,color:i,autoContrast:s})=>{const l=e.variantColorResolver({color:i||e.primaryColor,theme:e,gradient:o,variant:r||"filled",autoContrast:s});return{root:{"--ti-size":ke(t,"ti-size"),"--ti-radius":n===void 0?void 0:gt(n),"--ti-bg":i||r?l.background:void 0,"--ti-color":i||r?l.color:void 0,"--ti-bd":i||r?l.border:void 0}}},jv=Q((e,t)=>{const n=U("ThemeIcon",wO,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,autoContrast:u,...d}=n,f=ce({name:"ThemeIcon",classes:nP,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:SO});return C.createElement(H,{ref:t,...f("root"),...d})});jv.classes=nP;jv.displayName="@mantine/core/ThemeIcon";const bO=["h1","h2","h3","h4","h5","h6"];function CO(e,t){const n=t!==void 0?t:`h${e}`;return bO.includes(n)?{fontSize:`var(--mantine-${n}-font-size)`,fontWeight:`var(--mantine-${n}-font-weight)`,lineHeight:`var(--mantine-${n}-line-height)`}:{fontSize:B(n),fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}}var rP={root:"m_8a5d1357"};const EO={order:1},jO=(e,{order:t,size:n,lineClamp:r,textWrap:o})=>{const i=CO(t,n);return{root:{"--title-fw":i.fontWeight,"--title-lh":i.lineHeight,"--title-fz":i.fontSize,"--title-line-clamp":typeof r=="number"?r.toString():void 0,"--title-text-wrap":o}}},le=Q((e,t)=>{const n=U("Title",EO,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,order:c,vars:u,size:d,variant:f,lineClamp:h,textWrap:m,mod:g,...y}=n,S=ce({name:"Title",props:n,classes:rP,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:u,varsResolver:jO});return[1,2,3,4,5,6].includes(c)?C.createElement(H,{...S("root"),component:`h${c}`,variant:f,ref:t,mod:[{order:c,"data-line-clamp":typeof h=="number"},g],size:d,...y}):null});le.classes=rP;le.displayName="@mantine/core/Title";function PO(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 TO(e){return p.useSyncExternalStore(e.subscribe,()=>e.getState(),()=>e.getState())}const kO=()=>PO({notifications:[],queue:[],limit:5}),bs=kO(),RO=(e=bs)=>TO(e);function Qa(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 ue(e,t=bs){const n=e.id||ag();return Qa(t,r=>e.id&&r.some(o=>o.id===e.id)?r:[...r,{...e,id:n}]),n}function oP(e,t=bs){return Qa(t,n=>n.filter(r=>{var o;return r.id===e?((o=r.onClose)==null||o.call(r,r),!1):!0})),e}function jl(e,t=bs){return Qa(t,n=>n.map(r=>r.id===e.id?{...r,...e}:r)),e.id}function _O(e=bs){Qa(e,()=>[])}function IO(e=bs){Qa(e,t=>t.slice(0,e.getState().limit))}const no={show:ue,hide:oP,update:jl,clean:_O,cleanQueue:IO,updateState:Qa};function Em(e,t){return Em=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,o){return r.__proto__=o,r},Em(e,t)}function iP(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Em(e,t)}var sP={exports:{}},DO="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",AO=DO,NO=AO;function aP(){}function lP(){}lP.resetWarningCache=aP;var OO=function(){function e(r,o,i,s,l,c){if(c!==NO){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:lP,resetWarningCache:aP};return n.PropTypes=n,n};sP.exports=OO();var MO=sP.exports;const it=Jm(MO),L1={disabled:!1},Od=C.createContext(null);var $O=function(t){return t.scrollTop},Pl="unmounted",$i="exited",Li="entering",Vs="entered",jm="exiting",zo=function(e){iP(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=Li):c=Vs:r.unmountOnExit||r.mountOnEnter?c=Pl:c=$i,i.state={status:c},i.nextCallback=null,i}t.getDerivedStateFromProps=function(o,i){var s=o.in;return s&&i.status===Pl?{status:$i}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var i=null;if(o!==this.props){var s=this.state.status;this.props.in?s!==Li&&s!==Vs&&(i=Li):(s===Li||s===Vs)&&(i=jm)}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===Li){if(this.props.unmountOnExit||this.props.mountOnEnter){var s=this.props.nodeRef?this.props.nodeRef.current:na.findDOMNode(this);s&&$O(s)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===$i&&this.setState({status:Pl})},n.performEnter=function(o){var i=this,s=this.props.enter,l=this.context?this.context.isMounting:o,c=this.props.nodeRef?[l]:[na.findDOMNode(this),l],u=c[0],d=c[1],f=this.getTimeouts(),h=l?f.appear:f.enter;if(!o&&!s||L1.disabled){this.safeSetState({status:Vs},function(){i.props.onEntered(u)});return}this.props.onEnter(u,d),this.safeSetState({status:Li},function(){i.props.onEntering(u,d),i.onTransitionEnd(h,function(){i.safeSetState({status:Vs},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:na.findDOMNode(this);if(!i||L1.disabled){this.safeSetState({status:$i},function(){o.props.onExited(l)});return}this.props.onExit(l),this.safeSetState({status:jm},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:na.findDOMNode(this),l=o==null&&!this.props.addEndListener;if(!s||l){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var c=this.props.nodeRef?[this.nextCallback]:[s,this.nextCallback],u=c[0],d=c[1];this.props.addEndListener(u,d)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===Pl)return null;var i=this.props,s=i.children;i.in,i.mountOnEnter,i.unmountOnExit,i.appear,i.enter,i.exit,i.timeout,i.addEndListener,i.onEnter,i.onEntering,i.onEntered,i.onExit,i.onExiting,i.onExited,i.nodeRef;var l=Jy(i,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return C.createElement(Od.Provider,{value:null},typeof s=="function"?s(o,l):C.cloneElement(C.Children.only(s),l))},t}(C.Component);zo.contextType=Od;zo.propTypes={};function $s(){}zo.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:$s,onEntering:$s,onEntered:$s,onExit:$s,onExiting:$s,onExited:$s};zo.UNMOUNTED=Pl;zo.EXITED=$i;zo.ENTERING=Li;zo.ENTERED=Vs;zo.EXITING=jm;const LO=zo;function FO(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Pv(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 zO(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 Wi(e,t,n){return n[t]!=null?n[t]:e.props[t]}function BO(e,t){return Pv(e.children,function(n){return p.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:Wi(n,"appear",e),enter:Wi(n,"enter",e),exit:Wi(n,"exit",e)})})}function UO(e,t,n){var r=Pv(e.children),o=zO(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:Wi(s,"exit",e),enter:Wi(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:Wi(s,"exit",e),enter:Wi(s,"enter",e)}))}}),o}var VO=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},HO={component:"div",childFactory:function(t){return t}},Tv=function(e){iP(t,e);function t(r,o){var i;i=e.call(this,r,o)||this;var s=i.handleExited.bind(FO(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?BO(o,l):UO(o,s,l),firstRender:!1}},n.handleExited=function(o,i){var s=Pv(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=Jy(o,["component","childFactory"]),c=this.state.contextValue,u=VO(this.state.children).map(s);return delete l.appear,delete l.enter,delete l.exit,i===null?C.createElement(Od.Provider,{value:c},u):C.createElement(Od.Provider,{value:c},C.createElement(i,l,u))},t}(C.Component);Tv.propTypes={};Tv.defaultProps=HO;const WO=Tv,F1={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},qO={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function GO({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:F1[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:qO[s]},u={opacity:0,maxHeight:0,transform:F1[s]};return{...l,...{entering:c,entered:c,exiting:u,exited:u}[e]}}function QO(e,t){return typeof t=="number"?t:t===!1||e===!1?!1:e}const cP=p.forwardRef(({data:e,onHide:t,autoClose:n,...r},o)=>{const{autoClose:i,message:s,...l}=e,c=QO(n,e.autoClose),u=p.useRef(),d=()=>window.clearTimeout(u.current),f=()=>{t(e.id),d()},h=()=>{typeof c=="number"&&(u.current=window.setTimeout(f,c))};return p.useEffect(()=>{var m;(m=e.onOpen)==null||m.call(e,e)},[]),p.useEffect(()=>(h(),d),[c]),C.createElement(uv,{...r,...l,onClose:f,ref:o,onMouseEnter:d,onMouseLeave:h},s)});cP.displayName="@mantine/notifications/NotificationContainer";var uP={root:"m_b37d9ac7",notification:"m_5ed0edd0"};const KO=LO,YO={position:"bottom-right",autoClose:4e3,transitionDuration:250,containerWidth:440,notificationMaxHeight:200,limit:5,zIndex:zr("overlay"),store:bs,withinPortal:!0},XO=(e,{zIndex:t,position:n,containerWidth:r})=>{const[o,i]=n.split("-");return{root:{"--notifications-z-index":t==null?void 0:t.toString(),"--notifications-top":o==="top"?"var(--mantine-spacing-md)":void 0,"--notifications-bottom":o==="bottom"?"var(--mantine-spacing-md)":void 0,"--notifications-left":i==="left"?"var(--mantine-spacing-md)":i==="center"?"50%":void 0,"--notifications-right":i==="right"?"var(--mantine-spacing-md)":void 0,"--notifications-transform":i==="center"?"translateX(-50%)":void 0,"--notifications-container-width":B(r)}}},Bo=Q((e,t)=>{const n=U("Notifications",YO,e),{classNames:r,className:o,style:i,styles:s,unstyled:l,vars:c,position:u,autoClose:d,transitionDuration:f,containerWidth:h,notificationMaxHeight:m,limit:g,zIndex:y,store:S,portalProps:v,withinPortal:x,...w}=n,b=Tt(),j=RO(S),E=_2(),P=cg(),T=p.useRef({}),_=p.useRef(0),O=(b.respectReducedMotion?P:!1)?1:f,I=ce({name:"Notifications",classes:uP,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:XO});p.useEffect(()=>{S==null||S.updateState(N=>({...N,limit:g||5}))},[g]),Co(()=>{j.notifications.length>_.current&&setTimeout(()=>E(),0),_.current=j.notifications.length},[j.notifications]);const L=j.notifications.map(({style:N,...M})=>C.createElement(KO,{key:M.id,timeout:O,onEnter:()=>T.current[M.id].offsetHeight,nodeRef:{current:T.current[M.id]}},$=>C.createElement(cP,{ref:R=>{T.current[M.id]=R},data:M,onHide:R=>oP(R,S),autoClose:d,...I("notification",{style:{...GO({state:$,position:u,transitionDuration:O,maxHeight:m}),...N}})})));return C.createElement(ys,{withinPortal:x,...v},C.createElement(H,{...I("root"),ref:t,...w},C.createElement(WO,null,L)))});Bo.classes=uP;Bo.displayName="@mantine/notifications/Notifications";Bo.show=no.show;Bo.hide=no.hide;Bo.update=no.update;Bo.clean=no.clean;Bo.cleanQueue=no.cleanQueue;Bo.updateState=no.updateState;class JO{constructor(t,n){this.operator=t,this.child=n}toString(){return`${this.operator}(${this.child.toString()})`}}class Fc{constructor(t,n,r){this.operator=t,this.left=n,this.right=r}toString(){return`${this.left.toString()} ${this.operator} ${this.right.toString()}`}}class ZO{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 eM(t,this.prefixParselets,this.infixParselets)}}class eM{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 tM="http://hl7.org",dP="ok",nM="created",rM="gone",oM="not-modified",iM="not-found",sM="forbidden",aM="accepted",lM={resourceType:"OperationOutcome",id:dP,issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},cM={resourceType:"OperationOutcome",id:iM,issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},fP={resourceType:"OperationOutcome",id:sM,issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]};function mi(e,t){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"invalid",details:{text:e},expression:t?[t]:void 0}]}}function vt(e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"structure",details:{text:e}}]}}function uM(e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"exception",details:{text:"Internal server error"},diagnostics:e.toString()}]}}function qf(e){return typeof e=="object"&&e!==null&&e.resourceType==="OperationOutcome"}function hP(e){return e.id===dP||e.id===nM||e.id===oM||e.id===aM}function dM(e){return e.id===rM}class Me extends Error{constructor(t,n){super(pP(t)),this.outcome=t,this.cause=n}}function at(e){return e instanceof Me?e.outcome:qf(e)?e:mi(Re(e))}function Re(e){return e?typeof e=="string"?e:e instanceof Error?e.message:qf(e)?pP(e):typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:JSON.stringify(e):"Unknown error"}function pP(e){var n;const t=((n=e.issue)==null?void 0:n.map(mP))??[];return t.length>0?t.join("; "):"Unknown error"}function mP(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 fM(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 hM(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,fM(o,i)])),constraints:[],innerTypes:[]};return t}const pM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]}}},mM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]}}},gM={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"}]}}},yM={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"}]}}},vM={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"}]}}},xM={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"}]}}},wM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},coding:{max:9007199254740991,type:[{code:"Coding"}]},text:{type:[{code:"string"}]}}},SM={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"}]}}},bM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},name:{type:[{code:"string"}]},telecom:{max:9007199254740991,type:[{code:"ContactPoint"}]}}},CM={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"}]}}},EM={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"}]}}},jM={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"}]}}},PM={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"}]}}},TM={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"}]}}},kM={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"]}]}}},RM={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"}]}}},_M={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"}]}}},IM={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"}]}}},DM={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"}]}}},AM={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"}]}}},NM={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"]}]}}},OM={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"}]}}},MM={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"}]}}},$M={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},currency:{type:[{code:"code"}]}}},LM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},status:{min:1,type:[{code:"code"}]},div:{min:1,type:[{code:"xhtml"}]}}},FM={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"]}]}}},zM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},start:{type:[{code:"dateTime"}]},end:{type:[{code:"dateTime"}]}}},BM={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"}]}}},UM={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"}]}}},VM={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"}]}}},HM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},WM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},low:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},high:{type:[{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},qM={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},numerator:{type:[{code:"Quantity"}]},denominator:{type:[{code:"Quantity"}]}}},GM={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"}]}}},QM={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"]}]}}},KM={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"}]}}},YM={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"}]}}},XM={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"}]}}},JM={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"}]}}},ZM={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"}]}}},e$={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"]}]}}},t$={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"}]}}},n$={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"}]}}},r$={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"}]}}},o$={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"}]}}},i$={Element:pM,BackboneElement:mM,Address:gM,Age:yM,Annotation:vM,Attachment:xM,CodeableConcept:wM,Coding:SM,ContactDetail:bM,ContactPoint:CM,Contributor:EM,Count:jM,DataRequirement:PM,Distance:TM,Dosage:kM,Duration:RM,ElementDefinition:_M,Expression:IM,Extension:DM,HumanName:AM,Identifier:NM,MarketingStatus:OM,Meta:MM,Money:$M,Narrative:LM,ParameterDefinition:FM,Period:zM,Population:BM,ProdCharacteristic:UM,ProductShelfLife:VM,Quantity:HM,Range:WM,Ratio:qM,Reference:GM,RelatedArtifact:QM,SampledData:KM,Signature:YM,SubstanceAmount:XM,Timing:JM,TriggerDefinition:ZM,UsageContext:e$,MoneyQuantity:t$,SimpleQuantity:n$,MetadataResource:r$,IdentityProvider:o$};function s$(e){return new a$(e).parse()}const gP=hM(i$),kv=Object.create(null),z1=Object.create(null);function Pm(e){let t;return e?(t=z1[e],t||(t=z1[e]=Object.create(null))):t=gP,t}function B1(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)yP(o,t)}function yP(e,t){if(!(e!=null&&e.name))throw new Error("Failed loading StructureDefinition from bundle");if(e.resourceType!=="StructureDefinition")return;const n=s$(e),r=Pm(t);r[e.name]=n,t&&e.url===t&&(kv[t]=n);for(const o of n.innerTypes)o.parentType=n,r[o.name]=o}function vP(e){return!!gP[e]}function Gf(e,t){let n=Pm(t)[e];return!n&&t&&(n=Pm()[e]),n}function xP(e,t){const n=Gf(e,t);if(!n)throw new Me(mi("Unknown data type: "+e));return n}function Rv(e){return!!kv[e]}function Cs(e){return kv[e]}class a${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:u$(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=ip(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[ip(t,c.path)]=l;break}c=c.parent}if(!c){const u=ip(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&&!Ls((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:Y1(t),title:t.label,description:t.definition,elements:{},constraints:this.parseElementDefinition(t).constraints,innerTypes:[]},path:t.path??"",parent:Ls((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;c$(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&&!Ls(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&&!Ls(this.backboneContext.path,t==null?void 0:t.path));else this.innerTypes.push(this.backboneContext.type),this.backboneContext=void 0;this.slicingContext&&!Ls(this.slicingContext.path,t==null?void 0:t.path)&&((n=this.slicingContext)!=null&&n.current&&this.slicingContext.field.slices.push(this.slicingContext.current),this.slicingContext=void 0)}next(){const t=this.peek();if(t)return this.index++,t}peek(){var n,r,o,i,s;const t=this.elements[this.index];if(t){if(this.elementIndex[t.path??""]=t,t.contentReference){const l=t.contentReference.slice(t.contentReference.indexOf("#")+1),c=this.elementIndex[l];return c?{...c,id:t.id,path:t.path,min:t.min??c.min,max:t.max??c.max,base:{path:((n=c.base)==null?void 0:n.path)??l,min:((r=t.base)==null?void 0:r.min)??((o=c.base)==null?void 0:o.min)??c.min,max:((i=t.base)==null?void 0:i.max)??((s=c.base)==null?void 0:s.max)??c.max},contentReference:t.contentReference,definition:t.definition}:void 0}return t}}isInnerType(t){var r;const n=this.peek();return!!(Ls(t==null?void 0:t.path,n==null?void 0:n.path)&&((r=t.type)!=null&&r.some(o=>["BackboneElement","Element"].includes(o.code))))}parseSliceStart(t){if(!this.slicingContext)throw new Error(`Invalid slice start before discriminator: ${t.sliceName} (${t.id})`);this.slicingContext.current&&this.slicingContext.field.slices.push(this.slicingContext.current),this.slicingContext.current={name:t.sliceName??"",path:t.path??"",definition:t.definition,type:this.parseElementDefinitionType(t),elements:{},min:t.min??0,max:t.max==="*"?Number.POSITIVE_INFINITY:Number.parseInt(t.max,10),binding:t.binding}}parseElementDefinitionType(t){return(t.type??[]).map(n=>{var o;let r;return(n.code==="BackboneElement"||n.code==="Element")&&(r=Y1(t)),r||(r=(o=zc(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=U1(t.max),r=(i=t.base)!=null&&i.max?U1(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:V1(an(o,"fixed[x]")),pattern:V1(an(o,"pattern[x]")),binding:t.binding}}}function U1(e){return e==="*"?Number.POSITIVE_INFINITY:Number.parseInt(e,10)}function ip(e,t=""){return l$(e.path,t)}function l$(e,t){return e?t&&e.startsWith(t)?e.substring(t.length+1):e:""}function Ls(e,t){return!e||!t?!1:t.startsWith(e+".")||t===e}function V1(e){return Array.isArray(e)&&e.length>0?e[0]:At(e)?void 0:e}function c$(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 u$(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}function d$(e,t,n){if(e===void 0)return[void 0];if(t==="$this")return[e];const r=n!=null&&n.withPath?f$:an,[o,...i]=t.split(".");let s=[r(e,o,n)];for(const l of i){const c=[];for(const u of s)if(Array.isArray(u))for(const d of u)c.push(r(d,l,n));else(n!=null&&n.withPath&&u&&u.value!==void 0||!(n!=null&&n.withPath)&&u!==void 0)&&c.push(r(u,l,n));s=c}return s}function f$(e,t,n){const r=e.path;return h$(an(e,t,n),r,t)}function h$(e,t,n){const r=t?t+".":"";return e===void 0?{type:"undefined",value:void 0,path:`${r}${n}`}:Array.isArray(e)?e.map((o,i)=>({...o,path:`${r}${n}[${i}]`})):{...e,path:`${r}${n}`}}const wP={base64Binary:/^([A-Za-z\d+/]{4})*([A-Za-z\d+/]{2}==|[A-Za-z\d+/]{3}=)?$/,canonical:/^\S*$/,code:/^[^\s]+( [^\s]+)*$/,date:/^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/,dateTime:/^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/,id:/^[A-Za-z0-9\-.]{1,64}$/,instant:/^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00))$/,markdown:/^[\s\S]+$/,oid:/^urn:oid:[0-2](\.(0|[1-9]\d*))+$/,string:/^[\s\S]+$/,time:/^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/,uri:/^\S*$/,url:/^\S*$/,uuid:/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,xhtml:/.*/};function p$(e,t){const n=Array.isArray(e)?e.map(r=>({type:r.type,value:r.value})):{type:e.type,value:e.value};return!(t.pattern&&!Iv(n,t.pattern)||t.fixed&&!Bc(n,t.fixed))}function m$(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(p$(e,o))return!0;break;case"type":return!e||!(i!=null&&i.length)?!1:i.some(s=>s.code===e.type)}return!1}function Se(e){return[{type:V.boolean,value:e}]}function so(e){return e==null?{type:"undefined",value:void 0}:Number.isSafeInteger(e)?{type:V.integer,value:e}:typeof e=="number"?{type:V.decimal,value:e}:typeof e=="boolean"?{type:V.boolean,value:e}:typeof e=="string"?{type:V.string,value:e}:hr(e)?{type:V.Quantity,value:e}:Uo(e)?{type:e.resourceType,value:e}:{type:V.BackboneElement,value:e}}function si(e){return e.length===0?!1:!!e[0].value}function Ro(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 an(e,t,n){if(!e.value)return;const r=js(e.type,t,n==null?void 0:n.profileUrl);return r?SP(e,t,r):g$(e,t)}function SP(e,t,n){const r=e.value,o=n.type;if(!o||o.length===0)return;let i,s="undefined",l;if(n.path.endsWith("[x]")){const c=n.path.split(".").pop().replace("[x]","");for(const u of o){const d=c+Vt(u.code);if(i=r[d],l=r["_"+d],i!==void 0||l!==void 0){s=u.code;break}}}else console.assert(o.length===1,"Expected single type",n.path),i=r[t],s=o[0].code,l=r["_"+t];if(l)if(Array.isArray(i)){i=i.slice();for(let c=0;c<Math.max(i.length,l.length);c++)i[c]=G1(i[c],l[c])}else i=G1(i,l);if(!At(i))return(s==="Element"||s==="BackboneElement")&&(s=n.type[0].code),Array.isArray(i)?i.map(c=>H1(c,s)):H1(i,s)}function H1(e,t){return t==="Resource"&&Uo(e)&&(t=e.resourceType),{type:t,value:e}}function g$(e,t){const n=e.value;if(!n||typeof n!="object")return;let r;if(t in n)r=n[t];else for(const o in V){const i=t+Vt(o);if(i in n){r=n[i];break}}if(!At(r))return Array.isArray(r)?r.map(so):so(r)}function bP(e){const t=[];for(const n of e){let r=!1;for(const o of t)if(si(jP(n,o))){r=!0;break}r||t.push(n)}return t}function CP(e){return Se(!si(e))}function EP(e,t){return e.length===0||t.length===0?[]:e.length!==t.length?Se(!1):Se(e.every((n,r)=>si(jP(n,t[r]))))}function jP(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"?Se(Math.abs(n-r)<1e-8):hr(n)&&hr(r)?Se(kP(n,r)):Se(typeof n=="object"&&typeof r=="object"?_v(e,t):n===r)}function PP(e,t){return e.length===0&&t.length===0?Se(!0):e.length!==t.length?Se(!1):(e.sort(W1),t.sort(W1),Se(e.every((n,r)=>si(y$(n,t[r])))))}function y$(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"?Se(Math.abs(s-l)<.01):hr(s)&&hr(l)?Se(kP(s,l)):Se(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"?_v({...s,id:void 0},{...l,id:void 0}):typeof s=="string"&&typeof l=="string"?s.toLowerCase()===l.toLowerCase():s===l)}function W1(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 TP(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 v$(n);case"DateTime":return Tm(n);case"Time":return typeof n=="string"&&!!/^T\d/.exec(n);case"Period":return x$(n);case"Quantity":return hr(n);default:return typeof n=="object"&&(n==null?void 0:n.resourceType)===t}}function v$(e){return typeof e=="string"&&!!wP.date.exec(e)}function Tm(e){return typeof e=="string"&&!!wP.dateTime.exec(e)}function x$(e){return!!(e&&typeof e=="object"&&("start"in e&&Tm(e.start)||"end"in e&&Tm(e.end)))}function hr(e){return!!(e&&typeof e=="object"&&"value"in e&&typeof e.value=="number")}function kP(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 _v(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(q1(i)&&q1(s)){if(!_v(i,s))return!1}else if(i!==s)return!1}return!0}function q1(e){return e!==null&&typeof e=="object"}function G1(e,t){if(t){if(typeof t!="object")throw new Error("Primitive extension must be an object");return w$(e??{},t)}return e}function w$(e,t){return delete t.__proto__,delete t.constructor,Object.assign(e,t)}function ft(e){const t=ht(e),n=_o(e);return n===t?{reference:t}:{reference:t,display:n}}function ht(e){return Ps(e)?e.reference:`${e.resourceType}/${e.id}`}function Qf(e){if(e)return Ps(e)?e.reference.split("/")[1]:e.id}function S$(e){return e.resourceType==="Patient"||e.resourceType==="Practitioner"||e.resourceType==="RelatedPerson"}function _o(e){if(S$(e)){const t=b$(e);if(t)return t}if(e.resourceType==="Device"){const t=C$(e);if(t)return t}if(e.resourceType==="MedicationRequest"){const t=e.medicationCodeableConcept;if(t)return Si(t)}if(e.resourceType==="User"&&e.email)return e.email;if("name"in e&&e.name&&typeof e.name=="string")return e.name;if("code"in e&&e.code){let t=e.code;if(Array.isArray(t)&&(t=t[0]),A$(t))return Si(t);if(N$(t))return t.text}return ht(e)}function b$(e){const t=e.name;if(t&&t.length>0)return Uc(t[0])}function C$(e){const t=e.deviceName;if(t&&t.length>0)return t[0].name}function E$(e){if(!("photo"in e))return;const t=e.photo;if(t)if(Array.isArray(t))for(const n of t){const r=Q1(n);if(r)return r}else return Q1(t)}function Q1(e){var t;if(e.url&&((t=e.contentType)!=null&&t.startsWith("image/")))return e.url}function RP(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 j$(e,t){const{years:n,months:r,days:o}=RP(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 zc(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 er(e,t){return JSON.stringify(e,P$,t?2:void 0)}function P$(e,t){return!T$(e)&&At(t)?void 0:t}function T$(e){return!!/\d+$/.exec(e)}function At(e){if(e==null)return!0;const t=typeof e;return t==="string"||t==="object"?!Dt(e):!1}function Dt(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 Bc(e,t,n){return e===t||At(e)&&At(t)?!0:At(e)||At(t)?!1:Array.isArray(e)&&Array.isArray(t)?k$(e,t):Array.isArray(e)||Array.isArray(t)?!1:pn(e)&&pn(t)?R$(e,t,n):(pn(e)||pn(t),!1)}function k$(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!Bc(e[n],t[n]))return!1;return!0}function R$(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(!Bc(i,s,o))return!1}return!0}function Iv(e,t){return At(e)?!0:At(t)?!1:Array.isArray(e)&&Array.isArray(t)?_$(e,t):Array.isArray(e)||Array.isArray(t)?!1:pn(e)&&pn(t)?I$(e,t):pn(e)||pn(t)?!1:e===t}function _$(e,t){return t.every(n=>e.some(r=>Iv(r,n)))}function I$(e,t){return Object.entries(t).every(([n,r])=>n in e&&Iv(e[n],r))}function ao(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function _P(e){return!!/^\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$/i.exec(e)}function pn(e){return e!==null&&typeof e=="object"}function D$(e){return pn(e)&&"code"in e&&typeof e.code=="string"}function A$(e){return pn(e)&&"coding"in e&&Array.isArray(e.coding)&&e.coding.every(D$)}function N$(e){return pn(e)&&"text"in e&&typeof e.text=="string"}const IP=[];for(let e=0;e<256;e++)IP.push(e.toString(16).padStart(2,"0"));function O$(e){const t=new Uint8Array(e),n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=IP[t[r]];return n.join("")}function M$(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 Vt(e){return e?e.charAt(0).toUpperCase()+e.substring(1):""}function Dv(e){return e.length>0&&e.startsWith(e[0].toUpperCase())}function ac(e,t){const n=e+".";if(t.startsWith(n))return t.slice(n.length)}function $$(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 L$(e){if(e)return Array.isArray(e)?e:[e]}const K1=e=>new Promise(t=>{setTimeout(t,e)});function F$(e,t,n){const r=[];for(let o=0;o<n-1;o++){const i=e.indexOf(t);if(i<0)break;r.push(e.slice(0,i)),e=e.slice(i+t.length)}return r.push(e),r}function z$(e){let t,n=!1;return function(){return n||(t=e(),n=!0),t}}function fl(e,t){return e?(e.push(t),e):[t]}function lc(e){return e.sort((t,n)=>t.localeCompare(n))}function DP(e){return e.endsWith("/")?e:e+"/"}function B$(e){return e.startsWith("/")?e.slice(1):e}function po(e,t){return new URL(B$(t),DP(e.toString())).toString()}function U$(e,t){return po(e,t).toString().replace("http://","ws://").replace("https://","wss://")}function V$(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 Uc(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=uc(e.text);if(r)return r}return n.join(" ").trim()}function Kf(e){return e instanceof Date&&!isNaN(e.getTime())}function H$(e,t,n){if(!e)return"";const r=new Date("2000-01-01T"+e+"Z");return Kf(r)?r.toLocaleTimeString(t,n):""}function En(e,t,n){if(!e)return"";const r=new Date(e);return Kf(r)?r.toLocaleString(t,n):""}function W$(e,t,n){return!e||!e.start&&!e.end?"":En(e.start,t,n)+" - "+En(e.end,t,n)}const q$={s:"every second",min:"every minute",h:"hourly",d:"daily",wk:"weekly",mo:"monthly",a:"annually"},G$={s:"second",min:"minute",h:"hour",d:"day",wk:"week",mo:"month",a:"year"},Q$={s:"seconds",min:"minutes",h:"hours",d:"days",wk:"weeks",mo:"months",a:"years"};function AP(e){if(!e)return"";const t=[];return K$(t,e.repeat),e.event&&t.push(e.event.map(n=>En(n)).join(", ")),Vt(t.join(" ").trim())}function K$(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(q$[o]):(n===1?e.push("once"):e.push(n+" times"),r===1?e.push("per "+G$[o]):e.push("per "+r+" "+Q$[o])),t.dayOfWeek&&e.push("on "+t.dayOfWeek.map(Vt).join(", ")),t.timeOfDay&&e.push("at "+t.timeOfDay.map(i=>H$(i)).join(", "))}function cc(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=J$(r.value,t),`> ${Jo(r,t)}`):`>= ${Jo(r,t)}`:(r==null?void 0:r.value)===void 0&&(o==null?void 0:o.value)!==void 0?n&&t!==void 0?(o.value=X$(o.value,t),`< ${Jo(o,t)}`):`<= ${Jo(o,t)}`:((r==null?void 0:r.unit)===(o==null?void 0:o.unit)&&(r==null||delete r.unit),`${Jo(r,t)} - ${Jo(o,t)}`)}function Jo(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 Y$(e){return(e==null?void 0:e.value)===void 0?"":e.value.toLocaleString(void 0,{style:"currency",currency:e.currency??"USD",currencyDisplay:"narrowSymbol"})}function Si(e){if(!e)return"";const t=uc(e.text);return t||(e.coding?e.coding.map(n=>Es(n)).join(", "):"")}function Es(e){return uc(e==null?void 0:e.display)??uc(e==null?void 0:e.code)??""}function NP(e){if(!e)return"";if("component"in e)return e.component.map(n=>NP(n)).join(" / ");if(e.valueQuantity)return Jo(e.valueQuantity);if(e.valueCodeableConcept)return Si(e.valueCodeableConcept);const t=uc(e.valueString);return t||""}function uc(e){return typeof e=="string"?e:void 0}function X$(e,t,n=1){return(OP(e,t)+n)*Math.pow(10,-t)}function J$(e,t,n=1){return(OP(e,t)-n)*Math.pow(10,-t)}function OP(e,t){return t===void 0?e:Math.round(e*Math.pow(10,t))}const V={Address:"Address",Age:"Age",Annotation:"Annotation",Attachment:"Attachment",BackboneElement:"BackboneElement",CodeableConcept:"CodeableConcept",Coding:"Coding",ContactDetail:"ContactDetail",ContactPoint:"ContactPoint",Contributor:"Contributor",Count:"Count",DataRequirement:"DataRequirement",Distance:"Distance",Dosage:"Dosage",Duration:"Duration",Expression:"Expression",Extension:"Extension",HumanName:"HumanName",Identifier:"Identifier",MarketingStatus:"MarketingStatus",Meta:"Meta",Money:"Money",Narrative:"Narrative",ParameterDefinition:"ParameterDefinition",Period:"Period",Population:"Population",ProdCharacteristic:"ProdCharacteristic",ProductShelfLife:"ProductShelfLife",Quantity:"Quantity",Range:"Range",Ratio:"Ratio",Reference:"Reference",RelatedArtifact:"RelatedArtifact",SampledData:"SampledData",Signature:"Signature",SubstanceAmount:"SubstanceAmount",SystemString:"http://hl7.org/fhirpath/System.String",Timing:"Timing",TriggerDefinition:"TriggerDefinition",UsageContext:"UsageContext",base64Binary:"base64Binary",boolean:"boolean",canonical:"canonical",code:"code",date:"date",dateTime:"dateTime",decimal:"decimal",id:"id",instant:"instant",integer:"integer",markdown:"markdown",oid:"oid",positiveInt:"positiveInt",string:"string",time:"time",unsignedInt:"unsignedInt",uri:"uri",url:"url",uuid:"uuid"};function Z$(e){for(const t of e.base??[]){let n=Io.types[t];n||(n={searchParamsDetails:{}},Io.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 Y1(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"?eL((i=((o=e.base)==null?void 0:o.path)??e.path)==null?void 0:i.split(".")):t}function eL(e){return e.length===1?e[0]:e.map(Vt).join("")}function Av(e){var t;return(t=Io.types[e])==null?void 0:t.searchParams}function tL(e,t){var n,r;return(r=(n=Io.types[e])==null?void 0:n.searchParams)==null?void 0:r[t]}function as(e){const t=e.replaceAll("[x]","").split(".").pop();return MP(t)}function MP(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(rL).join(" ").replace("_"," ").replace(/\s+/g," ")}const nL=new Set(["ID","IP","PKCE","JWKS","URI","URL","OMB","UDI"]);function rL(e){const t=e.toUpperCase();return e===t?e:nL.has(t)?t:t.charAt(0)+e.slice(1)}function js(e,t,n){const r=Gf(e,n);if(r)return oL(r.elements,t)}function oL(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 Uo(e){return!!(e&&typeof e=="object"&&"resourceType"in e)}function Ps(e){return!!(e&&typeof e=="object"&&"reference"in e&&typeof e.reference=="string")}const Io={types:{}};function ed(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 hl=()=>[],An={empty:(e,t)=>Se(t.length===0||t.every(n=>At(n.value))),hasValue:(e,t)=>Se(t.length!==0),exists:(e,t,n)=>Se(n?t.filter(r=>si(n.eval(e,[r]))).length>0:t.length>0&&t.every(r=>!At(r.value))),all:(e,t,n)=>Se(t.every(r=>si(n.eval(e,[r])))),allTrue:(e,t)=>{for(const n of t)if(!n.value)return Se(!1);return Se(!0)},anyTrue:(e,t)=>{for(const n of t)if(n.value)return Se(!0);return Se(!1)},allFalse:(e,t)=>{for(const n of t)if(n.value)return Se(!1);return Se(!0)},anyFalse:(e,t)=>{for(const n of t)if(!n.value)return Se(!0);return Se(!1)},subsetOf:hl,supersetOf:hl,count:(e,t)=>[{type:V.integer,value:t.length}],distinct:(e,t)=>{const n=[];for(const r of t)n.some(o=>o.value===r.value)||n.push(r);return n},isDistinct:(e,t)=>Se(t.length===An.distinct(e,t).length),where:(e,t,n)=>t.filter(r=>si(n.eval({parent:e,variables:{$this:r}},[r]))),select:(e,t,n)=>t.map(r=>n.eval(e,[r])).flat(),repeat:hl,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 bP([...t,...r])},combine:(e,t,n)=>{if(!n)return t;const r=n.eval(e,t);return[...t,...r]},htmlChecks:(e,t,n)=>[so(!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 si(i)?r.eval(e,t):o?o.eval(e,t):[]},toBoolean:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Xr(t,1);if(typeof n=="boolean")return[{type:V.boolean,value:n}];if(typeof n=="number"&&(n===0||n===1))return Se(!!n);if(typeof n=="string"){const r=n.toLowerCase();if(["true","t","yes","y","1","1.0"].includes(r))return Se(!0);if(["false","f","no","n","0","0.0"].includes(r))return Se(!1)}return[]},convertsToBoolean:(e,t)=>t.length===0?[]:Se(An.toBoolean(e,t).length===1),toInteger:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Xr(t,1);return typeof n=="number"?[{type:V.integer,value:n}]:typeof n=="string"&&/^[+-]?\d+$/.exec(n)?[{type:V.integer,value:parseInt(n,10)}]:typeof n=="boolean"?[{type:V.integer,value:n?1:0}]:[]},convertsToInteger:(e,t)=>t.length===0?[]:Se(An.toInteger(e,t).length===1),toDate:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Xr(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:V.date,value:ed(n)}]:[]},convertsToDate:(e,t)=>t.length===0?[]:Se(An.toDate(e,t).length===1),toDateTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Xr(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:V.dateTime,value:ed(n)}]:[]},convertsToDateTime:(e,t)=>t.length===0?[]:Se(An.toDateTime(e,t).length===1),toDecimal:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Xr(t,1);return typeof n=="number"?[{type:V.decimal,value:n}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?$/.exec(n)?[{type:V.decimal,value:parseFloat(n)}]:typeof n=="boolean"?[{type:V.decimal,value:n?1:0}]:[]},convertsToDecimal:(e,t)=>t.length===0?[]:Se(An.toDecimal(e,t).length===1),toQuantity:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Xr(t,1);return hr(n)?[{type:V.Quantity,value:n}]:typeof n=="number"?[{type:V.Quantity,value:{value:n,unit:"1"}}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?/.exec(n)?[{type:V.Quantity,value:{value:parseFloat(n),unit:"1"}}]:typeof n=="boolean"?[{type:V.Quantity,value:{value:n?1:0,unit:"1"}}]:[]},convertsToQuantity:(e,t)=>t.length===0?[]:Se(An.toQuantity(e,t).length===1),toString:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Xr(t,1);return n==null?[]:hr(n)?[{type:V.string,value:`${n.value} '${n.unit}'`}]:[{type:V.string,value:n.toString()}]},convertsToString:(e,t)=>t.length===0?[]:Se(An.toString(e,t).length===1),toTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=Xr(t,1);if(typeof n=="string"){const r=/^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(n);if(r)return[{type:V.time,value:ed("T"+r[1])}]}return[]},convertsToTime:(e,t)=>t.length===0?[]:Se(An.toTime(e,t).length===1),indexOf:(e,t,n)=>ir((r,o)=>r.indexOf(o),e,t,n),substring:(e,t,n,r)=>ir((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)=>ir((r,o)=>r.startsWith(o),e,t,n),endsWith:(e,t,n)=>ir((r,o)=>r.endsWith(o),e,t,n),contains:(e,t,n)=>ir((r,o)=>r.includes(o),e,t,n),upper:(e,t)=>ir(n=>n.toUpperCase(),e,t),lower:(e,t)=>ir(n=>n.toLowerCase(),e,t),replace:(e,t,n,r)=>ir((o,i,s)=>o.replaceAll(i,s),e,t,n,r),matches:(e,t,n)=>ir((r,o)=>!!new RegExp(o).exec(r),e,t,n),replaceMatches:(e,t,n,r)=>ir((o,i,s)=>o.replaceAll(i,s),e,t,n,r),length:(e,t)=>ir(n=>n.length,e,t),toChars:(e,t)=>ir(n=>n?n.split(""):void 0,e,t),abs:(e,t)=>Qr(Math.abs,e,t),ceiling:(e,t)=>Qr(Math.ceil,e,t),exp:(e,t)=>Qr(Math.exp,e,t),floor:(e,t)=>Qr(Math.floor,e,t),ln:(e,t)=>Qr(Math.log,e,t),log:(e,t,n)=>Qr((r,o)=>Math.log(r)/Math.log(o),e,t,n),power:(e,t,n)=>Qr(Math.pow,e,t,n),round:(e,t)=>Qr(Math.round,e,t),sqrt:(e,t)=>Qr(Math.sqrt,e,t),truncate:(e,t)=>Qr(n=>n|0,e,t),children:hl,descendants:hl,trace:(e,t,n)=>t,now:()=>[{type:V.dateTime,value:new Date().toISOString()}],timeOfDay:()=>[{type:V.time,value:new Date().toISOString().substring(11)}],today:()=>[{type:V.date,value:new Date().toISOString().substring(0,10)}],between:(e,t,n,r,o)=>{var u;const i=An.toDateTime(e,n.eval(e,t));if(i.length===0)throw new Error("Invalid start date");const s=An.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=RP(i[0].value,s[0].value);return[{type:V.Quantity,value:{value:c[l],unit:l}}]},is:(e,t,n)=>{let r="";return n instanceof Nv?r=n.name:n instanceof Mv&&(r=n.left.name+"."+n.right.name),r?t.map(o=>({type:V.boolean,value:TP(o,r)})):[]},not:(e,t)=>An.toBoolean(e,t).map(n=>({type:V.boolean,value:!n.value})),resolve:(e,t)=>t.map(n=>{const r=n.value;let o;if(typeof r=="string")o=r;else if(typeof r=="object"){const i=r;if(i.resource)return so(i.resource);i.reference?o=i.reference:i.type&&i.identifier&&(o=`${i.type}?identifier=${i.identifier.system}|${i.identifier.value}`)}if(o!=null&&o.includes("?")){const[i]=o.split("?");return{type:i,value:{resourceType:i}}}if(o!=null&&o.includes("/")){const[i,s]=o.split("/");return{type:i,value:{resourceType:i,id:s}}}return{type:V.BackboneElement,value:void 0}}).filter(n=>!!n.value),as:(e,t)=>t,type:(e,t)=>t.map(({value:n})=>typeof n=="boolean"?{type:V.BackboneElement,value:{namespace:"System",name:"Boolean"}}:typeof n=="number"?{type:V.BackboneElement,value:{namespace:"System",name:"Integer"}}:Uo(n)?{type:V.BackboneElement,value:{namespace:"FHIR",name:n.resourceType}}:{type:V.BackboneElement,value:null}),conformsTo:(e,t,n)=>{const r=n.eval(e,t)[0].value;if(!r.startsWith("http://hl7.org/fhir/StructureDefinition/"))throw new Error("Expected a StructureDefinition URL");const o=r.replace("http://hl7.org/fhir/StructureDefinition/","");return t.map(i=>{var s;return{type:V.boolean,value:((s=i.value)==null?void 0:s.resourceType)===o}})}};function ir(e,t,n,...r){if(n.length===0)return[];const[{value:o}]=Xr(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(so):[so(i)]}function Qr(e,t,n,...r){if(n.length===0)return[];const[{value:o}]=Xr(n,1),i=hr(o),s=i?o.value:o;if(typeof s!="number")throw new Error("Math function cannot be called with non-number");const l=e(s,...r.map(d=>{var f;return(f=d.eval(t,n)[0])==null?void 0:f.value})),c=i?V.Quantity:n[0].type,u=i?{...o,value:l}:l;return[{type:c,value:u}]}function Xr(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 iL{constructor(t,n){this.original=t,this.child=n}eval(t,n){try{if(n.length>0){const r=[];for(const o of n)r.push(this.child.eval({parent:t,variables:{$this:o}},[o]));return r.flat()}else return this.child.eval(t,[])}catch(r){throw new Error(`FhirPathError on "${this.original}": ${r}`)}}toString(){return this.child.toString()}}class Fs{constructor(t){this.value=t}eval(){return[this.value]}toString(){const t=this.value.value;return typeof t=="string"?`'${t}'`:t.toString()}}class Nv{constructor(t){this.name=t}eval(t,n){const r=this.getVariable(t);if(r)return[r];if(this.name.startsWith("%"))throw new Error(`Undefined variable ${this.name}`);return n.flatMap(o=>this.evalValue(o)).filter(o=>(o==null?void 0:o.value)!==void 0)}getVariable(t){const n=t.variables[this.name];if(n!==void 0)return n;if(t.parent)return this.getVariable(t.parent)}evalValue(t){const n=t.value;if(!(!n||typeof n!="object"))return Uo(n)&&n.resourceType===this.name?t:an(t,this.name)}toString(){return this.name}}class sL{eval(){return[]}toString(){return"{}"}}class aL extends JO{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 Ov extends Fc{constructor(t,n){super("as",t,n)}eval(t,n){return An.ofType(t,this.left.eval(t,n),this.right)}}class Hn extends Fc{}class jr extends Hn{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=hr(i)?i.value:i,c=hr(s)?s.value:s,u=this.impl(l,c);return typeof u=="boolean"?Se(u):hr(i)?[{type:V.Quantity,value:{...i,value:u}}]:[so(u)]}}class lL extends Fc{constructor(t,n){super("&",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n),i=[...r,...o];return i.length>0&&i.every(s=>typeof s.value=="string")?[{type:V.string,value:i.map(s=>s.value).join("")}]:i}}class cL extends Hn{constructor(t,n){super("contains",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return Se(r.some(i=>i.value===o[0].value))}}class uL extends Hn{constructor(t,n){super("in",t,n)}eval(t,n){const r=Ro(this.left.eval(t,n)),o=this.right.eval(t,n);return r?Se(o.some(i=>i.value===r.value)):[]}}class Mv extends Fc{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 $P extends Fc{constructor(t,n){super("|",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return bP([...r,...o])}}class dL extends Hn{constructor(t,n){super("=",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return EP(r,o)}}class fL extends Hn{constructor(t,n){super("!=",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return CP(EP(r,o))}}class hL extends Hn{constructor(t,n){super("~",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return PP(r,o)}}class pL extends Hn{constructor(t,n){super("!~",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return CP(PP(r,o))}}class $v extends Hn{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 Se(TP(r[0],o))}}class mL extends Hn{constructor(t,n){super("and",t,n)}eval(t,n){const r=Ro(this.left.eval(t,n),"boolean"),o=Ro(this.right.eval(t,n),"boolean");return(r==null?void 0:r.value)===!0&&(o==null?void 0:o.value)===!0?Se(!0):(r==null?void 0:r.value)===!1||(o==null?void 0:o.value)===!1?Se(!1):[]}}class gL extends Hn{constructor(t,n){super("or",t,n)}eval(t,n){const r=Ro(this.left.eval(t,n),"boolean"),o=Ro(this.right.eval(t,n),"boolean");return(r==null?void 0:r.value)===!1&&(o==null?void 0:o.value)===!1?Se(!1):r!=null&&r.value||o!=null&&o.value?Se(!0):[]}}class yL extends Hn{constructor(t,n){super("xor",t,n)}eval(t,n){const r=Ro(this.left.eval(t,n),"boolean"),o=Ro(this.right.eval(t,n),"boolean");return!r||!o?[]:Se(r.value!==o.value)}}class vL extends Hn{constructor(t,n){super("implies",t,n)}eval(t,n){const r=Ro(this.left.eval(t,n),"boolean"),o=Ro(this.right.eval(t,n),"boolean");return(o==null?void 0:o.value)===!0||(r==null?void 0:r.value)===!1?Se(!0):!r||!o?[]:Se(!1)}}class Lv{constructor(t,n){this.name=t,this.args=n}eval(t,n){const r=An[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 Fv{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 xL=["year","years","month","months","week","weeks","day","days","hour","hours","minute","minutes","second","seconds","millisecond","milliseconds"];class wL{constructor(t,n,r,o){this.result=[],this.pos={index:0,line:1,column:0},this.markStack=[],this.str=t,this.keywords=n,this.operators=r,this.dateTimeLiterals=!!(o!=null&&o.dateTimeLiterals),this.symbolRegex=(o==null?void 0:o.symbolRegex)??/[$\w%]/}tokenize(){for(;this.pos.index<this.str.length;){const t=this.consumeToken();t&&this.result.push(t)}return this.result}prevToken(){return this.result.slice(-1)[0]}peekToken(){this.mark();const t=this.consumeToken();return this.reset(),t}consumeToken(){this.consumeWhitespace();const t=this.curr();if(!t)return;this.mark();const n=this.peek();return t==="/"&&n==="*"?this.consumeMultiLineComment():t==="/"&&n==="/"?this.consumeSingleLineComment():t==="'"||t==='"'?this.consumeString(t):t==="`"?this.consumeBacktickSymbol():t==="@"?this.consumeDateTime():/\d/.exec(t)?this.consumeNumber():/\w/.exec(t)?this.consumeSymbol():(t==="$"||t==="%")&&/\w/.exec(n)?this.consumeSymbol():this.consumeOperator()}consumeWhitespace(){this.consumeWhile(()=>/\s/.exec(this.curr()))}consumeMultiLineComment(){const t=this.pos.index;return this.consumeWhile(()=>this.curr()!=="*"||this.peek()!=="/"),this.advance(),this.advance(),this.buildToken("Comment",this.str.substring(t,this.pos.index))}consumeSingleLineComment(){return this.buildToken("Comment",this.consumeWhile(()=>this.curr()!==`
84
+ `))}consumeString(t){this.advance();const n=this.buildToken("String",this.consumeWhile(()=>this.prev()==="\\"||this.curr()!==t));return this.advance(),n}consumeBacktickSymbol(){this.advance();const t=this.buildToken("Symbol",this.consumeWhile(()=>this.curr()!=="`"));return this.advance(),t}consumeDateTime(){this.advance();const t=this.pos.index;this.consumeWhile(()=>/[\d-]/.exec(this.curr()));let n=!1,r=!1;this.curr()==="T"&&(n=!0,this.advance(),this.consumeWhile(()=>/[\d:]/.exec(this.curr())),this.curr()==="."&&/\d/.exec(this.peek())&&(this.advance(),this.consumeWhile(()=>/\d/.exec(this.curr()))),this.curr()==="Z"?(r=!0,this.advance()):(this.curr()==="+"||this.curr()==="-")&&(r=!0,this.advance(),this.consumeWhile(()=>/[\d:]/.exec(this.curr()))));let o=this.str.substring(t,this.pos.index);return o.endsWith("T")?o=o.substring(0,o.length-1):!o.startsWith("T")&&n&&!r&&(o+="Z"),this.buildToken("DateTime",o)}consumeNumber(){const t=this.pos.index;let n="Number";return this.consumeWhile(()=>/\d/.exec(this.curr())),this.curr()==="."&&/\d/.exec(this.peek())&&(this.advance(),this.consumeWhile(()=>/\d/.exec(this.curr()))),this.curr()==="-"&&this.dateTimeLiterals?(this.pos.index=t-1,this.consumeDateTime()):(this.curr()===" "&&SL(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 SL(e){return!!(e&&(e.id==="String"||e.id==="Symbol"&&xL.includes(e.value)))}const bL=["true","false"],CL=["!=","!~","<=",">=","{}","->"];function EL(e){return new wL(e,bL,CL).tokenize()}const Je={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},jL={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}},PL={parse(e,t){const n=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new Fv(t,n)},precedence:Je.Indexer},TL={parse(e,t){if(!(t instanceof Nv))throw new Error("Unexpected parentheses");const n=[];for(;!e.match(")");)n.push(e.consumeAndParse()),e.match(",");return new Lv(t.name,n)},precedence:Je.FunctionCall};function kL(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 RL(){return new ZO().registerPrefix("String",{parse:(e,t)=>new Fs({type:V.string,value:t.value})}).registerPrefix("DateTime",{parse:(e,t)=>new Fs({type:V.dateTime,value:ed(t.value)})}).registerPrefix("Quantity",{parse:(e,t)=>new Fs({type:V.Quantity,value:kL(t.value)})}).registerPrefix("Number",{parse:(e,t)=>new Fs({type:t.value.includes(".")?V.decimal:V.integer,value:parseFloat(t.value)})}).registerPrefix("true",{parse:()=>new Fs({type:V.boolean,value:!0})}).registerPrefix("false",{parse:()=>new Fs({type:V.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new Nv(t.value)}).registerPrefix("{}",{parse:()=>new sL}).registerPrefix("(",jL).registerInfix("[",PL).registerInfix("(",TL).prefix("+",Je.UnaryAdd,(e,t)=>new aL("+",t,n=>n)).prefix("-",Je.UnarySubtract,(e,t)=>new jr("-",t,t,(n,r)=>-r)).infixLeft(".",Je.Dot,(e,t,n)=>new Mv(e,n)).infixLeft("/",Je.Divide,(e,t,n)=>new jr("/",e,n,(r,o)=>r/o)).infixLeft("*",Je.Multiply,(e,t,n)=>new jr("*",e,n,(r,o)=>r*o)).infixLeft("+",Je.Add,(e,t,n)=>new jr("+",e,n,(r,o)=>r+o)).infixLeft("-",Je.Subtract,(e,t,n)=>new jr("-",e,n,(r,o)=>r-o)).infixLeft("|",Je.Union,(e,t,n)=>new $P(e,n)).infixLeft("=",Je.Equals,(e,t,n)=>new dL(e,n)).infixLeft("!=",Je.NotEquals,(e,t,n)=>new fL(e,n)).infixLeft("~",Je.Equivalent,(e,t,n)=>new hL(e,n)).infixLeft("!~",Je.NotEquivalent,(e,t,n)=>new pL(e,n)).infixLeft("<",Je.LessThan,(e,t,n)=>new jr("<",e,n,(r,o)=>r<o)).infixLeft("<=",Je.LessThanOrEquals,(e,t,n)=>new jr("<=",e,n,(r,o)=>r<=o)).infixLeft(">",Je.GreaterThan,(e,t,n)=>new jr(">",e,n,(r,o)=>r>o)).infixLeft(">=",Je.GreaterThanOrEquals,(e,t,n)=>new jr(">=",e,n,(r,o)=>r>=o)).infixLeft("&",Je.Ampersand,(e,t,n)=>new lL(e,n)).infixLeft("and",Je.And,(e,t,n)=>new mL(e,n)).infixLeft("as",Je.As,(e,t,n)=>new Ov(e,n)).infixLeft("contains",Je.Contains,(e,t,n)=>new cL(e,n)).infixLeft("div",Je.Divide,(e,t,n)=>new jr("div",e,n,(r,o)=>r/o|0)).infixLeft("in",Je.In,(e,t,n)=>new uL(e,n)).infixLeft("is",Je.Is,(e,t,n)=>new $v(e,n)).infixLeft("mod",Je.Modulo,(e,t,n)=>new jr("mod",e,n,(r,o)=>r%o)).infixLeft("or",Je.Or,(e,t,n)=>new gL(e,n)).infixLeft("xor",Je.Xor,(e,t,n)=>new yL(e,n)).infixLeft("implies",Je.Implies,(e,t,n)=>new vL(e,n))}const _L=RL();function LP(e){return new iL(e,_L.construct(EL(e)).consumeAndParse())}function IL(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]=so(n[r]))}return dc(e,n).map(r=>r.value)}function dc(e,t,n){const r=n??{};return LP(e).eval({variables:r},t).map(i=>{var s;return{type:i.type,value:(s=i.value)==null?void 0:s.valueOf()}})}var Zo=(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))(Zo||{});function Yf(e,t){var r,o;let n=(o=(r=Io.types[e])==null?void 0:r.searchParamsDetails)==null?void 0:o[t.code];return n||(n=AL(e,t)),n}function DL(e,t,n){let r=Io.types[e];r||(r={},Io.types[e]=r),r.searchParamsDetails||(r.searchParamsDetails={}),r.searchParamsDetails[t]=n}function AL(e,t){const n=t.code,r=ML(n),o=LL(e,t.expression),i={elementDefinitions:[],propertyTypes:new Set,array:!1};for(const l of o){const c=Ml(l),u=z$(()=>c.join("."));c.length===1&&c[0]instanceof Hn?i.propertyTypes.add("boolean"):u().endsWith("extension.value.code")||u().endsWith("extension.value.coding.code")?(i.array=!0,i.propertyTypes.add("code")):FP(i,Ml(l),e,1),u().endsWith("extension.valueDateTime")&&(i.array=!1)}const s={columnName:r,type:$L(t,i.propertyTypes),elementDefinitions:i.elementDefinitions,array:i.array};return DL(e,n,s),s}function FP(e,t,n,r){const o=t[r];if(o instanceof Ov){e.propertyTypes.add(o.right.toString());return}if(o instanceof Lv){NL(e,o);return}const i=o.toString(),s=js(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 Fv&&(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;OL(d)&&(d=s.type[0].code),FP(e,t,d,c)}}function NL(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 $v){e.propertyTypes.add(t.args[0].right.toString());return}throw new Error(`Unhandled FHIRPath function: ${t.name}`)}function OL(e){return e==="Element"||e==="BackboneElement"}function ML(e){return e.split("-").reduce((t,n,r)=>t+(r?Vt(n):n),"")}function $L(e,t){switch(e.type){case"date":return t.size===1&&t.has(V.date)?"DATE":"DATETIME";case"number":return"NUMBER";case"quantity":return"QUANTITY";case"reference":return t.has(V.canonical)?"CANONICAL":"REFERENCE";case"token":return t.size===1&&t.has(V.boolean)?"BOOLEAN":"TEXT";default:return"TEXT"}}function LL(e,t){const n=[],r=LP(t);return km(e,r.child,n),n}function km(e,t,n){t instanceof $P?(km(e,t.left,n),km(e,t.right,n)):t.toString().startsWith(e+".")&&n.push(t)}function Ml(e){if(e instanceof Ov||e instanceof Fv)return[Ml(e.left),e].flat();if(e instanceof Hn)return[e];if(e instanceof Mv)return[Ml(e.left),Ml(e.right)].flat();if(e instanceof Lv){if(e.name==="where"&&!(e.args[0]instanceof $v))return[];if(e.name==="last")return[]}return[e]}const Xf=20;var re=(e=>(e.EQUALS="eq",e.NOT_EQUALS="ne",e.GREATER_THAN="gt",e.LESS_THAN="lt",e.GREATER_THAN_OR_EQUALS="ge",e.LESS_THAN_OR_EQUALS="le",e.STARTS_AFTER="sa",e.ENDS_BEFORE="eb",e.APPROXIMATELY="ap",e.CONTAINS="contains",e.EXACT="exact",e.TEXT="text",e.NOT="not",e.ABOVE="above",e.BELOW="below",e.IN="in",e.NOT_IN="not-in",e.OF_TYPE="of-type",e.MISSING="missing",e.IDENTIFIER="identifier",e.ITERATE="iterate",e))(re||{});const zP={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"},zv={eq:"eq",ne:"ne",lt:"lt",le:"le",gt:"gt",ge:"ge",sa:"sa",eb:"eb",ap:"ap"};function FL(e,t){if(!e)throw new Error("Invalid search URL");let n="",r;if(typeof e=="string")if(e.includes("?")){const[s,l]=e.split("?");n=s,r=new URLSearchParams(l)}else n=e;else typeof e=="object"&&(n=e.pathname,r=e.searchParams);let o;n.includes("/")?o=n.split("/").filter(Boolean).pop():o=n;const i=[];if(r&&i.push(...r.entries()),t)for(const[s,l]of Object.entries(t))if(Array.isArray(l))for(const c of l)i.push([s,c]);else i.push([s,l??""]);return zL(o,i)}function zL(e,t){const n={resourceType:e};for(const[r,o]of t)BL(n,r,o);return n}function BL(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!=="_"){if(r==="_has"||t.includes(".")){e.filters=fl(e.filters,{code:t,operator:"eq",value:n});return}switch(r){case"_sort":UL(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=X1(n);o==="iterate"&&(c.modifier="iterate"),e.include=fl(e.include,c);break}case"_revinclude":{const c=X1(n);o==="iterate"&&(c.modifier="iterate"),e.revInclude=fl(e.revInclude,c);break}case"_fields":case"_elements":e.fields=n.split(",");break;case"_type":e.types=n.split(",");break;case"_format":e.format=n;break;case"_pretty":e.pretty=n==="true";break;default:{const c=(l=(s=Io.types[e.resourceType])==null?void 0:s.searchParams)==null?void 0:l[r];c?e.filters=fl(e.filters,VL(c,o,n)):e.filters=fl(e.filters,qL(r,o,n))}}}}function UL(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 VL(e,t,n){if(t==="missing")return{code:e.code,operator:"missing",value:n};switch(e.type){case"number":case"date":case"quantity":return HL(e,n);case"reference":case"string":case"token":case"uri":return WL(e,t,n);default:throw new Error("Unrecognized search parameter type: "+e.type)}}function HL(e,t){const{operator:n,value:r}=GL(t);return{code:e.code,operator:n,value:r}}function WL(e,t,n){return{code:e.code,operator:QL(t),value:n}}function qL(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 zv&&(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 GL(e){const t=e.substring(0,2),n=zv[t];return n?{operator:n,value:e.substring(2)}:{operator:"eq",value:e}}function QL(e){return zP[e]??"eq"}function X1(e){const t=e.split(":");if(t.includes("*"))throw new Me(mi("'*' is not supported as a value for search inclusion parameters"));if(t.length===1)throw new Me(mi(`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 Me(mi(`Invalid include value '${e}'`))}function ra(e){const t=[];return e.fields&&t.push("_fields="+e.fields.join(",")),e.filters&&e.filters.forEach(n=>t.push(KL(n))),e.sortRules&&e.sortRules.length>0&&t.push(YL(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(J1("_include",n))),e.revInclude&&e.revInclude.forEach(n=>t.push(J1("_revinclude",n))),t.length===0?"":(lc(t),"?"+t.join("&"))}function KL(e){const t=e.operator in zP?":"+e.operator:"",n=e.operator!=="eq"&&e.operator in zv?e.operator:"";return`${e.code}${t}=${n}${encodeURIComponent(e.value)}`}function YL(e){return"_sort="+e.map(t=>t.descending?"-"+t.code:t.code).join(",")}function J1(e,t){return e+"="+t.resourceType+":"+t.searchParam+(t.targetType?":"+t.targetType:"")}function XL(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 JL(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 Z1(){const e=new Uint32Array(28);return crypto.getRandomValues(e),O$(e.buffer)}async function ZL(e){return crypto.subtle.digest("SHA-256",new TextEncoder().encode(e))}function BP(){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 UP(e){var o,i,s;const t={};e=ao(e);for(const l of e.entry||[]){((o=l.resource)==null?void 0:o.meta)!==void 0&&(delete l.resource.meta.author,delete l.resource.meta.compartment,delete l.resource.meta.lastUpdated,delete l.resource.meta.project,delete l.resource.meta.versionId);const c=(i=l.resource)==null?void 0:i.id;c&&(t[c]=BP(),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)=>e7(l,c,t),2);return t7(JSON.parse(r))}function e7(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 t7(e){const t=r7(e),{sorted:n,cycles:r}=n7(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 n7(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 VP(e,t){for(const n in e)if(e[n]&&typeof e[n]=="object"){const r=e[n];if(Ps(r)){const o=r.reference;o.startsWith("urn:uuid:")&&t(o)}else VP(r,t)}}function r7(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&&VP(n.resource,o=>{t[o]&&t[o].push(r)})}return t}class HP{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 Kt={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",SCIM_JSON:"application/scim+json",SVG:"image/svg+xml",TEXT:"text/plain",TYPESCRIPT:"text/typescript",PING:"x-application/ping"};class WP{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}removeAllListeners(){this.listeners={}}}class Bv{constructor(){this.emitter=new WP}dispatchEvent(t){this.emitter.dispatchEvent(t)}addEventListener(t,n){this.emitter.addEventListener(t,n)}removeEventListener(t,n){this.emitter.removeEventListener(t,n)}removeAllListeners(){this.emitter.removeAllListeners()}}const Rm={"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"},o7=["Patient","Encounter","ImagingStudy","DiagnosticReport","OperationOutcome","Bundle"],Uv=["DiagnosticReport-update"];function i7(e){return Uv.includes(e)}function s7(e){if(Uv.includes(e))throw new Me(vt(`'context.version' is required for '${e}'.`))}const a7={"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 l7(e){return o7.includes(e)}function qP(e){return!!e.endpoint}function ew(e){if(!Vv(e))throw new Me(vt("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 qP(e)&&(i.endpoint=e.endpoint),new URLSearchParams(i).toString()}function Vv(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(!Rm[i])return!1;return!(qP(e)&&!(typeof e.endpoint=="string"&&e.endpoint.startsWith("ws")))}function tw(e,t,n,r){if(typeof t!="object")throw new Me(vt(`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 Me(vt(`context[${n}] is invalid. Resource must contain a valid string ID.`));if(!t.resourceType)throw new Me(vt(`context[${n}] is invalid. Resource must contain a resource type. No resource type found.`));const o=r.resourceType;if(o!=="*"){if(!l7(t.resourceType))throw new Me(vt(`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 Me(vt(`context[${n}] is invalid. context[${n}] for the '${e}' event should contain resource of type ${o}.`))}}function c7(e,t,n,r,o){if(o.set(t.key,(o.get(t.key)??0)+1),!r.isArray)tw(e,t.resource,n,r);else{const{resources:i}=t;if(!i)throw new Me(vt(`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)tw(e,s,n,r)}}function u7(e,t){const n=new Map,r=a7[e];for(let o=0;o<t.length;o++){const i=t[o].key;if(!r[i])throw new Me(vt(`Key '${i}' not found for event '${e}'. Make sure to add only valid keys.`));c7(e,t[o],o,r[i],n)}for(const[o,i]of Object.entries(r)){if(!(i.optional||n.has(o)))throw new Me(vt(`Missing required key '${o}' on context for '${e}' event.`));if(!i.manyAllowed&&(n.get(o)||0)>1)throw new Me(vt(`${n.get(o)} context entries with key '${o}' found for the '${e}' event when schema only allows for 1.`))}}function nw(e,t,n,r){if(!(e&&typeof e=="string"))throw new Me(vt("Must provide a topic."));if(!Rm[t])throw new Me(vt(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(Rm).join(", ")}`));if(typeof n!="object")throw new Me(vt("context must be a context object or array of context objects."));if(Uv.includes(t)&&!r)throw new Me(vt(`The '${t}' event must contain a 'context.versionId'.`));const o=Array.isArray(n)?n:[n];return u7(t,o),{timestamp:new Date().toISOString(),id:BP(),event:{"hub.topic":e,"hub.event":t,context:o,...r?{"context.versionId":r}:{}}}}class d7 extends Bv{constructor(t){if(super(),this.subRequest=t,!t.endpoint)throw new Me(vt("Subscription request should contain an endpoint."));if(!Vv(t))throw new Me(vt("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 f7(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=XL(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 h7(e){return e.split(".").length===3}function Hv(e){const[t,n,r]=e.split(".");return f7(n)}function p7(e){try{return typeof Hv(e).login_id=="string"}catch{return!1}}function m7(e){try{const n=Hv(e).exp;return typeof n=="number"?n*1e3:void 0}catch{return}}class g7{constructor(t){this.medplum=t}async get(t){return this.medplum.get(`keyvalue/v1/${t}`)}async set(t,n){await this.medplum.put(`keyvalue/v1/${t}`,n)}async delete(t){await this.medplum.delete(`keyvalue/v1/${t}`)}}var rw;class Pr{constructor(t){this[rw]="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)}}rw=Symbol.toStringTag;class y7{constructor(t){this.storage=t??(typeof localStorage<"u"?localStorage:new v7)}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?er(n):void 0)}}class v7{constructor(){this.data=new Map}get length(){return this.data.size}clear(){this.data.clear()}getItem(t){return this.data.get(t)??null}setItem(t,n){n?this.data.set(t,n):this.data.delete(t)}removeItem(t){this.data.delete(t)}key(t){return Array.from(this.data.keys())[t]}}class x7 extends Bv{constructor(t){super(),this.bufferedAmount=-1/0,this.extensions="NOT_IMPLEMENTED",this.messageBuffer=[];const n=new WebSocket(t);n.addEventListener("open",()=>{if(this.messageBuffer.length){const r=this.messageBuffer;for(const o of r)n.send(o)}this.dispatchEvent(new Event("open"))}),n.addEventListener("error",r=>{this.dispatchEvent(r)}),n.addEventListener("message",r=>{this.dispatchEvent(r)}),n.addEventListener("close",r=>{this.dispatchEvent(r)}),this.ws=n}get readyState(){return this.ws.readyState}close(){this.ws.close()}send(t){if(this.ws.readyState!==WebSocket.OPEN){this.messageBuffer.push(t);return}try{this.ws.send(t)}catch(n){this.dispatchEvent(new ErrorEvent("error",{error:n,message:n.message})),this.messageBuffer.push(t)}}}class _m extends Bv{constructor(...t){super(),this.criteria=new Set(t)}getCriteria(){return this.criteria}_addCriteria(t){this.criteria.add(t)}_removeCriteria(t){this.criteria.delete(t)}}class w7{constructor(t){this.criteria=t,this.emitter=new _m(t),this.refCount=1}}class S7{constructor(t,n,r){if(!(t instanceof GP))throw new Me(vt("First arg of constructor should be a `MedplumClient`"));let o;try{o=new URL(n).toString()}catch{throw new Me(vt("Not a valid URL"))}const i=r!=null&&r.RobustWebSocket?new r.RobustWebSocket(o):new x7(o);this.medplum=t,this.ws=i,this.masterSubEmitter=new _m,this.criteriaEntries=new Map,this.criteriaEntriesBySubscriptionId=new Map,this.wsClosed=!1,this.setupWebSocketListeners()}setupWebSocketListeners(){const t=this.ws;t.addEventListener("message",n=>{var r,o,i,s,l;try{const c=JSON.parse(n.data),u=(o=(r=c==null?void 0:c.entry)==null?void 0:r[0])==null?void 0:o.resource;if(u.type==="heartbeat"){(i=this.masterSubEmitter)==null||i.dispatchEvent({type:"heartbeat",payload:c});return}(s=this.masterSubEmitter)==null||s.dispatchEvent({type:"message",payload:c});const d=this.criteriaEntriesBySubscriptionId.get(Qf(u.subscription));if(!d){console.warn("Received notification for criteria the SubscriptionManager is not listening for");return}d.emitter.dispatchEvent({type:"message",payload:c})}catch(c){console.error(c);const u={type:"error",payload:c};(l=this.masterSubEmitter)==null||l.dispatchEvent(u);for(const{emitter:d}of this.criteriaEntries.values())d.dispatchEvent(u)}}),t.addEventListener("error",()=>{var r;const n={type:"error",payload:new Me(uM(new Error("WebSocket error")))};(r=this.masterSubEmitter)==null||r.dispatchEvent(n);for(const{emitter:o}of this.criteriaEntries.values())o.dispatchEvent(n)}),t.addEventListener("close",()=>{var r;const n={type:"close"};this.wsClosed&&((r=this.masterSubEmitter)==null||r.dispatchEvent(n));for(const{emitter:o}of this.criteriaEntries.values())o.dispatchEvent(n)})}emitConnect(t){var r;const n={type:"connect",payload:{subscriptionId:t}};(r=this.masterSubEmitter)==null||r.dispatchEvent(n);for(const{emitter:o}of this.criteriaEntries.values())o.dispatchEvent(n)}emitError(t,n){var o,i,s;const r={type:"error",payload:n};(o=this.masterSubEmitter)==null||o.dispatchEvent(r),(s=(i=this.criteriaEntries.get(t))==null?void 0:i.emitter)==null||s.dispatchEvent(r)}async getTokenForCriteria(t){var s,l;let n=t==null?void 0:t.subscriptionId;n||(n=(await this.medplum.createResource({resourceType:"Subscription",status:"active",reason:`WebSocket subscription for ${ht(this.medplum.getProfile())}`,criteria:t.criteria,channel:{type:"websocket"}})).id);const{parameter:r}=await this.medplum.get(`fhir/R4/Subscription/${n}/$get-ws-binding-token`),o=(s=r==null?void 0:r.find(c=>c.name==="token"))==null?void 0:s.valueString,i=(l=r==null?void 0:r.find(c=>c.name==="websocket-url"))==null?void 0:l.valueUrl;if(!o)throw new Me(vt("Failed to get token"));if(!i)throw new Me(vt("Failed to get URL from $get-ws-binding-token"));return[n,o]}addCriteria(t){this.masterSubEmitter&&this.masterSubEmitter._addCriteria(t);const n=this.criteriaEntries.get(t);if(n)return n.refCount+=1,n.emitter;const r=new w7(t);return this.criteriaEntries.set(t,r),this.getTokenForCriteria(r).then(([o,i])=>{r.subscriptionId=o,this.criteriaEntriesBySubscriptionId.set(o,r),this.emitConnect(o),this.ws.send(JSON.stringify({type:"bind-with-token",payload:{token:i}}))}).catch(o=>{console.error(o.message),this.emitError(t,o),this.criteriaEntries.delete(t)}),r.emitter}removeCriteria(t){var i,s,l;const n=this.criteriaEntries.get(t);if(!n){console.warn("Criteria not known to `SubscriptionManager`. Possibly called remove too many times.");return}if(n.refCount-=1,n.refCount>0)return;const r=(i=this.criteriaEntries.get(t))==null?void 0:i.subscriptionId,o={type:"disconnect",payload:{subscriptionId:r}};this.masterSubEmitter&&(this.masterSubEmitter._removeCriteria(t),this.masterSubEmitter.dispatchEvent(o)),(l=(s=this.criteriaEntries.get(t))==null?void 0:s.emitter)==null||l.dispatchEvent(o),this.criteriaEntries.delete(t),r&&this.criteriaEntriesBySubscriptionId.delete(r)}closeWebSocket(){this.wsClosed||(this.wsClosed=!0,this.ws.close())}getCriteriaCount(){return this.criteriaEntries.size}getMasterEmitter(){return this.masterSubEmitter||(this.masterSubEmitter=new _m(...Array.from(this.criteriaEntries.keys()))),this.masterSubEmitter}}const b7="3.1.1-5c643b5a7",C7=Kt.FHIR_JSON+", */*; q=0.1",E7="https://api.medplum.com/",j7=1e3,P7=6e4,T7=0,k7="Binary/",ow={resourceType:"Device",id:"system",deviceName:[{type:"model-name",name:"System"}]};class GP extends WP{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");this.options=t??{},this.fetch=(t==null?void 0:t.fetch)??R7(),this.storage=(t==null?void 0:t.storage)??new y7,this.createPdfImpl=t==null?void 0:t.createPdf,this.baseUrl=DP((t==null?void 0:t.baseUrl)??E7),this.fhirBaseUrl=po(this.baseUrl,(t==null?void 0:t.fhirUrlPath)??"fhir/R4"),this.authorizeUrl=po(this.baseUrl,(t==null?void 0:t.authorizeUrl)??"oauth2/authorize"),this.tokenUrl=po(this.baseUrl,(t==null?void 0:t.tokenUrl)??"oauth2/token"),this.logoutUrl=po(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"?T7:P7),this.cacheTime>0?this.requestCache=new HP((t==null?void 0:t.resourceCacheSize)??j7):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.storage.getInitPromise===void 0?(t!=null&&t.accessToken||this.attemptResumeActiveLogin().catch(console.error),this.initPromise=Promise.resolve()):(this.initComplete=!1,this.initPromise=this.storage.getInitPromise(),this.initPromise.then(()=>{t!=null&&t.accessToken||this.attemptResumeActiveLogin().catch(console.error),this.initComplete=!0}).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=po(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 Pr(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,Kt.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(po(this.fhirBaseUrl,t.join("/")))}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 Pr((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 Pr(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 Pr(this.search(t,n,r).then(sp));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 sp(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 ow;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 Pr(Promise.reject(new Error("Missing reference")));if(r==="system")return new Pr(Promise.resolve(ow));const[o,i]=r.split("/");return!o||!i?new Pr(Promise.reject(new Error("Invalid reference"))):this.readResource(o,i,n)}requestSchema(t){if(vP(t))return Promise.resolve();const n=t+"-requestSchema",r=this.getCacheEntry(n,void 0);if(r)return r.value;const o=new Pr((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);B1(s.data.StructureDefinitionList);for(const l of s.data.SearchParameterList)Z$(l)})());return this.setCacheEntry(n,o),o}requestProfileSchema(t,n){if(!(n!=null&&n.expandProfile)&&Rv(t))return Promise.resolve([t]);const r=t+"-requestSchema"+(n!=null&&n.expandProfile?"-nested":""),o=this.getCacheEntry(r,void 0);if(o)return o.value;const i=new Pr((async()=>{if(n!=null&&n.expandProfile){const s=this.fhirUrl("StructureDefinition","$expand-profile");s.search=new URLSearchParams({url:t}).toString();const l=await this.post(s.toString(),{});return sp(l).map(c=>(yP(c,c.url),c.url))}else{const s=await this.searchOne("StructureDefinition",{url:t,_sort:"-_lastUpdated"});return s?(B1([s],t),[t]):(console.warn(`No StructureDefinition found for ${t}!`),[])}})());return this.setCacheEntry(r,i),i}readHistory(t,n,r){return this.get(this.fhirUrl(t,n,"_history"),r)}readVersion(t,n,r,o){return this.get(this.fhirUrl(t,n,"_history",r),o)}readPatientEverything(t,n){return this.get(this.fhirUrl("Patient",t,"$everything"),n)}createResource(t,n){if(!t.resourceType)throw new Error("Missing resourceType");return this.invalidateSearches(t.resourceType),this.post(this.fhirUrl(t.resourceType),t,void 0,n)}async createResourceIfNoneExist(t,n,r){return await this.searchOne(t.resourceType,n,r)??this.createResource(t,r)}async createAttachment(t,n,r,o,i){const s=aw(t,n,r,o),l=i??(typeof n=="object"?n:{}),c=await this.createBinary(s,l);return{contentType:s.contentType,url:c.url,title:s.filename}}createBinary(t,n,r,o,i){const s=aw(t,n,r,o),l=i??(typeof n=="object"?n:{}),{data:c,contentType:u,filename:d,securityContext:f,onProgress:h}=s,m=this.fhirUrl("Binary");return d&&m.searchParams.set("_filename",d),f!=null&&f.reference&&this.setRequestHeader(l,"X-Security-Context",f.reference),h?this.uploadwithProgress(m,c,u,h,l):this.post(m,c,u,l)}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)};if(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 Me(at(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"),i!=null&&i.headers){const h=i.headers;for(const[m,g]of Object.entries(h))c.setRequestHeader(m,g)}c.send(n)})}async createPdf(t,n,r,o){if(!this.createPdfImpl)throw new Error("PDF creation not enabled");const i=D7(t,n,r,o),s=typeof n=="object"?n:{},{docDefinition:l,tableLayouts:c,fonts:u,...d}=i,f=await this.createPdfImpl(l,c,u),h={...d,data:f,contentType:"application/pdf"};return this.createBinary(h,s)}createComment(t,n,r){const o=this.getProfile();let i,s;return t.resourceType==="Encounter"&&(i=ft(t),s=t.subject),t.resourceType==="ServiceRequest"&&(i=t.encounter,s=t.subject),t.resourceType==="Patient"&&(s=ft(t)),this.createResource({resourceType:"Communication",status:"completed",basedOn:[ft(t)],encounter:i,subject:s,sender:o?ft(o):void 0,sent:new Date().toISOString(),payload:[{contentString:n}]},r)}async updateResource(t,n){if(!t.resourceType)throw new Error("Missing resourceType");if(!t.id)throw new Error("Missing id");let r=await this.put(this.fhirUrl(t.resourceType,t.id),t,void 0,n);return r||(r=t),this.cacheResource(r),this.invalidateUrl(this.fhirUrl(t.resourceType,t.id,"_history")),this.invalidateSearches(t.resourceType),r}patchResource(t,n,r,o){return this.invalidateSearches(t),this.patch(this.fhirUrl(t,n),r,o)}deleteResource(t,n,r){return this.deleteCacheEntry(this.fhirUrl(t,n).toString()),this.invalidateSearches(t),this.delete(this.fhirUrl(t,n),r)}validateResource(t,n){return this.post(this.fhirUrl(t.resourceType,"$validate"),t,void 0,n)}executeBot(t,n,r,o){let i;if(typeof t=="string"){const s=t;i=this.fhirUrl("Bot",s,"$execute")}else{const s=t;i=this.fhirUrl("Bot","$execute"),i.searchParams.set("identifier",s.system+"|"+s.value)}return this.post(i,n,r,o)}executeBatch(t,n){return this.post(this.fhirBaseUrl,t,void 0,n)}sendEmail(t,n){return this.post("email/v1/send",t,Kt.JSON,n)}graphql(t,n,r,o){return this.post(this.fhirUrl("$graphql"),{query:t,operationName:n,variables:r},Kt.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",Qf(t),"$push"),{destination:typeof n=="string"?n:ht(n),body:r,contentType:o,waitForResponse:i},Kt.FHIR_JSON,s)}getActiveLogin(){return this.storage.getObject("activeLogin")}async setActiveLogin(t){var n,r;(!((n=this.sessionDetails)!=null&&n.profile)||ht(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=m7(t),this.medplumServer=p7(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.isInitialized||!!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();r.startsWith(k7)&&(t=this.fhirUrl(r));let o=n.headers;return o||(o={},n.headers=o),o.Accept||(o.Accept="*/*"),this.addFetchOptionsDefaults(n),(await this.fetchWithRetry(t.toString(),n)).blob()}async createMedia(t,n){const{additionalFields:r,...o}=t,i=await this.createResource({resourceType:"Media",status:"preparation",content:{contentType:t.contentType},...r});o.securityContext||(o.securityContext=ft(i));const s=await this.createAttachment(o,n);return this.updateResource({...i,status:"completed",content:s})}async uploadMedia(t,n,r,o,i){return this.createMedia({data:t,contentType:n,filename:r,additionalFields:o},i)}async bulkExport(t="",n,r,o){const i=t&&`${t}/`,s=this.fhirUrl(`${i}$export`);return n&&s.searchParams.set("_type",n),r&&s.searchParams.set("_since",r),this.startAsyncRequest(s.toString(),o)}async startAsyncRequest(t,n={}){this.addFetchOptionsDefaults(n);const r=n.headers;return r.Prefer="respond-async",this.request("POST",t,n)}get keyValue(){return this.keyValueClient||(this.keyValueClient=new g7(this)),this.keyValueClient}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 Pr(Promise.resolve(t)))}deleteCacheEntry(t){this.requestCache&&this.requestCache.delete(t)}async request(t,n,r={},o={}){await this.refreshIfExpired(),r.method=t,this.addFetchOptionsDefaults(r);const i=await this.fetchWithRetry(n,r);if(i.status===401)return this.handleUnauthenticated(t,n,r);if(i.status===204||i.status===304)return;const s=i.headers.get("content-type"),l=s==null?void 0:s.includes("json");if(i.status===404&&!l)throw new Me(cM);const c=await this.parseBody(i,l);if(i.status===200&&r.followRedirectOnOk||i.status===201&&r.followRedirectOnCreated){const u=await sw(i,c);if(u)return this.request("GET",u,{...r,body:void 0})}if(i.status===202&&r.pollStatusOnAccepted){const d=await sw(i,c)??o.statusUrl;if(d)return this.pollStatus(d,r,o)}if(i.status>=400)throw new Me(at(c));return c}async parseBody(t,n){let r;if(n)try{r=await t.json()}catch(o){throw console.error("Error parsing response",t.status,o),o}else r=await t.text();return r}async fetchWithRetry(t,n){t.startsWith("http")||(t=po(this.baseUrl,t));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 K1(o)}return i}logRequest(t,n){if(console.log(`> ${n.method} ${t}`),n.headers){const r=n.headers;for(const o of lc(Object.keys(r)))console.log(`> ${o}: ${r[o]}`)}}logResponse(t){console.log(`< ${t.status} ${t.statusText}`),t.headers&&t.headers.forEach((n,r)=>console.log(`< ${r}: ${n}`))}async pollStatus(t,n,r){const o={...n,method:"GET",body:void 0,redirect:"follow"};if(r.pollCount===void 0)n.headers&&typeof n.headers=="object"&&"Prefer"in n.headers&&(o.headers={...n.headers},delete o.headers.Prefer),r.statusUrl=t,r.pollCount=1;else{const i=n.pollStatusPeriod??1e3;await K1(i),r.pollCount++}return this.request("GET",t,o,r)}async executeAutoBatch(){var o,i;const t=[...this.autoBatchQueue];if(this.autoBatchQueue.length=0,this.autoBatchTimerId=void 0,t.length===1){const s=t[0];try{s.resolve(await this.request(s.method,po(this.fhirBaseUrl,s.url),s.options))}catch(l){s.reject(new Me(at(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,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&&!hP(c.response.outcome)?l.reject(new Me(c.response.outcome)):l.resolve(c==null?void 0:c.resource)}}addFetchOptionsDefaults(t){this.setRequestHeader(t,"X-Medplum","extended"),this.setRequestHeader(t,"Accept",C7,!0),t.body&&this.setRequestHeader(t,"Content-Type",Kt.FHIR_JSON,!0),this.accessToken?this.setRequestHeader(t,"Authorization","Bearer "+this.accessToken):this.basicAuth&&this.setRequestHeader(t,"Authorization","Basic "+this.basicAuth),t.cache||(t.cache="no-cache"),t.credentials||(t.credentials="include")}setRequestContentType(t,n){this.setRequestHeader(t,"Content-Type",n)}setRequestHeader(t,n,r,o=!1){t.headers||(t.headers={});const i=t.headers;o&&i[n]||(i[n]=r)}setRequestBody(t,n){typeof n=="string"||typeof Blob<"u"&&(n instanceof Blob||n.constructor.name==="Blob")||typeof File<"u"&&(n instanceof File||n.constructor.name==="File")||typeof Uint8Array<"u"&&(n instanceof Uint8Array||n.constructor.name==="Uint8Array")?t.body=n:n&&(t.body=JSON.stringify(n))}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=Z1();sessionStorage.setItem("pkceState",t);const n=Z1();sessionStorage.setItem("codeVerifier",n);const r=await ZL(n),o=M$(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??iw()),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)??iw()),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=JL(t+":"+n)}async fhircastSubscribe(t,n){if(!(typeof t=="string"&&t!==""))throw new Me(vt("Invalid topic provided. Topic must be a valid string."));if(!(typeof n=="object"&&Array.isArray(n)&&n.length>0))throw new Me(vt("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",ew(r),Kt.FORM_URL_ENCODED))["hub.channel.endpoint"];if(!i)throw new Error("Invalid response!");return r.endpoint=i,r}async fhircastUnsubscribe(t){if(!Vv(t))throw new Me(vt("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));if(!(t.endpoint&&typeof t.endpoint=="string"&&t.endpoint.startsWith("ws")))throw new Me(vt("Provided subscription request must have an endpoint in order to unsubscribe."));t.mode="unsubscribe",await this.post("/fhircast/STU3",ew(t),Kt.FORM_URL_ENCODED)}fhircastConnect(t){return new d7(t)}async fhircastPublish(t,n,r,o){return i7(n)?this.post(`/fhircast/STU3/${t}`,nw(t,n,r,o),Kt.JSON):(s7(n),this.post(`/fhircast/STU3/${t}`,nw(t,n,r),Kt.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":Kt.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 Me(mi(s.error_description))}catch(s){throw new Me(mi("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(h7(n)){const r=Hv(n);if(Date.now()>=r.exp*1e3)throw this.clearActiveLogin(),new Error("Token expired");if(r.cid){if(r.cid!==this.clientId)throw this.clearActiveLogin(),new Error("Token was not issued for this audience")}else if(this.clientId&&r.client_id!==this.clientId)throw this.clearActiveLogin(),new Error("Token was not issued for this audience")}return this.setActiveLogin({accessToken:n,refreshToken:t.refresh_token,project:t.project,profile:t.profile})}setupStorageListener(){try{window.addEventListener("storage",t=>{(t.key===null||t.key==="activeLogin")&&window.location.reload()})}catch{}}retryCatch(t,n,r){if(r.message==="Failed to fetch"&&t===1&&this.dispatchEvent({type:"offline"}),t>=n-1)throw r}getSubscriptionManager(){return this.subscriptionManager||(this.subscriptionManager=new S7(this,U$(this.baseUrl,"/ws/subscriptions-r4"))),this.subscriptionManager}subscribeToCriteria(t){return this.getSubscriptionManager().addCriteria(t)}unsubscribeFromCriteria(t){this.subscriptionManager&&(this.subscriptionManager.removeCriteria(t),this.subscriptionManager.getCriteriaCount()===0&&this.subscriptionManager.closeWebSocket())}getMasterSubscriptionEmitter(){return this.getSubscriptionManager().getMasterEmitter()}}function R7(){if(!globalThis.fetch)throw new Error("Fetch not available in this environment");return globalThis.fetch.bind(globalThis)}function iw(){return typeof window>"u"?"":window.location.protocol+"//"+window.location.host+"/"}async function sw(e,t){var o,i;const n=e.headers.get("content-location");if(n)return n;const r=e.headers.get("location");if(r)return r;if(qf(t)&&((i=(o=t.issue)==null?void 0:o[0])!=null&&i.diagnostics))return t.issue[0].diagnostics}function sp(e){var n;const t=((n=e.entry)==null?void 0:n.map(r=>r.resource))??[];return Object.assign(t,{bundle:e})}function _7(e){return pn(e)&&"data"in e&&"contentType"in e}function aw(e,t,n,r){return _7(e)?e:{data:e,filename:t,contentType:n,onProgress:r}}function I7(e){return pn(e)&&"docDefinition"in e}function D7(e,t,n,r){return I7(e)?e:{docDefinition:e,filename:t,tableLayouts:n,fonts:r}}function _a({parentContext:e,path:t,elements:n,profileUrl:r,debugMode:o}){if(t===(e==null?void 0:e.path))return;const i=A7(t,n,e,!!o),s=Object.create(null);for(const[l,c]of Object.entries(i))s[t+"."+l]=c;return{path:t,elements:i,elementsByPath:s,profileUrl:r??(e==null?void 0:e.profileUrl),debugMode:o??(e==null?void 0:e.debugMode)??!1}}function A7(e,t,n,r){const o=Object.create(null);if(n)for(const[s,l]of Object.entries(n.elementsByPath)){const c=ac(e,s);c!==void 0&&(o[c]=l)}let i=!1;if(t)for(const[s,l]of Object.entries(t))s in o||(o[s]=l,i=!0);return r&&console.assert(i,"Unnecessary ElementsContext; not using any newly provided elements"),o}function QP(e){return e.type!==void 0&&e.type.length>0}function N7(e,t,n,r){var i;const o=d$(e,t.path,{profileUrl:r});if(o){const s=((i=n.typeSchema)==null?void 0:i.elements)??n.elements;return o.some(l=>m$(l,t,n,s))??!1}return console.assert(!1,"getNestedProperty[%s] in isDiscriminatorComponentMatch missed",t.path),!1}function KP(e,t,n,r){var o,i;if(e)for(const s of t){const l={value:e,type:((o=s.typeSchema)==null?void 0:o.name)??((i=s.type)==null?void 0:i[0].code)};if(n.every(c=>{var u;return N7(l,c,s,((u=s.typeSchema)==null?void 0:u.url)??r)}))return s.name}}class O7{constructor(t,n,r){if(t.type===void 0)throw new Error("schema must include a type");this.rootSchema=t;const o=_a({parentContext:void 0,path:this.rootSchema.type,elements:r??this.rootSchema.elements,profileUrl:this.rootSchema.name===this.rootSchema.type?void 0:this.rootSchema.url});if(o===void 0)throw new Error("Could not create root elements context");this.elementsContextStack=[o],this.visitor=n}get elementsContext(){return this.elementsContextStack[this.elementsContextStack.length-1]}crawlElement(t,n,r){this.visitor.onEnterSchema&&this.visitor.onEnterSchema(this.rootSchema);const o=Object.fromEntries(Object.entries(this.elementsContext.elements).filter(([i])=>i.startsWith(n)));this.crawlElementsImpl(o,r),this.visitor.onExitSchema&&this.visitor.onExitSchema(this.rootSchema)}crawlSlice(t,n,r){const o=this.prepareSlices(r.slices,r);if(!Dt(o.slices))throw new Error(`cannot crawl slice ${n.name} since it has no type information`);this.visitor.onEnterSchema&&this.visitor.onEnterSchema(this.rootSchema),this.sliceAllowList=[n],this.crawlSliceImpl(o.slices[0],n.path,o),this.sliceAllowList=void 0,this.visitor.onExitSchema&&this.visitor.onExitSchema(this.rootSchema)}crawlResource(){this.visitor.onEnterSchema&&this.visitor.onEnterSchema(this.rootSchema),this.crawlElementsImpl(this.rootSchema.elements,this.rootSchema.type),this.visitor.onExitSchema&&this.visitor.onExitSchema(this.rootSchema)}crawlElementsImpl(t,n){const r=M7(t);for(const o of r)this.crawlElementNode(o,n)}crawlElementNode(t,n){var o,i;const r=n+"."+t.key;this.visitor.onEnterElement&&this.visitor.onEnterElement(r,t.element,this.elementsContext);for(const s of t.children)this.crawlElementNode(s,n);Dt((i=(o=t.element)==null?void 0:o.slicing)==null?void 0:i.slices)&&this.crawlSlicingImpl(t.element.slicing,r),this.visitor.onExitElement&&this.visitor.onExitElement(r,t.element,this.elementsContext)}prepareSlices(t,n){var i,s;const r=[];for(const l of t){if(!QP(l))continue;const c=(s=(i=l.type.find(u=>Dt(u.profile)))==null?void 0:i.profile)==null?void 0:s[0];if(Dt(c)){const u=Cs(c);u&&(l.typeSchema=u)}r.push(l)}return{...n,slices:r}}crawlSlicingImpl(t,n){const r=this.prepareSlices(t.slices,t);for(const o of r.slices)(this.sliceAllowList===void 0||this.sliceAllowList.includes(o))&&this.crawlSliceImpl(o,n,r)}crawlSliceImpl(t,n,r){const o=t.typeSchema;o&&this.visitor.onEnterSchema&&this.visitor.onEnterSchema(o),this.visitor.onEnterSlice&&this.visitor.onEnterSlice(n,t,r);let i;const s=(o==null?void 0:o.elements)??t.elements;Dt(s)&&(i=_a({path:n,parentContext:this.elementsContext,elements:s})),i&&this.elementsContextStack.push(i),this.crawlElementsImpl(s,n),i&&this.elementsContextStack.pop(),this.visitor.onExitSlice&&this.visitor.onExitSlice(n,t,r),o&&this.visitor.onExitSchema&&this.visitor.onExitSchema(o)}}function M7(e){const t=[];function n(i,s){return s.startsWith(i+".")}function r(i,s){for(const l of i.children)if(n(l.key,s.key)){r(l,s);return}i.children.push(s)}const o=Object.entries(e);o.sort((i,s)=>i[0].localeCompare(s[0]));for(const[i,s]of o){const l={key:i,element:s,children:[]};let c=!1;for(const u of t)if(n(u.key,i)){r(u,l),c=!0;break}c||t.push(l)}return t}const ap="__sliceName";function $7(e,t){const n=new L7(e,e.resourceType,"resource");return new O7(t,n).crawlResource(),n.getDefaultValue()}function lw(e,t,n){for(const[r,o]of Object.entries(t)){if(n===void 0||n===r){Md(e,r,o,t);continue}const i=ac(n,r);i!==void 0&&Md(e,i,o,t)}return e}class L7{constructor(t,n,r){this.schemaStack=[],this.valueStack=[],this.rootValue=ao(t),this.valueStack.splice(0,this.valueStack.length,{type:r,path:n,values:[this.rootValue]})}get schema(){return this.schemaStack[this.schemaStack.length-1]}get value(){return this.valueStack[this.valueStack.length-1]}onEnterSchema(t){this.schemaStack.push(t)}onExitSchema(){this.schemaStack.pop()}onEnterElement(t,n,r){const o=this.value.values,i=this.value.path,s=ac(i,t);if(s===void 0)throw new Error(`Expected ${t} to be prefixed by ${i}`);const l=[];for(const c of o){if(c===void 0)continue;const u=Array.isArray(c)?c:[c];for(const d of u){F7(d,s,n,r.elements),Md(d,s,n,r.elements);const f=Dm(d,s,n,r.elements);f!==void 0&&l.push(f)}}this.valueStack.push({type:"element",path:t,values:l})}onExitElement(t,n,r){if(!this.valueStack.pop())throw new Error("Expected value context to exist when exiting element");const i=ac(this.value.path,t);if(i===void 0)throw new Error(`Expected ${t} to be prefixed by ${this.value.path}`);for(const s of this.value.values){const l=Dm(s,i,n,r.elements);if(Array.isArray(l))for(let c=l.length-1;c>=0;c--){const u=l[c];Dt(u)||l.splice(c,1)}At(l)&&Im(s,void 0,i,n)}}onEnterSlice(t,n,r){const o=this.value.values,i=[];for(const s of o){if(s===void 0)continue;if(!Array.isArray(s))throw new Error("Expected array value for sliced element");const l=this.getMatchingSliceValues(s,n,r);i.push(l)}this.valueStack.push({type:"slice",path:t,values:i})}getMatchingSliceValues(t,n,r){const o=[];for(const i of t)(i[ap]??KP(i,[n],r.discriminator,this.schema.url))===n.name&&o.push(i);for(let i=o.length;i<n.min;i++)if(Dv(n.type[0].code)){const s=Object.create(null);o.push(s),t.push(s)}return o}onExitSlice(){const t=this.valueStack.pop();if(!t)throw new Error("Expected value context to exist in onExitSlice");for(const n of t.values)for(let r=n.length-1;r>=0;r--){const o=n[r];ap in o&&delete o[ap]}}getDefaultValue(){return this.rootValue}}function F7(e,t,n,r){const o=Dm(e,t,n,r);n.min>0&&o===void 0&&Dv(n.type[0].code)&&(n.isArray?Im(e,[Object.create(null)],t,n):Im(e,Object.create(null),t,n))}function Im(e,t,n,r){if(n.includes("."))throw new Error("key cannot be nested");let o=n;if(n.includes("[x]")){const i=r.type[0].code;o=n.replace("[x]",Vt(i))}t===void 0?delete e[o]:e[o]=t}function Dm(e,t,n,r){const o=t.split(".");let i=e,s;for(let l=0;l<o.length;l++){let c=o[l];if(c.includes("[x]")){const d=r[o.slice(0,l+1).join(".")].type[0].code;c=c.replace("[x]",Vt(d))}if(l===o.length-1){Array.isArray(i)?s=i.map(u=>u[c]):s=i[c];continue}if(Array.isArray(i))i=i.map(u=>u[c]);else if(pn(i)){if(i[c]===void 0)return;i=i[c]}else return}return s}function Md(e,t,n,r){if(!(n.fixed||n.pattern))return e;if(Array.isArray(e))return e.map(l=>Md(l,t,n,r));e==null&&(e=Object.create(null));const o=e,i=t.split(".");let s=o;for(let l=0;l<i.length;l++){let c=i[l];if(c.includes("[x]")){const d=r[i.slice(0,l+1).join(".")].type[0].code;c=c.replace("[x]",Vt(d))}if(l===i.length-1){const u=Array.isArray(s)?s:[s];for(const d of u)n.fixed?d[c]??(d[c]=n.fixed.value):n.pattern&&(d[c]=YP(d[c],n.pattern.value))}else{if(!(c in s)){const u=i.slice(0,l+1).join(".");s[c]=r[u].isArray?[Object.create(null)]:Object.create(null)}s=s[c]}}return o}function YP(e,t){if(Array.isArray(t)&&(Array.isArray(e)||e===void 0))return((e==null?void 0:e.length)??0)>0?e:ao(t);if(pn(t)&&(pn(e)&&!Array.isArray(e)||e===void 0)){const n=ao(e)??Object.create(null);for(const r of Object.keys(t))n[r]=YP(n[r],t[r]);return n}return e}var XP=p.createContext(void 0);function Jf(){return p.useContext(XP)}function ee(){return Jf().medplum}function Zf(){return Jf().navigate}function eh(){return Jf().profile}function z7(e){let t=e.medplum,n=e.navigate??B7,[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(XP.Provider,{value:i,children:e.children})}function B7(e){window.location.assign(e)}var cw=new Map,JP=e=>p.useMemo(()=>{if(!e)return;let t=e.split("?")[0];if(!t)return e;let n;try{n=new URLSearchParams(new URL(e).search)}catch{return e}if(!n.has("Key-Pair-Id")||!n.has("Signature"))return e;let r=n.get("Expires");if(!r||r.length>13)return e;let o=cw.get(t);if(o){let i=new URLSearchParams(new URL(o).search).get("Expires");if(i&&parseInt(i,10)*1e3-5e3>Date.now())return o}return cw.set(t,e),e},[e]);function lt(e,t){let n=ee(),[r,o]=p.useState(uw(n,e)),i=p.useCallback(s=>{Bc(s,r)||o(s)},[r,o]);return p.useEffect(()=>{i(uw(n,e))},[n,e,i]),p.useEffect(()=>{let s=!0;return Ps(e)&&n.readReference(e).then(l=>{s&&i(l)}).catch(l=>{s&&(i(void 0),t&&t(at(l)))}),()=>s=!1},[n,r,e,i,t]),r}function uw(e,t){if(t){if(Uo(t))return t;if(Ps(t))return e.getCachedReference(t)}}function U7(e,t){return ZP("searchOne",e,t)}function Ia(e,t){return ZP("searchResources",e,t)}function ZP(e,t,n){let r=ee(),[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(lM)}).catch(m=>{l(!1),u(void 0),f(at(m))}))},[r,e,t,n,o]),[c,s,d]}function V7(e){const t=e.value;return t?a.jsx(a.Fragment,{children:V$(t)}):null}function dw(e,t){return e.line&&e.line.length>t?e.line[t]:""}function fw(e,t,n){const r=e.line||[];for(;r.length<=t;)r.push("");return r[t]=n,{...e,line:r}}function H7(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(fw(r.current||{},0,h))}function c(h){o(fw(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(wt,{"data-testid":"address-use",defaultValue:t.use,onChange:h=>i(h.currentTarget.value),data:["","home","work","temp","old","billing"]}),a.jsx(wt,{"data-testid":"address-type",defaultValue:t.type,onChange:h=>s(h.currentTarget.value),data:["","postal","physical","both"]}),a.jsx(ie,{placeholder:"Line 1",defaultValue:dw(t,0),onChange:h=>l(h.currentTarget.value)}),a.jsx(ie,{placeholder:"Line 2",defaultValue:dw(t,1),onChange:h=>c(h.currentTarget.value)}),a.jsx(ie,{placeholder:"City",defaultValue:t.city,onChange:h=>u(h.currentTarget.value)}),a.jsx(ie,{placeholder:"State",defaultValue:t.state,onChange:h=>d(h.currentTarget.value)}),a.jsx(ie,{placeholder:"Postal Code",defaultValue:t.postalCode,onChange:h=>f(h.currentTarget.value)})]})}function W7(e){const t=eh(),[n,r]=p.useState(e.defaultValue||{});function o(i){const s=i?{text:i,authorReference:t&&ft(t),time:new Date().toISOString()}:{};r(s),e.onChange&&e.onChange(s)}return a.jsx(ie,{name:e.name,placeholder:"Annotation text",defaultValue:n.text,onChange:i=>o(i.currentTarget.value)})}/**
125
+ * @license @tabler/icons-react v3.1.0 - MIT
126
+ *
127
+ * This source code is licensed under the MIT license.
128
+ * See the LICENSE file in the root directory of this source tree.
129
+ */var q7={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};/**
130
+ * @license @tabler/icons-react v3.1.0 - MIT
131
+ *
132
+ * This source code is licensed under the MIT license.
133
+ * See the LICENSE file in the root directory of this source tree.
134
+ */const he=(e,t,n,r)=>{const o=p.forwardRef(({color:i="currentColor",size:s=24,stroke:l=2,className:c,children:u,...d},f)=>p.createElement("svg",{ref:f,...q7[e],width:s,height:s,className:["tabler-icon",`tabler-icon-${t}`,c].join(" "),...e==="filled"?{fill:i}:{strokeWidth:l,stroke:i},...d},[...r.map(([h,m])=>p.createElement(h,m)),...Array.isArray(u)?u:[u]]));return o.displayName=`${n}`,o};/**
135
+ * @license @tabler/icons-react v3.1.0 - MIT
136
+ *
137
+ * This source code is licensed under the MIT license.
138
+ * See the LICENSE file in the root directory of this source tree.
139
+ */var G7=he("outline","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"}]]);/**
140
+ * @license @tabler/icons-react v3.1.0 - MIT
141
+ *
142
+ * This source code is licensed under the MIT license.
143
+ * See the LICENSE file in the root directory of this source tree.
144
+ */var Vc=he("outline","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"}]]);/**
145
+ * @license @tabler/icons-react v3.1.0 - MIT
146
+ *
147
+ * This source code is licensed under the MIT license.
148
+ * See the LICENSE file in the root directory of this source tree.
149
+ */var Q7=he("outline","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"}]]);/**
150
+ * @license @tabler/icons-react v3.1.0 - MIT
151
+ *
152
+ * This source code is licensed under the MIT license.
153
+ * See the LICENSE file in the root directory of this source tree.
154
+ */var K7=he("outline","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"}]]);/**
155
+ * @license @tabler/icons-react v3.1.0 - MIT
156
+ *
157
+ * This source code is licensed under the MIT license.
158
+ * See the LICENSE file in the root directory of this source tree.
159
+ */var Y7=he("outline","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"}]]);/**
160
+ * @license @tabler/icons-react v3.1.0 - MIT
161
+ *
162
+ * This source code is licensed under the MIT license.
163
+ * See the LICENSE file in the root directory of this source tree.
164
+ */var X7=he("outline","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"}]]);/**
165
+ * @license @tabler/icons-react v3.1.0 - MIT
166
+ *
167
+ * This source code is licensed under the MIT license.
168
+ * See the LICENSE file in the root directory of this source tree.
169
+ */var J7=he("outline","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"}]]);/**
170
+ * @license @tabler/icons-react v3.1.0 - MIT
171
+ *
172
+ * This source code is licensed under the MIT license.
173
+ * See the LICENSE file in the root directory of this source tree.
174
+ */var Z7=he("outline","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"}]]);/**
175
+ * @license @tabler/icons-react v3.1.0 - MIT
176
+ *
177
+ * This source code is licensed under the MIT license.
178
+ * See the LICENSE file in the root directory of this source tree.
179
+ */var e6=he("outline","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"}]]);/**
180
+ * @license @tabler/icons-react v3.1.0 - MIT
181
+ *
182
+ * This source code is licensed under the MIT license.
183
+ * See the LICENSE file in the root directory of this source tree.
184
+ */var t6=he("outline","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"}]]);/**
185
+ * @license @tabler/icons-react v3.1.0 - MIT
186
+ *
187
+ * This source code is licensed under the MIT license.
188
+ * See the LICENSE file in the root directory of this source tree.
189
+ */var n6=he("outline","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"}]]);/**
190
+ * @license @tabler/icons-react v3.1.0 - MIT
191
+ *
192
+ * This source code is licensed under the MIT license.
193
+ * See the LICENSE file in the root directory of this source tree.
194
+ */var r6=he("outline","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"}]]);/**
195
+ * @license @tabler/icons-react v3.1.0 - MIT
196
+ *
197
+ * This source code is licensed under the MIT license.
198
+ * See the LICENSE file in the root directory of this source tree.
199
+ */var Ni=he("outline","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"}]]);/**
200
+ * @license @tabler/icons-react v3.1.0 - MIT
201
+ *
202
+ * This source code is licensed under the MIT license.
203
+ * See the LICENSE file in the root directory of this source tree.
204
+ */var th=he("outline","check","IconCheck",[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]]);/**
205
+ * @license @tabler/icons-react v3.1.0 - MIT
206
+ *
207
+ * This source code is licensed under the MIT license.
208
+ * See the LICENSE file in the root directory of this source tree.
209
+ */var o6=he("outline","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"}]]);/**
210
+ * @license @tabler/icons-react v3.1.0 - MIT
211
+ *
212
+ * This source code is licensed under the MIT license.
213
+ * See the LICENSE file in the root directory of this source tree.
214
+ */var eT=he("outline","chevron-down","IconChevronDown",[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]]);/**
215
+ * @license @tabler/icons-react v3.1.0 - MIT
216
+ *
217
+ * This source code is licensed under the MIT license.
218
+ * See the LICENSE file in the root directory of this source tree.
219
+ */var $d=he("outline","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"}]]);/**
220
+ * @license @tabler/icons-react v3.1.0 - MIT
221
+ *
222
+ * This source code is licensed under the MIT license.
223
+ * See the LICENSE file in the root directory of this source tree.
224
+ */var Ld=he("outline","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"}]]);/**
225
+ * @license @tabler/icons-react v3.1.0 - MIT
226
+ *
227
+ * This source code is licensed under the MIT license.
228
+ * See the LICENSE file in the root directory of this source tree.
229
+ */var Wv=he("outline","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"}]]);/**
230
+ * @license @tabler/icons-react v3.1.0 - MIT
231
+ *
232
+ * This source code is licensed under the MIT license.
233
+ * See the LICENSE file in the root directory of this source tree.
234
+ */var i6=he("outline","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"}]]);/**
235
+ * @license @tabler/icons-react v3.1.0 - MIT
236
+ *
237
+ * This source code is licensed under the MIT license.
238
+ * See the LICENSE file in the root directory of this source tree.
239
+ */var tT=he("outline","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"}]]);/**
240
+ * @license @tabler/icons-react v3.1.0 - MIT
241
+ *
242
+ * This source code is licensed under the MIT license.
243
+ * See the LICENSE file in the root directory of this source tree.
244
+ */var s6=he("outline","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"}]]);/**
245
+ * @license @tabler/icons-react v3.1.0 - MIT
246
+ *
247
+ * This source code is licensed under the MIT license.
248
+ * See the LICENSE file in the root directory of this source tree.
249
+ */var a6=he("outline","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"}]]);/**
250
+ * @license @tabler/icons-react v3.1.0 - MIT
251
+ *
252
+ * This source code is licensed under the MIT license.
253
+ * See the LICENSE file in the root directory of this source tree.
254
+ */var l6=he("outline","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"}]]);/**
255
+ * @license @tabler/icons-react v3.1.0 - MIT
256
+ *
257
+ * This source code is licensed under the MIT license.
258
+ * See the LICENSE file in the root directory of this source tree.
259
+ */var c6=he("outline","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"}]]);/**
260
+ * @license @tabler/icons-react v3.1.0 - MIT
261
+ *
262
+ * This source code is licensed under the MIT license.
263
+ * See the LICENSE file in the root directory of this source tree.
264
+ */var Hc=he("outline","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"}]]);/**
265
+ * @license @tabler/icons-react v3.1.0 - MIT
266
+ *
267
+ * This source code is licensed under the MIT license.
268
+ * See the LICENSE file in the root directory of this source tree.
269
+ */var Wc=he("outline","equal","IconEqual",[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}]]);/**
270
+ * @license @tabler/icons-react v3.1.0 - MIT
271
+ *
272
+ * This source code is licensed under the MIT license.
273
+ * See the LICENSE file in the root directory of this source tree.
274
+ */var hw=he("outline","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"}]]);/**
275
+ * @license @tabler/icons-react v3.1.0 - MIT
276
+ *
277
+ * This source code is licensed under the MIT license.
278
+ * See the LICENSE file in the root directory of this source tree.
279
+ */var u6=he("outline","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"}]]);/**
280
+ * @license @tabler/icons-react v3.1.0 - MIT
281
+ *
282
+ * This source code is licensed under the MIT license.
283
+ * See the LICENSE file in the root directory of this source tree.
284
+ */var d6=he("outline","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"}]]);/**
285
+ * @license @tabler/icons-react v3.1.0 - MIT
286
+ *
287
+ * This source code is licensed under the MIT license.
288
+ * See the LICENSE file in the root directory of this source tree.
289
+ */var f6=he("outline","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"}]]);/**
290
+ * @license @tabler/icons-react v3.1.0 - MIT
291
+ *
292
+ * This source code is licensed under the MIT license.
293
+ * See the LICENSE file in the root directory of this source tree.
294
+ */var h6=he("outline","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"}]]);/**
295
+ * @license @tabler/icons-react v3.1.0 - MIT
296
+ *
297
+ * This source code is licensed under the MIT license.
298
+ * See the LICENSE file in the root directory of this source tree.
299
+ */var p6=he("outline","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"}]]);/**
300
+ * @license @tabler/icons-react v3.1.0 - MIT
301
+ *
302
+ * This source code is licensed under the MIT license.
303
+ * See the LICENSE file in the root directory of this source tree.
304
+ */var m6=he("outline","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"}]]);/**
305
+ * @license @tabler/icons-react v3.1.0 - MIT
306
+ *
307
+ * This source code is licensed under the MIT license.
308
+ * See the LICENSE file in the root directory of this source tree.
309
+ */var g6=he("outline","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"}]]);/**
310
+ * @license @tabler/icons-react v3.1.0 - MIT
311
+ *
312
+ * This source code is licensed under the MIT license.
313
+ * See the LICENSE file in the root directory of this source tree.
314
+ */var y6=he("outline","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"}]]);/**
315
+ * @license @tabler/icons-react v3.1.0 - MIT
316
+ *
317
+ * This source code is licensed under the MIT license.
318
+ * See the LICENSE file in the root directory of this source tree.
319
+ */var nT=he("outline","math-greater","IconMathGreater",[["path",{d:"M5 18l14 -6l-14 -6",key:"svg-0"}]]);/**
320
+ * @license @tabler/icons-react v3.1.0 - MIT
321
+ *
322
+ * This source code is licensed under the MIT license.
323
+ * See the LICENSE file in the root directory of this source tree.
324
+ */var rT=he("outline","math-lower","IconMathLower",[["path",{d:"M19 18l-14 -6l14 -6",key:"svg-0"}]]);/**
325
+ * @license @tabler/icons-react v3.1.0 - MIT
326
+ *
327
+ * This source code is licensed under the MIT license.
328
+ * See the LICENSE file in the root directory of this source tree.
329
+ */var v6=he("outline","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"}]]);/**
330
+ * @license @tabler/icons-react v3.1.0 - MIT
331
+ *
332
+ * This source code is licensed under the MIT license.
333
+ * See the LICENSE file in the root directory of this source tree.
334
+ */var x6=he("outline","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"}]]);/**
335
+ * @license @tabler/icons-react v3.1.0 - MIT
336
+ *
337
+ * This source code is licensed under the MIT license.
338
+ * See the LICENSE file in the root directory of this source tree.
339
+ */var w6=he("outline","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"}]]);/**
340
+ * @license @tabler/icons-react v3.1.0 - MIT
341
+ *
342
+ * This source code is licensed under the MIT license.
343
+ * See the LICENSE file in the root directory of this source tree.
344
+ */var S6=he("outline","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"}]]);/**
345
+ * @license @tabler/icons-react v3.1.0 - MIT
346
+ *
347
+ * This source code is licensed under the MIT license.
348
+ * See the LICENSE file in the root directory of this source tree.
349
+ */var b6=he("outline","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"}]]);/**
350
+ * @license @tabler/icons-react v3.1.0 - MIT
351
+ *
352
+ * This source code is licensed under the MIT license.
353
+ * See the LICENSE file in the root directory of this source tree.
354
+ */var C6=he("outline","player-play","IconPlayerPlay",[["path",{d:"M7 4v16l13 -8z",key:"svg-0"}]]);/**
355
+ * @license @tabler/icons-react v3.1.0 - MIT
356
+ *
357
+ * This source code is licensed under the MIT license.
358
+ * See the LICENSE file in the root directory of this source tree.
359
+ */var E6=he("outline","plus","IconPlus",[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]]);/**
360
+ * @license @tabler/icons-react v3.1.0 - MIT
361
+ *
362
+ * This source code is licensed under the MIT license.
363
+ * See the LICENSE file in the root directory of this source tree.
364
+ */var j6=he("outline","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"}]]);/**
365
+ * @license @tabler/icons-react v3.1.0 - MIT
366
+ *
367
+ * This source code is licensed under the MIT license.
368
+ * See the LICENSE file in the root directory of this source tree.
369
+ */var P6=he("outline","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"}]]);/**
370
+ * @license @tabler/icons-react v3.1.0 - MIT
371
+ *
372
+ * This source code is licensed under the MIT license.
373
+ * See the LICENSE file in the root directory of this source tree.
374
+ */var T6=he("outline","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"}]]);/**
375
+ * @license @tabler/icons-react v3.1.0 - MIT
376
+ *
377
+ * This source code is licensed under the MIT license.
378
+ * See the LICENSE file in the root directory of this source tree.
379
+ */var k6=he("outline","router","IconRouter",[["path",{d:"M3 13m0 2a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M17 17l0 .01",key:"svg-1"}],["path",{d:"M13 17l0 .01",key:"svg-2"}],["path",{d:"M15 13l0 -2",key:"svg-3"}],["path",{d:"M11.75 8.75a4 4 0 0 1 6.5 0",key:"svg-4"}],["path",{d:"M8.5 6.5a8 8 0 0 1 13 0",key:"svg-5"}]]);/**
380
+ * @license @tabler/icons-react v3.1.0 - MIT
381
+ *
382
+ * This source code is licensed under the MIT license.
383
+ * See the LICENSE file in the root directory of this source tree.
384
+ */var R6=he("outline","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"}]]);/**
385
+ * @license @tabler/icons-react v3.1.0 - MIT
386
+ *
387
+ * This source code is licensed under the MIT license.
388
+ * See the LICENSE file in the root directory of this source tree.
389
+ */var Am=he("outline","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"}]]);/**
390
+ * @license @tabler/icons-react v3.1.0 - MIT
391
+ *
392
+ * This source code is licensed under the MIT license.
393
+ * See the LICENSE file in the root directory of this source tree.
394
+ */var qv=he("outline","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"}]]);/**
395
+ * @license @tabler/icons-react v3.1.0 - MIT
396
+ *
397
+ * This source code is licensed under the MIT license.
398
+ * See the LICENSE file in the root directory of this source tree.
399
+ */var Gv=he("outline","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"}]]);/**
400
+ * @license @tabler/icons-react v3.1.0 - MIT
401
+ *
402
+ * This source code is licensed under the MIT license.
403
+ * See the LICENSE file in the root directory of this source tree.
404
+ */var _6=he("outline","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"}]]);/**
405
+ * @license @tabler/icons-react v3.1.0 - MIT
406
+ *
407
+ * This source code is licensed under the MIT license.
408
+ * See the LICENSE file in the root directory of this source tree.
409
+ */var I6=he("outline","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"}]]);/**
410
+ * @license @tabler/icons-react v3.1.0 - MIT
411
+ *
412
+ * This source code is licensed under the MIT license.
413
+ * See the LICENSE file in the root directory of this source tree.
414
+ */var D6=he("outline","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"}]]);/**
415
+ * @license @tabler/icons-react v3.1.0 - MIT
416
+ *
417
+ * This source code is licensed under the MIT license.
418
+ * See the LICENSE file in the root directory of this source tree.
419
+ */var A6=he("outline","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"}]]);/**
420
+ * @license @tabler/icons-react v3.1.0 - MIT
421
+ *
422
+ * This source code is licensed under the MIT license.
423
+ * See the LICENSE file in the root directory of this source tree.
424
+ */var oT=he("outline","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"}]]);/**
425
+ * @license @tabler/icons-react v3.1.0 - MIT
426
+ *
427
+ * This source code is licensed under the MIT license.
428
+ * See the LICENSE file in the root directory of this source tree.
429
+ */var pw=he("outline","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"}]]);/**
430
+ * @license @tabler/icons-react v3.1.0 - MIT
431
+ *
432
+ * This source code is licensed under the MIT license.
433
+ * See the LICENSE file in the root directory of this source tree.
434
+ */var N6=he("outline","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"}]]);/**
435
+ * @license @tabler/icons-react v3.1.0 - MIT
436
+ *
437
+ * This source code is licensed under the MIT license.
438
+ * See the LICENSE file in the root directory of this source tree.
439
+ */var Fd=he("outline","x","IconX",[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]]);/**
440
+ * @license @tabler/icons-react v3.1.0 - MIT
441
+ *
442
+ * This source code is licensed under the MIT license.
443
+ * See the LICENSE file in the root directory of this source tree.
444
+ */var O6=he("filled","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",key:"svg-0"}]]);class iT 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(xs,{icon:a.jsx(Vc,{size:16}),title:"Something went wrong",color:"red",children:Re(this.state.error)}):this.props.children}}function Lr(){return a.jsx(on,{style:{width:"100%",height:"100vh"},children:a.jsx(Un,{})})}const M6="_main_1szoq_1",$6={main:M6};function ot(e){e.preventDefault(),e.stopPropagation()}function sT(e){if(mw(e))return!0;if(e instanceof HTMLTableCellElement){const t=e.children;if(t.length===1&&mw(t[0]))return!0}return!1}function mw(e){return e instanceof HTMLInputElement&&e.type==="checkbox"}function $e(e){const t=Zf(),{to:n,suffix:r,label:o,onClick:i,children:s,...l}=e;let c=L6(n);return r&&(c+="/"+r),a.jsx(Ve,{href:c,"aria-label":o,onClick:u=>{ot(u),i?i(u):n&&t(c)},...l,children:s})}function L6(e){if(e){if(typeof e=="string")return F6(e);if(Uo(e))return z6(e);if(Ps(e))return B6(e)}return"#"}function F6(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:"/"+e}function z6(e){return`/${e.resourceType}/${e.id}`}function B6(e){return`/${e.reference}`}function U6(e){const t=e.split(" ").filter(Boolean);return t.length>1?t[0][0]+t[t.length-1][0]:t.length===1?t[0][0]:""}function Ti(e){const t=lt(e.value),n=t?_o(t):e.alt??"",r=U6(n),o=(t&&E$(t))??e.src,i=JP(o??void 0),s=e.radius??"xl",l={...e,value:void 0,link:void 0};return e.link?a.jsx($e,{to:t,children:a.jsx(is,{src:i,alt:n,radius:s,...l,children:r})}):a.jsx(is,{src:i,alt:n,radius:s,...l,children:r})}const V6="_logoButton_189g3_1",H6="_user_189g3_11",W6="_userName_189g3_21",q6="_userActive_189g3_31",Du={logoButton:V6,user:H6,userName:W6,userActive:q6};function Qv(e){const t=e.value;return t?a.jsx(a.Fragment,{children:Uc(t,e.options)}):null}function G6(e){var c,u,d;const t=Jf(),{medplum:n,profile:r,navigate:o}=t,i=n.getLogins(),{colorScheme:s,setColorScheme:l}=T_();return a.jsxs(a.Fragment,{children:[a.jsxs(je,{align:"center",p:"xl",children:[a.jsx(Ti,{size:"xl",radius:100,value:t.profile}),a.jsx(Qv,{value:(u=(c=t.profile)==null?void 0:c.name)==null?void 0:u[0]}),a.jsx(oe,{c:"dimmed",size:"xs",children:(d=n.getActiveLogin())==null?void 0:d.project.display})]}),i.length>1&&a.jsx(J.Divider,{}),i.map(f=>f.profile.reference!==ht(t.profile)&&a.jsx(J.Item,{onClick:()=>{n.setActiveLogin(f).then(()=>window.location.reload()).catch(console.log)},children:a.jsxs(Y,{children:[a.jsx(is,{radius:"xl"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(oe,{size:"sm",fw:500,children:f.profile.display}),a.jsx(oe,{c:"dimmed",size:"xs",children:f.project.display})]})]})},f.profile.reference)),a.jsx(J.Divider,{}),a.jsx(Y,{justify:"center",children:a.jsx(pv,{size:"xs",value:s,onChange:f=>l(f),data:[{label:"Light",value:"light"},{label:"Dark",value:"dark"},{label:"Auto",value:"auto"}]})}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(D6,{size:14,stroke:1.5}),onClick:()=>o("/signin"),children:"Add another account"}),a.jsx(J.Item,{leftSection:a.jsx(Am,{size:14,stroke:1.5}),onClick:()=>o(`/${ht(r)}`),children:"Account settings"}),a.jsx(J.Item,{leftSection:a.jsx(y6,{size:14,stroke:1.5}),onClick:async()=>{await n.signOut(),o("/signin")},children:"Sign out"}),a.jsx(oe,{size:"xs",c:"dimmed",ta:"center",children:e.version})]})}function Kv(e){const t=_c({onDropdownClose:()=>t.resetSelectedOption(),onDropdownOpen:()=>t.updateSelectedOptionIndex("active")}),{name:n,label:r,description:o,error:i,defaultValue:s,toOption:l,loadOptions:c,itemComponent:u,onChange:d,onCreate:f,creatable:h,clearable:m,required:g,placeholder:y,leftSection:S,maxValues:v,...x}=e,w=Q6(s),[b,j]=p.useState(""),[E,P]=p.useState(),[T,_]=p.useState(),[D,O]=p.useState(),[I,L]=p.useState(w.map(l)),[N,M]=p.useState([]),$=u??K6,R=p.useRef();R.current=b;const k=p.useRef(),F=p.useRef(),q=p.useRef();q.current=E;const G=p.useRef();G.current=T;const ne=p.useRef();ne.current=D;const xe=p.useRef();xe.current=N;const ge=p.useCallback(()=>{if(P(void 0),R.current===F.current&&c===k.current)return;F.current=R.current,k.current=c;const me=new AbortController;_(me),c(R.current??"",me.signal).then(Fe=>{me.signal.aborted||(M(Fe.map(l)),_(void 0),ne.current?(Fe.length>0&&d(Fe.slice(0,1)),O(!1)):Fe.length>0&&t.openDropdown())}).catch(Fe=>{me.signal.aborted||Fe.message.includes("aborted")||ue({color:"red",message:Re(Fe)})})},[t,c,d,l]),Pe=p.useCallback(me=>{(N&&N.length>0||h)&&t.openDropdown(),t.updateSelectedOptionIndex(),j(me.currentTarget.value),G.current&&(G.current.abort(),_(void 0)),q.current!==void 0&&window.clearTimeout(q.current);const Fe=window.setTimeout(()=>ge(),100);P(Fe)},[t,N,h,ge]),Te=p.useCallback(me=>{const Fe=[],ct=[...I];let Oe=N==null?void 0:N.find(Bt=>Bt.value===me),Qe=Oe==null?void 0:Oe.resource;if(!Qe&&h!==!1&&f&&(Qe=f(me),Oe=l(Qe)),Qe&&Fe.push(Qe),Oe&&ct.push(Oe),v!==void 0)for(;ct.length>v;)ct.shift();d(Fe),L(ct)},[h,N,I,v,d,f,l]),Le=me=>{j(""),M([]),t.closeDropdown(),F.current=void 0,Te(me==="$create"?b:me)},pe=p.useCallback(me=>{const Fe=I.filter(ct=>ct.value!==me.value);d(Fe.map(ct=>ct.resource)),L(Fe)},[I,d]),Ge=p.useCallback(me=>{me.key==="Enter"?!E&&!T?(ot(me),N&&N.length>0&&(M(N.slice(0,1)),Te(N[0].value))):O(!0):me.key==="Backspace"&&b.length===0&&(ot(me),pe(I[I.length-1]))},[b,I,N,E,T,Te,pe]);p.useEffect(()=>()=>{G.current&&G.current.abort()},[]);const Ot=m&&I.length>0&&a.jsx(Ee.ClearButton,{title:"Clear all",size:16,onClear:()=>{j(""),L([]),d([]),t.closeDropdown()}});return a.jsxs(Ee,{store:t,onOptionSubmit:Le,withinPortal:!0,shadow:"xl",...x,children:[a.jsx(Ee.DropdownTarget,{children:a.jsx(ka,{label:r,description:o,error:i,className:e.className,leftSection:S,rightSection:T?a.jsx(Un,{size:16}):Ot,required:g,children:a.jsxs(ss.Group,{children:[I.map(me=>a.jsx(ss,{withRemoveButton:!0,onRemove:()=>pe(me),children:me.label},me.value)),(v===void 0||v===0||I.length<v)&&a.jsx(Ee.EventsTarget,{children:a.jsx(ka.Field,{role:"searchbox",name:n,value:b,placeholder:y,onFocus:Pe,onBlur:()=>t.closeDropdown(),onKeyDown:Ge,onChange:Pe})})]})})}),a.jsx(Ee.Dropdown,{children:a.jsxs(Ee.Options,{children:[N.map(me=>a.jsx(Ee.Option,{value:me.value,active:I.includes(me),children:a.jsx($,{...me})},me.value)),h&&b.trim().length>0&&a.jsxs(Ee.Option,{value:"$create",children:["+ Create ",b]}),!h&&b.trim().length>0&&N.length===0&&a.jsx(Ee.Empty,{children:"Nothing found"})]})})]})}function Q6(e){return e?Array.isArray(e)?e:[e]:[]}function K6(e){return a.jsx(Y,{gap:"sm",children:a.jsx("span",{children:e.label})})}const Y6="_searchInput_dick8_1",X6={searchInput:Y6};function J6(e){return{value:e.id,label:_o(e),resource:e}}function Z6(e){const t=Zf(),n=ee(),r=p.useCallback(async(i,s)=>{const l=t8(i),c={signal:s},u=await n.graphql(l,void 0,void 0,c);return n8(u,i)},[n]),o=p.useCallback(i=>{i.length>0&&t(`/${ht(i[0])}`)},[t]);return a.jsx(Kv,{size:"sm",radius:"md",className:X6.searchInput,leftSection:a.jsx(R6,{size:16}),placeholder:"Search",itemComponent:e8,toOption:J6,onChange:o,loadOptions:r,maxValues:0,clearable:!1},`${e.pathname}?${e.searchParams}`)}const e8=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(Ti,{value:e}),a.jsxs("div",{children:[a.jsx(oe,{children:_o(e)}),a.jsx(oe,{size:"xs",c:"dimmed",children:r})]})]})})});function t8(e){const t=JSON.stringify(e);return _P(e)?`{
445
+ Patients1: PatientList(_id: ${t}, _count: 1) {
446
+ resourceType
447
+ id
448
+ identifier {
449
+ system
450
+ value
451
+ }
452
+ name {
453
+ given
454
+ family
455
+ }
456
+ birthDate
457
+ }
458
+ ServiceRequestList(_id: ${t}, _count: 1) {
459
+ resourceType
460
+ id
461
+ identifier {
462
+ system
463
+ value
464
+ }
465
+ subject {
466
+ display
467
+ }
468
+ }
469
+ }`.replace(/\s+/g," "):`{
470
+ Patients1: PatientList(name: ${t}, _count: 5) {
471
+ resourceType
472
+ id
473
+ identifier {
474
+ system
475
+ value
476
+ }
477
+ name {
478
+ given
479
+ family
480
+ }
481
+ birthDate
482
+ }
483
+ Patients2: PatientList(identifier: ${t}, _count: 5) {
484
+ resourceType
485
+ id
486
+ identifier {
487
+ system
488
+ value
489
+ }
490
+ name {
491
+ given
492
+ family
493
+ }
494
+ birthDate
495
+ }
496
+ ServiceRequestList(identifier: ${t}, _count: 5) {
497
+ resourceType
498
+ id
499
+ identifier {
500
+ system
501
+ value
502
+ }
503
+ subject {
504
+ display
505
+ }
506
+ }
507
+ }`.replace(/\s+/g," ")}function n8(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),o8(r8(n),t).slice(0,5)}function r8(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 o8(e,t){return e.sort((n,r)=>gw(r,t)-gw(n,t))}function gw(e,t){let n=0;if(e.identifier)for(const r of e.identifier)n=Math.max(n,yw(r.value,t));if(e.resourceType==="Patient"&&e.name)for(const r of e.name)n=Math.max(n,yw(Uc(r),t));return n}function yw(e,t){if(!e)return 0;const n=e.toLowerCase().indexOf(t.toLowerCase());return n<0?0:100-n}function i8(e){var o;const t=eh(),[n,r]=p.useState(!1);return a.jsx(Bn.Header,{p:8,style:{zIndex:101},children:a.jsxs(Y,{justify:"space-between",children:[a.jsxs(Y,{gap:"xs",children:[a.jsx(Xn,{className:Du.logoButton,onClick:e.navbarToggle,children:e.logo}),!e.headerSearchDisabled&&a.jsx(Z6,{pathname:e.pathname,searchParams:e.searchParams})]}),a.jsxs(Y,{gap:"lg",pr:"sm",children:[e.notifications,a.jsxs(J,{width:260,shadow:"xl",position:"bottom-end",transitionProps:{transition:"pop-top-right"},opened:n,onClose:()=>r(!1),children:[a.jsx(J.Target,{children:a.jsx(Xn,{className:et(Du.user,{[Du.userActive]:n}),onClick:()=>r(i=>!i),children:a.jsxs(Y,{gap:7,children:[a.jsx(Ti,{value:t,radius:"xl",size:24}),a.jsx(oe,{size:"sm",className:Du.userName,children:Uc((o=t==null?void 0:t.name)==null?void 0:o[0])}),a.jsx(eT,{size:12,stroke:1.5})]})})}),a.jsx(J.Dropdown,{children:a.jsx(G6,{version:e.version})})]})]})]})})}function s8(e){const t={};for(const n of Array.from(e.elements))n instanceof HTMLInputElement?a8(t,n):n instanceof HTMLTextAreaElement?t[n.name]=n.value:n instanceof HTMLSelectElement&&l8(t,n);return t}function a8(e,t){t.disabled||(t.type==="checkbox"||t.type==="radio")&&!t.checked||(e[t.name]=t.value)}function l8(e,t){e[t.name]=t.value}function Be(e){return a.jsx("form",{style:e.style,"data-testid":e.testid,onSubmit:t=>{t.preventDefault();const n=s8(t.target);e.onSubmit&&e.onSubmit(n)},children:e.children})}function c8(e){const t=ee(),n=t.getUserConfiguration();function r(o){var d,f;const{menuname:i,bookmarkname:s}=o,l=`${e.pathname}?${e.searchParams.toString()}`,c=ao(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"}),ue({color:"green",message:"Success"}),e.onOk()}).catch(h=>{ue({color:"red",message:Re(h)})})}return a.jsx(Rn,{title:"Add Bookmark",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:a.jsx(Be,{onSubmit:r,children:a.jsxs(je,{children:[a.jsx(u8,{config:n}),a.jsx(ie,{label:"Bookmark Name",type:"text",name:"bookmarkname",placeholder:"Bookmark Name",withAsterisk:!0}),a.jsx(Y,{justify:"flex-end",children:a.jsx(Z,{mt:"sm",type:"submit",children:"OK"})})]})})})}function u8(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(wt,{name:"menuname",defaultValue:n[0],label:"Select Menu Option",data:n,withAsterisk:!0})}function aT(e){return typeof e.code=="string"?e.code:JSON.stringify(e)}function d8(e){return typeof e.display=="string"?e.display:aT(e)}function f8(e){return{value:aT(e),label:d8(e),resource:e}}function h8(e){return{code:e,display:e}}function Yv(e){const t=ee(),{binding:n,creatable:r,clearable:o,expandParams:i,withHelpText:s,...l}=e,c=p.useCallback(async(u,d)=>{var g;if(!n)return[];const h=(g=(await t.valueSetExpand({...i,url:n,filter:u},{signal:d})).expansion)==null?void 0:g.contains,m=[];for(const y of h)y.code&&!m.some(S=>S.code===y.code)&&m.push(y);return m},[t,i,n]);return a.jsx(Kv,{...l,creatable:r??!0,clearable:o??!0,toOption:f8,loadOptions:c,onCreate:h8,itemComponent:s?p8:void 0})}const p8=p.forwardRef(({label:e,resource:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsx(Y,{wrap:"nowrap",children:a.jsxs("div",{children:[a.jsx(oe,{children:e}),a.jsx(oe,{size:"xs",c:"dimmed",children:`${t.system}#${t.code}`})]})})}));function lT(e){const{defaultValue:t,onChange:n,withHelpText:r,...o}=e,[i,s]=p.useState(t);function l(c){const u=c[0],d=g8(u);s(d),n&&n(d)}return a.jsx(Yv,{defaultValue:m8(i),onChange:l,withHelpText:r??!0,...o})}function m8(e){return e?{code:e}:void 0}function g8(e){return e==null?void 0:e.code}function Xv(e){const[t,n]=p.useState(e.defaultValue),r=e.onChange,o=p.useCallback(i=>{n(i),r&&r(i)},[r]);return a.jsx(lT,{"data-autofocus":e.autoFocus,"data-testid":e.testId,defaultValue:t,onChange:o,name:e.name,placeholder:e.placeholder,binding:"https://medplum.com/fhir/ValueSet/resource-types",creatable:!1,maxValues:e.maxValues??1,clearable:!1,withHelpText:!1})}const y8="_menuTitle_9g6l5_1",v8="_link_9g6l5_9",x8="_linkActive_9g6l5_38",Nm={menuTitle:y8,link:v8,linkActive:x8};function w8(e){var l;const t=Zf(),n=C8(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(Bn.Navbar,{children:a.jsxs(vr,{p:"xs",children:[!e.resourceTypeSearchDisabled&&a.jsx(Bn.Section,{mb:"sm",children:a.jsx(Xv,{name:"resourceType",placeholder:"Resource Type",maxValues:0,onChange:c=>s(c)},window.location.pathname)}),a.jsxs(Bn.Section,{grow:!0,children:[(l=e.menus)==null?void 0:l.map(c=>{var u;return a.jsxs(p.Fragment,{children:[a.jsx(oe,{className:Nm.menuTitle,children:c.title}),(u=c.links)==null?void 0:u.map(d=>a.jsxs(S8,{to:d.href,active:d.href===(n==null?void 0:n.href),onClick:f=>i(f,d.href),children:[a.jsx(b8,{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(E6,{size:"0.75rem"}),onClick:()=>o(!0),children:"Add Bookmark"})]})]})}),e.pathname&&e.searchParams&&a.jsx(c8,{pathname:e.pathname,searchParams:e.searchParams,visible:r,onOk:()=>o(!1),onCancel:()=>o(!1)})]})}function S8(e){return a.jsx($e,{onClick:e.onClick,to:e.to,className:et(Nm.link,{[Nm.linkActive]:e.active}),children:e.children})}function b8(e){return e.icon?e.icon:a.jsx(Wf,{w:30})}function C8(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=E8(e,t,s.href);l>o&&(o=l,r=s)}return r}function E8(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 j8(e){const[t,n]=p.useState(localStorage.navbarOpen==="true"),r=ee(),o=eh();p.useEffect(()=>{function c(){ue({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(Lr,{}):a.jsxs(Bn,{header:{height:60},navbar:{width:250,breakpoint:"sm",collapsed:{desktop:!o||!t,mobile:!o||!t}},padding:0,children:[o&&a.jsx(i8,{pathname:e.pathname,searchParams:e.searchParams,headerSearchDisabled:e.headerSearchDisabled,logo:e.logo,version:e.version,navbarToggle:l,notifications:e.notifications}),o&&t?a.jsx(w8,{pathname:e.pathname,searchParams:e.searchParams,menus:e.menus,closeNavbar:s,displayAddBookmark:e.displayAddBookmark,resourceTypeSearchDisabled:e.resourceTypeSearchDisabled}):void 0,a.jsx(Bn.Main,{className:$6.main,children:a.jsx(iT,{children:a.jsx(p.Suspense,{fallback:a.jsx(Lr,{}),children:e.children})})})]})}function qc(e){const{contentType:t,url:n,title:r}=e.value??{},o=JP(n);return o?a.jsxs("div",{"data-testid":"attachment-display",children:[(t==null?void 0:t.startsWith("image/"))&&a.jsx("img",{"data-testid":"attachment-image",style:{maxWidth:e.maxWidth},src:o,alt:r}),(t==null?void 0:t.startsWith("video/"))&&a.jsx("video",{"data-testid":"attachment-video",style:{maxWidth:e.maxWidth},controls:!0,children:a.jsx("source",{type:t,src:o})}),t==="application/pdf"&&a.jsx("div",{"data-testid":"attachment-pdf",style:{maxWidth:e.maxWidth,minHeight:400},children:a.jsx("iframe",{width:"100%",height:"400",src:o+"#navpanes=0",allowFullScreen:!0,frameBorder:0,seamless:!0})}),a.jsx("div",{"data-testid":"download-link",style:{padding:"2px 16px 16px 16px"},children:a.jsx(Ve,{href:o,"data-testid":"attachment-details",target:"_blank",rel:"noopener noreferrer",download:P8(r),children:r||"Download"})})]}):null}function P8(e){return e!=null&&e.includes(".")?e:void 0}const T8="_root_17n8t_1",k8="_compact_17n8t_25",vw={root:T8,compact:k8};function Jv(e){const{children:t,compact:n}=e;return a.jsx("dl",{className:et(vw.root,{[vw.compact]:n}),children:t})}function bo(e){return a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:e.term}),a.jsx("dd",{children:e.children})]})}function R8(e){var r;const t=(r=e.values)==null?void 0:r.map((o,i)=>a.jsx("div",{children:a.jsx(qc,{value:o,maxWidth:e.maxWidth})},"attatchment-"+i));let n;if(e.includeDescriptionListEntry){if(e.property===void 0)throw new Error("props.property is required when includeDescriptionListEntry is true");if(!Dt(e.path))throw new Error("props.path is required when includeDescriptionListEntry is true");const o=e.path.split(".").pop();n=a.jsx(bo,{term:as(o),children:t})}else n=a.jsx(a.Fragment,{children:t});return n}function Zv(e){const t=ee(),n=p.useRef(null);function r(s){var l;ot(s),(l=n.current)==null||l.click()}function o(s){ot(s);const l=s.target.files;l&&Array.from(l).forEach(i)}function i(s){!s||!s.name||(e.onUploadStart&&e.onUploadStart(),t.createAttachment({data:s,contentType:s.type||"application/octet-stream",filename:s.name,securityContext:e.securityContext,onProgress:e.onUploadProgress}).then(c=>e.onUpload(c)).catch(c=>{e.onUploadError&&e.onUploadError(at(c))}))}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 _8(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(qc,{value:i,maxWidth:200})}),a.jsx("td",{children:a.jsx(Gt,{title:"Remove",variant:"subtle",size:"sm",color:"gray",onClick:l=>{ot(l);const c=t.slice();c.splice(s,1),o(c)},children:a.jsx($d,{})})})]},`${s}-${t.length}`)),a.jsxs("tr",{children:[a.jsx("td",{}),a.jsx("td",{children:a.jsx(Zv,{onUpload:i=>{o([...r.current,i])},children:i=>a.jsx(Gt,{...i,title:"Add",variant:"subtle",size:"sm",color:"green",children:a.jsx(Wv,{})})})})]})]})]})}function cT(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(qc,{value:t,maxWidth:200}),a.jsx(Z,{onClick:o=>{ot(o),r(void 0)},children:"Remove"})]}):a.jsx(Zv,{securityContext:e.securityContext,onUpload:r,children:o=>a.jsx(Z,{...o,children:"Upload..."})})}const uT=["meta","implicitRules","contained","extension","modifierExtension"],dT=["language","text"];function ro(e){return a.jsx(a.Fragment,{children:Si(e.value)})}function I8(e){return a.jsx(a.Fragment,{children:Es(e.value)})}function fT(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 D8(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(fT,{value:r},`telecom-${t.name}-${r.value}`))]}):null}function A8(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 N8(e){return a.jsx(a.Fragment,{children:Y$(e.value)})}function fc(e){return a.jsx(a.Fragment,{children:Jo(e.value)})}function e0(e){return a.jsx(a.Fragment,{children:cc(e.value)})}function O8(e){const t=e.value;return t?a.jsxs(a.Fragment,{children:[a.jsx(fc,{value:t.numerator})," / ",a.jsx(fc,{value:t.denominator})]}):null}function zd(e){if(!e.value)return null;const t=e.value.display||e.value.reference||er(e.value);return e.link!==!1&&e.value.reference?a.jsx($e,{to:e.value,children:t}):a.jsx(a.Fragment,{children:t})}const Zt=C.createContext({path:"",profileUrl:void 0,elements:Object.create(null),elementsByPath:Object.create(null),debugMode:!1});Zt.displayName="ElementsContext";const t0=["extension","modifierExtension"],M8=["id",...uT].filter(e=>!t0.includes(e));function $8(e){return Object.entries(e).filter(([n,r])=>{var o;return!Dt(r.type)||r.max===0||r.path.toLowerCase().endsWith("extension.url")&&r.fixed||t0.includes(n)&&!Dt((o=r.slicing)==null?void 0:o.slices)||M8.includes(n)?!1:!(dT.includes(n)&&r.path.split(".").length===2||n.includes("."))})}function hT(e,t,n,r){if(!Dt(n==null?void 0:n.slices))return[e];const o=new Array(t.length+1);for(let i=0;i<o.length;i++)o[i]=[];for(const i of e){const s=KP(i,t,n.discriminator,r);let l=s?t.findIndex(c=>c.name===s):-1;l===-1&&(l=t.length),o[l].push(i)}return o}async function pT({medplum:e,property:t}){return new Promise((n,r)=>{var l,c;if(!t.slicing){n([]);return}const o=[],i=[],s=[];for(const u of t.slicing.slices){if(!QP(u)){console.debug("Unsupported slice definition",u);continue}let d;Dt(u.elements)||(d=(c=(l=u.type[0])==null?void 0:l.profile)==null?void 0:c[0]),o.push(u),i.push(d),d?s.push(e.requestProfileSchema(d)):s.push(Promise.resolve([]))}Promise.all(s).then(()=>{for(let u=0;u<o.length;u++){const d=o[u],f=i[u];if(f){const h=Cs(f);d.typeSchema=h}}n(o)}).catch(r)})}function nh(e,t,n){return t!==void 0?a.jsx(e,{value:t,children:n}):n}function L8(e){var s,l;const{slice:t,property:n}=e,r=((s=t.typeSchema)==null?void 0:s.elements)??t.elements,o=p.useContext(Zt),i=p.useMemo(()=>{var c;if(Dt(r))return _a({parentContext:o,elements:r,path:e.path,profileUrl:(c=t.typeSchema)==null?void 0:c.url})},[o,e.path,(l=t.typeSchema)==null?void 0:l.url,r]);return nh(Zt.Provider,i,a.jsx(a.Fragment,{children:e.value.map((c,u)=>a.jsx("div",{children:a.jsx(Fr,{property:n,path:e.path,arrayElement:!0,elementDefinitionType:t.type[0],propertyType:t.type[0].code,value:c,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},`${u}-${e.value.length}`))}))}function F8(e){var g;const{property:t,propertyType:n}=e,r=ee(),o=p.useMemo(()=>Array.isArray(e.values)?e.values:[],[e.values]),[i,s]=p.useState(!0),[l,c]=p.useState([]),[u,d]=p.useState(()=>[o]),f=p.useContext(Zt);if(p.useEffect(()=>{pT({medplum:r,property:t}).then(y=>{c(y);const S=hT(o,y,t.slicing,f.profileUrl);d(S),s(!1)}).catch(y=>{console.error(y),s(!1)})},[r,t,f.profileUrl,d,o]),i)return a.jsx("div",{children:"Loading..."});let h;if(((g=t.type[0])==null?void 0:g.code)!=="Extension"){const y=u[l.length],S=y.map((v,x)=>a.jsx("div",{children:a.jsx(Fr,{path:e.path,arrayElement:!0,property:t,propertyType:n,value:v,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},`${x}-${y.length}`));if(e.includeDescriptionListEntry){if(!Dt(e.path))throw new Error("props.path is required when includeDescriptionListEntry is true");const v=e.path.split(".").pop();h=a.jsx(bo,{term:as(v),children:S})}else h=a.jsx(a.Fragment,{children:S})}return a.jsxs(a.Fragment,{children:[l.map((y,S)=>{if(!e.path)throw Error(`Displaying a resource property with slices of type ${e.propertyType} requires path`);let v=a.jsx(L8,{path:e.path,slice:y,property:t,value:u[S],ignoreMissingValues:e.ignoreMissingValues,link:e.link},y.name);return e.includeDescriptionListEntry&&(v=a.jsx(bo,{term:as(y.name),children:v},y.name)),v}),h]})}function Gc(e,t,n){const r=an(e,t,{profileUrl:n});return r?Array.isArray(r)?[r.map(o=>o.value),r[0].type]:[r.value,r.type]:[void 0,"undefined"]}function z8(e,t,n){const r=SP(e,t,n);return r?Array.isArray(r)?[r.map(o=>o.value),r[0].type]:[r.value,r.type]:[void 0,"undefined"]}function B8(e){const{elementDefinitionType:t}=e,n=ee(),r=p.useContext(Zt),[o,i]=p.useState(xP("Extension")),s=p.useMemo(()=>{if(Dt(t==null?void 0:t.profile))return t.profile[0]},[t]),[l,c]=p.useState(s!==void 0);if(p.useEffect(()=>{s&&(c(!0),n.requestProfileSchema(s).then(()=>{const f=Cs(s);c(!1),f&&i(f)}).catch(f=>{c(!1),console.warn(f)}))},[n,s]),s&&(l||!Rv(s)))return a.jsx("div",{children:"Loading..."});const u=o.elements["value[x]"];if((u==null?void 0:u.max)!==0){const[f,h]=Gc({type:"Extension",value:e.value},"value[x]",s??r.profileUrl);return a.jsx(Fr,{propertyType:h,value:f})}return a.jsx(Bd,{path:e.path,value:{type:o.name,value:e.value},compact:e.compact,ignoreMissingValues:e.ignoreMissingValues,link:e.link,profileUrl:s})}function Fr(e){var s;const{property:t,propertyType:n,value:r}=e;if((s=t==null?void 0:t.path)==null?void 0:s.endsWith(".id"))return a.jsxs(H,{component:"div",style:{display:"flex",gap:3,alignItems:"center"},children:[r,!At(r)&&a.jsx(Rj,{value:r,timeout:2e3,children:({copied:l,copy:c})=>a.jsx(Ga,{label:l?"Copied":"Copy",withArrow:!0,position:"right",children:a.jsx(Gt,{variant:"subtle",color:l?"teal":"gray",onClick:c,children:l?a.jsx(th,{size:"1rem"}):a.jsx(tT,{size:"1rem"})})})})]});const i=!!e.arrayElement;if(t!=null&&t.max&&t.max>1&&!i)return n===V.Attachment?a.jsx(R8,{values:r,maxWidth:e.maxWidth,includeDescriptionListEntry:e.includeArrayDescriptionListEntry,property:t,path:e.path}):a.jsx(F8,{path:e.path,property:t,propertyType:n,values:r,includeDescriptionListEntry:e.includeArrayDescriptionListEntry,ignoreMissingValues:e.ignoreMissingValues,link:e.link});switch(n){case V.boolean:return a.jsx(a.Fragment,{children:r===void 0?"":(!!r).toString()});case V.SystemString:case V.string:return a.jsx("div",{style:{whiteSpace:"pre-wrap"},children:r});case V.code:case V.date:case V.decimal:case V.id:case V.integer:case V.positiveInt:case V.unsignedInt:case V.uri:case V.url:return a.jsx(a.Fragment,{children:r});case V.canonical:return a.jsx(zd,{value:{reference:r},link:e.link});case V.dateTime:case V.instant:return a.jsx(a.Fragment,{children:En(r)});case V.markdown:return a.jsx("pre",{children:r});case V.Address:return a.jsx(V7,{value:r});case V.Annotation:return a.jsx(a.Fragment,{children:r==null?void 0:r.text});case V.Attachment:return a.jsx(qc,{value:r,maxWidth:e.maxWidth});case V.CodeableConcept:return a.jsx(ro,{value:r});case V.Coding:return a.jsx(I8,{value:r});case V.ContactDetail:return a.jsx(D8,{value:r});case V.ContactPoint:return a.jsx(fT,{value:r});case V.HumanName:return a.jsx(Qv,{value:r});case V.Identifier:return a.jsx(A8,{value:r});case V.Money:return a.jsx(N8,{value:r});case V.Period:return a.jsx(a.Fragment,{children:W$(r)});case V.Quantity:case V.Duration:return a.jsx(fc,{value:r});case V.Range:return a.jsx(e0,{value:r});case V.Ratio:return a.jsx(O8,{value:r});case V.Reference:return a.jsx(zd,{value:r,link:e.link});case V.Timing:return a.jsx(a.Fragment,{children:AP(r)});case V.Dosage:case V.UsageContext:if(!e.path)throw Error(`Displaying property of type ${e.propertyType} requires path`);return a.jsx(Bd,{path:e.path,value:{type:n,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues});case V.Extension:if(!e.path)throw Error(`Displaying property of type ${e.propertyType} requires path`);return a.jsx(B8,{path:e.path,value:r,compact:!0,ignoreMissingValues:e.ignoreMissingValues,elementDefinitionType:e.elementDefinitionType});default:if(!t)throw Error(`Displaying property of type ${e.propertyType} requires element schema`);if(!e.path)throw Error(`Displaying property of type ${e.propertyType} requires path`);return a.jsx(Bd,{path:e.path,value:{type:t.type[0].code,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues})}}const mT=["extension","modifierExtension"],U8=uT.filter(e=>!mT.includes(e));function Bd(e){const t=e.value,{value:n,type:r}=t,o=p.useContext(Zt),i=e.profileUrl??(o==null?void 0:o.profileUrl),s=p.useMemo(()=>Gf(r,i),[i,r]),l=p.useMemo(()=>{if(s)return _a({parentContext:o,elements:s.elements,path:e.path,profileUrl:s.url})},[s,e.path,o]);if(At(n))return null;if(!s)return a.jsxs("div",{children:[r," not implemented"]});if(typeof n=="object"&&"name"in n&&Object.keys(n).length===1&&typeof n.name=="string")return a.jsx("div",{children:n.name});const c=l??o;return nh(Zt.Provider,l,a.jsx(Jv,{compact:e.compact,children:Object.entries(c.elements).map(([u,d])=>{var y;if(mT.includes(u)&&At((y=d.slicing)==null?void 0:y.slices))return null;if(U8.includes(u))return null;if(dT.includes(u)&&d.path.split(".").length===2||u.includes("."))return null;const[f,h]=Gc(t,u,c.profileUrl);if((e.ignoreMissingValues||d.max===0)&&At(f)||e.path.endsWith(".extension")&&(u==="url"||u==="id"))return null;const m=d.max>1||d.isArray,g=a.jsx(Fr,{property:d,propertyType:h,path:e.path+"."+u,value:f,ignoreMissingValues:e.ignoreMissingValues,includeArrayDescriptionListEntry:m,link:e.link},u);return m?g:a.jsx(bo,{term:as(u),children:g},u)})}))}function gT(e){const{debugMode:t}=p.useContext(Zt);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(bt.Wrapper,{id:e.htmlFor,label:n,description:e.description,withAsterisk:e.withAsterisk,children:null})})]})}function Ue(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 yT((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(`
508
+ `)}function Qc(e,t){var n;return(n=e==null?void 0:e.issue)==null?void 0:n.filter(r=>{var o;return yT((o=r.expression)==null?void 0:o[0],t)})}const Au=/\[\d+\]/;function yT(e,t){const n=typeof e=="string"&&Au.test(e),r=typeof t=="string"&&Au.test(t);if(n!==r&&(e=e==null?void 0:e.replace(Au,""),t=t==null?void 0:t.replace(Au,"")),e===t)return!0;if(!e||!t)return!1;const o=e.indexOf(".");if(o>=0&&e.substring(o+1)===t)return!0;const i=t.indexOf(".");return i>=0&&t.substring(i+1)===e}function st(e){const{debugMode:t}=p.useContext(Zt);let n;return t&&e.fhirPath?n=`${e.title} - ${e.fhirPath}`:n=e.title,a.jsx(bt.Wrapper,{id:e.htmlFor,label:n,description:e.description,withAsterisk:e.withAsterisk,error:Ue(e.outcome,e.errorExpression??e.htmlFor),"data-testid":e.testId,children:e.children})}function vT(e,t,n,r,o){const i=r.type;if(i.length>1)for(const s of i){const l=t.replace("[x]",Vt(s.code));l in e&&delete e[l]}return e[n]=o,e}function V8(e){return!!e&&!At(e.url)&&!At(e.name)}function H8(e){const{defaultValue:t,onChange:n,withHelpText:r,outcome:o,path:i,valuePath:s,...l}=e,[c,u]=p.useState(t);function d(f){const h=q8(f);u(h),n&&n(h)}return a.jsx(Yv,{defaultValue:c&&W8(c),onChange:d,withHelpText:r??!0,...l})}function W8(e){var t;return(t=e.coding)==null?void 0:t.map(n=>({system:n.system,code:n.code,display:n.display}))}function q8(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,withHelpText:r,...o}=e,[i,s]=p.useState(t);function l(c){const u=c[0],d=u&&Q8(u);s(d),n&&n(d)}return a.jsx(Yv,{defaultValue:i&&G8(i),maxValues:1,onChange:l,withHelpText:r??!0,...o})}function G8(e){return{system:e.system,code:e.code,display:e.display}}function Q8(e){return{system:e.system,code:e.code,display:e.display}}function wT(e){const{path:t,outcome:n}=e,{elementsByPath:r}=p.useContext(Zt),[o,i]=p.useState(e.defaultValue),s=p.useRef();s.current=o;const[l,c,u]=p.useMemo(()=>["system","use","value"].map(y=>r[t+"."+y]),[r,t]);function d(y){y&&Object.keys(y).length===0&&(y=void 0),i(y),e.onChange&&e.onChange(y)}function f(y){const S={...s.current,system:y};y||delete S.system,d(S)}function h(y){const S={...s.current,use:y};y||delete S.use,d(S)}function m(y){const S={...s.current,value:y};y||delete S.value,d(S)}const g=e.valuePath??t;return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(wt,{"data-testid":"system",defaultValue:o==null?void 0:o.system,required:((l==null?void 0:l.min)??0)>0,onChange:y=>f(y.currentTarget.value),data:["","email","phone","fax","pager","sms","other"],error:Ue(n,g+".system")}),a.jsx(wt,{"data-testid":"use",defaultValue:o==null?void 0:o.use,required:((c==null?void 0:c.min)??0)>0,onChange:y=>h(y.currentTarget.value),data:["","home","work","temp","old","mobile"],error:Ue(n,g+".use")}),a.jsx(ie,{placeholder:"Value",defaultValue:o==null?void 0:o.value,required:((u==null?void 0:u.min)??0)>0,onChange:y=>m(y.currentTarget.value),error:Ue(n,g+".value")})]})}function K8(e){var l;const[t,n]=p.useState(e.defaultValue),r=p.useRef();r.current=t;function o(c){n(c),e.onChange&&e.onChange(c)}function i(c){const u={...r.current,name:c};c||delete u.name,o(u)}function s(c){const u={...r.current,telecom:c&&[c]};c||delete u.telecom,o(u)}return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(ie,{"data-testid":e.name+"-name",name:e.name+"-name",placeholder:"Name",style:{width:180},defaultValue:t==null?void 0:t.name,onChange:c=>i(c.currentTarget.value)}),a.jsx(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 Y8(e){if(!e)return"";const t=new Date(e);return Kf(t)?t.toLocaleDateString("sv")+"T"+t.toLocaleTimeString("sv"):""}function ST(e){if(!e)return"";const t=new Date(e);return Kf(t)?t.toISOString():""}var X8={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.1.1-5c643b5a7",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function ls(e){return a.jsx(ie,{id:e.name,name:e.name,label:e.label,"data-autofocus":e.autoFocus,"data-testid":e.name,placeholder:e.placeholder,required:e.required,type:J8(),defaultValue:Y8(e.defaultValue),autoFocus:e.autoFocus,error:Ue(e.outcome,e.name),onChange:t=>{if(e.onChange){const n=t.currentTarget.value;e.onChange(ST(n))}}})}function J8(){return X8.NODE_ENV==="test"?"text":"datetime-local"}function Z8(e){const{propertyType:t}=e,n=ee(),[r,o]=p.useState(),i=p.useMemo(()=>{if(Dt(t.profile))return t.profile[0]},[t]),[s,l]=p.useState(i!==void 0);return p.useEffect(()=>{i&&(l(!0),n.requestProfileSchema(i).then(()=>{const c=Cs(i);l(!1),o(c)}).catch(c=>{l(!1),console.warn(c)}))},[n,i]),i&&(s||!Rv(i))?a.jsx("div",{children:"Loading..."}):a.jsx(o0,{profileUrl:i,path:e.path,typeName:(r==null?void 0:r.name)??"Extension",defaultValue:e.defaultValue,onChange:e.onChange})}function eF(e){var h,m,g;const{outcome:t,path:n}=e,[r,o]=p.useState(e.defaultValue);function i(y){o(y),e.onChange&&e.onChange(y)}function s(y){i({...r,use:y||void 0})}function l(y){i({...r,prefix:y?y.split(" "):void 0})}function c(y){i({...r,given:y?y.split(" "):void 0})}function u(y){i({...r,family:y||void 0})}function d(y){i({...r,suffix:y?y.split(" "):void 0})}const f=e.valuePath??n;return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(wt,{defaultValue:r==null?void 0:r.use,name:e.name+"-use","data-testid":"use",onChange:y=>s(y.currentTarget.value),data:["","temp","old","usual","official","nickname","anonymous","maiden"],error:Ue(t,f+".use")}),a.jsx(ie,{placeholder:"Prefix",name:e.name+"-prefix",defaultValue:(h=r==null?void 0:r.prefix)==null?void 0:h.join(" "),onChange:y=>l(y.currentTarget.value),error:Ue(t,f+".prefix")}),a.jsx(ie,{placeholder:"Given",name:e.name+"-given",defaultValue:(m=r==null?void 0:r.given)==null?void 0:m.join(" "),onChange:y=>c(y.currentTarget.value),error:Ue(t,f+".given")}),a.jsx(ie,{name:e.name+"-family",placeholder:"Family",defaultValue:r==null?void 0:r.family,onChange:y=>u(y.currentTarget.value),error:Ue(t,f+".family")}),a.jsx(ie,{placeholder:"Suffix",name:e.name+"-suffix",defaultValue:(g=r==null?void 0:r.suffix)==null?void 0:g.join(" "),onChange:y=>d(y.currentTarget.value),error:Ue(t,f+".suffix")})]})}function tF(e){const[t,n]=p.useState(e.defaultValue),{elementsByPath:r}=p.useContext(Zt),[o,i]=p.useMemo(()=>["system","value"].map(c=>r[e.path+"."+c]),[r,e.path]);function s(c){n(c),e.onChange&&e.onChange(c)}const l=e.valuePath??e.path;return a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(ie,{placeholder:"System",required:((o==null?void 0:o.min)??0)>0,defaultValue:t==null?void 0:t.system,onChange:c=>s({...t,system:c.currentTarget.value}),error:Ue(e.outcome,l+".system")}),a.jsx(ie,{placeholder:"Value",required:((i==null?void 0:i.min)??0)>0,defaultValue:t==null?void 0:t.value,onChange:c=>s({...t,value:c.currentTarget.value}),error:Ue(e.outcome,l+".value")})]})}const nF=["USD","EUR","CAD","GBP","AUD"];function rF(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(wt,{defaultValue:n==null?void 0:n.currency,data:nF,styles:{input:{fontWeight:500,borderTopLeftRadius:0,borderBottomLeftRadius:0,width:92}},onChange:i});return a.jsx(ie,{type:"number",name:e.name,label:e.label,placeholder:e.placeholder??"Value",defaultValue:((c=n==null?void 0:n.value)==null?void 0:c.toString())??"USD",leftSection:a.jsx(s6,{size:14}),rightSection:l,rightSectionWidth:92,onChange:s})}function oF(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(ls,{name:e.name+".start",placeholder:"Start",defaultValue:t==null?void 0:t.start,onChange:o=>r({...t,start:o})}),a.jsx(ls,{name:e.name+".end",placeholder:"End",defaultValue:t==null?void 0:t.end,onChange:o=>r({...t,end:o})})]})}function cs(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(wt,{style:{width:80},"data-testid":e.name+"-comparator",defaultValue:t==null?void 0:t.comparator,data:["","<","<=",">=",">"],onChange:o=>r({...t,comparator:o.currentTarget.value})}),a.jsx(ie,{id:e.name,name:e.name,required:e.required,"data-autofocus":e.autoFocus,"data-testid":e.name+"-value",type:"number",placeholder:"Value",defaultValue:t==null?void 0:t.value,autoFocus:e.autoFocus,step:"any",onWheel:o=>{e.disableWheel&&o.currentTarget.blur()},onChange:o=>{r({...t,value:iF(o.currentTarget.value)})}}),a.jsx(ie,{placeholder:"Unit","data-testid":e.name+"-unit",defaultValue:t==null?void 0:t.unit,onChange:o=>r({...t,unit:o.currentTarget.value})})]})}function iF(e){if(e)return parseFloat(e)}function n0(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(cs,{name:e.name+"-low",defaultValue:t==null?void 0:t.low,onChange:o=>r({...t,low:o})}),a.jsx(cs,{name:e.name+"-high",defaultValue:t==null?void 0:t.high,onChange:o=>r({...t,high:o})})]})}function sF(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(cs,{name:e.name+"-numerator",defaultValue:t==null?void 0:t.numerator,onChange:o=>r({...t,numerator:o})}),a.jsx(cs,{name:e.name+"-denominator",defaultValue:t==null?void 0:t.denominator,onChange:o=>r({...t,denominator:o})})]})}const aF={Device:"device-name",Observation:"code",User:"email:contains"},lF=["AccessPolicy","Account","ActivityDefinition","Bot","CapabilityStatement","CareTeam","ClientApplication","CodeSystem","CompartmentDefinition","ConceptMap","EffectEvidenceSynthesis","Endpoint","EventDefinition","Evidence","EvidenceVariable","ExampleScenario","GraphDefinition","Group","HealthcareService","ImplementationGuide","InsurancePlan","Library","Location","Measure","MedicinalProduct","MessageDefinition","NamingSystem","OperationDefinition","Organization","Patient","Person","PlanDefinition","Practitioner","Project","Questionnaire","RelatedPerson","ResearchDefinition","ResearchElementDefinition","RiskEvidenceSynthesis","SearchParameter","StructureDefinition","StructureMap","TerminologyCapabilities","TestScript","UserConfiguration","ValueSet"];function cF(e){return{value:ht(e),label:_o(e),resource:e}}function Ka(e){const t=ee(),{resourceType:n,searchCriteria:r}=e,[o,i]=p.useState(),s=lt(e.defaultValue,i),l=e.onChange,c=p.useCallback(async(d,f)=>{const h=dF(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 Dt(e.defaultValue)&&!o&&!s?null:a.jsx(Kv,{name:e.name,required:e.required,itemComponent:uF,defaultValue:s,placeholder:e.placeholder,maxValues:1,toOption:cF,loadOptions:c,onChange:u,clearable:!0})}const uF=p.forwardRef(({label:e,resource:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs(Y,{wrap:"nowrap",children:[a.jsx(Ti,{value:t}),a.jsxs("div",{children:[a.jsx(oe,{children:e}),a.jsx(oe,{size:"xs",c:"dimmed",children:t.birthDate})]})]})}));function dF(e){return aF[e]??(lF.includes(e)?"name":"_id")}function rh(e){const{onChange:t}=e,n=ee(),[r,o]=p.useState(e.defaultValue),[i,s]=p.useState(()=>fF(e.targetTypes)),[l,c]=p.useState(()=>hF(e.defaultValue,i)),u=p.useRef(new HP),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(!mF(y))return Promise.resolve(y);m=!0;const S=y.value,v=u.current.get(S);if(v)return v;const x=pF(n,y.value).then(b=>{const j={...y};return b?Dt(b.type)?(j.resourceType=b.type,j.name=b.name,j.title=b.title):(console.error(`StructureDefinition.type missing for ${y.value}`),j.error="StructureDefinition.type missing"):(console.error(`StructureDefinition not found for ${y.value}`),j.error="StructureDefinition not found"),j}).catch(b=>(console.error(b),{...y,error:b})),w=new Pr(x);return u.current.set(S,w),w});!g||!m||Promise.all(g).then(y=>{if(s(y),!l)return;const S=y.findIndex(v=>v.value===l.value||v.resourceType===l.resourceType);if(S===-1){console.debug(`defaultValue had unexpected resourceType: ${l.resourceType}`);return}c(y[S])}).catch(console.error)},[n,l,i]);const f=p.useCallback(m=>{const g=m?ft(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(wt,{"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(S=>S.value===g);c(y)},data:h}),!i&&a.jsx(Xv,{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(Ka,{resourceType:l==null?void 0:l.resourceType,name:e.name+"-id",required:e.required,placeholder:e.placeholder,defaultValue:r,searchCriteria:d,onChange:f})]})}function fF(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 hF(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 pF(e,t){const n=Cs(t);if(n)return{type:n.type,name:n.name,title:n.title};const r=`{
509
+ StructureDefinitionList(url: "${t}", _sort: "_lastUpdated", _count: 1) {
510
+ type,
511
+ name,
512
+ title,
513
+ }
514
+ }`.replace(/\s+/g," ");return(await e.graphql(r)).data.StructureDefinitionList[0]}function mF(e){return e.type==="profile"&&!(e!=null&&e.error)&&At(e.resourceType)}function bT({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(Ld,{size:"1.25rem"}),onClick:t,children:r}):a.jsx(Gt,{title:r,color:"green.6","data-testid":n,onClick:t,children:a.jsx(Ld,{size:"1.25rem"})})}function CT({propertyDisplayName:e,onClick:t,testId:n}){return a.jsx(Gt,{title:e?`Remove ${e}`:"Remove",color:"red.5","data-testid":n,variant:"subtle",onClick:t,children:a.jsx($d,{size:"1.25rem"})})}const gF="_indented_ldk1d_1",ET={indented:gF};function yF(e){var h,m;const{slice:t,property:n}=e,[r,o]=p.useState(e.defaultValue),i=((h=t.typeSchema)==null?void 0:h.elements)??t.elements,s=p.useContext(Zt),l=p.useMemo(()=>{var g;if(Dt(i))return _a({parentContext:s,elements:i,path:e.path,profileUrl:(g=t.typeSchema)==null?void 0:g.url})},[s,e.path,(m=t.typeSchema)==null?void 0:m.url,i]);function c(g){o(g),e.onChange&&e.onChange(g)}const u=t.min>0,d=At(t.elements),f=MP(t.name);return nh(Zt.Provider,l,a.jsx(st,{title:f,description:t.definition,withAsterisk:u,fhirPath:`${n.path}:${t.name}`,testId:e.testId,children:a.jsxs(je,{className:d?ET.indented:void 0,children:[r.map((g,y)=>a.jsxs(Y,{wrap:"nowrap",children:[a.jsx("div",{style:{flexGrow:1},"data-testid":e.testId&&`${e.testId}-elements-${y}`,children:a.jsx(r0,{elementDefinitionType:t.type[0],name:t.name,defaultValue:g,onChange:S=>{const v=[...r];v[y]=S,c(v)},outcome:e.outcome,min:t.min,max:t.max,binding:t.binding,path:e.path,valuePath:void 0})}),r.length>t.min&&a.jsx(CT,{propertyDisplayName:f,testId:e.testId&&`${e.testId}-remove-${y}`,onClick:S=>{ot(S);const v=[...r];v.splice(y,1),c(v)}})]},`${y}-${r.length}`)),r.length<t.max&&a.jsx(Y,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(bT,{propertyDisplayName:f,onClick:g=>{ot(g);const y=[...r,void 0];c(y)},testId:e.testId&&`${e.testId}-add`})})]})}))}function vF(e,t,n){return t===void 0?e:n===void 0?t:`${t}[${n}]`}function xF(e){var v;const{property:t}=e,n=ee(),[r,o]=p.useState(!0),[i,s]=p.useState([]),[l]=p.useState(()=>Array.isArray(e.defaultValue)?e.defaultValue:[]),[c,u]=p.useState(()=>[l]),d=p.useContext(Zt),f=(v=t.type[0])==null?void 0:v.code;p.useEffect(()=>{pT({medplum:n,property:t}).then(x=>{s(x);const w=hT(l,x,t.slicing,d.profileUrl);wF(w,x),u(w),o(!1)}).catch(x=>{console.error(x),o(!1)})},[n,t,l,d.profileUrl,u]);function h(x,w){const b=[...c];if(b[w]=x,u(b),e.onChange){const j=b.flat().filter(E=>E!==void 0);e.onChange(j)}}if(r)return a.jsx("div",{children:"Loading..."});const m=i.length,g=c[m],y=!(e.hideNonSliceValues??(f==="Extension"&&i.length>0)),S=as(t.path);return a.jsxs(je,{className:e.indent?ET.indented:void 0,children:[i.map((x,w)=>a.jsx(yF,{slice:x,path:e.path,valuePath:e.valuePath,property:t,defaultValue:c[w],onChange:b=>{h(b,w)},testId:`slice-${x.name}`},x.name)),y&&g.map((x,w)=>a.jsxs(Y,{wrap:"nowrap",style:{flexGrow:1},children:[a.jsx("div",{style:{flexGrow:1},children:a.jsx(Ya,{arrayElement:!0,property:e.property,name:e.name+"."+w,path:e.path,valuePath:vF(e.path,e.valuePath,w),defaultValue:x,onChange:b=>{const j=[...g];j[w]=b,h(j,m)},defaultPropertyType:void 0,outcome:e.outcome})}),a.jsx(CT,{propertyDisplayName:S,testId:`nonsliced-remove-${w}`,onClick:b=>{ot(b);const j=[...g];j.splice(w,1),h(j,m)}})]},`${w}-${g.length}`)),y&&c.flat().length<t.max&&a.jsx(Y,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(bT,{propertyDisplayName:S,onClick:x=>{ot(x);const w=[...g];w.push(void 0),h(w,m)},testId:"nonsliced-add"})})]})}function wF(e,t){for(let n=0;n<t.length;n++){const r=t[n],o=e[n];for(;o.length<r.min;)o.push(void 0)}}function SF(e){const[t,n]=p.useState(!1),r=$S(),o=p.useRef(null),i={...e.styles};return t||(i.input||(i.input={}),i.input.WebkitTextSecurity="disc"),a.jsxs(os,{gap:"xs",children:[a.jsx(ws,{...e,styles:{...i,root:{...i.root??{},flexGrow:1}},ref:o,autosize:!0,minRows:1,onFocus:()=>n(!0),onBlur:()=>n(!1)}),a.jsx(Gt,{title:"Copy secret",onClick:()=>{var s;r.copy((s=o.current)==null?void 0:s.value),ue({color:"green",message:"Copied"})},children:a.jsx(tT,{})})]})}const bF=["sun","mon","tue","wed","thu","fri","sat"];function CF(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:AP(i.current)||"No repeat"}),a.jsx(Z,{onClick:()=>o(!0),children:"Edit"})]}),a.jsx(EF,{visible:r,defaultValue:i.current,onOk:s=>{e.onChange&&e.onChange(s),n(s),o(!1)},onCancel:()=>o(!1)})]})}const xw={repeat:{period:1,periodUnit:"d"}};function EF(e){const[t,n]=p.useState(e.defaultValue||xw),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(Rn,{title:"Timing",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:()=>e.onCancel(),children:a.jsxs(je,{children:[a.jsx(st,{title:"Starts on",htmlFor:"timing-dialog-start",children:a.jsx(ls,{name:"timing-dialog-start",onChange:u=>o(u)})}),a.jsx(Mc,{label:"Repeat",checked:!!t.repeat,onChange:u=>i(u.currentTarget.checked?xw.repeat:void 0)}),t.repeat&&a.jsxs(a.Fragment,{children:[a.jsx(st,{title:"Repeat every",htmlFor:"timing-dialog-period",children:a.jsxs(Y,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(ie,{type:"number",step:1,id:"timing-dialog-period",name:"timing-dialog-period",defaultValue:t.repeat.period||1,onChange:u=>s(parseInt(u.currentTarget.value,10)||1)}),a.jsx(wt,{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(st,{title:"Repeat on",children:a.jsx(ic.Group,{multiple:!0,onChange:c,children:a.jsx(Y,{justify:"space-between",mt:"md",gap:"xs",children:bF.map(u=>a.jsx(ic,{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 Ya(e){var l;const{property:t,name:n,onChange:r,defaultValue:o}=e,i=e.defaultPropertyType&&e.defaultPropertyType!=="undefined"?e.defaultPropertyType:t.type[0].code,s=t.type;if((t.isArray||t.max>1)&&!e.arrayElement){if(i===V.Attachment)return a.jsx(_8,{name:n,defaultValue:o,onChange:r});const c=((l=s[0])==null?void 0:l.code)!==V.Extension;return a.jsx(xF,{property:t,name:n,path:e.path,valuePath:e.valuePath,defaultValue:o,indent:c,onChange:r,outcome:e.outcome})}else return s.length>1?a.jsx(jF,{elementDefinitionTypes:s,...e}):a.jsx(r0,{name:n,defaultValue:o,onChange:c=>{if(e.onChange){const u=e.name.replace("[x]",Vt(s[0].code));e.onChange(c,u)}},outcome:e.outcome,elementDefinitionType:s[0],min:t.min,max:t.min,binding:t.binding,path:e.path,valuePath:e.valuePath})}function jF(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(wt,{style:{width:"200px"},defaultValue:r.code,"data-testid":e.name&&e.name+"-selector",onChange:i=>{o(t.find(s=>s.code===i.currentTarget.value))},data:t.map(i=>({value:i.code,label:i.code}))}),a.jsx(r0,{name:e.name,defaultValue:e.defaultValue,outcome:e.outcome,elementDefinitionType:r,onChange:i=>{e.onChange&&e.onChange(i,e.name.replace("[x]",Vt(r.code)))},min:e.property.min,max:e.property.max,binding:e.property.binding,path:e.property.path,valuePath:e.valuePath})]})}function r0(e){const{name:t,onChange:n,outcome:r,binding:o,path:i,valuePath:s}=e,l=e.min!==void 0&&e.min>0,c=e.elementDefinitionType.code,u=p.useContext(Zt),d=p.useMemo(()=>{if(!Dv(c)||!At(e.defaultValue))return e.defaultValue;const m=Object.create(null);if(u.path===e.path)lw(m,u.elements);else{const g=ac(u.path,e.path);if(g===void 0)return e.defaultValue;lw(m,u.elements,g)}return Dt(m)?m:e.defaultValue},[c,u.path,u.elements,e.path,e.defaultValue]);if(!c)return a.jsx("div",{children:"Property type not specified "});function f(){return{name:t,defaultValue:d,onChange:n,outcome:r,path:i,valuePath:s}}function h(){const m=Ue(e.outcome,s??i);return{id:t,name:t,"data-testid":t,defaultValue:d,required:l,error:m}}switch(c){case V.SystemString:case V.canonical:case V.string:case V.time:case V.uri:case V.url:return e.path==="Project.secret.value[x]"?a.jsx(SF,{...h(),onChange:m=>{e.onChange&&e.onChange(m.currentTarget.value)}}):a.jsx(ie,{...h(),onChange:m=>{n&&n(m.currentTarget.value)}});case V.date:return a.jsx(ie,{...h(),type:"date",onChange:m=>{n&&n(m.currentTarget.value)}});case V.dateTime:case V.instant:return a.jsx(ls,{name:t,defaultValue:d,onChange:n,outcome:r});case V.decimal:case V.integer:case V.positiveInt:case V.unsignedInt:return a.jsx(ie,{...h(),type:"number",step:c===V.decimal?"any":"1",onChange:m=>{if(n){const g=m.currentTarget.valueAsNumber;n(Number.isNaN(g)?void 0:g)}}});case V.code:return a.jsx(lT,{...h(),error:void 0,onChange:n,binding:o==null?void 0:o.valueSet});case V.boolean:return a.jsx(gr,{...h(),defaultChecked:!!d,onChange:m=>{n&&n(m.currentTarget.checked)}});case V.base64Binary:case V.markdown:return a.jsx(ws,{...h(),spellCheck:c!==V.base64Binary,onChange:m=>{n&&n(m.currentTarget.value)}});case V.Address:return a.jsx(H7,{...f()});case V.Annotation:return a.jsx(W7,{...f()});case V.Attachment:return a.jsx(cT,{...f()});case V.CodeableConcept:return a.jsx(H8,{binding:o==null?void 0:o.valueSet,...f()});case V.Coding:return a.jsx(xT,{binding:o==null?void 0:o.valueSet,...f()});case V.ContactDetail:return a.jsx(K8,{...f()});case V.ContactPoint:return a.jsx(wT,{...f()});case V.Extension:return a.jsx(Z8,{...f(),propertyType:e.elementDefinitionType});case V.HumanName:return a.jsx(eF,{...f()});case V.Identifier:return a.jsx(tF,{...f()});case V.Money:return a.jsx(rF,{...f()});case V.Period:return a.jsx(oF,{...f()});case V.Duration:case V.Quantity:return a.jsx(cs,{...f()});case V.Range:return a.jsx(n0,{...f()});case V.Ratio:return a.jsx(sF,{...f()});case V.Reference:return a.jsx(rh,{...f(),targetTypes:TF(e.elementDefinitionType)});case V.Timing:return a.jsx(CF,{...f()});case V.Dosage:case V.UsageContext:default:return a.jsx(o0,{...f(),typeName:c})}}const PF=[`${tM}/fhir/StructureDefinition/`,"https://medplum.com/fhir/StructureDefinition/"];function TF(e){var t;return(t=e==null?void 0:e.targetProfile)==null?void 0:t.map(n=>{const r=PF.find(o=>n.startsWith(o));return r?n.slice(r.length):n})}function kF(e){const[t,n]=p.useState(e.defaultValue??{}),r=p.useContext(Zt),o=p.useMemo(()=>$8(r.elements),[r.elements]);function i(l){n(l),e.onChange&&e.onChange(l)}const s={type:e.type,value:t};return a.jsx(je,{style:{flexGrow:1},"data-testid":e.testId,children:o.map(([l,c])=>{const[u,d]=z8(s,l,c),f=c.min!==void 0&&c.min>0,h=e.valuePath?e.valuePath+"."+l:void 0,m=a.jsx(Ya,{property:c,name:l,path:e.path+"."+l,valuePath:h,defaultValue:u,defaultPropertyType:d,onChange:(g,y)=>{i(vT({...t},l,y??l,c,g))},outcome:e.outcome},l);return e.type==="Extension"||t0.includes(l)?m:c.type.length===1&&c.type[0].code==="boolean"?a.jsx(gT,{title:as(l),description:c.description,htmlFor:l,fhirPath:c.path,withAsterisk:f,children:m},l):a.jsx(st,{title:as(l),description:c.description,withAsterisk:f,htmlFor:l,outcome:e.outcome,fhirPath:c.path,errorExpression:h,children:m},l)})})}function o0(e){const[t]=p.useState(()=>e.defaultValue??{}),n=p.useContext(Zt),r=e.profileUrl??(n==null?void 0:n.profileUrl),o=p.useMemo(()=>Gf(e.typeName,r),[e.typeName,r]),i=(o==null?void 0:o.type)??e.typeName,s=p.useMemo(()=>{if(o)return _a({parentContext:n,elements:o.elements,path:e.path,profileUrl:o.url})},[o,e.path,n]);return o?nh(Zt.Provider,s,a.jsx(kF,{path:e.path,valuePath:e.valuePath,type:i,defaultValue:t,onChange:e.onChange,outcome:e.outcome})):a.jsxs("div",{children:[i," not implemented"]})}const RF="_root_1vii2_1",_F={root:RF};function Kc(e){const{children:t,...n}=e;return a.jsx(Ky,{className:_F.root,...n,children:t})}const IF="_noteBody_10swh_1",DF="_noteCite_10swh_5",AF="_noteRoot_10swh_10",ww={noteBody:IF,noteCite:DF,noteRoot:AF};function jT({value:e}){return e?a.jsx(je,{justify:"flex-start",gap:"xs",children:e.map(t=>{var n;return t.text&&a.jsx(qy,{classNames:{cite:ww.noteCite,root:ww.noteRoot},cite:((n=t.authorReference)==null?void 0:n.display)||t.authorString,icon:null,children:t.text},`note-${t.text}`)})}):null}function Xa(e){const{value:t,link:n,...r}=e,[o,i]=p.useState(),s=lt(t,i);let l;if(o&&!hP(o))l=`[${Re(o)}]`;else if(s)l=_o(s);else return null;return n?a.jsx($e,{to:t,...r,children:l}):a.jsx(oe,{component:"span",...r,children:l})}function ma(e){return a.jsxs(Y,{gap:"xs",children:[a.jsx(Ti,{size:24,radius:12,value:e.value,link:e.link}),a.jsx(Xa,{value:e.value,link:e.link})]})}const NF={draft:"blue",active:"blue","on-hold":"yellow",revoked:"red",completed:"green","entered-in-error":"red",unknown:"gray",retired:"gray",registered:"blue",preliminary:"blue",final:"green",amended:"yellow",corrected:"yellow",cancelled:"red",requested:"blue",received:"blue",accepted:"blue",rejected:"red",ready:"blue","in-progress":"blue",failed:"red",proposed:"blue",pending:"blue",booked:"blue",arrived:"blue",fulfilled:"green",noshow:"red","checked-in":"blue",waitlist:"gray",routine:"gray",urgent:"red",asap:"red",stat:"red","not-done":"red",connected:"green",disconnected:"red"};function i0(e){return a.jsx(Ic,{color:NF[e.status],children:e.status})}const OF="_table_pe9td_1",MF="_criticalRow_pe9td_12",$F="_noteBody_pe9td_23",LF="_noteCite_pe9td_27",FF="_noteRoot_pe9td_32",PT={table:OF,criticalRow:MF,noteBody:$F,noteCite:LF,noteRoot:FF};s0.defaultProps={hideObservationNotes:!1,hideSpecimenInfo:!1};function s0(e){var s;const t=ee(),n=lt(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(je,{children:[a.jsx(le,{children:"Diagnostic Report"}),a.jsx(zF,{value:n}),r&&!e.hideSpecimenInfo&&BF(r),n.result&&a.jsx(UF,{hideObservationNotes:e.hideObservationNotes,value:n.result}),i.length>0&&a.jsx(jT,{value:i})]})}function zF({value:e}){var t,n;return a.jsxs(Y,{mt:"md",gap:30,children:[e.subject&&a.jsxs("div",{children:[a.jsx(oe,{size:"xs",tt:"uppercase",c:"dimmed",children:"Subject"}),a.jsx(ma,{value:e.subject,link:!0})]}),(t=e.resultsInterpreter)==null?void 0:t.map(r=>a.jsxs("div",{children:[a.jsx(oe,{size:"xs",tt:"uppercase",c:"dimmed",children:"Interpreter"}),a.jsx(ma,{value:r,link:!0})]},r.reference)),(n=e.performer)==null?void 0:n.map(r=>a.jsxs("div",{children:[a.jsx(oe,{size:"xs",tt:"uppercase",c:"dimmed",children:"Performer"}),a.jsx(ma,{value:r,link:!0})]},r.reference)),e.issued&&a.jsxs("div",{children:[a.jsx(oe,{size:"xs",tt:"uppercase",c:"dimmed",children:"Issued"}),a.jsx(oe,{children:En(e.issued)})]}),e.status&&a.jsxs("div",{children:[a.jsx(oe,{size:"xs",tt:"uppercase",c:"dimmed",children:"Status"}),a.jsx(oe,{children:Vt(e.status)})]})]})}function BF(e){return a.jsxs(je,{gap:"xs",children:[a.jsx(le,{order:2,size:"h6",children:"Specimens"}),a.jsx(bn,{type:"ordered",children:e==null?void 0:e.map(t=>{var n;return a.jsx(bn.Item,{ml:"sm",children:a.jsxs(Y,{gap:20,children:[a.jsxs(Y,{gap:5,children:[a.jsx(oe,{fw:500,children:"Collected:"})," ",En((n=t.collection)==null?void 0:n.collectedDateTime)]}),a.jsxs(Y,{gap:5,children:[a.jsx(oe,{fw:500,children:"Received:"})," ",En(t.receivedTime)]})]})},`specimen-${t.id}`)})})]})}function UF(e){return a.jsxs("table",{className:PT.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(TT,{value:e.value,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes})})]})}function TT(e){var t;return a.jsx(a.Fragment,{children:(t=e.value)==null?void 0:t.map(n=>a.jsx(VF,{value:n,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes},`obs-${Ps(n)?n.reference:n.id}`))})}function VF(e){var o,i;const t=lt(e.value);if(!t||(o=e.ancestorIds)!=null&&o.includes(t.id))return null;const n=!e.hideObservationNotes&&t.note,r=qF(t);return a.jsxs(a.Fragment,{children:[a.jsxs("tr",{className:et({[PT.criticalRow]:r}),children:[a.jsx("td",{rowSpan:n?2:1,children:a.jsx($e,{to:t,children:a.jsx(ro,{value:t.code})})}),a.jsx("td",{children:a.jsx(HF,{value:t})}),a.jsx("td",{children:a.jsx(WF,{value:t.referenceRange})}),a.jsx("td",{children:t.interpretation&&t.interpretation.length>0&&a.jsx(ro,{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(ro,{value:s})},`category-${Si(s)}`))})}),a.jsx("td",{children:(i=t.performer)==null?void 0:i.map(s=>a.jsx(zd,{value:s},s.reference))}),a.jsx("td",{children:t.status&&a.jsx(i0,{status:t.status})})]}),t.hasMember&&a.jsx(TT,{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(jT,{value:t.note})})})]})}function HF(e){const t=e.value;return a.jsx(a.Fragment,{children:NP(t)})}function WF(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(e0,{value:t}):null}function qF(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 GF="_paper_1igaj_1",QF="_fill_1igaj_20",Sw={paper:GF,fill:QF};function a0(e){const{width:t,fill:n,className:r,children:o,...i}=e,s=t?{maxWidth:t}:void 0;return a.jsx(Fn,{className:et(Sw.paper,n&&Sw.fill,r),style:s,shadow:"sm",radius:"sm",withBorder:!0,...i,children:o})}var kT={},Yc={};Object.defineProperty(Yc,"__esModule",{value:!0});Yc.Pointer=void 0;function KF(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function YF(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}var XF=function(){function e(t){t===void 0&&(t=[""]),this.tokens=t}return e.fromJSON=function(t){var n=t.split("/").map(KF);if(n[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(t));return new e(n)},e.prototype.toString=function(){return this.tokens.map(YF).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}();Yc.Pointer=XF;var Rt={},l0={};(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})(l0);var Sn={};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.diffAny=Sn.diffObjects=Sn.diffArrays=Sn.intersection=Sn.subtract=Sn.isDestructive=void 0;var hc=l0;function JF(e){var t=e.op;return t==="remove"||t==="replace"||t==="copy"||t==="move"}Sn.isDestructive=JF;function Om(e,t){var n={};for(var r in e)hc.hasOwnProperty.call(e,r)&&e[r]!==void 0&&(n[r]=1);for(var o in t)hc.hasOwnProperty.call(t,o)&&t[o]!==void 0&&delete n[o];return Object.keys(n)}Sn.subtract=Om;function RT(e){for(var t=e.length,n={},r=0;r<t;r++){var o=e[r];for(var i in o)hc.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)}Sn.intersection=RT;function ZF(e){return e.op==="add"}function ez(e){return e.op==="remove"}function lp(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function _T(e,t,n,r){r===void 0&&(r=oh);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),S={op:"remove",index:d-1};g.push(lp(y,S))}if(f>0){var v=i(d,f-1),x={op:"add",index:d-1,value:t[f-1]};g.push(lp(v,x))}if(d>0&&f>0){var w=i(d-1,f-1),b={op:"replace",index:d-1,original:e[d-1],value:t[f-1]};g.push(lp(w,b))}var j=g.sort(function(E,P){return E.cost-P.cost})[0];m=j}o[h]=m}return m}var s=isNaN(e.length)||e.length<=0?0:e.length,l=isNaN(t.length)||t.length<=0?0:t.length,c=i(s,l).operations,u=c.reduce(function(d,f){var h=d[0],m=d[1];if(ZF(f)){var g=f.index+1+m,y=g<s+m?String(g):"-",S={op:f.op,path:n.add(y).toString(),value:f.value};return[h.concat(S),m+1]}else if(ez(f)){var S={op:f.op,path:n.add(String(f.index+m)).toString()};return[h.concat(S),m-1]}else{var v=n.add(String(f.index+m)),x=r(f.original,f.value,v);return[h.concat.apply(h,x),m]}},[[],0])[0];return u}Sn.diffArrays=_T;function IT(e,t,n,r){r===void 0&&(r=oh);var o=[];return Om(e,t).forEach(function(i){o.push({op:"remove",path:n.add(i).toString()})}),Om(t,e).forEach(function(i){o.push({op:"add",path:n.add(i).toString(),value:t[i]})}),RT([e,t]).forEach(function(i){o.push.apply(o,r(e[i],t[i],n.add(i)))}),o}Sn.diffObjects=IT;function oh(e,t,n,r){if(r===void 0&&(r=oh),e===t)return[];var o=(0,hc.objectType)(e),i=(0,hc.objectType)(t);return o=="array"&&i=="array"?_T(e,t,n,r):o=="object"&&i=="object"?IT(e,t,n,r):[{op:"replace",path:n.toString(),value:t}]}Sn.diffAny=oh;var c0=R0&&R0.__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(Rt,"__esModule",{value:!0});Rt.apply=Rt.InvalidOperationError=Rt.test=Rt.copy=Rt.move=Rt.replace=Rt.remove=Rt.add=Rt.TestError=Rt.MissingError=void 0;var Do=Yc,u0=l0,tz=Sn,oo=function(e){c0(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);Rt.MissingError=oo;var DT=function(e){c0(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);Rt.TestError=DT;function d0(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 AT(e,t){if(Array.isArray(e)){var n=parseInt(t,10);e.splice(n,1)}else delete e[t]}function NT(e,t){var n=Do.Pointer.fromJSON(t.path).evaluate(e);return n.parent===void 0?new oo(t.path):(d0(n.parent,n.key,(0,u0.clone)(t.value)),null)}Rt.add=NT;function OT(e,t){var n=Do.Pointer.fromJSON(t.path).evaluate(e);return n.value===void 0?new oo(t.path):(AT(n.parent,n.key),null)}Rt.remove=OT;function MT(e,t){var n=Do.Pointer.fromJSON(t.path).evaluate(e);if(n.parent===null)return new oo(t.path);if(Array.isArray(n.parent)){if(parseInt(n.key,10)>=n.parent.length)return new oo(t.path)}else if(n.value===void 0)return new oo(t.path);return n.parent[n.key]=(0,u0.clone)(t.value),null}Rt.replace=MT;function $T(e,t){var n=Do.Pointer.fromJSON(t.from).evaluate(e);if(n.value===void 0)return new oo(t.from);var r=Do.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new oo(t.path):(AT(n.parent,n.key),d0(r.parent,r.key,n.value),null)}Rt.move=$T;function LT(e,t){var n=Do.Pointer.fromJSON(t.from).evaluate(e);if(n.value===void 0)return new oo(t.from);var r=Do.Pointer.fromJSON(t.path).evaluate(e);return r.parent===void 0?new oo(t.path):(d0(r.parent,r.key,(0,u0.clone)(n.value)),null)}Rt.copy=LT;function FT(e,t){var n=Do.Pointer.fromJSON(t.path).evaluate(e);return(0,tz.diffAny)(n.value,t.value,new Do.Pointer).length?new DT(n.value,t.value):null}Rt.test=FT;var zT=function(e){c0(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);Rt.InvalidOperationError=zT;function nz(e,t){switch(t.op){case"add":return NT(e,t);case"remove":return OT(e,t);case"replace":return MT(e,t);case"move":return $T(e,t);case"copy":return LT(e,t);case"test":return FT(e,t)}return new zT(t)}Rt.apply=nz;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createTests=e.createPatch=e.applyPatch=e.Pointer=void 0;var t=Yc;Object.defineProperty(e,"Pointer",{enumerable:!0,get:function(){return t.Pointer}});var n=Rt,r=Sn;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})(kT);const rz="_root_w6lfx_1",oz="_removed_w6lfx_16",iz="_added_w6lfx_21",cp={root:rz,removed:oz,added:iz};function sz(e){const t=ee(),{original:n,revised:r}=e,[o,i]=p.useState(!1);p.useEffect(()=>{t.requestSchema(e.original.resourceType).then(()=>i(!0)).catch(console.log)},[t,e.original.resourceType]);const s=p.useMemo(()=>{if(!o)return null;const l=[so(n)],c=[so(r)],u=[],d=az(kT.createPatch(n,r));for(const f of d){const h=f.path,m=lz(h),g=cz(n.resourceType,m),y=f.op==="add"?void 0:dc(m,l),S=f.op==="remove"?void 0:dc(m,c);u.push({key:`op-${f.op}-${f.path}`,name:`${Vt(f.op)} ${m}`,path:(g==null?void 0:g.path)??n.resourceType+"."+m,property:g,originalValue:bw(g,y),revisedValue:bw(g,S)})}return u},[o,n,r]);return s?a.jsxs(se,{className:cp.root,children:[a.jsx(se.Thead,{children:a.jsxs(se.Tr,{children:[a.jsx(se.Th,{}),a.jsx(se.Th,{children:"Before"}),a.jsx(se.Th,{children:"After"})]})}),a.jsx(se.Tbody,{children:s.map(l=>a.jsxs(se.Tr,{children:[a.jsx(se.Td,{children:l.name}),a.jsx(se.Td,{className:cp.removed,children:l.originalValue&&a.jsx(Fr,{path:l.path,property:l.property,propertyType:l.originalValue.type,value:l.originalValue.value,ignoreMissingValues:!0})}),a.jsx(se.Td,{className:cp.added,children:l.revisedValue&&a.jsx(Fr,{path:l.path,property:l.property,propertyType:l.revisedValue.type,value:l.revisedValue.value,ignoreMissingValues:!0})})]},l.key))})]}):null}function az(e){const t=[];for(const n of e){const{op:r,path:o}=n;if(o.startsWith("/meta/author")||o.startsWith("/meta/compartment")||o.startsWith("/meta/lastUpdated")||o.startsWith("/meta/versionId"))continue;const i=e.filter(l=>l.op===r&&l.path===o).length,s={op:r,path:o};i>1&&(r==="add"||r==="remove")&&/\/[0-9-]+$/.test(o)&&(s.op="replace",s.path=o.replace(/\/[^/]+$/,"")),t.some(l=>l.op===s.op&&l.path===s.path)||t.push(s)}return t}function lz(e){const t=e.split("/").filter(Boolean);let n="";for(let r=0;r<t.length;r++){const o=t[r];o==="-"?n+=".last()":/^\d+$/.test(o)?n+=`[${o}]`:(r>0&&(n+="."),n+=o)}return n.endsWith(".url")&&(n=n.replace(/\.url$/,"")),n}function cz(e,t){var r;const n=Yf(e,{resourceType:"SearchParameter",base:[e],code:e+"."+t,expression:e+"."+t});return(r=n==null?void 0:n.elementDefinitions)==null?void 0:r[0]}function bw(e,t){return t&&{type:Array.isArray(t)?t[0].type:t.type,value:uz(t,!!(e!=null&&e.isArray))}}function uz(e,t){const n=L$(e).flatMap(r=>r.value);return t?n:n[0]}function f0(e){const{profileUrl:t}=e,n=ee(),r=lt(e.value),[o,i]=p.useState();return p.useEffect(()=>{if(r)if(t)n.requestProfileSchema(t,{expandProfile:!0}).then(()=>{const s=Cs(t);s?i(s.name):console.error(`Schema not found for ${t}`)}).catch(s=>{console.error("Error in requestProfileSchema",s)});else{const s=r.resourceType;n.requestSchema(s).then(()=>{i(s)}).catch(console.error)}},[n,t,r]),!o||!r?null:a.jsx(Bd,{path:r.resourceType,value:{type:o,value:e.forceUseInput?e.value:r},profileUrl:t,ignoreMissingValues:e.ignoreMissingValues})}function dz(e){return a.jsx(Kc,{children:e.children})}function us(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(a0,{"data-testid":"timeline-item",fill:!0,...i,children:[a.jsxs(Y,{justify:"space-between",gap:8,mx:"xs",my:"sm",children:[a.jsx(Ti,{value:s,link:!0,size:"md"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(oe,{size:"sm",children:a.jsx(Xa,{c:"dark",fw:500,value:s,link:!0})}),a.jsxs(oe,{size:"xs",children:[a.jsx($e,{c:"dimmed",to:e.resource,children:En(l)}),a.jsx(oe,{component:"span",c:"dimmed",mx:8,children:"·"}),a.jsx($e,{c:"dimmed",to:e.resource,children:e.resource.resourceType})]})]}),o&&a.jsxs(J,{position:"bottom-end",shadow:"md",width:200,children:[a.jsx(J.Target,{children:a.jsx(Gt,{color:"gray",variant:"subtle",radius:"xl","aria-label":`Actions for ${ht(e.resource)}`,children:a.jsx(l6,{})})}),o]})]}),a.jsxs(iT,{children:[r&&a.jsx("div",{style:{padding:"0 16px 16px 16px"},children:e.children}),!r&&a.jsx(a.Fragment,{children:e.children})]})]})}function BT(e,t){e.sort((n,r)=>{const o=Cw(n,t),i=Cw(r,t);return o>i?1:o<i?-1:Ew(n,t)-Ew(r,t)})}function Cw(e,t){if(!UT(e,t)){const n=e.priority;if(typeof n=="string")return{stat:4,asap:3,urgent:2}[n]??0}return 0}function Ew(e,t){var r;if(!UT(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 UT(e,t){return!!t&&e.resourceType===t.resourceType&&e.id===t.id}const fz="_pinnedComment_5uxzi_2",hz={pinnedComment:fz};function ih(e){const t=ee(),n=Zf(),r=t.getProfile(),o=p.useRef(null),i=lt(e.value),[s,l]=p.useState(),[c,u]=p.useState([]),d=e.loadTimelineResources,f=p.useRef(c);f.current=c;const h=p.useCallback(I=>{BT(I,i),I.reverse(),u(I)},[i]),m=p.useCallback(I=>{const L=[];for(const N of I){if(N.status!=="fulfilled")continue;const M=N.value;if(M.type==="history"&&l(M),M.entry)for(const $ of M.entry)L.push($.resource)}h(L)},[h]),g=p.useCallback(I=>h([...f.current,I]),[h]),y=p.useCallback(()=>{var N;let I,L;"resourceType"in e.value?(I=e.value.resourceType,L=e.value.id):[I,L]=(N=e.value.reference)==null?void 0:N.split("/"),d(t,I,L).then(m).catch(console.error)},[t,e.value,d,m]);p.useEffect(()=>y(),[y]);function S(I){!i||!e.createCommunication||t.createResource(e.createCommunication(i,r,I)).then(L=>g(L)).catch(console.error)}function v(I){!i||!e.createMedia||t.createResource(e.createMedia(i,r,I)).then(L=>g(L)).then(()=>jl({id:"upload-notification",color:"teal",title:"Upload complete",message:"",icon:a.jsx(th,{size:16}),autoClose:2e3})).catch(L=>jl({id:"upload-notification",color:"red",title:"Upload error",message:Re(L),icon:a.jsx(hw,{size:16}),autoClose:2e3}))}function x(I,L){return t.updateResource({...I,priority:L})}function w(I){x(I,"stat").then(y).catch(console.error)}function b(I){x(I,"routine").then(y).catch(console.error)}function j(I){n(`/${I.resourceType}/${I.id}`)}function E(I){n(`/${I.resourceType}/${I.id}/edit`)}function P(I){n(`/${I.resourceType}/${I.id}/delete`)}function T(I){var L;n(`/${I.resourceType}/${I.id}/_history/${(L=I.meta)==null?void 0:L.versionId}`)}function _(){ue({id:"upload-notification",loading:!0,title:"Initializing upload...",message:"Please wait...",autoClose:!1,withCloseButton:!1})}function D(I){jl({id:"upload-notification",loading:!0,title:"Uploading...",message:wz(I),autoClose:!1,withCloseButton:!1})}function O(I){jl({id:"upload-notification",color:"red",title:"Upload error",message:Re(I),icon:a.jsx(hw,{size:16}),autoClose:2e3})}return i?a.jsxs(dz,{children:[e.createCommunication&&a.jsx(a0,{children:a.jsx(Be,{testid:"timeline-form",onSubmit:I=>{S(I.text);const L=o.current;L&&(L.value="",L.focus())},children:a.jsxs(Y,{gap:"xs",wrap:"nowrap",style:{width:"100%"},children:[a.jsx(Ti,{value:r}),a.jsx(ie,{name:"text",ref:o,placeholder:"Add comment",style:{width:"100%",maxWidth:300}}),a.jsx(Gt,{type:"submit",radius:"xl",color:"blue",variant:"filled",children:a.jsx(v6,{size:16})}),a.jsx(Zv,{securityContext:ft(i),onUpload:v,onUploadStart:_,onUploadProgress:D,onUploadError:O,children:I=>a.jsx(Gt,{...I,radius:"xl",color:"blue",variant:"filled",children:a.jsx(Wv,{size:16})})})]})})}),c.map(I=>{var N;if(!I)return null;const L=`${I.resourceType}/${I.id}/${(N=I.meta)==null?void 0:N.versionId}`;if(I.resourceType===i.resourceType&&I.id===i.id)return a.jsx(pz,{history:s,resource:I,onDetails:T},L);switch(I.resourceType){case"AuditEvent":return a.jsx(vz,{resource:I,onDetails:j},L);case"Communication":return a.jsx(gz,{resource:I,onPin:I.priority!=="stat"?w:void 0,onUnpin:I.priority==="stat"?b:void 0,onDetails:j,onEdit:E,onDelete:P},L);case"DiagnosticReport":return a.jsx(xz,{resource:I,onDetails:j,onEdit:E,onDelete:P},L);case"Media":return a.jsx(yz,{resource:I,onDetails:j,onEdit:E,onDelete:P},L);default:return a.jsx(us,{resource:I,padding:!0,children:a.jsx(f0,{value:I,ignoreMissingValues:!0})},L)}})]}):a.jsx(on,{style:{width:"100%",height:"100%"},children:a.jsx(Un,{})})}function Da(e){return a.jsxs(J.Dropdown,{children:[a.jsx(J.Label,{children:"Resource"}),e.onPin&&a.jsx(J.Item,{leftSection:a.jsx(S6,{size:14}),onClick:()=>e.onPin(e.resource),"aria-label":`Pin ${ht(e.resource)}`,children:"Pin"}),e.onUnpin&&a.jsx(J.Item,{leftSection:a.jsx(b6,{size:14}),onClick:()=>e.onUnpin(e.resource),"aria-label":`Unpin ${ht(e.resource)}`,children:"Unpin"}),e.onDetails&&a.jsx(J.Item,{leftSection:a.jsx(p6,{size:14}),onClick:()=>e.onDetails(e.resource),"aria-label":`Details ${ht(e.resource)}`,children:"Details"}),e.onEdit&&a.jsx(J.Item,{leftSection:a.jsx(c6,{size:14}),onClick:()=>e.onEdit(e.resource),"aria-label":`Edit ${ht(e.resource)}`,children:"Edit"}),e.onDelete&&a.jsxs(a.Fragment,{children:[a.jsx(J.Divider,{}),a.jsx(J.Label,{children:"Danger zone"}),a.jsx(J.Item,{color:"red",leftSection:a.jsx(oT,{size:14}),onClick:()=>e.onDelete(e.resource),"aria-label":`Delete ${ht(e.resource)}`,children:"Delete"})]})]})}function pz(e){const t=mz(e.history,e.resource);return t?a.jsx(us,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Da,{...e}),children:a.jsx(sz,{original:t,revised:e.resource})}):a.jsxs(us,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Da,{...e}),children:[a.jsx("h3",{children:"Created"}),a.jsx(f0,{value:e.resource,ignoreMissingValues:!0,forceUseInput:!0})]})}function mz(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 gz(e){var r,o;const n=!e.resource.priority||e.resource.priority==="routine"?void 0:hz.pinnedComment;return a.jsx(us,{resource:e.resource,profile:e.resource.sender,dateTime:e.resource.sent,padding:!0,className:n,popupMenuItems:a.jsx(Da,{...e}),children:a.jsx("p",{children:(o=(r=e.resource.payload)==null?void 0:r[0])==null?void 0:o.contentString})})}function yz(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(us,{resource:e.resource,padding:!!n,popupMenuItems:a.jsx(Da,{...e}),children:a.jsx(qc,{value:e.resource.content})})}function vz(e){return a.jsx(us,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Da,{...e}),children:a.jsx(vr,{children:a.jsx("pre",{children:e.resource.outcomeDesc})})})}function xz(e){return a.jsx(us,{resource:e.resource,padding:!0,popupMenuItems:a.jsx(Da,{...e}),children:a.jsx(s0,{value:e.resource})})}function wz(e){if(e.lengthComputable){const t=100*e.loaded/e.total;return`Uploaded: ${up(e.loaded)} / ${up(e.total)} ${t.toFixed(2)}%`}return`Uploaded: ${up(e.loaded)}`}function up(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 Sz(e){return a.jsx(ih,{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 Ce(e){const{children:t,...n}=e;return a.jsx(Kc,{children:a.jsx(a0,{...n,children:t})})}function bz(e){return a.jsx(ih,{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:ft(t),subject:t.subject,sender:ft(n),sent:new Date().toISOString(),payload:[{contentString:r}]}),createMedia:(t,n,r)=>({resourceType:"Media",status:"completed",encounter:ft(t),subject:t.subject,operator:ft(n),issued:new Date().toISOString(),content:r})})}function Cz(e){let t;try{t=IL(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(Fr,{value:t[0]||"",propertyType:e.propertyType})}function Ez(e){return a.jsxs(Rn,{title:"Export",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:[a.jsxs(H,{display:"flex",style:{justifyContent:"space-between"},children:[e.exportCsv&&a.jsx(jw,{text:"CSV",exportLogic:e.exportCsv,onCancel:e.onCancel}),e.exportTransactionBundle&&a.jsx(jw,{text:"Transaction Bundle",exportLogic:e.exportTransactionBundle,onCancel:e.onCancel})]}),a.jsx(oe,{style:{marginTop:"10px",marginLeft:"2px"},children:"Limited to 1000 records"})]})}function jw(e){return a.jsx(Z,{onClick:()=>{e.exportLogic(),e.onCancel()},children:`Export as ${e.text}`})}const jz={string:[re.EQUALS,re.NOT,re.CONTAINS,re.EXACT],fulltext:[re.EQUALS,re.NOT,re.CONTAINS,re.EXACT],token:[re.EQUALS,re.NOT],reference:[re.EQUALS,re.NOT],numeric:[re.EQUALS,re.NOT_EQUALS,re.GREATER_THAN,re.LESS_THAN,re.GREATER_THAN_OR_EQUALS,re.LESS_THAN_OR_EQUALS],quantity:[re.EQUALS,re.NOT_EQUALS,re.GREATER_THAN,re.LESS_THAN,re.GREATER_THAN_OR_EQUALS,re.LESS_THAN_OR_EQUALS],date:[re.EQUALS,re.NOT_EQUALS,re.GREATER_THAN,re.LESS_THAN,re.GREATER_THAN_OR_EQUALS,re.LESS_THAN_OR_EQUALS,re.STARTS_AFTER,re.ENDS_BEFORE,re.APPROXIMATELY],datetime:[re.EQUALS,re.NOT_EQUALS,re.GREATER_THAN,re.LESS_THAN,re.GREATER_THAN_OR_EQUALS,re.LESS_THAN_OR_EQUALS,re.STARTS_AFTER,re.ENDS_BEFORE,re.APPROXIMATELY]},Pz={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 h0(e,t){return{...e,filters:t,offset:0,name:void 0}}function p0(e,t){return h0(e,(e.filters??[]).filter(n=>n.code!==t))}function sh(e,t,n,r,o){o&&(e=p0(e,t));const i=[];return e.filters&&i.push(...e.filters),i.push({code:t,operator:n,value:r??""}),h0(e,i)}function Tz(e,t){if(!e.filters)return e;const n=[...e.filters];return n.splice(t,1),{...e,filters:n,name:void 0}}function kz(e,t){return m0(e,t,-1)}function Rz(e,t){return m0(e,t,0)}function _z(e,t){return m0(e,t,1)}function m0(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),y0(e,t,r,o)}function Iz(e,t){return g0(e,t,-1)}function Dz(e,t){return g0(e,t,0)}function Az(e,t){return g0(e,t,1)}function g0(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),y0(e,t,r,o)}function Nz(e,t){const n=new Date;return n.setMonth(0),n.setDate(1),n.setHours(0,0,0,0),y0(e,t,n,new Date)}function y0(e,t,n,r){return e=p0(e,t),e=Pw(e,t,re.GREATER_THAN_OR_EQUALS,n),e=Pw(e,t,re.LESS_THAN_OR_EQUALS,r),e}function Pw(e,t,n,r){return sh(e,t,n,r.toISOString())}function Tw(e,t,n=!0){return sh(e,t,re.MISSING,n.toString())}function Oz(e,t){return e.offset===t?e:{...e,offset:t,name:void 0}}function Mz(e,t){const n=e.count??Xf,r=(t-1)*n;return Oz(e,r)}function $z(e,t,n){return t===Lz(e)&&n!==void 0&&n===Fz(e)?e:{...e,sortRules:[{code:t,descending:!!n}],name:void 0}}function Lz(e){const t=e.sortRules;if(!t||t.length===0)return;const n=t[0].code;return n.startsWith("-")?n.substr(1):n}function Fz(e){const t=e.sortRules;return!t||t.length===0?!1:!!t[0].descending}function zz(e){return jz[e.type]}function v0(e){return Pz[e]??""}function bi(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(Vt).join(" "))}function Bz(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"?En((o=e.meta)==null?void 0:o.lastUpdated):t.elementDefinition&&`${e.resourceType}.${t.name}`===t.elementDefinition.path?Uz(e,t.elementDefinition):t.searchParams&&t.searchParams.length===1&&t.name===t.searchParams[0].code?Vz(e,t.searchParams[0]):null}function Uz(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]=Gc({type:e.resourceType,value:e},n);return r?a.jsx(Fr,{path:t.path,property:t,propertyType:o,value:r,maxWidth:200,ignoreMissingValues:!0,link:!1}):null}function Vz(e,t){const n=dc(t.expression,[{type:e.resourceType,value:e}]);return!n||n.length===0?null:a.jsx(a.Fragment,{children:n.map((r,o)=>a.jsx(Fr,{propertyType:r.type,value:r.value,maxWidth:200,ignoreMissingValues:!0,link:!1},`${o}-${n.length}`))})}function Hz(e){const t=p.useRef(!1),[n,r]=p.useState({search:JSON.parse(er(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=xP(c),d=Av(c);return lc(Wz(u,d)).map(f=>({value:f,label:bi(f)}))},[e.visible,e.search.resourceType]);if(!e.visible)return null;function l(c){r({search:{...n.search,fields:c}})}return a.jsx(Rn,{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(je,{children:[a.jsx(Lf,{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 Wz(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(bi(i));if(t)for(const i of Object.keys(t)){const s=bi(i);!r.has(i)&&!o.has(s)&&(n.push(i),r.add(i),o.add(s))}return n}function VT(e){var o;const{resourceType:t,filter:n}=e,r=(o=Io.types[t].searchParams)==null?void 0:o[n.code];if(r){if(r.type==="reference"&&(n.operator===re.EQUALS||n.operator===re.NOT_EQUALS))return a.jsx(Xa,{value:{reference:n.value}});const i=Yf(t,r);if(n.code==="_lastUpdated"||i.type===Zo.DATETIME)return a.jsx(a.Fragment,{children:En(n.value)})}return a.jsx(a.Fragment,{children:n.value})}function HT(e){const t=Yf(e.resourceType,e.searchParam),n="filter-value";switch(t.type){case Zo.REFERENCE:return a.jsx(rh,{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 Zo.BOOLEAN:return a.jsx(gr,{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 Zo.DATE:return a.jsx(ie,{type:"date",name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.value)});case Zo.DATETIME:return a.jsx(ls,{name:n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:e.onChange});case Zo.NUMBER:return a.jsx(ie,{type:"number",name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.value)});case Zo.QUANTITY:return a.jsx(cs,{name:n,defaultValue:qz(e.defaultValue),autoFocus:e.autoFocus,onChange:r=>{r?e.onChange(`${r.value}`):e.onChange("")}});default:return a.jsx(ie,{name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.value),placeholder:"Search value"})}}function qz(e){if(e){const[t,n,r]=e.split("|");if(t)return{value:parseFloat(t),system:n,unit:r}}}function Gz(e){const[t,n]=p.useState(JSON.parse(er(e.search))),[r,o]=p.useState(-1),i=p.useRef(t);i.current=t,p.useEffect(()=>{n(JSON.parse(er(e.search)))},[e.search]);function s(d){n(sh(i.current,d.code,d.operator,d.value))}if(!e.visible)return null;const l=e.search.resourceType,c=Av(l)??{},u=t.filters||[];return a.jsxs(Rn,{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(kw,{resourceType:l,searchParams:c,defaultValue:d,okText:"Save",onOk:h=>{const m=[...u];m[f]=h,n(h0(i.current,m)),o(-1)},onCancel:()=>o(-1)},`filter-${d.code}-${d.operator}-${d.value}-input`):a.jsx(Qz,{resourceType:l,filter:d,onEdit:()=>o(f),onDelete:()=>n(Tz(i.current,f))},`filter-${d.code}-${d.operator}-${d.value}-display`)),a.jsx(kw,{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 Qz(e){const{filter:t}=e;return a.jsxs("tr",{children:[a.jsx("td",{children:bi(t.code)}),a.jsx("td",{children:v0(t.operator)}),a.jsx("td",{children:a.jsx(VT,{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:"compact-md",variant:"outline",onClick:e.onDelete,children:"Delete"})]})]})}function kw(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&&zz(l);return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(wt,{"data-testid":"filter-field",defaultValue:r.current.code,onChange:u=>o(u.currentTarget.value),data:["",...Object.keys(e.searchParams).map(u=>({value:u,label:bi(u)}))]})}),a.jsx("td",{children:c&&a.jsx(wt,{"data-testid":"filter-operation",defaultValue:t.operator,onChange:u=>i(u.currentTarget.value),data:["",...c.map(u=>({value:u,label:v0(u)}))]})}),a.jsx("td",{children:l&&t.operator&&a.jsx(HT,{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 Kz(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(Rn,{title:e.title,size:"xl",opened:e.visible,onClose:e.onCancel,children:a.jsx(Be,{onSubmit:r,children:a.jsxs(Qn,{children:[a.jsx(Qn.Col,{span:10,children:a.jsx(HT,{resourceType:e.resourceType,searchParam:e.searchParam,defaultValue:t,autoFocus:!0,onChange:n})}),a.jsx(Qn.Col,{span:2,children:a.jsx(Z,{onClick:r,fullWidth:!0,children:"OK"})})]})})})}function Yz(e){if(!e.searchParams)return null;function t(i,s){o($z(e.search,i.code,s))}function n(i){o(p0(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(Xz,{search:e.search,searchParam:e.searchParams[0],onSort:t,onPrompt:r,onChange:o,onClear:n}):a.jsx(J.Dropdown,{children:e.searchParams.map(i=>a.jsx(J.Item,{children:bi(i.code)},i.code))})}function Xz(e){switch(e.searchParam.type){case"date":return a.jsx(Jz,{...e});case"number":case"quantity":return a.jsx(Zz,{...e});case"reference":return a.jsx(eB,{...e});case"string":return a.jsx(tB,{...e});case"token":case"uri":return a.jsx(nB,{...e});default:return a.jsxs(a.Fragment,{children:["Unknown search param type: ",e.searchParam.type]})}}function Jz(e){const{searchParam:t}=e,n=t.code;return a.jsxs(J.Dropdown,{children:[a.jsx(J.Item,{leftSection:a.jsx(qv,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Oldest to Newest"}),a.jsx(J.Item,{leftSection:a.jsx(Gv,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Newest to Oldest"}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Wc,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Equals..."}),a.jsx(J.Item,{leftSection:a.jsx(Hc,{size:14}),onClick:()=>e.onPrompt(t,re.NOT_EQUALS),children:"Does not equal..."}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(rT,{size:14}),onClick:()=>e.onPrompt(t,re.ENDS_BEFORE),children:"Before..."}),a.jsx(J.Item,{leftSection:a.jsx(nT,{size:14}),onClick:()=>e.onPrompt(t,re.STARTS_AFTER),children:"After..."}),a.jsx(J.Item,{leftSection:a.jsx(Z7,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Between..."}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Ni,{size:14}),onClick:()=>e.onChange(_z(e.search,n)),children:"Tomorrow"}),a.jsx(J.Item,{leftSection:a.jsx(Ni,{size:14}),onClick:()=>e.onChange(Rz(e.search,n)),children:"Today"}),a.jsx(J.Item,{leftSection:a.jsx(Ni,{size:14}),onClick:()=>e.onChange(kz(e.search,n)),children:"Yesterday"}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Ni,{size:14}),onClick:()=>e.onChange(Az(e.search,n)),children:"Next Month"}),a.jsx(J.Item,{leftSection:a.jsx(Ni,{size:14}),onClick:()=>e.onChange(Dz(e.search,n)),children:"This Month"}),a.jsx(J.Item,{leftSection:a.jsx(Ni,{size:14}),onClick:()=>e.onChange(Iz(e.search,n)),children:"Last Month"}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Ni,{size:14}),onClick:()=>e.onChange(Nz(e.search,n)),children:"Year to date"}),a.jsx(Xc,{...e})]})}function Zz(e){const{searchParam:t}=e;return a.jsxs(J.Dropdown,{children:[a.jsx(J.Item,{leftSection:a.jsx(qv,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Smallest to Largest"}),a.jsx(J.Item,{leftSection:a.jsx(Gv,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Largest to Smallest"}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Wc,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Equals..."}),a.jsx(J.Item,{leftSection:a.jsx(Hc,{size:14}),onClick:()=>e.onPrompt(t,re.NOT_EQUALS),children:"Does not equal..."}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(nT,{size:14}),onClick:()=>e.onPrompt(t,re.GREATER_THAN),children:"Greater than..."}),a.jsx(J.Item,{leftSection:a.jsx(Am,{size:14}),onClick:()=>e.onPrompt(t,re.GREATER_THAN_OR_EQUALS),children:"Greater than or equal to..."}),a.jsx(J.Item,{leftSection:a.jsx(rT,{size:14}),onClick:()=>e.onPrompt(t,re.LESS_THAN),children:"Less than..."}),a.jsx(J.Item,{leftSection:a.jsx(Am,{size:14}),onClick:()=>e.onPrompt(t,re.LESS_THAN_OR_EQUALS),children:"Less than or equal to..."}),a.jsx(Xc,{...e})]})}function eB(e){const{searchParam:t}=e;return a.jsxs(J.Dropdown,{children:[a.jsx(J.Item,{leftSection:a.jsx(Wc,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Equals..."}),a.jsx(J.Item,{leftSection:a.jsx(Hc,{size:14}),onClick:()=>e.onPrompt(t,re.NOT),children:"Does not equal..."}),a.jsx(Xc,{...e})]})}function tB(e){const{searchParam:t}=e;return a.jsxs(J.Dropdown,{children:[a.jsx(J.Item,{leftSection:a.jsx(qv,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort A to Z"}),a.jsx(J.Item,{leftSection:a.jsx(Gv,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Z to A"}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Wc,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Equals..."}),a.jsx(J.Item,{leftSection:a.jsx(Hc,{size:14}),onClick:()=>e.onPrompt(t,re.NOT),children:"Does not equal..."}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(n6,{size:14}),onClick:()=>e.onPrompt(t,re.CONTAINS),children:"Contains..."}),a.jsx(J.Item,{leftSection:a.jsx(t6,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Does not contain..."}),a.jsx(Xc,{...e})]})}function nB(e){const{searchParam:t}=e;return a.jsxs(J.Dropdown,{children:[a.jsx(J.Item,{leftSection:a.jsx(Wc,{size:14}),onClick:()=>e.onPrompt(t,re.EQUALS),children:"Equals..."}),a.jsx(J.Item,{leftSection:a.jsx(Hc,{size:14}),onClick:()=>e.onPrompt(t,re.NOT),children:"Does not equal..."}),a.jsx(Xc,{...e})]})}function Xc(e){const{searchParam:t}=e,n=t.code;return a.jsxs(a.Fragment,{children:[a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(X7,{size:14}),onClick:()=>e.onChange(Tw(e.search,n)),children:"Missing"}),a.jsx(J.Item,{leftSection:a.jsx(Y7,{size:14}),onClick:()=>e.onChange(Tw(e.search,n,!1)),children:"Not missing"}),a.jsx(J.Divider,{}),a.jsx(J.Item,{leftSection:a.jsx(Fd,{size:14}),onClick:()=>e.onClear(t),children:"Clear filters"})]})}const rB="_root_vlout_1",oB="_table_vlout_8",iB="_tr_vlout_12",sB="_th_vlout_18",aB="_control_vlout_22",lB="_icon_vlout_31",pl={root:rB,table:oB,tr:iB,th:sB,control:aB,icon:lB};function cB(e){const t=e.resourceType,n=[];for(const r of e.fields||["id","_lastUpdated"])n.push(uB(t,r));return n}function uB(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=js(e,t),r=tL(e,t.toLowerCase());if(n&&r)return{name:t,elementDefinition:n,searchParams:[r]};if(n){const i=Av(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=Yf(e,r);return{name:t,elementDefinition:(o=i.elementDefinitions)==null?void 0:o[0],searchParams:[r]}}return{name:t}}class dB extends Event{constructor(t){super("change"),this.definition=t}}class fB extends Event{constructor(t){super("load"),this.response=t}}class Ud extends Event{constructor(t,n){super("click"),this.resource=t,this.browserEvent=n}}function hB(e){var N,M,$;const t=ee(),[n,r]=p.useState(),[o,i]=p.useState(),{search:s,onLoad:l}=e,[c,u]=p.useState({selected:{},fieldEditorVisible:!1,filterEditorVisible:!1,exportDialogVisible:!1,filterDialogVisible:!1}),d=p.useRef(c);d.current=c;const f=s.total??"accurate",h=p.useCallback(R=>{i(void 0),t.search(s.resourceType,ra({...s,total:f,fields:void 0}),R).then(k=>{u({...d.current,searchResponse:k}),l&&l(new fB(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(R,k){R.stopPropagation();const q=R.target.checked,G={...d.current.selected};q?G[k]=!0:delete G[k],u({...d.current,selected:G})}function y(R){R.stopPropagation();const F=R.target.checked,q={},G=d.current.searchResponse;F&&(G!=null&&G.entry)&&G.entry.forEach(ne=>{var xe;(xe=ne.resource)!=null&&xe.id&&(q[ne.resource.id]=!0)}),u({...d.current,selected:q})}function S(){var k,F;const R=d.current;if(!((k=R.searchResponse)!=null&&k.entry)||R.searchResponse.entry.length===0)return!1;for(const q of R.searchResponse.entry)if((F=q.resource)!=null&&F.id&&!R.selected[q.resource.id])return!1;return!0}function v(R){e.onChange&&e.onChange(new dB(R))}function x(R,k){if(sT(R.target)||R.button===2)return;ot(R);const F=R.button===1||R.ctrlKey||R.metaKey;!F&&e.onClick&&e.onClick(new Ud(k,R)),F&&e.onAuxClick&&e.onAuxClick(new Ud(k,R))}function w(){return!!(e.onExport??e.onExportCsv??e.onExportTransactionBundle)}if(p.useEffect(()=>{r(e.search.resourceType),t.requestSchema(e.search.resourceType).catch(console.error).finally(()=>r(void 0))},[t,e.search.resourceType]),!vP(e.search.resourceType)||n===e.search.resourceType)return a.jsx(on,{style:{width:"100%",height:"100%"},children:a.jsx(Un,{})});const b=e.checkboxesEnabled,j=cB(s),E=s.resourceType,P=c.searchResponse,T=P==null?void 0:P.entry,_=T==null?void 0:T.map(R=>R.resource),D="subtle",O="gray",I=16,L=window.innerWidth<768;return a.jsxs("div",{className:pl.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:D,color:O,leftSection:a.jsx(i6,{size:I}),onClick:()=>u({...d.current,fieldEditorVisible:!0}),children:"Fields"}),a.jsx(Z,{size:"compact-md",variant:D,color:O,leftSection:a.jsx(d6,{size:I}),onClick:()=>u({...d.current,filterEditorVisible:!0}),children:"Filters"}),e.onNew&&a.jsx(Z,{size:"compact-md",variant:D,color:O,leftSection:a.jsx(u6,{size:I}),onClick:e.onNew,children:"New..."}),!L&&w()&&a.jsx(Z,{size:"compact-md",variant:D,color:O,leftSection:a.jsx(A6,{size:I}),onClick:e.onExport?e.onExport:()=>u({...d.current,exportDialogVisible:!0}),children:"Export..."}),!L&&e.onDelete&&a.jsx(Z,{size:"compact-md",variant:D,color:O,leftSection:a.jsx(oT,{size:I}),onClick:()=>e.onDelete(Object.keys(c.selected)),children:"Delete..."}),!L&&e.onBulk&&a.jsx(Z,{size:"compact-md",variant:D,color:O,leftSection:a.jsx(J7,{size:I}),onClick:()=>e.onBulk(Object.keys(c.selected)),children:"Bulk..."})]}),a.jsxs(Y,{gap:2,children:[P&&a.jsxs(oe,{size:"xs",c:"dimmed","data-testid":"count-display",children:[WT(s,P).toLocaleString(),"-",yB(s,P).toLocaleString(),P.total!==void 0&&` of ${s.total==="estimate"?"~":""}${(N=P.total)==null?void 0:N.toLocaleString()}`]}),a.jsx(Gt,{variant:D,color:O,title:"Refresh",onClick:m,children:a.jsx(P6,{size:I})})]})]}),a.jsxs(se,{className:pl.table,children:[a.jsxs(se.Thead,{children:[a.jsxs(se.Tr,{children:[b&&a.jsx(se.Th,{children:a.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:S(),onChange:R=>y(R)})}),j.map(R=>a.jsx(se.Th,{children:a.jsxs(J,{shadow:"md",width:240,position:"bottom-end",children:[a.jsx(J.Target,{children:a.jsx(Xn,{className:pl.control,p:2,children:a.jsxs(Y,{justify:"space-between",wrap:"nowrap",children:[a.jsx(oe,{fw:500,children:bi(R.name)}),a.jsx(on,{className:pl.icon,children:a.jsx(G7,{size:14,stroke:1.5})})]})})}),a.jsx(Yz,{search:e.search,searchParams:R.searchParams,onPrompt:(k,F)=>{u({...d.current,filterDialogVisible:!0,filterDialogSearchParam:k,filterDialogFilter:F})},onChange:k=>{v(k)}})]})},R.name))]}),!e.hideFilters&&a.jsxs(se.Tr,{children:[b&&a.jsx(se.Th,{}),j.map(R=>a.jsx(se.Th,{children:R.searchParams&&a.jsx(pB,{resourceType:E,searchParams:R.searchParams,filters:e.search.filters})},R.name))]})]}),a.jsx(se.Tbody,{children:_==null?void 0:_.map(R=>R&&a.jsxs(se.Tr,{className:pl.tr,"data-testid":"search-control-row",onClick:k=>x(k,R),onAuxClick:k=>x(k,R),children:[b&&a.jsx(se.Td,{children:a.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${R.id}`,checked:!!c.selected[R.id],onChange:k=>g(k,R.id)})}),j.map(k=>a.jsx(se.Td,{children:Bz(R,k)},k.name))]},R.id))})]}),(_==null?void 0:_.length)===0&&a.jsx(Kc,{children:a.jsx(on,{style:{height:150},children:a.jsx(oe,{size:"xl",c:"dimmed",children:"No results"})})}),P&&a.jsx(on,{m:"md",p:"md",children:a.jsx(Ur,{value:mB(s),total:gB(s,P),onChange:R=>v(Mz(s,R)),getControlProps:R=>{switch(R){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(Hz,{search:e.search,visible:d.current.fieldEditorVisible,onOk:R=>{v(R),u({...d.current,fieldEditorVisible:!1})},onCancel:()=>{u({...d.current,fieldEditorVisible:!1})}}),a.jsx(Gz,{search:e.search,visible:d.current.filterEditorVisible,onOk:R=>{v(R),u({...d.current,filterEditorVisible:!1})},onCancel:()=>{u({...d.current,filterEditorVisible:!1})}}),a.jsx(Ez,{visible:d.current.exportDialogVisible,exportCsv:e.onExportCsv,exportTransactionBundle:e.onExportTransactionBundle,onCancel:()=>{u({...d.current,exportDialogVisible:!1})}}),a.jsx(Kz,{visible:d.current.filterDialogVisible,title:(M=c.filterDialogSearchParam)!=null&&M.code?bi(c.filterDialogSearchParam.code):"",resourceType:E,searchParam:c.filterDialogSearchParam,filter:c.filterDialogFilter,defaultValue:"",onOk:R=>{v(sh(e.search,R.code,R.operator,R.value)),u({...d.current,filterDialogVisible:!1})},onCancel:()=>{u({...d.current,filterDialogVisible:!1})}},($=c.filterDialogSearchParam)==null?void 0:$.code)]})}const Jc=p.memo(hB);function pB(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:[v0(n.operator)," ",a.jsx(VT,{resourceType:e.resourceType,filter:n})]},`filter-${n.code}-${n.operator}-${n.value}`))})}function mB(e){return Math.floor((e.offset??0)/(e.count??Xf))+1}function gB(e,t){const n=e.count??Xf,r=qT(e,t);return Math.ceil(r/n)}function WT(e,t){return Math.min(qT(e,t),(e.offset??0)+1)}function yB(e,t){var n;return Math.max(WT(e,t)+(((n=t.entry)==null?void 0:n.length)??0)-1,0)}function qT(e,t){var r,o;let n=t.total;return n===void 0&&(n=(e.offset??0)+(((r=t.entry)==null?void 0:r.length)??0)+((o=t.link)!=null&&o.some(i=>i.relation==="next")?1:0)),n}function vB(e){const t=ee(),[n,r]=p.useState(!1),[o,i]=p.useState(),{query:s,fields:l}=e,[c,u]=p.useState(),[d,f]=p.useState({}),h=p.useRef();h.current=c;const m=p.useRef({});m.current=d,p.useEffect(()=>{i(void 0),t.graphql(s).then(u).catch(w=>i(at(w)))},[t,s]);function g(w,b){w.stopPropagation();const E=w.target.checked,P={...m.current};E?P[b]=!0:delete P[b],f(P)}function y(w){var T;w.stopPropagation();const j=w.target.checked,E={},P=(T=h.current)==null?void 0:T.data.ResourceList;j&&P&&P.forEach(_=>{_.id&&(E[_.id]=!0)}),f(E)}function S(){var b;const w=(b=h.current)==null?void 0:b.data.ResourceList;if(!w||w.length===0)return!1;for(const j of w)if(j.id&&!m.current[j.id])return!1;return!0}function v(w,b){sT(w.target)||(ot(w),w.button!==1&&e.onClick&&e.onClick(new Ud(b,w)),w.button===1&&e.onAuxClick&&e.onAuxClick(new Ud(b,w)))}if(p.useEffect(()=>{t.requestSchema(e.resourceType).then(()=>r(!0)).catch(console.log)},[t,e.resourceType]),!n)return a.jsx(Un,{});const x=e.checkboxesEnabled;return a.jsxs("div",{onContextMenu:w=>ot(w),"data-testid":"search-control",children:[a.jsxs(se,{children:[a.jsx(se.Thead,{children:a.jsxs(se.Tr,{children:[x&&a.jsx(se.Th,{children:a.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:S(),onChange:w=>y(w)})}),l.map(w=>a.jsx(se.Th,{children:w.name},w.name))]})}),a.jsx(se.Tbody,{children:c==null?void 0:c.data.ResourceList.map(w=>w&&a.jsxs(se.Tr,{"data-testid":"search-control-row",onClick:b=>v(b,w),onAuxClick:b=>v(b,w),children:[x&&a.jsx(se.Td,{children:a.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${w.id}`,checked:!!d[w.id],onChange:b=>g(b,w.id)})}),l.map(b=>a.jsx(se.Td,{children:a.jsx(Cz,{propertyType:b.propertyType,path:b.fhirPath,resource:w})},b.name))]},w.id))})]}),(c==null?void 0:c.data.ResourceList.length)===0&&a.jsx("div",{"data-testid":"empty-search",children:"No results"}),o&&a.jsx("div",{"data-testid":"search-error",children:a.jsx("pre",{style:{textAlign:"left"},children:JSON.stringify(o,void 0,2)})}),e.onBulk&&a.jsx(Z,{onClick:()=>e.onBulk(Object.keys(m.current)),children:"Bulk..."})]})}const xB=p.memo(vB);function Vr(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 wB(e){const{group:t}=e;return a.jsx(Fn,{withBorder:!0,radius:"md",p:"xs",display:"flex",style:{alignItems:"center",justifyContent:"center"},children:a.jsxs(Y,{children:[t.measureScore&&a.jsx(CB,{group:t}),!t.measureScore&&a.jsx(bB,{group:t})]})})}function SB(e){const{measure:t}=e;return a.jsxs(a.Fragment,{children:[a.jsx(oe,{fz:"md",fw:500,mb:8,children:t.title}),a.jsx(oe,{fz:"xs",c:"dimmed",mb:8,children:t.subtitle})]})}function bB(e){const{group:t}=e,n=t.population,r=n==null?void 0:n.find(c=>Si(c.code)==="numerator"),o=n==null?void 0:n.find(c=>Si(c.code)==="denominator"),i=r==null?void 0:r.count,s=o==null?void 0:o.count;if(s===0)return a.jsxs(H,{children:[a.jsx(le,{order:3,children:"Not Applicable"}),a.jsx(oe,{children:`Denominator: ${s}`})]});if(i===void 0||s===void 0)return a.jsxs(H,{children:[a.jsx(le,{order:3,children:"Insufficient Data"}),a.jsx(oe,{children:`Numerator: ${i}`}),a.jsx(oe,{children:`Denominator: ${s}`})]});const l=i/s*100;return a.jsx(Hf,{size:120,thickness:12,roundCaps:!0,sections:[{value:l,color:GT(l)}],label:a.jsx(os,{justify:"center",children:a.jsxs(oe,{fw:700,fz:18,children:[i," / ",s]})})})}function CB(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(Hf,{size:120,thickness:12,roundCaps:!0,sections:[{value:EB(t),color:GT(((i=t==null?void 0:t.measureScore)==null?void 0:i.value)??0)}],label:a.jsx(os,{justify:"center",children:a.jsx(oe,{fw:700,fz:18,children:a.jsx(fc,{value:t.measureScore})})})}):a.jsx(os,{h:120,align:"center",children:a.jsx(le,{order:3,children:a.jsx(fc,{value:t.measureScore})})})})}function EB(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 jB(e){var r;const t=lt(e.measureReport),[n]=U7("Measure",{url:t==null?void 0:t.measure});return t?a.jsxs(H,{children:[n&&a.jsx(SB,{measure:n}),a.jsx(mv,{cols:{base:3,sm:1},spacing:{base:"md",sm:"sm"},children:(r=t.group)==null?void 0:r.map((o,i)=>a.jsx(wB,{group:o},o.id??i))})]}):null}function Hr(e){var n;const t=((n=e.outcome)==null?void 0:n.issue)||e.issues;return!t||t.length===0?null:a.jsx(xs,{icon:a.jsx(Vc,{size:16}),color:"red",children:t.map(r=>{var o;return a.jsx("div",{"data-testid":"text-field-error",children:mP(r)},(o=r.details)==null?void 0:o.text)})})}function PB(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(ih,{value:e.patient,loadTimelineResources:t,createCommunication:(n,r,o)=>({resourceType:"Communication",status:"completed",subject:ft(n),sender:ft(r),sent:new Date().toISOString(),payload:[{contentString:o}]}),createMedia:(n,r,o)=>({resourceType:"Media",status:"completed",subject:ft(n),operator:ft(r),issued:new Date().toISOString(),content:o})})}const TB="_section_14dzq_2",kB="_hovering_14dzq_11",RB="_editing_14dzq_15",_B="_bottomActions_14dzq_20",oa={section:TB,hovering:kB,editing:RB,bottomActions:_B};function IB(e){const t=ee(),n=lt(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($B(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,S){d({...m.current,[y]:S})}return a.jsx("div",{children:a.jsxs(Be,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(u),children:[a.jsx(ie,{label:"Plan Title",defaultValue:u.title,onChange: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:oa.section,children:[e.actions.map(i=>a.jsx("div",{children:a.jsx(DB,{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:oa.bottomActions,children:a.jsx(Ve,{href:"#",onClick:i=>{ot(i),r({id:YT()})},children:"Add action"})})]})}function DB(e){const{action:t}=e,n=MB(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){ot(c),e.setHoverKey(e.action.id)}const l=et(oa.section,{[oa.editing]:r,[oa.hovering]:o&&!r});return a.jsxs("div",{"data-testid":t.id,className:l,onClick:i,onMouseOver:s,onFocus:s,children:[r?a.jsx(NB,{action:t,actionType:n,onChange:e.onChange,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onRemove:e.onRemove}):a.jsx(AB,{action:t,actionType:n}),a.jsx("div",{className:oa.bottomActions,children:a.jsx(Ve,{href:"#",onClick:c=>{c.preventDefault(),e.onRemove()},children:"Remove"})})]})}const Mm={path:"PlanDefinition.action.timing[x]",min:0,max:1,description:"",isArray:!1,constraints:[],type:["dateTime","Period","Range","Timing"].map(e=>({code:e}))};function AB(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(zd,{value:{reference:t.definitionCanonical}})}),r&&a.jsx("div",{children:a.jsx(Fr,{property:Mm,propertyType:o,value:r})})]})}function NB(e){const{action:t}=e,[n,r]=p.useState(e.actionType);function o(i,s){e.onChange({...t,[i]:s})}return a.jsxs(je,{gap:"xl",children:[a.jsx(ie,{name:`actionTitle-${t.id}`,label:"Title",defaultValue:t.title,onChange:i=>o("title",i.currentTarget.value)}),a.jsx(ie,{name:`actionDescription-${t.id}`,label:"Description",defaultValue:t.description,onChange:i=>o("description",i.currentTarget.value)}),a.jsx(wt,{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(Nu,{title:"Appointment",description:"The subject must schedule an appointment from the schedule.",resourceType:"Schedule",action:t,onChange:e.onChange});case"lab":return a.jsx(Nu,{title:"Lab",description:"The subject must complete the following lab panel.",resourceType:"ActivityDefinition",action:t,onChange:e.onChange});case"questionnaire":return a.jsx(Nu,{title:"Questionnaire",description:"The subject must complete the selected questionnaire.",resourceType:"Questionnaire",action:t,onChange:e.onChange});case"task":return a.jsx(Nu,{title:"Task",description:"The subject must complete the following task.",resourceType:"ActivityDefinition",action:t,onChange:e.onChange});default:return null}})(),a.jsx(st,{title:"Timing",description:"When the action should take place.",children:a.jsx(OB,{name:"timing-"+t.id,action:t,onChange:e.onChange})})]})}function Nu(e){const{id:t,definitionCanonical:n}=e.action,r=n!=null&&n.startsWith(e.resourceType+"/")?{reference:n}:void 0;return a.jsx(Ka,{name:t,resourceType:e.resourceType,defaultValue:r,loadOnFocus:!0,onChange:o=>{o?e.onChange({...e.action,definitionCanonical:ht(o)}):e.onChange({...e.action,definitionCanonical:void 0})}})}function OB(e){const t=e.action,n="timing",[r,o]=KT(t);return a.jsx(Ya,{property:Mm,name:"timing[x]",path:"PlanDefinition.timing[x]",defaultValue:r,defaultPropertyType:o,onChange:(i,s)=>{e.onChange(vT(t,n,s??n,Mm,i))},outcome:void 0})}function MB(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 Gc({type:"PlanDefinitionAction",value:e},"timing")}let dp=1;function YT(e){if(e){if(e.startsWith("id-")){const t=parseInt(e.substring(3),10);isNaN(t)||(dp=Math.max(dp,t+1))}return e}return"id-"+dp++}function $B(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 ut=(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))(ut||{});function LB(e){return e.type==="choice"||e.type==="open-choice"}function FB(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}=UB(r,o,n);if(n==="any"&&i)return!0;if(n==="all"&&!s)return!1}return n!=="any"}function zB(e,t,n){return e.map(r=>{var s;const o=(s=n.answerOption)==null?void 0:s.find(l=>Es(l.valueCoding)===r||l[t]===r),i=an({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 BB(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}]=dc(`%actualAnswer ${r} %expectedAnswer`,[e],{"%actualAnswer":e,"%expectedAnswer":t});return o}else return!1}function UB(e,t,n){const r=t||[],o=an({type:"QuestionnaireItemEnableWhen",value:e},"answer[x]");let i=!1,s=!0;for(const l of r){const c=an({type:"QuestionnaireResponseItemAnswer",value:l},"value[x]"),{operator:u}=e;if(BB(c,o,u)?i=!0:s=!1,n==="any"&&i)break}return{anyMatch:i,allMatch:s}}function ZT(e){var n,r;const t=zc(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 fp(e,t){var o;const n=ao(e);let r=zc(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 VB(e,t,n){const r=zc(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]=F$(l,"=",2);i[c]=u}return i}function HB(e){return{resourceType:"QuestionnaireResponse",questionnaire:ht(e),item:ek(e.item),status:"in-progress"}}function ek(e){return(e==null?void 0:e.map(tk))??[]}function tk(e){var t;return{id:qB(),linkId:e.linkId,text:e.text,item:ek(e.item),answer:((t=e.initial)==null?void 0:t.map(GB))??[]}}let WB=1;function qB(){return"id-"+WB++}function GB(e){return{...e}}function QB(e){return e.value.display||e.value.reference||er(e.value)}function KB(e){var n,r,o,i;const t=(n=e==null?void 0:e.item)==null?void 0:n[0];if(t){const s=zc(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 nk=p.createContext({});function $m(e){const t=p.useContext(nk),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((S,v)=>v===e.index?u:S)??[],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=x0(r,e.index)??an({type:"QuestionnaireItemInitial",value:l},"value");switch(i){case ut.display:return a.jsx("p",{children:e.item.text},e.item.linkId);case ut.boolean:return a.jsx(gT,{title:e.item.text,htmlFor:e.item.linkId,children:a.jsx(gr,{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 ut.decimal:return a.jsx(ie,{type:"number",step:"any",id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDecimal:u.currentTarget.valueAsNumber})});case ut.integer:return a.jsx(ie,{type:"number",step:1,id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueInteger:u.currentTarget.valueAsNumber})});case ut.date:return a.jsx(ie,{type:"date",id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDate:u.currentTarget.value})});case ut.dateTime:return a.jsx(ls,{name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueDateTime:u})});case ut.time:return a.jsx(ie,{type:"time",id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueTime:u.currentTarget.value})});case ut.string:case ut.url:return a.jsx(ie,{id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueString:u.currentTarget.value})});case ut.text:return a.jsx(ws,{id:s,name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueString:u.currentTarget.value})});case ut.attachment:return a.jsx(Y,{py:4,children:a.jsx(cT,{name:s,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueAttachment:u})})});case ut.reference:return a.jsx(rh,{name:s,required:n.required,targetTypes:ZT(n),searchCriteria:VB(n,t.subject,t.encounter),defaultValue:c==null?void 0:c.value,onChange:u=>o({valueReference:u})});case ut.quantity:return a.jsx(cs,{name:s,required:n.required,defaultValue:c==null?void 0:c.value,onChange:u=>o({valueQuantity:u}),disableWheel:!0});case ut.choice:case ut.openChoice:return tU(n)&&!n.answerValueSet?a.jsx(YB,{name:s,item:n,initial:l,response:r,onChangeAnswer:u=>o(u)}):a.jsx(XB,{name:s,item:n,initial:l,response:r,onChangeAnswer:u=>o(u)});default:return null}}function YB(e){var c;const{name:t,item:n,initial:r,response:o}=e;if(!((c=n.answerOption)!=null&&c.length))return a.jsx(rk,{});const i=an({type:"QuestionnaireItemInitial",value:r},"value"),s=[""];for(const u of n.answerOption){const d=an({type:"QuestionnaireItemAnswerOption",value:u},"value");s.push(Rw(d))}const l=x0(o)??i;if(n.repeats){const{propertyName:u,data:d}=nU(e.item),f=ZB(o);return a.jsx(Lf,{data:d,placeholder:"Select items",searchable:!0,defaultValue:f||[Rw(i)],onChange:h=>{const m=zB(h,u,n);e.onChangeAnswer(m)}})}return a.jsx(wt,{id:t,name:t,onChange:u=>{const d=u.currentTarget.selectedIndex;if(d===0){e.onChangeAnswer({});return}const f=n.answerOption[d-1],h=an({type:"QuestionnaireItemAnswerOption",value:f},"value"),m="value"+Vt(h.type);e.onChangeAnswer({[m]:h.value})},defaultValue:Es(l==null?void 0:l.value)||(l==null?void 0:l.value),data:s})}function XB(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(rk,{}):n.answerValueSet?a.jsx(xT,{name:t,binding:n.answerValueSet,onChange:l=>o({valueCoding:l}),creatable:n.type===ut.openChoice}):a.jsx(JB,{name:(i==null?void 0:i.id)??t,item:n,initial:r,response:i,onChangeAnswer:o})}function JB(e){const{name:t,item:n,initial:r,onChangeAnswer:o,response:i}=e,s=js("QuestionnaireItemAnswerOption","value[x]"),l=an({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=an({type:"QuestionnaireItemAnswerOption",value:m},"value");y!=null&&y.value&&(l&&er(y)===er(l)&&(u=g),c.push([g,y]))}const d=x0(i),f=eU(c,d);return a.jsx(sc.Group,{name:t,value:f??u,onChange:h=>{const m=c.find(g=>g[0]===h);if(m){const g=m[1],y="value"+Vt(g.type);o({[y]:g.value})}},children:c.map(([h,m])=>a.jsx(sc,{id:h,value:h,py:4,label:a.jsx(Fr,{property:s,propertyType:m.type,value:m.value})},h))})}function rk(){return a.jsx(ie,{disabled:!0,placeholder:"No Answers Defined"})}function ok(e){return an({type:"QuestionnaireItemAnswer",value:e},"value")}function x0(e,t=0){const n=e.answer;return ok((n==null?void 0:n[t])??{})}function ZB(e){const t=e.answer;return t?t.map(r=>ok(r)).map(r=>Es(r==null?void 0:r.value)||(r==null?void 0:r.value)):[]}function eU(e,t){var n;return(n=e.find(r=>Bc(r[1].value,t==null?void 0:t.value)))==null?void 0:n[0]}function Rw(e){if(e)return e.type==="CodeableConcept"?Si(e.value):e.type==="Coding"?Es(e.value):e.type==="Reference"?QB(e):e.value.toString()}function tU(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 nU(e){var i;if(((i=e.answerOption)==null?void 0:i.length)===0)return{propertyName:"",data:[]};const t=e.answerOption[0],n=an({type:"QuestionnaireItemAnswerOption",value:t},"value"),r="value"+Vt(n.type),o=(e.answerOption??[]).map(s=>({value:_w(s,r),label:_w(s,r)}));return{propertyName:r,data:o}}function _w(e,t){var n;return Es(e.valueCoding)||((n=e[t])==null?void 0:n.toString())}const rU="_section_cpwxo_1",oU="_hovering_cpwxo_10",iU="_editing_cpwxo_14",sU="_questionBody_cpwxo_19",aU="_topActions_cpwxo_23",lU="_bottomActions_cpwxo_32",cU="_movementActions_cpwxo_43",uU="_movementIcons_cpwxo_55",dU="_columnAlignment_cpwxo_59",fU="_linkIdInput_cpwxo_64",hU="_typeSelect_cpwxo_69",sr={section:rU,hovering:oU,editing:iU,questionBody:sU,topActions:aU,bottomActions:lU,movementActions:cU,movementIcons:uU,columnAlignment:dU,linkIdInput:fU,typeSelect:hU};function pU(e){const t=ee(),n=lt(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(vU(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(Be,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(i),children:[a.jsx(ik,{item:i,selectedKey:l,setSelectedKey:c,hoverKey:u,setHoverKey:d,onChange:m}),a.jsx(Z,{type:"submit",children:"Save"})]})})}function ik(e){var w;const t=e.item,n=e.item,r=Uo(e.item),o=r||n.type===ut.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(b){ot(b),e.setSelectedKey(e.item.id)}function d(b){ot(b),e.setHoverKey(e.item.id)}function f(b){var E;const j=c.current;e.onChange({...j,item:(E=j.item)==null?void 0:E.map(P=>P.id===b.id?b:P)})}function h(b,j){e.onChange({...e.item,item:[...e.item.item??[],b]},j)}function m(b){var j;e.onChange({...e.item,item:(j=e.item.item)==null?void 0:j.filter(E=>E!==b)})}function g(b,j){e.onChange({...c.current,[b]:j})}function y(b){e.onChange({...e.item,...b})}function S(b){var j;e.onChange({...e.item,item:(j=e.item.item)==null?void 0:j.map(E=>E===b?{...E,repeats:!E.repeats}:E)})}function v(b,j){const E=SU(e.item.item,b,j);e.onChange({...e.item,item:E})}const x=et(sr.section,{[sr.editing]:s,[sr.hovering]:l&&!s});return a.jsxs("div",{"data-testid":n.linkId,className:x,onClick:u,onMouseOver:d,onFocus:d,children:[a.jsx("div",{className:sr.questionBody,children:s?a.jsxs(a.Fragment,{children:[r&&a.jsx(ie,{size:"xl",defaultValue:t.title,onBlur:b=>g("title",b.currentTarget.value)}),!r&&a.jsx(ws,{autosize:!0,minRows:2,defaultValue:n.text,onBlur:b=>g("text",b.currentTarget.value)}),n.type==="reference"&&a.jsx(yU,{item:n,onChange:y}),LB(n)&&a.jsx(mU,{item:n,onChange:b=>y(b)})]}):a.jsxs(a.Fragment,{children:[t.title&&a.jsx(le,{children:t.title}),n.text&&a.jsx("div",{children:n.text}),!o&&a.jsx($m,{item:n,index:0,onChange:()=>{},response:{linkId:n.linkId}})]})}),(w=n.item)==null?void 0:w.map((b,j)=>a.jsx("div",{children:a.jsx(ik,{item:b,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,isFirst:j===0,isLast:j===(e.item.item??[]).length-1,setHoverKey:e.setHoverKey,onChange:f,onRemove:()=>m(b),onRepeatable:S,onMoveUp:()=>v(j,-1),onMoveDown:()=>v(j,1)})},b.id)),!o&&a.jsx("div",{className:sr.topActions,children:s?a.jsxs(a.Fragment,{children:[a.jsx(ie,{size:"xs",className:sr.linkIdInput,defaultValue:n.linkId,onBlur:b=>g("linkId",b.currentTarget.value)}),!o&&a.jsx(wt,{size:"xs",className:sr.typeSelect,defaultValue:n.type,onChange:b=>g("type",b.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(H,{className:sr.movementActions,children:a.jsxs(H,{className:sr.columnAlignment,children:[!e.isFirst&&a.jsx(Ve,{href:"#",onClick:b=>{b.preventDefault(),e.onMoveUp&&e.onMoveUp()},children:a.jsx(K7,{"data-testid":"up-button",size:15,className:sr.movementIcons})}),!e.isLast&&a.jsx(Ve,{href:"#",onClick:b=>{b.preventDefault(),e.onMoveDown&&e.onMoveDown()},children:a.jsx(Q7,{"data-testid":"down-button",size:15,className:sr.movementIcons})})]})}),a.jsxs("div",{className:sr.bottomActions,children:[o&&a.jsxs(a.Fragment,{children:[a.jsx(Ve,{href:"#",onClick:b=>{b.preventDefault(),h({id:ds(),linkId:zm("q"),type:"string",text:"Question"})},children:"Add item"}),a.jsx(Ve,{href:"#",onClick:b=>{b.preventDefault(),h({id:ds(),linkId:zm("g"),type:"group",text:"Group"},!0)},children:"Add group"})]}),r&&a.jsx(Ve,{href:"#",onClick:b=>{b.preventDefault(),h(wU(),!0)},children:"Add Page"}),s&&!r&&a.jsxs(a.Fragment,{children:[a.jsx(Ve,{href:"#",onClick:b=>{b.preventDefault(),e.onRepeatable&&e.onRepeatable(n)},children:n.repeats?"Remove Repeatable":"Make Repeatable"}),a.jsx(Ve,{href:"#",onClick:b=>{b.preventDefault(),e.onRemove&&e.onRemove()},children:"Remove"})]})]})]})}function mU(e){const t=js("QuestionnaireItemAnswerOption","value[x]"),n=e.item.answerOption??[];return a.jsxs("div",{children:[e.item.answerValueSet!==void 0?a.jsx(ie,{placeholder:"Enter Value Set",defaultValue:e.item.answerValueSet,onChange:r=>e.onChange({...e.item,answerValueSet:r.target.value})}):a.jsx(gU,{options:n,property:t,item:e.item,onChange:e.onChange}),a.jsxs(H,{display:"flex",children:[a.jsx(Ve,{href:"#",onClick:r=>{ot(r),e.onChange({...e.item,answerValueSet:void 0,answerOption:[...n,{id:ds()}]})},children:"Add choice"}),a.jsx(Wf,{w:"lg"}),a.jsx(Ve,{href:"#",onClick:r=>{ot(r),e.onChange({...e.item,answerOption:[],answerValueSet:""})},children:"Add value set"})]})]})}function gU(e){return a.jsx("div",{children:e.options.map(t=>{const[n,r]=Gc({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(Ya,{name:"value[x]",path:"Questionnaire.answerOption.value[x]",property:e.property,defaultPropertyType:r,defaultValue:n,onChange:(o,i)=>{const s=[...e.options],l=s.findIndex(c=>c.id===t.id);s[l]={id:t.id,[i]:o},e.onChange({...e.item,answerOption:s})},outcome:void 0},t.id)}),a.jsx("div",{children:a.jsx(Ve,{href:"#",onClick:o=>{ot(o),e.onChange({...e.item,answerOption:e.options.filter(i=>i.id!==t.id)})},children:"Remove"})})]},t.id)})})}function yU(e){const t=ZT(e.item)??[];return a.jsxs(a.Fragment,{children:[t.map((n,r)=>a.jsxs(Y,{children:[a.jsx(Xv,{name:"resourceType",placeholder:"Resource Type",defaultValue:n,onChange:o=>{e.onChange(fp(e.item,t.map(i=>i===n?o:i)))}}),a.jsx(Ve,{href:"#",onClick:o=>{ot(o),e.onChange(fp(e.item,t.filter(i=>i!==n)))},children:"Remove"})]},`${n}-${r}`)),a.jsx(Ve,{href:"#",onClick:n=>{ot(n),e.onChange(fp(e.item,[...t,""]))},children:"Add Resource Type"})]})}let Lm=1,Fm=1;function zm(e){return e+Lm++}function ds(){return"id-"+Fm++}function vU(e){return{...e,id:e.id||ds(),item:sk(e.item)}}function sk(e){if(e)return e.forEach(t=>{var n,r;(n=t.id)!=null&&n.match(/^id-\d+$/)&&(Fm=Math.max(Fm,parseInt(t.id.substring(3),10)+1)),(r=t.linkId)!=null&&r.match(/^q\d+$/)&&(Lm=Math.max(Lm,parseInt(t.linkId.substring(1),10)+1))}),e.map(t=>({...t,id:t.id||ds(),item:sk(t.item),answerOption:xU(t.answerOption)}))}function xU(e){if(e)return e.map(t=>({...t,id:t.id||ds()}))}function wU(){return{id:ds(),linkId:zm("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 SU(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 ak(e){const{item:t,response:n,onChange:r}=e,[o,i]=p.useState(bU(t,n??{linkId:t.linkId}));if(!e.checkForQuestionEnabled(t)||!n)return null;if(t.type===ut.display)return a.jsx("p",{children:t.text},t.linkId);const s=(t==null?void 0:t.repeats)&&t.type!==ut.choice&&t.type!==ut.openChoice;return t.type===ut.boolean?a.jsx($m,{item:t,response:n,onChange:l=>r([l]),index:0},t.linkId):a.jsxs(st,{htmlFor:e.item.linkId,title:e.item.text,withAsterisk:e.item.required,children:[[...Array(o)].map((l,c)=>a.jsx($m,{item:t,response:n,onChange:u=>r([u]),index:c},`${t.linkId}-${c}`)),s&&a.jsx(Ve,{onClick:()=>i(l=>l+1),children:"Add Item"})]},e.item.linkId)}function bU(e,t){if(e.type===ut.choice||e.type===ut.openChoice)return 1;const n=t.answer;return n!=null&&n.length?n.length:1}function lk(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=tk(e.item);n([...t,i])}return a.jsxs(a.Fragment,{children:[t.map((i,s)=>a.jsx(ck,{item:e.item,response:i,checkForQuestionEnabled:e.checkForQuestionEnabled,onChange:l=>r(l,s)},i.id)),e.item.repeats&&a.jsx(Ve,{onClick:o,children:`Add Group: ${e.item.text}`})]})}function ck(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(je,{children:(i=e.item.item)==null?void 0:i.map(s=>{var l,c,u;return s.type===ut.group?s.repeats?a.jsx(lk,{item:s,response:((l=t.item)==null?void 0:l.filter(d=>d.linkId===s.linkId))??[],checkForQuestionEnabled:n,onChange:o},s.linkId):a.jsx(ck,{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(ak,{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 CU(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(S=>S.linkId===h.linkId))??[],g=h.type===ut.group?a.jsx(lk,{item:h,response:m,onChange:o,checkForQuestionEnabled:d},h.linkId):a.jsx(ak,{item:h,response:m==null?void 0:m[0],onChange:o,checkForQuestionEnabled:d},h.linkId);return c?a.jsx(Ra.Step,{label:h.text,children:g},h.linkId):g});return a.jsxs(a.Fragment,{children:[c&&a.jsx(Ra,{active:r??0,allowNextStepsSelect:!1,p:6,children:f}),!c&&a.jsx(je,{children:f}),a.jsx(EU,{activePage:r??0,numberOfPages:l,nextStep:i,prevStep:s,submitButtonText:u})]})}function EU(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 uk(e){const t=ee(),n=t.getProfile(),[r,o]=p.useState(!1),i=lt(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?HB(i):void 0)},[i]);function d(y){const S=(s==null?void 0:s.item)??[],x={resourceType:"QuestionnaireResponse",status:"in-progress",item:dk(S,Array.isArray(y)?y:[y])};l(x)}function f(y){return FB(y,(s==null?void 0:s.item)??[])}if(!r||!i||!s)return null;const h=KB(i),m=()=>u(y=>y+1),g=()=>u(y=>y-1);return a.jsx(nk.Provider,{value:{subject:e.subject,encounter:e.encounter},children:a.jsxs(Be,{testid:"questionnaire-form",onSubmit:()=>{e.onSubmit&&s&&e.onSubmit({...s,questionnaire:ht(i),subject:e.subject,source:ft(n),authored:new Date().toISOString(),status:"completed"})},children:[i.title&&a.jsx(le,{children:i.title}),a.jsx(CU,{items:i.item??[],response:s,onChange:d,renderPages:h>1,activePage:c,numberOfPages:h,submitButtonText:e.submitButtonText,checkForQuestionEnabled:f,nextStep:m,prevStep:g})]})})}function jU(e,t){const n=dk(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 dk(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(jU(o,s)),r.add(s.id)):n.push(o)}for(const o of t)r.has(o.id)||n.push(o);return n}const PU="_section_4m5it_1",TU={section:PU},kU=["gender","age","gestationalAge","context","appliesTo","category"],RU={definition:{resourceType:"ObservationDefinition",code:{text:""}},onSubmit:()=>{}};function _U(e){e=Object.assign(RU,e);const t=e.definition,[n,r]=p.useState([]),[o,i]=p.useState(1),[s,l]=p.useState(1);return p.useEffect(()=>{const g=AU(t,l);r(NU(g.qualifiedInterval||[],i))},[t]),a.jsxs(Be,{testid:"reference-range-editor",onSubmit:c,children:[a.jsx(je,{children:n.map(g=>{var y;return a.jsx(IU,{unit:MU((y=t.quantitativeDetails)==null?void 0:y.unit),onChange:f,onAdd:h,onRemove:m,onRemoveGroup:d,intervalGroup:g},`group-${g.id}`)})}),a.jsx(Gt,{title:"Add Group",variant:"subtle",size:"sm",onClick:g=>{ot(g),u({id:`group-id-${o}`,filters:{},intervals:[]}),i(y=>y+1)},children:a.jsx(Ld,{})}),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=>!$U(y));e.onSubmit({...t,qualifiedInterval:g})}function u(g){r(y=>[...y,g])}function d(g){r(y=>y.filter(S=>S.id!==g.id))}function f(g,y){r(S=>{S=[...S];const v=S.find(w=>w.id===g),x=v==null?void 0:v.intervals.findIndex(w=>w.id===y.id);return x!==void 0&&(v!=null&&v.intervals[x])&&(v.intervals[x]=y),S})}function h(g,y){y.id===void 0&&(y.id=`id-${s}`,l(S=>S+1)),r(S=>{S=[...S];const v=S.findIndex(x=>x.id===g);if(v!==-1){const x={...S[v]};y={...y,...x.filters},x.intervals=[...x.intervals,y],S[v]=x}return S})}function m(g,y){r(S=>{S=[...S];const v=S.find(x=>x.id===g);return v&&(v.intervals=v.intervals.filter(x=>x.id!==y.id)),S})}}function IU(e){const{intervalGroup:t,unit:n}=e;return a.jsx(Kc,{"data-testid":t.id,className:TU.section,children:a.jsxs(je,{gap:"lg",children:[a.jsx(Y,{justify:"flex-end",children:a.jsx(Gt,{title:"Remove Group",variant:"subtle","data-testid":`remove-group-button-${t.id}`,size:"sm",onClick:r=>{ot(r),e.onRemoveGroup(t)},children:a.jsx($d,{})},`remove-group-button-${t.id}`)}),a.jsx(DU,{intervalGroup:t,onChange:e.onChange}),a.jsx(dn,{}),t.intervals.map(r=>a.jsxs(je,{gap:"xs",children:[a.jsxs(Y,{children:[a.jsx(ie,{"data-testid":`condition-${r.id}`,defaultValue:r.condition,label:"Condition: ",size:"sm",onChange:o=>{ot(o),e.onChange(t.id,{...r,condition:o.currentTarget.value.trim()})}},`condition-${r.id}`),a.jsx(Gt,{title:"Remove Interval",variant:"subtle",size:"sm","data-testid":`remove-interval-${r.id}`,onClick:o=>{ot(o),e.onRemove(t.id,r)},children:a.jsx($d,{})},`remove-interval-${r.id}`)]}),a.jsx(n0,{onChange:o=>{e.onChange(t.id,{...r,range:o})},name:`range-${r.id}`,defaultValue:r.range},`range-${r.id}`)]},`interval-${r.id}`)),a.jsx(Gt,{title:"Add Interval",variant:"subtle",size:"sm",onClick:r=>{ot(r),e.onAdd(t.id,{range:{low:{unit:n},high:{unit:n}}})},children:a.jsx(Ld,{})})]})})}function DU(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(je,{style:{maxWidth:"50%"},children:[a.jsx(Y,{children:a.jsx(wt,{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(oe,{component:"label",htmlFor:`div-age-${t.id}`,children:"Age:"}),a.jsx("div",{id:`div-age-${t.id}`,children:a.jsx(n0,{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(wt,{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(wt,{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 AU(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 NU(e,t){let n=1;const r={};for(const o of e){const i=OU(o);i in r||(r[i]={id:`group-id-${n++}`,filters:Object.fromEntries(kU.map(s=>[s,o[s]])),intervals:[]}),r[i].intervals.push(o)}return t(n),Object.values(r)}function OU(e){var n,r;return[`gender=${e.gender}`,`age=${cc(e.age)}`,`gestationalAge=${cc(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 MU(e){return e&&($$(e,"http://unitsofmeasure.org")||e.text)}function $U(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 LU(e){var u;const t=ee(),n=lt(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(Qn,{children:(u=n.action)==null?void 0:u.map((d,f)=>{var y,S,v,x,w,b;const h=d.resource&&c(d.resource),m=(S=(y=h==null?void 0:h.input)==null?void 0:y[0])==null?void 0:S.valueReference,g=(x=(v=h==null?void 0:h.output)==null?void 0:v[0])==null?void 0:x.valueReference;return a.jsxs(p.Fragment,{children:[a.jsx(Qn.Col,{span:1,p:"md",children:(h==null?void 0:h.status)==="completed"?a.jsx(o6,{}):a.jsx(_6,{color:"gray"})}),a.jsxs(Qn.Col,{span:9,p:"xs",children:[a.jsx(oe,{fw:500,children:d.title}),d.description&&a.jsx("div",{children:d.description}),a.jsxs("div",{children:["Last edited by ",a.jsx(Xa,{value:(w=h==null?void 0:h.meta)==null?void 0:w.author})," on ",En((b=h==null?void 0:h.meta)==null?void 0:b.lastUpdated)]}),a.jsxs("div",{children:["Status: ",a.jsx(i0,{status:(h==null?void 0:h.status)||"unknown"})]})]}),a.jsxs(Qn.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===ht(f.resource))return f.resource}}function fk(e,t){const n=FU(e,t);return zU(n,e,t)}function FU(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,S=0;u===-c||u!==c&&g.i<m.i?(S=m.i,y=m):(S=g.i+1,y=g),l[h]=void 0;let v=S-u,x={i:S,j:v,prev:BU(y),snake:!1};for(;S<n&&v<r&&e[S]===t[v];)S++,v++;if(S>x.i&&(x={i:S,j:v,prev:x,snake:!0}),l[d]=x,S>=n&&v>=r)return l[d]}l[s+c-1]=void 0}}function zU(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 BU(e){return e&&!e.snake&&e.prev?e.prev:e}function UU(e){const t=e.entry.filter(r=>!!r.resource).map(r=>{var o;return{meta:(o=r.resource)==null?void 0:o.meta,lines:er(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 VU(n,t),HU(n),n}function VU(e,t){for(let n=1;n<t.length;n++){const r=fk(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 HU(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 WU="_container_1oj0p_1",qU="_root_1oj0p_5",GU="_startRow_1oj0p_20",QU="_normalRow_1oj0p_24",KU="_author_1oj0p_28",YU="_dateTime_1oj0p_32",XU="_lineNumber_1oj0p_37",JU="_line_1oj0p_37",ZU="_pre_1oj0p_52",ho={container:WU,root:qU,startRow:GU,normalRow:QU,author:KU,dateTime:YU,lineNumber:XU,line:JU,pre:ZU};function eV(e,t){return`/${e.resourceType}/${e.id}/_history/${t}`}function tV(e){const t=Math.floor((Date.now()-Date.parse(e))/1e3),n=Math.floor(t/31536e3);if(n>0)return zs(n,"year");const r=Math.floor(t/2592e3);if(r>0)return zs(r,"month");const o=Math.floor(t/86400);if(o>0)return zs(o,"day");const i=Math.floor(t/3600);if(i>0)return zs(i,"hour");const s=Math.floor(t/60);return s>0?zs(s,"minute"):zs(t,"second")}function zs(e,t){return`${e} ${e===1?t:t+"s"} ago`}function nV(e){var s,l;const t=ee(),[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=UU(n);return a.jsx("div",{className:ho.container,children:a.jsx("table",{className:ho.root,children:a.jsx("tbody",{children:i.map((c,u)=>a.jsxs("tr",{className:c.span>0?ho.startRow:ho.normalRow,children:[c.span>0&&a.jsxs(a.Fragment,{children:[a.jsx("td",{className:ho.author,rowSpan:c.span,children:a.jsx(ma,{value:c.meta.author,link:!0})}),a.jsx("td",{className:ho.dateTime,rowSpan:c.span,children:a.jsx($e,{to:eV(o,c.meta.versionId),children:tV(c.meta.lastUpdated)})})]}),a.jsx("td",{className:ho.lineNumber,children:u+1}),a.jsx("td",{className:ho.line,children:a.jsx("pre",{className:ho.pre,children:c.value})})]},"row-"+u))})})})}const rV="_removed_mgz0k_2",oV="_added_mgz0k_7",Iw={removed:rV,added:oV};function iV(e){let t=e.original,n=e.revised;e.ignoreMeta&&(t={...t,meta:void 0},n={...n,meta:void 0});const r=er(t,!0).match(/[^\r\n]+/g),o=er(n,!0).match(/[^\r\n]+/g),i=fk(r,o);return a.jsx("pre",{style:{color:"gray"},children:i.map((s,l)=>a.jsx(sV,{delta:s},"delta"+l))})}function sV(e){return a.jsxs(a.Fragment,{children:["...",a.jsx("br",{}),e.delta.original.lines.length>0&&a.jsx("div",{className:Iw.removed,children:e.delta.original.lines.join(`
515
+ `)}),e.delta.revised.lines.length>0&&a.jsx("div",{className:Iw.added,children:e.delta.revised.lines.join(`
516
+ `)}),"...",a.jsx("br",{})]})}function Vd(e){const{outcome:t}=e,n=ee(),r=lt(e.defaultValue),[o,i]=p.useState(),[s,l]=p.useState();return p.useEffect(()=>{if(r)if(e.profileUrl){const c=e.profileUrl;n.requestProfileSchema(e.profileUrl,{expandProfile:!0}).then(()=>{const u=Cs(c);if(u){i(u.name);const d=$7(r,u);l(d)}else console.error(`Schema not found for ${c}`)}).catch(u=>{console.error("Error in requestProfileSchema",u)})}else{const c=e.schemaName??(r==null?void 0:r.resourceType);n.requestSchema(c).then(()=>{l(r),i(c)}).catch(console.log)}},[n,r,e.schemaName,e.profileUrl]),!o||!s?a.jsx("div",{children:"Loading..."}):a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:c=>{c.preventDefault(),e.onSubmit&&e.onSubmit(s)},children:[a.jsxs(je,{mb:"xl",children:[a.jsx(st,{title:"Resource Type",htmlFor:"resourceType",outcome:t,children:a.jsx(ie,{name:"resourceType",defaultValue:s.resourceType,disabled:!0})}),a.jsx(st,{title:"ID",htmlFor:"id",outcome:t,children:a.jsx(ie,{name:"id",defaultValue:s.id,disabled:!0})})]}),a.jsx(o0,{path:s.resourceType,valuePath:s.resourceType,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 aV(e){var o;const t=ee(),[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(se,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[a.jsx(se.Thead,{children:a.jsxs(se.Tr,{children:[a.jsx(se.Th,{children:"Author"}),a.jsx(se.Th,{children:"Date"}),a.jsx(se.Th,{children:"Version"})]})}),a.jsx(se.Tbody,{children:(o=n.entry)==null?void 0:o.map((i,s)=>a.jsx(lV,{entry:i},"entry-"+s))})]}):a.jsx("div",{children:"Loading..."})}function lV(e){var r,o,i;const{response:t,resource:n}=e.entry;return n?a.jsxs(se.Tr,{children:[a.jsx(se.Td,{children:a.jsx(ma,{value:(r=n.meta)==null?void 0:r.author,link:!0})}),a.jsx(se.Td,{children:En((o=n.meta)==null?void 0:o.lastUpdated)}),a.jsx(se.Td,{children:a.jsx($e,{to:cV(n),children:(i=n.meta)==null?void 0:i.versionId})})]}):a.jsx(se.Tr,{children:a.jsx(se.Td,{colSpan:3,children:Re(t==null?void 0:t.outcome)})})}function cV(e){var t;return`/${e.resourceType}/${e.id}/_history/${(t=e.meta)==null?void 0:t.versionId}`}function uV(e){return a.jsx(ih,{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:[ft(t)],subject:t.subject,sender:ft(n),sent:new Date().toISOString(),payload:[{contentString:r}]}),createMedia:(t,n,r)=>({resourceType:"Media",status:"completed",basedOn:[ft(t)],subject:t.subject,operator:ft(n),issued:new Date().toISOString(),content:r})})}function dV(e){const t=ee(),{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=>ue({color:"red",message:Re(c),autoClose:!1}))}return a.jsx(Ve,{onClick:()=>l(),...s,children:i})}function hk(e){const t=ee(),[n,r]=p.useState();return a.jsxs(Be,{style:{maxWidth:400},onSubmit:async o=>{try{e.handleAuthResponse(await t.startNewProject({login:e.login,projectName:o.projectName}))}catch(i){r(at(i))}},children:[a.jsxs(on,{style:{flexDirection:"column"},children:[a.jsx(Vr,{size:32}),a.jsx(le,{children:"Create project"})]}),a.jsxs(je,{gap:"xl",children:[a.jsx(ie,{name:"projectName",label:"Project Name",placeholder:"My Project",required:!0,autoFocus:!0,error:Ue(n,"firstName")}),a.jsxs(oe,{c:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",a.jsx(Ve,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Ve,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]})]}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{type:"submit",children:"Create project"})})]})}function pk(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 mk(e){const t=ee(),{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"){pk("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 fV={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.1.1-5c643b5a7",BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function gk(e){var t;if(e)return e;if(typeof window<"u"){const n=window.location.protocol+"//"+window.location.host;if((((t=fV.GOOGLE_AUTH_ORIGINS)==null?void 0:t.split(","))??[]).includes(n))return"__GOOGLE_CLIENT_ID__"}}function yk(e){typeof grecaptcha>"u"&&pk("https://www.google.com/recaptcha/api.js?render="+e)}function vk(e){return new Promise((t,n)=>{grecaptcha.ready(async()=>{try{t(await grecaptcha.execute(e,{action:"submit"}))}catch(r){n(r)}})})}function hV(e){const t=gk(e.googleClientId),n=e.recaptchaSiteKey,r=ee(),[o,i]=p.useState(),s=Qc(o,void 0);return p.useEffect(()=>{n&&yk(n)},[n]),a.jsxs(Be,{style:{maxWidth:400},onSubmit:async l=>{try{let c="";n&&(c=await vk(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(at(c))}},children:[a.jsx(on,{style:{flexDirection:"column"},children:e.children}),a.jsx(Hr,{issues:s}),t&&a.jsxs(a.Fragment,{children:[a.jsx(Y,{justify:"center",p:"xl",style:{height:70},children:a.jsx(mk,{googleClientId:t,handleGoogleCredential:async l=>{try{e.handleAuthResponse(await r.startGoogleLogin({googleClientId:l.clientId,googleCredential:l.credential,createUser:!0}))}catch(c){i(at(c))}}})}),a.jsx(dn,{label:"or",labelPosition:"center",my:"lg"})]}),a.jsxs(je,{gap:"xl",children:[a.jsx(ie,{name:"firstName",type:"text",label:"First name",placeholder:"First name",required:!0,autoFocus:!0,error:Ue(o,"firstName")}),a.jsx(ie,{name:"lastName",type:"text",label:"Last name",placeholder:"Last name",required:!0,error:Ue(o,"lastName")}),a.jsx(ie,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,error:Ue(o,"email")}),a.jsx(Nr,{name:"password",label:"Password",autoComplete:"off",required:!0,error:Ue(o,"password")}),a.jsxs(oe,{c:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",a.jsx(Ve,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Ve,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]}),a.jsxs(oe,{c:"dimmed",size:"xs",children:["This site is protected by reCAPTCHA and the Google"," ",a.jsx(Ve,{href:"https://policies.google.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Ve,{href:"https://policies.google.com/terms",children:"Terms of Service"})," apply."]})]}),a.jsxs(Y,{justify:"space-between",mt:"xl",wrap:"nowrap",children:[a.jsx(gr,{name:"remember",label:"Remember me",size:"xs"}),a.jsx(Z,{type:"submit",children:"Create account"})]})]})}function pV(e){const{type:t,projectId:n,clientId:r,googleClientId:o,recaptchaSiteKey:i,onSuccess:s}=e,l=ee(),[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(at(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(Ce,{width:450,children:[d&&a.jsx("pre",{children:JSON.stringify(d,null,2)}),!c&&a.jsx(hV,{projectId:n,clientId:r,googleClientId:o,recaptchaSiteKey:i,handleAuthResponse:h,children:e.children}),c&&t==="project"&&a.jsx(hk,{login:c,handleAuthResponse:h})]})}function mV(e){const[t,n]=p.useState();return t?a.jsx(yV,{email:t,...e}):a.jsx(gV,{setEmail:n,...e})}function gV(e){const{setEmail:t,onRegister:n,handleAuthResponse:r,children:o,disableEmailAuth:i,...s}=e,l=ee(),c=!e.disableGoogleAuth&&gk(e.googleClientId),[u,d]=p.useState(),f=Qc(u,void 0),h=p.useCallback(async y=>{if(!y.authorizeUrl)return!1;const S=JSON.stringify({...await l.ensureCodeChallenge(s),domain:y.domain}),v=new URL(y.authorizeUrl);return v.searchParams.set("state",S),window.location.assign(v.toString()),!0},[l,s]),m=p.useCallback(async y=>{const S=await l.post("auth/method",{email:y.email});await h(S)||t(y.email)},[l,h,t]),g=p.useCallback(async y=>{try{const S=await l.startGoogleLogin({...s,googleCredential:y.credential});await h(S)||r(S)}catch(S){d(at(S))}},[l,s,h,r]);return a.jsxs(Be,{onSubmit:m,children:[a.jsx(on,{style:{flexDirection:"column"},children:o}),a.jsx(Hr,{issues:f}),c&&a.jsxs(a.Fragment,{children:[a.jsx(Y,{justify:"center",p:"xl",style:{height:70},children:a.jsx(mk,{googleClientId:c,handleGoogleCredential:g})}),!i&&a.jsx(dn,{label:"or",labelPosition:"center",my:"lg"})]}),!i&&a.jsx(ie,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,autoFocus:!0,error:Ue(u,"email")}),a.jsxs(Y,{justify:"space-between",mt:"xl",gap:0,wrap:"nowrap",children:[a.jsx("div",{children:n&&a.jsx(Ve,{component:"button",type:"button",color:"dimmed",onClick:n,size:"xs",children:"Register"})}),!i&&a.jsx(Z,{type:"submit",children:"Next"})]})]})}function yV(e){const{onForgotPassword:t,handleAuthResponse:n,children:r,...o}=e,i=ee(),[s,l]=p.useState(),c=Qc(s,void 0),u=p.useCallback(d=>{i.startLogin({...o,password:d.password,remember:d.remember==="on"}).then(n).catch(f=>l(at(f)))},[i,o,n]);return a.jsxs(Be,{style:{maxWidth:400},onSubmit:u,children:[a.jsx(on,{style:{flexDirection:"column"},children:r}),a.jsx(Hr,{issues:c}),a.jsx(je,{gap:"xl",children:a.jsx(Nr,{name:"password",label:"Password",autoComplete:"off",required:!0,autoFocus:!0,error:Ue(s,"password")})}),a.jsxs(Y,{justify:"space-between",mt:"xl",gap:0,wrap:"nowrap",children:[t&&a.jsx(Ve,{component:"button",type:"button",c:"dimmed",onClick:t,size:"xs",children:"Forgot password"}),a.jsx(gr,{id:"remember",name:"remember",label:"Remember me",size:"xs",style:{lineHeight:1}}),a.jsx(Z,{type:"submit",children:"Sign in"})]})]})}function vV(e){const t=ee(),n=_c(),[r,o]=p.useState(""),[i,s]=p.useState();function l(f){var h;return!!((h=f==null?void 0:f.toLowerCase())!=null&&h.includes(r.toLowerCase()))}function c(f){var h,m;return l((h=f.profile)==null?void 0:h.display)||l((m=f.project)==null?void 0:m.display)}function u(f){t.post("auth/profile",{login:e.login,profile:f}).then(e.handleAuthResponse).catch(h=>s(at(h)))}const d=e.memberships.filter(c).slice(0,10).map(f=>a.jsx(Ee.Option,{value:f.id,children:a.jsx(xV,{...f})},f.id));return a.jsxs(je,{children:[a.jsxs(os,{gap:"md",mb:"md",justify:"center",align:"center",direction:"column",wrap:"nowrap",children:[a.jsx(Vr,{size:32}),a.jsx(le,{order:3,children:"Choose profile"})]}),a.jsx(Hr,{outcome:i}),a.jsxs(Ee,{store:n,onOptionSubmit:u,children:[a.jsx(Ee.EventsTarget,{children:a.jsx(ie,{placeholder:"Search",value:r,onChange:f=>{o(f.currentTarget.value),n.updateSelectedOptionIndex()}})}),a.jsx("div",{children:a.jsx(Ee.Options,{children:d.length>0?d:a.jsx(Ee.Empty,{children:"Nothing found..."})})})]})]})}function xV(e){var t,n;return a.jsxs(Y,{children:[a.jsx(is,{radius:"xl"}),a.jsxs("div",{children:[a.jsx(oe,{fz:"sm",fw:500,children:(t=e.profile)==null?void 0:t.display}),a.jsx(oe,{fz:"xs",opacity:.6,children:(n=e.project)==null?void 0:n.display})]})]})}function wV(e){const t=ee();return a.jsx(Be,{style:{maxWidth:400},onSubmit:n=>{t.post("auth/scope",{login:e.login,scope:Object.keys(n).join(" ")}).then(e.handleAuthResponse).catch(console.log)},children:a.jsxs(je,{children:[a.jsxs(on,{style:{flexDirection:"column"},children:[a.jsx(Vr,{size:32}),a.jsx(le,{children:"Choose scope"})]}),a.jsx(je,{children:(e.scope??"openid").split(" ").map(n=>a.jsx(gr,{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 SV(e){const t=ee(),[n,r]=p.useState();return a.jsx(Be,{style:{maxWidth:400},onSubmit:o=>{r(void 0),t.post("auth/mfa/verify",{login:e.login,token:o.token}).then(e.handleAuthResponse).catch(i=>r(Re(i)))},children:a.jsxs(je,{children:[a.jsxs(on,{style:{flexDirection:"column"},children:[a.jsx(Vr,{size:32}),a.jsx(le,{children:"Enter MFA code"})]}),n&&a.jsx(xs,{icon:a.jsx(Vc,{size:16}),title:"Error",color:"red",children:n}),a.jsx(je,{children:a.jsx(ie,{name:"token",label:"MFA code",required:!0,autoFocus:!0})}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"Submit code"})})]})})}function xk(e){const{login:t,chooseScopes:n,onSuccess:r,onForgotPassword:o,onRegister:i,onCode:s,...l}=e,c=ee(),[u,d]=p.useState(),f=p.useRef(!1),[h,m]=p.useState(!1),[g,y]=p.useState(),S=p.useCallback(w=>{s?s(w):c.processCode(w).then(()=>{r&&r()}).catch(b=>ue({color:"red",message:Re(b)}))},[c,s,r]),v=p.useCallback(w=>{m(!!w.mfaRequired),w.login&&d(w.login),w.memberships&&y(w.memberships),w.code&&(n?y(void 0):S(w.code))},[n,S]),x=p.useCallback(w=>{S(w.code)},[S]);return p.useEffect(()=>{t&&!f.current&&!u&&(f.current=!0,c.get("auth/login/"+t).then(v).catch(w=>ue({color:"red",message:Re(w)})))},[c,t,f,u,v]),a.jsx(Ce,{width:450,px:"sm",py:"md",children:u?h?a.jsx(SV,{login:u,handleAuthResponse:v}):g?a.jsx(vV,{login:u,memberships:g,handleAuthResponse:v}):e.projectId==="new"?a.jsx(hk,{login:u,handleAuthResponse:v}):e.chooseScopes?a.jsx(wV,{login:u,scope:e.scope,handleAuthResponse:x}):a.jsx("div",{children:"Success"}):a.jsx(mV,{onForgotPassword:o,onRegister:i,handleAuthResponse:v,disableGoogleAuth:e.disableGoogleAuth,disableEmailAuth:e.disableEmailAuth,...l,children:e.children})})}var wk,Dw=jc;wk=Dw.createRoot,Dw.hydrateRoot;/**
517
+ * @remix-run/router v1.15.3
518
+ *
519
+ * Copyright (c) Remix Software Inc.
520
+ *
521
+ * This source code is licensed under the MIT license found in the
522
+ * LICENSE.md file in the root directory of this source tree.
523
+ *
524
+ * @license MIT
525
+ */function It(){return It=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},It.apply(this,arguments)}var Ft;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(Ft||(Ft={}));const Aw="popstate";function bV(e){e===void 0&&(e={});function t(r,o){let{pathname:i,search:s,hash:l}=r.location;return pc("",{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:Zc(o)}return EV(t,n,null,e)}function Ne(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function Aa(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function CV(){return Math.random().toString(36).substr(2,8)}function Nw(e,t){return{usr:e.state,key:e.key,idx:t}}function pc(e,t,n,r){return n===void 0&&(n=null),It({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?Vo(t):t,{state:n,key:t&&t.key||r||CV()})}function Zc(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 Vo(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 EV(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:i=!1}=r,s=o.history,l=Ft.Pop,c=null,u=d();u==null&&(u=0,s.replaceState(It({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function f(){l=Ft.Pop;let S=d(),v=S==null?null:S-u;u=S,c&&c({action:l,location:y.location,delta:v})}function h(S,v){l=Ft.Push;let x=pc(y.location,S,v);n&&n(x,S),u=d()+1;let w=Nw(x,u),b=y.createHref(x);try{s.pushState(w,"",b)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;o.location.assign(b)}i&&c&&c({action:l,location:y.location,delta:1})}function m(S,v){l=Ft.Replace;let x=pc(y.location,S,v);n&&n(x,S),u=d();let w=Nw(x,u),b=y.createHref(x);s.replaceState(w,"",b),i&&c&&c({action:l,location:y.location,delta:0})}function g(S){let v=o.location.origin!=="null"?o.location.origin:o.location.href,x=typeof S=="string"?S:Zc(S);return x=x.replace(/ $/,"%20"),Ne(v,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,v)}let y={get action(){return l},get location(){return e(o,s)},listen(S){if(c)throw new Error("A history only accepts one active listener");return o.addEventListener(Aw,f),c=S,()=>{o.removeEventListener(Aw,f),c=null}},createHref(S){return t(o,S)},createURL:g,encodeLocation(S){let v=g(S);return{pathname:v.pathname,search:v.search,hash:v.hash}},push:h,replace:m,go(S){return s.go(S)}};return y}var kt;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(kt||(kt={}));const jV=new Set(["lazy","caseSensitive","path","id","index","children"]);function PV(e){return e.index===!0}function Bm(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(Ne(o.index!==!0||!o.children,"Cannot specify children on an index route"),Ne(!r[l],'Found a route id collision on id "'+l+`". Route id's must be globally unique within Data Router usages`),PV(o)){let c=It({},o,t(o),{id:l});return r[l]=c,c}else{let c=It({},o,t(o),{id:l,children:void 0});return r[l]=c,o.children&&(c.children=Bm(o.children,t,s,r)),c}})}function ia(e,t,n){n===void 0&&(n="/");let r=typeof t=="string"?Vo(t):t,o=eu(r.pathname||"/",n);if(o==null)return null;let i=Sk(e);kV(i);let s=null;for(let l=0;s==null&&l<i.length;++l){let c=zV(o);s=$V(i[l],c)}return s}function TV(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 Sk(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("/")&&(Ne(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=gi([r,c.relativePath]),d=n.concat(c);i.children&&i.children.length>0&&(Ne(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Sk(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:OV(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 bk(i.path))o(i,s,c)}),t}function bk(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=bk(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 kV(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:MV(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const RV=/^:[\w-]+$/,_V=3,IV=2,DV=1,AV=10,NV=-2,Ow=e=>e==="*";function OV(e,t){let n=e.split("/"),r=n.length;return n.some(Ow)&&(r+=NV),t&&(r+=IV),n.filter(o=>!Ow(o)).reduce((o,i)=>o+(RV.test(i)?_V:i===""?DV:AV),r)}function MV(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 $V(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=LV({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:gi([o,d.pathname]),pathnameBase:VV(gi([o,d.pathnameBase])),route:f}),d.pathnameBase!=="/"&&(o=gi([o,d.pathnameBase]))}return i}function LV(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=FV(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]=(g||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:s,pattern:e}}function FV(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Aa(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 zV(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Aa(!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 eu(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 BV(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?Vo(e):e;return{pathname:n?n.startsWith("/")?n:UV(n,t):t,search:HV(r),hash:WV(o)}}function UV(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 hp(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 Ck(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function Ek(e,t){let n=Ck(e);return t?n.map((r,o)=>o===e.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function jk(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=Vo(e):(o=It({},e),Ne(!o.pathname||!o.pathname.includes("?"),hp("?","pathname","search",o)),Ne(!o.pathname||!o.pathname.includes("#"),hp("#","pathname","hash",o)),Ne(!o.search||!o.search.includes("#"),hp("#","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=BV(o,l),u=s&&s!=="/"&&s.endsWith("/"),d=(i||s===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(u||d)&&(c.pathname+="/"),c}const gi=e=>e.join("/").replace(/\/\/+/g,"/"),VV=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),HV=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,WV=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class w0{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 Pk(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const Tk=["post","put","patch","delete"],qV=new Set(Tk),GV=["get",...Tk],QV=new Set(GV),KV=new Set([301,302,303,307,308]),YV=new Set([307,308]),pp={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},XV={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},ml={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},kk=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,JV=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),Rk="remix-router-transitions";function ZV(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;Ne(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=z=>({hasErrorBoundary:A(z)})}else o=JV;let i={},s=Bm(e.routes,o,void 0,i),l,c=e.basename||"/",u=It({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},e.future),d=null,f=new Set,h=null,m=null,g=null,y=e.hydrationData!=null,S=ia(s,e.history.location,c),v=null;if(S==null){let A=lr(404,{pathname:e.history.location.pathname}),{matches:z,route:W}=Vw(s);S=z,v={[W.id]:A}}let x,w=S.some(A=>A.route.lazy),b=S.some(A=>A.route.loader);if(w)x=!1;else if(!b)x=!0;else if(u.v7_partialHydration){let A=e.hydrationData?e.hydrationData.loaderData:null,z=e.hydrationData?e.hydrationData.errors:null,W=X=>X.route.loader?X.route.loader.hydrate===!0?!1:A&&A[X.route.id]!==void 0||z&&z[X.route.id]!==void 0:!0;if(z){let X=S.findIndex(de=>z[de.route.id]!==void 0);x=S.slice(0,X+1).every(W)}else x=S.every(W)}else x=e.hydrationData!=null;let j,E={historyAction:e.history.action,location:e.history.location,matches:S,initialized:x,navigation:pp,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},P=Ft.Pop,T=!1,_,D=!1,O=new Map,I=null,L=!1,N=!1,M=[],$=[],R=new Map,k=0,F=-1,q=new Map,G=new Set,ne=new Map,xe=new Map,ge=new Set,Pe=new Map,Te=new Map,Le=!1;function pe(){if(d=e.history.listen(A=>{let{action:z,location:W,delta:X}=A;if(Le){Le=!1;return}Aa(Te.size===0||X!=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 de=or({currentLocation:E.location,nextLocation:W,historyAction:z});if(de&&X!=null){Le=!0,e.history.go(X*-1),ks(de,{state:"blocked",location:W,proceed(){ks(de,{state:"proceeding",proceed:void 0,reset:void 0,location:W}),e.history.go(X)},reset(){let ve=new Map(E.blockers);ve.set(de,ml),me({blockers:ve})}});return}return Qe(z,W)}),n){uH(t,O);let A=()=>dH(t,O);t.addEventListener("pagehide",A),I=()=>t.removeEventListener("pagehide",A)}return E.initialized||Qe(Ft.Pop,E.location,{initialHydration:!0}),j}function Ge(){d&&d(),I&&I(),f.clear(),_&&_.abort(),E.fetchers.forEach((A,z)=>rr(z)),E.blockers.forEach((A,z)=>ru(z))}function Ot(A){return f.add(A),()=>f.delete(A)}function me(A,z){z===void 0&&(z={}),E=It({},E,A);let W=[],X=[];u.v7_fetcherPersist&&E.fetchers.forEach((de,ve)=>{de.state==="idle"&&(ge.has(ve)?X.push(ve):W.push(ve))}),[...f].forEach(de=>de(E,{deletedFetchers:X,unstable_viewTransitionOpts:z.viewTransitionOpts,unstable_flushSync:z.flushSync===!0})),u.v7_fetcherPersist&&(W.forEach(de=>E.fetchers.delete(de)),X.forEach(de=>rr(de)))}function Fe(A,z,W){var X,de;let{flushSync:ve}=W===void 0?{}:W,be=E.actionData!=null&&E.navigation.formMethod!=null&&Rr(E.navigation.formMethod)&&E.navigation.state==="loading"&&((X=A.state)==null?void 0:X._isRedirect)!==!0,we;z.actionData?Object.keys(z.actionData).length>0?we=z.actionData:we=null:be?we=E.actionData:we=null;let ye=z.loaderData?Uw(E.loaderData,z.loaderData,z.matches||[],z.errors):E.loaderData,Ae=E.blockers;Ae.size>0&&(Ae=new Map(Ae),Ae.forEach((nt,Ht)=>Ae.set(Ht,ml)));let $t=T===!0||E.navigation.formMethod!=null&&Rr(E.navigation.formMethod)&&((de=A.state)==null?void 0:de._isRedirect)!==!0;l&&(s=l,l=void 0),L||P===Ft.Pop||(P===Ft.Push?e.history.push(A,A.state):P===Ft.Replace&&e.history.replace(A,A.state));let Ie;if(P===Ft.Pop){let nt=O.get(E.location.pathname);nt&&nt.has(A.pathname)?Ie={currentLocation:E.location,nextLocation:A}:O.has(A.pathname)&&(Ie={currentLocation:A,nextLocation:E.location})}else if(D){let nt=O.get(E.location.pathname);nt?nt.add(A.pathname):(nt=new Set([A.pathname]),O.set(E.location.pathname,nt)),Ie={currentLocation:E.location,nextLocation:A}}me(It({},z,{actionData:we,loaderData:ye,historyAction:P,location:A,initialized:!0,navigation:pp,revalidation:"idle",restoreScrollPosition:Rs(A,z.matches||E.matches),preventScrollReset:$t,blockers:Ae}),{viewTransitionOpts:Ie,flushSync:ve===!0}),P=Ft.Pop,T=!1,D=!1,L=!1,N=!1,M=[],$=[]}async function ct(A,z){if(typeof A=="number"){e.history.go(A);return}let W=Um(E.location,E.matches,c,u.v7_prependBasename,A,u.v7_relativeSplatPath,z==null?void 0:z.fromRouteId,z==null?void 0:z.relative),{path:X,submission:de,error:ve}=Mw(u.v7_normalizeFormMethod,!1,W,z),be=E.location,we=pc(E.location,X,z&&z.state);we=It({},we,e.history.encodeLocation(we));let ye=z&&z.replace!=null?z.replace:void 0,Ae=Ft.Push;ye===!0?Ae=Ft.Replace:ye===!1||de!=null&&Rr(de.formMethod)&&de.formAction===E.location.pathname+E.location.search&&(Ae=Ft.Replace);let $t=z&&"preventScrollReset"in z?z.preventScrollReset===!0:void 0,Ie=(z&&z.unstable_flushSync)===!0,nt=or({currentLocation:be,nextLocation:we,historyAction:Ae});if(nt){ks(nt,{state:"blocked",location:we,proceed(){ks(nt,{state:"proceeding",proceed:void 0,reset:void 0,location:we}),ct(A,z)},reset(){let Ht=new Map(E.blockers);Ht.set(nt,ml),me({blockers:Ht})}});return}return await Qe(Ae,we,{submission:de,pendingError:ve,preventScrollReset:$t,replace:z&&z.replace,enableViewTransition:z&&z.unstable_viewTransition,flushSync:Ie})}function Oe(){if(He(),me({revalidation:"loading"}),E.navigation.state!=="submitting"){if(E.navigation.state==="idle"){Qe(E.historyAction,E.location,{startUninterruptedRevalidation:!0});return}Qe(P||E.historyAction,E.navigation.location,{overrideNavigation:E.navigation})}}async function Qe(A,z,W){_&&_.abort(),_=null,P=A,L=(W&&W.startUninterruptedRevalidation)===!0,el(E.location,E.matches),T=(W&&W.preventScrollReset)===!0,D=(W&&W.enableViewTransition)===!0;let X=l||s,de=W&&W.overrideNavigation,ve=ia(X,z,c),be=(W&&W.flushSync)===!0;if(!ve){let Ht=lr(404,{pathname:z.pathname}),{matches:tn,route:Lt}=Vw(X);Di(),Fe(z,{matches:tn,loaderData:{},errors:{[Lt.id]:Ht}},{flushSync:be});return}if(E.initialized&&!N&&oH(E.location,z)&&!(W&&W.submission&&Rr(W.submission.formMethod))){Fe(z,{matches:ve},{flushSync:be});return}_=new AbortController;let we=yl(e.history,z,_.signal,W&&W.submission),ye,Ae;if(W&&W.pendingError)Ae={[$l(ve).route.id]:W.pendingError};else if(W&&W.submission&&Rr(W.submission.formMethod)){let Ht=await Bt(we,z,W.submission,ve,{replace:W.replace,flushSync:be});if(Ht.shortCircuited)return;ye=Ht.pendingActionData,Ae=Ht.pendingActionError,de=mp(z,W.submission),be=!1,we=new Request(we.url,{signal:we.signal})}let{shortCircuited:$t,loaderData:Ie,errors:nt}=await _n(we,z,ve,de,W&&W.submission,W&&W.fetcherSubmission,W&&W.replace,W&&W.initialHydration===!0,be,ye,Ae);$t||(_=null,Fe(z,It({matches:ve},ye?{actionData:ye}:{},{loaderData:Ie,errors:nt})))}async function Bt(A,z,W,X,de){de===void 0&&(de={}),He();let ve=lH(z,W);me({navigation:ve},{flushSync:de.flushSync===!0});let be,we=Hm(X,z);if(!we.route.action&&!we.route.lazy)be={type:kt.error,error:lr(405,{method:A.method,pathname:z.pathname,routeId:we.route.id})};else if(be=await gl("action",A,we,X,i,o,c,u.v7_relativeSplatPath),A.signal.aborted)return{shortCircuited:!0};if(Gi(be)){let ye;return de&&de.replace!=null?ye=de.replace:ye=be.location===E.location.pathname+E.location.search,await te(E,be,{submission:W,replace:ye}),{shortCircuited:!0}}if(sa(be)){let ye=$l(X,we.route.id);return(de&&de.replace)!==!0&&(P=Ft.Push),{pendingActionData:{},pendingActionError:{[ye.route.id]:be.error}}}if(qi(be))throw lr(400,{type:"defer-action"});return{pendingActionData:{[we.route.id]:be.data}}}async function _n(A,z,W,X,de,ve,be,we,ye,Ae,$t){let Ie=X||mp(z,de),nt=de||ve||qw(Ie),Ht=l||s,[tn,Lt]=$w(e.history,E,W,nt,z,u.v7_partialHydration&&we===!0,N,M,$,ge,ne,G,Ht,c,Ae,$t);if(Di(Ke=>!(W&&W.some(rt=>rt.route.id===Ke))||tn&&tn.some(rt=>rt.route.id===Ke)),F=++k,tn.length===0&&Lt.length===0){let Ke=br();return Fe(z,It({matches:W,loaderData:{},errors:$t||null},Ae?{actionData:Ae}:{},Ke?{fetchers:new Map(E.fetchers)}:{}),{flushSync:ye}),{shortCircuited:!0}}if(!L&&(!u.v7_partialHydration||!we)){Lt.forEach(rt=>{let Dn=E.fetchers.get(rt.key),su=vl(void 0,Dn?Dn.data:void 0);E.fetchers.set(rt.key,su)});let Ke=Ae||E.actionData;me(It({navigation:Ie},Ke?Object.keys(Ke).length===0?{actionData:null}:{actionData:Ke}:{},Lt.length>0?{fetchers:new Map(E.fetchers)}:{}),{flushSync:ye})}Lt.forEach(Ke=>{R.has(Ke.key)&&In(Ke.key),Ke.controller&&R.set(Ke.key,Ke.controller)});let Ye=()=>Lt.forEach(Ke=>In(Ke.key));_&&_.signal.addEventListener("abort",Ye);let{results:Ai,loaderResults:uo,fetcherResults:Cr}=await _e(E.matches,W,tn,Lt,A);if(A.signal.aborted)return{shortCircuited:!0};_&&_.signal.removeEventListener("abort",Ye),Lt.forEach(Ke=>R.delete(Ke.key));let fo=Hw(Ai);if(fo){if(fo.idx>=tn.length){let Ke=Lt[fo.idx-tn.length].key;G.add(Ke)}return await te(E,fo.result,{replace:be}),{shortCircuited:!0}}let{loaderData:mh,errors:tl}=Bw(E,W,tn,uo,$t,Lt,Cr,Pe);Pe.forEach((Ke,rt)=>{Ke.subscribe(Dn=>{(Dn||Ke.done)&&Pe.delete(rt)})}),u.v7_partialHydration&&we&&E.errors&&Object.entries(E.errors).filter(Ke=>{let[rt]=Ke;return!tn.some(Dn=>Dn.route.id===rt)}).forEach(Ke=>{let[rt,Dn]=Ke;tl=Object.assign(tl||{},{[rt]:Dn})});let gh=br(),_s=Wo(F),iu=gh||_s||Lt.length>0;return It({loaderData:mh,errors:tl},iu?{fetchers:new Map(E.fetchers)}:{})}function lo(A,z,W,X){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.");R.has(A)&&In(A);let de=(X&&X.unstable_flushSync)===!0,ve=l||s,be=Um(E.location,E.matches,c,u.v7_prependBasename,W,u.v7_relativeSplatPath,z,X==null?void 0:X.relative),we=ia(ve,be,c);if(!we){Mt(A,z,lr(404,{pathname:be}),{flushSync:de});return}let{path:ye,submission:Ae,error:$t}=Mw(u.v7_normalizeFormMethod,!0,be,X);if($t){Mt(A,z,$t,{flushSync:de});return}let Ie=Hm(we,ye);if(T=(X&&X.preventScrollReset)===!0,Ae&&Rr(Ae.formMethod)){en(A,z,ye,Ie,we,de,Ae);return}ne.set(A,{routeId:z,path:ye}),co(A,z,ye,Ie,we,de,Ae)}async function en(A,z,W,X,de,ve,be){if(He(),ne.delete(A),!X.route.action&&!X.route.lazy){let rt=lr(405,{method:be.formMethod,pathname:W,routeId:z});Mt(A,z,rt,{flushSync:ve});return}let we=E.fetchers.get(A);tt(A,cH(be,we),{flushSync:ve});let ye=new AbortController,Ae=yl(e.history,W,ye.signal,be);R.set(A,ye);let $t=k,Ie=await gl("action",Ae,X,de,i,o,c,u.v7_relativeSplatPath);if(Ae.signal.aborted){R.get(A)===ye&&R.delete(A);return}if(u.v7_fetcherPersist&&ge.has(A)){if(Gi(Ie)||sa(Ie)){tt(A,Ko(void 0));return}}else{if(Gi(Ie))if(R.delete(A),F>$t){tt(A,Ko(void 0));return}else return G.add(A),tt(A,vl(be)),te(E,Ie,{fetcherSubmission:be});if(sa(Ie)){Mt(A,z,Ie.error);return}}if(qi(Ie))throw lr(400,{type:"defer-action"});let nt=E.navigation.location||E.location,Ht=yl(e.history,nt,ye.signal),tn=l||s,Lt=E.navigation.state!=="idle"?ia(tn,E.navigation.location,c):E.matches;Ne(Lt,"Didn't find any matches after fetcher action");let Ye=++k;q.set(A,Ye);let Ai=vl(be,Ie.data);E.fetchers.set(A,Ai);let[uo,Cr]=$w(e.history,E,Lt,be,nt,!1,N,M,$,ge,ne,G,tn,c,{[X.route.id]:Ie.data},void 0);Cr.filter(rt=>rt.key!==A).forEach(rt=>{let Dn=rt.key,su=E.fetchers.get(Dn),oR=vl(void 0,su?su.data:void 0);E.fetchers.set(Dn,oR),R.has(Dn)&&In(Dn),rt.controller&&R.set(Dn,rt.controller)}),me({fetchers:new Map(E.fetchers)});let fo=()=>Cr.forEach(rt=>In(rt.key));ye.signal.addEventListener("abort",fo);let{results:mh,loaderResults:tl,fetcherResults:gh}=await _e(E.matches,Lt,uo,Cr,Ht);if(ye.signal.aborted)return;ye.signal.removeEventListener("abort",fo),q.delete(A),R.delete(A),Cr.forEach(rt=>R.delete(rt.key));let _s=Hw(mh);if(_s){if(_s.idx>=uo.length){let rt=Cr[_s.idx-uo.length].key;G.add(rt)}return te(E,_s.result)}let{loaderData:iu,errors:Ke}=Bw(E,E.matches,uo,tl,void 0,Cr,gh,Pe);if(E.fetchers.has(A)){let rt=Ko(Ie.data);E.fetchers.set(A,rt)}Wo(Ye),E.navigation.state==="loading"&&Ye>F?(Ne(P,"Expected pending action"),_&&_.abort(),Fe(E.navigation.location,{matches:Lt,loaderData:iu,errors:Ke,fetchers:new Map(E.fetchers)})):(me({errors:Ke,loaderData:Uw(E.loaderData,iu,Lt,Ke),fetchers:new Map(E.fetchers)}),N=!1)}async function co(A,z,W,X,de,ve,be){let we=E.fetchers.get(A);tt(A,vl(be,we?we.data:void 0),{flushSync:ve});let ye=new AbortController,Ae=yl(e.history,W,ye.signal);R.set(A,ye);let $t=k,Ie=await gl("loader",Ae,X,de,i,o,c,u.v7_relativeSplatPath);if(qi(Ie)&&(Ie=await Dk(Ie,Ae.signal,!0)||Ie),R.get(A)===ye&&R.delete(A),!Ae.signal.aborted){if(ge.has(A)){tt(A,Ko(void 0));return}if(Gi(Ie))if(F>$t){tt(A,Ko(void 0));return}else{G.add(A),await te(E,Ie);return}if(sa(Ie)){Mt(A,z,Ie.error);return}Ne(!qi(Ie),"Unhandled fetcher deferred data"),tt(A,Ko(Ie.data))}}async function te(A,z,W){let{submission:X,fetcherSubmission:de,replace:ve}=W===void 0?{}:W;z.revalidate&&(N=!0);let be=pc(A.location,z.location,{_isRedirect:!0});if(Ne(be,"Expected a location on the redirect navigation"),n){let nt=!1;if(z.reloadDocument)nt=!0;else if(kk.test(z.location)){const Ht=e.history.createURL(z.location);nt=Ht.origin!==t.location.origin||eu(Ht.pathname,c)==null}if(nt){ve?t.location.replace(z.location):t.location.assign(z.location);return}}_=null;let we=ve===!0?Ft.Replace:Ft.Push,{formMethod:ye,formAction:Ae,formEncType:$t}=A.navigation;!X&&!de&&ye&&Ae&&$t&&(X=qw(A.navigation));let Ie=X||de;if(YV.has(z.status)&&Ie&&Rr(Ie.formMethod))await Qe(we,be,{submission:It({},Ie,{formAction:z.location}),preventScrollReset:T});else{let nt=mp(be,X);await Qe(we,be,{overrideNavigation:nt,fetcherSubmission:de,preventScrollReset:T})}}async function _e(A,z,W,X,de){let ve=await Promise.all([...W.map(ye=>gl("loader",de,ye,z,i,o,c,u.v7_relativeSplatPath)),...X.map(ye=>ye.matches&&ye.match&&ye.controller?gl("loader",yl(e.history,ye.path,ye.controller.signal),ye.match,ye.matches,i,o,c,u.v7_relativeSplatPath):{type:kt.error,error:lr(404,{pathname:ye.path})})]),be=ve.slice(0,W.length),we=ve.slice(W.length);return await Promise.all([Ww(A,W,be,be.map(()=>de.signal),!1,E.loaderData),Ww(A,X.map(ye=>ye.match),we,X.map(ye=>ye.controller?ye.controller.signal:null),!0)]),{results:ve,loaderResults:be,fetcherResults:we}}function He(){N=!0,M.push(...Di()),ne.forEach((A,z)=>{R.has(z)&&($.push(z),In(z))})}function tt(A,z,W){W===void 0&&(W={}),E.fetchers.set(A,z),me({fetchers:new Map(E.fetchers)},{flushSync:(W&&W.flushSync)===!0})}function Mt(A,z,W,X){X===void 0&&(X={});let de=$l(E.matches,z);rr(A),me({errors:{[de.route.id]:W},fetchers:new Map(E.fetchers)},{flushSync:(X&&X.flushSync)===!0})}function Wr(A){return u.v7_fetcherPersist&&(xe.set(A,(xe.get(A)||0)+1),ge.has(A)&&ge.delete(A)),E.fetchers.get(A)||XV}function rr(A){let z=E.fetchers.get(A);R.has(A)&&!(z&&z.state==="loading"&&q.has(A))&&In(A),ne.delete(A),q.delete(A),G.delete(A),ge.delete(A),E.fetchers.delete(A)}function Ii(A){if(u.v7_fetcherPersist){let z=(xe.get(A)||0)-1;z<=0?(xe.delete(A),ge.add(A)):xe.set(A,z)}else rr(A);me({fetchers:new Map(E.fetchers)})}function In(A){let z=R.get(A);Ne(z,"Expected fetch controller: "+A),z.abort(),R.delete(A)}function qr(A){for(let z of A){let W=Wr(z),X=Ko(W.data);E.fetchers.set(z,X)}}function br(){let A=[],z=!1;for(let W of G){let X=E.fetchers.get(W);Ne(X,"Expected fetcher: "+W),X.state==="loading"&&(G.delete(W),A.push(W),z=!0)}return qr(A),z}function Wo(A){let z=[];for(let[W,X]of q)if(X<A){let de=E.fetchers.get(W);Ne(de,"Expected fetcher: "+W),de.state==="loading"&&(In(W),q.delete(W),z.push(W))}return qr(z),z.length>0}function Za(A,z){let W=E.blockers.get(A)||ml;return Te.get(A)!==z&&Te.set(A,z),W}function ru(A){E.blockers.delete(A),Te.delete(A)}function ks(A,z){let W=E.blockers.get(A)||ml;Ne(W.state==="unblocked"&&z.state==="blocked"||W.state==="blocked"&&z.state==="blocked"||W.state==="blocked"&&z.state==="proceeding"||W.state==="blocked"&&z.state==="unblocked"||W.state==="proceeding"&&z.state==="unblocked","Invalid blocker state transition: "+W.state+" -> "+z.state);let X=new Map(E.blockers);X.set(A,z),me({blockers:X})}function or(A){let{currentLocation:z,nextLocation:W,historyAction:X}=A;if(Te.size===0)return;Te.size>1&&Aa(!1,"A router only supports one blocker at a time");let de=Array.from(Te.entries()),[ve,be]=de[de.length-1],we=E.blockers.get(ve);if(!(we&&we.state==="proceeding")&&be({currentLocation:z,nextLocation:W,historyAction:X}))return ve}function Di(A){let z=[];return Pe.forEach((W,X)=>{(!A||A(X))&&(W.cancel(),z.push(X),Pe.delete(X))}),z}function ph(A,z,W){if(h=A,g=z,m=W||null,!y&&E.navigation===pp){y=!0;let X=Rs(E.location,E.matches);X!=null&&me({restoreScrollPosition:X})}return()=>{h=null,g=null,m=null}}function ou(A,z){return m&&m(A,z.map(X=>TV(X,E.loaderData)))||A.key}function el(A,z){if(h&&g){let W=ou(A,z);h[W]=g()}}function Rs(A,z){if(h){let W=ou(A,z),X=h[W];if(typeof X=="number")return X}return null}function qo(A){i={},l=Bm(A,o,void 0,i)}return j={get basename(){return c},get future(){return u},get state(){return E},get routes(){return s},get window(){return t},initialize:pe,subscribe:Ot,enableScrollRestoration:ph,navigate:ct,fetch:lo,revalidate:Oe,createHref:A=>e.history.createHref(A),encodeLocation:A=>e.history.encodeLocation(A),getFetcher:Wr,deleteFetcher:Ii,dispose:Ge,getBlocker:Za,deleteBlocker:ru,_internalFetchControllers:R,_internalActiveDeferreds:Pe,_internalSetRoutes:qo},j}function eH(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Um(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=jk(o||".",Ek(c,i),eu(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&&!S0(d.search)&&(d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index"),r&&n!=="/"&&(d.pathname=d.pathname==="/"?n:gi([n,d.pathname])),Zc(d)}function Mw(e,t,n,r){if(!r||!eH(r))return{path:n};if(r.formMethod&&!aH(r.formMethod))return{path:n,error:lr(405,{method:r.formMethod})};let o=()=>({path:n,error:lr(400,{type:"invalid-body"})}),i=r.formMethod||"get",s=e?i.toUpperCase():i.toLowerCase(),l=Ik(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!Rr(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,S]=g;return""+m+y+"="+S+`
526
+ `},""):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(!Rr(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()}}}Ne(typeof FormData=="function","FormData is not available in this environment");let c,u;if(r.formData)c=Vm(r.formData),u=r.formData;else if(r.body instanceof FormData)c=Vm(r.body),u=r.body;else if(r.body instanceof URLSearchParams)c=r.body,u=zw(c);else if(r.body==null)c=new URLSearchParams,u=new FormData;else try{c=new URLSearchParams(r.body),u=zw(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(Rr(d.formMethod))return{path:n,submission:d};let f=Vo(n);return t&&f.search&&S0(f.search)&&c.append("index",""),f.search="?"+c,{path:Zc(f),submission:d}}function tH(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 $w(e,t,n,r,o,i,s,l,c,u,d,f,h,m,g,y){let S=y?Object.values(y)[0]:g?Object.values(g)[0]:void 0,v=e.createURL(t.location),x=e.createURL(o),w=y?Object.keys(y)[0]:void 0,j=tH(n,w).filter((P,T)=>{let{route:_}=P;if(_.lazy)return!0;if(_.loader==null)return!1;if(i)return _.loader.hydrate?!0:t.loaderData[_.id]===void 0&&(!t.errors||t.errors[_.id]===void 0);if(nH(t.loaderData,t.matches[T],P)||l.some(I=>I===P.route.id))return!0;let D=t.matches[T],O=P;return Lw(P,It({currentUrl:v,currentParams:D.params,nextUrl:x,nextParams:O.params},r,{actionResult:S,defaultShouldRevalidate:s||v.pathname+v.search===x.pathname+x.search||v.search!==x.search||_k(D,O)}))}),E=[];return d.forEach((P,T)=>{if(i||!n.some(L=>L.route.id===P.routeId)||u.has(T))return;let _=ia(h,P.path,m);if(!_){E.push({key:T,routeId:P.routeId,path:P.path,matches:null,match:null,controller:null});return}let D=t.fetchers.get(T),O=Hm(_,P.path),I=!1;f.has(T)?I=!1:c.includes(T)?I=!0:D&&D.state!=="idle"&&D.data===void 0?I=s:I=Lw(O,It({currentUrl:v,currentParams:t.matches[t.matches.length-1].params,nextUrl:x,nextParams:n[n.length-1].params},r,{actionResult:S,defaultShouldRevalidate:s})),I&&E.push({key:T,routeId:P.routeId,path:P.path,matches:_,match:O,controller:new AbortController})}),[j,E]}function nH(e,t,n){let r=!t||n.route.id!==t.route.id,o=e[n.route.id]===void 0;return r||o}function _k(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Lw(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}async function Fw(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let o=n[e.id];Ne(o,"No route found in manifest");let i={};for(let s in r){let c=o[s]!==void 0&&s!=="hasErrorBoundary";Aa(!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&&!jV.has(s)&&(i[s]=r[s])}Object.assign(o,i),Object.assign(o,It({},t(o),{lazy:void 0}))}async function gl(e,t,n,r,o,i,s,l,c){c===void 0&&(c={});let u,d,f,h=y=>{let S,v=new Promise((x,w)=>S=w);return f=()=>S(),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 S,v=await Promise.all([h(y).catch(x=>{S=x}),Fw(n.route,i,o)]);if(S)throw S;d=v[0]}else if(await Fw(n.route,i,o),y=n.route[e],y)d=await h(y);else if(e==="action"){let S=new URL(t.url),v=S.pathname+S.search;throw lr(405,{method:t.method,pathname:v,routeId:n.route.id})}else return{type:kt.data,data:void 0};else if(y)d=await h(y);else{let S=new URL(t.url),v=S.pathname+S.search;throw lr(404,{pathname:v})}Ne(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=kt.error,d=y}finally{f&&t.signal.removeEventListener("abort",f)}if(sH(d)){let y=d.status;if(KV.has(y)){let v=d.headers.get("Location");if(Ne(v,"Redirects returned/thrown from loaders/actions must have a Location header"),!kk.test(v))v=Um(new URL(t.url),r.slice(0,r.indexOf(n)+1),s,!0,v,l);else if(!c.isStaticRequest){let x=new URL(t.url),w=v.startsWith("//")?new URL(x.protocol+v):new URL(v),b=eu(w.pathname,s)!=null;w.origin===x.origin&&b&&(v=w.pathname+w.search+w.hash)}if(c.isStaticRequest)throw d.headers.set("Location",v),d;return{type:kt.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===kt.error?kt.error:kt.data,response:d};let S;try{let v=d.headers.get("Content-Type");v&&/\bapplication\/json\b/.test(v)?d.body==null?S=null:S=await d.json():S=await d.text()}catch(v){return{type:kt.error,error:v}}return u===kt.error?{type:u,error:new w0(y,d.statusText,S),headers:d.headers}:{type:kt.data,data:S,statusCode:d.status,headers:d.headers}}if(u===kt.error)return{type:u,error:d};if(iH(d)){var m,g;return{type:kt.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:kt.data,data:d}}function yl(e,t,n,r){let o=e.createURL(Ik(t)).toString(),i={signal:n};if(r&&Rr(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=Vm(r.formData):i.body=r.formData}return new Request(o,i)}function Vm(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function zw(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function rH(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(Ne(!Gi(d),"Cannot handle redirect results in processLoaderData"),sa(d)){let m=$l(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=Pk(d.error)?d.error.status:500),d.headers&&(u[h]=d.headers)}else qi(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 Bw(e,t,n,r,o,i,s,l){let{loaderData:c,errors:u}=rH(t,n,r,o,l);for(let d=0;d<i.length;d++){let{key:f,match:h,controller:m}=i[d];Ne(s!==void 0&&s[d]!==void 0,"Did not find corresponding fetcher result");let g=s[d];if(!(m&&m.signal.aborted))if(sa(g)){let y=$l(e.matches,h==null?void 0:h.route.id);u&&u[y.route.id]||(u=It({},u,{[y.route.id]:g.error})),e.fetchers.delete(f)}else if(Gi(g))Ne(!1,"Unhandled fetcher revalidation redirect");else if(qi(g))Ne(!1,"Unhandled fetcher deferred data");else{let y=Ko(g.data);e.fetchers.set(f,y)}}return{loaderData:c,errors:u}}function Uw(e,t,n,r){let o=It({},t);for(let i of n){let s=i.route.id;if(t.hasOwnProperty(s)?t[s]!==void 0&&(o[s]=t[s]):e[s]!==void 0&&i.route.loader&&(o[s]=e[s]),r&&r.hasOwnProperty(s))break}return o}function $l(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 Vw(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 lr(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 w0(e||500,s,new Error(l),!0)}function Hw(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(Gi(n))return{result:n,idx:t}}}function Ik(e){let t=typeof e=="string"?Vo(e):e;return Zc(It({},t,{hash:""}))}function oH(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function qi(e){return e.type===kt.deferred}function sa(e){return e.type===kt.error}function Gi(e){return(e&&e.type)===kt.redirect}function iH(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 sH(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function aH(e){return QV.has(e.toLowerCase())}function Rr(e){return qV.has(e.toLowerCase())}async function Ww(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&&!_k(u,c)&&(i&&i[c.route.id])!==void 0;if(qi(l)&&(o||d)){let f=r[s];Ne(f,"Expected an AbortSignal for revalidating fetcher deferred result"),await Dk(l,f,o).then(h=>{h&&(n[s]=h||n[s])})}}}async function Dk(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:kt.data,data:e.deferredData.unwrappedData}}catch(o){return{type:kt.error,error:o}}return{type:kt.data,data:e.deferredData.data}}}function S0(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Hm(e,t){let n=typeof t=="string"?Vo(t).search:t.search;if(e[e.length-1].route.index&&S0(n||""))return e[e.length-1];let r=Ck(e);return r[r.length-1]}function qw(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 mp(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 lH(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 vl(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 cH(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 Ko(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 uH(e,t){try{let n=e.sessionStorage.getItem(Rk);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 dH(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(Rk,JSON.stringify(n))}catch(r){Aa(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/**
527
+ * React Router v6.22.3
528
+ *
529
+ * Copyright (c) Remix Software Inc.
530
+ *
531
+ * This source code is licensed under the MIT license found in the
532
+ * LICENSE.md file in the root directory of this source tree.
533
+ *
534
+ * @license MIT
535
+ */function mc(){return mc=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},mc.apply(this,arguments)}const ah=p.createContext(null),Ak=p.createContext(null),lh=p.createContext(null),ch=p.createContext(null),ki=p.createContext({outlet:null,matches:[],isDataRoute:!1}),Nk=p.createContext(null);function uh(){return p.useContext(ch)!=null}function Ho(){return uh()||Ne(!1),p.useContext(ch).location}function Ok(e){p.useContext(lh).static||p.useLayoutEffect(e)}function Nt(){let{isDataRoute:e}=p.useContext(ki);return e?jH():fH()}function fH(){uh()||Ne(!1);let e=p.useContext(ah),{basename:t,future:n,navigator:r}=p.useContext(lh),{matches:o}=p.useContext(ki),{pathname:i}=Ho(),s=JSON.stringify(Ek(o,n.v7_relativeSplatPath)),l=p.useRef(!1);return Ok(()=>{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=jk(u,JSON.parse(s),i,d.relative==="path");e==null&&t!=="/"&&(f.pathname=f.pathname==="/"?t:gi([t,f.pathname])),(d.replace?r.replace:r.push)(f,d.state,d)},[t,r,s,i,e])}const hH=p.createContext(null);function pH(e){let t=p.useContext(ki).outlet;return t&&p.createElement(hH.Provider,{value:e},t)}function Xe(){let{matches:e}=p.useContext(ki),t=e[e.length-1];return t?t.params:{}}function mH(e,t){return Mk(e,t)}function Mk(e,t,n,r){uh()||Ne(!1);let{navigator:o}=p.useContext(lh),{matches:i}=p.useContext(ki),s=i[i.length-1],l=s?s.params:{};s&&s.pathname;let c=s?s.pathnameBase:"/";s&&s.route;let u=Ho(),d;if(t){var f;let S=typeof t=="string"?Vo(t):t;c==="/"||(f=S.pathname)!=null&&f.startsWith(c)||Ne(!1),d=S}else d=u;let h=d.pathname||"/",m=h;if(c!=="/"){let S=c.replace(/^\//,"").split("/");m="/"+h.replace(/^\//,"").split("/").slice(S.length).join("/")}let g=ia(e,{pathname:m}),y=wH(g&&g.map(S=>Object.assign({},S,{params:Object.assign({},l,S.params),pathname:gi([c,o.encodeLocation?o.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?c:gi([c,o.encodeLocation?o.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),i,n,r);return t&&y?p.createElement(ch.Provider,{value:{location:mc({pathname:"/",search:"",hash:"",state:null,key:"default"},d),navigationType:Ft.Pop}},y):y}function gH(){let e=EH(),t=Pk(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 yH=p.createElement(gH,null);class vH 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(ki.Provider,{value:this.props.routeContext},p.createElement(Nk.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function xH(e){let{routeContext:t,match:n,children:r}=e,o=p.useContext(ah);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),p.createElement(ki.Provider,{value:t},r)}function wH(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||Ne(!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,S=null;n&&(m=l&&f.route.id?l[f.route.id]:void 0,y=f.route.errorElement||yH,c&&(u<0&&h===0?(PH("route-fallback",!1),g=!0,S=null):u===h&&(g=!0,S=f.route.hydrateFallbackElement||null)));let v=t.concat(s.slice(0,h+1)),x=()=>{let w;return m?w=y:g?w=S:f.route.Component?w=p.createElement(f.route.Component,null):f.route.element?w=f.route.element:w=d,p.createElement(xH,{match:f,routeContext:{outlet:d,matches:v,isDataRoute:n!=null},children:w})};return n&&(f.route.ErrorBoundary||f.route.errorElement||h===0)?p.createElement(vH,{location:n.location,revalidation:n.revalidation,component:y,error:m,children:x(),routeContext:{outlet:null,matches:v,isDataRoute:!0}}):x()},null)}var $k=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}($k||{}),Hd=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}(Hd||{});function SH(e){let t=p.useContext(ah);return t||Ne(!1),t}function bH(e){let t=p.useContext(Ak);return t||Ne(!1),t}function CH(e){let t=p.useContext(ki);return t||Ne(!1),t}function Lk(e){let t=CH(),n=t.matches[t.matches.length-1];return n.route.id||Ne(!1),n.route.id}function EH(){var e;let t=p.useContext(Nk),n=bH(Hd.UseRouteError),r=Lk(Hd.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function jH(){let{router:e}=SH($k.UseNavigateStable),t=Lk(Hd.UseNavigateStable),n=p.useRef(!1);return Ok(()=>{n.current=!0}),p.useCallback(function(o,i){i===void 0&&(i={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,mc({fromRouteId:t},i)))},[e,t])}const Gw={};function PH(e,t,n){!t&&!Gw[e]&&(Gw[e]=!0)}function b0(e){return pH(e.context)}function fe(e){Ne(!1)}function TH(e){let{basename:t="/",children:n=null,location:r,navigationType:o=Ft.Pop,navigator:i,static:s=!1,future:l}=e;uh()&&Ne(!1);let c=t.replace(/^\/*/,"/"),u=p.useMemo(()=>({basename:c,navigator:i,static:s,future:mc({v7_relativeSplatPath:!1},l)}),[c,l,i,s]);typeof r=="string"&&(r=Vo(r));let{pathname:d="/",search:f="",hash:h="",state:m=null,key:g="default"}=r,y=p.useMemo(()=>{let S=eu(d,c);return S==null?null:{location:{pathname:S,search:f,hash:h,state:m,key:g},navigationType:o}},[c,d,f,h,m,g,o]);return y==null?null:p.createElement(lh.Provider,{value:u},p.createElement(ch.Provider,{children:n,value:y}))}function kH(e){let{children:t,location:n}=e;return mH(Wm(t),n)}new Promise(()=>{});function Wm(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,Wm(r.props.children,i));return}r.type!==fe&&Ne(!1),!r.props.index||!r.props.children||Ne(!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=Wm(r.props.children,i)),n.push(s)}),n}function RH(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}/**
536
+ * React Router DOM v6.22.3
537
+ *
538
+ * Copyright (c) Remix Software Inc.
539
+ *
540
+ * This source code is licensed under the MIT license found in the
541
+ * LICENSE.md file in the root directory of this source tree.
542
+ *
543
+ * @license MIT
544
+ */function Wd(){return Wd=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},Wd.apply(this,arguments)}function qm(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 _H(e,t){let n=qm(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}const IH="6";try{window.__reactRouterVersion=IH}catch{}function DH(e,t){return ZV({basename:t==null?void 0:t.basename,future:Wd({},t==null?void 0:t.future,{v7_prependBasename:!0}),history:bV({window:t==null?void 0:t.window}),hydrationData:(t==null?void 0:t.hydrationData)||AH(),routes:e,mapRouteProperties:RH,window:t==null?void 0:t.window}).initialize()}function AH(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=Wd({},t,{errors:NH(t.errors)})),t}function NH(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 w0(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 OH=p.createContext({isTransitioning:!1}),MH=p.createContext(new Map),$H="startTransition",Qw=rg[$H],LH="flushSync",Kw=YD[LH];function FH(e){Qw?Qw(e):e()}function xl(e){Kw?Kw(e):e()}class zH{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 BH(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(),S=p.useRef(new Map),{v7_startTransition:v}=r||{},x=p.useCallback(P=>{v?FH(P):P()},[v]),w=p.useCallback((P,T)=>{let{deletedFetchers:_,unstable_flushSync:D,unstable_viewTransitionOpts:O}=T;_.forEach(L=>S.current.delete(L)),P.fetchers.forEach((L,N)=>{L.data!==void 0&&S.current.set(N,L.data)});let I=n.window==null||typeof n.window.document.startViewTransition!="function";if(!O||I){D?xl(()=>i(P)):x(()=>i(P));return}if(D){xl(()=>{h&&(d&&d.resolve(),h.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:O.currentLocation,nextLocation:O.nextLocation})});let L=n.window.document.startViewTransition(()=>{xl(()=>i(P))});L.finished.finally(()=>{xl(()=>{f(void 0),m(void 0),l(void 0),u({isTransitioning:!1})})}),xl(()=>m(L));return}h?(d&&d.resolve(),h.skipTransition(),y({state:P,currentLocation:O.currentLocation,nextLocation:O.nextLocation})):(l(P),u({isTransitioning:!0,flushSync:!1,currentLocation:O.currentLocation,nextLocation:O.nextLocation}))},[n.window,h,d,S,x]);p.useLayoutEffect(()=>n.subscribe(w),[n,w]),p.useEffect(()=>{c.isTransitioning&&!c.flushSync&&f(new zH)},[c]),p.useEffect(()=>{if(d&&s&&n.window){let P=s,T=d.promise,_=n.window.document.startViewTransition(async()=>{x(()=>i(P)),await T});_.finished.finally(()=>{f(void 0),m(void 0),l(void 0),u({isTransitioning:!1})}),m(_)}},[x,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 b=p.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:P=>n.navigate(P),push:(P,T,_)=>n.navigate(P,{state:T,preventScrollReset:_==null?void 0:_.preventScrollReset}),replace:(P,T,_)=>n.navigate(P,{replace:!0,state:T,preventScrollReset:_==null?void 0:_.preventScrollReset})}),[n]),j=n.basename||"/",E=p.useMemo(()=>({router:n,navigator:b,static:!1,basename:j}),[n,b,j]);return p.createElement(p.Fragment,null,p.createElement(ah.Provider,{value:E},p.createElement(Ak.Provider,{value:o},p.createElement(MH.Provider,{value:S.current},p.createElement(OH.Provider,{value:c},p.createElement(TH,{basename:j,location:o.location,navigationType:o.historyAction,navigator:b,future:{v7_relativeSplatPath:n.future.v7_relativeSplatPath}},o.initialized||n.future.v7_partialHydration?p.createElement(UH,{routes:n.routes,future:n.future,state:o}):t))))),null)}function UH(e){let{routes:t,future:n,state:r}=e;return Mk(t,void 0,r,n)}var Yw;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Yw||(Yw={}));var Xw;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Xw||(Xw={}));function C0(e){let t=p.useRef(qm(e)),n=p.useRef(!1),r=Ho(),o=p.useMemo(()=>_H(r.search,n.current?null:t.current),[r.search]),i=Nt(),s=p.useCallback((l,c)=>{const u=qm(typeof l=="function"?l(o):l);n.current=!0,i("?"+u,c)},[i,o]);return[o,s]}const VH=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 tu(e,t){const n=HH(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 HH(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),o=VH.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var Ja=(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 WH=[".DS_Store","Thumbs.db"];function qH(e){return Ja(this,null,function*(){return qd(e)&&GH(e.dataTransfer)?XH(e.dataTransfer,e.type):QH(e)?KH(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?YH(e):[]})}function GH(e){return qd(e)}function QH(e){return qd(e)&&qd(e.target)}function qd(e){return typeof e=="object"&&e!==null}function KH(e){return Gm(e.target.files).map(t=>tu(t))}function YH(e){return Ja(this,null,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>tu(n))})}function XH(e,t){return Ja(this,null,function*(){if(e.items){const n=Gm(e.items).filter(o=>o.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(JH));return Jw(Fk(r))}return Jw(Gm(e.files).map(n=>tu(n)))})}function Jw(e){return e.filter(t=>WH.indexOf(t.name)===-1)}function Gm(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 JH(e){if(typeof e.webkitGetAsEntry!="function")return Zw(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?zk(t):Zw(e)}function Fk(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?Fk(n):[n]],[])}function Zw(e){const t=e.getAsFile();if(!t)return Promise.reject(`${e} is not a File`);const n=tu(t);return Promise.resolve(n)}function ZH(e){return Ja(this,null,function*(){return e.isDirectory?zk(e):eW(e)})}function zk(e){const t=e.createReader();return new Promise((n,r)=>{const o=[];function i(){t.readEntries(s=>Ja(this,null,function*(){if(s.length){const l=Promise.all(s.map(ZH));o.push(l),i()}else try{const l=yield Promise.all(o);n(l)}catch(l){r(l)}}),s=>{r(s)})}i()})}function eW(e){return Ja(this,null,function*(){return new Promise((t,n)=>{e.file(r=>{const o=tu(r,e.fullPath);t(o)},r=>{n(r)})})})}function tW(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 nW=Object.defineProperty,rW=Object.defineProperties,oW=Object.getOwnPropertyDescriptors,eS=Object.getOwnPropertySymbols,iW=Object.prototype.hasOwnProperty,sW=Object.prototype.propertyIsEnumerable,tS=(e,t,n)=>t in e?nW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aW=(e,t)=>{for(var n in t||(t={}))iW.call(t,n)&&tS(e,n,t[n]);if(eS)for(var n of eS(t))sW.call(t,n)&&tS(e,n,t[n]);return e},lW=(e,t)=>rW(e,oW(t));const cW="file-invalid-type",uW="file-too-large",dW="file-too-small",fW="too-many-files",hW=e=>{e=Array.isArray(e)&&e.length===1?e[0]:e;const t=Array.isArray(e)?`one of ${e.join(", ")}`:e;return{code:cW,message:`File type must be ${t}`}},nS=e=>({code:uW,message:`File is larger than ${e} ${e===1?"byte":"bytes"}`}),rS=e=>({code:dW,message:`File is smaller than ${e} ${e===1?"byte":"bytes"}`}),pW={code:fW,message:"Too many files"};function Bk(e,t){const n=e.type==="application/x-moz-file"||tW(e,t);return[n,n?null:hW(t)]}function Uk(e,t,n){if(zi(e.size))if(zi(t)&&zi(n)){if(e.size>n)return[!1,nS(n)];if(e.size<t)return[!1,rS(t)]}else{if(zi(t)&&e.size<t)return[!1,rS(t)];if(zi(n)&&e.size>n)return[!1,nS(n)]}return[!0,null]}function zi(e){return e!=null}function mW({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]=Bk(l,t),[u]=Uk(l,n,r),d=s?s(l):null;return c&&u&&!d})}function Gd(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Ou(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 oS(e){e.preventDefault()}function gW(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function yW(e){return e.indexOf("Edge/")!==-1}function vW(e=window.navigator.userAgent){return gW(e)||yW(e)}function Kr(...e){return(t,...n)=>e.some(r=>(!Gd(t)&&r&&r(t,...n),Gd(t)))}function xW(){return"showOpenFilePicker"in window}function wW(e){return zi(e)?[{description:"Files",accept:Object.entries(e).filter(([n,r])=>{let o=!0;return Vk(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(Hk))&&(console.warn(`Skipped "${n}" because an invalid file extension was provided.`),o=!1),o}).reduce((n,[r,o])=>lW(aW({},n),{[r]:o}),{})}]:e}function SW(e){if(zi(e))return Object.entries(e).reduce((t,[n,r])=>[...t,n,...r],[]).filter(t=>Vk(t)||Hk(t)).join(",")}function bW(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function CW(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function Vk(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||/\w+\/[-+.\w]+/g.test(e)}function Hk(e){return/^.*\.[\w]+$/.test(e)}var EW=Object.defineProperty,jW=Object.defineProperties,PW=Object.getOwnPropertyDescriptors,Qd=Object.getOwnPropertySymbols,Wk=Object.prototype.hasOwnProperty,qk=Object.prototype.propertyIsEnumerable,iS=(e,t,n)=>t in e?EW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wn=(e,t)=>{for(var n in t||(t={}))Wk.call(t,n)&&iS(e,n,t[n]);if(Qd)for(var n of Qd(t))qk.call(t,n)&&iS(e,n,t[n]);return e},ei=(e,t)=>jW(e,PW(t)),Kd=(e,t)=>{var n={};for(var r in e)Wk.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Qd)for(var r of Qd(e))t.indexOf(r)<0&&qk.call(e,r)&&(n[r]=e[r]);return n};const E0=p.forwardRef((e,t)=>{var n=e,{children:r}=n,o=Kd(n,["children"]);const i=Qk(o),{open:s}=i,l=Kd(i,["open"]);return p.useImperativeHandle(t,()=>({open:s}),[s]),C.createElement(p.Fragment,null,r(ei(wn({},l),{open:s})))});E0.displayName="Dropzone";const Gk={disabled:!1,getFilesFromEvent:qH,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};E0.defaultProps=Gk;E0.propTypes={children:it.func,accept:it.objectOf(it.arrayOf(it.string)),multiple:it.bool,preventDropOnDocument:it.bool,noClick:it.bool,noKeyboard:it.bool,noDrag:it.bool,noDragEventsBubbling:it.bool,minSize:it.number,maxSize:it.number,maxFiles:it.number,disabled:it.bool,getFilesFromEvent:it.func,onFileDialogCancel:it.func,onFileDialogOpen:it.func,useFsAccessApi:it.bool,autoFocus:it.bool,onDragEnter:it.func,onDragLeave:it.func,onDragOver:it.func,onDrop:it.func,onDropAccepted:it.func,onDropRejected:it.func,onError:it.func,validator:it.func};const Qm={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Qk(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:S,autoFocus:v,preventDropOnDocument:x,noClick:w,noKeyboard:b,noDrag:j,noDragEventsBubbling:E,onError:P,validator:T}=wn(wn({},Gk),e),_=p.useMemo(()=>SW(t),[t]),D=p.useMemo(()=>wW(t),[t]),O=p.useMemo(()=>typeof y=="function"?y:sS,[y]),I=p.useMemo(()=>typeof g=="function"?g:sS,[g]),L=p.useRef(null),N=p.useRef(null),[M,$]=p.useReducer(TW,Qm),{isFocused:R,isFileDialogActive:k}=M,F=p.useRef(typeof window<"u"&&window.isSecureContext&&S&&xW()),q=()=>{!F.current&&k&&setTimeout(()=>{if(N.current){const{files:te}=N.current;te.length||($({type:"closeDialog"}),I())}},300)};p.useEffect(()=>(window.addEventListener("focus",q,!1),()=>{window.removeEventListener("focus",q,!1)}),[N,k,I,F]);const G=p.useRef([]),ne=te=>{L.current&&L.current.contains(te.target)||(te.preventDefault(),G.current=[])};p.useEffect(()=>(x&&(document.addEventListener("dragover",oS,!1),document.addEventListener("drop",ne,!1)),()=>{x&&(document.removeEventListener("dragover",oS),document.removeEventListener("drop",ne))}),[L,x]),p.useEffect(()=>(!n&&v&&L.current&&L.current.focus(),()=>{}),[L,v,n]);const xe=p.useCallback(te=>{P?P(te):console.error(te)},[P]),ge=p.useCallback(te=>{te.preventDefault(),te.persist(),_n(te),G.current=[...G.current,te.target],Ou(te)&&Promise.resolve(r(te)).then(_e=>{if(Gd(te)&&!E)return;const He=_e.length,tt=He>0&&mW({files:_e,accept:_,minSize:i,maxSize:o,multiple:s,maxFiles:l,validator:T}),Mt=He>0&&!tt;$({isDragAccept:tt,isDragReject:Mt,isDragActive:!0,type:"setDraggedFiles"}),c&&c(te)}).catch(_e=>xe(_e))},[r,c,xe,E,_,i,o,s,l,T]),Pe=p.useCallback(te=>{te.preventDefault(),te.persist(),_n(te);const _e=Ou(te);if(_e&&te.dataTransfer)try{te.dataTransfer.dropEffect="copy"}catch{}return _e&&d&&d(te),!1},[d,E]),Te=p.useCallback(te=>{te.preventDefault(),te.persist(),_n(te);const _e=G.current.filter(tt=>L.current&&L.current.contains(tt)),He=_e.indexOf(te.target);He!==-1&&_e.splice(He,1),G.current=_e,!(_e.length>0)&&($({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Ou(te)&&u&&u(te))},[L,u,E]),Le=p.useCallback((te,_e)=>{const He=[],tt=[];te.forEach(Mt=>{const[Wr,rr]=Bk(Mt,_),[Ii,In]=Uk(Mt,i,o),qr=T?T(Mt):null;if(Wr&&Ii&&!qr)He.push(Mt);else{let br=[rr,In];qr&&(br=br.concat(qr)),tt.push({file:Mt,errors:br.filter(Wo=>Wo)})}}),(!s&&He.length>1||s&&l>=1&&He.length>l)&&(He.forEach(Mt=>{tt.push({file:Mt,errors:[pW]})}),He.splice(0)),$({acceptedFiles:He,fileRejections:tt,type:"setFiles"}),f&&f(He,tt,_e),tt.length>0&&m&&m(tt,_e),He.length>0&&h&&h(He,_e)},[$,s,_,i,o,l,f,h,m,T]),pe=p.useCallback(te=>{te.preventDefault(),te.persist(),_n(te),G.current=[],Ou(te)&&Promise.resolve(r(te)).then(_e=>{Gd(te)&&!E||Le(_e,te)}).catch(_e=>xe(_e)),$({type:"reset"})},[r,Le,xe,E]),Ge=p.useCallback(()=>{if(F.current){$({type:"openDialog"}),O();const te={multiple:s,types:D};window.showOpenFilePicker(te).then(_e=>r(_e)).then(_e=>{Le(_e,null),$({type:"closeDialog"})}).catch(_e=>{bW(_e)?(I(_e),$({type:"closeDialog"})):CW(_e)?(F.current=!1,N.current?(N.current.value=null,N.current.click()):xe(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."))):xe(_e)});return}N.current&&($({type:"openDialog"}),O(),N.current.value=null,N.current.click())},[$,O,I,S,Le,xe,D,s]),Ot=p.useCallback(te=>{!L.current||!L.current.isEqualNode(te.target)||(te.key===" "||te.key==="Enter"||te.keyCode===32||te.keyCode===13)&&(te.preventDefault(),Ge())},[L,Ge]),me=p.useCallback(()=>{$({type:"focus"})},[]),Fe=p.useCallback(()=>{$({type:"blur"})},[]),ct=p.useCallback(()=>{w||(vW()?setTimeout(Ge,0):Ge())},[w,Ge]),Oe=te=>n?null:te,Qe=te=>b?null:Oe(te),Bt=te=>j?null:Oe(te),_n=te=>{E&&te.stopPropagation()},lo=p.useMemo(()=>(te={})=>{var _e=te,{refKey:He="ref",role:tt,onKeyDown:Mt,onFocus:Wr,onBlur:rr,onClick:Ii,onDragEnter:In,onDragOver:qr,onDragLeave:br,onDrop:Wo}=_e,Za=Kd(_e,["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"]);return wn(wn({onKeyDown:Qe(Kr(Mt,Ot)),onFocus:Qe(Kr(Wr,me)),onBlur:Qe(Kr(rr,Fe)),onClick:Oe(Kr(Ii,ct)),onDragEnter:Bt(Kr(In,ge)),onDragOver:Bt(Kr(qr,Pe)),onDragLeave:Bt(Kr(br,Te)),onDrop:Bt(Kr(Wo,pe)),role:typeof tt=="string"&&tt!==""?tt:"presentation",[He]:L},!n&&!b?{tabIndex:0}:{}),Za)},[L,Ot,me,Fe,ct,ge,Pe,Te,pe,b,j,n]),en=p.useCallback(te=>{te.stopPropagation()},[]),co=p.useMemo(()=>(te={})=>{var _e=te,{refKey:He="ref",onChange:tt,onClick:Mt}=_e,Wr=Kd(_e,["refKey","onChange","onClick"]);const rr={accept:_,multiple:s,type:"file",style:{display:"none"},onChange:Oe(Kr(tt,pe)),onClick:Oe(Kr(Mt,en)),tabIndex:-1,[He]:N};return wn(wn({},rr),Wr)},[N,t,s,pe,n]);return ei(wn({},M),{isFocused:R&&!n,getRootProps:lo,getInputProps:co,rootRef:L,inputRef:N,open:Oe(Ge)})}function TW(e,t){switch(t.type){case"focus":return ei(wn({},e),{isFocused:!0});case"blur":return ei(wn({},e),{isFocused:!1});case"openDialog":return ei(wn({},Qm),{isFileDialogActive:!0});case"closeDialog":return ei(wn({},e),{isFileDialogActive:!1});case"setDraggedFiles":return ei(wn({},e),{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return ei(wn({},e),{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return wn({},Qm);default:return e}}function sS(){}const[kW,RW]=Pn("Dropzone component was not found in tree");function j0(e){const t=n=>{const{children:r,...o}=U(`Dropzone${F0(e)}`,{},n),i=RW(),s=Ao(r)?r:C.createElement("span",null,r);return i[e]?p.cloneElement(s,o):null};return t.displayName=`@mantine/dropzone/${F0(e)}`,t}const _W=j0("accept"),IW=j0("reject"),DW=j0("idle");var gc={root:"m_d46a4834",inner:"m_b85f7144",fullScreen:"m_96f6e9ad",dropzone:"m_7946116d"};const AW={loading:!1,multiple:!0,maxSize:1/0,autoFocus:!1,activateOnClick:!0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,useFsAccessApi:!0,variant:"light",rejectColor:"red"},NW=(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":gt(t),"--dropzone-accept-color":i.color,"--dropzone-accept-bg":i.background,"--dropzone-reject-color":s.color,"--dropzone-reject-bg":s.background}}},Ri=Q((e,t)=>{const n=U("Dropzone",AW,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:S,onDrop:v,onReject:x,openRef:w,name:b,maxFiles:j,autoFocus:E,activateOnClick:P,activateOnDrag:T,dragEventsBubbling:_,activateOnKeyboard:D,onDragEnter:O,onDragLeave:I,onDragOver:L,onFileDialogCancel:N,onFileDialogOpen:M,preventDropOnDocument:$,useFsAccessApi:R,getFilesFromEvent:k,validator:F,rejectColor:q,acceptColor:G,enablePointerEvents:ne,loaderProps:xe,inputProps:ge,mod:Pe,...Te}=n,Le=ce({name:"Dropzone",classes:gc,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,vars:c,varsResolver:NW}),{getRootProps:pe,getInputProps:Ge,isDragAccept:Ot,isDragReject:me,open:Fe}=Qk({onDrop:S,onDropAccepted:v,onDropRejected:x,disabled:d||f,accept:Array.isArray(g)?g.reduce((Oe,Qe)=>({...Oe,[Qe]:[]}),{}):g,multiple:h,maxSize:m,maxFiles:j,autoFocus:E,noClick:!P,noDrag:!T,noDragEventsBubbling:!_,noKeyboard:!D,onDragEnter:O,onDragLeave:I,onDragOver:L,onFileDialogCancel:N,onFileDialogOpen:M,preventDropOnDocument:$,useFsAccessApi:R,validator:F,...k?{getFilesFromEvent:k}:null});lg(w,Fe);const ct=!Ot&&!me;return C.createElement(kW,{value:{accept:Ot,reject:me,idle:ct}},C.createElement(H,{...pe({ref:t}),...Le("root",{focusable:!0}),...Te,mod:[{accept:Ot,reject:me,idle:ct,loading:f,"activate-on-click":P},Pe]},C.createElement(tv,{visible:f,overlayProps:{radius:u},unstyled:l,loaderProps:xe}),C.createElement("input",{...Ge(ge),name:b}),C.createElement("div",{...Le("inner"),"data-enable-pointer-events":ne||void 0},y)))});Ri.classes=gc;Ri.displayName="@mantine/dropzone/Dropzone";Ri.Accept=_W;Ri.Idle=DW;Ri.Reject=IW;const OW={loading:!1,maxSize:1/0,activateOnClick:!1,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,active:!0,zIndex:zr("max"),withinPortal:!0},P0=Q((e,t)=>{const n=U("DropzoneFullScreen",OW,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,S=ce({name:"DropzoneFullScreen",classes:gc,props:n,className:o,style:i,classNames:r,styles:s,unstyled:l,rootSelector:"fullScreen"}),{resolvedClassNames:v,resolvedStyles:x}=tf({classNames:r,styles:s,props:n}),[w,b]=p.useState(0),[j,{open:E,close:P}]=O2(!1),T=D=>{var O;(O=D.dataTransfer)!=null&&O.types.includes("Files")&&(b(I=>I+1),E())},_=()=>{b(D=>D-1)};return p.useEffect(()=>{w===0&&P()},[w]),p.useEffect(()=>{if(u)return document.addEventListener("dragenter",T,!1),document.addEventListener("dragleave",_,!1),()=>{document.removeEventListener("dragenter",T,!1),document.removeEventListener("dragleave",_,!1)}},[u]),C.createElement(ys,{...g,withinPortal:m},C.createElement(H,{...S("fullScreen",{style:{opacity:j?1:0,pointerEvents:j?"all":"none",zIndex:h}}),ref:t},C.createElement(Ri,{...y,classNames:v,styles:x,unstyled:l,className:gc.dropzone,onDrop:D=>{d==null||d(D),P(),b(0)},onReject:D=>{f==null||f(D),P(),b(0)}})))});P0.classes=gc;P0.displayName="@mantine/dropzone/DropzoneFullScreen";Ri.FullScreen=P0;const Mu=Ri,MW='{"resourceType": "Bundle"}';function gp({id:e,title:t,message:n,color:r,icon:o,withCloseButton:i=!1,method:s="show",loading:l}){no[s]({id:e,loading:l,title:t,message:n,color:r,icon:o,withCloseButton:i,autoClose:!1})}function $W(){const e=Tt(),t=ee(),[n,r]=p.useState({}),o=p.useCallback(async(l,c)=>{const u="batch-upload";gp({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=UP(d));const f=await t.executeBatch(d);r(h=>({...h,[c]:f})),gp({id:u,title:"Batch Upload Successful",message:"Your batch data was successfully uploaded.",color:"green",method:"update",icon:a.jsx(th,{size:"1rem"}),withCloseButton:!0})}catch(d){gp({id:u,title:"Batch Upload Failed",color:"red",message:Re(d),method:"update",icon:a.jsx(Fd,{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(Ce,{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(We,{defaultValue:"upload",children:[a.jsxs(We.List,{children:[a.jsx(We.Tab,{value:"upload",children:"File Upload"}),a.jsx(We.Tab,{value:"json",children:"JSON"})]}),a.jsx(We.Panel,{value:"upload",pt:"xs",children:a.jsx(Mu,{onDrop:i,accept:["application/json"],children:a.jsxs(Y,{justify:"center",gap:"xl",style:{minHeight:220,pointerEvents:"none"},children:[a.jsx(Mu.Accept,{children:a.jsx(pw,{size:50,stroke:1.5,color:e.colors[e.primaryColor][5]})}),a.jsx(Mu.Reject,{children:a.jsx(Fd,{size:50,stroke:1.5,color:e.colors.red[5]})}),a.jsx(Mu.Idle,{children:a.jsx(pw,{size:50,stroke:1.5})}),a.jsxs("div",{children:[a.jsx(oe,{size:"xl",inline:!0,children:"Drag files here or click to select files"}),a.jsx(oe,{size:"sm",color:"dimmed",inline:!0,mt:7,children:"Attach as many files as you like"})]})]})})}),a.jsx(We.Panel,{value:"json",pt:"xs",children:a.jsxs(Be,{onSubmit:s,children:[a.jsx(Ha,{"data-testid":"batch-input",name:"input",autosize:!0,minRows:20,defaultValue:MW,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(We,{defaultValue:Object.keys(n)[0],children:[a.jsx(We.List,{children:Object.keys(n).map(l=>a.jsx(We.Tab,{value:l,children:l},l))}),Object.keys(n).map(l=>a.jsx(We.Panel,{value:l,children:a.jsx("pre",{style:{border:"1px solid #888"},children:JSON.stringify(n[l],void 0,2)})},l))]}),a.jsx(Y,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Z,{onClick:()=>r({}),children:"Start over"})})]})]})}function LW(){const{resourceType:e}=Xe(),n=(Object.fromEntries(new URLSearchParams(location.search).entries()).ids||"").split(",").filter(o=>!!o),[r]=Ia("Questionnaire",`subject-type=${e}`);return r?r.length===0?a.jsxs(Ce,{children:[a.jsxs(le,{children:["No apps for ",e]}),a.jsx($e,{to:`/${e}`,children:"Return to search page"})]}):a.jsx(Ce,{children:a.jsx("div",{children:r.map(o=>a.jsxs("div",{children:[a.jsx("h3",{children:a.jsx($e,{to:`/forms/${o.id}?subject=`+n.map(i=>`${e}/${i}`).join(","),children:o.name})}),a.jsx("p",{children:o.description})]},o.id))})}):a.jsx(Lr,{})}function FW(){const e=ee(),[t,n]=p.useState(),[r,o]=p.useState(!1);return a.jsx(Ce,{width:450,children:a.jsxs(Be,{style:{maxWidth:400},onSubmit:i=>{n(void 0),e.post("auth/changepassword",i).then(()=>o(!0)).catch(s=>n(at(s)))},children:[a.jsxs(on,{style:{flexDirection:"column"},children:[a.jsx(Vr,{size:32}),a.jsx(le,{children:"Change password"})]}),!r&&a.jsxs(je,{gap:"xl",mt:"xl",children:[a.jsx(Nr,{name:"oldPassword",label:"Old password",required:!0,autoFocus:!0,error:Ue(t,"oldPassword")}),a.jsx(Nr,{name:"newPassword",label:"New password",required:!0,error:Ue(t,"newPassword")}),a.jsx(Nr,{name:"confirmPassword",label:"Confirm new password",required:!0,error:Ue(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 Km=["Form","JSON","Profiles"],zW=["Profiles"],yp=Km[0].toLowerCase();function BW(){const e=Nt(),t=Tt(),{resourceType:n}=Xe(),[r,o]=p.useState(()=>{const s=window.location.pathname.split("/").pop();return s&&Km.map(l=>l.toLowerCase()).includes(s)?s:yp});function i(s){s||(s=yp),o(s),e(`/${n}/new/${s}`)}return a.jsxs(a.Fragment,{children:[a.jsxs(Fn,{children:[a.jsxs(oe,{p:"md",fw:500,children:["New ",n]}),a.jsx(vr,{children:a.jsx(We,{defaultValue:yp,value:r,onChange:i,children:a.jsx(We.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:Km.map(s=>a.jsx(We.Tab,{value:s.toLowerCase(),px:"md",children:zW.includes(s)?a.jsxs(Y,{gap:"xs",wrap:"nowrap",children:[s,a.jsx(Ic,{color:t.primaryColor,size:"sm",children:"Beta"})]}):s},s))})})})]}),a.jsx(b0,{})]})}function UW(){return a.jsx(Ce,{children:a.jsxs(je,{children:[a.jsx(le,{order:1,children:"Unexpected Error"}),a.jsx(oe,{children:"We're sorry, something went wrong."}),a.jsxs(oe,{children:["Please contact ",a.jsx(Ve,{href:"mailto:support@medplum.com",children:"support"})," for assistance."]})]})})}const VW="_root_1fbwr_1",HW="_entry_1fbwr_8",WW="_key_1fbwr_13",qW="_value_1fbwr_20",dh={root:VW,entry:HW,key:WW,value:qW};function De(e){return a.jsx(vr,{children:a.jsx("div",{className:dh.root,children:e.children})})}De.Entry=function(t){return a.jsx("div",{className:dh.entry,children:t.children})};De.Key=function(t){return a.jsx("div",{className:dh.key,children:t.children})};De.Value=function(t){return a.jsx("div",{className:dh.value,children:t.children})};function GW(e){if(e.gender==="male")return"blue";if(e.gender==="female")return"pink"}function Kk(e){var n,r;const t=lt(e.patient);return t?a.jsxs(De,{children:[a.jsx(Ti,{value:t,size:"lg",color:GW(t)}),a.jsxs(De.Entry,{children:[a.jsx(De.Key,{children:"Name"}),a.jsx(De.Value,{children:a.jsx($e,{to:t,fw:500,children:t.name?a.jsx(Qv,{value:t.name[0],options:{use:!1}}):"[blank]"})})]}),t.birthDate&&a.jsxs(a.Fragment,{children:[a.jsxs(De.Entry,{children:[a.jsx(De.Key,{children:"DoB"}),a.jsx(De.Value,{children:t.birthDate})]}),a.jsxs(De.Entry,{children:[a.jsx(De.Key,{children:"Age"}),a.jsx(De.Value,{children:j$(t.birthDate)})]})]}),t.gender&&a.jsxs(De.Entry,{children:[a.jsx(De.Key,{children:"Gender"}),a.jsx(De.Value,{children:t.gender})]}),t.address&&a.jsxs(De.Entry,{children:[a.jsx(De.Key,{children:"State"}),a.jsx(De.Value,{children:(n=t.address[0])==null?void 0:n.state})]}),(r=t.identifier)==null?void 0:r.map(o=>a.jsxs(De.Entry,{children:[a.jsx(De.Key,{children:o==null?void 0:o.system}),a.jsx(De.Value,{children:o==null?void 0:o.value})]},`${o==null?void 0:o.system}-${o==null?void 0:o.value}`))]}):null}function Yk(e){const t=lt(e.resource);if(!t)return null;const n=[{key:"Type",value:a.jsx($e,{to:`/${t.resourceType}`,children:t.resourceType})}];function r(s,l){s&&l&&n.push({key:s,value:l})}function o(s){s&&r(s.system,s.value)}function i(s,l){Array.isArray(l)?l.forEach(c=>i(s,c)):typeof l=="string"?r(s,l):l&&(Array.isArray(l.coding)?r(s,l.coding.map(c=>c.display||c.code).join(", ")):r(s,l.text))}if("name"in t){const s=_o(t);s!==ht(t)&&r("Name",s)}return"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(De,{children:n.map(s=>a.jsxs(De.Entry,{children:[a.jsx(De.Key,{children:s.key}),a.jsx(De.Value,{children:s.value})]},`${s.key}-${s.value}`))})}function T0(e){if(e.resourceType==="Patient")return e;if(e.resourceType==="DiagnosticReport"||e.resourceType==="Encounter"||e.resourceType==="Observation"||e.resourceType==="ServiceRequest")return e.subject}function QW(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 td(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 _i(e){var t;return Qf((t=e.getActiveLogin())==null?void 0:t.project)}function KW(e,t){const n=new Blob([e],{type:Kt.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 YW(){const{id:e}=Xe(),t=Ho(),r=Object.fromEntries(new URLSearchParams(t.search).entries()).subject,o=ee(),[i,s]=p.useState(!0),[l,c]=p.useState(),[u,d]=p.useState(),[f,h]=p.useState(),[m,g]=p.useState(),[y,S]=p.useState();if(p.useEffect(()=>{const w={resourceType:"Bundle",type:"batch",entry:[{request:{method:"GET",url:`Questionnaire/${e}`}}]};if(r){const b=r.split(",").filter(j=>!!j);b.length===1&&w.entry.push({request:{method:"GET",url:b[0]}}),d(b)}o.executeBatch(w).then(b=>{var j,E,P,T,_,D,O,I;((P=(E=(j=b.entry)==null?void 0:j[0])==null?void 0:E.response)==null?void 0:P.status)!=="200"?g((D=(_=(T=b.entry)==null?void 0:T[0])==null?void 0:_.response)==null?void 0:D.outcome):(c((O=b.entry[0])==null?void 0:O.resource),h((I=b.entry[1])==null?void 0:I.resource)),s(!1)}).catch(b=>{g(b),s(!1)})},[o,e,r]),m)return a.jsx(Ce,{children:a.jsx("pre",{"data-testid":"error",children:JSON.stringify(m,void 0,2)})});if(y)return a.jsxs(Ce,{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($e,{to:y[0],children:"Review your answers"})}),y.length>1&&a.jsxs("li",{children:["Review your answers:",a.jsx("ul",{children:y.map(w=>a.jsx("li",{children:a.jsx($e,{to:w,children:ht(w)})},w.id))})]}),f&&a.jsx("li",{children:a.jsxs($e,{to:f,children:["Back to ",_o(f)]})}),a.jsx("li",{children:a.jsx($e,{to:"/",children:"Go back home"})})]})]});if(i||!l)return a.jsx(Lr,{});const v=f&&T0(f);return a.jsxs(a.Fragment,{children:[a.jsxs(Fn,{shadow:"xs",radius:0,children:[v&&a.jsx(Kk,{patient:v}),f&&f.resourceType!=="Patient"&&a.jsx(Yk,{resource:f}),a.jsx(H,{px:"xl",py:"md",children:a.jsxs(oe,{children:[_o(l),u&&u.length>1&&a.jsxs(a.Fragment,{children:[" (for ",u.length," resources)"]})]})})]}),a.jsx(Ce,{children:a.jsx(uk,{questionnaire:l,subject:f&&ft(f),onSubmit:x})})]});async function x(w){const b=[];if(!u||u.length===0)b.push(await o.createResource(w));else for(const j of u)b.push(await o.createResource({...w,subject:{reference:j}}));S(b)}}const XW="_paper_unw9o_1",JW={paper:XW},ZW={Bot:"/admin/bots/new",ClientApplication:"/admin/clients/new"};function Xk(e,t){const n=e.resourceType||eq(t),r=e.fields??tq(n),o=e.filters??(e.resourceType?void 0:nq(n)),i=e.sortRules??rq(n),s=e.offset??0,l=e.count??Xf;return{...e,resourceType:n,fields:r,filters:o,sortRules:i,offset:s,count:l}}function eq(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 tq(e){const t=k0(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 nq(e){var t;return(t=k0(e))==null?void 0:t.filters}function rq(e){const t=k0(e);return t!=null&&t.sortRules?t.sortRules:[{code:"_lastUpdated",descending:!0}]}function k0(e){const t=localStorage.getItem(e+"-defaultSearch");return t?JSON.parse(t):void 0}function oq(e){localStorage.setItem("defaultResourceType",e.resourceType),localStorage.setItem(e.resourceType+"-defaultSearch",JSON.stringify(e))}async function iq(e,t){const n={resourceType:e.resourceType,count:1e3,offset:0,filters:e.filters},r=Xk(n,t.getUserConfiguration()),o=await t.search(r.resourceType,ra({...r,total:"accurate",fields:void 0}));return UP(o)}function aS(){const e=ee(),t=Nt(),n=Ho(),[r,o]=p.useState();return p.useEffect(()=>{const i=FL(n.pathname+n.search),s=Xk(i,e.getUserConfiguration());n.pathname===`/${s.resourceType}`&&n.search===ra(s)?(oq(s),o(s)):t(`/${s.resourceType}${ra(s)}`)},[e,t,n]),!(r!=null&&r.resourceType)||!r.fields||r.fields.length===0?a.jsx(Lr,{}):a.jsx(Fn,{shadow:"xs",m:"md",p:"xs",className:JW.paper,children:a.jsx(Jc,{checkboxesEnabled:!0,search:r,onClick:i=>t(`/${i.resource.resourceType}/${i.resource.id}`),onAuxClick:i=>window.open(`/${i.resource.resourceType}/${i.resource.id}`,"_blank"),onChange:i=>{t(`/${r.resourceType}${ra(i.definition)}`)},onNew:()=>{t(ZW[r.resourceType]??`/${r.resourceType}/new`)},onExportCsv:()=>{const i=e.fhirUrl(r.resourceType,"$csv")+ra(r);e.download(i).then(s=>{window.open(window.URL.createObjectURL(s),"_blank")}).catch(s=>ue({color:"red",message:Re(s),autoClose:!1}))},onExportTransactionBundle:async()=>{iq(r,e).then(i=>KW(JSON.stringify(i,void 0,2))).catch(i=>ue({color:"red",message:Re(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=>ue({color:"red",message:Re(s),autoClose:!1})))},onBulk:i=>{t(`/bulk/${r.resourceType}?ids=${i.join(",")}`)}})})}function sq(){const e=ee(),[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=>ue({color:"red",message:Re(l),autoClose:!1}))},[e]);const i=p.useCallback(l=>{e.post("auth/mfa/enroll",l).then(()=>{o(!0),ue({color:"green",message:"Success"})}).catch(c=>ue({color:"red",message:Re(c),autoClose:!1}))},[e]),s=p.useCallback(()=>{e.post("auth/mfa/disable",{}).catch(console.log)},[e]);return r===void 0?null:r?a.jsx(Ce,{children:a.jsxs(Y,{children:[a.jsx(le,{children:"MFA is enabled"}),a.jsx(Z,{onClick:s,children:"Disable MFA"})]})}):a.jsx(Ce,{width:400,children:a.jsxs(Be,{onSubmit:i,children:[a.jsx(le,{children:"Multi Factor Auth Setup"}),a.jsx(on,{children:a.jsx("img",{src:t})}),a.jsx(ie,{name:"token",label:"Code"}),a.jsx(Y,{justify:"flex-end",mt:"xl",children:a.jsx(Z,{type:"submit",children:"Enroll"})})]})})}const Ym={baseUrl:"__MEDPLUM_BASE_URL__",clientId:"__MEDPLUM_CLIENT_ID__",googleClientId:"__GOOGLE_CLIENT_ID__",recaptchaSiteKey:"__RECAPTCHA_SITE_KEY__",registerEnabled:"__MEDPLUM_REGISTER_ENABLED__"};function nu(){return Ym}function Jk(){try{return Ym.registerEnabled!==!1&&Ym.registerEnabled!=="false"}catch{return!0}}function aq(){const e=Nt(),[t]=C0(),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(xk,{onCode:o,onForgotPassword:()=>e("/resetpassword"),onRegister:()=>e("/register"),googleClientId:nu().googleClientId,clientId:n||void 0,redirectUri:t.get("redirect_uri")||void 0,scope:r,nonce:t.get("nonce")||void 0,launch:t.get("launch")||void 0,codeChallenge:t.get("code_challenge")||void 0,codeChallengeMethod:t.get("code_challenge_method")||void 0,chooseScopes:r!=="openid",children:[a.jsx(Vr,{size:32}),a.jsx(le,{children:"Sign in to Medplum"})]})}function lq(){const e=ee(),t=Nt(),n=nu();return p.useEffect(()=>{e.getProfile()&&t("/signin?project=new")},[e,t]),Jk()?a.jsxs(pV,{type:"project",onSuccess:()=>t("/"),googleClientId:n.googleClientId,recaptchaSiteKey:n.recaptchaSiteKey,children:[a.jsx(Vr,{size:32}),a.jsx(le,{children:"Create a new account"})]}):a.jsx(Ce,{width:450,children:a.jsx(xs,{icon:a.jsx(Vc,{size:16}),title:"New projects disabled",color:"red",children:"New projects are disabled on this server."})})}function cq(){const e=Nt(),t=ee(),[n,r]=p.useState(),[o,i]=p.useState(!1),s=nu().recaptchaSiteKey;return p.useEffect(()=>{yk(s)},[s]),a.jsx(Ce,{width:450,children:a.jsxs(Be,{style:{maxWidth:400},onSubmit:async l=>{let c="";c=await vk(s),t.post("auth/resetpassword",{...l,recaptchaToken:c}).then(()=>i(!0)).catch(u=>r(at(u)))},children:[a.jsxs(je,{gap:"lg",mb:"xl",align:"center",children:[a.jsx(Vr,{size:32}),a.jsx(le,{children:"Medplum Password Reset"})]}),a.jsxs(je,{gap:"xl",children:[a.jsx(Hr,{issues:Qc(n,void 0)}),!o&&a.jsxs(a.Fragment,{children:[a.jsx(ie,{name:"email",type:"email",label:"Email",required:!0,autoFocus:!0,error:Ue(n,"email")}),a.jsxs(Y,{justify:"space-between",mt:"xl",wrap:"nowrap",children:[a.jsx(Ve,{component:"button",type:"button",color:"dimmed",onClick:()=>e("/register"),size:"xs",children:"Register"}),a.jsx(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 uq(){var i;const e=Nt(),t=ee(),[n,r]=p.useState();p.useEffect(()=>{t.get("auth/me").then(r).catch(s=>ue({color:"red",message:Re(s),autoClose:!1}))},[t]);function o(s){t.post("auth/revoke",{loginId:s}).then(()=>t.get("auth/me",{cache:"no-cache"})).then(r).then(()=>ue({color:"green",message:"Login revoked"})).catch(l=>ue({color:"red",message:Re(l),autoClose:!1}))}return n?a.jsxs(a.Fragment,{children:[a.jsxs(Ce,{children:[a.jsx(le,{children:"Security"}),a.jsxs(Jv,{children:[a.jsx(bo,{term:"ID",children:a.jsx(Ve,{href:`/${ht(n.profile)}`,children:n.profile.id})}),a.jsx(bo,{term:"Resource Type",children:n.profile.resourceType}),a.jsx(bo,{term:"Name",children:Uc((i=n.profile.name)==null?void 0:i[0])})]})]}),a.jsxs(Ce,{children:[a.jsx(le,{children:"Sessions"}),a.jsxs(se,{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:En(s.lastUpdated)}),a.jsx("td",{children:a.jsx(Ve,{href:"#",onClick:()=>o(s.id),children:"Revoke"})})]},s.id))})]})]}),a.jsxs(Ce,{children:[a.jsx(le,{children:"Password"}),a.jsx(Z,{onClick:()=>e("/changepassword"),children:"Change password"})]}),a.jsxs(Ce,{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 dq(){const{id:e,secret:t}=Xe(),n=ee(),[r,o]=p.useState(),[i,s]=p.useState(!1),l=Qc(r,void 0);return a.jsxs(Ce,{width:450,children:[a.jsx(Hr,{issues:l}),a.jsxs(Be,{style:{maxWidth:400},onSubmit:c=>{if(c.password!==c.confirmPassword){o(mi("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(at(d)))},children:[a.jsxs(on,{style:{flexDirection:"column"},children:[a.jsx(Vr,{size:32}),a.jsx(le,{children:"Set password"})]}),!i&&a.jsxs(je,{children:[a.jsx(Nr,{name:"password",label:"New password",required:!0,error:Ue(r,"password")}),a.jsx(Nr,{name:"confirmPassword",label:"Confirm new password",required:!0,error:Ue(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($e,{to:"/signin",children:"sign in"}),"."]})]})]})}function fq(){const e=eh(),t=Nt(),[n]=C0(),r=nu(),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(xk,{onSuccess:()=>o(),onForgotPassword:()=>t("/resetpassword"),onRegister:Jk()?()=>t("/register"):void 0,googleClientId:r.googleClientId,login:n.get("login")||void 0,projectId:n.get("project")||void 0,children:[a.jsx(Vr,{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 hq(){const e=Nt(),t=Ho(),[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(xB,{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 fh(e){const t=ee(),n=_i(t),r=Nt(),[o,i]=p.useState({resourceType:"ProjectMembership",filters:[{code:"project",operator:re.EQUALS,value:"Project/"+n},{code:"profile-type",operator:re.EQUALS,value:e.resourceType}],fields:e.fields,count:100});return a.jsx(Jc,{search:o,onClick:s=>r(`/admin/members/${s.resource.id}`),onChange:s=>i(s.definition),hideFilters:!0,hideToolbar:!0})}function pq(){return a.jsxs(a.Fragment,{children:[a.jsx(le,{children:"Bots"}),a.jsx(fh,{resourceType:"Bot",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx($e,{to:"/admin/bots/new",children:"Create new bot"})})]})}function mq(){return a.jsxs(a.Fragment,{children:[a.jsx(le,{children:"Clients"}),a.jsx(fh,{resourceType:"ClientApplication",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx($e,{to:"/admin/clients/new",children:"Create new client"})})]})}function hh(e){return a.jsx(Ka,{resourceType:"AccessPolicy",name:"accessPolicy",defaultValue:e.defaultValue,placeholder:"Access Policy",onChange:t=>{Uo(t)?e.onChange(ft(t)):e.onChange(void 0)}})}function gq(){const e=ee(),t=_i(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(Be,{onSubmit:()=>{const h={name:n,description:o,accessPolicy:s};e.post("admin/projects/"+t+"/bot",h).then(m=>{e.invalidateSearches("Bot"),e.invalidateSearches("ProjectMembership"),f(m),ue({color:"green",message:"Bot created"})}).catch(m=>{ue({color:"red",message:Re(m),autoClose:!1}),u(at(m))})},children:[!d&&a.jsxs(je,{children:[a.jsx(st,{title:"Name",htmlFor:"name",outcome:c,children:a.jsx(ie,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:h=>r(h.currentTarget.value),error:Ue(c,"name")})}),a.jsx(st,{title:"Description",htmlFor:"description",outcome:c,children:a.jsx(ie,{id:"description",name:"description",onChange:h=>i(h.currentTarget.value),error:Ue(c,"description")})}),a.jsx(st,{title:"Access Policy",htmlFor:"accessPolicy",outcome:c,children:a.jsx(hh,{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(oe,{children:"Bot created"}),a.jsxs(bn,{children:[a.jsx(bn.Item,{children:a.jsx($e,{to:d,children:"Go to new bot"})}),a.jsx(bn.Item,{children:a.jsx($e,{to:"/admin/bots",children:"Back to bots list"})})]})]})]})]})}function yq(){const e=ee(),t=_i(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(Be,{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),ue({color:"green",message:"Client created"})}).catch(y=>{ue({color:"red",message:Re(y),autoClose:!1}),f(at(y))})},children:[!h&&a.jsxs(je,{children:[a.jsx(st,{title:"Name",htmlFor:"name",outcome:d,children:a.jsx(ie,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:g=>r(g.currentTarget.value),error:Ue(d,"name")})}),a.jsx(st,{title:"Description",htmlFor:"description",outcome:d,children:a.jsx(ie,{id:"description",name:"description",onChange:g=>i(g.currentTarget.value),error:Ue(d,"description")})}),a.jsx(st,{title:"Redirect URI",htmlFor:"redirectUri",outcome:d,children:a.jsx(ie,{id:"redirectUri",name:"redirectUri",onChange:g=>l(g.currentTarget.value),error:Ue(d,"redirectUri")})}),a.jsx(st,{title:"Access Policy",htmlFor:"accessPolicy",outcome:d,children:a.jsx(hh,{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(oe,{children:"Client created"}),a.jsxs(bn,{children:[a.jsx(bn.Item,{children:a.jsx($e,{to:h,children:"Go to new client"})}),a.jsx(bn.Item,{children:a.jsx($e,{to:"/admin/clients",children:"Back to clients list"})})]})]})]})]})}function vq(e){return a.jsx(Ka,{resourceType:"UserConfiguration",name:"userConfiguration",defaultValue:e.defaultValue,placeholder:"User Configuration",onChange:t=>{Uo(t)?e.onChange(ft(t)):e.onChange(void 0)}})}function xq(){const{membershipId:e}=Xe(),t=ee(),n=_i(t),r=Nt(),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(S=>h(at(S)))}return a.jsxs(a.Fragment,{children:[a.jsx(le,{children:"Edit membership"}),a.jsx("h3",{children:a.jsx(ma,{value:o.profile,link:!0})}),a.jsxs(Be,{onSubmit:()=>{const S={...o,accessPolicy:i,userConfiguration:l,admin:u};t.post(`admin/projects/${n}/members/${e}`,S).then(()=>g(!0)).catch(v=>h(at(v)))},children:[!m&&a.jsxs(je,{children:[a.jsx(st,{title:"Access Policy",htmlFor:"accessPolicy",outcome:f,children:a.jsx(hh,{name:"accessPolicy",defaultValue:i,onChange:s})}),a.jsx(st,{title:"User Configuration",htmlFor:"userConfiguration",outcome:f,children:a.jsx(vq,{name:"userConfiguration",defaultValue:l,onChange:c})}),a.jsx(st,{title:"Admin",htmlFor:"admin",outcome:f,children:a.jsx(gr,{id:"admin",name:"admin",defaultChecked:u,onChange:S=>d(S.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($e,{to:"/admin/project",children:"here"})," to return to the project admin page."]})]})]})]})}function wq(){const e=ee(),[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"),qf(g)?s(g):d(g),c(m.sendEmail??!1),ue({color:"green",message:"Invite success"})}).catch(g=>{ue({color:"red",message:Re(g),autoClose:!1}),s(at(g))})},[e,t,r]);return a.jsxs(Be,{onSubmit:f,children:[!u&&!i&&a.jsxs(je,{children:[a.jsx(le,{children:"Invite new member"}),e.isSuperAdmin()&&a.jsx(st,{title:"Project",htmlFor:"project",outcome:i,children:a.jsx(Ka,{resourceType:"Project",name:"project",defaultValue:t,onChange:n})}),a.jsx(wt,{name:"resourceType",label:"Role",defaultValue:"Practitioner",data:["Practitioner","Patient","RelatedPerson"],error:Ue(i,"resourceType")}),a.jsx(ie,{name:"firstName",label:"First Name",required:!0,autoFocus:!0,error:Ue(i,"firstName")}),a.jsx(ie,{name:"lastName",label:"Last Name",required:!0,error:Ue(i,"lastName")}),a.jsx(ie,{name:"email",type:"email",label:"Email",required:!0,error:Ue(i,"email")}),a.jsx(st,{title:"Access Policy",htmlFor:"accessPolicy",outcome:i,children:a.jsx(hh,{name:"accessPolicy",onChange:o})}),a.jsx(gr,{name:"sendEmail",label:"Send email",defaultChecked:!0}),a.jsx(gr,{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($e,{to:"/admin/project",children:"here"})," to return to the project admin page."]})]}),u&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(oe,{children:"User created"}),l&&a.jsx(oe,{children:"Email sent"}),a.jsxs(bn,{children:[a.jsx(bn.Item,{children:a.jsx($e,{to:u,children:"Go to new membership"})}),a.jsx(bn.Item,{children:a.jsx($e,{to:u.profile,children:"Go to new profile"})}),a.jsx(bn.Item,{children:a.jsx($e,{to:"/admin/users",children:"Back to users list"})})]})]})]})}function Sq(){return a.jsxs(a.Fragment,{children:[a.jsx(le,{children:"Patients"}),a.jsx(fh,{resourceType:"Patient",fields:["user","profile","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx($e,{to:"/admin/invite",children:"Invite new patient"})})]})}function bq(){const e=ee();if(!e.isLoading()&&!e.isProjectAdmin())return a.jsx(Hr,{outcome:fP});function t(n){e.post("admin/projects/setpassword",n).then(()=>ue({color:"green",message:"Done"})).catch(r=>ue({color:"red",message:Re(r),autoClose:!1}))}return a.jsxs(Ce,{width:600,children:[a.jsx(le,{order:1,children:"Project Admin"}),a.jsx(dn,{my:"lg"}),a.jsx(le,{order:2,children:"Force Set Password"}),a.jsx(oe,{children:"Sets the password for the specified user in this project."}),a.jsx(oe,{children:"This action can only be performed by project administrators. Passwords can only be set for users scoped in this project."}),a.jsx(Be,{onSubmit:t,children:a.jsxs(je,{children:[a.jsx(ie,{name:"email",label:"Email",required:!0}),a.jsx(Nr,{name:"password",label:"Password",required:!0}),a.jsx(Z,{type:"submit",children:"Force Set Password"})]})})]})}function lS(){const e=ee(),t=_i(e),n=e.get(`admin/projects/${t}`).read();return a.jsxs(a.Fragment,{children:[a.jsx(le,{children:"Details"}),a.jsxs(Jv,{children:[a.jsx(bo,{term:"ID",children:n.project.id}),a.jsx(bo,{term:"Name",children:n.project.name})]})]})}const cS=["Details","Users","Patients","Clients","Bots","Secrets","Sites"];function Cq(){const e=Nt(),n=Ho().pathname.replace("/admin/","")||cS[0],r=ee(),o=_i(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(Fn,{children:[a.jsx(De,{children:a.jsxs(De.Entry,{children:[a.jsx(De.Key,{children:"Project"}),a.jsx(De.Value,{children:i.project.name})]})}),a.jsx(vr,{children:a.jsx(We,{value:n.toLowerCase(),onChange:s,children:a.jsx(We.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:cS.map(l=>a.jsx(We.Tab,{value:l.toLowerCase(),children:l},l))})})})]}),a.jsx(Ce,{children:a.jsx(b0,{})})]})}function Eq(){const e=ee(),t=_i(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(ao(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(()=>ue({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(Ya,{property:js("Project","secret"),name:"secret",path:"Project.secret",defaultValue:i,onChange:s,outcome:void 0}),a.jsx(Z,{type:"submit",children:"Save"})]})}function jq(){const e=ee(),t=_i(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(ao(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(()=>ue({color:"green",message:"Saved"})).catch(c=>{var d,f,h,m;const u=at(c);ue({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(Ya,{property:js("Project","site"),name:"site",path:"Project.site",defaultValue:i,onChange:s,outcome:void 0}),a.jsx(Z,{type:"submit",children:"Save"})]})}function Pq(){const e=ee();if(!e.isLoading()&&!e.isSuperAdmin())return a.jsx(Hr,{outcome:fP});function t(){wl(e,"Rebuilding Structure Definitions","admin/super/structuredefinitions")}function n(){wl(e,"Rebuilding Search Parameters","admin/super/searchparameters")}function r(){wl(e,"Rebuilding Value Sets","admin/super/valuesets")}function o(u){wl(e,"Reindexing Resources","admin/super/reindex",u)}function i(u){wl(e,"Rebuilding Compartments","admin/super/compartments",u)}function s(u){e.post("admin/super/removebotidjobsfromqueue",u).then(()=>ue({color:"green",message:"Done"})).catch(d=>ue({color:"red",message:Re(d),autoClose:!1}))}function l(u){e.post("admin/super/purge",{...u,before:ST(u.before)}).then(()=>ue({color:"green",message:"Done"})).catch(d=>ue({color:"red",message:Re(d),autoClose:!1}))}function c(u){e.post("admin/super/setpassword",u).then(()=>ue({color:"green",message:"Done"})).catch(d=>ue({color:"red",message:Re(d),autoClose:!1}))}return a.jsxs(Ce,{width:600,children:[a.jsx(le,{order:1,children:"Super Admin"}),a.jsx(dn,{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(Be,{children:a.jsx(Z,{onClick:t,children:"Rebuild StructureDefinitions"})}),a.jsx(dn,{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(Be,{children:a.jsx(Z,{onClick:n,children:"Rebuild SearchParameters"})}),a.jsx(dn,{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(Be,{children:a.jsx(Z,{onClick:r,children:"Rebuild ValueSets"})}),a.jsx(dn,{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(Be,{onSubmit:o,children:a.jsxs(je,{children:[a.jsx(st,{title:"Resource Type",children:a.jsx(ie,{name:"resourceType",placeholder:"Reindex Resource Type"})}),a.jsx(Z,{type:"submit",children:"Reindex"})]})}),a.jsx(dn,{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(Be,{onSubmit:i,children:a.jsxs(je,{children:[a.jsx(st,{title:"Resource Type",children:a.jsx(ie,{name:"resourceType",placeholder:"Compartments Resource Type"})}),a.jsx(Z,{type:"submit",children:"Rebuild Compartments"})]})}),a.jsx(dn,{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(Be,{onSubmit:l,children:a.jsxs(je,{children:[a.jsx(st,{title:"Purge Resource Type",htmlFor:"purgeResourceType",children:a.jsx(wt,{id:"purgeResourceType",name:"resourceType",data:["","AuditEvent","Login"]})}),a.jsx(st,{title:"Purge Before",htmlFor:"before",children:a.jsx(ls,{name:"before",placeholder:"Before Date"})}),a.jsx(Z,{type:"submit",children:"Purge"})]})}),a.jsx(dn,{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(Be,{onSubmit:s,children:a.jsxs(je,{children:[a.jsx(st,{title:"Bot ID",children:a.jsx(ie,{name:"botId",placeholder:"Bot Id"})}),a.jsx(Z,{type:"submit",children:"Remove Jobs by Bot ID"})]})}),a.jsx(dn,{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(Be,{onSubmit:c,children:a.jsxs(je,{children:[a.jsx(ie,{name:"email",label:"Email",required:!0}),a.jsx(Nr,{name:"password",label:"Password",required:!0}),a.jsx(ie,{name:"projectId",label:"Project ID"}),a.jsx(Z,{type:"submit",children:"Force Set Password"})]})})]})}function wl(e,t,n,r){no.show({id:n,loading:!0,title:t,message:"Running...",autoClose:!1,withCloseButton:!1});const o={method:"POST",pollStatusOnAccepted:!0};r&&(o.body=JSON.stringify(r)),e.startAsyncRequest(n,o).then(()=>{no.update({id:n,color:"green",title:t,message:"Done",icon:a.jsx(th,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0})}).catch(i=>{no.update({id:n,color:"red",title:t,message:Re(i),icon:a.jsx(Fd,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0})})}function Tq(){return a.jsxs(a.Fragment,{children:[a.jsx(le,{children:"Users"}),a.jsx(fh,{resourceType:"Practitioner",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(Y,{justify:"flex-end",children:a.jsx($e,{to:"/admin/invite",children:"Invite new user"})})]})}function kq(){const[e]=Ia("ObservationDefinition","_count=100");return e?a.jsxs(se,{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(ro,{value:(n=t.category)==null?void 0:n[0]})}),a.jsx("td",{children:a.jsx(ro,{value:t.code})}),a.jsx("td",{children:a.jsx(ro,{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(Xm,{ranges:t.qualifiedInterval})})]},t.id)})})]}):a.jsx(Lr,{})}function Xm(e){const{ranges:t}=e;if(!t)return null;const n=uS(t.map(o=>o.gender));if(n.length>1)return lc(n),a.jsx(a.Fragment,{children:n.map(o=>{var i;return a.jsxs(p.Fragment,{children:[a.jsx("div",{children:a.jsx("strong",{children:Vt(o)})}),a.jsx(Xm,{ranges:(i=e.ranges)==null?void 0:i.filter(s=>s.gender===o)})]},o)})});const r=uS(t.map(o=>o.age&&cc(o.age)));return r.length>1?(lc(r),a.jsx(a.Fragment,{children:r.map(o=>{var i;return a.jsxs(p.Fragment,{children:[a.jsx("div",{children:a.jsx("strong",{children:Vt(o)})}),a.jsx(Xm,{ranges:(i=e.ranges)==null?void 0:i.filter(s=>cc(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(e0,{value:o.range})})]})})},`range-${o.condition}`))})}function uS(e){return[...new Set(e.filter(t=>!!t))]}function Rq(){const[e]=Ia("ActivityDefinition","_count=100"),[t]=Ia("ObservationDefinition","_count=100");return!e||!t?a.jsx(Lr,{}):a.jsxs(se,{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(ro,{value:(r=n.category)==null?void 0:r[0]})}),a.jsx("td",{children:a.jsx(ro,{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 _q(e){var s;const t=ee(),[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($e,{to:o,suffix:"checklist",children:"Request Group"})]}),a.jsxs("li",{children:["Back to the ",a.jsx($e,{to:e.planDefinition,children:"Plan Definition"})]})]})]}):a.jsx(Be,{onSubmit:()=>{t.post(t.fhirUrl("PlanDefinition",e.planDefinition.id,"$apply"),{resourceType:"Parameters",parameter:[{name:"subject",valueReference:n}]}).then(i).catch(console.log)},children:a.jsxs(je,{children:[a.jsxs(le,{children:['Start "',e.planDefinition.title,'"']}),a.jsxs(oe,{children:["Use the ",a.jsx("strong",{children:"Apply"})," operation to create a group of tasks for a workflow."]}),a.jsx(oe,{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(ro,{value:l.code[0]})]},`action-${c}`)})}),a.jsx(st,{title:"Subject",children:a.jsx(rh,{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 Iq(){const{resourceType:e,id:t}=Xe(),n=lt({reference:e+"/"+t});return n?a.jsx(Ce,{children:a.jsx(_q,{planDefinition:n})}):null}function Dq(){const{resourceType:e,id:t}=Xe(),n=lt({reference:e+"/"+t}),[r,o]=Ia("Questionnaire","subject-type="+e),[i,s]=Ia("ClientApplication",{_count:1e3});if(!n||o||s)return a.jsx(Lr,{});const l=i==null?void 0:i.filter(d=>Aq(e)&&!!d.launchUri);if((!r||r.length===0)&&(!l||l.length===0))return a.jsxs(Ce,{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=ft(n):n.resourceType==="Encounter"&&(c=n.subject,u=ft(n)),a.jsxs(Ce,{children:[r==null?void 0:r.map(d=>a.jsxs("div",{children:[a.jsx(le,{order:3,children:a.jsx($e,{to:`/forms/${d.id}?subject=${ht(n)}`,children:d.title||d.name})}),a.jsx(oe,{children:d.description})]},d.id)),l==null?void 0:l.map(d=>a.jsxs("div",{children:[a.jsx(le,{order:3,children:a.jsx(dV,{client:d,patient:c,encounter:u,children:d.name})}),a.jsx(oe,{children:d.description})]},d.id))]})}function Aq(e){return e==="Patient"||e==="Encounter"}function Nq(){const{resourceType:e,id:t}=Xe(),n=Nt(),[r,o]=p.useState({resourceType:"AuditEvent",filters:[{code:"entity",operator:re.EQUALS,value:`${e}/${t}`}],fields:["id","outcome","outcomeDesc","_lastUpdated"],sortRules:[{code:"-_lastUpdated"}],count:20});return a.jsx(Ce,{children:a.jsx(Jc,{search:r,onClick:i=>n(`/${i.resource.resourceType}/${i.resource.id}`),onChange:i=>o(i.definition),hideFilters:!0})})}function Oq(){const e=ee(),{resourceType:t,id:n}=Xe(),r=e.readHistory(t,n).read();return a.jsx(Ce,{children:a.jsx(nV,{history:r})})}const Mq="_hl7Input_k5xm3_1",$q={hl7Input:Mq};function Lq(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 Fq(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=>{td(r.currentTarget,{command:"setValue",value:t}).catch(console.error)}})}const zq=`{
545
+ "resourceType": "Patient",
546
+ "name": [
547
+ {
548
+ "given": [
549
+ "Alice"
550
+ ],
551
+ "family": "Smith"
552
+ }
553
+ ]
554
+ }`,Bq="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 Uq(){const e=ee(),{id:t}=Xe(),[n,r]=p.useState(),[o,i]=p.useState(),[s,l]=p.useState(zq),[c,u]=p.useState(Bq),[d,f]=p.useState(Kt.FHIR_JSON),h=p.useRef(null),m=p.useRef(null),[g,y]=p.useState(!1);p.useEffect(()=>{e.readResource("Bot",t).then(async E=>{r(E),i(await Vq(e,E))}).catch(E=>ue({color:"red",message:Re(E),autoClose:!1}))},[e,t]);const S=p.useCallback(()=>td(h.current,{command:"getValue"}),[]),v=p.useCallback(()=>td(h.current,{command:"getOutput"}),[]),x=p.useCallback(async()=>d===Kt.FHIR_JSON?JSON.parse(s):c,[d,s,c]),w=p.useCallback(async E=>{E.preventDefault(),E.stopPropagation(),y(!0);try{const P=await S(),T=await e.createAttachment(P,"index.ts","text/typescript"),_=[];n!=null&&n.sourceCode?_.push({op:"replace",path:"/sourceCode",value:T}):_.push({op:"add",path:"/sourceCode",value:T}),await e.patchResource("Bot",t,_),ue({color:"green",message:"Saved"})}catch(P){ue({color:"red",message:Re(P),autoClose:!1})}finally{y(!1)}},[e,t,n,S]),b=p.useCallback(async E=>{E.preventDefault(),E.stopPropagation(),y(!0);try{const P=await v();await e.post(e.fhirUrl("Bot",t,"$deploy"),{code:P}),ue({color:"green",message:"Deployed"})}catch(P){ue({color:"red",message:Re(P),autoClose:!1})}finally{y(!1)}},[e,t,v]),j=p.useCallback(async E=>{E.preventDefault(),E.stopPropagation(),y(!0);try{const P=await x(),T=await e.post(e.fhirUrl("Bot",t,"$execute"),P,d);await td(m.current,{command:"setValue",value:T}),ue({color:"green",message:"Success"})}catch(P){ue({color:"red",message:Re(P),autoClose:!1})}finally{y(!1)}},[e,t,x,d]);return!n||o===void 0?null:a.jsxs(Qn,{m:0,gutter:0,style:{overflow:"hidden"},children:[a.jsx(Qn.Col,{span:8,children:a.jsxs(Fn,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",mih:400,children:[a.jsx(Fq,{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:w,loading:g,leftSection:a.jsx(a6,{size:"1rem"}),children:"Save"}),a.jsx(Z,{type:"button",onClick:b,loading:g,leftSection:a.jsx(Wv,{size:"1rem"}),children:"Deploy"}),a.jsx(Z,{type:"button",onClick:j,loading:g,leftSection:a.jsx(C6,{size:"1rem"}),children:"Execute"})]})]})}),a.jsxs(Qn.Col,{span:4,children:[a.jsxs(Fn,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",children:[a.jsx(wt,{data:[{label:"FHIR",value:Kt.FHIR_JSON},{label:"HL7",value:Kt.HL7_V2}],onChange:E=>f(E.currentTarget.value)}),d===Kt.FHIR_JSON?a.jsx(Ha,{value:s,onChange:E=>l(E),autosize:!0,minRows:15}):a.jsx("textarea",{className:$q.hl7Input,value:c,onChange:E=>u(E.currentTarget.value),rows:15})]}),a.jsx(Fn,{m:2,p:"xs",shadow:"md",children:a.jsx(Lq,{iframeRef:m,className:"medplum-bot-output-frame",testId:"output-frame",minHeight:"200px"})})]})]})}async function Vq(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(_P);return(await e.download(e.fhirUrl("Binary",i))).text()}return t.code??""}function Ts(e){let t=e.meta;return t&&(t={...t,lastUpdated:void 0,versionId:void 0,author:void 0}),{...e,meta:t}}function Zk(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 Hq(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 Wq(){const e=ee(),{resourceType:t,id:n}=Xe(),r={reference:t+"/"+n},o=p.useCallback(i=>{e.updateResource(Ts(i)).then(()=>{ue({color:"green",message:"Success"})}).catch(s=>{ue({color:"red",message:Re(s),autoClose:!1})})},[e]);switch(t){case"PlanDefinition":return a.jsx(Ce,{children:a.jsx(IB,{value:r,onSubmit:o})});case"Questionnaire":return a.jsx(Ce,{children:a.jsx(pU,{questionnaire:r,onSubmit:o})});default:return null}}function qq(){const{resourceType:e,id:t}=Xe(),n=lt({reference:e+"/"+t}),r=Nt();return n?a.jsx(Ce,{children:a.jsx(LU,{value:n,onStart:(o,i)=>r(`/forms/${Qf(i)}`),onEdit:(o,i,s)=>r(`/${s.reference}}`)})}):null}function Gq(){const e=ee(),{resourceType:t,id:n}=Xe(),r=Nt();return a.jsxs(Ce,{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=>ue({color:"red",message:Re(o),autoClose:!1}))},children:"Delete"})]})}const Qq="_selectProfileBtn_tbaz6_1",Kq="_chevron_tbaz6_13",dS={selectProfileBtn:Qq,chevron:Kq};function Yq(){var c,u;const{resourceType:e,id:t}=Xe(),n=lt({reference:e+"/"+t}),[r,o]=p.useState(),i=_c({onDropdownClose:()=>i.resetSelectedOption()}),s=p.useMemo(()=>{var d;if(Dt((d=n==null?void 0:n.meta)==null?void 0:d.profile))return[a.jsx(Ee.Option,{value:"",children:"None"},""),...n.meta.profile.map(f=>a.jsx(Ee.Option,{value:f,children:f},f))]},[(c=n==null?void 0:n.meta)==null?void 0:c.profile]);if(p.useEffect(()=>{var d,f;((f=(d=n==null?void 0:n.meta)==null?void 0:d.profile)==null?void 0:f.length)===1&&o(n.meta.profile[0])},[(u=n==null?void 0:n.meta)==null?void 0:u.profile]),!n)return null;let l;return Dt(s)&&(l=a.jsx(Y,{justify:"flex-end",children:a.jsxs(je,{align:"flex-end",gap:"xs",children:[a.jsxs(Ee,{store:i,width:250,position:"bottom-end",withinPortal:!1,onOptionSubmit:d=>{o(d),i.closeDropdown()},children:[a.jsx(Ee.Target,{children:a.jsx(Xn,{onClick:()=>i.toggleDropdown(),children:a.jsxs(Qy,{fw:"bold",fs:"sm",className:dS.selectProfileBtn,children:[a.jsx("span",{children:"Pick profile"}),a.jsx(eT,{stroke:1.5,className:dS.chevron})]})})}),a.jsx(Ee.Dropdown,{w:"max-content",children:a.jsx(Ee.Options,{children:s})})]}),a.jsx(H,{children:r?a.jsxs(a.Fragment,{children:[a.jsx(oe,{span:!0,size:"sm",c:"dimmed",children:"Displaying profile: "}),a.jsx(oe,{span:!0,size:"sm",children:r||"Nothing selected"})]}):a.jsx(oe,{span:!0,size:"sm",c:"dimmed",children:"No profile displayed"})})]})})),a.jsx(Ce,{children:a.jsxs(je,{gap:"xl",children:[l,a.jsx(f0,{value:n,profileUrl:r})]})})}function Xq(){const e=ee(),{resourceType:t,id:n}=Xe(),[r,o]=p.useState(),i=Nt(),[s,l]=p.useState();p.useEffect(()=>{e.readResource(t,n).then(d=>o(ao(d))).catch(d=>{l(at(d)),ue({color:"red",message:Re(d),autoClose:!1})})},[e,t,n]);const c=p.useCallback(d=>{l(void 0),e.updateResource(Ts(d)).then(()=>{i(`/${t}/${n}/details`),ue({color:"green",message:"Success"})}).catch(f=>{l(at(f)),ue({color:"red",message:Re(f),autoClose:!1})})},[e,t,n,i]),u=p.useCallback(()=>i(`/${t}/${n}/delete`),[i,t,n]);return r?a.jsx(Ce,{children:a.jsx(Vd,{defaultValue:r,onSubmit:c,onDelete:u,outcome:s})}):null}function eR(e,t){const n=ee(),r=Nt();return{defaultValue:{resourceType:e},handleSubmit:s=>{t&&t(void 0),n.createResource(s).then(l=>r("/"+l.resourceType+"/"+l.id)).catch(l=>{t&&t(at(l)),ue({color:"red",message:Re(l),autoClose:!1,styles:{description:{whiteSpace:"pre-line"}}})})}}}function tR({resource:e,currentProfile:t,onChange:n}){const r=e.resourceType,o=ee(),[i,s]=p.useState();return p.useEffect(()=>{o.searchResources("StructureDefinition",{type:r,derivation:"constraint",_count:50}).then(l=>{s(l.filter(V8))}).catch(console.error)},[o,n,r]),a.jsx(We,{value:t==null?void 0:t.url,onChange:l=>{const c=i==null?void 0:i.find(u=>u.url===l);c&&n(c)},children:a.jsx(We.List,{children:i==null?void 0:i.map(l=>{var d,f;const c=(f=(d=e.meta)==null?void 0:d.profile)==null?void 0:f.includes(l.url),u=c?"This profile is present in this resource's meta.profile property.":"This profile is not included in this resource's meta.profile property.";return a.jsx(We.Tab,{value:l.url,title:u,rightSection:c&&a.jsx(jv,{variant:"outline",color:"green",size:"xs",style:{borderStyle:"none"},children:a.jsx(O6,{size:"90%"})}),children:l.title||l.name},l.url)})})})}function vp(){const{resourceType:e}=Xe(),t=Ho(),[n,r]=p.useState(),{defaultValue:o,handleSubmit:i}=eR(e,r),[s,l]=p.useState(),c=t.pathname.toLowerCase().endsWith("profiles"),u=p.useCallback(d=>{const f=Ts(d);s&&Zk(f,s.url),i(f)},[s,i]);return c?a.jsx(Ce,{children:a.jsxs(je,{children:[a.jsx(tR,{resource:o,currentProfile:s,onChange:l}),s?a.jsx(Vd,{defaultValue:o,onSubmit:u,outcome:n,profileUrl:s.url},s.url):a.jsx(oe,{my:"lg",fz:"lg",fs:"italic",ta:"center",children:"Select a profile above"})]})}):a.jsx(Ce,{children:a.jsx(Vd,{defaultValue:o,onSubmit:i,outcome:n})})}function Jq(){const e=ee(),{resourceType:t,id:n}=Xe(),r=e.readHistory(t,n).read();return a.jsx(Ce,{children:a.jsx(aV,{history:r})})}function Zq(){const{resourceType:e}=Xe(),[t,n]=p.useState(),{defaultValue:r,handleSubmit:o}=eR(e,n),i=p.useCallback(s=>{o(JSON.parse(s["new-resource"]))},[o]);return a.jsxs(Ce,{children:[t&&a.jsx(Hr,{outcome:t}),a.jsxs(Be,{onSubmit:i,children:[a.jsx(Ha,{name:"new-resource","data-testid":"create-resource-json",autosize:!0,minRows:24,defaultValue:er(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 eG(){const e=ee(),{resourceType:t,id:n}=Xe(),r=lt({reference:t+"/"+n}),o=Nt(),[i,s]=p.useState(),l=p.useCallback(c=>{e.updateResource(Ts(JSON.parse(c.resource))).then(()=>{s(void 0),o(`/${t}/${n}/details`),ue({color:"green",message:"Success"})}).catch(u=>{ue({color:"red",message:Re(u),autoClose:!1})})},[e,t,n,o]);return r?a.jsxs(Ce,{children:[i&&a.jsx(Hr,{outcome:i}),a.jsxs(Be,{onSubmit:l,children:[a.jsx(Ha,{name:"resource","data-testid":"resource-json",autosize:!0,minRows:24,defaultValue:er(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 tG(){const{resourceType:e,id:t}=Xe();return lt({reference:e+"/"+t})?a.jsxs(Ce,{children:[a.jsxs(xs,{icon:a.jsx(Vc,{size:16}),mb:"xl",children:["This is just a preview! Access your form here:",a.jsx("br",{}),a.jsx(Ve,{href:`/forms/${t}`,children:`/forms/${t}`})]}),a.jsx(uk,{questionnaire:{reference:e+"/"+t},onSubmit:()=>alert("You submitted the preview")})]}):null}function nG(){const e=ee(),{resourceType:t,id:n}=Xe(),[r,o]=p.useState(),[i,s]=p.useState();return p.useEffect(()=>{e.readResource(t,n).then(l=>o(ao(l))).catch(l=>{ue({color:"red",message:Re(l)})})},[e,t,n]),r?a.jsxs(Ce,{children:[a.jsxs(le,{order:2,children:["Available ",t," profiles"]}),a.jsx(je,{children:a.jsxs(a.Fragment,{children:[a.jsx(tR,{resource:r,currentProfile:i,onChange:s}),i?a.jsx(rG,{profile:i,resource:r,onResourceUpdated:l=>o(l)},i.url):a.jsx(oe,{my:"lg",fz:"lg",fs:"italic",ta:"center",children:"Select a profile above"})]})})]}):null}const rG=({profile:e,resource:t,onResourceUpdated:n})=>{const r=ee(),[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=Ts(u);s?Zk(d,e.url):Hq(d,e.url),r.updateResource(d).then(f=>{n(f),ue({color:"green",message:"Success"})}).catch(f=>{i(at(f)),ue({color:"red",message:Re(f),autoClose:!1})})},[r,e.url,n,s]);return a.jsxs(je,{children:[a.jsx(Mc,{size:"md",checked:s,label:`Conform resource to ${e.title}`,onChange:u=>l(u.currentTarget.checked),"data-testid":"profile-toggle"}),s?a.jsx(Vd,{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 oG(){const e=ee(),{id:t}=Xe(),[n,r]=p.useState(),[o,i]=p.useState(0),s=e.searchResources("Subscription","status=active&_count=100").read().filter(c=>iG(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:ht(n)}}).then(()=>{r(void 0),i(Date.now()),e.invalidateSearches("Subscription"),ue({color:"green",message:"Success"})}).catch(c=>ue({color:"red",message:Re(c),autoClose:!1}))}return a.jsxs(Ce,{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(Xa,{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(Ka,{name:"bot",resourceType:"Bot",onChange:c=>r(c)}),a.jsx(Z,{onClick:l,children:"Connect"})]}),a.jsx("div",{style:{display:"none"},children:o})]})}function iG(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 sG(){const{id:e}=Xe(),t=Nt(),[n,r]=p.useState({resourceType:"QuestionnaireResponse",filters:[{code:"questionnaire",operator:re.EQUALS,value:"Questionnaire/"+e}],fields:["id","_lastUpdated"]});return a.jsx(Ce,{children:a.jsx(Jc,{search:n,onClick:o=>t(`/${o.resource.resourceType}/${o.resource.id}`),onChange:o=>r(o.definition),hideFilters:!0,hideToolbar:!0})})}function aG(){const e=ee(),{resourceType:t,id:n}=Xe(),r=lt({reference:t+"/"+n}),o=p.useCallback(i=>{e.updateResource(Ts(i)).then(()=>{ue({color:"green",message:"Success"})}).catch(s=>{ue({color:"red",message:Re(s),autoClose:!1})})},[e]);return r?a.jsx(Ce,{children:a.jsx(_U,{onSubmit:o,definition:r})}):null}function lG(){const{resourceType:e,id:t}=Xe(),n=lt({reference:e+"/"+t});return n?a.jsx(Ce,{children:e==="MeasureReport"?a.jsx(jB,{measureReport:n}):a.jsx(s0,{value:n})}):null}const cG="_container_1ue98_1",uG="_entry_1ue98_14",dG="_active_1ue98_21",xp={container:cG,entry:uG,active:dG};function fG(e){const t=ee(),n=lt(e.value),[r,o]=p.useState();return p.useEffect(()=>{if(!n)return;const i=T0(n);if(!i)return;const s="reference"in i?i.reference:ht(i);t.search("ServiceRequest","subject="+s).then(l=>{const u=l.entry.map(d=>d.resource);BT(u),u.reverse(),o(u)}).catch(l=>ue({color:"red",message:Re(l),autoClose:!1}))},[t,n]),r?a.jsx("div",{"data-testid":"quick-service-requests",className:xp.container,children:r.map(i=>{var s,l,c,u,d,f,h;return a.jsxs("div",{className:et(xp.entry,{[xp.active]:i.id===(n==null?void 0:n.id)}),children:[a.jsx("p",{children:a.jsx($e,{to:i,children:hG(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:pG(i)})]},i.id)})}):null}function hG(e){if(e.identifier){for(const t of e.identifier)if(t.value)return t.value}return e.id||""}function pG(e){var t;return e.authoredOn?e.authoredOn.substring(0,10):(t=e.meta)!=null&&t.lastUpdated?e.meta.lastUpdated.substring(0,10):""}const mG="_container_1l2dh_1",gG={container:mG};function yG(e){var o,i,s,l;const t=lt(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:gG.container,children:a.jsx(wt,{defaultValue:e.defaultValue,onChange:c=>e.onChange(c.currentTarget.value),data:n})})}function vG(e){var n,r;const t=lt(e.specimen);return t?a.jsxs(De,{children:[a.jsxs(De.Entry,{children:[a.jsx(De.Key,{children:"Type"}),a.jsx(De.Value,{children:"Specimen"})]}),a.jsxs(De.Entry,{children:[a.jsx(De.Key,{children:"Collected"}),a.jsx(De.Value,{children:En((n=t.collection)==null?void 0:n.collectedDateTime)})]}),a.jsxs(De.Entry,{children:[a.jsx(De.Key,{children:"Specimen Age"}),a.jsx(De.Value,{children:xG(t)})]}),(r=t.collection)!=null&&r.collectedDateTime&&t.receivedTime?a.jsxs(De.Entry,{children:[a.jsx(De.Key,{children:"Specimen Stability"}),a.jsx(De.Value,{children:wG(t)})]}):a.jsx(a.Fragment,{})]}):null}function xG(e){var o;const t=(o=e.collection)==null?void 0:o.collectedDateTime;if(!t)return;const n=new Date(t);return nR(rR(n,new Date))}function wG(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 nR(rR(t,n))}function nR(e){return e.toString().padStart(3,"0")+"D"}function rR(e,t){const n=t.getTime()-e.getTime();return Math.floor(n/(1e3*3600*24))}function SG(e){const t=["Timeline"];return e==="Bot"&&t.push("Editor","Subscriptions"),e==="PlanDefinition"&&t.push("Apply","Builder"),e==="Questionnaire"&&t.push("Preview","Builder","Bots","Responses"),(e==="DiagnosticReport"||e==="MeasureReport")&&t.push("Report"),e==="RequestGroup"&&t.push("Checklist"),e==="ObservationDefinition"&&t.push("Ranges"),e==="Agent"&&t.push("Tools"),t.push("Details","Edit","Event","History","Blame","JSON","Apps","Profiles"),t}const bG=["Profiles"];function CG(){var w,b,j,E,P,T,_;const e=ee(),{resourceType:t,id:n}=Xe(),r={reference:t+"/"+n},o=Nt(),[i,s]=p.useState(),l=lt(r,s),c=SG(t),[u,d]=p.useState(()=>{const D=window.location.pathname.split("/").pop();return D&&c.map(O=>O.toLowerCase()).includes(D)?D:c[0].toLowerCase()}),f=Tt();async function h(){var I,L;const O=(L=(I=(await e.readHistory(t,n)).entry)==null?void 0:I.find(N=>!!N.resource))==null?void 0:L.resource;O?m(O):ue({color:"red",message:"No history to restore",autoClose:!1})}function m(D){e.updateResource(Ts(D)).then(()=>{s(void 0),ue({color:"green",message:"Success"})}).catch(O=>{ue({color:"red",message:Re(O),autoClose:!1})})}if(i)return dM(i)?a.jsxs(Ce,{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(Hr,{outcome:i});function g(D){D||(D=c[0].toLowerCase()),d(D),o(`/${t}/${n}/${D}`)}function y(D){const O=l,I=O.orderDetail||[];I.length===0&&I.push({}),I[0].text!==D&&(I[0].text=D,m({...O,orderDetail:I}))}const S=l&&T0(l),v=l&&QW(l),x=(j=(b=(w=e.getUserConfiguration())==null?void 0:w.option)==null?void 0:b.find(D=>D.id==="statusValueSet"))==null?void 0:j.valueString;return a.jsxs(a.Fragment,{children:[(l==null?void 0:l.resourceType)==="ServiceRequest"&&x&&a.jsx(yG,{valueSet:{reference:x},defaultValue:(P=(E=l.orderDetail)==null?void 0:E[0])==null?void 0:P.text,onChange:y},ht(l)+"-"+((_=(T=l.orderDetail)==null?void 0:T[0])==null?void 0:_.text)),l&&a.jsx(fG,{value:l}),l&&a.jsxs(Fn,{children:[S&&a.jsx(Kk,{patient:S}),v&&a.jsx(vG,{specimen:v}),t!=="Patient"&&a.jsx(Yk,{resource:r}),a.jsx(vr,{children:a.jsx(We,{value:u.toLowerCase(),onChange:g,children:a.jsx(We.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:c.map(D=>a.jsx(We.Tab,{value:D.toLowerCase(),children:bG.includes(D)?a.jsxs(Y,{gap:"xs",wrap:"nowrap",children:[D,a.jsx(Ic,{color:f.primaryColor,size:"sm",children:"Beta"})]}):D},D))})})})]}),a.jsx(b0,{})]})}function fS(){var v,x,w,b;const e=Nt(),{resourceType:t,id:n,versionId:r,tab:o}=Xe(),i=ee(),[s,l]=p.useState(!0),[c,u]=p.useState(),[d,f]=p.useState();if(p.useEffect(()=>{f(void 0),l(!0),i.readHistory(t,n).then(j=>u(j)).then(()=>l(!1)).catch(j=>{f(j),l(!1)})},[i,t,n]),s)return a.jsx(Lr,{});if(!c)return a.jsxs(Ce,{children:[a.jsx(le,{children:"Resource not found"}),a.jsx($e,{to:`/${t}`,children:"Return to search page"})]});const h=c.entry,m=h.findIndex(j=>{var E,P;return((P=(E=j.resource)==null?void 0:E.meta)==null?void 0:P.versionId)===r});if(m===-1)return a.jsxs(Ce,{children:[a.jsx(le,{children:"Version not found"}),a.jsx($e,{to:`/${t}/${n}`,children:"Return to resource"})]});const g=h[m].resource,y=m<h.length-1?h[m+1].resource:void 0,S="diff";return a.jsxs(We,{value:o||S,onChange:j=>e(`/${t}/${n}/_history/${r}/${j||S}`),children:[a.jsxs(Fn,{children:[a.jsx(Kc,{fluid:!0,p:"md",children:a.jsx(oe,{children:`${t} ${n}`})}),a.jsxs(We.List,{children:[a.jsx(We.Tab,{value:"diff",children:"Diff"}),a.jsx(We.Tab,{value:"raw",children:"Raw"})]})]}),a.jsxs(Ce,{children:[d&&a.jsx("pre",{"data-testid":"error",children:JSON.stringify(d,void 0,2)}),a.jsx(We.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($e,{to:`/${t}/${n}/_history/${(x=y.meta)==null?void 0:x.versionId}`,children:(w=y.meta)==null?void 0:w.versionId})]})]}),a.jsx(iV,{original:y,revised:g})]}):a.jsxs(a.Fragment,{children:[a.jsxs("ul",{children:[a.jsxs("li",{children:["Current: ",(b=g.meta)==null?void 0:b.versionId]}),a.jsx("li",{children:"Previous: (none)"})]}),a.jsx("pre",{children:JSON.stringify(g,void 0,2)})]})}),a.jsx(We.Panel,{value:"raw",children:a.jsx("pre",{children:JSON.stringify(g,void 0,2)})})]})]})}function EG(){const{resourceType:e,id:t}=Xe(),n=Nt(),[r,o]=p.useState({resourceType:"Subscription",filters:[{code:"url",operator:re.EQUALS,value:`${e}/${t}`}],fields:["id","criteria","status","_lastUpdated"]});return a.jsx(Ce,{children:a.jsx(Jc,{search:r,onClick:i=>n(`/${i.resource.resourceType}/${i.resource.id}`),onChange:i=>o(i.definition),hideFilters:!0})})}function hS(){const{resourceType:e,id:t}=Xe(),n={reference:e+"/"+t};switch(e){case"Encounter":return a.jsx(bz,{encounter:n});case"Patient":return a.jsx(PB,{patient:n});case"ServiceRequest":return a.jsx(uV,{serviceRequest:n});default:return a.jsx(Sz,{resource:n})}}function jG(){const e=ee(),{id:t}=Xe(),n=p.useMemo(()=>({reference:"Agent/"+t}),[t]),[r,o]=p.useState(!1),[i,s]=p.useState(),[l,c]=p.useState(),[u,d]=p.useState(),[f,h]=p.useState(!1),m=p.useCallback(()=>{o(!0),e.get(e.fhirUrl("Agent",t,"$status"),{cache:"reload"}).then(S=>{var v,x,w,b;s((x=(v=S.parameter)==null?void 0:v.find(j=>j.name==="status"))==null?void 0:x.valueCode),c((b=(w=S.parameter)==null?void 0:w.find(j=>j.name==="lastUpdated"))==null?void 0:b.valueInstant)}).catch(S=>y(Re(S))).finally(()=>o(!1))},[e,t]),g=p.useCallback(S=>{const v=S.ip;v&&(h(!0),e.pushToAgent(n,v,"PING",Kt.PING,!0).then(x=>d(x)).catch(x=>y(Re(x))).finally(()=>h(!1)))},[e,n]);function y(S){ue({color:"red",title:"Error",message:S,autoClose:!1})}return a.jsxs(Ce,{children:[a.jsx(le,{order:1,children:"Agent Tools"}),a.jsxs("div",{style:{marginBottom:10},children:["Agent: ",a.jsx(Xa,{value:n,link:!0})]}),a.jsx(dn,{my:"lg"}),a.jsx(le,{order:2,children:"Agent Status"}),a.jsx("p",{children:"Retrieve the status of the agent. This tests whether the agent is connected to the Medplum server, and the last time it was able to communicate."}),a.jsx(Z,{onClick:m,loading:r,children:"Get Status"}),!r&&i&&a.jsx(se,{children:a.jsxs(se.Tbody,{children:[a.jsxs(se.Tr,{children:[a.jsx(se.Td,{children:"Status"}),a.jsx(se.Td,{children:a.jsx(i0,{status:i})})]}),a.jsxs(se.Tr,{children:[a.jsx(se.Td,{children:"Last Updated"}),a.jsx(se.Td,{children:En(l)})]})]})}),a.jsx(dn,{my:"lg"}),a.jsx(le,{order:2,children:"Ping from Agent"}),a.jsx("p",{children:"Send a ping command from the agent to an IP address. Use this tool to troubleshoot local network connectivity."}),a.jsx(Be,{onSubmit:g,children:a.jsx(ie,{id:"ip",name:"ip",placeholder:"IP Address",rightSection:a.jsx(Gt,{size:24,radius:"xl",variant:"filled",type:"submit","aria-label":"Ping",loading:f,children:a.jsx(k6,{style:{width:"1rem",height:"1rem"},stroke:1.5})})})}),!f&&u&&a.jsxs(a.Fragment,{children:[a.jsx(le,{order:5,mt:"sm",mb:0,children:"Last Ping"}),a.jsx("pre",{children:u})]})]})}function PG(){return a.jsx(kH,{children:a.jsxs(fe,{errorElement:a.jsx(UW,{}),children:[a.jsx(fe,{path:"/signin",element:a.jsx(fq,{})}),a.jsx(fe,{path:"/oauth",element:a.jsx(aq,{})}),a.jsx(fe,{path:"/resetpassword",element:a.jsx(cq,{})}),a.jsx(fe,{path:"/setpassword/:id/:secret",element:a.jsx(dq,{})}),a.jsx(fe,{path:"/register",element:a.jsx(lq,{})}),a.jsx(fe,{path:"/changepassword",element:a.jsx(FW,{})}),a.jsx(fe,{path:"/security",element:a.jsx(uq,{})}),a.jsx(fe,{path:"/mfa",element:a.jsx(sq,{})}),a.jsx(fe,{path:"/batch",element:a.jsx($W,{})}),a.jsx(fe,{path:"/bulk/:resourceType",element:a.jsx(LW,{})}),a.jsx(fe,{path:"/smart",element:a.jsx(hq,{})}),a.jsx(fe,{path:"/forms/:id",element:a.jsx(YW,{})}),a.jsx(fe,{path:"/admin/super",element:a.jsx(Pq,{})}),a.jsx(fe,{path:"/admin/config",element:a.jsx(bq,{})}),a.jsxs(fe,{path:"/admin",element:a.jsx(Cq,{}),children:[a.jsx(fe,{path:"patients",element:a.jsx(Sq,{})}),a.jsx(fe,{path:"bots/new",element:a.jsx(gq,{})}),a.jsx(fe,{path:"bots",element:a.jsx(pq,{})}),a.jsx(fe,{path:"clients/new",element:a.jsx(yq,{})}),a.jsx(fe,{path:"clients",element:a.jsx(mq,{})}),a.jsx(fe,{path:"details",element:a.jsx(lS,{})}),a.jsx(fe,{path:"invite",element:a.jsx(wq,{})}),a.jsx(fe,{path:"users",element:a.jsx(Tq,{})}),a.jsx(fe,{path:"project",element:a.jsx(lS,{})}),a.jsx(fe,{path:"secrets",element:a.jsx(Eq,{})}),a.jsx(fe,{path:"sites",element:a.jsx(jq,{})}),a.jsx(fe,{path:"members/:membershipId",element:a.jsx(xq,{})})]}),a.jsx(fe,{path:"/lab/assays",element:a.jsx(kq,{})}),a.jsx(fe,{path:"/lab/panels",element:a.jsx(Rq,{})}),a.jsx(fe,{path:"/:resourceType/:id/_history/:versionId/:tab",element:a.jsx(fS,{})}),a.jsx(fe,{path:"/:resourceType/:id/_history/:versionId",element:a.jsx(fS,{})}),a.jsxs(fe,{path:"/:resourceType/new",element:a.jsx(BW,{}),children:[a.jsx(fe,{index:!0,element:a.jsx(vp,{})}),a.jsx(fe,{path:"form",element:a.jsx(vp,{})}),a.jsx(fe,{path:"json",element:a.jsx(Zq,{})}),a.jsx(fe,{path:"profiles",element:a.jsx(vp,{})})]}),a.jsxs(fe,{path:"/:resourceType/:id",element:a.jsx(CG,{}),children:[a.jsx(fe,{index:!0,element:a.jsx(hS,{})}),a.jsx(fe,{path:"apply",element:a.jsx(Iq,{})}),a.jsx(fe,{path:"apps",element:a.jsx(Dq,{})}),a.jsx(fe,{path:"event",element:a.jsx(Nq,{})}),a.jsx(fe,{path:"blame",element:a.jsx(Oq,{})}),a.jsx(fe,{path:"bots",element:a.jsx(oG,{})}),a.jsx(fe,{path:"builder",element:a.jsx(Wq,{})}),a.jsx(fe,{path:"checklist",element:a.jsx(qq,{})}),a.jsx(fe,{path:"delete",element:a.jsx(Gq,{})}),a.jsx(fe,{path:"details",element:a.jsx(Yq,{})}),a.jsx(fe,{path:"edit",element:a.jsx(Xq,{})}),a.jsx(fe,{path:"editor",element:a.jsx(Uq,{})}),a.jsx(fe,{path:"history",element:a.jsx(Jq,{})}),a.jsx(fe,{path:"json",element:a.jsx(eG,{})}),a.jsx(fe,{path:"preview",element:a.jsx(tG,{})}),a.jsx(fe,{path:"responses",element:a.jsx(sG,{})}),a.jsx(fe,{path:"report",element:a.jsx(lG,{})}),a.jsx(fe,{path:"ranges",element:a.jsx(aG,{})}),a.jsx(fe,{path:"subscriptions",element:a.jsx(EG,{})}),a.jsx(fe,{path:"timeline",element:a.jsx(hS,{})}),a.jsx(fe,{path:"tools",element:a.jsx(jG,{})}),a.jsx(fe,{path:"profiles",element:a.jsx(nG,{})})]}),a.jsx(fe,{path:"/:resourceType",element:a.jsx(aS,{})}),a.jsx(fe,{path:"/",element:a.jsx(aS,{})})]})})}function TG(){const e=ee(),t=e.getUserConfiguration(),n=Ho(),[r]=C0();return e.isLoading()?a.jsx(Lr,{}):a.jsx(j8,{logo:a.jsx(Vr,{size:24}),pathname:n.pathname,searchParams:r,version:b7,menus:kG(t),displayAddBookmark:!!(t!=null&&t.id),children:a.jsx(p.Suspense,{fallback:a.jsx(Lr,{}),children:a.jsx(PG,{})})})}function kG(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:RG(i.target)})))||[]}}))||[];return t.push({title:"Settings",links:[{label:"Security",href:"/security",icon:a.jsx(g6,{})}]}),t}const pS={Patient:I6,Practitioner:h6,Organization:r6,ServiceRequest:j6,DiagnosticReport:T6,Questionnaire:f6,admin:e6,AccessPolicy:m6,Subscription:N6,batch:w6,Observation:x6};function RG(e){try{const t=new URL(e,"https://app.medplum.com").pathname.split("/")[1];if(t in pS){const n=pS[t];return a.jsx(n,{})}}catch{}return a.jsx(Wf,{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 _G(){const e=nu(),t=new GP({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=DH([{path:"*",element:a.jsx(TG,{})}]),o=s=>r.navigate(s);wk(document.getElementById("root")).render(a.jsx(p.StrictMode,{children:a.jsx(z7,{medplum:t,navigate:o,children:a.jsxs(KS,{theme:n,children:[a.jsx(Bo,{position:"bottom-right"}),a.jsx(BH,{router:r})]})})}))}_G().catch(console.error);
555
+ //# sourceMappingURL=index-DOIYU6OT.js.map