@medplum/app 5.0.5 → 5.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,200 +0,0 @@
1
- function f3(e,t){for(var n=0;n<t.length;n++){const r=t[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in e)){const s=Object.getOwnPropertyDescriptor(r,o);s&&Object.defineProperty(e,o,s.get?s:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const s of o)if(s.type==="childList")for(const c of s.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(o){const s={};return o.integrity&&(s.integrity=o.integrity),o.referrerPolicy&&(s.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?s.credentials="include":o.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(o){if(o.ep)return;o.ep=!0;const s=n(o);fetch(o.href,s)}})();function Lp(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ny={exports:{}},Qu={};var _C;function h3(){if(_C)return Qu;_C=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function n(r,o,s){var c=null;if(s!==void 0&&(c=""+s),o.key!==void 0&&(c=""+o.key),"key"in o){s={};for(var d in o)d!=="key"&&(s[d]=o[d])}else s=o;return o=s.ref,{$$typeof:e,type:r,key:c,ref:o!==void 0?o:null,props:s}}return Qu.Fragment=t,Qu.jsx=n,Qu.jsxs=n,Qu}var DC;function p3(){return DC||(DC=1,ny.exports=h3()),ny.exports}var a=p3(),yo=function(){return yo=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},yo.apply(this,arguments)};function XR(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 gl(e,t,n,r){function o(s){return s instanceof n?s:new n(function(c){c(s)})}return new(n||(n=Promise))(function(s,c){function d(m){try{p(r.next(m))}catch(g){c(g)}}function f(m){try{p(r.throw(m))}catch(g){c(g)}}function p(m){m.done?s(m.value):o(m.value).then(d,f)}p((r=r.apply(e,t||[])).next())})}function m3(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}var ry={exports:{}},gt={};var AC;function g3(){if(AC)return gt;AC=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),s=Symbol.for("react.consumer"),c=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),y=Symbol.iterator;function b(O){return O===null||typeof O!="object"?null:(O=y&&O[y]||O["@@iterator"],typeof O=="function"?O:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,C={};function R(O,H,oe){this.props=O,this.context=H,this.refs=C,this.updater=oe||w}R.prototype.isReactComponent={},R.prototype.setState=function(O,H){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,H,"setState")},R.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function T(){}T.prototype=R.prototype;function E(O,H,oe){this.props=O,this.context=H,this.refs=C,this.updater=oe||w}var _=E.prototype=new T;_.constructor=E,j(_,R.prototype),_.isPureReactComponent=!0;var k=Array.isArray;function L(){}var A={H:null,A:null,T:null,S:null},N=Object.prototype.hasOwnProperty;function U(O,H,oe){var ue=oe.ref;return{$$typeof:e,type:O,key:H,ref:ue!==void 0?ue:null,props:oe}}function B(O,H){return U(O.type,H,O.props)}function Q(O){return typeof O=="object"&&O!==null&&O.$$typeof===e}function J(O){var H={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(oe){return H[oe]})}var Z=/\/+/g;function $(O,H){return typeof O=="object"&&O!==null&&O.key!=null?J(""+O.key):H.toString(36)}function W(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(L,L):(O.status="pending",O.then(function(H){O.status==="pending"&&(O.status="fulfilled",O.value=H)},function(H){O.status==="pending"&&(O.status="rejected",O.reason=H)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function M(O,H,oe,ue,Se){var ge=typeof O;(ge==="undefined"||ge==="boolean")&&(O=null);var Pe=!1;if(O===null)Pe=!0;else switch(ge){case"bigint":case"string":case"number":Pe=!0;break;case"object":switch(O.$$typeof){case e:case t:Pe=!0;break;case m:return Pe=O._init,M(Pe(O._payload),H,oe,ue,Se)}}if(Pe)return Se=Se(O),Pe=ue===""?"."+$(O,0):ue,k(Se)?(oe="",Pe!=null&&(oe=Pe.replace(Z,"$&/")+"/"),M(Se,H,oe,"",function(ht){return ht})):Se!=null&&(Q(Se)&&(Se=B(Se,oe+(Se.key==null||O&&O.key===Se.key?"":(""+Se.key).replace(Z,"$&/")+"/")+Pe)),H.push(Se)),1;Pe=0;var rt=ue===""?".":ue+":";if(k(O))for(var Ce=0;Ce<O.length;Ce++)ue=O[Ce],ge=rt+$(ue,Ce),Pe+=M(ue,H,oe,ge,Se);else if(Ce=b(O),typeof Ce=="function")for(O=Ce.call(O),Ce=0;!(ue=O.next()).done;)ue=ue.value,ge=rt+$(ue,Ce++),Pe+=M(ue,H,oe,ge,Se);else if(ge==="object"){if(typeof O.then=="function")return M(W(O),H,oe,ue,Se);throw H=String(O),Error("Objects are not valid as a React child (found: "+(H==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":H)+"). If you meant to render a collection of children, use an array instead.")}return Pe}function I(O,H,oe){if(O==null)return O;var ue=[],Se=0;return M(O,ue,"","",function(ge){return H.call(oe,ge,Se++)}),ue}function z(O){if(O._status===-1){var H=O._result;H=H(),H.then(function(oe){(O._status===0||O._status===-1)&&(O._status=1,O._result=oe)},function(oe){(O._status===0||O._status===-1)&&(O._status=2,O._result=oe)}),O._status===-1&&(O._status=0,O._result=H)}if(O._status===1)return O._result.default;throw O._result}var F=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var H=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(H))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},X={map:I,forEach:function(O,H,oe){I(O,function(){H.apply(this,arguments)},oe)},count:function(O){var H=0;return I(O,function(){H++}),H},toArray:function(O){return I(O,function(H){return H})||[]},only:function(O){if(!Q(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return gt.Activity=g,gt.Children=X,gt.Component=R,gt.Fragment=n,gt.Profiler=o,gt.PureComponent=E,gt.StrictMode=r,gt.Suspense=f,gt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,gt.__COMPILER_RUNTIME={__proto__:null,c:function(O){return A.H.useMemoCache(O)}},gt.cache=function(O){return function(){return O.apply(null,arguments)}},gt.cacheSignal=function(){return null},gt.cloneElement=function(O,H,oe){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var ue=j({},O.props),Se=O.key;if(H!=null)for(ge in H.key!==void 0&&(Se=""+H.key),H)!N.call(H,ge)||ge==="key"||ge==="__self"||ge==="__source"||ge==="ref"&&H.ref===void 0||(ue[ge]=H[ge]);var ge=arguments.length-2;if(ge===1)ue.children=oe;else if(1<ge){for(var Pe=Array(ge),rt=0;rt<ge;rt++)Pe[rt]=arguments[rt+2];ue.children=Pe}return U(O.type,Se,ue)},gt.createContext=function(O){return O={$$typeof:c,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:s,_context:O},O},gt.createElement=function(O,H,oe){var ue,Se={},ge=null;if(H!=null)for(ue in H.key!==void 0&&(ge=""+H.key),H)N.call(H,ue)&&ue!=="key"&&ue!=="__self"&&ue!=="__source"&&(Se[ue]=H[ue]);var Pe=arguments.length-2;if(Pe===1)Se.children=oe;else if(1<Pe){for(var rt=Array(Pe),Ce=0;Ce<Pe;Ce++)rt[Ce]=arguments[Ce+2];Se.children=rt}if(O&&O.defaultProps)for(ue in Pe=O.defaultProps,Pe)Se[ue]===void 0&&(Se[ue]=Pe[ue]);return U(O,ge,Se)},gt.createRef=function(){return{current:null}},gt.forwardRef=function(O){return{$$typeof:d,render:O}},gt.isValidElement=Q,gt.lazy=function(O){return{$$typeof:m,_payload:{_status:-1,_result:O},_init:z}},gt.memo=function(O,H){return{$$typeof:p,type:O,compare:H===void 0?null:H}},gt.startTransition=function(O){var H=A.T,oe={};A.T=oe;try{var ue=O(),Se=A.S;Se!==null&&Se(oe,ue),typeof ue=="object"&&ue!==null&&typeof ue.then=="function"&&ue.then(L,F)}catch(ge){F(ge)}finally{H!==null&&oe.types!==null&&(H.types=oe.types),A.T=H}},gt.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},gt.use=function(O){return A.H.use(O)},gt.useActionState=function(O,H,oe){return A.H.useActionState(O,H,oe)},gt.useCallback=function(O,H){return A.H.useCallback(O,H)},gt.useContext=function(O){return A.H.useContext(O)},gt.useDebugValue=function(){},gt.useDeferredValue=function(O,H){return A.H.useDeferredValue(O,H)},gt.useEffect=function(O,H){return A.H.useEffect(O,H)},gt.useEffectEvent=function(O){return A.H.useEffectEvent(O)},gt.useId=function(){return A.H.useId()},gt.useImperativeHandle=function(O,H,oe){return A.H.useImperativeHandle(O,H,oe)},gt.useInsertionEffect=function(O,H){return A.H.useInsertionEffect(O,H)},gt.useLayoutEffect=function(O,H){return A.H.useLayoutEffect(O,H)},gt.useMemo=function(O,H){return A.H.useMemo(O,H)},gt.useOptimistic=function(O,H){return A.H.useOptimistic(O,H)},gt.useReducer=function(O,H,oe){return A.H.useReducer(O,H,oe)},gt.useRef=function(O){return A.H.useRef(O)},gt.useState=function(O){return A.H.useState(O)},gt.useSyncExternalStore=function(O,H,oe){return A.H.useSyncExternalStore(O,H,oe)},gt.useTransition=function(){return A.H.useTransition()},gt.version="19.2.0",gt}var kC;function Xx(){return kC||(kC=1,ry.exports=g3()),ry.exports}var v=Xx();const kn=Lp(v),JR=f3({__proto__:null,default:kn},[v]);var Vh="right-scroll-bar-position",Fh="width-before-scroll-bar",v3="with-scroll-bars-hidden",y3="--removed-body-scroll-bar-size";function iy(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function x3(e,t){var n=v.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var b3=typeof window<"u"?v.useLayoutEffect:v.useEffect,PC=new WeakMap;function S3(e,t){var n=x3(null,function(r){return e.forEach(function(o){return iy(o,r)})});return b3(function(){var r=PC.get(n);if(r){var o=new Set(r),s=new Set(e),c=n.current;o.forEach(function(d){s.has(d)||iy(d,null)}),s.forEach(function(d){o.has(d)||iy(d,c)})}PC.set(n,e)},[e]),n}function w3(e){return e}function j3(e,t){t===void 0&&(t=w3);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var c=t(s,r);return n.push(c),function(){n=n.filter(function(d){return d!==c})}},assignSyncMedium:function(s){for(r=!0;n.length;){var c=n;n=[],c.forEach(s)}n={push:function(d){return s(d)},filter:function(){return n}}},assignMedium:function(s){r=!0;var c=[];if(n.length){var d=n;n=[],d.forEach(s),c=n}var f=function(){var m=c;c=[],m.forEach(s)},p=function(){return Promise.resolve().then(f)};p(),n={push:function(m){c.push(m),p()},filter:function(m){return c=c.filter(m),n}}}};return o}function C3(e){e===void 0&&(e={});var t=j3(null);return t.options=yo({async:!0,ssr:!1},e),t}var ZR=function(e){var t=e.sideCar,n=XR(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return v.createElement(r,yo({},n))};ZR.isSideCarExport=!0;function E3(e,t){return e.useMedium(t),ZR}var e2=C3(),oy=function(){},Ip=v.forwardRef(function(e,t){var n=v.useRef(null),r=v.useState({onScrollCapture:oy,onWheelCapture:oy,onTouchMoveCapture:oy}),o=r[0],s=r[1],c=e.forwardProps,d=e.children,f=e.className,p=e.removeScrollBar,m=e.enabled,g=e.shards,y=e.sideCar,b=e.noRelative,w=e.noIsolation,j=e.inert,C=e.allowPinchZoom,R=e.as,T=R===void 0?"div":R,E=e.gapMode,_=XR(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),k=y,L=S3([n,t]),A=yo(yo({},_),o);return v.createElement(v.Fragment,null,m&&v.createElement(k,{sideCar:e2,removeScrollBar:p,shards:g,noRelative:b,noIsolation:w,inert:j,setCallbacks:s,allowPinchZoom:!!C,lockRef:n,gapMode:E}),c?v.cloneElement(v.Children.only(d),yo(yo({},A),{ref:L})):v.createElement(T,yo({},A,{className:f,ref:L}),d))});Ip.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ip.classNames={fullWidth:Fh,zeroRight:Vh};var T3=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function R3(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=T3();return t&&e.setAttribute("nonce",t),e}function _3(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function D3(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var A3=function(){var e=0,t=null;return{add:function(n){e==0&&(t=R3())&&(_3(t,n),D3(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},k3=function(){var e=A3();return function(t,n){v.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},t2=function(){var e=k3(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},P3={left:0,top:0,right:0,gap:0},ay=function(e){return parseInt(e||"",10)||0},N3=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[ay(n),ay(r),ay(o)]},O3=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return P3;var t=N3(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])}},M3=t2(),Tc="data-scroll-locked",L3=function(e,t,n,r){var o=e.left,s=e.top,c=e.right,d=e.gap;return n===void 0&&(n="margin"),`
2
- .`.concat(v3,` {
3
- overflow: hidden `).concat(r,`;
4
- padding-right: `).concat(d,"px ").concat(r,`;
5
- }
6
- body[`).concat(Tc,`] {
7
- overflow: hidden `).concat(r,`;
8
- overscroll-behavior: contain;
9
- `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
10
- padding-left: `.concat(o,`px;
11
- padding-top: `).concat(s,`px;
12
- padding-right: `).concat(c,`px;
13
- margin-left:0;
14
- margin-top:0;
15
- margin-right: `).concat(d,"px ").concat(r,`;
16
- `),n==="padding"&&"padding-right: ".concat(d,"px ").concat(r,";")].filter(Boolean).join(""),`
17
- }
18
-
19
- .`).concat(Vh,` {
20
- right: `).concat(d,"px ").concat(r,`;
21
- }
22
-
23
- .`).concat(Fh,` {
24
- margin-right: `).concat(d,"px ").concat(r,`;
25
- }
26
-
27
- .`).concat(Vh," .").concat(Vh,` {
28
- right: 0 `).concat(r,`;
29
- }
30
-
31
- .`).concat(Fh," .").concat(Fh,` {
32
- margin-right: 0 `).concat(r,`;
33
- }
34
-
35
- body[`).concat(Tc,`] {
36
- `).concat(y3,": ").concat(d,`px;
37
- }
38
- `)},NC=function(){var e=parseInt(document.body.getAttribute(Tc)||"0",10);return isFinite(e)?e:0},I3=function(){v.useEffect(function(){return document.body.setAttribute(Tc,(NC()+1).toString()),function(){var e=NC()-1;e<=0?document.body.removeAttribute(Tc):document.body.setAttribute(Tc,e.toString())}},[])},z3=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;I3();var s=v.useMemo(function(){return O3(o)},[o]);return v.createElement(M3,{styles:L3(s,!t,o,n?"":"!important")})},tx=!1;if(typeof window<"u")try{var Sh=Object.defineProperty({},"passive",{get:function(){return tx=!0,!0}});window.addEventListener("test",Sh,Sh),window.removeEventListener("test",Sh,Sh)}catch{tx=!1}var uc=tx?{passive:!1}:!1,$3=function(e){return e.tagName==="TEXTAREA"},n2=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!$3(e)&&n[t]==="visible")},U3=function(e){return n2(e,"overflowY")},B3=function(e){return n2(e,"overflowX")},OC=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=r2(e,r);if(o){var s=i2(e,r),c=s[1],d=s[2];if(c>d)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},V3=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},F3=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},r2=function(e,t){return e==="v"?U3(t):B3(t)},i2=function(e,t){return e==="v"?V3(t):F3(t)},H3=function(e,t){return e==="h"&&t==="rtl"?-1:1},q3=function(e,t,n,r,o){var s=H3(e,window.getComputedStyle(t).direction),c=s*r,d=n.target,f=t.contains(d),p=!1,m=c>0,g=0,y=0;do{if(!d)break;var b=i2(e,d),w=b[0],j=b[1],C=b[2],R=j-C-s*w;(w||R)&&r2(e,d)&&(g+=R,y+=w);var T=d.parentNode;d=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!f&&d!==document.body||f&&(t.contains(d)||t===d));return(m&&Math.abs(g)<1||!m&&Math.abs(y)<1)&&(p=!0),p},wh=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},MC=function(e){return[e.deltaX,e.deltaY]},LC=function(e){return e&&"current"in e?e.current:e},G3=function(e,t){return e[0]===t[0]&&e[1]===t[1]},W3=function(e){return`
39
- .block-interactivity-`.concat(e,` {pointer-events: none;}
40
- .allow-interactivity-`).concat(e,` {pointer-events: all;}
41
- `)},Q3=0,dc=[];function Y3(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),o=v.useState(Q3++)[0],s=v.useState(t2)[0],c=v.useRef(e);v.useEffect(function(){c.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var j=m3([e.lockRef.current],(e.shards||[]).map(LC),!0).filter(Boolean);return j.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),j.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var d=v.useCallback(function(j,C){if("touches"in j&&j.touches.length===2||j.type==="wheel"&&j.ctrlKey)return!c.current.allowPinchZoom;var R=wh(j),T=n.current,E="deltaX"in j?j.deltaX:T[0]-R[0],_="deltaY"in j?j.deltaY:T[1]-R[1],k,L=j.target,A=Math.abs(E)>Math.abs(_)?"h":"v";if("touches"in j&&A==="h"&&L.type==="range")return!1;var N=OC(A,L);if(!N)return!0;if(N?k=A:(k=A==="v"?"h":"v",N=OC(A,L)),!N)return!1;if(!r.current&&"changedTouches"in j&&(E||_)&&(r.current=k),!k)return!0;var U=r.current||k;return q3(U,C,j,U==="h"?E:_)},[]),f=v.useCallback(function(j){var C=j;if(!(!dc.length||dc[dc.length-1]!==s)){var R="deltaY"in C?MC(C):wh(C),T=t.current.filter(function(k){return k.name===C.type&&(k.target===C.target||C.target===k.shadowParent)&&G3(k.delta,R)})[0];if(T&&T.should){C.cancelable&&C.preventDefault();return}if(!T){var E=(c.current.shards||[]).map(LC).filter(Boolean).filter(function(k){return k.contains(C.target)}),_=E.length>0?d(C,E[0]):!c.current.noIsolation;_&&C.cancelable&&C.preventDefault()}}},[]),p=v.useCallback(function(j,C,R,T){var E={name:j,delta:C,target:R,should:T,shadowParent:K3(R)};t.current.push(E),setTimeout(function(){t.current=t.current.filter(function(_){return _!==E})},1)},[]),m=v.useCallback(function(j){n.current=wh(j),r.current=void 0},[]),g=v.useCallback(function(j){p(j.type,MC(j),j.target,d(j,e.lockRef.current))},[]),y=v.useCallback(function(j){p(j.type,wh(j),j.target,d(j,e.lockRef.current))},[]);v.useEffect(function(){return dc.push(s),e.setCallbacks({onScrollCapture:g,onWheelCapture:g,onTouchMoveCapture:y}),document.addEventListener("wheel",f,uc),document.addEventListener("touchmove",f,uc),document.addEventListener("touchstart",m,uc),function(){dc=dc.filter(function(j){return j!==s}),document.removeEventListener("wheel",f,uc),document.removeEventListener("touchmove",f,uc),document.removeEventListener("touchstart",m,uc)}},[]);var b=e.removeScrollBar,w=e.inert;return v.createElement(v.Fragment,null,w?v.createElement(s,{styles:W3(o)}):null,b?v.createElement(z3,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function K3(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const X3=E3(e2,Y3);var il=v.forwardRef(function(e,t){return v.createElement(Ip,yo({},e,{ref:t,sideCar:X3}))});il.classNames=Ip.classNames;function cn(e){return Object.keys(e)}function sy(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Jx(e,t){const n={...e},r=t;return sy(e)&&sy(t)&&Object.keys(t).forEach(o=>{sy(r[o])&&o in e?n[o]=Jx(n[o],r[o]):n[o]=r[o]}),n}function J3(e){return e.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function Z3(e){return typeof e!="string"||!e.includes("var(--mantine-scale)")?e:e.match(/^calc\((.*?)\)$/)?.[1].split("*")[0].trim()}function ud(e){const t=Z3(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 IC(e){return e==="0rem"?"0rem":`calc(${e} * var(--mantine-scale))`}function o2(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?IC(o):o}if(typeof r=="string"){if(r===""||r.startsWith("calc(")||r.startsWith("clamp(")||r.includes("rgba("))return r;if(r.includes(","))return r.split(",").map(s=>n(s)).join(",");if(r.includes(" "))return r.split(" ").map(s=>n(s)).join(" ");const o=r.replace("px","");if(!Number.isNaN(Number(o))){const s=`${Number(o)/16}${e}`;return t?IC(s):s}}return r}return n}const le=o2("rem",{shouldScale:!0}),tp=o2("em");function hs(e){return Object.keys(e).reduce((t,n)=>(e[n]!==void 0&&(t[n]=e[n]),t),{})}function a2(e){if(typeof e=="number")return!0;if(typeof e=="string"){if(e.startsWith("calc(")||e.startsWith("var(")||e.includes(" ")&&e.trim()!=="")return!0;const t=/^[+-]?[0-9]+(\.[0-9]+)?(px|em|rem|ex|ch|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cm|mm|in|pt|pc|q|cqw|cqh|cqi|cqb|cqmin|cqmax|%)?$/;return e.trim().split(/\s+/).every(r=>t.test(r))}return!1}function Po(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==v.Fragment:!1}function Mr(e){const t=v.createContext(null);return[({children:o,value:s})=>a.jsx(t.Provider,{value:s,children:o}),()=>{const o=v.useContext(t);if(o===null)throw new Error(e);return o}]}function No(e=null){const t=v.createContext(e);return[({children:o,value:s})=>a.jsx(t.Provider,{value:s,children:o}),()=>v.useContext(t)]}function zC(e,t){return n=>{if(typeof n!="string"||n.trim().length===0)throw new Error(t);return`${e}-${n}`}}function np(e,t){let n=e;for(;(n=n.parentElement)&&!n.matches(t););return n}function eM(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 tM(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 nM(e,t,n){return np(e,n)===np(t,n)}function Zx({parentSelector:e,siblingSelector:t,onKeyDown:n,loop:r=!0,activateOnFocus:o=!1,dir:s="rtl",orientation:c}){return d=>{n?.(d);const f=Array.from(np(d.currentTarget,e)?.querySelectorAll(t)||[]).filter(w=>nM(d.currentTarget,w,e)),p=f.findIndex(w=>d.currentTarget===w),m=tM(p,f,r),g=eM(p,f,r),y=s==="rtl"?g:m,b=s==="rtl"?m:g;switch(d.key){case"ArrowRight":{c==="horizontal"&&(d.stopPropagation(),d.preventDefault(),f[y].focus(),o&&f[y].click());break}case"ArrowLeft":{c==="horizontal"&&(d.stopPropagation(),d.preventDefault(),f[b].focus(),o&&f[b].click());break}case"ArrowUp":{c==="vertical"&&(d.stopPropagation(),d.preventDefault(),f[g].focus(),o&&f[g].click());break}case"ArrowDown":{c==="vertical"&&(d.stopPropagation(),d.preventDefault(),f[m].focus(),o&&f[m].click());break}case"Home":{d.stopPropagation(),d.preventDefault(),!f[0].disabled&&f[0].focus();break}case"End":{d.stopPropagation(),d.preventDefault();const w=f.length-1;!f[w].disabled&&f[w].focus();break}}}}const rM={app:100,modal:200,popover:300,overlay:400,max:9999};function hi(e){return rM[e]}const rp=()=>{};function iM(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||rp:n=>{n.key==="Escape"&&(e(n),t.onTrigger?.())}}function st(e,t="size",n=!0){if(e!==void 0)return a2(e)?n?le(e):e:`var(--${t}-${e})`}function Fn(e){return st(e,"mantine-spacing")}function Ft(e){return e===void 0?"var(--mantine-radius-default)":st(e,"mantine-radius")}function Hn(e){return st(e,"mantine-font-size")}function s2(e){return st(e,"mantine-line-height",!1)}function eb(e){if(e)return st(e,"mantine-shadow",!1)}function ir(e,t){return n=>{e?.(n),t?.(n)}}function tb(e,t){return e in t?ud(t[e]):ud(e)}function dd(e,t){const n=e.map(r=>({value:r,px:tb(r,t)}));return n.sort((r,o)=>r.px-o.px),n}function Qi(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function oM(e,t,n){return n?Array.from(np(n,t)?.querySelectorAll(e)||[]).findIndex(r=>r===n):null}function Hh(e,t,n){return t===void 0&&n===void 0?e:t!==void 0&&n===void 0?Math.max(e,t):Math.min(t===void 0&&n!==void 0?e:Math.max(e,t),n)}function ip(e="mantine-"){return`${e}${Math.random().toString(36).slice(2,11)}`}function aM(e,t){if(e===t||Number.isNaN(e)&&Number.isNaN(t))return!0;if(!(e instanceof Object)||!(t instanceof Object))return!1;const n=Object.keys(e),{length:r}=n;if(r!==Object.keys(t).length)return!1;for(let o=0;o<r;o+=1){const s=n[o];if(!(s in t)||e[s]!==t[s]&&!(Number.isNaN(e[s])&&Number.isNaN(t[s])))return!1}return!0}function $C(e){return typeof e!="string"?"":e.charAt(0).toUpperCase()+e.slice(1)}function qs(e){const t=v.useRef(e);return v.useEffect(()=>{t.current=e}),v.useMemo(()=>((...n)=>t.current?.(...n)),[])}function zp(e,t){const{delay:n,flushOnUnmount:r,leading:o}=typeof t=="number"?{delay:t,flushOnUnmount:!1,leading:!1}:t,s=qs(e),c=v.useRef(0),d=v.useMemo(()=>{const f=Object.assign((...p)=>{window.clearTimeout(c.current);const m=f._isFirstCall;f._isFirstCall=!1;function g(){window.clearTimeout(c.current),c.current=0,f._isFirstCall=!0}if(o&&m){s(...p);const w=()=>{g()},j=()=>{c.current!==0&&(g(),s(...p))},C=()=>{g()};f.flush=j,f.cancel=C,c.current=window.setTimeout(w,n);return}if(o&&!m){const w=()=>{c.current!==0&&(g(),s(...p))},j=()=>{g()};f.flush=w,f.cancel=j;const C=()=>{g()};c.current=window.setTimeout(C,n);return}const y=()=>{c.current!==0&&(g(),s(...p))},b=()=>{g()};f.flush=y,f.cancel=b,c.current=window.setTimeout(y,n)},{flush:()=>{},cancel:()=>{},_isFirstCall:!0});return f},[s,n,o]);return v.useEffect(()=>()=>{r?d.flush():d.cancel()},[d,r]),d}const sM=["mousedown","touchstart"];function lM(e,t,n){const r=v.useRef(null),o=t||sM;return v.useEffect(()=>{const s=c=>{const{target:d}=c??{};if(Array.isArray(n)){const f=!document.body.contains(d)&&d?.tagName!=="HTML";n.every(m=>!!m&&!c.composedPath().includes(m))&&!f&&e(c)}else r.current&&!r.current.contains(d)&&e(c)};return o.forEach(c=>document.addEventListener(c,s)),()=>{o.forEach(c=>document.removeEventListener(c,s))}},[r,e,n]),r}function l2(e={timeout:2e3}){const[t,n]=v.useState(null),[r,o]=v.useState(!1),[s,c]=v.useState(null),d=m=>{window.clearTimeout(s),c(window.setTimeout(()=>o(!1),e.timeout)),o(m)};return{copy:m=>{"clipboard"in navigator?navigator.clipboard.writeText(m).then(()=>d(!0)).catch(g=>n(g)):n(new Error("useClipboard: navigator.clipboard is not supported"))},reset:()=>{o(!1),n(null),window.clearTimeout(s)},error:t,copied:r}}function cM(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function uM(e,t){return typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function c2(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=v.useState(n?t:uM(e));return v.useEffect(()=>{try{const s=window.matchMedia(e);return o(s.matches),cM(s,c=>o(c.matches))}catch{return}},[e]),r||!1}function dM(e,t){return c2("(prefers-color-scheme: dark)",e==="dark",t)?"dark":"light"}const Fc=typeof document<"u"?v.useLayoutEffect:v.useEffect;function tl(e,t){const n=v.useRef(!1);v.useEffect(()=>()=>{n.current=!1},[]),v.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function u2({opened:e,shouldReturnFocus:t=!0}){const n=v.useRef(null),r=()=>{n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&n.current?.focus({preventScroll:!0})};return tl(()=>{let o=-1;const s=c=>{c.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",s),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",s)}},[e,t]),r}const fM=/input|select|textarea|button|object/,d2="a, input, select, textarea, button, object, [tabindex]";function hM(e){return e.style.display==="none"}function pM(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(hM(n))return!1;n=n.parentNode}return!0}function f2(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function nx(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(f2(e));return(fM.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&pM(e)}function h2(e){const t=f2(e);return(Number.isNaN(t)||t>=0)&&nx(e)}function mM(e){return Array.from(e.querySelectorAll(d2)).filter(h2)}function gM(e,t){const n=mM(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();let s=r===o.activeElement||e===o.activeElement;const c=o.activeElement;if(c.tagName==="INPUT"&&c.getAttribute("type")==="radio"&&(s=n.filter(m=>m.getAttribute("type")==="radio"&&m.getAttribute("name")===c.getAttribute("name")).includes(r)),!s)return;t.preventDefault();const f=n[t.shiftKey?n.length-1:0];f&&f.focus()}function vM(e=!0){const t=v.useRef(null),n=o=>{let s=o.querySelector("[data-autofocus]");if(!s){const c=Array.from(o.querySelectorAll(d2));s=c.find(h2)||c.find(nx)||null,!s&&nx(o)&&(s=o)}s&&s.focus({preventScroll:!0})},r=v.useCallback(o=>{e&&o!==null&&t.current!==o&&(o?(setTimeout(()=>{o.getRootNode()&&n(o)}),t.current=o):t.current=null)},[e]);return v.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>n(t.current));const o=s=>{s.key==="Tab"&&t.current&&gM(t.current,s)};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[e]),r}const yM=e=>(e+1)%1e6;function xM(){const[,e]=v.useReducer(yM,0);return e}const bM=kn.useId||(()=>{});function SM(){const e=bM();return e?`mantine-${e.replace(/:/g,"")}`:""}function hr(e){const t=SM(),[n,r]=v.useState(t);return Fc(()=>{r(ip())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function p2(e,t,n){v.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function fd(e,t){if(typeof e=="function")return e(t);typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function wM(...e){const t=new Map;return n=>{if(e.forEach(r=>{const o=fd(r,n);o&&t.set(r,o)}),t.size>0)return()=>{e.forEach(r=>{const o=t.get(r);o&&typeof o=="function"?o():fd(r,null)}),t.clear()}}}function zn(...e){return v.useCallback(wM(...e),e)}function or({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=v.useState(t!==void 0?t:n),c=(d,...f)=>{s(d),r?.(d,...f)};return e!==void 0?[e,r,!0]:[o,c,!1]}function Za(e,t){const n=t-e+1;return Array.from({length:n},(r,o)=>o+e)}const jh="dots";function jM({total:e,siblings:t=1,boundaries:n=1,page:r,initialPage:o=1,onChange:s}){const c=Math.max(Math.trunc(e),0),[d,f]=or({value:r,onChange:s,defaultValue:o,finalValue:o}),p=j=>{j<=0?f(1):j>c?f(c):f(j)},m=()=>p(d+1),g=()=>p(d-1),y=()=>p(1),b=()=>p(c);return{range:v.useMemo(()=>{if(t*2+3+n*2>=c)return Za(1,c);const C=Math.max(d-t,n),R=Math.min(d+t,c-n),T=C>n+2,E=R<c-(n+1);if(!T&&E){const _=t*2+n+2;return[...Za(1,_),jh,...Za(c-(n-1),c)]}if(T&&!E){const _=n+1+2*t;return[...Za(1,n),jh,...Za(c-_,c)]}return[...Za(1,n),jh,...Za(C,R),jh,...Za(c-n+1,c)]},[c,t,d]),active:d,setPage:p,next:m,previous:g,first:y,last:b}}function nb(e,t){return c2("(prefers-reduced-motion: reduce)",e,t)}function CM(e,t){if(!e||!t)return!1;if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n+=1)if(!aM(e[n],t[n]))return!1;return!0}function EM(e){const t=v.useRef([]),n=v.useRef(0);return CM(t.current,e)||(t.current=e,n.current+=1),[n.current]}function TM(e,t){v.useEffect(e,EM(t))}function Hc(e=!1,t={}){const[n,r]=v.useState(e),o=v.useCallback(()=>{r(d=>d||(t.onOpen?.(),!0))},[t.onOpen]),s=v.useCallback(()=>{r(d=>d&&(t.onClose?.(),!1))},[t.onClose]),c=v.useCallback(()=>{n?s():o()},[s,o,n]);return[n,{open:o,close:s,toggle:c}]}function RM(e,t,n={autoInvoke:!1}){const r=v.useRef(null),o=v.useCallback((...c)=>{r.current||(r.current=window.setTimeout(()=>{e(c),r.current=null},t))},[t]),s=v.useCallback(()=>{r.current&&(window.clearTimeout(r.current),r.current=null)},[]);return v.useEffect(()=>(n.autoInvoke&&o(),s),[s,o]),{start:o,clear:s}}function _M(e,t,n){const r=v.useRef(null),o=v.useRef(null);return v.useEffect(()=>{const s=typeof n=="function"?n():n;return(s||o.current)&&(r.current=new MutationObserver(e),r.current.observe(s||o.current,t)),()=>{r.current?.disconnect()}},[e,t]),o}function DM(){const[e,t]=v.useState(!1);return v.useEffect(()=>t(!0),[]),e}var AM={};function m2(){return typeof process<"u"&&AM?"production":"development"}function $p(e){const t=kn.version;return typeof kn.version!="string"||t.startsWith("18.")?e?.ref:e?.props?.ref}function g2(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=g2(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function $t(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=g2(e))&&(r&&(r+=" "),r+=t);return r}const kM={};function PM(e){const t={};return e.forEach(n=>{Object.entries(n).forEach(([r,o])=>{t[r]?t[r]=$t(t[r],o):t[r]=o})}),t}function Up({theme:e,classNames:t,props:n,stylesCtx:r}){const s=(Array.isArray(t)?t:[t]).map(c=>typeof c=="function"?c(e,n,r):c||kM);return PM(s)}function op({theme:e,styles:t,props:n,stylesCtx:r}){return(Array.isArray(t)?t:[t]).reduce((s,c)=>typeof c=="function"?{...s,...c(e,n,r)}:{...s,...c},{})}const rb=v.createContext(null);function xa(){const e=v.useContext(rb);if(!e)throw new Error("[@mantine/core] MantineProvider was not found in tree");return e}function NM(){return xa().cssVariablesResolver}function OM(){return xa().classNamesPrefix}function Bp(){return xa().getStyleNonce}function MM(){return xa().withStaticClasses}function LM(){return xa().headless}function IM(){return xa().stylesTransform?.sx}function zM(){return xa().stylesTransform?.styles}function Vp(){return xa().env||"default"}function $M(e){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(e)}function UM(e){let t=e.replace("#","");if(t.length===3){const c=t.split("");t=[c[0],c[0],c[1],c[1],c[2],c[2]].join("")}if(t.length===8){const c=parseInt(t.slice(6,8),16)/255;return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16),a:c}}const n=parseInt(t,16),r=n>>16&255,o=n>>8&255,s=n&255;return{r,g:o,b:s,a:1}}function BM(e){const[t,n,r,o]=e.replace(/[^0-9,./]/g,"").split(/[/,]/).map(Number);return{r:t,g:n,b:r,a:o===void 0?1:o}}function VM(e){const t=/^hsla?\(\s*(\d+)\s*,\s*(\d+%)\s*,\s*(\d+%)\s*(,\s*(0?\.\d+|\d+(\.\d+)?))?\s*\)$/i,n=e.match(t);if(!n)return{r:0,g:0,b:0,a:1};const r=parseInt(n[1],10),o=parseInt(n[2],10)/100,s=parseInt(n[3],10)/100,c=n[5]?parseFloat(n[5]):void 0,d=(1-Math.abs(2*s-1))*o,f=r/60,p=d*(1-Math.abs(f%2-1)),m=s-d/2;let g,y,b;return f>=0&&f<1?(g=d,y=p,b=0):f>=1&&f<2?(g=p,y=d,b=0):f>=2&&f<3?(g=0,y=d,b=p):f>=3&&f<4?(g=0,y=p,b=d):f>=4&&f<5?(g=p,y=0,b=d):(g=d,y=0,b=p),{r:Math.round((g+m)*255),g:Math.round((y+m)*255),b:Math.round((b+m)*255),a:c||1}}function ib(e){return $M(e)?UM(e):e.startsWith("rgb")?BM(e):e.startsWith("hsl")?VM(e):{r:0,g:0,b:0,a:1}}function Ch(e,t){if(e.startsWith("var("))return`color-mix(in srgb, ${e}, black ${t*100}%)`;const{r:n,g:r,b:o,a:s}=ib(e),c=1-t,d=f=>Math.round(f*c);return`rgba(${d(n)}, ${d(r)}, ${d(o)}, ${s})`}function hd(e,t){return typeof e.primaryShade=="number"?e.primaryShade:t==="dark"?e.primaryShade.dark:e.primaryShade.light}function ly(e){return e<=.03928?e/12.92:((e+.055)/1.055)**2.4}function FM(e){const t=e.match(/oklch\((.*?)%\s/);return t?parseFloat(t[1]):null}function HM(e){if(e.startsWith("oklch("))return(FM(e)||0)/100;const{r:t,g:n,b:r}=ib(e),o=t/255,s=n/255,c=r/255,d=ly(o),f=ly(s),p=ly(c);return .2126*d+.7152*f+.0722*p}function Yu(e,t=.179){return e.startsWith("var(")?!1:HM(e)>t}function ci({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:Yu(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:Yu(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:Yu(e==="white"?t.white:t.black,t.luminanceThreshold),variable:`--mantine-color-${e}`};const[r,o]=e.split("."),s=o?Number(o):void 0,c=r in t.colors;if(c){const d=s!==void 0?t.colors[r][s]:t.colors[r][hd(t,n||"light")];return{color:r,value:d,shade:s,isThemeColor:c,isLight:Yu(d,t.luminanceThreshold),variable:o?`--mantine-color-${r}-${s}`:`--mantine-color-${r}-filled`}}return{color:e,value:e,isThemeColor:c,isLight:Yu(e,t.luminanceThreshold),shade:s,variable:void 0}}function Qt(e,t){const n=ci({color:e||t.primaryColor,theme:t});return n.variable?`var(${n.variable})`:e}function rx(e,t){const n={from:e?.from||t.defaultGradient.from,to:e?.to||t.defaultGradient.to,deg:e?.deg??t.defaultGradient.deg??0},r=Qt(n.from,t),o=Qt(n.to,t);return`linear-gradient(${n.deg}deg, ${r} 0%, ${o} 100%)`}function Ri(e,t){if(typeof e!="string"||t>1||t<0)return"rgba(0, 0, 0, 1)";if(e.startsWith("var(")){const s=(1-t)*100;return`color-mix(in srgb, ${e}, transparent ${s}%)`}if(e.startsWith("oklch"))return e.includes("/")?e.replace(/\/\s*[\d.]+\s*\)/,`/ ${t})`):e.replace(")",` / ${t})`);const{r:n,g:r,b:o}=ib(e);return`rgba(${n}, ${r}, ${o}, ${t})`}const fc=Ri,qM=({color:e,theme:t,variant:n,gradient:r,autoContrast:o})=>{const s=ci({color:e,theme:t}),c=typeof o=="boolean"?o:t.autoContrast;if(n==="none")return{background:"transparent",hover:"transparent",color:"inherit",border:"none"};if(n==="filled"){const d=c&&s.isLight?"var(--mantine-color-black)":"var(--mantine-color-white)";return s.isThemeColor?s.shade===void 0?{background:`var(--mantine-color-${e}-filled)`,hover:`var(--mantine-color-${e}-filled-hover)`,color:d,border:`${le(1)} solid transparent`}:{background:`var(--mantine-color-${s.color}-${s.shade})`,hover:`var(--mantine-color-${s.color}-${s.shade===9?8:s.shade+1})`,color:d,border:`${le(1)} solid transparent`}:{background:e,hover:Ch(e,.1),color:d,border:`${le(1)} solid transparent`}}if(n==="light"){if(s.isThemeColor){if(s.shade===void 0)return{background:`var(--mantine-color-${e}-light)`,hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${le(1)} solid transparent`};const d=t.colors[s.color][s.shade];return{background:Ri(d,.1),hover:Ri(d,.12),color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${le(1)} solid transparent`}}return{background:Ri(e,.1),hover:Ri(e,.12),color:e,border:`${le(1)} solid transparent`}}if(n==="outline")return s.isThemeColor?s.shade===void 0?{background:"transparent",hover:`var(--mantine-color-${e}-outline-hover)`,color:`var(--mantine-color-${e}-outline)`,border:`${le(1)} solid var(--mantine-color-${e}-outline)`}:{background:"transparent",hover:Ri(t.colors[s.color][s.shade],.05),color:`var(--mantine-color-${s.color}-${s.shade})`,border:`${le(1)} solid var(--mantine-color-${s.color}-${s.shade})`}:{background:"transparent",hover:Ri(e,.05),color:e,border:`${le(1)} solid ${e}`};if(n==="subtle"){if(s.isThemeColor){if(s.shade===void 0)return{background:"transparent",hover:`var(--mantine-color-${e}-light-hover)`,color:`var(--mantine-color-${e}-light-color)`,border:`${le(1)} solid transparent`};const d=t.colors[s.color][s.shade];return{background:"transparent",hover:Ri(d,.12),color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${le(1)} solid transparent`}}return{background:"transparent",hover:Ri(e,.12),color:e,border:`${le(1)} solid transparent`}}return n==="transparent"?s.isThemeColor?s.shade===void 0?{background:"transparent",hover:"transparent",color:`var(--mantine-color-${e}-light-color)`,border:`${le(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${le(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:e,border:`${le(1)} solid transparent`}:n==="white"?s.isThemeColor?s.shade===void 0?{background:"var(--mantine-color-white)",hover:Ch(t.white,.01),color:`var(--mantine-color-${e}-filled)`,border:`${le(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:Ch(t.white,.01),color:`var(--mantine-color-${s.color}-${s.shade})`,border:`${le(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:Ch(t.white,.01),color:e,border:`${le(1)} solid transparent`}:n==="gradient"?{background:rx(r,t),hover:rx(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:`${le(1)} solid var(--mantine-color-default-border)`}:{}},GM={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"]},UC="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",ob={scale:1,fontSmoothing:!0,focusRing:"auto",white:"#fff",black:"#000",colors:GM,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:qM,autoContrast:!1,luminanceThreshold:.3,fontFamily:UC,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:UC,fontWeight:"700",textWrap:"wrap",sizes:{h1:{fontSize:le(34),lineHeight:"1.3"},h2:{fontSize:le(26),lineHeight:"1.35"},h3:{fontSize:le(22),lineHeight:"1.4"},h4:{fontSize:le(18),lineHeight:"1.45"},h5:{fontSize:le(16),lineHeight:"1.5"},h6:{fontSize:le(14),lineHeight:"1.5"}}},fontSizes:{xs:le(12),sm:le(14),md:le(16),lg:le(18),xl:le(20)},lineHeights:{xs:"1.4",sm:"1.45",md:"1.55",lg:"1.6",xl:"1.65"},radius:{xs:le(2),sm:le(4),md:le(8),lg:le(16),xl:le(32)},spacing:{xs:le(10),sm:le(12),md:le(16),lg:le(20),xl:le(32)},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},shadows:{xs:`0 ${le(1)} ${le(3)} rgba(0, 0, 0, 0.05), 0 ${le(1)} ${le(2)} rgba(0, 0, 0, 0.1)`,sm:`0 ${le(1)} ${le(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${le(10)} ${le(15)} ${le(-5)}, rgba(0, 0, 0, 0.04) 0 ${le(7)} ${le(7)} ${le(-5)}`,md:`0 ${le(1)} ${le(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${le(20)} ${le(25)} ${le(-5)}, rgba(0, 0, 0, 0.04) 0 ${le(10)} ${le(10)} ${le(-5)}`,lg:`0 ${le(1)} ${le(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${le(28)} ${le(23)} ${le(-7)}, rgba(0, 0, 0, 0.04) 0 ${le(12)} ${le(12)} ${le(-7)}`,xl:`0 ${le(1)} ${le(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${le(36)} ${le(28)} ${le(-7)}, rgba(0, 0, 0, 0.04) 0 ${le(17)} ${le(17)} ${le(-7)}`},other:{},components:{}};function BC(e){return e==="auto"||e==="dark"||e==="light"}function WM({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 BC(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&&BC(r.newValue)&&n(r.newValue)},window.addEventListener("storage",t)},unsubscribe:()=>{window.removeEventListener("storage",t)},clear:()=>{window.localStorage.removeItem(e)}}}const QM="[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color",VC="[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }";function cy(e){return e<0||e>9?!1:parseInt(e.toString(),10)===e}function FC(e){if(!(e.primaryColor in e.colors))throw new Error(QM);if(typeof e.primaryShade=="object"&&(!cy(e.primaryShade.dark)||!cy(e.primaryShade.light)))throw new Error(VC);if(typeof e.primaryShade=="number"&&!cy(e.primaryShade))throw new Error(VC)}function YM(e,t){if(!t)return FC(e),e;const n=Jx(e,t);return t.fontFamily&&!t.headings?.fontFamily&&(n.headings.fontFamily=t.fontFamily),FC(n),n}const ab=v.createContext(null),KM=()=>v.useContext(ab)||ob;function jn(){const e=v.useContext(ab);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 v2({theme:e,children:t,inherit:n=!0}){const r=KM(),o=v.useMemo(()=>YM(n?r:ob,e),[e,r,n]);return a.jsx(ab.Provider,{value:o,children:t})}v2.displayName="@mantine/core/MantineThemeProvider";function XM(){const e=jn(),t=Bp(),n=cn(e.breakpoints).reduce((r,o)=>{const s=e.breakpoints[o].includes("px"),c=ud(e.breakpoints[o]),d=s?`${c-.1}px`:tp(c-.1),f=s?`${c}px`:tp(c);return`${r}@media (max-width: ${d}) {.mantine-visible-from-${o} {display: none !important;}}@media (min-width: ${f}) {.mantine-hidden-from-${o} {display: none !important;}}`},"");return a.jsx("style",{"data-mantine-styles":"classes",nonce:t?.(),dangerouslySetInnerHTML:{__html:n}})}function uy(e){return Object.entries(e).map(([t,n])=>`${t}: ${n};`).join("")}function Ku(e,t){return(Array.isArray(e)?e:[e]).reduce((r,o)=>`${o}{${r}}`,t)}function JM(e,t){const n=uy(e.variables),r=n?Ku(t,n):"",o=uy(e.dark),s=uy(e.light),c=o?Ku(t===":host"?`${t}([data-mantine-color-scheme="dark"])`:`${t}[data-mantine-color-scheme="dark"]`,o):"",d=s?Ku(t===":host"?`${t}([data-mantine-color-scheme="light"])`:`${t}[data-mantine-color-scheme="light"]`,s):"";return`${r}
42
-
43
- ${c}
44
-
45
- ${d}`}function ba({color:e,theme:t,autoContrast:n}){return(typeof n=="boolean"?n:t.autoContrast)&&ci({color:e||t.primaryColor,theme:t}).isLight?"var(--mantine-color-black)":"var(--mantine-color-white)"}function HC(e,t){return ba({color:e.colors[e.primaryColor][hd(e,t)],theme:e,autoContrast:null})}function Eh({theme:e,color:t,colorScheme:n,name:r=t,withColorValues:o=!0}){if(!e.colors[t])return{};if(n==="light"){const d=hd(e,"light"),f={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-filled)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${d})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${d===9?8:d+1})`,[`--mantine-color-${r}-light`]:fc(e.colors[t][d],.1),[`--mantine-color-${r}-light-hover`]:fc(e.colors[t][d],.12),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-${d})`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${d})`,[`--mantine-color-${r}-outline-hover`]:fc(e.colors[t][d],.05)};return o?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...f}:f}const s=hd(e,"dark"),c={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-4)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${s})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${s===9?8:s+1})`,[`--mantine-color-${r}-light`]:fc(e.colors[t][Math.max(0,s-2)],.15),[`--mantine-color-${r}-light-hover`]:fc(e.colors[t][Math.max(0,s-2)],.2),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-${Math.max(s-5,0)})`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${Math.max(s-4,0)})`,[`--mantine-color-${r}-outline-hover`]:fc(e.colors[t][Math.max(s-4,0)],.05)};return o?{[`--mantine-color-${r}-0`]:e.colors[t][0],[`--mantine-color-${r}-1`]:e.colors[t][1],[`--mantine-color-${r}-2`]:e.colors[t][2],[`--mantine-color-${r}-3`]:e.colors[t][3],[`--mantine-color-${r}-4`]:e.colors[t][4],[`--mantine-color-${r}-5`]:e.colors[t][5],[`--mantine-color-${r}-6`]:e.colors[t][6],[`--mantine-color-${r}-7`]:e.colors[t][7],[`--mantine-color-${r}-8`]:e.colors[t][8],[`--mantine-color-${r}-9`]:e.colors[t][9],...c}:c}function ZM(e){return!!e&&typeof e=="object"&&"mantine-virtual-color"in e}function hc(e,t,n){cn(t).forEach(r=>Object.assign(e,{[`--mantine-${n}-${r}`]:t[r]}))}const y2=e=>{const t=hd(e,"light"),n=e.defaultRadius in e.radius?e.radius[e.defaultRadius]:le(e.defaultRadius),r={variables:{"--mantine-z-index-app":"100","--mantine-z-index-modal":"200","--mantine-z-index-popover":"300","--mantine-z-index-overlay":"400","--mantine-z-index-max":"9999","--mantine-scale":e.scale.toString(),"--mantine-cursor-type":e.cursorType,"--mantine-webkit-font-smoothing":e.fontSmoothing?"antialiased":"unset","--mantine-moz-font-smoothing":e.fontSmoothing?"grayscale":"unset","--mantine-color-white":e.white,"--mantine-color-black":e.black,"--mantine-line-height":e.lineHeights.md,"--mantine-font-family":e.fontFamily,"--mantine-font-family-monospace":e.fontFamilyMonospace,"--mantine-font-family-headings":e.headings.fontFamily,"--mantine-heading-font-weight":e.headings.fontWeight,"--mantine-heading-text-wrap":e.headings.textWrap,"--mantine-radius-default":n,"--mantine-primary-color-filled":`var(--mantine-color-${e.primaryColor}-filled)`,"--mantine-primary-color-filled-hover":`var(--mantine-color-${e.primaryColor}-filled-hover)`,"--mantine-primary-color-light":`var(--mantine-color-${e.primaryColor}-light)`,"--mantine-primary-color-light-hover":`var(--mantine-color-${e.primaryColor}-light-hover)`,"--mantine-primary-color-light-color":`var(--mantine-color-${e.primaryColor}-light-color)`},light:{"--mantine-color-scheme":"light","--mantine-primary-color-contrast":HC(e,"light"),"--mantine-color-bright":"var(--mantine-color-black)","--mantine-color-text":e.black,"--mantine-color-body":e.white,"--mantine-color-error":"var(--mantine-color-red-6)","--mantine-color-placeholder":"var(--mantine-color-gray-5)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-${t})`,"--mantine-color-default":"var(--mantine-color-white)","--mantine-color-default-hover":"var(--mantine-color-gray-0)","--mantine-color-default-color":"var(--mantine-color-black)","--mantine-color-default-border":"var(--mantine-color-gray-4)","--mantine-color-dimmed":"var(--mantine-color-gray-6)","--mantine-color-disabled":"var(--mantine-color-gray-2)","--mantine-color-disabled-color":"var(--mantine-color-gray-5)","--mantine-color-disabled-border":"var(--mantine-color-gray-3)"},dark:{"--mantine-color-scheme":"dark","--mantine-primary-color-contrast":HC(e,"dark"),"--mantine-color-bright":"var(--mantine-color-white)","--mantine-color-text":"var(--mantine-color-dark-0)","--mantine-color-body":"var(--mantine-color-dark-7)","--mantine-color-error":"var(--mantine-color-red-8)","--mantine-color-placeholder":"var(--mantine-color-dark-3)","--mantine-color-anchor":`var(--mantine-color-${e.primaryColor}-4)`,"--mantine-color-default":"var(--mantine-color-dark-6)","--mantine-color-default-hover":"var(--mantine-color-dark-5)","--mantine-color-default-color":"var(--mantine-color-white)","--mantine-color-default-border":"var(--mantine-color-dark-4)","--mantine-color-dimmed":"var(--mantine-color-dark-2)","--mantine-color-disabled":"var(--mantine-color-dark-6)","--mantine-color-disabled-color":"var(--mantine-color-dark-3)","--mantine-color-disabled-border":"var(--mantine-color-dark-4)"}};hc(r.variables,e.breakpoints,"breakpoint"),hc(r.variables,e.spacing,"spacing"),hc(r.variables,e.fontSizes,"font-size"),hc(r.variables,e.lineHeights,"line-height"),hc(r.variables,e.shadows,"shadow"),hc(r.variables,e.radius,"radius"),e.colors[e.primaryColor].forEach((s,c)=>{r.variables[`--mantine-primary-color-${c}`]=`var(--mantine-color-${e.primaryColor}-${c})`}),cn(e.colors).forEach(s=>{const c=e.colors[s];if(ZM(c)){Object.assign(r.light,Eh({theme:e,name:c.name,color:c.light,colorScheme:"light",withColorValues:!0})),Object.assign(r.dark,Eh({theme:e,name:c.name,color:c.dark,colorScheme:"dark",withColorValues:!0}));return}c.forEach((d,f)=>{r.variables[`--mantine-color-${s}-${f}`]=d}),Object.assign(r.light,Eh({theme:e,color:s,colorScheme:"light",withColorValues:!1})),Object.assign(r.dark,Eh({theme:e,color:s,colorScheme:"dark",withColorValues:!1}))});const o=e.headings.sizes;return cn(o).forEach(s=>{r.variables[`--mantine-${s}-font-size`]=o[s].fontSize,r.variables[`--mantine-${s}-line-height`]=o[s].lineHeight,r.variables[`--mantine-${s}-font-weight`]=o[s].fontWeight||e.headings.fontWeight}),r};function e4({theme:e,generator:t}){const n=y2(e),r=t?.(e);return r?Jx(n,r):n}const dy=y2(ob);function t4(e){const t={variables:{},light:{},dark:{}};return cn(e.variables).forEach(n=>{dy.variables[n]!==e.variables[n]&&(t.variables[n]=e.variables[n])}),cn(e.light).forEach(n=>{dy.light[n]!==e.light[n]&&(t.light[n]=e.light[n])}),cn(e.dark).forEach(n=>{dy.dark[n]!==e.dark[n]&&(t.dark[n]=e.dark[n])}),t}function n4(e){return`
46
- ${e}[data-mantine-color-scheme="dark"] { --mantine-color-scheme: dark; }
47
- ${e}[data-mantine-color-scheme="light"] { --mantine-color-scheme: light; }
48
- `}function x2({cssVariablesSelector:e,deduplicateCssVariables:t}){const n=jn(),r=Bp(),o=NM(),s=e4({theme:n,generator:o}),c=e===":root"&&t,d=c?t4(s):s,f=JM(d,e);return f?a.jsx("style",{"data-mantine-styles":!0,nonce:r?.(),dangerouslySetInnerHTML:{__html:`${f}${c?"":n4(e)}`}}):null}x2.displayName="@mantine/CssVariables";function pc(e,t){const n=typeof window<"u"&&"matchMedia"in window&&window.matchMedia("(prefers-color-scheme: dark)")?.matches,r=e!=="auto"?e:n?"dark":"light";t()?.setAttribute("data-mantine-color-scheme",r)}function r4({manager:e,defaultColorScheme:t,getRootElement:n,forceColorScheme:r}){const o=v.useRef(null),[s,c]=v.useState(()=>e.get(t)),d=r||s,f=v.useCallback(m=>{r||(pc(m,n),c(m),e.set(m))},[e.set,d,r]),p=v.useCallback(()=>{c(t),pc(t,n),e.clear()},[e.clear,t]);return v.useEffect(()=>(e.subscribe(f),e.unsubscribe),[e.subscribe,e.unsubscribe]),Fc(()=>{pc(e.get(t),n)},[]),v.useEffect(()=>{if(r)return pc(r,n),()=>{};r===void 0&&pc(s,n),typeof window<"u"&&"matchMedia"in window&&(o.current=window.matchMedia("(prefers-color-scheme: dark)"));const m=g=>{s==="auto"&&pc(g.matches?"dark":"light",n)};return o.current?.addEventListener("change",m),()=>o.current?.removeEventListener("change",m)},[s,r]),{colorScheme:d,setColorScheme:f,clearColorScheme:p}}function i4({respectReducedMotion:e,getRootElement:t}){Fc(()=>{e&&t()?.setAttribute("data-respect-reduced-motion","true")},[e])}function b2({theme:e,children:t,getStyleNonce:n,withStaticClasses:r=!0,withGlobalClasses:o=!0,deduplicateCssVariables:s=!0,withCssVariables:c=!0,cssVariablesSelector:d=":root",classNamesPrefix:f="mantine",colorSchemeManager:p=WM(),defaultColorScheme:m="light",getRootElement:g=()=>document.documentElement,cssVariablesResolver:y,forceColorScheme:b,stylesTransform:w,env:j}){const{colorScheme:C,setColorScheme:R,clearColorScheme:T}=r4({defaultColorScheme:m,forceColorScheme:b,manager:p,getRootElement:g});return i4({respectReducedMotion:e?.respectReducedMotion||!1,getRootElement:g}),a.jsx(rb.Provider,{value:{colorScheme:C,setColorScheme:R,clearColorScheme:T,getRootElement:g,classNamesPrefix:f,getStyleNonce:n,cssVariablesResolver:y,cssVariablesSelector:d,withStaticClasses:r,stylesTransform:w,env:j},children:a.jsxs(v2,{theme:e,children:[c&&a.jsx(x2,{cssVariablesSelector:d,deduplicateCssVariables:s}),o&&a.jsx(XM,{}),t]})})}b2.displayName="@mantine/core/MantineProvider";function vl({classNames:e,styles:t,props:n,stylesCtx:r}){const o=jn();return{resolvedClassNames:Up({theme:o,classNames:e,props:n,stylesCtx:r||void 0}),resolvedStyles:op({theme:o,styles:t,props:n,stylesCtx:r||void 0})}}const o4={always:"mantine-focus-always",auto:"mantine-focus-auto",never:"mantine-focus-never"};function a4({theme:e,options:t,unstyled:n}){return $t(t?.focusable&&!n&&(e.focusClassName||o4[e.focusRing]),t?.active&&!n&&e.activeClassName)}function s4({selector:e,stylesCtx:t,options:n,props:r,theme:o}){return Up({theme:o,classNames:n?.classNames,props:n?.props||r,stylesCtx:t})[e]}function qC({selector:e,stylesCtx:t,theme:n,classNames:r,props:o}){return Up({theme:n,classNames:r,props:o,stylesCtx:t})[e]}function l4({rootSelector:e,selector:t,className:n}){return e===t?n:void 0}function c4({selector:e,classes:t,unstyled:n}){return n?void 0:t[e]}function u4({themeName:e,classNamesPrefix:t,selector:n,withStaticClass:r}){return r===!1?[]:e.map(o=>`${t}-${o}-${n}`)}function d4({themeName:e,theme:t,selector:n,props:r,stylesCtx:o}){return e.map(s=>Up({theme:t,classNames:t.components[s]?.classNames,props:r,stylesCtx:o})?.[n])}function f4({options:e,classes:t,selector:n,unstyled:r}){return e?.variant&&!r?t[`${n}--${e.variant}`]:void 0}function h4({theme:e,options:t,themeName:n,selector:r,classNamesPrefix:o,classNames:s,classes:c,unstyled:d,className:f,rootSelector:p,props:m,stylesCtx:g,withStaticClasses:y,headless:b,transformedStyles:w}){return $t(a4({theme:e,options:t,unstyled:d||b}),d4({theme:e,themeName:n,selector:r,props:m,stylesCtx:g}),f4({options:t,classes:c,selector:r,unstyled:d}),qC({selector:r,stylesCtx:g,theme:e,classNames:s,props:m}),qC({selector:r,stylesCtx:g,theme:e,classNames:w,props:m}),s4({selector:r,stylesCtx:g,options:t,props:m,theme:e}),l4({rootSelector:p,selector:r,className:f}),c4({selector:r,classes:c,unstyled:d||b}),y&&!b&&u4({themeName:n,classNamesPrefix:o,selector:r,withStaticClass:t?.withStaticClass}),t?.className)}function p4({theme:e,themeName:t,props:n,stylesCtx:r,selector:o}){return t.map(s=>op({theme:e,styles:e.components[s]?.styles,props:n,stylesCtx:r})[o]).reduce((s,c)=>({...s,...c}),{})}function ix({style:e,theme:t}){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...ix({style:r,theme:t})}),{}):typeof e=="function"?e(t):e??{}}function m4(e){return e.reduce((t,n)=>(n&&Object.keys(n).forEach(r=>{t[r]={...t[r],...hs(n[r])}}),t),{})}function g4({vars:e,varsResolver:t,theme:n,props:r,stylesCtx:o,selector:s,themeName:c,headless:d}){return m4([d?{}:t?.(n,r,o),...c.map(f=>n.components?.[f]?.vars?.(n,r,o)),e?.(n,r,o)])?.[s]}function v4({theme:e,themeName:t,selector:n,options:r,props:o,stylesCtx:s,rootSelector:c,styles:d,style:f,vars:p,varsResolver:m,headless:g,withStylesTransform:y}){return{...!y&&p4({theme:e,themeName:t,props:o,stylesCtx:s,selector:n}),...!y&&op({theme:e,styles:d,props:o,stylesCtx:s})[n],...!y&&op({theme:e,styles:r?.styles,props:r?.props||o,stylesCtx:s})[n],...g4({theme:e,props:o,stylesCtx:s,vars:p,varsResolver:m,selector:n,themeName:t,headless:g}),...c===n?ix({style:f,theme:e}):null,...ix({style:r?.style,theme:e})}}function y4({props:e,stylesCtx:t,themeName:n}){const r=jn(),o=zM()?.();return{getTransformedStyles:c=>o?[...c.map(f=>o(f,{props:e,theme:r,ctx:t})),...n.map(f=>o(r.components[f]?.styles,{props:e,theme:r,ctx:t}))].filter(Boolean):[],withStylesTransform:!!o}}function ze({name:e,classes:t,props:n,stylesCtx:r,className:o,style:s,rootSelector:c="root",unstyled:d,classNames:f,styles:p,vars:m,varsResolver:g,attributes:y}){const b=jn(),w=OM(),j=MM(),C=LM(),R=(Array.isArray(e)?e:[e]).filter(_=>_),{withStylesTransform:T,getTransformedStyles:E}=y4({props:n,stylesCtx:r,themeName:R});return(_,k)=>({className:h4({theme:b,options:k,themeName:R,selector:_,classNamesPrefix:w,classNames:f,classes:t,unstyled:d,className:o,rootSelector:c,props:n,stylesCtx:r,withStaticClasses:j,headless:C,transformedStyles:E([k?.styles,p])}),style:v4({theme:b,themeName:R,selector:_,options:k,props:n,stylesCtx:r,rootSelector:c,styles:p,style:s,vars:m,varsResolver:g,headless:C,withStylesTransform:T}),...y?.[_]})}function yl(e,t){return typeof e=="boolean"?e:t.autoContrast}function GC(e){const t=document.createElement("style");return t.setAttribute("data-mantine-styles","inline"),t.innerHTML="*, *::before, *::after {transition: none !important;}",t.setAttribute("data-mantine-disable-transition","true"),e&&t.setAttribute("nonce",e),document.head.appendChild(t),()=>document.querySelectorAll("[data-mantine-disable-transition]").forEach(r=>r.remove())}function x4({keepTransitions:e}={}){const t=v.useRef(rp),n=v.useRef(-1),r=v.useContext(rb),o=Bp(),s=v.useRef(o?.());if(!r)throw new Error("[@mantine/core] MantineProvider was not found in tree");const c=g=>{r.setColorScheme(g),t.current=e?()=>{}:GC(s.current),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t.current?.()},10)},d=()=>{r.clearColorScheme(),t.current=e?()=>{}:GC(s.current),window.clearTimeout(n.current),n.current=window.setTimeout(()=>{t.current?.()},10)},f=dM("light",{getInitialValueInEffect:!1}),p=r.colorScheme==="auto"?f:r.colorScheme,m=v.useCallback(()=>c(p==="light"?"dark":"light"),[c,p]);return v.useEffect(()=>()=>{t.current?.(),window.clearTimeout(n.current)},[]),{colorScheme:r.colorScheme,setColorScheme:c,clearColorScheme:d,toggleColorScheme:m}}function ae(e,t,n){const r=jn(),o=r.components[e]?.defaultProps,s=typeof o=="function"?o(r):o;return{...t,...s,...hs(n)}}function fy(e){return cn(e).reduce((t,n)=>e[n]!==void 0?`${t}${J3(n)}:${e[n]};`:t,"").trim()}function b4({selector:e,styles:t,media:n,container:r}){const o=t?fy(t):"",s=Array.isArray(n)?n.map(d=>`@media${d.query}{${e}{${fy(d.styles)}}}`):[],c=Array.isArray(r)?r.map(d=>`@container ${d.query}{${e}{${fy(d.styles)}}}`):[];return`${o?`${e}{${o}}`:""}${s.join("")}${c.join("")}`.trim()}function xl(e){const t=Bp();return a.jsx("style",{"data-mantine-styles":"inline",nonce:t?.(),dangerouslySetInnerHTML:{__html:b4(e)}})}function Sa(e){const{m:t,mx:n,my:r,mt:o,mb:s,ml:c,mr:d,me:f,ms:p,p:m,px:g,py:y,pt:b,pb:w,pl:j,pr:C,pe:R,ps:T,bd:E,bdrs:_,bg:k,c:L,opacity:A,ff:N,fz:U,fw:B,lts:Q,ta:J,lh:Z,fs:$,tt:W,td:M,w:I,miw:z,maw:F,h:X,mih:O,mah:H,bgsz:oe,bgp:ue,bgr:Se,bga:ge,pos:Pe,top:rt,left:Ce,bottom:ht,right:lt,inset:vt,display:it,flex:wt,hiddenFrom:pt,visibleFrom:It,lightHidden:_e,darkHidden:Ee,sx:Le,...Ne}=e;return{styleProps:hs({m:t,mx:n,my:r,mt:o,mb:s,ml:c,mr:d,me:f,ms:p,p:m,px:g,py:y,pt:b,pb:w,pl:j,pr:C,pe:R,ps:T,bd:E,bg:k,c:L,opacity:A,ff:N,fz:U,fw:B,lts:Q,ta:J,lh:Z,fs:$,tt:W,td:M,w:I,miw:z,maw:F,h:X,mih:O,mah:H,bgsz:oe,bgp:ue,bgr:Se,bga:ge,pos:Pe,top:rt,left:Ce,bottom:ht,right:lt,inset:vt,display:it,flex:wt,bdrs:_,hiddenFrom:pt,visibleFrom:It,lightHidden:_e,darkHidden:Ee,sx:Le}),rest:Ne}}const S4={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},ms:{type:"spacing",property:"marginInlineStart"},me:{type:"spacing",property:"marginInlineEnd"},mx:{type:"spacing",property:"marginInline"},my:{type:"spacing",property:"marginBlock"},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},ps:{type:"spacing",property:"paddingInlineStart"},pe:{type:"spacing",property:"paddingInlineEnd"},px:{type:"spacing",property:"paddingInline"},py:{type:"spacing",property:"paddingBlock"},bd:{type:"border",property:"border"},bdrs:{type:"radius",property:"borderRadius"},bg:{type:"color",property:"background"},c:{type:"textColor",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"fontFamily",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"lineHeight",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"size",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"},flex:{type:"identity",property:"flex"}};function sb(e,t){const n=ci({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 w4(e,t){const n=ci({color:e,theme:t});return n.isThemeColor&&n.shade===void 0?`var(--mantine-color-${n.color}-text)`:sb(e,t)}function j4(e,t){if(typeof e=="number")return le(e);if(typeof e=="string"){const[n,r,...o]=e.split(" ").filter(c=>c.trim()!=="");let s=`${le(n)}`;return r&&(s+=` ${r}`),o.length>0&&(s+=` ${sb(o.join(" "),t)}`),s.trim()}return e}const WC={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 C4(e){return typeof e=="string"&&e in WC?WC[e]:e}const E4=["h1","h2","h3","h4","h5","h6"];function T4(e,t){return typeof e=="string"&&e in t.fontSizes?`var(--mantine-font-size-${e})`:typeof e=="string"&&E4.includes(e)?`var(--mantine-${e}-font-size)`:typeof e=="number"||typeof e=="string"?le(e):e}function R4(e){return e}const _4=["h1","h2","h3","h4","h5","h6"];function D4(e,t){return typeof e=="string"&&e in t.lineHeights?`var(--mantine-line-height-${e})`:typeof e=="string"&&_4.includes(e)?`var(--mantine-${e}-line-height)`:e}function A4(e,t){return typeof e=="string"&&e in t.radius?`var(--mantine-radius-${e})`:typeof e=="number"||typeof e=="string"?le(e):e}function k4(e){return typeof e=="number"?le(e):e}function P4(e,t){if(typeof e=="number")return le(e);if(typeof e=="string"){const n=e.replace("-","");if(!(n in t.spacing))return le(e);const r=`--mantine-spacing-${n}`;return e.startsWith("-")?`calc(var(${r}) * -1)`:`var(${r})`}return e}const hy={color:sb,textColor:w4,fontSize:T4,spacing:P4,radius:A4,identity:R4,size:k4,lineHeight:D4,fontFamily:C4,border:j4};function QC(e){return e.replace("(min-width: ","").replace("em)","")}function N4({media:e,...t}){const r=Object.keys(e).sort((o,s)=>Number(QC(o))-Number(QC(s))).map(o=>({query:o,styles:e[o]}));return{...t,media:r}}function O4(e){if(typeof e!="object"||e===null)return!1;const t=Object.keys(e);return!(t.length===1&&t[0]==="base")}function M4(e){return typeof e=="object"&&e!==null?"base"in e?e.base:void 0:e}function L4(e){return typeof e=="object"&&e!==null?cn(e).filter(t=>t!=="base"):[]}function I4(e,t){return typeof e=="object"&&e!==null&&t in e?e[t]:e}function S2({styleProps:e,data:t,theme:n}){return N4(cn(e).reduce((r,o)=>{if(o==="hiddenFrom"||o==="visibleFrom"||o==="sx")return r;const s=t[o],c=Array.isArray(s.property)?s.property:[s.property],d=M4(e[o]);if(!O4(e[o]))return c.forEach(p=>{r.inlineStyles[p]=hy[s.type](d,n)}),r;r.hasResponsiveStyles=!0;const f=L4(e[o]);return c.forEach(p=>{d!=null&&(r.styles[p]=hy[s.type](d,n)),f.forEach(m=>{const g=`(min-width: ${n.breakpoints[m]})`;r.media[g]={...r.media[g],[p]:hy[s.type](I4(e[o],m),n)}})}),r},{hasResponsiveStyles:!1,styles:{},inlineStyles:{},media:{}}))}function Ad(){return`__m__-${v.useId().replace(/[:«»]/g,"")}`}function w2(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...w2(r,t)}),{}):typeof e=="function"?e(t):e??{}}function j2(e){return e.startsWith("data-")?e:`data-${e}`}function z4(e){return Object.keys(e).reduce((t,n)=>{const r=e[n];return r===void 0||r===""||r===!1||r===null||(t[j2(n)]=e[n]),t},{})}function C2(e){return e?typeof e=="string"?{[j2(e)]:!0}:Array.isArray(e)?[...e].reduce((t,n)=>({...t,...C2(n)}),{}):z4(e):null}function ox(e,t){return Array.isArray(e)?[...e].reduce((n,r)=>({...n,...ox(r,t)}),{}):typeof e=="function"?e(t):e??{}}function $4({theme:e,style:t,vars:n,styleProps:r}){const o=ox(t,e),s=ox(n,e);return{...o,...s,...r}}const E2=v.forwardRef(({component:e,style:t,__vars:n,className:r,variant:o,mod:s,size:c,hiddenFrom:d,visibleFrom:f,lightHidden:p,darkHidden:m,renderRoot:g,__size:y,...b},w)=>{const j=jn(),C=e||"div",{styleProps:R,rest:T}=Sa(b),_=IM()?.()?.(R.sx),k=Ad(),L=S2({styleProps:R,theme:j,data:S4}),A={ref:w,style:$4({theme:j,style:t,vars:n,styleProps:L.inlineStyles}),className:$t(r,_,{[k]:L.hasResponsiveStyles,"mantine-light-hidden":p,"mantine-dark-hidden":m,[`mantine-hidden-from-${d}`]:d,[`mantine-visible-from-${f}`]:f}),"data-variant":o,"data-size":a2(c)?void 0:c||void 0,size:y,...C2(s),...T};return a.jsxs(a.Fragment,{children:[L.hasResponsiveStyles&&a.jsx(xl,{selector:`.${k}`,styles:L.styles,media:L.media}),typeof g=="function"?g(A):a.jsx(C,{...A})]})});E2.displayName="@mantine/core/Box";const de=E2;function T2(e){return e}function U4(e){const t=e;return n=>{const r=v.forwardRef((o,s)=>a.jsx(t,{...n,...o,ref:s}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r}}function be(e){const t=v.forwardRef(e);return t.extend=T2,t.withProps=n=>{const r=v.forwardRef((o,s)=>a.jsx(t,{...n,...o,ref:s}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r},t}function pr(e){const t=v.forwardRef(e);return t.withProps=n=>{const r=v.forwardRef((o,s)=>a.jsx(t,{...n,...o,ref:s}));return r.extend=t.extend,r.displayName=`WithProps(${t.displayName})`,r},t.extend=T2,t}const B4=v.createContext({dir:"ltr",toggleDirection:()=>{},setDirection:()=>{}});function ps(){return v.useContext(B4)}var py={exports:{}},gr={};var YC;function V4(){if(YC)return gr;YC=1;var e=Xx();function t(f){var p="https://react.dev/errors/"+f;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var m=2;m<arguments.length;m++)p+="&args[]="+encodeURIComponent(arguments[m])}return"Minified React error #"+f+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(t(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},o=Symbol.for("react.portal");function s(f,p,m){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:f,containerInfo:p,implementation:m}}var c=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(f,p){if(f==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return gr.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,gr.createPortal=function(f,p){var m=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(t(299));return s(f,p,null,m)},gr.flushSync=function(f){var p=c.T,m=r.p;try{if(c.T=null,r.p=2,f)return f()}finally{c.T=p,r.p=m,r.d.f()}},gr.preconnect=function(f,p){typeof f=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,r.d.C(f,p))},gr.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},gr.preinit=function(f,p){if(typeof f=="string"&&p&&typeof p.as=="string"){var m=p.as,g=d(m,p.crossOrigin),y=typeof p.integrity=="string"?p.integrity:void 0,b=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;m==="style"?r.d.S(f,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:y,fetchPriority:b}):m==="script"&&r.d.X(f,{crossOrigin:g,integrity:y,fetchPriority:b,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},gr.preinitModule=function(f,p){if(typeof f=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var m=d(p.as,p.crossOrigin);r.d.M(f,{crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&r.d.M(f)},gr.preload=function(f,p){if(typeof f=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var m=p.as,g=d(m,p.crossOrigin);r.d.L(f,m,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},gr.preloadModule=function(f,p){if(typeof f=="string")if(p){var m=d(p.as,p.crossOrigin);r.d.m(f,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:m,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else r.d.m(f)},gr.requestFormReset=function(f){r.d.r(f)},gr.unstable_batchedUpdates=function(f,p){return f(p)},gr.useFormState=function(f,p,m){return c.H.useFormState(f,p,m)},gr.useFormStatus=function(){return c.H.useHostTransitionStatus()},gr.version="19.2.0",gr}var KC;function R2(){if(KC)return py.exports;KC=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),py.exports=V4(),py.exports}var lb=R2();const id=Lp(lb);function Fp(){return typeof window<"u"}function qc(e){return _2(e)?(e.nodeName||"").toLowerCase():"#document"}function Wr(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Oo(e){var t;return(t=(_2(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function _2(e){return Fp()?e instanceof Node||e instanceof Wr(e).Node:!1}function bn(e){return Fp()?e instanceof Element||e instanceof Wr(e).Element:!1}function ui(e){return Fp()?e instanceof HTMLElement||e instanceof Wr(e).HTMLElement:!1}function ax(e){return!Fp()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Wr(e).ShadowRoot}const F4=new Set(["inline","contents"]);function kd(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=ki(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!F4.has(o)}const H4=new Set(["table","td","th"]);function q4(e){return H4.has(qc(e))}const G4=[":popover-open",":modal"];function Hp(e){return G4.some(t=>{try{return e.matches(t)}catch{return!1}})}const W4=["transform","translate","scale","rotate","perspective"],Q4=["transform","translate","scale","rotate","perspective","filter"],Y4=["paint","layout","strict","content"];function cb(e){const t=qp(),n=bn(e)?ki(e):e;return W4.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Q4.some(r=>(n.willChange||"").includes(r))||Y4.some(r=>(n.contain||"").includes(r))}function K4(e){let t=ha(e);for(;ui(t)&&!da(t);){if(cb(t))return t;if(Hp(t))return null;t=ha(t)}return null}function qp(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const X4=new Set(["html","body","#document"]);function da(e){return X4.has(qc(e))}function ki(e){return Wr(e).getComputedStyle(e)}function Gp(e){return bn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ha(e){if(qc(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ax(e)&&e.host||Oo(e);return ax(t)?t.host:t}function D2(e){const t=ha(e);return da(t)?e.ownerDocument?e.ownerDocument.body:e.body:ui(t)&&kd(t)?t:D2(t)}function fa(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=D2(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),c=Wr(o);if(s){const d=sx(c);return t.concat(c,c.visualViewport||[],kd(o)?o:[],d&&n?fa(d):[])}return t.concat(o,fa(o,[],n))}function sx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const J4=["top","right","bottom","left"],Ji=Math.min,xr=Math.max,ap=Math.round,Th=Math.floor,So=e=>({x:e,y:e}),Z4={left:"right",right:"left",bottom:"top",top:"bottom"},e5={start:"end",end:"start"};function lx(e,t,n){return xr(e,Ji(t,n))}function Ro(e,t){return typeof e=="function"?e(t):e}function Zi(e){return e.split("-")[0]}function Gc(e){return e.split("-")[1]}function ub(e){return e==="x"?"y":"x"}function db(e){return e==="y"?"height":"width"}const t5=new Set(["top","bottom"]);function Yi(e){return t5.has(Zi(e))?"y":"x"}function fb(e){return ub(Yi(e))}function n5(e,t,n){n===void 0&&(n=!1);const r=Gc(e),o=fb(e),s=db(o);let c=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=sp(c)),[c,sp(c)]}function r5(e){const t=sp(e);return[cx(e),t,cx(t)]}function cx(e){return e.replace(/start|end/g,t=>e5[t])}const XC=["left","right"],JC=["right","left"],i5=["top","bottom"],o5=["bottom","top"];function a5(e,t,n){switch(e){case"top":case"bottom":return n?t?JC:XC:t?XC:JC;case"left":case"right":return t?i5:o5;default:return[]}}function s5(e,t,n,r){const o=Gc(e);let s=a5(Zi(e),n==="start",r);return o&&(s=s.map(c=>c+"-"+o),t&&(s=s.concat(s.map(cx)))),s}function sp(e){return e.replace(/left|right|bottom|top/g,t=>Z4[t])}function l5(e){return{top:0,right:0,bottom:0,left:0,...e}}function hb(e){return typeof e!="number"?l5(e):{top:e,right:e,bottom:e,left:e}}function Pc(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function c5(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function u5(){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 d5(){return/apple/i.test(navigator.vendor)}function f5(){return c5().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function h5(){return u5().includes("jsdom/")}const ZC="data-floating-ui-focusable",p5="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function eE(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 pd(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&ax(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function wc(e){return"composedPath"in e?e.composedPath()[0]:e.target}function my(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 m5(e){return e.matches("html,body")}function Qs(e){return e?.ownerDocument||document}function g5(e){return ui(e)&&e.matches(p5)}function v5(e){if(!e||h5())return!0;try{return e.matches(":focus-visible")}catch{return!0}}function y5(e){return e?e.hasAttribute(ZC)?e:e.querySelector("["+ZC+"]")||e:null}function qh(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...qh(e,o.id,n)])}function x5(e){return"nativeEvent"in e}function ux(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}var b5=typeof document<"u",S5=function(){},wo=b5?v.useLayoutEffect:S5;const w5={...JR};function Rh(e){const t=v.useRef(e);return wo(()=>{t.current=e}),t}const j5=w5.useInsertionEffect,C5=j5||(e=>e());function xo(e){const t=v.useRef(()=>{});return C5(()=>{t.current=e}),v.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function tE(e,t,n){let{reference:r,floating:o}=e;const s=Yi(t),c=fb(t),d=db(c),f=Zi(t),p=s==="y",m=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,y=r[d]/2-o[d]/2;let b;switch(f){case"top":b={x:m,y:r.y-o.height};break;case"bottom":b={x:m,y:r.y+r.height};break;case"right":b={x:r.x+r.width,y:g};break;case"left":b={x:r.x-o.width,y:g};break;default:b={x:r.x,y:r.y}}switch(Gc(t)){case"start":b[c]-=y*(n&&p?-1:1);break;case"end":b[c]+=y*(n&&p?-1:1);break}return b}const E5=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:c}=n,d=s.filter(Boolean),f=await(c.isRTL==null?void 0:c.isRTL(t));let p=await c.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:g}=tE(p,r,f),y=r,b={},w=0;for(let j=0;j<d.length;j++){const{name:C,fn:R}=d[j],{x:T,y:E,data:_,reset:k}=await R({x:m,y:g,initialPlacement:r,placement:y,strategy:o,middlewareData:b,rects:p,platform:c,elements:{reference:e,floating:t}});m=T??m,g=E??g,b={...b,[C]:{...b[C],..._}},k&&w<=50&&(w++,typeof k=="object"&&(k.placement&&(y=k.placement),k.rects&&(p=k.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:o}):k.rects),{x:m,y:g}=tE(p,y,f)),j=-1)}return{x:m,y:g,placement:y,strategy:o,middlewareData:b}};async function md(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:c,elements:d,strategy:f}=e,{boundary:p="clippingAncestors",rootBoundary:m="viewport",elementContext:g="floating",altBoundary:y=!1,padding:b=0}=Ro(t,e),w=hb(b),C=d[y?g==="floating"?"reference":"floating":g],R=Pc(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(C)))==null||n?C:C.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(d.floating)),boundary:p,rootBoundary:m,strategy:f})),T=g==="floating"?{x:r,y:o,width:c.floating.width,height:c.floating.height}:c.reference,E=await(s.getOffsetParent==null?void 0:s.getOffsetParent(d.floating)),_=await(s.isElement==null?void 0:s.isElement(E))?await(s.getScale==null?void 0:s.getScale(E))||{x:1,y:1}:{x:1,y:1},k=Pc(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:T,offsetParent:E,strategy:f}):T);return{top:(R.top-k.top+w.top)/_.y,bottom:(k.bottom-R.bottom+w.bottom)/_.y,left:(R.left-k.left+w.left)/_.x,right:(k.right-R.right+w.right)/_.x}}const T5=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:c,elements:d,middlewareData:f}=t,{element:p,padding:m=0}=Ro(e,t)||{};if(p==null)return{};const g=hb(m),y={x:n,y:r},b=fb(o),w=db(b),j=await c.getDimensions(p),C=b==="y",R=C?"top":"left",T=C?"bottom":"right",E=C?"clientHeight":"clientWidth",_=s.reference[w]+s.reference[b]-y[b]-s.floating[w],k=y[b]-s.reference[b],L=await(c.getOffsetParent==null?void 0:c.getOffsetParent(p));let A=L?L[E]:0;(!A||!await(c.isElement==null?void 0:c.isElement(L)))&&(A=d.floating[E]||s.floating[w]);const N=_/2-k/2,U=A/2-j[w]/2-1,B=Ji(g[R],U),Q=Ji(g[T],U),J=B,Z=A-j[w]-Q,$=A/2-j[w]/2+N,W=lx(J,$,Z),M=!f.arrow&&Gc(o)!=null&&$!==W&&s.reference[w]/2-($<J?B:Q)-j[w]/2<0,I=M?$<J?$-J:$-Z:0;return{[b]:y[b]+I,data:{[b]:W,centerOffset:$-W-I,...M&&{alignmentOffset:I}},reset:M}}}),R5=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:c,initialPlacement:d,platform:f,elements:p}=t,{mainAxis:m=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:j=!0,...C}=Ro(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const R=Zi(o),T=Yi(d),E=Zi(d)===d,_=await(f.isRTL==null?void 0:f.isRTL(p.floating)),k=y||(E||!j?[sp(d)]:r5(d)),L=w!=="none";!y&&L&&k.push(...s5(d,j,w,_));const A=[d,...k],N=await md(t,C),U=[];let B=((r=s.flip)==null?void 0:r.overflows)||[];if(m&&U.push(N[R]),g){const $=n5(o,c,_);U.push(N[$[0]],N[$[1]])}if(B=[...B,{placement:o,overflows:U}],!U.every($=>$<=0)){var Q,J;const $=(((Q=s.flip)==null?void 0:Q.index)||0)+1,W=A[$];if(W&&(!(g==="alignment"?T!==Yi(W):!1)||B.every(z=>Yi(z.placement)===T?z.overflows[0]>0:!0)))return{data:{index:$,overflows:B},reset:{placement:W}};let M=(J=B.filter(I=>I.overflows[0]<=0).sort((I,z)=>I.overflows[1]-z.overflows[1])[0])==null?void 0:J.placement;if(!M)switch(b){case"bestFit":{var Z;const I=(Z=B.filter(z=>{if(L){const F=Yi(z.placement);return F===T||F==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(F=>F>0).reduce((F,X)=>F+X,0)]).sort((z,F)=>z[1]-F[1])[0])==null?void 0:Z[0];I&&(M=I);break}case"initialPlacement":M=d;break}if(o!==M)return{reset:{placement:M}}}return{}}}};function nE(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function rE(e){return J4.some(t=>e[t]>=0)}const _5=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=Ro(e,t);switch(r){case"referenceHidden":{const s=await md(t,{...o,elementContext:"reference"}),c=nE(s,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:rE(c)}}}case"escaped":{const s=await md(t,{...o,altBoundary:!0}),c=nE(s,n.floating);return{data:{escapedOffsets:c,escaped:rE(c)}}}default:return{}}}}};function A2(e){const t=Ji(...e.map(s=>s.left)),n=Ji(...e.map(s=>s.top)),r=xr(...e.map(s=>s.right)),o=xr(...e.map(s=>s.bottom));return{x:t,y:n,width:r-t,height:o-n}}function D5(e){const t=e.slice().sort((o,s)=>o.y-s.y),n=[];let r=null;for(let o=0;o<t.length;o++){const s=t[o];!r||s.y-r.y>r.height/2?n.push([s]):n[n.length-1].push(s),r=s}return n.map(o=>Pc(A2(o)))}const A5=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:c}=t,{padding:d=2,x:f,y:p}=Ro(e,t),m=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),g=D5(m),y=Pc(A2(m)),b=hb(d);function w(){if(g.length===2&&g[0].left>g[1].right&&f!=null&&p!=null)return g.find(C=>f>C.left-b.left&&f<C.right+b.right&&p>C.top-b.top&&p<C.bottom+b.bottom)||y;if(g.length>=2){if(Yi(n)==="y"){const B=g[0],Q=g[g.length-1],J=Zi(n)==="top",Z=B.top,$=Q.bottom,W=J?B.left:Q.left,M=J?B.right:Q.right,I=M-W,z=$-Z;return{top:Z,bottom:$,left:W,right:M,width:I,height:z,x:W,y:Z}}const C=Zi(n)==="left",R=xr(...g.map(B=>B.right)),T=Ji(...g.map(B=>B.left)),E=g.filter(B=>C?B.left===T:B.right===R),_=E[0].top,k=E[E.length-1].bottom,L=T,A=R,N=A-L,U=k-_;return{top:_,bottom:k,left:L,right:A,width:N,height:U,x:L,y:_}}return y}const j=await s.getElementRects({reference:{getBoundingClientRect:w},floating:r.floating,strategy:c});return o.reference.x!==j.reference.x||o.reference.y!==j.reference.y||o.reference.width!==j.reference.width||o.reference.height!==j.reference.height?{reset:{rects:j}}:{}}}},k2=new Set(["left","top"]);async function k5(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=Zi(n),d=Gc(n),f=Yi(n)==="y",p=k2.has(c)?-1:1,m=s&&f?-1:1,g=Ro(t,e);let{mainAxis:y,crossAxis:b,alignmentAxis:w}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof w=="number"&&(b=d==="end"?w*-1:w),f?{x:b*m,y:y*p}:{x:y*p,y:b*m}}const P5=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:c,middlewareData:d}=t,f=await k5(t,e);return c===((n=d.offset)==null?void 0:n.placement)&&(r=d.arrow)!=null&&r.alignmentOffset?{}:{x:o+f.x,y:s+f.y,data:{...f,placement:c}}}}},N5=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:d={fn:C=>{let{x:R,y:T}=C;return{x:R,y:T}}},...f}=Ro(e,t),p={x:n,y:r},m=await md(t,f),g=Yi(Zi(o)),y=ub(g);let b=p[y],w=p[g];if(s){const C=y==="y"?"top":"left",R=y==="y"?"bottom":"right",T=b+m[C],E=b-m[R];b=lx(T,b,E)}if(c){const C=g==="y"?"top":"left",R=g==="y"?"bottom":"right",T=w+m[C],E=w-m[R];w=lx(T,w,E)}const j=d.fn({...t,[y]:b,[g]:w});return{...j,data:{x:j.x-n,y:j.y-r,enabled:{[y]:s,[g]:c}}}}}},O5=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:c}=t,{offset:d=0,mainAxis:f=!0,crossAxis:p=!0}=Ro(e,t),m={x:n,y:r},g=Yi(o),y=ub(g);let b=m[y],w=m[g];const j=Ro(d,t),C=typeof j=="number"?{mainAxis:j,crossAxis:0}:{mainAxis:0,crossAxis:0,...j};if(f){const E=y==="y"?"height":"width",_=s.reference[y]-s.floating[E]+C.mainAxis,k=s.reference[y]+s.reference[E]-C.mainAxis;b<_?b=_:b>k&&(b=k)}if(p){var R,T;const E=y==="y"?"width":"height",_=k2.has(Zi(o)),k=s.reference[g]-s.floating[E]+(_&&((R=c.offset)==null?void 0:R[g])||0)+(_?0:C.crossAxis),L=s.reference[g]+s.reference[E]+(_?0:((T=c.offset)==null?void 0:T[g])||0)-(_?C.crossAxis:0);w<k?w=k:w>L&&(w=L)}return{[y]:b,[g]:w}}}},M5=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:c,elements:d}=t,{apply:f=()=>{},...p}=Ro(e,t),m=await md(t,p),g=Zi(o),y=Gc(o),b=Yi(o)==="y",{width:w,height:j}=s.floating;let C,R;g==="top"||g==="bottom"?(C=g,R=y===(await(c.isRTL==null?void 0:c.isRTL(d.floating))?"start":"end")?"left":"right"):(R=g,C=y==="end"?"top":"bottom");const T=j-m.top-m.bottom,E=w-m.left-m.right,_=Ji(j-m[C],T),k=Ji(w-m[R],E),L=!t.middlewareData.shift;let A=_,N=k;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(N=E),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(A=T),L&&!y){const B=xr(m.left,0),Q=xr(m.right,0),J=xr(m.top,0),Z=xr(m.bottom,0);b?N=w-2*(B!==0||Q!==0?B+Q:xr(m.left,m.right)):A=j-2*(J!==0||Z!==0?J+Z:xr(m.top,m.bottom))}await f({...t,availableWidth:N,availableHeight:A});const U=await c.getDimensions(d.floating);return w!==U.width||j!==U.height?{reset:{rects:!0}}:{}}}};function P2(e){const t=ki(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=ui(e),s=o?e.offsetWidth:n,c=o?e.offsetHeight:r,d=ap(n)!==s||ap(r)!==c;return d&&(n=s,r=c),{width:n,height:r,$:d}}function pb(e){return bn(e)?e:e.contextElement}function Rc(e){const t=pb(e);if(!ui(t))return So(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=P2(t);let c=(s?ap(n.width):n.width)/r,d=(s?ap(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!d||!Number.isFinite(d))&&(d=1),{x:c,y:d}}const L5=So(0);function N2(e){const t=Wr(e);return!qp()||!t.visualViewport?L5:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function I5(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Wr(e)?!1:t}function ol(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=pb(e);let c=So(1);t&&(r?bn(r)&&(c=Rc(r)):c=Rc(e));const d=I5(s,n,r)?N2(s):So(0);let f=(o.left+d.x)/c.x,p=(o.top+d.y)/c.y,m=o.width/c.x,g=o.height/c.y;if(s){const y=Wr(s),b=r&&bn(r)?Wr(r):r;let w=y,j=sx(w);for(;j&&r&&b!==w;){const C=Rc(j),R=j.getBoundingClientRect(),T=ki(j),E=R.left+(j.clientLeft+parseFloat(T.paddingLeft))*C.x,_=R.top+(j.clientTop+parseFloat(T.paddingTop))*C.y;f*=C.x,p*=C.y,m*=C.x,g*=C.y,f+=E,p+=_,w=Wr(j),j=sx(w)}}return Pc({width:m,height:g,x:f,y:p})}function Wp(e,t){const n=Gp(e).scrollLeft;return t?t.left+n:ol(Oo(e)).left+n}function O2(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Wp(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function z5(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",c=Oo(r),d=t?Hp(t.floating):!1;if(r===c||d&&s)return n;let f={scrollLeft:0,scrollTop:0},p=So(1);const m=So(0),g=ui(r);if((g||!g&&!s)&&((qc(r)!=="body"||kd(c))&&(f=Gp(r)),ui(r))){const b=ol(r);p=Rc(r),m.x=b.x+r.clientLeft,m.y=b.y+r.clientTop}const y=c&&!g&&!s?O2(c,f):So(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-f.scrollLeft*p.x+m.x+y.x,y:n.y*p.y-f.scrollTop*p.y+m.y+y.y}}function $5(e){return Array.from(e.getClientRects())}function U5(e){const t=Oo(e),n=Gp(e),r=e.ownerDocument.body,o=xr(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=xr(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+Wp(e);const d=-n.scrollTop;return ki(r).direction==="rtl"&&(c+=xr(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:c,y:d}}const iE=25;function B5(e,t){const n=Wr(e),r=Oo(e),o=n.visualViewport;let s=r.clientWidth,c=r.clientHeight,d=0,f=0;if(o){s=o.width,c=o.height;const m=qp();(!m||m&&t==="fixed")&&(d=o.offsetLeft,f=o.offsetTop)}const p=Wp(r);if(p<=0){const m=r.ownerDocument,g=m.body,y=getComputedStyle(g),b=m.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,w=Math.abs(r.clientWidth-g.clientWidth-b);w<=iE&&(s-=w)}else p<=iE&&(s+=p);return{width:s,height:c,x:d,y:f}}const V5=new Set(["absolute","fixed"]);function F5(e,t){const n=ol(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=ui(e)?Rc(e):So(1),c=e.clientWidth*s.x,d=e.clientHeight*s.y,f=o*s.x,p=r*s.y;return{width:c,height:d,x:f,y:p}}function oE(e,t,n){let r;if(t==="viewport")r=B5(e,n);else if(t==="document")r=U5(Oo(e));else if(bn(t))r=F5(t,n);else{const o=N2(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Pc(r)}function M2(e,t){const n=ha(e);return n===t||!bn(n)||da(n)?!1:ki(n).position==="fixed"||M2(n,t)}function H5(e,t){const n=t.get(e);if(n)return n;let r=fa(e,[],!1).filter(d=>bn(d)&&qc(d)!=="body"),o=null;const s=ki(e).position==="fixed";let c=s?ha(e):e;for(;bn(c)&&!da(c);){const d=ki(c),f=cb(c);!f&&d.position==="fixed"&&(o=null),(s?!f&&!o:!f&&d.position==="static"&&!!o&&V5.has(o.position)||kd(c)&&!f&&M2(e,c))?r=r.filter(m=>m!==c):o=d,c=ha(c)}return t.set(e,r),r}function q5(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const c=[...n==="clippingAncestors"?Hp(t)?[]:H5(t,this._c):[].concat(n),r],d=c[0],f=c.reduce((p,m)=>{const g=oE(t,m,o);return p.top=xr(g.top,p.top),p.right=Ji(g.right,p.right),p.bottom=Ji(g.bottom,p.bottom),p.left=xr(g.left,p.left),p},oE(t,d,o));return{width:f.right-f.left,height:f.bottom-f.top,x:f.left,y:f.top}}function G5(e){const{width:t,height:n}=P2(e);return{width:t,height:n}}function W5(e,t,n){const r=ui(t),o=Oo(t),s=n==="fixed",c=ol(e,!0,s,t);let d={scrollLeft:0,scrollTop:0};const f=So(0);function p(){f.x=Wp(o)}if(r||!r&&!s)if((qc(t)!=="body"||kd(o))&&(d=Gp(t)),r){const b=ol(t,!0,s,t);f.x=b.x+t.clientLeft,f.y=b.y+t.clientTop}else o&&p();s&&!r&&o&&p();const m=o&&!r&&!s?O2(o,d):So(0),g=c.left+d.scrollLeft-f.x-m.x,y=c.top+d.scrollTop-f.y-m.y;return{x:g,y,width:c.width,height:c.height}}function gy(e){return ki(e).position==="static"}function aE(e,t){if(!ui(e)||ki(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Oo(e)===n&&(n=n.ownerDocument.body),n}function L2(e,t){const n=Wr(e);if(Hp(e))return n;if(!ui(e)){let o=ha(e);for(;o&&!da(o);){if(bn(o)&&!gy(o))return o;o=ha(o)}return n}let r=aE(e,t);for(;r&&q4(r)&&gy(r);)r=aE(r,t);return r&&da(r)&&gy(r)&&!cb(r)?n:r||K4(e)||n}const Q5=async function(e){const t=this.getOffsetParent||L2,n=this.getDimensions,r=await n(e.floating);return{reference:W5(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Y5(e){return ki(e).direction==="rtl"}const K5={convertOffsetParentRelativeRectToViewportRelativeRect:z5,getDocumentElement:Oo,getClippingRect:q5,getOffsetParent:L2,getElementRects:Q5,getClientRects:$5,getDimensions:G5,getScale:Rc,isElement:bn,isRTL:Y5};function I2(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function X5(e,t){let n=null,r;const o=Oo(e);function s(){var d;clearTimeout(r),(d=n)==null||d.disconnect(),n=null}function c(d,f){d===void 0&&(d=!1),f===void 0&&(f=1),s();const p=e.getBoundingClientRect(),{left:m,top:g,width:y,height:b}=p;if(d||t(),!y||!b)return;const w=Th(g),j=Th(o.clientWidth-(m+y)),C=Th(o.clientHeight-(g+b)),R=Th(m),E={rootMargin:-w+"px "+-j+"px "+-C+"px "+-R+"px",threshold:xr(0,Ji(1,f))||1};let _=!0;function k(L){const A=L[0].intersectionRatio;if(A!==f){if(!_)return c();A?c(!1,A):r=setTimeout(()=>{c(!1,1e-7)},1e3)}A===1&&!I2(p,e.getBoundingClientRect())&&c(),_=!1}try{n=new IntersectionObserver(k,{...E,root:o.ownerDocument})}catch{n=new IntersectionObserver(k,E)}n.observe(e)}return c(!0),s}function dx(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:f=!1}=r,p=pb(e),m=o||s?[...p?fa(p):[],...fa(t)]:[];m.forEach(R=>{o&&R.addEventListener("scroll",n,{passive:!0}),s&&R.addEventListener("resize",n)});const g=p&&d?X5(p,n):null;let y=-1,b=null;c&&(b=new ResizeObserver(R=>{let[T]=R;T&&T.target===p&&b&&(b.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var E;(E=b)==null||E.observe(t)})),n()}),p&&!f&&b.observe(p),b.observe(t));let w,j=f?ol(e):null;f&&C();function C(){const R=ol(e);j&&!I2(j,R)&&n(),j=R,w=requestAnimationFrame(C)}return n(),()=>{var R;m.forEach(T=>{o&&T.removeEventListener("scroll",n),s&&T.removeEventListener("resize",n)}),g?.(),(R=b)==null||R.disconnect(),b=null,f&&cancelAnimationFrame(w)}}const J5=P5,Z5=N5,e9=R5,t9=M5,n9=_5,sE=T5,r9=A5,i9=O5,o9=(e,t,n)=>{const r=new Map,o={platform:K5,...n},s={...o.platform,_c:r};return E5(e,t,{...o,platform:s})};var a9=typeof document<"u",s9=function(){},Gh=a9?v.useLayoutEffect:s9;function lp(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(!lp(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!lp(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function z2(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function lE(e,t){const n=z2(e);return Math.round(t*n)/n}function vy(e){const t=v.useRef(e);return Gh(()=>{t.current=e}),t}function l9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:c}={},transform:d=!0,whileElementsMounted:f,open:p}=e,[m,g]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,b]=v.useState(r);lp(y,r)||b(r);const[w,j]=v.useState(null),[C,R]=v.useState(null),T=v.useCallback(z=>{z!==L.current&&(L.current=z,j(z))},[]),E=v.useCallback(z=>{z!==A.current&&(A.current=z,R(z))},[]),_=s||w,k=c||C,L=v.useRef(null),A=v.useRef(null),N=v.useRef(m),U=f!=null,B=vy(f),Q=vy(o),J=vy(p),Z=v.useCallback(()=>{if(!L.current||!A.current)return;const z={placement:t,strategy:n,middleware:y};Q.current&&(z.platform=Q.current),o9(L.current,A.current,z).then(F=>{const X={...F,isPositioned:J.current!==!1};$.current&&!lp(N.current,X)&&(N.current=X,lb.flushSync(()=>{g(X)}))})},[y,t,n,Q,J]);Gh(()=>{p===!1&&N.current.isPositioned&&(N.current.isPositioned=!1,g(z=>({...z,isPositioned:!1})))},[p]);const $=v.useRef(!1);Gh(()=>($.current=!0,()=>{$.current=!1}),[]),Gh(()=>{if(_&&(L.current=_),k&&(A.current=k),_&&k){if(B.current)return B.current(_,k,Z);Z()}},[_,k,Z,B,U]);const W=v.useMemo(()=>({reference:L,floating:A,setReference:T,setFloating:E}),[T,E]),M=v.useMemo(()=>({reference:_,floating:k}),[_,k]),I=v.useMemo(()=>{const z={position:n,left:0,top:0};if(!M.floating)return z;const F=lE(M.floating,m.x),X=lE(M.floating,m.y);return d?{...z,transform:"translate("+F+"px, "+X+"px)",...z2(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:F,top:X}},[n,d,M.floating,m.x,m.y]);return v.useMemo(()=>({...m,update:Z,refs:W,elements:M,floatingStyles:I}),[m,Z,W,M,I])}const c9=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?sE({element:r.current,padding:o}).fn(n):{}:r?sE({element:r,padding:o}).fn(n):{}}}},$2=(e,t)=>({...J5(e),options:[e,t]}),mb=(e,t)=>({...Z5(e),options:[e,t]}),cE=(e,t)=>({...i9(e),options:[e,t]}),cp=(e,t)=>({...e9(e),options:[e,t]}),u9=(e,t)=>({...t9(e),options:[e,t]}),d9=(e,t)=>({...n9(e),options:[e,t]}),ld=(e,t)=>({...r9(e),options:[e,t]}),U2=(e,t)=>({...c9(e),options:[e,t]});function B2(e){const t=v.useRef(void 0),n=v.useCallback(r=>{const o=e.map(s=>{if(s!=null){if(typeof s=="function"){const c=s,d=c(r);return typeof d=="function"?d:()=>{c(null)}}return s.current=r,()=>{s.current=null}}});return()=>{o.forEach(s=>s?.())}},e);return v.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}const f9="data-floating-ui-focusable",uE="active",dE="selected",h9={...JR};let fE=!1,p9=0;const hE=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+p9++;function m9(){const[e,t]=v.useState(()=>fE?hE():void 0);return wo(()=>{e==null&&t(hE())},[]),v.useEffect(()=>{fE=!0},[]),e}const g9=h9.useId,V2=g9||m9;function v9(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const y9=v.createContext(null),x9=v.createContext(null),gb=()=>{var e;return((e=v.useContext(y9))==null?void 0:e.id)||null},vb=()=>v.useContext(x9);function yb(e){return"data-floating-ui-"+e}function Ti(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}const pE=yb("safe-polygon");function Wh(e,t,n){if(n&&!ux(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[t]}return e?.[t]}function yy(e){return typeof e=="function"?e():e}function b9(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,events:s,elements:c}=e,{enabled:d=!0,delay:f=0,handleClose:p=null,mouseOnly:m=!1,restMs:g=0,move:y=!0}=t,b=vb(),w=gb(),j=Rh(p),C=Rh(f),R=Rh(n),T=Rh(g),E=v.useRef(),_=v.useRef(-1),k=v.useRef(),L=v.useRef(-1),A=v.useRef(!0),N=v.useRef(!1),U=v.useRef(()=>{}),B=v.useRef(!1),Q=xo(()=>{var I;const z=(I=o.current.openEvent)==null?void 0:I.type;return z?.includes("mouse")&&z!=="mousedown"});v.useEffect(()=>{if(!d)return;function I(z){let{open:F}=z;F||(Ti(_),Ti(L),A.current=!0,B.current=!1)}return s.on("openchange",I),()=>{s.off("openchange",I)}},[d,s]),v.useEffect(()=>{if(!d||!j.current||!n)return;function I(F){Q()&&r(!1,F,"hover")}const z=Qs(c.floating).documentElement;return z.addEventListener("mouseleave",I),()=>{z.removeEventListener("mouseleave",I)}},[c.floating,n,r,d,j,Q]);const J=v.useCallback(function(I,z,F){z===void 0&&(z=!0),F===void 0&&(F="hover");const X=Wh(C.current,"close",E.current);X&&!k.current?(Ti(_),_.current=window.setTimeout(()=>r(!1,I,F),X)):z&&(Ti(_),r(!1,I,F))},[C,r]),Z=xo(()=>{U.current(),k.current=void 0}),$=xo(()=>{if(N.current){const I=Qs(c.floating).body;I.style.pointerEvents="",I.removeAttribute(pE),N.current=!1}}),W=xo(()=>o.current.openEvent?["click","mousedown"].includes(o.current.openEvent.type):!1);v.useEffect(()=>{if(!d)return;function I(H){if(Ti(_),A.current=!1,m&&!ux(E.current)||yy(T.current)>0&&!Wh(C.current,"open"))return;const oe=Wh(C.current,"open",E.current);oe?_.current=window.setTimeout(()=>{R.current||r(!0,H,"hover")},oe):n||r(!0,H,"hover")}function z(H){if(W()){$();return}U.current();const oe=Qs(c.floating);if(Ti(L),B.current=!1,j.current&&o.current.floatingContext){n||Ti(_),k.current=j.current({...o.current.floatingContext,tree:b,x:H.clientX,y:H.clientY,onClose(){$(),Z(),W()||J(H,!0,"safe-polygon")}});const Se=k.current;oe.addEventListener("mousemove",Se),U.current=()=>{oe.removeEventListener("mousemove",Se)};return}(E.current==="touch"?!pd(c.floating,H.relatedTarget):!0)&&J(H)}function F(H){W()||o.current.floatingContext&&(j.current==null||j.current({...o.current.floatingContext,tree:b,x:H.clientX,y:H.clientY,onClose(){$(),Z(),W()||J(H)}})(H))}function X(){Ti(_)}function O(H){W()||J(H,!1)}if(bn(c.domReference)){const H=c.domReference,oe=c.floating;return n&&H.addEventListener("mouseleave",F),y&&H.addEventListener("mousemove",I,{once:!0}),H.addEventListener("mouseenter",I),H.addEventListener("mouseleave",z),oe&&(oe.addEventListener("mouseleave",F),oe.addEventListener("mouseenter",X),oe.addEventListener("mouseleave",O)),()=>{n&&H.removeEventListener("mouseleave",F),y&&H.removeEventListener("mousemove",I),H.removeEventListener("mouseenter",I),H.removeEventListener("mouseleave",z),oe&&(oe.removeEventListener("mouseleave",F),oe.removeEventListener("mouseenter",X),oe.removeEventListener("mouseleave",O))}}},[c,d,e,m,y,J,Z,$,r,n,R,b,C,j,o,W,T]),wo(()=>{var I;if(d&&n&&(I=j.current)!=null&&(I=I.__options)!=null&&I.blockPointerEvents&&Q()){N.current=!0;const F=c.floating;if(bn(c.domReference)&&F){var z;const X=Qs(c.floating).body;X.setAttribute(pE,"");const O=c.domReference,H=b==null||(z=b.nodesRef.current.find(oe=>oe.id===w))==null||(z=z.context)==null?void 0:z.elements.floating;return H&&(H.style.pointerEvents=""),X.style.pointerEvents="none",O.style.pointerEvents="auto",F.style.pointerEvents="auto",()=>{X.style.pointerEvents="",O.style.pointerEvents="",F.style.pointerEvents=""}}}},[d,n,w,c,b,j,Q]),wo(()=>{n||(E.current=void 0,B.current=!1,Z(),$())},[n,Z,$]),v.useEffect(()=>()=>{Z(),Ti(_),Ti(L),$()},[d,c.domReference,Z,$]);const M=v.useMemo(()=>{function I(z){E.current=z.pointerType}return{onPointerDown:I,onPointerEnter:I,onMouseMove(z){const{nativeEvent:F}=z;function X(){!A.current&&!R.current&&r(!0,F,"hover")}m&&!ux(E.current)||n||yy(T.current)===0||B.current&&z.movementX**2+z.movementY**2<2||(Ti(L),E.current==="touch"?X():(B.current=!0,L.current=window.setTimeout(X,yy(T.current))))}}},[m,r,n,R,T]);return v.useMemo(()=>d?{reference:M}:{},[d,M])}const fx=()=>{},F2=v.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:fx,setState:fx,isInstantPhase:!1}),S9=()=>v.useContext(F2);function w9(e){const{children:t,delay:n,timeoutMs:r=0}=e,[o,s]=v.useReducer((f,p)=>({...f,...p}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),c=v.useRef(null),d=v.useCallback(f=>{s({currentId:f})},[]);return wo(()=>{o.currentId?c.current===null?c.current=o.currentId:o.isInstantPhase||s({isInstantPhase:!0}):(o.isInstantPhase&&s({isInstantPhase:!1}),c.current=null)},[o.currentId,o.isInstantPhase]),a.jsx(F2.Provider,{value:v.useMemo(()=>({...o,setState:s,setCurrentId:d}),[o,d]),children:t})}function j9(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,floatingId:o}=e,{id:s,enabled:c=!0}=t,d=s??o,f=S9(),{currentId:p,setCurrentId:m,initialDelay:g,setState:y,timeoutMs:b}=f;return wo(()=>{c&&p&&(y({delay:{open:1,close:Wh(g,"close")}}),p!==d&&r(!1))},[c,d,r,y,p,g]),wo(()=>{function w(){r(!1),y({delay:g,currentId:null})}if(c&&p&&!n&&p===d){if(b){const j=window.setTimeout(w,b);return()=>{clearTimeout(j)}}w()}},[c,n,y,p,d,r,g,b]),wo(()=>{c&&(m===fx||!n||m(d))},[c,n,m,d]),f}const C9={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},E9={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},mE=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e?.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e?.outsidePress)!=null?n:!0}};function T9(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:s}=e,{enabled:c=!0,escapeKey:d=!0,outsidePress:f=!0,outsidePressEvent:p="pointerdown",referencePress:m=!1,referencePressEvent:g="pointerdown",ancestorScroll:y=!1,bubbles:b,capture:w}=t,j=vb(),C=xo(typeof f=="function"?f:()=>!1),R=typeof f=="function"?C:f,T=v.useRef(!1),{escapeKey:E,outsidePress:_}=mE(b),{escapeKey:k,outsidePress:L}=mE(w),A=v.useRef(!1),N=xo($=>{var W;if(!n||!c||!d||$.key!=="Escape"||A.current)return;const M=(W=s.current.floatingContext)==null?void 0:W.nodeId,I=j?qh(j.nodesRef.current,M):[];if(!E&&($.stopPropagation(),I.length>0)){let z=!0;if(I.forEach(F=>{var X;if((X=F.context)!=null&&X.open&&!F.context.dataRef.current.__escapeKeyBubbles){z=!1;return}}),!z)return}r(!1,x5($)?$.nativeEvent:$,"escape-key")}),U=xo($=>{var W;const M=()=>{var I;N($),(I=wc($))==null||I.removeEventListener("keydown",M)};(W=wc($))==null||W.addEventListener("keydown",M)}),B=xo($=>{var W;const M=s.current.insideReactTree;s.current.insideReactTree=!1;const I=T.current;if(T.current=!1,p==="click"&&I||M||typeof R=="function"&&!R($))return;const z=wc($),F="["+yb("inert")+"]",X=Qs(o.floating).querySelectorAll(F);let O=bn(z)?z:null;for(;O&&!da(O);){const Se=ha(O);if(da(Se)||!bn(Se))break;O=Se}if(X.length&&bn(z)&&!m5(z)&&!pd(z,o.floating)&&Array.from(X).every(Se=>!pd(O,Se)))return;if(ui(z)&&Z){const Se=da(z),ge=ki(z),Pe=/auto|scroll/,rt=Se||Pe.test(ge.overflowX),Ce=Se||Pe.test(ge.overflowY),ht=rt&&z.clientWidth>0&&z.scrollWidth>z.clientWidth,lt=Ce&&z.clientHeight>0&&z.scrollHeight>z.clientHeight,vt=ge.direction==="rtl",it=lt&&(vt?$.offsetX<=z.offsetWidth-z.clientWidth:$.offsetX>z.clientWidth),wt=ht&&$.offsetY>z.clientHeight;if(it||wt)return}const H=(W=s.current.floatingContext)==null?void 0:W.nodeId,oe=j&&qh(j.nodesRef.current,H).some(Se=>{var ge;return my($,(ge=Se.context)==null?void 0:ge.elements.floating)});if(my($,o.floating)||my($,o.domReference)||oe)return;const ue=j?qh(j.nodesRef.current,H):[];if(ue.length>0){let Se=!0;if(ue.forEach(ge=>{var Pe;if((Pe=ge.context)!=null&&Pe.open&&!ge.context.dataRef.current.__outsidePressBubbles){Se=!1;return}}),!Se)return}r(!1,$,"outside-press")}),Q=xo($=>{var W;const M=()=>{var I;B($),(I=wc($))==null||I.removeEventListener(p,M)};(W=wc($))==null||W.addEventListener(p,M)});v.useEffect(()=>{if(!n||!c)return;s.current.__escapeKeyBubbles=E,s.current.__outsidePressBubbles=_;let $=-1;function W(X){r(!1,X,"ancestor-scroll")}function M(){window.clearTimeout($),A.current=!0}function I(){$=window.setTimeout(()=>{A.current=!1},qp()?5:0)}const z=Qs(o.floating);d&&(z.addEventListener("keydown",k?U:N,k),z.addEventListener("compositionstart",M),z.addEventListener("compositionend",I)),R&&z.addEventListener(p,L?Q:B,L);let F=[];return y&&(bn(o.domReference)&&(F=fa(o.domReference)),bn(o.floating)&&(F=F.concat(fa(o.floating))),!bn(o.reference)&&o.reference&&o.reference.contextElement&&(F=F.concat(fa(o.reference.contextElement)))),F=F.filter(X=>{var O;return X!==((O=z.defaultView)==null?void 0:O.visualViewport)}),F.forEach(X=>{X.addEventListener("scroll",W,{passive:!0})}),()=>{d&&(z.removeEventListener("keydown",k?U:N,k),z.removeEventListener("compositionstart",M),z.removeEventListener("compositionend",I)),R&&z.removeEventListener(p,L?Q:B,L),F.forEach(X=>{X.removeEventListener("scroll",W)}),window.clearTimeout($)}},[s,o,d,R,p,n,r,y,c,E,_,N,k,U,B,L,Q]),v.useEffect(()=>{s.current.insideReactTree=!1},[s,R,p]);const J=v.useMemo(()=>({onKeyDown:N,...m&&{[C9[g]]:$=>{r(!1,$.nativeEvent,"reference-press")},...g!=="click"&&{onClick($){r(!1,$.nativeEvent,"reference-press")}}}}),[N,r,m,g]),Z=v.useMemo(()=>({onKeyDown:N,onMouseDown(){T.current=!0},onMouseUp(){T.current=!0},[E9[p]]:()=>{s.current.insideReactTree=!0}}),[N,p,s]);return v.useMemo(()=>c?{reference:J,floating:Z}:{},[c,J,Z])}function R9(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=V2(),s=v.useRef({}),[c]=v.useState(()=>v9()),d=gb()!=null,[f,p]=v.useState(r.reference),m=xo((b,w,j)=>{s.current.openEvent=b?w:void 0,c.emit("openchange",{open:b,event:w,reason:j,nested:d}),n?.(b,w,j)}),g=v.useMemo(()=>({setPositionReference:p}),[]),y=v.useMemo(()=>({reference:f||r.reference||null,floating:r.floating||null,domReference:r.reference}),[f,r.reference,r.floating]);return v.useMemo(()=>({dataRef:s,open:t,onOpenChange:m,elements:y,events:c,floatingId:o,refs:g}),[t,m,y,c,o,g])}function xb(e){e===void 0&&(e={});const{nodeId:t}=e,n=R9({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,c]=v.useState(null),[d,f]=v.useState(null),m=o?.domReference||s,g=v.useRef(null),y=vb();wo(()=>{m&&(g.current=m)},[m]);const b=l9({...e,elements:{...o,...d&&{reference:d}}}),w=v.useCallback(E=>{const _=bn(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;f(_),b.refs.setReference(_)},[b.refs]),j=v.useCallback(E=>{(bn(E)||E===null)&&(g.current=E,c(E)),(bn(b.refs.reference.current)||b.refs.reference.current===null||E!==null&&!bn(E))&&b.refs.setReference(E)},[b.refs]),C=v.useMemo(()=>({...b.refs,setReference:j,setPositionReference:w,domReference:g}),[b.refs,j,w]),R=v.useMemo(()=>({...b.elements,domReference:m}),[b.elements,m]),T=v.useMemo(()=>({...b,...r,refs:C,elements:R,nodeId:t}),[b,C,R,t,r]);return wo(()=>{r.dataRef.current.floatingContext=T;const E=y?.nodesRef.current.find(_=>_.id===t);E&&(E.context=T)}),v.useMemo(()=>({...b,context:T,refs:C,elements:R}),[b,C,R,T])}function xy(){return f5()&&d5()}function _9(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,events:o,dataRef:s,elements:c}=e,{enabled:d=!0,visibleOnly:f=!0}=t,p=v.useRef(!1),m=v.useRef(-1),g=v.useRef(!0);v.useEffect(()=>{if(!d)return;const b=Wr(c.domReference);function w(){!n&&ui(c.domReference)&&c.domReference===eE(Qs(c.domReference))&&(p.current=!0)}function j(){g.current=!0}function C(){g.current=!1}return b.addEventListener("blur",w),xy()&&(b.addEventListener("keydown",j,!0),b.addEventListener("pointerdown",C,!0)),()=>{b.removeEventListener("blur",w),xy()&&(b.removeEventListener("keydown",j,!0),b.removeEventListener("pointerdown",C,!0))}},[c.domReference,n,d]),v.useEffect(()=>{if(!d)return;function b(w){let{reason:j}=w;(j==="reference-press"||j==="escape-key")&&(p.current=!0)}return o.on("openchange",b),()=>{o.off("openchange",b)}},[o,d]),v.useEffect(()=>()=>{Ti(m)},[]);const y=v.useMemo(()=>({onMouseLeave(){p.current=!1},onFocus(b){if(p.current)return;const w=wc(b.nativeEvent);if(f&&bn(w)){if(xy()&&!b.relatedTarget){if(!g.current&&!g5(w))return}else if(!v5(w))return}r(!0,b.nativeEvent,"focus")},onBlur(b){p.current=!1;const w=b.relatedTarget,j=b.nativeEvent,C=bn(w)&&w.hasAttribute(yb("focus-guard"))&&w.getAttribute("data-type")==="outside";m.current=window.setTimeout(()=>{var R;const T=eE(c.domReference?c.domReference.ownerDocument:document);!w&&T===c.domReference||pd((R=s.current.floatingContext)==null?void 0:R.refs.floating.current,T)||pd(c.domReference,T)||C||r(!1,j,"focus")})}}),[s,c.domReference,r,f]);return v.useMemo(()=>d?{reference:y}:{},[d,y])}function by(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[uE]:c,[dE]:d,...f}=e;s=f}return{...n==="floating"&&{tabIndex:-1,[f9]:""},...s,...t.map(c=>{const d=c?c[n]:null;return typeof d=="function"?e?d(e):null:d}).concat(e).reduce((c,d)=>(d&&Object.entries(d).forEach(f=>{let[p,m]=f;if(!(o&&[uE,dE].includes(p)))if(p.indexOf("on")===0){if(r.has(p)||r.set(p,[]),typeof m=="function"){var g;(g=r.get(p))==null||g.push(m),c[p]=function(){for(var y,b=arguments.length,w=new Array(b),j=0;j<b;j++)w[j]=arguments[j];return(y=r.get(p))==null?void 0:y.map(C=>C(...w)).find(C=>C!==void 0)}}}else c[p]=m}),c),{})}}function D9(e){e===void 0&&(e=[]);const t=e.map(d=>d?.reference),n=e.map(d=>d?.floating),r=e.map(d=>d?.item),o=v.useCallback(d=>by(d,e,"reference"),t),s=v.useCallback(d=>by(d,e,"floating"),n),c=v.useCallback(d=>by(d,e,"item"),r);return v.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:c}),[o,s,c])}const A9=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function k9(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:s,floatingId:c}=e,{enabled:d=!0,role:f="dialog"}=t,p=V2(),m=((n=s.domReference)==null?void 0:n.id)||p,g=v.useMemo(()=>{var T;return((T=y5(s.floating))==null?void 0:T.id)||c},[s.floating,c]),y=(r=A9.get(f))!=null?r:f,w=gb()!=null,j=v.useMemo(()=>y==="tooltip"||f==="label"?{["aria-"+(f==="label"?"labelledby":"describedby")]:o?g:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":y==="alertdialog"?"dialog":y,"aria-controls":o?g:void 0,...y==="listbox"&&{role:"combobox"},...y==="menu"&&{id:m},...y==="menu"&&w&&{role:"menuitem"},...f==="select"&&{"aria-autocomplete":"none"},...f==="combobox"&&{"aria-autocomplete":"list"}},[y,g,w,o,m,f]),C=v.useMemo(()=>{const T={id:g,...y&&{role:y}};return y==="tooltip"||f==="label"?T:{...T,...y==="menu"&&{"aria-labelledby":m}}},[y,g,m,f]),R=v.useCallback(T=>{let{active:E,selected:_}=T;const k={role:"option",...E&&{id:g+"-fui-option"}};switch(f){case"select":case"combobox":return{...k,"aria-selected":_}}return{}},[g,f]);return v.useMemo(()=>d?{reference:j,floating:C,item:R}:{},[d,j,C,R])}const[P9,Oi]=Mr("ScrollArea.Root component was not found in tree");function Nc(e,t){const n=qs(t);Fc(()=>{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 N9=v.forwardRef((e,t)=>{const{style:n,...r}=e,o=Oi(),[s,c]=v.useState(0),[d,f]=v.useState(0),p=!!(s&&d);return Nc(o.scrollbarX,()=>{const m=o.scrollbarX?.offsetHeight||0;o.onCornerHeightChange(m),f(m)}),Nc(o.scrollbarY,()=>{const m=o.scrollbarY?.offsetWidth||0;o.onCornerWidthChange(m),c(m)}),p?a.jsx("div",{...r,ref:t,style:{...n,width:s,height:d}}):null}),O9=v.forwardRef((e,t)=>{const n=Oi(),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(N9,{...e,ref:t}):null}),M9={scrollHideDelay:1e3,type:"hover"},H2=v.forwardRef((e,t)=>{const{type:n,scrollHideDelay:r,scrollbars:o,getStyles:s,...c}=ae("ScrollAreaRoot",M9,e),[d,f]=v.useState(null),[p,m]=v.useState(null),[g,y]=v.useState(null),[b,w]=v.useState(null),[j,C]=v.useState(null),[R,T]=v.useState(0),[E,_]=v.useState(0),[k,L]=v.useState(!1),[A,N]=v.useState(!1),U=zn(t,B=>f(B));return a.jsx(P9,{value:{type:n,scrollHideDelay:r,scrollArea:d,viewport:p,onViewportChange:m,content:g,onContentChange:y,scrollbarX:b,onScrollbarXChange:w,scrollbarXEnabled:k,onScrollbarXEnabledChange:L,scrollbarY:j,onScrollbarYChange:C,scrollbarYEnabled:A,onScrollbarYEnabledChange:N,onCornerWidthChange:T,onCornerHeightChange:_,getStyles:s},children:a.jsx(de,{...c,ref:U,__vars:{"--sa-corner-width":o!=="xy"?"0px":`${R}px`,"--sa-corner-height":o!=="xy"?"0px":`${E}px`}})})});H2.displayName="@mantine/core/ScrollAreaRoot";function q2(e,t){const n=e/t;return Number.isNaN(n)?0:n}function Qp(e){const t=q2(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function G2(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 L9(e,[t,n]){return Math.min(n,Math.max(t,e))}function gE(e,t,n="ltr"){const r=Qp(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,c=t.content-t.viewport,d=s-r,f=n==="ltr"?[0,c]:[c*-1,0],p=L9(e,f);return G2([0,c],[0,d])(p)}function I9(e,t,n,r="ltr"){const o=Qp(n),s=o/2,c=t||s,d=o-c,f=n.scrollbar.paddingStart+c,p=n.scrollbar.size-n.scrollbar.paddingEnd-d,m=n.content-n.viewport,g=r==="ltr"?[0,m]:[m*-1,0];return G2([f,p],g)(e)}function W2(e,t){return e>0&&e<t}function as(e){return e?parseInt(e,10):0}function nl(e,t,{checkForDefaultPrevented:n=!0}={}){return r=>{e?.(r),(n===!1||!r.defaultPrevented)&&t?.(r)}}const[z9,Q2]=Mr("ScrollAreaScrollbar was not found in tree"),Y2=v.forwardRef((e,t)=>{const{sizes:n,hasThumb:r,onThumbChange:o,onThumbPointerUp:s,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:f,onWheelScroll:p,onResize:m,...g}=e,y=Oi(),[b,w]=v.useState(null),j=zn(t,N=>w(N)),C=v.useRef(null),R=v.useRef(""),{viewport:T}=y,E=n.content-n.viewport,_=qs(p),k=qs(d),L=zp(m,10),A=N=>{if(C.current){const U=N.clientX-C.current.left,B=N.clientY-C.current.top;f({x:U,y:B})}};return v.useEffect(()=>{const N=U=>{const B=U.target;b?.contains(B)&&_(U,E)};return document.addEventListener("wheel",N,{passive:!1}),()=>document.removeEventListener("wheel",N,{passive:!1})},[T,b,E,_]),v.useEffect(k,[n,k]),Nc(b,L),Nc(y.content,L),a.jsx(z9,{value:{scrollbar:b,hasThumb:r,onThumbChange:qs(o),onThumbPointerUp:qs(s),onThumbPositionChange:k,onThumbPointerDown:qs(c)},children:a.jsx("div",{...g,ref:j,"data-mantine-scrollbar":!0,style:{position:"absolute",...g.style},onPointerDown:nl(e.onPointerDown,N=>{N.preventDefault(),N.button===0&&(N.target.setPointerCapture(N.pointerId),C.current=b.getBoundingClientRect(),R.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",A(N))}),onPointerMove:nl(e.onPointerMove,A),onPointerUp:nl(e.onPointerUp,N=>{const U=N.target;U.hasPointerCapture(N.pointerId)&&(N.preventDefault(),U.releasePointerCapture(N.pointerId))}),onLostPointerCapture:()=>{document.body.style.webkitUserSelect=R.current,C.current=null}})})}),K2=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...s}=e,c=Oi(),[d,f]=v.useState(),p=v.useRef(null),m=zn(t,p,c.onScrollbarXChange);return v.useEffect(()=>{p.current&&f(getComputedStyle(p.current))},[p]),a.jsx(Y2,{"data-orientation":"horizontal",...s,ref:m,sizes:n,style:{...o,"--sa-thumb-width":`${Qp(n)}px`},onThumbPointerDown:g=>e.onThumbPointerDown(g.x),onDragScroll:g=>e.onDragScroll(g.x),onWheelScroll:(g,y)=>{if(c.viewport){const b=c.viewport.scrollLeft+g.deltaX;e.onWheelScroll(b),W2(b,y)&&g.preventDefault()}},onResize:()=>{p.current&&c.viewport&&d&&r({content:c.viewport.scrollWidth,viewport:c.viewport.offsetWidth,scrollbar:{size:p.current.clientWidth,paddingStart:as(d.paddingLeft),paddingEnd:as(d.paddingRight)}})}})});K2.displayName="@mantine/core/ScrollAreaScrollbarX";const X2=v.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,style:o,...s}=e,c=Oi(),[d,f]=v.useState(),p=v.useRef(null),m=zn(t,p,c.onScrollbarYChange);return v.useEffect(()=>{p.current&&f(window.getComputedStyle(p.current))},[]),a.jsx(Y2,{...s,"data-orientation":"vertical",ref:m,sizes:n,style:{"--sa-thumb-height":`${Qp(n)}px`,...o},onThumbPointerDown:g=>e.onThumbPointerDown(g.y),onDragScroll:g=>e.onDragScroll(g.y),onWheelScroll:(g,y)=>{if(c.viewport){const b=c.viewport.scrollTop+g.deltaY;e.onWheelScroll(b),W2(b,y)&&g.preventDefault()}},onResize:()=>{p.current&&c.viewport&&d&&r({content:c.viewport.scrollHeight,viewport:c.viewport.offsetHeight,scrollbar:{size:p.current.clientHeight,paddingStart:as(d.paddingTop),paddingEnd:as(d.paddingBottom)}})}})});X2.displayName="@mantine/core/ScrollAreaScrollbarY";const Yp=v.forwardRef((e,t)=>{const{orientation:n="vertical",...r}=e,{dir:o}=ps(),s=Oi(),c=v.useRef(null),d=v.useRef(0),[f,p]=v.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),m=q2(f.viewport,f.content),g={...r,sizes:f,onSizesChange:p,hasThumb:m>0&&m<1,onThumbChange:b=>{c.current=b},onThumbPointerUp:()=>{d.current=0},onThumbPointerDown:b=>{d.current=b}},y=(b,w)=>I9(b,d.current,f,w);return n==="horizontal"?a.jsx(K2,{...g,ref:t,onThumbPositionChange:()=>{if(s.viewport&&c.current){const b=s.viewport.scrollLeft,w=gE(b,f,o);c.current.style.transform=`translate3d(${w}px, 0, 0)`}},onWheelScroll:b=>{s.viewport&&(s.viewport.scrollLeft=b)},onDragScroll:b=>{s.viewport&&(s.viewport.scrollLeft=y(b,o))}}):n==="vertical"?a.jsx(X2,{...g,ref:t,onThumbPositionChange:()=>{if(s.viewport&&c.current){const b=s.viewport.scrollTop,w=gE(b,f);f.scrollbar.size===0?c.current.style.setProperty("--thumb-opacity","0"):c.current.style.setProperty("--thumb-opacity","1"),c.current.style.transform=`translate3d(0, ${w}px, 0)`}},onWheelScroll:b=>{s.viewport&&(s.viewport.scrollTop=b)},onDragScroll:b=>{s.viewport&&(s.viewport.scrollTop=y(b))}}):null});Yp.displayName="@mantine/core/ScrollAreaScrollbarVisible";const bb=v.forwardRef((e,t)=>{const n=Oi(),{forceMount:r,...o}=e,[s,c]=v.useState(!1),d=e.orientation==="horizontal",f=zp(()=>{if(n.viewport){const p=n.viewport.offsetWidth<n.viewport.scrollWidth,m=n.viewport.offsetHeight<n.viewport.scrollHeight;c(d?p:m)}},10);return Nc(n.viewport,f),Nc(n.content,f),r||s?a.jsx(Yp,{"data-state":s?"visible":"hidden",...o,ref:t}):null});bb.displayName="@mantine/core/ScrollAreaScrollbarAuto";const J2=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Oi(),[s,c]=v.useState(!1);return v.useEffect(()=>{const{scrollArea:d}=o;let f=0;if(d){const p=()=>{window.clearTimeout(f),c(!0)},m=()=>{f=window.setTimeout(()=>c(!1),o.scrollHideDelay)};return d.addEventListener("pointerenter",p),d.addEventListener("pointerleave",m),()=>{window.clearTimeout(f),d.removeEventListener("pointerenter",p),d.removeEventListener("pointerleave",m)}}},[o.scrollArea,o.scrollHideDelay]),n||s?a.jsx(bb,{"data-state":s?"visible":"hidden",...r,ref:t}):null});J2.displayName="@mantine/core/ScrollAreaScrollbarHover";const $9=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Oi(),s=e.orientation==="horizontal",[c,d]=v.useState("hidden"),f=zp(()=>d("idle"),100);return v.useEffect(()=>{if(c==="idle"){const p=window.setTimeout(()=>d("hidden"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[c,o.scrollHideDelay]),v.useEffect(()=>{const{viewport:p}=o,m=s?"scrollLeft":"scrollTop";if(p){let g=p[m];const y=()=>{const b=p[m];g!==b&&(d("scrolling"),f()),g=b};return p.addEventListener("scroll",y),()=>p.removeEventListener("scroll",y)}},[o.viewport,s,f]),n||c!=="hidden"?a.jsx(Yp,{"data-state":c==="hidden"?"hidden":"visible",...r,ref:t,onPointerEnter:nl(e.onPointerEnter,()=>d("interacting")),onPointerLeave:nl(e.onPointerLeave,()=>d("idle"))}):null}),hx=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Oi(),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:c}=o,d=e.orientation==="horizontal";return v.useEffect(()=>(d?s(!0):c(!0),()=>{d?s(!1):c(!1)}),[d,s,c]),o.type==="hover"?a.jsx(J2,{...r,ref:t,forceMount:n}):o.type==="scroll"?a.jsx($9,{...r,ref:t,forceMount:n}):o.type==="auto"?a.jsx(bb,{...r,ref:t,forceMount:n}):o.type==="always"?a.jsx(Yp,{...r,ref:t}):null});hx.displayName="@mantine/core/ScrollAreaScrollbar";function U9(e,t=()=>{}){let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function o(){const s={left:e.scrollLeft,top:e.scrollTop},c=n.left!==s.left,d=n.top!==s.top;(c||d)&&t(),n=s,r=window.requestAnimationFrame(o)})(),()=>window.cancelAnimationFrame(r)}const Z2=v.forwardRef((e,t)=>{const{style:n,...r}=e,o=Oi(),s=Q2(),{onThumbPositionChange:c}=s,d=zn(t,m=>s.onThumbChange(m)),f=v.useRef(void 0),p=zp(()=>{f.current&&(f.current(),f.current=void 0)},100);return v.useEffect(()=>{const{viewport:m}=o;if(m){const g=()=>{if(p(),!f.current){const y=U9(m,c);f.current=y,c()}};return c(),m.addEventListener("scroll",g),()=>m.removeEventListener("scroll",g)}},[o.viewport,p,c]),a.jsx("div",{"data-state":s.hasThumb?"visible":"hidden",...r,ref:d,style:{width:"var(--sa-thumb-width)",height:"var(--sa-thumb-height)",...n},onPointerDownCapture:nl(e.onPointerDownCapture,m=>{const y=m.target.getBoundingClientRect(),b=m.clientX-y.left,w=m.clientY-y.top;s.onThumbPointerDown({x:b,y:w})}),onPointerUp:nl(e.onPointerUp,s.onThumbPointerUp)})});Z2.displayName="@mantine/core/ScrollAreaThumb";const px=v.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Q2();return n||o.hasThumb?a.jsx(Z2,{ref:t,...r}):null});px.displayName="@mantine/core/ScrollAreaThumb";const e_=v.forwardRef(({children:e,style:t,...n},r)=>{const o=Oi(),s=zn(r,o.onViewportChange);return a.jsx(de,{...n,ref:s,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t},children:a.jsx("div",{...o.getStyles("content"),ref:o.onContentChange,children:e})})});e_.displayName="@mantine/core/ScrollAreaViewport";var Sb={root:"m_d57069b5",content:"m_b1336c6",viewport:"m_c0783ff9",viewportInner:"m_f8f631dd",scrollbar:"m_c44ba933",thumb:"m_d8b5e363",corner:"m_21657268"};const t_={scrollHideDelay:1e3,type:"hover",scrollbars:"xy"},B9=(e,{scrollbarSize:t,overscrollBehavior:n})=>({root:{"--scrollarea-scrollbar-size":le(t),"--scrollarea-over-scroll-behavior":n}}),pi=be((e,t)=>{const n=ae("ScrollArea",t_,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,scrollbarSize:f,vars:p,type:m,scrollHideDelay:g,viewportProps:y,viewportRef:b,onScrollPositionChange:w,children:j,offsetScrollbars:C,scrollbars:R,onBottomReached:T,onTopReached:E,overscrollBehavior:_,attributes:k,...L}=n,[A,N]=v.useState(!1),[U,B]=v.useState(!1),[Q,J]=v.useState(!1),Z=ze({name:"ScrollArea",props:n,classes:Sb,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:k,vars:p,varsResolver:B9}),$=v.useRef(null),W=B2([b,$]);return v.useEffect(()=>{if(!$.current||C!=="present")return;const M=$.current,I=new ResizeObserver(()=>{const{scrollHeight:z,clientHeight:F,scrollWidth:X,clientWidth:O}=M;B(z>F),J(X>O)});return I.observe(M),()=>I.disconnect()},[$,C]),a.jsxs(H2,{getStyles:Z,type:m==="never"?"always":m,scrollHideDelay:g,ref:t,scrollbars:R,...Z("root"),...L,children:[a.jsx(e_,{...y,...Z("viewport",{style:y?.style}),ref:W,"data-offset-scrollbars":C===!0?"xy":C||void 0,"data-scrollbars":R||void 0,"data-horizontal-hidden":C==="present"&&!Q?"true":void 0,"data-vertical-hidden":C==="present"&&!U?"true":void 0,onScroll:M=>{y?.onScroll?.(M),w?.({x:M.currentTarget.scrollLeft,y:M.currentTarget.scrollTop});const{scrollTop:I,scrollHeight:z,clientHeight:F}=M.currentTarget;I-(z-F)>=-.6&&T?.(),I===0&&E?.()},children:j}),(R==="xy"||R==="x")&&a.jsx(hx,{...Z("scrollbar"),orientation:"horizontal","data-hidden":m==="never"||C==="present"&&!Q?!0:void 0,forceMount:!0,onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1),children:a.jsx(px,{...Z("thumb")})}),(R==="xy"||R==="y")&&a.jsx(hx,{...Z("scrollbar"),orientation:"vertical","data-hidden":m==="never"||C==="present"&&!U?!0:void 0,forceMount:!0,onMouseEnter:()=>N(!0),onMouseLeave:()=>N(!1),children:a.jsx(px,{...Z("thumb")})}),a.jsx(O9,{...Z("corner"),"data-hovered":A||void 0,"data-hidden":m==="never"||void 0})]})});pi.displayName="@mantine/core/ScrollArea";const Kp=be((e,t)=>{const{children:n,classNames:r,styles:o,scrollbarSize:s,scrollHideDelay:c,type:d,dir:f,offsetScrollbars:p,viewportRef:m,onScrollPositionChange:g,unstyled:y,variant:b,viewportProps:w,scrollbars:j,style:C,vars:R,onBottomReached:T,onTopReached:E,onOverflowChange:_,...k}=ae("ScrollAreaAutosize",t_,e),L=v.useRef(null),A=B2([m,L]),[N,U]=v.useState(!1),B=v.useRef(!1);return v.useEffect(()=>{if(!_)return;const Q=L.current;if(!Q)return;const J=()=>{const $=Q.scrollHeight>Q.clientHeight;$!==N&&(B.current?_?.($):(B.current=!0,$&&_?.(!0)),U($))};J();const Z=new ResizeObserver(J);return Z.observe(Q),()=>Z.disconnect()},[_,N]),a.jsx(de,{...k,ref:t,style:[{display:"flex",overflow:"hidden"},C],children:a.jsx(de,{style:{display:"flex",flexDirection:"column",flex:1,overflow:"hidden",...j==="y"&&{minWidth:0},...j==="x"&&{minHeight:0},...j==="xy"&&{minWidth:0,minHeight:0},...j===!1&&{minWidth:0,minHeight:0}},children:a.jsx(pi,{classNames:r,styles:o,scrollHideDelay:c,scrollbarSize:s,type:d,dir:f,offsetScrollbars:p,viewportRef:A,onScrollPositionChange:g,unstyled:y,variant:b,viewportProps:w,vars:R,scrollbars:j,onBottomReached:T,onTopReached:E,"data-autosize":"true",children:n})})})});pi.classes=Sb;Kp.displayName="@mantine/core/ScrollAreaAutosize";Kp.classes=Sb;pi.Autosize=Kp;var n_={root:"m_87cf2631"};const V9={__staticSelector:"UnstyledButton"},ar=pr((e,t)=>{const n=ae("UnstyledButton",V9,e),{className:r,component:o="button",__staticSelector:s,unstyled:c,classNames:d,styles:f,style:p,attributes:m,...g}=n,y=ze({name:s,props:n,classes:n_,className:r,style:p,classNames:d,styles:f,unstyled:c,attributes:m});return a.jsx(de,{...y("root",{focusable:!0}),component:o,ref:t,type:o==="button"?"button":void 0,...g})});ar.classes=n_;ar.displayName="@mantine/core/UnstyledButton";var r_={root:"m_515a97f8"};const wb=be((e,t)=>{const n=ae("VisuallyHidden",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,attributes:p,...m}=n,g=ze({name:"VisuallyHidden",classes:r_,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:p});return a.jsx(de,{component:"span",ref:t,...g("root"),...m})});wb.classes=r_;wb.displayName="@mantine/core/VisuallyHidden";var i_={root:"m_1b7284a3"};const F9=(e,{radius:t,shadow:n})=>({root:{"--paper-radius":t===void 0?void 0:Ft(t),"--paper-shadow":eb(n)}}),Pr=pr((e,t)=>{const n=ae("Paper",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,withBorder:f,vars:p,radius:m,shadow:g,variant:y,mod:b,attributes:w,...j}=n,C=ze({name:"Paper",props:n,classes:i_,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:w,vars:p,varsResolver:F9});return a.jsx(de,{ref:t,mod:[{"data-with-border":f},b],...C("root"),variant:y,...j})});Pr.classes=i_;Pr.displayName="@mantine/core/Paper";function vE(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function yE(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 H9={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function q9({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:c,dir:d}){const[f,p="center"]=e.split("-"),m={width:t,height:t,transform:"rotate(45deg)",position:"absolute",[H9[f]]:r},g=-t/2;return f==="left"?{...m,...vE(p,c,n,o),right:g,borderLeftColor:"transparent",borderBottomColor:"transparent",clipPath:"polygon(100% 0, 0 0, 100% 100%)"}:f==="right"?{...m,...vE(p,c,n,o),left:g,borderRightColor:"transparent",borderTopColor:"transparent",clipPath:"polygon(0 100%, 0 0, 100% 100%)"}:f==="top"?{...m,...yE(p,s,n,o,d),bottom:g,borderTopColor:"transparent",borderLeftColor:"transparent",clipPath:"polygon(0 100%, 100% 100%, 100% 0)"}:f==="bottom"?{...m,...yE(p,s,n,o,d),top:g,borderBottomColor:"transparent",borderRightColor:"transparent",clipPath:"polygon(0 100%, 0 0, 100% 0)"}:{}}const up=v.forwardRef(({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,visible:s,arrowX:c,arrowY:d,style:f,...p},m)=>{const{dir:g}=ps();return s?a.jsx("div",{...p,ref:m,style:{...f,...q9({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,dir:g,arrowX:c,arrowY:d})}}):null});up.displayName="@mantine/core/FloatingArrow";function o_(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),o=n==="right"?"left":"right";return r===void 0?o:`${o}-${r}`}return t}var a_={root:"m_9814e45f"};const G9={zIndex:hi("modal")},W9=(e,{gradient:t,color:n,backgroundOpacity:r,blur:o,radius:s,zIndex:c})=>({root:{"--overlay-bg":t||(n!==void 0||r!==void 0)&&Ri(n||"#000",r??.6)||void 0,"--overlay-filter":o?`blur(${le(o)})`:void 0,"--overlay-radius":s===void 0?void 0:Ft(s),"--overlay-z-index":c?.toString()}}),Oc=pr((e,t)=>{const n=ae("Overlay",G9,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,fixed:p,center:m,children:g,radius:y,zIndex:b,gradient:w,blur:j,color:C,backgroundOpacity:R,mod:T,attributes:E,..._}=n,k=ze({name:"Overlay",props:n,classes:a_,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:E,vars:f,varsResolver:W9});return a.jsx(de,{ref:t,...k("root"),mod:[{center:m,fixed:p},T],..._,children:g})});Oc.classes=a_;Oc.displayName="@mantine/core/Overlay";function Sy(e){const t=document.createElement("div");return t.setAttribute("data-portal","true"),typeof e.className=="string"&&t.classList.add(...e.className.split(" ").filter(Boolean)),typeof e.style=="object"&&Object.assign(t.style,e.style),typeof e.id=="string"&&t.setAttribute("id",e.id),t}function Q9({target:e,reuseTargetNode:t,...n}){if(e)return typeof e=="string"?document.querySelector(e)||Sy(n):e;if(t){const r=document.querySelector("[data-mantine-shared-portal-node]");if(r)return r;const o=Sy(n);return o.setAttribute("data-mantine-shared-portal-node","true"),document.body.appendChild(o),o}return Sy(n)}const Y9={reuseTargetNode:!0},s_=be((e,t)=>{const{children:n,target:r,reuseTargetNode:o,...s}=ae("Portal",Y9,e),[c,d]=v.useState(!1),f=v.useRef(null);return Fc(()=>(d(!0),f.current=Q9({target:r,reuseTargetNode:o,...s}),fd(t,f.current),!r&&!o&&f.current&&document.body.appendChild(f.current),()=>{!r&&!o&&f.current&&document.body.removeChild(f.current)}),[r]),!c||!f.current?null:lb.createPortal(a.jsx(a.Fragment,{children:n}),f.current)});s_.displayName="@mantine/core/Portal";const pa=be(({withinPortal:e=!0,children:t,...n},r)=>Vp()==="test"||!e?a.jsx(a.Fragment,{children:t}):a.jsx(s_,{ref:r,...n,children:t}));pa.displayName="@mantine/core/OptionalPortal";const Xu=e=>({in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${e==="bottom"?10:-10}px)`},transitionProperty:"transform, opacity"}),_h={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},"fade-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(30px)"},transitionProperty:"opacity, transform"},"fade-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-30px)"},transitionProperty:"opacity, transform"},"fade-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(30px)"},transitionProperty:"opacity, transform"},"fade-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-30px)"},transitionProperty:"opacity, transform"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:"translateY(-20px) skew(-10deg, -5deg)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:"translateY(20px) skew(-10deg, -5deg)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:"translateY(20px) rotate(-5deg)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:"translateY(20px) rotate(5deg)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:{...Xu("bottom"),common:{transformOrigin:"center center"}},"pop-bottom-left":{...Xu("bottom"),common:{transformOrigin:"bottom left"}},"pop-bottom-right":{...Xu("bottom"),common:{transformOrigin:"bottom right"}},"pop-top-left":{...Xu("top"),common:{transformOrigin:"top left"}},"pop-top-right":{...Xu("top"),common:{transformOrigin:"top right"}}},xE={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function K9({transition:e,state:t,duration:n,timingFunction:r}){const o={WebkitBackfaceVisibility:"hidden",transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in _h?{transitionProperty:_h[e].transitionProperty,...o,..._h[e].common,..._h[e][xE[t]]}:{}:{transitionProperty:e.transitionProperty,...o,...e.common,...e[xE[t]]}}function X9({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:c,onExited:d,enterDelay:f,exitDelay:p}){const m=jn(),g=nb(),y=m.respectReducedMotion?g:!1,[b,w]=v.useState(y?0:e),[j,C]=v.useState(r?"entered":"exited"),R=v.useRef(-1),T=v.useRef(-1),E=v.useRef(-1);function _(){window.clearTimeout(R.current),window.clearTimeout(T.current),cancelAnimationFrame(E.current)}const k=A=>{_();const N=A?o:s,U=A?c:d,B=y?0:A?e:t;w(B),B===0?(typeof N=="function"&&N(),typeof U=="function"&&U(),C(A?"entered":"exited")):E.current=requestAnimationFrame(()=>{id.flushSync(()=>{C(A?"pre-entering":"pre-exiting")}),E.current=requestAnimationFrame(()=>{typeof N=="function"&&N(),C(A?"entering":"exiting"),R.current=window.setTimeout(()=>{typeof U=="function"&&U(),C(A?"entered":"exited")},B)})})},L=A=>{if(_(),typeof(A?f:p)!="number"){k(A);return}T.current=window.setTimeout(()=>{k(A)},A?f:p)};return tl(()=>{L(r)},[r]),v.useEffect(()=>()=>{_()},[]),{transitionDuration:b,transitionStatus:j,transitionTimingFunction:n||"ease"}}function eo({keepMounted:e,transition:t="fade",duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:c="ease",onExit:d,onEntered:f,onEnter:p,onExited:m,enterDelay:g,exitDelay:y}){const b=Vp(),{transitionDuration:w,transitionStatus:j,transitionTimingFunction:C}=X9({mounted:o,exitDuration:r,duration:n,timingFunction:c,onExit:d,onEntered:f,onEnter:p,onExited:m,enterDelay:g,exitDelay:y});return w===0||b==="test"?o?a.jsx(a.Fragment,{children:s({})}):e?s({display:"none"}):null:j==="exited"?e?s({display:"none"}):null:a.jsx(a.Fragment,{children:s(K9({transition:t,duration:w,state:j,timingFunction:C}))})}eo.displayName="@mantine/core/Transition";const[J9,l_]=Mr("Popover component was not found in the tree");function Xp({children:e,active:t=!0,refProp:n="ref",innerRef:r}){const o=vM(t),s=zn(o,r);return Po(e)?v.cloneElement(e,{[n]:s}):e}function c_(e){return a.jsx(wb,{tabIndex:-1,"data-autofocus":!0,...e})}Xp.displayName="@mantine/core/FocusTrap";c_.displayName="@mantine/core/FocusTrapInitialFocus";Xp.InitialFocus=c_;var u_={dropdown:"m_38a85659",arrow:"m_a31dc6c1",overlay:"m_3d7bc908"};const jb=be((e,t)=>{const n=ae("PopoverDropdown",null,e),{className:r,style:o,vars:s,children:c,onKeyDownCapture:d,variant:f,classNames:p,styles:m,...g}=n,y=l_(),b=u2({opened:y.opened,shouldReturnFocus:y.returnFocus}),w=y.withRoles?{"aria-labelledby":y.getTargetId(),id:y.getDropdownId(),role:"dialog",tabIndex:-1}:{},j=zn(t,y.floating);return y.disabled?null:a.jsx(pa,{...y.portalProps,withinPortal:y.withinPortal,children:a.jsx(eo,{mounted:y.opened,...y.transitionProps,transition:y.transitionProps?.transition||"fade",duration:y.transitionProps?.duration??150,keepMounted:y.keepMounted,exitDuration:typeof y.transitionProps?.exitDuration=="number"?y.transitionProps.exitDuration:y.transitionProps?.duration,children:C=>a.jsx(Xp,{active:y.trapFocus&&y.opened,innerRef:j,children:a.jsxs(de,{...w,...g,variant:f,onKeyDownCapture:iM(()=>{y.onClose?.(),y.onDismiss?.()},{active:y.closeOnEscape,onTrigger:b,onKeyDown:d}),"data-position":y.placement,"data-fixed":y.floatingStrategy==="fixed"||void 0,...y.getStyles("dropdown",{className:r,props:n,classNames:p,styles:m,style:[{...C,zIndex:y.zIndex,top:y.y??0,left:y.x??0,width:y.width==="target"?void 0:le(y.width),...y.referenceHidden?{display:"none"}:null},y.resolvedStyles.dropdown,m?.dropdown,o]}),children:[c,a.jsx(up,{ref:y.arrowRef,arrowX:y.arrowX,arrowY:y.arrowY,visible:y.withArrow,position:y.placement,arrowSize:y.arrowSize,arrowRadius:y.arrowRadius,arrowOffset:y.arrowOffset,arrowPosition:y.arrowPosition,...y.getStyles("arrow",{props:n,classNames:p,styles:m})})]})})})})});jb.classes=u_;jb.displayName="@mantine/core/PopoverDropdown";const Z9={refProp:"ref",popupType:"dialog"},d_=be((e,t)=>{const{children:n,refProp:r,popupType:o,...s}=ae("PopoverTarget",Z9,e);if(!Po(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 c=s,d=l_(),f=zn(d.reference,$p(n),t),p=d.withRoles?{"aria-haspopup":o,"aria-expanded":d.opened,"aria-controls":d.getDropdownId(),id:d.getTargetId()}:{};return v.cloneElement(n,{...c,...p,...d.targetProps,className:$t(d.targetProps.className,c.className,n.props.className),[r]:f,...d.controlled?null:{onClick:()=>{d.onToggle(),n.props.onClick?.()}}})});d_.displayName="@mantine/core/PopoverTarget";function eL(e){if(e===void 0)return{shift:!0,flip:!0};const t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function tL(e,t,n){const r=eL(e.middlewares),o=[$2(e.offset),d9()];return e.dropdownVisible&&n!=="test"&&e.preventPositionChangeWhenVisible&&(r.flip=!1),r.shift&&o.push(mb(typeof r.shift=="boolean"?{limiter:cE(),padding:5}:{limiter:cE(),padding:5,...r.shift})),r.flip&&o.push(typeof r.flip=="boolean"?cp():cp(r.flip)),r.inline&&o.push(typeof r.inline=="boolean"?ld():ld(r.inline)),o.push(U2({element:e.arrowRef,padding:e.arrowOffset})),(r.size||e.width==="target")&&o.push(u9({...typeof r.size=="boolean"?{}:r.size,apply({rects:s,availableWidth:c,availableHeight:d,...f}){const m=t().refs.floating.current?.style??{};r.size&&(typeof r.size=="object"&&r.size.apply?r.size.apply({rects:s,availableWidth:c,availableHeight:d,...f}):Object.assign(m,{maxWidth:`${c}px`,maxHeight:`${d}px`})),e.width==="target"&&Object.assign(m,{width:`${s.reference.width}px`})}})),o}function nL(e){const t=Vp(),[n,r]=or({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),o=v.useRef(n),s=()=>{n&&!e.disabled&&r(!1)},c=()=>{e.disabled||r(!n)},d=xb({strategy:e.strategy,placement:e.preventPositionChangeWhenVisible?e.positionRef.current:e.position,middleware:tL(e,()=>d,t),whileElementsMounted:e.keepMounted?void 0:dx});return v.useEffect(()=>{if(!(!d.refs.reference.current||!d.refs.floating.current)&&n)return dx(d.refs.reference.current,d.refs.floating.current,d.update)},[n,d.update]),tl(()=>{e.onPositionChange?.(d.placement),e.positionRef.current=d.placement},[d.placement,e.preventPositionChangeWhenVisible]),tl(()=>{n!==o.current&&(n?e.onOpen?.():e.onClose?.()),o.current=n},[n,e.onClose,e.onOpen]),tl(()=>{let f=-1;return n&&(f=window.setTimeout(()=>e.setDropdownVisible(!0),4)),()=>{window.clearTimeout(f)}},[n,e.position]),{floating:d,controlled:typeof e.opened=="boolean",opened:n,onClose:s,onToggle:c}}const rL={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,hideDetached:!0,clickOutsideEvents:["mousedown","touchstart"],zIndex:hi("popover"),__staticSelector:"Popover",width:"max-content"},iL=(e,{radius:t,shadow:n})=>({dropdown:{"--popover-radius":t===void 0?void 0:Ft(t),"--popover-shadow":eb(n)}});function Kr(e){const t=ae("Popover",rL,e),{children:n,position:r,offset:o,onPositionChange:s,positionDependencies:c,opened:d,transitionProps:f,onExitTransitionEnd:p,onEnterTransitionEnd:m,width:g,middlewares:y,withArrow:b,arrowSize:w,arrowOffset:j,arrowRadius:C,arrowPosition:R,unstyled:T,classNames:E,styles:_,closeOnClickOutside:k,withinPortal:L,portalProps:A,closeOnEscape:N,clickOutsideEvents:U,trapFocus:B,onClose:Q,onDismiss:J,onOpen:Z,onChange:$,zIndex:W,radius:M,shadow:I,id:z,defaultOpened:F,__staticSelector:X,withRoles:O,disabled:H,returnFocus:oe,variant:ue,keepMounted:Se,vars:ge,floatingStrategy:Pe,withOverlay:rt,overlayProps:Ce,hideDetached:ht,attributes:lt,preventPositionChangeWhenVisible:vt,...it}=t,wt=ze({name:X,props:t,classes:u_,classNames:E,styles:_,unstyled:T,attributes:lt,rootSelector:"dropdown",vars:ge,varsResolver:iL}),{resolvedStyles:pt}=vl({classNames:E,styles:_,props:t}),[It,_e]=v.useState(d??F??!1),Ee=v.useRef(r),Le=v.useRef(null),[Ne,ct]=v.useState(null),[et,at]=v.useState(null),{dir:ve}=ps(),pe=Vp(),Oe=hr(z),tt=nL({middlewares:y,width:g,position:o_(ve,r),offset:typeof o=="number"?o+(b?w/2:0):o,arrowRef:Le,arrowOffset:j,onPositionChange:s,positionDependencies:c,opened:d,defaultOpened:F,onChange:$,onOpen:Z,onClose:Q,onDismiss:J,strategy:Pe,dropdownVisible:It,setDropdownVisible:_e,positionRef:Ee,disabled:H,preventPositionChangeWhenVisible:vt,keepMounted:Se});lM(()=>{k&&(tt.onClose(),J?.())},U,[Ne,et]);const Tt=v.useCallback(Wn=>{ct(Wn),tt.floating.refs.setReference(Wn)},[tt.floating.refs.setReference]),Cn=v.useCallback(Wn=>{at(Wn),tt.floating.refs.setFloating(Wn)},[tt.floating.refs.setFloating]),gn=v.useCallback(()=>{f?.onExited?.(),p?.(),_e(!1),vt||(Ee.current=r)},[f?.onExited,p,vt,r]),$n=v.useCallback(()=>{f?.onEntered?.(),m?.()},[f?.onEntered,m]);return a.jsxs(J9,{value:{returnFocus:oe,disabled:H,controlled:tt.controlled,reference:Tt,floating:Cn,x:tt.floating.x,y:tt.floating.y,arrowX:tt.floating?.middlewareData?.arrow?.x,arrowY:tt.floating?.middlewareData?.arrow?.y,opened:tt.opened,arrowRef:Le,transitionProps:{...f,onExited:gn,onEntered:$n},width:g,withArrow:b,arrowSize:w,arrowOffset:j,arrowRadius:C,arrowPosition:R,placement:tt.floating.placement,trapFocus:B,withinPortal:L,portalProps:A,zIndex:W,radius:M,shadow:I,closeOnEscape:N,onDismiss:J,onClose:tt.onClose,onToggle:tt.onToggle,getTargetId:()=>`${Oe}-target`,getDropdownId:()=>`${Oe}-dropdown`,withRoles:O,targetProps:it,__staticSelector:X,classNames:E,styles:_,unstyled:T,variant:ue,keepMounted:Se,getStyles:wt,resolvedStyles:pt,floatingStrategy:Pe,referenceHidden:ht&&pe!=="test"?tt.floating.middlewareData.hide?.referenceHidden:!1},children:[n,rt&&a.jsx(eo,{transition:"fade",mounted:tt.opened,duration:f?.duration||250,exitDuration:f?.exitDuration||250,children:Wn=>a.jsx(pa,{withinPortal:L,children:a.jsx(Oc,{...Ce,...wt("overlay",{className:Ce?.className,style:[Wn,Ce?.style]})})})})]})}Kr.Target=d_;Kr.Dropdown=jb;Kr.displayName="@mantine/core/Popover";Kr.extend=e=>e;var Ki={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 f_=v.forwardRef(({className:e,...t},n)=>a.jsxs(de,{component:"span",className:$t(Ki.barsLoader,e),...t,ref:n,children:[a.jsx("span",{className:Ki.bar}),a.jsx("span",{className:Ki.bar}),a.jsx("span",{className:Ki.bar})]}));f_.displayName="@mantine/core/Bars";const h_=v.forwardRef(({className:e,...t},n)=>a.jsxs(de,{component:"span",className:$t(Ki.dotsLoader,e),...t,ref:n,children:[a.jsx("span",{className:Ki.dot}),a.jsx("span",{className:Ki.dot}),a.jsx("span",{className:Ki.dot})]}));h_.displayName="@mantine/core/Dots";const p_=v.forwardRef(({className:e,...t},n)=>a.jsx(de,{component:"span",className:$t(Ki.ovalLoader,e),...t,ref:n}));p_.displayName="@mantine/core/Oval";const m_={bars:f_,oval:p_,dots:h_},oL={loaders:m_,type:"oval"},aL=(e,{size:t,color:n})=>({root:{"--loader-size":st(t,"loader-size"),"--loader-color":n?Qt(n,e):void 0}}),Or=be((e,t)=>{const n=ae("Loader",oL,e),{size:r,color:o,type:s,vars:c,className:d,style:f,classNames:p,styles:m,unstyled:g,loaders:y,variant:b,children:w,attributes:j,...C}=n,R=ze({name:"Loader",props:n,classes:Ki,className:d,style:f,classNames:p,styles:m,unstyled:g,attributes:j,vars:c,varsResolver:aL});return w?a.jsx(de,{...R("root"),ref:t,...C,children:w}):a.jsx(de,{...R("root"),ref:t,component:y[s],variant:b,size:r,...C})});Or.defaultLoaders=m_;Or.classes=Ki;Or.displayName="@mantine/core/Loader";var Wc={root:"m_8d3f4000",icon:"m_8d3afb97",loader:"m_302b9fb1",group:"m_1a0f1b21",groupSection:"m_437b6484"};const bE={orientation:"horizontal"},sL=(e,{borderWidth:t})=>({group:{"--ai-border-width":le(t)}}),Cb=be((e,t)=>{const n=ae("ActionIconGroup",bE,e),{className:r,style:o,classNames:s,styles:c,unstyled:d,orientation:f,vars:p,borderWidth:m,variant:g,mod:y,attributes:b,...w}=ae("ActionIconGroup",bE,e),j=ze({name:"ActionIconGroup",props:n,classes:Wc,className:r,style:o,classNames:s,styles:c,unstyled:d,attributes:b,vars:p,varsResolver:sL,rootSelector:"group"});return a.jsx(de,{...j("group"),ref:t,variant:g,mod:[{"data-orientation":f},y],role:"group",...w})});Cb.classes=Wc;Cb.displayName="@mantine/core/ActionIconGroup";const lL=(e,{radius:t,color:n,gradient:r,variant:o,autoContrast:s,size:c})=>{const d=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:s});return{groupSection:{"--section-height":st(c,"section-height"),"--section-padding-x":st(c,"section-padding-x"),"--section-fz":Hn(c),"--section-radius":t===void 0?void 0:Ft(t),"--section-bg":n||o?d.background:void 0,"--section-color":d.color,"--section-bd":n||o?d.border:void 0}}},Eb=be((e,t)=>{const n=ae("ActionIconGroupSection",null,e),{className:r,style:o,classNames:s,styles:c,unstyled:d,vars:f,variant:p,gradient:m,radius:g,autoContrast:y,attributes:b,...w}=n,j=ze({name:"ActionIconGroupSection",props:n,classes:Wc,className:r,style:o,classNames:s,styles:c,unstyled:d,attributes:b,vars:f,varsResolver:lL,rootSelector:"groupSection"});return a.jsx(de,{...j("groupSection"),ref:t,variant:p,...w})});Eb.classes=Wc;Eb.displayName="@mantine/core/ActionIconGroupSection";const cL=(e,{size:t,radius:n,variant:r,gradient:o,color:s,autoContrast:c})=>{const d=e.variantColorResolver({color:s||e.primaryColor,theme:e,gradient:o,variant:r||"filled",autoContrast:c});return{root:{"--ai-size":st(t,"ai-size"),"--ai-radius":n===void 0?void 0:Ft(n),"--ai-bg":s||r?d.background:void 0,"--ai-hover":s||r?d.hover:void 0,"--ai-hover-color":s||r?d.hoverColor:void 0,"--ai-color":d.color,"--ai-bd":s||r?d.border:void 0}}},Rn=pr((e,t)=>{const n=ae("ActionIcon",null,e),{className:r,unstyled:o,variant:s,classNames:c,styles:d,style:f,loading:p,loaderProps:m,size:g,color:y,radius:b,__staticSelector:w,gradient:j,vars:C,children:R,disabled:T,"data-disabled":E,autoContrast:_,mod:k,attributes:L,...A}=n,N=ze({name:["ActionIcon",w],props:n,className:r,style:f,classes:Wc,classNames:c,styles:d,unstyled:o,attributes:L,vars:C,varsResolver:cL});return a.jsxs(ar,{...N("root",{active:!T&&!p&&!E}),...A,unstyled:o,variant:s,size:g,disabled:T||p,ref:t,mod:[{loading:p,disabled:T||E},k],children:[typeof p=="boolean"&&a.jsx(eo,{mounted:p,transition:"slide-down",duration:150,children:U=>a.jsx(de,{component:"span",...N("loader",{style:U}),"aria-hidden":!0,children:a.jsx(Or,{color:"var(--ai-color)",size:"calc(var(--ai-size) * 0.55)",...m})})}),a.jsx(de,{component:"span",mod:{loading:p},...N("icon"),children:R})]})});Rn.classes=Wc;Rn.displayName="@mantine/core/ActionIcon";Rn.Group=Cb;Rn.GroupSection=Eb;const g_=v.forwardRef(({size:e="var(--cb-icon-size, 70%)",style:t,...n},r)=>a.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...t,width:e,height:e},ref:r,...n,children:a.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}));g_.displayName="@mantine/core/CloseIcon";var v_={root:"m_86a44da5","root--subtle":"m_220c80f2"};const uL={variant:"subtle"},dL=(e,{size:t,radius:n,iconSize:r})=>({root:{"--cb-size":st(t,"cb-size"),"--cb-radius":n===void 0?void 0:Ft(n),"--cb-icon-size":le(r)}}),ms=pr((e,t)=>{const n=ae("CloseButton",uL,e),{iconSize:r,children:o,vars:s,radius:c,className:d,classNames:f,style:p,styles:m,unstyled:g,"data-disabled":y,disabled:b,variant:w,icon:j,mod:C,attributes:R,__staticSelector:T,...E}=n,_=ze({name:T||"CloseButton",props:n,className:d,style:p,classes:v_,classNames:f,styles:m,unstyled:g,attributes:R,vars:s,varsResolver:dL});return a.jsxs(ar,{ref:t,...E,unstyled:g,variant:w,disabled:b,mod:[{disabled:b||y},C],..._("root",{variant:w,active:!b&&!y}),children:[j||a.jsx(g_,{}),o]})});ms.classes=v_;ms.displayName="@mantine/core/CloseButton";function fL(e){return v.Children.toArray(e).filter(Boolean)}var y_={root:"m_4081bf90"};const hL={preventGrowOverflow:!0,gap:"md",align:"center",justify:"flex-start",wrap:"wrap"},pL=(e,{grow:t,preventGrowOverflow:n,gap:r,align:o,justify:s,wrap:c},{childWidth:d})=>({root:{"--group-child-width":t&&n?d:void 0,"--group-gap":Fn(r),"--group-align":o,"--group-justify":s,"--group-wrap":c}}),xe=be((e,t)=>{const n=ae("Group",hL,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,children:f,gap:p,align:m,justify:g,wrap:y,grow:b,preventGrowOverflow:w,vars:j,variant:C,__size:R,mod:T,attributes:E,..._}=n,k=fL(f),L=k.length,A=Fn(p??"md"),U={childWidth:`calc(${100/L}% - (${A} - ${A} / ${L}))`},B=ze({name:"Group",props:n,stylesCtx:U,className:o,style:s,classes:y_,classNames:r,styles:c,unstyled:d,attributes:E,vars:j,varsResolver:pL});return a.jsx(de,{...B("root"),ref:t,variant:C,mod:[{grow:b},T],size:R,..._,children:k})});xe.classes=y_;xe.displayName="@mantine/core/Group";const[mL,wa]=Mr("ModalBase component was not found in tree");function gL({opened:e,transitionDuration:t}){const[n,r]=v.useState(e),o=v.useRef(-1),c=nb()?0:t;return v.useEffect(()=>(e?(r(!0),window.clearTimeout(o.current)):c===0?r(!1):o.current=window.setTimeout(()=>r(!1),c),()=>window.clearTimeout(o.current)),[e,c]),n}function vL({id:e,transitionProps:t,opened:n,trapFocus:r,closeOnEscape:o,onClose:s,returnFocus:c}){const d=hr(e),[f,p]=v.useState(!1),[m,g]=v.useState(!1),y=typeof t?.duration=="number"?t?.duration:200,b=gL({opened:n,transitionDuration:y});return p2("keydown",w=>{w.key==="Escape"&&o&&!w.isComposing&&n&&w.target?.getAttribute("data-mantine-stop-propagation")!=="true"&&s()},{capture:!0}),u2({opened:n,shouldReturnFocus:r&&c}),{_id:d,titleMounted:f,bodyMounted:m,shouldLockScroll:b,setTitleMounted:p,setBodyMounted:g}}const x_=v.forwardRef(({keepMounted:e,opened:t,onClose:n,id:r,transitionProps:o,onExitTransitionEnd:s,onEnterTransitionEnd:c,trapFocus:d,closeOnEscape:f,returnFocus:p,closeOnClickOutside:m,withinPortal:g,portalProps:y,lockScroll:b,children:w,zIndex:j,shadow:C,padding:R,__vars:T,unstyled:E,removeScrollProps:_,...k},L)=>{const{_id:A,titleMounted:N,bodyMounted:U,shouldLockScroll:B,setTitleMounted:Q,setBodyMounted:J}=vL({id:r,transitionProps:o,opened:t,trapFocus:d,closeOnEscape:f,onClose:n,returnFocus:p}),{key:Z,...$}=_||{};return a.jsx(pa,{...y,withinPortal:g,children:a.jsx(mL,{value:{opened:t,onClose:n,closeOnClickOutside:m,onExitTransitionEnd:s,onEnterTransitionEnd:c,transitionProps:{...o,keepMounted:e},getTitleId:()=>`${A}-title`,getBodyId:()=>`${A}-body`,titleMounted:N,bodyMounted:U,setTitleMounted:Q,setBodyMounted:J,trapFocus:d,closeOnEscape:f,zIndex:j,unstyled:E},children:a.jsx(il,{enabled:B&&b,...$,children:a.jsx(de,{ref:L,...k,__vars:{...T,"--mb-z-index":(j||hi("modal")).toString(),"--mb-shadow":eb(C),"--mb-padding":Fn(R)},children:w})},Z)})})});x_.displayName="@mantine/core/ModalBase";function yL(){const e=wa();return v.useEffect(()=>(e.setBodyMounted(!0),()=>e.setBodyMounted(!1)),[]),e.getBodyId()}var Mc={title:"m_615af6c9",header:"m_b5489c3c",inner:"m_60c222c7",content:"m_fd1ab0aa",close:"m_606cb269",body:"m_5df29311"};const b_=v.forwardRef(({className:e,...t},n)=>{const r=yL(),o=wa();return a.jsx(de,{ref:n,...t,id:r,className:$t({[Mc.body]:!o.unstyled},e)})});b_.displayName="@mantine/core/ModalBaseBody";const S_=v.forwardRef(({className:e,onClick:t,...n},r)=>{const o=wa();return a.jsx(ms,{ref:r,...n,onClick:s=>{o.onClose(),t?.(s)},className:$t({[Mc.close]:!o.unstyled},e),unstyled:o.unstyled})});S_.displayName="@mantine/core/ModalBaseCloseButton";const w_=v.forwardRef(({transitionProps:e,className:t,innerProps:n,onKeyDown:r,style:o,...s},c)=>{const d=wa();return a.jsx(eo,{mounted:d.opened,transition:"pop",...d.transitionProps,onExited:()=>{d.onExitTransitionEnd?.(),d.transitionProps?.onExited?.()},onEntered:()=>{d.onEnterTransitionEnd?.(),d.transitionProps?.onEntered?.()},...e,children:f=>a.jsx("div",{...n,className:$t({[Mc.inner]:!d.unstyled},n.className),children:a.jsx(Xp,{active:d.opened&&d.trapFocus,innerRef:c,children:a.jsx(Pr,{...s,component:"section",role:"dialog",tabIndex:-1,"aria-modal":!0,"aria-describedby":d.bodyMounted?d.getBodyId():void 0,"aria-labelledby":d.titleMounted?d.getTitleId():void 0,style:[o,f],className:$t({[Mc.content]:!d.unstyled},t),unstyled:d.unstyled,children:s.children})})})})});w_.displayName="@mantine/core/ModalBaseContent";const j_=v.forwardRef(({className:e,...t},n)=>{const r=wa();return a.jsx(de,{component:"header",ref:n,className:$t({[Mc.header]:!r.unstyled},e),...t})});j_.displayName="@mantine/core/ModalBaseHeader";const xL={duration:200,timingFunction:"ease",transition:"fade"};function bL(e){const t=wa();return{...xL,...t.transitionProps,...e}}const C_=v.forwardRef(({onClick:e,transitionProps:t,style:n,visible:r,...o},s)=>{const c=wa(),d=bL(t);return a.jsx(eo,{mounted:r!==void 0?r:c.opened,...d,transition:"fade",children:f=>a.jsx(Oc,{ref:s,fixed:!0,style:[n,f],zIndex:c.zIndex,unstyled:c.unstyled,onClick:p=>{e?.(p),c.closeOnClickOutside&&c.onClose()},...o})})});C_.displayName="@mantine/core/ModalBaseOverlay";function SL(){const e=wa();return v.useEffect(()=>(e.setTitleMounted(!0),()=>e.setTitleMounted(!1)),[]),e.getTitleId()}const E_=v.forwardRef(({className:e,...t},n)=>{const r=SL(),o=wa();return a.jsx(de,{component:"h2",ref:n,className:$t({[Mc.title]:!o.unstyled},e),...t,id:r})});E_.displayName="@mantine/core/ModalBaseTitle";function wL({children:e}){return a.jsx(a.Fragment,{children:e})}const[jL,CL]=No({size:"sm"}),T_=be((e,t)=>{const n=ae("InputClearButton",null,e),{size:r,variant:o,vars:s,classNames:c,styles:d,...f}=n,p=CL(),{resolvedClassNames:m,resolvedStyles:g}=vl({classNames:c,styles:d,props:n});return a.jsx(ms,{variant:o||"transparent",ref:t,size:r||p?.size||"sm",classNames:m,styles:g,__staticSelector:"InputClearButton",style:{pointerEvents:"all",background:"var(--input-bg)",...f.style},...f})});T_.displayName="@mantine/core/InputClearButton";const EL={xs:7,sm:8,md:10,lg:12,xl:15};function TL({__clearable:e,__clearSection:t,rightSection:n,__defaultRightSection:r,size:o="sm"}){const s=e&&t;return s&&(n||r)?a.jsxs("div",{"data-combined-clear-section":!0,style:{display:"flex",gap:2,alignItems:"center",paddingInlineEnd:EL[o]},children:[s,n||r]}):n===null?null:n||s||r}const[RL,Qc]=No({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0});var Mi={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 _L=(e,{size:t})=>({description:{"--input-description-size":t===void 0?void 0:`calc(${Hn(t)} - ${le(2)})`}}),Jp=be((e,t)=>{const n=ae("InputDescription",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,size:p,__staticSelector:m,__inheritStyles:g=!0,attributes:y,variant:b,...w}=ae("InputDescription",null,n),j=Qc(),C=ze({name:["InputWrapper",m],props:n,classes:Mi,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:y,rootSelector:"description",vars:f,varsResolver:_L}),R=g&&j?.getStyles||C;return a.jsx(de,{component:"p",ref:t,variant:b,size:p,...R("description",j?.getStyles?{className:o,style:s}:void 0),...w})});Jp.classes=Mi;Jp.displayName="@mantine/core/InputDescription";const DL=(e,{size:t})=>({error:{"--input-error-size":t===void 0?void 0:`calc(${Hn(t)} - ${le(2)})`}}),Zp=be((e,t)=>{const n=ae("InputError",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,size:p,attributes:m,__staticSelector:g,__inheritStyles:y=!0,variant:b,...w}=n,j=ze({name:["InputWrapper",g],props:n,classes:Mi,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:m,rootSelector:"error",vars:f,varsResolver:DL}),C=Qc(),R=y&&C?.getStyles||j;return a.jsx(de,{component:"p",ref:t,variant:b,size:p,...R("error",C?.getStyles?{className:o,style:s}:void 0),...w})});Zp.classes=Mi;Zp.displayName="@mantine/core/InputError";const SE={labelElement:"label"},AL=(e,{size:t})=>({label:{"--input-label-size":Hn(t),"--input-asterisk-color":void 0}}),Pd=be((e,t)=>{const n=ae("InputLabel",SE,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,labelElement:p,size:m,required:g,htmlFor:y,onMouseDown:b,children:w,__staticSelector:j,variant:C,mod:R,attributes:T,...E}=ae("InputLabel",SE,n),_=ze({name:["InputWrapper",j],props:n,classes:Mi,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:T,rootSelector:"label",vars:f,varsResolver:AL}),k=Qc(),L=k?.getStyles||_;return a.jsxs(de,{...L("label",k?.getStyles?{className:o,style:s}:void 0),component:p,variant:C,size:m,ref:t,htmlFor:p==="label"?y:void 0,mod:[{required:g},R],onMouseDown:A=>{b?.(A),!A.defaultPrevented&&A.detail>1&&A.preventDefault()},...E,children:[w,g&&a.jsx("span",{...L("required"),"aria-hidden":!0,children:" *"})]})});Pd.classes=Mi;Pd.displayName="@mantine/core/InputLabel";const Tb=be((e,t)=>{const n=ae("InputPlaceholder",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,__staticSelector:p,variant:m,error:g,mod:y,attributes:b,...w}=n,j=ze({name:["InputPlaceholder",p],props:n,classes:Mi,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:b,rootSelector:"placeholder"});return a.jsx(de,{...j("placeholder"),mod:[{error:!!g},y],component:"span",variant:m,ref:t,...w})});Tb.classes=Mi;Tb.displayName="@mantine/core/InputPlaceholder";function kL(e,{hasDescription:t,hasError:n}){const r=e.findIndex(f=>f==="input"),o=e.slice(0,r),s=e.slice(r+1),c=t&&o.includes("description")||n&&o.includes("error");return{offsetBottom:t&&s.includes("description")||n&&s.includes("error"),offsetTop:c}}const PL={labelElement:"label",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},NL=(e,{size:t})=>({label:{"--input-label-size":Hn(t),"--input-asterisk-color":void 0},error:{"--input-error-size":t===void 0?void 0:`calc(${Hn(t)} - ${le(2)})`},description:{"--input-description-size":t===void 0?void 0:`calc(${Hn(t)} - ${le(2)})`}}),Nd=be((e,t)=>{const n=ae("InputWrapper",PL,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,size:p,variant:m,__staticSelector:g,inputContainer:y,inputWrapperOrder:b,label:w,error:j,description:C,labelProps:R,descriptionProps:T,errorProps:E,labelElement:_,children:k,withAsterisk:L,id:A,required:N,__stylesApiProps:U,mod:B,attributes:Q,...J}=n,Z=ze({name:["InputWrapper",g],props:U||n,classes:Mi,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:Q,vars:f,varsResolver:NL}),$={size:p,variant:m,__staticSelector:g},W=hr(A),M=typeof L=="boolean"?L:N,I=E?.id||`${W}-error`,z=T?.id||`${W}-description`,F=W,X=!!j&&typeof j!="boolean",O=!!C,H=`${X?I:""} ${O?z:""}`,oe=H.trim().length>0?H.trim():void 0,ue=R?.id||`${W}-label`,Se=w&&a.jsx(Pd,{labelElement:_,id:ue,htmlFor:F,required:M,...$,...R,children:w},"label"),ge=O&&a.jsx(Jp,{...T,...$,size:T?.size||$.size,id:T?.id||z,children:C},"description"),Pe=a.jsx(v.Fragment,{children:y(k)},"input"),rt=X&&v.createElement(Zp,{...E,...$,size:E?.size||$.size,key:"error",id:E?.id||I},j),Ce=b.map(ht=>{switch(ht){case"label":return Se;case"input":return Pe;case"description":return ge;case"error":return rt;default:return null}});return a.jsx(RL,{value:{getStyles:Z,describedBy:oe,inputId:F,labelId:ue,...kL(b,{hasDescription:O,hasError:X})},children:a.jsx(de,{ref:t,variant:m,size:p,mod:[{error:!!j},B],...Z("root"),...J,children:Ce})})});Nd.classes=Mi;Nd.displayName="@mantine/core/InputWrapper";const OL={variant:"default",leftSectionPointerEvents:"none",rightSectionPointerEvents:"none",withAria:!0,withErrorStyles:!0,size:"sm"},ML=(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":st(t.size,"input-height"),"--input-fz":Hn(t.size),"--input-radius":t.radius===void 0?void 0:Ft(t.radius),"--input-left-section-width":t.leftSectionWidth!==void 0?le(t.leftSectionWidth):void 0,"--input-right-section-width":t.rightSectionWidth!==void 0?le(t.rightSectionWidth):void 0,"--input-padding-y":t.multiline?st(t.size,"input-padding-y"):void 0,"--input-left-section-pointer-events":t.leftSectionPointerEvents,"--input-right-section-pointer-events":t.rightSectionPointerEvents}}),mn=pr((e,t)=>{const n=ae("Input",OL,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,required:f,__staticSelector:p,__stylesApiProps:m,size:g,wrapperProps:y,error:b,disabled:w,leftSection:j,leftSectionProps:C,leftSectionWidth:R,rightSection:T,rightSectionProps:E,rightSectionWidth:_,rightSectionPointerEvents:k,leftSectionPointerEvents:L,variant:A,vars:N,pointer:U,multiline:B,radius:Q,id:J,withAria:Z,withErrorStyles:$,mod:W,inputSize:M,attributes:I,__clearSection:z,__clearable:F,__defaultRightSection:X,...O}=n,{styleProps:H,rest:oe}=Sa(O),ue=Qc(),Se={offsetBottom:ue?.offsetBottom,offsetTop:ue?.offsetTop},ge=ze({name:["Input",p],props:m||n,classes:Mi,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:I,stylesCtx:Se,rootSelector:"wrapper",vars:N,varsResolver:ML}),Pe=Z?{required:f,disabled:w,"aria-invalid":!!b,"aria-describedby":ue?.describedBy,id:ue?.inputId||J}:{},rt=TL({__clearable:F,__clearSection:z,rightSection:T,__defaultRightSection:X,size:g});return a.jsx(jL,{value:{size:g||"sm"},children:a.jsxs(de,{...ge("wrapper"),...H,...y,mod:[{error:!!b&&$,pointer:U,disabled:w,multiline:B,"data-with-right-section":!!rt,"data-with-left-section":!!j},W],variant:A,size:g,children:[j&&a.jsx("div",{...C,"data-position":"left",...ge("section",{className:C?.className,style:C?.style}),children:j}),a.jsx(de,{component:"input",...oe,...Pe,ref:t,required:f,mod:{disabled:w,error:!!b&&$},variant:A,__size:M,...ge("input")}),rt&&a.jsx("div",{...E,"data-position":"right",...ge("section",{className:E?.className,style:E?.style}),children:rt})]})})});mn.classes=Mi;mn.Wrapper=Nd;mn.Label=Pd;mn.Error=Zp;mn.Description=Jp;mn.Placeholder=Tb;mn.ClearButton=T_;mn.displayName="@mantine/core/Input";function LL(e,t,n){const r=ae(e,t,n),{label:o,description:s,error:c,required:d,classNames:f,styles:p,className:m,unstyled:g,__staticSelector:y,__stylesApiProps:b,errorProps:w,labelProps:j,descriptionProps:C,wrapperProps:R,id:T,size:E,style:_,inputContainer:k,inputWrapperOrder:L,withAsterisk:A,variant:N,vars:U,mod:B,attributes:Q,...J}=r,{styleProps:Z,rest:$}=Sa(J),W={label:o,description:s,error:c,required:d,classNames:f,className:m,__staticSelector:y,__stylesApiProps:b||r,errorProps:w,labelProps:j,descriptionProps:C,unstyled:g,styles:p,size:E,style:_,inputContainer:k,inputWrapperOrder:L,withAsterisk:A,variant:N,id:T,mod:B,attributes:Q,...R};return{...$,classNames:f,styles:p,unstyled:g,wrapperProps:{...W,...Z},inputProps:{required:d,classNames:f,styles:p,unstyled:g,size:E,__staticSelector:y,__stylesApiProps:b||r,error:c,variant:N,id:T,attributes:Q}}}const IL={__staticSelector:"InputBase",withAria:!0,size:"sm"},Lr=pr((e,t)=>{const{inputProps:n,wrapperProps:r,...o}=LL("InputBase",IL,e);return a.jsx(mn.Wrapper,{...r,children:a.jsx(mn,{...n,...o,ref:t})})});Lr.classes={...mn.classes,...mn.Wrapper.classes};Lr.displayName="@mantine/core/InputBase";const zL={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 R_={root:"m_8bffd616"};const to=pr((e,t)=>{const n=ae("Flex",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,gap:p,rowGap:m,columnGap:g,align:y,justify:b,wrap:w,direction:j,attributes:C,...R}=n,T=ze({name:"Flex",classes:R_,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:C,vars:f}),E=jn(),_=Ad(),k=S2({styleProps:{gap:p,rowGap:m,columnGap:g,align:y,justify:b,wrap:w,direction:j},theme:E,data:zL});return a.jsxs(a.Fragment,{children:[k.hasResponsiveStyles&&a.jsx(xl,{selector:`.${_}`,styles:k.styles,media:k.media}),a.jsx(de,{ref:t,...T("root",{className:_,style:hs(k.inlineStyles)}),...R})]})});to.classes=R_;to.displayName="@mantine/core/Flex";function $L(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 UL({target:e,parent:t,ref:n,displayAfterTransitionEnd:r}){const o=v.useRef(-1),[s,c]=v.useState(!1),[d,f]=v.useState(typeof r=="boolean"?r:!1),p=()=>{if(!e||!t||!n.current)return;const b=e.getBoundingClientRect(),w=t.getBoundingClientRect(),j=window.getComputedStyle(e),C=window.getComputedStyle(t),R=as(j.borderTopWidth)+as(C.borderTopWidth),T=as(j.borderLeftWidth)+as(C.borderLeftWidth),E={top:b.top-w.top-R,left:b.left-w.left-T,width:b.width,height:b.height};n.current.style.transform=`translateY(${E.top}px) translateX(${E.left}px)`,n.current.style.width=`${E.width}px`,n.current.style.height=`${E.height}px`},m=()=>{window.clearTimeout(o.current),n.current&&(n.current.style.transitionDuration="0ms"),p(),o.current=window.setTimeout(()=>{n.current&&(n.current.style.transitionDuration="")},30)},g=v.useRef(null),y=v.useRef(null);return v.useEffect(()=>{if(p(),e)return g.current=new ResizeObserver(m),g.current.observe(e),t&&(y.current=new ResizeObserver(m),y.current.observe(t)),()=>{g.current?.disconnect(),y.current?.disconnect()}},[t,e]),v.useEffect(()=>{if(t){const b=w=>{$L(w.target,t)&&(m(),f(!1))};return t.addEventListener("transitionend",b),()=>{t.removeEventListener("transitionend",b)}}},[t]),RM(()=>{m2()!=="test"&&c(!0)},20,{autoInvoke:!0}),_M(b=>{b.forEach(w=>{w.type==="attributes"&&w.attributeName==="dir"&&m()})},{attributes:!0,attributeFilter:["dir"]},()=>document.documentElement),{initialized:s,hidden:d}}var __={root:"m_96b553a6"};const BL=(e,{transitionDuration:t})=>({root:{"--transition-duration":typeof t=="number"?`${t}ms`:t}}),Rb=be((e,t)=>{const n=ae("FloatingIndicator",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,target:p,parent:m,transitionDuration:g,mod:y,displayAfterTransitionEnd:b,attributes:w,...j}=n,C=ze({name:"FloatingIndicator",classes:__,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:w,vars:f,varsResolver:BL}),R=v.useRef(null),{initialized:T,hidden:E}=UL({target:p,parent:m,ref:R,displayAfterTransitionEnd:b}),_=zn(t,R);return!p||!m?null:a.jsx(de,{ref:_,mod:[{initialized:T,hidden:E},y],...C("root"),...j})});Rb.displayName="@mantine/core/FloatingIndicator";Rb.classes=__;function D_({open:e,close:t,openDelay:n,closeDelay:r}){const o=v.useRef(-1),s=v.useRef(-1),c=()=>{window.clearTimeout(o.current),window.clearTimeout(s.current)},d=()=>{c(),n===0||n===void 0?e():o.current=window.setTimeout(e,n)},f=()=>{c(),r===0||r===void 0?t():s.current=window.setTimeout(t,r)};return v.useEffect(()=>c,[]),{openDropdown:d,closeDropdown:f}}function A_({style:e,size:t=16,...n}){return a.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...e,width:le(t),height:le(t),display:"block"},...n,children:a.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}A_.displayName="@mantine/core/AccordionChevron";var k_={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 VL=(e,{radius:t,color:n,variant:r,autoContrast:o})=>{const s=e.variantColorResolver({color:n||e.primaryColor,theme:e,variant:r||"light",autoContrast:o});return{root:{"--alert-radius":t===void 0?void 0:Ft(t),"--alert-bg":n||r?s.background:void 0,"--alert-color":s.color,"--alert-bd":n||r?s.border:void 0}}},Mo=be((e,t)=>{const n=ae("Alert",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,radius:p,color:m,title:g,children:y,id:b,icon:w,withCloseButton:j,onClose:C,closeButtonLabel:R,variant:T,autoContrast:E,attributes:_,...k}=n,L=ze({name:"Alert",classes:k_,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:_,vars:f,varsResolver:VL}),A=hr(b),N=g&&`${A}-title`||void 0,U=`${A}-body`;return a.jsx(de,{id:A,...L("root",{variant:T}),variant:T,ref:t,...k,role:"alert","aria-describedby":y?U:void 0,"aria-labelledby":g?N:void 0,children:a.jsxs("div",{...L("wrapper"),children:[w&&a.jsx("div",{...L("icon"),children:w}),a.jsxs("div",{...L("body"),children:[g&&a.jsx("div",{...L("title"),"data-with-close-button":j||void 0,children:a.jsx("span",{id:N,...L("label"),children:g})}),y&&a.jsx("div",{id:U,...L("message"),"data-variant":T,children:y})]}),j&&a.jsx(ms,{...L("closeButton"),onClick:C,variant:"transparent",size:16,iconSize:16,"aria-label":R,unstyled:d})]})})});Mo.classes=k_;Mo.displayName="@mantine/core/Alert";var P_={root:"m_b6d8b162"};function FL(e){if(e==="start")return"start";if(e==="end"||e)return"end"}const HL={inherit:!1},qL=(e,{variant:t,lineClamp:n,gradient:r,size:o,color:s})=>({root:{"--text-fz":Hn(o),"--text-lh":s2(o),"--text-gradient":t==="gradient"?rx(r,e):void 0,"--text-line-clamp":typeof n=="number"?n.toString():void 0,"--text-color":s?Qt(s,e):void 0}}),Te=pr((e,t)=>{const n=ae("Text",HL,e),{lineClamp:r,truncate:o,inline:s,inherit:c,gradient:d,span:f,__staticSelector:p,vars:m,className:g,style:y,classNames:b,styles:w,unstyled:j,variant:C,mod:R,size:T,attributes:E,..._}=n,k=ze({name:["Text",p],props:n,classes:P_,className:g,style:y,classNames:b,styles:w,unstyled:j,attributes:E,vars:m,varsResolver:qL});return a.jsx(de,{...k("root",{focusable:!0}),ref:t,component:f?"span":"p",variant:C,mod:[{"data-truncate":FL(o),"data-line-clamp":typeof r=="number","data-inline":s,"data-inherit":c},R],size:T,..._})});Te.classes=P_;Te.displayName="@mantine/core/Text";var N_={root:"m_849cf0da"};const GL={underline:"hover"},Mt=pr((e,t)=>{const{underline:n,className:r,unstyled:o,mod:s,...c}=ae("Anchor",GL,e);return a.jsx(Te,{component:"a",ref:t,className:$t({[N_.root]:!o},r),...c,mod:[{underline:n},s],__staticSelector:"Anchor",unstyled:o})});Mt.classes=N_;Mt.displayName="@mantine/core/Anchor";const[WL,Yc]=Mr("AppShell was not found in tree");var gs={root:"m_89ab340",navbar:"m_45252eee",aside:"m_9cdde9a",header:"m_3b16f56b",main:"m_8983817",footer:"m_3840c879",section:"m_6dcfc7c7"};const _b=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,unstyled:c,vars:d,withBorder:f,zIndex:p,mod:m,...g}=ae("AppShellAside",null,e),y=Yc();return y.disabled?null:a.jsx(de,{component:"aside",ref:t,mod:[{"with-border":f??y.withBorder},m],...y.getStyles("aside",{className:$t({[il.classNames.zeroRight]:y.offsetScrollbars},r),classNames:n,styles:s,style:o}),...g,__vars:{"--app-shell-aside-z-index":`calc(${p??y.zIndex} + 1)`}})});_b.classes=gs;_b.displayName="@mantine/core/AppShellAside";const Db=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,unstyled:c,vars:d,withBorder:f,zIndex:p,mod:m,...g}=ae("AppShellFooter",null,e),y=Yc();return y.disabled?null:a.jsx(de,{component:"footer",ref:t,mod:[{"with-border":f??y.withBorder},m],...y.getStyles("footer",{className:$t({[il.classNames.zeroRight]:y.offsetScrollbars},r),classNames:n,styles:s,style:o}),...g,__vars:{"--app-shell-footer-z-index":(p??y.zIndex)?.toString()}})});Db.classes=gs;Db.displayName="@mantine/core/AppShellFooter";const Ab=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,unstyled:c,vars:d,withBorder:f,zIndex:p,mod:m,...g}=ae("AppShellHeader",null,e),y=Yc();return y.disabled?null:a.jsx(de,{component:"header",ref:t,mod:[{"with-border":f??y.withBorder},m],...y.getStyles("header",{className:$t({[il.classNames.zeroRight]:y.offsetScrollbars},r),classNames:n,styles:s,style:o}),...g,__vars:{"--app-shell-header-z-index":(p??y.zIndex)?.toString()}})});Ab.classes=gs;Ab.displayName="@mantine/core/AppShellHeader";const kb=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,...d}=ae("AppShellMain",null,e),f=Yc();return a.jsx(de,{component:"main",ref:t,...f.getStyles("main",{className:r,style:o,classNames:n,styles:s}),...d})});kb.classes=gs;kb.displayName="@mantine/core/AppShellMain";function Od(e){return typeof e=="object"?e.base:e}function Md(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 Ld(e){return!(typeof e!="object"||e===null||Object.keys(e).length===1&&"base"in e)}function QL({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,aside:r,theme:o}){const s=r?.width,c="translateX(var(--app-shell-aside-width))",d="translateX(calc(var(--app-shell-aside-width) * -1))";if(r?.breakpoint&&!r?.collapsed?.mobile&&(n[r?.breakpoint]=n[r?.breakpoint]||{},n[r?.breakpoint]["--app-shell-aside-width"]="100%",n[r?.breakpoint]["--app-shell-aside-offset"]="0px"),Md(s)){const f=le(Od(s));e["--app-shell-aside-width"]=f,e["--app-shell-aside-offset"]=f}if(Ld(s)&&(typeof s.base<"u"&&(e["--app-shell-aside-width"]=le(s.base),e["--app-shell-aside-offset"]=le(s.base)),cn(s).forEach(f=>{f!=="base"&&(t[f]=t[f]||{},t[f]["--app-shell-aside-width"]=le(s[f]),t[f]["--app-shell-aside-offset"]=le(s[f]))})),r?.collapsed?.desktop){const f=r.breakpoint;t[f]=t[f]||{},t[f]["--app-shell-aside-transform"]=c,t[f]["--app-shell-aside-transform-rtl"]=d,t[f]["--app-shell-aside-offset"]="0px !important",t[f]["--app-shell-aside-scroll-locked-visibility"]="hidden"}if(r?.collapsed?.mobile){const f=tb(r.breakpoint,o.breakpoints)-.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"]=c,n[f]["--app-shell-aside-transform-rtl"]=d,n[f]["--app-shell-aside-scroll-locked-visibility"]="hidden"}}function YL({baseStyles:e,minMediaStyles:t,footer:n}){const r=n?.height,o="translateY(var(--app-shell-footer-height))",s=n?.offset??!0;if(Md(r)){const c=le(Od(r));e["--app-shell-footer-height"]=c,s&&(e["--app-shell-footer-offset"]=c)}Ld(r)&&(typeof r.base<"u"&&(e["--app-shell-footer-height"]=le(r.base),s&&(e["--app-shell-footer-offset"]=le(r.base))),cn(r).forEach(c=>{c!=="base"&&(t[c]=t[c]||{},t[c]["--app-shell-footer-height"]=le(r[c]),s&&(t[c]["--app-shell-footer-offset"]=le(r[c])))})),n?.collapsed&&(e["--app-shell-footer-transform"]=o,e["--app-shell-footer-offset"]="0px !important")}function KL({baseStyles:e,minMediaStyles:t,header:n}){const r=n?.height,o="translateY(calc(var(--app-shell-header-height) * -1))",s=n?.offset??!0;if(Md(r)){const c=le(Od(r));e["--app-shell-header-height"]=c,s&&(e["--app-shell-header-offset"]=c)}Ld(r)&&(typeof r.base<"u"&&(e["--app-shell-header-height"]=le(r.base),s&&(e["--app-shell-header-offset"]=le(r.base))),cn(r).forEach(c=>{c!=="base"&&(t[c]=t[c]||{},t[c]["--app-shell-header-height"]=le(r[c]),s&&(t[c]["--app-shell-header-offset"]=le(r[c])))})),n?.collapsed&&(e["--app-shell-header-transform"]=o,e["--app-shell-header-offset"]="0px !important")}function XL({baseStyles:e,minMediaStyles:t,maxMediaStyles:n,navbar:r,theme:o}){const s=r?.width,c="translateX(calc(var(--app-shell-navbar-width) * -1))",d="translateX(var(--app-shell-navbar-width))";if(r?.breakpoint&&!r?.collapsed?.mobile&&(n[r?.breakpoint]=n[r?.breakpoint]||{},n[r?.breakpoint]["--app-shell-navbar-width"]="100%",n[r?.breakpoint]["--app-shell-navbar-offset"]="0px"),Md(s)){const f=le(Od(s));e["--app-shell-navbar-width"]=f,e["--app-shell-navbar-offset"]=f}if(Ld(s)&&(typeof s.base<"u"&&(e["--app-shell-navbar-width"]=le(s.base),e["--app-shell-navbar-offset"]=le(s.base)),cn(s).forEach(f=>{f!=="base"&&(t[f]=t[f]||{},t[f]["--app-shell-navbar-width"]=le(s[f]),t[f]["--app-shell-navbar-offset"]=le(s[f]))})),r?.collapsed?.desktop){const f=r.breakpoint;t[f]=t[f]||{},t[f]["--app-shell-navbar-transform"]=c,t[f]["--app-shell-navbar-transform-rtl"]=d,t[f]["--app-shell-navbar-offset"]="0px !important"}if(r?.collapsed?.mobile){const f=tb(r.breakpoint,o.breakpoints)-.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"]=c,n[f]["--app-shell-navbar-transform-rtl"]=d}}function wy(e){return Number(e)===0?"0px":Fn(e)}function JL({padding:e,baseStyles:t,minMediaStyles:n}){Md(e)&&(t["--app-shell-padding"]=wy(Od(e))),Ld(e)&&(e.base&&(t["--app-shell-padding"]=wy(e.base)),cn(e).forEach(r=>{r!=="base"&&(n[r]=n[r]||{},n[r]["--app-shell-padding"]=wy(e[r]))}))}function ZL({navbar:e,header:t,footer:n,aside:r,padding:o,theme:s}){const c={},d={},f={};XL({baseStyles:f,minMediaStyles:c,maxMediaStyles:d,navbar:e,theme:s}),QL({baseStyles:f,minMediaStyles:c,maxMediaStyles:d,aside:r,theme:s}),KL({baseStyles:f,minMediaStyles:c,header:t}),YL({baseStyles:f,minMediaStyles:c,footer:n}),JL({baseStyles:f,minMediaStyles:c,padding:o});const p=dd(cn(c),s.breakpoints).map(y=>({query:`(min-width: ${tp(y.px)})`,styles:c[y.value]})),m=dd(cn(d),s.breakpoints).map(y=>({query:`(max-width: ${tp(y.px)})`,styles:d[y.value]})),g=[...p,...m];return{baseStyles:f,media:g}}function eI({navbar:e,header:t,aside:n,footer:r,padding:o}){const s=jn(),c=xa(),{media:d,baseStyles:f}=ZL({navbar:e,header:t,footer:r,aside:n,padding:o,theme:s});return a.jsx(xl,{media:d,styles:f,selector:c.cssVariablesSelector})}const Pb=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,unstyled:c,vars:d,withBorder:f,zIndex:p,mod:m,...g}=ae("AppShellNavbar",null,e),y=Yc();return y.disabled?null:a.jsx(de,{component:"nav",ref:t,mod:[{"with-border":f??y.withBorder},m],...y.getStyles("navbar",{className:r,classNames:n,styles:s,style:o}),...g,__vars:{"--app-shell-navbar-z-index":`calc(${p??y.zIndex} + 1)`}})});Pb.classes=gs;Pb.displayName="@mantine/core/AppShellNavbar";const Nb=pr((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,grow:d,mod:f,...p}=ae("AppShellSection",null,e),m=Yc();return a.jsx(de,{ref:t,mod:[{grow:d},f],...m.getStyles("section",{className:r,style:o,classNames:n,styles:s}),...p})});Nb.classes=gs;Nb.displayName="@mantine/core/AppShellSection";function tI({transitionDuration:e,disabled:t}){const[n,r]=v.useState(!0),o=v.useRef(-1),s=v.useRef(-1);return p2("resize",()=>{r(!0),clearTimeout(o.current),o.current=window.setTimeout(()=>v.startTransition(()=>{r(!1)}),200)}),Fc(()=>{r(!0),clearTimeout(s.current),s.current=window.setTimeout(()=>v.startTransition(()=>{r(!1)}),e||0)},[t,e]),n}const nI={withBorder:!0,padding:0,transitionDuration:200,transitionTimingFunction:"ease",zIndex:hi("app")},rI=(e,{transitionDuration:t,transitionTimingFunction:n})=>({root:{"--app-shell-transition-duration":`${t}ms`,"--app-shell-transition-timing-function":n}}),Qr=be((e,t)=>{const n=ae("AppShell",nI,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,navbar:p,withBorder:m,padding:g,transitionDuration:y,transitionTimingFunction:b,header:w,zIndex:j,layout:C,disabled:R,aside:T,footer:E,offsetScrollbars:_=!0,mod:k,attributes:L,...A}=n,N=ze({name:"AppShell",classes:gs,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:L,vars:f,varsResolver:rI}),U=tI({disabled:R,transitionDuration:y});return a.jsxs(WL,{value:{getStyles:N,withBorder:m,zIndex:j,disabled:R,offsetScrollbars:_},children:[a.jsx(eI,{navbar:p,header:w,aside:T,footer:E,padding:g}),a.jsx(de,{ref:t,...N("root"),mod:[{resizing:U,layout:C,disabled:R},k],...A})]})});Qr.classes=gs;Qr.displayName="@mantine/core/AppShell";Qr.Navbar=Pb;Qr.Header=Ab;Qr.Main=kb;Qr.Aside=_b;Qr.Footer=Db;Qr.Section=Nb;function O_(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=>O_(t))}:e}function M_(e){return e?e.map(t=>O_(t)):[]}function L_(e){return e.reduce((t,n)=>"group"in n?{...t,...L_(n.items)}:(t[n.value]=n,t),{})}var Yr={dropdown:"m_88b62a41",search:"m_985517d8",options:"m_b2821a6e",option:"m_92253aa5",empty:"m_2530cd1d",header:"m_858f94bd",footer:"m_82b967cb",group:"m_254f3e4f",groupLabel:"m_2bb2e9e5",chevron:"m_2943220b",optionsDropdownOption:"m_390b5f4",optionsDropdownCheckIcon:"m_8ee53fc2"};const iI={error:null},oI=(e,{size:t,color:n})=>({chevron:{"--combobox-chevron-size":st(t,"combobox-chevron-size"),"--combobox-chevron-color":n?Qt(n,e):void 0}}),em=be((e,t)=>{const n=ae("ComboboxChevron",iI,e),{size:r,error:o,style:s,className:c,classNames:d,styles:f,unstyled:p,vars:m,mod:g,...y}=n,b=ze({name:"ComboboxChevron",classes:Yr,props:n,style:s,className:c,classNames:d,styles:f,unstyled:p,vars:m,varsResolver:oI,rootSelector:"chevron"});return a.jsx(de,{component:"svg",...y,...b("chevron"),size:r,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",mod:["combobox-chevron",{error:o},g],ref:t,children:a.jsx("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})});em.classes=Yr;em.displayName="@mantine/core/ComboboxChevron";const[aI,Li]=Mr("Combobox component was not found in tree"),I_=v.forwardRef(({size:e,onMouseDown:t,onClick:n,onClear:r,...o},s)=>a.jsx(mn.ClearButton,{ref:s,tabIndex:-1,"aria-hidden":!0,...o,onMouseDown:c=>{c.preventDefault(),t?.(c)},onClick:c=>{r(),n?.(c)}}));I_.displayName="@mantine/core/ComboboxClearButton";const Ob=be((e,t)=>{const{classNames:n,styles:r,className:o,style:s,hidden:c,...d}=ae("ComboboxDropdown",null,e),f=Li();return a.jsx(Kr.Dropdown,{...d,ref:t,role:"presentation","data-hidden":c||void 0,...f.getStyles("dropdown",{className:o,style:s,classNames:n,styles:r})})});Ob.classes=Yr;Ob.displayName="@mantine/core/ComboboxDropdown";const sI={refProp:"ref"},z_=be((e,t)=>{const{children:n,refProp:r}=ae("ComboboxDropdownTarget",sI,e);if(Li(),!Po(n))throw new Error("Combobox.DropdownTarget component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");return a.jsx(Kr.Target,{ref:t,refProp:r,children:n})});z_.displayName="@mantine/core/ComboboxDropdownTarget";const Mb=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,...d}=ae("ComboboxEmpty",null,e),f=Li();return a.jsx(de,{ref:t,...f.getStyles("empty",{className:r,classNames:n,styles:s,style:o}),...d})});Mb.classes=Yr;Mb.displayName="@mantine/core/ComboboxEmpty";function Lb({onKeyDown:e,withKeyboardNavigation:t,withAriaAttributes:n,withExpandedAttribute:r,targetType:o,autoComplete:s}){const c=Li(),[d,f]=v.useState(null),p=g=>{if(e?.(g),!c.readOnly&&t){if(g.nativeEvent.isComposing)return;if(g.nativeEvent.code==="ArrowDown"&&(g.preventDefault(),c.store.dropdownOpened?f(c.store.selectNextOption()):(c.store.openDropdown("keyboard"),f(c.store.selectActiveOption()),c.store.updateSelectedOptionIndex("selected",{scrollIntoView:!0}))),g.nativeEvent.code==="ArrowUp"&&(g.preventDefault(),c.store.dropdownOpened?f(c.store.selectPreviousOption()):(c.store.openDropdown("keyboard"),f(c.store.selectActiveOption()),c.store.updateSelectedOptionIndex("selected",{scrollIntoView:!0}))),g.nativeEvent.code==="Enter"||g.nativeEvent.code==="NumpadEnter"){if(g.nativeEvent.keyCode===229)return;const y=c.store.getSelectedOptionIndex();c.store.dropdownOpened&&y!==-1?(g.preventDefault(),c.store.clickSelectedOption()):o==="button"&&(g.preventDefault(),c.store.openDropdown("keyboard"))}g.key==="Escape"&&c.store.closeDropdown("keyboard"),g.nativeEvent.code==="Space"&&o==="button"&&(g.preventDefault(),c.store.toggleDropdown("keyboard"))}};return{...n?{"aria-haspopup":"listbox","aria-expanded":r?!!(c.store.listId&&c.store.dropdownOpened):void 0,"aria-controls":c.store.dropdownOpened&&c.store.listId?c.store.listId:void 0,"aria-activedescendant":c.store.dropdownOpened&&d||void 0,autoComplete:s,"data-expanded":c.store.dropdownOpened||void 0,"data-mantine-stop-propagation":c.store.dropdownOpened||void 0}:{},onKeyDown:p}}const lI={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},$_=be((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:s,withExpandedAttribute:c,targetType:d,autoComplete:f,...p}=ae("ComboboxEventsTarget",lI,e);if(!Po(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 m=Li(),g=Lb({targetType:d,withAriaAttributes:s,withKeyboardNavigation:o,withExpandedAttribute:c,onKeyDown:n.props.onKeyDown,autoComplete:f});return v.cloneElement(n,{...g,...p,[r]:zn(t,m.store.targetRef,$p(n))})});$_.displayName="@mantine/core/ComboboxEventsTarget";const Ib=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,...d}=ae("ComboboxFooter",null,e),f=Li();return a.jsx(de,{ref:t,...f.getStyles("footer",{className:r,classNames:n,style:o,styles:s}),...d,onMouseDown:p=>{p.preventDefault()}})});Ib.classes=Yr;Ib.displayName="@mantine/core/ComboboxFooter";const zb=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,children:d,label:f,id:p,...m}=ae("ComboboxGroup",null,e),g=Li(),y=hr(p);return a.jsxs(de,{ref:t,role:"group","aria-labelledby":f?y:void 0,...g.getStyles("group",{className:r,classNames:n,style:o,styles:s}),...m,children:[f&&a.jsx("div",{id:y,...g.getStyles("groupLabel",{classNames:n,styles:s}),children:f}),d]})});zb.classes=Yr;zb.displayName="@mantine/core/ComboboxGroup";const $b=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,...d}=ae("ComboboxHeader",null,e),f=Li();return a.jsx(de,{ref:t,...f.getStyles("header",{className:r,classNames:n,style:o,styles:s}),...d,onMouseDown:p=>{p.preventDefault()}})});$b.classes=Yr;$b.displayName="@mantine/core/ComboboxHeader";function U_({value:e,valuesDivider:t=",",...n}){return a.jsx("input",{type:"hidden",value:Array.isArray(e)?e.join(t):e||"",...n})}U_.displayName="@mantine/core/ComboboxHiddenInput";const Ub=be((e,t)=>{const n=ae("ComboboxOption",null,e),{classNames:r,className:o,style:s,styles:c,vars:d,onClick:f,id:p,active:m,onMouseDown:g,onMouseOver:y,disabled:b,selected:w,mod:j,...C}=n,R=Li(),T=v.useId(),E=p||T;return a.jsx(de,{...R.getStyles("option",{className:o,classNames:r,styles:c,style:s}),...C,ref:t,id:E,mod:["combobox-option",{"combobox-active":m,"combobox-disabled":b,"combobox-selected":w},j],role:"option",onClick:_=>{b?_.preventDefault():(R.onOptionSubmit?.(n.value,n),f?.(_))},onMouseDown:_=>{_.preventDefault(),g?.(_)},onMouseOver:_=>{R.resetSelectionOnOptionHover&&R.store.resetSelectedOption(),y?.(_)}})});Ub.classes=Yr;Ub.displayName="@mantine/core/ComboboxOption";const Bb=be((e,t)=>{const n=ae("ComboboxOptions",null,e),{classNames:r,className:o,style:s,styles:c,id:d,onMouseDown:f,labelledBy:p,...m}=n,g=Li(),y=hr(d);return v.useEffect(()=>{g.store.setListId(y)},[y]),a.jsx(de,{ref:t,...g.getStyles("options",{className:o,style:s,classNames:r,styles:c}),...m,id:y,role:"listbox","aria-labelledby":p,onMouseDown:b=>{b.preventDefault(),f?.(b)}})});Bb.classes=Yr;Bb.displayName="@mantine/core/ComboboxOptions";const cI={withAriaAttributes:!0,withKeyboardNavigation:!0},Vb=be((e,t)=>{const n=ae("ComboboxSearch",cI,e),{classNames:r,styles:o,unstyled:s,vars:c,withAriaAttributes:d,onKeyDown:f,withKeyboardNavigation:p,size:m,...g}=n,y=Li(),b=y.getStyles("search"),w=Lb({targetType:"input",withAriaAttributes:d,withKeyboardNavigation:p,withExpandedAttribute:!1,onKeyDown:f,autoComplete:"off"});return a.jsx(mn,{ref:zn(t,y.store.searchRef),classNames:[{input:b.className},r],styles:[{input:b.style},o],size:m||y.size,...w,...g,__staticSelector:"Combobox"})});Vb.classes=Yr;Vb.displayName="@mantine/core/ComboboxSearch";const uI={refProp:"ref",targetType:"input",withKeyboardNavigation:!0,withAriaAttributes:!0,withExpandedAttribute:!1,autoComplete:"off"},B_=be((e,t)=>{const{children:n,refProp:r,withKeyboardNavigation:o,withAriaAttributes:s,withExpandedAttribute:c,targetType:d,autoComplete:f,...p}=ae("ComboboxTarget",uI,e);if(!Po(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 m=Li(),g=Lb({targetType:d,withAriaAttributes:s,withKeyboardNavigation:o,withExpandedAttribute:c,onKeyDown:n.props.onKeyDown,autoComplete:f}),y=v.cloneElement(n,{...g,...p});return a.jsx(Kr.Target,{ref:zn(t,m.store.targetRef),children:y})});B_.displayName="@mantine/core/ComboboxTarget";function dI(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 fI(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 hI(e){for(let t=0;t<e.length;t+=1)if(!e[t].hasAttribute("data-combobox-disabled"))return t;return-1}function bl({defaultOpened:e,opened:t,onOpenedChange:n,onDropdownClose:r,onDropdownOpen:o,loop:s=!0,scrollBehavior:c="instant"}={}){const[d,f]=or({value:t,defaultValue:e,finalValue:!1,onChange:n}),p=v.useRef(null),m=v.useRef(-1),g=v.useRef(null),y=v.useRef(null),b=v.useRef(-1),w=v.useRef(-1),j=v.useRef(-1),C=v.useCallback((M="unknown")=>{d||(f(!0),o?.(M))},[f,o,d]),R=v.useCallback((M="unknown")=>{d&&(f(!1),r?.(M))},[f,r,d]),T=v.useCallback((M="unknown")=>{d?R(M):C(M)},[R,C,d]),E=v.useCallback(()=>{const M=document.querySelector(`#${p.current} [data-combobox-selected]`);M?.removeAttribute("data-combobox-selected"),M?.removeAttribute("aria-selected")},[]),_=v.useCallback(M=>{const z=document.getElementById(p.current)?.querySelectorAll("[data-combobox-option]");if(!z)return null;const F=M>=z.length?0:M<0?z.length-1:M;return m.current=F,z?.[F]&&!z[F].hasAttribute("data-combobox-disabled")?(E(),z[F].setAttribute("data-combobox-selected","true"),z[F].setAttribute("aria-selected","true"),z[F].scrollIntoView({block:"nearest",behavior:c}),z[F].id):null},[c,E]),k=v.useCallback(()=>{const M=document.querySelector(`#${p.current} [data-combobox-active]`);if(M){const I=document.querySelectorAll(`#${p.current} [data-combobox-option]`),z=Array.from(I).findIndex(F=>F===M);return _(z)}return _(0)},[_]),L=v.useCallback(()=>_(fI(m.current,document.querySelectorAll(`#${p.current} [data-combobox-option]`),s)),[_,s]),A=v.useCallback(()=>_(dI(m.current,document.querySelectorAll(`#${p.current} [data-combobox-option]`),s)),[_,s]),N=v.useCallback(()=>_(hI(document.querySelectorAll(`#${p.current} [data-combobox-option]`))),[_]),U=v.useCallback((M="selected",I)=>{j.current=window.setTimeout(()=>{const z=document.querySelectorAll(`#${p.current} [data-combobox-option]`),F=Array.from(z).findIndex(X=>X.hasAttribute(`data-combobox-${M}`));m.current=F,I?.scrollIntoView&&z[F]?.scrollIntoView({block:"nearest",behavior:c})},0)},[]),B=v.useCallback(()=>{m.current=-1,E()},[E]),Q=v.useCallback(()=>{document.querySelectorAll(`#${p.current} [data-combobox-option]`)?.[m.current]?.click()},[]),J=v.useCallback(M=>{p.current=M},[]),Z=v.useCallback(()=>{b.current=window.setTimeout(()=>g.current?.focus(),0)},[]),$=v.useCallback(()=>{w.current=window.setTimeout(()=>y.current?.focus(),0)},[]),W=v.useCallback(()=>m.current,[]);return v.useEffect(()=>()=>{window.clearTimeout(b.current),window.clearTimeout(w.current),window.clearTimeout(j.current)},[]),{dropdownOpened:d,openDropdown:C,closeDropdown:R,toggleDropdown:T,selectedOptionIndex:m.current,getSelectedOptionIndex:W,selectOption:_,selectFirstOption:N,selectActiveOption:k,selectNextOption:L,selectPreviousOption:A,resetSelectedOption:B,updateSelectedOptionIndex:U,listId:p.current,setListId:J,clickSelectedOption:Q,searchRef:g,focusSearchInput:Z,targetRef:y,focusTarget:$}}const pI={keepMounted:!0,withinPortal:!0,resetSelectionOnOptionHover:!1,width:"target",transitionProps:{transition:"fade",duration:0},size:"sm"},mI=(e,{size:t,dropdownPadding:n})=>({options:{"--combobox-option-fz":Hn(t),"--combobox-option-padding":st(t,"combobox-option-padding")},dropdown:{"--combobox-padding":n===void 0?void 0:le(n),"--combobox-option-fz":Hn(t),"--combobox-option-padding":st(t,"combobox-option-padding")}});function Ye(e){const t=ae("Combobox",pI,e),{classNames:n,styles:r,unstyled:o,children:s,store:c,vars:d,onOptionSubmit:f,onClose:p,size:m,dropdownPadding:g,resetSelectionOnOptionHover:y,__staticSelector:b,readOnly:w,attributes:j,...C}=t,R=bl(),T=c||R,E=ze({name:b||"Combobox",classes:Yr,props:t,classNames:n,styles:r,unstyled:o,attributes:j,vars:d,varsResolver:mI}),_=()=>{p?.(),T.closeDropdown()};return a.jsx(aI,{value:{getStyles:E,store:T,onOptionSubmit:f,size:m,resetSelectionOnOptionHover:y,readOnly:w},children:a.jsx(Kr,{opened:T.dropdownOpened,preventPositionChangeWhenVisible:!0,...C,onChange:k=>!k&&_(),withRoles:!1,unstyled:o,children:s})})}const gI=e=>e;Ye.extend=gI;Ye.classes=Yr;Ye.displayName="@mantine/core/Combobox";Ye.Target=B_;Ye.Dropdown=Ob;Ye.Options=Bb;Ye.Option=Ub;Ye.Search=Vb;Ye.Empty=Mb;Ye.Chevron=em;Ye.Footer=Ib;Ye.Header=$b;Ye.EventsTarget=$_;Ye.DropdownTarget=z_;Ye.Group=zb;Ye.ClearButton=I_;Ye.HiddenInput=U_;var V_={root:"m_5f75b09e",body:"m_5f6e695e",labelWrapper:"m_d3ea56bb",label:"m_8ee546b8",description:"m_328f68c0",error:"m_8e8a99cc"};const F_=V_,tm=v.forwardRef(({__staticSelector:e,__stylesApiProps:t,className:n,classNames:r,styles:o,unstyled:s,children:c,label:d,description:f,id:p,disabled:m,error:g,size:y,labelPosition:b="left",bodyElement:w="div",labelElement:j="label",variant:C,style:R,vars:T,mod:E,attributes:_,...k},L)=>{const A=ze({name:e,props:t,className:n,style:R,classes:V_,classNames:r,styles:o,unstyled:s,attributes:_});return a.jsx(de,{...A("root"),ref:L,__vars:{"--label-fz":Hn(y),"--label-lh":st(y,"label-lh")},mod:[{"label-position":b},E],variant:C,size:y,...k,children:a.jsxs(de,{component:w,htmlFor:w==="label"?p:void 0,...A("body"),children:[c,a.jsxs("div",{...A("labelWrapper"),"data-disabled":m||void 0,children:[d&&a.jsx(de,{component:j,htmlFor:j==="label"?p:void 0,...A("label"),"data-disabled":m||void 0,children:d}),f&&a.jsx(mn.Description,{size:y,__inheritStyles:!1,...A("description"),children:f}),g&&typeof g!="boolean"&&a.jsx(mn.Error,{size:y,__inheritStyles:!1,...A("error"),children:g})]})]})})});tm.displayName="@mantine/core/InlineInput";const H_=v.createContext(null),vI=H_.Provider,q_=()=>v.useContext(H_),[yI,xI]=No();var G_={card:"m_26775b0a"};const bI={withBorder:!0},SI=(e,{radius:t})=>({card:{"--card-radius":Ft(t)}}),Fb=be((e,t)=>{const n=ae("CheckboxCard",bI,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,checked:p,mod:m,withBorder:g,value:y,onClick:b,defaultChecked:w,onChange:j,attributes:C,...R}=n,T=ze({name:"CheckboxCard",classes:G_,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:C,vars:f,varsResolver:SI,rootSelector:"card"}),E=q_(),_=typeof p=="boolean"?p:E?E.value.includes(y||""):void 0,[k,L]=or({value:_,defaultValue:w,finalValue:!1,onChange:j});return a.jsx(yI,{value:{checked:k},children:a.jsx(ar,{ref:t,mod:[{"with-border":g,checked:k},m],...T("card"),...R,role:"checkbox","aria-checked":k,onClick:A=>{b?.(A),E?.onChange(y||""),L(!k)}})})});Fb.displayName="@mantine/core/CheckboxCard";Fb.classes=G_;function Hb({children:e,role:t}){const n=Qc();return n?a.jsx("div",{role:t,"aria-labelledby":n.labelId,"aria-describedby":n.describedBy,children:e}):a.jsx(a.Fragment,{children:e})}const qb=be((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:s,wrapperProps:c,children:d,readOnly:f,disabled:p,...m}=ae("CheckboxGroup",null,e),[g,y]=or({value:n,defaultValue:r,finalValue:[],onChange:o}),b=w=>{const j=typeof w=="string"?w:w.currentTarget.value;!f&&y(g.includes(j)?g.filter(C=>C!==j):[...g,j])};return a.jsx(vI,{value:{value:g,onChange:b,size:s,disabled:p},children:a.jsx(mn.Wrapper,{size:s,ref:t,...c,...m,labelElement:"div",__staticSelector:"CheckboxGroup",children:a.jsx(Hb,{role:"group",children:d})})})});qb.classes=mn.Wrapper.classes;qb.displayName="@mantine/core/CheckboxGroup";function Id({size:e,style:t,...n}){const r=e!==void 0?{width:le(e),height:le(e),...t}:t;return a.jsx("svg",{viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:r,"aria-hidden":!0,...n,children:a.jsx("path",{d:"M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}function W_({indeterminate:e,...t}){return e?a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 6","aria-hidden":!0,...t,children:a.jsx("rect",{width:"32",height:"6",fill:"currentColor",rx:"3"})}):a.jsx(Id,{...t})}var Q_={indicator:"m_5e5256ee",icon:"m_1b1c543a","indicator--outline":"m_76e20374"};const wI={icon:W_,variant:"filled"},jI=(e,{radius:t,color:n,size:r,iconColor:o,variant:s,autoContrast:c})=>{const d=ci({color:n||e.primaryColor,theme:e}),f=d.isThemeColor&&d.shade===void 0?`var(--mantine-color-${d.color}-outline)`:d.color;return{indicator:{"--checkbox-size":st(r,"checkbox-size"),"--checkbox-radius":t===void 0?void 0:Ft(t),"--checkbox-color":s==="outline"?f:Qt(n,e),"--checkbox-icon-color":o?Qt(o,e):yl(c,e)?ba({color:n,theme:e,autoContrast:c}):void 0}}},Gb=be((e,t)=>{const n=ae("CheckboxIndicator",wI,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,icon:p,indeterminate:m,radius:g,color:y,iconColor:b,autoContrast:w,checked:j,mod:C,variant:R,disabled:T,attributes:E,..._}=n,k=ze({name:"CheckboxIndicator",classes:Q_,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:E,vars:f,varsResolver:jI,rootSelector:"indicator"}),L=xI(),A=typeof j=="boolean"||typeof m=="boolean"?j||m:L?.checked||!1;return a.jsx(de,{ref:t,...k("indicator",{variant:R}),variant:R,mod:[{checked:A,disabled:T},C],..._,children:a.jsx(p,{indeterminate:m,...k("icon")})})});Gb.displayName="@mantine/core/CheckboxIndicator";Gb.classes=Q_;var Y_={root:"m_bf2d988c",inner:"m_26062bec",input:"m_26063560",icon:"m_bf295423","input--outline":"m_215c4542"};const CI={labelPosition:"right",icon:W_,variant:"filled"},EI=(e,{radius:t,color:n,size:r,iconColor:o,variant:s,autoContrast:c})=>{const d=ci({color:n||e.primaryColor,theme:e}),f=d.isThemeColor&&d.shade===void 0?`var(--mantine-color-${d.color}-outline)`:d.color;return{root:{"--checkbox-size":st(r,"checkbox-size"),"--checkbox-radius":t===void 0?void 0:Ft(t),"--checkbox-color":s==="outline"?f:Qt(n,e),"--checkbox-icon-color":o?Qt(o,e):yl(c,e)?ba({color:n,theme:e,autoContrast:c}):void 0}}},Ln=be((e,t)=>{const n=ae("Checkbox",CI,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,color:p,label:m,id:g,size:y,radius:b,wrapperProps:w,checked:j,labelPosition:C,description:R,error:T,disabled:E,variant:_,indeterminate:k,icon:L,rootRef:A,iconColor:N,onChange:U,autoContrast:B,mod:Q,attributes:J,...Z}=n,$=q_(),W=y||$?.size,M=ze({name:"Checkbox",props:n,classes:Y_,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:J,vars:f,varsResolver:EI}),{styleProps:I,rest:z}=Sa(Z),F=hr(g),X={checked:$?.value.includes(z.value)??j,onChange:oe=>{$?.onChange(oe),U?.(oe)},disabled:$?.disabled??E},O=v.useRef(null),H=t||O;return v.useEffect(()=>{H&&"current"in H&&H.current&&(H.current.indeterminate=k||!1,k?H.current.setAttribute("data-indeterminate","true"):H.current.removeAttribute("data-indeterminate"))},[k,H]),a.jsx(tm,{...M("root"),__staticSelector:"Checkbox",__stylesApiProps:n,id:F,size:W,labelPosition:C,label:m,description:R,error:T,disabled:X.disabled,classNames:r,styles:c,unstyled:d,"data-checked":X.checked||j||void 0,variant:_,ref:A,mod:Q,...I,...w,children:a.jsxs(de,{...M("inner"),mod:{"data-label-position":C},children:[a.jsx(de,{component:"input",id:F,ref:H,mod:{error:!!T,indeterminate:k},...M("input",{focusable:!0,variant:_}),...z,...X,type:"checkbox"}),a.jsx(L,{indeterminate:k,...M("icon")})]})})});Ln.classes={...Y_,...F_};Ln.displayName="@mantine/core/Checkbox";Ln.Group=qb;Ln.Indicator=Gb;Ln.Card=Fb;function Lc(e){return"group"in e}function K_({options:e,search:t,limit:n}){const r=t.trim().toLowerCase(),o=[];for(let s=0;s<e.length;s+=1){const c=e[s];if(o.length===n)return o;Lc(c)&&o.push({group:c.group,items:K_({options:c.items,search:t,limit:n-o.length})}),Lc(c)||c.label.toLowerCase().includes(r)&&o.push(c)}return o}function TI(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 X_(e,t=new Set){if(Array.isArray(e))for(const n of e)if(Lc(n))X_(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 RI(e,t){return Array.isArray(e)?e.includes(t):e===t}function J_({data:e,withCheckIcon:t,value:n,checkIconPosition:r,unstyled:o,renderOption:s}){if(!Lc(e)){const d=RI(n,e.value),f=t&&d&&a.jsx(Id,{className:Yr.optionsDropdownCheckIcon}),p=a.jsxs(a.Fragment,{children:[r==="left"&&f,a.jsx("span",{children:e.label}),r==="right"&&f]});return a.jsx(Ye.Option,{value:e.value,disabled:e.disabled,className:$t({[Yr.optionsDropdownOption]:!o}),"data-reverse":r==="right"||void 0,"data-checked":d||void 0,"aria-selected":d,active:d,children:typeof s=="function"?s({option:e,checked:d}):p})}const c=e.items.map(d=>a.jsx(J_,{data:d,value:n,unstyled:o,withCheckIcon:t,checkIconPosition:r,renderOption:s},d.value));return a.jsx(Ye.Group,{label:e.group,children:c})}function _I({data:e,hidden:t,hiddenWhenEmpty:n,filter:r,search:o,limit:s,maxDropdownHeight:c,withScrollArea:d=!0,filterOptions:f=!0,withCheckIcon:p=!1,value:m,checkIconPosition:g,nothingFoundMessage:y,unstyled:b,labelId:w,renderOption:j,scrollAreaProps:C,"aria-label":R}){X_(e);const E=typeof o=="string"?(r||K_)({options:e,search:f?o:"",limit:s??1/0}):e,_=TI(E),k=E.map(L=>a.jsx(J_,{data:L,withCheckIcon:p,value:m,checkIconPosition:g,unstyled:b,renderOption:j},Lc(L)?L.group:L.value));return a.jsx(Ye.Dropdown,{hidden:t||n&&_,"data-composed":!0,children:a.jsxs(Ye.Options,{labelledBy:w,"aria-label":R,children:[d?a.jsx(pi.Autosize,{mah:c??220,type:"scroll",scrollbarSize:"var(--combobox-padding)",offsetScrollbars:"y",...C,children:k}):k,_&&y&&a.jsx(Ye.Empty,{children:y})]})})}const Z_=v.createContext(null),DI=Z_.Provider;function AI(){return{withinGroup:!!v.useContext(Z_)}}var nm={group:"m_11def92b",root:"m_f85678b6",image:"m_11f8ac07",placeholder:"m_104cd71f"};const kI=(e,{spacing:t})=>({group:{"--ag-spacing":Fn(t)}}),Wb=be((e,t)=>{const n=ae("AvatarGroup",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,spacing:p,attributes:m,...g}=n,y=ze({name:"AvatarGroup",classes:nm,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:m,vars:f,varsResolver:kI,rootSelector:"group"});return a.jsx(DI,{value:!0,children:a.jsx(de,{ref:t,...y("group"),...g})})});Wb.classes=nm;Wb.displayName="@mantine/core/AvatarGroup";function PI(e){return a.jsx("svg",{...e,"data-avatar-placeholder-icon":!0,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:a.jsx("path",{d:"M0.877014 7.49988C0.877014 3.84219 3.84216 0.877045 7.49985 0.877045C11.1575 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1575 14.1227 7.49985 14.1227C3.84216 14.1227 0.877014 11.1575 0.877014 7.49988ZM7.49985 1.82704C4.36683 1.82704 1.82701 4.36686 1.82701 7.49988C1.82701 8.97196 2.38774 10.3131 3.30727 11.3213C4.19074 9.94119 5.73818 9.02499 7.50023 9.02499C9.26206 9.02499 10.8093 9.94097 11.6929 11.3208C12.6121 10.3127 13.1727 8.97172 13.1727 7.49988C13.1727 4.36686 10.6328 1.82704 7.49985 1.82704ZM10.9818 11.9787C10.2839 10.7795 8.9857 9.97499 7.50023 9.97499C6.01458 9.97499 4.71624 10.7797 4.01845 11.9791C4.97952 12.7272 6.18765 13.1727 7.49985 13.1727C8.81227 13.1727 10.0206 12.727 10.9818 11.9787ZM5.14999 6.50487C5.14999 5.207 6.20212 4.15487 7.49999 4.15487C8.79786 4.15487 9.84999 5.207 9.84999 6.50487C9.84999 7.80274 8.79786 8.85487 7.49999 8.85487C6.20212 8.85487 5.14999 7.80274 5.14999 6.50487ZM7.49999 5.10487C6.72679 5.10487 6.09999 5.73167 6.09999 6.50487C6.09999 7.27807 6.72679 7.90487 7.49999 7.90487C8.27319 7.90487 8.89999 7.27807 8.89999 6.50487C8.89999 5.73167 8.27319 5.10487 7.49999 5.10487Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}function NI(e){let t=0;for(let n=0;n<e.length;n+=1){const r=e.charCodeAt(n);t=(t<<5)-t+r,t|=0}return t}const OI=["blue","cyan","grape","green","indigo","lime","orange","pink","red","teal","violet"];function MI(e,t=OI){const n=NI(e),r=Math.abs(n)%t.length;return t[r]}function LI(e,t=2){const n=e.split(" ");return n.length===1?e.slice(0,t).toUpperCase():n.map(r=>r[0]).slice(0,t).join("").toUpperCase()}const II=(e,{size:t,radius:n,variant:r,gradient:o,color:s,autoContrast:c,name:d,allowedInitialsColors:f})=>{const p=s==="initials"&&typeof d=="string"?MI(d,f):s,m=e.variantColorResolver({color:p||"gray",theme:e,gradient:o,variant:r||"light",autoContrast:c});return{root:{"--avatar-size":st(t,"avatar-size"),"--avatar-radius":n===void 0?void 0:Ft(n),"--avatar-bg":p||r?m.background:void 0,"--avatar-color":p||r?m.color:void 0,"--avatar-bd":p||r?m.border:void 0}}},al=pr((e,t)=>{const n=ae("Avatar",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,src:p,alt:m,radius:g,color:y,gradient:b,imageProps:w,children:j,autoContrast:C,mod:R,name:T,allowedInitialsColors:E,attributes:_,...k}=n,L=AI(),[A,N]=v.useState(!p),U=ze({name:"Avatar",props:n,classes:nm,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:_,vars:f,varsResolver:II});return v.useEffect(()=>N(!p),[p]),a.jsx(de,{...U("root"),mod:[{"within-group":L.withinGroup},R],ref:t,...k,children:A||!p?a.jsx("span",{...U("placeholder"),title:m,children:j||typeof T=="string"&&LI(T)||a.jsx(PI,{})}):a.jsx("img",{...w,...U("image"),src:p,alt:m,onError:B=>{N(!0),w?.onError?.(B)}})})});al.classes=nm;al.displayName="@mantine/core/Avatar";al.Group=Wb;var eD={root:"m_347db0ec","root--dot":"m_fbd81e3d",label:"m_5add502a",section:"m_91fdda9b"};const zI=(e,{radius:t,color:n,gradient:r,variant:o,size:s,autoContrast:c})=>{const d=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:c});return{root:{"--badge-height":st(s,"badge-height"),"--badge-padding-x":st(s,"badge-padding-x"),"--badge-fz":st(s,"badge-fz"),"--badge-radius":t===void 0?void 0:Ft(t),"--badge-bg":n||o?d.background:void 0,"--badge-color":n||o?d.color:void 0,"--badge-bd":n||o?d.border:void 0,"--badge-dot-color":o==="dot"?Qt(n,e):void 0}}},rm=pr((e,t)=>{const n=ae("Badge",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,radius:p,color:m,gradient:g,leftSection:y,rightSection:b,children:w,variant:j,fullWidth:C,autoContrast:R,circle:T,mod:E,attributes:_,...k}=n,L=ze({name:"Badge",props:n,classes:eD,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:_,vars:f,varsResolver:zI});return a.jsxs(de,{variant:j,mod:[{block:C,circle:T,"with-right-section":!!b,"with-left-section":!!y},E],...L("root",{variant:j}),ref:t,...k,children:[y&&a.jsx("span",{...L("section"),"data-position":"left",children:y}),a.jsx("span",{...L("label"),children:w}),b&&a.jsx("span",{...L("section"),"data-position":"right",children:b})]})});rm.classes=eD;rm.displayName="@mantine/core/Badge";var tD={root:"m_ddec01c0",icon:"m_dde7bd57",cite:"m_dde51a35"};const $I={iconSize:48},UI=(e,{color:t,iconSize:n,radius:r})=>{const o=ci({color:t||e.primaryColor,theme:e,colorScheme:"dark"}),s=ci({color:t||e.primaryColor,theme:e,colorScheme:"light"});return{root:{"--bq-bg-light":Ri(s.value,.07),"--bq-bg-dark":Ri(o.value,.06),"--bq-bd":Qt(t,e),"--bq-icon-size":le(n),"--bq-radius":Ft(r)}}},Qb=be((e,t)=>{const n=ae("Blockquote",$I,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,children:p,icon:m,iconSize:g,cite:y,attributes:b,...w}=n,j=ze({name:"Blockquote",classes:tD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:b,vars:f,varsResolver:UI});return a.jsxs(de,{component:"blockquote",ref:t,...j("root"),...w,children:[m&&a.jsx("span",{...j("icon"),children:m}),p,y&&a.jsx("cite",{...j("cite"),children:y})]})});Qb.classes=tD;Qb.displayName="@mantine/core/Blockquote";var Kc={root:"m_77c9d27d",inner:"m_80f1301b",label:"m_811560b9",section:"m_a74036a",loader:"m_a25b86ee",group:"m_80d6d844",groupSection:"m_70be2a01"};const wE={orientation:"horizontal"},BI=(e,{borderWidth:t})=>({group:{"--button-border-width":le(t)}}),Yb=be((e,t)=>{const n=ae("ButtonGroup",wE,e),{className:r,style:o,classNames:s,styles:c,unstyled:d,orientation:f,vars:p,borderWidth:m,variant:g,mod:y,attributes:b,...w}=ae("ButtonGroup",wE,e),j=ze({name:"ButtonGroup",props:n,classes:Kc,className:r,style:o,classNames:s,styles:c,unstyled:d,attributes:b,vars:p,varsResolver:BI,rootSelector:"group"});return a.jsx(de,{...j("group"),ref:t,variant:g,mod:[{"data-orientation":f},y],role:"group",...w})});Yb.classes=Kc;Yb.displayName="@mantine/core/ButtonGroup";const VI=(e,{radius:t,color:n,gradient:r,variant:o,autoContrast:s,size:c})=>{const d=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:s});return{groupSection:{"--section-height":st(c,"section-height"),"--section-padding-x":st(c,"section-padding-x"),"--section-fz":c?.includes("compact")?Hn(c.replace("compact-","")):Hn(c),"--section-radius":t===void 0?void 0:Ft(t),"--section-bg":n||o?d.background:void 0,"--section-color":d.color,"--section-bd":n||o?d.border:void 0}}},Kb=be((e,t)=>{const n=ae("ButtonGroupSection",null,e),{className:r,style:o,classNames:s,styles:c,unstyled:d,vars:f,variant:p,gradient:m,radius:g,autoContrast:y,attributes:b,...w}=n,j=ze({name:"ButtonGroupSection",props:n,classes:Kc,className:r,style:o,classNames:s,styles:c,unstyled:d,attributes:b,vars:f,varsResolver:VI,rootSelector:"groupSection"});return a.jsx(de,{...j("groupSection"),ref:t,variant:p,...w})});Kb.classes=Kc;Kb.displayName="@mantine/core/ButtonGroupSection";const FI={in:{opacity:1,transform:`translate(-50%, calc(-50% + ${le(1)}))`},out:{opacity:0,transform:"translate(-50%, -200%)"},common:{transformOrigin:"center"},transitionProperty:"transform, opacity"},HI=(e,{radius:t,color:n,gradient:r,variant:o,size:s,justify:c,autoContrast:d})=>{const f=e.variantColorResolver({color:n||e.primaryColor,theme:e,gradient:r,variant:o||"filled",autoContrast:d});return{root:{"--button-justify":c,"--button-height":st(s,"button-height"),"--button-padding-x":st(s,"button-padding-x"),"--button-fz":s?.includes("compact")?Hn(s.replace("compact-","")):Hn(s),"--button-radius":t===void 0?void 0:Ft(t),"--button-bg":n||o?f.background:void 0,"--button-hover":n||o?f.hover:void 0,"--button-color":f.color,"--button-bd":n||o?f.border:void 0,"--button-hover-color":n||o?f.hoverColor:void 0}}},Ae=pr((e,t)=>{const n=ae("Button",null,e),{style:r,vars:o,className:s,color:c,disabled:d,children:f,leftSection:p,rightSection:m,fullWidth:g,variant:y,radius:b,loading:w,loaderProps:j,gradient:C,classNames:R,styles:T,unstyled:E,"data-disabled":_,autoContrast:k,mod:L,attributes:A,...N}=n,U=ze({name:"Button",props:n,classes:Kc,className:s,style:r,classNames:R,styles:T,unstyled:E,attributes:A,vars:o,varsResolver:HI}),B=!!p,Q=!!m;return a.jsxs(ar,{ref:t,...U("root",{active:!d&&!w&&!_}),unstyled:E,variant:y,disabled:d||w,mod:[{disabled:d||_,loading:w,block:g,"with-left-section":B,"with-right-section":Q},L],...N,children:[typeof w=="boolean"&&a.jsx(eo,{mounted:w,transition:FI,duration:150,children:J=>a.jsx(de,{component:"span",...U("loader",{style:J}),"aria-hidden":!0,children:a.jsx(Or,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...j})})}),a.jsxs("span",{...U("inner"),children:[p&&a.jsx(de,{component:"span",...U("section"),mod:{position:"left"},children:p}),a.jsx(de,{component:"span",mod:{loading:w},...U("label"),children:f}),m&&a.jsx(de,{component:"span",...U("section"),mod:{position:"right"},children:m})]})]})});Ae.classes=Kc;Ae.displayName="@mantine/core/Button";Ae.Group=Yb;Ae.GroupSection=Kb;var nD={root:"m_4451eb3a"};const dr=pr((e,t)=>{const n=ae("Center",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,inline:p,mod:m,attributes:g,...y}=n,b=ze({name:"Center",props:n,classes:nD,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:g,vars:f});return a.jsx(de,{ref:t,mod:[{inline:p},m],...b("root"),...y})});dr.classes=nD;dr.displayName="@mantine/core/Center";const[qI,GI]=No();function rD(e){const{value:t,defaultValue:n,onChange:r,multiple:o,children:s}=ae("ChipGroup",null,e),[c,d]=or({value:t,defaultValue:n,finalValue:o?[]:null,onChange:r}),f=m=>Array.isArray(c)?c.includes(m):m===c,p=m=>{const g=m.currentTarget.value;Array.isArray(c)?d(c.includes(g)?c.filter(y=>y!==g):[...c,g]):d(g)};return a.jsx(qI,{value:{isChipSelected:f,onChange:p,multiple:o},children:s})}rD.displayName="@mantine/core/ChipGroup";var iD={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 WI={type:"checkbox"},QI=(e,{size:t,radius:n,variant:r,color:o,autoContrast:s})=>{const c=e.variantColorResolver({color:o||e.primaryColor,theme:e,variant:r||"filled",autoContrast:s});return{root:{"--chip-fz":Hn(t),"--chip-size":st(t,"chip-size"),"--chip-radius":n===void 0?void 0:Ft(n),"--chip-checked-padding":st(t,"chip-checked-padding"),"--chip-padding":st(t,"chip-padding"),"--chip-icon-size":st(t,"chip-icon-size"),"--chip-bg":o||r?c.background:void 0,"--chip-hover":o||r?c.hover:void 0,"--chip-color":o||r?c.color:void 0,"--chip-bd":o||r?c.border:void 0,"--chip-spacing":st(t,"chip-spacing")}}},gd=be((e,t)=>{const n=ae("Chip",WI,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,id:p,checked:m,defaultChecked:g,onChange:y,value:b,wrapperProps:w,type:j,disabled:C,children:R,size:T,variant:E,icon:_,rootRef:k,autoContrast:L,mod:A,attributes:N,...U}=n,B=ze({name:"Chip",classes:iD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:N,vars:f,varsResolver:QI}),Q=GI(),J=hr(p),{styleProps:Z,rest:$}=Sa(U),[W,M]=or({value:m,defaultValue:g,finalValue:!1,onChange:y}),I=Q?{checked:Q.isChipSelected(b),onChange:F=>{Q.onChange(F),y?.(F.currentTarget.checked)},type:Q.multiple?"checkbox":"radio"}:{},z=I.checked||W;return a.jsxs(de,{size:T,variant:E,ref:k,mod:A,...B("root"),...Z,...w,children:[a.jsx("input",{type:j,...B("input"),checked:z,onChange:F=>M(F.currentTarget.checked),id:J,disabled:C,ref:t,value:b,...I,...$}),a.jsxs("label",{htmlFor:J,"data-checked":z||void 0,"data-disabled":C||void 0,...B("label",{variant:E||"filled"}),children:[z&&_!==null&&_!==!1&&a.jsx("span",{...B("iconWrapper"),children:_===void 0?a.jsx(Id,{...B("checkIcon")}):_}),a.jsx("span",{children:R})]})]})});gd.classes=iD;gd.displayName="@mantine/core/Chip";gd.Group=rD;var oD={root:"m_b183c0a2"};const YI=(e,{color:t})=>({root:{"--code-bg":t?Qt(t,e):void 0}}),zd=be((e,t)=>{const n=ae("Code",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,color:p,block:m,variant:g,mod:y,attributes:b,...w}=n,j=ze({name:"Code",props:n,classes:oD,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:b,vars:f,varsResolver:YI});return a.jsx(de,{component:m?"pre":"code",variant:g,ref:t,mod:[{block:m},y],...j("root"),...w,dir:"ltr"})});zd.classes=oD;zd.displayName="@mantine/core/Code";var aD={root:"m_7485cace"};const KI=(e,{size:t,fluid:n})=>({root:{"--container-size":n?void 0:st(t,"container-size")}}),$d=be((e,t)=>{const n=ae("Container",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,fluid:p,mod:m,attributes:g,strategy:y,...b}=n,w=ze({name:"Container",classes:aD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:g,vars:f,varsResolver:KI});return a.jsx(de,{ref:t,mod:[{fluid:p,strategy:y||"block"},m],...w("root"),...b})});$d.classes=aD;$d.displayName="@mantine/core/Container";const XI={timeout:1e3};function Xb(e){const{children:t,timeout:n,value:r,...o}=ae("CopyButton",XI,e),s=l2({timeout:n}),c=()=>s.copy(r);return a.jsx(a.Fragment,{children:t({copy:c,copied:s.copied,...o})})}Xb.displayName="@mantine/core/CopyButton";var sD={root:"m_3eebeb36",label:"m_9e365f20"};const JI={orientation:"horizontal"},ZI=(e,{color:t,variant:n,size:r})=>({root:{"--divider-color":t?Qt(t,e):void 0,"--divider-border-style":n,"--divider-size":st(r,"divider-size")}}),Tn=be((e,t)=>{const n=ae("Divider",JI,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,color:p,orientation:m,label:g,labelPosition:y,mod:b,attributes:w,...j}=n,C=ze({name:"Divider",classes:sD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:w,vars:f,varsResolver:ZI});return a.jsx(de,{ref:t,mod:[{orientation:m,"with-label":!!g},b],...C("root"),...j,role:"separator",children:g&&a.jsx(de,{component:"span",mod:{position:y},...C("label"),children:g})})});Tn.classes=sD;Tn.displayName="@mantine/core/Divider";const[jE,lD]=Mr("Grid component was not found in tree"),mx=(e,t)=>e==="content"?"auto":e==="auto"?"0rem":e?`${100/(t/e)}%`:void 0,CE=(e,t,n)=>n||e==="auto"?"100%":e==="content"?"unset":mx(e,t),EE=(e,t)=>{if(e)return e==="auto"||t?"1":"auto"},TE=(e,t)=>e===0?"0":e?`${100/(t/e)}%`:void 0;function e7({span:e,order:t,offset:n,selector:r}){const o=jn(),s=lD(),c=s.breakpoints||o.breakpoints,f=Qi(e)===void 0?12:Qi(e),p=hs({"--col-order":Qi(t)?.toString(),"--col-flex-grow":EE(f,s.grow),"--col-flex-basis":mx(f,s.columns),"--col-width":f==="content"?"auto":void 0,"--col-max-width":CE(f,s.columns,s.grow),"--col-offset":TE(Qi(n),s.columns)}),m=cn(c).reduce((b,w)=>(b[w]||(b[w]={}),typeof t=="object"&&t[w]!==void 0&&(b[w]["--col-order"]=t[w]?.toString()),typeof e=="object"&&e[w]!==void 0&&(b[w]["--col-flex-grow"]=EE(e[w],s.grow),b[w]["--col-flex-basis"]=mx(e[w],s.columns),b[w]["--col-width"]=e[w]==="content"?"auto":void 0,b[w]["--col-max-width"]=CE(e[w],s.columns,s.grow)),typeof n=="object"&&n[w]!==void 0&&(b[w]["--col-offset"]=TE(n[w],s.columns)),b),{}),y=dd(cn(m),c).filter(b=>cn(m[b.value]).length>0).map(b=>({query:s.type==="container"?`mantine-grid (min-width: ${c[b.value]})`:`(min-width: ${c[b.value]})`,styles:m[b.value]}));return a.jsx(xl,{styles:p,media:s.type==="container"?void 0:y,container:s.type==="container"?y:void 0,selector:r})}var Jb={container:"m_8478a6da",root:"m_410352e9",inner:"m_dee7bd2f",col:"m_96bdd299"};const t7={span:12},Zb=be((e,t)=>{const n=ae("GridCol",t7,e),{classNames:r,className:o,style:s,styles:c,vars:d,span:f,order:p,offset:m,...g}=n,y=lD(),b=Ad();return a.jsxs(a.Fragment,{children:[a.jsx(e7,{selector:`.${b}`,span:f,order:p,offset:m}),a.jsx(de,{ref:t,...y.getStyles("col",{className:$t(o,b),style:s,classNames:r,styles:c}),...g})]})});Zb.classes=Jb;Zb.displayName="@mantine/core/GridCol";function RE({gutter:e,selector:t,breakpoints:n,type:r}){const o=jn(),s=n||o.breakpoints,c=hs({"--grid-gutter":Fn(Qi(e))}),d=cn(s).reduce((m,g)=>(m[g]||(m[g]={}),typeof e=="object"&&e[g]!==void 0&&(m[g]["--grid-gutter"]=Fn(e[g])),m),{}),p=dd(cn(d),s).filter(m=>cn(d[m.value]).length>0).map(m=>({query:r==="container"?`mantine-grid (min-width: ${s[m.value]})`:`(min-width: ${s[m.value]})`,styles:d[m.value]}));return a.jsx(xl,{styles:c,media:r==="container"?void 0:p,container:r==="container"?p:void 0,selector:t})}const n7={gutter:"md",grow:!1,columns:12},r7=(e,{justify:t,align:n,overflow:r})=>({root:{"--grid-justify":t,"--grid-align":n,"--grid-overflow":r}}),br=be((e,t)=>{const n=ae("Grid",n7,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,grow:p,gutter:m,columns:g,align:y,justify:b,children:w,breakpoints:j,type:C,attributes:R,...T}=n,E=ze({name:"Grid",classes:Jb,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:R,vars:f,varsResolver:r7}),_=Ad();return C==="container"&&j?a.jsxs(jE,{value:{getStyles:E,grow:p,columns:g,breakpoints:j,type:C},children:[a.jsx(RE,{selector:`.${_}`,...n}),a.jsx("div",{...E("container"),children:a.jsx(de,{ref:t,...E("root",{className:_}),...T,children:a.jsx("div",{...E("inner"),children:w})})})]}):a.jsxs(jE,{value:{getStyles:E,grow:p,columns:g,breakpoints:j,type:C},children:[a.jsx(RE,{selector:`.${_}`,...n}),a.jsx(de,{ref:t,...E("root",{className:_}),...T,children:a.jsx("div",{...E("inner"),children:w})})]})});br.classes=Jb;br.displayName="@mantine/core/Grid";br.Col=Zb;function dp(){return dp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dp.apply(null,arguments)}function e0(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}var i7=v.useLayoutEffect,o7=function(t){var n=kn.useRef(t);return i7(function(){n.current=t}),n},_E=function(t,n){if(typeof t=="function"){t(n);return}t.current=n},a7=function(t,n){var r=kn.useRef();return kn.useCallback(function(o){t.current=o,r.current&&_E(r.current,null),r.current=n,n&&_E(n,o)},[n])},DE={"min-height":"0","max-height":"none",height:"0",visibility:"hidden",overflow:"hidden",position:"absolute","z-index":"-1000",top:"0",right:"0",display:"block"},s7=function(t){Object.keys(DE).forEach(function(n){t.style.setProperty(n,DE[n],"important")})},AE=s7,_r=null,kE=function(t,n){var r=t.scrollHeight;return n.sizingStyle.boxSizing==="border-box"?r+n.borderSize:r-n.paddingSize};function l7(e,t,n,r){n===void 0&&(n=1),r===void 0&&(r=1/0),_r||(_r=document.createElement("textarea"),_r.setAttribute("tabindex","-1"),_r.setAttribute("aria-hidden","true"),AE(_r)),_r.parentNode===null&&document.body.appendChild(_r);var o=e.paddingSize,s=e.borderSize,c=e.sizingStyle,d=c.boxSizing;Object.keys(c).forEach(function(y){var b=y;_r.style[b]=c[b]}),AE(_r),_r.value=t;var f=kE(_r,e);_r.value=t,f=kE(_r,e),_r.value="x";var p=_r.scrollHeight-o,m=p*n;d==="border-box"&&(m=m+o+s),f=Math.max(m,f);var g=p*r;return d==="border-box"&&(g=g+o+s),f=Math.min(g,f),[f,p]}var PE=function(){},c7=function(t,n){return t.reduce(function(r,o){return r[o]=n[o],r},{})},u7=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopWidth","boxSizing","fontFamily","fontSize","fontStyle","fontWeight","letterSpacing","lineHeight","paddingBottom","paddingLeft","paddingRight","paddingTop","tabSize","textIndent","textRendering","textTransform","width","wordBreak","wordSpacing","scrollbarGutter"],d7=!!document.documentElement.currentStyle,f7=function(t){var n=window.getComputedStyle(t);if(n===null)return null;var r=c7(u7,n),o=r.boxSizing;if(o==="")return null;d7&&o==="border-box"&&(r.width=parseFloat(r.width)+parseFloat(r.borderRightWidth)+parseFloat(r.borderLeftWidth)+parseFloat(r.paddingRight)+parseFloat(r.paddingLeft)+"px");var s=parseFloat(r.paddingBottom)+parseFloat(r.paddingTop),c=parseFloat(r.borderBottomWidth)+parseFloat(r.borderTopWidth);return{sizingStyle:r,paddingSize:s,borderSize:c}},h7=f7;function t0(e,t,n){var r=o7(n);v.useLayoutEffect(function(){var o=function(c){return r.current(c)};if(e)return e.addEventListener(t,o),function(){return e.removeEventListener(t,o)}},[])}var p7=function(t,n){t0(document.body,"reset",function(r){t.current.form===r.target&&n(r)})},m7=function(t){t0(window,"resize",t)},g7=function(t){t0(document.fonts,"loadingdone",t)},v7=["cacheMeasurements","maxRows","minRows","onChange","onHeightChange"],y7=function(t,n){var r=t.cacheMeasurements,o=t.maxRows,s=t.minRows,c=t.onChange,d=c===void 0?PE:c,f=t.onHeightChange,p=f===void 0?PE:f,m=e0(t,v7),g=m.value!==void 0,y=v.useRef(null),b=a7(y,n),w=v.useRef(0),j=v.useRef(),C=function(){var E=y.current,_=r&&j.current?j.current:h7(E);if(_){j.current=_;var k=l7(_,E.value||E.placeholder||"x",s,o),L=k[0],A=k[1];w.current!==L&&(w.current=L,E.style.setProperty("height",L+"px","important"),p(L,{rowHeight:A}))}},R=function(E){g||C(),d(E)};return v.useLayoutEffect(C),p7(y,function(){if(!g){var T=y.current.value;requestAnimationFrame(function(){var E=y.current;E&&T!==E.value&&C()})}}),m7(C),g7(C),v.createElement("textarea",dp({},m,{onChange:R,ref:b}))},x7=v.forwardRef(y7);const b7={size:"sm"},Sl=be((e,t)=>{const{autosize:n,maxRows:r,minRows:o,__staticSelector:s,resize:c,...d}=ae("Textarea",b7,e),f=n&&m2()!=="test",p=f?{maxRows:r,minRows:o}:{};return a.jsx(Lr,{component:f?x7:"textarea",ref:t,...d,__staticSelector:s||"Textarea",multiline:!0,"data-no-overflow":n&&r===void 0||void 0,__vars:{"--input-resize":c},...p})});Sl.classes=Lr.classes;Sl.displayName="@mantine/core/Textarea";function NE(e,t){if(typeof e=="string"&&e.trim().length===0)return!0;try{return t(e),!0}catch{return!1}}const S7={serialize:JSON.stringify,deserialize:JSON.parse,size:"sm"},Xc=be((e,t)=>{const{value:n,defaultValue:r,onChange:o,formatOnBlur:s,validationError:c,serialize:d,deserialize:f,onFocus:p,onBlur:m,readOnly:g,error:y,...b}=ae("JsonInput",S7,e),[w,j]=or({value:n,defaultValue:r,finalValue:"",onChange:o}),[C,R]=v.useState(NE(w,f)),T=_=>{p?.(_),R(!0)},E=_=>{typeof m=="function"&&m(_);const k=NE(_.currentTarget.value,f);s&&!g&&k&&_.currentTarget.value.trim()!==""&&j(d(f(_.currentTarget.value),null,2)),R(k)};return a.jsx(Sl,{value:w,onChange:_=>j(_.currentTarget.value),onFocus:T,onBlur:E,ref:t,readOnly:g,...b,autoComplete:"off",__staticSelector:"JsonInput",error:C?y:c||!0,"data-monospace":!0})});Xc.classes=Lr.classes;Xc.displayName="@mantine/core/JsonInput";const[w7,j7]=Mr("List component was not found in tree");var n0={root:"m_abbac491",item:"m_abb6bec2",itemWrapper:"m_75cd9f71",itemIcon:"m_60f83e5b"};const r0=be((e,t)=>{const n=ae("ListItem",null,e),{classNames:r,className:o,style:s,styles:c,vars:d,icon:f,children:p,mod:m,...g}=n,y=j7(),b=f||y.icon,w={classNames:r,styles:c};return a.jsx(de,{...y.getStyles("item",{...w,className:o,style:s}),component:"li",mod:[{"with-icon":!!b,centered:y.center},m],ref:t,...g,children:a.jsxs("div",{...y.getStyles("itemWrapper",w),children:[b&&a.jsx("span",{...y.getStyles("itemIcon",w),children:b}),a.jsx("span",{...y.getStyles("itemLabel",w),children:p})]})})});r0.classes=n0;r0.displayName="@mantine/core/ListItem";const C7={type:"unordered"},E7=(e,{size:t,spacing:n})=>({root:{"--list-fz":Hn(t),"--list-lh":s2(t),"--list-spacing":Fn(n)}}),kr=be((e,t)=>{const n=ae("List",C7,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,children:p,type:m,withPadding:g,icon:y,spacing:b,center:w,listStyleType:j,mod:C,attributes:R,...T}=n,E=ze({name:"List",classes:n0,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:R,vars:f,varsResolver:E7});return a.jsx(w7,{value:{center:w,icon:y,getStyles:E},children:a.jsx(de,{...E("root",{style:{listStyleType:j}}),component:m==="unordered"?"ul":"ol",mod:[{"with-padding":g,type:j},C],ref:t,...T,children:p})})});kr.classes=n0;kr.displayName="@mantine/core/List";kr.Item=r0;var cD={root:"m_6e45937b",loader:"m_e8eb006c",overlay:"m_df587f17"};const OE={transitionProps:{transition:"fade",duration:0},overlayProps:{backgroundOpacity:.75},zIndex:hi("overlay")},T7=(e,{zIndex:t})=>({root:{"--lo-z-index":t?.toString()}}),im=be((e,t)=>{const n=ae("LoadingOverlay",OE,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,transitionProps:p,loaderProps:m,overlayProps:g,visible:y,zIndex:b,attributes:w,...j}=n,C=jn(),R=ze({name:"LoadingOverlay",classes:cD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:w,vars:f,varsResolver:T7}),T={...OE.overlayProps,...g};return a.jsx(eo,{transition:"fade",...p,mounted:!!y,children:E=>a.jsxs(de,{...R("root",{style:E}),ref:t,...j,children:[a.jsx(Or,{...R("loader"),unstyled:d,...m}),a.jsx(Oc,{...T,...R("overlay"),darkHidden:!0,unstyled:d,color:g?.color||C.white}),a.jsx(Oc,{...T,...R("overlay"),lightHidden:!0,unstyled:d,color:g?.color||C.colors.dark[5]})]})})});im.classes=cD;im.displayName="@mantine/core/LoadingOverlay";const[R7,vs]=Mr("Menu component was not found in the tree");var ys={dropdown:"m_dc9b7c9f",label:"m_9bfac126",divider:"m_efdf90cb",item:"m_99ac2aa1",itemLabel:"m_5476e0d3",itemSection:"m_8b75e504",chevron:"m_b85b0bed"};const i0=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,...d}=ae("MenuDivider",null,e),f=vs();return a.jsx(de,{ref:t,...f.getStyles("divider",{className:r,style:o,styles:s,classNames:n}),...d})});i0.classes=ys;i0.displayName="@mantine/core/MenuDivider";const o0=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,onMouseEnter:d,onMouseLeave:f,onKeyDown:p,children:m,...g}=ae("MenuDropdown",null,e),y=v.useRef(null),b=vs(),w=ir(p,R=>{(R.key==="ArrowUp"||R.key==="ArrowDown")&&(R.preventDefault(),y.current?.querySelectorAll("[data-menu-item]:not(:disabled)")[0]?.focus())}),j=ir(d,()=>(b.trigger==="hover"||b.trigger==="click-hover")&&b.openDropdown()),C=ir(f,()=>(b.trigger==="hover"||b.trigger==="click-hover")&&b.closeDropdown());return a.jsxs(Kr.Dropdown,{...g,onMouseEnter:j,onMouseLeave:C,role:"menu","aria-orientation":"vertical",ref:zn(t,y),...b.getStyles("dropdown",{className:r,style:o,styles:s,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:w,children:[b.withInitialFocusPlaceholder&&a.jsx("div",{tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),m]})});o0.classes=ys;o0.displayName="@mantine/core/MenuDropdown";const[_7,om]=No(),a0=pr((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,color:d,closeMenuOnClick:f,leftSection:p,rightSection:m,children:g,disabled:y,"data-disabled":b,...w}=ae("MenuItem",null,e),j=vs(),C=om(),R=jn(),{dir:T}=ps(),E=v.useRef(null),_=w,k=ir(_.onClick,()=>{b||(typeof f=="boolean"?f&&j.closeDropdownImmediately():j.closeOnItemClick&&j.closeDropdownImmediately())}),L=d?R.variantColorResolver({color:d,theme:R,variant:"light"}):void 0,A=d?ci({color:d,theme:R}):null,N=ir(_.onKeyDown,U=>{U.key==="ArrowLeft"&&C&&(C.close(),C.focusParentItem())});return a.jsxs(ar,{onMouseDown:U=>U.preventDefault(),...w,unstyled:j.unstyled,tabIndex:j.menuItemTabIndex,...j.getStyles("item",{className:r,style:o,styles:s,classNames:n}),ref:zn(E,t),role:"menuitem",disabled:y,"data-menu-item":!0,"data-disabled":y||b||void 0,"data-mantine-stop-propagation":!0,onClick:k,onKeyDown:Zx({siblingSelector:"[data-menu-item]:not([data-disabled])",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:j.loop,dir:T,orientation:"vertical",onKeyDown:N}),__vars:{"--menu-item-color":A?.isThemeColor&&A?.shade===void 0?`var(--mantine-color-${A.color}-6)`:L?.color,"--menu-item-hover":L?.hover},children:[p&&a.jsx("div",{...j.getStyles("itemSection",{styles:s,classNames:n}),"data-position":"left",children:p}),g&&a.jsx("div",{...j.getStyles("itemLabel",{styles:s,classNames:n}),children:g}),m&&a.jsx("div",{...j.getStyles("itemSection",{styles:s,classNames:n}),"data-position":"right",children:m})]})});a0.classes=ys;a0.displayName="@mantine/core/MenuItem";const s0=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,...d}=ae("MenuLabel",null,e),f=vs();return a.jsx(de,{ref:t,...f.getStyles("label",{className:r,style:o,styles:s,classNames:n}),...d})});s0.classes=ys;s0.displayName="@mantine/core/MenuLabel";const l0=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,onMouseEnter:d,onMouseLeave:f,onKeyDown:p,children:m,...g}=ae("MenuSubDropdown",null,e),y=v.useRef(null),b=vs(),w=om(),j=ir(d,w?.open),C=ir(f,w?.close);return a.jsx(Kr.Dropdown,{...g,onMouseEnter:j,onMouseLeave:C,role:"menu","aria-orientation":"vertical",ref:zn(t,y),...b.getStyles("dropdown",{className:r,style:o,styles:s,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,children:m})});l0.classes=ys;l0.displayName="@mantine/core/MenuSubDropdown";const c0=pr((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,color:d,leftSection:f,rightSection:p,children:m,disabled:g,"data-disabled":y,closeMenuOnClick:b,...w}=ae("MenuSubItem",null,e),j=vs(),C=om(),R=jn(),{dir:T}=ps(),E=v.useRef(null),_=w,k=d?R.variantColorResolver({color:d,theme:R,variant:"light"}):void 0,L=d?ci({color:d,theme:R}):null,A=ir(_.onKeyDown,Q=>{Q.key==="ArrowRight"&&(C?.open(),C?.focusFirstItem()),Q.key==="ArrowLeft"&&C?.parentContext&&(C.parentContext.close(),C.parentContext.focusParentItem())}),N=ir(_.onClick,()=>{!y&&b&&j.closeDropdownImmediately()}),U=ir(_.onMouseEnter,C?.open),B=ir(_.onMouseLeave,C?.close);return a.jsxs(ar,{onMouseDown:Q=>Q.preventDefault(),...w,unstyled:j.unstyled,tabIndex:j.menuItemTabIndex,...j.getStyles("item",{className:r,style:o,styles:s,classNames:n}),ref:zn(E,t),role:"menuitem",disabled:g,"data-menu-item":!0,"data-sub-menu-item":!0,"data-disabled":g||y||void 0,"data-mantine-stop-propagation":!0,onMouseEnter:U,onMouseLeave:B,onClick:N,onKeyDown:Zx({siblingSelector:"[data-menu-item]:not([data-disabled])",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:j.loop,dir:T,orientation:"vertical",onKeyDown:A}),__vars:{"--menu-item-color":L?.isThemeColor&&L?.shade===void 0?`var(--mantine-color-${L.color}-6)`:k?.color,"--menu-item-hover":k?.hover},children:[f&&a.jsx("div",{...j.getStyles("itemSection",{styles:s,classNames:n}),"data-position":"left",children:f}),m&&a.jsx("div",{...j.getStyles("itemLabel",{styles:s,classNames:n}),children:m}),a.jsx("div",{...j.getStyles("itemSection",{styles:s,classNames:n}),"data-position":"right",children:p||a.jsx(A_,{...j.getStyles("chevron"),size:14})})]})});c0.classes=ys;c0.displayName="@mantine/core/MenuSubItem";function uD({children:e,refProp:t}){if(!Po(e))throw new Error("Menu.Sub.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");return vs(),a.jsx(Kr.Target,{refProp:t,popupType:"menu",children:e})}uD.displayName="@mantine/core/MenuSubTarget";const D7={offset:0,position:"right-start",transitionProps:{duration:0},middlewares:{shift:{crossAxis:!0}}};function Jc(e){const{children:t,closeDelay:n,...r}=ae("MenuSub",D7,e),o=hr(),[s,{open:c,close:d}]=Hc(!1),f=om(),{openDropdown:p,closeDropdown:m}=D_({open:c,close:d,closeDelay:n,openDelay:0}),g=()=>window.setTimeout(()=>{document.getElementById(`${o}-dropdown`)?.querySelectorAll("[data-menu-item]:not([data-disabled])")[0]?.focus()},16),y=()=>window.setTimeout(()=>{document.getElementById(`${o}-target`)?.focus()},16);return a.jsx(_7,{value:{opened:s,close:m,open:p,focusFirstItem:g,focusParentItem:y,parentContext:f},children:a.jsx(Kr,{opened:s,withinPortal:!1,withArrow:!1,id:o,...r,children:t})})}Jc.extend=e=>e;Jc.displayName="@mantine/core/MenuSub";Jc.Target=uD;Jc.Dropdown=l0;Jc.Item=c0;const A7={refProp:"ref"},dD=v.forwardRef((e,t)=>{const{children:n,refProp:r,...o}=ae("MenuTarget",A7,e);if(!Po(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 s=vs(),c=n.props,d=ir(c.onClick,()=>{s.trigger==="click"?s.toggleDropdown():s.trigger==="click-hover"&&(s.setOpenedViaClick(!0),s.opened||s.openDropdown())}),f=ir(c.onMouseEnter,()=>(s.trigger==="hover"||s.trigger==="click-hover")&&s.openDropdown()),p=ir(c.onMouseLeave,()=>{(s.trigger==="hover"||s.trigger==="click-hover"&&!s.openedViaClick)&&s.closeDropdown()});return a.jsx(Kr.Target,{refProp:r,popupType:"menu",ref:t,...o,children:v.cloneElement(n,{onClick:d,onMouseEnter:f,onMouseLeave:p,"data-expanded":s.opened?!0:void 0})})});dD.displayName="@mantine/core/MenuTarget";const k7={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:["mousedown","touchstart","keydown"],loop:!0,trigger:"click",openDelay:0,closeDelay:100,menuItemTabIndex:-1};function we(e){const t=ae("Menu",k7,e),{children:n,onOpen:r,onClose:o,opened:s,defaultOpened:c,trapFocus:d,onChange:f,closeOnItemClick:p,loop:m,closeOnEscape:g,trigger:y,openDelay:b,closeDelay:w,classNames:j,styles:C,unstyled:R,variant:T,vars:E,menuItemTabIndex:_,keepMounted:k,withInitialFocusPlaceholder:L,attributes:A,...N}=t,U=ze({name:"Menu",classes:ys,props:t,classNames:j,styles:C,unstyled:R,attributes:A}),[B,Q]=or({value:s,defaultValue:c,finalValue:!1,onChange:f}),[J,Z]=v.useState(!1),$=()=>{Q(!1),Z(!1),B&&o?.()},W=()=>{Q(!0),!B&&r?.()},M=()=>{B?$():W()},{openDropdown:I,closeDropdown:z}=D_({open:W,close:$,closeDelay:w,openDelay:b}),F=H=>oM("[data-menu-item]","[data-menu-dropdown]",H),{resolvedClassNames:X,resolvedStyles:O}=vl({classNames:j,styles:C,props:t});return a.jsx(R7,{value:{getStyles:U,opened:B,toggleDropdown:M,getItemIndex:F,openedViaClick:J,setOpenedViaClick:Z,closeOnItemClick:p,closeDropdown:y==="click"?$:z,openDropdown:y==="click"?W:I,closeDropdownImmediately:$,loop:m,trigger:y,unstyled:R,menuItemTabIndex:_,withInitialFocusPlaceholder:L},children:a.jsx(Kr,{...N,opened:B,onChange:M,defaultOpened:c,trapFocus:k?!1:d,closeOnEscape:g,__staticSelector:"Menu",classNames:X,styles:O,unstyled:R,variant:T,keepMounted:k,children:n})})}we.extend=e=>e;we.withProps=U4(we);we.classes=ys;we.displayName="@mantine/core/Menu";we.Item=a0;we.Label=s0;we.Dropdown=o0;we.Target=dD;we.Divider=i0;we.Sub=Jc;const[P7,Zc]=Mr("Modal component was not found in tree");var ja={root:"m_9df02822",content:"m_54c44539",inner:"m_1f958f16",header:"m_d0e2b9cd"};const am=be((e,t)=>{const n=ae("ModalBody",null,e),{classNames:r,className:o,style:s,styles:c,vars:d,...f}=n,p=Zc();return a.jsx(b_,{ref:t,...p.getStyles("body",{classNames:r,style:s,styles:c,className:o}),...f})});am.classes=ja;am.displayName="@mantine/core/ModalBody";const sm=be((e,t)=>{const n=ae("ModalCloseButton",null,e),{classNames:r,className:o,style:s,styles:c,vars:d,...f}=n,p=Zc();return a.jsx(S_,{ref:t,...p.getStyles("close",{classNames:r,style:s,styles:c,className:o}),...f})});sm.classes=ja;sm.displayName="@mantine/core/ModalCloseButton";const lm=be((e,t)=>{const n=ae("ModalContent",null,e),{classNames:r,className:o,style:s,styles:c,vars:d,children:f,__hidden:p,...m}=n,g=Zc(),y=g.scrollAreaComponent||wL;return a.jsx(w_,{...g.getStyles("content",{className:o,style:s,styles:c,classNames:r}),innerProps:g.getStyles("inner",{className:o,style:s,styles:c,classNames:r}),"data-full-screen":g.fullScreen||void 0,"data-modal-content":!0,"data-hidden":p||void 0,ref:t,...m,children:a.jsx(y,{style:{maxHeight:g.fullScreen?"100dvh":`calc(100dvh - (${le(g.yOffset)} * 2))`},children:f})})});lm.classes=ja;lm.displayName="@mantine/core/ModalContent";const cm=be((e,t)=>{const n=ae("ModalHeader",null,e),{classNames:r,className:o,style:s,styles:c,vars:d,...f}=n,p=Zc();return a.jsx(j_,{ref:t,...p.getStyles("header",{classNames:r,style:s,styles:c,className:o}),...f})});cm.classes=ja;cm.displayName="@mantine/core/ModalHeader";const um=be((e,t)=>{const n=ae("ModalOverlay",null,e),{classNames:r,className:o,style:s,styles:c,vars:d,...f}=n,p=Zc();return a.jsx(C_,{ref:t,...p.getStyles("overlay",{classNames:r,style:s,styles:c,className:o}),...f})});um.classes=ja;um.displayName="@mantine/core/ModalOverlay";const N7={__staticSelector:"Modal",closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:hi("modal"),transitionProps:{duration:200,transition:"fade-down"},yOffset:"5dvh"},O7=(e,{radius:t,size:n,yOffset:r,xOffset:o})=>({root:{"--modal-radius":t===void 0?void 0:Ft(t),"--modal-size":st(n,"modal-size"),"--modal-y-offset":le(r),"--modal-x-offset":le(o)}}),dm=be((e,t)=>{const n=ae("ModalRoot",N7,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,yOffset:p,scrollAreaComponent:m,radius:g,fullScreen:y,centered:b,xOffset:w,__staticSelector:j,attributes:C,...R}=n,T=ze({name:j,classes:ja,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:C,vars:f,varsResolver:O7});return a.jsx(P7,{value:{yOffset:p,scrollAreaComponent:m,getStyles:T,fullScreen:y},children:a.jsx(x_,{ref:t,...T("root"),"data-full-screen":y||void 0,"data-centered":b||void 0,"data-offset-scrollbars":m===pi.Autosize||void 0,unstyled:d,...R})})});dm.classes=ja;dm.displayName="@mantine/core/ModalRoot";const[M7,L7]=No();function fD({children:e}){const[t,n]=v.useState([]),[r,o]=v.useState(hi("modal"));return a.jsx(M7,{value:{stack:t,addModal:(s,c)=>{n(d=>[...new Set([...d,s])]),o(d=>typeof c=="number"&&typeof d=="number"?Math.max(d,c):d)},removeModal:s=>n(c=>c.filter(d=>d!==s)),getZIndex:s=>`calc(${r} + ${t.indexOf(s)} + 1)`,currentId:t[t.length-1],maxZIndex:r},children:e})}fD.displayName="@mantine/core/ModalStack";const fm=be((e,t)=>{const n=ae("ModalTitle",null,e),{classNames:r,className:o,style:s,styles:c,vars:d,...f}=n,p=Zc();return a.jsx(E_,{ref:t,...p.getStyles("title",{classNames:r,style:s,styles:c,className:o}),...f})});fm.classes=ja;fm.displayName="@mantine/core/ModalTitle";const I7={closeOnClickOutside:!0,withinPortal:!0,lockScroll:!0,trapFocus:!0,returnFocus:!0,closeOnEscape:!0,keepMounted:!1,zIndex:hi("modal"),transitionProps:{duration:200,transition:"fade-down"},withOverlay:!0,withCloseButton:!0},Gn=be((e,t)=>{const{title:n,withOverlay:r,overlayProps:o,withCloseButton:s,closeButtonProps:c,children:d,radius:f,opened:p,stackId:m,zIndex:g,...y}=ae("Modal",I7,e),b=L7(),w=!!n||s,j=b&&m?{closeOnEscape:b.currentId===m,trapFocus:b.currentId===m,zIndex:b.getZIndex(m)}:{},C=r===!1?!1:m&&b?b.currentId===m:p;return v.useEffect(()=>{b&&m&&(p?b.addModal(m,g||hi("modal")):b.removeModal(m))},[p,m,g]),a.jsxs(dm,{ref:t,radius:f,opened:p,zIndex:b&&m?b.getZIndex(m):g,...y,...j,children:[r&&a.jsx(um,{visible:C,transitionProps:b&&m?{duration:0}:void 0,...o}),a.jsxs(lm,{radius:f,__hidden:b&&m&&p?m!==b.currentId:!1,children:[w&&a.jsxs(cm,{children:[n&&a.jsx(fm,{children:n}),s&&a.jsx(sm,{...c})]}),a.jsx(am,{children:d})]})]})});Gn.classes=ja;Gn.displayName="@mantine/core/Modal";Gn.Root=dm;Gn.Overlay=um;Gn.Content=lm;Gn.Body=am;Gn.Header=cm;Gn.Title=fm;Gn.CloseButton=sm;Gn.Stack=fD;const[z7,u0]=No(),[$7,U7]=No();var hm={root:"m_7cda1cd6","root--default":"m_44da308b","root--contrast":"m_e3a01f8",label:"m_1e0e6180",remove:"m_ae386778",group:"m_1dcfd90b"};const B7=(e,{gap:t},{size:n})=>({group:{"--pg-gap":t!==void 0?st(t):st(n,"pg-gap")}}),d0=be((e,t)=>{const n=ae("PillGroup",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,size:p,disabled:m,attributes:g,...y}=n,w=u0()?.size||p||void 0,j=ze({name:"PillGroup",classes:hm,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:g,vars:f,varsResolver:B7,stylesCtx:{size:w},rootSelector:"group"});return a.jsx($7,{value:{size:w,disabled:m},children:a.jsx(de,{ref:t,size:w,...j("group"),...y})})});d0.classes=hm;d0.displayName="@mantine/core/PillGroup";const V7={variant:"default"},F7=(e,{radius:t},{size:n})=>({root:{"--pill-fz":st(n,"pill-fz"),"--pill-height":st(n,"pill-height"),"--pill-radius":t===void 0?void 0:Ft(t)}}),ma=be((e,t)=>{const n=ae("Pill",V7,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,variant:p,children:m,withRemoveButton:g,onRemove:y,removeButtonProps:b,radius:w,size:j,disabled:C,mod:R,attributes:T,...E}=n,_=U7(),k=u0(),L=j||_?.size||void 0,A=k?.variant==="filled"?"contrast":p||"default",N=ze({name:"Pill",classes:hm,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:T,vars:f,varsResolver:F7,stylesCtx:{size:L}});return a.jsxs(de,{component:"span",ref:t,variant:A,size:L,...N("root",{variant:A}),mod:[{"with-remove":g&&!C,disabled:C||_?.disabled},R],...E,children:[a.jsx("span",{...N("label"),children:m}),g&&a.jsx(ms,{variant:"transparent",radius:w,tabIndex:-1,"aria-hidden":!0,unstyled:d,...b,...N("remove",{className:b?.className,style:b?.style}),onMouseDown:U=>{U.preventDefault(),U.stopPropagation(),b?.onMouseDown?.(U)},onClick:U=>{U.stopPropagation(),y?.(),b?.onClick?.(U)}})]})});ma.classes=hm;ma.displayName="@mantine/core/Pill";ma.Group=d0;var hD={field:"m_45c4369d"};const H7={type:"visible"},f0=be((e,t)=>{const n=ae("PillsInputField",H7,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,type:p,disabled:m,id:g,pointer:y,mod:b,attributes:w,...j}=n,C=u0(),R=Qc(),T=ze({name:"PillsInputField",classes:hD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:w,rootSelector:"field"}),E=m||C?.disabled;return a.jsx(de,{component:"input",ref:zn(t,C?.fieldRef),"data-type":p,disabled:E,mod:[{disabled:E,pointer:y},b],...T("field"),...j,id:R?.inputId||g,"aria-invalid":C?.hasError,"aria-describedby":R?.describedBy,type:"text",onMouseDown:_=>!y&&_.stopPropagation()})});f0.classes=hD;f0.displayName="@mantine/core/PillsInputField";const q7={size:"sm"},us=be((e,t)=>{const n=ae("PillsInput",q7,e),{children:r,onMouseDown:o,onClick:s,size:c,disabled:d,__staticSelector:f,error:p,variant:m,...g}=n,y=v.useRef(null);return a.jsx(z7,{value:{fieldRef:y,size:c,disabled:d,hasError:!!p,variant:m},children:a.jsx(Lr,{size:c,error:p,variant:m,component:"div",ref:t,"data-no-overflow":!0,onMouseDown:b=>{b.preventDefault(),o?.(b),y.current?.focus()},onClick:b=>{b.preventDefault(),b.currentTarget.closest("fieldset")?.disabled||(y.current?.focus(),s?.(b))},...g,multiline:!0,disabled:d,__staticSelector:f||"PillsInput",withAria:!1,children:r})})});us.displayName="@mantine/core/PillsInput";us.Field=f0;function G7({data:e,value:t}){const n=t.map(o=>o.trim().toLowerCase());return e.reduce((o,s)=>(Lc(s)?o.push({group:s.group,items:s.items.filter(c=>n.indexOf(c.value.toLowerCase().trim())===-1)}):n.indexOf(s.value.toLowerCase().trim())===-1&&o.push(s),o),[])}const W7={maxValues:1/0,withCheckIcon:!0,checkIconPosition:"left",hiddenInputValuesDivider:",",clearSearchOnChange:!0,size:"sm"},pm=be((e,t)=>{const n=ae("MultiSelect",W7,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,size:p,value:m,defaultValue:g,onChange:y,onKeyDown:b,variant:w,data:j,dropdownOpened:C,defaultDropdownOpened:R,onDropdownOpen:T,onDropdownClose:E,selectFirstOptionOnChange:_,onOptionSubmit:k,comboboxProps:L,filter:A,limit:N,withScrollArea:U,maxDropdownHeight:B,searchValue:Q,defaultSearchValue:J,onSearchChange:Z,readOnly:$,disabled:W,onFocus:M,onBlur:I,radius:z,rightSection:F,rightSectionWidth:X,rightSectionPointerEvents:O,rightSectionProps:H,leftSection:oe,leftSectionWidth:ue,leftSectionPointerEvents:Se,leftSectionProps:ge,inputContainer:Pe,inputWrapperOrder:rt,withAsterisk:Ce,labelProps:ht,descriptionProps:lt,errorProps:vt,wrapperProps:it,description:wt,label:pt,error:It,maxValues:_e,searchable:Ee,nothingFoundMessage:Le,withCheckIcon:Ne,checkIconPosition:ct,hidePickedOptions:et,withErrorStyles:at,name:ve,form:pe,id:Oe,clearable:tt,clearButtonProps:Tt,hiddenInputProps:Cn,placeholder:gn,hiddenInputValuesDivider:$n,required:Wn,mod:Un,renderOption:Dn,onRemove:Zn,onClear:Nn,scrollAreaProps:Uo,chevronColor:ao,attributes:Zr,clearSearchOnChange:Bo,...$i}=n,so=hr(Oe),Ir=M_(j),mr=L_(Ir),Ui=v.useRef({}),Qn=bl({opened:C,defaultOpened:R,onDropdownOpen:T,onDropdownClose:()=>{E?.(),Qn.resetSelectedOption()}}),{styleProps:Vo,rest:{type:Cs,autoComplete:Fo,...au}}=Sa($i),[V,Y]=or({value:m,defaultValue:g,finalValue:[],onChange:y}),[ie,je]=or({value:Q,defaultValue:J,finalValue:"",onChange:Z}),De=nt=>{je(nt),Qn.resetSelectedOption()},We=ze({name:"MultiSelect",classes:{},props:n,classNames:r,styles:c,unstyled:d,attributes:Zr}),{resolvedClassNames:Ke,resolvedStyles:Be}=vl({props:n,styles:c,classNames:r}),Me=nt=>{b?.(nt),nt.key===" "&&!Ee&&(nt.preventDefault(),Qn.toggleDropdown()),nt.key==="Backspace"&&ie.length===0&&V.length>0&&(Zn?.(V[V.length-1]),Y(V.slice(0,V.length-1)))},Ve=V.map((nt,fn)=>{const hn=mr[nt]||Ui.current[nt];return a.jsx(ma,{withRemoveButton:!$&&!mr[nt]?.disabled,onRemove:()=>{Y(V.filter(qt=>nt!==qt)),Zn?.(nt)},unstyled:d,disabled:W,...We("pill"),children:hn?.label||nt},`${nt}-${fn}`)});v.useEffect(()=>{_&&Qn.selectFirstOption()},[_,ie]),v.useEffect(()=>{V.forEach(nt=>{nt in mr&&(Ui.current[nt]=mr[nt])})},[mr,V]);const Qe=a.jsx(Ye.ClearButton,{...Tt,onClear:()=>{Nn?.(),Y([]),De("")}}),Ze=G7({data:Ir,value:V}),Et=tt&&V.length>0&&!W&&!$;return a.jsxs(a.Fragment,{children:[a.jsxs(Ye,{store:Qn,classNames:Ke,styles:Be,unstyled:d,size:p,readOnly:$,__staticSelector:"MultiSelect",attributes:Zr,onOptionSubmit:nt=>{k?.(nt),Bo&&De(""),Qn.updateSelectedOptionIndex("selected"),V.includes(mr[nt].value)?(Y(V.filter(fn=>fn!==mr[nt].value)),Zn?.(mr[nt].value)):V.length<_e&&Y([...V,mr[nt].value])},...L,children:[a.jsx(Ye.DropdownTarget,{children:a.jsx(us,{...Vo,__staticSelector:"MultiSelect",classNames:Ke,styles:Be,unstyled:d,size:p,className:o,style:s,variant:w,disabled:W,radius:z,__defaultRightSection:a.jsx(Ye.Chevron,{size:p,error:It,unstyled:d,color:ao}),__clearSection:Qe,__clearable:Et,rightSection:F,rightSectionPointerEvents:O||"none",rightSectionWidth:X,rightSectionProps:H,leftSection:oe,leftSectionWidth:ue,leftSectionPointerEvents:Se,leftSectionProps:ge,inputContainer:Pe,inputWrapperOrder:rt,withAsterisk:Ce,labelProps:ht,descriptionProps:lt,errorProps:vt,wrapperProps:it,description:wt,label:pt,error:It,withErrorStyles:at,__stylesApiProps:{...n,rightSectionPointerEvents:O||(Et?"all":"none"),multiline:!0},pointer:!Ee,onClick:()=>Ee?Qn.openDropdown():Qn.toggleDropdown(),"data-expanded":Qn.dropdownOpened||void 0,id:so,required:Wn,mod:Un,attributes:Zr,children:a.jsxs(ma.Group,{attributes:Zr,disabled:W,unstyled:d,...We("pillsList"),children:[Ve,a.jsx(Ye.EventsTarget,{autoComplete:Fo,children:a.jsx(us.Field,{...au,ref:t,id:so,placeholder:gn,type:!Ee&&!gn?"hidden":"visible",...We("inputField"),unstyled:d,onFocus:nt=>{M?.(nt),Ee&&Qn.openDropdown()},onBlur:nt=>{I?.(nt),Qn.closeDropdown(),De("")},onKeyDown:Me,value:ie,onChange:nt=>{De(nt.currentTarget.value),Ee&&Qn.openDropdown(),_&&Qn.selectFirstOption()},disabled:W,readOnly:$||!Ee,pointer:!Ee})})]})})}),a.jsx(_I,{data:et?Ze:Ir,hidden:$||W,filter:A,search:ie,limit:N,hiddenWhenEmpty:!Le,withScrollArea:U,maxDropdownHeight:B,filterOptions:Ee,value:V,checkIconPosition:ct,withCheckIcon:Ne,nothingFoundMessage:Le,unstyled:d,labelId:pt?`${so}-label`:void 0,"aria-label":pt?void 0:$i["aria-label"],renderOption:Dn,scrollAreaProps:Uo})]}),a.jsx(Ye.HiddenInput,{name:ve,valuesDivider:$n,value:V,form:pe,disabled:W,...Cn})]})});pm.classes={...Lr.classes,...Ye.classes};pm.displayName="@mantine/core/MultiSelect";function Q7(e){return"group"in e}function h0({data:e}){if(Q7(e)){const o=e.items.map(s=>a.jsx(h0,{data:s},s.value));return a.jsx("optgroup",{label:e.group,children:o})}const{value:t,label:n,...r}=e;return a.jsx("option",{value:e.value,...r,children:e.label},e.value)}h0.displayName="@mantine/core/NativeSelectOption";const Y7={rightSectionPointerEvents:"none"},un=be((e,t)=>{const{data:n,children:r,size:o,error:s,rightSection:c,unstyled:d,...f}=ae("NativeSelect",Y7,e),p=M_(n).map((m,g)=>a.jsx(h0,{data:m},g));return a.jsx(Lr,{component:"select",ref:t,...f,__staticSelector:"NativeSelect",size:o,pointer:!0,error:s,unstyled:d,rightSection:c||a.jsx(em,{size:o,error:s,unstyled:d}),children:r||p})});un.classes=Lr.classes;un.displayName="@mantine/core/NativeSelect";var pD={root:"m_a513464",icon:"m_a4ceffb",loader:"m_b0920b15",body:"m_a49ed24",title:"m_3feedf16",description:"m_3d733a3a",closeButton:"m_919a4d88"};const K7={withCloseButton:!0},X7=(e,{radius:t,color:n})=>({root:{"--notification-radius":t===void 0?void 0:Ft(t),"--notification-color":n?Qt(n,e):void 0}}),p0=be((e,t)=>{const n=ae("Notification",K7,e),{className:r,color:o,radius:s,loading:c,withCloseButton:d,withBorder:f,title:p,icon:m,children:g,onClose:y,closeButtonProps:b,classNames:w,style:j,styles:C,unstyled:R,variant:T,vars:E,mod:_,loaderProps:k,role:L,attributes:A,...N}=n,U=ze({name:"Notification",classes:pD,props:n,className:r,style:j,classNames:w,styles:C,unstyled:R,attributes:A,vars:E,varsResolver:X7});return a.jsxs(de,{...U("root"),mod:[{"data-with-icon":!!m||c,"data-with-border":f},_],ref:t,variant:T,role:L||"alert",...N,children:[m&&!c&&a.jsx("div",{...U("icon"),children:m}),c&&a.jsx(Or,{size:28,color:o,...k,...U("loader")}),a.jsxs("div",{...U("body"),children:[p&&a.jsx("div",{...U("title"),children:p}),a.jsx(de,{...U("description"),mod:{"data-with-title":!!p},children:g})]}),d&&a.jsx(ms,{iconSize:16,color:"gray",...b,unstyled:R,onClick:y,...U("closeButton")})]})});p0.classes=pD;p0.displayName="@mantine/core/Notification";function mD(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}var vd;(function(e){e.event="event",e.props="prop"})(vd||(vd={}));function rs(){}function J7(e){var t,n=void 0;return function(){for(var r=[],o=arguments.length;o--;)r[o]=arguments[o];return t&&r.length===t.length&&r.every(function(s,c){return s===t[c]})||(t=r,n=e.apply(void 0,r)),n}}function yd(e){return!!(e||"").match(/\d/)}function _c(e){return e==null}function Z7(e){return typeof e=="number"&&isNaN(e)}function gD(e){return _c(e)||Z7(e)||typeof e=="number"&&!isFinite(e)}function vD(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function e6(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;case"thousand":default:return/(\d)(?=(\d{3})+(?!\d))/g}}function t6(e,t,n){var r=e6(n),o=e.search(/[1-9]/);return o=o===-1?e.length:o,e.substring(0,o)+e.substring(o,e.length).replace(r,"$1"+t)}function n6(e){var t=v.useRef(e);t.current=e;var n=v.useRef(function(){for(var r=[],o=arguments.length;o--;)r[o]=arguments[o];return t.current.apply(t,r)});return n.current}function m0(e,t){t===void 0&&(t=!0);var n=e[0]==="-",r=n&&t;e=e.replace("-","");var o=e.split("."),s=o[0],c=o[1]||"";return{beforeDecimal:s,afterDecimal:c,hasNegation:n,addNegation:r}}function r6(e){if(!e)return e;var t=e[0]==="-";t&&(e=e.substring(1,e.length));var n=e.split("."),r=n[0].replace(/^0+/,"")||"0",o=n[1]||"";return(t?"-":"")+r+(o?"."+o:"")}function yD(e,t,n){for(var r="",o=n?"0":"",s=0;s<=t-1;s++)r+=e[s]||o;return r}function ME(e,t){return Array(t+1).join(e)}function xD(e){var t=e+"",n=t[0]==="-"?"-":"";n&&(t=t.substring(1));var r=t.split(/[eE]/g),o=r[0],s=r[1];if(s=Number(s),!s)return n+o;o=o.replace(".","");var c=1+s,d=o.length;return c<0?o="0."+ME("0",Math.abs(c))+o:c>=d?o=o+ME("0",c-d):o=(o.substring(0,c)||"0")+"."+o.substring(c),n+o}function LE(e,t,n){if(["","-"].indexOf(e)!==-1)return e;var r=(e.indexOf(".")!==-1||n)&&t,o=m0(e),s=o.beforeDecimal,c=o.afterDecimal,d=o.hasNegation,f=parseFloat("0."+(c||"0")),p=c.length<=t?"0."+c:f.toFixed(t),m=p.split("."),g=s;s&&Number(m[0])&&(g=s.split("").reverse().reduce(function(j,C,R){return j.length>R?(Number(j[0])+Number(C)).toString()+j.substring(1,j.length):C+j},m[0]));var y=yD(m[1]||"",t,n),b=d?"-":"",w=r?".":"";return""+b+g+w+y}function Gs(e,t){if(e.value=e.value,e!==null){if(e.createTextRange){var n=e.createTextRange();return n.move("character",t),n.select(),!0}return e.selectionStart||e.selectionStart===0?(e.focus(),e.setSelectionRange(t,t),!0):(e.focus(),!1)}}var bD=J7(function(e,t){for(var n=0,r=0,o=e.length,s=t.length;e[n]===t[n]&&n<o;)n++;for(;e[o-1-r]===t[s-1-r]&&s-r>n&&o-r>n;)r++;return{from:{start:n,end:o-r},to:{start:n,end:s-r}}}),i6=function(e,t){var n=Math.min(e.selectionStart,t);return{from:{start:n,end:e.selectionEnd},to:{start:n,end:t}}};function o6(e,t,n){return Math.min(Math.max(e,t),n)}function jy(e){return Math.max(e.selectionStart,e.selectionEnd)}function a6(){return typeof navigator<"u"&&!(navigator.platform&&/iPhone|iPod/.test(navigator.platform))}function s6(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}function l6(e){var t=e.currentValue,n=e.formattedValue,r=e.currentValueIndex,o=e.formattedValueIndex;return t[r]===n[o]}function c6(e,t,n,r,o,s,c){c===void 0&&(c=l6);var d=o.findIndex(function(_){return _}),f=e.slice(0,d);!t&&!n.startsWith(f)&&(t=f,n=f+n,r=r+f.length);for(var p=n.length,m=e.length,g={},y=new Array(p),b=0;b<p;b++){y[b]=-1;for(var w=0,j=m;w<j;w++){var C=c({currentValue:n,lastValue:t,formattedValue:e,currentValueIndex:b,formattedValueIndex:w});if(C&&g[w]!==!0){y[b]=w,g[w]=!0;break}}}for(var R=r;R<p&&(y[R]===-1||!s(n[R]));)R++;var T=R===p||y[R]===-1?m:y[R];for(R=r-1;R>0&&y[R]===-1;)R--;var E=R===-1||y[R]===-1?0:y[R]+1;return E>T?T:r-E<T-r?E:T}function IE(e,t,n,r){var o=e.length;if(t=o6(t,0,o),r==="left"){for(;t>=0&&!n[t];)t--;t===-1&&(t=n.indexOf(!0))}else{for(;t<=o&&!n[t];)t++;t>o&&(t=n.lastIndexOf(!0))}return t===-1&&(t=o),t}function u6(e){for(var t=Array.from({length:e.length+1}).map(function(){return!0}),n=0,r=t.length;n<r;n++)t[n]=!!(yd(e[n])||yd(e[n-1]));return t}function SD(e,t,n,r,o,s){s===void 0&&(s=rs);var c=n6(function(w,j){var C,R;return gD(w)?(R="",C=""):typeof w=="number"||j?(R=typeof w=="number"?xD(w):w,C=r(R)):(R=o(w,void 0),C=r(R)),{formattedValue:C,numAsString:R}}),d=v.useState(function(){return c(_c(e)?t:e,n)}),f=d[0],p=d[1],m=function(w,j){w.formattedValue!==f.formattedValue&&p({formattedValue:w.formattedValue,numAsString:w.value}),s(w,j)},g=e,y=n;_c(e)&&(g=f.numAsString,y=!0);var b=c(g,y);return v.useMemo(function(){p(b)},[b.formattedValue]),[f,m]}function d6(e){return e.replace(/[^0-9]/g,"")}function f6(e){return e}function h6(e){var t=e.type;t===void 0&&(t="text");var n=e.displayType;n===void 0&&(n="input");var r=e.customInput,o=e.renderText,s=e.getInputRef,c=e.format;c===void 0&&(c=f6);var d=e.removeFormatting;d===void 0&&(d=d6);var f=e.defaultValue,p=e.valueIsNumericString,m=e.onValueChange,g=e.isAllowed,y=e.onChange;y===void 0&&(y=rs);var b=e.onKeyDown;b===void 0&&(b=rs);var w=e.onMouseUp;w===void 0&&(w=rs);var j=e.onFocus;j===void 0&&(j=rs);var C=e.onBlur;C===void 0&&(C=rs);var R=e.value,T=e.getCaretBoundary;T===void 0&&(T=u6);var E=e.isValidInputCharacter;E===void 0&&(E=yd);var _=e.isCharacterSame,k=mD(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),L=SD(R,f,!!p,c,d,m),A=L[0],N=A.formattedValue,U=A.numAsString,B=L[1],Q=v.useRef(),J=v.useRef({formattedValue:N,numAsString:U}),Z=function(_e,Ee){J.current={formattedValue:_e.formattedValue,numAsString:_e.value},B(_e,Ee)},$=v.useState(!1),W=$[0],M=$[1],I=v.useRef(null),z=v.useRef({setCaretTimeout:null,focusTimeout:null});v.useEffect(function(){return M(!0),function(){clearTimeout(z.current.setCaretTimeout),clearTimeout(z.current.focusTimeout)}},[]);var F=c,X=function(_e,Ee){var Le=parseFloat(Ee);return{formattedValue:_e,value:Ee,floatValue:isNaN(Le)?void 0:Le}},O=function(_e,Ee,Le){_e.selectionStart===0&&_e.selectionEnd===_e.value.length||(Gs(_e,Ee),z.current.setCaretTimeout=setTimeout(function(){_e.value===Le&&_e.selectionStart!==Ee&&Gs(_e,Ee)},0))},H=function(_e,Ee,Le){return IE(_e,Ee,T(_e),Le)},oe=function(_e,Ee,Le){var Ne=T(Ee),ct=c6(Ee,N,_e,Le,Ne,E,_);return ct=IE(Ee,ct,Ne),ct},ue=function(_e){var Ee=_e.formattedValue;Ee===void 0&&(Ee="");var Le=_e.input,Ne=_e.source,ct=_e.event,et=_e.numAsString,at;if(Le){var ve=_e.inputValue||Le.value,pe=jy(Le);Le.value=Ee,at=oe(ve,Ee,pe),at!==void 0&&O(Le,at,Ee)}Ee!==N&&Z(X(Ee,et),{event:ct,source:Ne})};v.useEffect(function(){var _e=J.current,Ee=_e.formattedValue,Le=_e.numAsString;(N!==Ee||U!==Le)&&Z(X(N,U),{event:void 0,source:vd.props})},[N,U]);var Se=I.current?jy(I.current):void 0,ge=typeof window<"u"?v.useLayoutEffect:v.useEffect;ge(function(){var _e=I.current;if(N!==J.current.formattedValue&&_e){var Ee=oe(J.current.formattedValue,N,Se);_e.value=N,O(_e,Ee,N)}},[N]);var Pe=function(_e,Ee,Le){var Ne=Ee.target,ct=Q.current?i6(Q.current,Ne.selectionEnd):bD(N,_e),et=Object.assign(Object.assign({},ct),{lastValue:N}),at=d(_e,et),ve=F(at);if(at=d(ve,void 0),g&&!g(X(ve,at))){var pe=Ee.target,Oe=jy(pe),tt=oe(_e,N,Oe);return pe.value=N,O(pe,tt,N),!1}return ue({formattedValue:ve,numAsString:at,inputValue:_e,event:Ee,source:Le,input:Ee.target}),!0},rt=function(_e,Ee){Ee===void 0&&(Ee=0);var Le=_e.selectionStart,Ne=_e.selectionEnd;Q.current={selectionStart:Le,selectionEnd:Ne+Ee}},Ce=function(_e){var Ee=_e.target,Le=Ee.value,Ne=Pe(Le,_e,vd.event);Ne&&y(_e),Q.current=void 0},ht=function(_e){var Ee=_e.target,Le=_e.key,Ne=Ee.selectionStart,ct=Ee.selectionEnd,et=Ee.value;et===void 0&&(et="");var at;Le==="ArrowLeft"||Le==="Backspace"?at=Math.max(Ne-1,0):Le==="ArrowRight"?at=Math.min(Ne+1,et.length):Le==="Delete"&&(at=Ne);var ve=0;Le==="Delete"&&Ne===ct&&(ve=1);var pe=Le==="ArrowLeft"||Le==="ArrowRight";if(at===void 0||Ne!==ct&&!pe){b(_e),rt(Ee,ve);return}var Oe=at;if(pe){var tt=Le==="ArrowLeft"?"left":"right";Oe=H(et,at,tt),Oe!==at&&_e.preventDefault()}else Le==="Delete"&&!E(et[at])?Oe=H(et,at,"right"):Le==="Backspace"&&!E(et[at])&&(Oe=H(et,at,"left"));Oe!==at&&O(Ee,Oe,et),b(_e),rt(Ee,ve)},lt=function(_e){var Ee=_e.target,Le=function(){var Ne=Ee.selectionStart,ct=Ee.selectionEnd,et=Ee.value;if(et===void 0&&(et=""),Ne===ct){var at=H(et,Ne);at!==Ne&&O(Ee,at,et)}};Le(),requestAnimationFrame(function(){Le()}),w(_e),rt(Ee)},vt=function(_e){_e.persist&&_e.persist();var Ee=_e.target,Le=_e.currentTarget;I.current=Ee,z.current.focusTimeout=setTimeout(function(){var Ne=Ee.selectionStart,ct=Ee.selectionEnd,et=Ee.value;et===void 0&&(et="");var at=H(et,Ne);at!==Ne&&!(Ne===0&&ct===et.length)&&O(Ee,at,et),j(Object.assign(Object.assign({},_e),{currentTarget:Le}))},0)},it=function(_e){I.current=null,clearTimeout(z.current.focusTimeout),clearTimeout(z.current.setCaretTimeout),C(_e)},wt=W&&a6()?"numeric":void 0,pt=Object.assign({inputMode:wt},k,{type:t,value:N,onChange:Ce,onKeyDown:ht,onMouseUp:lt,onFocus:vt,onBlur:it});if(n==="text")return o?kn.createElement(kn.Fragment,null,o(N,k)||null):kn.createElement("span",Object.assign({},k,{ref:s}),N);if(r){var It=r;return kn.createElement(It,Object.assign({},pt,{ref:s}))}return kn.createElement("input",Object.assign({},pt,{ref:s}))}function zE(e,t){var n=t.decimalScale,r=t.fixedDecimalScale,o=t.prefix;o===void 0&&(o="");var s=t.suffix;s===void 0&&(s="");var c=t.allowNegative,d=t.thousandsGroupStyle;if(d===void 0&&(d="thousand"),e===""||e==="-")return e;var f=mm(t),p=f.thousandSeparator,m=f.decimalSeparator,g=n!==0&&e.indexOf(".")!==-1||n&&r,y=m0(e,c),b=y.beforeDecimal,w=y.afterDecimal,j=y.addNegation;return n!==void 0&&(w=yD(w,n,!!r)),p&&(b=t6(b,p,d)),o&&(b=o+b),s&&(w=w+s),j&&(b="-"+b),e=b+(g&&m||"")+w,e}function mm(e){var t=e.decimalSeparator;t===void 0&&(t=".");var n=e.thousandSeparator,r=e.allowedDecimalSeparators;return n===!0&&(n=","),r||(r=[t,"."]),{decimalSeparator:t,thousandSeparator:n,allowedDecimalSeparators:r}}function p6(e,t){e===void 0&&(e="");var n=new RegExp("(-)"),r=new RegExp("(-)(.)*(-)"),o=n.test(e),s=r.test(e);return e=e.replace(/-/g,""),o&&!s&&t&&(e="-"+e),e}function m6(e,t){return new RegExp("(^-)|[0-9]|"+vD(e),"g")}function g6(e,t,n){return e===""?!0:!t?.match(/\d/)&&!n?.match(/\d/)&&typeof e=="string"&&!isNaN(Number(e))}function v6(e,t,n){var r;t===void 0&&(t=s6(e));var o=n.allowNegative,s=n.prefix;s===void 0&&(s="");var c=n.suffix;c===void 0&&(c="");var d=n.decimalScale,f=t.from,p=t.to,m=p.start,g=p.end,y=mm(n),b=y.allowedDecimalSeparators,w=y.decimalSeparator,j=e[g]===w;if(yd(e)&&(e===s||e===c)&&t.lastValue==="")return e;if(g-m===1&&b.indexOf(e[m])!==-1){var C=d===0?"":w;e=e.substring(0,m)+C+e.substring(m+1,e.length)}var R=function(I,z,F){var X=!1,O=!1;s.startsWith("-")?X=!1:I.startsWith("--")?(X=!1,O=!0):c.startsWith("-")&&I.length===c.length?X=!1:I[0]==="-"&&(X=!0);var H=X?1:0;return O&&(H=2),H&&(I=I.substring(H),z-=H,F-=H),{value:I,start:z,end:F,hasNegation:X}},T=R(e,m,g),E=T.hasNegation;r=T,e=r.value,m=r.start,g=r.end;var _=R(t.lastValue,f.start,f.end),k=_.start,L=_.end,A=_.value,N=e.substring(m,g);e.length&&A.length&&(k>A.length-c.length||L<s.length)&&!(N&&c.startsWith(N))&&(e=A);var U=0;e.startsWith(s)?U+=s.length:m<s.length&&(U=m),e=e.substring(U),g-=U;var B=e.length,Q=e.length-c.length;e.endsWith(c)?B=Q:(g>Q||g>e.length-c.length)&&(B=g),e=e.substring(0,B),e=p6(E?"-"+e:e,o),e=(e.match(m6(w))||[]).join("");var J=e.indexOf(w);e=e.replace(new RegExp(vD(w),"g"),function(I,z){return z===J?".":""});var Z=m0(e,o),$=Z.beforeDecimal,W=Z.afterDecimal,M=Z.addNegation;return p.end-p.start<f.end-f.start&&$===""&&j&&!parseFloat(W)&&(e=M?"-":""),e}function y6(e,t){var n=t.prefix;n===void 0&&(n="");var r=t.suffix;r===void 0&&(r="");var o=Array.from({length:e.length+1}).map(function(){return!0}),s=e[0]==="-";o.fill(!1,0,n.length+(s?1:0));var c=e.length;return o.fill(!1,c-r.length+1,c+1),o}function x6(e){var t=mm(e),n=t.thousandSeparator,r=t.decimalSeparator,o=e.prefix;o===void 0&&(o="");var s=e.allowNegative;if(s===void 0&&(s=!0),n===r)throw new Error(`
49
- Decimal separator can't be same as thousand separator.
50
- thousandSeparator: `+n+` (thousandSeparator = {true} is same as thousandSeparator = ",")
51
- decimalSeparator: `+r+` (default value for decimalSeparator is .)
52
- `);return o.startsWith("-")&&s&&(console.error(`
53
- Prefix can't start with '-' when allowNegative is true.
54
- prefix: `+o+`
55
- allowNegative: `+s+`
56
- `),s=!1),Object.assign(Object.assign({},e),{allowNegative:s})}function b6(e){e=x6(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,o=e.onKeyDown;o===void 0&&(o=rs);var s=e.onBlur;s===void 0&&(s=rs);var c=e.thousandSeparator,d=e.decimalScale,f=e.fixedDecimalScale,p=e.prefix;p===void 0&&(p="");var m=e.defaultValue,g=e.value,y=e.valueIsNumericString,b=e.onValueChange,w=mD(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),j=mm(e),C=j.decimalSeparator,R=j.allowedDecimalSeparators,T=function(M){return zE(M,e)},E=function(M,I){return v6(M,I,e)},_=_c(g)?m:g,k=y??g6(_,p,t);_c(g)?_c(m)||(k=k||typeof m=="number"):k=k||typeof g=="number";var L=function(M){return gD(M)?M:(typeof M=="number"&&(M=xD(M)),k&&typeof d=="number"?LE(M,d,!!f):M)},A=SD(L(g),L(m),!!k,T,E,b),N=A[0],U=N.numAsString,B=N.formattedValue,Q=A[1],J=function(M){var I=M.target,z=M.key,F=I.selectionStart,X=I.selectionEnd,O=I.value;if(O===void 0&&(O=""),(z==="Backspace"||z==="Delete")&&X<p.length){M.preventDefault();return}if(F!==X){o(M);return}z==="Backspace"&&O[0]==="-"&&F===p.length+1&&n&&Gs(I,1),d&&f&&(z==="Backspace"&&O[F-1]===C?(Gs(I,F-1),M.preventDefault()):z==="Delete"&&O[F]===C&&M.preventDefault()),R?.includes(z)&&O[F]===C&&Gs(I,F+1);var H=c===!0?",":c;z==="Backspace"&&O[F-1]===H&&Gs(I,F-1),z==="Delete"&&O[F]===H&&Gs(I,F+1),o(M)},Z=function(M){var I=U;if(I.match(/\d/g)||(I=""),r||(I=r6(I)),f&&d&&(I=LE(I,d,f)),I!==U){var z=zE(I,e);Q({formattedValue:z,value:I,floatValue:parseFloat(I)},{event:M,source:vd.event})}s(M)},$=function(M){return M===C?!0:yd(M)},W=function(M){var I=M.currentValue,z=M.lastValue,F=M.formattedValue,X=M.currentValueIndex,O=M.formattedValueIndex,H=I[X],oe=F[O],ue=bD(z,I),Se=ue.to,ge=function(Pe){return E(Pe).indexOf(".")+p.length};return g===0&&f&&d&&I[Se.start]===C&&ge(I)<X&&ge(F)>O?!1:X>=Se.start&&X<Se.end&&R&&R.includes(H)&&oe===C?!0:H===oe};return Object.assign(Object.assign({},w),{value:B,valueIsNumericString:!1,isValidInputCharacter:$,isCharacterSame:W,onValueChange:Q,format:T,removeFormatting:E,getCaretBoundary:function(M){return y6(M,e)},onKeyDown:J,onBlur:Z})}function S6(e){var t=b6(e);return kn.createElement(h6,Object.assign({},t))}function $E({direction:e,style:t,...n}){return a.jsx("svg",{style:{width:"var(--ni-chevron-size)",height:"var(--ni-chevron-size)",transform:e==="up"?"rotate(180deg)":void 0,...t},viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",...n,children:a.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}var gx={root:"m_e2f5cd4e",controls:"m_95e17d22",control:"m_80b4b171"};const w6=/^(0\.0*|-0(\.0*)?)$/,j6=/^-?0\d+(\.\d+)?\.?$/,C6=/\.\d*0$/;function vx(e){return typeof e=="string"&&e!==""&&!Number.isNaN(Number(e))}function Cy(e){return typeof e=="number"?e<Number.MAX_SAFE_INTEGER:e===""||vx(e)&&Number(e)<Number.MAX_SAFE_INTEGER}function E6(e){return e.toString().replace(".","").length}function T6(e,t){return(typeof e=="number"?e<Number.MAX_SAFE_INTEGER:!Number.isNaN(Number(e)))&&!Number.isNaN(e)&&E6(t)<14&&t!==""}function UE(e,t,n){if(e===void 0)return!0;const r=t===void 0||e>=t,o=n===void 0||e<=n;return r&&o}const R6={step:1,clampBehavior:"blur",allowDecimal:!0,allowNegative:!0,withKeyboardEvents:!0,allowLeadingZeros:!0,trimLeadingZeroesOnBlur:!0,startValue:0},_6=(e,{size:t})=>({controls:{"--ni-chevron-size":st(t,"ni-chevron-size")}});function D6(e,t,n){const r=e.toString().replace(/^0+(?=\d)/,""),o=parseFloat(r);return Number.isNaN(o)?r:o>Number.MAX_SAFE_INTEGER?t!==void 0?t:r:Hh(o,n,t)}const Ic=be((e,t)=>{const n=ae("NumberInput",R6,e),{className:r,classNames:o,styles:s,unstyled:c,vars:d,onChange:f,onValueChange:p,value:m,defaultValue:g,max:y,min:b,step:w,hideControls:j,rightSection:C,isAllowed:R,clampBehavior:T,onBlur:E,allowDecimal:_,decimalScale:k,onKeyDown:L,onKeyDownCapture:A,handlersRef:N,startValue:U,disabled:B,rightSectionPointerEvents:Q,allowNegative:J,readOnly:Z,size:$,rightSectionWidth:W,stepHoldInterval:M,stepHoldDelay:I,allowLeadingZeros:z,withKeyboardEvents:F,trimLeadingZeroesOnBlur:X,attributes:O,...H}=n,oe=ze({name:"NumberInput",classes:gx,props:n,classNames:o,styles:s,unstyled:c,attributes:O,vars:d,varsResolver:_6}),{resolvedClassNames:ue,resolvedStyles:Se}=vl({classNames:o,styles:s,props:n}),[ge,Pe]=or({value:m,defaultValue:g,finalValue:"",onChange:f}),rt=I!==void 0&&M!==void 0,Ce=v.useRef(null),ht=v.useRef(null),lt=v.useRef(0),vt=(pe,Oe)=>{Oe.source==="event"&&Pe(T6(pe.floatValue,pe.value)&&!w6.test(pe.value)&&!(z&&j6.test(pe.value))&&!C6.test(pe.value)?pe.floatValue:pe.value),p?.(pe,Oe)},it=pe=>{const Oe=String(pe).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return Oe?Math.max(0,(Oe[1]?Oe[1].length:0)-(Oe[2]?+Oe[2]:0)):0},wt=pe=>{Ce.current&&typeof pe<"u"&&Ce.current.setSelectionRange(pe,pe)},pt=v.useRef(rp);pt.current=()=>{if(!Cy(ge))return;let pe;const Oe=it(ge),tt=it(w),Tt=Math.max(Oe,tt),Cn=10**Tt;if(!vx(ge)&&(typeof ge!="number"||Number.isNaN(ge)))pe=Hh(U,b,y);else if(y!==void 0){const $n=(Math.round(Number(ge)*Cn)+Math.round(w*Cn))/Cn;pe=$n<=y?$n:y}else pe=(Math.round(Number(ge)*Cn)+Math.round(w*Cn))/Cn;const gn=pe.toFixed(Tt);Pe(parseFloat(gn)),p?.({floatValue:parseFloat(gn),formattedValue:gn,value:gn},{source:"increment"}),setTimeout(()=>wt(Ce.current?.value.length),0)};const It=v.useRef(rp);It.current=()=>{if(!Cy(ge))return;let pe;const Oe=b!==void 0?b:J?Number.MIN_SAFE_INTEGER:0,tt=it(ge),Tt=it(w),Cn=Math.max(tt,Tt),gn=10**Cn;if(!vx(ge)&&typeof ge!="number"||Number.isNaN(ge))pe=Hh(U,Oe,y);else{const Wn=(Math.round(Number(ge)*gn)-Math.round(w*gn))/gn;pe=Oe!==void 0&&Wn<Oe?Oe:Wn}const $n=pe.toFixed(Cn);Pe(parseFloat($n)),p?.({floatValue:parseFloat($n),formattedValue:$n,value:$n},{source:"decrement"}),setTimeout(()=>wt(Ce.current?.value.length),0)};const _e=pe=>{L?.(pe),!(Z||!F)&&(pe.key==="ArrowUp"&&(pe.preventDefault(),pt.current?.()),pe.key==="ArrowDown"&&(pe.preventDefault(),It.current?.()))},Ee=pe=>{if(A?.(pe),pe.key==="Backspace"){const Oe=Ce.current;Oe&&Oe.selectionStart===0&&Oe.selectionStart===Oe.selectionEnd&&(pe.preventDefault(),window.setTimeout(()=>wt(0),0))}},Le=pe=>{let Oe=ge;T==="blur"&&typeof Oe=="number"&&(Oe=Hh(Oe,b,y)),X&&typeof Oe=="string"&&it(Oe)<15&&(Oe=D6(Oe,y,b)),ge!==Oe&&Pe(Oe),E?.(pe)};fd(N,{increment:pt.current,decrement:It.current});const Ne=pe=>{pe?pt.current?.():It.current?.(),lt.current+=1},ct=pe=>{if(Ne(pe),rt){const Oe=typeof M=="number"?M:M(lt.current);ht.current=window.setTimeout(()=>ct(pe),Oe)}},et=(pe,Oe)=>{pe.preventDefault(),Ce.current?.focus(),Ne(Oe),rt&&(ht.current=window.setTimeout(()=>ct(Oe),I))},at=()=>{ht.current&&window.clearTimeout(ht.current),ht.current=null,lt.current=0},ve=a.jsxs("div",{...oe("controls"),children:[a.jsx(ar,{...oe("control"),tabIndex:-1,"aria-hidden":!0,disabled:B||typeof ge=="number"&&y!==void 0&&ge>=y,mod:{direction:"up"},onMouseDown:pe=>pe.preventDefault(),onPointerDown:pe=>{et(pe,!0)},onPointerUp:at,onPointerLeave:at,children:a.jsx($E,{direction:"up"})}),a.jsx(ar,{...oe("control"),tabIndex:-1,"aria-hidden":!0,disabled:B||typeof ge=="number"&&b!==void 0&&ge<=b,mod:{direction:"down"},onMouseDown:pe=>pe.preventDefault(),onPointerDown:pe=>{et(pe,!1)},onPointerUp:at,onPointerLeave:at,children:a.jsx($E,{direction:"down"})})]});return a.jsx(Lr,{component:S6,allowNegative:J,className:$t(gx.root,r),size:$,...H,readOnly:Z,disabled:B,value:ge,getInputRef:zn(t,Ce),onValueChange:vt,rightSection:j||Z||!Cy(ge)?C:C||ve,classNames:ue,styles:Se,unstyled:c,__staticSelector:"NumberInput",decimalScale:_?k:0,onKeyDown:_e,onKeyDownCapture:Ee,rightSectionPointerEvents:Q??(B?"none":void 0),rightSectionWidth:W??`var(--ni-right-section-width-${$||"sm"})`,allowLeadingZeros:z,onBlur:Le,attributes:O,isAllowed:pe=>T==="strict"?R?R(pe)&&UE(pe.floatValue,b,y):UE(pe.floatValue,b,y):R?R(pe):!0})});Ic.classes={...Lr.classes,...gx};Ic.displayName="@mantine/core/NumberInput";const[A6,gm]=Mr("Pagination.Root component was not found in tree");var Ud={root:"m_4addd315",control:"m_326d024a",dots:"m_4ad7767d"};const k6={withPadding:!0},Bd=be((e,t)=>{const n=ae("PaginationControl",k6,e),{classNames:r,className:o,style:s,styles:c,vars:d,active:f,disabled:p,withPadding:m,mod:g,...y}=n,b=gm(),w=p||b.disabled;return a.jsx(ar,{ref:t,disabled:w,mod:[{active:f,disabled:w,"with-padding":m},g],...b.getStyles("control",{className:o,style:s,classNames:r,styles:c,active:!w}),...y})});Bd.classes=Ud;Bd.displayName="@mantine/core/PaginationControl";function Vd({style:e,children:t,path:n,...r}){return a.jsx("svg",{viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)",...e},...r,children:a.jsx("path",{d:n,fill:"currentColor"})})}const P6=e=>a.jsx(Vd,{...e,path:"M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z"}),N6=e=>a.jsx(Vd,{...e,path:"M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z"}),O6=e=>a.jsx(Vd,{...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"}),M6=e=>a.jsx(Vd,{...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"}),L6=e=>a.jsx(Vd,{...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"}),I6={icon:L6},vm=be((e,t)=>{const n=ae("PaginationDots",I6,e),{classNames:r,className:o,style:s,styles:c,vars:d,icon:f,...p}=n,m=gm();return a.jsx(de,{ref:t,...m.getStyles("dots",{className:o,style:s,styles:c,classNames:r}),...p,children:a.jsx(f,{style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}})})});vm.classes=Ud;vm.displayName="@mantine/core/PaginationDots";function ym({icon:e,name:t,action:n,type:r}){const o={icon:e},s=v.forwardRef((c,d)=>{const{icon:f,...p}=ae(t,o,c),m=gm(),g=r==="next"?m.active===m.total:m.active===1;return a.jsx(Bd,{disabled:m.disabled||g,ref:d,onClick:m[n],withPadding:!1,...p,children:a.jsx(f,{className:"mantine-rotate-rtl",style:{width:"calc(var(--pagination-control-size) / 1.8)",height:"calc(var(--pagination-control-size) / 1.8)"}})})});return s.displayName=`@mantine/core/${t}`,s}const wD=ym({icon:P6,name:"PaginationNext",action:"onNext",type:"next"}),jD=ym({icon:N6,name:"PaginationPrevious",action:"onPrevious",type:"previous"}),CD=ym({icon:O6,name:"PaginationFirst",action:"onFirst",type:"previous"}),ED=ym({icon:M6,name:"PaginationLast",action:"onLast",type:"next"});function g0({dotsIcon:e}){const t=gm(),n=t.range.map((r,o)=>r==="dots"?a.jsx(vm,{icon:e},o):a.jsx(Bd,{active:r===t.active,"aria-current":r===t.active?"page":void 0,onClick:()=>t.onChange(r),disabled:t.disabled,...t.getItemProps?.(r),children:t.getItemProps?.(r)?.children??r},o));return a.jsx(a.Fragment,{children:n})}g0.displayName="@mantine/core/PaginationItems";const z6={siblings:1,boundaries:1},$6=(e,{size:t,radius:n,color:r,autoContrast:o})=>({root:{"--pagination-control-radius":n===void 0?void 0:Ft(n),"--pagination-control-size":st(t,"pagination-control-size"),"--pagination-control-fz":Hn(t),"--pagination-active-bg":r?Qt(r,e):void 0,"--pagination-active-color":yl(o,e)?ba({color:r,theme:e,autoContrast:o}):void 0}}),xm=be((e,t)=>{const n=ae("PaginationRoot",z6,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,total:p,value:m,defaultValue:g,onChange:y,disabled:b,siblings:w,boundaries:j,color:C,radius:R,onNextPage:T,onPreviousPage:E,onFirstPage:_,onLastPage:k,getItemProps:L,autoContrast:A,attributes:N,...U}=n,B=ze({name:"Pagination",classes:Ud,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:N,vars:f,varsResolver:$6}),{range:Q,setPage:J,next:Z,previous:$,active:W,first:M,last:I}=jM({page:m,initialPage:g,onChange:y,total:p,siblings:w,boundaries:j}),z=ir(T,Z),F=ir(E,$),X=ir(_,M),O=ir(k,I);return a.jsx(A6,{value:{total:p,range:Q,active:W,disabled:b,getItemProps:L,onChange:J,onNext:z,onPrevious:F,onFirst:X,onLast:O,getStyles:B},children:a.jsx(de,{ref:t,...B("root"),...U})})});xm.classes=Ud;xm.displayName="@mantine/core/PaginationRoot";const U6={withControls:!0,withPages:!0,siblings:1,boundaries:1,gap:8},Ii=be((e,t)=>{const n=ae("Pagination",U6,e),{withEdges:r,withControls:o,getControlProps:s,nextIcon:c,previousIcon:d,lastIcon:f,firstIcon:p,dotsIcon:m,total:g,gap:y,hideWithOnePage:b,withPages:w,...j}=n;return g<=0||b&&g===1?null:a.jsx(xm,{ref:t,total:g,...j,children:a.jsxs(xe,{gap:y,children:[r&&a.jsx(CD,{icon:p,...s?.("first")}),o&&a.jsx(jD,{icon:d,...s?.("previous")}),w&&a.jsx(g0,{dotsIcon:m}),o&&a.jsx(wD,{icon:c,...s?.("next")}),r&&a.jsx(ED,{icon:f,...s?.("last")})]})})});Ii.classes=Ud;Ii.displayName="@mantine/core/Pagination";Ii.Root=xm;Ii.Control=Bd;Ii.Dots=vm;Ii.First=CD;Ii.Last=ED;Ii.Next=wD;Ii.Previous=jD;Ii.Items=g0;const B6=({reveal:e})=>a.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{width:"var(--psi-icon-size)",height:"var(--psi-icon-size)"},children:a.jsx("path",{d:e?"M13.3536 2.35355C13.5488 2.15829 13.5488 1.84171 13.3536 1.64645C13.1583 1.45118 12.8417 1.45118 12.6464 1.64645L10.6828 3.61012C9.70652 3.21671 8.63759 3 7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C0.902945 9.08812 2.02314 10.1861 3.36061 10.9323L1.64645 12.6464C1.45118 12.8417 1.45118 13.1583 1.64645 13.3536C1.84171 13.5488 2.15829 13.5488 2.35355 13.3536L4.31723 11.3899C5.29348 11.7833 6.36241 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C14.0971 5.9119 12.9769 4.81391 11.6394 4.06771L13.3536 2.35355ZM9.90428 4.38861C9.15332 4.1361 8.34759 4 7.5 4C4.80285 4 2.52952 5.37816 1.09622 7.50001C1.87284 8.6497 2.89609 9.58106 4.09974 10.1931L9.90428 4.38861ZM5.09572 10.6114L10.9003 4.80685C12.1039 5.41894 13.1272 6.35031 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11C6.65241 11 5.84668 10.8639 5.09572 10.6114Z":"M7.5 11C4.80285 11 2.52952 9.62184 1.09622 7.50001C2.52952 5.37816 4.80285 4 7.5 4C10.1971 4 12.4705 5.37816 13.9038 7.50001C12.4705 9.62183 10.1971 11 7.5 11ZM7.5 3C4.30786 3 1.65639 4.70638 0.0760002 7.23501C-0.0253338 7.39715 -0.0253334 7.60288 0.0760014 7.76501C1.65639 10.2936 4.30786 12 7.5 12C10.6921 12 13.3436 10.2936 14.924 7.76501C15.0253 7.60288 15.0253 7.39715 14.924 7.23501C13.3436 4.70638 10.6921 3 7.5 3ZM7.5 9.5C8.60457 9.5 9.5 8.60457 9.5 7.5C9.5 6.39543 8.60457 5.5 7.5 5.5C6.39543 5.5 5.5 6.39543 5.5 7.5C5.5 8.60457 6.39543 9.5 7.5 9.5Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})});var yx={root:"m_f61ca620",input:"m_ccf8da4c",innerInput:"m_f2d85dd2",visibilityToggle:"m_b1072d44"};const V6={visibilityToggleIcon:B6},F6=(e,{size:t})=>({root:{"--psi-icon-size":st(t,"psi-icon-size"),"--psi-button-size":st(t,"psi-button-size")}}),Xi=be((e,t)=>{const n=ae("PasswordInput",V6,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,required:p,error:m,leftSection:g,disabled:y,id:b,variant:w,inputContainer:j,description:C,label:R,size:T,errorProps:E,descriptionProps:_,labelProps:k,withAsterisk:L,inputWrapperOrder:A,wrapperProps:N,radius:U,rightSection:B,rightSectionWidth:Q,rightSectionPointerEvents:J,leftSectionWidth:Z,visible:$,defaultVisible:W,onVisibilityChange:M,visibilityToggleIcon:I,visibilityToggleButtonProps:z,rightSectionProps:F,leftSectionProps:X,leftSectionPointerEvents:O,withErrorStyles:H,mod:oe,attributes:ue,...Se}=n,ge=hr(b),[Pe,rt]=or({value:$,defaultValue:W,finalValue:!1,onChange:M}),Ce=()=>rt(!Pe),ht=ze({name:"PasswordInput",classes:yx,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:ue,vars:f,varsResolver:F6}),{resolvedClassNames:lt,resolvedStyles:vt}=vl({classNames:r,styles:c,props:n}),{styleProps:it,rest:wt}=Sa(Se),pt=E?.id||`${ge}-error`,It=_?.id||`${ge}-description`,Le=`${!!m&&typeof m!="boolean"?pt:""} ${!!C?It:""}`,Ne=Le.trim().length>0?Le.trim():void 0,ct=a.jsx(Rn,{...ht("visibilityToggle"),disabled:y,radius:U,"aria-hidden":!z,"aria-pressed":Pe,tabIndex:-1,...z,variant:z?.variant??"subtle",color:"gray",unstyled:d,onTouchEnd:et=>{et.preventDefault(),z?.onTouchEnd?.(et),Ce()},onMouseDown:et=>{et.preventDefault(),z?.onMouseDown?.(et),Ce()},onKeyDown:et=>{z?.onKeyDown?.(et),et.key===" "&&(et.preventDefault(),Ce())},children:a.jsx(I,{reveal:Pe})});return a.jsx(mn.Wrapper,{required:p,id:ge,label:R,error:m,description:C,size:T,classNames:lt,styles:vt,__staticSelector:"PasswordInput",unstyled:d,withAsterisk:L,inputWrapperOrder:A,inputContainer:j,variant:w,labelProps:{...k,htmlFor:ge},descriptionProps:{..._,id:It},errorProps:{...E,id:pt},mod:oe,attributes:ue,...ht("root"),...it,...N,children:a.jsx(mn,{component:"div",error:m,leftSection:g,size:T,classNames:{...lt,input:$t(yx.input,lt.input)},styles:vt,radius:U,disabled:y,__staticSelector:"PasswordInput",rightSectionWidth:Q,rightSection:B??ct,variant:w,unstyled:d,leftSectionWidth:Z,rightSectionPointerEvents:J||"all",rightSectionProps:F,leftSectionProps:X,leftSectionPointerEvents:O,withAria:!1,withErrorStyles:H,attributes:ue,children:a.jsx("input",{required:p,"data-invalid":!!m||void 0,"data-with-left-section":!!g||void 0,...ht("innerInput"),disabled:y,id:ge,ref:t,...wt,"aria-describedby":Ne,autoComplete:wt.autoComplete||"off",type:Pe?"text":"password"})})})});Xi.classes={...Lr.classes,...yx};Xi.displayName="@mantine/core/PasswordInput";const[H6,TD]=No(),[q6,G6]=No();var RD={card:"m_9dc8ae12"};const W6={withBorder:!0},Q6=(e,{radius:t})=>({card:{"--card-radius":Ft(t)}}),v0=be((e,t)=>{const n=ae("RadioCard",W6,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,checked:p,mod:m,withBorder:g,value:y,onClick:b,name:w,onKeyDown:j,attributes:C,...R}=n,T=ze({name:"RadioCard",classes:RD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:C,vars:f,varsResolver:Q6,rootSelector:"card"}),{dir:E}=ps(),_=TD(),k=typeof p=="boolean"?p:_?.value===y||!1,L=w||_?.name,A=N=>{if(j?.(N),["ArrowDown","ArrowUp","ArrowLeft","ArrowRight"].includes(N.nativeEvent.code)){N.preventDefault();const U=Array.from(document.querySelectorAll(`[role="radio"][name="${L||"__mantine"}"]`)),B=U.findIndex(Z=>Z===N.target),Q=B+1>=U.length?0:B+1,J=B-1<0?U.length-1:B-1;N.nativeEvent.code==="ArrowDown"&&(U[Q].focus(),U[Q].click()),N.nativeEvent.code==="ArrowUp"&&(U[J].focus(),U[J].click()),N.nativeEvent.code==="ArrowLeft"&&(U[E==="ltr"?J:Q].focus(),U[E==="ltr"?J:Q].click()),N.nativeEvent.code==="ArrowRight"&&(U[E==="ltr"?Q:J].focus(),U[E==="ltr"?Q:J].click())}};return a.jsx(q6,{value:{checked:k},children:a.jsx(ar,{ref:t,mod:[{"with-border":g,checked:k},m],...T("card"),...R,role:"radio","aria-checked":k,name:L,onClick:N=>{b?.(N),_?.onChange(y||"")},onKeyDown:A})})});v0.displayName="@mantine/core/RadioCard";v0.classes=RD;const y0=be((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:s,wrapperProps:c,children:d,name:f,readOnly:p,disabled:m,...g}=ae("RadioGroup",null,e),y=hr(f),[b,w]=or({value:n,defaultValue:r,finalValue:"",onChange:o}),j=C=>!p&&w(typeof C=="string"?C:C.currentTarget.value);return a.jsx(H6,{value:{value:b,onChange:j,size:s,name:y,disabled:m},children:a.jsx(mn.Wrapper,{size:s,ref:t,...c,...g,labelElement:"div",__staticSelector:"RadioGroup",children:a.jsx(Hb,{role:"radiogroup",children:d})})})});y0.classes=mn.Wrapper.classes;y0.displayName="@mantine/core/RadioGroup";function _D({size:e,style:t,...n}){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 5 5",style:{width:le(e),height:le(e),...t},"aria-hidden":!0,...n,children:a.jsx("circle",{cx:"2.5",cy:"2.5",r:"2.5",fill:"currentColor"})})}var DD={indicator:"m_717d7ff6",icon:"m_3e4da632","indicator--outline":"m_2980836c"};const Y6={icon:_D},K6=(e,{radius:t,color:n,size:r,iconColor:o,variant:s,autoContrast:c})=>{const d=ci({color:n||e.primaryColor,theme:e}),f=d.isThemeColor&&d.shade===void 0?`var(--mantine-color-${d.color}-outline)`:d.color;return{indicator:{"--radio-size":st(r,"radio-size"),"--radio-radius":t===void 0?void 0:Ft(t),"--radio-color":s==="outline"?f:Qt(n,e),"--radio-icon-size":st(r,"radio-icon-size"),"--radio-icon-color":o?Qt(o,e):yl(c,e)?ba({color:n,theme:e,autoContrast:c}):void 0}}},x0=be((e,t)=>{const n=ae("RadioIndicator",Y6,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,icon:p,radius:m,color:g,iconColor:y,autoContrast:b,checked:w,mod:j,variant:C,disabled:R,attributes:T,...E}=n,_=ze({name:"RadioIndicator",classes:DD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:T,vars:f,varsResolver:K6,rootSelector:"indicator"}),k=G6(),L=typeof w=="boolean"?w:k?.checked||!1;return a.jsx(de,{ref:t,..._("indicator",{variant:C}),variant:C,mod:[{checked:L,disabled:R},j],...E,children:a.jsx(p,{..._("icon")})})});x0.displayName="@mantine/core/RadioIndicator";x0.classes=DD;var AD={root:"m_f3f1af94",inner:"m_89c4f5e4",icon:"m_f3ed6b2b",radio:"m_8a3dbb89","radio--outline":"m_1bfe9d39"};const X6={labelPosition:"right"},J6=(e,{size:t,radius:n,color:r,iconColor:o,variant:s,autoContrast:c})=>{const d=ci({color:r||e.primaryColor,theme:e}),f=d.isThemeColor&&d.shade===void 0?`var(--mantine-color-${d.color}-outline)`:d.color;return{root:{"--radio-size":st(t,"radio-size"),"--radio-radius":n===void 0?void 0:Ft(n),"--radio-color":s==="outline"?f:Qt(r,e),"--radio-icon-color":o?Qt(o,e):yl(c,e)?ba({color:r,theme:e,autoContrast:c}):void 0,"--radio-icon-size":st(t,"radio-icon-size")}}},vr=be((e,t)=>{const n=ae("Radio",X6,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,id:p,size:m,label:g,labelPosition:y,description:b,error:w,radius:j,color:C,variant:R,disabled:T,wrapperProps:E,icon:_=_D,rootRef:k,iconColor:L,onChange:A,mod:N,attributes:U,checked:B,...Q}=n,J=ze({name:"Radio",classes:AD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:U,vars:f,varsResolver:J6}),Z=TD(),$=Z?.size??m,W=n.size?m:$,{styleProps:M,rest:I}=Sa(Q),z=hr(p),F={checked:Z?.value===I.value||B||void 0,name:Z?.name??I.name,onChange:X=>{Z?.onChange(X),A?.(X)},disabled:Z?.disabled??T};return a.jsx(tm,{...J("root"),__staticSelector:"Radio",__stylesApiProps:n,id:z,size:W,labelPosition:y,label:g,description:b,error:w,disabled:F.disabled,classNames:r,styles:c,unstyled:d,"data-checked":F.checked,variant:R,ref:k,mod:N,...M,...E,children:a.jsxs(de,{...J("inner"),mod:{"label-position":y},children:[a.jsx(de,{...J("radio",{focusable:!0,variant:R}),...I,...F,component:"input",mod:{error:!!w},ref:t,id:z,type:"radio"}),a.jsx(_,{...J("icon"),"aria-hidden":!0})]})})});vr.classes=AD;vr.displayName="@mantine/core/Radio";vr.Group=y0;vr.Card=v0;vr.Indicator=x0;const Z6={duration:100,transition:"fade"};function BE(e,t){return{...Z6,...t,...e}}function ez({offset:e,position:t,defaultOpened:n}){const[r,o]=v.useState(n),s=v.useRef(null),{x:c,y:d,elements:f,refs:p,update:m,placement:g}=xb({placement:t,middleware:[mb({crossAxis:!0,padding:5,rootBoundary:"document"})]}),y=g.includes("right")?e:t.includes("left")?e*-1:0,b=g.includes("bottom")?e:t.includes("top")?e*-1:0,w=v.useCallback(({clientX:j,clientY:C})=>{p.setPositionReference({getBoundingClientRect(){return{width:0,height:0,x:j,y:C,left:j+y,top:C+b,right:j,bottom:C}}})},[f.reference]);return v.useEffect(()=>{if(p.floating.current){const j=s.current;j.addEventListener("mousemove",w);const C=fa(p.floating.current);return C.forEach(R=>{R.addEventListener("scroll",m)}),()=>{j.removeEventListener("mousemove",w),C.forEach(R=>{R.removeEventListener("scroll",m)})}}},[f.reference,p.floating.current,m,w,r]),{handleMouseMove:w,x:c,y:d,opened:r,setOpened:o,boundaryRef:s,floating:p.setFloating}}var bm={tooltip:"m_1b3c8819",arrow:"m_f898399f"};const tz={refProp:"ref",withinPortal:!0,offset:10,position:"right",zIndex:hi("popover")},nz=(e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:Ft(t),"--tooltip-bg":n?Qt(n,e):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),b0=be((e,t)=>{const n=ae("TooltipFloating",tz,e),{children:r,refProp:o,withinPortal:s,style:c,className:d,classNames:f,styles:p,unstyled:m,radius:g,color:y,label:b,offset:w,position:j,multiline:C,zIndex:R,disabled:T,defaultOpened:E,variant:_,vars:k,portalProps:L,attributes:A,...N}=n,U=jn(),B=ze({name:"TooltipFloating",props:n,classes:bm,className:d,style:c,classNames:f,styles:p,unstyled:m,attributes:A,rootSelector:"tooltip",vars:k,varsResolver:nz}),{handleMouseMove:Q,x:J,y:Z,opened:$,boundaryRef:W,floating:M,setOpened:I}=ez({offset:w,position:j,defaultOpened:E});if(!Po(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 z=zn(W,$p(r),t),F=r.props,X=H=>{F.onMouseEnter?.(H),Q(H),I(!0)},O=H=>{F.onMouseLeave?.(H),I(!1)};return a.jsxs(a.Fragment,{children:[a.jsx(pa,{...L,withinPortal:s,children:a.jsx(de,{...N,...B("tooltip",{style:{...w2(c,U),zIndex:R,display:!T&&$?"block":"none",top:(Z&&Math.round(Z))??"",left:(J&&Math.round(J))??""}}),variant:_,ref:M,mod:{multiline:C},children:b})}),v.cloneElement(r,{...F,[o]:z,onMouseEnter:X,onMouseLeave:O})]})});b0.classes=bm;b0.displayName="@mantine/core/TooltipFloating";const kD=v.createContext(!1),rz=kD.Provider,iz=()=>v.useContext(kD),oz={openDelay:0,closeDelay:0};function S0(e){const{openDelay:t,closeDelay:n,children:r}=ae("TooltipGroup",oz,e);return a.jsx(rz,{value:!0,children:a.jsx(w9,{delay:{open:t,close:n},children:r})})}S0.displayName="@mantine/core/TooltipGroup";S0.extend=e=>e;function az(e){if(e===void 0)return{shift:!0,flip:!0};const t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function sz(e){const t=az(e.middlewares),n=[$2(e.offset)];return t.shift&&n.push(mb(typeof t.shift=="boolean"?{padding:8}:{padding:8,...t.shift})),t.flip&&n.push(typeof t.flip=="boolean"?cp():cp(t.flip)),n.push(U2({element:e.arrowRef,padding:e.arrowOffset})),t.inline?n.push(typeof t.inline=="boolean"?ld():ld(t.inline)):e.inline&&n.push(ld()),n}function lz(e){const[t,n]=v.useState(e.defaultOpened),o=typeof e.opened=="boolean"?e.opened:t,s=iz(),c=hr(),d=v.useCallback(k=>{n(k),k&&R(c)},[c]),{x:f,y:p,context:m,refs:g,placement:y,middlewareData:{arrow:{x:b,y:w}={}}}=xb({strategy:e.strategy,placement:e.position,open:o,onOpenChange:d,middleware:sz(e),whileElementsMounted:dx}),{delay:j,currentId:C,setCurrentId:R}=j9(m,{id:c}),{getReferenceProps:T,getFloatingProps:E}=D9([b9(m,{enabled:e.events?.hover,delay:s?j:{open:e.openDelay,close:e.closeDelay},mouseOnly:!e.events?.touch}),_9(m,{enabled:e.events?.focus,visibleOnly:!0}),k9(m,{role:"tooltip"}),T9(m,{enabled:typeof e.opened>"u"})]);tl(()=>{e.onPositionChange?.(y)},[y]);const _=o&&C&&C!==c;return{x:f,y:p,arrowX:b,arrowY:w,reference:g.setReference,floating:g.setFloating,getFloatingProps:E,getReferenceProps:T,isGroupPhase:_,opened:o,placement:y}}const VE={position:"top",refProp:"ref",withinPortal:!0,arrowSize:4,arrowOffset:5,arrowRadius:0,arrowPosition:"side",offset:5,transitionProps:{duration:100,transition:"fade"},events:{hover:!0,focus:!1,touch:!1},zIndex:hi("popover"),positionDependencies:[],middlewares:{flip:!0,shift:!0,inline:!1}},cz=(e,{radius:t,color:n,variant:r,autoContrast:o})=>{const s=e.variantColorResolver({theme:e,color:n||e.primaryColor,autoContrast:o,variant:r||"filled"});return{tooltip:{"--tooltip-radius":t===void 0?void 0:Ft(t),"--tooltip-bg":n?s.background:void 0,"--tooltip-color":n?s.color:void 0}}},ga=be((e,t)=>{const n=ae("Tooltip",VE,e),{children:r,position:o,refProp:s,label:c,openDelay:d,closeDelay:f,onPositionChange:p,opened:m,defaultOpened:g,withinPortal:y,radius:b,color:w,classNames:j,styles:C,unstyled:R,style:T,className:E,withArrow:_,arrowSize:k,arrowOffset:L,arrowRadius:A,arrowPosition:N,offset:U,transitionProps:B,multiline:Q,events:J,zIndex:Z,disabled:$,positionDependencies:W,onClick:M,onMouseEnter:I,onMouseLeave:z,inline:F,variant:X,keepMounted:O,vars:H,portalProps:oe,mod:ue,floatingStrategy:Se,middlewares:ge,autoContrast:Pe,attributes:rt,target:Ce,...ht}=ae("Tooltip",VE,n),{dir:lt}=ps(),vt=v.useRef(null),it=lz({position:o_(lt,o),closeDelay:f,openDelay:d,onPositionChange:p,opened:m,defaultOpened:g,events:J,arrowRef:vt,arrowOffset:L,offset:typeof U=="number"?U+(_?k/2:0):U,positionDependencies:[...W,Ce??r],inline:F,strategy:Se,middlewares:ge});v.useEffect(()=>{const Le=Ce instanceof HTMLElement?Ce:typeof Ce=="string"?document.querySelector(Ce):Ce?.current||null;Le&&it.reference(Le)},[Ce,it]);const wt=ze({name:"Tooltip",props:n,classes:bm,className:E,style:T,classNames:j,styles:C,unstyled:R,attributes:rt,rootSelector:"tooltip",vars:H,varsResolver:cz});if(!Ce&&!Po(r))return null;if(Ce){const Le=BE(B,{duration:100,transition:"fade"});return a.jsx(a.Fragment,{children:a.jsx(pa,{...oe,withinPortal:y,children:a.jsx(eo,{...Le,keepMounted:O,mounted:!$&&!!it.opened,duration:it.isGroupPhase?10:Le.duration,children:Ne=>a.jsxs(de,{...ht,"data-fixed":Se==="fixed"||void 0,variant:X,mod:[{multiline:Q},ue],...it.getFloatingProps({ref:it.floating,className:wt("tooltip").className,style:{...wt("tooltip").style,...Ne,zIndex:Z,top:it.y??0,left:it.x??0}}),children:[c,a.jsx(up,{ref:vt,arrowX:it.arrowX,arrowY:it.arrowY,visible:_,position:it.placement,arrowSize:k,arrowOffset:L,arrowRadius:A,arrowPosition:N,...wt("arrow")})]})})})})}const pt=r,It=pt.props,_e=zn(it.reference,$p(pt),t),Ee=BE(B,{duration:100,transition:"fade"});return a.jsxs(a.Fragment,{children:[a.jsx(pa,{...oe,withinPortal:y,children:a.jsx(eo,{...Ee,keepMounted:O,mounted:!$&&!!it.opened,duration:it.isGroupPhase?10:Ee.duration,children:Le=>a.jsxs(de,{...ht,"data-fixed":Se==="fixed"||void 0,variant:X,mod:[{multiline:Q},ue],...it.getFloatingProps({ref:it.floating,className:wt("tooltip").className,style:{...wt("tooltip").style,...Le,zIndex:Z,top:it.y??0,left:it.x??0}}),children:[c,a.jsx(up,{ref:vt,arrowX:it.arrowX,arrowY:it.arrowY,visible:_,position:it.placement,arrowSize:k,arrowOffset:L,arrowRadius:A,arrowPosition:N,...wt("arrow")})]})})}),v.cloneElement(pt,it.getReferenceProps({onClick:M,onMouseEnter:I,onMouseLeave:z,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,className:$t(E,It.className),...It,[s]:_e}))]})});ga.classes=bm;ga.displayName="@mantine/core/Tooltip";ga.Floating=b0;ga.Group=S0;function uz({size:e,thickness:t,sum:n,value:r,root:o,offset:s}){const c=(e*.9-t*2)/2,d=Math.PI*c*2/100,f=o||r===void 0?`${(100-n)*d}, ${n*d}`:`${r*d}, ${(100-r)*d}`;return{strokeWidth:Number.isNaN(t)?12:t,cx:e/2||0,cy:e/2||0,r:c||0,transform:o?`scale(1, -1) translate(0, -${e})`:void 0,strokeDasharray:f,strokeDashoffset:o?0:s||0}}function PD({size:e,value:t,offset:n,sum:r,thickness:o,root:s,color:c,lineRoundCaps:d,tooltip:f,getStyles:p,display:m,...g}){const y=jn();return a.jsx(ga.Floating,{disabled:!f,label:f,children:a.jsx(de,{component:"circle",...g,...p("curve"),__vars:{"--curve-color":c?Qt(c,y):void 0},fill:"none",strokeLinecap:d?"round":"butt",...uz({sum:r,size:e,thickness:o,value:t,offset:n,root:s})})})}PD.displayName="@mantine/core/Curve";function dz({size:e,thickness:t,sections:n,renderRoundedLineCaps:r,rootColor:o}){const s=n.reduce((m,g)=>m+g.value,0),c=Math.PI*((e*.9-t*2)/2)*2;let d=c;const f=[],p=[];for(let m=0;m<n.length;m+=1)f.push({sum:s,offset:d,data:n[m],root:!1}),d-=n[m].value/100*c;if(f.push({sum:s,offset:d,data:{color:o},root:!0}),p.push({...f[f.length-1],lineRoundCaps:!1}),f.length>2){p.push({...f[0],lineRoundCaps:r}),p.push({...f[f.length-2],lineRoundCaps:r});for(let m=1;m<=f.length-3;m+=1)p.push({...f[m],lineRoundCaps:!1})}else p.push({...f[0],lineRoundCaps:r});return p}var ND={root:"m_b32e4812",svg:"m_d43b5134",curve:"m_b1ca1fbf",label:"m_b23f9dc4"};function fz(e,t){return Math.min(e||12,(t||120)/4)}const hz={size:120,thickness:12},pz=(e,{size:t,thickness:n,transitionDuration:r})=>({root:{"--rp-size":le(t),"--rp-label-offset":le(n*2),"--rp-transition-duration":r?`${r}ms`:void 0}}),Sm=be((e,t)=>{const n=ae("RingProgress",hz,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,label:p,sections:m,size:g,thickness:y,roundCaps:b,rootColor:w,transitionDuration:j,attributes:C,...R}=n,T=ze({name:"RingProgress",classes:ND,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:C,vars:f,varsResolver:pz}),E=fz(y,g),_=dz({size:g,thickness:E,sections:m,renderRoundedLineCaps:b,rootColor:w}).map(({data:k,sum:L,root:A,lineRoundCaps:N,offset:U},B)=>v.createElement(PD,{...k,key:B,size:g,thickness:E,sum:L,offset:U,color:k?.color,root:A,lineRoundCaps:N,getStyles:T}));return a.jsxs(de,{...T("root"),size:g,ref:t,...R,children:[a.jsx("svg",{...T("svg"),children:_}),p&&a.jsx("div",{...T("label"),children:p})]})});Sm.classes=ND;Sm.displayName="@mantine/core/RingProgress";var OD={root:"m_cf365364",indicator:"m_9e182ccd",label:"m_1738fcb2",input:"m_1714d588",control:"m_69686b9b",innerLabel:"m_78882f40"};const mz={withItemsBorders:!0},gz=(e,{radius:t,color:n,transitionDuration:r,size:o,transitionTimingFunction:s})=>({root:{"--sc-radius":t===void 0?void 0:Ft(t),"--sc-color":n?Qt(n,e):void 0,"--sc-shadow":n?void 0:"var(--mantine-shadow-xs)","--sc-transition-duration":r===void 0?void 0:`${r}ms`,"--sc-transition-timing-function":s,"--sc-padding":st(o,"sc-padding"),"--sc-font-size":Hn(o)}}),Fd=be((e,t)=>{const n=ae("SegmentedControl",mz,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,data:p,value:m,defaultValue:g,onChange:y,size:b,name:w,disabled:j,readOnly:C,fullWidth:R,orientation:T,radius:E,color:_,transitionDuration:k,transitionTimingFunction:L,variant:A,autoContrast:N,withItemsBorders:U,mod:B,attributes:Q,...J}=n,Z=ze({name:"SegmentedControl",props:n,classes:OD,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:Q,vars:f,varsResolver:gz}),$=jn(),W=p.map(Ce=>typeof Ce=="string"?{label:Ce,value:Ce}:Ce),M=DM(),[I,z]=v.useState(ip()),[F,X]=v.useState(null),[O,H]=v.useState({}),oe=(Ce,ht)=>{O[ht]=Ce,H(O)},[ue,Se]=or({value:m,defaultValue:g,finalValue:Array.isArray(p)?W.find(Ce=>!Ce.disabled)?.value??p[0]?.value??null:null,onChange:y}),ge=hr(w),Pe=W.map(Ce=>v.createElement(de,{...Z("control"),mod:{active:ue===Ce.value,orientation:T},key:Ce.value},v.createElement("input",{...Z("input"),disabled:j||Ce.disabled,type:"radio",name:ge,value:Ce.value,id:`${ge}-${Ce.value}`,checked:ue===Ce.value,onChange:()=>!C&&Se(Ce.value),"data-focus-ring":$.focusRing,key:`${Ce.value}-input`}),v.createElement(de,{component:"label",...Z("label"),mod:{active:ue===Ce.value&&!(j||Ce.disabled),disabled:j||Ce.disabled,"read-only":C},htmlFor:`${ge}-${Ce.value}`,ref:ht=>oe(ht,Ce.value),__vars:{"--sc-label-color":_!==void 0?ba({color:_,theme:$,autoContrast:N}):void 0},key:`${Ce.value}-label`},a.jsx("span",{...Z("innerLabel"),children:Ce.label})))),rt=zn(t,Ce=>X(Ce));return TM(()=>{z(ip())},[p.length]),p.length===0?null:a.jsxs(de,{...Z("root"),variant:A,size:b,ref:rt,mod:[{"full-width":R,orientation:T,initialized:M,"with-items-borders":U},B],...J,role:"radiogroup","data-disabled":j,children:[typeof ue=="string"&&a.jsx(Rb,{target:O[ue],parent:F,component:"span",transitionDuration:"var(--sc-transition-duration)",...Z("indicator")},I),Pe]})});Fd.classes=OD;Fd.displayName="@mantine/core/SegmentedControl";function vz({spacing:e,verticalSpacing:t,cols:n,selector:r}){const o=jn(),s=t===void 0?e:t,c=hs({"--sg-spacing-x":Fn(Qi(e)),"--sg-spacing-y":Fn(Qi(s)),"--sg-cols":Qi(n)?.toString()}),d=cn(o.breakpoints).reduce((m,g)=>(m[g]||(m[g]={}),typeof e=="object"&&e[g]!==void 0&&(m[g]["--sg-spacing-x"]=Fn(e[g])),typeof s=="object"&&s[g]!==void 0&&(m[g]["--sg-spacing-y"]=Fn(s[g])),typeof n=="object"&&n[g]!==void 0&&(m[g]["--sg-cols"]=n[g]),m),{}),p=dd(cn(d),o.breakpoints).filter(m=>cn(d[m.value]).length>0).map(m=>({query:`(min-width: ${o.breakpoints[m.value]})`,styles:d[m.value]}));return a.jsx(xl,{styles:c,media:p,selector:r})}function Ey(e){return typeof e=="object"&&e!==null?cn(e):[]}function yz(e){return e.sort((t,n)=>ud(t)-ud(n))}function xz({spacing:e,verticalSpacing:t,cols:n}){const r=Array.from(new Set([...Ey(e),...Ey(t),...Ey(n)]));return yz(r)}function bz({spacing:e,verticalSpacing:t,cols:n,selector:r}){const o=t===void 0?e:t,s=hs({"--sg-spacing-x":Fn(Qi(e)),"--sg-spacing-y":Fn(Qi(o)),"--sg-cols":Qi(n)?.toString()}),c=xz({spacing:e,verticalSpacing:t,cols:n}),d=c.reduce((p,m)=>(p[m]||(p[m]={}),typeof e=="object"&&e[m]!==void 0&&(p[m]["--sg-spacing-x"]=Fn(e[m])),typeof o=="object"&&o[m]!==void 0&&(p[m]["--sg-spacing-y"]=Fn(o[m])),typeof n=="object"&&n[m]!==void 0&&(p[m]["--sg-cols"]=n[m]),p),{}),f=c.map(p=>({query:`simple-grid (min-width: ${p})`,styles:d[p]}));return a.jsx(xl,{styles:s,container:f,selector:r})}var MD={container:"m_925c2d2c",root:"m_2415a157"};const Sz={cols:1,spacing:"md",type:"media"},wm=be((e,t)=>{const n=ae("SimpleGrid",Sz,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,cols:p,verticalSpacing:m,spacing:g,type:y,attributes:b,...w}=n,j=ze({name:"SimpleGrid",classes:MD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:b,vars:f}),C=Ad();return y==="container"?a.jsxs(a.Fragment,{children:[a.jsx(bz,{...n,selector:`.${C}`}),a.jsx("div",{...j("container"),children:a.jsx(de,{ref:t,...j("root",{className:C}),...w})})]}):a.jsxs(a.Fragment,{children:[a.jsx(vz,{...n,selector:`.${C}`}),a.jsx(de,{ref:t,...j("root",{className:C}),...w})]})});wm.classes=MD;wm.displayName="@mantine/core/SimpleGrid";const jm=be((e,t)=>{const{w:n,h:r,miw:o,mih:s,...c}=ae("Space",null,e);return a.jsx(de,{ref:t,...c,w:n,miw:o??n,h:r,mih:s??r})});jm.displayName="@mantine/core/Space";var LD={root:"m_6d731127"};const wz={gap:"md",align:"stretch",justify:"flex-start"},jz=(e,{gap:t,align:n,justify:r})=>({root:{"--stack-gap":Fn(t),"--stack-align":n,"--stack-justify":r}}),Ue=be((e,t)=>{const n=ae("Stack",wz,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,align:p,justify:m,gap:g,variant:y,attributes:b,...w}=n,j=ze({name:"Stack",props:n,classes:LD,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:b,vars:f,varsResolver:jz});return a.jsx(de,{ref:t,...j("root"),variant:y,...w})});Ue.classes=LD;Ue.displayName="@mantine/core/Stack";const[Cz,Ez]=Mr("Stepper component was not found in tree"),fp=()=>null;fp.displayName="@mantine/core/StepperCompleted";var w0={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 Dh=(e,t)=>typeof e=="function"?a.jsx(e,{step:t||0}):e,Tz={withIcon:!0,allowStepClick:!0,iconPosition:"left"},j0=be((e,t)=>{const{classNames:n,className:r,style:o,styles:s,vars:c,step:d,state:f,color:p,icon:m,completedIcon:g,progressIcon:y,label:b,description:w,withIcon:j,iconSize:C,loading:R,allowStepClick:T,allowStepSelect:E,iconPosition:_,orientation:k,mod:L,...A}=ae("StepperStep",Tz,e),N=Ez(),U=jn(),B={classNames:n,styles:s},Q=f==="stepCompleted"?null:f==="stepProgress"?y:m,J={"data-progress":f==="stepProgress"||void 0,"data-completed":f==="stepCompleted"||void 0};return a.jsxs(ar,{...N.getStyles("step",{className:r,style:o,variant:N.orientation,...B}),mod:[{"icon-position":_||N.iconPosition,"allow-click":T},L],ref:t,...J,...A,__vars:{"--step-color":p?Qt(p,U):void 0},tabIndex:T?0:-1,children:[j&&a.jsxs("span",{...N.getStyles("stepWrapper",B),children:[a.jsxs("span",{...N.getStyles("stepIcon",B),...J,children:[a.jsx(eo,{mounted:f==="stepCompleted",transition:"pop",duration:200,children:Z=>a.jsx("span",{...N.getStyles("stepCompletedIcon",{style:Z,...B}),children:R?a.jsx(Or,{color:"var(--mantine-color-white)",size:"calc(var(--stepper-icon-size) / 2)",...N.getStyles("stepLoader",B)}):Dh(g,d)||a.jsx(Id,{size:"60%"})})}),f!=="stepCompleted"?R?a.jsx(Or,{...N.getStyles("stepLoader",B),size:"calc(var(--stepper-icon-size) / 2)",color:p}):Dh(Q||m,d):null]}),k==="vertical"&&a.jsx("span",{...N.getStyles("verticalSeparator",B),"data-active":f==="stepCompleted"||void 0})]}),(b||w)&&a.jsxs("span",{...N.getStyles("stepBody",B),"data-orientation":N.orientation,"data-icon-position":_||N.iconPosition,children:[b&&a.jsx("span",{...N.getStyles("stepLabel",B),children:Dh(b,d)}),w&&a.jsx("span",{...N.getStyles("stepDescription",B),children:Dh(w,d)})]})]})});j0.classes=w0;j0.displayName="@mantine/core/StepperStep";const Rz={orientation:"horizontal",iconPosition:"left",allowNextStepsSelect:!0,wrap:!0},_z=(e,{color:t,iconSize:n,size:r,contentPadding:o,radius:s,autoContrast:c})=>({root:{"--stepper-color":t?Qt(t,e):void 0,"--stepper-icon-color":yl(c,e)?ba({color:t,theme:e,autoContrast:c}):void 0,"--stepper-icon-size":n===void 0?st(r,"stepper-icon-size"):le(n),"--stepper-content-padding":Fn(o),"--stepper-radius":s===void 0?void 0:Ft(s),"--stepper-fz":Hn(r),"--stepper-spacing":Fn(r)}}),zc=be((e,t)=>{const n=ae("Stepper",Rz,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,children:p,onStepClick:m,active:g,icon:y,completedIcon:b,progressIcon:w,color:j,iconSize:C,contentPadding:R,orientation:T,iconPosition:E,size:_,radius:k,allowNextStepsSelect:L,wrap:A,autoContrast:N,attributes:U,...B}=n,Q=ze({name:"Stepper",classes:w0,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:U,vars:f,varsResolver:_z}),J=v.Children.toArray(p),Z=J.filter(F=>F.type!==fp),$=J.find(F=>F.type===fp),W=Z.reduce((F,X,O)=>{const H=g===O?"stepProgress":g>O?"stepCompleted":"stepInactive",ue=typeof m!="function"?!1:typeof X.props.allowStepSelect=="boolean"?X.props.allowStepSelect:H==="stepCompleted"||L;return F.push(v.cloneElement(X,{icon:X.props.icon||y||O+1,key:O,step:O,state:H,onClick:()=>ue&&m?.(O),allowStepClick:ue,completedIcon:X.props.completedIcon||b,progressIcon:X.props.progressIcon||w,color:X.props.color||j,iconSize:C,iconPosition:X.props.iconPosition||E,orientation:T})),T==="horizontal"&&O!==Z.length-1&&F.push(v.createElement("div",{...Q("separator"),"data-active":O<g||void 0,"data-orientation":T,key:`separator-${O}`})),F},[]),M=Z[g]?.props?.children,I=$?.props?.children,z=g>Z.length-1?I:M;return a.jsx(Cz,{value:{getStyles:Q,orientation:T,iconPosition:E},children:a.jsxs(de,{...Q("root"),ref:t,size:_,...B,children:[a.jsx(de,{...Q("steps"),mod:{orientation:T,"icon-position":E,wrap:A&&T!=="vertical"},children:W}),z&&a.jsx("div",{...Q("content"),children:z})]})})});zc.classes=w0;zc.displayName="@mantine/core/Stepper";zc.Completed=fp;zc.Step=j0;const ID=v.createContext(null),Dz=ID.Provider,Az=()=>v.useContext(ID),C0=be((e,t)=>{const{value:n,defaultValue:r,onChange:o,size:s,wrapperProps:c,children:d,readOnly:f,disabled:p,...m}=ae("SwitchGroup",null,e),[g,y]=or({value:n,defaultValue:r,finalValue:[],onChange:o}),b=w=>{const j=w.currentTarget.value;!f&&y(g.includes(j)?g.filter(C=>C!==j):[...g,j])};return a.jsx(Dz,{value:{value:g,onChange:b,size:s,disabled:p},children:a.jsx(mn.Wrapper,{size:s,ref:t,...c,...m,labelElement:"div",__staticSelector:"SwitchGroup",children:a.jsx(Hb,{role:"group",children:d})})})});C0.classes=mn.Wrapper.classes;C0.displayName="@mantine/core/SwitchGroup";var zD={root:"m_5f93f3bb",input:"m_926b4011",track:"m_9307d992",thumb:"m_93039a1d",trackLabel:"m_8277e082"};const kz={labelPosition:"right",withThumbIndicator:!0},Pz=(e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:Ft(t),"--switch-height":st(r,"switch-height"),"--switch-width":st(r,"switch-width"),"--switch-thumb-size":st(r,"switch-thumb-size"),"--switch-label-font-size":st(r,"switch-label-font-size"),"--switch-track-label-padding":st(r,"switch-track-label-padding"),"--switch-color":n?Qt(n,e):void 0}}),Hd=be((e,t)=>{const n=ae("Switch",kz,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,color:p,label:m,offLabel:g,onLabel:y,id:b,size:w,radius:j,wrapperProps:C,thumbIcon:R,checked:T,defaultChecked:E,onChange:_,labelPosition:k,description:L,error:A,disabled:N,variant:U,rootRef:B,mod:Q,withThumbIndicator:J,attributes:Z,...$}=n,W=Az(),M=w||W?.size,I=ze({name:"Switch",props:n,classes:zD,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:Z,vars:f,varsResolver:Pz}),{styleProps:z,rest:F}=Sa($),X=hr(b),O={checked:W?.value.includes(F.value)??T,onChange:ue=>{W?.onChange(ue),_?.(ue)},disabled:W?.disabled??N},[H,oe]=or({value:O.checked??T,defaultValue:E,finalValue:!1});return a.jsxs(tm,{...I("root"),__staticSelector:"Switch",__stylesApiProps:n,id:X,size:M,labelPosition:k,label:m,description:L,error:A,disabled:O.disabled,bodyElement:"label",labelElement:"span",classNames:r,styles:c,unstyled:d,"data-checked":O.checked,variant:U,ref:B,mod:Q,...z,...C,children:[a.jsx("input",{...F,...O,checked:H,"data-checked":O.checked,onChange:ue=>{O.onChange?.(ue),oe(ue.currentTarget.checked)},id:X,ref:t,type:"checkbox",role:"switch",...I("input")}),a.jsxs(de,{"aria-hidden":"true",component:"span",mod:{error:A,"label-position":k,"without-labels":!y&&!g},...I("track"),children:[a.jsx(de,{component:"span",mod:{"reduce-motion":!0,"with-thumb-indicator":J&&!R},...I("thumb"),children:R}),a.jsx("span",{...I("trackLabel"),children:H?y:g})]})]})});Hd.classes={...zD,...F_};Hd.displayName="@mantine/core/Switch";Hd.Group=C0;const[Nz,Oz]=Mr("Table component was not found in the tree");var qd={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 Mz(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 wl(e,t){const n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=be((o,s)=>{const c=ae(n,{},o),{classNames:d,className:f,style:p,styles:m,...g}=c,y=Oz();return a.jsx(de,{component:e,ref:s,...Mz(y,t),...y.getStyles(e,{className:f,classNames:d,style:p,styles:m,props:c}),...g})});return r.displayName=`@mantine/core/${n}`,r.classes=qd,r}const xx=wl("th",{columnBorder:!0}),$D=wl("td",{columnBorder:!0}),Qh=wl("tr",{rowBorder:!0,striped:!0,highlightOnHover:!0}),UD=wl("thead",{stickyHeader:!0}),BD=wl("tbody"),VD=wl("tfoot"),FD=wl("caption",{captionSide:!0});function E0({data:e}){return a.jsxs(a.Fragment,{children:[e.caption&&a.jsx(FD,{children:e.caption}),e.head&&a.jsx(UD,{children:a.jsx(Qh,{children:e.head.map((t,n)=>a.jsx(xx,{children:t},n))})}),e.body&&a.jsx(BD,{children:e.body.map((t,n)=>a.jsx(Qh,{children:t.map((r,o)=>a.jsx($D,{children:r},o))},n))}),e.foot&&a.jsx(VD,{children:a.jsx(Qh,{children:e.foot.map((t,n)=>a.jsx(xx,{children:t},n))})})]})}E0.displayName="@mantine/core/TableDataRenderer";const Lz={type:"scrollarea"},Iz=(e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":le(t),"--table-max-height":le(n),"--table-overflow":r==="native"?"auto":void 0}}),T0=be((e,t)=>{const n=ae("TableScrollContainer",Lz,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,children:p,minWidth:m,maxHeight:g,type:y,scrollAreaProps:b,attributes:w,...j}=n,C=ze({name:"TableScrollContainer",classes:qd,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:w,vars:f,varsResolver:Iz,rootSelector:"scrollContainer"});return a.jsx(de,{component:y==="scrollarea"?pi:"div",...y==="scrollarea"?g?{offsetScrollbars:"xy",...b}:{offsetScrollbars:"x",...b}:{},ref:t,...C("scrollContainer"),...j,children:a.jsx("div",{...C("scrollContainerInner"),children:p})})});T0.classes=qd;T0.displayName="@mantine/core/TableScrollContainer";const zz={withRowBorders:!0,verticalSpacing:7},$z=(e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:o,borderColor:s,stripedColor:c,highlightOnHoverColor:d,striped:f,highlightOnHover:p,stickyHeaderOffset:m,stickyHeader:g})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":Fn(r),"--table-vertical-spacing":Fn(o),"--table-border-color":s?Qt(s,e):void 0,"--table-striped-color":f&&c?Qt(c,e):void 0,"--table-highlight-on-hover-color":p&&d?Qt(d,e):void 0,"--table-sticky-header-offset":g?le(m):void 0}}),ce=be((e,t)=>{const n=ae("Table",zz,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,horizontalSpacing:p,verticalSpacing:m,captionSide:g,stripedColor:y,highlightOnHoverColor:b,striped:w,highlightOnHover:j,withColumnBorders:C,withRowBorders:R,withTableBorder:T,borderColor:E,layout:_,variant:k,data:L,children:A,stickyHeader:N,stickyHeaderOffset:U,mod:B,tabularNums:Q,attributes:J,...Z}=n,$=ze({name:"Table",props:n,className:o,style:s,classes:qd,classNames:r,styles:c,unstyled:d,attributes:J,rootSelector:"table",vars:f,varsResolver:$z});return a.jsx(Nz,{value:{getStyles:$,stickyHeader:N,striped:w===!0?"odd":w||void 0,highlightOnHover:j,withColumnBorders:C,withRowBorders:R,captionSide:g||"bottom"},children:a.jsx(de,{component:"table",variant:k,ref:t,mod:[{"data-with-table-border":T,"data-tabular-nums":Q},B],...$("table"),...Z,children:A||!!L&&a.jsx(E0,{data:L})})})});ce.classes=qd;ce.displayName="@mantine/core/Table";ce.Td=$D;ce.Th=xx;ce.Tr=Qh;ce.Thead=UD;ce.Tbody=BD;ce.Tfoot=VD;ce.Caption=FD;ce.ScrollContainer=T0;ce.DataRenderer=E0;const[Uz,R0]=Mr("Tabs component was not found in the tree");var Gd={root:"m_89d60db1","list--default":"m_576c9d4",list:"m_89d33d6d",tab:"m_4ec4dce6",panel:"m_b0c91715",tabSection:"m_fc420b1f",tabLabel:"m_42bbd1ae","tab--default":"m_539e827b","list--outline":"m_6772fbd5","tab--outline":"m_b59ab47c","tab--pills":"m_c3381914"};const _0=be((e,t)=>{const n=ae("TabsList",null,e),{children:r,className:o,grow:s,justify:c,classNames:d,styles:f,style:p,mod:m,...g}=n,y=R0();return a.jsx(de,{...g,...y.getStyles("list",{className:o,style:p,classNames:d,styles:f,props:n,variant:y.variant}),ref:t,role:"tablist",variant:y.variant,mod:[{grow:s,orientation:y.orientation,placement:y.orientation==="vertical"&&y.placement,inverted:y.inverted},m],"aria-orientation":y.orientation,__vars:{"--tabs-justify":c},children:r})});_0.classes=Gd;_0.displayName="@mantine/core/TabsList";const D0=be((e,t)=>{const n=ae("TabsPanel",null,e),{children:r,className:o,value:s,classNames:c,styles:d,style:f,mod:p,keepMounted:m,...g}=n,y=R0(),b=y.value===s,w=y.keepMounted||m||b?r:null;return a.jsx(de,{...y.getStyles("panel",{className:o,classNames:c,styles:d,style:[f,b?void 0:{display:"none"}],props:n}),ref:t,mod:[{orientation:y.orientation},p],role:"tabpanel",id:y.getPanelId(s),"aria-labelledby":y.getTabId(s),...g,children:w})});D0.classes=Gd;D0.displayName="@mantine/core/TabsPanel";const A0=be((e,t)=>{const n=ae("TabsTab",null,e),{className:r,children:o,rightSection:s,leftSection:c,value:d,onClick:f,onKeyDown:p,disabled:m,color:g,style:y,classNames:b,styles:w,vars:j,mod:C,tabIndex:R,...T}=n,E=jn(),{dir:_}=ps(),k=R0(),L=d===k.value,A=U=>{k.onChange(k.allowTabDeactivation&&d===k.value?null:d),f?.(U)},N={classNames:b,styles:w,props:n};return a.jsxs(ar,{...k.getStyles("tab",{className:r,style:y,variant:k.variant,...N}),disabled:m,unstyled:k.unstyled,variant:k.variant,mod:[{active:L,disabled:m,orientation:k.orientation,inverted:k.inverted,placement:k.orientation==="vertical"&&k.placement},C],ref:t,role:"tab",id:k.getTabId(d),"aria-selected":L,tabIndex:R!==void 0?R:L||k.value===null?0:-1,"aria-controls":k.getPanelId(d),onClick:A,__vars:{"--tabs-color":g?Qt(g,E):void 0},onKeyDown:Zx({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:k.activateTabWithKeyboard,loop:k.loop,orientation:k.orientation||"horizontal",dir:_,onKeyDown:p}),...T,children:[c&&a.jsx("span",{...k.getStyles("tabSection",N),"data-position":"left",children:c}),o&&a.jsx("span",{...k.getStyles("tabLabel",N),children:o}),s&&a.jsx("span",{...k.getStyles("tabSection",N),"data-position":"right",children:s})]})});A0.classes=Gd;A0.displayName="@mantine/core/TabsTab";const FE="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",Bz={keepMounted:!0,orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,variant:"default",placement:"left"},Vz=(e,{radius:t,color:n,autoContrast:r})=>({root:{"--tabs-radius":Ft(t),"--tabs-color":Qt(n,e),"--tabs-text-color":yl(r,e)?ba({color:n,theme:e,autoContrast:r}):void 0}}),Pt=be((e,t)=>{const n=ae("Tabs",Bz,e),{defaultValue:r,value:o,onChange:s,orientation:c,children:d,loop:f,id:p,activateTabWithKeyboard:m,allowTabDeactivation:g,variant:y,color:b,radius:w,inverted:j,placement:C,keepMounted:R,classNames:T,styles:E,unstyled:_,className:k,style:L,vars:A,autoContrast:N,mod:U,attributes:B,...Q}=n,J=hr(p),[Z,$]=or({value:o,defaultValue:r,finalValue:null,onChange:s}),W=ze({name:"Tabs",props:n,classes:Gd,className:k,style:L,classNames:T,styles:E,unstyled:_,attributes:B,vars:A,varsResolver:Vz});return a.jsx(Uz,{value:{placement:C,value:Z,orientation:c,id:J,loop:f,activateTabWithKeyboard:m,getTabId:zC(`${J}-tab`,FE),getPanelId:zC(`${J}-panel`,FE),onChange:$,allowTabDeactivation:g,variant:y,color:b,radius:w,inverted:j,keepMounted:R,unstyled:_,getStyles:W},children:a.jsx(de,{ref:t,id:J,variant:y,mod:[{orientation:c,inverted:c==="horizontal"&&j,placement:c==="vertical"&&C},U],...W("root"),...Q,children:d})})});Pt.classes=Gd;Pt.displayName="@mantine/core/Tabs";Pt.Tab=A0;Pt.Panel=D0;Pt.List=_0;const Fe=be((e,t)=>{const n=ae("TextInput",null,e);return a.jsx(Lr,{component:"input",ref:t,...n,__staticSelector:"TextInput"})});Fe.classes=Lr.classes;Fe.displayName="@mantine/core/TextInput";var HD={root:"m_7341320d"};const Fz=(e,{size:t,radius:n,variant:r,gradient:o,color:s,autoContrast:c})=>{const d=e.variantColorResolver({color:s||e.primaryColor,theme:e,gradient:o,variant:r||"filled",autoContrast:c});return{root:{"--ti-size":st(t,"ti-size"),"--ti-radius":n===void 0?void 0:Ft(n),"--ti-bg":s||r?d.background:void 0,"--ti-color":s||r?d.color:void 0,"--ti-bd":s||r?d.border:void 0}}},k0=be((e,t)=>{const n=ae("ThemeIcon",null,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,autoContrast:p,attributes:m,...g}=n,y=ze({name:"ThemeIcon",classes:HD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:m,vars:f,varsResolver:Fz});return a.jsx(de,{ref:t,...y("root"),...g})});k0.classes=HD;k0.displayName="@mantine/core/ThemeIcon";const Hz=["h1","h2","h3","h4","h5","h6"],qz=["xs","sm","md","lg","xl"];function Gz(e,t){const n=t!==void 0?t:`h${e}`;return Hz.includes(n)?{fontSize:`var(--mantine-${n}-font-size)`,fontWeight:`var(--mantine-${n}-font-weight)`,lineHeight:`var(--mantine-${n}-line-height)`}:qz.includes(n)?{fontSize:`var(--mantine-font-size-${n})`,fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}:{fontSize:le(n),fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}}var qD={root:"m_8a5d1357"};const Wz={order:1},Qz=(e,{order:t,size:n,lineClamp:r,textWrap:o})=>{const s=Gz(t||1,n);return{root:{"--title-fw":s.fontWeight,"--title-lh":s.lineHeight,"--title-fz":s.fontSize,"--title-line-clamp":typeof r=="number"?r.toString():void 0,"--title-text-wrap":o}}},Ie=be((e,t)=>{const n=ae("Title",Wz,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,order:f,vars:p,size:m,variant:g,lineClamp:y,textWrap:b,mod:w,attributes:j,...C}=n,R=ze({name:"Title",props:n,classes:qD,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:j,vars:p,varsResolver:Qz});return[1,2,3,4,5,6].includes(f)?a.jsx(de,{...R("root"),component:`h${f}`,variant:g,ref:t,mod:[{order:f,"data-line-clamp":typeof y=="number"},w],size:m,...C}):null});Ie.classes=qD;Ie.displayName="@mantine/core/Title";function Yz(e){let t=e,n=!1;const r=new Set;return{getState(){return t},updateState(o){t=typeof o=="function"?o(t):o},setState(o){this.updateState(o),r.forEach(s=>s(t))},initialize(o){n||(t=o,n=!0)},subscribe(o){return r.add(o),()=>r.delete(o)}}}function Kz(e){return v.useSyncExternalStore(e.subscribe,()=>e.getState(),()=>e.getState())}function Xz(e,t,n){const r=[],o=[],s={};for(const c of e){const d=c.position||t;s[d]=s[d]||0,s[d]+=1,s[d]<=n?o.push(c):r.push(c)}return{notifications:o,queue:r}}const Jz=()=>Yz({notifications:[],queue:[],defaultPosition:"bottom-right",limit:5}),jl=Jz(),Zz=(e=jl)=>Kz(e);function eu(e,t){const n=e.getState(),r=t([...n.notifications,...n.queue]),o=Xz(r,n.defaultPosition,n.limit);e.setState({notifications:o.notifications,queue:o.queue,limit:n.limit,defaultPosition:n.defaultPosition})}function ke(e,t=jl){const n=e.id||ip();return eu(t,r=>e.id&&r.some(o=>o.id===e.id)?r:[...r,{...e,id:n}]),n}function GD(e,t=jl){return eu(t,n=>n.filter(r=>r.id===e?(r.onClose?.(r),!1):!0)),e}function Ys(e,t=jl){return eu(t,n=>n.map(r=>r.id===e.id?{...r,...e}:r)),e.id}function e8(e=jl){eu(e,()=>[])}function t8(e=jl){eu(e,t=>t.slice(0,e.getState().limit))}const Di={show:ke,hide:GD,update:Ys,clean:e8,cleanQueue:t8,updateState:eu};function bx(e,t){return bx=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},bx(e,t)}function WD(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,bx(e,t)}var Ty={exports:{}},Ry,HE;function n8(){if(HE)return Ry;HE=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Ry=e,Ry}var _y,qE;function r8(){if(qE)return _y;qE=1;var e=n8();function t(){}function n(){}return n.resetWarningCache=t,_y=function(){function r(c,d,f,p,m,g){if(g!==e){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}}r.isRequired=r;function o(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s},_y}var GE;function i8(){return GE||(GE=1,Ty.exports=r8()()),Ty.exports}var o8=i8();const ln=Lp(o8),WE={disabled:!1},hp=kn.createContext(null);var a8=function(t){return t.scrollTop},od="unmounted",Fs="exited",Hs="entering",jc="entered",Sx="exiting",Ca=(function(e){WD(t,e);function t(r,o){var s;s=e.call(this,r,o)||this;var c=o,d=c&&!c.isMounting?r.enter:r.appear,f;return s.appearStatus=null,r.in?d?(f=Fs,s.appearStatus=Hs):f=jc:r.unmountOnExit||r.mountOnEnter?f=od:f=Fs,s.state={status:f},s.nextCallback=null,s}t.getDerivedStateFromProps=function(o,s){var c=o.in;return c&&s.status===od?{status:Fs}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(o){var s=null;if(o!==this.props){var c=this.state.status;this.props.in?c!==Hs&&c!==jc&&(s=Hs):(c===Hs||c===jc)&&(s=Sx)}this.updateStatus(!1,s)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var o=this.props.timeout,s,c,d;return s=c=d=o,o!=null&&typeof o!="number"&&(s=o.exit,c=o.enter,d=o.appear!==void 0?o.appear:c),{exit:s,enter:c,appear:d}},n.updateStatus=function(o,s){if(o===void 0&&(o=!1),s!==null)if(this.cancelNextCallback(),s===Hs){if(this.props.unmountOnExit||this.props.mountOnEnter){var c=this.props.nodeRef?this.props.nodeRef.current:id.findDOMNode(this);c&&a8(c)}this.performEnter(o)}else this.performExit();else this.props.unmountOnExit&&this.state.status===Fs&&this.setState({status:od})},n.performEnter=function(o){var s=this,c=this.props.enter,d=this.context?this.context.isMounting:o,f=this.props.nodeRef?[d]:[id.findDOMNode(this),d],p=f[0],m=f[1],g=this.getTimeouts(),y=d?g.appear:g.enter;if(!o&&!c||WE.disabled){this.safeSetState({status:jc},function(){s.props.onEntered(p)});return}this.props.onEnter(p,m),this.safeSetState({status:Hs},function(){s.props.onEntering(p,m),s.onTransitionEnd(y,function(){s.safeSetState({status:jc},function(){s.props.onEntered(p,m)})})})},n.performExit=function(){var o=this,s=this.props.exit,c=this.getTimeouts(),d=this.props.nodeRef?void 0:id.findDOMNode(this);if(!s||WE.disabled){this.safeSetState({status:Fs},function(){o.props.onExited(d)});return}this.props.onExit(d),this.safeSetState({status:Sx},function(){o.props.onExiting(d),o.onTransitionEnd(c.exit,function(){o.safeSetState({status:Fs},function(){o.props.onExited(d)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(o,s){s=this.setNextCallback(s),this.setState(o,s)},n.setNextCallback=function(o){var s=this,c=!0;return this.nextCallback=function(d){c&&(c=!1,s.nextCallback=null,o(d))},this.nextCallback.cancel=function(){c=!1},this.nextCallback},n.onTransitionEnd=function(o,s){this.setNextCallback(s);var c=this.props.nodeRef?this.props.nodeRef.current:id.findDOMNode(this),d=o==null&&!this.props.addEndListener;if(!c||d){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var f=this.props.nodeRef?[this.nextCallback]:[c,this.nextCallback],p=f[0],m=f[1];this.props.addEndListener(p,m)}o!=null&&setTimeout(this.nextCallback,o)},n.render=function(){var o=this.state.status;if(o===od)return null;var s=this.props,c=s.children;s.in,s.mountOnEnter,s.unmountOnExit,s.appear,s.enter,s.exit,s.timeout,s.addEndListener,s.onEnter,s.onEntering,s.onEntered,s.onExit,s.onExiting,s.onExited,s.nodeRef;var d=e0(s,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]);return kn.createElement(hp.Provider,{value:null},typeof c=="function"?c(o,d):kn.cloneElement(kn.Children.only(c),d))},t})(kn.Component);Ca.contextType=hp;Ca.propTypes={};function mc(){}Ca.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:mc,onEntering:mc,onEntered:mc,onExit:mc,onExiting:mc,onExited:mc};Ca.UNMOUNTED=od;Ca.EXITED=Fs;Ca.ENTERING=Hs;Ca.ENTERED=jc;Ca.EXITING=Sx;function s8(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function P0(e,t){var n=function(s){return t&&v.isValidElement(s)?t(s):s},r=Object.create(null);return e&&v.Children.map(e,function(o){return o}).forEach(function(o){r[o.key]=n(o)}),r}function l8(e,t){e=e||{},t=t||{};function n(m){return m in t?t[m]:e[m]}var r=Object.create(null),o=[];for(var s in e)s in t?o.length&&(r[s]=o,o=[]):o.push(s);var c,d={};for(var f in t){if(r[f])for(c=0;c<r[f].length;c++){var p=r[f][c];d[r[f][c]]=n(p)}d[f]=n(f)}for(c=0;c<o.length;c++)d[o[c]]=n(o[c]);return d}function Ks(e,t,n){return n[t]!=null?n[t]:e.props[t]}function c8(e,t){return P0(e.children,function(n){return v.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:Ks(n,"appear",e),enter:Ks(n,"enter",e),exit:Ks(n,"exit",e)})})}function u8(e,t,n){var r=P0(e.children),o=l8(t,r);return Object.keys(o).forEach(function(s){var c=o[s];if(v.isValidElement(c)){var d=s in t,f=s in r,p=t[s],m=v.isValidElement(p)&&!p.props.in;f&&(!d||m)?o[s]=v.cloneElement(c,{onExited:n.bind(null,c),in:!0,exit:Ks(c,"exit",e),enter:Ks(c,"enter",e)}):!f&&d&&!m?o[s]=v.cloneElement(c,{in:!1}):f&&d&&v.isValidElement(p)&&(o[s]=v.cloneElement(c,{onExited:n.bind(null,c),in:p.props.in,exit:Ks(c,"exit",e),enter:Ks(c,"enter",e)}))}}),o}var d8=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},f8={component:"div",childFactory:function(t){return t}},ts=(function(e){WD(t,e);function t(r,o){var s;s=e.call(this,r,o)||this;var c=s.handleExited.bind(s8(s));return s.state={contextValue:{isMounting:!0},handleExited:c,firstRender:!0},s}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(o,s){var c=s.children,d=s.handleExited,f=s.firstRender;return{children:f?c8(o,d):u8(o,c,d),firstRender:!1}},n.handleExited=function(o,s){var c=P0(this.props.children);o.key in c||(o.props.onExited&&o.props.onExited(s),this.mounted&&this.setState(function(d){var f=dp({},d.children);return delete f[o.key],{children:f}}))},n.render=function(){var o=this.props,s=o.component,c=o.childFactory,d=e0(o,["component","childFactory"]),f=this.state.contextValue,p=d8(this.state.children).map(c);return delete d.appear,delete d.enter,delete d.exit,s===null?kn.createElement(hp.Provider,{value:f},p):kn.createElement(hp.Provider,{value:f},kn.createElement(s,d,p))},t})(kn.Component);ts.propTypes={};ts.defaultProps=f8;const QD=["bottom-center","bottom-left","bottom-right","top-center","top-left","top-right"];function h8(e,t){return e.reduce((n,r)=>(n[r.position||t].push(r),n),QD.reduce((n,r)=>(n[r]=[],n),{}))}const QE={left:"translateX(-100%)",right:"translateX(100%)","top-center":"translateY(-100%)","bottom-center":"translateY(100%)"},p8={left:"translateX(0)",right:"translateX(0)","top-center":"translateY(0)","bottom-center":"translateY(0)"};function m8({state:e,maxHeight:t,position:n,transitionDuration:r}){const[o,s]=n.split("-"),c=s==="center"?`${o}-center`:s,d={opacity:0,maxHeight:t,transform:QE[c],transitionDuration:`${r}ms, ${r}ms, ${r}ms`,transitionTimingFunction:"cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear",transitionProperty:"opacity, transform, max-height"},f={opacity:1,transform:p8[c]},p={opacity:0,maxHeight:0,transform:QE[c]};return{...d,...{entering:f,entered:f,exiting:p,exited:p}[e]}}function g8(e,t){return typeof t=="number"?t:t===!1||e===!1?!1:e}const YD=v.forwardRef(({data:e,onHide:t,autoClose:n,...r},o)=>{const{autoClose:s,message:c,...d}=e,f=g8(n,e.autoClose),p=v.useRef(-1),m=()=>window.clearTimeout(p.current),g=()=>{t(e.id),m()},y=()=>{typeof f=="number"&&(p.current=window.setTimeout(g,f))};return v.useEffect(()=>{e.onOpen?.(e)},[]),v.useEffect(()=>(y(),m),[f]),a.jsx(p0,{...r,...d,onClose:g,ref:o,onMouseEnter:m,onMouseLeave:y,children:c})});YD.displayName="@mantine/notifications/NotificationContainer";var KD={root:"m_b37d9ac7",notification:"m_5ed0edd0"};const v8=Ca,y8={position:"bottom-right",autoClose:4e3,transitionDuration:250,containerWidth:440,notificationMaxHeight:200,limit:5,zIndex:hi("overlay"),store:jl,withinPortal:!0},x8=(e,{zIndex:t,containerWidth:n})=>({root:{"--notifications-z-index":t?.toString(),"--notifications-container-width":le(n)}}),Ea=be((e,t)=>{const n=ae("Notifications",y8,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,position:p,autoClose:m,transitionDuration:g,containerWidth:y,notificationMaxHeight:b,limit:w,zIndex:j,store:C,portalProps:R,withinPortal:T,...E}=n,_=jn(),k=Zz(C),L=xM(),A=nb(),N=v.useRef({}),U=v.useRef(0),Q=(_.respectReducedMotion?A:!1)?1:g,J=ze({name:"Notifications",classes:KD,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,vars:f,varsResolver:x8});v.useEffect(()=>{C?.updateState(W=>({...W,limit:w||5,defaultPosition:p}))},[w,p]),tl(()=>{k.notifications.length>U.current&&setTimeout(()=>L(),0),U.current=k.notifications.length},[k.notifications]);const Z=h8(k.notifications,p),$=QD.reduce((W,M)=>(W[M]=Z[M].map(({style:I,...z})=>a.jsx(v8,{timeout:Q,onEnter:()=>N.current[z.id].offsetHeight,nodeRef:{current:N.current[z.id]},children:F=>a.jsx(YD,{ref:X=>{X&&(N.current[z.id]=X)},data:z,onHide:X=>GD(X,C),autoClose:m,...J("notification",{style:{...m8({state:F,position:M,transitionDuration:Q,maxHeight:b}),...I}})})},z.id)),W),{});return a.jsxs(pa,{withinPortal:T,...R,children:[a.jsx(de,{...J("root"),"data-position":"top-center",ref:t,...E,children:a.jsx(ts,{children:$["top-center"]})}),a.jsx(de,{...J("root"),"data-position":"top-left",...E,children:a.jsx(ts,{children:$["top-left"]})}),a.jsx(de,{...J("root",{className:il.classNames.fullWidth}),"data-position":"top-right",...E,children:a.jsx(ts,{children:$["top-right"]})}),a.jsx(de,{...J("root",{className:il.classNames.fullWidth}),"data-position":"bottom-right",...E,children:a.jsx(ts,{children:$["bottom-right"]})}),a.jsx(de,{...J("root"),"data-position":"bottom-left",...E,children:a.jsx(ts,{children:$["bottom-left"]})}),a.jsx(de,{...J("root"),"data-position":"bottom-center",...E,children:a.jsx(ts,{children:$["bottom-center"]})})]})});Ea.classes=KD;Ea.displayName="@mantine/notifications/Notifications";Ea.show=Di.show;Ea.hide=Di.hide;Ea.update=Di.update;Ea.clean=Di.clean;Ea.cleanQueue=Di.cleanQueue;Ea.updateState=Di.updateState;class b8{operator;child;constructor(t,n){this.operator=t,this.child=n}toString(){return`${this.operator}(${this.child.toString()})`}}class Wd{operator;left;right;constructor(t,n,r){this.operator=t,this.left=n,this.right=r}toString(){return`(${this.left.toString()} ${this.operator} ${this.right.toString()})`}}class S8{prefixParselets={};infixParselets={};registerInfix(t,n){return this.infixParselets[t]=n,this}registerPrefix(t,n){return this.prefixParselets[t]=n,this}prefix(t,n,r){return this.registerPrefix(t,{parse(o,s){const c=o.consumeAndParse(n);return r(s,c)}})}infixLeft(t,n,r){return this.registerInfix(t,{parse(o,s,c){const d=o.consumeAndParse(n);return r(s,c,d)},precedence:n})}construct(t){return new w8(t,this.prefixParselets,this.infixParselets)}}class w8{tokens;prefixParselets;infixParselets;constructor(t,n,r){this.tokens=t,this.prefixParselets=n,this.infixParselets=r}hasMore(){return this.tokens.length>0}match(t){return this.peek()?.id!==t?!1:(this.consume(),!0)}consumeAndParse(t=1/0){const n=this.consume(),r=this.prefixParselets[n.id];if(!r)throw Error(`Parse error at "${n.value}" (line ${n.line}, column ${n.column}). No matching prefix parselet.`);let o=r.parse(this,n);for(;t>this.getPrecedence();){const s=this.consume();o=this.getInfixParselet(s).parse(this,o,s)}return o}getPrecedence(){const t=this.peek();if(!t)return 1/0;const n=this.getInfixParselet(t);return n?n.precedence:1/0}consume(t,n){if(!this.tokens.length)throw Error("Cant consume unknown more tokens.");if(t&&this.peek()?.id!==t){const r=this.peek();throw Error(`Expected ${t} but got "${r.id}" (${r.value}) at line ${r.line} column ${r.column}.`)}if(n&&this.peek()?.value!==n){const r=this.peek();throw Error(`Expected "${n}" but got "${r.value}" at line ${r.line} column ${r.column}.`)}return this.tokens.shift()}peek(){return this.tokens.length>0?this.tokens[0]:void 0}removeComments(){this.tokens=this.tokens.filter(t=>t.id!=="Comment")}getInfixParselet(t){return this.infixParselets[t.id==="Symbol"?t.value:t.id]}}class XD{max;cache;constructor(t=10){this.max=t,this.cache=new Map}clear(){this.cache.clear()}get(t){const n=this.cache.get(t);return n&&(this.cache.delete(t),this.cache.set(t,n)),n}set(t,n){this.cache.has(t)?this.cache.delete(t):this.cache.size>=this.max&&this.cache.delete(this.first()),this.cache.set(t,n)}delete(t){this.cache.delete(t)}keys(){return this.cache.keys()}first(){return this.cache.keys().next().value}}const io="http://hl7.org",JD="ok",j8="created",C8="gone",E8="not-modified",T8="not-found",R8="unauthorized",_8="forbidden",D8="accepted",A8={resourceType:"OperationOutcome",id:JD,issue:[{severity:"information",code:"informational",details:{text:"All OK"}}]},k8={resourceType:"OperationOutcome",id:T8,issue:[{severity:"error",code:"not-found",details:{text:"Not found"}}]},xd={resourceType:"OperationOutcome",id:R8,issue:[{severity:"error",code:"login",details:{text:"Unauthorized"}}]},P8={...xd,issue:[...xd.issue,{severity:"error",code:"expired",details:{text:"Token expired"}}]},YE={...xd,issue:[...xd.issue,{severity:"error",code:"invalid",details:{text:"Token not issued for this audience"}}]},Qd={resourceType:"OperationOutcome",id:_8,issue:[{severity:"error",code:"forbidden",details:{text:"Forbidden"}}]};function jo(e,t){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"invalid",details:{text:e},...t?{expression:[t]}:void 0}]}}function Sn(e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"structure",details:{text:e}}]}}function N8(e){return{resourceType:"OperationOutcome",issue:[{severity:"error",code:"exception",details:{text:"Internal server error"},diagnostics:e.toString()}]}}function O8(e){return!e||typeof e!="object"?!1:e instanceof Error||typeof DOMException<"u"&&e instanceof DOMException?!0:Object.prototype.toString.call(e)==="[object Error]"}function Cm(e){return typeof e=="object"&&e!==null&&e.resourceType==="OperationOutcome"}function ZD(e){return e.id===JD||e.id===j8||e.id===E8||e.id===D8}function M8(e){return e.id===C8}class ft extends Error{outcome;constructor(t,n){super(eA(t),n),Object.setPrototypeOf(this,ft.prototype),this.name=this.constructor.name,this.outcome=t,Error.captureStackTrace(this,this.constructor)}}function Yt(e){return e instanceof ft?e.outcome:Cm(e)?e:jo(Ge(e))}function Ge(e){return e?typeof e=="string"?e:O8(e)?e.message:Cm(e)?eA(e):typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:JSON.stringify(e):"Unknown error"}function eA(e){const t=e.issue?.map(tA)??[];return t.length>0?t.join("; "):"Unknown error"}function tA(e){let t;return e.details?.text?e.diagnostics?t=`${e.details.text} (${e.diagnostics})`:t=e.details.text:e.diagnostics?t=e.diagnostics:t="Unknown error",e.expression?.length&&(t+=` (${e.expression.join(", ")})`),t}function L8(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 I8(e){const t=Object.create(null);for(const[n,r]of Object.entries(e))t[n]={name:n,type:n,path:n,elements:Object.fromEntries(Object.entries(r.elements).map(([o,s])=>[o,L8(o,s)])),constraints:[],innerTypes:[]};return t}const z8={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]}}},$8={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},modifierExtension:{max:9007199254740991,type:[{code:"Extension"}]}}},U8={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"}]}}},B8={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"}]}}},V8={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"}]}}},F8={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"}]}}},H8={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},coding:{max:9007199254740991,type:[{code:"Coding"}]},text:{type:[{code:"string"}]}}},q8={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"}]}}},G8={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},name:{type:[{code:"string"}]},telecom:{max:9007199254740991,type:[{code:"ContactPoint"}]}}},W8={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"}]}}},Q8={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"}]}}},Y8={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"}]}}},K8={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"}]}}},X8={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{type:[{code:"string"}]},searchParam:{type:[{code:"string"}]},valueSet:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/ValueSet"]}]},code:{max:9007199254740991,type:[{code:"Coding"}]}}},J8={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{type:[{code:"string"}]},searchParam:{type:[{code:"string"}]},"value[x]":{type:[{code:"dateTime"},{code:"Period"},{code:"Duration"}]}}},Z8={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{min:1,type:[{code:"string"}]},direction:{min:1,type:[{code:"code"}]}}},e$={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"}]}}},t$={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"]}]}}},n$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{type:[{code:"CodeableConcept"}]},"dose[x]":{type:[{code:"Range"},{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]},"rate[x]":{type:[{code:"Ratio"},{code:"Range"},{code:"Quantity",profile:["http://hl7.org/fhir/StructureDefinition/SimpleQuantity"]}]}}},r$={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"}]}}},i$={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"}]}}},o$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},type:{min:1,type:[{code:"code"}]},path:{min:1,type:[{code:"string"}]}}},a$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},discriminator:{max:9007199254740991,type:[{code:"ElementDefinitionSlicingDiscriminator"}]},description:{type:[{code:"string"}]},ordered:{type:[{code:"boolean"}]},rules:{min:1,type:[{code:"code"}]}}},s$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},path:{min:1,type:[{code:"string"}]},min:{min:1,type:[{code:"unsignedInt"}]},max:{min:1,type:[{code:"string"}]}}},l$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},code:{min:1,type:[{code:"uri"}]},profile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition","http://hl7.org/fhir/StructureDefinition/ImplementationGuide"]}]},targetProfile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition","http://hl7.org/fhir/StructureDefinition/ImplementationGuide"]}]},aggregation:{max:9007199254740991,type:[{code:"code"}]},versioning:{type:[{code:"code"}]}}},c$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},label:{min:1,type:[{code:"string"}]},"value[x]":{min:1,type:[{code:"base64Binary"},{code:"boolean"},{code:"canonical"},{code:"code"},{code:"date"},{code:"dateTime"},{code:"decimal"},{code:"id"},{code:"instant"},{code:"integer"},{code:"markdown"},{code:"oid"},{code:"positiveInt"},{code:"string"},{code:"time"},{code:"unsignedInt"},{code:"uri"},{code:"url"},{code:"uuid"},{code:"Address"},{code:"Age"},{code:"Annotation"},{code:"Attachment"},{code:"CodeableConcept"},{code:"Coding"},{code:"ContactPoint"},{code:"Count"},{code:"Distance"},{code:"Duration"},{code:"HumanName"},{code:"Identifier"},{code:"Money"},{code:"Period"},{code:"Quantity"},{code:"Range"},{code:"Ratio"},{code:"Reference"},{code:"SampledData"},{code:"Signature"},{code:"Timing"},{code:"ContactDetail"},{code:"Contributor"},{code:"DataRequirement"},{code:"Expression"},{code:"ParameterDefinition"},{code:"RelatedArtifact"},{code:"TriggerDefinition"},{code:"UsageContext"},{code:"Dosage"},{code:"Meta"}]}}},u$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},key:{min:1,type:[{code:"id"}]},requirements:{type:[{code:"string"}]},severity:{min:1,type:[{code:"code"}]},human:{min:1,type:[{code:"string"}]},expression:{type:[{code:"string"}]},xpath:{type:[{code:"string"}]},source:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]}}},d$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},strength:{min:1,type:[{code:"code"}]},description:{type:[{code:"string"}]},valueSet:{type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/ValueSet"]}]}}},f$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},identity:{min:1,type:[{code:"id"}]},language:{type:[{code:"code"}]},map:{min:1,type:[{code:"string"}]},comment:{type:[{code:"string"}]}}},h$={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"}]}}},p$={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"}]}}},m$={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"}]}}},g$={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"]}]}}},v$={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"}]}}},y$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},versionId:{type:[{code:"id"}]},lastUpdated:{type:[{code:"instant"}]},source:{type:[{code:"uri"}]},profile:{max:9007199254740991,type:[{code:"canonical",targetProfile:["http://hl7.org/fhir/StructureDefinition/StructureDefinition"]}]},security:{max:9007199254740991,type:[{code:"Coding"}]},tag:{max:9007199254740991,type:[{code:"Coding"}]},project:{type:[{code:"uri"}]},author:{type:[{code:"Reference"}]},onBehalfOf:{type:[{code:"Reference"}]},account:{type:[{code:"Reference"}]},accounts:{max:9007199254740991,type:[{code:"Reference"}]},compartment:{max:9007199254740991,type:[{code:"Reference"}]}}},x$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},currency:{type:[{code:"code"}]}}},b$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},status:{min:1,type:[{code:"code"}]},div:{min:1,type:[{code:"xhtml"}]}}},S$={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"]}]}}},w$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},start:{type:[{code:"dateTime"}]},end:{type:[{code:"dateTime"}]}}},j$={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"}]}}},C$={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"}]}}},E$={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"}]}}},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"}]}}},R$={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"]}]}}},_$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},numerator:{type:[{code:"Quantity"}]},denominator:{type:[{code:"Quantity"}]}}},D$={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"}]}}},A$={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"]}]}}},k$={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"}]}}},P$={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"}]}}},N$={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"}]}}},O$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},lowLimit:{type:[{code:"Quantity"}]},highLimit:{type:[{code:"Quantity"}]}}},M$={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"}]}}},L$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},"bounds[x]":{type:[{code:"Duration"},{code:"Range"},{code:"Period"}]},count:{type:[{code:"positiveInt"}]},countMax:{type:[{code:"positiveInt"}]},duration:{type:[{code:"decimal"}]},durationMax:{type:[{code:"decimal"}]},durationUnit:{type:[{code:"code"}]},frequency:{type:[{code:"positiveInt"}]},frequencyMax:{type:[{code:"positiveInt"}]},period:{type:[{code:"decimal"}]},periodMax:{type:[{code:"decimal"}]},periodUnit:{type:[{code:"code"}]},dayOfWeek:{max:9007199254740991,type:[{code:"code"}]},timeOfDay:{max:9007199254740991,type:[{code:"time"}]},when:{max:9007199254740991,type:[{code:"code"}]},offset:{type:[{code:"unsignedInt"}]}}},I$={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"}]}}},z$={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"]}]}}},$$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},U$={elements:{id:{type:[{code:"string"}]},extension:{max:9007199254740991,type:[{code:"Extension"}]},value:{type:[{code:"decimal"}]},comparator:{max:0,type:[{code:"code"}]},unit:{type:[{code:"string"}]},system:{type:[{code:"uri"}]},code:{type:[{code:"code"}]}}},B$={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"}]}}},V$={Element:z8,BackboneElement:$8,Address:U8,Age:B8,Annotation:V8,Attachment:F8,CodeableConcept:H8,Coding:q8,ContactDetail:G8,ContactPoint:W8,Contributor:Q8,Count:Y8,DataRequirement:K8,DataRequirementCodeFilter:X8,DataRequirementDateFilter:J8,DataRequirementSort:Z8,Distance:e$,Dosage:t$,DosageDoseAndRate:n$,Duration:r$,ElementDefinition:i$,ElementDefinitionSlicingDiscriminator:o$,ElementDefinitionSlicing:a$,ElementDefinitionBase:s$,ElementDefinitionType:l$,ElementDefinitionExample:c$,ElementDefinitionConstraint:u$,ElementDefinitionBinding:d$,ElementDefinitionMapping:f$,Expression:h$,Extension:p$,HumanName:m$,Identifier:g$,MarketingStatus:v$,Meta:y$,Money:x$,Narrative:b$,ParameterDefinition:S$,Period:w$,Population:j$,ProdCharacteristic:C$,ProductShelfLife:E$,Quantity:T$,Range:R$,Ratio:_$,Reference:D$,RelatedArtifact:A$,SampledData:k$,Signature:P$,SubstanceAmount:N$,SubstanceAmountReferenceRange:O$,Timing:M$,TimingRepeat:L$,TriggerDefinition:I$,UsageContext:z$,MoneyQuantity:$$,SimpleQuantity:U$,IdentityProvider:B$};function F$(e){return new q$(e).parse()}const pp=I8(V$),N0=Object.create(null),KE=Object.create(null),H$={"http://hl7.org/fhir/StructureDefinition/MoneyQuantity":"MoneyQuantity","http://hl7.org/fhir/StructureDefinition/SimpleQuantity":"SimpleQuantity","http://hl7.org/fhir/uv/sql-on-fhir/StructureDefinition/ViewDefinition":"ViewDefinition"};function nA(e){let t;return t=KE[e],t||(t=KE[e]=Object.create(null)),t}function XE(e){const n=(Array.isArray(e)?e:e.entry?.map(r=>r.resource)??[]).filter(r=>r?.resourceType==="StructureDefinition");OU(n);for(const r of n)rA(r)}function rA(e){if(!e?.name)throw new Error("Failed loading StructureDefinition from bundle");if(e.resourceType!=="StructureDefinition")return;const t=F$(e),n=H$[e.url];let r,o;n?(r=pp,o=n):e.url===`http://hl7.org/fhir/StructureDefinition/${e.type}`||e.url===`https://medplum.com/fhir/StructureDefinition/${e.type}`||e.type?.startsWith("http://")||e.type?.startsWith("https://")?(r=pp,o=e.type):(r=nA(e.url),o=e.type),r[o]=t;for(const s of t.innerTypes)s.parentType=t,r[s.name]=s;N0[e.url]=t}function iA(e){return!!pp[e]}function Em(e,t){if(t){const n=nA(t)[e];if(n)return n}return pp[e]}function oA(e,t){const n=Em(e,t);if(!n)throw new ft(jo("Unknown data type: "+e));return n}function O0(e){return!!N0[e]}function tu(e){return N0[e]}class q${root;elements;elementIndex;index;resourceSchema;slicingContext;innerTypes;backboneContext;constructor(t){if(!t.snapshot?.element||t.snapshot.element.length===0)throw new Error(`No snapshot defined for StructureDefinition '${t.name}'`);this.root=t.snapshot.element[0],this.elements=t.snapshot.element.slice(1),this.elementIndex=Object.create(null),this.index=0,this.resourceSchema={name:t.name,path:this.root.path,title:t.title,type:t.type,url:t.url,version:t.version,kind:t.kind,description:Q$(t),elements:{},constraints:this.parseElementDefinition(this.root).constraints,innerTypes:[],summaryProperties:new Set,mandatoryProperties:new Set},this.innerTypes=[]}parse(){let t=this.next();for(;t;){if(t.sliceName)this.parseSliceStart(t);else if(t.id?.includes(":")){if(this.slicingContext?.current){const n=Dy(t,this.slicingContext.path);this.slicingContext.current.elements[n]=this.parseElementDefinition(t)}}else{const n=this.parseElementDefinition(t);this.checkFieldEnter(t,n);let r=this.backboneContext;for(;r;){if(t.path?.startsWith(r.path+".")){r.type.elements[Dy(t,r.path)]=n;break}r=r.parent}if(!r){const o=Dy(t,this.root.path);t.isSummary&&this.resourceSchema.summaryProperties?.add(o.replace("[x]","")),n.min>0&&this.resourceSchema.mandatoryProperties?.add(o.replace("[x]","")),this.resourceSchema.elements[o]=n}this.checkFieldExit(t)}t=this.next()}return this.checkFieldExit(),this.innerTypes.length>0&&(this.resourceSchema.innerTypes=this.innerTypes),this.resourceSchema}checkFieldEnter(t,n){this.isInnerType(t)&&this.enterInnerType(t),this.slicingContext&&!gc(this.slicingContext.path,t?.path)&&(this.slicingContext=void 0),t.slicing&&!this.slicingContext&&this.enterSlice(t,n)}enterInnerType(t){for(;this.backboneContext&&!gc(this.backboneContext?.path,t.path);)this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;const n=oT(t);this.backboneContext={type:{name:n,type:n,path:t.path,title:t.label,description:t.definition,elements:{},constraints:this.parseElementDefinition(t).constraints,innerTypes:[]},path:t.path,parent:gc(this.backboneContext?.path,t.path)?this.backboneContext:this.backboneContext?.parent}}enterSlice(t,n){W$(t)&&!this.peek()?.sliceName||(n.slicing={discriminator:(t.slicing?.discriminator??[]).map(r=>{if(r.type!=="value"&&r.type!=="pattern"&&r.type!=="type")throw new Error(`Unsupported slicing discriminator type: ${r.type}`);return{path:r.path,type:r.type}}),slices:[],ordered:t.slicing?.ordered??!1,rule:t.slicing?.rules},this.slicingContext={field:n.slicing,path:t.path??""})}checkFieldExit(t=void 0){if(this.backboneContext&&!gc(this.backboneContext.path,t?.path))if(this.backboneContext.parent)do this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;while(this.backboneContext&&!gc(this.backboneContext.path,t?.path));else this.innerTypes.push(this.backboneContext.type),this.backboneContext=void 0}next(){const t=this.peek();if(t)return this.index++,t}peek(){const t=this.elements[this.index];if(t){if(this.elementIndex[t.path??""]=t,t.contentReference){const n=t.contentReference.slice(t.contentReference.indexOf("#")+1),r=this.elementIndex[n];return r?{...r,id:t.id,path:t.path,min:t.min??r.min,max:t.max??r.max,base:{path:r.base?.path??n,min:t.base?.min??r.base?.min??r.min,max:t.base?.max??r.base?.max??r.max},contentReference:t.contentReference,definition:t.definition}:void 0}return t}}isInnerType(t){const n=this.peek();return!!(gc(t?.path,n?.path)&&t.type?.some(r=>["BackboneElement","Element"].includes(r.code)))}parseSliceStart(t){if(!this.slicingContext)throw new Error(`Invalid slice start before discriminator: ${t.sliceName} (${t.id})`);this.slicingContext.current={...this.parseElementDefinition(t),name:t.sliceName??"",definition:t.definition,elements:{}},this.slicingContext.field.slices.push(this.slicingContext.current)}parseElementDefinitionType(t){return(t.type??[]).map(n=>{let r;return(n.code==="BackboneElement"||n.code==="Element")&&(r=oT(t)),r||(r=Lo(n,"http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type")?.valueUrl),r||(r=n.code??""),{code:r,targetProfile:n.targetProfile,profile:n.profile}})}parseElementDefinition(t){const n=JE(t.max),r=t.base?.max?JE(t.base.max):n,o={type:"ElementDefinition",value:t};return{description:t.definition||"",path:t.path||t.base?.path||"",min:t.min??0,max:n,isArray:r>1,constraints:(t.constraint??[]).map(s=>({key:s.key??"",severity:s.severity??"error",expression:s.expression??"",description:s.human??""})),type:this.parseElementDefinitionType(t),fixed:ZE(bd(o,"fixed[x]")),pattern:ZE(bd(o,"pattern[x]")),binding:t.binding}}}function JE(e){return e==="*"?Number.POSITIVE_INFINITY:Number.parseInt(e,10)}function Dy(e,t=""){return G$(e.path,t)}function G$(e,t){return e?t&&e.startsWith(t)?e.substring(t.length+1):e:""}function gc(e,t){return!e||!t?!1:t.startsWith(e+".")||t===e}function ZE(e){return Array.isArray(e)&&e.length>0?e[0]:wn(e)?void 0:e}function W$(e){const t=e.slicing?.discriminator;return!!(e.type?.some(n=>n.code==="Extension")&&t?.length===1&&t[0].type==="value"&&t[0].path==="url")}function Q$(e){let t=e.description;return t?.startsWith(`Base StructureDefinition for ${e.name} Type: `)&&(t=t.substring(`Base StructureDefinition for ${e.name} Type: `.length)),t}function Y$(e,t,n){if(e===void 0)return[void 0];if(t==="$this")return[e];const r=n?.withPath?aA:bd,[o,...s]=t.split(".");let c=[r(e,o,n)];for(const d of s){const f=[];for(const p of c)if(Array.isArray(p))for(const m of p)f.push(r(m,d,n));else(n?.withPath&&p?.value!==void 0||!n?.withPath&&p!==void 0)&&f.push(r(p,d,n));c=f}return c}function aA(e,t,n){const r=e.path;return K$(bd(e,t,n),r,t)}function K$(e,t,n){const r=t?t+".":"";return e===void 0?{type:"undefined",value:void 0,path:`${r}${n}`}:Array.isArray(e)?e.map((o,s)=>({...o,path:`${r}${n}[${s}]`})):{...e,path:`${r}${n}`}}const sA={date:/^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/,dateTime:/^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/};function X$(e,t,n,r){if(Array.isArray(e))return!1;let o;t.path==="$this"?o=n:o=(r??n.elements)[t.path];const s=n.type;switch(t.type){case"value":case"pattern":if(!e||!o)return!1;if(o.pattern)return I0(e,o.pattern);if(o.fixed)return _o(e,o.fixed);if(o.binding?.strength==="required"&&o.binding.valueSet)return!0;break;case"type":return!e||!s?.length?!1:s.some(c=>c.code===e.type)}return!1}function Je(e){return[{type:ne.boolean,value:e}]}function di(e){return e==null?{type:"undefined",value:void 0}:Number.isSafeInteger(e)?{type:ne.integer,value:e}:typeof e=="number"?{type:ne.decimal,value:e}:typeof e=="boolean"?{type:ne.boolean,value:e}:typeof e=="string"?{type:ne.string,value:e}:Ai(e)?{type:ne.Quantity,value:e}:Io(e)?{type:e.resourceType,value:e}:bA(e)?{type:ne.CodeableConcept,value:e}:xA(e)?{type:ne.Coding,value:e}:{type:ne.BackboneElement,value:e}}function bo(e){return e.length===0?!1:!!e[0].value}function va(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 bd(e,t,n){if(!e.value)return;const r=xs(e.type,t,n?.profileUrl);return r?lA(e,t,r):Yd(e,t)}function lA(e,t,n){const r=e.value,o=n.type;if(!o||o.length===0)return;let s,c="undefined",d;const f=n.path.lastIndexOf("."),p=n.path.substring(f+1);for(const m of o){const g=p.replace("[x]",qn(m.code));if(s=r[g],d=r["_"+g],s!==void 0||d!==void 0){c=m.code;break}}if(d)if(Array.isArray(s)){s=s.slice();for(let m=0;m<Math.max(s.length,d.length);m++)s[m]=Ay(s[m],d[m])}else if(!s&&Array.isArray(d)){s=d.slice();for(let m=0;m<d.length;m++)s[m]=Ay(void 0,d[m])}else s=Ay(s,d);if(!wn(s))return(c==="Element"||c==="BackboneElement")&&(c=n.type[0].code),Array.isArray(s)?s.map(m=>eT(m,c)):eT(s,c)}function eT(e,t){return t==="Resource"&&Io(e)&&(t=e.resourceType),{type:t,value:e}}function Yd(e,t){const n=e.value;if(!n||typeof n!="object")return;let r;if(t in n){const o=n[t];Array.isArray(o)?r=o.map(di):r=di(o)}else{const o=t.endsWith("[x]")?t.substring(0,t.length-3):t;for(const s of Object.values(ne)){const c=o+qn(s);if(c in n){const d=n[c];Array.isArray(d)?r=d.map(f=>({type:s,value:f})):r={type:s,value:d};break}}}if(Array.isArray(r)){if(r.length===0||wn(r[0]))return}else if(wn(r))return;return r}function cA(e){const t=[];for(const n of e){let r=!1;for(const o of t)if(bo(Tm(n,o))){r=!0;break}r||t.push(n)}return t}function J$(e){return Je(!bo(e))}function Z$(e,t){return e.length===0||t.length===0?[]:e.length!==t.length?Je(!1):Je(e.every((n,r)=>bo(Tm(n,t[r]))))}function eU(e,t){return e.length===0||t.length===0?[]:e.length!==t.length?Je(!0):Je(e.some((n,r)=>!bo(Tm(n,t[r]))))}function Tm(e,t){const n=e.value?.valueOf(),r=t.value?.valueOf();return typeof n=="number"&&typeof r=="number"?Je(Math.abs(n-r)<1e-8):Ai(n)&&Ai(r)?Je(mA(n,r)):Je(typeof n=="object"&&typeof r=="object"?M0(e,t):n===r)}function uA(e,t){return e.length===0&&t.length===0?Je(!0):e.length!==t.length?Je(!1):(e.sort(tT),t.sort(tT),Je(e.every((n,r)=>bo(tU(n,t[r])))))}function tU(e,t){const{type:n,value:r}=e,{type:o,value:s}=t,c=r?.valueOf(),d=s?.valueOf();return typeof c=="number"&&typeof d=="number"?Je(Math.abs(c-d)<.01):Ai(c)&&Ai(d)?Je(mA(c,d)):Je(n==="Coding"&&o==="Coding"?typeof c!="object"||typeof d!="object"?!1:c.code===d.code&&c.system===d.system:typeof c=="object"&&typeof d=="object"?M0({...c,id:void 0},{...d,id:void 0}):typeof c=="string"&&typeof d=="string"?c.toLowerCase()===d.toLowerCase():c===d)}function tT(e,t){const n=e.value?.valueOf(),r=t.value?.valueOf();return typeof n=="number"&&typeof r=="number"?n-r:typeof n=="string"&&typeof r=="string"?n.localeCompare(r):0}function dA(e,t){const{value:n}=e;if(n==null)return!1;let r=t;switch(r.startsWith("System.")&&(r=r.substring(7)),r.startsWith("FHIR.")&&(r=r.substring(5)),r){case"Boolean":return typeof n=="boolean";case"Decimal":case"Integer":return typeof n=="number";case"Date":return fA(n);case"DateTime":return Sd(n);case"Time":return typeof n=="string"&&!!/^T\d/.exec(n);case"Period":return hA(n);case"Quantity":return Ai(n);default:return e.type===r||typeof n=="object"&&n?.resourceType===r}}function fA(e){return typeof e=="string"&&!!sA.date.exec(e)}function Sd(e){return typeof e=="string"&&!!sA.dateTime.exec(e)}function hA(e){return!!(e&&typeof e=="object"&&("start"in e&&Sd(e.start)||"end"in e&&Sd(e.end)))}function pA(e){if(e){if(fA(e)||Sd(e))return{start:Ah(e,"0000-01-01T00:00:00.000"),end:Ah(e,"xxxx-12-31T23:59:59.999")};if(hA(e))return{start:e.start?Ah(e.start,"0000-01-01T00:00:00.000"):void 0,end:e.end?Ah(e.end,"xxxx-12-31T23:59:59.999"):void 0}}}function Ah(e,t){let n="Z";const r=Math.max(e.indexOf("+",10),e.indexOf("-",10));r>-1?(n=e.substring(r),e=e.substring(0,r)):e.endsWith("Z")&&(e=e.substring(0,e.length-1));const o=e+t.substring(e.length)+n;return new Date(o).toISOString()}function Ai(e){return!!(e&&typeof e=="object"&&"value"in e&&typeof e.value=="number")}function mA(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 M0(e,t){const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const s=e[o],c=t[o];if(nT(s)&&nT(c)){if(!M0(s,c))return!1}else if(s!==c)return!1}return!0}function nT(e){return e!==null&&typeof e=="object"}function Ay(e,t){if(t){if(typeof t!="object")throw new Error("Primitive extension must be an object");return nU(e??{},t)}return e}function nU(e,t){return delete t.__proto__,delete t.constructor,Object.assign(e,t)}function gA(e,t){return Io(e,t)&&"id"in e&&typeof e.id=="string"}function Wt(e){const t=Ot(e)??"undefined/undefined",n=ya(e);return n===t?{reference:t}:{reference:t,display:n}}function Ot(e){if(Ta(e))return e.reference;if(gA(e))return`${e.resourceType}/${e.id}`}function sl(e){if(e)return Ta(e)?e.reference.split("/")[1]:e.id}function rU(e){return e.resourceType==="Patient"||e.resourceType==="Practitioner"||e.resourceType==="RelatedPerson"}function ya(e){if(rU(e)){const t=iU(e);if(t)return t}if(e.resourceType==="Device"){const t=oU(e);if(t)return t}if(e.resourceType==="MedicationRequest"&&e.medicationCodeableConcept)return ds(e.medicationCodeableConcept);if(e.resourceType==="Subscription"&&e.criteria)return e.criteria;if(e.resourceType==="User"&&e.email)return e.email;if("name"in e&&e.name&&typeof e.name=="string")return e.name;if("code"in e&&e.code){let t=e.code;if(Array.isArray(t)&&(t=t[0]),bA(t))return ds(t);if(gU(t))return t.text}return Ot(e)??""}function iU(e){const t=e.name;if(t&&t.length>0)return nu(t[0])}function oU(e){const t=e.deviceName;if(t&&t.length>0)return t[0].name}function aU(e){if(!("photo"in e))return;const t=e.photo;if(t)if(Array.isArray(t))for(const n of t){const r=rT(n);if(r)return r}else return rT(t)}function rT(e){if(e.url&&e.contentType?.startsWith("image/"))return e.url}function vA(e,t){const n=new Date(e);n.setUTCHours(0,0,0,0);const r=t?new Date(t):new Date;r.setUTCHours(0,0,0,0);const o=n.getUTCFullYear(),s=n.getUTCMonth(),c=n.getUTCDate(),d=r.getUTCFullYear(),f=r.getUTCMonth(),p=r.getUTCDate();let m=d-o;(f<s||f===s&&p<c)&&m--;let g=d*12+f-(o*12+s);p<c&&g--;const y=Math.floor((r.getTime()-n.getTime())/(1e3*60*60*24));return{years:m,months:g,days:y}}function sU(e,t){const{years:n,months:r,days:o}=vA(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 Lo(e,...t){let n=e;for(let r=0;r<t.length&&n;r++)n=n?.extension?.find(o=>o.url===t[r]);return n}function no(e,t){const n=L0(e);return JSON.stringify(n,null,t?2:void 0)??""}function L0(e){if(!(e==null||e===""))return typeof e=="object"?Array.isArray(e)?lU(e):cU(e):e}function lU(e){const t=e.length;if(t===0)return;let n,r=0;for(let o=0;o<t;o++){const s=e[o],c=L0(s);c!==s&&!n&&(n=Array.from(e)),c===void 0?n&&(n[o]=null):(n&&(n[o]=c),r++)}if(r!==0)return n??e}function cU(e){let t,n=0;for(const r in e){const o=e[r],s=L0(o);s!==o&&!t&&(t={...e}),s===void 0?t&&delete t[r]:(t&&(t[r]=s),n++)}if(n!==0)return t??e}function wn(e){if(e==null)return!0;const t=typeof e;return t==="string"||t==="object"?!Pn(e):!1}function Pn(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 uU(e){if(!e)return;let t=e.length-1;for(;t>=0&&wn(e[t]);)t--;return t>=0?e.slice(0,t+1):void 0}function _o(e,t,n){return e===t||wn(e)&&wn(t)?!0:wn(e)||wn(t)?!1:Array.isArray(e)&&Array.isArray(t)?dU(e,t):Array.isArray(e)||Array.isArray(t)?!1:fr(e)&&fr(t)?fU(e,t,n):(fr(e)||fr(t),!1)}function dU(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!_o(e[n],t[n]))return!1;return!0}function fU(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 s=e[o],c=t[o];if(!_o(s,c,o))return!1}return!0}function I0(e,t){return wn(e)?!0:wn(t)?!1:Array.isArray(e)&&Array.isArray(t)?hU(e,t):Array.isArray(e)||Array.isArray(t)?!1:fr(e)&&fr(t)?pU(e,t):fr(e)||fr(t)?!1:e===t}function hU(e,t){return t.every(n=>e.some(r=>I0(r,n)))}function pU(e,t){return Object.entries(t).every(([n,r])=>n in e&&I0(e[n],r))}function fi(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function yA(e){return/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i.test(e)}function fr(e){return e!==null&&typeof e=="object"}function mU(e){return typeof e=="string"}function xA(e){return fr(e)&&"code"in e&&typeof e.code=="string"}function bA(e){return fr(e)&&"coding"in e&&Array.isArray(e.coding)&&e.coding.every(xA)}function gU(e){return fr(e)&&"text"in e&&typeof e.text=="string"}const SA=[];for(let e=0;e<256;e++)SA.push(e.toString(16).padStart(2,"0"));function vU(e){const t=wA(e),n=new Uint8Array(t),r=new Array(n.length);for(let o=0;o<n.length;o++)r[o]=SA[n[o]];return r.join("")}function yU(e){const t=wA(e),n=new Uint8Array(t),r=new Array(n.length);for(let o=0;o<n.length;o++)r[o]=String.fromCharCode(n[o]);return window.btoa(r.join(""))}function wA(e){return ArrayBuffer.isView(e)?e.buffer:e}function qn(e){return e?e.charAt(0).toUpperCase()+e.substring(1):""}function z0(e){return e.length>0&&e.startsWith(e[0].toUpperCase())}function Xs(e,t){const n=e+".";if(t.startsWith(n))return t.slice(n.length)}function xU(e,t){return e.coding?.find(n=>n.system===t)?.code}function bU(e){if(e!==void 0)return Array.isArray(e)?e:[e]}const iT=e=>new Promise(t=>{setTimeout(t,e)});function wx(e,t,n){const r=[];for(let o=0;o<n-1;o++){const s=e.indexOf(t);if(s<0)break;r.push(e.slice(0,s)),e=e.slice(s+t.length)}return r.push(e),r}function SU(e){let t,n=!1;return function(){return n||(t=e(),n=!0),t}}function Ju(e,t){return e?(e.push(t),e):[t]}function $c(e){return e.sort((t,n)=>t.localeCompare(n))}function $0(e){return e.endsWith("/")?e:e+"/"}function wU(e){return e.startsWith("/")?e.slice(1):e}function mo(e,t){return new URL(wU(t),$0(e.toString())).toString()}function jU(e,t){return mo(e,t).toString().replace("http://","ws://").replace("https://","wss://")}function CU(e){return typeof e=="object"&&!Array.isArray(e)&&!(e instanceof URLSearchParams)&&(e=Object.fromEntries(Object.entries(e).filter(t=>t[1]!==void 0))),new URLSearchParams(e).toString()}function jA(e,t){return e?.meta?.profile?.includes(t)||(e.meta=e.meta??{},e.meta.profile=e.meta.profile??[],e.meta.profile.push(t)),e}function EU(e,t){if(e?.meta?.profile?.includes(t)){const n=e.meta.profile.indexOf(t);e.meta.profile.splice(n,1)}return e}function ll(e){if(!e)return"";switch(e.type){case"Address":return CA(e.value);case"CodeableConcept":return ds(e.value);case"Coding":return Kd(e.value);case"ContactPoint":return e.value.value;case"HumanName":return nu(e.value);case"Quantity":return Js(e.value);case"Reference":return TU(e.value);default:return e.value?.toString()??""}}function TU(e){return e?e.display??e.reference??no(e):""}function CA(e,t){if(!e)return"";const n=[];if(e.line&&n.push(...e.line),e.city||e.state||e.postalCode){const r=[];e.city&&r.push(e.city),e.state&&r.push(e.state),e.postalCode&&r.push(e.postalCode),n.push(r.join(", "))}return e.use&&t?.use,n.join(", ").trim()}function nu(e,t){if(!e)return"";const n=[];if(e.prefix&&t?.prefix!==!1&&n.push(...e.prefix),e.given&&n.push(...e.given),e.family&&n.push(e.family),e.suffix&&t?.suffix!==!1&&n.push(...e.suffix),e.use&&(t?.all||t?.use)&&n.push("["+e.use+"]"),n.length===0){const r=jd(e.text);if(r)return r}return n.join(" ").trim()}function Rm(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function RU(e,t,n){if(!e)return"";const r=new Date("2000-01-01T"+e+"Z");return Rm(r)?r.toLocaleTimeString(t,n):""}function Sr(e,t,n){if(!e)return"";const r=new Date(e);return Rm(r)?r.toLocaleString(t,n):""}function _U(e,t,n){return!e||!e.start&&!e.end?"":Sr(e.start,t,n)+" - "+Sr(e.end,t,n)}const DU={s:"every second",min:"every minute",h:"hourly",d:"daily",wk:"weekly",mo:"monthly",a:"annually"},AU={s:"second",min:"minute",h:"hour",d:"day",wk:"week",mo:"month",a:"year"},kU={s:"seconds",min:"minutes",h:"hours",d:"days",wk:"weeks",mo:"months",a:"years"};function EA(e){if(!e)return"";const t=[];return PU(t,e.repeat),e.event&&t.push(e.event.map(n=>Sr(n)).join(", ")),qn(t.join(" ").trim())}function PU(e,t){if(!t?.periodUnit)return;const n=t.frequency??1,r=t.period??1,o=t.periodUnit;n===1&&r===1?e.push(DU[o]):(n===1?e.push("once"):e.push(n+" times"),r===1?e.push("per "+AU[o]):e.push("per "+r+" "+kU[o])),t.dayOfWeek&&e.push("on "+t.dayOfWeek.map(qn).join(", ")),t.timeOfDay&&e.push("at "+t.timeOfDay.map(s=>RU(s)).join(", "))}function wd(e,t,n=!1){if(n&&t===void 0)throw new Error("Precision must be specified for exclusive ranges");const r=e?.low&&{...e.low,comparator:void 0},o=e?.high&&{...e.high,comparator:void 0};return r?.value===void 0&&o?.value===void 0?"":r?.value!==void 0&&o?.value===void 0?`>= ${Js(r)}`:r?.value===void 0&&o?.value!==void 0?`<= ${Js(o)}`:(r?.unit===o?.unit&&delete r?.unit,`${Js(r)} - ${Js(o)}`)}function Js(e,t){if(!e)return"";const n=[];return e.comparator&&(n.push(e.comparator),n.push(" ")),e.value!==void 0&&n.push(e.value),e.unit&&(e.unit!=="%"&&n.at(-1)!==" "&&n.push(" "),n.push(e.unit)),n.join("").trim()}function NU(e){return e?.value===void 0?"":e.value.toLocaleString(void 0,{style:"currency",currency:e.currency??"USD",currencyDisplay:"narrowSymbol"})}function ds(e){if(!e)return"";const t=jd(e.text);return t||(e.coding?e.coding.map(n=>Kd(n)).join(", "):"")}function Kd(e,t){const n=jd(e?.display);return n?`${n}`:jd(e?.code)??""}function TA(e){if(!e)return"";const t=[];if(e.valueQuantity)t.push(Js(e.valueQuantity));else if(e.valueCodeableConcept)t.push(ds(e.valueCodeableConcept));else{const n=jd(e.valueString);n&&t.push(n)}return"component"in e&&t.push(e.component.map(n=>TA(n)).join(" / ")),t.join(" / ").trim()}function jd(e){return typeof e=="string"?e:void 0}const ne={Address:"Address",Age:"Age",Annotation:"Annotation",Attachment:"Attachment",BackboneElement:"BackboneElement",CodeableConcept:"CodeableConcept",Coding:"Coding",ContactDetail:"ContactDetail",ContactPoint:"ContactPoint",Contributor:"Contributor",Count:"Count",DataRequirement:"DataRequirement",Distance:"Distance",Dosage:"Dosage",Duration:"Duration",Element:"Element",ElementDefinition:"ElementDefinition",Expression:"Expression",Extension:"Extension",HumanName:"HumanName",Identifier:"Identifier",MarketingStatus:"MarketingStatus",Meta:"Meta",Money:"Money",MoneyQuantity:"MoneyQuantity",Narrative:"Narrative",ParameterDefinition:"ParameterDefinition",Period:"Period",Population:"Population",ProdCharacteristic:"ProdCharacteristic",ProductShelfLife:"ProductShelfLife",Quantity:"Quantity",Range:"Range",Ratio:"Ratio",Reference:"Reference",RelatedArtifact:"RelatedArtifact",SampledData:"SampledData",Signature:"Signature",SimpleQuantity:"SimpleQuantity",SubstanceAmount:"SubstanceAmount",SystemString:"http://hl7.org/fhirpath/System.String",Timing:"Timing",TriggerDefinition:"TriggerDefinition",UsageContext:"UsageContext",base64Binary:"base64Binary",boolean:"boolean",canonical:"canonical",code:"code",date:"date",dateTime:"dateTime",decimal:"decimal",id:"id",instant:"instant",integer:"integer",markdown:"markdown",oid:"oid",positiveInt:"positiveInt",string:"string",time:"time",unsignedInt:"unsignedInt",uri:"uri",url:"url",uuid:"uuid",xhtml:"xhtml"};function OU(e){const t=Array.isArray(e)?e:e.entry?.map(n=>n.resource)??[];for(const n of t)n?.resourceType==="StructureDefinition"&&n.kind==="resource"&&RA(n.type)}function RA(e){let t=Do.types[e];return t||(t={searchParamsDetails:{}},Do.types[e]=t),!t.searchParams&&e!=="Binary"&&(t.searchParams={_id:{base:[e],code:"_id",type:"token",expression:e+".id"},_lastUpdated:{base:[e],code:"_lastUpdated",type:"date",expression:e+".meta.lastUpdated"},_compartment:{base:[e],code:"_compartment",type:"reference",expression:e+".meta.compartment"},_profile:{base:[e],code:"_profile",type:"uri",expression:e+".meta.profile"},_security:{base:[e],code:"_security",type:"token",expression:e+".meta.security"},_source:{base:[e],code:"_source",type:"uri",expression:e+".meta.source"},_tag:{base:[e],code:"_tag",type:"token",expression:e+".meta.tag"}}),t}function MU(e){for(const t of e.base??[]){const n=RA(t);n.searchParams||(n.searchParams={}),n.searchParams[e.code]=e}}function oT(e){const t=e.type?.[0]?.code;return t==="BackboneElement"||t==="Element"?LU((e.base?.path??e.path)?.split(".")):t}function LU(e){return e.length===1?e[0]:e.map(qn).join("")}function U0(e){return Do.types[e]?.searchParams}function IU(e,t){return Do.types[e]?.searchParams?.[t]}function cl(e){const t=e.replaceAll("[x]","").split(".").pop();return _A(t)}function _A(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($U).join(" ").replace("_"," ").replaceAll(/\s+/g," ")}const zU=new Set(["ID","IP","PKCE","JWKS","URI","URL","OMB","UDI"]);function $U(e){const t=e.toUpperCase();return e===t?e:zU.has(t)?t:t.charAt(0)+e.slice(1)}function xs(e,t,n){const r=Em(e,n);if(r)return UU(r.elements,t)}function UU(e,t){const n=e[t]??e[t+"[x]"];if(n)return n;for(let r=0;r<t.length;r++){const o=t[r];if(o>="A"&&o<="Z"){const s=t.slice(0,r)+"[x]",c=e[s];if(c)return c}}}function Io(e,t){return!(!e||typeof e!="object"||!("resourceType"in e)||t&&e.resourceType!==t)}function Ta(e,t){return!!(e&&typeof e=="object"&&"reference"in e&&typeof e.reference=="string")}const Do={types:{}};function Yh(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 sa=()=>[],Gr={empty:(e,t)=>Je(t.every(n=>wn(n.value))),hasValue:(e,t)=>Je(t.length!==0),exists:(e,t,n)=>Je(n?t.some(r=>bo(n.eval(e,[r]))):t.length>0&&t.every(r=>!wn(r.value))),all:(e,t,n)=>Je(t.every(r=>bo(n.eval(e,[r])))),allTrue:(e,t)=>{for(const n of t)if(!n.value)return Je(!1);return Je(!0)},anyTrue:(e,t)=>{for(const n of t)if(n.value)return Je(!0);return Je(!1)},allFalse:(e,t)=>{for(const n of t)if(n.value)return Je(!1);return Je(!0)},anyFalse:(e,t)=>{for(const n of t)if(!n.value)return Je(!0);return Je(!1)},subsetOf:(e,t,n)=>{if(t.length===0)return Je(!0);const r=n.eval(e,Bs(e));return r.length===0?Je(!1):Je(t.every(o=>r.some(s=>s.value===o.value)))},supersetOf:(e,t,n)=>{const r=n.eval(e,Bs(e));return r.length===0?Je(!0):t.length===0?Je(!1):Je(r.every(o=>t.some(s=>s.value===o.value)))},count:(e,t)=>[{type:ne.integer,value:t.length}],distinct:(e,t)=>{const n=[];for(const r of t)n.some(o=>o.value===r.value)||n.push(r);return n},isDistinct:(e,t)=>Je(t.length===Gr.distinct(e,t).length),where:(e,t,n)=>t.filter(r=>bo(n.eval(e,[r]))),select:(e,t,n)=>t.flatMap(r=>n.eval({parent:e,variables:{$this:r}},[r])),repeat:sa,ofType:(e,t,n)=>t.filter(r=>r.type===n.name),single:(e,t)=>{if(t.length>1)throw new Error("Expected input length one for single()");return t.length===0?[]:t.slice(0,1)},first:(e,t)=>t.length===0?[]:t.slice(0,1),last:(e,t)=>t.length===0?[]:t.slice(-1,t.length),tail:(e,t)=>t.length===0?[]:t.slice(1,t.length),skip:(e,t,n)=>{const r=n.eval(e,t)[0]?.value;if(typeof r!="number")throw new TypeError("Expected a number for skip(num)");return r>=t.length?[]:r<=0?t:t.slice(r,t.length)},take:(e,t,n)=>{const r=n.eval(e,t)[0]?.value;if(typeof r!="number")throw new TypeError("Expected a number for take(num)");return r>=t.length?t:r<=0?[]:t.slice(0,r)},intersect:(e,t,n)=>{if(!n)return t;const r=n.eval(e,Bs(e)),o=[];for(const s of t)!o.some(c=>c.value===s.value)&&r.some(c=>c.value===s.value)&&o.push(s);return o},exclude:(e,t,n)=>{if(!n)return t;const r=n.eval(e,Bs(e)),o=[];for(const s of t)r.some(c=>c.value===s.value)||o.push(s);return o},union:(e,t,n)=>{if(!n)return t;const r=n.eval(e,Bs(e));return cA([...t,...r])},combine:(e,t,n)=>{if(!n)return t;const r=n.eval(e,Bs(e));return[...t,...r]},htmlChecks:(e,t,n)=>[di(!0)],iif:(e,t,n,r,o)=>{const s=n.eval(e,t);if(s.length>1||s.length===1&&typeof s[0].value!="boolean")throw new Error("Expected criterion to evaluate to a Boolean");return bo(s)?r.eval(e,t):o?o.eval(e,t):[]},toBoolean:(e,t)=>{if(t.length===0)return[];const[{value:n}]=go(t,1);if(typeof n=="boolean")return[{type:ne.boolean,value:n}];if(typeof n=="number"&&(n===0||n===1))return Je(!!n);if(typeof n=="string"){const r=n.toLowerCase();if(["true","t","yes","y","1","1.0"].includes(r))return Je(!0);if(["false","f","no","n","0","0.0"].includes(r))return Je(!1)}return[]},convertsToBoolean:(e,t)=>t.length===0?[]:Je(Gr.toBoolean(e,t).length===1),toInteger:(e,t)=>{if(t.length===0)return[];const[{value:n}]=go(t,1);return typeof n=="number"?[{type:ne.integer,value:n}]:typeof n=="string"&&/^[+-]?\d+$/.exec(n)?[{type:ne.integer,value:Number.parseInt(n,10)}]:typeof n=="boolean"?[{type:ne.integer,value:n?1:0}]:[]},convertsToInteger:(e,t)=>t.length===0?[]:Je(Gr.toInteger(e,t).length===1),toDate:(e,t)=>{if(t.length===0)return[];const[{value:n}]=go(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:ne.date,value:Yh(n)}]:[]},convertsToDate:(e,t)=>t.length===0?[]:Je(Gr.toDate(e,t).length===1),toDateTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=go(t,1);return typeof n=="string"&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:ne.dateTime,value:Yh(n)}]:[]},convertsToDateTime:(e,t)=>t.length===0?[]:Je(Gr.toDateTime(e,t).length===1),toDecimal:(e,t)=>{if(t.length===0)return[];const[{value:n}]=go(t,1);return typeof n=="number"?[{type:ne.decimal,value:n}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?$/.exec(n)?[{type:ne.decimal,value:Number.parseFloat(n)}]:typeof n=="boolean"?[{type:ne.decimal,value:n?1:0}]:[]},convertsToDecimal:(e,t)=>t.length===0?[]:Je(Gr.toDecimal(e,t).length===1),toQuantity:(e,t)=>{if(t.length===0)return[];const[{value:n}]=go(t,1);return Ai(n)?[{type:ne.Quantity,value:n}]:typeof n=="number"?[{type:ne.Quantity,value:{value:n,unit:"1"}}]:typeof n=="string"&&/^-?\d{1,9}(\.\d{1,9})?/.exec(n)?[{type:ne.Quantity,value:{value:Number.parseFloat(n),unit:"1"}}]:typeof n=="boolean"?[{type:ne.Quantity,value:{value:n?1:0,unit:"1"}}]:[]},convertsToQuantity:(e,t)=>t.length===0?[]:Je(Gr.toQuantity(e,t).length===1),toString:(e,t)=>{if(t.length===0)return[];const[{value:n}]=go(t,1);return n==null?[]:Ai(n)?[{type:ne.string,value:`${n.value} '${n.unit}'`}]:[{type:ne.string,value:n.toString()}]},convertsToString:(e,t)=>t.length===0?[]:Je(Gr.toString(e,t).length===1),toTime:(e,t)=>{if(t.length===0)return[];const[{value:n}]=go(t,1);if(typeof n=="string"){const r=/^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(n);if(r)return[{type:ne.time,value:Yh("T"+r[1])}]}return[]},convertsToTime:(e,t)=>t.length===0?[]:Je(Gr.toTime(e,t).length===1),indexOf:(e,t,n)=>Ei((r,o)=>r.indexOf(o),e,t,n),substring:(e,t,n,r)=>Ei((o,s,c)=>{const d=s,f=c?d+c:o.length;return d<0||d>=o.length?void 0:o.substring(d,f)},e,t,n,r),startsWith:(e,t,n)=>Ei((r,o)=>r.startsWith(o),e,t,n),endsWith:(e,t,n)=>Ei((r,o)=>r.endsWith(o),e,t,n),contains:(e,t,n)=>Ei((r,o)=>r.includes(o),e,t,n),upper:(e,t)=>Ei(n=>n.toUpperCase(),e,t),lower:(e,t)=>Ei(n=>n.toLowerCase(),e,t),replace:(e,t,n,r)=>Ei((o,s,c)=>o.replaceAll(s,c),e,t,n,r),matches:(e,t,n)=>Ei((r,o)=>!!new RegExp(o).exec(r),e,t,n),replaceMatches:(e,t,n,r)=>Ei((o,s,c)=>o.replaceAll(new RegExp(s,"g"),c.replaceAll(/\$\{(\w+)\}/g,"$<$1>")),e,t,n,r),length:(e,t)=>Ei(n=>n.length,e,t),toChars:(e,t)=>Ei(n=>n?n.split(""):void 0,e,t),encode:sa,decode:sa,escape:sa,unescape:sa,trim:sa,split:sa,join:(e,t,n)=>{const r=n?.eval(e,Bs(e))[0]?.value??"";if(typeof r!="string")throw new TypeError("Separator must be a string.");return[{type:ne.string,value:t.map(o=>o.value?.toString()??"").join(r)}]},abs:(e,t)=>ho(Math.abs,e,t),ceiling:(e,t)=>ho(Math.ceil,e,t),exp:(e,t)=>ho(Math.exp,e,t),floor:(e,t)=>ho(Math.floor,e,t),ln:(e,t)=>ho(Math.log,e,t),log:(e,t,n)=>ho((r,o)=>Math.log(r)/Math.log(o),e,t,n),power:(e,t,n)=>ho(Math.pow,e,t,n),round:(e,t,...n)=>ho((r,o=0)=>{if(typeof o!="number"||o<0)throw new Error("Invalid precision provided to round()");const s=Math.pow(10,o);return Math.round(r*s)/s},e,t,...n),sqrt:(e,t)=>ho(Math.sqrt,e,t),truncate:(e,t)=>ho(n=>Math.trunc(n),e,t),children:sa,descendants:sa,trace:(e,t,n)=>t,now:()=>[{type:ne.dateTime,value:new Date().toISOString()}],timeOfDay:()=>[{type:ne.time,value:new Date().toISOString().substring(11)}],today:()=>[{type:ne.date,value:new Date().toISOString().substring(0,10)}],between:(e,t,n,r,o)=>{const s=Gr.toDateTime(e,n.eval(e,t));if(s.length===0)throw new Error("Invalid start date");const c=Gr.toDateTime(e,r.eval(e,t));if(c.length===0)throw new Error("Invalid end date");const d=o.eval(e,t)[0]?.value;if(d!=="years"&&d!=="months"&&d!=="days")throw new Error("Invalid units");const f=vA(s[0].value,c[0].value);return[{type:ne.Quantity,value:{value:f[d],unit:d}}]},is:(e,t,n)=>{let r="";return n instanceof mp?r=n.name:n instanceof B0&&(r=n.left.name+"."+n.right.name),r?t.map(o=>({type:ne.boolean,value:dA(o,r)})):[]},not:(e,t)=>Gr.toBoolean(e,t).map(n=>({type:ne.boolean,value:!n.value})),resolve:(e,t)=>t.map(n=>{const r=n.value;let o;if(typeof r=="string")o=r;else if(typeof r=="object"){const s=r;if(s.resource)return di(s.resource);s.reference?o=s.reference:s.type&&s.identifier&&(o=`${s.type}?identifier=${s.identifier.system}|${s.identifier.value}`)}if(o?.includes("?")){const[s]=o.split("?");return{type:s,value:{resourceType:s}}}if(o?.includes("/")){const[s,c]=o.split("/");return{type:s,value:{resourceType:s,id:c}}}return{type:ne.BackboneElement,value:void 0}}).filter(n=>!!n.value),as:(e,t)=>t,type:(e,t)=>t.map(({value:n})=>typeof n=="boolean"?{type:ne.BackboneElement,value:{namespace:"System",name:"Boolean"}}:typeof n=="number"?{type:ne.BackboneElement,value:{namespace:"System",name:"Integer"}}:Io(n)?{type:ne.BackboneElement,value:{namespace:"FHIR",name:n.resourceType}}:{type:ne.BackboneElement,value:null}),conformsTo:(e,t,n)=>{const r=n.eval(e,t)[0].value;if(!r.startsWith("http://hl7.org/fhir/StructureDefinition/"))throw new Error("Expected a StructureDefinition URL");const o=r.replace("http://hl7.org/fhir/StructureDefinition/","");return t.map(s=>({type:ne.boolean,value:s.value?.resourceType===o}))},getResourceKey:(e,t)=>{const n=t[0].value;return n?.id?[{type:ne.id,value:n.id}]:[]},getReferenceKey:(e,t,n)=>{const r=t[0].value;if(!r?.reference)return[];let o="";return n instanceof mp&&(o=n.name),o&&!r.reference.startsWith(o+"/")?[]:[{type:ne.id,value:sl(r)}]},extension:(e,t,n)=>{const r=n.eval(e,t)[0].value,o=t?.[0]?.value;if(o){const s=Lo(o,r);if(s)return[{type:ne.Extension,value:s}]}return[]}};function Ei(e,t,n,...r){if(n.length===0)return[];const[{value:o}]=go(n,1);if(typeof o!="string")throw new TypeError("String function cannot be called with non-string");const s=r.map(d=>d?.eval(t,n)[0]?.value),c=e(o,...s);return c===void 0?[]:Array.isArray(c)?c.map(di):[di(c)]}function ho(e,t,n,...r){if(n.length===0)return[];const[{value:o}]=go(n,1),s=Ai(o),c=s?o.value:o;if(typeof c!="number")throw new TypeError("Math function cannot be called with non-number");const d=e(c,...r.map(m=>m.eval(t,n)[0]?.value)),f=s?ne.Quantity:n[0].type,p=s?{...o,value:d}:d;return[{type:f,value:p}]}function go(e,t){if(e.length!==t)throw new Error(`Expected ${t} arguments`);for(const n of e)if(n==null)throw new Error("Expected non-null argument");return e}function Bs(e){let t=e;for(;t.parent?.variables.$this;)t=t.parent;return[t.variables.$this]}class DA{original;child;constructor(t,n){this.original=t,this.child=n}eval(t,n){try{if(n.length>0){const r=[];for(const o of n)r.push(this.child.eval({parent:t,variables:{$this:o}},[o]));return r.flat()}else return this.child.eval(t,[])}catch(r){throw new Error(`FhirPathError on "${this.original}": ${r}`,{cause:r})}}toString(){return this.child.toString()}}class vc{value;constructor(t){this.value=t}eval(){return[this.value]}toString(){const t=this.value.value;return typeof t=="string"?`'${t}'`:t.toString()}}class mp{name;constructor(t){this.name=t}eval(t,n){if(this.name==="$this")return n;const r=this.getVariable(t);if(r)return[r];if(this.name.startsWith("%"))throw new Error(`Undefined variable ${this.name}`);return n.flatMap(o=>this.evalValue(o)).filter(o=>o?.value!==void 0)}getVariable(t){const n=t.variables[this.name];if(n!==void 0)return n;if(t.parent)return this.getVariable(t.parent)}evalValue(t){const n=t.value;if(!(!n||typeof n!="object"))return Io(n,this.name)?t:aA(t,this.name)}toString(){return this.name}}class BU{eval(){return[]}toString(){return"{}"}}class VU extends b8{impl;constructor(t,n,r){super(t,n),this.impl=r}eval(t,n){return this.impl(this.child.eval(t,n))}toString(){return this.operator+this.child.toString()}}class gp extends Wd{constructor(t,n){super("as",t,n)}eval(t,n){return Gr.ofType(t,this.left.eval(t,n),this.right)}}class Xr extends Wd{}class Gi extends Xr{impl;constructor(t,n,r,o){super(t,n,r),this.impl=o}eval(t,n){const r=this.left.eval(t,n);if(r.length!==1)return[];const o=this.right.eval(t,n);if(o.length!==1)return[];const s=r[0].value,c=o[0].value,d=Ai(s)?s.value:s,f=Ai(c)?c.value:c,p=this.impl(d,f);return typeof p=="boolean"?Je(p):Ai(s)?[{type:ne.Quantity,value:{...s,value:p}}]:[di(p)]}}class FU extends Wd{constructor(t,n){super("&",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n),s=[...r,...o];return s.length>0&&s.every(c=>typeof c.value=="string")?[{type:ne.string,value:s.map(c=>c.value).join("")}]:s}}class HU extends Xr{constructor(t,n){super("contains",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return Je(r.some(s=>s.value===o[0].value))}}class qU extends Xr{constructor(t,n){super("in",t,n)}eval(t,n){const r=va(this.left.eval(t,n)),o=this.right.eval(t,n);return r?Je(o.some(s=>Tm(r,s)[0].value)):[]}}class B0 extends Wd{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 V0 extends Wd{constructor(t,n){super("|",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return cA([...r,...o])}}class GU extends Xr{constructor(t,n){super("=",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return Z$(r,o)}}class WU extends Xr{constructor(t,n){super("!=",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return eU(r,o)}}class QU extends Xr{constructor(t,n){super("~",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return uA(r,o)}}class YU extends Xr{constructor(t,n){super("!~",t,n)}eval(t,n){const r=this.left.eval(t,n),o=this.right.eval(t,n);return J$(uA(r,o))}}class F0 extends Xr{constructor(t,n){super("is",t,n)}eval(t,n){const r=this.left.eval(t,n);if(r.length!==1)return[];const o=this.right.name;return Je(dA(r[0],o))}}class KU extends Xr{constructor(t,n){super("and",t,n)}eval(t,n){const r=va(this.left.eval(t,n),"boolean"),o=va(this.right.eval(t,n),"boolean");return r?.value===!0&&o?.value===!0?Je(!0):r?.value===!1||o?.value===!1?Je(!1):[]}}class XU extends Xr{constructor(t,n){super("or",t,n)}eval(t,n){const r=va(this.left.eval(t,n),"boolean"),o=va(this.right.eval(t,n),"boolean");return r?.value===!1&&o?.value===!1?Je(!1):r?.value||o?.value?Je(!0):[]}}class JU extends Xr{constructor(t,n){super("xor",t,n)}eval(t,n){const r=va(this.left.eval(t,n),"boolean"),o=va(this.right.eval(t,n),"boolean");return!r||!o?[]:Je(r.value!==o.value)}}class ZU extends Xr{constructor(t,n){super("implies",t,n)}eval(t,n){const r=va(this.left.eval(t,n),"boolean"),o=va(this.right.eval(t,n),"boolean");return o?.value===!0||r?.value===!1?Je(!0):!r||!o?[]:Je(!1)}}class H0{name;args;constructor(t,n){this.name=t,this.args=n}eval(t,n){const r=Gr[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 q0{left;expr;constructor(t,n){this.left=t,this.expr=n}eval(t,n){const r=this.expr.eval(t,n);if(r.length!==1)return[];const o=r[0].value;if(typeof o!="number")throw new Error("Invalid indexer expression: should return integer}");const s=this.left.eval(t,n);return o in s?[s[o]]:[]}toString(){return`${this.left.toString()}[${this.expr.toString()}]`}}const eB=["year","years","month","months","week","weeks","day","days","hour","hours","minute","minutes","second","seconds","millisecond","milliseconds"],tB={"'":"'",'"':'"',"`":"`",r:"\r",n:`
57
- `,t:" ",f:"\f","\\":"\\"};class nB{str;keywords;operators;dateTimeLiterals;symbolRegex;result=[];pos={index:0,line:1,column:0};markStack=[];constructor(t,n,r,o){this.str=t,this.keywords=n,this.operators=r,this.dateTimeLiterals=!!o?.dateTimeLiterals,this.symbolRegex=o?.symbolRegex??/[$\w%]/}tokenize(){for(;this.pos.index<this.str.length;){const t=this.consumeToken();t&&this.result.push(t)}return this.result}prevToken(){return this.result.slice(-1)[0]}peekToken(){this.mark();const t=this.consumeToken();return this.reset(),t}consumeToken(){this.consumeWhitespace();const t=this.curr();if(!t)return;this.mark();const n=this.peek();return t==="/"&&n==="*"?this.consumeMultiLineComment():t==="/"&&n==="/"?this.consumeSingleLineComment():t==="'"||t==='"'||t==="`"?this.consumeString(t):t==="@"?this.consumeDateTime():/\d/.exec(t)?this.consumeNumber():/\w/.exec(t)?this.consumeSymbol():(t==="$"||t==="%")&&/\w/.exec(n)?this.consumeSymbol():(t==="$"||t==="%")&&(n==="'"||n==='"'||n==="`")?this.consumeQuotedSymbol(n):this.consumeOperator()}consumeWhitespace(){this.consumeWhile(()=>/\s/.exec(this.curr()))}consumeMultiLineComment(){const t=this.pos.index;return this.consumeWhile(()=>this.curr()!=="*"||this.peek()!=="/"),this.advance(),this.advance(),this.buildToken("Comment",this.str.substring(t,this.pos.index))}consumeSingleLineComment(){return this.buildToken("Comment",this.consumeWhile(()=>this.curr()!==`
58
- `))}consumeString(t){this.advance();let n="",r;for(;r=this.consumeChar(t);)n+=r;const o=this.buildToken(t==="`"?"Symbol":"String",n);return this.advance(),o}consumeChar(t){const n=this.curr();if(n==="\\"){this.advance();const r=this.curr(),o=tB[r];if(o!==void 0)return this.advance(),o;if(r==="u"){this.advance();const s=/^[0-9a-fA-F]{4}$/.exec(this.str.substring(this.pos.index,this.pos.index+4))?.[0];return s?(this.advance(),this.advance(),this.advance(),this.advance(),String.fromCodePoint(Number.parseInt(s,16))):"u"}return this.consumeChar(t)}return n===t||!n?"":(this.advance(),n)}consumeQuotedSymbol(t){this.mark();const n=this.pos.index;this.advance(),this.consumeString(t);const r=this.str.substring(n,this.pos.index);return this.buildToken("Symbol",r)}consumeDateTime(){this.advance();const t=this.pos.index;this.consumeWhile(()=>/[\d-]/.exec(this.curr()));let n=!1,r=!1;if(this.curr()==="T"&&(n=!0,this.advance(),this.consumeWhile(()=>/[\d:]/.exec(this.curr())),this.curr()==="."&&/\d/.exec(this.peek())&&(this.advance(),this.consumeWhile(()=>/\d/.exec(this.curr()))),this.curr()==="Z"?(r=!0,this.advance()):(this.curr()==="+"||this.curr()==="-")&&(r=!0,this.advance(),this.consumeWhile(()=>/[\d:]/.exec(this.curr())))),this.pos.index===t)throw new Error("Invalid DateTime literal");let o=this.str.substring(t,this.pos.index);return o.endsWith("T")?o=o.substring(0,o.length-1):!o.startsWith("T")&&n&&!r&&(o+="Z"),this.buildToken("DateTime",o)}consumeNumber(){const t=this.pos.index;let n="Number";return this.consumeWhile(()=>/\d/.exec(this.curr())),this.curr()==="."&&/\d/.exec(this.peek())&&(this.advance(),this.consumeWhile(()=>/\d/.exec(this.curr()))),this.curr()==="-"&&this.dateTimeLiterals?(this.pos.index=t-1,this.consumeDateTime()):(this.curr()===" "&&rB(this.peekToken())&&(n="Quantity",this.consumeToken()),this.buildToken(n,this.str.substring(t,this.pos.index)))}consumeSymbol(){const t=this.consumeWhile(()=>this.symbolRegex.exec(this.curr()));return this.prevToken()?.value!=="."&&this.keywords.includes(t)?this.buildToken(t,t):this.buildToken("Symbol",t)}consumeOperator(){const t=this.curr(),n=this.peek(),r=t+n;return this.operators.includes(r)?(this.advance(),this.advance(),this.buildToken(r,r)):(this.advance(),this.buildToken(t,t))}consumeWhile(t){const n=this.pos.index;for(;this.pos.index<this.str.length&&t();)this.advance();return this.str.substring(n,this.pos.index)}curr(){return this.str[this.pos.index]}peek(){return this.str[this.pos.index+1]??""}mark(){this.markStack.push({...this.pos})}reset(){const t=this.markStack.pop();if(!t)throw new Error("No mark to reset to");this.pos.index=t.index,this.pos.line=t.line,this.pos.column=t.column}advance(){this.pos.index++,this.curr()===`
59
- `?(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 rB(e){return!!(e&&(e.id==="String"||e.id==="Symbol"&&eB.includes(e.value)))}const iB=["true","false"],oB=["!=","!~","<=",">=","{}","->"];function aB(e){return new nB(e,iB,oB).tokenize()}const en={FunctionCall:0,Dot:1,Indexer:2,UnaryAdd:3,UnarySubtract:3,Multiply:4,Divide:4,Modulo:4,Add:5,Subtract:5,Ampersand:5,Is:6,As:6,Union:7,GreaterThan:8,GreaterThanOrEquals:8,LessThan:8,LessThanOrEquals:8,Equals:9,Equivalent:9,NotEquals:9,NotEquivalent:9,In:10,Contains:10,And:11,Xor:12,Or:12,Implies:13},sB={parse(e){const t=e.consumeAndParse();if(!e.match(")"))throw new Error("Parse error: expected `)` got `"+e.peek()?.value+"`");return t}},lB={parse(e,t){const n=e.consumeAndParse();if(!e.match("]"))throw new Error("Parse error: expected `]`");return new q0(t,n)},precedence:en.Indexer},cB={parse(e,t){if(!(t instanceof mp))throw new Error("Unexpected parentheses");const n=[];for(;!e.match(")");)n.push(e.consumeAndParse()),e.match(",");return new H0(t.name,n)},precedence:en.FunctionCall};function uB(e){const t=e.split(" "),n=Number.parseFloat(t[0]);let r=t[1];return r?.startsWith("'")&&r.endsWith("'")?r=r.substring(1,r.length-1):r="{"+r+"}",{value:n,unit:r}}function dB(){return new S8().registerPrefix("String",{parse:(e,t)=>new vc({type:ne.string,value:t.value})}).registerPrefix("DateTime",{parse:(e,t)=>new vc({type:ne.dateTime,value:Yh(t.value)})}).registerPrefix("Quantity",{parse:(e,t)=>new vc({type:ne.Quantity,value:uB(t.value)})}).registerPrefix("Number",{parse:(e,t)=>new vc({type:t.value.includes(".")?ne.decimal:ne.integer,value:Number.parseFloat(t.value)})}).registerPrefix("true",{parse:()=>new vc({type:ne.boolean,value:!0})}).registerPrefix("false",{parse:()=>new vc({type:ne.boolean,value:!1})}).registerPrefix("Symbol",{parse:(e,t)=>new mp(t.value)}).registerPrefix("{}",{parse:()=>new BU}).registerPrefix("(",sB).registerInfix("[",lB).registerInfix("(",cB).prefix("+",en.UnaryAdd,(e,t)=>new VU("+",t,n=>n)).prefix("-",en.UnarySubtract,(e,t)=>new Gi("-",t,t,(n,r)=>-r)).infixLeft(".",en.Dot,(e,t,n)=>new B0(e,n)).infixLeft("/",en.Divide,(e,t,n)=>new Gi("/",e,n,(r,o)=>r/o)).infixLeft("*",en.Multiply,(e,t,n)=>new Gi("*",e,n,(r,o)=>r*o)).infixLeft("+",en.Add,(e,t,n)=>new Gi("+",e,n,(r,o)=>r+o)).infixLeft("-",en.Subtract,(e,t,n)=>new Gi("-",e,n,(r,o)=>r-o)).infixLeft("|",en.Union,(e,t,n)=>new V0(e,n)).infixLeft("=",en.Equals,(e,t,n)=>new GU(e,n)).infixLeft("!=",en.NotEquals,(e,t,n)=>new WU(e,n)).infixLeft("~",en.Equivalent,(e,t,n)=>new QU(e,n)).infixLeft("!~",en.NotEquivalent,(e,t,n)=>new YU(e,n)).infixLeft("<",en.LessThan,(e,t,n)=>new Gi("<",e,n,(r,o)=>r<o)).infixLeft("<=",en.LessThanOrEquals,(e,t,n)=>new Gi("<=",e,n,(r,o)=>r<=o)).infixLeft(">",en.GreaterThan,(e,t,n)=>new Gi(">",e,n,(r,o)=>r>o)).infixLeft(">=",en.GreaterThanOrEquals,(e,t,n)=>new Gi(">=",e,n,(r,o)=>r>=o)).infixLeft("&",en.Ampersand,(e,t,n)=>new FU(e,n)).infixLeft("and",en.And,(e,t,n)=>new KU(e,n)).infixLeft("as",en.As,(e,t,n)=>new gp(e,n)).infixLeft("contains",en.Contains,(e,t,n)=>new HU(e,n)).infixLeft("div",en.Divide,(e,t,n)=>new Gi("div",e,n,(r,o)=>Math.trunc(r/o))).infixLeft("in",en.In,(e,t,n)=>new qU(e,n)).infixLeft("is",en.Is,(e,t,n)=>new F0(e,n)).infixLeft("mod",en.Modulo,(e,t,n)=>new Gi("mod",e,n,(r,o)=>r%o)).infixLeft("or",en.Or,(e,t,n)=>new XU(e,n)).infixLeft("xor",en.Xor,(e,t,n)=>new JU(e,n)).infixLeft("implies",en.Implies,(e,t,n)=>new ZU(e,n))}const fB=dB();function G0(e){return new DA(e,fB.construct(aB(e)).consumeAndParse())}function hB(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]=di(n[r]))}return fs(e,n).map(r=>r.value)}function fs(e,t,n={},r=void 0){let o;if(typeof e=="string"){const s=r?.get(e);o=s??G0(e),r&&!s&&r.set(e,o)}else o=e;return o.eval({variables:n},t).map(s=>{const c={type:s.type,value:s.value?.valueOf()};return"path"in s&&(c.path=s.path),c})}function pB(e){const t=[];for(const n of e){const r=pA(n.value);r&&t.push(r)}return t}function mB(e){const t=new Set;for(const n of e){const r=ll(n);r&&t.add(r)}return Array.from(t)}function gB(e){const t=new Set;for(const n of e){const{value:r}=n;r&&(mU(r)?t.add(r):Ta(r)?t.add(r.reference):gA(r)?t.add(Ot(r)):typeof r.identifier=="object"&&t.add(`identifier:${r.identifier.system}|${r.identifier.value}`))}return Array.from(t)}function vB(e,t={}){const n=[];for(const r of e)yB(t,n,r);return n}function yB(e,t,n){const{type:r,value:o}=n;switch(r){case ne.Identifier:xB(t,e,o);break;case ne.CodeableConcept:bB(t,e,o);break;case ne.Coding:AA(t,e,o);break;case ne.ContactPoint:SB(t,e,o);break;default:ul(t,e,void 0,o?.toString())}}function xB(e,t,n){n?.type?.text&&ul(e,t,t.textSearchSystem,n.type.text),ul(e,t,n?.system,n?.value)}function bB(e,t,n){if(n?.text&&ul(e,t,t.textSearchSystem,n.text),n?.coding)for(const r of n.coding)AA(e,t,r)}function AA(e,t,n){n&&(n.display&&ul(e,t,t.textSearchSystem,n.display),ul(e,t,n.system,n.code))}function SB(e,t,n){n&&ul(e,t,n.system,n.value?.toLocaleLowerCase())}function ul(e,t,n,r){(n||r)&&!e.some(o=>o.system===n&&o.value===r)&&e.push({system:n,value:r&&t.caseInsensitive?r.toLocaleLowerCase():r})}const _m=20,he={EQUALS:"eq",NOT_EQUALS:"ne",GREATER_THAN:"gt",LESS_THAN:"lt",GREATER_THAN_OR_EQUALS:"ge",LESS_THAN_OR_EQUALS:"le",STARTS_AFTER:"sa",ENDS_BEFORE:"eb",APPROXIMATELY:"ap",CONTAINS:"contains",STARTS_WITH:"sw",EXACT:"exact",TEXT:"text",NOT:"not",ABOVE:"above",BELOW:"below",IN:"in",NOT_IN:"not-in",OF_TYPE:"of-type",MISSING:"missing",PRESENT:"present",IDENTIFIER:"identifier",ITERATE:"iterate"},kA={contains:he.CONTAINS,exact:he.EXACT,above:he.ABOVE,below:he.BELOW,text:he.TEXT,not:he.NOT,in:he.IN,"not-in":he.NOT_IN,"of-type":he.OF_TYPE,missing:he.MISSING,identifier:he.IDENTIFIER,iterate:he.ITERATE},W0={eq:he.EQUALS,ne:he.NOT_EQUALS,lt:he.LESS_THAN,le:he.LESS_THAN_OR_EQUALS,gt:he.GREATER_THAN,ge:he.GREATER_THAN_OR_EQUALS,sa:he.STARTS_AFTER,eb:he.ENDS_BEFORE,ap:he.APPROXIMATELY,sw:he.STARTS_WITH};function PA(e,t){if(!e)throw new Error("Invalid search URL");let n="",r;if(typeof e=="string")if(e.includes("?")){const[c,d]=e.split("?");n=c,r=new URLSearchParams(d)}else n=e;else typeof e=="object"&&(n=e.pathname,r=e.searchParams);let o;n.includes("/")?o=n.split("/").filter(Boolean).pop():o=n;const s=[];return r&&s.push(...r.entries()),wB(o,s)}function wB(e,t){const n={resourceType:e};for(const[r,o]of t)jB(n,r,o);return n}function jB(e,t,n){let r,o;const s=t.indexOf(":");if(s>=0?(r=t.substring(0,s),o=t.substring(s+1)):(r=t,o=""),r!=="_"){if(r==="_has"||t.includes(".")){e.filters=Ju(e.filters,{code:t,operator:he.EQUALS,value:n});return}switch(r){case"_sort":CB(e,n);break;case"_cursor":e.cursor=n;break;case"_count":e.count=Number.parseInt(n,10);break;case"_offset":e.offset=Number.parseInt(n,10);break;case"_total":e.total=n;break;case"_summary":n==="count"?(e.total="accurate",e.count=0):(n==="true"||n==="data"||n==="text")&&(e.summary=n);break;case"_include":{const c=aT(n);o==="iterate"&&(c.modifier=he.ITERATE),e.include=Ju(e.include,c);break}case"_revinclude":{const c=aT(n);o==="iterate"&&(c.modifier=he.ITERATE),e.revInclude=Ju(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=Do.types[e.resourceType]?.searchParams?.[r];c?e.filters=Ju(e.filters,TB(c,o,n)):e.filters=Ju(e.filters,RB(r,o,n))}}}}function CB(e,t){for(const n of t.split(",")){let r,o=!1;n.startsWith("-")?(r=n.substring(1),o=!0):r=n,e.sortRules||(e.sortRules=[]),e.sortRules.push({code:r,descending:o})}}const EB=[he.MISSING,he.PRESENT];function TB(e,t,n){if(EB.includes(t))return{code:e.code,operator:t,value:n};switch(e.type){case"number":case"date":case"quantity":{const{operator:r,value:o}=_B(n,t||he.EQUALS);if(!sT(e,o))throw new ft(jo(`Invalid format for ${e.type} search parameter: ${o}`));return{code:e.code,operator:r,value:o}}case"reference":case"string":case"token":case"uri":if(!sT(e,n))throw new ft(jo(`Invalid format for ${e.type} search parameter: ${n}`));return{code:e.code,operator:DB(t),value:n};default:throw new Error("Unrecognized search parameter type: "+e.type)}}function RB(e,t,n){let r=he.EQUALS;if(t)r=t;else if(n.length>=2){const o=n.substring(0,2);o in W0&&(n.length===2||n.at(2)?.match(/\d/))&&(r=o,n=n.substring(o.length))}return{code:e,operator:r,value:n}}function _B(e,t){const n=e.substring(0,2),r=W0[n];return r?{operator:r,value:e.substring(2)}:{operator:t,value:e}}function DB(e){return kA[e]??he.EQUALS}function aT(e){const t=e.split(":");if(t.includes("*"))throw new ft(jo("'*' is not supported as a value for search inclusion parameters"));if(t.length===1)throw new ft(jo(`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 ft(jo(`Invalid include value '${e}'`))}function sT(e,t){switch(e.type){case"date":return Sd(t);default:return!0}}function ss(e){const t=[];return e.fields&&t.push("_fields="+e.fields.join(",")),e.filters&&e.filters.forEach(n=>t.push(AB(n))),e.sortRules&&e.sortRules.length>0&&t.push(kB(e.sortRules)),e.cursor!==void 0&&t.push("_cursor="+encodeURIComponent(e.cursor)),e.offset!==void 0&&e.offset!==0&&t.push("_offset="+e.offset),e.count!==void 0&&t.push("_count="+e.count),e.total!==void 0&&t.push("_total="+e.total),e.types&&e.types.length>0&&t.push("_type="+e.types.join(",")),e.include&&e.include.forEach(n=>t.push(lT("_include",n))),e.revInclude&&e.revInclude.forEach(n=>t.push(lT("_revinclude",n))),t.length===0?"":($c(t),"?"+t.join("&"))}function AB(e){const t=e.operator in kA?":"+e.operator:"",n=e.operator!==he.EQUALS&&e.operator in W0?e.operator:"";return`${e.code}${t}=${n}${encodeURIComponent(e.value)}`}function kB(e){return"_sort="+e.map(t=>t.descending?"-"+t.code:t.code).join(",")}function lT(e,t){return e+(t.modifier?":"+t.modifier:"")+"="+t.resourceType+":"+t.searchParam+(t.targetType?":"+t.targetType:"")}function Dm(e){const t=[];let n="",r=!1;for(const o of e)r?(n+=o,r=!1):o==="\\"?r=!0:o===","?(t.push(n),n=""):n+=o;return t.push(n),t}function PB(e,t){if(t.resourceType!==e.resourceType)return!1;if(t.filters){for(const n of t.filters)if(!NB(e,t,n))return!1}return!0}function NB(e,t,n){const r=Do.types[t.resourceType]?.searchParams?.[n.code];if(!r)return!1;const o=fs(r.expression,[di(e)]);if(n.operator===he.MISSING||n.operator===he.PRESENT)return OB(o,n);switch(r.type){case"reference":return MB(o,n);case"string":case"uri":return zB(o,n);case"token":return LB(o,n);case"date":return UB(o,n);default:return!1}}function OB(e,t){const n=e.length>0;return(t.operator===he.MISSING&&t.value==="false"||t.operator===he.PRESENT&&t.value==="true")===n}function MB(e,t){const n=Am(t.operator);if(t.value===""&&e.length===0)return t.operator===he.EQUALS;const r=gB(e);for(const o of Dm(t.value)){let s=r.includes(o);if(!s&&t.code==="_compartment"&&(s=r.some(c=>c?.endsWith("/"+o))),s)return!n}return n}function LB(e,t){const n=vB(e),r=Dm(t.value),o=Am(t.operator);for(const s of n)for(const c of r)if(IB(s,c))return!o;return o}function IB(e,t){if(t.includes("|")){const[n,r]=t.split("|").map(o=>o.toLowerCase());return!n&&!r?!1:n?e.system?.toLowerCase()===n&&(!r||e.value?.toLowerCase()===r):!e.system&&e.value?.toLowerCase()===r}return e.value?.toLowerCase()===t.toLowerCase()}function zB(e,t){const n=mB(e),r=Dm(t.value),o=Am(t.operator);for(const s of n)for(const c of r)if($B(s,c))return!o;return o}function $B(e,t){return e.toLowerCase().includes(t.toLowerCase())}function UB(e,t){const n=pB(e),r=Dm(t.value),o=Am(t.operator);for(const s of n)for(const c of r)if(BB(s,t.operator,c))return!o;return o}function BB(e,t,n){if(!e)return!1;const r=pA(n);if(!r)return!1;const o=e.start??"0000",s=e.end??"9999",c=r.start,d=r.end;switch(t){case he.APPROXIMATELY:case he.EQUALS:case he.NOT_EQUALS:return o<d&&s>c;case he.LESS_THAN:return o<c;case he.GREATER_THAN:return s>d;case he.LESS_THAN_OR_EQUALS:return o<=d;case he.GREATER_THAN_OR_EQUALS:return s>=c;case he.STARTS_AFTER:return o>d;case he.ENDS_BEFORE:return s<c;default:return!1}}function Am(e){return e===he.NOT_EQUALS||e===he.NOT}const VB={resourceType:"*"},FB=["DomainConfiguration","JsonWebKey","Login"],HB=["UserSecurityRequest","Project","ProjectMembership","User"],Zs={READ:"read",VREAD:"vread",UPDATE:"update",HISTORY:"history",SEARCH:"search"},qB=[Zs.READ,Zs.VREAD,Zs.HISTORY,Zs.SEARCH];function GB(e,t){return FB.includes(t)?!1:WB(e,Zs.UPDATE,t)}function WB(e,t,n){return!!e.resource?.some(r=>OA(r,n,t))}function NA(e,t,n){return n?n.resource?.find(r=>QB(e,t,r)):VB}function QB(e,t,n){const r=e.resourceType;return OA(n,r,t)?r==="Binary"?!0:!(n.compartment&&!e.meta?.compartment?.some(o=>o.reference===n.compartment?.reference)||n.criteria&&!PB(e,PA(n.criteria))):!1}function OA(e,t,n){return e.resourceType!==t&&(e.resourceType!=="*"||HB.includes(t))?!1:e.interaction?e.interaction.includes(n):!e.readonly||qB.includes(n)}function vo(){return typeof window<"u"}function MA(){return typeof Buffer<"u"?Buffer:void 0}const rr={assign(e){vo()&&globalThis.location.assign(e)},reload(){vo()&&globalThis.location.reload()},getSearch(){return vo()?globalThis.location.search:""},getPathname(){return vo()?globalThis.location.pathname:""},getLocation(){return vo()?globalThis.location.toString():""},getOrigin(){return vo()?globalThis.location.protocol+"//"+globalThis.location.host+"/":""}};function YB(e){if(vo()){const n=window.atob(e),r=Uint8Array.from(n,o=>o.charCodeAt(0));return new window.TextDecoder().decode(r)}const t=MA();if(t)return t.from(e,"base64").toString("utf-8");throw new Error("Unable to decode base64")}function cT(e){if(vo()){const n=new window.TextEncoder().encode(e),r=String.fromCharCode.apply(null,n);return window.btoa(r)}const t=MA();if(t)return t.from(e,"utf8").toString("base64");throw new Error("Unable to encode base64")}function KB(e){e=e.padEnd(e.length+(4-e.length%4)%4,"=");const t=e.replaceAll("-","+").replaceAll("_","/");return YB(t)}function uT(){const e=new Uint32Array(28);return crypto.getRandomValues(e),vU(e.buffer)}async function XB(e){return crypto.subtle.digest("SHA-256",new TextEncoder().encode(e))}function LA(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replaceAll(/[xy]/g,e=>{const t=Math.trunc(Math.random()*16);return(e==="x"?t:t&3|8).toString(16)})}function IA(e){const t={};e=fi(e);for(const o of e.entry||[]){const s=o.resource;if(!s)continue;s.meta!==void 0&&(delete s.meta.author,delete s.meta.compartment,delete s.meta.lastUpdated,delete s.meta.project,delete s.meta.versionId,Object.keys(s.meta).length===0&&delete s.meta);const c=s?.id;c&&(t[c]=LA(),o.fullUrl="urn:uuid:"+t[c],delete o.resource?.id)}const n=e.entry,r=JSON.stringify({resourceType:"Bundle",type:"transaction",entry:n?.map(o=>({fullUrl:o.fullUrl,request:{method:"POST",url:o.resource?.resourceType},resource:o.resource}))},(o,s)=>JB(o,s,t),2);return ZB(JSON.parse(r))}function JB(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 ZB(e){const t=tV(e),{sorted:n,cycles:r}=eV(t),o={},s=[];for(const d of e.entry??[])d.fullUrl?o[d.fullUrl]=d:s.push(d);const c=n.map(d=>o[d]);for(const d of r)for(const f of d){const p=o[f],m={...p,request:{...p.request,method:"PUT"}};c.push(m)}return c.push(...s),{...e,entry:c}}const yc={NotVisited:"NotVisited",Visiting:"Visiting",Visited:"Visited"};function eV(e){const t=[],n={},r=[];for(const s of Object.keys(e))n[s]=yc.NotVisited;function o(s,c){if(n[s]===yc.Visited)return!0;if(n[s]===yc.Visiting){const f=c.lastIndexOf(s);return f!==-1&&r.push(c.slice(f)),!0}n[s]=yc.Visiting,c.push(s);let d=!1;for(const f of e[s])o(f,c)||(d=!0);return n[s]=yc.Visited,c.pop(),t.unshift(s),!d}for(const s in e)n[s]===yc.NotVisited&&o(s,[]);return{sorted:t,cycles:r}}function zA(e,t){for(const n in e)if(e[n]&&typeof e[n]=="object"){const r=e[n];if(Ta(r)){const o=r.reference;o.startsWith("urn:uuid:")&&t(o)}else zA(r,t)}}function tV(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&&zA(n.resource,o=>{t[o]&&t[o].push(r)})}return t}const on={CSS:"text/css",DICOM:"application/dicom",FAVICON:"image/vnd.microsoft.icon",FHIR_JSON:"application/fhir+json",FORM_URL_ENCODED:"application/x-www-form-urlencoded",HL7_V2:"x-application/hl7-v2+er7",HTML:"text/html",JAVASCRIPT:"text/javascript",JSON:"application/json",JSON_PATCH:"application/json-patch+json",JWT:"application/jwt",MULTIPART_FORM_DATA:"multipart/form-data",PNG:"image/png",SCIM_JSON:"application/scim+json",SVG:"image/svg+xml",TEXT:"text/plain",TYPESCRIPT:"text/typescript",PING:"x-application/ping",XML:"text/xml",CDA_XML:"application/cda+xml",OCTET_STREAM:"application/octet-stream"};let nV=class{listeners;constructor(){this.listeners={}}addEventListener(t,n){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(n)}removeEventListener(t,n){const r=this.listeners[t];if(r){for(let o=0;o<r.length;o++)if(r[o]===n){r.splice(o,1);return}}}dispatchEvent(t){const n=this.listeners[t.type];if(n)for(const r of n)r.call(this,t);return!t.defaultPrevented}removeAllListeners(){this.listeners={}}listenerCount(t){return this.listeners[t]?.length??0}};class km{emitter=new nV;dispatchEvent(t){this.emitter.dispatchEvent(t)}addEventListener(t,n){this.emitter.addEventListener(t,n)}removeEventListener(t,n){this.emitter.removeEventListener(t,n)}removeAllListeners(){this.emitter.removeAllListeners()}listenerCount(t){return this.emitter.listenerCount(t)}}const jx={"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"},rV=["Patient","Encounter","ImagingStudy","DiagnosticReport","OperationOutcome","Bundle"],Q0=["DiagnosticReport-update"];function iV(e){return Q0.includes(e)}function oV(e){if(Q0.includes(e))throw new ft(Sn(`'context.version' is required for '${e}'.`))}const aV={"Patient-open":{patient:{resourceType:"Patient"},encounter:{resourceType:"Encounter",optional:!0}},"Patient-close":{patient:{resourceType:"Patient"},encounter:{resourceType:"Encounter",optional:!0}},"ImagingStudy-open":{study:{resourceType:"ImagingStudy"},encounter:{resourceType:"Encounter",optional:!0},patient:{resourceType:"Patient",optional:!0}},"ImagingStudy-close":{study:{resourceType:"ImagingStudy"},encounter:{resourceType:"Encounter",optional:!0},patient:{resourceType:"Patient",optional:!0}},"Encounter-open":{encounter:{resourceType:"Encounter"},patient:{resourceType:"Patient"}},"Encounter-close":{encounter:{resourceType:"Encounter"},patient:{resourceType:"Patient"}},"DiagnosticReport-open":{report:{resourceType:"DiagnosticReport"},encounter:{resourceType:"Encounter",optional:!0},study:{resourceType:"ImagingStudy",optional:!0,manyAllowed:!0},patient:{resourceType:"Patient"}},"DiagnosticReport-close":{report:{resourceType:"DiagnosticReport"},encounter:{resourceType:"Encounter",optional:!0},study:{resourceType:"ImagingStudy",optional:!0,manyAllowed:!0},patient:{resourceType:"Patient"}},"DiagnosticReport-select":{report:{resourceType:"DiagnosticReport",reference:!0},patient:{resourceType:"Patient",optional:!0,reference:!0},select:{resourceType:"*",reference:!0,manyAllowed:!0}},"DiagnosticReport-update":{report:{resourceType:"DiagnosticReport",reference:!0},patient:{resourceType:"Patient",optional:!0,reference:!0},updates:{resourceType:"Bundle"}},syncerror:{operationoutcome:{resourceType:"OperationOutcome"}}};function sV(e){return rV.includes(e)}function $A(e){return!!e.endpoint}function dT(e){if(!Y0(e))throw new ft(Sn("subscriptionRequest must be an object conforming to SubscriptionRequest type."));const{channelType:t,mode:n,topic:r,events:o}=e,s={"hub.channel.type":t,"hub.mode":n,"hub.topic":r,"hub.events":o.join(",")};return $A(e)&&(s.endpoint=e.endpoint),new URLSearchParams(s).toString()}function Y0(e){if(typeof e!="object")return!1;const{channelType:t,mode:n,topic:r,events:o}=e;if(!(t&&n&&r&&o)||typeof r!="string"||typeof o!="object"||!Array.isArray(o)||o.length<1||t!=="websocket"||n!=="subscribe"&&n!=="unsubscribe")return!1;for(const s of o)if(!jx[s])return!1;return!($A(e)&&!(typeof e.endpoint=="string"&&e.endpoint.startsWith("ws")))}function lV(e,t,n,r){if(typeof t!="object")throw new ft(Sn(`context[${n}] is invalid. Context must contain a single valid FHIR resource! Resource is not an object.`));if(!(t.id&&typeof t.id=="string"))throw new ft(Sn(`context[${n}] is invalid. Resource must contain a valid string ID.`));if(!t.resourceType)throw new ft(Sn(`context[${n}] is invalid. Resource must contain a resource type. No resource type found.`));const o=r.resourceType;if(o!=="*"){if(!sV(t.resourceType))throw new ft(Sn(`context[${n}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));if(o&&t.resourceType!==o)throw new ft(Sn(`context[${n}] is invalid. context[${n}] for the '${e}' event should contain resource of type ${o}.`))}}function cV(e,t,n,r,o){if(o.set(t.key,(o.get(t.key)??0)+1),r.reference){if(!Ta(t.reference))throw new ft(Sn(`context[${n}] is invalid. Expected key '${t.key}' to be a reference.`))}else lV(e,t.resource,n,r)}function uV(e,t){const n=new Map,r=aV[e];for(let o=0;o<t.length;o++){const s=t[o].key;if(!r[s])throw new ft(Sn(`Key '${s}' not found for event '${e}'. Make sure to add only valid keys.`));cV(e,t[o],o,r[s],n)}for(const[o,s]of Object.entries(r)){if(!(s.optional||n.has(o)))throw new ft(Sn(`Missing required key '${o}' on context for '${e}' event.`));if(!s.manyAllowed&&(n.get(o)??0)>1)throw new ft(Sn(`${n.get(o)} context entries with key '${o}' found for the '${e}' event when schema only allows for 1.`))}}function fT(e,t,n,r){if(!(e&&typeof e=="string"))throw new ft(Sn("Must provide a topic."));if(!jx[t])throw new ft(Sn(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(jx).join(", ")}`));if(typeof n!="object")throw new ft(Sn("context must be a context object or array of context objects."));if(Q0.includes(t)&&!r)throw new ft(Sn(`The '${t}' event must contain a 'context.versionId'.`));const o=Array.isArray(n)?n:[n];return uV(t,o),{timestamp:new Date().toISOString(),id:LA(),event:{"hub.topic":e,"hub.event":t,context:o,...r?{"context.versionId":r}:{}}}}class dV extends km{subRequest;websocket;constructor(t){if(super(),this.subRequest=t,!t.endpoint)throw new ft(Sn("Subscription request should contain an endpoint."));if(!Y0(t))throw new ft(Sn("Subscription request failed validation."));const n=new WebSocket(t.endpoint);n.addEventListener("open",()=>{this.dispatchEvent({type:"connect"}),n.addEventListener("message",r=>{const o=JSON.parse(r.data);if(o["hub.topic"])return;const s=o;s.event["hub.event"]!=="heartbeat"&&(this.dispatchEvent({type:"message",payload:s}),n.send(JSON.stringify({id:o?.id,timestamp:new Date().toISOString()})))}),n.addEventListener("close",()=>{this.dispatchEvent({type:"disconnect"})})}),this.websocket=n}disconnect(){this.websocket.close()}}function fV(e){return JSON.parse(KB(e))}function hV(e){return e.split(".").length===3}function K0(e){const[t,n,r]=e.split(".");return fV(n)}function pV(e){try{return typeof K0(e).login_id=="string"}catch{return!1}}function mV(e){try{const n=K0(e).exp;return typeof n=="number"?n*1e3:void 0}catch{return}}class gV{medplum;constructor(t){this.medplum=t}async get(t){return this.medplum.get(`keyvalue/v1/${t}`)}async set(t,n){await this.medplum.put(`keyvalue/v1/${t}`,n,on.TEXT)}async delete(t){await this.medplum.delete(`keyvalue/v1/${t}`)}}class Wi{[Symbol.toStringTag]="ReadablePromise";suspender;status="pending";response;error;constructor(t){this.suspender=t.then(n=>(this.status="success",this.response=n,n),n=>{throw this.status="error",this.error=n,n})}isPending(){return this.status==="pending"}isOk(){return this.status==="success"}read(){switch(this.status){case"pending":throw this.suspender;case"error":throw this.error;default:return this.response}}then(t,n){return this.suspender.then(t,n)}catch(t){return this.suspender.catch(t)}finally(t){return this.suspender.finally(t)}}class vV{storage;prefix="";constructor(t,n=""){this.storage=t??globalThis.localStorage??new yV,this.prefix=n}makeKey(t){return this.prefix+t}clear(){this.storage===globalThis.localStorage&&this.prefix?Object.keys(this.storage).filter(t=>t.startsWith(this.prefix)).forEach(t=>{this.storage.removeItem(t)}):this.storage.clear()}getString(t){return this.storage.getItem(this.makeKey(t))??void 0}setString(t,n){n?this.storage.setItem(this.makeKey(t),n):this.storage.removeItem(this.makeKey(t))}getObject(t){const n=this.getString(t);return n?JSON.parse(n):void 0}setObject(t,n){this.setString(t,n?no(n):void 0)}}class yV{data;constructor(){this.data=new Map}get length(){return this.data.size}clear(){this.data.clear()}getItem(t){return this.data.get(t)??null}setItem(t,n){n?this.data.set(t,n):this.data.delete(t)}removeItem(t){this.data.delete(t)}key(t){return Array.from(this.data.keys())[t]}}const Dc={Event:typeof globalThis.Event<"u"?globalThis.Event:void 0,ErrorEvent:void 0,CloseEvent:void 0};let hT=!1;function xV(){if(typeof globalThis.Event>"u")throw new Error("Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet");Dc.Event=globalThis.Event,Dc.ErrorEvent=class extends Event{message;error;constructor(t,n){super("error",n),this.message=t.message,this.error=t}},Dc.CloseEvent=class extends Event{code;reason;wasClean=!0;constructor(t=1e3,n="",r){super("close",r),this.code=t,this.reason=n}}}function bV(e,t){if(!e)throw new Error(t)}function kh(e){return new e.constructor(e.type,e)}const Vs={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0};let pT=!1;class ns extends km{_ws;_retryCount=-1;_uptimeTimeout;_connectTimeout;_shouldReconnect=!0;_connectLock=!1;_binaryType;_closeCalled=!1;_messageQueue=[];_debugLogger=console.log.bind(console);_url;_protocols;_options;constructor(t,n,r={}){hT||(xV(),hT=!0),super(),this._url=t,this._protocols=n,this._options=r,this._options.startClosed&&(this._shouldReconnect=!1),this._options.binaryType?this._binaryType=this._options.binaryType:this._binaryType="blob",this._options.debugLogger&&(this._debugLogger=this._options.debugLogger),this._connect()}static get CONNECTING(){return 0}static get OPEN(){return 1}static get CLOSING(){return 2}static get CLOSED(){return 3}get CONNECTING(){return ns.CONNECTING}get OPEN(){return ns.OPEN}get CLOSING(){return ns.CLOSING}get CLOSED(){return ns.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(t){this._binaryType=t,this._ws&&(this._ws.binaryType=t)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce((n,r)=>(typeof r=="string"?n+=r.length:r instanceof Blob?n+=r.size:n+=r.byteLength,n),0)+(this._ws?.bufferedAmount??0)}get extensions(){return this._ws?.extensions??""}get protocol(){return this._ws?.protocol??""}get readyState(){return this._ws?this._ws.readyState:this._options.startClosed?ns.CLOSED:ns.CONNECTING}get url(){return this._ws?this._ws.url:""}get shouldReconnect(){return this._shouldReconnect}onclose=null;onerror=null;onmessage=null;onopen=null;close(t=1e3,n){if(this._closeCalled=!0,this._shouldReconnect=!1,this._clearTimeouts(),!this._ws){this._debug("close enqueued: no ws instance");return}if(this._ws.readyState===this.CLOSED){this._debug("close: already closed");return}this._ws.close(t,n)}reconnect(t,n){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED?this._connect():(this._disconnect(t,n),this._connect())}send(t){if(this._ws&&this._ws.readyState===this.OPEN)this._debug("send",t),this._ws.send(t);else{const{maxEnqueuedMessages:n=Vs.maxEnqueuedMessages}=this._options;this._messageQueue.length<n&&(this._debug("enqueue",t),this._messageQueue.push(t))}}_debug(...t){this._options.debug&&this._debugLogger("RWS>",...t)}_getNextDelay(){const{reconnectionDelayGrowFactor:t=Vs.reconnectionDelayGrowFactor,minReconnectionDelay:n=Vs.minReconnectionDelay,maxReconnectionDelay:r=Vs.maxReconnectionDelay}=this._options;let o=0;return this._retryCount>0&&(o=n*Math.pow(t,this._retryCount-1),o>r&&(o=r)),this._debug("next delay",o),o}_wait(){return new Promise(t=>{setTimeout(t,this._getNextDelay())})}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;const{maxRetries:t=Vs.maxRetries,connectionTimeout:n=Vs.connectionTimeout}=this._options;if(this._retryCount>=t){this._debug("max retries reached",this._retryCount,">=",t);return}this._retryCount++,this._debug("connect",this._retryCount),this._removeListeners(),this._wait().then(()=>{if(this._closeCalled){this._connectLock=!1;return}!this._options.WebSocket&&typeof WebSocket>"u"&&!pT&&(console.error("‼️ No WebSocket implementation available. You should define options.WebSocket."),pT=!0);const r=this._options.WebSocket||WebSocket;this._debug("connect",{url:this._url,protocols:this._protocols}),this._ws=this._protocols?new r(this._url,this._protocols):new r(this._url),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),n)}).catch(r=>{this._connectLock=!1,this._handleError(new Dc.ErrorEvent(Error(r.message),this))})}_handleTimeout(){this._debug("timeout event"),this._handleError(new Dc.ErrorEvent(Error("TIMEOUT"),this))}_disconnect(t=1e3,n){if(this._clearTimeouts(),!!this._ws){this._removeListeners();try{this._ws.close(t,n),this._handleClose(new Dc.CloseEvent(t,n,this))}catch{}}}_acceptOpen(){this._debug("accept open"),this._retryCount=0}_handleOpen=t=>{this._debug("open event");const{minUptime:n=Vs.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),n),bV(this._ws,"WebSocket is not defined"),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(r=>this._ws?.send(r)),this._messageQueue=[],this.onopen&&this.onopen(t),this.dispatchEvent(kh(t))};_handleMessage=t=>{this._debug("message event"),this.onmessage&&this.onmessage(t),this.dispatchEvent(kh(t))};_handleError=t=>{this._debug("error event",t.message),this._disconnect(void 0,t.message==="TIMEOUT"?"timeout":void 0),this.onerror&&this.onerror(t),this._debug("exec error listeners"),this.dispatchEvent(kh(t)),this._connect()};_handleClose=t=>{this._debug("close event"),this._clearTimeouts(),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(t),this.dispatchEvent(kh(t))};_removeListeners(){this._ws&&(this._debug("removeListeners"),this._ws.removeEventListener("open",this._handleOpen),this._ws.removeEventListener("close",this._handleClose),this._ws.removeEventListener("message",this._handleMessage),this._ws.removeEventListener("error",this._handleError))}_addListeners(){this._ws&&(this._debug("addListeners"),this._ws.addEventListener("open",this._handleOpen),this._ws.addEventListener("close",this._handleClose),this._ws.addEventListener("message",this._handleMessage),this._ws.addEventListener("error",this._handleError))}_clearTimeouts(){clearTimeout(this._connectTimeout),clearTimeout(this._uptimeTimeout)}}const SV=5e3;class Cx extends km{criteria;constructor(...t){super(),this.criteria=new Set(t)}getCriteria(){return this.criteria}_addCriteria(t){this.criteria.add(t)}_removeCriteria(t){this.criteria.delete(t)}}class wV{criteria;emitter;refCount;subscriptionProps;subscriptionId;token;connecting=!1;constructor(t,n){this.criteria=t,this.emitter=new Cx(t),this.refCount=1,this.subscriptionProps=n?{...n}:void 0}clearAttachedSubscription(){this.subscriptionId=void 0,this.token=void 0}}class jV{medplum;ws;masterSubEmitter;criteriaEntries;criteriaEntriesBySubscriptionId;wsClosed;pingTimer=void 0;pingIntervalMs;waitingForPong=!1;currentProfile;constructor(t,n,r){if(!(t instanceof BA))throw new ft(Sn("First arg of constructor should be a `MedplumClient`"));let o;try{o=new URL(n).toString()}catch{throw new ft(Sn("Not a valid URL"))}const s=r?.ReconnectingWebSocket?new r.ReconnectingWebSocket(o,void 0,{debug:r?.debug,debugLogger:r?.debugLogger}):new ns(o,void 0,{debug:r?.debug,debugLogger:r?.debugLogger});this.medplum=t,this.ws=s,this.masterSubEmitter=new Cx,this.criteriaEntries=new Map,this.criteriaEntriesBySubscriptionId=new Map,this.wsClosed=!1,this.pingIntervalMs=r?.pingIntervalMs??SV,this.currentProfile=t.getProfile(),this.setupListeners()}setupListeners(){const t=this.ws;t.addEventListener("message",n=>{try{const r=JSON.parse(n.data);if(r.type==="pong"){this.waitingForPong=!1;return}const o=r,s=o?.entry?.[0]?.resource;if(s.type==="heartbeat"){this.masterSubEmitter?.dispatchEvent({type:"heartbeat",payload:o});return}if(s.type==="handshake"){const d=sl(s.subscription),f={type:"connect",payload:{subscriptionId:d}};this.masterSubEmitter?.dispatchEvent(f);const p=this.criteriaEntriesBySubscriptionId.get(d);if(!p){console.warn("Received handshake for criteria the SubscriptionManager is not listening for yet");return}p.connecting=!1,p.emitter.dispatchEvent({...f});return}this.masterSubEmitter?.dispatchEvent({type:"message",payload:o});const c=this.criteriaEntriesBySubscriptionId.get(sl(s.subscription));if(!c){console.warn("Received notification for criteria the SubscriptionManager is not listening for");return}c.emitter.dispatchEvent({type:"message",payload:o})}catch(r){console.error(r);const o={type:"error",payload:r};this.masterSubEmitter?.dispatchEvent(o);for(const s of this.getAllCriteriaEmitters())s.dispatchEvent({...o})}}),t.addEventListener("error",()=>{const n={type:"error",payload:new ft(N8(new Error("WebSocket error")))};this.masterSubEmitter?.dispatchEvent(n);for(const r of this.getAllCriteriaEmitters())r.dispatchEvent({...n})}),t.addEventListener("close",()=>{const n={type:"close"};this.masterSubEmitter?.dispatchEvent(n);for(const r of this.getAllCriteriaEmitters())r.dispatchEvent({...n});this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=void 0,this.waitingForPong=!1),this.wsClosed&&(this.criteriaEntries.clear(),this.criteriaEntriesBySubscriptionId.clear(),this.masterSubEmitter?.removeAllListeners())}),t.addEventListener("open",()=>{const n={type:"open"};this.masterSubEmitter?.dispatchEvent(n);for(const r of this.getAllCriteriaEmitters())r.dispatchEvent({...n});this.refreshAllSubscriptions().catch(console.error),this.pingTimer||(this.pingTimer=setInterval(()=>{if(this.waitingForPong){this.waitingForPong=!1,t.reconnect();return}t.send(JSON.stringify({type:"ping"})),this.waitingForPong=!0},this.pingIntervalMs))}),this.medplum.addEventListener("change",()=>{const n=this.medplum.getProfile();this.currentProfile&&n===void 0?this.ws.close():n&&this.currentProfile?.id!==n.id&&this.ws.reconnect(),this.currentProfile=n})}emitError(t,n){const r={type:"error",payload:n};this.masterSubEmitter?.dispatchEvent(r),t.emitter.dispatchEvent({...r})}maybeEmitDisconnect(t){const{subscriptionId:n}=t;if(n){const r={type:"disconnect",payload:{subscriptionId:n}};this.masterSubEmitter?.dispatchEvent(r),t.emitter.dispatchEvent({...r})}else console.warn("Called disconnect for `CriteriaEntry` before `subscriptionId` was present.")}async getTokenForCriteria(t){let n=t?.subscriptionId;n||(n=(await this.medplum.createResource({...t.subscriptionProps,resourceType:"Subscription",status:"active",reason:`WebSocket subscription for ${Ot(this.medplum.getProfile())}`,channel:{type:"websocket"},criteria:t.criteria})).id);const{parameter:r}=await this.medplum.get(`fhir/R4/Subscription/${n}/$get-ws-binding-token`),o=r?.find(c=>c.name==="token")?.valueString,s=r?.find(c=>c.name==="websocket-url")?.valueUrl;if(!o)throw new ft(Sn("Failed to get token"));if(!s)throw new ft(Sn("Failed to get URL from $get-ws-binding-token"));return[n,o]}maybeGetCriteriaEntry(t,n){const r=this.criteriaEntries.get(t);if(r){if(!n)return r.bareCriteria;for(const o of r.criteriaWithProps)if(_o(n,o.subscriptionProps))return o}}getAllCriteriaEmitters(){const t=[];for(const n of this.criteriaEntries.values()){n.bareCriteria&&t.push(n.bareCriteria.emitter);for(const r of n.criteriaWithProps)t.push(r.emitter)}return t}addCriteriaEntry(t){const{criteria:n,subscriptionProps:r}=t;let o;this.criteriaEntries.has(n)?o=this.criteriaEntries.get(n):(o={criteriaWithProps:[]},this.criteriaEntries.set(n,o)),r?o.criteriaWithProps.push(t):o.bareCriteria=t}removeCriteriaEntry(t){const{criteria:n,subscriptionProps:r,subscriptionId:o,token:s}=t;if(!this.criteriaEntries.has(n))return;const c=this.criteriaEntries.get(n);r?c.criteriaWithProps=c.criteriaWithProps.filter(d=>{const f=d.subscriptionProps;return!_o(r,f)}):c.bareCriteria=void 0,!c.bareCriteria&&c.criteriaWithProps.length===0&&(this.criteriaEntries.delete(n),this.masterSubEmitter?._removeCriteria(n)),o&&this.criteriaEntriesBySubscriptionId.delete(o),s&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:"unbind-from-token",payload:{token:s}}))}async subscribeToCriteria(t){if(!(this.ws.readyState!==WebSocket.OPEN||t.connecting)){t.connecting=!0;try{const[n,r]=await this.getTokenForCriteria(t);t.subscriptionId=n,t.token=r,this.criteriaEntriesBySubscriptionId.set(n,t),this.ws.send(JSON.stringify({type:"bind-with-token",payload:{token:r}}))}catch(n){console.error(Ge(n)),this.emitError(t,n),this.removeCriteriaEntry(t)}}}async refreshAllSubscriptions(){this.criteriaEntriesBySubscriptionId.clear();for(const t of this.criteriaEntries.values())for(const n of[...t.bareCriteria?[t.bareCriteria]:[],...t.criteriaWithProps])n.clearAttachedSubscription(),await this.subscribeToCriteria(n)}addCriteria(t,n){this.masterSubEmitter&&this.masterSubEmitter._addCriteria(t);const r=this.maybeGetCriteriaEntry(t,n);if(r)return r.refCount+=1,r.emitter;const o=new wV(t,n);return this.addCriteriaEntry(o),this.subscribeToCriteria(o).catch(console.error),o.emitter}removeCriteria(t,n){const r=this.maybeGetCriteriaEntry(t,n);if(!r){console.warn("Criteria not known to `SubscriptionManager`. Possibly called remove too many times.");return}r.refCount-=1,!(r.refCount>0)&&(this.maybeEmitDisconnect(r),this.removeCriteriaEntry(r))}getWebSocket(){return this.ws}closeWebSocket(){this.wsClosed||(this.wsClosed=!0,this.ws.close())}reconnectWebSocket(){this.ws.reconnect(),this.wsClosed=!1}getCriteriaCount(){return this.getAllCriteriaEmitters().length}getMasterEmitter(){return this.masterSubEmitter||(this.masterSubEmitter=new Cx(...Array.from(this.criteriaEntries.keys()))),this.masterSubEmitter}}const UA="5.0.5-6737a7f",CV=on.FHIR_JSON+", */*; q=0.1",EV="https://api.medplum.com/",TV=1e3,RV=6e4,_V=0,DV=3e5,AV="Binary/",mT={resourceType:"Device",id:"system",deviceName:[{type:"model-name",name:"System"}]},xc={ClientCredentials:"client_credentials",AuthorizationCode:"authorization_code",RefreshToken:"refresh_token",JwtBearer:"urn:ietf:params:oauth:grant-type:jwt-bearer",TokenExchange:"urn:ietf:params:oauth:grant-type:token-exchange"},kV={AccessToken:"urn:ietf:params:oauth:token-type:access_token"},PV={JwtBearer:"urn:ietf:params:oauth:client-assertion-type:jwt-bearer"};class BA extends km{options;fetch;createPdfImpl;storage;requestCache;cacheTime;baseUrl;fhirBaseUrl;authorizeUrl;tokenUrl;logoutUrl;fhircastHubUrl;defaultHeaders;onUnauthenticated;autoBatchTime;autoBatchQueue;refreshGracePeriod;subscriptionManager;medplumServer;clientId;clientSecret;credentialsInHeader;autoBatchTimerId;accessToken;accessTokenExpires;refreshToken;refreshPromise;profilePromise;sessionDetails;currentRateLimits;basicAuth;initPromise;initComplete=!0;keyValueClient;constructor(t){if(super(),t?.baseUrl&&!t.baseUrl.startsWith("http"))throw new Error("Base URL must start with http or https");this.options=t??{},this.fetch=t?.fetch??NV(),this.storage=t?.storage??new vV(void 0,t?.storagePrefix),this.createPdfImpl=t?.createPdf,this.baseUrl=$0(t?.baseUrl??EV),this.fhirBaseUrl=mo(this.baseUrl,t?.fhirUrlPath??"fhir/R4"),this.authorizeUrl=mo(this.baseUrl,t?.authorizeUrl??"oauth2/authorize"),this.tokenUrl=mo(this.baseUrl,t?.tokenUrl??"oauth2/token"),this.logoutUrl=mo(this.baseUrl,t?.logoutUrl??"oauth2/logout"),this.fhircastHubUrl=mo(this.baseUrl,t?.fhircastHubUrl??"fhircast/STU3"),this.clientId=t?.clientId??"",this.clientSecret=t?.clientSecret??"",this.credentialsInHeader=t?.authCredentialsMethod==="header",this.defaultHeaders=t?.defaultHeaders??{},this.onUnauthenticated=t?.onUnauthenticated,this.refreshGracePeriod=t?.refreshGracePeriod??DV,this.cacheTime=t?.cacheTime??(vo()?RV:_V),this.cacheTime>0?this.requestCache=new XD(t?.resourceCacheSize??TV):this.requestCache=void 0,t?.autoBatchTime?(this.autoBatchTime=t.autoBatchTime,this.autoBatchQueue=[]):(this.autoBatchTime=0,this.autoBatchQueue=void 0),t?.accessToken&&this.setAccessToken(t.accessToken),this.storage.getInitPromise===void 0?(t?.accessToken||this.attemptResumeActiveLogin().catch(console.error),this.initPromise=Promise.resolve(),this.dispatchEvent({type:"storageInitialized"})):(this.initComplete=!1,this.initPromise=this.storage.getInitPromise(),this.initPromise.then(()=>{t?.accessToken||this.attemptResumeActiveLogin().catch(console.error),this.initComplete=!0,this.dispatchEvent({type:"storageInitialized"})}).catch(n=>{console.error(n),this.initComplete=!0,this.dispatchEvent({type:"storageInitFailed",payload:{error:n}})})),this.setupStorageListener()}get isInitialized(){return this.initComplete}getInitPromise(){return this.initPromise}async attemptResumeActiveLogin(){const t=this.getActiveLogin();t&&(this.setAccessToken(t.accessToken,t.refreshToken),await this.refreshProfile())}getBaseUrl(){return this.baseUrl}getAuthorizeUrl(){return this.authorizeUrl}getTokenUrl(){return this.tokenUrl}getLogoutUrl(){return this.logoutUrl}getFhircastHubUrl(){return this.fhircastHubUrl}getDefaultHeaders(){return this.defaultHeaders}clear(){this.storage.clear(),vo()&&sessionStorage.clear(),this.clearActiveLogin()}clearActiveLogin(){this.storage.setString("activeLogin",void 0),this.requestCache?.clear(),this.accessToken=void 0,this.refreshToken=void 0,this.refreshPromise=void 0,this.accessTokenExpires=void 0,this.sessionDetails=void 0,this.medplumServer=void 0,this.dispatchEvent({type:"change"})}invalidateUrl(t){t=t.toString(),this.requestCache?.delete(t)}invalidateAll(){this.requestCache?.clear()}invalidateSearches(t){const n=mo(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&&!n.disableAutoBatch?o=new Promise((c,d)=>{this.autoBatchQueue.push({method:"GET",url:t.replace(this.fhirBaseUrl,""),options:n,resolve:c,reject:d}),this.autoBatchTimerId||(this.autoBatchTimerId=setTimeout(()=>this.executeAutoBatch(),this.autoBatchTime))}):o=this.request("GET",t,n);const s=new Wi(o);return this.setCacheEntry(t,s),s}post(t,n,r,o={}){return t=t.toString(),this.setRequestBody(o,n),r&&this.setRequestContentType(o,r),this.invalidateUrl(t),this.request("POST",t,o)}put(t,n,r,o={}){return t=t.toString(),this.setRequestBody(o,n),r&&this.setRequestContentType(o,r),this.invalidateUrl(t),this.request("PUT",t,o)}patch(t,n,r={}){return t=t.toString(),this.setRequestBody(r,n),this.setRequestContentType(r,on.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(rr.getSearch()).get("code");if(!r){await this.requestAuthorization(t);return}return this.processCode(r)}signOutWithRedirect(){rr.assign(this.logoutUrl)}async signInWithExternalAuth(t,n,r,o,s=!0){let c=o;s&&(c=await this.ensureCodeChallenge(o)),rr.assign(this.getExternalAuthRedirectUri(t,n,r,c,s))}async exchangeExternalAccessToken(t,n){if(n=n??this.clientId,!n)throw new Error("MedplumClient is missing clientId");return this.fetchTokens({grant_type:xc.TokenExchange,subject_token_type:kV.AccessToken,client_id:n,subject_token:t})}getExternalAuthRedirectUri(t,n,r,o,s=!0){const c=new URL(t);if(c.searchParams.set("response_type","code"),c.searchParams.set("client_id",n),c.searchParams.set("redirect_uri",r),c.searchParams.set("scope",o.scope??"openid profile email"),c.searchParams.set("state",JSON.stringify(o)),s){const{codeChallenge:d,codeChallengeMethod:f}=o;if(!f)throw new Error("`LoginRequest` for external auth must include a `codeChallengeMethod`.");if(!d)throw new Error("`LoginRequest` for external auth must include a `codeChallenge`.");c.searchParams.set("code_challenge_method",f),c.searchParams.set("code_challenge",d)}return c.toString()}fhirUrl(...t){return new URL(mo(this.fhirBaseUrl,t.join("/")))}fhirSearchUrl(t,n){const r=this.fhirUrl(t);return n&&(r.search=CU(n)),r}search(t,n,r){const o=this.fhirSearchUrl(t,n),s="search-"+o.toString(),c=this.getCacheEntry(s,r);if(c)return c.value;const d=this.getBundle(o,r);return this.setCacheEntry(s,d),d}searchOne(t,n,r){const o=this.fhirSearchUrl(t,n);o.searchParams.set("_count","1"),o.searchParams.sort();const s="searchOne-"+o.toString(),c=this.getCacheEntry(s,r);if(c)return c.value;const d=new Wi(this.search(t,o.searchParams,r).then(f=>f.entry?.[0]?.resource));return this.setCacheEntry(s,d),d}searchResources(t,n,r){const s="searchResources-"+this.fhirSearchUrl(t,n).toString(),c=this.getCacheEntry(s,r);if(c)return c.value;const d=new Wi(this.search(t,n,r).then(vT));return this.setCacheEntry(s,d),d}async*searchResourcePages(t,n,r){let o=this.fhirSearchUrl(t,n);for(;o;){const s=new URL(o).searchParams;s.has("_count")||s.set("_count","1000");const c=await this.search(t,s,r),d=c.link?.find(f=>f.relation==="next");if(!c.entry?.length&&!d)break;yield vT(c),o=d?.url?new URL(d.url):void 0}}valueSetExpand(t,n){const r=this.fhirUrl("ValueSet","$expand");return r.search=new URLSearchParams(t).toString(),this.get(r.toString(),n)}getCached(t,n){const r=this.requestCache?.get(this.fhirUrl(t,n).toString())?.value;return r?.isOk()?r.read():void 0}getCachedReference(t){const n=t.reference;if(!n)return;if(n==="system")return mT;const[r,o]=n.split("/");if(!(!r||!o))return this.getCached(r,o)}readResource(t,n,r){if(!n)throw new Error('The "id" parameter cannot be null, undefined, or an empty string.');return this.get(this.fhirUrl(t,n),r)}readReference(t,n){const r=t.reference;if(!r)return new Wi(Promise.reject(new Error("Missing reference")));if(r==="system")return new Wi(Promise.resolve(mT));const[o,s]=r.split("/");return!o||!s?new Wi(Promise.reject(new Error("Invalid reference"))):this.readResource(o,s,n)}requestSchema(t){if(iA(t))return Promise.resolve();const n=t+"-requestSchema",r=this.getCacheEntry(n,void 0);if(r)return r.value;const o=new Wi((async()=>{const s=`{
60
- StructureDefinitionList(_filter: "name eq ${t}") {
61
- resourceType,
62
- name,
63
- kind,
64
- description,
65
- type,
66
- url,
67
- snapshot {
68
- element {
69
- id,
70
- path,
71
- definition,
72
- min,
73
- max,
74
- base {
75
- path,
76
- min,
77
- max
78
- },
79
- contentReference,
80
- type {
81
- code,
82
- profile,
83
- targetProfile
84
- },
85
- binding {
86
- strength,
87
- valueSet
88
- }
89
- }
90
- }
91
- }
92
- SearchParameterList(base: "${t}", _count: 100) {
93
- base,
94
- code,
95
- type,
96
- expression,
97
- target
98
- }
99
- }`.replaceAll(/\s+/g," "),c=await this.graphql(s);XE(c.data.StructureDefinitionList);for(const d of c.data.SearchParameterList)MU(d)})());return this.setCacheEntry(n,o),o}requestProfileSchema(t,n){if(!n?.expandProfile&&O0(t))return Promise.resolve();const r=t+"-requestSchema"+(n?.expandProfile?"-nested":""),o=this.getCacheEntry(r,void 0);if(o)return o.value;const s=new Wi((async()=>{if(n?.expandProfile){const c=this.fhirUrl("StructureDefinition","$expand-profile");c.search=new URLSearchParams({url:t}).toString();const d=await this.post(c.toString(),{});XE(d)}else{const c=await this.searchOne("StructureDefinition",{url:t,_sort:"-_lastUpdated"});if(!c){console.warn(`No StructureDefinition found for ${t}!`);return}rA(c)}})());return this.setCacheEntry(r,s),s}readHistory(t,n,r,o){const s=this.fhirUrl(t,n,"_history");return r?.count&&s.searchParams.set("_count",r.count.toString()),r?.offset&&s.searchParams.set("_offset",r.offset.toString()),this.get(s.toString(),o)}readVersion(t,n,r,o){return this.get(this.fhirUrl(t,n,"_history",r),o)}readPatientEverything(t,n){return this.getBundle(this.fhirUrl("Patient",t,"$everything"),n)}readPatientSummary(t,n){return this.getBundle(this.fhirUrl("Patient",t,"$summary"),n)}createResource(t,n){if(!t.resourceType)throw new Error("Missing resourceType");return this.invalidateSearches(t.resourceType),this.post(this.fhirUrl(t.resourceType),t,void 0,n)}async createResourceIfNoneExist(t,n,r={}){const o=this.fhirUrl(t.resourceType);this.setRequestHeader(r,"If-None-Exist",n);const s=await this.post(o,t,void 0,r);return this.cacheResource(s),this.invalidateUrl(this.fhirUrl(t.resourceType,t.id,"_history")),this.invalidateSearches(t.resourceType),s}async upsertResource(t,n,r){const o=this.fhirSearchUrl(t.resourceType,n);let s=await this.put(o,t,void 0,r);return s||(s=t),this.cacheResource(s),this.invalidateUrl(this.fhirUrl(t.resourceType,t.id,"_history")),this.invalidateSearches(t.resourceType),s}async createAttachment(t,n,r,o,s){let c=yT(t,n,r,o);if(c.contentType===on.XML){const p=c.data;let m;p instanceof Blob?m=await new Promise((g,y)=>{const b=new FileReader;b.onload=()=>{if(!b.result){y(new Error("Failed to load file"));return}g(b.result)},b.readAsText(p,"utf-8")}):ArrayBuffer.isView(p)?m=new TextDecoder().decode(p):m=p,m.includes("<ClinicalDocument")&&m.includes("urn:hl7-org:v3")&&(c={...c,contentType:on.CDA_XML})}const d=s??(typeof n=="object"?n:{}),f=await this.createBinary(c,d);return{contentType:c.contentType,url:f.url,title:c.filename}}createBinary(t,n,r,o,s){const c=yT(t,n,r,o),d=s??(typeof n=="object"?n:{}),{data:f,contentType:p,filename:m,securityContext:g,onProgress:y}=c,b=this.fhirUrl("Binary");return m&&b.searchParams.set("_filename",m),g?.reference&&this.setRequestHeader(d,"X-Security-Context",g.reference),y?this.uploadwithProgress(b,f,p,y,d):this.post(b,f,p,d)}uploadwithProgress(t,n,r,o,s){return new Promise((c,d)=>{const f=new XMLHttpRequest,p=()=>f.abort();s?.signal?.addEventListener("abort",p);const m=g=>{s?.signal?.removeEventListener("abort",p),g instanceof Error?d(g):c(g)};if(f.responseType="json",f.onabort=()=>m(new DOMException("Request aborted","AbortError")),f.onerror=()=>m(new Error("Request error")),o&&(f.upload.onprogress=g=>o(g),f.upload.onload=g=>o(g)),f.onload=()=>{f.status>=200&&f.status<300?m(f.response):m(new ft(Yt(f.response||f.statusText)))},f.open("POST",t),f.withCredentials=!0,f.setRequestHeader("Authorization","Bearer "+this.accessToken),f.setRequestHeader("Cache-Control","no-cache, no-store, max-age=0"),f.setRequestHeader("Content-Type",r),this.options.extendedMode!==!1&&f.setRequestHeader("X-Medplum","extended"),s?.headers){const g=s.headers;for(const[y,b]of Object.entries(g))f.setRequestHeader(y,b)}f.send(n)})}async createPdf(t,n,r,o){if(!this.createPdfImpl)throw new Error("PDF creation not enabled");const s=LV(t,n,r,o),c=typeof n=="object"?n:{},{docDefinition:d,tableLayouts:f,fonts:p,...m}=s,g=await this.createPdfImpl(d,f,p),y={...m,data:g,contentType:"application/pdf"};return this.createBinary(y,c)}createComment(t,n,r){const o=this.getProfile();let s,c;return t.resourceType==="Encounter"&&(s=Wt(t),c=t.subject),t.resourceType==="ServiceRequest"&&(s=t.encounter,c=t.subject),t.resourceType==="Patient"&&(c=Wt(t)),this.createResource({resourceType:"Communication",status:"completed",basedOn:[Wt(t)],encounter:s,subject:c,sender:o?Wt(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}async patchResource(t,n,r,o){const s=await this.patch(this.fhirUrl(t,n),r,o);return this.cacheResource(s),this.invalidateUrl(this.fhirUrl(t,n,"_history")),this.invalidateSearches(t),s}deleteResource(t,n,r){return this.deleteCacheEntry(this.fhirUrl(t,n).toString()),this.invalidateSearches(t),this.delete(this.fhirUrl(t,n),r)}validateResource(t,n){return this.post(this.fhirUrl(t.resourceType,"$validate"),t,void 0,n)}executeBot(t,n,r,o){let s;if(typeof t=="string"){const c=t;s=this.fhirUrl("Bot",c,"$execute")}else{const c=t;s=this.fhirUrl("Bot","$execute"),s.searchParams.set("identifier",c.system+"|"+c.value)}return this.post(s,n,r,o)}executeBatch(t,n){return this.post(this.fhirBaseUrl,t,void 0,n)}sendEmail(t,n){return this.post("email/v1/send",t,on.JSON,n)}graphql(t,n,r,o){return this.post(this.fhirUrl("$graphql"),{query:t,operationName:n,variables:r},on.JSON,o)}readResourceGraph(t,n,r,o){return this.get(`${this.fhirUrl(t,n)}/$graph?graph=${r}`,o)}pushToAgent(t,n,r,o,s,c){const{waitTimeout:d,...f}=c??{};return this.post(this.fhirUrl("Agent",sl(t),"$push"),{destination:typeof n=="string"?n:Ot(n),body:r,contentType:o,waitForResponse:s,...d!==void 0?{waitTimeout:d}:void 0},on.FHIR_JSON,f)}getActiveLogin(){return this.storage.getObject("activeLogin")}async setActiveLogin(t){(!this.sessionDetails?.profile||Ot(this.sessionDetails.profile)!==t.profile?.reference)&&this.clearActiveLogin(),this.setAccessToken(t.accessToken,t.refreshToken),this.storage.setObject("activeLogin",t),this.addLogin(t),this.refreshPromise=void 0,await this.refreshProfile()}getAccessToken(){return this.accessToken}isAuthenticated(t){return this.accessTokenExpires!==void 0&&Date.now()<this.accessTokenExpires-(t??this.refreshGracePeriod)}setAccessToken(t,n){this.accessToken=t,this.refreshToken=n,this.accessTokenExpires=mV(t),this.medplumServer=pV(t)}getLogins(){return this.storage.getObject("logins")??[]}addLogin(t){const n=this.getLogins().filter(r=>r.profile?.reference!==t.profile?.reference);n.push(t),this.storage.setObject("logins",n)}async refreshProfile(){if(this.medplumServer)return this.profilePromise=new Promise((t,n)=>{this.get("auth/me",{cache:"no-cache"}).then(r=>{this.profilePromise=void 0;const o=this.sessionDetails?.profile?.id!==r.profile.id;this.sessionDetails=r,o&&this.dispatchEvent({type:"change"}),t(r.profile),this.dispatchEvent({type:"profileRefreshed"})}).catch(n)}),this.dispatchEvent({type:"profileRefreshing"}),this.profilePromise}isLoading(){return!this.isInitialized||!!this.profilePromise&&!this.sessionDetails?.profile}isSuperAdmin(){return!!this.sessionDetails?.project.superAdmin}isProjectAdmin(){return!!this.sessionDetails?.membership.admin}getProject(){return this.sessionDetails?.project}getProjectMembership(){return this.sessionDetails?.membership}getProfile(){return this.sessionDetails?.profile}async getProfileAsync(){return this.profilePromise?this.profilePromise:this.sessionDetails?this.sessionDetails.profile:this.refreshProfile()}getUserConfiguration(){return this.sessionDetails?.config}getAccessPolicy(){return this.sessionDetails?.accessPolicy}async download(t,n={}){this.refreshPromise&&await this.refreshPromise;const r=t.toString();r.startsWith(AV)&&(t=this.fhirUrl(r));let o=n.headers;return o||(o={},n.headers=o),o.Accept||(o.Accept="*/*"),this.addFetchOptionsDefaults(n),(await this.fetchWithRetry(t.toString(),n)).blob()}async createMedia(t,n){const{additionalFields:r,...o}=t,s=await this.createResource({resourceType:"Media",status:"preparation",content:{contentType:t.contentType},...r});o.securityContext||(o.securityContext=Wt(s));const c=await this.createAttachment(o,n);return this.updateResource({...s,status:"completed",content:c})}async uploadMedia(t,n,r,o,s){return this.createMedia({data:t,contentType:n,filename:r,additionalFields:o},s)}async createDocumentReference(t,n){const{additionalFields:r,...o}=t,s=await this.createResource({resourceType:"DocumentReference",status:"current",content:[{attachment:{contentType:t.contentType}}],...r});o.securityContext||(o.securityContext=Wt(s));const c=await this.createAttachment(o,n);return this.updateResource({...s,content:[{attachment:c}]})}async bulkExport(t="",n,r,o){const s=t&&`${t}/`,c=this.fhirUrl(`${s}$export`);return n&&c.searchParams.set("_type",n),r&&c.searchParams.set("_since",r),this.startAsyncRequest(c.toString(),o)}async startAsyncRequest(t,n={}){this.addFetchOptionsDefaults(n);const r=n.headers;return r.Prefer="respond-async",this.request("POST",t,n)}get keyValue(){return this.keyValueClient||(this.keyValueClient=new gV(this)),this.keyValueClient}getBundle(t,n){return new Wi((async()=>{const r=await this.get(t,n);if(r.entry)for(const o of r.entry)this.cacheResource(o.resource);return r})())}getCacheEntry(t,n){if(!this.requestCache||n?.cache==="no-cache"||n?.cache==="reload")return;const r=this.requestCache.get(t);if(!(!r||r.requestTime+this.cacheTime<Date.now()))return r}setCacheEntry(t,n){this.requestCache&&this.requestCache.set(t,{requestTime:Date.now(),value:n})}cacheResource(t){t?.id&&!t.meta?.tag?.some(n=>n.code==="SUBSETTED")&&this.setCacheEntry(this.fhirUrl(t.resourceType,t.id).toString(),new Wi(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 s=await this.fetchWithRetry(n,r);if(s.status===401)return this.handleUnauthenticated(t,n,r);if(s.status===204||s.status===304)return;const d=s.headers.get("content-type")?.includes("json");if(s.status===404&&!d)throw new ft(k8);const f=await this.parseBody(s,d);if(s.status===200&&r.followRedirectOnOk||s.status===201&&r.followRedirectOnCreated){const p=await gT(s,f);if(p)return this.request("GET",p,{...r,body:void 0})}if(s.status===202&&r.pollStatusOnAccepted){const m=await gT(s,f)??o.statusUrl;if(m)return this.pollStatus(m,r,o)}if(s.status>=400)throw new ft(Yt(f));return f}async parseBody(t,n){let r;if(t.headers.get("content-length")!=="0"){if(n)try{r=await t.json()}catch(o){throw console.error("Error parsing response",t.status,o),o}else r=await t.text();return r}}async fetchWithRetry(t,n){t.startsWith("http")||(t=mo(this.baseUrl,t));const r=n?.maxRetries??2;for(let o=0;o<=r;o++)try{this.options.verbose&&this.logRequest(t,n);const s=await this.fetch(t,n);if(this.options.verbose&&this.logResponse(s),this.setCurrentRateLimit(s),o>=r||!IV(s))return s;const c=this.getRetryDelay(o),d=n.maxRetryTime??2e3;if(c>d)return s;await iT(c)}catch(s){if(s.message==="Failed to fetch"&&o===0&&this.dispatchEvent({type:"offline"}),s.name==="AbortError"||o===r)throw s}throw new Error("Unreachable")}logRequest(t,n){if(console.log(`> ${n.method} ${t}`),n.headers){const r=n.headers;for(const o of $c(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}`))}setCurrentRateLimit(t){if(!t?.headers||typeof t.headers.get!="function")return;const n=t.headers.get("ratelimit");n&&(this.currentRateLimits=n)}rateLimitStatus(){if(!this.currentRateLimits)return[];const t=this.currentRateLimits;return t.split(/\s*;\s*/g).map(n=>{const r=n.split(/\s*,\s*/g);if(r.length!==3)throw new Error("Could not parse RateLimit header: "+t);const o=r[0].substring(1,r[0].length-1),s=r.find(p=>p.startsWith("r=")),c=s?Number.parseInt(s.substring(2),10):NaN,d=r.find(p=>p.startsWith("t=")),f=d?Number.parseInt(d.substring(2),10):NaN;if(!o||Number.isNaN(c)||Number.isNaN(f))throw new Error("Could not parse RateLimit header: "+t);return{name:o,remainingUnits:c,secondsUntilReset:f}})}getRetryDelay(t){const n=this.rateLimitStatus();let r=500*Math.pow(1.5,t);for(const o of n)o.remainingUnits||(r=Math.max(r,o.secondsUntilReset*1e3));return r}async pollStatus(t,n,r){const o={...n,method:"GET",body:void 0,redirect:"follow"};if(r.pollCount===void 0)n.headers&&typeof n.headers=="object"&&"Prefer"in n.headers&&(o.headers={...n.headers},delete o.headers.Prefer),r.statusUrl=t,r.pollCount=1;else{const s=n.pollStatusPeriod??1e3;await iT(s),r.pollCount++}return this.request("GET",t,o,r)}async executeAutoBatch(){if(this.autoBatchQueue===void 0)return;const t=[...this.autoBatchQueue];if(this.autoBatchQueue.length=0,this.autoBatchTimerId=void 0,t.length===1){const o=t[0];try{o.resolve(await this.request(o.method,mo(this.fhirBaseUrl,o.url),o.options))}catch(s){o.reject(new ft(Yt(s)))}return}const n={resourceType:"Bundle",type:"batch",entry:t.map(o=>({request:{method:o.method,url:o.url},resource:o.options.body?JSON.parse(o.options.body):void 0}))},r=await this.post(this.fhirBaseUrl,n);for(let o=0;o<t.length;o++){const s=t[o],c=r.entry?.[o];c?.response?.outcome&&!ZD(c.response.outcome)?s.reject(new ft(c.response.outcome)):s.resolve(c?.resource)}}addFetchOptionsDefaults(t){Object.entries(this.defaultHeaders).forEach(([n,r])=>{this.setRequestHeader(t,n,r)}),this.setRequestHeader(t,"Accept",CV,!0),this.options.extendedMode!==!1&&this.setRequestHeader(t,"X-Medplum","extended"),t.body&&this.setRequestHeader(t,"Content-Type",on.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){const s=t.headers;s?Array.isArray(s)?(!o||!s.some(([c])=>c.toLowerCase()===n.toLowerCase()))&&s.push([n,r]):s instanceof Headers?(!o||!s.has(n))&&s.set(n,r):fr(s)&&(!o||!s[n])&&(s[n]=r):t.headers={[n]:r}}setRequestBody(t,n){typeof n=="string"||typeof Blob<"u"&&(n instanceof Blob||n?.constructor.name==="Blob")||typeof File<"u"&&(n instanceof File||n?.constructor.name==="File")||typeof Uint8Array<"u"&&(n instanceof Uint8Array||n?.constructor.name==="Uint8Array")?t.body=n:n&&(t.body=JSON.stringify(n))}async handleUnauthenticated(t,n,r){if(this.refresh())return this.request(t,n,r);throw this.clear(),this.onUnauthenticated?.(),new ft(xd)}async startPkce(){const t=uT();sessionStorage.setItem("pkceState",t);const n=uT().slice(0,128);sessionStorage.setItem("codeVerifier",n);try{const r=await XB(n);return{codeChallengeMethod:"S256",codeChallenge:yU(r).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}}catch(r){return console.warn("Failed to hash code verifier. Falling back to 'plain' code challenge method",r),{codeChallengeMethod:"plain",codeChallenge:n}}}async requestAuthorization(t){const n=await this.ensureCodeChallenge(t??{}),r=new URL(this.authorizeUrl);r.searchParams.set("response_type","code"),r.searchParams.set("state",sessionStorage.getItem("pkceState")),r.searchParams.set("client_id",n.clientId??this.clientId),r.searchParams.set("redirect_uri",n.redirectUri??rr.getOrigin()),r.searchParams.set("code_challenge_method",n.codeChallengeMethod),r.searchParams.set("code_challenge",n.codeChallenge),r.searchParams.set("scope",n.scope??"openid profile"),rr.assign(r.toString())}processCode(t,n){const r={grant_type:xc.AuthorizationCode,code:t,client_id:n?.clientId??this.clientId??"",redirect_uri:n?.redirectUri??rr.getOrigin()};if(typeof sessionStorage<"u"){const o=sessionStorage.getItem("codeVerifier");o&&(r.code_verifier=o)}return this.fetchTokens(r)}refreshIfExpired(t){return!this.refreshPromise&&this.accessTokenExpires!==void 0&&!this.isAuthenticated(t)&&this.refresh(),this.refreshPromise??Promise.resolve()}refresh(){if(this.refreshPromise)return this.refreshPromise;if(this.refreshToken)return this.refreshPromise=this.fetchTokens({grant_type:xc.RefreshToken,client_id:this.clientId??"",refresh_token:this.refreshToken}),this.refreshPromise;if(this.clientId&&this.clientSecret)return this.refreshPromise=this.startClientLogin(this.clientId,this.clientSecret),this.refreshPromise}async startClientLogin(t,n){return this.clientId=t,this.clientSecret=n,this.fetchTokens({grant_type:xc.ClientCredentials,client_id:t,client_secret:n})}async startJwtBearerLogin(t,n,r){return this.clientId=t,this.fetchTokens({grant_type:xc.JwtBearer,client_id:t,assertion:n,scope:r})}async startJwtAssertionLogin(t){return this.fetchTokens({grant_type:xc.ClientCredentials,client_assertion_type:PV.JwtBearer,client_assertion:t})}setBasicAuth(t,n){this.clientId=t,this.clientSecret=n,this.basicAuth=cT(t+":"+n)}setVerbose(t){this.options.verbose=t}async fhircastSubscribe(t,n){if(!(typeof t=="string"&&t!==""))throw new ft(Sn("Invalid topic provided. Topic must be a valid string."));if(!(typeof n=="object"&&Array.isArray(n)&&n.length>0))throw new ft(Sn("Invalid events provided. Events must be an array of event names containing at least one event."));const r={channelType:"websocket",mode:"subscribe",topic:t,events:n},s=(await this.post(this.fhircastHubUrl,dT(r),on.FORM_URL_ENCODED))["hub.channel.endpoint"];if(!s)throw new Error("Invalid response!");return r.endpoint=s,r}async fhircastUnsubscribe(t){if(!Y0(t))throw new ft(Sn("Invalid topic or subscriptionRequest. SubscriptionRequest must be an object."));if(!(t.endpoint&&typeof t.endpoint=="string"&&t.endpoint.startsWith("ws")))throw new ft(Sn("Provided subscription request must have an endpoint in order to unsubscribe."));t.mode="unsubscribe",await this.post(this.fhircastHubUrl,dT(t),on.FORM_URL_ENCODED)}fhircastConnect(t){return new dV(t)}async fhircastPublish(t,n,r,o){return iV(n)?this.post(this.fhircastHubUrl,fT(t,n,r,o),on.JSON):(oV(n),this.post(this.fhircastHubUrl,fT(t,n,r),on.JSON))}async fhircastGetContext(t){return this.get(`${this.fhircastHubUrl}/${t}`,{cache:"no-cache"})}async invite(t,n){return this.post("admin/projects/"+t+"/invite",n)}async fetchTokens(t){const n=new URLSearchParams(t),r={...this.defaultHeaders,"Content-Type":on.FORM_URL_ENCODED};this.basicAuth&&(r.Authorization=`Basic ${this.basicAuth}`),this.credentialsInHeader&&(n.delete("client_id"),n.delete("client_secret"),!this.basicAuth&&t.client_id&&t.client_secret&&(r.Authorization=`Basic ${cT(t.client_id+":"+t.client_secret)}`));const o={method:"POST",headers:r,body:n.toString(),credentials:"include"};let s;try{s=await this.fetchWithRetry(this.tokenUrl,o)}catch(d){throw this.refreshPromise=void 0,d}if(!s.ok){this.clearActiveLogin(),this.onUnauthenticated?.();try{const d=await s.json();throw new ft(jo(d.error_description))}catch(d){throw new ft(jo("Failed to fetch tokens"),{cause:d})}}const c=await s.json();return await this.verifyTokens(c),this.getProfile()}async verifyTokens(t){const n=t.access_token;if(hV(n)){const r=K0(n);if(Date.now()>=r.exp*1e3)throw this.clearActiveLogin(),new ft(P8);if(r.cid){if(r.cid!==this.clientId)throw this.clearActiveLogin(),new ft(YE)}else if(this.clientId&&r.client_id!==this.clientId)throw this.clearActiveLogin(),new ft(YE)}return this.setActiveLogin({accessToken:n,refreshToken:t.refresh_token,project:t.project,profile:t.profile})}checkSessionDetailsMatchLogin(t){return this.sessionDetails&&t?t.profile?.reference?.endsWith(this.sessionDetails.profile.id)??!1:!0}setupStorageListener(){try{window.addEventListener("storage",t=>{if(t.key===null)rr.reload();else if(t.key===this.storage.makeKey("activeLogin")){const n=t.oldValue?JSON.parse(t.oldValue):void 0,r=t.newValue?JSON.parse(t.newValue):void 0;n?.profile.reference!==r?.profile.reference||!this.checkSessionDetailsMatchLogin(r)?rr.reload():r?this.setAccessToken(r.accessToken,r.refreshToken):this.clear()}})}catch{}}getSubscriptionManager(){return this.subscriptionManager||(this.subscriptionManager=new jV(this,jU(this.baseUrl,"/ws/subscriptions-r4"))),this.subscriptionManager}subscribeToCriteria(t,n){return this.getSubscriptionManager().addCriteria(t,n)}unsubscribeFromCriteria(t,n){this.subscriptionManager&&(this.subscriptionManager.removeCriteria(t,n),this.subscriptionManager.getCriteriaCount()===0&&this.subscriptionManager.closeWebSocket())}getMasterSubscriptionEmitter(){return this.getSubscriptionManager().getMasterEmitter()}}function NV(){if(!globalThis.fetch)throw new Error("Fetch not available in this environment");return globalThis.fetch.bind(globalThis)}async function gT(e,t){const n=e.headers.get("content-location");if(n)return n;const r=e.headers.get("location");if(r)return r;if(Cm(t)&&t.issue?.[0]?.diagnostics)return t.issue[0].diagnostics}function vT(e){const t=e.entry?.map(n=>n.resource)??[];return Object.assign(t,{bundle:e})}function OV(e){return fr(e)&&"data"in e&&"contentType"in e}function yT(e,t,n,r){return OV(e)?e:{data:e,filename:t,contentType:n,onProgress:r}}function MV(e){return fr(e)&&"docDefinition"in e}function LV(e,t,n,r){return MV(e)?e:{docDefinition:e,filename:t,tableLayouts:n,fonts:r}}function IV(e){return e.status===429||e.status>=500}function Uc({parentContext:e,path:t,elements:n,profileUrl:r,debugMode:o,accessPolicyResource:s}){if(t===e?.path)return;o??=e?.debugMode??!1,s??=e?.accessPolicyResource;let c=zV(t,n,e,!!o);const d=wx(t,".",2)[1];c=$V(c,s,d),c=UV(c,s,d);const f=Object.create(null);for(const[m,g]of Object.entries(c))f[t+"."+m]=g;let p;if(e&&!e.isDefaultContext)p=e.getExtendedProps;else{const m=Object.create(null);p=g=>{const y=wx(g,".",2)[1];if(y){if(!m[y]){const b=vp(y,s?.hiddenFields);m[y]={hidden:b,readonly:b||vp(y,s?.readonlyFields)}}return m[y]}}}return{path:t,elements:c,elementsByPath:f,profileUrl:r??e?.profileUrl,debugMode:o,getExtendedProps:p,accessPolicyResource:s}}function zV(e,t,n,r){const o=Object.create(null);if(n)for(const[c,d]of Object.entries(n.elementsByPath)){const f=Xs(e,c);f!==void 0&&(o[f]=d)}let s=!1;if(t)for(const[c,d]of Object.entries(t))c in o||(o[c]=d,s=!0);return r&&console.assert(s,"Unnecessary ElementsContext; not using any newly provided elements"),o}function $V(e,t,n){if(!t?.hiddenFields?.length)return e;const r=n?n+".":"";return Object.fromEntries(Object.entries(e).filter(([o])=>!vp(r+o,t.hiddenFields)))}function UV(e,t,n){if(!t?.readonlyFields?.length)return e;const r=Object.create(null),o=n?n+".":"";for(const[s,c]of Object.entries(e))vp(o+s,t.readonlyFields)?r[s]={...c,readonly:!0}:r[s]=c;return r}function vp(e,t){if(!t?.length)return!1;const n=e.split(".");for(let r=1;r<=n.length;r++){const o=n.slice(0,r).join(".");if(t.includes(o))return!0}return!1}function VA(e){return e.type!==void 0&&e.type.length>0}function BV(e,t,n,r){const o=Y$(e,t.path,{profileUrl:r});if(o){const s=n.typeSchema?.elements??n.elements;return o.some(c=>X$(c,t,n,s))??!1}return console.assert(!1,"getNestedProperty[%s] in isDiscriminatorComponentMatch missed",t.path),!1}function FA(e,t,n,r){if(e)for(const o of t){const s={value:e,type:o.typeSchema?.type??o.type?.[0].code};if(n.every(c=>BV(s,c,o,o.typeSchema?.url??r)))return o.name}}class VV{rootSchema;visitor;elementsContextStack;sliceAllowList;constructor(t,n,r){if(t.type===void 0)throw new Error("schema must include a type");this.rootSchema=t;const o=Uc({parentContext:void 0,path:this.rootSchema.type,elements:r??this.rootSchema.elements,profileUrl:this.rootSchema.name===this.rootSchema.type?void 0:this.rootSchema.url});if(o===void 0)throw new Error("Could not create root elements context");this.elementsContextStack=[o],this.visitor=n}get elementsContext(){return this.elementsContextStack.at(-1)}crawlElement(t,n,r){this.visitor.onEnterSchema&&this.visitor.onEnterSchema(this.rootSchema);const o=Object.fromEntries(Object.entries(this.elementsContext.elements).filter(([s])=>s.startsWith(n)));this.crawlElementsImpl(o,r),this.visitor.onExitSchema&&this.visitor.onExitSchema(this.rootSchema)}crawlSlice(t,n,r){const o=this.prepareSlices(r.slices,r);if(!Pn(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=FV(t);for(const o of r)this.crawlElementNode(o,n)}crawlElementNode(t,n){const r=n+"."+t.key;this.visitor.onEnterElement&&this.visitor.onEnterElement(r,t.element,this.elementsContext);for(const o of t.children)this.crawlElementNode(o,n);Pn(t.element?.slicing?.slices)&&this.crawlSlicingImpl(t.element.slicing,r),this.visitor.onExitElement&&this.visitor.onExitElement(r,t.element,this.elementsContext)}prepareSlices(t,n){const r=[];for(const s of t){if(!VA(s))continue;const c=s.type.find(d=>Pn(d.profile))?.profile?.[0];if(Pn(c)){const d=tu(c);d&&(s.typeSchema=d)}r.push(s)}return{...n,slices:r}}crawlSlicingImpl(t,n){const r=this.prepareSlices(t.slices,t);for(const o of r.slices)(this.sliceAllowList===void 0||this.sliceAllowList.includes(o))&&this.crawlSliceImpl(o,n,r)}crawlSliceImpl(t,n,r){const o=t.typeSchema;o&&this.visitor.onEnterSchema&&this.visitor.onEnterSchema(o),this.visitor.onEnterSlice&&this.visitor.onEnterSlice(n,t,r);let s;const c=o?.elements??t.elements;Pn(c)&&(s=Uc({path:n,parentContext:this.elementsContext,elements:c})),s&&this.elementsContextStack.push(s),this.crawlElementsImpl(c,n),s&&this.elementsContextStack.pop(),this.visitor.onExitSlice&&this.visitor.onExitSlice(n,t,r),o&&this.visitor.onExitSchema&&this.visitor.onExitSchema(o)}}function FV(e){const t=[];function n(s,c){return c.startsWith(s+".")}function r(s,c){for(const d of s.children)if(n(d.key,c.key)){r(d,c);return}s.children.push(c)}const o=Object.entries(e);o.sort((s,c)=>s[0].localeCompare(c[0]));for(const[s,c]of o){const d={key:s,element:c,children:[]};let f=!1;for(const p of t)if(n(p.key,s)){r(p,d),f=!0;break}f||t.push(d)}return t}const ky="__sliceName";function HV(e,t){const n=new qV(e,e.resourceType,"resource");return new VV(t,n).crawlResource(),n.getDefaultValue()}function xT(e,t,n){for(const[r,o]of Object.entries(t)){if(n===void 0||n===r){yp(e,r,o,t);continue}const s=Xs(n,r);s!==void 0&&yp(e,s,o,t)}return e}class qV{rootValue;schemaStack;valueStack;constructor(t,n,r){this.schemaStack=[],this.valueStack=[],this.rootValue=fi(t),this.valueStack.splice(0,this.valueStack.length,{type:r,path:n,values:[this.rootValue]})}get schema(){return this.schemaStack.at(-1)}get value(){return this.valueStack.at(-1)}onEnterSchema(t){this.schemaStack.push(t)}onExitSchema(){this.schemaStack.pop()}onEnterElement(t,n,r){const o=this.value.values,s=this.value.path,c=Xs(s,t);if(c===void 0)throw new Error(`Expected ${t} to be prefixed by ${s}`);const d=[];for(const f of o){if(f===void 0)continue;const p=Xs(r.path,s),m=Array.isArray(f)?f:[f];for(const g of m){GV(g,c,n,r.elements,p),yp(g,c,n,r.elements);const y=Tx(g,c,r.elements,p);y!==void 0&&d.push(y)}}this.valueStack.push({type:"element",path:t,values:d})}onExitElement(t,n,r){if(!this.valueStack.pop())throw new Error("Expected value context to exist when exiting element");const s=Xs(this.value.path,t);if(s===void 0)throw new Error(`Expected ${t} to be prefixed by ${this.value.path}`);const c=Xs(r.path,this.value.path);for(const d of this.value.values){const f=Tx(d,s,r.elements,c);if(Array.isArray(f))for(let p=f.length-1;p>=0;p--){const m=f[p];Pn(m)||f.splice(p,1)}wn(f)&&Ex(d,void 0,s,n)}}onEnterSlice(t,n,r){const o=this.value.values,s=[];for(const c of o)if(c!==void 0){const d=Array.isArray(c)?c:[c],f=this.getMatchingSliceValues(d,n,r);s.push(f)}this.valueStack.push({type:"slice",path:t,values:s})}getMatchingSliceValues(t,n,r){const o=[];for(const s of t)(s[ky]??FA(s,[n],r.discriminator,this.schema.url))===n.name&&o.push(s);for(let s=o.length;s<n.min;s++)if(z0(n.type[0].code)){const c=Object.create(null);o.push(c),t.push(c)}return o}onExitSlice(){const t=this.valueStack.pop();if(!t)throw new Error("Expected value context to exist in onExitSlice");for(const n of t.values)for(let r=n.length-1;r>=0;r--){const o=n[r];ky in o&&delete o[ky]}}getDefaultValue(){return this.rootValue}}function GV(e,t,n,r,o){const s=Tx(e,t,r,o);n.min>0&&s===void 0&&z0(n.type[0].code)&&(n.isArray?Ex(e,[Object.create(null)],t,n):Ex(e,Object.create(null),t,n))}function Ex(e,t,n,r){if(n.includes("."))throw new Error("key cannot be nested");let o=n;if(n.includes("[x]")){const s=r.type[0].code;o=n.replace("[x]",qn(s))}t===void 0?delete e[o]:e[o]=t}function Tx(e,t,n,r){const o=t.split(".");let s=e,c;for(let d=0;d<o.length;d++){let f=o[d];if(f.includes("[x]")){const p=(r?r+".":"")+o.slice(0,d+1).join("."),g=n[p].type[0].code;f=f.replace("[x]",qn(g))}if(d===o.length-1){Array.isArray(s)?c=s.map(p=>p[f]):c=s[f];continue}if(Array.isArray(s))s=s.map(p=>p[f]);else if(fr(s)){if(s[f]===void 0)return;s=s[f]}else return}return c}function yp(e,t,n,r){if(!(n.fixed||n.pattern))return e;if(Array.isArray(e))return e.map(d=>yp(d,t,n,r));e==null&&(e=Object.create(null));const o=e,s=t.split(".");let c=o;for(let d=0;d<s.length;d++){let f=s[d];if(f.includes("[x]")){const m=r[s.slice(0,d+1).join(".")].type[0].code;f=f.replace("[x]",qn(m))}if(d===s.length-1){const p=Array.isArray(c)?c:[c];for(const m of p)n.fixed?m[f]??=n.fixed.value:n.pattern&&(m[f]=HA(m[f],n.pattern.value))}else{if(!(f in c)){const p=s.slice(0,d+1).join(".");c[f]=r[p].isArray?[Object.create(null)]:Object.create(null)}c=c[f]}}return o}function HA(e,t){if(Array.isArray(t)&&(Array.isArray(e)||e===void 0))return(e?.length??0)>0?e:fi(t);if(fr(t)&&(fr(e)&&!Array.isArray(e)||e===void 0)){const n=fi(e)??Object.create(null);for(const r of Object.keys(t))n[r]=HA(n[r],t[r]);return n}return e}const yr={BOOLEAN:"BOOLEAN",NUMBER:"NUMBER",QUANTITY:"QUANTITY",TEXT:"TEXT",REFERENCE:"REFERENCE",CANONICAL:"CANONICAL",DATE:"DATE",DATETIME:"DATETIME"};function Pm(e,t){let n=Do.types[e]?.searchParamsDetails?.[t.code];return n||(n=QV(e,t)),n}function WV(e,t,n){let r=Do.types[e];r||(r={},Do.types[e]=r),r.searchParamsDetails||(r.searchParamsDetails={}),r.searchParamsDetails[t]=n}function QV(e,t){const n=t.code,r=JV(e,t.expression),o={elementDefinitions:[],propertyTypes:new Set,array:!1};for(const c of r){const d=Kh(c),f=SU(()=>d.join("."));d.length===1&&d[0]instanceof Xr?o.propertyTypes.add("boolean"):t.code.endsWith(":identifier")?o.propertyTypes.add("Identifier"):f().endsWith("extension.value.code")||f().endsWith("extension.value.coding.code")?(o.array=!0,o.propertyTypes.clear(),o.propertyTypes.add("code")):qA(o,d,e,1),f().endsWith("extension.valueDateTime")&&(o.array=!1,o.propertyTypes.clear(),o.propertyTypes.add("dateTime"))}const s={type:XV(t,o.propertyTypes),elementDefinitions:o.elementDefinitions.map(c=>({...c,type:c.type?.filter(d=>o.propertyTypes.has(d.code))})).filter(c=>c.type&&c.type.length>0),parsedExpression:ZV(e,t.expression),array:o.array};return WV(e,n,s),s}function qA(e,t,n,r){const o=t[r];if(o instanceof gp){e.propertyTypes.add(o.right.toString());return}if(o instanceof H0){YV(e,o);return}const s=o.toString(),c=xs(n,s);if(!c)throw new Error(`Element definition not found for ${n} ${s}`);let d=!1,f=r+1;f<t.length&&t[f]instanceof q0&&(d=!0,f++);const p=t[f];if(c.isArray&&!d&&(e.array=!0),f===t.length-1&&p instanceof gp){e.elementDefinitions.push(c),e.propertyTypes.add(p.right.toString());return}if(f>=t.length){e.elementDefinitions.push(c);for(const m of c.type)e.propertyTypes.add(m.code);return}for(const m of c.type){let g=m.code;KV(g)&&(g=c.type[0].code),qA(e,t,g,f)}}function YV(e,t){if(t.name==="as"){e.propertyTypes.add(t.args[0].toString());return}if(t.name==="ofType"){e.propertyTypes.add(t.args[0].toString());return}if(t.name==="resolve"){e.propertyTypes.add("string");return}if(t.name==="where"&&t.args[0]instanceof F0){e.propertyTypes.add(t.args[0].right.toString());return}throw new Error(`Unhandled FHIRPath function: ${t.name}`)}function KV(e){return e==="Element"||e==="BackboneElement"}function XV(e,t){switch(e.type){case"date":return t.size===1&&t.has(ne.date)?yr.DATE:yr.DATETIME;case"number":return yr.NUMBER;case"quantity":return yr.QUANTITY;case"reference":return t.has(ne.canonical)?yr.CANONICAL:yr.REFERENCE;case"token":return t.size===1&&t.has(ne.boolean)?yr.BOOLEAN:yr.TEXT;default:return yr.TEXT}}function JV(e,t){const n=[],r=G0(t);return xp(e,r.child,n),n}function ZV(e,t){const n=[],r=G0(t);if(xp(e,r.child,n),n.length===0)return r;let o=n[0];for(let s=1;s<n.length;s++)o=new V0(o,n[s]);return new DA("<original-not-available>",o)}function xp(e,t,n){t instanceof V0?(xp(e,t.left,n),xp(e,t.right,n)):t.toString().includes(e+".")&&n.push(t)}function Kh(e){if(e instanceof gp||e instanceof q0)return[Kh(e.left),e].flat();if(e instanceof Xr)return[e];if(e instanceof B0)return[Kh(e.left),Kh(e.right)].flat();if(e instanceof H0){if(e.name==="where"&&!(e.args[0]instanceof F0))return[];if(e.name==="last")return[]}return[e]}const eF="https://meta.medplum.com/releases",Py=new Map;function tF(e){const t=e;if(!t.tag_name)throw new Error("Manifest missing tag_name");const n=t.assets;if(!n?.length)throw new Error("Manifest missing assets list");for(const r of n){if(!r.browser_download_url)throw new Error("Asset missing browser download URL");if(!r.name)throw new Error("Asset missing name")}}async function nF(e,t,n){let r=Py.get("latest");if(!r){const o="latest",s=new URL(`${eF}/${o}.json`);s.searchParams.set("a",e),s.searchParams.set("c",UA);const c=await fetch(s.toString());if(c.status!==200){let f;try{f=(await c.json()).message}catch(p){console.error(`Failed to parse message from body: ${Ge(p)}`)}throw new Error(`Received status code ${c.status} while fetching manifest for version 'latest'. Message: ${f}`)}const d=await c.json();tF(d),r=d,Py.set("latest",r),Py.set(r.tag_name.slice(1),r)}return r}async function rF(e){const t=await nF(e);if(!t.tag_name.startsWith("v"))throw new Error(`Invalid release name found. Release tag '${t.tag_name}' did not start with 'v'`);return t.tag_name.slice(1)}const GA=v.createContext(void 0);function Nm(){return v.useContext(GA)}function Re(){return Nm().medplum}function Om(){return Nm().navigate}function Mm(){return Nm().profile}const bT=["change","storageInitialized","storageInitFailed","profileRefreshing","profileRefreshed"];function iF(e){const t=e.medplum,n=e.navigate??oF,[r,o]=v.useState({profile:t.getProfile(),loading:t.isLoading()});v.useEffect(()=>{function c(){o(d=>({...d,profile:t.getProfile(),loading:t.isLoading()}))}for(const d of bT)t.addEventListener(d,c);return()=>{for(const d of bT)t.removeEventListener(d,c)}},[t]);const s=v.useMemo(()=>({...r,medplum:t,navigate:n}),[r,t,n]);return a.jsx(GA.Provider,{value:s,children:e.children})}function oF(e){window.location.assign(e)}const ST=new Map,WA=e=>v.useMemo(()=>{if(!e)return;const t=e.split("?")[0];if(!t)return e;let n;try{n=new URLSearchParams(new URL(e).search)}catch{return e}if(!n.has("Key-Pair-Id")||!n.has("Signature"))return e;const r=n.get("Expires");if(!r||r.length>13)return e;const o=ST.get(t);if(o){const c=new URLSearchParams(new URL(o).search).get("Expires");if(c&&Number.parseInt(c,10)*1e3-5e3>Date.now())return o}return ST.set(t,e),e},[e]);function Kt(e,t){const n=Re(),[r,o]=v.useState(()=>wT(n,e)),s=v.useCallback(c=>{_o(c,r)||o(c)},[r]);return v.useEffect(()=>{let c=!0;const d=wT(n,e);return!d&&Ta(e)?n.readReference(e).then(f=>{c&&s(f)}).catch(f=>{c&&(s(void 0),t&&t(Yt(f)))}):s(d),(()=>c=!1)},[n,e,s,t]),r}function wT(e,t){if(t){if(Io(t))return t;if(Ta(t))return e.getCachedReference(t)}}const Ct={group:"group",display:"display",boolean:"boolean",decimal:"decimal",integer:"integer",date:"date",dateTime:"dateTime",time:"time",string:"string",text:"text",url:"url",choice:"choice",openChoice:"open-choice",attachment:"attachment",reference:"reference",quantity:"quantity"},X0=`${io}/fhir/StructureDefinition/questionnaire-itemControl`,aF=`${io}/fhir/StructureDefinition/questionnaire-referenceFilter`,Rx=`${io}/fhir/StructureDefinition/questionnaire-referenceResource`,sF=`${io}/fhir/StructureDefinition/questionnaire-validationError`,lF=`${io}/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression`,cF=`${io}/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression`,uF=`${io}/fhir/StructureDefinition/questionnaire-signatureRequired`,Xh=`${io}/fhir/StructureDefinition/questionnaireresponse-signature`;function dF(e){return e.type==="choice"||e.type==="open-choice"}function fF(e,t){const n=hF(e,t);return n!==void 0?n:pF(e,t)}function hF(e,t){const n=Lo(e,lF);if(t&&n){const r=n.valueExpression?.expression;if(r){const o=di(t),s=fs(r,[o],{"%resource":o});return bo(s)}}}function pF(e,t){if(!e.enableWhen)return!0;const n=e.enableBehavior??"any";for(const r of e.enableWhen){const o=KA(t?.item,r.question);if(r.operator==="exists"&&!r.answerBoolean&&!o?.length){if(n==="any")return!0;continue}const{anyMatch:s,allMatch:c}=bF(r,o,n);if(n==="any"&&s)return!0;if(n==="all"&&!c)return!1}return n!=="any"}function QA(e,t,n=t.item){for(const r of e){const o=n?.find(s=>s.linkId===r.linkId);o&&(mF(t,r,o),r.item&&o.item&&QA(r.item,t,o.item))}}function mF(e,t,n){try{const r=yF(t,e);if(!r)return;const o=vF(t,r);if(!o)return;n.answer=[o]}catch(r){n.extension=[{url:sF,valueString:`Expression evaluation failed: ${Ge(r)}`}]}}const gF={[Ct.boolean]:[ne.boolean],[Ct.date]:[ne.date],[Ct.dateTime]:[ne.dateTime],[Ct.time]:[ne.time],[Ct.url]:[ne.string,ne.uri,ne.url],[Ct.attachment]:[ne.Attachment],[Ct.reference]:[ne.Reference],[Ct.quantity]:[ne.Quantity],[Ct.decimal]:[ne.decimal,ne.integer],[Ct.integer]:[ne.decimal,ne.integer]};function vF(e,t){if(!e.type)return;if(e.type===Ct.choice||e.type===Ct.openChoice)return{[`value${qn(t.type)}`]:t.value};if(e.type===Ct.string||e.type===Ct.text)return typeof t.value=="string"?{valueString:t.value}:void 0;if(gF[e.type]?.includes(t.type))return{[`value${qn(e.type)}`]:t.value}}function yF(e,t){if(!t)return;const n=Lo(e,cF);if(n){const r=n.valueExpression?.expression;if(r){const o=di(t),s=fs(r,[o],{"%resource":o});return s.length!==0?s[0]:void 0}}}function YA(e,t,n){const r=[];for(const o of e){const s=n.answerOption?.find(c=>ll(Ao(c))===o);if(s){const c=Ao(s);c&&r.push({[t]:c.value})}}return r}function KA(e,t){if(e)for(const n of e){if(n.linkId===t)return n.answer;if(n.item){const r=KA(n.item,t);if(r)return r}}}function xF(e,t,n){if(n==="exists")return!!e===t.value;if(e){const r=n==="="||n==="!="?n?.replace("=","~"):n,[{value:o}]=fs(`%actualAnswer ${r} %expectedAnswer`,[e],{"%actualAnswer":e,"%expectedAnswer":t});return o}else return!1}function bF(e,t,n){const r=t||[],o=jF(e);let s=!1,c=!0;for(const d of r){const f=CF(d),{operator:p}=e;if(xF(f,o,p)?s=!0:c=!1,n==="any"&&s)break}return{anyMatch:s,allMatch:c}}function XA(e){const t=Lo(e,Rx);if(t){if(t.valueCode!==void 0)return[t.valueCode];if(t.valueCodeableConcept)return t.valueCodeableConcept?.coding?.map(n=>n.code)}}function Ny(e,t){const n=fi(e);let r=Lo(n,Rx);return!t||t.length===0?(r&&(n.extension=n.extension?.filter(o=>o!==r)),n):(r||(n.extension??=[],r={url:Rx},n.extension.push(r)),t.length===1?(r.valueCode=t[0],delete r.valueCodeableConcept):(r.valueCodeableConcept={coding:t.map(o=>({code:o}))},delete r.valueCode),n)}function SF(e,t,n){const r=Lo(e,aF);if(!r?.valueString)return;let o=r.valueString;t?.reference&&(o=o.replaceAll("$subj",t.reference)),n?.reference&&(o=o.replaceAll("$encounter",n.reference));const s={},c=o.split("&");for(const d of c){const[f,p]=wx(d,"=",2);s[f]=p}return s}function jT(e,t){return{resourceType:"QuestionnaireResponse",questionnaire:e.url??Ot(e),item:J0(e.item,t?.item),status:"in-progress"}}function J0(e,t){if(!e)return;const n=[];for(const r of e){if(r.type===Ct.display)continue;const o=t?.filter(s=>s.linkId===r.linkId);if(o&&o?.length>0)for(const s of o)s.id=s.id??ZA(),s.text=s.text??r.text,s.item=J0(r.item,s.item),s.answer=ek(r,s),n.push(s);else n.push(JA(r))}return n}function JA(e){return{id:ZA(),linkId:e.linkId,text:e.text,item:J0(e.item,void 0),answer:ek(e)}}let wF=1;function ZA(){return"id-"+wF++}function ek(e,t){if(!(e.type===Ct.display||e.type===Ct.group)){if(t?.answer&&t.answer.length>0)return t.answer;if(e.initial&&e.initial.length>0)return e.initial.map(n=>({...n}));if(e.answerOption)return e.answerOption.filter(n=>n.initialSelected).map(n=>({...n,initialSelected:void 0}))}}function Z0(e){return Yd({value:e},"value")}function Ao(e){return Yd({value:e},"value")}function jF(e){return Yd({value:e},"answer")}function CF(e){return Yd({value:e},"value")}function EF(e){const t=Kt(e.questionnaire),n=Kt(e.defaultValue),[,r]=v.useReducer(w=>w+1,0),o=v.useRef({activePage:0});if(!o.current.questionnaire&&t&&(o.current.questionnaire=t,o.current.pages=e.disablePagination?void 0:TF(t)),t&&e.defaultValue&&n&&!o.current.questionnaireResponse&&(o.current.questionnaireResponse=jT(t,n),b()),t&&!e.defaultValue&&!o.current.questionnaireResponse&&(o.current.questionnaireResponse=jT(t),b()),!o.current.questionnaire||!o.current.questionnaireResponse)return{loading:!0};function s(w,j){let C=o.current.questionnaireResponse;for(const R of w)C=C?.item?.find(T=>R.id?T.id===R.id:T.linkId===R.linkId);return j&&(C=C?.item?.find(R=>R.linkId===j.linkId)),C}function c(){o.current.activePage=(o.current.activePage??0)+1,r()}function d(){o.current.activePage=(o.current.activePage??0)-1,r()}function f(w,j){const C=s(w);C&&(C.item??=[],C.item.push(JA(j)),b())}function p(w,j){const C=s(w,j);C&&(C.answer??=[],C.answer.push({}),b())}function m(w,j,C){const R=s(w,j);R&&(R.answer=C,b())}function g(w){const j=o.current.questionnaireResponse;j&&(w?(j.extension=j.extension??[],j.extension=j.extension.filter(C=>C.url!==Xh),j.extension.push({url:Xh,valueSignature:w})):j.extension=j.extension?.filter(C=>C.url!==Xh),b())}function y(){const w=o.current.questionnaire;if(w?.item){const j=o.current.questionnaireResponse;QA(w.item,j)}}function b(){const w=o.current.questionnaireResponse;w&&(y(),r(),e.onChange?.(w))}return{loading:!1,pagination:!!o.current.pages,questionnaire:o.current.questionnaire,questionnaireResponse:o.current.questionnaireResponse,subject:e.subject,encounter:e.encounter,activePage:o.current.activePage,pages:o.current.pages,items:RF(o.current.questionnaire,o.current.pages,o.current.activePage),responseItems:_F(o.current.questionnaireResponse,o.current.pages,o.current.activePage),onNextPage:c,onPrevPage:d,onAddGroup:f,onAddAnswer:p,onChangeAnswer:m,onChangeSignature:g}}function TF(e){if(!(!e?.item||Lo(e?.item?.[0],X0)?.valueCodeableConcept?.coding?.[0]?.code!=="page"))return e.item.map((n,r)=>({linkId:n.linkId,title:n.text??`Page ${r+1}`,group:n}))}function RF(e,t,n=0){return t&&e?.item?.[n]?[e.item[n]]:e.item??[]}function _F(e,t,n=0){return t&&e?.item?.[n]?[e.item[n]]:e.item??[]}function DF(e,t,n={leading:!1}){const[r,o]=v.useState(e),s=v.useRef(!1),c=v.useRef(void 0),d=v.useRef(!1),f=v.useCallback(()=>window.clearTimeout(c.current),[]);return v.useEffect(()=>{s.current&&(!d.current&&n.leading?(d.current=!0,o(e)):(f(),c.current=setTimeout(()=>{d.current=!1,o(e)},t)))},[e,n.leading,t,f]),v.useEffect(()=>(s.current=!0,f),[f]),[r,f]}const AF=250;function kF(e,t,n){return tk("searchOne",e,t)}function Bc(e,t,n){return tk("searchResources",e,t)}function tk(e,t,n,r){const o=Re(),[s,c]=v.useState(),[d,f]=v.useState(!0),[p,m]=v.useState(),[g,y]=v.useState(),b=o.fhirSearchUrl(t,n).toString(),[w]=DF(b,AF,{leading:!0});return v.useEffect(()=>{w!==s&&(c(w),o[e](t,n).then(j=>{f(!1),m(j),y(A8)}).catch(j=>{f(!1),m(void 0),y(Yt(j))}))},[o,e,t,n,s,w]),[p,d,g]}function PF(e){const t=e.value;return t?a.jsx(a.Fragment,{children:CA(t)}):null}const nk=["meta","implicitRules","contained","extension","modifierExtension"],rk=["language","text"],dn=v.createContext({path:"",profileUrl:void 0,elements:Object.create(null),elementsByPath:Object.create(null),getExtendedProps:()=>({readonly:!1,hidden:!1}),accessPolicyResource:void 0,debugMode:!1,isDefaultContext:!0});dn.displayName="ElementsContext";const eS=["extension","modifierExtension"],NF=["id",...nk].filter(e=>!eS.includes(e));function OF(e){return Object.entries(e).filter(([n,r])=>!Pn(r.type)||r.max===0||r.path.toLowerCase().endsWith("extension.url")&&r.fixed||eS.includes(n)&&!Pn(r.slicing?.slices)||NF.includes(n)?!1:!(rk.includes(n)&&r.path.split(".").length===2||n.includes(".")))}function CT(e,t){return e.line&&e.line.length>t?e.line[t]:""}function ET(e,t,n){const r=e.line||[];for(;r.length<=t;)r.push("");return r[t]=n,{...e,line:uU(r)}}function MF(e){const[t,n]=v.useState(e.defaultValue||{}),r=v.useRef(t);r.current=t;const{getExtendedProps:o}=v.useContext(dn),[s,c,d,f,p,m,g]=v.useMemo(()=>["use","type","line1","line2","city","state","postalCode"].map(_=>o(e.path+"."+_)),[o,e.path]);function y(_){n(_),e.onChange&&e.onChange(_)}function b(_){y({...r.current,use:_})}function w(_){y({...r.current,type:_})}function j(_){y(ET(r.current||{},0,_))}function C(_){y(ET(r.current||{},1,_))}function R(_){y({...r.current,city:_})}function T(_){y({...r.current,state:_})}function E(_){y({...r.current,postalCode:_})}return a.jsxs(xe,{gap:"xs",wrap:"nowrap",grow:!0,children:[a.jsx(un,{disabled:e.disabled||s?.readonly,"data-testid":"address-use",defaultValue:t.use,onChange:_=>b(_.currentTarget.value),data:["","home","work","temp","old","billing"]}),a.jsx(un,{disabled:e.disabled||c?.readonly,"data-testid":"address-type",defaultValue:t.type,onChange:_=>w(_.currentTarget.value),data:["","postal","physical","both"]}),a.jsx(Fe,{disabled:e.disabled||d?.readonly,placeholder:"Line 1",defaultValue:CT(t,0),onChange:_=>j(_.currentTarget.value)}),a.jsx(Fe,{disabled:e.disabled||f?.readonly,placeholder:"Line 2",defaultValue:CT(t,1),onChange:_=>C(_.currentTarget.value)}),a.jsx(Fe,{disabled:e.disabled||p?.readonly,placeholder:"City",defaultValue:t.city,onChange:_=>R(_.currentTarget.value)}),a.jsx(Fe,{disabled:e.disabled||m?.readonly,placeholder:"State",defaultValue:t.state,onChange:_=>T(_.currentTarget.value)}),a.jsx(Fe,{disabled:e.disabled||g?.readonly,placeholder:"Postal Code",defaultValue:t.postalCode,onChange:_=>E(_.currentTarget.value)})]})}function LF(e){const t=Mm(),[n,r]=v.useState(e.defaultValue||{});function o(s){const c=s?{text:s,authorReference:t&&Wt(t),time:new Date().toISOString()}:{};r(c),e.onChange&&e.onChange(c)}return a.jsx(Fe,{disabled:e.disabled,name:e.name,placeholder:"Annotation text",defaultValue:n.text,onChange:s=>o(s.currentTarget.value)})}var IF={outline:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"},filled:{xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"currentColor",stroke:"none"}};const He=(e,t,n,r)=>{const o=v.forwardRef(({color:s="currentColor",size:c=24,stroke:d=2,title:f,className:p,children:m,...g},y)=>v.createElement("svg",{ref:y,...IF[e],width:c,height:c,className:["tabler-icon",`tabler-icon-${t}`,p].join(" "),...e==="filled"?{fill:s}:{strokeWidth:d,stroke:s},...g},[f&&v.createElement("title",{key:"svg-title"},f),...r.map(([b,w])=>v.createElement(b,w)),...Array.isArray(m)?m:[m]]));return o.displayName=`${n}`,o};const zF=[["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"}]],$F=He("outline","adjustments-horizontal","AdjustmentsHorizontal",zF);const UF=[["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"}]],bs=He("outline","alert-circle","AlertCircle",UF);const BF=[["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"}]],VF=He("outline","arrow-down","ArrowDown",BF);const FF=[["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"}]],HF=He("outline","arrow-up","ArrowUp",FF);const qF=[["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"}]],GF=He("outline","bleach-off","BleachOff",qF);const WF=[["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"}]],QF=He("outline","bleach","Bleach",WF);const YF=[["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"}]],KF=He("outline","box-multiple","BoxMultiple",YF);const XF=[["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"}]],JF=He("outline","brackets-contain","BracketsContain",XF);const ZF=[["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"}]],eH=He("outline","brand-asana","BrandAsana",ZF);const tH=[["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"}]],nH=He("outline","bucket-off","BucketOff",tH);const rH=[["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"}]],iH=He("outline","bucket","Bucket",rH);const oH=[["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"}]],aH=He("outline","building","Building",oH);const sH=[["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"}]],es=He("outline","calendar","Calendar",sH);const lH=[["path",{d:"M5 12l5 5l10 -10",key:"svg-0"}]],zo=He("outline","check","Check",lH);const cH=[["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"}]],uH=He("outline","checkbox","Checkbox",cH);const dH=[["path",{d:"M6 9l6 6l6 -6",key:"svg-0"}]],tS=He("outline","chevron-down","ChevronDown",dH);const fH=[["path",{d:"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0",key:"svg-0"}],["path",{d:"M9 12l2 2l4 -4",key:"svg-1"}]],hH=He("outline","circle-check","CircleCheck",fH);const pH=[["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"}]],bp=He("outline","circle-minus","CircleMinus",pH);const mH=[["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"}]],Sp=He("outline","circle-plus","CirclePlus",mH);const gH=[["path",{d:"M7 18a4.6 4.4 0 0 1 0 -9a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-1",key:"svg-0"}],["path",{d:"M9 15l3 -3l3 3",key:"svg-1"}],["path",{d:"M12 12l0 9",key:"svg-2"}]],nS=He("outline","cloud-upload","CloudUpload",gH);const vH=[["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"}]],yH=He("outline","columns","Columns",vH);const xH=[["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"}]],rS=He("outline","copy","Copy",xH);const bH=[["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"}]],SH=He("outline","currency-dollar","CurrencyDollar",bH);const wH=[["path",{d:"M12 6m-8 0a8 3 0 1 0 16 0a8 3 0 1 0 -16 0",key:"svg-0"}],["path",{d:"M4 6v6a8 3 0 0 0 16 0v-6",key:"svg-1"}],["path",{d:"M4 12v6a8 3 0 0 0 16 0v-6",key:"svg-2"}]],jH=He("outline","database","Database",wH);const CH=[["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"}]],EH=He("outline","device-floppy","DeviceFloppy",CH);const TH=[["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"}]],RH=He("outline","dots","Dots",TH);const _H=[["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"}]],ik=He("outline","edit","Edit",_H);const DH=[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}],["path",{d:"M5 19l14 -14",key:"svg-2"}]],Xd=He("outline","equal-not","EqualNot",DH);const AH=[["path",{d:"M5 10h14",key:"svg-0"}],["path",{d:"M5 14h14",key:"svg-1"}]],Jd=He("outline","equal","Equal",AH);const kH=[["path",{d:"M10.585 10.587a2 2 0 0 0 2.829 2.828",key:"svg-0"}],["path",{d:"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87",key:"svg-1"}],["path",{d:"M3 3l18 18",key:"svg-2"}]],PH=He("outline","eye-off","EyeOff",kH);const NH=[["path",{d:"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0",key:"svg-0"}],["path",{d:"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6",key:"svg-1"}]],OH=He("outline","eye","Eye",NH);const MH=[["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"}]],TT=He("outline","file-alert","FileAlert",MH);const LH=[["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"}]],IH=He("outline","file-plus","FilePlus",LH);const zH=[["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"}]],$H=He("outline","filter","Filter",zH);const UH=[["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"}]],BH=He("outline","forms","Forms",UH);const VH=[["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"}]],FH=He("outline","id","Id",VH);const HH=[["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"}]],RT=He("outline","list-details","ListDetails",HH);const qH=[["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"}]],GH=He("outline","lock-access","LockAccess",qH);const WH=[["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"}]],QH=He("outline","lock","Lock",WH);const YH=[["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"}]],KH=He("outline","logout","Logout",YH);const XH=[["path",{d:"M5 18l14 -6l-14 -6",key:"svg-0"}]],ok=He("outline","math-greater","MathGreater",XH);const JH=[["path",{d:"M19 18l-14 -6l14 -6",key:"svg-0"}]],ak=He("outline","math-lower","MathLower",JH);const ZH=[["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"}]],eq=He("outline","message","Message",ZH);const tq=[["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"}]],nq=He("outline","microscope","Microscope",tq);const rq=[["path",{d:"M5 12l14 0",key:"svg-0"}]],iq=He("outline","minus","Minus",rq);const oq=[["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"}]],aq=He("outline","packages","Packages",oq);const sq=[["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"}]],lq=He("outline","pin","Pin",sq);const cq=[["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"}]],uq=He("outline","pinned-off","PinnedOff",cq);const dq=[["path",{d:"M7 4v16l13 -8z",key:"svg-0"}]],fq=He("outline","player-play","PlayerPlay",dq);const hq=[["path",{d:"M12 5l0 14",key:"svg-0"}],["path",{d:"M5 12l14 0",key:"svg-1"}]],sk=He("outline","plus","Plus",hq);const pq=[["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"}]],mq=He("outline","receipt","Receipt",pq);const gq=[["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"}]],lk=He("outline","refresh","Refresh",gq);const vq=[["path",{d:"M4 12v-3a3 3 0 0 1 3 -3h13m-3 -3l3 3l-3 3",key:"svg-0"}],["path",{d:"M20 12v3a3 3 0 0 1 -3 3h-13m3 3l-3 -3l3 -3",key:"svg-1"}]],yq=He("outline","repeat","Repeat",vq);const xq=[["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"}]],bq=He("outline","report-medical","ReportMedical",xq);const Sq=[["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"}]],wq=He("outline","router","Router",Sq);const jq=[["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"}]],Cq=He("outline","search","Search",jq);const Eq=[["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"}]],_x=He("outline","settings","Settings",Eq);const Tq=[["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"}]],iS=He("outline","sort-ascending","SortAscending",Tq);const Rq=[["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"}]],oS=He("outline","sort-descending","SortDescending",Rq);const _q=[["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"}]],Dq=He("outline","square","Square",_q);const Aq=[["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"}]],kq=He("outline","star","Star",Aq);const Pq=[["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"}]],Nq=He("outline","switch-horizontal","SwitchHorizontal",Pq);const Oq=[["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"}]],Mq=He("outline","table-export","TableExport",Oq);const Lq=[["path",{d:"M4 8v-2a2 2 0 0 1 2 -2h2",key:"svg-0"}],["path",{d:"M4 16v2a2 2 0 0 0 2 2h2",key:"svg-1"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"svg-2"}],["path",{d:"M16 20h2a2 2 0 0 0 2 -2v-2",key:"svg-3"}],["path",{d:"M12 16v-7",key:"svg-4"}],["path",{d:"M9 9h6",key:"svg-5"}]],Iq=He("outline","text-recognition","TextRecognition",Lq);const zq=[["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"}]],Lm=He("outline","trash","Trash",zq);const $q=[["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"}]],_T=He("outline","upload","Upload",$q);const Uq=[["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"}]],Bq=He("outline","webhook","Webhook",Uq);const Vq=[["path",{d:"M18 6l-12 12",key:"svg-0"}],["path",{d:"M6 6l12 12",key:"svg-1"}]],dl=He("outline","x","X",Vq);const Fq=[["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"}]],Hq=He("filled","circle-filled","CircleFilled",Fq);class aS extends v.Component{state;constructor(t){super(t),this.state={lastLocation:rr.getLocation()}}static getDerivedStateFromError(t){return{error:t,lastLocation:rr.getLocation()}}componentDidUpdate(t,n){rr.getLocation()!==this.state.lastLocation&&this.setState({lastLocation:rr.getLocation(),error:void 0})}shouldComponentUpdate(t,n){return!!(this.props.children!==t.children||n.error&&!this.state.error||this.state.lastLocation!==rr.getLocation())}componentDidCatch(t,n){console.error("Uncaught error:",t,n)}render(){return this.state.error?a.jsx(Mo,{icon:a.jsx(bs,{size:16}),title:"Something went wrong",color:"red",children:Ge(this.state.error)}):this.props.children}}function Pi(){return a.jsx(dr,{style:{width:"100%",height:"100vh"},children:a.jsx(Or,{})})}const qq="_main_6f7o5_1",Gq={main:qq};function pn(e){e.preventDefault(),e.stopPropagation()}function ck(e){return e.button===1||e.ctrlKey||e.metaKey}function uk(e){if(DT(e))return!0;if(e instanceof HTMLTableCellElement){const t=e.children;if(t.length===1&&DT(t[0]))return!0}return!1}function DT(e){return e instanceof HTMLInputElement&&e.type==="checkbox"}async function cd(e,t){return new Promise((n,r)=>{const o=new MessageChannel;o.port1.onmessage=({data:s})=>{o.port1.close(),s.error?r(s.error):n(s.result)},e.contentWindow?.postMessage(t,new URL(e.src).origin,[o.port2])})}function dk(e,t){const n=new Blob([e],{type:on.JSON}),r=URL.createObjectURL(n),o=document.createElement("a");o.href=r;const s=t??new Date().toISOString().replaceAll(/\D/g,"");o.download=`${s}.json`,document.body.appendChild(o),o.click(),URL.revokeObjectURL(r)}function St(e){const t=Om(),{to:n,suffix:r,label:o,onClick:s,children:c,...d}=e;let f=Wq(n);return r&&(f+="/"+r),a.jsx(Mt,{href:f,"aria-label":o,onAuxClick:p=>{p.stopPropagation()},onClick:p=>{p.stopPropagation(),s?(p.preventDefault(),s(p)):n&&(ck(p)||(p.preventDefault(),t(f)))},...d,children:c})}function Wq(e){if(e){if(typeof e=="string")return Qq(e);if(Io(e))return Yq(e);if(Ta(e))return Kq(e)}return"#"}function Qq(e){return e.startsWith("http://")||e.startsWith("https://")||e.startsWith("/")?e:"/"+e}function Yq(e){return`/${e.resourceType}/${e.id}`}function Kq(e){return`/${e.reference}`}function Xq(e){const t=e.split(" ").filter(Boolean);return t.length>1?t[0][0]+t.at(-1)?.at(0):t.length===1?t[0][0]:""}function Ss(e){const t=Kt(e.value),n=t?ya(t):e.alt??"",r=Xq(n),o=(t&&aU(t))??e.src,s=WA(o??void 0),c=e.radius??"xl",d={...e,value:void 0,link:void 0};return e.link?a.jsx(St,{to:t,children:a.jsx(al,{src:s,alt:n,radius:c,...d,children:r})}):a.jsx(al,{src:s,alt:n,radius:c,...d,children:r})}const Jq="_logoButton_189g3_1",Zq="_user_189g3_11",eG="_userName_189g3_21",tG="_userActive_189g3_31",Ph={logoButton:Jq,user:Zq,userName:eG,userActive:tG};function sS(e){const t=e.value;return t?a.jsx(a.Fragment,{children:nu(t,e.options)}):null}function fk(){return"Medplum"}function nG(e){const t=Nm(),{medplum:n,profile:r,navigate:o}=t,s=n.getLogins(),{colorScheme:c,setColorScheme:d}=x4();return a.jsxs(a.Fragment,{children:[a.jsxs(Ue,{align:"center",p:"xl",children:[a.jsx(Ss,{size:"xl",radius:100,value:t.profile}),a.jsx(sS,{value:t.profile?.name?.[0]}),a.jsx(Te,{c:"dimmed",size:"xs",children:n.getActiveLogin()?.project.display})]}),s.length>1&&a.jsx(we.Divider,{}),s.map(f=>f.profile.reference!==Ot(t.profile)&&a.jsx(we.Item,{onClick:()=>{n.setActiveLogin(f).then(()=>rr.reload()).catch(console.log)},children:a.jsxs(xe,{children:[a.jsx(al,{radius:"xl"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(Te,{size:"sm",fw:500,children:f.profile.display}),a.jsx(Te,{c:"dimmed",size:"xs",children:f.project.display})]})]})},f.profile.reference)),a.jsx(we.Divider,{}),a.jsx(xe,{justify:"center",children:a.jsx(Fd,{size:"xs",value:c,onChange:f=>d(f),data:[{label:"Light",value:"light"},{label:"Dark",value:"dark"},{label:"Auto",value:"auto"}]})}),a.jsx(we.Divider,{}),a.jsx(we.Item,{leftSection:a.jsx(Nq,{size:14,stroke:1.5}),onClick:()=>o("/signin"),children:"Add another account"}),a.jsx(we.Item,{leftSection:a.jsx(_x,{size:14,stroke:1.5}),onClick:()=>o(`/${Ot(r)}`),children:"Account settings"}),a.jsx(we.Item,{leftSection:a.jsx(KH,{size:14,stroke:1.5}),onClick:async()=>{await n.signOut(),o("/signin")},children:"Sign out"}),a.jsxs(Te,{size:"xs",c:"dimmed",my:"sm",ta:"center",children:[fk()," ",e.version]})]})}const AT={selectedItems:"selected-items",options:"options"};function lS(e){const t=bl({onDropdownClose:()=>t.resetSelectedOption(),onDropdownOpen:()=>t.updateSelectedOptionIndex("active")}),{name:n,label:r,description:o,error:s,defaultValue:c,toOption:d,loadOptions:f,itemComponent:p,pillComponent:m,emptyComponent:g,onChange:y,onCreate:b,creatable:w,clearable:j,required:C,placeholder:R,leftSection:T,maxValues:E,optionsDropdownMaxHeight:_=320,minInputLength:k=0,...L}=e,A=L.disabled,N=rG(c),[U,B]=v.useState(""),[Q,J]=v.useState(),[Z,$]=v.useState(),[W,M]=v.useState(),[I,z]=v.useState(N.map(d)),[F,X]=v.useState([]),O=p??iG,H=m??oG,oe=g??aG,ue=v.useRef(U);ue.current=U;const Se=v.useRef(void 0),ge=v.useRef(void 0),Pe=v.useRef(Q);Pe.current=Q;const rt=v.useRef(Z);rt.current=Z;const Ce=v.useRef(W);Ce.current=W;const ht=v.useRef(F);ht.current=F;const lt=v.useCallback(()=>{if(J(void 0),ue.current===ge.current&&f===Se.current||(ue.current?.length??0)<k)return;ge.current=ue.current,Se.current=f;const Ne=new AbortController;$(Ne),f(ue.current??"",Ne.signal).then(ct=>{Ne.signal.aborted||(X(ct.map(d)),Ce.current?(ct.length>0&&y(ct.slice(0,1)),M(!1)):ct.length>0&&t.openDropdown())}).catch(ct=>{Ne.signal.aborted||ct.message.includes("aborted")||ke({color:"red",message:Ge(ct)})}).finally(()=>{Ne.signal.aborted||$(void 0)})},[t,f,y,d,k]),vt=v.useCallback(Ne=>{(F&&F.length>0||w)&&t.openDropdown(),t.updateSelectedOptionIndex(),B(Ne.currentTarget.value),rt.current&&(rt.current.abort(),$(void 0)),Pe.current!==void 0&&window.clearTimeout(Pe.current);const ct=window.setTimeout(()=>lt(),100);J(ct)},[t,F,w,lt]),it=v.useCallback(Ne=>{const ct=I.some(ve=>ve.value===Ne),et=ct?I.filter(ve=>ve.value!==Ne):[...I];let at=F?.find(ve=>ve.value===Ne);if(!at&&w!==!1&&b){const ve=b(Ne);at=d(ve)}if(at){if(E===0){y([at.resource]),I.length>0&&z([]);return}ct||et.push(at)}if(E!==void 0)for(;et.length>E;)et.shift();y(et.map(ve=>ve.resource)),z(et)},[w,F,I,E,y,b,d]),wt=v.useMemo(()=>{if(!A)return Ne=>{A||(E===1&&(B(""),X([]),t.closeDropdown()),ge.current=void 0,Ne==="$create"?(B(""),it(U)):it(Ne))}},[it,t,A,E,U]),pt=v.useCallback(Ne=>{const ct=I.filter(et=>et.value!==Ne.value);y(ct.map(et=>et.resource)),z(ct)},[I,y]),It=v.useCallback(Ne=>{Ne.key==="Enter"?(Q||Z)&&M(!0):Ne.key==="Backspace"&&U.length===0&&(pn(Ne),pt(I[I.length-1]))},[Z,pt,U.length,I,Q]);v.useEffect(()=>()=>{rt.current&&rt.current.abort()},[]);const _e=!A&&j&&I.length>0&&a.jsx(Ye.ClearButton,{title:"Clear all",size:"sm",onClear:()=>{B(""),z([]),y([]),t.closeDropdown()}}),Ee=w&&U.trim().length>0,Le=F.length>0||Ee;return a.jsxs(Ye,{store:t,onOptionSubmit:wt,withinPortal:!0,shadow:"xl",...L,children:[a.jsx(Ye.DropdownTarget,{children:a.jsx(us,{label:r,description:o,error:s,className:e.className,leftSection:T,rightSection:Z?a.jsx(Or,{size:16}):_e,required:C,disabled:A,children:a.jsxs(ma.Group,{"data-testid":AT.selectedItems,children:[I.map(Ne=>a.jsx(H,{item:Ne,disabled:A,onRemove:()=>pt(Ne)},Ne.value)),!A&&(E===void 0||E===0||I.length<E)&&a.jsx(Ye.EventsTarget,{children:a.jsx(us.Field,{role:"searchbox",name:n,value:U,placeholder:R,onFocus:vt,onBlur:()=>{t.closeDropdown(),B("")},onKeyDown:It,onChange:vt})})]})})}),a.jsx(Ye.Dropdown,{hidden:!Le,"data-testid":AT.options,children:a.jsx(Ye.Options,{children:a.jsxs(Kp,{type:"scroll",mah:_,children:[F.map(Ne=>{const ct=I.some(et=>et.value===Ne.value);return a.jsx(Ye.Option,{value:Ne.value,active:ct,children:a.jsx(O,{...Ne,active:ct})},Ne.value)}),Ee&&a.jsxs(Ye.Option,{value:"$create",children:["+ Create ",U]}),!w&&U.trim().length>0&&F.length===0&&a.jsx(oe,{search:U})]})})})]})}function rG(e){return e?Array.isArray(e)?e:[e]:[]}function iG(e){return a.jsxs(xe,{gap:"xs",children:[e.active&&a.jsx(zo,{size:12}),a.jsx("span",{children:e.label})]})}function oG({item:e,disabled:t,onRemove:n}){return a.jsx(ma,{withRemoveButton:!t,onRemove:n,children:e.label})}function aG(){return a.jsx(Ye.Empty,{children:"Nothing found"})}const sG="_searchInput_dick8_1",lG={searchInput:sG};function cG(e){return{value:e.id,label:ya(e),resource:e}}function uG(e){const t=Om(),n=Re(),r=v.useCallback(async(s,c)=>{const d=fG(s),f={signal:c},p=await n.graphql(d,void 0,void 0,f);return hG(p,s)},[n]),o=v.useCallback(s=>{s.length>0&&t(`/${Ot(s[0])}`)},[t]);return a.jsx(lS,{size:"sm",radius:"md",className:lG.searchInput,leftSection:a.jsx(Cq,{size:16}),placeholder:"Search",itemComponent:dG,toOption:cG,onChange:o,loadOptions:r,maxValues:0,clearable:!1},`${e.pathname}?${e.searchParams}`)}const dG=v.forwardRef(({resource:e,active:t,...n},r)=>{let o;return e.resourceType==="Patient"?o=e.birthDate:e.resourceType==="ServiceRequest"&&(o=e.subject?.display),a.jsx("div",{ref:r,...n,children:a.jsxs(xe,{wrap:"nowrap",children:[a.jsx(Ss,{value:e}),a.jsxs("div",{children:[a.jsx(Te,{children:ya(e)}),a.jsx(Te,{size:"xs",c:"dimmed",children:o})]})]})})});function fG(e){const t=JSON.stringify(e);return yA(e)?`{
100
- Patients1: PatientList(_id: ${t}, _count: 1) {
101
- resourceType
102
- id
103
- identifier {
104
- system
105
- value
106
- }
107
- name {
108
- given
109
- family
110
- }
111
- birthDate
112
- }
113
- ServiceRequestList(_id: ${t}, _count: 1) {
114
- resourceType
115
- id
116
- identifier {
117
- system
118
- value
119
- }
120
- subject {
121
- display
122
- }
123
- }
124
- }`.replaceAll(/\s+/g," "):`{
125
- Patients1: PatientList(name: ${t}, _count: 5) {
126
- resourceType
127
- id
128
- identifier {
129
- system
130
- value
131
- }
132
- name {
133
- given
134
- family
135
- }
136
- birthDate
137
- }
138
- Patients2: PatientList(identifier: ${t}, _count: 5) {
139
- resourceType
140
- id
141
- identifier {
142
- system
143
- value
144
- }
145
- name {
146
- given
147
- family
148
- }
149
- birthDate
150
- }
151
- ServiceRequestList(identifier: ${t}, _count: 5) {
152
- resourceType
153
- id
154
- identifier {
155
- system
156
- value
157
- }
158
- subject {
159
- display
160
- }
161
- }
162
- }`.replaceAll(/\s+/g," ")}function hG(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),mG(pG(n),t).slice(0,5)}function pG(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 mG(e,t){return e.sort((n,r)=>kT(r,t)-kT(n,t))}function kT(e,t){let n=0;if(e.identifier)for(const r of e.identifier)n=Math.max(n,PT(r.value,t));if(e.resourceType==="Patient"&&e.name)for(const r of e.name)n=Math.max(n,PT(nu(r),t));return n}function PT(e,t){if(!e)return 0;const n=e.toLowerCase().indexOf(t.toLowerCase());return n<0?0:100-n}function gG(e){const t=Mm(),[n,r]=v.useState(!1);return a.jsx(Qr.Header,{p:8,style:{zIndex:101},children:a.jsxs(xe,{justify:"space-between",children:[a.jsxs(xe,{gap:"xs",children:[a.jsx(ar,{className:Ph.logoButton,onClick:e.navbarToggle,children:e.logo}),!e.headerSearchDisabled&&a.jsx(uG,{pathname:e.pathname,searchParams:e.searchParams})]}),a.jsxs(xe,{gap:"lg",pr:"sm",children:[e.notifications,a.jsxs(we,{width:260,shadow:"xl",position:"bottom-end",transitionProps:{transition:"fade-down"},opened:n,onClose:()=>r(!1),children:[a.jsx(we.Target,{children:a.jsx(ar,{className:$t(Ph.user,{[Ph.userActive]:n}),onClick:()=>r(o=>!o),children:a.jsxs(xe,{gap:7,children:[a.jsx(Ss,{value:t,radius:"xl",size:24}),a.jsx(Te,{size:"sm",className:Ph.userName,children:nu(t?.name?.[0])}),a.jsx(tS,{size:12,stroke:1.5})]})})}),a.jsx(we.Dropdown,{children:a.jsx(nG,{version:e.version})})]})]})]})})}const cS=v.createContext({submitting:!1});cS.displayName="FormContext";function vG(e){const t={};for(const n of Array.from(e.elements))n instanceof HTMLInputElement?yG(t,n):n instanceof HTMLTextAreaElement?t[n.name]=n.value:n instanceof HTMLSelectElement&&xG(t,n);return t}function yG(e,t){t.disabled||(t.type==="checkbox"||t.type==="radio")&&!t.checked||(e[t.name]=t.value)}function xG(e,t){e[t.name]=t.value}function mt(e){const[t,n]=v.useState(!1);return a.jsx(cS.Provider,{value:{submitting:t},children:a.jsx("form",{style:e.style,"data-testid":e.testid,onSubmit:r=>{r.preventDefault();const o=vG(r.target);if(e.onSubmit){n(!0);const s=e.onSubmit(o);s?.then?s.catch(console.error).finally(()=>{n(!1)}):n(!1)}},children:e.children})})}function wr(e){const{children:t,...n}=e,{submitting:r}=v.useContext(cS);return a.jsx(Ae,{type:"submit",loading:r,...n,children:t})}function bG(e){const t=Re(),n=t.getUserConfiguration();function r(o){const{menuname:s,bookmarkname:c}=o,d=`${e.pathname}?${e.searchParams.toString()}`,f=fi(n);f.menu?.find(({title:m})=>m===s)?.link?.push({name:c,target:d}),t.updateResource(f).then(m=>{n.menu=m.menu,t.dispatchEvent({type:"change"}),ke({color:"green",message:"Success"}),e.onOk()}).catch(m=>{ke({color:"red",message:Ge(m)})})}return a.jsx(Gn,{title:"Add Bookmark",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:a.jsx(mt,{onSubmit:r,children:a.jsxs(Ue,{children:[a.jsx(SG,{config:n}),a.jsx(Fe,{label:"Bookmark Name",type:"text",name:"bookmarkname",placeholder:"Bookmark Name",withAsterisk:!0}),a.jsx(xe,{justify:"flex-end",children:a.jsx(wr,{mt:"sm",children:"OK"})})]})})})}function SG(e){function t(r){return r?.menu?.map(o=>o.title)}const n=t(e.config);return a.jsx(un,{name:"menuname",defaultValue:n[0],label:"Select Menu Option",data:n,withAsterisk:!0})}function hk(e){return typeof e.code=="string"?e.code:JSON.stringify(e)}function wG(e){return typeof e.display=="string"?e.display:hk(e)}function jG(e){return{value:hk(e),label:wG(e),resource:e}}function CG(e){return{code:e,display:e}}function Zd(e){const t=Re(),{binding:n,creatable:r,clearable:o,expandParams:s,withHelpText:c,...d}=e,f=v.useCallback(async(p,m)=>{if(!n)return[];const y=(await t.valueSetExpand({...s,url:n,filter:p,count:10},{signal:m})).expansion?.contains??[],b=[];for(const w of y)w.code&&!b.some(j=>j.code===w.code)&&b.push(w);return b},[t,s,n]);return a.jsx(lS,{...d,creatable:r??!0,clearable:o??!0,toOption:jG,loadOptions:f,onCreate:CG,itemComponent:c?EG:void 0})}const EG=v.forwardRef(({label:e,resource:t,active:n,...r},o)=>a.jsx("div",{ref:o,...r,children:a.jsxs(xe,{wrap:"nowrap",gap:"xs",children:[n&&a.jsx(zo,{size:12}),a.jsxs("div",{children:[a.jsx(Te,{children:e}),a.jsx(Te,{size:"xs",c:"dimmed",children:`${t.system}#${t.code}`})]})]})}));function pk(e){const{defaultValue:t,onChange:n,withHelpText:r,...o}=e,[s,c]=v.useState(t);function d(f){const p=f[0],m=RG(p);c(m),n&&n(m)}return a.jsx(Zd,{defaultValue:TG(s),onChange:d,withHelpText:r??!0,...o})}function TG(e){return e?{code:e}:void 0}function RG(e){return e?.code}function uS(e){const[t,n]=v.useState(e.defaultValue),r=e.onChange,o=v.useCallback(s=>{n(s),r&&r(s)},[r]);return a.jsx(pk,{disabled:e.disabled,"data-autofocus":e.autoFocus,"data-testid":e.testId,defaultValue:t,onChange:o,name:e.name,placeholder:e.placeholder,binding:"https://medplum.com/fhir/ValueSet/resource-types",creatable:!1,maxValues:e.maxValues??1,clearable:!1,withHelpText:!1})}const _G="_menuTitle_9g6l5_1",DG="_link_9g6l5_9",AG="_linkActive_9g6l5_38",Dx={menuTitle:_G,link:DG,linkActive:AG};function kG(e){const t=Om(),n=OG(e.pathname,e.searchParams,e.menus),[r,o]=v.useState(!1);function s(d,f){d.stopPropagation(),d.preventDefault(),t(f),window.innerWidth<768&&e.closeNavbar()}function c(d){d&&t(`/${d}`)}return a.jsxs(a.Fragment,{children:[a.jsx(Qr.Navbar,{children:a.jsxs(pi,{p:"xs",children:[!e.resourceTypeSearchDisabled&&a.jsx(Qr.Section,{mb:"sm",children:a.jsx(uS,{name:"resourceType",placeholder:"Resource Type",maxValues:0,onChange:d=>c(d)},window.location.pathname)}),a.jsxs(Qr.Section,{grow:!0,children:[e.menus?.map(d=>a.jsxs(v.Fragment,{children:[a.jsx(Te,{className:Dx.menuTitle,children:d.title}),d.links?.map(f=>a.jsxs(PG,{to:f.href,active:f.href===n?.href,onClick:p=>s(p,f.href),children:[a.jsx(NG,{icon:f.icon}),a.jsx("span",{children:f.label})]},f.href))]},`menu-${d.title}`)),e.displayAddBookmark&&a.jsx(Ae,{variant:"subtle",size:"xs",mt:"xl",leftSection:a.jsx(sk,{size:"0.75rem"}),onClick:()=>o(!0),children:"Add Bookmark"})]})]})}),e.pathname&&e.searchParams&&a.jsx(bG,{pathname:e.pathname,searchParams:e.searchParams,visible:r,onOk:()=>o(!1),onCancel:()=>o(!1)})]})}function PG(e){return a.jsx(St,{onClick:e.onClick,to:e.to,className:$t(Dx.link,{[Dx.linkActive]:e.active}),children:e.children})}function NG(e){return e.icon?e.icon:a.jsx(jm,{w:30})}function OG(e,t,n){if(!e||!t||!n)return;let r,o=0;for(const s of n)if(s.links)for(const c of s.links){const d=MG(e,t,c.href);d>o&&(o=d,r=c)}return r}function MG(e,t,n){const r=new URL(n,"https://example.com");if(e!==r.pathname)return 0;const o=["_count","_offset"];for(const[c,d]of r.searchParams.entries())if(!o.includes(c)&&t.get(c)!==d)return 0;let s=1;for(const[c,d]of t.entries())o.includes(c)||r.searchParams.get(c)===d&&s++;return s}function LG(e){const[t,n]=v.useState(localStorage.navbarOpen==="true"),r=Re(),o=Mm();v.useEffect(()=>{function f(){ke({id:"offline",color:"red",message:"No connection to server",autoClose:!1})}return r.addEventListener("offline",f),()=>r.removeEventListener("offline",f)},[r]);function s(f){localStorage.navbarOpen=f.toString(),n(f)}function c(){s(!1)}function d(){s(!t)}return r.isLoading()?a.jsx(Pi,{}):a.jsxs(Qr,{header:{height:60},navbar:{width:250,breakpoint:"sm",collapsed:{desktop:!o||!t,mobile:!o||!t}},padding:0,children:[o&&a.jsx(gG,{pathname:e.pathname,searchParams:e.searchParams,headerSearchDisabled:e.headerSearchDisabled,logo:e.logo,version:e.version,navbarToggle:d,notifications:e.notifications}),o&&t?a.jsx(kG,{pathname:e.pathname,searchParams:e.searchParams,menus:e.menus,closeNavbar:c,displayAddBookmark:e.displayAddBookmark,resourceTypeSearchDisabled:e.resourceTypeSearchDisabled}):void 0,a.jsx(Qr.Main,{className:Gq.main,children:a.jsx(aS,{children:a.jsx(v.Suspense,{fallback:a.jsx(Pi,{}),children:e.children})})})]})}const IG="https://ccda.medplum.com",zG="https://ccda-validator.medplum.com/";function $G(e){const{url:t}=e,[n,r]=v.useState(!1),o=v.useRef(null),[s,c]=v.useState(),[d,f]=v.useState(!1);v.useEffect(()=>{t&&n&&o.current&&(cd(o.current,{command:"loadCcdaXml",value:t}).catch(console.error),r(!1))},[t,n]);const p=async()=>{if(t)try{f(!0);const b=await(await fetch(t)).text(),w=new FormData;w.append("ccdaFile",new Blob([b],{type:"text/xml"}),"ccda.xml");const j=`${zG}referenceccdaservice/?validationObjective=C-CDA_IG_Plus_Vocab&referenceFileName=No%20scenario%20File&curesUpdate=true&severityLevel=WARNING`,C=await fetch(j,{method:"POST",body:w,credentials:"omit",redirect:"manual"});if(!C.ok)throw new Error(`Validation failed: ${C.status} ${C.statusText}`);const R=await C.json();c(R)}catch(y){c(void 0),console.error("CCDA validation error:",y)}finally{f(!1)}},m=()=>{if(!s)return;const y=JSON.stringify(s,null,2);dk(y,"ccda-validation-results")},g=()=>s?s.resultsMetaData.resultMetaData.filter(y=>y?.type.includes("Error")).reduce((y,b)=>y+(b.count||0),0):0;return t?a.jsxs("div",{"data-testid":"ccda-iframe",style:{maxWidth:e.maxWidth},children:[a.jsx("div",{style:{minHeight:400},children:a.jsx("iframe",{title:"C-CDA Viewer",width:"100%",height:"400",ref:o,src:IG,allowFullScreen:!0,frameBorder:0,seamless:!0,onLoad:()=>r(!0)})}),a.jsxs("div",{style:{marginTop:"10px",marginBottom:"10px",display:"flex",alignItems:"center"},children:[a.jsx(Ae,{type:"button",onClick:p,disabled:d,children:d?"Validating...":"Validate"}),s&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{marginLeft:"15px"},children:[a.jsx("strong",{children:"Validation Results:"})," ",g()," errors found"]}),a.jsx(Ae,{type:"button",onClick:m,color:"green",style:{marginLeft:"auto"},children:"Download Full Results"})]})]})]}):null}function ef(e){const{contentType:t,url:n,title:r}=e.value??{},o=WA(n);return o?a.jsxs("div",{"data-testid":"attachment-display",children:[t?.startsWith("image/")&&a.jsx("img",{"data-testid":"attachment-image",style:{maxWidth:e.maxWidth},src:o,alt:r}),t?.startsWith("video/")&&a.jsx("video",{"data-testid":"attachment-video",style:{maxWidth:e.maxWidth},controls:!0,children:a.jsx("source",{type:t,src:o})}),(t?.startsWith("text/")||t==="application/json"||t==="application/pdf")&&a.jsx("div",{"data-testid":"attachment-iframe",style:{maxWidth:e.maxWidth,minHeight:400},children:a.jsx("iframe",{title:"Attachment",width:"100%",height:"400",src:o+"#navpanes=0",allowFullScreen:!0,frameBorder:0,seamless:!0})}),t===on.CDA_XML&&a.jsx($G,{url:o}),a.jsx("div",{"data-testid":"download-link",style:{padding:"2px 16px 16px 16px"},children:a.jsx(Mt,{href:n,"data-testid":"attachment-details",target:"_blank",rel:"noopener noreferrer",download:UG(r),children:r||"Download"})})]}):null}function UG(e){return e?.includes(".")?e:void 0}const BG="_root_17n8t_1",VG="_compact_17n8t_25",NT={root:BG,compact:VG};function tf(e){const{children:t,compact:n}=e;return a.jsx("dl",{className:$t(NT.root,{[NT.compact]:n}),children:t})}function Nr(e){return a.jsxs(a.Fragment,{children:[a.jsx("dt",{children:e.term}),a.jsx("dd",{children:e.children})]})}function FG(e){const t=e.values?.map((r,o)=>a.jsx("div",{children:a.jsx(ef,{value:r,maxWidth:e.maxWidth})},"attatchment-"+o));let n;if(e.includeDescriptionListEntry){if(e.property===void 0)throw new Error("props.property is required when includeDescriptionListEntry is true");if(!Pn(e.path))throw new Error("props.path is required when includeDescriptionListEntry is true");const r=e.path.split(".").pop();n=a.jsx(Nr,{term:cl(r),children:t})}else n=a.jsx(a.Fragment,{children:t});return n}function dS(e){const t=Re(),n=v.useRef(null);function r(c){pn(c),n.current?.click()}function o(c){pn(c);const d=c.target.files;d&&Array.from(d).forEach(s)}function s(c){!c||!c.name||(e.onUploadStart&&e.onUploadStart(),t.createAttachment({data:c,contentType:c.type||"application/octet-stream",filename:c.name,securityContext:e.securityContext,onProgress:e.onUploadProgress}).then(f=>e.onUpload(f)).catch(f=>{e.onUploadError&&e.onUploadError(Yt(f))}))}return a.jsxs(a.Fragment,{children:[a.jsx("input",{disabled:e.disabled,type:"file","data-testid":"upload-file-input",style:{display:"none"},ref:n,onChange:c=>o(c)}),e.children({onClick:r,disabled:e.disabled})]})}function HG(e){const[t,n]=v.useState(e.defaultValue??[]),r=v.useRef(t);r.current=t;function o(s){n(s),e.onChange&&e.onChange(s)}return a.jsxs("table",{style:{width:"100%"},children:[a.jsxs("colgroup",{children:[a.jsx("col",{width:"97%"}),a.jsx("col",{width:"3%"})]}),a.jsxs("tbody",{children:[t.map((s,c)=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(ef,{value:s,maxWidth:200})}),a.jsx("td",{children:a.jsx(Rn,{disabled:e.disabled,title:"Remove",variant:"subtle",size:"sm",color:"gray",onClick:d=>{pn(d);const f=t.slice();f.splice(c,1),o(f)},children:a.jsx(bp,{})})})]},`${c}-${t.length}`)),a.jsxs("tr",{children:[a.jsx("td",{}),a.jsx("td",{children:a.jsx(dS,{disabled:e.disabled,onUpload:s=>{o([...r.current,s])},children:s=>a.jsx(Rn,{...s,title:"Add",variant:"subtle",size:"sm",color:s.disabled?"gray":"green",children:a.jsx(nS,{})})})})]})]})]})}function mk(e){const[t,n]=v.useState(e.defaultValue);function r(o){n(o),e.onChange&&e.onChange(o)}return t?a.jsxs(a.Fragment,{children:[a.jsx(ef,{value:t,maxWidth:200}),a.jsx(Ae,{disabled:e.disabled,onClick:o=>{pn(o),r(void 0)},children:"Remove"})]}):a.jsx(dS,{disabled:e.disabled,securityContext:e.securityContext,onUpload:r,children:o=>a.jsx(Ae,{...o,children:"Upload..."})})}function zi(e){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 180 180",style:{width:e.size,height:e.size},children:[a.jsx("title",{children:"Medplum Logo"}),a.jsx("path",{fill:e.fill??"#9c36b5",d:"M84 56c-3-15-15-24-23-28l5-10c8 2 14 8 20 14 0-12 1-16 5-21 8-9 13-9 41-9 0 7 1 18-3 24-7 9-16 7-41 8 5 8 7 14 8 22 36-24 74-7 74 39 0 42-40 83-80 83s-80-41-80-83c0-46 38-63 74-39Zm-3 43H65c-4 0-7 3-7 7v4c0 4 3 7 7 7h16v16c0 4 3 7 7 7h4c4 0 7-3 7-7v-16h16c4 0 7-3 7-7v-4c0-4-3-7-7-7H99V83c0-4-3-7-7-7h-4c-4 0-7 3-7 7z"})]})}function wp(e){const[t,n]=v.useState();return a.jsx(mt,{onSubmit:r=>{n(void 0),e.onSubmit(r)?.catch(o=>n(Ge(o)))},children:a.jsxs(Ue,{children:[a.jsxs(dr,{style:{flexDirection:"column"},children:[a.jsx(zi,{size:32}),a.jsx(Ie,{children:e.title})]}),t&&a.jsx(Mo,{icon:a.jsx(bs,{size:16}),title:"Error",color:"red",children:t}),e.qrCodeUrl&&a.jsxs(Ue,{align:"center",children:[a.jsx(Te,{children:"Scan this QR code with your authenticator app."}),a.jsx("img",{src:e.qrCodeUrl,alt:"Multi Factor Auth QR Code"})]}),a.jsx(Ue,{children:a.jsx(Fe,{name:"token",label:"MFA code",autoComplete:"one-time-code",required:!0,autoFocus:!0})}),a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(wr,{children:e.buttonText})})]})})}const qG="_root_1vii2_1",GG={root:qG};function ru(e){const{children:t,...n}=e;return a.jsx($d,{className:GG.root,...n,children:t})}const WG="_paper_1igaj_1",QG="_fill_1igaj_20",OT={paper:WG,fill:QG};function Cl(e){const{width:t,fill:n,className:r,children:o,...s}=e,c=t?{maxWidth:t}:void 0;return a.jsx(Pr,{className:$t(OT.paper,n&&OT.fill,r),style:c,shadow:"sm",radius:"sm",withBorder:!0,...s,children:o})}function dt(e){const{children:t,...n}=e;return a.jsx(ru,{children:a.jsx(Cl,{...n,children:t})})}function Lt(e,t){return e?.issue?.filter(n=>gk(n.expression?.[0],t))?.map(n=>n.details?.text)?.join(`
163
- `)}function iu(e,t){return e?.issue?.filter(n=>gk(n.expression?.[0],t))}const Nh=/\[\d+\]/;function gk(e,t){const n=typeof e=="string"&&Nh.test(e),r=typeof t=="string"&&Nh.test(t);if(n!==r&&(e=e?.replace(Nh,""),t=t?.replace(Nh,"")),e===t)return!0;if(!e||!t)return!1;const o=e.indexOf(".");if(o>=0&&e.substring(o+1)===t)return!0;const s=t.indexOf(".");return s>=0&&t.substring(s+1)===e}function vk(e){const t=Re(),[n,r]=v.useState();return a.jsxs(mt,{onSubmit:async o=>{try{e.handleAuthResponse(await t.startNewProject({login:e.login,projectName:o.projectName}))}catch(s){r(Yt(s))}},children:[a.jsxs(dr,{style:{flexDirection:"column"},children:[a.jsx(zi,{size:32}),a.jsx(Ie,{children:"Create project"})]}),a.jsxs(Ue,{gap:"xl",children:[a.jsx(Fe,{name:"projectName",label:"Project Name",placeholder:"My Project",required:!0,autoFocus:!0,error:Lt(n,"projectName")}),a.jsxs(Te,{c:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",a.jsx(Mt,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Mt,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]})]}),a.jsx(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(wr,{children:"Create project"})})]})}function yk(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 xk(e){const t=Re(),{googleClientId:n,handleGoogleCredential:r}=e,o=v.useRef(null),[s,c]=v.useState(typeof google<"u"),[d,f]=v.useState(!1),[p,m]=v.useState(!1);return v.useEffect(()=>{if(typeof google>"u"){yk("https://accounts.google.com/gsi/client",()=>c(!0));return}d||(google.accounts.id.initialize({client_id:n,callback:r}),f(!0)),o.current&&!p&&(google.accounts.id.renderButton(o.current,{}),m(!0))},[t,n,d,s,o,p,r]),n?a.jsx("div",{ref:o}):null}function bk(e){if(e)return e;const t=rr.getOrigin();if(t&&[].includes(t))return"__GOOGLE_CLIENT_ID__"}function jr(e){const t=e.outcome?.issue||e.issues;return!t||t.length===0?null:a.jsx(Mo,{icon:a.jsx(bs,{size:16}),color:"red",children:t.map(n=>a.jsx("div",{"data-testid":"text-field-error",children:tA(n)},n.details?.text))})}function Sk(e){typeof grecaptcha>"u"&&yk("https://www.google.com/recaptcha/api.js?render="+e)}function wk(e){return new Promise((t,n)=>{grecaptcha.ready(async()=>{try{t(await grecaptcha.execute(e,{action:"submit"}))}catch(r){n(r)}})})}function YG(e){const t=bk(e.googleClientId),n=e.recaptchaSiteKey,r=Re(),[o,s]=v.useState(),c=iu(o,void 0);return v.useEffect(()=>{n&&Sk(n)},[n]),a.jsxs(mt,{onSubmit:async d=>{s(void 0);try{let f="";n&&(f=await wk(n)),e.handleAuthResponse(await r.startNewUser({projectId:e.projectId,clientId:e.clientId,firstName:d.firstName,lastName:d.lastName,email:d.email,password:d.password,remember:d.remember==="true",recaptchaSiteKey:n,recaptchaToken:f}))}catch(f){s(Yt(f))}},children:[a.jsx(dr,{style:{flexDirection:"column"},children:e.children}),a.jsx(jr,{issues:c}),t&&a.jsxs(a.Fragment,{children:[a.jsx(xe,{justify:"center",p:"xl",style:{height:70},children:a.jsx(xk,{googleClientId:t,handleGoogleCredential:async d=>{try{e.handleAuthResponse(await r.startGoogleLogin({googleClientId:d.clientId,googleCredential:d.credential,projectId:e.projectId,createUser:!0}))}catch(f){s(Yt(f))}}})}),a.jsx(Tn,{label:"or",labelPosition:"center",my:"lg"})]}),a.jsxs(Ue,{gap:"xl",children:[a.jsx(Fe,{name:"firstName",type:"text",label:"First name",placeholder:"First name",required:!0,autoFocus:!0,error:Lt(o,"firstName")}),a.jsx(Fe,{name:"lastName",type:"text",label:"Last name",placeholder:"Last name",required:!0,error:Lt(o,"lastName")}),a.jsx(Fe,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,error:Lt(o,"email")}),a.jsx(Xi,{name:"password",label:"Password",autoComplete:"off",required:!0,error:Lt(o,"password")}),a.jsxs(Te,{c:"dimmed",size:"xs",children:["By clicking submit you agree to the Medplum"," ",a.jsx(Mt,{href:"https://www.medplum.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Mt,{href:"https://www.medplum.com/terms",children:"Terms of Service"}),"."]}),a.jsxs(Te,{c:"dimmed",size:"xs",children:["This site is protected by reCAPTCHA and the Google"," ",a.jsx(Mt,{href:"https://policies.google.com/privacy",children:"Privacy Policy"})," and ",a.jsx(Mt,{href:"https://policies.google.com/terms",children:"Terms of Service"})," apply."]})]}),a.jsxs(xe,{justify:"space-between",mt:"xl",wrap:"nowrap",children:[a.jsx(Ln,{name:"remember",label:"Remember me",size:"xs"}),a.jsx(wr,{children:"Create account"})]})]})}function KG(e){const{type:t,projectId:n,clientId:r,googleClientId:o,recaptchaSiteKey:s,onSuccess:c}=e,d=Re(),[f,p]=v.useState(),[m,g]=v.useState();v.useEffect(()=>{t==="patient"&&f&&d.startNewPatient({login:f,projectId:n}).then(b=>d.processCode(b.code)).then(()=>c()).catch(b=>g(Yt(b)))},[d,t,n,f,c]);function y(b){b.code?d.processCode(b.code).then(()=>c()).catch(console.log):b.login&&p(b.login)}return a.jsxs(dt,{width:450,children:[m&&a.jsx("pre",{children:JSON.stringify(m,null,2)}),!f&&a.jsx(YG,{projectId:n,clientId:r,googleClientId:o,recaptchaSiteKey:s,handleAuthResponse:y,children:e.children}),f&&t==="project"&&a.jsx(vk,{login:f,handleAuthResponse:y})]})}const XG="_userNotice_1iefq_1",JG={userNotice:XG};function ZG(e){const[t,n]=v.useState();return t?a.jsx(tW,{email:t,resetEmail:()=>n(void 0),...e}):a.jsx(eW,{setEmail:n,...e})}function eW(e){const{setEmail:t,onRegister:n,handleAuthResponse:r,children:o,disableEmailAuth:s,...c}=e,d=Re(),f=!e.disableGoogleAuth&&bk(e.googleClientId),[p,m]=v.useState(),g=iu(p,void 0),y=v.useCallback(async j=>{if(!j.authorizeUrl)return!1;const C=JSON.stringify({...await d.ensureCodeChallenge(c),domain:j.domain}),R=new URL(j.authorizeUrl);return R.searchParams.set("state",C),rr.assign(R.toString()),!0},[d,c]),b=v.useCallback(async j=>{const C=await d.post("auth/method",{email:j.email});await y(C)||t(j.email)},[d,y,t]),w=v.useCallback(async j=>{try{const C=await d.startGoogleLogin({...c,googleCredential:j.credential});await y(C)||r(C)}catch(C){m(Yt(C))}},[d,c,y,r]);return a.jsxs(mt,{onSubmit:b,children:[a.jsx(dr,{style:{flexDirection:"column"},children:o}),a.jsx(jr,{issues:g}),f&&a.jsxs(a.Fragment,{children:[a.jsx(xe,{justify:"center",p:"xl",style:{height:70},children:a.jsx(xk,{googleClientId:f,handleGoogleCredential:w})}),!s&&a.jsx(Tn,{label:"or",labelPosition:"center",my:"lg"})]}),!s&&a.jsx(Fe,{name:"email",type:"email",label:"Email",placeholder:"name@domain.com",required:!0,autoFocus:!0,error:Lt(p,"email"),"data-testid":"auth.email"}),a.jsxs(xe,{justify:"space-between",mt:"xl",gap:0,wrap:"nowrap",children:[a.jsx("div",{children:n&&a.jsx(Mt,{component:"button",type:"button",c:"dimmed",onClick:n,size:"xs","data-dashlane-ignore":"true","data-lp-ignore":"true","data-no-autofill":"true","data-form-type":"navigation",children:"Register"})}),!s&&a.jsx(wr,{children:"Next"})]})]})}function tW(e){const{onForgotPassword:t,handleAuthResponse:n,children:r,...o}=e,s=Re(),[c,d]=v.useState(),f=iu(c,void 0),p=v.useCallback(m=>{s.startLogin({...o,password:m.password,remember:m.remember==="on"}).then(n).catch(g=>d(Yt(g)))},[s,o,n]);return a.jsxs(mt,{onSubmit:p,children:[a.jsx(dr,{style:{flexDirection:"column"},children:r}),a.jsx(jr,{issues:f}),a.jsxs(Ue,{gap:"sm",children:[a.jsx(Xi,{name:"password",label:"Password",autoComplete:"off",required:!0,autoFocus:!0,error:Lt(c,"password"),"data-testid":"auth.password"}),a.jsxs(to,{className:JG.userNotice,justify:"space-between",align:"center",px:"xs",bdrs:"sm",children:[a.jsxs(Te,{size:"xs",children:["Logging in as ",a.jsx("em",{children:e.email})]}),a.jsx(Ae,{variant:"transparent",onClick:e.resetEmail,size:"compact-xs",children:"Change"})]})]}),a.jsxs(xe,{justify:"space-between",mt:"xl",gap:0,wrap:"nowrap",children:[t&&a.jsx(Mt,{component:"button",type:"button",c:"dimmed",onClick:t,size:"xs",children:"Forgot password"}),a.jsx(Ln,{id:"remember",name:"remember",label:"Remember me",size:"xs",style:{lineHeight:1}}),a.jsx(wr,{children:"Sign in"})]})]})}function nW(e){const t=Re(),n=bl(),[r,o]=v.useState(""),[s,c]=v.useState();function d(g){return!!g?.toLowerCase()?.includes(r.toLowerCase())}function f(g){return d(g.profile?.display)||d(g.project?.display)}function p(g){t.post("auth/profile",{login:e.login,profile:g}).then(e.handleAuthResponse).catch(y=>c(Yt(y)))}const m=e.memberships.filter(f).slice(0,10).map(g=>a.jsx(Ye.Option,{value:g.id,children:a.jsx(iW,{...g})},g.id));return a.jsxs(Ue,{children:[a.jsxs(to,{gap:"md",mb:"md",justify:"center",align:"center",direction:"column",wrap:"nowrap",children:[a.jsx(zi,{size:32}),a.jsx(Ie,{order:3,children:"Choose profile"})]}),a.jsx(jr,{outcome:s}),a.jsxs(Ye,{store:n,onOptionSubmit:p,children:[a.jsx(Ye.EventsTarget,{children:a.jsx(Fe,{placeholder:"Search",value:r,onChange:g=>{o(g.currentTarget.value),n.updateSelectedOptionIndex()}})}),a.jsx("div",{children:a.jsx(Ye.Options,{children:m.length>0?m:a.jsx(Ye.Empty,{children:"Nothing found..."})})})]})]})}function rW(e){return e.identifier?.find(t=>t.system==="https://medplum.com/identifier/label")?.value}function iW(e){const t=rW(e);return a.jsxs(xe,{children:[a.jsx(al,{radius:"xl"}),a.jsxs("div",{children:[a.jsx(Te,{fz:"sm",fw:500,children:e.profile?.display}),a.jsxs(Te,{fz:"xs",opacity:.6,children:[e.project?.display," ",t?` - ${t}`:""]})]})]})}const oW=/^patient\/Condition\.(?:\*|c?r?u?d?s?)$/,aW="?category=http://terminology.hl7.org/CodeSystem/condition-category|encounter-diagnosis",sW="?category=http://terminology.hl7.org/CodeSystem/condition-category|problem-list-item",lW="?category=http://hl7.org/fhir/us/core/CodeSystem/condition-category|health-concern",cW=/^patient\/Observation\.(?:\*|c?r?u?d?s?)$/,uW="?category=http://hl7.org/fhir/us/core/CodeSystem/us-core-observation-category|clinical-test",dW="?category=http://terminology.hl7.org/CodeSystem/observation-category|laboratory",fW="?category=http://terminology.hl7.org/CodeSystem/observation-category|social-history",hW="?category=http://hl7.org/fhir/us/core/CodeSystem/us-core-category|sdoh",pW="?category=http://terminology.hl7.org/CodeSystem/observation-category|survey",mW="?category=http://terminology.hl7.org/CodeSystem/observation-category|vital-signs";function gW(e){const t=Re();return a.jsx(mt,{onSubmit:n=>{t.post("auth/scope",{login:e.login,scope:Object.keys(n).join(" ")}).then(e.handleAuthResponse).catch(console.log)},children:a.jsxs(Ue,{children:[a.jsxs(dr,{style:{flexDirection:"column"},children:[a.jsx(zi,{size:32}),a.jsx(Ie,{children:"Choose scope"})]}),a.jsx(Ue,{children:(e.scope??"openid").split(" ").map(n=>{let r;return oW.test(n)?r=[n+aW,n+sW,n+lW]:cW.test(n)&&(r=[n+uW,n+dW,n+fW,n+hW,n+pW,n+mW]),a.jsxs(a.Fragment,{children:[a.jsx(Ln,{id:n,name:n,label:n,defaultChecked:!0},n),r?.map(o=>a.jsx(Ln,{id:o,name:o,label:o},o))]},n+"_group")})}),a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(wr,{children:"Set scope"})})]})})}function jk(e){const{login:t,chooseScopes:n,onSuccess:r,onForgotPassword:o,onRegister:s,onCode:c,...d}=e,f=Re(),[p,m]=v.useState(),g=v.useRef(!1),[y,b]=v.useState(!1),[w,j]=v.useState(),[C,R]=v.useState(!1),[T,E]=v.useState(),_=v.useCallback(A=>{c?c(A):f.processCode(A).then(()=>{r&&r()}).catch(N=>ke({color:"red",message:Ge(N)}))},[f,c,r]),k=v.useCallback(A=>{b(!!A.mfaEnrollRequired),j(A.enrollQrCode),R(!!A.mfaRequired),A.login&&m(A.login),A.memberships&&E(A.memberships),A.code&&(n?E(void 0):_(A.code))},[n,_]),L=v.useCallback(A=>{_(A.code)},[_]);return v.useEffect(()=>{t&&!g.current&&!p&&(g.current=!0,f.get("auth/login/"+t).then(k).catch(A=>ke({color:"red",message:Ge(A)})))},[f,t,g,p,k]),a.jsx(dt,{width:450,px:"sm",py:"md",children:p?y&&w?a.jsx(wp,{title:"Enroll in MFA",buttonText:"Enroll",qrCodeUrl:w,onSubmit:async A=>{const N=await f.post("auth/mfa/login-enroll",{login:p,token:A.token});k(N)}}):C?a.jsx(wp,{title:"Enter MFA code",buttonText:"Submit code",onSubmit:async A=>{const N=await f.post("auth/mfa/verify",{login:p,token:A.token});k(N)}}):T?a.jsx(nW,{login:p,memberships:T,handleAuthResponse:k}):e.projectId==="new"?a.jsx(vk,{login:p,handleAuthResponse:k}):e.chooseScopes?a.jsx(gW,{login:p,scope:e.scope,handleAuthResponse:L}):a.jsx("div",{children:"Success"}):a.jsx(ZG,{onForgotPassword:o,onRegister:s,handleAuthResponse:k,disableGoogleAuth:e.disableGoogleAuth,disableEmailAuth:e.disableEmailAuth,...d,children:e.children})})}function Co(e){return a.jsx(a.Fragment,{children:ds(e.value)})}function vW(e){return a.jsx(a.Fragment,{children:Kd(e.value)})}function Ck(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 yW(e){const t=e.value;return t?a.jsxs(a.Fragment,{children:[t.name,t.name&&": ",t.telecom?.map(n=>a.jsx(Ck,{value:n},`telecom-${t.name}-${n.value}`))]}):null}function Im(e,t,n){const r=bd(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 xW(e,t,n){const r=lA(e,t,n);return r?Array.isArray(r)?[r.map(o=>o.value),r[0].type]:[r.value,r.type]:[void 0,"undefined"]}function bW(e){const{elementDefinitionType:t}=e,n=Re(),r=v.useContext(dn),[o,s]=v.useState(oA("Extension")),c=v.useMemo(()=>{if(Pn(t?.profile))return t.profile[0]},[t]),[d,f]=v.useState(c!==void 0);if(v.useEffect(()=>{c&&(f(!0),n.requestProfileSchema(c).then(()=>{const g=tu(c);f(!1),g&&s(g)}).catch(g=>{f(!1),console.warn(g)}))},[n,c]),c&&(d||!O0(c)))return a.jsx("div",{children:"Loading..."});if(o.elements["value[x]"]?.max!==0){const[g,y]=Im({type:"Extension",value:e.value},"value[x]",c??r.profileUrl);return a.jsx(ro,{propertyType:y,value:g})}return a.jsx(Cp,{path:e.path,value:{type:o.type,value:e.value},compact:e.compact,ignoreMissingValues:e.ignoreMissingValues,link:e.link,profileUrl:c})}function SW(e){return a.jsxs("div",{children:[e.value?.system,": ",e.value?.value]})}function wW(e){return a.jsx(a.Fragment,{children:NU(e.value)})}function Cd(e){return a.jsx(a.Fragment,{children:Js(e.value)})}function fS(e){return a.jsx(a.Fragment,{children:wd(e.value)})}function jW(e){const t=e.value;return t?a.jsxs(a.Fragment,{children:[a.jsx(Cd,{value:t.numerator})," / ",a.jsx(Cd,{value:t.denominator})]}):null}function jp(e){if(!e.value)return null;const t=e.value.display||e.value.reference||no(e.value);return e.link!==!1&&e.value.reference?a.jsx(St,{to:e.value,children:t}):a.jsx(a.Fragment,{children:t})}function Ek(e,t,n,r){if(!Pn(n?.slices))return[e];const o=new Array(t.length+1);for(let s=0;s<o.length;s++)o[s]=[];for(const s of e){const c=FA(s,t,n.discriminator,r);let d=c?t.findIndex(f=>f.name===c):-1;d===-1&&(d=t.length),o[d].push(s)}return o}async function Tk({medplum:e,property:t}){return new Promise((n,r)=>{if(!t.slicing){n([]);return}const o=[],s=[],c=[];for(const d of t.slicing.slices){if(!VA(d)){console.debug("Unsupported slice definition",d);continue}let f;Pn(d.elements)||(f=d.type[0]?.profile?.[0]),o.push(d),s.push(f),f&&c.push(e.requestProfileSchema(f))}Promise.all(c).then(()=>{for(let d=0;d<o.length;d++){const f=o[d],p=s[d];if(p){const m=tu(p);f.typeSchema=m}}n(o)}).catch(r)})}function zm(e,t,n){return t!==void 0?a.jsx(e,{value:t,children:n}):n}function CW(e){const{slice:t,property:n}=e,r=t.typeSchema?.elements??t.elements,o=v.useContext(dn),s=v.useMemo(()=>{if(Pn(r))return Uc({parentContext:o,elements:r,path:e.path,profileUrl:t.typeSchema?.url})},[o,e.path,t.typeSchema?.url,r]);return zm(dn.Provider,s,a.jsx(a.Fragment,{children:e.value.map((c,d)=>a.jsx("div",{children:a.jsx(ro,{property:n,path:e.path,arrayElement:!0,elementDefinitionType:t.type[0],propertyType:t.type[0].code,value:c,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},`${d}-${e.value.length}`))}))}const MT=50;function EW(e){const{property:t,propertyType:n}=e,r=Re(),o=v.useMemo(()=>Array.isArray(e.values)?e.values:[],[e.values]),[s,c]=v.useState(!0),[d,f]=v.useState([]),[p,m]=v.useState(()=>[o]),[g,y]=v.useState(0),b=v.useContext(dn);if(v.useEffect(()=>{Tk({medplum:r,property:t}).then(C=>{y(o.length),f(C);const R=o.slice(0,MT),T=Ek(R,C,t.slicing,b.profileUrl);m(T),c(!1)}).catch(C=>{console.error(C),c(!1)})},[r,t,b.profileUrl,m,o]),s)return a.jsx("div",{children:"Loading..."});let w;if(t.type[0]?.code!=="Extension"){const C=p[d.length],R=C.map((T,E)=>a.jsx("div",{children:a.jsx(ro,{path:e.path,arrayElement:!0,property:t,propertyType:n,value:T,ignoreMissingValues:e.ignoreMissingValues,link:e.link})},`${E}-${C.length}`));if(e.includeDescriptionListEntry){if(!Pn(e.path))throw new Error("props.path is required when includeDescriptionListEntry is true");const T=e.path.split(".").pop();w=a.jsx(Nr,{term:cl(T),children:R})}else w=a.jsx(a.Fragment,{children:R})}return a.jsxs(a.Fragment,{children:[d.map((C,R)=>{if(!e.path)throw Error(`Displaying a resource property with slices of type ${e.propertyType} requires path`);let T=a.jsx(CW,{path:e.path,slice:C,property:t,value:p[R],ignoreMissingValues:e.ignoreMissingValues,link:e.link},C.name);return e.includeDescriptionListEntry&&(T=a.jsx(Nr,{term:cl(C.name),children:T},C.name)),T}),w,g>MT&&a.jsx(xe,{justify:"right",children:a.jsxs(Te,{children:["... ",g," total values"]})})]})}function ro(e){const{property:t,propertyType:n,value:r}=e;if(t?.path?.endsWith(".id"))return a.jsxs(to,{gap:3,align:"center",children:[r,!wn(r)&&a.jsx(Xb,{value:r,timeout:2e3,children:({copied:s,copy:c})=>a.jsx(ga,{label:s?"Copied":"Copy",withArrow:!0,position:"right",children:a.jsx(Rn,{variant:"subtle",color:s?"teal":"gray",onClick:c,children:s?a.jsx(zo,{size:"1rem"}):a.jsx(rS,{size:"1rem"})})})})]});if(t&&(t.isArray||t.max>1)&&!e.arrayElement)return n===ne.Attachment?a.jsx(FG,{values:r,maxWidth:e.maxWidth,includeDescriptionListEntry:e.includeArrayDescriptionListEntry,property:t,path:e.path}):a.jsx(EW,{path:e.path,property:t,propertyType:n,values:r,includeDescriptionListEntry:e.includeArrayDescriptionListEntry,ignoreMissingValues:e.ignoreMissingValues,link:e.link});switch(n){case ne.boolean:return a.jsx(a.Fragment,{children:r===void 0?"":(!!r).toString()});case ne.SystemString:case ne.string:return e.property?.path?.toLowerCase().includes("secret")?a.jsx(TW,{value:r}):a.jsx("div",{style:{whiteSpace:"pre-wrap"},children:r});case ne.code:case ne.date:case ne.decimal:case ne.id:case ne.integer:case ne.positiveInt:case ne.unsignedInt:case ne.uri:case ne.url:case ne.xhtml:return a.jsx(a.Fragment,{children:r});case ne.canonical:return a.jsx(jp,{value:{reference:r},link:e.link});case ne.dateTime:case ne.instant:return a.jsx(a.Fragment,{children:Sr(r)});case ne.markdown:return a.jsx("pre",{children:r});case ne.Address:return a.jsx(PF,{value:r});case ne.Annotation:return a.jsx(a.Fragment,{children:r?.text});case ne.Attachment:return a.jsx(ef,{value:r,maxWidth:e.maxWidth});case ne.CodeableConcept:return a.jsx(Co,{value:r});case ne.Coding:return a.jsx(vW,{value:r});case ne.ContactDetail:return a.jsx(yW,{value:r});case ne.ContactPoint:return a.jsx(Ck,{value:r});case ne.HumanName:return a.jsx(sS,{value:r});case ne.Identifier:return a.jsx(SW,{value:r});case ne.Money:return a.jsx(wW,{value:r});case ne.Period:return a.jsx(a.Fragment,{children:_U(r)});case ne.Quantity:case ne.Duration:return a.jsx(Cd,{value:r});case ne.Range:return a.jsx(fS,{value:r});case ne.Ratio:return a.jsx(jW,{value:r});case ne.Reference:return a.jsx(jp,{value:r,link:e.link});case ne.Timing:return a.jsx(a.Fragment,{children:EA(r)});case ne.Dosage:case ne.UsageContext:if(!e.path)throw Error(`Displaying property of type ${e.propertyType} requires path`);return a.jsx(Cp,{path:e.path,value:{type:n,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues});case ne.Extension:if(!e.path)throw Error(`Displaying property of type ${e.propertyType} requires path`);return a.jsx(bW,{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(Cp,{path:e.path,value:{type:t.type[0].code,value:r},compact:!0,ignoreMissingValues:e.ignoreMissingValues})}}function TW(e){const[t,n]=v.useState(!1),r=e.value??"",o=!wn(r),s="•".repeat(8);return a.jsxs(to,{gap:3,align:"center",children:[t?a.jsx("div",{style:{whiteSpace:"pre-wrap"},children:r}):a.jsx("div",{style:{whiteSpace:"pre-wrap"},"aria-hidden":"true",children:o?s:""}),o&&a.jsxs(a.Fragment,{children:[a.jsx(Xb,{value:e.value,timeout:2e3,children:({copied:c,copy:d})=>a.jsx(ga,{label:c?"Copied":"Copy secret",withArrow:!0,position:"right",children:a.jsx(Rn,{variant:"subtle",color:c?"teal":"gray",onClick:d,"aria-label":c?"Copied":"Copy secret",children:c?a.jsx(zo,{size:"1rem"}):a.jsx(rS,{size:"1rem"})})})}),a.jsx(ga,{label:t?"Hide secret":"Show secret",withArrow:!0,position:"right",children:a.jsx(Rn,{variant:"subtle",color:"gray",onClick:()=>n(!t),"aria-label":t?"Hide secret":"Show secret",children:t?a.jsx(PH,{size:"1rem"}):a.jsx(OH,{size:"1rem"})})})]})]})}const Rk=["extension","modifierExtension"],RW=nk.filter(e=>!Rk.includes(e));function Cp(e){const t=e.value,{value:n,type:r}=t,o=v.useContext(dn),s=e.profileUrl??o?.profileUrl,c=v.useMemo(()=>Em(r,s),[s,r]),d=v.useMemo(()=>{if(c)return Uc({parentContext:o,elements:c.elements,path:e.path,profileUrl:c.url,accessPolicyResource:e.accessPolicyResource})},[c,o,e.path,e.accessPolicyResource]);if(wn(n))return null;if(!c)return a.jsxs("div",{children:[r," not implemented"]});if(typeof n=="object"&&"name"in n&&Object.keys(n).length===1&&typeof n.name=="string")return a.jsx("div",{children:n.name});const f=d??o;return zm(dn.Provider,d,a.jsx(tf,{compact:e.compact,children:Object.entries(f.elements).map(([p,m])=>{if(Rk.includes(p)&&wn(m.slicing?.slices))return null;if(RW.includes(p))return null;if(rk.includes(p)&&m.path.split(".").length===2||p.includes("."))return null;const[g,y]=Im(t,p,f.profileUrl);if((e.ignoreMissingValues||m.max===0)&&wn(g)||e.path.endsWith(".extension")&&(p==="url"||p==="id"))return null;const b=m.max>1||m.isArray,w=a.jsx(ro,{property:m,propertyType:y,path:e.path+"."+p,value:g,ignoreMissingValues:e.ignoreMissingValues,includeArrayDescriptionListEntry:b,link:e.link},p);return b?w:a.jsx(Nr,{term:cl(p),children:w},p)})}))}const _W="_dimmed_11me5_1",DW="_preserveBreaks_11me5_5",Ax={dimmed:_W,preserveBreaks:DW},_k="Read Only";function Dk(e,t){return e?a.jsx(ga.Floating,{label:e,children:t}):t}function Ak(e){const{debugMode:t}=v.useContext(dn);let n;return t&&e.fhirPath?n=`${e.title} - ${e.fhirPath}`:n=e.title,Dk(e?.readonly?_k:void 0,a.jsxs(xe,{wrap:"nowrap","data-testid":e.testId,children:[a.jsx("div",{children:e.children}),a.jsx("div",{children:a.jsx(mn.Wrapper,{id:e.htmlFor,label:n,classNames:{label:e?.readonly?Ax.dimmed:void 0},description:e.description,withAsterisk:e.withAsterisk,children:null})})]}))}function zt(e){const{debugMode:t}=v.useContext(dn);let n;return t&&e.fhirPath?n=`${e.title} - ${e.fhirPath}`:n=e.title,Dk(e?.readonly?_k:void 0,a.jsx(mn.Wrapper,{id:e.htmlFor,label:n,classNames:{label:$t({[Ax.dimmed]:e?.readonly},Ax.preserveBreaks)},description:e.description,withAsterisk:e.withAsterisk,error:Lt(e.outcome,e.errorExpression??e.htmlFor),"data-testid":e.testId,children:e.children}))}function AW(e,t,n,r,o){const s=r.type;if(s.length>1)for(const c of s){const d=t.replace("[x]",qn(c.code));d in e&&delete e[d]}return wn(o)?e[n]=void 0:e[n]=o,e}function kW(e){return!!e&&!wn(e.url)&&!wn(e.name)}function PW(e){const{defaultValue:t,onChange:n,withHelpText:r,outcome:o,path:s,valuePath:c,...d}=e,[f,p]=v.useState(t);function m(g){const y=OW(g);p(y),n&&n(y)}return a.jsx(Zd,{defaultValue:f&&NW(f),onChange:m,withHelpText:r??!0,...d})}function NW(e){return e.coding?.map(t=>({system:t.system,code:t.code,display:t.display}))}function OW(e){if(e.length!==0)return{coding:e.map(t=>({system:t.system,code:t.code,display:t.display}))}}function MW(e){const{defaultValue:t,onChange:n,withHelpText:r,response:o,...s}=e,[c,d]=v.useState(o?.answer?.[0]?.valueCoding??t);function f(p){const m=p[0],g=m&&IW(m);d(g),n&&n(g)}return a.jsx(Zd,{defaultValue:c?LW(c):void 0,maxValues:1,onChange:f,withHelpText:r??!0,...s})}function LW(e){return{system:e.system,code:e.code,display:e.display}}function IW(e){return{system:e.system,code:e.code,display:e.display}}function kk(e){const{path:t,outcome:n}=e,{elementsByPath:r,getExtendedProps:o}=v.useContext(dn),[s,c]=v.useState(e.defaultValue),d=v.useRef(s);d.current=s;const[f,p,m]=v.useMemo(()=>["system","use","value"].map(E=>r[t+"."+E]),[r,t]),[g,y,b]=v.useMemo(()=>["system","use","value"].map(E=>o(t+"."+E)),[o,t]);function w(E){E&&Object.keys(E).length===0&&(E=void 0),c(E),e.onChange&&e.onChange(E)}function j(E){const _={...d.current,system:E};E||delete _.system,w(_)}function C(E){const _={...d.current,use:E};E||delete _.use,w(_)}function R(E){const _={...d.current,value:E};E||delete _.value,w(_)}const T=e.valuePath??t;return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(un,{disabled:e.disabled||g?.readonly,"data-testid":"system",defaultValue:s?.system,required:(f?.min??0)>0,onChange:E=>j(E.currentTarget.value),data:["","email","phone","fax","pager","sms","other"],error:Lt(n,T+".system")}),a.jsx(un,{disabled:e.disabled||y?.readonly,"data-testid":"use",defaultValue:s?.use,required:(p?.min??0)>0,onChange:E=>C(E.currentTarget.value),data:["","home","work","temp","old","mobile"],error:Lt(n,T+".use")}),a.jsx(Fe,{disabled:e.disabled||b?.readonly,placeholder:"Value",defaultValue:s?.value,required:(m?.min??0)>0,onChange:E=>R(E.currentTarget.value),error:Lt(n,T+".value")})]})}function zW(e){const[t,n]=v.useState(e.defaultValue),r=v.useRef(t);r.current=t;const{getExtendedProps:o}=v.useContext(dn),[s,c]=v.useMemo(()=>["name","telecom"].map(m=>o(e.path+"."+m)),[o,e.path]);function d(m){n(m),e.onChange&&e.onChange(m)}function f(m){const g={...r.current,name:m};m||delete g.name,d(g)}function p(m){const g={...r.current,telecom:m&&[m]};m||delete g.telecom,d(g)}return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(Fe,{disabled:e.disabled||s?.readonly,"data-testid":e.name+"-name",name:e.name+"-name",placeholder:"Name",style:{width:180},defaultValue:t?.name,onChange:m=>f(m.currentTarget.value)}),a.jsx(kk,{disabled:e.disabled||c?.readonly,name:e.name+"-telecom",path:e.path+".telecom",defaultValue:t?.telecom?.[0],onChange:p,outcome:e.outcome})]})}function $W(e){if(!e)return"";const t=new Date(e);return Rm(t)?t.toLocaleDateString("sv")+"T"+t.toLocaleTimeString("sv"):""}function hS(e){if(!e)return"";const t=new Date(e);return Rm(t)?t.toISOString():""}function Eo(e){return a.jsx(Fe,{id:e.name,name:e.name,label:e.label,"data-autofocus":e.autoFocus,"data-testid":e["data-testid"]??e.name,placeholder:e.placeholder,required:e.required,disabled:e.disabled,type:UW(),step:1,defaultValue:$W(e.defaultValue),autoFocus:e.autoFocus,error:Lt(e.outcome,e.name),onChange:t=>{if(e.onChange){const n=t.currentTarget.value;e.onChange(hS(n))}}})}function UW(){return"datetime-local"}function BW(e){const{propertyType:t}=e,n=Re(),r=v.useMemo(()=>{if(Pn(t.profile))return t.profile[0]},[t]),[o,s]=v.useState(r!==void 0);return v.useEffect(()=>{r&&(s(!0),n.requestProfileSchema(r).then(()=>s(!1)).catch(c=>{s(!1),console.warn(c)}))},[n,r]),r&&(o||!O0(r))?a.jsx("div",{children:"Loading..."}):a.jsx(vS,{profileUrl:r,path:e.path,typeName:"Extension",defaultValue:e.defaultValue,onChange:e.onChange})}function VW(e){const{outcome:t,path:n}=e,[r,o]=v.useState(e.defaultValue),{getExtendedProps:s}=v.useContext(dn),[c,d,f,p,m]=v.useMemo(()=>["use","prefix","given","family","suffix"].map(T=>s(e.path+"."+T)),[s,e.path]);function g(T){o(T),e.onChange&&e.onChange(T)}function y(T){g({...r,use:T||void 0})}function b(T){g({...r,prefix:T?T.split(" "):void 0})}function w(T){g({...r,given:T?T.split(" "):void 0})}function j(T){g({...r,family:T||void 0})}function C(T){g({...r,suffix:T?T.split(" "):void 0})}const R=e.valuePath??n;return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(un,{disabled:e.disabled||c?.readonly,defaultValue:r?.use,name:e.name+"-use","data-testid":"use",onChange:T=>y(T.currentTarget.value),data:["","temp","old","usual","official","nickname","anonymous","maiden"],error:Lt(t,R+".use")}),a.jsx(Fe,{disabled:e.disabled||d?.readonly,placeholder:"Prefix",name:e.name+"-prefix",defaultValue:r?.prefix?.join(" "),onChange:T=>b(T.currentTarget.value),error:Lt(t,R+".prefix")}),a.jsx(Fe,{disabled:e.disabled||f?.readonly,placeholder:"Given",name:e.name+"-given",defaultValue:r?.given?.join(" "),onChange:T=>w(T.currentTarget.value),error:Lt(t,R+".given")}),a.jsx(Fe,{disabled:e.disabled||p?.readonly,name:e.name+"-family",placeholder:"Family",defaultValue:r?.family,onChange:T=>j(T.currentTarget.value),error:Lt(t,R+".family")}),a.jsx(Fe,{disabled:e.disabled||m?.readonly,placeholder:"Suffix",name:e.name+"-suffix",defaultValue:r?.suffix?.join(" "),onChange:T=>C(T.currentTarget.value),error:Lt(t,R+".suffix")})]})}function FW(e){const[t,n]=v.useState(e.defaultValue),{elementsByPath:r,getExtendedProps:o}=v.useContext(dn),[s,c]=v.useMemo(()=>["system","value"].map(g=>r[e.path+"."+g]),[r,e.path]),[d,f]=v.useMemo(()=>["system","value"].map(g=>o(e.path+"."+g)),[o,e.path]);function p(g){n(g),e.onChange&&e.onChange(g)}const m=e.valuePath??e.path;return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(Fe,{disabled:e.disabled||d?.readonly,placeholder:"System",required:(s?.min??0)>0,defaultValue:t?.system,onChange:g=>p({...t,system:g.currentTarget.value}),error:Lt(e.outcome,m+".system")}),a.jsx(Fe,{disabled:e.disabled||f?.readonly,placeholder:"Value",required:(c?.min??0)>0,defaultValue:t?.value,onChange:g=>p({...t,value:g.currentTarget.value}),error:Lt(e.outcome,m+".value")})]})}const HW=["USD","EUR","CAD","GBP","AUD"];function qW(e){const{onChange:t}=e,[n,r]=v.useState(e.defaultValue),{getExtendedProps:o}=v.useContext(dn),[s,c]=v.useMemo(()=>["currency","value"].map(g=>o(e.path+"."+g)),[o,e.path]),d=v.useCallback(g=>{r(g),t&&t(g)},[t]),f=v.useCallback(g=>{d({...n,currency:g.currentTarget.value})},[n,d]),p=v.useCallback(g=>{d({...n,value:g.currentTarget.valueAsNumber})},[n,d]),m=a.jsx(un,{disabled:e.disabled||s?.readonly,defaultValue:n?.currency,data:HW,styles:{input:{fontWeight:500,borderTopLeftRadius:0,borderBottomLeftRadius:0,width:92}},onChange:f});return a.jsx(Fe,{disabled:e.disabled||c?.readonly,type:"number",name:e.name,label:e.label,placeholder:e.placeholder??"Value",defaultValue:n?.value?.toString()??"USD",leftSection:a.jsx(SH,{size:14}),rightSection:m,rightSectionWidth:92,onChange:p})}function GW(e){const[t,n]=v.useState(e.defaultValue),{getExtendedProps:r}=v.useContext(dn),[o,s]=v.useMemo(()=>["start","end"].map(d=>r(e.path+"."+d)),[r,e.path]);function c(d){n(d),e.onChange&&e.onChange(d)}return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(Eo,{disabled:e.disabled||o?.readonly,name:e.name+".start",placeholder:"Start",defaultValue:t?.start,onChange:d=>c({...t,start:d})}),a.jsx(Eo,{disabled:e.disabled||s?.readonly,name:e.name+".end",placeholder:"End",defaultValue:t?.end,onChange:d=>c({...t,end:d})})]})}function fl(e){const[t,n]=v.useState(e.defaultValue),{getExtendedProps:r}=v.useContext(dn),[o,s,c]=v.useMemo(()=>["comparator","value","unit"].map(f=>r(e.path+"."+f)),[r,e.path]);function d(f){n(f),e.onChange&&e.onChange(f)}return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(un,{disabled:e.disabled||o?.readonly,style:{width:80},"data-testid":e.name+"-comparator",defaultValue:t?.comparator,data:["","<","<=",">=",">"],onChange:f=>d({...t,comparator:f.currentTarget.value})}),a.jsx(Fe,{disabled:e.disabled||s?.readonly,id:e.name,name:e.name,required:e.required,"data-autofocus":e.autoFocus,"data-testid":e.name+"-value",type:"number",placeholder:"Value",defaultValue:t?.value,autoFocus:e.autoFocus,step:"any",onWheel:f=>{e.disableWheel&&f.currentTarget.blur()},onChange:f=>{d({...t,value:WW(f.currentTarget.value)})}}),a.jsx(Fe,{disabled:e.disabled||c?.readonly,placeholder:"Unit","data-testid":e.name+"-unit",defaultValue:t?.unit,onChange:f=>d({...t,unit:f.currentTarget.value})})]})}function WW(e){if(e)return Number.parseFloat(e)}function pS(e){const[t,n]=v.useState(e.defaultValue),{getExtendedProps:r}=v.useContext(dn),[o,s]=v.useMemo(()=>["low","high"].map(d=>r(e.path+"."+d)),[r,e.path]);function c(d){n(d),e.onChange&&e.onChange(d)}return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(fl,{path:e.path+".low",disabled:e.disabled||o?.readonly,name:e.name+"-low",defaultValue:t?.low,onChange:d=>c({...t,low:d})}),a.jsx(fl,{path:e.path+".high",disabled:e.disabled||s?.readonly,name:e.name+"-high",defaultValue:t?.high,onChange:d=>c({...t,high:d})})]})}function QW(e){const[t,n]=v.useState(e.defaultValue),{getExtendedProps:r}=v.useContext(dn),[o,s]=v.useMemo(()=>["numerator","denominator"].map(d=>r(e.path+"."+d)),[r,e.path]);function c(d){n(d),e.onChange&&e.onChange(d)}return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(fl,{path:e.path+".numerator",disabled:e.disabled||o?.readonly,name:e.name+"-numerator",defaultValue:t?.numerator,onChange:d=>c({...t,numerator:d})}),a.jsx(fl,{path:e.path+".denominator",disabled:e.disabled||s?.readonly,name:e.name+"-denominator",defaultValue:t?.denominator,onChange:d=>c({...t,denominator:d})})]})}const YW={Device:"device-name",Observation:"code",Subscription:"criteria",User:"email:contains"},KW=["AccessPolicy","Account","ActivityDefinition","Bot","CapabilityStatement","CareTeam","ClientApplication","CodeSystem","CompartmentDefinition","ConceptMap","EffectEvidenceSynthesis","Endpoint","EventDefinition","Evidence","EvidenceVariable","ExampleScenario","GraphDefinition","Group","HealthcareService","ImplementationGuide","InsurancePlan","Library","Location","Measure","MedicinalProduct","MessageDefinition","NamingSystem","OperationDefinition","Organization","Patient","Person","PlanDefinition","Practitioner","Project","Questionnaire","RelatedPerson","ResearchDefinition","ResearchElementDefinition","ResearchStudy","RiskEvidenceSynthesis","SearchParameter","StructureDefinition","StructureMap","TerminologyCapabilities","TestScript","UserConfiguration","ValueSet"];function XW(e){return{value:Ot(e)??"",label:ya(e),resource:e}}function El(e){const t=Re(),{resourceType:n,searchCriteria:r}=e,[o,s]=v.useState(),c=Kt(e.defaultValue,s),d=e.itemComponent??JW,f=e.onChange,p=v.useCallback(async(g,y)=>{const b=ZW(n),w=new URLSearchParams({[b]:g??"",_count:"10",...r});return await t.searchResources(n,w,{signal:y})},[t,n,r]),m=v.useCallback(g=>{f&&f(g[0])},[f]);return Pn(e.defaultValue)&&!o&&!c?null:a.jsx(lS,{disabled:e.disabled,name:e.name,label:e.label,error:e.error,required:e.required,itemComponent:d,defaultValue:c,placeholder:e.placeholder,maxValues:1,toOption:XW,loadOptions:p,onChange:m,clearable:!0})}const JW=v.forwardRef(({label:e,resource:t,active:n,...r},o)=>a.jsx("div",{ref:o,...r,children:a.jsxs(xe,{wrap:"nowrap",children:[a.jsx(Ss,{value:t}),a.jsxs("div",{children:[a.jsx(Te,{children:e}),a.jsx(Te,{size:"xs",c:"dimmed",children:t.birthDate||t.id})]})]})}));function ZW(e){return YW[e]??(KW.includes(e)?"name":"_id")}function cs(e){const{onChange:t}=e,n=Re(),[r,o]=v.useState(e.defaultValue),[s,c]=v.useState(()=>eQ(e.targetTypes)),[d,f]=v.useState(()=>tQ(e.defaultValue,s)),p=v.useRef(new XD),m=v.useMemo(()=>d?.type==="profile"?{...e.searchCriteria,_profile:d.value}:e.searchCriteria,[e.searchCriteria,d]);v.useEffect(()=>{let b=!1;const w=s?.map(j=>{if(!rQ(j))return Promise.resolve(j);b=!0;const C=j.value,R=p.current.get(C);if(R)return R;const T=nQ(n,j.value).then(_=>{const k={...j};return _?Pn(_.type)?(k.resourceType=_.type,k.name=_.name,k.title=_.title):(console.error(`StructureDefinition.type missing for ${j.value}`),k.error="StructureDefinition.type missing"):(console.error(`StructureDefinition not found for ${j.value}`),k.error="StructureDefinition not found"),k}).catch(_=>(console.error(_),{...j,error:_})),E=new Wi(T);return p.current.set(C,E),E});!w||!b||Promise.all(w).then(j=>{if(c(j),!d)return;const C=j.findIndex(R=>R.value===d.value||R.resourceType===d.resourceType);if(C===-1){console.debug(`defaultValue had unexpected resourceType: ${d.resourceType}`);return}f(j[C])}).catch(console.error)},[n,d,s]);const g=v.useCallback(b=>{const w=b?Wt(b):void 0;o(w),t&&t(w)},[t]),y=v.useMemo(()=>s?s.map(b=>({value:b.value,label:b.type==="profile"?b.title??b.name??b.resourceType??b.value:b.value})):[],[s]);return a.jsxs(a.Fragment,{children:[e.name&&a.jsx("input",{type:"hidden",name:e.name,value:r?.reference??""}),a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[s&&s.length>1&&a.jsx(un,{name:e.name+"-resourceType",disabled:e.disabled,"data-autofocus":e.autoFocus,"data-testid":"reference-input-resource-type-select",defaultValue:d?.resourceType,autoFocus:e.autoFocus,onChange:b=>{const w=b.currentTarget.value,j=s.find(C=>C.value===w);f(j)},data:y}),!s&&a.jsx(uS,{disabled:e.disabled,autoFocus:e.autoFocus,testId:"reference-input-resource-type-input",defaultValue:d?.resourceType,onChange:b=>{f(b?{type:"resourceType",value:b,resourceType:b}:void 0)},name:e.name+"-resourceType",placeholder:"Resource Type"}),a.jsx(El,{resourceType:d?.resourceType,name:e.name+"-id",required:e.required,placeholder:e.placeholder,defaultValue:r,searchCriteria:m,onChange:g,disabled:e.disabled})]})]})}function eQ(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 tQ(e,t){const n=e?.reference?.split("/")[0];if(n){const r=t?.find(o=>o.resourceType===n);return r||{type:"resourceType",value:n,resourceType:n}}if(t&&t.length>0)return t[0]}async function nQ(e,t){const n=tu(t);if(n)return{type:n.type,name:n.name,title:n.title};const r=`{
164
- StructureDefinitionList(url: "${t}", _sort: "_lastUpdated", _count: 1) {
165
- type,
166
- name,
167
- title,
168
- }
169
- }`.replaceAll(/\s+/g," ");return(await e.graphql(r)).data.StructureDefinitionList[0]}function rQ(e){return e.type==="profile"&&!e?.error&&wn(e.resourceType)}function iQ(e,t,n){return t===void 0?e:n===void 0?t:`${t}[${n}]`}const oQ="_indented_ldk1d_1",Pk={indented:oQ};function mS({propertyDisplayName:e,onClick:t,testId:n}){const r=e?`Add ${e}`:"Add";return e?a.jsx(Ae,{title:r,size:"sm",color:"green.6",variant:"subtle","data-testid":n,leftSection:a.jsx(Sp,{size:"1.25rem"}),onClick:t,children:r}):a.jsx(Rn,{title:r,color:"green.6","data-testid":n,onClick:t,children:a.jsx(Sp,{size:"1.25rem"})})}function Nk({propertyDisplayName:e,onClick:t,testId:n}){return a.jsx(Rn,{title:e?`Remove ${e}`:"Remove",color:"red.5","data-testid":n,variant:"subtle",onClick:t,children:a.jsx(bp,{size:"1.25rem"})})}function aQ(e){const{slice:t,property:n}=e,[r,o]=v.useState(e.defaultValue),s=t.typeSchema?.elements??t.elements,c=v.useContext(dn),d=v.useMemo(()=>{if(Pn(s))return Uc({parentContext:c,elements:s,path:e.path,profileUrl:t.typeSchema?.url})},[c,e.path,t.typeSchema?.url,s]);function f(b){o(b),e.onChange&&e.onChange(b)}const p=t.min>0,m=wn(t.elements),g=_A(t.name),y=e.property.readonly&&r.length===0;return zm(dn.Provider,d,a.jsx(zt,{title:g,description:t.definition,withAsterisk:p,fhirPath:`${n.path}:${t.name}`,testId:e.testId,readonly:e.property.readonly,children:y?a.jsx(Te,{c:"dimmed",children:"(empty)"}):a.jsxs(Ue,{className:m?Pk.indented:void 0,children:[r.map((b,w)=>a.jsxs(xe,{wrap:"nowrap",children:[a.jsx("div",{style:{flexGrow:1},"data-testid":e.testId&&`${e.testId}-elements-${w}`,children:a.jsx(gS,{elementDefinitionType:t.type[0],name:t.name,defaultValue:b,onChange:j=>{const C=[...r];C[w]=j,f(C)},outcome:e.outcome,min:t.min,max:t.max,binding:t.binding,path:e.path,valuePath:void 0,readOnly:e.property.readonly})}),!e.property.readonly&&r.length>t.min&&a.jsx(Nk,{propertyDisplayName:g,testId:e.testId&&`${e.testId}-remove-${w}`,onClick:j=>{pn(j);const C=[...r];C.splice(w,1),f(C)}})]},`${w}-${r.length}`)),!e.property.readonly&&r.length<t.max&&a.jsx(xe,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(mS,{propertyDisplayName:g,onClick:b=>{pn(b);const w=[...r,void 0];f(w)},testId:e.testId&&`${e.testId}-add`})})]})}))}function sQ(e){const{property:t}=e,n=Re(),[r,o]=v.useState(!0),[s,c]=v.useState([]),[d]=v.useState(()=>Array.isArray(e.defaultValue)?e.defaultValue:[]),[f,p]=v.useState(()=>[d]),m=v.useContext(dn),g=t.type[0]?.code;v.useEffect(()=>{Tk({medplum:n,property:t}).then(T=>{c(T);const E=Ek(d,T,t.slicing,m.profileUrl);lQ(E,T),p(E),o(!1)}).catch(T=>{console.error(T),o(!1)})},[n,t,d,m.profileUrl,p]);function y(T,E){const _=[...f];if(_[E]=T,p(_),e.onChange){const k=_.flat().filter(L=>L!==void 0);e.onChange(k)}}if(r)return a.jsx("div",{children:"Loading..."});const b=s.length,w=f[b],j=!(e.hideNonSliceValues??(g==="Extension"&&s.length>0)),C=cl(t.path),R=e.property.readonly&&s.length===0&&d.length===0;return a.jsxs(Ue,{className:e.indent?Pk.indented:void 0,children:[R&&a.jsx(Te,{c:"dimmed",children:"(empty)"}),s.map((T,E)=>a.jsx(aQ,{slice:T,path:e.path,valuePath:e.valuePath,property:t,defaultValue:f[E],onChange:_=>{y(_,E)},testId:`slice-${T.name}`},T.name)),j&&w.map((T,E)=>a.jsxs(xe,{wrap:"nowrap",style:{flexGrow:1},children:[a.jsx("div",{style:{flexGrow:1},children:a.jsx(nf,{arrayElement:!0,property:e.property,name:e.name+"."+E,path:e.path,valuePath:iQ(e.path,e.valuePath,E),defaultValue:T,onChange:_=>{const k=[...w];k[E]=_,y(k,b)},defaultPropertyType:void 0,outcome:e.outcome})}),!e.property.readonly&&a.jsx(Nk,{propertyDisplayName:C,testId:`nonsliced-remove-${E}`,onClick:_=>{pn(_);const k=[...w];k.splice(E,1),y(k,b)}})]},`${E}-${w.length}`)),!e.property.readonly&&j&&f.flat().length<t.max&&a.jsx(xe,{wrap:"nowrap",style:{justifyContent:"flex-start"},children:a.jsx(mS,{propertyDisplayName:C,onClick:T=>{pn(T);const E=[...w];E.push(void 0),y(E,b)},testId:"nonsliced-add"})})]})}function lQ(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 cQ(e){const[t,n]=v.useState(!1),r=l2(),o=v.useRef(null),s={...e.styles};return t||(s.input||(s.input={}),s.input.WebkitTextSecurity="disc"),a.jsxs(to,{gap:"xs",children:[a.jsx(Sl,{...e,styles:{...s,root:{...s.root??{},flexGrow:1}},ref:o,autosize:!0,minRows:1,onFocus:()=>n(!0),onBlur:()=>n(!1)}),a.jsx(Rn,{title:"Copy secret",onClick:()=>{r.copy(o.current?.value),ke({color:"green",message:"Copied"})},children:a.jsx(rS,{})})]})}const uQ=["sun","mon","tue","wed","thu","fri","sat"];function dQ(e){const[t,n]=v.useState(e.defaultValue),[r,o]=v.useState(!e.disabled&&(e.defaultModalOpen??!1)),s=v.useRef(t);return s.current=t,a.jsxs(a.Fragment,{children:[a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx("span",{children:EA(s.current)||"No repeat"}),a.jsx(Ae,{disabled:e.disabled,onClick:()=>o(!0),children:"Edit"})]}),!e.disabled&&a.jsx(fQ,{path:e.path,visible:r,defaultValue:s.current,onOk:c=>{e.onChange&&e.onChange(c),n(c),o(!1)},onCancel:()=>o(!1)})]})}const LT={repeat:{period:1,periodUnit:"d"}};function fQ(e){const[t,n]=v.useState(e.defaultValue||LT),{getExtendedProps:r}=v.useContext(dn),[o,s,c,d,f]=v.useMemo(()=>["event","repeat","repeat.period","repeat.periodUnit","repeat.dayOfWeek"].map(j=>r(e.path+"."+j)),[r,e.path]),p=v.useRef(t);p.current=t;function m(j){n({...p.current,event:[j]})}function g(j){n({...p.current,repeat:j})}function y(j){g({...p.current?.repeat,period:j})}function b(j){g({...p.current?.repeat,periodUnit:j})}function w(j){g({...p.current?.repeat,dayOfWeek:j})}return a.jsx(Gn,{title:"Timing",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:()=>e.onCancel(),children:a.jsxs(Ue,{children:[a.jsx(zt,{title:"Starts on",htmlFor:"timing-dialog-start",children:a.jsx(Eo,{disabled:o?.readonly,name:"timing-dialog-start",onChange:j=>m(j)})}),a.jsx(Hd,{disabled:s?.readonly,label:"Repeat",checked:!!t.repeat,onChange:j=>g(j.currentTarget.checked?LT.repeat:void 0)}),t.repeat&&a.jsxs(a.Fragment,{children:[a.jsx(zt,{title:"Repeat every",htmlFor:"timing-dialog-period",children:a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",children:[a.jsx(Fe,{disabled:c?.readonly,type:"number",step:1,id:"timing-dialog-period",name:"timing-dialog-period",defaultValue:t.repeat.period||1,onChange:j=>y(Number.parseInt(j.currentTarget.value,10)||1)}),a.jsx(un,{disabled:d?.readonly,id:"timing-dialog-periodUnit",name:"timing-dialog-periodUnit",defaultValue:t.repeat.periodUnit,onChange:j=>b(j.currentTarget.value),data:[{label:"minute",value:"min"},{label:"hour",value:"h"},{label:"day",value:"d"},{label:"week",value:"wk"},{label:"month",value:"mo"},{label:"year",value:"a"}]})]})}),t.repeat.periodUnit==="wk"&&a.jsx(zt,{title:"Repeat on",children:a.jsx(gd.Group,{multiple:!0,onChange:w,children:a.jsx(xe,{justify:"space-between",mt:"md",gap:"xs",children:uQ.map(j=>a.jsx(gd,{value:j,size:"xs",radius:"xl",disabled:f?.readonly,children:j.charAt(0).toUpperCase()},j))})})})]}),a.jsx(xe,{justify:"flex-end",children:a.jsx(Ae,{onClick:()=>e.onOk(t),children:"OK"})})]})})}function nf(e){const{property:t,name:n,onChange:r,defaultValue:o}=e,s=e.defaultPropertyType&&e.defaultPropertyType!=="undefined"?e.defaultPropertyType:t.type[0].code,c=t.type;if((t.isArray||t.max>1)&&!e.arrayElement){if(s===ne.Attachment)return a.jsx(HG,{name:n,defaultValue:o,onChange:r,disabled:t.readonly});const d=c[0]?.code!==ne.Extension;return a.jsx(sQ,{property:t,name:n,path:e.path,valuePath:e.valuePath,defaultValue:o,indent:d,onChange:r,outcome:e.outcome})}else return c.length>1?a.jsx(hQ,{elementDefinitionTypes:c,...e}):a.jsx(gS,{name:n,defaultValue:o,onChange:d=>{if(e.onChange){const f=e.name.replace("[x]",qn(c[0].code));e.onChange(d,f)}},outcome:e.outcome,elementDefinitionType:c[0],min:t.min,max:t.min,binding:t.binding,path:e.path,valuePath:e.valuePath,readOnly:t.readonly})}function hQ(e){const t=e.elementDefinitionTypes;let n;e.defaultPropertyType&&(n=t.find(s=>s.code===e.defaultPropertyType)),n||(n=t[0]);const[r,o]=v.useState(n);return a.jsxs(xe,{gap:"xs",grow:!0,wrap:"nowrap",align:"flex-start",children:[a.jsx(un,{disabled:e.property.readonly,style:{width:"200px"},defaultValue:r.code,"data-testid":e.name&&e.name+"-selector",onChange:s=>{o(t.find(c=>c.code===s.currentTarget.value))},data:t.map(s=>({value:s.code,label:s.code}))}),a.jsx(gS,{name:e.name,defaultValue:e.defaultValue,outcome:e.outcome,elementDefinitionType:r,onChange:s=>{e.onChange&&e.onChange(s,e.name.replace("[x]",qn(r.code)))},min:e.property.min,max:e.property.max,binding:e.property.binding,path:e.property.path,valuePath:e.valuePath,readOnly:e.property.readonly})]})}function gS(e){const{name:t,onChange:n,outcome:r,binding:o,path:s,valuePath:c,readOnly:d}=e,f=e.min!==void 0&&e.min>0,p=e.elementDefinitionType.code,m=v.useContext(dn),g=v.useMemo(()=>{if(!z0(p)||!wn(e.defaultValue))return e.defaultValue;const w=Object.create(null);if(m.path===e.path)xT(w,m.elements);else{const j=Xs(m.path,e.path);if(j===void 0)return e.defaultValue;xT(w,m.elements,j)}return Pn(w)?w:e.defaultValue},[p,m.path,m.elements,e.path,e.defaultValue]);if(!p)return a.jsx("div",{children:"Property type not specified "});function y(){return{name:t,defaultValue:g,onChange:n,outcome:r,path:s,valuePath:c,disabled:d}}function b(){const w=Lt(e.outcome,c??s);return{id:t,name:t,"data-testid":t,defaultValue:g,required:f,error:w,disabled:d}}switch(p){case ne.SystemString:case ne.canonical:case ne.string:case ne.time:case ne.uri:case ne.url:return e.path==="Project.secret.value[x]"?a.jsx(cQ,{...b(),onChange:w=>{e.onChange&&e.onChange(w.currentTarget.value)}}):a.jsx(Fe,{...b(),onChange:w=>{n&&n(w.currentTarget.value)}});case ne.date:return a.jsx(Fe,{...b(),type:"date",onChange:w=>{n&&n(w.currentTarget.value)}});case ne.dateTime:case ne.instant:return a.jsx(Eo,{...b(),onChange:n,outcome:r});case ne.decimal:case ne.integer:case ne.positiveInt:case ne.unsignedInt:return a.jsx(Fe,{...b(),type:"number",step:p===ne.decimal?"any":"1",onChange:w=>{if(n){const j=w.currentTarget.valueAsNumber;n(Number.isNaN(j)?void 0:j)}}});case ne.code:return a.jsx(pk,{...b(),error:void 0,onChange:n,binding:o?.valueSet,creatable:!0,maxValues:1});case ne.boolean:return a.jsx(Ln,{...b(),defaultChecked:!!g,onChange:w=>{n&&n(w.currentTarget.checked)}});case ne.base64Binary:case ne.markdown:case ne.xhtml:return a.jsx(Sl,{...b(),spellCheck:p!==ne.base64Binary,onChange:w=>{n&&n(w.currentTarget.value)}});case ne.Address:return a.jsx(MF,{...y()});case ne.Annotation:return a.jsx(LF,{...y()});case ne.Attachment:return a.jsx(mk,{...y()});case ne.CodeableConcept:return a.jsx(PW,{binding:o?.valueSet,...y()});case ne.Coding:return a.jsx(MW,{binding:o?.valueSet,...y()});case ne.ContactDetail:return a.jsx(zW,{...y()});case ne.ContactPoint:return a.jsx(kk,{...y()});case ne.Extension:return a.jsx(BW,{...y(),propertyType:e.elementDefinitionType});case ne.HumanName:return a.jsx(VW,{...y()});case ne.Identifier:return a.jsx(FW,{...y()});case ne.Money:return a.jsx(qW,{...y()});case ne.Period:return a.jsx(GW,{...y()});case ne.Duration:case ne.Quantity:return a.jsx(fl,{...y()});case ne.Range:return a.jsx(pS,{...y()});case ne.Ratio:return a.jsx(QW,{...y()});case ne.Reference:return a.jsx(cs,{...y(),targetTypes:mQ(e.elementDefinitionType)});case ne.Timing:return a.jsx(dQ,{...y()});case ne.Dosage:case ne.UsageContext:default:return a.jsx(vS,{...y(),typeName:p})}}const pQ=[`${io}/fhir/StructureDefinition/`,"https://medplum.com/fhir/StructureDefinition/"];function mQ(e){return e?.targetProfile?.map(t=>{const n=pQ.find(r=>t.startsWith(r));return n?t.slice(n.length):t})}function gQ(e){const[t,n]=v.useState(e.defaultValue??{}),r=v.useContext(dn),o=v.useMemo(()=>OF(r.elements),[r.elements]);function s(d){n(d),e.onChange&&e.onChange(d)}const c={type:e.type,value:t};return a.jsx(Ue,{style:{flexGrow:1},"data-testid":e.testId,children:o.map(([d,f])=>{const[p,m]=xW(c,d,f),g=f.min!==void 0&&f.min>0,y=e.valuePath?e.valuePath+"."+d:void 0,b=a.jsx(nf,{property:f,name:d,path:e.path+"."+d,valuePath:y,defaultValue:p,defaultPropertyType:m,onChange:(w,j)=>{s(AW({...t},d,j??d,f,w))},outcome:e.outcome},d);return e.type==="Extension"||eS.includes(d)?b:f.type.length===1&&f.type[0].code==="boolean"?a.jsx(Ak,{title:cl(d),description:f.description,htmlFor:d,fhirPath:f.path,withAsterisk:g,readonly:f.readonly,children:b},d):a.jsx(zt,{title:cl(d),description:f.description,withAsterisk:g,htmlFor:d,outcome:e.outcome,fhirPath:f.path,errorExpression:y,readonly:f.readonly,children:b},d)})})}function vS(e){const[t]=v.useState(()=>e.defaultValue??{}),n=v.useContext(dn),r=e.profileUrl??n?.profileUrl,o=v.useMemo(()=>Em(e.typeName,r),[e.typeName,r]),s=o?.type??e.typeName,c=v.useMemo(()=>{if(o)return Uc({parentContext:n,elements:o.elements,path:e.path,profileUrl:o.url,accessPolicyResource:e.accessPolicyResource})},[o,n,e.path,e.accessPolicyResource]);return o?zm(dn.Provider,c,a.jsx(gQ,{path:e.path,valuePath:e.valuePath,type:s,defaultValue:t,onChange:e.onChange,outcome:e.outcome})):a.jsxs("div",{children:[s," not implemented"]})}const vQ="_noteCite_10swh_5",yQ="_noteRoot_10swh_10",IT={noteCite:vQ,noteRoot:yQ};function Ok({value:e}){return e?a.jsx(Ue,{justify:"flex-start",gap:"xs",children:e.map(t=>t.text&&a.jsx(Qb,{classNames:{cite:IT.noteCite,root:IT.noteRoot},cite:t.authorReference?.display||t.authorString,icon:null,children:t.text},`note-${t.text}`))}):null}function Tl(e){const{value:t,link:n,...r}=e,[o,s]=v.useState(),c=Kt(t,s);let d;if(o&&!ZD(o))d=`[${Ge(o)}]`;else if(c)d=ya(c);else return null;return n?a.jsx(St,{to:t,...r,children:d}):a.jsx(Te,{component:"span",...r,children:d})}function Ac(e){return a.jsxs(xe,{gap:"xs",children:[a.jsx(Ss,{size:24,radius:12,value:e.value,link:e.link}),a.jsx(Tl,{value:e.value,link:e.link})]})}const xQ={draft:"blue",active:"blue","on-hold":"yellow",revoked:"red",completed:"green","entered-in-error":"red",unknown:"gray",retired:"gray",registered:"blue",preliminary:"blue",final:"green",amended:"yellow",corrected:"yellow",cancelled:"red",requested:"blue",received:"blue",accepted:"blue",rejected:"red",ready:"blue","in-progress":"blue",failed:"red",proposed:"blue",pending:"blue",booked:"blue",arrived:"blue",fulfilled:"green",noshow:"red","checked-in":"blue",waitlist:"gray",routine:"gray",urgent:"red",asap:"red",stat:"red","not-done":"red",connected:"green",disconnected:"red",finished:"green",planned:"gray"};function $m(e){const{status:t,...n}=e;return a.jsx(rm,{color:e.color||xQ[t],...n,children:t.replaceAll("-"," ")})}const bQ="_table_pe9td_1",SQ="_criticalRow_pe9td_12",Mk={table:bQ,criticalRow:SQ};yS.defaultProps={hideObservationNotes:!1,hideSpecimenInfo:!1,hideSubject:!1};function yS(e){const t=Re(),n=Kt(e.value),[r,o]=v.useState();if(v.useEffect(()=>{n?.specimen&&Promise.allSettled(n.specimen.map(c=>t.readReference(c))).then(c=>c.filter(d=>d.status==="fulfilled").map(d=>d.value)).then(o).catch(console.error)},[t,n]),!n)return null;const s=r?.flatMap(c=>c.note||[])||[];if(n.presentedForm&&n.presentedForm.length>0){const c=n.presentedForm[0];c.contentType?.startsWith("text/plain")&&c.data&&s.push({text:window.atob(c.data)})}return a.jsxs(Ue,{children:[a.jsx(Ie,{children:"Diagnostic Report"}),a.jsx(wQ,{value:n,hideSubject:e.hideSubject}),r&&!e.hideSpecimenInfo&&jQ(r),n.result&&a.jsx(CQ,{hideObservationNotes:e.hideObservationNotes,value:n.result}),s.length>0&&a.jsx(Ok,{value:s})]})}function wQ({value:e,hideSubject:t=!1}){return a.jsxs(xe,{mt:"md",gap:30,children:[e.subject&&!t&&a.jsxs("div",{children:[a.jsx(Te,{size:"xs",tt:"uppercase",c:"dimmed",children:"Subject"}),a.jsx(Ac,{value:e.subject,link:!0})]}),e.resultsInterpreter?.map(n=>a.jsxs("div",{children:[a.jsx(Te,{size:"xs",tt:"uppercase",c:"dimmed",children:"Interpreter"}),a.jsx(Ac,{value:n,link:!0})]},n.reference)),e.performer?.map(n=>a.jsxs("div",{children:[a.jsx(Te,{size:"xs",tt:"uppercase",c:"dimmed",children:"Performer"}),a.jsx(Ac,{value:n,link:!0})]},n.reference)),e.issued&&a.jsxs("div",{children:[a.jsx(Te,{size:"xs",tt:"uppercase",c:"dimmed",children:"Issued"}),a.jsx(Te,{children:Sr(e.issued)})]}),e.status&&a.jsxs("div",{children:[a.jsx(Te,{size:"xs",tt:"uppercase",c:"dimmed",children:"Status"}),a.jsx($m,{status:e.status})]})]})}function jQ(e){return a.jsxs(Ue,{gap:"xs",children:[a.jsx(Ie,{order:2,size:"h6",children:"Specimens"}),a.jsx(kr,{type:"ordered",children:e?.map(t=>a.jsx(kr.Item,{ml:"sm",children:a.jsxs(xe,{gap:20,children:[a.jsxs(xe,{gap:5,children:[a.jsx(Te,{fw:500,children:"Collected:"})," ",Sr(t.collection?.collectedDateTime)]}),a.jsxs(xe,{gap:5,children:[a.jsx(Te,{fw:500,children:"Received:"})," ",Sr(t.receivedTime)]})]})},`specimen-${t.id}`))})]})}function CQ(e){return a.jsxs("table",{className:Mk.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(Lk,{value:e.value,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes})})]})}function Lk(e){return a.jsx(a.Fragment,{children:e.value?.map(t=>a.jsx(EQ,{value:t,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes},`obs-${Ta(t)?t.reference:t.id}`))})}function EQ(e){const t=Kt(e.value);if(!t||e.ancestorIds?.includes(t.id))return null;const n=!e.hideObservationNotes&&t.note,r=_Q(t);return a.jsxs(a.Fragment,{children:[a.jsxs("tr",{className:$t({[Mk.criticalRow]:r}),children:[a.jsx("td",{rowSpan:n?2:1,children:a.jsx(St,{to:t,children:a.jsx(Co,{value:t.code})})}),a.jsx("td",{children:a.jsx(TQ,{value:t})}),a.jsx("td",{children:a.jsx(RQ,{value:t.referenceRange})}),a.jsx("td",{children:t.interpretation&&t.interpretation.length>0&&a.jsx(Co,{value:t.interpretation[0]})}),a.jsx("td",{children:t.category&&t.category.length>0&&a.jsx(a.Fragment,{children:t.category.map(o=>a.jsx("div",{children:a.jsx(Co,{value:o})},`category-${ds(o)}`))})}),a.jsx("td",{children:t.performer?.map(o=>a.jsx(jp,{value:o},o.reference))}),a.jsx("td",{children:t.status&&a.jsx($m,{status:t.status})})]}),t.hasMember&&a.jsx(Lk,{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(Ok,{value:t.note})})})]})}function TQ(e){const t=e.value;return a.jsx(a.Fragment,{children:TA(t)})}function RQ(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(fS,{value:t}):null}function _Q(e){const t=e.interpretation?.[0]?.coding?.[0]?.code;return t==="AA"||t==="LL"||t==="HH"||t==="A"}var Oy={},la={},zT;function Ik(){if(zT)return la;zT=1,Object.defineProperty(la,"__esModule",{value:!0}),la.Pointer=la.escapeToken=la.unescapeToken=void 0;function e(r){return r.replace(/~1/g,"/").replace(/~0/g,"~")}la.unescapeToken=e;function t(r){return r.replace(/~/g,"~0").replace(/\//g,"~1")}la.escapeToken=t;var n=(function(){function r(o){o===void 0&&(o=[""]),this.tokens=o}return r.fromJSON=function(o){var s=o.split("/").map(e);if(s[0]!=="")throw new Error("Invalid JSON Pointer: ".concat(o));return new r(s)},r.prototype.toString=function(){return this.tokens.map(t).join("/")},r.prototype.evaluate=function(o){for(var s=null,c="",d=o,f=1,p=this.tokens.length;f<p;f++)s=d,c=this.tokens[f],!(c=="__proto__"||c=="constructor"||c=="prototype")&&(d=(s||{})[c]);return{parent:s,key:c,value:d}},r.prototype.get=function(o){return this.evaluate(o).value},r.prototype.set=function(o,s){var c=this.evaluate(o);c.parent&&(c.parent[c.key]=s)},r.prototype.push=function(o){this.tokens.push(o)},r.prototype.add=function(o){var s=this.tokens.concat(String(o));return new r(s)},r})();return la.Pointer=n,la}var xn={},My={},$T;function zk(){return $T||($T=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.clone=e.objectType=e.hasOwnProperty=void 0,e.hasOwnProperty=Object.prototype.hasOwnProperty;function t(o){return o===void 0?"undefined":o===null?"null":Array.isArray(o)?"array":typeof o}e.objectType=t;function n(o){return o!=null&&typeof o=="object"}function r(o){if(!n(o))return o;if(o.constructor==Array){for(var s=o.length,c=new Array(s),d=0;d<s;d++)c[d]=r(o[d]);return c}if(o.constructor==Date){var f=new Date(+o);return f}var p={};for(var m in o)e.hasOwnProperty.call(o,m)&&(p[m]=r(o[m]));return p}e.clone=r})(My)),My}var Dr={},UT;function $k(){if(UT)return Dr;UT=1,Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.diffAny=Dr.diffObjects=Dr.diffArrays=Dr.intersection=Dr.subtract=Dr.isDestructive=void 0;var e=zk();function t(m){var g=m.op;return g==="remove"||g==="replace"||g==="copy"||g==="move"}Dr.isDestructive=t;function n(m,g){var y={};for(var b in m)e.hasOwnProperty.call(m,b)&&m[b]!==void 0&&(y[b]=1);for(var w in g)e.hasOwnProperty.call(g,w)&&g[w]!==void 0&&delete y[w];return Object.keys(y)}Dr.subtract=n;function r(m){for(var g=m.length,y={},b=0;b<g;b++){var w=m[b];for(var j in w)e.hasOwnProperty.call(w,j)&&w[j]!==void 0&&(y[j]=(y[j]||0)+1)}for(var j in y)y[j]<g&&delete y[j];return Object.keys(y)}Dr.intersection=r;function o(m){return m.op==="add"}function s(m){return m.op==="remove"}function c(m,g){return{operations:m.operations.concat(g),cost:m.cost+1}}function d(m,g,y,b){b===void 0&&(b=p);var w={"0,0":{operations:[],cost:0}};function j(_,k){var L="".concat(_,",").concat(k),A=w[L];if(A===void 0){if(_>0&&k>0&&!b(m[_-1],g[k-1],y.add(String(_-1))).length)A=j(_-1,k-1);else{var N=[];if(_>0){var U=j(_-1,k),B={op:"remove",index:_-1};N.push(c(U,B))}if(k>0){var Q=j(_,k-1),J={op:"add",index:_-1,value:g[k-1]};N.push(c(Q,J))}if(_>0&&k>0){var Z=j(_-1,k-1),$={op:"replace",index:_-1,original:m[_-1],value:g[k-1]};N.push(c(Z,$))}var W=N.sort(function(M,I){return M.cost-I.cost})[0];A=W}w[L]=A}return A}var C=isNaN(m.length)||m.length<=0?0:m.length,R=isNaN(g.length)||g.length<=0?0:g.length,T=j(C,R).operations,E=T.reduce(function(_,k){var L=_[0],A=_[1];if(o(k)){var N=k.index+1+A,U=N<C+A?String(N):"-",B={op:k.op,path:y.add(U).toString(),value:k.value};return[L.concat(B),A+1]}else if(s(k)){var B={op:k.op,path:y.add(String(k.index+A)).toString()};return[L.concat(B),A-1]}else{var Q=y.add(String(k.index+A)),J=b(k.original,k.value,Q);return[L.concat.apply(L,J),A]}},[[],0])[0];return E}Dr.diffArrays=d;function f(m,g,y,b){b===void 0&&(b=p);var w=[];return n(m,g).forEach(function(j){w.push({op:"remove",path:y.add(j).toString()})}),n(g,m).forEach(function(j){w.push({op:"add",path:y.add(j).toString(),value:g[j]})}),r([m,g]).forEach(function(j){w.push.apply(w,b(m[j],g[j],y.add(j)))}),w}Dr.diffObjects=f;function p(m,g,y,b){if(b===void 0&&(b=p),m===g)return[];var w=(0,e.objectType)(m),j=(0,e.objectType)(g);return w=="array"&&j=="array"?d(m,g,y,b):w=="object"&&j=="object"?f(m,g,y,b):[{op:"replace",path:y.toString(),value:g}]}return Dr.diffAny=p,Dr}var BT;function DQ(){if(BT)return xn;BT=1;var e=xn&&xn.__extends||(function(){var C=function(R,T){return C=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,_){E.__proto__=_}||function(E,_){for(var k in _)Object.prototype.hasOwnProperty.call(_,k)&&(E[k]=_[k])},C(R,T)};return function(R,T){if(typeof T!="function"&&T!==null)throw new TypeError("Class extends value "+String(T)+" is not a constructor or null");C(R,T);function E(){this.constructor=R}R.prototype=T===null?Object.create(T):(E.prototype=T.prototype,new E)}})();Object.defineProperty(xn,"__esModule",{value:!0}),xn.apply=xn.InvalidOperationError=xn.test=xn.copy=xn.move=xn.replace=xn.remove=xn.add=xn.TestError=xn.MissingError=void 0;var t=Ik(),n=zk(),r=$k(),o=(function(C){e(R,C);function R(T){var E=C.call(this,"Value required at path: ".concat(T))||this;return E.path=T,E.name="MissingError",E}return R})(Error);xn.MissingError=o;var s=(function(C){e(R,C);function R(T,E){var _=C.call(this,"Test failed: ".concat(T," != ").concat(E))||this;return _.actual=T,_.expected=E,_.name="TestError",_}return R})(Error);xn.TestError=s;function c(C,R,T){if(Array.isArray(C))if(R=="-")C.push(T);else{var E=parseInt(R,10);C.splice(E,0,T)}else C[R]=T}function d(C,R){if(Array.isArray(C)){var T=parseInt(R,10);C.splice(T,1)}else delete C[R]}function f(C,R){var T=t.Pointer.fromJSON(R.path).evaluate(C);return T.parent===void 0?new o(R.path):(c(T.parent,T.key,(0,n.clone)(R.value)),null)}xn.add=f;function p(C,R){var T=t.Pointer.fromJSON(R.path).evaluate(C);return T.value===void 0?new o(R.path):(d(T.parent,T.key),null)}xn.remove=p;function m(C,R){var T=t.Pointer.fromJSON(R.path).evaluate(C);if(T.parent===null)return new o(R.path);if(Array.isArray(T.parent)){if(parseInt(T.key,10)>=T.parent.length)return new o(R.path)}else if(T.value===void 0)return new o(R.path);return T.parent[T.key]=(0,n.clone)(R.value),null}xn.replace=m;function g(C,R){var T=t.Pointer.fromJSON(R.from).evaluate(C);if(T.value===void 0)return new o(R.from);var E=t.Pointer.fromJSON(R.path).evaluate(C);return E.parent===void 0?new o(R.path):(d(T.parent,T.key),c(E.parent,E.key,T.value),null)}xn.move=g;function y(C,R){var T=t.Pointer.fromJSON(R.from).evaluate(C);if(T.value===void 0)return new o(R.from);var E=t.Pointer.fromJSON(R.path).evaluate(C);return E.parent===void 0?new o(R.path):(c(E.parent,E.key,(0,n.clone)(T.value)),null)}xn.copy=y;function b(C,R){var T=t.Pointer.fromJSON(R.path).evaluate(C);return(0,r.diffAny)(T.value,R.value,new t.Pointer).length?new s(T.value,R.value):null}xn.test=b;var w=(function(C){e(R,C);function R(T){var E=C.call(this,"Invalid operation: ".concat(T.op))||this;return E.operation=T,E.name="InvalidOperationError",E}return R})(Error);xn.InvalidOperationError=w;function j(C,R){switch(R.op){case"add":return f(C,R);case"remove":return p(C,R);case"replace":return m(C,R);case"move":return g(C,R);case"copy":return y(C,R);case"test":return b(C,R)}return new w(R)}return xn.apply=j,xn}var VT;function AQ(){return VT||(VT=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createTests=e.createPatch=e.applyPatch=e.Pointer=void 0;var t=Ik();Object.defineProperty(e,"Pointer",{enumerable:!0,get:function(){return t.Pointer}});var n=DQ(),r=$k();function o(p,m){return m.map(function(g){return(0,n.apply)(p,g)})}e.applyPatch=o;function s(p){function m(g,y,b){var w=p(g,y,b);return Array.isArray(w)?w:(0,r.diffAny)(g,y,b,m)}return m}function c(p,m,g){var y=new t.Pointer;return(g?s(g):r.diffAny)(p,m,y)}e.createPatch=c;function d(p,m){var g=t.Pointer.fromJSON(m).evaluate(p);if(g!==void 0)return{op:"test",path:m,value:g.value}}function f(p,m){var g=new Array;return m.filter(r.isDestructive).forEach(function(y){var b=d(p,y.path);if(b&&g.push(b),"from"in y){var w=d(p,y.from);w&&g.push(w)}}),g}e.createTests=f})(Oy)),Oy}var Uk=AQ();const kQ="_removed_el5zk_1",PQ="_added_el5zk_6",FT={removed:kQ,added:PQ};function NQ(e){const{name:t,path:n,property:r,originalValue:o,revisedValue:s}=e,c=!!r?.type?.find(m=>m.code==="Attachment"),[d,f]=v.useState(c),p=()=>f(m=>!m);return a.jsx(a.Fragment,{children:c&&!d||!c?a.jsx(a.Fragment,{children:a.jsxs(ce.Tr,{children:[a.jsx(ce.Td,{children:t}),a.jsx(ce.Td,{className:FT.removed,children:o&&a.jsx(ro,{path:n,property:r,propertyType:o.type,value:o.value,ignoreMissingValues:!0})}),a.jsx(ce.Td,{className:FT.added,children:s&&a.jsx(ro,{path:n,property:r,propertyType:s.type,value:s.value,ignoreMissingValues:!0})})]})}):a.jsxs(ce.Tr,{children:[a.jsx(ce.Td,{children:t}),a.jsx(ce.Td,{colSpan:2,style:{textAlign:"right"},children:a.jsx(Ae,{onClick:p,variant:"light",children:"Expand"})})]})})}const OQ="_root_15xvr_1",MQ={root:OQ};function LQ(e){const t=Re(),{original:n,revised:r}=e,[o,s]=v.useState(!1);v.useEffect(()=>{t.requestSchema(e.original.resourceType).then(()=>s(!0)).catch(console.log)},[t,e.original.resourceType]);const c=v.useMemo(()=>{if(!o)return null;const d=[di(n)],f=[di(r)],p=[],m=IQ(Uk.createPatch(n,r));for(const g of m){const y=g.path,b=zQ(y),w=$Q(n.resourceType,b),j=g.op==="add"?void 0:fs(b,d),C=g.op==="remove"?void 0:fs(b,f);p.push({key:`op-${g.op}-${g.path}`,name:`${qn(g.op)} ${b}`,path:w?.path??n.resourceType+"."+b,property:w,originalValue:HT(w,j),revisedValue:HT(w,C)})}return p},[o,n,r]);return c?a.jsxs(ce,{className:MQ.root,children:[a.jsx(ce.Thead,{children:a.jsxs(ce.Tr,{children:[a.jsx(ce.Th,{}),a.jsx(ce.Th,{children:"Before"}),a.jsx(ce.Th,{children:"After"})]})}),a.jsx(ce.Tbody,{children:c.map(d=>{const{key:f,...p}=d;return a.jsx(NQ,{...p},f)})})]}):null}function IQ(e){const t=[];for(const n of e){const{op:r,path:o}=n;if(o.startsWith("/meta/author")||o.startsWith("/meta/compartment")||o.startsWith("/meta/lastUpdated")||o.startsWith("/meta/versionId"))continue;const s=e.filter(d=>d.op===r&&d.path===o).length,c={op:r,path:o};s>1&&(r==="add"||r==="remove")&&/\/[0-9-]+$/.test(o)&&(c.op="replace",c.path=o.replace(/\/[^/]+$/,"")),t.some(d=>d.op===c.op&&d.path===c.path)||t.push(c)}return t}function zQ(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 $Q(e,t){try{return Pm(e,{resourceType:"SearchParameter",base:[e],code:e+"."+t,expression:e+"."+t})?.elementDefinitions?.[0]}catch(n){console.warn("Failed to get element definition",{resourceType:e,fhirPath:t,err:n});return}}function HT(e,t){return t&&{type:Array.isArray(t)?t[0].type:t.type,value:UQ(t,!!e?.isArray)}}function UQ(e,t){const n=bU(e).flatMap(r=>r.value);return t?n:n[0]}function xS(e){const{profileUrl:t}=e,n=Re(),r=n.getAccessPolicy(),o=Kt(e.value),[s,c]=v.useState(!1);v.useEffect(()=>{if(o)if(t)n.requestProfileSchema(t,{expandProfile:!0}).then(()=>{tu(t)?c(!0):console.error(`Schema not found for ${t}`)}).catch(f=>{console.error("Error in requestProfileSchema",f)});else{const f=o.resourceType;n.requestSchema(f).then(()=>{c(!0)}).catch(console.error)}},[n,t,o]);const d=v.useMemo(()=>o&&NA(o,Zs.READ,r),[r,o]);return!s||!o?null:a.jsx(Cp,{path:o.resourceType,value:{type:o.resourceType,value:e.forceUseInput?e.value:o},profileUrl:t,ignoreMissingValues:e.ignoreMissingValues,accessPolicyResource:d})}const BQ="_item_5q6yx_1",VQ="_itemPadding_5q6yx_5",qT={item:BQ,itemPadding:VQ};function FQ(e){return a.jsx(ru,{children:e.children})}function hl(e){const{resource:t,profile:n,padding:r,popupMenuItems:o,...s}=e,c=n??t.meta?.author,d=e.dateTime??t.meta?.lastUpdated;return a.jsxs(Cl,{"data-testid":"timeline-item",fill:!0,...s,children:[a.jsxs(xe,{justify:"space-between",gap:8,mx:"xs",my:"sm",children:[a.jsx(Ss,{value:c,link:!0,size:"md"}),a.jsxs("div",{style:{flex:1},children:[a.jsx(Te,{size:"sm",children:a.jsx(Tl,{c:"dark",fw:500,value:c,link:!0})}),a.jsxs(Te,{size:"xs",children:[a.jsx(St,{c:"dimmed",to:e.resource,children:Sr(d)}),a.jsx(Te,{component:"span",c:"dimmed",mx:8,children:"·"}),a.jsx(St,{c:"dimmed",to:e.resource,children:e.resource.resourceType})]})]}),o&&a.jsxs(we,{position:"bottom-end",shadow:"md",width:200,children:[a.jsx(we.Target,{children:a.jsx(Rn,{color:"gray",variant:"subtle",radius:"xl","aria-label":`Actions for ${Ot(e.resource)}`,children:a.jsx(RH,{})})}),o]})]}),a.jsx(aS,{children:a.jsx("div",{className:$t(qT.item,{[qT.itemPadding]:r}),children:e.children})})]})}function Bk(e,t){e.sort((n,r)=>{const o=GT(n,t),s=GT(r,t);return o>s?1:o<s?-1:WT(n,t)-WT(r,t)})}function GT(e,t){if(!Vk(e,t)){const n=e.priority;if(typeof n=="string")return{stat:4,asap:3,urgent:2}[n]??0}return 0}function WT(e,t){if(!Vk(e,t)){if(e.resourceType==="Communication"&&e.sent)return new Date(e.sent).getTime();if((e.resourceType==="DiagnosticReport"||e.resourceType==="Media"||e.resourceType==="Observation")&&e.issued)return new Date(e.issued).getTime();if(e.resourceType==="DocumentReference"&&e.date)return new Date(e.date).getTime()}const n=e.meta?.lastUpdated;return n?new Date(n).getTime():0}function Vk(e,t){return!!t&&e.resourceType===t.resourceType&&e.id===t.id}const HQ="_pinnedComment_u08s5_1",qQ={pinnedComment:HQ};function Um(e){const t=Re(),n=t.getProfile(),r=v.useRef(null),o=Kt(e.value),[s,c]=v.useState(),[d,f]=v.useState([]),[p,m]=v.useState(10),g=e.loadTimelineResources,y=v.useRef(d);y.current=d;const b=v.useCallback(A=>{Bk(A,o),A.reverse(),f(A)},[o]),w=v.useCallback(A=>{const N=[];for(const U of A){if(U.status!=="fulfilled")continue;const B=U.value;if(B.type==="history"&&c(B),B.entry)for(const Q of B.entry)N.push(Q.resource)}b(N)},[b]),j=v.useCallback(A=>b([...y.current,A]),[b]),C=v.useCallback(()=>{let A,N;"resourceType"in e.value?(A=e.value.resourceType,N=e.value.id):[A,N]=e.value.reference?.split("/"),g(t,A,N).then(w).catch(console.error)},[t,e.value,g,w]);v.useEffect(()=>C(),[C]);function R(A){!o||!e.createCommunication||t.createResource(e.createCommunication(o,n,A)).then(N=>j(N)).catch(console.error)}function T(A){!o||!e.createMedia||t.createResource(e.createMedia(o,n,A)).then(N=>j(N)).then(()=>Ys({id:"upload-notification",color:"teal",title:"Upload complete",message:"",icon:a.jsx(zo,{size:16}),autoClose:2e3})).catch(N=>Ys({id:"upload-notification",color:"red",title:"Upload error",message:Ge(N),icon:a.jsx(TT,{size:16}),autoClose:2e3}))}function E(){ke({id:"upload-notification",loading:!0,title:"Initializing upload...",message:"Please wait...",autoClose:!1,withCloseButton:!1})}function _(A){Ys({id:"upload-notification",loading:!0,title:"Uploading...",message:JQ(A),autoClose:!1,withCloseButton:!1})}function k(A){Ys({id:"upload-notification",color:"red",title:"Upload error",message:Ge(A),icon:a.jsx(TT,{size:16}),autoClose:2e3})}if(!o)return a.jsx(dr,{style:{width:"100%",height:"100%"},children:a.jsx(Or,{})});const L=d.filter(A=>A).slice(0,p);return a.jsxs(FQ,{children:[e.createCommunication&&a.jsx(Cl,{children:a.jsx(mt,{testid:"timeline-form",onSubmit:A=>{R(A.text);const N=r.current;N&&(N.value="",N.focus())},children:a.jsxs(xe,{gap:"xs",wrap:"nowrap",style:{width:"100%"},children:[a.jsx(Ss,{value:n}),a.jsx(Fe,{name:"text",ref:r,placeholder:"Add comment",style:{width:"100%",maxWidth:300}}),a.jsx(Rn,{type:"submit",radius:"xl",color:"blue",variant:"filled",children:a.jsx(eq,{size:16})}),a.jsx(dS,{securityContext:Wt(o),onUpload:T,onUploadStart:E,onUploadProgress:_,onUploadError:k,children:A=>a.jsx(Rn,{...A,radius:"xl",color:"blue",variant:"filled",children:a.jsx(nS,{size:16})})})]})})}),L.map(A=>{const N=`${A.resourceType}/${A.id}/${A.meta?.versionId}`,U=e.getMenu?e.getMenu({primaryResource:o,currentResource:A,reloadTimeline:C}):void 0;if(A.resourceType===o.resourceType&&A.id===o.id)return a.jsx(GQ,{history:s,resource:A,popupMenuItems:U},N);switch(A.resourceType){case"AuditEvent":return a.jsx(KQ,{resource:A,popupMenuItems:U},N);case"Communication":return a.jsx(QQ,{resource:A,popupMenuItems:U},N);case"DiagnosticReport":return a.jsx(XQ,{resource:A,popupMenuItems:U},N);case"Media":return a.jsx(YQ,{resource:A,popupMenuItems:U},N);default:return a.jsx(hl,{resource:A,padding:!0,children:a.jsx(xS,{value:A,ignoreMissingValues:!0})},N)}}),p<d.length&&a.jsx(xe,{justify:"center",pb:"lg",children:a.jsx(Ae,{onClick:()=>m(p+10),children:"Show More"})})]})}function GQ(e){const{history:t,resource:n,...r}=e,o=WQ(t,n);return o?a.jsx(hl,{resource:n,padding:!0,...r,children:a.jsx(LQ,{original:o,revised:e.resource})}):a.jsxs(hl,{resource:n,padding:!0,...r,children:[a.jsx("h3",{children:"Created"}),a.jsx(xS,{value:n,ignoreMissingValues:!0,forceUseInput:!0})]})}function WQ(e,t){const n=e.entry??[],r=n.findIndex(o=>o.resource?.meta?.versionId===t.meta?.versionId);if(!(r>=n.length-1))return n[r+1].resource}function QQ(e){const n=!e.resource.priority||e.resource.priority==="routine"?void 0:qQ.pinnedComment;return a.jsx(hl,{resource:e.resource,profile:e.resource.sender,dateTime:e.resource.sent,padding:!0,className:n,popupMenuItems:e.popupMenuItems,children:a.jsx("p",{children:e.resource.payload?.[0]?.contentString})})}function YQ(e){const t=e.resource.content?.contentType,n=t&&!t.startsWith("image/")&&!t.startsWith("video/")&&t!=="application/pdf";return a.jsx(hl,{resource:e.resource,padding:!!n,popupMenuItems:e.popupMenuItems,children:a.jsx(ef,{value:e.resource.content})})}function KQ(e){return a.jsx(hl,{resource:e.resource,padding:!0,popupMenuItems:e.popupMenuItems,children:a.jsx(pi,{children:a.jsx("pre",{children:e.resource.outcomeDesc})})})}function XQ(e){return a.jsx(hl,{resource:e.resource,padding:!0,popupMenuItems:e.popupMenuItems,children:a.jsx(yS,{value:e.resource})})}function JQ(e){if(e.lengthComputable){const t=100*e.loaded/e.total;return`Uploaded: ${Ly(e.loaded)} / ${Ly(e.total)} ${t.toFixed(2)}%`}return`Uploaded: ${Ly(e.loaded)}`}function Ly(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 ZQ(e){const{resource:t,...n}=e;return a.jsx(Um,{value:t,loadTimelineResources:async(r,o,s)=>{const c=`${o}/${s}`;return Promise.allSettled([r.readHistory(o,s),r.search("Task",{_filter:`based-on eq ${c} or focus eq ${c} or subject eq ${c}`,_count:100})])},...n})}function eY(e){const{encounter:t,...n}=e;return a.jsx(Um,{value:t,loadTimelineResources:async(r,o,s)=>Promise.allSettled([r.readHistory("Encounter",s),r.search("Communication","encounter=Encounter/"+s),r.search("Media","encounter=Encounter/"+s)]),createCommunication:(r,o,s)=>({resourceType:"Communication",status:"completed",encounter:Wt(r),subject:r.subject,sender:Wt(o),sent:new Date().toISOString(),payload:[{contentString:s}]}),createMedia:(r,o,s)=>({resourceType:"Media",status:"completed",encounter:Wt(r),subject:r.subject,operator:Wt(o),issued:new Date().toISOString(),content:s}),...n})}function tY(e){let t;try{t=hB(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(ro,{value:t[0]||"",propertyType:e.propertyType})}function nY(e){return a.jsxs(Gn,{title:"Export",closeButtonProps:{"aria-label":"Close"},opened:e.visible,onClose:e.onCancel,children:[a.jsxs(de,{display:"flex",style:{justifyContent:"space-between"},children:[e.exportCsv&&a.jsx(QT,{text:"CSV",exportLogic:e.exportCsv,onCancel:e.onCancel}),e.exportTransactionBundle&&a.jsx(QT,{text:"Transaction Bundle",exportLogic:e.exportTransactionBundle,onCancel:e.onCancel})]}),a.jsx(Te,{style:{marginTop:"10px",marginLeft:"2px"},children:"Limited to 1000 records"})]})}function QT(e){return a.jsx(Ae,{onClick:()=>{e.exportLogic(),e.onCancel()},children:`Export as ${e.text}`})}const rY={string:[he.EQUALS,he.NOT,he.CONTAINS,he.EXACT],fulltext:[he.EQUALS,he.NOT,he.CONTAINS,he.EXACT],token:[he.EQUALS,he.NOT],reference:[he.EQUALS,he.NOT],numeric:[he.EQUALS,he.NOT_EQUALS,he.GREATER_THAN,he.LESS_THAN,he.GREATER_THAN_OR_EQUALS,he.LESS_THAN_OR_EQUALS],quantity:[he.EQUALS,he.NOT_EQUALS,he.GREATER_THAN,he.LESS_THAN,he.GREATER_THAN_OR_EQUALS,he.LESS_THAN_OR_EQUALS],date:[he.EQUALS,he.NOT_EQUALS,he.GREATER_THAN,he.LESS_THAN,he.GREATER_THAN_OR_EQUALS,he.LESS_THAN_OR_EQUALS,he.STARTS_AFTER,he.ENDS_BEFORE,he.APPROXIMATELY],datetime:[he.EQUALS,he.NOT_EQUALS,he.GREATER_THAN,he.LESS_THAN,he.GREATER_THAN_OR_EQUALS,he.LESS_THAN_OR_EQUALS,he.STARTS_AFTER,he.ENDS_BEFORE,he.APPROXIMATELY],uri:[he.EQUALS,he.NOT,he.ABOVE,he.BELOW]},iY={eq:"equals",ne:"not equals",gt:"greater than",lt:"less than",ge:"greater than or equals",le:"less than or equals",sa:"starts after",eb:"ends before",ap:"approximately",sw:"starts with",contains:"contains",exact:"exact",text:"text",not:"not",above:"above",below:"below",in:"in","not-in":"not in","of-type":"of type",missing:"missing",present:"present",identifier:"identifier",iterate:"iterate"};function bS(e,t){return{...e,filters:t,offset:0,name:void 0}}function Fk(e,t){return bS(e,(e.filters??[]).filter(n=>n.code!==t))}function Bm(e,t,n,r,o){const s=[];return e.filters&&s.push(...e.filters),s.push({code:t,operator:n,value:r??""}),bS(e,s)}function oY(e,t){if(!e.filters)return e;const n=[...e.filters];return n.splice(t,1),{...e,filters:n,name:void 0}}function aY(e,t){return SS(e,t,-1)}function sY(e,t){return SS(e,t,0)}function lY(e,t){return SS(e,t,1)}function SS(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),Vm(e,t,r,o)}function cY(e,t){const n=new Date,r=new Date(n.getTime()+1440*60*1e3);return Vm(e,t,n,r)}function uY(e,t){return wS(e,t,-1)}function dY(e,t){return wS(e,t,0)}function fY(e,t){return wS(e,t,1)}function wS(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),Vm(e,t,r,o)}function hY(e,t){const n=new Date;return n.setMonth(0),n.setDate(1),n.setHours(0,0,0,0),Vm(e,t,n,new Date)}function Vm(e,t,n,r){return e=Fk(e,t),e=YT(e,t,he.GREATER_THAN_OR_EQUALS,n),e=YT(e,t,he.LESS_THAN_OR_EQUALS,r),e}function YT(e,t,n,r){return Bm(e,t,n,r.toISOString())}function KT(e,t,n=!0){return Bm(e,t,he.MISSING,n.toString())}function pY(e,t){return e.offset===t?e:{...e,offset:t,name:void 0}}function mY(e,t){const n=e.count??_m,r=(t-1)*n;return pY(e,r)}function gY(e,t,n){return t===vY(e)&&n!==void 0&&n===yY(e)?e:{...e,sortRules:[{code:t,descending:!!n}],name:void 0}}function vY(e){const t=e.sortRules;if(!t||t.length===0)return;const n=t[0].code;return n.startsWith("-")?n.substr(1):n}function yY(e){const t=e.sortRules;return!t||t.length===0?!1:!!t[0].descending}function xY(e){return rY[e.type]}function Hk(e){return iY[e]??""}function pl(e){let t=e;return t.includes(".")&&(t=t.split(".").pop()),t==="versionId"?"Version ID":(t=t.replace("[x]",""),t=t.replaceAll(/([A-Z])/g," $1"),t=t.replaceAll(/[-_]/g," "),t=t.replaceAll(/\s+/g," "),t=t.trim(),t.toLowerCase()==="id"?"ID":t.split(/\s/).map(qn).join(" "))}function bY(e,t){const n=t.name;return n==="id"?a.jsx(St,{to:`/${e.resourceType}/${e.id}`,children:e.id}):n==="meta.versionId"?e.meta?.versionId:n==="_lastUpdated"?Sr(e.meta?.lastUpdated):`${e.resourceType}.${t.name}`===t.elementDefinition?.path?SY(e,t.elementDefinition):t.searchParams?.length===1&&t.name===t.searchParams[0].code?wY(e,t.searchParams[0]):null}function SY(e,t){const n=t.path?.split(".")?.pop()?.replaceAll("[x]","")??"",[r,o]=Im({type:e.resourceType,value:e},n);return r?a.jsx(ro,{path:t.path,property:t,propertyType:o,value:r,maxWidth:200,ignoreMissingValues:!0,link:!1}):null}function wY(e,t){const n=fs(t.expression,[{type:e.resourceType,value:e}]);return!n||n.length===0?null:a.jsx(a.Fragment,{children:n.map((r,o)=>a.jsx(ro,{propertyType:r.type,value:r.value,maxWidth:200,ignoreMissingValues:!0,link:!1},`${o}-${n.length}`))})}function jY(e){const t=v.useRef(!1),[n,r]=v.useState({search:JSON.parse(no(e.search))}),[o,s]=v.useState(!1);v.useEffect(()=>{r({search:e.search})},[e.search]);const c=v.useMemo(()=>{if(!e.visible)return[];const f=e.search.resourceType,p=oA(f),m=U0(f);return $c(CY(p,m)).map(g=>({value:g,label:pl(g)}))},[e.visible,e.search.resourceType]);function d(f){r({search:{...n.search,fields:f}})}return a.jsx(Gn,{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(Ue,{children:[a.jsx(pm,{style:{width:550},placeholder:"Select fields to display",data:c,value:n.search.fields??[],onChange:d,onDropdownOpen:()=>s(!0),onDropdownClose:()=>s(!1),maxDropdownHeight:"250px",clearButtonProps:{"aria-label":"Clear selection"},clearable:!0,searchable:!0}),a.jsx(xe,{justify:"flex-end",children:a.jsx(Ae,{onClick:()=>e.onOk(n.search),children:"OK"})})]})})}function CY(e,t){const n=[],r=new Set,o=new Set;for(const s of Object.keys(e.elements))n.push(s),r.add(s.toLowerCase()),o.add(pl(s));if(t)for(const s of Object.keys(t)){const c=pl(s);!r.has(s)&&!o.has(c)&&(n.push(s),r.add(s),o.add(c))}return n}function qk(e){const t=Pm(e.resourceType,e.searchParam),n=e.name??"filter-value";switch(t.type){case yr.REFERENCE:return a.jsx(cs,{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 yr.BOOLEAN:return a.jsx(Ln,{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 yr.DATE:return a.jsx(Fe,{type:"date",name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.value)});case yr.DATETIME:return a.jsx(Eo,{name:n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:e.onChange});case yr.NUMBER:return a.jsx(Fe,{type:"number",name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.value)});case yr.QUANTITY:return a.jsx(fl,{name:n,path:"",defaultValue:EY(e.defaultValue),autoFocus:e.autoFocus,onChange:r=>{r?e.onChange(`${r.value}`):e.onChange("")}});default:return a.jsx(Fe,{name:n,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:r=>e.onChange(r.currentTarget.value),placeholder:"Search value"})}}function EY(e){if(e){const[t,n,r]=e.split("|");if(t)return{value:Number.parseFloat(t),system:n,unit:r}}}function TY(e){const[t,n]=v.useState(fi(e.search)),r=v.useRef(t);r.current=t,v.useEffect(()=>{n(fi(e.search))},[e.search]);function o(f){n(Bm(r.current,f.code,f.operator,f.value))}const s=e.search.resourceType,c=U0(s)??{},d=t.filters||[];return a.jsx(Gn,{title:"Filters",closeButtonProps:{"aria-label":"Close"},size:900,opened:e.visible,onClose:e.onCancel,children:a.jsxs(mt,{onSubmit:()=>e.onOk(r.current),children:[a.jsxs("div",{children:[a.jsxs("table",{children:[a.jsxs("colgroup",{children:[a.jsx("col",{style:{width:200}}),a.jsx("col",{style:{width:200}}),a.jsx("col",{style:{width:380}}),a.jsx("col",{style:{width:40}})]}),a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Field"}),a.jsx("th",{children:"Operation"}),a.jsx("th",{children:"Value"}),a.jsx("th",{})]})}),a.jsx("tbody",{children:d.map((f,p)=>a.jsx(RY,{id:`filter-${p}-row`,resourceType:s,searchParams:c,value:f,onChange:m=>{const g=[...d];g[p]=m,n(bS(r.current,g))},onDelete:()=>n(oY(r.current,p))},`filter-${p}-row`))})]}),a.jsx(mS,{propertyDisplayName:"Filter",onClick:()=>o({})})]}),a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(wr,{children:"OK"})})]})})}function RY(e){const t=e.value,n=v.useRef(t);n.current=t;function r(f){n.current.code=f,n.current.operator=he.EQUALS,n.current.value="",e.onChange(n.current)}function o(f){n.current.operator=f,n.current.value="",e.onChange(n.current)}function s(f){n.current.value=f,e.onChange(n.current)}const c=e.searchParams[t.code],d=c&&xY(c);return a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(un,{"data-testid":`${e.id}-filter-field`,defaultValue:e.value.code,onChange:f=>r(f.currentTarget.value),data:["",...Object.keys(e.searchParams).map(f=>({value:f,label:pl(f)}))]})}),a.jsx("td",{children:d&&a.jsx(un,{"data-testid":`${e.id}-filter-operation`,defaultValue:t.operator,onChange:f=>o(f.currentTarget.value),data:["",...d.map(f=>({value:f,label:Hk(f)}))]},`${e.id}-filter-value-${e.value.code}`)}),a.jsx("td",{children:c&&t.operator&&a.jsx(qk,{name:`${e.id}-filter-value`,resourceType:e.resourceType,searchParam:c,defaultValue:t.value,onChange:s},`${e.id}-filter-value-${e.value.code}-${e.value.operator}`)}),a.jsx("td",{children:e.onDelete&&a.jsx(Rn,{variant:"outline",color:"red",radius:"xl","aria-label":"Delete filter",onClick:e.onDelete,children:a.jsx(dl,{style:{width:"70%",height:"70%"},stroke:1.5})})})]})}function _Y(e){const[t,n]=v.useState(e.defaultValue??"");if(!e.searchParam||!e.filter)return null;function r(){e.onOk({...e.filter,value:t})}return a.jsx(Gn,{title:e.title,size:"xl",opened:e.visible,onClose:e.onCancel,children:a.jsx(mt,{onSubmit:r,children:a.jsxs(br,{children:[a.jsx(br.Col,{span:10,children:a.jsx(qk,{resourceType:e.resourceType,searchParam:e.searchParam,defaultValue:t,autoFocus:!0,onChange:n})}),a.jsx(br.Col,{span:2,children:a.jsx(Ae,{onClick:r,fullWidth:!0,children:"OK"})})]})})})}function DY(e){const{resourceType:t,filter:n}=e,r=Do.types[t].searchParams?.[n.code];if(r){if(r.type==="reference"&&(n.operator===he.EQUALS||n.operator===he.NOT_EQUALS))return a.jsx(Tl,{value:{reference:n.value}});const o=Pm(t,r);if(n.code==="_lastUpdated"||o.type===yr.DATETIME)return a.jsx(a.Fragment,{children:Sr(n.value)})}return a.jsx(a.Fragment,{children:n.value})}function AY(e){if(!e.searchParams)return null;function t(s,c){o(gY(e.search,s.code,c))}function n(s){o(Fk(e.search,s.code))}function r(s,c){e.onPrompt(s,{code:s.code,operator:c,value:""})}function o(s){e.onChange(s)}return e.searchParams.length===1?a.jsx(kY,{search:e.search,searchParam:e.searchParams[0],onSort:t,onPrompt:r,onChange:o,onClear:n}):a.jsx(we.Dropdown,{children:e.searchParams.map(s=>a.jsx(we.Item,{children:pl(s.code)},s.code))})}function kY(e){switch(e.searchParam.type){case"date":return a.jsx(PY,{...e});case"number":case"quantity":return a.jsx(NY,{...e});case"reference":return a.jsx(OY,{...e});case"string":return a.jsx(MY,{...e});case"token":case"uri":return a.jsx(LY,{...e});default:return a.jsxs(a.Fragment,{children:["Unknown search param type: ",e.searchParam.type]})}}function PY(e){const{searchParam:t}=e,n=t.code;return a.jsxs(we.Dropdown,{children:[a.jsx(we.Item,{leftSection:a.jsx(iS,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Oldest to Newest"}),a.jsx(we.Item,{leftSection:a.jsx(oS,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Newest to Oldest"}),a.jsx(we.Divider,{}),a.jsx(we.Item,{leftSection:a.jsx(Jd,{size:14}),onClick:()=>e.onPrompt(t,he.EQUALS),children:"Equals..."}),a.jsx(we.Item,{leftSection:a.jsx(Xd,{size:14}),onClick:()=>e.onPrompt(t,he.NOT_EQUALS),children:"Does not equal..."}),a.jsx(we.Divider,{}),a.jsx(we.Item,{leftSection:a.jsx(ak,{size:14}),onClick:()=>e.onPrompt(t,he.ENDS_BEFORE),children:"Before..."}),a.jsx(we.Item,{leftSection:a.jsx(ok,{size:14}),onClick:()=>e.onPrompt(t,he.STARTS_AFTER),children:"After..."}),a.jsx(we.Item,{leftSection:a.jsx(JF,{size:14}),onClick:()=>e.onPrompt(t,he.EQUALS),children:"Between..."}),a.jsx(we.Divider,{}),a.jsx(we.Item,{leftSection:a.jsx(es,{size:14}),onClick:()=>e.onChange(lY(e.search,n)),children:"Tomorrow"}),a.jsx(we.Item,{leftSection:a.jsx(es,{size:14}),onClick:()=>e.onChange(sY(e.search,n)),children:"Today"}),a.jsx(we.Item,{leftSection:a.jsx(es,{size:14}),onClick:()=>e.onChange(aY(e.search,n)),children:"Yesterday"}),a.jsx(we.Item,{leftSection:a.jsx(es,{size:14}),onClick:()=>e.onChange(cY(e.search,n)),children:"Next 24 Hours"}),a.jsx(we.Divider,{}),a.jsx(we.Item,{leftSection:a.jsx(es,{size:14}),onClick:()=>e.onChange(fY(e.search,n)),children:"Next Month"}),a.jsx(we.Item,{leftSection:a.jsx(es,{size:14}),onClick:()=>e.onChange(dY(e.search,n)),children:"This Month"}),a.jsx(we.Item,{leftSection:a.jsx(es,{size:14}),onClick:()=>e.onChange(uY(e.search,n)),children:"Last Month"}),a.jsx(we.Divider,{}),a.jsx(we.Item,{leftSection:a.jsx(es,{size:14}),onClick:()=>e.onChange(hY(e.search,n)),children:"Year to date"}),a.jsx(rf,{...e})]})}function NY(e){const{searchParam:t}=e;return a.jsxs(we.Dropdown,{children:[a.jsx(we.Item,{leftSection:a.jsx(iS,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort Smallest to Largest"}),a.jsx(we.Item,{leftSection:a.jsx(oS,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Largest to Smallest"}),a.jsx(we.Divider,{}),a.jsx(we.Item,{leftSection:a.jsx(Jd,{size:14}),onClick:()=>e.onPrompt(t,he.EQUALS),children:"Equals..."}),a.jsx(we.Item,{leftSection:a.jsx(Xd,{size:14}),onClick:()=>e.onPrompt(t,he.NOT_EQUALS),children:"Does not equal..."}),a.jsx(we.Divider,{}),a.jsx(we.Item,{leftSection:a.jsx(ok,{size:14}),onClick:()=>e.onPrompt(t,he.GREATER_THAN),children:"Greater than..."}),a.jsx(we.Item,{leftSection:a.jsx(_x,{size:14}),onClick:()=>e.onPrompt(t,he.GREATER_THAN_OR_EQUALS),children:"Greater than or equal to..."}),a.jsx(we.Item,{leftSection:a.jsx(ak,{size:14}),onClick:()=>e.onPrompt(t,he.LESS_THAN),children:"Less than..."}),a.jsx(we.Item,{leftSection:a.jsx(_x,{size:14}),onClick:()=>e.onPrompt(t,he.LESS_THAN_OR_EQUALS),children:"Less than or equal to..."}),a.jsx(rf,{...e})]})}function OY(e){const{searchParam:t}=e;return a.jsxs(we.Dropdown,{children:[a.jsx(we.Item,{leftSection:a.jsx(Jd,{size:14}),onClick:()=>e.onPrompt(t,he.EQUALS),children:"Equals..."}),a.jsx(we.Item,{leftSection:a.jsx(Xd,{size:14}),onClick:()=>e.onPrompt(t,he.NOT),children:"Does not equal..."}),a.jsx(rf,{...e})]})}function MY(e){const{searchParam:t}=e;return a.jsxs(we.Dropdown,{children:[a.jsx(we.Item,{leftSection:a.jsx(iS,{size:14}),onClick:()=>e.onSort(t,!1),children:"Sort A to Z"}),a.jsx(we.Item,{leftSection:a.jsx(oS,{size:14}),onClick:()=>e.onSort(t,!0),children:"Sort Z to A"}),a.jsx(we.Divider,{}),a.jsx(we.Item,{leftSection:a.jsx(Jd,{size:14}),onClick:()=>e.onPrompt(t,he.EQUALS),children:"Equals..."}),a.jsx(we.Item,{leftSection:a.jsx(Xd,{size:14}),onClick:()=>e.onPrompt(t,he.NOT),children:"Does not equal..."}),a.jsx(we.Divider,{}),a.jsx(we.Item,{leftSection:a.jsx(iH,{size:14}),onClick:()=>e.onPrompt(t,he.CONTAINS),children:"Contains..."}),a.jsx(we.Item,{leftSection:a.jsx(nH,{size:14}),onClick:()=>e.onPrompt(t,he.EQUALS),children:"Does not contain..."}),a.jsx(rf,{...e})]})}function LY(e){const{searchParam:t}=e;return a.jsxs(we.Dropdown,{children:[a.jsx(we.Item,{leftSection:a.jsx(Jd,{size:14}),onClick:()=>e.onPrompt(t,he.EQUALS),children:"Equals..."}),a.jsx(we.Item,{leftSection:a.jsx(Xd,{size:14}),onClick:()=>e.onPrompt(t,he.NOT),children:"Does not equal..."}),a.jsx(rf,{...e})]})}function rf(e){const{searchParam:t}=e,n=t.code;return a.jsxs(a.Fragment,{children:[a.jsx(we.Divider,{}),a.jsx(we.Item,{leftSection:a.jsx(QF,{size:14}),onClick:()=>e.onChange(KT(e.search,n)),children:"Missing"}),a.jsx(we.Item,{leftSection:a.jsx(GF,{size:14}),onClick:()=>e.onChange(KT(e.search,n,!1)),children:"Not missing"}),a.jsx(we.Divider,{}),a.jsx(we.Item,{leftSection:a.jsx(dl,{size:14}),onClick:()=>e.onClear(t),children:"Clear filters"})]})}function Gk(e){switch(e){case"next":return{"aria-label":"Next page"};case"previous":return{"aria-label":"Previous page"};case"first":return{"aria-label":"First page"};case"last":return{"aria-label":"Last page"};default:return{}}}const IY="_root_vlout_1",zY="_table_vlout_8",$Y="_tr_vlout_12",UY="_control_vlout_22",BY="_icon_vlout_31",Zu={root:IY,table:zY,tr:$Y,control:UY,icon:BY};function VY(e){const t=e.resourceType,n=[];for(const r of e.fields||["id","_lastUpdated"])n.push(FY(t,r));return n}function FY(e,t){if(t==="_lastUpdated")return{name:"_lastUpdated",searchParams:[{resourceType:"SearchParameter",base:["Resource"],code:"_lastUpdated",name:"_lastUpdated",type:"date",expression:"Resource.meta.lastUpdated"}]};if(t==="meta.versionId")return{name:"meta.versionId",searchParams:[{resourceType:"SearchParameter",base:["Resource"],code:"_versionId",name:"_versionId",type:"token",expression:"Resource.meta.versionId"}]};const n=xs(e,t),r=IU(e,t.toLowerCase());if(n&&r)return{name:t,elementDefinition:n,searchParams:[r]};if(n){const o=U0(e);let s;if(o){const c=new RegExp(`${e}\\.${t.replaceAll("[x]","")}([^\\w-]|$)`);s=Object.values(o).filter(d=>!!d.expression&&c.test(d?.expression)),s.length===0&&(s=void 0)}return{name:t,elementDefinition:n,searchParams:s}}if(r){const o=Pm(e,r);return{name:t,elementDefinition:o.elementDefinitions?.[0],searchParams:[r]}}return{name:t}}class HY extends Event{definition;constructor(t){super("change"),this.definition=t}}class qY extends Event{response;constructor(t){super("load"),this.response=t}}class Ep extends Event{resource;browserEvent;constructor(t,n){super("click"),this.resource=t,this.browserEvent=n}}function ou(e){const t=Re(),[n,r]=v.useState(),{search:o,onLoad:s}=e,[c,d]=v.useState(o);_o(o,c)||d(o);const[f,p]=v.useState({selected:{},fieldEditorVisible:!1,filterEditorVisible:!1,exportDialogVisible:!1,filterDialogVisible:!1}),m=v.useRef(f);m.current=f;const g=c.total??"accurate",y=v.useCallback($=>{r(void 0),t.requestSchema(c.resourceType).then(()=>t.search(c.resourceType,ss({...c,total:g,fields:void 0}),$)).then(W=>{p({...m.current,searchResponse:W}),s&&s(new qY(W))}).catch(W=>{p({...m.current,searchResponse:void 0}),r(Yt(W))})},[t,c,g,s]),b=v.useCallback(()=>{p({...m.current,searchResponse:void 0}),y({cache:"reload"})},[y]);v.useEffect(()=>{y()},[y]);function w($,W){$.stopPropagation();const I=$.target.checked,z={...m.current.selected};I?z[W]=!0:delete z[W],p({...m.current,selected:z})}function j($){$.stopPropagation();const M=$.target.checked,I={},z=m.current.searchResponse;M&&z?.entry&&z.entry.forEach(F=>{F.resource?.id&&(I[F.resource.id]=!0)}),p({...m.current,selected:I})}function C(){const $=m.current;if(!$.searchResponse?.entry||$.searchResponse.entry.length===0)return!1;for(const W of $.searchResponse.entry)if(W.resource?.id&&!$.selected[W.resource.id])return!1;return!0}function R($){e.onChange&&e.onChange(new HY($))}function T($,W){if(uk($.target)||$.button===2)return;pn($);const M=ck($);!M&&e.onClick&&e.onClick(new Ep(W,$)),M&&e.onAuxClick&&e.onAuxClick(new Ep(W,$))}function E(){return!!(e.onExport??e.onExportCsv??e.onExportTransactionBundle)}if(n)return a.jsx(jr,{outcome:n});if(!iA(c.resourceType))return a.jsx(dr,{style:{width:"100%",height:"100%"},children:a.jsx(Or,{})});const _=e.checkboxesEnabled,k=VY(c),L=c.resourceType,A=f.searchResponse,U=A?.entry?.map($=>$.resource),B="subtle",Q="gray",J=16,Z=window.innerWidth<768;return a.jsxs("div",{className:Zu.root,"data-testid":"search-control",children:[!e.hideToolbar&&a.jsxs(xe,{justify:"space-between",mb:"xl",children:[a.jsxs(xe,{gap:2,children:[a.jsx(Ae,{size:"compact-md",variant:B,color:Q,leftSection:a.jsx(yH,{size:J}),onClick:()=>p({...m.current,fieldEditorVisible:!0,dialogOpenTime:Date.now()}),children:"Fields"}),a.jsx(Ae,{size:"compact-md",variant:B,color:Q,leftSection:a.jsx($H,{size:J}),onClick:()=>p({...m.current,filterEditorVisible:!0,dialogOpenTime:Date.now()}),children:"Filters"}),e.onNew&&a.jsx(Ae,{size:"compact-md",variant:B,color:Q,leftSection:a.jsx(IH,{size:J}),onClick:e.onNew,children:"New..."}),!Z&&E()&&a.jsx(Ae,{size:"compact-md",variant:B,color:Q,leftSection:a.jsx(Mq,{size:J}),onClick:e.onExport?e.onExport:()=>p({...m.current,exportDialogVisible:!0,dialogOpenTime:Date.now()}),children:"Export..."}),!Z&&e.onDelete&&a.jsx(Ae,{size:"compact-md",variant:B,color:Q,leftSection:a.jsx(Lm,{size:J}),onClick:()=>e.onDelete(Object.keys(f.selected)),children:"Delete..."}),!Z&&e.onBulk&&a.jsx(Ae,{size:"compact-md",variant:B,color:Q,leftSection:a.jsx(KF,{size:J}),onClick:()=>e.onBulk(Object.keys(f.selected)),children:"Bulk..."})]}),a.jsxs(xe,{gap:2,children:[A&&a.jsxs(Te,{size:"xs",c:"dimmed","data-testid":"count-display",children:[Wk(c,A).toLocaleString(),"-",YY(c,A).toLocaleString(),A.total!==void 0&&` of ${c.total==="estimate"?"~":""}${A.total?.toLocaleString()}`]}),a.jsx(Rn,{variant:B,color:Q,title:"Refresh",onClick:b,children:a.jsx(lk,{size:J})})]})]}),a.jsxs(ce,{className:Zu.table,children:[a.jsxs(ce.Thead,{children:[a.jsxs(ce.Tr,{children:[_&&a.jsx(ce.Th,{children:a.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:C(),onChange:$=>j($)})}),k.map($=>a.jsx(ce.Th,{children:a.jsxs(we,{shadow:"md",width:240,position:"bottom-end",children:[a.jsx(we.Target,{children:a.jsx(ar,{className:Zu.control,p:2,children:a.jsxs(xe,{justify:"space-between",wrap:"nowrap",children:[a.jsx(Te,{fw:500,children:pl($.name)}),a.jsx(dr,{className:Zu.icon,children:a.jsx($F,{size:14,stroke:1.5})})]})})}),a.jsx(AY,{search:c,searchParams:$.searchParams,onPrompt:(W,M)=>{p({...m.current,filterDialogVisible:!0,filterDialogSearchParam:W,filterDialogFilter:M,dialogOpenTime:Date.now()})},onChange:W=>{R(W)}})]})},$.name))]}),!e.hideFilters&&a.jsxs(ce.Tr,{children:[_&&a.jsx(ce.Th,{}),k.map($=>a.jsx(ce.Th,{children:$.searchParams&&a.jsx(GY,{resourceType:L,searchParams:$.searchParams,filters:c.filters})},$.name))]})]}),a.jsx(ce.Tbody,{children:U?.map($=>$&&a.jsxs(ce.Tr,{className:Zu.tr,"data-testid":"search-control-row",onClick:W=>T(W,$),onAuxClick:W=>T(W,$),children:[_&&a.jsx(ce.Td,{children:a.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${$.id}`,checked:!!f.selected[$.id],onChange:W=>w(W,$.id)})}),k.map(W=>a.jsx(ce.Td,{children:bY($,W)},W.name))]},$.id))})]}),!U?.length&&a.jsx(ru,{children:a.jsx(dr,{style:{height:150},children:a.jsx(Te,{size:"xl",c:"dimmed",children:"No results"})})}),A&&a.jsx(dr,{m:"md",p:"md",children:a.jsx(Ii,{value:WY(c),total:QY(c,A),onChange:$=>R(mY(c,$)),getControlProps:Gk})}),a.jsx(jY,{search:c,visible:m.current.fieldEditorVisible,onOk:$=>{R($),p({...m.current,fieldEditorVisible:!1})},onCancel:()=>{p({...m.current,fieldEditorVisible:!1})}},`search-field-editor-${f.dialogOpenTime}`),a.jsx(TY,{search:c,visible:m.current.filterEditorVisible,onOk:$=>{R($),p({...m.current,filterEditorVisible:!1})},onCancel:()=>{p({...m.current,filterEditorVisible:!1})}},`search-filter-editor-${f.dialogOpenTime}`),a.jsx(nY,{visible:m.current.exportDialogVisible,exportCsv:e.onExportCsv,exportTransactionBundle:e.onExportTransactionBundle,onCancel:()=>{p({...m.current,exportDialogVisible:!1})}},`search-export-dialog-${f.dialogOpenTime}`),a.jsx(_Y,{visible:m.current.filterDialogVisible,title:f.filterDialogSearchParam?.code?pl(f.filterDialogSearchParam.code):"",resourceType:L,searchParam:f.filterDialogSearchParam,filter:f.filterDialogFilter,defaultValue:"",onOk:$=>{R(Bm(c,$.code,$.operator,$.value)),p({...m.current,filterDialogVisible:!1})},onCancel:()=>{p({...m.current,filterDialogVisible:!1})}},`search-filter-dialog-${f.dialogOpenTime}`)]})}function GY(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:[Hk(n.operator)," ",a.jsx(DY,{resourceType:e.resourceType,filter:n})]},`filter-${n.code}-${n.operator}-${n.value}`))})}function WY(e){return Math.floor((e.offset??0)/(e.count??_m))+1}function QY(e,t){const n=e.count??_m,r=Qk(e,t);return Math.ceil(r/n)}function Wk(e,t){return Math.min(Qk(e,t),(e.offset??0)+1)}function YY(e,t){return Math.max(Wk(e,t)+(t.entry?.length??0)-1,0)}function Qk(e,t){let n=t.total;return n===void 0&&(n=(e.offset??0)+(t.entry?.length??0)+(t.link?.some(r=>r.relation==="next")?1:0)),n}function KY(e){const t=Re(),[n,r]=v.useState(!1),[o,s]=v.useState(),{query:c,fields:d}=e,[f,p]=v.useState(),[m,g]=v.useState({}),y=v.useRef(f);y.current=f;const b=v.useRef({});b.current=m,v.useEffect(()=>{s(void 0),t.graphql(c).then(p).catch(E=>s(Yt(E)))},[t,c]);function w(E,_){E.stopPropagation();const L=E.target.checked,A={...b.current};L?A[_]=!0:delete A[_],g(A)}function j(E){E.stopPropagation();const k=E.target.checked,L={},A=y.current?.data.ResourceList;k&&A&&A.forEach(N=>{N.id&&(L[N.id]=!0)}),g(L)}function C(){const E=y.current?.data.ResourceList;if(!E||E.length===0)return!1;for(const _ of E)if(_.id&&!b.current[_.id])return!1;return!0}function R(E,_){uk(E.target)||(pn(E),E.button!==1&&e.onClick&&e.onClick(new Ep(_,E)),E.button===1&&e.onAuxClick&&e.onAuxClick(new Ep(_,E)))}if(v.useEffect(()=>{t.requestSchema(e.resourceType).then(()=>r(!0)).catch(console.log)},[t,e.resourceType]),!n)return a.jsx(Or,{});const T=e.checkboxesEnabled;return a.jsxs("div",{onContextMenu:E=>pn(E),"data-testid":"search-control",children:[a.jsxs(ce,{children:[a.jsx(ce.Thead,{children:a.jsxs(ce.Tr,{children:[T&&a.jsx(ce.Th,{children:a.jsx("input",{type:"checkbox",value:"checked","aria-label":"all-checkbox","data-testid":"all-checkbox",checked:C(),onChange:E=>j(E)})}),d.map(E=>a.jsx(ce.Th,{children:E.name},E.name))]})}),a.jsx(ce.Tbody,{children:f?.data.ResourceList.map(E=>E&&a.jsxs(ce.Tr,{"data-testid":"search-control-row",onClick:_=>R(_,E),onAuxClick:_=>R(_,E),children:[T&&a.jsx(ce.Td,{children:a.jsx("input",{type:"checkbox",value:"checked","data-testid":"row-checkbox","aria-label":`Checkbox for ${E.id}`,checked:!!m[E.id],onChange:_=>w(_,E.id)})}),d.map(_=>a.jsx(ce.Td,{children:a.jsx(tY,{propertyType:_.propertyType,path:_.fhirPath,resource:E})},_.name))]},E.id))})]}),f?.data.ResourceList.length===0&&a.jsx("div",{"data-testid":"empty-search",children:"No results"}),o&&a.jsx("div",{"data-testid":"search-error",children:a.jsx("pre",{style:{textAlign:"left"},children:JSON.stringify(o,void 0,2)})}),e.onBulk&&a.jsx(Ae,{onClick:()=>e.onBulk(Object.keys(b.current)),children:"Bulk..."})]})}const XY=v.memo(KY),JY="_root_1fbwr_1",ZY="_entry_1fbwr_8",eK="_key_1fbwr_13",tK="_value_1fbwr_20",Fm={root:JY,entry:ZY,key:eK,value:tK};function yt(e){return a.jsx(pi,{children:a.jsx("div",{className:Fm.root,children:e.children})})}yt.Entry=function(t){return a.jsx("div",{className:Fm.entry,children:t.children})};yt.Key=function(t){return a.jsx("div",{className:Fm.key,children:t.children})};yt.Value=function(t){return a.jsx("div",{className:Fm.value,children:t.children})};function nK(e){const{group:t}=e;return a.jsx(Pr,{withBorder:!0,radius:"md",p:"xs",display:"flex",style:{alignItems:"center",justifyContent:"center"},children:a.jsxs(xe,{children:[t.measureScore&&a.jsx(oK,{group:t}),!t.measureScore&&a.jsx(iK,{group:t})]})})}function rK(e){const{measure:t}=e;return a.jsxs(a.Fragment,{children:[a.jsx(Te,{fz:"md",fw:500,mb:8,children:t.title}),a.jsx(Te,{fz:"xs",c:"dimmed",mb:8,children:t.subtitle})]})}function iK(e){const{group:t}=e,n=t.population,r=n?.find(f=>ds(f.code)==="numerator"),o=n?.find(f=>ds(f.code)==="denominator"),s=r?.count,c=o?.count;if(c===0)return a.jsxs(de,{children:[a.jsx(Ie,{order:3,children:"Not Applicable"}),a.jsx(Te,{children:`Denominator: ${c}`})]});if(s===void 0||c===void 0)return a.jsxs(de,{children:[a.jsx(Ie,{order:3,children:"Insufficient Data"}),a.jsx(Te,{children:`Numerator: ${s}`}),a.jsx(Te,{children:`Denominator: ${c}`})]});const d=s/c*100;return a.jsx(Sm,{size:120,thickness:12,roundCaps:!0,sections:[{value:d,color:Yk(d)}],label:a.jsx(to,{justify:"center",children:a.jsxs(Te,{fw:700,fz:18,children:[s," / ",c]})})})}function oK(e){const{group:t}=e,n=t.measureScore?.unit??t.measureScore?.code;return a.jsx(a.Fragment,{children:n==="%"?a.jsx(Sm,{size:120,thickness:12,roundCaps:!0,sections:[{value:aK(t),color:Yk(t?.measureScore?.value??0)}],label:a.jsx(to,{justify:"center",children:a.jsx(Te,{fw:700,fz:18,children:a.jsx(Cd,{value:t.measureScore})})})}):a.jsx(to,{h:120,align:"center",children:a.jsx(Ie,{order:3,children:a.jsx(Cd,{value:t.measureScore})})})})}function aK(e){const t=e.measureScore?.value,n=e.measureScore?.unit;return t?t<=1&&n==="%"?t*100:t:0}function Yk(e){return e<=33?"red":e<=67?"yellow":"green"}function sK(e){const t=Kt(e.measureReport),[n]=kF("Measure",{url:t?.measure});return t?a.jsxs(de,{children:[n&&a.jsx(rK,{measure:n}),a.jsx(wm,{cols:{base:3,sm:1},spacing:{base:"md",sm:"sm"},children:t.group?.map((r,o)=>a.jsx(nK,{group:r},r.id??o))})]}):null}const Iy="patient-export",zy="Patient Export",lK={everything:{operation:"$everything",extension:"json",contentType:on.FHIR_JSON},summary:{operation:"$summary",extension:"json",contentType:on.FHIR_JSON},ccda:{operation:"$ccda-export",extension:"xml",contentType:on.CDA_XML},ccdaReferral:{operation:"$ccda-export",type:"referral",extension:"xml",contentType:on.CDA_XML}};function cK(e){const t=Re(),{patient:n}=e,r=v.useCallback(async o=>{const s=sl(n),c=o.format,{operation:d,type:f,contentType:p,extension:m}=lK[c],g=t.fhirUrl("Patient",s,d),y={};f&&(y.type=f),o.author&&(y.author={reference:o.author}),o.authoredOn&&(y.authoredOn=hS(o.authoredOn)),o.startDate&&(y.start=o.startDate),o.endDate&&(y.end=o.endDate),Di.show({id:Iy,title:zy,loading:!0,message:"Exporting...",autoClose:!1,withCloseButton:!1});try{const b=await t.post(g,y,void 0,{cache:"no-cache",headers:{Accept:p}}),w=`Patient-export-${s}-${new Date().toISOString().replaceAll(":","-")}.${m}`;uK(b,w,p),Di.update({id:Iy,title:zy,color:"green",message:"Done",icon:a.jsx(zo,{size:"1rem"}),loading:!1,autoClose:!0,withCloseButton:!0})}catch(b){Di.update({id:Iy,title:zy,color:"red",message:Ge(b),icon:a.jsx(dl,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0})}},[t,n]);return a.jsx(mt,{onSubmit:r,children:a.jsxs(Ue,{children:[a.jsx(zt,{title:"Export Format",description:"Required",withAsterisk:!0,children:a.jsx(Fd,{name:"format",data:[{label:"FHIR Everything",value:"everything"},{label:"Patient Summary",value:"summary"},{label:"C-CDA",value:"ccda"},{label:"C-CDA Referral",value:"ccdaReferral"}],fullWidth:!0})}),a.jsx(zt,{title:"Author",description:"Optional author for composition. Default value is current user.",children:a.jsx(cs,{name:"author",placeholder:"Author",targetTypes:["Organization","Practitioner","PractitionerRole"]})}),a.jsx(zt,{title:"Authored On",description:"Optional date for composition authored on. Default value is current date.",children:a.jsx(Eo,{name:"authoredOn",placeholder:"Authored on"})}),a.jsx(zt,{title:"Start Date",description:"The start date of care. If no start date is provided, all records prior to the end date are in scope.",children:a.jsx(Eo,{name:"startDate",placeholder:"Start date"})}),a.jsx(zt,{title:"End Date",description:"The end date of care. If no end date is provided, all records subsequent to the start date are in scope.",children:a.jsx(Eo,{name:"endDate",placeholder:"End date"})}),a.jsx(xe,{justify:"right",children:a.jsx(wr,{children:"Request Export"})})]})})}function uK(e,t,n){const r=typeof e=="string"?e:JSON.stringify(e,null,2),o=new Blob([r],{type:n}),s=window.URL.createObjectURL(o),c=document.createElement("a");document.body.appendChild(c),c.style.display="none",c.href=s,c.download=t,c.click(),window.URL.revokeObjectURL(s)}function dK(e){if(e.gender==="male")return"blue";if(e.gender==="female")return"pink"}function Kk(e){const t=Kt(e.patient);return t?a.jsxs(yt,{children:[a.jsx(Ss,{value:t,size:"lg",color:dK(t)}),a.jsxs(yt.Entry,{children:[a.jsx(yt.Key,{children:"Name"}),a.jsx(yt.Value,{children:a.jsx(St,{to:t,fw:500,children:t.name?a.jsx(sS,{value:t.name[0],options:{use:!1}}):"[blank]"})})]}),t.birthDate&&a.jsxs(a.Fragment,{children:[a.jsxs(yt.Entry,{children:[a.jsx(yt.Key,{children:"DoB"}),a.jsx(yt.Value,{children:t.birthDate})]}),a.jsxs(yt.Entry,{children:[a.jsx(yt.Key,{children:"Age"}),a.jsx(yt.Value,{children:sU(t.birthDate)})]})]}),t.gender&&a.jsxs(yt.Entry,{children:[a.jsx(yt.Key,{children:"Gender"}),a.jsx(yt.Value,{children:t.gender})]}),t.address&&a.jsxs(yt.Entry,{children:[a.jsx(yt.Key,{children:"State"}),a.jsx(yt.Value,{children:t.address[0]?.state})]}),t.identifier?.map(n=>a.jsxs(yt.Entry,{children:[a.jsx(yt.Key,{children:n?.system}),a.jsx(yt.Value,{children:n?.value})]},`${n?.system}-${n?.value}`))]}):null}function fK(e){const{patient:t,...n}=e,r=v.useCallback((o,s,c)=>{const d=`${s}/${c}`,f=100;return Promise.allSettled([o.readHistory("Patient",c),o.search("Communication",{subject:d,_count:f}),o.search("Device",{patient:d,_count:f}),o.search("DeviceRequest",{patient:d,_count:f}),o.search("DiagnosticReport",{subject:d,_count:f}),o.search("Media",{subject:d,_count:f}),o.search("ServiceRequest",{subject:d,_count:f}),o.search("Task",{subject:d,_count:f})])},[]);return a.jsx(Um,{value:t,loadTimelineResources:r,createCommunication:(o,s,c)=>({resourceType:"Communication",status:"completed",subject:Wt(o),sender:Wt(s),sent:new Date().toISOString(),payload:[{contentString:c}]}),createMedia:(o,s,c)=>({resourceType:"Media",status:"completed",subject:Wt(o),operator:Wt(s),issued:new Date().toISOString(),content:c}),...n})}const hK="_section_pqpwm_1",pK="_hovering_pqpwm_7",kx={section:hK,hovering:pK};function mK(e){const t=Re(),n=Kt(e.value),[r,o]=v.useState(!1),[s,c]=v.useState(),[d,f]=v.useState(),[p,m]=v.useState();function g(){f(void 0)}function y(){c(void 0)}const b=v.useRef(p);if(b.current=p,v.useEffect(()=>{t.requestSchema("PlanDefinition").then(()=>o(!0)).catch(console.log)},[t]),v.useEffect(()=>(m(bK(n??{resourceType:"PlanDefinition",status:"active"})),document.addEventListener("mouseover",g),document.addEventListener("click",y),()=>{document.removeEventListener("mouseover",g),document.removeEventListener("click",y)}),[n]),!r||!p)return null;function w(j,C){m({...b.current,[j]:C})}return a.jsx("div",{children:a.jsxs(mt,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(p),children:[a.jsx(Fe,{label:"Plan Title",py:"md",defaultValue:p.title,onChange:j=>w("title",j.currentTarget.value)}),a.jsx(gK,{actions:p.action||[],selectedKey:s,setSelectedKey:c,hoverKey:d,setHoverKey:f,onChange:j=>w("action",j)}),a.jsx(wr,{children:"Save"})]})})}function gK(e){const t=v.useRef(e.actions);t.current=e.actions;function n(s){e.onChange(t.current.map(c=>c.id===s.id?s:c))}function r(s){e.onChange([...t.current,s]),e.setSelectedKey(s.id)}function o(s){e.onChange(t.current.filter(c=>c!==s))}return a.jsxs(Ue,{gap:"md",className:kx.section,children:[e.actions.map(s=>a.jsx(vK,{action:s,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:n,onRemove:()=>o(s)},s.id)),a.jsx("div",{children:a.jsx(Ae,{variant:"outline",onClick:s=>{pn(s),r({id:Xk()})},children:"Add action"})})]})}function vK(e){const{action:t}=e,n=xK(t);function r(s){s.stopPropagation(),e.setSelectedKey(e.action.id)}function o(s){pn(s),e.setHoverKey(e.action.id)}return a.jsx("div",{onClick:r,onMouseOver:o,onFocus:o,children:a.jsx(yK,{action:t,actionType:n,onChange:e.onChange,selectedKey:e.selectedKey,hoverKey:e.hoverKey,onRemove:e.onRemove})})}function yK(e){const{action:t}=e,[n,r]=v.useState(e.actionType),o=e.selectedKey===e.action.id,s=e.hoverKey===e.action.id;function c(f,p){e.onChange({...t,[f]:p})}const d=$t(kx.section,{[kx.hovering]:s&&!o});return a.jsxs(Pr,{"data-testid":t.id,className:d,p:0,radius:"sm",withBorder:!0,children:[a.jsxs(to,{w:"100%",p:"xs",bg:"gray.0",gap:"md",align:"center",justify:"space-between",children:[a.jsx(Fe,{w:"100%",name:`actionTitle-${t.id}`,defaultValue:t.title,placeholder:"Title",onChange:f=>c("title",f.currentTarget.value)}),a.jsx(ms,{"data-testid":"close-button",onClick:e.onRemove})]}),o&&a.jsxs(Ue,{gap:"xl",p:"md",children:[a.jsx(de,{children:a.jsx(Fe,{label:"Task Description",placeholder:"Enter task description",name:`actionDescription-${t.id}`,defaultValue:t.description,onChange:f=>c("description",f.currentTarget.value)})}),a.jsx(de,{children:a.jsx(un,{label:"Type of Action",value:n,onChange:f=>{const p=f.currentTarget.value==="standard"?void 0:f.currentTarget.value;r(p),e.onChange({...e.action,definitionCanonical:p==="standard"?void 0:e.action.definitionCanonical})},data:[{value:"standard",label:"Standard task"},{value:"questionnaire",label:"Task with Questionnaire"},{value:"activitydefinition",label:"Task with Activity Definition"}]})}),n==="questionnaire"&&a.jsxs(Ue,{gap:0,children:[a.jsxs(xe,{gap:0,mb:"xs",children:[a.jsx(Te,{fw:600,children:"Select questionnaire"}),a.jsx(Te,{c:"red",children:"*"})]}),a.jsxs(Te,{size:"sm",c:"dimmed",mb:"sm",children:["Questionnaire to be shown in the task in Encounter view. You can create new one from"," ",a.jsx(Mt,{href:"/Questionnaire",target:"_blank",c:"blue",children:"questionnaires list"})]}),a.jsx(XT,{resourceType:"Questionnaire",action:t,onChange:e.onChange})]}),n==="activitydefinition"&&a.jsxs(Ue,{gap:0,children:[a.jsxs(xe,{gap:0,mb:"xs",children:[a.jsx(Te,{fw:600,children:"Select activity definition"}),a.jsx(Te,{c:"red",children:"*"})]}),a.jsxs(Te,{size:"sm",c:"dimmed",mb:"sm",children:["ActivityDefinition.kind resource to be shown in the task in Encounter view. You can create new one from"," ",a.jsx(Mt,{href:"/ActivityDefinition",target:"_blank",c:"blue",children:"activity definitions list"})]}),a.jsx(XT,{resourceType:"ActivityDefinition",action:t,onChange:e.onChange})]})]})]})}function XT(e){const{id:t,definitionCanonical:n}=e.action,r=n?.startsWith(e.resourceType+"/")?{reference:n}:void 0;return a.jsx(El,{name:t,resourceType:e.resourceType,defaultValue:r,onChange:o=>{o?e.onChange({...e.action,definitionCanonical:Ot(o)}):e.onChange({...e.action,definitionCanonical:void 0})}})}function xK(e){return e.definitionCanonical?.startsWith("Questionnaire")?"questionnaire":e.definitionCanonical?.startsWith("ActivityDefinition")?"activitydefinition":"standard"}let $y=1;function Xk(e){if(e){if(e.startsWith("id-")){const t=Number.parseInt(e.substring(3),10);Number.isNaN(t)||($y=Math.max($y,t+1))}return e}return"id-"+$y++}function bK(e){return{...e,action:Jk(e.action)}}function Jk(e){if(e)return e.map(t=>({...t,id:Xk(t.id),action:Jk(t.action)}))}const rl=30,Tp=50;function Rp(e){const t=e.formState,n=e.item,r=e.responseItem;function o(g){t&&e.context&&t.onChangeAnswer(e.context,e.item,g)}const s=n.type;if(!s)return null;const c=n.linkId;if(!c)return null;let d;n.initial&&n.initial.length>0?d=n.initial[0]:n.answerOption&&n.answerOption.length>0&&(d=n.answerOption.find(g=>g.initialSelected));const f=CS(r,e.index)??Z0(d),p=Lo(r,`${io}/fhir/StructureDefinition/questionnaire-validationError`);let m=null;switch(s){case Ct.display:m=a.jsx("p",{children:e.item.text},e.item.linkId);break;case Ct.boolean:m=a.jsx(Ak,{title:e.item.text,htmlFor:e.item.linkId,children:a.jsx(Ln,{id:e.item.linkId,name:e.item.linkId,required:e.required??n.required,defaultChecked:f?.value,onChange:g=>o([{valueBoolean:g.currentTarget.checked}])})},e.item.linkId);break;case Ct.decimal:m=a.jsx(Fe,{type:"number",step:"any",id:c,name:c,required:e.required??n.required,defaultValue:f?.value,onChange:g=>o(g.currentTarget.value===""?[]:[{valueDecimal:g.currentTarget.valueAsNumber}])});break;case Ct.integer:m=a.jsx(Fe,{type:"number",step:1,id:c,name:c,required:e.required??n.required,defaultValue:f?.value,onChange:g=>o(g.currentTarget.value===""?[]:[{valueInteger:g.currentTarget.valueAsNumber}])});break;case Ct.date:m=a.jsx(Fe,{type:"date",id:c,name:c,required:e.required??n.required,defaultValue:f?.value,onChange:g=>o([{valueDate:g.currentTarget.value}])});break;case Ct.dateTime:m=a.jsx(Eo,{name:c,required:e.required??n.required,defaultValue:f?.value,onChange:g=>o([{valueDateTime:g}])});break;case Ct.time:m=a.jsx(Fe,{type:"time",id:c,name:c,required:e.required??n.required,defaultValue:f?.value,onChange:g=>o([{valueTime:g.currentTarget.value}])});break;case Ct.string:case Ct.url:m=a.jsx(Fe,{id:c,name:c,required:e.required??n.required,defaultValue:f?.value,onChange:g=>{const y=g.currentTarget.value;o(y===""?[]:[{valueString:y}])}});break;case Ct.text:m=a.jsx(Sl,{id:c,name:c,required:e.required??n.required,defaultValue:f?.value,onChange:g=>{const y=g.currentTarget.value;o(y===""?[]:[{valueString:y}])}});break;case Ct.attachment:m=a.jsx(xe,{py:4,children:a.jsx(mk,{path:"",name:c,defaultValue:f?.value,onChange:g=>o([{valueAttachment:g}])})});break;case Ct.reference:m=a.jsx(cs,{name:c,required:e.required??n.required,targetTypes:XA(n),searchCriteria:SF(n,t?.subject,t?.encounter),defaultValue:f?.value,onChange:g=>o([{valueReference:g}])});break;case Ct.quantity:m=a.jsx(fl,{path:"",name:c,required:e.required??n.required,defaultValue:f?.value,onChange:g=>o([{valueQuantity:g}]),disableWheel:!0});break;case Ct.choice:case Ct.openChoice:RK(n)?m=a.jsx(CK,{name:c,item:n,required:e.required??n.required,initial:d,response:r,onChangeAnswer:g=>o(g)}):TK(n)||n.answerValueSet&&!_K(n)?m=a.jsx(SK,{name:c,item:n,required:e.required??n.required,initial:d,response:r,onChangeAnswer:g=>o(g)}):m=a.jsx(jK,{name:c,item:n,required:e.required??n.required,initial:d,response:r,onChangeAnswer:g=>o(g)});break;default:return null}return a.jsxs(a.Fragment,{children:[m,p?.valueString&&a.jsx(Te,{c:"red",size:"lg",mt:4,children:p.valueString})]})}function SK(e){const{name:t,item:n,required:r,initial:o,onChangeAnswer:s,response:c}=e;if(!n.answerOption?.length&&!n.answerValueSet)return a.jsx(jS,{});const d=Z0(o),f=CS(c)??d,p=tP(c),m=n.repeats||DK(n);if(n.answerValueSet)return a.jsx(Zd,{name:t,placeholder:"Select items",binding:n.answerValueSet,maxValues:m?void 0:1,required:r,onChange:g=>{m?g.length===0?s([{}]):s(g.map(y=>({valueCoding:y}))):s([{valueCoding:g[0]}])},defaultValue:f?.value});if(m){const{propertyName:g,data:y}=AK(n);return a.jsx(pm,{data:y,placeholder:"Select items",searchable:!0,defaultValue:p||[ll(d)],required:r,onChange:b=>{if(b.length===0)s([{}]);else{const w=YA(b,g,n);s(w)}}})}else{const g=[""];if(n.answerOption)for(const y of n.answerOption){const b=Ao(y);g.push(ll(b))}return a.jsx(un,{id:t,name:t,required:r,onChange:y=>{const b=y.currentTarget.selectedIndex;if(b===0){s([{}]);return}const w=n.answerOption[b-1],j=Ao(w),C="value"+qn(j.type);s([{[C]:j.value}])},defaultValue:Kd(f?.value)||f?.value,data:g})}}function wK(e,t){return e?t.valueSetExpand({url:e,count:rl+1}).then(n=>n.expansion?.contains??[]):Promise.resolve([])}function Zk(e){const t=Re(),[n,r]=v.useState([]),[o,s]=v.useState(!1);return v.useEffect(()=>{async function c(){if(e){s(!0);try{const d=await wK(e,t);r(d)}catch(d){console.error("Error loading value set:",d)}finally{s(!1)}}}c().catch(console.error)},[e,t]),[n,o]}function eP(e,t){return e.map((n,r)=>{const o=`${t}-valueset-${r}`,s={type:"Coding",value:{system:n.system,code:n.code,display:n.display}};return[o,s]})}function jK(e){const{name:t,item:n,required:r,initial:o,onChangeAnswer:s,response:c}=e,d=xs("QuestionnaireItemAnswerOption","value[x]"),f=Z0(o),[p,m]=Zk(n.answerValueSet),g=[];let y;if(n.answerValueSet)g.push(...eP(p,t));else if(n.answerOption){const C=n.answerOption.slice(0,Tp).map((R,T)=>{const E=`${t}-option-${T}`,_=Ao(R);return _?.value?(f&&no(_)===no(f)&&(y=E),[E,_]):null}).filter(R=>R!==null);g.push(...C)}const b=CS(c),w=EK(g,b);if(m)return a.jsx(Te,{children:"Loading options..."});if(g.length===0)return a.jsx(jS,{});const j=g.slice(0,rl);return a.jsxs(a.Fragment,{children:[a.jsx(vr.Group,{name:t,value:w??y,required:r,onChange:C=>{const R=g.find(T=>T[0]===C);if(R){const T=R[1],E="value"+qn(T.type);s([{[E]:T.value}])}},children:j.map(([C,R])=>a.jsx(vr,{id:C,value:C,py:4,required:r,label:a.jsx(ro,{property:d,propertyType:R.type,value:R.value})},C))}),(n.answerValueSet&&g.length>rl||n.answerOption&&g.length>Tp)&&a.jsxs(Te,{size:"sm",c:"dimmed",mt:"xs",children:["Showing first ",rl," options"]})]})}function CK(e){const{name:t,item:n,onChangeAnswer:r,response:o}=e,s=xs("QuestionnaireItemAnswerOption","value[x]"),[c,d]=Zk(n.answerValueSet),f=n.answerValueSet?(o?.answer?.map(w=>w.valueCoding)||[]).filter(w=>w!==void 0):tP(o),[p,m]=v.useState(f),g=[];if(n.answerValueSet)g.push(...eP(c,t));else if(n.answerOption){const w=n.answerOption.slice(0,Tp).map((j,C)=>{const R=`${t}-option-${C}`,T=Ao(j);return T?.value?[R,T]:null}).filter(j=>j!==null);g.push(...w)}if(d)return a.jsx(Te,{children:"Loading options..."});if(g.length===0)return a.jsx(jS,{});const y=g.slice(0,rl),b=(w,j)=>{if(n.answerValueSet){const C=p;let R;j?R=[...C,w.value]:R=C.filter(T=>!_o(T,w.value)),m(R),R.length===0?r([{}]):r(R.map(T=>({valueCoding:T})))}else{const C=p,R=ll(w);let T;if(j?T=[...C,R]:T=C.filter(E=>E!==R),m(T),T.length===0)r([{}]);else{const E=YA(T,"value"+qn(w.type),n);r(E)}}};return a.jsxs(xe,{style:{flexDirection:"column",alignItems:"flex-start"},children:[y.map(([w,j])=>{const C=ll(j),R=n.answerValueSet?p.some(T=>_o(T,j.value)):p.includes(C);return a.jsx(Ln,{id:w,label:a.jsx(ro,{property:s,propertyType:j.type,value:j.value}),checked:R,onChange:T=>b(j,T.currentTarget.checked)},w)}),(n.answerValueSet&&g.length>rl||n.answerOption&&g.length>Tp)&&a.jsxs(Te,{size:"sm",c:"dimmed",children:["Showing first ",rl," options"]})]})}function jS(){return a.jsx(Fe,{disabled:!0,placeholder:"No Answers Defined"})}function CS(e,t=0){return Ao(e?.answer?.[t]??{})}function tP(e){const t=e?.answer;return t?t.map(r=>Ao(r)).map(r=>Kd(r?.value)||r?.value).filter(Boolean):[]}function EK(e,t){return e.find(n=>_o(n[1].value,t?.value))?.[0]}function Hm(e,t){return!!e.extension?.some(n=>n.url===X0&&n.valueCodeableConcept?.coding?.[0]?.code===t)}function TK(e){return Hm(e,"drop-down")}function RK(e){return Hm(e,"check-box")}function _K(e){return Hm(e,"radio-button")}function DK(e){return Hm(e,"multi-select")}function AK(e){if(e.answerOption?.length===0)return{propertyName:"",data:[]};const t=e.answerOption[0],n=Ao(t),r="value"+qn(n.type),o=(e.answerOption??[]).map(s=>{const c=Ao(s),d=ll(c);return{value:d,label:d}});return{propertyName:r,data:o}}const kK="_section_my8o4_1",PK="_hovering_my8o4_10",NK="_editing_my8o4_14",OK="_questionBody_my8o4_20",MK="_topActions_my8o4_24",LK="_bottomActions_my8o4_33",IK="_movementActions_my8o4_44",zK="_movementIcons_my8o4_56",$K="_columnAlignment_my8o4_60",UK="_linkIdInput_my8o4_65",BK="_typeSelect_my8o4_70",VK="_preserveBreaks_my8o4_74",si={section:kK,hovering:PK,editing:NK,questionBody:OK,topActions:MK,bottomActions:LK,movementActions:IK,movementIcons:zK,columnAlignment:$K,linkIdInput:UK,typeSelect:BK,preserveBreaks:VK};function FK(e){const t=Re(),n=Kt(e.questionnaire),[r,o]=v.useState(!1),[s,c]=v.useState(),[d,f]=v.useState(),[p,m]=v.useState();function g(){m(void 0)}function y(){f(void 0)}v.useEffect(()=>{t.requestSchema("Questionnaire").then(()=>o(!0)).catch(console.log)},[t]),v.useEffect(()=>(c(WK(n??{resourceType:"Questionnaire",status:"active"})),document.addEventListener("mouseover",g),document.addEventListener("click",y),()=>{document.removeEventListener("mouseover",g),document.removeEventListener("click",y)}),[n]);const b=(w,j)=>{c(w),e.autoSave&&!j&&e.onSubmit&&e.onSubmit(w)};return!r||!s?null:a.jsx("div",{children:a.jsxs(mt,{testid:"questionnaire-form",onSubmit:()=>e.onSubmit(s),children:[a.jsx(nP,{item:s,selectedKey:d,setSelectedKey:f,hoverKey:p,setHoverKey:m,onChange:b}),a.jsx(wr,{children:"Save"})]})})}function nP(e){const t=e.item,n=e.item,r=Io(e.item),o=r||n.type===Ct.group,s=n.linkId??"[untitled]",c=e.selectedKey===e.item.id,d=e.hoverKey===e.item.id,f=v.useRef(e.item);f.current=e.item;function p(E){pn(E),e.setSelectedKey(e.item.id)}function m(E){pn(E),e.setHoverKey(e.item.id)}function g(E){const _=f.current;e.onChange({..._,item:_.item?.map(k=>k.id===E.id?E:k)})}function y(E,_){e.onChange({...e.item,item:[...e.item.item??[],E]},_)}function b(E){e.onChange({...e.item,item:e.item.item?.filter(_=>_!==E)})}function w(E,_){e.onChange({...f.current,[E]:_})}function j(E){e.onChange({...e.item,...E})}function C(E){e.onChange({...e.item,item:e.item.item?.map(_=>_===E?{..._,repeats:!_.repeats}:_)})}function R(E,_){const k=KK(e.item.item,E,_);e.onChange({...e.item,item:k})}const T=$t(si.section,{[si.editing]:c,[si.hovering]:d&&!c});return a.jsxs("div",{"data-testid":n.linkId,className:T,onClick:p,onMouseOver:m,onFocus:m,children:[a.jsx("div",{className:si.questionBody,children:c?a.jsxs(a.Fragment,{children:[r&&a.jsx(Fe,{size:"xl",defaultValue:t.title,onBlur:E=>w("title",E.currentTarget.value)}),!r&&a.jsx(Sl,{autosize:!0,minRows:2,defaultValue:n.text,onBlur:E=>w("text",E.currentTarget.value)}),n.type==="reference"&&a.jsx(GK,{item:n,onChange:j}),dF(n)&&a.jsx(HK,{item:n,onChange:E=>j(E)})]}):a.jsxs(a.Fragment,{children:[t.title&&a.jsx(Ie,{children:t.title}),n.text&&a.jsx("div",{className:si.preserveBreaks,children:n.text}),!o&&a.jsx(Rp,{item:n,index:0,required:!1,responseItem:{linkId:n.linkId}})]})}),n.item?.map((E,_)=>a.jsx("div",{children:a.jsx(nP,{item:E,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,isFirst:_===0,isLast:_===(e.item.item??[]).length-1,setHoverKey:e.setHoverKey,onChange:g,onRemove:()=>b(E),onRepeatable:C,onMoveUp:()=>R(_,-1),onMoveDown:()=>R(_,1)})},E.id)),!o&&a.jsx("div",{className:si.topActions,children:c?a.jsxs(a.Fragment,{children:[a.jsx(Fe,{size:"xs",className:si.linkIdInput,defaultValue:n.linkId,onBlur:E=>w("linkId",E.currentTarget.value)}),!o&&a.jsx(un,{size:"xs",className:si.typeSelect,defaultValue:n.type,onChange:E=>w("type",E.currentTarget.value),data:[{value:"display",label:"Display"},{value:"boolean",label:"Boolean"},{value:"decimal",label:"Decimal"},{value:"integer",label:"Integer"},{value:"date",label:"Date"},{value:"dateTime",label:"Date/Time"},{value:"time",label:"Time"},{value:"string",label:"String"},{value:"text",label:"Text"},{value:"url",label:"URL"},{value:"choice",label:"Choice"},{value:"open-choice",label:"Open Choice"},{value:"attachment",label:"Attachment"},{value:"reference",label:"Reference"},{value:"quantity",label:"Quantity"}]})]}):a.jsx("div",{children:s})}),!r&&a.jsx(de,{className:si.movementActions,children:a.jsxs(de,{className:si.columnAlignment,children:[!e.isFirst&&a.jsx(Mt,{href:"#",onClick:E=>{E.preventDefault(),e.onMoveUp&&e.onMoveUp()},children:a.jsx(HF,{"data-testid":"up-button",size:15,className:si.movementIcons})}),!e.isLast&&a.jsx(Mt,{href:"#",onClick:E=>{E.preventDefault(),e.onMoveDown&&e.onMoveDown()},children:a.jsx(VF,{"data-testid":"down-button",size:15,className:si.movementIcons})})]})}),a.jsxs("div",{className:si.bottomActions,children:[o&&a.jsxs(a.Fragment,{children:[a.jsx(Mt,{href:"#",onClick:E=>{E.preventDefault(),y({id:ml(),linkId:Ox("q"),type:"string",text:"Question"})},children:"Add item"}),a.jsx(Mt,{href:"#",onClick:E=>{E.preventDefault(),y({id:ml(),linkId:Ox("g"),type:"group",text:"Group"},!0)},children:"Add group"})]}),r&&a.jsx(Mt,{href:"#",onClick:E=>{E.preventDefault(),y(YK(),!0)},children:"Add Page"}),c&&!r&&a.jsxs(a.Fragment,{children:[a.jsx(Mt,{href:"#",onClick:E=>{E.preventDefault(),e.onRepeatable&&e.onRepeatable(n)},children:n.repeats?"Remove Repeatable":"Make Repeatable"}),a.jsx(Mt,{href:"#",onClick:E=>{E.preventDefault(),e.onRemove&&e.onRemove()},children:"Remove"})]})]})]})}function HK(e){const t=xs("QuestionnaireItemAnswerOption","value[x]"),n=e.item.answerOption??[];return a.jsxs("div",{children:[e.item.answerValueSet!==void 0?a.jsx(Fe,{placeholder:"Enter Value Set",defaultValue:e.item.answerValueSet,onChange:r=>e.onChange({...e.item,answerValueSet:r.target.value})}):a.jsx(qK,{options:n,property:t,item:e.item,onChange:e.onChange}),a.jsxs(de,{display:"flex",children:[a.jsx(Mt,{href:"#",onClick:r=>{pn(r),e.onChange({...e.item,answerValueSet:void 0,answerOption:[...n,{id:ml()}]})},children:"Add choice"}),a.jsx(jm,{w:"lg"}),a.jsx(Mt,{href:"#",onClick:r=>{pn(r),e.onChange({...e.item,answerOption:[],answerValueSet:""})},children:"Add value set"})]})]})}function qK(e){return a.jsx("div",{children:e.options.map(t=>{const[n,r]=Im({type:"QuestionnaireItemAnswerOption",value:t},"value");return a.jsxs("div",{style:{display:"flex",flexDirection:"row",justifyContent:"space-between",alignItems:"center",width:"80%"},children:[a.jsx("div",{children:a.jsx(nf,{name:"value[x]",path:"Questionnaire.answerOption.value[x]",property:e.property,defaultPropertyType:r,defaultValue:n,onChange:(o,s)=>{const c=[...e.options],d=c.findIndex(f=>f.id===t.id);c[d]={id:t.id,[s]:o},e.onChange({...e.item,answerOption:c})},outcome:void 0},t.id)}),a.jsx("div",{children:a.jsx(Mt,{href:"#",onClick:o=>{pn(o),e.onChange({...e.item,answerOption:e.options.filter(s=>s.id!==t.id)})},children:"Remove"})})]},t.id)})})}function GK(e){const t=XA(e.item)??[];return a.jsxs(a.Fragment,{children:[t.map((n,r)=>a.jsxs(xe,{children:[a.jsx(uS,{name:"resourceType",placeholder:"Resource Type",defaultValue:n,onChange:o=>{e.onChange(Ny(e.item,t.map(s=>s===n?o:s)))}}),a.jsx(Mt,{href:"#",onClick:o=>{pn(o),e.onChange(Ny(e.item,t.filter(s=>s!==n)))},children:"Remove"})]},`${n}-${r}`)),a.jsx(Mt,{href:"#",onClick:n=>{pn(n),e.onChange(Ny(e.item,[...t,""]))},children:"Add Resource Type"})]})}let Px=1,Nx=1;function Ox(e){return e+Px++}function ml(){return"id-"+Nx++}function WK(e){return{...e,id:e.id||ml(),item:rP(e.item)}}function rP(e){if(e)return e.forEach(t=>{t.id?.match(/^id-\d+$/)&&(Nx=Math.max(Nx,Number.parseInt(t.id.substring(3),10)+1)),t.linkId?.match(/^q\d+$/)&&(Px=Math.max(Px,Number.parseInt(t.linkId.substring(1),10)+1))}),e.map(t=>({...t,id:t.id||ml(),item:rP(t.item),answerOption:QK(t.answerOption)}))}function QK(e){if(e)return e.map(t=>({...t,id:t.id||ml()}))}function YK(){return{id:ml(),linkId:Ox("s"),type:"group",text:"New Page",extension:[{url:X0,valueCodeableConcept:{coding:[{system:"http://hl7.org/fhir/questionnaire-item-control",code:"page"}]}}]}}function KK(e,t,n){const r=e??[],o=t+n;if(o<0||o>=r.length)return r;const s=[...r];return[s[t],s[o]]=[s[o],s[t]],s}var _p=class{x;y;pressure;time;constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw new Error(`Point is invalid: (${e}, ${t})`);this.x=+e,this.y=+t,this.pressure=n||0,this.time=r||Date.now()}distanceTo(e){return Math.sqrt(Math.pow(this.x-e.x,2)+Math.pow(this.y-e.y,2))}equals(e){return this.x===e.x&&this.y===e.y&&this.pressure===e.pressure&&this.time===e.time}velocityFrom(e){return this.time!==e.time?this.distanceTo(e)/(this.time-e.time):0}},XK=class iP{constructor(t,n,r,o,s,c){this.startPoint=t,this.control2=n,this.control1=r,this.endPoint=o,this.startWidth=s,this.endWidth=c}static fromPoints(t,n){const r=this.calculateControlPoints(t[0],t[1],t[2]).c2,o=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new iP(t[1],r,o,t[2],n.start,n.end)}static calculateControlPoints(t,n,r){const o=t.x-n.x,s=t.y-n.y,c=n.x-r.x,d=n.y-r.y,f={x:(t.x+n.x)/2,y:(t.y+n.y)/2},p={x:(n.x+r.x)/2,y:(n.y+r.y)/2},m=Math.sqrt(o*o+s*s),g=Math.sqrt(c*c+d*d),y=f.x-p.x,b=f.y-p.y,w=m+g==0?0:g/(m+g),j={x:p.x+y*w,y:p.y+b*w},C=n.x-j.x,R=n.y-j.y;return{c1:new _p(f.x+C,f.y+R),c2:new _p(p.x+C,p.y+R)}}length(){let n=0,r,o;for(let s=0;s<=10;s+=1){const c=s/10,d=this.point(c,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),f=this.point(c,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(s>0){const p=d-r,m=f-o;n+=Math.sqrt(p*p+m*m)}r=d,o=f}return n}point(t,n,r,o,s){return n*(1-t)*(1-t)*(1-t)+3*r*(1-t)*(1-t)*t+3*o*(1-t)*t*t+s*t*t*t}},JK=class{_et;constructor(){try{this._et=new EventTarget}catch{this._et=document}}addEventListener(e,t,n){this._et.addEventListener(e,t,n)}dispatchEvent(e){return this._et.dispatchEvent(e)}removeEventListener(e,t,n){this._et.removeEventListener(e,t,n)}};function ZK(e,t=250){let n=0,r=null,o,s,c;const d=()=>{n=Date.now(),r=null,o=e.apply(s,c),r||(s=null,c=[])};return function(...p){const m=Date.now(),g=t-(m-n);return s=this,c=p,g<=0||g>t?(r&&(clearTimeout(r),r=null),n=m,o=e.apply(s,c),r||(s=null,c=[])):r||(r=window.setTimeout(d,g)),o}}var eX=class Mx extends JK{constructor(t,n={}){super(),this.canvas=t,this.velocityFilterWeight=n.velocityFilterWeight||.7,this.minWidth=n.minWidth||.5,this.maxWidth=n.maxWidth||2.5,this.throttle=n.throttle??16,this.minDistance=n.minDistance??5,this.dotSize=n.dotSize||0,this.penColor=n.penColor||"black",this.backgroundColor=n.backgroundColor||"rgba(0,0,0,0)",this.compositeOperation=n.compositeOperation||"source-over",this.canvasContextOptions=n.canvasContextOptions??{},this._strokeMoveUpdate=this.throttle?ZK(Mx.prototype._strokeUpdate,this.throttle):Mx.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._ctx=t.getContext("2d",this.canvasContextOptions),this.clear(),this.on()}dotSize;minWidth;maxWidth;penColor;minDistance;velocityFilterWeight;compositeOperation;backgroundColor;throttle;canvasContextOptions;_ctx;_drawingStroke=!1;_isEmpty=!0;_dataUrl;_dataUrlOptions;_lastPoints=[];_data=[];_lastVelocity=0;_lastWidth=0;_strokeMoveUpdate;_strokePointerId;clear(){const{_ctx:t,canvas:n}=this;t.fillStyle=this.backgroundColor,t.clearRect(0,0,n.width,n.height),t.fillRect(0,0,n.width,n.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._dataUrl=void 0,this._dataUrlOptions=void 0,this._strokePointerId=void 0}redraw(){const t=this._data,n=this._dataUrl,r=this._dataUrlOptions;this.clear(),n&&this.fromDataURL(n,r),this.fromData(t,{clear:!1})}fromDataURL(t,n={}){return new Promise((r,o)=>{const s=new Image,c=n.ratio||window.devicePixelRatio||1,d=n.width||this.canvas.width/c,f=n.height||this.canvas.height/c,p=n.xOffset||0,m=n.yOffset||0;this._reset(this._getPointGroupOptions()),s.onload=()=>{this._ctx.drawImage(s,p,m,d,f),r()},s.onerror=g=>{o(g)},s.crossOrigin="anonymous",s.src=t,this._isEmpty=!1,this._dataUrl=t,this._dataUrlOptions={...n}})}toDataURL(t="image/png",n){switch(t){case"image/svg+xml":return typeof n!="object"&&(n=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(n))}`;default:return typeof n!="number"&&(n=void 0),this.canvas.toDataURL(t,n)}}on(){this.canvas.style.touchAction="none",this.canvas.style.msTouchAction="none",this.canvas.style.userSelect="none";const t=/Macintosh/.test(navigator.userAgent)&&"ontouchstart"in document;window.PointerEvent&&!t?this._handlePointerEvents():(this._handleMouseEvents(),"ontouchstart"in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction="auto",this.canvas.style.msTouchAction="auto",this.canvas.style.userSelect="auto",this.canvas.removeEventListener("pointerdown",this._handlePointerDown),this.canvas.removeEventListener("mousedown",this._handleMouseDown),this.canvas.removeEventListener("touchstart",this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){const t=window.document===this.canvas.ownerDocument?window:this.canvas.ownerDocument.defaultView??this.canvas.ownerDocument;return{addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}_removeMoveUpEventListeners(){const{removeEventListener:t}=this._getListenerFunctions();t("pointermove",this._handlePointerMove),t("pointerup",this._handlePointerUp),t("mousemove",this._handleMouseMove),t("mouseup",this._handleMouseUp),t("touchmove",this._handleTouchMove),t("touchend",this._handleTouchEnd)}isEmpty(){return this._isEmpty}fromData(t,{clear:n=!0}={}){n&&this.clear(),this._fromData(t,this._drawCurve.bind(this),this._drawDot.bind(this)),this._data=this._data.concat(t)}toData(){return this._data}_isLeftButtonPressed(t,n){return n?t.buttons===1:(t.buttons&1)===1}_pointerEventToSignatureEvent(t){return{event:t,type:t.type,x:t.clientX,y:t.clientY,pressure:"pressure"in t?t.pressure:0}}_touchEventToSignatureEvent(t){const n=t.changedTouches[0];return{event:t,type:t.type,x:n.clientX,y:n.clientY,pressure:n.force}}_handleMouseDown(t){!this._isLeftButtonPressed(t,!0)||this._drawingStroke||this._strokeBegin(this._pointerEventToSignatureEvent(t))}_handleMouseMove(t){if(!this._isLeftButtonPressed(t,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(t),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(t))}_handleMouseUp(t){this._isLeftButtonPressed(t)||this._strokeEnd(this._pointerEventToSignatureEvent(t))}_handleTouchStart(t){t.targetTouches.length!==1||this._drawingStroke||(t.cancelable&&t.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(t)))}_handleTouchMove(t){if(t.targetTouches.length===1){if(t.cancelable&&t.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(t),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(t))}}_handleTouchEnd(t){t.targetTouches.length===0&&(t.cancelable&&t.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(t)))}_getPointerId(t){return t.persistentDeviceId||t.pointerId}_allowPointerId(t,n=!1){return typeof this._strokePointerId>"u"?n:this._getPointerId(t)===this._strokePointerId}_handlePointerDown(t){this._drawingStroke||!this._isLeftButtonPressed(t)||!this._allowPointerId(t,!0)||(this._strokePointerId=this._getPointerId(t),t.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(t)))}_handlePointerMove(t){if(this._allowPointerId(t)){if(!this._isLeftButtonPressed(t,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(t),!1);return}t.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(t))}}_handlePointerUp(t){this._isLeftButtonPressed(t)||!this._allowPointerId(t)||(t.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(t)))}_getPointGroupOptions(t){return{penColor:t&&"penColor"in t?t.penColor:this.penColor,dotSize:t&&"dotSize"in t?t.dotSize:this.dotSize,minWidth:t&&"minWidth"in t?t.minWidth:this.minWidth,maxWidth:t&&"maxWidth"in t?t.maxWidth:this.maxWidth,velocityFilterWeight:t&&"velocityFilterWeight"in t?t.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:t&&"compositeOperation"in t?t.compositeOperation:this.compositeOperation}}_strokeBegin(t){if(!this.dispatchEvent(new CustomEvent("beginStroke",{detail:t,cancelable:!0})))return;const{addEventListener:r}=this._getListenerFunctions();switch(t.event.type){case"mousedown":r("mousemove",this._handleMouseMove,{passive:!1}),r("mouseup",this._handleMouseUp,{passive:!1});break;case"touchstart":r("touchmove",this._handleTouchMove,{passive:!1}),r("touchend",this._handleTouchEnd,{passive:!1});break;case"pointerdown":r("pointermove",this._handlePointerMove,{passive:!1}),r("pointerup",this._handlePointerUp,{passive:!1});break}this._drawingStroke=!0;const o=this._getPointGroupOptions(),s={...o,points:[]};this._data.push(s),this._reset(o),this._strokeUpdate(t)}_strokeUpdate(t){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(t);return}this.dispatchEvent(new CustomEvent("beforeUpdateStroke",{detail:t}));const n=this._createPoint(t.x,t.y,t.pressure),r=this._data[this._data.length-1],o=r.points,s=o.length>0&&o[o.length-1],c=s?n.distanceTo(s)<=this.minDistance:!1,d=this._getPointGroupOptions(r);if(!s||!(s&&c)){const f=this._addPoint(n,d);s?f&&this._drawCurve(f,d):this._drawDot(n,d),o.push({time:n.time,x:n.x,y:n.y,pressure:n.pressure})}this.dispatchEvent(new CustomEvent("afterUpdateStroke",{detail:t}))}_strokeEnd(t,n=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(n&&this._strokeUpdate(t),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent("endStroke",{detail:t})))}_handlePointerEvents(){this._drawingStroke=!1,this.canvas.addEventListener("pointerdown",this._handlePointerDown,{passive:!1})}_handleMouseEvents(){this._drawingStroke=!1,this.canvas.addEventListener("mousedown",this._handleMouseDown,{passive:!1})}_handleTouchEvents(){this.canvas.addEventListener("touchstart",this._handleTouchStart,{passive:!1})}_reset(t){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(t.minWidth+t.maxWidth)/2,this._ctx.fillStyle=t.penColor,this._ctx.globalCompositeOperation=t.compositeOperation}_createPoint(t,n,r){const o=this.canvas.getBoundingClientRect();return new _p(t-o.left,n-o.top,r,new Date().getTime())}_addPoint(t,n){const{_lastPoints:r}=this;if(r.push(t),r.length>2){r.length===3&&r.unshift(r[0]);const o=this._calculateCurveWidths(r[1],r[2],n),s=XK.fromPoints(r,o);return r.shift(),s}return null}_calculateCurveWidths(t,n,r){const o=r.velocityFilterWeight*n.velocityFrom(t)+(1-r.velocityFilterWeight)*this._lastVelocity,s=this._strokeWidth(o,r),c={end:s,start:this._lastWidth};return this._lastVelocity=o,this._lastWidth=s,c}_strokeWidth(t,n){return Math.max(n.maxWidth/(t+1),n.minWidth)}_drawCurveSegment(t,n,r){const o=this._ctx;o.moveTo(t,n),o.arc(t,n,r,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(t,n){const r=this._ctx,o=t.endWidth-t.startWidth,s=Math.ceil(t.length())*2;r.beginPath(),r.fillStyle=n.penColor;for(let c=0;c<s;c+=1){const d=c/s,f=d*d,p=f*d,m=1-d,g=m*m,y=g*m;let b=y*t.startPoint.x;b+=3*g*d*t.control1.x,b+=3*m*f*t.control2.x,b+=p*t.endPoint.x;let w=y*t.startPoint.y;w+=3*g*d*t.control1.y,w+=3*m*f*t.control2.y,w+=p*t.endPoint.y;const j=Math.min(t.startWidth+p*o,n.maxWidth);this._drawCurveSegment(b,w,j)}r.closePath(),r.fill()}_drawDot(t,n){const r=this._ctx,o=n.dotSize>0?n.dotSize:(n.minWidth+n.maxWidth)/2;r.beginPath(),this._drawCurveSegment(t.x,t.y,o),r.closePath(),r.fillStyle=n.penColor,r.fill()}_fromData(t,n,r){for(const o of t){const{points:s}=o,c=this._getPointGroupOptions(o);if(s.length>1)for(let d=0;d<s.length;d+=1){const f=s[d],p=new _p(f.x,f.y,f.pressure,f.time);d===0&&this._reset(c);const m=this._addPoint(p,c);m&&n(m,c)}else this._reset(c),r(s[0],c)}}toSVG({includeBackgroundColor:t=!1,includeDataUrl:n=!1}={}){const r=this._data,o=Math.max(window.devicePixelRatio||1,1),s=0,c=0,d=this.canvas.width/o,f=this.canvas.height/o,p=document.createElementNS("http://www.w3.org/2000/svg","svg");if(p.setAttribute("xmlns","http://www.w3.org/2000/svg"),p.setAttribute("xmlns:xlink","http://www.w3.org/1999/xlink"),p.setAttribute("viewBox",`${s} ${c} ${d} ${f}`),p.setAttribute("width",d.toString()),p.setAttribute("height",f.toString()),t&&this.backgroundColor){const m=document.createElement("rect");m.setAttribute("width","100%"),m.setAttribute("height","100%"),m.setAttribute("fill",this.backgroundColor),p.appendChild(m)}if(n&&this._dataUrl){const m=this._dataUrlOptions?.ratio||window.devicePixelRatio||1,g=this._dataUrlOptions?.width||this.canvas.width/m,y=this._dataUrlOptions?.height||this.canvas.height/m,b=this._dataUrlOptions?.xOffset||0,w=this._dataUrlOptions?.yOffset||0,j=document.createElement("image");j.setAttribute("x",b.toString()),j.setAttribute("y",w.toString()),j.setAttribute("width",g.toString()),j.setAttribute("height",y.toString()),j.setAttribute("preserveAspectRatio","none"),j.setAttribute("href",this._dataUrl),p.appendChild(j)}return this._fromData(r,(m,{penColor:g})=>{const y=document.createElement("path");if(!isNaN(m.control1.x)&&!isNaN(m.control1.y)&&!isNaN(m.control2.x)&&!isNaN(m.control2.y)){const b=`M ${m.startPoint.x.toFixed(3)},${m.startPoint.y.toFixed(3)} C ${m.control1.x.toFixed(3)},${m.control1.y.toFixed(3)} ${m.control2.x.toFixed(3)},${m.control2.y.toFixed(3)} ${m.endPoint.x.toFixed(3)},${m.endPoint.y.toFixed(3)}`;y.setAttribute("d",b),y.setAttribute("stroke-width",(m.endWidth*2.25).toFixed(3)),y.setAttribute("stroke",g),y.setAttribute("fill","none"),y.setAttribute("stroke-linecap","round"),p.appendChild(y)}},(m,{penColor:g,dotSize:y,minWidth:b,maxWidth:w})=>{const j=document.createElement("circle"),C=y>0?y:(b+w)/2;j.setAttribute("r",C.toString()),j.setAttribute("cx",m.x.toString()),j.setAttribute("cy",m.y.toString()),j.setAttribute("fill",g),p.appendChild(j)}),p.outerHTML}};function tX(e){const t=Re(),{width:n=500,height:r=200,defaultValue:o,who:s,onChange:c,...d}=e,f=v.useRef(null),p=v.useRef(null),m=v.useRef(c);m.current=c,v.useEffect(()=>{function y(){m.current?.({type:[{system:io+"/fhir/signature-type",code:"ProofOfOrigin",display:"Proof of Origin"}],when:new Date().toISOString(),who:s??Wt(t.getProfile()),data:p.current?.toDataURL().split(",")[1]})}if(f.current){const b=new eX(f.current);o?.data&&b.fromDataURL(o.data).catch(console.error),b.addEventListener("endStroke",y),p.current=b}return()=>{p.current&&p.current.removeEventListener("beginStroke",y)}},[t,o,s]);const g=()=>{p.current&&p.current.clear(),m.current?.(void 0)};return a.jsxs(Pr,{withBorder:!0,p:0,w:n,h:r,pos:"relative",...d,children:[a.jsx("canvas",{ref:f,width:n,height:r,"aria-label":"Signature input area"}),a.jsx(Ae,{onClick:g,"aria-label":"Clear signature",pos:"absolute",top:0,right:0,size:"xs",leftSection:a.jsx(Lm,{size:16}),variant:"subtle",color:"gray",children:"Clear"})]})}function oP(e){const t=[...e.context,e.responseItem];return a.jsxs("div",{children:[e.item.text&&a.jsx(Ie,{order:3,mb:"md",children:e.item.text}),a.jsx(Lx,{formState:e.formState,context:t,items:e.item.item??[],responseItems:e.responseItem.item??[]})]},e.item.linkId)}function nX(e){return a.jsxs(a.Fragment,{children:[e.responseItems.map(t=>a.jsx(oP,{formState:e.formState,context:e.context,item:e.item,responseItem:t},`group-${t.id}`)),a.jsx(Mt,{onClick:()=>e.formState.onAddGroup(e.context,e.item),children:`Add Group: ${e.item.text}`})]})}function rX(e){const{formState:t,context:n,item:r,responseItem:o}=e,s=r.type!==Ct.choice&&r.type!==Ct.openChoice,c=o.answer&&o.answer.length>0?o.answer:[{}];return a.jsxs(zt,{htmlFor:e.item.linkId,title:e.item.text,withAsterisk:e.item.required,children:[a.jsx(Ue,{gap:"xs",children:c?.map((d,f)=>a.jsx(Rp,{formState:t,context:n,item:r,responseItem:o,index:f},`${r.linkId}-${f}`))}),s&&a.jsx(Mt,{onClick:()=>t.onAddAnswer(n,r),children:"Add Item"})]},e.item.linkId)}function Lx(e){const{formState:t,context:n,items:r,responseItems:o}=e;return a.jsx(Ue,{children:r.map((s,c)=>{if(!fF(s,t.questionnaireResponse))return null;if(s.type===Ct.display)return a.jsx("p",{children:s.text},`display-${s.id}-${c}`);const d=o.filter(f=>f.linkId===s.linkId);return s.type===Ct.group&&s.repeats?a.jsx(nX,{formState:t,context:n,item:s,responseItems:d},`repeating-group-${s.id}-${c}`):s.type===Ct.group?a.jsx(oP,{formState:t,context:n,item:s,responseItem:d[0]},`group-${s.id}-${c}`):s.type===Ct.boolean?a.jsx(Rp,{formState:t,context:n,item:s,responseItem:d[0],index:0},`boolean-item-${s.id}-${c}`):s.repeats?a.jsx(rX,{formState:t,context:n,item:s,responseItem:d[0]},`repeating-item-${s.id}-${c}`):a.jsx(zt,{htmlFor:s.linkId,title:s.text,withAsterisk:s.required,children:a.jsx(Rp,{formState:t,context:n,item:s,responseItem:d[0],index:0})},`repeating-item-${s.id}-${c}`)})})}function iX(e){const{formState:t,submitButtonText:n,excludeButtons:r,children:o}=e,s=t.pages,c=t.activePage,d=c>0,f=c<s.length-1,p=c===s.length-1;return a.jsxs(a.Fragment,{children:[a.jsx(zc,{active:c,allowNextStepsSelect:!1,p:6,children:s.map((m,g)=>a.jsx(zc.Step,{label:m.title,children:g===c&&o},m.linkId))}),!r&&a.jsxs(xe,{justify:"flex-end",mt:"xl",gap:"xs",children:[d&&a.jsx(Ae,{onClick:t.onPrevPage,children:"Back"}),f&&a.jsx(Ae,{onClick:m=>{m.currentTarget.closest("form").reportValidity()&&t.onNextPage()},children:"Next"}),p&&a.jsx(wr,{children:n??"Submit"})]})]})}function aP(e){const t=Re(),[n,r]=v.useState(!1),o=v.useRef(e);o.current=e;const s=v.useCallback(g=>{r(!1),o.current.onChange?.(g)},[]),c=EF({questionnaire:e.questionnaire,defaultValue:e.questionnaireResponse,subject:e.subject,encounter:e.encounter,source:e.source,disablePagination:e.disablePagination,onChange:s}),d=v.useRef(c);d.current=c;const f=v.useMemo(()=>c.loading?!1:!!Lo(c.questionnaire,uF),[c]),p=v.useMemo(()=>c.loading?!1:!!c.questionnaireResponse.extension?.find(g=>g.url===Xh),[c]),m=v.useCallback(()=>{const g=d.current;if(g.loading)return;const y=o.current.onSubmit;if(!y)return;if(f&&!p){r(!0);return}const b=g.questionnaire,w=g.questionnaireResponse,j=o.current.subject;let C=o.current.source;if(!C){const R=t.getProfile();R&&(C=Wt(R))}y({...w,questionnaire:b.url??Ot(b),subject:j,source:C,authored:new Date().toISOString(),status:"completed"})},[t,f,p]);return c.loading?null:a.jsxs(mt,{testid:"questionnaire-form",onSubmit:m,children:[c.questionnaire.title&&a.jsx(Ie,{children:c.questionnaire.title}),c.pagination?a.jsx(iX,{formState:c,submitButtonText:e.submitButtonText,excludeButtons:e.excludeButtons,children:a.jsx(Lx,{formState:c,context:[],items:c.items,responseItems:c.responseItems})}):a.jsxs(a.Fragment,{children:[a.jsx(Lx,{formState:c,context:[],items:c.items,responseItems:c.responseItems}),f&&a.jsxs(Ue,{mt:"md",gap:0,children:[a.jsx(Te,{size:"sm",fw:500,children:"Signature"}),a.jsx(tX,{onChange:c.onChangeSignature}),!p&&n&&a.jsx(Te,{c:"red",size:"sm",children:"Signature is required."})]}),!e.excludeButtons&&a.jsx(xe,{justify:"flex-end",mt:"xl",gap:"xs",children:a.jsx(wr,{children:e.submitButtonText??"Submit"})})]})]})}const oX="_section_4m5it_1",aX={section:oX},sX=["gender","age","gestationalAge","context","appliesTo","category"],lX={definition:{resourceType:"ObservationDefinition",code:{text:""}},onSubmit:()=>{}};function cX(e){e=Object.assign(lX,e);const t=e.definition,[n,r]=v.useState([]),[o,s]=v.useState(1),[c,d]=v.useState(1);return v.useEffect(()=>{const w=fX(t,d);r(hX(w.qualifiedInterval||[],s))},[t]),a.jsxs(mt,{testid:"reference-range-editor",onSubmit:f,children:[a.jsx(Ue,{children:n.map(w=>a.jsx(uX,{unit:mX(t.quantitativeDetails?.unit),onChange:g,onAdd:y,onRemove:b,onRemoveGroup:m,intervalGroup:w},`group-${w.id}`))}),a.jsx(Rn,{title:"Add Group",variant:"subtle",size:"sm",onClick:w=>{pn(w),p({id:`group-id-${o}`,filters:{},intervals:[]}),s(j=>j+1)},children:a.jsx(Sp,{})}),a.jsx(xe,{justify:"flex-end",children:a.jsx(wr,{children:"Save"})})]});function f(){const w=n.flatMap(j=>j.intervals).filter(j=>!gX(j));e.onSubmit({...t,qualifiedInterval:w})}function p(w){r(j=>[...j,w])}function m(w){r(j=>j.filter(C=>C.id!==w.id))}function g(w,j){r(C=>{C=[...C];const R=C.find(E=>E.id===w),T=R?.intervals.findIndex(E=>E.id===j.id);return T!==void 0&&R?.intervals[T]&&(R.intervals[T]=j),C})}function y(w,j){j.id===void 0&&(j.id=`id-${c}`,d(C=>C+1)),r(C=>{C=[...C];const R=C.findIndex(T=>T.id===w);if(R!==-1){const T={...C[R]};j={...j,...T.filters},T.intervals=[...T.intervals,j],C[R]=T}return C})}function b(w,j){r(C=>{C=[...C];const R=C.find(T=>T.id===w);return R&&(R.intervals=R.intervals.filter(T=>T.id!==j.id)),C})}}function uX(e){const{intervalGroup:t,unit:n}=e;return a.jsx(ru,{"data-testid":t.id,className:aX.section,children:a.jsxs(Ue,{gap:"lg",children:[a.jsx(xe,{justify:"flex-end",children:a.jsx(Rn,{title:"Remove Group",variant:"subtle","data-testid":`remove-group-button-${t.id}`,size:"sm",onClick:r=>{pn(r),e.onRemoveGroup(t)},children:a.jsx(bp,{})},`remove-group-button-${t.id}`)}),a.jsx(dX,{intervalGroup:t,onChange:e.onChange}),a.jsx(Tn,{}),t.intervals.map(r=>a.jsxs(Ue,{gap:"xs",children:[a.jsxs(xe,{children:[a.jsx(Fe,{"data-testid":`condition-${r.id}`,defaultValue:r.condition,label:"Condition: ",size:"sm",onChange:o=>{pn(o),e.onChange(t.id,{...r,condition:o.currentTarget.value.trim()})}},`condition-${r.id}`),a.jsx(Rn,{title:"Remove Interval",variant:"subtle",size:"sm","data-testid":`remove-interval-${r.id}`,onClick:o=>{pn(o),e.onRemove(t.id,r)},children:a.jsx(bp,{})},`remove-interval-${r.id}`)]}),a.jsx(pS,{path:"",onChange:o=>{e.onChange(t.id,{...r,range:o})},name:`range-${r.id}`,defaultValue:r.range},`range-${r.id}`)]},`interval-${r.id}`)),a.jsx(Rn,{title:"Add Interval",variant:"subtle",size:"sm",onClick:r=>{pn(r),e.onAdd(t.id,{range:{low:{unit:n},high:{unit:n}}})},children:a.jsx(Sp,{})})]})})}function dX(e){const{intervalGroup:t,onChange:n}=e;t.filters.age||(t.filters.age={});for(const r of["low","high"])t.filters.age[r]?.unit||(t.filters.age[r]={...t.filters.age[r],unit:"years",system:"http://unitsofmeasure.org"});return a.jsxs(Ue,{style:{maxWidth:"50%"},children:[a.jsx(xe,{children:a.jsx(un,{data:["","male","female"],label:"Gender:",defaultValue:t.filters.gender||"",onChange:r=>{for(const o of t.intervals){let s=r.currentTarget.value;s===""&&(s=void 0),n(t.id,{...o,gender:s})}}})}),a.jsxs(xe,{gap:"xs",children:[a.jsx(Te,{component:"label",htmlFor:`div-age-${t.id}`,children:"Age:"}),a.jsx("div",{id:`div-age-${t.id}`,children:a.jsx(pS,{path:"",name:`age-${t.id}`,defaultValue:t.filters.age,onChange:r=>{for(const o of t.intervals)n(t.id,{...o,age:r})}},`age-${t.id}`)})]}),a.jsx(un,{data:["","pre-puberty","follicular","midcycle","luteal","postmenopausal"],label:"Endocrine:",defaultValue:t.filters.context?.text||"",onChange:r=>{for(const o of t.intervals){let s=r.currentTarget.value;s===""?(s=void 0,n(t.id,{...o,context:void 0})):n(t.id,{...o,context:{text:s,coding:[{code:s,system:"http://terminology.hl7.org/CodeSystem/referencerange-meaning"}]}})}}}),a.jsx(un,{data:["","reference","critical","absolute"],label:"Category: ",defaultValue:t.filters.category,onChange:r=>{for(const o of t.intervals){const s=r.currentTarget.value;s===""?n(t.id,{...o,category:void 0}):n(t.id,{...o,category:s})}}})]})}function fX(e,t){const n=e.qualifiedInterval||[];let r=Math.max(...n.map(o=>{const s=Number.parseInt(o.id?.substring(3)||"",10);return Number.isNaN(s)?Number.NEGATIVE_INFINITY:s}))+1;return Number.isFinite(r)||(r=1),e={...e,qualifiedInterval:n.map(o=>({...o,id:o.id||`id-${r++}`}))},t(r),e}function hX(e,t){let n=1;const r={};for(const o of e){const s=pX(o);s in r||(r[s]={id:`group-id-${n++}`,filters:Object.fromEntries(sX.map(c=>[c,o[c]])),intervals:[]}),r[s].intervals.push(o)}return t(n),Object.values(r)}function pX(e){return[`gender=${e.gender}`,`age=${wd(e.age)}`,`gestationalAge=${wd(e.gestationalAge)}`,`context=${e.context?.text}`,`appliesTo=${e.appliesTo?.map(n=>n.text).join("+")}`,`category=${e.category}`].join(":")}function mX(e){return e&&(xU(e,"http://unitsofmeasure.org")||e.text)}function gX(e){return e.range?.low?.value===void 0&&e.range?.high?.value===void 0}function vX(e){const t=Re(),n=Kt(e.value),[r,o]=v.useState(!1),[s,c]=v.useState();if(v.useEffect(()=>{n&&!r&&(t.executeBatch(d(n)).then(c).catch(console.log),o(!0))},[t,n,r]),!n||!s)return null;return a.jsx(br,{children:n.action?.map((p,m)=>{const g=p.resource&&f(p.resource),y=g?.input?.[0]?.valueReference,b=g?.output?.[0]?.valueReference;return a.jsxs(v.Fragment,{children:[a.jsx(br.Col,{span:1,p:"md",children:g?.status==="completed"?a.jsx(uH,{}):a.jsx(Dq,{color:"gray"})}),a.jsxs(br.Col,{span:9,p:"xs",children:[a.jsx(Te,{fw:500,children:p.title}),p.description&&a.jsx("div",{children:p.description}),a.jsxs("div",{children:["Last edited by ",a.jsx(Tl,{value:g?.meta?.author})," on ",Sr(g?.meta?.lastUpdated)]}),a.jsxs("div",{children:["Status: ",a.jsx($m,{status:g?.status||"unknown"})]})]}),a.jsxs(br.Col,{span:2,p:"md",children:[y&&!b&&a.jsx(Ae,{onClick:()=>e.onStart(g,y),children:"Start"}),y&&b&&a.jsx(Ae,{onClick:()=>e.onEdit(g,y,b),children:"Edit"})]})]},`action-${m}`)})});function d(p){const m=[];if(p.action)for(const g of p.action)g.resource?.reference&&m.push({request:{method:"GET",url:g.resource.reference}});return{resourceType:"Bundle",type:"batch",entry:m}}function f(p){for(const m of s?.entry??[])if(m.resource&&p.reference===Ot(m.resource))return m.resource}}function sP(e,t){const n=yX(e,t);return xX(n,e,t)}function yX(e,t){const n=e.length,r=t.length,o=n+r+1,s=1+2*o,c=Math.trunc(s/2),d=new Array(s);d[c+1]={i:0,j:-1,prev:void 0,snake:!0};for(let f=0;f<o;f++){for(let p=-f;p<=f;p+=2){const m=c+p,g=m+1,y=m-1,b=d[g],w=d[y];let j,C=0;p===-f||p!==f&&w.i<b.i?(C=b.i,j=b):(C=w.i+1,j=w),d[y]=void 0;let R=C-p,T={i:C,j:R,prev:bX(j),snake:!1};for(;C<n&&R<r&&e[C]===t[R];)C++,R++;if(C>T.i&&(T={i:C,j:R,prev:T,snake:!0}),d[m]=T,C>=n&&R>=r)return d[m]}d[c+f-1]=void 0}}function xX(e,t,n){const r=[];let o=e;for(o.snake&&(o=o.prev);o?.prev&&o.prev.j>=0;){const s=o.i,c=o.j;o=o.prev;const d=o.i,f=o.j,p={position:d,lines:t.slice(d,s)},m={position:f,lines:n.slice(f,c)};let g;p.lines.length===0&&m.lines.length>0?g="insert":p.lines.length>0&&m.lines.length===0?g="delete":g="change",r.push({original:p,revised:m,type:g}),o.snake&&(o=o.prev)}return r}function bX(e){return e&&!e.snake&&e.prev?e.prev:e}function SX(e){const t=(e.entry??[]).filter(r=>!!r.resource).map(r=>({meta:r.resource?.meta,lines:no(r.resource,!0).match(/[^\r\n]+/g)})).sort((r,o)=>r.meta.lastUpdated.localeCompare(o.meta.lastUpdated));if(!t.length)return[];const n=t[0].lines.map(r=>({id:t[0].meta.versionId,meta:t[0].meta,value:r,span:1}));return wX(n,t),jX(n),n}function wX(e,t){for(let n=1;n<t.length;n++){const r=sP(t[n-1].lines,t[n].lines);for(const o of r){const s=o.original.position,c=o.original.lines,d=o.revised.lines;if((o.type==="delete"||o.type==="change")&&e.splice(s,c.length),o.type==="insert"||o.type==="change")for(let f=0;f<o.revised.lines.length;f++)e.splice(s+f,0,{id:t[n].meta.versionId,meta:t[n].meta,value:d[f],span:1})}}}function jX(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 CX="_container_1tyf3_1",EX="_root_1tyf3_5",TX="_startRow_1tyf3_20",RX="_normalRow_1tyf3_25",_X="_author_1tyf3_30",DX="_dateTime_1tyf3_34",AX="_lineNumber_1tyf3_40",kX="_line_1tyf3_40",PX="_pre_1tyf3_55",ca={container:CX,root:EX,startRow:TX,normalRow:RX,author:_X,dateTime:DX,lineNumber:AX,line:kX,pre:PX};function NX(e,t){return`/${e.resourceType}/${e.id}/_history/${t}`}function OX(e){const t=Math.floor((Date.now()-Date.parse(e))/1e3),n=Math.floor(t/31536e3);if(n>0)return bc(n,"year");const r=Math.floor(t/2592e3);if(r>0)return bc(r,"month");const o=Math.floor(t/86400);if(o>0)return bc(o,"day");const s=Math.floor(t/3600);if(s>0)return bc(s,"hour");const c=Math.floor(t/60);return c>0?bc(c,"minute"):bc(t,"second")}function bc(e,t){return`${e} ${e===1?t:t+"s"} ago`}function MX(e){const t=Re(),[n,r]=v.useState(e.history);if(v.useEffect(()=>{!e.history&&e.resourceType&&e.id&&t.readHistory(e.resourceType,e.id).then(r).catch(console.log)},[t,e.history,e.resourceType,e.id]),!n)return a.jsx("div",{children:"Loading..."});const o=n.entry?.[0]?.resource;if(!o)return null;const s=SX(n);return a.jsx("div",{className:ca.container,children:a.jsx("table",{className:ca.root,children:a.jsx("tbody",{children:s.map((c,d)=>a.jsxs("tr",{className:c.span>0?ca.startRow:ca.normalRow,children:[c.span>0&&a.jsxs(a.Fragment,{children:[a.jsx("td",{className:ca.author,rowSpan:c.span,children:a.jsx(Tl,{value:c.meta.author,link:!0,fz:"xs"})}),a.jsx("td",{className:ca.dateTime,rowSpan:c.span,children:a.jsx(St,{to:NX(o,c.meta.versionId),fz:"xs",children:OX(c.meta.lastUpdated)})})]}),a.jsx("td",{className:ca.lineNumber,children:d+1}),a.jsx("td",{className:ca.line,children:a.jsx("pre",{className:ca.pre,children:c.value})})]},"row-"+d))})})})}const LX="_removed_el5zk_1",IX="_added_el5zk_6",JT={removed:LX,added:IX};function zX(e){let t=e.original,n=e.revised;e.ignoreMeta&&(t={...t,meta:void 0},n={...n,meta:void 0});const r=no(t,!0).match(/[^\r\n]+/g),o=no(n,!0).match(/[^\r\n]+/g),s=sP(r,o);return a.jsx("pre",{style:{color:"gray"},children:s.map((c,d)=>a.jsx($X,{delta:c},"delta"+d))})}function $X(e){return a.jsxs(a.Fragment,{children:["...",a.jsx("br",{}),e.delta.original.lines.length>0&&a.jsx("div",{className:JT.removed,children:e.delta.original.lines.join(`
170
- `)}),e.delta.revised.lines.length>0&&a.jsx("div",{className:JT.added,children:e.delta.revised.lines.join(`
171
- `)}),"...",a.jsx("br",{})]})}const UX="_splitButton_1i0gi_1",BX="_menuControl_1i0gi_6",ZT={splitButton:UX,menuControl:BX};function Dp(e){const{outcome:t}=e,n=Re(),r=Kt(e.defaultValue),o=r?.resourceType,[s,c]=v.useState(!1),[d,f]=v.useState(),p=n.getAccessPolicy(),m=jn();v.useEffect(()=>{if(r)if(e.profileUrl){const b=e.profileUrl;n.requestProfileSchema(e.profileUrl,{expandProfile:!0}).then(()=>{const w=tu(b);if(w){c(!0);const j=HV(r,w);f(j)}else console.error(`Schema not found for ${b}`)}).catch(w=>{console.error("Error in requestProfileSchema",w)})}else n.requestSchema(o).then(()=>{f(r),c(!0)}).catch(console.log)},[n,r,o,e.profileUrl]);const g=v.useMemo(()=>r&&NA(r,Zs.READ,p),[p,r]),y=v.useMemo(()=>n.isSuperAdmin()||!p||!Pn(d?.resourceType)?!0:GB(p,d?.resourceType),[n,p,d?.resourceType]);return!s||!d?a.jsx("div",{children:"Loading..."}):y?a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:b=>{b.preventDefault(),e.onSubmit&&e.onSubmit(d)},children:[a.jsxs(Ue,{mb:"xl",children:[a.jsx(zt,{title:"Resource Type",htmlFor:"resourceType",outcome:t,children:a.jsx(Fe,{name:"resourceType",defaultValue:d.resourceType,disabled:!0})}),a.jsx(zt,{title:"ID",htmlFor:"id",outcome:t,children:a.jsx(Fe,{name:"id",defaultValue:d.id,disabled:!0})})]}),a.jsx(vS,{path:d.resourceType,valuePath:d.resourceType,typeName:o,defaultValue:d,outcome:t,onChange:f,profileUrl:e.profileUrl,accessPolicyResource:g}),a.jsxs(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",gap:0,children:[a.jsx(Ae,{type:"submit",className:$t((e.onPatch||e.onDelete)&&ZT.splitButton),children:r?.id?"Update":"Create"}),(e.onPatch||e.onDelete)&&a.jsxs(we,{transitionProps:{transition:"pop"},position:"bottom-end",withinPortal:!0,children:[a.jsx(we.Target,{children:a.jsx(Rn,{variant:"filled",color:m.primaryColor,size:36,className:ZT.menuControl,"aria-label":"More actions",children:a.jsx(tS,{size:14,stroke:1.5})})}),a.jsxs(we.Dropdown,{children:[e.onPatch&&a.jsx(we.Item,{leftSection:a.jsx(ik,{size:14,stroke:1.5}),onClick:()=>{e.onPatch(d)},children:"Patch"}),e.onDelete&&a.jsx(we.Item,{color:"red",leftSection:a.jsx(Lm,{size:14,stroke:1.5,color:"red"}),onClick:()=>{e.onDelete(d)},children:"Delete"})]})]})]})]}):a.jsxs(Mo,{color:"red",title:"Permission denied",icon:a.jsx(bs,{}),children:["Your access level prevents you from editing and creating ",d.resourceType," resources."]})}function VX(e){const t=Re(),[n,r]=v.useState(e.history);return v.useEffect(()=>{!e.history&&e.resourceType&&e.id&&t.readHistory(e.resourceType,e.id).then(r).catch(console.log)},[t,e.history,e.resourceType,e.id]),n?a.jsxs(ce,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[a.jsx(ce.Thead,{children:a.jsxs(ce.Tr,{children:[a.jsx(ce.Th,{children:"Author"}),a.jsx(ce.Th,{children:"Date"}),a.jsx(ce.Th,{children:"Version"})]})}),a.jsx(ce.Tbody,{children:n.entry?.map((o,s)=>a.jsx(FX,{entry:o},"entry-"+s))})]}):a.jsx("div",{children:"Loading..."})}function FX(e){const{response:t,resource:n}=e.entry;return n?a.jsxs(ce.Tr,{children:[a.jsx(ce.Td,{children:a.jsx(Ac,{value:n.meta?.author,link:!0})}),a.jsx(ce.Td,{children:Sr(n.meta?.lastUpdated)}),a.jsx(ce.Td,{children:a.jsx(St,{to:HX(n),children:n.meta?.versionId})})]}):a.jsx(ce.Tr,{children:a.jsx(ce.Td,{colSpan:3,children:Ge(t?.outcome)})})}function HX(e){return`/${e.resourceType}/${e.id}/_history/${e.meta?.versionId}`}function qX(e){const{serviceRequest:t,...n}=e;return a.jsx(Um,{value:t,loadTimelineResources:async(r,o,s)=>{const c=`${o}/${s}`,d=100;return Promise.allSettled([r.readHistory("ServiceRequest",s),r.search("Communication",{"based-on":c,_count:d}),r.search("DiagnosticReport",{"based-on":c,_count:d}),r.search("Media",{"based-on":c,_count:d}),r.search("DocumentReference",{related:c,_count:d}),r.search("Task",{_filter:`based-on eq ${c} or focus eq ${c} or subject eq ${c}`,_count:d})])},createCommunication:(r,o,s)=>({resourceType:"Communication",status:"completed",basedOn:[Wt(r)],subject:r.subject,sender:Wt(o),sent:new Date().toISOString(),payload:[{contentString:s}]}),createMedia:(r,o,s)=>({resourceType:"Media",status:"completed",basedOn:[Wt(r)],subject:r.subject,operator:Wt(o),issued:new Date().toISOString(),content:s}),...n})}function GX(e){const t=Re(),{client:n,patient:r,encounter:o,children:s,...c}=e;function d(){t.createResource({resourceType:"SmartAppLaunch",patient:r,encounter:o}).then(f=>{const p=new URL(n.launchUri);p.searchParams.set("iss",$0(t.fhirUrl().toString())),p.searchParams.set("launch",f.id),rr.assign(p.toString())}).catch(f=>ke({color:"red",message:Ge(f),autoClose:!1}))}return a.jsx(Mt,{onClick:()=>d(),...c,children:s})}var Uy={exports:{}},ed={},By={exports:{}},Vy={};var eR;function WX(){return eR||(eR=1,(function(e){function t(M,I){var z=M.length;M.push(I);e:for(;0<z;){var F=z-1>>>1,X=M[F];if(0<o(X,I))M[F]=I,M[z]=X,z=F;else break e}}function n(M){return M.length===0?null:M[0]}function r(M){if(M.length===0)return null;var I=M[0],z=M.pop();if(z!==I){M[0]=z;e:for(var F=0,X=M.length,O=X>>>1;F<O;){var H=2*(F+1)-1,oe=M[H],ue=H+1,Se=M[ue];if(0>o(oe,z))ue<X&&0>o(Se,oe)?(M[F]=Se,M[ue]=z,F=ue):(M[F]=oe,M[H]=z,F=H);else if(ue<X&&0>o(Se,z))M[F]=Se,M[ue]=z,F=ue;else break e}}return I}function o(M,I){var z=M.sortIndex-I.sortIndex;return z!==0?z:M.id-I.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var s=performance;e.unstable_now=function(){return s.now()}}else{var c=Date,d=c.now();e.unstable_now=function(){return c.now()-d}}var f=[],p=[],m=1,g=null,y=3,b=!1,w=!1,j=!1,C=!1,R=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function _(M){for(var I=n(p);I!==null;){if(I.callback===null)r(p);else if(I.startTime<=M)r(p),I.sortIndex=I.expirationTime,t(f,I);else break;I=n(p)}}function k(M){if(j=!1,_(M),!w)if(n(f)!==null)w=!0,L||(L=!0,J());else{var I=n(p);I!==null&&W(k,I.startTime-M)}}var L=!1,A=-1,N=5,U=-1;function B(){return C?!0:!(e.unstable_now()-U<N)}function Q(){if(C=!1,L){var M=e.unstable_now();U=M;var I=!0;try{e:{w=!1,j&&(j=!1,T(A),A=-1),b=!0;var z=y;try{t:{for(_(M),g=n(f);g!==null&&!(g.expirationTime>M&&B());){var F=g.callback;if(typeof F=="function"){g.callback=null,y=g.priorityLevel;var X=F(g.expirationTime<=M);if(M=e.unstable_now(),typeof X=="function"){g.callback=X,_(M),I=!0;break t}g===n(f)&&r(f),_(M)}else r(f);g=n(f)}if(g!==null)I=!0;else{var O=n(p);O!==null&&W(k,O.startTime-M),I=!1}}break e}finally{g=null,y=z,b=!1}I=void 0}}finally{I?J():L=!1}}}var J;if(typeof E=="function")J=function(){E(Q)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,$=Z.port2;Z.port1.onmessage=Q,J=function(){$.postMessage(null)}}else J=function(){R(Q,0)};function W(M,I){A=R(function(){M(e.unstable_now())},I)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(M){M.callback=null},e.unstable_forceFrameRate=function(M){0>M||125<M?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<M?Math.floor(1e3/M):5},e.unstable_getCurrentPriorityLevel=function(){return y},e.unstable_next=function(M){switch(y){case 1:case 2:case 3:var I=3;break;default:I=y}var z=y;y=I;try{return M()}finally{y=z}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(M,I){switch(M){case 1:case 2:case 3:case 4:case 5:break;default:M=3}var z=y;y=M;try{return I()}finally{y=z}},e.unstable_scheduleCallback=function(M,I,z){var F=e.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?F+z:F):z=F,M){case 1:var X=-1;break;case 2:X=250;break;case 5:X=1073741823;break;case 4:X=1e4;break;default:X=5e3}return X=z+X,M={id:m++,callback:I,priorityLevel:M,startTime:z,expirationTime:X,sortIndex:-1},z>F?(M.sortIndex=z,t(p,M),n(f)===null&&M===n(p)&&(j?(T(A),A=-1):j=!0,W(k,z-F))):(M.sortIndex=X,t(f,M),w||b||(w=!0,L||(L=!0,J()))),M},e.unstable_shouldYield=B,e.unstable_wrapCallback=function(M){var I=y;return function(){var z=y;y=I;try{return M.apply(this,arguments)}finally{y=z}}}})(Vy)),Vy}var tR;function QX(){return tR||(tR=1,By.exports=WX()),By.exports}var nR;function YX(){if(nR)return ed;nR=1;var e=QX(),t=Xx(),n=R2();function r(i){var l="https://react.dev/errors/"+i;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)l+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+i+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function s(i){var l=i,u=i;if(i.alternate)for(;l.return;)l=l.return;else{i=l;do l=i,(l.flags&4098)!==0&&(u=l.return),i=l.return;while(i)}return l.tag===3?u:null}function c(i){if(i.tag===13){var l=i.memoizedState;if(l===null&&(i=i.alternate,i!==null&&(l=i.memoizedState)),l!==null)return l.dehydrated}return null}function d(i){if(i.tag===31){var l=i.memoizedState;if(l===null&&(i=i.alternate,i!==null&&(l=i.memoizedState)),l!==null)return l.dehydrated}return null}function f(i){if(s(i)!==i)throw Error(r(188))}function p(i){var l=i.alternate;if(!l){if(l=s(i),l===null)throw Error(r(188));return l!==i?null:i}for(var u=i,h=l;;){var x=u.return;if(x===null)break;var S=x.alternate;if(S===null){if(h=x.return,h!==null){u=h;continue}break}if(x.child===S.child){for(S=x.child;S;){if(S===u)return f(x),i;if(S===h)return f(x),l;S=S.sibling}throw Error(r(188))}if(u.return!==h.return)u=x,h=S;else{for(var D=!1,P=x.child;P;){if(P===u){D=!0,u=x,h=S;break}if(P===h){D=!0,h=x,u=S;break}P=P.sibling}if(!D){for(P=S.child;P;){if(P===u){D=!0,u=S,h=x;break}if(P===h){D=!0,h=S,u=x;break}P=P.sibling}if(!D)throw Error(r(189))}}if(u.alternate!==h)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?i:l}function m(i){var l=i.tag;if(l===5||l===26||l===27||l===6)return i;for(i=i.child;i!==null;){if(l=m(i),l!==null)return l;i=i.sibling}return null}var g=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),E=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),k=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),N=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),Q=Symbol.iterator;function J(i){return i===null||typeof i!="object"?null:(i=Q&&i[Q]||i["@@iterator"],typeof i=="function"?i:null)}var Z=Symbol.for("react.client.reference");function $(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===Z?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case j:return"Fragment";case R:return"Profiler";case C:return"StrictMode";case k:return"Suspense";case L:return"SuspenseList";case U:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case w:return"Portal";case E:return i.displayName||"Context";case T:return(i._context.displayName||"Context")+".Consumer";case _:var l=i.render;return i=i.displayName,i||(i=l.displayName||l.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case A:return l=i.displayName||null,l!==null?l:$(i.type)||"Memo";case N:l=i._payload,i=i._init;try{return $(i(l))}catch{}}return null}var W=Array.isArray,M=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},F=[],X=-1;function O(i){return{current:i}}function H(i){0>X||(i.current=F[X],F[X]=null,X--)}function oe(i,l){X++,F[X]=i.current,i.current=l}var ue=O(null),Se=O(null),ge=O(null),Pe=O(null);function rt(i,l){switch(oe(ge,l),oe(Se,i),oe(ue,null),l.nodeType){case 9:case 11:i=(i=l.documentElement)&&(i=i.namespaceURI)?Xj(i):0;break;default:if(i=l.tagName,l=l.namespaceURI)l=Xj(l),i=Jj(l,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}H(ue),oe(ue,i)}function Ce(){H(ue),H(Se),H(ge)}function ht(i){i.memoizedState!==null&&oe(Pe,i);var l=ue.current,u=Jj(l,i.type);l!==u&&(oe(Se,i),oe(ue,u))}function lt(i){Se.current===i&&(H(ue),H(Se)),Pe.current===i&&(H(Pe),Hu._currentValue=z)}var vt,it;function wt(i){if(vt===void 0)try{throw Error()}catch(u){var l=u.stack.trim().match(/\n( *(at )?)/);vt=l&&l[1]||"",it=-1<u.stack.indexOf(`
172
- at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
173
- `+vt+i+it}var pt=!1;function It(i,l){if(!i||pt)return"";pt=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(l){var ye=function(){throw Error()};if(Object.defineProperty(ye.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ye,[])}catch(se){var re=se}Reflect.construct(i,[],ye)}else{try{ye.call()}catch(se){re=se}i.call(ye.prototype)}}else{try{throw Error()}catch(se){re=se}(ye=i())&&typeof ye.catch=="function"&&ye.catch(function(){})}}catch(se){if(se&&re&&typeof se.stack=="string")return[se.stack,re.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var x=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");x&&x.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var S=h.DetermineComponentFrameRoot(),D=S[0],P=S[1];if(D&&P){var q=D.split(`
174
- `),te=P.split(`
175
- `);for(x=h=0;h<q.length&&!q[h].includes("DetermineComponentFrameRoot");)h++;for(;x<te.length&&!te[x].includes("DetermineComponentFrameRoot");)x++;if(h===q.length||x===te.length)for(h=q.length-1,x=te.length-1;1<=h&&0<=x&&q[h]!==te[x];)x--;for(;1<=h&&0<=x;h--,x--)if(q[h]!==te[x]){if(h!==1||x!==1)do if(h--,x--,0>x||q[h]!==te[x]){var fe=`
176
- `+q[h].replace(" at new "," at ");return i.displayName&&fe.includes("<anonymous>")&&(fe=fe.replace("<anonymous>",i.displayName)),fe}while(1<=h&&0<=x);break}}}finally{pt=!1,Error.prepareStackTrace=u}return(u=i?i.displayName||i.name:"")?wt(u):""}function _e(i,l){switch(i.tag){case 26:case 27:case 5:return wt(i.type);case 16:return wt("Lazy");case 13:return i.child!==l&&l!==null?wt("Suspense Fallback"):wt("Suspense");case 19:return wt("SuspenseList");case 0:case 15:return It(i.type,!1);case 11:return It(i.type.render,!1);case 1:return It(i.type,!0);case 31:return wt("Activity");default:return""}}function Ee(i){try{var l="",u=null;do l+=_e(i,u),u=i,i=i.return;while(i);return l}catch(h){return`
177
- Error generating stack: `+h.message+`
178
- `+h.stack}}var Le=Object.prototype.hasOwnProperty,Ne=e.unstable_scheduleCallback,ct=e.unstable_cancelCallback,et=e.unstable_shouldYield,at=e.unstable_requestPaint,ve=e.unstable_now,pe=e.unstable_getCurrentPriorityLevel,Oe=e.unstable_ImmediatePriority,tt=e.unstable_UserBlockingPriority,Tt=e.unstable_NormalPriority,Cn=e.unstable_LowPriority,gn=e.unstable_IdlePriority,$n=e.log,Wn=e.unstable_setDisableYieldValue,Un=null,Dn=null;function Zn(i){if(typeof $n=="function"&&Wn(i),Dn&&typeof Dn.setStrictMode=="function")try{Dn.setStrictMode(Un,i)}catch{}}var Nn=Math.clz32?Math.clz32:Zr,Uo=Math.log,ao=Math.LN2;function Zr(i){return i>>>=0,i===0?32:31-(Uo(i)/ao|0)|0}var Bo=256,$i=262144,so=4194304;function Ir(i){var l=i&42;if(l!==0)return l;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function mr(i,l,u){var h=i.pendingLanes;if(h===0)return 0;var x=0,S=i.suspendedLanes,D=i.pingedLanes;i=i.warmLanes;var P=h&134217727;return P!==0?(h=P&~S,h!==0?x=Ir(h):(D&=P,D!==0?x=Ir(D):u||(u=P&~i,u!==0&&(x=Ir(u))))):(P=h&~S,P!==0?x=Ir(P):D!==0?x=Ir(D):u||(u=h&~i,u!==0&&(x=Ir(u)))),x===0?0:l!==0&&l!==x&&(l&S)===0&&(S=x&-x,u=l&-l,S>=u||S===32&&(u&4194048)!==0)?l:x}function Ui(i,l){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&l)===0}function Qn(i,l){switch(i){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Vo(){var i=so;return so<<=1,(so&62914560)===0&&(so=4194304),i}function Cs(i){for(var l=[],u=0;31>u;u++)l.push(i);return l}function Fo(i,l){i.pendingLanes|=l,l!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function au(i,l,u,h,x,S){var D=i.pendingLanes;i.pendingLanes=u,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=u,i.entangledLanes&=u,i.errorRecoveryDisabledLanes&=u,i.shellSuspendCounter=0;var P=i.entanglements,q=i.expirationTimes,te=i.hiddenUpdates;for(u=D&~u;0<u;){var fe=31-Nn(u),ye=1<<fe;P[fe]=0,q[fe]=-1;var re=te[fe];if(re!==null)for(te[fe]=null,fe=0;fe<re.length;fe++){var se=re[fe];se!==null&&(se.lane&=-536870913)}u&=~ye}h!==0&&V(i,h,0),S!==0&&x===0&&i.tag!==0&&(i.suspendedLanes|=S&~(D&~l))}function V(i,l,u){i.pendingLanes|=l,i.suspendedLanes&=~l;var h=31-Nn(l);i.entangledLanes|=l,i.entanglements[h]=i.entanglements[h]|1073741824|u&261930}function Y(i,l){var u=i.entangledLanes|=l;for(i=i.entanglements;u;){var h=31-Nn(u),x=1<<h;x&l|i[h]&l&&(i[h]|=l),u&=~x}}function ie(i,l){var u=l&-l;return u=(u&42)!==0?1:je(u),(u&(i.suspendedLanes|l))!==0?0:u}function je(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function De(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function We(){var i=I.p;return i!==0?i:(i=window.event,i===void 0?32:SC(i.type))}function Ke(i,l){var u=I.p;try{return I.p=i,l()}finally{I.p=u}}var Be=Math.random().toString(36).slice(2),Me="__reactFiber$"+Be,Ve="__reactProps$"+Be,Qe="__reactContainer$"+Be,Ze="__reactEvents$"+Be,Et="__reactListeners$"+Be,nt="__reactHandles$"+Be,fn="__reactResources$"+Be,hn="__reactMarker$"+Be;function qt(i){delete i[Me],delete i[Ve],delete i[Ze],delete i[Et],delete i[nt]}function Ut(i){var l=i[Me];if(l)return l;for(var u=i.parentNode;u;){if(l=u[Qe]||u[Me]){if(u=l.alternate,l.child!==null||u!==null&&u.child!==null)for(i=oC(i);i!==null;){if(u=i[Me])return u;i=oC(i)}return l}i=u,u=i.parentNode}return null}function zr(i){if(i=i[Me]||i[Qe]){var l=i.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return i}return null}function Bi(i){var l=i.tag;if(l===5||l===26||l===27||l===6)return i.stateNode;throw Error(r(33))}function Cr(i){var l=i[fn];return l||(l=i[fn]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Xt(i){i[hn]=!0}var Dl=new Set,_a={};function Er(i,l){Vi(i,l),Vi(i+"Capture",l)}function Vi(i,l){for(_a[i]=l,i=0;i<l.length;i++)Dl.add(l[i])}var Al=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Dt={},er={};function Da(i){return Le.call(er,i)?!0:Le.call(Dt,i)?!1:Al.test(i)?er[i]=!0:(Dt[i]=!0,!1)}function mi(i,l,u){if(Da(l))if(u===null)i.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":i.removeAttribute(l);return;case"boolean":var h=l.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){i.removeAttribute(l);return}}i.setAttribute(l,""+u)}}function an(i,l,u){if(u===null)i.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(l);return}i.setAttribute(l,""+u)}}function $r(i,l,u,h){if(h===null)i.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(u);return}i.setAttributeNS(l,u,""+h)}}function Tr(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function uf(i){var l=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function oN(i,l,u){var h=Object.getOwnPropertyDescriptor(i.constructor.prototype,l);if(!i.hasOwnProperty(l)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var x=h.get,S=h.set;return Object.defineProperty(i,l,{configurable:!0,get:function(){return x.call(this)},set:function(D){u=""+D,S.call(this,D)}}),Object.defineProperty(i,l,{enumerable:h.enumerable}),{getValue:function(){return u},setValue:function(D){u=""+D},stopTracking:function(){i._valueTracker=null,delete i[l]}}}}function Ym(i){if(!i._valueTracker){var l=uf(i)?"checked":"value";i._valueTracker=oN(i,l,""+i[l])}}function HS(i){if(!i)return!1;var l=i._valueTracker;if(!l)return!0;var u=l.getValue(),h="";return i&&(h=uf(i)?i.checked?"true":"false":i.value),i=h,i!==u?(l.setValue(i),!0):!1}function df(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var aN=/[\n"\\]/g;function gi(i){return i.replace(aN,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function Km(i,l,u,h,x,S,D,P){i.name="",D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"?i.type=D:i.removeAttribute("type"),l!=null?D==="number"?(l===0&&i.value===""||i.value!=l)&&(i.value=""+Tr(l)):i.value!==""+Tr(l)&&(i.value=""+Tr(l)):D!=="submit"&&D!=="reset"||i.removeAttribute("value"),l!=null?Xm(i,D,Tr(l)):u!=null?Xm(i,D,Tr(u)):h!=null&&i.removeAttribute("value"),x==null&&S!=null&&(i.defaultChecked=!!S),x!=null&&(i.checked=x&&typeof x!="function"&&typeof x!="symbol"),P!=null&&typeof P!="function"&&typeof P!="symbol"&&typeof P!="boolean"?i.name=""+Tr(P):i.removeAttribute("name")}function qS(i,l,u,h,x,S,D,P){if(S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(i.type=S),l!=null||u!=null){if(!(S!=="submit"&&S!=="reset"||l!=null)){Ym(i);return}u=u!=null?""+Tr(u):"",l=l!=null?""+Tr(l):u,P||l===i.value||(i.value=l),i.defaultValue=l}h=h??x,h=typeof h!="function"&&typeof h!="symbol"&&!!h,i.checked=P?i.checked:!!h,i.defaultChecked=!!h,D!=null&&typeof D!="function"&&typeof D!="symbol"&&typeof D!="boolean"&&(i.name=D),Ym(i)}function Xm(i,l,u){l==="number"&&df(i.ownerDocument)===i||i.defaultValue===""+u||(i.defaultValue=""+u)}function kl(i,l,u,h){if(i=i.options,l){l={};for(var x=0;x<u.length;x++)l["$"+u[x]]=!0;for(u=0;u<i.length;u++)x=l.hasOwnProperty("$"+i[u].value),i[u].selected!==x&&(i[u].selected=x),x&&h&&(i[u].defaultSelected=!0)}else{for(u=""+Tr(u),l=null,x=0;x<i.length;x++){if(i[x].value===u){i[x].selected=!0,h&&(i[x].defaultSelected=!0);return}l!==null||i[x].disabled||(l=i[x])}l!==null&&(l.selected=!0)}}function GS(i,l,u){if(l!=null&&(l=""+Tr(l),l!==i.value&&(i.value=l),u==null)){i.defaultValue!==l&&(i.defaultValue=l);return}i.defaultValue=u!=null?""+Tr(u):""}function WS(i,l,u,h){if(l==null){if(h!=null){if(u!=null)throw Error(r(92));if(W(h)){if(1<h.length)throw Error(r(93));h=h[0]}u=h}u==null&&(u=""),l=u}u=Tr(l),i.defaultValue=u,h=i.textContent,h===u&&h!==""&&h!==null&&(i.value=h),Ym(i)}function Pl(i,l){if(l){var u=i.firstChild;if(u&&u===i.lastChild&&u.nodeType===3){u.nodeValue=l;return}}i.textContent=l}var sN=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function QS(i,l,u){var h=l.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?h?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="":h?i.setProperty(l,u):typeof u!="number"||u===0||sN.has(l)?l==="float"?i.cssFloat=u:i[l]=(""+u).trim():i[l]=u+"px"}function YS(i,l,u){if(l!=null&&typeof l!="object")throw Error(r(62));if(i=i.style,u!=null){for(var h in u)!u.hasOwnProperty(h)||l!=null&&l.hasOwnProperty(h)||(h.indexOf("--")===0?i.setProperty(h,""):h==="float"?i.cssFloat="":i[h]="");for(var x in l)h=l[x],l.hasOwnProperty(x)&&u[x]!==h&&QS(i,x,h)}else for(var S in l)l.hasOwnProperty(S)&&QS(i,S,l[S])}function Jm(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var lN=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),cN=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ff(i){return cN.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Ho(){}var Zm=null;function eg(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Nl=null,Ol=null;function KS(i){var l=zr(i);if(l&&(i=l.stateNode)){var u=i[Ve]||null;e:switch(i=l.stateNode,l.type){case"input":if(Km(i,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),l=u.name,u.type==="radio"&&l!=null){for(u=i;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+gi(""+l)+'"][type="radio"]'),l=0;l<u.length;l++){var h=u[l];if(h!==i&&h.form===i.form){var x=h[Ve]||null;if(!x)throw Error(r(90));Km(h,x.value,x.defaultValue,x.defaultValue,x.checked,x.defaultChecked,x.type,x.name)}}for(l=0;l<u.length;l++)h=u[l],h.form===i.form&&HS(h)}break e;case"textarea":GS(i,u.value,u.defaultValue);break e;case"select":l=u.value,l!=null&&kl(i,!!u.multiple,l,!1)}}}var tg=!1;function XS(i,l,u){if(tg)return i(l,u);tg=!0;try{var h=i(l);return h}finally{if(tg=!1,(Nl!==null||Ol!==null)&&(Zf(),Nl&&(l=Nl,i=Ol,Ol=Nl=null,KS(l),i)))for(l=0;l<i.length;l++)KS(i[l])}}function su(i,l){var u=i.stateNode;if(u===null)return null;var h=u[Ve]||null;if(h===null)return null;u=h[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(i=i.type,h=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!h;break e;default:i=!1}if(i)return null;if(u&&typeof u!="function")throw Error(r(231,l,typeof u));return u}var qo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ng=!1;if(qo)try{var lu={};Object.defineProperty(lu,"passive",{get:function(){ng=!0}}),window.addEventListener("test",lu,lu),window.removeEventListener("test",lu,lu)}catch{ng=!1}var Aa=null,rg=null,hf=null;function JS(){if(hf)return hf;var i,l=rg,u=l.length,h,x="value"in Aa?Aa.value:Aa.textContent,S=x.length;for(i=0;i<u&&l[i]===x[i];i++);var D=u-i;for(h=1;h<=D&&l[u-h]===x[S-h];h++);return hf=x.slice(i,1<h?1-h:void 0)}function pf(i){var l=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&l===13&&(i=13)):i=l,i===10&&(i=13),32<=i||i===13?i:0}function mf(){return!0}function ZS(){return!1}function Ur(i){function l(u,h,x,S,D){this._reactName=u,this._targetInst=x,this.type=h,this.nativeEvent=S,this.target=D,this.currentTarget=null;for(var P in i)i.hasOwnProperty(P)&&(u=i[P],this[P]=u?u(S):S[P]);return this.isDefaultPrevented=(S.defaultPrevented!=null?S.defaultPrevented:S.returnValue===!1)?mf:ZS,this.isPropagationStopped=ZS,this}return g(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=mf)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=mf)},persist:function(){},isPersistent:mf}),l}var Es={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},gf=Ur(Es),cu=g({},Es,{view:0,detail:0}),uN=Ur(cu),ig,og,uu,vf=g({},cu,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:sg,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==uu&&(uu&&i.type==="mousemove"?(ig=i.screenX-uu.screenX,og=i.screenY-uu.screenY):og=ig=0,uu=i),ig)},movementY:function(i){return"movementY"in i?i.movementY:og}}),e1=Ur(vf),dN=g({},vf,{dataTransfer:0}),fN=Ur(dN),hN=g({},cu,{relatedTarget:0}),ag=Ur(hN),pN=g({},Es,{animationName:0,elapsedTime:0,pseudoElement:0}),mN=Ur(pN),gN=g({},Es,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),vN=Ur(gN),yN=g({},Es,{data:0}),t1=Ur(yN),xN={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},bN={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"},SN={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function wN(i){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(i):(i=SN[i])?!!l[i]:!1}function sg(){return wN}var jN=g({},cu,{key:function(i){if(i.key){var l=xN[i.key]||i.key;if(l!=="Unidentified")return l}return i.type==="keypress"?(i=pf(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?bN[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:sg,charCode:function(i){return i.type==="keypress"?pf(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?pf(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),CN=Ur(jN),EN=g({},vf,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),n1=Ur(EN),TN=g({},cu,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:sg}),RN=Ur(TN),_N=g({},Es,{propertyName:0,elapsedTime:0,pseudoElement:0}),DN=Ur(_N),AN=g({},vf,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),kN=Ur(AN),PN=g({},Es,{newState:0,oldState:0}),NN=Ur(PN),ON=[9,13,27,32],lg=qo&&"CompositionEvent"in window,du=null;qo&&"documentMode"in document&&(du=document.documentMode);var MN=qo&&"TextEvent"in window&&!du,r1=qo&&(!lg||du&&8<du&&11>=du),i1=" ",o1=!1;function a1(i,l){switch(i){case"keyup":return ON.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function s1(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Ml=!1;function LN(i,l){switch(i){case"compositionend":return s1(l);case"keypress":return l.which!==32?null:(o1=!0,i1);case"textInput":return i=l.data,i===i1&&o1?null:i;default:return null}}function IN(i,l){if(Ml)return i==="compositionend"||!lg&&a1(i,l)?(i=JS(),hf=rg=Aa=null,Ml=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return r1&&l.locale!=="ko"?null:l.data;default:return null}}var zN={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 l1(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l==="input"?!!zN[i.type]:l==="textarea"}function c1(i,l,u,h){Nl?Ol?Ol.push(h):Ol=[h]:Nl=h,l=ah(l,"onChange"),0<l.length&&(u=new gf("onChange","change",null,u,h),i.push({event:u,listeners:l}))}var fu=null,hu=null;function $N(i){qj(i,0)}function yf(i){var l=Bi(i);if(HS(l))return i}function u1(i,l){if(i==="change")return l}var d1=!1;if(qo){var cg;if(qo){var ug="oninput"in document;if(!ug){var f1=document.createElement("div");f1.setAttribute("oninput","return;"),ug=typeof f1.oninput=="function"}cg=ug}else cg=!1;d1=cg&&(!document.documentMode||9<document.documentMode)}function h1(){fu&&(fu.detachEvent("onpropertychange",p1),hu=fu=null)}function p1(i){if(i.propertyName==="value"&&yf(hu)){var l=[];c1(l,hu,i,eg(i)),XS($N,l)}}function UN(i,l,u){i==="focusin"?(h1(),fu=l,hu=u,fu.attachEvent("onpropertychange",p1)):i==="focusout"&&h1()}function BN(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return yf(hu)}function VN(i,l){if(i==="click")return yf(l)}function FN(i,l){if(i==="input"||i==="change")return yf(l)}function HN(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}var ei=typeof Object.is=="function"?Object.is:HN;function pu(i,l){if(ei(i,l))return!0;if(typeof i!="object"||i===null||typeof l!="object"||l===null)return!1;var u=Object.keys(i),h=Object.keys(l);if(u.length!==h.length)return!1;for(h=0;h<u.length;h++){var x=u[h];if(!Le.call(l,x)||!ei(i[x],l[x]))return!1}return!0}function m1(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function g1(i,l){var u=m1(i);i=0;for(var h;u;){if(u.nodeType===3){if(h=i+u.textContent.length,i<=l&&h>=l)return{node:u,offset:l-i};i=h}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=m1(u)}}function v1(i,l){return i&&l?i===l?!0:i&&i.nodeType===3?!1:l&&l.nodeType===3?v1(i,l.parentNode):"contains"in i?i.contains(l):i.compareDocumentPosition?!!(i.compareDocumentPosition(l)&16):!1:!1}function y1(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var l=df(i.document);l instanceof i.HTMLIFrameElement;){try{var u=typeof l.contentWindow.location.href=="string"}catch{u=!1}if(u)i=l.contentWindow;else break;l=df(i.document)}return l}function dg(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l&&(l==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||l==="textarea"||i.contentEditable==="true")}var qN=qo&&"documentMode"in document&&11>=document.documentMode,Ll=null,fg=null,mu=null,hg=!1;function x1(i,l,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;hg||Ll==null||Ll!==df(h)||(h=Ll,"selectionStart"in h&&dg(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),mu&&pu(mu,h)||(mu=h,h=ah(fg,"onSelect"),0<h.length&&(l=new gf("onSelect","select",null,l,u),i.push({event:l,listeners:h}),l.target=Ll)))}function Ts(i,l){var u={};return u[i.toLowerCase()]=l.toLowerCase(),u["Webkit"+i]="webkit"+l,u["Moz"+i]="moz"+l,u}var Il={animationend:Ts("Animation","AnimationEnd"),animationiteration:Ts("Animation","AnimationIteration"),animationstart:Ts("Animation","AnimationStart"),transitionrun:Ts("Transition","TransitionRun"),transitionstart:Ts("Transition","TransitionStart"),transitioncancel:Ts("Transition","TransitionCancel"),transitionend:Ts("Transition","TransitionEnd")},pg={},b1={};qo&&(b1=document.createElement("div").style,"AnimationEvent"in window||(delete Il.animationend.animation,delete Il.animationiteration.animation,delete Il.animationstart.animation),"TransitionEvent"in window||delete Il.transitionend.transition);function Rs(i){if(pg[i])return pg[i];if(!Il[i])return i;var l=Il[i],u;for(u in l)if(l.hasOwnProperty(u)&&u in b1)return pg[i]=l[u];return i}var S1=Rs("animationend"),w1=Rs("animationiteration"),j1=Rs("animationstart"),GN=Rs("transitionrun"),WN=Rs("transitionstart"),QN=Rs("transitioncancel"),C1=Rs("transitionend"),E1=new Map,mg="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");mg.push("scrollEnd");function Fi(i,l){E1.set(i,l),Er(l,[i])}var xf=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},vi=[],zl=0,gg=0;function bf(){for(var i=zl,l=gg=zl=0;l<i;){var u=vi[l];vi[l++]=null;var h=vi[l];vi[l++]=null;var x=vi[l];vi[l++]=null;var S=vi[l];if(vi[l++]=null,h!==null&&x!==null){var D=h.pending;D===null?x.next=x:(x.next=D.next,D.next=x),h.pending=x}S!==0&&T1(u,x,S)}}function Sf(i,l,u,h){vi[zl++]=i,vi[zl++]=l,vi[zl++]=u,vi[zl++]=h,gg|=h,i.lanes|=h,i=i.alternate,i!==null&&(i.lanes|=h)}function vg(i,l,u,h){return Sf(i,l,u,h),wf(i)}function _s(i,l){return Sf(i,null,null,l),wf(i)}function T1(i,l,u){i.lanes|=u;var h=i.alternate;h!==null&&(h.lanes|=u);for(var x=!1,S=i.return;S!==null;)S.childLanes|=u,h=S.alternate,h!==null&&(h.childLanes|=u),S.tag===22&&(i=S.stateNode,i===null||i._visibility&1||(x=!0)),i=S,S=S.return;return i.tag===3?(S=i.stateNode,x&&l!==null&&(x=31-Nn(u),i=S.hiddenUpdates,h=i[x],h===null?i[x]=[l]:h.push(l),l.lane=u|536870912),S):null}function wf(i){if(50<Iu)throw Iu=0,Tv=null,Error(r(185));for(var l=i.return;l!==null;)i=l,l=i.return;return i.tag===3?i.stateNode:null}var $l={};function YN(i,l,u,h){this.tag=i,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(i,l,u,h){return new YN(i,l,u,h)}function yg(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Go(i,l){var u=i.alternate;return u===null?(u=ti(i.tag,l,i.key,i.mode),u.elementType=i.elementType,u.type=i.type,u.stateNode=i.stateNode,u.alternate=i,i.alternate=u):(u.pendingProps=l,u.type=i.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=i.flags&65011712,u.childLanes=i.childLanes,u.lanes=i.lanes,u.child=i.child,u.memoizedProps=i.memoizedProps,u.memoizedState=i.memoizedState,u.updateQueue=i.updateQueue,l=i.dependencies,u.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},u.sibling=i.sibling,u.index=i.index,u.ref=i.ref,u.refCleanup=i.refCleanup,u}function R1(i,l){i.flags&=65011714;var u=i.alternate;return u===null?(i.childLanes=0,i.lanes=l,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=u.childLanes,i.lanes=u.lanes,i.child=u.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=u.memoizedProps,i.memoizedState=u.memoizedState,i.updateQueue=u.updateQueue,i.type=u.type,l=u.dependencies,i.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),i}function jf(i,l,u,h,x,S){var D=0;if(h=i,typeof i=="function")yg(i)&&(D=1);else if(typeof i=="string")D=e3(i,u,ue.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case U:return i=ti(31,u,l,x),i.elementType=U,i.lanes=S,i;case j:return Ds(u.children,x,S,l);case C:D=8,x|=24;break;case R:return i=ti(12,u,l,x|2),i.elementType=R,i.lanes=S,i;case k:return i=ti(13,u,l,x),i.elementType=k,i.lanes=S,i;case L:return i=ti(19,u,l,x),i.elementType=L,i.lanes=S,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case E:D=10;break e;case T:D=9;break e;case _:D=11;break e;case A:D=14;break e;case N:D=16,h=null;break e}D=29,u=Error(r(130,i===null?"null":typeof i,"")),h=null}return l=ti(D,u,l,x),l.elementType=i,l.type=h,l.lanes=S,l}function Ds(i,l,u,h){return i=ti(7,i,h,l),i.lanes=u,i}function xg(i,l,u){return i=ti(6,i,null,l),i.lanes=u,i}function _1(i){var l=ti(18,null,null,0);return l.stateNode=i,l}function bg(i,l,u){return l=ti(4,i.children!==null?i.children:[],i.key,l),l.lanes=u,l.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},l}var D1=new WeakMap;function yi(i,l){if(typeof i=="object"&&i!==null){var u=D1.get(i);return u!==void 0?u:(l={value:i,source:l,stack:Ee(l)},D1.set(i,l),l)}return{value:i,source:l,stack:Ee(l)}}var Ul=[],Bl=0,Cf=null,gu=0,xi=[],bi=0,ka=null,lo=1,co="";function Wo(i,l){Ul[Bl++]=gu,Ul[Bl++]=Cf,Cf=i,gu=l}function A1(i,l,u){xi[bi++]=lo,xi[bi++]=co,xi[bi++]=ka,ka=i;var h=lo;i=co;var x=32-Nn(h)-1;h&=~(1<<x),u+=1;var S=32-Nn(l)+x;if(30<S){var D=x-x%5;S=(h&(1<<D)-1).toString(32),h>>=D,x-=D,lo=1<<32-Nn(l)+x|u<<x|h,co=S+i}else lo=1<<S|u<<x|h,co=i}function Sg(i){i.return!==null&&(Wo(i,1),A1(i,1,0))}function wg(i){for(;i===Cf;)Cf=Ul[--Bl],Ul[Bl]=null,gu=Ul[--Bl],Ul[Bl]=null;for(;i===ka;)ka=xi[--bi],xi[bi]=null,co=xi[--bi],xi[bi]=null,lo=xi[--bi],xi[bi]=null}function k1(i,l){xi[bi++]=lo,xi[bi++]=co,xi[bi++]=ka,lo=l.id,co=l.overflow,ka=i}var sr=null,vn=null,Nt=!1,Pa=null,Si=!1,jg=Error(r(519));function Na(i){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw vu(yi(l,i)),jg}function P1(i){var l=i.stateNode,u=i.type,h=i.memoizedProps;switch(l[Me]=i,l[Ve]=h,u){case"dialog":_t("cancel",l),_t("close",l);break;case"iframe":case"object":case"embed":_t("load",l);break;case"video":case"audio":for(u=0;u<$u.length;u++)_t($u[u],l);break;case"source":_t("error",l);break;case"img":case"image":case"link":_t("error",l),_t("load",l);break;case"details":_t("toggle",l);break;case"input":_t("invalid",l),qS(l,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":_t("invalid",l);break;case"textarea":_t("invalid",l),WS(l,h.value,h.defaultValue,h.children)}u=h.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||l.textContent===""+u||h.suppressHydrationWarning===!0||Yj(l.textContent,u)?(h.popover!=null&&(_t("beforetoggle",l),_t("toggle",l)),h.onScroll!=null&&_t("scroll",l),h.onScrollEnd!=null&&_t("scrollend",l),h.onClick!=null&&(l.onclick=Ho),l=!0):l=!1,l||Na(i,!0)}function N1(i){for(sr=i.return;sr;)switch(sr.tag){case 5:case 31:case 13:Si=!1;return;case 27:case 3:Si=!0;return;default:sr=sr.return}}function Vl(i){if(i!==sr)return!1;if(!Nt)return N1(i),Nt=!0,!1;var l=i.tag,u;if((u=l!==3&&l!==27)&&((u=l===5)&&(u=i.type,u=!(u!=="form"&&u!=="button")||Bv(i.type,i.memoizedProps)),u=!u),u&&vn&&Na(i),N1(i),l===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));vn=iC(i)}else if(l===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));vn=iC(i)}else l===27?(l=vn,Wa(i.type)?(i=Gv,Gv=null,vn=i):vn=l):vn=sr?ji(i.stateNode.nextSibling):null;return!0}function As(){vn=sr=null,Nt=!1}function Cg(){var i=Pa;return i!==null&&(Hr===null?Hr=i:Hr.push.apply(Hr,i),Pa=null),i}function vu(i){Pa===null?Pa=[i]:Pa.push(i)}var Eg=O(null),ks=null,Qo=null;function Oa(i,l,u){oe(Eg,l._currentValue),l._currentValue=u}function Yo(i){i._currentValue=Eg.current,H(Eg)}function Tg(i,l,u){for(;i!==null;){var h=i.alternate;if((i.childLanes&l)!==l?(i.childLanes|=l,h!==null&&(h.childLanes|=l)):h!==null&&(h.childLanes&l)!==l&&(h.childLanes|=l),i===u)break;i=i.return}}function Rg(i,l,u,h){var x=i.child;for(x!==null&&(x.return=i);x!==null;){var S=x.dependencies;if(S!==null){var D=x.child;S=S.firstContext;e:for(;S!==null;){var P=S;S=x;for(var q=0;q<l.length;q++)if(P.context===l[q]){S.lanes|=u,P=S.alternate,P!==null&&(P.lanes|=u),Tg(S.return,u,i),h||(D=null);break e}S=P.next}}else if(x.tag===18){if(D=x.return,D===null)throw Error(r(341));D.lanes|=u,S=D.alternate,S!==null&&(S.lanes|=u),Tg(D,u,i),D=null}else D=x.child;if(D!==null)D.return=x;else for(D=x;D!==null;){if(D===i){D=null;break}if(x=D.sibling,x!==null){x.return=D.return,D=x;break}D=D.return}x=D}}function Fl(i,l,u,h){i=null;for(var x=l,S=!1;x!==null;){if(!S){if((x.flags&524288)!==0)S=!0;else if((x.flags&262144)!==0)break}if(x.tag===10){var D=x.alternate;if(D===null)throw Error(r(387));if(D=D.memoizedProps,D!==null){var P=x.type;ei(x.pendingProps.value,D.value)||(i!==null?i.push(P):i=[P])}}else if(x===Pe.current){if(D=x.alternate,D===null)throw Error(r(387));D.memoizedState.memoizedState!==x.memoizedState.memoizedState&&(i!==null?i.push(Hu):i=[Hu])}x=x.return}i!==null&&Rg(l,i,u,h),l.flags|=262144}function Ef(i){for(i=i.firstContext;i!==null;){if(!ei(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Ps(i){ks=i,Qo=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function lr(i){return O1(ks,i)}function Tf(i,l){return ks===null&&Ps(i),O1(i,l)}function O1(i,l){var u=l._currentValue;if(l={context:l,memoizedValue:u,next:null},Qo===null){if(i===null)throw Error(r(308));Qo=l,i.dependencies={lanes:0,firstContext:l},i.flags|=524288}else Qo=Qo.next=l;return u}var KN=typeof AbortController<"u"?AbortController:function(){var i=[],l=this.signal={aborted:!1,addEventListener:function(u,h){i.push(h)}};this.abort=function(){l.aborted=!0,i.forEach(function(u){return u()})}},XN=e.unstable_scheduleCallback,JN=e.unstable_NormalPriority,Yn={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function _g(){return{controller:new KN,data:new Map,refCount:0}}function yu(i){i.refCount--,i.refCount===0&&XN(JN,function(){i.controller.abort()})}var xu=null,Dg=0,Hl=0,ql=null;function ZN(i,l){if(xu===null){var u=xu=[];Dg=0,Hl=Pv(),ql={status:"pending",value:void 0,then:function(h){u.push(h)}}}return Dg++,l.then(M1,M1),l}function M1(){if(--Dg===0&&xu!==null){ql!==null&&(ql.status="fulfilled");var i=xu;xu=null,Hl=0,ql=null;for(var l=0;l<i.length;l++)(0,i[l])()}}function eO(i,l){var u=[],h={status:"pending",value:null,reason:null,then:function(x){u.push(x)}};return i.then(function(){h.status="fulfilled",h.value=l;for(var x=0;x<u.length;x++)(0,u[x])(l)},function(x){for(h.status="rejected",h.reason=x,x=0;x<u.length;x++)(0,u[x])(void 0)}),h}var L1=M.S;M.S=function(i,l){xj=ve(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&ZN(i,l),L1!==null&&L1(i,l)};var Ns=O(null);function Ag(){var i=Ns.current;return i!==null?i:sn.pooledCache}function Rf(i,l){l===null?oe(Ns,Ns.current):oe(Ns,l.pool)}function I1(){var i=Ag();return i===null?null:{parent:Yn._currentValue,pool:i}}var Gl=Error(r(460)),kg=Error(r(474)),_f=Error(r(542)),Df={then:function(){}};function z1(i){return i=i.status,i==="fulfilled"||i==="rejected"}function $1(i,l,u){switch(u=i[u],u===void 0?i.push(l):u!==l&&(l.then(Ho,Ho),l=u),l.status){case"fulfilled":return l.value;case"rejected":throw i=l.reason,B1(i),i;default:if(typeof l.status=="string")l.then(Ho,Ho);else{if(i=sn,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=l,i.status="pending",i.then(function(h){if(l.status==="pending"){var x=l;x.status="fulfilled",x.value=h}},function(h){if(l.status==="pending"){var x=l;x.status="rejected",x.reason=h}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw i=l.reason,B1(i),i}throw Ms=l,Gl}}function Os(i){try{var l=i._init;return l(i._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Ms=u,Gl):u}}var Ms=null;function U1(){if(Ms===null)throw Error(r(459));var i=Ms;return Ms=null,i}function B1(i){if(i===Gl||i===_f)throw Error(r(483))}var Wl=null,bu=0;function Af(i){var l=bu;return bu+=1,Wl===null&&(Wl=[]),$1(Wl,i,l)}function Su(i,l){l=l.props.ref,i.ref=l!==void 0?l:null}function kf(i,l){throw l.$$typeof===y?Error(r(525)):(i=Object.prototype.toString.call(l),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":i)))}function V1(i){function l(K,G){if(i){var ee=K.deletions;ee===null?(K.deletions=[G],K.flags|=16):ee.push(G)}}function u(K,G){if(!i)return null;for(;G!==null;)l(K,G),G=G.sibling;return null}function h(K){for(var G=new Map;K!==null;)K.key!==null?G.set(K.key,K):G.set(K.index,K),K=K.sibling;return G}function x(K,G){return K=Go(K,G),K.index=0,K.sibling=null,K}function S(K,G,ee){return K.index=ee,i?(ee=K.alternate,ee!==null?(ee=ee.index,ee<G?(K.flags|=67108866,G):ee):(K.flags|=67108866,G)):(K.flags|=1048576,G)}function D(K){return i&&K.alternate===null&&(K.flags|=67108866),K}function P(K,G,ee,me){return G===null||G.tag!==6?(G=xg(ee,K.mode,me),G.return=K,G):(G=x(G,ee),G.return=K,G)}function q(K,G,ee,me){var ot=ee.type;return ot===j?fe(K,G,ee.props.children,me,ee.key):G!==null&&(G.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===N&&Os(ot)===G.type)?(G=x(G,ee.props),Su(G,ee),G.return=K,G):(G=jf(ee.type,ee.key,ee.props,null,K.mode,me),Su(G,ee),G.return=K,G)}function te(K,G,ee,me){return G===null||G.tag!==4||G.stateNode.containerInfo!==ee.containerInfo||G.stateNode.implementation!==ee.implementation?(G=bg(ee,K.mode,me),G.return=K,G):(G=x(G,ee.children||[]),G.return=K,G)}function fe(K,G,ee,me,ot){return G===null||G.tag!==7?(G=Ds(ee,K.mode,me,ot),G.return=K,G):(G=x(G,ee),G.return=K,G)}function ye(K,G,ee){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=xg(""+G,K.mode,ee),G.return=K,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case b:return ee=jf(G.type,G.key,G.props,null,K.mode,ee),Su(ee,G),ee.return=K,ee;case w:return G=bg(G,K.mode,ee),G.return=K,G;case N:return G=Os(G),ye(K,G,ee)}if(W(G)||J(G))return G=Ds(G,K.mode,ee,null),G.return=K,G;if(typeof G.then=="function")return ye(K,Af(G),ee);if(G.$$typeof===E)return ye(K,Tf(K,G),ee);kf(K,G)}return null}function re(K,G,ee,me){var ot=G!==null?G.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return ot!==null?null:P(K,G,""+ee,me);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case b:return ee.key===ot?q(K,G,ee,me):null;case w:return ee.key===ot?te(K,G,ee,me):null;case N:return ee=Os(ee),re(K,G,ee,me)}if(W(ee)||J(ee))return ot!==null?null:fe(K,G,ee,me,null);if(typeof ee.then=="function")return re(K,G,Af(ee),me);if(ee.$$typeof===E)return re(K,G,Tf(K,ee),me);kf(K,ee)}return null}function se(K,G,ee,me,ot){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return K=K.get(ee)||null,P(G,K,""+me,ot);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case b:return K=K.get(me.key===null?ee:me.key)||null,q(G,K,me,ot);case w:return K=K.get(me.key===null?ee:me.key)||null,te(G,K,me,ot);case N:return me=Os(me),se(K,G,ee,me,ot)}if(W(me)||J(me))return K=K.get(ee)||null,fe(G,K,me,ot,null);if(typeof me.then=="function")return se(K,G,ee,Af(me),ot);if(me.$$typeof===E)return se(K,G,ee,Tf(G,me),ot);kf(G,me)}return null}function qe(K,G,ee,me){for(var ot=null,Bt=null,Xe=G,jt=G=0,kt=null;Xe!==null&&jt<ee.length;jt++){Xe.index>jt?(kt=Xe,Xe=null):kt=Xe.sibling;var Vt=re(K,Xe,ee[jt],me);if(Vt===null){Xe===null&&(Xe=kt);break}i&&Xe&&Vt.alternate===null&&l(K,Xe),G=S(Vt,G,jt),Bt===null?ot=Vt:Bt.sibling=Vt,Bt=Vt,Xe=kt}if(jt===ee.length)return u(K,Xe),Nt&&Wo(K,jt),ot;if(Xe===null){for(;jt<ee.length;jt++)Xe=ye(K,ee[jt],me),Xe!==null&&(G=S(Xe,G,jt),Bt===null?ot=Xe:Bt.sibling=Xe,Bt=Xe);return Nt&&Wo(K,jt),ot}for(Xe=h(Xe);jt<ee.length;jt++)kt=se(Xe,K,jt,ee[jt],me),kt!==null&&(i&&kt.alternate!==null&&Xe.delete(kt.key===null?jt:kt.key),G=S(kt,G,jt),Bt===null?ot=kt:Bt.sibling=kt,Bt=kt);return i&&Xe.forEach(function(Ja){return l(K,Ja)}),Nt&&Wo(K,jt),ot}function ut(K,G,ee,me){if(ee==null)throw Error(r(151));for(var ot=null,Bt=null,Xe=G,jt=G=0,kt=null,Vt=ee.next();Xe!==null&&!Vt.done;jt++,Vt=ee.next()){Xe.index>jt?(kt=Xe,Xe=null):kt=Xe.sibling;var Ja=re(K,Xe,Vt.value,me);if(Ja===null){Xe===null&&(Xe=kt);break}i&&Xe&&Ja.alternate===null&&l(K,Xe),G=S(Ja,G,jt),Bt===null?ot=Ja:Bt.sibling=Ja,Bt=Ja,Xe=kt}if(Vt.done)return u(K,Xe),Nt&&Wo(K,jt),ot;if(Xe===null){for(;!Vt.done;jt++,Vt=ee.next())Vt=ye(K,Vt.value,me),Vt!==null&&(G=S(Vt,G,jt),Bt===null?ot=Vt:Bt.sibling=Vt,Bt=Vt);return Nt&&Wo(K,jt),ot}for(Xe=h(Xe);!Vt.done;jt++,Vt=ee.next())Vt=se(Xe,K,jt,Vt.value,me),Vt!==null&&(i&&Vt.alternate!==null&&Xe.delete(Vt.key===null?jt:Vt.key),G=S(Vt,G,jt),Bt===null?ot=Vt:Bt.sibling=Vt,Bt=Vt);return i&&Xe.forEach(function(d3){return l(K,d3)}),Nt&&Wo(K,jt),ot}function rn(K,G,ee,me){if(typeof ee=="object"&&ee!==null&&ee.type===j&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case b:e:{for(var ot=ee.key;G!==null;){if(G.key===ot){if(ot=ee.type,ot===j){if(G.tag===7){u(K,G.sibling),me=x(G,ee.props.children),me.return=K,K=me;break e}}else if(G.elementType===ot||typeof ot=="object"&&ot!==null&&ot.$$typeof===N&&Os(ot)===G.type){u(K,G.sibling),me=x(G,ee.props),Su(me,ee),me.return=K,K=me;break e}u(K,G);break}else l(K,G);G=G.sibling}ee.type===j?(me=Ds(ee.props.children,K.mode,me,ee.key),me.return=K,K=me):(me=jf(ee.type,ee.key,ee.props,null,K.mode,me),Su(me,ee),me.return=K,K=me)}return D(K);case w:e:{for(ot=ee.key;G!==null;){if(G.key===ot)if(G.tag===4&&G.stateNode.containerInfo===ee.containerInfo&&G.stateNode.implementation===ee.implementation){u(K,G.sibling),me=x(G,ee.children||[]),me.return=K,K=me;break e}else{u(K,G);break}else l(K,G);G=G.sibling}me=bg(ee,K.mode,me),me.return=K,K=me}return D(K);case N:return ee=Os(ee),rn(K,G,ee,me)}if(W(ee))return qe(K,G,ee,me);if(J(ee)){if(ot=J(ee),typeof ot!="function")throw Error(r(150));return ee=ot.call(ee),ut(K,G,ee,me)}if(typeof ee.then=="function")return rn(K,G,Af(ee),me);if(ee.$$typeof===E)return rn(K,G,Tf(K,ee),me);kf(K,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,G!==null&&G.tag===6?(u(K,G.sibling),me=x(G,ee),me.return=K,K=me):(u(K,G),me=xg(ee,K.mode,me),me.return=K,K=me),D(K)):u(K,G)}return function(K,G,ee,me){try{bu=0;var ot=rn(K,G,ee,me);return Wl=null,ot}catch(Xe){if(Xe===Gl||Xe===_f)throw Xe;var Bt=ti(29,Xe,null,K.mode);return Bt.lanes=me,Bt.return=K,Bt}finally{}}}var Ls=V1(!0),F1=V1(!1),Ma=!1;function Pg(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ng(i,l){i=i.updateQueue,l.updateQueue===i&&(l.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function La(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function Ia(i,l,u){var h=i.updateQueue;if(h===null)return null;if(h=h.shared,(Gt&2)!==0){var x=h.pending;return x===null?l.next=l:(l.next=x.next,x.next=l),h.pending=l,l=wf(i),T1(i,null,u),l}return Sf(i,h,l,u),wf(i)}function wu(i,l,u){if(l=l.updateQueue,l!==null&&(l=l.shared,(u&4194048)!==0)){var h=l.lanes;h&=i.pendingLanes,u|=h,l.lanes=u,Y(i,u)}}function Og(i,l){var u=i.updateQueue,h=i.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var x=null,S=null;if(u=u.firstBaseUpdate,u!==null){do{var D={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};S===null?x=S=D:S=S.next=D,u=u.next}while(u!==null);S===null?x=S=l:S=S.next=l}else x=S=l;u={baseState:h.baseState,firstBaseUpdate:x,lastBaseUpdate:S,shared:h.shared,callbacks:h.callbacks},i.updateQueue=u;return}i=u.lastBaseUpdate,i===null?u.firstBaseUpdate=l:i.next=l,u.lastBaseUpdate=l}var Mg=!1;function ju(){if(Mg){var i=ql;if(i!==null)throw i}}function Cu(i,l,u,h){Mg=!1;var x=i.updateQueue;Ma=!1;var S=x.firstBaseUpdate,D=x.lastBaseUpdate,P=x.shared.pending;if(P!==null){x.shared.pending=null;var q=P,te=q.next;q.next=null,D===null?S=te:D.next=te,D=q;var fe=i.alternate;fe!==null&&(fe=fe.updateQueue,P=fe.lastBaseUpdate,P!==D&&(P===null?fe.firstBaseUpdate=te:P.next=te,fe.lastBaseUpdate=q))}if(S!==null){var ye=x.baseState;D=0,fe=te=q=null,P=S;do{var re=P.lane&-536870913,se=re!==P.lane;if(se?(At&re)===re:(h&re)===re){re!==0&&re===Hl&&(Mg=!0),fe!==null&&(fe=fe.next={lane:0,tag:P.tag,payload:P.payload,callback:null,next:null});e:{var qe=i,ut=P;re=l;var rn=u;switch(ut.tag){case 1:if(qe=ut.payload,typeof qe=="function"){ye=qe.call(rn,ye,re);break e}ye=qe;break e;case 3:qe.flags=qe.flags&-65537|128;case 0:if(qe=ut.payload,re=typeof qe=="function"?qe.call(rn,ye,re):qe,re==null)break e;ye=g({},ye,re);break e;case 2:Ma=!0}}re=P.callback,re!==null&&(i.flags|=64,se&&(i.flags|=8192),se=x.callbacks,se===null?x.callbacks=[re]:se.push(re))}else se={lane:re,tag:P.tag,payload:P.payload,callback:P.callback,next:null},fe===null?(te=fe=se,q=ye):fe=fe.next=se,D|=re;if(P=P.next,P===null){if(P=x.shared.pending,P===null)break;se=P,P=se.next,se.next=null,x.lastBaseUpdate=se,x.shared.pending=null}}while(!0);fe===null&&(q=ye),x.baseState=q,x.firstBaseUpdate=te,x.lastBaseUpdate=fe,S===null&&(x.shared.lanes=0),Va|=D,i.lanes=D,i.memoizedState=ye}}function H1(i,l){if(typeof i!="function")throw Error(r(191,i));i.call(l)}function q1(i,l){var u=i.callbacks;if(u!==null)for(i.callbacks=null,i=0;i<u.length;i++)H1(u[i],l)}var Ql=O(null),Pf=O(0);function G1(i,l){i=ia,oe(Pf,i),oe(Ql,l),ia=i|l.baseLanes}function Lg(){oe(Pf,ia),oe(Ql,Ql.current)}function Ig(){ia=Pf.current,H(Ql),H(Pf)}var ni=O(null),wi=null;function za(i){var l=i.alternate;oe(Bn,Bn.current&1),oe(ni,i),wi===null&&(l===null||Ql.current!==null||l.memoizedState!==null)&&(wi=i)}function zg(i){oe(Bn,Bn.current),oe(ni,i),wi===null&&(wi=i)}function W1(i){i.tag===22?(oe(Bn,Bn.current),oe(ni,i),wi===null&&(wi=i)):$a()}function $a(){oe(Bn,Bn.current),oe(ni,ni.current)}function ri(i){H(ni),wi===i&&(wi=null),H(Bn)}var Bn=O(0);function Nf(i){for(var l=i;l!==null;){if(l.tag===13){var u=l.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||Hv(u)||qv(u)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var Ko=0,xt=null,tn=null,Kn=null,Of=!1,Yl=!1,Is=!1,Mf=0,Eu=0,Kl=null,tO=0;function On(){throw Error(r(321))}function $g(i,l){if(l===null)return!1;for(var u=0;u<l.length&&u<i.length;u++)if(!ei(i[u],l[u]))return!1;return!0}function Ug(i,l,u,h,x,S){return Ko=S,xt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,M.H=i===null||i.memoizedState===null?Aw:tv,Is=!1,S=u(h,x),Is=!1,Yl&&(S=Y1(l,u,h,x)),Q1(i),S}function Q1(i){M.H=_u;var l=tn!==null&&tn.next!==null;if(Ko=0,Kn=tn=xt=null,Of=!1,Eu=0,Kl=null,l)throw Error(r(300));i===null||Xn||(i=i.dependencies,i!==null&&Ef(i)&&(Xn=!0))}function Y1(i,l,u,h){xt=i;var x=0;do{if(Yl&&(Kl=null),Eu=0,Yl=!1,25<=x)throw Error(r(301));if(x+=1,Kn=tn=null,i.updateQueue!=null){var S=i.updateQueue;S.lastEffect=null,S.events=null,S.stores=null,S.memoCache!=null&&(S.memoCache.index=0)}M.H=kw,S=l(u,h)}while(Yl);return S}function nO(){var i=M.H,l=i.useState()[0];return l=typeof l.then=="function"?Tu(l):l,i=i.useState()[0],(tn!==null?tn.memoizedState:null)!==i&&(xt.flags|=1024),l}function Bg(){var i=Mf!==0;return Mf=0,i}function Vg(i,l,u){l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~u}function Fg(i){if(Of){for(i=i.memoizedState;i!==null;){var l=i.queue;l!==null&&(l.pending=null),i=i.next}Of=!1}Ko=0,Kn=tn=xt=null,Yl=!1,Eu=Mf=0,Kl=null}function Rr(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Kn===null?xt.memoizedState=Kn=i:Kn=Kn.next=i,Kn}function Vn(){if(tn===null){var i=xt.alternate;i=i!==null?i.memoizedState:null}else i=tn.next;var l=Kn===null?xt.memoizedState:Kn.next;if(l!==null)Kn=l,tn=i;else{if(i===null)throw xt.alternate===null?Error(r(467)):Error(r(310));tn=i,i={memoizedState:tn.memoizedState,baseState:tn.baseState,baseQueue:tn.baseQueue,queue:tn.queue,next:null},Kn===null?xt.memoizedState=Kn=i:Kn=Kn.next=i}return Kn}function Lf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Tu(i){var l=Eu;return Eu+=1,Kl===null&&(Kl=[]),i=$1(Kl,i,l),l=xt,(Kn===null?l.memoizedState:Kn.next)===null&&(l=l.alternate,M.H=l===null||l.memoizedState===null?Aw:tv),i}function If(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Tu(i);if(i.$$typeof===E)return lr(i)}throw Error(r(438,String(i)))}function Hg(i){var l=null,u=xt.updateQueue;if(u!==null&&(l=u.memoCache),l==null){var h=xt.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(l={data:h.data.map(function(x){return x.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),u===null&&(u=Lf(),xt.updateQueue=u),u.memoCache=l,u=l.data[l.index],u===void 0)for(u=l.data[l.index]=Array(i),h=0;h<i;h++)u[h]=B;return l.index++,u}function Xo(i,l){return typeof l=="function"?l(i):l}function zf(i){var l=Vn();return qg(l,tn,i)}function qg(i,l,u){var h=i.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=u;var x=i.baseQueue,S=h.pending;if(S!==null){if(x!==null){var D=x.next;x.next=S.next,S.next=D}l.baseQueue=x=S,h.pending=null}if(S=i.baseState,x===null)i.memoizedState=S;else{l=x.next;var P=D=null,q=null,te=l,fe=!1;do{var ye=te.lane&-536870913;if(ye!==te.lane?(At&ye)===ye:(Ko&ye)===ye){var re=te.revertLane;if(re===0)q!==null&&(q=q.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),ye===Hl&&(fe=!0);else if((Ko&re)===re){te=te.next,re===Hl&&(fe=!0);continue}else ye={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},q===null?(P=q=ye,D=S):q=q.next=ye,xt.lanes|=re,Va|=re;ye=te.action,Is&&u(S,ye),S=te.hasEagerState?te.eagerState:u(S,ye)}else re={lane:ye,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},q===null?(P=q=re,D=S):q=q.next=re,xt.lanes|=ye,Va|=ye;te=te.next}while(te!==null&&te!==l);if(q===null?D=S:q.next=P,!ei(S,i.memoizedState)&&(Xn=!0,fe&&(u=ql,u!==null)))throw u;i.memoizedState=S,i.baseState=D,i.baseQueue=q,h.lastRenderedState=S}return x===null&&(h.lanes=0),[i.memoizedState,h.dispatch]}function Gg(i){var l=Vn(),u=l.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=i;var h=u.dispatch,x=u.pending,S=l.memoizedState;if(x!==null){u.pending=null;var D=x=x.next;do S=i(S,D.action),D=D.next;while(D!==x);ei(S,l.memoizedState)||(Xn=!0),l.memoizedState=S,l.baseQueue===null&&(l.baseState=S),u.lastRenderedState=S}return[S,h]}function K1(i,l,u){var h=xt,x=Vn(),S=Nt;if(S){if(u===void 0)throw Error(r(407));u=u()}else u=l();var D=!ei((tn||x).memoizedState,u);if(D&&(x.memoizedState=u,Xn=!0),x=x.queue,Yg(Z1.bind(null,h,x,i),[i]),x.getSnapshot!==l||D||Kn!==null&&Kn.memoizedState.tag&1){if(h.flags|=2048,Xl(9,{destroy:void 0},J1.bind(null,h,x,u,l),null),sn===null)throw Error(r(349));S||(Ko&127)!==0||X1(h,l,u)}return u}function X1(i,l,u){i.flags|=16384,i={getSnapshot:l,value:u},l=xt.updateQueue,l===null?(l=Lf(),xt.updateQueue=l,l.stores=[i]):(u=l.stores,u===null?l.stores=[i]:u.push(i))}function J1(i,l,u,h){l.value=u,l.getSnapshot=h,ew(l)&&tw(i)}function Z1(i,l,u){return u(function(){ew(l)&&tw(i)})}function ew(i){var l=i.getSnapshot;i=i.value;try{var u=l();return!ei(i,u)}catch{return!0}}function tw(i){var l=_s(i,2);l!==null&&qr(l,i,2)}function Wg(i){var l=Rr();if(typeof i=="function"){var u=i;if(i=u(),Is){Zn(!0);try{u()}finally{Zn(!1)}}}return l.memoizedState=l.baseState=i,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:i},l}function nw(i,l,u,h){return i.baseState=u,qg(i,tn,typeof h=="function"?h:Xo)}function rO(i,l,u,h,x){if(Bf(i))throw Error(r(485));if(i=l.action,i!==null){var S={payload:x,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(D){S.listeners.push(D)}};M.T!==null?u(!0):S.isTransition=!1,h(S),u=l.pending,u===null?(S.next=l.pending=S,rw(l,S)):(S.next=u.next,l.pending=u.next=S)}}function rw(i,l){var u=l.action,h=l.payload,x=i.state;if(l.isTransition){var S=M.T,D={};M.T=D;try{var P=u(x,h),q=M.S;q!==null&&q(D,P),iw(i,l,P)}catch(te){Qg(i,l,te)}finally{S!==null&&D.types!==null&&(S.types=D.types),M.T=S}}else try{S=u(x,h),iw(i,l,S)}catch(te){Qg(i,l,te)}}function iw(i,l,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(h){ow(i,l,h)},function(h){return Qg(i,l,h)}):ow(i,l,u)}function ow(i,l,u){l.status="fulfilled",l.value=u,aw(l),i.state=u,l=i.pending,l!==null&&(u=l.next,u===l?i.pending=null:(u=u.next,l.next=u,rw(i,u)))}function Qg(i,l,u){var h=i.pending;if(i.pending=null,h!==null){h=h.next;do l.status="rejected",l.reason=u,aw(l),l=l.next;while(l!==h)}i.action=null}function aw(i){i=i.listeners;for(var l=0;l<i.length;l++)(0,i[l])()}function sw(i,l){return l}function lw(i,l){if(Nt){var u=sn.formState;if(u!==null){e:{var h=xt;if(Nt){if(vn){t:{for(var x=vn,S=Si;x.nodeType!==8;){if(!S){x=null;break t}if(x=ji(x.nextSibling),x===null){x=null;break t}}S=x.data,x=S==="F!"||S==="F"?x:null}if(x){vn=ji(x.nextSibling),h=x.data==="F!";break e}}Na(h)}h=!1}h&&(l=u[0])}}return u=Rr(),u.memoizedState=u.baseState=l,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sw,lastRenderedState:l},u.queue=h,u=Rw.bind(null,xt,h),h.dispatch=u,h=Wg(!1),S=ev.bind(null,xt,!1,h.queue),h=Rr(),x={state:l,dispatch:null,action:i,pending:null},h.queue=x,u=rO.bind(null,xt,x,S,u),x.dispatch=u,h.memoizedState=i,[l,u,!1]}function cw(i){var l=Vn();return uw(l,tn,i)}function uw(i,l,u){if(l=qg(i,l,sw)[0],i=zf(Xo)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var h=Tu(l)}catch(D){throw D===Gl?_f:D}else h=l;l=Vn();var x=l.queue,S=x.dispatch;return u!==l.memoizedState&&(xt.flags|=2048,Xl(9,{destroy:void 0},iO.bind(null,x,u),null)),[h,S,i]}function iO(i,l){i.action=l}function dw(i){var l=Vn(),u=tn;if(u!==null)return uw(l,u,i);Vn(),l=l.memoizedState,u=Vn();var h=u.queue.dispatch;return u.memoizedState=i,[l,h,!1]}function Xl(i,l,u,h){return i={tag:i,create:u,deps:h,inst:l,next:null},l=xt.updateQueue,l===null&&(l=Lf(),xt.updateQueue=l),u=l.lastEffect,u===null?l.lastEffect=i.next=i:(h=u.next,u.next=i,i.next=h,l.lastEffect=i),i}function fw(){return Vn().memoizedState}function $f(i,l,u,h){var x=Rr();xt.flags|=i,x.memoizedState=Xl(1|l,{destroy:void 0},u,h===void 0?null:h)}function Uf(i,l,u,h){var x=Vn();h=h===void 0?null:h;var S=x.memoizedState.inst;tn!==null&&h!==null&&$g(h,tn.memoizedState.deps)?x.memoizedState=Xl(l,S,u,h):(xt.flags|=i,x.memoizedState=Xl(1|l,S,u,h))}function hw(i,l){$f(8390656,8,i,l)}function Yg(i,l){Uf(2048,8,i,l)}function oO(i){xt.flags|=4;var l=xt.updateQueue;if(l===null)l=Lf(),xt.updateQueue=l,l.events=[i];else{var u=l.events;u===null?l.events=[i]:u.push(i)}}function pw(i){var l=Vn().memoizedState;return oO({ref:l,nextImpl:i}),function(){if((Gt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function mw(i,l){return Uf(4,2,i,l)}function gw(i,l){return Uf(4,4,i,l)}function vw(i,l){if(typeof l=="function"){i=i();var u=l(i);return function(){typeof u=="function"?u():l(null)}}if(l!=null)return i=i(),l.current=i,function(){l.current=null}}function yw(i,l,u){u=u!=null?u.concat([i]):null,Uf(4,4,vw.bind(null,l,i),u)}function Kg(){}function xw(i,l){var u=Vn();l=l===void 0?null:l;var h=u.memoizedState;return l!==null&&$g(l,h[1])?h[0]:(u.memoizedState=[i,l],i)}function bw(i,l){var u=Vn();l=l===void 0?null:l;var h=u.memoizedState;if(l!==null&&$g(l,h[1]))return h[0];if(h=i(),Is){Zn(!0);try{i()}finally{Zn(!1)}}return u.memoizedState=[h,l],h}function Xg(i,l,u){return u===void 0||(Ko&1073741824)!==0&&(At&261930)===0?i.memoizedState=l:(i.memoizedState=u,i=Sj(),xt.lanes|=i,Va|=i,u)}function Sw(i,l,u,h){return ei(u,l)?u:Ql.current!==null?(i=Xg(i,u,h),ei(i,l)||(Xn=!0),i):(Ko&42)===0||(Ko&1073741824)!==0&&(At&261930)===0?(Xn=!0,i.memoizedState=u):(i=Sj(),xt.lanes|=i,Va|=i,l)}function ww(i,l,u,h,x){var S=I.p;I.p=S!==0&&8>S?S:8;var D=M.T,P={};M.T=P,ev(i,!1,l,u);try{var q=x(),te=M.S;if(te!==null&&te(P,q),q!==null&&typeof q=="object"&&typeof q.then=="function"){var fe=eO(q,h);Ru(i,l,fe,ai(i))}else Ru(i,l,h,ai(i))}catch(ye){Ru(i,l,{then:function(){},status:"rejected",reason:ye},ai())}finally{I.p=S,D!==null&&P.types!==null&&(D.types=P.types),M.T=D}}function aO(){}function Jg(i,l,u,h){if(i.tag!==5)throw Error(r(476));var x=jw(i).queue;ww(i,x,l,z,u===null?aO:function(){return Cw(i),u(h)})}function jw(i){var l=i.memoizedState;if(l!==null)return l;l={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:z},next:null};var u={};return l.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xo,lastRenderedState:u},next:null},i.memoizedState=l,i=i.alternate,i!==null&&(i.memoizedState=l),l}function Cw(i){var l=jw(i);l.next===null&&(l=i.alternate.memoizedState),Ru(i,l.next.queue,{},ai())}function Zg(){return lr(Hu)}function Ew(){return Vn().memoizedState}function Tw(){return Vn().memoizedState}function sO(i){for(var l=i.return;l!==null;){switch(l.tag){case 24:case 3:var u=ai();i=La(u);var h=Ia(l,i,u);h!==null&&(qr(h,l,u),wu(h,l,u)),l={cache:_g()},i.payload=l;return}l=l.return}}function lO(i,l,u){var h=ai();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},Bf(i)?_w(l,u):(u=vg(i,l,u,h),u!==null&&(qr(u,i,h),Dw(u,l,h)))}function Rw(i,l,u){var h=ai();Ru(i,l,u,h)}function Ru(i,l,u,h){var x={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(Bf(i))_w(l,x);else{var S=i.alternate;if(i.lanes===0&&(S===null||S.lanes===0)&&(S=l.lastRenderedReducer,S!==null))try{var D=l.lastRenderedState,P=S(D,u);if(x.hasEagerState=!0,x.eagerState=P,ei(P,D))return Sf(i,l,x,0),sn===null&&bf(),!1}catch{}finally{}if(u=vg(i,l,x,h),u!==null)return qr(u,i,h),Dw(u,l,h),!0}return!1}function ev(i,l,u,h){if(h={lane:2,revertLane:Pv(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Bf(i)){if(l)throw Error(r(479))}else l=vg(i,u,h,2),l!==null&&qr(l,i,2)}function Bf(i){var l=i.alternate;return i===xt||l!==null&&l===xt}function _w(i,l){Yl=Of=!0;var u=i.pending;u===null?l.next=l:(l.next=u.next,u.next=l),i.pending=l}function Dw(i,l,u){if((u&4194048)!==0){var h=l.lanes;h&=i.pendingLanes,u|=h,l.lanes=u,Y(i,u)}}var _u={readContext:lr,use:If,useCallback:On,useContext:On,useEffect:On,useImperativeHandle:On,useLayoutEffect:On,useInsertionEffect:On,useMemo:On,useReducer:On,useRef:On,useState:On,useDebugValue:On,useDeferredValue:On,useTransition:On,useSyncExternalStore:On,useId:On,useHostTransitionStatus:On,useFormState:On,useActionState:On,useOptimistic:On,useMemoCache:On,useCacheRefresh:On};_u.useEffectEvent=On;var Aw={readContext:lr,use:If,useCallback:function(i,l){return Rr().memoizedState=[i,l===void 0?null:l],i},useContext:lr,useEffect:hw,useImperativeHandle:function(i,l,u){u=u!=null?u.concat([i]):null,$f(4194308,4,vw.bind(null,l,i),u)},useLayoutEffect:function(i,l){return $f(4194308,4,i,l)},useInsertionEffect:function(i,l){$f(4,2,i,l)},useMemo:function(i,l){var u=Rr();l=l===void 0?null:l;var h=i();if(Is){Zn(!0);try{i()}finally{Zn(!1)}}return u.memoizedState=[h,l],h},useReducer:function(i,l,u){var h=Rr();if(u!==void 0){var x=u(l);if(Is){Zn(!0);try{u(l)}finally{Zn(!1)}}}else x=l;return h.memoizedState=h.baseState=x,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:x},h.queue=i,i=i.dispatch=lO.bind(null,xt,i),[h.memoizedState,i]},useRef:function(i){var l=Rr();return i={current:i},l.memoizedState=i},useState:function(i){i=Wg(i);var l=i.queue,u=Rw.bind(null,xt,l);return l.dispatch=u,[i.memoizedState,u]},useDebugValue:Kg,useDeferredValue:function(i,l){var u=Rr();return Xg(u,i,l)},useTransition:function(){var i=Wg(!1);return i=ww.bind(null,xt,i.queue,!0,!1),Rr().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,l,u){var h=xt,x=Rr();if(Nt){if(u===void 0)throw Error(r(407));u=u()}else{if(u=l(),sn===null)throw Error(r(349));(At&127)!==0||X1(h,l,u)}x.memoizedState=u;var S={value:u,getSnapshot:l};return x.queue=S,hw(Z1.bind(null,h,S,i),[i]),h.flags|=2048,Xl(9,{destroy:void 0},J1.bind(null,h,S,u,l),null),u},useId:function(){var i=Rr(),l=sn.identifierPrefix;if(Nt){var u=co,h=lo;u=(h&~(1<<32-Nn(h)-1)).toString(32)+u,l="_"+l+"R_"+u,u=Mf++,0<u&&(l+="H"+u.toString(32)),l+="_"}else u=tO++,l="_"+l+"r_"+u.toString(32)+"_";return i.memoizedState=l},useHostTransitionStatus:Zg,useFormState:lw,useActionState:lw,useOptimistic:function(i){var l=Rr();l.memoizedState=l.baseState=i;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=u,l=ev.bind(null,xt,!0,u),u.dispatch=l,[i,l]},useMemoCache:Hg,useCacheRefresh:function(){return Rr().memoizedState=sO.bind(null,xt)},useEffectEvent:function(i){var l=Rr(),u={impl:i};return l.memoizedState=u,function(){if((Gt&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},tv={readContext:lr,use:If,useCallback:xw,useContext:lr,useEffect:Yg,useImperativeHandle:yw,useInsertionEffect:mw,useLayoutEffect:gw,useMemo:bw,useReducer:zf,useRef:fw,useState:function(){return zf(Xo)},useDebugValue:Kg,useDeferredValue:function(i,l){var u=Vn();return Sw(u,tn.memoizedState,i,l)},useTransition:function(){var i=zf(Xo)[0],l=Vn().memoizedState;return[typeof i=="boolean"?i:Tu(i),l]},useSyncExternalStore:K1,useId:Ew,useHostTransitionStatus:Zg,useFormState:cw,useActionState:cw,useOptimistic:function(i,l){var u=Vn();return nw(u,tn,i,l)},useMemoCache:Hg,useCacheRefresh:Tw};tv.useEffectEvent=pw;var kw={readContext:lr,use:If,useCallback:xw,useContext:lr,useEffect:Yg,useImperativeHandle:yw,useInsertionEffect:mw,useLayoutEffect:gw,useMemo:bw,useReducer:Gg,useRef:fw,useState:function(){return Gg(Xo)},useDebugValue:Kg,useDeferredValue:function(i,l){var u=Vn();return tn===null?Xg(u,i,l):Sw(u,tn.memoizedState,i,l)},useTransition:function(){var i=Gg(Xo)[0],l=Vn().memoizedState;return[typeof i=="boolean"?i:Tu(i),l]},useSyncExternalStore:K1,useId:Ew,useHostTransitionStatus:Zg,useFormState:dw,useActionState:dw,useOptimistic:function(i,l){var u=Vn();return tn!==null?nw(u,tn,i,l):(u.baseState=i,[i,u.queue.dispatch])},useMemoCache:Hg,useCacheRefresh:Tw};kw.useEffectEvent=pw;function nv(i,l,u,h){l=i.memoizedState,u=u(h,l),u=u==null?l:g({},l,u),i.memoizedState=u,i.lanes===0&&(i.updateQueue.baseState=u)}var rv={enqueueSetState:function(i,l,u){i=i._reactInternals;var h=ai(),x=La(h);x.payload=l,u!=null&&(x.callback=u),l=Ia(i,x,h),l!==null&&(qr(l,i,h),wu(l,i,h))},enqueueReplaceState:function(i,l,u){i=i._reactInternals;var h=ai(),x=La(h);x.tag=1,x.payload=l,u!=null&&(x.callback=u),l=Ia(i,x,h),l!==null&&(qr(l,i,h),wu(l,i,h))},enqueueForceUpdate:function(i,l){i=i._reactInternals;var u=ai(),h=La(u);h.tag=2,l!=null&&(h.callback=l),l=Ia(i,h,u),l!==null&&(qr(l,i,u),wu(l,i,u))}};function Pw(i,l,u,h,x,S,D){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(h,S,D):l.prototype&&l.prototype.isPureReactComponent?!pu(u,h)||!pu(x,S):!0}function Nw(i,l,u,h){i=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(u,h),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(u,h),l.state!==i&&rv.enqueueReplaceState(l,l.state,null)}function zs(i,l){var u=l;if("ref"in l){u={};for(var h in l)h!=="ref"&&(u[h]=l[h])}if(i=i.defaultProps){u===l&&(u=g({},u));for(var x in i)u[x]===void 0&&(u[x]=i[x])}return u}function Ow(i){xf(i)}function Mw(i){console.error(i)}function Lw(i){xf(i)}function Vf(i,l){try{var u=i.onUncaughtError;u(l.value,{componentStack:l.stack})}catch(h){setTimeout(function(){throw h})}}function Iw(i,l,u){try{var h=i.onCaughtError;h(u.value,{componentStack:u.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(x){setTimeout(function(){throw x})}}function iv(i,l,u){return u=La(u),u.tag=3,u.payload={element:null},u.callback=function(){Vf(i,l)},u}function zw(i){return i=La(i),i.tag=3,i}function $w(i,l,u,h){var x=u.type.getDerivedStateFromError;if(typeof x=="function"){var S=h.value;i.payload=function(){return x(S)},i.callback=function(){Iw(l,u,h)}}var D=u.stateNode;D!==null&&typeof D.componentDidCatch=="function"&&(i.callback=function(){Iw(l,u,h),typeof x!="function"&&(Fa===null?Fa=new Set([this]):Fa.add(this));var P=h.stack;this.componentDidCatch(h.value,{componentStack:P!==null?P:""})})}function cO(i,l,u,h,x){if(u.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(l=u.alternate,l!==null&&Fl(l,u,x,!0),u=ni.current,u!==null){switch(u.tag){case 31:case 13:return wi===null?eh():u.alternate===null&&Mn===0&&(Mn=3),u.flags&=-257,u.flags|=65536,u.lanes=x,h===Df?u.flags|=16384:(l=u.updateQueue,l===null?u.updateQueue=new Set([h]):l.add(h),Dv(i,h,x)),!1;case 22:return u.flags|=65536,h===Df?u.flags|=16384:(l=u.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([h])},u.updateQueue=l):(u=l.retryQueue,u===null?l.retryQueue=new Set([h]):u.add(h)),Dv(i,h,x)),!1}throw Error(r(435,u.tag))}return Dv(i,h,x),eh(),!1}if(Nt)return l=ni.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=x,h!==jg&&(i=Error(r(422),{cause:h}),vu(yi(i,u)))):(h!==jg&&(l=Error(r(423),{cause:h}),vu(yi(l,u))),i=i.current.alternate,i.flags|=65536,x&=-x,i.lanes|=x,h=yi(h,u),x=iv(i.stateNode,h,x),Og(i,x),Mn!==4&&(Mn=2)),!1;var S=Error(r(520),{cause:h});if(S=yi(S,u),Lu===null?Lu=[S]:Lu.push(S),Mn!==4&&(Mn=2),l===null)return!0;h=yi(h,u),u=l;do{switch(u.tag){case 3:return u.flags|=65536,i=x&-x,u.lanes|=i,i=iv(u.stateNode,h,i),Og(u,i),!1;case 1:if(l=u.type,S=u.stateNode,(u.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Fa===null||!Fa.has(S))))return u.flags|=65536,x&=-x,u.lanes|=x,x=zw(x),$w(x,i,u,h),Og(u,x),!1}u=u.return}while(u!==null);return!1}var ov=Error(r(461)),Xn=!1;function cr(i,l,u,h){l.child=i===null?F1(l,null,u,h):Ls(l,i.child,u,h)}function Uw(i,l,u,h,x){u=u.render;var S=l.ref;if("ref"in h){var D={};for(var P in h)P!=="ref"&&(D[P]=h[P])}else D=h;return Ps(l),h=Ug(i,l,u,D,S,x),P=Bg(),i!==null&&!Xn?(Vg(i,l,x),Jo(i,l,x)):(Nt&&P&&Sg(l),l.flags|=1,cr(i,l,h,x),l.child)}function Bw(i,l,u,h,x){if(i===null){var S=u.type;return typeof S=="function"&&!yg(S)&&S.defaultProps===void 0&&u.compare===null?(l.tag=15,l.type=S,Vw(i,l,S,h,x)):(i=jf(u.type,null,h,l,l.mode,x),i.ref=l.ref,i.return=l,l.child=i)}if(S=i.child,!hv(i,x)){var D=S.memoizedProps;if(u=u.compare,u=u!==null?u:pu,u(D,h)&&i.ref===l.ref)return Jo(i,l,x)}return l.flags|=1,i=Go(S,h),i.ref=l.ref,i.return=l,l.child=i}function Vw(i,l,u,h,x){if(i!==null){var S=i.memoizedProps;if(pu(S,h)&&i.ref===l.ref)if(Xn=!1,l.pendingProps=h=S,hv(i,x))(i.flags&131072)!==0&&(Xn=!0);else return l.lanes=i.lanes,Jo(i,l,x)}return av(i,l,u,h,x)}function Fw(i,l,u,h){var x=h.children,S=i!==null?i.memoizedState:null;if(i===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((l.flags&128)!==0){if(S=S!==null?S.baseLanes|u:u,i!==null){for(h=l.child=i.child,x=0;h!==null;)x=x|h.lanes|h.childLanes,h=h.sibling;h=x&~S}else h=0,l.child=null;return Hw(i,l,S,u,h)}if((u&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},i!==null&&Rf(l,S!==null?S.cachePool:null),S!==null?G1(l,S):Lg(),W1(l);else return h=l.lanes=536870912,Hw(i,l,S!==null?S.baseLanes|u:u,u,h)}else S!==null?(Rf(l,S.cachePool),G1(l,S),$a(),l.memoizedState=null):(i!==null&&Rf(l,null),Lg(),$a());return cr(i,l,x,u),l.child}function Du(i,l){return i!==null&&i.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function Hw(i,l,u,h,x){var S=Ag();return S=S===null?null:{parent:Yn._currentValue,pool:S},l.memoizedState={baseLanes:u,cachePool:S},i!==null&&Rf(l,null),Lg(),W1(l),i!==null&&Fl(i,l,h,!0),l.childLanes=x,null}function Ff(i,l){return l=qf({mode:l.mode,children:l.children},i.mode),l.ref=i.ref,i.child=l,l.return=i,l}function qw(i,l,u){return Ls(l,i.child,null,u),i=Ff(l,l.pendingProps),i.flags|=2,ri(l),l.memoizedState=null,i}function uO(i,l,u){var h=l.pendingProps,x=(l.flags&128)!==0;if(l.flags&=-129,i===null){if(Nt){if(h.mode==="hidden")return i=Ff(l,h),l.lanes=536870912,Du(null,i);if(zg(l),(i=vn)?(i=rC(i,Si),i=i!==null&&i.data==="&"?i:null,i!==null&&(l.memoizedState={dehydrated:i,treeContext:ka!==null?{id:lo,overflow:co}:null,retryLane:536870912,hydrationErrors:null},u=_1(i),u.return=l,l.child=u,sr=l,vn=null)):i=null,i===null)throw Na(l);return l.lanes=536870912,null}return Ff(l,h)}var S=i.memoizedState;if(S!==null){var D=S.dehydrated;if(zg(l),x)if(l.flags&256)l.flags&=-257,l=qw(i,l,u);else if(l.memoizedState!==null)l.child=i.child,l.flags|=128,l=null;else throw Error(r(558));else if(Xn||Fl(i,l,u,!1),x=(u&i.childLanes)!==0,Xn||x){if(h=sn,h!==null&&(D=ie(h,u),D!==0&&D!==S.retryLane))throw S.retryLane=D,_s(i,D),qr(h,i,D),ov;eh(),l=qw(i,l,u)}else i=S.treeContext,vn=ji(D.nextSibling),sr=l,Nt=!0,Pa=null,Si=!1,i!==null&&k1(l,i),l=Ff(l,h),l.flags|=4096;return l}return i=Go(i.child,{mode:h.mode,children:h.children}),i.ref=l.ref,l.child=i,i.return=l,i}function Hf(i,l){var u=l.ref;if(u===null)i!==null&&i.ref!==null&&(l.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(i===null||i.ref!==u)&&(l.flags|=4194816)}}function av(i,l,u,h,x){return Ps(l),u=Ug(i,l,u,h,void 0,x),h=Bg(),i!==null&&!Xn?(Vg(i,l,x),Jo(i,l,x)):(Nt&&h&&Sg(l),l.flags|=1,cr(i,l,u,x),l.child)}function Gw(i,l,u,h,x,S){return Ps(l),l.updateQueue=null,u=Y1(l,h,u,x),Q1(i),h=Bg(),i!==null&&!Xn?(Vg(i,l,S),Jo(i,l,S)):(Nt&&h&&Sg(l),l.flags|=1,cr(i,l,u,S),l.child)}function Ww(i,l,u,h,x){if(Ps(l),l.stateNode===null){var S=$l,D=u.contextType;typeof D=="object"&&D!==null&&(S=lr(D)),S=new u(h,S),l.memoizedState=S.state!==null&&S.state!==void 0?S.state:null,S.updater=rv,l.stateNode=S,S._reactInternals=l,S=l.stateNode,S.props=h,S.state=l.memoizedState,S.refs={},Pg(l),D=u.contextType,S.context=typeof D=="object"&&D!==null?lr(D):$l,S.state=l.memoizedState,D=u.getDerivedStateFromProps,typeof D=="function"&&(nv(l,u,D,h),S.state=l.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof S.getSnapshotBeforeUpdate=="function"||typeof S.UNSAFE_componentWillMount!="function"&&typeof S.componentWillMount!="function"||(D=S.state,typeof S.componentWillMount=="function"&&S.componentWillMount(),typeof S.UNSAFE_componentWillMount=="function"&&S.UNSAFE_componentWillMount(),D!==S.state&&rv.enqueueReplaceState(S,S.state,null),Cu(l,h,S,x),ju(),S.state=l.memoizedState),typeof S.componentDidMount=="function"&&(l.flags|=4194308),h=!0}else if(i===null){S=l.stateNode;var P=l.memoizedProps,q=zs(u,P);S.props=q;var te=S.context,fe=u.contextType;D=$l,typeof fe=="object"&&fe!==null&&(D=lr(fe));var ye=u.getDerivedStateFromProps;fe=typeof ye=="function"||typeof S.getSnapshotBeforeUpdate=="function",P=l.pendingProps!==P,fe||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(P||te!==D)&&Nw(l,S,h,D),Ma=!1;var re=l.memoizedState;S.state=re,Cu(l,h,S,x),ju(),te=l.memoizedState,P||re!==te||Ma?(typeof ye=="function"&&(nv(l,u,ye,h),te=l.memoizedState),(q=Ma||Pw(l,u,q,h,re,te,D))?(fe||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"&&(l.flags|=4194308)):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=h,l.memoizedState=te),S.props=h,S.state=te,S.context=D,h=q):(typeof S.componentDidMount=="function"&&(l.flags|=4194308),h=!1)}else{S=l.stateNode,Ng(i,l),D=l.memoizedProps,fe=zs(u,D),S.props=fe,ye=l.pendingProps,re=S.context,te=u.contextType,q=$l,typeof te=="object"&&te!==null&&(q=lr(te)),P=u.getDerivedStateFromProps,(te=typeof P=="function"||typeof S.getSnapshotBeforeUpdate=="function")||typeof S.UNSAFE_componentWillReceiveProps!="function"&&typeof S.componentWillReceiveProps!="function"||(D!==ye||re!==q)&&Nw(l,S,h,q),Ma=!1,re=l.memoizedState,S.state=re,Cu(l,h,S,x),ju();var se=l.memoizedState;D!==ye||re!==se||Ma||i!==null&&i.dependencies!==null&&Ef(i.dependencies)?(typeof P=="function"&&(nv(l,u,P,h),se=l.memoizedState),(fe=Ma||Pw(l,u,fe,h,re,se,q)||i!==null&&i.dependencies!==null&&Ef(i.dependencies))?(te||typeof S.UNSAFE_componentWillUpdate!="function"&&typeof S.componentWillUpdate!="function"||(typeof S.componentWillUpdate=="function"&&S.componentWillUpdate(h,se,q),typeof S.UNSAFE_componentWillUpdate=="function"&&S.UNSAFE_componentWillUpdate(h,se,q)),typeof S.componentDidUpdate=="function"&&(l.flags|=4),typeof S.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof S.componentDidUpdate!="function"||D===i.memoizedProps&&re===i.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||D===i.memoizedProps&&re===i.memoizedState||(l.flags|=1024),l.memoizedProps=h,l.memoizedState=se),S.props=h,S.state=se,S.context=q,h=fe):(typeof S.componentDidUpdate!="function"||D===i.memoizedProps&&re===i.memoizedState||(l.flags|=4),typeof S.getSnapshotBeforeUpdate!="function"||D===i.memoizedProps&&re===i.memoizedState||(l.flags|=1024),h=!1)}return S=h,Hf(i,l),h=(l.flags&128)!==0,S||h?(S=l.stateNode,u=h&&typeof u.getDerivedStateFromError!="function"?null:S.render(),l.flags|=1,i!==null&&h?(l.child=Ls(l,i.child,null,x),l.child=Ls(l,null,u,x)):cr(i,l,u,x),l.memoizedState=S.state,i=l.child):i=Jo(i,l,x),i}function Qw(i,l,u,h){return As(),l.flags|=256,cr(i,l,u,h),l.child}var sv={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function lv(i){return{baseLanes:i,cachePool:I1()}}function cv(i,l,u){return i=i!==null?i.childLanes&~u:0,l&&(i|=oi),i}function Yw(i,l,u){var h=l.pendingProps,x=!1,S=(l.flags&128)!==0,D;if((D=S)||(D=i!==null&&i.memoizedState===null?!1:(Bn.current&2)!==0),D&&(x=!0,l.flags&=-129),D=(l.flags&32)!==0,l.flags&=-33,i===null){if(Nt){if(x?za(l):$a(),(i=vn)?(i=rC(i,Si),i=i!==null&&i.data!=="&"?i:null,i!==null&&(l.memoizedState={dehydrated:i,treeContext:ka!==null?{id:lo,overflow:co}:null,retryLane:536870912,hydrationErrors:null},u=_1(i),u.return=l,l.child=u,sr=l,vn=null)):i=null,i===null)throw Na(l);return qv(i)?l.lanes=32:l.lanes=536870912,null}var P=h.children;return h=h.fallback,x?($a(),x=l.mode,P=qf({mode:"hidden",children:P},x),h=Ds(h,x,u,null),P.return=l,h.return=l,P.sibling=h,l.child=P,h=l.child,h.memoizedState=lv(u),h.childLanes=cv(i,D,u),l.memoizedState=sv,Du(null,h)):(za(l),uv(l,P))}var q=i.memoizedState;if(q!==null&&(P=q.dehydrated,P!==null)){if(S)l.flags&256?(za(l),l.flags&=-257,l=dv(i,l,u)):l.memoizedState!==null?($a(),l.child=i.child,l.flags|=128,l=null):($a(),P=h.fallback,x=l.mode,h=qf({mode:"visible",children:h.children},x),P=Ds(P,x,u,null),P.flags|=2,h.return=l,P.return=l,h.sibling=P,l.child=h,Ls(l,i.child,null,u),h=l.child,h.memoizedState=lv(u),h.childLanes=cv(i,D,u),l.memoizedState=sv,l=Du(null,h));else if(za(l),qv(P)){if(D=P.nextSibling&&P.nextSibling.dataset,D)var te=D.dgst;D=te,h=Error(r(419)),h.stack="",h.digest=D,vu({value:h,source:null,stack:null}),l=dv(i,l,u)}else if(Xn||Fl(i,l,u,!1),D=(u&i.childLanes)!==0,Xn||D){if(D=sn,D!==null&&(h=ie(D,u),h!==0&&h!==q.retryLane))throw q.retryLane=h,_s(i,h),qr(D,i,h),ov;Hv(P)||eh(),l=dv(i,l,u)}else Hv(P)?(l.flags|=192,l.child=i.child,l=null):(i=q.treeContext,vn=ji(P.nextSibling),sr=l,Nt=!0,Pa=null,Si=!1,i!==null&&k1(l,i),l=uv(l,h.children),l.flags|=4096);return l}return x?($a(),P=h.fallback,x=l.mode,q=i.child,te=q.sibling,h=Go(q,{mode:"hidden",children:h.children}),h.subtreeFlags=q.subtreeFlags&65011712,te!==null?P=Go(te,P):(P=Ds(P,x,u,null),P.flags|=2),P.return=l,h.return=l,h.sibling=P,l.child=h,Du(null,h),h=l.child,P=i.child.memoizedState,P===null?P=lv(u):(x=P.cachePool,x!==null?(q=Yn._currentValue,x=x.parent!==q?{parent:q,pool:q}:x):x=I1(),P={baseLanes:P.baseLanes|u,cachePool:x}),h.memoizedState=P,h.childLanes=cv(i,D,u),l.memoizedState=sv,Du(i.child,h)):(za(l),u=i.child,i=u.sibling,u=Go(u,{mode:"visible",children:h.children}),u.return=l,u.sibling=null,i!==null&&(D=l.deletions,D===null?(l.deletions=[i],l.flags|=16):D.push(i)),l.child=u,l.memoizedState=null,u)}function uv(i,l){return l=qf({mode:"visible",children:l},i.mode),l.return=i,i.child=l}function qf(i,l){return i=ti(22,i,null,l),i.lanes=0,i}function dv(i,l,u){return Ls(l,i.child,null,u),i=uv(l,l.pendingProps.children),i.flags|=2,l.memoizedState=null,i}function Kw(i,l,u){i.lanes|=l;var h=i.alternate;h!==null&&(h.lanes|=l),Tg(i.return,l,u)}function fv(i,l,u,h,x,S){var D=i.memoizedState;D===null?i.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:h,tail:u,tailMode:x,treeForkCount:S}:(D.isBackwards=l,D.rendering=null,D.renderingStartTime=0,D.last=h,D.tail=u,D.tailMode=x,D.treeForkCount=S)}function Xw(i,l,u){var h=l.pendingProps,x=h.revealOrder,S=h.tail;h=h.children;var D=Bn.current,P=(D&2)!==0;if(P?(D=D&1|2,l.flags|=128):D&=1,oe(Bn,D),cr(i,l,h,u),h=Nt?gu:0,!P&&i!==null&&(i.flags&128)!==0)e:for(i=l.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Kw(i,u,l);else if(i.tag===19)Kw(i,u,l);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===l)break e;for(;i.sibling===null;){if(i.return===null||i.return===l)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(x){case"forwards":for(u=l.child,x=null;u!==null;)i=u.alternate,i!==null&&Nf(i)===null&&(x=u),u=u.sibling;u=x,u===null?(x=l.child,l.child=null):(x=u.sibling,u.sibling=null),fv(l,!1,x,u,S,h);break;case"backwards":case"unstable_legacy-backwards":for(u=null,x=l.child,l.child=null;x!==null;){if(i=x.alternate,i!==null&&Nf(i)===null){l.child=x;break}i=x.sibling,x.sibling=u,u=x,x=i}fv(l,!0,u,null,S,h);break;case"together":fv(l,!1,null,null,void 0,h);break;default:l.memoizedState=null}return l.child}function Jo(i,l,u){if(i!==null&&(l.dependencies=i.dependencies),Va|=l.lanes,(u&l.childLanes)===0)if(i!==null){if(Fl(i,l,u,!1),(u&l.childLanes)===0)return null}else return null;if(i!==null&&l.child!==i.child)throw Error(r(153));if(l.child!==null){for(i=l.child,u=Go(i,i.pendingProps),l.child=u,u.return=l;i.sibling!==null;)i=i.sibling,u=u.sibling=Go(i,i.pendingProps),u.return=l;u.sibling=null}return l.child}function hv(i,l){return(i.lanes&l)!==0?!0:(i=i.dependencies,!!(i!==null&&Ef(i)))}function dO(i,l,u){switch(l.tag){case 3:rt(l,l.stateNode.containerInfo),Oa(l,Yn,i.memoizedState.cache),As();break;case 27:case 5:ht(l);break;case 4:rt(l,l.stateNode.containerInfo);break;case 10:Oa(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,zg(l),null;break;case 13:var h=l.memoizedState;if(h!==null)return h.dehydrated!==null?(za(l),l.flags|=128,null):(u&l.child.childLanes)!==0?Yw(i,l,u):(za(l),i=Jo(i,l,u),i!==null?i.sibling:null);za(l);break;case 19:var x=(i.flags&128)!==0;if(h=(u&l.childLanes)!==0,h||(Fl(i,l,u,!1),h=(u&l.childLanes)!==0),x){if(h)return Xw(i,l,u);l.flags|=128}if(x=l.memoizedState,x!==null&&(x.rendering=null,x.tail=null,x.lastEffect=null),oe(Bn,Bn.current),h)break;return null;case 22:return l.lanes=0,Fw(i,l,u,l.pendingProps);case 24:Oa(l,Yn,i.memoizedState.cache)}return Jo(i,l,u)}function Jw(i,l,u){if(i!==null)if(i.memoizedProps!==l.pendingProps)Xn=!0;else{if(!hv(i,u)&&(l.flags&128)===0)return Xn=!1,dO(i,l,u);Xn=(i.flags&131072)!==0}else Xn=!1,Nt&&(l.flags&1048576)!==0&&A1(l,gu,l.index);switch(l.lanes=0,l.tag){case 16:e:{var h=l.pendingProps;if(i=Os(l.elementType),l.type=i,typeof i=="function")yg(i)?(h=zs(i,h),l.tag=1,l=Ww(null,l,i,h,u)):(l.tag=0,l=av(null,l,i,h,u));else{if(i!=null){var x=i.$$typeof;if(x===_){l.tag=11,l=Uw(null,l,i,h,u);break e}else if(x===A){l.tag=14,l=Bw(null,l,i,h,u);break e}}throw l=$(i)||i,Error(r(306,l,""))}}return l;case 0:return av(i,l,l.type,l.pendingProps,u);case 1:return h=l.type,x=zs(h,l.pendingProps),Ww(i,l,h,x,u);case 3:e:{if(rt(l,l.stateNode.containerInfo),i===null)throw Error(r(387));h=l.pendingProps;var S=l.memoizedState;x=S.element,Ng(i,l),Cu(l,h,null,u);var D=l.memoizedState;if(h=D.cache,Oa(l,Yn,h),h!==S.cache&&Rg(l,[Yn],u,!0),ju(),h=D.element,S.isDehydrated)if(S={element:h,isDehydrated:!1,cache:D.cache},l.updateQueue.baseState=S,l.memoizedState=S,l.flags&256){l=Qw(i,l,h,u);break e}else if(h!==x){x=yi(Error(r(424)),l),vu(x),l=Qw(i,l,h,u);break e}else{switch(i=l.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(vn=ji(i.firstChild),sr=l,Nt=!0,Pa=null,Si=!0,u=F1(l,null,h,u),l.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(As(),h===x){l=Jo(i,l,u);break e}cr(i,l,h,u)}l=l.child}return l;case 26:return Hf(i,l),i===null?(u=cC(l.type,null,l.pendingProps,null))?l.memoizedState=u:Nt||(u=l.type,i=l.pendingProps,h=sh(ge.current).createElement(u),h[Me]=l,h[Ve]=i,ur(h,u,i),Xt(h),l.stateNode=h):l.memoizedState=cC(l.type,i.memoizedProps,l.pendingProps,i.memoizedState),null;case 27:return ht(l),i===null&&Nt&&(h=l.stateNode=aC(l.type,l.pendingProps,ge.current),sr=l,Si=!0,x=vn,Wa(l.type)?(Gv=x,vn=ji(h.firstChild)):vn=x),cr(i,l,l.pendingProps.children,u),Hf(i,l),i===null&&(l.flags|=4194304),l.child;case 5:return i===null&&Nt&&((x=h=vn)&&(h=BO(h,l.type,l.pendingProps,Si),h!==null?(l.stateNode=h,sr=l,vn=ji(h.firstChild),Si=!1,x=!0):x=!1),x||Na(l)),ht(l),x=l.type,S=l.pendingProps,D=i!==null?i.memoizedProps:null,h=S.children,Bv(x,S)?h=null:D!==null&&Bv(x,D)&&(l.flags|=32),l.memoizedState!==null&&(x=Ug(i,l,nO,null,null,u),Hu._currentValue=x),Hf(i,l),cr(i,l,h,u),l.child;case 6:return i===null&&Nt&&((i=u=vn)&&(u=VO(u,l.pendingProps,Si),u!==null?(l.stateNode=u,sr=l,vn=null,i=!0):i=!1),i||Na(l)),null;case 13:return Yw(i,l,u);case 4:return rt(l,l.stateNode.containerInfo),h=l.pendingProps,i===null?l.child=Ls(l,null,h,u):cr(i,l,h,u),l.child;case 11:return Uw(i,l,l.type,l.pendingProps,u);case 7:return cr(i,l,l.pendingProps,u),l.child;case 8:return cr(i,l,l.pendingProps.children,u),l.child;case 12:return cr(i,l,l.pendingProps.children,u),l.child;case 10:return h=l.pendingProps,Oa(l,l.type,h.value),cr(i,l,h.children,u),l.child;case 9:return x=l.type._context,h=l.pendingProps.children,Ps(l),x=lr(x),h=h(x),l.flags|=1,cr(i,l,h,u),l.child;case 14:return Bw(i,l,l.type,l.pendingProps,u);case 15:return Vw(i,l,l.type,l.pendingProps,u);case 19:return Xw(i,l,u);case 31:return uO(i,l,u);case 22:return Fw(i,l,u,l.pendingProps);case 24:return Ps(l),h=lr(Yn),i===null?(x=Ag(),x===null&&(x=sn,S=_g(),x.pooledCache=S,S.refCount++,S!==null&&(x.pooledCacheLanes|=u),x=S),l.memoizedState={parent:h,cache:x},Pg(l),Oa(l,Yn,x)):((i.lanes&u)!==0&&(Ng(i,l),Cu(l,null,null,u),ju()),x=i.memoizedState,S=l.memoizedState,x.parent!==h?(x={parent:h,cache:h},l.memoizedState=x,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=x),Oa(l,Yn,h)):(h=S.cache,Oa(l,Yn,h),h!==x.cache&&Rg(l,[Yn],u,!0))),cr(i,l,l.pendingProps.children,u),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function Zo(i){i.flags|=4}function pv(i,l,u,h,x){if((l=(i.mode&32)!==0)&&(l=!1),l){if(i.flags|=16777216,(x&335544128)===x)if(i.stateNode.complete)i.flags|=8192;else if(Ej())i.flags|=8192;else throw Ms=Df,kg}else i.flags&=-16777217}function Zw(i,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!pC(l))if(Ej())i.flags|=8192;else throw Ms=Df,kg}function Gf(i,l){l!==null&&(i.flags|=4),i.flags&16384&&(l=i.tag!==22?Vo():536870912,i.lanes|=l,tc|=l)}function Au(i,l){if(!Nt)switch(i.tailMode){case"hidden":l=i.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?i.tail=null:u.sibling=null;break;case"collapsed":u=i.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?l||i.tail===null?i.tail=null:i.tail.sibling=null:h.sibling=null}}function yn(i){var l=i.alternate!==null&&i.alternate.child===i.child,u=0,h=0;if(l)for(var x=i.child;x!==null;)u|=x.lanes|x.childLanes,h|=x.subtreeFlags&65011712,h|=x.flags&65011712,x.return=i,x=x.sibling;else for(x=i.child;x!==null;)u|=x.lanes|x.childLanes,h|=x.subtreeFlags,h|=x.flags,x.return=i,x=x.sibling;return i.subtreeFlags|=h,i.childLanes=u,l}function fO(i,l,u){var h=l.pendingProps;switch(wg(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return yn(l),null;case 1:return yn(l),null;case 3:return u=l.stateNode,h=null,i!==null&&(h=i.memoizedState.cache),l.memoizedState.cache!==h&&(l.flags|=2048),Yo(Yn),Ce(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(i===null||i.child===null)&&(Vl(l)?Zo(l):i===null||i.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Cg())),yn(l),null;case 26:var x=l.type,S=l.memoizedState;return i===null?(Zo(l),S!==null?(yn(l),Zw(l,S)):(yn(l),pv(l,x,null,h,u))):S?S!==i.memoizedState?(Zo(l),yn(l),Zw(l,S)):(yn(l),l.flags&=-16777217):(i=i.memoizedProps,i!==h&&Zo(l),yn(l),pv(l,x,i,h,u)),null;case 27:if(lt(l),u=ge.current,x=l.type,i!==null&&l.stateNode!=null)i.memoizedProps!==h&&Zo(l);else{if(!h){if(l.stateNode===null)throw Error(r(166));return yn(l),null}i=ue.current,Vl(l)?P1(l):(i=aC(x,h,u),l.stateNode=i,Zo(l))}return yn(l),null;case 5:if(lt(l),x=l.type,i!==null&&l.stateNode!=null)i.memoizedProps!==h&&Zo(l);else{if(!h){if(l.stateNode===null)throw Error(r(166));return yn(l),null}if(S=ue.current,Vl(l))P1(l);else{var D=sh(ge.current);switch(S){case 1:S=D.createElementNS("http://www.w3.org/2000/svg",x);break;case 2:S=D.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;default:switch(x){case"svg":S=D.createElementNS("http://www.w3.org/2000/svg",x);break;case"math":S=D.createElementNS("http://www.w3.org/1998/Math/MathML",x);break;case"script":S=D.createElement("div"),S.innerHTML="<script><\/script>",S=S.removeChild(S.firstChild);break;case"select":S=typeof h.is=="string"?D.createElement("select",{is:h.is}):D.createElement("select"),h.multiple?S.multiple=!0:h.size&&(S.size=h.size);break;default:S=typeof h.is=="string"?D.createElement(x,{is:h.is}):D.createElement(x)}}S[Me]=l,S[Ve]=h;e:for(D=l.child;D!==null;){if(D.tag===5||D.tag===6)S.appendChild(D.stateNode);else if(D.tag!==4&&D.tag!==27&&D.child!==null){D.child.return=D,D=D.child;continue}if(D===l)break e;for(;D.sibling===null;){if(D.return===null||D.return===l)break e;D=D.return}D.sibling.return=D.return,D=D.sibling}l.stateNode=S;e:switch(ur(S,x,h),x){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Zo(l)}}return yn(l),pv(l,l.type,i===null?null:i.memoizedProps,l.pendingProps,u),null;case 6:if(i&&l.stateNode!=null)i.memoizedProps!==h&&Zo(l);else{if(typeof h!="string"&&l.stateNode===null)throw Error(r(166));if(i=ge.current,Vl(l)){if(i=l.stateNode,u=l.memoizedProps,h=null,x=sr,x!==null)switch(x.tag){case 27:case 5:h=x.memoizedProps}i[Me]=l,i=!!(i.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||Yj(i.nodeValue,u)),i||Na(l,!0)}else i=sh(i).createTextNode(h),i[Me]=l,l.stateNode=i}return yn(l),null;case 31:if(u=l.memoizedState,i===null||i.memoizedState!==null){if(h=Vl(l),u!==null){if(i===null){if(!h)throw Error(r(318));if(i=l.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[Me]=l}else As(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;yn(l),i=!1}else u=Cg(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=u),i=!0;if(!i)return l.flags&256?(ri(l),l):(ri(l),null);if((l.flags&128)!==0)throw Error(r(558))}return yn(l),null;case 13:if(h=l.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(x=Vl(l),h!==null&&h.dehydrated!==null){if(i===null){if(!x)throw Error(r(318));if(x=l.memoizedState,x=x!==null?x.dehydrated:null,!x)throw Error(r(317));x[Me]=l}else As(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;yn(l),x=!1}else x=Cg(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=x),x=!0;if(!x)return l.flags&256?(ri(l),l):(ri(l),null)}return ri(l),(l.flags&128)!==0?(l.lanes=u,l):(u=h!==null,i=i!==null&&i.memoizedState!==null,u&&(h=l.child,x=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(x=h.alternate.memoizedState.cachePool.pool),S=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(S=h.memoizedState.cachePool.pool),S!==x&&(h.flags|=2048)),u!==i&&u&&(l.child.flags|=8192),Gf(l,l.updateQueue),yn(l),null);case 4:return Ce(),i===null&&Lv(l.stateNode.containerInfo),yn(l),null;case 10:return Yo(l.type),yn(l),null;case 19:if(H(Bn),h=l.memoizedState,h===null)return yn(l),null;if(x=(l.flags&128)!==0,S=h.rendering,S===null)if(x)Au(h,!1);else{if(Mn!==0||i!==null&&(i.flags&128)!==0)for(i=l.child;i!==null;){if(S=Nf(i),S!==null){for(l.flags|=128,Au(h,!1),i=S.updateQueue,l.updateQueue=i,Gf(l,i),l.subtreeFlags=0,i=u,u=l.child;u!==null;)R1(u,i),u=u.sibling;return oe(Bn,Bn.current&1|2),Nt&&Wo(l,h.treeForkCount),l.child}i=i.sibling}h.tail!==null&&ve()>Xf&&(l.flags|=128,x=!0,Au(h,!1),l.lanes=4194304)}else{if(!x)if(i=Nf(S),i!==null){if(l.flags|=128,x=!0,i=i.updateQueue,l.updateQueue=i,Gf(l,i),Au(h,!0),h.tail===null&&h.tailMode==="hidden"&&!S.alternate&&!Nt)return yn(l),null}else 2*ve()-h.renderingStartTime>Xf&&u!==536870912&&(l.flags|=128,x=!0,Au(h,!1),l.lanes=4194304);h.isBackwards?(S.sibling=l.child,l.child=S):(i=h.last,i!==null?i.sibling=S:l.child=S,h.last=S)}return h.tail!==null?(i=h.tail,h.rendering=i,h.tail=i.sibling,h.renderingStartTime=ve(),i.sibling=null,u=Bn.current,oe(Bn,x?u&1|2:u&1),Nt&&Wo(l,h.treeForkCount),i):(yn(l),null);case 22:case 23:return ri(l),Ig(),h=l.memoizedState!==null,i!==null?i.memoizedState!==null!==h&&(l.flags|=8192):h&&(l.flags|=8192),h?(u&536870912)!==0&&(l.flags&128)===0&&(yn(l),l.subtreeFlags&6&&(l.flags|=8192)):yn(l),u=l.updateQueue,u!==null&&Gf(l,u.retryQueue),u=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==u&&(l.flags|=2048),i!==null&&H(Ns),null;case 24:return u=null,i!==null&&(u=i.memoizedState.cache),l.memoizedState.cache!==u&&(l.flags|=2048),Yo(Yn),yn(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function hO(i,l){switch(wg(l),l.tag){case 1:return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 3:return Yo(Yn),Ce(),i=l.flags,(i&65536)!==0&&(i&128)===0?(l.flags=i&-65537|128,l):null;case 26:case 27:case 5:return lt(l),null;case 31:if(l.memoizedState!==null){if(ri(l),l.alternate===null)throw Error(r(340));As()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 13:if(ri(l),i=l.memoizedState,i!==null&&i.dehydrated!==null){if(l.alternate===null)throw Error(r(340));As()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 19:return H(Bn),null;case 4:return Ce(),null;case 10:return Yo(l.type),null;case 22:case 23:return ri(l),Ig(),i!==null&&H(Ns),i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 24:return Yo(Yn),null;case 25:return null;default:return null}}function ej(i,l){switch(wg(l),l.tag){case 3:Yo(Yn),Ce();break;case 26:case 27:case 5:lt(l);break;case 4:Ce();break;case 31:l.memoizedState!==null&&ri(l);break;case 13:ri(l);break;case 19:H(Bn);break;case 10:Yo(l.type);break;case 22:case 23:ri(l),Ig(),i!==null&&H(Ns);break;case 24:Yo(Yn)}}function ku(i,l){try{var u=l.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var x=h.next;u=x;do{if((u.tag&i)===i){h=void 0;var S=u.create,D=u.inst;h=S(),D.destroy=h}u=u.next}while(u!==x)}}catch(P){Zt(l,l.return,P)}}function Ua(i,l,u){try{var h=l.updateQueue,x=h!==null?h.lastEffect:null;if(x!==null){var S=x.next;h=S;do{if((h.tag&i)===i){var D=h.inst,P=D.destroy;if(P!==void 0){D.destroy=void 0,x=l;var q=u,te=P;try{te()}catch(fe){Zt(x,q,fe)}}}h=h.next}while(h!==S)}}catch(fe){Zt(l,l.return,fe)}}function tj(i){var l=i.updateQueue;if(l!==null){var u=i.stateNode;try{q1(l,u)}catch(h){Zt(i,i.return,h)}}}function nj(i,l,u){u.props=zs(i.type,i.memoizedProps),u.state=i.memoizedState;try{u.componentWillUnmount()}catch(h){Zt(i,l,h)}}function Pu(i,l){try{var u=i.ref;if(u!==null){switch(i.tag){case 26:case 27:case 5:var h=i.stateNode;break;case 30:h=i.stateNode;break;default:h=i.stateNode}typeof u=="function"?i.refCleanup=u(h):u.current=h}}catch(x){Zt(i,l,x)}}function uo(i,l){var u=i.ref,h=i.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(x){Zt(i,l,x)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(x){Zt(i,l,x)}else u.current=null}function rj(i){var l=i.type,u=i.memoizedProps,h=i.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":u.autoFocus&&h.focus();break e;case"img":u.src?h.src=u.src:u.srcSet&&(h.srcset=u.srcSet)}}catch(x){Zt(i,i.return,x)}}function mv(i,l,u){try{var h=i.stateNode;MO(h,i.type,u,l),h[Ve]=l}catch(x){Zt(i,i.return,x)}}function ij(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Wa(i.type)||i.tag===4}function gv(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||ij(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Wa(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function vv(i,l,u){var h=i.tag;if(h===5||h===6)i=i.stateNode,l?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(i,l):(l=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,l.appendChild(i),u=u._reactRootContainer,u!=null||l.onclick!==null||(l.onclick=Ho));else if(h!==4&&(h===27&&Wa(i.type)&&(u=i.stateNode,l=null),i=i.child,i!==null))for(vv(i,l,u),i=i.sibling;i!==null;)vv(i,l,u),i=i.sibling}function Wf(i,l,u){var h=i.tag;if(h===5||h===6)i=i.stateNode,l?u.insertBefore(i,l):u.appendChild(i);else if(h!==4&&(h===27&&Wa(i.type)&&(u=i.stateNode),i=i.child,i!==null))for(Wf(i,l,u),i=i.sibling;i!==null;)Wf(i,l,u),i=i.sibling}function oj(i){var l=i.stateNode,u=i.memoizedProps;try{for(var h=i.type,x=l.attributes;x.length;)l.removeAttributeNode(x[0]);ur(l,h,u),l[Me]=i,l[Ve]=u}catch(S){Zt(i,i.return,S)}}var ea=!1,Jn=!1,yv=!1,aj=typeof WeakSet=="function"?WeakSet:Set,nr=null;function pO(i,l){if(i=i.containerInfo,$v=ph,i=y1(i),dg(i)){if("selectionStart"in i)var u={start:i.selectionStart,end:i.selectionEnd};else e:{u=(u=i.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var x=h.anchorOffset,S=h.focusNode;h=h.focusOffset;try{u.nodeType,S.nodeType}catch{u=null;break e}var D=0,P=-1,q=-1,te=0,fe=0,ye=i,re=null;t:for(;;){for(var se;ye!==u||x!==0&&ye.nodeType!==3||(P=D+x),ye!==S||h!==0&&ye.nodeType!==3||(q=D+h),ye.nodeType===3&&(D+=ye.nodeValue.length),(se=ye.firstChild)!==null;)re=ye,ye=se;for(;;){if(ye===i)break t;if(re===u&&++te===x&&(P=D),re===S&&++fe===h&&(q=D),(se=ye.nextSibling)!==null)break;ye=re,re=ye.parentNode}ye=se}u=P===-1||q===-1?null:{start:P,end:q}}else u=null}u=u||{start:0,end:0}}else u=null;for(Uv={focusedElem:i,selectionRange:u},ph=!1,nr=l;nr!==null;)if(l=nr,i=l.child,(l.subtreeFlags&1028)!==0&&i!==null)i.return=l,nr=i;else for(;nr!==null;){switch(l=nr,S=l.alternate,i=l.flags,l.tag){case 0:if((i&4)!==0&&(i=l.updateQueue,i=i!==null?i.events:null,i!==null))for(u=0;u<i.length;u++)x=i[u],x.ref.impl=x.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&S!==null){i=void 0,u=l,x=S.memoizedProps,S=S.memoizedState,h=u.stateNode;try{var qe=zs(u.type,x);i=h.getSnapshotBeforeUpdate(qe,S),h.__reactInternalSnapshotBeforeUpdate=i}catch(ut){Zt(u,u.return,ut)}}break;case 3:if((i&1024)!==0){if(i=l.stateNode.containerInfo,u=i.nodeType,u===9)Fv(i);else if(u===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Fv(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=l.sibling,i!==null){i.return=l.return,nr=i;break}nr=l.return}}function sj(i,l,u){var h=u.flags;switch(u.tag){case 0:case 11:case 15:na(i,u),h&4&&ku(5,u);break;case 1:if(na(i,u),h&4)if(i=u.stateNode,l===null)try{i.componentDidMount()}catch(D){Zt(u,u.return,D)}else{var x=zs(u.type,l.memoizedProps);l=l.memoizedState;try{i.componentDidUpdate(x,l,i.__reactInternalSnapshotBeforeUpdate)}catch(D){Zt(u,u.return,D)}}h&64&&tj(u),h&512&&Pu(u,u.return);break;case 3:if(na(i,u),h&64&&(i=u.updateQueue,i!==null)){if(l=null,u.child!==null)switch(u.child.tag){case 27:case 5:l=u.child.stateNode;break;case 1:l=u.child.stateNode}try{q1(i,l)}catch(D){Zt(u,u.return,D)}}break;case 27:l===null&&h&4&&oj(u);case 26:case 5:na(i,u),l===null&&h&4&&rj(u),h&512&&Pu(u,u.return);break;case 12:na(i,u);break;case 31:na(i,u),h&4&&uj(i,u);break;case 13:na(i,u),h&4&&dj(i,u),h&64&&(i=u.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(u=jO.bind(null,u),FO(i,u))));break;case 22:if(h=u.memoizedState!==null||ea,!h){l=l!==null&&l.memoizedState!==null||Jn,x=ea;var S=Jn;ea=h,(Jn=l)&&!S?ra(i,u,(u.subtreeFlags&8772)!==0):na(i,u),ea=x,Jn=S}break;case 30:break;default:na(i,u)}}function lj(i){var l=i.alternate;l!==null&&(i.alternate=null,lj(l)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(l=i.stateNode,l!==null&&qt(l)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var En=null,Br=!1;function ta(i,l,u){for(u=u.child;u!==null;)cj(i,l,u),u=u.sibling}function cj(i,l,u){if(Dn&&typeof Dn.onCommitFiberUnmount=="function")try{Dn.onCommitFiberUnmount(Un,u)}catch{}switch(u.tag){case 26:Jn||uo(u,l),ta(i,l,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:Jn||uo(u,l);var h=En,x=Br;Wa(u.type)&&(En=u.stateNode,Br=!1),ta(i,l,u),Bu(u.stateNode),En=h,Br=x;break;case 5:Jn||uo(u,l);case 6:if(h=En,x=Br,En=null,ta(i,l,u),En=h,Br=x,En!==null)if(Br)try{(En.nodeType===9?En.body:En.nodeName==="HTML"?En.ownerDocument.body:En).removeChild(u.stateNode)}catch(S){Zt(u,l,S)}else try{En.removeChild(u.stateNode)}catch(S){Zt(u,l,S)}break;case 18:En!==null&&(Br?(i=En,tC(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,u.stateNode),cc(i)):tC(En,u.stateNode));break;case 4:h=En,x=Br,En=u.stateNode.containerInfo,Br=!0,ta(i,l,u),En=h,Br=x;break;case 0:case 11:case 14:case 15:Ua(2,u,l),Jn||Ua(4,u,l),ta(i,l,u);break;case 1:Jn||(uo(u,l),h=u.stateNode,typeof h.componentWillUnmount=="function"&&nj(u,l,h)),ta(i,l,u);break;case 21:ta(i,l,u);break;case 22:Jn=(h=Jn)||u.memoizedState!==null,ta(i,l,u),Jn=h;break;default:ta(i,l,u)}}function uj(i,l){if(l.memoizedState===null&&(i=l.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{cc(i)}catch(u){Zt(l,l.return,u)}}}function dj(i,l){if(l.memoizedState===null&&(i=l.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{cc(i)}catch(u){Zt(l,l.return,u)}}function mO(i){switch(i.tag){case 31:case 13:case 19:var l=i.stateNode;return l===null&&(l=i.stateNode=new aj),l;case 22:return i=i.stateNode,l=i._retryCache,l===null&&(l=i._retryCache=new aj),l;default:throw Error(r(435,i.tag))}}function Qf(i,l){var u=mO(i);l.forEach(function(h){if(!u.has(h)){u.add(h);var x=CO.bind(null,i,h);h.then(x,x)}})}function Vr(i,l){var u=l.deletions;if(u!==null)for(var h=0;h<u.length;h++){var x=u[h],S=i,D=l,P=D;e:for(;P!==null;){switch(P.tag){case 27:if(Wa(P.type)){En=P.stateNode,Br=!1;break e}break;case 5:En=P.stateNode,Br=!1;break e;case 3:case 4:En=P.stateNode.containerInfo,Br=!0;break e}P=P.return}if(En===null)throw Error(r(160));cj(S,D,x),En=null,Br=!1,S=x.alternate,S!==null&&(S.return=null),x.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)fj(l,i),l=l.sibling}var Hi=null;function fj(i,l){var u=i.alternate,h=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Vr(l,i),Fr(i),h&4&&(Ua(3,i,i.return),ku(3,i),Ua(5,i,i.return));break;case 1:Vr(l,i),Fr(i),h&512&&(Jn||u===null||uo(u,u.return)),h&64&&ea&&(i=i.updateQueue,i!==null&&(h=i.callbacks,h!==null&&(u=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=u===null?h:u.concat(h))));break;case 26:var x=Hi;if(Vr(l,i),Fr(i),h&512&&(Jn||u===null||uo(u,u.return)),h&4){var S=u!==null?u.memoizedState:null;if(h=i.memoizedState,u===null)if(h===null)if(i.stateNode===null){e:{h=i.type,u=i.memoizedProps,x=x.ownerDocument||x;t:switch(h){case"title":S=x.getElementsByTagName("title")[0],(!S||S[hn]||S[Me]||S.namespaceURI==="http://www.w3.org/2000/svg"||S.hasAttribute("itemprop"))&&(S=x.createElement(h),x.head.insertBefore(S,x.querySelector("head > title"))),ur(S,h,u),S[Me]=i,Xt(S),h=S;break e;case"link":var D=fC("link","href",x).get(h+(u.href||""));if(D){for(var P=0;P<D.length;P++)if(S=D[P],S.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&S.getAttribute("rel")===(u.rel==null?null:u.rel)&&S.getAttribute("title")===(u.title==null?null:u.title)&&S.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){D.splice(P,1);break t}}S=x.createElement(h),ur(S,h,u),x.head.appendChild(S);break;case"meta":if(D=fC("meta","content",x).get(h+(u.content||""))){for(P=0;P<D.length;P++)if(S=D[P],S.getAttribute("content")===(u.content==null?null:""+u.content)&&S.getAttribute("name")===(u.name==null?null:u.name)&&S.getAttribute("property")===(u.property==null?null:u.property)&&S.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&S.getAttribute("charset")===(u.charSet==null?null:u.charSet)){D.splice(P,1);break t}}S=x.createElement(h),ur(S,h,u),x.head.appendChild(S);break;default:throw Error(r(468,h))}S[Me]=i,Xt(S),h=S}i.stateNode=h}else hC(x,i.type,i.stateNode);else i.stateNode=dC(x,h,i.memoizedProps);else S!==h?(S===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):S.count--,h===null?hC(x,i.type,i.stateNode):dC(x,h,i.memoizedProps)):h===null&&i.stateNode!==null&&mv(i,i.memoizedProps,u.memoizedProps)}break;case 27:Vr(l,i),Fr(i),h&512&&(Jn||u===null||uo(u,u.return)),u!==null&&h&4&&mv(i,i.memoizedProps,u.memoizedProps);break;case 5:if(Vr(l,i),Fr(i),h&512&&(Jn||u===null||uo(u,u.return)),i.flags&32){x=i.stateNode;try{Pl(x,"")}catch(qe){Zt(i,i.return,qe)}}h&4&&i.stateNode!=null&&(x=i.memoizedProps,mv(i,x,u!==null?u.memoizedProps:x)),h&1024&&(yv=!0);break;case 6:if(Vr(l,i),Fr(i),h&4){if(i.stateNode===null)throw Error(r(162));h=i.memoizedProps,u=i.stateNode;try{u.nodeValue=h}catch(qe){Zt(i,i.return,qe)}}break;case 3:if(uh=null,x=Hi,Hi=lh(l.containerInfo),Vr(l,i),Hi=x,Fr(i),h&4&&u!==null&&u.memoizedState.isDehydrated)try{cc(l.containerInfo)}catch(qe){Zt(i,i.return,qe)}yv&&(yv=!1,hj(i));break;case 4:h=Hi,Hi=lh(i.stateNode.containerInfo),Vr(l,i),Fr(i),Hi=h;break;case 12:Vr(l,i),Fr(i);break;case 31:Vr(l,i),Fr(i),h&4&&(h=i.updateQueue,h!==null&&(i.updateQueue=null,Qf(i,h)));break;case 13:Vr(l,i),Fr(i),i.child.flags&8192&&i.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Kf=ve()),h&4&&(h=i.updateQueue,h!==null&&(i.updateQueue=null,Qf(i,h)));break;case 22:x=i.memoizedState!==null;var q=u!==null&&u.memoizedState!==null,te=ea,fe=Jn;if(ea=te||x,Jn=fe||q,Vr(l,i),Jn=fe,ea=te,Fr(i),h&8192)e:for(l=i.stateNode,l._visibility=x?l._visibility&-2:l._visibility|1,x&&(u===null||q||ea||Jn||$s(i)),u=null,l=i;;){if(l.tag===5||l.tag===26){if(u===null){q=u=l;try{if(S=q.stateNode,x)D=S.style,typeof D.setProperty=="function"?D.setProperty("display","none","important"):D.display="none";else{P=q.stateNode;var ye=q.memoizedProps.style,re=ye!=null&&ye.hasOwnProperty("display")?ye.display:null;P.style.display=re==null||typeof re=="boolean"?"":(""+re).trim()}}catch(qe){Zt(q,q.return,qe)}}}else if(l.tag===6){if(u===null){q=l;try{q.stateNode.nodeValue=x?"":q.memoizedProps}catch(qe){Zt(q,q.return,qe)}}}else if(l.tag===18){if(u===null){q=l;try{var se=q.stateNode;x?nC(se,!0):nC(q.stateNode,!1)}catch(qe){Zt(q,q.return,qe)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===i)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===i)break e;for(;l.sibling===null;){if(l.return===null||l.return===i)break e;u===l&&(u=null),l=l.return}u===l&&(u=null),l.sibling.return=l.return,l=l.sibling}h&4&&(h=i.updateQueue,h!==null&&(u=h.retryQueue,u!==null&&(h.retryQueue=null,Qf(i,u))));break;case 19:Vr(l,i),Fr(i),h&4&&(h=i.updateQueue,h!==null&&(i.updateQueue=null,Qf(i,h)));break;case 30:break;case 21:break;default:Vr(l,i),Fr(i)}}function Fr(i){var l=i.flags;if(l&2){try{for(var u,h=i.return;h!==null;){if(ij(h)){u=h;break}h=h.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var x=u.stateNode,S=gv(i);Wf(i,S,x);break;case 5:var D=u.stateNode;u.flags&32&&(Pl(D,""),u.flags&=-33);var P=gv(i);Wf(i,P,D);break;case 3:case 4:var q=u.stateNode.containerInfo,te=gv(i);vv(i,te,q);break;default:throw Error(r(161))}}catch(fe){Zt(i,i.return,fe)}i.flags&=-3}l&4096&&(i.flags&=-4097)}function hj(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var l=i;hj(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),i=i.sibling}}function na(i,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)sj(i,l.alternate,l),l=l.sibling}function $s(i){for(i=i.child;i!==null;){var l=i;switch(l.tag){case 0:case 11:case 14:case 15:Ua(4,l,l.return),$s(l);break;case 1:uo(l,l.return);var u=l.stateNode;typeof u.componentWillUnmount=="function"&&nj(l,l.return,u),$s(l);break;case 27:Bu(l.stateNode);case 26:case 5:uo(l,l.return),$s(l);break;case 22:l.memoizedState===null&&$s(l);break;case 30:$s(l);break;default:$s(l)}i=i.sibling}}function ra(i,l,u){for(u=u&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var h=l.alternate,x=i,S=l,D=S.flags;switch(S.tag){case 0:case 11:case 15:ra(x,S,u),ku(4,S);break;case 1:if(ra(x,S,u),h=S,x=h.stateNode,typeof x.componentDidMount=="function")try{x.componentDidMount()}catch(te){Zt(h,h.return,te)}if(h=S,x=h.updateQueue,x!==null){var P=h.stateNode;try{var q=x.shared.hiddenCallbacks;if(q!==null)for(x.shared.hiddenCallbacks=null,x=0;x<q.length;x++)H1(q[x],P)}catch(te){Zt(h,h.return,te)}}u&&D&64&&tj(S),Pu(S,S.return);break;case 27:oj(S);case 26:case 5:ra(x,S,u),u&&h===null&&D&4&&rj(S),Pu(S,S.return);break;case 12:ra(x,S,u);break;case 31:ra(x,S,u),u&&D&4&&uj(x,S);break;case 13:ra(x,S,u),u&&D&4&&dj(x,S);break;case 22:S.memoizedState===null&&ra(x,S,u),Pu(S,S.return);break;case 30:break;default:ra(x,S,u)}l=l.sibling}}function xv(i,l){var u=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(u=i.memoizedState.cachePool.pool),i=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(i=l.memoizedState.cachePool.pool),i!==u&&(i!=null&&i.refCount++,u!=null&&yu(u))}function bv(i,l){i=null,l.alternate!==null&&(i=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==i&&(l.refCount++,i!=null&&yu(i))}function qi(i,l,u,h){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)pj(i,l,u,h),l=l.sibling}function pj(i,l,u,h){var x=l.flags;switch(l.tag){case 0:case 11:case 15:qi(i,l,u,h),x&2048&&ku(9,l);break;case 1:qi(i,l,u,h);break;case 3:qi(i,l,u,h),x&2048&&(i=null,l.alternate!==null&&(i=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==i&&(l.refCount++,i!=null&&yu(i)));break;case 12:if(x&2048){qi(i,l,u,h),i=l.stateNode;try{var S=l.memoizedProps,D=S.id,P=S.onPostCommit;typeof P=="function"&&P(D,l.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(q){Zt(l,l.return,q)}}else qi(i,l,u,h);break;case 31:qi(i,l,u,h);break;case 13:qi(i,l,u,h);break;case 23:break;case 22:S=l.stateNode,D=l.alternate,l.memoizedState!==null?S._visibility&2?qi(i,l,u,h):Nu(i,l):S._visibility&2?qi(i,l,u,h):(S._visibility|=2,Jl(i,l,u,h,(l.subtreeFlags&10256)!==0||!1)),x&2048&&xv(D,l);break;case 24:qi(i,l,u,h),x&2048&&bv(l.alternate,l);break;default:qi(i,l,u,h)}}function Jl(i,l,u,h,x){for(x=x&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var S=i,D=l,P=u,q=h,te=D.flags;switch(D.tag){case 0:case 11:case 15:Jl(S,D,P,q,x),ku(8,D);break;case 23:break;case 22:var fe=D.stateNode;D.memoizedState!==null?fe._visibility&2?Jl(S,D,P,q,x):Nu(S,D):(fe._visibility|=2,Jl(S,D,P,q,x)),x&&te&2048&&xv(D.alternate,D);break;case 24:Jl(S,D,P,q,x),x&&te&2048&&bv(D.alternate,D);break;default:Jl(S,D,P,q,x)}l=l.sibling}}function Nu(i,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var u=i,h=l,x=h.flags;switch(h.tag){case 22:Nu(u,h),x&2048&&xv(h.alternate,h);break;case 24:Nu(u,h),x&2048&&bv(h.alternate,h);break;default:Nu(u,h)}l=l.sibling}}var Ou=8192;function Zl(i,l,u){if(i.subtreeFlags&Ou)for(i=i.child;i!==null;)mj(i,l,u),i=i.sibling}function mj(i,l,u){switch(i.tag){case 26:Zl(i,l,u),i.flags&Ou&&i.memoizedState!==null&&t3(u,Hi,i.memoizedState,i.memoizedProps);break;case 5:Zl(i,l,u);break;case 3:case 4:var h=Hi;Hi=lh(i.stateNode.containerInfo),Zl(i,l,u),Hi=h;break;case 22:i.memoizedState===null&&(h=i.alternate,h!==null&&h.memoizedState!==null?(h=Ou,Ou=16777216,Zl(i,l,u),Ou=h):Zl(i,l,u));break;default:Zl(i,l,u)}}function gj(i){var l=i.alternate;if(l!==null&&(i=l.child,i!==null)){l.child=null;do l=i.sibling,i.sibling=null,i=l;while(i!==null)}}function Mu(i){var l=i.deletions;if((i.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var h=l[u];nr=h,yj(h,i)}gj(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)vj(i),i=i.sibling}function vj(i){switch(i.tag){case 0:case 11:case 15:Mu(i),i.flags&2048&&Ua(9,i,i.return);break;case 3:Mu(i);break;case 12:Mu(i);break;case 22:var l=i.stateNode;i.memoizedState!==null&&l._visibility&2&&(i.return===null||i.return.tag!==13)?(l._visibility&=-3,Yf(i)):Mu(i);break;default:Mu(i)}}function Yf(i){var l=i.deletions;if((i.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var h=l[u];nr=h,yj(h,i)}gj(i)}for(i=i.child;i!==null;){switch(l=i,l.tag){case 0:case 11:case 15:Ua(8,l,l.return),Yf(l);break;case 22:u=l.stateNode,u._visibility&2&&(u._visibility&=-3,Yf(l));break;default:Yf(l)}i=i.sibling}}function yj(i,l){for(;nr!==null;){var u=nr;switch(u.tag){case 0:case 11:case 15:Ua(8,u,l);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var h=u.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:yu(u.memoizedState.cache)}if(h=u.child,h!==null)h.return=u,nr=h;else e:for(u=i;nr!==null;){h=nr;var x=h.sibling,S=h.return;if(lj(h),h===u){nr=null;break e}if(x!==null){x.return=S,nr=x;break e}nr=S}}}var gO={getCacheForType:function(i){var l=lr(Yn),u=l.data.get(i);return u===void 0&&(u=i(),l.data.set(i,u)),u},cacheSignal:function(){return lr(Yn).controller.signal}},vO=typeof WeakMap=="function"?WeakMap:Map,Gt=0,sn=null,Rt=null,At=0,Jt=0,ii=null,Ba=!1,ec=!1,Sv=!1,ia=0,Mn=0,Va=0,Us=0,wv=0,oi=0,tc=0,Lu=null,Hr=null,jv=!1,Kf=0,xj=0,Xf=1/0,Jf=null,Fa=null,tr=0,Ha=null,nc=null,oa=0,Cv=0,Ev=null,bj=null,Iu=0,Tv=null;function ai(){return(Gt&2)!==0&&At!==0?At&-At:M.T!==null?Pv():We()}function Sj(){if(oi===0)if((At&536870912)===0||Nt){var i=$i;$i<<=1,($i&3932160)===0&&($i=262144),oi=i}else oi=536870912;return i=ni.current,i!==null&&(i.flags|=32),oi}function qr(i,l,u){(i===sn&&(Jt===2||Jt===9)||i.cancelPendingCommit!==null)&&(rc(i,0),qa(i,At,oi,!1)),Fo(i,u),((Gt&2)===0||i!==sn)&&(i===sn&&((Gt&2)===0&&(Us|=u),Mn===4&&qa(i,At,oi,!1)),fo(i))}function wj(i,l,u){if((Gt&6)!==0)throw Error(r(327));var h=!u&&(l&127)===0&&(l&i.expiredLanes)===0||Ui(i,l),x=h?bO(i,l):_v(i,l,!0),S=h;do{if(x===0){ec&&!h&&qa(i,l,0,!1);break}else{if(u=i.current.alternate,S&&!yO(u)){x=_v(i,l,!1),S=!1;continue}if(x===2){if(S=l,i.errorRecoveryDisabledLanes&S)var D=0;else D=i.pendingLanes&-536870913,D=D!==0?D:D&536870912?536870912:0;if(D!==0){l=D;e:{var P=i;x=Lu;var q=P.current.memoizedState.isDehydrated;if(q&&(rc(P,D).flags|=256),D=_v(P,D,!1),D!==2){if(Sv&&!q){P.errorRecoveryDisabledLanes|=S,Us|=S,x=4;break e}S=Hr,Hr=x,S!==null&&(Hr===null?Hr=S:Hr.push.apply(Hr,S))}x=D}if(S=!1,x!==2)continue}}if(x===1){rc(i,0),qa(i,l,0,!0);break}e:{switch(h=i,S=x,S){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:qa(h,l,oi,!Ba);break e;case 2:Hr=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(x=Kf+300-ve(),10<x)){if(qa(h,l,oi,!Ba),mr(h,0,!0)!==0)break e;oa=l,h.timeoutHandle=Zj(jj.bind(null,h,u,Hr,Jf,jv,l,oi,Us,tc,Ba,S,"Throttled",-0,0),x);break e}jj(h,u,Hr,Jf,jv,l,oi,Us,tc,Ba,S,null,-0,0)}}break}while(!0);fo(i)}function jj(i,l,u,h,x,S,D,P,q,te,fe,ye,re,se){if(i.timeoutHandle=-1,ye=l.subtreeFlags,ye&8192||(ye&16785408)===16785408){ye={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ho},mj(l,S,ye);var qe=(S&62914560)===S?Kf-ve():(S&4194048)===S?xj-ve():0;if(qe=n3(ye,qe),qe!==null){oa=S,i.cancelPendingCommit=qe(kj.bind(null,i,l,S,u,h,x,D,P,q,fe,ye,null,re,se)),qa(i,S,D,!te);return}}kj(i,l,S,u,h,x,D,P,q)}function yO(i){for(var l=i;;){var u=l.tag;if((u===0||u===11||u===15)&&l.flags&16384&&(u=l.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var h=0;h<u.length;h++){var x=u[h],S=x.getSnapshot;x=x.value;try{if(!ei(S(),x))return!1}catch{return!1}}if(u=l.child,l.subtreeFlags&16384&&u!==null)u.return=l,l=u;else{if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function qa(i,l,u,h){l&=~wv,l&=~Us,i.suspendedLanes|=l,i.pingedLanes&=~l,h&&(i.warmLanes|=l),h=i.expirationTimes;for(var x=l;0<x;){var S=31-Nn(x),D=1<<S;h[S]=-1,x&=~D}u!==0&&V(i,u,l)}function Zf(){return(Gt&6)===0?(zu(0),!1):!0}function Rv(){if(Rt!==null){if(Jt===0)var i=Rt.return;else i=Rt,Qo=ks=null,Fg(i),Wl=null,bu=0,i=Rt;for(;i!==null;)ej(i.alternate,i),i=i.return;Rt=null}}function rc(i,l){var u=i.timeoutHandle;u!==-1&&(i.timeoutHandle=-1,zO(u)),u=i.cancelPendingCommit,u!==null&&(i.cancelPendingCommit=null,u()),oa=0,Rv(),sn=i,Rt=u=Go(i.current,null),At=l,Jt=0,ii=null,Ba=!1,ec=Ui(i,l),Sv=!1,tc=oi=wv=Us=Va=Mn=0,Hr=Lu=null,jv=!1,(l&8)!==0&&(l|=l&32);var h=i.entangledLanes;if(h!==0)for(i=i.entanglements,h&=l;0<h;){var x=31-Nn(h),S=1<<x;l|=i[x],h&=~S}return ia=l,bf(),u}function Cj(i,l){xt=null,M.H=_u,l===Gl||l===_f?(l=U1(),Jt=3):l===kg?(l=U1(),Jt=4):Jt=l===ov?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,ii=l,Rt===null&&(Mn=1,Vf(i,yi(l,i.current)))}function Ej(){var i=ni.current;return i===null?!0:(At&4194048)===At?wi===null:(At&62914560)===At||(At&536870912)!==0?i===wi:!1}function Tj(){var i=M.H;return M.H=_u,i===null?_u:i}function Rj(){var i=M.A;return M.A=gO,i}function eh(){Mn=4,Ba||(At&4194048)!==At&&ni.current!==null||(ec=!0),(Va&134217727)===0&&(Us&134217727)===0||sn===null||qa(sn,At,oi,!1)}function _v(i,l,u){var h=Gt;Gt|=2;var x=Tj(),S=Rj();(sn!==i||At!==l)&&(Jf=null,rc(i,l)),l=!1;var D=Mn;e:do try{if(Jt!==0&&Rt!==null){var P=Rt,q=ii;switch(Jt){case 8:Rv(),D=6;break e;case 3:case 2:case 9:case 6:ni.current===null&&(l=!0);var te=Jt;if(Jt=0,ii=null,ic(i,P,q,te),u&&ec){D=0;break e}break;default:te=Jt,Jt=0,ii=null,ic(i,P,q,te)}}xO(),D=Mn;break}catch(fe){Cj(i,fe)}while(!0);return l&&i.shellSuspendCounter++,Qo=ks=null,Gt=h,M.H=x,M.A=S,Rt===null&&(sn=null,At=0,bf()),D}function xO(){for(;Rt!==null;)_j(Rt)}function bO(i,l){var u=Gt;Gt|=2;var h=Tj(),x=Rj();sn!==i||At!==l?(Jf=null,Xf=ve()+500,rc(i,l)):ec=Ui(i,l);e:do try{if(Jt!==0&&Rt!==null){l=Rt;var S=ii;t:switch(Jt){case 1:Jt=0,ii=null,ic(i,l,S,1);break;case 2:case 9:if(z1(S)){Jt=0,ii=null,Dj(l);break}l=function(){Jt!==2&&Jt!==9||sn!==i||(Jt=7),fo(i)},S.then(l,l);break e;case 3:Jt=7;break e;case 4:Jt=5;break e;case 7:z1(S)?(Jt=0,ii=null,Dj(l)):(Jt=0,ii=null,ic(i,l,S,7));break;case 5:var D=null;switch(Rt.tag){case 26:D=Rt.memoizedState;case 5:case 27:var P=Rt;if(D?pC(D):P.stateNode.complete){Jt=0,ii=null;var q=P.sibling;if(q!==null)Rt=q;else{var te=P.return;te!==null?(Rt=te,th(te)):Rt=null}break t}}Jt=0,ii=null,ic(i,l,S,5);break;case 6:Jt=0,ii=null,ic(i,l,S,6);break;case 8:Rv(),Mn=6;break e;default:throw Error(r(462))}}SO();break}catch(fe){Cj(i,fe)}while(!0);return Qo=ks=null,M.H=h,M.A=x,Gt=u,Rt!==null?0:(sn=null,At=0,bf(),Mn)}function SO(){for(;Rt!==null&&!et();)_j(Rt)}function _j(i){var l=Jw(i.alternate,i,ia);i.memoizedProps=i.pendingProps,l===null?th(i):Rt=l}function Dj(i){var l=i,u=l.alternate;switch(l.tag){case 15:case 0:l=Gw(u,l,l.pendingProps,l.type,void 0,At);break;case 11:l=Gw(u,l,l.pendingProps,l.type.render,l.ref,At);break;case 5:Fg(l);default:ej(u,l),l=Rt=R1(l,ia),l=Jw(u,l,ia)}i.memoizedProps=i.pendingProps,l===null?th(i):Rt=l}function ic(i,l,u,h){Qo=ks=null,Fg(l),Wl=null,bu=0;var x=l.return;try{if(cO(i,x,l,u,At)){Mn=1,Vf(i,yi(u,i.current)),Rt=null;return}}catch(S){if(x!==null)throw Rt=x,S;Mn=1,Vf(i,yi(u,i.current)),Rt=null;return}l.flags&32768?(Nt||h===1?i=!0:ec||(At&536870912)!==0?i=!1:(Ba=i=!0,(h===2||h===9||h===3||h===6)&&(h=ni.current,h!==null&&h.tag===13&&(h.flags|=16384))),Aj(l,i)):th(l)}function th(i){var l=i;do{if((l.flags&32768)!==0){Aj(l,Ba);return}i=l.return;var u=fO(l.alternate,l,ia);if(u!==null){Rt=u;return}if(l=l.sibling,l!==null){Rt=l;return}Rt=l=i}while(l!==null);Mn===0&&(Mn=5)}function Aj(i,l){do{var u=hO(i.alternate,i);if(u!==null){u.flags&=32767,Rt=u;return}if(u=i.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!l&&(i=i.sibling,i!==null)){Rt=i;return}Rt=i=u}while(i!==null);Mn=6,Rt=null}function kj(i,l,u,h,x,S,D,P,q){i.cancelPendingCommit=null;do nh();while(tr!==0);if((Gt&6)!==0)throw Error(r(327));if(l!==null){if(l===i.current)throw Error(r(177));if(S=l.lanes|l.childLanes,S|=gg,au(i,u,S,D,P,q),i===sn&&(Rt=sn=null,At=0),nc=l,Ha=i,oa=u,Cv=S,Ev=x,bj=h,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,EO(Tt,function(){return Lj(),null})):(i.callbackNode=null,i.callbackPriority=0),h=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||h){h=M.T,M.T=null,x=I.p,I.p=2,D=Gt,Gt|=4;try{pO(i,l,u)}finally{Gt=D,I.p=x,M.T=h}}tr=1,Pj(),Nj(),Oj()}}function Pj(){if(tr===1){tr=0;var i=Ha,l=nc,u=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||u){u=M.T,M.T=null;var h=I.p;I.p=2;var x=Gt;Gt|=4;try{fj(l,i);var S=Uv,D=y1(i.containerInfo),P=S.focusedElem,q=S.selectionRange;if(D!==P&&P&&P.ownerDocument&&v1(P.ownerDocument.documentElement,P)){if(q!==null&&dg(P)){var te=q.start,fe=q.end;if(fe===void 0&&(fe=te),"selectionStart"in P)P.selectionStart=te,P.selectionEnd=Math.min(fe,P.value.length);else{var ye=P.ownerDocument||document,re=ye&&ye.defaultView||window;if(re.getSelection){var se=re.getSelection(),qe=P.textContent.length,ut=Math.min(q.start,qe),rn=q.end===void 0?ut:Math.min(q.end,qe);!se.extend&&ut>rn&&(D=rn,rn=ut,ut=D);var K=g1(P,ut),G=g1(P,rn);if(K&&G&&(se.rangeCount!==1||se.anchorNode!==K.node||se.anchorOffset!==K.offset||se.focusNode!==G.node||se.focusOffset!==G.offset)){var ee=ye.createRange();ee.setStart(K.node,K.offset),se.removeAllRanges(),ut>rn?(se.addRange(ee),se.extend(G.node,G.offset)):(ee.setEnd(G.node,G.offset),se.addRange(ee))}}}}for(ye=[],se=P;se=se.parentNode;)se.nodeType===1&&ye.push({element:se,left:se.scrollLeft,top:se.scrollTop});for(typeof P.focus=="function"&&P.focus(),P=0;P<ye.length;P++){var me=ye[P];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}ph=!!$v,Uv=$v=null}finally{Gt=x,I.p=h,M.T=u}}i.current=l,tr=2}}function Nj(){if(tr===2){tr=0;var i=Ha,l=nc,u=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||u){u=M.T,M.T=null;var h=I.p;I.p=2;var x=Gt;Gt|=4;try{sj(i,l.alternate,l)}finally{Gt=x,I.p=h,M.T=u}}tr=3}}function Oj(){if(tr===4||tr===3){tr=0,at();var i=Ha,l=nc,u=oa,h=bj;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?tr=5:(tr=0,nc=Ha=null,Mj(i,i.pendingLanes));var x=i.pendingLanes;if(x===0&&(Fa=null),De(u),l=l.stateNode,Dn&&typeof Dn.onCommitFiberRoot=="function")try{Dn.onCommitFiberRoot(Un,l,void 0,(l.current.flags&128)===128)}catch{}if(h!==null){l=M.T,x=I.p,I.p=2,M.T=null;try{for(var S=i.onRecoverableError,D=0;D<h.length;D++){var P=h[D];S(P.value,{componentStack:P.stack})}}finally{M.T=l,I.p=x}}(oa&3)!==0&&nh(),fo(i),x=i.pendingLanes,(u&261930)!==0&&(x&42)!==0?i===Tv?Iu++:(Iu=0,Tv=i):Iu=0,zu(0)}}function Mj(i,l){(i.pooledCacheLanes&=l)===0&&(l=i.pooledCache,l!=null&&(i.pooledCache=null,yu(l)))}function nh(){return Pj(),Nj(),Oj(),Lj()}function Lj(){if(tr!==5)return!1;var i=Ha,l=Cv;Cv=0;var u=De(oa),h=M.T,x=I.p;try{I.p=32>u?32:u,M.T=null,u=Ev,Ev=null;var S=Ha,D=oa;if(tr=0,nc=Ha=null,oa=0,(Gt&6)!==0)throw Error(r(331));var P=Gt;if(Gt|=4,vj(S.current),pj(S,S.current,D,u),Gt=P,zu(0,!1),Dn&&typeof Dn.onPostCommitFiberRoot=="function")try{Dn.onPostCommitFiberRoot(Un,S)}catch{}return!0}finally{I.p=x,M.T=h,Mj(i,l)}}function Ij(i,l,u){l=yi(u,l),l=iv(i.stateNode,l,2),i=Ia(i,l,2),i!==null&&(Fo(i,2),fo(i))}function Zt(i,l,u){if(i.tag===3)Ij(i,i,u);else for(;l!==null;){if(l.tag===3){Ij(l,i,u);break}else if(l.tag===1){var h=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Fa===null||!Fa.has(h))){i=yi(u,i),u=zw(2),h=Ia(l,u,2),h!==null&&($w(u,h,l,i),Fo(h,2),fo(h));break}}l=l.return}}function Dv(i,l,u){var h=i.pingCache;if(h===null){h=i.pingCache=new vO;var x=new Set;h.set(l,x)}else x=h.get(l),x===void 0&&(x=new Set,h.set(l,x));x.has(u)||(Sv=!0,x.add(u),i=wO.bind(null,i,l,u),l.then(i,i))}function wO(i,l,u){var h=i.pingCache;h!==null&&h.delete(l),i.pingedLanes|=i.suspendedLanes&u,i.warmLanes&=~u,sn===i&&(At&u)===u&&(Mn===4||Mn===3&&(At&62914560)===At&&300>ve()-Kf?(Gt&2)===0&&rc(i,0):wv|=u,tc===At&&(tc=0)),fo(i)}function zj(i,l){l===0&&(l=Vo()),i=_s(i,l),i!==null&&(Fo(i,l),fo(i))}function jO(i){var l=i.memoizedState,u=0;l!==null&&(u=l.retryLane),zj(i,u)}function CO(i,l){var u=0;switch(i.tag){case 31:case 13:var h=i.stateNode,x=i.memoizedState;x!==null&&(u=x.retryLane);break;case 19:h=i.stateNode;break;case 22:h=i.stateNode._retryCache;break;default:throw Error(r(314))}h!==null&&h.delete(l),zj(i,u)}function EO(i,l){return Ne(i,l)}var rh=null,oc=null,Av=!1,ih=!1,kv=!1,Ga=0;function fo(i){i!==oc&&i.next===null&&(oc===null?rh=oc=i:oc=oc.next=i),ih=!0,Av||(Av=!0,RO())}function zu(i,l){if(!kv&&ih){kv=!0;do for(var u=!1,h=rh;h!==null;){if(i!==0){var x=h.pendingLanes;if(x===0)var S=0;else{var D=h.suspendedLanes,P=h.pingedLanes;S=(1<<31-Nn(42|i)+1)-1,S&=x&~(D&~P),S=S&201326741?S&201326741|1:S?S|2:0}S!==0&&(u=!0,Vj(h,S))}else S=At,S=mr(h,h===sn?S:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(S&3)===0||Ui(h,S)||(u=!0,Vj(h,S));h=h.next}while(u);kv=!1}}function TO(){$j()}function $j(){ih=Av=!1;var i=0;Ga!==0&&IO()&&(i=Ga);for(var l=ve(),u=null,h=rh;h!==null;){var x=h.next,S=Uj(h,l);S===0?(h.next=null,u===null?rh=x:u.next=x,x===null&&(oc=u)):(u=h,(i!==0||(S&3)!==0)&&(ih=!0)),h=x}tr!==0&&tr!==5||zu(i),Ga!==0&&(Ga=0)}function Uj(i,l){for(var u=i.suspendedLanes,h=i.pingedLanes,x=i.expirationTimes,S=i.pendingLanes&-62914561;0<S;){var D=31-Nn(S),P=1<<D,q=x[D];q===-1?((P&u)===0||(P&h)!==0)&&(x[D]=Qn(P,l)):q<=l&&(i.expiredLanes|=P),S&=~P}if(l=sn,u=At,u=mr(i,i===l?u:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),h=i.callbackNode,u===0||i===l&&(Jt===2||Jt===9)||i.cancelPendingCommit!==null)return h!==null&&h!==null&&ct(h),i.callbackNode=null,i.callbackPriority=0;if((u&3)===0||Ui(i,u)){if(l=u&-u,l===i.callbackPriority)return l;switch(h!==null&&ct(h),De(u)){case 2:case 8:u=tt;break;case 32:u=Tt;break;case 268435456:u=gn;break;default:u=Tt}return h=Bj.bind(null,i),u=Ne(u,h),i.callbackPriority=l,i.callbackNode=u,l}return h!==null&&h!==null&&ct(h),i.callbackPriority=2,i.callbackNode=null,2}function Bj(i,l){if(tr!==0&&tr!==5)return i.callbackNode=null,i.callbackPriority=0,null;var u=i.callbackNode;if(nh()&&i.callbackNode!==u)return null;var h=At;return h=mr(i,i===sn?h:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),h===0?null:(wj(i,h,l),Uj(i,ve()),i.callbackNode!=null&&i.callbackNode===u?Bj.bind(null,i):null)}function Vj(i,l){if(nh())return null;wj(i,l,!0)}function RO(){$O(function(){(Gt&6)!==0?Ne(Oe,TO):$j()})}function Pv(){if(Ga===0){var i=Hl;i===0&&(i=Bo,Bo<<=1,(Bo&261888)===0&&(Bo=256)),Ga=i}return Ga}function Fj(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:ff(""+i)}function Hj(i,l){var u=l.ownerDocument.createElement("input");return u.name=l.name,u.value=l.value,i.id&&u.setAttribute("form",i.id),l.parentNode.insertBefore(u,l),i=new FormData(i),u.parentNode.removeChild(u),i}function _O(i,l,u,h,x){if(l==="submit"&&u&&u.stateNode===x){var S=Fj((x[Ve]||null).action),D=h.submitter;D&&(l=(l=D[Ve]||null)?Fj(l.formAction):D.getAttribute("formAction"),l!==null&&(S=l,D=null));var P=new gf("action","action",null,h,x);i.push({event:P,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Ga!==0){var q=D?Hj(x,D):new FormData(x);Jg(u,{pending:!0,data:q,method:x.method,action:S},null,q)}}else typeof S=="function"&&(P.preventDefault(),q=D?Hj(x,D):new FormData(x),Jg(u,{pending:!0,data:q,method:x.method,action:S},S,q))},currentTarget:x}]})}}for(var Nv=0;Nv<mg.length;Nv++){var Ov=mg[Nv],DO=Ov.toLowerCase(),AO=Ov[0].toUpperCase()+Ov.slice(1);Fi(DO,"on"+AO)}Fi(S1,"onAnimationEnd"),Fi(w1,"onAnimationIteration"),Fi(j1,"onAnimationStart"),Fi("dblclick","onDoubleClick"),Fi("focusin","onFocus"),Fi("focusout","onBlur"),Fi(GN,"onTransitionRun"),Fi(WN,"onTransitionStart"),Fi(QN,"onTransitionCancel"),Fi(C1,"onTransitionEnd"),Vi("onMouseEnter",["mouseout","mouseover"]),Vi("onMouseLeave",["mouseout","mouseover"]),Vi("onPointerEnter",["pointerout","pointerover"]),Vi("onPointerLeave",["pointerout","pointerover"]),Er("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Er("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Er("onBeforeInput",["compositionend","keypress","textInput","paste"]),Er("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Er("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Er("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $u="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(" "),kO=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat($u));function qj(i,l){l=(l&4)!==0;for(var u=0;u<i.length;u++){var h=i[u],x=h.event;h=h.listeners;e:{var S=void 0;if(l)for(var D=h.length-1;0<=D;D--){var P=h[D],q=P.instance,te=P.currentTarget;if(P=P.listener,q!==S&&x.isPropagationStopped())break e;S=P,x.currentTarget=te;try{S(x)}catch(fe){xf(fe)}x.currentTarget=null,S=q}else for(D=0;D<h.length;D++){if(P=h[D],q=P.instance,te=P.currentTarget,P=P.listener,q!==S&&x.isPropagationStopped())break e;S=P,x.currentTarget=te;try{S(x)}catch(fe){xf(fe)}x.currentTarget=null,S=q}}}}function _t(i,l){var u=l[Ze];u===void 0&&(u=l[Ze]=new Set);var h=i+"__bubble";u.has(h)||(Gj(l,i,2,!1),u.add(h))}function Mv(i,l,u){var h=0;l&&(h|=4),Gj(u,i,h,l)}var oh="_reactListening"+Math.random().toString(36).slice(2);function Lv(i){if(!i[oh]){i[oh]=!0,Dl.forEach(function(u){u!=="selectionchange"&&(kO.has(u)||Mv(u,!1,i),Mv(u,!0,i))});var l=i.nodeType===9?i:i.ownerDocument;l===null||l[oh]||(l[oh]=!0,Mv("selectionchange",!1,l))}}function Gj(i,l,u,h){switch(SC(l)){case 2:var x=o3;break;case 8:x=a3;break;default:x=Xv}u=x.bind(null,l,u,i),x=void 0,!ng||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(x=!0),h?x!==void 0?i.addEventListener(l,u,{capture:!0,passive:x}):i.addEventListener(l,u,!0):x!==void 0?i.addEventListener(l,u,{passive:x}):i.addEventListener(l,u,!1)}function Iv(i,l,u,h,x){var S=h;if((l&1)===0&&(l&2)===0&&h!==null)e:for(;;){if(h===null)return;var D=h.tag;if(D===3||D===4){var P=h.stateNode.containerInfo;if(P===x)break;if(D===4)for(D=h.return;D!==null;){var q=D.tag;if((q===3||q===4)&&D.stateNode.containerInfo===x)return;D=D.return}for(;P!==null;){if(D=Ut(P),D===null)return;if(q=D.tag,q===5||q===6||q===26||q===27){h=S=D;continue e}P=P.parentNode}}h=h.return}XS(function(){var te=S,fe=eg(u),ye=[];e:{var re=E1.get(i);if(re!==void 0){var se=gf,qe=i;switch(i){case"keypress":if(pf(u)===0)break e;case"keydown":case"keyup":se=CN;break;case"focusin":qe="focus",se=ag;break;case"focusout":qe="blur",se=ag;break;case"beforeblur":case"afterblur":se=ag;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":se=e1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":se=fN;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":se=RN;break;case S1:case w1:case j1:se=mN;break;case C1:se=DN;break;case"scroll":case"scrollend":se=uN;break;case"wheel":se=kN;break;case"copy":case"cut":case"paste":se=vN;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":se=n1;break;case"toggle":case"beforetoggle":se=NN}var ut=(l&4)!==0,rn=!ut&&(i==="scroll"||i==="scrollend"),K=ut?re!==null?re+"Capture":null:re;ut=[];for(var G=te,ee;G!==null;){var me=G;if(ee=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||ee===null||K===null||(me=su(G,K),me!=null&&ut.push(Uu(G,me,ee))),rn)break;G=G.return}0<ut.length&&(re=new se(re,qe,null,u,fe),ye.push({event:re,listeners:ut}))}}if((l&7)===0){e:{if(re=i==="mouseover"||i==="pointerover",se=i==="mouseout"||i==="pointerout",re&&u!==Zm&&(qe=u.relatedTarget||u.fromElement)&&(Ut(qe)||qe[Qe]))break e;if((se||re)&&(re=fe.window===fe?fe:(re=fe.ownerDocument)?re.defaultView||re.parentWindow:window,se?(qe=u.relatedTarget||u.toElement,se=te,qe=qe?Ut(qe):null,qe!==null&&(rn=s(qe),ut=qe.tag,qe!==rn||ut!==5&&ut!==27&&ut!==6)&&(qe=null)):(se=null,qe=te),se!==qe)){if(ut=e1,me="onMouseLeave",K="onMouseEnter",G="mouse",(i==="pointerout"||i==="pointerover")&&(ut=n1,me="onPointerLeave",K="onPointerEnter",G="pointer"),rn=se==null?re:Bi(se),ee=qe==null?re:Bi(qe),re=new ut(me,G+"leave",se,u,fe),re.target=rn,re.relatedTarget=ee,me=null,Ut(fe)===te&&(ut=new ut(K,G+"enter",qe,u,fe),ut.target=ee,ut.relatedTarget=rn,me=ut),rn=me,se&&qe)t:{for(ut=PO,K=se,G=qe,ee=0,me=K;me;me=ut(me))ee++;me=0;for(var ot=G;ot;ot=ut(ot))me++;for(;0<ee-me;)K=ut(K),ee--;for(;0<me-ee;)G=ut(G),me--;for(;ee--;){if(K===G||G!==null&&K===G.alternate){ut=K;break t}K=ut(K),G=ut(G)}ut=null}else ut=null;se!==null&&Wj(ye,re,se,ut,!1),qe!==null&&rn!==null&&Wj(ye,rn,qe,ut,!0)}}e:{if(re=te?Bi(te):window,se=re.nodeName&&re.nodeName.toLowerCase(),se==="select"||se==="input"&&re.type==="file")var Bt=u1;else if(l1(re))if(d1)Bt=FN;else{Bt=BN;var Xe=UN}else se=re.nodeName,!se||se.toLowerCase()!=="input"||re.type!=="checkbox"&&re.type!=="radio"?te&&Jm(te.elementType)&&(Bt=u1):Bt=VN;if(Bt&&(Bt=Bt(i,te))){c1(ye,Bt,u,fe);break e}Xe&&Xe(i,re,te),i==="focusout"&&te&&re.type==="number"&&te.memoizedProps.value!=null&&Xm(re,"number",re.value)}switch(Xe=te?Bi(te):window,i){case"focusin":(l1(Xe)||Xe.contentEditable==="true")&&(Ll=Xe,fg=te,mu=null);break;case"focusout":mu=fg=Ll=null;break;case"mousedown":hg=!0;break;case"contextmenu":case"mouseup":case"dragend":hg=!1,x1(ye,u,fe);break;case"selectionchange":if(qN)break;case"keydown":case"keyup":x1(ye,u,fe)}var jt;if(lg)e:{switch(i){case"compositionstart":var kt="onCompositionStart";break e;case"compositionend":kt="onCompositionEnd";break e;case"compositionupdate":kt="onCompositionUpdate";break e}kt=void 0}else Ml?a1(i,u)&&(kt="onCompositionEnd"):i==="keydown"&&u.keyCode===229&&(kt="onCompositionStart");kt&&(r1&&u.locale!=="ko"&&(Ml||kt!=="onCompositionStart"?kt==="onCompositionEnd"&&Ml&&(jt=JS()):(Aa=fe,rg="value"in Aa?Aa.value:Aa.textContent,Ml=!0)),Xe=ah(te,kt),0<Xe.length&&(kt=new t1(kt,i,null,u,fe),ye.push({event:kt,listeners:Xe}),jt?kt.data=jt:(jt=s1(u),jt!==null&&(kt.data=jt)))),(jt=MN?LN(i,u):IN(i,u))&&(kt=ah(te,"onBeforeInput"),0<kt.length&&(Xe=new t1("onBeforeInput","beforeinput",null,u,fe),ye.push({event:Xe,listeners:kt}),Xe.data=jt)),_O(ye,i,te,u,fe)}qj(ye,l)})}function Uu(i,l,u){return{instance:i,listener:l,currentTarget:u}}function ah(i,l){for(var u=l+"Capture",h=[];i!==null;){var x=i,S=x.stateNode;if(x=x.tag,x!==5&&x!==26&&x!==27||S===null||(x=su(i,u),x!=null&&h.unshift(Uu(i,x,S)),x=su(i,l),x!=null&&h.push(Uu(i,x,S))),i.tag===3)return h;i=i.return}return[]}function PO(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function Wj(i,l,u,h,x){for(var S=l._reactName,D=[];u!==null&&u!==h;){var P=u,q=P.alternate,te=P.stateNode;if(P=P.tag,q!==null&&q===h)break;P!==5&&P!==26&&P!==27||te===null||(q=te,x?(te=su(u,S),te!=null&&D.unshift(Uu(u,te,q))):x||(te=su(u,S),te!=null&&D.push(Uu(u,te,q)))),u=u.return}D.length!==0&&i.push({event:l,listeners:D})}var NO=/\r\n?/g,OO=/\u0000|\uFFFD/g;function Qj(i){return(typeof i=="string"?i:""+i).replace(NO,`
179
- `).replace(OO,"")}function Yj(i,l){return l=Qj(l),Qj(i)===l}function nn(i,l,u,h,x,S){switch(u){case"children":typeof h=="string"?l==="body"||l==="textarea"&&h===""||Pl(i,h):(typeof h=="number"||typeof h=="bigint")&&l!=="body"&&Pl(i,""+h);break;case"className":an(i,"class",h);break;case"tabIndex":an(i,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":an(i,u,h);break;case"style":YS(i,h,S);break;case"data":if(l!=="object"){an(i,"data",h);break}case"src":case"href":if(h===""&&(l!=="a"||u!=="href")){i.removeAttribute(u);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){i.removeAttribute(u);break}h=ff(""+h),i.setAttribute(u,h);break;case"action":case"formAction":if(typeof h=="function"){i.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof S=="function"&&(u==="formAction"?(l!=="input"&&nn(i,l,"name",x.name,x,null),nn(i,l,"formEncType",x.formEncType,x,null),nn(i,l,"formMethod",x.formMethod,x,null),nn(i,l,"formTarget",x.formTarget,x,null)):(nn(i,l,"encType",x.encType,x,null),nn(i,l,"method",x.method,x,null),nn(i,l,"target",x.target,x,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){i.removeAttribute(u);break}h=ff(""+h),i.setAttribute(u,h);break;case"onClick":h!=null&&(i.onclick=Ho);break;case"onScroll":h!=null&&_t("scroll",i);break;case"onScrollEnd":h!=null&&_t("scrollend",i);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(x.children!=null)throw Error(r(60));i.innerHTML=u}}break;case"multiple":i.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":i.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){i.removeAttribute("xlink:href");break}u=ff(""+h),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?i.setAttribute(u,""+h):i.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?i.setAttribute(u,""):i.removeAttribute(u);break;case"capture":case"download":h===!0?i.setAttribute(u,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?i.setAttribute(u,h):i.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?i.setAttribute(u,h):i.removeAttribute(u);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?i.removeAttribute(u):i.setAttribute(u,h);break;case"popover":_t("beforetoggle",i),_t("toggle",i),mi(i,"popover",h);break;case"xlinkActuate":$r(i,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":$r(i,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":$r(i,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":$r(i,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":$r(i,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":$r(i,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":$r(i,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":$r(i,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":$r(i,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":mi(i,"is",h);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=lN.get(u)||u,mi(i,u,h))}}function zv(i,l,u,h,x,S){switch(u){case"style":YS(i,h,S);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(x.children!=null)throw Error(r(60));i.innerHTML=u}}break;case"children":typeof h=="string"?Pl(i,h):(typeof h=="number"||typeof h=="bigint")&&Pl(i,""+h);break;case"onScroll":h!=null&&_t("scroll",i);break;case"onScrollEnd":h!=null&&_t("scrollend",i);break;case"onClick":h!=null&&(i.onclick=Ho);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!_a.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(x=u.endsWith("Capture"),l=u.slice(2,x?u.length-7:void 0),S=i[Ve]||null,S=S!=null?S[u]:null,typeof S=="function"&&i.removeEventListener(l,S,x),typeof h=="function")){typeof S!="function"&&S!==null&&(u in i?i[u]=null:i.hasAttribute(u)&&i.removeAttribute(u)),i.addEventListener(l,h,x);break e}u in i?i[u]=h:h===!0?i.setAttribute(u,""):mi(i,u,h)}}}function ur(i,l,u){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":_t("error",i),_t("load",i);var h=!1,x=!1,S;for(S in u)if(u.hasOwnProperty(S)){var D=u[S];if(D!=null)switch(S){case"src":h=!0;break;case"srcSet":x=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:nn(i,l,S,D,u,null)}}x&&nn(i,l,"srcSet",u.srcSet,u,null),h&&nn(i,l,"src",u.src,u,null);return;case"input":_t("invalid",i);var P=S=D=x=null,q=null,te=null;for(h in u)if(u.hasOwnProperty(h)){var fe=u[h];if(fe!=null)switch(h){case"name":x=fe;break;case"type":D=fe;break;case"checked":q=fe;break;case"defaultChecked":te=fe;break;case"value":S=fe;break;case"defaultValue":P=fe;break;case"children":case"dangerouslySetInnerHTML":if(fe!=null)throw Error(r(137,l));break;default:nn(i,l,h,fe,u,null)}}qS(i,S,P,q,te,D,x,!1);return;case"select":_t("invalid",i),h=D=S=null;for(x in u)if(u.hasOwnProperty(x)&&(P=u[x],P!=null))switch(x){case"value":S=P;break;case"defaultValue":D=P;break;case"multiple":h=P;default:nn(i,l,x,P,u,null)}l=S,u=D,i.multiple=!!h,l!=null?kl(i,!!h,l,!1):u!=null&&kl(i,!!h,u,!0);return;case"textarea":_t("invalid",i),S=x=h=null;for(D in u)if(u.hasOwnProperty(D)&&(P=u[D],P!=null))switch(D){case"value":h=P;break;case"defaultValue":x=P;break;case"children":S=P;break;case"dangerouslySetInnerHTML":if(P!=null)throw Error(r(91));break;default:nn(i,l,D,P,u,null)}WS(i,h,x,S);return;case"option":for(q in u)if(u.hasOwnProperty(q)&&(h=u[q],h!=null))switch(q){case"selected":i.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:nn(i,l,q,h,u,null)}return;case"dialog":_t("beforetoggle",i),_t("toggle",i),_t("cancel",i),_t("close",i);break;case"iframe":case"object":_t("load",i);break;case"video":case"audio":for(h=0;h<$u.length;h++)_t($u[h],i);break;case"image":_t("error",i),_t("load",i);break;case"details":_t("toggle",i);break;case"embed":case"source":case"link":_t("error",i),_t("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in u)if(u.hasOwnProperty(te)&&(h=u[te],h!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:nn(i,l,te,h,u,null)}return;default:if(Jm(l)){for(fe in u)u.hasOwnProperty(fe)&&(h=u[fe],h!==void 0&&zv(i,l,fe,h,u,void 0));return}}for(P in u)u.hasOwnProperty(P)&&(h=u[P],h!=null&&nn(i,l,P,h,u,null))}function MO(i,l,u,h){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var x=null,S=null,D=null,P=null,q=null,te=null,fe=null;for(se in u){var ye=u[se];if(u.hasOwnProperty(se)&&ye!=null)switch(se){case"checked":break;case"value":break;case"defaultValue":q=ye;default:h.hasOwnProperty(se)||nn(i,l,se,null,h,ye)}}for(var re in h){var se=h[re];if(ye=u[re],h.hasOwnProperty(re)&&(se!=null||ye!=null))switch(re){case"type":S=se;break;case"name":x=se;break;case"checked":te=se;break;case"defaultChecked":fe=se;break;case"value":D=se;break;case"defaultValue":P=se;break;case"children":case"dangerouslySetInnerHTML":if(se!=null)throw Error(r(137,l));break;default:se!==ye&&nn(i,l,re,se,h,ye)}}Km(i,D,P,q,te,fe,S,x);return;case"select":se=D=P=re=null;for(S in u)if(q=u[S],u.hasOwnProperty(S)&&q!=null)switch(S){case"value":break;case"multiple":se=q;default:h.hasOwnProperty(S)||nn(i,l,S,null,h,q)}for(x in h)if(S=h[x],q=u[x],h.hasOwnProperty(x)&&(S!=null||q!=null))switch(x){case"value":re=S;break;case"defaultValue":P=S;break;case"multiple":D=S;default:S!==q&&nn(i,l,x,S,h,q)}l=P,u=D,h=se,re!=null?kl(i,!!u,re,!1):!!h!=!!u&&(l!=null?kl(i,!!u,l,!0):kl(i,!!u,u?[]:"",!1));return;case"textarea":se=re=null;for(P in u)if(x=u[P],u.hasOwnProperty(P)&&x!=null&&!h.hasOwnProperty(P))switch(P){case"value":break;case"children":break;default:nn(i,l,P,null,h,x)}for(D in h)if(x=h[D],S=u[D],h.hasOwnProperty(D)&&(x!=null||S!=null))switch(D){case"value":re=x;break;case"defaultValue":se=x;break;case"children":break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:x!==S&&nn(i,l,D,x,h,S)}GS(i,re,se);return;case"option":for(var qe in u)if(re=u[qe],u.hasOwnProperty(qe)&&re!=null&&!h.hasOwnProperty(qe))switch(qe){case"selected":i.selected=!1;break;default:nn(i,l,qe,null,h,re)}for(q in h)if(re=h[q],se=u[q],h.hasOwnProperty(q)&&re!==se&&(re!=null||se!=null))switch(q){case"selected":i.selected=re&&typeof re!="function"&&typeof re!="symbol";break;default:nn(i,l,q,re,h,se)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ut in u)re=u[ut],u.hasOwnProperty(ut)&&re!=null&&!h.hasOwnProperty(ut)&&nn(i,l,ut,null,h,re);for(te in h)if(re=h[te],se=u[te],h.hasOwnProperty(te)&&re!==se&&(re!=null||se!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(r(137,l));break;default:nn(i,l,te,re,h,se)}return;default:if(Jm(l)){for(var rn in u)re=u[rn],u.hasOwnProperty(rn)&&re!==void 0&&!h.hasOwnProperty(rn)&&zv(i,l,rn,void 0,h,re);for(fe in h)re=h[fe],se=u[fe],!h.hasOwnProperty(fe)||re===se||re===void 0&&se===void 0||zv(i,l,fe,re,h,se);return}}for(var K in u)re=u[K],u.hasOwnProperty(K)&&re!=null&&!h.hasOwnProperty(K)&&nn(i,l,K,null,h,re);for(ye in h)re=h[ye],se=u[ye],!h.hasOwnProperty(ye)||re===se||re==null&&se==null||nn(i,l,ye,re,h,se)}function Kj(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function LO(){if(typeof performance.getEntriesByType=="function"){for(var i=0,l=0,u=performance.getEntriesByType("resource"),h=0;h<u.length;h++){var x=u[h],S=x.transferSize,D=x.initiatorType,P=x.duration;if(S&&P&&Kj(D)){for(D=0,P=x.responseEnd,h+=1;h<u.length;h++){var q=u[h],te=q.startTime;if(te>P)break;var fe=q.transferSize,ye=q.initiatorType;fe&&Kj(ye)&&(q=q.responseEnd,D+=fe*(q<P?1:(P-te)/(q-te)))}if(--h,l+=8*(S+D)/(x.duration/1e3),i++,10<i)break}}if(0<i)return l/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var $v=null,Uv=null;function sh(i){return i.nodeType===9?i:i.ownerDocument}function Xj(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Jj(i,l){if(i===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&l==="foreignObject"?0:i}function Bv(i,l){return i==="textarea"||i==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Vv=null;function IO(){var i=window.event;return i&&i.type==="popstate"?i===Vv?!1:(Vv=i,!0):(Vv=null,!1)}var Zj=typeof setTimeout=="function"?setTimeout:void 0,zO=typeof clearTimeout=="function"?clearTimeout:void 0,eC=typeof Promise=="function"?Promise:void 0,$O=typeof queueMicrotask=="function"?queueMicrotask:typeof eC<"u"?function(i){return eC.resolve(null).then(i).catch(UO)}:Zj;function UO(i){setTimeout(function(){throw i})}function Wa(i){return i==="head"}function tC(i,l){var u=l,h=0;do{var x=u.nextSibling;if(i.removeChild(u),x&&x.nodeType===8)if(u=x.data,u==="/$"||u==="/&"){if(h===0){i.removeChild(x),cc(l);return}h--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")h++;else if(u==="html")Bu(i.ownerDocument.documentElement);else if(u==="head"){u=i.ownerDocument.head,Bu(u);for(var S=u.firstChild;S;){var D=S.nextSibling,P=S.nodeName;S[hn]||P==="SCRIPT"||P==="STYLE"||P==="LINK"&&S.rel.toLowerCase()==="stylesheet"||u.removeChild(S),S=D}}else u==="body"&&Bu(i.ownerDocument.body);u=x}while(u);cc(l)}function nC(i,l){var u=i;i=0;do{var h=u.nextSibling;if(u.nodeType===1?l?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(l?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),h&&h.nodeType===8)if(u=h.data,u==="/$"){if(i===0)break;i--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||i++;u=h}while(u)}function Fv(i){var l=i.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var u=l;switch(l=l.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Fv(u),qt(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}i.removeChild(u)}}function BO(i,l,u,h){for(;i.nodeType===1;){var x=u;if(i.nodeName.toLowerCase()!==l.toLowerCase()){if(!h&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(h){if(!i[hn])switch(l){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(S=i.getAttribute("rel"),S==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(S!==x.rel||i.getAttribute("href")!==(x.href==null||x.href===""?null:x.href)||i.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin)||i.getAttribute("title")!==(x.title==null?null:x.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(S=i.getAttribute("src"),(S!==(x.src==null?null:x.src)||i.getAttribute("type")!==(x.type==null?null:x.type)||i.getAttribute("crossorigin")!==(x.crossOrigin==null?null:x.crossOrigin))&&S&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(l==="input"&&i.type==="hidden"){var S=x.name==null?null:""+x.name;if(x.type==="hidden"&&i.getAttribute("name")===S)return i}else return i;if(i=ji(i.nextSibling),i===null)break}return null}function VO(i,l,u){if(l==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!u||(i=ji(i.nextSibling),i===null))return null;return i}function rC(i,l){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!l||(i=ji(i.nextSibling),i===null))return null;return i}function Hv(i){return i.data==="$?"||i.data==="$~"}function qv(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function FO(i,l){var u=i.ownerDocument;if(i.data==="$~")i._reactRetry=l;else if(i.data!=="$?"||u.readyState!=="loading")l();else{var h=function(){l(),u.removeEventListener("DOMContentLoaded",h)};u.addEventListener("DOMContentLoaded",h),i._reactRetry=h}}function ji(i){for(;i!=null;i=i.nextSibling){var l=i.nodeType;if(l===1||l===3)break;if(l===8){if(l=i.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return i}var Gv=null;function iC(i){i=i.nextSibling;for(var l=0;i;){if(i.nodeType===8){var u=i.data;if(u==="/$"||u==="/&"){if(l===0)return ji(i.nextSibling);l--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||l++}i=i.nextSibling}return null}function oC(i){i=i.previousSibling;for(var l=0;i;){if(i.nodeType===8){var u=i.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(l===0)return i;l--}else u!=="/$"&&u!=="/&"||l++}i=i.previousSibling}return null}function aC(i,l,u){switch(l=sh(u),i){case"html":if(i=l.documentElement,!i)throw Error(r(452));return i;case"head":if(i=l.head,!i)throw Error(r(453));return i;case"body":if(i=l.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function Bu(i){for(var l=i.attributes;l.length;)i.removeAttributeNode(l[0]);qt(i)}var Ci=new Map,sC=new Set;function lh(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var aa=I.d;I.d={f:HO,r:qO,D:GO,C:WO,L:QO,m:YO,X:XO,S:KO,M:JO};function HO(){var i=aa.f(),l=Zf();return i||l}function qO(i){var l=zr(i);l!==null&&l.tag===5&&l.type==="form"?Cw(l):aa.r(i)}var ac=typeof document>"u"?null:document;function lC(i,l,u){var h=ac;if(h&&typeof l=="string"&&l){var x=gi(l);x='link[rel="'+i+'"][href="'+x+'"]',typeof u=="string"&&(x+='[crossorigin="'+u+'"]'),sC.has(x)||(sC.add(x),i={rel:i,crossOrigin:u,href:l},h.querySelector(x)===null&&(l=h.createElement("link"),ur(l,"link",i),Xt(l),h.head.appendChild(l)))}}function GO(i){aa.D(i),lC("dns-prefetch",i,null)}function WO(i,l){aa.C(i,l),lC("preconnect",i,l)}function QO(i,l,u){aa.L(i,l,u);var h=ac;if(h&&i&&l){var x='link[rel="preload"][as="'+gi(l)+'"]';l==="image"&&u&&u.imageSrcSet?(x+='[imagesrcset="'+gi(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(x+='[imagesizes="'+gi(u.imageSizes)+'"]')):x+='[href="'+gi(i)+'"]';var S=x;switch(l){case"style":S=sc(i);break;case"script":S=lc(i)}Ci.has(S)||(i=g({rel:"preload",href:l==="image"&&u&&u.imageSrcSet?void 0:i,as:l},u),Ci.set(S,i),h.querySelector(x)!==null||l==="style"&&h.querySelector(Vu(S))||l==="script"&&h.querySelector(Fu(S))||(l=h.createElement("link"),ur(l,"link",i),Xt(l),h.head.appendChild(l)))}}function YO(i,l){aa.m(i,l);var u=ac;if(u&&i){var h=l&&typeof l.as=="string"?l.as:"script",x='link[rel="modulepreload"][as="'+gi(h)+'"][href="'+gi(i)+'"]',S=x;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":S=lc(i)}if(!Ci.has(S)&&(i=g({rel:"modulepreload",href:i},l),Ci.set(S,i),u.querySelector(x)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Fu(S)))return}h=u.createElement("link"),ur(h,"link",i),Xt(h),u.head.appendChild(h)}}}function KO(i,l,u){aa.S(i,l,u);var h=ac;if(h&&i){var x=Cr(h).hoistableStyles,S=sc(i);l=l||"default";var D=x.get(S);if(!D){var P={loading:0,preload:null};if(D=h.querySelector(Vu(S)))P.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":l},u),(u=Ci.get(S))&&Wv(i,u);var q=D=h.createElement("link");Xt(q),ur(q,"link",i),q._p=new Promise(function(te,fe){q.onload=te,q.onerror=fe}),q.addEventListener("load",function(){P.loading|=1}),q.addEventListener("error",function(){P.loading|=2}),P.loading|=4,ch(D,l,h)}D={type:"stylesheet",instance:D,count:1,state:P},x.set(S,D)}}}function XO(i,l){aa.X(i,l);var u=ac;if(u&&i){var h=Cr(u).hoistableScripts,x=lc(i),S=h.get(x);S||(S=u.querySelector(Fu(x)),S||(i=g({src:i,async:!0},l),(l=Ci.get(x))&&Qv(i,l),S=u.createElement("script"),Xt(S),ur(S,"link",i),u.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},h.set(x,S))}}function JO(i,l){aa.M(i,l);var u=ac;if(u&&i){var h=Cr(u).hoistableScripts,x=lc(i),S=h.get(x);S||(S=u.querySelector(Fu(x)),S||(i=g({src:i,async:!0,type:"module"},l),(l=Ci.get(x))&&Qv(i,l),S=u.createElement("script"),Xt(S),ur(S,"link",i),u.head.appendChild(S)),S={type:"script",instance:S,count:1,state:null},h.set(x,S))}}function cC(i,l,u,h){var x=(x=ge.current)?lh(x):null;if(!x)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(l=sc(u.href),u=Cr(x).hoistableStyles,h=u.get(l),h||(h={type:"style",instance:null,count:0,state:null},u.set(l,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){i=sc(u.href);var S=Cr(x).hoistableStyles,D=S.get(i);if(D||(x=x.ownerDocument||x,D={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},S.set(i,D),(S=x.querySelector(Vu(i)))&&!S._p&&(D.instance=S,D.state.loading=5),Ci.has(i)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Ci.set(i,u),S||ZO(x,i,u,D.state))),l&&h===null)throw Error(r(528,""));return D}if(l&&h!==null)throw Error(r(529,""));return null;case"script":return l=u.async,u=u.src,typeof u=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=lc(u),u=Cr(x).hoistableScripts,h=u.get(l),h||(h={type:"script",instance:null,count:0,state:null},u.set(l,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function sc(i){return'href="'+gi(i)+'"'}function Vu(i){return'link[rel="stylesheet"]['+i+"]"}function uC(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function ZO(i,l,u,h){i.querySelector('link[rel="preload"][as="style"]['+l+"]")?h.loading=1:(l=i.createElement("link"),h.preload=l,l.addEventListener("load",function(){return h.loading|=1}),l.addEventListener("error",function(){return h.loading|=2}),ur(l,"link",u),Xt(l),i.head.appendChild(l))}function lc(i){return'[src="'+gi(i)+'"]'}function Fu(i){return"script[async]"+i}function dC(i,l,u){if(l.count++,l.instance===null)switch(l.type){case"style":var h=i.querySelector('style[data-href~="'+gi(u.href)+'"]');if(h)return l.instance=h,Xt(h),h;var x=g({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(i.ownerDocument||i).createElement("style"),Xt(h),ur(h,"style",x),ch(h,u.precedence,i),l.instance=h;case"stylesheet":x=sc(u.href);var S=i.querySelector(Vu(x));if(S)return l.state.loading|=4,l.instance=S,Xt(S),S;h=uC(u),(x=Ci.get(x))&&Wv(h,x),S=(i.ownerDocument||i).createElement("link"),Xt(S);var D=S;return D._p=new Promise(function(P,q){D.onload=P,D.onerror=q}),ur(S,"link",h),l.state.loading|=4,ch(S,u.precedence,i),l.instance=S;case"script":return S=lc(u.src),(x=i.querySelector(Fu(S)))?(l.instance=x,Xt(x),x):(h=u,(x=Ci.get(S))&&(h=g({},u),Qv(h,x)),i=i.ownerDocument||i,x=i.createElement("script"),Xt(x),ur(x,"link",h),i.head.appendChild(x),l.instance=x);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(h=l.instance,l.state.loading|=4,ch(h,u.precedence,i));return l.instance}function ch(i,l,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),x=h.length?h[h.length-1]:null,S=x,D=0;D<h.length;D++){var P=h[D];if(P.dataset.precedence===l)S=P;else if(S!==x)break}S?S.parentNode.insertBefore(i,S.nextSibling):(l=u.nodeType===9?u.head:u,l.insertBefore(i,l.firstChild))}function Wv(i,l){i.crossOrigin==null&&(i.crossOrigin=l.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=l.referrerPolicy),i.title==null&&(i.title=l.title)}function Qv(i,l){i.crossOrigin==null&&(i.crossOrigin=l.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=l.referrerPolicy),i.integrity==null&&(i.integrity=l.integrity)}var uh=null;function fC(i,l,u){if(uh===null){var h=new Map,x=uh=new Map;x.set(u,h)}else x=uh,h=x.get(u),h||(h=new Map,x.set(u,h));if(h.has(i))return h;for(h.set(i,null),u=u.getElementsByTagName(i),x=0;x<u.length;x++){var S=u[x];if(!(S[hn]||S[Me]||i==="link"&&S.getAttribute("rel")==="stylesheet")&&S.namespaceURI!=="http://www.w3.org/2000/svg"){var D=S.getAttribute(l)||"";D=i+D;var P=h.get(D);P?P.push(S):h.set(D,[S])}}return h}function hC(i,l,u){i=i.ownerDocument||i,i.head.insertBefore(u,l==="title"?i.querySelector("head > title"):null)}function e3(i,l,u){if(u===1||l.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return i=l.disabled,typeof l.precedence=="string"&&i==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function pC(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function t3(i,l,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var x=sc(h.href),S=l.querySelector(Vu(x));if(S){l=S._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(i.count++,i=dh.bind(i),l.then(i,i)),u.state.loading|=4,u.instance=S,Xt(S);return}S=l.ownerDocument||l,h=uC(h),(x=Ci.get(x))&&Wv(h,x),S=S.createElement("link"),Xt(S);var D=S;D._p=new Promise(function(P,q){D.onload=P,D.onerror=q}),ur(S,"link",h),u.instance=S}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(u,l),(l=u.state.preload)&&(u.state.loading&3)===0&&(i.count++,u=dh.bind(i),l.addEventListener("load",u),l.addEventListener("error",u))}}var Yv=0;function n3(i,l){return i.stylesheets&&i.count===0&&hh(i,i.stylesheets),0<i.count||0<i.imgCount?function(u){var h=setTimeout(function(){if(i.stylesheets&&hh(i,i.stylesheets),i.unsuspend){var S=i.unsuspend;i.unsuspend=null,S()}},6e4+l);0<i.imgBytes&&Yv===0&&(Yv=62500*LO());var x=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&hh(i,i.stylesheets),i.unsuspend)){var S=i.unsuspend;i.unsuspend=null,S()}},(i.imgBytes>Yv?50:800)+l);return i.unsuspend=u,function(){i.unsuspend=null,clearTimeout(h),clearTimeout(x)}}:null}function dh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)hh(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var fh=null;function hh(i,l){i.stylesheets=null,i.unsuspend!==null&&(i.count++,fh=new Map,l.forEach(r3,i),fh=null,dh.call(i))}function r3(i,l){if(!(l.state.loading&4)){var u=fh.get(i);if(u)var h=u.get(null);else{u=new Map,fh.set(i,u);for(var x=i.querySelectorAll("link[data-precedence],style[data-precedence]"),S=0;S<x.length;S++){var D=x[S];(D.nodeName==="LINK"||D.getAttribute("media")!=="not all")&&(u.set(D.dataset.precedence,D),h=D)}h&&u.set(null,h)}x=l.instance,D=x.getAttribute("data-precedence"),S=u.get(D)||h,S===h&&u.set(null,x),u.set(D,x),this.count++,h=dh.bind(this),x.addEventListener("load",h),x.addEventListener("error",h),S?S.parentNode.insertBefore(x,S.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(x,i.firstChild)),l.state.loading|=4}}var Hu={$$typeof:E,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function i3(i,l,u,h,x,S,D,P,q){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Cs(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Cs(0),this.hiddenUpdates=Cs(null),this.identifierPrefix=h,this.onUncaughtError=x,this.onCaughtError=S,this.onRecoverableError=D,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=q,this.incompleteTransitions=new Map}function mC(i,l,u,h,x,S,D,P,q,te,fe,ye){return i=new i3(i,l,u,D,q,te,fe,ye,P),l=1,S===!0&&(l|=24),S=ti(3,null,null,l),i.current=S,S.stateNode=i,l=_g(),l.refCount++,i.pooledCache=l,l.refCount++,S.memoizedState={element:h,isDehydrated:u,cache:l},Pg(S),i}function gC(i){return i?(i=$l,i):$l}function vC(i,l,u,h,x,S){x=gC(x),h.context===null?h.context=x:h.pendingContext=x,h=La(l),h.payload={element:u},S=S===void 0?null:S,S!==null&&(h.callback=S),u=Ia(i,h,l),u!==null&&(qr(u,i,l),wu(u,i,l))}function yC(i,l){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var u=i.retryLane;i.retryLane=u!==0&&u<l?u:l}}function Kv(i,l){yC(i,l),(i=i.alternate)&&yC(i,l)}function xC(i){if(i.tag===13||i.tag===31){var l=_s(i,67108864);l!==null&&qr(l,i,67108864),Kv(i,67108864)}}function bC(i){if(i.tag===13||i.tag===31){var l=ai();l=je(l);var u=_s(i,l);u!==null&&qr(u,i,l),Kv(i,l)}}var ph=!0;function o3(i,l,u,h){var x=M.T;M.T=null;var S=I.p;try{I.p=2,Xv(i,l,u,h)}finally{I.p=S,M.T=x}}function a3(i,l,u,h){var x=M.T;M.T=null;var S=I.p;try{I.p=8,Xv(i,l,u,h)}finally{I.p=S,M.T=x}}function Xv(i,l,u,h){if(ph){var x=Jv(h);if(x===null)Iv(i,l,h,mh,u),wC(i,h);else if(l3(x,i,l,u,h))h.stopPropagation();else if(wC(i,h),l&4&&-1<s3.indexOf(i)){for(;x!==null;){var S=zr(x);if(S!==null)switch(S.tag){case 3:if(S=S.stateNode,S.current.memoizedState.isDehydrated){var D=Ir(S.pendingLanes);if(D!==0){var P=S;for(P.pendingLanes|=2,P.entangledLanes|=2;D;){var q=1<<31-Nn(D);P.entanglements[1]|=q,D&=~q}fo(S),(Gt&6)===0&&(Xf=ve()+500,zu(0))}}break;case 31:case 13:P=_s(S,2),P!==null&&qr(P,S,2),Zf(),Kv(S,2)}if(S=Jv(h),S===null&&Iv(i,l,h,mh,u),S===x)break;x=S}x!==null&&h.stopPropagation()}else Iv(i,l,h,null,u)}}function Jv(i){return i=eg(i),Zv(i)}var mh=null;function Zv(i){if(mh=null,i=Ut(i),i!==null){var l=s(i);if(l===null)i=null;else{var u=l.tag;if(u===13){if(i=c(l),i!==null)return i;i=null}else if(u===31){if(i=d(l),i!==null)return i;i=null}else if(u===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;i=null}else l!==i&&(i=null)}}return mh=i,null}function SC(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(pe()){case Oe:return 2;case tt:return 8;case Tt:case Cn:return 32;case gn:return 268435456;default:return 32}default:return 32}}var ey=!1,Qa=null,Ya=null,Ka=null,qu=new Map,Gu=new Map,Xa=[],s3="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function wC(i,l){switch(i){case"focusin":case"focusout":Qa=null;break;case"dragenter":case"dragleave":Ya=null;break;case"mouseover":case"mouseout":Ka=null;break;case"pointerover":case"pointerout":qu.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Gu.delete(l.pointerId)}}function Wu(i,l,u,h,x,S){return i===null||i.nativeEvent!==S?(i={blockedOn:l,domEventName:u,eventSystemFlags:h,nativeEvent:S,targetContainers:[x]},l!==null&&(l=zr(l),l!==null&&xC(l)),i):(i.eventSystemFlags|=h,l=i.targetContainers,x!==null&&l.indexOf(x)===-1&&l.push(x),i)}function l3(i,l,u,h,x){switch(l){case"focusin":return Qa=Wu(Qa,i,l,u,h,x),!0;case"dragenter":return Ya=Wu(Ya,i,l,u,h,x),!0;case"mouseover":return Ka=Wu(Ka,i,l,u,h,x),!0;case"pointerover":var S=x.pointerId;return qu.set(S,Wu(qu.get(S)||null,i,l,u,h,x)),!0;case"gotpointercapture":return S=x.pointerId,Gu.set(S,Wu(Gu.get(S)||null,i,l,u,h,x)),!0}return!1}function jC(i){var l=Ut(i.target);if(l!==null){var u=s(l);if(u!==null){if(l=u.tag,l===13){if(l=c(u),l!==null){i.blockedOn=l,Ke(i.priority,function(){bC(u)});return}}else if(l===31){if(l=d(u),l!==null){i.blockedOn=l,Ke(i.priority,function(){bC(u)});return}}else if(l===3&&u.stateNode.current.memoizedState.isDehydrated){i.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}i.blockedOn=null}function gh(i){if(i.blockedOn!==null)return!1;for(var l=i.targetContainers;0<l.length;){var u=Jv(i.nativeEvent);if(u===null){u=i.nativeEvent;var h=new u.constructor(u.type,u);Zm=h,u.target.dispatchEvent(h),Zm=null}else return l=zr(u),l!==null&&xC(l),i.blockedOn=u,!1;l.shift()}return!0}function CC(i,l,u){gh(i)&&u.delete(l)}function c3(){ey=!1,Qa!==null&&gh(Qa)&&(Qa=null),Ya!==null&&gh(Ya)&&(Ya=null),Ka!==null&&gh(Ka)&&(Ka=null),qu.forEach(CC),Gu.forEach(CC)}function vh(i,l){i.blockedOn===l&&(i.blockedOn=null,ey||(ey=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,c3)))}var yh=null;function EC(i){yh!==i&&(yh=i,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){yh===i&&(yh=null);for(var l=0;l<i.length;l+=3){var u=i[l],h=i[l+1],x=i[l+2];if(typeof h!="function"){if(Zv(h||u)===null)continue;break}var S=zr(u);S!==null&&(i.splice(l,3),l-=3,Jg(S,{pending:!0,data:x,method:u.method,action:h},h,x))}}))}function cc(i){function l(q){return vh(q,i)}Qa!==null&&vh(Qa,i),Ya!==null&&vh(Ya,i),Ka!==null&&vh(Ka,i),qu.forEach(l),Gu.forEach(l);for(var u=0;u<Xa.length;u++){var h=Xa[u];h.blockedOn===i&&(h.blockedOn=null)}for(;0<Xa.length&&(u=Xa[0],u.blockedOn===null);)jC(u),u.blockedOn===null&&Xa.shift();if(u=(i.ownerDocument||i).$$reactFormReplay,u!=null)for(h=0;h<u.length;h+=3){var x=u[h],S=u[h+1],D=x[Ve]||null;if(typeof S=="function")D||EC(u);else if(D){var P=null;if(S&&S.hasAttribute("formAction")){if(x=S,D=S[Ve]||null)P=D.formAction;else if(Zv(x)!==null)continue}else P=D.action;typeof P=="function"?u[h+1]=P:(u.splice(h,3),h-=3),EC(u)}}}function TC(){function i(S){S.canIntercept&&S.info==="react-transition"&&S.intercept({handler:function(){return new Promise(function(D){return x=D})},focusReset:"manual",scroll:"manual"})}function l(){x!==null&&(x(),x=null),h||setTimeout(u,20)}function u(){if(!h&&!navigation.transition){var S=navigation.currentEntry;S&&S.url!=null&&navigation.navigate(S.url,{state:S.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,x=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(u,100),function(){h=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),x!==null&&(x(),x=null)}}}function ty(i){this._internalRoot=i}xh.prototype.render=ty.prototype.render=function(i){var l=this._internalRoot;if(l===null)throw Error(r(409));var u=l.current,h=ai();vC(u,h,i,l,null,null)},xh.prototype.unmount=ty.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var l=i.containerInfo;vC(i.current,2,null,i,null,null),Zf(),l[Qe]=null}};function xh(i){this._internalRoot=i}xh.prototype.unstable_scheduleHydration=function(i){if(i){var l=We();i={blockedOn:null,target:i,priority:l};for(var u=0;u<Xa.length&&l!==0&&l<Xa[u].priority;u++);Xa.splice(u,0,i),u===0&&jC(i)}};var RC=t.version;if(RC!=="19.2.0")throw Error(r(527,RC,"19.2.0"));I.findDOMNode=function(i){var l=i._reactInternals;if(l===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=p(l),i=i!==null?m(i):null,i=i===null?null:i.stateNode,i};var u3={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:M,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var bh=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!bh.isDisabled&&bh.supportsFiber)try{Un=bh.inject(u3),Dn=bh}catch{}}return ed.createRoot=function(i,l){if(!o(i))throw Error(r(299));var u=!1,h="",x=Ow,S=Mw,D=Lw;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(h=l.identifierPrefix),l.onUncaughtError!==void 0&&(x=l.onUncaughtError),l.onCaughtError!==void 0&&(S=l.onCaughtError),l.onRecoverableError!==void 0&&(D=l.onRecoverableError)),l=mC(i,1,!1,null,null,u,h,null,x,S,D,TC),i[Qe]=l.current,Lv(i),new ty(l)},ed.hydrateRoot=function(i,l,u){if(!o(i))throw Error(r(299));var h=!1,x="",S=Ow,D=Mw,P=Lw,q=null;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(x=u.identifierPrefix),u.onUncaughtError!==void 0&&(S=u.onUncaughtError),u.onCaughtError!==void 0&&(D=u.onCaughtError),u.onRecoverableError!==void 0&&(P=u.onRecoverableError),u.formState!==void 0&&(q=u.formState)),l=mC(i,1,!0,l,u??null,h,x,q,S,D,P,TC),l.context=gC(null),u=l.current,h=ai(),h=je(h),x=La(h),x.callback=null,Ia(u,x,h),u=h,l.current.lanes=u,Fo(l,u),fo(l),i[Qe]=l.current,Lv(i),new xh(l)},ed.version="19.2.0",ed}var rR;function KX(){if(rR)return Uy.exports;rR=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Uy.exports=YX(),Uy.exports}var XX=KX();var lP=e=>{throw TypeError(e)},JX=(e,t,n)=>t.has(e)||lP("Cannot "+n),Fy=(e,t,n)=>(JX(e,t,"read from private field"),n?n.call(e):t.get(e)),ZX=(e,t,n)=>t.has(e)?lP("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),iR="popstate";function eJ(e={}){function t(r,o){let{pathname:s,search:c,hash:d}=r.location;return Ed("",{pathname:s,search:c,hash:d},o.state&&o.state.usr||null,o.state&&o.state.key||"default")}function n(r,o){return typeof o=="string"?o:ko(o)}return nJ(t,n,null,e)}function bt(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function In(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function tJ(){return Math.random().toString(36).substring(2,10)}function oR(e,t){return{usr:e.state,key:e.key,idx:t}}function Ed(e,t,n=null,r){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?Ra(t):t,state:n,key:t&&t.key||r||tJ()}}function ko({pathname:e="/",search:t="",hash:n=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ra(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function nJ(e,t,n,r={}){let{window:o=document.defaultView,v5Compat:s=!1}=r,c=o.history,d="POP",f=null,p=m();p==null&&(p=0,c.replaceState({...c.state,idx:p},""));function m(){return(c.state||{idx:null}).idx}function g(){d="POP";let C=m(),R=C==null?null:C-p;p=C,f&&f({action:d,location:j.location,delta:R})}function y(C,R){d="PUSH";let T=Ed(j.location,C,R);p=m()+1;let E=oR(T,p),_=j.createHref(T);try{c.pushState(E,"",_)}catch(k){if(k instanceof DOMException&&k.name==="DataCloneError")throw k;o.location.assign(_)}s&&f&&f({action:d,location:j.location,delta:1})}function b(C,R){d="REPLACE";let T=Ed(j.location,C,R);p=m();let E=oR(T,p),_=j.createHref(T);c.replaceState(E,"",_),s&&f&&f({action:d,location:j.location,delta:0})}function w(C){return cP(C)}let j={get action(){return d},get location(){return e(o,c)},listen(C){if(f)throw new Error("A history only accepts one active listener");return o.addEventListener(iR,g),f=C,()=>{o.removeEventListener(iR,g),f=null}},createHref(C){return t(o,C)},createURL:w,encodeLocation(C){let R=w(C);return{pathname:R.pathname,search:R.search,hash:R.hash}},push:y,replace:b,go(C){return c.go(C)}};return j}function cP(e,t=!1){let n="http://localhost";typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),bt(n,"No window.location.(origin|href) available to create URL");let r=typeof e=="string"?e:ko(e);return r=r.replace(/ $/,"%20"),!t&&r.startsWith("//")&&(r=n+r),new URL(r,n)}var ad,aR=class{constructor(e){if(ZX(this,ad,new Map),e)for(let[t,n]of e)this.set(t,n)}get(e){if(Fy(this,ad).has(e))return Fy(this,ad).get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw new Error("No value found for context")}set(e,t){Fy(this,ad).set(e,t)}};ad=new WeakMap;var rJ=new Set(["lazy","caseSensitive","path","id","index","children"]);function iJ(e){return rJ.has(e)}var oJ=new Set(["lazy","caseSensitive","path","id","index","middleware","children"]);function aJ(e){return oJ.has(e)}function sJ(e){return e.index===!0}function Td(e,t,n=[],r={},o=!1){return e.map((s,c)=>{let d=[...n,String(c)],f=typeof s.id=="string"?s.id:d.join("-");if(bt(s.index!==!0||!s.children,"Cannot specify children on an index route"),bt(o||!r[f],`Found a route id collision on id "${f}". Route id's must be globally unique within Data Router usages`),sJ(s)){let p={...s,id:f};return r[f]=sR(p,t(p)),p}else{let p={...s,id:f,children:void 0};return r[f]=sR(p,t(p)),s.children&&(p.children=Td(s.children,t,d,r,o)),p}})}function sR(e,t){return Object.assign(e,{...t,...typeof t.lazy=="object"&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function is(e,t,n="/"){return sd(e,t,n,!1)}function sd(e,t,n,r){let o=typeof t=="string"?Ra(t):t,s=Ni(o.pathname||"/",n);if(s==null)return null;let c=uP(e);cJ(c);let d=null;for(let f=0;d==null&&f<c.length;++f){let p=bJ(s);d=yJ(c[f],p,r)}return d}function lJ(e,t){let{route:n,pathname:r,params:o}=e;return{id:n.id,pathname:r,params:o,data:t[n.id],loaderData:t[n.id],handle:n.handle}}function uP(e,t=[],n=[],r="",o=!1){let s=(c,d,f=o,p)=>{let m={relativePath:p===void 0?c.path||"":p,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};if(m.relativePath.startsWith("/")){if(!m.relativePath.startsWith(r)&&f)return;bt(m.relativePath.startsWith(r),`Absolute route path "${m.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),m.relativePath=m.relativePath.slice(r.length)}let g=To([r,m.relativePath]),y=n.concat(m);c.children&&c.children.length>0&&(bt(c.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${g}".`),uP(c.children,t,y,g,f)),!(c.path==null&&!c.index)&&t.push({path:g,score:gJ(g,c.index),routesMeta:y})};return e.forEach((c,d)=>{if(c.path===""||!c.path?.includes("?"))s(c,d);else for(let f of dP(c.path))s(c,d,!0,f)}),t}function dP(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),s=n.replace(/\?$/,"");if(r.length===0)return o?[s,""]:[s];let c=dP(r.join("/")),d=[];return d.push(...c.map(f=>f===""?s:[s,f].join("/"))),o&&d.push(...c),d.map(f=>e.startsWith("/")&&f===""?"/":f)}function cJ(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:vJ(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var uJ=/^:[\w-]+$/,dJ=3,fJ=2,hJ=1,pJ=10,mJ=-2,lR=e=>e==="*";function gJ(e,t){let n=e.split("/"),r=n.length;return n.some(lR)&&(r+=mJ),t&&(r+=fJ),n.filter(o=>!lR(o)).reduce((o,s)=>o+(uJ.test(s)?dJ:s===""?hJ:pJ),r)}function vJ(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 yJ(e,t,n=!1){let{routesMeta:r}=e,o={},s="/",c=[];for(let d=0;d<r.length;++d){let f=r[d],p=d===r.length-1,m=s==="/"?t:t.slice(s.length)||"/",g=Ap({path:f.relativePath,caseSensitive:f.caseSensitive,end:p},m),y=f.route;if(!g&&p&&n&&!r[r.length-1].route.index&&(g=Ap({path:f.relativePath,caseSensitive:f.caseSensitive,end:!1},m)),!g)return null;Object.assign(o,g.params),c.push({params:o,pathname:To([s,g.pathname]),pathnameBase:CJ(To([s,g.pathnameBase])),route:y}),g.pathnameBase!=="/"&&(s=To([s,g.pathnameBase]))}return c}function Ap(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=xJ(e.path,e.caseSensitive,e.end),o=t.match(n);if(!o)return null;let s=o[0],c=s.replace(/(.)\/+$/,"$1"),d=o.slice(1);return{params:r.reduce((p,{paramName:m,isOptional:g},y)=>{if(m==="*"){let w=d[y]||"";c=s.slice(0,s.length-w.length).replace(/(.)\/+$/,"$1")}const b=d[y];return g&&!b?p[m]=void 0:p[m]=(b||"").replace(/%2F/g,"/"),p},{}),pathname:s,pathnameBase:c,pattern:e}}function xJ(e,t=!1,n=!0){In(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(c,d,f)=>(r.push({paramName:d,isOptional:f!=null}),f?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function bJ(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return In(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function Ni(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 SJ({basename:e,pathname:t}){return t==="/"?e:To([e,t])}var wJ=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,qm=e=>wJ.test(e);function jJ(e,t="/"){let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?Ra(e):e,s;if(n)if(qm(n))s=n;else{if(n.includes("//")){let c=n;n=n.replace(/\/\/+/g,"/"),In(!1,`Pathnames cannot have embedded double slashes - normalizing ${c} -> ${n}`)}n.startsWith("/")?s=cR(n.substring(1),"/"):s=cR(n,t)}else s=t;return{pathname:s,search:EJ(r),hash:TJ(o)}}function cR(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 Hy(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 fP(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function ES(e){let t=fP(e);return t.map((n,r)=>r===t.length-1?n.pathname:n.pathnameBase)}function TS(e,t,n,r=!1){let o;typeof e=="string"?o=Ra(e):(o={...e},bt(!o.pathname||!o.pathname.includes("?"),Hy("?","pathname","search",o)),bt(!o.pathname||!o.pathname.includes("#"),Hy("#","pathname","hash",o)),bt(!o.search||!o.search.includes("#"),Hy("#","search","hash",o)));let s=e===""||o.pathname==="",c=s?"/":o.pathname,d;if(c==null)d=n;else{let g=t.length-1;if(!r&&c.startsWith("..")){let y=c.split("/");for(;y[0]==="..";)y.shift(),g-=1;o.pathname=y.join("/")}d=g>=0?t[g]:"/"}let f=jJ(o,d),p=c&&c!=="/"&&c.endsWith("/"),m=(s||c===".")&&n.endsWith("/");return!f.pathname.endsWith("/")&&(p||m)&&(f.pathname+="/"),f}var To=e=>e.join("/").replace(/\/\/+/g,"/"),CJ=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),EJ=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,TJ=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e,kp=class{constructor(e,t,n,r=!1){this.status=e,this.statusText=t||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function Rd(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}function RS(e){return e.filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var ls=Symbol("Uninstrumented");function RJ(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(o=>o({id:t.id,index:t.index,path:t.path,instrument(s){let c=Object.keys(n);for(let d of c)s[d]&&n[d].push(s[d])}}));let r={};if(typeof t.lazy=="function"&&n.lazy.length>0){let o=Ec(n.lazy,t.lazy,()=>{});o&&(r.lazy=o)}if(typeof t.lazy=="object"){let o=t.lazy;["middleware","loader","action"].forEach(s=>{let c=o[s],d=n[`lazy.${s}`];if(typeof c=="function"&&d.length>0){let f=Ec(d,c,()=>{});f&&(r.lazy=Object.assign(r.lazy||{},{[s]:f}))}})}return["loader","action"].forEach(o=>{let s=t[o];if(typeof s=="function"&&n[o].length>0){let c=s[ls]??s,d=Ec(n[o],c,(...f)=>uR(f[0]));d&&(d[ls]=c,r[o]=d)}}),t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(o=>{let s=o[ls]??o,c=Ec(n.middleware,s,(...d)=>uR(d[0]));return c?(c[ls]=s,c):o})),r}function _J(e,t){let n={navigate:[],fetch:[]};if(t.forEach(r=>r({instrument(o){let s=Object.keys(o);for(let c of s)o[c]&&n[c].push(o[c])}})),n.navigate.length>0){let r=e.navigate[ls]??e.navigate,o=Ec(n.navigate,r,(...s)=>{let[c,d]=s;return{to:typeof c=="number"||typeof c=="string"?c:c?ko(c):".",...dR(e,d??{})}});o&&(o[ls]=r,e.navigate=o)}if(n.fetch.length>0){let r=e.fetch[ls]??e.fetch,o=Ec(n.fetch,r,(...s)=>{let[c,,d,f]=s;return{href:d??".",fetcherKey:c,...dR(e,f??{})}});o&&(o[ls]=r,e.fetch=o)}return e}function Ec(e,t,n){return e.length===0?null:async(...r)=>{let o=await hP(e,n(...r),()=>t(...r),e.length-1);if(o.type==="error")throw o.value;return o.value}}async function hP(e,t,n,r){let o=e[r],s;if(o){let c,d=async()=>(c?console.error("You cannot call instrumented handlers more than once"):c=hP(e,t,n,r-1),s=await c,bt(s,"Expected a result"),s.type==="error"&&s.value instanceof Error?{status:"error",error:s.value}:{status:"success",error:void 0});try{await o(d,t)}catch(f){console.error("An instrumentation function threw an error:",f)}c||await d(),await c}else try{s={type:"success",value:await n()}}catch(c){s={type:"error",value:c}}return s||{type:"error",value:new Error("No result assigned in instrumentation chain.")}}function uR(e){let{request:t,context:n,params:r,unstable_pattern:o}=e;return{request:DJ(t),params:{...r},unstable_pattern:o,context:AJ(n)}}function dR(e,t){return{currentUrl:ko(e.state.location),..."formMethod"in t?{formMethod:t.formMethod}:{},..."formEncType"in t?{formEncType:t.formEncType}:{},..."formData"in t?{formData:t.formData}:{},..."body"in t?{body:t.body}:{}}}function DJ(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function AJ(e){if(PJ(e)){let t={...e};return Object.freeze(t),t}else return{get:t=>e.get(t)}}var kJ=Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function PJ(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getOwnPropertyNames(t).sort().join("\0")===kJ}var pP=["POST","PUT","PATCH","DELETE"],NJ=new Set(pP),OJ=["GET",...pP],MJ=new Set(OJ),LJ=new Set([301,302,303,307,308]),IJ=new Set([307,308]),qy={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},zJ={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},td={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},$J=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),mP="remix-router-transitions",gP=Symbol("ResetLoaderData");function UJ(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u";bt(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let r=e.hydrationRouteProperties||[],o=e.mapRouteProperties||$J,s=o;if(e.unstable_instrumentations){let V=e.unstable_instrumentations;s=Y=>({...o(Y),...RJ(V.map(ie=>ie.route).filter(Boolean),Y)})}let c={},d=Td(e.routes,s,void 0,c),f,p=e.basename||"/";p.startsWith("/")||(p=`/${p}`);let m=e.dataStrategy||qJ,g={...e.future},y=null,b=new Set,w=null,j=null,C=null,R=e.hydrationData!=null,T=is(d,e.history.location,p),E=!1,_=null,k;if(T==null&&!e.patchRoutesOnNavigation){let V=_i(404,{pathname:e.history.location.pathname}),{matches:Y,route:ie}=Oh(d);k=!0,T=Y,_={[ie.id]:V}}else if(T&&!e.hydrationData&&Qn(T,d,e.history.location.pathname).active&&(T=null),T)if(T.some(V=>V.route.lazy))k=!1;else if(!T.some(V=>_S(V.route)))k=!0;else{let V=e.hydrationData?e.hydrationData.loaderData:null,Y=e.hydrationData?e.hydrationData.errors:null;if(Y){let ie=T.findIndex(je=>Y[je.route.id]!==void 0);k=T.slice(0,ie+1).every(je=>!zx(je.route,V,Y))}else k=T.every(ie=>!zx(ie.route,V,Y))}else{k=!1,T=[];let V=Qn(null,d,e.history.location.pathname);V.active&&V.matches&&(E=!0,T=V.matches)}let L,A={historyAction:e.history.action,location:e.history.location,matches:T,initialized:k,navigation:qy,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||_,fetchers:new Map,blockers:new Map},N="POP",U=!1,B,Q=!1,J=new Map,Z=null,$=!1,W=!1,M=new Set,I=new Map,z=0,F=-1,X=new Map,O=new Set,H=new Map,oe=new Map,ue=new Set,Se=new Map,ge,Pe=null;function rt(){if(y=e.history.listen(({action:V,location:Y,delta:ie})=>{if(ge){ge(),ge=void 0;return}In(Se.size===0||ie!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let je=Bo({currentLocation:A.location,nextLocation:Y,historyAction:V});if(je&&ie!=null){let De=new Promise(We=>{ge=We});e.history.go(ie*-1),Zr(je,{state:"blocked",location:Y,proceed(){Zr(je,{state:"proceeding",proceed:void 0,reset:void 0,location:Y}),De.then(()=>e.history.go(ie))},reset(){let We=new Map(A.blockers);We.set(je,td),lt({blockers:We})}});return}return pt(V,Y)}),n){aZ(t,J);let V=()=>sZ(t,J);t.addEventListener("pagehide",V),Z=()=>t.removeEventListener("pagehide",V)}return A.initialized||pt("POP",A.location,{initialHydration:!0}),L}function Ce(){y&&y(),Z&&Z(),b.clear(),B&&B.abort(),A.fetchers.forEach((V,Y)=>$n(Y)),A.blockers.forEach((V,Y)=>ao(Y))}function ht(V){return b.add(V),()=>b.delete(V)}function lt(V,Y={}){V.matches&&(V.matches=V.matches.map(De=>{let We=c[De.route.id],Ke=De.route;return Ke.element!==We.element||Ke.errorElement!==We.errorElement||Ke.hydrateFallbackElement!==We.hydrateFallbackElement?{...De,route:We}:De})),A={...A,...V};let ie=[],je=[];A.fetchers.forEach((De,We)=>{De.state==="idle"&&(ue.has(We)?ie.push(We):je.push(We))}),ue.forEach(De=>{!A.fetchers.has(De)&&!I.has(De)&&ie.push(De)}),[...b].forEach(De=>De(A,{deletedFetchers:ie,viewTransitionOpts:Y.viewTransitionOpts,flushSync:Y.flushSync===!0})),ie.forEach(De=>$n(De)),je.forEach(De=>A.fetchers.delete(De))}function vt(V,Y,{flushSync:ie}={}){let je=A.actionData!=null&&A.navigation.formMethod!=null&&Ar(A.navigation.formMethod)&&A.navigation.state==="loading"&&V.state?._isRedirect!==!0,De;Y.actionData?Object.keys(Y.actionData).length>0?De=Y.actionData:De=null:je?De=A.actionData:De=null;let We=Y.loaderData?SR(A.loaderData,Y.loaderData,Y.matches||[],Y.errors):A.loaderData,Ke=A.blockers;Ke.size>0&&(Ke=new Map(Ke),Ke.forEach((Qe,Ze)=>Ke.set(Ze,td)));let Be=$?!1:Ui(V,Y.matches||A.matches),Me=U===!0||A.navigation.formMethod!=null&&Ar(A.navigation.formMethod)&&V.state?._isRedirect!==!0;f&&(d=f,f=void 0),$||N==="POP"||(N==="PUSH"?e.history.push(V,V.state):N==="REPLACE"&&e.history.replace(V,V.state));let Ve;if(N==="POP"){let Qe=J.get(A.location.pathname);Qe&&Qe.has(V.pathname)?Ve={currentLocation:A.location,nextLocation:V}:J.has(V.pathname)&&(Ve={currentLocation:V,nextLocation:A.location})}else if(Q){let Qe=J.get(A.location.pathname);Qe?Qe.add(V.pathname):(Qe=new Set([V.pathname]),J.set(A.location.pathname,Qe)),Ve={currentLocation:A.location,nextLocation:V}}lt({...Y,actionData:De,loaderData:We,historyAction:N,location:V,initialized:!0,navigation:qy,revalidation:"idle",restoreScrollPosition:Be,preventScrollReset:Me,blockers:Ke},{viewTransitionOpts:Ve,flushSync:ie===!0}),N="POP",U=!1,Q=!1,$=!1,W=!1,Pe?.resolve(),Pe=null}async function it(V,Y){if(typeof V=="number"){e.history.go(V);return}let ie=Ix(A.location,A.matches,p,V,Y?.fromRouteId,Y?.relative),{path:je,submission:De,error:We}=fR(!1,ie,Y),Ke=A.location,Be=Ed(A.location,je,Y&&Y.state);Be={...Be,...e.history.encodeLocation(Be)};let Me=Y&&Y.replace!=null?Y.replace:void 0,Ve="PUSH";Me===!0?Ve="REPLACE":Me===!1||De!=null&&Ar(De.formMethod)&&De.formAction===A.location.pathname+A.location.search&&(Ve="REPLACE");let Qe=Y&&"preventScrollReset"in Y?Y.preventScrollReset===!0:void 0,Ze=(Y&&Y.flushSync)===!0,Et=Bo({currentLocation:Ke,nextLocation:Be,historyAction:Ve});if(Et){Zr(Et,{state:"blocked",location:Be,proceed(){Zr(Et,{state:"proceeding",proceed:void 0,reset:void 0,location:Be}),it(V,Y)},reset(){let nt=new Map(A.blockers);nt.set(Et,td),lt({blockers:nt})}});return}await pt(Ve,Be,{submission:De,pendingError:We,preventScrollReset:Qe,replace:Y&&Y.replace,enableViewTransition:Y&&Y.viewTransition,flushSync:Ze})}function wt(){Pe||(Pe=lZ()),Oe(),lt({revalidation:"loading"});let V=Pe.promise;return A.navigation.state==="submitting"?V:A.navigation.state==="idle"?(pt(A.historyAction,A.location,{startUninterruptedRevalidation:!0}),V):(pt(N||A.historyAction,A.navigation.location,{overrideNavigation:A.navigation,enableViewTransition:Q===!0}),V)}async function pt(V,Y,ie){B&&B.abort(),B=null,N=V,$=(ie&&ie.startUninterruptedRevalidation)===!0,mr(A.location,A.matches),U=(ie&&ie.preventScrollReset)===!0,Q=(ie&&ie.enableViewTransition)===!0;let je=f||d,De=ie&&ie.overrideNavigation,We=ie?.initialHydration&&A.matches&&A.matches.length>0&&!E?A.matches:is(je,Y,p),Ke=(ie&&ie.flushSync)===!0;if(We&&A.initialized&&!W&&ZJ(A.location,Y)&&!(ie&&ie.submission&&Ar(ie.submission.formMethod))){vt(Y,{matches:We},{flushSync:Ke});return}let Be=Qn(We,je,Y.pathname);if(Be.active&&Be.matches&&(We=Be.matches),!We){let{error:hn,notFoundMatches:qt,route:Ut}=$i(Y.pathname);vt(Y,{matches:qt,loaderData:{},errors:{[Ut.id]:hn}},{flushSync:Ke});return}B=new AbortController;let Me=Cc(e.history,Y,B.signal,ie&&ie.submission),Ve=e.getContext?await e.getContext():new aR,Qe;if(ie&&ie.pendingError)Qe=[os(We).route.id,{type:"error",error:ie.pendingError}];else if(ie&&ie.submission&&Ar(ie.submission.formMethod)){let hn=await It(Me,Y,ie.submission,We,Ve,Be.active,ie&&ie.initialHydration===!0,{replace:ie.replace,flushSync:Ke});if(hn.shortCircuited)return;if(hn.pendingActionResult){let[qt,Ut]=hn.pendingActionResult;if(li(Ut)&&Rd(Ut.error)&&Ut.error.status===404){B=null,vt(Y,{matches:hn.matches,loaderData:{},errors:{[qt]:Ut.error}});return}}We=hn.matches||We,Qe=hn.pendingActionResult,De=Gy(Y,ie.submission),Ke=!1,Be.active=!1,Me=Cc(e.history,Me.url,Me.signal)}let{shortCircuited:Ze,matches:Et,loaderData:nt,errors:fn}=await _e(Me,Y,We,Ve,Be.active,De,ie&&ie.submission,ie&&ie.fetcherSubmission,ie&&ie.replace,ie&&ie.initialHydration===!0,Ke,Qe);Ze||(B=null,vt(Y,{matches:Et||We,...wR(Qe),loaderData:nt,errors:fn}))}async function It(V,Y,ie,je,De,We,Ke,Be={}){Oe();let Me=iZ(Y,ie);if(lt({navigation:Me},{flushSync:Be.flushSync===!0}),We){let Ze=await Vo(je,Y.pathname,V.signal);if(Ze.type==="aborted")return{shortCircuited:!0};if(Ze.type==="error"){if(Ze.partialMatches.length===0){let{matches:nt,route:fn}=Oh(d);return{matches:nt,pendingActionResult:[fn.id,{type:"error",error:Ze.error}]}}let Et=os(Ze.partialMatches).route.id;return{matches:Ze.partialMatches,pendingActionResult:[Et,{type:"error",error:Ze.error}]}}else if(Ze.matches)je=Ze.matches;else{let{notFoundMatches:Et,error:nt,route:fn}=$i(Y.pathname);return{matches:Et,pendingActionResult:[fn.id,{type:"error",error:nt}]}}}let Ve,Qe=Jh(je,Y);if(!Qe.route.action&&!Qe.route.lazy)Ve={type:"error",error:_i(405,{method:V.method,pathname:Y.pathname,routeId:Qe.route.id})};else{let Ze=kc(s,c,V,je,Qe,Ke?[]:r,De),Et=await ve(V,Ze,De,null);if(Ve=Et[Qe.route.id],!Ve){for(let nt of je)if(Et[nt.route.id]){Ve=Et[nt.route.id];break}}if(V.signal.aborted)return{shortCircuited:!0}}if(el(Ve)){let Ze;return Be&&Be.replace!=null?Ze=Be.replace:Ze=yR(Ve.response.headers.get("Location"),new URL(V.url),p)===A.location.pathname+A.location.search,await at(V,Ve,!0,{submission:ie,replace:Ze}),{shortCircuited:!0}}if(li(Ve)){let Ze=os(je,Qe.route.id);return(Be&&Be.replace)!==!0&&(N="PUSH"),{matches:je,pendingActionResult:[Ze.route.id,Ve,Qe.route.id]}}return{matches:je,pendingActionResult:[Qe.route.id,Ve]}}async function _e(V,Y,ie,je,De,We,Ke,Be,Me,Ve,Qe,Ze){let Et=We||Gy(Y,Ke),nt=Ke||Be||CR(Et),fn=!$&&!Ve;if(De){if(fn){let er=Ee(Ze);lt({navigation:Et,...er!==void 0?{actionData:er}:{}},{flushSync:Qe})}let Dt=await Vo(ie,Y.pathname,V.signal);if(Dt.type==="aborted")return{shortCircuited:!0};if(Dt.type==="error"){if(Dt.partialMatches.length===0){let{matches:Da,route:mi}=Oh(d);return{matches:Da,loaderData:{},errors:{[mi.id]:Dt.error}}}let er=os(Dt.partialMatches).route.id;return{matches:Dt.partialMatches,loaderData:{},errors:{[er]:Dt.error}}}else if(Dt.matches)ie=Dt.matches;else{let{error:er,notFoundMatches:Da,route:mi}=$i(Y.pathname);return{matches:Da,loaderData:{},errors:{[mi.id]:er}}}}let hn=f||d,{dsMatches:qt,revalidatingFetchers:Ut}=hR(V,je,s,c,e.history,A,ie,nt,Y,Ve?[]:r,Ve===!0,W,M,ue,H,O,hn,p,e.patchRoutesOnNavigation!=null,Ze);if(F=++z,!e.dataStrategy&&!qt.some(Dt=>Dt.shouldLoad)&&!qt.some(Dt=>Dt.route.middleware&&Dt.route.middleware.length>0)&&Ut.length===0){let Dt=Zn();return vt(Y,{matches:ie,loaderData:{},errors:Ze&&li(Ze[1])?{[Ze[0]]:Ze[1].error}:null,...wR(Ze),...Dt?{fetchers:new Map(A.fetchers)}:{}},{flushSync:Qe}),{shortCircuited:!0}}if(fn){let Dt={};if(!De){Dt.navigation=Et;let er=Ee(Ze);er!==void 0&&(Dt.actionData=er)}Ut.length>0&&(Dt.fetchers=Le(Ut)),lt(Dt,{flushSync:Qe})}Ut.forEach(Dt=>{Un(Dt.key),Dt.controller&&I.set(Dt.key,Dt.controller)});let zr=()=>Ut.forEach(Dt=>Un(Dt.key));B&&B.signal.addEventListener("abort",zr);let{loaderResults:Bi,fetcherResults:Cr}=await pe(qt,Ut,V,je);if(V.signal.aborted)return{shortCircuited:!0};B&&B.signal.removeEventListener("abort",zr),Ut.forEach(Dt=>I.delete(Dt.key));let Xt=Mh(Bi);if(Xt)return await at(V,Xt.result,!0,{replace:Me}),{shortCircuited:!0};if(Xt=Mh(Cr),Xt)return O.add(Xt.key),await at(V,Xt.result,!0,{replace:Me}),{shortCircuited:!0};let{loaderData:Dl,errors:_a}=bR(A,ie,Bi,Ze,Ut,Cr);Ve&&A.errors&&(_a={...A.errors,..._a});let Er=Zn(),Vi=Nn(F),Al=Er||Vi||Ut.length>0;return{matches:ie,loaderData:Dl,errors:_a,...Al?{fetchers:new Map(A.fetchers)}:{}}}function Ee(V){if(V&&!li(V[1]))return{[V[0]]:V[1].data};if(A.actionData)return Object.keys(A.actionData).length===0?null:A.actionData}function Le(V){return V.forEach(Y=>{let ie=A.fetchers.get(Y.key),je=nd(void 0,ie?ie.data:void 0);A.fetchers.set(Y.key,je)}),new Map(A.fetchers)}async function Ne(V,Y,ie,je){Un(V);let De=(je&&je.flushSync)===!0,We=f||d,Ke=Ix(A.location,A.matches,p,ie,Y,je?.relative),Be=is(We,Ke,p),Me=Qn(Be,We,Ke);if(Me.active&&Me.matches&&(Be=Me.matches),!Be){Tt(V,Y,_i(404,{pathname:Ke}),{flushSync:De});return}let{path:Ve,submission:Qe,error:Ze}=fR(!0,Ke,je);if(Ze){Tt(V,Y,Ze,{flushSync:De});return}let Et=e.getContext?await e.getContext():new aR,nt=(je&&je.preventScrollReset)===!0;if(Qe&&Ar(Qe.formMethod)){await ct(V,Y,Ve,Be,Et,Me.active,De,nt,Qe);return}H.set(V,{routeId:Y,path:Ve}),await et(V,Y,Ve,Be,Et,Me.active,De,nt,Qe)}async function ct(V,Y,ie,je,De,We,Ke,Be,Me){Oe(),H.delete(V);let Ve=A.fetchers.get(V);tt(V,oZ(Me,Ve),{flushSync:Ke});let Qe=new AbortController,Ze=Cc(e.history,ie,Qe.signal,Me);if(We){let an=await Vo(je,new URL(Ze.url).pathname,Ze.signal,V);if(an.type==="aborted")return;if(an.type==="error"){Tt(V,Y,an.error,{flushSync:Ke});return}else if(an.matches)je=an.matches;else{Tt(V,Y,_i(404,{pathname:ie}),{flushSync:Ke});return}}let Et=Jh(je,ie);if(!Et.route.action&&!Et.route.lazy){let an=_i(405,{method:Me.formMethod,pathname:ie,routeId:Y});Tt(V,Y,an,{flushSync:Ke});return}I.set(V,Qe);let nt=z,fn=kc(s,c,Ze,je,Et,r,De),hn=await ve(Ze,fn,De,V),qt=hn[Et.route.id];if(!qt){for(let an of fn)if(hn[an.route.id]){qt=hn[an.route.id];break}}if(Ze.signal.aborted){I.get(V)===Qe&&I.delete(V);return}if(ue.has(V)){if(el(qt)||li(qt)){tt(V,ua(void 0));return}}else{if(el(qt))if(I.delete(V),F>nt){tt(V,ua(void 0));return}else return O.add(V),tt(V,nd(Me)),at(Ze,qt,!1,{fetcherSubmission:Me,preventScrollReset:Be});if(li(qt)){Tt(V,Y,qt.error);return}}let Ut=A.navigation.location||A.location,zr=Cc(e.history,Ut,Qe.signal),Bi=f||d,Cr=A.navigation.state!=="idle"?is(Bi,A.navigation.location,p):A.matches;bt(Cr,"Didn't find any matches after fetcher action");let Xt=++z;X.set(V,Xt);let Dl=nd(Me,qt.data);A.fetchers.set(V,Dl);let{dsMatches:_a,revalidatingFetchers:Er}=hR(zr,De,s,c,e.history,A,Cr,Me,Ut,r,!1,W,M,ue,H,O,Bi,p,e.patchRoutesOnNavigation!=null,[Et.route.id,qt]);Er.filter(an=>an.key!==V).forEach(an=>{let $r=an.key,Tr=A.fetchers.get($r),uf=nd(void 0,Tr?Tr.data:void 0);A.fetchers.set($r,uf),Un($r),an.controller&&I.set($r,an.controller)}),lt({fetchers:new Map(A.fetchers)});let Vi=()=>Er.forEach(an=>Un(an.key));Qe.signal.addEventListener("abort",Vi);let{loaderResults:Al,fetcherResults:Dt}=await pe(_a,Er,zr,De);if(Qe.signal.aborted)return;if(Qe.signal.removeEventListener("abort",Vi),X.delete(V),I.delete(V),Er.forEach(an=>I.delete(an.key)),A.fetchers.has(V)){let an=ua(qt.data);A.fetchers.set(V,an)}let er=Mh(Al);if(er)return at(zr,er.result,!1,{preventScrollReset:Be});if(er=Mh(Dt),er)return O.add(er.key),at(zr,er.result,!1,{preventScrollReset:Be});let{loaderData:Da,errors:mi}=bR(A,Cr,Al,void 0,Er,Dt);Nn(Xt),A.navigation.state==="loading"&&Xt>F?(bt(N,"Expected pending action"),B&&B.abort(),vt(A.navigation.location,{matches:Cr,loaderData:Da,errors:mi,fetchers:new Map(A.fetchers)})):(lt({errors:mi,loaderData:SR(A.loaderData,Da,Cr,mi),fetchers:new Map(A.fetchers)}),W=!1)}async function et(V,Y,ie,je,De,We,Ke,Be,Me){let Ve=A.fetchers.get(V);tt(V,nd(Me,Ve?Ve.data:void 0),{flushSync:Ke});let Qe=new AbortController,Ze=Cc(e.history,ie,Qe.signal);if(We){let Ut=await Vo(je,new URL(Ze.url).pathname,Ze.signal,V);if(Ut.type==="aborted")return;if(Ut.type==="error"){Tt(V,Y,Ut.error,{flushSync:Ke});return}else if(Ut.matches)je=Ut.matches;else{Tt(V,Y,_i(404,{pathname:ie}),{flushSync:Ke});return}}let Et=Jh(je,ie);I.set(V,Qe);let nt=z,fn=kc(s,c,Ze,je,Et,r,De),qt=(await ve(Ze,fn,De,V))[Et.route.id];if(I.get(V)===Qe&&I.delete(V),!Ze.signal.aborted){if(ue.has(V)){tt(V,ua(void 0));return}if(el(qt))if(F>nt){tt(V,ua(void 0));return}else{O.add(V),await at(Ze,qt,!1,{preventScrollReset:Be});return}if(li(qt)){Tt(V,Y,qt.error);return}tt(V,ua(qt.data))}}async function at(V,Y,ie,{submission:je,fetcherSubmission:De,preventScrollReset:We,replace:Ke}={}){Y.response.headers.has("X-Remix-Revalidate")&&(W=!0);let Be=Y.response.headers.get("Location");bt(Be,"Expected a Location header on the redirect Response"),Be=yR(Be,new URL(V.url),p);let Me=Ed(A.location,Be,{_isRedirect:!0});if(n){let fn=!1;if(Y.response.headers.has("X-Remix-Reload-Document"))fn=!0;else if(qm(Be)){const hn=cP(Be,!0);fn=hn.origin!==t.location.origin||Ni(hn.pathname,p)==null}if(fn){Ke?t.location.replace(Be):t.location.assign(Be);return}}B=null;let Ve=Ke===!0||Y.response.headers.has("X-Remix-Replace")?"REPLACE":"PUSH",{formMethod:Qe,formAction:Ze,formEncType:Et}=A.navigation;!je&&!De&&Qe&&Ze&&Et&&(je=CR(A.navigation));let nt=je||De;if(IJ.has(Y.response.status)&&nt&&Ar(nt.formMethod))await pt(Ve,Me,{submission:{...nt,formAction:Be},preventScrollReset:We||U,enableViewTransition:ie?Q:void 0});else{let fn=Gy(Me,je);await pt(Ve,Me,{overrideNavigation:fn,fetcherSubmission:De,preventScrollReset:We||U,enableViewTransition:ie?Q:void 0})}}async function ve(V,Y,ie,je){let De,We={};try{De=await WJ(m,V,Y,je,ie,!1)}catch(Ke){return Y.filter(Be=>Be.shouldLoad).forEach(Be=>{We[Be.route.id]={type:"error",error:Ke}}),We}if(V.signal.aborted)return We;for(let[Ke,Be]of Object.entries(De))if(nZ(Be)){let Me=Be.result;We[Ke]={type:"redirect",response:XJ(Me,V,Ke,Y,p)}}else We[Ke]=await KJ(Be);return We}async function pe(V,Y,ie,je){let De=ve(ie,V,je,null),We=Promise.all(Y.map(async Me=>{if(Me.matches&&Me.match&&Me.request&&Me.controller){let Qe=(await ve(Me.request,Me.matches,je,Me.key))[Me.match.route.id];return{[Me.key]:Qe}}else return Promise.resolve({[Me.key]:{type:"error",error:_i(404,{pathname:Me.path})}})})),Ke=await De,Be=(await We).reduce((Me,Ve)=>Object.assign(Me,Ve),{});return{loaderResults:Ke,fetcherResults:Be}}function Oe(){W=!0,H.forEach((V,Y)=>{I.has(Y)&&M.add(Y),Un(Y)})}function tt(V,Y,ie={}){A.fetchers.set(V,Y),lt({fetchers:new Map(A.fetchers)},{flushSync:(ie&&ie.flushSync)===!0})}function Tt(V,Y,ie,je={}){let De=os(A.matches,Y);$n(V),lt({errors:{[De.route.id]:ie},fetchers:new Map(A.fetchers)},{flushSync:(je&&je.flushSync)===!0})}function Cn(V){return oe.set(V,(oe.get(V)||0)+1),ue.has(V)&&ue.delete(V),A.fetchers.get(V)||zJ}function gn(V,Y){Un(V,Y?.reason),tt(V,ua(null))}function $n(V){let Y=A.fetchers.get(V);I.has(V)&&!(Y&&Y.state==="loading"&&X.has(V))&&Un(V),H.delete(V),X.delete(V),O.delete(V),ue.delete(V),M.delete(V),A.fetchers.delete(V)}function Wn(V){let Y=(oe.get(V)||0)-1;Y<=0?(oe.delete(V),ue.add(V)):oe.set(V,Y),lt({fetchers:new Map(A.fetchers)})}function Un(V,Y){let ie=I.get(V);ie&&(ie.abort(Y),I.delete(V))}function Dn(V){for(let Y of V){let ie=Cn(Y),je=ua(ie.data);A.fetchers.set(Y,je)}}function Zn(){let V=[],Y=!1;for(let ie of O){let je=A.fetchers.get(ie);bt(je,`Expected fetcher: ${ie}`),je.state==="loading"&&(O.delete(ie),V.push(ie),Y=!0)}return Dn(V),Y}function Nn(V){let Y=[];for(let[ie,je]of X)if(je<V){let De=A.fetchers.get(ie);bt(De,`Expected fetcher: ${ie}`),De.state==="loading"&&(Un(ie),X.delete(ie),Y.push(ie))}return Dn(Y),Y.length>0}function Uo(V,Y){let ie=A.blockers.get(V)||td;return Se.get(V)!==Y&&Se.set(V,Y),ie}function ao(V){A.blockers.delete(V),Se.delete(V)}function Zr(V,Y){let ie=A.blockers.get(V)||td;bt(ie.state==="unblocked"&&Y.state==="blocked"||ie.state==="blocked"&&Y.state==="blocked"||ie.state==="blocked"&&Y.state==="proceeding"||ie.state==="blocked"&&Y.state==="unblocked"||ie.state==="proceeding"&&Y.state==="unblocked",`Invalid blocker state transition: ${ie.state} -> ${Y.state}`);let je=new Map(A.blockers);je.set(V,Y),lt({blockers:je})}function Bo({currentLocation:V,nextLocation:Y,historyAction:ie}){if(Se.size===0)return;Se.size>1&&In(!1,"A router only supports one blocker at a time");let je=Array.from(Se.entries()),[De,We]=je[je.length-1],Ke=A.blockers.get(De);if(!(Ke&&Ke.state==="proceeding")&&We({currentLocation:V,nextLocation:Y,historyAction:ie}))return De}function $i(V){let Y=_i(404,{pathname:V}),ie=f||d,{matches:je,route:De}=Oh(ie);return{notFoundMatches:je,route:De,error:Y}}function so(V,Y,ie){if(w=V,C=Y,j=ie||null,!R&&A.navigation===qy){R=!0;let je=Ui(A.location,A.matches);je!=null&&lt({restoreScrollPosition:je})}return()=>{w=null,C=null,j=null}}function Ir(V,Y){return j&&j(V,Y.map(je=>lJ(je,A.loaderData)))||V.key}function mr(V,Y){if(w&&C){let ie=Ir(V,Y);w[ie]=C()}}function Ui(V,Y){if(w){let ie=Ir(V,Y),je=w[ie];if(typeof je=="number")return je}return null}function Qn(V,Y,ie){if(e.patchRoutesOnNavigation)if(V){if(Object.keys(V[0].params).length>0)return{active:!0,matches:sd(Y,ie,p,!0)}}else return{active:!0,matches:sd(Y,ie,p,!0)||[]};return{active:!1,matches:null}}async function Vo(V,Y,ie,je){if(!e.patchRoutesOnNavigation)return{type:"success",matches:V};let De=V;for(;;){let We=f==null,Ke=f||d,Be=c;try{await e.patchRoutesOnNavigation({signal:ie,path:Y,matches:De,fetcherKey:je,patch:(Qe,Ze)=>{ie.aborted||pR(Qe,Ze,Ke,Be,s,!1)}})}catch(Qe){return{type:"error",error:Qe,partialMatches:De}}finally{We&&!ie.aborted&&(d=[...d])}if(ie.aborted)return{type:"aborted"};let Me=is(Ke,Y,p),Ve=null;if(Me){if(Object.keys(Me[0].params).length===0)return{type:"success",matches:Me};if(Ve=sd(Ke,Y,p,!0),!(Ve&&De.length<Ve.length&&Cs(De,Ve.slice(0,De.length))))return{type:"success",matches:Me}}if(Ve||(Ve=sd(Ke,Y,p,!0)),!Ve||Cs(De,Ve))return{type:"success",matches:null};De=Ve}}function Cs(V,Y){return V.length===Y.length&&V.every((ie,je)=>ie.route.id===Y[je].route.id)}function Fo(V){c={},f=Td(V,s,void 0,c)}function au(V,Y,ie=!1){let je=f==null;pR(V,Y,f||d,c,s,ie),je&&(d=[...d],lt({}))}return L={get basename(){return p},get future(){return g},get state(){return A},get routes(){return d},get window(){return t},initialize:rt,subscribe:ht,enableScrollRestoration:so,navigate:it,fetch:Ne,revalidate:wt,createHref:V=>e.history.createHref(V),encodeLocation:V=>e.history.encodeLocation(V),getFetcher:Cn,resetFetcher:gn,deleteFetcher:Wn,dispose:Ce,getBlocker:Uo,deleteBlocker:ao,patchRoutes:au,_internalFetchControllers:I,_internalSetRoutes:Fo,_internalSetStateDoNotUseOrYouWillBreakYourApp(V){lt(V)}},e.unstable_instrumentations&&(L=_J(L,e.unstable_instrumentations.map(V=>V.router).filter(Boolean))),L}function BJ(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Ix(e,t,n,r,o,s){let c,d;if(o){c=[];for(let p of t)if(c.push(p),p.route.id===o){d=p;break}}else c=t,d=t[t.length-1];let f=TS(r||".",ES(c),Ni(e.pathname,n)||e.pathname,s==="path");if(r==null&&(f.search=e.search,f.hash=e.hash),(r==null||r===""||r===".")&&d){let p=DS(f.search);if(d.route.index&&!p)f.search=f.search?f.search.replace(/^\?/,"?index&"):"?index";else if(!d.route.index&&p){let m=new URLSearchParams(f.search),g=m.getAll("index");m.delete("index"),g.filter(b=>b).forEach(b=>m.append("index",b));let y=m.toString();f.search=y?`?${y}`:""}}return n!=="/"&&(f.pathname=SJ({basename:n,pathname:f.pathname})),ko(f)}function fR(e,t,n){if(!n||!BJ(n))return{path:t};if(n.formMethod&&!rZ(n.formMethod))return{path:t,error:_i(405,{method:n.formMethod})};let r=()=>({path:t,error:_i(400,{type:"invalid-body"})}),s=(n.formMethod||"get").toUpperCase(),c=wP(t);if(n.body!==void 0){if(n.formEncType==="text/plain"){if(!Ar(s))return r();let g=typeof n.body=="string"?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((y,[b,w])=>`${y}${b}=${w}
180
- `,""):String(n.body);return{path:t,submission:{formMethod:s,formAction:c,formEncType:n.formEncType,formData:void 0,json:void 0,text:g}}}else if(n.formEncType==="application/json"){if(!Ar(s))return r();try{let g=typeof n.body=="string"?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:s,formAction:c,formEncType:n.formEncType,formData:void 0,json:g,text:void 0}}}catch{return r()}}}bt(typeof FormData=="function","FormData is not available in this environment");let d,f;if(n.formData)d=Ux(n.formData),f=n.formData;else if(n.body instanceof FormData)d=Ux(n.body),f=n.body;else if(n.body instanceof URLSearchParams)d=n.body,f=xR(d);else if(n.body==null)d=new URLSearchParams,f=new FormData;else try{d=new URLSearchParams(n.body),f=xR(d)}catch{return r()}let p={formMethod:s,formAction:c,formEncType:n&&n.formEncType||"application/x-www-form-urlencoded",formData:f,json:void 0,text:void 0};if(Ar(p.formMethod))return{path:t,submission:p};let m=Ra(t);return e&&m.search&&DS(m.search)&&d.append("index",""),m.search=`?${d}`,{path:ko(m),submission:p}}function hR(e,t,n,r,o,s,c,d,f,p,m,g,y,b,w,j,C,R,T,E){let _=E?li(E[1])?E[1].error:E[1].data:void 0,k=o.createURL(s.location),L=o.createURL(f),A;if(m&&s.errors){let $=Object.keys(s.errors)[0];A=c.findIndex(W=>W.route.id===$)}else if(E&&li(E[1])){let $=E[0];A=c.findIndex(W=>W.route.id===$)-1}let N=E?E[1].statusCode:void 0,U=N&&N>=400,B={currentUrl:k,currentParams:s.matches[0]?.params||{},nextUrl:L,nextParams:c[0].params,...d,actionResult:_,actionStatus:N},Q=RS(c.map($=>$.route.path)),J=c.map(($,W)=>{let{route:M}=$,I=null;if(A!=null&&W>A?I=!1:M.lazy?I=!0:_S(M)?m?I=zx(M,s.loaderData,s.errors):VJ(s.loaderData,s.matches[W],$)&&(I=!0):I=!1,I!==null)return $x(n,r,e,Q,$,p,t,I);let z=U?!1:g||k.pathname+k.search===L.pathname+L.search||k.search!==L.search||FJ(s.matches[W],$),F={...B,defaultShouldRevalidate:z},X=Pp($,F);return $x(n,r,e,Q,$,p,t,X,F)}),Z=[];return w.forEach(($,W)=>{if(m||!c.some(oe=>oe.route.id===$.routeId)||b.has(W))return;let M=s.fetchers.get(W),I=M&&M.state!=="idle"&&M.data===void 0,z=is(C,$.path,R);if(!z){if(T&&I)return;Z.push({key:W,routeId:$.routeId,path:$.path,matches:null,match:null,request:null,controller:null});return}if(j.has(W))return;let F=Jh(z,$.path),X=new AbortController,O=Cc(o,$.path,X.signal),H=null;if(y.has(W))y.delete(W),H=kc(n,r,O,z,F,p,t);else if(I)g&&(H=kc(n,r,O,z,F,p,t));else{let oe={...B,defaultShouldRevalidate:U?!1:g};Pp(F,oe)&&(H=kc(n,r,O,z,F,p,t,oe))}H&&Z.push({key:W,routeId:$.routeId,path:$.path,matches:H,match:F,request:O,controller:X})}),{dsMatches:J,revalidatingFetchers:Z}}function _S(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function zx(e,t,n){if(e.lazy)return!0;if(!_S(e))return!1;let r=t!=null&&e.id in t,o=n!=null&&n[e.id]!==void 0;return!r&&o?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!r&&!o}function VJ(e,t,n){let r=!t||n.route.id!==t.route.id,o=!e.hasOwnProperty(n.route.id);return r||o}function FJ(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Pp(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function pR(e,t,n,r,o,s){let c;if(e){let p=r[e];bt(p,`No route found to patch children into: routeId = ${e}`),p.children||(p.children=[]),c=p.children}else c=n;let d=[],f=[];if(t.forEach(p=>{let m=c.find(g=>vP(p,g));m?f.push({existingRoute:m,newRoute:p}):d.push(p)}),d.length>0){let p=Td(d,o,[e||"_","patch",String(c?.length||"0")],r);c.push(...p)}if(s&&f.length>0)for(let p=0;p<f.length;p++){let{existingRoute:m,newRoute:g}=f[p],y=m,[b]=Td([g],o,[],{},!0);Object.assign(y,{element:b.element?b.element:y.element,errorElement:b.errorElement?b.errorElement:y.errorElement,hydrateFallbackElement:b.hydrateFallbackElement?b.hydrateFallbackElement:y.hydrateFallbackElement})}}function vP(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,r)=>t.children?.some(o=>vP(n,o))):!1}var mR=new WeakMap,yP=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let o=n[t.id];if(bt(o,"No route found in manifest"),!o.lazy||typeof o.lazy!="object")return;let s=o.lazy[e];if(!s)return;let c=mR.get(o);c||(c={},mR.set(o,c));let d=c[e];if(d)return d;let f=(async()=>{let p=iJ(e),g=o[e]!==void 0&&e!=="hasErrorBoundary";if(p)In(!p,"Route property "+e+" is not a supported lazy route property. This property will be ignored."),c[e]=Promise.resolve();else if(g)In(!1,`Route "${o.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let y=await s();y!=null&&(Object.assign(o,{[e]:y}),Object.assign(o,r(o)))}typeof o.lazy=="object"&&(o.lazy[e]=void 0,Object.values(o.lazy).every(y=>y===void 0)&&(o.lazy=void 0))})();return c[e]=f,f},gR=new WeakMap;function HJ(e,t,n,r,o){let s=n[e.id];if(bt(s,"No route found in manifest"),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy=="function"){let m=gR.get(s);if(m)return{lazyRoutePromise:m,lazyHandlerPromise:m};let g=(async()=>{bt(typeof e.lazy=="function","No lazy route function found");let y=await e.lazy(),b={};for(let w in y){let j=y[w];if(j===void 0)continue;let C=aJ(w),T=s[w]!==void 0&&w!=="hasErrorBoundary";C?In(!C,"Route property "+w+" is not a supported property to be returned from a lazy route function. This property will be ignored."):T?In(!T,`Route "${s.id}" has a static property "${w}" defined but its lazy function is also returning a value for this property. The lazy route property "${w}" will be ignored.`):b[w]=j}Object.assign(s,b),Object.assign(s,{...r(s),lazy:void 0})})();return gR.set(s,g),g.catch(()=>{}),{lazyRoutePromise:g,lazyHandlerPromise:g}}let c=Object.keys(e.lazy),d=[],f;for(let m of c){if(o&&o.includes(m))continue;let g=yP({key:m,route:e,manifest:n,mapRouteProperties:r});g&&(d.push(g),m===t&&(f=g))}let p=d.length>0?Promise.all(d).then(()=>{}):void 0;return p?.catch(()=>{}),f?.catch(()=>{}),{lazyRoutePromise:p,lazyHandlerPromise:f}}async function vR(e){let t=e.matches.filter(o=>o.shouldLoad),n={};return(await Promise.all(t.map(o=>o.resolve()))).forEach((o,s)=>{n[t[s].route.id]=o}),n}async function qJ(e){return e.matches.some(t=>t.route.middleware)?xP(e,()=>vR(e)):vR(e)}function xP(e,t){return GJ(e,t,r=>r,eZ,n);function n(r,o,s){if(s)return Promise.resolve(Object.assign(s.value,{[o]:{type:"error",result:r}}));{let{matches:c}=e,d=Math.min(Math.max(c.findIndex(p=>p.route.id===o),0),Math.max(c.findIndex(p=>p.unstable_shouldCallHandler()),0)),f=os(c,c[d].route.id).route.id;return Promise.resolve({[f]:{type:"error",result:r}})}}}async function GJ(e,t,n,r,o){let{matches:s,request:c,params:d,context:f,unstable_pattern:p}=e,m=s.flatMap(y=>y.route.middleware?y.route.middleware.map(b=>[y.route.id,b]):[]);return await bP({request:c,params:d,context:f,unstable_pattern:p},m,t,n,r,o)}async function bP(e,t,n,r,o,s,c=0){let{request:d}=e;if(d.signal.aborted)throw d.signal.reason??new Error(`Request aborted: ${d.method} ${d.url}`);let f=t[c];if(!f)return await n();let[p,m]=f,g,y=async()=>{if(g)throw new Error("You may only call `next()` once per middleware");try{return g={value:await bP(e,t,n,r,o,s,c+1)},g.value}catch(b){return g={value:await s(b,p,g)},g.value}};try{let b=await m(e,y),w=b!=null?r(b):void 0;return o(w)?w:g?w??g.value:(g={value:await y()},g.value)}catch(b){return await s(b,p,g)}}function SP(e,t,n,r,o){let s=yP({key:"middleware",route:r.route,manifest:t,mapRouteProperties:e}),c=HJ(r.route,Ar(n.method)?"action":"loader",t,e,o);return{middleware:s,route:c.lazyRoutePromise,handler:c.lazyHandlerPromise}}function $x(e,t,n,r,o,s,c,d,f=null){let p=!1,m=SP(e,t,n,o,s);return{...o,_lazyPromises:m,shouldLoad:d,unstable_shouldRevalidateArgs:f,unstable_shouldCallHandler(g){return p=!0,f?typeof g=="boolean"?Pp(o,{...f,defaultShouldRevalidate:g}):Pp(o,f):d},resolve(g){let{lazy:y,loader:b,middleware:w}=o.route,j=p||d||g&&!Ar(n.method)&&(y||b),C=w&&w.length>0&&!b&&!y;return j&&(Ar(n.method)||!C)?QJ({request:n,unstable_pattern:r,match:o,lazyHandlerPromise:m?.handler,lazyRoutePromise:m?.route,handlerOverride:g,scopedContext:c}):Promise.resolve({type:"data",result:void 0})}}}function kc(e,t,n,r,o,s,c,d=null){return r.map(f=>f.route.id!==o.route.id?{...f,shouldLoad:!1,unstable_shouldRevalidateArgs:d,unstable_shouldCallHandler:()=>!1,_lazyPromises:SP(e,t,n,f,s),resolve:()=>Promise.resolve({type:"data",result:void 0})}:$x(e,t,n,RS(r.map(p=>p.route.path)),f,s,c,!0,d))}async function WJ(e,t,n,r,o,s){n.some(p=>p._lazyPromises?.middleware)&&await Promise.all(n.map(p=>p._lazyPromises?.middleware));let c={request:t,unstable_pattern:RS(n.map(p=>p.route.path)),params:n[0].params,context:o,matches:n},f=await e({...c,fetcherKey:r,runClientMiddleware:p=>{let m=c;return xP(m,()=>p({...m,fetcherKey:r,runClientMiddleware:()=>{throw new Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))}});try{await Promise.all(n.flatMap(p=>[p._lazyPromises?.handler,p._lazyPromises?.route]))}catch{}return f}async function QJ({request:e,unstable_pattern:t,match:n,lazyHandlerPromise:r,lazyRoutePromise:o,handlerOverride:s,scopedContext:c}){let d,f,p=Ar(e.method),m=p?"action":"loader",g=y=>{let b,w=new Promise((R,T)=>b=T);f=()=>b(),e.signal.addEventListener("abort",f);let j=R=>typeof y!="function"?Promise.reject(new Error(`You cannot call the handler for a route which defines a boolean "${m}" [routeId: ${n.route.id}]`)):y({request:e,unstable_pattern:t,params:n.params,context:c},...R!==void 0?[R]:[]),C=(async()=>{try{return{type:"data",result:await(s?s(T=>j(T)):j())}}catch(R){return{type:"error",result:R}}})();return Promise.race([C,w])};try{let y=p?n.route.action:n.route.loader;if(r||o)if(y){let b,[w]=await Promise.all([g(y).catch(j=>{b=j}),r,o]);if(b!==void 0)throw b;d=w}else{await r;let b=p?n.route.action:n.route.loader;if(b)[d]=await Promise.all([g(b),o]);else if(m==="action"){let w=new URL(e.url),j=w.pathname+w.search;throw _i(405,{method:e.method,pathname:j,routeId:n.route.id})}else return{type:"data",result:void 0}}else if(y)d=await g(y);else{let b=new URL(e.url),w=b.pathname+b.search;throw _i(404,{pathname:w})}}catch(y){return{type:"error",result:y}}finally{f&&e.signal.removeEventListener("abort",f)}return d}async function YJ(e){let t=e.headers.get("Content-Type");return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function KJ(e){let{result:t,type:n}=e;if(jP(t)){let r;try{r=await YJ(t)}catch(o){return{type:"error",error:o}}return n==="error"?{type:"error",error:new kp(t.status,t.statusText,r),statusCode:t.status,headers:t.headers}:{type:"data",data:r,statusCode:t.status,headers:t.headers}}return n==="error"?jR(t)?t.data instanceof Error?{type:"error",error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:new kp(t.init?.status||500,void 0,t.data),statusCode:Rd(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"error",error:t,statusCode:Rd(t)?t.status:void 0}:jR(t)?{type:"data",data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:"data",data:t}}function XJ(e,t,n,r,o){let s=e.headers.get("Location");if(bt(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!qm(s)){let c=r.slice(0,r.findIndex(d=>d.route.id===n)+1);s=Ix(new URL(t.url),c,o,s),e.headers.set("Location",s)}return e}function yR(e,t,n){if(qm(e)){let r=e,o=r.startsWith("//")?new URL(t.protocol+r):new URL(r),s=Ni(o.pathname,n)!=null;if(o.origin===t.origin&&s)return o.pathname+o.search+o.hash}return e}function Cc(e,t,n,r){let o=e.createURL(wP(t)).toString(),s={signal:n};if(r&&Ar(r.formMethod)){let{formMethod:c,formEncType:d}=r;s.method=c.toUpperCase(),d==="application/json"?(s.headers=new Headers({"Content-Type":d}),s.body=JSON.stringify(r.json)):d==="text/plain"?s.body=r.text:d==="application/x-www-form-urlencoded"&&r.formData?s.body=Ux(r.formData):s.body=r.formData}return new Request(o,s)}function Ux(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function xR(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function JJ(e,t,n,r=!1,o=!1){let s={},c=null,d,f=!1,p={},m=n&&li(n[1])?n[1].error:void 0;return e.forEach(g=>{if(!(g.route.id in t))return;let y=g.route.id,b=t[y];if(bt(!el(b),"Cannot handle redirect results in processLoaderData"),li(b)){let w=b.error;if(m!==void 0&&(w=m,m=void 0),c=c||{},o)c[y]=w;else{let j=os(e,y);c[j.route.id]==null&&(c[j.route.id]=w)}r||(s[y]=gP),f||(f=!0,d=Rd(b.error)?b.error.status:500),b.headers&&(p[y]=b.headers)}else s[y]=b.data,b.statusCode&&b.statusCode!==200&&!f&&(d=b.statusCode),b.headers&&(p[y]=b.headers)}),m!==void 0&&n&&(c={[n[0]]:m},n[2]&&(s[n[2]]=void 0)),{loaderData:s,errors:c,statusCode:d||200,loaderHeaders:p}}function bR(e,t,n,r,o,s){let{loaderData:c,errors:d}=JJ(t,n,r);return o.filter(f=>!f.matches||f.matches.some(p=>p.shouldLoad)).forEach(f=>{let{key:p,match:m,controller:g}=f;if(g&&g.signal.aborted)return;let y=s[p];if(bt(y,"Did not find corresponding fetcher result"),li(y)){let b=os(e.matches,m?.route.id);d&&d[b.route.id]||(d={...d,[b.route.id]:y.error}),e.fetchers.delete(p)}else if(el(y))bt(!1,"Unhandled fetcher revalidation redirect");else{let b=ua(y.data);e.fetchers.set(p,b)}}),{loaderData:c,errors:d}}function SR(e,t,n,r){let o=Object.entries(t).filter(([,s])=>s!==gP).reduce((s,[c,d])=>(s[c]=d,s),{});for(let s of n){let c=s.route.id;if(!t.hasOwnProperty(c)&&e.hasOwnProperty(c)&&s.route.loader&&(o[c]=e[c]),r&&r.hasOwnProperty(c))break}return o}function wR(e){return e?li(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function os(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 Oh(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 _i(e,{pathname:t,routeId:n,method:r,type:o,message:s}={}){let c="Unknown Server Error",d="Unknown @remix-run/router error";return e===400?(c="Bad Request",r&&t&&n?d=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:o==="invalid-body"&&(d="Unable to encode submission body")):e===403?(c="Forbidden",d=`Route "${n}" does not match URL "${t}"`):e===404?(c="Not Found",d=`No route matches URL "${t}"`):e===405&&(c="Method Not Allowed",r&&t&&n?d=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(d=`Invalid request method "${r.toUpperCase()}"`)),new kp(e||500,c,new Error(d),!0)}function Mh(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,o]=t[n];if(el(o))return{key:r,result:o}}}function wP(e){let t=typeof e=="string"?Ra(e):e;return ko({...t,hash:""})}function ZJ(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function eZ(e){return e!=null&&typeof e=="object"&&Object.entries(e).every(([t,n])=>typeof t=="string"&&tZ(n))}function tZ(e){return e!=null&&typeof e=="object"&&"type"in e&&"result"in e&&(e.type==="data"||e.type==="error")}function nZ(e){return jP(e.result)&&LJ.has(e.result.status)}function li(e){return e.type==="error"}function el(e){return(e&&e.type)==="redirect"}function jR(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function jP(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function rZ(e){return MJ.has(e.toUpperCase())}function Ar(e){return NJ.has(e.toUpperCase())}function DS(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Jh(e,t){let n=typeof t=="string"?Ra(t).search:t.search;if(e[e.length-1].route.index&&DS(n||""))return e[e.length-1];let r=fP(e);return r[r.length-1]}function CR(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:s,json:c}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(s!=null)return{formMethod:t,formAction:n,formEncType:r,formData:s,json:void 0,text:void 0};if(c!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:c,text:void 0}}}function Gy(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 iZ(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 nd(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 oZ(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 ua(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 aZ(e,t){try{let n=e.sessionStorage.getItem(mP);if(n){let r=JSON.parse(n);for(let[o,s]of Object.entries(r||{}))s&&Array.isArray(s)&&t.set(o,new Set(s||[]))}}catch{}}function sZ(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(mP,JSON.stringify(n))}catch(r){In(!1,`Failed to save applied view transitions in sessionStorage (${r}).`)}}}function lZ(){let e,t,n=new Promise((r,o)=>{e=async s=>{r(s);try{await n}catch{}},t=async s=>{o(s);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var Rl=v.createContext(null);Rl.displayName="DataRouter";var of=v.createContext(null);of.displayName="DataRouterState";v.createContext(!1);var AS=v.createContext({isTransitioning:!1});AS.displayName="ViewTransition";var CP=v.createContext(new Map);CP.displayName="Fetchers";var cZ=v.createContext(null);cZ.displayName="Await";var $o=v.createContext(null);$o.displayName="Navigation";var af=v.createContext(null);af.displayName="Location";var oo=v.createContext({outlet:null,matches:[],isDataRoute:!1});oo.displayName="Route";var kS=v.createContext(null);kS.displayName="RouteError";function uZ(e,{relative:t}={}){bt(sf(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=v.useContext($o),{hash:o,pathname:s,search:c}=lf(e,{relative:t}),d=s;return n!=="/"&&(d=s==="/"?n:To([n,s])),r.createHref({pathname:d,search:c,hash:o})}function sf(){return v.useContext(af)!=null}function Jr(){return bt(sf(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(af).location}var EP="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function TP(e){v.useContext($o).static||v.useLayoutEffect(e)}function _n(){let{isDataRoute:e}=v.useContext(oo);return e?EZ():dZ()}function dZ(){bt(sf(),"useNavigate() may be used only in the context of a <Router> component.");let e=v.useContext(Rl),{basename:t,navigator:n}=v.useContext($o),{matches:r}=v.useContext(oo),{pathname:o}=Jr(),s=JSON.stringify(ES(r)),c=v.useRef(!1);return TP(()=>{c.current=!0}),v.useCallback((f,p={})=>{if(In(c.current,EP),!c.current)return;if(typeof f=="number"){n.go(f);return}let m=TS(f,JSON.parse(s),o,p.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:To([t,m.pathname])),(p.replace?n.replace:n.push)(m,p.state,p)},[t,n,s,o,e])}var fZ=v.createContext(null);function hZ(e){let t=v.useContext(oo).outlet;return v.useMemo(()=>t&&v.createElement(fZ.Provider,{value:e},t),[t,e])}function Ht(){let{matches:e}=v.useContext(oo),t=e[e.length-1];return t?t.params:{}}function lf(e,{relative:t}={}){let{matches:n}=v.useContext(oo),{pathname:r}=Jr(),o=JSON.stringify(ES(n));return v.useMemo(()=>TS(e,JSON.parse(o),r,t==="path"),[e,o,r,t])}function pZ(e,t){return RP(e,t)}function RP(e,t,n,r,o){bt(sf(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=v.useContext($o),{matches:c}=v.useContext(oo),d=c[c.length-1],f=d?d.params:{},p=d?d.pathname:"/",m=d?d.pathnameBase:"/",g=d&&d.route;{let T=g&&g.path||"";_P(p,!g||T.endsWith("*")||T.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${T}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
181
-
182
- Please change the parent <Route path="${T}"> to <Route path="${T==="/"?"*":`${T}/*`}">.`)}let y=Jr(),b;if(t){let T=typeof t=="string"?Ra(t):t;bt(m==="/"||T.pathname?.startsWith(m),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${m}" but pathname "${T.pathname}" was given in the \`location\` prop.`),b=T}else b=y;let w=b.pathname||"/",j=w;if(m!=="/"){let T=m.replace(/^\//,"").split("/");j="/"+w.replace(/^\//,"").split("/").slice(T.length).join("/")}let C=is(e,{pathname:j});In(g||C!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),In(C==null||C[C.length-1].route.element!==void 0||C[C.length-1].route.Component!==void 0||C[C.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let R=xZ(C&&C.map(T=>Object.assign({},T,{params:Object.assign({},f,T.params),pathname:To([m,s.encodeLocation?s.encodeLocation(T.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathname]),pathnameBase:T.pathnameBase==="/"?m:To([m,s.encodeLocation?s.encodeLocation(T.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:T.pathnameBase])})),c,n,r,o);return t&&R?v.createElement(af.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...b},navigationType:"POP"}},R):R}function mZ(){let e=CZ(),t=Rd(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},s={padding:"2px 4px",backgroundColor:r},c=null;return console.error("Error handled by React Router default ErrorBoundary:",e),c=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:s},"ErrorBoundary")," or"," ",v.createElement("code",{style:s},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},t),n?v.createElement("pre",{style:o},n):null,c)}var gZ=v.createElement(mZ,null),vZ=class extends v.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error("React Router caught the following error during render",e)}render(){return this.state.error!==void 0?v.createElement(oo.Provider,{value:this.props.routeContext},v.createElement(kS.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function yZ({routeContext:e,match:t,children:n}){let r=v.useContext(Rl);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),v.createElement(oo.Provider,{value:e},n)}function xZ(e,t=[],n=null,r=null,o=null){if(e==null){if(!n)return null;if(n.errors)e=n.matches;else if(t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let s=e,c=n?.errors;if(c!=null){let m=s.findIndex(g=>g.route.id&&c?.[g.route.id]!==void 0);bt(m>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(c).join(",")}`),s=s.slice(0,Math.min(s.length,m+1))}let d=!1,f=-1;if(n)for(let m=0;m<s.length;m++){let g=s[m];if((g.route.HydrateFallback||g.route.hydrateFallbackElement)&&(f=m),g.route.id){let{loaderData:y,errors:b}=n,w=g.route.loader&&!y.hasOwnProperty(g.route.id)&&(!b||b[g.route.id]===void 0);if(g.route.lazy||w){d=!0,f>=0?s=s.slice(0,f+1):s=[s[0]];break}}}let p=n&&r?(m,g)=>{r(m,{location:n.location,params:n.matches?.[0]?.params??{},errorInfo:g})}:void 0;return s.reduceRight((m,g,y)=>{let b,w=!1,j=null,C=null;n&&(b=c&&g.route.id?c[g.route.id]:void 0,j=g.route.errorElement||gZ,d&&(f<0&&y===0?(_P("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),w=!0,C=null):f===y&&(w=!0,C=g.route.hydrateFallbackElement||null)));let R=t.concat(s.slice(0,y+1)),T=()=>{let E;return b?E=j:w?E=C:g.route.Component?E=v.createElement(g.route.Component,null):g.route.element?E=g.route.element:E=m,v.createElement(yZ,{match:g,routeContext:{outlet:m,matches:R,isDataRoute:n!=null},children:E})};return n&&(g.route.ErrorBoundary||g.route.errorElement||y===0)?v.createElement(vZ,{location:n.location,revalidation:n.revalidation,component:j,error:b,children:T(),routeContext:{outlet:null,matches:R,isDataRoute:!0},onError:p}):T()},null)}function PS(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bZ(e){let t=v.useContext(Rl);return bt(t,PS(e)),t}function SZ(e){let t=v.useContext(of);return bt(t,PS(e)),t}function wZ(e){let t=v.useContext(oo);return bt(t,PS(e)),t}function NS(e){let t=wZ(e),n=t.matches[t.matches.length-1];return bt(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function jZ(){return NS("useRouteId")}function CZ(){let e=v.useContext(kS),t=SZ("useRouteError"),n=NS("useRouteError");return e!==void 0?e:t.errors?.[n]}function EZ(){let{router:e}=bZ("useNavigate"),t=NS("useNavigate"),n=v.useRef(!1);return TP(()=>{n.current=!0}),v.useCallback(async(o,s={})=>{In(n.current,EP),n.current&&(typeof o=="number"?e.navigate(o):await e.navigate(o,{fromRouteId:t,...s}))},[e,t])}var ER={};function _P(e,t,n){!t&&!ER[e]&&(ER[e]=!0,In(!1,n))}var TR={};function RR(e,t){!e&&!TR[t]&&(TR[t]=!0,console.warn(t))}function TZ(e){let t={hasErrorBoundary:e.hasErrorBoundary||e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&(e.element&&In(!1,"You should not include both `Component` and `element` on your route - `Component` will be used."),Object.assign(t,{element:v.createElement(e.Component),Component:void 0})),e.HydrateFallback&&(e.hydrateFallbackElement&&In(!1,"You should not include both `HydrateFallback` and `hydrateFallbackElement` on your route - `HydrateFallback` will be used."),Object.assign(t,{hydrateFallbackElement:v.createElement(e.HydrateFallback),HydrateFallback:void 0})),e.ErrorBoundary&&(e.errorElement&&In(!1,"You should not include both `ErrorBoundary` and `errorElement` on your route - `ErrorBoundary` will be used."),Object.assign(t,{errorElement:v.createElement(e.ErrorBoundary),ErrorBoundary:void 0})),t}var RZ=["HydrateFallback","hydrateFallbackElement"],_Z=class{constructor(){this.status="pending",this.promise=new Promise((e,t)=>{this.resolve=n=>{this.status==="pending"&&(this.status="resolved",e(n))},this.reject=n=>{this.status==="pending"&&(this.status="rejected",t(n))}})}};function DZ({router:e,flushSync:t,unstable_onError:n}){let[r,o]=v.useState(e.state),[s,c]=v.useState(),[d,f]=v.useState({isTransitioning:!1}),[p,m]=v.useState(),[g,y]=v.useState(),[b,w]=v.useState(),j=v.useRef(new Map),C=v.useCallback(k=>{o(L=>(k.errors&&n&&Object.entries(k.errors).forEach(([A,N])=>{L.errors?.[A]!==N&&n(N,{location:k.location,params:k.matches[0]?.params??{}})}),k))},[n]),R=v.useCallback((k,{deletedFetchers:L,flushSync:A,viewTransitionOpts:N})=>{k.fetchers.forEach((B,Q)=>{B.data!==void 0&&j.current.set(Q,B.data)}),L.forEach(B=>j.current.delete(B)),RR(A===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let U=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition=="function";if(RR(N==null||U,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!N||!U){t&&A?t(()=>C(k)):v.startTransition(()=>C(k));return}if(t&&A){t(()=>{g&&(p&&p.resolve(),g.skipTransition()),f({isTransitioning:!0,flushSync:!0,currentLocation:N.currentLocation,nextLocation:N.nextLocation})});let B=e.window.document.startViewTransition(()=>{t(()=>C(k))});B.finished.finally(()=>{t(()=>{m(void 0),y(void 0),c(void 0),f({isTransitioning:!1})})}),t(()=>y(B));return}g?(p&&p.resolve(),g.skipTransition(),w({state:k,currentLocation:N.currentLocation,nextLocation:N.nextLocation})):(c(k),f({isTransitioning:!0,flushSync:!1,currentLocation:N.currentLocation,nextLocation:N.nextLocation}))},[e.window,t,g,p,C]);v.useLayoutEffect(()=>e.subscribe(R),[e,R]),v.useEffect(()=>{d.isTransitioning&&!d.flushSync&&m(new _Z)},[d]),v.useEffect(()=>{if(p&&s&&e.window){let k=s,L=p.promise,A=e.window.document.startViewTransition(async()=>{v.startTransition(()=>C(k)),await L});A.finished.finally(()=>{m(void 0),y(void 0),c(void 0),f({isTransitioning:!1})}),y(A)}},[s,p,e.window,C]),v.useEffect(()=>{p&&s&&r.location.key===s.location.key&&p.resolve()},[p,g,r.location,s]),v.useEffect(()=>{!d.isTransitioning&&b&&(c(b.state),f({isTransitioning:!0,flushSync:!1,currentLocation:b.currentLocation,nextLocation:b.nextLocation}),w(void 0))},[d.isTransitioning,b]);let T=v.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:k=>e.navigate(k),push:(k,L,A)=>e.navigate(k,{state:L,preventScrollReset:A?.preventScrollReset}),replace:(k,L,A)=>e.navigate(k,{replace:!0,state:L,preventScrollReset:A?.preventScrollReset})}),[e]),E=e.basename||"/",_=v.useMemo(()=>({router:e,navigator:T,static:!1,basename:E,unstable_onError:n}),[e,T,E,n]);return v.createElement(v.Fragment,null,v.createElement(Rl.Provider,{value:_},v.createElement(of.Provider,{value:r},v.createElement(CP.Provider,{value:j.current},v.createElement(AS.Provider,{value:d},v.createElement(PZ,{basename:E,location:r.location,navigationType:r.historyAction,navigator:T},v.createElement(AZ,{routes:e.routes,future:e.future,state:r,unstable_onError:n})))))),null)}var AZ=v.memo(kZ);function kZ({routes:e,future:t,state:n,unstable_onError:r}){return RP(e,void 0,n,r,t)}function OS(e){return hZ(e.context)}function $e(e){bt(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function PZ({basename:e="/",children:t=null,location:n,navigationType:r="POP",navigator:o,static:s=!1}){bt(!sf(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let c=e.replace(/^\/*/,"/"),d=v.useMemo(()=>({basename:c,navigator:o,static:s,future:{}}),[c,o,s]);typeof n=="string"&&(n=Ra(n));let{pathname:f="/",search:p="",hash:m="",state:g=null,key:y="default"}=n,b=v.useMemo(()=>{let w=Ni(f,c);return w==null?null:{location:{pathname:w,search:p,hash:m,state:g,key:y},navigationType:r}},[c,f,p,m,g,y,r]);return In(b!=null,`<Router basename="${c}"> is not able to match the URL "${f}${p}${m}" because it does not start with the basename, so the <Router> won't render anything.`),b==null?null:v.createElement($o.Provider,{value:d},v.createElement(af.Provider,{children:t,value:b}))}function NZ({children:e,location:t}){return pZ(Bx(e),t)}function Bx(e,t=[]){let n=[];return v.Children.forEach(e,(r,o)=>{if(!v.isValidElement(r))return;let s=[...t,o];if(r.type===v.Fragment){n.push.apply(n,Bx(r.props.children,s));return}bt(r.type===$e,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),bt(!r.props.index||!r.props.children,"An index route cannot have child routes.");let c={id:r.props.id||s.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(c.children=Bx(r.props.children,s)),n.push(c)}),n}var Zh="get",ep="application/x-www-form-urlencoded";function Gm(e){return e!=null&&typeof e.tagName=="string"}function OZ(e){return Gm(e)&&e.tagName.toLowerCase()==="button"}function MZ(e){return Gm(e)&&e.tagName.toLowerCase()==="form"}function LZ(e){return Gm(e)&&e.tagName.toLowerCase()==="input"}function IZ(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function zZ(e,t){return e.button===0&&(!t||t==="_self")&&!IZ(e)}function Vx(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function $Z(e,t){let n=Vx(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(s=>{n.append(o,s)})}),n}var Lh=null;function UZ(){if(Lh===null)try{new FormData(document.createElement("form"),0),Lh=!1}catch{Lh=!0}return Lh}var BZ=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Wy(e){return e!=null&&!BZ.has(e)?(In(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${ep}"`),null):e}function VZ(e,t){let n,r,o,s,c;if(MZ(e)){let d=e.getAttribute("action");r=d?Ni(d,t):null,n=e.getAttribute("method")||Zh,o=Wy(e.getAttribute("enctype"))||ep,s=new FormData(e)}else if(OZ(e)||LZ(e)&&(e.type==="submit"||e.type==="image")){let d=e.form;if(d==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let f=e.getAttribute("formaction")||d.getAttribute("action");if(r=f?Ni(f,t):null,n=e.getAttribute("formmethod")||d.getAttribute("method")||Zh,o=Wy(e.getAttribute("formenctype"))||Wy(d.getAttribute("enctype"))||ep,s=new FormData(d,e),!UZ()){let{name:p,type:m,value:g}=e;if(m==="image"){let y=p?`${p}.`:"";s.append(`${y}x`,"0"),s.append(`${y}y`,"0")}else p&&s.append(p,g)}}else{if(Gm(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Zh,r=null,o=ep,c=e}return s&&o==="text/plain"&&(c=s,s=void 0),{action:r,method:n.toLowerCase(),encType:o,formData:s,body:c}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function MS(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function FZ(e,t,n){let r=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return r.pathname==="/"?r.pathname=`_root.${n}`:t&&Ni(r.pathname,t)==="/"?r.pathname=`${t.replace(/\/$/,"")}/_root.${n}`:r.pathname=`${r.pathname.replace(/\/$/,"")}.${n}`,r}async function HZ(e,t){if(e.id in t)return t[e.id];try{let n=await import(e.module);return t[e.id]=n,n}catch(n){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function qZ(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function GZ(e,t,n){let r=await Promise.all(e.map(async o=>{let s=t.routes[o.route.id];if(s){let c=await HZ(s,n);return c.links?c.links():[]}return[]}));return KZ(r.flat(1).filter(qZ).filter(o=>o.rel==="stylesheet"||o.rel==="preload").map(o=>o.rel==="stylesheet"?{...o,rel:"prefetch",as:"style"}:{...o,rel:"prefetch"}))}function _R(e,t,n,r,o,s){let c=(f,p)=>n[p]?f.route.id!==n[p].route.id:!0,d=(f,p)=>n[p].pathname!==f.pathname||n[p].route.path?.endsWith("*")&&n[p].params["*"]!==f.params["*"];return s==="assets"?t.filter((f,p)=>c(f,p)||d(f,p)):s==="data"?t.filter((f,p)=>{let m=r.routes[f.route.id];if(!m||!m.hasLoader)return!1;if(c(f,p)||d(f,p))return!0;if(f.route.shouldRevalidate){let g=f.route.shouldRevalidate({currentUrl:new URL(o.pathname+o.search+o.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:f.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function WZ(e,t,{includeHydrateFallback:n}={}){return QZ(e.map(r=>{let o=t.routes[r.route.id];if(!o)return[];let s=[o.module];return o.clientActionModule&&(s=s.concat(o.clientActionModule)),o.clientLoaderModule&&(s=s.concat(o.clientLoaderModule)),n&&o.hydrateFallbackModule&&(s=s.concat(o.hydrateFallbackModule)),o.imports&&(s=s.concat(o.imports)),s}).flat(1))}function QZ(e){return[...new Set(e)]}function YZ(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function KZ(e,t){let n=new Set;return new Set(t),e.reduce((r,o)=>{let s=JSON.stringify(YZ(o));return n.has(s)||(n.add(s),r.push({key:s,link:o})),r},[])}function DP(){let e=v.useContext(Rl);return MS(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function XZ(){let e=v.useContext(of);return MS(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var LS=v.createContext(void 0);LS.displayName="FrameworkContext";function AP(){let e=v.useContext(LS);return MS(e,"You must render this element inside a <HydratedRouter> element"),e}function JZ(e,t){let n=v.useContext(LS),[r,o]=v.useState(!1),[s,c]=v.useState(!1),{onFocus:d,onBlur:f,onMouseEnter:p,onMouseLeave:m,onTouchStart:g}=t,y=v.useRef(null);v.useEffect(()=>{if(e==="render"&&c(!0),e==="viewport"){let j=R=>{R.forEach(T=>{c(T.isIntersecting)})},C=new IntersectionObserver(j,{threshold:.5});return y.current&&C.observe(y.current),()=>{C.disconnect()}}},[e]),v.useEffect(()=>{if(r){let j=setTimeout(()=>{c(!0)},100);return()=>{clearTimeout(j)}}},[r]);let b=()=>{o(!0)},w=()=>{o(!1),c(!1)};return n?e!=="intent"?[s,y,{}]:[s,y,{onFocus:rd(d,b),onBlur:rd(f,w),onMouseEnter:rd(p,b),onMouseLeave:rd(m,w),onTouchStart:rd(g,b)}]:[!1,y,{}]}function rd(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function ZZ({page:e,...t}){let{router:n}=DP(),r=v.useMemo(()=>is(n.routes,e,n.basename),[n.routes,e,n.basename]);return r?v.createElement(tee,{page:e,matches:r,...t}):null}function eee(e){let{manifest:t,routeModules:n}=AP(),[r,o]=v.useState([]);return v.useEffect(()=>{let s=!1;return GZ(e,t,n).then(c=>{s||o(c)}),()=>{s=!0}},[e,t,n]),r}function tee({page:e,matches:t,...n}){let r=Jr(),{manifest:o,routeModules:s}=AP(),{basename:c}=DP(),{loaderData:d,matches:f}=XZ(),p=v.useMemo(()=>_R(e,t,f,o,r,"data"),[e,t,f,o,r]),m=v.useMemo(()=>_R(e,t,f,o,r,"assets"),[e,t,f,o,r]),g=v.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let w=new Set,j=!1;if(t.forEach(R=>{let T=o.routes[R.route.id];!T||!T.hasLoader||(!p.some(E=>E.route.id===R.route.id)&&R.route.id in d&&s[R.route.id]?.shouldRevalidate||T.hasClientLoader?j=!0:w.add(R.route.id))}),w.size===0)return[];let C=FZ(e,c,"data");return j&&w.size>0&&C.searchParams.set("_routes",t.filter(R=>w.has(R.route.id)).map(R=>R.route.id).join(",")),[C.pathname+C.search]},[c,d,r,o,p,t,e,s]),y=v.useMemo(()=>WZ(m,o),[m,o]),b=eee(m);return v.createElement(v.Fragment,null,g.map(w=>v.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...n})),y.map(w=>v.createElement("link",{key:w,rel:"modulepreload",href:w,...n})),b.map(({key:w,link:j})=>v.createElement("link",{key:w,nonce:n.nonce,...j})))}function nee(...e){return t=>{e.forEach(n=>{typeof n=="function"?n(t):n!=null&&(n.current=t)})}}var kP=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{kP&&(window.__reactRouterVersion="7.9.6")}catch{}function ree(e,t){return UJ({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:eJ({window:t?.window}),hydrationData:iee(),routes:e,mapRouteProperties:TZ,hydrationRouteProperties:RZ,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,unstable_instrumentations:t?.unstable_instrumentations}).initialize()}function iee(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:oee(e.errors)}),e}function oee(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 kp(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let s=window[o.__subType];if(typeof s=="function")try{let c=new s(o.message);c.stack="",n[r]=c}catch{}}if(n[r]==null){let s=new Error(o.message);s.stack="",n[r]=s}}else n[r]=o;return n}var PP=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,NP=v.forwardRef(function({onClick:t,discover:n="render",prefetch:r="none",relative:o,reloadDocument:s,replace:c,state:d,target:f,to:p,preventScrollReset:m,viewTransition:g,...y},b){let{basename:w}=v.useContext($o),j=typeof p=="string"&&PP.test(p),C,R=!1;if(typeof p=="string"&&j&&(C=p,kP))try{let U=new URL(window.location.href),B=p.startsWith("//")?new URL(U.protocol+p):new URL(p),Q=Ni(B.pathname,w);B.origin===U.origin&&Q!=null?p=Q+B.search+B.hash:R=!0}catch{In(!1,`<Link to="${p}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let T=uZ(p,{relative:o}),[E,_,k]=JZ(r,y),L=cee(p,{replace:c,state:d,target:f,preventScrollReset:m,relative:o,viewTransition:g});function A(U){t&&t(U),U.defaultPrevented||L(U)}let N=v.createElement("a",{...y,...k,href:C||T,onClick:R||s?t:A,ref:nee(b,_),target:f,"data-discover":!j&&n==="render"?"true":void 0});return E&&!j?v.createElement(v.Fragment,null,N,v.createElement(ZZ,{page:T})):N});NP.displayName="Link";var aee=v.forwardRef(function({"aria-current":t="page",caseSensitive:n=!1,className:r="",end:o=!1,style:s,to:c,viewTransition:d,children:f,...p},m){let g=lf(c,{relative:p.relative}),y=Jr(),b=v.useContext(of),{navigator:w,basename:j}=v.useContext($o),C=b!=null&&pee(g)&&d===!0,R=w.encodeLocation?w.encodeLocation(g).pathname:g.pathname,T=y.pathname,E=b&&b.navigation&&b.navigation.location?b.navigation.location.pathname:null;n||(T=T.toLowerCase(),E=E?E.toLowerCase():null,R=R.toLowerCase()),E&&j&&(E=Ni(E,j)||E);const _=R!=="/"&&R.endsWith("/")?R.length-1:R.length;let k=T===R||!o&&T.startsWith(R)&&T.charAt(_)==="/",L=E!=null&&(E===R||!o&&E.startsWith(R)&&E.charAt(R.length)==="/"),A={isActive:k,isPending:L,isTransitioning:C},N=k?t:void 0,U;typeof r=="function"?U=r(A):U=[r,k?"active":null,L?"pending":null,C?"transitioning":null].filter(Boolean).join(" ");let B=typeof s=="function"?s(A):s;return v.createElement(NP,{...p,"aria-current":N,className:U,ref:m,style:B,to:c,viewTransition:d},typeof f=="function"?f(A):f)});aee.displayName="NavLink";var see=v.forwardRef(({discover:e="render",fetcherKey:t,navigate:n,reloadDocument:r,replace:o,state:s,method:c=Zh,action:d,onSubmit:f,relative:p,preventScrollReset:m,viewTransition:g,...y},b)=>{let w=fee(),j=hee(d,{relative:p}),C=c.toLowerCase()==="get"?"get":"post",R=typeof d=="string"&&PP.test(d),T=E=>{if(f&&f(E),E.defaultPrevented)return;E.preventDefault();let _=E.nativeEvent.submitter,k=_?.getAttribute("formmethod")||c;w(_||E.currentTarget,{fetcherKey:t,method:k,navigate:n,replace:o,state:s,relative:p,preventScrollReset:m,viewTransition:g})};return v.createElement("form",{ref:b,method:C,action:j,onSubmit:r?f:T,...y,"data-discover":!R&&e==="render"?"true":void 0})});see.displayName="Form";function lee(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function OP(e){let t=v.useContext(Rl);return bt(t,lee(e)),t}function cee(e,{target:t,replace:n,state:r,preventScrollReset:o,relative:s,viewTransition:c}={}){let d=_n(),f=Jr(),p=lf(e,{relative:s});return v.useCallback(m=>{if(zZ(m,t)){m.preventDefault();let g=n!==void 0?n:ko(f)===ko(p);d(e,{replace:g,state:r,preventScrollReset:o,relative:s,viewTransition:c})}},[f,d,p,n,r,t,e,o,s,c])}function IS(e){In(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=v.useRef(Vx(e)),n=v.useRef(!1),r=Jr(),o=v.useMemo(()=>$Z(r.search,n.current?null:t.current),[r.search]),s=_n(),c=v.useCallback((d,f)=>{const p=Vx(typeof d=="function"?d(new URLSearchParams(o)):d);n.current=!0,s("?"+p,f)},[s,o]);return[o,c]}var uee=0,dee=()=>`__${String(++uee)}__`;function fee(){let{router:e}=OP("useSubmit"),{basename:t}=v.useContext($o),n=jZ();return v.useCallback(async(r,o={})=>{let{action:s,method:c,encType:d,formData:f,body:p}=VZ(r,t);if(o.navigate===!1){let m=o.fetcherKey||dee();await e.fetch(m,n,o.action||s,{preventScrollReset:o.preventScrollReset,formData:f,body:p,formMethod:o.method||c,formEncType:o.encType||d,flushSync:o.flushSync})}else await e.navigate(o.action||s,{preventScrollReset:o.preventScrollReset,formData:f,body:p,formMethod:o.method||c,formEncType:o.encType||d,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[e,t,n])}function hee(e,{relative:t}={}){let{basename:n}=v.useContext($o),r=v.useContext(oo);bt(r,"useFormAction must be used inside a RouteContext");let[o]=r.matches.slice(-1),s={...lf(e||".",{relative:t})},c=Jr();if(e==null){s.search=c.search;let d=new URLSearchParams(s.search),f=d.getAll("index");if(f.some(m=>m==="")){d.delete("index"),f.filter(g=>g).forEach(g=>d.append("index",g));let m=d.toString();s.search=m?`?${m}`:""}}return(!e||e===".")&&o.route.index&&(s.search=s.search?s.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(s.pathname=s.pathname==="/"?n:To([n,s.pathname])),ko(s)}function pee(e,{relative:t}={}){let n=v.useContext(AS);bt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=OP("useViewTransitionState"),o=lf(e,{relative:t});if(!n.isTransitioning)return!1;let s=Ni(n.currentLocation.pathname,r)||n.currentLocation.pathname,c=Ni(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Ap(o.pathname,c)!=null||Ap(o.pathname,s)!=null}function zS(e){if(e.resourceType==="Patient")return e;if(e.resourceType==="DiagnosticReport"||e.resourceType==="Encounter"||e.resourceType==="Observation"||e.resourceType==="ServiceRequest")return e.subject}function mee(e){if(e.resourceType==="Specimen")return e;if(e.resourceType==="Observation")return e.specimen;if(e.resourceType==="DiagnosticReport"||e.resourceType==="ServiceRequest")return e.specimen?.[0]}function ws(e){return sl(e.getActiveLogin()?.project)}function Wm(e){const t=Re(),n=ws(t),r=_n(),[o,s]=v.useState({resourceType:"ProjectMembership",filters:[{code:"project",operator:he.EQUALS,value:"Project/"+n},{code:"profile-type",operator:he.EQUALS,value:e.resourceType}],fields:e.fields,count:100});return a.jsx(ou,{search:o,onClick:c=>r(`/admin/members/${c.resource.id}`)?.catch(console.error),onChange:c=>s(c.definition),hideFilters:!0,hideToolbar:!0})}function gee(){return a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:"Bots"}),a.jsx(Wm,{resourceType:"Bot",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(xe,{justify:"flex-end",children:a.jsx(St,{to:"/admin/bots/new",children:"Create new bot"})})]})}function vee(){return a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:"Clients"}),a.jsx(Wm,{resourceType:"ClientApplication",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(xe,{justify:"flex-end",children:a.jsx(St,{to:"/admin/clients/new",children:"Create new client"})})]})}function Qm(e){return a.jsx(El,{resourceType:"AccessPolicy",name:e.name,defaultValue:e.defaultValue,placeholder:"Access Policy",onChange:t=>{Io(t)?e.onChange(Wt(t)):e.onChange(void 0)}})}function yee(){const e=Re(),t=ws(e),[n,r]=v.useState(""),[o,s]=v.useState(""),[c,d]=v.useState(),[f,p]=v.useState(),[m,g]=v.useState(void 0);return a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:"Create new Bot"}),a.jsxs(mt,{onSubmit:()=>{const y={name:n,description:o,accessPolicy:c};e.post("admin/projects/"+t+"/bot",y).then(b=>{e.invalidateSearches("Bot"),e.invalidateSearches("ProjectMembership"),g(b),ke({color:"green",message:"Bot created"})}).catch(b=>{ke({color:"red",message:Ge(b),autoClose:!1}),p(Yt(b))})},children:[!m&&a.jsxs(Ue,{children:[a.jsx(zt,{title:"Name",htmlFor:"name",outcome:f,children:a.jsx(Fe,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:y=>r(y.currentTarget.value),error:Lt(f,"name")})}),a.jsx(zt,{title:"Description",htmlFor:"description",outcome:f,children:a.jsx(Fe,{id:"description",name:"description",onChange:y=>s(y.currentTarget.value),error:Lt(f,"description")})}),a.jsx(zt,{title:"Access Policy",htmlFor:"accessPolicy",outcome:f,children:a.jsx(Qm,{name:"accessPolicy",onChange:d})}),a.jsx(xe,{justify:"flex-end",children:a.jsx(Ae,{type:"submit",children:"Create Bot"})})]}),m&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(Te,{children:"Bot created"}),a.jsxs(kr,{children:[a.jsx(kr.Item,{children:a.jsx(St,{to:m,children:"Go to new bot"})}),a.jsx(kr.Item,{children:a.jsx(St,{to:"/admin/bots",children:"Back to bots list"})})]})]})]})]})}function xee(){const e=Re(),t=ws(e),[n,r]=v.useState(""),[o,s]=v.useState(""),[c,d]=v.useState(""),[f,p]=v.useState(),[m,g]=v.useState(),[y,b]=v.useState(void 0);return a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:"Create new Client"}),a.jsxs(mt,{onSubmit:()=>{const w={name:n,description:o,redirectUri:c,accessPolicy:f};e.post("admin/projects/"+t+"/client",w).then(j=>{e.invalidateSearches("ClientApplication"),e.invalidateSearches("ProjectMembership"),b(j),ke({color:"green",message:"Client created"})}).catch(j=>{ke({color:"red",message:Ge(j),autoClose:!1}),g(Yt(j))})},children:[!y&&a.jsxs(Ue,{children:[a.jsx(zt,{title:"Name",htmlFor:"name",outcome:m,children:a.jsx(Fe,{id:"name",name:"name",required:!0,autoFocus:!0,onChange:w=>r(w.currentTarget.value),error:Lt(m,"name")})}),a.jsx(zt,{title:"Description",htmlFor:"description",outcome:m,children:a.jsx(Fe,{id:"description",name:"description",onChange:w=>s(w.currentTarget.value),error:Lt(m,"description")})}),a.jsx(zt,{title:"Redirect URI",htmlFor:"redirectUri",outcome:m,children:a.jsx(Fe,{id:"redirectUri",name:"redirectUri",onChange:w=>d(w.currentTarget.value),error:Lt(m,"redirectUri")})}),a.jsx(zt,{title:"Access Policy",htmlFor:"accessPolicy",outcome:m,children:a.jsx(Qm,{name:"accessPolicy",onChange:p})}),a.jsx(xe,{justify:"flex-end",children:a.jsx(Ae,{type:"submit",children:"Create Client"})})]}),y&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(Te,{children:"Client created"}),a.jsxs(kr,{children:[a.jsx(kr.Item,{children:a.jsx(St,{to:y,children:"Go to new client"})}),a.jsx(kr.Item,{children:a.jsx(St,{to:"/admin/clients",children:"Back to clients list"})})]})]})]})]})}function $S(e,t,n,r){const o=Date.now().toString();ke({id:o,loading:!0,title:t,message:"Running...",autoClose:!1,withCloseButton:!1});const s={method:"POST",pollStatusOnAccepted:!0};return r&&(s.body=JSON.stringify(r)),e.startAsyncRequest(n,s).then(c=>{let d="Done";return c.resourceType==="AsyncJob"?d=a.jsx(St,{to:c,children:"View AsyncJob"}):c.resourceType==="OperationOutcome"&&c.issue?.[0]?.details?.text&&(d=a.jsx(Te,{children:c.issue[0].details.text})),Di.update({id:o,color:"green",title:t,message:d,icon:a.jsx(zo,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0}),c}).catch(c=>{throw Di.update({id:o,color:"red",title:t,message:Ge(c),icon:a.jsx(dl,{size:"1rem"}),loading:!1,autoClose:!1,withCloseButton:!0}),c})}function Sc(e,t,n,r){$S(e,t,n,r).catch(()=>{})}const bee=8;function See({pillInputProps:e,inputProps:t,data:n,onChange:r}){const o=bl({onDropdownClose:()=>o.resetSelectedOption(),onDropdownOpen:()=>o.updateSelectedOptionIndex("active")}),[s,c]=v.useState(""),[d,f]=v.useState([]),p=w=>{const j=d.includes(w)?d.filter(C=>C!==w):[...d,w];f(j),r&&r(j)},m=w=>f(j=>j.filter(C=>C!==w)),g=v.useMemo(()=>d.map(w=>a.jsx(ma,{withRemoveButton:!0,onRemove:()=>m(w),children:w},w)),[d]),y=v.useMemo(()=>{const w=s.trim().toLowerCase();return n.filter(j=>j.toLowerCase().includes(w))},[n,s]),b=v.useMemo(()=>{const w=new Array(Math.min(y.length,bee));for(let j=0;j<w.length;j++){const C=y[j];w[j]=a.jsx(Ye.Option,{value:C,active:d.includes(C),children:a.jsxs(xe,{gap:"sm",children:[d.includes(C)?a.jsx(Id,{size:12}):null,a.jsx("span",{children:C})]})},C)}return w},[y,d]);return a.jsxs(Ye,{store:o,onOptionSubmit:p,withinPortal:!1,children:[a.jsx(Ye.DropdownTarget,{children:a.jsx(us,{onClick:()=>o.openDropdown(),...e,children:a.jsxs(ma.Group,{children:[g,a.jsx(Ye.EventsTarget,{children:a.jsx(us.Field,{onFocus:()=>o.openDropdown(),onBlur:()=>{o.closeDropdown(),c("")},value:s,onChange:w=>{o.updateSelectedOptionIndex(),c(w.currentTarget.value)},onKeyDown:w=>{w.key==="Backspace"&&s.length===0&&d.length>0&&(w.preventDefault(),m(d[d.length-1]))},...t})})]})})}),a.jsx(Ye.Dropdown,{children:a.jsx(Ye.Options,{children:b.length>0?b:a.jsx(Ye.Empty,{children:"Nothing found..."})})})]})}function wee({defaultGinPendingListLimit:e,availableTables:t,onResponse:n}){const r=Re(),[o,s]=v.useState(!1),[c,d]=v.useState([]),[f,p]=v.useState("unspecified"),[m,g]=v.useState("unspecified"),[y,b]=v.useState(void 0),w=()=>{const j={tableName:c};f==="reset"?j.fastUpdateAction="reset":f==="on"?(j.fastUpdateAction="set",j.fastUpdateValue=!0):f==="off"&&(j.fastUpdateAction="set",j.fastUpdateValue=!1),m==="reset"?j.ginPendingListLimitAction="reset":m==="set"&&(j.ginPendingListLimitAction="set",j.ginPendingListLimitValue=y),s(!0),$S(r,"Configure GIN Indexes","fhir/R4/$db-configure-indexes",j).then(C=>{n(C)}).catch(()=>{}).finally(()=>{s(!1)})};return a.jsx(mt,{onSubmit:w,children:a.jsxs(Ue,{gap:"sm",maw:"800",children:[a.jsx(Nd,{label:"Table(s)",children:a.jsx(See,{data:t,onChange:j=>d(j),inputProps:{name:"tables",placeholder:"e.g. Observation"}})}),a.jsx(vr.Group,{name:"fastUpdate",label:"fastupdate",value:f,onChange:j=>p(j),children:a.jsxs(xe,{h:"36",children:[a.jsx(vr,{size:"sm",value:"unspecified",label:"unspecified"}),a.jsx(vr,{size:"sm",value:"reset",label:"reset to default (on)"}),a.jsx(vr,{size:"sm",value:"off",label:"off"}),a.jsx(vr,{size:"sm",value:"on",label:"on"})]})}),a.jsx(vr.Group,{name:"ginPendingListLimit",label:"gin_pending_list_limit",value:m,onChange:j=>{g(j),j!=="set"&&b(void 0)},children:a.jsxs(xe,{h:"36",children:[a.jsx(vr,{size:"sm",value:"unspecified",label:"unspecified"}),a.jsx(vr,{size:"sm",value:"reset",label:`reset to default (${e}kB)`}),a.jsxs(xe,{children:[a.jsx(vr,{size:"sm",value:"set",label:"Set to (kB)"}),a.jsx(Ic,{title:"gin_pending_list_limit_value",name:"gin_pending_list_limit_value",value:(m==="set"?y:"")||"",disabled:m!=="set",required:m==="set",size:"sm",w:"100",min:64,max:2147483647,onChange:j=>{b(typeof j=="number"?j:void 0)}})]})]})}),a.jsx(xe,{justify:"center",children:a.jsx(wr,{size:"sm",loading:o,children:"Update"})})]})})}const jee=8;function Cee({inputProps:e,data:t,onChange:n}){const r=bl({onDropdownClose:()=>r.resetSelectedOption()}),[o,s]=v.useState(null),[c,d]=v.useState(""),f=v.useMemo(()=>t.filter(m=>m.toLowerCase().includes(c.toLowerCase().trim())),[t,c]),p=v.useMemo(()=>{const m=new Array(Math.min(f.length,jee));for(let g=0;g<m.length;g++){const y=f[g];m[g]=a.jsx(Ye.Option,{value:y,children:y},y)}return m},[f]);return a.jsxs(Ye,{store:r,withinPortal:!1,onOptionSubmit:m=>{n&&n(m),s(m),d(m),r.closeDropdown()},children:[a.jsx(Ye.Target,{children:a.jsx(Lr,{rightSection:a.jsx(Ye.Chevron,{}),value:c,onChange:m=>{r.openDropdown(),r.updateSelectedOptionIndex(),d(m.currentTarget.value)},onClick:()=>r.openDropdown(),onFocus:()=>r.openDropdown(),onBlur:()=>{r.closeDropdown(),d(o||"")},rightSectionPointerEvents:"none",...e})}),a.jsx(Ye.Dropdown,{children:a.jsx(Ye.Options,{children:p.length>0?p:a.jsx(Ye.Empty,{children:"Nothing found"})})})]})}function Eee(e){let t=[];for(const n of e)t.push(n),t.push(n+"_History"),t.push(n+"_References");return t.push("Address"),t.push("ContactPoint"),t.push("HumanName"),t.push("Coding"),t.push("Coding_Property"),t.push("DatabaseMigration"),t=$c(t),t}function MP(e){return typeof e=="string"?e.length>50?e.substring(0,50)+"...":e:typeof e=="boolean"?e.toString().toLocaleUpperCase():e}function Tee(){const e=Re(),[t,{open:n,close:r}]=Hc(!1),[o,s]=v.useState(""),[c,d]=v.useState(),[f,p]=v.useState(void 0),[m,g]=v.useState(0),[y,b]=v.useState(!1),[w,j]=v.useState(void 0),[C,R]=v.useState([]),[T,E]=v.useState(0);v.useEffect(()=>{async function A(){return(await e.valueSetExpand({url:"https://medplum.com/fhir/ValueSet/resource-types",count:200})).expansion?.contains?.map(U=>U.code).filter(U=>U!==void 0)??[]}A().then(N=>{R(Eee(N))}).catch(console.error)},[e]),v.useEffect(()=>{b(!0),e.get("fhir/R4/$db-indexes?tableName="+encodeURIComponent(f??""),{cache:"no-cache"}).then(A=>{const N=A.parameter?.find(B=>B.name==="defaultGinPendingListLimit")?.valueInteger??0;g(N);const U=A.parameter?.filter(B=>B.name==="index");j(U??[])}).finally(()=>{b(!1)}).catch(A=>{ke({color:"red",message:A.message})})},[e,f,T]);const _=A=>{s("Configure results"),d(a.jsx("pre",{children:JSON.stringify(A,null,2)})),n(),E(N=>(N+1)%100)},k={onClick:A=>{s("Details"),d(a.jsx("pre",{children:A})),n()}};let L;return y?L="Loading...":f?w?.length===0&&(L="No GIN indexes on this table"):L="Select a table",a.jsxs(a.Fragment,{children:[a.jsxs(Ue,{gap:"sm",children:[a.jsx("h2",{children:"Configure GIN indexes"}),a.jsx(xe,{children:a.jsx(wee,{defaultGinPendingListLimit:m,availableTables:C,onResponse:_})}),a.jsx("h2",{children:"GIN index stats"}),a.jsxs(xe,{children:[a.jsx(Cee,{data:C,inputProps:{placeholder:"Table name",inputSize:"50"},onChange:A=>{p(A)}}),a.jsx(Ae,{loading:y,onClick:()=>E(A=>(A+1)%100),disabled:!f,children:"Refresh"})]}),a.jsx(ce.ScrollContainer,{minWidth:500,children:a.jsxs(ce,{striped:!0,highlightOnHover:!0,children:[a.jsx(ce.Thead,{children:a.jsxs(ce.Tr,{children:[a.jsx(ce.Th,{children:"Schema"}),a.jsx(ce.Th,{children:"Table"}),a.jsx(ce.Th,{children:"Index"}),a.jsx(ce.Th,{children:"fastupdate"}),a.jsx(ce.Th,{children:"gin_pending_list_limit"}),a.jsx(ce.Th,{children:"options"})]})}),a.jsxs(ce.Tbody,{children:[L&&a.jsx(ce.Tr,{children:a.jsx(ce.Td,{colSpan:16,children:L})}),!L&&w?.map(A=>{const N=A.part??[],U=N.find(B=>B.name==="indexName")?.valueString;if(!U)throw new Error("Index missing name",{cause:A});return a.jsxs(ce.Tr,{children:[a.jsx(ce.Td,{children:N.find(B=>B.name==="schemaName")?.valueString}),a.jsx(ce.Td,{children:N.find(B=>B.name==="tableName")?.valueString}),a.jsx(ce.Td,{children:U}),a.jsx(Qy,{value:N.find(B=>B.name==="fastUpdate")?.valueBoolean,defaultValue:a.jsxs(Te,{span:!0,c:"dimmed",fs:"italic",children:["default (",MP(!0),")"]}),...k}),a.jsx(Qy,{value:N.find(B=>B.name==="ginPendingListLimit")?.valueInteger,defaultValue:a.jsxs(Te,{span:!0,c:"dimmed",fs:"italic",children:["default (",m,")"]}),...k}),a.jsx(Qy,{value:N.find(B=>B.name==="indexOptions")?.valueString,defaultValue:a.jsx(Te,{span:!0,c:"dimmed",fs:"italic",children:"NULL"}),...k})]},U)})]})]})})]}),a.jsx(Gn,{opened:t,onClose:r,title:o,centered:!0,size:"auto",children:c})]})}function Qy({value:e,onClick:t,defaultValue:n}){return a.jsx(ce.Td,{style:{cursor:"pointer"},onClick:()=>t?.(e),children:e===void 0?n:MP(e)})}function Ree(){const e=Re(),t=["GIN Indexes"],[n,r]=v.useState(t[0]);function o(s){s||(s=t[0]),r(s)}return!e.isLoading()&&!e.isSuperAdmin()?a.jsx(jr,{outcome:Qd}):a.jsx(ru,{maw:"100%",children:a.jsxs(Cl,{children:[a.jsx(Ie,{order:1,children:"Database Tools"}),a.jsxs(Pt,{value:n,onChange:o,children:[a.jsx(Pt.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:t.map(s=>a.jsx(Pt.Tab,{value:s,children:s},s))}),a.jsx(Pt.Panel,{value:"GIN Indexes",pt:"md",children:a.jsx(Tee,{})})]})]})})}function _ee(e){return a.jsx(El,{resourceType:"UserConfiguration",name:e.name,defaultValue:e.defaultValue,placeholder:"User Configuration",onChange:t=>{Io(t)?e.onChange(Wt(t)):e.onChange(void 0)}})}function Dee(){const{membershipId:e}=Ht(),t=Re(),n=ws(t),r=_n(),o=t.get(`admin/projects/${n}/members/${e}`).read(),[s,c]=v.useState(o.accessPolicy),[d,f]=v.useState(o.userConfiguration),[p,m]=v.useState(o.admin),[g,y]=v.useState(),[b,w]=v.useState(!1);function j(){window.confirm("Are you sure?")&&t.delete(`admin/projects/${n}/members/${e}`).then(()=>t.get(`admin/projects/${n}`,{cache:"no-cache"})).then(()=>r("/admin/project")).catch(C=>y(Yt(C)))}return a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:"Edit membership"}),a.jsx("h3",{children:a.jsx(Ac,{value:o.profile,link:!0})}),a.jsxs(mt,{onSubmit:()=>{const C={...o,accessPolicy:s,userConfiguration:d,admin:p};t.post(`admin/projects/${n}/members/${e}`,C).then(()=>w(!0)).catch(R=>y(Yt(R)))},children:[!b&&a.jsxs(Ue,{children:[a.jsx(zt,{title:"Access Policy",htmlFor:"accessPolicy",outcome:g,children:a.jsx(Qm,{name:"accessPolicy",defaultValue:s,onChange:c})}),a.jsx(zt,{title:"User Configuration",htmlFor:"userConfiguration",outcome:g,children:a.jsx(_ee,{name:"userConfiguration",defaultValue:d,onChange:f})}),a.jsx(zt,{title:"Admin",htmlFor:"admin",outcome:g,children:a.jsx(Ln,{id:"admin",name:"admin",defaultChecked:p,onChange:C=>m(C.currentTarget.checked)})}),a.jsxs(xe,{justify:"flex-end",mt:"xl",children:[a.jsx(Ae,{type:"submit",children:"Save"}),a.jsx(Ae,{type:"button",color:"red",variant:"outline",onClick:j,children:"Remove user"})]})]}),b&&a.jsxs("div",{"data-testid":"success",children:[a.jsx("p",{children:"User updated"}),a.jsx("pre",{children:JSON.stringify(g,void 0,2)}),a.jsxs("p",{children:["Click ",a.jsx(St,{to:"/admin/project",children:"here"})," to return to the project admin page."]})]})]})]})}function Aee(){const e=Re(),[t,n]=v.useState(e.getProject()),[r,o]=v.useState(),[s,c]=v.useState(),[d,f]=v.useState(!1),[p,m]=v.useState(void 0),g=v.useCallback(y=>{const b={resourceType:y.resourceType,firstName:y.firstName,lastName:y.lastName,email:y.email,sendEmail:y.sendEmail==="on",accessPolicy:r,admin:y.isAdmin==="on",scope:y.isProjectScoped==="on"?"project":"server",mfaRequired:y.mfaRequired==="on"};return e.invite(t?.id,b).then(w=>{e.invalidateSearches("Patient"),e.invalidateSearches("Practitioner"),e.invalidateSearches("ProjectMembership"),Cm(w)?c(w):m(w),f(b.sendEmail??!1),ke({color:"green",message:"Invite success"})}).catch(w=>{ke({color:"red",message:Ge(w),autoClose:!1}),c(Yt(w))})},[e,t,r]);return a.jsxs(mt,{onSubmit:g,children:[!p&&!s&&a.jsxs(Ue,{children:[a.jsx(Ie,{children:"Invite new member"}),e.isSuperAdmin()&&a.jsx(zt,{title:"Project",htmlFor:"project",outcome:s,children:a.jsx(El,{resourceType:"Project",name:"project",defaultValue:t,onChange:n})}),a.jsx(un,{name:"resourceType",label:"Role",defaultValue:"Practitioner",data:["Practitioner","Patient","RelatedPerson"],error:Lt(s,"resourceType")}),a.jsx(Fe,{name:"firstName",label:"First Name",required:!0,autoFocus:!0,error:Lt(s,"firstName")}),a.jsx(Fe,{name:"lastName",label:"Last Name",required:!0,error:Lt(s,"lastName")}),a.jsx(Fe,{name:"email",type:"email",label:"Email",required:!0,error:Lt(s,"email")}),a.jsx(zt,{title:"Access Policy",htmlFor:"accessPolicy",outcome:s,children:a.jsx(Qm,{name:"accessPolicy",onChange:o})}),a.jsx(Ln,{name:"sendEmail",label:"Send email",defaultChecked:!0}),a.jsx(Ln,{name:"isAdmin",label:"Admin"}),a.jsx(Ln,{name:"isProjectScoped",label:"Project scoped"}),a.jsx(Ln,{name:"mfaRequired",label:"MFA required"}),a.jsx(xe,{justify:"flex-end",children:a.jsx(wr,{children:"Invite"})})]}),s&&a.jsxs("div",{"data-testid":"success",children:[a.jsx("p",{children:"User created, email couldn't be sent"}),a.jsx("p",{children:"Could not send email. Make sure you have AWS SES set up."}),a.jsxs("p",{children:["Click ",a.jsx(St,{to:"/admin/project",children:"here"})," to return to the project admin page."]})]}),p&&a.jsxs("div",{"data-testid":"success",children:[a.jsx(Te,{children:"User created"}),d&&a.jsx(Te,{children:"Email sent"}),a.jsxs(kr,{children:[a.jsx(kr.Item,{children:a.jsx(St,{to:p,children:"Go to new membership"})}),a.jsx(kr.Item,{children:a.jsx(St,{to:p.profile,children:"Go to new profile"})}),a.jsx(kr.Item,{children:a.jsx(St,{to:"/admin/users",children:"Back to users list"})})]})]})]})}function kee(){return a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:"Patients"}),a.jsx(Wm,{resourceType:"Patient",fields:["user","profile","_lastUpdated"]}),a.jsx(xe,{justify:"flex-end",children:a.jsx(St,{to:"/admin/invite",children:"Invite new patient"})})]})}function Pee(){const e=Re();if(!e.isLoading()&&!e.isProjectAdmin())return a.jsx(jr,{outcome:Qd});function t(n){e.post("admin/projects/setpassword",n).then(()=>ke({color:"green",message:"Done"})).catch(r=>ke({color:"red",message:Ge(r),autoClose:!1}))}return a.jsxs(dt,{width:600,children:[a.jsx(Ie,{order:1,children:"Project Admin"}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{order:2,children:"Force Set Password"}),a.jsx(Te,{children:"Sets the password for the specified user in this project."}),a.jsx(Te,{children:"This action can only be performed by project administrators. Passwords can only be set for users scoped in this project."}),a.jsx(mt,{onSubmit:t,children:a.jsxs(Ue,{children:[a.jsx(Fe,{name:"email",label:"Email",required:!0}),a.jsx(Xi,{name:"password",label:"Password",required:!0}),a.jsx(Ae,{type:"submit",children:"Force Set Password"})]})})]})}function DR(){const e=Re(),t=ws(e),n=e.get(`admin/projects/${t}`).read();return a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:"Details"}),a.jsxs(tf,{children:[a.jsx(Nr,{term:"ID",children:n.project.id}),a.jsx(Nr,{term:"Name",children:n.project.name})]})]})}const AR=["Details","Users","Patients","Clients","Bots","Secrets","Sites"];function Nee(){const e=_n(),n=Jr().pathname.replace("/admin/","")||AR[0],r=Re(),o=ws(r),s=v.useMemo(()=>r.get("admin/projects/"+o).read(),[r,o]);function c(d){e(`/admin/${d}`)?.catch(console.error)}return a.jsxs(a.Fragment,{children:[a.jsxs(Pr,{children:[a.jsx(yt,{children:a.jsxs(yt.Entry,{children:[a.jsx(yt.Key,{children:"Project"}),a.jsx(yt.Value,{children:s.project.name})]})}),a.jsx(pi,{children:a.jsx(Pt,{value:n.toLowerCase(),onChange:c,children:a.jsx(Pt.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:AR.map(d=>a.jsx(Pt.Tab,{value:d.toLowerCase(),children:d},d))})})})]}),a.jsx(dt,{children:a.jsx(OS,{})})]})}function Oee(){const e=Re(),t=ws(e),n=e.get(`admin/projects/${t}`).read(),[r,o]=v.useState(!1),[s,c]=v.useState();return v.useEffect(()=>{e.requestSchema("Project").then(()=>o(!0)).catch(console.log)},[e]),v.useEffect(()=>{n&&c(fi(n.project.secret||[]))},[e,n]),!r||!s?a.jsx("div",{children:"Loading..."}):a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:d=>{d.preventDefault(),e.post(`admin/projects/${t}/secrets`,s).then(()=>e.get(`admin/projects/${t}`,{cache:"reload"})).then(()=>ke({color:"green",message:"Saved"})).catch(console.log)},children:[a.jsx(Ie,{children:"Project Secrets"}),a.jsx("p",{children:"Use project secrets to store sensitive information such as API keys or other access credentials."}),a.jsx(nf,{property:xs("Project","secret"),name:"secret",path:"Project.secret",defaultValue:s,onChange:c,outcome:void 0}),a.jsx(Ae,{type:"submit",children:"Save"})]})}function Mee(){const e=Re(),t=ws(e),n=e.get(`admin/projects/${t}`).read(),[r,o]=v.useState(!1),[s,c]=v.useState();return v.useEffect(()=>{e.requestSchema("Project").then(()=>o(!0)).catch(console.log)},[e]),v.useEffect(()=>{n&&c(fi(n.project.site||[]))},[e,n]),!r||!s?a.jsx("div",{children:"Loading..."}):a.jsxs("form",{noValidate:!0,autoComplete:"off",onSubmit:d=>{d.preventDefault(),e.post(`admin/projects/${t}/sites`,s).then(()=>e.get(`admin/projects/${t}`,{cache:"reload"})).then(()=>ke({color:"green",message:"Saved"})).catch(f=>{const p=Yt(f);ke({color:"red",message:`Error ${p.issue?.[0].details?.text} ${p.issue?.[0].expression?.[0]}`,autoClose:!1})})},children:[a.jsx(Ie,{children:"Project Sites"}),a.jsx("p",{children:"Use project sites configure your project on a separate domain."}),a.jsx(nf,{property:xs("Project","site"),name:"site",path:"Project.site",defaultValue:s,onChange:c,outcome:void 0}),a.jsx(Ae,{type:"submit",children:"Save"})]})}const LP="System AsyncJob",IP="Post-deploy Migrations",Ih=[IP,LP];function Lee(){const e=Re(),[t,n]=v.useState(Ih[0]);function r(o){o||=Ih[0],Ih.includes(o)&&n(o)}return!e.isLoading()&&!e.isSuperAdmin()?a.jsx(jr,{outcome:Qd}):a.jsx(ru,{miw:"1600",maw:"2000",children:a.jsxs(Cl,{children:[a.jsx(Ie,{order:1,children:"AsyncJob Dashboard"}),a.jsxs(Pt,{keepMounted:!1,value:t,onChange:r,children:[a.jsx(Pt.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:Ih.map(o=>a.jsx(Pt.Tab,{value:o,children:o},o))}),a.jsx(Pt.Panel,{value:LP,pt:"md",children:a.jsx(zee,{})}),a.jsx(Pt.Panel,{value:IP,pt:"md",children:a.jsx(Uee,{})})]})]})})}const Iee={resourceType:"AsyncJob",fields:["id","_lastUpdated","request","status","type"],filters:[{code:"_project",operator:he.MISSING,value:"true"}],sortRules:[{code:"_lastUpdated",descending:!0}]};function zee(){const e=_n(),[t]=v.useState(Iee);return a.jsxs(Ue,{children:[a.jsx(St,{to:`/${t.resourceType}/${ss(t)}`,children:"Show in search page"}),a.jsx(ou,{checkboxesEnabled:!1,search:t,onClick:n=>e(kR(n.resource))?.catch(console.error),onAuxClick:n=>window.open(kR(n.resource),"_blank")})]})}const $ee={resourceType:"AsyncJob",fields:["id","_lastUpdated","request","status","type"],filters:[{code:"_project",operator:he.MISSING,value:"true"},{code:"type",operator:he.EQUALS,value:"data-migration"}],count:1e3,sortRules:[{code:"_lastUpdated",descending:!0}]};function Uee(){const e=Re(),[t,n]=v.useState(),[r,o]=v.useState(),[s,c]=v.useState([]),[d,f]=v.useState(0),[p,m]=v.useState([]);v.useEffect(()=>{const j="info";m(C=>C.includes(j)?C:[...C,j]),e.get("admin/super/migrations",{cache:"no-cache"}).then(C=>{C.postDeployMigrations.sort((R,T)=>T-R),n(C)}).catch(C=>{ke({color:"red",message:Ge(C),autoClose:!1})}).finally(()=>m(C=>C.filter(R=>R!==j)))},[e,d]),v.useEffect(()=>{const j="jobs";m(C=>C.includes(j)?C:[...C,j]),e.requestSchema("AsyncJob").then(()=>e.search("AsyncJob",ss({...$ee,total:"accurate",fields:void 0}),{cache:"no-cache"}).then(C=>{o(C.entry?.map(R=>R.resource))})).catch(C=>{o(void 0),ke({color:"red",message:Ge(C),autoClose:!1})}).finally(()=>m(C=>C.filter(R=>R!==j)))},[e,d]);function g(){f(j=>j+1)}function y(j){$S(e,"Run pending post-deploy migration","admin/super/migrate",{dataVersion:j}).finally(()=>{g()}).catch(()=>{}),g()}const b=p.length>0;function w(j,{isLoading:C}){return a.jsxs("div",{style:{position:"relative"},children:[a.jsx(im,{visible:C}),a.jsxs(ce,{children:[a.jsx(ce.Thead,{children:a.jsxs(ce.Tr,{children:[a.jsx(ce.Th,{children:"Version"}),a.jsx(ce.Th,{children:"Action"}),a.jsx(ce.Th,{children:"Status"}),a.jsx(ce.Th,{children:"AsyncJob"}),a.jsx(ce.Th,{children:"Last Updated"}),a.jsx(ce.Th,{children:"Request Time"}),a.jsx(ce.Th,{children:"Duration"}),a.jsx(ce.Th,{children:"Attempts"})]})}),a.jsx(ce.Tbody,{children:j()})]})]})}return a.jsxs(a.Fragment,{children:[a.jsx(Ae,{size:"xs",mb:"xs",variant:"subtle",leftSection:a.jsx(lk,{size:14}),onClick:g,loading:b,children:"Refresh"}),w(()=>{if(!b){if(!t)return a.jsx(ce.Tr,{children:a.jsx(ce.Td,{colSpan:6,children:"Failed to load migration info"})});if(!r)return a.jsx(ce.Tr,{children:a.jsx(ce.Td,{colSpan:6,children:"Failed to load async jobs"})})}return!t||!r?null:t.postDeployMigrations?.map(j=>{const{status:C,asyncJob:R,asyncJobs:T}=Bee(j,r??[],t?.pendingPostDeployMigration),E=s.includes(j),_=j===t?.pendingPostDeployMigration&&(!R||R?.status==="error"),k=[a.jsxs(ce.Tr,{children:[a.jsx(ce.Td,{children:j}),a.jsx(ce.Td,{children:_&&a.jsx(Ae,{color:"green",size:"xs",onClick:()=>y(j),children:"Start"})}),a.jsx(ce.Td,{children:C}),a.jsx(ce.Td,{children:R&&a.jsx(St,{to:`/AsyncJob/${R?.id}`,children:R?.id})}),a.jsx(ce.Td,{children:R?.meta?.lastUpdated}),a.jsx(ce.Td,{children:R?.requestTime}),a.jsx(ce.Td,{children:PR(R)}),a.jsx(ce.Td,{display:"flex",children:a.jsxs(xe,{gap:"xs",children:[T.length?T.length:"",E&&T.length>1&&a.jsx(Ae,{leftSection:a.jsx(iq,{size:14}),variant:"subtle",color:"blue",size:"xs",radius:"xs",onClick:()=>c(L=>L.includes(j)?L.filter(A=>A!==j):L),children:"Hide all"}),!E&&T.length>1&&a.jsx(Ae,{leftSection:a.jsx(sk,{size:14}),variant:"subtle",color:"blue",size:"xs",radius:"xs",onClick:()=>c(L=>L.includes(j)?L:[...L,j]),children:"Show all"})]})})]},j)];return E&&k.push(...T.filter(L=>L.id!==R?.id).map(L=>a.jsxs(ce.Tr,{bg:"gray.1",children:[a.jsx(ce.Td,{children:j}),a.jsx(ce.Td,{}),a.jsx(ce.Td,{children:L.status}),a.jsx(ce.Td,{children:a.jsx(St,{to:`/AsyncJob/${L.id}`,children:L.id})}),a.jsx(ce.Td,{children:L.meta?.lastUpdated}),a.jsx(ce.Td,{children:L.requestTime}),a.jsx(ce.Td,{children:PR(L)}),a.jsx(ce.Td,{})]},L.id))),k})},{isLoading:b})]})}function Bee(e,t,n){const r=t.filter(c=>c.dataVersion===e),o=r.find(c=>c.status==="completed")??r[0];let s;return n===0?s=o?.status??"completed":e>n?s=o?.status??"pending":e===n?s=o?.status??"next":s=o?.status??"completed",{status:s,asyncJob:o,asyncJobs:r}}function kR(e){return`/${e.resourceType}/${e.id}`}function PR(e){const t=e?.requestTime,n=e?.transactionTime??e?.meta?.lastUpdated;if(!t||!n)return"";const r=new Date(t),s=new Date(n).getTime()-r.getTime();if(s<1e3)return`${s.toFixed(0)}ms`;const c=s/1e3;return c<60?`${c.toFixed(2)}s`:c<3600?`${(c/60).toFixed(2)}m`:`${(c/3600).toFixed(2)}h`}function Vee(){const e=Re(),[t,{open:n,close:r}]=Hc(!1),[o,s]=v.useState(""),[c,d]=v.useState();if(!e.isLoading()&&!e.isSuperAdmin())return a.jsx(jr,{outcome:Qd});function f(){Sc(e,"Rebuilding Structure Definitions","admin/super/structuredefinitions")}function p(){Sc(e,"Rebuilding Search Parameters","admin/super/searchparameters")}function m(){Sc(e,"Rebuilding Value Sets","admin/super/valuesets")}function g(_){Sc(e,"Reindexing Resources","admin/super/reindex",_)}function y(){Sc(e,"Reload Cron Resources","admin/super/reloadcron")}function b(_){e.post("admin/super/removebotidjobsfromqueue",_).then(()=>ke({color:"green",message:"Done"})).catch(k=>ke({color:"red",message:Ge(k),autoClose:!1}))}function w(_){e.post("admin/super/purge",{..._,before:hS(_.before)}).then(()=>ke({color:"green",message:"Done"})).catch(k=>ke({color:"red",message:Ge(k),autoClose:!1}))}function j(_){e.post("admin/super/setpassword",_).then(()=>ke({color:"green",message:"Done"})).catch(k=>ke({color:"red",message:Ge(k),autoClose:!1}))}function C(_){e.post("fhir/R4/$db-stats",_.tableNames?{resourceType:"Parameters",parameter:[{name:"tableNames",valueString:_.tableNames}]}:void 0).then(k=>{s("Database Stats"),d(a.jsx("pre",{children:k.parameter?.find(L=>L.name==="tableString")?.valueString})),n()}).catch(k=>ke({color:"red",message:Ge(k),autoClose:!1}))}function R(){e.post("fhir/R4/$db-invalid-indexes").then(_=>{s("Database Invalid Indexes"),d(a.jsx("pre",{children:_.parameter?.filter(k=>k.name==="invalidIndex").map(k=>k.valueString).join(`
183
- `)})),n()}).catch(_=>ke({color:"red",message:Ge(_),autoClose:!1}))}function T(){e.post("fhir/R4/$db-schema-diff").then(_=>{s("Schema Diff"),d(a.jsx("pre",{children:_.parameter?.find(k=>k.name==="migrationString")?.valueString})),n()}).catch(_=>ke({color:"red",message:Ge(_),autoClose:!1}))}function E(){Sc(e,"Reconcile Schema Diff","admin/super/reconcile-db-schema-drift")}return a.jsxs(dt,{width:600,children:[a.jsx(Ie,{order:1,children:"Super Admin"}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{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(mt,{children:a.jsx(Ae,{onClick:f,children:"Rebuild StructureDefinitions"})}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{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(mt,{children:a.jsx(Ae,{onClick:p,children:"Rebuild SearchParameters"})}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{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(mt,{children:a.jsx(Ae,{onClick:m,children:"Rebuild ValueSets"})}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{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(mt,{onSubmit:g,children:a.jsxs(Ue,{children:[a.jsx(zt,{title:"Resource Type",htmlFor:"resourceType",children:a.jsx(Fe,{id:"resourceType",name:"resourceType",placeholder:"Reindex Resource Type"})}),a.jsx(zt,{title:"Search Filter",htmlFor:"filter",children:a.jsx(Fe,{id:"filter",name:"filter",placeholder:"e.g. name=Sam&birthdate=lt2000-01-01"})}),a.jsx(zt,{title:"Max Resource Version",htmlFor:"maxResourceVersion",children:a.jsx(Fee,{})}),a.jsx(Ae,{type:"submit",children:"Reindex"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{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(mt,{onSubmit:w,children:a.jsxs(Ue,{children:[a.jsx(zt,{title:"Purge Resource Type",htmlFor:"purgeResourceType",children:a.jsx(un,{id:"purgeResourceType",name:"resourceType",data:["","AuditEvent","Login"]})}),a.jsx(zt,{title:"Purge Before",htmlFor:"before",children:a.jsx(Eo,{name:"before",placeholder:"Before Date"})}),a.jsx(Ae,{type:"submit",children:"Purge"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{order:2,children:"Remove Bot ID Jobs from Queue"}),a.jsx("p",{children:"Remove all queued jobs for a Bot ID"}),a.jsx(mt,{onSubmit:b,children:a.jsxs(Ue,{children:[a.jsx(zt,{title:"Bot ID",children:a.jsx(Fe,{name:"botId",placeholder:"Bot Id"})}),a.jsx(Ae,{type:"submit",children:"Remove Jobs by Bot ID"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{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(mt,{onSubmit:j,children:a.jsxs(Ue,{children:[a.jsx(Fe,{name:"email",label:"Email",required:!0}),a.jsx(Xi,{name:"password",label:"Password",required:!0}),a.jsx(Fe,{name:"projectId",label:"Project ID"}),a.jsx(Ae,{type:"submit",children:"Force Set Password"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{order:2,children:"Database Stats"}),a.jsx("p",{children:"Query current table statistics from the database."}),a.jsx(mt,{onSubmit:C,children:a.jsxs(Ue,{children:[a.jsx(zt,{title:"Table Names (comma-delimited)",htmlFor:"tableNames",children:a.jsx(Fe,{id:"tableNames",name:"tableNames",placeholder:"Observation,Observation_History"})}),a.jsx(Ae,{type:"submit",children:"Get Database Stats"})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{order:2,children:"Database Invalid Indexes"}),a.jsx("p",{children:"Query invalid indexes from the database."}),a.jsx(mt,{onSubmit:R,children:a.jsx(Ue,{children:a.jsx(Ae,{type:"submit",children:"Get Database Invalid Indexes"})})}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{order:2,children:"Database Schema Drift"}),a.jsx("p",{children:"Show the schema migration needed to match the expected database schema."}),a.jsxs(br,{children:[a.jsx(br.Col,{span:6,children:a.jsx(mt,{onSubmit:T,children:a.jsx(Ue,{children:a.jsx(Ae,{type:"submit",children:"Get Schema Drift"})})})}),a.jsx(br.Col,{span:6,children:a.jsx(mt,{onSubmit:E,children:a.jsx(Ue,{children:a.jsx(Ae,{type:"submit",children:"Reconcile Schema Drift"})})})})]}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{order:2,children:"Reload Cron Resources"}),a.jsx("p",{children:"Obliterates the cron queue and rebuilds all the cron job schedulers for cron resources (eg. cron bots)."}),a.jsx(mt,{onSubmit:y,children:a.jsx(Ue,{children:a.jsx(Ae,{type:"submit",children:"Reload Cron Resources"})})}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{order:2,children:"Database Explain Search"}),a.jsx("p",{children:"Runs an EXPLAIN query on the database to show the query plan for a search."}),a.jsx(Hee,{setModalTitle:s,setModalContent:d,openModal:n}),a.jsx(Gn,{opened:t,onClose:r,title:o,centered:!0,size:"auto",children:c})]})}function Fee(){const[e,t]=v.useState("outdated");return a.jsxs(a.Fragment,{children:[a.jsx(un,{id:"reindexType",name:"reindexType",value:e,onChange:n=>t(n.target.value),data:[{label:"Outdated resources",value:"outdated"},{label:"All resources",value:"all"},{label:"Less than or equal to a specific version",value:"specific"}]}),e==="specific"&&a.jsx(Ic,{required:!0,name:"maxResourceVersion",placeholder:"Max Resource Version",min:0})]})}function Hee({setModalTitle:e,setModalContent:t,openModal:n}){const r=Re(),[o,s]=v.useState(),[c,d]=v.useState(),[f,p]=v.useState(),[m,g]=v.useState(),y=v.useMemo(()=>{if(o?.reference)return{"_has:ProjectMembership:profile:project":o.reference}},[o]);v.useEffect(()=>{if(g(void 0),!c?.reference&&!o?.reference){p(void 0);return}r.searchResources("ProjectMembership",{profile:c?.reference,project:o?.reference,_count:20}).then(j=>{p(j),j.length===1&&g(Wt(j[0]))}).catch(j=>{console.error(j),ke({color:"red",message:Ge(j),autoClose:!1})})},[r,c,o]);const b=v.useMemo(()=>{const j={};return c?.reference&&(j.profile=c?.reference),o?.reference&&(j.project=o?.reference),j},[c,o]);function w(j){if(!j.query){ke({color:"red",message:"Query is required",autoClose:!1});return}const C=j.onBehalfOfProjectMembership;delete j.onBehalfOfProjectMembership;const R={query:j.query,analyze:j.analyze==="on",format:"text"},T={};C&&(T["x-medplum-on-behalf-of"]=C),r.post("fhir/R4/$explain",R,void 0,{headers:T}).then(E=>{e("Database Explain");const _=E.parameter?.find(N=>N.name==="explain")?.valueString,k=E.parameter?.find(N=>N.name==="query")?.valueString,L=E.parameter?.find(N=>N.name==="parameters")?.valueString,A=[k,L,`
184
- `,_].join(`
185
- `);t(a.jsx(zd,{block:!0,maw:"100%",children:A})),n()}).catch(E=>{ke({color:"red",message:Ge(E),autoClose:!1})})}return!r.isLoading()&&!r.isSuperAdmin()?a.jsx(jr,{outcome:Qd}):a.jsx(mt,{onSubmit:w,children:a.jsxs(Ue,{children:[a.jsx(Fe,{name:"query",label:"Search",required:!0,placeholder:"Observation?code=85354-9&_sort=-date&_count=5"}),a.jsx(Ln,{name:"analyze",label:"Analyze"}),a.jsx(Nd,{label:"On Behalf Of",children:a.jsxs(Ue,{gap:"sm",children:[a.jsx(cs,{required:!0,placeholder:"Project",targetTypes:["Project"],name:"onBehalfOfProject",onChange:s}),a.jsx(cs,{required:!0,placeholder:"Practitioner or Patient",name:"onBehalfOfProfile",targetTypes:["Practitioner","Patient"],onChange:d,searchCriteria:y}),f?.length!==1&&a.jsx(cs,{required:!0,placeholder:"ProjectMembership",name:"onBehalfOfProjectMembership",targetTypes:["ProjectMembership"],onChange:g,searchCriteria:b}),f?.length===1&&a.jsxs(a.Fragment,{children:[a.jsx("input",{type:"hidden",name:"onBehalfOfProjectMembership",value:Ot(f[0])}),a.jsx(jp,{value:Wt(f[0])})]}),!m&&a.jsx(Te,{fs:"italic",children:"On Behalf Of not set. Running as super admin"})]})}),a.jsx(Ae,{type:"submit",children:"Explain Search"})]})})}function qee(){return a.jsxs(a.Fragment,{children:[a.jsx(Ie,{children:"Users"}),a.jsx(Wm,{resourceType:"Practitioner",fields:["user","profile","admin","_lastUpdated"]}),a.jsx(xe,{justify:"flex-end",children:a.jsx(St,{to:"/admin/invite",children:"Invite new user"})})]})}const Gee=new Map([["1km","application/vnd.1000minds.decision-model+xml"],["3dml","text/vnd.in3d.3dml"],["3ds","image/x-3ds"],["3g2","video/3gpp2"],["3gp","video/3gp"],["3gpp","video/3gpp"],["3mf","model/3mf"],["7z","application/x-7z-compressed"],["7zip","application/x-7z-compressed"],["123","application/vnd.lotus-1-2-3"],["aab","application/x-authorware-bin"],["aac","audio/x-acc"],["aam","application/x-authorware-map"],["aas","application/x-authorware-seg"],["abw","application/x-abiword"],["ac","application/vnd.nokia.n-gage.ac+xml"],["ac3","audio/ac3"],["acc","application/vnd.americandynamics.acc"],["ace","application/x-ace-compressed"],["acu","application/vnd.acucobol"],["acutc","application/vnd.acucorp"],["adp","audio/adpcm"],["aep","application/vnd.audiograph"],["afm","application/x-font-type1"],["afp","application/vnd.ibm.modcap"],["ahead","application/vnd.ahead.space"],["ai","application/pdf"],["aif","audio/x-aiff"],["aifc","audio/x-aiff"],["aiff","audio/x-aiff"],["air","application/vnd.adobe.air-application-installer-package+zip"],["ait","application/vnd.dvb.ait"],["ami","application/vnd.amiga.ami"],["amr","audio/amr"],["apk","application/vnd.android.package-archive"],["apng","image/apng"],["appcache","text/cache-manifest"],["application","application/x-ms-application"],["apr","application/vnd.lotus-approach"],["arc","application/x-freearc"],["arj","application/x-arj"],["asc","application/pgp-signature"],["asf","video/x-ms-asf"],["asm","text/x-asm"],["aso","application/vnd.accpac.simply.aso"],["asx","video/x-ms-asf"],["atc","application/vnd.acucorp"],["atom","application/atom+xml"],["atomcat","application/atomcat+xml"],["atomdeleted","application/atomdeleted+xml"],["atomsvc","application/atomsvc+xml"],["atx","application/vnd.antix.game-component"],["au","audio/x-au"],["avi","video/x-msvideo"],["avif","image/avif"],["aw","application/applixware"],["azf","application/vnd.airzip.filesecure.azf"],["azs","application/vnd.airzip.filesecure.azs"],["azv","image/vnd.airzip.accelerator.azv"],["azw","application/vnd.amazon.ebook"],["b16","image/vnd.pco.b16"],["bat","application/x-msdownload"],["bcpio","application/x-bcpio"],["bdf","application/x-font-bdf"],["bdm","application/vnd.syncml.dm+wbxml"],["bdoc","application/x-bdoc"],["bed","application/vnd.realvnc.bed"],["bh2","application/vnd.fujitsu.oasysprs"],["bin","application/octet-stream"],["blb","application/x-blorb"],["blorb","application/x-blorb"],["bmi","application/vnd.bmi"],["bmml","application/vnd.balsamiq.bmml+xml"],["bmp","image/bmp"],["book","application/vnd.framemaker"],["box","application/vnd.previewsystems.box"],["boz","application/x-bzip2"],["bpk","application/octet-stream"],["bpmn","application/octet-stream"],["bsp","model/vnd.valve.source.compiled-map"],["btif","image/prs.btif"],["buffer","application/octet-stream"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["c","text/x-c"],["c4d","application/vnd.clonk.c4group"],["c4f","application/vnd.clonk.c4group"],["c4g","application/vnd.clonk.c4group"],["c4p","application/vnd.clonk.c4group"],["c4u","application/vnd.clonk.c4group"],["c11amc","application/vnd.cluetrust.cartomobile-config"],["c11amz","application/vnd.cluetrust.cartomobile-config-pkg"],["cab","application/vnd.ms-cab-compressed"],["caf","audio/x-caf"],["cap","application/vnd.tcpdump.pcap"],["car","application/vnd.curl.car"],["cat","application/vnd.ms-pki.seccat"],["cb7","application/x-cbr"],["cba","application/x-cbr"],["cbr","application/x-cbr"],["cbt","application/x-cbr"],["cbz","application/x-cbr"],["cc","text/x-c"],["cco","application/x-cocoa"],["cct","application/x-director"],["ccxml","application/ccxml+xml"],["cdbcmsg","application/vnd.contact.cmsg"],["cda","application/x-cdf"],["cdf","application/x-netcdf"],["cdfx","application/cdfx+xml"],["cdkey","application/vnd.mediastation.cdkey"],["cdmia","application/cdmi-capability"],["cdmic","application/cdmi-container"],["cdmid","application/cdmi-domain"],["cdmio","application/cdmi-object"],["cdmiq","application/cdmi-queue"],["cdr","application/cdr"],["cdx","chemical/x-cdx"],["cdxml","application/vnd.chemdraw+xml"],["cdy","application/vnd.cinderella"],["cer","application/pkix-cert"],["cfs","application/x-cfs-compressed"],["cgm","image/cgm"],["chat","application/x-chat"],["chm","application/vnd.ms-htmlhelp"],["chrt","application/vnd.kde.kchart"],["cif","chemical/x-cif"],["cii","application/vnd.anser-web-certificate-issue-initiation"],["cil","application/vnd.ms-artgalry"],["cjs","application/node"],["cla","application/vnd.claymore"],["class","application/octet-stream"],["clkk","application/vnd.crick.clicker.keyboard"],["clkp","application/vnd.crick.clicker.palette"],["clkt","application/vnd.crick.clicker.template"],["clkw","application/vnd.crick.clicker.wordbank"],["clkx","application/vnd.crick.clicker"],["clp","application/x-msclip"],["cmc","application/vnd.cosmocaller"],["cmdf","chemical/x-cmdf"],["cml","chemical/x-cml"],["cmp","application/vnd.yellowriver-custom-menu"],["cmx","image/x-cmx"],["cod","application/vnd.rim.cod"],["coffee","text/coffeescript"],["com","application/x-msdownload"],["conf","text/plain"],["cpio","application/x-cpio"],["cpp","text/x-c"],["cpt","application/mac-compactpro"],["crd","application/x-mscardfile"],["crl","application/pkix-crl"],["crt","application/x-x509-ca-cert"],["crx","application/x-chrome-extension"],["cryptonote","application/vnd.rig.cryptonote"],["csh","application/x-csh"],["csl","application/vnd.citationstyles.style+xml"],["csml","chemical/x-csml"],["csp","application/vnd.commonspace"],["csr","application/octet-stream"],["css","text/css"],["cst","application/x-director"],["csv","text/csv"],["cu","application/cu-seeme"],["curl","text/vnd.curl"],["cww","application/prs.cww"],["cxt","application/x-director"],["cxx","text/x-c"],["dae","model/vnd.collada+xml"],["daf","application/vnd.mobius.daf"],["dart","application/vnd.dart"],["dataless","application/vnd.fdsn.seed"],["davmount","application/davmount+xml"],["dbf","application/vnd.dbf"],["dbk","application/docbook+xml"],["dcr","application/x-director"],["dcurl","text/vnd.curl.dcurl"],["dd2","application/vnd.oma.dd2+xml"],["ddd","application/vnd.fujixerox.ddd"],["ddf","application/vnd.syncml.dmddf+xml"],["dds","image/vnd.ms-dds"],["deb","application/x-debian-package"],["def","text/plain"],["deploy","application/octet-stream"],["der","application/x-x509-ca-cert"],["dfac","application/vnd.dreamfactory"],["dgc","application/x-dgc-compressed"],["dic","text/x-c"],["dir","application/x-director"],["dis","application/vnd.mobius.dis"],["disposition-notification","message/disposition-notification"],["dist","application/octet-stream"],["distz","application/octet-stream"],["djv","image/vnd.djvu"],["djvu","image/vnd.djvu"],["dll","application/octet-stream"],["dmg","application/x-apple-diskimage"],["dmn","application/octet-stream"],["dmp","application/vnd.tcpdump.pcap"],["dms","application/octet-stream"],["dna","application/vnd.dna"],["doc","application/msword"],["docm","application/vnd.ms-word.template.macroEnabled.12"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["dot","application/msword"],["dotm","application/vnd.ms-word.template.macroEnabled.12"],["dotx","application/vnd.openxmlformats-officedocument.wordprocessingml.template"],["dp","application/vnd.osgi.dp"],["dpg","application/vnd.dpgraph"],["dra","audio/vnd.dra"],["drle","image/dicom-rle"],["dsc","text/prs.lines.tag"],["dssc","application/dssc+der"],["dtb","application/x-dtbook+xml"],["dtd","application/xml-dtd"],["dts","audio/vnd.dts"],["dtshd","audio/vnd.dts.hd"],["dump","application/octet-stream"],["dvb","video/vnd.dvb.file"],["dvi","application/x-dvi"],["dwd","application/atsc-dwd+xml"],["dwf","model/vnd.dwf"],["dwg","image/vnd.dwg"],["dxf","image/vnd.dxf"],["dxp","application/vnd.spotfire.dxp"],["dxr","application/x-director"],["ear","application/java-archive"],["ecelp4800","audio/vnd.nuera.ecelp4800"],["ecelp7470","audio/vnd.nuera.ecelp7470"],["ecelp9600","audio/vnd.nuera.ecelp9600"],["ecma","application/ecmascript"],["edm","application/vnd.novadigm.edm"],["edx","application/vnd.novadigm.edx"],["efif","application/vnd.picsel"],["ei6","application/vnd.pg.osasli"],["elc","application/octet-stream"],["emf","image/emf"],["eml","message/rfc822"],["emma","application/emma+xml"],["emotionml","application/emotionml+xml"],["emz","application/x-msmetafile"],["eol","audio/vnd.digital-winds"],["eot","application/vnd.ms-fontobject"],["eps","application/postscript"],["epub","application/epub+zip"],["es","application/ecmascript"],["es3","application/vnd.eszigno3+xml"],["esa","application/vnd.osgi.subsystem"],["esf","application/vnd.epson.esf"],["et3","application/vnd.eszigno3+xml"],["etx","text/x-setext"],["eva","application/x-eva"],["evy","application/x-envoy"],["exe","application/octet-stream"],["exi","application/exi"],["exp","application/express"],["exr","image/aces"],["ext","application/vnd.novadigm.ext"],["ez","application/andrew-inset"],["ez2","application/vnd.ezpix-album"],["ez3","application/vnd.ezpix-package"],["f","text/x-fortran"],["f4v","video/mp4"],["f77","text/x-fortran"],["f90","text/x-fortran"],["fbs","image/vnd.fastbidsheet"],["fcdt","application/vnd.adobe.formscentral.fcdt"],["fcs","application/vnd.isac.fcs"],["fdf","application/vnd.fdf"],["fdt","application/fdt+xml"],["fe_launch","application/vnd.denovo.fcselayout-link"],["fg5","application/vnd.fujitsu.oasysgp"],["fgd","application/x-director"],["fh","image/x-freehand"],["fh4","image/x-freehand"],["fh5","image/x-freehand"],["fh7","image/x-freehand"],["fhc","image/x-freehand"],["fig","application/x-xfig"],["fits","image/fits"],["flac","audio/x-flac"],["fli","video/x-fli"],["flo","application/vnd.micrografx.flo"],["flv","video/x-flv"],["flw","application/vnd.kde.kivio"],["flx","text/vnd.fmi.flexstor"],["fly","text/vnd.fly"],["fm","application/vnd.framemaker"],["fnc","application/vnd.frogans.fnc"],["fo","application/vnd.software602.filler.form+xml"],["for","text/x-fortran"],["fpx","image/vnd.fpx"],["frame","application/vnd.framemaker"],["fsc","application/vnd.fsc.weblaunch"],["fst","image/vnd.fst"],["ftc","application/vnd.fluxtime.clip"],["fti","application/vnd.anser-web-funds-transfer-initiation"],["fvt","video/vnd.fvt"],["fxp","application/vnd.adobe.fxp"],["fxpl","application/vnd.adobe.fxp"],["fzs","application/vnd.fuzzysheet"],["g2w","application/vnd.geoplan"],["g3","image/g3fax"],["g3w","application/vnd.geospace"],["gac","application/vnd.groove-account"],["gam","application/x-tads"],["gbr","application/rpki-ghostbusters"],["gca","application/x-gca-compressed"],["gdl","model/vnd.gdl"],["gdoc","application/vnd.google-apps.document"],["geo","application/vnd.dynageo"],["geojson","application/geo+json"],["gex","application/vnd.geometry-explorer"],["ggb","application/vnd.geogebra.file"],["ggt","application/vnd.geogebra.tool"],["ghf","application/vnd.groove-help"],["gif","image/gif"],["gim","application/vnd.groove-identity-message"],["glb","model/gltf-binary"],["gltf","model/gltf+json"],["gml","application/gml+xml"],["gmx","application/vnd.gmx"],["gnumeric","application/x-gnumeric"],["gpg","application/gpg-keys"],["gph","application/vnd.flographit"],["gpx","application/gpx+xml"],["gqf","application/vnd.grafeq"],["gqs","application/vnd.grafeq"],["gram","application/srgs"],["gramps","application/x-gramps-xml"],["gre","application/vnd.geometry-explorer"],["grv","application/vnd.groove-injector"],["grxml","application/srgs+xml"],["gsf","application/x-font-ghostscript"],["gsheet","application/vnd.google-apps.spreadsheet"],["gslides","application/vnd.google-apps.presentation"],["gtar","application/x-gtar"],["gtm","application/vnd.groove-tool-message"],["gtw","model/vnd.gtw"],["gv","text/vnd.graphviz"],["gxf","application/gxf"],["gxt","application/vnd.geonext"],["gz","application/gzip"],["gzip","application/gzip"],["h","text/x-c"],["h261","video/h261"],["h263","video/h263"],["h264","video/h264"],["hal","application/vnd.hal+xml"],["hbci","application/vnd.hbci"],["hbs","text/x-handlebars-template"],["hdd","application/x-virtualbox-hdd"],["hdf","application/x-hdf"],["heic","image/heic"],["heics","image/heic-sequence"],["heif","image/heif"],["heifs","image/heif-sequence"],["hej2","image/hej2k"],["held","application/atsc-held+xml"],["hh","text/x-c"],["hjson","application/hjson"],["hlp","application/winhlp"],["hpgl","application/vnd.hp-hpgl"],["hpid","application/vnd.hp-hpid"],["hps","application/vnd.hp-hps"],["hqx","application/mac-binhex40"],["hsj2","image/hsj2"],["htc","text/x-component"],["htke","application/vnd.kenameaapp"],["htm","text/html"],["html","text/html"],["hvd","application/vnd.yamaha.hv-dic"],["hvp","application/vnd.yamaha.hv-voice"],["hvs","application/vnd.yamaha.hv-script"],["i2g","application/vnd.intergeo"],["icc","application/vnd.iccprofile"],["ice","x-conference/x-cooltalk"],["icm","application/vnd.iccprofile"],["ico","image/x-icon"],["ics","text/calendar"],["ief","image/ief"],["ifb","text/calendar"],["ifm","application/vnd.shana.informed.formdata"],["iges","model/iges"],["igl","application/vnd.igloader"],["igm","application/vnd.insors.igm"],["igs","model/iges"],["igx","application/vnd.micrografx.igx"],["iif","application/vnd.shana.informed.interchange"],["img","application/octet-stream"],["imp","application/vnd.accpac.simply.imp"],["ims","application/vnd.ms-ims"],["in","text/plain"],["ini","text/plain"],["ink","application/inkml+xml"],["inkml","application/inkml+xml"],["install","application/x-install-instructions"],["iota","application/vnd.astraea-software.iota"],["ipfix","application/ipfix"],["ipk","application/vnd.shana.informed.package"],["irm","application/vnd.ibm.rights-management"],["irp","application/vnd.irepository.package+xml"],["iso","application/x-iso9660-image"],["itp","application/vnd.shana.informed.formtemplate"],["its","application/its+xml"],["ivp","application/vnd.immervision-ivp"],["ivu","application/vnd.immervision-ivu"],["jad","text/vnd.sun.j2me.app-descriptor"],["jade","text/jade"],["jam","application/vnd.jam"],["jar","application/java-archive"],["jardiff","application/x-java-archive-diff"],["java","text/x-java-source"],["jhc","image/jphc"],["jisp","application/vnd.jisp"],["jls","image/jls"],["jlt","application/vnd.hp-jlyt"],["jng","image/x-jng"],["jnlp","application/x-java-jnlp-file"],["joda","application/vnd.joost.joda-archive"],["jp2","image/jp2"],["jpe","image/jpeg"],["jpeg","image/jpeg"],["jpf","image/jpx"],["jpg","image/jpeg"],["jpg2","image/jp2"],["jpgm","video/jpm"],["jpgv","video/jpeg"],["jph","image/jph"],["jpm","video/jpm"],["jpx","image/jpx"],["js","application/javascript"],["json","application/json"],["json5","application/json5"],["jsonld","application/ld+json"],["jsonl","application/jsonl"],["jsonml","application/jsonml+json"],["jsx","text/jsx"],["jxr","image/jxr"],["jxra","image/jxra"],["jxrs","image/jxrs"],["jxs","image/jxs"],["jxsc","image/jxsc"],["jxsi","image/jxsi"],["jxss","image/jxss"],["kar","audio/midi"],["karbon","application/vnd.kde.karbon"],["kdb","application/octet-stream"],["kdbx","application/x-keepass2"],["key","application/x-iwork-keynote-sffkey"],["kfo","application/vnd.kde.kformula"],["kia","application/vnd.kidspiration"],["kml","application/vnd.google-earth.kml+xml"],["kmz","application/vnd.google-earth.kmz"],["kne","application/vnd.kinar"],["knp","application/vnd.kinar"],["kon","application/vnd.kde.kontour"],["kpr","application/vnd.kde.kpresenter"],["kpt","application/vnd.kde.kpresenter"],["kpxx","application/vnd.ds-keypoint"],["ksp","application/vnd.kde.kspread"],["ktr","application/vnd.kahootz"],["ktx","image/ktx"],["ktx2","image/ktx2"],["ktz","application/vnd.kahootz"],["kwd","application/vnd.kde.kword"],["kwt","application/vnd.kde.kword"],["lasxml","application/vnd.las.las+xml"],["latex","application/x-latex"],["lbd","application/vnd.llamagraphics.life-balance.desktop"],["lbe","application/vnd.llamagraphics.life-balance.exchange+xml"],["les","application/vnd.hhe.lesson-player"],["less","text/less"],["lgr","application/lgr+xml"],["lha","application/octet-stream"],["link66","application/vnd.route66.link66+xml"],["list","text/plain"],["list3820","application/vnd.ibm.modcap"],["listafp","application/vnd.ibm.modcap"],["litcoffee","text/coffeescript"],["lnk","application/x-ms-shortcut"],["log","text/plain"],["lostxml","application/lost+xml"],["lrf","application/octet-stream"],["lrm","application/vnd.ms-lrm"],["ltf","application/vnd.frogans.ltf"],["lua","text/x-lua"],["luac","application/x-lua-bytecode"],["lvp","audio/vnd.lucent.voice"],["lwp","application/vnd.lotus-wordpro"],["lzh","application/octet-stream"],["m1v","video/mpeg"],["m2a","audio/mpeg"],["m2v","video/mpeg"],["m3a","audio/mpeg"],["m3u","text/plain"],["m3u8","application/vnd.apple.mpegurl"],["m4a","audio/x-m4a"],["m4p","application/mp4"],["m4s","video/iso.segment"],["m4u","application/vnd.mpegurl"],["m4v","video/x-m4v"],["m13","application/x-msmediaview"],["m14","application/x-msmediaview"],["m21","application/mp21"],["ma","application/mathematica"],["mads","application/mads+xml"],["maei","application/mmt-aei+xml"],["mag","application/vnd.ecowin.chart"],["maker","application/vnd.framemaker"],["man","text/troff"],["manifest","text/cache-manifest"],["map","application/json"],["mar","application/octet-stream"],["markdown","text/markdown"],["mathml","application/mathml+xml"],["mb","application/mathematica"],["mbk","application/vnd.mobius.mbk"],["mbox","application/mbox"],["mc1","application/vnd.medcalcdata"],["mcd","application/vnd.mcd"],["mcurl","text/vnd.curl.mcurl"],["md","text/markdown"],["mdb","application/x-msaccess"],["mdi","image/vnd.ms-modi"],["mdx","text/mdx"],["me","text/troff"],["mesh","model/mesh"],["meta4","application/metalink4+xml"],["metalink","application/metalink+xml"],["mets","application/mets+xml"],["mfm","application/vnd.mfmp"],["mft","application/rpki-manifest"],["mgp","application/vnd.osgeo.mapguide.package"],["mgz","application/vnd.proteus.magazine"],["mid","audio/midi"],["midi","audio/midi"],["mie","application/x-mie"],["mif","application/vnd.mif"],["mime","message/rfc822"],["mj2","video/mj2"],["mjp2","video/mj2"],["mjs","application/javascript"],["mk3d","video/x-matroska"],["mka","audio/x-matroska"],["mkd","text/x-markdown"],["mks","video/x-matroska"],["mkv","video/x-matroska"],["mlp","application/vnd.dolby.mlp"],["mmd","application/vnd.chipnuts.karaoke-mmd"],["mmf","application/vnd.smaf"],["mml","text/mathml"],["mmr","image/vnd.fujixerox.edmics-mmr"],["mng","video/x-mng"],["mny","application/x-msmoney"],["mobi","application/x-mobipocket-ebook"],["mods","application/mods+xml"],["mov","video/quicktime"],["movie","video/x-sgi-movie"],["mp2","audio/mpeg"],["mp2a","audio/mpeg"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mp4a","audio/mp4"],["mp4s","application/mp4"],["mp4v","video/mp4"],["mp21","application/mp21"],["mpc","application/vnd.mophun.certificate"],["mpd","application/dash+xml"],["mpe","video/mpeg"],["mpeg","video/mpeg"],["mpg","video/mpeg"],["mpg4","video/mp4"],["mpga","audio/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["mpm","application/vnd.blueice.multipass"],["mpn","application/vnd.mophun.application"],["mpp","application/vnd.ms-project"],["mpt","application/vnd.ms-project"],["mpy","application/vnd.ibm.minipay"],["mqy","application/vnd.mobius.mqy"],["mrc","application/marc"],["mrcx","application/marcxml+xml"],["ms","text/troff"],["mscml","application/mediaservercontrol+xml"],["mseed","application/vnd.fdsn.mseed"],["mseq","application/vnd.mseq"],["msf","application/vnd.epson.msf"],["msg","application/vnd.ms-outlook"],["msh","model/mesh"],["msi","application/x-msdownload"],["msl","application/vnd.mobius.msl"],["msm","application/octet-stream"],["msp","application/octet-stream"],["msty","application/vnd.muvee.style"],["mtl","model/mtl"],["mts","model/vnd.mts"],["mus","application/vnd.musician"],["musd","application/mmt-usd+xml"],["musicxml","application/vnd.recordare.musicxml+xml"],["mvb","application/x-msmediaview"],["mvt","application/vnd.mapbox-vector-tile"],["mwf","application/vnd.mfer"],["mxf","application/mxf"],["mxl","application/vnd.recordare.musicxml"],["mxmf","audio/mobile-xmf"],["mxml","application/xv+xml"],["mxs","application/vnd.triscape.mxs"],["mxu","video/vnd.mpegurl"],["n-gage","application/vnd.nokia.n-gage.symbian.install"],["n3","text/n3"],["nb","application/mathematica"],["nbp","application/vnd.wolfram.player"],["nc","application/x-netcdf"],["ncx","application/x-dtbncx+xml"],["nfo","text/x-nfo"],["ngdat","application/vnd.nokia.n-gage.data"],["nitf","application/vnd.nitf"],["nlu","application/vnd.neurolanguage.nlu"],["nml","application/vnd.enliven"],["nnd","application/vnd.noblenet-directory"],["nns","application/vnd.noblenet-sealer"],["nnw","application/vnd.noblenet-web"],["npx","image/vnd.net-fpx"],["nq","application/n-quads"],["nsc","application/x-conference"],["nsf","application/vnd.lotus-notes"],["nt","application/n-triples"],["ntf","application/vnd.nitf"],["numbers","application/x-iwork-numbers-sffnumbers"],["nzb","application/x-nzb"],["oa2","application/vnd.fujitsu.oasys2"],["oa3","application/vnd.fujitsu.oasys3"],["oas","application/vnd.fujitsu.oasys"],["obd","application/x-msbinder"],["obgx","application/vnd.openblox.game+xml"],["obj","model/obj"],["oda","application/oda"],["odb","application/vnd.oasis.opendocument.database"],["odc","application/vnd.oasis.opendocument.chart"],["odf","application/vnd.oasis.opendocument.formula"],["odft","application/vnd.oasis.opendocument.formula-template"],["odg","application/vnd.oasis.opendocument.graphics"],["odi","application/vnd.oasis.opendocument.image"],["odm","application/vnd.oasis.opendocument.text-master"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogex","model/vnd.opengex"],["ogg","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["omdoc","application/omdoc+xml"],["onepkg","application/onenote"],["onetmp","application/onenote"],["onetoc","application/onenote"],["onetoc2","application/onenote"],["opf","application/oebps-package+xml"],["opml","text/x-opml"],["oprc","application/vnd.palm"],["opus","audio/ogg"],["org","text/x-org"],["osf","application/vnd.yamaha.openscoreformat"],["osfpvg","application/vnd.yamaha.openscoreformat.osfpvg+xml"],["osm","application/vnd.openstreetmap.data+xml"],["otc","application/vnd.oasis.opendocument.chart-template"],["otf","font/otf"],["otg","application/vnd.oasis.opendocument.graphics-template"],["oth","application/vnd.oasis.opendocument.text-web"],["oti","application/vnd.oasis.opendocument.image-template"],["otp","application/vnd.oasis.opendocument.presentation-template"],["ots","application/vnd.oasis.opendocument.spreadsheet-template"],["ott","application/vnd.oasis.opendocument.text-template"],["ova","application/x-virtualbox-ova"],["ovf","application/x-virtualbox-ovf"],["owl","application/rdf+xml"],["oxps","application/oxps"],["oxt","application/vnd.openofficeorg.extension"],["p","text/x-pascal"],["p7a","application/x-pkcs7-signature"],["p7b","application/x-pkcs7-certificates"],["p7c","application/pkcs7-mime"],["p7m","application/pkcs7-mime"],["p7r","application/x-pkcs7-certreqresp"],["p7s","application/pkcs7-signature"],["p8","application/pkcs8"],["p10","application/x-pkcs10"],["p12","application/x-pkcs12"],["pac","application/x-ns-proxy-autoconfig"],["pages","application/x-iwork-pages-sffpages"],["pas","text/x-pascal"],["paw","application/vnd.pawaafile"],["pbd","application/vnd.powerbuilder6"],["pbm","image/x-portable-bitmap"],["pcap","application/vnd.tcpdump.pcap"],["pcf","application/x-font-pcf"],["pcl","application/vnd.hp-pcl"],["pclxl","application/vnd.hp-pclxl"],["pct","image/x-pict"],["pcurl","application/vnd.curl.pcurl"],["pcx","image/x-pcx"],["pdb","application/x-pilot"],["pde","text/x-processing"],["pdf","application/pdf"],["pem","application/x-x509-user-cert"],["pfa","application/x-font-type1"],["pfb","application/x-font-type1"],["pfm","application/x-font-type1"],["pfr","application/font-tdpfr"],["pfx","application/x-pkcs12"],["pgm","image/x-portable-graymap"],["pgn","application/x-chess-pgn"],["pgp","application/pgp"],["php","application/x-httpd-php"],["php3","application/x-httpd-php"],["php4","application/x-httpd-php"],["phps","application/x-httpd-php-source"],["phtml","application/x-httpd-php"],["pic","image/x-pict"],["pkg","application/octet-stream"],["pki","application/pkixcmp"],["pkipath","application/pkix-pkipath"],["pkpass","application/vnd.apple.pkpass"],["pl","application/x-perl"],["plb","application/vnd.3gpp.pic-bw-large"],["plc","application/vnd.mobius.plc"],["plf","application/vnd.pocketlearn"],["pls","application/pls+xml"],["pm","application/x-perl"],["pml","application/vnd.ctc-posml"],["png","image/png"],["pnm","image/x-portable-anymap"],["portpkg","application/vnd.macports.portpkg"],["pot","application/vnd.ms-powerpoint"],["potm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["potx","application/vnd.openxmlformats-officedocument.presentationml.template"],["ppa","application/vnd.ms-powerpoint"],["ppam","application/vnd.ms-powerpoint.addin.macroEnabled.12"],["ppd","application/vnd.cups-ppd"],["ppm","image/x-portable-pixmap"],["pps","application/vnd.ms-powerpoint"],["ppsm","application/vnd.ms-powerpoint.slideshow.macroEnabled.12"],["ppsx","application/vnd.openxmlformats-officedocument.presentationml.slideshow"],["ppt","application/powerpoint"],["pptm","application/vnd.ms-powerpoint.presentation.macroEnabled.12"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["pqa","application/vnd.palm"],["prc","application/x-pilot"],["pre","application/vnd.lotus-freelance"],["prf","application/pics-rules"],["provx","application/provenance+xml"],["ps","application/postscript"],["psb","application/vnd.3gpp.pic-bw-small"],["psd","application/x-photoshop"],["psf","application/x-font-linux-psf"],["pskcxml","application/pskc+xml"],["pti","image/prs.pti"],["ptid","application/vnd.pvi.ptid1"],["pub","application/x-mspublisher"],["pvb","application/vnd.3gpp.pic-bw-var"],["pwn","application/vnd.3m.post-it-notes"],["pya","audio/vnd.ms-playready.media.pya"],["pyv","video/vnd.ms-playready.media.pyv"],["qam","application/vnd.epson.quickanime"],["qbo","application/vnd.intu.qbo"],["qfx","application/vnd.intu.qfx"],["qps","application/vnd.publishare-delta-tree"],["qt","video/quicktime"],["qwd","application/vnd.quark.quarkxpress"],["qwt","application/vnd.quark.quarkxpress"],["qxb","application/vnd.quark.quarkxpress"],["qxd","application/vnd.quark.quarkxpress"],["qxl","application/vnd.quark.quarkxpress"],["qxt","application/vnd.quark.quarkxpress"],["ra","audio/x-realaudio"],["ram","audio/x-pn-realaudio"],["raml","application/raml+yaml"],["rapd","application/route-apd+xml"],["rar","application/x-rar"],["ras","image/x-cmu-raster"],["rcprofile","application/vnd.ipunplugged.rcprofile"],["rdf","application/rdf+xml"],["rdz","application/vnd.data-vision.rdz"],["relo","application/p2p-overlay+xml"],["rep","application/vnd.businessobjects"],["res","application/x-dtbresource+xml"],["rgb","image/x-rgb"],["rif","application/reginfo+xml"],["rip","audio/vnd.rip"],["ris","application/x-research-info-systems"],["rl","application/resource-lists+xml"],["rlc","image/vnd.fujixerox.edmics-rlc"],["rld","application/resource-lists-diff+xml"],["rm","audio/x-pn-realaudio"],["rmi","audio/midi"],["rmp","audio/x-pn-realaudio-plugin"],["rms","application/vnd.jcp.javame.midlet-rms"],["rmvb","application/vnd.rn-realmedia-vbr"],["rnc","application/relax-ng-compact-syntax"],["rng","application/xml"],["roa","application/rpki-roa"],["roff","text/troff"],["rp9","application/vnd.cloanto.rp9"],["rpm","audio/x-pn-realaudio-plugin"],["rpss","application/vnd.nokia.radio-presets"],["rpst","application/vnd.nokia.radio-preset"],["rq","application/sparql-query"],["rs","application/rls-services+xml"],["rsa","application/x-pkcs7"],["rsat","application/atsc-rsat+xml"],["rsd","application/rsd+xml"],["rsheet","application/urc-ressheet+xml"],["rss","application/rss+xml"],["rtf","text/rtf"],["rtx","text/richtext"],["run","application/x-makeself"],["rusd","application/route-usd+xml"],["rv","video/vnd.rn-realvideo"],["s","text/x-asm"],["s3m","audio/s3m"],["saf","application/vnd.yamaha.smaf-audio"],["sass","text/x-sass"],["sbml","application/sbml+xml"],["sc","application/vnd.ibm.secure-container"],["scd","application/x-msschedule"],["scm","application/vnd.lotus-screencam"],["scq","application/scvp-cv-request"],["scs","application/scvp-cv-response"],["scss","text/x-scss"],["scurl","text/vnd.curl.scurl"],["sda","application/vnd.stardivision.draw"],["sdc","application/vnd.stardivision.calc"],["sdd","application/vnd.stardivision.impress"],["sdkd","application/vnd.solent.sdkm+xml"],["sdkm","application/vnd.solent.sdkm+xml"],["sdp","application/sdp"],["sdw","application/vnd.stardivision.writer"],["sea","application/octet-stream"],["see","application/vnd.seemail"],["seed","application/vnd.fdsn.seed"],["sema","application/vnd.sema"],["semd","application/vnd.semd"],["semf","application/vnd.semf"],["senmlx","application/senml+xml"],["sensmlx","application/sensml+xml"],["ser","application/java-serialized-object"],["setpay","application/set-payment-initiation"],["setreg","application/set-registration-initiation"],["sfd-hdstx","application/vnd.hydrostatix.sof-data"],["sfs","application/vnd.spotfire.sfs"],["sfv","text/x-sfv"],["sgi","image/sgi"],["sgl","application/vnd.stardivision.writer-global"],["sgm","text/sgml"],["sgml","text/sgml"],["sh","application/x-sh"],["shar","application/x-shar"],["shex","text/shex"],["shf","application/shf+xml"],["shtml","text/html"],["sid","image/x-mrsid-image"],["sieve","application/sieve"],["sig","application/pgp-signature"],["sil","audio/silk"],["silo","model/mesh"],["sis","application/vnd.symbian.install"],["sisx","application/vnd.symbian.install"],["sit","application/x-stuffit"],["sitx","application/x-stuffitx"],["siv","application/sieve"],["skd","application/vnd.koan"],["skm","application/vnd.koan"],["skp","application/vnd.koan"],["skt","application/vnd.koan"],["sldm","application/vnd.ms-powerpoint.slide.macroenabled.12"],["sldx","application/vnd.openxmlformats-officedocument.presentationml.slide"],["slim","text/slim"],["slm","text/slim"],["sls","application/route-s-tsid+xml"],["slt","application/vnd.epson.salt"],["sm","application/vnd.stepmania.stepchart"],["smf","application/vnd.stardivision.math"],["smi","application/smil"],["smil","application/smil"],["smv","video/x-smv"],["smzip","application/vnd.stepmania.package"],["snd","audio/basic"],["snf","application/x-font-snf"],["so","application/octet-stream"],["spc","application/x-pkcs7-certificates"],["spdx","text/spdx"],["spf","application/vnd.yamaha.smaf-phrase"],["spl","application/x-futuresplash"],["spot","text/vnd.in3d.spot"],["spp","application/scvp-vp-response"],["spq","application/scvp-vp-request"],["spx","audio/ogg"],["sql","application/x-sql"],["src","application/x-wais-source"],["srt","application/x-subrip"],["sru","application/sru+xml"],["srx","application/sparql-results+xml"],["ssdl","application/ssdl+xml"],["sse","application/vnd.kodak-descriptor"],["ssf","application/vnd.epson.ssf"],["ssml","application/ssml+xml"],["sst","application/octet-stream"],["st","application/vnd.sailingtracker.track"],["stc","application/vnd.sun.xml.calc.template"],["std","application/vnd.sun.xml.draw.template"],["stf","application/vnd.wt.stf"],["sti","application/vnd.sun.xml.impress.template"],["stk","application/hyperstudio"],["stl","model/stl"],["stpx","model/step+xml"],["stpxz","model/step-xml+zip"],["stpz","model/step+zip"],["str","application/vnd.pg.format"],["stw","application/vnd.sun.xml.writer.template"],["styl","text/stylus"],["stylus","text/stylus"],["sub","text/vnd.dvb.subtitle"],["sus","application/vnd.sus-calendar"],["susp","application/vnd.sus-calendar"],["sv4cpio","application/x-sv4cpio"],["sv4crc","application/x-sv4crc"],["svc","application/vnd.dvb.service"],["svd","application/vnd.svd"],["svg","image/svg+xml"],["svgz","image/svg+xml"],["swa","application/x-director"],["swf","application/x-shockwave-flash"],["swi","application/vnd.aristanetworks.swi"],["swidtag","application/swid+xml"],["sxc","application/vnd.sun.xml.calc"],["sxd","application/vnd.sun.xml.draw"],["sxg","application/vnd.sun.xml.writer.global"],["sxi","application/vnd.sun.xml.impress"],["sxm","application/vnd.sun.xml.math"],["sxw","application/vnd.sun.xml.writer"],["t","text/troff"],["t3","application/x-t3vm-image"],["t38","image/t38"],["taglet","application/vnd.mynfc"],["tao","application/vnd.tao.intent-module-archive"],["tap","image/vnd.tencent.tap"],["tar","application/x-tar"],["tcap","application/vnd.3gpp2.tcap"],["tcl","application/x-tcl"],["td","application/urc-targetdesc+xml"],["teacher","application/vnd.smart.teacher"],["tei","application/tei+xml"],["teicorpus","application/tei+xml"],["tex","application/x-tex"],["texi","application/x-texinfo"],["texinfo","application/x-texinfo"],["text","text/plain"],["tfi","application/thraud+xml"],["tfm","application/x-tex-tfm"],["tfx","image/tiff-fx"],["tga","image/x-tga"],["tgz","application/x-tar"],["thmx","application/vnd.ms-officetheme"],["tif","image/tiff"],["tiff","image/tiff"],["tk","application/x-tcl"],["tmo","application/vnd.tmobile-livetv"],["toml","application/toml"],["torrent","application/x-bittorrent"],["tpl","application/vnd.groove-tool-template"],["tpt","application/vnd.trid.tpt"],["tr","text/troff"],["tra","application/vnd.trueapp"],["trig","application/trig"],["trm","application/x-msterminal"],["ts","video/mp2t"],["tsd","application/timestamped-data"],["tsv","text/tab-separated-values"],["ttc","font/collection"],["ttf","font/ttf"],["ttl","text/turtle"],["ttml","application/ttml+xml"],["twd","application/vnd.simtech-mindmapper"],["twds","application/vnd.simtech-mindmapper"],["txd","application/vnd.genomatix.tuxedo"],["txf","application/vnd.mobius.txf"],["txt","text/plain"],["u8dsn","message/global-delivery-status"],["u8hdr","message/global-headers"],["u8mdn","message/global-disposition-notification"],["u8msg","message/global"],["u32","application/x-authorware-bin"],["ubj","application/ubjson"],["udeb","application/x-debian-package"],["ufd","application/vnd.ufdl"],["ufdl","application/vnd.ufdl"],["ulx","application/x-glulx"],["umj","application/vnd.umajin"],["unityweb","application/vnd.unity"],["uoml","application/vnd.uoml+xml"],["uri","text/uri-list"],["uris","text/uri-list"],["urls","text/uri-list"],["usdz","model/vnd.usdz+zip"],["ustar","application/x-ustar"],["utz","application/vnd.uiq.theme"],["uu","text/x-uuencode"],["uva","audio/vnd.dece.audio"],["uvd","application/vnd.dece.data"],["uvf","application/vnd.dece.data"],["uvg","image/vnd.dece.graphic"],["uvh","video/vnd.dece.hd"],["uvi","image/vnd.dece.graphic"],["uvm","video/vnd.dece.mobile"],["uvp","video/vnd.dece.pd"],["uvs","video/vnd.dece.sd"],["uvt","application/vnd.dece.ttml+xml"],["uvu","video/vnd.uvvu.mp4"],["uvv","video/vnd.dece.video"],["uvva","audio/vnd.dece.audio"],["uvvd","application/vnd.dece.data"],["uvvf","application/vnd.dece.data"],["uvvg","image/vnd.dece.graphic"],["uvvh","video/vnd.dece.hd"],["uvvi","image/vnd.dece.graphic"],["uvvm","video/vnd.dece.mobile"],["uvvp","video/vnd.dece.pd"],["uvvs","video/vnd.dece.sd"],["uvvt","application/vnd.dece.ttml+xml"],["uvvu","video/vnd.uvvu.mp4"],["uvvv","video/vnd.dece.video"],["uvvx","application/vnd.dece.unspecified"],["uvvz","application/vnd.dece.zip"],["uvx","application/vnd.dece.unspecified"],["uvz","application/vnd.dece.zip"],["vbox","application/x-virtualbox-vbox"],["vbox-extpack","application/x-virtualbox-vbox-extpack"],["vcard","text/vcard"],["vcd","application/x-cdlink"],["vcf","text/x-vcard"],["vcg","application/vnd.groove-vcard"],["vcs","text/x-vcalendar"],["vcx","application/vnd.vcx"],["vdi","application/x-virtualbox-vdi"],["vds","model/vnd.sap.vds"],["vhd","application/x-virtualbox-vhd"],["vis","application/vnd.visionary"],["viv","video/vnd.vivo"],["vlc","application/videolan"],["vmdk","application/x-virtualbox-vmdk"],["vob","video/x-ms-vob"],["vor","application/vnd.stardivision.writer"],["vox","application/x-authorware-bin"],["vrml","model/vrml"],["vsd","application/vnd.visio"],["vsf","application/vnd.vsf"],["vss","application/vnd.visio"],["vst","application/vnd.visio"],["vsw","application/vnd.visio"],["vtf","image/vnd.valve.source.texture"],["vtt","text/vtt"],["vtu","model/vnd.vtu"],["vxml","application/voicexml+xml"],["w3d","application/x-director"],["wad","application/x-doom"],["wadl","application/vnd.sun.wadl+xml"],["war","application/java-archive"],["wasm","application/wasm"],["wav","audio/x-wav"],["wax","audio/x-ms-wax"],["wbmp","image/vnd.wap.wbmp"],["wbs","application/vnd.criticaltools.wbs+xml"],["wbxml","application/wbxml"],["wcm","application/vnd.ms-works"],["wdb","application/vnd.ms-works"],["wdp","image/vnd.ms-photo"],["weba","audio/webm"],["webapp","application/x-web-app-manifest+json"],["webm","video/webm"],["webmanifest","application/manifest+json"],["webp","image/webp"],["wg","application/vnd.pmi.widget"],["wgt","application/widget"],["wks","application/vnd.ms-works"],["wm","video/x-ms-wm"],["wma","audio/x-ms-wma"],["wmd","application/x-ms-wmd"],["wmf","image/wmf"],["wml","text/vnd.wap.wml"],["wmlc","application/wmlc"],["wmls","text/vnd.wap.wmlscript"],["wmlsc","application/vnd.wap.wmlscriptc"],["wmv","video/x-ms-wmv"],["wmx","video/x-ms-wmx"],["wmz","application/x-msmetafile"],["woff","font/woff"],["woff2","font/woff2"],["word","application/msword"],["wpd","application/vnd.wordperfect"],["wpl","application/vnd.ms-wpl"],["wps","application/vnd.ms-works"],["wqd","application/vnd.wqd"],["wri","application/x-mswrite"],["wrl","model/vrml"],["wsc","message/vnd.wfa.wsc"],["wsdl","application/wsdl+xml"],["wspolicy","application/wspolicy+xml"],["wtb","application/vnd.webturbo"],["wvx","video/x-ms-wvx"],["x3d","model/x3d+xml"],["x3db","model/x3d+fastinfoset"],["x3dbz","model/x3d+binary"],["x3dv","model/x3d-vrml"],["x3dvz","model/x3d+vrml"],["x3dz","model/x3d+xml"],["x32","application/x-authorware-bin"],["x_b","model/vnd.parasolid.transmit.binary"],["x_t","model/vnd.parasolid.transmit.text"],["xaml","application/xaml+xml"],["xap","application/x-silverlight-app"],["xar","application/vnd.xara"],["xav","application/xcap-att+xml"],["xbap","application/x-ms-xbap"],["xbd","application/vnd.fujixerox.docuworks.binder"],["xbm","image/x-xbitmap"],["xca","application/xcap-caps+xml"],["xcs","application/calendar+xml"],["xdf","application/xcap-diff+xml"],["xdm","application/vnd.syncml.dm+xml"],["xdp","application/vnd.adobe.xdp+xml"],["xdssc","application/dssc+xml"],["xdw","application/vnd.fujixerox.docuworks"],["xel","application/xcap-el+xml"],["xenc","application/xenc+xml"],["xer","application/patch-ops-error+xml"],["xfdf","application/vnd.adobe.xfdf"],["xfdl","application/vnd.xfdl"],["xht","application/xhtml+xml"],["xhtml","application/xhtml+xml"],["xhvml","application/xv+xml"],["xif","image/vnd.xiff"],["xl","application/excel"],["xla","application/vnd.ms-excel"],["xlam","application/vnd.ms-excel.addin.macroEnabled.12"],["xlc","application/vnd.ms-excel"],["xlf","application/xliff+xml"],["xlm","application/vnd.ms-excel"],["xls","application/vnd.ms-excel"],["xlsb","application/vnd.ms-excel.sheet.binary.macroEnabled.12"],["xlsm","application/vnd.ms-excel.sheet.macroEnabled.12"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xlt","application/vnd.ms-excel"],["xltm","application/vnd.ms-excel.template.macroEnabled.12"],["xltx","application/vnd.openxmlformats-officedocument.spreadsheetml.template"],["xlw","application/vnd.ms-excel"],["xm","audio/xm"],["xml","application/xml"],["xns","application/xcap-ns+xml"],["xo","application/vnd.olpc-sugar"],["xop","application/xop+xml"],["xpi","application/x-xpinstall"],["xpl","application/xproc+xml"],["xpm","image/x-xpixmap"],["xpr","application/vnd.is-xpr"],["xps","application/vnd.ms-xpsdocument"],["xpw","application/vnd.intercon.formnet"],["xpx","application/vnd.intercon.formnet"],["xsd","application/xml"],["xsl","application/xml"],["xslt","application/xslt+xml"],["xsm","application/vnd.syncml+xml"],["xspf","application/xspf+xml"],["xul","application/vnd.mozilla.xul+xml"],["xvm","application/xv+xml"],["xvml","application/xv+xml"],["xwd","image/x-xwindowdump"],["xyz","chemical/x-xyz"],["xz","application/x-xz"],["yaml","text/yaml"],["yang","application/yang"],["yin","application/yin+xml"],["yml","text/yaml"],["ymp","text/x-suse-ymp"],["z","application/x-compress"],["z1","application/x-zmachine"],["z2","application/x-zmachine"],["z3","application/x-zmachine"],["z4","application/x-zmachine"],["z5","application/x-zmachine"],["z6","application/x-zmachine"],["z7","application/x-zmachine"],["z8","application/x-zmachine"],["zaz","application/vnd.zzazz.deck+xml"],["zip","application/zip"],["zir","application/vnd.zul"],["zirz","application/vnd.zul"],["zmm","application/vnd.handheld-entertainment+xml"],["zsh","text/x-scriptzsh"]]);function Vc(e,t,n){const r=Wee(e),{webkitRelativePath:o}=e,s=typeof t=="string"?t:typeof o=="string"&&o.length>0?o:`./${e.name}`;return typeof r.path!="string"&&NR(r,"path",s),NR(r,"relativePath",s),r}function Wee(e){const{name:t}=e;if(t&&t.lastIndexOf(".")!==-1&&!e.type){const r=t.split(".").pop().toLowerCase(),o=Gee.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}function NR(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}const Qee=[".DS_Store","Thumbs.db"];function Yee(e){return gl(this,void 0,void 0,function*(){return Np(e)&&Kee(e.dataTransfer)?ete(e.dataTransfer,e.type):Xee(e)?Jee(e):Array.isArray(e)&&e.every(t=>"getFile"in t&&typeof t.getFile=="function")?Zee(e):[]})}function Kee(e){return Np(e)}function Xee(e){return Np(e)&&Np(e.target)}function Np(e){return typeof e=="object"&&e!==null}function Jee(e){return Fx(e.target.files).map(t=>Vc(t))}function Zee(e){return gl(this,void 0,void 0,function*(){return(yield Promise.all(e.map(n=>n.getFile()))).map(n=>Vc(n))})}function ete(e,t){return gl(this,void 0,void 0,function*(){if(e.items){const n=Fx(e.items).filter(o=>o.kind==="file");if(t!=="drop")return n;const r=yield Promise.all(n.map(tte));return OR(zP(r))}return OR(Fx(e.files).map(n=>Vc(n)))})}function OR(e){return e.filter(t=>Qee.indexOf(t.name)===-1)}function Fx(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 tte(e){if(typeof e.webkitGetAsEntry!="function")return MR(e);const t=e.webkitGetAsEntry();return t&&t.isDirectory?$P(t):MR(e,t)}function zP(e){return e.reduce((t,n)=>[...t,...Array.isArray(n)?zP(n):[n]],[])}function MR(e,t){return gl(this,void 0,void 0,function*(){var n;if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle=="function"){const s=yield e.getAsFileSystemHandle();if(s===null)throw new Error(`${e} is not a File`);if(s!==void 0){const c=yield s.getFile();return c.handle=s,Vc(c)}}const r=e.getAsFile();if(!r)throw new Error(`${e} is not a File`);return Vc(r,(n=t?.fullPath)!==null&&n!==void 0?n:void 0)})}function nte(e){return gl(this,void 0,void 0,function*(){return e.isDirectory?$P(e):rte(e)})}function $P(e){const t=e.createReader();return new Promise((n,r)=>{const o=[];function s(){t.readEntries(c=>gl(this,void 0,void 0,function*(){if(c.length){const d=Promise.all(c.map(nte));o.push(d),s()}else try{const d=yield Promise.all(o);n(d)}catch(d){r(d)}}),c=>{r(c)})}s()})}function rte(e){return gl(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(r=>{const o=Vc(r,e.fullPath);t(o)},r=>{n(r)})})})}var zh={},LR;function ite(){return LR||(LR=1,zh.__esModule=!0,zh.default=function(e,t){if(e&&t){var n=Array.isArray(t)?t:t.split(",");if(n.length===0)return!0;var r=e.name||"",o=(e.type||"").toLowerCase(),s=o.replace(/\/.*$/,"");return n.some(function(c){var d=c.trim().toLowerCase();return d.charAt(0)==="."?r.toLowerCase().endsWith(d):d.endsWith("/*")?s===d.replace(/\/.*$/,""):o===d})}return!0}),zh}var ote=ite();const Yy=Lp(ote);function IR(e){return lte(e)||ste(e)||BP(e)||ate()}function ate(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
186
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ste(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function lte(e){if(Array.isArray(e))return Hx(e)}function zR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function $R(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?zR(Object(n),!0).forEach(function(r){UP(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):zR(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function UP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _d(e,t){return dte(e)||ute(e,t)||BP(e,t)||cte()}function cte(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
187
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BP(e,t){if(e){if(typeof e=="string")return Hx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Hx(e,t)}}function Hx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function ute(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,s=!1,c,d;try{for(n=n.call(e);!(o=(c=n.next()).done)&&(r.push(c.value),!(t&&r.length===t));o=!0);}catch(f){s=!0,d=f}finally{try{!o&&n.return!=null&&n.return()}finally{if(s)throw d}}return r}}function dte(e){if(Array.isArray(e))return e}var fte=typeof Yy=="function"?Yy:Yy.default,hte="file-invalid-type",pte="file-too-large",mte="file-too-small",gte="too-many-files",vte=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=t.split(","),r=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:hte,message:"File type must be ".concat(r)}},UR=function(t){return{code:pte,message:"File is larger than ".concat(t," ").concat(t===1?"byte":"bytes")}},BR=function(t){return{code:mte,message:"File is smaller than ".concat(t," ").concat(t===1?"byte":"bytes")}},yte={code:gte,message:"Too many files"};function VP(e,t){var n=e.type==="application/x-moz-file"||fte(e,t);return[n,n?null:vte(t)]}function FP(e,t,n){if(Ws(e.size))if(Ws(t)&&Ws(n)){if(e.size>n)return[!1,UR(n)];if(e.size<t)return[!1,BR(t)]}else{if(Ws(t)&&e.size<t)return[!1,BR(t)];if(Ws(n)&&e.size>n)return[!1,UR(n)]}return[!0,null]}function Ws(e){return e!=null}function xte(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,c=e.maxFiles,d=e.validator;return!s&&t.length>1||s&&c>=1&&t.length>c?!1:t.every(function(f){var p=VP(f,n),m=_d(p,1),g=m[0],y=FP(f,r,o),b=_d(y,1),w=b[0],j=d?d(f):null;return g&&w&&!j})}function Op(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function $h(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function VR(e){e.preventDefault()}function bte(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function Ste(e){return e.indexOf("Edge/")!==-1}function wte(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return bte(e)||Ste(e)}function po(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){for(var o=arguments.length,s=new Array(o>1?o-1:0),c=1;c<o;c++)s[c-1]=arguments[c];return t.some(function(d){return!Op(r)&&d&&d.apply(void 0,[r].concat(s)),Op(r)})}}function jte(){return"showOpenFilePicker"in window}function Cte(e){if(Ws(e)){var t=Object.entries(e).filter(function(n){var r=_d(n,2),o=r[0],s=r[1],c=!0;return HP(o)||(console.warn('Skipped "'.concat(o,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),c=!1),(!Array.isArray(s)||!s.every(qP))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),c=!1),c}).reduce(function(n,r){var o=_d(r,2),s=o[0],c=o[1];return $R($R({},n),{},UP({},s,c))},{});return[{description:"Files",accept:t}]}return e}function Ete(e){if(Ws(e))return Object.entries(e).reduce(function(t,n){var r=_d(n,2),o=r[0],s=r[1];return[].concat(IR(t),[o],IR(s))},[]).filter(function(t){return HP(t)||qP(t)}).join(",")}function Tte(e){return e instanceof DOMException&&(e.name==="AbortError"||e.code===e.ABORT_ERR)}function Rte(e){return e instanceof DOMException&&(e.name==="SecurityError"||e.code===e.SECURITY_ERR)}function HP(e){return e==="audio/*"||e==="video/*"||e==="image/*"||e==="text/*"||e==="application/*"||/\w+\/[-+.\w]+/g.test(e)}function qP(e){return/^.*\.[\w]+$/.test(e)}var _te=["children"],Dte=["open"],Ate=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],kte=["refKey","onChange","onClick"];function Pte(e){return Mte(e)||Ote(e)||GP(e)||Nte()}function Nte(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
188
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ote(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Mte(e){if(Array.isArray(e))return qx(e)}function Ky(e,t){return zte(e)||Ite(e,t)||GP(e,t)||Lte()}function Lte(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
189
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GP(e,t){if(e){if(typeof e=="string")return qx(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qx(e,t)}}function qx(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Ite(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r=[],o=!0,s=!1,c,d;try{for(n=n.call(e);!(o=(c=n.next()).done)&&(r.push(c.value),!(t&&r.length===t));o=!0);}catch(f){s=!0,d=f}finally{try{!o&&n.return!=null&&n.return()}finally{if(s)throw d}}return r}}function zte(e){if(Array.isArray(e))return e}function FR(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function An(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?FR(Object(n),!0).forEach(function(r){Gx(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):FR(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Gx(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Mp(e,t){if(e==null)return{};var n=$te(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function $te(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}var US=v.forwardRef(function(e,t){var n=e.children,r=Mp(e,_te),o=QP(r),s=o.open,c=Mp(o,Dte);return v.useImperativeHandle(t,function(){return{open:s}},[s]),kn.createElement(v.Fragment,null,n(An(An({},c),{},{open:s})))});US.displayName="Dropzone";var WP={disabled:!1,getFilesFromEvent:Yee,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};US.defaultProps=WP;US.propTypes={children:ln.func,accept:ln.objectOf(ln.arrayOf(ln.string)),multiple:ln.bool,preventDropOnDocument:ln.bool,noClick:ln.bool,noKeyboard:ln.bool,noDrag:ln.bool,noDragEventsBubbling:ln.bool,minSize:ln.number,maxSize:ln.number,maxFiles:ln.number,disabled:ln.bool,getFilesFromEvent:ln.func,onFileDialogCancel:ln.func,onFileDialogOpen:ln.func,useFsAccessApi:ln.bool,autoFocus:ln.bool,onDragEnter:ln.func,onDragLeave:ln.func,onDragOver:ln.func,onDrop:ln.func,onDropAccepted:ln.func,onDropRejected:ln.func,onError:ln.func,validator:ln.func};var Wx={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function QP(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=An(An({},WP),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,c=t.minSize,d=t.multiple,f=t.maxFiles,p=t.onDragEnter,m=t.onDragLeave,g=t.onDragOver,y=t.onDrop,b=t.onDropAccepted,w=t.onDropRejected,j=t.onFileDialogCancel,C=t.onFileDialogOpen,R=t.useFsAccessApi,T=t.autoFocus,E=t.preventDropOnDocument,_=t.noClick,k=t.noKeyboard,L=t.noDrag,A=t.noDragEventsBubbling,N=t.onError,U=t.validator,B=v.useMemo(function(){return Ete(n)},[n]),Q=v.useMemo(function(){return Cte(n)},[n]),J=v.useMemo(function(){return typeof C=="function"?C:HR},[C]),Z=v.useMemo(function(){return typeof j=="function"?j:HR},[j]),$=v.useRef(null),W=v.useRef(null),M=v.useReducer(Ute,Wx),I=Ky(M,2),z=I[0],F=I[1],X=z.isFocused,O=z.isFileDialogActive,H=v.useRef(typeof window<"u"&&window.isSecureContext&&R&&jte()),oe=function(){!H.current&&O&&setTimeout(function(){if(W.current){var pe=W.current.files;pe.length||(F({type:"closeDialog"}),Z())}},300)};v.useEffect(function(){return window.addEventListener("focus",oe,!1),function(){window.removeEventListener("focus",oe,!1)}},[W,O,Z,H]);var ue=v.useRef([]),Se=function(pe){$.current&&$.current.contains(pe.target)||(pe.preventDefault(),ue.current=[])};v.useEffect(function(){return E&&(document.addEventListener("dragover",VR,!1),document.addEventListener("drop",Se,!1)),function(){E&&(document.removeEventListener("dragover",VR),document.removeEventListener("drop",Se))}},[$,E]),v.useEffect(function(){return!r&&T&&$.current&&$.current.focus(),function(){}},[$,T,r]);var ge=v.useCallback(function(ve){N?N(ve):console.error(ve)},[N]),Pe=v.useCallback(function(ve){ve.preventDefault(),ve.persist(),Ne(ve),ue.current=[].concat(Pte(ue.current),[ve.target]),$h(ve)&&Promise.resolve(o(ve)).then(function(pe){if(!(Op(ve)&&!A)){var Oe=pe.length,tt=Oe>0&&xte({files:pe,accept:B,minSize:c,maxSize:s,multiple:d,maxFiles:f,validator:U}),Tt=Oe>0&&!tt;F({isDragAccept:tt,isDragReject:Tt,isDragActive:!0,type:"setDraggedFiles"}),p&&p(ve)}}).catch(function(pe){return ge(pe)})},[o,p,ge,A,B,c,s,d,f,U]),rt=v.useCallback(function(ve){ve.preventDefault(),ve.persist(),Ne(ve);var pe=$h(ve);if(pe&&ve.dataTransfer)try{ve.dataTransfer.dropEffect="copy"}catch{}return pe&&g&&g(ve),!1},[g,A]),Ce=v.useCallback(function(ve){ve.preventDefault(),ve.persist(),Ne(ve);var pe=ue.current.filter(function(tt){return $.current&&$.current.contains(tt)}),Oe=pe.indexOf(ve.target);Oe!==-1&&pe.splice(Oe,1),ue.current=pe,!(pe.length>0)&&(F({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),$h(ve)&&m&&m(ve))},[$,m,A]),ht=v.useCallback(function(ve,pe){var Oe=[],tt=[];ve.forEach(function(Tt){var Cn=VP(Tt,B),gn=Ky(Cn,2),$n=gn[0],Wn=gn[1],Un=FP(Tt,c,s),Dn=Ky(Un,2),Zn=Dn[0],Nn=Dn[1],Uo=U?U(Tt):null;if($n&&Zn&&!Uo)Oe.push(Tt);else{var ao=[Wn,Nn];Uo&&(ao=ao.concat(Uo)),tt.push({file:Tt,errors:ao.filter(function(Zr){return Zr})})}}),(!d&&Oe.length>1||d&&f>=1&&Oe.length>f)&&(Oe.forEach(function(Tt){tt.push({file:Tt,errors:[yte]})}),Oe.splice(0)),F({acceptedFiles:Oe,fileRejections:tt,isDragReject:tt.length>0,type:"setFiles"}),y&&y(Oe,tt,pe),tt.length>0&&w&&w(tt,pe),Oe.length>0&&b&&b(Oe,pe)},[F,d,B,c,s,f,y,b,w,U]),lt=v.useCallback(function(ve){ve.preventDefault(),ve.persist(),Ne(ve),ue.current=[],$h(ve)&&Promise.resolve(o(ve)).then(function(pe){Op(ve)&&!A||ht(pe,ve)}).catch(function(pe){return ge(pe)}),F({type:"reset"})},[o,ht,ge,A]),vt=v.useCallback(function(){if(H.current){F({type:"openDialog"}),J();var ve={multiple:d,types:Q};window.showOpenFilePicker(ve).then(function(pe){return o(pe)}).then(function(pe){ht(pe,null),F({type:"closeDialog"})}).catch(function(pe){Tte(pe)?(Z(pe),F({type:"closeDialog"})):Rte(pe)?(H.current=!1,W.current?(W.current.value=null,W.current.click()):ge(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."))):ge(pe)});return}W.current&&(F({type:"openDialog"}),J(),W.current.value=null,W.current.click())},[F,J,Z,R,ht,ge,Q,d]),it=v.useCallback(function(ve){!$.current||!$.current.isEqualNode(ve.target)||(ve.key===" "||ve.key==="Enter"||ve.keyCode===32||ve.keyCode===13)&&(ve.preventDefault(),vt())},[$,vt]),wt=v.useCallback(function(){F({type:"focus"})},[]),pt=v.useCallback(function(){F({type:"blur"})},[]),It=v.useCallback(function(){_||(wte()?setTimeout(vt,0):vt())},[_,vt]),_e=function(pe){return r?null:pe},Ee=function(pe){return k?null:_e(pe)},Le=function(pe){return L?null:_e(pe)},Ne=function(pe){A&&pe.stopPropagation()},ct=v.useMemo(function(){return function(){var ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},pe=ve.refKey,Oe=pe===void 0?"ref":pe,tt=ve.role,Tt=ve.onKeyDown,Cn=ve.onFocus,gn=ve.onBlur,$n=ve.onClick,Wn=ve.onDragEnter,Un=ve.onDragOver,Dn=ve.onDragLeave,Zn=ve.onDrop,Nn=Mp(ve,Ate);return An(An(Gx({onKeyDown:Ee(po(Tt,it)),onFocus:Ee(po(Cn,wt)),onBlur:Ee(po(gn,pt)),onClick:_e(po($n,It)),onDragEnter:Le(po(Wn,Pe)),onDragOver:Le(po(Un,rt)),onDragLeave:Le(po(Dn,Ce)),onDrop:Le(po(Zn,lt)),role:typeof tt=="string"&&tt!==""?tt:"presentation"},Oe,$),!r&&!k?{tabIndex:0}:{}),Nn)}},[$,it,wt,pt,It,Pe,rt,Ce,lt,k,L,r]),et=v.useCallback(function(ve){ve.stopPropagation()},[]),at=v.useMemo(function(){return function(){var ve=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},pe=ve.refKey,Oe=pe===void 0?"ref":pe,tt=ve.onChange,Tt=ve.onClick,Cn=Mp(ve,kte),gn=Gx({accept:B,multiple:d,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:_e(po(tt,lt)),onClick:_e(po(Tt,et)),tabIndex:-1},Oe,W);return An(An({},gn),Cn)}},[W,n,d,lt,r]);return An(An({},z),{},{isFocused:X&&!r,getRootProps:ct,getInputProps:at,rootRef:$,inputRef:W,open:_e(vt)})}function Ute(e,t){switch(t.type){case"focus":return An(An({},e),{},{isFocused:!0});case"blur":return An(An({},e),{},{isFocused:!1});case"openDialog":return An(An({},Wx),{},{isFileDialogActive:!0});case"closeDialog":return An(An({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return An(An({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return An(An({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:t.isDragReject});case"reset":return An({},Wx);default:return e}}function HR(){}const[Bte,Vte]=Mr("Dropzone component was not found in tree");function BS(e){const t=n=>{const{children:r,...o}=ae(`Dropzone${$C(e)}`,{},n),s=Vte(),c=Po(r)?r:a.jsx("span",{children:r});return s[e]?v.cloneElement(c,o):null};return t.displayName=`@mantine/dropzone/${$C(e)}`,t}const Fte=BS("accept"),Hte=BS("reject"),qte=BS("idle");var Dd={root:"m_d46a4834",inner:"m_b85f7144",fullScreen:"m_96f6e9ad",dropzone:"m_7946116d"};const Gte={multiple:!0,maxSize:1/0,activateOnClick:!0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,useFsAccessApi:!0,variant:"light",rejectColor:"red"},Wte=(e,{radius:t,variant:n,acceptColor:r,rejectColor:o})=>{const s=e.variantColorResolver({color:r||e.primaryColor,theme:e,variant:n}),c=e.variantColorResolver({color:o||"red",theme:e,variant:n});return{root:{"--dropzone-radius":Ft(t),"--dropzone-accept-color":s.color,"--dropzone-accept-bg":s.background,"--dropzone-reject-color":c.color,"--dropzone-reject-bg":c.background}}},js=be((e,t)=>{const n=ae("Dropzone",Gte,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,radius:p,disabled:m,loading:g,multiple:y,maxSize:b,accept:w,children:j,onDropAny:C,onDrop:R,onReject:T,openRef:E,name:_,maxFiles:k,autoFocus:L,activateOnClick:A,activateOnDrag:N,dragEventsBubbling:U,activateOnKeyboard:B,onDragEnter:Q,onDragLeave:J,onDragOver:Z,onFileDialogCancel:$,onFileDialogOpen:W,preventDropOnDocument:M,useFsAccessApi:I,getFilesFromEvent:z,validator:F,rejectColor:X,acceptColor:O,enablePointerEvents:H,loaderProps:oe,inputProps:ue,mod:Se,attributes:ge,...Pe}=n,rt=ze({name:"Dropzone",classes:Dd,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:ge,vars:f,varsResolver:Wte}),{getRootProps:Ce,getInputProps:ht,isDragAccept:lt,isDragReject:vt,isDragActive:it,open:wt}=QP({onDrop:C,onDropAccepted:R,onDropRejected:T,disabled:m||g,accept:Array.isArray(w)?w.reduce((Ee,Le)=>({...Ee,[Le]:[]}),{}):w,multiple:y,maxSize:b,maxFiles:k,autoFocus:L,noClick:!A,noDrag:!N,noDragEventsBubbling:!U,noKeyboard:!B,onDragEnter:Q,onDragLeave:J,onDragOver:Z,onFileDialogCancel:$,onFileDialogOpen:W,preventDropOnDocument:M,useFsAccessApi:I,validator:F,...z?{getFilesFromEvent:z}:null});fd(E,wt);const pt=it&&lt,It=it&&vt,_e=!pt&&!It;return a.jsx(Bte,{value:{accept:pt,reject:It,idle:_e},children:a.jsxs(de,{...Ce(),...rt("root",{focusable:!0}),...Pe,mod:[{accept:pt,reject:It,idle:_e,disabled:m,loading:g,"activate-on-click":A},Se],children:[a.jsx(im,{visible:g,overlayProps:{radius:p},unstyled:d,loaderProps:oe}),a.jsx("input",{...ht(ue),name:_}),a.jsx("div",{...rt("inner"),ref:t,"data-enable-pointer-events":H||void 0,children:j})]})})});js.classes=Dd;js.displayName="@mantine/dropzone/Dropzone";js.Accept=Fte;js.Idle=qte;js.Reject=Hte;const Qte={maxSize:1/0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,active:!0,zIndex:hi("max"),withinPortal:!0},VS=be((e,t)=>{const n=ae("DropzoneFullScreen",Qte,e),{classNames:r,className:o,style:s,styles:c,unstyled:d,vars:f,active:p,onDrop:m,onReject:g,zIndex:y,withinPortal:b,portalProps:w,attributes:j,...C}=n,R=ze({name:"DropzoneFullScreen",classes:Dd,props:n,className:o,style:s,classNames:r,styles:c,unstyled:d,attributes:j,rootSelector:"fullScreen"}),{resolvedClassNames:T,resolvedStyles:E}=vl({classNames:r,styles:c,props:n}),[_,k]=v.useState(0),[L,{open:A,close:N}]=Hc(!1),U=Q=>{Q.dataTransfer?.types.includes("Files")&&(k(J=>J+1),A())},B=()=>{k(Q=>Q-1)};return v.useEffect(()=>{_===0&&N()},[_]),v.useEffect(()=>{if(p)return document.addEventListener("dragenter",U,!1),document.addEventListener("dragleave",B,!1),()=>{document.removeEventListener("dragenter",U,!1),document.removeEventListener("dragleave",B,!1)}},[p]),a.jsx(pa,{...w,withinPortal:b,children:a.jsx(de,{ref:t,...R("fullScreen",{style:{opacity:L?1:0,pointerEvents:L?"all":"none",zIndex:y}}),children:a.jsx(js,{activateOnClick:!1,...C,classNames:T,styles:E,unstyled:d,className:Dd.dropzone,onDrop:Q=>{m?.(Q),N(),k(0)},onReject:Q=>{g?.(Q),N(),k(0)}})})})});VS.classes=Dd;VS.displayName="@mantine/dropzone/DropzoneFullScreen";js.FullScreen=VS;const Uh=js,Yte='{"resourceType": "Bundle"}';function Xy({id:e,title:t,message:n,color:r,icon:o,withCloseButton:s=!1,method:c="show",loading:d}){Di[c]({id:e,loading:d,title:t,message:n,color:r,icon:o,withCloseButton:s,autoClose:!1})}function Kte(){const e=jn(),t=Re(),[n,r]=v.useState({}),o=v.useCallback(async(d,f)=>{const p="batch-upload";Xy({id:p,title:"Batch Upload in Progress",message:"Your batch data is being uploaded. This may take a moment...",method:"show",loading:!0});try{r({});let m=JSON.parse(d);m.type!=="batch"&&m.type!=="transaction"&&(m=IA(m));const g=await t.executeBatch(m);r(y=>({...y,[f]:g})),Xy({id:p,title:"Batch Upload Successful",message:"Your batch data was successfully uploaded.",color:"green",method:"update",icon:a.jsx(zo,{size:"1rem"}),withCloseButton:!0})}catch(m){Xy({id:p,title:"Batch Upload Failed",color:"red",message:Ge(m),method:"update",icon:a.jsx(dl,{size:"1rem"}),withCloseButton:!0})}},[t]),s=v.useCallback(async d=>{for(const f of d){const p=new FileReader;p.onload=m=>o(m.target?.result,f.name),p.readAsText(f)}},[o]),c=v.useCallback(async d=>{await o(d.input,"JSON Data")},[o]);return a.jsxs(dt,{children:[a.jsx(Ie,{children:"Batch Create"}),a.jsxs(Te,{children:["Use this page to create, read, or update multiple resources. For more details, see"," ",a.jsx(Mt,{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(Pt,{defaultValue:"upload",children:[a.jsxs(Pt.List,{children:[a.jsx(Pt.Tab,{value:"upload",children:"File Upload"}),a.jsx(Pt.Tab,{value:"json",children:"JSON"})]}),a.jsx(Pt.Panel,{value:"upload",pt:"xs",children:a.jsx(Uh,{onDrop:s,accept:["application/json"],children:a.jsxs(xe,{justify:"center",gap:"xl",style:{minHeight:220,pointerEvents:"none"},children:[a.jsx(Uh.Accept,{children:a.jsx(_T,{size:50,stroke:1.5,color:e.colors[e.primaryColor][5]})}),a.jsx(Uh.Reject,{children:a.jsx(dl,{size:50,stroke:1.5,color:e.colors.red[5]})}),a.jsx(Uh.Idle,{children:a.jsx(_T,{size:50,stroke:1.5})}),a.jsxs("div",{children:[a.jsx(Te,{size:"xl",inline:!0,children:"Drag files here or click to select files"}),a.jsx(Te,{size:"sm",color:"dimmed",inline:!0,mt:7,children:"Attach as many files as you like"})]})]})})}),a.jsx(Pt.Panel,{value:"json",pt:"xs",children:a.jsxs(mt,{onSubmit:c,children:[a.jsx(Xc,{"data-testid":"batch-input",name:"input",autosize:!0,minRows:20,defaultValue:Yte,deserialize:JSON.parse}),a.jsx(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Ae,{type:"submit",children:"Submit"})})]})})]})]}),Object.keys(n).length>0&&a.jsxs(a.Fragment,{children:[a.jsx("h3",{children:"Output"}),a.jsxs(Pt,{defaultValue:Object.keys(n)[0],children:[a.jsx(Pt.List,{children:Object.keys(n).map(d=>a.jsx(Pt.Tab,{value:d,children:d},d))}),Object.keys(n).map(d=>a.jsx(Pt.Panel,{value:d,children:a.jsx("pre",{style:{border:"1px solid #888"},children:JSON.stringify(n[d],void 0,2)})},d))]}),a.jsx(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Ae,{onClick:()=>r({}),children:"Start over"})})]})]})}function Xte(){const{resourceType:e}=Ht(),n=(Object.fromEntries(new URLSearchParams(location.search).entries()).ids||"").split(",").filter(o=>!!o),[r]=Bc("Questionnaire",`subject-type=${e}`);return r?r.length===0?a.jsxs(dt,{children:[a.jsxs(Ie,{children:["No apps for ",e]}),a.jsx(St,{to:`/${e}`,children:"Return to search page"})]}):a.jsx(dt,{children:a.jsx("div",{children:r.map(o=>a.jsxs("div",{children:[a.jsx("h3",{children:a.jsx(St,{to:`/forms/${o.id}?subject=`+n.map(s=>`${e}/${s}`).join(","),children:o.name})}),a.jsx("p",{children:o.description})]},o.id))})}):a.jsx(Pi,{})}function Jte(){const e=Re(),[t,n]=v.useState(),[r,o]=v.useState(!1);return a.jsx(dt,{width:450,children:a.jsxs(mt,{onSubmit:s=>{n(void 0),e.post("auth/changepassword",s).then(()=>o(!0)).catch(c=>n(Yt(c)))},children:[a.jsxs(dr,{style:{flexDirection:"column"},children:[a.jsx(zi,{size:32}),a.jsx(Ie,{children:"Change password"})]}),!r&&a.jsxs(Ue,{gap:"xl",mt:"xl",children:[a.jsx(Xi,{name:"oldPassword",label:"Old password",required:!0,autoFocus:!0,error:Lt(t,"oldPassword")}),a.jsx(Xi,{name:"newPassword",label:"New password",required:!0,error:Lt(t,"newPassword")}),a.jsx(Xi,{name:"confirmPassword",label:"Confirm new password",required:!0,error:Lt(t,"confirmPassword")}),a.jsx(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Ae,{type:"submit",children:"Change password"})})]}),r&&a.jsx("div",{"data-testid":"success",children:"Password changed successfully"})]})})}const Qx=["Form","JSON","Profiles"],Zte=["Profiles"],Jy=Qx[0].toLowerCase();function ene(){const e=_n(),t=jn(),{resourceType:n}=Ht(),[r,o]=v.useState(()=>{const c=window.location.pathname.split("/").pop();return c&&Qx.map(d=>d.toLowerCase()).includes(c)?c:Jy});function s(c){c||(c=Jy),o(c),e(`/${n}/new/${c}`)?.catch(console.error)}return a.jsxs(a.Fragment,{children:[a.jsxs(Pr,{children:[a.jsxs(Te,{p:"md",fw:500,children:["New ",n]}),a.jsx(pi,{children:a.jsx(Pt,{defaultValue:Jy,value:r,onChange:s,children:a.jsx(Pt.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:Qx.map(c=>a.jsx(Pt.Tab,{value:c.toLowerCase(),px:"md",children:Zte.includes(c)?a.jsxs(xe,{gap:"xs",wrap:"nowrap",children:[c,a.jsx(rm,{color:t.primaryColor,size:"sm",children:"Beta"})]}):c},c))})})})]}),a.jsx(OS,{})]})}function tne(){return a.jsx(dt,{children:a.jsxs(Ue,{children:[a.jsx(Ie,{order:1,children:"Unexpected Error"}),a.jsx(Te,{children:"We're sorry, something went wrong."}),a.jsxs(Te,{children:["Please contact ",a.jsx(Mt,{href:"mailto:support@medplum.com",children:"support"})," for assistance."]})]})})}function YP(e){const t=Kt(e.resource);if(!t)return null;const n=[{key:"Type",value:a.jsx(St,{to:`/${t.resourceType}`,children:t.resourceType})}];function r(c,d){c&&d&&n.push({key:c,value:d})}function o(c){c&&r(c.system,c.value)}function s(c,d){Array.isArray(d)?d.forEach(f=>s(c,f)):typeof d=="string"?r(c,d):d&&(Array.isArray(d.coding)?r(c,d.coding.map(f=>f.display||f.code).join(", ")):r(c,d.text))}if("name"in t){const c=ya(t);c!==Ot(t)&&r("Name",c)}return"category"in t&&s("Category",t.category),t.resourceType!=="Bot"&&"code"in t&&s("Code",t.code),"identifier"in t&&(Array.isArray(t.identifier)?t.identifier.forEach(o):o(t.identifier)),n.length===1&&n.push({key:"ID",value:t.id}),a.jsx(yt,{children:n.map((c,d)=>a.jsxs(yt.Entry,{children:[a.jsx(yt.Key,{children:c.key}),a.jsx(yt.Value,{children:c.value})]},`${c.key}-${d}`))})}function nne(){const{id:e}=Ht(),t=Jr(),r=Object.fromEntries(new URLSearchParams(t.search).entries()).subject,o=Re(),[s,c]=v.useState(!0),[d,f]=v.useState(),[p,m]=v.useState(),[g,y]=v.useState(),[b,w]=v.useState(),[j,C]=v.useState();if(v.useEffect(()=>{const E={resourceType:"Bundle",type:"batch",entry:[{request:{method:"GET",url:`Questionnaire/${e}`}}]};if(r){const _=r.split(",").filter(k=>!!k);_.length===1&&E.entry.push({request:{method:"GET",url:_[0]}}),m(_)}o.executeBatch(E).then(_=>{_.entry?.[0]?.response?.status!=="200"?w(_.entry?.[0]?.response?.outcome):(f(_.entry[0]?.resource),y(_.entry[1]?.resource)),c(!1)}).catch(_=>{w(_),c(!1)})},[o,e,r]),b)return a.jsx(dt,{children:a.jsx("pre",{"data-testid":"error",children:JSON.stringify(b,void 0,2)})});if(j)return a.jsxs(dt,{children:[a.jsx(Ie,{children:d?.title}),a.jsx("p",{children:"Your response has been recorded."}),a.jsxs("ul",{children:[j.length===1&&a.jsx("li",{children:a.jsx(St,{to:j[0],children:"Review your answers"})}),j.length>1&&a.jsxs("li",{children:["Review your answers:",a.jsx("ul",{children:j.map(E=>a.jsx("li",{children:a.jsx(St,{to:E,children:Ot(E)})},E.id))})]}),g&&a.jsx("li",{children:a.jsxs(St,{to:g,children:["Back to ",ya(g)]})}),a.jsx("li",{children:a.jsx(St,{to:"/",children:"Go back home"})})]})]});if(s||!d)return a.jsx(Pi,{});const R=g&&zS(g);return a.jsxs(a.Fragment,{children:[a.jsxs(Pr,{shadow:"xs",radius:0,children:[R&&a.jsx(Kk,{patient:R}),g&&g.resourceType!=="Patient"&&a.jsx(YP,{resource:g}),a.jsx(de,{px:"xl",py:"md",children:a.jsxs(Te,{children:[ya(d),p&&p.length>1&&a.jsxs(a.Fragment,{children:[" (for ",p.length," resources)"]})]})})]}),a.jsx(dt,{children:a.jsx(aP,{questionnaire:d,subject:g&&Wt(g),onSubmit:T})})]});async function T(E){const _=[];if(!p||p.length===0)_.push(await o.createResource(E));else for(const k of p)_.push(await o.createResource({...E,subject:{reference:k}}));C(_)}}const rne="_paper_unw9o_1",ine={paper:rne},one={Bot:"/admin/bots/new",ClientApplication:"/admin/clients/new"};function KP(e,t){const n=e.resourceType||ane(t),r=e.fields??sne(n),o=e.filters??(e.resourceType?void 0:lne(n)),s=e.sortRules??cne(n),c=e.offset??0,d=e.count??_m;return{...e,resourceType:n,fields:r,filters:o,sortRules:s,offset:c,count:d}}function ane(e){return localStorage.getItem("defaultResourceType")??e?.option?.find(t=>t.id==="defaultResourceType")?.valueString??"Patient"}function sne(e){const t=FS(e);if(t?.fields)return t.fields;const n=["id","_lastUpdated"];switch(e){case"Patient":n.push("name","birthDate","gender");break;case"AsyncJob":n.push("status","dataVersion");break;case"AccessPolicy":case"Bot":case"ClientApplication":case"Practitioner":case"Project":case"Organization":case"Questionnaire":case"UserConfiguration":n.push("name");break;case"CodeSystem":case"ValueSet":n.push("name","title","status");break;case"Condition":n.push("subject","code","clinicalStatus");break;case"Device":n.push("manufacturer","deviceName","patient");break;case"DeviceDefinition":n.push("manufacturer[x]","deviceName");break;case"DeviceRequest":n.push("code[x]","subject");break;case"DiagnosticReport":case"Observation":n.push("subject","code","status");break;case"Encounter":n.push("subject");break;case"ServiceRequest":n.push("subject","code","status","orderDetail");break;case"Subscription":n.push("criteria");break;case"User":n.push("email");break}return n}function lne(e){return FS(e)?.filters}function cne(e){const t=FS(e);return t?.sortRules?t.sortRules:[{code:"_lastUpdated",descending:!0}]}function FS(e){const t=localStorage.getItem(e+"-defaultSearch");return t?JSON.parse(t):void 0}function une(e){localStorage.setItem("defaultResourceType",e.resourceType),localStorage.setItem(e.resourceType+"-defaultSearch",JSON.stringify(e))}async function dne(e,t){const n={...e,count:1e3,offset:0},r=KP(n,t.getUserConfiguration()),o=await t.search(r.resourceType,ss({...r,total:"accurate",fields:void 0}));return IA(o)}function qR(){const e=Re(),t=_n(),n=Jr(),[r,o]=v.useState();return v.useEffect(()=>{const s=PA(n.pathname+n.search),c=KP(s,e.getUserConfiguration());n.pathname===`/${c.resourceType}`&&n.search===ss(c)?(une(c),o(c)):t(`/${c.resourceType}${ss(c)}`)?.catch(console.error)},[e,t,n]),!r?.resourceType||!r.fields||r.fields.length===0?a.jsx(Pi,{}):a.jsx(Pr,{shadow:"xs",m:"md",p:"xs",className:ine.paper,children:a.jsx(ou,{checkboxesEnabled:!0,search:r,onClick:s=>t(`/${s.resource.resourceType}/${s.resource.id}`)?.catch(console.error),onAuxClick:s=>window.open(`/${s.resource.resourceType}/${s.resource.id}`,"_blank"),onChange:s=>{t(`/${r.resourceType}${ss(s.definition)}`)?.catch(console.error)},onNew:()=>{t(one[r.resourceType]??`/${r.resourceType}/new`)?.catch(console.error)},onExportCsv:()=>{const s=e.fhirUrl(r.resourceType,"$csv")+ss(r);e.download(s).then(c=>{window.open(window.URL.createObjectURL(c),"_blank")}).catch(c=>ke({color:"red",message:Ge(c),autoClose:!1}))},onExportTransactionBundle:async()=>{dne(r,e).then(s=>dk(JSON.stringify(s,void 0,2))).catch(s=>ke({color:"red",message:Ge(s),autoClose:!1}))},onDelete:s=>{window.confirm("Are you sure you want to delete these resources?")&&(e.invalidateSearches(r.resourceType),e.executeBatch({resourceType:"Bundle",type:"batch",entry:s.map(c=>({request:{method:"DELETE",url:`${r.resourceType}/${c}`}}))}).then(()=>o({...r})).catch(c=>ke({color:"red",message:Ge(c),autoClose:!1})))},onBulk:s=>{t(`/bulk/${r.resourceType}?ids=${s.join(",")}`)?.catch(console.error)}})})}function fne(){const[e]=Bc("ObservationDefinition","_count=100");return e?a.jsxs(ce,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Category"}),a.jsx("th",{children:"Code"}),a.jsx("th",{children:"Method"}),a.jsx("th",{children:"Unit"}),a.jsx("th",{children:"Precision"}),a.jsx("th",{children:"Ranges"})]})}),a.jsx("tbody",{children:e.map(t=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(Co,{value:t.category?.[0]})}),a.jsx("td",{children:a.jsx(Co,{value:t.code})}),a.jsx("td",{children:a.jsx(Co,{value:t.method})}),a.jsx("td",{children:t.quantitativeDetails?.unit?.text}),a.jsx("td",{children:t.quantitativeDetails?.decimalPrecision}),a.jsx("td",{children:a.jsx(Yx,{ranges:t.qualifiedInterval})})]},t.id))})]}):a.jsx(Pi,{})}function Yx(e){const{ranges:t}=e;if(!t)return null;const n=GR(t.map(o=>o.gender));if(n.length>1)return $c(n),a.jsx(a.Fragment,{children:n.map(o=>a.jsxs(v.Fragment,{children:[a.jsx("div",{children:a.jsx("strong",{children:qn(o)})}),a.jsx(Yx,{ranges:e.ranges?.filter(s=>s.gender===o)})]},o))});const r=GR(t.map(o=>o.age&&wd(o.age)));return r.length>1?($c(r),a.jsx(a.Fragment,{children:r.map(o=>a.jsxs(v.Fragment,{children:[a.jsx("div",{children:a.jsx("strong",{children:qn(o)})}),a.jsx(Yx,{ranges:e.ranges?.filter(s=>wd(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(fS,{value:o.range})})]})})},`range-${o.condition}`))})}function GR(e){return[...new Set(e.filter(t=>!!t))]}function hne(){const[e]=Bc("ActivityDefinition","_count=100"),[t]=Bc("ObservationDefinition","_count=100");return!e||!t?a.jsx(Pi,{}):a.jsxs(ce,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[a.jsx("thead",{children:a.jsxs("tr",{children:[a.jsx("th",{children:"Category"}),a.jsx("th",{children:"Assay"}),e.map(n=>a.jsx("th",{children:n.name},n.id))]})}),a.jsx("tbody",{children:t.map(n=>a.jsxs("tr",{children:[a.jsx("td",{children:a.jsx(Co,{value:n.category?.[0]})}),a.jsx("td",{children:a.jsx(Co,{value:n.code})}),e.map(r=>a.jsx("td",{children:r.observationResultRequirement?.find(o=>o.reference?.includes(n.id))?"✅":""},r.id))]},n.id))})]})}function pne(){const e=Re(),[t,n]=v.useState(),[r,o]=v.useState(void 0),[s,c]=v.useState(!1),d=v.useCallback(()=>{e.get("auth/mfa/status",{cache:"no-cache"}).then(m=>{n(m.enrollQrCode),o(m.enrolled)}).catch(m=>ke({color:"red",message:Ge(m),autoClose:!1}))},[e]);v.useEffect(()=>{d()},[d]);const f=v.useCallback(m=>{e.post("auth/mfa/enroll",m).then(()=>{o(!0),ke({color:"green",message:"Success"})}).catch(g=>ke({color:"red",message:Ge(g),autoClose:!1}))},[e]),p=v.useCallback(async m=>e.post("auth/mfa/disable",{token:m.token}),[e]);return r===void 0?null:r?a.jsxs(dt,{children:[a.jsx(Gn,{title:"Disable MFA",opened:s,onClose:()=>c(!1),children:a.jsx(wp,{title:"Disable MFA",buttonText:"Submit code",onSubmit:async m=>{await p(m),c(!1),o(!1),ke({id:"mfa-disabled",color:"green",title:"Success",message:"MFA disabled",icon:a.jsx(hH,{})}),d()}})}),a.jsxs(xe,{children:[a.jsx(Ie,{children:"MFA is enabled"}),a.jsx(Ae,{onClick:()=>c(!0),children:"Disable MFA"})]})]}):a.jsx(dt,{width:400,children:a.jsx(wp,{title:"Multi Factor Auth Setup",buttonText:"Enroll",qrCodeUrl:t,onSubmit:f})})}const mne={},Kx={baseUrl:"__MEDPLUM_BASE_URL__",clientId:"__MEDPLUM_CLIENT_ID__",googleClientId:"__GOOGLE_CLIENT_ID__",recaptchaSiteKey:"__RECAPTCHA_SITE_KEY__",registerEnabled:"__MEDPLUM_REGISTER_ENABLED__",awsTextractEnabled:mne?.MEDPLUM_AWS_TEXTRACT_ENABLED};function cf(){return Kx}function XP(){return JP("registerEnabled")}function gne(){return JP("awsTextractEnabled")}function JP(e){try{return Kx[e]!==!1&&Kx[e]!=="false"}catch{return!0}}function vne(){const e=_n(),[t]=IS(),n=Re(),r=t.get("scope")||"openid",[o,s]=v.useState(),[c,d]=v.useState(!0),f=t.get("client_id"),p=t.get("login");if(v.useEffect(()=>{if(!f||f==="medplum-cli")return;async function g(){try{const y=await n.get(`/auth/clientinfo/${f}`);s(y)}catch(y){ke({id:"clientinfofail",title:"Failed to retrieve client information.",color:"red",message:Ge(y),withCloseButton:!0})}finally{d(!1)}}g().catch(console.error)},[n,f]),!f)return null;function m(g){const y=new URL(t.get("redirect_uri"));for(const b of["scope","state","nonce"])t.has(b)&&y.searchParams.set(b,t.get(b));y.searchParams.set("code",g),rr.assign(y.toString())}return a.jsx(jk,{onCode:m,onForgotPassword:()=>e("/resetpassword")?.catch(console.error),onRegister:()=>e("/register")?.catch(console.error),googleClientId:cf().googleClientId,clientId:f||void 0,redirectUri:t.get("redirect_uri")||void 0,scope:r,nonce:t.get("nonce")||void 0,launch:t.get("launch")||void 0,codeChallenge:t.get("code_challenge")||void 0,codeChallengeMethod:t.get("code_challenge_method")||void 0,chooseScopes:r!=="openid",login:p||void 0,children:!c&&a.jsxs(a.Fragment,{children:[o?.logo?.url?a.jsx("img",{src:o?.logo?.url,alt:"Welcome Logo",height:60,style:{width:"auto"}}):a.jsx(zi,{size:32}),a.jsx(Ie,{children:o?.welcomeString??"Sign in to Medplum"})]})})}function yne(){const e=Re(),t=_n(),n=cf();return v.useEffect(()=>{e.getProfile()&&t("/signin?project=new")?.catch(console.error)},[e,t]),XP()?a.jsxs(KG,{type:"project",projectId:"new",onSuccess:()=>{window.location.href="/"},googleClientId:n.googleClientId,recaptchaSiteKey:n.recaptchaSiteKey,children:[a.jsx(zi,{size:32}),a.jsx(Ie,{children:"Create a new account"})]}):a.jsx(dt,{width:450,children:a.jsx(Mo,{icon:a.jsx(bs,{size:16}),title:"New projects disabled",color:"red",children:"New projects are disabled on this server."})})}function xne(){const e=_n(),t=Re(),[n,r]=v.useState(),[o,s]=v.useState(!1),c=cf().recaptchaSiteKey;return v.useEffect(()=>{Sk(c)},[c]),a.jsx(dt,{width:450,children:a.jsxs(mt,{onSubmit:async d=>{let f="";f=await wk(c),t.post("auth/resetpassword",{...d,recaptchaToken:f}).then(()=>s(!0)).catch(p=>r(Yt(p)))},children:[a.jsxs(Ue,{gap:"lg",mb:"xl",align:"center",children:[a.jsx(zi,{size:32}),a.jsx(Ie,{children:"Password Reset"})]}),a.jsxs(Ue,{gap:"xl",children:[a.jsx(jr,{issues:iu(n,void 0)}),!o&&a.jsxs(a.Fragment,{children:[a.jsx(Fe,{name:"email",type:"email",label:"Email",required:!0,autoFocus:!0,error:Lt(n,"email")}),a.jsxs(xe,{justify:"space-between",mt:"xl",wrap:"nowrap",children:[a.jsx(Mt,{component:"button",type:"button",color:"dimmed",onClick:()=>e("/register")?.catch(console.error),size:"xs",children:"Register"}),a.jsx(Ae,{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 bne(e){const t=Re(),[n,r]=v.useState(),[o,s]=v.useState();return o?a.jsxs(a.Fragment,{children:[a.jsx("p",{children:"Request group created successfully."}),a.jsxs("ul",{children:[a.jsxs("li",{children:["Go to the"," ",a.jsx(St,{to:o,suffix:"checklist",children:"Request Group"})]}),a.jsxs("li",{children:["Back to the ",a.jsx(St,{to:e.planDefinition,children:"Plan Definition"})]})]})]}):a.jsx(mt,{onSubmit:()=>{t.post(t.fhirUrl("PlanDefinition",e.planDefinition.id,"$apply"),{resourceType:"Parameters",parameter:[{name:"subject",valueString:n?.reference}]}).then(s).catch(console.log)},children:a.jsxs(Ue,{children:[a.jsxs(Ie,{children:['Start "',e.planDefinition.title,'"']}),a.jsxs(Te,{children:["Use the ",a.jsx("strong",{children:"Apply"})," operation to create a group of tasks for a workflow."]}),a.jsx(Te,{children:"The following tasks will be created:"}),a.jsx("ul",{children:e.planDefinition.action?.map((c,d)=>a.jsxs("li",{children:[c.definitionCanonical?.startsWith("Questionnaire/")&&"Questionnaire request: ",c.title&&a.jsx(a.Fragment,{children:c.title}),c.code&&a.jsx(Co,{value:c.code[0]})]},`action-${d}`))}),a.jsx(zt,{title:"Subject",children:a.jsx(cs,{name:"subject",targetTypes:["Patient","Practitioner"],defaultValue:n,onChange:r})}),a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(Ae,{type:"submit",children:"Go"})})]})})}function Sne(){const{resourceType:e,id:t}=Ht(),n=Kt({reference:e+"/"+t});return n?a.jsx(dt,{children:a.jsx(bne,{planDefinition:n})}):null}function wne(){const{resourceType:e,id:t}=Ht(),n=Kt({reference:e+"/"+t}),[r,o]=Bc("Questionnaire","subject-type="+e),[s,c]=Bc("ClientApplication",{_count:1e3});if(!n||o||c)return a.jsx(Pi,{});const d=s?.filter(m=>jne(e)&&!!m.launchUri);if((!r||r.length===0)&&(!d||d.length===0))return a.jsxs(dt,{children:[a.jsx(Ie,{children:"Apps"}),a.jsxs("p",{children:["No apps found. Contact your administrator or ",a.jsx("a",{href:"mailto:support@medplum.com",children:"Medplum Support"})," to add automation here."]})]});let f,p;return n.resourceType==="Patient"?f=Wt(n):n.resourceType==="Encounter"&&(f=n.subject,p=Wt(n)),a.jsxs(dt,{children:[r?.map(m=>a.jsxs("div",{children:[a.jsx(Ie,{order:3,children:a.jsx(St,{to:`/forms/${m.id}?subject=${Ot(n)}`,children:m.title||m.name})}),a.jsx(Te,{children:m.description})]},m.id)),d?.map(m=>a.jsxs("div",{children:[a.jsx(Ie,{order:3,children:a.jsx(GX,{client:m,patient:f,encounter:p,children:m.name})}),a.jsx(Te,{children:m.description})]},m.id))]})}function jne(e){return e==="Patient"||e==="Encounter"}function Cne(){const{resourceType:e,id:t}=Ht(),n=_n(),[r,o]=v.useState({resourceType:"AuditEvent",filters:[{code:"entity",operator:he.EQUALS,value:`${e}/${t}`}],fields:["id","outcome","outcomeDesc","_lastUpdated"],sortRules:[{code:"-_lastUpdated"}],count:20});return a.jsx(dt,{children:a.jsx(ou,{search:r,onClick:s=>n(`/${s.resource.resourceType}/${s.resource.id}`)?.catch(console.error),onChange:s=>o(s.definition),hideFilters:!0})})}function Ene(){const e=Re(),{resourceType:t,id:n}=Ht(),r=e.readHistory(t,n).read();return a.jsx($d,{maw:1200,children:a.jsx(Cl,{children:a.jsx(MX,{history:r})})})}const Tne="_hl7Input_k5xm3_1",Rne={hl7Input:Tne};function _ne(e){return a.jsx("iframe",{title:"Bot Runner",frameBorder:"0",src:"https://codeeditor.medplum.com/bot-runner.html",className:e.className,ref:e.iframeRef,"data-testid":e.testId,style:{width:"100%",height:"100%",minHeight:e.minHeight}})}function Dne(e){const t=e.defaultValue,n=new URL(`https://codeeditor.medplum.com/${e.language}-editor.html`);return e.module&&n.searchParams.set("module",e.module),a.jsx("iframe",{title:"Code Editor",frameBorder:"0",src:n.toString(),style:{width:"100%",height:"100%",minHeight:e.minHeight},ref:e.iframeRef,"data-testid":e.testId,onLoad:r=>{cd(r.currentTarget,{command:"setValue",value:t}).catch(console.error)}})}const Ane=`{
190
- "resourceType": "Patient",
191
- "name": [
192
- {
193
- "given": [
194
- "Alice"
195
- ],
196
- "family": "Smith"
197
- }
198
- ]
199
- }`,kne="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 Pne(){const e=Re(),{id:t}=Ht(),[n,r]=v.useState(),[o,s]=v.useState(),[c,d]=v.useState(),[f,p]=v.useState(Ane),[m,g]=v.useState(kne),[y,b]=v.useState(on.FHIR_JSON),w=v.useRef(null),j=v.useRef(null),[C,R]=v.useState(!1);v.useEffect(()=>{e.readResource("Bot",t).then(async N=>{r(N),s(N.runtimeVersion==="vmcontext"?"commonjs":"esnext"),d(await Nne(e,N))}).catch(N=>ke({color:"red",message:Ge(N),autoClose:!1}))},[e,t]);const T=v.useCallback(async()=>cd(w.current,{command:"getValue"}),[]),E=v.useCallback(async()=>cd(w.current,{command:"getOutput"}),[]),_=v.useCallback(async()=>y===on.FHIR_JSON?JSON.parse(f):m,[y,f,m]),k=v.useCallback(async N=>{N.preventDefault(),N.stopPropagation(),R(!0);try{const U=await T(),B=await E(),Q=await e.createAttachment({data:U,filename:"index.ts",contentType:on.TYPESCRIPT}),J=await e.createAttachment({data:B,filename:o==="commonjs"?"index.cjs":"index.mjs",contentType:on.JAVASCRIPT}),Z=[{op:"add",path:"/sourceCode",value:Q},{op:"add",path:"/executableCode",value:J}];await e.patchResource("Bot",t,Z),ke({color:"green",message:"Saved"})}catch(U){ke({color:"red",message:Ge(U),autoClose:!1})}finally{R(!1)}},[e,t,o,T,E]),L=v.useCallback(async N=>{N.preventDefault(),N.stopPropagation(),R(!0);try{await e.post(e.fhirUrl("Bot",t,"$deploy")),ke({color:"green",message:"Deployed"})}catch(U){ke({color:"red",message:Ge(U),autoClose:!1})}finally{R(!1)}},[e,t]),A=v.useCallback(async N=>{N.preventDefault(),N.stopPropagation(),R(!0);try{const U=await _(),B=await e.post(e.fhirUrl("Bot",t,"$execute"),U,y);await cd(j.current,{command:"setValue",value:B}),ke({color:"green",message:"Success"})}catch(U){ke({color:"red",message:Ge(U),autoClose:!1})}finally{R(!1)}},[e,t,_,y]);return!n||c===void 0?null:a.jsxs(br,{m:0,gutter:0,style:{overflow:"hidden"},children:[a.jsx(br.Col,{span:8,children:a.jsxs(Pr,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",mih:400,children:[a.jsx(Dne,{iframeRef:w,language:"typescript",module:o,testId:"code-frame",defaultValue:c,minHeight:"528px"}),a.jsxs(xe,{justify:"flex-end",gap:"xs",children:[a.jsx(Ae,{type:"button",onClick:k,loading:C,leftSection:a.jsx(EH,{size:"1rem"}),children:"Save"}),a.jsx(Ae,{type:"button",onClick:L,loading:C,leftSection:a.jsx(nS,{size:"1rem"}),children:"Deploy"}),a.jsx(Ae,{type:"button",onClick:A,loading:C,leftSection:a.jsx(fq,{size:"1rem"}),children:"Execute"})]})]})}),a.jsxs(br.Col,{span:4,children:[a.jsxs(Pr,{m:2,pb:"xs",pr:"xs",pt:"xs",shadow:"md",children:[a.jsx(un,{data:[{label:"FHIR",value:on.FHIR_JSON},{label:"HL7",value:on.HL7_V2}],onChange:N=>b(N.currentTarget.value)}),y===on.FHIR_JSON?a.jsx(Xc,{value:f,onChange:N=>p(N),autosize:!0,minRows:15}):a.jsx("textarea",{className:Rne.hl7Input,value:m,onChange:N=>g(N.currentTarget.value),rows:15})]}),a.jsx(Pr,{m:2,p:"xs",shadow:"md",children:a.jsx(_ne,{iframeRef:j,className:"medplum-bot-output-frame",testId:"output-frame",minHeight:"200px"})})]})]})}async function Nne(e,t){if(t.sourceCode?.url){const n=t.sourceCode.url?.split("/")?.find(yA);return(await e.download(e.fhirUrl("Binary",n))).text()}return t.code??""}function _l(e){let t=e.meta;return t&&(t={...t,lastUpdated:void 0,versionId:void 0,author:void 0}),{...e,meta:t}}function One(){const e=Re(),{resourceType:t,id:n}=Ht(),r={reference:t+"/"+n},o=v.useCallback(s=>{e.updateResource(_l(s)).then(()=>{ke({color:"green",message:"Success"})}).catch(c=>{ke({color:"red",message:Ge(c),autoClose:!1})})},[e]);switch(t){case"PlanDefinition":return a.jsx(dt,{children:a.jsx(mK,{value:r,onSubmit:o})});case"Questionnaire":return a.jsx(dt,{children:a.jsx(FK,{questionnaire:r,onSubmit:o})});default:return null}}function Mne(){const{resourceType:e,id:t}=Ht(),n=Kt({reference:e+"/"+t}),r=_n();return n?a.jsx(dt,{children:a.jsx(vX,{value:n,onStart:(o,s)=>r(`/forms/${sl(s)}`)?.catch(console.error),onEdit:(o,s,c)=>r(`/${c.reference}}`)?.catch(console.error)})}):null}function Lne(){const e=Re(),{resourceType:t,id:n}=Ht(),r=_n();return a.jsxs(dt,{children:[a.jsxs("p",{children:["Are you sure you want to delete this ",t,"?"]}),a.jsx(Ae,{color:"red",onClick:()=>{e.deleteResource(t,n).then(()=>r(`/${t}`)?.catch(console.error)).catch(o=>ke({color:"red",message:Ge(o),autoClose:!1}))},children:"Delete"})]})}const Ine="_selectProfileBtn_tbaz6_1",zne="_chevron_tbaz6_13",WR={selectProfileBtn:Ine,chevron:zne};function $ne(){const{resourceType:e,id:t}=Ht(),n=Kt({reference:e+"/"+t}),[r,o]=v.useState(),s=bl({onDropdownClose:()=>s.resetSelectedOption()}),c=v.useMemo(()=>{if(Pn(n?.meta?.profile))return[a.jsx(Ye.Option,{value:"",children:"None"},""),...n.meta.profile.map(f=>a.jsx(Ye.Option,{value:f,children:f},f))]},[n?.meta?.profile]);if(v.useEffect(()=>{n?.meta?.profile?.length===1&&o(n.meta.profile[0])},[n?.meta?.profile]),!n)return null;let d;return Pn(c)&&(d=a.jsx(xe,{justify:"flex-end",children:a.jsxs(Ue,{align:"flex-end",gap:"xs",children:[a.jsxs(Ye,{store:s,width:250,position:"bottom-end",withinPortal:!1,onOptionSubmit:f=>{o(f),s.closeDropdown()},children:[a.jsx(Ye.Target,{children:a.jsx(ar,{onClick:()=>s.toggleDropdown(),children:a.jsxs(zd,{fw:"bold",fs:"sm",className:WR.selectProfileBtn,children:[a.jsx("span",{children:"Pick profile"}),a.jsx(tS,{stroke:1.5,className:WR.chevron})]})})}),a.jsx(Ye.Dropdown,{w:"max-content",children:a.jsx(Ye.Options,{children:c})})]}),a.jsx(de,{children:r?a.jsxs(a.Fragment,{children:[a.jsx(Te,{span:!0,size:"sm",c:"dimmed",children:"Displaying profile: "}),a.jsx(Te,{span:!0,size:"sm",children:r||"Nothing selected"})]}):a.jsx(Te,{span:!0,size:"sm",c:"dimmed",children:"No profile displayed"})})]})})),a.jsx(dt,{children:a.jsxs(Ue,{gap:"xl",children:[d,a.jsx(xS,{value:n,profileUrl:r})]})})}function Une(){const e=Re(),{resourceType:t,id:n}=Ht(),[r,o]=v.useState(),[s,c]=v.useState(),d=_n(),[f,p]=v.useState();v.useEffect(()=>{e.readResource(t,n).then(b=>{o(fi(b)),c(fi(b))}).catch(b=>{p(Yt(b)),ke({color:"red",message:Ge(b),autoClose:!1})})},[e,t,n]);const m=v.useCallback(b=>{p(void 0),e.updateResource(_l(b)).then(()=>{d(`/${t}/${n}/details`)?.catch(console.error),ke({id:"succes",color:"green",message:"Success"})}).catch(w=>{p(Yt(w)),ke({color:"red",message:Ge(w),autoClose:!1})})},[e,t,n,d]),g=v.useCallback(b=>{p(void 0);const w=Uk.createPatch(r,b);e.patchResource(t,n,w).then(()=>{d(`/${t}/${n}/details`)?.catch(console.error),ke({id:"succes",color:"green",message:"Success"})}).catch(j=>{p(Yt(j)),ke({color:"red",message:Ge(j),autoClose:!1})})},[e,t,n,r,d]),y=v.useCallback(()=>d(`/${t}/${n}/delete`)?.catch(console.error),[d,t,n]);return s?a.jsx(dt,{children:a.jsx(Dp,{defaultValue:s,onSubmit:m,onPatch:g,onDelete:y,outcome:f})}):null}function Bne(){const{resourceType:e,id:t}=Ht(),n=Kt({reference:e+"/"+t});return n?a.jsx(dt,{maw:700,children:n.resourceType==="Patient"?a.jsx(cK,{patient:n}):a.jsx(Mo,{icon:a.jsx(bs,{size:16}),title:"Unsupported export type",color:"red",children:"This page is only supported for Patient resources"})}):null}function ZP({resource:e,currentProfile:t,onChange:n}){const r=e.resourceType,o=Re(),[s,c]=v.useState();return v.useEffect(()=>{o.searchResources("StructureDefinition",{type:r,derivation:"constraint",_count:50}).then(d=>{c(d.filter(kW))}).catch(console.error)},[o,n,r]),a.jsx(Pt,{value:t?.url,onChange:d=>{const f=s?.find(p=>p.url===d);f&&n(f)},children:a.jsx(Pt.List,{children:s?.map(d=>{const f=e.meta?.profile?.includes(d.url),p=f?"This profile is present in this resource's meta.profile property.":"This profile is not included in this resource's meta.profile property.";return a.jsx(Pt.Tab,{value:d.url,title:p,rightSection:f&&a.jsx(k0,{variant:"outline",color:"green",size:"xs",style:{borderStyle:"none"},children:a.jsx(Hq,{size:"90%"})}),children:d.title||d.name},d.url)})})})}function eN(e,t){const n=Re(),r=_n();return{defaultValue:{resourceType:e},handleSubmit:c=>{t&&t(void 0),n.createResource(c).then(d=>r("/"+d.resourceType+"/"+d.id)).catch(d=>{t&&t(Yt(d)),ke({color:"red",message:Ge(d),autoClose:!1,styles:{description:{whiteSpace:"pre-line"}}})})}}}function Zy(){const{resourceType:e}=Ht(),t=Jr(),[n,r]=v.useState(),{defaultValue:o,handleSubmit:s}=eN(e,r),[c,d]=v.useState(),f=t.pathname.toLowerCase().endsWith("profiles"),p=v.useCallback(m=>{const g=_l(m);c&&jA(g,c.url),s(g)},[c,s]);return f?a.jsx(dt,{children:a.jsxs(Ue,{children:[a.jsx(ZP,{resource:o,currentProfile:c,onChange:d}),c?a.jsx(Dp,{defaultValue:o,onSubmit:p,outcome:n,profileUrl:c.url},c.url):a.jsx(Te,{my:"lg",fz:"lg",fs:"italic",ta:"center",children:"Select a profile above"})]})}):a.jsx(dt,{children:a.jsx(Dp,{defaultValue:o,onSubmit:s,outcome:n})})}function QR(){const e=Re(),{resourceType:t,id:n}=Ht(),r=e.readHistory(t,n).read();return a.jsx(dt,{children:a.jsx(VX,{history:r})})}function Vne(){const{resourceType:e}=Ht(),[t,n]=v.useState(),{defaultValue:r,handleSubmit:o}=eN(e,n),s=v.useCallback(c=>{o(JSON.parse(c["new-resource"]))},[o]);return a.jsxs(dt,{children:[t&&a.jsx(jr,{outcome:t}),a.jsxs(mt,{onSubmit:s,children:[a.jsx(Xc,{name:"new-resource","data-testid":"create-resource-json",autosize:!0,minRows:24,defaultValue:no(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),a.jsx(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Ae,{type:"submit",children:"OK"})})]})]})}function Fne(){const e=Re(),{resourceType:t,id:n}=Ht(),r=Kt({reference:t+"/"+n}),o=_n(),[s,c]=v.useState(),d=v.useCallback(f=>{e.updateResource(_l(JSON.parse(f.resource))).then(()=>{c(void 0),o(`/${t}/${n}/details`)?.catch(console.error),ke({color:"green",message:"Success"})}).catch(p=>{ke({color:"red",message:Ge(p),autoClose:!1})})},[e,t,n,o]);return r?a.jsxs(dt,{children:[s&&a.jsx(jr,{outcome:s}),a.jsxs(mt,{onSubmit:d,children:[a.jsx(Xc,{name:"resource","data-testid":"resource-json",autosize:!0,minRows:24,defaultValue:no(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),a.jsx(xe,{justify:"flex-end",mt:"xl",wrap:"nowrap",children:a.jsx(Ae,{type:"submit",children:"OK"})})]})]}):null}function Hne(e){const{resourceType:t,id:n}=e;return a.jsxs(dt,{children:[a.jsxs(Mo,{icon:a.jsx(bs,{size:16}),mb:"xl",children:["This is just a preview! Access your form here:",a.jsx("br",{}),a.jsx(Mt,{href:`/forms/${n}`,children:`/forms/${n}`})]}),a.jsx(aP,{questionnaire:{reference:t+"/"+n},onSubmit:()=>alert("You submitted the preview")})]})}const qne="_propertyTable_1xts4_1",Gne="_propertiesTitle_1xts4_17",tN={propertyTable:qne,propertiesTitle:Gne};function Wne(e){return e.valueCode||e.valueString||(e.valueBoolean===void 0?void 0:String(e.valueBoolean))||(e.valueInteger===void 0?void 0:String(e.valueInteger))||(e.valueDecimal===void 0?void 0:String(e.valueDecimal))||e.valueDate||e.valueDateTime||"N/A"}function Qne(e){const{properties:t}=e,n=t.map(r=>{let o="",s="",c="";return r.part?.forEach(d=>{d.name==="code"?o=d.valueCode||"":d.name==="description"?s=d.valueString||"":d.name==="value"&&(c=Wne(d))}),{code:o,description:s,value:c}});return a.jsxs(ce,{className:tN.propertyTable,children:[a.jsx(ce.Thead,{children:a.jsxs(ce.Tr,{children:[a.jsx(ce.Th,{children:"Code"}),a.jsx(ce.Th,{children:"Description"}),a.jsx(ce.Th,{children:"Value"})]})}),a.jsx(ce.Tbody,{children:n.map((r,o)=>a.jsxs(ce.Tr,{children:[a.jsx(ce.Td,{children:r.code}),a.jsx(ce.Td,{children:r.description}),a.jsx(ce.Td,{children:r.value})]},`property-${o}`))})]})}function Yne(e){const{valueSet:t}=e,n=Re(),r=t.url,[o,s]=v.useState(),[c,d]=v.useState(),[f,p]=v.useState(!1),[m,g]=v.useState(),y=v.useCallback(async j=>{if(s(j),d(void 0),g(void 0),!j?.code||!j?.system){p(!1);return}p(!0);try{const C=new URLSearchParams({system:j.system,code:j.code}),R=n.fhirUrl("CodeSystem","$lookup")+"?"+C.toString(),T=await n.get(R);d(T)}catch(C){g(C instanceof Error?C:new Error(String(C)))}finally{p(!1)}},[n]),b=v.useMemo(()=>c?.parameter?.filter(j=>j.name==="property"&&j.part)??[],[c]),w=b.length>0;return a.jsx(dt,{children:a.jsxs(Ue,{gap:"xl",children:[a.jsx(Zd,{binding:r,placeholder:"Select a value from the ValueSet",onChange:j=>y(j[0]),defaultValue:o,maxValues:1}),o?a.jsxs(Ue,{gap:"md",children:[a.jsxs(tf,{children:[a.jsx(Nr,{term:"Code",children:o.code}),o.system&&a.jsx(Nr,{term:"System",children:o.system}),o.display&&a.jsx(Nr,{term:"Display",children:o.display})]}),f&&a.jsxs(xe,{gap:"xs",children:[a.jsx(Or,{size:"sm"}),a.jsx(Te,{size:"sm",c:"dimmed",children:"Loading properties..."})]}),!f&&m&&a.jsxs(Mo,{icon:a.jsx(bs,{size:16}),title:"Lookup Failed",color:"red",children:["Failed to retrieve code information: ",Ge(m)]}),!f&&!m&&w&&a.jsx(aS,{children:a.jsxs(Ue,{gap:"xs",mt:"lg",children:[a.jsx(Te,{fw:500,size:"sm",c:"dimmed",className:tN.propertiesTitle,children:"Properties"}),a.jsx(Qne,{properties:b})]})})]}):null]})})}function Kne(){const{resourceType:e,id:t}=Ht(),n=Kt({reference:e+"/"+t});return n?n.resourceType==="Questionnaire"?a.jsx(Hne,{resourceType:e,id:t}):n.resourceType==="ValueSet"?a.jsx(Yne,{valueSet:n}):null:null}function Xne(){const e=Re(),{resourceType:t,id:n}=Ht(),[r,o]=v.useState(),[s,c]=v.useState();return v.useEffect(()=>{e.readResource(t,n).then(d=>o(fi(d))).catch(d=>{ke({color:"red",message:Ge(d)})})},[e,t,n]),r?a.jsxs(dt,{children:[a.jsxs(Ie,{order:2,children:["Available ",t," profiles"]}),a.jsx(Ue,{children:a.jsxs(a.Fragment,{children:[a.jsx(ZP,{resource:r,currentProfile:s,onChange:c}),s?a.jsx(Jne,{profile:s,resource:r,onResourceUpdated:d=>o(d)},s.url):a.jsx(Te,{my:"lg",fz:"lg",fs:"italic",ta:"center",children:"Select a profile above"})]})})]}):null}const Jne=({profile:e,resource:t,onResourceUpdated:n})=>{const r=Re(),[o,s]=v.useState(),[c,d]=v.useState(()=>t.meta?.profile?.includes(e.url)),f=v.useCallback(p=>{s(void 0);const m=_l(p);c?jA(m,e.url):EU(m,e.url),r.updateResource(m).then(g=>{n(g),ke({color:"green",message:"Success"})}).catch(g=>{s(Yt(g)),ke({color:"red",message:Ge(g),autoClose:!1})})},[r,e.url,n,c]);return a.jsxs(Ue,{children:[a.jsx(Hd,{size:"md",checked:c,label:`Conform resource to ${e.title}`,onChange:p=>d(p.currentTarget.checked),"data-testid":"profile-toggle"}),c?a.jsx(Dp,{profileUrl:e.url,defaultValue:t,onSubmit:f,outcome:o}):a.jsx("form",{noValidate:!0,onSubmit:p=>{p.preventDefault(),f(t)},children:a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(Ae,{type:"submit",children:"OK"})})})]})},nN={"Create Only":"create","Update Only":"update","Delete Only":"delete","All Interactions":void 0},Zne=Object.keys(nN);function ere(){const e=Re(),{id:t}=Ht(),n=Kt({reference:`Questionnaire/${t}`}),[r,o]=v.useState(),[s,c]=v.useState("create"),[d,f]=v.useState(0),p=e.searchResources("Subscription","status=active&_count=100").read().filter(g=>tre(g,n));function m(){r&&n&&e.createResource({resourceType:"Subscription",status:"active",reason:`Connect bot ${r.name} to questionnaire responses`,criteria:`QuestionnaireResponse?questionnaire=${n.url?`${n.url},${Ot(n)}`:Ot(n)}`,channel:{type:"rest-hook",endpoint:Ot(r)},...s?{extension:[{url:"https://medplum.com/fhir/StructureDefinition/subscription-supported-interaction",valueCode:s}]}:void 0}).then(()=>{o(void 0),f(Date.now()),e.invalidateSearches("Subscription"),ke({color:"green",message:"Success"})}).catch(g=>ke({color:"red",message:Ge(g),autoClose:!1}))}return a.jsxs(dt,{children:[a.jsx(Ie,{children:"Bots"}),a.jsxs(Ue,{children:[p.length===0&&a.jsx("p",{children:"No bots found."}),p.map(g=>a.jsxs("div",{children:[a.jsx("h3",{children:a.jsx(Tl,{value:{reference:g.channel?.endpoint},link:!0})}),a.jsxs("p",{children:["Criteria: ",g.criteria]})]},g.id))]}),a.jsx(Tn,{}),a.jsxs(Ue,{mt:10,children:[a.jsx(Pd,{size:"lg",htmlFor:"bot",children:"Connect to bot"}),a.jsxs(xe,{children:[a.jsx(El,{name:"bot",resourceType:"Bot",onChange:g=>o(g)}),a.jsx(Ae,{onClick:m,children:"Connect"})]}),a.jsx(xe,{children:a.jsx(un,{name:"subscription-trigger-event",defaultValue:"Create Only",label:"Subscription Trigger Event",data:Zne,onChange:g=>c(nN[g.target.value])})})]}),a.jsx("div",{style:{display:"none"},children:d})]})}function tre(e,t){if(!t)return!1;const n=e.criteria||"",r=e.channel?.endpoint||"";return n.startsWith("QuestionnaireResponse?")&&r.startsWith("Bot/")&&(n.includes(Ot(t))||(t.url?n.includes(t.url):!1))}function nre(){const{id:e}=Ht(),t=_n(),r=Re().readReference({reference:`Questionnaire/${e}`}).read(),[o,s]=v.useState({resourceType:"QuestionnaireResponse",filters:[{code:"questionnaire",operator:he.EQUALS,value:r.url?`${r.url},Questionnaire/${e}`:`Questionnaire/${e}`}],fields:["id","_lastUpdated"]});return a.jsx(dt,{children:a.jsx(ou,{search:o,onClick:c=>t(`/${c.resource.resourceType}/${c.resource.id}`)?.catch(console.error),onChange:c=>s(c.definition),hideFilters:!0,hideToolbar:!0})})}function rre(){const e=Re(),{resourceType:t,id:n}=Ht(),r=Kt({reference:t+"/"+n}),o=v.useCallback(s=>{e.updateResource(_l(s)).then(()=>{ke({color:"green",message:"Success"})}).catch(c=>{ke({color:"red",message:Ge(c),autoClose:!1})})},[e]);return r?a.jsx(dt,{children:a.jsx(cX,{onSubmit:o,definition:r})}):null}function ire(){const{resourceType:e,id:t}=Ht(),n=Kt({reference:e+"/"+t});return n?a.jsx(dt,{children:e==="MeasureReport"?a.jsx(sK,{measureReport:n}):a.jsx(yS,{value:n})}):null}const ore="_container_1ue98_1",are="_entry_1ue98_14",sre="_active_1ue98_21",ex={container:ore,entry:are,active:sre};function lre(e){const t=Re(),n=Kt(e.value),[r,o]=v.useState();return v.useEffect(()=>{if(!n)return;const s=zS(n);if(!s)return;const c="reference"in s?s.reference:Ot(s);t.search("ServiceRequest","subject="+c).then(d=>{const p=(d.entry??[]).map(m=>m.resource);Bk(p),p.reverse(),o(p)}).catch(d=>ke({color:"red",message:Ge(d),autoClose:!1}))},[t,n]),r?a.jsx("div",{"data-testid":"quick-service-requests",className:ex.container,children:r.map(s=>a.jsxs("div",{className:$t(ex.entry,{[ex.active]:s.id===n?.id}),children:[a.jsx("p",{children:a.jsx(St,{to:s,children:cre(s)})}),s.category?.[0]?.text&&a.jsx("p",{children:s.category[0]?.text}),s.code?.coding?.[0]?.code&&a.jsx("p",{children:s.code.coding[0]?.code}),a.jsx("p",{children:ure(s)})]},s.id))}):null}function cre(e){if(e.identifier){for(const t of e.identifier)if(t.value)return t.value}return e.id||""}function ure(e){return e.authoredOn?e.authoredOn.substring(0,10):e.meta?.lastUpdated?e.meta.lastUpdated.substring(0,10):""}const dre="_container_1l2dh_1",fre={container:dre};function hre(e){const t=Kt(e.valueSet);if(!t)return null;const n=[""],r=t.compose?.include?.[0]?.concept?.map(o=>o.code);return r&&n.push(...r),e.defaultValue&&!n.includes(e.defaultValue)&&n.push(e.defaultValue),a.jsx("div",{className:fre.container,children:a.jsx(un,{defaultValue:e.defaultValue,onChange:o=>e.onChange(o.currentTarget.value),data:n})})}function pre(e){const t=Kt(e.specimen);return t?a.jsxs(yt,{children:[a.jsxs(yt.Entry,{children:[a.jsx(yt.Key,{children:"Type"}),a.jsx(yt.Value,{children:"Specimen"})]}),a.jsxs(yt.Entry,{children:[a.jsx(yt.Key,{children:"Collected"}),a.jsx(yt.Value,{children:Sr(t.collection?.collectedDateTime)})]}),a.jsxs(yt.Entry,{children:[a.jsx(yt.Key,{children:"Specimen Age"}),a.jsx(yt.Value,{children:mre(t)})]}),t.collection?.collectedDateTime&&t.receivedTime?a.jsxs(yt.Entry,{children:[a.jsx(yt.Key,{children:"Specimen Stability"}),a.jsx(yt.Value,{children:gre(t)})]}):a.jsx(a.Fragment,{})]}):null}function mre(e){const t=e.collection?.collectedDateTime;if(!t)return;const n=new Date(t);return rN(iN(n,new Date))}function gre(e){if(!e.collection?.collectedDateTime||!e.receivedTime)return;const t=new Date(e.collection.collectedDateTime),n=new Date(e.receivedTime);return rN(iN(t,n))}function rN(e){return e.toString().padStart(3,"0")+"D"}function iN(e,t){const n=t.getTime()-e.getTime();return Math.floor(n/(1e3*3600*24))}function vre(e){const t=["Timeline"];return e==="Bot"&&t.push("Editor","Subscriptions"),e==="PlanDefinition"&&t.push("Apply","Builder"),e==="Questionnaire"&&t.push("Preview","Builder","Bots","Responses"),e==="ValueSet"&&t.push("Preview"),(e==="DiagnosticReport"||e==="MeasureReport")&&t.push("Report"),e==="RequestGroup"&&t.push("Checklist"),e==="ObservationDefinition"&&t.push("Ranges"),e==="Agent"&&t.push("Tools"),t.push("Details","Edit","Event","History","Blame","JSON","Apps","Profiles"),e==="Patient"&&t.push("Export"),t}function yre(){const e=Re(),{resourceType:t,id:n}=Ht(),r={reference:t+"/"+n},o=_n(),[s,c]=v.useState(),d=Kt(r,c),f=vre(t),[p,m]=v.useState(()=>{const T=window.location.pathname.split("/").pop();return T&&f.map(E=>E.toLowerCase()).includes(T)?T:f[0].toLowerCase()});async function g(){const E=(await e.readHistory(t,n)).entry?.find(_=>!!_.resource)?.resource;E?y(E):ke({color:"red",message:"No history to restore",autoClose:!1})}function y(T){e.updateResource(_l(T)).then(()=>{c(void 0),ke({color:"green",message:"Success"})}).catch(E=>{ke({color:"red",message:Ge(E),autoClose:!1})})}if(s)return M8(s)?a.jsxs(dt,{children:[a.jsx(Ie,{children:"Deleted"}),a.jsx("p",{children:"The resource was deleted."}),a.jsx(Ae,{color:"red",onClick:g,children:"Restore"})]}):a.jsx(jr,{outcome:s});function b(T){T||(T=f[0].toLowerCase()),m(T),o(`/${t}/${n}/${T}`)?.catch(console.error)}function w(T){const E=d,_=E.orderDetail||[];_.length===0&&_.push({}),_[0].text!==T&&(_[0].text=T,y({...E,orderDetail:_}))}const j=d&&zS(d),C=d&&mee(d),R=e.getUserConfiguration()?.option?.find(T=>T.id==="statusValueSet")?.valueString;return a.jsxs(a.Fragment,{children:[d?.resourceType==="ServiceRequest"&&R&&a.jsx(hre,{valueSet:{reference:R},defaultValue:d.orderDetail?.[0]?.text,onChange:w},Ot(d)+"-"+d.orderDetail?.[0]?.text),d&&a.jsx(lre,{value:d}),d&&a.jsxs(Pr,{children:[j&&a.jsx(Kk,{patient:j}),C&&a.jsx(pre,{specimen:C}),t!=="Patient"&&a.jsx(YP,{resource:r}),a.jsx(pi,{children:a.jsx(Pt,{value:p.toLowerCase(),onChange:b,children:a.jsx(Pt.List,{style:{whiteSpace:"nowrap",flexWrap:"nowrap"},children:f.map(T=>a.jsx(Pt.Tab,{value:T.toLowerCase(),children:T},T))})})})]}),a.jsx(OS,{})]})}function Bh(){const e=_n(),{resourceType:t,id:n,versionId:r,tab:o}=Ht(),s=Re(),[c,d]=v.useState(!0),[f,p]=v.useState(),[m,g]=v.useState();if(v.useEffect(()=>{g(void 0),d(!0),s.readHistory(t,n).then(E=>p(E)).then(()=>d(!1)).catch(E=>{g(E),d(!1)})},[s,t,n]),c)return a.jsx(Pi,{});const y=f?.entry??[],b=y.findIndex(E=>E.resource?.meta?.versionId===r);if(b===-1)return a.jsxs(dt,{children:[a.jsx(Ie,{children:"Version not found"}),a.jsx(St,{to:`/${t}/${n}`,children:"Return to resource"})]});const w=y[b].resource,j=b<y.length-1?y[b+1].resource:void 0,C="diff",R=o||C,T=y.length-b;return a.jsx($d,{maw:1200,children:a.jsx(Cl,{children:a.jsxs(Ue,{gap:"lg",children:[m&&a.jsx("pre",{"data-testid":"error",children:JSON.stringify(m,void 0,2)}),a.jsxs(wm,{cols:2,mb:"lg",children:[a.jsx(Ii,{total:y.length,value:T,getControlProps:Gk,onChange:E=>e(`/${t}/${n}/_history/${y[y.length-E]?.resource?.meta?.versionId}/${R}`)?.catch(console.error)}),a.jsx(xe,{justify:"right",children:a.jsx(Fd,{data:[{value:"diff",label:"Diff"},{value:"raw",label:"Raw"}],value:R,onChange:E=>e(`/${t}/${n}/_history/${r}/${E||C}`)?.catch(console.error)})})]}),a.jsx(de,{mb:"lg",children:a.jsxs(tf,{compact:!0,children:[a.jsx(Nr,{term:"Version ID",children:w.meta?.versionId}),a.jsx(Nr,{term:"Author",children:a.jsx(Ac,{value:w.meta?.author,link:!0},w.meta?.author?.reference)}),a.jsx(Nr,{term:"Date/Time",children:Sr(w.meta?.lastUpdated)})]})}),R==="diff"&&a.jsx(zX,{original:j??{resourceType:t,id:n},revised:w}),R==="raw"&&a.jsx("pre",{style:{fontSize:"9pt"},children:JSON.stringify(w,void 0,2)})]})})})}function xre(){const{resourceType:e,id:t}=Ht(),n=_n(),[r,o]=v.useState({resourceType:"Subscription",filters:[{code:"url",operator:he.EQUALS,value:`${e}/${t}`}],fields:["id","criteria","status","_lastUpdated"]});return a.jsx(dt,{children:a.jsx(ou,{search:r,onClick:s=>n(`/${s.resource.resourceType}/${s.resource.id}`)?.catch(console.error),onChange:s=>o(s.definition),hideFilters:!0})})}function bre(e){const t=Re(),{resource:n,opened:r,onClose:o}=e,[s,c]=v.useState(!1),[d,f]=v.useState(),[p,m]=v.useState(!1),g=v.useCallback(async()=>{if(n?.id)try{await t.post(t.fhirUrl(n.resourceType,n.id,"$resend"),{subscription:s&&d?Ot(d):void 0,verbose:p}),ke({color:"green",message:"Done"}),o()}catch(y){ke({color:"red",message:Ge(y),autoClose:!1})}},[t,n,o,s,d,p]);return a.jsx(Gn,{opened:r,onClose:o,title:"Resend Subscriptions",children:a.jsx(mt,{onSubmit:g,children:a.jsxs(Ue,{children:[a.jsx(Ln,{label:"Choose subscription (all subscriptions by default)",onChange:y=>c(y.currentTarget.checked)}),s&&a.jsx(El,{name:"subscription",resourceType:"Subscription",placeholder:"Subscription",onChange:f}),a.jsx(Ln,{label:"Verbose mode",onChange:y=>m(y.currentTarget.checked)}),a.jsx(xe,{justify:"flex-end",children:a.jsx(Ae,{type:"submit",children:"Resend"})})]})})})}function YR(){const e=Re(),t=Om(),{resourceType:n,id:r}=Ht(),o={reference:n+"/"+r},[s,c]=v.useState(),d=Hc(!1);function f(T,E){return e.updateResource({...T,priority:E})}function p(T,E){f(T,"stat").then(E).catch(console.error)}function m(T,E){f(T,"routine").then(E).catch(console.error)}function g(T){t(`/${T.resourceType}/${T.id}`)}function y(T){t(`/${T.resourceType}/${T.id}/edit`)}function b(T){t(`/${T.resourceType}/${T.id}/delete`)}function w(T){c(T),d[1].open()}function j(T){t(`/${T.resourceType}/${T.id}/_history/${T.meta?.versionId}`)}function C(T,E){const _="aws-textract";ke({id:_,title:"AWS Textract in Progress",message:"Extracting text... This may take a moment...",loading:!0,autoClose:!1}),e.post(e.fhirUrl(T.resourceType,T.id,"$aws-textract"),{}).then(()=>{E(),Ys({id:_,title:"AWS Textract Successful",message:"Text successfully extracted.",color:"green",icon:a.jsx(zo,{size:"1rem"}),loading:!1,withCloseButton:!0})}).catch(k=>Ys({id:_,title:"AWS Textract Error",color:"red",message:Ge(k),icon:a.jsx(dl,{size:"1rem"}),loading:!1,withCloseButton:!0}))}function R(T){const{primaryResource:E,currentResource:_,reloadTimeline:k}=T,L=_.resourceType===E.resourceType&&_.id===E.id,A=_.resourceType==="Communication"&&_.priority!=="stat",N=_.resourceType==="Communication"&&_.priority==="stat",U=L,B=!L,Q=!L,J=!L,Z=e.getProjectMembership()?.admin,$=Z,W=gne()&&(_.resourceType==="DocumentReference"||_.resourceType==="Media");return a.jsxs(we.Dropdown,{children:[a.jsx(we.Label,{children:"Resource"}),A&&a.jsx(we.Item,{leftSection:a.jsx(lq,{size:14}),onClick:()=>p(_,k),"aria-label":`Pin ${Ot(_)}`,children:"Pin"}),N&&a.jsx(we.Item,{leftSection:a.jsx(uq,{size:14}),onClick:()=>m(_,k),"aria-label":`Unpin ${Ot(_)}`,children:"Unpin"}),B&&a.jsx(we.Item,{leftSection:a.jsx(RT,{size:14}),onClick:()=>g(_),"aria-label":`Details ${Ot(_)}`,children:"Details"}),U&&a.jsx(we.Item,{leftSection:a.jsx(RT,{size:14}),onClick:()=>j(_),"aria-label":`Details ${Ot(_)}`,children:"Details"}),Q&&a.jsx(we.Item,{leftSection:a.jsx(ik,{size:14}),onClick:()=>y(_),"aria-label":`Edit ${Ot(_)}`,children:"Edit"}),Z&&a.jsxs(a.Fragment,{children:[a.jsx(we.Divider,{}),a.jsx(we.Label,{children:"Admin"}),$&&a.jsx(we.Item,{leftSection:a.jsx(yq,{size:14}),onClick:()=>w(_),"aria-label":`Resend Subscriptions ${Ot(_)}`,children:"Resend Subscriptions"})]}),W&&a.jsxs(a.Fragment,{children:[a.jsx(we.Divider,{}),a.jsx(we.Label,{children:"AWS AI"}),a.jsx(we.Item,{leftSection:a.jsx(Iq,{size:14}),onClick:()=>C(_,k),"aria-label":`AWS Textract ${Ot(_)}`,children:"AWS Textract"})]}),J&&a.jsxs(a.Fragment,{children:[a.jsx(we.Divider,{}),a.jsx(we.Label,{children:"Danger zone"}),a.jsx(we.Item,{color:"red",leftSection:a.jsx(Lm,{size:14}),onClick:()=>b(_),"aria-label":`Delete ${Ot(_)}`,children:"Delete"})]})]})}return a.jsxs(a.Fragment,{children:[n==="Encounter"&&a.jsx(eY,{encounter:o,getMenu:R}),n==="Patient"&&a.jsx(fK,{patient:o,getMenu:R}),n==="ServiceRequest"&&a.jsx(qX,{serviceRequest:o,getMenu:R}),n!=="Encounter"&&n!=="Patient"&&n!=="ServiceRequest"&&a.jsx(ZQ,{resource:o,getMenu:R}),a.jsx(bre,{resource:s,opened:d[0],onClose:d[1].close},`resend-subscriptions-${s?.id}`)]})}function Sre(e){const{opened:t,close:n,version:r,loadingStatus:o,handleStatus:s,handleUpgrade:c}=e,[d,f]=v.useState(),[p,m]=v.useState(!1);return v.useEffect(()=>{t&&(d||rF("app-tools-page").then(f).catch(console.error),s())},[t,d,s]),d&&r&&!o?r==="unknown"?a.jsx("p",{children:"Unable to determine the current version of the agent. Check the network connectivity of the agent."}):r.startsWith(d)?a.jsxs("p",{children:["This agent is already on the latest version (",d,")."]}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{children:["Are you sure you want to upgrade this agent from version ",r," to version ",d,"?"]}),a.jsxs(xe,{children:[a.jsx(Ae,{onClick:()=>{c(p),n()},"aria-label":"Confirm upgrade",children:"Confirm Upgrade"}),a.jsx(Ln,{label:"Force",onChange:g=>m(g.currentTarget.checked)})]})]}):a.jsx(Pi,{})}function wre(){const e=Re(),{id:t}=Ht(),n=v.useMemo(()=>({reference:"Agent/"+t}),[t]),[r,o]=v.useState(!1),[s,c]=v.useState(!1),[d,f]=v.useState(!1),[p,m]=v.useState(!1),[g,y]=v.useState(),[b,w]=v.useState(),[j,C]=v.useState(),[R,T]=v.useState(),[E,_]=v.useState(!1),[k,L]=v.useState(!1),[A,N]=v.useState(),[U,{open:B,close:Q}]=Hc(!1);v.useEffect(()=>{if(r||s||d||E){L(!0);return}L(!1)},[r,s,d,E]);const J=v.useCallback(()=>{o(!0),e.get(e.fhirUrl("Agent",t,"$status"),{cache:"reload"}).then(F=>{y(F.parameter?.find(X=>X.name==="status")?.valueCode),w(F.parameter?.find(X=>X.name==="version")?.valueString),C(F.parameter?.find(X=>X.name==="lastUpdated")?.valueInstant)}).catch(F=>z(Ge(F))).finally(()=>o(!1))},[e,t]),Z=v.useCallback(F=>{const X=F.host,O=F.pingCount||1;X&&(_(!0),e.pushToAgent(n,X,`PING ${O}`,on.PING,!0).then(H=>T(H)).catch(H=>z(Ge(H))).finally(()=>_(!1)))},[e,n]),$=v.useCallback(()=>{c(!0),e.get(e.fhirUrl("Agent",t,"$reload-config"),{cache:"reload"}).then(F=>{I("Agent config reloaded successfully.")}).catch(F=>z(Ge(F))).finally(()=>c(!1))},[e,t]),W=v.useCallback(F=>{f(!0);const X=e.fhirUrl("Agent",t,"$upgrade");X.searchParams.set("force",String(F)),e.get(X,{cache:"reload"}).then(O=>{I("Agent upgraded successfully.")}).catch(O=>z(Ge(O))).finally(()=>f(!1))},[e,t]),M=v.useCallback(F=>{m(!0);const X=F.logLimit||20;e.get(e.fhirUrl("Agent",t,`$fetch-logs${X!==void 0?`?limit=${X}`:""}`),{cache:"reload"}).then(O=>{const H=O?.parameter?.find(oe=>oe.name==="logs");H&&N(H?.valueString)}).catch(O=>z(Ge(O))).finally(()=>m(!1))},[e,t]);function I(F){ke({color:"green",title:"Success",icon:a.jsx(zo,{size:"1rem"}),message:F})}function z(F){ke({color:"red",title:"Error",message:F,autoClose:!1})}return a.jsxs(dt,{children:[a.jsx(Gn,{opened:U,onClose:Q,title:"Upgrade Agent",centered:!0,children:a.jsx(Sre,{opened:U,close:Q,version:b,loadingStatus:r,handleStatus:J,handleUpgrade:W})}),a.jsx(Ie,{order:1,children:"Agent Tools"}),a.jsxs("div",{style:{marginBottom:10},children:["Agent: ",a.jsx(Tl,{value:n,link:!0})]}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{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(Ae,{onClick:J,loading:r,disabled:k&&!r,children:"Get Status"}),!r&&g&&a.jsx(ce,{children:a.jsxs(ce.Tbody,{children:[a.jsxs(ce.Tr,{children:[a.jsx(ce.Td,{children:"Status"}),a.jsx(ce.Td,{children:a.jsx($m,{status:g})})]}),a.jsxs(ce.Tr,{children:[a.jsx(ce.Td,{children:"Version"}),a.jsx(ce.Td,{children:b})]}),a.jsxs(ce.Tr,{children:[a.jsx(ce.Td,{children:"Last Updated"}),a.jsx(ce.Td,{children:Sr(j,void 0,{timeZoneName:"longOffset"})})]})]})}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{order:2,children:"Reload Config"}),a.jsx("p",{children:"Reload the configuration of this agent, syncing it with the current version of the Agent resource on the Medplum server."}),a.jsx(Ae,{onClick:$,loading:s,disabled:k&&!s,"aria-label":"Reload config",children:"Reload Config"}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{order:2,children:"Upgrade Agent"}),a.jsx("p",{children:"Upgrade the version of this agent, to either the latest (default) or a specified version."}),a.jsx(Ae,{onClick:B,loading:d,disabled:k&&!d,"aria-label":"Upgrade agent",children:"Upgrade"}),a.jsx(Tn,{my:"lg"}),a.jsxs(mt,{onSubmit:M,children:[a.jsx(Ie,{order:2,children:"Fetch Logs"}),a.jsx("p",{children:"Fetch logs from the agent."}),A?.length?a.jsx(zd,{block:!0,mb:15,children:A}):null,a.jsxs(xe,{children:[a.jsx(Ic,{w:100,id:"logLimit",name:"logLimit",placeholder:"20",label:"Log Limit"}),a.jsx(Ae,{mt:22,loading:p,disabled:k&&!p,"aria-label":"Fetch logs",type:"submit",children:"Fetch Logs"})]})]}),a.jsx(Tn,{my:"lg"}),a.jsx(Ie,{order:2,children:"Ping from Agent"}),a.jsx("p",{children:"Send a ping command from the agent to a valid IP address or hostname. Use this tool to troubleshoot local network connectivity."}),a.jsx(mt,{onSubmit:Z,children:a.jsxs(xe,{children:[a.jsx(Fe,{id:"host",name:"host",placeholder:"ex. 127.0.0.1",label:"IP Address / Hostname",rightSection:a.jsx(Rn,{size:24,radius:"xl",variant:"filled",type:"submit","aria-label":"Ping",loading:E,disabled:k&&!E,children:a.jsx(wq,{style:{width:"1rem",height:"1rem"},stroke:1.5})})}),a.jsx(Ic,{id:"pingCount",name:"pingCount",placeholder:"1",label:"Ping Count"})]})}),!E&&R&&a.jsxs(a.Fragment,{children:[a.jsx(Ie,{order:5,mt:"sm",mb:0,children:"Last Ping"}),a.jsx("pre",{children:R})]})]})}function jre(){const e=_n(),t=Re(),[n,r]=v.useState();v.useEffect(()=>{t.get("auth/me",{cache:"no-cache"}).then(r).catch(s=>ke({color:"red",message:Ge(s),autoClose:!1}))},[t]);function o(s){t.post("auth/revoke",{loginId:s}).then(()=>t.get("auth/me",{cache:"no-cache"})).then(r).then(()=>ke({color:"green",message:"Login revoked"})).catch(c=>ke({color:"red",message:Ge(c),autoClose:!1}))}return n?a.jsxs(a.Fragment,{children:[a.jsxs(dt,{children:[a.jsx(Ie,{children:"Security"}),a.jsxs(tf,{children:[a.jsx(Nr,{term:"ID",children:a.jsx(Mt,{href:`/${Ot(n.profile)}`,children:n.profile.id})}),a.jsx(Nr,{term:"Resource Type",children:n.profile.resourceType}),a.jsx(Nr,{term:"Name",children:nu(n.profile.name?.[0])})]})]}),a.jsxs(dt,{children:[a.jsx(Ie,{children:"Sessions"}),a.jsxs(ce,{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:Sr(s.lastUpdated)}),a.jsx("td",{children:a.jsx(Mt,{href:"#",onClick:()=>o(s.id),children:"Revoke"})})]},s.id))})]})]}),a.jsxs(dt,{children:[a.jsx(Ie,{children:"Password"}),a.jsx(Ae,{onClick:()=>e("/changepassword")?.catch(console.error),children:"Change password"})]}),a.jsxs(dt,{children:[a.jsx(Ie,{children:"Multi Factor Auth"}),a.jsxs("p",{children:["Enrolled: ",n.security.mfaEnrolled.toString()]}),!n.security.mfaEnrolled&&a.jsx(Ae,{onClick:()=>e("/mfa")?.catch(console.error),children:"Enroll"})]})]}):null}function Cre(){const{id:e,secret:t}=Ht(),n=Re(),[r,o]=v.useState(),[s,c]=v.useState(!1),d=iu(r,void 0);return a.jsxs(dt,{width:450,children:[a.jsx(jr,{issues:d}),a.jsxs(mt,{onSubmit:f=>{if(f.password!==f.confirmPassword){o(jo("Passwords do not match","confirmPassword"));return}o(void 0);const p={id:e,secret:t,password:f.password};n.post("auth/setpassword",p).then(()=>c(!0)).catch(m=>o(Yt(m)))},children:[a.jsxs(dr,{style:{flexDirection:"column"},children:[a.jsx(zi,{size:32}),a.jsx(Ie,{children:"Set password"})]}),!s&&a.jsxs(Ue,{children:[a.jsx(Xi,{name:"password",label:"New password",required:!0,error:Lt(r,"password")}),a.jsx(Xi,{name:"confirmPassword",label:"Confirm new password",required:!0,error:Lt(r,"confirmPassword")}),a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(Ae,{type:"submit",children:"Set password"})})]}),s&&a.jsxs("div",{"data-testid":"success",children:["Password set. You can now ",a.jsx(St,{to:"/signin",children:"sign in"}),"."]})]})]})}function Ere(){const e=Mm(),t=_n(),[n]=IS(),r=cf(),o=v.useCallback(()=>{const s=n.get("next");t(s?.startsWith("/")?s:"/")?.catch(console.error)},[n,t]);return v.useEffect(()=>{e&&n.has("next")&&o()},[e,n,o]),a.jsxs(jk,{onSuccess:()=>o(),onForgotPassword:()=>t("/resetpassword")?.catch(console.error),onRegister:XP()?()=>t("/register")?.catch(console.error):void 0,googleClientId:r.googleClientId,login:n.get("login")||void 0,projectId:n.get("project")||void 0,children:[a.jsx(zi,{size:32}),a.jsxs(Ie,{children:["Sign in to ",fk()]}),n.get("project")==="new"&&a.jsx("div",{children:"Sign in again to create a new project"})]})}function Tre(){const e=_n(),t=Jr(),[n,r]=v.useState(),[o,s]=v.useState(),[c,d]=v.useState();return v.useEffect(()=>{const f=Object.fromEntries(new URLSearchParams(t.search).entries());r(f.resourceType),s(f.query),d(JSON.parse(f.fields))},[t]),!n||!o||!c?null:a.jsx(XY,{resourceType:n,checkboxesEnabled:!0,query:o,fields:c,onClick:f=>e(`/${n}/${f.resource.id}`)?.catch(console.error),onAuxClick:f=>window.open(`/${n}/${f.resource.id}`,"_blank"),onBulk:f=>{e(`/bulk/${n}?ids=${f.join(",")}`)?.catch(console.error)}})}function Rre(){const{id:e,secret:t}=Ht(),n=Re(),[r,o]=v.useState(),[s,c]=v.useState(!1),d=iu(r,void 0);return a.jsxs(dt,{width:450,children:[a.jsx(jr,{issues:d}),a.jsxs(mt,{onSubmit:()=>{o(void 0);const f={id:e,secret:t};n.post("auth/verifyemail",f).then(()=>c(!0)).catch(p=>o(Yt(p)))},children:[a.jsxs(dr,{style:{flexDirection:"column"},children:[a.jsx(zi,{size:32}),a.jsx(Ie,{children:"Email address verification required"})]}),!s&&a.jsxs(Ue,{children:[a.jsx("p",{children:"In order to sign in, click the button below to verify your ability to receive email at the address this link was sent to."}),a.jsx(xe,{justify:"flex-end",mt:"xl",children:a.jsx(Ae,{type:"submit",children:"Verify email"})})]}),s&&a.jsxs("div",{"data-testid":"success",children:["Email verified. You can now ",a.jsx(St,{to:"/signin",children:"sign in"}),"."]})]})]})}function _re(){return a.jsx(NZ,{children:a.jsxs($e,{errorElement:a.jsx(tne,{}),children:[a.jsx($e,{path:"/signin",element:a.jsx(Ere,{})}),a.jsx($e,{path:"/oauth",element:a.jsx(vne,{})}),a.jsx($e,{path:"/resetpassword",element:a.jsx(xne,{})}),a.jsx($e,{path:"/setpassword/:id/:secret",element:a.jsx(Cre,{})}),a.jsx($e,{path:"/verifyemail/:id/:secret",element:a.jsx(Rre,{})}),a.jsx($e,{path:"/register",element:a.jsx(yne,{})}),a.jsx($e,{path:"/changepassword",element:a.jsx(Jte,{})}),a.jsx($e,{path:"/security",element:a.jsx(jre,{})}),a.jsx($e,{path:"/mfa",element:a.jsx(pne,{})}),a.jsx($e,{path:"/batch",element:a.jsx(Kte,{})}),a.jsx($e,{path:"/bulk/:resourceType",element:a.jsx(Xte,{})}),a.jsx($e,{path:"/smart",element:a.jsx(Tre,{})}),a.jsx($e,{path:"/forms/:id",element:a.jsx(nne,{})}),a.jsx($e,{path:"/admin/super",element:a.jsx(Vee,{})}),a.jsx($e,{path:"/admin/super/asyncjob",element:a.jsx(Lee,{})}),a.jsx($e,{path:"/admin/super/db",element:a.jsx(Ree,{})}),a.jsx($e,{path:"/admin/config",element:a.jsx(Pee,{})}),a.jsxs($e,{path:"/admin",element:a.jsx(Nee,{}),children:[a.jsx($e,{path:"patients",element:a.jsx(kee,{})}),a.jsx($e,{path:"bots/new",element:a.jsx(yee,{})}),a.jsx($e,{path:"bots",element:a.jsx(gee,{})}),a.jsx($e,{path:"clients/new",element:a.jsx(xee,{})}),a.jsx($e,{path:"clients",element:a.jsx(vee,{})}),a.jsx($e,{path:"details",element:a.jsx(DR,{})}),a.jsx($e,{path:"invite",element:a.jsx(Aee,{})}),a.jsx($e,{path:"users",element:a.jsx(qee,{})}),a.jsx($e,{path:"project",element:a.jsx(DR,{})}),a.jsx($e,{path:"secrets",element:a.jsx(Oee,{})}),a.jsx($e,{path:"sites",element:a.jsx(Mee,{})}),a.jsx($e,{path:"members/:membershipId",element:a.jsx(Dee,{})})]}),a.jsx($e,{path:"/lab/assays",element:a.jsx(fne,{})}),a.jsx($e,{path:"/lab/panels",element:a.jsx(hne,{})}),a.jsxs($e,{path:"/:resourceType/new",element:a.jsx(ene,{}),children:[a.jsx($e,{index:!0,element:a.jsx(Zy,{})}),a.jsx($e,{path:"form",element:a.jsx(Zy,{})}),a.jsx($e,{path:"json",element:a.jsx(Vne,{})}),a.jsx($e,{path:"profiles",element:a.jsx(Zy,{})})]}),a.jsxs($e,{path:"/:resourceType/:id",element:a.jsx(yre,{}),children:[a.jsx($e,{index:!0,element:a.jsx(YR,{})}),a.jsx($e,{path:"apply",element:a.jsx(Sne,{})}),a.jsx($e,{path:"apps",element:a.jsx(wne,{})}),a.jsx($e,{path:"event",element:a.jsx(Cne,{})}),a.jsx($e,{path:"blame",element:a.jsx(Ene,{})}),a.jsx($e,{path:"bots",element:a.jsx(ere,{})}),a.jsx($e,{path:"builder",element:a.jsx(One,{})}),a.jsx($e,{path:"checklist",element:a.jsx(Mne,{})}),a.jsx($e,{path:"delete",element:a.jsx(Lne,{})}),a.jsx($e,{path:"details",element:a.jsx($ne,{})}),a.jsx($e,{path:"edit",element:a.jsx(Une,{})}),a.jsx($e,{path:"editor",element:a.jsx(Pne,{})}),a.jsxs($e,{path:"history",children:[a.jsx($e,{index:!0,element:a.jsx(QR,{})}),a.jsx($e,{path:":versionId/:tab",element:a.jsx(Bh,{})}),a.jsx($e,{path:":versionId",element:a.jsx(Bh,{})})]}),a.jsxs($e,{path:"_history",children:[a.jsx($e,{index:!0,element:a.jsx(QR,{})}),a.jsx($e,{path:":versionId/:tab",element:a.jsx(Bh,{})}),a.jsx($e,{path:":versionId",element:a.jsx(Bh,{})})]}),a.jsx($e,{path:"json",element:a.jsx(Fne,{})}),a.jsx($e,{path:"preview",element:a.jsx(Kne,{})}),a.jsx($e,{path:"responses",element:a.jsx(nre,{})}),a.jsx($e,{path:"report",element:a.jsx(ire,{})}),a.jsx($e,{path:"ranges",element:a.jsx(rre,{})}),a.jsx($e,{path:"subscriptions",element:a.jsx(xre,{})}),a.jsx($e,{path:"timeline",element:a.jsx(YR,{})}),a.jsx($e,{path:"tools",element:a.jsx(wre,{})}),a.jsx($e,{path:"profiles",element:a.jsx(Xne,{})}),a.jsx($e,{path:"export",element:a.jsx(Bne,{})})]}),a.jsx($e,{path:"/:resourceType",element:a.jsx(qR,{})}),a.jsx($e,{path:"/",element:a.jsx(qR,{})})]})})}function Dre(){const e=Re(),t=e.getUserConfiguration(),n=Jr(),[r]=IS();return e.isLoading()?a.jsx(Pi,{}):a.jsx(LG,{logo:a.jsx(zi,{size:24}),pathname:n.pathname,searchParams:r,version:UA,menus:Are(t),displayAddBookmark:!!t?.id,children:a.jsx(v.Suspense,{fallback:a.jsx(Pi,{}),children:a.jsx(_re,{})})})}function Are(e){const t=e?.menu?.map(n=>({title:n.title,links:n.link?.map(r=>({label:r.name,href:r.target,icon:kre(r.target)}))||[]}))||[];return t.push({title:"Settings",links:[{label:"Security",href:"/security",icon:a.jsx(QH,{})}]}),t}const KR={Patient:kq,Practitioner:FH,Organization:aH,ServiceRequest:mq,DiagnosticReport:bq,Questionnaire:BH,admin:eH,AccessPolicy:GH,Subscription:Bq,batch:aq,Observation:nq};function kre(e){if(e.includes("admin/super/db"))return a.jsx(jH,{});try{const t=new URL(e,"https://app.medplum.com").pathname.split("/")[1];if(t in KR){const n=KR[t];return a.jsx(n,{})}}catch{}return a.jsx(jm,{w:30})}async function Pre(){const e=cf(),t=new BA({baseUrl:e.baseUrl,clientId:e.clientId,storagePrefix:"@medplum:",cacheTime:6e4,autoBatchTime:100,onUnauthenticated:()=>{window.location.pathname!=="/signin"&&window.location.pathname!=="/oauth"&&(window.location.href="/signin?next="+encodeURIComponent(window.location.pathname+window.location.search))}}),n={headings:{sizes:{h1:{fontSize:"1.125rem",fontWeight:"500",lineHeight:"2.0"}}},fontSizes:{xs:"0.6875rem",sm:"0.875rem",md:"0.875rem",lg:"1.0rem",xl:"1.125rem"}},r=ree([{path:"*",element:a.jsx(Dre,{})}]),o=c=>r.navigate(c);XX.createRoot(document.getElementById("root")).render(a.jsx(v.StrictMode,{children:a.jsx(iF,{medplum:t,navigate:o,children:a.jsxs(b2,{theme:n,children:[a.jsx(Ea,{position:"bottom-right"}),a.jsx(DZ,{router:r})]})})}))}Pre().catch(console.error);
200
- //# sourceMappingURL=index-bf6IP9S6.js.map