@medplum/app 5.2.3 → 5.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{index-DyuzFsRa.js → index-CTTKsohl.js} +19 -19
- package/dist/assets/index-CTTKsohl.js.map +1 -0
- package/dist/assets/{index-CFTl7YmP.css → index-Cuqsi-u2.css} +1 -1
- package/dist/assets/{jsQR-BNygLPoh.js → jsQR-CogLAsBn.js} +2 -2
- package/dist/assets/{jsQR-BNygLPoh.js.map → jsQR-CogLAsBn.js.map} +1 -1
- package/dist/index.html +3 -3
- package/package.json +6 -6
- package/dist/assets/index-DyuzFsRa.js.map +0 -1
|
@@ -53,7 +53,7 @@ ${o?`${s(`light`)}{${o}}`:``}`}function Mr({color:e,theme:t,autoContrast:n}){ret
|
|
|
53
53
|
`),a=!1),Object.assign(Object.assign({},e),{allowNegative:a})}function O_(e){e=D_(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var t=e.suffix,n=e.allowNegative,r=e.allowLeadingZeros,i=e.onKeyDown;i===void 0&&(i=Ug);var a=e.onBlur;a===void 0&&(a=Ug);var o=e.thousandSeparator,s=e.decimalScale,c=e.fixedDecimalScale,l=e.prefix;l===void 0&&(l=``);var u=e.defaultValue,d=e.value,f=e.valueIsNumericString,p=e.onValueChange,m=Vg(e,[`decimalSeparator`,`allowedDecimalSeparators`,`thousandsGroupStyle`,`suffix`,`allowNegative`,`allowLeadingZeros`,`onKeyDown`,`onBlur`,`thousandSeparator`,`decimalScale`,`fixedDecimalScale`,`prefix`,`defaultValue`,`value`,`valueIsNumericString`,`onValueChange`]),h=x_(e),g=h.decimalSeparator,_=h.allowedDecimalSeparators,v=function(t){return b_(t,e)},y=function(t,n){return T_(t,n,e)},b=Kg(d)?u:d,x=f??w_(b,l,t);Kg(d)?Kg(u)||(x||=typeof u==`number`):x||=typeof d==`number`;var S=function(e){return Jg(e)?e:(typeof e==`number`&&(e=r_(e)),x&&typeof s==`number`?i_(e,s,!!c):e)},C=g_(S(d),S(u),!!x,v,y,p),w=C[0],T=w.numAsString,E=w.formattedValue,D=C[1];return Object.assign(Object.assign({},m),{value:E,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===g||Gg(e)},isCharacterSame:function(e){var t=e.currentValue,n=e.lastValue,r=e.formattedValue,i=e.currentValueIndex,a=e.formattedValueIndex,o=t[i],u=r[a],f=o_(n,t).to,p=function(e){return y(e).indexOf(`.`)+l.length};return d===0&&c&&s&&t[f.start]===g&&p(t)<i&&p(r)>a?!1:i>=f.start&&i<f.end&&_&&_.includes(o)&&u===g?!0:o===u},onValueChange:D,format:v,removeFormatting:y,getCaretBoundary:function(t){return E_(t,e)},onKeyDown:function(e){var t=e.target,r=e.key,a=t.selectionStart,u=t.selectionEnd,d=t.value;if(d===void 0&&(d=``),(r===`Backspace`||r===`Delete`)&&u<l.length&&d!==`-`){e.preventDefault();return}if(a!==u){i(e);return}r===`Backspace`&&d[0]===`-`&&a===l.length+1&&n&&a_(t,1),s&&c&&(r===`Backspace`&&d[a-1]===g?(a_(t,a-1),e.preventDefault()):r===`Delete`&&d[a]===g&&e.preventDefault()),_?.includes(r)&&d[a]===g&&a_(t,a+1);var f=o===!0?`,`:o;r===`Backspace`&&d[a-1]===f&&a_(t,a-1),r===`Delete`&&d[a]===f&&a_(t,a+1),i(e)},onBlur:function(t){var n=T;n.match(/\d/g)||(n=``),r||(n=e_(n)),c&&s&&(n=i_(n,s,c)),n!==T&&D({formattedValue:b_(n,e),value:n,floatValue:parseFloat(n)},{event:t,source:Hg.event}),a(t)}})}function k_(e){var t=O_(e);return b.createElement(y_,Object.assign({},t))}var A_={root:`m_e2f5cd4e`,controls:`m_95e17d22`,control:`m_80b4b171`};function j_({direction:e,style:t,...n}){return(0,L.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:(0,L.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 M_=/^(0\.0*|-0(\.0*)?)$/,N_=/^-?0\d+(\.\d+)?\.?$/,P_=/\.\d*0$/,F_=/^-?\d+\.$/;function I_(e){return typeof e==`string`&&e!==``&&!Number.isNaN(Number(e))}function L_(e){return typeof e==`number`?e<2**53-1:e===``||I_(e)&&Number(e)<2**53-1}function R_(e){return e.toString().replace(`.`,``).length}function z_(e,t){return(typeof e==`number`?e<2**53-1:!Number.isNaN(Number(e)))&&!Number.isNaN(e)&&R_(t)<14&&t!==``}function B_(e,t,n){return e===void 0||(t===void 0||e>=t)&&(n===void 0||e<=n)}var V_={step:1,clampBehavior:`blur`,allowDecimal:!0,allowNegative:!0,withKeyboardEvents:!0,allowLeadingZeros:!0,trimLeadingZeroesOnBlur:!0,startValue:0,allowedDecimalSeparators:[`.`,`,`]},H_=Fn((e,{size:t})=>({controls:{"--ni-chevron-size":ut(t,`ni-chevron-size`)}}));function U_(e,t,n){let r=e.toString(),i=F_.test(r),a=r.replace(/^0+(?=\d)/,``),o=parseFloat(a);if(Number.isNaN(o))return a;if(o>2**53-1)return t===void 0?a:t;let s=xt(o,n,t);return i?`${s.toString().replace(/^0+(?=\d)/,``)}.`:s}var W_=B((e,t)=>{let n=R(`NumberInput`,V_,e),{className:r,classNames:i,styles:a,unstyled:o,vars:s,onChange:c,onValueChange:l,value:u,defaultValue:d,max:f,min:p,step:m,hideControls:h,rightSection:g,isAllowed:_,clampBehavior:v,onBlur:y,allowDecimal:x,decimalScale:S,onKeyDown:C,onKeyDownCapture:w,handlersRef:T,startValue:E,disabled:D,rightSectionPointerEvents:O,allowNegative:k,readOnly:A,size:j,rightSectionWidth:M,stepHoldInterval:N,stepHoldDelay:ee,allowLeadingZeros:P,withKeyboardEvents:te,trimLeadingZeroesOnBlur:ne,allowedDecimalSeparators:re,attributes:ie,...ae}=n,oe=ui({name:`NumberInput`,classes:A_,props:n,classNames:i,styles:a,unstyled:o,attributes:ie,vars:s,varsResolver:H_}),{resolvedClassNames:se,resolvedStyles:ce}=qr({classNames:i,styles:a,props:n}),[le,ue]=ln({value:u,defaultValue:d,finalValue:``,onChange:c}),de=ee!==void 0&&N!==void 0,fe=(0,b.useRef)(null),pe=(0,b.useRef)(null),F=(0,b.useRef)(0),me=(e,t)=>{t.source===`event`&&ue(z_(e.floatValue,e.value)&&!M_.test(e.value)&&!(P&&N_.test(e.value))&&!P_.test(e.value)&&!F_.test(e.value)?e.floatValue:e.value),l?.(e,t)},he=e=>{let t=String(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return t?Math.max(0,(t[1]?t[1].length:0)-(t[2]?+t[2]:0)):0},ge=e=>{fe.current&&e!==void 0&&fe.current.setSelectionRange(e,e)},_e=(0,b.useRef)(ct);_e.current=()=>{if(!L_(le))return;let e,t=he(le),n=he(m),r=Math.max(t,n),i=10**r;if(!I_(le)&&(typeof le!=`number`||Number.isNaN(le)))e=xt(E,p,f);else if(f!==void 0){let t=(Math.round(Number(le)*i)+Math.round(m*i))/i;e=t<=f?t:f}else e=(Math.round(Number(le)*i)+Math.round(m*i))/i;let a=e.toFixed(r);ue(parseFloat(a)),l?.({floatValue:parseFloat(a),formattedValue:a,value:a},{source:`increment`}),setTimeout(()=>ge(fe.current?.value.length),0)};let ve=(0,b.useRef)(ct);ve.current=()=>{if(!L_(le))return;let e,t=p===void 0?k?-(2**53-1):0:p,n=he(le),r=he(m),i=Math.max(n,r),a=10**i;if(!I_(le)&&typeof le!=`number`||Number.isNaN(le))e=xt(E,t,f);else{let n=(Math.round(Number(le)*a)-Math.round(m*a))/a;e=t!==void 0&&n<t?t:n}let o=e.toFixed(i);ue(parseFloat(o)),l?.({floatValue:parseFloat(o),formattedValue:o,value:o},{source:`decrement`}),setTimeout(()=>ge(fe.current?.value.length),0)};let ye=e=>{let t=e.clipboardData.getData(`text`),n=ae.decimalSeparator||`.`,r=(re||[`.`,`,`]).filter(e=>e!==n);if(r.some(e=>t.includes(e))){e.preventDefault();let i=t;r.forEach(e=>{i=i.split(e).join(n)});let a=fe.current;if(a){let e=a.selectionStart??0,t=a.selectionEnd??0,n=a.value,r=n.substring(0,e)+i+n.substring(t);(Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,`value`)?.set)?.call(a,r),a.dispatchEvent(new Event(`change`,{bubbles:!0}));let o=e+i.length;setTimeout(()=>ge(o),0)}}ae.onPaste?.(e)},be=e=>{C?.(e),!A&&te&&(e.key===`ArrowUp`&&(e.preventDefault(),_e.current?.()),e.key===`ArrowDown`&&(e.preventDefault(),ve.current?.()))},xe=e=>{if(w?.(e),e.key===`Backspace`){let t=fe.current;t&&t.selectionStart===0&&t.selectionStart===t.selectionEnd&&(e.preventDefault(),window.setTimeout(()=>ge(0),0))}},Se=e=>{let t=le;v===`blur`&&typeof t==`number`&&(t=xt(t,p,f)),ne&&typeof t==`string`&&he(t)<15&&(t=U_(t,f,p)),le!==t&&ue(t),y?.(e)};on(T,{increment:_e.current,decrement:ve.current});let Ce=e=>{e?_e.current?.():ve.current?.(),F.current+=1},we=e=>{if(Ce(e),de){let t=typeof N==`number`?N:N(F.current);pe.current=window.setTimeout(()=>we(e),t)}},Te=(e,t)=>{e.preventDefault(),fe.current?.focus(),Ce(t),de&&(pe.current=window.setTimeout(()=>we(t),ee))},Ee=()=>{pe.current&&window.clearTimeout(pe.current),pe.current=null,F.current=0},De=(0,L.jsxs)(`div`,{...oe(`controls`),children:[(0,L.jsx)(vl,{...oe(`control`),tabIndex:-1,"aria-hidden":!0,disabled:D||typeof le==`number`&&f!==void 0&&le>=f,mod:{direction:`up`},onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{Te(e,!0)},onPointerUp:Ee,onPointerLeave:Ee,children:(0,L.jsx)(j_,{direction:`up`})}),(0,L.jsx)(vl,{...oe(`control`),tabIndex:-1,"aria-hidden":!0,disabled:D||typeof le==`number`&&p!==void 0&&le<=p,mod:{direction:`down`},onMouseDown:e=>e.preventDefault(),onPointerDown:e=>{Te(e,!1)},onPointerUp:Ee,onPointerLeave:Ee,children:(0,L.jsx)(j_,{direction:`down`})})]});return(0,L.jsx)(vd,{component:k_,allowNegative:k,className:Ln(A_.root,r),size:j,inputMode:`decimal`,...ae,readOnly:A,disabled:D,value:le,getInputRef:cn(t,fe),onValueChange:me,rightSection:h||A||!L_(le)?g:g||De,classNames:se,styles:ce,unstyled:o,__staticSelector:`NumberInput`,decimalScale:x?S:0,onPaste:ye,onKeyDown:be,onKeyDownCapture:xe,rightSectionPointerEvents:O??(D?`none`:void 0),rightSectionWidth:M??`var(--ni-right-section-width-${j||`sm`})`,allowLeadingZeros:P,allowedDecimalSeparators:re,onBlur:Se,attributes:ie,isAllowed:e=>v===`strict`?_?_(e)&&B_(e.floatValue,p,f):B_(e.floatValue,p,f):!_||_(e)})});W_.classes={...vd.classes,...A_},W_.displayName=`@mantine/core/NumberInput`;var G_={root:`m_4addd315`,control:`m_326d024a`,dots:`m_4ad7767d`},[K_,q_]=Qe(`Pagination.Root component was not found in tree`),J_={withPadding:!0},Y_=B((e,t)=>{let{classNames:n,className:r,style:i,styles:a,vars:o,active:s,disabled:c,withPadding:l,mod:u,...d}=R(`PaginationControl`,J_,e),f=q_(),p=c||f.disabled;return(0,L.jsx)(vl,{ref:t,disabled:p,mod:[{active:s,disabled:p,"with-padding":l},u],...f.getStyles(`control`,{className:r,style:i,classNames:n,styles:a,active:!p}),...d})});Y_.classes=G_,Y_.displayName=`@mantine/core/PaginationControl`;function X_({style:e,children:t,path:n,...r}){return(0,L.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:(0,L.jsx)(`path`,{d:n,fill:`currentColor`})})}var Z_=e=>(0,L.jsx)(X_,{...e,path:`M8.781 8l-3.3-3.3.943-.943L10.667 8l-4.243 4.243-.943-.943 3.3-3.3z`}),Q_=e=>(0,L.jsx)(X_,{...e,path:`M7.219 8l3.3 3.3-.943.943L5.333 8l4.243-4.243.943.943-3.3 3.3z`}),$_=e=>(0,L.jsx)(X_,{...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`}),ev=e=>(0,L.jsx)(X_,{...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`}),tv={icon:e=>(0,L.jsx)(X_,{...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`})},nv=B((e,t)=>{let{classNames:n,className:r,style:i,styles:a,vars:o,icon:s,...c}=R(`PaginationDots`,tv,e),l=q_();return(0,L.jsx)(z,{ref:t,...l.getStyles(`dots`,{className:r,style:i,styles:a,classNames:n}),...c,children:(0,L.jsx)(s,{style:{width:`calc(var(--pagination-control-size) / 1.8)`,height:`calc(var(--pagination-control-size) / 1.8)`}})})});nv.classes=G_,nv.displayName=`@mantine/core/PaginationDots`;function rv({icon:e,name:t,action:n,type:r}){let i={icon:e},a=(0,b.forwardRef)((e,a)=>{let{icon:o,...s}=R(t,i,e),c=q_(),l=r===`next`?c.active===c.total:c.active===1;return(0,L.jsx)(Y_,{disabled:c.disabled||l,ref:a,onClick:c[n],withPadding:!1,...s,children:(0,L.jsx)(o,{className:`mantine-rotate-rtl`,style:{width:`calc(var(--pagination-control-size) / 1.8)`,height:`calc(var(--pagination-control-size) / 1.8)`}})})});return a.displayName=`@mantine/core/${t}`,Ui(a)}var iv=rv({icon:Z_,name:`PaginationNext`,action:`onNext`,type:`next`}),av=rv({icon:Q_,name:`PaginationPrevious`,action:`onPrevious`,type:`previous`}),ov=rv({icon:$_,name:`PaginationFirst`,action:`onFirst`,type:`previous`}),sv=rv({icon:ev,name:`PaginationLast`,action:`onLast`,type:`next`});function cv({dotsIcon:e}){let t=q_(),n=t.range.map((n,r)=>n===`dots`?(0,L.jsx)(nv,{icon:e},r):(0,L.jsx)(Y_,{active:n===t.active,"aria-current":n===t.active?`page`:void 0,onClick:()=>t.onChange(n),disabled:t.disabled,...t.getItemProps?.(n),children:t.getItemProps?.(n)?.children??n},r));return(0,L.jsx)(L.Fragment,{children:n})}cv.displayName=`@mantine/core/PaginationItems`;var lv={siblings:1,boundaries:1},uv=Fn((e,{size:t,radius:n,color:r,autoContrast:i})=>({root:{"--pagination-control-radius":n===void 0?void 0:ft(n),"--pagination-control-size":ut(t,`pagination-control-size`),"--pagination-control-fz":pt(t),"--pagination-active-bg":r?ur(r,e):void 0,"--pagination-active-color":di(i,e)?Mr({color:r,theme:e,autoContrast:i}):void 0}})),dv=B((e,t)=>{let n=R(`PaginationRoot`,lv,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,total:l,value:u,defaultValue:d,onChange:f,disabled:p,siblings:m,boundaries:h,color:g,radius:_,onNextPage:v,onPreviousPage:y,onFirstPage:b,onLastPage:x,getItemProps:S,autoContrast:C,attributes:w,...T}=n,E=ui({name:`Pagination`,classes:G_,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:w,vars:c,varsResolver:uv}),{range:D,setPage:O,next:k,previous:A,active:j,first:M,last:N}=fn({page:u,initialPage:d,onChange:f,total:l,siblings:m,boundaries:h}),ee=gt(v,k),P=gt(y,A),te=gt(b,M),ne=gt(x,N);return(0,L.jsx)(K_,{value:{total:l,range:D,active:j,disabled:p,getItemProps:S,onChange:O,onNext:ee,onPrevious:P,onFirst:te,onLast:ne,getStyles:E},children:(0,L.jsx)(z,{ref:t,...E(`root`),...T})})});dv.classes=G_,dv.displayName=`@mantine/core/PaginationRoot`;var fv={withControls:!0,withPages:!0,siblings:1,boundaries:1,gap:8},pv=B((e,t)=>{let{withEdges:n,withControls:r,getControlProps:i,nextIcon:a,previousIcon:o,lastIcon:s,firstIcon:c,dotsIcon:l,total:u,gap:d,hideWithOnePage:f,withPages:p,...m}=R(`Pagination`,fv,e);return u<=0||f&&u===1?null:(0,L.jsx)(dv,{ref:t,total:u,...m,children:(0,L.jsxs)(V,{gap:d,children:[n&&(0,L.jsx)(ov,{icon:c,...i?.(`first`)}),r&&(0,L.jsx)(av,{icon:o,...i?.(`previous`)}),p&&(0,L.jsx)(cv,{dotsIcon:l}),r&&(0,L.jsx)(iv,{icon:a,...i?.(`next`)}),n&&(0,L.jsx)(sv,{icon:s,...i?.(`last`)})]})})});pv.classes=G_,pv.displayName=`@mantine/core/Pagination`,pv.Root=dv,pv.Control=Y_,pv.Dots=nv,pv.First=ov,pv.Last=sv,pv.Next=iv,pv.Previous=av,pv.Items=cv;var mv={root:`m_f61ca620`,input:`m_ccf8da4c`,innerInput:`m_f2d85dd2`,visibilityToggle:`m_b1072d44`},hv={visibilityToggleIcon:({reveal:e})=>(0,L.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:(0,L.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`})})},gv=Fn((e,{size:t})=>({root:{"--psi-icon-size":ut(t,`psi-icon-size`),"--psi-button-size":ut(t,`psi-button-size`)}})),_v=B((e,t)=>{let n=R(`PasswordInput`,hv,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,required:l,error:u,leftSection:d,disabled:f,id:p,variant:m,inputContainer:h,description:g,label:_,size:v,errorProps:y,descriptionProps:b,labelProps:x,withAsterisk:S,inputWrapperOrder:C,wrapperProps:w,radius:T,rightSection:E,rightSectionWidth:D,rightSectionPointerEvents:O,leftSectionWidth:k,visible:A,defaultVisible:j,onVisibilityChange:M,visibilityToggleIcon:N,visibilityToggleButtonProps:ee,rightSectionProps:P,leftSectionProps:te,leftSectionPointerEvents:ne,withErrorStyles:re,mod:ie,attributes:ae,...oe}=n,se=Zt(p),[ce,le]=ln({value:A,defaultValue:j,finalValue:!1,onChange:M}),ue=()=>le(!ce),de=ui({name:`PasswordInput`,classes:mv,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:ae,vars:c,varsResolver:gv}),{resolvedClassNames:fe,resolvedStyles:pe}=qr({classNames:r,styles:o,props:n}),{styleProps:F,rest:me}=vi(oe),he=y?.id||`${se}-error`,ge=b?.id||`${se}-description`,_e=`${u&&typeof u!=`boolean`?he:``} ${g?ge:``}`,ve=_e.trim().length>0?_e.trim():void 0,ye=(0,L.jsx)(bu,{...de(`visibilityToggle`),disabled:f,radius:T,"aria-hidden":!ee,"aria-pressed":ce,tabIndex:-1,...ee,variant:ee?.variant??`subtle`,color:`gray`,unstyled:s,onTouchEnd:e=>{e.preventDefault(),ee?.onTouchEnd?.(e),ue()},onMouseDown:e=>{e.preventDefault(),ee?.onMouseDown?.(e),ue()},onKeyDown:e=>{ee?.onKeyDown?.(e),e.key===` `&&(e.preventDefault(),ue())},children:(0,L.jsx)(N,{reveal:ce})});return(0,L.jsx)(hd.Wrapper,{required:l,id:se,label:_,error:u,description:g,size:v,classNames:fe,styles:pe,__staticSelector:`PasswordInput`,__stylesApiProps:n,unstyled:s,withAsterisk:S,inputWrapperOrder:C,inputContainer:h,variant:m,labelProps:{...x,htmlFor:se},descriptionProps:{...b,id:ge},errorProps:{...y,id:he},mod:ie,attributes:ae,...de(`root`),...F,...w,children:(0,L.jsx)(hd,{component:`div`,error:u,leftSection:d,size:v,classNames:{...fe,input:Ln(mv.input,fe.input)},styles:pe,radius:T,disabled:f,__staticSelector:`PasswordInput`,__stylesApiProps:n,rightSectionWidth:D,rightSection:E??ye,variant:m,unstyled:s,leftSectionWidth:k,rightSectionPointerEvents:O||`all`,rightSectionProps:P,leftSectionProps:te,leftSectionPointerEvents:ne,withAria:!1,withErrorStyles:re,attributes:ae,children:(0,L.jsx)(`input`,{required:l,"data-invalid":!!u||void 0,"data-with-left-section":!!d||void 0,...de(`innerInput`),disabled:f,id:se,ref:t,...me,"aria-describedby":ve,autoComplete:me.autoComplete||`off`,type:ce?`text`:`password`})})})});_v.classes={...vd.classes,...mv},_v.displayName=`@mantine/core/PasswordInput`;var vv={root:`m_db6d6462`,section:`m_2242eb65`,"stripes-animation":`m_81a374bd`,"stripes-animation-vertical":`m_e0fb7a86`,label:`m_91e40b74`},[yv,bv]=Qe(`Progress.Root component was not found in tree`),xv=B((e,t)=>{let{classNames:n,className:r,style:i,styles:a,vars:o,...s}=R(`ProgressLabel`,null,e),c=bv();return(0,L.jsx)(z,{ref:t,...c.getStyles(`label`,{className:r,style:i,classNames:n,styles:a}),...s})});xv.classes=vv,xv.displayName=`@mantine/core/ProgressLabel`;var Sv=Fn((e,{size:t,radius:n,transitionDuration:r})=>({root:{"--progress-size":ut(t,`progress-size`),"--progress-radius":n===void 0?void 0:ft(n),"--progress-transition-duration":typeof r==`number`?`${r}ms`:void 0}})),Cv=B((e,t)=>{let n=R(`ProgressRoot`,null,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,autoContrast:l,transitionDuration:u,orientation:d,attributes:f,mod:p,...m}=n,h=ui({name:`Progress`,classes:vv,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:f,vars:c,varsResolver:Sv});return(0,L.jsx)(yv,{value:{getStyles:h,autoContrast:l},children:(0,L.jsx)(z,{ref:t,mod:[{orientation:d},p],...h(`root`),...m})})});Cv.classes=vv,Cv.displayName=`@mantine/core/ProgressRoot`;var wv={withAria:!0},Tv=B((e,t)=>{let{classNames:n,className:r,style:i,styles:a,vars:o,value:s,withAria:c,color:l,striped:u,animated:d,mod:f,...p}=R(`ProgressSection`,wv,e),m=bv(),h=Dr(),g=c?{role:`progressbar`,"aria-valuemax":100,"aria-valuemin":0,"aria-valuenow":s,"aria-valuetext":`${s}%`}:{};return(0,L.jsx)(z,{ref:t,...m.getStyles(`section`,{className:r,classNames:n,styles:a,style:i}),...p,...g,mod:[{striped:u||d,animated:d},f],__vars:{"--progress-section-size":`${s}%`,"--progress-section-color":ur(l,h),"--progress-label-color":di(m.autoContrast,h)?Mr({color:l,theme:h,autoContrast:m.autoContrast}):void 0}})});Tv.classes=vv,Tv.displayName=`@mantine/core/ProgressSection`;var Ev=B((e,t)=>{let n=R(`Progress`,null,e),{value:r,classNames:i,styles:a,vars:o,color:s,striped:c,animated:l,"aria-label":u,...d}=n,{resolvedClassNames:f,resolvedStyles:p}=qr({classNames:i,styles:a,props:n});return(0,L.jsx)(Cv,{ref:t,classNames:f,styles:p,vars:o,...d,children:(0,L.jsx)(Tv,{value:r,color:s,striped:c,animated:l,"aria-label":u})})});Ev.classes=vv,Ev.displayName=`@mantine/core/Progress`,Ev.Section=Tv,Ev.Root=Cv,Ev.Label=xv;var Dv={root:`m_f3f1af94`,inner:`m_89c4f5e4`,icon:`m_f3ed6b2b`,radio:`m_8a3dbb89`,"radio--outline":`m_1bfe9d39`},[Ov,kv]=$e(),[Av,jv]=$e(),Mv={card:`m_9dc8ae12`},Nv={withBorder:!0},Pv=Fn((e,{radius:t})=>({card:{"--card-radius":ft(t)}})),Fv=B((e,t)=>{let n=R(`RadioCard`,Nv,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,checked:l,mod:u,withBorder:d,value:f,onClick:p,name:m,onKeyDown:h,attributes:g,..._}=n,v=ui({name:`RadioCard`,classes:Mv,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:g,vars:c,varsResolver:Pv,rootSelector:`card`}),{dir:y}=ea(),b=kv(),x=typeof l==`boolean`?l:b?.value===f||!1,S=m||b?.name,C=e=>{if(h?.(e),[`ArrowDown`,`ArrowUp`,`ArrowLeft`,`ArrowRight`].includes(e.nativeEvent.code)){e.preventDefault();let t=Array.from(document.querySelectorAll(`[role="radio"][name="${S||`__mantine`}"]`)),n=t.findIndex(t=>t===e.target),r=n+1>=t.length?0:n+1,i=n-1<0?t.length-1:n-1;e.nativeEvent.code===`ArrowDown`&&(t[r].focus(),t[r].click()),e.nativeEvent.code===`ArrowUp`&&(t[i].focus(),t[i].click()),e.nativeEvent.code===`ArrowLeft`&&(t[y===`ltr`?i:r].focus(),t[y===`ltr`?i:r].click()),e.nativeEvent.code===`ArrowRight`&&(t[y===`ltr`?r:i].focus(),t[y===`ltr`?r:i].click())}};return(0,L.jsx)(Av,{value:{checked:x},children:(0,L.jsx)(vl,{ref:t,mod:[{"with-border":d,checked:x},u],...v(`card`),..._,role:`radio`,"aria-checked":x,name:S,onClick:e=>{p?.(e),b?.onChange(f||``)},onKeyDown:C})})});Fv.displayName=`@mantine/core/RadioCard`,Fv.classes=Mv;var Iv=B((e,t)=>{let{value:n,defaultValue:r,onChange:i,size:a,wrapperProps:o,children:s,name:c,readOnly:l,disabled:u,...d}=R(`RadioGroup`,null,e),f=Zt(c),[p,m]=ln({value:n,defaultValue:r,finalValue:``,onChange:i});return(0,L.jsx)(Ov,{value:{value:p,onChange:e=>!l&&m(typeof e==`string`?e:e.currentTarget.value),size:a,name:f,disabled:u},children:(0,L.jsx)(hd.Wrapper,{size:a,ref:t,...o,...d,labelElement:`div`,__staticSelector:`RadioGroup`,children:(0,L.jsx)(rp,{role:`radiogroup`,children:s})})})});Iv.classes=hd.Wrapper.classes,Iv.displayName=`@mantine/core/RadioGroup`;function Lv({size:e,style:t,...n}){return(0,L.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 5 5`,style:{width:I(e),height:I(e),...t},"aria-hidden":!0,...n,children:(0,L.jsx)(`circle`,{cx:`2.5`,cy:`2.5`,r:`2.5`,fill:`currentColor`})})}var Rv={indicator:`m_717d7ff6`,icon:`m_3e4da632`,"indicator--outline":`m_2980836c`},zv={icon:Lv},Bv=Fn((e,{radius:t,color:n,size:r,iconColor:i,variant:a,autoContrast:o})=>{let s=lr({color:n||e.primaryColor,theme:e}),c=s.isThemeColor&&s.shade===void 0?`var(--mantine-color-${s.color}-outline)`:s.color;return{indicator:{"--radio-size":ut(r,`radio-size`),"--radio-radius":t===void 0?void 0:ft(t),"--radio-color":a===`outline`?c:ur(n,e),"--radio-icon-size":ut(r,`radio-icon-size`),"--radio-icon-color":i?ur(i,e):di(o,e)?Mr({color:n,theme:e,autoContrast:o}):void 0}}}),Vv=B((e,t)=>{let n=R(`RadioIndicator`,zv,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,icon:l,radius:u,color:d,iconColor:f,autoContrast:p,checked:m,mod:h,variant:g,disabled:_,attributes:v,...y}=n,b=ui({name:`RadioIndicator`,classes:Rv,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:v,vars:c,varsResolver:Bv,rootSelector:`indicator`}),x=jv(),S=typeof m==`boolean`?m:x?.checked||!1;return(0,L.jsx)(z,{ref:t,...b(`indicator`,{variant:g}),variant:g,mod:[{checked:S,disabled:_},h],...y,children:(0,L.jsx)(l,{...b(`icon`)})})});Vv.displayName=`@mantine/core/RadioIndicator`,Vv.classes=Rv;var Hv={labelPosition:`right`},Uv=Fn((e,{size:t,radius:n,color:r,iconColor:i,variant:a,autoContrast:o})=>{let s=lr({color:r||e.primaryColor,theme:e}),c=s.isThemeColor&&s.shade===void 0?`var(--mantine-color-${s.color}-outline)`:s.color;return{root:{"--radio-size":ut(t,`radio-size`),"--radio-radius":n===void 0?void 0:ft(n),"--radio-color":a===`outline`?c:ur(r,e),"--radio-icon-color":i?ur(i,e):di(o,e)?Mr({color:r,theme:e,autoContrast:o}):void 0,"--radio-icon-size":ut(t,`radio-icon-size`)}}}),Wv=B((e,t)=>{let n=R(`Radio`,Hv,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,id:l,size:u,label:d,labelPosition:f,description:p,error:m,radius:h,color:g,variant:_,disabled:v,wrapperProps:y,icon:b=Lv,rootRef:x,iconColor:S,onChange:C,mod:w,attributes:T,checked:E,...D}=n,O=ui({name:`Radio`,classes:Dv,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:T,vars:c,varsResolver:Uv}),k=kv(),A=k?.size??u,j=n.size?u:A,{styleProps:M,rest:N}=vi(D),ee=Zt(l),P=k?k.value===N.value:void 0,te={checked:P??E,name:k?.name??N.name,onChange:e=>{k?.onChange(e),C?.(e)},disabled:k?.disabled??v};return(0,L.jsx)(Kf,{...O(`root`),__staticSelector:`Radio`,__stylesApiProps:n,id:ee,size:j,labelPosition:f,label:d,description:p,error:m,disabled:te.disabled,classNames:r,styles:o,unstyled:s,"data-checked":(P??E)||void 0,variant:_,ref:x,mod:w,...M,...y,children:(0,L.jsxs)(z,{...O(`inner`),mod:{"label-position":f},children:[(0,L.jsx)(z,{...O(`radio`,{focusable:!0,variant:_}),...N,...te,component:`input`,mod:{error:!!m},ref:t,id:ee,type:`radio`}),(0,L.jsx)(b,{...O(`icon`),"aria-hidden":!0})]})})});Wv.classes=Dv,Wv.displayName=`@mantine/core/Radio`,Wv.Group=Iv,Wv.Card=Fv,Wv.Indicator=Vv;var Gv={duration:100,transition:`fade`};function Kv(e,t){return{...Gv,...t,...e}}var qv={tooltip:`m_1b3c8819`,arrow:`m_f898399f`};function Jv({offset:e,position:t,defaultOpened:n}){let[r,i]=(0,b.useState)(n),a=(0,b.useRef)(null),{x:o,y:s,elements:c,refs:l,update:u,placement:d}=Oc({placement:t,middleware:[Rs({crossAxis:!0,padding:5,rootBoundary:`document`})]}),f=d.includes(`right`)?e:t.includes(`left`)?e*-1:0,p=d.includes(`bottom`)?e:t.includes(`top`)?e*-1:0,m=(0,b.useCallback)(({clientX:e,clientY:t})=>{l.setPositionReference({getBoundingClientRect(){return{width:0,height:0,x:e,y:t,left:e+f,top:t+p,right:e,bottom:t}}})},[c.reference]);return(0,b.useEffect)(()=>{if(l.floating.current){let e=a.current;e.addEventListener(`mousemove`,m);let t=Ea(l.floating.current);return t.forEach(e=>{e.addEventListener(`scroll`,u)}),()=>{e.removeEventListener(`mousemove`,m),t.forEach(e=>{e.removeEventListener(`scroll`,u)})}}},[c.reference,l.floating.current,u,m,r]),{handleMouseMove:m,x:o,y:s,opened:r,setOpened:i,boundaryRef:a,floating:l.setFloating}}var Yv={refProp:`ref`,withinPortal:!0,offset:10,position:`right`,zIndex:st(`popover`)},Xv=Fn((e,{radius:t,color:n})=>({tooltip:{"--tooltip-radius":t===void 0?void 0:ft(t),"--tooltip-bg":n?ur(n,e):void 0,"--tooltip-color":n?`var(--mantine-color-white)`:void 0}})),Zv=B((e,t)=>{let n=R(`TooltipFloating`,Yv,e),{children:r,refProp:i,withinPortal:a,style:o,className:s,classNames:c,styles:l,unstyled:u,radius:d,color:f,label:p,offset:m,position:h,multiline:g,zIndex:_,disabled:v,defaultOpened:y,variant:x,vars:S,portalProps:C,attributes:w,...T}=n,E=Dr(),D=ui({name:`TooltipFloating`,props:n,classes:qv,className:s,style:o,classNames:c,styles:l,unstyled:u,attributes:w,rootSelector:`tooltip`,vars:S,varsResolver:Xv}),{handleMouseMove:O,x:k,y:A,opened:j,boundaryRef:M,floating:N,setOpened:ee}=Jv({offset:m,position:h,defaultOpened:y}),P=Pn(r);if(!P)throw 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`);let te=cn(M,An(P),t),ne=P.props,re=e=>{ne.onMouseEnter?.(e),O(e),ee(!0)},ie=e=>{ne.onMouseLeave?.(e),ee(!1)};return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Rl,{...C,withinPortal:a,children:(0,L.jsx)(z,{...T,...D(`tooltip`,{style:{...Hi(o,E),zIndex:_,display:!v&&j?`block`:`none`,top:(A&&Math.round(A))??``,left:(k&&Math.round(k))??``}}),variant:x,ref:N,mod:{multiline:g},children:p})}),(0,b.cloneElement)(P,{...ne,[i]:te,onMouseEnter:re,onMouseLeave:ie})]})});Zv.classes=qv,Zv.displayName=`@mantine/core/TooltipFloating`;var Qv=(0,b.createContext)(!1),$v=Qv.Provider,ey=()=>(0,b.useContext)(Qv),ty={openDelay:0,closeDelay:0};function ny(e){let{openDelay:t,closeDelay:n,children:r}=R(`TooltipGroup`,ty,e);return(0,L.jsx)($v,{value:!0,children:(0,L.jsx)(xc,{delay:{open:t,close:n},children:r})})}ny.displayName=`@mantine/core/TooltipGroup`,ny.extend=e=>e;function ry(e){if(e===void 0)return{shift:!0,flip:!0};let t={...e};return e.shift===void 0&&(t.shift=!0),e.flip===void 0&&(t.flip=!0),t}function iy(e){let t=ry(e.middlewares),n=[Ls(e.offset)];return t.shift&&n.push(Rs(typeof t.shift==`boolean`?{padding:8}:{padding:8,...t.shift})),t.flip&&n.push(typeof t.flip==`boolean`?Bs():Bs(t.flip)),n.push(Ws({element:e.arrowRef,padding:e.arrowOffset})),t.inline?n.push(typeof t.inline==`boolean`?Us():Us(t.inline)):e.inline&&n.push(Us()),n}function ay(e){let[t,n]=(0,b.useState)(e.defaultOpened),r=typeof e.opened==`boolean`?e.opened:t,i=ey(),a=Zt(),o=(0,b.useCallback)(e=>{n(e),e&&g(a)},[a]),{x:s,y:c,context:l,refs:u,placement:d,middlewareData:{arrow:{x:f,y:p}={}}}=Oc({strategy:e.strategy,placement:e.position,open:r,onOpenChange:o,middleware:iy(e),whileElementsMounted:ys}),{delay:m,currentId:h,setCurrentId:g}=Sc(l,{id:a}),{getReferenceProps:_,getFloatingProps:v}=Mc([_c(l,{enabled:e.events?.hover,delay:i?m:{open:e.openDelay,close:e.closeDelay},mouseOnly:!e.events?.touch}),Ac(l,{enabled:e.events?.focus,visibleOnly:!0}),Pc(l,{role:`tooltip`}),Ec(l,{enabled:e.opened===void 0})]);Ft(()=>{e.onPositionChange?.(d)},[d]);let y=r&&h&&h!==a;return{x:s,y:c,arrowX:f,arrowY:p,reference:u.setReference,floating:u.setFloating,getFloatingProps:v,getReferenceProps:_,isGroupPhase:y,opened:r,placement:d}}var oy={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:st(`popover`),positionDependencies:[],middlewares:{flip:!0,shift:!0,inline:!1}},sy=Fn((e,{radius:t,color:n,variant:r,autoContrast:i})=>{let a=e.variantColorResolver({theme:e,color:n||e.primaryColor,autoContrast:i,variant:r||`filled`});return{tooltip:{"--tooltip-radius":t===void 0?void 0:ft(t),"--tooltip-bg":n?a.background:void 0,"--tooltip-color":n?a.color:void 0}}}),cy=B((e,t)=>{let n=R(`Tooltip`,oy,e),{children:r,position:i,refProp:a,label:o,openDelay:s,closeDelay:c,onPositionChange:l,opened:u,defaultOpened:d,withinPortal:f,radius:p,color:m,classNames:h,styles:g,unstyled:_,style:v,className:y,withArrow:x,arrowSize:S,arrowOffset:C,arrowRadius:w,arrowPosition:T,offset:E,transitionProps:D,multiline:O,events:k,zIndex:A,disabled:j,positionDependencies:M,onClick:N,onMouseEnter:ee,onMouseLeave:P,inline:te,variant:ne,keepMounted:re,vars:ie,portalProps:ae,mod:oe,floatingStrategy:se,middlewares:ce,autoContrast:le,attributes:ue,target:de,...fe}=R(`Tooltip`,oy,n),{dir:pe}=ea(),F=(0,b.useRef)(null),me=ay({position:kl(pe,i),closeDelay:c,openDelay:s,onPositionChange:l,opened:u,defaultOpened:d,events:k,arrowRef:F,arrowOffset:C,offset:typeof E==`number`?E+(x?S/2:0):E,positionDependencies:[...M,de??r],inline:te,strategy:se,middlewares:ce});(0,b.useEffect)(()=>{let e=de instanceof HTMLElement?de:typeof de==`string`?document.querySelector(de):de?.current||null;e&&me.reference(e)},[de,me]);let he=ui({name:`Tooltip`,props:n,classes:qv,className:y,style:v,classNames:h,styles:g,unstyled:_,attributes:ue,rootSelector:`tooltip`,vars:ie,varsResolver:sy}),ge=Pn(r);if(!de&&!ge)throw Error(`[@mantine/core] Tooltip component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported`);if(de){let e=Kv(D,{duration:100,transition:`fade`});return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(Rl,{...ae,withinPortal:f,children:(0,L.jsx)(Wl,{...e,keepMounted:re,mounted:!j&&!!me.opened,duration:me.isGroupPhase?10:e.duration,children:e=>(0,L.jsxs)(z,{...fe,"data-fixed":se===`fixed`||void 0,variant:ne,mod:[{multiline:O},oe],...me.getFloatingProps({ref:me.floating,className:he(`tooltip`).className,style:{...he(`tooltip`).style,...e,zIndex:A,top:me.y??0,left:me.x??0}}),children:[o,(0,L.jsx)(Ol,{ref:F,arrowX:me.arrowX,arrowY:me.arrowY,visible:x,position:me.placement,arrowSize:S,arrowOffset:C,arrowRadius:w,arrowPosition:T,...he(`arrow`)})]})})})})}let _e=ge.props,ve=cn(me.reference,An(ge),t),ye=Kv(D,{duration:100,transition:`fade`});return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Rl,{...ae,withinPortal:f,children:(0,L.jsx)(Wl,{...ye,keepMounted:re,mounted:!j&&!!me.opened,duration:me.isGroupPhase?10:ye.duration,children:e=>(0,L.jsxs)(z,{...fe,"data-fixed":se===`fixed`||void 0,variant:ne,mod:[{multiline:O},oe],...me.getFloatingProps({ref:me.floating,className:he(`tooltip`).className,style:{...he(`tooltip`).style,...e,zIndex:A,top:me.y??0,left:me.x??0}}),children:[o,(0,L.jsx)(Ol,{ref:F,arrowX:me.arrowX,arrowY:me.arrowY,visible:x,position:me.placement,arrowSize:S,arrowOffset:C,arrowRadius:w,arrowPosition:T,...he(`arrow`)})]})})}),(0,b.cloneElement)(ge,me.getReferenceProps({onClick:N,onMouseEnter:ee,onMouseLeave:P,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,..._e,className:Ln(y,_e.className),[a]:ve}))]})});cy.classes=qv,cy.displayName=`@mantine/core/Tooltip`,cy.Floating=Zv,cy.Group=ny;function ly({size:e,thickness:t,sum:n,value:r,root:i,offset:a}){let o=(e*.9-t*2)/2,s=Math.PI*o*2/100,c=i||r===void 0?`${(100-n)*s}, ${n*s}`:`${r*s}, ${(100-r)*s}`;return{strokeWidth:Number.isNaN(t)?12:t,cx:e/2||0,cy:e/2||0,r:o||0,transform:i?`scale(1, -1) translate(0, -${e})`:void 0,strokeDasharray:c,strokeDashoffset:i?0:a||0}}function uy({size:e,value:t,offset:n,sum:r,thickness:i,root:a,color:o,lineRoundCaps:s,tooltip:c,getStyles:l,display:u,...d}){let f=Dr();return(0,L.jsx)(cy.Floating,{disabled:!c,label:c,children:(0,L.jsx)(z,{component:`circle`,...d,...l(`curve`),__vars:{"--curve-color":o?ur(o,f):void 0},fill:`none`,strokeLinecap:s?`round`:`butt`,...ly({sum:r,size:e,thickness:i,value:t,offset:n,root:a})})})}uy.displayName=`@mantine/core/Curve`;function dy({size:e,thickness:t,sections:n,renderRoundedLineCaps:r,rootColor:i}){let a=n.reduce((e,t)=>e+t.value,0),o=Math.PI*((e*.9-t*2)/2)*2,s=o,c=[],l=[];for(let e=0;e<n.length;e+=1)c.push({sum:a,offset:s,data:n[e],root:!1}),s-=n[e].value/100*o;if(c.push({sum:a,offset:s,data:{color:i},root:!0}),l.push({...c[c.length-1],lineRoundCaps:!1}),c.length>2){l.push({...c[0],lineRoundCaps:r}),l.push({...c[c.length-2],lineRoundCaps:r});for(let e=1;e<=c.length-3;e+=1)l.push({...c[e],lineRoundCaps:!1})}else l.push({...c[0],lineRoundCaps:r});return l}var fy={root:`m_b32e4812`,svg:`m_d43b5134`,curve:`m_b1ca1fbf`,label:`m_b23f9dc4`};function py(e,t){return Math.min(e||12,(t||120)/4)}var my={size:120,thickness:12},hy=Fn((e,{size:t,thickness:n,transitionDuration:r})=>({root:{"--rp-size":I(t),"--rp-label-offset":I(n*2),"--rp-transition-duration":r?`${r}ms`:void 0}})),gy=B((e,t)=>{let n=R(`RingProgress`,my,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,label:l,sections:u,size:d,thickness:f,roundCaps:p,rootColor:m,transitionDuration:h,attributes:g,..._}=n,v=ui({name:`RingProgress`,classes:fy,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:g,vars:c,varsResolver:hy}),y=py(f,d),x=dy({size:d,thickness:y,sections:u,renderRoundedLineCaps:p,rootColor:m}).map(({data:e,sum:t,root:n,lineRoundCaps:r,offset:i},a)=>(0,b.createElement)(uy,{...e,key:a,size:d,thickness:y,sum:t,offset:i,color:e?.color,root:n,lineRoundCaps:r,getStyles:v}));return(0,L.jsxs)(z,{...v(`root`),size:d,ref:t,..._,children:[(0,L.jsx)(`svg`,{...v(`svg`),children:x}),l&&(0,L.jsx)(`div`,{...v(`label`),children:l})]})});gy.classes=fy,gy.displayName=`@mantine/core/RingProgress`;var _y={root:`m_cf365364`,indicator:`m_9e182ccd`,label:`m_1738fcb2`,input:`m_1714d588`,control:`m_69686b9b`,innerLabel:`m_78882f40`},vy={withItemsBorders:!0},yy=Fn((e,{radius:t,color:n,transitionDuration:r,size:i,transitionTimingFunction:a})=>({root:{"--sc-radius":t===void 0?void 0:ft(t),"--sc-color":n?ur(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":a,"--sc-padding":ut(i,`sc-padding`),"--sc-font-size":pt(i)}})),by=B((e,t)=>{let n=R(`SegmentedControl`,vy,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,data:l,value:u,defaultValue:d,onChange:f,size:p,name:m,disabled:h,readOnly:g,fullWidth:_,orientation:v,radius:y,color:x,transitionDuration:S,transitionTimingFunction:C,variant:w,autoContrast:T,withItemsBorders:E,mod:D,attributes:O,...k}=n,A=ui({name:`SegmentedControl`,props:n,classes:_y,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:O,vars:c,varsResolver:yy}),j=Dr(),M=l.map(e=>typeof e==`string`?{label:e,value:e}:e),N=On(),[ee,P]=(0,b.useState)(St()),[te,ne]=(0,b.useState)(null),[re,ie]=(0,b.useState)({}),ae=(e,t)=>{re[t]=e,ie(re)},[oe,se]=ln({value:u,defaultValue:d,finalValue:Array.isArray(l)?M.find(e=>!e.disabled)?.value??l[0]?.value??null:null,onChange:f}),ce=Zt(m),le=M.map(e=>(0,b.createElement)(z,{...A(`control`),mod:{active:oe===e.value,orientation:v},key:e.value},(0,b.createElement)(`input`,{...A(`input`),disabled:h||e.disabled,type:`radio`,name:ce,value:e.value,id:`${ce}-${e.value}`,checked:oe===e.value,onChange:()=>!g&&se(e.value),"data-focus-ring":j.focusRing,key:`${e.value}-input`}),(0,b.createElement)(z,{component:`label`,...A(`label`),mod:{active:oe===e.value&&!(h||e.disabled),disabled:h||e.disabled,"read-only":g},htmlFor:`${ce}-${e.value}`,ref:t=>ae(t,e.value),__vars:{"--sc-label-color":x===void 0?void 0:Mr({color:x,theme:j,autoContrast:T})},key:`${e.value}-label`},(0,L.jsx)(`span`,{...A(`innerLabel`),children:e.label})))),ue=cn(t,e=>ne(e));return gn(()=>{P(St())},[l.length]),l.length===0?null:(0,L.jsxs)(z,{...A(`root`),variant:w,size:p,ref:ue,mod:[{"full-width":_,orientation:v,initialized:N,"with-items-borders":E},D],...k,role:`radiogroup`,"data-disabled":h,children:[typeof oe==`string`&&(0,L.jsx)(Ed,{target:re[oe],parent:te,component:`span`,transitionDuration:`var(--sc-transition-duration)`,...A(`indicator`)},ee),le]})});by.classes=_y,by.displayName=`@mantine/core/SegmentedControl`;var xy={withCheckIcon:!0,allowDeselect:!0,checkIconPosition:`left`,openOnFocus:!0},Sy=B((e,t)=>{let n=R(`Select`,xy,e),{classNames:r,styles:i,unstyled:a,vars:o,dropdownOpened:s,defaultDropdownOpened:c,onDropdownClose:l,onDropdownOpen:u,onFocus:d,onBlur:f,onClick:p,onChange:m,data:h,value:g,defaultValue:_,selectFirstOptionOnChange:v,selectFirstOptionOnDropdownOpen:y,onOptionSubmit:x,comboboxProps:S,readOnly:C,disabled:w,filter:T,limit:E,withScrollArea:D,maxDropdownHeight:O,size:k,searchable:A,rightSection:j,checkIconPosition:M,withCheckIcon:N,withAlignedLabels:ee,nothingFoundMessage:P,name:te,form:ne,searchValue:re,defaultSearchValue:ie,onSearchChange:ae,allowDeselect:oe,error:se,rightSectionPointerEvents:ce,id:le,clearable:ue,clearButtonProps:de,hiddenInputProps:fe,renderOption:pe,onClear:F,autoComplete:me,scrollAreaProps:he,__defaultRightSection:ge,__clearSection:_e,__clearable:ve,chevronColor:ye,autoSelectOnBlur:be,openOnFocus:xe,attributes:Se,...Ce}=n,we=(0,b.useMemo)(()=>df(h),[h]),Te=(0,b.useRef)({}),Ee=(0,b.useMemo)(()=>ff(we),[we]),De=Zt(le),[Oe,ke,Ae]=ln({value:g,defaultValue:_,finalValue:null,onChange:m}),je=typeof Oe==`string`?Oe in Ee?Ee[Oe]:Te.current[Oe]:void 0,Me=En(je),[Ne,Pe,Fe]=ln({value:re,defaultValue:ie,finalValue:je?je.label:``,onChange:ae}),Ie=Bf({opened:s,defaultOpened:c,onDropdownOpen:()=>{u?.(),y?Ie.selectFirstOption():Ie.updateSelectedOptionIndex(`active`,{scrollIntoView:!0})},onDropdownClose:()=>{l?.(),setTimeout(Ie.resetSelectedOption,0)}}),Le=e=>{Pe(e),Ie.resetSelectedOption()},{resolvedClassNames:Re,resolvedStyles:ze}=qr({props:n,styles:i,classNames:r});(0,b.useEffect)(()=>{v&&Ie.selectFirstOption()},[v,Ne]),(0,b.useEffect)(()=>{g===null&&Le(``),typeof g==`string`&&je&&(Me?.value!==je.value||Me?.label!==je.label)&&Le(je.label)},[g,je]),(0,b.useEffect)(()=>{!Ae&&!Fe&&Le(typeof Oe==`string`?Oe in Ee?Ee[Oe]?.label:Te.current[Oe]?.label||``:``)},[Ee,Oe]),(0,b.useEffect)(()=>{Oe&&Oe in Ee&&(Te.current[Oe]=Ee[Oe])},[Ee,Oe]);let Be=(0,L.jsx)(Uf.ClearButton,{...de,onClear:()=>{ke(null,null),Le(``),F?.()}}),Ve=ue&&!!Oe&&!w&&!C;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Uf,{store:Ie,__staticSelector:`Select`,classNames:Re,styles:ze,unstyled:a,readOnly:C,size:k,attributes:Se,keepMounted:be,onOptionSubmit:e=>{x?.(e);let t=oe&&Ee[e].value===Oe?null:Ee[e],n=t?t.value:null;n!==Oe&&ke(n,t),!Ae&&Le(typeof n==`string`&&t?.label||``),Ie.closeDropdown()},...S,children:[(0,L.jsx)(Uf.Target,{targetType:A?`input`:`button`,autoComplete:me,children:(0,L.jsx)(vd,{id:De,ref:t,__defaultRightSection:(0,L.jsx)(Uf.Chevron,{size:k,error:se,unstyled:a,color:ye}),__clearSection:Be,__clearable:Ve,rightSection:j,rightSectionPointerEvents:ce||`none`,...Ce,size:k,__staticSelector:`Select`,disabled:w,readOnly:C||!A,value:Ne,onChange:e=>{Le(e.currentTarget.value),Ie.openDropdown(),v&&Ie.selectFirstOption()},onFocus:e=>{xe&&A&&Ie.openDropdown(),d?.(e)},onBlur:e=>{be&&Ie.clickSelectedOption(),A&&Ie.closeDropdown();let t=typeof Oe==`string`&&(Oe in Ee?Ee[Oe]:Te.current[Oe]);Le(t&&t.label||``),f?.(e)},onClick:e=>{A?Ie.openDropdown():Ie.toggleDropdown(),p?.(e)},classNames:Re,styles:ze,unstyled:a,pointer:!A,error:se,attributes:Se})}),(0,L.jsx)(bp,{data:we,hidden:C||w,filter:T,search:Ne,limit:E,hiddenWhenEmpty:!P,withScrollArea:D,maxDropdownHeight:O,filterOptions:!!A&&je?.label!==Ne,value:Oe,checkIconPosition:M,withCheckIcon:N,withAlignedLabels:ee,nothingFoundMessage:P,unstyled:a,labelId:Ce.label?`${De}-label`:void 0,"aria-label":Ce.label?void 0:Ce[`aria-label`],renderOption:pe,scrollAreaProps:he})]}),(0,L.jsx)(Uf.HiddenInput,{value:Oe,name:te,form:ne,disabled:w,...fe})]})});Sy.classes={...vd.classes,...Uf.classes},Sy.displayName=`@mantine/core/Select`;var Cy={container:`m_925c2d2c`,root:`m_2415a157`};function wy({spacing:e,verticalSpacing:t,cols:n,selector:r}){let i=Dr(),a=t===void 0?e:t,o=Je({"--sg-spacing-x":dt(yt(e)),"--sg-spacing-y":dt(yt(a)),"--sg-cols":yt(n)?.toString()}),s=ze(i.breakpoints).reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=dt(e[r])),typeof a==`object`&&a[r]!==void 0&&(t[r][`--sg-spacing-y`]=dt(a[r])),typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),c=vt(ze(s),i.breakpoints).filter(e=>ze(s[e.value]).length>0).map(e=>({query:`(min-width: ${i.breakpoints[e.value]})`,styles:s[e.value]}));return(0,L.jsx)(_i,{styles:o,media:c,selector:r})}function Ty(e){return typeof e==`object`&&e?ze(e):[]}function Ey(e){return e.sort((e,t)=>We(e)-We(t))}function Dy({spacing:e,verticalSpacing:t,cols:n}){return Ey(Array.from(new Set([...Ty(e),...Ty(t),...Ty(n)])))}function Oy({spacing:e,verticalSpacing:t,cols:n,selector:r}){let i=t===void 0?e:t,a=Je({"--sg-spacing-x":dt(yt(e)),"--sg-spacing-y":dt(yt(i)),"--sg-cols":yt(n)?.toString()}),o=Dy({spacing:e,verticalSpacing:t,cols:n}),s=o.reduce((t,r)=>(t[r]||(t[r]={}),typeof e==`object`&&e[r]!==void 0&&(t[r][`--sg-spacing-x`]=dt(e[r])),typeof i==`object`&&i[r]!==void 0&&(t[r][`--sg-spacing-y`]=dt(i[r])),typeof n==`object`&&n[r]!==void 0&&(t[r][`--sg-cols`]=n[r]),t),{}),c=o.map(e=>({query:`simple-grid (min-width: ${e})`,styles:s[e]}));return(0,L.jsx)(_i,{styles:a,container:c,selector:r})}var ky={cols:1,spacing:`md`,type:`media`},Ay=B((e,t)=>{let n=R(`SimpleGrid`,ky,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,cols:l,verticalSpacing:u,spacing:d,type:f,attributes:p,...m}=n,h=ui({name:`SimpleGrid`,classes:Cy,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:p,vars:c}),g=Vi();return f===`container`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Oy,{...n,selector:`.${g}`}),(0,L.jsx)(`div`,{...h(`container`),children:(0,L.jsx)(z,{ref:t,...h(`root`,{className:g}),...m})})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(wy,{...n,selector:`.${g}`}),(0,L.jsx)(z,{ref:t,...h(`root`,{className:g}),...m})]})});Ay.classes=Cy,Ay.displayName=`@mantine/core/SimpleGrid`;var jy={root:`m_18320242`,"skeleton-fade":`m_299c329c`},My={visible:!0,animate:!0},Ny=Fn((e,{width:t,height:n,radius:r,circle:i})=>({root:{"--skeleton-height":I(n),"--skeleton-width":I(i?n:t),"--skeleton-radius":i?`1000px`:r===void 0?void 0:ft(r)}})),Py=B((e,t)=>{let n=R(`Skeleton`,My,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,width:l,height:u,circle:d,visible:f,radius:p,animate:m,mod:h,attributes:g,..._}=n,v=ui({name:`Skeleton`,classes:jy,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:g,vars:c,varsResolver:Ny});return(0,L.jsx)(z,{ref:t,...v(`root`),mod:[{visible:f,animate:m},h],..._})});Py.classes=jy,Py.displayName=`@mantine/core/Skeleton`;var Fy=B((e,t)=>{let{w:n,h:r,miw:i,mih:a,...o}=R(`Space`,null,e);return(0,L.jsx)(z,{ref:t,...o,w:n,miw:i??n,h:r,mih:a??r})});Fy.displayName=`@mantine/core/Space`;var Iy={root:`m_6d731127`},Ly={gap:`md`,align:`stretch`,justify:`flex-start`},Ry=Fn((e,{gap:t,align:n,justify:r})=>({root:{"--stack-gap":dt(t),"--stack-align":n,"--stack-justify":r}})),W=B((e,t)=>{let n=R(`Stack`,Ly,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,align:l,justify:u,gap:d,variant:f,attributes:p,...m}=n,h=ui({name:`Stack`,props:n,classes:Iy,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:p,vars:c,varsResolver:Ry});return(0,L.jsx)(z,{ref:t,...h(`root`),variant:f,...m})});W.classes=Iy,W.displayName=`@mantine/core/Stack`;var[zy,By]=Qe(`Stepper component was not found in tree`),Vy={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`},Hy=()=>null;Hy.displayName=`@mantine/core/StepperCompleted`;var Uy=(e,t)=>typeof e==`function`?(0,L.jsx)(e,{step:t||0}):e,Wy={withIcon:!0,allowStepClick:!0,iconPosition:`left`},Gy=B((e,t)=>{let{classNames:n,className:r,style:i,styles:a,vars:o,step:s,state:c,color:l,icon:u,completedIcon:d,progressIcon:f,label:p,description:m,withIcon:h,iconSize:g,loading:_,allowStepClick:v,allowStepSelect:y,iconPosition:b,orientation:x,mod:S,...C}=R(`StepperStep`,Wy,e),w=By(),T=Dr(),E={classNames:n,styles:a},D=c===`stepCompleted`?null:c===`stepProgress`?f:u,O={"data-progress":c===`stepProgress`||void 0,"data-completed":c===`stepCompleted`||void 0};return(0,L.jsxs)(vl,{...w.getStyles(`step`,{className:r,style:i,variant:w.orientation,...E}),mod:[{"icon-position":b||w.iconPosition,"allow-click":v},S],ref:t,...O,...C,__vars:{"--step-color":l?ur(l,T):void 0},tabIndex:v?0:-1,children:[h&&(0,L.jsxs)(`span`,{...w.getStyles(`stepWrapper`,E),children:[(0,L.jsxs)(`span`,{...w.getStyles(`stepIcon`,E),...O,children:[(0,L.jsx)(Wl,{mounted:c===`stepCompleted`,transition:`pop`,duration:200,children:e=>(0,L.jsx)(`span`,{...w.getStyles(`stepCompletedIcon`,{style:e,...E}),children:_?(0,L.jsx)(fu,{color:`var(--mantine-color-white)`,size:`calc(var(--stepper-icon-size) / 2)`,...w.getStyles(`stepLoader`,E)}):Uy(d,s)||(0,L.jsx)(ap,{size:`60%`})})}),c===`stepCompleted`?null:(0,L.jsx)(`span`,{children:_?(0,L.jsx)(fu,{...w.getStyles(`stepLoader`,E),size:`calc(var(--stepper-icon-size) / 2)`,color:l}):Uy(D||u,s)})]}),x===`vertical`&&(0,L.jsx)(`span`,{...w.getStyles(`verticalSeparator`,E),"data-active":c===`stepCompleted`||void 0})]}),(p||m)&&(0,L.jsxs)(`span`,{...w.getStyles(`stepBody`,E),"data-orientation":w.orientation,"data-icon-position":b||w.iconPosition,children:[p&&(0,L.jsx)(`span`,{...w.getStyles(`stepLabel`,E),children:Uy(p,s)}),m&&(0,L.jsx)(`span`,{...w.getStyles(`stepDescription`,E),children:Uy(m,s)})]})]})});Gy.classes=Vy,Gy.displayName=`@mantine/core/StepperStep`;var Ky={orientation:`horizontal`,iconPosition:`left`,allowNextStepsSelect:!0,wrap:!0},qy=Fn((e,{color:t,iconSize:n,size:r,contentPadding:i,radius:a,autoContrast:o})=>({root:{"--stepper-color":t?ur(t,e):void 0,"--stepper-icon-color":di(o,e)?Mr({color:t,theme:e,autoContrast:o}):void 0,"--stepper-icon-size":n===void 0?ut(r,`stepper-icon-size`):I(n),"--stepper-content-padding":dt(i),"--stepper-radius":a===void 0?void 0:ft(a),"--stepper-fz":pt(r),"--stepper-spacing":dt(r)}})),Jy=B((e,t)=>{let n=R(`Stepper`,Ky,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,children:l,onStepClick:u,active:d,icon:f,completedIcon:p,progressIcon:m,color:h,iconSize:g,contentPadding:_,orientation:v,iconPosition:y,size:x,radius:S,allowNextStepsSelect:C,wrap:w,autoContrast:T,attributes:E,...D}=n,O=ui({name:`Stepper`,classes:Vy,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:E,vars:c,varsResolver:qy}),k=b.Children.toArray(l),A=k.filter(e=>e.type!==Hy),j=k.find(e=>e.type===Hy),M=A.reduce((e,t,n)=>{let r=d===n?`stepProgress`:d>n?`stepCompleted`:`stepInactive`,i=typeof u==`function`?typeof t.props.allowStepSelect==`boolean`?t.props.allowStepSelect:r===`stepCompleted`||C:!1;return e.push((0,b.cloneElement)(t,{icon:t.props.icon||f||n+1,key:n,step:n,state:r,onClick:()=>i&&u?.(n),allowStepClick:i,completedIcon:t.props.completedIcon||p,progressIcon:t.props.progressIcon||m,color:t.props.color||h,iconSize:g,iconPosition:t.props.iconPosition||y,orientation:v})),v===`horizontal`&&n!==A.length-1&&e.push((0,b.createElement)(`div`,{...O(`separator`),"data-active":n<d||void 0,"data-orientation":v,key:`separator-${n}`})),e},[]),N=A[d]?.props?.children,ee=j?.props?.children,P=d>A.length-1?ee:N;return(0,L.jsx)(zy,{value:{getStyles:O,orientation:v,iconPosition:y},children:(0,L.jsxs)(z,{...O(`root`),ref:t,size:x,...D,children:[(0,L.jsx)(z,{...O(`steps`),mod:{orientation:v,"icon-position":y,wrap:w&&v!==`vertical`},children:M}),P&&(0,L.jsx)(`div`,{...O(`content`),children:P})]})})});Jy.classes=Vy,Jy.displayName=`@mantine/core/Stepper`,Jy.Completed=Hy,Jy.Step=Gy;var Yy={root:`m_5f93f3bb`,input:`m_926b4011`,track:`m_9307d992`,thumb:`m_93039a1d`,trackLabel:`m_8277e082`},Xy=(0,b.createContext)(null),Zy=Xy.Provider,Qy=()=>(0,b.useContext)(Xy),$y=B((e,t)=>{let{value:n,defaultValue:r,onChange:i,size:a,wrapperProps:o,children:s,readOnly:c,disabled:l,...u}=R(`SwitchGroup`,null,e),[d,f]=ln({value:n,defaultValue:r,finalValue:[],onChange:i});return(0,L.jsx)(Zy,{value:{value:d,onChange:e=>{let t=e.currentTarget.value;!c&&f(d.includes(t)?d.filter(e=>e!==t):[...d,t])},size:a,disabled:l},children:(0,L.jsx)(hd.Wrapper,{size:a,ref:t,...o,...u,labelElement:`div`,__staticSelector:`SwitchGroup`,children:(0,L.jsx)(rp,{role:`group`,children:s})})})});$y.classes=hd.Wrapper.classes,$y.displayName=`@mantine/core/SwitchGroup`;var eb={labelPosition:`right`,withThumbIndicator:!0},tb=Fn((e,{radius:t,color:n,size:r})=>({root:{"--switch-radius":t===void 0?void 0:ft(t),"--switch-height":ut(r,`switch-height`),"--switch-width":ut(r,`switch-width`),"--switch-thumb-size":ut(r,`switch-thumb-size`),"--switch-label-font-size":ut(r,`switch-label-font-size`),"--switch-track-label-padding":ut(r,`switch-track-label-padding`),"--switch-color":n?ur(n,e):void 0}})),nb=B((e,t)=>{let n=R(`Switch`,eb,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,color:l,label:u,offLabel:d,onLabel:f,id:p,size:m,radius:h,wrapperProps:g,thumbIcon:_,checked:v,defaultChecked:y,onChange:b,labelPosition:x,description:S,error:C,disabled:w,variant:T,rootRef:E,mod:D,withThumbIndicator:O,attributes:k,...A}=n,j=Qy(),M=m||j?.size,N=ui({name:`Switch`,props:n,classes:Yy,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:k,vars:c,varsResolver:tb}),{styleProps:ee,rest:P}=vi(A),te=Zt(p),ne={checked:j?.value.includes(P.value)??v,onChange:e=>{j?.onChange(e),b?.(e)},disabled:j?.disabled??w},[re,ie]=ln({value:ne.checked??v,defaultValue:y,finalValue:!1});return(0,L.jsxs)(Kf,{...N(`root`),__staticSelector:`Switch`,__stylesApiProps:n,id:te,size:M,labelPosition:x,label:u,description:S,error:C,disabled:ne.disabled,bodyElement:`label`,labelElement:`span`,classNames:r,styles:o,unstyled:s,"data-checked":ne.checked,variant:T,ref:E,mod:D,inert:P.inert,...ee,...g,children:[(0,L.jsx)(`input`,{...P,...ne,checked:re,"data-checked":ne.checked,onChange:e=>{ne.onChange?.(e),ie(e.currentTarget.checked)},id:te,ref:t,type:`checkbox`,role:`switch`,inert:P.inert,...N(`input`)}),(0,L.jsxs)(z,{"aria-hidden":`true`,component:`span`,mod:{error:C,"label-position":x,"without-labels":!f&&!d},...N(`track`),children:[(0,L.jsx)(z,{component:`span`,mod:{"reduce-motion":!0,"with-thumb-indicator":O&&!_},...N(`thumb`),children:_}),(0,L.jsx)(`span`,{...N(`trackLabel`),children:re?f:d})]})]})});nb.classes={...Yy,...Gf},nb.displayName=`@mantine/core/Switch`,nb.Group=$y;var[rb,ib]=Qe(`Table component was not found in the tree`),ab={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 ob(e,t){if(!t)return;let 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 sb(e,t){let n=`Table${e.charAt(0).toUpperCase()}${e.slice(1)}`,r=B((r,i)=>{let a=R(n,{},r),{classNames:o,className:s,style:c,styles:l,...u}=a,d=ib();return(0,L.jsx)(z,{component:e,ref:i,...ob(d,t),...d.getStyles(e,{className:s,classNames:o,style:c,styles:l,props:a}),...u})});return r.displayName=`@mantine/core/${n}`,r.classes=ab,r}var cb=sb(`th`,{columnBorder:!0}),lb=sb(`td`,{columnBorder:!0}),ub=sb(`tr`,{rowBorder:!0,striped:!0,highlightOnHover:!0}),db=sb(`thead`,{stickyHeader:!0}),fb=sb(`tbody`),pb=sb(`tfoot`),mb=sb(`caption`,{captionSide:!0});function hb({data:e}){return(0,L.jsxs)(L.Fragment,{children:[e.caption&&(0,L.jsx)(mb,{children:e.caption}),e.head&&(0,L.jsx)(db,{children:(0,L.jsx)(ub,{children:e.head.map((e,t)=>(0,L.jsx)(cb,{children:e},t))})}),e.body&&(0,L.jsx)(fb,{children:e.body.map((e,t)=>(0,L.jsx)(ub,{children:e.map((e,t)=>(0,L.jsx)(lb,{children:e},t))},t))}),e.foot&&(0,L.jsx)(pb,{children:(0,L.jsx)(ub,{children:e.foot.map((e,t)=>(0,L.jsx)(cb,{children:e},t))})})]})}hb.displayName=`@mantine/core/TableDataRenderer`;var gb={type:`scrollarea`},_b=Fn((e,{minWidth:t,maxHeight:n,type:r})=>({scrollContainer:{"--table-min-width":I(t),"--table-max-height":I(n),"--table-overflow":r===`native`?`auto`:void 0}})),vb=B((e,t)=>{let n=R(`TableScrollContainer`,gb,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,children:l,minWidth:u,maxHeight:d,type:f,scrollAreaProps:p,attributes:m,...h}=n,g=ui({name:`TableScrollContainer`,classes:ab,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:m,vars:c,varsResolver:_b,rootSelector:`scrollContainer`});return(0,L.jsx)(z,{component:f===`scrollarea`?ml:`div`,...f===`scrollarea`?d?{offsetScrollbars:`xy`,...p}:{offsetScrollbars:`x`,...p}:{},ref:t,...g(`scrollContainer`),...h,children:(0,L.jsx)(`div`,{...g(`scrollContainerInner`),children:l})})});vb.classes=ab,vb.displayName=`@mantine/core/TableScrollContainer`;var yb={withRowBorders:!0,verticalSpacing:7},bb=Fn((e,{layout:t,captionSide:n,horizontalSpacing:r,verticalSpacing:i,borderColor:a,stripedColor:o,highlightOnHoverColor:s,striped:c,highlightOnHover:l,stickyHeaderOffset:u,stickyHeader:d})=>({table:{"--table-layout":t,"--table-caption-side":n,"--table-horizontal-spacing":dt(r),"--table-vertical-spacing":dt(i),"--table-border-color":a?ur(a,e):void 0,"--table-striped-color":c&&o?ur(o,e):void 0,"--table-highlight-on-hover-color":l&&s?ur(s,e):void 0,"--table-sticky-header-offset":d?I(u):void 0}})),G=B((e,t)=>{let n=R(`Table`,yb,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,horizontalSpacing:l,verticalSpacing:u,captionSide:d,stripedColor:f,highlightOnHoverColor:p,striped:m,highlightOnHover:h,withColumnBorders:g,withRowBorders:_,withTableBorder:v,borderColor:y,layout:b,variant:x,data:S,children:C,stickyHeader:w,stickyHeaderOffset:T,mod:E,tabularNums:D,attributes:O,...k}=n,A=ui({name:`Table`,props:n,className:i,style:a,classes:ab,classNames:r,styles:o,unstyled:s,attributes:O,rootSelector:`table`,vars:c,varsResolver:bb});return(0,L.jsx)(rb,{value:{getStyles:A,stickyHeader:w,striped:m===!0?`odd`:m||void 0,highlightOnHover:h,withColumnBorders:g,withRowBorders:_,captionSide:d||`bottom`},children:(0,L.jsx)(z,{component:`table`,variant:x,ref:t,mod:[{"data-with-table-border":v,"data-tabular-nums":D},E],...A(`table`),...k,children:C||!!S&&(0,L.jsx)(hb,{data:S})})})});G.classes=ab,G.displayName=`@mantine/core/Table`,G.Td=lb,G.Th=cb,G.Tr=ub,G.Thead=db,G.Tbody=fb,G.Tfoot=pb,G.Caption=mb,G.ScrollContainer=vb,G.DataRenderer=hb;var[xb,Sb]=Qe(`Tabs component was not found in the tree`),Cb={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`},wb=B((e,t)=>{let n=R(`TabsList`,null,e),{children:r,className:i,grow:a,justify:o,classNames:s,styles:c,style:l,mod:u,...d}=n,f=Sb();return(0,L.jsx)(z,{...d,...f.getStyles(`list`,{className:i,style:l,classNames:s,styles:c,props:n,variant:f.variant}),ref:t,role:`tablist`,variant:f.variant,mod:[{grow:a,orientation:f.orientation,placement:f.orientation===`vertical`&&f.placement,inverted:f.inverted},u],"aria-orientation":f.orientation,__vars:{"--tabs-justify":o},children:r})});wb.classes=Cb,wb.displayName=`@mantine/core/TabsList`;var Tb=B((e,t)=>{let n=R(`TabsPanel`,null,e),{children:r,className:i,value:a,classNames:o,styles:s,style:c,mod:l,keepMounted:u,...d}=n,f=Sb(),p=f.value===a,m=f.keepMounted||u||p?r:null;return(0,L.jsx)(z,{...f.getStyles(`panel`,{className:i,classNames:o,styles:s,style:[c,p?void 0:{display:`none`}],props:n}),ref:t,mod:[{orientation:f.orientation},l],role:`tabpanel`,id:f.getPanelId(a),"aria-labelledby":f.getTabId(a),...d,children:m})});Tb.classes=Cb,Tb.displayName=`@mantine/core/TabsPanel`;var Eb=B((e,t)=>{let n=R(`TabsTab`,null,e),{className:r,children:i,rightSection:a,leftSection:o,value:s,onClick:c,onKeyDown:l,disabled:u,color:d,style:f,classNames:p,styles:m,vars:h,mod:g,tabIndex:_,...v}=n,y=Dr(),{dir:b}=ea(),x=Sb(),S=s===x.value,C=e=>{x.onChange(x.allowTabDeactivation&&s===x.value?null:s),c?.(e)},w={classNames:p,styles:m,props:n};return(0,L.jsxs)(vl,{...x.getStyles(`tab`,{className:r,style:f,variant:x.variant,...w}),disabled:u,unstyled:x.unstyled,variant:x.variant,mod:[{active:S,disabled:u,orientation:x.orientation,inverted:x.inverted,placement:x.orientation===`vertical`&&x.placement},g],ref:t,role:`tab`,id:x.getTabId(s),"aria-selected":S,tabIndex:_===void 0?S||x.value===null?0:-1:_,"aria-controls":x.getPanelId(s),onClick:C,__vars:{"--tabs-color":d?ur(d,y):void 0},onKeyDown:at({siblingSelector:`[role="tab"]`,parentSelector:`[role="tablist"]`,activateOnFocus:x.activateTabWithKeyboard,loop:x.loop,orientation:x.orientation||`horizontal`,dir:b,onKeyDown:l}),...v,children:[o&&(0,L.jsx)(`span`,{...x.getStyles(`tabSection`,w),"data-position":`left`,children:o}),i&&(0,L.jsx)(`span`,{...x.getStyles(`tabLabel`,w),children:i}),a&&(0,L.jsx)(`span`,{...x.getStyles(`tabSection`,w),"data-position":`right`,children:a})]})});Eb.classes=Cb,Eb.displayName=`@mantine/core/TabsTab`;var Db=`Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value`,Ob={keepMounted:!0,orientation:`horizontal`,loop:!0,activateTabWithKeyboard:!0,variant:`default`,placement:`left`},kb=Fn((e,{radius:t,color:n,autoContrast:r})=>({root:{"--tabs-radius":ft(t),"--tabs-color":ur(n,e),"--tabs-text-color":di(r,e)?Mr({color:n,theme:e,autoContrast:r}):void 0}})),Ab=B((e,t)=>{let n=R(`Tabs`,Ob,e),{defaultValue:r,value:i,onChange:a,orientation:o,children:s,loop:c,id:l,activateTabWithKeyboard:u,allowTabDeactivation:d,variant:f,color:p,radius:m,inverted:h,placement:g,keepMounted:_,classNames:v,styles:y,unstyled:b,className:x,style:S,vars:C,autoContrast:w,mod:T,attributes:E,...D}=n,O=Zt(l),[k,A]=ln({value:i,defaultValue:r,finalValue:null,onChange:a}),j=ui({name:`Tabs`,props:n,classes:Cb,className:x,style:S,classNames:v,styles:y,unstyled:b,attributes:E,vars:C,varsResolver:kb});return(0,L.jsx)(xb,{value:{placement:g,value:k,orientation:o,id:O,loop:c,activateTabWithKeyboard:u,getTabId:et(`${O}-tab`,Db),getPanelId:et(`${O}-panel`,Db),onChange:A,allowTabDeactivation:d,variant:f,color:p,radius:m,inverted:h,keepMounted:_,unstyled:b,getStyles:j},children:(0,L.jsx)(z,{ref:t,id:O,variant:f,mod:[{orientation:o,inverted:o===`horizontal`&&h,placement:o===`vertical`&&g},T],...j(`root`),...D,children:s})})});Ab.classes=Cb,Ab.displayName=`@mantine/core/Tabs`,Ab.Tab=Eb,Ab.Panel=Tb,Ab.List=wb;var jb=B((e,t)=>{let n=R(`TextInput`,null,e);return(0,L.jsx)(vd,{component:`input`,ref:t,...n,__staticSelector:`TextInput`})});jb.classes=vd.classes,jb.displayName=`@mantine/core/TextInput`;var Mb={root:`m_7341320d`},Nb=Fn((e,{size:t,radius:n,variant:r,gradient:i,color:a,autoContrast:o})=>{let s=e.variantColorResolver({color:a||e.primaryColor,theme:e,gradient:i,variant:r||`filled`,autoContrast:o});return{root:{"--ti-size":ut(t,`ti-size`),"--ti-radius":n===void 0?void 0:ft(n),"--ti-bg":a||r?s.background:void 0,"--ti-color":a||r?s.color:void 0,"--ti-bd":a||r?s.border:void 0}}}),Pb=B((e,t)=>{let n=R(`ThemeIcon`,null,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,autoContrast:l,attributes:u,...d}=n,f=ui({name:`ThemeIcon`,classes:Mb,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:u,vars:c,varsResolver:Nb});return(0,L.jsx)(z,{ref:t,...f(`root`),...d})});Pb.classes=Mb,Pb.displayName=`@mantine/core/ThemeIcon`;var Fb=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`],Ib=[`xs`,`sm`,`md`,`lg`,`xl`];function Lb(e,t){let n=t===void 0?`h${e}`:t;return Fb.includes(n)?{fontSize:`var(--mantine-${n}-font-size)`,fontWeight:`var(--mantine-${n}-font-weight)`,lineHeight:`var(--mantine-${n}-line-height)`}:Ib.includes(n)?{fontSize:`var(--mantine-font-size-${n})`,fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}:{fontSize:I(n),fontWeight:`var(--mantine-h${e}-font-weight)`,lineHeight:`var(--mantine-h${e}-line-height)`}}var Rb={root:`m_8a5d1357`},zb={order:1},Bb=Fn((e,{order:t,size:n,lineClamp:r,textWrap:i})=>{let a=Lb(t||1,n);return{root:{"--title-fw":a.fontWeight,"--title-lh":a.lineHeight,"--title-fz":a.fontSize,"--title-line-clamp":typeof r==`number`?r.toString():void 0,"--title-text-wrap":i}}}),K=B((e,t)=>{let n=R(`Title`,zb,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,order:c,vars:l,size:u,variant:d,lineClamp:f,textWrap:p,mod:m,attributes:h,...g}=n,_=ui({name:`Title`,props:n,classes:Rb,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:h,vars:l,varsResolver:Bb});return[1,2,3,4,5,6].includes(c)?(0,L.jsx)(z,{..._(`root`),component:`h${c}`,variant:d,ref:t,mod:[{order:c,"data-line-clamp":typeof f==`number`},m],size:u,...g}):null});K.classes=Rb,K.displayName=`@mantine/core/Title`;function Vb(e){let t=e,n=!1,r=new Set;return{getState(){return t},updateState(e){t=typeof e==`function`?e(t):e},setState(e){this.updateState(e),r.forEach(e=>e(t))},initialize(e){n||=(t=e,!0)},subscribe(e){return r.add(e),()=>r.delete(e)}}}function Hb(e){return(0,b.useSyncExternalStore)(e.subscribe,()=>e.getState(),()=>e.getState())}function Ub(e,t,n){let r=[],i=[],a={};for(let o of e){let e=o.position||t;a[e]=a[e]||0,a[e]+=1,a[e]<=n?i.push(o):r.push(o)}return{notifications:i,queue:r}}var Wb=Vb({notifications:[],queue:[],defaultPosition:`bottom-right`,limit:5}),Gb=(e=Wb)=>Hb(e);function Kb(e,t){let n=e.getState(),r=Ub(t([...n.notifications,...n.queue]),n.defaultPosition,n.limit);e.setState({notifications:r.notifications,queue:r.queue,limit:n.limit,defaultPosition:n.defaultPosition})}function q(e,t=Wb){let n=e.id||St();return Kb(t,t=>e.id&&t.some(t=>t.id===e.id)?t:[...t,{...e,id:n}]),n}function qb(e,t=Wb){return Kb(t,t=>t.filter(t=>t.id!==e||(t.onClose?.(t),!1))),e}function Jb(e,t=Wb){return Kb(t,t=>t.map(t=>t.id===e.id?{...t,...e}:t)),e.id}function Yb(e=Wb){Kb(e,()=>[])}function Xb(e=Wb){Kb(e,t=>t.slice(0,e.getState().limit))}var Zb={show:q,hide:qb,update:Jb,clean:Yb,cleanQueue:Xb,updateState:Kb};function Qb(e,t){return Qb=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Qb(e,t)}function $b(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Qb(e,t)}var ex=o(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),tx=o(((e,t)=>{var n=ex();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=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 s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),nx=o(((e,t)=>{t.exports=tx()()})),rx={disabled:!1},ix=b.createContext(null),ax=function(e){return e.scrollTop},ox=`unmounted`,sx=`exited`,cx=`entering`,lx=`entered`,ux=`exiting`,dx=function(e){$b(t,e);function t(t,n){var r=e.call(this,t,n)||this,i=n,a=i&&!i.isMounting?t.enter:t.appear,o;return r.appearStatus=null,t.in?a?(o=sx,r.appearStatus=cx):o=lx:o=t.unmountOnExit||t.mountOnEnter?ox:sx,r.state={status:o},r.nextCallback=null,r}t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===`unmounted`?{status:sx}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==`entering`&&n!==`entered`&&(t=cx):(n===`entering`||n===`entered`)&&(t=ux)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e=this.props.timeout,t=n=r=e,n,r;return e!=null&&typeof e!=`number`&&(t=e.exit,n=e.enter,r=e.appear===void 0?n:e.appear),{exit:t,enter:n,appear:r}},n.updateStatus=function(e,t){if(e===void 0&&(e=!1),t!==null){if(this.cancelNextCallback(),t===`entering`){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:ks.default.findDOMNode(this);n&&ax(n)}this.performEnter(e)}else this.performExit()}else this.props.unmountOnExit&&this.state.status===`exited`&&this.setState({status:ox})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,i=this.props.nodeRef?[r]:[ks.default.findDOMNode(this),r],a=i[0],o=i[1],s=this.getTimeouts(),c=r?s.appear:s.enter;if(!e&&!n||rx.disabled){this.safeSetState({status:lx},function(){t.props.onEntered(a)});return}this.props.onEnter(a,o),this.safeSetState({status:cx},function(){t.props.onEntering(a,o),t.onTransitionEnd(c,function(){t.safeSetState({status:lx},function(){t.props.onEntered(a,o)})})})},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:ks.default.findDOMNode(this);if(!t||rx.disabled){this.safeSetState({status:sx},function(){e.props.onExited(r)});return}this.props.onExit(r),this.safeSetState({status:ux},function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:sx},function(){e.props.onExited(r)})})})},n.cancelNextCallback=function(){this.nextCallback!==null&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:ks.default.findDOMNode(this),r=e==null&&!this.props.addEndListener;if(!n||r){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var i=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],a=i[0],o=i[1];this.props.addEndListener(a,o)}e!=null&&setTimeout(this.nextCallback,e)},n.render=function(){var e=this.state.status;if(e===`unmounted`)return null;var t=this.props,n=t.children;t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef;var r=qm(t,[`children`,`in`,`mountOnEnter`,`unmountOnExit`,`appear`,`enter`,`exit`,`timeout`,`addEndListener`,`onEnter`,`onEntering`,`onEntered`,`onExit`,`onExiting`,`onExited`,`nodeRef`]);return b.createElement(ix.Provider,{value:null},typeof n==`function`?n(e,r):b.cloneElement(b.Children.only(n),r))},t}(b.Component);dx.contextType=ix,dx.propTypes={};function fx(){}dx.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:fx,onEntering:fx,onEntered:fx,onExit:fx,onExiting:fx,onExited:fx},dx.UNMOUNTED=ox,dx.EXITED=sx,dx.ENTERING=cx,dx.ENTERED=lx,dx.EXITING=ux;function px(e){if(e===void 0)throw ReferenceError(`this hasn't been initialised - super() hasn't been called`);return e}function mx(e,t){var n=function(e){return t&&(0,b.isValidElement)(e)?t(e):e},r=Object.create(null);return e&&b.Children.map(e,function(e){return e}).forEach(function(e){r[e.key]=n(e)}),r}function hx(e,t){e||={},t||={};function n(n){return n in t?t[n]:e[n]}var r=Object.create(null),i=[];for(var a in e)a in t?i.length&&(r[a]=i,i=[]):i.push(a);var o,s={};for(var c in t){if(r[c])for(o=0;o<r[c].length;o++){var l=r[c][o];s[r[c][o]]=n(l)}s[c]=n(c)}for(o=0;o<i.length;o++)s[i[o]]=n(i[o]);return s}function gx(e,t,n){return n[t]==null?e.props[t]:n[t]}function _x(e,t){return mx(e.children,function(n){return(0,b.cloneElement)(n,{onExited:t.bind(null,n),in:!0,appear:gx(n,`appear`,e),enter:gx(n,`enter`,e),exit:gx(n,`exit`,e)})})}function vx(e,t,n){var r=mx(e.children),i=hx(t,r);return Object.keys(i).forEach(function(a){var o=i[a];if((0,b.isValidElement)(o)){var s=a in t,c=a in r,l=t[a],u=(0,b.isValidElement)(l)&&!l.props.in;c&&(!s||u)?i[a]=(0,b.cloneElement)(o,{onExited:n.bind(null,o),in:!0,exit:gx(o,`exit`,e),enter:gx(o,`enter`,e)}):!c&&s&&!u?i[a]=(0,b.cloneElement)(o,{in:!1}):c&&s&&(0,b.isValidElement)(l)&&(i[a]=(0,b.cloneElement)(o,{onExited:n.bind(null,o),in:l.props.in,exit:gx(o,`exit`,e),enter:gx(o,`enter`,e)}))}}),i}var yx=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},bx={component:`div`,childFactory:function(e){return e}},xx=function(e){$b(t,e);function t(t,n){var r=e.call(this,t,n)||this;return r.state={contextValue:{isMounting:!0},handleExited:r.handleExited.bind(px(r)),firstRender:!0},r}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(e,t){var n=t.children,r=t.handleExited;return{children:t.firstRender?_x(e,r):vx(e,n,r),firstRender:!1}},n.handleExited=function(e,t){var n=mx(this.props.children);e.key in n||(e.props.onExited&&e.props.onExited(t),this.mounted&&this.setState(function(t){var n=Km({},t.children);return delete n[e.key],{children:n}}))},n.render=function(){var e=this.props,t=e.component,n=e.childFactory,r=qm(e,[`component`,`childFactory`]),i=this.state.contextValue,a=yx(this.state.children).map(n);return delete r.appear,delete r.enter,delete r.exit,t===null?b.createElement(ix.Provider,{value:i},a):b.createElement(ix.Provider,{value:i},b.createElement(t,r,a))},t}(b.Component);xx.propTypes={},xx.defaultProps=bx;var Sx=[`bottom-center`,`bottom-left`,`bottom-right`,`top-center`,`top-left`,`top-right`];function Cx(e,t){return e.reduce((e,n)=>(e[n.position||t].push(n),e),Sx.reduce((e,t)=>(e[t]=[],e),{}))}var wx={left:`translateX(-100%)`,right:`translateX(100%)`,"top-center":`translateY(-100%)`,"bottom-center":`translateY(100%)`},Tx={left:`translateX(0)`,right:`translateX(0)`,"top-center":`translateY(0)`,"bottom-center":`translateY(0)`};function Ex({state:e,maxHeight:t,position:n,transitionDuration:r}){let[i,a]=n.split(`-`),o=a===`center`?`${i}-center`:a,s={opacity:0,maxHeight:t,transform:wx[o],transitionDuration:`${r}ms, ${r}ms, ${r}ms`,transitionTimingFunction:`cubic-bezier(.51,.3,0,1.21), cubic-bezier(.51,.3,0,1.21), linear`,transitionProperty:`opacity, transform, max-height`},c={opacity:1,transform:Tx[o]},l={opacity:0,maxHeight:0,transform:wx[o]},u={entering:c,entered:c,exiting:l,exited:l};return{...s,...u[e]}}function Dx(e,t){return typeof t==`number`?t:t===!1||e===!1?!1:e}var Ox=(0,b.forwardRef)(({data:e,onHide:t,autoClose:n,...r},i)=>{let{autoClose:a,message:o,...s}=e,c=Dx(n,e.autoClose),l=(0,b.useRef)(-1),u=()=>window.clearTimeout(l.current),d=()=>{t(e.id),u()},f=()=>{typeof c==`number`&&(l.current=window.setTimeout(d,c))};return(0,b.useEffect)(()=>{e.onOpen?.(e)},[]),(0,b.useEffect)(()=>(f(),u),[c]),(0,L.jsx)(Bg,{...r,...s,onClose:d,ref:i,onMouseEnter:u,onMouseLeave:f,children:o})});Ox.displayName=`@mantine/notifications/NotificationContainer`;var kx={root:`m_b37d9ac7`,notification:`m_5ed0edd0`},Ax=dx,jx={position:`bottom-right`,autoClose:4e3,transitionDuration:250,containerWidth:440,notificationMaxHeight:200,limit:5,zIndex:st(`overlay`),store:Wb,withinPortal:!0},Mx=Fn((e,{zIndex:t,containerWidth:n})=>({root:{"--notifications-z-index":t?.toString(),"--notifications-container-width":I(n)}})),Nx=B((e,t)=>{let n=R(`Notifications`,jx,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,position:l,autoClose:u,transitionDuration:d,containerWidth:f,notificationMaxHeight:p,limit:m,zIndex:h,store:g,portalProps:_,withinPortal:v,...y}=n,x=Dr(),S=Gb(g),C=Jt(),w=pn(),T=(0,b.useRef)({}),E=(0,b.useRef)(0),D=x.respectReducedMotion&&w?1:d,O=ui({name:`Notifications`,classes:kx,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,vars:c,varsResolver:Mx});(0,b.useEffect)(()=>{g?.updateState(e=>({...e,limit:m||5,defaultPosition:l}))},[m,l]),Ft(()=>{S.notifications.length>E.current&&setTimeout(()=>C(),0),E.current=S.notifications.length},[S.notifications]);let k=Cx(S.notifications,l),A=Sx.reduce((e,t)=>(e[t]=k[t].map(({style:e,...n})=>(0,L.jsx)(Ax,{timeout:D,onEnter:()=>T.current[n.id].offsetHeight,nodeRef:{current:T.current[n.id]},children:r=>(0,L.jsx)(Ox,{ref:e=>{e&&(T.current[n.id]=e)},data:n,onHide:e=>qb(e,g),autoClose:u,...O(`notification`,{style:{...Ex({state:r,position:t,transitionDuration:D,maxHeight:p}),...e}})})},n.id)),e),{});return(0,L.jsxs)(Rl,{withinPortal:v,..._,children:[(0,L.jsx)(z,{...O(`root`),"data-position":`top-center`,ref:t,...y,children:(0,L.jsx)(xx,{children:A[`top-center`]})}),(0,L.jsx)(z,{...O(`root`),"data-position":`top-left`,...y,children:(0,L.jsx)(xx,{children:A[`top-left`]})}),(0,L.jsx)(z,{...O(`root`,{className:Re.classNames.fullWidth}),"data-position":`top-right`,...y,children:(0,L.jsx)(xx,{children:A[`top-right`]})}),(0,L.jsx)(z,{...O(`root`,{className:Re.classNames.fullWidth}),"data-position":`bottom-right`,...y,children:(0,L.jsx)(xx,{children:A[`bottom-right`]})}),(0,L.jsx)(z,{...O(`root`),"data-position":`bottom-left`,...y,children:(0,L.jsx)(xx,{children:A[`bottom-left`]})}),(0,L.jsx)(z,{...O(`root`),"data-position":`bottom-center`,...y,children:(0,L.jsx)(xx,{children:A[`bottom-center`]})})]})});Nx.classes=kx,Nx.displayName=`@mantine/notifications/Notifications`,Nx.show=Zb.show,Nx.hide=Zb.hide,Nx.update=Zb.update,Nx.clean=Zb.clean,Nx.cleanQueue=Zb.cleanQueue,Nx.updateState=Zb.updateState;var Px=class{max;cache;constructor(e=10){this.max=e,this.cache=new Map}clear(){this.cache.clear()}get(e){let t=this.cache.get(e);return t&&(this.cache.delete(e),this.cache.set(e,t)),t}set(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size>=this.max&&this.cache.delete(this.first()),this.cache.set(e,t)}delete(e){this.cache.delete(e)}keys(){return this.cache.keys()}first(){return this.cache.keys().next().value}},Fx=class{operator;child;constructor(e,t){this.operator=e,this.child=t}toString(){return`${this.operator}(${this.child.toString()})`}},Ix=class{operator;left;right;constructor(e,t,n){this.operator=e,this.left=t,this.right=n}toString(){return`(${this.left.toString()} ${this.operator} ${this.right.toString()})`}},Lx=class{prefixParselets={};infixParselets={};registerInfix(e,t){return this.infixParselets[e]=t,this}registerPrefix(e,t){return this.prefixParselets[e]=t,this}prefix(e,t,n){return this.registerPrefix(e,{parse(e,r){return n(r,e.consumeAndParse(t))}})}infixLeft(e,t,n){return this.registerInfix(e,{parse(e,r,i){return n(r,i,e.consumeAndParse(t))},precedence:t})}construct(e){return new Rx(e,this.prefixParselets,this.infixParselets)}},Rx=class{tokens;prefixParselets;infixParselets;constructor(e,t,n){this.tokens=e,this.prefixParselets=t,this.infixParselets=n}hasMore(){return this.tokens.length>0}match(e){return this.peek()?.id===e&&(this.consume(),!0)}consumeAndParse(e=1/0){let t=this.consume(),n=this.prefixParselets[t.id];if(!n)throw Error(`Parse error at "${t.value}" (line ${t.line}, column ${t.column}). No matching prefix parselet.`);let r=n.parse(this,t);for(;e>this.getPrecedence();){let e=this.consume();r=this.getInfixParselet(e).parse(this,r,e)}return r}getPrecedence(){let e=this.peek();if(!e)return 1/0;let t=this.getInfixParselet(e);return t?t.precedence:1/0}consume(e,t){if(!this.tokens.length)throw Error(`Cant consume unknown more tokens.`);if(e&&this.peek()?.id!==e){let t=this.peek();throw Error(`Expected ${e} but got "${t.id}" (${t.value}) at line ${t.line} column ${t.column}.`)}if(t&&this.peek()?.value!==t){let e=this.peek();throw Error(`Expected "${t}" but got "${e.value}" at line ${e.line} column ${e.column}.`)}return this.tokens.shift()}peek(){return this.tokens.length>0?this.tokens[0]:void 0}removeComments(){this.tokens=this.tokens.filter(e=>e.id!==`Comment`)}getInfixParselet(e){return this.infixParselets[e.id===`Symbol`?e.value:e.id]}};function zx(e){if(e!==void 0)return Array.isArray(e)?e:[e]}var Bx=`http://hl7.org`,Vx=`ok`,Hx=`created`,Ux=`gone`,Wx=`not-modified`,Gx=`found`,Kx=`not-found`,qx=`conflict`,Jx=`unauthorized`,Yx=`forbidden`,Xx=`precondition-failed`,Zx=`content-too-large`,Qx=`unsupported-media-type`,$x=`multiple-matches`,eS=`too-many-requests`,tS=`accepted`,nS=`server-timeout`,rS=`business-rule`,iS={resourceType:`OperationOutcome`,id:Vx,issue:[{severity:`information`,code:`informational`,details:{text:`All OK`}}]},aS={resourceType:`OperationOutcome`,id:Kx,issue:[{severity:`error`,code:`not-found`,details:{text:`Not found`}}]},oS={resourceType:`OperationOutcome`,id:Jx,issue:[{severity:`error`,code:`login`,details:{text:`Unauthorized`}}]},sS={...oS,issue:[...oS.issue,{severity:`error`,code:`expired`,details:{text:`Token expired`}}]},cS={...oS,issue:[...oS.issue,{severity:`error`,code:`invalid`,details:{text:`Token not issued for this audience`}}]},lS={resourceType:`OperationOutcome`,id:Yx,issue:[{severity:`error`,code:`forbidden`,details:{text:`Forbidden`}}]};function uS(e,t){return{resourceType:`OperationOutcome`,issue:[{severity:`error`,code:`invalid`,details:{text:e},...t?{expression:zx(t)}:void 0}]}}function dS(e,t,n,r){return{resourceType:`OperationOutcome`,issue:[{severity:`error`,code:n??`structure`,details:{text:e},...t?{expression:t}:void 0,...r?{diagnostics:r}:void 0}]}}function fS(e){return e?.issue?.[0]?.details?.coding?.find(e=>e.system===`urn:ietf:rfc:3986`)?.code}function pS(e){return!e||typeof e!=`object`?!1:e instanceof Error||typeof DOMException<`u`&&e instanceof DOMException||Object.prototype.toString.call(e)===`[object Error]`}function mS(e){return typeof e==`object`&&!!e&&e.resourceType===`OperationOutcome`}function hS(e){return e.id===Vx||e.id===Hx||e.id===Wx||e.id===tS}function gS(e){return e.id===Ux}function _S(e){switch(e.id){case Vx:return 200;case Hx:return 201;case tS:return 202;case Gx:return 302;case Wx:return 304;case Jx:return 401;case Yx:return 403;case Kx:return 404;case qx:return 409;case Ux:return 410;case Xx:case $x:return 412;case Zx:return 413;case Qx:return 415;case rS:return 422;case eS:return 429;case nS:return 504;default:return e.issue?.[0]?.code===`exception`?500:400}}var vS=class extends Error{outcome;constructor(e,t){super(bS(e),t),this.name=`OperationOutcomeError`,this.outcome=e}};function yS(e){return e instanceof vS?e.outcome:mS(e)?e:uS(J(e))}function J(e){return e?typeof e==`string`?e:pS(e)?e.message:mS(e)?bS(e):typeof e==`object`&&`code`in e&&typeof e.code==`string`?e.code:JSON.stringify(e):`Unknown error`}function bS(e){let t=e.issue?.map(xS)??[];return t.length>0?t.join(`; `):`Unknown error`}function xS(e){let t;return t=e.details?.text?e.diagnostics?`${e.details.text} (${e.diagnostics})`:e.details.text:e.diagnostics?e.diagnostics:`Unknown error`,e.expression?.length&&(t+=` (${e.expression.join(`, `)})`),t}function SS(e,t){let n=t.max&&t.max===2**53-1?1/0:t.max;return{path:e,description:``,type:t.type??[],min:t.min??0,max:n??1,isArray:!!n&&n>1,constraints:[]}}function CS(e){let t=Object.create(null);for(let[n,r]of Object.entries(e))t[n]={name:n,type:n,path:n,elements:Object.fromEntries(Object.entries(r.elements).map(([e,t])=>[e,SS(e,t)])),constraints:[],innerTypes:[]};return t}var wS={Element:{elements:{id:{type:[{code:`string`}]},extension:{max:9007199254740991,type:[{code:`Extension`}]}}},BackboneElement:{elements:{id:{type:[{code:`string`}]},extension:{max:9007199254740991,type:[{code:`Extension`}]},modifierExtension:{max:9007199254740991,type:[{code:`Extension`}]}}},Address:{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`}]}}},Age:{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`}]}}},Annotation:{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`}]}}},Attachment:{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`}]}}},CodeableConcept:{elements:{id:{type:[{code:`string`}]},extension:{max:9007199254740991,type:[{code:`Extension`}]},coding:{max:9007199254740991,type:[{code:`Coding`}]},text:{type:[{code:`string`}]}}},Coding:{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`}]}}},ContactDetail:{elements:{id:{type:[{code:`string`}]},extension:{max:9007199254740991,type:[{code:`Extension`}]},name:{type:[{code:`string`}]},telecom:{max:9007199254740991,type:[{code:`ContactPoint`}]}}},ContactPoint:{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`}]}}},Contributor:{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`}]}}},Count:{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`}]}}},DataRequirement:{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`}]}}},DataRequirementCodeFilter:{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`}]}}},DataRequirementDateFilter:{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`}]}}},DataRequirementSort:{elements:{id:{type:[{code:`string`}]},extension:{max:9007199254740991,type:[{code:`Extension`}]},path:{min:1,type:[{code:`string`}]},direction:{min:1,type:[{code:`code`}]}}},Distance:{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`}]}}},Dosage:{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`]}]}}},DosageDoseAndRate:{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`]}]}}},Duration:{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`}]}}},ElementDefinition:{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`}]}}},ElementDefinitionSlicingDiscriminator:{elements:{id:{type:[{code:`string`}]},extension:{max:9007199254740991,type:[{code:`Extension`}]},type:{min:1,type:[{code:`code`}]},path:{min:1,type:[{code:`string`}]}}},ElementDefinitionSlicing:{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`}]}}},ElementDefinitionBase:{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`}]}}},ElementDefinitionType:{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`}]}}},ElementDefinitionExample:{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`}]}}},ElementDefinitionConstraint:{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`]}]}}},ElementDefinitionBinding:{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`]}]}}},ElementDefinitionMapping:{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`}]}}},Expression:{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`}]}}},Extension:{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`}]}}},HumanName:{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`}]}}},Identifier:{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`]}]}}},MarketingStatus:{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`}]}}},Meta:{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`}]},deleted:{type:[{code:`boolean`}]}}},Money:{elements:{id:{type:[{code:`string`}]},extension:{max:9007199254740991,type:[{code:`Extension`}]},value:{type:[{code:`decimal`}]},currency:{type:[{code:`code`}]}}},Narrative:{elements:{id:{type:[{code:`string`}]},extension:{max:9007199254740991,type:[{code:`Extension`}]},status:{min:1,type:[{code:`code`}]},div:{min:1,type:[{code:`xhtml`}]}}},ParameterDefinition:{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`]}]}}},Period:{elements:{id:{type:[{code:`string`}]},extension:{max:9007199254740991,type:[{code:`Extension`}]},start:{type:[{code:`dateTime`}]},end:{type:[{code:`dateTime`}]}}},Population:{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`}]}}},ProdCharacteristic:{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`}]}}},ProductShelfLife:{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`}]}}},Quantity:{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`}]}}},Range:{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`]}]}}},Ratio:{elements:{id:{type:[{code:`string`}]},extension:{max:9007199254740991,type:[{code:`Extension`}]},numerator:{type:[{code:`Quantity`}]},denominator:{type:[{code:`Quantity`}]}}},Reference:{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`}]}}},RelatedArtifact:{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`]}]}}},SampledData:{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`}]}}},Signature:{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`}]}}},SubstanceAmount:{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`}]}}},SubstanceAmountReferenceRange:{elements:{id:{type:[{code:`string`}]},extension:{max:9007199254740991,type:[{code:`Extension`}]},lowLimit:{type:[{code:`Quantity`}]},highLimit:{type:[{code:`Quantity`}]}}},Timing:{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`}]}}},TimingRepeat:{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`}]}}},TriggerDefinition:{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`}]}}},UsageContext:{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`]}]}}},MoneyQuantity:{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`}]}}},SimpleQuantity:{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`}]}}},IdentityProvider:{elements:{issuer:{type:[{code:`string`}]},audience:{type:[{code:`string`}]},jwksUrl:{type:[{code:`string`}]},authorizeUrl:{type:[{code:`string`}]},tokenUrl:{type:[{code:`string`}]},tokenAuthMethod:{type:[{code:`code`}]},userInfoUrl:{type:[{code:`string`}]},userInfoMode:{type:[{code:`code`}]},userInfoApiKey:{type:[{code:`string`}]},clientId:{type:[{code:`string`}]},clientSecret:{type:[{code:`string`}]},usePkce:{type:[{code:`boolean`}]},useSubject:{type:[{code:`boolean`}]},identitySource:{type:[{code:`code`}]},identityMappingMode:{type:[{code:`code`}]}}}};function TS(e){return new zS(e).parse()}var ES=CS(wS),DS=Object.create(null),OS=Object.create(null),kS={"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 AS(e){let t;return t=OS[e],t||=OS[e]=Object.create(null),t}function jS(e){let t=(Array.isArray(e)?e:e.entry?.map(e=>e.resource)??[]).filter(e=>e?.resourceType===`StructureDefinition`);Zw(t);for(let e of t)MS(e)}function MS(e){if(!e?.name)throw Error(`Failed loading StructureDefinition from bundle`);if(e.resourceType!==`StructureDefinition`)return;let t=TS(e),n=kS[e.url],r,i;n?(r=ES,i=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=ES,i=e.type):(r=AS(e.url),i=e.type),r[i]=t;for(let e of t.innerTypes)e.parentType=t,r[e.name]=e;DS[e.url]=t}function NS(){return ES}function PS(e){return!!ES[e]}function FS(e,t){if(t){let n=AS(t)[e];if(n)return n}return ES[e]}function IS(e,t){let n=FS(e,t);if(!n)throw new vS(uS(`Unknown data type: `+e));return n}function LS(e){return!!DS[e]}function RS(e){return DS[e]}var zS=class{root;elements;elementIndex;index;resourceSchema;slicingContext;innerTypes;backboneContext;constructor(e){if(!e.snapshot?.element||e.snapshot.element.length===0)throw Error(`No snapshot defined for StructureDefinition '${e.name}'`);this.root=e.snapshot.element[0],this.elements=e.snapshot.element.slice(1),this.elementIndex=Object.create(null),this.index=0,this.resourceSchema={name:e.name,path:this.root.path,title:e.title,type:e.type,url:e.url,version:e.version,kind:e.kind,description:KS(e),elements:{},constraints:this.parseElementDefinition(this.root).constraints,innerTypes:[],summaryProperties:new Set,mandatoryProperties:new Set},this.innerTypes=[]}parse(){let e=this.next();for(;e;){if(e.sliceName)this.parseSliceStart(e);else if(e.id?.includes(`:`)){if(this.slicingContext?.current){let t=VS(e,this.slicingContext.path);this.slicingContext.current.elements[t]=this.parseElementDefinition(e)}}else{let t=this.parseElementDefinition(e);this.checkFieldEnter(e,t);let n=this.backboneContext;for(;n;){if(e.path?.startsWith(n.path+`.`)){n.type.elements[VS(e,n.path)]=t;break}n=n.parent}if(!n){let n=VS(e,this.root.path);e.isSummary&&this.resourceSchema.summaryProperties?.add(n.replace(`[x]`,``)),t.min>0&&this.resourceSchema.mandatoryProperties?.add(n.replace(`[x]`,``)),this.resourceSchema.elements[n]=t}this.checkFieldExit(e)}e=this.next()}return this.checkFieldExit(),this.innerTypes.length>0&&(this.resourceSchema.innerTypes=this.innerTypes),this.resourceSchema}checkFieldEnter(e,t){this.isInnerType(e)&&this.enterInnerType(e),this.slicingContext&&!US(this.slicingContext.path,e?.path)&&(this.slicingContext=void 0),e.slicing&&!this.slicingContext&&this.enterSlice(e,t)}enterInnerType(e){for(;this.backboneContext&&!US(this.backboneContext?.path,e.path);)this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;let t=eT(e);this.backboneContext={type:{name:t,type:t,path:e.path,title:e.label,description:e.definition,elements:{},constraints:this.parseElementDefinition(e).constraints,innerTypes:[]},path:e.path,parent:US(this.backboneContext?.path,e.path)?this.backboneContext:this.backboneContext?.parent}}enterSlice(e,t){(!GS(e)||this.peek()?.sliceName)&&(t.slicing={discriminator:(e.slicing?.discriminator??[]).map(e=>{if(e.type!==`value`&&e.type!==`pattern`&&e.type!==`type`)throw Error(`Unsupported slicing discriminator type: ${e.type}`);return{path:e.path,type:e.type}}),slices:[],ordered:e.slicing?.ordered??!1,rule:e.slicing?.rules},this.slicingContext={field:t.slicing,path:e.path??``})}checkFieldExit(e=void 0){if(this.backboneContext&&!US(this.backboneContext.path,e?.path)){if(this.backboneContext.parent)do this.innerTypes.push(this.backboneContext.type),this.backboneContext=this.backboneContext.parent;while(this.backboneContext&&!US(this.backboneContext.path,e?.path));else this.innerTypes.push(this.backboneContext.type),this.backboneContext=void 0}}next(){let e=this.peek();if(e)return this.index++,e}peek(){let e=this.elements[this.index];if(e){if(this.elementIndex[e.path??``]=e,e.contentReference){let t=e.contentReference.slice(e.contentReference.indexOf(`#`)+1),n=this.elementIndex[t];return n?{...n,id:e.id,path:e.path,min:e.min??n.min,max:e.max??n.max,base:{path:n.base?.path??t,min:e.base?.min??n.base?.min??n.min,max:e.base?.max??n.base?.max??n.max},contentReference:e.contentReference,definition:e.definition}:void 0}return e}}isInnerType(e){let t=this.peek();return!!(US(e?.path,t?.path)&&e.type?.some(e=>[`BackboneElement`,`Element`].includes(e.code)))}parseSliceStart(e){if(!this.slicingContext)throw Error(`Invalid slice start before discriminator: ${e.sliceName} (${e.id})`);this.slicingContext.current={...this.parseElementDefinition(e),name:e.sliceName??``,definition:e.definition,elements:{}},this.slicingContext.field.slices.push(this.slicingContext.current)}parseElementDefinitionType(e){return(e.type??[]).map(t=>{let n;return(t.code===`BackboneElement`||t.code===`Element`)&&(n=eT(e)),n||=BC(t,`http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type`)?.valueUrl,n||=t.code??``,{code:n,targetProfile:t.targetProfile,profile:t.profile}})}parseElementDefinition(e){let t=BS(e.max),n=e.base?.max?BS(e.base.max):t,r={type:`ElementDefinition`,value:e};return{description:e.definition||``,path:e.path||e.base?.path||``,min:e.min??0,max:t,isArray:n>1,constraints:(e.constraint??[]).map(e=>({key:e.key??``,severity:e.severity??`error`,expression:e.expression??``,description:e.human??``})),type:this.parseElementDefinitionType(e),fixed:WS(nC(r,`fixed[x]`)),pattern:WS(nC(r,`pattern[x]`)),binding:e.binding}}};function BS(e){return e===`*`?1/0:Number.parseInt(e,10)}function VS(e,t=``){return HS(e.path,t)}function HS(e,t){return e?t&&e.startsWith(t)?e.substring(t.length+1):e:``}function US(e,t){return!e||!t?!1:t.startsWith(e+`.`)||t===e}function WS(e){if(Array.isArray(e)&&e.length>0)return e[0];if(!GC(e))return e}function GS(e){let t=e.slicing?.discriminator;return!!(e.type?.some(e=>e.code===`Extension`)&&t?.length===1&&t[0].type===`value`&&t[0].path===`url`)}function KS(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 qS(e,t,n){if(e===void 0)return[void 0];if(t===`$this`)return[e];let r=n?.withPath?JS:nC,[i,...a]=t.split(`.`),o=[r(e,i,n)];for(let e of a){let t=[];for(let i of o)if(Array.isArray(i))for(let a of i)t.push(r(a,e,n));else(n?.withPath&&i?.value!==void 0||!n?.withPath&&i!==void 0)&&t.push(r(i,e,n));o=t}return o}function JS(e,t,n){let r=e.path;return YS(nC(e,t,n),r,t)}function YS(e,t,n){let r=t?t+`.`:``;return e===void 0?{type:`undefined`,value:void 0,path:`${r}${n}`}:Array.isArray(e)?e.map((e,t)=>({...e,path:`${r}${n}[${t}]`})):{...e,path:`${r}${n}`}}new Px(1e3);var XS={canonical:/^\S*$/,code:/^[^\s]+( [^\s]+)*$/,date:/^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1]))?)?$/,dateTime:/^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2]\d|3[0-1])(T([01]\d|2[0-3])(:[0-5]\d:([0-5]\d|60)(\.\d{1,9})?)?)?)?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00)?)?)?$/,id:/^[A-Za-z0-9\-.]{1,64}$/,instant:/^(\d(\d(\d[1-9]|[1-9]0)|[1-9]00)|[1-9]000)-(0[1-9]|1[0-2])-(0[1-9]|[1-2]\d|3[0-1])T([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?(Z|[+-]((0\d|1[0-3]):[0-5]\d|14:00))$/,markdown:/^[\r\n\t\u0020-\uFFFF]+$/,oid:/^urn:oid:[0-2](\.(0|[1-9]\d*))+$/,string:/^[\r\n\t\u0020-\uFFFF]+$/,time:/^([01]\d|2[0-3]):[0-5]\d:([0-5]\d|60)(\.\d{1,9})?$/,uri:/^\S*$/,url:/^\S*$/,uuid:/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/,xhtml:/.*/};function ZS(e,t,n,r){if(Array.isArray(e))return!1;let i;i=t.path===`$this`?n:(r??n.elements)[t.path];let a=n.type;switch(t.type){case`value`:case`pattern`:if(!e||!i)return!1;if(i.pattern)return ZC(e,i.pattern);if(i.fixed)return JC(e,i.fixed);if(i.binding?.strength===`required`&&i.binding.valueSet)return!0;break;case`type`:return!e||!a?.length?!1:a.some(t=>t.code===e.type)}return!1}function QS(e){return[{type:Y.boolean,value:e}]}function $S(e){return e==null?{type:`undefined`,value:void 0}:Number.isSafeInteger(e)?{type:Y.integer,value:e}:typeof e==`number`?{type:Y.decimal,value:e}:typeof e==`boolean`?{type:Y.boolean,value:e}:typeof e==`string`?{type:Y.string,value:e}:bC(e)?{type:Y.Quantity,value:e}:fT(e)?{type:e.resourceType,value:e}:aw(e)?{type:Y.CodeableConcept,value:e}:iw(e)?{type:Y.Coding,value:e}:{type:Y.BackboneElement,value:e}}function eC(e){return e.length!==0&&!!e[0].value}function tC(e,t){if(e.length!==0){if(e.length===1&&(!t||e[0].type===t))return e[0];{let n=t?` of type ${t}`:``;throw Error(`Expected singleton${n}, but found ${JSON.stringify(e)}`)}}}function nC(e,t,n){if(!e.value)return;let r=uT(e.type,t,n?.profileUrl);return r?rC(e,t,r):aC(e,t)}function rC(e,t,n){let r=e.value,i=n.type;if(!i||i.length===0)return;let a,o=`undefined`,s,c=n.path.lastIndexOf(`.`),l=n.path.substring(c+1),u=l,d=!1;l.endsWith(`[x]`)&&(u=l.substring(0,l.length-3),d=!0);for(let e of i){let t=u;if(d&&(t+=dw(e.code)),a=r[t],s=r[`_`+t],a!==void 0||s!==void 0){o=e.code;break}}if(s){if(Array.isArray(a)){a=a.slice();for(let e=0;e<Math.max(a.length,s.length);e++)a[e]=wC(a[e],s[e])}else if(!a&&Array.isArray(s)){a=s.slice();for(let e=0;e<s.length;e++)a[e]=wC(void 0,s[e])}else a=wC(a,s)}if(!GC(a))return(o===`Element`||o===`BackboneElement`)&&(o=n.type[0].code),Array.isArray(a)?a.map(e=>iC(e,o)):iC(a,o)}function iC(e,t){return t===`Resource`&&fT(e)&&(t=e.resourceType),{type:t,value:e}}function aC(e,t){let n=e.value;if(!n||typeof n!=`object`)return;let r;if(t in n){let e=n[t];r=Array.isArray(e)?e.map($S):$S(e)}else{let e=t.endsWith(`[x]`)?t.substring(0,t.length-3):t;for(let t of Object.values(Y)){let i=e+dw(t);if(i in n){let e=n[i];r=Array.isArray(e)?e.map(e=>({type:t,value:e})):{type:t,value:e};break}}}if(Array.isArray(r)){if(r.length===0||GC(r[0]))return}else if(GC(r))return;return r}function oC(e){let t=[];for(let n of e){let e=!1;for(let r of t)if(eC(uC(n,r))){e=!0;break}e||t.push(n)}return t}function sC(e){return QS(!eC(e))}function cC(e,t){return e.length===0||t.length===0?[]:e.length===t.length?QS(e.every((e,n)=>eC(uC(e,t[n])))):QS(!1)}function lC(e,t){return e.length===0||t.length===0?[]:e.length===t.length?QS(e.some((e,n)=>!eC(uC(e,t[n])))):QS(!0)}function uC(e,t){let n=e.value?.valueOf(),r=t.value?.valueOf();return typeof n==`number`&&typeof r==`number`?QS(Math.abs(n-r)<1e-8):bC(n)&&bC(r)?QS(xC(n,r)):QS(typeof n==`object`&&typeof r==`object`?SC(e,t):n===r)}function dC(e,t){return e.length===0&&t.length===0?QS(!0):e.length===t.length?(e.sort(pC),t.sort(pC),QS(e.every((e,n)=>eC(fC(e,t[n]))))):QS(!1)}function fC(e,t){let{type:n,value:r}=e,{type:i,value:a}=t,o=r?.valueOf(),s=a?.valueOf();return typeof o==`number`&&typeof s==`number`?QS(Math.abs(o-s)<.01):bC(o)&&bC(s)?QS(xC(o,s)):QS(n===`Coding`&&i===`Coding`?typeof o!=`object`||typeof s!=`object`?!1:o.code===s.code&&o.system===s.system:typeof o==`object`&&typeof s==`object`?SC({...o,id:void 0},{...s,id:void 0}):typeof o==`string`&&typeof s==`string`?o.toLowerCase()===s.toLowerCase():o===s)}function pC(e,t){let 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 mC(e,t){let{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 hC(n);case`DateTime`:return gC(n);case`Time`:return typeof n==`string`&&!!/^T\d/.exec(n);case`Period`:return _C(n);case`Quantity`:return bC(n);default:return e.type===r||typeof n==`object`&&n?.resourceType===r}}function hC(e){return typeof e==`string`&&!!XS.date.exec(e)}function gC(e){return typeof e==`string`&&!!XS.dateTime.exec(e)}function _C(e){return!!(e&&typeof e==`object`&&(`start`in e&&gC(e.start)||`end`in e&&gC(e.end)))}function vC(e){if(hC(e)||gC(e))return{start:yC(e,`0000-01-01T00:00:00.000`),end:yC(e,`xxxx-12-31T23:59:59.999`)};if(_C(e))return{start:e.start?yC(e.start,`0000-01-01T00:00:00.000`):void 0,end:e.end?yC(e.end,`xxxx-12-31T23:59:59.999`):void 0}}function yC(e,t){let n=`Z`,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));let i=e+t.substring(e.length)+n;return new Date(i).toISOString()}function bC(e){return!!(e&&typeof e==`object`&&`value`in e&&typeof e.value==`number`)}function xC(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 SC(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(CC(n)&&CC(i)){if(!SC(n,i))return!1}else if(n!==i)return!1}return!0}function CC(e){return typeof e==`object`&&!!e}function wC(e,t){if(t){if(typeof t!=`object`)throw Error(`Primitive extension must be an object`);return TC(e??{},t)}return e}function TC(e,t){return delete t.__proto__,delete t.constructor,Object.assign(e,t)}function EC(e,t){return fT(e,t)&&`id`in e&&typeof e.id==`string`}function DC(e){let t=OC(e)??`undefined/undefined`,n=MC(e);return n===t?{reference:t}:{reference:t,display:n}}function OC(e){if(pT(e))return e.reference;if(EC(e))return`${e.resourceType}/${e.id}`}function kC(e){if(e)return pT(e)?e.reference.split(`/`)[1]:e.id}function AC(e){if(e){if(e.accounts&&e.account){let t=e.accounts;return t.some(t=>t.reference===e.account?.reference)?t:[e.account,...t]}return zx(e.accounts??e.account)}}function jC(e){return e.resourceType===`Patient`||e.resourceType===`Practitioner`||e.resourceType===`RelatedPerson`}function MC(e){if(jC(e)){let t=NC(e);if(t)return t}if(e.resourceType===`Appointment`&&e.serviceType?.[0])return Ww(e.serviceType[0]);if(e.resourceType===`Device`){let t=PC(e);if(t)return t}if(e.resourceType===`DocumentReference`){if(e.description)return e.description;if(e.type)return Ww(e.type)}if(e.resourceType===`MedicationRequest`&&e.medicationCodeableConcept||e.resourceType===`MedicationStatement`&&e.medicationCodeableConcept)return Ww(e.medicationCodeableConcept);if(e.resourceType===`Slot`&&(e.start||e.end))return`${Pw(e.start)} - ${Pw(e.end)}`;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]),aw(t))return Ww(t);if(ow(t))return t.text}return OC(e)??``}function NC(e){let t=e.name;if(t&&t.length>0)return jw(t[0])}function PC(e){let t=e.deviceName;if(t&&t.length>0)return t[0].name}function FC(e){if(!(`photo`in e))return;let t=e.photo;if(t){if(Array.isArray(t))for(let e of t){let t=IC(e);if(t)return t}else return IC(t)}}function IC(e){if(e.url&&e.contentType?.startsWith(`image/`))return e.url}function LC(e,t){let n=new Date(e);n.setUTCHours(0,0,0,0);let r=t?new Date(t):new Date;r.setUTCHours(0,0,0,0);let i=n.getUTCFullYear(),a=n.getUTCMonth(),o=n.getUTCDate(),s=r.getUTCFullYear(),c=r.getUTCMonth(),l=r.getUTCDate(),u=s-i;(c<a||c===a&&l<o)&&u--;let d=s*12+c-(i*12+a);l<o&&d--;let f=Math.floor((r.getTime()-n.getTime())/864e5);return{years:u,months:d,days:f}}function RC(e,t){let{years:n,months:r,days:i}=LC(e,t);return n>=2?n.toString().padStart(3,`0`)+`Y`:r>=1?r.toString().padStart(3,`0`)+`M`:i.toString().padStart(3,`0`)+`D`}function zC(e,t){let n=e.identifier;if(!n)return;let r=Array.isArray(n)?n:[n];for(let e of r)if(e.system===t)return e.value}function BC(e,...t){let n=e;for(let e=0;e<t.length&&n;e++)n=(n?.extension)?.find(n=>n.url===t[e]);return n}function VC(e,t){let n=HC(e);return JSON.stringify(n,null,t?2:void 0)??``}function HC(e){if(e!=null&&e!==``)return typeof e==`object`?Array.isArray(e)?UC(e):WC(e):e}function UC(e){let t=e.length;if(t===0)return;let n,r=0;for(let i=0;i<t;i++){let t=e[i],a=HC(t);a!==t&&!n&&(n=Array.from(e)),a===void 0?n&&(n[i]=null):(n&&(n[i]=a),r++)}if(r!==0)return n??e}function WC(e){let t,n=0;for(let r in e){let i=e[r],a=HC(i);a!==i&&!t&&(t={...e}),a===void 0?t&&delete t[r]:(t&&(t[r]=a),n++)}if(n!==0)return t??e}function GC(e){if(e==null)return!0;let t=typeof e;return t===`string`||t===`object`?!KC(e):!1}function KC(e){if(e==null)return!1;let t=typeof e;return t===`string`&&e!==``||t===`object`&&(`length`in e&&e.length>0||Object.keys(e).length>0)}function qC(e){if(!e)return;let t=e.length-1;for(;t>=0&&GC(e[t]);)t--;return t>=0?e.slice(0,t+1):void 0}function JC(e,t,n){return e===t||GC(e)&&GC(t)?!0:GC(e)||GC(t)?!1:Array.isArray(e)&&Array.isArray(t)?YC(e,t):Array.isArray(e)||Array.isArray(t)?!1:nw(e)&&nw(t)?XC(e,t,n):!1}function YC(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(!JC(e[n],t[n]))return!1;return!0}function XC(e,t,n){let r=new Set;for(let t of Object.keys(e))r.add(t);for(let e of Object.keys(t))r.add(e);n===`meta`&&(r.delete(`versionId`),r.delete(`lastUpdated`),r.delete(`author`));for(let n of r){let r=e[n],i=t[n];if(!JC(r,i,n))return!1}return!0}function ZC(e,t){return GC(e)?!0:GC(t)?!1:Array.isArray(e)&&Array.isArray(t)?QC(e,t):Array.isArray(e)||Array.isArray(t)?!1:nw(e)&&nw(t)?$C(e,t):nw(e)||nw(t)?!1:e===t}function QC(e,t){return t.every(t=>e.some(e=>ZC(e,t)))}function $C(e,t){return Object.entries(t).every(([t,n])=>t in e&&ZC(e[t],n))}function ew(e){return e===void 0?e:JSON.parse(JSON.stringify(e))}function tw(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 nw(e){return typeof e==`object`&&!!e}function rw(e){return typeof e==`string`}function iw(e){return nw(e)&&`code`in e&&typeof e.code==`string`}function aw(e){return nw(e)&&`coding`in e&&Array.isArray(e.coding)&&e.coding.every(iw)}function ow(e){return nw(e)&&`text`in e&&typeof e.text==`string`}var sw=[];for(let e=0;e<256;e++)sw.push(e.toString(16).padStart(2,`0`));function cw(e){let t=uw(e),n=new Uint8Array(t),r=Array(n.length);for(let e=0;e<n.length;e++)r[e]=sw[n[e]];return r.join(``)}function lw(e){let t=uw(e),n=new Uint8Array(t),r=Array(n.length);for(let e=0;e<n.length;e++)r[e]=String.fromCodePoint(n[e]);return window.btoa(r.join(``))}function uw(e){return ArrayBuffer.isView(e)?e.buffer:e}function dw(e){return e?e.charAt(0).toUpperCase()+e.substring(1):``}function fw(e){return e.length>0&&e.startsWith(e[0].toUpperCase())}function pw(e,t){let n=e+`.`;if(t.startsWith(n))return t.slice(n.length)}function mw(e,t){return e.coding?.find(e=>e.system===t)?.code}var hw=(e,t)=>new Promise((n,r)=>{t?.signal?.throwIfAborted();let i=setTimeout(n,e);t?.signal?.addEventListener(`abort`,()=>{clearTimeout(i),r(t.signal?.reason)},{once:!0})});function gw(e,t,n){let r=[];for(let i=0;i<n-1;i++){let n=e.indexOf(t);if(n<0)break;r.push(e.slice(0,n)),e=e.slice(n+t.length)}return r.push(e),r}function _w(e){let t,n=!1;return function(){return n||=(t=e(),!0),t}}function vw(e,t){return e?(e.push(t),e):[t]}function yw(e){return e.sort((e,t)=>e.localeCompare(t))}function bw(e){return e.endsWith(`/`)?e:e+`/`}function xw(e){return e.startsWith(`/`)?e.slice(1):e}function Sw(e,t){return new URL(xw(t),bw(e.toString())).toString()}function Cw(e,t){return Sw(e,t).toString().replace(`http://`,`ws://`).replace(`https://`,`wss://`)}function ww(e){return typeof e==`object`&&!Array.isArray(e)&&!(e instanceof URLSearchParams)&&(e=Object.fromEntries(Object.entries(e).filter(e=>e[1]!==void 0))),new URLSearchParams(e).toString()}function Tw(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 Ew(e,t){if(e?.meta?.profile?.includes(t)){let n=e.meta.profile.indexOf(t);e.meta.profile.splice(n,1)}return e}var Dw=Object.freeze([]);function Ow(e){if(!e)return``;switch(e.type){case`Address`:return Aw(e.value);case`CodeableConcept`:return Ww(e.value);case`Coding`:return Gw(e.value);case`ContactPoint`:return e.value.value;case`HumanName`:return jw(e.value);case`Quantity`:return Hw(e.value);case`Reference`:return kw(e.value);default:return e.value?.toString()??``}}function kw(e){return e?e.display??e.reference??VC(e):``}function Aw(e,t){if(!e)return``;let n=[];if(e.line&&n.push(...e.line),e.city||e.state||e.postalCode){let t=[];e.city&&t.push(e.city),e.state&&t.push(e.state),e.postalCode&&t.push(e.postalCode),n.push(t.join(`, `))}return e.use&&(t?.all||t?.use)&&n.push(`[`+e.use+`]`),n.join(t?.lineSeparator??`, `).trim()}function jw(e,t){if(!e)return``;let 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){let t=qw(e.text);if(t)return t}return n.join(` `).trim()}function Mw(e){return e instanceof Date&&!Number.isNaN(e.getTime())}function Nw(e,t,n){if(!e)return``;let[r=0,i=0,a=0]=e.split(`:`).map(Number),o=new Date(Date.UTC(1970,0,1,r,i,a));return Mw(o)?new Intl.DateTimeFormat(t,{hour:`numeric`,minute:`2-digit`,second:a===0?void 0:`numeric`,...n,timeZone:`UTC`}).format(o):``}function Pw(e,t,n){if(!e)return``;let r=new Date(e);return Mw(r)?r.toLocaleString(t,n):``}function Fw(e,t,n){return!e||!e.start&&!e.end?``:Pw(e.start,t,n)+` - `+Pw(e.end,t,n)}var Iw={s:`every second`,min:`every minute`,h:`hourly`,d:`daily`,wk:`weekly`,mo:`monthly`,a:`annually`},Lw={s:`second`,min:`minute`,h:`hour`,d:`day`,wk:`week`,mo:`month`,a:`year`},Rw={s:`seconds`,min:`minutes`,h:`hours`,d:`days`,wk:`weeks`,mo:`months`,a:`years`};function zw(e){if(!e)return``;let t=[];return Bw(t,e.repeat),e.event&&t.push(e.event.map(e=>Pw(e)).join(`, `)),dw(t.join(` `).trim())}function Bw(e,t){if(!t?.periodUnit)return;let n=t.frequency??1,r=t.period??1,i=t.periodUnit;n===1&&r===1?e.push(Iw[i]):(n===1?e.push(`once`):e.push(n+` times`),r===1?e.push(`per `+Lw[i]):e.push(`per `+r+` `+Rw[i])),t.dayOfWeek&&e.push(`on `+t.dayOfWeek.map(dw).join(`, `)),t.timeOfDay&&e.push(`at `+t.timeOfDay.map(e=>Nw(e)).join(`, `))}function Vw(e,t,n=!1){if(n&&t===void 0)throw Error(`Precision must be specified for exclusive ranges`);let r=e?.low&&{...e.low,comparator:void 0},i=e?.high&&{...e.high,comparator:void 0};return r?.value===void 0&&i?.value===void 0?``:r?.value!==void 0&&i?.value===void 0?n&&t!==void 0?(r.value=Yw(r.value,t),`> ${Hw(r,t)}`):`>= ${Hw(r,t)}`:r?.value===void 0&&i?.value!==void 0?n&&t!==void 0?(i.value=Jw(i.value,t),`< ${Hw(i,t)}`):`<= ${Hw(i,t)}`:(r?.unit===i?.unit&&delete r?.unit,`${Hw(r,t)} - ${Hw(i,t)}`)}function Hw(e,t){if(!e)return``;let n=[];return e.comparator&&(n.push(e.comparator),n.push(` `)),e.value!==void 0&&(t===void 0?n.push(e.value):n.push(e.value.toFixed(t))),e.unit&&(e.unit!==`%`&&n.at(-1)!==` `&&n.push(` `),n.push(e.unit)),n.join(``).trim()}function Uw(e){return e?.value===void 0?``:e.value.toLocaleString(void 0,{style:`currency`,currency:e.currency??`USD`,currencyDisplay:`narrowSymbol`})}function Ww(e){return e?qw(e.text)||(e.coding?e.coding.map(e=>Gw(e)).join(`, `):``):``}function Gw(e,t){let n=qw(e?.display);if(n){let r=t?qw(e?.code):void 0;return`${n}${r?` (`+r+`)`:``}`}return qw(e?.code)??``}function Kw(e){if(!e)return``;let t=[];if(e.valueQuantity)t.push(Hw(e.valueQuantity));else if(e.valueCodeableConcept)t.push(Ww(e.valueCodeableConcept));else{let n=qw(e.valueString);n&&t.push(n)}return`component`in e&&t.push(e.component.map(e=>Kw(e)).join(` / `)),t.join(` / `).trim()}function qw(e){return typeof e==`string`?e:void 0}function Jw(e,t,n=1){return(Xw(e,t)+n)*10**-t}function Yw(e,t,n=1){return(Xw(e,t)-n)*10**-t}function Xw(e,t){return t===void 0?e:Math.round(e*10**t)}var Y={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 Zw(e){let t=Array.isArray(e)?e:e.entry?.map(e=>e.resource)??[];for(let e of t)e?.resourceType===`StructureDefinition`&&e.kind===`resource`&&Qw(e.type)}function Qw(e){let t=mT.types[e];t||(t={searchParamsDetails:{}},mT.types[e]=t);let n;return!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`,get target(){return n??=rT(),n}},_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`},_project:{base:[e],code:`_project`,type:`token`,expression:e+`.meta.project`}}),t}function $w(e){for(let t of e.base??Dw){let n=Qw(t);n.searchParams||={},n.searchParams[e.code]=e}}function eT(e){let t=e.type?.[0]?.code;return t===`BackboneElement`||t===`Element`?tT((e.base?.path??e.path)?.split(`.`)):t}function tT(e){return e.length===1?e[0]:e.map(dw).join(``)}function nT(e){return e.kind===`resource`&&e.name!==`Resource`&&e.name!==`DomainResource`}function rT(){return Object.values(NS()).filter(nT).map(e=>e.name)}function iT(e){return mT.types[e]?.searchParams}function aT(e,t){return mT.types[e]?.searchParams?.[t]}function oT(e){return sT(e.replaceAll(`[x]`,``).split(`.`).pop())}function sT(e){let t;return t=e.length<100?e.match(/[A-Z]+(?![a-z])|[A-Z]?[a-z]+|\d+/g)??[]:e.split(/(?=[A-Z])/),t.map(lT).join(` `).replace(`_`,` `).replaceAll(/\s+/g,` `)}var cT=new Set([`CDS`,`ID`,`IP`,`JWKS`,`PKCE`,`OMB`,`OID`,`SOP`,`UDI`,`UID`,`URI`,`URL`]);function lT(e){let t=e.toUpperCase();return e===t?e:cT.has(t)?t:t.charAt(0)+e.slice(1)}function uT(e,t,n){let r=FS(e,n);if(r)return dT(r.elements,t)}function dT(e,t){let n=e[t]??e[t+`[x]`];if(n)return n;for(let n=0;n<t.length;n++){let r=t[n];if(r>=`A`&&r<=`Z`){let r=e[t.slice(0,n)+`[x]`];if(r)return r}}}function fT(e,t){return!(!e||typeof e!=`object`||!(`resourceType`in e)||t&&e.resourceType!==t)}function pT(e,t){return e&&typeof e==`object`&&`reference`in e&&typeof e.reference==`string`?!t||e.reference.match(RegExp(`^${t}(/|\\?)`))!==null:!1}var mT={types:{}};function hT(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}}var gT=()=>[];function _T(e){return e instanceof TT?e.name:e instanceof PT&&e.left instanceof TT&&e.right instanceof TT?e.left.name+`.`+e.right.name:``}var vT={empty:(e,t)=>QS(t.every(e=>GC(e.value))),hasValue:(e,t)=>QS(t.length!==0),exists:(e,t,n)=>QS(n?t.some(t=>eC(n.eval(e,[t]))):t.length>0&&t.every(e=>!GC(e.value))),all:(e,t,n)=>QS(t.every(t=>eC(n.eval(e,[t])))),allTrue:(e,t)=>{for(let e of t)if(!e.value)return QS(!1);return QS(!0)},anyTrue:(e,t)=>{for(let e of t)if(e.value)return QS(!0);return QS(!1)},allFalse:(e,t)=>{for(let e of t)if(e.value)return QS(!1);return QS(!0)},anyFalse:(e,t)=>{for(let e of t)if(!e.value)return QS(!0);return QS(!1)},subsetOf:(e,t,n)=>{if(t.length===0)return QS(!0);let r=n.eval(e,ST(e));return r.length===0?QS(!1):QS(t.every(e=>r.some(t=>t.value===e.value)))},supersetOf:(e,t,n)=>{let r=n.eval(e,ST(e));return r.length===0?QS(!0):t.length===0?QS(!1):QS(r.every(e=>t.some(t=>t.value===e.value)))},count:(e,t)=>[{type:Y.integer,value:t.length}],distinct:(e,t)=>{let n=[];for(let e of t)n.some(t=>t.value===e.value)||n.push(e);return n},isDistinct:(e,t)=>QS(t.length===vT.distinct(e,t).length),where:(e,t,n)=>t.filter(t=>eC(n.eval(e,[t]))),select:(e,t,n)=>t.flatMap(t=>n.eval({parent:e,variables:{$this:t}},[t])),repeat:gT,ofType:(e,t,n)=>{let r=_T(n);return r?t.filter(e=>mC(e,r)):[]},single:(e,t)=>{if(t.length>1)throw 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)=>{let r=n.eval(e,t)[0]?.value;if(typeof r!=`number`)throw TypeError(`Expected a number for skip(num)`);return r>=t.length?[]:r<=0?t:t.slice(r,t.length)},take:(e,t,n)=>{let r=n.eval(e,t)[0]?.value;if(typeof r!=`number`)throw TypeError(`Expected a number for take(num)`);return r<=0?[]:t.slice(0,r)},intersect:(e,t,n)=>{if(!n)return t;let r=n.eval(e,ST(e)),i=[];for(let e of t)!i.some(t=>t.value===e.value)&&r.some(t=>t.value===e.value)&&i.push(e);return i},exclude:(e,t,n)=>{if(!n)return t;let r=n.eval(e,ST(e)),i=[];for(let e of t)r.some(t=>t.value===e.value)||i.push(e);return i},union:(e,t,n)=>{if(!n)return t;let r=n.eval(e,ST(e));return oC([...t,...r])},combine:(e,t,n)=>{if(!n)return t;let r=n.eval(e,ST(e));return[...t,...r]},htmlChecks:(e,t,n)=>[$S(!0)],iif:(e,t,n,r,i)=>{let a=n.eval(e,t);if(a.length>1||a.length===1&&typeof a[0].value!=`boolean`)throw Error(`Expected criterion to evaluate to a Boolean`);return eC(a)?r.eval(e,t):i?i.eval(e,t):[]},toBoolean:(e,t)=>{if(t.length===0)return[];let[{value:n}]=xT(t,1);if(typeof n==`boolean`)return[{type:Y.boolean,value:n}];if(typeof n==`number`&&(n===0||n===1))return QS(!!n);if(typeof n==`string`){let e=n.toLowerCase();if([`true`,`t`,`yes`,`y`,`1`,`1.0`].includes(e))return QS(!0);if([`false`,`f`,`no`,`n`,`0`,`0.0`].includes(e))return QS(!1)}return[]},convertsToBoolean:(e,t)=>t.length===0?[]:QS(vT.toBoolean(e,t).length===1),toInteger:(e,t)=>{if(t.length===0)return[];let[{value:n}]=xT(t,1);return typeof n==`number`?[{type:Y.integer,value:n}]:typeof n==`string`&&/^[+-]?\d+$/.exec(n)?[{type:Y.integer,value:Number.parseInt(n,10)}]:typeof n==`boolean`?[{type:Y.integer,value:+!!n}]:[]},convertsToInteger:(e,t)=>t.length===0?[]:QS(vT.toInteger(e,t).length===1),toDate:(e,t)=>{if(t.length===0)return[];let[{value:n}]=xT(t,1);return typeof n==`string`&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:Y.date,value:hT(n)}]:[]},convertsToDate:(e,t)=>t.length===0?[]:QS(vT.toDate(e,t).length===1),toDateTime:(e,t)=>{if(t.length===0)return[];let[{value:n}]=xT(t,1);return typeof n==`string`&&/^\d{4}(-\d{2}(-\d{2})?)?/.exec(n)?[{type:Y.dateTime,value:hT(n)}]:[]},convertsToDateTime:(e,t)=>t.length===0?[]:QS(vT.toDateTime(e,t).length===1),toDecimal:(e,t)=>{if(t.length===0)return[];let[{value:n}]=xT(t,1);return typeof n==`number`?[{type:Y.decimal,value:n}]:typeof n==`string`&&/^-?\d{1,9}(\.\d{1,9})?$/.exec(n)?[{type:Y.decimal,value:Number.parseFloat(n)}]:typeof n==`boolean`?[{type:Y.decimal,value:+!!n}]:[]},convertsToDecimal:(e,t)=>t.length===0?[]:QS(vT.toDecimal(e,t).length===1),toQuantity:(e,t)=>{if(t.length===0)return[];let[{value:n}]=xT(t,1);return bC(n)?[{type:Y.Quantity,value:n}]:typeof n==`number`?[{type:Y.Quantity,value:{value:n,unit:`1`}}]:typeof n==`string`&&/^-?\d{1,9}(\.\d{1,9})?/.exec(n)?[{type:Y.Quantity,value:{value:Number.parseFloat(n),unit:`1`}}]:typeof n==`boolean`?[{type:Y.Quantity,value:{value:+!!n,unit:`1`}}]:[]},convertsToQuantity:(e,t)=>t.length===0?[]:QS(vT.toQuantity(e,t).length===1),toString:(e,t)=>{if(t.length===0)return[];let[{value:n}]=xT(t,1);return n==null?[]:bC(n)?[{type:Y.string,value:`${n.value} '${n.unit}'`}]:[{type:Y.string,value:n.toString()}]},convertsToString:(e,t)=>t.length===0?[]:QS(vT.toString(e,t).length===1),toTime:(e,t)=>{if(t.length===0)return[];let[{value:n}]=xT(t,1);if(typeof n==`string`){let e=/^T?(\d{2}(:\d{2}(:\d{2})?)?)/.exec(n);if(e)return[{type:Y.time,value:hT(`T`+e[1])}]}return[]},convertsToTime:(e,t)=>t.length===0?[]:QS(vT.toTime(e,t).length===1),indexOf:(e,t,n)=>yT((e,t)=>e.indexOf(t),e,t,n),substring:(e,t,n,r)=>yT((e,t,n)=>{let r=t,i=n?r+n:e.length;return r<0||r>=e.length?void 0:e.substring(r,i)},e,t,n,r),startsWith:(e,t,n)=>yT((e,t)=>e.startsWith(t),e,t,n),endsWith:(e,t,n)=>yT((e,t)=>e.endsWith(t),e,t,n),contains:(e,t,n)=>yT((e,t)=>e.includes(t),e,t,n),upper:(e,t)=>yT(e=>e.toUpperCase(),e,t),lower:(e,t)=>yT(e=>e.toLowerCase(),e,t),replace:(e,t,n,r)=>yT((e,t,n)=>e.replaceAll(t,n),e,t,n,r),matches:(e,t,n)=>yT((e,t)=>!!new RegExp(t).exec(e),e,t,n),replaceMatches:(e,t,n,r)=>yT((e,t,n)=>e.replaceAll(new RegExp(t,`g`),n.replaceAll(/\$\{(\w+)\}/g,`$<$1>`)),e,t,n,r),length:(e,t)=>yT(e=>e.length,e,t),toChars:(e,t)=>yT(e=>e?e.split(``):void 0,e,t),encode:gT,decode:gT,escape:gT,unescape:gT,trim:gT,split:gT,join:(e,t,n)=>{let r=n?.eval(e,ST(e))[0]?.value??``;if(typeof r!=`string`)throw TypeError(`Separator must be a string.`);return[{type:Y.string,value:t.map(e=>e.value?.toString()??``).join(r)}]},abs:(e,t)=>bT(Math.abs,e,t),ceiling:(e,t)=>bT(Math.ceil,e,t),exp:(e,t)=>bT(Math.exp,e,t),floor:(e,t)=>bT(Math.floor,e,t),ln:(e,t)=>bT(Math.log,e,t),log:(e,t,n)=>bT((e,t)=>Math.log(e)/Math.log(t),e,t,n),power:(e,t,n)=>bT(Math.pow,e,t,n),round:(e,t,...n)=>bT((e,t=0)=>{if(typeof t!=`number`||t<0)throw Error(`Invalid precision provided to round()`);let n=10**t;return Math.round(e*n)/n},e,t,...n),sqrt:(e,t)=>bT(Math.sqrt,e,t),truncate:(e,t)=>bT(e=>Math.trunc(e),e,t),children:gT,descendants:gT,trace:(e,t,n)=>t,now:()=>[{type:Y.dateTime,value:new Date().toISOString()}],timeOfDay:()=>[{type:Y.time,value:new Date().toISOString().substring(11)}],today:()=>[{type:Y.date,value:new Date().toISOString().substring(0,10)}],between:(e,t,n,r,i)=>{let a=vT.toDateTime(e,n.eval(e,t));if(a.length===0)throw Error(`Invalid start date`);let o=vT.toDateTime(e,r.eval(e,t));if(o.length===0)throw Error(`Invalid end date`);let s=i.eval(e,t)[0]?.value;if(s!==`years`&&s!==`months`&&s!==`days`)throw Error(`Invalid units`);let c=LC(a[0].value,o[0].value);return[{type:Y.Quantity,value:{value:c[s],unit:s}}]},is:(e,t,n)=>{let r=_T(n);return r?t.map(e=>({type:Y.boolean,value:mC(e,r)})):[]},not:(e,t)=>vT.toBoolean(e,t).map(e=>({type:Y.boolean,value:!e.value})),resolve:(e,t)=>t.map(e=>{let t=e.value,n;if(typeof t==`string`)n=t;else if(typeof t==`object`){let e=t;if(e.resource)return $S(e.resource);e.reference?n=e.reference:e.type&&e.identifier&&(n=`${e.type}?identifier=${e.identifier.system}|${e.identifier.value}`)}if(n?.includes(`?`)){let[e]=n.split(`?`);return{type:e,value:{resourceType:e}}}if(n?.includes(`/`)){let[e,t]=n.split(`/`);return{type:e,value:{resourceType:e,id:t}}}return{type:Y.BackboneElement,value:void 0}}).filter(e=>!!e.value),as:(e,t,n)=>{let r=_T(n);if(!r)throw Error(`Expected a valid type identifier as the right operand of 'as', but found ${n.toString()}`);let i=tC(t);return i&&mC(i,r)?[i]:[]},type:(e,t)=>t.map(({value:e})=>typeof e==`boolean`?{type:Y.BackboneElement,value:{namespace:`System`,name:`Boolean`}}:typeof e==`number`?{type:Y.BackboneElement,value:{namespace:`System`,name:`Integer`}}:fT(e)?{type:Y.BackboneElement,value:{namespace:`FHIR`,name:e.resourceType}}:{type:Y.BackboneElement,value:null}),conformsTo:(e,t,n)=>{let r=n.eval(e,t)[0].value;if(!r.startsWith(`http://hl7.org/fhir/StructureDefinition/`))throw Error(`Expected a StructureDefinition URL`);let i=r.replace(`http://hl7.org/fhir/StructureDefinition/`,``);return t.map(e=>({type:Y.boolean,value:e.value?.resourceType===i}))},getResourceKey:(e,t)=>{let n=t[0]?.value;return n?.id?[{type:Y.id,value:n.id}]:[]},getReferenceKey:(e,t,n)=>{let r=t[0]?.value;if(!r?.reference)return[];let i=``;return n instanceof TT&&(i=n.name),i&&!r.reference.startsWith(i+`/`)?[]:[{type:Y.id,value:kC(r)}]},extension:(e,t,n)=>{let r=n.eval(e,t)[0].value,i=t?.[0]?.value;if(i){let e=BC(i,r);if(e)return[{type:Y.Extension,value:e}]}return[]}};function yT(e,t,n,...r){if(n.length===0)return[];let[{value:i}]=xT(n,1);if(typeof i!=`string`)throw TypeError(`String function cannot be called with non-string`);let a=e(i,...r.map(e=>e?.eval(t,n)[0]?.value));return a===void 0?[]:Array.isArray(a)?a.map($S):[$S(a)]}function bT(e,t,n,...r){if(n.length===0)return[];let[{value:i}]=xT(n,1),a=bC(i),o=a?i.value:i;if(typeof o!=`number`)throw TypeError(`Math function cannot be called with non-number`);let s=e(o,...r.map(e=>e.eval(t,n)[0]?.value));return[{type:a?Y.Quantity:n[0].type,value:a?{...i,value:s}:s}]}function xT(e,t){if(e.length!==t)throw Error(`Expected ${t} arguments`);for(let t of e)if(t==null)throw Error(`Expected non-null argument`);return e}function ST(e){let t=e;for(;t.parent?.variables.$this;)t=t.parent;return[t.variables.$this]}var CT=class{original;child;constructor(e,t){this.original=e,this.child=t}eval(e,t){try{if(t.length>0){let n=[];for(let r of t)n.push(this.child.eval({parent:e,variables:{$this:r}},[r]));return n.flat()}return this.child.eval(e,[])}catch(e){throw Error(`FhirPathError on "${this.original}": ${e}`,{cause:e})}}toString(){return this.child.toString()}},wT=class{value;constructor(e){this.value=e}eval(){return[this.value]}toString(){let e=this.value.value;return typeof e==`string`?`'${e}'`:e.toString()}},TT=class{name;constructor(e){this.name=e}eval(e,t){if(this.name===`$this`)return t;let n=this.getVariable(e);if(n)return[n];if(this.name.startsWith(`%`))throw Error(`Undefined variable ${this.name}`);return t.flatMap(e=>this.evalValue(e)).filter(e=>e?.value!==void 0)}getVariable(e){let t=e.variables[this.name];if(t!==void 0)return t;if(e.parent)return this.getVariable(e.parent)}evalValue(e){let t=e.value;if(t&&typeof t==`object`)return fT(t,this.name)?(`path`in e||(e.path=t.resourceType),e):JS(e,this.name)}toString(){return this.name}},ET=class{eval(){return[]}toString(){return`{}`}},DT=class extends Fx{impl;constructor(e,t,n){super(e,t),this.impl=n}eval(e,t){return this.impl(this.child.eval(e,t))}toString(){return this.operator+this.child.toString()}},OT=class extends Ix{constructor(e,t){super(`as`,e,t)}eval(e,t){return vT.as(e,this.left.eval(e,t),this.right)}},kT=class extends Ix{impl;constructor(e,t,n,r){super(e,t,n),this.impl=r}eval(e,t){let n=this.left.eval(e,t),r=this.right.eval(e,t);if(n.length<1||r.length<1)return[];let i=tC(n)?.value,a=tC(r)?.value,o=bC(i)?i.value:i,s=bC(a)?a.value:a,c=this.impl(o,s);return typeof c==`boolean`?QS(c):bC(i)?[{type:Y.Quantity,value:{...i,value:c}}]:[$S(c)]}},AT=Object.freeze({type:`string`,value:``}),jT=class extends Ix{constructor(e,t){super(`&`,e,t)}eval(e,t){let n=tC(this.left.eval(e,t))??AT,r=tC(this.right.eval(e,t))??AT;if(typeof n.value!=`string`)throw Error(`Expected string operand for &, but got ${n.type}`);if(typeof r.value!=`string`)throw Error(`Expected string operand for &, but got ${r.type}`);return[{type:Y.string,value:n.value+r.value}]}},MT=class extends Ix{constructor(e,t){super(`contains`,e,t)}eval(e,t){let n=this.left.eval(e,t),r=this.right.eval(e,t);return QS(n.some(e=>e.value===r[0].value))}},NT=class extends Ix{constructor(e,t){super(`in`,e,t)}eval(e,t){let n=tC(this.left.eval(e,t)),r=this.right.eval(e,t);return n?QS(r.some(e=>uC(n,e)[0].value)):[]}},PT=class extends Ix{constructor(e,t){super(`.`,e,t)}eval(e,t){return this.right.eval(e,this.left.eval(e,t))}toString(){return`${this.left.toString()}.${this.right.toString()}`}},FT=class extends Ix{constructor(e,t){super(`|`,e,t)}eval(e,t){let n=this.left.eval(e,t),r=this.right.eval(e,t);return oC([...n,...r])}},IT=class extends Ix{constructor(e,t){super(`=`,e,t)}eval(e,t){return cC(this.left.eval(e,t),this.right.eval(e,t))}},LT=class extends Ix{constructor(e,t){super(`!=`,e,t)}eval(e,t){return lC(this.left.eval(e,t),this.right.eval(e,t))}},RT=class extends Ix{constructor(e,t){super(`~`,e,t)}eval(e,t){return dC(this.left.eval(e,t),this.right.eval(e,t))}},zT=class extends Ix{constructor(e,t){super(`!~`,e,t)}eval(e,t){return sC(dC(this.left.eval(e,t),this.right.eval(e,t)))}},BT=class extends Ix{constructor(e,t){super(`is`,e,t)}eval(e,t){let n=this.left.eval(e,t);if(n.length!==1)return[];let r=_T(this.right);return r?QS(mC(n[0],r)):[]}},VT=class extends Ix{constructor(e,t){super(`and`,e,t)}eval(e,t){let n=tC(this.left.eval(e,t),`boolean`),r=tC(this.right.eval(e,t),`boolean`);return n?.value===!0&&r?.value===!0?QS(!0):n?.value===!1||r?.value===!1?QS(!1):[]}},HT=class extends Ix{constructor(e,t){super(`or`,e,t)}eval(e,t){let n=tC(this.left.eval(e,t),`boolean`),r=tC(this.right.eval(e,t),`boolean`);return n?.value===!1&&r?.value===!1?QS(!1):n?.value||r?.value?QS(!0):[]}},UT=class extends Ix{constructor(e,t){super(`xor`,e,t)}eval(e,t){let n=tC(this.left.eval(e,t),`boolean`),r=tC(this.right.eval(e,t),`boolean`);return!n||!r?[]:QS(n.value!==r.value)}},WT=class extends Ix{constructor(e,t){super(`implies`,e,t)}eval(e,t){let n=tC(this.left.eval(e,t),`boolean`),r=tC(this.right.eval(e,t),`boolean`);return r?.value===!0||n?.value===!1?QS(!0):!n||!r?[]:QS(!1)}},GT=class{name;args;constructor(e,t){this.name=e,this.args=t}eval(e,t){let n=vT[this.name];if(!n)throw Error(`Unrecognized function: `+this.name);return n(e,t,...this.args)}toString(){return`${this.name}(${this.args.map(e=>e.toString()).join(`, `)})`}},KT=class{left;expr;constructor(e,t){this.left=e,this.expr=t}eval(e,t){let n=this.expr.eval(e,t);if(n.length!==1)return[];let r=n[0].value;if(typeof r!=`number`)throw Error(`Invalid indexer expression: should return integer}`);let i=this.left.eval(e,t);return r in i?[i[r]]:[]}toString(){return`${this.left.toString()}[${this.expr.toString()}]`}},qT=[`year`,`years`,`month`,`months`,`week`,`weeks`,`day`,`days`,`hour`,`hours`,`minute`,`minutes`,`second`,`seconds`,`millisecond`,`milliseconds`],JT=/^\d{4}-\d{2}[\dT:.+\-Z]*(?=[\s)\]]|$)/,YT={"'":`'`,'"':`"`,"`":"`",r:`\r`,n:`
|
|
54
54
|
`,t:` `,f:`\f`,"\\":`\\`},XT=class{str;keywords;operators;dateTimeLiterals;symbolRegex;result=[];pos={index:0,line:1,column:0};markStack=[];constructor(e,t,n,r){this.str=e,this.keywords=t,this.operators=n,this.dateTimeLiterals=!!r?.dateTimeLiterals,this.symbolRegex=r?.symbolRegex??/[$\w%]/}tokenize(){for(;this.pos.index<this.str.length;){let e=this.consumeToken();e&&this.result.push(e)}return this.result}prevToken(){return this.result.slice(-1)[0]}peekToken(){this.mark();let e=this.consumeToken();return this.reset(),e}consumeToken(){this.consumeWhitespace();let e=this.curr();if(!e)return;this.mark();let t=this.peek();return e===`/`&&t===`*`?this.consumeMultiLineComment():e===`/`&&t===`/`?this.consumeSingleLineComment():e===`'`||e===`"`||e==="`"?this.consumeString(e):e===`@`?this.consumeDateTime():/\d/.exec(e)?this.consumeNumber():/\w/.exec(e)||(e===`$`||e===`%`)&&/\w/.exec(t)?this.consumeSymbol():(e===`$`||e===`%`)&&(t===`'`||t===`"`||t==="`")?this.consumeQuotedSymbol(t):this.consumeOperator()}consumeWhitespace(){this.consumeWhile(()=>/\s/.exec(this.curr()))}consumeMultiLineComment(){let e=this.pos.index;return this.consumeWhile(()=>this.curr()!==`*`||this.peek()!==`/`),this.advance(),this.advance(),this.buildToken(`Comment`,this.str.substring(e,this.pos.index))}consumeSingleLineComment(){return this.buildToken(`Comment`,this.consumeWhile(()=>this.curr()!==`
|
|
55
55
|
`))}consumeString(e){this.advance();let t=``,n;for(;n=this.consumeChar(e);)t+=n;let r=this.buildToken(e==="`"?`Symbol`:`String`,t);return this.advance(),r}consumeChar(e){let t=this.curr();if(t===`\\`){this.advance();let t=this.curr(),n=YT[t];if(n!==void 0)return this.advance(),n;if(t===`u`){this.advance();let e=/^[0-9a-fA-F]{4}$/.exec(this.str.substring(this.pos.index,this.pos.index+4))?.[0];return e?(this.advance(),this.advance(),this.advance(),this.advance(),String.fromCodePoint(Number.parseInt(e,16))):`u`}return this.consumeChar(e)}return t===e||!t?``:(this.advance(),t)}consumeQuotedSymbol(e){this.mark();let t=this.pos.index;this.advance(),this.consumeString(e);let n=this.str.substring(t,this.pos.index);return this.buildToken(`Symbol`,n)}consumeDateTime(){this.advance();let e=this.pos.index;this.consumeWhile(()=>/[\d-]/.exec(this.curr()));let t=!1,n=!1;if(this.curr()===`T`&&(t=!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`?(n=!0,this.advance()):(this.curr()===`+`||this.curr()===`-`)&&(n=!0,this.advance(),this.consumeWhile(()=>/[\d:]/.exec(this.curr())))),this.pos.index===e)throw Error(`Invalid DateTime literal`);let r=this.str.substring(e,this.pos.index);return r.endsWith(`T`)?r=r.substring(0,r.length-1):!r.startsWith(`T`)&&t&&!n&&(r+=`Z`),this.buildToken(`DateTime`,r)}consumeNumber(){let e=this.pos.index,t=`Number`;this.consumeWhile(()=>/\d/.exec(this.curr())),this.curr()===`.`&&/\d/.exec(this.peek())&&(this.advance(),this.consumeWhile(()=>/\d/.exec(this.curr())));let n=this.curr();if(n===`-`&&this.dateTimeLiterals)return JT.test(this.str.substring(e))?(this.pos.index=e-1,this.consumeDateTime()):this.consumeUnquotedString(e);if(n===` `)ZT(this.peekToken())&&(t=`Quantity`,this.consumeToken());else if(n&&/[a-zA-Z_$]/.exec(n))return this.consumeUnquotedString(e);return this.buildToken(t,this.str.substring(e,this.pos.index))}consumeUnquotedString(e){return this.pos.index=e,this.buildToken(`String`,this.consumeWhile(()=>this.symbolRegex.exec(this.curr())))}consumeSymbol(){let e=this.consumeWhile(()=>this.symbolRegex.exec(this.curr()));return this.prevToken()?.value!==`.`&&this.keywords.includes(e)?this.buildToken(e,e):this.buildToken(`Symbol`,e)}consumeOperator(){let e=this.curr(),t=e+this.peek();return this.operators.includes(t)?(this.advance(),this.advance(),this.buildToken(t,t)):(this.advance(),this.buildToken(e,e))}consumeWhile(e){let t=this.pos.index;for(;this.pos.index<this.str.length&&e();)this.advance();return this.str.substring(t,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(){let e=this.markStack.pop();if(!e)throw Error(`No mark to reset to`);this.pos.index=e.index,this.pos.line=e.line,this.pos.column=e.column}advance(){this.pos.index++,this.curr()===`
|
|
56
|
-
`?(this.pos.line++,this.pos.column=0):this.pos.column++}buildToken(e,t){let n=this.markStack.pop();if(!n)throw Error(`No mark for token`);return{id:e,value:t,...n}}};function ZT(e){return!!(e&&(e.id===`String`||e.id===`Symbol`&&qT.includes(e.value)))}var QT=[`true`,`false`],$T=[`!=`,`!~`,`<=`,`>=`,`{}`,`->`];function eE(e){return new XT(e,QT,$T).tokenize()}var tE={FunctionCall:0,Dot:1,Indexer:2,UnaryAdd:3,UnarySubtract:3,Multiply:4,Divide:4,IntegerDivide:4,Modulo:4,Add:5,Subtract:5,Ampersand:5,Is:6,As:6,Union:7,GreaterThan:8,GreaterThanOrEquals:8,LessThan:8,LessThanOrEquals:8,Equals:9,Equivalent:9,NotEquals:9,NotEquivalent:9,In:10,Contains:10,And:11,Xor:12,Or:12,Implies:13,Arrow:100,Semicolon:200},nE={parse(e){let t=e.consumeAndParse();if(!e.match(`)`))throw Error("Parse error: expected `)` got `"+e.peek()?.value+"`");return t}},rE={parse(e,t){let n=e.consumeAndParse();if(!e.match(`]`))throw Error("Parse error: expected `]`");return new KT(t,n)},precedence:tE.Indexer},iE={parse(e,t){if(!(t instanceof TT))throw Error(`Unexpected parentheses`);let n=[];for(;!e.match(`)`);)n.push(e.consumeAndParse()),e.match(`,`);return new GT(t.name,n)},precedence:tE.FunctionCall};function aE(e){let t=e.split(` `),n=Number.parseFloat(t[0]),r=t[1];return r=r?.startsWith(`'`)&&r.endsWith(`'`)?r.substring(1,r.length-1):`{`+r+`}`,{value:n,unit:r}}function oE(){return new Lx().registerPrefix(`String`,{parse:(e,t)=>new wT({type:Y.string,value:t.value})}).registerPrefix(`DateTime`,{parse:(e,t)=>new wT({type:Y.dateTime,value:hT(t.value)})}).registerPrefix(`Quantity`,{parse:(e,t)=>new wT({type:Y.Quantity,value:aE(t.value)})}).registerPrefix(`Number`,{parse:(e,t)=>new wT({type:t.value.includes(`.`)?Y.decimal:Y.integer,value:Number.parseFloat(t.value)})}).registerPrefix(`true`,{parse:()=>new wT({type:Y.boolean,value:!0})}).registerPrefix(`false`,{parse:()=>new wT({type:Y.boolean,value:!1})}).registerPrefix(`Symbol`,{parse:(e,t)=>new TT(t.value)}).registerPrefix(`{}`,{parse:()=>new ET}).registerPrefix(`(`,nE).registerInfix(`[`,rE).registerInfix(`(`,iE).prefix(`+`,tE.UnaryAdd,(e,t)=>new DT(`+`,t,e=>e)).prefix(`-`,tE.UnarySubtract,(e,t)=>new kT(`-`,t,t,(e,t)=>-t)).infixLeft(`.`,tE.Dot,(e,t,n)=>new PT(e,n)).infixLeft(`/`,tE.Divide,(e,t,n)=>new kT(`/`,e,n,(e,t)=>e/t)).infixLeft(`*`,tE.Multiply,(e,t,n)=>new kT(`*`,e,n,(e,t)=>e*t)).infixLeft(`+`,tE.Add,(e,t,n)=>new kT(`+`,e,n,(e,t)=>e+t)).infixLeft(`-`,tE.Subtract,(e,t,n)=>new kT(`-`,e,n,(e,t)=>e-t)).infixLeft(`|`,tE.Union,(e,t,n)=>new FT(e,n)).infixLeft(`=`,tE.Equals,(e,t,n)=>new IT(e,n)).infixLeft(`!=`,tE.NotEquals,(e,t,n)=>new LT(e,n)).infixLeft(`~`,tE.Equivalent,(e,t,n)=>new RT(e,n)).infixLeft(`!~`,tE.NotEquivalent,(e,t,n)=>new zT(e,n)).infixLeft(`<`,tE.LessThan,(e,t,n)=>new kT(`<`,e,n,(e,t)=>e<t)).infixLeft(`<=`,tE.LessThanOrEquals,(e,t,n)=>new kT(`<=`,e,n,(e,t)=>e<=t)).infixLeft(`>`,tE.GreaterThan,(e,t,n)=>new kT(`>`,e,n,(e,t)=>e>t)).infixLeft(`>=`,tE.GreaterThanOrEquals,(e,t,n)=>new kT(`>=`,e,n,(e,t)=>e>=t)).infixLeft(`&`,tE.Ampersand,(e,t,n)=>new jT(e,n)).infixLeft(`and`,tE.And,(e,t,n)=>new VT(e,n)).infixLeft(`as`,tE.As,(e,t,n)=>new OT(e,n)).infixLeft(`contains`,tE.Contains,(e,t,n)=>new MT(e,n)).infixLeft(`div`,tE.Divide,(e,t,n)=>new kT(`div`,e,n,(e,t)=>Math.trunc(e/t))).infixLeft(`in`,tE.In,(e,t,n)=>new NT(e,n)).infixLeft(`is`,tE.Is,(e,t,n)=>new BT(e,n)).infixLeft(`mod`,tE.Modulo,(e,t,n)=>new kT(`mod`,e,n,(e,t)=>e%t)).infixLeft(`or`,tE.Or,(e,t,n)=>new HT(e,n)).infixLeft(`xor`,tE.Xor,(e,t,n)=>new UT(e,n)).infixLeft(`implies`,tE.Implies,(e,t,n)=>new WT(e,n))}var sE=oE();function cE(e){return new CT(e,sE.construct(eE(e)).consumeAndParse())}function lE(e,t,n={},r=void 0){let i=Array.isArray(t)?t:[t];for(let e=0;e<i.length;e++){let t=i[e];typeof t==`object`&&`type`in t&&`value`in t||(i[e]=$S(i[e]))}return uE(e,i,n,r).map(e=>e.value)}function uE(e,t,n={},r=void 0){let i;if(typeof e==`string`){let t=r?.get(e);i=t??cE(e),r&&!t&&r.set(e,i)}else i=e;return i.eval({variables:n},t).map(e=>{let t={type:e.type,value:e.value?.valueOf()};return`path`in e&&(t.path=e.path),t})}function dE(e){let t=[];for(let n of e){let e=vC(n.value);e&&t.push(e)}return t}function fE(e){let t=new Set;for(let n of e){let e=Ow(n);e&&t.add(e)}return Array.from(t)}function pE(e){let t=new Set;for(let n of e){let{value:e}=n;e&&(rw(e)?t.add(e):pT(e)?t.add(e.reference):EC(e)?t.add(OC(e)):typeof e.identifier==`object`&&t.add(`identifier:${e.identifier.system}|${e.identifier.value}`))}return Array.from(t)}function mE(e,t={}){let n=[];for(let r of e)hE(t,n,r);return n}function hE(e,t,n){let{type:r,value:i}=n;switch(r){case Y.Identifier:gE(t,e,i);break;case Y.CodeableConcept:_E(t,e,i);break;case Y.Coding:vE(t,e,i);break;case Y.ContactPoint:yE(t,e,i);break;default:bE(t,e,void 0,i?.toString())}}function gE(e,t,n){n?.type?.text&&bE(e,t,t.textSearchSystem,n.type.text),bE(e,t,n?.system,n?.value)}function _E(e,t,n){n?.text&&bE(e,t,t.textSearchSystem,n.text);for(let r of n?.coding??Dw)vE(e,t,r)}function vE(e,t,n){n&&(n.display&&bE(e,t,t.textSearchSystem,n.display),bE(e,t,n.system,n.code))}function yE(e,t,n){n&&bE(e,t,n.system,n.value?.toLocaleLowerCase())}function bE(e,t,n,r){(n||r)&&!e.some(e=>e.system===n&&e.value===r)&&e.push({system:n,value:r&&t.caseInsensitive?r.toLocaleLowerCase():r})}var X={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`},xE={contains:X.CONTAINS,exact:X.EXACT,above:X.ABOVE,below:X.BELOW,text:X.TEXT,not:X.NOT,in:X.IN,"not-in":X.NOT_IN,"of-type":X.OF_TYPE,missing:X.MISSING,identifier:X.IDENTIFIER,iterate:X.ITERATE},SE={eq:X.EQUALS,ne:X.NOT_EQUALS,lt:X.LESS_THAN,le:X.LESS_THAN_OR_EQUALS,gt:X.GREATER_THAN,ge:X.GREATER_THAN_OR_EQUALS,sa:X.STARTS_AFTER,eb:X.ENDS_BEFORE,ap:X.APPROXIMATELY,sw:X.STARTS_WITH};function CE(e,t){if(!e)throw Error(`Invalid search URL`);let n=``,r;if(typeof e==`string`){if(e.includes(`?`)){let[t,i]=e.split(`?`);n=t,r=new URLSearchParams(i)}else n=e}else typeof e==`object`&&(n=e.pathname,r=e.searchParams);let i;i=n.includes(`/`)?n.split(`/`).filter(Boolean).pop():n;let a=[];if(r)for(let e of r)a.push(e);if(t)for(let[e,n]of Object.entries(t))if(Array.isArray(n))for(let t of n)a.push([e,t]);else a.push([e,n??``]);return wE(i,a)}function wE(e,t){let n={resourceType:e},r=new Set;for(let[e,i]of t)EE(n,r,e,i);return n}function TE(e,t,n){let r=`${n.code}\0${n.operator}\0${n.value}`;t.has(r)||(t.add(r),e.filters=vw(e.filters,n))}function EE(e,t,n,r){let i,a,o=n.indexOf(`:`);if(o>=0?(i=n.substring(0,o),a=n.substring(o+1)):(i=n,a=``),i!==`_`){if(i===`_has`||n.includes(`.`)){TE(e,t,{code:n,operator:X.EQUALS,value:r});return}switch(i){case`_sort`:DE(e,r);break;case`_cursor`:e.cursor=r;break;case`_count`:e.count=Number.parseInt(r,10);break;case`_offset`:e.offset=Number.parseInt(r,10);break;case`_total`:e.total=r;break;case`_summary`:r===`count`?(e.total=`accurate`,e.count=0):(r===`true`||r===`data`||r===`text`)&&(e.summary=r);break;case`_include`:{let t=NE(r);a===`iterate`&&(t.modifier=X.ITERATE),e.include=vw(e.include,t);break}case`_revinclude`:{let t=NE(r);a===`iterate`&&(t.modifier=X.ITERATE),e.revInclude=vw(e.revInclude,t);break}case`_fields`:case`_elements`:e.fields=r.split(`,`);break;case`_type`:e.types=r.split(`,`);break;case`_format`:e.format=r;break;case`_pretty`:e.pretty=r===`true`;break;default:{let n=mT.types[e.resourceType]?.searchParams?.[i];n?TE(e,t,kE(n,X.EQUALS,a,r)):TE(e,t,AE(i,a,r))}}}}function DE(e,t){for(let n of t.split(`,`)){let t,r=!1;n.startsWith(`-`)?(t=n.substring(1),r=!0):t=n,e.sortRules||=[],e.sortRules.push({code:t,descending:r})}}var OE=[X.MISSING,X.PRESENT];function kE(e,t,n,r){if(OE.includes(n||t))return{code:e.code,operator:n||t,value:r};switch(e.type){case`number`:case`date`:case`quantity`:{let{operator:t,value:i}=jE(r,n||X.EQUALS);if(!PE(e,i))throw new vS(uS(`Invalid format for ${e.type} search parameter: ${i}`));return{code:e.code,operator:t,value:i}}case`reference`:case`string`:case`token`:case`uri`:if(!PE(e,r))throw new vS(uS(`Invalid format for ${e.type} search parameter: ${r}`));return{code:e.code,operator:ME(n)??t,value:r};default:throw Error(`Unrecognized search parameter type: `+e.type)}}function AE(e,t,n){let r=X.EQUALS;if(t)r=t;else if(n.length>=2){let e=n.substring(0,2);e in SE&&(n.length===2||n.at(2)?.match(/\d/))&&(r=e,n=n.substring(e.length))}return{code:e,operator:r,value:n}}function jE(e,t){let n=SE[e.substring(0,2)];return n?{operator:n,value:e.substring(2)}:{operator:t,value:e}}function ME(e){return xE[e]}function NE(e){let t=e.split(`:`);if(t.includes(`*`))throw new vS(uS(`'*' is not supported as a value for search inclusion parameters`));if(t.length===1)throw new vS(uS(`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 vS(uS(`Invalid include value '${e}'`))}function PE(e,t){switch(e.type){case`date`:return gC(t);default:return!0}}function FE(e){let t=[];e.fields&&t.push(`_fields=`+e.fields.join(`,`));for(let n of e.filters??Dw)t.push(IE(n));e.sortRules&&e.sortRules.length>0&&t.push(LE(e.sortRules)),e.cursor!==void 0&&t.push(`_cursor=`+encodeURIComponent(e.cursor)),e.offset!==void 0&&e.offset!==0&&t.push(`_offset=`+e.offset),e.count!==void 0&&t.push(`_count=`+e.count),e.total!==void 0&&t.push(`_total=`+e.total),e.types&&e.types.length>0&&t.push(`_type=`+e.types.join(`,`));for(let n of e.include??Dw)t.push(RE(`_include`,n));for(let n of e.revInclude??Dw)t.push(RE(`_revinclude`,n));return t.length===0?``:(yw(t),`?`+t.join(`&`))}function IE(e){let t=e.operator in xE?`:`+e.operator:``,n=e.operator!==X.EQUALS&&e.operator in SE?e.operator:``;return`${e.code}${t}=${n}${encodeURIComponent(e.value)}`}function LE(e){return`_sort=`+e.map(e=>e.descending?`-`+e.code:e.code).join(`,`)}function RE(e,t){return e+(t.modifier?`:`+t.modifier:``)+`=`+t.resourceType+`:`+t.searchParam+(t.targetType?`:`+t.targetType:``)}function zE(e){let t=[],n=``,r=!1;for(let i of e)r?(n+=i,r=!1):i===`\\`?r=!0:i===`,`?(t.push(n),n=``):n+=i;return t.push(n),t}function BE(e,t){if(t.resourceType!==e.resourceType)return!1;for(let n of t.filters??Dw)if(!HE(e,t,n))return!1;return!0}var VE=new Px(1e3);function HE(e,t,n){let r=mT.types[t.resourceType]?.searchParams?.[n.code];if(!r)return!1;let i=uE(r.expression,[$S(e)],void 0,VE);if(n.operator===X.MISSING||n.operator===X.PRESENT)return UE(i,n);switch(r.type){case`reference`:return WE(r,i,n);case`string`:case`uri`:return qE(i,n);case`token`:return GE(i,n);case`date`:return YE(i,n);default:return!1}}function UE(e,t){let n=e.length>0;return(t.operator===X.MISSING&&t.value===`false`||t.operator===X.PRESENT&&t.value===`true`)===n}function WE(e,t,n){let r=ZE(n.operator);if(n.value===``&&t.length===0)return n.operator===X.EQUALS;let i=pE(t);for(let t of zE(n.value)){let a=!1;if(t.includes(`/`)?a=i.includes(t):(e.target?.length===1||n.code===`_compartment`)&&(a=i.some(e=>e?.endsWith(`/`+t))),a)return!r}return r}function GE(e,t){let n=mE(e),r=zE(t.value),i=ZE(t.operator);for(let e of n)for(let t of r)if(KE(e,t))return!i;return i}function KE(e,t){if(t.includes(`|`)){let[n,r]=t.split(`|`).map(e=>e.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 qE(e,t){let n=fE(e),r=zE(t.value),i=ZE(t.operator);for(let e of n)for(let t of r)if(JE(e,t))return!i;return i}function JE(e,t){return e.toLowerCase().includes(t.toLowerCase())}function YE(e,t){let n=dE(e),r=zE(t.value),i=ZE(t.operator);for(let e of n)for(let n of r)if(XE(e,t.operator,n))return!i;return i}function XE(e,t,n){if(!e)return!1;let r=vC(n);if(!r)return!1;let i=e.start??`0000`,a=e.end??`9999`,o=r.start,s=r.end;switch(t){case X.APPROXIMATELY:case X.EQUALS:case X.NOT_EQUALS:return i<s&&a>o;case X.LESS_THAN:return i<o;case X.GREATER_THAN:return a>s;case X.LESS_THAN_OR_EQUALS:return i<=s;case X.GREATER_THAN_OR_EQUALS:return a>=o;case X.STARTS_AFTER:return i>s;case X.ENDS_BEFORE:return a<o;default:return!1}}function ZE(e){return e===X.NOT_EQUALS||e===X.NOT}var QE={resourceType:`*`},$E=[`DomainConfiguration`,`Enterprise`,`JsonWebKey`,`Login`],eD=[`AccessPolicy`,`Cron`,`Package`,`PackageRelease`,`PackageInstallation`,`Project`,`ProjectMembership`,`User`,`UserSecurityRequest`],tD={READ:`read`,VREAD:`vread`,UPDATE:`update`,DELETE:`delete`,HISTORY:`history`,CREATE:`create`,SEARCH:`search`},nD=[tD.READ,tD.VREAD,tD.HISTORY,tD.SEARCH];function rD(e,t){return!$E.includes(t)&&iD(e,tD.UPDATE,t)}function iD(e,t,n){return!!e.resource?.some(e=>sD(e,n,t))}function aD(e,t,n){return n?n.resource?.find(n=>oD(e,t,n)):QE}function oD(e,t,n){let r=e.resourceType;return sD(n,r,t)?r===`Binary`||!(n.compartment&&!e.meta?.compartment?.some(e=>e.reference===n.compartment?.reference)||n.criteria&&!BE(e,CE(n.criteria))):!1}function sD(e,t,n){return e.resourceType!==t&&(e.resourceType!==`*`||eD.includes(t))?!1:e.interaction?e.interaction.includes(n):!e.readonly||nD.includes(n)}function cD(){return typeof window<`u`}function lD(){return typeof Buffer<`u`?Buffer:void 0}var uD={assign(e){cD()&&globalThis.location.assign(e)},reload(){cD()&&globalThis.location.reload()},getSearch(){return cD()?globalThis.location.search:``},getPathname(){return cD()?globalThis.location.pathname:``},getLocation(){return cD()?globalThis.location.toString():``},getOrigin(){return cD()?globalThis.location.protocol+`//`+globalThis.location.host+`/`:``}};function dD(e){if(cD()){let t=window.atob(e),n=Uint8Array.from(t,e=>e.codePointAt(0));return new window.TextDecoder().decode(n)}let t=lD();if(t)return t.from(e,`base64`).toString(`utf-8`);throw Error(`Unable to decode base64`)}function fD(e){if(cD()){let t=new window.TextEncoder().encode(e),n=String.fromCodePoint.apply(null,t);return window.btoa(n)}let t=lD();if(t)return t.from(e,`utf8`).toString(`base64`);throw Error(`Unable to encode base64`)}function pD(e){return e=e.padEnd(e.length+(4-e.length%4)%4,`=`),dD(e.replaceAll(`-`,`+`).replaceAll(`_`,`/`))}function mD(){let e=new Uint32Array(28);return crypto.getRandomValues(e),cw(e.buffer)}async function hD(e){return crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e))}function gD(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replaceAll(/[xy]/g,e=>{let t=Math.trunc(Math.random()*16);return(e===`x`?t:t&3|8).toString(16)})}function _D(e){let t={};e=ew(e);for(let n of e.entry??Dw){let e=n.resource;if(!e)continue;e.meta!==void 0&&(delete e.meta.author,delete e.meta.compartment,delete e.meta.lastUpdated,delete e.meta.project,delete e.meta.versionId,Object.keys(e.meta).length===0&&delete e.meta);let r=e?.id;if(r)t[r]=gD(),n.fullUrl=`urn:uuid:`+t[r],delete n.resource?.id;else if(n.fullUrl?.startsWith(`resource:`)){let e=n.fullUrl.slice(9);t[e]=gD(),n.fullUrl=`urn:uuid:`+t[e]}}let n=e.entry,r=JSON.stringify({resourceType:`Bundle`,type:`transaction`,entry:n?.map(e=>({fullUrl:e.fullUrl,request:{method:`POST`,url:e.resource?.resourceType},resource:e.resource}))},(e,n)=>vD(e,n,t),2);return yD(JSON.parse(r))}function vD(e,t,n){if((e===`reference`||e===`url`)&&typeof t==`string`){let e;if(t.includes(`/`)?e=t.split(`/`)[1]:t.startsWith(`urn:uuid:`)||t.startsWith(`resource:`)?e=t.slice(9):t.startsWith(`#`)&&(e=t.slice(1)),e){let t=n[e];if(t)return`urn:uuid:`+t}}return t}function yD(e){let{sorted:t,cycles:n}=xD(CD(e)),r={},i=[];for(let t of e.entry??Dw)t.fullUrl?r[t.fullUrl]=t:i.push(t);let a=t.map(e=>r[e]);for(let e of n)for(let t of e){let e=r[t],n={...e,request:{...e.request,method:`PUT`}};a.push(n)}return a.push(...i),{...e,entry:a}}var bD={NotVisited:`NotVisited`,Visiting:`Visiting`,Visited:`Visited`};function xD(e){let t=[],n={},r=[];for(let t of Object.keys(e))n[t]=bD.NotVisited;function i(a,o){if(n[a]===bD.Visited)return!0;if(n[a]===bD.Visiting){let e=o.lastIndexOf(a);return e!==-1&&r.push(o.slice(e)),!0}n[a]=bD.Visiting,o.push(a);let s=!1;for(let t of e[a]??Dw)i(t,o)||(s=!0);return n[a]=bD.Visited,o.pop(),t.unshift(a),!s}for(let t in e)n[t]===bD.NotVisited&&i(t,[]);return{sorted:t,cycles:r}}function SD(e,t){for(let n in e)if(e[n]&&typeof e[n]==`object`){let r=e[n];if(pT(r)){let e=r.reference;(e.startsWith(`urn:uuid:`)||e.startsWith(`resource:`))&&t(e)}else SD(r,t)}}function CD(e){let t={};for(let n of e.entry??Dw)n.fullUrl&&(t[n.fullUrl]=[]);for(let n of e.entry??Dw){let e=n.fullUrl;e&&n.resource&&SD(n.resource,n=>{n!==e&&t[n]&&t[n].push(e)})}return t}var wD={CSS:`text/css`,DICOM:`application/dicom`,DICOM_JSON:`application/dicom+json`,EVENT_STREAM:`text/event-stream`,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`,JOSE:`application/jose`,JSON:`application/json`,JSON_PATCH:`application/json-patch+json`,JWT:`application/jwt`,LINKSET_JSON:`application/linkset+json`,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`},TD=class{listeners;constructor(){this.listeners={}}addEventListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}removeEventListener(e,t){let n=this.listeners[e];if(n){for(let e=0;e<n.length;e++)if(n[e]===t){n.splice(e,1);return}}}dispatchEvent(e){let t=this.listeners[e.type];for(let n of t??Dw)try{n.call(this,e)}catch(t){console.error(`Unhandled error in "${e.type}" event listener`,t)}return!e.defaultPrevented}removeAllListeners(){this.listeners={}}listenerCount(e){return this.listeners[e]?.length??0}},ED=class{emitter=new TD;dispatchEvent(e){this.emitter.dispatchEvent(e)}addEventListener(e,t){this.emitter.addEventListener(e,t)}removeEventListener(e,t){this.emitter.removeEventListener(e,t)}removeAllListeners(){this.emitter.removeAllListeners()}listenerCount(e){return this.emitter.listenerCount(e)}},DD={Event:globalThis.Event===void 0?void 0:globalThis.Event,ErrorEvent:void 0,CloseEvent:void 0},OD=!1;function kD(){if(globalThis.Event===void 0)throw Error(`Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet`);DD.Event=globalThis.Event,DD.ErrorEvent=class extends Event{message;error;constructor(e,t){super(`error`,t),this.message=e.message,this.error=e}},DD.CloseEvent=class extends Event{code;reason;wasClean=!0;constructor(e=1e3,t=``,n){super(`close`,n),this.code=e,this.reason=t}}}function AD(e,t){if(!e)throw Error(t)}function jD(){}function MD(e){if(e instanceof DD.CloseEvent){let t=e;return new DD.CloseEvent(t.code,t.reason,void 0)}if(e instanceof DD.ErrorEvent){let t=e;return new DD.ErrorEvent(t.error??Error(t.message),void 0)}return new e.constructor(e.type,e)}function ND(e,t){let n=e;return n.error instanceof Error?new DD.ErrorEvent(n.error,t):new DD.ErrorEvent(Error(n.message||`WebSocket error`),t)}var PD={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},FD=!1,ID=class e extends ED{_ws;_retryCount=-1;_uptimeTimeout;_connectTimeout;_shouldReconnect=!0;_connectLock=!1;_binaryType;_closeCalled=!1;_messageQueue=[];_debugLogger=console.log.bind(console);_url;_protocols;_options;constructor(e,t,n={}){OD||=(kD(),!0),super(),this._url=e,this._protocols=t,this._options=n,this._options.startClosed&&(this._shouldReconnect=!1),this._binaryType=this._options.binaryType?this._options.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 e.CONNECTING}get OPEN(){return e.OPEN}get CLOSING(){return e.CLOSING}get CLOSED(){return e.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce((e,t)=>(typeof t==`string`?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e),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?e.CLOSED:e.CONNECTING}get url(){return this._ws?this._ws.url:``}get shouldReconnect(){return this._shouldReconnect}onclose=null;onerror=null;onmessage=null;onopen=null;close(e=1e3,t){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(e,t)}reconnect(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED||this._disconnect(e,t),this._connect()}send(e){if(this._ws?.readyState===this.OPEN)this._debug(`send`,e),this._ws.send(e);else{let{maxEnqueuedMessages:t=PD.maxEnqueuedMessages}=this._options;this._messageQueue.length<t&&(this._debug(`enqueue`,e),this._messageQueue.push(e))}}_debug(...e){this._options.debug&&this._debugLogger(`RWS>`,...e)}_getNextDelay(){let{reconnectionDelayGrowFactor:e=PD.reconnectionDelayGrowFactor,minReconnectionDelay:t=PD.minReconnectionDelay,maxReconnectionDelay:n=PD.maxReconnectionDelay}=this._options,r=0;return this._retryCount>0&&(r=t*e**(this._retryCount-1),r>n&&(r=n)),this._debug(`next delay`,r),r}_wait(){return new Promise(e=>{setTimeout(e,this._getNextDelay())})}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;let{maxRetries:e=PD.maxRetries,connectionTimeout:t=PD.connectionTimeout}=this._options;if(this._retryCount>=e){this._connectLock=!1,this._debug(`max retries reached`,this._retryCount,`>=`,e);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`&&!FD&&(console.error(`‼️ No WebSocket implementation available. You should define options.WebSocket.`),FD=!0);let e=this._options.WebSocket||WebSocket;this._debug(`connect`,{url:this._url,protocols:this._protocols}),this._ws=this._protocols?new e(this._url,this._protocols):new e(this._url),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),t)}).catch(e=>{this._connectLock=!1,this._handleError(new DD.ErrorEvent(Error(e.message),this))})}_handleTimeout(){this._debug(`timeout event`),this._handleError(new DD.ErrorEvent(Error(`TIMEOUT`),this))}_disconnect(e=1e3,t){if(this._clearTimeouts(),!this._ws)return;let n=this._ws;this._removeListeners(),n.addEventListener(`error`,jD);try{n.close(e,t),this._handleClose(new DD.CloseEvent(e,t,this))}catch{}}_acceptOpen(){this._debug(`accept open`),this._retryCount=0}_handleOpen=e=>{this._debug(`open event`);let{minUptime:t=PD.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),t),AD(this._ws,`WebSocket is not defined`),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(e=>this._ws?.send(e)),this._messageQueue=[],this.onopen&&this.onopen(e),this.dispatchEvent(MD(e))};_handleMessage=e=>{this._debug(`message event`),this.onmessage&&this.onmessage(e),this.dispatchEvent(MD(e))};_handleError=e=>{let t=ND(e,this);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(MD(t)),this._connect()};_handleClose=e=>{this._debug(`close event`),this._clearTimeouts(),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(e),this.dispatchEvent(MD(e))};_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)}},LD={"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`},RD=[`Patient`,`Encounter`,`ImagingStudy`,`DiagnosticReport`,`OperationOutcome`,`Bundle`],zD=[`DiagnosticReport-update`];function BD(e){return zD.includes(e)}function VD(e){if(zD.includes(e))throw new vS(dS(`'context.version' is required for '${e}'.`))}var HD={"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 UD(e){return RD.includes(e)}function WD(e){return!!e.endpoint}function GD(e){if(!KD(e))throw new vS(dS(`subscriptionRequest must be an object conforming to SubscriptionRequest type.`));let{channelType:t,mode:n,topic:r,events:i}=e,a={"hub.channel.type":t,"hub.mode":n,"hub.topic":r};return n===`subscribe`&&(a[`hub.events`]=i.join(`,`)),WD(e)&&(a[`hub.channel.endpoint`]=e.endpoint),new URLSearchParams(a).toString()}function KD(e){if(typeof e!=`object`)return!1;let{channelType:t,mode:n,topic:r,events:i}=e;if(!(t&&n&&r&&i)||typeof r!=`string`||typeof i!=`object`||!Array.isArray(i)||i.length<1||t!==`websocket`||n!==`subscribe`&&n!==`unsubscribe`)return!1;for(let e of i)if(!LD[e])return!1;return!(WD(e)&&!(typeof e.endpoint==`string`&&e.endpoint.startsWith(`ws`)))}function qD(e,t,n,r){if(typeof t!=`object`)throw new vS(dS(`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 vS(dS(`context[${n}] is invalid. Resource must contain a valid string ID.`));if(!t.resourceType)throw new vS(dS(`context[${n}] is invalid. Resource must contain a resource type. No resource type found.`));let i=r.resourceType;if(i!==`*`){if(!UD(t.resourceType))throw new vS(dS(`context[${n}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));if(i&&t.resourceType!==i)throw new vS(dS(`context[${n}] is invalid. context[${n}] for the '${e}' event should contain resource of type ${i}.`))}}function JD(e,t,n,r,i){if(i.set(t.key,(i.get(t.key)??0)+1),r.reference){if(!pT(t.reference))throw new vS(dS(`context[${n}] is invalid. Expected key '${t.key}' to be a reference.`))}else qD(e,t.resource,n,r)}function YD(e,t){let n=new Map,r=HD[e];for(let i=0;i<t.length;i++){let a=t[i].key;if(!r[a])throw new vS(dS(`Key '${a}' not found for event '${e}'. Make sure to add only valid keys.`));JD(e,t[i],i,r[a],n)}for(let[t,i]of Object.entries(r)){if(!(i.optional||n.has(t)))throw new vS(dS(`Missing required key '${t}' on context for '${e}' event.`));if(!i.manyAllowed&&(n.get(t)??0)>1)throw new vS(dS(`${n.get(t)} context entries with key '${t}' found for the '${e}' event when schema only allows for 1.`))}}function XD(e,t,n,r){if(!(e&&typeof e==`string`))throw new vS(dS(`Must provide a topic.`));if(!LD[t])throw new vS(dS(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(LD).join(`, `)}`));if(typeof n!=`object`)throw new vS(dS(`context must be a context object or array of context objects.`));if(zD.includes(t)&&!r)throw new vS(dS(`The '${t}' event must contain a 'context.versionId'.`));let i=Array.isArray(n)?n:[n];return YD(t,i),{timestamp:new Date().toISOString(),id:gD(),event:{"hub.topic":e,"hub.event":t,context:i,...r?{"context.versionId":r}:{}}}}var ZD=class extends ED{subRequest;websocket;constructor(e,t){if(super(),this.subRequest=e,!e.endpoint)throw new vS(dS(`Subscription request should contain an endpoint.`));if(!KD(e))throw new vS(dS(`Subscription request failed validation.`));let{ReconnectingWebSocket:n=ID,...r}=t??{},i=new n(e.endpoint,void 0,r);i.addEventListener(`open`,()=>{this.dispatchEvent({type:`connect`})}),i.addEventListener(`message`,e=>{let t=JSON.parse(e.data);if(!t.event){t[`hub.mode`]===`denied`&&this.disconnect();return}let n=t;n.event[`hub.event`]!==`heartbeat`&&(this.dispatchEvent({type:`message`,payload:n}),i.send(JSON.stringify({id:t?.id,timestamp:new Date().toISOString()})))}),i.addEventListener(`close`,()=>{this.dispatchEvent({type:`disconnect`})}),this.websocket=i}disconnect(){this.websocket.close()}};function QD(e){return JSON.parse(pD(e))}function $D(e){return e.split(`.`).length===3}function eO(e){let[t,n,r]=e.split(`.`);return QD(n)}function tO(e){try{return typeof eO(e).login_id==`string`}catch{return!1}}function nO(e){try{let t=eO(e).exp;return typeof t==`number`?t*1e3:void 0}catch{return}}var rO=class{medplum;constructor(e){this.medplum=e}async get(e){return this.medplum.get(`keyvalue/v1/${e}`)}async set(e,t){await this.medplum.put(`keyvalue/v1/${e}`,t,wD.TEXT)}async delete(e){await this.medplum.delete(`keyvalue/v1/${e}`)}},iO=class{[Symbol.toStringTag]=`ReadablePromise`;suspender;status=`pending`;response;error;constructor(e){this.suspender=e.then(e=>(this.status=`success`,this.response=e,e),e=>{throw this.status=`error`,this.error=e,e})}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(e,t){return this.suspender.then(e,t)}catch(e){return this.suspender.catch(e)}finally(e){return this.suspender.finally(e)}},aO=class{storage;prefix=``;constructor(e,t=``){this.storage=e??globalThis.localStorage??new oO,this.prefix=t}makeKey(e){return this.prefix+e}clear(){if(this.storage===globalThis.localStorage&&this.prefix)for(let e=this.storage.length-1;e>=0;e--){let t=this.storage.key(e);t?.startsWith(this.prefix)&&this.storage.removeItem(t)}else this.storage.clear()}getString(e){return this.storage.getItem(this.makeKey(e))??void 0}setString(e,t){t?this.storage.setItem(this.makeKey(e),t):this.storage.removeItem(this.makeKey(e))}getObject(e){let t=this.getString(e);return t?JSON.parse(t):void 0}setObject(e,t){this.setString(e,t?VC(t):void 0)}},oO=class{data;constructor(){this.data=new Map}get length(){return this.data.size}clear(){this.data.clear()}getItem(e){return this.data.get(e)??null}setItem(e,t){t?this.data.set(e,t):this.data.delete(e)}removeItem(e){this.data.delete(e)}key(e){return Array.from(this.data.keys())[e]}},sO=6e4,cO=[WebSocket.CLOSING,WebSocket.CLOSED],lO=class extends ED{criteria;constructor(...e){super(),this.criteria=new Set(e)}getCriteria(){return this.criteria}_addCriteria(e){this.criteria.add(e)}_removeCriteria(e){this.criteria.delete(e)}},uO=class{criteria;emitter;refCount;subscriptionProps;subscriptionId;token;tokenExpiry;state=`idle`;generation=0;lastUnrefTime;constructor(e,t){this.criteria=e,this.emitter=new lO(e),this.refCount=1,this.subscriptionProps=t?{...t}:void 0}nextGeneration(){return++this.generation}},dO=class{medplum;ws;masterSubEmitter;criteriaEntries;criteriaEntriesBySubscriptionId;wsClosed;pingTimer=void 0;tokenRefreshTimer=void 0;pingIntervalMs;waitingForPong=!1;currentProfile;constructor(e,t,n){if(!(e instanceof EO))throw new vS(dS("First arg of constructor should be a `MedplumClient`"));let r;try{r=new URL(t).toString()}catch{throw new vS(dS(`Not a valid URL`))}let i=n?.ReconnectingWebSocket?new n.ReconnectingWebSocket(r,void 0,{debug:n?.debug,debugLogger:n?.debugLogger}):new ID(r,void 0,{debug:n?.debug,debugLogger:n?.debugLogger});this.medplum=e,this.ws=i,this.masterSubEmitter=new lO,this.criteriaEntries=new Map,this.criteriaEntriesBySubscriptionId=new Map,this.wsClosed=!1,this.pingIntervalMs=n?.pingIntervalMs??5e3,this.currentProfile=e.getProfile(),this.setupListeners()}setupListeners(){let e=this.ws;e.addEventListener(`message`,e=>{try{let t=JSON.parse(e.data);if(t.type===`pong`){this.waitingForPong=!1;return}let n=t,r=n?.entry?.[0]?.resource;if(!r){console.warn(`Received WebSocket message without a SubscriptionStatus resource; ignoring`,n);return}if(r.type===`heartbeat`){this.masterSubEmitter?.dispatchEvent({type:`heartbeat`,payload:n});return}if(r.type===`handshake`){let e=kC(r.subscription),t={type:`connect`,payload:{subscriptionId:e}};this.masterSubEmitter?.dispatchEvent(t);let n=this.criteriaEntriesBySubscriptionId.get(e);if(!n){console.warn(`Received handshake for criteria the SubscriptionManager is not listening for yet`);return}(n.state===`connecting`||n.state===`refreshing`)&&(n.state=`active`),n.emitter.dispatchEvent({...t});return}this.masterSubEmitter?.dispatchEvent({type:`message`,payload:n});let i=this.criteriaEntriesBySubscriptionId.get(kC(r.subscription));if(!i){console.warn(`Received notification for criteria the SubscriptionManager is not listening for`);return}i.emitter.dispatchEvent({type:`message`,payload:n})}catch(e){console.error(e);let t={type:`error`,payload:e};this.masterSubEmitter?.dispatchEvent(t);for(let e of this.getAllCriteriaEmitters())e.dispatchEvent({...t})}}),e.addEventListener(`error`,e=>{let t={type:`error`,payload:new vS({resourceType:`OperationOutcome`,issue:[{severity:`error`,code:`exception`,details:{text:`WebSocket connection closed due to an error`},diagnostics:e.error?J(e.error):e.message}]})};this.masterSubEmitter?.dispatchEvent(t);for(let e of this.getAllCriteriaEmitters())e.dispatchEvent({...t})}),e.addEventListener(`close`,()=>{let e={type:`close`};this.masterSubEmitter?.dispatchEvent(e);for(let t of this.getAllCriteriaEmitters())t.dispatchEvent({...e});this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=void 0,this.waitingForPong=!1),this.tokenRefreshTimer&&=(clearInterval(this.tokenRefreshTimer),void 0),this.wsClosed&&(this.criteriaEntries.clear(),this.criteriaEntriesBySubscriptionId.clear(),this.masterSubEmitter?.removeAllListeners())}),e.addEventListener(`open`,()=>{let t={type:`open`};this.masterSubEmitter?.dispatchEvent(t);for(let e of this.getAllCriteriaEmitters())e.dispatchEvent({...t});this.refreshAllSubscriptions().catch(console.error),this.pingTimer??=setInterval(()=>{this.waitingForPong?(this.waitingForPong=!1,e.reconnect()):(e.send(JSON.stringify({type:`ping`})),this.waitingForPong=!0),this.gcUnrefEntries()},this.pingIntervalMs),this.tokenRefreshTimer??=setInterval(()=>{this.checkTokenExpirations(),this.gcUnrefEntries()},sO)}),this.medplum.addEventListener(`change`,()=>{let e=this.medplum.getProfile();this.currentProfile&&e===void 0?this.ws.close():e&&this.currentProfile?.id!==e.id&&this.ws.reconnect(),this.currentProfile=e})}sendBind(e){this.ws.send(JSON.stringify({type:`bind-with-token`,payload:{token:e}}))}sendUnbind(e){this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:`unbind-from-token`,payload:{token:e}}))}emitError(e,t){let n={type:`error`,payload:t};this.masterSubEmitter?.dispatchEvent(n),e.emitter.dispatchEvent({...n})}maybeEmitDisconnect(e){let{subscriptionId:t}=e;if(t){let n={type:`disconnect`,payload:{subscriptionId:t}};this.masterSubEmitter?.dispatchEvent(n),e.emitter.dispatchEvent({...n})}else console.warn("Called disconnect for `CriteriaEntry` before `subscriptionId` was present.")}isStale(e,t){return this.isEntryGettingRemoved(e)||e.generation!==t}maybeGetCriteriaEntry(e,t){let n=this.criteriaEntries.get(e);if(n){if(!t)return n.bareCriteria;for(let e of n.criteriaWithProps)if(JC(t,e.subscriptionProps))return e}}getAllCriteriaEmitters(){let e=[];for(let t of this.criteriaEntries.values())for(let n of fO(t))n.refCount>0&&e.push(n.emitter);return e}addCriteriaEntry(e){let{criteria:t,subscriptionProps:n}=e,r;this.criteriaEntries.has(t)?r=this.criteriaEntries.get(t):(r={criteriaWithProps:[]},this.criteriaEntries.set(t,r)),n?r.criteriaWithProps.push(e):r.bareCriteria=e}removeCriteriaEntry(e){e.state=`removed`,e.generation++;let{criteria:t,subscriptionProps:n,subscriptionId:r,token:i}=e;if(!this.criteriaEntries.has(t))return;let a=this.criteriaEntries.get(t);n?a.criteriaWithProps=a.criteriaWithProps.filter(e=>{let t=e.subscriptionProps;return!JC(n,t)}):a.bareCriteria=void 0,!a.bareCriteria&&a.criteriaWithProps.length===0&&(this.criteriaEntries.delete(t),this.masterSubEmitter?._removeCriteria(t)),r&&this.criteriaEntriesBySubscriptionId.delete(r),i&&this.sendUnbind(i)}async subscribeToCriteria(e){this.wsClosed&&await this.reconnectIfNeeded(),this.ws.readyState===WebSocket.OPEN&&this.medplum.getProfile()&&e.state===`idle`&&(e.state=`connecting`,await this.rebindCriteriaEntry(e))}async refreshAllSubscriptions(){this.criteriaEntriesBySubscriptionId.clear();let e=[],t=[];for(let n of this.criteriaEntries.values())for(let r of fO(n))r.refCount===0?t.push(r):e.push(r);for(let e of t)this.removeCriteriaEntry(e);for(let t of e)t.token&&this.sendUnbind(t.token),t.token=void 0,t.tokenExpiry=void 0,t.subscriptionId=void 0,t.state=`idle`,t.generation++,await this.subscribeToCriteria(t)}async rebindCriteriaEntry(e){let t=e.nextGeneration();try{if(!e.subscriptionId){let n=await this.medplum.createResource({...e.subscriptionProps,resourceType:`Subscription`,status:`active`,reason:`WebSocket subscription for ${OC(this.medplum.getProfile())}`,channel:{type:`websocket`},criteria:e.criteria});if(e.subscriptionId??=n.id,this.isStale(e,t))return}let{parameter:n}=await this.medplum.get(`fhir/R4/Subscription/${e.subscriptionId}/$get-ws-binding-token`,{cache:`no-cache`}),r=n?.find(e=>e.name===`token`)?.valueString,i=n?.find(e=>e.name===`websocket-url`)?.valueUrl,a=n?.find(e=>e.name===`expiration`)?.valueDateTime;if(!r)throw new vS(dS(`Failed to get token`));if(!i)throw new vS(dS(`Failed to get URL from $get-ws-binding-token`));if(!a)throw new vS(dS(`Failed to get expiration from $get-ws-binding-token`));if(this.isStale(e,t))return;e.token=r,e.tokenExpiry=new Date(a).getTime(),this.criteriaEntriesBySubscriptionId.set(e.subscriptionId,e),this.sendBind(r)}catch(n){console.error(J(n)),e.generation===t&&!this.isEntryGettingRemoved(e)&&(e.state=e.state===`refreshing`?`active`:`idle`),this.emitError(e,n)}}checkTokenExpirations(){if(!this.medplum.getProfile())return;let e=Date.now();for(let t of this.criteriaEntries.values())for(let n of fO(t))n.refCount!==0&&n.tokenExpiry&&n.tokenExpiry-e<=3e5&&n.state===`active`&&this.ws.readyState===WebSocket.OPEN&&(n.state=`refreshing`,this.rebindCriteriaEntry(n).catch(e=>{this.masterSubEmitter?.dispatchEvent({type:`error`,payload:e})}))}addCriteria(e,t){this.masterSubEmitter&&this.masterSubEmitter._addCriteria(e);let n=this.maybeGetCriteriaEntry(e,t);if(n)return n.refCount===0&&(n.lastUnrefTime=void 0,n.generation++,n.state!==`active`&&(n.state=n.token?`active`:`idle`)),n.refCount+=1,n.state===`idle`&&this.subscribeToCriteria(n).catch(console.error),n.emitter;let r=new uO(e,t);return this.addCriteriaEntry(r),this.subscribeToCriteria(r).catch(console.error),r.emitter}removeCriteria(e,t){let n=this.maybeGetCriteriaEntry(e,t);if(!n||this.isEntryGettingRemoved(n)){console.warn("Criteria not known to `SubscriptionManager`. Possibly called remove too many times.");return}--n.refCount,n.refCount===0&&(n.lastUnrefTime=Date.now(),n.generation++)}gcUnrefEntries(){let e=Date.now(),t=[];for(let n of this.criteriaEntries.values())for(let r of fO(n))r.refCount===0&&r.lastUnrefTime!==void 0&&e-r.lastUnrefTime>=1e4&&t.push(r);for(let e of t)this.maybeEmitDisconnect(e),this.removeCriteriaEntry(e);t.length>0&&this.criteriaEntries.size===0&&this.closeWebSocket()}isEntryGettingRemoved(e){return e.refCount===0||e.state===`removed`}getWebSocket(){return this.ws}closeWebSocket(){if(!this.wsClosed){if(this.ws.readyState===WebSocket.OPEN)for(let e of this.criteriaEntries.values())for(let t of fO(e))t.token&&this.sendUnbind(t.token);this.wsClosed=!0,this.ws.close()}}reconnectWebSocket(){this.ws.reconnect(),this.wsClosed=!1}getCriteriaCount(){return this.getAllCriteriaEmitters().length}getMasterEmitter(){return this.masterSubEmitter||=new lO(...Array.from(this.criteriaEntries.keys())),this.masterSubEmitter}async reconnectIfNeeded(){cO.includes(this.getWebSocket().readyState)&&await new Promise(e=>{let t=()=>{this.getWebSocket().removeEventListener(`open`,t),e()};this.getWebSocket().addEventListener(`open`,t),this.reconnectWebSocket()})}};function fO(e){return e.bareCriteria?[e.bareCriteria,...e.criteriaWithProps]:e.criteriaWithProps}new Px(1e3);var pO=`5.2.3-39c4978`,mO=wD.FHIR_JSON+`, */*; q=0.1`,hO=`https://api.medplum.com/`,gO=1e3,_O=6e4,vO=0,yO=3e5,bO=`Binary/`,xO={resourceType:`Device`,id:`system`,deviceName:[{type:`model-name`,name:`System`}]},SO=2,CO={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`,PreAuthorizedCode:`urn:ietf:params:oauth:grant-type:pre-authorized_code`},wO={AccessToken:`urn:ietf:params:oauth:token-type:access_token`,RefreshToken:`urn:ietf:params:oauth:token-type:refresh_token`,IdToken:`urn:ietf:params:oauth:token-type:id_token`,Saml1Token:`urn:ietf:params:oauth:token-type:saml1`,Saml2Token:`urn:ietf:params:oauth:token-type:saml2`},TO={JwtBearer:`urn:ietf:params:oauth:client-assertion-type:jwt-bearer`},EO=class extends ED{options;fetch;createPdfImpl;storage;requestCache;cacheTime;baseUrl;fhirBaseUrl;authorizeUrl;tokenUrl;logoutUrl;fhircastHubUrl;cdsServicesUrl;defaultHeaders;onUnauthenticated;autoBatchTime;autoBatchQueue;maxRetries;maxRetryTime;refreshGracePeriod;subscriptionManager;medplumServer;clientId;clientSecret;credentialsInHeader;autoBatchTimerId;accessToken;accessTokenExpires;refreshToken;refreshPromise;profilePromise;sessionDetails;currentRateLimits;basicAuth;initPromise;initComplete=!0;keyValueClient;logLevel;constructor(e){if(super(),e?.baseUrl&&!e.baseUrl.startsWith(`http`))throw Error(`Base URL must start with http or https`);this.options=e??{},this.fetch=e?.fetch??DO(),this.storage=e?.storage??new aO(void 0,e?.storagePrefix),this.createPdfImpl=e?.createPdf,this.baseUrl=bw(e?.baseUrl??hO),this.fhirBaseUrl=Sw(this.baseUrl,e?.fhirUrlPath??`fhir/R4`),this.authorizeUrl=Sw(this.baseUrl,e?.authorizeUrl??`oauth2/authorize`),this.tokenUrl=Sw(this.baseUrl,e?.tokenUrl??`oauth2/token`),this.logoutUrl=Sw(this.baseUrl,e?.logoutUrl??`oauth2/logout`),this.fhircastHubUrl=Sw(this.baseUrl,e?.fhircastHubUrl??`fhircast/STU3`),this.cdsServicesUrl=Sw(this.baseUrl,e?.cdsServicesUrl??`cds-services`),this.clientId=e?.clientId??``,this.clientSecret=e?.clientSecret??``,this.credentialsInHeader=e?.authCredentialsMethod===`header`,this.defaultHeaders=e?.defaultHeaders??{},this.onUnauthenticated=e?.onUnauthenticated,this.refreshGracePeriod=e?.refreshGracePeriod??yO,this.logLevel=this.initializeLogLevel(e),this.maxRetries=e?.maxRetries??2,this.maxRetryTime=e?.maxRetryTime??2e3,this.cacheTime=e?.cacheTime??(cD()?_O:vO),this.requestCache=this.cacheTime>0?new Px(e?.resourceCacheSize??gO):void 0,e?.autoBatchTime?(this.autoBatchTime=e.autoBatchTime,this.autoBatchQueue=[]):(this.autoBatchTime=0,this.autoBatchQueue=void 0),e?.accessToken&&this.setAccessToken(e.accessToken),this.storage.getInitPromise===void 0?(e?.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(()=>{e?.accessToken||this.attemptResumeActiveLogin().catch(console.error),this.initComplete=!0,this.dispatchEvent({type:`storageInitialized`})}).catch(e=>{console.error(e),this.initComplete=!0,this.dispatchEvent({type:`storageInitFailed`,payload:{error:e}})})),this.setupStorageListener()}get isInitialized(){return this.initComplete}getInitPromise(){return this.initPromise}initializeLogLevel(e){return e?.logLevel?e.logLevel:e?.verbose===void 0?`none`:e.verbose?`verbose`:`none`}async attemptResumeActiveLogin(){let e=this.getActiveLogin();e&&(this.setAccessToken(e.accessToken,e.refreshToken),await this.refreshProfile())}getBaseUrl(){return this.baseUrl}getAuthorizeUrl(){return this.authorizeUrl}getTokenUrl(){return this.tokenUrl}getLogoutUrl(){return this.logoutUrl}getFhircastHubUrl(){return this.fhircastHubUrl}getCdsServicesUrl(){return this.cdsServicesUrl}getDefaultHeaders(){return this.defaultHeaders}clear(){this.storage.clear(),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(e){e=e.toString(),this.requestCache?.delete(e)}invalidateAll(){this.requestCache?.clear()}invalidateSearches(e){let t=Sw(this.fhirBaseUrl,e);for(let e of this.requestCache?.keys()??Dw)(e.endsWith(t)||e.includes(t+`?`))&&this.requestCache?.delete(e)}notifyResourceModified(e){e.operation!==`delete`&&e.resource?this.cacheResource(e.resource,void 0):e.id&&this.deleteCacheEntry(this.fhirUrl(e.resourceType,e.id).toString()),this.invalidateSearches(e.resourceType),this.dispatchResourceModified(e)}get(e,t={}){e=e.toString();let n=this.getCacheEntry(e,t);if(n)return n.value;let r;e.startsWith(this.fhirBaseUrl)&&this.autoBatchQueue&&!t.disableAutoBatch?r=new Promise((n,r)=>{this.autoBatchQueue.push({method:`GET`,url:e.replace(this.fhirBaseUrl,``),options:t,resolve:n,reject:r}),this.autoBatchTimerId||=setTimeout(()=>this.executeAutoBatch(),this.autoBatchTime)}):(t.method=`GET`,r=this.request(e,t));let i=new iO(r);return this.setCacheEntry(e,i,t),i}post(e,t,n,r={}){return e=e.toString(),this.setRequestBody(r,t),n&&this.setRequestContentType(r,n),this.invalidateUrl(e),r.method=`POST`,this.request(e,r)}put(e,t,n,r={}){return e=e.toString(),this.setRequestBody(r,t),n&&this.setRequestContentType(r,n),this.invalidateUrl(e),r.method=`PUT`,this.request(e,r)}patch(e,t,n={}){return e=e.toString(),this.setRequestBody(n,t),this.setRequestContentType(n,wD.JSON_PATCH),this.invalidateUrl(e),n.method=`PATCH`,this.request(e,n)}delete(e,t={}){return e=e.toString(),this.invalidateUrl(e),t.method=`DELETE`,this.request(e,t)}async startNewUser(e,t){let{codeChallengeMethod:n,codeChallenge:r}=await this.startPkce();return this.post(`auth/newuser`,{...e,clientId:e.clientId??this.clientId,codeChallengeMethod:n,codeChallenge:r},void 0,t)}async startNewProject(e,t){return this.post(`auth/newproject`,e,void 0,t)}async startNewPatient(e,t){return this.post(`auth/newpatient`,e,void 0,t)}async startLogin(e,t){return this.post(`auth/login`,{...await this.ensureCodeChallenge(e),clientId:e.clientId??this.clientId,scope:e.scope},void 0,t)}async startGoogleLogin(e,t){return this.post(`auth/google`,{...await this.ensureCodeChallenge(e),clientId:e.clientId??this.clientId,scope:e.scope},void 0,t)}async ensureCodeChallenge(e){return e.codeChallenge?e:{...e,...await this.startPkce()}}async signOut(){await this.post(this.logoutUrl,{}),this.clear()}async signInWithRedirect(e){let t=new URLSearchParams(uD.getSearch()).get(`code`);if(!t){await this.requestAuthorization(e);return}return this.processCode(t)}signOutWithRedirect(){uD.assign(this.logoutUrl)}async signInWithExternalAuth(e,t,n,r,i=!0){let a=r;i&&(a=await this.ensureCodeChallenge(r)),uD.assign(this.getExternalAuthRedirectUri(e,t,n,a,i))}async exchangeExternalAccessToken(e,t,n){if(t??=this.clientId,!t)throw Error(`MedplumClient is missing clientId`);let r={grant_type:CO.TokenExchange,subject_token_type:wO.AccessToken,client_id:t,subject_token:e};return n&&(r.membership_id=n),this.fetchTokens(r)}getExternalAuthRedirectUri(e,t,n,r,i=!0){let a=new URL(e);if(a.searchParams.set(`response_type`,`code`),a.searchParams.set(`client_id`,t),a.searchParams.set(`redirect_uri`,n),a.searchParams.set(`scope`,r.scope??`openid profile email`),a.searchParams.set(`state`,JSON.stringify(r)),i){let{codeChallenge:e,codeChallengeMethod:t}=r;if(!t)throw Error("`LoginRequest` for external auth must include a `codeChallengeMethod`.");if(!e)throw Error("`LoginRequest` for external auth must include a `codeChallenge`.");a.searchParams.set(`code_challenge_method`,t),a.searchParams.set(`code_challenge`,e)}return a.toString()}fhirUrl(...e){return new URL(Sw(this.fhirBaseUrl,e.join(`/`)))}fhirSearchUrl(e,t){let n=this.fhirUrl(e);return t&&(n.search=ww(t)),n}search(e,t,n){let r=this.fhirSearchUrl(e,t),i=`search-`+r.toString(),a=this.getCacheEntry(i,n);if(a)return a.value;let o=this.getBundle(r,n);return this.setCacheEntry(i,o,n),o}searchOne(e,t,n){let r=this.fhirSearchUrl(e,t);r.searchParams.set(`_count`,`1`),r.searchParams.sort();let i=`searchOne-`+r.toString(),a=this.getCacheEntry(i,n);if(a)return a.value;let o=new iO(this.search(e,r.searchParams,n).then(e=>e.entry?.[0]?.resource));return this.setCacheEntry(i,o,n),o}searchResources(e,t,n){let r=`searchResources-`+this.fhirSearchUrl(e,t).toString(),i=this.getCacheEntry(r,n);if(i)return i.value;let a=new iO(this.search(e,t,n).then(kO));return this.setCacheEntry(r,a,n),a}async*searchResourcePages(e,t,n){let r=this.fhirSearchUrl(e,t);for(;r;){let t=new URL(r).searchParams;t.has(`_count`)||t.set(`_count`,`1000`);let i=await this.search(e,t,n),a=i.link?.find(e=>e.relation===`next`);if(!i.entry?.length&&!a)break;yield kO(i),r=a?.url?new URL(a.url):void 0}}valueSetExpand(e,t){let n=this.fhirUrl(`ValueSet`,`$expand`);return n.search=new URLSearchParams(e).toString(),this.get(n.toString(),t)}getCached(e,t){let n=this.requestCache?.get(this.fhirUrl(e,t).toString())?.value;return n?.isOk()?n.read():void 0}getCachedReference(e){let t=e.reference;if(!t)return;if(t===`system`)return xO;let[n,r]=t.split(`/`);if(n&&r)return this.getCached(n,r)}readResource(e,t,n){if(!t)throw Error(`The "id" parameter cannot be null, undefined, or an empty string.`);return this.get(this.fhirUrl(e,t),n)}readReference(e,t){let n=e.reference;if(!n)return new iO(Promise.reject(Error(`Missing reference`)));if(n===`system`)return new iO(Promise.resolve(xO));let[r,i]=n.split(`/`);return!r||!i?new iO(Promise.reject(Error(`Invalid reference`))):this.readResource(r,i,t)}readCanonical(e,t,n){return Array.isArray(e)?this.searchOne(``,{_type:e.join(`,`),url:t},n):this.searchOne(e,`url=`+t,n)}requestSchema(e,t){if(PS(e))return Promise.resolve();let n=e+`-requestSchema`,r=this.getCacheEntry(n,void 0);if(r)return r.value;let i=new iO((async()=>{let t=`{
|
|
56
|
+
`?(this.pos.line++,this.pos.column=0):this.pos.column++}buildToken(e,t){let n=this.markStack.pop();if(!n)throw Error(`No mark for token`);return{id:e,value:t,...n}}};function ZT(e){return!!(e&&(e.id===`String`||e.id===`Symbol`&&qT.includes(e.value)))}var QT=[`true`,`false`],$T=[`!=`,`!~`,`<=`,`>=`,`{}`,`->`];function eE(e){return new XT(e,QT,$T).tokenize()}var tE={FunctionCall:0,Dot:1,Indexer:2,UnaryAdd:3,UnarySubtract:3,Multiply:4,Divide:4,IntegerDivide:4,Modulo:4,Add:5,Subtract:5,Ampersand:5,Is:6,As:6,Union:7,GreaterThan:8,GreaterThanOrEquals:8,LessThan:8,LessThanOrEquals:8,Equals:9,Equivalent:9,NotEquals:9,NotEquivalent:9,In:10,Contains:10,And:11,Xor:12,Or:12,Implies:13,Arrow:100,Semicolon:200},nE={parse(e){let t=e.consumeAndParse();if(!e.match(`)`))throw Error("Parse error: expected `)` got `"+e.peek()?.value+"`");return t}},rE={parse(e,t){let n=e.consumeAndParse();if(!e.match(`]`))throw Error("Parse error: expected `]`");return new KT(t,n)},precedence:tE.Indexer},iE={parse(e,t){if(!(t instanceof TT))throw Error(`Unexpected parentheses`);let n=[];for(;!e.match(`)`);)n.push(e.consumeAndParse()),e.match(`,`);return new GT(t.name,n)},precedence:tE.FunctionCall};function aE(e){let t=e.split(` `),n=Number.parseFloat(t[0]),r=t[1];return r=r?.startsWith(`'`)&&r.endsWith(`'`)?r.substring(1,r.length-1):`{`+r+`}`,{value:n,unit:r}}function oE(){return new Lx().registerPrefix(`String`,{parse:(e,t)=>new wT({type:Y.string,value:t.value})}).registerPrefix(`DateTime`,{parse:(e,t)=>new wT({type:Y.dateTime,value:hT(t.value)})}).registerPrefix(`Quantity`,{parse:(e,t)=>new wT({type:Y.Quantity,value:aE(t.value)})}).registerPrefix(`Number`,{parse:(e,t)=>new wT({type:t.value.includes(`.`)?Y.decimal:Y.integer,value:Number.parseFloat(t.value)})}).registerPrefix(`true`,{parse:()=>new wT({type:Y.boolean,value:!0})}).registerPrefix(`false`,{parse:()=>new wT({type:Y.boolean,value:!1})}).registerPrefix(`Symbol`,{parse:(e,t)=>new TT(t.value)}).registerPrefix(`{}`,{parse:()=>new ET}).registerPrefix(`(`,nE).registerInfix(`[`,rE).registerInfix(`(`,iE).prefix(`+`,tE.UnaryAdd,(e,t)=>new DT(`+`,t,e=>e)).prefix(`-`,tE.UnarySubtract,(e,t)=>new kT(`-`,t,t,(e,t)=>-t)).infixLeft(`.`,tE.Dot,(e,t,n)=>new PT(e,n)).infixLeft(`/`,tE.Divide,(e,t,n)=>new kT(`/`,e,n,(e,t)=>e/t)).infixLeft(`*`,tE.Multiply,(e,t,n)=>new kT(`*`,e,n,(e,t)=>e*t)).infixLeft(`+`,tE.Add,(e,t,n)=>new kT(`+`,e,n,(e,t)=>e+t)).infixLeft(`-`,tE.Subtract,(e,t,n)=>new kT(`-`,e,n,(e,t)=>e-t)).infixLeft(`|`,tE.Union,(e,t,n)=>new FT(e,n)).infixLeft(`=`,tE.Equals,(e,t,n)=>new IT(e,n)).infixLeft(`!=`,tE.NotEquals,(e,t,n)=>new LT(e,n)).infixLeft(`~`,tE.Equivalent,(e,t,n)=>new RT(e,n)).infixLeft(`!~`,tE.NotEquivalent,(e,t,n)=>new zT(e,n)).infixLeft(`<`,tE.LessThan,(e,t,n)=>new kT(`<`,e,n,(e,t)=>e<t)).infixLeft(`<=`,tE.LessThanOrEquals,(e,t,n)=>new kT(`<=`,e,n,(e,t)=>e<=t)).infixLeft(`>`,tE.GreaterThan,(e,t,n)=>new kT(`>`,e,n,(e,t)=>e>t)).infixLeft(`>=`,tE.GreaterThanOrEquals,(e,t,n)=>new kT(`>=`,e,n,(e,t)=>e>=t)).infixLeft(`&`,tE.Ampersand,(e,t,n)=>new jT(e,n)).infixLeft(`and`,tE.And,(e,t,n)=>new VT(e,n)).infixLeft(`as`,tE.As,(e,t,n)=>new OT(e,n)).infixLeft(`contains`,tE.Contains,(e,t,n)=>new MT(e,n)).infixLeft(`div`,tE.Divide,(e,t,n)=>new kT(`div`,e,n,(e,t)=>Math.trunc(e/t))).infixLeft(`in`,tE.In,(e,t,n)=>new NT(e,n)).infixLeft(`is`,tE.Is,(e,t,n)=>new BT(e,n)).infixLeft(`mod`,tE.Modulo,(e,t,n)=>new kT(`mod`,e,n,(e,t)=>e%t)).infixLeft(`or`,tE.Or,(e,t,n)=>new HT(e,n)).infixLeft(`xor`,tE.Xor,(e,t,n)=>new UT(e,n)).infixLeft(`implies`,tE.Implies,(e,t,n)=>new WT(e,n))}var sE=oE();function cE(e){return new CT(e,sE.construct(eE(e)).consumeAndParse())}function lE(e,t,n={},r=void 0){let i=Array.isArray(t)?t:[t];for(let e=0;e<i.length;e++){let t=i[e];typeof t==`object`&&`type`in t&&`value`in t||(i[e]=$S(i[e]))}return uE(e,i,n,r).map(e=>e.value)}function uE(e,t,n={},r=void 0){let i;if(typeof e==`string`){let t=r?.get(e);i=t??cE(e),r&&!t&&r.set(e,i)}else i=e;return i.eval({variables:n},t).map(e=>{let t={type:e.type,value:e.value?.valueOf()};return`path`in e&&(t.path=e.path),t})}function dE(e){let t=[];for(let n of e){let e=vC(n.value);e&&t.push(e)}return t}function fE(e){let t=new Set;for(let n of e){let e=Ow(n);e&&t.add(e)}return Array.from(t)}function pE(e){let t=new Set;for(let n of e){let{value:e}=n;e&&(rw(e)?t.add(e):pT(e)?t.add(e.reference):EC(e)?t.add(OC(e)):typeof e.identifier==`object`&&t.add(`identifier:${e.identifier.system}|${e.identifier.value}`))}return Array.from(t)}function mE(e,t={}){let n=[];for(let r of e)hE(t,n,r);return n}function hE(e,t,n){let{type:r,value:i}=n;switch(r){case Y.Identifier:gE(t,e,i);break;case Y.CodeableConcept:_E(t,e,i);break;case Y.Coding:vE(t,e,i);break;case Y.ContactPoint:yE(t,e,i);break;default:bE(t,e,void 0,i?.toString())}}function gE(e,t,n){n?.type?.text&&bE(e,t,t.textSearchSystem,n.type.text),bE(e,t,n?.system,n?.value)}function _E(e,t,n){n?.text&&bE(e,t,t.textSearchSystem,n.text);for(let r of n?.coding??Dw)vE(e,t,r)}function vE(e,t,n){n&&(n.display&&bE(e,t,t.textSearchSystem,n.display),bE(e,t,n.system,n.code))}function yE(e,t,n){n&&bE(e,t,n.system,n.value?.toLocaleLowerCase())}function bE(e,t,n,r){(n||r)&&!e.some(e=>e.system===n&&e.value===r)&&e.push({system:n,value:r&&t.caseInsensitive?r.toLocaleLowerCase():r})}var X={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`},xE={contains:X.CONTAINS,exact:X.EXACT,above:X.ABOVE,below:X.BELOW,text:X.TEXT,not:X.NOT,in:X.IN,"not-in":X.NOT_IN,"of-type":X.OF_TYPE,missing:X.MISSING,identifier:X.IDENTIFIER,iterate:X.ITERATE},SE={eq:X.EQUALS,ne:X.NOT_EQUALS,lt:X.LESS_THAN,le:X.LESS_THAN_OR_EQUALS,gt:X.GREATER_THAN,ge:X.GREATER_THAN_OR_EQUALS,sa:X.STARTS_AFTER,eb:X.ENDS_BEFORE,ap:X.APPROXIMATELY,sw:X.STARTS_WITH};function CE(e,t){if(!e)throw Error(`Invalid search URL`);let n=``,r;if(typeof e==`string`){if(e.includes(`?`)){let[t,i]=e.split(`?`);n=t,r=new URLSearchParams(i)}else n=e}else typeof e==`object`&&(n=e.pathname,r=e.searchParams);let i;i=n.includes(`/`)?n.split(`/`).filter(Boolean).pop():n;let a=[];if(r)for(let e of r)a.push(e);if(t)for(let[e,n]of Object.entries(t))if(Array.isArray(n))for(let t of n)a.push([e,t]);else a.push([e,n??``]);return wE(i,a)}function wE(e,t){let n={resourceType:e},r=new Set;for(let[e,i]of t)EE(n,r,e,i);return n}function TE(e,t,n){let r=`${n.code}\0${n.operator}\0${n.value}`;t.has(r)||(t.add(r),e.filters=vw(e.filters,n))}function EE(e,t,n,r){let i,a,o=n.indexOf(`:`);if(o>=0?(i=n.substring(0,o),a=n.substring(o+1)):(i=n,a=``),i!==`_`){if(i===`_has`||n.includes(`.`)){TE(e,t,{code:n,operator:X.EQUALS,value:r});return}switch(i){case`_sort`:DE(e,r);break;case`_cursor`:e.cursor=r;break;case`_count`:e.count=Number.parseInt(r,10);break;case`_offset`:e.offset=Number.parseInt(r,10);break;case`_total`:e.total=r;break;case`_summary`:r===`count`?(e.total=`accurate`,e.count=0):(r===`true`||r===`data`||r===`text`)&&(e.summary=r);break;case`_include`:{let t=NE(r);a===`iterate`&&(t.modifier=X.ITERATE),e.include=vw(e.include,t);break}case`_revinclude`:{let t=NE(r);a===`iterate`&&(t.modifier=X.ITERATE),e.revInclude=vw(e.revInclude,t);break}case`_fields`:case`_elements`:e.fields=r.split(`,`);break;case`_type`:e.types=r.split(`,`);break;case`_format`:e.format=r;break;case`_pretty`:e.pretty=r===`true`;break;default:{let n=mT.types[e.resourceType]?.searchParams?.[i];n?TE(e,t,kE(n,X.EQUALS,a,r)):TE(e,t,AE(i,a,r))}}}}function DE(e,t){for(let n of t.split(`,`)){let t,r=!1;n.startsWith(`-`)?(t=n.substring(1),r=!0):t=n,e.sortRules||=[],e.sortRules.push({code:t,descending:r})}}var OE=[X.MISSING,X.PRESENT];function kE(e,t,n,r){if(OE.includes(n||t))return{code:e.code,operator:n||t,value:r};switch(e.type){case`number`:case`date`:case`quantity`:{let{operator:t,value:i}=jE(r,n||X.EQUALS);if(!PE(e,i))throw new vS(uS(`Invalid format for ${e.type} search parameter: ${i}`));return{code:e.code,operator:t,value:i}}case`reference`:case`string`:case`token`:case`uri`:if(!PE(e,r))throw new vS(uS(`Invalid format for ${e.type} search parameter: ${r}`));return{code:e.code,operator:ME(n)??t,value:r};default:throw Error(`Unrecognized search parameter type: `+e.type)}}function AE(e,t,n){let r=X.EQUALS;if(t)r=t;else if(n.length>=2){let e=n.substring(0,2);e in SE&&(n.length===2||n.at(2)?.match(/\d/))&&(r=e,n=n.substring(e.length))}return{code:e,operator:r,value:n}}function jE(e,t){let n=SE[e.substring(0,2)];return n?{operator:n,value:e.substring(2)}:{operator:t,value:e}}function ME(e){return xE[e]}function NE(e){let t=e.split(`:`);if(t.includes(`*`))throw new vS(uS(`'*' is not supported as a value for search inclusion parameters`));if(t.length===1)throw new vS(uS(`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 vS(uS(`Invalid include value '${e}'`))}function PE(e,t){switch(e.type){case`date`:return gC(t);default:return!0}}function FE(e){let t=[];e.fields&&t.push(`_fields=`+e.fields.join(`,`));for(let n of e.filters??Dw)t.push(IE(n));e.sortRules&&e.sortRules.length>0&&t.push(LE(e.sortRules)),e.cursor!==void 0&&t.push(`_cursor=`+encodeURIComponent(e.cursor)),e.offset!==void 0&&e.offset!==0&&t.push(`_offset=`+e.offset),e.count!==void 0&&t.push(`_count=`+e.count),e.total!==void 0&&t.push(`_total=`+e.total),e.types&&e.types.length>0&&t.push(`_type=`+e.types.join(`,`));for(let n of e.include??Dw)t.push(RE(`_include`,n));for(let n of e.revInclude??Dw)t.push(RE(`_revinclude`,n));return t.length===0?``:(yw(t),`?`+t.join(`&`))}function IE(e){let t=e.operator in xE?`:`+e.operator:``,n=e.operator!==X.EQUALS&&e.operator in SE?e.operator:``;return`${e.code}${t}=${n}${encodeURIComponent(e.value)}`}function LE(e){return`_sort=`+e.map(e=>e.descending?`-`+e.code:e.code).join(`,`)}function RE(e,t){return e+(t.modifier?`:`+t.modifier:``)+`=`+t.resourceType+`:`+t.searchParam+(t.targetType?`:`+t.targetType:``)}function zE(e){let t=[],n=``,r=!1;for(let i of e)r?(n+=i,r=!1):i===`\\`?r=!0:i===`,`?(t.push(n),n=``):n+=i;return t.push(n),t}function BE(e,t){if(t.resourceType!==e.resourceType)return!1;for(let n of t.filters??Dw)if(!HE(e,t,n))return!1;return!0}var VE=new Px(1e3);function HE(e,t,n){let r=mT.types[t.resourceType]?.searchParams?.[n.code];if(!r)return!1;let i=uE(r.expression,[$S(e)],void 0,VE);if(n.operator===X.MISSING||n.operator===X.PRESENT)return UE(i,n);switch(r.type){case`reference`:return WE(r,i,n);case`string`:case`uri`:return qE(i,n);case`token`:return GE(i,n);case`date`:return YE(i,n);default:return!1}}function UE(e,t){let n=e.length>0;return(t.operator===X.MISSING&&t.value===`false`||t.operator===X.PRESENT&&t.value===`true`)===n}function WE(e,t,n){let r=ZE(n.operator);if(n.value===``&&t.length===0)return n.operator===X.EQUALS;let i=pE(t);for(let t of zE(n.value)){let a=!1;if(t.includes(`/`)?a=i.includes(t):(e.target?.length===1||n.code===`_compartment`)&&(a=i.some(e=>e?.endsWith(`/`+t))),a)return!r}return r}function GE(e,t){let n=mE(e),r=zE(t.value),i=ZE(t.operator);for(let e of n)for(let t of r)if(KE(e,t))return!i;return i}function KE(e,t){if(t.includes(`|`)){let[n,r]=t.split(`|`).map(e=>e.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 qE(e,t){let n=fE(e),r=zE(t.value),i=ZE(t.operator);for(let e of n)for(let t of r)if(JE(e,t))return!i;return i}function JE(e,t){return e.toLowerCase().includes(t.toLowerCase())}function YE(e,t){let n=dE(e),r=zE(t.value),i=ZE(t.operator);for(let e of n)for(let n of r)if(XE(e,t.operator,n))return!i;return i}function XE(e,t,n){if(!e)return!1;let r=vC(n);if(!r)return!1;let i=e.start??`0000`,a=e.end??`9999`,o=r.start,s=r.end;switch(t){case X.APPROXIMATELY:case X.EQUALS:case X.NOT_EQUALS:return i<s&&a>o;case X.LESS_THAN:return i<o;case X.GREATER_THAN:return a>s;case X.LESS_THAN_OR_EQUALS:return i<=s;case X.GREATER_THAN_OR_EQUALS:return a>=o;case X.STARTS_AFTER:return i>s;case X.ENDS_BEFORE:return a<o;default:return!1}}function ZE(e){return e===X.NOT_EQUALS||e===X.NOT}var QE={resourceType:`*`},$E=[`DomainConfiguration`,`Enterprise`,`JsonWebKey`,`Login`],eD=[`AccessPolicy`,`Cron`,`Package`,`PackageRelease`,`PackageInstallation`,`Project`,`ProjectMembership`,`User`,`UserSecurityRequest`],tD={READ:`read`,VREAD:`vread`,UPDATE:`update`,DELETE:`delete`,HISTORY:`history`,CREATE:`create`,SEARCH:`search`},nD=[tD.READ,tD.VREAD,tD.HISTORY,tD.SEARCH];function rD(e,t){return!$E.includes(t)&&iD(e,tD.UPDATE,t)}function iD(e,t,n){return!!e.resource?.some(e=>sD(e,n,t))}function aD(e,t,n){return n?n.resource?.find(n=>oD(e,t,n)):QE}function oD(e,t,n){let r=e.resourceType;return sD(n,r,t)?r===`Binary`||!(n.compartment&&!e.meta?.compartment?.some(e=>e.reference===n.compartment?.reference)||n.criteria&&!BE(e,CE(n.criteria))):!1}function sD(e,t,n){return e.resourceType!==t&&(e.resourceType!==`*`||eD.includes(t))?!1:e.interaction?e.interaction.includes(n):!e.readonly||nD.includes(n)}function cD(){return typeof window<`u`}function lD(){return typeof Buffer<`u`?Buffer:void 0}var uD={assign(e){cD()&&globalThis.location.assign(e)},reload(){cD()&&globalThis.location.reload()},getSearch(){return cD()?globalThis.location.search:``},getPathname(){return cD()?globalThis.location.pathname:``},getLocation(){return cD()?globalThis.location.toString():``},getOrigin(){return cD()?globalThis.location.protocol+`//`+globalThis.location.host+`/`:``}};function dD(e){if(cD()){let t=window.atob(e),n=Uint8Array.from(t,e=>e.codePointAt(0));return new window.TextDecoder().decode(n)}let t=lD();if(t)return t.from(e,`base64`).toString(`utf-8`);throw Error(`Unable to decode base64`)}function fD(e){if(cD()){let t=new window.TextEncoder().encode(e),n=String.fromCodePoint.apply(null,t);return window.btoa(n)}let t=lD();if(t)return t.from(e,`utf8`).toString(`base64`);throw Error(`Unable to encode base64`)}function pD(e){return e=e.padEnd(e.length+(4-e.length%4)%4,`=`),dD(e.replaceAll(`-`,`+`).replaceAll(`_`,`/`))}function mD(){let e=new Uint32Array(28);return crypto.getRandomValues(e),cw(e.buffer)}async function hD(e){return crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e))}function gD(){return typeof crypto<`u`&&`randomUUID`in crypto?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replaceAll(/[xy]/g,e=>{let t=Math.trunc(Math.random()*16);return(e===`x`?t:t&3|8).toString(16)})}function _D(e){let t={};e=ew(e);for(let n of e.entry??Dw){let e=n.resource;if(!e)continue;e.meta!==void 0&&(delete e.meta.author,delete e.meta.compartment,delete e.meta.lastUpdated,delete e.meta.project,delete e.meta.versionId,Object.keys(e.meta).length===0&&delete e.meta);let r=e?.id;if(r)t[r]=gD(),n.fullUrl=`urn:uuid:`+t[r],delete n.resource?.id;else if(n.fullUrl?.startsWith(`resource:`)){let e=n.fullUrl.slice(9);t[e]=gD(),n.fullUrl=`urn:uuid:`+t[e]}}let n=e.entry,r=JSON.stringify({resourceType:`Bundle`,type:`transaction`,entry:n?.map(e=>({fullUrl:e.fullUrl,request:{method:`POST`,url:e.resource?.resourceType},resource:e.resource}))},(e,n)=>vD(e,n,t),2);return yD(JSON.parse(r))}function vD(e,t,n){if((e===`reference`||e===`url`)&&typeof t==`string`){let e;if(t.includes(`/`)?e=t.split(`/`)[1]:t.startsWith(`urn:uuid:`)||t.startsWith(`resource:`)?e=t.slice(9):t.startsWith(`#`)&&(e=t.slice(1)),e){let t=n[e];if(t)return`urn:uuid:`+t}}return t}function yD(e){let{sorted:t,cycles:n}=xD(CD(e)),r={},i=[];for(let t of e.entry??Dw)t.fullUrl?r[t.fullUrl]=t:i.push(t);let a=t.map(e=>r[e]);for(let e of n)for(let t of e){let e=r[t],n={...e,request:{...e.request,method:`PUT`}};a.push(n)}return a.push(...i),{...e,entry:a}}var bD={NotVisited:`NotVisited`,Visiting:`Visiting`,Visited:`Visited`};function xD(e){let t=[],n={},r=[];for(let t of Object.keys(e))n[t]=bD.NotVisited;function i(a,o){if(n[a]===bD.Visited)return!0;if(n[a]===bD.Visiting){let e=o.lastIndexOf(a);return e!==-1&&r.push(o.slice(e)),!0}n[a]=bD.Visiting,o.push(a);let s=!1;for(let t of e[a]??Dw)i(t,o)||(s=!0);return n[a]=bD.Visited,o.pop(),t.unshift(a),!s}for(let t in e)n[t]===bD.NotVisited&&i(t,[]);return{sorted:t,cycles:r}}function SD(e,t){for(let n in e)if(e[n]&&typeof e[n]==`object`){let r=e[n];if(pT(r)){let e=r.reference;(e.startsWith(`urn:uuid:`)||e.startsWith(`resource:`))&&t(e)}else SD(r,t)}}function CD(e){let t={};for(let n of e.entry??Dw)n.fullUrl&&(t[n.fullUrl]=[]);for(let n of e.entry??Dw){let e=n.fullUrl;e&&n.resource&&SD(n.resource,n=>{n!==e&&t[n]&&t[n].push(e)})}return t}var wD={CSS:`text/css`,DICOM:`application/dicom`,DICOM_JSON:`application/dicom+json`,EVENT_STREAM:`text/event-stream`,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`,JOSE:`application/jose`,JSON:`application/json`,JSON_PATCH:`application/json-patch+json`,JWT:`application/jwt`,LINKSET_JSON:`application/linkset+json`,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`},TD=class{listeners;constructor(){this.listeners={}}addEventListener(e,t){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t)}removeEventListener(e,t){let n=this.listeners[e];if(n){for(let e=0;e<n.length;e++)if(n[e]===t){n.splice(e,1);return}}}dispatchEvent(e){let t=this.listeners[e.type];for(let n of t??Dw)try{n.call(this,e)}catch(t){console.error(`Unhandled error in "${e.type}" event listener`,t)}return!e.defaultPrevented}removeAllListeners(){this.listeners={}}listenerCount(e){return this.listeners[e]?.length??0}},ED=class{emitter=new TD;dispatchEvent(e){this.emitter.dispatchEvent(e)}addEventListener(e,t){this.emitter.addEventListener(e,t)}removeEventListener(e,t){this.emitter.removeEventListener(e,t)}removeAllListeners(){this.emitter.removeAllListeners()}listenerCount(e){return this.emitter.listenerCount(e)}},DD={Event:globalThis.Event===void 0?void 0:globalThis.Event,ErrorEvent:void 0,CloseEvent:void 0},OD=!1;function kD(){if(globalThis.Event===void 0)throw Error(`Unable to lazy init events for ReconnectingWebSocket. globalThis.Event is not defined yet`);DD.Event=globalThis.Event,DD.ErrorEvent=class extends Event{message;error;constructor(e,t){super(`error`,t),this.message=e.message,this.error=e}},DD.CloseEvent=class extends Event{code;reason;wasClean=!0;constructor(e=1e3,t=``,n){super(`close`,n),this.code=e,this.reason=t}}}function AD(e,t){if(!e)throw Error(t)}function jD(){}function MD(e){if(e instanceof DD.CloseEvent){let t=e;return new DD.CloseEvent(t.code,t.reason,void 0)}if(e instanceof DD.ErrorEvent){let t=e;return new DD.ErrorEvent(t.error??Error(t.message),void 0)}return new e.constructor(e.type,e)}function ND(e,t){let n=e;return n.error instanceof Error?new DD.ErrorEvent(n.error,t):new DD.ErrorEvent(Error(n.message||`WebSocket error`),t)}var PD={maxReconnectionDelay:1e4,minReconnectionDelay:1e3+Math.random()*4e3,minUptime:5e3,reconnectionDelayGrowFactor:1.3,connectionTimeout:4e3,maxRetries:1/0,maxEnqueuedMessages:1/0,startClosed:!1,debug:!1},FD=!1,ID=class e extends ED{_ws;_retryCount=-1;_uptimeTimeout;_connectTimeout;_shouldReconnect=!0;_connectLock=!1;_binaryType;_closeCalled=!1;_messageQueue=[];_debugLogger=console.log.bind(console);_url;_protocols;_options;constructor(e,t,n={}){OD||=(kD(),!0),super(),this._url=e,this._protocols=t,this._options=n,this._options.startClosed&&(this._shouldReconnect=!1),this._binaryType=this._options.binaryType?this._options.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 e.CONNECTING}get OPEN(){return e.OPEN}get CLOSING(){return e.CLOSING}get CLOSED(){return e.CLOSED}get binaryType(){return this._ws?this._ws.binaryType:this._binaryType}set binaryType(e){this._binaryType=e,this._ws&&(this._ws.binaryType=e)}get retryCount(){return Math.max(this._retryCount,0)}get bufferedAmount(){return this._messageQueue.reduce((e,t)=>(typeof t==`string`?e+=t.length:t instanceof Blob?e+=t.size:e+=t.byteLength,e),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?e.CLOSED:e.CONNECTING}get url(){return this._ws?this._ws.url:``}get shouldReconnect(){return this._shouldReconnect}onclose=null;onerror=null;onmessage=null;onopen=null;close(e=1e3,t){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(e,t)}reconnect(e,t){this._shouldReconnect=!0,this._closeCalled=!1,this._retryCount=-1,!this._ws||this._ws.readyState===this.CLOSED||this._disconnect(e,t),this._connect()}send(e){if(this._ws?.readyState===this.OPEN)this._debug(`send`,e),this._ws.send(e);else{let{maxEnqueuedMessages:t=PD.maxEnqueuedMessages}=this._options;this._messageQueue.length<t&&(this._debug(`enqueue`,e),this._messageQueue.push(e))}}_debug(...e){this._options.debug&&this._debugLogger(`RWS>`,...e)}_getNextDelay(){let{reconnectionDelayGrowFactor:e=PD.reconnectionDelayGrowFactor,minReconnectionDelay:t=PD.minReconnectionDelay,maxReconnectionDelay:n=PD.maxReconnectionDelay}=this._options,r=0;return this._retryCount>0&&(r=t*e**(this._retryCount-1),r>n&&(r=n)),this._debug(`next delay`,r),r}_wait(){return new Promise(e=>{setTimeout(e,this._getNextDelay())})}_connect(){if(this._connectLock||!this._shouldReconnect)return;this._connectLock=!0;let{maxRetries:e=PD.maxRetries,connectionTimeout:t=PD.connectionTimeout}=this._options;if(this._retryCount>=e){this._connectLock=!1,this._debug(`max retries reached`,this._retryCount,`>=`,e);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`&&!FD&&(console.error(`‼️ No WebSocket implementation available. You should define options.WebSocket.`),FD=!0);let e=this._options.WebSocket||WebSocket;this._debug(`connect`,{url:this._url,protocols:this._protocols}),this._ws=this._protocols?new e(this._url,this._protocols):new e(this._url),this._ws.binaryType=this._binaryType,this._connectLock=!1,this._addListeners(),this._connectTimeout=setTimeout(()=>this._handleTimeout(),t)}).catch(e=>{this._connectLock=!1,this._handleError(new DD.ErrorEvent(Error(e.message),this))})}_handleTimeout(){this._debug(`timeout event`),this._handleError(new DD.ErrorEvent(Error(`TIMEOUT`),this))}_disconnect(e=1e3,t){if(this._clearTimeouts(),!this._ws)return;let n=this._ws;this._removeListeners(),n.addEventListener(`error`,jD);try{n.close(e,t),this._handleClose(new DD.CloseEvent(e,t,this))}catch{}}_acceptOpen(){this._debug(`accept open`),this._retryCount=0}_handleOpen=e=>{this._debug(`open event`);let{minUptime:t=PD.minUptime}=this._options;clearTimeout(this._connectTimeout),this._uptimeTimeout=setTimeout(()=>this._acceptOpen(),t),AD(this._ws,`WebSocket is not defined`),this._ws.binaryType=this._binaryType,this._messageQueue.forEach(e=>this._ws?.send(e)),this._messageQueue=[],this.onopen&&this.onopen(e),this.dispatchEvent(MD(e))};_handleMessage=e=>{this._debug(`message event`),this.onmessage&&this.onmessage(e),this.dispatchEvent(MD(e))};_handleError=e=>{let t=ND(e,this);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(MD(t)),this._connect()};_handleClose=e=>{this._debug(`close event`),this._clearTimeouts(),this._shouldReconnect&&this._connect(),this.onclose&&this.onclose(e),this.dispatchEvent(MD(e))};_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)}},LD={"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`},RD=[`Patient`,`Encounter`,`ImagingStudy`,`DiagnosticReport`,`OperationOutcome`,`Bundle`],zD=[`DiagnosticReport-update`];function BD(e){return zD.includes(e)}function VD(e){if(zD.includes(e))throw new vS(dS(`'context.version' is required for '${e}'.`))}var HD={"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 UD(e){return RD.includes(e)}function WD(e){return!!e.endpoint}function GD(e){if(!KD(e))throw new vS(dS(`subscriptionRequest must be an object conforming to SubscriptionRequest type.`));let{channelType:t,mode:n,topic:r,events:i}=e,a={"hub.channel.type":t,"hub.mode":n,"hub.topic":r};return n===`subscribe`&&(a[`hub.events`]=i.join(`,`)),WD(e)&&(a[`hub.channel.endpoint`]=e.endpoint),new URLSearchParams(a).toString()}function KD(e){if(typeof e!=`object`)return!1;let{channelType:t,mode:n,topic:r,events:i}=e;if(!(t&&n&&r&&i)||typeof r!=`string`||typeof i!=`object`||!Array.isArray(i)||i.length<1||t!==`websocket`||n!==`subscribe`&&n!==`unsubscribe`)return!1;for(let e of i)if(!LD[e])return!1;return!(WD(e)&&!(typeof e.endpoint==`string`&&e.endpoint.startsWith(`ws`)))}function qD(e,t,n,r){if(typeof t!=`object`)throw new vS(dS(`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 vS(dS(`context[${n}] is invalid. Resource must contain a valid string ID.`));if(!t.resourceType)throw new vS(dS(`context[${n}] is invalid. Resource must contain a resource type. No resource type found.`));let i=r.resourceType;if(i!==`*`){if(!UD(t.resourceType))throw new vS(dS(`context[${n}] is invalid. Resource must contain a valid FHIRcast resource type. Resource type is not a known resource type.`));if(i&&t.resourceType!==i)throw new vS(dS(`context[${n}] is invalid. context[${n}] for the '${e}' event should contain resource of type ${i}.`))}}function JD(e,t,n,r,i){if(i.set(t.key,(i.get(t.key)??0)+1),r.reference){if(!pT(t.reference))throw new vS(dS(`context[${n}] is invalid. Expected key '${t.key}' to be a reference.`))}else qD(e,t.resource,n,r)}function YD(e,t){let n=new Map,r=HD[e];for(let i=0;i<t.length;i++){let a=t[i].key;if(!r[a])throw new vS(dS(`Key '${a}' not found for event '${e}'. Make sure to add only valid keys.`));JD(e,t[i],i,r[a],n)}for(let[t,i]of Object.entries(r)){if(!(i.optional||n.has(t)))throw new vS(dS(`Missing required key '${t}' on context for '${e}' event.`));if(!i.manyAllowed&&(n.get(t)??0)>1)throw new vS(dS(`${n.get(t)} context entries with key '${t}' found for the '${e}' event when schema only allows for 1.`))}}function XD(e,t,n,r){if(!(e&&typeof e==`string`))throw new vS(dS(`Must provide a topic.`));if(!LD[t])throw new vS(dS(`Must provide a valid FHIRcast event name. Supported events: ${Object.keys(LD).join(`, `)}`));if(typeof n!=`object`)throw new vS(dS(`context must be a context object or array of context objects.`));if(zD.includes(t)&&!r)throw new vS(dS(`The '${t}' event must contain a 'context.versionId'.`));let i=Array.isArray(n)?n:[n];return YD(t,i),{timestamp:new Date().toISOString(),id:gD(),event:{"hub.topic":e,"hub.event":t,context:i,...r?{"context.versionId":r}:{}}}}var ZD=class extends ED{subRequest;websocket;constructor(e,t){if(super(),this.subRequest=e,!e.endpoint)throw new vS(dS(`Subscription request should contain an endpoint.`));if(!KD(e))throw new vS(dS(`Subscription request failed validation.`));let{ReconnectingWebSocket:n=ID,...r}=t??{},i=new n(e.endpoint,void 0,r);i.addEventListener(`open`,()=>{this.dispatchEvent({type:`connect`})}),i.addEventListener(`message`,e=>{let t=JSON.parse(e.data);if(!t.event){t[`hub.mode`]===`denied`&&this.disconnect();return}let n=t;n.event[`hub.event`]!==`heartbeat`&&(this.dispatchEvent({type:`message`,payload:n}),i.send(JSON.stringify({id:t?.id,timestamp:new Date().toISOString()})))}),i.addEventListener(`close`,()=>{this.dispatchEvent({type:`disconnect`})}),this.websocket=i}disconnect(){this.websocket.close()}};function QD(e){return JSON.parse(pD(e))}function $D(e){return e.split(`.`).length===3}function eO(e){let[t,n,r]=e.split(`.`);return QD(n)}function tO(e){try{return typeof eO(e).login_id==`string`}catch{return!1}}function nO(e){try{let t=eO(e).exp;return typeof t==`number`?t*1e3:void 0}catch{return}}var rO=class{medplum;constructor(e){this.medplum=e}async get(e){return this.medplum.get(`keyvalue/v1/${e}`)}async set(e,t){await this.medplum.put(`keyvalue/v1/${e}`,t,wD.TEXT)}async delete(e){await this.medplum.delete(`keyvalue/v1/${e}`)}},iO=class{[Symbol.toStringTag]=`ReadablePromise`;suspender;status=`pending`;response;error;constructor(e){this.suspender=e.then(e=>(this.status=`success`,this.response=e,e),e=>{throw this.status=`error`,this.error=e,e})}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(e,t){return this.suspender.then(e,t)}catch(e){return this.suspender.catch(e)}finally(e){return this.suspender.finally(e)}},aO=class{storage;prefix=``;constructor(e,t=``){this.storage=e??globalThis.localStorage??new oO,this.prefix=t}makeKey(e){return this.prefix+e}clear(){if(this.storage===globalThis.localStorage&&this.prefix)for(let e=this.storage.length-1;e>=0;e--){let t=this.storage.key(e);t?.startsWith(this.prefix)&&this.storage.removeItem(t)}else this.storage.clear()}getString(e){return this.storage.getItem(this.makeKey(e))??void 0}setString(e,t){t?this.storage.setItem(this.makeKey(e),t):this.storage.removeItem(this.makeKey(e))}getObject(e){let t=this.getString(e);return t?JSON.parse(t):void 0}setObject(e,t){this.setString(e,t?VC(t):void 0)}},oO=class{data;constructor(){this.data=new Map}get length(){return this.data.size}clear(){this.data.clear()}getItem(e){return this.data.get(e)??null}setItem(e,t){t?this.data.set(e,t):this.data.delete(e)}removeItem(e){this.data.delete(e)}key(e){return Array.from(this.data.keys())[e]}},sO=6e4,cO=[WebSocket.CLOSING,WebSocket.CLOSED],lO=class extends ED{criteria;constructor(...e){super(),this.criteria=new Set(e)}getCriteria(){return this.criteria}_addCriteria(e){this.criteria.add(e)}_removeCriteria(e){this.criteria.delete(e)}},uO=class{criteria;emitter;refCount;subscriptionProps;subscriptionId;token;tokenExpiry;state=`idle`;generation=0;lastUnrefTime;constructor(e,t){this.criteria=e,this.emitter=new lO(e),this.refCount=1,this.subscriptionProps=t?{...t}:void 0}nextGeneration(){return++this.generation}},dO=class{medplum;ws;masterSubEmitter;criteriaEntries;criteriaEntriesBySubscriptionId;wsClosed;pingTimer=void 0;tokenRefreshTimer=void 0;pingIntervalMs;waitingForPong=!1;currentProfile;constructor(e,t,n){if(!(e instanceof EO))throw new vS(dS("First arg of constructor should be a `MedplumClient`"));let r;try{r=new URL(t).toString()}catch{throw new vS(dS(`Not a valid URL`))}let i=n?.ReconnectingWebSocket?new n.ReconnectingWebSocket(r,void 0,{debug:n?.debug,debugLogger:n?.debugLogger}):new ID(r,void 0,{debug:n?.debug,debugLogger:n?.debugLogger});this.medplum=e,this.ws=i,this.masterSubEmitter=new lO,this.criteriaEntries=new Map,this.criteriaEntriesBySubscriptionId=new Map,this.wsClosed=!1,this.pingIntervalMs=n?.pingIntervalMs??5e3,this.currentProfile=e.getProfile(),this.setupListeners()}setupListeners(){let e=this.ws;e.addEventListener(`message`,e=>{try{let t=JSON.parse(e.data);if(t.type===`pong`){this.waitingForPong=!1;return}let n=t,r=n?.entry?.[0]?.resource;if(!r){console.warn(`Received WebSocket message without a SubscriptionStatus resource; ignoring`,n);return}if(r.type===`heartbeat`){this.masterSubEmitter?.dispatchEvent({type:`heartbeat`,payload:n});return}if(r.type===`handshake`){let e=kC(r.subscription),t={type:`connect`,payload:{subscriptionId:e}};this.masterSubEmitter?.dispatchEvent(t);let n=this.criteriaEntriesBySubscriptionId.get(e);if(!n){console.warn(`Received handshake for criteria the SubscriptionManager is not listening for yet`);return}(n.state===`connecting`||n.state===`refreshing`)&&(n.state=`active`),n.emitter.dispatchEvent({...t});return}this.masterSubEmitter?.dispatchEvent({type:`message`,payload:n});let i=this.criteriaEntriesBySubscriptionId.get(kC(r.subscription));if(!i){console.warn(`Received notification for criteria the SubscriptionManager is not listening for`);return}i.emitter.dispatchEvent({type:`message`,payload:n})}catch(e){console.error(e);let t={type:`error`,payload:e};this.masterSubEmitter?.dispatchEvent(t);for(let e of this.getAllCriteriaEmitters())e.dispatchEvent({...t})}}),e.addEventListener(`error`,e=>{let t={type:`error`,payload:new vS({resourceType:`OperationOutcome`,issue:[{severity:`error`,code:`exception`,details:{text:`WebSocket connection closed due to an error`},diagnostics:e.error?J(e.error):e.message}]})};this.masterSubEmitter?.dispatchEvent(t);for(let e of this.getAllCriteriaEmitters())e.dispatchEvent({...t})}),e.addEventListener(`close`,()=>{let e={type:`close`};this.masterSubEmitter?.dispatchEvent(e);for(let t of this.getAllCriteriaEmitters())t.dispatchEvent({...e});this.pingTimer&&(clearInterval(this.pingTimer),this.pingTimer=void 0,this.waitingForPong=!1),this.tokenRefreshTimer&&=(clearInterval(this.tokenRefreshTimer),void 0),this.wsClosed&&(this.criteriaEntries.clear(),this.criteriaEntriesBySubscriptionId.clear(),this.masterSubEmitter?.removeAllListeners())}),e.addEventListener(`open`,()=>{let t={type:`open`};this.masterSubEmitter?.dispatchEvent(t);for(let e of this.getAllCriteriaEmitters())e.dispatchEvent({...t});this.refreshAllSubscriptions().catch(console.error),this.pingTimer??=setInterval(()=>{this.waitingForPong?(this.waitingForPong=!1,e.reconnect()):(e.send(JSON.stringify({type:`ping`})),this.waitingForPong=!0),this.gcUnrefEntries()},this.pingIntervalMs),this.tokenRefreshTimer??=setInterval(()=>{this.checkTokenExpirations(),this.gcUnrefEntries()},sO)}),this.medplum.addEventListener(`change`,()=>{let e=this.medplum.getProfile();this.currentProfile&&e===void 0?this.ws.close():e&&this.currentProfile?.id!==e.id&&this.ws.reconnect(),this.currentProfile=e})}sendBind(e){this.ws.send(JSON.stringify({type:`bind-with-token`,payload:{token:e}}))}sendUnbind(e){this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify({type:`unbind-from-token`,payload:{token:e}}))}emitError(e,t){let n={type:`error`,payload:t};this.masterSubEmitter?.dispatchEvent(n),e.emitter.dispatchEvent({...n})}maybeEmitDisconnect(e){let{subscriptionId:t}=e;if(t){let n={type:`disconnect`,payload:{subscriptionId:t}};this.masterSubEmitter?.dispatchEvent(n),e.emitter.dispatchEvent({...n})}else console.warn("Called disconnect for `CriteriaEntry` before `subscriptionId` was present.")}isStale(e,t){return this.isEntryGettingRemoved(e)||e.generation!==t}maybeGetCriteriaEntry(e,t){let n=this.criteriaEntries.get(e);if(n){if(!t)return n.bareCriteria;for(let e of n.criteriaWithProps)if(JC(t,e.subscriptionProps))return e}}getAllCriteriaEmitters(){let e=[];for(let t of this.criteriaEntries.values())for(let n of fO(t))n.refCount>0&&e.push(n.emitter);return e}addCriteriaEntry(e){let{criteria:t,subscriptionProps:n}=e,r;this.criteriaEntries.has(t)?r=this.criteriaEntries.get(t):(r={criteriaWithProps:[]},this.criteriaEntries.set(t,r)),n?r.criteriaWithProps.push(e):r.bareCriteria=e}removeCriteriaEntry(e){e.state=`removed`,e.generation++;let{criteria:t,subscriptionProps:n,subscriptionId:r,token:i}=e;if(!this.criteriaEntries.has(t))return;let a=this.criteriaEntries.get(t);n?a.criteriaWithProps=a.criteriaWithProps.filter(e=>{let t=e.subscriptionProps;return!JC(n,t)}):a.bareCriteria=void 0,!a.bareCriteria&&a.criteriaWithProps.length===0&&(this.criteriaEntries.delete(t),this.masterSubEmitter?._removeCriteria(t)),r&&this.criteriaEntriesBySubscriptionId.delete(r),i&&this.sendUnbind(i)}async subscribeToCriteria(e){this.wsClosed&&await this.reconnectIfNeeded(),this.ws.readyState===WebSocket.OPEN&&this.medplum.getProfile()&&e.state===`idle`&&(e.state=`connecting`,await this.rebindCriteriaEntry(e))}async refreshAllSubscriptions(){this.criteriaEntriesBySubscriptionId.clear();let e=[],t=[];for(let n of this.criteriaEntries.values())for(let r of fO(n))r.refCount===0?t.push(r):e.push(r);for(let e of t)this.removeCriteriaEntry(e);for(let t of e)t.token&&this.sendUnbind(t.token),t.token=void 0,t.tokenExpiry=void 0,t.subscriptionId=void 0,t.state=`idle`,t.generation++,await this.subscribeToCriteria(t)}async rebindCriteriaEntry(e){let t=e.nextGeneration();try{if(!e.subscriptionId){let n=await this.medplum.createResource({...e.subscriptionProps,resourceType:`Subscription`,status:`active`,reason:`WebSocket subscription for ${OC(this.medplum.getProfile())}`,channel:{type:`websocket`},criteria:e.criteria});if(e.subscriptionId??=n.id,this.isStale(e,t))return}let{parameter:n}=await this.medplum.get(`fhir/R4/Subscription/${e.subscriptionId}/$get-ws-binding-token`,{cache:`no-cache`}),r=n?.find(e=>e.name===`token`)?.valueString,i=n?.find(e=>e.name===`websocket-url`)?.valueUrl,a=n?.find(e=>e.name===`expiration`)?.valueDateTime;if(!r)throw new vS(dS(`Failed to get token`));if(!i)throw new vS(dS(`Failed to get URL from $get-ws-binding-token`));if(!a)throw new vS(dS(`Failed to get expiration from $get-ws-binding-token`));if(this.isStale(e,t))return;e.token=r,e.tokenExpiry=new Date(a).getTime(),this.criteriaEntriesBySubscriptionId.set(e.subscriptionId,e),this.sendBind(r)}catch(n){console.error(J(n)),e.generation===t&&!this.isEntryGettingRemoved(e)&&(e.state=e.state===`refreshing`?`active`:`idle`),this.emitError(e,n)}}checkTokenExpirations(){if(!this.medplum.getProfile())return;let e=Date.now();for(let t of this.criteriaEntries.values())for(let n of fO(t))n.refCount!==0&&n.tokenExpiry&&n.tokenExpiry-e<=3e5&&n.state===`active`&&this.ws.readyState===WebSocket.OPEN&&(n.state=`refreshing`,this.rebindCriteriaEntry(n).catch(e=>{this.masterSubEmitter?.dispatchEvent({type:`error`,payload:e})}))}addCriteria(e,t){this.masterSubEmitter&&this.masterSubEmitter._addCriteria(e);let n=this.maybeGetCriteriaEntry(e,t);if(n)return n.refCount===0&&(n.lastUnrefTime=void 0,n.generation++,n.state!==`active`&&(n.state=n.token?`active`:`idle`)),n.refCount+=1,n.state===`idle`&&this.subscribeToCriteria(n).catch(console.error),n.emitter;let r=new uO(e,t);return this.addCriteriaEntry(r),this.subscribeToCriteria(r).catch(console.error),r.emitter}removeCriteria(e,t){let n=this.maybeGetCriteriaEntry(e,t);if(!n||this.isEntryGettingRemoved(n)){console.warn("Criteria not known to `SubscriptionManager`. Possibly called remove too many times.");return}--n.refCount,n.refCount===0&&(n.lastUnrefTime=Date.now(),n.generation++)}gcUnrefEntries(){let e=Date.now(),t=[];for(let n of this.criteriaEntries.values())for(let r of fO(n))r.refCount===0&&r.lastUnrefTime!==void 0&&e-r.lastUnrefTime>=1e4&&t.push(r);for(let e of t)this.maybeEmitDisconnect(e),this.removeCriteriaEntry(e);t.length>0&&this.criteriaEntries.size===0&&this.closeWebSocket()}isEntryGettingRemoved(e){return e.refCount===0||e.state===`removed`}getWebSocket(){return this.ws}closeWebSocket(){if(!this.wsClosed){if(this.ws.readyState===WebSocket.OPEN)for(let e of this.criteriaEntries.values())for(let t of fO(e))t.token&&this.sendUnbind(t.token);this.wsClosed=!0,this.ws.close()}}reconnectWebSocket(){this.ws.reconnect(),this.wsClosed=!1}getCriteriaCount(){return this.getAllCriteriaEmitters().length}getMasterEmitter(){return this.masterSubEmitter||=new lO(...Array.from(this.criteriaEntries.keys())),this.masterSubEmitter}async reconnectIfNeeded(){cO.includes(this.getWebSocket().readyState)&&await new Promise(e=>{let t=()=>{this.getWebSocket().removeEventListener(`open`,t),e()};this.getWebSocket().addEventListener(`open`,t),this.reconnectWebSocket()})}};function fO(e){return e.bareCriteria?[e.bareCriteria,...e.criteriaWithProps]:e.criteriaWithProps}new Px(1e3);var pO=`5.2.4-4574508`,mO=wD.FHIR_JSON+`, */*; q=0.1`,hO=`https://api.medplum.com/`,gO=1e3,_O=6e4,vO=0,yO=3e5,bO=`Binary/`,xO={resourceType:`Device`,id:`system`,deviceName:[{type:`model-name`,name:`System`}]},SO=2,CO={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`,PreAuthorizedCode:`urn:ietf:params:oauth:grant-type:pre-authorized_code`},wO={AccessToken:`urn:ietf:params:oauth:token-type:access_token`,RefreshToken:`urn:ietf:params:oauth:token-type:refresh_token`,IdToken:`urn:ietf:params:oauth:token-type:id_token`,Saml1Token:`urn:ietf:params:oauth:token-type:saml1`,Saml2Token:`urn:ietf:params:oauth:token-type:saml2`},TO={JwtBearer:`urn:ietf:params:oauth:client-assertion-type:jwt-bearer`},EO=class extends ED{options;fetch;createPdfImpl;storage;requestCache;cacheTime;baseUrl;fhirBaseUrl;authorizeUrl;tokenUrl;logoutUrl;fhircastHubUrl;cdsServicesUrl;defaultHeaders;onUnauthenticated;autoBatchTime;autoBatchQueue;maxRetries;maxRetryTime;refreshGracePeriod;subscriptionManager;medplumServer;clientId;clientSecret;credentialsInHeader;autoBatchTimerId;accessToken;accessTokenExpires;refreshToken;refreshPromise;profilePromise;sessionDetails;currentRateLimits;basicAuth;initPromise;initComplete=!0;keyValueClient;logLevel;constructor(e){if(super(),e?.baseUrl&&!e.baseUrl.startsWith(`http`))throw Error(`Base URL must start with http or https`);this.options=e??{},this.fetch=e?.fetch??DO(),this.storage=e?.storage??new aO(void 0,e?.storagePrefix),this.createPdfImpl=e?.createPdf,this.baseUrl=bw(e?.baseUrl??hO),this.fhirBaseUrl=Sw(this.baseUrl,e?.fhirUrlPath??`fhir/R4`),this.authorizeUrl=Sw(this.baseUrl,e?.authorizeUrl??`oauth2/authorize`),this.tokenUrl=Sw(this.baseUrl,e?.tokenUrl??`oauth2/token`),this.logoutUrl=Sw(this.baseUrl,e?.logoutUrl??`oauth2/logout`),this.fhircastHubUrl=Sw(this.baseUrl,e?.fhircastHubUrl??`fhircast/STU3`),this.cdsServicesUrl=Sw(this.baseUrl,e?.cdsServicesUrl??`cds-services`),this.clientId=e?.clientId??``,this.clientSecret=e?.clientSecret??``,this.credentialsInHeader=e?.authCredentialsMethod===`header`,this.defaultHeaders=e?.defaultHeaders??{},this.onUnauthenticated=e?.onUnauthenticated,this.refreshGracePeriod=e?.refreshGracePeriod??yO,this.logLevel=this.initializeLogLevel(e),this.maxRetries=e?.maxRetries??2,this.maxRetryTime=e?.maxRetryTime??2e3,this.cacheTime=e?.cacheTime??(cD()?_O:vO),this.requestCache=this.cacheTime>0?new Px(e?.resourceCacheSize??gO):void 0,e?.autoBatchTime?(this.autoBatchTime=e.autoBatchTime,this.autoBatchQueue=[]):(this.autoBatchTime=0,this.autoBatchQueue=void 0),e?.accessToken&&this.setAccessToken(e.accessToken),this.storage.getInitPromise===void 0?(e?.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(()=>{e?.accessToken||this.attemptResumeActiveLogin().catch(console.error),this.initComplete=!0,this.dispatchEvent({type:`storageInitialized`})}).catch(e=>{console.error(e),this.initComplete=!0,this.dispatchEvent({type:`storageInitFailed`,payload:{error:e}})})),this.setupStorageListener()}get isInitialized(){return this.initComplete}getInitPromise(){return this.initPromise}initializeLogLevel(e){return e?.logLevel?e.logLevel:e?.verbose===void 0?`none`:e.verbose?`verbose`:`none`}async attemptResumeActiveLogin(){let e=this.getActiveLogin();e&&(this.setAccessToken(e.accessToken,e.refreshToken),await this.refreshProfile())}getBaseUrl(){return this.baseUrl}getAuthorizeUrl(){return this.authorizeUrl}getTokenUrl(){return this.tokenUrl}getLogoutUrl(){return this.logoutUrl}getFhircastHubUrl(){return this.fhircastHubUrl}getCdsServicesUrl(){return this.cdsServicesUrl}getDefaultHeaders(){return this.defaultHeaders}clear(){this.storage.clear(),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(e){e=e.toString(),this.requestCache?.delete(e)}invalidateAll(){this.requestCache?.clear()}invalidateSearches(e){let t=Sw(this.fhirBaseUrl,e);for(let e of this.requestCache?.keys()??Dw)(e.endsWith(t)||e.includes(t+`?`))&&this.requestCache?.delete(e)}notifyResourceModified(e){e.operation!==`delete`&&e.resource?this.cacheResource(e.resource,void 0):e.id&&this.deleteCacheEntry(this.fhirUrl(e.resourceType,e.id).toString()),this.invalidateSearches(e.resourceType),this.dispatchResourceModified(e)}get(e,t={}){e=e.toString();let n=this.getCacheEntry(e,t);if(n)return n.value;let r;e.startsWith(this.fhirBaseUrl)&&this.autoBatchQueue&&!t.disableAutoBatch?r=new Promise((n,r)=>{this.autoBatchQueue.push({method:`GET`,url:e.replace(this.fhirBaseUrl,``),options:t,resolve:n,reject:r}),this.autoBatchTimerId||=setTimeout(()=>this.executeAutoBatch(),this.autoBatchTime)}):(t.method=`GET`,r=this.request(e,t));let i=new iO(r);return this.setCacheEntry(e,i,t),i}post(e,t,n,r={}){return e=e.toString(),this.setRequestBody(r,t),n&&this.setRequestContentType(r,n),this.invalidateUrl(e),r.method=`POST`,this.request(e,r)}put(e,t,n,r={}){return e=e.toString(),this.setRequestBody(r,t),n&&this.setRequestContentType(r,n),this.invalidateUrl(e),r.method=`PUT`,this.request(e,r)}patch(e,t,n={}){return e=e.toString(),this.setRequestBody(n,t),this.setRequestContentType(n,wD.JSON_PATCH),this.invalidateUrl(e),n.method=`PATCH`,this.request(e,n)}delete(e,t={}){return e=e.toString(),this.invalidateUrl(e),t.method=`DELETE`,this.request(e,t)}async startNewUser(e,t){let{codeChallengeMethod:n,codeChallenge:r}=await this.startPkce();return this.post(`auth/newuser`,{...e,clientId:e.clientId??this.clientId,codeChallengeMethod:n,codeChallenge:r},void 0,t)}async startNewProject(e,t){return this.post(`auth/newproject`,e,void 0,t)}async startNewPatient(e,t){return this.post(`auth/newpatient`,e,void 0,t)}async startLogin(e,t){return this.post(`auth/login`,{...await this.ensureCodeChallenge(e),clientId:e.clientId??this.clientId,scope:e.scope},void 0,t)}async startGoogleLogin(e,t){return this.post(`auth/google`,{...await this.ensureCodeChallenge(e),clientId:e.clientId??this.clientId,scope:e.scope},void 0,t)}async ensureCodeChallenge(e){return e.codeChallenge?e:{...e,...await this.startPkce()}}async signOut(){await this.post(this.logoutUrl,{}),this.clear()}async signInWithRedirect(e){let t=new URLSearchParams(uD.getSearch()).get(`code`);if(!t){await this.requestAuthorization(e);return}return this.processCode(t)}signOutWithRedirect(){uD.assign(this.logoutUrl)}async signInWithExternalAuth(e,t,n,r,i=!0){let a=r;i&&(a=await this.ensureCodeChallenge(r)),uD.assign(this.getExternalAuthRedirectUri(e,t,n,a,i))}async exchangeExternalAccessToken(e,t,n){if(t??=this.clientId,!t)throw Error(`MedplumClient is missing clientId`);let r={grant_type:CO.TokenExchange,subject_token_type:wO.AccessToken,client_id:t,subject_token:e};return n&&(r.membership_id=n),this.fetchTokens(r)}getExternalAuthRedirectUri(e,t,n,r,i=!0){let a=new URL(e);if(a.searchParams.set(`response_type`,`code`),a.searchParams.set(`client_id`,t),a.searchParams.set(`redirect_uri`,n),a.searchParams.set(`scope`,r.scope??`openid profile email`),a.searchParams.set(`state`,JSON.stringify(r)),i){let{codeChallenge:e,codeChallengeMethod:t}=r;if(!t)throw Error("`LoginRequest` for external auth must include a `codeChallengeMethod`.");if(!e)throw Error("`LoginRequest` for external auth must include a `codeChallenge`.");a.searchParams.set(`code_challenge_method`,t),a.searchParams.set(`code_challenge`,e)}return a.toString()}fhirUrl(...e){return new URL(Sw(this.fhirBaseUrl,e.join(`/`)))}fhirSearchUrl(e,t){let n=this.fhirUrl(e);return t&&(n.search=ww(t)),n}search(e,t,n){let r=this.fhirSearchUrl(e,t),i=`search-`+r.toString(),a=this.getCacheEntry(i,n);if(a)return a.value;let o=this.getBundle(r,n);return this.setCacheEntry(i,o,n),o}searchOne(e,t,n){let r=this.fhirSearchUrl(e,t);r.searchParams.set(`_count`,`1`),r.searchParams.sort();let i=`searchOne-`+r.toString(),a=this.getCacheEntry(i,n);if(a)return a.value;let o=new iO(this.search(e,r.searchParams,n).then(e=>e.entry?.[0]?.resource));return this.setCacheEntry(i,o,n),o}searchResources(e,t,n){let r=`searchResources-`+this.fhirSearchUrl(e,t).toString(),i=this.getCacheEntry(r,n);if(i)return i.value;let a=new iO(this.search(e,t,n).then(kO));return this.setCacheEntry(r,a,n),a}async*searchResourcePages(e,t,n){let r=this.fhirSearchUrl(e,t);for(;r;){let t=new URL(r).searchParams;t.has(`_count`)||t.set(`_count`,`1000`);let i=await this.search(e,t,n),a=i.link?.find(e=>e.relation===`next`);if(!i.entry?.length&&!a)break;yield kO(i),r=a?.url?new URL(a.url):void 0}}valueSetExpand(e,t){let n=this.fhirUrl(`ValueSet`,`$expand`);return n.search=new URLSearchParams(e).toString(),this.get(n.toString(),t)}getCached(e,t){let n=this.requestCache?.get(this.fhirUrl(e,t).toString())?.value;return n?.isOk()?n.read():void 0}getCachedReference(e){let t=e.reference;if(!t)return;if(t===`system`)return xO;let[n,r]=t.split(`/`);if(n&&r)return this.getCached(n,r)}readResource(e,t,n){if(!t)throw Error(`The "id" parameter cannot be null, undefined, or an empty string.`);return this.get(this.fhirUrl(e,t),n)}readReference(e,t){let n=e.reference;if(!n)return new iO(Promise.reject(Error(`Missing reference`)));if(n===`system`)return new iO(Promise.resolve(xO));let[r,i]=n.split(`/`);return!r||!i?new iO(Promise.reject(Error(`Invalid reference`))):this.readResource(r,i,t)}readCanonical(e,t,n){return Array.isArray(e)?this.searchOne(``,{_type:e.join(`,`),url:t},n):this.searchOne(e,`url=`+t,n)}requestSchema(e,t){if(PS(e))return Promise.resolve();let n=e+`-requestSchema`,r=this.getCacheEntry(n,void 0);if(r)return r.value;let i=new iO((async()=>{let t=`{
|
|
57
57
|
StructureDefinitionList(_filter: "name eq ${e}") {
|
|
58
58
|
resourceType,
|
|
59
59
|
name,
|
|
@@ -95,7 +95,7 @@ ${o?`${s(`light`)}{${o}}`:``}`}function Mr({color:e,theme:t,autoContrast:n}){ret
|
|
|
95
95
|
}
|
|
96
96
|
}`.replaceAll(/\s+/g,` `),n=await this.graphql(t);jS(n.data.StructureDefinitionList);for(let e of n.data.SearchParameterList)$w(e)})());return this.setCacheEntry(n,i,t),i}requestProfileSchema(e,t){if(!t?.expandProfile&&LS(e))return Promise.resolve();let n=e+`-requestSchema`+(t?.expandProfile?`-nested`:``),r=this.getCacheEntry(n,void 0);if(r)return r.value;let i=new iO((async()=>{if(t?.expandProfile){let t=this.fhirUrl(`StructureDefinition`,`$expand-profile`);t.search=new URLSearchParams({url:e}).toString(),jS(await this.post(t.toString(),{}))}else{let t=await this.searchOne(`StructureDefinition`,{url:e,_sort:`-_lastUpdated`});if(!t){console.warn(`No StructureDefinition found for ${e}!`);return}MS(t)}})());return this.setCacheEntry(n,i,t),i}readHistory(e,t,n,r){let i=this.fhirUrl(e,t,`_history`);return n?.count&&i.searchParams.set(`_count`,n.count.toString()),n?.offset&&i.searchParams.set(`_offset`,n.offset.toString()),this.get(i.toString(),r)}readVersion(e,t,n,r){return this.get(this.fhirUrl(e,t,`_history`,n),r)}readPatientEverything(e,t){return this.getBundle(this.fhirUrl(`Patient`,e,`$everything`),t)}readPatientSummary(e,t){return this.getBundle(this.fhirUrl(`Patient`,e,`$summary`),t)}async createResource(e,t){if(!e.resourceType)throw Error(`Missing resourceType`);this.invalidateSearches(e.resourceType);let n=await this.post(this.fhirUrl(e.resourceType),e,void 0,t);return this.dispatchResourceModified({resourceType:e.resourceType,operation:`create`,id:n?.id,resource:n}),n}async createResourceIfNoneExist(e,t,n={}){let r=this.fhirUrl(e.resourceType);this.setRequestHeader(n,`If-None-Exist`,t);let i=await this.post(r,e,void 0,n);return this.cacheResource(i,n),this.invalidateUrl(this.fhirUrl(e.resourceType,e.id,`_history`)),this.invalidateSearches(e.resourceType),this.dispatchResourceModified({resourceType:e.resourceType,operation:`create`,id:i?.id,resource:i}),i}async upsertResource(e,t,n){let r=this.fhirSearchUrl(e.resourceType,t),i=await this.put(r,e,void 0,n),a=i!==void 0;return i||=e,this.cacheResource(i,n),this.invalidateUrl(this.fhirUrl(e.resourceType,e.id,`_history`)),this.invalidateSearches(e.resourceType),a&&this.dispatchResourceModified({resourceType:e.resourceType,operation:`update`,id:i.id,resource:i}),i}async createAttachment(e,t,n,r,i){let a=jO(e,t,n,r);if(a.contentType===wD.XML){let e=a.data,t;t=e instanceof Blob?await new Promise((t,n)=>{let r=new FileReader;r.onload=()=>{if(!r.result){n(Error(`Failed to load file`));return}t(r.result)},r.readAsText(e,`utf-8`)}):ArrayBuffer.isView(e)?new TextDecoder().decode(e):e,t.includes(`<ClinicalDocument`)&&t.includes(`urn:hl7-org:v3`)&&(a={...a,contentType:wD.CDA_XML})}let o=i??(typeof t==`object`?t:{}),s=await this.createBinary(a,o);return{contentType:a.contentType,url:s.url,title:a.filename}}createBinary(e,t,n,r,i){let a=jO(e,t,n,r),o=i??(typeof t==`object`?t:{}),{data:s,contentType:c,filename:l,securityContext:u,onProgress:d}=a,f=this.fhirUrl(`Binary`);return l&&f.searchParams.set(`_filename`,l),u?.reference&&this.setRequestHeader(o,`X-Security-Context`,u.reference),d?this.uploadwithProgress(f,s,c,d,o):this.post(f,s,c,o)}uploadwithProgress(e,t,n,r,i){return new Promise((a,o)=>{let s=new XMLHttpRequest,c=()=>s.abort();i?.signal?.addEventListener(`abort`,c);let l=e=>{i?.signal?.removeEventListener(`abort`,c),e instanceof Error?o(e):a(e)};if(s.responseType=`json`,s.onabort=()=>l(new DOMException(`Request aborted`,`AbortError`)),s.onerror=()=>l(Error(`Request error`)),r&&(s.upload.onprogress=e=>r(e),s.upload.onload=e=>r(e)),s.onload=()=>{s.status>=200&&s.status<300?l(s.response):l(new vS(yS(s.response||s.statusText)))},s.open(`POST`,e),s.withCredentials=!0,s.setRequestHeader(`Authorization`,`Bearer `+this.accessToken),s.setRequestHeader(`Cache-Control`,`no-cache, no-store, max-age=0`),s.setRequestHeader(`Content-Type`,n),this.options.extendedMode!==!1&&s.setRequestHeader(`X-Medplum`,`extended`),i?.headers){let e=i.headers;for(let[t,n]of Object.entries(e))s.setRequestHeader(t,n)}s.send(t)})}async createPdf(e,t,n,r){if(!this.createPdfImpl)throw Error(`PDF creation not enabled`);let i=NO(e,t,n,r),a=typeof t==`object`?t:{},{docDefinition:o,tableLayouts:s,fonts:c,...l}=i,u=await this.createPdfImpl(o,s,c),d={...l,data:u,contentType:`application/pdf`};return this.createBinary(d,a)}createComment(e,t,n){let r=this.getProfile(),i,a;return e.resourceType===`Encounter`&&(i=DC(e),a=e.subject),e.resourceType===`ServiceRequest`&&(i=e.encounter,a=e.subject),e.resourceType===`Patient`&&(a=DC(e)),this.createResource({resourceType:`Communication`,status:`completed`,basedOn:[DC(e)],encounter:i,subject:a,sender:r?DC(r):void 0,sent:new Date().toISOString(),payload:[{contentString:t}]},n)}async updateResource(e,t){if(!e.resourceType)throw Error(`Missing resourceType`);if(!e.id)throw Error(`Missing id`);let n=await this.put(this.fhirUrl(e.resourceType,e.id),e,void 0,t),r=n!==void 0;return n||=e,this.cacheResource(n,t),this.invalidateUrl(this.fhirUrl(e.resourceType,e.id,`_history`)),this.invalidateSearches(e.resourceType),r&&this.dispatchResourceModified({resourceType:e.resourceType,operation:`update`,id:n.id,resource:n}),n}async patchResource(e,t,n,r){let i=await this.patch(this.fhirUrl(e,t),n,r);return this.cacheResource(i,r),this.invalidateUrl(this.fhirUrl(e,t,`_history`)),this.invalidateSearches(e),this.dispatchResourceModified({resourceType:e,operation:`patch`,id:t,resource:i}),i}async deleteResource(e,t,n){this.deleteCacheEntry(this.fhirUrl(e,t).toString()),this.invalidateSearches(e);let r=await this.delete(this.fhirUrl(e,t),n);return this.dispatchResourceModified({resourceType:e,operation:`delete`,id:t}),r}validateResource(e,t){return this.post(this.fhirUrl(e.resourceType,`$validate`),e,void 0,t)}executeBot(e,t,n,r){let i;if(typeof e==`string`){let t=e;i=this.fhirUrl(`Bot`,t,`$execute`)}else{let t=e;i=this.fhirUrl(`Bot`,`$execute`),i.searchParams.set(`identifier`,t.system+`|`+t.value)}return this.post(i,t,n,r)}executeBatch(e,t){return this.post(this.fhirBaseUrl,e,void 0,t)}sendEmail(e,t){return this.post(`email/v1/send`,e,wD.JSON,t)}graphql(e,t,n,r){return this.post(this.fhirUrl(`$graphql`),{query:e,operationName:t,variables:n},wD.JSON,r)}readResourceGraph(e,t,n,r){return this.get(`${this.fhirUrl(e,t)}/$graph?graph=${n}`,r)}pushToAgent(e,t,n,r,i,a){let{waitTimeout:o,returnAck:s,...c}=a??{};return this.post(this.fhirUrl(`Agent`,kC(e),`$push`),{destination:typeof t==`string`?t:OC(t),body:n,contentType:r,waitForResponse:i,...o===void 0?void 0:{waitTimeout:o},...s===void 0?void 0:{returnAck:s}},wD.FHIR_JSON,c)}getCdsServices(e){return this.get(this.cdsServicesUrl,e)}callCdsService(e,t,n){return this.post(Sw(this.cdsServicesUrl,e),t,wD.JSON,n)}getActiveLogin(){return this.storage.getObject(`activeLogin`)}async setActiveLogin(e){(!this.sessionDetails?.profile||OC(this.sessionDetails.profile)!==e.profile?.reference)&&this.clearActiveLogin(),this.setAccessToken(e.accessToken,e.refreshToken),this.storage.setObject(`activeLogin`,e),this.addLogin(e),this.refreshPromise=void 0,await this.refreshProfile()}getAccessToken(){return this.accessToken}isAuthenticated(e){return this.accessTokenExpires!==void 0&&Date.now()<this.accessTokenExpires-(e??this.refreshGracePeriod)}setAccessToken(e,t){this.accessToken=e,this.refreshToken=t,this.accessTokenExpires=nO(e),this.medplumServer=tO(e)}getLogins(){return this.storage.getObject(`logins`)??[]}addLogin(e){let t=this.getLogins().filter(t=>t.profile?.reference!==e.profile?.reference);t.push(e),this.storage.setObject(`logins`,t)}async refreshProfile(){if(this.medplumServer)return this.profilePromise=new Promise((e,t)=>{this.get(`auth/me`,{cache:`no-cache`}).then(t=>{this.profilePromise=void 0;let n=this.sessionDetails?.profile?.id!==t.profile.id;this.sessionDetails=t,this.syncStoredLoginProject(),n&&this.dispatchEvent({type:`change`}),e(t.profile),this.dispatchEvent({type:`profileRefreshed`})}).catch(t)}),this.dispatchEvent({type:`profileRefreshing`}),this.profilePromise}syncStoredLoginProject(){let e=this.getActiveLogin(),t=this.sessionDetails?.project?.name;if(!e||!t||e.project.display===t)return;let n={...e,project:{...e.project,display:t}};this.storage.setObject(`activeLogin`,n),this.addLogin(n)}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(e,t={}){return(await this.downloadResponse(e,t)).blob()}async downloadResponse(e,t={}){this.refreshPromise&&await this.refreshPromise;let n=e.toString();n.startsWith(bO)&&(e=this.fhirUrl(n));let r=t.headers;return r||(r={},t.headers=r),r.Accept||(r.Accept=`*/*`),this.addFetchOptionsDefaults(t,e.toString()),this.fetchWithRetry(e.toString(),t)}async createMedia(e,t){let{additionalFields:n,...r}=e,i=await this.createResource({resourceType:`Media`,status:`preparation`,content:{contentType:e.contentType},...n});r.securityContext||=DC(i);let a=await this.createAttachment(r,t);return this.updateResource({...i,status:`completed`,content:a})}async uploadMedia(e,t,n,r,i){return this.createMedia({data:e,contentType:t,filename:n,additionalFields:r},i)}async createDocumentReference(e,t){let{additionalFields:n,...r}=e,i=await this.createResource({resourceType:`DocumentReference`,status:`current`,content:[{attachment:{contentType:e.contentType}}],...n});r.securityContext||=DC(i);let a=await this.createAttachment(r,t);return this.updateResource({...i,content:[{attachment:a}]})}async bulkExport(e=``,t,n,r){let i=e&&`${e}/`,a=this.fhirUrl(`${i}$export`);return t&&a.searchParams.set(`_type`,t),n&&a.searchParams.set(`_since`,n),this.startAsyncRequest(a.toString(),r)}async startAsyncRequest(e,t={}){this.addFetchOptionsDefaults(t,e);let n=t.headers;return n.Prefer=`respond-async`,t.method=`POST`,this.request(e,t)}async wrappedFetch(e,t){return await this.refreshIfExpired(),this.addFetchOptionsDefaults(t,e),this.fetchWithRetry(e,t)}get keyValue(){return this.keyValueClient||=new rO(this),this.keyValueClient}getBundle(e,t){return new iO((async()=>{let n=await this.get(e,t);for(let e of n.entry??Dw)this.cacheResource(e.resource,t);return n})())}isCacheEnabled(e){return!!this.requestCache&&!this.getRequestHeader(e,`x-medplum-on-behalf-of`)}getCacheEntry(e,t){if(!this.isCacheEnabled(t)||t?.cache===`no-cache`||t?.cache===`reload`)return;let n=this.requestCache.get(e);if(!(!n||n.requestTime+this.cacheTime<Date.now()))return n}setCacheEntry(e,t,n){this.isCacheEnabled(n)&&!n?.signal?.aborted&&(this.requestCache.set(e,{requestTime:Date.now(),value:t}),n?.signal&&n.signal.addEventListener(`abort`,()=>{this.requestCache.delete(e)}))}cacheResource(e,t){e?.id&&!e.meta?.tag?.some(e=>e.code===`SUBSETTED`)&&this.setCacheEntry(this.fhirUrl(e.resourceType,e.id).toString(),new iO(Promise.resolve(e)),t)}deleteCacheEntry(e){this.requestCache&&this.requestCache.delete(e)}dispatchResourceModified(e){this.listenerCount(`resourceModified`)>0&&this.dispatchEvent({type:`resourceModified`,payload:e})}async request(e,t={},n={}){let r=await this.wrappedFetch(e,t);if(r.status===401)return this.handleUnauthenticated(e,t,n);if(r.status===204||r.status===304)return;let i=r.headers.get(`content-type`)?.includes(`json`);if(r.status===404&&!i)throw new vS(aS);let a=await this.parseBody(r,i);if(r.status===200&&t.followRedirectOnOk||r.status===201&&t.followRedirectOnCreated){let e=await OO(r,a);if(e)return this.request(e,{...t,method:`GET`,body:void 0})}if(r.status===202&&t.pollStatusOnAccepted){let e=await OO(r,a)??n.statusUrl;if(e)return this.pollStatus(e,t,n)}if(r.status>=400)throw new vS(yS(a));return a}async parseBody(e,t){let n;if(e.headers.get(`content-length`)!==`0`){if(t)try{n=await e.json()}catch(t){throw console.error(`Error parsing response`,e.status,t),t}else n=await e.text();return n}}async fetchWithRetry(e,t){e.startsWith(`http`)||(e=Sw(this.baseUrl,e));let n=t?.maxRetries??this.maxRetries;for(let r=0;r<=n;r++)try{this.logLevel!==`none`&&this.logRequest(e,t);let i=await this.fetch(e,t);if(this.logLevel!==`none`&&this.logResponse(i),this.setCurrentRateLimit(i),r>=n||!PO(i))return i;let a=this.getRetryDelay(r);if(a>(t.maxRetryTime??this.maxRetryTime))return i;await hw(a,{signal:t.signal})}catch(e){if(e.message===`Failed to fetch`&&r===0&&this.dispatchEvent({type:`offline`}),e.name===`AbortError`||r===n)throw e}throw Error(`Unreachable`)}logRequest(e,t){if(console.log(`> ${t.method} ${e}`),this.logLevel===`verbose`&&t.headers){let e=t.headers;for(let t of yw(Object.keys(e)))console.log(`> ${t}: ${e[t]}`)}}logResponse(e){console.log(`< ${e.status} ${e.statusText}`),this.logLevel===`verbose`&&e.headers&&e.headers.forEach((e,t)=>console.log(`< ${t}: ${e}`))}setCurrentRateLimit(e){if(!e?.headers||typeof e.headers.get!=`function`)return;let t=e.headers.get(`ratelimit`);t&&(this.currentRateLimits=t)}rateLimitStatus(){if(!this.currentRateLimits)return[];let e=this.currentRateLimits;return e.split(`,`).map(t=>{let n=t.split(`;`).map(e=>e.trim());if(n.length!==3)throw Error(`Could not parse RateLimit header: `+e);let r=n[0].substring(1,n[0].length-1),i=n.find(e=>e.startsWith(`r=`))?.substring(2),a=i?Number.parseInt(i,10):NaN,o=n.find(e=>e.startsWith(`t=`))?.substring(2),s=o?Number.parseInt(o,10):NaN;if(!r||Number.isNaN(a)||Number.isNaN(s))throw Error(`Could not parse RateLimit header: `+e);return{name:r,remainingUnits:a,secondsUntilReset:s,resetsAfter:Math.ceil((Date.now()+1e3*s)/1e3)}})}getRetryDelay(e){let t=this.rateLimitStatus(),n=500*1.5**e;for(let e of t)e.remainingUnits||(n=Math.max(n,e.secondsUntilReset*1e3));return n}async pollStatus(e,t,n){let r={...t,method:`GET`,body:void 0,redirect:`follow`};return n.pollCount===void 0?(t.headers&&typeof t.headers==`object`&&`Prefer`in t.headers&&(r.headers={...t.headers},delete r.headers.Prefer),n.statusUrl=e,n.pollCount=1):(await hw(t.pollStatusPeriod??1e3,{signal:t.signal}),n.pollCount++),this.request(e,r,n)}async executeAutoBatch(){if(this.autoBatchQueue===void 0)return;let e=[...this.autoBatchQueue];if(this.autoBatchQueue.length=0,this.autoBatchTimerId=void 0,e.length===1){let t=e[0];try{t.options.method=t.method,t.resolve(await this.request(Sw(this.fhirBaseUrl,t.url),t.options))}catch(e){t.reject(new vS(yS(e)))}return}let t={resourceType:`Bundle`,type:`batch`,entry:e.map(e=>({request:{method:e.method,url:e.url},resource:e.options.body?JSON.parse(e.options.body):void 0}))},n=await this.post(this.fhirBaseUrl,t);for(let t=0;t<e.length;t++){let r=e[t],i=n.entry?.[t];i?.response?.outcome&&!hS(i.response.outcome)?r.reject(new vS(i.response.outcome)):r.resolve(i?.resource)}}isInternalUrl(e){if(!e.startsWith(`http://`)&&!e.startsWith(`https://`))return!0;try{let t=new URL(e);return e.startsWith(this.baseUrl)||e.startsWith(this.fhirBaseUrl)||t.origin===new URL(this.baseUrl).origin&&bw(t.pathname).startsWith(bw(new URL(this.baseUrl).pathname))}catch{return!1}}addFetchOptionsDefaults(e,t){Object.entries(this.defaultHeaders).forEach(([t,n])=>{this.setRequestHeader(e,t,n)}),this.setRequestHeader(e,`Accept`,mO,!0),this.options.extendedMode!==!1&&this.setRequestHeader(e,`X-Medplum`,`extended`),e.body&&this.setRequestHeader(e,`Content-Type`,wD.FHIR_JSON,!0),this.isInternalUrl(t)&&(this.accessToken?this.setRequestHeader(e,`Authorization`,`Bearer `+this.accessToken):this.basicAuth&&this.setRequestHeader(e,`Authorization`,`Basic `+this.basicAuth),e.credentials||=`include`)}setRequestContentType(e,t){this.setRequestHeader(e,`Content-Type`,t)}getRequestHeader(e,t){let n=e?.headers;if(n){if(Array.isArray(n)){let e=n.find(([e])=>e.toLowerCase()===t.toLowerCase());return e?e[1]:void 0}if(n instanceof Headers)return n.get(t)??void 0;if(nw(n))return n[t]??void 0}}setRequestHeader(e,t,n,r=!1){let i=e.headers;i?Array.isArray(i)?(!r||!i.some(([e])=>e.toLowerCase()===t.toLowerCase()))&&i.push([t,n]):i instanceof Headers?(!r||!i.has(t))&&i.set(t,n):nw(i)&&(!r||!i[t])&&(i[t]=n):e.headers={[t]:n}}setRequestBody(e,t){typeof t==`string`||typeof Blob<`u`&&(t instanceof Blob||t?.constructor.name===`Blob`)||typeof File<`u`&&(t instanceof File||t?.constructor.name===`File`)||typeof Uint8Array<`u`&&(t instanceof Uint8Array||t?.constructor.name===`Uint8Array`)?e.body=t:typeof t==`object`&&t&&(typeof t.getReader==`function`||typeof t.pipe==`function`&&typeof t.on==`function`)?(e.body=t,e.duplex=`half`):t&&(e.body=JSON.stringify(t))}async handleUnauthenticated(e,t,n){let r=n.authAttempt??0,i=r+1<SO?this.refresh(void 0,!0):void 0;if(i)return await i,this.request(e,t,{...n,authAttempt:r+1});throw this.clear(),this.onUnauthenticated?.(),new vS(oS)}async startPkce(){let e=mD();this.storage.setString(`pkceState`,e);let t=mD().slice(0,128);this.storage.setString(`codeVerifier`,t);try{return{codeChallengeMethod:`S256`,codeChallenge:lw(await hD(t)).replaceAll(`+`,`-`).replaceAll(`/`,`_`).replaceAll(`=`,``)}}catch(e){return console.warn(`Failed to hash code verifier. Falling back to 'plain' code challenge method`,e),{codeChallengeMethod:`plain`,codeChallenge:t}}}async requestAuthorization(e){let t=await this.ensureCodeChallenge(e??{}),n=new URL(this.authorizeUrl);n.searchParams.set(`response_type`,`code`),n.searchParams.set(`state`,this.storage.getString(`pkceState`)),n.searchParams.set(`client_id`,t.clientId??this.clientId),n.searchParams.set(`redirect_uri`,t.redirectUri??uD.getOrigin()),n.searchParams.set(`code_challenge_method`,t.codeChallengeMethod),n.searchParams.set(`code_challenge`,t.codeChallenge),n.searchParams.set(`scope`,t.scope??`openid profile`),uD.assign(n.toString())}processCode(e,t){let n={grant_type:CO.AuthorizationCode,code:e,client_id:t?.clientId??this.clientId??``,redirect_uri:t?.redirectUri??uD.getOrigin()},r=this.storage.getString(`codeVerifier`);return r&&(n.code_verifier=r),this.fetchTokens(n)}refreshIfExpired(e){return!this.refreshPromise&&this.accessTokenExpires!==void 0&&!this.isAuthenticated(e)&&this.refresh(e),this.refreshPromise??Promise.resolve()}refresh(e,t=!1){if(this.refreshPromise)return this.refreshPromise;if(this.refreshToken||this.clientId&&this.clientSecret)return this.refreshPromise=this.runRefreshWithLock(e,t),this.refreshPromise}async runRefreshWithLock(e,t=!1){let n=()=>{let n=this.accessToken,r=this.getActiveLogin();r?.accessToken&&r.accessToken!==this.accessToken&&this.setAccessToken(r.accessToken,r.refreshToken);let i=this.accessToken!==n;return this.isAuthenticated(e)&&(!t||i)?Promise.resolve(this.getProfile()):this.refreshToken?this.fetchTokens({grant_type:CO.RefreshToken,client_id:this.clientId??``,refresh_token:this.refreshToken}):this.clientId&&this.clientSecret?this.startClientLogin(this.clientId,this.clientSecret):Promise.resolve(void 0)},r=typeof navigator<`u`?navigator.locks:void 0;if(!r?.request)return n();let i=`medplum-refresh:${this.storage.makeKey(`activeLogin`)}`;return r.request(i,n)}async startClientLogin(e,t){return this.clientId=e,this.clientSecret=t,this.fetchTokens({grant_type:CO.ClientCredentials,client_id:e,client_secret:t})}async startJwtBearerLogin(e,t,n){return this.clientId=e,this.fetchTokens({grant_type:CO.JwtBearer,client_id:e,assertion:t,scope:n})}async startJwtAssertionLogin(e){return this.fetchTokens({grant_type:CO.ClientCredentials,client_assertion_type:TO.JwtBearer,client_assertion:e})}setBasicAuth(e,t){this.clientId=e,this.clientSecret=t,this.basicAuth=fD(e+`:`+t)}setLogLevel(e){this.logLevel=e,this.options.verbose=e===`verbose`}getLogLevel(){return this.logLevel}setVerbose(e){this.logLevel=e?`verbose`:`none`,this.options.verbose=e}async fhircastSubscribe(e,t){if(typeof e!=`string`||e===``)throw new vS(dS(`Invalid topic provided. Topic must be a valid string.`));if(!(typeof t==`object`&&Array.isArray(t)&&t.length>0))throw new vS(dS(`Invalid events provided. Events must be an array of event names containing at least one event.`));let n={channelType:`websocket`,mode:`subscribe`,topic:e,events:t},r=(await this.post(this.fhircastHubUrl,GD(n),wD.FORM_URL_ENCODED))[`hub.channel.endpoint`];if(!r)throw Error(`Invalid response!`);return n.endpoint=r,n}async fhircastUnsubscribe(e){if(!KD(e))throw new vS(dS(`Invalid topic or subscriptionRequest. SubscriptionRequest must be an object.`));if(!(e.endpoint&&typeof e.endpoint==`string`&&e.endpoint.startsWith(`ws`)))throw new vS(dS(`Provided subscription request must have an endpoint in order to unsubscribe.`));e.mode=`unsubscribe`,await this.post(this.fhircastHubUrl,GD(e),wD.FORM_URL_ENCODED)}fhircastConnect(e,t){return new ZD(e,t)}async fhircastPublish(e,t,n,r){return BD(t)?this.post(this.fhircastHubUrl,XD(e,t,n,r),wD.JSON):(VD(t),this.post(this.fhircastHubUrl,XD(e,t,n),wD.JSON))}async fhircastGetContext(e){return this.get(`${this.fhircastHubUrl}/${e}`,{cache:`no-cache`})}async invite(e,t){return this.post(`admin/projects/`+e+`/invite`,t)}async handleTokenError(e){try{let t=await e.json();throw mS(t)?new vS(t):t.error_description?new vS(uS(t.error_description)):Error(JSON.stringify(t))}catch(e){throw e instanceof vS?(e.message=`Failed to fetch tokens: ${e.message}`,e):new vS(uS(`Failed to fetch tokens`),{cause:e})}}async fetchTokens(e){let t=new URLSearchParams(e),n={...this.defaultHeaders,"Content-Type":wD.FORM_URL_ENCODED};this.basicAuth&&(n.Authorization=`Basic ${this.basicAuth}`),this.credentialsInHeader&&(t.delete(`client_id`),t.delete(`client_secret`),!this.basicAuth&&e.client_id&&e.client_secret&&(n.Authorization=`Basic ${fD(e.client_id+`:`+e.client_secret)}`));let r={method:`POST`,headers:n,body:t.toString(),credentials:`include`},i;try{i=await this.fetchWithRetry(this.tokenUrl,r)}catch(e){throw this.refreshPromise=void 0,e}i.ok||(this.clearActiveLogin(),this.onUnauthenticated?.(),await this.handleTokenError(i));let a=await i.json();return await this.verifyTokens(a),this.getProfile()}async verifyTokens(e){let t=e.access_token;if($D(t)){let e=eO(t);if(Date.now()>=e.exp*1e3)throw this.clearActiveLogin(),new vS(sS);if(e.cid){if(e.cid!==this.clientId)throw this.clearActiveLogin(),new vS(cS)}else if(this.clientId&&e.client_id!==this.clientId)throw this.clearActiveLogin(),new vS(cS)}return this.setActiveLogin({accessToken:t,refreshToken:e.refresh_token,project:e.project,profile:e.profile})}checkSessionDetailsMatchLogin(e){return this.sessionDetails&&e?e.profile?.reference?.endsWith(this.sessionDetails.profile.id)??!1:!0}setupStorageListener(){try{window.addEventListener(`storage`,e=>{if(e.key===null)uD.reload();else if(e.key===this.storage.makeKey(`activeLogin`)){let t=e.oldValue?JSON.parse(e.oldValue):void 0,n=e.newValue?JSON.parse(e.newValue):void 0;t?.profile.reference!==n?.profile.reference||!this.checkSessionDetailsMatchLogin(n)?uD.reload():n?this.setAccessToken(n.accessToken,n.refreshToken):this.clear()}})}catch{}}getSubscriptionManager(){return this.subscriptionManager||=new dO(this,Cw(this.baseUrl,`/ws/subscriptions-r4`)),this.subscriptionManager}subscribeToCriteria(e,t){return this.getSubscriptionManager().addCriteria(e,t)}unsubscribeFromCriteria(e,t){this.subscriptionManager&&this.subscriptionManager.removeCriteria(e,t)}getMasterSubscriptionEmitter(){return this.getSubscriptionManager().getMasterEmitter()}};function DO(){if(!globalThis.fetch)throw Error(`Fetch not available in this environment`);return globalThis.fetch.bind(globalThis)}async function OO(e,t){let n=e.headers.get(`content-location`);if(n)return n;let r=e.headers.get(`location`);if(r)return r;if(mS(t)&&t.issue?.[0]?.diagnostics)return t.issue[0].diagnostics}function kO(e){let t=e.entry?.map(e=>e.resource)??[];return Object.assign(t,{bundle:e})}function AO(e){return nw(e)&&`data`in e&&`contentType`in e}function jO(e,t,n,r){return AO(e)?e:{data:e,filename:t,contentType:n,onProgress:r}}function MO(e){return nw(e)&&`docDefinition`in e}function NO(e,t,n,r){return MO(e)?e:{docDefinition:e,filename:t,tableLayouts:n,fonts:r}}function PO(e){return e.status===429||e.status>=500}function FO({parentContext:e,path:t,elements:n,profileUrl:r,debugMode:i,accessPolicyResource:a}){if(t===e?.path)return;i??=e?.debugMode??!1,a??=e?.accessPolicyResource;let o=IO(t,n,e,!!i),s=gw(t,`.`,2)[1];o=LO(o,a,s),o=RO(o,a,s);let c=Object.create(null);for(let[e,n]of Object.entries(o))c[t+`.`+e]=n;let l;if(e&&!e.isDefaultContext)l=e.getExtendedProps;else{let e=Object.create(null);l=t=>{let n=gw(t,`.`,2)[1];if(n){if(!e[n]){let t=zO(n,a?.hiddenFields);e[n]={hidden:t,readonly:t||zO(n,a?.readonlyFields)}}return e[n]}}}return{path:t,elements:o,elementsByPath:c,profileUrl:r??e?.profileUrl,debugMode:i,getExtendedProps:l,accessPolicyResource:a}}function IO(e,t,n,r){let i=Object.create(null);if(n)for(let[t,r]of Object.entries(n.elementsByPath)){let n=pw(e,t);n!==void 0&&(i[n]=r)}let a=!1;if(t)for(let[e,n]of Object.entries(t))e in i||(i[e]=n,a=!0);return r&&console.assert(a,`Unnecessary ElementsContext; not using any newly provided elements`),i}function LO(e,t,n){if(!t?.hiddenFields?.length)return e;let r=n?n+`.`:``;return Object.fromEntries(Object.entries(e).filter(([e])=>!zO(r+e,t.hiddenFields)))}function RO(e,t,n){if(!t?.readonlyFields?.length)return e;let r=Object.create(null),i=n?n+`.`:``;for(let[n,a]of Object.entries(e))r[n]=zO(i+n,t.readonlyFields)?{...a,readonly:!0}:a;return r}function zO(e,t){if(!t?.length)return!1;let n=e.split(`.`);for(let e=1;e<=n.length;e++){let r=n.slice(0,e).join(`.`);if(t.includes(r))return!0}return!1}function BO(e){return e.type!==void 0&&e.type.length>0}function VO(e,t,n,r){let i=qS(e,t.path,{profileUrl:r});if(i){let e=n.typeSchema?.elements??n.elements;return i.some(r=>ZS(r,t,n,e))??!1}return console.assert(!1,`getNestedProperty[%s] in isDiscriminatorComponentMatch missed`,t.path),!1}function HO(e,t,n,r){if(e)for(let i of t){let t={value:e,type:i.typeSchema?.type??i.type?.[0].code};if(n.every(e=>VO(t,e,i,i.typeSchema?.url??r)))return i.name}}var UO=class{rootSchema;visitor;elementsContextStack;sliceAllowList;constructor(e,t,n){if(e.type===void 0)throw Error(`schema must include a type`);this.rootSchema=e;let r=FO({parentContext:void 0,path:this.rootSchema.type,elements:n??this.rootSchema.elements,profileUrl:this.rootSchema.name===this.rootSchema.type?void 0:this.rootSchema.url});if(r===void 0)throw Error(`Could not create root elements context`);this.elementsContextStack=[r],this.visitor=t}get elementsContext(){return this.elementsContextStack.at(-1)}crawlElement(e,t,n){this.visitor.onEnterSchema&&this.visitor.onEnterSchema(this.rootSchema);let r=Object.fromEntries(Object.entries(this.elementsContext.elements).filter(([e])=>e.startsWith(t)));this.crawlElementsImpl(r,n),this.visitor.onExitSchema&&this.visitor.onExitSchema(this.rootSchema)}crawlSlice(e,t,n){let r=this.prepareSlices(n.slices,n);if(!KC(r.slices))throw Error(`cannot crawl slice ${t.name} since it has no type information`);this.visitor.onEnterSchema&&this.visitor.onEnterSchema(this.rootSchema),this.sliceAllowList=[t],this.crawlSliceImpl(r.slices[0],t.path,r),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(e,t){let n=WO(e);for(let e of n)this.crawlElementNode(e,t)}crawlElementNode(e,t){let n=t+`.`+e.key;this.visitor.onEnterElement&&this.visitor.onEnterElement(n,e.element,this.elementsContext);for(let n of e.children)this.crawlElementNode(n,t);KC(e.element?.slicing?.slices)&&this.crawlSlicingImpl(e.element.slicing,n),this.visitor.onExitElement&&this.visitor.onExitElement(n,e.element,this.elementsContext)}prepareSlices(e,t){let n=[];for(let t of e){if(!BO(t))continue;let e=t.type.find(e=>KC(e.profile))?.profile?.[0];if(KC(e)){let n=RS(e);n&&(t.typeSchema=n)}n.push(t)}return{...t,slices:n}}crawlSlicingImpl(e,t){let n=this.prepareSlices(e.slices,e);for(let e of n.slices)(this.sliceAllowList===void 0||this.sliceAllowList.includes(e))&&this.crawlSliceImpl(e,t,n)}crawlSliceImpl(e,t,n){let r=e.typeSchema;r&&this.visitor.onEnterSchema&&this.visitor.onEnterSchema(r),this.visitor.onEnterSlice&&this.visitor.onEnterSlice(t,e,n);let i,a=r?.elements??e.elements;KC(a)&&(i=FO({path:t,parentContext:this.elementsContext,elements:a})),i&&this.elementsContextStack.push(i),this.crawlElementsImpl(a,t),i&&this.elementsContextStack.pop(),this.visitor.onExitSlice&&this.visitor.onExitSlice(t,e,n),r&&this.visitor.onExitSchema&&this.visitor.onExitSchema(r)}};function WO(e){let t=[];function n(e,t){return t.startsWith(e+`.`)}function r(e,t){for(let i of e.children)if(n(i.key,t.key)){r(i,t);return}e.children.push(t)}let i=Object.entries(e);i.sort((e,t)=>e[0].localeCompare(t[0]));for(let[e,a]of i){let i={key:e,element:a,children:[]},o=!1;for(let a of t)if(n(a.key,e)){r(a,i),o=!0;break}o||t.push(i)}return t}var GO=`__sliceName`;function KO(e,t){let n=new JO(e,e.resourceType,`resource`);return new UO(t,n).crawlResource(),n.getDefaultValue()}function qO(e,t,n){for(let[r,i]of Object.entries(t)){if(n===void 0||n===r){QO(e,r,i,t);continue}let a=pw(n,r);a!==void 0&&QO(e,a,i,t)}return e}var JO=class{rootValue;schemaStack;valueStack;constructor(e,t,n){this.schemaStack=[],this.valueStack=[],this.rootValue=ew(e),this.valueStack.splice(0,this.valueStack.length,{type:n,path:t,values:[this.rootValue]})}get schema(){return this.schemaStack.at(-1)}get value(){return this.valueStack.at(-1)}onEnterSchema(e){this.schemaStack.push(e)}onExitSchema(){this.schemaStack.pop()}onEnterElement(e,t,n){let r=this.value.values,i=this.value.path,a=pw(i,e);if(a===void 0)throw Error(`Expected ${e} to be prefixed by ${i}`);let o=[];for(let e of r){if(e===void 0)continue;let r=pw(n.path,i),s=Array.isArray(e)?e:[e];for(let e of s){YO(e,a,t,n.elements,r),QO(e,a,t,n.elements);let i=ZO(e,a,n.elements,r);i!==void 0&&o.push(i)}}this.valueStack.push({type:`element`,path:e,values:o})}onExitElement(e,t,n){if(!this.valueStack.pop())throw Error(`Expected value context to exist when exiting element`);let r=pw(this.value.path,e);if(r===void 0)throw Error(`Expected ${e} to be prefixed by ${this.value.path}`);let i=pw(n.path,this.value.path);for(let e of this.value.values){let a=ZO(e,r,n.elements,i);if(Array.isArray(a))for(let e=a.length-1;e>=0;e--){let t=a[e];KC(t)||a.splice(e,1)}GC(a)&&XO(e,void 0,r,t)}}onEnterSlice(e,t,n){let r=this.value.values,i=[];for(let e of r)if(e!==void 0){let r=Array.isArray(e)?e:[e],a=this.getMatchingSliceValues(r,t,n);i.push(a)}this.valueStack.push({type:`slice`,path:e,values:i})}getMatchingSliceValues(e,t,n){let r=[];for(let i of e)(i[GO]??HO(i,[t],n.discriminator,this.schema.url))===t.name&&r.push(i);for(let n=r.length;n<t.min;n++)if(fw(t.type[0].code)){let t=Object.create(null);r.push(t),e.push(t)}return r}onExitSlice(){let e=this.valueStack.pop();if(!e)throw Error(`Expected value context to exist in onExitSlice`);for(let t of e.values)for(let e=t.length-1;e>=0;e--){let n=t[e];GO in n&&delete n[GO]}}getDefaultValue(){return this.rootValue}};function YO(e,t,n,r,i){let a=ZO(e,t,r,i);n.min>0&&a===void 0&&fw(n.type[0].code)&&(n.isArray?XO(e,[Object.create(null)],t,n):XO(e,Object.create(null),t,n))}function XO(e,t,n,r){if(n.includes(`.`))throw Error(`key cannot be nested`);let i=n;if(n.includes(`[x]`)){let e=r.type[0].code;i=n.replace(`[x]`,dw(e))}t===void 0?delete e[i]:e[i]=t}function ZO(e,t,n,r){let i=t.split(`.`),a=e,o;for(let e=0;e<i.length;e++){let t=i[e];if(t.includes(`[x]`)){let a=n[(r?r+`.`:``)+i.slice(0,e+1).join(`.`)].type[0].code;t=t.replace(`[x]`,dw(a))}if(e===i.length-1){o=Array.isArray(a)?a.map(e=>e[t]):a[t];continue}if(Array.isArray(a))a=a.map(e=>e[t]);else if(nw(a)){if(a[t]===void 0)return;a=a[t]}else return}return o}function QO(e,t,n,r){if(!(n.fixed||n.pattern))return e;if(Array.isArray(e))return e.map(e=>QO(e,t,n,r));e??=Object.create(null);let i=e,a=t.split(`.`),o=i;for(let e=0;e<a.length;e++){let t=a[e];if(t.includes(`[x]`)){let n=r[a.slice(0,e+1).join(`.`)].type[0].code;t=t.replace(`[x]`,dw(n))}if(e===a.length-1){let e=Array.isArray(o)?o:[o];for(let r of e)n.fixed?r[t]??=n.fixed.value:n.pattern&&(r[t]=$O(r[t],n.pattern.value))}else{if(!(t in o)){let n=a.slice(0,e+1).join(`.`);o[t]=r[n].isArray?[Object.create(null)]:Object.create(null)}o=o[t]}}return i}function $O(e,t){if(Array.isArray(t)&&(Array.isArray(e)||e===void 0))return(e?.length??0)>0?e:ew(t);if(nw(t)&&(nw(e)&&!Array.isArray(e)||e===void 0)){let n=ew(e)??Object.create(null);for(let e of Object.keys(t))n[e]=$O(n[e],t[e]);return n}return e}var ek=Object.prototype.hasOwnProperty;function tk(e){return e===void 0?`undefined`:e===null?`null`:Array.isArray(e)?`array`:typeof e}function nk(e,t){let n=[];for(let r in e)ek.call(e,r)&&e[r]!==void 0&&!(ek.call(t,r)&&t[r]!==void 0)&&n.push(r);return n}function rk(e,t){let n=[];for(let r in e)ek.call(e,r)&&e[r]!==void 0&&ek.call(t,r)&&t[r]!==void 0&&n.push(r);return n}function ik(e){return e.op===`add`}function ak(e){return e.op===`remove`}function ok(e,t){return{operations:e.operations.concat(t),cost:e.cost+1}}function sk(e,t,n,r=lk){let i=Math.max(e.length,t.length),a=new Map([[0,{operations:[],cost:0}]]);function o(s,c){let l=s*i+c,u=a.get(l);if(u===void 0){if(s>0&&c>0&&!r(e[s-1],t[c-1],n.add(String(s-1))).length)u=o(s-1,c-1);else{let n=[];if(s>0){let e=o(s-1,c),t={op:`remove`,index:s-1};n.push(ok(e,t))}if(c>0){let e=o(s,c-1),r={op:`add`,index:s-1,value:t[c-1]};n.push(ok(e,r))}if(s>0&&c>0){let r=o(s-1,c-1),i={op:`replace`,index:s-1,original:e[s-1],value:t[c-1]};n.push(ok(r,i))}u=n.sort((e,t)=>e.cost-t.cost)[0]}a.set(l,u)}return u}let s=isNaN(e.length)||e.length<=0?0:e.length,[c]=o(s,isNaN(t.length)||t.length<=0?0:t.length).operations.reduce(([e,t],i)=>{if(ik(i)){let r=i.index+1+t,a=r<s+t?String(r):`-`,o={op:i.op,path:n.add(a).toString(),value:i.value};return[e.concat(o),t+1]}if(ak(i)){let r={op:i.op,path:n.add(String(i.index+t)).toString()};return[e.concat(r),t-1]}{let a=n.add(String(i.index+t)),o=r(i.original,i.value,a);return[e.concat(...o),t]}},[[],0]);return c}function ck(e,t,n,r=lk){let i=[];return nk(e,t).forEach(e=>{i.push({op:`remove`,path:n.add(e).toString()})}),nk(t,e).forEach(e=>{i.push({op:`add`,path:n.add(e).toString(),value:t[e]})}),rk(e,t).forEach(a=>{i.push(...r(e[a],t[a],n.add(a)))}),i}function lk(e,t,n,r=lk){if(e===t)return[];let i=tk(e),a=tk(t);return i===`array`&&a===`array`?sk(e,t,n,r):i===`object`&&a===`object`?ck(e,t,n,r):[{op:`replace`,path:n.toString(),value:t}]}function uk(e){return e.replace(/~1/g,`/`).replace(/~0/g,`~`)}function dk(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}var fk=class e{tokens;constructor(e=[``]){this.tokens=e}static fromJSON(t){let n=t.split(`/`).map(uk);if(n[0]!==``)throw Error(`Invalid JSON Pointer: ${t}`);return new e(n)}toString(){return this.tokens.map(dk).join(`/`)}evaluate(e){let t=null,n=``,r=e;for(let e=1,i=this.tokens.length;e<i;e++){if(t=r,n=this.tokens[e],n===`__proto__`||n===`constructor`||n===`prototype`)throw Error(`Invalid path: `+this.toString());if(t!=null&&(typeof t==`object`||typeof t==`function`)&&!Object.hasOwn(t,n)&&n in t)throw Error(`Invalid inherited key: `+n);r=t?.[n]}return{parent:t,key:n,value:r}}get(e){return this.evaluate(e).value}set(e,t){let n=this.evaluate(e);n.parent&&(n.parent[n.key]=t)}push(e){this.tokens.push(e)}add(t){let n=this.tokens.concat(String(t));return new e(n)}parent(){let t=this.tokens.length>1?this.tokens.slice(0,-1):[``];return new e(t)}};function pk(e){function t(n,r,i){let a=e(n,r,i);return Array.isArray(a)?a:lk(n,r,i,t)}return t}function mk(e,t,n){let r=new fk;return(n?pk(n):lk)(e,t,r)}function hk(e){return e.match(/^\((.+)\)\.identifier$/)?.[1]}function gk(e,t){return new CT(e,new PT(t,new TT(`identifier`)))}var _k={BOOLEAN:`BOOLEAN`,NUMBER:`NUMBER`,QUANTITY:`QUANTITY`,TEXT:`TEXT`,REFERENCE:`REFERENCE`,CANONICAL:`CANONICAL`,DATE:`DATE`,DATETIME:`DATETIME`,PERIOD:`PERIOD`,UUID:`UUID`};function vk(e,t){return mT.types[e]?.searchParamsDetails?.[t.code]??bk(e,t)}function yk(e,t,n){let r=mT.types[e];r||(r={},mT.types[e]=r),r.searchParamsDetails||(r.searchParamsDetails={}),r.searchParamsDetails[t]=n}function bk(e,t){let n=t.code,r=t.expression,i=Tk(e,r),a={elementDefinitions:[],propertyTypes:new Set,array:!1};for(let n of i){let r=Ok(n),i=_w(()=>r.join(`.`));r.length===1&&r[0]instanceof Ix&&r[0].operator!==`.`?a.propertyTypes.add(`boolean`):t.code.endsWith(`:identifier`)?a.propertyTypes.add(`Identifier`):i().endsWith(`extension.value.code`)||i().endsWith(`extension.value.coding.code`)?(a.array=!0,a.propertyTypes.clear(),a.propertyTypes.add(`code`)):xk(a,r,e,1),i().endsWith(`extension.valueDateTime`)&&(a.array=!1,a.propertyTypes.clear(),a.propertyTypes.add(`dateTime`))}let o;if(t.code.endsWith(`:identifier`)){let t=hk(r);if(t===void 0)throw Error(`Unexpected expression for derived identifier search parameter: ${r}`);o=gk(r,Ek(e,t))}else o=Ek(e,r);let s=a.elementDefinitions.map(e=>({...e,type:e.type?.filter(e=>a.propertyTypes.has(e.code))})).filter(e=>e.type&&e.type.length>0),c={type:wk(t,a.propertyTypes),elementDefinitions:s,parsedExpression:o,array:a.array,referenceTargetTypes:kk(t,s)};return yk(e,n,c),c}function xk(e,t,n,r){let i=t[r];if(i instanceof OT){e.propertyTypes.add(i.right.toString());return}if(i instanceof GT){Sk(e,i);return}let a=i.toString(),o=uT(n,a);if(!o)throw Error(`Element definition not found for ${n} ${a}`);let s=!1,c=r+1;c<t.length&&t[c]instanceof KT&&(s=!0,c++);let l=t[c];if(o.isArray&&!s&&(e.array=!0),c===t.length-1){if(l instanceof OT){e.elementDefinitions.push(o),e.propertyTypes.add(l.right.toString());return}if(l instanceof GT&&l.name===`ofType`){e.elementDefinitions.push(o),e.propertyTypes.add(l.args[0].toString());return}}if(c>=t.length){e.elementDefinitions.push(o);for(let t of o.type??Dw)e.propertyTypes.add(t.code);return}for(let n of o.type??Dw){let r=n.code;Ck(r)&&(r=o.type[0].code),xk(e,t,r,c)}}function Sk(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 BT){e.propertyTypes.add(t.args[0].right.toString());return}throw Error(`Unhandled FHIRPath function: ${t.name}`)}function Ck(e){return e===`Element`||e===`BackboneElement`}function wk(e,t){switch(e.type){case`date`:return t.size===1&&t.has(Y.date)?_k.DATE:_k.DATETIME;case`number`:return _k.NUMBER;case`quantity`:return _k.QUANTITY;case`reference`:return t.has(Y.canonical)?_k.CANONICAL:_k.REFERENCE;case`token`:return t.size===1&&t.has(Y.boolean)?_k.BOOLEAN:_k.TEXT;default:return _k.TEXT}}function Tk(e,t){let n=[];return Dk(e,cE(t).child,n),n}function Ek(e,t){let n=[],r=cE(t);if(Dk(e,r.child,n),n.length===0)return r;let i=n[0];for(let e=1;e<n.length;e++)i=new FT(i,n[e]);return new CT(`<original-not-available>`,i)}function Dk(e,t,n){t instanceof FT?(Dk(e,t.left,n),Dk(e,t.right,n)):t.toString().includes(e+`.`)&&n.push(t)}function Ok(e){return e instanceof OT||e instanceof KT?[Ok(e.left),e].flat():e instanceof Ix&&e.operator!==`.`?[e]:e instanceof PT?[Ok(e.left),Ok(e.right)].flat():e instanceof GT&&(e.name===`where`&&!(e.args[0]instanceof BT)||e.name===`last`)?[]:[e]}function kk(e,t){if(e.target?.length===1)return e.target;if(t){let e=new Set;for(let n of t)for(let t of n.type)if(t.code===`Reference`&&t.targetProfile)for(let n of t.targetProfile){let t=n.split(`/`).at(-1);t&&t!==`Resource`&&e.add(t)}if(e.size>0)return Array.from(e)}}var Ak=/^\d+\.\d+\.\d+(-[0-9a-z]{7})?$/,jk=`https://meta.medplum.com/releases`,Mk=new Map;function Nk(e){let t=e;if(!t.tag_name?.startsWith(`v`))throw Error(`Manifest missing valid tag_name starting with a 'v' (eg. v5.1.15)`);let n=t.assets;if(!n?.length)throw Error(`Manifest missing assets list`);for(let e of n){if(!e.browser_download_url)throw Error(`Asset missing browser download URL`);if(!e.name)throw Error(`Asset missing name`)}}async function Pk(e,t,n,r){let i=new URL(`${jk}/${e}`);if(i.searchParams.set(`a`,t),i.searchParams.set(`c`,pO),r)for(let[e,t]of Object.entries(r))i.searchParams.set(e,t);let a=await fetch(i.toString());if(a.status!==200){let e;try{e=(await a.json()).message}catch(e){console.error(`Failed to parse message from body: ${J(e)}`)}throw Error(`Received status code ${a.status} while ${n}`,{cause:Error(e)})}return await a.json()}async function Fk(e,t,n){let r=t?Mk.get(t):void 0;if(!r){let i=await Pk(`${t?`v${t}`:`latest`}.json`,e,`fetching manifest for version '${t??`latest`}'`,n);Nk(i),r=i,Mk.set(r.tag_name.slice(1),r)}return r}function Ik(e){return Ak.test(e)}function Lk(e){if(!Ak.test(e))throw TypeError(`Version is not a valid Medplum semver (eg. 1.1.1 or 1.1.1-a1bc): ${e}`)}function Rk(e,t){let n=e.split(`-`)[0].split(`.`).map(Number),r=t.split(`-`)[0].split(`.`).map(Number);for(let e=0;e<3;e++){let t=(n[e]??0)-(r[e]??0);if(t!==0)return t}return 0}async function zk(e){let t=await Fk(e);if(!t.tag_name.startsWith(`v`))throw Error(`Invalid release name found. Release tag '${t.tag_name}' did not start with 'v'`);let n=t.tag_name.slice(1);return Lk(n),n}async function Bk(e,t){return((await Pk(`all.json`,e,`fetching all release versions`,t)).versions??[]).map(e=>e.version).filter(Ik).toSorted(Rk).reverse()}var Vk=(0,b.createContext)(void 0);function Hk(){return(0,b.useContext)(Vk)}function Z(){return Hk().medplum}function Uk(){return Hk().navigate}function Wk(){return Hk().profile}var Gk=[`change`,`storageInitialized`,`storageInitFailed`,`profileRefreshing`,`profileRefreshed`];function Kk(e){let t=e.medplum,n=e.navigate??qk,[r,i]=(0,b.useState)({profile:t.getProfile(),loading:t.isLoading()});(0,b.useEffect)(()=>{function e(){i(e=>({...e,profile:t.getProfile(),loading:t.isLoading()}))}for(let n of Gk)t.addEventListener(n,e);return()=>{for(let n of Gk)t.removeEventListener(n,e)}},[t]);let a=(0,b.useMemo)(()=>({...r,medplum:t,navigate:n}),[r,t,n]);return(0,L.jsx)(Vk.Provider,{value:a,children:e.children})}function qk(e){window.location.assign(e)}var Jk=new Map,Yk=e=>(0,b.useMemo)(()=>{if(!e)return;let t=e.split(`?`)[0];if(!t)return e;let n;try{n=new URLSearchParams(new URL(e).search)}catch{return e}if(!n.has(`Key-Pair-Id`)||!n.has(`Signature`))return e;let r=n.get(`Expires`);if(!r||r.length>13)return e;let i=Jk.get(t);if(i){let e=new URLSearchParams(new URL(i).search).get(`Expires`);if(e&&Number.parseInt(e,10)*1e3-5e3>Date.now())return i}return Jk.set(t,e),e},[e]);function Xk(e){let t=(0,b.useRef)(e);return(0,b.useInsertionEffect)(()=>{t.current=e},[e]),(0,b.useCallback)((...e)=>t.current?.(...e),[])}var Zk=3e3;function Qk(e,t,n){let r=Z(),i=r.getProject(),a=Wk()&&i?.features?.includes(`websocket-subscriptions`)?e:void 0,[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(n?.subscriptionProps),u=(0,b.useRef)(!1),d=(0,b.useRef)(void 0),f=(0,b.useRef)(void 0),p=(0,b.useRef)(void 0);(0,b.useEffect)(()=>{JC(n?.subscriptionProps,c)||l(n?.subscriptionProps)},[c,n]),(0,b.useEffect)(()=>{d.current&&=(clearTimeout(d.current),void 0);let e=!1;return(f.current!==a||!JC(p.current,c))&&(e=!0),e&&f.current&&r.unsubscribeFromCriteria(f.current,p.current),f.current=a,p.current=c,e&&a?s(r.subscribeToCriteria(a,c)):a||s(void 0),()=>{d.current=setTimeout(()=>{a&&r.unsubscribeFromCriteria(a,c)},Zk)}},[r,a,c]);let m=Xk(t),h=Xk(n?.onWebSocketOpen),g=Xk(n?.onWebSocketClose),_=Xk(n?.onSubscriptionConnect),v=Xk(n?.onSubscriptionDisconnect),y=Xk(n?.onError),x=(0,b.useCallback)(e=>m(e.payload),[m]),S=(0,b.useCallback)(e=>h(),[h]),C=(0,b.useCallback)(e=>g(),[g]),w=(0,b.useCallback)(e=>_(e.payload.subscriptionId),[_]),T=(0,b.useCallback)(e=>v(e.payload.subscriptionId),[v]),E=(0,b.useCallback)(e=>y(e.payload),[y]);(0,b.useEffect)(()=>o?(u.current||=(o.addEventListener(`message`,x),o.addEventListener(`open`,S),o.addEventListener(`close`,C),o.addEventListener(`connect`,w),o.addEventListener(`disconnect`,T),o.addEventListener(`error`,E),!0),()=>{u.current=!1,o.removeEventListener(`message`,x),o.removeEventListener(`open`,S),o.removeEventListener(`close`,C),o.removeEventListener(`connect`,w),o.removeEventListener(`disconnect`,T),o.removeEventListener(`error`,E)}):()=>void 0,[o,x,S,C,w,T,E])}function $k(e){let t=Z(),{resourceType:n,countCriteria:r,subscriptionCriteria:i}=e,[a,o]=(0,b.useState)(0),s=(0,b.useCallback)(e=>{t.search(n,r,{cache:e}).then(e=>o(e.total)).catch(console.error)},[t,n,r]);return(0,b.useEffect)(()=>{s(`default`)},[s]),Qk(i,()=>{s(`reload`)}),a}function eA(e,t){let n=Z(),[r,i]=(0,b.useState)(()=>tA(n,e)),a=(0,b.useCallback)(e=>{JC(e,r)||i(e)},[r]);return(0,b.useEffect)(()=>{let r=!0,i=tA(n,e);return!i&&pT(e)?n.readReference(e).then(e=>{r&&a(e)}).catch(e=>{r&&(a(void 0),t&&t(yS(e)))}):a(i),(()=>r=!1)},[n,e,a,t]),r}function tA(e,t){if(t){if(fT(t))return t;if(pT(t))return e.getCachedReference(t)}}var nA={group:`group`,display:`display`,question:`question`,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`},rA=`${Bx}/fhir/StructureDefinition/questionnaire-itemControl`,iA=`${Bx}/fhir/StructureDefinition/questionnaire-referenceFilter`,aA=`${Bx}/fhir/StructureDefinition/questionnaire-referenceResource`,oA=`${Bx}/fhir/StructureDefinition/questionnaire-validationError`,sA=`${Bx}/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-enableWhenExpression`,cA=`${Bx}/fhir/uv/sdc/StructureDefinition/sdc-questionnaire-calculatedExpression`,lA=`${Bx}/fhir/StructureDefinition/questionnaire-signatureRequired`,uA=`${Bx}/fhir/StructureDefinition/questionnaireresponse-signature`,dA=`${Bx}/fhir/StructureDefinition/questionnaire-hidden`,fA=`${Bx}/fhir/StructureDefinition/questionnaire-optionExclusive`;function pA(e){return e.type===`choice`||e.type===`open-choice`}function mA(e,t){return{...t,item:hA(e.item,t.item,t)}}function hA(e,t,n){if(!t)return t;let r=[];for(let i of t){let t=e?.find(e=>e.linkId===i.linkId);(!t||gA(t,n))&&(t?.item&&i.item?r.push({...i,item:hA(t.item,i.item,n)}):r.push(i))}return r}function gA(e,t){if(BC(e,dA)?.valueBoolean===!0)return!1;let n=_A(e,t);return n===void 0?vA(e,t):n}function _A(e,t){let n=BC(e,sA);if(t&&n){let e=n.valueExpression?.expression;if(e){let n=$S(t);return eC(uE(e,[n],{"%resource":n}))}}}function vA(e,t){if(!e.enableWhen)return!0;let n=e.enableBehavior??`any`;for(let r of e.enableWhen){let e=EA(t?.item,r.question);if(r.operator===`exists`&&!r.answerBoolean&&!e?.length){if(n===`any`)return!0;continue}let{anyMatch:i,allMatch:a}=OA(r,e,n);if(n===`any`&&i)return!0;if(n===`all`&&!a)return!1}return n!==`any`}function yA(e,t,n=t.item){for(let r of e){let e=n?.find(e=>e.linkId===r.linkId);e&&(bA(t,r,e),r.item&&e.item&&yA(r.item,t,e.item))}}function bA(e,t,n){try{let r=CA(t,e);if(!r)return;let i=SA(t,r);if(!i)return;n.answer=[i]}catch(e){n.extension=[{url:oA,valueString:`Expression evaluation failed: ${J(e)}`}]}}var xA={[nA.boolean]:[Y.boolean],[nA.date]:[Y.date],[nA.dateTime]:[Y.dateTime],[nA.time]:[Y.time],[nA.url]:[Y.string,Y.uri,Y.url],[nA.attachment]:[Y.Attachment],[nA.reference]:[Y.Reference],[nA.quantity]:[Y.Quantity],[nA.decimal]:[Y.decimal,Y.integer],[nA.integer]:[Y.decimal,Y.integer]};function SA(e,t){if(e.type){if(e.type===nA.choice||e.type===nA.openChoice)return{[`value${dw(t.type)}`]:t.value};if(e.type===nA.string||e.type===nA.text)return typeof t.value==`string`?{valueString:t.value}:void 0;if(xA[e.type]?.includes(t.type))return{[`value${dw(e.type)}`]:t.value}}}function CA(e,t){if(!t)return;let n=BC(e,cA);if(n){let e=n.valueExpression?.expression;if(e){let n=$S(t),r=uE(e,[n],{"%resource":n});return r.length===0?void 0:r[0]}}}function wA(e,t,n){let r=[];for(let i of e){let e=n.answerOption?.find(e=>Ow(zA(e))===i);if(e){let n=zA(e);n&&r.push({[t]:n.value})}}return r}function TA(e,t,n){let r=[];for(let t of e.answerOption??Dw)if(BC(t,fA)?.valueBoolean===!0){let e=zA(t);e?.value!==void 0&&r.push(e)}if(r.length===0)return n;let i=e=>{let t=VA(e);return!!t&&r.some(e=>JC(e,t))},a=n.filter(e=>!t?.some(t=>JC(t,e))),o=a.find(i);return o?[o]:a.some(e=>!i(e))?n.filter(e=>!i(e)):n}function EA(e,t){for(let n of e??Dw){if(n.linkId===t)return n.answer;if(n.item){let e=EA(n.item,t);if(e)return e}}}function DA(e,t,n){if(n===`exists`)return!!e===t.value;if(e){let[{value:r}]=uE(`%actualAnswer ${n===`=`||n===`!=`?n?.replace(`=`,`~`):n} %expectedAnswer`,[e],{"%actualAnswer":e,"%expectedAnswer":t});return r}return!1}function OA(e,t,n){let r=t||[],i=BA(e),a=!1,o=!0;for(let t of r){let r=VA(t),{operator:s}=e;if(DA(r,i,s)?a=!0:o=!1,n===`any`&&a)break}return{anyMatch:a,allMatch:o}}function kA(e){let t=BC(e,aA);if(t){if(t.valueCode!==void 0)return[t.valueCode];if(t.valueCodeableConcept)return t.valueCodeableConcept?.coding?.map(e=>e.code)}}function AA(e,t){let n=ew(e),r=BC(n,aA);return!t||t.length===0?(r&&(n.extension=n.extension?.filter(e=>e!==r)),n):(r||(n.extension??=[],r={url:aA},n.extension.push(r)),t.length===1?(r.valueCode=t[0],delete r.valueCodeableConcept):(r.valueCodeableConcept={coding:t.map(e=>({code:e}))},delete r.valueCode),n)}function jA(e,t,n){let r=BC(e,iA);if(!r?.valueString)return;let i=r.valueString;t?.reference&&(i=i.replaceAll(`$subj`,t.reference)),n?.reference&&(i=i.replaceAll(`$encounter`,n.reference));let a={},o=i.split(`&`);for(let e of o){let[t,n]=gw(e,`=`,2);a[t]=n}return a}function MA(e,t){return{resourceType:`QuestionnaireResponse`,questionnaire:e.url??OC(e),item:NA(e.item,t?.item),status:`in-progress`}}function NA(e,t){let n;for(let r of e??Dw){if(r.type===nA.display)continue;let e=t?.filter(e=>e.linkId===r.linkId);if(e?.length)for(let t of e)t.id=t.id??IA(),t.text=t.text??r.text,t.item=NA(r.item,t.item),t.answer=LA(r,t),n=vw(n,t);else n=vw(n,PA(r))}return n}function PA(e){return{id:IA(),linkId:e.linkId,text:e.text,item:NA(e.item,void 0),answer:LA(e)}}var FA=1;function IA(){return`id-`+FA++}function LA(e,t){if(e.type!==nA.display&&e.type!==nA.group){if(t?.answer&&t.answer.length>0)return t.answer;if(e.initial&&e.initial.length>0)return e.initial.map(e=>({...e}));if(e.answerOption)return e.answerOption.filter(e=>e.initialSelected).map(e=>({...e,initialSelected:void 0}))}}function RA(e){return aC({type:`QuestionnaireItemInitial`,value:e},`value`)}function zA(e){return aC({type:`QuestionnaireItemAnswerOption`,value:e},`value`)}function BA(e){return aC({type:`QuestionnaireItemEnableWhen`,value:e},`answer`)}function VA(e){return aC({type:`QuestionnaireResponseItemAnswer`,value:e},`value`)}function HA(e){let t=eA(e.questionnaire),n=eA(e.defaultValue),[,r]=(0,b.useReducer)(e=>e+1,0),i=(0,b.useRef)({activePage:0});if(!i.current.questionnaire&&t&&(i.current.questionnaire=t,i.current.pages=e.disablePagination?void 0:UA(t)),t&&e.defaultValue&&n&&!i.current.questionnaireResponse&&(i.current.questionnaireResponse=MA(t,n),p()),t&&!e.defaultValue&&!i.current.questionnaireResponse&&(i.current.questionnaireResponse=MA(t),p()),!i.current.questionnaire||!i.current.questionnaireResponse)return{loading:!0};function a(e,t){let n=i.current.questionnaireResponse;for(let t of e)n=n?.item?.find(e=>t.id?e.id===t.id:e.linkId===t.linkId);return t&&(n=n?.item?.find(e=>e.linkId===t.linkId)),n}function o(){i.current.activePage=(i.current.activePage??0)+1,r()}function s(){i.current.activePage=(i.current.activePage??0)-1,r()}function c(e,t){let n=a(e);n&&(n.item??=[],n.item.push(PA(t)),p())}function l(e,t){let n=a(e,t);n&&(n.answer??=[],n.answer.push({}),p())}function u(e,t,n){let r=a(e,t);r&&(r.answer=TA(t,r.answer,n),p())}function d(e){let t=i.current.questionnaireResponse;t&&(e?(t.extension=t.extension??[],t.extension=t.extension.filter(e=>e.url!==uA),t.extension.push({url:uA,valueSignature:e})):t.extension=t.extension?.filter(e=>e.url!==uA),p())}function f(){let e=i.current.questionnaire;if(e?.item){let t=i.current.questionnaireResponse;yA(e.item,t)}}function p(){let t=i.current.questionnaireResponse,n=i.current.questionnaire;t&&n&&(f(),r(),e.onChange?.(mA(n,t)))}return{loading:!1,pagination:!!i.current.pages,questionnaire:i.current.questionnaire,questionnaireResponse:mA(i.current.questionnaire,i.current.questionnaireResponse),subject:e.subject,encounter:e.encounter,activePage:i.current.activePage,pages:i.current.pages,items:WA(i.current.questionnaire,i.current.pages,i.current.activePage),responseItems:GA(i.current.questionnaireResponse,i.current.pages,i.current.activePage),onNextPage:o,onPrevPage:s,onAddGroup:c,onAddAnswer:l,onChangeAnswer:u,onChangeSignature:d}}function UA(e){if(e?.item&&BC(e?.item?.[0],rA)?.valueCodeableConcept?.coding?.[0]?.code===`page`)return e.item.map((e,t)=>({linkId:e.linkId,title:e.text??`Page ${t+1}`,group:e}))}function WA(e,t,n=0){return t&&e?.item?.[n]?[e.item[n]]:e.item??[]}function GA(e,t,n=0){return t&&e?.item?.[n]?[e.item[n]]:e.item??[]}function KA(e,t,n={leading:!1}){let[r,i]=(0,b.useState)(e),a=(0,b.useRef)(!1),o=(0,b.useRef)(void 0),s=(0,b.useRef)(!1),c=(0,b.useCallback)(()=>window.clearTimeout(o.current),[]);return(0,b.useEffect)(()=>{a.current&&(!s.current&&n.leading?(s.current=!0,i(e),o.current=setTimeout(()=>{s.current=!1},t)):(c(),o.current=setTimeout(()=>{s.current=!1,i(e)},t)))},[e,n.leading,t,c]),(0,b.useEffect)(()=>(a.current=!0,c),[c]),[r,c]}var qA=250;function JA(e,t,n){return XA(`searchOne`,e,t,n)}function YA(e,t,n){return XA(`searchResources`,e,t,n)}function XA(e,t,n,r){let i=Z(),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)(),d=i.fhirSearchUrl(t,n).toString(),f=(0,b.useMemo)(()=>({resourceType:t,query:n}),[d]),p=r?.enabled??!0,[m]=KA(f,r?.debounceMs??qA,{leading:!0});return(0,b.useEffect)(()=>{if(!p)return()=>{};o(!0);let t=!0;return i[e](m.resourceType,m.query).then(e=>{t&&(o(!1),c(e),u(iS))}).catch(e=>{t&&(o(!1),c(void 0),u(yS(e)))}),()=>{t=!1}},[i,e,m,p]),[s,a,l]}function ZA(e){if(e instanceof vS){let t=_S(e.outcome);return t===400||t===404}return!1}var QA=[];function $A(e){let t=Z(),n=Array.from(new Set(e.filter(e=>!!e))).sort((e,t)=>e.localeCompare(t)).join(`
|
|
97
97
|
`),r=(0,b.useMemo)(()=>n===``?QA:n.split(`
|
|
98
|
-
`),[n]),[i,a]=(0,b.useState)({});return(0,b.useEffect)(()=>{if(r.length===0)return;let e=!1;for(let n of r)t.valueSetExpand({url:n,count:1}).then(()=>{e||a(e=>({...e,[n]:!0}))}).catch(t=>{e||a(e=>({...e,[n]:!ZA(t)}))});return()=>{e=!0}},[t,r]),(0,b.useMemo)(()=>{let e=[],t=[],n=!1;for(let a of r){let r=i[a];r===void 0?n=!0:r?e.push(a):t.push(a)}return{loading:n,available:e,unavailable:t}},[r,i])}function ej(e){let{loading:t,unavailable:n}=$A(e?[e]:QA);if(!e)return!0;if(!t)return!n.includes(e)}function tj(e){let t=e.value;return t?(0,L.jsx)(L.Fragment,{children:Aw(t,e.options)}):null}var nj=[`meta`,`implicitRules`,`contained`,`extension`,`modifierExtension`],rj=[`language`,`text`],ij=(0,b.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});ij.displayName=`ElementsContext`;var aj=[`extension`,`modifierExtension`],oj=[`id`,...nj].filter(e=>!aj.includes(e));function sj(e){return Object.entries(e).filter(([e,t])=>!(!KC(t.type)||t.max===0||t.path.toLowerCase().endsWith(`extension.url`)&&t.fixed||aj.includes(e)&&!KC(t.slicing?.slices)||oj.includes(e)||rj.includes(e)&&t.path.split(`.`).length===2||e.includes(`.`)))}function cj(e,t){return e.line&&e.line.length>t?e.line[t]:``}function lj(e,t,n){let r=e.line||[];for(;r.length<=t;)r.push(``);return r[t]=n,{...e,line:qC(r)}}function uj(e){let[t,n]=(0,b.useState)(e.defaultValue||{}),{getExtendedProps:r}=(0,b.useContext)(ij),[i,a,o,s,c,l,u]=(0,b.useMemo)(()=>[`use`,`type`,`line1`,`line2`,`city`,`state`,`postalCode`].map(t=>r(e.path+`.`+t)),[r,e.path]);function d(r){n(e=>({...e,...r})),e.onChange&&e.onChange({...t,...r})}function f(e){d({use:e})}function p(e){d({type:e})}function m(e){d(lj(t,0,e))}function h(e){d(lj(t,1,e))}function g(e){d({city:e})}function _(e){d({state:e})}function v(e){d({postalCode:e})}return(0,L.jsxs)(V,{gap:`xs`,wrap:`nowrap`,grow:!0,children:[(0,L.jsx)(Ig,{disabled:e.disabled||i?.readonly,"data-testid":`address-use`,defaultValue:t.use,onChange:e=>f(e.currentTarget.value),data:[``,`home`,`work`,`temp`,`old`,`billing`]}),(0,L.jsx)(Ig,{disabled:e.disabled||a?.readonly,"data-testid":`address-type`,defaultValue:t.type,onChange:e=>p(e.currentTarget.value),data:[``,`postal`,`physical`,`both`]}),(0,L.jsx)(jb,{disabled:e.disabled||o?.readonly,placeholder:`Line 1`,defaultValue:cj(t,0),onChange:e=>m(e.currentTarget.value)}),(0,L.jsx)(jb,{disabled:e.disabled||s?.readonly,placeholder:`Line 2`,defaultValue:cj(t,1),onChange:e=>h(e.currentTarget.value)}),(0,L.jsx)(jb,{disabled:e.disabled||c?.readonly,placeholder:`City`,defaultValue:t.city,onChange:e=>g(e.currentTarget.value)}),(0,L.jsx)(jb,{disabled:e.disabled||l?.readonly,placeholder:`State`,defaultValue:t.state,onChange:e=>_(e.currentTarget.value)}),(0,L.jsx)(jb,{disabled:e.disabled||u?.readonly,placeholder:`Postal Code`,defaultValue:t.postalCode,onChange:e=>v(e.currentTarget.value)})]})}function dj(e){let t=Wk(),[n,r]=(0,b.useState)(e.defaultValue||{});function i(n){let i=n?{text:n,authorReference:t&&DC(t),time:new Date().toISOString()}:{};r(i),e.onChange&&e.onChange(i)}return(0,L.jsx)(jb,{disabled:e.disabled,name:e.name,placeholder:`Annotation text`,defaultValue:n.text,onChange:e=>i(e.currentTarget.value)})}var fj={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`}},Q=(e,t,n,r)=>{let i=(0,b.forwardRef)(({color:n=`currentColor`,size:i=24,stroke:a=2,title:o,className:s,children:c,...l},u)=>(0,b.createElement)(`svg`,{ref:u,...fj[e],width:i,height:i,className:[`tabler-icon`,`tabler-icon-${t}`,s].filter(Boolean).join(` `),...e===`filled`?{fill:n}:{strokeWidth:a,stroke:n},...l},[o&&(0,b.createElement)(`title`,{key:`svg-title`},o),...r.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(c)?c:[c]]));return i.displayName=`${n}`,i},pj=Q(`outline`,`alert-circle`,`AlertCircle`,[[`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`}]]),mj=Q(`outline`,`alert-triangle`,`AlertTriangle`,[[`path`,{d:`M12 9v4`,key:`svg-0`}],[`path`,{d:`M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0`,key:`svg-1`}],[`path`,{d:`M12 16h.01`,key:`svg-2`}]]),hj=Q(`outline`,`arrow-down`,`ArrowDown`,[[`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`}]]),gj=Q(`outline`,`arrow-up`,`ArrowUp`,[[`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`}]]),_j=Q(`outline`,`arrows-sort`,`ArrowsSort`,[[`path`,{d:`M3 9l4 -4l4 4m-4 -4v14`,key:`svg-0`}],[`path`,{d:`M21 15l-4 4l-4 -4m4 4v-14`,key:`svg-1`}]]),vj=Q(`outline`,`bleach-off`,`BleachOff`,[[`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`}]]),yj=Q(`outline`,`bleach`,`Bleach`,[[`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`}]]),bj=Q(`outline`,`bolt`,`Bolt`,[[`path`,{d:`M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11`,key:`svg-0`}]]),xj=Q(`outline`,`bookmark`,`Bookmark`,[[`path`,{d:`M18 7v14l-6 -4l-6 4v-14a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4`,key:`svg-0`}]]),Sj=Q(`outline`,`brackets-contain`,`BracketsContain`,[[`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`}]]),Cj=Q(`outline`,`brand-asana`,`BrandAsana`,[[`path`,{d:`M9 7a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-0`}],[`path`,{d:`M14 16a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-1`}],[`path`,{d:`M4 16a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-2`}]]),wj=Q(`outline`,`briefcase`,`Briefcase`,[[`path`,{d:`M3 9a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v9a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -9`,key:`svg-0`}],[`path`,{d:`M8 7v-2a2 2 0 0 1 2 -2h4a2 2 0 0 1 2 2v2`,key:`svg-1`}],[`path`,{d:`M12 12l0 .01`,key:`svg-2`}],[`path`,{d:`M3 13a20 20 0 0 0 18 0`,key:`svg-3`}]]),Tj=Q(`outline`,`bucket-off`,`BucketOff`,[[`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`}]]),Ej=Q(`outline`,`bucket`,`Bucket`,[[`path`,{d:`M4 7a8 4 0 1 0 16 0a8 4 0 1 0 -16 0`,key:`svg-0`}],[`path`,{d:`M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.333 -1 1.246 -4.345 2.737 -10.035a7.45 7.45 0 0 0 .263 -1.965`,key:`svg-1`}]]),Dj=Q(`outline`,`building`,`Building`,[[`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`}]]),Oj=Q(`outline`,`calendar-due`,`CalendarDue`,[[`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 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M16 3v4`,key:`svg-1`}],[`path`,{d:`M8 3v4`,key:`svg-2`}],[`path`,{d:`M4 11h16`,key:`svg-3`}],[`path`,{d:`M11 16a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-4`}]]),kj=Q(`outline`,`calendar-month`,`CalendarMonth`,[[`path`,{d:`M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12`,key:`svg-0`}],[`path`,{d:`M16 3v4`,key:`svg-1`}],[`path`,{d:`M8 3v4`,key:`svg-2`}],[`path`,{d:`M4 11h16`,key:`svg-3`}],[`path`,{d:`M8 14v4`,key:`svg-4`}],[`path`,{d:`M12 14v4`,key:`svg-5`}],[`path`,{d:`M16 14v4`,key:`svg-6`}]]),Aj=Q(`outline`,`calendar-time`,`CalendarTime`,[[`path`,{d:`M11.795 21h-6.795a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4`,key:`svg-0`}],[`path`,{d:`M14 18a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-1`}],[`path`,{d:`M15 3v4`,key:`svg-2`}],[`path`,{d:`M7 3v4`,key:`svg-3`}],[`path`,{d:`M3 11h16`,key:`svg-4`}],[`path`,{d:`M18 16.496v1.504l1 1`,key:`svg-5`}]]),jj=Q(`outline`,`check`,`Check`,[[`path`,{d:`M5 12l5 5l10 -10`,key:`svg-0`}]]),Mj=Q(`outline`,`checkbox`,`Checkbox`,[[`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`}]]),Nj=Q(`outline`,`chevron-down`,`ChevronDown`,[[`path`,{d:`M6 9l6 6l6 -6`,key:`svg-0`}]]),Pj=Q(`outline`,`circle-check`,`CircleCheck`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M9 12l2 2l4 -4`,key:`svg-1`}]]),Fj=Q(`outline`,`circle-minus`,`CircleMinus`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M9 12l6 0`,key:`svg-1`}]]),Ij=Q(`outline`,`circle-plus`,`CirclePlus`,[[`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`}]]),Lj=Q(`outline`,`cloud-upload`,`CloudUpload`,[[`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`}]]),Rj=Q(`outline`,`columns`,`Columns`,[[`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`}]]),zj=Q(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),Bj=Q(`outline`,`currency-dollar`,`CurrencyDollar`,[[`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`}]]),Vj=Q(`outline`,`database`,`Database`,[[`path`,{d:`M4 6a8 3 0 1 0 16 0a8 3 0 1 0 -16 0`,key:`svg-0`}],[`path`,{d:`M4 6v6a8 3 0 0 0 16 0v-6`,key:`svg-1`}],[`path`,{d:`M4 12v6a8 3 0 0 0 16 0v-6`,key:`svg-2`}]]),Hj=Q(`outline`,`device-desktop`,`DeviceDesktop`,[[`path`,{d:`M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10`,key:`svg-0`}],[`path`,{d:`M7 20h10`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M15 16v4`,key:`svg-3`}]]),Uj=Q(`outline`,`device-floppy`,`DeviceFloppy`,[[`path`,{d:`M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2`,key:`svg-0`}],[`path`,{d:`M10 14a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M14 4l0 4l-6 0l0 -4`,key:`svg-2`}]]),Wj=Q(`outline`,`dots`,`Dots`,[[`path`,{d:`M4 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-0`}],[`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M18 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-2`}]]),Gj=Q(`outline`,`edit`,`Edit`,[[`path`,{d:`M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1`,key:`svg-0`}],[`path`,{d:`M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415`,key:`svg-1`}],[`path`,{d:`M16 5l3 3`,key:`svg-2`}]]),Kj=Q(`outline`,`equal-not`,`EqualNot`,[[`path`,{d:`M5 10h14`,key:`svg-0`}],[`path`,{d:`M5 14h14`,key:`svg-1`}],[`path`,{d:`M5 19l14 -14`,key:`svg-2`}]]),qj=Q(`outline`,`equal`,`Equal`,[[`path`,{d:`M5 10h14`,key:`svg-0`}],[`path`,{d:`M5 14h14`,key:`svg-1`}]]),Jj=Q(`outline`,`eye-off`,`EyeOff`,[[`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`}]]),Yj=Q(`outline`,`eye`,`Eye`,[[`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`}]]),Xj=Q(`outline`,`file-alert`,`FileAlert`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2`,key:`svg-1`}],[`path`,{d:`M12 17l.01 0`,key:`svg-2`}],[`path`,{d:`M12 11l0 3`,key:`svg-3`}]]),Zj=Q(`outline`,`filter`,`Filter`,[[`path`,{d:`M4 4h16v2.172a2 2 0 0 1 -.586 1.414l-4.414 4.414v7l-6 2v-8.5l-4.48 -4.928a2 2 0 0 1 -.52 -1.345v-2.227`,key:`svg-0`}]]),Qj=Q(`outline`,`folder`,`Folder`,[[`path`,{d:`M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2`,key:`svg-0`}]]),$j=Q(`outline`,`forms`,`Forms`,[[`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`}]]),eM=Q(`outline`,`id`,`Id`,[[`path`,{d:`M3 7a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3l0 -10`,key:`svg-0`}],[`path`,{d:`M7 10a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M15 8l2 0`,key:`svg-2`}],[`path`,{d:`M15 12l2 0`,key:`svg-3`}],[`path`,{d:`M7 16l10 0`,key:`svg-4`}]]),tM=Q(`outline`,`info-circle`,`InfoCircle`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0`,key:`svg-0`}],[`path`,{d:`M12 9h.01`,key:`svg-1`}],[`path`,{d:`M11 12h1v4h1`,key:`svg-2`}]]),nM=Q(`outline`,`layout-sidebar`,`LayoutSidebar`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M9 4l0 16`,key:`svg-1`}]]),rM=Q(`outline`,`library-plus`,`LibraryPlus`,[[`path`,{d:`M7 5.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 7.26a2.005 2.005 0 0 0 -1.012 1.737v10c0 1.1 .9 2 2 2h10c.75 0 1.158 -.385 1.5 -1`,key:`svg-1`}],[`path`,{d:`M11 10h6`,key:`svg-2`}],[`path`,{d:`M14 7v6`,key:`svg-3`}]]),iM=Q(`outline`,`list-details`,`ListDetails`,[[`path`,{d:`M13 5h8`,key:`svg-0`}],[`path`,{d:`M13 9h5`,key:`svg-1`}],[`path`,{d:`M13 15h8`,key:`svg-2`}],[`path`,{d:`M13 19h5`,key:`svg-3`}],[`path`,{d:`M3 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-4`}],[`path`,{d:`M3 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-5`}]]),aM=Q(`outline`,`lock-access`,`LockAccess`,[[`path`,{d:`M4 8v-2a2 2 0 0 1 2 -2h2`,key:`svg-0`}],[`path`,{d:`M4 16v2a2 2 0 0 0 2 2h2`,key:`svg-1`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v2`,key:`svg-2`}],[`path`,{d:`M16 20h2a2 2 0 0 0 2 -2v-2`,key:`svg-3`}],[`path`,{d:`M8 12a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1l0 -3`,key:`svg-4`}],[`path`,{d:`M10 11v-2a2 2 0 1 1 4 0v2`,key:`svg-5`}]]),oM=Q(`outline`,`lock`,`Lock`,[[`path`,{d:`M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6`,key:`svg-0`}],[`path`,{d:`M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0`,key:`svg-1`}],[`path`,{d:`M8 11v-4a4 4 0 1 1 8 0v4`,key:`svg-2`}]]),sM=Q(`outline`,`logout`,`Logout`,[[`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`}]]),cM=Q(`outline`,`math-greater`,`MathGreater`,[[`path`,{d:`M5 18l14 -6l-14 -6`,key:`svg-0`}]]),lM=Q(`outline`,`math-lower`,`MathLower`,[[`path`,{d:`M19 18l-14 -6l14 -6`,key:`svg-0`}]]),uM=Q(`outline`,`message`,`Message`,[[`path`,{d:`M8 9h8`,key:`svg-0`}],[`path`,{d:`M8 13h6`,key:`svg-1`}],[`path`,{d:`M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12`,key:`svg-2`}]]),dM=Q(`outline`,`microscope`,`Microscope`,[[`path`,{d:`M5 21h14`,key:`svg-0`}],[`path`,{d:`M6 18h2`,key:`svg-1`}],[`path`,{d:`M7 18v3`,key:`svg-2`}],[`path`,{d:`M9 11l3 3l6 -6l-3 -3l-6 6`,key:`svg-3`}],[`path`,{d:`M10.5 12.5l-1.5 1.5`,key:`svg-4`}],[`path`,{d:`M17 3l3 3`,key:`svg-5`}],[`path`,{d:`M12 21a6 6 0 0 0 3.715 -10.712`,key:`svg-6`}]]),fM=Q(`outline`,`minus`,`Minus`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}]]),pM=Q(`outline`,`moon`,`Moon`,[[`path`,{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`,key:`svg-0`}]]),mM=Q(`outline`,`packages`,`Packages`,[[`path`,{d:`M7 16.5l-5 -3l5 -3l5 3v5.5l-5 3l0 -5.5`,key:`svg-0`}],[`path`,{d:`M2 13.5v5.5l5 3`,key:`svg-1`}],[`path`,{d:`M7 16.545l5 -3.03`,key:`svg-2`}],[`path`,{d:`M17 16.5l-5 -3l5 -3l5 3v5.5l-5 3l0 -5.5`,key:`svg-3`}],[`path`,{d:`M12 19l5 3`,key:`svg-4`}],[`path`,{d:`M17 16.5l5 -3`,key:`svg-5`}],[`path`,{d:`M12 13.5v-5.5l-5 -3l5 -3l5 3v5.5`,key:`svg-6`}],[`path`,{d:`M7 5.03v5.455`,key:`svg-7`}],[`path`,{d:`M12 8l5 -3`,key:`svg-8`}]]),hM=Q(`outline`,`palette`,`Palette`,[[`path`,{d:`M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25`,key:`svg-0`}],[`path`,{d:`M7.5 10.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M11.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-2`}],[`path`,{d:`M15.5 10.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-3`}]]),gM=Q(`outline`,`pencil`,`Pencil`,[[`path`,{d:`M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4`,key:`svg-0`}],[`path`,{d:`M13.5 6.5l4 4`,key:`svg-1`}]]),_M=Q(`outline`,`pin`,`Pin`,[[`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`}]]),vM=Q(`outline`,`pinned-off`,`PinnedOff`,[[`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`}]]),yM=Q(`outline`,`player-play`,`PlayerPlay`,[[`path`,{d:`M7 4v16l13 -8l-13 -8`,key:`svg-0`}]]),bM=Q(`outline`,`plus`,`Plus`,[[`path`,{d:`M12 5l0 14`,key:`svg-0`}],[`path`,{d:`M5 12l14 0`,key:`svg-1`}]]),xM=Q(`outline`,`receipt`,`Receipt`,[[`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`}]]),SM=Q(`outline`,`refresh`,`Refresh`,[[`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`}]]),CM=Q(`outline`,`reload`,`Reload`,[[`path`,{d:`M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1 7.935 1.007 9.425 4.747`,key:`svg-0`}],[`path`,{d:`M20 4v5h-5`,key:`svg-1`}]]),wM=Q(`outline`,`repeat`,`Repeat`,[[`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`}]]),TM=Q(`outline`,`report-medical`,`ReportMedical`,[[`path`,{d:`M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2`,key:`svg-0`}],[`path`,{d:`M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2`,key:`svg-1`}],[`path`,{d:`M10 14l4 0`,key:`svg-2`}],[`path`,{d:`M12 12l0 4`,key:`svg-3`}]]),EM=Q(`outline`,`router`,`Router`,[[`path`,{d:`M3 15a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -4`,key:`svg-0`}],[`path`,{d:`M17 17l0 .01`,key:`svg-1`}],[`path`,{d:`M13 17l0 .01`,key:`svg-2`}],[`path`,{d:`M15 13l0 -2`,key:`svg-3`}],[`path`,{d:`M11.75 8.75a4 4 0 0 1 6.5 0`,key:`svg-4`}],[`path`,{d:`M8.5 6.5a8 8 0 0 1 13 0`,key:`svg-5`}]]),DM=Q(`outline`,`search`,`Search`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-1`}]]),OM=Q(`outline`,`settings`,`Settings`,[[`path`,{d:`M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065`,key:`svg-0`}],[`path`,{d:`M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-1`}]]),kM=Q(`outline`,`sort-ascending`,`SortAscending`,[[`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`}]]),AM=Q(`outline`,`sort-descending`,`SortDescending`,[[`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`}]]),jM=Q(`outline`,`square`,`Square`,[[`path`,{d:`M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14`,key:`svg-0`}]]),MM=Q(`outline`,`star`,`Star`,[[`path`,{d:`M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873l-6.158 -3.245`,key:`svg-0`}]]),NM=Q(`outline`,`sun-high`,`SunHigh`,[[`path`,{d:`M14.828 14.828a4 4 0 1 0 -5.656 -5.656a4 4 0 0 0 5.656 5.656`,key:`svg-0`}],[`path`,{d:`M6.343 17.657l-1.414 1.414`,key:`svg-1`}],[`path`,{d:`M6.343 6.343l-1.414 -1.414`,key:`svg-2`}],[`path`,{d:`M17.657 6.343l1.414 -1.414`,key:`svg-3`}],[`path`,{d:`M17.657 17.657l1.414 1.414`,key:`svg-4`}],[`path`,{d:`M4 12h-2`,key:`svg-5`}],[`path`,{d:`M12 4v-2`,key:`svg-6`}],[`path`,{d:`M20 12h2`,key:`svg-7`}],[`path`,{d:`M12 20v2`,key:`svg-8`}]]),PM=Q(`outline`,`switch-horizontal`,`SwitchHorizontal`,[[`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`}]]),FM=Q(`outline`,`table-export`,`TableExport`,[[`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`}]]),IM=Q(`outline`,`table`,`Table`,[[`path`,{d:`M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14`,key:`svg-0`}],[`path`,{d:`M3 10h18`,key:`svg-1`}],[`path`,{d:`M10 3v18`,key:`svg-2`}]]),LM=Q(`outline`,`text-recognition`,`TextRecognition`,[[`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`}]]),RM=Q(`outline`,`trash`,`Trash`,[[`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`}]]),zM=Q(`outline`,`upload`,`Upload`,[[`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`}]]),BM=Q(`outline`,`user-plus`,`UserPlus`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M16 19h6`,key:`svg-1`}],[`path`,{d:`M19 16v6`,key:`svg-2`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4`,key:`svg-3`}]]),VM=Q(`outline`,`webhook`,`Webhook`,[[`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`}]]),HM=Q(`outline`,`x`,`X`,[[`path`,{d:`M18 6l-12 12`,key:`svg-0`}],[`path`,{d:`M6 6l12 12`,key:`svg-1`}]]),UM=Q(`filled`,`circle-filled`,`CircleFilled`,[[`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`}]]),WM=class extends b.Component{state;constructor(e){super(e),this.state={lastLocation:uD.getLocation()}}static getDerivedStateFromError(e){return{error:e,lastLocation:uD.getLocation()}}componentDidUpdate(e,t){uD.getLocation()!==this.state.lastLocation&&this.setState({lastLocation:uD.getLocation(),error:void 0})}shouldComponentUpdate(e,t){return!!(this.props.children!==e.children||t.error&&!this.state.error||this.state.lastLocation!==uD.getLocation())}componentDidCatch(e,t){console.error(`Uncaught error:`,e,t)}render(){return this.state.error?(0,L.jsx)(jd,{icon:(0,L.jsx)(pj,{size:16}),title:`Something went wrong`,color:`red`,children:J(this.state.error)}):this.props.children}};function GM(){return(0,L.jsx)(Xp,{style:{width:`100%`,height:`100vh`},children:(0,L.jsx)(fu,{})})}var KM={main:`_main_6s8vf_1`,announcement:`_announcement_6s8vf_7`};function qM(e){return(0,L.jsx)(L.Fragment,{children:e.announcements.map((t,n)=>(0,L.jsx)(z,{className:KM.announcement,style:{backgroundColor:`var(--mantine-color-${t.color??`yellow`}-light)`,color:`var(--mantine-color-${t.color??`yellow`}-light-color)`},role:t.role??`status`,children:(0,L.jsxs)(V,{gap:`xs`,wrap:`nowrap`,h:`100%`,px:`md`,children:[t.icon,(0,L.jsx)(H,{size:`sm`,fw:500,truncate:!0,children:t.message}),t.dismissible&&(0,L.jsx)(Tu,{size:`sm`,variant:`subtle`,"aria-label":`Dismiss announcement`,onClick:()=>e.onDismiss(t),ml:`auto`})]})},t.id??n))})}function JM(e){e.preventDefault(),e.stopPropagation()}function YM(e){return e.button===1||e.ctrlKey||e.metaKey}function XM(e){if(ZM(e))return!0;if(e instanceof HTMLTableCellElement){let t=e.children;if(t.length===1&&ZM(t[0]))return!0}return!1}function ZM(e){return e instanceof HTMLInputElement&&e.type===`checkbox`}async function QM(e,t){return new Promise((n,r)=>{let i=new MessageChannel;i.port1.onmessage=({data:e})=>{i.port1.close(),e.error?r(e.error):n(e.result)},e.contentWindow?.postMessage(t,new URL(e.src).origin,[i.port2])})}function $M(e,t){let n=new Blob([e],{type:wD.JSON}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${t??new Date().toISOString().replaceAll(/\D/g,``)}.json`,document.body.appendChild(i),i.click(),URL.revokeObjectURL(r)}function eN(e){let t=Uk(),{to:n,suffix:r,label:i,onClick:a,children:o,...s}=e,c=tN(n);return r&&(c+=`/`+r),(0,L.jsx)(Rd,{href:c,"aria-label":i,onAuxClick:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation(),a?(e.preventDefault(),a(e)):n&&(YM(e)||(e.preventDefault(),t(c)))},...s,children:o})}function tN(e){if(e){if(typeof e==`string`)return nN(e);if(fT(e))return rN(e);if(pT(e))return iN(e)}return`#`}function nN(e){return e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)?e:`/`+e}function rN(e){return`/${e.resourceType}/${e.id}`}function iN(e){return`/${e.reference}`}function aN(e){let t=e.split(` `).filter(Boolean);return t.length>1?t[0][0]+t.at(-1)?.at(0):t.length===1?t[0][0]:``}function oN(e){let t=eA(e.value),n=t?MC(t):e.alt??``,r=aN(n),i=Yk((t&&FC(t))??e.src??void 0),a=e.radius??`xl`,o={...e,value:void 0,link:void 0};return e.link?(0,L.jsx)(eN,{to:t,children:(0,L.jsx)(Np,{src:i,alt:n,radius:a,...o,children:r})}):(0,L.jsx)(Np,{src:i,alt:n,radius:a,...o,children:r})}var sN={logoButton:`_logoButton_3ecx0_1`,user:`_user_3ecx0_11`,userInfo:`_userInfo_3ecx0_25`,userName:`_userName_3ecx0_35`,userProject:`_userProject_3ecx0_40`},cN={iconBox:`_iconBox_f3xp4_1`,subtitle:`_subtitle_f3xp4_12`,interactive:`_interactive_f3xp4_16`};function lN(e){let{projectDisplay:t,profileDisplay:n,label:r,selected:i}=e,a=r?`${t} - ${r}`:t;return(0,L.jsxs)(V,{gap:`xs`,align:`center`,wrap:`nowrap`,style:{width:`100%`,minWidth:0},children:[(0,L.jsx)(z,{className:cN.iconBox,children:(0,L.jsx)(wj,{size:16,stroke:2})}),(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,L.jsx)(H,{size:`sm`,fw:500,truncate:!0,children:a}),(0,L.jsx)(H,{size:`xs`,className:cN.subtitle,truncate:!0,children:n})]}),i&&(0,L.jsx)(jj,{size:16,stroke:2,color:`var(--mantine-color-blue-6)`})]})}function uN(e){let{membership:t,label:n}=e;return(0,L.jsx)(lN,{projectDisplay:t.project?.display,profileDisplay:t.profile?.display,label:n})}function dN(){return`Medplum`}var fN={divider:`_divider_3o3ui_1`,accountSection:`_accountSection_3o3ui_5`,projectOption:`_projectOption_3o3ui_9`,recentProjectItem:`_recentProjectItem_3o3ui_18`,dropdown:`_dropdown_3o3ui_22`,settingsRow:`_settingsRow_3o3ui_43`,settingsControlWrapper:`_settingsControlWrapper_3o3ui_50`,segmentedControl:`_segmentedControl_3o3ui_57`,appearanceControl:`_appearanceControl_3o3ui_76`,layoutControl:`_layoutControl_3o3ui_93`},pN=`var(--mantine-color-dimmed)`,mN=[{value:`light`,label:(0,L.jsx)(gN,{Icon:NM,label:`Light`})},{value:`auto`,label:(0,L.jsx)(gN,{Icon:Hj,label:`System`})},{value:`dark`,label:(0,L.jsx)(gN,{Icon:pM,label:`Dark`})}],hN=[{label:`v1`,value:`v1`},{label:`v2`,value:`v2`}];function gN({Icon:e,label:t}){return(0,L.jsx)(`span`,{"aria-label":t,style:{display:`flex`},children:(0,L.jsx)(e,{size:16,color:pN,"aria-hidden":!0})})}function _N(){return(0,L.jsx)(hm,{my:4,mx:4,className:fN.divider})}function vN(e,t){return t?e.project.reference===t.project.reference&&e.profile.reference===t.profile.reference:!1}function yN(e){return`${e.project.reference}-${e.profile.reference}`}function bN(e){let{medplum:t,profile:n,navigate:r}=Hk(),i=t.getActiveLogin(),a=t.getLogins().filter(e=>!vN(e,i)),o=t.getProject(),{colorScheme:s,setColorScheme:c}=pi(),[l]=(0,b.useState)(()=>localStorage.appShellLayoutVersion??`v1`),u=e.showLayoutVersionToggle??!0,d=o?.name??t.getActiveLogin()?.project.display,f=i?.profile.display??(n?jw(n.name?.[0]):void 0);function p(e){t.setActiveLogin(e).then(()=>uD.reload()).catch(console.error)}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z,{className:fN.accountSection,children:(0,L.jsx)(z,{className:fN.projectOption,children:(0,L.jsx)(lN,{projectDisplay:d,profileDisplay:f,selected:!0})})}),a.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(_N,{}),a.map(e=>(0,L.jsx)(Xh.Item,{className:fN.recentProjectItem,onClick:()=>p(e),children:(0,L.jsx)(z,{className:fN.projectOption,children:(0,L.jsx)(lN,{projectDisplay:e.project.display,profileDisplay:e.profile.display})})},yN(e)))]}),(0,L.jsx)(_N,{}),(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(PM,{size:16,color:pN}),onClick:()=>r(`/signin`),children:(0,L.jsx)(H,{size:`sm`,children:`Switch to another project`})}),(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(OM,{size:16,color:pN}),onClick:()=>r(`/${OC(n)}`),children:(0,L.jsx)(H,{size:`sm`,children:`Account settings`})}),(0,L.jsxs)(xd,{className:fN.settingsRow,align:`center`,pl:`sm`,pr:`xs`,py:`xs`,children:[(0,L.jsxs)(xd,{align:`center`,gap:`xs`,children:[(0,L.jsx)(hM,{size:16,color:pN}),(0,L.jsx)(H,{size:`sm`,children:`Appearance`})]}),(0,L.jsx)(z,{className:fN.settingsControlWrapper,children:(0,L.jsx)(by,{classNames:{root:Ln(fN.segmentedControl,fN.appearanceControl)},size:`xs`,radius:`xl`,withItemsBorders:!1,value:s,onChange:e=>c(e),data:mN,"aria-label":`Color scheme`})})]}),u&&(0,L.jsxs)(xd,{className:fN.settingsRow,align:`center`,pl:`sm`,pr:`xs`,py:`xs`,children:[(0,L.jsxs)(xd,{align:`center`,gap:`xs`,children:[(0,L.jsx)(IM,{size:16,color:pN}),(0,L.jsx)(H,{size:`sm`,children:`Layout`})]}),(0,L.jsx)(z,{className:fN.settingsControlWrapper,children:(0,L.jsx)(by,{classNames:{root:Ln(fN.segmentedControl,fN.layoutControl)},size:`xs`,radius:`xl`,withItemsBorders:!1,value:l,onChange:e=>{localStorage.appShellLayoutVersion=e,uD.reload()},data:hN,"aria-label":`App shell layout version`})})]}),(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(sM,{size:16,color:pN}),onClick:async()=>{await t.signOut(),r(`/signin`)},children:(0,L.jsx)(H,{size:`sm`,children:`Sign out`})}),(0,L.jsx)(_N,{}),(0,L.jsxs)(H,{size:`xs`,c:`dimmed`,fw:500,my:`sm`,ta:`center`,children:[dN(),` `,e.version]})]})}var xN={selectedItems:`selected-items`,options:`options`};function SN(e){let t=Bf({onDropdownClose:()=>t.resetSelectedOption(),onDropdownOpen:()=>t.updateSelectedOptionIndex(`active`)}),{name:n,label:r,description:i,error:a,defaultValue:o,toOption:s,loadOptions:c,itemComponent:l,pillComponent:u,emptyComponent:d,onChange:f,onCreate:p,creatable:m,clearable:h,required:g,withAsterisk:_,placeholder:v,leftSection:y,maxValues:x,optionsDropdownMaxHeight:S=320,minInputLength:C=0,...w}=e,T=w.disabled,E=CN(o),[D,O]=(0,b.useState)(``),[k,A]=(0,b.useState)(),[j,M]=(0,b.useState)(),[N,ee]=(0,b.useState)(E.map(s)),[P,te]=(0,b.useState)([]),ne=l??wN,re=u??TN,ie=d??EN,ae=(0,b.useRef)(D),oe=(0,b.useRef)(void 0),se=(0,b.useRef)(void 0),ce=(0,b.useRef)(k),le=(0,b.useRef)(j),ue=(0,b.useRef)(!1),de=(0,b.useRef)(N);(0,b.useLayoutEffect)(()=>{ae.current=D,ce.current=k,le.current=j,de.current=N});let fe=(0,b.useCallback)(e=>{let n=de.current;if(n.some(t=>t.value===e.value))return;if(x===0){f([e.resource]),ee([]);return}let r=[...n,e];if(x!==void 0){for(;r.length>x;)r.shift();r.length>=x&&(O(``),te([]),t.closeDropdown())}f(r.map(e=>e.resource)),ee(r)},[x,f,t,O,te]),pe=(0,b.useCallback)(()=>{if(A(void 0),ae.current===se.current&&c===oe.current||(ae.current?.length??0)<C)return;se.current=ae.current,oe.current=c;let e=new AbortController;M(e),c(ae.current??``,e.signal).then(n=>{if(!e.signal.aborted){let e=n.map(s);te(e),ue.current?(e.length>0&&fe(e[0]),ue.current=!1):n.length>0&&t.openDropdown()}}).catch(t=>{e.signal.aborted||t.message.includes(`aborted`)||q({color:`red`,message:J(t)})}).finally(()=>{e.signal.aborted||M(void 0)})},[t,c,fe,s,C,A,M]),F=(0,b.useCallback)(e=>{(P&&P.length>0||m)&&t.openDropdown(),t.updateSelectedOptionIndex(),O(e.currentTarget.value),le.current&&(le.current.abort(),M(void 0)),ce.current!==void 0&&window.clearTimeout(ce.current);let n=window.setTimeout(()=>pe(),100);A(n)},[t,P,m,pe,A,O,M]),me=(0,b.useCallback)(e=>{if(N.some(t=>t.value===e)){let t=N.filter(t=>t.value!==e);f(t.map(e=>e.resource)),ee(t)}else{let t=P?.find(t=>t.value===e);if(!t&&m!==!1&&p){let n=p(e);t=s(n)}t&&fe(t)}},[N,f,fe,p,s,P,m]),he=(0,b.useMemo)(()=>{if(!T)return e=>{T||(se.current=void 0,e===`$create`?(O(``),me(D)):me(e))}},[me,T,D,O]),ge=(0,b.useCallback)(e=>{let t=N.filter(t=>t.value!==e.value);f(t.map(e=>e.resource)),ee(t)},[N,f]),_e=(0,b.useCallback)(e=>{e.key===`Enter`?(k||j)&&(ue.current=!0):e.key===`Backspace`&&D.length===0&&(JM(e),ge(N[N.length-1]))},[j,ge,D.length,N,k]);(0,b.useEffect)(()=>()=>{le.current&&le.current.abort()},[]);let ve=!T&&h&&N.length>0&&(0,L.jsx)(Uf.ClearButton,{title:`Clear all`,size:`sm`,onClear:()=>{O(``),ee([]),f([]),t.closeDropdown()}}),ye=m&&D.trim().length>0,be=P.length>0||ye;return(0,L.jsxs)(Uf,{store:t,onOptionSubmit:he,withinPortal:!0,shadow:`xl`,...w,children:[(0,L.jsx)(Uf.DropdownTarget,{children:(0,L.jsx)(Og,{label:r,description:i,error:a,className:e.className,leftSection:y,rightSection:j?(0,L.jsx)(fu,{size:16}):ve,required:g,withAsterisk:_,disabled:T,children:(0,L.jsxs)(Cg.Group,{"data-testid":xN.selectedItems,children:[N.map(e=>(0,L.jsx)(re,{item:e,disabled:T,onRemove:()=>ge(e)},e.value)),!T&&(x===void 0||x===0||N.length<x)&&(0,L.jsx)(Uf.EventsTarget,{children:(0,L.jsx)(Og.Field,{role:`searchbox`,name:n,value:D,placeholder:v,onFocus:F,onBlur:()=>{t.closeDropdown(),O(``)},onKeyDown:_e,onChange:F})})]})})}),(0,L.jsx)(Uf.Dropdown,{hidden:!be,"data-testid":xN.options,children:(0,L.jsx)(Uf.Options,{children:(0,L.jsxs)(hl,{type:`scroll`,mah:S,children:[P.map(e=>{let t=N.some(t=>t.value===e.value);return(0,L.jsx)(Uf.Option,{value:e.value,active:t,children:(0,L.jsx)(ne,{...e,active:t})},e.value)}),ye&&(0,L.jsxs)(Uf.Option,{value:`$create`,children:[`+ Create `,D]}),!m&&D.trim().length>0&&P.length===0&&(0,L.jsx)(ie,{search:D})]})})})]})}function CN(e){return e?Array.isArray(e)?e:[e]:[]}function wN(e){return(0,L.jsxs)(V,{gap:`xs`,children:[e.active&&(0,L.jsx)(jj,{size:12}),(0,L.jsx)(`span`,{children:e.label})]})}function TN({item:e,disabled:t,onRemove:n}){return(0,L.jsx)(Cg,{withRemoveButton:!t,onRemove:n,children:e.label})}function EN(){return(0,L.jsx)(Uf.Empty,{children:`Nothing found`})}var DN={searchInput:`_searchInput_dick8_1`};function ON(e){return{value:e.id,label:MC(e),resource:e}}function kN(e){let t=Uk(),n=Z(),r=(0,b.useCallback)(async(e,t)=>{let r=jN(e),i={signal:t};return MN(await n.graphql(r,void 0,void 0,i),e)},[n]),i=(0,b.useCallback)(e=>{e.length>0&&t(`/${OC(e[0])}`)},[t]);return(0,L.jsx)(SN,{size:`sm`,radius:`md`,className:DN.searchInput,leftSection:(0,L.jsx)(DM,{size:16}),placeholder:`Search`,itemComponent:AN,toOption:ON,onChange:i,loadOptions:r,maxValues:0,clearable:!1},`${e.pathname}?${e.searchParams}`)}var AN=(0,b.forwardRef)(({resource:e,active:t,...n},r)=>{let i;return e.resourceType===`Patient`?i=e.birthDate:e.resourceType===`ServiceRequest`&&(i=e.subject?.display),(0,L.jsx)(`div`,{ref:r,...n,children:(0,L.jsxs)(V,{wrap:`nowrap`,children:[(0,L.jsx)(oN,{value:e}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(H,{children:MC(e)}),(0,L.jsx)(H,{size:`xs`,c:`dimmed`,children:i})]})]})})});function jN(e){let t=JSON.stringify(e);return tw(e)?`{
|
|
98
|
+
`),[n]),[i,a]=(0,b.useState)({});return(0,b.useEffect)(()=>{if(r.length===0)return;let e=!1;for(let n of r)t.valueSetExpand({url:n,count:1}).then(()=>{e||a(e=>({...e,[n]:!0}))}).catch(t=>{e||a(e=>({...e,[n]:!ZA(t)}))});return()=>{e=!0}},[t,r]),(0,b.useMemo)(()=>{let e=[],t=[],n=!1;for(let a of r){let r=i[a];r===void 0?n=!0:r?e.push(a):t.push(a)}return{loading:n,available:e,unavailable:t}},[r,i])}function ej(e){let{loading:t,unavailable:n}=$A(e?[e]:QA);if(!e)return!0;if(!t)return!n.includes(e)}function tj(e){let t=e.value;return t?(0,L.jsx)(L.Fragment,{children:Aw(t,e.options)}):null}var nj=[`meta`,`implicitRules`,`contained`,`extension`,`modifierExtension`],rj=[`language`,`text`],ij=(0,b.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});ij.displayName=`ElementsContext`;var aj=[`extension`,`modifierExtension`],oj=[`id`,...nj].filter(e=>!aj.includes(e));function sj(e){return Object.entries(e).filter(([e,t])=>!(!KC(t.type)||t.max===0||t.path.toLowerCase().endsWith(`extension.url`)&&t.fixed||aj.includes(e)&&!KC(t.slicing?.slices)||oj.includes(e)||rj.includes(e)&&t.path.split(`.`).length===2||e.includes(`.`)))}function cj(e,t){return e.line&&e.line.length>t?e.line[t]:``}function lj(e,t,n){let r=e.line||[];for(;r.length<=t;)r.push(``);return r[t]=n,{...e,line:qC(r)}}function uj(e){let[t,n]=(0,b.useState)(e.defaultValue||{}),{getExtendedProps:r}=(0,b.useContext)(ij),[i,a,o,s,c,l,u]=(0,b.useMemo)(()=>[`use`,`type`,`line1`,`line2`,`city`,`state`,`postalCode`].map(t=>r(e.path+`.`+t)),[r,e.path]);function d(r){n(e=>({...e,...r})),e.onChange&&e.onChange({...t,...r})}function f(e){d({use:e})}function p(e){d({type:e})}function m(e){d(lj(t,0,e))}function h(e){d(lj(t,1,e))}function g(e){d({city:e})}function _(e){d({state:e})}function v(e){d({postalCode:e})}return(0,L.jsxs)(V,{gap:`xs`,wrap:`nowrap`,grow:!0,children:[(0,L.jsx)(Ig,{disabled:e.disabled||i?.readonly,"data-testid":`address-use`,defaultValue:t.use,onChange:e=>f(e.currentTarget.value),data:[``,`home`,`work`,`temp`,`old`,`billing`]}),(0,L.jsx)(Ig,{disabled:e.disabled||a?.readonly,"data-testid":`address-type`,defaultValue:t.type,onChange:e=>p(e.currentTarget.value),data:[``,`postal`,`physical`,`both`]}),(0,L.jsx)(jb,{disabled:e.disabled||o?.readonly,placeholder:`Line 1`,defaultValue:cj(t,0),onChange:e=>m(e.currentTarget.value)}),(0,L.jsx)(jb,{disabled:e.disabled||s?.readonly,placeholder:`Line 2`,defaultValue:cj(t,1),onChange:e=>h(e.currentTarget.value)}),(0,L.jsx)(jb,{disabled:e.disabled||c?.readonly,placeholder:`City`,defaultValue:t.city,onChange:e=>g(e.currentTarget.value)}),(0,L.jsx)(jb,{disabled:e.disabled||l?.readonly,placeholder:`State`,defaultValue:t.state,onChange:e=>_(e.currentTarget.value)}),(0,L.jsx)(jb,{disabled:e.disabled||u?.readonly,placeholder:`Postal Code`,defaultValue:t.postalCode,onChange:e=>v(e.currentTarget.value)})]})}function dj(e){let t=Wk(),[n,r]=(0,b.useState)(e.defaultValue||{});function i(n){let i=n?{text:n,authorReference:t&&DC(t),time:new Date().toISOString()}:{};r(i),e.onChange&&e.onChange(i)}return(0,L.jsx)(jb,{disabled:e.disabled,name:e.name,placeholder:`Annotation text`,defaultValue:n.text,onChange:e=>i(e.currentTarget.value)})}var fj={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`}},Q=(e,t,n,r)=>{let i=(0,b.forwardRef)(({color:n=`currentColor`,size:i=24,stroke:a=2,title:o,className:s,children:c,...l},u)=>(0,b.createElement)(`svg`,{ref:u,...fj[e],width:i,height:i,className:[`tabler-icon`,`tabler-icon-${t}`,s].filter(Boolean).join(` `),...e===`filled`?{fill:n}:{strokeWidth:a,stroke:n},...l},[o&&(0,b.createElement)(`title`,{key:`svg-title`},o),...r.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(c)?c:[c]]));return i.displayName=`${n}`,i},pj=Q(`outline`,`alert-circle`,`AlertCircle`,[[`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`}]]),mj=Q(`outline`,`alert-triangle`,`AlertTriangle`,[[`path`,{d:`M12 9v4`,key:`svg-0`}],[`path`,{d:`M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636 -2.87l-8.106 -13.536a1.914 1.914 0 0 0 -3.274 0`,key:`svg-1`}],[`path`,{d:`M12 16h.01`,key:`svg-2`}]]),hj=Q(`outline`,`arrow-down`,`ArrowDown`,[[`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`}]]),gj=Q(`outline`,`arrow-up`,`ArrowUp`,[[`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`}]]),_j=Q(`outline`,`arrows-sort`,`ArrowsSort`,[[`path`,{d:`M3 9l4 -4l4 4m-4 -4v14`,key:`svg-0`}],[`path`,{d:`M21 15l-4 4l-4 -4m4 4v-14`,key:`svg-1`}]]),vj=Q(`outline`,`bleach-off`,`BleachOff`,[[`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`}]]),yj=Q(`outline`,`bleach`,`Bleach`,[[`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`}]]),bj=Q(`outline`,`bolt`,`Bolt`,[[`path`,{d:`M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11`,key:`svg-0`}]]),xj=Q(`outline`,`bookmark`,`Bookmark`,[[`path`,{d:`M18 7v14l-6 -4l-6 4v-14a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4`,key:`svg-0`}]]),Sj=Q(`outline`,`brackets-contain`,`BracketsContain`,[[`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`}]]),Cj=Q(`outline`,`brand-asana`,`BrandAsana`,[[`path`,{d:`M9 7a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-0`}],[`path`,{d:`M14 16a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-1`}],[`path`,{d:`M4 16a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-2`}]]),wj=Q(`outline`,`briefcase`,`Briefcase`,[[`path`,{d:`M3 9a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v9a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -9`,key:`svg-0`}],[`path`,{d:`M8 7v-2a2 2 0 0 1 2 -2h4a2 2 0 0 1 2 2v2`,key:`svg-1`}],[`path`,{d:`M12 12l0 .01`,key:`svg-2`}],[`path`,{d:`M3 13a20 20 0 0 0 18 0`,key:`svg-3`}]]),Tj=Q(`outline`,`bucket-off`,`BucketOff`,[[`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`}]]),Ej=Q(`outline`,`bucket`,`Bucket`,[[`path`,{d:`M4 7a8 4 0 1 0 16 0a8 4 0 1 0 -16 0`,key:`svg-0`}],[`path`,{d:`M4 7c0 .664 .088 1.324 .263 1.965l2.737 10.035c.5 1.5 2.239 2 5 2s4.5 -.5 5 -2c.333 -1 1.246 -4.345 2.737 -10.035a7.45 7.45 0 0 0 .263 -1.965`,key:`svg-1`}]]),Dj=Q(`outline`,`building`,`Building`,[[`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`}]]),Oj=Q(`outline`,`calendar-due`,`CalendarDue`,[[`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 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M16 3v4`,key:`svg-1`}],[`path`,{d:`M8 3v4`,key:`svg-2`}],[`path`,{d:`M4 11h16`,key:`svg-3`}],[`path`,{d:`M11 16a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-4`}]]),kj=Q(`outline`,`calendar-month`,`CalendarMonth`,[[`path`,{d:`M4 7a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12`,key:`svg-0`}],[`path`,{d:`M16 3v4`,key:`svg-1`}],[`path`,{d:`M8 3v4`,key:`svg-2`}],[`path`,{d:`M4 11h16`,key:`svg-3`}],[`path`,{d:`M8 14v4`,key:`svg-4`}],[`path`,{d:`M12 14v4`,key:`svg-5`}],[`path`,{d:`M16 14v4`,key:`svg-6`}]]),Aj=Q(`outline`,`calendar-time`,`CalendarTime`,[[`path`,{d:`M11.795 21h-6.795a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v4`,key:`svg-0`}],[`path`,{d:`M14 18a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-1`}],[`path`,{d:`M15 3v4`,key:`svg-2`}],[`path`,{d:`M7 3v4`,key:`svg-3`}],[`path`,{d:`M3 11h16`,key:`svg-4`}],[`path`,{d:`M18 16.496v1.504l1 1`,key:`svg-5`}]]),jj=Q(`outline`,`check`,`Check`,[[`path`,{d:`M5 12l5 5l10 -10`,key:`svg-0`}]]),Mj=Q(`outline`,`checkbox`,`Checkbox`,[[`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`}]]),Nj=Q(`outline`,`chevron-down`,`ChevronDown`,[[`path`,{d:`M6 9l6 6l6 -6`,key:`svg-0`}]]),Pj=Q(`outline`,`circle-check`,`CircleCheck`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M9 12l2 2l4 -4`,key:`svg-1`}]]),Fj=Q(`outline`,`circle-minus`,`CircleMinus`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M9 12l6 0`,key:`svg-1`}]]),Ij=Q(`outline`,`circle-plus`,`CirclePlus`,[[`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`}]]),Lj=Q(`outline`,`cloud-upload`,`CloudUpload`,[[`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`}]]),Rj=Q(`outline`,`columns`,`Columns`,[[`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`}]]),zj=Q(`outline`,`copy`,`Copy`,[[`path`,{d:`M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1`,key:`svg-1`}]]),Bj=Q(`outline`,`currency-dollar`,`CurrencyDollar`,[[`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`}]]),Vj=Q(`outline`,`database`,`Database`,[[`path`,{d:`M4 6a8 3 0 1 0 16 0a8 3 0 1 0 -16 0`,key:`svg-0`}],[`path`,{d:`M4 6v6a8 3 0 0 0 16 0v-6`,key:`svg-1`}],[`path`,{d:`M4 12v6a8 3 0 0 0 16 0v-6`,key:`svg-2`}]]),Hj=Q(`outline`,`device-desktop`,`DeviceDesktop`,[[`path`,{d:`M3 5a1 1 0 0 1 1 -1h16a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-16a1 1 0 0 1 -1 -1v-10`,key:`svg-0`}],[`path`,{d:`M7 20h10`,key:`svg-1`}],[`path`,{d:`M9 16v4`,key:`svg-2`}],[`path`,{d:`M15 16v4`,key:`svg-3`}]]),Uj=Q(`outline`,`device-floppy`,`DeviceFloppy`,[[`path`,{d:`M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2`,key:`svg-0`}],[`path`,{d:`M10 14a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M14 4l0 4l-6 0l0 -4`,key:`svg-2`}]]),Wj=Q(`outline`,`dots`,`Dots`,[[`path`,{d:`M4 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-0`}],[`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M18 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-2`}]]),Gj=Q(`outline`,`edit`,`Edit`,[[`path`,{d:`M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1`,key:`svg-0`}],[`path`,{d:`M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415`,key:`svg-1`}],[`path`,{d:`M16 5l3 3`,key:`svg-2`}]]),Kj=Q(`outline`,`equal-not`,`EqualNot`,[[`path`,{d:`M5 10h14`,key:`svg-0`}],[`path`,{d:`M5 14h14`,key:`svg-1`}],[`path`,{d:`M5 19l14 -14`,key:`svg-2`}]]),qj=Q(`outline`,`equal`,`Equal`,[[`path`,{d:`M5 10h14`,key:`svg-0`}],[`path`,{d:`M5 14h14`,key:`svg-1`}]]),Jj=Q(`outline`,`eye-off`,`EyeOff`,[[`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`}]]),Yj=Q(`outline`,`eye`,`Eye`,[[`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`}]]),Xj=Q(`outline`,`file-alert`,`FileAlert`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2`,key:`svg-1`}],[`path`,{d:`M12 17l.01 0`,key:`svg-2`}],[`path`,{d:`M12 11l0 3`,key:`svg-3`}]]),Zj=Q(`outline`,`filter-2-plus`,`Filter2Plus`,[[`path`,{d:`M4 6h16`,key:`svg-0`}],[`path`,{d:`M6 12h10`,key:`svg-1`}],[`path`,{d:`M9 18h3`,key:`svg-2`}],[`path`,{d:`M19 15v6`,key:`svg-3`}],[`path`,{d:`M16 18h6`,key:`svg-4`}]]),Qj=Q(`outline`,`folder`,`Folder`,[[`path`,{d:`M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2`,key:`svg-0`}]]),$j=Q(`outline`,`forms`,`Forms`,[[`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`}]]),eM=Q(`outline`,`id`,`Id`,[[`path`,{d:`M3 7a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v10a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3l0 -10`,key:`svg-0`}],[`path`,{d:`M7 10a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M15 8l2 0`,key:`svg-2`}],[`path`,{d:`M15 12l2 0`,key:`svg-3`}],[`path`,{d:`M7 16l10 0`,key:`svg-4`}]]),tM=Q(`outline`,`info-circle`,`InfoCircle`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0`,key:`svg-0`}],[`path`,{d:`M12 9h.01`,key:`svg-1`}],[`path`,{d:`M11 12h1v4h1`,key:`svg-2`}]]),nM=Q(`outline`,`layout-sidebar`,`LayoutSidebar`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M9 4l0 16`,key:`svg-1`}]]),rM=Q(`outline`,`library-plus`,`LibraryPlus`,[[`path`,{d:`M7 5.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666`,key:`svg-0`}],[`path`,{d:`M4.012 7.26a2.005 2.005 0 0 0 -1.012 1.737v10c0 1.1 .9 2 2 2h10c.75 0 1.158 -.385 1.5 -1`,key:`svg-1`}],[`path`,{d:`M11 10h6`,key:`svg-2`}],[`path`,{d:`M14 7v6`,key:`svg-3`}]]),iM=Q(`outline`,`list-details`,`ListDetails`,[[`path`,{d:`M13 5h8`,key:`svg-0`}],[`path`,{d:`M13 9h5`,key:`svg-1`}],[`path`,{d:`M13 15h8`,key:`svg-2`}],[`path`,{d:`M13 19h5`,key:`svg-3`}],[`path`,{d:`M3 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-4`}],[`path`,{d:`M3 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-5`}]]),aM=Q(`outline`,`lock-access`,`LockAccess`,[[`path`,{d:`M4 8v-2a2 2 0 0 1 2 -2h2`,key:`svg-0`}],[`path`,{d:`M4 16v2a2 2 0 0 0 2 2h2`,key:`svg-1`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v2`,key:`svg-2`}],[`path`,{d:`M16 20h2a2 2 0 0 0 2 -2v-2`,key:`svg-3`}],[`path`,{d:`M8 12a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v3a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1l0 -3`,key:`svg-4`}],[`path`,{d:`M10 11v-2a2 2 0 1 1 4 0v2`,key:`svg-5`}]]),oM=Q(`outline`,`lock`,`Lock`,[[`path`,{d:`M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6`,key:`svg-0`}],[`path`,{d:`M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0`,key:`svg-1`}],[`path`,{d:`M8 11v-4a4 4 0 1 1 8 0v4`,key:`svg-2`}]]),sM=Q(`outline`,`logout`,`Logout`,[[`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`}]]),cM=Q(`outline`,`math-greater`,`MathGreater`,[[`path`,{d:`M5 18l14 -6l-14 -6`,key:`svg-0`}]]),lM=Q(`outline`,`math-lower`,`MathLower`,[[`path`,{d:`M19 18l-14 -6l14 -6`,key:`svg-0`}]]),uM=Q(`outline`,`message`,`Message`,[[`path`,{d:`M8 9h8`,key:`svg-0`}],[`path`,{d:`M8 13h6`,key:`svg-1`}],[`path`,{d:`M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12`,key:`svg-2`}]]),dM=Q(`outline`,`microscope`,`Microscope`,[[`path`,{d:`M5 21h14`,key:`svg-0`}],[`path`,{d:`M6 18h2`,key:`svg-1`}],[`path`,{d:`M7 18v3`,key:`svg-2`}],[`path`,{d:`M9 11l3 3l6 -6l-3 -3l-6 6`,key:`svg-3`}],[`path`,{d:`M10.5 12.5l-1.5 1.5`,key:`svg-4`}],[`path`,{d:`M17 3l3 3`,key:`svg-5`}],[`path`,{d:`M12 21a6 6 0 0 0 3.715 -10.712`,key:`svg-6`}]]),fM=Q(`outline`,`minus`,`Minus`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}]]),pM=Q(`outline`,`moon`,`Moon`,[[`path`,{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`,key:`svg-0`}]]),mM=Q(`outline`,`packages`,`Packages`,[[`path`,{d:`M7 16.5l-5 -3l5 -3l5 3v5.5l-5 3l0 -5.5`,key:`svg-0`}],[`path`,{d:`M2 13.5v5.5l5 3`,key:`svg-1`}],[`path`,{d:`M7 16.545l5 -3.03`,key:`svg-2`}],[`path`,{d:`M17 16.5l-5 -3l5 -3l5 3v5.5l-5 3l0 -5.5`,key:`svg-3`}],[`path`,{d:`M12 19l5 3`,key:`svg-4`}],[`path`,{d:`M17 16.5l5 -3`,key:`svg-5`}],[`path`,{d:`M12 13.5v-5.5l-5 -3l5 -3l5 3v5.5`,key:`svg-6`}],[`path`,{d:`M7 5.03v5.455`,key:`svg-7`}],[`path`,{d:`M12 8l5 -3`,key:`svg-8`}]]),hM=Q(`outline`,`palette`,`Palette`,[[`path`,{d:`M12 21a9 9 0 0 1 0 -18c4.97 0 9 3.582 9 8c0 1.06 -.474 2.078 -1.318 2.828c-.844 .75 -1.989 1.172 -3.182 1.172h-2.5a2 2 0 0 0 -1 3.75a1.3 1.3 0 0 1 -1 2.25`,key:`svg-0`}],[`path`,{d:`M7.5 10.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M11.5 7.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-2`}],[`path`,{d:`M15.5 10.5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-3`}]]),gM=Q(`outline`,`pencil`,`Pencil`,[[`path`,{d:`M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4`,key:`svg-0`}],[`path`,{d:`M13.5 6.5l4 4`,key:`svg-1`}]]),_M=Q(`outline`,`pin`,`Pin`,[[`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`}]]),vM=Q(`outline`,`pinned-off`,`PinnedOff`,[[`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`}]]),yM=Q(`outline`,`player-play`,`PlayerPlay`,[[`path`,{d:`M7 4v16l13 -8l-13 -8`,key:`svg-0`}]]),bM=Q(`outline`,`plus`,`Plus`,[[`path`,{d:`M12 5l0 14`,key:`svg-0`}],[`path`,{d:`M5 12l14 0`,key:`svg-1`}]]),xM=Q(`outline`,`receipt`,`Receipt`,[[`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`}]]),SM=Q(`outline`,`refresh`,`Refresh`,[[`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`}]]),CM=Q(`outline`,`reload`,`Reload`,[[`path`,{d:`M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1 7.935 1.007 9.425 4.747`,key:`svg-0`}],[`path`,{d:`M20 4v5h-5`,key:`svg-1`}]]),wM=Q(`outline`,`repeat`,`Repeat`,[[`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`}]]),TM=Q(`outline`,`report-medical`,`ReportMedical`,[[`path`,{d:`M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2`,key:`svg-0`}],[`path`,{d:`M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2`,key:`svg-1`}],[`path`,{d:`M10 14l4 0`,key:`svg-2`}],[`path`,{d:`M12 12l0 4`,key:`svg-3`}]]),EM=Q(`outline`,`router`,`Router`,[[`path`,{d:`M3 15a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -4`,key:`svg-0`}],[`path`,{d:`M17 17l0 .01`,key:`svg-1`}],[`path`,{d:`M13 17l0 .01`,key:`svg-2`}],[`path`,{d:`M15 13l0 -2`,key:`svg-3`}],[`path`,{d:`M11.75 8.75a4 4 0 0 1 6.5 0`,key:`svg-4`}],[`path`,{d:`M8.5 6.5a8 8 0 0 1 13 0`,key:`svg-5`}]]),DM=Q(`outline`,`search`,`Search`,[[`path`,{d:`M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`,key:`svg-0`}],[`path`,{d:`M21 21l-6 -6`,key:`svg-1`}]]),OM=Q(`outline`,`settings`,`Settings`,[[`path`,{d:`M10.325 4.317c.426 -1.756 2.924 -1.756 3.35 0a1.724 1.724 0 0 0 2.573 1.066c1.543 -.94 3.31 .826 2.37 2.37a1.724 1.724 0 0 0 1.065 2.572c1.756 .426 1.756 2.924 0 3.35a1.724 1.724 0 0 0 -1.066 2.573c.94 1.543 -.826 3.31 -2.37 2.37a1.724 1.724 0 0 0 -2.572 1.065c-.426 1.756 -2.924 1.756 -3.35 0a1.724 1.724 0 0 0 -2.573 -1.066c-1.543 .94 -3.31 -.826 -2.37 -2.37a1.724 1.724 0 0 0 -1.065 -2.572c-1.756 -.426 -1.756 -2.924 0 -3.35a1.724 1.724 0 0 0 1.066 -2.573c-.94 -1.543 .826 -3.31 2.37 -2.37c1 .608 2.296 .07 2.572 -1.065`,key:`svg-0`}],[`path`,{d:`M9 12a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-1`}]]),kM=Q(`outline`,`sort-ascending`,`SortAscending`,[[`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`}]]),AM=Q(`outline`,`sort-descending`,`SortDescending`,[[`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`}]]),jM=Q(`outline`,`square`,`Square`,[[`path`,{d:`M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14`,key:`svg-0`}]]),MM=Q(`outline`,`star`,`Star`,[[`path`,{d:`M12 17.75l-6.172 3.245l1.179 -6.873l-5 -4.867l6.9 -1l3.086 -6.253l3.086 6.253l6.9 1l-5 4.867l1.179 6.873l-6.158 -3.245`,key:`svg-0`}]]),NM=Q(`outline`,`sun-high`,`SunHigh`,[[`path`,{d:`M14.828 14.828a4 4 0 1 0 -5.656 -5.656a4 4 0 0 0 5.656 5.656`,key:`svg-0`}],[`path`,{d:`M6.343 17.657l-1.414 1.414`,key:`svg-1`}],[`path`,{d:`M6.343 6.343l-1.414 -1.414`,key:`svg-2`}],[`path`,{d:`M17.657 6.343l1.414 -1.414`,key:`svg-3`}],[`path`,{d:`M17.657 17.657l1.414 1.414`,key:`svg-4`}],[`path`,{d:`M4 12h-2`,key:`svg-5`}],[`path`,{d:`M12 4v-2`,key:`svg-6`}],[`path`,{d:`M20 12h2`,key:`svg-7`}],[`path`,{d:`M12 20v2`,key:`svg-8`}]]),PM=Q(`outline`,`switch-horizontal`,`SwitchHorizontal`,[[`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`}]]),FM=Q(`outline`,`table-export`,`TableExport`,[[`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`}]]),IM=Q(`outline`,`table`,`Table`,[[`path`,{d:`M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14`,key:`svg-0`}],[`path`,{d:`M3 10h18`,key:`svg-1`}],[`path`,{d:`M10 3v18`,key:`svg-2`}]]),LM=Q(`outline`,`text-recognition`,`TextRecognition`,[[`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`}]]),RM=Q(`outline`,`trash`,`Trash`,[[`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`}]]),zM=Q(`outline`,`upload`,`Upload`,[[`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`}]]),BM=Q(`outline`,`user-plus`,`UserPlus`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M16 19h6`,key:`svg-1`}],[`path`,{d:`M19 16v6`,key:`svg-2`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4`,key:`svg-3`}]]),VM=Q(`outline`,`webhook`,`Webhook`,[[`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`}]]),HM=Q(`outline`,`x`,`X`,[[`path`,{d:`M18 6l-12 12`,key:`svg-0`}],[`path`,{d:`M6 6l12 12`,key:`svg-1`}]]),UM=Q(`filled`,`circle-filled`,`CircleFilled`,[[`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`}]]),WM=class extends b.Component{state;constructor(e){super(e),this.state={lastLocation:uD.getLocation()}}static getDerivedStateFromError(e){return{error:e,lastLocation:uD.getLocation()}}componentDidUpdate(e,t){uD.getLocation()!==this.state.lastLocation&&this.setState({lastLocation:uD.getLocation(),error:void 0})}shouldComponentUpdate(e,t){return!!(this.props.children!==e.children||t.error&&!this.state.error||this.state.lastLocation!==uD.getLocation())}componentDidCatch(e,t){console.error(`Uncaught error:`,e,t)}render(){return this.state.error?(0,L.jsx)(jd,{icon:(0,L.jsx)(pj,{size:16}),title:`Something went wrong`,color:`red`,children:J(this.state.error)}):this.props.children}};function GM(){return(0,L.jsx)(Xp,{style:{width:`100%`,height:`100vh`},children:(0,L.jsx)(fu,{})})}var KM={main:`_main_6s8vf_1`,announcement:`_announcement_6s8vf_7`};function qM(e){return(0,L.jsx)(L.Fragment,{children:e.announcements.map((t,n)=>(0,L.jsx)(z,{className:KM.announcement,style:{backgroundColor:`var(--mantine-color-${t.color??`yellow`}-light)`,color:`var(--mantine-color-${t.color??`yellow`}-light-color)`},role:t.role??`status`,children:(0,L.jsxs)(V,{gap:`xs`,wrap:`nowrap`,h:`100%`,px:`md`,children:[t.icon,(0,L.jsx)(H,{size:`sm`,fw:500,truncate:!0,children:t.message}),t.dismissible&&(0,L.jsx)(Tu,{size:`sm`,variant:`subtle`,"aria-label":`Dismiss announcement`,onClick:()=>e.onDismiss(t),ml:`auto`})]})},t.id??n))})}function JM(e){e.preventDefault(),e.stopPropagation()}function YM(e){return e.button===1||e.ctrlKey||e.metaKey}function XM(e){if(ZM(e))return!0;if(e instanceof HTMLTableCellElement){let t=e.children;if(t.length===1&&ZM(t[0]))return!0}return!1}function ZM(e){return e instanceof HTMLInputElement&&e.type===`checkbox`}async function QM(e,t){return new Promise((n,r)=>{let i=new MessageChannel;i.port1.onmessage=({data:e})=>{i.port1.close(),e.error?r(e.error):n(e.result)},e.contentWindow?.postMessage(t,new URL(e.src).origin,[i.port2])})}function $M(e,t){let n=new Blob([e],{type:wD.JSON}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`${t??new Date().toISOString().replaceAll(/\D/g,``)}.json`,document.body.appendChild(i),i.click(),URL.revokeObjectURL(r)}function eN(e){let t=Uk(),{to:n,suffix:r,label:i,onClick:a,children:o,...s}=e,c=tN(n);return r&&(c+=`/`+r),(0,L.jsx)(Rd,{href:c,"aria-label":i,onAuxClick:e=>{e.stopPropagation()},onClick:e=>{e.stopPropagation(),a?(e.preventDefault(),a(e)):n&&(YM(e)||(e.preventDefault(),t(c)))},...s,children:o})}function tN(e){if(e){if(typeof e==`string`)return nN(e);if(fT(e))return rN(e);if(pT(e))return iN(e)}return`#`}function nN(e){return e.startsWith(`http://`)||e.startsWith(`https://`)||e.startsWith(`/`)?e:`/`+e}function rN(e){return`/${e.resourceType}/${e.id}`}function iN(e){return`/${e.reference}`}function aN(e){let t=e.split(` `).filter(Boolean);return t.length>1?t[0][0]+t.at(-1)?.at(0):t.length===1?t[0][0]:``}function oN(e){let t=eA(e.value),n=t?MC(t):e.alt??``,r=aN(n),i=Yk((t&&FC(t))??e.src??void 0),a=e.radius??`xl`,o={...e,value:void 0,link:void 0};return e.link?(0,L.jsx)(eN,{to:t,children:(0,L.jsx)(Np,{src:i,alt:n,radius:a,...o,children:r})}):(0,L.jsx)(Np,{src:i,alt:n,radius:a,...o,children:r})}var sN={logoButton:`_logoButton_3ecx0_1`,user:`_user_3ecx0_11`,userInfo:`_userInfo_3ecx0_25`,userName:`_userName_3ecx0_35`,userProject:`_userProject_3ecx0_40`},cN={iconBox:`_iconBox_f3xp4_1`,subtitle:`_subtitle_f3xp4_12`,interactive:`_interactive_f3xp4_16`};function lN(e){let{projectDisplay:t,profileDisplay:n,label:r,selected:i}=e,a=r?`${t} - ${r}`:t;return(0,L.jsxs)(V,{gap:`xs`,align:`center`,wrap:`nowrap`,style:{width:`100%`,minWidth:0},children:[(0,L.jsx)(z,{className:cN.iconBox,children:(0,L.jsx)(wj,{size:16,stroke:2})}),(0,L.jsxs)(`div`,{style:{flex:1,minWidth:0},children:[(0,L.jsx)(H,{size:`sm`,fw:500,truncate:!0,children:a}),(0,L.jsx)(H,{size:`xs`,className:cN.subtitle,truncate:!0,children:n})]}),i&&(0,L.jsx)(jj,{size:16,stroke:2,color:`var(--mantine-color-blue-6)`})]})}function uN(e){let{membership:t,label:n}=e;return(0,L.jsx)(lN,{projectDisplay:t.project?.display,profileDisplay:t.profile?.display,label:n})}function dN(){return`Medplum`}var fN={divider:`_divider_3o3ui_1`,accountSection:`_accountSection_3o3ui_5`,projectOption:`_projectOption_3o3ui_9`,recentProjectItem:`_recentProjectItem_3o3ui_18`,dropdown:`_dropdown_3o3ui_22`,settingsRow:`_settingsRow_3o3ui_43`,settingsControlWrapper:`_settingsControlWrapper_3o3ui_50`,segmentedControl:`_segmentedControl_3o3ui_57`,appearanceControl:`_appearanceControl_3o3ui_76`,layoutControl:`_layoutControl_3o3ui_93`},pN=`var(--mantine-color-dimmed)`,mN=[{value:`light`,label:(0,L.jsx)(gN,{Icon:NM,label:`Light`})},{value:`auto`,label:(0,L.jsx)(gN,{Icon:Hj,label:`System`})},{value:`dark`,label:(0,L.jsx)(gN,{Icon:pM,label:`Dark`})}],hN=[{label:`v1`,value:`v1`},{label:`v2`,value:`v2`}];function gN({Icon:e,label:t}){return(0,L.jsx)(`span`,{"aria-label":t,style:{display:`flex`},children:(0,L.jsx)(e,{size:16,color:pN,"aria-hidden":!0})})}function _N(){return(0,L.jsx)(hm,{my:4,mx:4,className:fN.divider})}function vN(e,t){return t?e.project.reference===t.project.reference&&e.profile.reference===t.profile.reference:!1}function yN(e){return`${e.project.reference}-${e.profile.reference}`}function bN(e){let{medplum:t,profile:n,navigate:r}=Hk(),i=t.getActiveLogin(),a=t.getLogins().filter(e=>!vN(e,i)),o=t.getProject(),{colorScheme:s,setColorScheme:c}=pi(),[l]=(0,b.useState)(()=>localStorage.appShellLayoutVersion??`v1`),u=e.showLayoutVersionToggle??!0,d=o?.name??t.getActiveLogin()?.project.display,f=i?.profile.display??(n?jw(n.name?.[0]):void 0);function p(e){t.setActiveLogin(e).then(()=>uD.reload()).catch(console.error)}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(z,{className:fN.accountSection,children:(0,L.jsx)(z,{className:fN.projectOption,children:(0,L.jsx)(lN,{projectDisplay:d,profileDisplay:f,selected:!0})})}),a.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(_N,{}),a.map(e=>(0,L.jsx)(Xh.Item,{className:fN.recentProjectItem,onClick:()=>p(e),children:(0,L.jsx)(z,{className:fN.projectOption,children:(0,L.jsx)(lN,{projectDisplay:e.project.display,profileDisplay:e.profile.display})})},yN(e)))]}),(0,L.jsx)(_N,{}),(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(PM,{size:16,color:pN}),onClick:()=>r(`/signin`),children:(0,L.jsx)(H,{size:`sm`,children:`Switch to another project`})}),(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(OM,{size:16,color:pN}),onClick:()=>r(`/${OC(n)}`),children:(0,L.jsx)(H,{size:`sm`,children:`Account settings`})}),(0,L.jsxs)(xd,{className:fN.settingsRow,align:`center`,pl:`sm`,pr:`xs`,py:`xs`,children:[(0,L.jsxs)(xd,{align:`center`,gap:`xs`,children:[(0,L.jsx)(hM,{size:16,color:pN}),(0,L.jsx)(H,{size:`sm`,children:`Appearance`})]}),(0,L.jsx)(z,{className:fN.settingsControlWrapper,children:(0,L.jsx)(by,{classNames:{root:Ln(fN.segmentedControl,fN.appearanceControl)},size:`xs`,radius:`xl`,withItemsBorders:!1,value:s,onChange:e=>c(e),data:mN,"aria-label":`Color scheme`})})]}),u&&(0,L.jsxs)(xd,{className:fN.settingsRow,align:`center`,pl:`sm`,pr:`xs`,py:`xs`,children:[(0,L.jsxs)(xd,{align:`center`,gap:`xs`,children:[(0,L.jsx)(IM,{size:16,color:pN}),(0,L.jsx)(H,{size:`sm`,children:`Layout`})]}),(0,L.jsx)(z,{className:fN.settingsControlWrapper,children:(0,L.jsx)(by,{classNames:{root:Ln(fN.segmentedControl,fN.layoutControl)},size:`xs`,radius:`xl`,withItemsBorders:!1,value:l,onChange:e=>{localStorage.appShellLayoutVersion=e,uD.reload()},data:hN,"aria-label":`App shell layout version`})})]}),(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(sM,{size:16,color:pN}),onClick:async()=>{await t.signOut(),r(`/signin`)},children:(0,L.jsx)(H,{size:`sm`,children:`Sign out`})}),(0,L.jsx)(_N,{}),(0,L.jsxs)(H,{size:`xs`,c:`dimmed`,fw:500,my:`sm`,ta:`center`,children:[dN(),` `,e.version]})]})}var xN={selectedItems:`selected-items`,options:`options`};function SN(e){let t=Bf({onDropdownClose:()=>t.resetSelectedOption(),onDropdownOpen:()=>t.updateSelectedOptionIndex(`active`)}),{name:n,label:r,description:i,error:a,defaultValue:o,toOption:s,loadOptions:c,itemComponent:l,pillComponent:u,emptyComponent:d,onChange:f,onCreate:p,creatable:m,clearable:h,required:g,withAsterisk:_,placeholder:v,leftSection:y,maxValues:x,optionsDropdownMaxHeight:S=320,minInputLength:C=0,...w}=e,T=w.disabled,E=CN(o),[D,O]=(0,b.useState)(``),[k,A]=(0,b.useState)(),[j,M]=(0,b.useState)(),[N,ee]=(0,b.useState)(E.map(s)),[P,te]=(0,b.useState)([]),ne=l??wN,re=u??TN,ie=d??EN,ae=(0,b.useRef)(D),oe=(0,b.useRef)(void 0),se=(0,b.useRef)(void 0),ce=(0,b.useRef)(k),le=(0,b.useRef)(j),ue=(0,b.useRef)(!1),de=(0,b.useRef)(N);(0,b.useLayoutEffect)(()=>{ae.current=D,ce.current=k,le.current=j,de.current=N});let fe=(0,b.useCallback)(e=>{let n=de.current;if(n.some(t=>t.value===e.value))return;if(x===0){f([e.resource]),ee([]);return}let r=[...n,e];if(x!==void 0){for(;r.length>x;)r.shift();r.length>=x&&(O(``),te([]),t.closeDropdown())}f(r.map(e=>e.resource)),ee(r)},[x,f,t,O,te]),pe=(0,b.useCallback)(()=>{if(A(void 0),ae.current===se.current&&c===oe.current||(ae.current?.length??0)<C)return;se.current=ae.current,oe.current=c;let e=new AbortController;M(e),c(ae.current??``,e.signal).then(n=>{if(!e.signal.aborted){let e=n.map(s);te(e),ue.current?(e.length>0&&fe(e[0]),ue.current=!1):n.length>0&&t.openDropdown()}}).catch(t=>{e.signal.aborted||t.message.includes(`aborted`)||q({color:`red`,message:J(t)})}).finally(()=>{e.signal.aborted||M(void 0)})},[t,c,fe,s,C,A,M]),F=(0,b.useCallback)(e=>{(P&&P.length>0||m)&&t.openDropdown(),t.updateSelectedOptionIndex(),O(e.currentTarget.value),le.current&&(le.current.abort(),M(void 0)),ce.current!==void 0&&window.clearTimeout(ce.current);let n=window.setTimeout(()=>pe(),100);A(n)},[t,P,m,pe,A,O,M]),me=(0,b.useCallback)(e=>{if(N.some(t=>t.value===e)){let t=N.filter(t=>t.value!==e);f(t.map(e=>e.resource)),ee(t)}else{let t=P?.find(t=>t.value===e);if(!t&&m!==!1&&p){let n=p(e);t=s(n)}t&&fe(t)}},[N,f,fe,p,s,P,m]),he=(0,b.useMemo)(()=>{if(!T)return e=>{T||(se.current=void 0,e===`$create`?(O(``),me(D)):me(e))}},[me,T,D,O]),ge=(0,b.useCallback)(e=>{let t=N.filter(t=>t.value!==e.value);f(t.map(e=>e.resource)),ee(t)},[N,f]),_e=(0,b.useCallback)(e=>{e.key===`Enter`?(k||j)&&(ue.current=!0):e.key===`Backspace`&&D.length===0&&(JM(e),ge(N[N.length-1]))},[j,ge,D.length,N,k]);(0,b.useEffect)(()=>()=>{le.current&&le.current.abort()},[]);let ve=!T&&h&&N.length>0&&(0,L.jsx)(Uf.ClearButton,{title:`Clear all`,size:`sm`,onClear:()=>{O(``),ee([]),f([]),t.closeDropdown()}}),ye=m&&D.trim().length>0,be=P.length>0||ye;return(0,L.jsxs)(Uf,{store:t,onOptionSubmit:he,withinPortal:!0,shadow:`xl`,...w,children:[(0,L.jsx)(Uf.DropdownTarget,{children:(0,L.jsx)(Og,{label:r,description:i,error:a,className:e.className,leftSection:y,rightSection:j?(0,L.jsx)(fu,{size:16}):ve,required:g,withAsterisk:_,disabled:T,children:(0,L.jsxs)(Cg.Group,{"data-testid":xN.selectedItems,children:[N.map(e=>(0,L.jsx)(re,{item:e,disabled:T,onRemove:()=>ge(e)},e.value)),!T&&(x===void 0||x===0||N.length<x)&&(0,L.jsx)(Uf.EventsTarget,{children:(0,L.jsx)(Og.Field,{role:`searchbox`,name:n,value:D,placeholder:v,onFocus:F,onBlur:()=>{t.closeDropdown(),O(``)},onKeyDown:_e,onChange:F})})]})})}),(0,L.jsx)(Uf.Dropdown,{hidden:!be,"data-testid":xN.options,children:(0,L.jsx)(Uf.Options,{children:(0,L.jsxs)(hl,{type:`scroll`,mah:S,children:[P.map(e=>{let t=N.some(t=>t.value===e.value);return(0,L.jsx)(Uf.Option,{value:e.value,active:t,children:(0,L.jsx)(ne,{...e,active:t})},e.value)}),ye&&(0,L.jsxs)(Uf.Option,{value:`$create`,children:[`+ Create `,D]}),!m&&D.trim().length>0&&P.length===0&&(0,L.jsx)(ie,{search:D})]})})})]})}function CN(e){return e?Array.isArray(e)?e:[e]:[]}function wN(e){return(0,L.jsxs)(V,{gap:`xs`,children:[e.active&&(0,L.jsx)(jj,{size:12}),(0,L.jsx)(`span`,{children:e.label})]})}function TN({item:e,disabled:t,onRemove:n}){return(0,L.jsx)(Cg,{withRemoveButton:!t,onRemove:n,children:e.label})}function EN(){return(0,L.jsx)(Uf.Empty,{children:`Nothing found`})}var DN={searchInput:`_searchInput_dick8_1`};function ON(e){return{value:e.id,label:MC(e),resource:e}}function kN(e){let t=Uk(),n=Z(),r=(0,b.useCallback)(async(e,t)=>{let r=jN(e),i={signal:t};return MN(await n.graphql(r,void 0,void 0,i),e)},[n]),i=(0,b.useCallback)(e=>{e.length>0&&t(`/${OC(e[0])}`)},[t]);return(0,L.jsx)(SN,{size:`sm`,radius:`md`,className:DN.searchInput,leftSection:(0,L.jsx)(DM,{size:16}),placeholder:`Search`,itemComponent:AN,toOption:ON,onChange:i,loadOptions:r,maxValues:0,clearable:!1},`${e.pathname}?${e.searchParams}`)}var AN=(0,b.forwardRef)(({resource:e,active:t,...n},r)=>{let i;return e.resourceType===`Patient`?i=e.birthDate:e.resourceType===`ServiceRequest`&&(i=e.subject?.display),(0,L.jsx)(`div`,{ref:r,...n,children:(0,L.jsxs)(V,{wrap:`nowrap`,children:[(0,L.jsx)(oN,{value:e}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(H,{children:MC(e)}),(0,L.jsx)(H,{size:`xs`,c:`dimmed`,children:i})]})]})})});function jN(e){let t=JSON.stringify(e);return tw(e)?`{
|
|
99
99
|
Patients1: PatientList(_id: ${t}, _count: 1) {
|
|
100
100
|
resourceType
|
|
101
101
|
id
|
|
@@ -205,9 +205,9 @@ ${o?`${s(`light`)}{${o}}`:``}`}function Mr({color:e,theme:t,autoContrast:n}){ret
|
|
|
205
205
|
}
|
|
206
206
|
}`.replaceAll(/\s+/g,` `);return(await e.graphql(r)).data.StructureDefinitionList[0]}function IL(e){return e.type===`profile`&&!e?.error&&GC(e.resourceType)}function LL(e,t,n){return t===void 0?e:n===void 0?t:`${t}[${n}]`}var RL={indented:`_indented_ldk1d_1`};function zL({propertyDisplayName:e,onClick:t,testId:n}){let r=e?`Add ${e}`:`Add`;return e?(0,L.jsx)(U,{title:r,size:`sm`,color:`green.6`,variant:`subtle`,"data-testid":n,leftSection:(0,L.jsx)(Ij,{size:`1.25rem`}),onClick:t,children:r}):(0,L.jsx)(bu,{title:r,color:`green.6`,"data-testid":n,onClick:t,children:(0,L.jsx)(Ij,{size:`1.25rem`})})}function BL({propertyDisplayName:e,onClick:t,testId:n}){return(0,L.jsx)(bu,{title:e?`Remove ${e}`:`Remove`,color:`red.5`,"data-testid":n,variant:`subtle`,onClick:t,children:(0,L.jsx)(Fj,{size:`1.25rem`})})}function VL(e){let{slice:t,property:n}=e,[r,i]=(0,b.useState)(e.defaultValue),a=t.typeSchema?.elements??t.elements,o=(0,b.useContext)(ij),s=(0,b.useMemo)(()=>{if(KC(a))return FO({parentContext:o,elements:a,path:e.path,profileUrl:t.typeSchema?.url})},[o,e.path,t.typeSchema?.url,a]);function c(t){i(t),e.onChange&&e.onChange(t)}let l=t.min>0,u=GC(t.elements),d=sT(t.name),f=e.property.readonly&&r.length===0;return VI(ij.Provider,s,(0,L.jsx)(eL,{title:d,description:t.definition,withAsterisk:l,fhirPath:`${n.path}:${t.name}`,testId:e.testId,readonly:e.property.readonly,children:f?(0,L.jsx)(H,{c:`dimmed`,children:`(empty)`}):(0,L.jsxs)(W,{className:u?RL.indented:void 0,children:[r.map((n,i)=>(0,L.jsxs)(V,{wrap:`nowrap`,children:[(0,L.jsx)(`div`,{style:{flexGrow:1},"data-testid":e.testId&&`${e.testId}-elements-${i}`,children:(0,L.jsx)(ZL,{elementDefinitionType:t.type[0],name:t.name,defaultValue:n,onChange:e=>{let t=[...r];t[i]=e,c(t)},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&&(0,L.jsx)(BL,{propertyDisplayName:d,testId:e.testId&&`${e.testId}-remove-${i}`,onClick:e=>{JM(e);let t=[...r];t.splice(i,1),c(t)}})]},`${i}-${r.length}`)),!e.property.readonly&&r.length<t.max&&(0,L.jsx)(V,{wrap:`nowrap`,style:{justifyContent:`flex-start`},children:(0,L.jsx)(zL,{propertyDisplayName:d,onClick:e=>{JM(e),c([...r,void 0])},testId:e.testId&&`${e.testId}-add`})})]})}))}function HL(e){let{property:t}=e,n=Z(),[r,i]=(0,b.useState)(!0),[a,o]=(0,b.useState)([]),[s]=(0,b.useState)(()=>Array.isArray(e.defaultValue)?e.defaultValue:[]),[c,l]=(0,b.useState)(()=>[s]),u=(0,b.useContext)(ij),d=t.type[0]?.code;(0,b.useEffect)(()=>{BI({medplum:n,property:t}).then(e=>{o(e);let n=zI(s,e,t.slicing,u.profileUrl);UL(n,e),l(n),i(!1)}).catch(e=>{console.error(e),i(!1)})},[n,t,s,u.profileUrl,l]);function f(t,n){let r=[...c];if(r[n]=t,l(r),e.onChange){let t=r.flat().filter(e=>e!==void 0);e.onChange(t)}}if(r)return(0,L.jsx)(`div`,{children:`Loading...`});let p=a.length,m=c[p],h=!(e.hideNonSliceValues??(d===`Extension`&&a.length>0)),g=oT(t.path),_=e.property.readonly&&a.length===0&&s.length===0;return(0,L.jsxs)(W,{className:e.indent?RL.indented:void 0,children:[_&&(0,L.jsx)(H,{c:`dimmed`,children:`(empty)`}),a.map((n,r)=>(0,L.jsx)(VL,{slice:n,path:e.path,valuePath:e.valuePath,property:t,defaultValue:c[r],onChange:e=>{f(e,r)},testId:`slice-${n.name}`},n.name)),h&&m.map((t,n)=>(0,L.jsxs)(V,{wrap:`nowrap`,style:{flexGrow:1},children:[(0,L.jsx)(`div`,{style:{flexGrow:1},children:(0,L.jsx)(YL,{arrayElement:!0,property:e.property,name:e.name+`.`+n,path:e.path,valuePath:LL(e.path,e.valuePath,n),defaultValue:t,onChange:e=>{let t=[...m];t[n]=e,f(t,p)},defaultPropertyType:void 0,outcome:e.outcome})}),!e.property.readonly&&(0,L.jsx)(BL,{propertyDisplayName:g,testId:`nonsliced-remove-${n}`,onClick:e=>{JM(e);let t=[...m];t.splice(n,1),f(t,p)}})]},`${n}-${m.length}`)),!e.property.readonly&&h&&c.flat().length<t.max&&(0,L.jsx)(V,{wrap:`nowrap`,style:{justifyContent:`flex-start`},children:(0,L.jsx)(zL,{propertyDisplayName:g,onClick:e=>{JM(e);let t=[...m];t.push(void 0),f(t,p)},testId:`nonsliced-add`})})]})}function UL(e,t){for(let n=0;n<t.length;n++){let r=t[n],i=e[n];for(;i.length<r.min;)i.push(void 0)}}function WL(e){let[t,n]=(0,b.useState)(!1),r=kt(),i=(0,b.useRef)(null),a={...e.styles};return t||(a.input||={},a.input.WebkitTextSecurity=`disc`),(0,L.jsxs)(xd,{gap:`xs`,children:[(0,L.jsx)(hh,{...e,styles:{...a,root:{...a.root??{},flexGrow:1}},ref:i,autosize:!0,minRows:1,onFocus:()=>n(!0),onBlur:()=>n(!1)}),(0,L.jsx)(bu,{title:`Copy secret`,onClick:()=>{r.copy(i.current?.value),q({color:`green`,message:`Copied`})},children:(0,L.jsx)(zj,{})})]})}var GL=[`sun`,`mon`,`tue`,`wed`,`thu`,`fri`,`sat`];function KL(e){let[t,n]=(0,b.useState)(e.defaultValue),[r,i]=(0,b.useState)(!e.disabled&&(e.defaultModalOpen??!1));return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(V,{gap:`xs`,grow:!0,wrap:`nowrap`,children:[(0,L.jsx)(`span`,{"data-testid":`timinginput-display`,children:zw(t)||`No repeat`}),(0,L.jsx)(U,{disabled:e.disabled,onClick:()=>i(!0),children:`Edit`})]}),!e.disabled&&(0,L.jsx)(JL,{path:e.path,visible:r,defaultValue:t,onOk:t=>{e.onChange&&e.onChange(t),n(t),i(!1)},onCancel:()=>i(!1)})]})}var qL={repeat:{period:1,periodUnit:`d`}};function JL(e){let[t,n]=(0,b.useState)(e.defaultValue||qL),[r,i]=(0,b.useState)(()=>(e.defaultValue?.repeat?.timeOfDay??[]).map((e,t)=>({id:t,value:e}))),a=(0,b.useRef)(r.length),{getExtendedProps:o}=(0,b.useContext)(ij),[s,c,l,u,d,f]=(0,b.useMemo)(()=>[`event`,`repeat`,`repeat.period`,`repeat.periodUnit`,`repeat.dayOfWeek`,`repeat.timeOfDay`].map(t=>o(e.path+`.`+t)),[o,e.path]);function p(e){n(t=>({...t,event:[e]}))}function m(e){n(t=>({...t,repeat:e}))}function h(e){n(t=>({...t,repeat:{...t.repeat,period:e}}))}function g(e){n(t=>({...t,repeat:{...t.repeat,periodUnit:e}}))}function _(e){n(t=>({...t,repeat:{...t.repeat,dayOfWeek:e}}))}function v(e){i(t=>{let r=e(t),i=r.map(e=>e.value);return n(e=>({...e,repeat:{...e.repeat,timeOfDay:i}})),r})}return(0,L.jsx)(pg,{title:`Timing`,closeButtonProps:{"aria-label":`Close`},opened:e.visible,onClose:()=>e.onCancel(),children:(0,L.jsxs)(W,{gap:`md`,children:[(0,L.jsx)(eL,{title:`Starts on`,htmlFor:`timing-dialog-start`,children:(0,L.jsx)(pL,{disabled:s?.readonly,name:`timing-dialog-start`,onChange:e=>p(e)})}),(0,L.jsx)(nb,{disabled:c?.readonly,label:`Repeat`,checked:!!t.repeat,onChange:e=>m(e.currentTarget.checked?qL.repeat:void 0)}),t.repeat&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(eL,{title:`Repeat every`,htmlFor:`timing-dialog-period`,children:(0,L.jsxs)(V,{gap:`xs`,grow:!0,wrap:`nowrap`,children:[(0,L.jsx)(jb,{disabled:l?.readonly,type:`number`,step:1,id:`timing-dialog-period`,name:`timing-dialog-period`,defaultValue:t.repeat.period||1,onChange:e=>h(Number.parseInt(e.currentTarget.value,10)||1)}),(0,L.jsx)(Ig,{disabled:u?.readonly,id:`timing-dialog-periodUnit`,name:`timing-dialog-periodUnit`,defaultValue:t.repeat.periodUnit,onChange:e=>g(e.currentTarget.value),data:[{label:`minute`,value:`min`},{label:`hour`,value:`h`},{label:`day`,value:`d`},{label:`week`,value:`wk`},{label:`month`,value:`mo`},{label:`year`,value:`a`}]})]})}),t.repeat.periodUnit===`wk`&&(0,L.jsx)(eL,{title:`Repeat on`,children:(0,L.jsx)(rm.Group,{multiple:!0,onChange:_,value:t.repeat?.dayOfWeek,children:(0,L.jsx)(V,{justify:`space-between`,mt:`xs`,gap:`xs`,children:GL.map(e=>(0,L.jsx)(rm,{value:e,size:`xs`,radius:`xl`,disabled:d?.readonly,checked:(t.repeat?.dayOfWeek??[]).includes(e),children:e.charAt(0).toUpperCase()},e))})})}),(0,L.jsx)(eL,{title:`At times`,children:(0,L.jsxs)(W,{mt:`xs`,children:[r.map((e,t)=>(0,L.jsxs)(V,{children:[(0,L.jsx)(jb,{disabled:f?.readonly,type:`time`,id:`timing-dialog-repeat-timeOfDay[${t}]`,name:`timing-dialog-repeat-timeOfDay[${t}]`,"data-testid":`timing-repeat-timeOfDay-input-${t}`,defaultValue:e.value.slice(0,5),onChange:n=>{let r=`${n.currentTarget.value}:00`;v(n=>n.with(t,{...e,value:r}))},style:{flexGrow:1}}),(0,L.jsx)(BL,{testId:`timing-repeat-timeOfDay-remove-${t}`,onClick:()=>v(e=>e.toSpliced(t,1))})]},e.id)),(0,L.jsx)(z,{children:(0,L.jsx)(zL,{propertyDisplayName:`Time of Day`,onClick:()=>v(e=>{let t=a.current++;return e.concat({id:t,value:`00:00:00`})})})})]})})]}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(U,{onClick:()=>e.onOk(t),children:`OK`})})]})})}function YL(e){let{property:t,name:n,onChange:r,defaultValue:i}=e,a=e.defaultPropertyType&&e.defaultPropertyType!==`undefined`?e.defaultPropertyType:t.type[0].code,o=t.type;if((t.isArray||t.max>1)&&!e.arrayElement){if(a===Y.Attachment)return(0,L.jsx)(jF,{name:n,defaultValue:i,onChange:r,disabled:t.readonly});let s=o[0]?.code!==Y.Extension;return(0,L.jsx)(HL,{property:t,name:n,path:e.path,valuePath:e.valuePath,defaultValue:i,indent:s,onChange:r,outcome:e.outcome})}return o.length>1?(0,L.jsx)(XL,{elementDefinitionTypes:o,...e}):(0,L.jsx)(ZL,{name:n,defaultValue:i,onChange:t=>{if(e.onChange){let n=e.name.replace(`[x]`,dw(o[0].code));e.onChange(t,n)}},outcome:e.outcome,elementDefinitionType:o[0],min:t.min,max:t.min,binding:t.binding,path:e.path,valuePath:e.valuePath,readOnly:t.readonly})}function XL(e){let t=e.elementDefinitionTypes,n;e.defaultPropertyType&&(n=t.find(t=>t.code===e.defaultPropertyType)),n||=t[0];let[r,i]=(0,b.useState)(n);return(0,L.jsxs)(V,{gap:`xs`,grow:!0,wrap:`nowrap`,align:`flex-start`,children:[(0,L.jsx)(Ig,{disabled:e.property.readonly,style:{width:`200px`},defaultValue:r.code,"data-testid":e.name&&e.name+`-selector`,onChange:e=>{i(t.find(t=>t.code===e.currentTarget.value))},data:t.map(e=>({value:e.code,label:e.code}))}),(0,L.jsx)(ZL,{name:e.name,defaultValue:e.defaultValue,outcome:e.outcome,elementDefinitionType:r,onChange:t=>{e.onChange&&e.onChange(t,e.name.replace(`[x]`,dw(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 ZL(e){let{name:t,onChange:n,outcome:r,binding:i,path:a,valuePath:o,readOnly:s}=e,c=e.min!==void 0&&e.min>0,l=e.elementDefinitionType.code,u=(0,b.useContext)(ij),d=(0,b.useMemo)(()=>{if(!fw(l)||!GC(e.defaultValue))return e.defaultValue;let t=Object.create(null);if(u.path===e.path)qO(t,u.elements);else{let n=pw(u.path,e.path);if(n===void 0)return e.defaultValue;qO(t,u.elements,n)}return KC(t)?t:e.defaultValue},[l,u.path,u.elements,e.path,e.defaultValue]);if(!l)return(0,L.jsx)(`div`,{children:`Property type not specified `});function f(){return{name:t,defaultValue:d,onChange:n,outcome:r,path:a,valuePath:o,disabled:s}}function p(){let n=BF(e.outcome,o??a);return{id:t,name:t,"data-testid":t,defaultValue:d,required:c,error:n,disabled:s}}switch(l){case Y.SystemString:case Y.canonical:case Y.id:case Y.string:case Y.uri:case Y.url:return e.path===`Project.secret.value[x]`||e.path===`ClientApplication.certificateTrustStore`?(0,L.jsx)(WL,{...p(),onChange:t=>{e.onChange&&e.onChange(t.currentTarget.value)}}):(0,L.jsx)(jb,{...p(),onChange:e=>{n&&n(e.currentTarget.value)}});case Y.date:return(0,L.jsx)(jb,{...p(),type:`date`,onChange:e=>{n&&n(e.currentTarget.value)}});case Y.time:return(0,L.jsx)(jb,{...p(),type:`time`,step:1,onChange:e=>{n&&n(e.currentTarget.value)}});case Y.dateTime:case Y.instant:return(0,L.jsx)(pL,{...p(),onChange:n,outcome:r});case Y.decimal:case Y.integer:case Y.positiveInt:case Y.unsignedInt:return(0,L.jsx)(jb,{...p(),type:`number`,step:l===Y.decimal?`any`:`1`,onChange:e=>{if(n){let t=e.currentTarget.valueAsNumber;n(Number.isNaN(t)?void 0:t)}}});case Y.code:return(0,L.jsx)(KP,{...p(),error:void 0,onChange:n,binding:i?.valueSet,creatable:!0,maxValues:1});case Y.boolean:return(0,L.jsx)(pp,{...p(),defaultChecked:!!d,onChange:e=>{n&&n(e.currentTarget.checked)}});case Y.base64Binary:case Y.markdown:case Y.xhtml:return(0,L.jsx)(hh,{...p(),spellCheck:l!==Y.base64Binary,onChange:e=>{n&&n(e.currentTarget.value)}});case Y.Address:return(0,L.jsx)(uj,{...f()});case Y.Annotation:return(0,L.jsx)(dj,{...f()});case Y.Attachment:return(0,L.jsx)(MF,{...f()});case Y.CodeableConcept:return(0,L.jsx)(rL,{binding:i?.valueSet,...f()});case Y.Coding:return(0,L.jsx)(oL,{binding:i?.valueSet,...f()});case Y.ContactDetail:return(0,L.jsx)(uL,{...f()});case Y.ContactPoint:return(0,L.jsx)(lL,{...f()});case Y.Extension:return(0,L.jsx)(hL,{...f(),propertyType:e.elementDefinitionType});case Y.HumanName:return(0,L.jsx)(gL,{...f()});case Y.Identifier:return(0,L.jsx)(_L,{...f()});case Y.Money:return(0,L.jsx)(yL,{...f()});case Y.Period:return(0,L.jsx)(bL,{...f()});case Y.Duration:case Y.Quantity:return(0,L.jsx)(xL,{...f()});case Y.Range:return(0,L.jsx)(CL,{...f()});case Y.Ratio:return(0,L.jsx)(wL,{...f()});case Y.Reference:return(0,L.jsx)(ML,{...f(),targetTypes:$L(e.elementDefinitionType)});case Y.Timing:return(0,L.jsx)(KL,{...f()});case Y.Dosage:case Y.UsageContext:default:return(0,L.jsx)(nR,{...f(),typeName:l})}}var QL=[`${Bx}/fhir/StructureDefinition/`,`https://medplum.com/fhir/StructureDefinition/`];function $L(e){return e?.targetProfile?.map(e=>{let t=QL.find(t=>e.startsWith(t));return t?e.slice(t.length):e})}function eR(e){let[t,n]=(0,b.useState)(e.defaultValue??{}),r=(0,b.useContext)(ij),i=(0,b.useMemo)(()=>sj(r.elements),[r.elements]);function a(t){n(t),e.onChange&&e.onChange(t)}let o={type:e.type,value:t};return(0,L.jsx)(W,{style:{flexGrow:1},"data-testid":e.testId,children:i.map(([n,r])=>{let[i,s]=AI(o,n,r),c=r.min!==void 0&&r.min>0,l=e.valuePath?e.valuePath+`.`+n:void 0,u=(0,L.jsx)(YL,{property:r,name:n,path:e.path+`.`+n,valuePath:l,defaultValue:i,defaultPropertyType:s,onChange:(e,i)=>{a(tL({...t},n,i??n,r,e))},outcome:e.outcome},n);return e.type===`Extension`||aj.includes(n)?u:r.type.length===1&&r.type[0].code===`boolean`?(0,L.jsx)($I,{title:oT(n),description:r.description,htmlFor:n,fhirPath:r.path,withAsterisk:c,readonly:r.readonly,children:u},n):(0,L.jsx)(eL,{title:oT(n),description:r.description,withAsterisk:c,htmlFor:n,outcome:e.outcome,fhirPath:r.path,errorExpression:l,readonly:r.readonly,children:u},n)})})}var tR={nested:`_nested_1ya4k_1`};function nR(e){let[t]=(0,b.useState)(()=>e.defaultValue??{}),n=(0,b.useContext)(ij),r=e.profileUrl??n?.profileUrl,i=(0,b.useMemo)(()=>FS(e.typeName,r),[e.typeName,r]),a=i?.type??e.typeName,o=(0,b.useMemo)(()=>{if(i)return FO({parentContext:n,elements:i.elements,path:e.path,profileUrl:i.url,accessPolicyResource:e.accessPolicyResource})},[i,n,e.path,e.accessPolicyResource]);if(!i)return(0,L.jsxs)(`div`,{children:[a,`\xA0not implemented`]});let s=n.path!==``;return VI(ij.Provider,o,(0,L.jsx)(z,{className:Ln({[tR.nested]:s}),children:(0,L.jsx)(eR,{path:e.path,valuePath:e.valuePath,type:a,defaultValue:t,onChange:e.onChange,outcome:e.outcome})}))}var rR={modal:`_modal_jifq4_2`,content:`_content_jifq4_9`,header:`_header_jifq4_15`,title:`_title_jifq4_24`,body:`_body_jifq4_29`,scroll:`_scroll_jifq4_38`,footer:`_footer_jifq4_47`},iR={display:`flex`,flexDirection:`column`,flex:`1 1 auto`,minHeight:0};function aR(e){let{children:t,actions:n,onSubmit:r,bodyHeight:i,classNames:a,style:o,closeButtonProps:s,centered:c=!0,padding:l=`lg`,radius:u=`md`,...d}=e,f=(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:rR.scroll,children:t}),n&&(0,L.jsx)(`div`,{className:rR.footer,children:n})]});return(0,L.jsx)(pg,{...d,centered:c,padding:l,radius:u,closeButtonProps:{"aria-label":`Close`,radius:`xl`,...s},classNames:{...a,root:Ln(rR.modal,a?.root),content:Ln(rR.content,a?.content),header:Ln(rR.header,a?.header),title:Ln(rR.title,a?.title),body:Ln(rR.body,a?.body)},style:i?[o,{"--medplum-modal-body-height":i}]:o,children:r?(0,L.jsx)(NP,{onSubmit:r,style:iR,children:f}):f})}var oR={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 sR(e){let{status:t,...n}=e;return(0,L.jsx)(Ip,{color:e.color||oR[t],...n,children:t.replaceAll(`-`,` `)})}var cR={noteBody:`_noteBody_u8s69_1`,noteCite:`_noteCite_u8s69_5`,noteRoot:`_noteRoot_u8s69_10`};function lR({value:e}){return e?(0,L.jsx)(W,{justify:`flex-start`,gap:`xs`,children:e.map(e=>e.text&&(0,L.jsx)(Bp,{classNames:{cite:cR.noteCite,root:cR.noteRoot},cite:e.authorReference?.display||e.authorString,icon:null,children:e.text},`note-${e.text}`))}):null}function uR(e){let{value:t,link:n,...r}=e,[i,a]=(0,b.useState)(),o=eA(t,a),s;if(i&&!hS(i))s=`[${J(i)}]`;else if(o)s=MC(o);else return null;return n?(0,L.jsx)(eN,{to:t,...r,children:s}):(0,L.jsx)(H,{component:`span`,...r,children:s})}function dR(e){return(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(oN,{size:24,radius:12,value:e.value,link:e.link}),(0,L.jsx)(uR,{value:e.value,link:e.link})]})}var fR={table:`_table_15n6u_1`,groupHeaderRow:`_groupHeaderRow_15n6u_16`,criticalRow:`_criticalRow_15n6u_21`,noteBody:`_noteBody_15n6u_32`,noteCite:`_noteCite_15n6u_36`,noteRoot:`_noteRoot_15n6u_41`};pR.defaultProps={hideObservationNotes:!1,hideSpecimenInfo:!1,hideSubject:!1};function pR(e){let t=Z(),n=eA(e.value),[r,i]=(0,b.useState)();if((0,b.useEffect)(()=>{n?.specimen&&Promise.allSettled(n.specimen.map(e=>t.readReference(e))).then(e=>e.filter(e=>e.status===`fulfilled`).map(e=>e.value)).then(i).catch(console.error)},[t,n]),!n)return null;let a=r?.flatMap(e=>e.note||[])||[];if(n.presentedForm&&n.presentedForm.length>0){let e=n.presentedForm[0];e.contentType?.startsWith(`text/plain`)&&e.data&&a.push({text:window.atob(e.data)})}return(0,L.jsxs)(W,{children:[(0,L.jsx)(K,{children:`Diagnostic Report`}),(0,L.jsx)(mR,{value:n,hideSubject:e.hideSubject}),r&&!e.hideSpecimenInfo&&_R(r),n.result&&(0,L.jsx)(vR,{hideObservationNotes:e.hideObservationNotes,value:n.result}),a.length>0&&(0,L.jsx)(lR,{value:a}),n.conclusion&&(0,L.jsxs)(W,{mt:`md`,children:[(0,L.jsx)(H,{fw:500,size:`sm`,c:`dimmed`,children:`Conclusion`}),(0,L.jsx)(H,{children:n.conclusion})]}),(0,L.jsx)(kR,{value:n})]})}function mR({value:e,hideSubject:t=!1}){let n=eA(e.basedOn?.[0]),r=n?.resourceType===`ServiceRequest`?n.requester:void 0,i=!(!e.subject||t),a=i||!!r||!!e.resultsInterpreter?.length,o=!!(e.performer?.length||e.issued||e.status);return(0,L.jsxs)(V,{mt:`md`,gap:`xl`,align:`stretch`,wrap:`nowrap`,children:[a&&(0,L.jsxs)(W,{gap:`md`,style:{flex:1},children:[i&&(0,L.jsx)(hR,{label:`Subject`,children:(0,L.jsx)(dR,{value:e.subject,link:!0})}),r&&(0,L.jsx)(hR,{label:`Ordering`,children:(0,L.jsx)(dR,{value:r,link:!0})}),e.resultsInterpreter?.map(e=>(0,L.jsx)(hR,{label:`Interpreter`,children:(0,L.jsx)(dR,{value:e,link:!0})},e.reference))]}),a&&o&&(0,L.jsx)(hm,{orientation:`vertical`}),o&&(0,L.jsxs)(W,{gap:`md`,style:{flex:1},children:[e.performer?.map(e=>(0,L.jsx)(hR,{label:`Performer`,children:(0,L.jsx)(gR,{value:e})},e.reference)),e.issued&&(0,L.jsx)(hR,{label:`Issued`,children:(0,L.jsx)(H,{children:Pw(e.issued)})}),e.status&&(0,L.jsx)(hR,{label:`Status`,children:(0,L.jsx)(sR,{status:e.status})})]})]})}function hR({label:e,children:t}){return(0,L.jsxs)(V,{gap:`md`,align:`flex-start`,wrap:`nowrap`,children:[(0,L.jsx)(H,{c:`dimmed`,w:110,style:{flexShrink:0},children:e}),(0,L.jsx)(`div`,{children:t})]})}function gR({value:e}){let t=eA(e),n=t?.resourceType===`Organization`?t.address?.[0]:void 0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(dR,{value:e,link:!0}),n&&(0,L.jsx)(H,{size:`sm`,c:`dimmed`,mt:4,ml:34,children:(0,L.jsx)(tj,{value:n})})]})}function _R(e){return(0,L.jsxs)(W,{gap:`xs`,children:[(0,L.jsx)(K,{order:2,size:`h6`,children:`Specimens`}),(0,L.jsx)(Oh,{type:`ordered`,children:e?.map(e=>(0,L.jsx)(Oh.Item,{ml:`sm`,children:(0,L.jsxs)(V,{gap:20,children:[(0,L.jsxs)(V,{gap:5,children:[(0,L.jsx)(H,{fw:500,children:`Collected:`}),` `,Pw(e.collection?.collectedDateTime)]}),(0,L.jsxs)(V,{gap:5,children:[(0,L.jsx)(H,{fw:500,children:`Received:`}),` `,Pw(e.receivedTime)]})]})},`specimen-${e.id}`))})]})}function vR(e){return(0,L.jsxs)(`table`,{className:fR.table,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Test`}),(0,L.jsx)(`th`,{children:`Value`}),(0,L.jsx)(`th`,{children:`Reference Range`}),(0,L.jsx)(`th`,{children:`Interpretation`}),(0,L.jsx)(`th`,{children:`Category`}),(0,L.jsx)(`th`,{children:`Performer`}),(0,L.jsx)(`th`,{children:`Status`})]})}),(0,L.jsx)(`tbody`,{children:(0,L.jsx)(yR,{value:e.value,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes})})]})}function yR(e){return(0,L.jsx)(L.Fragment,{children:e.value?.map(t=>(0,L.jsx)(bR,{value:t,ancestorIds:e.ancestorIds,hideObservationNotes:e.hideObservationNotes},`obs-${pT(t)?t.reference:t.id}`))})}function bR(e){let t=eA(e.value);if(!t||e.ancestorIds?.includes(t.id)||ER(t))return null;let n=!e.hideObservationNotes&&t.note,r=OR(t),i=e.ancestorIds?.length??0,a=t.hasMember&&(0,L.jsx)(yR,{value:t.hasMember,ancestorIds:e.ancestorIds?[...e.ancestorIds,t.id]:[t.id],hideObservationNotes:e.hideObservationNotes});return DR(t)?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`tr`,{className:fR.groupHeaderRow,children:(0,L.jsx)(`td`,{colSpan:7,style:wR(i),children:(0,L.jsxs)(V,{gap:`sm`,children:[(0,L.jsx)(eN,{to:t,children:(0,L.jsx)(TI,{value:t.code})}),t.effectiveDateTime&&(0,L.jsxs)(H,{size:`sm`,c:`dimmed`,fw:400,children:[`Collected: `,Pw(t.effectiveDateTime)]})]})})}),n&&(0,L.jsx)(`tr`,{children:(0,L.jsx)(`td`,{colSpan:7,style:wR(i+1),children:(0,L.jsx)(lR,{value:t.note})})}),a]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`tr`,{className:Ln({[fR.criticalRow]:r}),children:[(0,L.jsx)(`td`,{rowSpan:n?2:1,style:wR(i),children:(0,L.jsx)(eN,{to:t,children:(0,L.jsx)(TI,{value:t.code})})}),(0,L.jsx)(`td`,{children:(0,L.jsx)(SR,{value:t})}),(0,L.jsx)(`td`,{children:(0,L.jsx)(CR,{value:t.referenceRange})}),(0,L.jsx)(`td`,{children:t.interpretation&&t.interpretation.length>0&&(0,L.jsx)(TI,{value:t.interpretation[0]})}),(0,L.jsx)(`td`,{children:t.category&&t.category.length>0&&(0,L.jsx)(L.Fragment,{children:t.category.map(e=>(0,L.jsx)(`div`,{children:(0,L.jsx)(TI,{value:e})},`category-${Ww(e)}`))})}),(0,L.jsx)(`td`,{children:t.performer?.map(e=>(0,L.jsx)(xR,{value:e},e.reference))}),(0,L.jsx)(`td`,{children:t.status&&(0,L.jsx)(sR,{status:t.status})})]}),a,n&&(0,L.jsx)(`tr`,{children:(0,L.jsx)(`td`,{colSpan:6,children:(0,L.jsx)(lR,{value:t.note})})})]})}function xR(e){let t=eA(e.value);return t?(0,L.jsx)(eN,{to:e.value,children:MC(t)}):(0,L.jsx)(RI,{value:e.value})}function SR(e){let t=e.value;return(0,L.jsx)(L.Fragment,{children:Kw(t)})}function CR(e){let t=e.value&&e.value.length>0&&e.value[0];return t?t.text?(0,L.jsx)(L.Fragment,{children:t.text}):(0,L.jsx)(II,{value:t}):null}function wR(e){return e>0?{paddingInlineStart:`calc(4px + ${e} * var(--mantine-spacing-md))`}:void 0}var TR=`DNR`;function ER(e){return!e.hasMember?.length&&Kw(e)===TR}function DR(e){return e.hasMember?.length?!(Kw(e)||e.dataAbsentReason||e.interpretation?.length||e.referenceRange?.length):!1}function OR(e){let t=e.interpretation?.[0]?.coding?.[0]?.code;if(t!==void 0)return t===`AA`||t===`LL`||t===`HH`||t===`A`;let n=e.interpretation?.[0].text;return n===`Critical abnormal`||n===`Critical high`||n===`Critical low`||n===`Critical`||n===`Abnormal`}function kR({value:e}){let t=Z(),[n,r]=(0,b.useState)();return(0,b.useEffect)(()=>{jR(t,e).then(r).catch(console.error)},[t,e]),!n||n.length===0?null:(0,L.jsxs)(W,{gap:`xs`,mt:`md`,children:[(0,L.jsx)(hm,{}),(0,L.jsx)(H,{fw:500,size:`sm`,c:`dimmed`,children:`Performing Labs`}),n.map(e=>(0,L.jsxs)(V,{justify:`space-between`,align:`flex-start`,wrap:`nowrap`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(H,{children:e.name}),e.address?.[0]&&(0,L.jsx)(H,{size:`sm`,c:`dimmed`,children:(0,L.jsx)(tj,{value:e.address[0]})})]}),(0,L.jsx)(AR,{value:e.contact?.[0]})]},`lab-${e.id}-${e.name}`))]})}function AR({value:e}){return e?(0,L.jsxs)(`div`,{style:{textAlign:`right`},children:[e.name&&(0,L.jsx)(H,{children:e.name.text??jw(e.name)}),e.telecom?.[0]&&(0,L.jsx)(H,{size:`sm`,c:`dimmed`,children:(0,L.jsx)(DI,{value:e.telecom[0]})})]}):null}async function jR(e,t){let n=[],r=new Set;async function i(a){let o=a.reference;if(!o||r.has(o))return;r.add(o);let s=o.startsWith(`#`)?MR(t,o,`Observation`):await e.readReference(a).catch(()=>void 0);if(s){n.push(s);for(let e of s.hasMember??[])await i(e)}}for(let e of t.result??[])await i(e);let a=new Map;for(let r of n.flatMap(e=>e.performer??[])){let n=r.reference,i;if(n?.startsWith(`#`)?i=MR(t,n,`Organization`):n?.startsWith(`Organization/`)&&(i=await e.readReference(r).catch(()=>void 0)),i&&(i.address||i.contact)){let e=`${i.name}|${Aw(i.address?.[0])}`;a.has(e)||a.set(e,i)}}return Array.from(a.values())}function MR(e,t,n){let r=t.slice(1);return e.contained?.find(e=>e.resourceType===n&&e.id===r)}function NR(e,t){e.sort((e,n)=>{let r=PR(e,t),i=PR(n,t);return r>i?1:r<i?-1:FR(e,t)-FR(n,t)})}function PR(e,t){if(!IR(e,t)){let t=e.priority;if(typeof t==`string`)return{stat:4,asap:3,urgent:2}[t]??0}return 0}function FR(e,t){if(!IR(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()}let n=e.meta?.lastUpdated;return n?new Date(n).getTime():0}function IR(e,t){return!!t&&e.resourceType===t.resourceType&&e.id===t.id}var LR={removed:`_removed_el5zk_1`,added:`_added_el5zk_6`};function RR(e){let{name:t,path:n,property:r,originalValue:i,revisedValue:a}=e,o=!!r?.type?.find(e=>e.code===`Attachment`),[s,c]=(0,b.useState)(o);return(0,L.jsx)(L.Fragment,{children:o&&!s||!o?(0,L.jsx)(L.Fragment,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:t}),(0,L.jsx)(G.Td,{className:LR.removed,children:i&&(0,L.jsx)(GI,{path:n,property:r,propertyType:i.type,value:i.value,ignoreMissingValues:!0})}),(0,L.jsx)(G.Td,{className:LR.added,children:a&&(0,L.jsx)(GI,{path:n,property:r,propertyType:a.type,value:a.value,ignoreMissingValues:!0})})]})}):(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:t}),(0,L.jsx)(G.Td,{colSpan:2,style:{textAlign:`right`},children:(0,L.jsx)(U,{onClick:()=>c(e=>!e),variant:`light`,children:`Expand`})})]})})}var zR={root:`_root_15xvr_1`,removed:`_removed_15xvr_20`,added:`_added_15xvr_25`};function BR(e){let t=Z(),{original:n,revised:r}=e,[i,a]=(0,b.useState)(!1);(0,b.useEffect)(()=>{t.requestSchema(e.original.resourceType).then(()=>a(!0)).catch(console.log)},[t,e.original.resourceType]);let o=(0,b.useMemo)(()=>{if(!i)return null;let e=[$S(n)],t=[$S(r)],a=[],o=VR(mk(n,r));for(let r of o){let i=r.path,o=HR(i),s=UR(n.resourceType,o),c=r.op===`add`?void 0:uE(o,e),l=r.op===`remove`?void 0:uE(o,t);a.push({key:`op-${r.op}-${r.path}`,name:`${dw(r.op)} ${o}`,path:s?.path??n.resourceType+`.`+o,property:s,originalValue:WR(s,c),revisedValue:WR(s,l)})}return a},[i,n,r]);return o?(0,L.jsxs)(G,{className:zR.root,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{}),(0,L.jsx)(G.Th,{children:`Before`}),(0,L.jsx)(G.Th,{children:`After`})]})}),(0,L.jsx)(G.Tbody,{children:o.map(e=>{let{key:t,...n}=e;return(0,L.jsx)(RR,{...n},t)})})]}):null}function VR(e){let t=[];for(let n of e){let{op:r,path:i}=n;if(i.startsWith(`/meta/author`)||i.startsWith(`/meta/compartment`)||i.startsWith(`/meta/lastUpdated`)||i.startsWith(`/meta/versionId`))continue;let a=e.filter(e=>e.op===r&&e.path===i).length,o={op:r,path:i};a>1&&(r===`add`||r===`remove`)&&/\/[0-9-]+$/.test(i)&&(o.op=`replace`,o.path=i.replace(/\/[^/]+$/,``)),t.some(e=>e.op===o.op&&e.path===o.path)||t.push(o)}return t}function HR(e){let t=e.split(`/`).filter(Boolean),n=``;for(let e=0;e<t.length;e++){let r=t[e];r===`-`?n+=`.last()`:/^\d+$/.test(r)?n+=`[${r}]`:(e>0&&(n+=`.`),n+=r)}return n.endsWith(`.url`)&&(n=n.replace(/\.url$/,``)),n}function UR(e,t){try{return vk(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 WR(e,t){if(!(!t||Array.isArray(t)&&t.length===0))return{type:Array.isArray(t)?t[0].type:t.type,value:GR(t,!!e?.isArray)}}function GR(e,t){let n=zx(e).flatMap(e=>e.value);return t?n:n[0]}function KR(e){let{profileUrl:t}=e,n=Z(),r=n.getAccessPolicy(),i=eA(e.value),[a,o]=(0,b.useState)(!1);(0,b.useEffect)(()=>{if(i){if(t)n.requestProfileSchema(t,{expandProfile:!0}).then(()=>{RS(t)?o(!0):console.error(`Schema not found for ${t}`)}).catch(e=>{console.error(`Error in requestProfileSchema`,e)});else{let e=i.resourceType;n.requestSchema(e).then(()=>{o(!0)}).catch(console.error)}}},[n,t,i]);let s=(0,b.useMemo)(()=>i&&aD(i,tD.READ,r),[r,i]);return!a||!i?null:(0,L.jsx)(YI,{path:i.resourceType,value:{type:i.resourceType,value:e.forceUseInput?e.value:i},profileUrl:t,ignoreMissingValues:e.ignoreMissingValues,accessPolicyResource:s})}var qR={item:`_item_5q6yx_1`,itemPadding:`_itemPadding_5q6yx_5`};function JR(e){return(0,L.jsx)(PF,{w:`100%`,children:e.children})}function YR(e){let{resource:t,profile:n,padding:r,popupMenuItems:i,...a}=e,o=n??t.meta?.author,s=t.meta?.onBehalfOf,c=e.dateTime??t.meta?.lastUpdated;return(0,L.jsxs)(IF,{"data-testid":`timeline-item`,fill:!0,...a,children:[(0,L.jsxs)(V,{justify:`space-between`,gap:8,mx:`xs`,my:`sm`,children:[(0,L.jsx)(oN,{value:o,link:!0,size:`md`}),(0,L.jsxs)(`div`,{style:{flex:1},children:[(0,L.jsxs)(H,{size:`sm`,children:[(0,L.jsx)(uR,{c:`inherit`,fw:500,value:o,link:!0}),s&&(0,L.jsxs)(H,{component:`span`,size:`xs`,c:`dimmed`,children:[` on behalf of `,(0,L.jsx)(uR,{c:`inherit`,value:s,link:!0})]})]}),(0,L.jsxs)(H,{size:`xs`,children:[(0,L.jsx)(eN,{c:`dimmed`,to:e.resource,children:Pw(c)}),(0,L.jsx)(H,{component:`span`,c:`dimmed`,mx:8,children:`·`}),(0,L.jsx)(eN,{c:`dimmed`,to:e.resource,children:e.resource.resourceType})]})]}),i&&(0,L.jsxs)(Xh,{position:`bottom-end`,shadow:`md`,width:200,children:[(0,L.jsx)(Xh.Target,{children:(0,L.jsx)(bu,{color:`gray`,variant:`subtle`,radius:`xl`,"aria-label":`Actions for ${OC(e.resource)}`,children:(0,L.jsx)(Wj,{})})}),i]})]}),(0,L.jsx)(WM,{children:(0,L.jsx)(`div`,{className:Ln(qR.item,{[qR.itemPadding]:r}),children:e.children})})]})}function XR(e){let t=e.lines??4;return(0,L.jsxs)(IF,{"data-testid":`timeline-item-skeleton`,fill:!0,children:[(0,L.jsxs)(V,{gap:8,mx:`xs`,my:`sm`,wrap:`nowrap`,children:[(0,L.jsx)(Py,{circle:!0,height:38}),(0,L.jsxs)(W,{gap:8,style:{flex:1},children:[(0,L.jsx)(Py,{height:16,width:`28%`}),(0,L.jsx)(Py,{height:12,width:`40%`})]})]}),(0,L.jsxs)(W,{gap:`md`,className:qR.itemPadding,children:[(0,L.jsx)(Py,{height:24,width:`35%`,mb:`xs`}),Array.from({length:t},(e,t)=>(0,L.jsx)(Py,{height:18},t))]})]})}var ZR={pinnedComment:`_pinnedComment_u08s5_1`};function QR(e){let t=Z(),n=t.getProfile(),r=(0,b.useRef)(null),i=eA(e.value),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)([]),[l,u]=(0,b.useState)(10),[d,f]=(0,b.useState)(!0),p=e.loadTimelineResources,m=(0,b.useRef)(s);(0,b.useLayoutEffect)(()=>{m.current=s});let h=(0,b.useCallback)(e=>{NR(e,i),e.reverse(),c(e)},[i]),g=(0,b.useCallback)(e=>{let t=[];for(let n of e){if(n.status!==`fulfilled`)continue;let e=n.value;if(e.type===`history`&&o(e),e.entry)for(let n of e.entry)t.push(n.resource)}h(t),f(!1)},[h]),_=(0,b.useCallback)(e=>h([...m.current,e]),[h]),v=(0,b.useCallback)(()=>{let n,r;`resourceType`in e.value?(n=e.value.resourceType,r=e.value.id):[n,r]=e.value.reference?.split(`/`),p(t,n,r).then(g).catch(e=>{console.error(e),f(!1)})},[t,e.value,p,g]);(0,b.useEffect)(()=>v(),[v]);function y(r){i&&e.createCommunication&&t.createResource(e.createCommunication(i,n,r)).then(e=>_(e)).catch(console.error)}function x(r){i&&e.createMedia&&t.createResource(e.createMedia(i,n,r)).then(e=>_(e)).then(()=>Jb({id:`upload-notification`,color:`teal`,title:`Upload complete`,message:``,icon:(0,L.jsx)(jj,{size:16}),autoClose:2e3})).catch(e=>Jb({id:`upload-notification`,color:`red`,title:`Upload error`,message:J(e),icon:(0,L.jsx)(Xj,{size:16}),autoClose:2e3}))}function S(){q({id:`upload-notification`,loading:!0,title:`Initializing upload...`,message:`Please wait...`,autoClose:!1,withCloseButton:!1})}function C(e){Jb({id:`upload-notification`,loading:!0,title:`Uploading...`,message:oz(e),autoClose:!1,withCloseButton:!1})}function w(e){Jb({id:`upload-notification`,color:`red`,title:`Upload error`,message:J(e),icon:(0,L.jsx)(Xj,{size:16}),autoClose:2e3})}if(!i)return(0,L.jsx)(JR,{children:(0,L.jsx)($R,{})});let T=s.filter(e=>e).slice(0,l);return(0,L.jsxs)(JR,{children:[e.createCommunication&&(0,L.jsx)(IF,{children:(0,L.jsx)(NP,{testid:`timeline-form`,onSubmit:e=>{y(e.text);let t=r.current;t&&(t.value=``,t.focus())},children:(0,L.jsxs)(V,{gap:`xs`,wrap:`nowrap`,style:{width:`100%`},children:[(0,L.jsx)(oN,{value:n}),(0,L.jsx)(jb,{name:`text`,ref:r,placeholder:`Add comment`,style:{width:`100%`,maxWidth:300}}),(0,L.jsx)(bu,{type:`submit`,radius:`xl`,color:`blue`,variant:`filled`,children:(0,L.jsx)(uM,{size:16})}),(0,L.jsx)(AF,{securityContext:DC(i),onUpload:x,onUploadStart:S,onUploadProgress:C,onUploadError:w,children:e=>(0,L.jsx)(bu,{...e,radius:`xl`,color:`blue`,variant:`filled`,children:(0,L.jsx)(Lj,{size:16})})})]})})}),d&&s.length===0&&(0,L.jsx)($R,{}),T.map(t=>{let n=`${t.resourceType}/${t.id}/${t.meta?.versionId}`,r=e.getMenu?e.getMenu({primaryResource:i,currentResource:t,reloadTimeline:v}):void 0;if(t.resourceType===i.resourceType&&t.id===i.id)return(0,L.jsx)(ez,{history:a,resource:t,popupMenuItems:r},n);switch(t.resourceType){case`AuditEvent`:return(0,L.jsx)(iz,{resource:t,popupMenuItems:r},n);case`Communication`:return(0,L.jsx)(nz,{resource:t,popupMenuItems:r},n);case`DiagnosticReport`:return(0,L.jsx)(az,{resource:t,popupMenuItems:r},n);case`Media`:return(0,L.jsx)(rz,{resource:t,popupMenuItems:r},n);default:return(0,L.jsx)(YR,{resource:t,padding:!0,children:(0,L.jsx)(KR,{value:t,ignoreMissingValues:!0})},n)}}),l<s.length&&(0,L.jsx)(V,{justify:`center`,pb:`lg`,children:(0,L.jsx)(U,{onClick:()=>u(l+10),children:`Show More`})})]})}function $R(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(XR,{lines:3}),(0,L.jsx)(XR,{lines:6}),(0,L.jsx)(XR,{lines:4})]})}function ez(e){let{history:t,resource:n,...r}=e,i=tz(t,n);return i?(0,L.jsx)(YR,{resource:n,padding:!0,...r,children:(0,L.jsx)(BR,{original:i,revised:e.resource})}):(0,L.jsxs)(YR,{resource:n,padding:!0,...r,children:[(0,L.jsx)(`h3`,{children:`Created`}),(0,L.jsx)(KR,{value:n,ignoreMissingValues:!0,forceUseInput:!0})]})}function tz(e,t){let n=e.entry??[],r=n.findIndex(e=>e.resource?.meta?.versionId===t.meta?.versionId);if(!(r>=n.length-1))return n[r+1].resource}function nz(e){let t=!e.resource.priority||e.resource.priority===`routine`?void 0:ZR.pinnedComment;return(0,L.jsx)(YR,{resource:e.resource,profile:e.resource.sender,dateTime:e.resource.sent,padding:!0,className:t,popupMenuItems:e.popupMenuItems,children:(0,L.jsx)(`p`,{children:e.resource.payload?.[0]?.contentString})})}function rz(e){let t=e.resource.content?.contentType,n=t&&!t.startsWith(`image/`)&&!t.startsWith(`video/`)&&t!==`application/pdf`;return(0,L.jsx)(YR,{resource:e.resource,padding:!!n,popupMenuItems:e.popupMenuItems,children:(0,L.jsx)(wF,{value:e.resource.content})})}function iz(e){return(0,L.jsx)(YR,{resource:e.resource,padding:!0,popupMenuItems:e.popupMenuItems,children:(0,L.jsx)(ml,{children:(0,L.jsx)(`pre`,{children:e.resource.outcomeDesc})})})}function az(e){return(0,L.jsx)(YR,{resource:e.resource,padding:!0,popupMenuItems:e.popupMenuItems,children:(0,L.jsx)(pR,{value:e.resource})})}function oz(e){if(e.lengthComputable){let t=100*e.loaded/e.total;return`Uploaded: ${sz(e.loaded)} / ${sz(e.total)} ${t.toFixed(2)}%`}return`Uploaded: ${sz(e.loaded)}`}function sz(e){if(e===0)return`0.00 B`;let t=Math.floor(Math.log(e)/Math.log(1024));return(e/1024**t).toFixed(2)+` `+` KMGTP`.charAt(t)+`B`}function cz(e){let{resource:t,...n}=e;return(0,L.jsx)(QR,{value:t,loadTimelineResources:async(e,t,n)=>{let r=`${t}/${n}`;return Promise.allSettled([e.readHistory(t,n),e.search(`Task`,{_filter:`based-on eq ${r} or focus eq ${r} or subject eq ${r}`,_count:100})])},...n})}function lz(e){let{encounter:t,...n}=e;return(0,L.jsx)(QR,{value:t,loadTimelineResources:async(e,t,n)=>Promise.allSettled([e.readHistory(`Encounter`,n),e.search(`Communication`,`encounter=Encounter/`+n),e.search(`Media`,`encounter=Encounter/`+n)]),createCommunication:(e,t,n)=>({resourceType:`Communication`,status:`completed`,encounter:DC(e),subject:e.subject,sender:DC(t),sent:new Date().toISOString(),payload:[{contentString:n}]}),createMedia:(e,t,n)=>({resourceType:`Media`,status:`completed`,encounter:DC(e),subject:e.subject,operator:DC(t),issued:new Date().toISOString(),content:n}),...n})}function uz(e){let t;try{t=lE(e.path,e.resource)}catch(e){return console.warn(`FhirPathDisplay:`,e),null}if(t.length>1)throw Error(`Component "path" for "FhirPathDisplay" must resolve to a single element. \
|
|
207
207
|
Received ${t.length} elements \
|
|
208
|
-
[${JSON.stringify(t,null,2)}]`);return(0,L.jsx)(GI,{value:t[0]||``,propertyType:e.propertyType})}function dz(e){let t=e.exportCsv||e.exportTransactionBundle?(0,L.jsxs)(L.Fragment,{children:[e.exportCsv&&(0,L.jsx)(fz,{text:`CSV`,exportLogic:e.exportCsv,onCancel:e.onCancel}),e.exportTransactionBundle&&(0,L.jsx)(fz,{text:`Transaction Bundle`,exportLogic:e.exportTransactionBundle,onCancel:e.onCancel})]}):void 0;return(0,L.jsx)(aR,{title:`Export`,opened:e.visible,onClose:e.onCancel,actions:t,children:(0,L.jsx)(H,{children:`Limited to 1000 records`})})}function fz(e){return(0,L.jsx)(U,{onClick:()=>{e.exportLogic(),e.onCancel()},children:`Export as ${e.text}`})}var pz={root:`_root_1dkk5_1`,tableScroll:`_tableScroll_1dkk5_7`,table:`_table_1dkk5_7`,toolbar:`_toolbar_1dkk5_30`,actionIcon:`_actionIcon_1dkk5_34`,toolbarButton:`_toolbarButton_1dkk5_42`,menuDropdown:`_menuDropdown_1dkk5_52`,tr:`_tr_1dkk5_71`,nameLink:`_nameLink_1dkk5_82`,checkboxCell:`_checkboxCell_1dkk5_91`,checkboxWrap:`_checkboxWrap_1dkk5_98`,control:`_control_1dkk5_109`,staticColumnTitle:`_staticColumnTitle_1dkk5_110`,mutedText:`_mutedText_1dkk5_115`,statusBadge:`_statusBadge_1dkk5_154`,statusBadgeLabel:`_statusBadgeLabel_1dkk5_159`},mz={string:[X.EQUALS,X.NOT,X.CONTAINS,X.EXACT],fulltext:[X.EQUALS,X.NOT,X.CONTAINS,X.EXACT],token:[X.EQUALS,X.NOT,X.TEXT],reference:[X.EQUALS,X.NOT],number:[X.EQUALS,X.NOT_EQUALS,X.GREATER_THAN,X.LESS_THAN,X.GREATER_THAN_OR_EQUALS,X.LESS_THAN_OR_EQUALS],quantity:[X.EQUALS,X.NOT_EQUALS,X.GREATER_THAN,X.LESS_THAN,X.GREATER_THAN_OR_EQUALS,X.LESS_THAN_OR_EQUALS],date:[X.EQUALS,X.NOT_EQUALS,X.GREATER_THAN,X.LESS_THAN,X.GREATER_THAN_OR_EQUALS,X.LESS_THAN_OR_EQUALS,X.STARTS_AFTER,X.ENDS_BEFORE,X.APPROXIMATELY],datetime:[X.EQUALS,X.NOT_EQUALS,X.GREATER_THAN,X.LESS_THAN,X.GREATER_THAN_OR_EQUALS,X.LESS_THAN_OR_EQUALS,X.STARTS_AFTER,X.ENDS_BEFORE,X.APPROXIMATELY],uri:[X.EQUALS,X.NOT,X.ABOVE,X.BELOW]},hz={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 gz(e,t){return{...e,filters:t,offset:0,name:void 0}}function _z(e,t){return gz(e,(e.filters??[]).filter(e=>e.code!==t))}function vz(e,t,n,r,i){i&&(e=_z(e,t));let a=[];return e.filters&&a.push(...e.filters),a.push({code:t,operator:n,value:r??``}),gz(e,a)}function yz(e,t){if(!e.filters)return e;let n=[...e.filters];return n.splice(t,1),{...e,filters:n,name:void 0}}function bz(e,t){return Cz(e,t,-1)}function xz(e,t){return Cz(e,t,0)}function Sz(e,t){return Cz(e,t,1)}function Cz(e,t,n){let r=new Date;r.setDate(r.getDate()+n),r.setHours(0,0,0,0);let i=new Date(r.getTime());return i.setDate(i.getDate()+1),i.setTime(i.getTime()-1),Az(e,t,r,i)}function wz(e,t){let n=new Date;return Az(e,t,n,new Date(n.getTime()+864e5))}function Tz(e,t){return Oz(e,t,-1)}function Ez(e,t){return Oz(e,t,0)}function Dz(e,t){return Oz(e,t,1)}function Oz(e,t,n){let r=new Date;r.setMonth(r.getMonth()+n),r.setDate(1),r.setHours(0,0,0,0);let i=new Date(r.getTime());return i.setMonth(i.getMonth()+1),i.setDate(1),i.setHours(0,0,0,0),i.setTime(i.getTime()-1),Az(e,t,r,i)}function kz(e,t){let n=new Date;return n.setMonth(0),n.setDate(1),n.setHours(0,0,0,0),Az(e,t,n,new Date)}function Az(e,t,n,r){return e=_z(e,t),e=jz(e,t,X.GREATER_THAN_OR_EQUALS,n),e=jz(e,t,X.LESS_THAN_OR_EQUALS,r),e}function jz(e,t,n,r){return vz(e,t,n,r.toISOString())}function Mz(e,t,n=!0){return vz(e,t,X.MISSING,n.toString())}function Nz(e,t){return e.offset===t?e:{...e,offset:t,name:void 0}}function Pz(e,t){let n=e.count??20;return Nz(e,(t-1)*n)}function Fz(e,t,n){return t===Rz(e)&&n!==void 0&&n===zz(e)?e:{...e,sortRules:[{code:t,descending:!!n}],name:void 0}}var Iz=[{code:`_lastUpdated`,descending:!0}];function Lz(e,t){return e.length===t.length&&e.every((e,n)=>e.code===t[n].code&&!!e.descending==!!t[n].descending)}function Rz(e){let t=e.sortRules;if(!t||t.length===0)return;let n=t[0].code;return n.startsWith(`-`)?n.substr(1):n}function zz(e){let t=e.sortRules;return!t||t.length===0?!1:!!t[0].descending}function Bz(e){return mz[e.type]}function Vz(e){return hz[e]??``}function Hz(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(dw).join(` `))}function Uz(e){return e.startsWith(`_`)}function Wz(e){return Uz(e)?e:Hz(e)}function Gz(e){let t=(e,t)=>Wz(e).localeCompare(Wz(t));return{fields:e.filter(e=>!Uz(e)).sort(t),metadata:e.filter(e=>Uz(e)).sort(t)}}function Kz(e){let{fields:t,metadata:n}=Gz(Object.keys(e)),r=e=>e.map(e=>({value:e,label:Wz(e)}));return[...t.length>0?[{group:`Fields`,items:r(t)}]:[],...n.length>0?[{group:`Metadata`,items:r(n)}]:[]]}function qz(e){switch(e){case`date`:return{asc:`Oldest to Newest`,desc:`Newest to Oldest`};case`number`:case`quantity`:return{asc:`Smallest to Largest`,desc:`Largest to Smallest`};default:return{asc:`A to Z`,desc:`Z to A`}}}function Jz(e,t){let n=t.name;return n===`id`?(0,L.jsx)(eN,{to:`/${e.resourceType}/${e.id}`,children:e.id}):n===`meta.versionId`?e.meta?.versionId:n===`_lastUpdated`?Pw(e.meta?.lastUpdated):n===`name`&&jC(e)?Yz(e):`${e.resourceType}.${t.name}`===t.elementDefinition?.path?Qz(e,t.elementDefinition):t.searchParams?.length===1&&t.name===t.searchParams[0].code?$z(e,t.searchParams[0]):null}function Yz(e){return(0,L.jsxs)(V,{gap:`xs`,wrap:`nowrap`,children:[(0,L.jsx)(oN,{value:e,radius:`xl`,size:28}),(0,L.jsx)(H,{size:`sm`,truncate:!0,children:MC(e)})]})}function Xz(e,t,n){if(e===Y.Reference&&!Array.isArray(t))return(0,L.jsx)(Zz,{value:t});if(n===`status`&&typeof t==`string`)return(0,L.jsx)(sR,{status:t,variant:`light`,classNames:{root:pz.statusBadge,label:pz.statusBadgeLabel}})}function Zz({value:e}){let t=e.display||(0,L.jsx)(uR,{value:e});return(0,L.jsxs)(V,{gap:`xs`,wrap:`nowrap`,children:[(0,L.jsx)(oN,{value:e,radius:`xl`,size:28}),e.reference?(0,L.jsx)(eN,{to:e,size:`sm`,className:pz.nameLink,children:t}):(0,L.jsx)(H,{size:`sm`,children:t})]})}function Qz(e,t){let n=t.path?.split(`.`)?.pop()?.replaceAll(`[x]`,``)??``,[r,i]=kI({type:e.resourceType,value:e},n);return r?Xz(i,r,n)??(0,L.jsx)(GI,{path:t.path,property:t,propertyType:i,value:r,maxWidth:200,ignoreMissingValues:!0,link:!1}):null}function $z(e,t){let n=uE(t.expression,[{type:e.resourceType,value:e}]);return!n||n.length===0?null:(0,L.jsx)(L.Fragment,{children:n.map((e,r)=>{let i=`${r}-${n.length}`,a=Xz(e.type,e.value,t.code);return a?(0,L.jsx)(`span`,{children:a},i):(0,L.jsx)(GI,{propertyType:e.type,value:e.value,maxWidth:200,ignoreMissingValues:!0,link:!1},i)})})}function eB(e){let t=(0,b.useRef)(!1),[n,r]=(0,b.useState)({search:JSON.parse(VC(e.search))}),[i,a]=(0,b.useState)(!1);(0,b.useEffect)(()=>{r({search:e.search})},[e.search]);let o=(0,b.useMemo)(()=>{if(!e.visible)return[];let t=e.search.resourceType;return yw(tB(IS(t),iT(t))).map(e=>({value:e,label:Hz(e)}))},[e.visible,e.search.resourceType]);function s(e){r({search:{...n.search,fields:e}})}return(0,L.jsx)(aR,{title:`Fields`,opened:e.visible,onClose:()=>{e.onCancel()},size:`auto`,withOverlay:!0,closeOnClickOutside:!1,overlayProps:{onMouseDownCapture:()=>{t.current=i},onClick:()=>{t.current||e.onCancel(),t.current=!1},children:(0,L.jsx)(`div`,{"data-testid":`overlay-child`})},actions:(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(U,{onClick:()=>e.onOk(n.search),children:`OK`})}),children:(0,L.jsx)(Mg,{style:{width:550},placeholder:`Select fields to display`,data:o,value:n.search.fields??[],onChange:s,onDropdownOpen:()=>a(!0),onDropdownClose:()=>a(!1),maxDropdownHeight:`250px`,clearButtonProps:{"aria-label":`Clear selection`},clearable:!0,searchable:!0})})}function tB(e,t){let n=[],r=new Set,i=new Set;for(let t of Object.keys(e.elements))n.push(t),r.add(t.toLowerCase()),i.add(Hz(t));if(t)for(let e of Object.keys(t)){let t=Hz(e);!r.has(e)&&!i.has(t)&&(n.push(e),r.add(e),i.add(t))}return n}function nB(e){let t=vk(e.resourceType,e.searchParam),n=e.name??`filter-value`;switch(t.type){case _k.REFERENCE:return(0,L.jsx)(ML,{name:n,defaultValue:e.defaultValue?{reference:e.defaultValue}:void 0,targetTypes:e.searchParam.target,withinPortal:e.withinPortal,autoFocus:e.autoFocus,onChange:t=>{t?e.onChange(t.reference):e.onChange(``)}});case _k.BOOLEAN:return(0,L.jsx)(pp,{name:n,"aria-label":e.ariaLabel,"data-autofocus":e.autoFocus,"data-testid":n,defaultChecked:e.defaultValue===`true`,autoFocus:e.autoFocus,onChange:t=>e.onChange(t.currentTarget.checked.toString())});case _k.DATE:return(0,L.jsx)(jb,{type:`date`,name:n,"aria-label":e.ariaLabel,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:t=>e.onChange(t.currentTarget.value)});case _k.DATETIME:return(0,L.jsx)(pL,{name:n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:e.onChange});case _k.NUMBER:return(0,L.jsx)(jb,{type:`number`,name:n,"aria-label":e.ariaLabel,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:t=>e.onChange(t.currentTarget.value)});case _k.QUANTITY:return(0,L.jsx)(xL,{name:n,path:``,defaultValue:rB(e.defaultValue),autoFocus:e.autoFocus,onChange:t=>{t?e.onChange(`${t.value}`):e.onChange(``)}});default:return(0,L.jsx)(jb,{name:n,"aria-label":e.ariaLabel,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:t=>e.onChange(t.currentTarget.value),placeholder:`Search value`})}}function rB(e){if(e){let[t,n,r]=e.split(`|`);if(t)return{value:Number.parseFloat(t),system:n,unit:r}}}function iB(e){let[t,n]=(0,b.useState)(ew(e.search)),r=(0,b.useRef)(t);(0,b.useLayoutEffect)(()=>{r.current=t}),(0,b.useEffect)(()=>{n(ew(e.search))},[e.search]);function i(e){n(vz(r.current,e.code,e.operator,e.value))}let a=e.search.resourceType,o=iT(a)??{},s=t.filters||[];return(0,L.jsxs)(aR,{title:`Filters`,size:900,opened:e.visible,onClose:e.onCancel,onSubmit:()=>e.onOk(r.current),actions:(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(PP,{children:`OK`})}),children:[(0,L.jsxs)(`table`,{children:[(0,L.jsxs)(`colgroup`,{children:[(0,L.jsx)(`col`,{style:{width:200}}),(0,L.jsx)(`col`,{style:{width:200}}),(0,L.jsx)(`col`,{style:{width:380}}),(0,L.jsx)(`col`,{style:{width:40}})]}),(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Field`}),(0,L.jsx)(`th`,{children:`Operation`}),(0,L.jsx)(`th`,{children:`Value`}),(0,L.jsx)(`th`,{})]})}),(0,L.jsx)(`tbody`,{children:s.map((e,t)=>(0,L.jsx)(aB,{id:`filter-${t}-row`,resourceType:a,searchParams:o,value:e,onChange:e=>{let i=[...s];i[t]=e,n(gz(r.current,i))},onDelete:()=>n(yz(r.current,t))},`filter-${t}-row`))})]}),(0,L.jsx)(zL,{propertyDisplayName:`Filter`,onClick:()=>i({})})]})}function aB(e){let t=e.value;function n(t){e.onChange({code:t,operator:X.EQUALS,value:``})}function r(n){e.onChange({code:t.code,operator:n,value:``})}function i(n){e.onChange({code:t.code,operator:t.operator,value:n})}let a=e.searchParams[t.code],o=a&&Bz(a),s=[],c=[];for(let t of Object.keys(e.searchParams)){let e={value:t,label:Wz(t)};Uz(t)?c.push(e):s.push(e)}return(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(Ig,{"data-testid":`${e.id}-filter-field`,defaultValue:e.value.code,onChange:e=>n(e.currentTarget.value),data:[``,...s.length>0?[{group:`Fields`,items:s}]:[],...c.length>0?[{group:`Metadata`,items:c}]:[]]})}),(0,L.jsx)(`td`,{children:o&&(0,L.jsx)(Ig,{"data-testid":`${e.id}-filter-operation`,defaultValue:t.operator,onChange:e=>r(e.currentTarget.value),data:[``,...o.map(e=>({value:e,label:Vz(e)}))]},`${e.id}-filter-value-${e.value.code}`)}),(0,L.jsx)(`td`,{children:a&&t.operator&&(0,L.jsx)(nB,{name:`${e.id}-filter-value`,resourceType:e.resourceType,searchParam:a,defaultValue:t.value,onChange:i},`${e.id}-filter-value-${e.value.code}-${e.value.operator}`)}),(0,L.jsx)(`td`,{children:e.onDelete&&(0,L.jsx)(bu,{variant:`outline`,color:`red`,radius:`xl`,"aria-label":`Delete filter`,onClick:e.onDelete,children:(0,L.jsx)(HM,{style:{width:`70%`,height:`70%`},stroke:1.5})})})]})}function oB(e){let[t,n]=(0,b.useState)(e.defaultValue??``);if(!e.searchParam||!e.filter)return null;function r(){e.onOk({...e.filter,value:t})}return(0,L.jsx)(aR,{title:e.title,size:`xl`,opened:e.visible,onClose:e.onCancel,onSubmit:r,actions:(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(PP,{children:`OK`})}),children:(0,L.jsx)(nB,{resourceType:e.resourceType,searchParam:e.searchParam,defaultValue:t,autoFocus:!0,onChange:n})})}function sB(e){let{resourceType:t,filter:n}=e,r=mT.types[t].searchParams?.[n.code];if(r){if(r.type===`reference`&&(n.operator===X.EQUALS||n.operator===X.NOT_EQUALS))return(0,L.jsx)(uR,{value:{reference:n.value}});let e=vk(t,r);if(n.code===`_lastUpdated`||e.type===_k.DATETIME)return(0,L.jsx)(L.Fragment,{children:Pw(n.value)})}return(0,L.jsx)(L.Fragment,{children:n.value})}var cB=16,lB=`var(--mantine-color-dimmed)`,uB=(0,L.jsx)(jj,{size:cB,color:`var(--mantine-color-blue-6)`});function dB(e){if(!e.searchParams)return null;function t(t,n){i(Fz(e.search,t.code,n))}function n(t){i(_z(e.search,t.code))}function r(t,n){e.onPrompt(t,{code:t.code,operator:n,value:``})}function i(t){e.onChange(t)}return e.searchParams.length===1?(0,L.jsx)(fB,{search:e.search,searchParam:e.searchParams[0],onSort:t,onPrompt:r,onChange:i,onClear:n}):(0,L.jsx)(Xh.Dropdown,{className:pz.menuDropdown,children:e.searchParams.map(e=>(0,L.jsx)(Xh.Item,{children:Hz(e.code)},e.code))})}function fB(e){switch(e.searchParam.type){case`date`:return(0,L.jsx)(vB,{...e});case`number`:case`quantity`:return(0,L.jsx)(yB,{...e});case`reference`:return(0,L.jsx)(bB,{...e});case`string`:return(0,L.jsx)(xB,{...e});case`token`:return(0,L.jsx)(SB,{...e});case`uri`:return(0,L.jsx)(CB,{...e});default:return(0,L.jsxs)(L.Fragment,{children:[`Unknown search param type: `,e.searchParam.type]})}}function pB(e){return(0,L.jsx)(Xh.Item,{leftSection:e.icon,rightSection:e.checked?uB:null,onClick:e.onClick,children:e.children})}function mB(e){let{searchParam:t}=e,n=n=>!!e.search.sortRules?.some(e=>e.code===t.code&&!!e.descending===n);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(pB,{icon:(0,L.jsx)(kM,{size:cB,color:lB}),checked:n(!1),onClick:()=>e.onSort(t,!1),children:e.ascLabel}),(0,L.jsx)(pB,{icon:(0,L.jsx)(AM,{size:cB,color:lB}),checked:n(!0),onClick:()=>e.onSort(t,!0),children:e.descLabel}),(0,L.jsx)(Xh.Divider,{})]})}function hB(e){let{searchParam:t}=e;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(pB,{icon:(0,L.jsx)(qj,{size:cB,color:lB}),onClick:()=>e.onPrompt(t,X.EQUALS),children:`Equals...`}),(0,L.jsx)(pB,{icon:(0,L.jsx)(Kj,{size:cB,color:lB}),onClick:()=>e.onPrompt(t,e.notOperator),children:`Does not equal...`})]})}var gB=[[{label:`Tomorrow`,Icon:Oj,apply:Sz},{label:`Today`,Icon:Oj,apply:xz},{label:`Yesterday`,Icon:Oj,apply:bz},{label:`Next 24 Hours`,Icon:Aj,apply:wz}],[{label:`Next Month`,Icon:kj,apply:Dz},{label:`This Month`,Icon:kj,apply:Ez},{label:`Last Month`,Icon:kj,apply:Tz}],[{label:`Year to date`,Icon:Aj,apply:kz,openEnded:!0}]];function _B(e,t,n){let r=(t.filters??[]).filter(e=>e.code===n),i=e.apply({resourceType:t.resourceType},n).filters??[];return r.length===i.length&&i.every((t,n)=>{let i=e.openEnded&&n>0?!0:r[n].value===t.value;return r[n].operator===t.operator&&i})}function vB(e){let{searchParam:t}=e,n=t.code;return(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[(0,L.jsx)(mB,{...e,ascLabel:`Sort Oldest to Newest`,descLabel:`Sort Newest to Oldest`}),(0,L.jsx)(hB,{...e,notOperator:X.NOT_EQUALS}),(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(pB,{icon:(0,L.jsx)(lM,{size:cB,color:lB}),onClick:()=>e.onPrompt(t,X.ENDS_BEFORE),children:`Before...`}),(0,L.jsx)(pB,{icon:(0,L.jsx)(cM,{size:cB,color:lB}),onClick:()=>e.onPrompt(t,X.STARTS_AFTER),children:`After...`}),(0,L.jsx)(pB,{icon:(0,L.jsx)(Sj,{size:cB,color:lB}),onClick:()=>e.onPrompt(t,X.EQUALS),children:`Between...`}),gB.map(t=>(0,L.jsxs)(b.Fragment,{children:[(0,L.jsx)(Xh.Divider,{}),t.map(t=>(0,L.jsx)(pB,{icon:(0,L.jsx)(t.Icon,{size:cB,color:lB}),checked:_B(t,e.search,n),onClick:()=>e.onChange(t.apply(e.search,n)),children:t.label},t.label))]},t[0].label)),(0,L.jsx)(wB,{...e})]})}function yB(e){let{searchParam:t}=e;return(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[(0,L.jsx)(mB,{...e,ascLabel:`Sort Smallest to Largest`,descLabel:`Sort Largest to Smallest`}),(0,L.jsx)(hB,{...e,notOperator:X.NOT_EQUALS}),(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(pB,{icon:(0,L.jsx)(cM,{size:cB,color:lB}),onClick:()=>e.onPrompt(t,X.GREATER_THAN),children:`Greater than...`}),(0,L.jsx)(pB,{icon:(0,L.jsx)(OM,{size:cB,color:lB}),onClick:()=>e.onPrompt(t,X.GREATER_THAN_OR_EQUALS),children:`Greater than or equal to...`}),(0,L.jsx)(pB,{icon:(0,L.jsx)(lM,{size:cB,color:lB}),onClick:()=>e.onPrompt(t,X.LESS_THAN),children:`Less than...`}),(0,L.jsx)(pB,{icon:(0,L.jsx)(OM,{size:cB,color:lB}),onClick:()=>e.onPrompt(t,X.LESS_THAN_OR_EQUALS),children:`Less than or equal to...`}),(0,L.jsx)(wB,{...e})]})}function bB(e){return(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[(0,L.jsx)(hB,{...e,notOperator:X.NOT}),(0,L.jsx)(wB,{...e})]})}function xB(e){let{searchParam:t}=e;return(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[(0,L.jsx)(mB,{...e,ascLabel:`Sort A to Z`,descLabel:`Sort Z to A`}),(0,L.jsx)(hB,{...e,notOperator:X.NOT}),(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(pB,{icon:(0,L.jsx)(Ej,{size:cB,color:lB}),onClick:()=>e.onPrompt(t,X.CONTAINS),children:`Contains...`}),(0,L.jsx)(pB,{icon:(0,L.jsx)(Tj,{size:cB,color:lB}),onClick:()=>e.onPrompt(t,X.EQUALS),children:`Does not contain...`}),(0,L.jsx)(wB,{...e})]})}function SB(e){let{searchParam:t}=e;return(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[(0,L.jsx)(hB,{...e,notOperator:X.NOT}),(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(pB,{icon:(0,L.jsx)(qj,{size:cB,color:lB}),onClick:()=>e.onPrompt(t,X.TEXT),children:`Text contains...`}),(0,L.jsx)(wB,{...e})]})}function CB(e){return(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[(0,L.jsx)(hB,{...e,notOperator:X.NOT}),(0,L.jsx)(wB,{...e})]})}function wB(e){let{searchParam:t}=e,n=t.code;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(pB,{icon:(0,L.jsx)(yj,{size:cB,color:lB}),onClick:()=>e.onChange(Mz(e.search,n)),children:`Missing`}),(0,L.jsx)(pB,{icon:(0,L.jsx)(vj,{size:cB,color:lB}),onClick:()=>e.onChange(Mz(e.search,n,!1)),children:`Not missing`}),(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(pB,{icon:(0,L.jsx)(HM,{size:cB,color:lB}),onClick:()=>e.onClear(t),children:`Clear filters`})]})}var TB={dropdown:`_dropdown_16oi3_4`,body:`_body_16oi3_9`,row:`_row_16oi3_17`,grow:`_grow_16oi3_23`,footer:`_footer_16oi3_28`,deleteIcon:`_deleteIcon_16oi3_36`,empty:`_empty_16oi3_40`,indicator:`_indicator_16oi3_46`,addButton:`_addButton_16oi3_50`};function EB(e){let{opened:t,activeLabel:n}=e,r=(0,b.useId)();return(0,L.jsxs)(iu,{opened:t,onChange:e.onChange,position:`bottom-start`,shadow:`md`,radius:`md`,width:e.width,trapFocus:!0,returnFocus:!0,closeOnClickOutside:!0,children:[(0,L.jsx)(Gm,{className:TB.indicator,disabled:!n,color:`blue`,size:8,offset:6,children:(0,L.jsx)(cy,{label:n??``,position:`bottom`,openDelay:500,disabled:!n||t,children:(0,L.jsx)(iu.Target,{children:(0,L.jsx)(U,{className:pz.toolbarButton,"data-opened":t||void 0,size:`compact-md`,variant:`subtle`,color:`gray`,leftSection:e.icon,"aria-describedby":n?r:void 0,onClick:e.onToggle,children:e.label})})})}),n&&(0,L.jsx)(bl,{id:r,children:n}),(0,L.jsxs)(iu.Dropdown,{className:TB.dropdown,children:[e.children,e.footer&&(0,L.jsx)(`div`,{className:TB.footer,children:e.footer})]})]})}function DB(e){return(0,L.jsx)(U,{className:TB.addButton,size:`compact-sm`,variant:`subtle`,color:`blue`,leftSection:(0,L.jsx)(Ij,{size:16}),fw:500,onClick:e.onClick,children:e.label})}var OB=0;function kB(e){return e.map(e=>({id:OB++,value:e}))}function AB(e){let[t,n]=(0,b.useState)(()=>kB(e()));function r(e,r){let i=t.map((t,n)=>n===e?{...t,value:r}:t);return n(i),i}function i(e){let r=t.filter((t,n)=>n!==e);return n(r),r}return{rows:t,reset:e=>n(kB(e)),update:r,remove:i,add:e=>n([...t,...kB([e])])}}function jB(e){let{search:t,onChange:n}=e,[r,i]=(0,b.useState)(!1),{rows:a,reset:o,update:s,remove:c,add:l}=AB(()=>MB(t)),u=(0,b.useMemo)(()=>iT(t.resourceType)??{},[t.resourceType]),d=(0,b.useMemo)(()=>Kz(u),[u]);function f(){r||o(MB(t)),i(e=>!e)}function p(e){n({...t,sortRules:e.map(e=>e.value).filter(e=>!!e.code)})}let m=t.sortRules??[],h=m.length>0&&!Lz(m,Iz)?`${m.length} ${m.length===1?`Sort`:`Sorts`} Applied`:void 0;return(0,L.jsx)(EB,{label:`Sort`,icon:(0,L.jsx)(_j,{size:16}),width:520,opened:r,onToggle:f,onChange:i,activeLabel:h,footer:(0,L.jsx)(DB,{label:`Add Sort`,onClick:()=>l({code:``,descending:!1})}),children:(0,L.jsxs)(`div`,{className:TB.body,tabIndex:-1,"data-autofocus":!0,children:[a.length===0&&(0,L.jsx)(`div`,{className:TB.empty,children:`No sort applied`}),a.map(({id:e,value:t},n)=>{let r=qz(t.code?u[t.code]?.type:void 0),i=t.descending?`desc`:`asc`;return(0,L.jsxs)(`div`,{className:TB.row,children:[(0,L.jsx)(Sy,{comboboxProps:{withinPortal:!1},className:TB.grow,"aria-label":`Sort ${n+1} field`,placeholder:`Field`,searchable:!0,data:d,value:t.code||null,onChange:e=>p(s(n,{code:e??``,descending:t.descending}))}),(0,L.jsx)(Sy,{comboboxProps:{withinPortal:!1},className:TB.grow,"aria-label":`Sort ${n+1} direction`,placeholder:`Order`,disabled:!t.code,allowDeselect:!1,data:[{value:`asc`,label:r.asc},{value:`desc`,label:r.desc}],value:t.code?i:null,onChange:e=>p(s(n,{code:t.code,descending:e===`desc`}))}),(0,L.jsx)(bu,{variant:`subtle`,color:`gray`,radius:`xl`,"aria-label":`Remove sort ${n+1}`,ml:2,onClick:()=>p(c(n)),children:(0,L.jsx)(HM,{size:16,stroke:2,className:TB.deleteIcon})})]},e)})]})})}function MB(e){return e.sortRules?.length?[...e.sortRules]:[...Iz]}function NB(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{}}}function PB(e){let t=e.resourceType,n=[];for(let r of e.fields||[`id`,`_lastUpdated`])n.push(FB(t,r));return n}function FB(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`}]};let n=uT(e,t),r=aT(e,t.toLowerCase());if(n&&r)return{name:t,elementDefinition:n,searchParams:[r]};if(n){let r=iT(e),i;if(r){let n=RegExp(`${e}\\.${t.replaceAll(`[x]`,``)}([^\\w-]|$)`);i=Object.values(r).filter(e=>!!e.expression&&n.test(e?.expression)),i.length===0&&(i=void 0)}return{name:t,elementDefinition:n,searchParams:i}}return r?{name:t,elementDefinition:vk(e,r).elementDefinitions?.[0],searchParams:[r]}:{name:t}}var IB=class extends Event{definition;constructor(e){super(`change`),this.definition=e}},LB=class extends Event{response;constructor(e){super(`load`),this.response=e}},RB=class extends Event{resource;browserEvent;constructor(e,t){super(`click`),this.resource=e,this.browserEvent=t}};function zB(e){let t=Z(),[n,r]=(0,b.useState)(),{search:i,onLoad:a}=e,o=i.sortRules?.length?i:{...i,sortRules:[...Iz]},[s,c]=(0,b.useState)(o);JC(o,s)||c(o);let[l,u]=(0,b.useState)({selected:{},exportDialogVisible:!1,fieldEditorVisible:!1,filterEditorVisible:!1,filterDialogVisible:!1}),[d,f]=(0,b.useState)(),p=s.total??`accurate`,m=(0,b.useCallback)(e=>{r(void 0),t.requestSchema(s.resourceType).then(()=>t.search(s.resourceType,FE({...s,total:p,fields:void 0}),e)).then(e=>{u(t=>({...t,searchResponse:e})),a&&a(new LB(e))}).catch(e=>{u(e=>({...e,searchResponse:void 0})),r(yS(e))})},[t,s,p,a]),h=(0,b.useCallback)(()=>{u(e=>({...e,searchResponse:void 0})),m({cache:`reload`})},[m]);(0,b.useEffect)(()=>{m()},[m]);function g(e,t){u(n=>{let r={...n.selected};return t??!n.selected[e]?r[e]=!0:delete r[e],{...n,selected:r}})}function _(e){u(t=>{let n={};return e&&t.searchResponse?.entry&&t.searchResponse.entry.forEach(e=>{e.resource?.id&&(n[e.resource.id]=!0)}),{...t,selected:n}})}function v(t){e.onChange&&e.onChange(new IB(t))}function y(t,n){if(XM(t.target)||t.button===2)return;JM(t);let r=YM(t);!r&&e.onClick&&e.onClick(new RB(n,t)),r&&e.onAuxClick&&e.onAuxClick(new RB(n,t))}function x(e,t){if(e.target!==e.currentTarget)return;let n=e.currentTarget,r;if(e.key===`ArrowDown`)r=n.nextElementSibling;else if(e.key===`ArrowUp`)r=n.previousElementSibling;else if(e.key===`Home`)r=n.parentElement?.firstElementChild;else if(e.key===`End`)r=n.parentElement?.lastElementChild;else if(e.key===`Enter`){JM(e),n.dispatchEvent(new window.MouseEvent(`click`,{bubbles:!0,cancelable:!0,ctrlKey:e.ctrlKey,metaKey:e.metaKey}));return}else if(e.key===` `&&w){JM(e),g(t.id);return}else return;JM(e),r?.focus()}async function S(){let t=Object.keys(l.selected);u(e=>({...e,deleting:!0}));try{await e.onDelete?.(t),u(e=>({...e,selected:{},deleting:!1,deleteConfirmVisible:!1})),m({cache:`reload`})}catch{u(e=>({...e,deleting:!1}))}}function C(){u(e=>({...e,deleteConfirmVisible:!1}))}if(n)return(0,L.jsx)(oI,{outcome:n});if(!PS(s.resourceType))return(0,L.jsx)(Xp,{style:{width:`100%`,height:`100%`},children:(0,L.jsx)(fu,{})});let w=e.checkboxesEnabled,T=PB(s),E=s.resourceType,D=l.searchResponse,O=D?.entry,k=O?.map(e=>e.resource),A=Object.keys(l.selected),j=!!O?.length&&O.every(e=>!e.resource?.id||l.selected[e.resource.id]),M=!!(e.onExport??e.onExportCsv??e.onExportTransactionBundle),N=!!e.onDelete,ee=!!e.onBulk,P=d&&k?.some(e=>e?.id===d)?d:k?.find(Boolean)?.id;return(0,L.jsxs)(`div`,{className:pz.root,"data-testid":`search-control`,children:[!e.hideToolbar&&(0,L.jsxs)(V,{justify:`space-between`,pb:`md`,className:pz.toolbar,children:[(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(U,{className:pz.toolbarButton,size:`compact-md`,variant:`subtle`,color:`gray`,leftSection:(0,L.jsx)(Rj,{size:16}),onClick:()=>u(e=>({...e,fieldEditorVisible:!0,dialogOpenTime:Date.now()})),children:`Fields`}),(0,L.jsx)(U,{className:pz.toolbarButton,size:`compact-md`,variant:`subtle`,color:`gray`,leftSection:(0,L.jsx)(Zj,{size:16}),onClick:()=>u(e=>({...e,filterEditorVisible:!0,dialogOpenTime:Date.now()})),children:`Filters`}),(0,L.jsx)(jB,{search:s,onChange:v}),D&&(0,L.jsxs)(H,{size:`xs`,fw:500,c:`dimmed`,ml:4,"data-testid":`count-display`,children:[GB(s,D).toLocaleString(),`-`,KB(s,D).toLocaleString(),D.total!==void 0&&` of ${s.total===`estimate`?`~`:``}${D.total?.toLocaleString()}`]})]}),(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(cy,{label:`Refresh`,position:`bottom`,openDelay:500,children:(0,L.jsx)(bu,{className:pz.actionIcon,variant:`transparent`,color:`gray`,size:32,radius:`xl`,"aria-label":`Refresh`,title:`Refresh`,onClick:h,children:(0,L.jsx)(CM,{size:16})})}),(M||ee||N)&&(0,L.jsxs)(Xh,{shadow:`md`,width:200,radius:`md`,position:`bottom-end`,children:[(0,L.jsx)(Xh.Target,{children:(0,L.jsx)(bu,{className:pz.actionIcon,variant:`transparent`,color:`gray`,size:32,radius:`xl`,"aria-label":`Actions`,children:(0,L.jsx)(Wj,{size:16})})}),(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[M&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(FM,{size:16}),onClick:e.onExport??(()=>u(e=>({...e,exportDialogVisible:!0,dialogOpenTime:Date.now()}))),children:`Export`}),ee&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(rM,{size:16}),onClick:()=>e.onBulk?.(A),children:`Bulk Apply`}),N&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(RM,{size:16}),disabled:A.length===0,onClick:()=>u(e=>({...e,deleteConfirmVisible:!0})),children:`Delete`})]})]}),e.onNew&&(0,L.jsx)(cy,{label:`New ${E}`,position:`bottom`,openDelay:500,children:(0,L.jsx)(bu,{variant:`filled`,color:`blue`,size:32,radius:`xl`,"aria-label":`New ${E}`,onClick:e.onNew,children:(0,L.jsx)(bM,{size:16})})})]})]}),(0,L.jsx)(`div`,{className:pz.tableScroll,children:(0,L.jsxs)(G,{className:pz.table,children:[(0,L.jsxs)(G.Thead,{children:[(0,L.jsxs)(G.Tr,{children:[w&&(0,L.jsx)(G.Th,{className:pz.checkboxCell,"data-checkbox-cell":!0,"data-testid":`all-checkbox-cell`,onClick:e=>HB(e,()=>_(!j)),onAuxClick:e=>e.stopPropagation(),children:(0,L.jsx)(`div`,{className:pz.checkboxWrap,children:(0,L.jsx)(pp,{size:`xs`,"aria-label":`Select all rows`,"data-testid":`all-checkbox`,checked:j,onChange:e=>_(e.currentTarget.checked)})})}),T.map(e=>{let t=e.searchParams?.[0]?.code,n=t?s.sortRules?.find(e=>e.code===t):void 0;return(0,L.jsx)(G.Th,{"aria-sort":n&&(n.descending?`descending`:`ascending`),children:e.searchParams?(0,L.jsxs)(Xh,{shadow:`md`,radius:`md`,position:`bottom-start`,children:[(0,L.jsx)(Xh.Target,{children:(0,L.jsx)(vl,{className:pz.control,children:(0,L.jsxs)(V,{gap:4,wrap:`nowrap`,children:[(0,L.jsx)(BB,{children:Hz(e.name)}),n&&(n.descending?(0,L.jsx)(hj,{size:12,stroke:2,"aria-hidden":!0}):(0,L.jsx)(gj,{size:12,stroke:2,"aria-hidden":!0}))]})})}),(0,L.jsx)(dB,{search:s,searchParams:e.searchParams,onChange:v,onPrompt:(e,t)=>u(n=>({...n,filterDialogVisible:!0,filterDialogSearchParam:e,filterDialogFilter:t,dialogOpenTime:Date.now()}))})]}):(0,L.jsx)(BB,{className:pz.staticColumnTitle,children:Hz(e.name)})},e.name)}),e.additionalColumns?.map(e=>(0,L.jsx)(G.Th,{children:(0,L.jsx)(BB,{className:pz.staticColumnTitle,children:e.name})},e.name))]}),!e.hideFilters&&(0,L.jsxs)(G.Tr,{children:[w&&(0,L.jsx)(G.Th,{}),T.map(e=>(0,L.jsx)(G.Th,{children:e.searchParams&&(0,L.jsx)(VB,{resourceType:E,searchParams:e.searchParams,filters:s.filters})},e.name)),e.additionalColumns?.map(e=>(0,L.jsx)(G.Th,{},e.name))]})]}),(0,L.jsx)(G.Tbody,{children:k?.map(t=>t&&(0,L.jsxs)(G.Tr,{className:pz.tr,"data-testid":`search-control-row`,tabIndex:t.id===P?0:-1,onFocus:e=>{e.target===e.currentTarget&&f(t.id)},onKeyDown:e=>x(e,t),onClick:e=>y(e,t),onAuxClick:e=>y(e,t),children:[w&&(0,L.jsx)(G.Td,{className:pz.checkboxCell,"data-checkbox-cell":!0,"data-testid":`row-checkbox-cell`,onClick:e=>HB(e,()=>g(t.id)),onAuxClick:e=>e.stopPropagation(),children:(0,L.jsx)(`div`,{className:pz.checkboxWrap,children:(0,L.jsx)(pp,{size:`xs`,"data-testid":`row-checkbox`,"aria-label":`Checkbox for ${t.id}`,checked:!!l.selected[t.id],onChange:e=>g(t.id,e.currentTarget.checked)})})}),T.map(e=>(0,L.jsx)(G.Td,{children:Jz(t,e)},e.name)),e.additionalColumns?.map(e=>(0,L.jsx)(G.Td,{children:e.renderCell(t)},e.name))]},t.id))})]})}),!k?.length&&(0,L.jsx)(PF,{children:(0,L.jsx)(Xp,{style:{height:150},children:(0,L.jsx)(H,{className:pz.mutedText,size:`xl`,children:`No results`})})}),D&&(0,L.jsx)(Xp,{m:0,p:`md`,pb:0,children:(0,L.jsx)(pv,{value:UB(s),total:WB(s,D),onChange:e=>v(Pz(s,e)),getControlProps:NB})}),(0,L.jsx)(eB,{search:s,visible:l.fieldEditorVisible,onOk:e=>{v(e),u(e=>({...e,fieldEditorVisible:!1}))},onCancel:()=>u(e=>({...e,fieldEditorVisible:!1}))},`search-field-editor-${l.dialogOpenTime}`),(0,L.jsx)(iB,{search:s,visible:l.filterEditorVisible,onOk:e=>{v(e),u(e=>({...e,filterEditorVisible:!1}))},onCancel:()=>u(e=>({...e,filterEditorVisible:!1}))},`search-filter-editor-${l.dialogOpenTime}`),(0,L.jsx)(dz,{visible:l.exportDialogVisible,exportCsv:e.onExportCsv,exportTransactionBundle:e.onExportTransactionBundle,onCancel:()=>{u(e=>({...e,exportDialogVisible:!1}))}},`search-export-dialog-${l.dialogOpenTime}`),(0,L.jsx)(oB,{visible:l.filterDialogVisible,title:l.filterDialogSearchParam?.code?Hz(l.filterDialogSearchParam.code):``,resourceType:E,searchParam:l.filterDialogSearchParam,filter:l.filterDialogFilter,defaultValue:``,onOk:e=>{v(vz(s,e.code,e.operator,e.value)),u(e=>({...e,filterDialogVisible:!1}))},onCancel:()=>u(e=>({...e,filterDialogVisible:!1}))},`search-filter-dialog-${l.dialogOpenTime}`),(0,L.jsx)(aR,{opened:!!l.deleteConfirmVisible,onClose:l.deleting?()=>void 0:C,title:`Delete selected ${Hz(E)} resources?`,actions:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(U,{color:`red`,w:`100%`,loading:!!l.deleting,onClick:S,children:`Delete`}),(0,L.jsx)(U,{variant:`outline`,w:`100%`,disabled:!!l.deleting,onClick:C,children:`Cancel`})]}),children:(0,L.jsx)(H,{children:`This action cannot be undone.`})})]})}function BB(e){return(0,L.jsx)(H,{className:`${pz.mutedText} ${e.className??``}`,size:`xs`,fw:500,lh:`sm`,children:e.children})}function VB(e){let t=(e.filters??[]).filter(t=>e.searchParams.find(e=>e.code===t.code));return t.length===0?(0,L.jsx)(H,{className:pz.mutedText,size:`xs`,lh:`sm`,children:`no filters`}):(0,L.jsx)(L.Fragment,{children:t.map(t=>(0,L.jsxs)(H,{size:`xs`,lh:`sm`,children:[Vz(t.operator),`\xA0`,(0,L.jsx)(sB,{resourceType:e.resourceType,filter:t})]},`filter-${t.code}-${t.operator}-${t.value}`))})}function HB(e,t){e.stopPropagation(),!e.target.closest(`input, label`)&&t()}function UB(e){return Math.floor((e.offset??0)/(e.count??20))+1}function WB(e,t){let n=e.count??20,r=qB(e,t);return Math.ceil(r/n)}function GB(e,t){return Math.min(qB(e,t),(e.offset??0)+1)}function KB(e,t){return Math.max(GB(e,t)+(t.entry?.length??0)-1,0)}function qB(e,t){let n=t.total;return n===void 0&&(n=(e.offset??0)+(t.entry?.length??0)+ +!!t.link?.some(e=>e.relation===`next`)),n}function JB(e){let t=Z(),[n,r]=(0,b.useState)(!1),[i,a]=(0,b.useState)(),{query:o,fields:s}=e,[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)({});(0,b.useEffect)(()=>{a(void 0),t.graphql(o).then(l).catch(e=>a(yS(e)))},[t,o]);function f(e,t){e.stopPropagation();let n=e.target.checked,r={...u};n?r[t]=!0:delete r[t],d(r)}function p(e){e.stopPropagation();let t=e.target.checked,n={},r=c?.data.ResourceList;t&&r&&r.forEach(e=>{e.id&&(n[e.id]=!0)}),d(n)}function m(){let e=c?.data.ResourceList;if(!e||e.length===0)return!1;for(let t of e)if(t.id&&!u[t.id])return!1;return!0}function h(t,n){XM(t.target)||(JM(t),t.button!==1&&e.onClick&&e.onClick(new RB(n,t)),t.button===1&&e.onAuxClick&&e.onAuxClick(new RB(n,t)))}if((0,b.useEffect)(()=>{t.requestSchema(e.resourceType).then(()=>r(!0)).catch(console.log)},[t,e.resourceType]),!n)return(0,L.jsx)(fu,{});let g=e.checkboxesEnabled;return(0,L.jsxs)(`div`,{onContextMenu:e=>JM(e),"data-testid":`search-control`,children:[(0,L.jsxs)(G,{children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[g&&(0,L.jsx)(G.Th,{children:(0,L.jsx)(`input`,{type:`checkbox`,value:`checked`,"aria-label":`all-checkbox`,"data-testid":`all-checkbox`,checked:m(),onChange:e=>p(e)})}),s.map(e=>(0,L.jsx)(G.Th,{children:e.name},e.name))]})}),(0,L.jsx)(G.Tbody,{children:c?.data.ResourceList.map(e=>e&&(0,L.jsxs)(G.Tr,{"data-testid":`search-control-row`,onClick:t=>h(t,e),onAuxClick:t=>h(t,e),children:[g&&(0,L.jsx)(G.Td,{children:(0,L.jsx)(`input`,{type:`checkbox`,value:`checked`,"data-testid":`row-checkbox`,"aria-label":`Checkbox for ${e.id}`,checked:!!u[e.id],onChange:t=>f(t,e.id)})}),s.map(t=>(0,L.jsx)(G.Td,{children:(0,L.jsx)(uz,{propertyType:t.propertyType,path:t.fhirPath,resource:e})},t.name))]},e.id))})]}),c?.data.ResourceList.length===0&&(0,L.jsx)(`div`,{"data-testid":`empty-search`,children:`No results`}),i&&(0,L.jsx)(`div`,{"data-testid":`search-error`,children:(0,L.jsx)(`pre`,{style:{textAlign:`left`},children:JSON.stringify(i,void 0,2)})}),e.onBulk&&(0,L.jsx)(U,{onClick:()=>e.onBulk(Object.keys(u)),children:`Bulk...`})]})}var YB=(0,b.memo)(JB),XB={root:`_root_1fbwr_1`,entry:`_entry_1fbwr_8`,key:`_key_1fbwr_13`,value:`_value_1fbwr_20`};function ZB(e){return(0,L.jsx)(ml,{children:(0,L.jsx)(`div`,{className:XB.root,children:e.children})})}ZB.Entry=function(e){return(0,L.jsx)(`div`,{className:XB.entry,children:e.children})},ZB.Key=function(e){return(0,L.jsx)(`div`,{className:XB.key,children:e.children})},ZB.Value=function(e){return(0,L.jsx)(`div`,{className:XB.value,children:e.children})};var QB=[120,90,50,60,40,110,220,90];function $B(e){let t=e.entries??6;return(0,L.jsx)(ml,{children:(0,L.jsxs)(`div`,{"data-testid":`info-bar-skeleton`,className:XB.root,children:[e.withAvatar&&(0,L.jsx)(Py,{circle:!0,height:56,mr:8,style:{flexShrink:0}}),Array.from({length:t},(e,t)=>(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(Py,{height:10,width:QB[t%QB.length]*.6,mb:8}),(0,L.jsx)(Py,{height:16,width:QB[t%QB.length]})]},t))]})})}var eV={list:`_list_y4z6g_1`,link:`_link_y4z6g_6`};function tV(e){let{baseUrl:t,tabs:n,children:r,...i}=e,a=nV(n),o=Uk(),[s,c]=(0,b.useState)(()=>{let e=uD.getPathname().split(`/`).pop();if(e){let t=e.toLowerCase(),n=a.find(e=>e.value.split(/[?#]/)[0].toLowerCase()===t);if(n)return n.value}return a[0].value});function l(e){e||=a[0].value,c(e),o(`${t}/${e}`)}return(0,L.jsxs)(Ab,{value:s,onChange:l,...i,children:[(0,L.jsx)(Ab.List,{className:eV.list,children:a.map(e=>(0,L.jsx)(Ab.Tab,{value:e.value,children:(0,L.jsx)(Rd,{className:eV.link,href:`${t}/${e.value}`,onClick:rV,children:e.label})},e.value))}),r]})}function nV(e){return e.map(e=>rw(e)?{label:e,value:e.toLowerCase()}:e)}function rV(e){YM(e)||e.preventDefault()}function iV(e){let{group:t}=e;return(0,L.jsx)(Cl,{withBorder:!0,radius:`md`,p:`xs`,display:`flex`,style:{alignItems:`center`,justifyContent:`center`},children:(0,L.jsxs)(V,{children:[t.measureScore&&(0,L.jsx)(sV,{group:t}),!t.measureScore&&(0,L.jsx)(oV,{group:t})]})})}function aV(e){let{measure:t}=e;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(H,{fz:`md`,fw:500,mb:8,children:t.title}),(0,L.jsx)(H,{fz:`xs`,c:`dimmed`,mb:8,children:t.subtitle})]})}function oV(e){let{group:t}=e,n=t.population,r=n?.find(e=>Ww(e.code)===`numerator`),i=n?.find(e=>Ww(e.code)===`denominator`),a=r?.count,o=i?.count;if(o===0)return(0,L.jsxs)(z,{children:[(0,L.jsx)(K,{order:3,children:`Not Applicable`}),(0,L.jsx)(H,{children:`Denominator: ${o}`})]});if(a===void 0||o===void 0)return(0,L.jsxs)(z,{children:[(0,L.jsx)(K,{order:3,children:`Insufficient Data`}),(0,L.jsx)(H,{children:`Numerator: ${a}`}),(0,L.jsx)(H,{children:`Denominator: ${o}`})]});let s=a/o*100;return(0,L.jsx)(gy,{size:120,thickness:12,roundCaps:!0,sections:[{value:s,color:lV(s)}],label:(0,L.jsx)(xd,{justify:`center`,children:(0,L.jsxs)(H,{fw:700,fz:18,children:[a,` / `,o]})})})}function sV(e){let{group:t}=e,n=t.measureScore?.unit??t.measureScore?.code;return(0,L.jsx)(L.Fragment,{children:n===`%`?(0,L.jsx)(gy,{size:120,thickness:12,roundCaps:!0,sections:[{value:cV(t),color:lV(t?.measureScore?.value??0)}],label:(0,L.jsx)(xd,{justify:`center`,children:(0,L.jsx)(H,{fw:700,fz:18,children:(0,L.jsx)(FI,{value:t.measureScore})})})}):(0,L.jsx)(xd,{h:120,align:`center`,children:(0,L.jsx)(K,{order:3,children:(0,L.jsx)(FI,{value:t.measureScore})})})})}function cV(e){let t=e.measureScore?.value,n=e.measureScore?.unit;return t?t<=1&&n===`%`?t*100:t:0}function lV(e){return e<=33?`red`:e<=67?`yellow`:`green`}function uV(e){let t=eA(e.measureReport),[n]=JA(`Measure`,{url:t?.measure});return t?(0,L.jsxs)(z,{children:[n&&(0,L.jsx)(aV,{measure:n}),(0,L.jsx)(Ay,{cols:{base:3,sm:1},spacing:{base:`md`,sm:`sm`},children:t.group?.map((e,t)=>(0,L.jsx)(iV,{group:e},e.id??t))})]}):null}var dV=`patient-accounts`,fV=`Patient Accounts`,pV=[`Organization`,`HealthcareService`,`CareTeam`];function mV(e){let{patient:t}=e,n=Z(),r=n.isProjectAdmin()||n.isSuperAdmin(),i=(0,b.useMemo)(()=>AC(t.meta)??[],[t.meta]),[a,o]=(0,b.useState)(i),[s,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!0),[d,f]=(0,b.useState)(!1),p=(0,b.useMemo)(()=>{let e=[];for(let t of a)i.some(e=>e.reference===t.reference)||e.push({reference:t,type:`addition`});for(let t of i)a.some(e=>e.reference===t.reference)||e.push({reference:t,type:`removal`});return e},[i,a]),m=p.length>0,h=(0,b.useCallback)(e=>{e?.reference&&(a.some(t=>t.reference===e.reference)||o(t=>[...t,e]))},[a]),g=(0,b.useCallback)(e=>{o(t=>t.filter(t=>t.reference!==e))},[]),_=(0,b.useCallback)(async()=>{let r=t.id;if(!r){Zb.show({id:dV,title:fV,color:`red`,message:`Cannot update accounts: Patient resource has no ID.`,icon:(0,L.jsx)(HM,{size:`1rem`}),autoClose:!1,withCloseButton:!0});return}f(!0),c(!1);let i=n.fhirUrl(`Patient`,r,`$set-accounts`),o={resourceType:`Parameters`,parameter:[...a.map(e=>({name:`accounts`,valueReference:{reference:e.reference}})),{name:`propagate`,valueBoolean:l}]};Zb.show({id:dV,title:fV,loading:!0,message:l?`Saving account changes and propagating to compartment...`:`Saving account changes...`,autoClose:!1,withCloseButton:!1});try{let t={};l&&(t.Prefer=`respond-async`),await n.post(i,o,void 0,{headers:t}),n.invalidateUrl(n.fhirUrl(`Patient`,r)),Zb.update({id:dV,title:fV,color:`green`,message:l?`Account changes saved. Compartment updates are being applied.`:`Account changes saved.`,icon:(0,L.jsx)(jj,{size:`1rem`}),loading:!1,autoClose:!0,withCloseButton:!0}),e.onSaved?.()}catch(e){Zb.update({id:dV,title:fV,color:`red`,message:J(e),icon:(0,L.jsx)(HM,{size:`1rem`}),loading:!1,autoClose:!1,withCloseButton:!0})}finally{f(!1)}},[n,t,a,l,e]);return r?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(W,{children:[(0,L.jsx)(K,{order:3,children:`Current Accounts`}),a.length===0?(0,L.jsx)(H,{c:`dimmed`,children:`No accounts assigned to this patient.`}):(0,L.jsxs)(G,{children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Type`}),(0,L.jsx)(G.Th,{children:`Account`}),(0,L.jsx)(G.Th,{})]})}),(0,L.jsx)(G.Tbody,{children:a.map(e=>(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:(0,L.jsx)(hV,{reference:e})}),(0,L.jsx)(G.Td,{children:(0,L.jsx)(dR,{value:e,link:!0})}),(0,L.jsx)(G.Td,{children:(0,L.jsx)(bu,{variant:`subtle`,color:`red`,"aria-label":`Remove ${e.reference}`,onClick:()=>g(e.reference),children:(0,L.jsx)(HM,{size:16})})})]},e.reference))})]}),(0,L.jsx)(hm,{}),(0,L.jsx)(K,{order:4,children:`Add Account`}),(0,L.jsx)(ML,{name:`newAccount`,placeholder:`Search for Organization, HealthcareService, or CareTeam...`,targetTypes:pV,onChange:e=>{e&&h(e)}}),m&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(hm,{}),(0,L.jsx)(K,{order:4,children:`Pending Changes`}),(0,L.jsx)(W,{gap:`xs`,children:p.map(e=>(0,L.jsxs)(V,{gap:`xs`,children:[e.type===`addition`?(0,L.jsx)(Ip,{color:`green`,variant:`light`,leftSection:(0,L.jsx)(bM,{size:12}),children:`Add`}):(0,L.jsx)(Ip,{color:`red`,variant:`light`,leftSection:(0,L.jsx)(fM,{size:12}),children:`Remove`}),(0,L.jsx)(dR,{value:e.reference,link:!0})]},`${e.type}-${e.reference.reference}`))})]}),(0,L.jsx)(z,{children:(0,L.jsx)(U,{disabled:!m||d,onClick:()=>c(!0),children:`Save Changes`})})]}),(0,L.jsx)(pg,{opened:s,onClose:()=>c(!1),title:`Confirm Account Changes`,size:`md`,keepMounted:!0,children:(0,L.jsxs)(W,{children:[(0,L.jsxs)(H,{children:[`The following changes will be applied to Patient`,` `,(0,L.jsxs)(`strong`,{children:[t.name?.[0]?.given?.join(` `),` `,t.name?.[0]?.family]}),`:`]}),p.filter(e=>e.type===`addition`).length>0&&(0,L.jsxs)(z,{children:[(0,L.jsx)(H,{fw:600,c:`green`,children:`Adding:`}),(0,L.jsx)(W,{gap:`xs`,mt:`xs`,children:p.filter(e=>e.type===`addition`).map(e=>(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(bM,{size:14,color:`green`}),(0,L.jsx)(dR,{value:e.reference})]},e.reference.reference))})]}),p.filter(e=>e.type===`removal`).length>0&&(0,L.jsxs)(z,{children:[(0,L.jsx)(H,{fw:600,c:`red`,children:`Removing:`}),(0,L.jsx)(W,{gap:`xs`,mt:`xs`,children:p.filter(e=>e.type===`removal`).map(e=>(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(fM,{size:14,color:`red`}),(0,L.jsx)(dR,{value:e.reference})]},e.reference.reference))})]}),(0,L.jsx)(pp,{label:`Propagate changes to all resources in this patient's compartment`,checked:l,onChange:e=>u(e.currentTarget.checked)}),(0,L.jsxs)(V,{justify:`right`,mt:`md`,children:[(0,L.jsx)(U,{variant:`default`,onClick:()=>c(!1),children:`Cancel`}),(0,L.jsx)(U,{onClick:_,loading:d,children:`Confirm`})]})]})})]}):(0,L.jsx)(jd,{color:`blue`,title:`Admin access required`,children:`You need project admin access to manage patient account assignments.`})}function hV({reference:e}){let t=e.reference?.split(`/`)[0]??`Unknown`;return(0,L.jsx)(Ip,{variant:`light`,color:{Organization:`blue`,HealthcareService:`teal`,CareTeam:`violet`}[t]??`gray`,size:`sm`,children:t})}var gV=`patient-export`,_V=`Patient Export`,vV={everything:{operation:`$everything`,extension:`json`,contentType:wD.FHIR_JSON},summary:{operation:`$summary`,extension:`json`,contentType:wD.FHIR_JSON},ccda:{operation:`$ccda-export`,extension:`xml`,contentType:wD.CDA_XML},ccdaReferral:{operation:`$ccda-export`,type:`referral`,extension:`xml`,contentType:wD.CDA_XML}};function yV(e){let t=Z(),{patient:n}=e,[r,i]=(0,b.useState)(`everything`),[a,o]=(0,b.useState)(!1),s=(0,b.useCallback)(async e=>{let i=kC(n),{operation:o,type:s,contentType:c,extension:l}=vV[r],u=t.fhirUrl(`Patient`,i,o),d={};r===`everything`&&a&&u.searchParams.set(`_inlineAttachments`,`true`),s&&(d.type=s),e.author&&(d.author={reference:e.author}),e.authoredOn&&(d.authoredOn=fL(e.authoredOn)),e.startDate&&(d.start=e.startDate),e.endDate&&(d.end=e.endDate),Zb.show({id:gV,title:_V,loading:!0,message:`Exporting...`,autoClose:!1,withCloseButton:!1});try{bV(await t.post(u,d,void 0,{cache:`no-cache`,headers:{Accept:c}}),`Patient-export-${i}-${new Date().toISOString().replaceAll(`:`,`-`)}.${l}`,c),Zb.update({id:gV,title:_V,color:`green`,message:`Done`,icon:(0,L.jsx)(jj,{size:`1rem`}),loading:!1,autoClose:!0,withCloseButton:!0})}catch(e){Zb.update({id:gV,title:_V,color:`red`,message:J(e),icon:(0,L.jsx)(HM,{size:`1rem`}),loading:!1,autoClose:!1,withCloseButton:!0})}},[t,n,r,a]);return(0,L.jsx)(NP,{onSubmit:s,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Export Format`,description:`Required`,withAsterisk:!0,children:(0,L.jsx)(by,{name:`format`,value:r,onChange:i,data:[{label:`FHIR Everything`,value:`everything`},{label:`Patient Summary`,value:`summary`},{label:`C-CDA`,value:`ccda`},{label:`C-CDA Referral`,value:`ccdaReferral`}],fullWidth:!0})}),(0,L.jsx)(eL,{title:`Author`,description:`Optional author for composition. Default value is current user.`,children:(0,L.jsx)(ML,{name:`author`,placeholder:`Author`,targetTypes:[`Organization`,`Practitioner`,`PractitionerRole`]})}),(0,L.jsx)(eL,{title:`Authored On`,description:`Optional date for composition authored on. Default value is current date.`,children:(0,L.jsx)(pL,{name:`authoredOn`,placeholder:`Authored on`})}),(0,L.jsx)(eL,{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:(0,L.jsx)(pL,{name:`startDate`,placeholder:`Start date`})}),(0,L.jsx)(eL,{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:(0,L.jsx)(pL,{name:`endDate`,placeholder:`End date`})}),r===`everything`&&(0,L.jsx)(eL,{title:`Inline Attachments`,description:`Embed DocumentReference file attachments as base64-encoded data instead of storage URLs.`,children:(0,L.jsx)(W,{gap:`xs`,children:(0,L.jsx)(pp,{label:`Inline attachments`,checked:a,onChange:e=>o(e.currentTarget.checked)})})}),(0,L.jsx)(V,{justify:`right`,children:(0,L.jsx)(PP,{children:`Request Export`})})]})})}function bV(e,t,n){let r=typeof e==`string`?e:JSON.stringify(e,null,2),i=new Blob([r],{type:n}),a=window.URL.createObjectURL(i),o=document.createElement(`a`);document.body.appendChild(o),o.style.display=`none`,o.href=a,o.download=t,o.click(),window.URL.revokeObjectURL(a)}function xV(e){if(e.gender===`male`)return`blue`;if(e.gender===`female`)return`pink`}function SV(e){let t=eA(e.patient);return t?(0,L.jsxs)(ZB,{children:[(0,L.jsx)(oN,{value:t,size:`lg`,color:xV(t)}),(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(ZB.Key,{children:`Name`}),(0,L.jsx)(ZB.Value,{children:(0,L.jsx)(eN,{to:t,fw:500,children:t.name?(0,L.jsx)(MI,{value:t.name[0],options:{use:!1}}):`[blank]`})})]}),t.birthDate&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(ZB.Key,{children:`DoB`}),(0,L.jsx)(ZB.Value,{children:t.birthDate})]}),(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(ZB.Key,{children:`Age`}),(0,L.jsx)(ZB.Value,{children:RC(t.birthDate)})]})]}),t.gender&&(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(ZB.Key,{children:`Gender`}),(0,L.jsx)(ZB.Value,{children:t.gender})]}),t.address&&(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(ZB.Key,{children:`State`}),(0,L.jsx)(ZB.Value,{children:t.address[0]?.state})]}),t.identifier?.map(e=>(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(ZB.Key,{children:e?.system}),(0,L.jsx)(ZB.Value,{children:e?.value})]},`${e?.system}-${e?.value}`))]}):null}function CV(e){let{patient:t,...n}=e,r=(0,b.useCallback)((e,t,n)=>{let r=`${t}/${n}`;return Promise.allSettled([e.readHistory(`Patient`,n),e.search(`ClinicalImpression`,{subject:r,_count:100}),e.search(`Communication`,{subject:r,_count:100}),e.search(`Device`,{patient:r,_count:100}),e.search(`DeviceRequest`,{patient:r,_count:100}),e.search(`DiagnosticReport`,{subject:r,_count:100}),e.search(`Media`,{subject:r,_count:100}),e.search(`ServiceRequest`,{subject:r,_count:100}),e.search(`Task`,{subject:r,_count:100})])},[]);return(0,L.jsx)(QR,{value:t,loadTimelineResources:r,createCommunication:(e,t,n)=>({resourceType:`Communication`,status:`completed`,subject:DC(e),sender:DC(t),sent:new Date().toISOString(),payload:[{contentString:n}]}),createMedia:(e,t,n)=>({resourceType:`Media`,status:`completed`,subject:DC(e),operator:DC(t),issued:new Date().toISOString(),content:n}),...n})}var wV={section:`_section_pqpwm_1`,hovering:`_hovering_pqpwm_7`,editing:`_editing_pqpwm_11`};function TV(e){let t=Z(),n=eA(e.value),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)();function d(){c(void 0)}function f(){o(void 0)}if((0,b.useEffect)(()=>{t.requestSchema(`PlanDefinition`).then(()=>i(!0)).catch(console.log)},[t]),(0,b.useEffect)(()=>(u(NV(n??{resourceType:`PlanDefinition`,status:`active`})),document.addEventListener(`mouseover`,d),document.addEventListener(`click`,f),()=>{document.removeEventListener(`mouseover`,d),document.removeEventListener(`click`,f)}),[n]),!r||!l)return null;function p(e,t){u(n=>({...n,[e]:t}))}return(0,L.jsx)(`div`,{children:(0,L.jsxs)(NP,{testid:`questionnaire-form`,onSubmit:()=>e.onSubmit(l),children:[(0,L.jsx)(jb,{label:`Plan Title`,py:`md`,defaultValue:l.title,onChange:e=>p(`title`,e.currentTarget.value)}),(0,L.jsx)(EV,{actions:l.action||[],selectedKey:a,setSelectedKey:o,hoverKey:s,setHoverKey:c,onChange:e=>p(`action`,e)}),(0,L.jsx)(PP,{children:`Save`})]})})}function EV(e){function t(t){e.onChange(e.actions.map(e=>e.id===t.id?t:e))}function n(t){e.onChange([...e.actions,t]),e.setSelectedKey(t.id)}function r(t){e.onChange(e.actions.filter(e=>e!==t))}return(0,L.jsxs)(W,{gap:`md`,className:wV.section,children:[e.actions.map(n=>(0,L.jsx)(DV,{action:n,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:t,onRemove:()=>r(n)},n.id)),(0,L.jsx)(`div`,{children:(0,L.jsx)(U,{variant:`outline`,onClick:e=>{JM(e),n({id:MV()})},children:`Add action`})})]})}function DV(e){let{action:t}=e;function n(t){t.stopPropagation(),e.setSelectedKey(e.action.id)}function r(t){JM(t),e.setHoverKey(e.action.id)}return(0,L.jsx)(`div`,{onClick:n,onMouseOver:r,onFocus:r,children:(0,L.jsx)(OV,{action:t,onChange:e.onChange,selectedKey:e.selectedKey,hoverKey:e.hoverKey,onRemove:e.onRemove})})}function OV(e){let{action:t}=e,[n,r]=(0,b.useState)(),i=Z(),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(),l=e.selectedKey===e.action.id,u=e.hoverKey===e.action.id;function d(n,r){e.onChange({...t,[n]:r})}let f=Ln(wV.section,{[wV.hovering]:u&&!l});return(0,b.useEffect)(()=>{(async()=>{if(!t.definitionCanonical)return;o(!0);let e=await i.readCanonical([`Questionnaire`,`ActivityDefinition`],t.definitionCanonical);r(AV(e)),c(e),o(!1)})().catch(console.error)},[t.definitionCanonical,i]),a?(0,L.jsx)(fu,{}):(0,L.jsxs)(Cl,{"data-testid":t.id,className:f,p:0,radius:`sm`,withBorder:!0,children:[(0,L.jsxs)(xd,{w:`100%`,p:`xs`,bg:`gray.0`,gap:`md`,align:`center`,justify:`space-between`,children:[(0,L.jsx)(jb,{w:`100%`,name:`actionTitle-${t.id}`,defaultValue:t.title,placeholder:`Title`,onChange:e=>d(`title`,e.currentTarget.value)}),(0,L.jsx)(Tu,{"data-testid":`close-button`,onClick:e.onRemove})]}),l&&(0,L.jsxs)(W,{gap:`xl`,p:`md`,children:[(0,L.jsx)(z,{children:(0,L.jsx)(jb,{label:`Task Description`,placeholder:`Enter task description`,name:`actionDescription-${t.id}`,defaultValue:t.description,onChange:e=>d(`description`,e.currentTarget.value)})}),(0,L.jsx)(z,{children:(0,L.jsx)(Ig,{label:`Type of Action`,value:n,onChange:t=>{let n=t.currentTarget.value===`standard`?void 0:t.currentTarget.value;r(n),e.onChange({...e.action,definitionCanonical:n===`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`&&(0,L.jsxs)(W,{gap:0,children:[(0,L.jsxs)(V,{gap:0,mb:`xs`,children:[(0,L.jsx)(H,{fw:600,children:`Select questionnaire`}),(0,L.jsx)(H,{c:`red`,children:`*`})]}),(0,L.jsxs)(H,{size:`sm`,c:`dimmed`,mb:`sm`,children:[`Questionnaire to be shown in the task in Encounter view. You can create new one from`,` `,(0,L.jsx)(Rd,{href:`/Questionnaire`,target:`_blank`,c:`blue`,children:`questionnaires list`})]}),(0,L.jsx)(kV,{resource:s,resourceType:`Questionnaire`,action:t,onChange:e.onChange,placeholder:`Search for questionnaire`})]}),n===`activitydefinition`&&(0,L.jsxs)(W,{gap:0,children:[(0,L.jsxs)(V,{gap:0,mb:`xs`,children:[(0,L.jsx)(H,{fw:600,children:`Select activity definition`}),(0,L.jsx)(H,{c:`red`,children:`*`})]}),(0,L.jsxs)(H,{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`,` `,(0,L.jsx)(Rd,{href:`/ActivityDefinition`,target:`_blank`,c:`blue`,children:`activity definitions list`})]}),(0,L.jsx)(kV,{resource:s,resourceType:`ActivityDefinition`,action:t,onChange:e.onChange,placeholder:`Search for activity definition`})]})]})]})}function kV(e){let{id:t}=e.action,{resource:n}=e;return(0,L.jsx)(jL,{name:t,placeholder:e.placeholder,resourceType:e.resourceType,defaultValue:n,onChange:t=>{t?e.onChange({...e.action,definitionCanonical:`url`in t?t.url:void 0,definitionUri:`url`in t?void 0:OC(t)}):e.onChange({...e.action,definitionCanonical:void 0})}})}function AV(e){return e===void 0?`standard`:e.resourceType.toLowerCase()}var jV=1;function MV(e){if(e){if(e.startsWith(`id-`)){let t=Number.parseInt(e.substring(3),10);Number.isNaN(t)||(jV=Math.max(jV,t+1))}return e}return`id-`+jV++}function NV(e){return{...e,action:PV(e.action)}}function PV(e){if(e)return e.map(e=>({...e,id:MV(e.id),action:PV(e.action)}))}var FV=`modulepreload`,IV=function(e){return`/`+e},LV={},RV=function(e){return e.pathname.endsWith(`.css`)},zV=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=IV(t,n);let r=s(t);if(r.href in LV)return;LV[r.href]=!0;let i=RV(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:FV,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},BV=150,VV;function HV({onScan:e,onError:t,scanOnce:n=!0}){let r=(0,b.useRef)(null),i=(0,b.useRef)(null),a=Xk(e),o=Xk(t),[s,c]=(0,b.useState)(!0),[l,u]=(0,b.useState)();return(0,b.useEffect)(()=>{let e=r.current,t=i.current,s=t?.getContext(`2d`,{willReadFrequently:!0});if(!e||!t||!s)return;let l=e,d=t,f=s,p=0,m,h=!1,g=!1,_=0,v;function y(){m?.getTracks().forEach(e=>e.stop())}function b(e){let t=e instanceof Error?e:Error(String(e));h||(c(!1),u(J(t)),o(t))}function x(e){if(!(h||g||!v)){if(l.readyState===l.HAVE_ENOUGH_DATA&&(c(!1),e-_>=BV)){_=e,d.height=l.videoHeight,d.width=l.videoWidth,f.drawImage(l,0,0,d.width,d.height);let t=f.getImageData(0,0,d.width,d.height),r=v(t.data,t.width,t.height,{inversionAttempts:`attemptBoth`});if(r?.data&&(g=n,a(r.data),n)){y();return}}p=requestAnimationFrame(x)}}async function S(){try{if(v=await UV(),h)return;if(!navigator.mediaDevices?.getUserMedia)throw Error(`Camera access is not available in this browser.`);let e=await navigator.mediaDevices.getUserMedia({video:{facingMode:`environment`}});if(h){e.getTracks().forEach(e=>e.stop());return}m=e,l.srcObject=e,l.setAttribute(`playsinline`,`true`),await l.play(),h||(p=requestAnimationFrame(x))}catch(e){b(e)}}return S().catch(b),()=>{h=!0,cancelAnimationFrame(p),y()}},[n,a,o]),(0,L.jsxs)(W,{gap:`sm`,children:[l&&(0,L.jsx)(jd,{color:`red`,children:l}),(0,L.jsxs)(z,{pos:`relative`,style:{aspectRatio:`4 / 3`,display:l?`none`:`block`,width:`100%`,maxHeight:`70vh`,overflow:`hidden`,borderRadius:`var(--mantine-radius-default)`,background:`black`},children:[(0,L.jsx)(`video`,{ref:r,width:640,height:480,muted:!0,style:{display:`block`,width:`100%`,height:`100%`,objectFit:`cover`}}),s&&!l&&(0,L.jsx)(Xp,{pos:`absolute`,top:0,left:0,right:0,bottom:0,style:{pointerEvents:`none`},children:(0,L.jsxs)(W,{gap:`xs`,align:`center`,children:[(0,L.jsx)(fu,{size:`sm`,color:`gray.3`}),(0,L.jsx)(H,{c:`gray.3`,size:`sm`,children:`Loading camera...`})]})})]}),(0,L.jsx)(`canvas`,{ref:i,hidden:!0})]})}async function UV(){return VV||=zV(()=>import(`./jsQR-BNygLPoh.js`).then(e=>c(e.default,1)).then(e=>e.default),[]).catch(e=>{throw VV=void 0,Error(`QR code scanning requires the optional "jsqr" dependency. Install jsqr to use QrCodeScanner. ${J(e)}`)}),VV}var WV=30,GV=50;function KV(e){let t=e.formState,n=e.item,r=e.responseItem;function i(i){if(t&&e.context){if(n.repeats&&e.index!==void 0&&n.type!==nA.choice&&n.type!==nA.openChoice){let n=[...r.answer||[]];i.length===0?n.splice(e.index,1):n[e.index]=i[0],t.onChangeAnswer(e.context,e.item,n)}else t.onChangeAnswer(e.context,e.item,i)}}let a=n.type;if(!a)return null;let o=n.linkId;if(!o)return null;let s=n.repeats&&e.index!==void 0&&n.type!==nA.choice&&n.type!==nA.openChoice?`${o}-${e.index}`:o,c;n.initial&&n.initial.length>0?c=n.initial[0]:n.answerOption&&n.answerOption.length>0&&(c=n.answerOption.find(e=>e.initialSelected));let l=tH(r,e.index)??RA(c),u=BC(r,`${Bx}/fhir/StructureDefinition/questionnaire-validationError`),d=null;switch(a){case nA.display:d=(0,L.jsx)(`p`,{children:e.item.text},e.item.linkId);break;case nA.boolean:d=(0,L.jsx)($I,{title:e.item.text,htmlFor:s,children:(0,L.jsx)(pp,{id:s,name:o,required:e.required??n.required,defaultChecked:l?.value,onChange:e=>i([{valueBoolean:e.currentTarget.checked}])})},e.item.linkId);break;case nA.decimal:d=(0,L.jsx)(jb,{type:`number`,step:`any`,id:s,name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>i(e.currentTarget.value===``?[]:[{valueDecimal:e.currentTarget.valueAsNumber}])});break;case nA.integer:d=(0,L.jsx)(jb,{type:`number`,step:1,id:s,name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>i(e.currentTarget.value===``?[]:[{valueInteger:e.currentTarget.valueAsNumber}])});break;case nA.date:d=(0,L.jsx)(jb,{type:`date`,id:s,name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>i([{valueDate:e.currentTarget.value}])});break;case nA.dateTime:d=(0,L.jsx)(pL,{name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>i([{valueDateTime:e}])});break;case nA.time:d=(0,L.jsx)(jb,{type:`time`,id:s,name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>i([{valueTime:e.currentTarget.value}])});break;case nA.string:case nA.url:d=(0,L.jsx)(jb,{id:s,name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>{let t=e.currentTarget.value;i(t===``?[]:[{valueString:t}])}});break;case nA.text:d=(0,L.jsx)(hh,{id:s,name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>{let t=e.currentTarget.value;i(t===``?[]:[{valueString:t}])}});break;case nA.attachment:d=(0,L.jsx)(V,{py:4,children:(0,L.jsx)(MF,{path:``,name:s,defaultValue:l?.value,onChange:e=>i([{valueAttachment:e}])})});break;case nA.reference:d=(0,L.jsx)(ML,{name:s,required:e.required??n.required,targetTypes:kA(n),searchCriteria:jA(n,t?.subject,t?.encounter),defaultValue:l?.value,onChange:e=>i([{valueReference:e}])});break;case nA.quantity:d=(0,L.jsx)(xL,{path:``,name:s,required:e.required??n.required,defaultValue:l?.value,onChange:e=>i([{valueQuantity:e}]),disableWheel:!0});break;case nA.choice:case nA.openChoice:{let{widget:t,multiselect:a}=aH(n),o={name:s,item:n,required:e.required??n.required,initial:c,response:r,multiselect:a,onChangeAnswer:i};d=t===`check-box`?(0,L.jsx)($V,{...o}):t===`drop-down`?(0,L.jsx)(qV,{...o}):(0,L.jsx)(QV,{...o})}break;default:return null}return(0,L.jsxs)(L.Fragment,{children:[d,u?.valueString&&(0,L.jsx)(H,{c:`red`,size:`lg`,mt:4,children:u.valueString})]})}function qV(e){let{name:t,item:n,required:r,initial:i,onChangeAnswer:a,response:o,multiselect:s}=e;if(!n.answerOption?.length&&!n.answerValueSet)return(0,L.jsx)(eH,{});let c=RA(i),l=tH(o)??c,u=nH(o),d=n.repeats||s;if(n.answerValueSet)return(0,L.jsx)(UP,{name:t,placeholder:`Select items`,binding:n.answerValueSet,maxValues:d?void 0:1,required:r,onChange:e=>{d?e.length===0?a([{}]):a(e.map(e=>({valueCoding:e}))):a([{valueCoding:e[0]}])},defaultValue:l?.value});if(d){let{propertyName:e,data:t}=oH(n);return(0,L.jsx)(Mg,{data:t,placeholder:`Select items`,searchable:!0,value:u,required:r,onChange:t=>{if(t.length===0)a([{}]);else{let r=wA(t,e,n);a(r)}}})}{let e=[``];if(n.answerOption)for(let t of n.answerOption){let n=zA(t);e.push(Ow(n))}return(0,L.jsx)(Ig,{id:t,name:t,required:r,onChange:e=>{let t=e.currentTarget.selectedIndex;if(t===0){a([{}]);return}let r=n.answerOption[t-1],i=zA(r),o=`value`+dw(i.type);a([{[o]:i.value}])},defaultValue:Gw(l?.value)||l?.value,data:e})}}function JV(e,t){return e?t.valueSetExpand({url:e,count:31}).then(e=>e.expansion?.contains??[]):Promise.resolve([])}function YV(e){let t=Z(),[n,r]=(0,b.useState)([]),[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(()=>!e||void 0);return(0,b.useEffect)(()=>{async function n(){if(!e){s(!0);return}a(!0),s(void 0);try{let n=await JV(e,t);r(n),s(!0)}catch(e){let t=ZA(e);s(!t),t||console.error(`Error loading value set:`,e)}finally{a(!1)}}n().catch(console.error)},[e,t]),{options:n,loading:i,available:o}}function XV({valueSetUrl:e}){return(0,L.jsx)(z,{children:(0,L.jsx)(RP,{text:`This question is unavailable.`,severity:`error`,message:`Value set ${e} is unavailable`})})}function ZV(e,t){return e.map((e,n)=>[`${t}-valueset-${n}`,{type:`Coding`,value:{system:e.system,code:e.code,display:e.display}}])}function QV(e){let{name:t,item:n,required:r,initial:i,onChangeAnswer:a,response:o}=e,s=uT(`QuestionnaireItemAnswerOption`,`value[x]`),c=RA(i),{options:l,loading:u,available:d}=YV(n.answerValueSet),f=[],p;if(n.answerValueSet)f.push(...ZV(l,t));else if(n.answerOption){let e=n.answerOption.slice(0,GV).map((e,n)=>{let r=`${t}-option-${n}`,i=zA(e);return i?.value?(c&&VC(i)===VC(c)&&(p=r),[r,i]):null}).filter(e=>e!==null);f.push(...e)}let m=rH(f,tH(o));if(u)return(0,L.jsx)(H,{children:`Loading options...`});if(f.length===0)return d===!1?(0,L.jsx)(XV,{valueSetUrl:n.answerValueSet}):(0,L.jsx)(eH,{});let h=f.slice(0,WV);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Wv.Group,{name:t,value:m??p,required:r,onChange:e=>{let t=f.find(t=>t[0]===e);if(t){let e=t[1],n=`value`+dw(e.type);a([{[n]:e.value}])}},children:h.map(([e,t])=>(0,L.jsx)(Wv,{id:e,value:e,py:4,required:r,label:(0,L.jsx)(GI,{property:s,propertyType:t.type,value:t.value})},e))}),(n.answerValueSet&&f.length>WV||n.answerOption&&f.length>GV)&&(0,L.jsxs)(H,{size:`sm`,c:`dimmed`,mt:`xs`,children:[`Showing first `,WV,` options`]})]})}function $V(e){let{name:t,item:n,onChangeAnswer:r,response:i}=e,a=uT(`QuestionnaireItemAnswerOption`,`value[x]`),{options:o,loading:s,available:c}=YV(n.answerValueSet),l=n.answerValueSet?(i?.answer?.map(e=>e.valueCoding)||[]).filter(e=>e!==void 0):nH(i),u=[];if(n.answerValueSet)u.push(...ZV(o,t));else if(n.answerOption){let e=n.answerOption.slice(0,GV).map((e,n)=>{let r=`${t}-option-${n}`,i=zA(e);return i?.value?[r,i]:null}).filter(e=>e!==null);u.push(...e)}if(s)return(0,L.jsx)(H,{children:`Loading options...`});if(u.length===0)return c===!1?(0,L.jsx)(XV,{valueSetUrl:n.answerValueSet}):(0,L.jsx)(eH,{});let d=u.slice(0,WV),f=(e,t)=>{if(n.answerValueSet){let n=l,i;i=t?[...n,e.value]:n.filter(t=>!JC(t,e.value)),i.length===0?r([{}]):r(i.map(e=>({valueCoding:e})))}else{let i=l,a=Ow(e),o;if(o=t?[...i,a]:i.filter(e=>e!==a),o.length===0)r([{}]);else{let t=wA(o,`value`+dw(e.type),n);r(t)}}};return(0,L.jsxs)(V,{style:{flexDirection:`column`,alignItems:`flex-start`},children:[d.map(([e,t])=>{let r=Ow(t),i=n.answerValueSet?l.some(e=>JC(e,t.value)):l.includes(r);return(0,L.jsx)(pp,{id:e,label:(0,L.jsx)(GI,{property:a,propertyType:t.type,value:t.value}),checked:i,onChange:e=>f(t,e.currentTarget.checked)},e)}),(n.answerValueSet&&u.length>WV||n.answerOption&&u.length>GV)&&(0,L.jsxs)(H,{size:`sm`,c:`dimmed`,children:[`Showing first `,WV,` options`]})]})}function eH(){return(0,L.jsx)(jb,{disabled:!0,placeholder:`No Answers Defined`})}function tH(e,t=0){return zA(e?.answer?.[t]??{})}function nH(e){let t=e?.answer;return t?t.map(e=>zA(e)).map(e=>Gw(e?.value)||e?.value).filter(Boolean):[]}function rH(e,t){return e.find(e=>JC(e[1].value,t?.value))?.[0]}var iH=[`drop-down`,`radio-button`,`check-box`];function aH(e){let t=`radio-button`,n=!1;e.answerValueSet&&(t=`drop-down`);for(let r of e.extension??[]){if(r.url!==rA)continue;let e=r.valueCodeableConcept?.coding?.[0]?.code;iH.includes(e)&&(t=e),e===`multi-select`&&(n=!0)}return t===`radio-button`&&n&&(t=`check-box`),{widget:t,multiselect:n}}function oH(e){if(e.answerOption?.length===0)return{propertyName:``,data:[]};let t=e.answerOption[0];return{propertyName:`value`+dw(zA(t).type),data:(e.answerOption??[]).map(e=>{let t=Ow(zA(e));return{value:t,label:t}})}}var sH={section:`_section_my8o4_1`,hovering:`_hovering_my8o4_10`,editing:`_editing_my8o4_14`,questionBody:`_questionBody_my8o4_20`,topActions:`_topActions_my8o4_24`,bottomActions:`_bottomActions_my8o4_33`,movementActions:`_movementActions_my8o4_44`,movementIcons:`_movementIcons_my8o4_56`,columnAlignment:`_columnAlignment_my8o4_60`,linkIdInput:`_linkIdInput_my8o4_65`,typeSelect:`_typeSelect_my8o4_70`,preserveBreaks:`_preserveBreaks_my8o4_74`};function cH(e){let t=Z(),n=eA(e.questionnaire),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)();function d(){u(void 0)}function f(){c(void 0)}return(0,b.useEffect)(()=>{t.requestSchema(`Questionnaire`).then(()=>i(!0)).catch(console.log)},[t]),(0,b.useEffect)(()=>(o(_H(n??{resourceType:`Questionnaire`,status:`active`})),document.addEventListener(`mouseover`,d),document.addEventListener(`click`,f),()=>{document.removeEventListener(`mouseover`,d),document.removeEventListener(`click`,f)}),[n]),!r||!a?null:(0,L.jsx)(`div`,{children:(0,L.jsxs)(NP,{testid:`questionnaire-form`,onSubmit:()=>e.onSubmit(a),children:[(0,L.jsx)(lH,{item:a,selectedKey:s,setSelectedKey:c,hoverKey:l,setHoverKey:u,onChange:(t,n)=>{o(t),e.autoSave&&!n&&e.onSubmit&&e.onSubmit(t)}}),(0,L.jsx)(PP,{children:`Save`})]})})}function lH(e){let t=e.item,n=e.item,r=fT(e.item),i=r||n.type===nA.group,a=n.linkId??`[untitled]`,o=e.selectedKey===e.item.id,s=e.hoverKey===e.item.id,c=(0,b.useRef)(e.item);(0,b.useLayoutEffect)(()=>{c.current=e.item});function l(t){JM(t),e.setSelectedKey(e.item.id)}function u(t){JM(t),e.setHoverKey(e.item.id)}function d(t){let n=c.current;e.onChange({...n,item:n.item?.map(e=>e.id===t.id?t:e)})}function f(t,n){e.onChange({...e.item,item:[...e.item.item??[],t]},n)}function p(t){e.onChange({...e.item,item:e.item.item?.filter(e=>e!==t)})}function m(t,n){e.onChange({...c.current,[t]:n})}function h(t){e.onChange({...e.item,...t})}function g(t){e.onChange({...e.item,item:e.item.item?.map(e=>e===t?{...e,repeats:!e.repeats}:e)})}function _(t,n){let r=xH(e.item.item,t,n);e.onChange({...e.item,item:r})}let v=Ln(sH.section,{[sH.editing]:o,[sH.hovering]:s&&!o});return(0,L.jsxs)(`div`,{"data-testid":n.linkId,className:v,onClick:l,onMouseOver:u,onFocus:u,children:[(0,L.jsx)(`div`,{className:sH.questionBody,children:o?(0,L.jsxs)(L.Fragment,{children:[r&&(0,L.jsx)(jb,{size:`xl`,defaultValue:t.title,onBlur:e=>m(`title`,e.currentTarget.value)}),!r&&(0,L.jsx)(hh,{autosize:!0,minRows:2,defaultValue:n.text,onBlur:e=>m(`text`,e.currentTarget.value)}),n.type===`reference`&&(0,L.jsx)(fH,{item:n,onChange:h}),pA(n)&&(0,L.jsx)(uH,{item:n,onChange:e=>h(e)})]}):(0,L.jsxs)(L.Fragment,{children:[t.title&&(0,L.jsx)(K,{children:t.title}),n.text&&(0,L.jsx)(`div`,{className:sH.preserveBreaks,children:n.text}),!i&&(0,L.jsx)(KV,{item:n,index:0,required:!1,responseItem:{linkId:n.linkId}})]})}),n.item?.map((t,n)=>(0,L.jsx)(`div`,{children:(0,L.jsx)(lH,{item:t,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,isFirst:n===0,isLast:n===(e.item.item??[]).length-1,setHoverKey:e.setHoverKey,onChange:d,onRemove:()=>p(t),onRepeatable:g,onMoveUp:()=>_(n,-1),onMoveDown:()=>_(n,1)})},t.id)),!i&&(0,L.jsx)(`div`,{className:sH.topActions,children:o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(jb,{size:`xs`,className:sH.linkIdInput,defaultValue:n.linkId,onBlur:e=>m(`linkId`,e.currentTarget.value)}),!i&&(0,L.jsx)(Ig,{size:`xs`,className:sH.typeSelect,defaultValue:n.type,onChange:e=>m(`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`}]})]}):(0,L.jsx)(`div`,{children:a})}),!r&&(0,L.jsx)(z,{className:sH.movementActions,children:(0,L.jsxs)(z,{className:sH.columnAlignment,children:[!e.isFirst&&(0,L.jsx)(Rd,{href:`#`,onClick:t=>{t.preventDefault(),e.onMoveUp&&e.onMoveUp()},children:(0,L.jsx)(gj,{"data-testid":`up-button`,size:15,className:sH.movementIcons})}),!e.isLast&&(0,L.jsx)(Rd,{href:`#`,onClick:t=>{t.preventDefault(),e.onMoveDown&&e.onMoveDown()},children:(0,L.jsx)(hj,{"data-testid":`down-button`,size:15,className:sH.movementIcons})})]})}),(0,L.jsxs)(`div`,{className:sH.bottomActions,children:[i&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Rd,{href:`#`,onClick:e=>{e.preventDefault(),f({id:gH(),linkId:hH(`q`),type:`string`,text:`Question`})},children:`Add item`}),(0,L.jsx)(Rd,{href:`#`,onClick:e=>{e.preventDefault(),f({id:gH(),linkId:hH(`g`),type:`group`,text:`Group`},!0)},children:`Add group`})]}),r&&(0,L.jsx)(Rd,{href:`#`,onClick:e=>{e.preventDefault(),f(bH(),!0)},children:`Add Page`}),o&&!r&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Rd,{href:`#`,onClick:t=>{t.preventDefault(),e.onRepeatable&&e.onRepeatable(n)},children:n.repeats?`Remove Repeatable`:`Make Repeatable`}),(0,L.jsx)(Rd,{href:`#`,onClick:t=>{t.preventDefault(),e.onRemove&&e.onRemove()},children:`Remove`})]})]})]})}function uH(e){let t=uT(`QuestionnaireItemAnswerOption`,`value[x]`),n=e.item.answerOption??[];return(0,L.jsxs)(`div`,{children:[e.item.answerValueSet===void 0?(0,L.jsx)(dH,{options:n,property:t,item:e.item,onChange:e.onChange}):(0,L.jsx)(jb,{placeholder:`Enter Value Set`,defaultValue:e.item.answerValueSet,onChange:t=>e.onChange({...e.item,answerValueSet:t.target.value})}),(0,L.jsxs)(z,{display:`flex`,children:[(0,L.jsx)(Rd,{href:`#`,onClick:t=>{JM(t),e.onChange({...e.item,answerValueSet:void 0,answerOption:[...n,{id:gH()}]})},children:`Add choice`}),(0,L.jsx)(Fy,{w:`lg`}),(0,L.jsx)(Rd,{href:`#`,onClick:t=>{JM(t),e.onChange({...e.item,answerOption:[],answerValueSet:``})},children:`Add value set`})]})]})}function dH(e){return(0,L.jsx)(`div`,{children:e.options.map(t=>{let[n,r]=kI({type:`QuestionnaireItemAnswerOption`,value:t},`value`);return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`,width:`80%`},children:[(0,L.jsx)(`div`,{children:(0,L.jsx)(YL,{name:`value[x]`,path:`Questionnaire.answerOption.value[x]`,property:e.property,defaultPropertyType:r,defaultValue:n,onChange:(n,r)=>{let i=[...e.options],a=i.findIndex(e=>e.id===t.id);i[a]={id:t.id,[r]:n},e.onChange({...e.item,answerOption:i})},outcome:void 0},t.id)}),(0,L.jsx)(`div`,{children:(0,L.jsx)(Rd,{href:`#`,onClick:n=>{JM(n),e.onChange({...e.item,answerOption:e.options.filter(e=>e.id!==t.id)})},children:`Remove`})})]},t.id)})})}function fH(e){let t=kA(e.item)??[];return(0,L.jsxs)(L.Fragment,{children:[t.map((n,r)=>(0,L.jsxs)(V,{children:[(0,L.jsx)(YP,{name:`resourceType`,placeholder:`Resource Type`,defaultValue:n,onChange:r=>{e.onChange(AA(e.item,t.map(e=>e===n?r:e)))}}),(0,L.jsx)(Rd,{href:`#`,onClick:r=>{JM(r),e.onChange(AA(e.item,t.filter(e=>e!==n)))},children:`Remove`})]},`${n}-${r}`)),(0,L.jsx)(Rd,{href:`#`,onClick:n=>{JM(n),e.onChange(AA(e.item,[...t,``]))},children:`Add Resource Type`})]})}var pH=1,mH=1;function hH(e){return e+pH++}function gH(){return`id-`+mH++}function _H(e){return{...e,id:e.id||gH(),item:vH(e.item)}}function vH(e){if(e)return e.forEach(e=>{e.id?.match(/^id-\d+$/)&&(mH=Math.max(mH,Number.parseInt(e.id.substring(3),10)+1)),e.linkId?.match(/^q\d+$/)&&(pH=Math.max(pH,Number.parseInt(e.linkId.substring(1),10)+1))}),e.map(e=>({...e,id:e.id||gH(),item:vH(e.item),answerOption:yH(e.answerOption)}))}function yH(e){if(e)return e.map(e=>({...e,id:e.id||gH()}))}function bH(){return{id:gH(),linkId:hH(`s`),type:`group`,text:`New Page`,extension:[{url:rA,valueCodeableConcept:{coding:[{system:`http://hl7.org/fhir/questionnaire-item-control`,code:`page`}]}}]}}function xH(e,t,n){let r=e??[],i=t+n;if(i<0||i>=r.length)return r;let a=[...r];return[a[t],a[i]]=[a[i],a[t]],a}var SH=class{x;y;pressure;time;constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw 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((this.x-e.x)**2+(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?0:this.distanceTo(e)/(this.time-e.time)}},CH=class e{constructor(e,t,n,r,i,a){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=a}startPoint;control2;control1;endPoint;startWidth;endWidth;static fromPoints(t,n){let r=this.calculateControlPoints(t[0],t[1],t[2]).c2,i=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new e(t[1],r,i,t[2],n.start,n.end)}static calculateControlPoints(e,t,n){let r=e.x-t.x,i=e.y-t.y,a=t.x-n.x,o=t.y-n.y,s={x:(e.x+t.x)/2,y:(e.y+t.y)/2},c={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l=Math.sqrt(r*r+i*i),u=Math.sqrt(a*a+o*o),d=s.x-c.x,f=s.y-c.y,p=l+u==0?0:u/(l+u),m={x:c.x+d*p,y:c.y+f*p},h=t.x-m.x,g=t.y-m.y;return{c1:new SH(s.x+h,s.y+g),c2:new SH(c.x+h,c.y+g)}}length(){let e=0,t,n;for(let r=0;r<=10;r+=1){let i=r/10,a=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),o=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){let r=a-t,i=o-n;e+=Math.sqrt(r*r+i*i)}t=a,n=o}return e}point(e,t,n,r,i){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+i*e*e*e}},wH=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 TH(e,t=250){let n=0,r=null,i,a,o,s=()=>{n=Date.now(),r=null,i=e.apply(a,o),r||(a=null,o=[])};return function(...c){let l=Date.now(),u=t-(l-n);return a=this,o=c,u<=0||u>t?(r&&=(clearTimeout(r),null),n=l,i=e.apply(a,o),r||(a=null,o=[])):r||=window.setTimeout(s,u),i}}var EH=class e extends wH{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?TH(e.prototype._strokeUpdate,this.throttle):e.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._handlePointerCancel=this._handlePointerCancel.bind(this),this._handleTouchCancel=this._handleTouchCancel.bind(this),this._ctx=t.getContext(`2d`,this.canvasContextOptions),this.clear(),this.on()}canvas;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(){let{_ctx:e,canvas:t}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._dataUrl=void 0,this._dataUrlOptions=void 0,this._strokePointerId=void 0}redraw(){let e=this._data,t=this._dataUrl,n=this._dataUrlOptions;this.clear(),t&&this.fromDataURL(t,n),this.fromData(e,{clear:!1})}fromDataURL(e,t={}){return new Promise((n,r)=>{let i=new Image,a=t.ratio||window.devicePixelRatio||1,o=t.width||this.canvas.width/a,s=t.height||this.canvas.height/a,c=t.xOffset||0,l=t.yOffset||0;this._reset(this._getPointGroupOptions()),i.onload=()=>{this._ctx.drawImage(i,c,l,o,s),n()},i.onerror=e=>{r(e)},i.crossOrigin=`anonymous`,i.src=e,this._isEmpty=!1,this._dataUrl=e,this._dataUrlOptions={...t}})}toDataURL(e=`image/png`,t){switch(e){case`image/svg+xml`:return typeof t!=`object`&&(t=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(t))}`;default:return typeof t!=`number`&&(t=void 0),this.canvas.toDataURL(e,t)}}on(){this.canvas.style.touchAction=`none`,this.canvas.style.msTouchAction=`none`,this.canvas.style.userSelect=`none`,this.canvas.style.webkitUserSelect=`none`;let e=/Macintosh/.test(navigator.userAgent)&&`ontouchstart`in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),`ontouchstart`in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction=`auto`,this.canvas.style.msTouchAction=`auto`,this.canvas.style.userSelect=`auto`,this.canvas.style.webkitUserSelect=`auto`,this.canvas.removeEventListener(`pointerdown`,this._handlePointerDown),this.canvas.removeEventListener(`mousedown`,this._handleMouseDown),this.canvas.removeEventListener(`touchstart`,this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){let e=window.document===this.canvas.ownerDocument?window:this.canvas.ownerDocument.defaultView??this.canvas.ownerDocument;return{addEventListener:e.addEventListener.bind(e),removeEventListener:e.removeEventListener.bind(e)}}_removeMoveUpEventListeners(){let{removeEventListener:e}=this._getListenerFunctions();e(`pointermove`,this._handlePointerMove),e(`pointerup`,this._handlePointerUp),e(`pointercancel`,this._handlePointerCancel),e(`mousemove`,this._handleMouseMove),e(`mouseup`,this._handleMouseUp),e(`touchmove`,this._handleTouchMove),e(`touchend`,this._handleTouchEnd),e(`touchcancel`,this._handleTouchCancel)}isEmpty(){return this._isEmpty}fromData(e,{clear:t=!0}={}){t&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this),this._drawLine.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,t){return t?e.buttons===1:(e.buttons&1)==1}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:`pressure`in e?e.pressure:0}}_touchEventToSignatureEvent(e){let t=e.changedTouches[0];return{event:e,type:e.type,x:t.clientX,y:t.clientY,pressure:t.force}}_handleMouseDown(e){this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&this._strokeBegin(this._pointerEventToSignatureEvent(e))}_handleMouseMove(e){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}_handleMouseUp(e){this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))}_handleTouchStart(e){e.targetTouches.length!==1||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))}_handleTouchMove(e){if(e.targetTouches.length===1){if(e.cancelable&&e.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(e))}}_handleTouchEnd(e){e.targetTouches.length===0&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))}_handlePointerCancel(e){this._allowPointerId(e)&&(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e),!1))}_handleTouchCancel(e){e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e),!1)}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_allowPointerId(e,t=!1){return this._strokePointerId===void 0?t:this._getPointerId(e)===this._strokePointerId}_handlePointerDown(e){!this._drawingStroke&&this._isLeftButtonPressed(e)&&this._allowPointerId(e,!0)&&(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))}_handlePointerMove(e){if(this._allowPointerId(e)){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}}_handlePointerUp(e){!this._isLeftButtonPressed(e)&&this._allowPointerId(e)&&(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))}_getPointGroupOptions(e){return{penColor:e&&`penColor`in e?e.penColor:this.penColor,dotSize:e&&`dotSize`in e?e.dotSize:this.dotSize,minWidth:e&&`minWidth`in e?e.minWidth:this.minWidth,maxWidth:e&&`maxWidth`in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&`velocityFilterWeight`in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&`compositeOperation`in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){if(!this.dispatchEvent(new CustomEvent(`beginStroke`,{detail:e,cancelable:!0})))return;let{addEventListener:t}=this._getListenerFunctions();switch(e.event.type){case`mousedown`:t(`mousemove`,this._handleMouseMove,{passive:!1}),t(`mouseup`,this._handleMouseUp,{passive:!1});break;case`touchstart`:t(`touchmove`,this._handleTouchMove,{passive:!1}),t(`touchend`,this._handleTouchEnd,{passive:!1}),t(`touchcancel`,this._handleTouchCancel,{passive:!1});break;case`pointerdown`:t(`pointermove`,this._handlePointerMove,{passive:!1}),t(`pointerup`,this._handlePointerUp,{passive:!1}),t(`pointercancel`,this._handlePointerCancel,{passive:!1})}this._drawingStroke=!0;let n=this._getPointGroupOptions(),r={...n,points:[]};this._data.push(r),this._reset(n),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(e);return}this.dispatchEvent(new CustomEvent(`beforeUpdateStroke`,{detail:e}));let t=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],r=n.points,i=r.length>0&&r[r.length-1],a=i?t.distanceTo(i)<=this.minDistance:!1,o=this._getPointGroupOptions(n);if(!i||!(i&&a)){let e=this._addPoint(t,o);i?e&&this._drawCurve(e,o):this._drawDot(t,o),r.push({time:t.time,x:t.x,y:t.y,pressure:t.pressure})}this.dispatchEvent(new CustomEvent(`afterUpdateStroke`,{detail:e}))}_strokeEnd(e,t=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent(`endStroke`,{detail:e})))}_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(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,t,n){let r=this.canvas.getBoundingClientRect();return new SH(e-r.left,t-r.top,n,new Date().getTime())}_addPoint(e,t){let{_lastPoints:n}=this;if(n.push(e),n.length>2){n.length===3&&n.unshift(n[0]);let e=this._calculateCurveWidths(n[1],n[2],t),r=CH.fromPoints(n,e);return n.shift(),r}return null}_calculateCurveWidths(e,t,n){let r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(r,n),a={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,a}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,n){let r=this._ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){let n=this._ctx,r=e.endWidth-e.startWidth,i=Math.ceil(e.length())*2;n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<i;n+=1){let a=n/i,o=a*a,s=o*a,c=1-a,l=c*c,u=l*c,d=u*e.startPoint.x;d+=3*l*a*e.control1.x,d+=3*c*o*e.control2.x,d+=s*e.endPoint.x;let f=u*e.startPoint.y;f+=3*l*a*e.control1.y,f+=3*c*o*e.control2.y,f+=s*e.endPoint.y;let p=Math.min(e.startWidth+s*r,t.maxWidth);this._drawCurveSegment(d,f,p)}n.closePath(),n.fill()}_getDotSize(e){return e.dotSize>0?e.dotSize:(e.minWidth+e.maxWidth)/2}_drawDot(e,t){let n=this._ctx,r=this._getDotSize(t);n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()}_drawLine(e,t,n){let r=this._ctx;r.save(),r.beginPath(),r.moveTo(e.x,e.y),r.lineTo(t.x,t.y),r.lineWidth=this._getDotSize(n)*2,r.lineCap=`round`,r.strokeStyle=n.penColor,r.stroke(),r.restore(),this._isEmpty=!1}_fromData(e,t,n,r){for(let i of e){let{points:e}=i,a=this._getPointGroupOptions(i);if(e.length>2)for(let n=0;n<e.length;n+=1){let r=e[n],i=new SH(r.x,r.y,r.pressure,r.time);n===0&&this._reset(a);let o=this._addPoint(i,a);o&&t(o,a)}else e.length===2?(this._reset(a),r(e[0],e[1],a)):(this._reset(a),n(e[0],a))}}toSVG({includeBackgroundColor:e=!1,includeDataUrl:t=!1}={}){let n=this._data,r=Math.max(window.devicePixelRatio||1,1),i=this.canvas.width/r,a=this.canvas.height/r,o=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);if(o.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),o.setAttribute(`xmlns:xlink`,`http://www.w3.org/1999/xlink`),o.setAttribute(`viewBox`,`0 0 ${i} ${a}`),o.setAttribute(`width`,i.toString()),o.setAttribute(`height`,a.toString()),e&&this.backgroundColor){let e=document.createElement(`rect`);e.setAttribute(`width`,`100%`),e.setAttribute(`height`,`100%`),e.setAttribute(`fill`,this.backgroundColor),o.appendChild(e)}if(t&&this._dataUrl){let e=this._dataUrlOptions?.ratio||window.devicePixelRatio||1,t=this._dataUrlOptions?.width||this.canvas.width/e,n=this._dataUrlOptions?.height||this.canvas.height/e,r=this._dataUrlOptions?.xOffset||0,i=this._dataUrlOptions?.yOffset||0,a=document.createElement(`image`);a.setAttribute(`x`,r.toString()),a.setAttribute(`y`,i.toString()),a.setAttribute(`width`,t.toString()),a.setAttribute(`height`,n.toString()),a.setAttribute(`preserveAspectRatio`,`none`),a.setAttribute(`href`,this._dataUrl),o.appendChild(a)}return this._fromData(n,(e,{penColor:t})=>{let n=document.createElement(`path`);if(!isNaN(e.control1.x)&&!isNaN(e.control1.y)&&!isNaN(e.control2.x)&&!isNaN(e.control2.y)){let r=`M ${e.startPoint.x.toFixed(3)},${e.startPoint.y.toFixed(3)} C ${e.control1.x.toFixed(3)},${e.control1.y.toFixed(3)} ${e.control2.x.toFixed(3)},${e.control2.y.toFixed(3)} ${e.endPoint.x.toFixed(3)},${e.endPoint.y.toFixed(3)}`;n.setAttribute(`d`,r),n.setAttribute(`stroke-width`,(e.endWidth*2.25).toFixed(3)),n.setAttribute(`stroke`,t),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke-linecap`,`round`),o.appendChild(n)}},(e,{penColor:t,dotSize:n,minWidth:r,maxWidth:i})=>{let a=document.createElement(`circle`),s=n>0?n:(r+i)/2;a.setAttribute(`r`,s.toString()),a.setAttribute(`cx`,e.x.toString()),a.setAttribute(`cy`,e.y.toString()),a.setAttribute(`fill`,t),o.appendChild(a)},(e,t,n)=>{let r=document.createElement(`line`);r.setAttribute(`x1`,e.x.toString()),r.setAttribute(`y1`,e.y.toString()),r.setAttribute(`x2`,t.x.toString()),r.setAttribute(`y2`,t.y.toString()),r.setAttribute(`stroke`,n.penColor),r.setAttribute(`stroke-width`,(this._getDotSize(n)*2).toString()),r.setAttribute(`stroke-linecap`,`round`),o.appendChild(r)}),o.outerHTML}};function DH(e){let t=Z(),{width:n=500,height:r=200,defaultValue:i,who:a,onChange:o,...s}=e,c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=Xk(o);(0,b.useEffect)(()=>{function e(){u({type:[{system:Bx+`/fhir/signature-type`,code:`ProofOfOrigin`,display:`Proof of Origin`}],when:new Date().toISOString(),who:a??DC(t.getProfile()),data:l.current?.toDataURL().split(`,`)[1]})}if(c.current){let t=new EH(c.current);i?.data&&t.fromDataURL(i.data).catch(console.error),t.addEventListener(`endStroke`,e),l.current=t}return()=>{l.current&&l.current.removeEventListener(`endStroke`,e)}},[t,i,a,u]);let d=()=>{l.current&&l.current.clear(),u(void 0)};return(0,L.jsxs)(Cl,{withBorder:!0,p:0,w:n,h:r,pos:`relative`,...s,children:[(0,L.jsx)(`canvas`,{ref:c,width:n,height:r,"aria-label":`Signature input area`}),(0,L.jsx)(U,{onClick:d,"aria-label":`Clear signature`,pos:`absolute`,top:0,right:0,size:`xs`,leftSection:(0,L.jsx)(RM,{size:16}),variant:`subtle`,color:`gray`,children:`Clear`})]})}function OH(e){let t=[...e.context,e.responseItem];return(0,L.jsxs)(`div`,{children:[e.item.text&&(0,L.jsx)(K,{order:4,mb:`md`,children:e.item.text}),(0,L.jsx)(jH,{formState:e.formState,context:t,items:e.item.item??[],responseItems:e.responseItem.item??[]})]},e.item.linkId)}function kH(e){return(0,L.jsxs)(L.Fragment,{children:[e.responseItems.map(t=>(0,L.jsx)(OH,{formState:e.formState,context:e.context,item:e.item,responseItem:t},`group-${t.id}`)),(0,L.jsx)(Rd,{onClick:()=>e.formState.onAddGroup(e.context,e.item),children:`Add Group: ${e.item.text}`})]})}function AH(e){let{formState:t,context:n,item:r,responseItem:i}=e,a=r.type===nA.choice||r.type===nA.openChoice,o=!a,s=!a&&i.answer&&i.answer.length>0?i.answer:[{}];return(0,L.jsxs)(eL,{title:e.item.text,withAsterisk:e.item.required,children:[(0,L.jsx)(W,{gap:`xs`,children:s?.map((e,a)=>(0,L.jsx)(KV,{formState:t,context:n,item:r,responseItem:i,index:a},`${r.linkId}-${a}`))}),o&&(0,L.jsx)(Rd,{onClick:()=>t.onAddAnswer(n,r),children:`Add Item`})]},e.item.linkId)}function jH(e){let{formState:t,context:n,items:r,responseItems:i}=e,a=n.length===0,o=!1;return(0,L.jsx)(W,{gap:`xl`,children:r.map((e,r)=>{if(!gA(e,t.questionnaireResponse))return null;let s=e.type===nA.group,c=a&&s&&o;if(s&&(o=!0),e.type===nA.display)return(0,L.jsx)(`p`,{children:e.text},`display-${e.id}-${r}`);let l=i.filter(t=>t.linkId===e.linkId);return e.type===nA.group&&e.repeats?(0,L.jsxs)(b.Fragment,{children:[c&&(0,L.jsx)(hm,{color:`var(--mantine-color-gray-2)`}),(0,L.jsx)(kH,{formState:t,context:n,item:e,responseItems:l})]},`repeating-group-${e.id}-${r}`):e.type===nA.group?(0,L.jsxs)(b.Fragment,{children:[c&&(0,L.jsx)(hm,{color:`var(--mantine-color-gray-2)`}),(0,L.jsx)(OH,{formState:t,context:n,item:e,responseItem:l[0]})]},`group-${e.id}-${r}`):e.type===nA.boolean?(0,L.jsx)(KV,{formState:t,context:n,item:e,responseItem:l[0],index:0},`boolean-item-${e.id}-${r}`):e.repeats?(0,L.jsx)(AH,{formState:t,context:n,item:e,responseItem:l[0]},`repeating-item-${e.id}-${r}`):(0,L.jsx)(eL,{htmlFor:e.linkId,title:e.text,withAsterisk:e.required,children:(0,L.jsx)(KV,{formState:t,context:n,item:e,responseItem:l[0],index:0})},`repeating-item-${e.id}-${r}`)})})}function MH(e){let{formState:t,submitButtonText:n,excludeButtons:r,children:i}=e,a=t.pages,o=t.activePage,s=o>0,c=o<a.length-1,l=o===a.length-1;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Jy,{active:o,allowNextStepsSelect:!1,p:6,children:a.map((e,t)=>(0,L.jsx)(Jy.Step,{label:e.title,children:t===o&&i},e.linkId))}),!r&&(0,L.jsxs)(V,{justify:`flex-end`,mt:`xl`,gap:`xs`,children:[s&&(0,L.jsx)(U,{onClick:t.onPrevPage,children:`Back`}),c&&(0,L.jsx)(U,{onClick:e=>{e.currentTarget.closest(`form`).reportValidity()&&t.onNextPage()},children:`Next`}),l&&(0,L.jsx)(PP,{children:n??`Submit`})]})]})}function NH(e){let t=Z(),[n,r]=(0,b.useState)(!1),i=(0,b.useRef)(e),a=(0,b.useRef)(void 0);(0,b.useLayoutEffect)(()=>{i.current=e});let o=(0,b.useCallback)(e=>{a.current=e},[]),s=HA({questionnaire:e.questionnaire,defaultValue:e.questionnaireResponse,subject:e.subject,encounter:e.encounter,source:e.source,disablePagination:e.disablePagination,onChange:o}),c=(0,b.useRef)(s);(0,b.useLayoutEffect)(()=>{c.current=s}),(0,b.useEffect)(()=>{let e=a.current;e&&(a.current=void 0,r(!1),i.current.onChange?.(e))});let l=(0,b.useMemo)(()=>!s.loading&&!!BC(s.questionnaire,lA),[s]),u=(0,b.useMemo)(()=>!s.loading&&!!s.questionnaireResponse.extension?.find(e=>e.url===uA),[s]),d=(0,b.useCallback)(()=>{let e=c.current;if(e.loading)return;let n=i.current.onSubmit;if(!n)return;if(l&&!u){r(!0);return}let a=e.questionnaire,o=e.questionnaireResponse,s=i.current.subject,d=i.current.source;if(!d){let e=t.getProfile();e&&(d=DC(e))}n({...o,questionnaire:a.url??OC(a),subject:s,source:d,authored:new Date().toISOString(),status:`completed`})},[t,l,u]);return s.loading?null:(0,L.jsxs)(NP,{testid:`questionnaire-form`,onSubmit:d,children:[s.questionnaire.title&&(0,L.jsx)(K,{order:1,fz:`1.625rem`,fw:700,lh:1.3,mb:`xl`,children:s.questionnaire.title}),e.afterHeader&&(0,L.jsxs)(W,{gap:`xl`,mb:`xl`,children:[e.afterHeader,(0,L.jsx)(hm,{color:`var(--mantine-color-gray-2)`})]}),s.pagination?(0,L.jsx)(MH,{formState:s,submitButtonText:e.submitButtonText,excludeButtons:e.excludeButtons,children:(0,L.jsx)(jH,{formState:s,context:[],items:s.items,responseItems:s.responseItems})}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(jH,{formState:s,context:[],items:s.items,responseItems:s.responseItems}),l&&(0,L.jsxs)(W,{mt:`md`,gap:0,children:[(0,L.jsx)(H,{size:`sm`,fw:500,children:`Signature`}),(0,L.jsx)(DH,{onChange:s.onChangeSignature}),!u&&n&&(0,L.jsx)(H,{c:`red`,size:`sm`,children:`Signature is required.`})]}),!e.excludeButtons&&(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,gap:`xs`,children:(0,L.jsx)(PP,{children:e.submitButtonText??`Submit`})})]})]})}var PH={section:`_section_4m5it_1`},FH=[`gender`,`age`,`gestationalAge`,`context`,`appliesTo`,`category`],IH={definition:{resourceType:`ObservationDefinition`,code:{text:``}},onSubmit:()=>{}};function LH(e){e=Object.assign(IH,e);let t=e.definition,[n,r]=(0,b.useState)([]),[i,a]=(0,b.useState)(1),[o,s]=(0,b.useState)(1);return(0,b.useEffect)(()=>{let e=BH(t,s);r(VH(e.qualifiedInterval||[],a))},[t]),(0,L.jsxs)(NP,{testid:`reference-range-editor`,onSubmit:c,children:[(0,L.jsx)(W,{children:n.map(e=>(0,L.jsx)(RH,{unit:UH(t.quantitativeDetails?.unit),onChange:d,onAdd:f,onRemove:p,onRemoveGroup:u,intervalGroup:e},`group-${e.id}`))}),(0,L.jsx)(bu,{title:`Add Group`,variant:`subtle`,size:`sm`,onClick:e=>{JM(e),l({id:`group-id-${i}`,filters:{},intervals:[]}),a(e=>e+1)},children:(0,L.jsx)(Ij,{})}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(PP,{children:`Save`})})]});function c(){let r=n.flatMap(e=>e.intervals).filter(e=>!WH(e));e.onSubmit({...t,qualifiedInterval:r})}function l(e){r(t=>[...t,e])}function u(e){r(t=>t.filter(t=>t.id!==e.id))}function d(e,t){r(n=>{n=[...n];let r=n.find(t=>t.id===e),i=r?.intervals.findIndex(e=>e.id===t.id);return i!==void 0&&r?.intervals[i]&&(r.intervals[i]=t),n})}function f(e,t){t.id===void 0&&(t.id=`id-${o}`,s(e=>e+1)),r(n=>{n=[...n];let r=n.findIndex(t=>t.id===e);if(r!==-1){let e={...n[r]};t={...t,...e.filters},e.intervals=[...e.intervals,t],n[r]=e}return n})}function p(e,t){r(n=>{n=[...n];let r=n.find(t=>t.id===e);return r&&(r.intervals=r.intervals.filter(e=>e.id!==t.id)),n})}}function RH(e){let{intervalGroup:t,unit:n}=e;return(0,L.jsx)(PF,{"data-testid":t.id,className:PH.section,children:(0,L.jsxs)(W,{gap:`lg`,children:[(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(bu,{title:`Remove Group`,variant:`subtle`,"data-testid":`remove-group-button-${t.id}`,size:`sm`,onClick:n=>{JM(n),e.onRemoveGroup(t)},children:(0,L.jsx)(Fj,{})},`remove-group-button-${t.id}`)}),(0,L.jsx)(zH,{intervalGroup:t,onChange:e.onChange}),(0,L.jsx)(hm,{}),t.intervals.map(n=>(0,L.jsxs)(W,{gap:`xs`,children:[(0,L.jsxs)(V,{children:[(0,L.jsx)(jb,{"data-testid":`condition-${n.id}`,defaultValue:n.condition,label:`Condition: `,size:`sm`,onChange:r=>{JM(r),e.onChange(t.id,{...n,condition:r.currentTarget.value.trim()})}},`condition-${n.id}`),(0,L.jsx)(bu,{title:`Remove Interval`,variant:`subtle`,size:`sm`,"data-testid":`remove-interval-${n.id}`,onClick:r=>{JM(r),e.onRemove(t.id,n)},children:(0,L.jsx)(Fj,{})},`remove-interval-${n.id}`)]}),(0,L.jsx)(CL,{path:``,onChange:r=>{e.onChange(t.id,{...n,range:r})},name:`range-${n.id}`,defaultValue:n.range},`range-${n.id}`)]},`interval-${n.id}`)),(0,L.jsx)(bu,{title:`Add Interval`,variant:`subtle`,size:`sm`,onClick:r=>{JM(r),e.onAdd(t.id,{range:{low:{unit:n},high:{unit:n}}})},children:(0,L.jsx)(Ij,{})})]})})}function zH(e){let{intervalGroup:t,onChange:n}=e,r=t.filters.age??{},i={low:r.low?.unit?r.low:{...r.low,unit:`years`,system:`http://unitsofmeasure.org`},high:r.high?.unit?r.high:{...r.high,unit:`years`,system:`http://unitsofmeasure.org`}};return(0,L.jsxs)(W,{style:{maxWidth:`50%`},children:[(0,L.jsx)(V,{children:(0,L.jsx)(Ig,{data:[``,`male`,`female`],label:`Gender:`,defaultValue:t.filters.gender||``,onChange:e=>{for(let r of t.intervals){let i=e.currentTarget.value;i===``&&(i=void 0),n(t.id,{...r,gender:i})}}})}),(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(H,{component:`label`,htmlFor:`div-age-${t.id}`,children:`Age:`}),(0,L.jsx)(`div`,{id:`div-age-${t.id}`,children:(0,L.jsx)(CL,{path:``,name:`age-${t.id}`,defaultValue:i,onChange:e=>{for(let r of t.intervals)n(t.id,{...r,age:e})}},`age-${t.id}`)})]}),(0,L.jsx)(Ig,{data:[``,`pre-puberty`,`follicular`,`midcycle`,`luteal`,`postmenopausal`],label:`Endocrine:`,defaultValue:t.filters.context?.text||``,onChange:e=>{for(let r of t.intervals){let i=e.currentTarget.value;i===``?(i=void 0,n(t.id,{...r,context:void 0})):n(t.id,{...r,context:{text:i,coding:[{code:i,system:`http://terminology.hl7.org/CodeSystem/referencerange-meaning`}]}})}}}),(0,L.jsx)(Ig,{data:[``,`reference`,`critical`,`absolute`],label:`Category: `,defaultValue:t.filters.category,onChange:e=>{for(let r of t.intervals){let i=e.currentTarget.value;i===``?n(t.id,{...r,category:void 0}):n(t.id,{...r,category:i})}}})]})}function BH(e,t){let n=e.qualifiedInterval||[],r=Math.max(...n.map(e=>{let t=Number.parseInt(e.id?.substring(3)||``,10);return Number.isNaN(t)?-1/0:t}))+1;return Number.isFinite(r)||(r=1),e={...e,qualifiedInterval:n.map(e=>({...e,id:e.id||`id-${r++}`}))},t(r),e}function VH(e,t){let n=1,r={};for(let t of e){let e=HH(t);e in r||(r[e]={id:`group-id-${n++}`,filters:Object.fromEntries(FH.map(e=>[e,t[e]])),intervals:[]}),r[e].intervals.push(t)}return t(n),Object.values(r)}function HH(e){return[`gender=${e.gender}`,`age=${Vw(e.age)}`,`gestationalAge=${Vw(e.gestationalAge)}`,`context=${e.context?.text}`,`appliesTo=${e.appliesTo?.map(e=>e.text).join(`+`)}`,`category=${e.category}`].join(`:`)}function UH(e){return e&&(mw(e,`http://unitsofmeasure.org`)||e.text)}function WH(e){return e.range?.low?.value===void 0&&e.range?.high?.value===void 0}function GH(e){let t=Z(),n=eA(e.value),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)();return(0,b.useEffect)(()=>{n&&!r&&(t.executeBatch(s(n)).then(o).catch(console.log),i(!0))},[t,n,r]),!n||!a?null:(0,L.jsx)(km,{children:n.action?.map((t,n)=>{let r=t.resource&&c(t.resource),i=r?.input?.[0]?.valueReference,a=r?.output?.[0]?.valueReference;return(0,L.jsxs)(b.Fragment,{children:[(0,L.jsx)(km.Col,{span:1,p:`md`,children:r?.status===`completed`?(0,L.jsx)(Mj,{}):(0,L.jsx)(jM,{color:`gray`})}),(0,L.jsxs)(km.Col,{span:9,p:`xs`,children:[(0,L.jsx)(H,{fw:500,children:t.title}),t.description&&(0,L.jsx)(`div`,{children:t.description}),(0,L.jsxs)(`div`,{children:[`Last edited by\xA0`,(0,L.jsx)(uR,{value:r?.meta?.author}),`\xA0on\xA0`,Pw(r?.meta?.lastUpdated)]}),(0,L.jsxs)(`div`,{children:[`Status: `,(0,L.jsx)(sR,{status:r?.status||`unknown`})]})]}),(0,L.jsxs)(km.Col,{span:2,p:`md`,children:[i&&!a&&(0,L.jsx)(U,{onClick:()=>e.onStart(r,i),children:`Start`}),i&&a&&(0,L.jsx)(U,{onClick:()=>e.onEdit(r,i,a),children:`Edit`})]})]},`action-${n}`)})});function s(e){let t=[];if(e.action)for(let n of e.action)n.resource?.reference&&t.push({request:{method:`GET`,url:n.resource.reference}});return{resourceType:`Bundle`,type:`batch`,entry:t}}function c(e){for(let t of a?.entry??[])if(t.resource&&e.reference===OC(t.resource))return t.resource}}function KH(e,t){return JH(qH(e,t),e,t)}function qH(e,t){let n=e.length,r=t.length,i=n+r+1,a=1+2*i,o=Math.trunc(a/2),s=Array(a);s[o+1]={i:0,j:-1,prev:void 0,snake:!0};for(let a=0;a<i;a++){for(let i=-a;i<=a;i+=2){let c=o+i,l=c+1,u=c-1,d=s[l],f=s[u],p,m=0;i===-a||i!==a&&f.i<d.i?(m=d.i,p=d):(m=f.i+1,p=f),s[u]=void 0;let h=m-i,g={i:m,j:h,prev:YH(p),snake:!1};for(;m<n&&h<r&&e[m]===t[h];)m++,h++;if(m>g.i&&(g={i:m,j:h,prev:g,snake:!0}),s[c]=g,m>=n&&h>=r)return s[c]}s[o+a-1]=void 0}}function JH(e,t,n){let r=[],i=e;for(i.snake&&(i=i.prev);i?.prev&&i.prev.j>=0;){let e=i.i,a=i.j;i=i.prev;let o=i.i,s=i.j,c={position:o,lines:t.slice(o,e)},l={position:s,lines:n.slice(s,a)},u;u=c.lines.length===0&&l.lines.length>0?`insert`:c.lines.length>0&&l.lines.length===0?`delete`:`change`,r.push({original:c,revised:l,type:u}),i.snake&&(i=i.prev)}return r}function YH(e){return e&&!e.snake&&e.prev?e.prev:e}function XH(e){let t=(e.entry??[]).filter(e=>!!e.resource).map(e=>({meta:e.resource?.meta,lines:VC(e.resource,!0).match(/[^\r\n]+/g)})).sort((e,t)=>e.meta.lastUpdated.localeCompare(t.meta.lastUpdated));if(!t.length)return[];let n=t[0].lines.map(e=>({id:t[0].meta.versionId,meta:t[0].meta,value:e,span:1}));return ZH(n,t),QH(n),n}function ZH(e,t){for(let n=1;n<t.length;n++){let r=KH(t[n-1].lines,t[n].lines);for(let i of r){let r=i.original.position,a=i.original.lines,o=i.revised.lines;if((i.type===`delete`||i.type===`change`)&&e.splice(r,a.length),i.type===`insert`||i.type===`change`)for(let a=0;a<i.revised.lines.length;a++)e.splice(r+a,0,{id:t[n].meta.versionId,meta:t[n].meta,value:o[a],span:1})}}}function QH(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}}var $H={container:`_container_1pz0t_1`,root:`_root_1pz0t_5`,startRow:`_startRow_1pz0t_20`,normalRow:`_normalRow_1pz0t_25`,author:`_author_1pz0t_30`,onBehalfOf:`_onBehalfOf_1pz0t_34`,dateTime:`_dateTime_1pz0t_40`,lineNumber:`_lineNumber_1pz0t_46`,line:`_line_1pz0t_46`,pre:`_pre_1pz0t_61`};function eU(e,t){return`/${e.resourceType}/${e.id}/_history/${t}`}function tU(e){let t=Math.floor((Date.now()-Date.parse(e))/1e3),n=Math.floor(t/31536e3);if(n>0)return nU(n,`year`);let r=Math.floor(t/2592e3);if(r>0)return nU(r,`month`);let i=Math.floor(t/86400);if(i>0)return nU(i,`day`);let a=Math.floor(t/3600);if(a>0)return nU(a,`hour`);let o=Math.floor(t/60);return o>0?nU(o,`minute`):nU(t,`second`)}function nU(e,t){return`${e} ${e===1?t:t+`s`} ago`}function rU(e){let t=Z(),[n,r]=(0,b.useState)(e.history);if((0,b.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(0,L.jsx)(`div`,{children:`Loading...`});let i=n.entry?.[0]?.resource;if(!i)return null;let a=XH(n);return(0,L.jsx)(`div`,{className:$H.container,children:(0,L.jsx)(`table`,{className:$H.root,children:(0,L.jsx)(`tbody`,{children:a.map((e,t)=>(0,L.jsxs)(`tr`,{className:e.span>0?$H.startRow:$H.normalRow,children:[e.span>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`td`,{className:$H.author,rowSpan:e.span,children:[(0,L.jsx)(uR,{value:e.meta.author,link:!0,fz:`xs`}),e.meta.onBehalfOf&&(0,L.jsxs)(`div`,{className:$H.onBehalfOf,children:[`on behalf of `,(0,L.jsx)(uR,{value:e.meta.onBehalfOf,link:!0,fz:`xs`,c:`dimmed`})]})]}),(0,L.jsx)(`td`,{className:$H.dateTime,rowSpan:e.span,children:(0,L.jsx)(eN,{to:eU(i,e.meta.versionId),fz:`xs`,children:tU(e.meta.lastUpdated)})})]}),(0,L.jsx)(`td`,{className:$H.lineNumber,children:t+1}),(0,L.jsx)(`td`,{className:$H.line,children:(0,L.jsx)(`pre`,{className:$H.pre,children:e.value})})]},`row-`+t))})})})}var iU={removed:`_removed_el5zk_1`,added:`_added_el5zk_6`};function aU(e){let t=e.original,n=e.revised;e.ignoreMeta&&(t={...t,meta:void 0},n={...n,meta:void 0});let r=KH(VC(t,!0).match(/[^\r\n]+/g)??[`{`,`}`],VC(n,!0).match(/[^\r\n]+/g)??[`{`,`}`]);return(0,L.jsx)(`pre`,{style:{color:`gray`},children:r.map((e,t)=>(0,L.jsx)(oU,{delta:e},`delta`+t))})}function oU(e){return(0,L.jsxs)(L.Fragment,{children:[`...`,(0,L.jsx)(`br`,{}),e.delta.original.lines.length>0&&(0,L.jsx)(`div`,{className:iU.removed,children:e.delta.original.lines.join(`
|
|
209
|
-
`)}),e.delta.revised.lines.length>0&&(0,L.jsx)(`div`,{className:
|
|
210
|
-
`)}),`...`,(0,L.jsx)(`br`,{})]})}var sU={splitButton:`_splitButton_1i0gi_1`,menuControl:`_menuControl_1i0gi_6`};function cU(e){let{outcome:t}=e,n=Z(),r=eA(e.defaultValue),i=r?.resourceType,[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(),l=n.getAccessPolicy(),u=Dr();(0,b.useEffect)(()=>{if(r){if(e.profileUrl){let t=e.profileUrl;n.requestProfileSchema(e.profileUrl,{expandProfile:!0}).then(()=>{let e=RS(t);if(e){o(!0);let t=KO(r,e);c(t)}else console.error(`Schema not found for ${t}`)}).catch(e=>{console.error(`Error in requestProfileSchema`,e)})}else n.requestSchema(i).then(()=>{c(r),o(!0)}).catch(console.log)}},[n,r,i,e.profileUrl]);let d=(0,b.useMemo)(()=>r&&aD(r,tD.READ,l),[l,r]),f=(0,b.useMemo)(()=>n.isSuperAdmin()||!l||!KC(s?.resourceType)?!0:rD(l,s?.resourceType),[n,l,s?.resourceType]);return!a||!s?(0,L.jsx)(`div`,{children:`Loading...`}):f?(0,L.jsxs)(`form`,{id:e.formId,noValidate:!0,autoComplete:`off`,onSubmit:t=>{t.preventDefault(),e.onSubmit&&e.onSubmit(s)},children:[(0,L.jsxs)(W,{mb:`xl`,children:[(0,L.jsx)(eL,{title:`Resource Type`,htmlFor:`resourceType`,outcome:t,children:(0,L.jsx)(jb,{name:`resourceType`,defaultValue:s.resourceType,disabled:!0})}),(0,L.jsx)(eL,{title:`ID`,htmlFor:`id`,outcome:t,children:(0,L.jsx)(jb,{name:`id`,defaultValue:s.id,disabled:!0})})]}),(0,L.jsx)(nR,{path:s.resourceType,valuePath:s.resourceType,typeName:i,defaultValue:s,outcome:t,onChange:c,profileUrl:e.profileUrl,accessPolicyResource:d}),!e.hideSubmitButton&&(0,L.jsxs)(V,{justify:`flex-end`,mt:`xl`,wrap:`nowrap`,gap:0,children:[(0,L.jsx)(U,{type:`submit`,className:Ln((e.onPatch||e.onDelete)&&sU.splitButton),children:r?.id?`Update`:`Create`}),(e.onPatch||e.onDelete)&&(0,L.jsxs)(Xh,{transitionProps:{transition:`pop`},position:`bottom-end`,withinPortal:!0,children:[(0,L.jsx)(Xh.Target,{children:(0,L.jsx)(bu,{variant:`filled`,color:u.primaryColor,size:36,className:sU.menuControl,"aria-label":`More actions`,children:(0,L.jsx)(Nj,{size:14,stroke:1.5})})}),(0,L.jsxs)(Xh.Dropdown,{children:[e.onPatch&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(Gj,{size:14,stroke:1.5}),onClick:()=>{e.onPatch(s)},children:`Patch`}),e.onDelete&&(0,L.jsx)(Xh.Item,{color:`red`,leftSection:(0,L.jsx)(RM,{size:14,stroke:1.5,color:`red`}),onClick:()=>{e.onDelete(s)},children:`Delete`})]})]})]})]}):(0,L.jsxs)(jd,{color:`red`,title:`Permission denied`,icon:(0,L.jsx)(pj,{}),children:[`Your access level prevents you from editing and creating `,s.resourceType,` resources.`]})}function lU(e){let t=Z(),[n,r]=(0,b.useState)(e.history);return(0,b.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?(0,L.jsxs)(G,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Author`}),(0,L.jsx)(G.Th,{children:`On Behalf Of`}),(0,L.jsx)(G.Th,{children:`Date`}),(0,L.jsx)(G.Th,{children:`Version`})]})}),(0,L.jsx)(G.Tbody,{children:n.entry?.map((e,t)=>(0,L.jsx)(uU,{entry:e},`entry-`+t))})]}):(0,L.jsx)(`div`,{children:`Loading...`})}function uU(e){let{response:t,resource:n}=e.entry;return n?(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:(0,L.jsx)(dR,{value:n.meta?.author,link:!0})}),(0,L.jsx)(G.Td,{children:n.meta?.onBehalfOf&&(0,L.jsx)(dR,{value:n.meta.onBehalfOf,link:!0})}),(0,L.jsx)(G.Td,{children:Pw(n.meta?.lastUpdated)}),(0,L.jsx)(G.Td,{children:(0,L.jsx)(eN,{to:dU(n),children:n.meta?.versionId})})]}):(0,L.jsx)(G.Tr,{children:(0,L.jsx)(G.Td,{colSpan:4,children:J(t?.outcome)})})}function dU(e){return`/${e.resourceType}/${e.id}/_history/${e.meta?.versionId}`}var fU=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,pU=/^[\\/]{2}/;function mU(e,t){return t+e.replace(/\\/g,`/`)}var hU=`popstate`;function gU(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function _U(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return SU(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:CU(t)}return TU(t,n,null,e)}function vU(e,t){if(e===!1||e==null)throw Error(t)}function yU(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function bU(){return Math.random().toString(36).substring(2,10)}function xU(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function SU(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?wU(t):t,state:n,key:t&&t.key||r||bU(),mask:i}}function CU({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 wU(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 TU(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=gU(e)?e:SU(h.location,e,t);n&&n(r,e),l=u()+1;let d=xU(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=gU(e)?e:SU(h.location,e,t);n&&n(r,e),l=u();let i=xU(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return EU(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(hU,d),c=e,()=>{i.removeEventListener(hU,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function EU(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),vU(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:CU(t);return i=i.replace(/ $/,`%20`),!n&&pU.test(i)&&(i=r+i),new URL(i,r)}var DU=class{#e=new Map;constructor(e){if(e)for(let[t,n]of e)this.set(t,n)}get(e){if(this.#e.has(e))return this.#e.get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){this.#e.set(e,t)}},OU=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function kU(e){return OU.has(e)}var AU=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function jU(e){return AU.has(e)}function MU(e){return e.index===!0}function NU(e){let t={};return e.Component&&Object.assign(t,{element:b.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:b.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:b.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function PU(e,t=NU,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(vU(e.index!==!0||!e.children,`Cannot specify children on an index route`),vU(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),MU(e)){let n={...e,id:s};return r[s]=FU(n,t(n)),n}{let n={...e,id:s,children:void 0};return r[s]=FU(n,t(n)),e.children&&(n.children=PU(e.children,t,o,r,i)),n}})}function FU(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function IU(e,t,n=`/`){return LU(e,t,n,!1)}function LU(e,t,n,r,i){let a=aW((typeof t==`string`?wU(t):t).pathname||`/`,n);if(a==null)return null;let o=i??zU(e),s=null,c=iW(a);for(let e=0;s==null&&e<o.length;++e)s=eW(o[e],c,r);return s}function RU(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,loaderData:t[n.id],handle:n.handle}}function zU(e){let t=BU(e);return HU(t),t}function BU(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;vU(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=hW([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(vU(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),BU(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:QU(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=rW(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of VU(e.path))a(e,t,!0,n)}),t}function VU(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=VU(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function HU(e){e.sort((e,t)=>e.score===t.score?$U(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var UU=/^:[\w-]+$/,WU=/^:[\w-]+/,GU=3.5,KU=3,qU=2,JU=1,YU=10,XU=-2,ZU=e=>e===`*`;function QU(e,t){let n=e.split(`/`),r=n.length;return n.some(ZU)&&(r+=XU),t&&(r+=qU),n.filter(e=>!ZU(e)).reduce((e,t)=>e+(UU.test(t)?KU:WU.test(t)?GU:t===``?JU:YU),r)}function $U(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function eW(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?nW(u,l,s.matcher,s.compiledParams):tW(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=tW({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:hW([a,d.pathname]),pathnameBase:_W(hW([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=hW([a,d.pathnameBase]))}return o}function tW(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=rW(e.path,e.caseSensitive,e.end);return nW(e,t,n,r)}function nW(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function rW(e,t=!1,n=!0){yU(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=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function iW(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return yU(!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 aW(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 oW({basename:e,pathname:t}){return t===`/`?e:hW([e,t])}var sW=e=>fU.test(e);function cW(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?wU(e):e,a;return n?(n=mW(n),a=n.startsWith(`/`)?lW(n.substring(1),`/`):lW(n,t)):a=t,{pathname:a,search:vW(r),hash:yW(i)}}function lW(e,t){let n=gW(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function uW(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 dW(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function fW(e){let t=dW(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function pW(e,t,n,r=!1){let i;typeof e==`string`?i=wU(e):(i={...e},vU(!i.pathname||!i.pathname.includes(`?`),uW(`?`,`pathname`,`search`,i)),vU(!i.pathname||!i.pathname.includes(`#`),uW(`#`,`pathname`,`hash`,i)),vU(!i.search||!i.search.includes(`#`),uW(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=cW(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var mW=e=>e.replace(/[\\/]{2,}/g,`/`),hW=e=>mW(e.join(`/`)),gW=e=>e.replace(/\/+$/,``),_W=e=>gW(e).replace(/^\/*/,`/`),vW=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,yW=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,bW=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],xW=class{status;statusText;data;error;internal;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 SW(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function CW(e){return hW(e.map(e=>e.route.path).filter(Boolean))||`/`}function wW(e,t){let n=new URL(typeof e==`string`||e instanceof URL?e:e.url),r=typeof t==`string`?wU(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);let i=e.toString();n.search=i?`?${i}`:``}else n.search=``;return n.hash=r.hash||``,n}var TW=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function EW(e,t){let n=e;if(typeof n!=`string`||!fU.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(TW)try{let e=new URL(window.location.href),r=pU.test(n)?new URL(mU(n,e.protocol)):new URL(n),a=aW(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{yU(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var DW=Symbol(`Uninstrumented`),OW=new WeakMap;function kW(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){e.lazy!=null&&n.lazy.push(e.lazy),e[`lazy.loader`]!=null&&n[`lazy.loader`].push(e[`lazy.loader`]),e[`lazy.action`]!=null&&n[`lazy.action`].push(e[`lazy.action`]),e[`lazy.middleware`]!=null&&n[`lazy.middleware`].push(e[`lazy.middleware`]),e.middleware!=null&&n.middleware.push(e.middleware),e.loader!=null&&n.loader.push(e.loader),e.action!=null&&n.action.push(e.action)}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=t.lazy;r.lazy=async(...t)=>FW(await IW(n.lazy,void 0,()=>e(...t),LW))}if(typeof t.lazy==`object`){let e=t.lazy;if(typeof e.middleware==`function`&&n[`lazy.middleware`].length>0){let t=e.middleware;r.lazy=Object.assign(r.lazy||{},{middleware:async(...e)=>FW(await IW(n[`lazy.middleware`],void 0,()=>t(...e),LW))})}if(typeof e.loader==`function`&&n[`lazy.loader`].length>0){let t=e.loader;r.lazy=Object.assign(r.lazy||{},{loader:async(...e)=>FW(await IW(n[`lazy.loader`],void 0,()=>t(...e),LW))})}if(typeof e.action==`function`&&n[`lazy.action`].length>0){let t=e.action;r.lazy=Object.assign(r.lazy||{},{action:async(...e)=>FW(await IW(n[`lazy.action`],void 0,()=>t(...e),LW))})}}if(typeof t.loader==`function`&&n.loader.length>0){let e=jW(t.loader),i=async(...t)=>FW(await IW(n.loader,RW(t[0]),()=>e(...t),LW));e.hydrate===!0&&(i.hydrate=!0),MW(i,e),r.loader=i}if(typeof t.action==`function`&&n.action.length>0){let e=jW(t.action),i=async(...t)=>FW(await IW(n.action,RW(t[0]),()=>e(...t),LW));MW(i,e),r.action=i}return t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=jW(e),r=async(...e)=>FW(await IW(n.middleware,RW(e[0]),()=>t(...e),LW));return MW(r,t),r})),r}function AW(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){e.navigate!=null&&n.navigate.push(e.navigate),e.fetch!=null&&n.fetch.push(e.fetch)}})),n.navigate.length>0){let t=jW(e.navigate),r=async(...r)=>{let[i,a]=r,o,s={to:typeof i==`number`||typeof i==`string`?i:i?CU(i):`.`,...zW(e,a??{})};return FW(await IW(n.navigate,s,async()=>{if(typeof i==`number`)return await t(...r);let n=NW(e,e=>{o=e});try{return await t(...r)}finally{n()}},e=>({...LW(e),meta:o})))};MW(r,t),e.navigate=r}if(n.fetch.length>0){let t=jW(e.fetch),r=async(...r)=>{let[i,a,o,s]=r,c;return FW(await IW(n.fetch,{href:o??`.`,fetcherKey:i,...zW(e,s??{})},async()=>{let n=NW(e,e=>{c=e});try{return await t(...r)}finally{n()}},e=>({...LW(e),meta:c})))};MW(r,t),e.fetch=r}return e}function jW(e){return e[DW]??e}function MW(e,t){e[DW]=t}function NW(e,t){return OW.set(e,t),()=>{OW.get(e)===t&&OW.delete(e)}}function PW(e){let t=OW.get(e);return OW.delete(e),t}function FW(e){if(e.type===`error`)throw e.value;return e.value}async function IW(e,t,n,r,i={result:null,innerResult:null},a=e.length-1){let o=e[a];if(o){let s,c=async()=>(s?console.error(`You cannot call instrumented handlers more than once`):s=IW(e,t,n,r,i,a-1),await s,vU(i.innerResult,`Expected an inner result`),i.innerResult);try{await o(c,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}s||await c(),await s}else{try{i.result={type:`success`,value:await n()}}catch(e){i.result={type:`error`,value:e}}i.innerResult=r(i.result,t)}return i.result?i.result:(i.result={type:`error`,value:Error(`No result assigned in instrumentation chain.`)},i.innerResult=r(i.result,t),i.result)}function LW(e){return e.type===`error`&&e.value instanceof Error?{status:`error`,error:e.value}:{status:`success`,error:void 0}}function RW(e){let{request:t,context:n,params:r}=e;return{...e,request:BW(t),params:{...r},context:VW(n)}}function zW(e,t){return{currentUrl:CU(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 BW(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function VW(e){return{get:t=>e.get(t)}}var HW=[`POST`,`PUT`,`PATCH`,`DELETE`],UW=new Set(HW),WW=[`GET`,...HW],GW=new Set(WW),KW=new Set([301,302,303,307,308]),qW=new Set([307,308]),JW={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},YW={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},XW={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},ZW=`remix-router-transitions`,QW=Symbol(`ResetLoaderData`),$W=class{#e;#t;#n;#r;constructor(e){this.#e=e,this.#t=zU(e)}get stableRoutes(){return this.#e}get activeRoutes(){return this.#n??this.#e}get branches(){return this.#r??this.#t}get hasHMRRoutes(){return this.#n!=null}setRoutes(e){this.#e=e,this.#t=zU(e)}setHmrRoutes(e){this.#n=e,this.#r=zU(e)}commitHmrRoutes(){this.#n&&(this.#e=this.#n,this.#t=this.#r,this.#n=void 0,this.#r=void 0)}};function eG(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;vU(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties,a=i||(()=>({}));if(e.instrumentations){let t=e.instrumentations;a=e=>({...i?.(e),...kW(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new $W(PU(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||_G,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=null,_=e.hydrationData!=null,v=LU(s.activeRoutes,e.history.location,c,!1,s.branches),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=VG(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=BG(s.activeRoutes);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&qe(v,s.activeRoutes,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=qe(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}else if(v.some(e=>e.route.lazy))x=!1,S=!x;else if(!v.some(e=>aG(e.route)))x=!0,S=!x;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=v;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}S=!1,x=!0,r.forEach(e=>{let r=oG(e.route,t,n);S||=r.renderFallback,x&&=!r.shouldLoad})}let C,w={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,renderFallback:S,navigation:JW,restoreScrollPosition:e.hydrationData==null&&null,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},T=`POP`,E=null,D=!1,O,k=!1,A=new Map,j=null,M=!1,N=!1,ee=new Set,P=new Map,te=0,ne=-1,re=new Map,ie=new Set,ae=new Map,oe=new Map,se=new Set,ce=new Map,le,ue=null;function de(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(le){le(),le=void 0;return}yU(ce.size===0||r!=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 i=He({currentLocation:w.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{le=e});e.history.go(r*-1),Ve(i,{state:`blocked`,location:n,proceed(){Ve(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(w.blockers);e.set(i,XW),F({blockers:e})}}),E?.resolve(),E=null;return}return _e(t,n)}),n){fK(t,A);let e=()=>pK(t,A);t.addEventListener(`pagehide`,e),j=()=>t.removeEventListener(`pagehide`,e)}return w.initialized||_e(`POP`,w.location,{initialHydration:!0}),C}function fe(){d&&d(),j&&j(),f.clear(),O&&O.abort(),w.fetchers.forEach((e,t)=>Ne(w.fetchers,t)),w.blockers.forEach((e,t)=>Be(t))}function pe(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(w,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function F(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),w={...w,...e};let n=[],r=[];w.fetchers.forEach((e,t)=>{e.state===`idle`&&(se.has(t)?n.push(t):r.push(t))}),se.forEach(e=>{!w.fetchers.has(e)&&!P.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(w,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Ne(w.fetchers,e)),r.forEach(e=>w.fetchers.delete(e))}function me(t,n,{flushSync:r}={}){let i=w.actionData!=null&&w.navigation.formMethod!=null&&nK(w.navigation.formMethod)&&w.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?w.actionData:null;let o=n.loaderData?LG(w.loaderData,n.loaderData,n.matches||[],n.errors):w.loaderData,c=w.blockers;c.size>0&&!M&&(c=new Map(c),c.forEach((e,t)=>c.set(t,XW)));let l=!M&&I(t,n.matches||w.matches),u=D===!0||w.navigation.formMethod!=null&&nK(w.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),M||T===`POP`||(T===`PUSH`?e.history.push(t,t.state):T===`REPLACE`&&e.history.replace(t,t.state));let d;if(T===`POP`){let e=A.get(w.location.pathname);e&&e.has(t.pathname)?d={currentLocation:w.location,nextLocation:t}:A.has(t.pathname)&&(d={currentLocation:t,nextLocation:w.location})}else if(k){let e=A.get(w.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),A.set(w.location.pathname,e)),d={currentLocation:w.location,nextLocation:t}}F({...n,actionData:a,loaderData:o,historyAction:T,location:t,initialized:!0,renderFallback:!1,navigation:JW,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),T=`POP`,D=!1,k=!1,M=!1,N=!1,E?.resolve(),E=null,ue?.resolve(),ue=null}async function he(t,n){if(E?.resolve(),E=null,typeof t==`number`){E||=mK();let n=E.promise;return e.history.go(t),n}let r=PW(C),{path:i,submission:a,error:o}=rG(!1,nG(w.location,w.matches,c,t,n?.fromRouteId,n?.relative),n),s;n?.mask&&(s={pathname:``,search:``,hash:``,...typeof n.mask==`string`?wU(n.mask):{...w.location.mask,...n.mask}});let l=w.location,u=SU(l,i,n&&n.state,void 0,s);u={...u,...e.history.encodeLocation(u)};let d=n&&n.replace!=null?n.replace:void 0,f=`PUSH`;d===!0?f=`REPLACE`:d===!1||a!=null&&nK(a.formMethod)&&a.formAction===w.location.pathname+w.location.search&&(f=`REPLACE`);let p=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,m=(n&&n.flushSync)===!0,h=He({currentLocation:l,nextLocation:u,historyAction:f});if(h){Ve(h,{state:`blocked`,location:u,proceed(){Ve(h,{state:`proceeding`,proceed:void 0,reset:void 0,location:u}),he(t,n)},reset(){let e=new Map(w.blockers);e.set(h,XW),F({blockers:e})}});return}await _e(f,u,{submission:a,pendingError:o,preventScrollReset:p,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:m,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate,instrumentationNavigateMetaReceiver:r})}function ge(){ue||=mK(),Oe(),F({revalidation:`loading`});let e=ue.promise;return w.navigation.state===`submitting`?e:w.navigation.state===`idle`?(_e(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),e):(_e(T||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:k===!0}),e)}async function _e(t,n,r){O&&O.abort(),O=null,T=t,M=(r&&r.startUninterruptedRevalidation)===!0,Ke(w.location,w.matches),D=(r&&r.preventScrollReset)===!0,k=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&w.matches&&w.matches.length>0&&!y?w.matches:LU(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&w.initialized&&!N&&WG(w.location,n)&&!(r&&r.submission&&nK(r.submission.formMethod))){me(n,{matches:a},{flushSync:o});return}let l=qe(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),r?.instrumentationNavigateMetaReceiver){let t=aK(e.history,n,a);r.instrumentationNavigateMetaReceiver(t)}if(!a){let{error:e,notFoundMatches:t,route:r}=Ue(n.pathname);me(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;O=new AbortController;let d=MG(e.history,n,O.signal,r&&r.submission),f=e.getContext?await e.getContext():new DU,p;if(r&&r.pendingError)p=[zG(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&nK(r.submission.formMethod)){let i=await ve(d,n,r.submission,a,t,f,l.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:o});if(i.shortCircuited)return;if(i.pendingActionResult){let[e,t]=i.pendingActionResult;if(YG(t)&&SW(t.error)&&t.error.status===404){O=null,me(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=sK(n,a,t,r.submission),o=!1,l.active=!1,d=MG(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await ye(d,n,a,t,f,l.active,u,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,o,p,r&&r.callSiteDefaultShouldRevalidate);m||(O=null,me(n,{matches:h||a,...RG(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function ve(t,n,i,l,u,d,f,p,m={}){if(Oe(),F({navigation:cK(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await Je(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=BG(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=zG(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Ue(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=iK(l,n);if(!g.route.action&&!g.route.lazy)h={type:`error`,error:VG(405,{method:t.method,pathname:n.pathname,routeId:g.route.id})};else{let e=await Ee(t,n,CG(a,o,t,n,l,g,p?[]:r,d),d,null);if(h=e[g.route.id],!h){for(let t of l)if(e[t.route.id]){h=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(XG(h)){let n;return n=m&&m.replace!=null?m.replace:jG(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===w.location.pathname+w.location.search,await Te(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(YG(h)){let e=zG(l,g.route.id);return(m&&m.replace)!==!0&&(T=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function ye(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||sK(n,i,l,p),x=p||m||oK(b),S=!M&&!g;if(d){if(S){let e=be(v);F({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await Je(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=BG(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=zG(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Ue(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:T,revalidatingFetchers:E}=iG(t,u,a,o,e.history,w,i,x,n,g?[]:r,g===!0,N,ee,se,ae,ie,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(ne=++te,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=new Map(w.fetchers),t=Le(e);return me(n,{matches:i,loaderData:{},errors:v&&YG(v[1])?{[v[0]]:v[1].error}:null,...RG(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=be(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=xe(E)),F(e,{flushSync:_})}E.forEach(e=>{Fe(e.key),e.controller&&P.set(e.key,e.controller)});let D=()=>E.forEach(e=>Fe(e.key));O&&O.signal.addEventListener(`abort`,D);let{loaderResults:k,fetcherResults:A}=await De(T,E,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener(`abort`,D),E.forEach(e=>P.delete(e.key));let j=HG(k);if(j)return await Te(t,j.result,!0,{replace:h}),{shortCircuited:!0};if(j=HG(A),j)return ie.add(j.key),await Te(t,j.result,!0,{replace:h}),{shortCircuited:!0};let re=new Map(w.fetchers),{loaderData:oe,errors:ce}=IG(w,i,k,v,E,A,re);g&&w.errors&&(ce={...w.errors,...ce});let le=Le(re),ue=Re(ne,re),de=le||ue||E.length>0;return{matches:i,loaderData:oe,errors:ce,...de?{workingFetchers:re}:{}}}function be(e){if(e&&!YG(e[1]))return{[e[0]]:e[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function xe(e){let t=new Map(w.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=lK(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function Se(t,n,r,i){Fe(t);let a=(i&&i.flushSync)===!0,o=PW(C),l=s.activeRoutes,u=nG(w.location,w.matches,c,r,n,i?.relative),d=LU(l,u,c,!1,s.branches),f=qe(d,l,u);if(f.active&&f.matches&&(d=f.matches),o&&o(aK(e.history,u,d)),!d){Ae(t,n,VG(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=rG(!0,u,i);if(h){Ae(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new DU,_=(i&&i.preventScrollReset)===!0;if(m&&nK(m.formMethod)){await Ce(t,n,p,d,g,f.active,a,_,m,i&&i.defaultShouldRevalidate);return}ae.set(t,{routeId:n,path:p}),await we(t,n,p,d,g,f.active,a,_,m)}async function Ce(t,n,i,l,u,d,f,p,m,h){Oe(),ae.delete(t),ke(t,uK(m,w.fetchers.get(t)),{flushSync:f});let g=new AbortController,_=MG(e.history,i,g.signal,m);if(d){let e=await Je(l,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ae(t,n,e.error,{flushSync:f});return}if(e.matches)l=e.matches;else{Ae(t,n,VG(404,{pathname:i}),{flushSync:f});return}}let v=iK(l,i);if(!v.route.action&&!v.route.lazy){Ae(t,n,VG(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}P.set(t,g);let y=te,b=CG(a,o,_,i,l,v,r,u),x=await Ee(_,i,b,u,t),S=x[v.route.id];if(!S){for(let e of b)if(x[e.route.id]){S=x[e.route.id];break}}if(_.signal.aborted){P.get(t)===g&&P.delete(t);return}if(se.has(t)){if(XG(S)||YG(S)){ke(t,dK(void 0));return}}else{if(XG(S)){if(P.delete(t),ne>y){ke(t,dK(void 0));return}return ie.add(t),ke(t,lK(m)),Te(_,S,!1,{fetcherSubmission:m,preventScrollReset:p})}if(YG(S)){Ae(t,n,S.error);return}}let C=w.navigation.location||w.location,E=MG(e.history,C,g.signal),D=s.activeRoutes,k=w.navigation.state===`idle`?w.matches:LU(D,w.navigation.location,c,!1,s.branches);vU(k,`Didn't find any matches after fetcher action`);let A=++te;re.set(t,A);let{dsMatches:j,revalidatingFetchers:M}=iG(E,u,a,o,e.history,w,k,m,C,r,!1,N,ee,se,ae,ie,D,c,e.patchRoutesOnNavigation!=null,s.branches,[v.route.id,S],h),oe=lK(m,S.data),ce=new Map(w.fetchers);ce.set(t,oe),M.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=ce.get(t),r=lK(void 0,n?n.data:void 0);ce.set(t,r),Fe(t),e.controller&&P.set(t,e.controller)}),F({fetchers:ce});let le=()=>M.forEach(e=>Fe(e.key));g.signal.addEventListener(`abort`,le);let{loaderResults:ue,fetcherResults:de}=await De(j,M,E,C,u);if(g.signal.aborted)return;g.signal.removeEventListener(`abort`,le),re.delete(t),P.delete(t),M.forEach(e=>P.delete(e.key));let fe=w.fetchers.has(t),pe=e=>{if(!fe)return e;let n=new Map(e.fetchers);return n.set(t,dK(S.data)),{...e,fetchers:n}},he=HG(ue);if(he)return w=pe(w),Te(E,he.result,!1,{preventScrollReset:p});if(he=HG(de),he)return ie.add(he.key),w=pe(w),Te(E,he.result,!1,{preventScrollReset:p});let ge=new Map(w.fetchers);fe&&ge.set(t,dK(S.data));let{loaderData:_e,errors:ve}=IG(w,k,ue,void 0,M,de,ge);Re(A,ge),w.navigation.state===`loading`&&A>ne?(vU(T,`Expected pending action`),O&&O.abort(),me(w.navigation.location,{matches:k,loaderData:_e,errors:ve,fetchers:ge})):(F({errors:ve,loaderData:LG(w.loaderData,_e,k,ve),fetchers:ge}),N=!1)}async function we(t,n,i,s,c,l,u,d,f){let p=w.fetchers.get(t);ke(t,lK(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=MG(e.history,i,m.signal);if(l){let e=await Je(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ae(t,n,e.error,{flushSync:u});return}if(e.matches)s=e.matches;else{Ae(t,n,VG(404,{pathname:i}),{flushSync:u});return}}let g=iK(s,i);P.set(t,m);let _=te,v=await Ee(h,i,CG(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(P.get(t)===m&&P.delete(t),!h.signal.aborted){if(se.has(t)){ke(t,dK(void 0));return}if(XG(y)){if(ne>_){ke(t,dK(void 0));return}ie.add(t),await Te(h,y,!1,{preventScrollReset:d});return}if(YG(y)){Ae(t,n,y.error);return}ke(t,dK(y.data))}}async function Te(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(E?.resolve(),E=null),i.response.headers.has(`X-Remix-Revalidate`)&&(N=!0);let d=i.response.headers.get(`Location`);vU(d,`Expected a Location header on the redirect Response`),d=jG(d,new URL(r.url),c,e.history);let f=SU(w.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(sW(d)){let n=EU(t,d,!0);e=n.origin!==t.location.origin||aW(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}O=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:h,formEncType:g}=w.navigation;!o&&!s&&m&&h&&g&&(o=oK(w.navigation));let _=o||s;qW.has(i.response.status)&&_&&nK(_.formMethod)?await _e(p,f,{submission:{..._,formAction:d},preventScrollReset:l||D,enableViewTransition:a?k:void 0}):await _e(p,f,{overrideNavigation:sK(f,[],p,o),fetcherSubmission:s,preventScrollReset:l||D,enableViewTransition:a?k:void 0})}async function Ee(e,t,n,r,i){let a,o={};try{a=await wG(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!nK(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!w.loaderData.hasOwnProperty(e.route.id)&&(!w.errors||!w.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(JG(r)){let i=r.result;o[t]={type:`redirect`,response:OG(i,e,t,n,c)}}else o[t]=await DG(r);return o}async function De(e,t,n,r,i){let a=Ee(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await Ee(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}return Promise.resolve({[e.key]:{type:`error`,error:VG(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Oe(){N=!0,ae.forEach((e,t)=>{P.has(t)&&ee.add(t),Fe(t)})}function ke(e,t,n={}){let r=new Map(w.fetchers);r.set(e,t),F({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function Ae(e,t,n,r={}){let i=zG(w.matches,t),a=new Map(w.fetchers);Ne(a,e),F({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function je(e){return oe.set(e,(oe.get(e)||0)+1),se.has(e)&&se.delete(e),w.fetchers.get(e)||YW}function Me(e,t){Fe(e,t?.reason),ke(e,dK(null))}function Ne(e,t){let n=w.fetchers.get(t);P.has(t)&&!(n&&n.state===`loading`&&re.has(t))&&Fe(t),ae.delete(t),re.delete(t),ie.delete(t),se.delete(t),ee.delete(t),e.delete(t)}function Pe(e){let t=(oe.get(e)||0)-1;t<=0?(oe.delete(e),se.add(e)):oe.set(e,t),F({fetchers:new Map(w.fetchers)})}function Fe(e,t){let n=P.get(e);n&&(n.abort(t),P.delete(e))}function Ie(e,t){for(let n of e){let e=t.get(n);vU(e,`Expected fetcher: ${n}`);let r=dK(e.data);t.set(n,r)}}function Le(e){let t=[],n=!1;for(let r of ie){let i=e.get(r);vU(i,`Expected fetcher: ${r}`),i.state===`loading`&&(ie.delete(r),t.push(r),n=!0)}return Ie(t,e),n}function Re(e,t){let n=[];for(let[r,i]of re)if(i<e){let e=t.get(r);vU(e,`Expected fetcher: ${r}`),e.state===`loading`&&(Fe(r),re.delete(r),n.push(r))}return Ie(n,t),n.length>0}function ze(e,t){let n=w.blockers.get(e)||XW;return ce.get(e)!==t&&ce.set(e,t),n}function Be(e){w.blockers.delete(e),ce.delete(e)}function Ve(e,t){let n=w.blockers.get(e)||XW;vU(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(w.blockers);r.set(e,t),F({blockers:r})}function He({currentLocation:e,nextLocation:t,historyAction:n}){if(ce.size===0)return;ce.size>1&&yU(!1,`A router only supports one blocker at a time`);let r=Array.from(ce.entries()),[i,a]=r[r.length-1],o=w.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Ue(e){let t=VG(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=BG(n);return{notFoundMatches:r,route:i,error:t}}function We(e,t,n){if(m=e,g=t,h=n||null,!_&&w.navigation===JW){_=!0;let e=I(w.location,w.matches);e!=null&&F({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Ge(e,t){return h&&h(e,t.map(e=>RU(e,w.loaderData)))||e.key}function Ke(e,t){if(m&&g){let n=Ge(e,t);m[n]=g()}}function I(e,t){if(m){let n=Ge(e,t),r=m[n];if(typeof r==`number`)return r}return null}function qe(t,n,r){if(e.patchRoutesOnNavigation){let e=s.branches;if(!t)return{active:!0,matches:LU(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:LU(n,r,c,!0,e)}}return{active:!1,matches:null}}async function Je(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let l=t;for(;;){let t=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:l,fetcherKey:i,patch:(e,n)=>{r.aborted||uG(e,n,s,t,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}if(r.aborted)return{type:`aborted`};let u=s.branches,d=LU(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=LU(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&&Ye(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=LU(s.activeRoutes,n,c,!0,u),!f||Ye(l,f))return{type:`success`,matches:null};l=f}}function Ye(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function Xe(e){o={},s.setHmrRoutes(PU(e,a,void 0,o))}function Ze(e,t,n=!1){uG(e,t,s,o,a,n),s.hasHMRRoutes||F({})}return C={get basename(){return c},get future(){return u},get state(){return w},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:de,subscribe:pe,enableScrollRestoration:We,navigate:he,fetch:Se,revalidate:ge,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:je,resetFetcher:Me,deleteFetcher:Pe,dispose:fe,getBlocker:ze,deleteBlocker:Be,patchRoutes:Ze,_internalFetchControllers:P,_internalSetRoutes:Xe,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){F(e)}},e.instrumentations&&(C=AW(C,e.instrumentations.map(e=>e.router).filter(Boolean))),C}function tG(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function nG(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=pW(r||`.`,fW(o),aW(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=rK(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=oW({basename:n,pathname:c.pathname})),CU(c)}function rG(e,t,n){if(!n||!tG(n))return{path:t};if(n.formMethod&&!tK(n.formMethod))return{path:t,error:VG(405,{method:n.formMethod})};let r=()=>({path:t,error:VG(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=UG(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!nK(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}\n`,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if(n.formEncType===`application/json`){if(!nK(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}vU(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=NG(n.formData),s=n.formData;else if(n.body instanceof FormData)o=NG(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=PG(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=PG(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(nK(c.formMethod))return{path:t,submission:c};let l=wU(t);return e&&l.search&&rK(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:CU(l),submission:c}}function iG(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let S=b?YG(b[1])?b[1].error:b[1].data:void 0,C=i.createURL(a.location),w=i.createURL(c),T;if(u&&a.errors){let e=Object.keys(a.errors)[0];T=o.findIndex(t=>t.route.id===e)}else if(b&&YG(b[1])){let e=b[0];T=o.findIndex(t=>t.route.id===e)-1}let E=b?b[1].statusCode:void 0,D=E&&E>=400,O={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:E},k=CW(o),A=o.map((i,o)=>{let{route:s}=i,f=null;if(T!=null&&o>T)f=!1;else if(s.lazy)f=!0;else if(!aG(s))f=!1;else if(u){let{shouldLoad:e}=oG(s,a.loaderData,a.errors);f=e}else sG(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return SG(n,r,e,c,k,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:D?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?cG(a.matches[o],i)&&(p=!0):p=!0;let m={...O,defaultShouldRevalidate:p};return SG(n,r,e,c,k,i,l,t,lG(i,m),m,x)}),j=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,b=LU(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;j.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let S=iK(b,e.path),C=new AbortController,w=MG(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=CG(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=CG(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:!D&&d;let a={...O,defaultShouldRevalidate:i};lG(S,a)&&(T=CG(n,r,w,e.path,b,S,l,t,a))}T&&j.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:A,revalidatingFetchers:j}}function aG(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function oG(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!aG(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function sG(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function cG(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function lG(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function uG(e,t,n,r,i,a){let o;if(e){let t=r[e];vU(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>dG(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=PU(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=PU([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function dG(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?!1:(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>dG(e,t)))??!1}var fG=new WeakMap,pG=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(vU(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=fG.get(i);o||(o={},fG.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=kU(e),n=i[e]!==void 0;if(t)yU(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)yU(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},mG=new WeakMap;function hG(e,t,n,r,i){let a=n[e.id];if(vU(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=mG.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{vU(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=jU(e),o=a[e]!==void 0;i?yU(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?yU(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return mG.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=pG({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function gG(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function _G(e){return e.matches.some(e=>e.route.middleware)?vG(e,()=>gG(e)):gG(e)}function vG(e,t){return yG(e,t,e=>{if(eK(e))throw e;return e},KG,n);async function n(t,n,r){if(r)return Object.assign(r.value,{[n]:{type:`error`,result:t}});{let{matches:r}=e,i=Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0)),a=r[i].route.id;for(let e of r.slice(0,i+1))try{await e._lazyPromises?.route}catch{a=e.route.id;break}return{[zG(r,a).route.id]:{type:`error`,result:t}}}}}async function yG(e,t,n,r,i){let{matches:a,...o}=e;return await bG(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function bG(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await bG(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function xG(e,t,n,r,i){let a=pG({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=hG(r.route,nK(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function SG(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=xG(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?lG(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?lG(a,{...l,defaultShouldRevalidate:e}):lG(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!nK(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(nK(n.method)||!p)?TG({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function CG(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?SG(e,t,n,r,CW(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:xG(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function wG(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,url:wW(t,n),pattern:CW(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return vG(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function TG({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=nK(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:wW(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a){if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw VG(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}}else if(t)c=await f(t);else{let t=new URL(e.url);throw VG(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function EG(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 DG(e){let{result:t,type:n}=e;if(QG(t)){let e;try{e=await EG(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new xW(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?ZG(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:GG(t),statusCode:SW(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:SW(t)?t.status:void 0}:ZG(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 OG(e,t,n,r,i){let a=e.headers.get(`Location`);if(vU(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!sW(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=nG(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var kG=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function AG(e){try{return kG.includes(new URL(e).protocol)}catch{return!1}}function jG(e,t,n,r){if(sW(e)){let r=e,i=pU.test(r)?new URL(mU(r,t.protocol)):new URL(r);if(AG(i.toString()))throw Error(`Invalid redirect location`);let a=aW(i.pathname,n)!=null;if(i.origin===t.origin&&a)return mW(i.pathname)+i.search+i.hash}try{if(AG(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function MG(e,t,n,r){let i=e.createURL(UG(t)).toString(),a={signal:n};if(r&&nK(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):a.body=t===`text/plain`?r.text:t===`application/x-www-form-urlencoded`&&r.formData?NG(r.formData):r.formData}return new Request(i,a)}function NG(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function PG(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function FG(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&YG(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(vU(!XG(f),`Cannot handle redirect results in processLoaderData`),YG(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=zG(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=QW),c||(c=!0,s=SW(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function IG(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=FG(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(vU(s,`Did not find corresponding fetcher result`),YG(s)){let t=zG(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(XG(s))vU(!1,`Unhandled fetcher revalidation redirect`);else{let e=dK(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function LG(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==QW).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function RG(e){return e?YG(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function zG(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.ErrorBoundary!=null||e.route.errorElement!=null)||e[0]}function BG(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function VG(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`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.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`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&&(s=`Invalid request method "${r.toUpperCase()}"`)),new xW(e||500,o,Error(s),!0)}function HG(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(XG(r))return{key:n,result:r}}}function UG(e){return CU({...typeof e==`string`?wU(e):e,hash:``})}function WG(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash||t.hash!==``}function GG(e){return new xW(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function KG(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&qG(t))}function qG(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function JG(e){return QG(e.result)&&KW.has(e.result.status)}function YG(e){return e.type===`error`}function XG(e){return(e&&e.type)===`redirect`}function ZG(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function QG(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function $G(e){return KW.has(e)}function eK(e){return QG(e)&&$G(e.status)&&e.headers.has(`Location`)}function tK(e){return GW.has(e.toUpperCase())}function nK(e){return UW.has(e.toUpperCase())}function rK(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function iK(e,t){let n=typeof t==`string`?wU(t).search:t.search;if(e[e.length-1].route.index&&rK(n||``))return e[e.length-1];let r=dW(e);return r[r.length-1]}function aK(e,t,n){return{url:wW(e.createURL(t),t),pattern:n?CW(n):``,params:n?.[0]?.params?{...n[0].params}:{}}}function oK(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(t&&n&&r){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function sK(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function cK(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function lK(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 uK(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 dK(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 fK(e,t){try{let n=e.sessionStorage.getItem(ZW);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function pK(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(ZW,JSON.stringify(n))}catch(e){yU(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function mK(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var hK=b.createContext(null);hK.displayName=`DataRouter`;var gK=b.createContext(null);gK.displayName=`DataRouterState`;var _K=b.createContext(!1);function vK(){return b.useContext(_K)}var yK=b.createContext({isTransitioning:!1});yK.displayName=`ViewTransition`;var bK=b.createContext(new Map);bK.displayName=`Fetchers`;var xK=b.createContext(null);xK.displayName=`Await`;var SK=b.createContext(null);SK.displayName=`Navigation`;var CK=b.createContext(null);CK.displayName=`Location`;var wK=b.createContext({outlet:null,matches:[],isDataRoute:!1});wK.displayName=`Route`;var TK=b.createContext(null);TK.displayName=`RouteError`;var EK=`REACT_ROUTER_ERROR`,DK=`REDIRECT`,OK=`ROUTE_ERROR_RESPONSE`;function kK(e){if(e.startsWith(`${EK}:${DK}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function AK(e){if(e.startsWith(`${EK}:${OK}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new xW(t.status,t.statusText,t.data)}catch{}}function jK(e,{relative:t}={}){vU(MK(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=b.useContext(SK),{hash:i,pathname:a,search:o}=BK(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:hW([n,a])),r.createHref({pathname:s,search:o,hash:i})}function MK(){return b.useContext(CK)!=null}function NK(){return vU(MK(),`useLocation() may be used only in the context of a <Router> component.`),b.useContext(CK).location}var PK=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function FK(){let{isDataRoute:e}=b.useContext(wK);return e?rq():IK()}function IK(){vU(MK(),`useNavigate() may be used only in the context of a <Router> component.`);let e=b.useContext(hK),{basename:t,navigator:n}=b.useContext(SK),{matches:r}=b.useContext(wK),{pathname:i}=NK(),a=JSON.stringify(fW(r)),o=b.useRef(!1);return b.useLayoutEffect(()=>{o.current=!0}),b.useCallback((r,s={})=>{if(yU(o.current,PK),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=pW(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:hW([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var LK=b.createContext(null);function RK(e){let t=b.useContext(wK).outlet;return b.useMemo(()=>t&&b.createElement(LK.Provider,{value:e},t),[t,e])}function zK(){let{matches:e}=b.useContext(wK);return e[e.length-1]?.params??{}}function BK(e,{relative:t}={}){let{matches:n}=b.useContext(wK),{pathname:r}=NK(),i=JSON.stringify(fW(n));return b.useMemo(()=>pW(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function VK(e,t){return HK(e,t)}function HK(e,t,n){vU(MK(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=b.useContext(SK),{matches:i}=b.useContext(wK),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=NK(),l;if(t){let e=typeof t==`string`?wU(t):t;vU(s===`/`||e.pathname?.startsWith(s),`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 "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=c;let u=l.pathname||`/`,d=u;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);d=`/`+u.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let f=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):IU(e,{pathname:d}),p=YK(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:hW([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:hW([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&p?b.createElement(CK.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},p):p}function UK(){let e=nq(),t=SW(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return b.createElement(b.Fragment,null,b.createElement(`h2`,null,`Unexpected Application Error!`),b.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?b.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var WK=b.createElement(UK,null),GK=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=_K;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?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=AK(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:b.createElement(wK.Provider,{value:this.props.routeContext},b.createElement(TK.Provider,{value:e,children:this.props.component}));return this.context?b.createElement(qK,{error:e},t):t}},KK=new WeakMap;function qK({children:e,error:t}){let{basename:n}=b.useContext(SK);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=kK(t.digest);if(e){let r=KK.get(t);if(r)throw r;let i=EW(e.location,n),a=i.absoluteURL||i.to;if(AG(a))throw Error(`Invalid redirect location`);if(TW&&!KK.get(t)){if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw KK.set(t,n),n}}return b.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function JK({routeContext:e,match:t,children:n}){let r=b.useContext(hK);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(wK.Provider,{value:e},n)}function YK(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);vU(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:CW(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||WK,o&&(s<0&&c===0?(aq(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?b.createElement(n.route.Component,null):n.route.element?n.route.element:e,b.createElement(JK,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?b.createElement(GK,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function XK(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function ZK(e){let t=b.useContext(hK);return vU(t,XK(e)),t}function QK(e){let t=b.useContext(gK);return vU(t,XK(e)),t}function $K(e){let t=b.useContext(wK);return vU(t,XK(e)),t}function eq(e){let t=$K(e),n=t.matches[t.matches.length-1];return vU(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function tq(){return eq(`useRouteId`)}function nq(){let e=b.useContext(TK),t=QK(`useRouteError`),n=eq(`useRouteError`);return e===void 0?t.errors?.[n]:e}function rq(){let{router:e}=ZK(`useNavigate`),t=eq(`useNavigate`),n=b.useRef(!1);return b.useLayoutEffect(()=>{n.current=!0}),b.useCallback(async(r,i={})=>{yU(n.current,PK),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var iq={};function aq(e,t,n){!t&&!iq[e]&&(iq[e]=!0,yU(!1,n))}var oq={};function sq(e,t){!e&&!oq[t]&&(oq[t]=!0,console.warn(t))}var cq=[`HydrateFallback`,`hydrateFallbackElement`],lq=class{status=`pending`;promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function uq({router:e,flushSync:t,onError:n,useTransitions:r}){r=vK()||r;let[i,a]=b.useState(e.state),[o,s]=(0,b.useOptimistic)(i),[c,l]=b.useState(),[u,d]=b.useState({isTransitioning:!1}),[f,p]=b.useState(),[m,h]=b.useState(),[g,_]=b.useState(),v=b.useRef(new Map),y=b.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:CW(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&v.current.set(t,e.data)}),o.forEach(e=>v.current.delete(e)),sq(u===!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 y=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(sq(g==null||y,"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."),!g||!y){t&&u?t(()=>a(i)):r===!1?a(i):b.startTransition(()=>{r===!0&&s(e=>dq(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);b.useLayoutEffect(()=>e.subscribe(y),[e,y]),b.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new lq)},[u]),b.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):b.startTransition(()=>{r===!0&&s(e=>dq(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),b.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),b.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let x=b.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),S=e.basename||`/`,C=b.useMemo(()=>({router:e,navigator:x,static:!1,basename:S,onError:n}),[e,x,S,n]);return b.createElement(b.Fragment,null,b.createElement(hK.Provider,{value:C},b.createElement(gK.Provider,{value:o},b.createElement(bK.Provider,{value:v.current},b.createElement(yK.Provider,{value:u},b.createElement(gq,{basename:S,location:o.location,navigationType:o.historyAction,navigator:x,useTransitions:r},b.createElement(fq,{routes:e.routes,manifest:e.manifest,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function dq(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var fq=b.memo(pq);function pq({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return HK(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function mq({to:e,replace:t,state:n,relative:r}){vU(MK(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=b.useContext(SK);yU(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=b.useContext(wK),{pathname:o}=NK(),s=FK(),c=pW(e,fW(a),o,r===`path`),l=JSON.stringify(c);return b.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function hq(e){return RK(e.context)}function $(e){vU(!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 gq({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){vU(!MK(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=b.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=wU(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=b.useMemo(()=>{let e=aW(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return yU(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:b.createElement(SK.Provider,{value:c},b.createElement(CK.Provider,{children:t,value:h}))}function _q({children:e,location:t}){return VK(vq(e),t)}b.Component;function vq(e,t=[]){let n=[];return b.Children.forEach(e,(e,r)=>{if(!b.isValidElement(e))return;let i=[...t,r];if(e.type===b.Fragment){n.push.apply(n,vq(e.props.children,i));return}vU(e.type===$,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let a=e.props;vU(!a.index||!a.children,`An index route cannot have child routes.`);let o={id:a.id||i.join(`-`),caseSensitive:a.caseSensitive,element:a.element,Component:a.Component,index:a.index,path:a.path,middleware:a.middleware,loader:a.loader,action:a.action,hydrateFallbackElement:a.hydrateFallbackElement,HydrateFallback:a.HydrateFallback,errorElement:a.errorElement,ErrorBoundary:a.ErrorBoundary,shouldRevalidate:a.shouldRevalidate,handle:a.handle,lazy:a.lazy};a.children&&(o.children=vq(a.children,i)),n.push(o)}),n}var yq=`application/x-www-form-urlencoded`;function bq(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function xq(e){return bq(e)&&e.tagName.toLowerCase()===`button`}function Sq(e){return bq(e)&&e.tagName.toLowerCase()===`form`}function Cq(e){return bq(e)&&e.tagName.toLowerCase()===`input`}function wq(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Tq(e,t){return e.button===0&&(!t||t===`_self`)&&!wq(e)}function Eq(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(e=>[n,e]):[[n,r]])},[]))}function Dq(e,t){let n=Eq(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Oq=null;function kq(){if(Oq===null)try{new FormData(document.createElement(`form`),0),Oq=!1}catch{Oq=!0}return Oq}var Aq=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function jq(e){return e!=null&&!Aq.has(e)?(yU(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yq}"`),null):e}function Mq(e,t){let n,r,i,a,o;if(Sq(e)){let o=e.getAttribute(`action`);r=o?aW(o,t):null,n=e.getAttribute(`method`)||`get`,i=jq(e.getAttribute(`enctype`))||yq,a=new FormData(e)}else if(xq(e)||Cq(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?aW(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=jq(e.getAttribute(`formenctype`))||jq(o.getAttribute(`enctype`))||yq,a=new FormData(o,e),!kq()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(bq(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=yq,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}function Nq(e,t){if(e===!1||e==null)throw Error(t)}function Pq(e,t){let n=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n.pathname=n.pathname.endsWith(`/`)?`${n.pathname}_.${t}`:`${n.pathname}.${t}`,n}async function Fq(e,t){if(e.id in t)return t[e.id];try{let n=await zV(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Iq(e){return e!=null&&typeof e.page==`string`}function Lq(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 Rq(e,t,n){return Uq((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await Fq(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Lq).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function zq(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Bq(e,t,{includeHydrateFallback:n}={}){return Vq(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Vq(e){return[...new Set(e)]}function Hq(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function Uq(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Iq(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Hq(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Wq(){let e=b.useContext(hK);return Nq(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Gq(){let e=b.useContext(gK);return Nq(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Kq=b.createContext(void 0);Kq.displayName=`FrameworkContext`;function qq(){let e=b.useContext(Kq);return Nq(e,`You must render this element inside a <HydratedRouter> element`),e}function Jq(e,t){let n=b.useContext(Kq),[r,i]=b.useState(!1),[a,o]=b.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=b.useRef(null);b.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),b.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:Yq(s,p),onBlur:Yq(c,m),onMouseEnter:Yq(l,p),onMouseLeave:Yq(u,m),onTouchStart:Yq(d,p)}]:[a,f,{}]:[!1,f,{}]}function Yq(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function Xq({page:e,...t}){let n=vK(),{nonce:r}=qq(),{router:i}=Wq(),a=b.useMemo(()=>IU(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?b.createElement(Qq,{page:e,matches:a,...t}):b.createElement($q,{page:e,matches:a,...t})):null}function Zq(e){let{manifest:t,routeModules:n}=qq(),[r,i]=b.useState([]);return b.useEffect(()=>{let r=!1;return Rq(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function Qq({page:e,matches:t,...n}){let r=NK(),i=b.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Pq(e,`rsc`),i=!1,a=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?i=!0:a.push(e.route.id);return i&&a.length>0&&n.searchParams.set(`_routes`,a.join(`,`)),[n.pathname+n.search]},[e,r,t]);return b.createElement(b.Fragment,null,i.map(e=>b.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function $q({page:e,matches:t,...n}){let r=NK(),{manifest:i,routeModules:a}=qq(),{loaderData:o,matches:s}=Gq(),c=b.useMemo(()=>zq(e,t,s,i,r,`data`),[e,t,s,i,r]),l=b.useMemo(()=>zq(e,t,s,i,r,`assets`),[e,t,s,i,r]),u=b.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];t&&t.hasLoader&&(!c.some(t=>t.route.id===e.route.id)&&e.route.id in o&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let l=Pq(e,`data`);return s&&n.size>0&&l.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[l.pathname+l.search]},[o,r,i,c,t,e,a]),d=b.useMemo(()=>Bq(l,i),[l,i]),f=Zq(l);return b.createElement(b.Fragment,null,u.map(e=>b.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),d.map(e=>b.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),f.map(({key:e,link:t})=>b.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function eJ(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var tJ=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{tJ&&(window.__reactRouterVersion=`8.3.0`)}catch{}function nJ(e,t){return eG({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:_U({window:t?.window}),hydrationData:t?.hydrationData||rJ(),routes:e,mapRouteProperties:NU,hydrationRouteProperties:cq,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function rJ(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:iJ(e.errors)}),e}function iJ(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new xW(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&bW.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}var aJ=b.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=b.useContext(SK),v=typeof l==`string`&&fU.test(l),y=EW(l,h);l=y.to;let x=jK(l,{relative:r}),S=NK(),C=null;if(o){let e=pW(o,[],S.mask?S.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:hW([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=Jq(n,p),D=uJ(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function O(t){e&&e(t),t.defaultPrevented||D(t)}let k=!(y.isExternal||i),A=b.createElement(`a`,{...p,...E,href:(k?C:void 0)||y.absoluteURL||x,onClick:k?O:e,ref:eJ(m,T),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return w&&!v?b.createElement(b.Fragment,null,A,b.createElement(Xq,{page:x})):A});aJ.displayName=`Link`;var oJ=b.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=BK(a,{relative:c.relative}),d=NK(),f=b.useContext(gK),{navigator:p,basename:m}=b.useContext(SK),h=f!=null&&gJ(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=aW(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,S=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(y)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return b.createElement(aJ,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});oJ.displayName=`NavLink`;var sJ=b.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=b.useContext(SK),g=mJ(),_=hJ(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&fU.test(s);return b.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?b.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});sJ.displayName=`Form`;function cJ(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function lJ(e){let t=b.useContext(hK);return vU(t,cJ(e)),t}function uJ(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=FK(),d=NK(),f=BK(e,{relative:o});return b.useCallback(p=>{if(Tq(p,t)){p.preventDefault();let t=n===void 0?CU(d)===CU(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?b.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function dJ(e){yU(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=b.useRef(Eq(e)),n=b.useRef(!1),r=NK(),i=b.useMemo(()=>Dq(r.search,n.current?null:t.current),[r.search]),a=FK();return[i,b.useCallback((e,t)=>{let r=Eq(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var fJ=0,pJ=()=>`__${String(++fJ)}__`;function mJ(){let{router:e}=lJ(`useSubmit`),{basename:t}=b.useContext(SK),n=tq(),r=e.fetch,i=e.navigate;return b.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Mq(e,t);a.navigate===!1?await r(a.fetcherKey||pJ(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function hJ(e,{relative:t}={}){let{basename:n}=b.useContext(SK),r=b.useContext(wK);vU(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...BK(e||`.`,{relative:t})},o=NK();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:hW([n,a.pathname])),CU(a)}function gJ(e,{relative:t}={}){let n=b.useContext(yK);vU(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=lJ(`useViewTransitionState`),i=BK(e,{relative:t});if(!n.isTransitioning)return!1;let a=aW(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=aW(n.nextLocation.pathname,r)||n.nextLocation.pathname;return tW(i.pathname,o)!=null||tW(i.pathname,a)!=null}function _J(){let{pathname:e}=NK();return(0,b.useEffect)(()=>{window.scrollTo(0,0)},[e]),null}function vJ(e){let{serviceRequest:t,...n}=e;return(0,L.jsx)(QR,{value:t,loadTimelineResources:async(e,t,n)=>{let r=`${t}/${n}`;return Promise.allSettled([e.readHistory(`ServiceRequest`,n),e.search(`Communication`,{"based-on":r,_count:100}),e.search(`DiagnosticReport`,{"based-on":r,_count:100}),e.search(`Media`,{"based-on":r,_count:100}),e.search(`DocumentReference`,{related:r,_count:100}),e.search(`Task`,{_filter:`based-on eq ${r} or focus eq ${r} or subject eq ${r}`,_count:100})])},createCommunication:(e,t,n)=>({resourceType:`Communication`,status:`completed`,basedOn:[DC(e)],subject:e.subject,sender:DC(t),sent:new Date().toISOString(),payload:[{contentString:n}]}),createMedia:(e,t,n)=>({resourceType:`Media`,status:`completed`,basedOn:[DC(e)],subject:e.subject,operator:DC(t),issued:new Date().toISOString(),content:n}),...n})}function yJ(e){let t=Z(),{client:n,patient:r,encounter:i,children:a,...o}=e,s=eA(r),c=eA(i);function l(){let a=r,o=i;if(n.launchIdentifierSystems?.length){let e=n.launchIdentifierSystems.find(e=>e.resourceType===`Patient`);if(a&&s&&e?.system){let t=s.identifier?.find(t=>t.system===e.system);t&&(a={...r,identifier:t})}let t=n.launchIdentifierSystems.find(e=>e.resourceType===`Encounter`);if(o&&c&&t?.system){let e=c.identifier?.find(e=>e.system===t.system);e&&(o={...i,identifier:e})}}t.createResource({resourceType:`SmartAppLaunch`,patient:a,encounter:o,fhirContext:e.fhirContext}).then(e=>{let r=new URL(n.launchUri);r.searchParams.set(`iss`,bw(t.fhirUrl().toString())),r.searchParams.set(`launch`,e.id),window.open(r.toString(),`_blank`)}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}return(0,L.jsx)(Rd,{onClick:()=>l(),...o,children:a})}var bJ=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),xJ=o(((e,t)=>{t.exports=bJ()})),SJ=o((e=>{var t=xJ(),n=m(),r=na();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function h(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=p(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var y=null,b=null;function x(e,t,n){return e===n||e===t&&(y=e,!0)}function S(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function w(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var T=Object.assign,E=Symbol.for(`react.element`),D=Symbol.for(`react.transitional.element`),O=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),P=Symbol.for(`react.suspense`),te=Symbol.for(`react.suspense_list`),ne=Symbol.for(`react.memo`),re=Symbol.for(`react.lazy`),ie=Symbol.for(`react.activity`),ae=Symbol.for(`react.legacy_hidden`),oe=Symbol.for(`react.memo_cache_sentinel`),se=Symbol.for(`react.view_transition`),ce=Symbol.for(`react.recoverable`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case j:return`Profiler`;case A:return`StrictMode`;case P:return`Suspense`;case te:return`SuspenseList`;case ie:return`Activity`;case se:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ne:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case re:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var pe=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},ge=[],_e=-1;function ve(e){return{current:e}}function ye(e){0>_e||(e.current=ge[_e],ge[_e]=null,_e--)}function be(e,t){_e++,ge[_e]=e.current,e.current=t}var xe=ve(null),Se=ve(null),Ce=ve(null),we=ve(null);function Te(e,t){switch(be(Ce,t),be(Se,e),be(xe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?bp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=bp(t),e=xp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ye(xe),be(xe,e)}function Ee(){ye(xe),ye(Se),ye(Ce)}function De(e){var t=e.memoizedState;t!==null&&(gh._currentValue=t.memoizedState,be(we,e)),t=xe.current;var n=xp(t,e.type);t!==n&&(be(Se,e),be(xe,n))}function Oe(e){Se.current===e&&(ye(xe),ye(Se)),we.current===e&&(ye(we),gh._currentValue=he)}var ke,Ae;function je(e){if(ke===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ke=t&&t[1]||``,Ae=-1<e.stack.indexOf(`
|
|
208
|
+
[${JSON.stringify(t,null,2)}]`);return(0,L.jsx)(GI,{value:t[0]||``,propertyType:e.propertyType})}function dz(e){let t=e.exportCsv||e.exportTransactionBundle?(0,L.jsxs)(L.Fragment,{children:[e.exportCsv&&(0,L.jsx)(fz,{text:`CSV`,exportLogic:e.exportCsv,onCancel:e.onCancel}),e.exportTransactionBundle&&(0,L.jsx)(fz,{text:`Transaction Bundle`,exportLogic:e.exportTransactionBundle,onCancel:e.onCancel})]}):void 0;return(0,L.jsx)(aR,{title:`Export`,opened:e.visible,onClose:e.onCancel,actions:t,children:(0,L.jsx)(H,{children:`Limited to 1000 records`})})}function fz(e){return(0,L.jsx)(U,{onClick:()=>{e.exportLogic(),e.onCancel()},children:`Export as ${e.text}`})}var pz={root:`_root_1dkk5_1`,tableScroll:`_tableScroll_1dkk5_7`,table:`_table_1dkk5_7`,toolbar:`_toolbar_1dkk5_30`,actionIcon:`_actionIcon_1dkk5_34`,toolbarButton:`_toolbarButton_1dkk5_42`,menuDropdown:`_menuDropdown_1dkk5_52`,tr:`_tr_1dkk5_71`,nameLink:`_nameLink_1dkk5_82`,checkboxCell:`_checkboxCell_1dkk5_91`,checkboxWrap:`_checkboxWrap_1dkk5_98`,control:`_control_1dkk5_109`,staticColumnTitle:`_staticColumnTitle_1dkk5_110`,mutedText:`_mutedText_1dkk5_115`,statusBadge:`_statusBadge_1dkk5_154`,statusBadgeLabel:`_statusBadgeLabel_1dkk5_159`},mz={string:[X.EQUALS,X.NOT,X.CONTAINS,X.EXACT],fulltext:[X.EQUALS,X.NOT,X.CONTAINS,X.EXACT],token:[X.EQUALS,X.NOT,X.TEXT],reference:[X.EQUALS,X.NOT],number:[X.EQUALS,X.NOT_EQUALS,X.GREATER_THAN,X.LESS_THAN,X.GREATER_THAN_OR_EQUALS,X.LESS_THAN_OR_EQUALS],quantity:[X.EQUALS,X.NOT_EQUALS,X.GREATER_THAN,X.LESS_THAN,X.GREATER_THAN_OR_EQUALS,X.LESS_THAN_OR_EQUALS],date:[X.EQUALS,X.NOT_EQUALS,X.GREATER_THAN,X.LESS_THAN,X.GREATER_THAN_OR_EQUALS,X.LESS_THAN_OR_EQUALS,X.STARTS_AFTER,X.ENDS_BEFORE,X.APPROXIMATELY],datetime:[X.EQUALS,X.NOT_EQUALS,X.GREATER_THAN,X.LESS_THAN,X.GREATER_THAN_OR_EQUALS,X.LESS_THAN_OR_EQUALS,X.STARTS_AFTER,X.ENDS_BEFORE,X.APPROXIMATELY],uri:[X.EQUALS,X.NOT,X.ABOVE,X.BELOW]},hz={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 gz(e,t){return{...e,filters:t,offset:0,name:void 0}}function _z(e,t){return gz(e,(e.filters??[]).filter(e=>e.code!==t))}function vz(e,t,n,r,i){i&&(e=_z(e,t));let a=[];return e.filters&&a.push(...e.filters),a.push({code:t,operator:n,value:r??``}),gz(e,a)}function yz(e,t){return Sz(e,t,-1)}function bz(e,t){return Sz(e,t,0)}function xz(e,t){return Sz(e,t,1)}function Sz(e,t,n){let r=new Date;r.setDate(r.getDate()+n),r.setHours(0,0,0,0);let i=new Date(r.getTime());return i.setDate(i.getDate()+1),i.setTime(i.getTime()-1),kz(e,t,r,i)}function Cz(e,t){let n=new Date;return kz(e,t,n,new Date(n.getTime()+864e5))}function wz(e,t){return Dz(e,t,-1)}function Tz(e,t){return Dz(e,t,0)}function Ez(e,t){return Dz(e,t,1)}function Dz(e,t,n){let r=new Date;r.setMonth(r.getMonth()+n),r.setDate(1),r.setHours(0,0,0,0);let i=new Date(r.getTime());return i.setMonth(i.getMonth()+1),i.setDate(1),i.setHours(0,0,0,0),i.setTime(i.getTime()-1),kz(e,t,r,i)}function Oz(e,t){let n=new Date;return n.setMonth(0),n.setDate(1),n.setHours(0,0,0,0),kz(e,t,n,new Date)}function kz(e,t,n,r){return e=_z(e,t),e=Az(e,t,X.GREATER_THAN_OR_EQUALS,n),e=Az(e,t,X.LESS_THAN_OR_EQUALS,r),e}function Az(e,t,n,r){return vz(e,t,n,r.toISOString())}function jz(e,t,n=!0){return vz(e,t,X.MISSING,n.toString())}function Mz(e,t){return e.offset===t?e:{...e,offset:t,name:void 0}}function Nz(e,t){let n=e.count??20;return Mz(e,(t-1)*n)}function Pz(e,t,n){return t===Lz(e)&&n!==void 0&&n===Rz(e)?e:{...e,sortRules:[{code:t,descending:!!n}],name:void 0}}var Fz=[{code:`_lastUpdated`,descending:!0}];function Iz(e,t){return e.length===t.length&&e.every((e,n)=>e.code===t[n].code&&!!e.descending==!!t[n].descending)}function Lz(e){let t=e.sortRules;if(!t||t.length===0)return;let n=t[0].code;return n.startsWith(`-`)?n.substr(1):n}function Rz(e){let t=e.sortRules;return!t||t.length===0?!1:!!t[0].descending}function zz(e){return mz[e.type]}function Bz(e){return hz[e]??``}function Vz(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(dw).join(` `))}function Hz(e){return e.startsWith(`_`)}function Uz(e){return Hz(e)?e:Vz(e)}function Wz(e){let t=(e,t)=>Uz(e).localeCompare(Uz(t));return{fields:e.filter(e=>!Hz(e)).sort(t),metadata:e.filter(e=>Hz(e)).sort(t)}}function Gz(e){let{fields:t,metadata:n}=Wz(Object.keys(e)),r=e=>e.map(e=>({value:e,label:Uz(e)}));return[...t.length>0?[{group:`Fields`,items:r(t)}]:[],...n.length>0?[{group:`Metadata`,items:r(n)}]:[]]}function Kz(e){switch(e){case`date`:return{asc:`Oldest to Newest`,desc:`Newest to Oldest`};case`number`:case`quantity`:return{asc:`Smallest to Largest`,desc:`Largest to Smallest`};default:return{asc:`A to Z`,desc:`Z to A`}}}function qz(e,t){let n=t.name;return n===`id`?(0,L.jsx)(eN,{to:`/${e.resourceType}/${e.id}`,children:e.id}):n===`meta.versionId`?e.meta?.versionId:n===`_lastUpdated`?Pw(e.meta?.lastUpdated):n===`name`&&jC(e)?Jz(e):`${e.resourceType}.${t.name}`===t.elementDefinition?.path?Zz(e,t.elementDefinition):t.searchParams?.length===1&&t.name===t.searchParams[0].code?Qz(e,t.searchParams[0]):null}function Jz(e){return(0,L.jsxs)(V,{gap:`xs`,wrap:`nowrap`,children:[(0,L.jsx)(oN,{value:e,radius:`xl`,size:28}),(0,L.jsx)(H,{size:`sm`,truncate:!0,children:MC(e)})]})}function Yz(e,t,n){if(e===Y.Reference&&!Array.isArray(t))return(0,L.jsx)(Xz,{value:t});if(n===`status`&&typeof t==`string`)return(0,L.jsx)(sR,{status:t,variant:`light`,classNames:{root:pz.statusBadge,label:pz.statusBadgeLabel}})}function Xz({value:e}){let t=e.display||(0,L.jsx)(uR,{value:e});return(0,L.jsxs)(V,{gap:`xs`,wrap:`nowrap`,children:[(0,L.jsx)(oN,{value:e,radius:`xl`,size:28}),e.reference?(0,L.jsx)(eN,{to:e,size:`sm`,className:pz.nameLink,children:t}):(0,L.jsx)(H,{size:`sm`,children:t})]})}function Zz(e,t){let n=t.path?.split(`.`)?.pop()?.replaceAll(`[x]`,``)??``,[r,i]=kI({type:e.resourceType,value:e},n);return r?Yz(i,r,n)??(0,L.jsx)(GI,{path:t.path,property:t,propertyType:i,value:r,maxWidth:200,ignoreMissingValues:!0,link:!1}):null}function Qz(e,t){let n=uE(t.expression,[{type:e.resourceType,value:e}]);return!n||n.length===0?null:(0,L.jsx)(L.Fragment,{children:n.map((e,r)=>{let i=`${r}-${n.length}`,a=Yz(e.type,e.value,t.code);return a?(0,L.jsx)(`span`,{children:a},i):(0,L.jsx)(GI,{propertyType:e.type,value:e.value,maxWidth:200,ignoreMissingValues:!0,link:!1},i)})})}function $z(e){let t=(0,b.useRef)(!1),[n,r]=(0,b.useState)({search:JSON.parse(VC(e.search))}),[i,a]=(0,b.useState)(!1);(0,b.useEffect)(()=>{r({search:e.search})},[e.search]);let o=(0,b.useMemo)(()=>{if(!e.visible)return[];let t=e.search.resourceType;return yw(eB(IS(t),iT(t))).map(e=>({value:e,label:Vz(e)}))},[e.visible,e.search.resourceType]);function s(e){r({search:{...n.search,fields:e}})}return(0,L.jsx)(aR,{title:`Fields`,opened:e.visible,onClose:()=>{e.onCancel()},size:`auto`,withOverlay:!0,closeOnClickOutside:!1,overlayProps:{onMouseDownCapture:()=>{t.current=i},onClick:()=>{t.current||e.onCancel(),t.current=!1},children:(0,L.jsx)(`div`,{"data-testid":`overlay-child`})},actions:(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(U,{onClick:()=>e.onOk(n.search),children:`OK`})}),children:(0,L.jsx)(Mg,{style:{width:550},placeholder:`Select fields to display`,data:o,value:n.search.fields??[],onChange:s,onDropdownOpen:()=>a(!0),onDropdownClose:()=>a(!1),maxDropdownHeight:`250px`,clearButtonProps:{"aria-label":`Clear selection`},clearable:!0,searchable:!0})})}function eB(e,t){let n=[],r=new Set,i=new Set;for(let t of Object.keys(e.elements))n.push(t),r.add(t.toLowerCase()),i.add(Vz(t));if(t)for(let e of Object.keys(t)){let t=Vz(e);!r.has(e)&&!i.has(t)&&(n.push(e),r.add(e),i.add(t))}return n}var tB={dropdown:`_dropdown_16oi3_4`,body:`_body_16oi3_9`,row:`_row_16oi3_17`,grow:`_grow_16oi3_23`,footer:`_footer_16oi3_28`,deleteIcon:`_deleteIcon_16oi3_36`,empty:`_empty_16oi3_40`,indicator:`_indicator_16oi3_46`,addButton:`_addButton_16oi3_50`};function nB(e){let{opened:t,activeLabel:n}=e,r=(0,b.useId)();return(0,L.jsxs)(iu,{opened:t,onChange:e.onChange,position:`bottom-start`,shadow:`md`,radius:`md`,width:e.width,trapFocus:!0,returnFocus:!0,closeOnClickOutside:!0,children:[(0,L.jsx)(Gm,{className:tB.indicator,disabled:!n,color:`blue`,size:8,offset:6,children:(0,L.jsx)(cy,{label:n??``,position:`bottom`,openDelay:500,disabled:!n||t,children:(0,L.jsx)(iu.Target,{children:(0,L.jsx)(U,{className:pz.toolbarButton,"data-opened":t||void 0,size:`compact-md`,variant:`subtle`,color:`gray`,leftSection:e.icon,"aria-describedby":n?r:void 0,onClick:e.onToggle,children:e.label})})})}),n&&(0,L.jsx)(bl,{id:r,children:n}),(0,L.jsxs)(iu.Dropdown,{className:tB.dropdown,children:[e.children,e.footer&&(0,L.jsx)(`div`,{className:tB.footer,children:e.footer})]})]})}function rB(e){return(0,L.jsx)(U,{className:tB.addButton,size:`compact-sm`,variant:`subtle`,color:`blue`,leftSection:(0,L.jsx)(Ij,{size:16}),fw:500,onClick:e.onClick,children:e.label})}var iB=0;function aB(e){return e.map(e=>({id:iB++,value:e}))}function oB(e){let[t,n]=(0,b.useState)(()=>aB(e()));function r(e,r){let i=t.map((t,n)=>n===e?{...t,value:r}:t);return n(i),i}function i(e){let r=t.filter((t,n)=>n!==e);return n(r),r}return{rows:t,reset:e=>n(aB(e)),update:r,remove:i,add:e=>n([...t,...aB([e])])}}function sB(e){let t=vk(e.resourceType,e.searchParam),n=e.name??`filter-value`;switch(t.type){case _k.REFERENCE:return(0,L.jsx)(ML,{name:n,defaultValue:e.defaultValue?{reference:e.defaultValue}:void 0,targetTypes:e.searchParam.target,withinPortal:e.withinPortal,autoFocus:e.autoFocus,onChange:t=>{t?e.onChange(t.reference):e.onChange(``)}});case _k.BOOLEAN:return(0,L.jsx)(pp,{name:n,"aria-label":e.ariaLabel,"data-autofocus":e.autoFocus,"data-testid":n,defaultChecked:e.defaultValue===`true`,autoFocus:e.autoFocus,onChange:t=>e.onChange(t.currentTarget.checked.toString())});case _k.DATE:return(0,L.jsx)(jb,{type:`date`,name:n,"aria-label":e.ariaLabel,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:t=>e.onChange(t.currentTarget.value)});case _k.DATETIME:return(0,L.jsx)(pL,{name:n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:e.onChange});case _k.NUMBER:return(0,L.jsx)(jb,{type:`number`,name:n,"aria-label":e.ariaLabel,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:t=>e.onChange(t.currentTarget.value)});case _k.QUANTITY:return(0,L.jsx)(xL,{name:n,path:``,defaultValue:cB(e.defaultValue),autoFocus:e.autoFocus,onChange:t=>{t?e.onChange(`${t.value}`):e.onChange(``)}});default:return(0,L.jsx)(jb,{name:n,"aria-label":e.ariaLabel,"data-autofocus":e.autoFocus,"data-testid":n,defaultValue:e.defaultValue,autoFocus:e.autoFocus,onChange:t=>e.onChange(t.currentTarget.value),placeholder:`Search value`})}}function cB(e){if(e){let[t,n,r]=e.split(`|`);if(t)return{value:Number.parseFloat(t),system:n,unit:r}}}var lB={row:`_row_3ln2b_4`,conjunction:`_conjunction_3ln2b_10`,field:`_field_3ln2b_16`,operator:`_operator_3ln2b_20`,value:`_value_3ln2b_24`},uB=300;function dB(e){let{search:t,onChange:n}=e,[r,i]=(0,b.useState)(!1),{rows:a,reset:o,update:s,remove:c,add:l}=oB(()=>mB(t)),u=(0,b.useMemo)(()=>iT(t.resourceType)??{},[t.resourceType]),d=(0,b.useMemo)(()=>Gz(u),[u]);function f(e){let r=e.map(e=>e.value).filter(hB);JC(r,t.filters??[])||n(gz(t,r))}let p=Et(f,{delay:uB,flushOnUnmount:!0});function m(e){p.cancel(),f(e)}function h(e){e||p.flush(),i(e)}function g(){r||o(mB(t)),h(!r)}let _=t.filters?.length??0,v=_>0?`${_} ${_===1?`Filter`:`Filters`} Applied`:void 0;return(0,L.jsx)(nB,{label:`Filters`,icon:(0,L.jsx)(Zj,{size:16}),width:860,opened:r,onToggle:g,onChange:h,activeLabel:v,footer:(0,L.jsx)(rB,{label:`Add Filter`,onClick:()=>l({})}),children:(0,L.jsxs)(`div`,{className:tB.body,tabIndex:-1,"data-autofocus":!0,children:[a.length===0&&(0,L.jsx)(`div`,{className:tB.empty,children:`No filters applied`}),a.map(({id:e,value:n},r)=>(0,L.jsx)(fB,{rowId:e,index:r,resourceType:t.resourceType,searchParams:u,fieldData:d,value:n,onChange:e=>m(s(r,e)),onValueChange:e=>p(s(r,e)),onDelete:()=>m(c(r))},e))]})})}function fB(e){let{value:t,searchParams:n,resourceType:r,index:i}=e,a=t.code?n[t.code]:void 0,o=a&&zz(a);function s(i){let o=i?n[i]:void 0,s=!!t.operator&&!!o&&!!zz(o)?.includes(t.operator),c=!!a&&!!o&&pB(r,a,o);e.onChange({code:i??void 0,operator:s?t.operator:X.EQUALS,value:c?t.value:``})}function c(n){e.onChange({code:t.code,operator:n??void 0,value:t.value})}let l=(0,L.jsx)(`div`,{className:lB.value,children:a&&t.operator&&(0,L.jsx)(sB,{name:`filter-${i}-value`,ariaLabel:`Filter ${i+1} value`,resourceType:e.resourceType,searchParam:a,defaultValue:t.value,withinPortal:!1,onChange:n=>e.onValueChange({code:t.code,operator:t.operator,value:n})},`filter-${e.rowId}-value-${t.code}-${t.operator}`)}),u=(0,L.jsx)(bu,{variant:`subtle`,color:`gray`,radius:`xl`,"aria-label":`Remove filter ${i+1}`,ml:2,onClick:e.onDelete,children:(0,L.jsx)(HM,{size:16,stroke:2,className:tB.deleteIcon})});return(0,L.jsxs)(`div`,{className:lB.row,children:[(0,L.jsx)(H,{className:lB.conjunction,children:i===0?`Where`:`and`}),(0,L.jsx)(Sy,{comboboxProps:{withinPortal:!1},className:lB.field,"aria-label":`Filter ${i+1} field`,placeholder:`Field`,searchable:!0,data:e.fieldData,value:t.code??null,onChange:s}),(0,L.jsx)(Sy,{comboboxProps:{withinPortal:!1},className:lB.operator,"aria-label":`Filter ${i+1} operator`,placeholder:`Operator`,disabled:!o,data:o?o.map(e=>({value:e,label:Bz(e)})):[],value:t.operator??null,onChange:c}),l,u]})}function pB(e,t,n){let r=vk(e,n).type;return r!==_k.REFERENCE&&r===vk(e,t).type}function mB(e){return[...e.filters??[]]}function hB(e){return!!e.code&&!!e.operator&&e.value!==void 0&&e.value!==``}function gB(e){let[t,n]=(0,b.useState)(e.defaultValue??``);if(!e.searchParam||!e.filter)return null;function r(){e.onOk({...e.filter,value:t})}return(0,L.jsx)(aR,{title:e.title,size:`xl`,opened:e.visible,onClose:e.onCancel,onSubmit:r,actions:(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(PP,{children:`OK`})}),children:(0,L.jsx)(sB,{resourceType:e.resourceType,searchParam:e.searchParam,defaultValue:t,autoFocus:!0,onChange:n})})}function _B(e){let{resourceType:t,filter:n}=e,r=mT.types[t].searchParams?.[n.code];if(r){if(r.type===`reference`&&(n.operator===X.EQUALS||n.operator===X.NOT_EQUALS))return(0,L.jsx)(uR,{value:{reference:n.value}});let e=vk(t,r);if(n.code===`_lastUpdated`||e.type===_k.DATETIME)return(0,L.jsx)(L.Fragment,{children:Pw(n.value)})}return(0,L.jsx)(L.Fragment,{children:n.value})}var vB=16,yB=`var(--mantine-color-dimmed)`,bB=(0,L.jsx)(jj,{size:vB,color:`var(--mantine-color-blue-6)`});function xB(e){if(!e.searchParams)return null;function t(t,n){i(Pz(e.search,t.code,n))}function n(t){i(_z(e.search,t.code))}function r(t,n){e.onPrompt(t,{code:t.code,operator:n,value:``})}function i(t){e.onChange(t)}return e.searchParams.length===1?(0,L.jsx)(SB,{search:e.search,searchParam:e.searchParams[0],onSort:t,onPrompt:r,onChange:i,onClear:n}):(0,L.jsx)(Xh.Dropdown,{className:pz.menuDropdown,children:e.searchParams.map(e=>(0,L.jsx)(Xh.Item,{children:Vz(e.code)},e.code))})}function SB(e){switch(e.searchParam.type){case`date`:return(0,L.jsx)(OB,{...e});case`number`:case`quantity`:return(0,L.jsx)(kB,{...e});case`reference`:return(0,L.jsx)(AB,{...e});case`string`:return(0,L.jsx)(jB,{...e});case`token`:return(0,L.jsx)(MB,{...e});case`uri`:return(0,L.jsx)(NB,{...e});default:return(0,L.jsxs)(L.Fragment,{children:[`Unknown search param type: `,e.searchParam.type]})}}function CB(e){return(0,L.jsx)(Xh.Item,{leftSection:e.icon,rightSection:e.checked?bB:null,onClick:e.onClick,children:e.children})}function wB(e){let{searchParam:t}=e,n=n=>!!e.search.sortRules?.some(e=>e.code===t.code&&!!e.descending===n);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(CB,{icon:(0,L.jsx)(kM,{size:vB,color:yB}),checked:n(!1),onClick:()=>e.onSort(t,!1),children:e.ascLabel}),(0,L.jsx)(CB,{icon:(0,L.jsx)(AM,{size:vB,color:yB}),checked:n(!0),onClick:()=>e.onSort(t,!0),children:e.descLabel}),(0,L.jsx)(Xh.Divider,{})]})}function TB(e){let{searchParam:t}=e;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(CB,{icon:(0,L.jsx)(qj,{size:vB,color:yB}),onClick:()=>e.onPrompt(t,X.EQUALS),children:`Equals...`}),(0,L.jsx)(CB,{icon:(0,L.jsx)(Kj,{size:vB,color:yB}),onClick:()=>e.onPrompt(t,e.notOperator),children:`Does not equal...`})]})}var EB=[[{label:`Tomorrow`,Icon:Oj,apply:xz},{label:`Today`,Icon:Oj,apply:bz},{label:`Yesterday`,Icon:Oj,apply:yz},{label:`Next 24 Hours`,Icon:Aj,apply:Cz}],[{label:`Next Month`,Icon:kj,apply:Ez},{label:`This Month`,Icon:kj,apply:Tz},{label:`Last Month`,Icon:kj,apply:wz}],[{label:`Year to date`,Icon:Aj,apply:Oz,openEnded:!0}]];function DB(e,t,n){let r=(t.filters??[]).filter(e=>e.code===n),i=e.apply({resourceType:t.resourceType},n).filters??[];return r.length===i.length&&i.every((t,n)=>{let i=e.openEnded&&n>0?!0:r[n].value===t.value;return r[n].operator===t.operator&&i})}function OB(e){let{searchParam:t}=e,n=t.code;return(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[(0,L.jsx)(wB,{...e,ascLabel:`Sort Oldest to Newest`,descLabel:`Sort Newest to Oldest`}),(0,L.jsx)(TB,{...e,notOperator:X.NOT_EQUALS}),(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(CB,{icon:(0,L.jsx)(lM,{size:vB,color:yB}),onClick:()=>e.onPrompt(t,X.ENDS_BEFORE),children:`Before...`}),(0,L.jsx)(CB,{icon:(0,L.jsx)(cM,{size:vB,color:yB}),onClick:()=>e.onPrompt(t,X.STARTS_AFTER),children:`After...`}),(0,L.jsx)(CB,{icon:(0,L.jsx)(Sj,{size:vB,color:yB}),onClick:()=>e.onPrompt(t,X.EQUALS),children:`Between...`}),EB.map(t=>(0,L.jsxs)(b.Fragment,{children:[(0,L.jsx)(Xh.Divider,{}),t.map(t=>(0,L.jsx)(CB,{icon:(0,L.jsx)(t.Icon,{size:vB,color:yB}),checked:DB(t,e.search,n),onClick:()=>e.onChange(t.apply(e.search,n)),children:t.label},t.label))]},t[0].label)),(0,L.jsx)(PB,{...e})]})}function kB(e){let{searchParam:t}=e;return(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[(0,L.jsx)(wB,{...e,ascLabel:`Sort Smallest to Largest`,descLabel:`Sort Largest to Smallest`}),(0,L.jsx)(TB,{...e,notOperator:X.NOT_EQUALS}),(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(CB,{icon:(0,L.jsx)(cM,{size:vB,color:yB}),onClick:()=>e.onPrompt(t,X.GREATER_THAN),children:`Greater than...`}),(0,L.jsx)(CB,{icon:(0,L.jsx)(OM,{size:vB,color:yB}),onClick:()=>e.onPrompt(t,X.GREATER_THAN_OR_EQUALS),children:`Greater than or equal to...`}),(0,L.jsx)(CB,{icon:(0,L.jsx)(lM,{size:vB,color:yB}),onClick:()=>e.onPrompt(t,X.LESS_THAN),children:`Less than...`}),(0,L.jsx)(CB,{icon:(0,L.jsx)(OM,{size:vB,color:yB}),onClick:()=>e.onPrompt(t,X.LESS_THAN_OR_EQUALS),children:`Less than or equal to...`}),(0,L.jsx)(PB,{...e})]})}function AB(e){return(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[(0,L.jsx)(TB,{...e,notOperator:X.NOT}),(0,L.jsx)(PB,{...e})]})}function jB(e){let{searchParam:t}=e;return(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[(0,L.jsx)(wB,{...e,ascLabel:`Sort A to Z`,descLabel:`Sort Z to A`}),(0,L.jsx)(TB,{...e,notOperator:X.NOT}),(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(CB,{icon:(0,L.jsx)(Ej,{size:vB,color:yB}),onClick:()=>e.onPrompt(t,X.CONTAINS),children:`Contains...`}),(0,L.jsx)(CB,{icon:(0,L.jsx)(Tj,{size:vB,color:yB}),onClick:()=>e.onPrompt(t,X.EQUALS),children:`Does not contain...`}),(0,L.jsx)(PB,{...e})]})}function MB(e){let{searchParam:t}=e;return(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[(0,L.jsx)(TB,{...e,notOperator:X.NOT}),(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(CB,{icon:(0,L.jsx)(qj,{size:vB,color:yB}),onClick:()=>e.onPrompt(t,X.TEXT),children:`Text contains...`}),(0,L.jsx)(PB,{...e})]})}function NB(e){return(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[(0,L.jsx)(TB,{...e,notOperator:X.NOT}),(0,L.jsx)(PB,{...e})]})}function PB(e){let{searchParam:t}=e,n=t.code;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(CB,{icon:(0,L.jsx)(yj,{size:vB,color:yB}),onClick:()=>e.onChange(jz(e.search,n)),children:`Missing`}),(0,L.jsx)(CB,{icon:(0,L.jsx)(vj,{size:vB,color:yB}),onClick:()=>e.onChange(jz(e.search,n,!1)),children:`Not missing`}),(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(CB,{icon:(0,L.jsx)(HM,{size:vB,color:yB}),onClick:()=>e.onClear(t),children:`Clear filters`})]})}function FB(e){let{search:t,onChange:n}=e,[r,i]=(0,b.useState)(!1),{rows:a,reset:o,update:s,remove:c,add:l}=oB(()=>IB(t)),u=(0,b.useMemo)(()=>iT(t.resourceType)??{},[t.resourceType]),d=(0,b.useMemo)(()=>Gz(u),[u]);function f(){r||o(IB(t)),i(e=>!e)}function p(e){n({...t,sortRules:e.map(e=>e.value).filter(e=>!!e.code)})}let m=t.sortRules??[],h=m.length>0&&!Iz(m,Fz)?`${m.length} ${m.length===1?`Sort`:`Sorts`} Applied`:void 0;return(0,L.jsx)(nB,{label:`Sort`,icon:(0,L.jsx)(_j,{size:16}),width:520,opened:r,onToggle:f,onChange:i,activeLabel:h,footer:(0,L.jsx)(rB,{label:`Add Sort`,onClick:()=>l({code:``,descending:!1})}),children:(0,L.jsxs)(`div`,{className:tB.body,tabIndex:-1,"data-autofocus":!0,children:[a.length===0&&(0,L.jsx)(`div`,{className:tB.empty,children:`No sort applied`}),a.map(({id:e,value:t},n)=>{let r=Kz(t.code?u[t.code]?.type:void 0),i=t.descending?`desc`:`asc`;return(0,L.jsxs)(`div`,{className:tB.row,children:[(0,L.jsx)(Sy,{comboboxProps:{withinPortal:!1},className:tB.grow,"aria-label":`Sort ${n+1} field`,placeholder:`Field`,searchable:!0,data:d,value:t.code||null,onChange:e=>p(s(n,{code:e??``,descending:t.descending}))}),(0,L.jsx)(Sy,{comboboxProps:{withinPortal:!1},className:tB.grow,"aria-label":`Sort ${n+1} direction`,placeholder:`Order`,disabled:!t.code,allowDeselect:!1,data:[{value:`asc`,label:r.asc},{value:`desc`,label:r.desc}],value:t.code?i:null,onChange:e=>p(s(n,{code:t.code,descending:e===`desc`}))}),(0,L.jsx)(bu,{variant:`subtle`,color:`gray`,radius:`xl`,"aria-label":`Remove sort ${n+1}`,ml:2,onClick:()=>p(c(n)),children:(0,L.jsx)(HM,{size:16,stroke:2,className:tB.deleteIcon})})]},e)})]})})}function IB(e){return e.sortRules?.length?[...e.sortRules]:[...Fz]}function LB(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{}}}function RB(e){let t=e.resourceType,n=[];for(let r of e.fields||[`id`,`_lastUpdated`])n.push(zB(t,r));return n}function zB(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`}]};let n=uT(e,t),r=aT(e,t.toLowerCase());if(n&&r)return{name:t,elementDefinition:n,searchParams:[r]};if(n){let r=iT(e),i;if(r){let n=RegExp(`${e}\\.${t.replaceAll(`[x]`,``)}([^\\w-]|$)`);i=Object.values(r).filter(e=>!!e.expression&&n.test(e?.expression)),i.length===0&&(i=void 0)}return{name:t,elementDefinition:n,searchParams:i}}return r?{name:t,elementDefinition:vk(e,r).elementDefinitions?.[0],searchParams:[r]}:{name:t}}var BB=class extends Event{definition;constructor(e){super(`change`),this.definition=e}},VB=class extends Event{response;constructor(e){super(`load`),this.response=e}},HB=class extends Event{resource;browserEvent;constructor(e,t){super(`click`),this.resource=e,this.browserEvent=t}};function UB(e){let t=Z(),[n,r]=(0,b.useState)(),{search:i,onLoad:a}=e,o=i.sortRules?.length?i:{...i,sortRules:[...Fz]},[s,c]=(0,b.useState)(o);JC(o,s)||c(o);let[l,u]=(0,b.useState)({selected:{},exportDialogVisible:!1,fieldEditorVisible:!1,filterDialogVisible:!1}),[d,f]=(0,b.useState)(),p=s.total??`accurate`,m=(0,b.useCallback)(e=>{r(void 0),t.requestSchema(s.resourceType).then(()=>t.search(s.resourceType,FE({...s,total:p,fields:void 0}),e)).then(e=>{u(t=>({...t,searchResponse:e})),a&&a(new VB(e))}).catch(e=>{u(e=>({...e,searchResponse:void 0})),r(yS(e))})},[t,s,p,a]),h=(0,b.useCallback)(()=>{u(e=>({...e,searchResponse:void 0})),m({cache:`reload`})},[m]);(0,b.useEffect)(()=>{m()},[m]);function g(e,t){u(n=>{let r={...n.selected};return t??!n.selected[e]?r[e]=!0:delete r[e],{...n,selected:r}})}function _(e){u(t=>{let n={};return e&&t.searchResponse?.entry&&t.searchResponse.entry.forEach(e=>{e.resource?.id&&(n[e.resource.id]=!0)}),{...t,selected:n}})}function v(t){e.onChange&&e.onChange(new BB(t))}function y(t,n){if(XM(t.target)||t.button===2)return;JM(t);let r=YM(t);!r&&e.onClick&&e.onClick(new HB(n,t)),r&&e.onAuxClick&&e.onAuxClick(new HB(n,t))}function x(e,t){if(e.target!==e.currentTarget)return;let n=e.currentTarget,r;if(e.key===`ArrowDown`)r=n.nextElementSibling;else if(e.key===`ArrowUp`)r=n.previousElementSibling;else if(e.key===`Home`)r=n.parentElement?.firstElementChild;else if(e.key===`End`)r=n.parentElement?.lastElementChild;else if(e.key===`Enter`){JM(e),n.dispatchEvent(new window.MouseEvent(`click`,{bubbles:!0,cancelable:!0,ctrlKey:e.ctrlKey,metaKey:e.metaKey}));return}else if(e.key===` `&&w){JM(e),g(t.id);return}else return;JM(e),r?.focus()}async function S(){let t=Object.keys(l.selected);u(e=>({...e,deleting:!0}));try{await e.onDelete?.(t),u(e=>({...e,selected:{},deleting:!1,deleteConfirmVisible:!1})),m({cache:`reload`})}catch{u(e=>({...e,deleting:!1}))}}function C(){u(e=>({...e,deleteConfirmVisible:!1}))}if(n)return(0,L.jsx)(oI,{outcome:n});if(!PS(s.resourceType))return(0,L.jsx)(Xp,{style:{width:`100%`,height:`100%`},children:(0,L.jsx)(fu,{})});let w=e.checkboxesEnabled,T=RB(s),E=s.resourceType,D=l.searchResponse,O=D?.entry,k=O?.map(e=>e.resource),A=Object.keys(l.selected),j=!!O?.length&&O.every(e=>!e.resource?.id||l.selected[e.resource.id]),M=!!(e.onExport??e.onExportCsv??e.onExportTransactionBundle),N=!!e.onDelete,ee=!!e.onBulk,P=d&&k?.some(e=>e?.id===d)?d:k?.find(Boolean)?.id;return(0,L.jsxs)(`div`,{className:pz.root,"data-testid":`search-control`,children:[!e.hideToolbar&&(0,L.jsxs)(V,{justify:`space-between`,pb:`md`,className:pz.toolbar,children:[(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(U,{className:pz.toolbarButton,size:`compact-md`,variant:`subtle`,color:`gray`,leftSection:(0,L.jsx)(Rj,{size:16}),onClick:()=>u(e=>({...e,fieldEditorVisible:!0,dialogOpenTime:Date.now()})),children:`Fields`}),(0,L.jsx)(dB,{search:s,onChange:v}),(0,L.jsx)(FB,{search:s,onChange:v}),D&&(0,L.jsxs)(H,{size:`xs`,fw:500,c:`dimmed`,ml:4,"data-testid":`count-display`,children:[YB(s,D).toLocaleString(),`-`,XB(s,D).toLocaleString(),D.total!==void 0&&` of ${s.total===`estimate`?`~`:``}${D.total?.toLocaleString()}`]})]}),(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(cy,{label:`Refresh`,position:`bottom`,openDelay:500,children:(0,L.jsx)(bu,{className:pz.actionIcon,variant:`transparent`,color:`gray`,size:32,radius:`xl`,"aria-label":`Refresh`,title:`Refresh`,onClick:h,children:(0,L.jsx)(CM,{size:16})})}),(M||ee||N)&&(0,L.jsxs)(Xh,{shadow:`md`,width:200,radius:`md`,position:`bottom-end`,children:[(0,L.jsx)(Xh.Target,{children:(0,L.jsx)(bu,{className:pz.actionIcon,variant:`transparent`,color:`gray`,size:32,radius:`xl`,"aria-label":`Actions`,children:(0,L.jsx)(Wj,{size:16})})}),(0,L.jsxs)(Xh.Dropdown,{className:pz.menuDropdown,children:[M&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(FM,{size:16}),onClick:e.onExport??(()=>u(e=>({...e,exportDialogVisible:!0,dialogOpenTime:Date.now()}))),children:`Export`}),ee&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(rM,{size:16}),onClick:()=>e.onBulk?.(A),children:`Bulk Apply`}),N&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(RM,{size:16}),disabled:A.length===0,onClick:()=>u(e=>({...e,deleteConfirmVisible:!0})),children:`Delete`})]})]}),e.onNew&&(0,L.jsx)(cy,{label:`New ${E}`,position:`bottom`,openDelay:500,children:(0,L.jsx)(bu,{variant:`filled`,color:`blue`,size:32,radius:`xl`,"aria-label":`New ${E}`,onClick:e.onNew,children:(0,L.jsx)(bM,{size:16})})})]})]}),(0,L.jsx)(`div`,{className:pz.tableScroll,children:(0,L.jsxs)(G,{className:pz.table,children:[(0,L.jsxs)(G.Thead,{children:[(0,L.jsxs)(G.Tr,{children:[w&&(0,L.jsx)(G.Th,{className:pz.checkboxCell,"data-checkbox-cell":!0,"data-testid":`all-checkbox-cell`,onClick:e=>KB(e,()=>_(!j)),onAuxClick:e=>e.stopPropagation(),children:(0,L.jsx)(`div`,{className:pz.checkboxWrap,children:(0,L.jsx)(pp,{size:`xs`,"aria-label":`Select all rows`,"data-testid":`all-checkbox`,checked:j,onChange:e=>_(e.currentTarget.checked)})})}),T.map(e=>{let t=e.searchParams?.[0]?.code,n=t?s.sortRules?.find(e=>e.code===t):void 0;return(0,L.jsx)(G.Th,{"aria-sort":n&&(n.descending?`descending`:`ascending`),children:e.searchParams?(0,L.jsxs)(Xh,{shadow:`md`,radius:`md`,position:`bottom-start`,children:[(0,L.jsx)(Xh.Target,{children:(0,L.jsx)(vl,{className:pz.control,children:(0,L.jsxs)(V,{gap:4,wrap:`nowrap`,children:[(0,L.jsx)(WB,{children:Vz(e.name)}),n&&(n.descending?(0,L.jsx)(hj,{size:12,stroke:2,"aria-hidden":!0}):(0,L.jsx)(gj,{size:12,stroke:2,"aria-hidden":!0}))]})})}),(0,L.jsx)(xB,{search:s,searchParams:e.searchParams,onChange:v,onPrompt:(e,t)=>u(n=>({...n,filterDialogVisible:!0,filterDialogSearchParam:e,filterDialogFilter:t,dialogOpenTime:Date.now()}))})]}):(0,L.jsx)(WB,{className:pz.staticColumnTitle,children:Vz(e.name)})},e.name)}),e.additionalColumns?.map(e=>(0,L.jsx)(G.Th,{children:(0,L.jsx)(WB,{className:pz.staticColumnTitle,children:e.name})},e.name))]}),!e.hideFilters&&(0,L.jsxs)(G.Tr,{children:[w&&(0,L.jsx)(G.Th,{}),T.map(e=>(0,L.jsx)(G.Th,{children:e.searchParams&&(0,L.jsx)(GB,{resourceType:E,searchParams:e.searchParams,filters:s.filters})},e.name)),e.additionalColumns?.map(e=>(0,L.jsx)(G.Th,{},e.name))]})]}),(0,L.jsx)(G.Tbody,{children:k?.map(t=>t&&(0,L.jsxs)(G.Tr,{className:pz.tr,"data-testid":`search-control-row`,tabIndex:t.id===P?0:-1,onFocus:e=>{e.target===e.currentTarget&&f(t.id)},onKeyDown:e=>x(e,t),onClick:e=>y(e,t),onAuxClick:e=>y(e,t),children:[w&&(0,L.jsx)(G.Td,{className:pz.checkboxCell,"data-checkbox-cell":!0,"data-testid":`row-checkbox-cell`,onClick:e=>KB(e,()=>g(t.id)),onAuxClick:e=>e.stopPropagation(),children:(0,L.jsx)(`div`,{className:pz.checkboxWrap,children:(0,L.jsx)(pp,{size:`xs`,"data-testid":`row-checkbox`,"aria-label":`Checkbox for ${t.id}`,checked:!!l.selected[t.id],onChange:e=>g(t.id,e.currentTarget.checked)})})}),T.map(e=>(0,L.jsx)(G.Td,{children:qz(t,e)},e.name)),e.additionalColumns?.map(e=>(0,L.jsx)(G.Td,{children:e.renderCell(t)},e.name))]},t.id))})]})}),!k?.length&&(0,L.jsx)(PF,{children:(0,L.jsx)(Xp,{style:{height:150},children:(0,L.jsx)(H,{className:pz.mutedText,size:`xl`,children:`No results`})})}),D&&(0,L.jsx)(Xp,{m:0,p:`md`,pb:0,children:(0,L.jsx)(pv,{value:qB(s),total:JB(s,D),onChange:e=>v(Nz(s,e)),getControlProps:LB})}),(0,L.jsx)($z,{search:s,visible:l.fieldEditorVisible,onOk:e=>{v(e),u(e=>({...e,fieldEditorVisible:!1}))},onCancel:()=>u(e=>({...e,fieldEditorVisible:!1}))},`search-field-editor-${l.dialogOpenTime}`),(0,L.jsx)(dz,{visible:l.exportDialogVisible,exportCsv:e.onExportCsv,exportTransactionBundle:e.onExportTransactionBundle,onCancel:()=>{u(e=>({...e,exportDialogVisible:!1}))}},`search-export-dialog-${l.dialogOpenTime}`),(0,L.jsx)(gB,{visible:l.filterDialogVisible,title:l.filterDialogSearchParam?.code?Vz(l.filterDialogSearchParam.code):``,resourceType:E,searchParam:l.filterDialogSearchParam,filter:l.filterDialogFilter,defaultValue:``,onOk:e=>{v(vz(s,e.code,e.operator,e.value)),u(e=>({...e,filterDialogVisible:!1}))},onCancel:()=>u(e=>({...e,filterDialogVisible:!1}))},`search-filter-dialog-${l.dialogOpenTime}`),(0,L.jsx)(aR,{opened:!!l.deleteConfirmVisible,onClose:l.deleting?()=>void 0:C,title:`Delete selected ${Vz(E)} resources?`,actions:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(U,{color:`red`,w:`100%`,loading:!!l.deleting,onClick:S,children:`Delete`}),(0,L.jsx)(U,{variant:`outline`,w:`100%`,disabled:!!l.deleting,onClick:C,children:`Cancel`})]}),children:(0,L.jsx)(H,{children:`This action cannot be undone.`})})]})}function WB(e){return(0,L.jsx)(H,{className:`${pz.mutedText} ${e.className??``}`,size:`xs`,fw:500,lh:`sm`,children:e.children})}function GB(e){let t=(e.filters??[]).filter(t=>e.searchParams.find(e=>e.code===t.code));return t.length===0?(0,L.jsx)(H,{className:pz.mutedText,size:`xs`,lh:`sm`,children:`no filters`}):(0,L.jsx)(L.Fragment,{children:t.map(t=>(0,L.jsxs)(H,{size:`xs`,lh:`sm`,children:[Bz(t.operator),`\xA0`,(0,L.jsx)(_B,{resourceType:e.resourceType,filter:t})]},`filter-${t.code}-${t.operator}-${t.value}`))})}function KB(e,t){e.stopPropagation(),!e.target.closest(`input, label`)&&t()}function qB(e){return Math.floor((e.offset??0)/(e.count??20))+1}function JB(e,t){let n=e.count??20,r=ZB(e,t);return Math.ceil(r/n)}function YB(e,t){return Math.min(ZB(e,t),(e.offset??0)+1)}function XB(e,t){return Math.max(YB(e,t)+(t.entry?.length??0)-1,0)}function ZB(e,t){let n=t.total;return n===void 0&&(n=(e.offset??0)+(t.entry?.length??0)+ +!!t.link?.some(e=>e.relation===`next`)),n}function QB(e){let t=Z(),[n,r]=(0,b.useState)(!1),[i,a]=(0,b.useState)(),{query:o,fields:s}=e,[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)({});(0,b.useEffect)(()=>{a(void 0),t.graphql(o).then(l).catch(e=>a(yS(e)))},[t,o]);function f(e,t){e.stopPropagation();let n=e.target.checked,r={...u};n?r[t]=!0:delete r[t],d(r)}function p(e){e.stopPropagation();let t=e.target.checked,n={},r=c?.data.ResourceList;t&&r&&r.forEach(e=>{e.id&&(n[e.id]=!0)}),d(n)}function m(){let e=c?.data.ResourceList;if(!e||e.length===0)return!1;for(let t of e)if(t.id&&!u[t.id])return!1;return!0}function h(t,n){XM(t.target)||(JM(t),t.button!==1&&e.onClick&&e.onClick(new HB(n,t)),t.button===1&&e.onAuxClick&&e.onAuxClick(new HB(n,t)))}if((0,b.useEffect)(()=>{t.requestSchema(e.resourceType).then(()=>r(!0)).catch(console.log)},[t,e.resourceType]),!n)return(0,L.jsx)(fu,{});let g=e.checkboxesEnabled;return(0,L.jsxs)(`div`,{onContextMenu:e=>JM(e),"data-testid":`search-control`,children:[(0,L.jsxs)(G,{children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[g&&(0,L.jsx)(G.Th,{children:(0,L.jsx)(`input`,{type:`checkbox`,value:`checked`,"aria-label":`all-checkbox`,"data-testid":`all-checkbox`,checked:m(),onChange:e=>p(e)})}),s.map(e=>(0,L.jsx)(G.Th,{children:e.name},e.name))]})}),(0,L.jsx)(G.Tbody,{children:c?.data.ResourceList.map(e=>e&&(0,L.jsxs)(G.Tr,{"data-testid":`search-control-row`,onClick:t=>h(t,e),onAuxClick:t=>h(t,e),children:[g&&(0,L.jsx)(G.Td,{children:(0,L.jsx)(`input`,{type:`checkbox`,value:`checked`,"data-testid":`row-checkbox`,"aria-label":`Checkbox for ${e.id}`,checked:!!u[e.id],onChange:t=>f(t,e.id)})}),s.map(t=>(0,L.jsx)(G.Td,{children:(0,L.jsx)(uz,{propertyType:t.propertyType,path:t.fhirPath,resource:e})},t.name))]},e.id))})]}),c?.data.ResourceList.length===0&&(0,L.jsx)(`div`,{"data-testid":`empty-search`,children:`No results`}),i&&(0,L.jsx)(`div`,{"data-testid":`search-error`,children:(0,L.jsx)(`pre`,{style:{textAlign:`left`},children:JSON.stringify(i,void 0,2)})}),e.onBulk&&(0,L.jsx)(U,{onClick:()=>e.onBulk(Object.keys(u)),children:`Bulk...`})]})}var $B=(0,b.memo)(QB),eV={root:`_root_1fbwr_1`,entry:`_entry_1fbwr_8`,key:`_key_1fbwr_13`,value:`_value_1fbwr_20`};function tV(e){return(0,L.jsx)(ml,{children:(0,L.jsx)(`div`,{className:eV.root,children:e.children})})}tV.Entry=function(e){return(0,L.jsx)(`div`,{className:eV.entry,children:e.children})},tV.Key=function(e){return(0,L.jsx)(`div`,{className:eV.key,children:e.children})},tV.Value=function(e){return(0,L.jsx)(`div`,{className:eV.value,children:e.children})};var nV=[120,90,50,60,40,110,220,90];function rV(e){let t=e.entries??6;return(0,L.jsx)(ml,{children:(0,L.jsxs)(`div`,{"data-testid":`info-bar-skeleton`,className:eV.root,children:[e.withAvatar&&(0,L.jsx)(Py,{circle:!0,height:56,mr:8,style:{flexShrink:0}}),Array.from({length:t},(e,t)=>(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(Py,{height:10,width:nV[t%nV.length]*.6,mb:8}),(0,L.jsx)(Py,{height:16,width:nV[t%nV.length]})]},t))]})})}var iV={list:`_list_y4z6g_1`,link:`_link_y4z6g_6`};function aV(e){let{baseUrl:t,tabs:n,children:r,...i}=e,a=oV(n),o=Uk(),[s,c]=(0,b.useState)(()=>{let e=uD.getPathname().split(`/`).pop();if(e){let t=e.toLowerCase(),n=a.find(e=>e.value.split(/[?#]/)[0].toLowerCase()===t);if(n)return n.value}return a[0].value});function l(e){e||=a[0].value,c(e),o(`${t}/${e}`)}return(0,L.jsxs)(Ab,{value:s,onChange:l,...i,children:[(0,L.jsx)(Ab.List,{className:iV.list,children:a.map(e=>(0,L.jsx)(Ab.Tab,{value:e.value,children:(0,L.jsx)(Rd,{className:iV.link,href:`${t}/${e.value}`,onClick:sV,children:e.label})},e.value))}),r]})}function oV(e){return e.map(e=>rw(e)?{label:e,value:e.toLowerCase()}:e)}function sV(e){YM(e)||e.preventDefault()}function cV(e){let{group:t}=e;return(0,L.jsx)(Cl,{withBorder:!0,radius:`md`,p:`xs`,display:`flex`,style:{alignItems:`center`,justifyContent:`center`},children:(0,L.jsxs)(V,{children:[t.measureScore&&(0,L.jsx)(dV,{group:t}),!t.measureScore&&(0,L.jsx)(uV,{group:t})]})})}function lV(e){let{measure:t}=e;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(H,{fz:`md`,fw:500,mb:8,children:t.title}),(0,L.jsx)(H,{fz:`xs`,c:`dimmed`,mb:8,children:t.subtitle})]})}function uV(e){let{group:t}=e,n=t.population,r=n?.find(e=>Ww(e.code)===`numerator`),i=n?.find(e=>Ww(e.code)===`denominator`),a=r?.count,o=i?.count;if(o===0)return(0,L.jsxs)(z,{children:[(0,L.jsx)(K,{order:3,children:`Not Applicable`}),(0,L.jsx)(H,{children:`Denominator: ${o}`})]});if(a===void 0||o===void 0)return(0,L.jsxs)(z,{children:[(0,L.jsx)(K,{order:3,children:`Insufficient Data`}),(0,L.jsx)(H,{children:`Numerator: ${a}`}),(0,L.jsx)(H,{children:`Denominator: ${o}`})]});let s=a/o*100;return(0,L.jsx)(gy,{size:120,thickness:12,roundCaps:!0,sections:[{value:s,color:pV(s)}],label:(0,L.jsx)(xd,{justify:`center`,children:(0,L.jsxs)(H,{fw:700,fz:18,children:[a,` / `,o]})})})}function dV(e){let{group:t}=e,n=t.measureScore?.unit??t.measureScore?.code;return(0,L.jsx)(L.Fragment,{children:n===`%`?(0,L.jsx)(gy,{size:120,thickness:12,roundCaps:!0,sections:[{value:fV(t),color:pV(t?.measureScore?.value??0)}],label:(0,L.jsx)(xd,{justify:`center`,children:(0,L.jsx)(H,{fw:700,fz:18,children:(0,L.jsx)(FI,{value:t.measureScore})})})}):(0,L.jsx)(xd,{h:120,align:`center`,children:(0,L.jsx)(K,{order:3,children:(0,L.jsx)(FI,{value:t.measureScore})})})})}function fV(e){let t=e.measureScore?.value,n=e.measureScore?.unit;return t?t<=1&&n===`%`?t*100:t:0}function pV(e){return e<=33?`red`:e<=67?`yellow`:`green`}function mV(e){let t=eA(e.measureReport),[n]=JA(`Measure`,{url:t?.measure});return t?(0,L.jsxs)(z,{children:[n&&(0,L.jsx)(lV,{measure:n}),(0,L.jsx)(Ay,{cols:{base:3,sm:1},spacing:{base:`md`,sm:`sm`},children:t.group?.map((e,t)=>(0,L.jsx)(cV,{group:e},e.id??t))})]}):null}var hV=`patient-accounts`,gV=`Patient Accounts`,_V=[`Organization`,`HealthcareService`,`CareTeam`];function vV(e){let{patient:t}=e,n=Z(),r=n.isProjectAdmin()||n.isSuperAdmin(),i=(0,b.useMemo)(()=>AC(t.meta)??[],[t.meta]),[a,o]=(0,b.useState)(i),[s,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!0),[d,f]=(0,b.useState)(!1),p=(0,b.useMemo)(()=>{let e=[];for(let t of a)i.some(e=>e.reference===t.reference)||e.push({reference:t,type:`addition`});for(let t of i)a.some(e=>e.reference===t.reference)||e.push({reference:t,type:`removal`});return e},[i,a]),m=p.length>0,h=(0,b.useCallback)(e=>{e?.reference&&(a.some(t=>t.reference===e.reference)||o(t=>[...t,e]))},[a]),g=(0,b.useCallback)(e=>{o(t=>t.filter(t=>t.reference!==e))},[]),_=(0,b.useCallback)(async()=>{let r=t.id;if(!r){Zb.show({id:hV,title:gV,color:`red`,message:`Cannot update accounts: Patient resource has no ID.`,icon:(0,L.jsx)(HM,{size:`1rem`}),autoClose:!1,withCloseButton:!0});return}f(!0),c(!1);let i=n.fhirUrl(`Patient`,r,`$set-accounts`),o={resourceType:`Parameters`,parameter:[...a.map(e=>({name:`accounts`,valueReference:{reference:e.reference}})),{name:`propagate`,valueBoolean:l}]};Zb.show({id:hV,title:gV,loading:!0,message:l?`Saving account changes and propagating to compartment...`:`Saving account changes...`,autoClose:!1,withCloseButton:!1});try{let t={};l&&(t.Prefer=`respond-async`),await n.post(i,o,void 0,{headers:t}),n.invalidateUrl(n.fhirUrl(`Patient`,r)),Zb.update({id:hV,title:gV,color:`green`,message:l?`Account changes saved. Compartment updates are being applied.`:`Account changes saved.`,icon:(0,L.jsx)(jj,{size:`1rem`}),loading:!1,autoClose:!0,withCloseButton:!0}),e.onSaved?.()}catch(e){Zb.update({id:hV,title:gV,color:`red`,message:J(e),icon:(0,L.jsx)(HM,{size:`1rem`}),loading:!1,autoClose:!1,withCloseButton:!0})}finally{f(!1)}},[n,t,a,l,e]);return r?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(W,{children:[(0,L.jsx)(K,{order:3,children:`Current Accounts`}),a.length===0?(0,L.jsx)(H,{c:`dimmed`,children:`No accounts assigned to this patient.`}):(0,L.jsxs)(G,{children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Type`}),(0,L.jsx)(G.Th,{children:`Account`}),(0,L.jsx)(G.Th,{})]})}),(0,L.jsx)(G.Tbody,{children:a.map(e=>(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:(0,L.jsx)(yV,{reference:e})}),(0,L.jsx)(G.Td,{children:(0,L.jsx)(dR,{value:e,link:!0})}),(0,L.jsx)(G.Td,{children:(0,L.jsx)(bu,{variant:`subtle`,color:`red`,"aria-label":`Remove ${e.reference}`,onClick:()=>g(e.reference),children:(0,L.jsx)(HM,{size:16})})})]},e.reference))})]}),(0,L.jsx)(hm,{}),(0,L.jsx)(K,{order:4,children:`Add Account`}),(0,L.jsx)(ML,{name:`newAccount`,placeholder:`Search for Organization, HealthcareService, or CareTeam...`,targetTypes:_V,onChange:e=>{e&&h(e)}}),m&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(hm,{}),(0,L.jsx)(K,{order:4,children:`Pending Changes`}),(0,L.jsx)(W,{gap:`xs`,children:p.map(e=>(0,L.jsxs)(V,{gap:`xs`,children:[e.type===`addition`?(0,L.jsx)(Ip,{color:`green`,variant:`light`,leftSection:(0,L.jsx)(bM,{size:12}),children:`Add`}):(0,L.jsx)(Ip,{color:`red`,variant:`light`,leftSection:(0,L.jsx)(fM,{size:12}),children:`Remove`}),(0,L.jsx)(dR,{value:e.reference,link:!0})]},`${e.type}-${e.reference.reference}`))})]}),(0,L.jsx)(z,{children:(0,L.jsx)(U,{disabled:!m||d,onClick:()=>c(!0),children:`Save Changes`})})]}),(0,L.jsx)(pg,{opened:s,onClose:()=>c(!1),title:`Confirm Account Changes`,size:`md`,keepMounted:!0,children:(0,L.jsxs)(W,{children:[(0,L.jsxs)(H,{children:[`The following changes will be applied to Patient`,` `,(0,L.jsxs)(`strong`,{children:[t.name?.[0]?.given?.join(` `),` `,t.name?.[0]?.family]}),`:`]}),p.filter(e=>e.type===`addition`).length>0&&(0,L.jsxs)(z,{children:[(0,L.jsx)(H,{fw:600,c:`green`,children:`Adding:`}),(0,L.jsx)(W,{gap:`xs`,mt:`xs`,children:p.filter(e=>e.type===`addition`).map(e=>(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(bM,{size:14,color:`green`}),(0,L.jsx)(dR,{value:e.reference})]},e.reference.reference))})]}),p.filter(e=>e.type===`removal`).length>0&&(0,L.jsxs)(z,{children:[(0,L.jsx)(H,{fw:600,c:`red`,children:`Removing:`}),(0,L.jsx)(W,{gap:`xs`,mt:`xs`,children:p.filter(e=>e.type===`removal`).map(e=>(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(fM,{size:14,color:`red`}),(0,L.jsx)(dR,{value:e.reference})]},e.reference.reference))})]}),(0,L.jsx)(pp,{label:`Propagate changes to all resources in this patient's compartment`,checked:l,onChange:e=>u(e.currentTarget.checked)}),(0,L.jsxs)(V,{justify:`right`,mt:`md`,children:[(0,L.jsx)(U,{variant:`default`,onClick:()=>c(!1),children:`Cancel`}),(0,L.jsx)(U,{onClick:_,loading:d,children:`Confirm`})]})]})})]}):(0,L.jsx)(jd,{color:`blue`,title:`Admin access required`,children:`You need project admin access to manage patient account assignments.`})}function yV({reference:e}){let t=e.reference?.split(`/`)[0]??`Unknown`;return(0,L.jsx)(Ip,{variant:`light`,color:{Organization:`blue`,HealthcareService:`teal`,CareTeam:`violet`}[t]??`gray`,size:`sm`,children:t})}var bV=`patient-export`,xV=`Patient Export`,SV={everything:{operation:`$everything`,extension:`json`,contentType:wD.FHIR_JSON},summary:{operation:`$summary`,extension:`json`,contentType:wD.FHIR_JSON},ccda:{operation:`$ccda-export`,extension:`xml`,contentType:wD.CDA_XML},ccdaReferral:{operation:`$ccda-export`,type:`referral`,extension:`xml`,contentType:wD.CDA_XML}};function CV(e){let t=Z(),{patient:n}=e,[r,i]=(0,b.useState)(`everything`),[a,o]=(0,b.useState)(!1),s=(0,b.useCallback)(async e=>{let i=kC(n),{operation:o,type:s,contentType:c,extension:l}=SV[r],u=t.fhirUrl(`Patient`,i,o),d={};r===`everything`&&a&&u.searchParams.set(`_inlineAttachments`,`true`),s&&(d.type=s),e.author&&(d.author={reference:e.author}),e.authoredOn&&(d.authoredOn=fL(e.authoredOn)),e.startDate&&(d.start=e.startDate),e.endDate&&(d.end=e.endDate),Zb.show({id:bV,title:xV,loading:!0,message:`Exporting...`,autoClose:!1,withCloseButton:!1});try{wV(await t.post(u,d,void 0,{cache:`no-cache`,headers:{Accept:c}}),`Patient-export-${i}-${new Date().toISOString().replaceAll(`:`,`-`)}.${l}`,c),Zb.update({id:bV,title:xV,color:`green`,message:`Done`,icon:(0,L.jsx)(jj,{size:`1rem`}),loading:!1,autoClose:!0,withCloseButton:!0})}catch(e){Zb.update({id:bV,title:xV,color:`red`,message:J(e),icon:(0,L.jsx)(HM,{size:`1rem`}),loading:!1,autoClose:!1,withCloseButton:!0})}},[t,n,r,a]);return(0,L.jsx)(NP,{onSubmit:s,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Export Format`,description:`Required`,withAsterisk:!0,children:(0,L.jsx)(by,{name:`format`,value:r,onChange:i,data:[{label:`FHIR Everything`,value:`everything`},{label:`Patient Summary`,value:`summary`},{label:`C-CDA`,value:`ccda`},{label:`C-CDA Referral`,value:`ccdaReferral`}],fullWidth:!0})}),(0,L.jsx)(eL,{title:`Author`,description:`Optional author for composition. Default value is current user.`,children:(0,L.jsx)(ML,{name:`author`,placeholder:`Author`,targetTypes:[`Organization`,`Practitioner`,`PractitionerRole`]})}),(0,L.jsx)(eL,{title:`Authored On`,description:`Optional date for composition authored on. Default value is current date.`,children:(0,L.jsx)(pL,{name:`authoredOn`,placeholder:`Authored on`})}),(0,L.jsx)(eL,{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:(0,L.jsx)(pL,{name:`startDate`,placeholder:`Start date`})}),(0,L.jsx)(eL,{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:(0,L.jsx)(pL,{name:`endDate`,placeholder:`End date`})}),r===`everything`&&(0,L.jsx)(eL,{title:`Inline Attachments`,description:`Embed DocumentReference file attachments as base64-encoded data instead of storage URLs.`,children:(0,L.jsx)(W,{gap:`xs`,children:(0,L.jsx)(pp,{label:`Inline attachments`,checked:a,onChange:e=>o(e.currentTarget.checked)})})}),(0,L.jsx)(V,{justify:`right`,children:(0,L.jsx)(PP,{children:`Request Export`})})]})})}function wV(e,t,n){let r=typeof e==`string`?e:JSON.stringify(e,null,2),i=new Blob([r],{type:n}),a=window.URL.createObjectURL(i),o=document.createElement(`a`);document.body.appendChild(o),o.style.display=`none`,o.href=a,o.download=t,o.click(),window.URL.revokeObjectURL(a)}function TV(e){if(e.gender===`male`)return`blue`;if(e.gender===`female`)return`pink`}function EV(e){let t=eA(e.patient);return t?(0,L.jsxs)(tV,{children:[(0,L.jsx)(oN,{value:t,size:`lg`,color:TV(t)}),(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(tV.Key,{children:`Name`}),(0,L.jsx)(tV.Value,{children:(0,L.jsx)(eN,{to:t,fw:500,children:t.name?(0,L.jsx)(MI,{value:t.name[0],options:{use:!1}}):`[blank]`})})]}),t.birthDate&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(tV.Key,{children:`DoB`}),(0,L.jsx)(tV.Value,{children:t.birthDate})]}),(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(tV.Key,{children:`Age`}),(0,L.jsx)(tV.Value,{children:RC(t.birthDate)})]})]}),t.gender&&(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(tV.Key,{children:`Gender`}),(0,L.jsx)(tV.Value,{children:t.gender})]}),t.address&&(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(tV.Key,{children:`State`}),(0,L.jsx)(tV.Value,{children:t.address[0]?.state})]}),t.identifier?.map(e=>(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(tV.Key,{children:e?.system}),(0,L.jsx)(tV.Value,{children:e?.value})]},`${e?.system}-${e?.value}`))]}):null}function DV(e){let{patient:t,...n}=e,r=(0,b.useCallback)((e,t,n)=>{let r=`${t}/${n}`;return Promise.allSettled([e.readHistory(`Patient`,n),e.search(`ClinicalImpression`,{subject:r,_count:100}),e.search(`Communication`,{subject:r,_count:100}),e.search(`Device`,{patient:r,_count:100}),e.search(`DeviceRequest`,{patient:r,_count:100}),e.search(`DiagnosticReport`,{subject:r,_count:100}),e.search(`Media`,{subject:r,_count:100}),e.search(`ServiceRequest`,{subject:r,_count:100}),e.search(`Task`,{subject:r,_count:100})])},[]);return(0,L.jsx)(QR,{value:t,loadTimelineResources:r,createCommunication:(e,t,n)=>({resourceType:`Communication`,status:`completed`,subject:DC(e),sender:DC(t),sent:new Date().toISOString(),payload:[{contentString:n}]}),createMedia:(e,t,n)=>({resourceType:`Media`,status:`completed`,subject:DC(e),operator:DC(t),issued:new Date().toISOString(),content:n}),...n})}var OV={section:`_section_pqpwm_1`,hovering:`_hovering_pqpwm_7`,editing:`_editing_pqpwm_11`};function kV(e){let t=Z(),n=eA(e.value),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)();function d(){c(void 0)}function f(){o(void 0)}if((0,b.useEffect)(()=>{t.requestSchema(`PlanDefinition`).then(()=>i(!0)).catch(console.log)},[t]),(0,b.useEffect)(()=>(u(LV(n??{resourceType:`PlanDefinition`,status:`active`})),document.addEventListener(`mouseover`,d),document.addEventListener(`click`,f),()=>{document.removeEventListener(`mouseover`,d),document.removeEventListener(`click`,f)}),[n]),!r||!l)return null;function p(e,t){u(n=>({...n,[e]:t}))}return(0,L.jsx)(`div`,{children:(0,L.jsxs)(NP,{testid:`questionnaire-form`,onSubmit:()=>e.onSubmit(l),children:[(0,L.jsx)(jb,{label:`Plan Title`,py:`md`,defaultValue:l.title,onChange:e=>p(`title`,e.currentTarget.value)}),(0,L.jsx)(AV,{actions:l.action||[],selectedKey:a,setSelectedKey:o,hoverKey:s,setHoverKey:c,onChange:e=>p(`action`,e)}),(0,L.jsx)(PP,{children:`Save`})]})})}function AV(e){function t(t){e.onChange(e.actions.map(e=>e.id===t.id?t:e))}function n(t){e.onChange([...e.actions,t]),e.setSelectedKey(t.id)}function r(t){e.onChange(e.actions.filter(e=>e!==t))}return(0,L.jsxs)(W,{gap:`md`,className:OV.section,children:[e.actions.map(n=>(0,L.jsx)(jV,{action:n,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,setHoverKey:e.setHoverKey,onChange:t,onRemove:()=>r(n)},n.id)),(0,L.jsx)(`div`,{children:(0,L.jsx)(U,{variant:`outline`,onClick:e=>{JM(e),n({id:IV()})},children:`Add action`})})]})}function jV(e){let{action:t}=e;function n(t){t.stopPropagation(),e.setSelectedKey(e.action.id)}function r(t){JM(t),e.setHoverKey(e.action.id)}return(0,L.jsx)(`div`,{onClick:n,onMouseOver:r,onFocus:r,children:(0,L.jsx)(MV,{action:t,onChange:e.onChange,selectedKey:e.selectedKey,hoverKey:e.hoverKey,onRemove:e.onRemove})})}function MV(e){let{action:t}=e,[n,r]=(0,b.useState)(),i=Z(),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(),l=e.selectedKey===e.action.id,u=e.hoverKey===e.action.id;function d(n,r){e.onChange({...t,[n]:r})}let f=Ln(OV.section,{[OV.hovering]:u&&!l});return(0,b.useEffect)(()=>{(async()=>{if(!t.definitionCanonical)return;o(!0);let e=await i.readCanonical([`Questionnaire`,`ActivityDefinition`],t.definitionCanonical);r(PV(e)),c(e),o(!1)})().catch(console.error)},[t.definitionCanonical,i]),a?(0,L.jsx)(fu,{}):(0,L.jsxs)(Cl,{"data-testid":t.id,className:f,p:0,radius:`sm`,withBorder:!0,children:[(0,L.jsxs)(xd,{w:`100%`,p:`xs`,bg:`gray.0`,gap:`md`,align:`center`,justify:`space-between`,children:[(0,L.jsx)(jb,{w:`100%`,name:`actionTitle-${t.id}`,defaultValue:t.title,placeholder:`Title`,onChange:e=>d(`title`,e.currentTarget.value)}),(0,L.jsx)(Tu,{"data-testid":`close-button`,onClick:e.onRemove})]}),l&&(0,L.jsxs)(W,{gap:`xl`,p:`md`,children:[(0,L.jsx)(z,{children:(0,L.jsx)(jb,{label:`Task Description`,placeholder:`Enter task description`,name:`actionDescription-${t.id}`,defaultValue:t.description,onChange:e=>d(`description`,e.currentTarget.value)})}),(0,L.jsx)(z,{children:(0,L.jsx)(Ig,{label:`Type of Action`,value:n,onChange:t=>{let n=t.currentTarget.value===`standard`?void 0:t.currentTarget.value;r(n),e.onChange({...e.action,definitionCanonical:n===`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`&&(0,L.jsxs)(W,{gap:0,children:[(0,L.jsxs)(V,{gap:0,mb:`xs`,children:[(0,L.jsx)(H,{fw:600,children:`Select questionnaire`}),(0,L.jsx)(H,{c:`red`,children:`*`})]}),(0,L.jsxs)(H,{size:`sm`,c:`dimmed`,mb:`sm`,children:[`Questionnaire to be shown in the task in Encounter view. You can create new one from`,` `,(0,L.jsx)(Rd,{href:`/Questionnaire`,target:`_blank`,c:`blue`,children:`questionnaires list`})]}),(0,L.jsx)(NV,{resource:s,resourceType:`Questionnaire`,action:t,onChange:e.onChange,placeholder:`Search for questionnaire`})]}),n===`activitydefinition`&&(0,L.jsxs)(W,{gap:0,children:[(0,L.jsxs)(V,{gap:0,mb:`xs`,children:[(0,L.jsx)(H,{fw:600,children:`Select activity definition`}),(0,L.jsx)(H,{c:`red`,children:`*`})]}),(0,L.jsxs)(H,{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`,` `,(0,L.jsx)(Rd,{href:`/ActivityDefinition`,target:`_blank`,c:`blue`,children:`activity definitions list`})]}),(0,L.jsx)(NV,{resource:s,resourceType:`ActivityDefinition`,action:t,onChange:e.onChange,placeholder:`Search for activity definition`})]})]})]})}function NV(e){let{id:t}=e.action,{resource:n}=e;return(0,L.jsx)(jL,{name:t,placeholder:e.placeholder,resourceType:e.resourceType,defaultValue:n,onChange:t=>{t?e.onChange({...e.action,definitionCanonical:`url`in t?t.url:void 0,definitionUri:`url`in t?void 0:OC(t)}):e.onChange({...e.action,definitionCanonical:void 0})}})}function PV(e){return e===void 0?`standard`:e.resourceType.toLowerCase()}var FV=1;function IV(e){if(e){if(e.startsWith(`id-`)){let t=Number.parseInt(e.substring(3),10);Number.isNaN(t)||(FV=Math.max(FV,t+1))}return e}return`id-`+FV++}function LV(e){return{...e,action:RV(e.action)}}function RV(e){if(e)return e.map(e=>({...e,id:IV(e.id),action:RV(e.action)}))}var zV=`modulepreload`,BV=function(e){return`/`+e},VV={},HV=function(e){return e.pathname.endsWith(`.css`)},UV=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=BV(t,n);let r=s(t);if(r.href in VV)return;VV[r.href]=!0;let i=HV(r);if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let o=document.createElement(`link`);if(o.rel=i?`stylesheet`:zV,i||(o.as=`script`),o.crossOrigin=``,o.href=r.href,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),i)return new Promise((e,t)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>t(Error(`Unable to preload CSS for ${r}`)))})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},WV=150,GV;function KV({onScan:e,onError:t,scanOnce:n=!0}){let r=(0,b.useRef)(null),i=(0,b.useRef)(null),a=Xk(e),o=Xk(t),[s,c]=(0,b.useState)(!0),[l,u]=(0,b.useState)();return(0,b.useEffect)(()=>{let e=r.current,t=i.current,s=t?.getContext(`2d`,{willReadFrequently:!0});if(!e||!t||!s)return;let l=e,d=t,f=s,p=0,m,h=!1,g=!1,_=0,v;function y(){m?.getTracks().forEach(e=>e.stop())}function b(e){let t=e instanceof Error?e:Error(String(e));h||(c(!1),u(J(t)),o(t))}function x(e){if(!(h||g||!v)){if(l.readyState===l.HAVE_ENOUGH_DATA&&(c(!1),e-_>=WV)){_=e,d.height=l.videoHeight,d.width=l.videoWidth,f.drawImage(l,0,0,d.width,d.height);let t=f.getImageData(0,0,d.width,d.height),r=v(t.data,t.width,t.height,{inversionAttempts:`attemptBoth`});if(r?.data&&(g=n,a(r.data),n)){y();return}}p=requestAnimationFrame(x)}}async function S(){try{if(v=await qV(),h)return;if(!navigator.mediaDevices?.getUserMedia)throw Error(`Camera access is not available in this browser.`);let e=await navigator.mediaDevices.getUserMedia({video:{facingMode:`environment`}});if(h){e.getTracks().forEach(e=>e.stop());return}m=e,l.srcObject=e,l.setAttribute(`playsinline`,`true`),await l.play(),h||(p=requestAnimationFrame(x))}catch(e){b(e)}}return S().catch(b),()=>{h=!0,cancelAnimationFrame(p),y()}},[n,a,o]),(0,L.jsxs)(W,{gap:`sm`,children:[l&&(0,L.jsx)(jd,{color:`red`,children:l}),(0,L.jsxs)(z,{pos:`relative`,style:{aspectRatio:`4 / 3`,display:l?`none`:`block`,width:`100%`,maxHeight:`70vh`,overflow:`hidden`,borderRadius:`var(--mantine-radius-default)`,background:`black`},children:[(0,L.jsx)(`video`,{ref:r,width:640,height:480,muted:!0,style:{display:`block`,width:`100%`,height:`100%`,objectFit:`cover`}}),s&&!l&&(0,L.jsx)(Xp,{pos:`absolute`,top:0,left:0,right:0,bottom:0,style:{pointerEvents:`none`},children:(0,L.jsxs)(W,{gap:`xs`,align:`center`,children:[(0,L.jsx)(fu,{size:`sm`,color:`gray.3`}),(0,L.jsx)(H,{c:`gray.3`,size:`sm`,children:`Loading camera...`})]})})]}),(0,L.jsx)(`canvas`,{ref:i,hidden:!0})]})}async function qV(){return GV||=UV(()=>import(`./jsQR-CogLAsBn.js`).then(e=>c(e.default,1)).then(e=>e.default),[]).catch(e=>{throw GV=void 0,Error(`QR code scanning requires the optional "jsqr" dependency. Install jsqr to use QrCodeScanner. ${J(e)}`)}),GV}var JV=30,YV=50;function XV(e){let t=e.formState,n=e.item,r=e.responseItem;function i(i){if(t&&e.context){if(n.repeats&&e.index!==void 0&&n.type!==nA.choice&&n.type!==nA.openChoice){let n=[...r.answer||[]];i.length===0?n.splice(e.index,1):n[e.index]=i[0],t.onChangeAnswer(e.context,e.item,n)}else t.onChangeAnswer(e.context,e.item,i)}}let a=n.type;if(!a)return null;let o=n.linkId;if(!o)return null;let s=n.repeats&&e.index!==void 0&&n.type!==nA.choice&&n.type!==nA.openChoice?`${o}-${e.index}`:o,c;n.initial&&n.initial.length>0?c=n.initial[0]:n.answerOption&&n.answerOption.length>0&&(c=n.answerOption.find(e=>e.initialSelected));let l=aH(r,e.index)??RA(c),u=BC(r,`${Bx}/fhir/StructureDefinition/questionnaire-validationError`),d=null;switch(a){case nA.display:d=(0,L.jsx)(`p`,{children:e.item.text},e.item.linkId);break;case nA.boolean:d=(0,L.jsx)($I,{title:e.item.text,htmlFor:s,children:(0,L.jsx)(pp,{id:s,name:o,required:e.required??n.required,defaultChecked:l?.value,onChange:e=>i([{valueBoolean:e.currentTarget.checked}])})},e.item.linkId);break;case nA.decimal:d=(0,L.jsx)(jb,{type:`number`,step:`any`,id:s,name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>i(e.currentTarget.value===``?[]:[{valueDecimal:e.currentTarget.valueAsNumber}])});break;case nA.integer:d=(0,L.jsx)(jb,{type:`number`,step:1,id:s,name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>i(e.currentTarget.value===``?[]:[{valueInteger:e.currentTarget.valueAsNumber}])});break;case nA.date:d=(0,L.jsx)(jb,{type:`date`,id:s,name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>i([{valueDate:e.currentTarget.value}])});break;case nA.dateTime:d=(0,L.jsx)(pL,{name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>i([{valueDateTime:e}])});break;case nA.time:d=(0,L.jsx)(jb,{type:`time`,id:s,name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>i([{valueTime:e.currentTarget.value}])});break;case nA.string:case nA.url:d=(0,L.jsx)(jb,{id:s,name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>{let t=e.currentTarget.value;i(t===``?[]:[{valueString:t}])}});break;case nA.text:d=(0,L.jsx)(hh,{id:s,name:o,required:e.required??n.required,defaultValue:l?.value,onChange:e=>{let t=e.currentTarget.value;i(t===``?[]:[{valueString:t}])}});break;case nA.attachment:d=(0,L.jsx)(V,{py:4,children:(0,L.jsx)(MF,{path:``,name:s,defaultValue:l?.value,onChange:e=>i([{valueAttachment:e}])})});break;case nA.reference:d=(0,L.jsx)(ML,{name:s,required:e.required??n.required,targetTypes:kA(n),searchCriteria:jA(n,t?.subject,t?.encounter),defaultValue:l?.value,onChange:e=>i([{valueReference:e}])});break;case nA.quantity:d=(0,L.jsx)(xL,{path:``,name:s,required:e.required??n.required,defaultValue:l?.value,onChange:e=>i([{valueQuantity:e}]),disableWheel:!0});break;case nA.choice:case nA.openChoice:{let{widget:t,multiselect:a}=lH(n),o={name:s,item:n,required:e.required??n.required,initial:c,response:r,multiselect:a,onChangeAnswer:i};d=t===`check-box`?(0,L.jsx)(rH,{...o}):t===`drop-down`?(0,L.jsx)(ZV,{...o}):(0,L.jsx)(nH,{...o})}break;default:return null}return(0,L.jsxs)(L.Fragment,{children:[d,u?.valueString&&(0,L.jsx)(H,{c:`red`,size:`lg`,mt:4,children:u.valueString})]})}function ZV(e){let{name:t,item:n,required:r,initial:i,onChangeAnswer:a,response:o,multiselect:s}=e;if(!n.answerOption?.length&&!n.answerValueSet)return(0,L.jsx)(iH,{});let c=RA(i),l=aH(o)??c,u=oH(o),d=n.repeats||s;if(n.answerValueSet)return(0,L.jsx)(UP,{name:t,placeholder:`Select items`,binding:n.answerValueSet,maxValues:d?void 0:1,required:r,onChange:e=>{d?e.length===0?a([{}]):a(e.map(e=>({valueCoding:e}))):a([{valueCoding:e[0]}])},defaultValue:l?.value});if(d){let{propertyName:e,data:t}=uH(n);return(0,L.jsx)(Mg,{data:t,placeholder:`Select items`,searchable:!0,value:u,required:r,onChange:t=>{if(t.length===0)a([{}]);else{let r=wA(t,e,n);a(r)}}})}{let e=[``];if(n.answerOption)for(let t of n.answerOption){let n=zA(t);e.push(Ow(n))}return(0,L.jsx)(Ig,{id:t,name:t,required:r,onChange:e=>{let t=e.currentTarget.selectedIndex;if(t===0){a([{}]);return}let r=n.answerOption[t-1],i=zA(r),o=`value`+dw(i.type);a([{[o]:i.value}])},defaultValue:Gw(l?.value)||l?.value,data:e})}}function QV(e,t){return e?t.valueSetExpand({url:e,count:31}).then(e=>e.expansion?.contains??[]):Promise.resolve([])}function $V(e){let t=Z(),[n,r]=(0,b.useState)([]),[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(()=>!e||void 0);return(0,b.useEffect)(()=>{async function n(){if(!e){s(!0);return}a(!0),s(void 0);try{let n=await QV(e,t);r(n),s(!0)}catch(e){let t=ZA(e);s(!t),t||console.error(`Error loading value set:`,e)}finally{a(!1)}}n().catch(console.error)},[e,t]),{options:n,loading:i,available:o}}function eH({valueSetUrl:e}){return(0,L.jsx)(z,{children:(0,L.jsx)(RP,{text:`This question is unavailable.`,severity:`error`,message:`Value set ${e} is unavailable`})})}function tH(e,t){return e.map((e,n)=>[`${t}-valueset-${n}`,{type:`Coding`,value:{system:e.system,code:e.code,display:e.display}}])}function nH(e){let{name:t,item:n,required:r,initial:i,onChangeAnswer:a,response:o}=e,s=uT(`QuestionnaireItemAnswerOption`,`value[x]`),c=RA(i),{options:l,loading:u,available:d}=$V(n.answerValueSet),f=[],p;if(n.answerValueSet)f.push(...tH(l,t));else if(n.answerOption){let e=n.answerOption.slice(0,YV).map((e,n)=>{let r=`${t}-option-${n}`,i=zA(e);return i?.value?(c&&VC(i)===VC(c)&&(p=r),[r,i]):null}).filter(e=>e!==null);f.push(...e)}let m=sH(f,aH(o));if(u)return(0,L.jsx)(H,{children:`Loading options...`});if(f.length===0)return d===!1?(0,L.jsx)(eH,{valueSetUrl:n.answerValueSet}):(0,L.jsx)(iH,{});let h=f.slice(0,JV);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Wv.Group,{name:t,value:m??p,required:r,onChange:e=>{let t=f.find(t=>t[0]===e);if(t){let e=t[1],n=`value`+dw(e.type);a([{[n]:e.value}])}},children:h.map(([e,t])=>(0,L.jsx)(Wv,{id:e,value:e,py:4,required:r,label:(0,L.jsx)(GI,{property:s,propertyType:t.type,value:t.value})},e))}),(n.answerValueSet&&f.length>JV||n.answerOption&&f.length>YV)&&(0,L.jsxs)(H,{size:`sm`,c:`dimmed`,mt:`xs`,children:[`Showing first `,JV,` options`]})]})}function rH(e){let{name:t,item:n,onChangeAnswer:r,response:i}=e,a=uT(`QuestionnaireItemAnswerOption`,`value[x]`),{options:o,loading:s,available:c}=$V(n.answerValueSet),l=n.answerValueSet?(i?.answer?.map(e=>e.valueCoding)||[]).filter(e=>e!==void 0):oH(i),u=[];if(n.answerValueSet)u.push(...tH(o,t));else if(n.answerOption){let e=n.answerOption.slice(0,YV).map((e,n)=>{let r=`${t}-option-${n}`,i=zA(e);return i?.value?[r,i]:null}).filter(e=>e!==null);u.push(...e)}if(s)return(0,L.jsx)(H,{children:`Loading options...`});if(u.length===0)return c===!1?(0,L.jsx)(eH,{valueSetUrl:n.answerValueSet}):(0,L.jsx)(iH,{});let d=u.slice(0,JV),f=(e,t)=>{if(n.answerValueSet){let n=l,i;i=t?[...n,e.value]:n.filter(t=>!JC(t,e.value)),i.length===0?r([{}]):r(i.map(e=>({valueCoding:e})))}else{let i=l,a=Ow(e),o;if(o=t?[...i,a]:i.filter(e=>e!==a),o.length===0)r([{}]);else{let t=wA(o,`value`+dw(e.type),n);r(t)}}};return(0,L.jsxs)(V,{style:{flexDirection:`column`,alignItems:`flex-start`},children:[d.map(([e,t])=>{let r=Ow(t),i=n.answerValueSet?l.some(e=>JC(e,t.value)):l.includes(r);return(0,L.jsx)(pp,{id:e,label:(0,L.jsx)(GI,{property:a,propertyType:t.type,value:t.value}),checked:i,onChange:e=>f(t,e.currentTarget.checked)},e)}),(n.answerValueSet&&u.length>JV||n.answerOption&&u.length>YV)&&(0,L.jsxs)(H,{size:`sm`,c:`dimmed`,children:[`Showing first `,JV,` options`]})]})}function iH(){return(0,L.jsx)(jb,{disabled:!0,placeholder:`No Answers Defined`})}function aH(e,t=0){return zA(e?.answer?.[t]??{})}function oH(e){let t=e?.answer;return t?t.map(e=>zA(e)).map(e=>Gw(e?.value)||e?.value).filter(Boolean):[]}function sH(e,t){return e.find(e=>JC(e[1].value,t?.value))?.[0]}var cH=[`drop-down`,`radio-button`,`check-box`];function lH(e){let t=`radio-button`,n=!1;e.answerValueSet&&(t=`drop-down`);for(let r of e.extension??[]){if(r.url!==rA)continue;let e=r.valueCodeableConcept?.coding?.[0]?.code;cH.includes(e)&&(t=e),e===`multi-select`&&(n=!0)}return t===`radio-button`&&n&&(t=`check-box`),{widget:t,multiselect:n}}function uH(e){if(e.answerOption?.length===0)return{propertyName:``,data:[]};let t=e.answerOption[0];return{propertyName:`value`+dw(zA(t).type),data:(e.answerOption??[]).map(e=>{let t=Ow(zA(e));return{value:t,label:t}})}}var dH={section:`_section_my8o4_1`,hovering:`_hovering_my8o4_10`,editing:`_editing_my8o4_14`,questionBody:`_questionBody_my8o4_20`,topActions:`_topActions_my8o4_24`,bottomActions:`_bottomActions_my8o4_33`,movementActions:`_movementActions_my8o4_44`,movementIcons:`_movementIcons_my8o4_56`,columnAlignment:`_columnAlignment_my8o4_60`,linkIdInput:`_linkIdInput_my8o4_65`,typeSelect:`_typeSelect_my8o4_70`,preserveBreaks:`_preserveBreaks_my8o4_74`};function fH(e){let t=Z(),n=eA(e.questionnaire),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)();function d(){u(void 0)}function f(){c(void 0)}return(0,b.useEffect)(()=>{t.requestSchema(`Questionnaire`).then(()=>i(!0)).catch(console.log)},[t]),(0,b.useEffect)(()=>(o(xH(n??{resourceType:`Questionnaire`,status:`active`})),document.addEventListener(`mouseover`,d),document.addEventListener(`click`,f),()=>{document.removeEventListener(`mouseover`,d),document.removeEventListener(`click`,f)}),[n]),!r||!a?null:(0,L.jsx)(`div`,{children:(0,L.jsxs)(NP,{testid:`questionnaire-form`,onSubmit:()=>e.onSubmit(a),children:[(0,L.jsx)(pH,{item:a,selectedKey:s,setSelectedKey:c,hoverKey:l,setHoverKey:u,onChange:(t,n)=>{o(t),e.autoSave&&!n&&e.onSubmit&&e.onSubmit(t)}}),(0,L.jsx)(PP,{children:`Save`})]})})}function pH(e){let t=e.item,n=e.item,r=fT(e.item),i=r||n.type===nA.group,a=n.linkId??`[untitled]`,o=e.selectedKey===e.item.id,s=e.hoverKey===e.item.id,c=(0,b.useRef)(e.item);(0,b.useLayoutEffect)(()=>{c.current=e.item});function l(t){JM(t),e.setSelectedKey(e.item.id)}function u(t){JM(t),e.setHoverKey(e.item.id)}function d(t){let n=c.current;e.onChange({...n,item:n.item?.map(e=>e.id===t.id?t:e)})}function f(t,n){e.onChange({...e.item,item:[...e.item.item??[],t]},n)}function p(t){e.onChange({...e.item,item:e.item.item?.filter(e=>e!==t)})}function m(t,n){e.onChange({...c.current,[t]:n})}function h(t){e.onChange({...e.item,...t})}function g(t){e.onChange({...e.item,item:e.item.item?.map(e=>e===t?{...e,repeats:!e.repeats}:e)})}function _(t,n){let r=TH(e.item.item,t,n);e.onChange({...e.item,item:r})}let v=Ln(dH.section,{[dH.editing]:o,[dH.hovering]:s&&!o});return(0,L.jsxs)(`div`,{"data-testid":n.linkId,className:v,onClick:l,onMouseOver:u,onFocus:u,children:[(0,L.jsx)(`div`,{className:dH.questionBody,children:o?(0,L.jsxs)(L.Fragment,{children:[r&&(0,L.jsx)(jb,{size:`xl`,defaultValue:t.title,onBlur:e=>m(`title`,e.currentTarget.value)}),!r&&(0,L.jsx)(hh,{autosize:!0,minRows:2,defaultValue:n.text,onBlur:e=>m(`text`,e.currentTarget.value)}),n.type===`reference`&&(0,L.jsx)(gH,{item:n,onChange:h}),pA(n)&&(0,L.jsx)(mH,{item:n,onChange:e=>h(e)})]}):(0,L.jsxs)(L.Fragment,{children:[t.title&&(0,L.jsx)(K,{children:t.title}),n.text&&(0,L.jsx)(`div`,{className:dH.preserveBreaks,children:n.text}),!i&&(0,L.jsx)(XV,{item:n,index:0,required:!1,responseItem:{linkId:n.linkId}})]})}),n.item?.map((t,n)=>(0,L.jsx)(`div`,{children:(0,L.jsx)(pH,{item:t,selectedKey:e.selectedKey,setSelectedKey:e.setSelectedKey,hoverKey:e.hoverKey,isFirst:n===0,isLast:n===(e.item.item??[]).length-1,setHoverKey:e.setHoverKey,onChange:d,onRemove:()=>p(t),onRepeatable:g,onMoveUp:()=>_(n,-1),onMoveDown:()=>_(n,1)})},t.id)),!i&&(0,L.jsx)(`div`,{className:dH.topActions,children:o?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(jb,{size:`xs`,className:dH.linkIdInput,defaultValue:n.linkId,onBlur:e=>m(`linkId`,e.currentTarget.value)}),!i&&(0,L.jsx)(Ig,{size:`xs`,className:dH.typeSelect,defaultValue:n.type,onChange:e=>m(`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`}]})]}):(0,L.jsx)(`div`,{children:a})}),!r&&(0,L.jsx)(z,{className:dH.movementActions,children:(0,L.jsxs)(z,{className:dH.columnAlignment,children:[!e.isFirst&&(0,L.jsx)(Rd,{href:`#`,onClick:t=>{t.preventDefault(),e.onMoveUp&&e.onMoveUp()},children:(0,L.jsx)(gj,{"data-testid":`up-button`,size:15,className:dH.movementIcons})}),!e.isLast&&(0,L.jsx)(Rd,{href:`#`,onClick:t=>{t.preventDefault(),e.onMoveDown&&e.onMoveDown()},children:(0,L.jsx)(hj,{"data-testid":`down-button`,size:15,className:dH.movementIcons})})]})}),(0,L.jsxs)(`div`,{className:dH.bottomActions,children:[i&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Rd,{href:`#`,onClick:e=>{e.preventDefault(),f({id:bH(),linkId:yH(`q`),type:`string`,text:`Question`})},children:`Add item`}),(0,L.jsx)(Rd,{href:`#`,onClick:e=>{e.preventDefault(),f({id:bH(),linkId:yH(`g`),type:`group`,text:`Group`},!0)},children:`Add group`})]}),r&&(0,L.jsx)(Rd,{href:`#`,onClick:e=>{e.preventDefault(),f(wH(),!0)},children:`Add Page`}),o&&!r&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Rd,{href:`#`,onClick:t=>{t.preventDefault(),e.onRepeatable&&e.onRepeatable(n)},children:n.repeats?`Remove Repeatable`:`Make Repeatable`}),(0,L.jsx)(Rd,{href:`#`,onClick:t=>{t.preventDefault(),e.onRemove&&e.onRemove()},children:`Remove`})]})]})]})}function mH(e){let t=uT(`QuestionnaireItemAnswerOption`,`value[x]`),n=e.item.answerOption??[];return(0,L.jsxs)(`div`,{children:[e.item.answerValueSet===void 0?(0,L.jsx)(hH,{options:n,property:t,item:e.item,onChange:e.onChange}):(0,L.jsx)(jb,{placeholder:`Enter Value Set`,defaultValue:e.item.answerValueSet,onChange:t=>e.onChange({...e.item,answerValueSet:t.target.value})}),(0,L.jsxs)(z,{display:`flex`,children:[(0,L.jsx)(Rd,{href:`#`,onClick:t=>{JM(t),e.onChange({...e.item,answerValueSet:void 0,answerOption:[...n,{id:bH()}]})},children:`Add choice`}),(0,L.jsx)(Fy,{w:`lg`}),(0,L.jsx)(Rd,{href:`#`,onClick:t=>{JM(t),e.onChange({...e.item,answerOption:[],answerValueSet:``})},children:`Add value set`})]})]})}function hH(e){return(0,L.jsx)(`div`,{children:e.options.map(t=>{let[n,r]=kI({type:`QuestionnaireItemAnswerOption`,value:t},`value`);return(0,L.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`,alignItems:`center`,width:`80%`},children:[(0,L.jsx)(`div`,{children:(0,L.jsx)(YL,{name:`value[x]`,path:`Questionnaire.answerOption.value[x]`,property:e.property,defaultPropertyType:r,defaultValue:n,onChange:(n,r)=>{let i=[...e.options],a=i.findIndex(e=>e.id===t.id);i[a]={id:t.id,[r]:n},e.onChange({...e.item,answerOption:i})},outcome:void 0},t.id)}),(0,L.jsx)(`div`,{children:(0,L.jsx)(Rd,{href:`#`,onClick:n=>{JM(n),e.onChange({...e.item,answerOption:e.options.filter(e=>e.id!==t.id)})},children:`Remove`})})]},t.id)})})}function gH(e){let t=kA(e.item)??[];return(0,L.jsxs)(L.Fragment,{children:[t.map((n,r)=>(0,L.jsxs)(V,{children:[(0,L.jsx)(YP,{name:`resourceType`,placeholder:`Resource Type`,defaultValue:n,onChange:r=>{e.onChange(AA(e.item,t.map(e=>e===n?r:e)))}}),(0,L.jsx)(Rd,{href:`#`,onClick:r=>{JM(r),e.onChange(AA(e.item,t.filter(e=>e!==n)))},children:`Remove`})]},`${n}-${r}`)),(0,L.jsx)(Rd,{href:`#`,onClick:n=>{JM(n),e.onChange(AA(e.item,[...t,``]))},children:`Add Resource Type`})]})}var _H=1,vH=1;function yH(e){return e+_H++}function bH(){return`id-`+vH++}function xH(e){return{...e,id:e.id||bH(),item:SH(e.item)}}function SH(e){if(e)return e.forEach(e=>{e.id?.match(/^id-\d+$/)&&(vH=Math.max(vH,Number.parseInt(e.id.substring(3),10)+1)),e.linkId?.match(/^q\d+$/)&&(_H=Math.max(_H,Number.parseInt(e.linkId.substring(1),10)+1))}),e.map(e=>({...e,id:e.id||bH(),item:SH(e.item),answerOption:CH(e.answerOption)}))}function CH(e){if(e)return e.map(e=>({...e,id:e.id||bH()}))}function wH(){return{id:bH(),linkId:yH(`s`),type:`group`,text:`New Page`,extension:[{url:rA,valueCodeableConcept:{coding:[{system:`http://hl7.org/fhir/questionnaire-item-control`,code:`page`}]}}]}}function TH(e,t,n){let r=e??[],i=t+n;if(i<0||i>=r.length)return r;let a=[...r];return[a[t],a[i]]=[a[i],a[t]],a}var EH=class{x;y;pressure;time;constructor(e,t,n,r){if(isNaN(e)||isNaN(t))throw 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((this.x-e.x)**2+(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?0:this.distanceTo(e)/(this.time-e.time)}},DH=class e{constructor(e,t,n,r,i,a){this.startPoint=e,this.control2=t,this.control1=n,this.endPoint=r,this.startWidth=i,this.endWidth=a}startPoint;control2;control1;endPoint;startWidth;endWidth;static fromPoints(t,n){let r=this.calculateControlPoints(t[0],t[1],t[2]).c2,i=this.calculateControlPoints(t[1],t[2],t[3]).c1;return new e(t[1],r,i,t[2],n.start,n.end)}static calculateControlPoints(e,t,n){let r=e.x-t.x,i=e.y-t.y,a=t.x-n.x,o=t.y-n.y,s={x:(e.x+t.x)/2,y:(e.y+t.y)/2},c={x:(t.x+n.x)/2,y:(t.y+n.y)/2},l=Math.sqrt(r*r+i*i),u=Math.sqrt(a*a+o*o),d=s.x-c.x,f=s.y-c.y,p=l+u==0?0:u/(l+u),m={x:c.x+d*p,y:c.y+f*p},h=t.x-m.x,g=t.y-m.y;return{c1:new EH(s.x+h,s.y+g),c2:new EH(c.x+h,c.y+g)}}length(){let e=0,t,n;for(let r=0;r<=10;r+=1){let i=r/10,a=this.point(i,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x),o=this.point(i,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y);if(r>0){let r=a-t,i=o-n;e+=Math.sqrt(r*r+i*i)}t=a,n=o}return e}point(e,t,n,r,i){return t*(1-e)*(1-e)*(1-e)+3*n*(1-e)*(1-e)*e+3*r*(1-e)*e*e+i*e*e*e}},OH=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 kH(e,t=250){let n=0,r=null,i,a,o,s=()=>{n=Date.now(),r=null,i=e.apply(a,o),r||(a=null,o=[])};return function(...c){let l=Date.now(),u=t-(l-n);return a=this,o=c,u<=0||u>t?(r&&=(clearTimeout(r),null),n=l,i=e.apply(a,o),r||(a=null,o=[])):r||=window.setTimeout(s,u),i}}var AH=class e extends OH{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?kH(e.prototype._strokeUpdate,this.throttle):e.prototype._strokeUpdate,this._handleMouseDown=this._handleMouseDown.bind(this),this._handleMouseMove=this._handleMouseMove.bind(this),this._handleMouseUp=this._handleMouseUp.bind(this),this._handleTouchStart=this._handleTouchStart.bind(this),this._handleTouchMove=this._handleTouchMove.bind(this),this._handleTouchEnd=this._handleTouchEnd.bind(this),this._handlePointerDown=this._handlePointerDown.bind(this),this._handlePointerMove=this._handlePointerMove.bind(this),this._handlePointerUp=this._handlePointerUp.bind(this),this._handlePointerCancel=this._handlePointerCancel.bind(this),this._handleTouchCancel=this._handleTouchCancel.bind(this),this._ctx=t.getContext(`2d`,this.canvasContextOptions),this.clear(),this.on()}canvas;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(){let{_ctx:e,canvas:t}=this;e.fillStyle=this.backgroundColor,e.clearRect(0,0,t.width,t.height),e.fillRect(0,0,t.width,t.height),this._data=[],this._reset(this._getPointGroupOptions()),this._isEmpty=!0,this._dataUrl=void 0,this._dataUrlOptions=void 0,this._strokePointerId=void 0}redraw(){let e=this._data,t=this._dataUrl,n=this._dataUrlOptions;this.clear(),t&&this.fromDataURL(t,n),this.fromData(e,{clear:!1})}fromDataURL(e,t={}){return new Promise((n,r)=>{let i=new Image,a=t.ratio||window.devicePixelRatio||1,o=t.width||this.canvas.width/a,s=t.height||this.canvas.height/a,c=t.xOffset||0,l=t.yOffset||0;this._reset(this._getPointGroupOptions()),i.onload=()=>{this._ctx.drawImage(i,c,l,o,s),n()},i.onerror=e=>{r(e)},i.crossOrigin=`anonymous`,i.src=e,this._isEmpty=!1,this._dataUrl=e,this._dataUrlOptions={...t}})}toDataURL(e=`image/png`,t){switch(e){case`image/svg+xml`:return typeof t!=`object`&&(t=void 0),`data:image/svg+xml;base64,${btoa(this.toSVG(t))}`;default:return typeof t!=`number`&&(t=void 0),this.canvas.toDataURL(e,t)}}on(){this.canvas.style.touchAction=`none`,this.canvas.style.msTouchAction=`none`,this.canvas.style.userSelect=`none`,this.canvas.style.webkitUserSelect=`none`;let e=/Macintosh/.test(navigator.userAgent)&&`ontouchstart`in document;window.PointerEvent&&!e?this._handlePointerEvents():(this._handleMouseEvents(),`ontouchstart`in window&&this._handleTouchEvents())}off(){this.canvas.style.touchAction=`auto`,this.canvas.style.msTouchAction=`auto`,this.canvas.style.userSelect=`auto`,this.canvas.style.webkitUserSelect=`auto`,this.canvas.removeEventListener(`pointerdown`,this._handlePointerDown),this.canvas.removeEventListener(`mousedown`,this._handleMouseDown),this.canvas.removeEventListener(`touchstart`,this._handleTouchStart),this._removeMoveUpEventListeners()}_getListenerFunctions(){let e=window.document===this.canvas.ownerDocument?window:this.canvas.ownerDocument.defaultView??this.canvas.ownerDocument;return{addEventListener:e.addEventListener.bind(e),removeEventListener:e.removeEventListener.bind(e)}}_removeMoveUpEventListeners(){let{removeEventListener:e}=this._getListenerFunctions();e(`pointermove`,this._handlePointerMove),e(`pointerup`,this._handlePointerUp),e(`pointercancel`,this._handlePointerCancel),e(`mousemove`,this._handleMouseMove),e(`mouseup`,this._handleMouseUp),e(`touchmove`,this._handleTouchMove),e(`touchend`,this._handleTouchEnd),e(`touchcancel`,this._handleTouchCancel)}isEmpty(){return this._isEmpty}fromData(e,{clear:t=!0}={}){t&&this.clear(),this._fromData(e,this._drawCurve.bind(this),this._drawDot.bind(this),this._drawLine.bind(this)),this._data=this._data.concat(e)}toData(){return this._data}_isLeftButtonPressed(e,t){return t?e.buttons===1:(e.buttons&1)==1}_pointerEventToSignatureEvent(e){return{event:e,type:e.type,x:e.clientX,y:e.clientY,pressure:`pressure`in e?e.pressure:0}}_touchEventToSignatureEvent(e){let t=e.changedTouches[0];return{event:e,type:e.type,x:t.clientX,y:t.clientY,pressure:t.force}}_handleMouseDown(e){this._isLeftButtonPressed(e,!0)&&!this._drawingStroke&&this._strokeBegin(this._pointerEventToSignatureEvent(e))}_handleMouseMove(e){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}_handleMouseUp(e){this._isLeftButtonPressed(e)||this._strokeEnd(this._pointerEventToSignatureEvent(e))}_handleTouchStart(e){e.targetTouches.length!==1||this._drawingStroke||(e.cancelable&&e.preventDefault(),this._strokeBegin(this._touchEventToSignatureEvent(e)))}_handleTouchMove(e){if(e.targetTouches.length===1){if(e.cancelable&&e.preventDefault(),!this._drawingStroke){this._strokeEnd(this._touchEventToSignatureEvent(e),!1);return}this._strokeMoveUpdate(this._touchEventToSignatureEvent(e))}}_handleTouchEnd(e){e.targetTouches.length===0&&(e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e)))}_handlePointerCancel(e){this._allowPointerId(e)&&(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e),!1))}_handleTouchCancel(e){e.cancelable&&e.preventDefault(),this._strokeEnd(this._touchEventToSignatureEvent(e),!1)}_getPointerId(e){return e.persistentDeviceId||e.pointerId}_allowPointerId(e,t=!1){return this._strokePointerId===void 0?t:this._getPointerId(e)===this._strokePointerId}_handlePointerDown(e){!this._drawingStroke&&this._isLeftButtonPressed(e)&&this._allowPointerId(e,!0)&&(this._strokePointerId=this._getPointerId(e),e.preventDefault(),this._strokeBegin(this._pointerEventToSignatureEvent(e)))}_handlePointerMove(e){if(this._allowPointerId(e)){if(!this._isLeftButtonPressed(e,!0)||!this._drawingStroke){this._strokeEnd(this._pointerEventToSignatureEvent(e),!1);return}e.preventDefault(),this._strokeMoveUpdate(this._pointerEventToSignatureEvent(e))}}_handlePointerUp(e){!this._isLeftButtonPressed(e)&&this._allowPointerId(e)&&(e.preventDefault(),this._strokeEnd(this._pointerEventToSignatureEvent(e)))}_getPointGroupOptions(e){return{penColor:e&&`penColor`in e?e.penColor:this.penColor,dotSize:e&&`dotSize`in e?e.dotSize:this.dotSize,minWidth:e&&`minWidth`in e?e.minWidth:this.minWidth,maxWidth:e&&`maxWidth`in e?e.maxWidth:this.maxWidth,velocityFilterWeight:e&&`velocityFilterWeight`in e?e.velocityFilterWeight:this.velocityFilterWeight,compositeOperation:e&&`compositeOperation`in e?e.compositeOperation:this.compositeOperation}}_strokeBegin(e){if(!this.dispatchEvent(new CustomEvent(`beginStroke`,{detail:e,cancelable:!0})))return;let{addEventListener:t}=this._getListenerFunctions();switch(e.event.type){case`mousedown`:t(`mousemove`,this._handleMouseMove,{passive:!1}),t(`mouseup`,this._handleMouseUp,{passive:!1});break;case`touchstart`:t(`touchmove`,this._handleTouchMove,{passive:!1}),t(`touchend`,this._handleTouchEnd,{passive:!1}),t(`touchcancel`,this._handleTouchCancel,{passive:!1});break;case`pointerdown`:t(`pointermove`,this._handlePointerMove,{passive:!1}),t(`pointerup`,this._handlePointerUp,{passive:!1}),t(`pointercancel`,this._handlePointerCancel,{passive:!1})}this._drawingStroke=!0;let n=this._getPointGroupOptions(),r={...n,points:[]};this._data.push(r),this._reset(n),this._strokeUpdate(e)}_strokeUpdate(e){if(!this._drawingStroke)return;if(this._data.length===0){this._strokeBegin(e);return}this.dispatchEvent(new CustomEvent(`beforeUpdateStroke`,{detail:e}));let t=this._createPoint(e.x,e.y,e.pressure),n=this._data[this._data.length-1],r=n.points,i=r.length>0&&r[r.length-1],a=i?t.distanceTo(i)<=this.minDistance:!1,o=this._getPointGroupOptions(n);if(!i||!(i&&a)){let e=this._addPoint(t,o);i?e&&this._drawCurve(e,o):this._drawDot(t,o),r.push({time:t.time,x:t.x,y:t.y,pressure:t.pressure})}this.dispatchEvent(new CustomEvent(`afterUpdateStroke`,{detail:e}))}_strokeEnd(e,t=!0){this._removeMoveUpEventListeners(),this._drawingStroke&&(t&&this._strokeUpdate(e),this._drawingStroke=!1,this._strokePointerId=void 0,this.dispatchEvent(new CustomEvent(`endStroke`,{detail:e})))}_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(e){this._lastPoints=[],this._lastVelocity=0,this._lastWidth=(e.minWidth+e.maxWidth)/2,this._ctx.fillStyle=e.penColor,this._ctx.globalCompositeOperation=e.compositeOperation}_createPoint(e,t,n){let r=this.canvas.getBoundingClientRect();return new EH(e-r.left,t-r.top,n,new Date().getTime())}_addPoint(e,t){let{_lastPoints:n}=this;if(n.push(e),n.length>2){n.length===3&&n.unshift(n[0]);let e=this._calculateCurveWidths(n[1],n[2],t),r=DH.fromPoints(n,e);return n.shift(),r}return null}_calculateCurveWidths(e,t,n){let r=n.velocityFilterWeight*t.velocityFrom(e)+(1-n.velocityFilterWeight)*this._lastVelocity,i=this._strokeWidth(r,n),a={end:i,start:this._lastWidth};return this._lastVelocity=r,this._lastWidth=i,a}_strokeWidth(e,t){return Math.max(t.maxWidth/(e+1),t.minWidth)}_drawCurveSegment(e,t,n){let r=this._ctx;r.moveTo(e,t),r.arc(e,t,n,0,2*Math.PI,!1),this._isEmpty=!1}_drawCurve(e,t){let n=this._ctx,r=e.endWidth-e.startWidth,i=Math.ceil(e.length())*2;n.beginPath(),n.fillStyle=t.penColor;for(let n=0;n<i;n+=1){let a=n/i,o=a*a,s=o*a,c=1-a,l=c*c,u=l*c,d=u*e.startPoint.x;d+=3*l*a*e.control1.x,d+=3*c*o*e.control2.x,d+=s*e.endPoint.x;let f=u*e.startPoint.y;f+=3*l*a*e.control1.y,f+=3*c*o*e.control2.y,f+=s*e.endPoint.y;let p=Math.min(e.startWidth+s*r,t.maxWidth);this._drawCurveSegment(d,f,p)}n.closePath(),n.fill()}_getDotSize(e){return e.dotSize>0?e.dotSize:(e.minWidth+e.maxWidth)/2}_drawDot(e,t){let n=this._ctx,r=this._getDotSize(t);n.beginPath(),this._drawCurveSegment(e.x,e.y,r),n.closePath(),n.fillStyle=t.penColor,n.fill()}_drawLine(e,t,n){let r=this._ctx;r.save(),r.beginPath(),r.moveTo(e.x,e.y),r.lineTo(t.x,t.y),r.lineWidth=this._getDotSize(n)*2,r.lineCap=`round`,r.strokeStyle=n.penColor,r.stroke(),r.restore(),this._isEmpty=!1}_fromData(e,t,n,r){for(let i of e){let{points:e}=i,a=this._getPointGroupOptions(i);if(e.length>2)for(let n=0;n<e.length;n+=1){let r=e[n],i=new EH(r.x,r.y,r.pressure,r.time);n===0&&this._reset(a);let o=this._addPoint(i,a);o&&t(o,a)}else e.length===2?(this._reset(a),r(e[0],e[1],a)):(this._reset(a),n(e[0],a))}}toSVG({includeBackgroundColor:e=!1,includeDataUrl:t=!1}={}){let n=this._data,r=Math.max(window.devicePixelRatio||1,1),i=this.canvas.width/r,a=this.canvas.height/r,o=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);if(o.setAttribute(`xmlns`,`http://www.w3.org/2000/svg`),o.setAttribute(`xmlns:xlink`,`http://www.w3.org/1999/xlink`),o.setAttribute(`viewBox`,`0 0 ${i} ${a}`),o.setAttribute(`width`,i.toString()),o.setAttribute(`height`,a.toString()),e&&this.backgroundColor){let e=document.createElement(`rect`);e.setAttribute(`width`,`100%`),e.setAttribute(`height`,`100%`),e.setAttribute(`fill`,this.backgroundColor),o.appendChild(e)}if(t&&this._dataUrl){let e=this._dataUrlOptions?.ratio||window.devicePixelRatio||1,t=this._dataUrlOptions?.width||this.canvas.width/e,n=this._dataUrlOptions?.height||this.canvas.height/e,r=this._dataUrlOptions?.xOffset||0,i=this._dataUrlOptions?.yOffset||0,a=document.createElement(`image`);a.setAttribute(`x`,r.toString()),a.setAttribute(`y`,i.toString()),a.setAttribute(`width`,t.toString()),a.setAttribute(`height`,n.toString()),a.setAttribute(`preserveAspectRatio`,`none`),a.setAttribute(`href`,this._dataUrl),o.appendChild(a)}return this._fromData(n,(e,{penColor:t})=>{let n=document.createElement(`path`);if(!isNaN(e.control1.x)&&!isNaN(e.control1.y)&&!isNaN(e.control2.x)&&!isNaN(e.control2.y)){let r=`M ${e.startPoint.x.toFixed(3)},${e.startPoint.y.toFixed(3)} C ${e.control1.x.toFixed(3)},${e.control1.y.toFixed(3)} ${e.control2.x.toFixed(3)},${e.control2.y.toFixed(3)} ${e.endPoint.x.toFixed(3)},${e.endPoint.y.toFixed(3)}`;n.setAttribute(`d`,r),n.setAttribute(`stroke-width`,(e.endWidth*2.25).toFixed(3)),n.setAttribute(`stroke`,t),n.setAttribute(`fill`,`none`),n.setAttribute(`stroke-linecap`,`round`),o.appendChild(n)}},(e,{penColor:t,dotSize:n,minWidth:r,maxWidth:i})=>{let a=document.createElement(`circle`),s=n>0?n:(r+i)/2;a.setAttribute(`r`,s.toString()),a.setAttribute(`cx`,e.x.toString()),a.setAttribute(`cy`,e.y.toString()),a.setAttribute(`fill`,t),o.appendChild(a)},(e,t,n)=>{let r=document.createElement(`line`);r.setAttribute(`x1`,e.x.toString()),r.setAttribute(`y1`,e.y.toString()),r.setAttribute(`x2`,t.x.toString()),r.setAttribute(`y2`,t.y.toString()),r.setAttribute(`stroke`,n.penColor),r.setAttribute(`stroke-width`,(this._getDotSize(n)*2).toString()),r.setAttribute(`stroke-linecap`,`round`),o.appendChild(r)}),o.outerHTML}};function jH(e){let t=Z(),{width:n=500,height:r=200,defaultValue:i,who:a,onChange:o,...s}=e,c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=Xk(o);(0,b.useEffect)(()=>{function e(){u({type:[{system:Bx+`/fhir/signature-type`,code:`ProofOfOrigin`,display:`Proof of Origin`}],when:new Date().toISOString(),who:a??DC(t.getProfile()),data:l.current?.toDataURL().split(`,`)[1]})}if(c.current){let t=new AH(c.current);i?.data&&t.fromDataURL(i.data).catch(console.error),t.addEventListener(`endStroke`,e),l.current=t}return()=>{l.current&&l.current.removeEventListener(`endStroke`,e)}},[t,i,a,u]);let d=()=>{l.current&&l.current.clear(),u(void 0)};return(0,L.jsxs)(Cl,{withBorder:!0,p:0,w:n,h:r,pos:`relative`,...s,children:[(0,L.jsx)(`canvas`,{ref:c,width:n,height:r,"aria-label":`Signature input area`}),(0,L.jsx)(U,{onClick:d,"aria-label":`Clear signature`,pos:`absolute`,top:0,right:0,size:`xs`,leftSection:(0,L.jsx)(RM,{size:16}),variant:`subtle`,color:`gray`,children:`Clear`})]})}function MH(e){let t=[...e.context,e.responseItem];return(0,L.jsxs)(`div`,{children:[e.item.text&&(0,L.jsx)(K,{order:4,mb:`md`,children:e.item.text}),(0,L.jsx)(FH,{formState:e.formState,context:t,items:e.item.item??[],responseItems:e.responseItem.item??[]})]},e.item.linkId)}function NH(e){return(0,L.jsxs)(L.Fragment,{children:[e.responseItems.map(t=>(0,L.jsx)(MH,{formState:e.formState,context:e.context,item:e.item,responseItem:t},`group-${t.id}`)),(0,L.jsx)(Rd,{onClick:()=>e.formState.onAddGroup(e.context,e.item),children:`Add Group: ${e.item.text}`})]})}function PH(e){let{formState:t,context:n,item:r,responseItem:i}=e,a=r.type===nA.choice||r.type===nA.openChoice,o=!a,s=!a&&i.answer&&i.answer.length>0?i.answer:[{}];return(0,L.jsxs)(eL,{title:e.item.text,withAsterisk:e.item.required,children:[(0,L.jsx)(W,{gap:`xs`,children:s?.map((e,a)=>(0,L.jsx)(XV,{formState:t,context:n,item:r,responseItem:i,index:a},`${r.linkId}-${a}`))}),o&&(0,L.jsx)(Rd,{onClick:()=>t.onAddAnswer(n,r),children:`Add Item`})]},e.item.linkId)}function FH(e){let{formState:t,context:n,items:r,responseItems:i}=e,a=n.length===0,o=!1;return(0,L.jsx)(W,{gap:`xl`,children:r.map((e,r)=>{if(!gA(e,t.questionnaireResponse))return null;let s=e.type===nA.group,c=a&&s&&o;if(s&&(o=!0),e.type===nA.display)return(0,L.jsx)(`p`,{children:e.text},`display-${e.id}-${r}`);let l=i.filter(t=>t.linkId===e.linkId);return e.type===nA.group&&e.repeats?(0,L.jsxs)(b.Fragment,{children:[c&&(0,L.jsx)(hm,{color:`var(--mantine-color-gray-2)`}),(0,L.jsx)(NH,{formState:t,context:n,item:e,responseItems:l})]},`repeating-group-${e.id}-${r}`):e.type===nA.group?(0,L.jsxs)(b.Fragment,{children:[c&&(0,L.jsx)(hm,{color:`var(--mantine-color-gray-2)`}),(0,L.jsx)(MH,{formState:t,context:n,item:e,responseItem:l[0]})]},`group-${e.id}-${r}`):e.type===nA.boolean?(0,L.jsx)(XV,{formState:t,context:n,item:e,responseItem:l[0],index:0},`boolean-item-${e.id}-${r}`):e.repeats?(0,L.jsx)(PH,{formState:t,context:n,item:e,responseItem:l[0]},`repeating-item-${e.id}-${r}`):(0,L.jsx)(eL,{htmlFor:e.linkId,title:e.text,withAsterisk:e.required,children:(0,L.jsx)(XV,{formState:t,context:n,item:e,responseItem:l[0],index:0})},`repeating-item-${e.id}-${r}`)})})}function IH(e){let{formState:t,submitButtonText:n,excludeButtons:r,children:i}=e,a=t.pages,o=t.activePage,s=o>0,c=o<a.length-1,l=o===a.length-1;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Jy,{active:o,allowNextStepsSelect:!1,p:6,children:a.map((e,t)=>(0,L.jsx)(Jy.Step,{label:e.title,children:t===o&&i},e.linkId))}),!r&&(0,L.jsxs)(V,{justify:`flex-end`,mt:`xl`,gap:`xs`,children:[s&&(0,L.jsx)(U,{onClick:t.onPrevPage,children:`Back`}),c&&(0,L.jsx)(U,{onClick:e=>{e.currentTarget.closest(`form`).reportValidity()&&t.onNextPage()},children:`Next`}),l&&(0,L.jsx)(PP,{children:n??`Submit`})]})]})}function LH(e){let t=Z(),[n,r]=(0,b.useState)(!1),i=(0,b.useRef)(e),a=(0,b.useRef)(void 0);(0,b.useLayoutEffect)(()=>{i.current=e});let o=(0,b.useCallback)(e=>{a.current=e},[]),s=HA({questionnaire:e.questionnaire,defaultValue:e.questionnaireResponse,subject:e.subject,encounter:e.encounter,source:e.source,disablePagination:e.disablePagination,onChange:o}),c=(0,b.useRef)(s);(0,b.useLayoutEffect)(()=>{c.current=s}),(0,b.useEffect)(()=>{let e=a.current;e&&(a.current=void 0,r(!1),i.current.onChange?.(e))});let l=(0,b.useMemo)(()=>!s.loading&&!!BC(s.questionnaire,lA),[s]),u=(0,b.useMemo)(()=>!s.loading&&!!s.questionnaireResponse.extension?.find(e=>e.url===uA),[s]),d=(0,b.useCallback)(()=>{let e=c.current;if(e.loading)return;let n=i.current.onSubmit;if(!n)return;if(l&&!u){r(!0);return}let a=e.questionnaire,o=e.questionnaireResponse,s=i.current.subject,d=i.current.source;if(!d){let e=t.getProfile();e&&(d=DC(e))}n({...o,questionnaire:a.url??OC(a),subject:s,source:d,authored:new Date().toISOString(),status:`completed`})},[t,l,u]);return s.loading?null:(0,L.jsxs)(NP,{testid:`questionnaire-form`,onSubmit:d,children:[s.questionnaire.title&&(0,L.jsx)(K,{order:1,fz:`1.625rem`,fw:700,lh:1.3,mb:`xl`,children:s.questionnaire.title}),e.afterHeader&&(0,L.jsxs)(W,{gap:`xl`,mb:`xl`,children:[e.afterHeader,(0,L.jsx)(hm,{color:`var(--mantine-color-gray-2)`})]}),s.pagination?(0,L.jsx)(IH,{formState:s,submitButtonText:e.submitButtonText,excludeButtons:e.excludeButtons,children:(0,L.jsx)(FH,{formState:s,context:[],items:s.items,responseItems:s.responseItems})}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(FH,{formState:s,context:[],items:s.items,responseItems:s.responseItems}),l&&(0,L.jsxs)(W,{mt:`md`,gap:0,children:[(0,L.jsx)(H,{size:`sm`,fw:500,children:`Signature`}),(0,L.jsx)(jH,{onChange:s.onChangeSignature}),!u&&n&&(0,L.jsx)(H,{c:`red`,size:`sm`,children:`Signature is required.`})]}),!e.excludeButtons&&(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,gap:`xs`,children:(0,L.jsx)(PP,{children:e.submitButtonText??`Submit`})})]})]})}var RH={section:`_section_4m5it_1`},zH=[`gender`,`age`,`gestationalAge`,`context`,`appliesTo`,`category`],BH={definition:{resourceType:`ObservationDefinition`,code:{text:``}},onSubmit:()=>{}};function VH(e){e=Object.assign(BH,e);let t=e.definition,[n,r]=(0,b.useState)([]),[i,a]=(0,b.useState)(1),[o,s]=(0,b.useState)(1);return(0,b.useEffect)(()=>{let e=WH(t,s);r(GH(e.qualifiedInterval||[],a))},[t]),(0,L.jsxs)(NP,{testid:`reference-range-editor`,onSubmit:c,children:[(0,L.jsx)(W,{children:n.map(e=>(0,L.jsx)(HH,{unit:qH(t.quantitativeDetails?.unit),onChange:d,onAdd:f,onRemove:p,onRemoveGroup:u,intervalGroup:e},`group-${e.id}`))}),(0,L.jsx)(bu,{title:`Add Group`,variant:`subtle`,size:`sm`,onClick:e=>{JM(e),l({id:`group-id-${i}`,filters:{},intervals:[]}),a(e=>e+1)},children:(0,L.jsx)(Ij,{})}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(PP,{children:`Save`})})]});function c(){let r=n.flatMap(e=>e.intervals).filter(e=>!JH(e));e.onSubmit({...t,qualifiedInterval:r})}function l(e){r(t=>[...t,e])}function u(e){r(t=>t.filter(t=>t.id!==e.id))}function d(e,t){r(n=>{n=[...n];let r=n.find(t=>t.id===e),i=r?.intervals.findIndex(e=>e.id===t.id);return i!==void 0&&r?.intervals[i]&&(r.intervals[i]=t),n})}function f(e,t){t.id===void 0&&(t.id=`id-${o}`,s(e=>e+1)),r(n=>{n=[...n];let r=n.findIndex(t=>t.id===e);if(r!==-1){let e={...n[r]};t={...t,...e.filters},e.intervals=[...e.intervals,t],n[r]=e}return n})}function p(e,t){r(n=>{n=[...n];let r=n.find(t=>t.id===e);return r&&(r.intervals=r.intervals.filter(e=>e.id!==t.id)),n})}}function HH(e){let{intervalGroup:t,unit:n}=e;return(0,L.jsx)(PF,{"data-testid":t.id,className:RH.section,children:(0,L.jsxs)(W,{gap:`lg`,children:[(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(bu,{title:`Remove Group`,variant:`subtle`,"data-testid":`remove-group-button-${t.id}`,size:`sm`,onClick:n=>{JM(n),e.onRemoveGroup(t)},children:(0,L.jsx)(Fj,{})},`remove-group-button-${t.id}`)}),(0,L.jsx)(UH,{intervalGroup:t,onChange:e.onChange}),(0,L.jsx)(hm,{}),t.intervals.map(n=>(0,L.jsxs)(W,{gap:`xs`,children:[(0,L.jsxs)(V,{children:[(0,L.jsx)(jb,{"data-testid":`condition-${n.id}`,defaultValue:n.condition,label:`Condition: `,size:`sm`,onChange:r=>{JM(r),e.onChange(t.id,{...n,condition:r.currentTarget.value.trim()})}},`condition-${n.id}`),(0,L.jsx)(bu,{title:`Remove Interval`,variant:`subtle`,size:`sm`,"data-testid":`remove-interval-${n.id}`,onClick:r=>{JM(r),e.onRemove(t.id,n)},children:(0,L.jsx)(Fj,{})},`remove-interval-${n.id}`)]}),(0,L.jsx)(CL,{path:``,onChange:r=>{e.onChange(t.id,{...n,range:r})},name:`range-${n.id}`,defaultValue:n.range},`range-${n.id}`)]},`interval-${n.id}`)),(0,L.jsx)(bu,{title:`Add Interval`,variant:`subtle`,size:`sm`,onClick:r=>{JM(r),e.onAdd(t.id,{range:{low:{unit:n},high:{unit:n}}})},children:(0,L.jsx)(Ij,{})})]})})}function UH(e){let{intervalGroup:t,onChange:n}=e,r=t.filters.age??{},i={low:r.low?.unit?r.low:{...r.low,unit:`years`,system:`http://unitsofmeasure.org`},high:r.high?.unit?r.high:{...r.high,unit:`years`,system:`http://unitsofmeasure.org`}};return(0,L.jsxs)(W,{style:{maxWidth:`50%`},children:[(0,L.jsx)(V,{children:(0,L.jsx)(Ig,{data:[``,`male`,`female`],label:`Gender:`,defaultValue:t.filters.gender||``,onChange:e=>{for(let r of t.intervals){let i=e.currentTarget.value;i===``&&(i=void 0),n(t.id,{...r,gender:i})}}})}),(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(H,{component:`label`,htmlFor:`div-age-${t.id}`,children:`Age:`}),(0,L.jsx)(`div`,{id:`div-age-${t.id}`,children:(0,L.jsx)(CL,{path:``,name:`age-${t.id}`,defaultValue:i,onChange:e=>{for(let r of t.intervals)n(t.id,{...r,age:e})}},`age-${t.id}`)})]}),(0,L.jsx)(Ig,{data:[``,`pre-puberty`,`follicular`,`midcycle`,`luteal`,`postmenopausal`],label:`Endocrine:`,defaultValue:t.filters.context?.text||``,onChange:e=>{for(let r of t.intervals){let i=e.currentTarget.value;i===``?(i=void 0,n(t.id,{...r,context:void 0})):n(t.id,{...r,context:{text:i,coding:[{code:i,system:`http://terminology.hl7.org/CodeSystem/referencerange-meaning`}]}})}}}),(0,L.jsx)(Ig,{data:[``,`reference`,`critical`,`absolute`],label:`Category: `,defaultValue:t.filters.category,onChange:e=>{for(let r of t.intervals){let i=e.currentTarget.value;i===``?n(t.id,{...r,category:void 0}):n(t.id,{...r,category:i})}}})]})}function WH(e,t){let n=e.qualifiedInterval||[],r=Math.max(...n.map(e=>{let t=Number.parseInt(e.id?.substring(3)||``,10);return Number.isNaN(t)?-1/0:t}))+1;return Number.isFinite(r)||(r=1),e={...e,qualifiedInterval:n.map(e=>({...e,id:e.id||`id-${r++}`}))},t(r),e}function GH(e,t){let n=1,r={};for(let t of e){let e=KH(t);e in r||(r[e]={id:`group-id-${n++}`,filters:Object.fromEntries(zH.map(e=>[e,t[e]])),intervals:[]}),r[e].intervals.push(t)}return t(n),Object.values(r)}function KH(e){return[`gender=${e.gender}`,`age=${Vw(e.age)}`,`gestationalAge=${Vw(e.gestationalAge)}`,`context=${e.context?.text}`,`appliesTo=${e.appliesTo?.map(e=>e.text).join(`+`)}`,`category=${e.category}`].join(`:`)}function qH(e){return e&&(mw(e,`http://unitsofmeasure.org`)||e.text)}function JH(e){return e.range?.low?.value===void 0&&e.range?.high?.value===void 0}function YH(e){let t=Z(),n=eA(e.value),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)();return(0,b.useEffect)(()=>{n&&!r&&(t.executeBatch(s(n)).then(o).catch(console.log),i(!0))},[t,n,r]),!n||!a?null:(0,L.jsx)(km,{children:n.action?.map((t,n)=>{let r=t.resource&&c(t.resource),i=r?.input?.[0]?.valueReference,a=r?.output?.[0]?.valueReference;return(0,L.jsxs)(b.Fragment,{children:[(0,L.jsx)(km.Col,{span:1,p:`md`,children:r?.status===`completed`?(0,L.jsx)(Mj,{}):(0,L.jsx)(jM,{color:`gray`})}),(0,L.jsxs)(km.Col,{span:9,p:`xs`,children:[(0,L.jsx)(H,{fw:500,children:t.title}),t.description&&(0,L.jsx)(`div`,{children:t.description}),(0,L.jsxs)(`div`,{children:[`Last edited by\xA0`,(0,L.jsx)(uR,{value:r?.meta?.author}),`\xA0on\xA0`,Pw(r?.meta?.lastUpdated)]}),(0,L.jsxs)(`div`,{children:[`Status: `,(0,L.jsx)(sR,{status:r?.status||`unknown`})]})]}),(0,L.jsxs)(km.Col,{span:2,p:`md`,children:[i&&!a&&(0,L.jsx)(U,{onClick:()=>e.onStart(r,i),children:`Start`}),i&&a&&(0,L.jsx)(U,{onClick:()=>e.onEdit(r,i,a),children:`Edit`})]})]},`action-${n}`)})});function s(e){let t=[];if(e.action)for(let n of e.action)n.resource?.reference&&t.push({request:{method:`GET`,url:n.resource.reference}});return{resourceType:`Bundle`,type:`batch`,entry:t}}function c(e){for(let t of a?.entry??[])if(t.resource&&e.reference===OC(t.resource))return t.resource}}function XH(e,t){return QH(ZH(e,t),e,t)}function ZH(e,t){let n=e.length,r=t.length,i=n+r+1,a=1+2*i,o=Math.trunc(a/2),s=Array(a);s[o+1]={i:0,j:-1,prev:void 0,snake:!0};for(let a=0;a<i;a++){for(let i=-a;i<=a;i+=2){let c=o+i,l=c+1,u=c-1,d=s[l],f=s[u],p,m=0;i===-a||i!==a&&f.i<d.i?(m=d.i,p=d):(m=f.i+1,p=f),s[u]=void 0;let h=m-i,g={i:m,j:h,prev:$H(p),snake:!1};for(;m<n&&h<r&&e[m]===t[h];)m++,h++;if(m>g.i&&(g={i:m,j:h,prev:g,snake:!0}),s[c]=g,m>=n&&h>=r)return s[c]}s[o+a-1]=void 0}}function QH(e,t,n){let r=[],i=e;for(i.snake&&(i=i.prev);i?.prev&&i.prev.j>=0;){let e=i.i,a=i.j;i=i.prev;let o=i.i,s=i.j,c={position:o,lines:t.slice(o,e)},l={position:s,lines:n.slice(s,a)},u;u=c.lines.length===0&&l.lines.length>0?`insert`:c.lines.length>0&&l.lines.length===0?`delete`:`change`,r.push({original:c,revised:l,type:u}),i.snake&&(i=i.prev)}return r}function $H(e){return e&&!e.snake&&e.prev?e.prev:e}function eU(e){let t=(e.entry??[]).filter(e=>!!e.resource).map(e=>({meta:e.resource?.meta,lines:VC(e.resource,!0).match(/[^\r\n]+/g)})).sort((e,t)=>e.meta.lastUpdated.localeCompare(t.meta.lastUpdated));if(!t.length)return[];let n=t[0].lines.map(e=>({id:t[0].meta.versionId,meta:t[0].meta,value:e,span:1}));return tU(n,t),nU(n),n}function tU(e,t){for(let n=1;n<t.length;n++){let r=XH(t[n-1].lines,t[n].lines);for(let i of r){let r=i.original.position,a=i.original.lines,o=i.revised.lines;if((i.type===`delete`||i.type===`change`)&&e.splice(r,a.length),i.type===`insert`||i.type===`change`)for(let a=0;a<i.revised.lines.length;a++)e.splice(r+a,0,{id:t[n].meta.versionId,meta:t[n].meta,value:o[a],span:1})}}}function nU(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}}var rU={container:`_container_1pz0t_1`,root:`_root_1pz0t_5`,startRow:`_startRow_1pz0t_20`,normalRow:`_normalRow_1pz0t_25`,author:`_author_1pz0t_30`,onBehalfOf:`_onBehalfOf_1pz0t_34`,dateTime:`_dateTime_1pz0t_40`,lineNumber:`_lineNumber_1pz0t_46`,line:`_line_1pz0t_46`,pre:`_pre_1pz0t_61`};function iU(e,t){return`/${e.resourceType}/${e.id}/_history/${t}`}function aU(e){let t=Math.floor((Date.now()-Date.parse(e))/1e3),n=Math.floor(t/31536e3);if(n>0)return oU(n,`year`);let r=Math.floor(t/2592e3);if(r>0)return oU(r,`month`);let i=Math.floor(t/86400);if(i>0)return oU(i,`day`);let a=Math.floor(t/3600);if(a>0)return oU(a,`hour`);let o=Math.floor(t/60);return o>0?oU(o,`minute`):oU(t,`second`)}function oU(e,t){return`${e} ${e===1?t:t+`s`} ago`}function sU(e){let t=Z(),[n,r]=(0,b.useState)(e.history);if((0,b.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(0,L.jsx)(`div`,{children:`Loading...`});let i=n.entry?.[0]?.resource;if(!i)return null;let a=eU(n);return(0,L.jsx)(`div`,{className:rU.container,children:(0,L.jsx)(`table`,{className:rU.root,children:(0,L.jsx)(`tbody`,{children:a.map((e,t)=>(0,L.jsxs)(`tr`,{className:e.span>0?rU.startRow:rU.normalRow,children:[e.span>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`td`,{className:rU.author,rowSpan:e.span,children:[(0,L.jsx)(uR,{value:e.meta.author,link:!0,fz:`xs`}),e.meta.onBehalfOf&&(0,L.jsxs)(`div`,{className:rU.onBehalfOf,children:[`on behalf of `,(0,L.jsx)(uR,{value:e.meta.onBehalfOf,link:!0,fz:`xs`,c:`dimmed`})]})]}),(0,L.jsx)(`td`,{className:rU.dateTime,rowSpan:e.span,children:(0,L.jsx)(eN,{to:iU(i,e.meta.versionId),fz:`xs`,children:aU(e.meta.lastUpdated)})})]}),(0,L.jsx)(`td`,{className:rU.lineNumber,children:t+1}),(0,L.jsx)(`td`,{className:rU.line,children:(0,L.jsx)(`pre`,{className:rU.pre,children:e.value})})]},`row-`+t))})})})}var cU={removed:`_removed_el5zk_1`,added:`_added_el5zk_6`};function lU(e){let t=e.original,n=e.revised;e.ignoreMeta&&(t={...t,meta:void 0},n={...n,meta:void 0});let r=XH(VC(t,!0).match(/[^\r\n]+/g)??[`{`,`}`],VC(n,!0).match(/[^\r\n]+/g)??[`{`,`}`]);return(0,L.jsx)(`pre`,{style:{color:`gray`},children:r.map((e,t)=>(0,L.jsx)(uU,{delta:e},`delta`+t))})}function uU(e){return(0,L.jsxs)(L.Fragment,{children:[`...`,(0,L.jsx)(`br`,{}),e.delta.original.lines.length>0&&(0,L.jsx)(`div`,{className:cU.removed,children:e.delta.original.lines.join(`
|
|
209
|
+
`)}),e.delta.revised.lines.length>0&&(0,L.jsx)(`div`,{className:cU.added,children:e.delta.revised.lines.join(`
|
|
210
|
+
`)}),`...`,(0,L.jsx)(`br`,{})]})}var dU={splitButton:`_splitButton_1i0gi_1`,menuControl:`_menuControl_1i0gi_6`};function fU(e){let{outcome:t}=e,n=Z(),r=eA(e.defaultValue),i=r?.resourceType,[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(),l=n.getAccessPolicy(),u=Dr();(0,b.useEffect)(()=>{if(r){if(e.profileUrl){let t=e.profileUrl;n.requestProfileSchema(e.profileUrl,{expandProfile:!0}).then(()=>{let e=RS(t);if(e){o(!0);let t=KO(r,e);c(t)}else console.error(`Schema not found for ${t}`)}).catch(e=>{console.error(`Error in requestProfileSchema`,e)})}else n.requestSchema(i).then(()=>{c(r),o(!0)}).catch(console.log)}},[n,r,i,e.profileUrl]);let d=(0,b.useMemo)(()=>r&&aD(r,tD.READ,l),[l,r]),f=(0,b.useMemo)(()=>n.isSuperAdmin()||!l||!KC(s?.resourceType)?!0:rD(l,s?.resourceType),[n,l,s?.resourceType]);return!a||!s?(0,L.jsx)(`div`,{children:`Loading...`}):f?(0,L.jsxs)(`form`,{id:e.formId,noValidate:!0,autoComplete:`off`,onSubmit:t=>{t.preventDefault(),e.onSubmit&&e.onSubmit(s)},children:[(0,L.jsxs)(W,{mb:`xl`,children:[(0,L.jsx)(eL,{title:`Resource Type`,htmlFor:`resourceType`,outcome:t,children:(0,L.jsx)(jb,{name:`resourceType`,defaultValue:s.resourceType,disabled:!0})}),(0,L.jsx)(eL,{title:`ID`,htmlFor:`id`,outcome:t,children:(0,L.jsx)(jb,{name:`id`,defaultValue:s.id,disabled:!0})})]}),(0,L.jsx)(nR,{path:s.resourceType,valuePath:s.resourceType,typeName:i,defaultValue:s,outcome:t,onChange:c,profileUrl:e.profileUrl,accessPolicyResource:d}),!e.hideSubmitButton&&(0,L.jsxs)(V,{justify:`flex-end`,mt:`xl`,wrap:`nowrap`,gap:0,children:[(0,L.jsx)(U,{type:`submit`,className:Ln((e.onPatch||e.onDelete)&&dU.splitButton),children:r?.id?`Update`:`Create`}),(e.onPatch||e.onDelete)&&(0,L.jsxs)(Xh,{transitionProps:{transition:`pop`},position:`bottom-end`,withinPortal:!0,children:[(0,L.jsx)(Xh.Target,{children:(0,L.jsx)(bu,{variant:`filled`,color:u.primaryColor,size:36,className:dU.menuControl,"aria-label":`More actions`,children:(0,L.jsx)(Nj,{size:14,stroke:1.5})})}),(0,L.jsxs)(Xh.Dropdown,{children:[e.onPatch&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(Gj,{size:14,stroke:1.5}),onClick:()=>{e.onPatch(s)},children:`Patch`}),e.onDelete&&(0,L.jsx)(Xh.Item,{color:`red`,leftSection:(0,L.jsx)(RM,{size:14,stroke:1.5,color:`red`}),onClick:()=>{e.onDelete(s)},children:`Delete`})]})]})]})]}):(0,L.jsxs)(jd,{color:`red`,title:`Permission denied`,icon:(0,L.jsx)(pj,{}),children:[`Your access level prevents you from editing and creating `,s.resourceType,` resources.`]})}function pU(e){let t=Z(),[n,r]=(0,b.useState)(e.history);return(0,b.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?(0,L.jsxs)(G,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Author`}),(0,L.jsx)(G.Th,{children:`On Behalf Of`}),(0,L.jsx)(G.Th,{children:`Date`}),(0,L.jsx)(G.Th,{children:`Version`})]})}),(0,L.jsx)(G.Tbody,{children:n.entry?.map((e,t)=>(0,L.jsx)(mU,{entry:e},`entry-`+t))})]}):(0,L.jsx)(`div`,{children:`Loading...`})}function mU(e){let{response:t,resource:n}=e.entry;return n?(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:(0,L.jsx)(dR,{value:n.meta?.author,link:!0})}),(0,L.jsx)(G.Td,{children:n.meta?.onBehalfOf&&(0,L.jsx)(dR,{value:n.meta.onBehalfOf,link:!0})}),(0,L.jsx)(G.Td,{children:Pw(n.meta?.lastUpdated)}),(0,L.jsx)(G.Td,{children:(0,L.jsx)(eN,{to:hU(n),children:n.meta?.versionId})})]}):(0,L.jsx)(G.Tr,{children:(0,L.jsx)(G.Td,{colSpan:4,children:J(t?.outcome)})})}function hU(e){return`/${e.resourceType}/${e.id}/_history/${e.meta?.versionId}`}var gU=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,_U=/^[\\/]{2}/;function vU(e,t){return t+e.replace(/\\/g,`/`)}var yU=`popstate`;function bU(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function xU(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return EU(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:DU(t)}return kU(t,n,null,e)}function SU(e,t){if(e===!1||e==null)throw Error(t)}function CU(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function wU(){return Math.random().toString(36).substring(2,10)}function TU(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function EU(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?OU(t):t,state:n,key:t&&t.key||r||wU(),mask:i}}function DU({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 OU(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 kU(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=bU(e)?e:EU(h.location,e,t);n&&n(r,e),l=u()+1;let d=TU(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=bU(e)?e:EU(h.location,e,t);n&&n(r,e),l=u();let i=TU(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return AU(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(yU,d),c=e,()=>{i.removeEventListener(yU,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function AU(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),SU(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:DU(t);return i=i.replace(/ $/,`%20`),!n&&_U.test(i)&&(i=r+i),new URL(i,r)}var jU=class{#e=new Map;constructor(e){if(e)for(let[t,n]of e)this.set(t,n)}get(e){if(this.#e.has(e))return this.#e.get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){this.#e.set(e,t)}},MU=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function NU(e){return MU.has(e)}var PU=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function FU(e){return PU.has(e)}function IU(e){return e.index===!0}function LU(e){let t={};return e.Component&&Object.assign(t,{element:b.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:b.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:b.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function RU(e,t=LU,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(SU(e.index!==!0||!e.children,`Cannot specify children on an index route`),SU(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),IU(e)){let n={...e,id:s};return r[s]=zU(n,t(n)),n}{let n={...e,id:s,children:void 0};return r[s]=zU(n,t(n)),e.children&&(n.children=RU(e.children,t,o,r,i)),n}})}function zU(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function BU(e,t,n=`/`){return VU(e,t,n,!1)}function VU(e,t,n,r,i){let a=lW((typeof t==`string`?OU(t):t).pathname||`/`,n);if(a==null)return null;let o=i??UU(e),s=null,c=cW(a);for(let e=0;s==null&&e<o.length;++e)s=iW(o[e],c,r);return s}function HU(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,loaderData:t[n.id],handle:n.handle}}function UU(e){let t=WU(e);return KU(t),t}function WU(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;SU(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=yW([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(SU(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),WU(e.children,t,u,l,o)),(e.path!=null||e.index)&&t.push({path:l,score:nW(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=sW(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of GU(e.path))a(e,t,!0,n)}),t}function GU(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=GU(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function KU(e){e.sort((e,t)=>e.score===t.score?rW(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var qU=/^:[\w-]+$/,JU=/^:[\w-]+/,YU=3.5,XU=3,ZU=2,QU=1,$U=10,eW=-2,tW=e=>e===`*`;function nW(e,t){let n=e.split(`/`),r=n.length;return n.some(tW)&&(r+=eW),t&&(r+=ZU),n.filter(e=>!tW(e)).reduce((e,t)=>e+(qU.test(t)?XU:JU.test(t)?YU:t===``?QU:$U),r)}function rW(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function iW(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?oW(u,l,s.matcher,s.compiledParams):aW(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=aW({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:yW([a,d.pathname]),pathnameBase:xW(yW([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=yW([a,d.pathnameBase]))}return o}function aW(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=sW(e.path,e.caseSensitive,e.end);return oW(e,t,n,r)}function oW(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return e[t]=n&&!i?void 0:(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function sW(e,t=!1,n=!0){CU(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=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function cW(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return CU(!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 lW(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 uW({basename:e,pathname:t}){return t===`/`?e:yW([e,t])}var dW=e=>gU.test(e);function fW(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?OU(e):e,a;return n?(n=vW(n),a=n.startsWith(`/`)?pW(n.substring(1),`/`):pW(n,t)):a=t,{pathname:a,search:SW(r),hash:CW(i)}}function pW(e,t){let n=bW(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function mW(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 hW(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function gW(e){let t=hW(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function _W(e,t,n,r=!1){let i;typeof e==`string`?i=OU(e):(i={...e},SU(!i.pathname||!i.pathname.includes(`?`),mW(`?`,`pathname`,`search`,i)),SU(!i.pathname||!i.pathname.includes(`#`),mW(`#`,`pathname`,`hash`,i)),SU(!i.search||!i.search.includes(`#`),mW(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=fW(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var vW=e=>e.replace(/[\\/]{2,}/g,`/`),yW=e=>vW(e.join(`/`)),bW=e=>e.replace(/\/+$/,``),xW=e=>bW(e).replace(/^\/*/,`/`),SW=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,CW=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,wW=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],TW=class{status;statusText;data;error;internal;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 EW(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function DW(e){return yW(e.map(e=>e.route.path).filter(Boolean))||`/`}function OW(e,t){let n=new URL(typeof e==`string`||e instanceof URL?e:e.url),r=typeof t==`string`?OU(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);let i=e.toString();n.search=i?`?${i}`:``}else n.search=``;return n.hash=r.hash||``,n}var kW=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function AW(e,t){let n=e;if(typeof n!=`string`||!gU.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(kW)try{let e=new URL(window.location.href),r=_U.test(n)?new URL(vU(n,e.protocol)):new URL(n),a=lW(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{CU(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var jW=Symbol(`Uninstrumented`),MW=new WeakMap;function NW(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){e.lazy!=null&&n.lazy.push(e.lazy),e[`lazy.loader`]!=null&&n[`lazy.loader`].push(e[`lazy.loader`]),e[`lazy.action`]!=null&&n[`lazy.action`].push(e[`lazy.action`]),e[`lazy.middleware`]!=null&&n[`lazy.middleware`].push(e[`lazy.middleware`]),e.middleware!=null&&n.middleware.push(e.middleware),e.loader!=null&&n.loader.push(e.loader),e.action!=null&&n.action.push(e.action)}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=t.lazy;r.lazy=async(...t)=>zW(await BW(n.lazy,void 0,()=>e(...t),VW))}if(typeof t.lazy==`object`){let e=t.lazy;if(typeof e.middleware==`function`&&n[`lazy.middleware`].length>0){let t=e.middleware;r.lazy=Object.assign(r.lazy||{},{middleware:async(...e)=>zW(await BW(n[`lazy.middleware`],void 0,()=>t(...e),VW))})}if(typeof e.loader==`function`&&n[`lazy.loader`].length>0){let t=e.loader;r.lazy=Object.assign(r.lazy||{},{loader:async(...e)=>zW(await BW(n[`lazy.loader`],void 0,()=>t(...e),VW))})}if(typeof e.action==`function`&&n[`lazy.action`].length>0){let t=e.action;r.lazy=Object.assign(r.lazy||{},{action:async(...e)=>zW(await BW(n[`lazy.action`],void 0,()=>t(...e),VW))})}}if(typeof t.loader==`function`&&n.loader.length>0){let e=FW(t.loader),i=async(...t)=>zW(await BW(n.loader,HW(t[0]),()=>e(...t),VW));e.hydrate===!0&&(i.hydrate=!0),IW(i,e),r.loader=i}if(typeof t.action==`function`&&n.action.length>0){let e=FW(t.action),i=async(...t)=>zW(await BW(n.action,HW(t[0]),()=>e(...t),VW));IW(i,e),r.action=i}return t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=FW(e),r=async(...e)=>zW(await BW(n.middleware,HW(e[0]),()=>t(...e),VW));return IW(r,t),r})),r}function PW(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){e.navigate!=null&&n.navigate.push(e.navigate),e.fetch!=null&&n.fetch.push(e.fetch)}})),n.navigate.length>0){let t=FW(e.navigate),r=async(...r)=>{let[i,a]=r,o,s={to:typeof i==`number`||typeof i==`string`?i:i?DU(i):`.`,...UW(e,a??{})};return zW(await BW(n.navigate,s,async()=>{if(typeof i==`number`)return await t(...r);let n=LW(e,e=>{o=e});try{return await t(...r)}finally{n()}},e=>({...VW(e),meta:o})))};IW(r,t),e.navigate=r}if(n.fetch.length>0){let t=FW(e.fetch),r=async(...r)=>{let[i,a,o,s]=r,c;return zW(await BW(n.fetch,{href:o??`.`,fetcherKey:i,...UW(e,s??{})},async()=>{let n=LW(e,e=>{c=e});try{return await t(...r)}finally{n()}},e=>({...VW(e),meta:c})))};IW(r,t),e.fetch=r}return e}function FW(e){return e[jW]??e}function IW(e,t){e[jW]=t}function LW(e,t){return MW.set(e,t),()=>{MW.get(e)===t&&MW.delete(e)}}function RW(e){let t=MW.get(e);return MW.delete(e),t}function zW(e){if(e.type===`error`)throw e.value;return e.value}async function BW(e,t,n,r,i={result:null,innerResult:null},a=e.length-1){let o=e[a];if(o){let s,c=async()=>(s?console.error(`You cannot call instrumented handlers more than once`):s=BW(e,t,n,r,i,a-1),await s,SU(i.innerResult,`Expected an inner result`),i.innerResult);try{await o(c,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}s||await c(),await s}else{try{i.result={type:`success`,value:await n()}}catch(e){i.result={type:`error`,value:e}}i.innerResult=r(i.result,t)}return i.result?i.result:(i.result={type:`error`,value:Error(`No result assigned in instrumentation chain.`)},i.innerResult=r(i.result,t),i.result)}function VW(e){return e.type===`error`&&e.value instanceof Error?{status:`error`,error:e.value}:{status:`success`,error:void 0}}function HW(e){let{request:t,context:n,params:r}=e;return{...e,request:WW(t),params:{...r},context:GW(n)}}function UW(e,t){return{currentUrl:DU(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 WW(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function GW(e){return{get:t=>e.get(t)}}var KW=[`POST`,`PUT`,`PATCH`,`DELETE`],qW=new Set(KW),JW=[`GET`,...KW],YW=new Set(JW),XW=new Set([301,302,303,307,308]),ZW=new Set([307,308]),QW={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},$W={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},eG={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},tG=`remix-router-transitions`,nG=Symbol(`ResetLoaderData`),rG=class{#e;#t;#n;#r;constructor(e){this.#e=e,this.#t=UU(e)}get stableRoutes(){return this.#e}get activeRoutes(){return this.#n??this.#e}get branches(){return this.#r??this.#t}get hasHMRRoutes(){return this.#n!=null}setRoutes(e){this.#e=e,this.#t=UU(e)}setHmrRoutes(e){this.#n=e,this.#r=UU(e)}commitHmrRoutes(){this.#n&&(this.#e=this.#n,this.#t=this.#r,this.#n=void 0,this.#r=void 0)}};function iG(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;SU(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties,a=i||(()=>({}));if(e.instrumentations){let t=e.instrumentations;a=e=>({...i?.(e),...NW(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new rG(RU(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||xG,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=null,_=e.hydrationData!=null,v=VU(s.activeRoutes,e.history.location,c,!1,s.branches),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=GG(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=WG(s.activeRoutes);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&qe(v,s.activeRoutes,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=qe(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}else if(v.some(e=>e.route.lazy))x=!1,S=!x;else if(!v.some(e=>lG(e.route)))x=!0,S=!x;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=v;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}S=!1,x=!0,r.forEach(e=>{let r=uG(e.route,t,n);S||=r.renderFallback,x&&=!r.shouldLoad})}let C,w={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,renderFallback:S,navigation:QW,restoreScrollPosition:e.hydrationData==null&&null,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},T=`POP`,E=null,D=!1,O,k=!1,A=new Map,j=null,M=!1,N=!1,ee=new Set,P=new Map,te=0,ne=-1,re=new Map,ie=new Set,ae=new Map,oe=new Map,se=new Set,ce=new Map,le,ue=null;function de(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(le){le(),le=void 0;return}CU(ce.size===0||r!=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 i=He({currentLocation:w.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{le=e});e.history.go(r*-1),Ve(i,{state:`blocked`,location:n,proceed(){Ve(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(w.blockers);e.set(i,eG),F({blockers:e})}}),E?.resolve(),E=null;return}return _e(t,n)}),n){gK(t,A);let e=()=>_K(t,A);t.addEventListener(`pagehide`,e),j=()=>t.removeEventListener(`pagehide`,e)}return w.initialized||_e(`POP`,w.location,{initialHydration:!0}),C}function fe(){d&&d(),j&&j(),f.clear(),O&&O.abort(),w.fetchers.forEach((e,t)=>Ne(w.fetchers,t)),w.blockers.forEach((e,t)=>Be(t))}function pe(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(w,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function F(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),w={...w,...e};let n=[],r=[];w.fetchers.forEach((e,t)=>{e.state===`idle`&&(se.has(t)?n.push(t):r.push(t))}),se.forEach(e=>{!w.fetchers.has(e)&&!P.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(w,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Ne(w.fetchers,e)),r.forEach(e=>w.fetchers.delete(e))}function me(t,n,{flushSync:r}={}){let i=w.actionData!=null&&w.navigation.formMethod!=null&&oK(w.navigation.formMethod)&&w.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?w.actionData:null;let o=n.loaderData?VG(w.loaderData,n.loaderData,n.matches||[],n.errors):w.loaderData,c=w.blockers;c.size>0&&!M&&(c=new Map(c),c.forEach((e,t)=>c.set(t,eG)));let l=!M&&I(t,n.matches||w.matches),u=D===!0||w.navigation.formMethod!=null&&oK(w.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),M||T===`POP`||(T===`PUSH`?e.history.push(t,t.state):T===`REPLACE`&&e.history.replace(t,t.state));let d;if(T===`POP`){let e=A.get(w.location.pathname);e&&e.has(t.pathname)?d={currentLocation:w.location,nextLocation:t}:A.has(t.pathname)&&(d={currentLocation:t,nextLocation:w.location})}else if(k){let e=A.get(w.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),A.set(w.location.pathname,e)),d={currentLocation:w.location,nextLocation:t}}F({...n,actionData:a,loaderData:o,historyAction:T,location:t,initialized:!0,renderFallback:!1,navigation:QW,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),T=`POP`,D=!1,k=!1,M=!1,N=!1,E?.resolve(),E=null,ue?.resolve(),ue=null}async function he(t,n){if(E?.resolve(),E=null,typeof t==`number`){E||=vK();let n=E.promise;return e.history.go(t),n}let r=RW(C),{path:i,submission:a,error:o}=sG(!1,oG(w.location,w.matches,c,t,n?.fromRouteId,n?.relative),n),s;n?.mask&&(s={pathname:``,search:``,hash:``,...typeof n.mask==`string`?OU(n.mask):{...w.location.mask,...n.mask}});let l=w.location,u=EU(l,i,n&&n.state,void 0,s);u={...u,...e.history.encodeLocation(u)};let d=n&&n.replace!=null?n.replace:void 0,f=`PUSH`;d===!0?f=`REPLACE`:d===!1||a!=null&&oK(a.formMethod)&&a.formAction===w.location.pathname+w.location.search&&(f=`REPLACE`);let p=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,m=(n&&n.flushSync)===!0,h=He({currentLocation:l,nextLocation:u,historyAction:f});if(h){Ve(h,{state:`blocked`,location:u,proceed(){Ve(h,{state:`proceeding`,proceed:void 0,reset:void 0,location:u}),he(t,n)},reset(){let e=new Map(w.blockers);e.set(h,eG),F({blockers:e})}});return}await _e(f,u,{submission:a,pendingError:o,preventScrollReset:p,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:m,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate,instrumentationNavigateMetaReceiver:r})}function ge(){ue||=vK(),Oe(),F({revalidation:`loading`});let e=ue.promise;return w.navigation.state===`submitting`?e:w.navigation.state===`idle`?(_e(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),e):(_e(T||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:k===!0}),e)}async function _e(t,n,r){O&&O.abort(),O=null,T=t,M=(r&&r.startUninterruptedRevalidation)===!0,Ke(w.location,w.matches),D=(r&&r.preventScrollReset)===!0,k=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&w.matches&&w.matches.length>0&&!y?w.matches:VU(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&w.initialized&&!N&&JG(w.location,n)&&!(r&&r.submission&&oK(r.submission.formMethod))){me(n,{matches:a},{flushSync:o});return}let l=qe(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),r?.instrumentationNavigateMetaReceiver){let t=lK(e.history,n,a);r.instrumentationNavigateMetaReceiver(t)}if(!a){let{error:e,notFoundMatches:t,route:r}=Ue(n.pathname);me(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;O=new AbortController;let d=IG(e.history,n,O.signal,r&&r.submission),f=e.getContext?await e.getContext():new jU,p;if(r&&r.pendingError)p=[UG(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&oK(r.submission.formMethod)){let i=await ve(d,n,r.submission,a,t,f,l.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:o});if(i.shortCircuited)return;if(i.pendingActionResult){let[e,t]=i.pendingActionResult;if($G(t)&&EW(t.error)&&t.error.status===404){O=null,me(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=dK(n,a,t,r.submission),o=!1,l.active=!1,d=IG(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await ye(d,n,a,t,f,l.active,u,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,o,p,r&&r.callSiteDefaultShouldRevalidate);m||(O=null,me(n,{matches:h||a,...HG(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function ve(t,n,i,l,u,d,f,p,m={}){if(Oe(),F({navigation:fK(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await Je(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=WG(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=UG(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Ue(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=cK(l,n);if(!g.route.action&&!g.route.lazy)h={type:`error`,error:GG(405,{method:t.method,pathname:n.pathname,routeId:g.route.id})};else{let e=await Ee(t,n,DG(a,o,t,n,l,g,p?[]:r,d),d,null);if(h=e[g.route.id],!h){for(let t of l)if(e[t.route.id]){h=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(eK(h)){let n;return n=m&&m.replace!=null?m.replace:FG(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===w.location.pathname+w.location.search,await Te(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if($G(h)){let e=UG(l,g.route.id);return(m&&m.replace)!==!0&&(T=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function ye(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||dK(n,i,l,p),x=p||m||uK(b),S=!M&&!g;if(d){if(S){let e=be(v);F({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await Je(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=WG(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=UG(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Ue(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:T,revalidatingFetchers:E}=cG(t,u,a,o,e.history,w,i,x,n,g?[]:r,g===!0,N,ee,se,ae,ie,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(ne=++te,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=new Map(w.fetchers),t=Le(e);return me(n,{matches:i,loaderData:{},errors:v&&$G(v[1])?{[v[0]]:v[1].error}:null,...HG(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=be(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=xe(E)),F(e,{flushSync:_})}E.forEach(e=>{Fe(e.key),e.controller&&P.set(e.key,e.controller)});let D=()=>E.forEach(e=>Fe(e.key));O&&O.signal.addEventListener(`abort`,D);let{loaderResults:k,fetcherResults:A}=await De(T,E,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener(`abort`,D),E.forEach(e=>P.delete(e.key));let j=KG(k);if(j)return await Te(t,j.result,!0,{replace:h}),{shortCircuited:!0};if(j=KG(A),j)return ie.add(j.key),await Te(t,j.result,!0,{replace:h}),{shortCircuited:!0};let re=new Map(w.fetchers),{loaderData:oe,errors:ce}=BG(w,i,k,v,E,A,re);g&&w.errors&&(ce={...w.errors,...ce});let le=Le(re),ue=Re(ne,re),de=le||ue||E.length>0;return{matches:i,loaderData:oe,errors:ce,...de?{workingFetchers:re}:{}}}function be(e){if(e&&!$G(e[1]))return{[e[0]]:e[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function xe(e){let t=new Map(w.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=pK(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function Se(t,n,r,i){Fe(t);let a=(i&&i.flushSync)===!0,o=RW(C),l=s.activeRoutes,u=oG(w.location,w.matches,c,r,n,i?.relative),d=VU(l,u,c,!1,s.branches),f=qe(d,l,u);if(f.active&&f.matches&&(d=f.matches),o&&o(lK(e.history,u,d)),!d){Ae(t,n,GG(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=sG(!0,u,i);if(h){Ae(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new jU,_=(i&&i.preventScrollReset)===!0;if(m&&oK(m.formMethod)){await Ce(t,n,p,d,g,f.active,a,_,m,i&&i.defaultShouldRevalidate);return}ae.set(t,{routeId:n,path:p}),await we(t,n,p,d,g,f.active,a,_,m)}async function Ce(t,n,i,l,u,d,f,p,m,h){Oe(),ae.delete(t),ke(t,mK(m,w.fetchers.get(t)),{flushSync:f});let g=new AbortController,_=IG(e.history,i,g.signal,m);if(d){let e=await Je(l,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ae(t,n,e.error,{flushSync:f});return}if(e.matches)l=e.matches;else{Ae(t,n,GG(404,{pathname:i}),{flushSync:f});return}}let v=cK(l,i);if(!v.route.action&&!v.route.lazy){Ae(t,n,GG(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}P.set(t,g);let y=te,b=DG(a,o,_,i,l,v,r,u),x=await Ee(_,i,b,u,t),S=x[v.route.id];if(!S){for(let e of b)if(x[e.route.id]){S=x[e.route.id];break}}if(_.signal.aborted){P.get(t)===g&&P.delete(t);return}if(se.has(t)){if(eK(S)||$G(S)){ke(t,hK(void 0));return}}else{if(eK(S)){if(P.delete(t),ne>y){ke(t,hK(void 0));return}return ie.add(t),ke(t,pK(m)),Te(_,S,!1,{fetcherSubmission:m,preventScrollReset:p})}if($G(S)){Ae(t,n,S.error);return}}let C=w.navigation.location||w.location,E=IG(e.history,C,g.signal),D=s.activeRoutes,k=w.navigation.state===`idle`?w.matches:VU(D,w.navigation.location,c,!1,s.branches);SU(k,`Didn't find any matches after fetcher action`);let A=++te;re.set(t,A);let{dsMatches:j,revalidatingFetchers:M}=cG(E,u,a,o,e.history,w,k,m,C,r,!1,N,ee,se,ae,ie,D,c,e.patchRoutesOnNavigation!=null,s.branches,[v.route.id,S],h),oe=pK(m,S.data),ce=new Map(w.fetchers);ce.set(t,oe),M.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=ce.get(t),r=pK(void 0,n?n.data:void 0);ce.set(t,r),Fe(t),e.controller&&P.set(t,e.controller)}),F({fetchers:ce});let le=()=>M.forEach(e=>Fe(e.key));g.signal.addEventListener(`abort`,le);let{loaderResults:ue,fetcherResults:de}=await De(j,M,E,C,u);if(g.signal.aborted)return;g.signal.removeEventListener(`abort`,le),re.delete(t),P.delete(t),M.forEach(e=>P.delete(e.key));let fe=w.fetchers.has(t),pe=e=>{if(!fe)return e;let n=new Map(e.fetchers);return n.set(t,hK(S.data)),{...e,fetchers:n}},he=KG(ue);if(he)return w=pe(w),Te(E,he.result,!1,{preventScrollReset:p});if(he=KG(de),he)return ie.add(he.key),w=pe(w),Te(E,he.result,!1,{preventScrollReset:p});let ge=new Map(w.fetchers);fe&&ge.set(t,hK(S.data));let{loaderData:_e,errors:ve}=BG(w,k,ue,void 0,M,de,ge);Re(A,ge),w.navigation.state===`loading`&&A>ne?(SU(T,`Expected pending action`),O&&O.abort(),me(w.navigation.location,{matches:k,loaderData:_e,errors:ve,fetchers:ge})):(F({errors:ve,loaderData:VG(w.loaderData,_e,k,ve),fetchers:ge}),N=!1)}async function we(t,n,i,s,c,l,u,d,f){let p=w.fetchers.get(t);ke(t,pK(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=IG(e.history,i,m.signal);if(l){let e=await Je(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ae(t,n,e.error,{flushSync:u});return}if(e.matches)s=e.matches;else{Ae(t,n,GG(404,{pathname:i}),{flushSync:u});return}}let g=cK(s,i);P.set(t,m);let _=te,v=await Ee(h,i,DG(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(P.get(t)===m&&P.delete(t),!h.signal.aborted){if(se.has(t)){ke(t,hK(void 0));return}if(eK(y)){if(ne>_){ke(t,hK(void 0));return}ie.add(t),await Te(h,y,!1,{preventScrollReset:d});return}if($G(y)){Ae(t,n,y.error);return}ke(t,hK(y.data))}}async function Te(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(E?.resolve(),E=null),i.response.headers.has(`X-Remix-Revalidate`)&&(N=!0);let d=i.response.headers.get(`Location`);SU(d,`Expected a Location header on the redirect Response`),d=FG(d,new URL(r.url),c,e.history);let f=EU(w.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(dW(d)){let n=AU(t,d,!0);e=n.origin!==t.location.origin||lW(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}O=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:h,formEncType:g}=w.navigation;!o&&!s&&m&&h&&g&&(o=uK(w.navigation));let _=o||s;ZW.has(i.response.status)&&_&&oK(_.formMethod)?await _e(p,f,{submission:{..._,formAction:d},preventScrollReset:l||D,enableViewTransition:a?k:void 0}):await _e(p,f,{overrideNavigation:dK(f,[],p,o),fetcherSubmission:s,preventScrollReset:l||D,enableViewTransition:a?k:void 0})}async function Ee(e,t,n,r,i){let a,o={};try{a=await OG(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!oK(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!w.loaderData.hasOwnProperty(e.route.id)&&(!w.errors||!w.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(QG(r)){let i=r.result;o[t]={type:`redirect`,response:MG(i,e,t,n,c)}}else o[t]=await jG(r);return o}async function De(e,t,n,r,i){let a=Ee(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await Ee(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}return Promise.resolve({[e.key]:{type:`error`,error:GG(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Oe(){N=!0,ae.forEach((e,t)=>{P.has(t)&&ee.add(t),Fe(t)})}function ke(e,t,n={}){let r=new Map(w.fetchers);r.set(e,t),F({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function Ae(e,t,n,r={}){let i=UG(w.matches,t),a=new Map(w.fetchers);Ne(a,e),F({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function je(e){return oe.set(e,(oe.get(e)||0)+1),se.has(e)&&se.delete(e),w.fetchers.get(e)||$W}function Me(e,t){Fe(e,t?.reason),ke(e,hK(null))}function Ne(e,t){let n=w.fetchers.get(t);P.has(t)&&!(n&&n.state===`loading`&&re.has(t))&&Fe(t),ae.delete(t),re.delete(t),ie.delete(t),se.delete(t),ee.delete(t),e.delete(t)}function Pe(e){let t=(oe.get(e)||0)-1;t<=0?(oe.delete(e),se.add(e)):oe.set(e,t),F({fetchers:new Map(w.fetchers)})}function Fe(e,t){let n=P.get(e);n&&(n.abort(t),P.delete(e))}function Ie(e,t){for(let n of e){let e=t.get(n);SU(e,`Expected fetcher: ${n}`);let r=hK(e.data);t.set(n,r)}}function Le(e){let t=[],n=!1;for(let r of ie){let i=e.get(r);SU(i,`Expected fetcher: ${r}`),i.state===`loading`&&(ie.delete(r),t.push(r),n=!0)}return Ie(t,e),n}function Re(e,t){let n=[];for(let[r,i]of re)if(i<e){let e=t.get(r);SU(e,`Expected fetcher: ${r}`),e.state===`loading`&&(Fe(r),re.delete(r),n.push(r))}return Ie(n,t),n.length>0}function ze(e,t){let n=w.blockers.get(e)||eG;return ce.get(e)!==t&&ce.set(e,t),n}function Be(e){w.blockers.delete(e),ce.delete(e)}function Ve(e,t){let n=w.blockers.get(e)||eG;SU(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(w.blockers);r.set(e,t),F({blockers:r})}function He({currentLocation:e,nextLocation:t,historyAction:n}){if(ce.size===0)return;ce.size>1&&CU(!1,`A router only supports one blocker at a time`);let r=Array.from(ce.entries()),[i,a]=r[r.length-1],o=w.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Ue(e){let t=GG(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=WG(n);return{notFoundMatches:r,route:i,error:t}}function We(e,t,n){if(m=e,g=t,h=n||null,!_&&w.navigation===QW){_=!0;let e=I(w.location,w.matches);e!=null&&F({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Ge(e,t){return h&&h(e,t.map(e=>HU(e,w.loaderData)))||e.key}function Ke(e,t){if(m&&g){let n=Ge(e,t);m[n]=g()}}function I(e,t){if(m){let n=Ge(e,t),r=m[n];if(typeof r==`number`)return r}return null}function qe(t,n,r){if(e.patchRoutesOnNavigation){let e=s.branches;if(!t)return{active:!0,matches:VU(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:VU(n,r,c,!0,e)}}return{active:!1,matches:null}}async function Je(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let l=t;for(;;){let t=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:l,fetcherKey:i,patch:(e,n)=>{r.aborted||mG(e,n,s,t,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}if(r.aborted)return{type:`aborted`};let u=s.branches,d=VU(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=VU(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&&Ye(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=VU(s.activeRoutes,n,c,!0,u),!f||Ye(l,f))return{type:`success`,matches:null};l=f}}function Ye(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function Xe(e){o={},s.setHmrRoutes(RU(e,a,void 0,o))}function Ze(e,t,n=!1){mG(e,t,s,o,a,n),s.hasHMRRoutes||F({})}return C={get basename(){return c},get future(){return u},get state(){return w},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:de,subscribe:pe,enableScrollRestoration:We,navigate:he,fetch:Se,revalidate:ge,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:je,resetFetcher:Me,deleteFetcher:Pe,dispose:fe,getBlocker:ze,deleteBlocker:Be,patchRoutes:Ze,_internalFetchControllers:P,_internalSetRoutes:Xe,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){F(e)}},e.instrumentations&&(C=PW(C,e.instrumentations.map(e=>e.router).filter(Boolean))),C}function aG(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function oG(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=_W(r||`.`,gW(o),lW(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=sK(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=uW({basename:n,pathname:c.pathname})),DU(c)}function sG(e,t,n){if(!n||!aG(n))return{path:t};if(n.formMethod&&!aK(n.formMethod))return{path:t,error:GG(405,{method:n.formMethod})};let r=()=>({path:t,error:GG(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=qG(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!oK(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}\n`,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}if(n.formEncType===`application/json`){if(!oK(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}SU(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=LG(n.formData),s=n.formData;else if(n.body instanceof FormData)o=LG(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=RG(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=RG(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(oK(c.formMethod))return{path:t,submission:c};let l=OU(t);return e&&l.search&&sK(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:DU(l),submission:c}}function cG(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let S=b?$G(b[1])?b[1].error:b[1].data:void 0,C=i.createURL(a.location),w=i.createURL(c),T;if(u&&a.errors){let e=Object.keys(a.errors)[0];T=o.findIndex(t=>t.route.id===e)}else if(b&&$G(b[1])){let e=b[0];T=o.findIndex(t=>t.route.id===e)-1}let E=b?b[1].statusCode:void 0,D=E&&E>=400,O={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:E},k=DW(o),A=o.map((i,o)=>{let{route:s}=i,f=null;if(T!=null&&o>T)f=!1;else if(s.lazy)f=!0;else if(!lG(s))f=!1;else if(u){let{shouldLoad:e}=uG(s,a.loaderData,a.errors);f=e}else dG(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return EG(n,r,e,c,k,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:D?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?fG(a.matches[o],i)&&(p=!0):p=!0;let m={...O,defaultShouldRevalidate:p};return EG(n,r,e,c,k,i,l,t,pG(i,m),m,x)}),j=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,b=VU(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;j.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let S=cK(b,e.path),C=new AbortController,w=IG(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=DG(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=DG(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:!D&&d;let a={...O,defaultShouldRevalidate:i};pG(S,a)&&(T=DG(n,r,w,e.path,b,S,l,t,a))}T&&j.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:A,revalidatingFetchers:j}}function lG(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function uG(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!lG(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function dG(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function fG(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function pG(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function mG(e,t,n,r,i,a){let o;if(e){let t=r[e];SU(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>hG(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=RU(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=RU([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function hG(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?!1:(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>hG(e,t)))??!1}var gG=new WeakMap,_G=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(SU(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=gG.get(i);o||(o={},gG.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=NU(e),n=i[e]!==void 0;if(t)CU(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)CU(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},vG=new WeakMap;function yG(e,t,n,r,i){let a=n[e.id];if(SU(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=vG.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{SU(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=FU(e),o=a[e]!==void 0;i?CU(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?CU(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return vG.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=_G({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function bG(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function xG(e){return e.matches.some(e=>e.route.middleware)?SG(e,()=>bG(e)):bG(e)}function SG(e,t){return CG(e,t,e=>{if(iK(e))throw e;return e},XG,n);async function n(t,n,r){if(r)return Object.assign(r.value,{[n]:{type:`error`,result:t}});{let{matches:r}=e,i=Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0)),a=r[i].route.id;for(let e of r.slice(0,i+1))try{await e._lazyPromises?.route}catch{a=e.route.id;break}return{[UG(r,a).route.id]:{type:`error`,result:t}}}}}async function CG(e,t,n,r,i){let{matches:a,...o}=e;return await wG(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function wG(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await wG(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function TG(e,t,n,r,i){let a=_G({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=yG(r.route,oK(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function EG(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=TG(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?pG(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?pG(a,{...l,defaultShouldRevalidate:e}):pG(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!oK(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(oK(n.method)||!p)?kG({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function DG(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?EG(e,t,n,r,DW(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:TG(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function OG(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,url:OW(t,n),pattern:DW(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return SG(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function kG({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=oK(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:OW(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a){if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw GG(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}}else if(t)c=await f(t);else{let t=new URL(e.url);throw GG(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function AG(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 jG(e){let{result:t,type:n}=e;if(nK(t)){let e;try{e=await AG(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new TW(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?tK(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:YG(t),statusCode:EW(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:EW(t)?t.status:void 0}:tK(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 MG(e,t,n,r,i){let a=e.headers.get(`Location`);if(SU(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!dW(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=oG(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var NG=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function PG(e){try{return NG.includes(new URL(e).protocol)}catch{return!1}}function FG(e,t,n,r){if(dW(e)){let r=e,i=_U.test(r)?new URL(vU(r,t.protocol)):new URL(r);if(PG(i.toString()))throw Error(`Invalid redirect location`);let a=lW(i.pathname,n)!=null;if(i.origin===t.origin&&a)return vW(i.pathname)+i.search+i.hash}try{if(PG(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function IG(e,t,n,r){let i=e.createURL(qG(t)).toString(),a={signal:n};if(r&&oK(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):a.body=t===`text/plain`?r.text:t===`application/x-www-form-urlencoded`&&r.formData?LG(r.formData):r.formData}return new Request(i,a)}function LG(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function RG(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function zG(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&$G(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(SU(!eK(f),`Cannot handle redirect results in processLoaderData`),$G(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=UG(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=nG),c||(c=!0,s=EW(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function BG(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=zG(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(SU(s,`Did not find corresponding fetcher result`),$G(s)){let t=UG(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(eK(s))SU(!1,`Unhandled fetcher revalidation redirect`);else{let e=hK(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function VG(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==nG).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function HG(e){return e?$G(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function UG(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.ErrorBoundary!=null||e.route.errorElement!=null)||e[0]}function WG(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function GG(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`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.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`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&&(s=`Invalid request method "${r.toUpperCase()}"`)),new TW(e||500,o,Error(s),!0)}function KG(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(eK(r))return{key:n,result:r}}}function qG(e){return DU({...typeof e==`string`?OU(e):e,hash:``})}function JG(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash||t.hash!==``}function YG(e){return new TW(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function XG(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&ZG(t))}function ZG(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function QG(e){return nK(e.result)&&XW.has(e.result.status)}function $G(e){return e.type===`error`}function eK(e){return(e&&e.type)===`redirect`}function tK(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function nK(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function rK(e){return XW.has(e)}function iK(e){return nK(e)&&rK(e.status)&&e.headers.has(`Location`)}function aK(e){return YW.has(e.toUpperCase())}function oK(e){return qW.has(e.toUpperCase())}function sK(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function cK(e,t){let n=typeof t==`string`?OU(t).search:t.search;if(e[e.length-1].route.index&&sK(n||``))return e[e.length-1];let r=hW(e);return r[r.length-1]}function lK(e,t,n){return{url:OW(e.createURL(t),t),pattern:n?DW(n):``,params:n?.[0]?.params?{...n[0].params}:{}}}function uK(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(t&&n&&r){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function dK(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function fK(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function pK(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 mK(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 hK(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 gK(e,t){try{let n=e.sessionStorage.getItem(tG);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function _K(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(tG,JSON.stringify(n))}catch(e){CU(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function vK(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var yK=b.createContext(null);yK.displayName=`DataRouter`;var bK=b.createContext(null);bK.displayName=`DataRouterState`;var xK=b.createContext(!1);function SK(){return b.useContext(xK)}var CK=b.createContext({isTransitioning:!1});CK.displayName=`ViewTransition`;var wK=b.createContext(new Map);wK.displayName=`Fetchers`;var TK=b.createContext(null);TK.displayName=`Await`;var EK=b.createContext(null);EK.displayName=`Navigation`;var DK=b.createContext(null);DK.displayName=`Location`;var OK=b.createContext({outlet:null,matches:[],isDataRoute:!1});OK.displayName=`Route`;var kK=b.createContext(null);kK.displayName=`RouteError`;var AK=`REACT_ROUTER_ERROR`,jK=`REDIRECT`,MK=`ROUTE_ERROR_RESPONSE`;function NK(e){if(e.startsWith(`${AK}:${jK}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function PK(e){if(e.startsWith(`${AK}:${MK}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new TW(t.status,t.statusText,t.data)}catch{}}function FK(e,{relative:t}={}){SU(IK(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=b.useContext(EK),{hash:i,pathname:a,search:o}=WK(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:yW([n,a])),r.createHref({pathname:s,search:o,hash:i})}function IK(){return b.useContext(DK)!=null}function LK(){return SU(IK(),`useLocation() may be used only in the context of a <Router> component.`),b.useContext(DK).location}var RK=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function zK(){let{isDataRoute:e}=b.useContext(OK);return e?sq():BK()}function BK(){SU(IK(),`useNavigate() may be used only in the context of a <Router> component.`);let e=b.useContext(yK),{basename:t,navigator:n}=b.useContext(EK),{matches:r}=b.useContext(OK),{pathname:i}=LK(),a=JSON.stringify(gW(r)),o=b.useRef(!1);return b.useLayoutEffect(()=>{o.current=!0}),b.useCallback((r,s={})=>{if(CU(o.current,RK),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=_W(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:yW([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var VK=b.createContext(null);function HK(e){let t=b.useContext(OK).outlet;return b.useMemo(()=>t&&b.createElement(VK.Provider,{value:e},t),[t,e])}function UK(){let{matches:e}=b.useContext(OK);return e[e.length-1]?.params??{}}function WK(e,{relative:t}={}){let{matches:n}=b.useContext(OK),{pathname:r}=LK(),i=JSON.stringify(gW(n));return b.useMemo(()=>_W(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function GK(e,t){return KK(e,t)}function KK(e,t,n){SU(IK(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=b.useContext(EK),{matches:i}=b.useContext(OK),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=LK(),l;if(t){let e=typeof t==`string`?OU(t):t;SU(s===`/`||e.pathname?.startsWith(s),`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 "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=c;let u=l.pathname||`/`,d=u;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);d=`/`+u.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let f=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):BU(e,{pathname:d}),p=$K(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:yW([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:yW([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&p?b.createElement(DK.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},p):p}function qK(){let e=oq(),t=EW(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return b.createElement(b.Fragment,null,b.createElement(`h2`,null,`Unexpected Application Error!`),b.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?b.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var JK=b.createElement(qK,null),YK=class extends b.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=xK;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?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=PK(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:b.createElement(OK.Provider,{value:this.props.routeContext},b.createElement(kK.Provider,{value:e,children:this.props.component}));return this.context?b.createElement(ZK,{error:e},t):t}},XK=new WeakMap;function ZK({children:e,error:t}){let{basename:n}=b.useContext(EK);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=NK(t.digest);if(e){let r=XK.get(t);if(r)throw r;let i=AW(e.location,n),a=i.absoluteURL||i.to;if(PG(a))throw Error(`Invalid redirect location`);if(kW&&!XK.get(t)){if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw XK.set(t,n),n}}return b.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function QK({routeContext:e,match:t,children:n}){let r=b.useContext(yK);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),b.createElement(OK.Provider,{value:e},n)}function $K(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);SU(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:DW(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||JK,o&&(s<0&&c===0?(lq(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?b.createElement(n.route.Component,null):n.route.element?n.route.element:e,b.createElement(QK,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?b.createElement(YK,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function eq(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function tq(e){let t=b.useContext(yK);return SU(t,eq(e)),t}function nq(e){let t=b.useContext(bK);return SU(t,eq(e)),t}function rq(e){let t=b.useContext(OK);return SU(t,eq(e)),t}function iq(e){let t=rq(e),n=t.matches[t.matches.length-1];return SU(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function aq(){return iq(`useRouteId`)}function oq(){let e=b.useContext(kK),t=nq(`useRouteError`),n=iq(`useRouteError`);return e===void 0?t.errors?.[n]:e}function sq(){let{router:e}=tq(`useNavigate`),t=iq(`useNavigate`),n=b.useRef(!1);return b.useLayoutEffect(()=>{n.current=!0}),b.useCallback(async(r,i={})=>{CU(n.current,RK),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var cq={};function lq(e,t,n){!t&&!cq[e]&&(cq[e]=!0,CU(!1,n))}var uq={};function dq(e,t){!e&&!uq[t]&&(uq[t]=!0,console.warn(t))}var fq=[`HydrateFallback`,`hydrateFallbackElement`],pq=class{status=`pending`;promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function mq({router:e,flushSync:t,onError:n,useTransitions:r}){r=SK()||r;let[i,a]=b.useState(e.state),[o,s]=(0,b.useOptimistic)(i),[c,l]=b.useState(),[u,d]=b.useState({isTransitioning:!1}),[f,p]=b.useState(),[m,h]=b.useState(),[g,_]=b.useState(),v=b.useRef(new Map),y=b.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:DW(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&v.current.set(t,e.data)}),o.forEach(e=>v.current.delete(e)),dq(u===!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 y=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(dq(g==null||y,"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."),!g||!y){t&&u?t(()=>a(i)):r===!1?a(i):b.startTransition(()=>{r===!0&&s(e=>hq(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);b.useLayoutEffect(()=>e.subscribe(y),[e,y]),b.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new pq)},[u]),b.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):b.startTransition(()=>{r===!0&&s(e=>hq(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),b.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),b.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let x=b.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),S=e.basename||`/`,C=b.useMemo(()=>({router:e,navigator:x,static:!1,basename:S,onError:n}),[e,x,S,n]);return b.createElement(b.Fragment,null,b.createElement(yK.Provider,{value:C},b.createElement(bK.Provider,{value:o},b.createElement(wK.Provider,{value:v.current},b.createElement(CK.Provider,{value:u},b.createElement(bq,{basename:S,location:o.location,navigationType:o.historyAction,navigator:x,useTransitions:r},b.createElement(gq,{routes:e.routes,manifest:e.manifest,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function hq(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var gq=b.memo(_q);function _q({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return KK(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function vq({to:e,replace:t,state:n,relative:r}){SU(IK(),`<Navigate> may be used only in the context of a <Router> component.`);let{static:i}=b.useContext(EK);CU(!i,`<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.`);let{matches:a}=b.useContext(OK),{pathname:o}=LK(),s=zK(),c=_W(e,gW(a),o,r===`path`),l=JSON.stringify(c);return b.useEffect(()=>{s(JSON.parse(l),{replace:t,state:n,relative:r})},[s,l,r,t,n]),null}function yq(e){return HK(e.context)}function $(e){SU(!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 bq({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){SU(!IK(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=b.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=OU(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=b.useMemo(()=>{let e=lW(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return CU(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:b.createElement(EK.Provider,{value:c},b.createElement(DK.Provider,{children:t,value:h}))}function xq({children:e,location:t}){return GK(Sq(e),t)}b.Component;function Sq(e,t=[]){let n=[];return b.Children.forEach(e,(e,r)=>{if(!b.isValidElement(e))return;let i=[...t,r];if(e.type===b.Fragment){n.push.apply(n,Sq(e.props.children,i));return}SU(e.type===$,`[${typeof e.type==`string`?e.type:e.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`);let a=e.props;SU(!a.index||!a.children,`An index route cannot have child routes.`);let o={id:a.id||i.join(`-`),caseSensitive:a.caseSensitive,element:a.element,Component:a.Component,index:a.index,path:a.path,middleware:a.middleware,loader:a.loader,action:a.action,hydrateFallbackElement:a.hydrateFallbackElement,HydrateFallback:a.HydrateFallback,errorElement:a.errorElement,ErrorBoundary:a.ErrorBoundary,shouldRevalidate:a.shouldRevalidate,handle:a.handle,lazy:a.lazy};a.children&&(o.children=Sq(a.children,i)),n.push(o)}),n}var Cq=`application/x-www-form-urlencoded`;function wq(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Tq(e){return wq(e)&&e.tagName.toLowerCase()===`button`}function Eq(e){return wq(e)&&e.tagName.toLowerCase()===`form`}function Dq(e){return wq(e)&&e.tagName.toLowerCase()===`input`}function Oq(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function kq(e,t){return e.button===0&&(!t||t===`_self`)&&!Oq(e)}function Aq(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(e=>[n,e]):[[n,r]])},[]))}function jq(e,t){let n=Aq(e);return t&&t.forEach((e,r)=>{n.has(r)||t.getAll(r).forEach(e=>{n.append(r,e)})}),n}var Mq=null;function Nq(){if(Mq===null)try{new FormData(document.createElement(`form`),0),Mq=!1}catch{Mq=!0}return Mq}var Pq=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function Fq(e){return e!=null&&!Pq.has(e)?(CU(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Cq}"`),null):e}function Iq(e,t){let n,r,i,a,o;if(Eq(e)){let o=e.getAttribute(`action`);r=o?lW(o,t):null,n=e.getAttribute(`method`)||`get`,i=Fq(e.getAttribute(`enctype`))||Cq,a=new FormData(e)}else if(Tq(e)||Dq(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?lW(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=Fq(e.getAttribute(`formenctype`))||Fq(o.getAttribute(`enctype`))||Cq,a=new FormData(o,e),!Nq()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(wq(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=Cq,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}function Lq(e,t){if(e===!1||e==null)throw Error(t)}function Rq(e,t){let n=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n.pathname=n.pathname.endsWith(`/`)?`${n.pathname}_.${t}`:`${n.pathname}.${t}`,n}async function zq(e,t){if(e.id in t)return t[e.id];try{let n=await UV(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Bq(e){return e!=null&&typeof e.page==`string`}function Vq(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 Hq(e,t,n){return qq((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await zq(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(Vq).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function Uq(e,t,n,r,i,a){let o=(e,t)=>!n[t]||e.route.id!==n[t].route.id,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function Wq(e,t,{includeHydrateFallback:n}={}){return Gq(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function Gq(e){return[...new Set(e)]}function Kq(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function qq(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!Bq(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(Kq(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function Jq(){let e=b.useContext(yK);return Lq(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function Yq(){let e=b.useContext(bK);return Lq(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var Xq=b.createContext(void 0);Xq.displayName=`FrameworkContext`;function Zq(){let e=b.useContext(Xq);return Lq(e,`You must render this element inside a <HydratedRouter> element`),e}function Qq(e,t){let n=b.useContext(Xq),[r,i]=b.useState(!1),[a,o]=b.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=b.useRef(null);b.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),b.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:$q(s,p),onBlur:$q(c,m),onMouseEnter:$q(l,p),onMouseLeave:$q(u,m),onTouchStart:$q(d,p)}]:[a,f,{}]:[!1,f,{}]}function $q(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function eJ({page:e,...t}){let n=SK(),{nonce:r}=Zq(),{router:i}=Jq(),a=b.useMemo(()=>BU(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?b.createElement(nJ,{page:e,matches:a,...t}):b.createElement(rJ,{page:e,matches:a,...t})):null}function tJ(e){let{manifest:t,routeModules:n}=Zq(),[r,i]=b.useState([]);return b.useEffect(()=>{let r=!1;return Hq(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function nJ({page:e,matches:t,...n}){let r=LK(),i=b.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=Rq(e,`rsc`),i=!1,a=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?i=!0:a.push(e.route.id);return i&&a.length>0&&n.searchParams.set(`_routes`,a.join(`,`)),[n.pathname+n.search]},[e,r,t]);return b.createElement(b.Fragment,null,i.map(e=>b.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function rJ({page:e,matches:t,...n}){let r=LK(),{manifest:i,routeModules:a}=Zq(),{loaderData:o,matches:s}=Yq(),c=b.useMemo(()=>Uq(e,t,s,i,r,`data`),[e,t,s,i,r]),l=b.useMemo(()=>Uq(e,t,s,i,r,`assets`),[e,t,s,i,r]),u=b.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];t&&t.hasLoader&&(!c.some(t=>t.route.id===e.route.id)&&e.route.id in o&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let l=Rq(e,`data`);return s&&n.size>0&&l.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[l.pathname+l.search]},[o,r,i,c,t,e,a]),d=b.useMemo(()=>Wq(l,i),[l,i]),f=tJ(l);return b.createElement(b.Fragment,null,u.map(e=>b.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),d.map(e=>b.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),f.map(({key:e,link:t})=>b.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function iJ(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var aJ=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{aJ&&(window.__reactRouterVersion=`8.3.0`)}catch{}function oJ(e,t){return iG({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:xU({window:t?.window}),hydrationData:t?.hydrationData||sJ(),routes:e,mapRouteProperties:LU,hydrationRouteProperties:fq,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function sJ(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:cJ(e.errors)}),e}function cJ(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new TW(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&wW.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}var lJ=b.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=b.useContext(EK),v=typeof l==`string`&&gU.test(l),y=AW(l,h);l=y.to;let x=FK(l,{relative:r}),S=LK(),C=null;if(o){let e=_W(o,[],S.mask?S.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:yW([h,e.pathname])),C=g.createHref(e)}let[w,T,E]=Qq(n,p),D=mJ(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function O(t){e&&e(t),t.defaultPrevented||D(t)}let k=!(y.isExternal||i),A=b.createElement(`a`,{...p,...E,href:(k?C:void 0)||y.absoluteURL||x,onClick:k?O:e,ref:iJ(m,T),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return w&&!v?b.createElement(b.Fragment,null,A,b.createElement(eJ,{page:x})):A});lJ.displayName=`Link`;var uJ=b.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=WK(a,{relative:c.relative}),d=LK(),f=b.useContext(bK),{navigator:p,basename:m}=b.useContext(EK),h=f!=null&&bJ(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=lW(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,x=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,S=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(y)===`/`),C={isActive:x,isPending:S,isTransitioning:h},w=x?e:void 0,T;T=typeof n==`function`?n(C):[n,x?`active`:null,S?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let E=typeof i==`function`?i(C):i;return b.createElement(lJ,{...c,"aria-current":w,className:T,ref:l,style:E,to:a,viewTransition:o},typeof s==`function`?s(C):s)});uJ.displayName=`NavLink`;var dJ=b.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=b.useContext(EK),g=vJ(),_=yJ(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&gU.test(s);return b.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?b.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});dJ.displayName=`Form`;function fJ(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function pJ(e){let t=b.useContext(yK);return SU(t,fJ(e)),t}function mJ(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=zK(),d=LK(),f=WK(e,{relative:o});return b.useCallback(p=>{if(kq(p,t)){p.preventDefault();let t=n===void 0?DU(d)===DU(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?b.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}function hJ(e){CU(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=b.useRef(Aq(e)),n=b.useRef(!1),r=LK(),i=b.useMemo(()=>jq(r.search,n.current?null:t.current),[r.search]),a=zK();return[i,b.useCallback((e,t)=>{let r=Aq(typeof e==`function`?e(new URLSearchParams(i)):e);n.current=!0,a(`?`+r,t)},[a,i])]}var gJ=0,_J=()=>`__${String(++gJ)}__`;function vJ(){let{router:e}=pJ(`useSubmit`),{basename:t}=b.useContext(EK),n=aq(),r=e.fetch,i=e.navigate;return b.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=Iq(e,t);a.navigate===!1?await r(a.fetcherKey||_J(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function yJ(e,{relative:t}={}){let{basename:n}=b.useContext(EK),r=b.useContext(OK);SU(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={...WK(e||`.`,{relative:t})},o=LK();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:yW([n,a.pathname])),DU(a)}function bJ(e,{relative:t}={}){let n=b.useContext(CK);SU(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=pJ(`useViewTransitionState`),i=WK(e,{relative:t});if(!n.isTransitioning)return!1;let a=lW(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=lW(n.nextLocation.pathname,r)||n.nextLocation.pathname;return aW(i.pathname,o)!=null||aW(i.pathname,a)!=null}function xJ(){let{pathname:e}=LK();return(0,b.useEffect)(()=>{window.scrollTo(0,0)},[e]),null}function SJ(e){let{serviceRequest:t,...n}=e;return(0,L.jsx)(QR,{value:t,loadTimelineResources:async(e,t,n)=>{let r=`${t}/${n}`;return Promise.allSettled([e.readHistory(`ServiceRequest`,n),e.search(`Communication`,{"based-on":r,_count:100}),e.search(`DiagnosticReport`,{"based-on":r,_count:100}),e.search(`Media`,{"based-on":r,_count:100}),e.search(`DocumentReference`,{related:r,_count:100}),e.search(`Task`,{_filter:`based-on eq ${r} or focus eq ${r} or subject eq ${r}`,_count:100})])},createCommunication:(e,t,n)=>({resourceType:`Communication`,status:`completed`,basedOn:[DC(e)],subject:e.subject,sender:DC(t),sent:new Date().toISOString(),payload:[{contentString:n}]}),createMedia:(e,t,n)=>({resourceType:`Media`,status:`completed`,basedOn:[DC(e)],subject:e.subject,operator:DC(t),issued:new Date().toISOString(),content:n}),...n})}function CJ(e){let t=Z(),{client:n,patient:r,encounter:i,children:a,...o}=e,s=eA(r),c=eA(i);function l(){let a=r,o=i;if(n.launchIdentifierSystems?.length){let e=n.launchIdentifierSystems.find(e=>e.resourceType===`Patient`);if(a&&s&&e?.system){let t=s.identifier?.find(t=>t.system===e.system);t&&(a={...r,identifier:t})}let t=n.launchIdentifierSystems.find(e=>e.resourceType===`Encounter`);if(o&&c&&t?.system){let e=c.identifier?.find(e=>e.system===t.system);e&&(o={...i,identifier:e})}}t.createResource({resourceType:`SmartAppLaunch`,patient:a,encounter:o,fhirContext:e.fhirContext}).then(e=>{let r=new URL(n.launchUri);r.searchParams.set(`iss`,bw(t.fhirUrl().toString())),r.searchParams.set(`launch`,e.id),window.open(r.toString(),`_blank`)}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}return(0,L.jsx)(Rd,{onClick:()=>l(),...o,children:a})}var wJ=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m){if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}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(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),TJ=o(((e,t)=>{t.exports=wJ()})),EJ=o((e=>{var t=TJ(),n=m(),r=na();function i(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(e){for(var t=e,n=t;n&&!n.alternate;)t=n,t.flags&4098&&(e=t.return),n=t.return;for(;t.return;)t=t.return;return t.tag===3?e:null}function s(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function c(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function l(e){if(o(e)!==e)throw Error(i(188))}function u(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return l(a),e;if(s===r)return l(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,u=a.child;u;){if(u===n){c=!0,n=a,r=s;break}if(u===r){c=!0,r=a,n=s;break}u=u.sibling}if(!c){for(u=s.child;u;){if(u===n){c=!0,n=s,r=a;break}if(u===r){c=!0,r=s,n=a;break}u=u.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function d(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=d(e),t!==null)return t;e=e.sibling}return null}function f(e,t,n,r,i,a){for(;e!==null;){if((e.tag===5||e.tag===27||e.tag===6)&&n(e,r,i,a)||(e.tag!==22||e.memoizedState===null)&&(t||e.tag!==5&&e.tag!==27)&&f(e.child,t,n,r,i,a))return!0;e=e.sibling}return!1}function p(e){for(e=e.return;e!==null;){if(e.tag===3||e.tag===5||e.tag===27)return e;e=e.return}return null}function h(e){var t=!1;for(e=e.return;e!==null&&(e.tag===4&&(t=!0),e.tag!==3&&e.tag!==5&&e.tag!==27);)e=e.return;return t}function g(e){var t=[null,null],n=p(e);return n===null||_(t,e,n.child,{foundSelf:!1}),t}function _(e,t,n,r){for(;n!==null;){if(n===t)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return e[1]=n,!0;e[0]=n}else if((n.tag!==22||n.memoizedState===null)&&_(e,t,n.child,r))return!0;n=n.sibling}return!1}function v(e){switch(e.tag){case 5:case 27:case 6:return e.stateNode;case 3:return e.stateNode.containerInfo;default:throw Error(i(559))}}var y=null,b=null;function x(e,t,n){return e===n||e===t&&(y=e,!0)}function S(e,t,n){return e===n?(b=e,!1):e===t&&(b!==null&&(y=e),!0)}function C(e){if(e===null)return null;do e=e===null?null:e.return;while(e&&e.tag!==5&&e.tag!==27&&e.tag!==3);return e||null}function w(e,t,n){for(var r=0,i=e;i;i=n(i))r++;i=0;for(var a=t;a;a=n(a))i++;for(;0<r-i;)e=n(e),r--;for(;0<i-r;)t=n(t),i--;for(;r--;){if(e===t||t!==null&&e===t.alternate)return e;e=n(e),t=n(t)}return null}var T=Object.assign,E=Symbol.for(`react.element`),D=Symbol.for(`react.transitional.element`),O=Symbol.for(`react.portal`),k=Symbol.for(`react.fragment`),A=Symbol.for(`react.strict_mode`),j=Symbol.for(`react.profiler`),M=Symbol.for(`react.consumer`),N=Symbol.for(`react.context`),ee=Symbol.for(`react.forward_ref`),P=Symbol.for(`react.suspense`),te=Symbol.for(`react.suspense_list`),ne=Symbol.for(`react.memo`),re=Symbol.for(`react.lazy`),ie=Symbol.for(`react.activity`),ae=Symbol.for(`react.legacy_hidden`),oe=Symbol.for(`react.memo_cache_sentinel`),se=Symbol.for(`react.view_transition`),ce=Symbol.for(`react.recoverable`),le=Symbol.iterator;function ue(e){return typeof e!=`object`||!e?null:(e=le&&e[le]||e[`@@iterator`],typeof e==`function`?e:null)}var de=Symbol.for(`react.client.reference`);function fe(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===de?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case k:return`Fragment`;case j:return`Profiler`;case A:return`StrictMode`;case P:return`Suspense`;case te:return`SuspenseList`;case ie:return`Activity`;case se:return`ViewTransition`}if(typeof e==`object`)switch(e.$$typeof){case O:return`Portal`;case N:return e.displayName||`Context`;case M:return(e._context.displayName||`Context`)+`.Consumer`;case ee:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case ne:return t=e.displayName||null,t===null?fe(e.type)||`Memo`:t;case re:t=e._payload,e=e._init;try{return fe(e(t))}catch{}}return null}var pe=Array.isArray,F=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,me=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,he={pending:!1,data:null,method:null,action:null},ge=[],_e=-1;function ve(e){return{current:e}}function ye(e){0>_e||(e.current=ge[_e],ge[_e]=null,_e--)}function be(e,t){_e++,ge[_e]=e.current,e.current=t}var xe=ve(null),Se=ve(null),Ce=ve(null),we=ve(null);function Te(e,t){switch(be(Ce,t),be(Se,e),be(xe,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?bp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=bp(t),e=xp(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ye(xe),be(xe,e)}function Ee(){ye(xe),ye(Se),ye(Ce)}function De(e){var t=e.memoizedState;t!==null&&(gh._currentValue=t.memoizedState,be(we,e)),t=xe.current;var n=xp(t,e.type);t!==n&&(be(Se,e),be(xe,n))}function Oe(e){Se.current===e&&(ye(xe),ye(Se)),we.current===e&&(ye(we),gh._currentValue=he)}var ke,Ae;function je(e){if(ke===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ke=t&&t[1]||``,Ae=-1<e.stack.indexOf(`
|
|
211
211
|
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
212
212
|
`+ke+e+Ae}var Me=!1;function Ne(e,t){if(!e||Me)return``;Me=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}n=!1;try{var i=Object.getOwnPropertyDescriptor(e.prototype,`props`);Object.defineProperty(e.prototype,"props",{configurable:!0,set:function(){throw Error()}}),n=!0,new e}finally{n&&(i===void 0?delete e.prototype.props:Object.defineProperty(e.prototype,"props",i))}}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
213
213
|
`),l=s.split(`
|
|
@@ -215,17 +215,17 @@ ${o?`${s(`light`)}{${o}}`:``}`}function Mr({color:e,theme:t,autoContrast:n}){ret
|
|
|
215
215
|
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{Me=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?je(n):``}function Pe(e,t){switch(e.tag){case 26:case 27:case 5:return je(e.type);case 16:return je(`Lazy`);case 13:return e.child!==t&&t!==null?je(`Suspense Fallback`):je(`Suspense`);case 19:return je(`SuspenseList`);case 0:case 15:return Ne(e.type,!1);case 11:return Ne(e.type.render,!1);case 1:return Ne(e.type,!0);case 31:return je(`Activity`);case 30:return je(`ViewTransition`);default:return``}}function Fe(e){try{var t=``,n=null;do t+=Pe(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
216
216
|
Error generating stack: `+e.message+`
|
|
217
217
|
`+e.stack}}var Ie=Object.prototype.hasOwnProperty,Le=t.unstable_scheduleCallback,Re=t.unstable_cancelCallback,ze=t.unstable_shouldYield,Be=t.unstable_requestPaint,Ve=t.unstable_now,He=t.unstable_getCurrentPriorityLevel,Ue=t.unstable_ImmediatePriority,We=t.unstable_UserBlockingPriority,Ge=t.unstable_NormalPriority,Ke=t.unstable_LowPriority,I=t.unstable_IdlePriority,qe=t.log,Je=t.unstable_setDisableYieldValue,Ye=null,Xe=null;function Ze(e){if(typeof qe==`function`&&Je(e),Xe&&typeof Xe.setStrictMode==`function`)try{Xe.setStrictMode(Ye,e)}catch{}}var L=Math.clz32?Math.clz32:et,Qe=Math.log,$e=Math.LN2;function et(e){return e>>>=0,e===0?32:31-(Qe(e)/$e|0)|0}var tt=256,nt=262144,rt=4194304;function it(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64: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 e&-e;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function at(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=it(n))):i=it(o):i=it(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=it(n))):i=it(o)):i=it(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function ot(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function st(e,t){t&8&&(t|=t&32);var n=e.entangledLanes;if(n!==0)for(e=e.entanglements,n&=t;0<n;){var r=31-L(n),i=1<<r;t|=e[r],n&=~i}return t}function ct(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 lt(){var e=rt;return rt<<=1,!(rt&62914560)&&(rt=4194304),e}function ut(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function dt(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function ft(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-L(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&pt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function pt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-L(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function mt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-L(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function ht(e,t){var n=t&-t;return n=n&42?1:gt(n),(n&(e.suspendedLanes|t))===0?n:0}function gt(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=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:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function _t(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function vt(){var e=me.p;return e===0?(e=window.event,e===void 0?32:Mh(e.type)):e}function yt(e,t){var n=me.p;try{return me.p=e,t()}finally{me.p=n}}var bt=Math.random().toString(36).slice(2),xt=`__reactFiber$`+bt,St=`__reactProps$`+bt,Ct=`__reactContainer$`+bt,wt=`__reactEvents$`+bt,Tt=`__reactListeners$`+bt,Et=`__reactHandles$`+bt,Dt=`__reactResources$`+bt,Ot=`__reactMarker$`+bt,kt=`__reactLoad$`+bt;function At(e){delete e[xt],delete e[St],delete e[Tt],delete e[Et]}function jt(e){var t;if(t=e[xt])return t;for(var n=e.parentNode;n;){if(t=n[Ct]||n[xt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=xm(e);e!==null;){if(n=e[xt])return n;e=xm(e)}return t}e=n,n=e.parentNode}return null}function Mt(e){if(e=e[xt]||e[Ct]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function Nt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function Pt(e){var t=e[Dt];return t||=e[Dt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function Ft(e){e[Ot]=!0}function It(e){e[kt]=void 0}var Lt=new Set,Rt={};function zt(e,t){Bt(e,t),Bt(e+`Capture`,t)}function Bt(e,t){for(Rt[e]=t,e=0;e<t.length;e++)Lt.add(t[e])}var Vt=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]*$`),Ht={},Ut={};function Wt(e){return Ie.call(Ut,e)?!0:Ie.call(Ht,e)?!1:Vt.test(e)?Ut[e]=!0:(Ht[e]=!0,!1)}var Gt=!1;function Kt(){var e=Gt;return Gt=!1,e}function qt(e,t,n){if(Wt(t)){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,n)}}}function Jt(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,n)}}function Yt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,r)}}function Xt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Zt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Qt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function $t(e){if(!e._valueTracker){var t=Zt(e)?`checked`:`value`;e._valueTracker=Qt(e,t,``+e[t])}}function en(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Zt(e)?e.checked?`true`:`false`:e.value),e=r,e!==n&&(t.setValue(e),!0)}var tn=/[\n"\\]/g;function nn(e){return e.replace(tn,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function rn(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Xt(t)):e.value!==``+Xt(t)&&(e.value=``+Xt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):on(e,Xt(n)):o===`number`&&e.value==t?on(e,Xt(e.value)):on(e,Xt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Xt(s):e.removeAttribute(`name`)}function an(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){$t(e);return}n=n==null?``:``+Xt(n),t=t==null?n:``+Xt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),$t(e)}function on(e,t){e.defaultValue!==``+t&&(e.defaultValue=``+t)}function sn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Xt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function cn(e,t,n){if(t!=null&&(t=``+Xt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Xt(n)}function ln(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(pe(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Xt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),$t(e)}function un(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var dn=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 fn(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||dn.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function pn(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``,Gt=!0);for(var a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&(fn(e,a,r),Gt=!0)}else for(var o in t)t.hasOwnProperty(o)&&fn(e,o,t[o])}function mn(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var hn=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`],[`maskType`,`mask-type`],[`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`]]),gn=/^[\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 _n(e){return gn.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function vn(){}var yn=null;function bn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var xn=null,Sn=null;function Cn(e){var t=Mt(e);if(t&&(e=t.stateNode)){var n=e[St]||null;a:switch(e=t.stateNode,t.type){case`input`:if(rn(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+nn(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[St]||null;if(!a)throw Error(i(90));rn(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&en(r)}break a;case`textarea`:cn(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&sn(e,!!n.multiple,t,!1)}}}var wn=!1;function Tn(e,t,n){if(wn)return e(t,n);wn=!0;try{return e(t)}finally{if(wn=!1,(xn!==null||Sn!==null)&&(Kd(),xn&&(t=xn,e=Sn,Sn=xn=null,Cn(t),e)))for(t=0;t<e.length;t++)Cn(e[t])}}function En(e,t){var n=e.stateNode;if(n===null)return null;var r=n[St]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=e!==`button`&&e!==`input`&&e!==`select`&&e!==`textarea`),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(i(231,t,typeof n));return n}var Dn=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0,On=!1;if(Dn)try{var kn={};Object.defineProperty(kn,"passive",{get:function(){On=!0}}),window.addEventListener(`test`,kn,kn),window.removeEventListener(`test`,kn,kn)}catch{On=!1}var An=null,jn=null,Mn=null;function Nn(){if(Mn)return Mn;var e,t=jn,n=t.length,r,i=`value`in An?An.value:An.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return Mn=i.slice(e,1<r?1-r:void 0)}function Pn(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function Fn(){return!0}function In(){return!1}function Ln(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?Fn:In,this.isPropagationStopped=In,this}return T(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=Fn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=Fn)},persist:function(){},isPersistent:Fn}),t}var Rn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zn=Ln(Rn),Bn=T({},Rn,{view:0,detail:0}),Vn=Ln(Bn),Hn,Un,Wn,Gn=T({},Bn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:nr,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==Wn&&(Wn&&e.type===`mousemove`?(Hn=e.screenX-Wn.screenX,Un=e.screenY-Wn.screenY):Un=Hn=0,Wn=e),Hn)},movementY:function(e){return`movementY`in e?e.movementY:Un}}),Kn=Ln(Gn),qn=Ln(T({},Gn,{dataTransfer:0})),Jn=Ln(T({},Bn,{relatedTarget:0})),Yn=Ln(T({},Rn,{animationName:0,elapsedTime:0,pseudoElement:0})),Xn=Ln(T({},Rn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Zn=Ln(T({},Rn,{data:0})),Qn={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},$n={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`},er={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function tr(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=er[e])?!!t[e]:!1}function nr(){return tr}var rr=Ln(T({},Bn,{key:function(e){if(e.key){var t=Qn[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=Pn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?$n[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:nr,charCode:function(e){return e.type===`keypress`?Pn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?Pn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),ir=Ln(T({},Gn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),ar=Ln(T({},Rn,{submitter:0})),or=Ln(T({},Bn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:nr})),sr=Ln(T({},Rn,{propertyName:0,elapsedTime:0,pseudoElement:0})),cr=Ln(T({},Gn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),lr=Ln(T({},Rn,{newState:0,oldState:0,source:0})),ur=[9,13,27,32],dr=Dn&&`CompositionEvent`in window,fr=null;Dn&&`documentMode`in document&&(fr=document.documentMode);var pr=Dn&&`TextEvent`in window&&!fr,mr=Dn&&(!dr||fr&&8<fr&&11>=fr),hr=` `,gr=!1;function _r(e,t){switch(e){case`keyup`:return ur.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function vr(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var yr=!1;function br(e,t){switch(e){case`compositionend`:return vr(t);case`keypress`:return t.which===32?(gr=!0,hr):null;case`textInput`:return e=t.data,e===hr&&gr?null:e;default:return null}}function xr(e,t){if(yr)return e===`compositionend`||!dr&&_r(e,t)?(e=Nn(),Mn=jn=An=null,yr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return mr&&t.locale!==`ko`?null:t.data;default:return null}}var Sr={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 Cr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Sr[e.type]:t===`textarea`}function wr(e,t,n,r){xn?Sn?Sn.push(r):Sn=[r]:xn=r,t=rp(t,`onChange`),0<t.length&&(n=new zn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var Tr=null,Er=null;function Dr(e){Yf(e,0)}function Or(e){if(en(Nt(e)))return e}function kr(e,t){if(e===`change`)return t}var Ar=!1;if(Dn){var jr;if(Dn){var Mr=`oninput`in document;if(!Mr){var Nr=document.createElement(`div`);Nr.setAttribute(`oninput`,`return;`),Mr=typeof Nr.oninput==`function`}jr=Mr}else jr=!1;Ar=jr&&(!document.documentMode||9<document.documentMode)}function Pr(){Tr&&(Tr.detachEvent(`onpropertychange`,Fr),Er=Tr=null)}function Fr(e){if(e.propertyName===`value`&&Or(Er)){var t=[];wr(t,Er,e,bn(e)),Tn(Dr,t)}}function Ir(e,t,n){e===`focusin`?(Pr(),Tr=t,Er=n,Tr.attachEvent(`onpropertychange`,Fr)):e===`focusout`&&Pr()}function Lr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return Or(Er)}function Rr(e,t){if(e===`click`)return Or(t)}function zr(e,t){if(e===`input`||e===`change`)return Or(t)}function Br(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Vr=typeof Object.is==`function`?Object.is:Br;function Hr(e,t){if(Vr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!Ie.call(t,i)||!Vr(e[i],t[i]))return!1}return!0}function Ur(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function Wr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Gr(e,t){var n=Wr(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Wr(n)}}function Kr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Kr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function qr(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ur(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ur(e.document)}return t}function Jr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Yr=Dn&&`documentMode`in document&&11>=document.documentMode,Xr=null,Zr=null,Qr=null,$r=!1;function ei(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$r||Xr==null||Xr!==Ur(r)||(r=Xr,`selectionStart`in r&&Jr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Qr&&Hr(Qr,r)||(Qr=r,r=rp(Zr,`onSelect`),0<r.length&&(t=new zn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Xr)))}function ti(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var ni={animationend:ti(`Animation`,`AnimationEnd`),animationiteration:ti(`Animation`,`AnimationIteration`),animationstart:ti(`Animation`,`AnimationStart`),transitionrun:ti(`Transition`,`TransitionRun`),transitionstart:ti(`Transition`,`TransitionStart`),transitioncancel:ti(`Transition`,`TransitionCancel`),transitionend:ti(`Transition`,`TransitionEnd`)},ri={},ii={};Dn&&(ii=document.createElement(`div`).style,`AnimationEvent`in window||(delete ni.animationend.animation,delete ni.animationiteration.animation,delete ni.animationstart.animation),`TransitionEvent`in window||delete ni.transitionend.transition);function ai(e){if(ri[e])return ri[e];if(!ni[e])return e;var t=ni[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in ii)return ri[e]=t[n];return e}var oi=ai(`animationend`),si=ai(`animationiteration`),ci=ai(`animationstart`),li=ai(`transitionrun`),ui=ai(`transitionstart`),di=ai(`transitioncancel`),fi=ai(`transitionend`),pi=new Map,R=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError 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(` `);R.push(`scrollEnd`);function mi(e,t){pi.set(e,t),zt(t,[e])}var hi=0;function gi(e,t){if(e.name!=null&&e.name!==`auto`)return e.name;if(t.autoName!==null)return t.autoName;e=Od.identifierPrefix;var n=hi++;return e=`_`+e+`t_`+n.toString(32)+`_`,t.autoName=e}function _i(e){if(e==null||typeof e==`string`)return e;var t=null,n=H;if(n!==null)for(var r=0;r<n.length;r++){var i=e[n[r]];if(i!=null){if(i===`none`)return`none`;t=t==null?i:t+(` `+i)}}return t??e.default}function vi(e,t){return e=_i(e),t=_i(t),t==null?e===`auto`?null:e:t===`auto`?null:t}var yi=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},bi=[],xi=0,Si=0;function Ci(){for(var e=xi,t=Si=xi=0;t<e;){var n=bi[t];bi[t++]=null;var r=bi[t];bi[t++]=null;var i=bi[t];bi[t++]=null;var a=bi[t];if(bi[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Di(n,i,a)}}function wi(e,t,n,r){bi[xi++]=e,bi[xi++]=t,bi[xi++]=n,bi[xi++]=r,Si|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Ti(e,t,n,r){return wi(e,t,n,r),Oi(e)}function Ei(e,t){return wi(e,null,null,t),Oi(e)}function Di(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-L(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Oi(e){if(50<Id)throw Id=0,Ld=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var ki={};function Ai(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ji(e,t,n,r){return new Ai(e,t,n,r)}function Mi(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Ni(e,t){var n=e.alternate;return n===null?(n=ji(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&1206910976,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function Pi(e,t){e.flags&=1206910978;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function Fi(e,t,n,r,a,o){var s=0;if(r=e,typeof r==`function`)Mi(r)&&(s=1);else if(typeof r==`string`)s=nh(e,n,xe.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(r){case ie:return e=ji(31,n,t,a),e.elementType=ie,e.lanes=o,e;case k:return Ii(n.children,a,o,t);case A:s=8,a|=24;break;case j:return e=ji(12,n,t,a|2),e.elementType=j,e.lanes=o,e;case P:return e=ji(13,n,t,a),e.elementType=P,e.lanes=o,e;case te:return e=ji(19,n,t,a),e.elementType=te,e.lanes=o,e;case ae:case se:return e=a|32,e=ji(30,n,t,e),e.elementType=se,e.lanes=o,e.stateNode={autoName:null,paired:null,clones:null,ref:null},e;default:if(typeof r==`object`&&r)switch(r.$$typeof){case N:s=10;break a;case M:s=9;break a;case ee:s=11;break a;case ne:s=14;break a;case re:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ji(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function Ii(e,t,n,r){return e=ji(7,e,r,t),e.lanes=n,e}function Li(e,t,n){return e=ji(6,e,null,t),e.lanes=n,e}function Ri(e){var t=ji(18,null,null,0);return t.stateNode=e,t}function zi(e,t,n){return t=ji(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Bi=new WeakMap;function Vi(e,t){if(typeof e==`object`&&e){var n=Bi.get(e);return n===void 0?(t={value:e,source:t,stack:Fe(t)},Bi.set(e,t),t):n}return{value:e,source:t,stack:Fe(t)}}var Hi=[],Ui=0,Wi=null,Gi=0,Ki=[],qi=0,Ji=null,Yi=1,z=``;function Xi(e,t){Hi[Ui++]=Gi,Hi[Ui++]=Wi,Wi=e,Gi=t}function Zi(e,t,n){Ki[qi++]=Yi,Ki[qi++]=z,Ki[qi++]=Ji,Ji=e;var r=Yi;e=z;var i=32-L(r)-1;r&=~(1<<i),n+=1;var a=32-L(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Yi=1<<32-L(t)+i|n<<i|r,z=a+e}else Yi=1<<a|n<<i|r,z=e}function B(e){e.return!==null&&(Xi(e,1),Zi(e,1,0))}function Qi(e){for(;e===Wi;)Wi=Hi[--Ui],Hi[Ui]=null,Gi=Hi[--Ui],Hi[Ui]=null;for(;e===Ji;)Ji=Ki[--qi],Ki[qi]=null,z=Ki[--qi],Ki[qi]=null,Yi=Ki[--qi],Ki[qi]=null}function $i(e,t){Ki[qi++]=Yi,Ki[qi++]=z,Ki[qi++]=Ji,Yi=t.id,z=t.overflow,Ji=e}var ea=null,ta=null,ra=!1,ia=null,aa=!1,oa=Error(i(519));function sa(e){throw pa(Vi(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),oa}function ca(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[xt]=e,t[St]=r,n){case`dialog`:Xf(`cancel`,t),Xf(`close`,t);break;case`iframe`:case`object`:case`embed`:Xf(`load`,t);break;case`video`:case`audio`:for(n=0;n<qf.length;n++)Xf(qf[n],t);break;case`source`:Xf(`error`,t);break;case`img`:case`image`:case`link`:Xf(`error`,t),Xf(`load`,t);break;case`details`:Xf(`toggle`,t);break;case`input`:Xf(`invalid`,t),an(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Xf(`invalid`,t);break;case`textarea`:Xf(`invalid`,t),ln(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||lp(t.textContent,n)?(r.popover!=null&&(Xf(`beforetoggle`,t),Xf(`toggle`,t)),r.onScroll!=null&&Xf(`scroll`,t),r.onScrollEnd!=null&&Xf(`scrollend`,t),r.onClick!=null&&(t.onclick=vn),t=!0):t=!1,t||sa(e,!0)}function la(e){for(ea=e.return;ea;)switch(ea.tag){case 5:case 31:case 13:aa=!1;return;case 27:case 3:aa=!0;return;default:ea=ea.return}}function ua(e){if(e!==ea)return!1;if(!ra)return la(e),ra=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=n===`form`||n===`button`||Cp(e.type,e.memoizedProps)),n=!n),n&&ta&&sa(e),la(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ta=bm(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));ta=bm(e)}else t===27?(t=ta,Mp(e.type)?(e=ym,ym=null,ta=e):ta=t):ta=ea?vm(e.stateNode.nextSibling):null;return!0}function da(){ta=ea=null,ra=!1}function fa(){var e=ia;return e!==null&&(bd===null?bd=e:bd.push.apply(bd,e),ia=null),e}function pa(e){ia===null?ia=[e]:ia.push(e)}var ma=ve(null),ha=null,ga=null;function _a(e,t,n){be(ma,t._currentValue),t._currentValue=n}function va(e){e._currentValue=ma.current,ye(ma)}function ya(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function ba(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),ya(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),ya(s,n,e),s=null}else a.tag===13&&a.memoizedState!==null&&a.memoizedState.dehydrated===null?(a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),ya(a.return,n,e),s=a.child,s=s===null?null:s.sibling):s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function xa(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Vr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===we.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[gh]:e.push(gh))}a=a.return}return e!==null&&ba(t,e,n,r),t.flags|=262144,e!==null}function Sa(e){for(e=e.firstContext;e!==null;){if(!Vr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Ca(e){ha=e,ga=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function wa(e){return Ea(ha,e)}function Ta(e,t){return ha===null&&Ca(e),Ea(e,t)}function Ea(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},ga===null){if(e===null)throw Error(i(308));ga=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else ga=ga.next=t;return n}var Da=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Oa=t.unstable_scheduleCallback,ka=t.unstable_NormalPriority,Aa={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ja(){return{controller:new Da,data:new Map,refCount:0}}function Ma(e){e.refCount--,e.refCount===0&&Oa(ka,function(){e.controller.abort()})}function Na(e,t){if(e.pendingLanes&4194048){var n=e.transitionTypes;for(n===null&&(n=e.transitionTypes=[]),e=0;e<t.length;e++){var r=t[e];n.indexOf(r)===-1&&n.push(r)}}}var Pa=null;function Fa(e){var t=e.transitionTypes;return e.transitionTypes=null,t}var Ia=null,La=0,Ra=0,za=null;function Ba(e,t){if(Ia===null){var n=Ia=[];La=0,Ra=Hf(),za={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return La++,t.then(Va,Va),t}function Va(){if(--La===0&&(Pa=null,Ia!==null)){za!==null&&(za.status=`fulfilled`);var e=Ia;Ia=null,Ra=0,za=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function Ha(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var Ua=F.S;F.S=function(e,t){if(Cd=Ve(),typeof t==`object`&&t&&typeof t.then==`function`&&Ba(e,t),Pa!==null)for(var n=Of;n!==null;)Na(n,Pa),n=n.next;if(n=e.types,n!==null){for(var r=Of;r!==null;)Na(r,n),r=r.next;if(Ra!==0){r=Pa,r===null&&(r=Pa=[]);for(var i=0;i<n.length;i++){var a=n[i];r.indexOf(a)===-1&&r.push(a)}}}Ua!==null&&Ua(e,t)};var Wa=ve(null);function Ga(){var e=Wa.current;return e===null?id.pooledCache:e}function Ka(e,t){t===null?be(Wa,Wa.current):be(Wa,t.pool)}function qa(){var e=Ga();return e===null?null:{parent:Aa._currentValue,pool:e}}var Ja=Error(i(460)),Ya=Error(i(474)),Xa=Error(i(542)),Za={then:function(){}};function Qa(e){return e=e.status,e===`fulfilled`||e===`rejected`}function $a(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(vn,vn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ro(e),e===void 0&&!(`reason`in t)?Error(i(600)):e;default:if(typeof t.status==`string`)t.then(vn,vn);else{if(e=id,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,ro(e),e}throw to=t,Ja}}function eo(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(to=e,Ja):e}}var to=null;function no(){if(to===null)throw Error(i(459));var e=to;return to=null,e}function ro(e){if(e===Ja||e===Xa)throw Error(i(483))}var io=null,ao=0;function oo(e){var t=ao;return ao+=1,io===null&&(io=[]),$a(io,e,t)}function so(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function co(e,t){throw t.$$typeof===E?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function lo(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function a(e,t){return e=Ni(e,t),e.index=0,e.sibling=null,e}function o(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=134217730,n):(r=r.index,r<n?(t.flags|=2,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=134217730),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=Li(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===k?(e=d(e,t,n.props.children,r,n.key),so(e,n),e):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===re&&eo(i)===t.type)?(t=a(t,n.props),so(t,n),t.return=e,t):(t=Fi(n.type,n.key,n.props,null,e.mode,r),so(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=zi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=Ii(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=Li(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case D:return n=Fi(t.type,t.key,t.props,null,e.mode,n),so(n,t),n.return=e,n;case O:return t=zi(t,e.mode,n),t.return=e,t;case re:return t=eo(t),f(e,t,n)}if(pe(t)||ue(t))return t=Ii(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,oo(t),n);if(t.$$typeof===N)return f(e,Ta(e,t),n);co(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case D:return n.key===i?l(e,t,n,r):null;case O:return n.key===i?u(e,t,n,r):null;case re:return n=eo(n),p(e,t,n,r)}if(pe(n)||ue(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,oo(n),r);if(n.$$typeof===N)return p(e,t,Ta(e,n),r);co(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case D:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case O:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case re:return r=eo(r),m(e,t,n,r,i)}if(pe(r)||ue(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,oo(r),i);if(r.$$typeof===N)return m(e,t,n,Ta(t,r),i);co(t,r)}return null}function h(i,a,s,c){for(var l=null,u=null,d=a,h=a=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),ra&&Xi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return ra&&Xi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&(_=g.alternate,_!==null&&d.delete(_.key===null?h:_.key)),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),ra&&Xi(i,h),l}function g(a,s,c,l){if(c==null)throw Error(i(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),ra&&Xi(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return ra&&Xi(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&(_=v.alternate,_!==null&&h.delete(_.key===null?g:_.key)),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),ra&&Xi(a,g),u}function _(e,r,o,c){if(typeof o==`object`&&o&&o.type===k&&o.key===null&&o.props.ref===void 0&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case D:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===k){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),so(c,o),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===re&&eo(l)===r.type){n(e,r.sibling),c=a(r,o.props),so(c,o),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}o.type===k?(c=Ii(o.props.children,e.mode,c,o.key),so(c,o),c.return=e,e=c):(c=Fi(o.type,o.key,o.props,null,e.mode,c),so(c,o),c.return=e,e=c)}return s(e);case O:a:{for(l=o.key;r!==null;){if(r.key===l){if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}n(e,r);break}t(e,r),r=r.sibling}c=zi(o,e.mode,c),c.return=e,e=c}return s(e);case re:return o=eo(o),_(e,r,o,c)}if(pe(o))return h(e,r,o,c);if(ue(o)){if(l=ue(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),g(e,r,o,c)}if(typeof o.then==`function`)return _(e,r,oo(o),c);if(o.$$typeof===N)return _(e,r,Ta(e,o),c);co(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=Li(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{ao=0;var i=_(e,t,n,r);return io=null,i}catch(t){if(t===Ja||t===Xa)throw t;var a=ji(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var uo=lo(!0),fo=lo(!1),po=!1;function mo(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ho(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function go(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function _o(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,rd&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Oi(e),Di(e,null,n),t}return wi(e,r,t,n),Oi(e)}function vo(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,mt(e,n)}}function yo(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var bo=!1;function xo(){if(bo){var e=za;if(e!==null)throw e}}function So(e,t,n,r){bo=!1;var i=e.updateQueue;po=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(od&f)===f:(r&f)===f){f!==0&&f===Ra&&(bo=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var m=e,h=s;f=t;var g=n;switch(h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(g,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(g,d,f):m,f==null)break a;d=T({},d,f);break a;case 2:po=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),md|=o,e.lanes=o,e.memoizedState=d}}function Co(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function wo(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Co(n[e],t)}var To=ve(null),Eo=ve(0);function Do(e,t){e=fd,be(Eo,e),be(To,t),fd=e|t.baseLanes}function Oo(){be(Eo,fd),be(To,To.current)}function ko(){fd=Eo.current,ye(To),ye(Eo)}var Ao=ve(null),jo=null;function Mo(e){var t=e.alternate;be(Lo,Lo.current&1),be(Ao,e),jo===null&&(t===null||To.current!==null||t.memoizedState!==null)&&(jo=e)}function No(e){be(Lo,Lo.current),be(Ao,e),jo===null&&(jo=e)}function Po(e){e.tag===22?(be(Lo,Lo.current),be(Ao,e),jo===null&&(jo=e)):Fo()}function Fo(){be(Lo,Lo.current),be(Ao,Ao.current)}function Io(e){ye(Ao),jo===e&&(jo=null),ye(Lo)}var Lo=ve(0);function Ro(e,t){be(Ao,Ao.current),be(Lo,t)}function zo(e){ye(Lo),ye(Ao),jo===e&&(jo=null)}function Bo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||hm(n)||gm(n)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==`independent`){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Vo=0,Ho=null,Uo=null,Wo=null,Go=!1,Ko=!1,qo=!1,Jo=0,Yo=0,Xo=null,Zo=0;function Qo(){throw Error(i(321))}function $o(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Vr(e[n],t[n]))return!1;return!0}function es(e,t,n,r,i,a){return Vo=a,Ho=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,F.H=e===null||e.memoizedState===null?_c:vc,qo=!1,a=n(r,i),qo=!1,Ko&&(a=ns(t,n,r,i)),ts(e),a}function ts(e){F.H=gc;var t=Uo!==null&&Uo.next!==null;if(Vo=0,Wo=Uo=Ho=null,Go=!1,Yo=0,Xo=null,t)throw Error(i(300));e===null||Fc||(e=e.dependencies,e!==null&&Sa(e)&&(Fc=!0))}function ns(e,t,n,r){Ho=e;var a=0;do{if(Ko&&(Xo=null),Yo=0,Ko=!1,25<=a)throw Error(i(301));if(a+=1,Wo=Uo=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}F.H=yc,o=t(n,r)}while(Ko);return o}function rs(){var e=F.H,t=e.useState()[0];return t=typeof t.then==`function`?us(t):t,e=e.useState()[0],(Uo===null?null:Uo.memoizedState)!==e&&(Ho.flags|=1024),t}function is(){var e=Jo!==0;return Jo=0,e}function as(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function os(e){if(Go){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Go=!1}Vo=0,Wo=Uo=Ho=null,Ko=!1,Yo=Jo=0,Xo=null}function ss(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Wo===null?Ho.memoizedState=Wo=e:Wo=Wo.next=e,Wo}function cs(){if(Uo===null){var e=Ho.alternate;e=e===null?null:e.memoizedState}else e=Uo.next;var t=Wo===null?Ho.memoizedState:Wo.next;if(t!==null)Wo=t,Uo=e;else{if(e===null)throw Ho.alternate===null?Error(i(467)):Error(i(310));Uo=e,e={memoizedState:Uo.memoizedState,baseState:Uo.baseState,baseQueue:Uo.baseQueue,queue:Uo.queue,next:null},Wo===null?Ho.memoizedState=Wo=e:Wo=Wo.next=e}return Wo}function ls(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function us(e){var t=Yo;return Yo+=1,Xo===null&&(Xo=[]),e=$a(Xo,e,t),t=Ho,(Wo===null?t.memoizedState:Wo.next)===null&&(t=t.alternate,F.H=t===null||t.memoizedState===null?_c:vc),e}function ds(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return us(e);if(e.$$typeof===ce)return;if(e.$$typeof===N)return wa(e)}throw Error(i(438,String(e)))}function fs(e){var t=null,n=Ho.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=Ho.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=ls(),Ho.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=oe;return t.index++,n}function ps(e,t){return typeof t==`function`?t(e):t}function ms(e){return hs(cs(),Uo,e)}function hs(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(Vo&f)===f:(od&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===Ra&&(d=!0);else if((Vo&p)===p){u=u.next,p===Ra&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=o):l=l.next=f,Ho.lanes|=p,md|=p;f=u.action,qo&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=o):l=l.next=p,Ho.lanes|=f,md|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Vr(o,e.memoizedState)&&(Fc=!0,d&&(n=za,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function gs(e){var t=cs(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Vr(o,t.memoizedState)||(Fc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function _s(e,t,n){var r=Ho,a=cs(),o=ra;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Vr((Uo||a).memoizedState,n);if(s&&(a.memoizedState=n,Fc=!0),a=a.queue,Hs(bs.bind(null,r,a,e),[e]),e=a.getSnapshot!==t||s||Wo!==null&&!!(Wo.memoizedState.tag&1),Ls(e?9:8,{destroy:void 0},ys.bind(null,r,a,n,t),null),e){if(r.flags|=2048,id===null)throw Error(i(349));o||Vo&127||vs(r,t,n)}return n}function vs(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=Ho.updateQueue,t===null?(t=ls(),Ho.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function ys(e,t,n,r){t.value=n,t.getSnapshot=r,xs(t)&&Ss(e)}function bs(e,t,n){return n(function(){xs(t)&&Ss(e)})}function xs(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Vr(e,n)}catch{return!0}}function Ss(e){var t=Ei(e,2);t!==null&&Vd(t,e,2)}function Cs(e){var t=ss();if(typeof e==`function`){var n=e;if(e=n(),qo){Ze(!0);try{n()}finally{Ze(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:e},t}function ws(e,t,n,r){return e.baseState=n,hs(e,Uo,typeof r==`function`?r:ps)}function Ts(e,t,n,r,a){if(pc(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};F.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Es(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Es(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=F.T,o={};o.types=a===null?null:a.types,F.T=o;try{var s=n(i,r),c=F.S;c!==null&&c(o,s),Ds(e,t,s)}catch(n){ks(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),F.T=a}}else try{a=n(i,r),Ds(e,t,a)}catch(n){ks(e,t,n)}}function Ds(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Os(e,t,n)},function(n){return ks(e,t,n)}):Os(e,t,n)}function Os(e,t,n){t.status=`fulfilled`,t.value=n,As(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Es(e,n)))}function ks(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,As(t),t=t.next;while(t!==r)}e.action=null}function As(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function js(e,t){return t}function Ms(e,t){if(ra){var n=id.formState;if(n!==null){a:{var r=Ho;if(ra){if(ta){b:{for(var i=ta,a=aa;i.nodeType!==8;){if(!a){i=null;break b}if(i=vm(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){ta=vm(i.nextSibling),r=i.data===`F!`;break a}}sa(r)}r=!1}r&&(t=n[0])}}return n=ss(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:js,lastRenderedState:t},n.queue=r,n=uc.bind(null,Ho,r),r.dispatch=n,r=Cs(!1),a=fc.bind(null,Ho,!1,r.queue),r=ss(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=Ts.bind(null,Ho,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Ns(e){return Ps(cs(),Uo,e)}function Ps(e,t,n){if(t=hs(e,t,js)[0],e=ms(ps)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=us(t)}catch(e){throw e===Ja?Xa:e}else r=t;t=cs();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(Ho.flags|=2048,Ls(9,{destroy:void 0},Fs.bind(null,i,n),null)),[r,a,e]}function Fs(e,t){e.action=t}function Is(e){var t=cs(),n=Uo;if(n!==null)return Ps(t,n,e);cs(),t=t.memoizedState,n=cs();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function Ls(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=Ho.updateQueue,t===null&&(t=ls(),Ho.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function Rs(){return cs().memoizedState}function zs(e,t,n,r){var i=ss();Ho.flags|=e,i.memoizedState=Ls(1|t,{destroy:void 0},n,r===void 0?null:r)}function Bs(e,t,n,r){var i=cs();r=r===void 0?null:r;var a=i.memoizedState.inst;Uo!==null&&r!==null&&$o(r,Uo.memoizedState.deps)?i.memoizedState=Ls(t,a,n,r):(Ho.flags|=e,i.memoizedState=Ls(1|t,a,n,r))}function Vs(e,t){zs(8390656,8,e,t)}function Hs(e,t){Bs(2048,8,e,t)}function Us(e){Ho.flags|=4;var t=Ho.updateQueue;if(t===null)t=ls(),Ho.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function Ws(e){var t=cs().memoizedState;return Us({ref:t,nextImpl:e}),function(){if(rd&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function Gs(e,t){return Bs(4,2,e,t)}function Ks(e,t){return Bs(4,4,e,t)}function qs(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Js(e,t,n){n=n==null?null:n.concat([e]),Bs(4,4,qs.bind(null,t,e),n)}function Ys(){}function Xs(e,t){var n=cs();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&$o(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function Zs(e,t){var n=cs();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&$o(t,r[1]))return r[0];if(r=e(),qo){Ze(!0);try{e()}finally{Ze(!1)}}return n.memoizedState=[r,t],r}function Qs(e,t,n){return n===void 0||Vo&1073741824&&!(od&261930)?e.memoizedState=t:(e.memoizedState=n,e=zd(),Ho.lanes|=e,md|=e,n)}function $s(e,t,n,r){return Vr(n,t)?n:To.current===null?!(Vo&106)||Vo&1073741824&&!(od&261930)?(Fc=!0,e.memoizedState=n):(e=zd(),Ho.lanes|=e,md|=e,t):(e=Qs(e,n,r),Vr(e,t)||(Fc=!0),e)}function ec(e,t,n,r,i){var a=me.p;me.p=a!==0&&8>a?a:8;var o=F.T,s={};s.types=o===null?null:o.types,F.T=s,fc(e,!1,t,n);try{var c=i(),l=F.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?dc(e,t,Ha(c,r),Rd(e)):dc(e,t,r,Rd(e))}catch(n){dc(e,t,{then:function(){},status:`rejected`,reason:n},Rd())}finally{me.p=a,o!==null&&s.types!==null&&(o.types=s.types),F.T=o}}function tc(){}function nc(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=rc(e).queue;ec(e,a,t,he,n===null?tc:function(){return ic(e),n(r)})}function rc(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:he,baseState:he,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:he},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ps,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function ic(e){var t=rc(e);t.next===null&&(t=e.alternate.memoizedState),dc(e,t.next.queue,{},Rd())}function ac(){return wa(gh)}function oc(){return cs().memoizedState}function sc(){return cs().memoizedState}function cc(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=Rd();e=go(n);var r=_o(t,e,n);r!==null&&(Vd(r,t,n),vo(r,t,n)),t={cache:ja()},e.payload=t;return}t=t.return}}function lc(e,t,n){var r=Rd();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},pc(e)?mc(t,n):(n=Ti(e,t,n,r),n!==null&&(Vd(n,e,r),hc(n,t,r)))}function uc(e,t,n){dc(e,t,n,Rd())}function dc(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(pc(e))mc(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Vr(s,o))return wi(e,t,i,0),id===null&&Ci(),!1}catch{}if(n=Ti(e,t,i,r),n!==null)return Vd(n,e,r),hc(n,t,r),!0}return!1}function fc(e,t,n,r){if(r={lane:2,revertLane:Hf(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},pc(e)){if(t)throw Error(i(479))}else t=Ti(e,n,r,2),t!==null&&Vd(t,e,2)}function pc(e){var t=e.alternate;return e===Ho||t!==null&&t===Ho}function mc(e,t){Ko=Go=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function hc(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,mt(e,n)}}var gc={readContext:wa,use:ds,useCallback:Qo,useContext:Qo,useEffect:Qo,useImperativeHandle:Qo,useLayoutEffect:Qo,useInsertionEffect:Qo,useMemo:Qo,useReducer:Qo,useRef:Qo,useState:Qo,useDebugValue:Qo,useDeferredValue:Qo,useTransition:Qo,useSyncExternalStore:Qo,useId:Qo,useHostTransitionStatus:Qo,useFormState:Qo,useActionState:Qo,useOptimistic:Qo,useMemoCache:Qo,useCacheRefresh:Qo,useEffectEvent:Qo},_c={readContext:wa,use:ds,useCallback:function(e,t){return ss().memoizedState=[e,t===void 0?null:t],e},useContext:wa,useEffect:Vs,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),zs(4194308,4,qs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return zs(4194308,4,e,t)},useInsertionEffect:function(e,t){zs(4,2,e,t)},useMemo:function(e,t){var n=ss();t=t===void 0?null:t;var r=e();if(qo){Ze(!0);try{e()}finally{Ze(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=ss();if(n!==void 0){var i=n(t);if(qo){Ze(!0);try{n(t)}finally{Ze(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=lc.bind(null,Ho,e),[r.memoizedState,e]},useRef:function(e){var t=ss();return e={current:e},t.memoizedState=e},useState:function(e){e=Cs(e);var t=e.queue,n=uc.bind(null,Ho,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:Ys,useDeferredValue:function(e,t){return Qs(ss(),e,t)},useTransition:function(){var e=Cs(!1);return e=ec.bind(null,Ho,e.queue,!0,!1),ss().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Ho,a=ss();if(ra){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),id===null)throw Error(i(349));od&127||vs(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Vs(bs.bind(null,r,o,e),[e]),r.flags|=2048,Ls(9,{destroy:void 0},ys.bind(null,r,o,n,t),null),n},useId:function(){var e=ss(),t=id.identifierPrefix;if(ra){var n=z,r=Yi;n=(r&~(1<<32-L(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=Jo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=Zo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:ac,useFormState:Ms,useActionState:Ms,useOptimistic:function(e){var t=ss();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=fc.bind(null,Ho,!0,n),n.dispatch=t,[e,t]},useMemoCache:fs,useCacheRefresh:function(){return ss().memoizedState=cc.bind(null,Ho)},useEffectEvent:function(e){var t=ss(),n={impl:e};return t.memoizedState=n,function(){if(rd&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},vc={readContext:wa,use:ds,useCallback:Xs,useContext:wa,useEffect:Hs,useImperativeHandle:Js,useInsertionEffect:Gs,useLayoutEffect:Ks,useMemo:Zs,useReducer:ms,useRef:Rs,useState:function(){return ms(ps)},useDebugValue:Ys,useDeferredValue:function(e,t){return $s(cs(),Uo.memoizedState,e,t)},useTransition:function(){var e=ms(ps)[0],t=cs().memoizedState;return[typeof e==`boolean`?e:us(e),t]},useSyncExternalStore:_s,useId:oc,useHostTransitionStatus:ac,useFormState:Ns,useActionState:Ns,useOptimistic:function(e,t){return ws(cs(),Uo,e,t)},useMemoCache:fs,useCacheRefresh:sc,useEffectEvent:Ws},yc={readContext:wa,use:ds,useCallback:Xs,useContext:wa,useEffect:Hs,useImperativeHandle:Js,useInsertionEffect:Gs,useLayoutEffect:Ks,useMemo:Zs,useReducer:gs,useRef:Rs,useState:function(){return gs(ps)},useDebugValue:Ys,useDeferredValue:function(e,t){var n=cs();return Uo===null?Qs(n,e,t):$s(n,Uo.memoizedState,e,t)},useTransition:function(){var e=gs(ps)[0],t=cs().memoizedState;return[typeof e==`boolean`?e:us(e),t]},useSyncExternalStore:_s,useId:oc,useHostTransitionStatus:ac,useFormState:Is,useActionState:Is,useOptimistic:function(e,t){var n=cs();return Uo===null?(n.baseState=e,[e,n.queue.dispatch]):ws(n,Uo,e,t)},useMemoCache:fs,useCacheRefresh:sc,useEffectEvent:Ws};function bc(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:T({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var xc={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=Rd(),i=go(r);i.payload=t,n!=null&&(i.callback=n),t=_o(e,i,r),t!==null&&(Vd(t,e,r),vo(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=Rd(),i=go(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=_o(e,i,r),t!==null&&(Vd(t,e,r),vo(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=Rd(),r=go(n);r.tag=2,t!=null&&(r.callback=t),t=_o(e,r,n),t!==null&&(Vd(t,e,n),vo(t,e,n))}};function Sc(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!Hr(n,r)||!Hr(i,a):!0}function Cc(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&xc.enqueueReplaceState(t,t.state,null)}function wc(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=T({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Tc(e){yi(e)}function Ec(e){console.error(e)}function Dc(e){yi(e)}function Oc(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function kc(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function Ac(e,t,n){return n=go(n),n.tag=3,n.payload={element:null},n.callback=function(){Oc(e,t)},n}function jc(e){return e=go(e),e.tag=3,e}function Mc(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){kc(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){kc(t,n,r),typeof i!=`function`&&(Ed===null?Ed=new Set([this]):Ed.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Nc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&xa(t,n,a,!0),n=Ao.current,n!==null){switch(n.tag){case 31:case 13:case 19:return jo===null?$d():n.alternate===null&&pd===0&&(pd=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===Za?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Sf(e,r,a)),!1;case 22:return n.flags|=65536,r===Za?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Sf(e,r,a)),!1}throw Error(i(435,n.tag))}return Sf(e,r,a),$d(),!1}if(ra)return t=Ao.current,t===null?(r!==oa&&(t=Error(i(423),{cause:r}),pa(Vi(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=Vi(r,n),a=Ac(e.stateNode,r,a),yo(e,a),pd!==4&&(pd=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==oa&&(e=Error(i(422),{cause:r}),pa(Vi(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=Vi(o,n),yd===null?yd=[o]:yd.push(o),pd!==4&&(pd=2),t===null)return!0;r=Vi(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Ac(n.stateNode,r,e),yo(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(Ed===null||!Ed.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=jc(a),Mc(a,e,n,r),yo(n,a),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var Pc=Error(i(461)),Fc=!1;function Ic(e,t,n,r){t.child=e===null?fo(t,null,n,r):uo(t,e.child,n,r)}function Lc(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return Ca(t),r=es(e,t,n,o,a,i),s=is(),e!==null&&!Fc?(as(e,t,i),dl(e,t,i)):(ra&&s&&B(t),t.flags|=1,Ic(e,t,r,i),t.child)}function Rc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!Mi(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,zc(e,t,a,r,i)):(e=Fi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!fl(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?Hr:n,n(o,r)&&e.ref===t.ref)return dl(e,t,i)}return t.flags|=1,e=Ni(a,r),e.ref=t.ref,e.return=t,t.child=e}function zc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(Hr(a,r)&&e.ref===t.ref){if(Fc=!1,t.pendingProps=r=a,fl(e,i))e.flags&131072&&(Fc=!0);else return t.lanes=e.lanes,dl(e,t,i)}}return qc(e,t,n,r,i)}function Bc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return Hc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Ka(t,a===null?null:a.cachePool),a===null?Oo():Do(t,a),Po(t);else return r=t.lanes=536870912,Hc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&Ka(t,null),Oo(),Fo()):(Ka(t,a.cachePool),Do(t,a),Fo(),t.memoizedState=null);return Ic(e,t,i,n),t.child}function Vc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function Hc(e,t,n,r,i){var a=Ga();return a=a===null?null:{parent:Aa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&Ka(t,null),Oo(),Po(t),e!==null&&xa(e,t,r,!0),t.childLanes=i,null}function Uc(e,t){return t=nl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Wc(e,t,n){return uo(t,e.child,null,n),e=Uc(t,t.pendingProps),e.flags|=2,Io(t),t.memoizedState=null,e}function Gc(e,t,n){var r=t.pendingProps,a=!!(t.flags&128);if(t.flags&=-129,e===null){if(ra){if(r.mode===`hidden`)return e=Uc(t,r),t.lanes=536870912,e.memoizedState={baseLanes:0,cachePool:null},Vc(null,e);if(No(t),(e=ta)?(e=mm(e,aa),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ji===null?null:{id:Yi,overflow:z},retryLane:536870912,hydrationErrors:null},n=Ri(e),n.return=t,t.child=n,ea=t,ta=null)):e=null,e===null)throw sa(t);return t.lanes=536870912,null}return Uc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(No(t),a){if(t.flags&256)t.flags&=-257,t=Wc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558))}else if(Fc||xa(e,t,n,!1),a=(n&e.childLanes)!==0,Fc||a){if(To.current===null){if(r=id,r!==null&&(s=ht(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,Ei(e,s),Vd(r,e,s),Pc;$d()}t=Wc(e,t,n)}else e=o.treeContext,ta=vm(s.nextSibling),ea=t,ra=!0,ia=null,aa=!1,e!==null&&$i(t,e),t=Uc(t,r),t.flags|=134221824;return t}return e=Ni(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Kc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function qc(e,t,n,r,i){return Ca(t),n=es(e,t,n,r,void 0,i),r=is(),e!==null&&!Fc?(as(e,t,i),dl(e,t,i)):(ra&&r&&B(t),t.flags|=1,Ic(e,t,n,i),t.child)}function Jc(e,t,n,r,i,a){return Ca(t),t.updateQueue=null,n=ns(t,r,n,i),ts(e),r=is(),e!==null&&!Fc?(as(e,t,a),dl(e,t,a)):(ra&&r&&B(t),t.flags|=1,Ic(e,t,n,a),t.child)}function Yc(e,t,n,r,i){if(Ca(t),t.stateNode===null){var a=ki,o=n.contextType;typeof o==`object`&&o&&(a=wa(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=xc,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},mo(t),o=n.contextType,a.context=typeof o==`object`&&o?wa(o):ki,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(bc(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&xc.enqueueReplaceState(a,a.state,null),So(t,r,a,i),xo(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=wc(n,s);a.props=c;var l=a.context,u=n.contextType;o=ki,typeof u==`object`&&u&&(o=wa(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Cc(t,a,r,o),po=!1;var f=t.memoizedState;a.state=f,So(t,r,a,i),xo(),l=t.memoizedState,s||f!==l||po?(typeof d==`function`&&(bc(t,n,d,r),l=t.memoizedState),(c=po||Sc(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,ho(e,t),o=t.memoizedProps,u=wc(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=ki,typeof l==`object`&&l&&(c=wa(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Cc(t,a,r,c),po=!1,f=t.memoizedState,a.state=f,So(t,r,a,i),xo();var p=t.memoizedState;o!==d||f!==p||po||e!==null&&e.dependencies!==null&&Sa(e.dependencies)?(typeof s==`function`&&(bc(t,n,s,r),p=t.memoizedState),(u=po||Sc(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Sa(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,Kc(e,t),r=!!(t.flags&128),a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=uo(t,e.child,null,i),t.child=uo(t,null,n,i)):Ic(e,t,n,i),t.memoizedState=a.state,e=t.child):e=dl(e,t,i),e}function Xc(e,t,n,r){return da(),t.flags|=256,Ic(e,t,n,r),t.child}var Zc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Qc(e){return{baseLanes:e,cachePool:qa()}}function $c(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=_d),e}function el(e,t,n){var r=t.pendingProps,i=!1,a=!!(t.flags&128),o;if((o=a)||(o=e!==null&&e.memoizedState===null?!1:!!(Lo.current&2)),o&&(i=!0,t.flags&=-129),o=!!(t.flags&32),t.flags&=-33,e===null){if(ra){if(i?Mo(t):Fo(),(e=ta)?(e=mm(e,aa),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:Ji===null?null:{id:Yi,overflow:z},retryLane:536870912,hydrationErrors:null},n=Ri(e),n.return=t,t.child=n,ea=t,ta=null)):e=null,e===null)throw sa(t);return t.lanes=gm(e)?32:536870912,null}return a=r.children,r=r.fallback,i?(Fo(),i=t.mode,a=nl({mode:`hidden`,children:a},i),r=Ii(r,i,n,null),a.return=t,r.return=t,a.sibling=r,t.child=a,r=t.child,r.memoizedState=Qc(n),r.childLanes=$c(e,o,n),t.memoizedState=Zc,Vc(null,r)):(Mo(t),tl(t,a))}var s=e.memoizedState;if(s!==null){var c=s.dehydrated;if(c!==null)return il(e,t,a,o,r,c,s,n)}return i?(Fo(),i=r.fallback,a=t.mode,s=e.child,c=s.sibling,r=Ni(s,{mode:`hidden`,children:r.children}),r.subtreeFlags=s.subtreeFlags&1206910976,c===null?(i=Ii(i,a,n,null),i.flags|=2):i=Ni(c,i),i.return=t,r.return=t,r.sibling=i,t.child=r,Vc(null,r),r=t.child,i=e.child.memoizedState,i===null?i=Qc(n):(a=i.cachePool,a===null?a=qa():(s=Aa._currentValue,a=a.parent===s?a:{parent:s,pool:s}),i={baseLanes:i.baseLanes|n,cachePool:a}),r.memoizedState=i,r.childLanes=$c(e,o,n),t.memoizedState=Zc,Vc(e.child,r)):(Mo(t),n=e.child,e=n.sibling,n=Ni(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(o=t.deletions,o===null?(t.deletions=[e],t.flags|=16):o.push(e)),t.child=n,t.memoizedState=null,n)}function tl(e,t){return t=nl({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function nl(e,t){return e=ji(22,e,null,t),e.lanes=0,e}function rl(e,t,n){return uo(t,e.child,null,n),e=tl(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function il(e,t,n,r,a,o,s,c){if(n)return t.flags&256?(Mo(t),t.flags&=-257,rl(e,t,c)):t.memoizedState===null?(Fo(),o=a.fallback,s=t.mode,a=nl({mode:`visible`,children:a.children},s),o=Ii(o,s,c,null),o.flags|=2,a.return=t,o.return=t,a.sibling=o,t.child=a,uo(t,e.child,null,c),a=t.child,a.memoizedState=Qc(c),a.childLanes=$c(e,r,c),t.memoizedState=Zc,Vc(null,a)):(Fo(),t.child=e.child,t.flags|=128,null);if(Mo(t),gm(o)){if(r=o.nextSibling&&o.nextSibling.dataset,r)var l=r.dgst;return r=l,r!==``&&(a=Error(i(419)),a.stack=``,a.digest=r,pa({value:a,source:null,stack:null})),rl(e,t,c)}if(Fc||xa(e,t,c,!1),r=(c&e.childLanes)!==0,Fc||r){if(To.current!==null)return rl(e,t,c);if(r=id,r!==null&&(a=ht(r,c),a!==0&&a!==s.retryLane))throw s.retryLane=a,Ei(e,a),Vd(r,e,a),Pc;return hm(o)||$d(),rl(e,t,c)}return hm(o)?(t.flags|=192,t.child=e.child,null):(e=s.treeContext,ta=vm(o.nextSibling),ea=t,ra=!0,ia=null,aa=!1,e!==null&&$i(t,e),t=tl(t,a.children),t.flags|=134221824,t)}function al(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),ya(e.return,t,n)}function ol(e){for(var t=null;e!==null;){var n=e.alternate;n!==null&&Bo(n)===null&&(t=e),e=e.sibling}return t}function sl(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function cl(e){var t=e.child;for(e.child=null;t!==null;){var n=t.sibling;t.sibling=e.child,e.child=t,t=n}}function ll(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=Lo.current;if(t.flags&128)return Ro(t,o),null;var s=!!(o&2);if(s?(o=o&1|2,t.flags|=128):o&=1,Ro(t,o),i===`backwards`&&e!==null?(cl(e),Ic(e,t,r,n),cl(e)):Ic(e,t,r,n),r=ra?Gi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&al(e,n,t);else if(e.tag===19)al(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`backwards`:n=ol(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null,cl(t)),sl(t,!0,i,null,a,r);break;case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&Bo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}sl(t,!0,n,null,a,r);break;case`together`:sl(t,!1,null,null,void 0,r);break;case`independent`:t.memoizedState=null;break;default:n=ol(t.child),n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),sl(t,!1,i,n,a,r)}return t.child}function ul(e,t,n){var r=t.pendingProps;return _a(t,t.type,r.value),Ic(e,t,r.children,n),t.child}function dl(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),md|=t.lanes,(n&t.childLanes)===0){if(e!==null){if(xa(e,t,n,!1),(n&t.childLanes)===0)return null}else return null}if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=Ni(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Ni(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function fl(e,t){return(e.lanes&t)!==0||(e=e.dependencies,!!(e!==null&&Sa(e)))}function pl(e,t,n){switch(t.tag){case 3:Te(t,t.stateNode.containerInfo),_a(t,Aa,e.memoizedState.cache),da();break;case 27:case 5:De(t);break;case 4:Te(t,t.stateNode.containerInfo);break;case 10:_a(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,No(t),null;break;case 13:var r=t.memoizedState;if(r!==null){if(r.dehydrated!==null)return Mo(t),t.flags|=128,null;r=xa(e,t,n,!1);var i=t.child.childLanes;return r||(n&i)!==0?el(e,t,n):(Mo(t),e=dl(e,t,n),e===null?null:e.sibling)}Mo(t);break;case 19:if(t.flags&128)return ll(e,t,n);if(i=!!(e.flags&128),r=(n&t.childLanes)!==0,r||=(xa(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return ll(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Ro(t,Lo.current),r)break;return null;case 22:return t.lanes=0,Bc(e,t,n,t.pendingProps);case 24:_a(t,Aa,e.memoizedState.cache)}return dl(e,t,n)}function ml(e,t,n){if(e!==null){if(e.memoizedProps!==t.pendingProps)Fc=!0;else{if(!fl(e,n)&&!(t.flags&128))return Fc=!1,pl(e,t,n);Fc=!!(e.flags&131072)}}else Fc=!1,ra&&t.flags&1048576&&Zi(t,Gi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=eo(t.elementType),t.type=e,typeof e==`function`)Mi(e)?(r=wc(e,r),t.tag=1,t=Yc(null,t,e,r,n)):(t.tag=0,t=qc(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===ee){t.tag=11,t=Lc(null,t,e,r,n);break a}if(a===ne){t.tag=14,t=Rc(null,t,e,r,n);break a}if(a===N){t.tag=10,t.type=e,t=ul(null,t,n);break a}}throw t=fe(e)||e,Error(i(306,t,``))}}return t;case 0:return qc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=wc(r,t.pendingProps),Yc(e,t,r,a,n);case 3:a:{if(Te(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,ho(e,t),So(t,r,null,n);var s=t.memoizedState;if(r=s.cache,_a(t,Aa,r),r!==o.cache&&ba(t,[Aa],n,!0),xo(),r=s.element,o.isDehydrated){if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=Xc(e,t,r,n);break a}if(r!==a){a=Vi(Error(i(424)),t),pa(a),t=Xc(e,t,r,n);break a}switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(ta=vm(e.firstChild),ea=t,ra=!0,ia=null,aa=!0,n=fo(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling}else{if(da(),r===a){t=dl(e,t,n);break a}Ic(e,t,r,n)}t=t.child}return t;case 26:return Kc(e,t),e===null?(n=Hm(t.type,null,t.pendingProps,null))?t.memoizedState=n:ra||(t.stateNode=Sp(t.type,t.pendingProps,Ce.current,t)):t.memoizedState=Hm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return De(t),e===null&&ra&&(r=t.stateNode=wm(t.type,t.pendingProps,Ce.current),ea=t,aa=!0,a=ta,Mp(t.type)?(ym=a,ta=vm(r.firstChild)):ta=a),Ic(e,t,t.pendingProps.children,n),Kc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&ra&&((a=r=ta)&&(r=fm(r,t.type,t.pendingProps,aa),r===null?a=!1:(t.stateNode=r,ea=t,ta=vm(r.firstChild),aa=!1,a=!0)),a||sa(t)),De(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Cp(a,o)?r=null:s!==null&&Cp(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=es(e,t,rs,null,null,n),gh._currentValue=a),Kc(e,t),Ic(e,t,r,n),t.child;case 6:return e===null&&ra&&((e=n=ta)&&(n=pm(n,t.pendingProps,aa),n===null?e=!1:(t.stateNode=n,ea=t,ta=null,e=!0)),e||sa(t)),null;case 13:return el(e,t,n);case 4:return Te(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=uo(t,null,r,n):Ic(e,t,r,n),t.child;case 11:return Lc(e,t,t.type,t.pendingProps,n);case 7:return r=t.pendingProps,Kc(e,t),Ic(e,t,r,n),t.child;case 8:return Ic(e,t,t.pendingProps.children,n),t.child;case 12:return Ic(e,t,t.pendingProps.children,n),t.child;case 10:return ul(e,t,n);case 9:return a=t.type._context,r=t.pendingProps.children,Ca(t),a=wa(a),r=r(a),t.flags|=1,Ic(e,t,r,n),t.child;case 14:return Rc(e,t,t.type,t.pendingProps,n);case 15:return zc(e,t,t.type,t.pendingProps,n);case 19:return ll(e,t,n);case 31:return Gc(e,t,n);case 22:return Bc(e,t,n,t.pendingProps);case 24:return Ca(t),r=wa(Aa),e===null?(a=Ga(),a===null&&(a=id,o=ja(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},mo(t),_a(t,Aa,a)):((e.lanes&n)!==0&&(ho(e,t),So(t,null,null,n),xo()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,_a(t,Aa,r),r!==a.cache&&ba(t,[Aa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),_a(t,Aa,r))),Ic(e,t,t.pendingProps.children,n),t.child;case 30:return t.stateNode===null&&(t.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=t.pendingProps,r.name!=null&&r.name!==`auto`?t.flags|=e===null?18882560:18874368:ra&&B(t),e!==null&&e.memoizedProps.name!==r.name?t.flags|=4194816:Kc(e,t),Ic(e,t,r.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function hl(e){e.flags|=4}function gl(e,t,n,r,i){var a;if((a=!!(e.mode&32))&&(a=n===null?rh(t,r):rh(t,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),a){if(e.flags|=16777216,(i&335544128)===i){if(e.stateNode.complete)e.flags|=8192;else if(Xd())e.flags|=8192;else throw to=Za,Ya}}else e.flags&=-16777217}function _l(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!ih(t)){if(Xd())e.flags|=8192;else throw to=Za,Ya}}function vl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:lt(),e.lanes|=t,vd|=t)}function yl(e,t){if(!ra)switch(e.tailMode){case`visible`:break;case`collapsed`:for(var n=e.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null;break;default:for(t=e.tail,n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null}}function bl(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&1206910976,r|=i.flags&1206910976,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function xl(e,t,n){var r=t.pendingProps;switch(Qi(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return bl(t),null;case 1:return bl(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),va(Aa),Ee(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(ua(t)?hl(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,fa())),bl(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(hl(t),o===null?(bl(t),gl(t,a,null,r,n)):(bl(t),_l(t,o))):o?o===e.memoizedState?(bl(t),t.flags&=-16777217):(hl(t),bl(t),_l(t,o)):(e=e.memoizedProps,e!==r&&hl(t),bl(t),gl(t,a,e,r,n)),null;case 27:if(Oe(t),n=Ce.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return bl(t),t.subtreeFlags&=-33554433,null}e=xe.current,ua(t)?ca(t,e):(e=wm(a,r,n),t.stateNode=e,hl(t))}return bl(t),t.subtreeFlags&=-33554433,null;case 5:if(Oe(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return bl(t),t.subtreeFlags&=-33554433,null}if(o=xe.current,ua(t))ca(t,o);else{var s=yp(Ce.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[xt]=t,o[St]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=o;a:switch(fp(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&hl(t)}}return bl(t),t.subtreeFlags&=-33554433,gl(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&hl(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=Ce.current,ua(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=ea,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[xt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||lp(e.nodeValue,n)),e||sa(t,!0)}else e=yp(e).createTextNode(r),e[xt]=t,t.stateNode=e}return bl(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=ua(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[xt]=t}else da(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bl(t),e=!1}else n=fa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Io(t),t):(Io(t),null);if(t.flags&128)throw Error(i(558))}return bl(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=ua(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[xt]=t}else da(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;bl(t),a=!1}else a=fa(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(Io(t),t):(Io(t),null)}return Io(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),vl(t,t.updateQueue),bl(t),null);case 4:return Ee(),e===null&&$f(t.stateNode.containerInfo),t.flags|=67108864,bl(t),null;case 10:return va(t.type),bl(t),null;case 19:if(zo(t),r=t.memoizedState,r===null)return bl(t),null;if(a=!!(t.flags&128),o=r.rendering,o===null){if(a)yl(r,!1);else{if(pd!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=Bo(e),o!==null){for(t.flags|=128,yl(r,!1),e=o.updateQueue,t.updateQueue=e,vl(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)Pi(n,e),n=n.sibling;return Ro(t,Lo.current&1|2),ra&&Xi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ve()>wd&&(t.flags|=128,a=!0,yl(r,!1),t.lanes=4194304)}}else{if(!a){if(e=Bo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,vl(t,e),yl(r,!0),r.tail===null&&r.tailMode!==`collapsed`&&r.tailMode!==`visible`&&!o.alternate&&!ra)return bl(t),null}else 2*Ve()-r.renderingStartTime>wd&&n!==536870912&&(t.flags|=128,a=!0,yl(r,!1),t.lanes=4194304)}r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}if(r.tail!==null){e=r.tail;a:{for(n=e;n!==null;){if(n.alternate!==null){n=!1;break a}n=n.sibling}n=!0}return r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ve(),e.sibling=null,o=Lo.current,o=a?o&1|2:o&1,r.tailMode===`visible`||r.tailMode===`collapsed`||!n||ra?Ro(t,o):(n=o,be(Ao,t),be(Lo,n),jo===null&&(jo=t)),ra&&Xi(t,r.treeForkCount),e}return bl(t),null;case 22:case 23:return Io(t),ko(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(bl(t),t.subtreeFlags&6&&(t.flags|=8192)):bl(t),n=t.updateQueue,n!==null&&vl(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&ye(Wa),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),va(Aa),bl(t),null;case 25:return null;case 30:return t.flags|=33554432,bl(t),null}throw Error(i(156,t.tag))}function Sl(e,t){switch(Qi(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return va(Aa),Ee(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Oe(t),null;case 31:if(t.memoizedState!==null){if(Io(t),t.alternate===null)throw Error(i(340));da()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Io(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));da()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return zo(t),e=t.flags,e&65536?(t.flags=e&-65537|128,e=t.memoizedState,e!==null&&(e.rendering=null,e.tail=null),t.flags|=4,t):null;case 4:return Ee(),null;case 10:return va(t.type),null;case 22:case 23:return Io(t),ko(),e!==null&&ye(Wa),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return va(Aa),null;case 25:return null;default:return null}}function Cl(e,t){switch(Qi(t),t.tag){case 3:va(Aa),Ee();break;case 26:case 27:case 5:Oe(t);break;case 4:Ee();break;case 31:t.memoizedState!==null&&Io(t);break;case 13:Io(t);break;case 19:zo(t);break;case 10:va(t.type);break;case 22:case 23:Io(t),ko(),e!==null&&ye(Wa);break;case 24:va(Aa)}}function wl(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){xf(t,t.return,e)}}function Tl(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){xf(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){xf(t,t.return,e)}}function El(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{wo(t,n)}catch(t){xf(e,e.return,t)}}}function Dl(e,t,n){n.props=wc(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){xf(e,t,n)}}function Ol(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:var i=e.stateNode,a=gi(e.memoizedProps,i);(i.ref===null||i.ref.name!==a)&&(i.ref=Wp(a)),r=i.ref;break;case 7:if(e.stateNode===null){var o=new Gp(e);f(e.child,!1,sm,o,void 0,void 0),e.stateNode=o}r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){xf(e,t,n)}}function kl(e,t){var n=e.ref,r=e.refCleanup;if(n!==null){if(typeof r==`function`)try{r()}catch(n){xf(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){xf(e,t,n)}else n.current=null}}function Al(e,t){if((e.tag===5||e.tag===27||e.tag===6)&&e.alternate===null&&t!==null)for(var n=0;n<t.length;n++)lm(e.stateNode,t[n])}function jl(e){for(var t=e.return;t!==null&&(Pl(t)&&lm(e.stateNode,t.stateNode),!Nl(t));)t=t.return}function Ml(e){for(var t=e.return;t!==null&&(Pl(t)&&um(e.stateNode,t.stateNode),!Nl(t));)t=t.return}function Nl(e){return e.tag===5||e.tag===3||e.tag===27}function Pl(e){return e&&e.tag===7&&e.stateNode!==null}function Fl(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){xf(e,e.return,t)}}function Il(e,t,n){try{var r=e.stateNode;mp(r,e.type,n,t),r[St]=t}catch(t){xf(e,e.return,t)}}function Ll(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Mp(e.type)||e.tag===4}function Rl(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ll(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Mp(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function zl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(i,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(i),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=vn)),Al(e,r),Gt=!0;else if(i!==4&&(i===27&&(Al(e,r),r=null,Mp(e.type)&&(n=e.stateNode,t=null)),e=e.child,e!==null))for(zl(e,t,n,r),e=e.sibling;e!==null;)zl(e,t,n,r),e=e.sibling}function Bl(e,t,n,r){var i=e.tag;if(i===5||i===6)i=e.stateNode,t?n.insertBefore(i,t):n.appendChild(i),Al(e,r),Gt=!0;else if(i!==4&&(i===27&&(Al(e,r),r=null,Mp(e.type)&&(n=e.stateNode)),e=e.child,e!==null))for(Bl(e,t,n,r),e=e.sibling;e!==null;)Bl(e,t,n,r),e=e.sibling}function Vl(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);fp(t,r,n),t[xt]=e,t[St]=n}catch(t){xf(e,e.return,t)}}var Hl=!1,Ul=null;function Wl(e){(e.tag===30||e.subtreeFlags&33554432)&&(Hl=!0)}var Gl=null;function Kl(){var e=Gl;return Gl=null,e}var ql=0;function Jl(e,t,n,r,i){return ql=0,Yl(e.child,t,n,r,i)}function Yl(e,t,n,r,i){for(var a=!1;e!==null;){if(e.tag===5){var o=e.stateNode;if(r!==null){var s=Rp(o);r.push(s),s.view&&(a=!0)}else a||Rp(o).view&&(a=!0);Hl=!0,Fp(o,ql===0?t:t+`_`+ql,n),ql++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&i||Yl(e.child,t,n,r,i)&&(a=!0));e=e.sibling}return a}function Xl(e,t){for(;e!==null;)e.tag===5?Ip(e.stateNode,e.memoizedProps):(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&t||Xl(e.child,t)),e=e.sibling}function Zl(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if((e.tag!==22||e.memoizedState===null)&&(Zl(e),e.tag===30&&e.flags&18874368&&e.stateNode.paired)){var t=e.memoizedProps;if(t.name==null||t.name===`auto`)throw Error(i(544));var n=t.name;t=vi(t.default,t.share),t!==`none`&&(Jl(e,n,t,null,!1)||Xl(e.child,!1))}e=e.sibling}}function Ql(e,t){if(e.tag===30){var n=e.stateNode,r=e.memoizedProps,i=gi(r,n),a=vi(r.default,n.paired?r.share:r.enter);a===`none`?Zl(e):Jl(e,i,a,null,!1)?(Zl(e),n.paired||t||Bd(e,r.onEnter)):Xl(e.child,!1)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)Ql(e,t),e=e.sibling;else Zl(e)}function $l(e){if(Ul!==null&&Ul.size!==0){var t=Ul;if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var n=e.memoizedProps,r=n.name;if(r!=null&&r!==`auto`){var i=t.get(r);if(i!==void 0){var a=vi(n.default,n.share);if(a!==`none`&&(Jl(e,r,a,null,!1)?(a=e.stateNode,i.paired=a,a.paired=i,Bd(e,n.onShare)):Xl(e.child,!1)),t.delete(r),t.size===0)break}}}$l(e)}e=e.sibling}}}function eu(e){if(e.tag===30){var t=e.memoizedProps,n=gi(t,e.stateNode),r=Ul===null?void 0:Ul.get(n),i=vi(t.default,r===void 0?t.exit:t.share);i!==`none`&&(Jl(e,n,i,null,!1)?r===void 0?Bd(e,t.onExit):(i=e.stateNode,r.paired=i,i.paired=r,Ul.delete(n),Bd(e,t.onShare)):Xl(e.child,!1)),Ul!==null&&$l(e)}else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)eu(e),e=e.sibling;else Ul!==null&&$l(e)}function tu(e){for(e=e.child;e!==null;){if(e.tag===30){var t=e.memoizedProps,n=gi(t,e.stateNode);t=vi(t.default,t.update),e.flags&=-5,t!==`none`&&Jl(e,n,t,e.memoizedState=[],!1)}else e.subtreeFlags&33554432&&tu(e);e=e.sibling}}function nu(e){if(e.subtreeFlags&18874368)for(e=e.child;e!==null;){if(e.tag!==22||e.memoizedState===null){if(e.tag===30&&e.flags&18874368){var t=e.stateNode;t.paired!==null&&(t.paired=null,Xl(e.child,!1))}nu(e)}e=e.sibling}}function ru(e){if(e.tag===30)e.stateNode.paired=null,Xl(e.child,!1),nu(e);else if(e.subtreeFlags&33554432)for(e=e.child;e!==null;)ru(e),e=e.sibling;else nu(e)}function iu(e){for(e=e.child;e!==null;)e.tag===30?Xl(e.child,!1):e.subtreeFlags&33554432&&iu(e),e=e.sibling}function au(e,t,n,r,i,a,o){for(var s=!1;t!==null;){if(t.tag===5){var c=t.stateNode;if(a!==null&&ql<a.length){var l=a[ql],u=Rp(c);(l.view||u.view)&&(s=!0);var d;if(d=!(e.flags&4)){if(u.clip)d=!0;else{d=l.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}}d&&(e.flags|=4),u.abs?u=!l.abs:(l=l.rect,u=u.rect,u=l.height!==u.height||l.width!==u.width),u&&(e.flags|=32)}else e.flags|=32;e.flags&4&&Fp(c,ql===0?n:n+`_`+ql,i),s&&e.flags&4||(Gl===null&&(Gl=[]),Gl.push(c,ql===0?r:r+`_`+ql,t.memoizedProps)),ql++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o?e.flags|=t.flags&32:au(e,t.child,n,r,i,a,o)&&(s=!0));t=t.sibling}return s}function ou(e,t){for(e=e.child;e!==null;){if(e.tag===30){var n=e.memoizedProps,r=e.stateNode,i=gi(n,r),a=vi(n.default,n.update);if(t){r=r.clones;var o=r===null?null:r.map(zp)}else o=e.memoizedState,e.memoizedState=null;r=e;var s=e.child;ql=0,i=au(r,s,i,i,a,o,!1),e.flags&4&&i&&(t||Bd(e,n.onUpdate))}else e.subtreeFlags&33554432&&ou(e,t);e=e.sibling}}var su=!1,cu=!1,lu=!1,uu=!1,du=typeof WeakSet==`function`?WeakSet:Set,fu=null,pu=!1,mu=!1,hu=!1,gu=!1;function _u(e,t,n){if(e=e.containerInfo,_p=Th,e=qr(e),Jr(e)){if(`selectionStart`in e)var r={start:e.selectionStart,end:e.selectionEnd};else a:{r=(r=e.ownerDocument)&&r.defaultView||window;var i=r.getSelection&&r.getSelection();if(i&&i.rangeCount!==0){r=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==r||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===r&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}r=c===-1||l===-1?null:{start:c,end:l}}else r=null}r||={start:0,end:0}}else r=null;for(vp={focusedElem:e,selectionRange:r},Th=!1,n=(n&335544064)===n,fu=t,t=n?9270:1024;fu!==null;){if(e=fu,n&&(r=e.deletions,r!==null))for(a=0;a<r.length;a++)n&&eu(r[a]);if(e.alternate===null&&e.flags&2)n&&Wl(e),vu(n);else{if(e.tag===22){if(r=e.alternate,e.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&eu(r),vu(n);continue}if(r!==null&&r.memoizedState!==null){n&&Wl(e),vu(n);continue}}r=e.child,(e.subtreeFlags&t)!==0&&r!==null?(r.return=e,fu=r):(n&&tu(e),vu(n))}}Ul=null}function vu(e){for(;fu!==null;){var t=fu,n=e,r=t.alternate,a=t.flags;switch(t.tag){case 0:case 11:case 15:break;case 1:if(a&1024&&r!==null){n=void 0,a=r.memoizedProps,r=r.memoizedState;var o=t.stateNode;try{var s=wc(t.type,a);n=o.getSnapshotBeforeUpdate(s,r),o.__reactInternalSnapshotBeforeUpdate=n}catch(e){xf(t,t.return,e)}}break;case 3:if(a&1024){if(r=t.stateNode.containerInfo,n=r.nodeType,n===9)dm(r);else if(n===1)switch(r.nodeName){case`HEAD`:case`HTML`:case`BODY`:dm(r);break;default:r.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=gi(r.memoizedProps,r.stateNode),a=t.memoizedProps,a=vi(a.default,a.update),a!==`none`&&Jl(r,n,a,r.memoizedState=[],!0));break;default:if(a&1024)throw Error(i(163))}if(r=t.sibling,r!==null){r.return=t.return,fu=r;break}fu=t.return}}function yu(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Ru(e,n),r&4&&wl(5,n);break;case 1:if(Ru(e,n),r&4){if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){xf(n,n.return,e)}else{var i=wc(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){xf(n,n.return,e)}}}r&64&&El(n),r&512&&Ol(n,n.return);break;case 3:if(Ru(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{wo(e,t)}catch(e){xf(n,n.return,e)}}break;case 27:t===null&&r&4&&Vl(n);case 26:case 5:Ru(e,n),t===null&&r&4&&Fl(n),r&512&&Ol(n,n.return);break;case 12:Ru(e,n);break;case 31:Ru(e,n),r&4&&Ou(e,n);break;case 13:Ru(e,n),r&4&&ku(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Tf.bind(null,n),_m(e,n))));break;case 22:if(r=n.memoizedState!==null||su,!r){var a=t!==null&&t.memoizedState!==null||cu;t=su,i=cu,su=r,(cu=a)&&!i?(r=2,n.subtreeFlags&8772&&(r|=1),Bu(e,n,r)):Ru(e,n),su=t,cu=i}break;case 30:Ru(e,n),r&512&&Ol(n,n.return);break;case 7:r&512&&Ol(n,n.return);default:Ru(e,n)}}function bu(e,t){for(e=e.child;e!==null;)xu(e,t),e=e.sibling}function xu(e,t){switch(e.tag){case 5:case 26:try{var n=e.stateNode;if(t){var r=n.style;typeof r.setProperty==`function`?r.setProperty(`display`,`none`,`important`):r.display=`none`}else{var i=e.stateNode,a=e.memoizedProps.style,o=a!=null&&a.hasOwnProperty(`display`)?a.display:null;i.style.display=o==null||typeof o==`boolean`?``:(``+o).trim()}}catch(t){xf(e,e.return,t)}Su(e,t);break;case 6:try{e.stateNode.nodeValue=t?``:e.memoizedProps,Gt=!0}catch(t){xf(e,e.return,t)}break;case 18:try{var s=e.stateNode;t?Pp(s,!0):Pp(e.stateNode,!1)}catch(t){xf(e,e.return,t)}break;case 22:case 23:e.memoizedState===null&&bu(e,t);break;default:bu(e,t)}}function Su(e,t){if(e.subtreeFlags&67108864)for(e=e.child;e!==null;){a:{var n=e,r=t;switch(n.tag){case 4:xu(n,r);break a;case 22:n.memoizedState===null&&Su(n,r);break a;default:Su(n,r)}}e=e.sibling}}function Cu(e){var t=e.alternate;t!==null&&(e.alternate=null,Cu(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&At(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var wu=null,Tu=!1;function Eu(e,t,n){for(n=n.child;n!==null;)Du(e,t,n),n=n.sibling}function Du(e,t,n){if(Xe&&typeof Xe.onCommitFiberUnmount==`function`)try{Xe.onCommitFiberUnmount(Ye,n)}catch{}switch(n.tag){case 26:cu||kl(n,t),Eu(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!cu&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:cu||kl(n,t),Ml(n);var r=wu,i=Tu;Mp(n.type)&&(wu=n.stateNode,Tu=!1),Eu(e,t,n),Tm(n.stateNode,n.type,n.memoizedProps),wu=r,Tu=i;break;case 5:cu||kl(n,t),Ml(n);case 6:if(n.tag===6&&Ml(n),r=wu,i=Tu,wu=null,Eu(e,t,n),wu=r,Tu=i,wu!==null){if(Tu)try{(wu.nodeType===9?wu.body:wu.nodeName===`HTML`?wu.ownerDocument.body:wu).removeChild(n.stateNode),Gt=!0}catch(e){xf(n,t,e)}else try{wu.removeChild(n.stateNode),Gt=!0}catch(e){xf(n,t,e)}}break;case 18:wu!==null&&(Tu?(e=wu,Np(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Zh(e)):Np(wu,n.stateNode));break;case 4:r=wu,i=Tu,wu=n.stateNode.containerInfo,Tu=!0,Eu(e,t,n),wu=r,Tu=i;break;case 0:case 11:case 14:case 15:Tl(2,n,t),cu||Tl(4,n,t),Eu(e,t,n);break;case 1:cu||(kl(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Dl(n,t,r)),Eu(e,t,n);break;case 21:Eu(e,t,n);break;case 22:cu=(r=cu)||n.memoizedState!==null,Eu(e,t,n),cu=r;break;case 30:kl(n,t),Eu(e,t,n);break;case 7:cu||kl(n,t),Eu(e,t,n);break;default:Eu(e,t,n)}}function Ou(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Zh(e)}catch(e){xf(t,t.return,e)}}}function ku(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Zh(e)}catch(e){xf(t,t.return,e)}}function V(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new du),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new du),t;default:throw Error(i(435,e.tag))}}function Au(e,t){var n=V(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Ef.bind(null,e,t);t.then(r,r)}})}function ju(e,t,n){var r=t.deletions;if(r!==null)for(var a=0;a<r.length;a++){var o=r[a],s=e,c=t,l=c;a:for(;l!==null;){switch(l.tag){case 27:if(Mp(l.type)){wu=l.stateNode,Tu=!1;break a}break;case 5:wu=l.stateNode,Tu=!1;break a;case 3:case 4:wu=l.stateNode.containerInfo,Tu=!0;break a}l=l.return}if(wu===null)throw Error(i(160));Du(s,c,o),wu=null,Tu=!1,s=o.alternate,s!==null&&(s.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)Nu(t,e,n),t=t.sibling}var Mu=null;function Nu(e,t,n){var r=e.alternate,a=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:if(a&4&&(r=e.updateQueue,r=r===null?null:r.events,r!==null))for(var o=0;o<r.length;o++){var s=r[o];s.ref.impl=s.nextImpl}ju(t,e,n),Pu(e),a&4&&(Tl(3,e,e.return),wl(3,e),Tl(5,e,e.return));break;case 1:ju(t,e,n),Pu(e),a&512&&(cu||r===null||kl(r,r.return)),a&64&&su&&(e=e.updateQueue,e!==null&&(t=e.callbacks,t!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?t:n.concat(t))));break;case 26:if(o=Mu,ju(t,e,n),Pu(e),a&512&&(cu||r===null||kl(r,r.return)),a&4){if(a=r===null?null:r.memoizedState,n=e.memoizedState,r===null){if(n===null){if(e.stateNode===null){if(su)e.stateNode=Sp(e.type,e.memoizedProps,t.containerInfo,e);else{a:{t=e.type,n=e.memoizedProps,a=o.ownerDocument||o;b:switch(t){case`title`:r=a.getElementsByTagName(`title`)[0],(!r||r[Ot]||r[xt]||r.namespaceURI===`http://www.w3.org/2000/svg`||r.hasAttribute(`itemprop`))&&(r=a.createElement(t),a.head.insertBefore(r,a.querySelector(`head > title`))),fp(r,t,n),r[xt]=e,Ft(r),t=r;break a;case`link`:if(o=eh(`link`,`href`,a).get(t+(n.href||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&r.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&r.getAttribute(`title`)===(n.title==null?null:n.title)&&r.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){o.splice(s,1);break b}}r=a.createElement(t),fp(r,t,n),a.head.appendChild(r);break;case`meta`:if(o=eh(`meta`,`content`,a).get(t+(n.content||``))){for(s=0;s<o.length;s++)if(r=o[s],r.getAttribute(`content`)===(n.content==null?null:``+n.content)&&r.getAttribute(`name`)===(n.name==null?null:n.name)&&r.getAttribute(`property`)===(n.property==null?null:n.property)&&r.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){o.splice(s,1);break b}}r=a.createElement(t),fp(r,t,n),a.head.appendChild(r);break;default:throw Error(i(468,t))}r[xt]=e,Ft(r),t=r}e.stateNode=t}}else su||th(o,e.type,e.stateNode)}else e.stateNode=Ym(o,n,e.memoizedProps)}else a===n?n===null&&e.stateNode!==null&&Il(e,e.memoizedProps,r.memoizedProps):(a===null?(t=r.stateNode,t===null||cu||t.parentNode.removeChild(t)):a.count--,n===null?su||th(o,e.type,e.stateNode):Ym(o,n,e.memoizedProps))}break;case 27:ju(t,e,n),Pu(e),a&512&&(cu||r===null||kl(r,r.return)),r!==null&&a&4&&Il(e,e.memoizedProps,r.memoizedProps);break;case 5:if(o=lu,lu=!1,ju(t,e,n),lu=o,Pu(e),a&512&&(cu||r===null||kl(r,r.return)),e.flags&32){t=e.stateNode;try{un(t,``),Gt=!0}catch(t){xf(e,e.return,t)}}a&4&&e.stateNode!=null&&(t=e.memoizedProps,Il(e,t,r===null?t:r.memoizedProps)),a&1024&&(uu=!0);break;case 6:if(ju(t,e,n),Pu(e),a&4){if(e.stateNode===null)throw Error(i(162));t=e.memoizedProps,n=e.stateNode;try{n.nodeValue=t,Gt=!0}catch(t){xf(e,e.return,t)}}break;case 3:if(Gt=!1,$m=null,o=Mu,Mu=km(t.containerInfo),ju(t,e,n),Mu=o,Pu(e),a&4&&r!==null&&r.memoizedState.isDehydrated)try{Zh(t.containerInfo)}catch(t){xf(e,e.return,t)}uu&&(uu=!1,Fu(e)),Gt=!1;break;case 4:a=lu,lu=su,r=Kt(),o=Mu,Mu=km(e.stateNode.containerInfo),ju(t,e,n),Pu(e),Mu=o,Gt&&mu&&(hu=!0),Gt=r,lu=a;break;case 12:ju(t,e,n),Pu(e);break;case 31:ju(t,e,n),Pu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Au(e,t)));break;case 13:ju(t,e,n),Pu(e),e.child.flags&8192&&e.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Sd=Ve()),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Au(e,t)));break;case 22:o=e.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var c=su,l=cu,u=lu;su=c||o,lu=u||o,cu=l||s,ju(t,e,n),cu=l,lu=u,su=c,Pu(e),a&8192&&(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,!o||r===null||s||su||cu||(t=s||cu,n=su,r=cu,su=o||su,cu=t,zu(e,2),su=n,cu=r),!o&&lu||bu(e,o)),a&4&&(t=e.updateQueue,t!==null&&(n=t.retryQueue,n!==null&&(t.retryQueue=null,Au(e,n))));break;case 19:ju(t,e,n),Pu(e),a&4&&(t=e.updateQueue,t!==null&&(e.updateQueue=null,Au(e,t)));break;case 30:a&512&&(cu||r===null||kl(r,r.return)),a=Kt(),o=mu,s=(n&335544064)===n,c=e.memoizedProps,mu=s&&vi(c.default,c.update)!==`none`,ju(t,e,n),Pu(e),s&&r!==null&&Gt&&(e.flags|=4),mu=o,Gt=a;break;case 21:break;case 7:a&512&&(cu||r===null||kl(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=e);default:ju(t,e,n),Pu(e)}}function Pu(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Ll(r)){n=r;break}r=r.return}r=null;for(var a=e.return;a!==null;){if(Pl(a)){var o=a.stateNode;r===null?r=[o]:r.push(o)}if(Nl(a))break;a=a.return}var s=r;if(n==null)throw Error(i(160));switch(n.tag){case 27:var c=n.stateNode;Bl(e,Rl(e),c,s);break;case 5:var l=n.stateNode;n.flags&32&&(un(l,``),n.flags&=-33),Bl(e,Rl(e),l,s);break;case 3:case 4:var u=n.stateNode.containerInfo;zl(e,Rl(e),u,s);break;default:throw Error(i(161))}}catch(t){xf(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Fu(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Fu(t),t.tag===5&&t.flags&1024&&(t=t.stateNode,Th=!0,t.reset(),Th=!1),e=e.sibling}}function Iu(e,t){if(t.subtreeFlags&9270)for(t=t.child;t!==null;)Lu(t,e),t=t.sibling;else ou(t,!1)}function Lu(e,t){var n=e.alternate;if(n===null)Ql(e,!1);else switch(e.tag){case 3:if(gu=pu=!1,Kl(),Iu(t,e),!pu&&!hu){if(e=Gl,e!==null)for(var r=0;r<e.length;r+=3){n=e[r];var i=e[r+1];Ip(n,e[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(`+i+`)`})}e=t.containerInfo,e=e.nodeType===9?e.documentElement:e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===``&&(e.style.viewTransitionName=`none`,e.animate({opacity:[0,0],pointerEvents:[`none`,`none`]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition-group(root)`}),e.animate({width:[0,0],height:[0,0]},{duration:0,fill:`forwards`,pseudoElement:`::view-transition`})),gu=!0}Gl=null;break;case 5:Iu(t,e);break;case 4:r=pu,pu=!1,Iu(t,e),pu&&(hu=!0),pu=r;break;case 22:e.memoizedState===null&&(n.memoizedState===null?Iu(t,e):Ql(e,!1));break;case 30:r=pu,i=Kl(),pu=!1,Iu(t,e),pu&&(e.flags|=4);var a=e.memoizedProps,o=e.stateNode;t=gi(a,o),o=gi(n.memoizedProps,o);var s=vi(a.default,a.update);s===`none`?t=!1:(a=n.memoizedState,n.memoizedState=null,n=e.child,ql=0,t=au(e,n,t,o,s,a,!0),ql!==(a===null?0:a.length)&&(e.flags|=32)),e.flags&4&&t?(Bd(e,e.memoizedProps.onUpdate),Gl=i):i!==null&&(i.push.apply(i,Gl),Gl=i),pu=e.flags&32?!0:r;break;default:Iu(t,e)}}function Ru(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)yu(e,t.alternate,t),t=t.sibling}function zu(e,t){for(e=e.child;e!==null;){var n=e,r=t;switch(n.tag){case 0:case 11:case 14:case 15:Tl(4,n,n.return),zu(n,r);break;case 1:kl(n,n.return);var i=n.stateNode;typeof i.componentWillUnmount==`function`&&Dl(n,n.return,i),zu(n,r);break;case 27:r&2&&Tm(n.stateNode,n.type,n.memoizedProps);case 5:kl(n,n.return),n.tag!==5&&n.tag!==27||Ml(n),zu(n,r);break;case 6:Ml(n);break;case 26:kl(n,n.return),i=n.stateNode,n.memoizedState!==null||i===null||cu||i.parentNode.removeChild(i),zu(n,r);break;case 22:n.memoizedState===null&&zu(n,r);break;case 30:kl(n,n.return),zu(n,r);break;case 7:kl(n,n.return);default:zu(n,r)}e=e.sibling}}function Bu(e,t,n){for(n=t.subtreeFlags&8772?n:n&-2,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags,s=!!(n&1);switch(a.tag){case 0:case 11:case 15:Bu(i,a,n),wl(4,a);break;case 1:if(Bu(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){xf(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var c=r.stateNode;try{var l=i.shared.hiddenCallbacks;if(l!==null)for(i.shared.hiddenCallbacks=null,i=0;i<l.length;i++)Co(l[i],c)}catch(e){xf(r,r.return,e)}}s&&o&64&&El(a),Ol(a,a.return);break;case 27:n&2&&Vl(a);case 5:a.tag!==5&&a.tag!==27||jl(a),Bu(i,a,n),s&&r===null&&o&4&&Fl(a),Ol(a,a.return);break;case 6:jl(a);break;case 26:c=a.stateNode,a.memoizedState!==null||c===null||su||th(km(c.ownerDocument),a.type,c),Bu(i,a,n),s&&r===null&&o&4&&Fl(a),Ol(a,a.return);break;case 12:Bu(i,a,n);break;case 31:Bu(i,a,n),s&&o&4&&Ou(i,a);break;case 13:Bu(i,a,n),s&&o&4&&ku(i,a);break;case 22:a.memoizedState===null&&Bu(i,a,n),Ol(a,a.return);break;case 30:Bu(i,a,n),Ol(a,a.return);break;case 7:Ol(a,a.return);default:Bu(i,a,n)}t=t.sibling}}function Vu(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&Ma(n))}function Hu(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ma(e))}function Uu(e,t,n,r){var i=(n&335544064)===n;if(t.subtreeFlags&(i?10262:10256))for(t=t.child;t!==null;)Wu(e,t,n,r),t=t.sibling;else i&&iu(t)}function Wu(e,t,n,r){var i=(n&335544064)===n;i&&t.alternate===null&&t.return!==null&&t.return.alternate!==null&&ru(t);var a=t.flags;switch(t.tag){case 0:case 11:case 15:Uu(e,t,n,r),a&2048&&wl(9,t);break;case 1:Uu(e,t,n,r);break;case 3:Uu(e,t,n,r),i&&gu&&(e=e.containerInfo,e=e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,e.style.viewTransitionName===`root`&&(e.style.viewTransitionName=``),e=e.ownerDocument.documentElement,e!==null&&e.style.viewTransitionName===`none`&&(e.style.viewTransitionName=``)),a&2048&&(a=null,t.alternate!==null&&(a=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==a&&(t.refCount++,a!=null&&Ma(a)));break;case 12:if(a&2048){Uu(e,t,n,r),a=t.stateNode;try{var o=t.memoizedProps,s=o.id,c=o.onPostCommit;typeof c==`function`&&c(s,t.alternate===null?`mount`:`update`,a.passiveEffectDuration,-0)}catch(e){xf(t,t.return,e)}}else Uu(e,t,n,r);break;case 31:Uu(e,t,n,r);break;case 13:Uu(e,t,n,r);break;case 23:break;case 22:o=t.stateNode,s=t.alternate,t.memoizedState===null?(i&&s!==null&&s.memoizedState!==null&&ru(t),o._visibility&2?Uu(e,t,n,r):(o._visibility|=2,Gu(e,t,n,r,!!(t.subtreeFlags&10256)||!1))):(i&&s!==null&&s.memoizedState===null&&ru(s),o._visibility&2?Uu(e,t,n,r):Ku(e,t)),a&2048&&Vu(s,t);break;case 24:Uu(e,t,n,r),a&2048&&Hu(t.alternate,t);break;case 30:i&&(a=t.alternate,a!==null&&(Xl(a.child,!0),Xl(t.child,!0))),Uu(e,t,n,r);break;default:Uu(e,t,n,r)}}function Gu(e,t,n,r,i){for(i&&=!!(t.subtreeFlags&10256)||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Gu(a,o,s,c,i),wl(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Gu(a,o,s,c,i)):u._visibility&2?Gu(a,o,s,c,i):Ku(a,o),i&&l&2048&&Vu(o.alternate,o);break;case 24:Gu(a,o,s,c,i),i&&l&2048&&Hu(o.alternate,o);break;default:Gu(a,o,s,c,i)}t=t.sibling}}function Ku(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:Ku(n,r),i&2048&&Vu(r.alternate,r);break;case 24:Ku(n,r),i&2048&&Hu(r.alternate,r);break;default:Ku(n,r)}t=t.sibling}}var qu=8192;function Ju(e,t,n){if(e.subtreeFlags&qu)for(e=e.child;e!==null;)Yu(e,t,n),e=e.sibling}function Yu(e,t,n){switch(e.tag){case 26:Ju(e,t,n),e.flags&qu&&(e.memoizedState===null?(e=e.stateNode,(t&335544128)===t&&oh(n,e)):sh(n,Mu,e.memoizedState,e.memoizedProps));break;case 5:Ju(e,t,n),e.flags&qu&&(e=e.stateNode,(t&335544128)===t&&oh(n,e));break;case 3:case 4:var r=Mu;Mu=km(e.stateNode.containerInfo),Ju(e,t,n),Mu=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=qu,qu=16777216,Ju(e,t,n),qu=r):Ju(e,t,n));break;case 30:if((e.flags&qu)!==0&&(r=e.memoizedProps.name,r!=null&&r!==`auto`)){var i=e.stateNode;i.paired=null,Ul===null&&(Ul=new Map),Ul.set(r,i)}Ju(e,t,n);break;default:Ju(e,t,n)}}function Xu(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Zu(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];fu=r,ed(r,e)}Xu(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Qu(e),e=e.sibling}function Qu(e){switch(e.tag){case 0:case 11:case 15:Zu(e),e.flags&2048&&Tl(9,e,e.return);break;case 3:Zu(e);break;case 12:Zu(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,$u(e)):Zu(e);break;default:Zu(e)}}function $u(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];fu=r,ed(r,e)}Xu(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Tl(8,t,t.return),$u(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,$u(t));break;default:$u(t)}e=e.sibling}}function ed(e,t){for(;fu!==null;){var n=fu;switch(n.tag){case 0:case 11:case 15:Tl(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Ma(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,fu=r;else a:for(n=e;fu!==null;){r=fu;var i=r.sibling,a=r.return;if(Cu(r),r===n){fu=null;break a}if(i!==null){i.return=a,fu=i;break a}fu=a}}}var td={getCacheForType:function(e){var t=wa(Aa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return wa(Aa).controller.signal}},nd=typeof WeakMap==`function`?WeakMap:Map,rd=0,id=null,ad=null,od=0,sd=0,cd=null,ld=!1,ud=!1,dd=!1,fd=0,pd=0,md=0,hd=0,gd=0,_d=0,vd=0,yd=null,bd=null,xd=!1,Sd=0,Cd=0,wd=1/0,Td=null,Ed=null,Dd=0,Od=null,kd=null,Ad=0,jd=0,Md=null,Nd=null,Pd=null,Fd=null,H=null,Id=0,Ld=null;function Rd(){return rd&2&&od!==0?od&-od:F.T===null?vt():Hf()}function zd(){if(_d===0){if(!(od&536870912)||ra){var e=nt;nt<<=1,!(nt&3932160)&&(nt=262144),_d=e}else _d=536870912}return e=Ao.current,e!==null&&(e.flags|=32),_d}function Bd(e,t){if(t!=null){var n=e.stateNode,r=n.ref;r===null&&(r=n.ref=Wp(gi(e.memoizedProps,n))),Fd===null&&(Fd=[]),Fd.push(t.bind(null,r))}}function Vd(e,t,n){(e===id&&(sd===2||sd===9)||e.cancelPendingCommit!==null)&&(Jd(e,0),Gd(e,od,_d,!1)),dt(e,n),(!(rd&2)||e!==id)&&(e===id&&(!(rd&2)&&(hd|=n),pd===4&&Gd(e,od,_d,!1)),Pf(e))}function Hd(e,t,n){if(rd&6)throw Error(i(327));var r=!n&&!(t&127)&&(t&e.expiredLanes)===0||ot(e,t),a=r?nf(e,t):ef(e,t,!0),o=r;do{if(a===0){ud&&!r&&Gd(e,t,0,!1);break}if(n=e.current.alternate,o&&!Wd(n)){a=ef(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;a=yd;var l=c.current.memoizedState.isDehydrated;if(l&&(Jd(c,s).flags|=256),s=ef(c,s,!1),s!==2&&s!==6){if(dd&&!l){c.errorRecoveryDisabledLanes|=o,hd|=o,a=4;break a}o=bd,bd=a,o!==null&&(bd===null?bd=o:bd.push.apply(bd,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Jd(e,0),Gd(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t&&(t&62914560)!==t)break;case 6:Gd(r,t,_d,!ld);break a;case 2:bd=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=Sd+300-Ve(),10<a)){if(Gd(r,t,_d,!ld),at(r,0,!0)!==0)break a;Ad=t,r.timeoutHandle=Ep(Ud.bind(null,r,n,bd,Td,xd,t,_d,hd,vd,ld,o,`Throttled`,-0,0),a);break a}Ud(r,n,bd,Td,xd,t,_d,hd,vd,ld,o,null,-0,0)}break}while(1);Pf(e)}function Ud(e,t,n,r,i,a,o,s,c,l,u,d,f,p){e.timeoutHandle=-1;var m=t.subtreeFlags,h=(a&335544064)===a;if(d=null,(h||m&8192||(m&16785408)==16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:vn},Ul=null,Yu(t,a,d),h&&(m=d,h=e.containerInfo,h=(h.nodeType===9?h:h.ownerDocument).__reactViewTransition,h!=null&&(m.count++,m.waitingForViewTransition=!0,m=dh.bind(m),h.finished.then(m,m))),m=(a&62914560)===a?Sd-Ve():(a&4194048)===a?Cd-Ve():0,m=lh(d,m),m!==null)){Ad=a,e.cancelPendingCommit=m(uf.bind(null,e,t,a,n,r,i,o,s,c,l,u,d,null,f,p)),Gd(e,a,o,!l);return}uf(e,t,a,n,r,i,o,s,c,l,u,d)}function Wd(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!Vr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function Gd(e,t,n,r){t=st(e,t),t&=~gd,t&=~hd,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-L(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&pt(e,n,t)}function Kd(){return rd&6?!0:(Ff(0,!1),!1)}function qd(){if(ad!==null){if(sd===0)var e=ad.return;else e=ad,ga=ha=null,os(e),io=null,ao=0,e=ad;for(;e!==null;)Cl(e.alternate,e),e=e.return;ad=null}}function Jd(e,t){var n=e.timeoutHandle;return n!==-1&&(e.timeoutHandle=-1,Dp(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),Ad=0,qd(),id=e,ad=n=Ni(e.current,null),od=t,sd=0,cd=null,ld=!1,ud=ot(e,t),dd=!1,vd=_d=gd=hd=md=pd=0,bd=yd=null,xd=!1,fd=st(e,t),Ci(),n}function Yd(e,t){Ho=null,F.H=gc,t===Ja||t===Xa?(t=no(),sd=3):t===Ya?(t=no(),sd=4):sd=t===Pc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,cd=t,ad===null&&(pd=1,Oc(e,Vi(t,e.current)))}function Xd(){var e=Ao.current;return e===null?!0:(od&4194048)===od?jo===null:(od&62914560)===od||od&536870912?e===jo:!1}function Zd(){var e=F.H;return F.H=gc,e===null?gc:e}function Qd(){var e=F.A;return F.A=td,e}function $d(){pd=4,ld||(od&4194048)!==od&&Ao.current!==null||(ud=!0),!(md&134217727)&&!(hd&134217727)||id===null||Gd(id,od,_d,!1)}function ef(e,t,n){var r=rd;rd|=2;var i=Zd(),a=Qd();(id!==e||od!==t)&&(Td=null,Jd(e,t)),t=!1;var o=pd;a:do try{if(sd!==0&&ad!==null){var s=ad,c=cd;switch(sd){case 8:qd(),o=6;break a;case 3:case 2:case 9:case 6:Ao.current===null&&(t=!0);var l=sd;if(sd=0,cd=null,sf(e,s,c,l),n&&ud){o=0;break a}break;default:l=sd,sd=0,cd=null,sf(e,s,c,l)}}tf(),o=pd;break}catch(t){Yd(e,t)}while(1);return t&&e.shellSuspendCounter++,ga=ha=null,rd=r,F.H=i,F.A=a,ad===null&&(id=null,od=0,Ci()),o}function tf(){for(;ad!==null;)af(ad)}function nf(e,t){var n=rd;rd|=2;var r=Zd(),a=Qd();id!==e||od!==t?(Td=null,wd=Ve()+500,Jd(e,t)):ud=ot(e,t);a:do try{if(sd!==0&&ad!==null){t=ad;var o=cd;b:switch(sd){case 1:sd=0,cd=null,sf(e,t,o,1);break;case 2:case 9:if(Qa(o)){sd=0,cd=null,of(t);break}t=function(){sd!==2&&sd!==9||id!==e||(sd=7),Pf(e)},o.then(t,t);break a;case 3:sd=7;break a;case 4:sd=5;break a;case 7:Qa(o)?(sd=0,cd=null,of(t)):(sd=0,cd=null,sf(e,t,o,7));break;case 5:var s=null;switch(ad.tag){case 26:s=ad.memoizedState;case 5:case 27:var c=ad;if(s?ih(s):c.stateNode.complete){sd=0,cd=null;var l=c.sibling;if(l!==null)ad=l;else{var u=c.return;u===null?ad=null:(ad=u,cf(u))}break b}}sd=0,cd=null,sf(e,t,o,5);break;case 6:sd=0,cd=null,sf(e,t,o,6);break;case 8:qd(),pd=6;break a;default:throw Error(i(462))}}rf();break}catch(t){Yd(e,t)}while(1);return ga=ha=null,F.H=r,F.A=a,rd=n,ad===null?(id=null,od=0,Ci(),pd):0}function rf(){for(;ad!==null&&!ze();)af(ad)}function af(e){var t=ml(e.alternate,e,fd);e.memoizedProps=e.pendingProps,t===null?cf(e):ad=t}function of(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=Jc(n,t,t.pendingProps,t.type,void 0,od);break;case 11:t=Jc(n,t,t.pendingProps,t.type.render,t.ref,od);break;case 5:os(t);var r=t;r===ea&&(ra?(la(r),r.tag===5&&r.stateNode!=null&&(ta=r.stateNode)):(la(r),ra=!0));default:Cl(n,t),t=ad=Pi(t,fd),t=ml(n,t,fd)}e.memoizedProps=e.pendingProps,t===null?cf(e):ad=t}function sf(e,t,n,r){ga=ha=null,os(t),io=null,ao=0;var i=t.return;try{if(Nc(e,i,t,n,od)){pd=1,Oc(e,Vi(n,e.current)),ad=null;return}}catch(t){if(i!==null)throw ad=i,t;pd=1,Oc(e,Vi(n,e.current)),ad=null;return}t.flags&32768?(ra||r===1?e=!0:ud||od&536870912?e=!1:(ld=e=!0,(r===2||r===9||r===3||r===6)&&(r=Ao.current,r!==null&&r.tag===13&&(r.flags|=16384))),lf(t,e)):cf(t)}function cf(e){var t=e;do{if(t.flags&32768){lf(t,ld);return}e=t.return;var n=xl(t.alternate,t,fd);if(n!==null){ad=n;return}if(t=t.sibling,t!==null){ad=t;return}ad=t=e}while(t!==null);pd===0&&(pd=5)}function lf(e,t){do{var n=Sl(e.alternate,e);if(n!==null){n.flags&=32767,ad=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){ad=e;return}ad=e=n}while(e!==null);pd=6,ad=null}function uf(e,t,n,r,a,o,s,c,l,u,d,f){e.cancelPendingCommit=null;do vf();while(Dd!==0);if(rd&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));e===id&&(ad=id=null,od=0),kd=t,Od=e,Ad=n,Md=a,Nd=r,df(e,t,n,s,c,l,f)}}function df(e,t,n,r,i,a,o){var s=t.lanes|t.childLanes;if(jd=s,s|=Si,ft(e,n,s,r,i,a),Fd=null,(n&335544064)===n?(H=Fa(e),r=10262):(H=null,r=10256),(t.subtreeFlags&r)!==0||(t.flags&r)!==0?(e.callbackNode=null,e.callbackPriority=0,Df(Ge,function(){return yf(),null})):(e.callbackNode=null,e.callbackPriority=0),Hl=!1,r=!!(t.flags&13878),t.subtreeFlags&13878||r){r=F.T,F.T=null,i=me.p,me.p=2,a=rd,rd|=4;try{_u(e,t,n)}finally{rd=a,me.p=i,F.T=r}}Dd=1,Hl?Pd=Hp(o,e.containerInfo,H,mf,hf,pf,gf,yf,ff,null,null):(mf(),hf(),gf())}function ff(e){if(Dd!==0){var t=Od.onRecoverableError;t(e,{componentStack:null})}}function pf(){Dd===3&&(Dd=0,Lu(kd,Od),Dd=4)}function mf(){if(Dd===1){Dd=0;var e=Od,t=kd,n=Ad,r=!!(t.flags&13878);if(t.subtreeFlags&13878||r){r=F.T,F.T=null;var i=me.p;me.p=2;var a=rd;rd|=4;try{mu=hu=!1,Nu(t,e,n),n=vp;var o=qr(e.containerInfo),s=n.focusedElem,c=n.selectionRange;if(o!==s&&s&&s.ownerDocument&&Kr(s.ownerDocument.documentElement,s)){if(c!==null&&Jr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=Gr(s,h),v=Gr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}Th=!!_p,vp=_p=null}finally{rd=a,me.p=i,F.T=r}}e.current=t,Dd=2}}function hf(){if(Dd===2){Dd=0;var e=Od,t=kd,n=!!(t.flags&8772);if(t.subtreeFlags&8772||n){n=F.T,F.T=null;var r=me.p;me.p=2;var i=rd;rd|=4;try{yu(e,t.alternate,t)}finally{rd=i,me.p=r,F.T=n}}Dd=3}}function gf(){if(Dd===4||Dd===3){Dd=0;var e=Pd;Pd=null,Be();var t=Od,n=kd,r=Ad,i=Nd,a=(r&335544064)===r?10262:10256;if((n.subtreeFlags&a)!==0||(n.flags&a)!==0?Dd=5:(Dd=0,kd=Od=null,_f(t,t.pendingLanes)),a=t.pendingLanes,a===0&&(Ed=null),_t(r),n=n.stateNode,Xe&&typeof Xe.onCommitFiberRoot==`function`)try{Xe.onCommitFiberRoot(Ye,n,void 0,(n.current.flags&128)==128)}catch{}if(i!==null){n=F.T,a=me.p,me.p=2,F.T=null;try{for(var o=t.onRecoverableError,s=0;s<i.length;s++){var c=i[s];o(c.value,{componentStack:c.stack})}}finally{F.T=n,me.p=a}}if(i=Fd,o=H,H=null,i!==null&&(Fd=null,o===null&&(o=[]),e!==null))for(c=0;c<i.length;c++)n=(0,i[c])(o),n!==void 0&&e.finished.finally(n);Ad&3&&vf(),Pf(t),a=t.pendingLanes,r&261930&&a&42?t===Ld?Id++:(Id=0,Ld=t):(Id=0,Ld=null),Ff(0,!1)}}function _f(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ma(t)))}function vf(){return Pd!==null&&(Pd.skipTransition(),Pd=null),mf(),hf(),gf(),yf()}function yf(){if(Dd!==5)return!1;var e=Od,t=jd;jd=0;var n=_t(Ad),r=F.T,a=me.p;try{me.p=32>n?32:n,F.T=null,n=Md,Md=null;var o=Od,s=Ad;if(Dd=0,kd=Od=null,Ad=0,rd&6)throw Error(i(331));var c=rd;if(rd|=4,Qu(o.current),Wu(o,o.current,s,n),rd=c,Ff(0,!1),Xe&&typeof Xe.onPostCommitFiberRoot==`function`)try{Xe.onPostCommitFiberRoot(Ye,o)}catch{}return!0}finally{me.p=a,F.T=r,_f(e,t)}}function bf(e,t,n){t=Vi(n,t),t=Ac(e.stateNode,t,2),e=_o(e,t,2),e!==null&&(dt(e,2),Pf(e))}function xf(e,t,n){if(e.tag===3)bf(e,e,n);else for(;t!==null;){if(t.tag===3){bf(t,e,n);break}if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(Ed===null||!Ed.has(r))){e=Vi(n,e),n=jc(2),r=_o(t,n,2),r!==null&&(Mc(n,r,t,e),dt(r,2),Pf(r));break}}t=t.return}}function Sf(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new nd;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(dd=!0,i.add(n),e=Cf.bind(null,e,t,n),t.then(e,e))}function Cf(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,id===e&&(od&n)===n&&(pd===4||pd===3&&(od&62914560)===od&&300>Ve()-Sd?rd&2?gd|=n:Jd(e,0):gd|=n,vd===od&&(vd=0)),Pf(e)}function wf(e,t){t===0&&(t=lt()),e=Ei(e,t),e!==null&&(dt(e,t),Pf(e))}function Tf(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),wf(e,n)}function Ef(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),wf(e,n)}function Df(e,t){return Le(e,t)}var Of=null,kf=null,Af=!1,jf=!1,Mf=!1,Nf=0;function Pf(e){e!==kf&&e.next===null&&(kf===null?Of=kf=e:kf=kf.next=e),jf=!0,Af||(Af=!0,Vf())}function Ff(e,t){if(!Mf&&jf){Mf=!0;do for(var n=!1,r=Of;r!==null;){if(!t){if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-L(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,Bf(r,a))}else a=od,a=at(r,r===id?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||ot(r,a)||(n=!0,Bf(r,a))}r=r.next}while(n);Mf=!1}}function If(){Lf()}function Lf(){jf=Af=!1;var e=0;Nf!==0&&Tp()&&(e=Nf);for(var t=Ve(),n=null,r=Of;r!==null;){var i=r.next,a=Rf(r,t);a===0?(r.next=null,n===null?Of=i:n.next=i,i===null&&(kf=n)):(n=r,(e!==0||a&3)&&(jf=!0)),r=i}Dd!==0&&Dd!==5||Ff(e,!1),Nf!==0&&(Nf=0)}function Rf(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-L(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=ct(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=id,n=od,n=at(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(sd===2||sd===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Re(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||ot(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Re(r),_t(n)){case 2:case 8:n=We;break;case 32:n=Ge;break;case 268435456:n=I;break;default:n=Ge}return r=zf.bind(null,e),n=Le(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Re(r),e.callbackPriority=2,e.callbackNode=null,2}function zf(e,t){if(Dd!==0&&Dd!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(vf()&&e.callbackNode!==n)return null;var r=od;return r=at(e,e===id?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Hd(e,r,t),Rf(e,Ve()),e.callbackNode!=null&&e.callbackNode===n?zf.bind(null,e):null)}function Bf(e,t){if(vf())return null;Hd(e,t,!0)}function Vf(){Ap(function(){rd&6?Le(Ue,If):Lf()})}function Hf(){if(Nf===0){var e=Ra;e===0&&(e=tt,tt<<=1,!(tt&261888)&&(tt=256)),Nf=e}return Nf}function Uf(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:_n(e)}function Wf(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=Uf((i[St]||null).action),o=r.submitter;o&&(t=(t=o[St]||null)?Uf(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new zn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(Nf!==0){var e=new FormData(i,o);nc(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=new FormData(i,o),nc(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var Gf=0;Gf<R.length;Gf++){var Kf=R[Gf];mi(Kf.toLowerCase(),`on`+(Kf[0].toUpperCase()+Kf.slice(1)))}mi(oi,`onAnimationEnd`),mi(si,`onAnimationIteration`),mi(ci,`onAnimationStart`),mi(`dblclick`,`onDoubleClick`),mi(`focusin`,`onFocus`),mi(`focusout`,`onBlur`),mi(li,`onTransitionRun`),mi(ui,`onTransitionStart`),mi(di,`onTransitionCancel`),mi(fi,`onTransitionEnd`),Bt(`onMouseEnter`,[`mouseout`,`mouseover`]),Bt(`onMouseLeave`,[`mouseout`,`mouseover`]),Bt(`onPointerEnter`,[`pointerout`,`pointerover`]),Bt(`onPointerLeave`,[`pointerout`,`pointerover`]),zt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),zt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),zt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),zt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),zt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),zt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var qf=`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(` `),Jf=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(qf));function Yf(e,t){t=!!(t&4);for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){yi(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){yi(e)}i.currentTarget=null,a=c}}}}function Xf(e,t){var n=t[wt];n===void 0&&(n=t[wt]=new Set);var r=e+`__bubble`;n.has(r)||(ep(t,e,2,!1),n.add(r))}function Zf(e,t,n){var r=0;t&&(r|=4),ep(n,e,r,t)}var Qf=`_reactListening`+Math.random().toString(36).slice(2);function $f(e){if(!e[Qf]){e[Qf]=!0,Lt.forEach(function(t){t!==`selectionchange`&&(Jf.has(t)||Zf(t,!1,e),Zf(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Qf]||(t[Qf]=!0,Zf(`selectionchange`,!1,t))}}function ep(e,t,n,r){switch(Mh(t)){case 2:var i=Eh;break;case 8:i=Dh;break;default:i=Oh}n=i.bind(null,t,n,e),i=void 0,!On||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function tp(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=jt(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}Tn(function(){var r=a,i=bn(n),s=[];a:{var c=pi.get(e);if(c!==void 0){var l=zn,u=e;switch(e){case`keypress`:if(Pn(n)===0)break a;case`keydown`:case`keyup`:l=rr;break;case`focusin`:u=`focus`,l=Jn;break;case`focusout`:u=`blur`,l=Jn;break;case`beforeblur`:case`afterblur`:l=Jn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Kn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=qn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=or;break;case oi:case si:case ci:l=Yn;break;case fi:l=sr;break;case`scroll`:case`scrollend`:l=Vn;break;case`wheel`:l=cr;break;case`copy`:case`cut`:case`paste`:l=Xn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=ir;break;case`submit`:l=ar;break;case`toggle`:case`beforetoggle`:l=lr}var d=!!(t&4),f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=En(m,p),g!=null&&d.push(np(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(l=e===`mouseover`||e===`pointerover`,c=e===`mouseout`||e===`pointerout`,l&&n!==yn&&(u=n.relatedTarget||n.fromElement)&&(jt(u)||u[Ct]))break a;(c||l)&&(u=i.window===i?i:(l=i.ownerDocument)?l.defaultView||l.parentWindow:window,c?(l=n.relatedTarget||n.toElement,c=r,l=l?jt(l):null,l!==null&&(f=o(l),d=l.tag,l!==f||d!==5&&d!==27&&d!==6)&&(l=null)):(c=null,l=r),c!==l&&(d=Kn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=ir,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=c==null?u:Nt(c),h=l==null?u:Nt(l),u=new d(g,m+`leave`,c,n,i),u.target=f,u.relatedTarget=h,g=null,jt(i)===r&&(d=new d(p,m+`enter`,l,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,d=c&&l?w(c,l,ip):null,c!==null&&ap(s,u,c,d,!1),l!==null&&f!==null&&ap(s,f,l,d,!0)))}a:{if(c=r?Nt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var _=kr;else if(Cr(c)){if(Ar)_=zr;else{_=Lr;var v=Ir}}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&mn(r.elementType)&&(_=kr):_=Rr;if(_&&=_(e,r)){wr(s,_,n,i);break a}v&&v(e,c,r)}switch(v=r?Nt(r):window,e){case`focusin`:(Cr(v)||v.contentEditable===`true`)&&(Xr=v,Zr=r,Qr=null);break;case`focusout`:Qr=Zr=Xr=null;break;case`mousedown`:$r=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:$r=!1,ei(s,n,i);break;case`selectionchange`:if(Yr)break;case`keydown`:case`keyup`:ei(s,n,i)}var y;if(dr)b:{switch(e){case`compositionstart`:var b=`onCompositionStart`;break b;case`compositionend`:b=`onCompositionEnd`;break b;case`compositionupdate`:b=`onCompositionUpdate`;break b}b=void 0}else yr?_r(e,n)&&(b=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(b=`onCompositionStart`);b&&(mr&&n.locale!==`ko`&&(yr||b!==`onCompositionStart`?b===`onCompositionEnd`&&yr&&(y=Nn()):(An=i,jn=`value`in An?An.value:An.textContent,yr=!0)),v=rp(r,b),0<v.length&&(b=new Zn(b,e,null,n,i),s.push({event:b,listeners:v}),y?b.data=y:(y=vr(n),y!==null&&(b.data=y)))),(y=pr?br(e,n):xr(e,n))&&(b=rp(r,`onBeforeInput`),0<b.length&&(v=new Zn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:v,listeners:b}),v.data=y)),Wf(s,e,r,n,i)}Yf(s,t)})}function np(e,t,n){return{instance:e,listener:t,currentTarget:n}}function rp(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=En(e,n),i!=null&&r.unshift(np(e,i,a)),i=En(e,t),i!=null&&r.push(np(e,i,a))),e.tag===3)return r;e=e.return}return[]}function ip(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function ap(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=En(n,a),l!=null&&o.unshift(np(n,l,c))):i||(l=En(n,a),l!=null&&o.push(np(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var op=/\r\n?/g,sp=/\u0000|\uFFFD/g;function cp(e){return(typeof e==`string`?e:``+e).replace(op,`
|
|
218
|
-
`).replace(sp,``)}function lp(e,t){return t=cp(t),cp(e)===t}function up(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||un(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&un(e,``+r);else return;break;case`className`:Jt(e,`class`,r);break;case`tabIndex`:Jt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Jt(e,n,r);break;case`style`:pn(e,r,o);return;case`data`:if(t!==`object`){Jt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=_n(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&up(e,t,`name`,a.name,a,null),up(e,t,`formEncType`,a.formEncType,a,null),up(e,t,`formMethod`,a.formMethod,a,null),up(e,t,`formTarget`,a.formTarget,a,null)):(up(e,t,`encType`,a.encType,a,null),up(e,t,`method`,a.method,a,null),up(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=_n(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=vn);return;case`onScroll`:r!=null&&Xf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Xf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=_n(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`: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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Xf(`beforetoggle`,e),Xf(`toggle`,e),qt(e,`popover`,r);break;case`xlinkActuate`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:qt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=hn.get(n)||n,qt(e,n,r);else return}Gt=!0}function dp(e,t,n,r,a,o){switch(n){case`style`:pn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)un(e,r);else if(typeof r==`number`||typeof r==`bigint`)un(e,``+r);else return;break;case`onScroll`:r!=null&&Xf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Xf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=vn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Rt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[St]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Gt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):qt(e,n,r)}return}Gt=!0}function fp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Xf(`error`,e),Xf(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:up(e,t,o,s,n,null)}}a&&up(e,t,`srcSet`,n.srcSet,n,null),r&&up(e,t,`src`,n.src,n,null);return;case`input`:Xf(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:up(e,t,r,d,n,null)}}an(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Xf(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:up(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&sn(e,!!r,n,!0):sn(e,!!r,t,!1);return;case`textarea`:for(s in Xf(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:up(e,t,s,c,n,null)}ln(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:up(e,t,l,r,n,null)}return;case`dialog`:Xf(`beforetoggle`,e),Xf(`toggle`,e),Xf(`cancel`,e),Xf(`close`,e);break;case`iframe`:case`object`:Xf(`load`,e);break;case`video`:case`audio`:for(r=0;r<qf.length;r++)Xf(qf[r],e);break;case`image`:Xf(`error`,e),Xf(`load`,e);break;case`details`:Xf(`toggle`,e);break;case`embed`:case`source`:case`link`:Xf(`error`,e),Xf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:up(e,t,u,r,n,null)}return;default:if(mn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&dp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&up(e,t,c,r,n,null))}var pp={};function mp(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||up(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Gt=!0),o=m;break;case`name`:m!==f&&(Gt=!0),a=m;break;case`checked`:m!==f&&(Gt=!0),u=m;break;case`defaultChecked`:m!==f&&(Gt=!0),d=m;break;case`value`:m!==f&&(Gt=!0),s=m;break;case`defaultValue`:m!==f&&(Gt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&up(e,t,p,m,r,f)}}rn(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||up(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(Gt=!0),p=o;break;case`defaultValue`:o!==l&&(Gt=!0),c=o;break;case`multiple`:o!==l&&(Gt=!0),s=o;default:o!==l&&up(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?sn(e,!!n,n?[]:``,!1):sn(e,!!n,t,!0)):sn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:up(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(Gt=!0),p=a;break;case`defaultValue`:a!==o&&(Gt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&up(e,t,s,a,r,o)}cn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:up(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Gt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:up(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&up(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:up(e,t,u,p,r,m)}return;default:if(mn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&dp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||dp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&up(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||up(e,t,f,p,r,m)}function hp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function gp(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&hp(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&hp(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var _p=null,vp=null;function yp(e){return e.nodeType===9?e:e.ownerDocument}function bp(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function xp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Sp(e,t,n,r){return n=yp(n).createElement(e),n[xt]=r,n[St]=t,fp(n,e,t),Ft(n),n}function Cp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var wp=null;function Tp(){var e=window.event;return e&&e.type===`popstate`?e!==wp&&(wp=e,!0):(wp=null,!1)}var Ep=typeof setTimeout==`function`?setTimeout:void 0,Dp=typeof clearTimeout==`function`?clearTimeout:void 0,Op=typeof Promise==`function`?Promise:void 0,kp=typeof requestAnimationFrame==`function`?requestAnimationFrame:Ep,Ap=typeof queueMicrotask==`function`?queueMicrotask:Op===void 0?Ep:function(e){return Op.resolve(null).then(e).catch(jp)};function jp(e){setTimeout(function(){throw e})}function Mp(e){return e===`head`}function Np(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Zh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Em(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Em(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Ot]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Em(e.ownerDocument.body)}n=i}while(n);Zh(t)}function Pp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Fp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ip(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Lp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Rp(e){return Lp(e.getBoundingClientRect(),getComputedStyle(e),e)}function zp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Lp(t,n,e)}function Bp(e){return e.documentElement.clientHeight}function Vp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Hp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Bp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=ah(f),u>ch){s.length=o;break}f=new Promise(Vp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Up(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Up.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:T({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Up.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Up.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Wp(e){return{name:e,group:new Up(`group`,e),imagePair:new Up(`image-pair`,e),old:new Up(`old`,e),new:new Up(`new`,e)}}function Gp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Gp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Yp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Jp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),f(this._fragmentFiber.child,!1,Kp,e,s,r)}this._eventListeners=a}};function Kp(e,t,n,r){return v(e).addEventListener(t,n,r),!1}Gp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Yp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Jp(i.optionsOrUseCapture),f(this._fragmentFiber.child,!1,qp,e,n,i),r.splice(t,1),a!==null&&a()}};function qp(e,t,n,r){return v(e).removeEventListener(t,n,r),!1}function Jp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function U(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Yp(e,t,n,r){if(e.length===0)return-1;r=U(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&U(a.optionsOrUseCapture)===r)return i}return-1}Gp.prototype.dispatchEvent=function(e){var t=p(this._fragmentFiber);if(t===null)return!0;t=v(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Jp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Jp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Gp.prototype.focus=function(e){f(this._fragmentFiber.child,!0,Xp,e,void 0,void 0)};function Xp(e,t){return e.tag!==6&&(e=v(e),Sm(e,t))}Gp.prototype.focusLast=function(e){var t=[];f(this._fragmentFiber.child,!0,Zp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Xp(t[n],e);n--);};function Zp(e,t){return t.push(e),!1}Gp.prototype.blur=function(){var e=p(this._fragmentFiber);e!==null&&(e=v(e),e=yp(e).activeElement,e!==null&&f(this._fragmentFiber.child,!1,Qp,e,void 0,void 0))};function Qp(e,t){return e.tag!==6&&(e=v(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Gp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),f(this._fragmentFiber.child,!1,$p,e,void 0,void 0)};function $p(e,t){return e.tag!==6&&(e=v(e),t.observe(e),!1)}Gp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),f(this._fragmentFiber.child,!1,em,e,void 0,void 0);for(var n=t=0;n<tm.length;n++){var r=tm[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):tm[t++]=r}tm.length=t}};function em(e,t){return e.tag!==6&&(e=v(e),t.unobserve(e),!1)}var tm=[],nm=!1;function rm(e,t,n){tm.push({fragmentInstance:e,observer:t,instance:n}),nm||(nm=!0,Cm(function(){nm=!1;var e=tm;tm=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Gp.prototype.getClientRects=function(){var e=[];return f(this._fragmentFiber.child,!1,im,e,void 0,void 0),e};function im(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=v(e),t.push.apply(t,e.getClientRects());return!1}Gp.prototype.getRootNode=function(e){var t=p(this._fragmentFiber);return t===null?this:v(t).getRootNode(e)},Gp.prototype.compareDocumentPosition=function(e){var t=p(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];f(this._fragmentFiber.child,!1,Zp,n,void 0,void 0);var r=v(t);if(n.length===0){if(n=r,h(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=g(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=v(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=v(n[0]),i=v(n[n.length-1]);var a=h(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||am(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function am(e,t,n,r,i){var a=jt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=p(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=w(n,a,C),t===null?t=!1:(f(t,!0,x,a,n),a=y,y=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=w(r,a,C),t===null?t=!1:(f(t,!0,S,a,r),a=y,b=y=null,t=a!==null)),t):!1}function om(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Gp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];f(this._fragmentFiber.child,!1,Zp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=g(this._fragmentFiber);if(r=n?r[1]||r[0]||p(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=v(r),om(e,n);return}if(r=v(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=v(a),om(a,n)):v(a).scrollIntoView(e),r+=n?-1:1}};function sm(e,t){return e=v(e),cm(e,t),!1}function cm(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function lm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Jp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<tm.length;i++){var a=tm[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(tm[r++]=a)}tm.length=r,n.observe(e)}),cm(e,t))}function um(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Jp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?rm(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function dm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:dm(n),At(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function fm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Ot])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=vm(e.nextSibling),e===null)break}return null}function pm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=vm(e.nextSibling),e===null))return null;return e}function mm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=vm(e.nextSibling),e===null))return null;return e}function hm(e){return e.data===`$?`||e.data===`$~`}function gm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function _m(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function vm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var ym=null;function bm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return vm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function xm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function Sm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function Cm(e){kp(function(){kp(function(t){return e(t)})})}function wm(e,t,n){switch(t=yp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Tm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&up(e,t,r,null,pp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===vn&&(e.onclick=null),At(e)}function Em(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);At(e)}var Dm=new Map,Om=new Set;function km(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Am=me.d;me.d={f:jm,r:Mm,D:Fm,C:Im,L:Lm,m:Rm,X:Bm,S:zm,M:Vm};function jm(){var e=Am.f(),t=Kd();return e||t}function Mm(e){var t=Mt(e);t!==null&&t.tag===5&&t.type===`form`?ic(t):Am.r(e)}var Nm=typeof document>`u`?null:document;function Pm(e,t,n){var r=Nm;if(r&&typeof t==`string`&&t){var i=nn(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Om.has(i)||(Om.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),fp(t,`link`,e),Ft(t),r.head.appendChild(t)))}}function Fm(e){Am.D(e),Pm(`dns-prefetch`,e,null)}function Im(e,t){Am.C(e,t),Pm(`preconnect`,e,t)}function Lm(e,t,n){Am.L(e,t,n);var r=Nm;if(r&&e&&t){var i=`link[rel="preload"][as="`+nn(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+nn(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+nn(n.imageSizes)+`"]`)):i+=`[href="`+nn(e)+`"]`;var a=i;switch(t){case`style`:a=Um(e);break;case`script`:a=qm(e)}if(!(Dm.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Dm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Wm(a))||t===`script`&&r.querySelector(Jm(a))))){var o=r.createElement(`link`);fp(o,`link`,e),t===`style`&&(o[kt]=!0,o.onload=o.onerror=function(){It(o)}),Ft(o),r.head.appendChild(o)}}}function Rm(e,t){Am.m(e,t);var n=Nm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+nn(r)+`"][href="`+nn(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=qm(e)}if(!Dm.has(a)&&(e=T({rel:`modulepreload`,href:e},t),Dm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Jm(a)))return}r=n.createElement(`link`),fp(r,`link`,e),Ft(r),n.head.appendChild(r)}}}function zm(e,t,n){Am.S(e,t,n);var r=Nm;if(r&&e){var i=Pt(r).hoistableStyles,a=Um(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Wm(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Dm.get(a))&&Zm(e,n);var c=o=r.createElement(`link`);Ft(c),fp(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Xm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Bm(e,t){Am.X(e,t);var n=Nm;if(n&&e){var r=Pt(n).hoistableScripts,i=qm(e),a=r.get(i);a||(a=n.querySelector(Jm(i)),a||(e=T({src:e,async:!0},t),(t=Dm.get(i))&&Qm(e,t),a=n.createElement(`script`),Ft(a),fp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Vm(e,t){Am.M(e,t);var n=Nm;if(n&&e){var r=Pt(n).hoistableScripts,i=qm(e),a=r.get(i);a||(a=n.querySelector(Jm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=Dm.get(i))&&Qm(e,t),a=n.createElement(`script`),Ft(a),fp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Hm(e,t,n,r){var a=(a=Ce.current)?km(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Um(n.href),t=Pt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Um(n.href);var o=Pt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Wm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=Dm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Dm.set(e,o)),Km(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=qm(n),t=Pt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Um(e){return`href="`+nn(e)+`"`}function Wm(e){return`link[rel="stylesheet"][`+e+`]`}function Gm(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Km(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[kt]){r.loading=1;return}}else t=e.createElement(`link`),t[kt]=!0,t.onload=t.onerror=It.bind(null,t),fp(t,`link`,n),Ft(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function qm(e){return`[src="`+nn(e)+`"]`}function Jm(e){return`script[async]`+e}function Ym(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+nn(n.href)+`"]`);if(r)return t.instance=r,Ft(r),r;var a=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ft(r),fp(r,`style`,a),Xm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Um(n.href);var o=e.querySelector(Wm(a));if(o)return t.state.loading|=4,t.instance=o,Ft(o),o;r=Gm(n),(a=Dm.get(a))&&Zm(r,a),o=(e.ownerDocument||e).createElement(`link`),Ft(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),fp(o,`link`,r),t.state.loading|=4,Xm(o,n.precedence,e),t.instance=o;case`script`:return o=qm(n.src),(a=e.querySelector(Jm(o)))?(t.instance=a,Ft(a),a):(r=n,(a=Dm.get(o))&&(r=T({},n),Qm(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Ft(a),fp(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Xm(r,n.precedence,e));return t.instance}function Xm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Zm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Qm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var $m=null;function eh(e,t,n){if($m===null){var r=new Map,i=$m=new Map;i.set(n,r)}else i=$m,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Ot]||a[xt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function th(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function nh(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function rh(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function ih(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function ah(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function oh(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=ah(t),e.suspenseyImages.push(t)),e=fh.bind(e),t.decode().then(e,e))}function sh(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Um(r.href),a=t.querySelector(Wm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=dh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ft(a);return}a=t.ownerDocument||t,r=Gm(r),(i=Dm.get(i))&&Zm(r,i),a=a.createElement(`link`),Ft(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),fp(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=dh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ch=0;function lh(e,t){return e.stylesheets&&e.count===0&&mh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&mh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ch===0&&(ch=62500*gp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&mh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ch?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function uh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)mh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function dh(){this.count--,uh(this)}function fh(){this.imgCount--,uh(this)}var ph=null;function mh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ph=new Map,t.forEach(hh,e),ph=null,dh.call(e))}function hh(e,t){if(!(t.state.loading&4)){var n=ph.get(e);if(n)var r=n.get(null);else{n=new Map,ph.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=dh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var gh={$$typeof:N,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function _h(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,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=ut(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ut(0),this.hiddenUpdates=ut(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function vh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new _h(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ji(3,null,null,t),e.current=a,a.stateNode=e,t=ja(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},mo(a),e}function yh(e){return e?(e=ki,e):ki}function bh(e,t,n,r,i,a){i=yh(i),r.context===null?r.context=i:r.pendingContext=i,r=go(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=_o(e,r,t),n!==null&&(Vd(n,e,t),vo(n,e,t))}function xh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Sh(e,t){xh(e,t),(e=e.alternate)&&xh(e,t)}function Ch(e){if(e.tag===13||e.tag===31){var t=Ei(e,67108864);t!==null&&Vd(t,e,67108864),Sh(e,67108864)}}function wh(e){if(e.tag===13||e.tag===31){var t=Rd();t=gt(t);var n=Ei(e,t);n!==null&&Vd(n,e,t),Sh(e,t)}}var Th=!0;function Eh(e,t,n,r){var i=F.T;F.T=null;var a=me.p;try{me.p=2,Oh(e,t,n,r)}finally{me.p=a,F.T=i}}function Dh(e,t,n,r){var i=F.T;F.T=null;var a=me.p;try{me.p=8,Oh(e,t,n,r)}finally{me.p=a,F.T=i}}function Oh(e,t,n,r){if(Th){var i=kh(r);if(i===null)tp(e,t,r,Ah,n),Vh(e,r);else if(Uh(i,e,t,n,r))r.stopPropagation();else if(Vh(e,r),t&4&&-1<Bh.indexOf(e)){for(;i!==null;){var a=Mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=it(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-L(o);s.entanglements[1]|=c,o&=~c}Pf(a),!(rd&6)&&(wd=Ve()+500,Ff(0,!1))}}break;case 31:case 13:s=Ei(a,2),s!==null&&Vd(s,a,2),Kd(),Sh(a,2)}if(a=kh(r),a===null&&tp(e,t,r,Ah,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else tp(e,t,r,null,n)}}function kh(e){return e=bn(e),jh(e)}var Ah=null;function jh(e){if(Ah=null,e=jt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ah=e,null}function Mh(e){switch(e){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`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`fullscreenerror`: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`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(He()){case Ue:return 2;case We:return 8;case Ge:case Ke:return 32;case I:return 268435456;default:return 32}default:return 32}}var Nh=!1,Ph=null,Fh=null,Ih=null,Lh=new Map,Rh=new Map,zh=[],Bh=`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 Vh(e,t){switch(e){case`focusin`:case`focusout`:Ph=null;break;case`dragenter`:case`dragleave`:Fh=null;break;case`mouseover`:case`mouseout`:Ih=null;break;case`pointerover`:case`pointerout`:Lh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Rh.delete(t.pointerId)}}function Hh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Mt(t),t!==null&&Ch(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Uh(e,t,n,r,i){switch(t){case`focusin`:return Ph=Hh(Ph,e,t,n,r,i),!0;case`dragenter`:return Fh=Hh(Fh,e,t,n,r,i),!0;case`mouseover`:return Ih=Hh(Ih,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Lh.set(a,Hh(Lh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Rh.set(a,Hh(Rh.get(a)||null,e,t,n,r,i)),!0}return!1}function Wh(e){var t=jt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,yt(e.priority,function(){wh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,yt(e.priority,function(){wh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Gh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=kh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);yn=r,n.target.dispatchEvent(r),yn=null}else return t=Mt(n),t!==null&&Ch(t),e.blockedOn=n,!1;t.shift()}return!0}function Kh(e,t,n){Gh(e)&&n.delete(t)}function qh(){Nh=!1,Ph!==null&&Gh(Ph)&&(Ph=null),Fh!==null&&Gh(Fh)&&(Fh=null),Ih!==null&&Gh(Ih)&&(Ih=null),Lh.forEach(Kh),Rh.forEach(Kh)}function Jh(e,n){e.blockedOn===n&&(e.blockedOn=null,Nh||(Nh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,qh)))}var Yh=null;function Xh(e){Yh!==e&&(Yh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Yh===e&&(Yh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(jh(r||n)===null)continue;break}var a=Mt(n);a!==null&&(e.splice(t,3),t-=3,nc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Zh(e){function t(t){return Jh(t,e)}Ph!==null&&Jh(Ph,e),Fh!==null&&Jh(Fh,e),Ih!==null&&Jh(Ih,e),Lh.forEach(t),Rh.forEach(t);for(var n=0;n<zh.length;n++){var r=zh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<zh.length&&(n=zh[0],n.blockedOn===null);)Wh(n),n.blockedOn===null&&zh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[St]||null;if(typeof a==`function`)o||Xh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[St]||null)s=o.formAction;else if(jh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Xh(n)}}}function Qh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function $h(e){this._internalRoot=e}eg.prototype.render=$h.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;bh(n,Rd(),e,t,null,null)},eg.prototype.unmount=$h.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;bh(e.current,2,null,e,null,null),Kd(),t[Ct]=null}};function eg(e){this._internalRoot=e}eg.prototype.unstable_scheduleHydration=function(e){if(e){var t=vt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<zh.length&&t!==0&&t<zh[n].priority;n++);zh.splice(n,0,e),n===0&&Wh(e)}};var tg=n.version;if(tg!==`19.3.0`)throw Error(i(527,tg,`19.3.0`));me.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var ng={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:F,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var rg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rg.isDisabled&&rg.supportsFiber)try{Ye=rg.inject(ng),Xe=rg}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Tc,s=Ec,c=Dc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=vh(e,1,!1,null,null,n,r,null,o,s,c,Qh),e[Ct]=t.current,$f(e),new $h(t)}})),CJ=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=SJ()}))();function wJ(e){if(e.resourceType===`Patient`)return e;if(e.resourceType===`DiagnosticReport`||e.resourceType===`Encounter`||e.resourceType===`Observation`||e.resourceType===`ServiceRequest`)return e.subject}function TJ(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 EJ(e){return kC(e.getActiveLogin()?.project)}var DJ={totp:`Authenticator app (TOTP)`,email:`Email`};function OJ(e){return e?e.mfaMethod&&e.mfaMethod.length>0?e.mfaMethod:e.mfaEnrolled?[`totp`]:[]:[]}function kJ(e){let t=e?.find(e=>e.name===`allowedMfaMethods`)?.valueString;if(!t)return[`totp`];let n=t.split(`,`).map(e=>e.trim()).filter(e=>e===`totp`||e===`email`);return n.length>0?n:[`totp`]}var AJ={totp:`MFA: Authenticator`,email:`MFA: Email`},jJ=16;function MJ(e){let t=e.user?.reference;return t?.startsWith(`User/`)?t.slice(5):void 0}function NJ(e){let t=Z(),n=EJ(t),r=FK(),[i,a]=(0,b.useState)(e.profileTypeOptions[0].value),{showMfaEnrollment:o}=e,[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)({});(0,b.useEffect)(()=>{o&&n&&t.get(`admin/projects/${n}`).then(e=>c(kJ(e.project?.setting))).catch(()=>c(void 0))},[t,n,o]);let d=(0,b.useCallback)(e=>{if(!o)return;let n=e.response.entry??[],r=Array.from(new Set(n.map(e=>e.resource?MJ(e.resource):void 0).filter(e=>e!==void 0)));if(r.length===0){u({});return}let i={resourceType:`Bundle`,type:`batch`,entry:r.map(e=>({request:{method:`GET`,url:`User/${e}`}}))};t.executeBatch(i).then(e=>{let t={};for(let n of e.entry??[]){let e=n.resource;e?.resourceType===`User`&&e.id&&(t[e.id]=e)}u(t)}).catch(()=>u({}))},[t,o]),f=(0,b.useMemo)(()=>{if(!o)return;let e=[{name:`Project-scoped`,renderCell:e=>{let t=MJ(e);return(t?l[t]:void 0)?.project?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(jj,{size:jJ,color:`var(--mantine-color-blue-6)`,style:{verticalAlign:`middle`},"aria-hidden":`true`}),(0,L.jsx)(bl,{children:`Project-scoped`})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(HM,{size:jJ,color:`var(--mantine-color-gray-6)`,style:{verticalAlign:`middle`},"aria-hidden":`true`}),(0,L.jsx)(bl,{children:`Not project-scoped`})]})}}];return s&&s.length>0&&e.push(...s.toSorted((e,t)=>t.localeCompare(e)).map(e=>({name:AJ[e],renderCell:t=>{let n=MJ(t),r=n?l[n]:void 0;return r?OJ(r).includes(e)?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(jj,{size:jJ,color:`var(--mantine-color-blue-6)`,style:{verticalAlign:`middle`},"aria-hidden":`true`}),(0,L.jsx)(bl,{children:`Enrolled`})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(HM,{size:jJ,color:`var(--mantine-color-gray-6)`,style:{verticalAlign:`middle`},"aria-hidden":`true`}),(0,L.jsx)(bl,{children:`Not enrolled`})]}):(0,L.jsx)(H,{c:`dimmed`,size:`sm`,children:`—`})}}))),e},[o,s,l]),[p,m]=(0,b.useState)({resourceType:`ProjectMembership`,filters:[{code:`project`,operator:X.EQUALS,value:`Project/`+n},{code:`profile-type`,operator:X.EQUALS,value:i}],fields:e.fields,count:100});function h(e){a(e),m({...p,filters:[{code:`project`,operator:X.EQUALS,value:`Project/`+n},{code:`profile-type`,operator:X.EQUALS,value:e}]})}let g=e.profileTypeOptions.length>1,_=g||e.toolbarLeft!==void 0||e.toolbarRight!==void 0;return(0,L.jsxs)(L.Fragment,{children:[_&&(0,L.jsxs)(V,{justify:`space-between`,align:`center`,mb:`md`,wrap:`nowrap`,children:[(0,L.jsxs)(V,{gap:`md`,wrap:`nowrap`,children:[g&&(0,L.jsx)(by,{value:i,onChange:h,data:e.profileTypeOptions}),e.toolbarLeft]}),e.toolbarRight]}),(0,L.jsx)(zB,{search:p,onClick:e=>r(`./${e.resource.id}`),onChange:e=>m(e.definition),onLoad:d,additionalColumns:f,hideFilters:!0,hideToolbar:!0})]})}function PJ(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`ProjectMemberships by Bot`}),(0,L.jsx)(NJ,{profileTypeOptions:[{label:`Bot`,value:`Bot`}],fields:[`user`,`profile`,`accessPolicy`,`userConfiguration`,`active`,`admin`],toolbarLeft:(0,L.jsx)(Cl,{withBorder:!0,p:`sm`,radius:`sm`,maw:520,children:(0,L.jsxs)(H,{size:`sm`,c:`dimmed`,children:[`Please note that this list is limited to Bots that have a ProjectMembership. Bots that are run as user commonly do not have a ProjectMembership, and are not included, such as most Bots in Medplum-managed integrations. For a complete list of Bots, see `,(0,L.jsx)(eN,{to:`/Bot`,children:`Bots`}),`. For more information, see`,` `,(0,L.jsx)(Rd,{href:`https://www.medplum.com/docs/bots/bot-run-as-user`,target:`_blank`,rel:`noopener noreferrer`,children:`running Bots as user`}),`.`]})}),toolbarRight:(0,L.jsx)(Rd,{href:`https://www.medplum.com/docs/bots`,target:`_blank`,rel:`noopener noreferrer`,size:`sm`,children:`Learn more about Bots`})}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(eN,{to:`/admin/bots/new`,children:`Create new bot`})})]})}function FJ(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`ProjectMemberships by ClientApplication`}),(0,L.jsx)(NJ,{profileTypeOptions:[{label:`ClientApplication`,value:`ClientApplication`}],fields:[`user`,`profile`,`accessPolicy`,`userConfiguration`,`active`,`admin`]}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(eN,{to:`/admin/clients/new`,children:`Create new client`})})]})}function IJ(e){return(0,L.jsx)(jL,{resourceType:`AccessPolicy`,name:e.name,defaultValue:e.defaultValue,placeholder:`Access Policy`,onChange:t=>{fT(t)?e.onChange(DC(t)):e.onChange(void 0)}})}function LJ(){let e=Z(),t=EJ(e),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)(void 0);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`Create new Bot`}),(0,L.jsxs)(NP,{onSubmit:()=>{let r={name:n,description:i,accessPolicy:o};e.post(`admin/projects/`+t+`/bot`,r).then(t=>{e.invalidateSearches(`Bot`),e.invalidateSearches(`ProjectMembership`),d(t),q({color:`green`,message:`Bot created`})}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1}),l(yS(e))})},children:[!u&&(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Name`,htmlFor:`name`,outcome:c,children:(0,L.jsx)(jb,{id:`name`,name:`name`,required:!0,autoFocus:!0,onChange:e=>r(e.currentTarget.value),error:BF(c,`name`)})}),(0,L.jsx)(eL,{title:`Description`,htmlFor:`description`,outcome:c,children:(0,L.jsx)(jb,{id:`description`,name:`description`,onChange:e=>a(e.currentTarget.value),error:BF(c,`description`)})}),(0,L.jsx)(eL,{title:`Access Policy`,htmlFor:`accessPolicy`,outcome:c,children:(0,L.jsx)(IJ,{name:`accessPolicy`,onChange:s})}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(U,{type:`submit`,children:`Create Bot`})})]}),u&&(0,L.jsxs)(`div`,{"data-testid":`success`,children:[(0,L.jsx)(H,{children:`Bot created`}),(0,L.jsxs)(Oh,{children:[(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:u,children:`Go to new bot`})}),(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:`/admin/bots`,children:`Back to bots list`})})]})]})]})]})}function RJ(){let e=Z(),t=EJ(e),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)(),[f,p]=(0,b.useState)(void 0);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`Create new Client`}),(0,L.jsxs)(NP,{onSubmit:()=>{let r={name:n,description:i,redirectUri:o,accessPolicy:c};e.post(`admin/projects/`+t+`/client`,r).then(t=>{e.invalidateSearches(`ClientApplication`),e.invalidateSearches(`ProjectMembership`),p(t),q({color:`green`,message:`Client created`})}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1}),d(yS(e))})},children:[!f&&(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Name`,htmlFor:`name`,outcome:u,children:(0,L.jsx)(jb,{id:`name`,name:`name`,required:!0,autoFocus:!0,onChange:e=>r(e.currentTarget.value),error:BF(u,`name`)})}),(0,L.jsx)(eL,{title:`Description`,htmlFor:`description`,outcome:u,children:(0,L.jsx)(jb,{id:`description`,name:`description`,onChange:e=>a(e.currentTarget.value),error:BF(u,`description`)})}),(0,L.jsx)(eL,{title:`Redirect URI`,htmlFor:`redirectUri`,outcome:u,children:(0,L.jsx)(jb,{id:`redirectUri`,name:`redirectUri`,onChange:e=>s(e.currentTarget.value),error:BF(u,`redirectUri`)})}),(0,L.jsx)(eL,{title:`Access Policy`,htmlFor:`accessPolicy`,outcome:u,children:(0,L.jsx)(IJ,{name:`accessPolicy`,onChange:l})}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(U,{type:`submit`,children:`Create Client`})})]}),f&&(0,L.jsxs)(`div`,{"data-testid":`success`,children:[(0,L.jsx)(H,{children:`Client created`}),(0,L.jsxs)(Oh,{children:[(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:f,children:`Go to new client`})}),(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:`/admin/clients`,children:`Back to clients list`})})]})]})]})]})}var zJ=1e-10;function BJ(e,t){let n=0,r=Math.exp(-t);for(let i=0;i<=e;i++)i>0&&(r*=t/i),n+=r;return n}function VJ(e,t,n=zJ){let r=0,i=Math.max(t+1,1);for(;BJ(t,i)>e;)i*=2;for(;i-r>n;){let n=(r+i)/2;BJ(t,n)>e?r=n:i=n}return i}function HJ(e,t,n,r){let i=e*300,a=9*t*i/(e*10*1e3/7),o=Math.ceil(a),s=o/i,c=Math.max(r??0,s),l=r?c*i:o,u=l,d=BJ(l-1,u),f=Math.log(1-n)/Math.log(d);return{rowsSampled:i,cutoffFrequencyExact:a,cutoffFrequency:o,minimumSelectivity:s,targetSelectivity:c,targetLambda:u,targetPoissonCdf:d,targetM:f,results:[{name:`Floor`,result:UJ(Math.floor(f),n,l,i)},{name:`Ceiling`,result:UJ(Math.ceil(f),n,l,i)}]}}function UJ(e,t,n,r){let i=(1-t)**(1/e),a=VJ(i,n-1);return{m:e,poissonCdf:i,lambda:a,f:a/r}}function WJ(e,t=`auto`,n=6){return Number.isFinite(e)?t===`scientific`?e.toExponential(n):t===`fixed`?e.toFixed(n):Math.abs(e)<1e-4&&e!==0?e.toExponential(n):Math.abs(e-Math.round(e))<1e-10?Math.round(e).toString():e.toPrecision(8):String(e)}function GJ({label:e,value:t,format:n=`auto`,decimals:r=6}){return(0,L.jsxs)(km,{children:[(0,L.jsx)(km.Col,{span:8,children:(0,L.jsx)(H,{size:`sm`,children:e})}),(0,L.jsx)(km.Col,{span:4,children:(0,L.jsx)(H,{size:`sm`,ff:`monospace`,ta:`right`,children:WJ(t,n,r)})})]})}function KJ({title:e,m:t,poissonCdf:n,lambda:r,f:i}){return(0,L.jsxs)(Cl,{withBorder:!0,p:`md`,children:[(0,L.jsx)(K,{order:4,mb:`sm`,children:e}),(0,L.jsxs)(W,{gap:`xs`,children:[(0,L.jsx)(GJ,{label:`M (padding multiplier)`,value:t}),(0,L.jsx)(GJ,{label:`Poisson CDF`,value:n}),(0,L.jsx)(GJ,{label:`Lambda`,value:r}),(0,L.jsx)(GJ,{label:`F (selectivity)`,value:i,format:`scientific`})]})]})}function qJ(){let[e,t]=(0,b.useState)(1e3),[n,r]=(0,b.useState)(3),[i,a]=(0,b.useState)(.999999),[o,s]=(0,b.useState)(``),c=(0,b.useMemo)(()=>{let t=typeof e==`number`?e:void 0,r=typeof n==`number`?n:void 0,a=typeof i==`number`?i:void 0,s=typeof o==`number`?o:void 0;if(t!==void 0&&r!==void 0&&a!==void 0)return HJ(t,r,a,s)},[e,n,i,o]);return(0,L.jsxs)(W,{gap:`lg`,children:[(0,L.jsxs)(Cl,{withBorder:!0,p:`md`,children:[(0,L.jsx)(K,{order:4,mb:`md`,children:`Inputs`}),(0,L.jsxs)(km,{children:[(0,L.jsx)(km.Col,{span:{base:12,sm:6,md:3},children:(0,L.jsx)(W_,{label:`Statistics Target`,value:e,onChange:t,min:100,max:1e4,step:100})}),(0,L.jsx)(km.Col,{span:{base:12,sm:6,md:3},children:(0,L.jsx)(W_,{label:`Elements Per Row`,value:n,onChange:r,min:1,max:1e3,step:1})}),(0,L.jsx)(km.Col,{span:{base:12,sm:6,md:3},children:(0,L.jsx)(W_,{label:`Confidence`,value:i,onChange:a,min:0,max:1,step:1e-6,decimalScale:10})}),(0,L.jsx)(km.Col,{span:{base:12,sm:6,md:3},children:(0,L.jsx)(W_,{label:`Target Selectivity (optional)`,description:`Overrides minimum selectivity`,value:o,onChange:s,min:0,max:1,step:1e-5,decimalScale:10,placeholder:c?WJ(c.minimumSelectivity,`scientific`):``})})]})]}),c&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Cl,{withBorder:!0,p:`md`,children:[(0,L.jsx)(K,{order:4,mb:`sm`,children:`Intermediate Values`}),(0,L.jsxs)(km,{children:[(0,L.jsx)(km.Col,{span:{base:12,md:6},children:(0,L.jsxs)(W,{gap:`xs`,children:[(0,L.jsx)(GJ,{label:`Rows Sampled`,value:c.rowsSampled}),(0,L.jsx)(GJ,{label:`Cutoff Frequency (exact)`,value:c.cutoffFrequencyExact}),(0,L.jsx)(GJ,{label:`Cutoff Frequency`,value:c.cutoffFrequency}),(0,L.jsx)(GJ,{label:`Min Selectivity`,value:c.minimumSelectivity,format:`scientific`})]})}),(0,L.jsx)(km.Col,{span:{base:12,md:6},children:(0,L.jsxs)(W,{gap:`xs`,children:[(0,L.jsx)(GJ,{label:`Target Selectivity`,value:c.targetSelectivity,format:`scientific`}),(0,L.jsx)(GJ,{label:`Target Lambda`,value:c.targetLambda}),(0,L.jsx)(GJ,{label:`Target Poisson CDF`,value:c.targetPoissonCdf}),(0,L.jsx)(GJ,{label:`Target m`,value:c.targetM})]})})]})]}),(0,L.jsx)(km,{children:c.results.map(({name:e,result:t})=>(0,L.jsx)(km.Col,{span:{base:12,md:6},children:(0,L.jsx)(KJ,{title:`${e} Option`,m:t.m,poissonCdf:t.poissonCdf,lambda:t.lambda,f:t.f})},e))})]})]})}var JJ=8;function YJ({inputProps:e,data:t,onChange:n}){let r=Bf({onDropdownClose:()=>r.resetSelectedOption()}),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)(``),c=(0,b.useMemo)(()=>t.filter(e=>e.toLowerCase().includes(o.toLowerCase().trim())),[t,o]),l=(0,b.useMemo)(()=>{let e=Array(Math.min(c.length,JJ));for(let t=0;t<e.length;t++){let n=c[t];e[t]=(0,L.jsx)(Uf.Option,{value:n,children:n},n)}return e},[c]);return(0,L.jsxs)(Uf,{store:r,withinPortal:!1,onOptionSubmit:e=>{n&&n(e),a(e),s(e),r.closeDropdown()},children:[(0,L.jsx)(Uf.Target,{children:(0,L.jsx)(vd,{rightSection:(0,L.jsx)(Uf.Chevron,{}),value:o,onChange:e=>{r.openDropdown(),r.updateSelectedOptionIndex(),s(e.currentTarget.value)},onClick:()=>r.openDropdown(),onFocus:()=>r.openDropdown(),onBlur:()=>{r.closeDropdown(),s(i||``)},rightSectionPointerEvents:`none`,...e})}),(0,L.jsx)(Uf.Dropdown,{children:(0,L.jsx)(Uf.Options,{children:l.length>0?l:(0,L.jsx)(Uf.Empty,{children:`Nothing found`})})})]})}function XJ(e){let t=[];for(let 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=yw(t),t}function ZJ(e){return typeof e==`string`?e.length>50?e.substring(0,50)+`...`:e:typeof e==`boolean`?e.toString().toLocaleUpperCase():e}function QJ(e){if(e===0)return`0 B`;let t=Math.min(Math.floor(Math.log(e)/Math.log(1024)),4);return`${(e/1024**t).toFixed(2)} ${[`B`,`KB`,`MB`,`GB`,`TB`][t]}`}var $J=({medplum:e,onChange:t,onError:n})=>{(0,b.useEffect)(()=>{async function r(){return(await e.valueSetExpand({url:`https://medplum.com/fhir/ValueSet/resource-types`,count:200})).expansion?.contains?.map(e=>e.code).filter(e=>e!==void 0)??[]}r().then(e=>{t(XJ(e))}).catch(e=>{n?n(e):console.error(e)})},[e,t,n])};function eY(){let e=Z(),[t,{open:n,close:r}]=wn(!1),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(void 0),[u,d]=(0,b.useState)(0),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)([]),[g,_]=(0,b.useState)([]),[v,y]=(0,b.useState)(!1),[x,S]=(0,b.useState)(void 0),[C,w]=(0,b.useState)([]),[T,E]=(0,b.useState)(0),[D,O]=(0,b.useState)(!1),[k,A]=(0,b.useState)(!1);$J({medplum:e,onChange:w}),(0,b.useEffect)(()=>{p(!0),e.get(`fhir/R4/$db-column-statistics?tableName=`+encodeURIComponent(c??``),{cache:`no-cache`}).then(e=>{let t=e.parameter?.find(e=>e.name===`defaultStatisticsTarget`)?.valueInteger??0;d(t);let n=(e.parameter?.find(e=>e.name===`table`)?.part)?.filter(e=>e.name===`column`);h(n??[])}).finally(()=>{p(!1)}).catch(e=>{q({color:`red`,message:e.message})})},[e,c,T]);function j(){if(c){if(g.length===0){q({color:`red`,message:`No columns selected`,autoClose:!0});return}q({title:`Submit`,message:JSON.stringify({resetToDefault:v,newStatisticsTarget:x,selectedRowNames:g}),autoClose:!0}),e.post(`fhir/R4/$db-configure-column-statistics`,{tableName:c,columnNames:g,resetToDefault:v,newStatisticsTarget:v?void 0:x}).then(e=>{q({color:`green`,message:`Done`}),E(e=>e+1)}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}}let M={onClick:e=>{a(`Details`),s((0,L.jsx)(`pre`,{children:e})),n()}},N=0;return(0,L.jsxs)(NP,{onSubmit:j,children:[(0,L.jsxs)(W,{gap:`sm`,children:[(0,L.jsxs)(V,{children:[(0,L.jsx)(YJ,{data:C,inputProps:{placeholder:`Table name`,inputSize:`50`},onChange:e=>{l(e),_([])}}),(0,L.jsx)(U,{loading:f,onClick:()=>E(e=>e+1),children:`Refresh`})]}),(0,L.jsxs)(V,{children:[(0,L.jsx)(H,{span:!0,fw:700,children:`Statistics Target:`}),(0,L.jsx)(W_,{value:v?``:x,disabled:v,required:!v,size:`sm`,w:`100`,min:0,step:100,max:1e4,onChange:e=>{typeof e==`number`&&S(e)}}),(0,L.jsx)(H,{span:!0,fw:700,c:`dimmed`,children:`– or –`}),(0,L.jsx)(pp,{checked:v,onChange:e=>y(e.currentTarget.checked),label:`Reset to default (`+u+`)`,size:`sm`}),(0,L.jsx)(PP,{size:`sm`,children:`Update`})]}),(0,L.jsx)(V,{children:(0,L.jsx)(pp,{checked:k,onChange:e=>A(e.currentTarget.checked),label:`Hide columns with default statistics target`,size:`sm`})}),(0,L.jsx)(V,{children:(0,L.jsx)(pp,{checked:D,onChange:e=>O(e.currentTarget.checked),label:`Show all column stats`,size:`sm`})}),(0,L.jsx)(G.ScrollContainer,{minWidth:500,children:(0,L.jsxs)(G,{striped:!0,highlightOnHover:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:(0,L.jsx)(pp,{size:`sm`,checked:m.length>0&&g.length===m.length,indeterminate:g.length>0&&g.length<m.length,onChange:()=>{g.length===m.length?_([]):_(m.map(e=>e.part?.find(e=>e.name===`name`)?.valueString??``))}})}),(0,L.jsx)(G.Th,{children:`Column`}),(0,L.jsx)(G.Th,{children:`Statistics Target`}),(0,L.jsx)(G.Th,{children:`null_frac`}),(0,L.jsx)(G.Th,{children:`avg_width`}),(0,L.jsx)(G.Th,{children:`n_distinct`}),(0,L.jsx)(G.Th,{children:`correlation`}),D&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(G.Th,{children:`most_common_vals`}),(0,L.jsx)(G.Th,{children:`most_common_freqs`}),(0,L.jsx)(G.Th,{children:`histogram_bounds`}),(0,L.jsx)(G.Th,{children:`most_common_elems`}),(0,L.jsx)(G.Th,{children:`most_common_elem_freqs`}),(0,L.jsx)(G.Th,{children:`elem_count_histogram`})]})]})}),(0,L.jsxs)(G.Tbody,{children:[m?.map(e=>{let t=e.part??[],n=t.find(e=>e.name===`name`)?.valueString,r=t.find(e=>e.name===`statisticsTarget`)?.valueInteger;if(r===-1&&(N++,k))return null;if(!n)throw Error(`Column missing name`,{cause:e});return(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:(0,L.jsx)(pp,{size:`sm`,checked:g.includes(n),onChange:e=>{_(e.currentTarget.checked?[...g,n]:g.filter(e=>e!==n))}})}),(0,L.jsx)(G.Td,{children:n}),(0,L.jsx)(G.Td,{children:r===-1?(0,L.jsxs)(H,{span:!0,c:`dimmed`,fs:`italic`,children:[`default (`,u,`)`]}):r}),(0,L.jsx)(tY,{value:t.find(e=>e.name===`nullFraction`)?.valueDecimal,...M}),(0,L.jsx)(tY,{value:t.find(e=>e.name===`avgWidth`)?.valueInteger,...M}),(0,L.jsx)(tY,{value:t.find(e=>e.name===`nDistinct`)?.valueDecimal,...M}),(0,L.jsx)(tY,{value:t.find(e=>e.name===`correlation`)?.valueDecimal,...M}),D&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(tY,{value:t.find(e=>e.name===`mostCommonValues`)?.valueString,...M}),(0,L.jsx)(tY,{value:t.find(e=>e.name===`mostCommonFreqs`)?.valueString,...M}),(0,L.jsx)(tY,{value:t.find(e=>e.name===`histogramBounds`)?.valueString,...M}),(0,L.jsx)(tY,{value:t.find(e=>e.name===`mostCommonElems`)?.valueString,...M}),(0,L.jsx)(tY,{value:t.find(e=>e.name===`mostCommonElemFreqs`)?.valueString,...M}),(0,L.jsx)(tY,{value:t.find(e=>e.name===`elemCountHistogram`)?.valueString,...M})]})]},n)}),k&&(0,L.jsx)(G.Tr,{children:(0,L.jsx)(G.Td,{colSpan:D?13:7,children:(0,L.jsxs)(H,{c:`dimmed`,fs:`italic`,children:[N,` hidden columns with default statistics target`]})})})]})]})})]}),(0,L.jsx)(pg,{opened:t,onClose:r,title:i,centered:!0,size:`auto`,children:o})]})}function tY({value:e,onClick:t}){return(0,L.jsx)(G.Td,{style:{cursor:`pointer`},onClick:()=>t?.(e),children:nY(e)})}function nY(e){return typeof e==`string`&&e.length>30?e.substring(0,30)+`...`:e}function rY(e,t,n,r){let i=Date.now().toString();q({id:i,loading:!0,title:t,message:`Running...`,autoClose:!1,withCloseButton:!1});let a={method:`POST`,pollStatusOnAccepted:!0};return r&&(a.body=JSON.stringify(r)),e.startAsyncRequest(n,a).then(e=>{let n=`Done`;return e.resourceType===`AsyncJob`?n=(0,L.jsx)(eN,{to:e,children:`View AsyncJob`}):e.resourceType===`OperationOutcome`&&e.issue?.[0]?.details?.text&&(n=(0,L.jsx)(H,{children:e.issue[0].details.text})),Zb.update({id:i,color:`green`,title:t,message:n,icon:(0,L.jsx)(jj,{size:`1rem`}),loading:!1,autoClose:!1,withCloseButton:!0}),e}).catch(e=>{throw Zb.update({id:i,color:`red`,title:t,message:J(e),icon:(0,L.jsx)(HM,{size:`1rem`}),loading:!1,autoClose:!1,withCloseButton:!0}),e})}function iY(e,t,n,r){rY(e,t,n,r).catch(()=>{})}var aY=8;function oY({pillInputProps:e,inputProps:t,data:n,onChange:r}){let i=Bf({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex(`active`)}),[a,o]=(0,b.useState)(``),[s,c]=(0,b.useState)([]),l=e=>{let t=s.includes(e)?s.filter(t=>t!==e):[...s,e];c(t),r&&r(t)},u=e=>{let t=s.filter(t=>t!==e);c(t),r?.(t)},d=s.map(e=>(0,L.jsx)(Cg,{withRemoveButton:!0,onRemove:()=>u(e),children:e},e)),f=(0,b.useMemo)(()=>{let e=a.trim().toLowerCase();return n.filter(t=>t.toLowerCase().includes(e))},[n,a]),p=(0,b.useMemo)(()=>{let e=Array(Math.min(f.length,aY));for(let t=0;t<e.length;t++){let n=f[t];e[t]=(0,L.jsx)(Uf.Option,{value:n,active:s.includes(n),children:(0,L.jsxs)(V,{gap:`sm`,children:[s.includes(n)?(0,L.jsx)(ap,{size:12}):null,(0,L.jsx)(`span`,{children:n})]})},n)}return e},[f,s]);return(0,L.jsxs)(Uf,{store:i,onOptionSubmit:l,withinPortal:!1,children:[(0,L.jsx)(Uf.DropdownTarget,{children:(0,L.jsx)(Og,{onClick:()=>i.openDropdown(),...e,children:(0,L.jsxs)(Cg.Group,{children:[d,(0,L.jsx)(Uf.EventsTarget,{children:(0,L.jsx)(Og.Field,{onFocus:()=>i.openDropdown(),onBlur:()=>{i.closeDropdown(),o(``)},value:a,onChange:e=>{i.updateSelectedOptionIndex(),o(e.currentTarget.value)},onKeyDown:e=>{e.key===`Backspace`&&a.length===0&&s.length>0&&(e.preventDefault(),u(s[s.length-1]))},...t})})]})})}),(0,L.jsx)(Uf.Dropdown,{children:(0,L.jsx)(Uf.Options,{children:p.length>0?p:(0,L.jsx)(Uf.Empty,{children:`Nothing found...`})})})]})}function sY({defaultGinPendingListLimit:e,availableTables:t,onResponse:n}){let r=Z(),[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)([]),[c,l]=(0,b.useState)(`unspecified`),[u,d]=(0,b.useState)(`unspecified`),[f,p]=(0,b.useState)(void 0);return(0,L.jsx)(NP,{onSubmit:()=>{let e={tableName:o};c===`reset`?e.fastUpdateAction=`reset`:c===`on`?(e.fastUpdateAction=`set`,e.fastUpdateValue=!0):c===`off`&&(e.fastUpdateAction=`set`,e.fastUpdateValue=!1),u===`reset`?e.ginPendingListLimitAction=`reset`:u===`set`&&(e.ginPendingListLimitAction=`set`,e.ginPendingListLimitValue=f),a(!0),rY(r,`Configure GIN Indexes`,`fhir/R4/$db-configure-indexes`,e).then(e=>{n(e)}).catch(()=>{}).finally(()=>{a(!1)})},children:(0,L.jsxs)(W,{gap:`sm`,maw:`800`,children:[(0,L.jsx)(fd,{label:`Table(s)`,children:(0,L.jsx)(oY,{data:t,onChange:e=>s(e),inputProps:{name:`tables`,placeholder:`e.g. Observation`}})}),(0,L.jsx)(Wv.Group,{name:`fastUpdate`,label:`fastupdate`,value:c,onChange:e=>l(e),children:(0,L.jsxs)(V,{h:`36`,children:[(0,L.jsx)(Wv,{size:`sm`,value:`unspecified`,label:`unspecified`}),(0,L.jsx)(Wv,{size:`sm`,value:`reset`,label:`reset to default (on)`}),(0,L.jsx)(Wv,{size:`sm`,value:`off`,label:`off`}),(0,L.jsx)(Wv,{size:`sm`,value:`on`,label:`on`})]})}),(0,L.jsx)(Wv.Group,{name:`ginPendingListLimit`,label:`gin_pending_list_limit`,value:u,onChange:e=>{d(e),e!==`set`&&p(void 0)},children:(0,L.jsxs)(V,{h:`36`,children:[(0,L.jsx)(Wv,{size:`sm`,value:`unspecified`,label:`unspecified`}),(0,L.jsx)(Wv,{size:`sm`,value:`reset`,label:`reset to default (${e}kB)`}),(0,L.jsxs)(V,{children:[(0,L.jsx)(Wv,{size:`sm`,value:`set`,label:`Set to (kB)`}),(0,L.jsx)(W_,{title:`gin_pending_list_limit_value`,name:`gin_pending_list_limit_value`,value:(u===`set`?f:``)||``,disabled:u!==`set`,required:u===`set`,size:`sm`,w:`100`,min:64,max:2147483647,onChange:e=>{p(typeof e==`number`?e:void 0)}})]})]})}),(0,L.jsx)(V,{justify:`center`,children:(0,L.jsx)(PP,{size:`sm`,loading:i,children:`Update`})})]})})}function cY(){let e=Z(),[t,{open:n,close:r}]=wn(!1),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(void 0),[u,d]=(0,b.useState)(0),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(void 0),[g,_]=(0,b.useState)([]),[v,y]=(0,b.useState)(0);$J({medplum:e,onChange:_}),(0,b.useEffect)(()=>{p(!0),e.get(`fhir/R4/$db-indexes?tableName=`+encodeURIComponent(c??``),{cache:`no-cache`}).then(e=>{let t=e.parameter?.find(e=>e.name===`defaultGinPendingListLimit`)?.valueInteger??0;d(t);let n=e.parameter?.filter(e=>e.name===`index`);h(n??[])}).finally(()=>{p(!1)}).catch(e=>{q({color:`red`,message:e.message})})},[e,c,v]);let x=e=>{a(`Configure results`),s((0,L.jsx)(`pre`,{children:JSON.stringify(e,null,2)})),n(),y(e=>(e+1)%100)},S={onClick:e=>{a(`Details`),s((0,L.jsx)(`pre`,{children:e})),n()}},C;return f?C=`Loading...`:c?m?.length===0&&(C=`No GIN indexes on this table`):C=`Select a table`,(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(W,{gap:`sm`,children:[(0,L.jsx)(`h2`,{children:`Configure GIN indexes`}),(0,L.jsx)(V,{children:(0,L.jsx)(sY,{defaultGinPendingListLimit:u,availableTables:g,onResponse:x})}),(0,L.jsx)(`h2`,{children:`GIN index stats`}),(0,L.jsxs)(V,{children:[(0,L.jsx)(YJ,{data:g,inputProps:{placeholder:`Table name`,inputSize:`50`},onChange:e=>{l(e)}}),(0,L.jsx)(U,{loading:f,onClick:()=>y(e=>(e+1)%100),disabled:!c,children:`Refresh`})]}),(0,L.jsx)(G.ScrollContainer,{minWidth:500,children:(0,L.jsxs)(G,{striped:!0,highlightOnHover:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Schema`}),(0,L.jsx)(G.Th,{children:`Table`}),(0,L.jsx)(G.Th,{children:`Index`}),(0,L.jsx)(G.Th,{children:`fastupdate`}),(0,L.jsx)(G.Th,{children:`gin_pending_list_limit`}),(0,L.jsx)(G.Th,{children:`options`})]})}),(0,L.jsxs)(G.Tbody,{children:[C&&(0,L.jsx)(G.Tr,{children:(0,L.jsx)(G.Td,{colSpan:16,children:C})}),!C&&m?.map(e=>{let t=e.part??[],n=t.find(e=>e.name===`indexName`)?.valueString;if(!n)throw Error(`Index missing name`,{cause:e});return(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:t.find(e=>e.name===`schemaName`)?.valueString}),(0,L.jsx)(G.Td,{children:t.find(e=>e.name===`tableName`)?.valueString}),(0,L.jsx)(G.Td,{children:n}),(0,L.jsx)(lY,{value:t.find(e=>e.name===`fastUpdate`)?.valueBoolean,defaultValue:(0,L.jsxs)(H,{span:!0,c:`dimmed`,fs:`italic`,children:[`default\xA0(`,ZJ(!0),`)`]}),...S}),(0,L.jsx)(lY,{value:t.find(e=>e.name===`ginPendingListLimit`)?.valueInteger,defaultValue:(0,L.jsxs)(H,{span:!0,c:`dimmed`,fs:`italic`,children:[`default\xA0(`,u,`)`]}),...S}),(0,L.jsx)(lY,{value:t.find(e=>e.name===`indexOptions`)?.valueString,defaultValue:(0,L.jsx)(H,{span:!0,c:`dimmed`,fs:`italic`,children:`NULL`}),...S})]},n)})]})]})})]}),(0,L.jsx)(pg,{opened:t,onClose:r,title:i,centered:!0,size:`auto`,children:o})]})}function lY({value:e,onClick:t,defaultValue:n}){return(0,L.jsx)(G.Td,{style:{cursor:`pointer`},onClick:()=>t?.(e),children:e===void 0?n:ZJ(e)})}var uY=1048576;function dY(){let e=Z(),[t,n]=(0,b.useState)([]),[r,i]=(0,b.useState)([]),[a,o]=(0,b.useState)(30),[s,c]=(0,b.useState)(100),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(),[p,m]=(0,b.useState)(),[h,g]=(0,b.useState)(),[_,v]=(0,b.useState)(),[y,x]=(0,b.useState)(`indexSize`),[S,C]=(0,b.useState)(`desc`);$J({medplum:e,onChange:i}),(0,b.useEffect)(()=>{let t=!0;return e.post(`fhir/R4/$db-invalid-indexes`,{}).then(e=>{t&&g(e.parameter?.filter(e=>e.name===`invalidIndex`&&e.valueString).map(e=>mY(e.valueString))??[])}).catch(e=>{t&&v(J(e))}),()=>{t=!1}},[e]);let w=(0,b.useMemo)(()=>[...p??[]].sort((e,t)=>{let n=e[y],r=t[y];if(n===void 0)return r===void 0?0:1;if(r===void 0)return-1;let i=typeof n==`number`&&typeof r==`number`?n-r:String(n).localeCompare(String(r));return S===`asc`?i:-i}),[p,S,y]),T=()=>{if(typeof a!=`number`||typeof s!=`number`)return;let n=new URLSearchParams({minBloatPercent:String(a),minIndexSize:String(Math.round(s*uY))});t.length>0&&n.set(`tableName`,t.join(`,`)),f(void 0),u(!0),e.get(`fhir/R4/$db-index-bloat?${n}`,{cache:`no-cache`}).then(e=>{m(e.parameter?.filter(e=>e.name===`index`).map(pY)??[])}).catch(e=>{let t=J(e);f(t),q({color:`red`,message:t,autoClose:!1})}).finally(()=>u(!1))},E=e=>{e===y?C(e=>e===`asc`?`desc`:`asc`):(x(e),C(e===`schemaName`||e===`tableName`||e===`indexName`||e===`indexType`||e===`liveTuplesPerPage`?`asc`:`desc`))},D=typeof a==`number`&&a>=0&&a<=100&&typeof s==`number`&&s>=0,O=h?.reduce((e,t)=>e+t.indexSizeBytes,0)??0;return(0,L.jsxs)(W,{gap:`md`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(K,{order:2,children:`Index health`}),(0,L.jsx)(H,{c:`dimmed`,size:`sm`,children:`Review invalid indexes and analyze valid indexes for bloat. Invalid indexes are excluded from bloat estimates.`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(K,{order:3,children:`Invalid indexes`}),(0,L.jsx)(H,{c:`dimmed`,size:`sm`,children:`Invalid indexes cannot serve queries, but may still consume disk and add write overhead.`})]}),_&&(0,L.jsx)(jd,{color:`red`,title:`Unable to load invalid indexes`,children:_}),h===void 0&&!_&&(0,L.jsx)(H,{c:`dimmed`,children:`Loading invalid indexes…`}),h?.length===0&&(0,L.jsx)(H,{c:`dimmed`,children:`No invalid indexes detected.`}),h&&h.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(jd,{color:`yellow`,title:`${h.length} invalid ${h.length===1?`index`:`indexes`} detected`,children:[`These indexes occupy `,QJ(O),` and are not included in the bloat analysis below.`]}),(0,L.jsx)(G.ScrollContainer,{minWidth:900,children:(0,L.jsxs)(G,{striped:!0,highlightOnHover:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Schema`}),(0,L.jsx)(G.Th,{children:`Table`}),(0,L.jsx)(G.Th,{children:`Index`}),(0,L.jsx)(G.Th,{children:`Status`}),(0,L.jsx)(G.Th,{children:`Type`}),(0,L.jsx)(G.Th,{children:`Size`}),(0,L.jsx)(G.Th,{children:`Unique`}),(0,L.jsx)(G.Th,{children:`Primary`})]})}),(0,L.jsx)(G.Tbody,{children:h.map(e=>(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:e.schemaName}),(0,L.jsx)(G.Td,{children:e.tableName}),(0,L.jsx)(G.Td,{children:e.indexName}),(0,L.jsx)(G.Td,{children:e.status}),(0,L.jsx)(G.Td,{children:e.indexType.toUpperCase()}),(0,L.jsx)(G.Td,{children:e.indexSize}),(0,L.jsx)(G.Td,{children:e.isUnique?`Yes`:`No`}),(0,L.jsx)(G.Td,{children:e.isPrimary?`Yes`:`No`})]},`${e.schemaName}.${e.indexName}`))})]})})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(K,{order:3,children:`Index bloat`}),(0,L.jsx)(H,{c:`dimmed`,size:`sm`,children:`B-tree rows show an estimated bloat percentage. GIN rows show live tuples per allocated page; a low ratio on a large index is a signal to consider REINDEX CONCURRENTLY. Live tuple estimates are updated by VACUUM and ANALYZE.`})]}),(0,L.jsxs)(V,{align:`end`,children:[(0,L.jsx)(fd,{label:`Table(s)`,children:(0,L.jsx)(oY,{data:r,onChange:n,pillInputProps:{w:360},inputProps:{name:`tables`,placeholder:`e.g. Observation`}})}),(0,L.jsx)(W_,{label:`Minimum B-tree bloat`,suffix:`%`,value:a,onChange:o,min:0,max:100,decimalScale:2,w:180}),(0,L.jsx)(W_,{label:`Minimum index size`,suffix:` MB`,value:s,onChange:c,min:0,decimalScale:2,w:240}),(0,L.jsx)(U,{loading:l,disabled:!D,onClick:T,children:`Analyze`})]}),d&&(0,L.jsx)(jd,{color:`red`,title:`Analysis failed`,children:d}),p===void 0&&!l&&(0,L.jsx)(H,{c:`dimmed`,children:`Click Analyze to scan indexes for bloat.`}),p?.length===0&&!l&&(0,L.jsx)(H,{c:`dimmed`,children:`No indexes meet the selected thresholds.`}),p&&p.length>0&&(0,L.jsx)(G.ScrollContainer,{minWidth:1100,children:(0,L.jsxs)(G,{striped:!0,highlightOnHover:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(fY,{label:`Schema`,sortKey:`schemaName`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(fY,{label:`Table`,sortKey:`tableName`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(fY,{label:`Index`,sortKey:`indexName`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(fY,{label:`Type`,sortKey:`indexType`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(fY,{label:`Index size`,sortKey:`indexSize`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(fY,{label:`GIN est. live tuples`,sortKey:`liveTuples`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(fY,{label:`GIN allocated pages`,sortKey:`allocatedPages`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(fY,{label:`GIN live tuples/page`,sortKey:`liveTuplesPerPage`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(fY,{label:`Est. B-tree bloat`,sortKey:`estimatedBloatSize`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(fY,{label:`B-tree bloat`,sortKey:`bloatPercent`,activeKey:y,direction:S,onSort:E})]})}),(0,L.jsx)(G.Tbody,{children:w.map(e=>(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:e.schemaName}),(0,L.jsx)(G.Td,{children:e.tableName}),(0,L.jsx)(G.Td,{children:e.indexName}),(0,L.jsx)(G.Td,{children:e.indexType.toUpperCase()}),(0,L.jsx)(G.Td,{children:QJ(e.indexSize)}),(0,L.jsx)(G.Td,{children:e.liveTuples===void 0?`—`:e.liveTuples.toLocaleString()}),(0,L.jsx)(G.Td,{children:e.allocatedPages===void 0?`—`:e.allocatedPages.toLocaleString()}),(0,L.jsx)(G.Td,{children:e.liveTuplesPerPage===void 0?`—`:e.liveTuplesPerPage.toFixed(2)}),(0,L.jsx)(G.Td,{children:e.estimatedBloatSize===void 0?`—`:QJ(e.estimatedBloatSize)}),(0,L.jsx)(G.Td,{children:e.bloatPercent===void 0?`—`:`${e.bloatPercent.toFixed(2)}%`})]},`${e.schemaName}.${e.indexName}`))})]})})]})}function fY({label:e,sortKey:t,activeKey:n,direction:r,onSort:i}){return(0,L.jsx)(G.Th,{children:(0,L.jsxs)(vl,{onClick:()=>i(t),style:{fontWeight:700,display:`flex`,alignItems:`center`,gap:4},children:[e,n===t&&(r===`desc`?(0,L.jsx)(hj,{size:14}):(0,L.jsx)(gj,{size:14}))]})})}function pY(e){let t=e.part??[];return{schemaName:_Y(t,`schemaName`),tableName:_Y(t,`tableName`),indexName:_Y(t,`indexName`),indexType:_Y(t,`indexType`),indexSize:vY(t,`indexSize`),estimatedBloatSize:yY(t,`estimatedBloatSize`),bloatPercent:yY(t,`bloatPercent`),liveTuples:yY(t,`liveTuples`),allocatedPages:yY(t,`allocatedPages`),liveTuplesPerPage:yY(t,`liveTuplesPerPage`)}}function mY(e){let t=new Map;for(let n of e.split(`
|
|
218
|
+
`).replace(sp,``)}function lp(e,t){return t=cp(t),cp(e)===t}function up(e,t,n,r,a,o){switch(n){case`children`:if(typeof r==`string`)t===`body`||t===`textarea`&&r===``||un(e,r);else if(typeof r==`number`||typeof r==`bigint`)t!==`body`&&un(e,``+r);else return;break;case`className`:Jt(e,`class`,r);break;case`tabIndex`:Jt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Jt(e,n,r);break;case`style`:pn(e,r,o);return;case`data`:if(t!==`object`){Jt(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=_n(r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`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}if(typeof o==`function`&&(n===`formAction`?(t!==`input`&&up(e,t,`name`,a.name,a,null),up(e,t,`formEncType`,a.formEncType,a,null),up(e,t,`formMethod`,a.formMethod,a,null),up(e,t,`formTarget`,a.formTarget,a,null)):(up(e,t,`encType`,a.encType,a,null),up(e,t,`method`,a.method,a,null),up(e,t,`target`,a.target,a,null))),r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=_n(r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=vn);return;case`onScroll`:r!=null&&Xf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Xf(`scrollend`,e);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=_n(r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`credentialless`: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`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Xf(`beforetoggle`,e),Xf(`toggle`,e),qt(e,`popover`,r);break;case`xlinkActuate`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Yt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Yt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:qt(e,`is`,r);break;case`innerText`:case`textContent`:return;default:if(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)n=hn.get(n)||n,qt(e,n,r);else return}Gt=!0}function dp(e,t,n,r,a,o){switch(n){case`style`:pn(e,r,o);return;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));o?.__html!==n&&(e.innerHTML=n)}}break;case`children`:if(typeof r==`string`)un(e,r);else if(typeof r==`number`||typeof r==`bigint`)un(e,``+r);else return;break;case`onScroll`:r!=null&&Xf(`scroll`,e);return;case`onScrollEnd`:r!=null&&Xf(`scrollend`,e);return;case`onClick`:r!=null&&(e.onclick=vn);return;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:return;case`innerText`:case`textContent`:return;default:if(!Rt.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),o=n.slice(2,a?n.length-7:void 0),t=e[St]||null,t=t==null?null:t[n],typeof t==`function`&&e.removeEventListener(o,t,a),typeof r==`function`)){typeof t!=`function`&&t!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(o,r,a);break a}Gt=!0,n in e?e[n]=r:!0===r?e.setAttribute(n,``):qt(e,n,r)}return}Gt=!0}function fp(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Xf(`error`,e),Xf(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:up(e,t,o,s,n,null)}}a&&up(e,t,`srcSet`,n.srcSet,n,null),r&&up(e,t,`src`,n.src,n,null);return;case`input`:Xf(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:up(e,t,r,d,n,null)}}an(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Xf(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:up(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&sn(e,!!r,n,!0):sn(e,!!r,t,!1);return;case`textarea`:for(s in Xf(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:up(e,t,s,c,n,null)}ln(e,r,a,o);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:up(e,t,l,r,n,null)}return;case`dialog`:Xf(`beforetoggle`,e),Xf(`toggle`,e),Xf(`cancel`,e),Xf(`close`,e);break;case`iframe`:case`object`:Xf(`load`,e);break;case`video`:case`audio`:for(r=0;r<qf.length;r++)Xf(qf[r],e);break;case`image`:Xf(`error`,e),Xf(`load`,e);break;case`details`:Xf(`toggle`,e);break;case`embed`:case`source`:case`link`:Xf(`error`,e),Xf(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:up(e,t,u,r,n,null)}return;default:if(mn(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&dp(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&up(e,t,c,r,n,null))}var pp={};function mp(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var a=null,o=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||up(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:m!==f&&(Gt=!0),o=m;break;case`name`:m!==f&&(Gt=!0),a=m;break;case`checked`:m!==f&&(Gt=!0),u=m;break;case`defaultChecked`:m!==f&&(Gt=!0),d=m;break;case`value`:m!==f&&(Gt=!0),s=m;break;case`defaultValue`:m!==f&&(Gt=!0),c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(i(137,t));break;default:m!==f&&up(e,t,p,m,r,f)}}rn(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||up(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:o!==l&&(Gt=!0),p=o;break;case`defaultValue`:o!==l&&(Gt=!0),c=o;break;case`multiple`:o!==l&&(Gt=!0),s=o;default:o!==l&&up(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?sn(e,!!n,n?[]:``,!1):sn(e,!!n,t,!0)):sn(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:up(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:a!==o&&(Gt=!0),p=a;break;case`defaultValue`:a!==o&&(Gt=!0),m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&up(e,t,s,a,r,o)}cn(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:up(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:p!==m&&(Gt=!0),e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:up(e,t,l,p,r,m)}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 g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&up(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(i(137,t));break;default:up(e,t,u,p,r,m)}return;default:if(mn(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&dp(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||dp(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&up(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||up(e,t,f,p,r,m)}function hp(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function gp(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&hp(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&hp(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var _p=null,vp=null;function yp(e){return e.nodeType===9?e:e.ownerDocument}function bp(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function xp(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function Sp(e,t,n,r){return n=yp(n).createElement(e),n[xt]=r,n[St]=t,fp(n,e,t),Ft(n),n}function Cp(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var wp=null;function Tp(){var e=window.event;return e&&e.type===`popstate`?e!==wp&&(wp=e,!0):(wp=null,!1)}var Ep=typeof setTimeout==`function`?setTimeout:void 0,Dp=typeof clearTimeout==`function`?clearTimeout:void 0,Op=typeof Promise==`function`?Promise:void 0,kp=typeof requestAnimationFrame==`function`?requestAnimationFrame:Ep,Ap=typeof queueMicrotask==`function`?queueMicrotask:Op===void 0?Ep:function(e){return Op.resolve(null).then(e).catch(jp)};function jp(e){setTimeout(function(){throw e})}function Mp(e){return e===`head`}function Np(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8){if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Zh(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)Em(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,Em(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[Ot]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&Em(e.ownerDocument.body)}n=i}while(n);Zh(t)}function Pp(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8){if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++}n=r}while(n)}function Fp(e,t,n){if(t=CSS.escape(t)===t?t:`r-`+btoa(t).replace(/=/g,``),e.style.viewTransitionName=t,n!=null&&(e.style.viewTransitionClass=n),n=getComputedStyle(e),n.display===`inline`){if(t=e.getClientRects(),t.length===1)var r=1;else for(var i=r=0;i<t.length;i++){var a=t[i];0<a.width&&0<a.height&&r++}r===1&&(e=e.style,e.display=t.length===1?`inline-block`:`block`,e.marginTop=`-`+n.paddingTop,e.marginBottom=`-`+n.paddingBottom)}}function Ip(e,t){e=e.style,t=t.style;var n=t==null?null:t.hasOwnProperty(`viewTransitionName`)?t.viewTransitionName:t.hasOwnProperty(`view-transition-name`)?t[`view-transition-name`]:null;e.viewTransitionName=n==null||typeof n==`boolean`?``:(``+n).trim(),n=t==null?null:t.hasOwnProperty(`viewTransitionClass`)?t.viewTransitionClass:t.hasOwnProperty(`view-transition-class`)?t[`view-transition-class`]:null,e.viewTransitionClass=n==null||typeof n==`boolean`?``:(``+n).trim(),e.display===`inline-block`&&(t==null?e.display=e.margin=``:(n=t.display,e.display=n==null||typeof n==`boolean`?``:n,n=t.margin,n==null?(n=t.hasOwnProperty(`marginTop`)?t.marginTop:t[`margin-top`],e.marginTop=n==null||typeof n==`boolean`?``:n,t=t.hasOwnProperty(`marginBottom`)?t.marginBottom:t[`margin-bottom`],e.marginBottom=t==null||typeof t==`boolean`?``:t):e.margin=n))}function Lp(e,t,n){return n=n.ownerDocument.defaultView,{rect:e,abs:t.position===`absolute`||t.position===`fixed`,clip:t.clipPath!==`none`||t.overflow!==`visible`||t.filter!==`none`||t.mask!==`none`||t.mask!==`none`||t.borderRadius!==`0px`,view:0<=e.bottom&&0<=e.right&&e.top<=n.innerHeight&&e.left<=n.innerWidth}}function Rp(e){return Lp(e.getBoundingClientRect(),getComputedStyle(e),e)}function zp(e){var t=e.getBoundingClientRect();t=new DOMRect(t.x+2e4,t.y+2e4,t.width,t.height);var n=getComputedStyle(e);return Lp(t,n,e)}function Bp(e){return e.documentElement.clientHeight}function Vp(e){this.addEventListener(`load`,e),this.addEventListener(`error`,e)}function Hp(e,t,n,r,i,a,o,s,c){var l=t.nodeType===9?t:t.ownerDocument;try{var u=l.startViewTransition({update:function(){var t=l.defaultView,n=t.navigation&&t.navigation.transition,o=l.fonts.status;r();var s=[];if(o===`loaded`&&(Bp(l),l.fonts.status===`loading`&&s.push(l.fonts.ready)),o=s.length,e!==null)for(var c=e.suspenseyImages,u=0,d=0;d<c.length;d++){var f=c[d];if(!f.complete){var p=f.getBoundingClientRect();if(0<p.bottom&&0<p.right&&p.top<t.innerHeight&&p.left<t.innerWidth){if(u+=ah(f),u>ch){s.length=o;break}f=new Promise(Vp.bind(f)),s.push(f)}}}if(0<s.length)return t=Promise.race([Promise.all(s),new Promise(function(e){return setTimeout(e,500)})]).then(i,i),(n?Promise.allSettled([n.finished,t]):t).then(a,a);if(i(),n)return n.finished.then(a,a);a()},types:n});l.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var e=l.documentElement.getAnimations({subtree:!0}),t=0;t<e.length;t++){var n=e[t],r=n.effect,i=r.pseudoElement;if(i!=null&&i.startsWith(`::view-transition`)){d.push(n),n=r.getKeyframes();for(var a=i=void 0,s=!0,c=0;c<n.length;c++){var u=n[c],f=u.width;if(i===void 0)i=f;else if(i!==f){s=!1;break}if(f=u.height,a===void 0)a=f;else if(a!==f){s=!1;break}delete u.width,delete u.height,u.transform===`none`&&delete u.transform}s&&i!==void 0&&a!==void 0&&(r.setKeyframes(n),s=getComputedStyle(r.target,r.pseudoElement),s.width!==i||s.height!==a)&&(s=n[0],s.width=i,s.height=a,s=n[n.length-1],s.width=i,s.height=a,r.setKeyframes(n))}}o()},function(e){l.__reactViewTransition===u&&(l.__reactViewTransition=null);try{if(typeof e==`object`&&e)switch(e.name){case`InvalidStateError`:(e.message===`View transition was skipped because document visibility state is hidden.`||e.message===`Skipping view transition because document visibility state has become hidden.`||e.message===`Skipping view transition because viewport size changed.`||e.message===`Transition was aborted because of invalid state`)&&(e=null)}e!==null&&c(e)}finally{r(),i(),o()}}),u.finished.finally(function(){for(var e=0;e<d.length;e++)d[e].cancel();l.__reactViewTransition===u&&(l.__reactViewTransition=null),s()}),u}catch{return r(),i(),o(),null}}function Up(e,t){this._scope=document.documentElement,this._selector=`::view-transition-`+e+`(`+t+`)`}Up.prototype.animate=function(e,t){return t=typeof t==`number`?{duration:t}:T({},t),t.pseudoElement=this._selector,this._scope.animate(e,t)},Up.prototype.getAnimations=function(){for(var e=this._scope,t=this._selector,n=e.getAnimations({subtree:!0}),r=[],i=0;i<n.length;i++){var a=n[i].effect;a!==null&&a.target===e&&a.pseudoElement===t&&r.push(n[i])}return r},Up.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function Wp(e){return{name:e,group:new Up(`group`,e),imagePair:new Up(`image-pair`,e),old:new Up(`old`,e),new:new Up(`new`,e)}}function Gp(e){this._fragmentFiber=e,this._observers=this._eventListeners=null}Gp.prototype.addEventListener=function(e,t,n){var r=null,i=null;if(!(n!=null&&typeof n!=`boolean`&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var a=this._eventListeners;if(Yp(a,e,t,n)===-1){var o=this,s=t;n!=null&&typeof n!=`boolean`&&!0===n.once&&(s=function(r){o.removeEventListener(e,t,n),typeof t==`function`?t.call(this,r):t.handleEvent(r)}),r!==null&&(i=o.removeEventListener.bind(o,e,t,n),r.addEventListener(`abort`,i,{once:!0}),i=r.removeEventListener.bind(r,`abort`,i)),r=Jp(n),a.push({type:e,listener:t,optionsOrUseCapture:n,attachedListener:s,cleanup:i}),f(this._fragmentFiber.child,!1,Kp,e,s,r)}this._eventListeners=a}};function Kp(e,t,n,r){return v(e).addEventListener(t,n,r),!1}Gp.prototype.removeEventListener=function(e,t,n){var r=this._eventListeners;if(r!==null&&(t=Yp(r,e,t,n),t!==-1)){var i=r[t];n=i.attachedListener;var a=i.cleanup;i=Jp(i.optionsOrUseCapture),f(this._fragmentFiber.child,!1,qp,e,n,i),r.splice(t,1),a!==null&&a()}};function qp(e,t,n,r){return v(e).removeEventListener(t,n,r),!1}function Jp(e){return e!=null&&typeof e!=`boolean`&&(!0===e.once||e.signal instanceof AbortSignal)?{capture:e.capture,passive:e.passive}:e}function U(e){return e==null?`c=0`:typeof e==`boolean`?`c=`+(e?`1`:`0`):`c=`+(e.capture?`1`:`0`)}function Yp(e,t,n,r){if(e.length===0)return-1;r=U(r);for(var i=0;i<e.length;i++){var a=e[i];if(a.type===t&&a.listener===n&&U(a.optionsOrUseCapture)===r)return i}return-1}Gp.prototype.dispatchEvent=function(e){var t=p(this._fragmentFiber);if(t===null)return!0;t=v(t);var n=this._eventListeners;if(n!==null&&0<n.length||!e.bubbles){var r=t.nodeType===9?t.createComment(``):document.createTextNode(``);if(n)for(var i=0;i<n.length;i++){var a=n[i];r.addEventListener(a.type,a.attachedListener,Jp(a.optionsOrUseCapture))}if(t.appendChild(r),e=r.dispatchEvent(e),n)for(i=0;i<n.length;i++)a=n[i],r.removeEventListener(a.type,a.attachedListener,Jp(a.optionsOrUseCapture));return t.removeChild(r),e}return t.dispatchEvent(e)},Gp.prototype.focus=function(e){f(this._fragmentFiber.child,!0,Xp,e,void 0,void 0)};function Xp(e,t){return e.tag!==6&&(e=v(e),Sm(e,t))}Gp.prototype.focusLast=function(e){var t=[];f(this._fragmentFiber.child,!0,Zp,t,void 0,void 0);for(var n=t.length-1;0<=n&&!Xp(t[n],e);n--);};function Zp(e,t){return t.push(e),!1}Gp.prototype.blur=function(){var e=p(this._fragmentFiber);e!==null&&(e=v(e),e=yp(e).activeElement,e!==null&&f(this._fragmentFiber.child,!1,Qp,e,void 0,void 0))};function Qp(e,t){return e.tag!==6&&(e=v(e),e===t||e.contains(t)?(t.blur(),!0):!1)}Gp.prototype.observeUsing=function(e){this._observers===null&&(this._observers=new Set),this._observers.add(e),f(this._fragmentFiber.child,!1,$p,e,void 0,void 0)};function $p(e,t){return e.tag!==6&&(e=v(e),t.observe(e),!1)}Gp.prototype.unobserveUsing=function(e){var t=this._observers;if(t!==null&&t.has(e)){t.delete(e),f(this._fragmentFiber.child,!1,em,e,void 0,void 0);for(var n=t=0;n<tm.length;n++){var r=tm[n];r.fragmentInstance===this&&r.observer===e?e.unobserve(r.instance):tm[t++]=r}tm.length=t}};function em(e,t){return e.tag!==6&&(e=v(e),t.unobserve(e),!1)}var tm=[],nm=!1;function rm(e,t,n){tm.push({fragmentInstance:e,observer:t,instance:n}),nm||(nm=!0,Cm(function(){nm=!1;var e=tm;tm=[];for(var t=0;t<e.length;t++){var n=e[t];n.observer.unobserve(n.instance)}}))}Gp.prototype.getClientRects=function(){var e=[];return f(this._fragmentFiber.child,!1,im,e,void 0,void 0),e};function im(e,t){if(e.tag===6){e=e.stateNode;var n=e.ownerDocument.createRange();n.selectNodeContents(e),t.push.apply(t,n.getClientRects())}else e=v(e),t.push.apply(t,e.getClientRects());return!1}Gp.prototype.getRootNode=function(e){var t=p(this._fragmentFiber);return t===null?this:v(t).getRootNode(e)},Gp.prototype.compareDocumentPosition=function(e){var t=p(this._fragmentFiber);if(t===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];f(this._fragmentFiber.child,!1,Zp,n,void 0,void 0);var r=v(t);if(n.length===0){if(n=r,h(this._fragmentFiber)){a:{for(t=this._fragmentFiber.return;t!==null;){if(t.tag===4){t=t.stateNode.containerInfo;break a}if(t.tag===3||t.tag===5||t.tag===27)break;t=t.return}t=null}t!=null&&(n=t)}t=this._fragmentFiber;var i=r=n.compareDocumentPosition(e);return n===e?i=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=g(t)[1],n===null?i=Node.DOCUMENT_POSITION_PRECEDING:(e=v(n).compareDocumentPosition(e),i=e===0||e&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),i|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}t=v(n[0]),i=v(n[n.length-1]);var a=h(this._fragmentFiber)?t.parentElement:r;if(a==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=a.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_CONTAINED_BY,a=a.compareDocumentPosition(i)&Node.DOCUMENT_POSITION_CONTAINED_BY;var o=t.compareDocumentPosition(e),s=i.compareDocumentPosition(e),c=o&Node.DOCUMENT_POSITION_CONTAINED_BY||s&Node.DOCUMENT_POSITION_CONTAINED_BY;return s=r&&a&&o&Node.DOCUMENT_POSITION_FOLLOWING&&s&Node.DOCUMENT_POSITION_PRECEDING,t=r&&t===e||a&&i===e||c||s?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&t===e||!a&&i===e?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:o,t&Node.DOCUMENT_POSITION_DISCONNECTED||t&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||am(t,this._fragmentFiber,n[0],n[n.length-1],e)?t:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function am(e,t,n,r,i){var a=jt(i);if(e&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!a)a:{for(;a!==null;){if(a.tag===7&&(a===t||a.alternate===t)){n=!0;break a}a=a.return}n=!1}return n}if(e&Node.DOCUMENT_POSITION_CONTAINS){if(a===null)return a=i.ownerDocument,i===a||i===a.documentElement||i===a.body;a:{for(a=t,t=p(t);a!==null;){if(!(a.tag!==5&&a.tag!==3&&a.tag!==27||a!==t&&a.alternate!==t)){a=!0;break a}a=a.return}a=!1}return a}return e&Node.DOCUMENT_POSITION_PRECEDING?((t=!!a)&&!(t=a===n)&&(t=w(n,a,C),t===null?t=!1:(f(t,!0,x,a,n),a=y,y=null,t=a!==null)),t):e&Node.DOCUMENT_POSITION_FOLLOWING?((t=!!a)&&!(t=a===r)&&(t=w(r,a,C),t===null?t=!1:(f(t,!0,S,a,r),a=y,b=y=null,t=a!==null)),t):!1}function om(e,t){var n=e.ownerDocument.createRange();n.selectNodeContents(e),e=n.getBoundingClientRect(),window.scrollTo(window.scrollX+e.left,t?window.scrollY+e.top:window.scrollY+e.bottom-window.innerHeight)}Gp.prototype.scrollIntoView=function(e){if(typeof e==`object`)throw Error(i(566));var t=[];f(this._fragmentFiber.child,!1,Zp,t,void 0,void 0);var n=!1!==e;if(t.length===0){var r=g(this._fragmentFiber);if(r=n?r[1]||r[0]||p(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){e=v(r),om(e,n);return}if(r=v(r),r.nodeType!==9){if(r.nodeType===11){n=`host`in r?r.host:null,n!==null&&n.scrollIntoView(e);return}r.scrollIntoView(e)}}for(r=n?t.length-1:0;r!==(n?-1:t.length);){var a=t[r];a.tag===6?(a=v(a),om(a,n)):v(a).scrollIntoView(e),r+=n?-1:1}};function sm(e,t){return e=v(e),cm(e,t),!1}function cm(e,t){e.reactFragments??=new Set,e.reactFragments.add(t)}function lm(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.addEventListener(i.type,i.attachedListener,Jp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){for(var r=0,i=0;i<tm.length;i++){var a=tm[i];(a.fragmentInstance!==t||a.observer!==n||a.instance!==e)&&(tm[r++]=a)}tm.length=r,n.observe(e)}),cm(e,t))}function um(e,t){var n=t._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];e.removeEventListener(i.type,i.attachedListener,Jp(i.optionsOrUseCapture))}e.nodeType!==3&&(n=t._observers,n!==null&&n.forEach(function(n){typeof n.rootMargin==`string`?rm(t,n,e):n.unobserve(e)}),e.reactFragments!=null&&e.reactFragments.delete(t))}function dm(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:dm(n),At(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function fm(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r){if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e}else if(!e[Ot])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=vm(e.nextSibling),e===null)break}return null}function pm(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=vm(e.nextSibling),e===null))return null;return e}function mm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=vm(e.nextSibling),e===null))return null;return e}function hm(e){return e.data===`$?`||e.data===`$~`}function gm(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function _m(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function vm(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var ym=null;function bm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return vm(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function xm(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function Sm(e,t){function n(){r=!0}if(e.ownerDocument.activeElement===e)return!0;var r=!1;try{e.ownerDocument.addEventListener(`focus`,n,!0),(e.focus||HTMLElement.prototype.focus).call(e,t)}finally{e.ownerDocument.removeEventListener(`focus`,n,!0)}return r}function Cm(e){kp(function(){kp(function(t){return e(t)})})}function wm(e,t,n){switch(t=yp(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function Tm(e,t,n){for(var r in n){var i=n[r];n.hasOwnProperty(r)&&i!=null&&up(e,t,r,null,pp,i)}n.dangerouslySetInnerHTML!=null&&(e.textContent=``),e.onclick===vn&&(e.onclick=null),At(e)}function Em(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);At(e)}var Dm=new Map,Om=new Set;function km(e){if(typeof e.getRootNode==`function`){var t=e.getRootNode();if(t.nodeType===9||t.nodeType===11)return t}return e.nodeType===9?e:e.ownerDocument}var Am=me.d;me.d={f:jm,r:Mm,D:Fm,C:Im,L:Lm,m:Rm,X:Bm,S:zm,M:Vm};function jm(){var e=Am.f(),t=Kd();return e||t}function Mm(e){var t=Mt(e);t!==null&&t.tag===5&&t.type===`form`?ic(t):Am.r(e)}var Nm=typeof document>`u`?null:document;function Pm(e,t,n){var r=Nm;if(r&&typeof t==`string`&&t){var i=nn(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Om.has(i)||(Om.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),fp(t,`link`,e),Ft(t),r.head.appendChild(t)))}}function Fm(e){Am.D(e),Pm(`dns-prefetch`,e,null)}function Im(e,t){Am.C(e,t),Pm(`preconnect`,e,t)}function Lm(e,t,n){Am.L(e,t,n);var r=Nm;if(r&&e&&t){var i=`link[rel="preload"][as="`+nn(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+nn(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+nn(n.imageSizes)+`"]`)):i+=`[href="`+nn(e)+`"]`;var a=i;switch(t){case`style`:a=Um(e);break;case`script`:a=qm(e)}if(!(Dm.has(a)||(e=T({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Dm.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Wm(a))||t===`script`&&r.querySelector(Jm(a))))){var o=r.createElement(`link`);fp(o,`link`,e),t===`style`&&(o[kt]=!0,o.onload=o.onerror=function(){It(o)}),Ft(o),r.head.appendChild(o)}}}function Rm(e,t){Am.m(e,t);var n=Nm;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+nn(r)+`"][href="`+nn(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=qm(e)}if(!Dm.has(a)&&(e=T({rel:`modulepreload`,href:e},t),Dm.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Jm(a)))return}r=n.createElement(`link`),fp(r,`link`,e),Ft(r),n.head.appendChild(r)}}}function zm(e,t,n){Am.S(e,t,n);var r=Nm;if(r&&e){var i=Pt(r).hoistableStyles,a=Um(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Wm(a)))s.loading=5;else{e=T({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Dm.get(a))&&Zm(e,n);var c=o=r.createElement(`link`);Ft(c),fp(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Xm(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Bm(e,t){Am.X(e,t);var n=Nm;if(n&&e){var r=Pt(n).hoistableScripts,i=qm(e),a=r.get(i);a||(a=n.querySelector(Jm(i)),a||(e=T({src:e,async:!0},t),(t=Dm.get(i))&&Qm(e,t),a=n.createElement(`script`),Ft(a),fp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Vm(e,t){Am.M(e,t);var n=Nm;if(n&&e){var r=Pt(n).hoistableScripts,i=qm(e),a=r.get(i);a||(a=n.querySelector(Jm(i)),a||(e=T({src:e,async:!0,type:`module`},t),(t=Dm.get(i))&&Qm(e,t),a=n.createElement(`script`),Ft(a),fp(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Hm(e,t,n,r){var a=(a=Ce.current)?km(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(n=Um(n.href),t=Pt(a).hoistableStyles,r=t.get(n),r||(r={type:`style`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Um(n.href);var o=Pt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(Wm(e)))?o._p||(s.instance=o,s.state.loading=5):(o=Dm.get(e),o||(o={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Dm.set(e,o)),Km(a,e,o,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(n=qm(n),t=Pt(a).hoistableScripts,r=t.get(n),r||(r={type:`script`,instance:null,count:0,state:null},t.set(n,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Um(e){return`href="`+nn(e)+`"`}function Wm(e){return`link[rel="stylesheet"][`+e+`]`}function Gm(e){return T({},e,{"data-precedence":e.precedence,precedence:null})}function Km(e,t,n,r){if(t=e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)){if(!0!==t[kt]){r.loading=1;return}}else t=e.createElement(`link`),t[kt]=!0,t.onload=t.onerror=It.bind(null,t),fp(t,`link`,n),Ft(t),e.head.appendChild(t);r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2})}function qm(e){return`[src="`+nn(e)+`"]`}function Jm(e){return`script[async]`+e}function Ym(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+nn(n.href)+`"]`);if(r)return t.instance=r,Ft(r),r;var a=T({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),Ft(r),fp(r,`style`,a),Xm(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Um(n.href);var o=e.querySelector(Wm(a));if(o)return t.state.loading|=4,t.instance=o,Ft(o),o;r=Gm(n),(a=Dm.get(a))&&Zm(r,a),o=(e.ownerDocument||e).createElement(`link`),Ft(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),fp(o,`link`,r),t.state.loading|=4,Xm(o,n.precedence,e),t.instance=o;case`script`:return o=qm(n.src),(a=e.querySelector(Jm(o)))?(t.instance=a,Ft(a),a):(r=n,(a=Dm.get(o))&&(r=T({},n),Qm(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),Ft(a),fp(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Xm(r,n.precedence,e));return t.instance}function Xm(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Zm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Qm(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var $m=null;function eh(e,t,n){if($m===null){var r=new Map,i=$m=new Map;i.set(n,r)}else i=$m,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[Ot]||a[xt]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function th(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function nh(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function rh(e,t){return e===`img`&&t.src!=null&&t.src!==``&&t.onLoad==null&&t.loading!==`lazy`}function ih(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function ah(e){return(e.width||100)*(e.height||100)*(typeof devicePixelRatio==`number`?devicePixelRatio:1)*.25}function oh(e,t){typeof t.decode==`function`&&(e.imgCount++,t.complete||(e.imgBytes+=ah(t),e.suspenseyImages.push(t)),e=fh.bind(e),t.decode().then(e,e))}function sh(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Um(r.href),a=t.querySelector(Wm(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=dh.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,Ft(a);return}a=t.ownerDocument||t,r=Gm(r),(i=Dm.get(i))&&Zm(r,i),a=a.createElement(`link`),Ft(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),fp(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=dh.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ch=0;function lh(e,t){return e.stylesheets&&e.count===0&&mh(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&mh(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ch===0&&(ch=62500*gp());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&mh(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ch?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function uh(e){if(e.count===0&&(e.imgCount===0||!e.waitingForImages)){if(e.stylesheets)mh(e,e.stylesheets);else if(e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}}}function dh(){this.count--,uh(this)}function fh(){this.imgCount--,uh(this)}var ph=null;function mh(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,ph=new Map,t.forEach(hh,e),ph=null,dh.call(e))}function hh(e,t){if(!(t.state.loading&4)){var n=ph.get(e);if(n)var r=n.get(null);else{n=new Map,ph.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=dh.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var gh={$$typeof:N,Provider:null,Consumer:null,_currentValue:he,_currentValue2:he,_threadCount:0};function _h(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,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=ut(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=ut(0),this.hiddenUpdates=ut(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.transitionTypes=null,this.incompleteTransitions=new Map}function vh(e,t,n,r,i,a,o,s,c,l,u,d){return e=new _h(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ji(3,null,null,t),e.current=a,a.stateNode=e,t=ja(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},mo(a),e}function yh(e){return e?(e=ki,e):ki}function bh(e,t,n,r,i,a){i=yh(i),r.context===null?r.context=i:r.pendingContext=i,r=go(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=_o(e,r,t),n!==null&&(Vd(n,e,t),vo(n,e,t))}function xh(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function Sh(e,t){xh(e,t),(e=e.alternate)&&xh(e,t)}function Ch(e){if(e.tag===13||e.tag===31){var t=Ei(e,67108864);t!==null&&Vd(t,e,67108864),Sh(e,67108864)}}function wh(e){if(e.tag===13||e.tag===31){var t=Rd();t=gt(t);var n=Ei(e,t);n!==null&&Vd(n,e,t),Sh(e,t)}}var Th=!0;function Eh(e,t,n,r){var i=F.T;F.T=null;var a=me.p;try{me.p=2,Oh(e,t,n,r)}finally{me.p=a,F.T=i}}function Dh(e,t,n,r){var i=F.T;F.T=null;var a=me.p;try{me.p=8,Oh(e,t,n,r)}finally{me.p=a,F.T=i}}function Oh(e,t,n,r){if(Th){var i=kh(r);if(i===null)tp(e,t,r,Ah,n),Vh(e,r);else if(Uh(i,e,t,n,r))r.stopPropagation();else if(Vh(e,r),t&4&&-1<Bh.indexOf(e)){for(;i!==null;){var a=Mt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=it(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-L(o);s.entanglements[1]|=c,o&=~c}Pf(a),!(rd&6)&&(wd=Ve()+500,Ff(0,!1))}}break;case 31:case 13:s=Ei(a,2),s!==null&&Vd(s,a,2),Kd(),Sh(a,2)}if(a=kh(r),a===null&&tp(e,t,r,Ah,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else tp(e,t,r,null,n)}}function kh(e){return e=bn(e),jh(e)}var Ah=null;function jh(e){if(Ah=null,e=jt(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=s(t),e!==null)return e;e=null}else if(n===31){if(e=c(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return Ah=e,null}function Mh(e){switch(e){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`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`fullscreenerror`: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`resize`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(He()){case Ue:return 2;case We:return 8;case Ge:case Ke:return 32;case I:return 268435456;default:return 32}default:return 32}}var Nh=!1,Ph=null,Fh=null,Ih=null,Lh=new Map,Rh=new Map,zh=[],Bh=`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 Vh(e,t){switch(e){case`focusin`:case`focusout`:Ph=null;break;case`dragenter`:case`dragleave`:Fh=null;break;case`mouseover`:case`mouseout`:Ih=null;break;case`pointerover`:case`pointerout`:Lh.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Rh.delete(t.pointerId)}}function Hh(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=Mt(t),t!==null&&Ch(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Uh(e,t,n,r,i){switch(t){case`focusin`:return Ph=Hh(Ph,e,t,n,r,i),!0;case`dragenter`:return Fh=Hh(Fh,e,t,n,r,i),!0;case`mouseover`:return Ih=Hh(Ih,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Lh.set(a,Hh(Lh.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Rh.set(a,Hh(Rh.get(a)||null,e,t,n,r,i)),!0}return!1}function Wh(e){var t=jt(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=s(n),t!==null){e.blockedOn=t,yt(e.priority,function(){wh(n)});return}}else if(t===31){if(t=c(n),t!==null){e.blockedOn=t,yt(e.priority,function(){wh(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Gh(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=kh(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);yn=r,n.target.dispatchEvent(r),yn=null}else return t=Mt(n),t!==null&&Ch(t),e.blockedOn=n,!1;t.shift()}return!0}function Kh(e,t,n){Gh(e)&&n.delete(t)}function qh(){Nh=!1,Ph!==null&&Gh(Ph)&&(Ph=null),Fh!==null&&Gh(Fh)&&(Fh=null),Ih!==null&&Gh(Ih)&&(Ih=null),Lh.forEach(Kh),Rh.forEach(Kh)}function Jh(e,n){e.blockedOn===n&&(e.blockedOn=null,Nh||(Nh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,qh)))}var Yh=null;function Xh(e){Yh!==e&&(Yh=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Yh===e&&(Yh=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(jh(r||n)===null)continue;break}var a=Mt(n);a!==null&&(e.splice(t,3),t-=3,nc(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Zh(e){function t(t){return Jh(t,e)}Ph!==null&&Jh(Ph,e),Fh!==null&&Jh(Fh,e),Ih!==null&&Jh(Ih,e),Lh.forEach(t),Rh.forEach(t);for(var n=0;n<zh.length;n++){var r=zh[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<zh.length&&(n=zh[0],n.blockedOn===null);)Wh(n),n.blockedOn===null&&zh.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[St]||null;if(typeof a==`function`)o||Xh(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[St]||null)s=o.formAction;else if(jh(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Xh(n)}}}function Qh(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function $h(e){this._internalRoot=e}eg.prototype.render=$h.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;bh(n,Rd(),e,t,null,null)},eg.prototype.unmount=$h.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;bh(e.current,2,null,e,null,null),Kd(),t[Ct]=null}};function eg(e){this._internalRoot=e}eg.prototype.unstable_scheduleHydration=function(e){if(e){var t=vt();e={blockedOn:null,target:e,priority:t};for(var n=0;n<zh.length&&t!==0&&t<zh[n].priority;n++);zh.splice(n,0,e),n===0&&Wh(e)}};var tg=n.version;if(tg!==`19.3.0`)throw Error(i(527,tg,`19.3.0`));me.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=u(t),e=e===null?null:d(e),e=e===null?null:e.stateNode,e};var ng={bundleType:0,version:`19.3.0`,rendererPackageName:`react-dom`,currentDispatcherRef:F,reconcilerVersion:`19.3.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var rg=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rg.isDisabled&&rg.supportsFiber)try{Ye=rg.inject(ng),Xe=rg}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=Tc,s=Ec,c=Dc;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=vh(e,1,!1,null,null,n,r,null,o,s,c,Qh),e[Ct]=t.current,$f(e),new $h(t)}})),DJ=o(((e,t)=>{function n(){if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE==`function`)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=EJ()}))();function OJ(e){if(e.resourceType===`Patient`)return e;if(e.resourceType===`DiagnosticReport`||e.resourceType===`Encounter`||e.resourceType===`Observation`||e.resourceType===`ServiceRequest`)return e.subject}function kJ(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 AJ(e){return kC(e.getActiveLogin()?.project)}var jJ={totp:`Authenticator app (TOTP)`,email:`Email`};function MJ(e){return e?e.mfaMethod&&e.mfaMethod.length>0?e.mfaMethod:e.mfaEnrolled?[`totp`]:[]:[]}function NJ(e){let t=e?.find(e=>e.name===`allowedMfaMethods`)?.valueString;if(!t)return[`totp`];let n=t.split(`,`).map(e=>e.trim()).filter(e=>e===`totp`||e===`email`);return n.length>0?n:[`totp`]}var PJ={totp:`MFA: Authenticator`,email:`MFA: Email`},FJ=16;function IJ(e){let t=e.user?.reference;return t?.startsWith(`User/`)?t.slice(5):void 0}function LJ(e){let t=Z(),n=AJ(t),r=zK(),[i,a]=(0,b.useState)(e.profileTypeOptions[0].value),{showMfaEnrollment:o}=e,[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)({});(0,b.useEffect)(()=>{o&&n&&t.get(`admin/projects/${n}`).then(e=>c(NJ(e.project?.setting))).catch(()=>c(void 0))},[t,n,o]);let d=(0,b.useCallback)(e=>{if(!o)return;let n=e.response.entry??[],r=Array.from(new Set(n.map(e=>e.resource?IJ(e.resource):void 0).filter(e=>e!==void 0)));if(r.length===0){u({});return}let i={resourceType:`Bundle`,type:`batch`,entry:r.map(e=>({request:{method:`GET`,url:`User/${e}`}}))};t.executeBatch(i).then(e=>{let t={};for(let n of e.entry??[]){let e=n.resource;e?.resourceType===`User`&&e.id&&(t[e.id]=e)}u(t)}).catch(()=>u({}))},[t,o]),f=(0,b.useMemo)(()=>{if(!o)return;let e=[{name:`Project-scoped`,renderCell:e=>{let t=IJ(e);return(t?l[t]:void 0)?.project?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(jj,{size:FJ,color:`var(--mantine-color-blue-6)`,style:{verticalAlign:`middle`},"aria-hidden":`true`}),(0,L.jsx)(bl,{children:`Project-scoped`})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(HM,{size:FJ,color:`var(--mantine-color-gray-6)`,style:{verticalAlign:`middle`},"aria-hidden":`true`}),(0,L.jsx)(bl,{children:`Not project-scoped`})]})}}];return s&&s.length>0&&e.push(...s.toSorted((e,t)=>t.localeCompare(e)).map(e=>({name:PJ[e],renderCell:t=>{let n=IJ(t),r=n?l[n]:void 0;return r?MJ(r).includes(e)?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(jj,{size:FJ,color:`var(--mantine-color-blue-6)`,style:{verticalAlign:`middle`},"aria-hidden":`true`}),(0,L.jsx)(bl,{children:`Enrolled`})]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(HM,{size:FJ,color:`var(--mantine-color-gray-6)`,style:{verticalAlign:`middle`},"aria-hidden":`true`}),(0,L.jsx)(bl,{children:`Not enrolled`})]}):(0,L.jsx)(H,{c:`dimmed`,size:`sm`,children:`—`})}}))),e},[o,s,l]),[p,m]=(0,b.useState)({resourceType:`ProjectMembership`,filters:[{code:`project`,operator:X.EQUALS,value:`Project/`+n},{code:`profile-type`,operator:X.EQUALS,value:i}],fields:e.fields,count:100});function h(e){a(e),m({...p,filters:[{code:`project`,operator:X.EQUALS,value:`Project/`+n},{code:`profile-type`,operator:X.EQUALS,value:e}]})}let g=e.profileTypeOptions.length>1,_=g||e.toolbarLeft!==void 0||e.toolbarRight!==void 0;return(0,L.jsxs)(L.Fragment,{children:[_&&(0,L.jsxs)(V,{justify:`space-between`,align:`center`,mb:`md`,wrap:`nowrap`,children:[(0,L.jsxs)(V,{gap:`md`,wrap:`nowrap`,children:[g&&(0,L.jsx)(by,{value:i,onChange:h,data:e.profileTypeOptions}),e.toolbarLeft]}),e.toolbarRight]}),(0,L.jsx)(UB,{search:p,onClick:e=>r(`./${e.resource.id}`),onChange:e=>m(e.definition),onLoad:d,additionalColumns:f,hideFilters:!0,hideToolbar:!0})]})}function RJ(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`ProjectMemberships by Bot`}),(0,L.jsx)(LJ,{profileTypeOptions:[{label:`Bot`,value:`Bot`}],fields:[`user`,`profile`,`accessPolicy`,`userConfiguration`,`active`,`admin`],toolbarLeft:(0,L.jsx)(Cl,{withBorder:!0,p:`sm`,radius:`sm`,maw:520,children:(0,L.jsxs)(H,{size:`sm`,c:`dimmed`,children:[`Please note that this list is limited to Bots that have a ProjectMembership. Bots that are run as user commonly do not have a ProjectMembership, and are not included, such as most Bots in Medplum-managed integrations. For a complete list of Bots, see `,(0,L.jsx)(eN,{to:`/Bot`,children:`Bots`}),`. For more information, see`,` `,(0,L.jsx)(Rd,{href:`https://www.medplum.com/docs/bots/bot-run-as-user`,target:`_blank`,rel:`noopener noreferrer`,children:`running Bots as user`}),`.`]})}),toolbarRight:(0,L.jsx)(Rd,{href:`https://www.medplum.com/docs/bots`,target:`_blank`,rel:`noopener noreferrer`,size:`sm`,children:`Learn more about Bots`})}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(eN,{to:`/admin/bots/new`,children:`Create new bot`})})]})}function zJ(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`ProjectMemberships by ClientApplication`}),(0,L.jsx)(LJ,{profileTypeOptions:[{label:`ClientApplication`,value:`ClientApplication`}],fields:[`user`,`profile`,`accessPolicy`,`userConfiguration`,`active`,`admin`]}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(eN,{to:`/admin/clients/new`,children:`Create new client`})})]})}function BJ(e){return(0,L.jsx)(jL,{resourceType:`AccessPolicy`,name:e.name,defaultValue:e.defaultValue,placeholder:`Access Policy`,onChange:t=>{fT(t)?e.onChange(DC(t)):e.onChange(void 0)}})}function VJ(){let e=Z(),t=AJ(e),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)(void 0);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`Create new Bot`}),(0,L.jsxs)(NP,{onSubmit:()=>{let r={name:n,description:i,accessPolicy:o};e.post(`admin/projects/`+t+`/bot`,r).then(t=>{e.invalidateSearches(`Bot`),e.invalidateSearches(`ProjectMembership`),d(t),q({color:`green`,message:`Bot created`})}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1}),l(yS(e))})},children:[!u&&(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Name`,htmlFor:`name`,outcome:c,children:(0,L.jsx)(jb,{id:`name`,name:`name`,required:!0,autoFocus:!0,onChange:e=>r(e.currentTarget.value),error:BF(c,`name`)})}),(0,L.jsx)(eL,{title:`Description`,htmlFor:`description`,outcome:c,children:(0,L.jsx)(jb,{id:`description`,name:`description`,onChange:e=>a(e.currentTarget.value),error:BF(c,`description`)})}),(0,L.jsx)(eL,{title:`Access Policy`,htmlFor:`accessPolicy`,outcome:c,children:(0,L.jsx)(BJ,{name:`accessPolicy`,onChange:s})}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(U,{type:`submit`,children:`Create Bot`})})]}),u&&(0,L.jsxs)(`div`,{"data-testid":`success`,children:[(0,L.jsx)(H,{children:`Bot created`}),(0,L.jsxs)(Oh,{children:[(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:u,children:`Go to new bot`})}),(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:`/admin/bots`,children:`Back to bots list`})})]})]})]})]})}function HJ(){let e=Z(),t=AJ(e),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)(),[f,p]=(0,b.useState)(void 0);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`Create new Client`}),(0,L.jsxs)(NP,{onSubmit:()=>{let r={name:n,description:i,redirectUri:o,accessPolicy:c};e.post(`admin/projects/`+t+`/client`,r).then(t=>{e.invalidateSearches(`ClientApplication`),e.invalidateSearches(`ProjectMembership`),p(t),q({color:`green`,message:`Client created`})}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1}),d(yS(e))})},children:[!f&&(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Name`,htmlFor:`name`,outcome:u,children:(0,L.jsx)(jb,{id:`name`,name:`name`,required:!0,autoFocus:!0,onChange:e=>r(e.currentTarget.value),error:BF(u,`name`)})}),(0,L.jsx)(eL,{title:`Description`,htmlFor:`description`,outcome:u,children:(0,L.jsx)(jb,{id:`description`,name:`description`,onChange:e=>a(e.currentTarget.value),error:BF(u,`description`)})}),(0,L.jsx)(eL,{title:`Redirect URI`,htmlFor:`redirectUri`,outcome:u,children:(0,L.jsx)(jb,{id:`redirectUri`,name:`redirectUri`,onChange:e=>s(e.currentTarget.value),error:BF(u,`redirectUri`)})}),(0,L.jsx)(eL,{title:`Access Policy`,htmlFor:`accessPolicy`,outcome:u,children:(0,L.jsx)(BJ,{name:`accessPolicy`,onChange:l})}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(U,{type:`submit`,children:`Create Client`})})]}),f&&(0,L.jsxs)(`div`,{"data-testid":`success`,children:[(0,L.jsx)(H,{children:`Client created`}),(0,L.jsxs)(Oh,{children:[(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:f,children:`Go to new client`})}),(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:`/admin/clients`,children:`Back to clients list`})})]})]})]})]})}var UJ=1e-10;function WJ(e,t){let n=0,r=Math.exp(-t);for(let i=0;i<=e;i++)i>0&&(r*=t/i),n+=r;return n}function GJ(e,t,n=UJ){let r=0,i=Math.max(t+1,1);for(;WJ(t,i)>e;)i*=2;for(;i-r>n;){let n=(r+i)/2;WJ(t,n)>e?r=n:i=n}return i}function KJ(e,t,n,r){let i=e*300,a=9*t*i/(e*10*1e3/7),o=Math.ceil(a),s=o/i,c=Math.max(r??0,s),l=r?c*i:o,u=l,d=WJ(l-1,u),f=Math.log(1-n)/Math.log(d);return{rowsSampled:i,cutoffFrequencyExact:a,cutoffFrequency:o,minimumSelectivity:s,targetSelectivity:c,targetLambda:u,targetPoissonCdf:d,targetM:f,results:[{name:`Floor`,result:qJ(Math.floor(f),n,l,i)},{name:`Ceiling`,result:qJ(Math.ceil(f),n,l,i)}]}}function qJ(e,t,n,r){let i=(1-t)**(1/e),a=GJ(i,n-1);return{m:e,poissonCdf:i,lambda:a,f:a/r}}function JJ(e,t=`auto`,n=6){return Number.isFinite(e)?t===`scientific`?e.toExponential(n):t===`fixed`?e.toFixed(n):Math.abs(e)<1e-4&&e!==0?e.toExponential(n):Math.abs(e-Math.round(e))<1e-10?Math.round(e).toString():e.toPrecision(8):String(e)}function YJ({label:e,value:t,format:n=`auto`,decimals:r=6}){return(0,L.jsxs)(km,{children:[(0,L.jsx)(km.Col,{span:8,children:(0,L.jsx)(H,{size:`sm`,children:e})}),(0,L.jsx)(km.Col,{span:4,children:(0,L.jsx)(H,{size:`sm`,ff:`monospace`,ta:`right`,children:JJ(t,n,r)})})]})}function XJ({title:e,m:t,poissonCdf:n,lambda:r,f:i}){return(0,L.jsxs)(Cl,{withBorder:!0,p:`md`,children:[(0,L.jsx)(K,{order:4,mb:`sm`,children:e}),(0,L.jsxs)(W,{gap:`xs`,children:[(0,L.jsx)(YJ,{label:`M (padding multiplier)`,value:t}),(0,L.jsx)(YJ,{label:`Poisson CDF`,value:n}),(0,L.jsx)(YJ,{label:`Lambda`,value:r}),(0,L.jsx)(YJ,{label:`F (selectivity)`,value:i,format:`scientific`})]})]})}function ZJ(){let[e,t]=(0,b.useState)(1e3),[n,r]=(0,b.useState)(3),[i,a]=(0,b.useState)(.999999),[o,s]=(0,b.useState)(``),c=(0,b.useMemo)(()=>{let t=typeof e==`number`?e:void 0,r=typeof n==`number`?n:void 0,a=typeof i==`number`?i:void 0,s=typeof o==`number`?o:void 0;if(t!==void 0&&r!==void 0&&a!==void 0)return KJ(t,r,a,s)},[e,n,i,o]);return(0,L.jsxs)(W,{gap:`lg`,children:[(0,L.jsxs)(Cl,{withBorder:!0,p:`md`,children:[(0,L.jsx)(K,{order:4,mb:`md`,children:`Inputs`}),(0,L.jsxs)(km,{children:[(0,L.jsx)(km.Col,{span:{base:12,sm:6,md:3},children:(0,L.jsx)(W_,{label:`Statistics Target`,value:e,onChange:t,min:100,max:1e4,step:100})}),(0,L.jsx)(km.Col,{span:{base:12,sm:6,md:3},children:(0,L.jsx)(W_,{label:`Elements Per Row`,value:n,onChange:r,min:1,max:1e3,step:1})}),(0,L.jsx)(km.Col,{span:{base:12,sm:6,md:3},children:(0,L.jsx)(W_,{label:`Confidence`,value:i,onChange:a,min:0,max:1,step:1e-6,decimalScale:10})}),(0,L.jsx)(km.Col,{span:{base:12,sm:6,md:3},children:(0,L.jsx)(W_,{label:`Target Selectivity (optional)`,description:`Overrides minimum selectivity`,value:o,onChange:s,min:0,max:1,step:1e-5,decimalScale:10,placeholder:c?JJ(c.minimumSelectivity,`scientific`):``})})]})]}),c&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Cl,{withBorder:!0,p:`md`,children:[(0,L.jsx)(K,{order:4,mb:`sm`,children:`Intermediate Values`}),(0,L.jsxs)(km,{children:[(0,L.jsx)(km.Col,{span:{base:12,md:6},children:(0,L.jsxs)(W,{gap:`xs`,children:[(0,L.jsx)(YJ,{label:`Rows Sampled`,value:c.rowsSampled}),(0,L.jsx)(YJ,{label:`Cutoff Frequency (exact)`,value:c.cutoffFrequencyExact}),(0,L.jsx)(YJ,{label:`Cutoff Frequency`,value:c.cutoffFrequency}),(0,L.jsx)(YJ,{label:`Min Selectivity`,value:c.minimumSelectivity,format:`scientific`})]})}),(0,L.jsx)(km.Col,{span:{base:12,md:6},children:(0,L.jsxs)(W,{gap:`xs`,children:[(0,L.jsx)(YJ,{label:`Target Selectivity`,value:c.targetSelectivity,format:`scientific`}),(0,L.jsx)(YJ,{label:`Target Lambda`,value:c.targetLambda}),(0,L.jsx)(YJ,{label:`Target Poisson CDF`,value:c.targetPoissonCdf}),(0,L.jsx)(YJ,{label:`Target m`,value:c.targetM})]})})]})]}),(0,L.jsx)(km,{children:c.results.map(({name:e,result:t})=>(0,L.jsx)(km.Col,{span:{base:12,md:6},children:(0,L.jsx)(XJ,{title:`${e} Option`,m:t.m,poissonCdf:t.poissonCdf,lambda:t.lambda,f:t.f})},e))})]})]})}var QJ=8;function $J({inputProps:e,data:t,onChange:n}){let r=Bf({onDropdownClose:()=>r.resetSelectedOption()}),[i,a]=(0,b.useState)(null),[o,s]=(0,b.useState)(``),c=(0,b.useMemo)(()=>t.filter(e=>e.toLowerCase().includes(o.toLowerCase().trim())),[t,o]),l=(0,b.useMemo)(()=>{let e=Array(Math.min(c.length,QJ));for(let t=0;t<e.length;t++){let n=c[t];e[t]=(0,L.jsx)(Uf.Option,{value:n,children:n},n)}return e},[c]);return(0,L.jsxs)(Uf,{store:r,withinPortal:!1,onOptionSubmit:e=>{n&&n(e),a(e),s(e),r.closeDropdown()},children:[(0,L.jsx)(Uf.Target,{children:(0,L.jsx)(vd,{rightSection:(0,L.jsx)(Uf.Chevron,{}),value:o,onChange:e=>{r.openDropdown(),r.updateSelectedOptionIndex(),s(e.currentTarget.value)},onClick:()=>r.openDropdown(),onFocus:()=>r.openDropdown(),onBlur:()=>{r.closeDropdown(),s(i||``)},rightSectionPointerEvents:`none`,...e})}),(0,L.jsx)(Uf.Dropdown,{children:(0,L.jsx)(Uf.Options,{children:l.length>0?l:(0,L.jsx)(Uf.Empty,{children:`Nothing found`})})})]})}function eY(e){let t=[];for(let 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=yw(t),t}function tY(e){return typeof e==`string`?e.length>50?e.substring(0,50)+`...`:e:typeof e==`boolean`?e.toString().toLocaleUpperCase():e}function nY(e){if(e===0)return`0 B`;let t=Math.min(Math.floor(Math.log(e)/Math.log(1024)),4);return`${(e/1024**t).toFixed(2)} ${[`B`,`KB`,`MB`,`GB`,`TB`][t]}`}var rY=({medplum:e,onChange:t,onError:n})=>{(0,b.useEffect)(()=>{async function r(){return(await e.valueSetExpand({url:`https://medplum.com/fhir/ValueSet/resource-types`,count:200})).expansion?.contains?.map(e=>e.code).filter(e=>e!==void 0)??[]}r().then(e=>{t(eY(e))}).catch(e=>{n?n(e):console.error(e)})},[e,t,n])};function iY(){let e=Z(),[t,{open:n,close:r}]=wn(!1),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(void 0),[u,d]=(0,b.useState)(0),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)([]),[g,_]=(0,b.useState)([]),[v,y]=(0,b.useState)(!1),[x,S]=(0,b.useState)(void 0),[C,w]=(0,b.useState)([]),[T,E]=(0,b.useState)(0),[D,O]=(0,b.useState)(!1),[k,A]=(0,b.useState)(!1);rY({medplum:e,onChange:w}),(0,b.useEffect)(()=>{p(!0),e.get(`fhir/R4/$db-column-statistics?tableName=`+encodeURIComponent(c??``),{cache:`no-cache`}).then(e=>{let t=e.parameter?.find(e=>e.name===`defaultStatisticsTarget`)?.valueInteger??0;d(t);let n=(e.parameter?.find(e=>e.name===`table`)?.part)?.filter(e=>e.name===`column`);h(n??[])}).finally(()=>{p(!1)}).catch(e=>{q({color:`red`,message:e.message})})},[e,c,T]);function j(){if(c){if(g.length===0){q({color:`red`,message:`No columns selected`,autoClose:!0});return}q({title:`Submit`,message:JSON.stringify({resetToDefault:v,newStatisticsTarget:x,selectedRowNames:g}),autoClose:!0}),e.post(`fhir/R4/$db-configure-column-statistics`,{tableName:c,columnNames:g,resetToDefault:v,newStatisticsTarget:v?void 0:x}).then(e=>{q({color:`green`,message:`Done`}),E(e=>e+1)}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}}let M={onClick:e=>{a(`Details`),s((0,L.jsx)(`pre`,{children:e})),n()}},N=0;return(0,L.jsxs)(NP,{onSubmit:j,children:[(0,L.jsxs)(W,{gap:`sm`,children:[(0,L.jsxs)(V,{children:[(0,L.jsx)($J,{data:C,inputProps:{placeholder:`Table name`,inputSize:`50`},onChange:e=>{l(e),_([])}}),(0,L.jsx)(U,{loading:f,onClick:()=>E(e=>e+1),children:`Refresh`})]}),(0,L.jsxs)(V,{children:[(0,L.jsx)(H,{span:!0,fw:700,children:`Statistics Target:`}),(0,L.jsx)(W_,{value:v?``:x,disabled:v,required:!v,size:`sm`,w:`100`,min:0,step:100,max:1e4,onChange:e=>{typeof e==`number`&&S(e)}}),(0,L.jsx)(H,{span:!0,fw:700,c:`dimmed`,children:`– or –`}),(0,L.jsx)(pp,{checked:v,onChange:e=>y(e.currentTarget.checked),label:`Reset to default (`+u+`)`,size:`sm`}),(0,L.jsx)(PP,{size:`sm`,children:`Update`})]}),(0,L.jsx)(V,{children:(0,L.jsx)(pp,{checked:k,onChange:e=>A(e.currentTarget.checked),label:`Hide columns with default statistics target`,size:`sm`})}),(0,L.jsx)(V,{children:(0,L.jsx)(pp,{checked:D,onChange:e=>O(e.currentTarget.checked),label:`Show all column stats`,size:`sm`})}),(0,L.jsx)(G.ScrollContainer,{minWidth:500,children:(0,L.jsxs)(G,{striped:!0,highlightOnHover:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:(0,L.jsx)(pp,{size:`sm`,checked:m.length>0&&g.length===m.length,indeterminate:g.length>0&&g.length<m.length,onChange:()=>{g.length===m.length?_([]):_(m.map(e=>e.part?.find(e=>e.name===`name`)?.valueString??``))}})}),(0,L.jsx)(G.Th,{children:`Column`}),(0,L.jsx)(G.Th,{children:`Statistics Target`}),(0,L.jsx)(G.Th,{children:`null_frac`}),(0,L.jsx)(G.Th,{children:`avg_width`}),(0,L.jsx)(G.Th,{children:`n_distinct`}),(0,L.jsx)(G.Th,{children:`correlation`}),D&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(G.Th,{children:`most_common_vals`}),(0,L.jsx)(G.Th,{children:`most_common_freqs`}),(0,L.jsx)(G.Th,{children:`histogram_bounds`}),(0,L.jsx)(G.Th,{children:`most_common_elems`}),(0,L.jsx)(G.Th,{children:`most_common_elem_freqs`}),(0,L.jsx)(G.Th,{children:`elem_count_histogram`})]})]})}),(0,L.jsxs)(G.Tbody,{children:[m?.map(e=>{let t=e.part??[],n=t.find(e=>e.name===`name`)?.valueString,r=t.find(e=>e.name===`statisticsTarget`)?.valueInteger;if(r===-1&&(N++,k))return null;if(!n)throw Error(`Column missing name`,{cause:e});return(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:(0,L.jsx)(pp,{size:`sm`,checked:g.includes(n),onChange:e=>{_(e.currentTarget.checked?[...g,n]:g.filter(e=>e!==n))}})}),(0,L.jsx)(G.Td,{children:n}),(0,L.jsx)(G.Td,{children:r===-1?(0,L.jsxs)(H,{span:!0,c:`dimmed`,fs:`italic`,children:[`default (`,u,`)`]}):r}),(0,L.jsx)(aY,{value:t.find(e=>e.name===`nullFraction`)?.valueDecimal,...M}),(0,L.jsx)(aY,{value:t.find(e=>e.name===`avgWidth`)?.valueInteger,...M}),(0,L.jsx)(aY,{value:t.find(e=>e.name===`nDistinct`)?.valueDecimal,...M}),(0,L.jsx)(aY,{value:t.find(e=>e.name===`correlation`)?.valueDecimal,...M}),D&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(aY,{value:t.find(e=>e.name===`mostCommonValues`)?.valueString,...M}),(0,L.jsx)(aY,{value:t.find(e=>e.name===`mostCommonFreqs`)?.valueString,...M}),(0,L.jsx)(aY,{value:t.find(e=>e.name===`histogramBounds`)?.valueString,...M}),(0,L.jsx)(aY,{value:t.find(e=>e.name===`mostCommonElems`)?.valueString,...M}),(0,L.jsx)(aY,{value:t.find(e=>e.name===`mostCommonElemFreqs`)?.valueString,...M}),(0,L.jsx)(aY,{value:t.find(e=>e.name===`elemCountHistogram`)?.valueString,...M})]})]},n)}),k&&(0,L.jsx)(G.Tr,{children:(0,L.jsx)(G.Td,{colSpan:D?13:7,children:(0,L.jsxs)(H,{c:`dimmed`,fs:`italic`,children:[N,` hidden columns with default statistics target`]})})})]})]})})]}),(0,L.jsx)(pg,{opened:t,onClose:r,title:i,centered:!0,size:`auto`,children:o})]})}function aY({value:e,onClick:t}){return(0,L.jsx)(G.Td,{style:{cursor:`pointer`},onClick:()=>t?.(e),children:oY(e)})}function oY(e){return typeof e==`string`&&e.length>30?e.substring(0,30)+`...`:e}function sY(e,t,n,r){let i=Date.now().toString();q({id:i,loading:!0,title:t,message:`Running...`,autoClose:!1,withCloseButton:!1});let a={method:`POST`,pollStatusOnAccepted:!0};return r&&(a.body=JSON.stringify(r)),e.startAsyncRequest(n,a).then(e=>{let n=`Done`;return e.resourceType===`AsyncJob`?n=(0,L.jsx)(eN,{to:e,children:`View AsyncJob`}):e.resourceType===`OperationOutcome`&&e.issue?.[0]?.details?.text&&(n=(0,L.jsx)(H,{children:e.issue[0].details.text})),Zb.update({id:i,color:`green`,title:t,message:n,icon:(0,L.jsx)(jj,{size:`1rem`}),loading:!1,autoClose:!1,withCloseButton:!0}),e}).catch(e=>{throw Zb.update({id:i,color:`red`,title:t,message:J(e),icon:(0,L.jsx)(HM,{size:`1rem`}),loading:!1,autoClose:!1,withCloseButton:!0}),e})}function cY(e,t,n,r){sY(e,t,n,r).catch(()=>{})}var lY=8;function uY({pillInputProps:e,inputProps:t,data:n,onChange:r}){let i=Bf({onDropdownClose:()=>i.resetSelectedOption(),onDropdownOpen:()=>i.updateSelectedOptionIndex(`active`)}),[a,o]=(0,b.useState)(``),[s,c]=(0,b.useState)([]),l=e=>{let t=s.includes(e)?s.filter(t=>t!==e):[...s,e];c(t),r&&r(t)},u=e=>{let t=s.filter(t=>t!==e);c(t),r?.(t)},d=s.map(e=>(0,L.jsx)(Cg,{withRemoveButton:!0,onRemove:()=>u(e),children:e},e)),f=(0,b.useMemo)(()=>{let e=a.trim().toLowerCase();return n.filter(t=>t.toLowerCase().includes(e))},[n,a]),p=(0,b.useMemo)(()=>{let e=Array(Math.min(f.length,lY));for(let t=0;t<e.length;t++){let n=f[t];e[t]=(0,L.jsx)(Uf.Option,{value:n,active:s.includes(n),children:(0,L.jsxs)(V,{gap:`sm`,children:[s.includes(n)?(0,L.jsx)(ap,{size:12}):null,(0,L.jsx)(`span`,{children:n})]})},n)}return e},[f,s]);return(0,L.jsxs)(Uf,{store:i,onOptionSubmit:l,withinPortal:!1,children:[(0,L.jsx)(Uf.DropdownTarget,{children:(0,L.jsx)(Og,{onClick:()=>i.openDropdown(),...e,children:(0,L.jsxs)(Cg.Group,{children:[d,(0,L.jsx)(Uf.EventsTarget,{children:(0,L.jsx)(Og.Field,{onFocus:()=>i.openDropdown(),onBlur:()=>{i.closeDropdown(),o(``)},value:a,onChange:e=>{i.updateSelectedOptionIndex(),o(e.currentTarget.value)},onKeyDown:e=>{e.key===`Backspace`&&a.length===0&&s.length>0&&(e.preventDefault(),u(s[s.length-1]))},...t})})]})})}),(0,L.jsx)(Uf.Dropdown,{children:(0,L.jsx)(Uf.Options,{children:p.length>0?p:(0,L.jsx)(Uf.Empty,{children:`Nothing found...`})})})]})}function dY({defaultGinPendingListLimit:e,availableTables:t,onResponse:n}){let r=Z(),[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)([]),[c,l]=(0,b.useState)(`unspecified`),[u,d]=(0,b.useState)(`unspecified`),[f,p]=(0,b.useState)(void 0);return(0,L.jsx)(NP,{onSubmit:()=>{let e={tableName:o};c===`reset`?e.fastUpdateAction=`reset`:c===`on`?(e.fastUpdateAction=`set`,e.fastUpdateValue=!0):c===`off`&&(e.fastUpdateAction=`set`,e.fastUpdateValue=!1),u===`reset`?e.ginPendingListLimitAction=`reset`:u===`set`&&(e.ginPendingListLimitAction=`set`,e.ginPendingListLimitValue=f),a(!0),sY(r,`Configure GIN Indexes`,`fhir/R4/$db-configure-indexes`,e).then(e=>{n(e)}).catch(()=>{}).finally(()=>{a(!1)})},children:(0,L.jsxs)(W,{gap:`sm`,maw:`800`,children:[(0,L.jsx)(fd,{label:`Table(s)`,children:(0,L.jsx)(uY,{data:t,onChange:e=>s(e),inputProps:{name:`tables`,placeholder:`e.g. Observation`}})}),(0,L.jsx)(Wv.Group,{name:`fastUpdate`,label:`fastupdate`,value:c,onChange:e=>l(e),children:(0,L.jsxs)(V,{h:`36`,children:[(0,L.jsx)(Wv,{size:`sm`,value:`unspecified`,label:`unspecified`}),(0,L.jsx)(Wv,{size:`sm`,value:`reset`,label:`reset to default (on)`}),(0,L.jsx)(Wv,{size:`sm`,value:`off`,label:`off`}),(0,L.jsx)(Wv,{size:`sm`,value:`on`,label:`on`})]})}),(0,L.jsx)(Wv.Group,{name:`ginPendingListLimit`,label:`gin_pending_list_limit`,value:u,onChange:e=>{d(e),e!==`set`&&p(void 0)},children:(0,L.jsxs)(V,{h:`36`,children:[(0,L.jsx)(Wv,{size:`sm`,value:`unspecified`,label:`unspecified`}),(0,L.jsx)(Wv,{size:`sm`,value:`reset`,label:`reset to default (${e}kB)`}),(0,L.jsxs)(V,{children:[(0,L.jsx)(Wv,{size:`sm`,value:`set`,label:`Set to (kB)`}),(0,L.jsx)(W_,{title:`gin_pending_list_limit_value`,name:`gin_pending_list_limit_value`,value:(u===`set`?f:``)||``,disabled:u!==`set`,required:u===`set`,size:`sm`,w:`100`,min:64,max:2147483647,onChange:e=>{p(typeof e==`number`?e:void 0)}})]})]})}),(0,L.jsx)(V,{justify:`center`,children:(0,L.jsx)(PP,{size:`sm`,loading:i,children:`Update`})})]})})}function fY(){let e=Z(),[t,{open:n,close:r}]=wn(!1),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(void 0),[u,d]=(0,b.useState)(0),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(void 0),[g,_]=(0,b.useState)([]),[v,y]=(0,b.useState)(0);rY({medplum:e,onChange:_}),(0,b.useEffect)(()=>{p(!0),e.get(`fhir/R4/$db-indexes?tableName=`+encodeURIComponent(c??``),{cache:`no-cache`}).then(e=>{let t=e.parameter?.find(e=>e.name===`defaultGinPendingListLimit`)?.valueInteger??0;d(t);let n=e.parameter?.filter(e=>e.name===`index`);h(n??[])}).finally(()=>{p(!1)}).catch(e=>{q({color:`red`,message:e.message})})},[e,c,v]);let x=e=>{a(`Configure results`),s((0,L.jsx)(`pre`,{children:JSON.stringify(e,null,2)})),n(),y(e=>(e+1)%100)},S={onClick:e=>{a(`Details`),s((0,L.jsx)(`pre`,{children:e})),n()}},C;return f?C=`Loading...`:c?m?.length===0&&(C=`No GIN indexes on this table`):C=`Select a table`,(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(W,{gap:`sm`,children:[(0,L.jsx)(`h2`,{children:`Configure GIN indexes`}),(0,L.jsx)(V,{children:(0,L.jsx)(dY,{defaultGinPendingListLimit:u,availableTables:g,onResponse:x})}),(0,L.jsx)(`h2`,{children:`GIN index stats`}),(0,L.jsxs)(V,{children:[(0,L.jsx)($J,{data:g,inputProps:{placeholder:`Table name`,inputSize:`50`},onChange:e=>{l(e)}}),(0,L.jsx)(U,{loading:f,onClick:()=>y(e=>(e+1)%100),disabled:!c,children:`Refresh`})]}),(0,L.jsx)(G.ScrollContainer,{minWidth:500,children:(0,L.jsxs)(G,{striped:!0,highlightOnHover:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Schema`}),(0,L.jsx)(G.Th,{children:`Table`}),(0,L.jsx)(G.Th,{children:`Index`}),(0,L.jsx)(G.Th,{children:`fastupdate`}),(0,L.jsx)(G.Th,{children:`gin_pending_list_limit`}),(0,L.jsx)(G.Th,{children:`options`})]})}),(0,L.jsxs)(G.Tbody,{children:[C&&(0,L.jsx)(G.Tr,{children:(0,L.jsx)(G.Td,{colSpan:16,children:C})}),!C&&m?.map(e=>{let t=e.part??[],n=t.find(e=>e.name===`indexName`)?.valueString;if(!n)throw Error(`Index missing name`,{cause:e});return(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:t.find(e=>e.name===`schemaName`)?.valueString}),(0,L.jsx)(G.Td,{children:t.find(e=>e.name===`tableName`)?.valueString}),(0,L.jsx)(G.Td,{children:n}),(0,L.jsx)(pY,{value:t.find(e=>e.name===`fastUpdate`)?.valueBoolean,defaultValue:(0,L.jsxs)(H,{span:!0,c:`dimmed`,fs:`italic`,children:[`default\xA0(`,tY(!0),`)`]}),...S}),(0,L.jsx)(pY,{value:t.find(e=>e.name===`ginPendingListLimit`)?.valueInteger,defaultValue:(0,L.jsxs)(H,{span:!0,c:`dimmed`,fs:`italic`,children:[`default\xA0(`,u,`)`]}),...S}),(0,L.jsx)(pY,{value:t.find(e=>e.name===`indexOptions`)?.valueString,defaultValue:(0,L.jsx)(H,{span:!0,c:`dimmed`,fs:`italic`,children:`NULL`}),...S})]},n)})]})]})})]}),(0,L.jsx)(pg,{opened:t,onClose:r,title:i,centered:!0,size:`auto`,children:o})]})}function pY({value:e,onClick:t,defaultValue:n}){return(0,L.jsx)(G.Td,{style:{cursor:`pointer`},onClick:()=>t?.(e),children:e===void 0?n:tY(e)})}var mY=1048576;function hY(){let e=Z(),[t,n]=(0,b.useState)([]),[r,i]=(0,b.useState)([]),[a,o]=(0,b.useState)(30),[s,c]=(0,b.useState)(100),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(),[p,m]=(0,b.useState)(),[h,g]=(0,b.useState)(),[_,v]=(0,b.useState)(),[y,x]=(0,b.useState)(`indexSize`),[S,C]=(0,b.useState)(`desc`);rY({medplum:e,onChange:i}),(0,b.useEffect)(()=>{let t=!0;return e.post(`fhir/R4/$db-invalid-indexes`,{}).then(e=>{t&&g(e.parameter?.filter(e=>e.name===`invalidIndex`&&e.valueString).map(e=>vY(e.valueString))??[])}).catch(e=>{t&&v(J(e))}),()=>{t=!1}},[e]);let w=(0,b.useMemo)(()=>[...p??[]].sort((e,t)=>{let n=e[y],r=t[y];if(n===void 0)return r===void 0?0:1;if(r===void 0)return-1;let i=typeof n==`number`&&typeof r==`number`?n-r:String(n).localeCompare(String(r));return S===`asc`?i:-i}),[p,S,y]),T=()=>{if(typeof a!=`number`||typeof s!=`number`)return;let n=new URLSearchParams({minBloatPercent:String(a),minIndexSize:String(Math.round(s*mY))});t.length>0&&n.set(`tableName`,t.join(`,`)),f(void 0),u(!0),e.get(`fhir/R4/$db-index-bloat?${n}`,{cache:`no-cache`}).then(e=>{m(e.parameter?.filter(e=>e.name===`index`).map(_Y)??[])}).catch(e=>{let t=J(e);f(t),q({color:`red`,message:t,autoClose:!1})}).finally(()=>u(!1))},E=e=>{e===y?C(e=>e===`asc`?`desc`:`asc`):(x(e),C(e===`schemaName`||e===`tableName`||e===`indexName`||e===`indexType`||e===`liveTuplesPerPage`?`asc`:`desc`))},D=typeof a==`number`&&a>=0&&a<=100&&typeof s==`number`&&s>=0,O=h?.reduce((e,t)=>e+t.indexSizeBytes,0)??0;return(0,L.jsxs)(W,{gap:`md`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(K,{order:2,children:`Index health`}),(0,L.jsx)(H,{c:`dimmed`,size:`sm`,children:`Review invalid indexes and analyze valid indexes for bloat. Invalid indexes are excluded from bloat estimates.`})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(K,{order:3,children:`Invalid indexes`}),(0,L.jsx)(H,{c:`dimmed`,size:`sm`,children:`Invalid indexes cannot serve queries, but may still consume disk and add write overhead.`})]}),_&&(0,L.jsx)(jd,{color:`red`,title:`Unable to load invalid indexes`,children:_}),h===void 0&&!_&&(0,L.jsx)(H,{c:`dimmed`,children:`Loading invalid indexes…`}),h?.length===0&&(0,L.jsx)(H,{c:`dimmed`,children:`No invalid indexes detected.`}),h&&h.length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(jd,{color:`yellow`,title:`${h.length} invalid ${h.length===1?`index`:`indexes`} detected`,children:[`These indexes occupy `,nY(O),` and are not included in the bloat analysis below.`]}),(0,L.jsx)(G.ScrollContainer,{minWidth:900,children:(0,L.jsxs)(G,{striped:!0,highlightOnHover:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Schema`}),(0,L.jsx)(G.Th,{children:`Table`}),(0,L.jsx)(G.Th,{children:`Index`}),(0,L.jsx)(G.Th,{children:`Status`}),(0,L.jsx)(G.Th,{children:`Type`}),(0,L.jsx)(G.Th,{children:`Size`}),(0,L.jsx)(G.Th,{children:`Unique`}),(0,L.jsx)(G.Th,{children:`Primary`})]})}),(0,L.jsx)(G.Tbody,{children:h.map(e=>(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:e.schemaName}),(0,L.jsx)(G.Td,{children:e.tableName}),(0,L.jsx)(G.Td,{children:e.indexName}),(0,L.jsx)(G.Td,{children:e.status}),(0,L.jsx)(G.Td,{children:e.indexType.toUpperCase()}),(0,L.jsx)(G.Td,{children:e.indexSize}),(0,L.jsx)(G.Td,{children:e.isUnique?`Yes`:`No`}),(0,L.jsx)(G.Td,{children:e.isPrimary?`Yes`:`No`})]},`${e.schemaName}.${e.indexName}`))})]})})]}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(K,{order:3,children:`Index bloat`}),(0,L.jsx)(H,{c:`dimmed`,size:`sm`,children:`B-tree rows show an estimated bloat percentage. GIN rows show live tuples per allocated page; a low ratio on a large index is a signal to consider REINDEX CONCURRENTLY. Live tuple estimates are updated by VACUUM and ANALYZE.`})]}),(0,L.jsxs)(V,{align:`end`,children:[(0,L.jsx)(fd,{label:`Table(s)`,children:(0,L.jsx)(uY,{data:r,onChange:n,pillInputProps:{w:360},inputProps:{name:`tables`,placeholder:`e.g. Observation`}})}),(0,L.jsx)(W_,{label:`Minimum B-tree bloat`,suffix:`%`,value:a,onChange:o,min:0,max:100,decimalScale:2,w:180}),(0,L.jsx)(W_,{label:`Minimum index size`,suffix:` MB`,value:s,onChange:c,min:0,decimalScale:2,w:240}),(0,L.jsx)(U,{loading:l,disabled:!D,onClick:T,children:`Analyze`})]}),d&&(0,L.jsx)(jd,{color:`red`,title:`Analysis failed`,children:d}),p===void 0&&!l&&(0,L.jsx)(H,{c:`dimmed`,children:`Click Analyze to scan indexes for bloat.`}),p?.length===0&&!l&&(0,L.jsx)(H,{c:`dimmed`,children:`No indexes meet the selected thresholds.`}),p&&p.length>0&&(0,L.jsx)(G.ScrollContainer,{minWidth:1100,children:(0,L.jsxs)(G,{striped:!0,highlightOnHover:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(gY,{label:`Schema`,sortKey:`schemaName`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(gY,{label:`Table`,sortKey:`tableName`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(gY,{label:`Index`,sortKey:`indexName`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(gY,{label:`Type`,sortKey:`indexType`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(gY,{label:`Index size`,sortKey:`indexSize`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(gY,{label:`GIN est. live tuples`,sortKey:`liveTuples`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(gY,{label:`GIN allocated pages`,sortKey:`allocatedPages`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(gY,{label:`GIN live tuples/page`,sortKey:`liveTuplesPerPage`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(gY,{label:`Est. B-tree bloat`,sortKey:`estimatedBloatSize`,activeKey:y,direction:S,onSort:E}),(0,L.jsx)(gY,{label:`B-tree bloat`,sortKey:`bloatPercent`,activeKey:y,direction:S,onSort:E})]})}),(0,L.jsx)(G.Tbody,{children:w.map(e=>(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:e.schemaName}),(0,L.jsx)(G.Td,{children:e.tableName}),(0,L.jsx)(G.Td,{children:e.indexName}),(0,L.jsx)(G.Td,{children:e.indexType.toUpperCase()}),(0,L.jsx)(G.Td,{children:nY(e.indexSize)}),(0,L.jsx)(G.Td,{children:e.liveTuples===void 0?`—`:e.liveTuples.toLocaleString()}),(0,L.jsx)(G.Td,{children:e.allocatedPages===void 0?`—`:e.allocatedPages.toLocaleString()}),(0,L.jsx)(G.Td,{children:e.liveTuplesPerPage===void 0?`—`:e.liveTuplesPerPage.toFixed(2)}),(0,L.jsx)(G.Td,{children:e.estimatedBloatSize===void 0?`—`:nY(e.estimatedBloatSize)}),(0,L.jsx)(G.Td,{children:e.bloatPercent===void 0?`—`:`${e.bloatPercent.toFixed(2)}%`})]},`${e.schemaName}.${e.indexName}`))})]})})]})}function gY({label:e,sortKey:t,activeKey:n,direction:r,onSort:i}){return(0,L.jsx)(G.Th,{children:(0,L.jsxs)(vl,{onClick:()=>i(t),style:{fontWeight:700,display:`flex`,alignItems:`center`,gap:4},children:[e,n===t&&(r===`desc`?(0,L.jsx)(hj,{size:14}):(0,L.jsx)(gj,{size:14}))]})})}function _Y(e){let t=e.part??[];return{schemaName:xY(t,`schemaName`),tableName:xY(t,`tableName`),indexName:xY(t,`indexName`),indexType:xY(t,`indexType`),indexSize:SY(t,`indexSize`),estimatedBloatSize:CY(t,`estimatedBloatSize`),bloatPercent:CY(t,`bloatPercent`),liveTuples:CY(t,`liveTuples`),allocatedPages:CY(t,`allocatedPages`),liveTuplesPerPage:CY(t,`liveTuplesPerPage`)}}function vY(e){let t=new Map;for(let n of e.split(`
|
|
219
219
|
`)){let e=/^\s*\[([^:]+):\s*(.*)]$/.exec(n);e&&t.set(e[1],e[2])}let n=t.get(`schema`)??``,r=e.split(`
|
|
220
|
-
`,1)[0].replace(/:$/,``).replace(RegExp(`^${gY(n)}\\.`),``).replace(/^"|"$/g,``),i=t.get(`index_size`)??`0 bytes`;return{schemaName:n,tableName:t.get(`table`)??``,indexName:r,status:t.get(`index_status`)??``,indexSize:i,indexSizeBytes:hY(i),indexType:t.get(`index_type`)??``,isPrimary:t.get(`is_primary`)===`true`,isUnique:t.get(`is_unique`)===`true`}}function hY(e){let t=/^(\d+(?:\.\d+)?)\s*(bytes|kB|MB|GB|TB)$/.exec(e);return t?Number(t[1])*({bytes:1,kB:1024,MB:1024**2,GB:1024**3,TB:1024**4}[t[2]]??0):0}function gY(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function _Y(e,t){let n=e.find(e=>e.name===t);return n?.valueString??n?.valueCode??``}function vY(e,t){return e.find(e=>e.name===t)?.valueDecimal??0}function yY(e,t){return e.find(e=>e.name===t)?.valueDecimal}var bY=[{label:`GIN Indexes`,value:`gin-indexes`},{label:`Index Health`,value:`index-health`},{label:`Column Statistics`,value:`column-statistics`},{label:`Array Column Padding`,value:`array-padding`}];function xY(){let e=Z();return!e.isLoading()&&!e.isSuperAdmin()?(0,L.jsx)(oI,{outcome:lS}):(0,L.jsx)(PF,{maw:`100%`,children:(0,L.jsxs)(IF,{children:[(0,L.jsx)(K,{order:1,children:`Database Tools`}),(0,L.jsxs)(tV,{baseUrl:`/admin/super/db`,tabs:bY,children:[(0,L.jsx)(Ab.Panel,{value:`gin-indexes`,pt:`md`,children:(0,L.jsx)(cY,{})}),(0,L.jsx)(Ab.Panel,{value:`index-health`,pt:`md`,children:(0,L.jsx)(dY,{})}),(0,L.jsx)(Ab.Panel,{value:`column-statistics`,pt:`md`,children:(0,L.jsx)(eY,{})}),(0,L.jsx)(Ab.Panel,{value:`array-padding`,pt:`md`,children:(0,L.jsx)(qJ,{})})]})]})})}function SY(){let e=Z(),[t,n]=(0,b.useState)(e.getProject()),[r,i]=(0,b.useState)(`Practitioner`),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)(),[d,f]=(0,b.useState)(),[p,m]=(0,b.useState)(!1),[h,g]=(0,b.useState)(void 0),_=(0,b.useCallback)(n=>{f(void 0);let r={resourceType:n.resourceType,firstName:n.firstName,lastName:n.lastName,email:n.email,sendEmail:n.sendEmail===`on`,accessPolicy:s,admin:n.isAdmin===`on`,scope:n.isProjectScoped===`on`?`project`:`server`,mfaRequired:n.mfaRequired===`on`,patient:n.resourceType===`RelatedPerson`?a:void 0};return e.invite(t?.id,r).then(t=>{e.invalidateSearches(`Patient`),e.invalidateSearches(`Practitioner`),e.invalidateSearches(`ProjectMembership`),mS(t)?u(t):g(t),m(r.sendEmail??!1),q({color:`green`,message:`Invite success`})}).catch(e=>{q({color:`red`,message:J(e)}),f(yS(e))})},[e,t,s,a]);return(0,L.jsxs)(NP,{onSubmit:_,children:[!h&&!l&&(0,L.jsxs)(W,{children:[(0,L.jsx)(K,{children:`Invite new member`}),d&&(0,L.jsx)(H,{c:`red`,"data-testid":`invite-error`,children:bS(d)}),e.isSuperAdmin()&&(0,L.jsx)(eL,{title:`Project`,htmlFor:`project`,outcome:d,children:(0,L.jsx)(jL,{resourceType:`Project`,name:`project`,defaultValue:t,onChange:n})}),(0,L.jsx)(Ig,{name:`resourceType`,label:`Role`,defaultValue:`Practitioner`,data:[`Practitioner`,`Patient`,`RelatedPerson`],onChange:e=>{i(e.currentTarget.value),o(void 0)},error:BF(d,`resourceType`)}),(0,L.jsx)(jb,{name:`firstName`,label:`First Name`,required:!0,autoFocus:!0,error:BF(d,`firstName`)}),(0,L.jsx)(jb,{name:`lastName`,label:`Last Name`,required:!0,error:BF(d,`lastName`)}),(0,L.jsx)(jb,{name:`email`,type:`email`,label:`Email`,required:!0,error:BF(d,`email`)}),r===`RelatedPerson`&&(0,L.jsx)(eL,{title:`Patient`,htmlFor:`patient`,outcome:d,children:(0,L.jsx)(jL,{resourceType:`Patient`,name:`patient`,placeholder:`Patient`,onChange:e=>o(e?DC(e):void 0)})}),(0,L.jsx)(eL,{title:`Access Policy`,htmlFor:`accessPolicy`,outcome:d,children:(0,L.jsx)(IJ,{name:`accessPolicy`,onChange:c})}),(0,L.jsx)(pp,{name:`sendEmail`,label:`Send email`,defaultChecked:!0}),(0,L.jsx)(pp,{name:`isAdmin`,label:`Admin`}),(0,L.jsx)(pp,{name:`isProjectScoped`,label:`Project scoped`}),(0,L.jsx)(pp,{name:`mfaRequired`,label:`MFA required`}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(PP,{children:`Invite`})})]}),l&&(0,L.jsxs)(`div`,{"data-testid":`email-failure`,children:[(0,L.jsx)(`p`,{children:`User created, email couldn't be sent`}),(0,L.jsx)(`p`,{children:bS(l)}),(0,L.jsxs)(`p`,{children:[`Click `,(0,L.jsx)(eN,{to:`/admin/project`,children:`here`}),` to return to the project admin page.`]})]}),h&&(0,L.jsxs)(`div`,{"data-testid":`success`,children:[(0,L.jsx)(H,{children:`User created`}),p&&(0,L.jsx)(H,{children:`Email sent`}),(0,L.jsxs)(Oh,{children:[(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:h,children:`Go to new membership`})}),(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:h.profile,children:`Go to new profile`})}),(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:`/admin/users`,children:`Back to users list`})})]})]})]})}function CY(e){let t=Z(),{enrolledMethods:n}=e,r=n&&!n.includes(`totp`)&&n.includes(`email`)?`email`:`totp`,[i,a]=(0,b.useState)(r),[o,s]=(0,b.useState)(!1);function c(e){return n!==void 0&&!n.includes(e)}function l(){s(!0),t.post(`admin/projects/${e.projectId}/members/${e.membershipId}/mfa/reset`,{method:i}).then(()=>{q({color:`green`,message:`Reset ${DJ[i]} MFA. The member has been emailed a notice.`}),e.onSuccess?.(),e.onClose()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1})).finally(()=>s(!1))}return(0,L.jsx)(pg,{opened:e.opened,onClose:e.onClose,title:`Reset MFA`,centered:!0,children:(0,L.jsx)(NP,{onSubmit:l,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(H,{size:`sm`,children:`Reset a multi-factor authentication factor for this member. Resetting the authenticator app rotates their secret so a lost device cannot be reused. Any other enrolled factors are left in place.`}),(0,L.jsx)(Wv.Group,{value:i,onChange:e=>a(e),label:`Factor to reset`,children:(0,L.jsxs)(W,{gap:`xs`,mt:`xs`,children:[(0,L.jsx)(Wv,{value:`totp`,label:DJ.totp,disabled:c(`totp`)}),(0,L.jsx)(Wv,{value:`email`,label:DJ.email,disabled:c(`email`)})]})}),(0,L.jsxs)(V,{justify:`flex-end`,children:[(0,L.jsx)(U,{variant:`default`,onClick:e.onClose,children:`Cancel`}),(0,L.jsx)(U,{type:`submit`,color:`red`,loading:o,disabled:c(i),children:`Reset MFA`})]})]})})})}function wY(e){let t=Z(),[n,r]=(0,b.useState)(!1);function i(){r(!0),t.post(`admin/projects/${e.projectId}/members/${e.membershipId}/resetpassword`,{}).then(()=>{q({color:`green`,message:`Password reset email sent.`}),e.onSuccess?.(),e.onClose()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1})).finally(()=>r(!1))}return(0,L.jsx)(pg,{opened:e.opened,onClose:e.onClose,title:`Send password reset email`,centered:!0,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(H,{size:`sm`,children:`Send this member an email with a single-use link to set a new password. Their current password remains valid until they complete the reset.`}),(0,L.jsxs)(V,{justify:`flex-end`,children:[(0,L.jsx)(U,{variant:`default`,onClick:e.onClose,children:`Cancel`}),(0,L.jsx)(U,{color:`blue`,loading:n,onClick:i,children:`Send email`})]})]})})}function TY(e){let t=Z(),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(!1);function o(){a(!0),t.post(`admin/projects/setpassword`,{email:e.email,password:n}).then(()=>{q({color:`green`,message:`Password updated.`}),r(``),e.onSuccess?.(),e.onClose()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1})).finally(()=>a(!1))}return(0,L.jsx)(pg,{opened:e.opened,onClose:e.onClose,title:`Set password`,centered:!0,children:(0,L.jsx)(NP,{onSubmit:o,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(H,{size:`sm`,children:`Set a new password for this member directly. They are not emailed. Use this only when a manual reset is required; otherwise prefer sending a password reset email.`}),(0,L.jsx)(_v,{label:`New password`,required:!0,minLength:8,value:n,onChange:e=>r(e.currentTarget.value),description:`At least 8 characters`}),(0,L.jsxs)(V,{justify:`flex-end`,children:[(0,L.jsx)(U,{variant:`default`,onClick:e.onClose,children:`Cancel`}),(0,L.jsx)(U,{type:`submit`,color:`red`,loading:i,disabled:n.length<8,children:`Set password`})]})]})})})}function EY(e){let{user:t}=e,n=OJ(t),[r,i]=wn(!1),[a,o]=wn(!1),[s,c]=wn(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{mt:`md`,children:`Account Security`}),(0,L.jsxs)(W,{gap:`sm`,children:[(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(H,{fw:500,size:`sm`,children:`MFA:`}),n.length>0?n.map(e=>(0,L.jsx)(Ip,{color:`green`,variant:`light`,children:DJ[e]},e)):(0,L.jsx)(Ip,{color:`gray`,variant:`light`,children:`Not enrolled`}),t.mfaRequired&&(0,L.jsx)(Ip,{color:`orange`,variant:`light`,children:`Required`})]}),!t.email&&(0,L.jsx)(jd,{color:`yellow`,children:`This member has no email address, so password reset emails cannot be sent.`}),(0,L.jsxs)(V,{children:[(0,L.jsx)(U,{variant:`outline`,color:`red`,onClick:i.open,disabled:n.length===0,children:`Reset MFA`}),(0,L.jsx)(U,{variant:`outline`,onClick:o.open,disabled:!t.email,children:`Send password reset email`}),(0,L.jsx)(U,{variant:`outline`,color:`red`,onClick:c.open,disabled:!t.email,children:`Set password`})]})]}),(0,L.jsx)(CY,{opened:r,onClose:i.close,projectId:e.projectId,membershipId:e.membershipId,enrolledMethods:n}),(0,L.jsx)(wY,{opened:a,onClose:o.close,projectId:e.projectId,membershipId:e.membershipId}),t.email&&(0,L.jsx)(TY,{opened:s,onClose:c.close,email:t.email})]})}function DY(e){return e.includes(`/admin/bots/`)?`/admin/bots`:e.includes(`/admin/clients/`)?`/admin/clients`:`/admin/users`}function OY(){let e=Z(),t=FK(),n=NK(),{membershipId:r}=zK(),i=EJ(e),a=e.getProjectMembership()?.admin,o=e.readResource(`ProjectMembership`,r).read(),s=eA(o.profile),c=eA(o.user?.reference?.startsWith(`User/`)?{reference:o.user.reference}:void 0),l=e.getProject()?.owner?.reference===o.user?.reference,u=DY(n.pathname),d=(0,b.useCallback)(()=>{window.confirm(`Are you sure you want to remove this user from the project?`)&&e.delete(`admin/projects/${i}/members/${r}`).then(()=>{e.invalidateSearches(`ProjectMembership`),t(u)?.catch(console.error)}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[e,i,r,t,u]);return s?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`ProjectMembership Details`}),(0,L.jsx)(eN,{to:o,children:`Go to ProjectMembership`}),(0,L.jsx)(KR,{value:o}),(0,L.jsx)(K,{mt:`md`,children:`Profile Details`}),(0,L.jsxs)(eN,{to:s,children:[`Go to `,s.resourceType]}),(0,L.jsx)(KR,{value:s,ignoreMissingValues:!0}),o.user?.reference?.startsWith(`User/`)&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{mt:`md`,children:`User Details`}),c?.project?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(eN,{to:`/User/${c.id}/email`,children:`Go to User (change login email)`}),(0,L.jsx)(KR,{value:c,ignoreMissingValues:!0})]}):(0,L.jsx)(jd,{color:`yellow`,children:`This User is server-scoped and cannot be viewed in this project.`})]}),a&&c?.project&&i&&(0,L.jsx)(EY,{projectId:i,membershipId:r,user:c}),a&&!l&&(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,children:(0,L.jsx)(U,{type:`button`,color:`red`,variant:`outline`,onClick:d,children:`Remove user`})})]}):(0,L.jsx)(GM,{})}function kY(){let e=Z(),t=e.isSuperAdmin(),n=EJ(e),[r,{open:i,close:a}]=wn(!1),[o,s]=(0,b.useState)(!t&&n?{reference:`Project/${n}`}:void 0),[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)(`loading`),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(0),g=o?.reference,_=g?.split(`/`)[1];(0,b.useEffect)(()=>{if(!c?.id){d(`loading`);return}let t=!1;return d(`loading`),e.readResource(`User`,c.id).then(e=>{t||d(e.meta?.project&&e.meta.project===_?`project`:`server`)}).catch(()=>{t||d(`server`)}),()=>{t=!0}},[e,c,_]);let v;u===`project`?v=`server`:u===`server`&&t&&(v=`project`);let y=!!(g&&c?.id&&v);function x(){y&&i()}function S(){if(!c?.id||!v)return;p(!0);let t={resourceType:`Parameters`,parameter:[{name:`scope`,valueCode:v}]};v===`project`&&o&&t.parameter?.push({name:`project`,valueReference:o}),e.post(e.fhirUrl(`User`,c.id,`$rescope`),t).then(()=>{q({color:`green`,message:`User rescoped successfully`}),e.invalidateSearches(`User`),l(void 0),h(e=>e+1),a()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1})).finally(()=>p(!1))}let C=o?.display??g??`(no project selected)`,w=g?{"_has:ProjectMembership:user:project":g}:void 0,T=c?jY(c):void 0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{order:2,children:`Rescope User`}),(0,L.jsxs)(`p`,{children:[`Move a User between `,(0,L.jsx)(`strong`,{children:`server`}),` scope (not tied to any Project) and `,(0,L.jsx)(`strong`,{children:`project`}),` scope (owned by a specific Project).`,` `,t?`Selecting a project-scoped User releases them to the server; selecting a server-scoped User assigns them to the chosen Project.`:`Project admins may release a project-scoped User in this Project to server scope. Re-assigning a User to a Project requires a super admin.`]}),(0,L.jsx)(NP,{onSubmit:x,children:(0,L.jsxs)(W,{children:[t&&(0,L.jsx)(eL,{title:`Project (required)`,htmlFor:`rescopeTargetProject`,children:(0,L.jsx)(ML,{name:`rescopeTargetProject`,placeholder:`Select a Project`,targetTypes:[`Project`],onChange:e=>{s(e),l(void 0),h(e=>e+1)}})}),(0,L.jsx)(eL,{title:`User (search by email; filtered to members of the selected Project)`,htmlFor:`rescopeTargetUser`,children:(0,L.jsx)(jL,{name:`rescopeTargetUser`,resourceType:`User`,placeholder:g?`Search by email`:`Select a Project first`,disabled:!g,searchCriteria:w,onChange:e=>l(e??void 0)},m)}),c&&(0,L.jsxs)(V,{gap:`sm`,children:[(0,L.jsx)(H,{children:T}),AY(u)]}),c&&u===`server`&&!t&&(0,L.jsxs)(jd,{color:`yellow`,children:[`This User is in `,(0,L.jsx)(`strong`,{children:`server`}),` scope. Only a super admin can assign a server-scoped User to a Project.`]}),(0,L.jsx)(`div`,{children:(0,L.jsx)(U,{type:`submit`,disabled:!y,children:v===`project`?`Assign User to Project`:`Release User to Server`})})]})}),(0,L.jsx)(pg,{opened:r,onClose:a,title:`Confirm User Rescope`,centered:!0,size:`auto`,children:(0,L.jsxs)(W,{children:[(0,L.jsxs)(H,{children:[`You are about to change the scope of `,(0,L.jsxs)(`strong`,{children:[`User/`,c?.id]}),`.`]}),v===`server`?(0,L.jsxs)(H,{children:[`This will `,(0,L.jsx)(`strong`,{children:`release`}),` the User from project `,(0,L.jsx)(`strong`,{children:C}),` to`,` `,(0,L.jsx)(`strong`,{children:`server`}),` scope. Any existing ProjectMemberships will be left in place and may be left orphaned.`]}):(0,L.jsxs)(H,{children:[`This will `,(0,L.jsx)(`strong`,{children:`assign`}),` the User to project `,(0,L.jsx)(`strong`,{children:C}),`. The User will become a project-scoped resource belonging to that Project.`]}),v===`server`&&!t&&(0,L.jsxs)(jd,{color:`red`,title:`This change cannot be reversed by a project admin`,children:[(0,L.jsx)(`strong`,{children:`You will need the help of a super admin to reverse this change.`}),` Once the User is released to server scope, only a super admin can re-assign the User back to this (or any) Project.`]}),(0,L.jsx)(H,{c:`red`,children:`This is a privileged operation. Double-check the User and target before continuing.`}),(0,L.jsxs)(V,{justify:`flex-end`,children:[(0,L.jsx)(U,{variant:`default`,onClick:a,disabled:f,children:`Cancel`}),(0,L.jsx)(U,{color:`red`,onClick:S,loading:f,children:`Confirm Rescope`})]})]})})]})}function AY(e){return e===`loading`?(0,L.jsx)(Py,{height:22,width:70,radius:`xl`}):e===`project`?(0,L.jsx)(Ip,{color:`blue`,variant:`light`,children:`Project`}):(0,L.jsx)(Ip,{color:`gray`,variant:`light`,children:`Server`})}function jY(e){let t;if(e.firstName||e.lastName){let n={family:e.lastName};e.firstName&&(n.given=[e.firstName]),t=jw(n)}return t&&e.email?`${t} (${e.email})`:t??e.email??`User/${e.id}`}function MY(){let e=Z();if(!e.isLoading()&&!e.isProjectAdmin())return(0,L.jsx)(oI,{outcome:lS});function t(t){e.post(`admin/projects/setpassword`,t).then(()=>q({color:`green`,message:`Done`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}return(0,L.jsxs)(LF,{width:600,children:[(0,L.jsx)(K,{order:1,children:`Project Admin`}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Force Set Password`}),(0,L.jsx)(H,{children:`Sets the password for the specified user in this project.`}),(0,L.jsx)(H,{children:`This action can only be performed by project administrators. Passwords can only be set for users scoped in this project.`}),(0,L.jsx)(NP,{onSubmit:t,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(jb,{name:`email`,label:`Email`,required:!0}),(0,L.jsx)(zF,{name:`password`,label:`Password`,required:!0}),(0,L.jsx)(U,{type:`submit`,children:`Force Set Password`})]})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(kY,{})]})}function NY(){let e=Z(),t=EJ(e),n=e.get(`admin/projects/${t}`).read();return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`Details`}),(0,L.jsxs)(DF,{children:[(0,L.jsx)(OF,{term:`ID`,children:n.project.id}),(0,L.jsx)(OF,{term:`Name`,children:n.project.name})]})]})}var PY=[{label:`Details`,value:`details`},{label:`Users`,value:`users`},{label:`Clients`,value:`clients`},{label:`Bots`,value:`bots`},{label:`Secrets`,value:`secrets`},{label:`Settings`,value:`settings`},{label:`Sites`,value:`sites`},{label:`Rate Limits`,value:`rate-limits`}];function FY(){let e=Z(),t=EJ(e),n=(0,b.useMemo)(()=>e.get(`admin/projects/`+t).read(),[e,t]);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Cl,{children:[(0,L.jsx)(ZB,{children:(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(ZB.Key,{children:`Project`}),(0,L.jsx)(ZB.Value,{children:n.project.name})]})}),(0,L.jsx)(ml,{children:(0,L.jsx)(tV,{baseUrl:`/admin`,tabs:PY})})]}),(0,L.jsx)(PF,{maw:`100%`,children:(0,L.jsx)(IF,{children:(0,L.jsx)(hq,{})})})]})}function IY(e,t){return e?.find(e=>e.name===t)?.valueString}function LY(e,t){return e?.find(e=>e.name===t)?.valueInteger}function RY(e,t){return e?.find(e=>e.name===t)?.valueReference}function zY(e){let t=e.parameter?.find(e=>e.name===`project`);return{project:{id:IY(t?.part,`id`)??``,limit:LY(t?.part,`limit`),consumedPoints:LY(t?.part,`consumedPoints`),remainingPoints:LY(t?.part,`remainingPoints`),msBeforeReset:LY(t?.part,`msBeforeReset`)},memberships:(e.parameter?.filter(e=>e.name===`membership`)??[]).map(e=>({membershipId:IY(e.part,`membershipId`)??``,profile:RY(e.part,`profile`),limit:LY(e.part,`limit`),consumedPoints:LY(e.part,`consumedPoints`),remainingPoints:LY(e.part,`remainingPoints`),msBeforeReset:LY(e.part,`msBeforeReset`)}))}}function BY(e){if(e.limit!==void 0&&e.consumedPoints!==void 0)return e.limit===0?0:e.consumedPoints/e.limit*100}function VY(e){return e>=90?`red`:e>=70?`yellow`:`green`}function HY(e){if(e===void 0)return`--`;let t=Math.ceil(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function UY(e){return e===void 0?`--`:e.toLocaleString()}function WY(e){let t=BY(e);return t===void 0?`--`:`${t.toFixed(1)}%`}var GY=`https://www.medplum.com/docs/api/fhir/operations/project-rate-limits`;function KY(){let e=Z(),t=EJ(e),[n,r]=(0,b.useState)(),[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(`desc`),c=(0,b.useCallback)(()=>{a(!0),e.get(e.fhirUrl(`Project`,t,`$rate-limits`),{cache:`no-cache`}).then(e=>{r(zY(e))}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})}).finally(()=>{a(!1)})},[e,t]),l=(0,b.useCallback)(()=>{s(e=>e===`desc`?`asc`:`desc`)},[]),u=(0,b.useMemo)(()=>n?[...n.memberships].sort((e,t)=>{let n=BY(e)??-1,r=BY(t)??-1;return o===`desc`?r-n:n-r}):[],[n,o]);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(V,{justify:`space-between`,mb:`md`,children:[(0,L.jsx)(K,{children:`Rate Limits`}),(0,L.jsxs)(V,{children:[(0,L.jsx)(Rd,{href:GY,target:`_blank`,rel:`noopener noreferrer`,size:`sm`,children:`$rate-limits documentation`}),(0,L.jsx)(U,{leftSection:(0,L.jsx)(SM,{size:14}),loading:i,onClick:c,children:`Refresh`})]})]}),!n&&!i&&(0,L.jsx)(H,{c:`dimmed`,children:`Click Refresh to load current rate limit data.`}),n&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(qY,{project:n.project}),u.length===0?(0,L.jsx)(H,{c:`dimmed`,mt:`md`,children:`No membership rate limit data found.`}):(0,L.jsx)(JY,{memberships:u,sortDirection:o,onToggleSort:l})]})]})}function qY({project:e}){let t=BY(e);return(0,L.jsxs)(`div`,{style:{marginBottom:`1rem`},children:[(0,L.jsx)(K,{order:4,mb:`xs`,children:`Project Utilization`}),t===void 0?(0,L.jsx)(H,{c:`dimmed`,size:`sm`,children:`No project-level rate limit data recorded yet.`}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(V,{gap:`xl`,mb:`xs`,children:[(0,L.jsxs)(H,{size:`sm`,children:[(0,L.jsx)(`strong`,{children:`Consumed:`}),` `,UY(e.consumedPoints),` / `,UY(e.limit)]}),(0,L.jsxs)(H,{size:`sm`,children:[(0,L.jsx)(`strong`,{children:`Remaining:`}),` `,UY(e.remainingPoints)]}),(0,L.jsxs)(H,{size:`sm`,children:[(0,L.jsx)(`strong`,{children:`Utilization:`}),` `,WY(e)]}),(0,L.jsxs)(H,{size:`sm`,children:[(0,L.jsx)(`strong`,{children:`Resets in:`}),` `,HY(e.msBeforeReset)]})]}),(0,L.jsx)(Ev,{value:t,color:VY(t),size:`lg`})]})]})}function JY({memberships:e,sortDirection:t,onToggleSort:n}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{order:4,mt:`lg`,mb:`xs`,children:`Membership Utilization`}),(0,L.jsxs)(G,{striped:!0,highlightOnHover:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Membership ID`}),(0,L.jsx)(G.Th,{children:`Profile`}),(0,L.jsx)(G.Th,{children:`Limit`}),(0,L.jsx)(G.Th,{children:`Consumed`}),(0,L.jsx)(G.Th,{children:`Remaining`}),(0,L.jsx)(G.Th,{children:(0,L.jsxs)(vl,{onClick:n,style:{fontWeight:700,display:`flex`,alignItems:`center`,gap:4},children:[`Utilization`,t===`desc`?(0,L.jsx)(hj,{size:14}):(0,L.jsx)(gj,{size:14})]})}),(0,L.jsx)(G.Th,{children:`Resets In`})]})}),(0,L.jsx)(G.Tbody,{children:e.map(e=>(0,L.jsx)(YY,{membership:e},e.membershipId))})]})]})}function YY({membership:e}){let t=FK(),n=BY(e);return(0,L.jsxs)(G.Tr,{onClick:()=>t(`/admin/users/${e.membershipId}`),style:{cursor:`pointer`},children:[(0,L.jsx)(G.Td,{children:e.membershipId}),(0,L.jsx)(G.Td,{children:(0,L.jsx)(uR,{value:e.profile})}),(0,L.jsx)(G.Td,{children:UY(e.limit)}),(0,L.jsx)(G.Td,{children:UY(e.consumedPoints)}),(0,L.jsx)(G.Td,{children:UY(e.remainingPoints)}),(0,L.jsx)(G.Td,{children:n===void 0?`--`:(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(Ev,{value:n,color:VY(n),size:`sm`,style:{flex:1,minWidth:60}}),(0,L.jsxs)(H,{size:`sm`,w:50,ta:`right`,children:[n.toFixed(1),`%`]})]})}),(0,L.jsx)(G.Td,{children:HY(e.msBeforeReset)})]})}function XY(){let e=Z(),t=EJ(e),n=e.get(`admin/projects/${t}`).read(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)();return(0,b.useEffect)(()=>{e.requestSchema(`Project`).then(()=>i(!0)).catch(console.log)},[e]),(0,b.useEffect)(()=>{n&&o(ew(n.project.secret||[]))},[e,n]),!r||!a?(0,L.jsx)(`div`,{children:`Loading...`}):(0,L.jsxs)(`form`,{noValidate:!0,autoComplete:`off`,onSubmit:n=>{n.preventDefault(),e.post(`admin/projects/${t}/secrets`,a).then(()=>e.get(`admin/projects/${t}`,{cache:`reload`})).then(()=>q({color:`green`,message:`Saved`})).catch(console.log)},children:[(0,L.jsx)(K,{children:`Project Secrets`}),(0,L.jsx)(`p`,{children:`Use project secrets to store sensitive information such as API keys or other access credentials.`}),(0,L.jsx)(YL,{property:uT(`Project`,`secret`),name:`secret`,path:`Project.secret`,defaultValue:a,onChange:o,outcome:void 0}),(0,L.jsx)(U,{type:`submit`,children:`Save`})]})}function ZY(){let e=Z(),t=EJ(e),n=e.get(`admin/projects/${t}`).read(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)();return(0,b.useEffect)(()=>{e.requestSchema(`Project`).then(()=>i(!0)).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[e]),(0,b.useEffect)(()=>{n&&o(ew(n.project.setting||[]))},[e,n]),!r||!a?(0,L.jsx)(`div`,{children:`Loading...`}):(0,L.jsxs)(`form`,{noValidate:!0,autoComplete:`off`,onSubmit:n=>{n.preventDefault(),e.post(`admin/projects/${t}/settings`,a).then(()=>e.get(`admin/projects/${t}`,{cache:`reload`})).then(()=>q({color:`green`,message:`Saved`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},children:[(0,L.jsx)(K,{children:`Project Settings`}),(0,L.jsxs)(`p`,{children:[`Use project settings to store non-sensitive configuration visible to all project users. For example, set "aiModels" to a JSON array of `,`{ "value", "label" }`,` objects to control the models available in the Spaces AI assistant.`]}),(0,L.jsx)(YL,{property:uT(`Project`,`setting`),name:`setting`,path:`Project.setting`,defaultValue:a,onChange:o,outcome:void 0}),(0,L.jsx)(U,{type:`submit`,children:`Save`})]})}function QY(){let e=Z(),t=EJ(e),n=e.get(`admin/projects/${t}`).read(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)();return(0,b.useEffect)(()=>{e.requestSchema(`Project`).then(()=>i(!0)).catch(console.log)},[e]),(0,b.useEffect)(()=>{n&&o(ew(n.project.site||[]))},[e,n]),!r||!a?(0,L.jsx)(`div`,{children:`Loading...`}):(0,L.jsxs)(`form`,{noValidate:!0,autoComplete:`off`,onSubmit:n=>{n.preventDefault(),e.post(`admin/projects/${t}/sites`,a).then(()=>e.get(`admin/projects/${t}`,{cache:`reload`})).then(()=>q({color:`green`,message:`Saved`})).catch(e=>{let t=yS(e);q({color:`red`,message:`Error ${t.issue?.[0].details?.text} ${t.issue?.[0].expression?.[0]}`,autoClose:!1})})},children:[(0,L.jsx)(K,{children:`Project Sites`}),(0,L.jsx)(`p`,{children:`Use project sites configure your project on a separate domain.`}),(0,L.jsx)(YL,{property:uT(`Project`,`site`),name:`site`,path:`Project.site`,defaultValue:a,onChange:o,outcome:void 0}),(0,L.jsx)(U,{type:`submit`,children:`Save`})]})}var $Y=[{label:`Post-deploy Migrations`,value:`migrations`},{label:`System AsyncJob`,value:`asyncjob`}];function eX(){let e=Z();return!e.isLoading()&&!e.isSuperAdmin()?(0,L.jsx)(oI,{outcome:lS}):(0,L.jsx)(PF,{miw:`1600`,maw:`2000`,children:(0,L.jsxs)(IF,{children:[(0,L.jsx)(K,{order:1,children:`AsyncJob Dashboard`}),(0,L.jsxs)(tV,{baseUrl:`/admin/super/asyncjob`,tabs:$Y,keepMounted:!1,children:[(0,L.jsx)(Ab.Panel,{value:`asyncjob`,pt:`md`,children:(0,L.jsx)(nX,{})}),(0,L.jsx)(Ab.Panel,{value:`migrations`,pt:`md`,children:(0,L.jsx)(iX,{})})]})]})})}var tX={resourceType:`AsyncJob`,fields:[`id`,`_lastUpdated`,`request`,`status`,`type`],filters:[{code:`_project`,operator:X.MISSING,value:`true`}],sortRules:[{code:`_lastUpdated`,descending:!0}]};function nX(){let e=FK(),[t]=(0,b.useState)(tX);return(0,L.jsxs)(W,{children:[(0,L.jsx)(eN,{to:`/${t.resourceType}/${FE(t)}`,children:`Show in search page`}),(0,L.jsx)(zB,{checkboxesEnabled:!1,search:t,onClick:t=>e(oX(t.resource))?.catch(console.error),onAuxClick:e=>window.open(oX(e.resource),`_blank`)})]})}var rX={resourceType:`AsyncJob`,fields:[`id`,`_lastUpdated`,`request`,`status`,`type`],filters:[{code:`_project`,operator:X.MISSING,value:`true`},{code:`type`,operator:X.EQUALS,value:`data-migration`}],count:1e3,sortRules:[{code:`_lastUpdated`,descending:!0}]};function iX(){let e=Z(),[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(),[a,o]=(0,b.useState)([]),[s,c]=(0,b.useState)(0),[l,u]=(0,b.useState)([]);(0,b.useEffect)(()=>{let t=`info`;u(e=>e.includes(t)?e:[...e,t]),e.get(`admin/super/migrations`,{cache:`no-cache`}).then(e=>{e.postDeployMigrations.sort((e,t)=>t-e),n(e)}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})}).finally(()=>u(e=>e.filter(e=>e!==t)))},[e,s]),(0,b.useEffect)(()=>{let t=`jobs`;u(e=>e.includes(t)?e:[...e,t]),e.requestSchema(`AsyncJob`).then(()=>e.search(`AsyncJob`,FE({...rX,total:`accurate`,fields:void 0}),{cache:`no-cache`}).then(e=>{i(e.entry?.map(e=>e.resource))})).catch(e=>{i(void 0),q({color:`red`,message:J(e),autoClose:!1})}).finally(()=>u(e=>e.filter(e=>e!==t)))},[e,s]);function d(){c(e=>e+1)}function f(t){rY(e,`Run pending post-deploy migration`,`admin/super/migrate`,{dataVersion:t}).finally(()=>{d()}).catch(()=>{}),d()}let p=l.length>0;function m(e,{isLoading:t}){return(0,L.jsxs)(`div`,{style:{position:`relative`},children:[(0,L.jsx)(Mh,{visible:t}),(0,L.jsxs)(G,{children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Version`}),(0,L.jsx)(G.Th,{children:`Action`}),(0,L.jsx)(G.Th,{children:`Status`}),(0,L.jsx)(G.Th,{children:`AsyncJob`}),(0,L.jsx)(G.Th,{children:`Last Updated`}),(0,L.jsx)(G.Th,{children:`Request Time`}),(0,L.jsx)(G.Th,{children:`Duration`}),(0,L.jsx)(G.Th,{children:`Attempts`})]})}),(0,L.jsx)(G.Tbody,{children:e()})]})]})}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(U,{size:`xs`,mb:`xs`,variant:`subtle`,leftSection:(0,L.jsx)(SM,{size:14}),onClick:d,loading:p,children:`Refresh`}),m(()=>{if(!p){if(!t)return(0,L.jsx)(G.Tr,{children:(0,L.jsx)(G.Td,{colSpan:6,children:`Failed to load migration info`})});if(!r)return(0,L.jsx)(G.Tr,{children:(0,L.jsx)(G.Td,{colSpan:6,children:`Failed to load async jobs`})})}return!t||!r?null:t.postDeployMigrations?.map(e=>{let{status:n,asyncJob:i,asyncJobs:s}=aX(e,r??[],t?.pendingPostDeployMigration),c=a.includes(e),l=e===t?.pendingPostDeployMigration&&(!i||i?.status===`error`),u=[(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:e}),(0,L.jsx)(G.Td,{children:l&&(0,L.jsx)(U,{color:`green`,size:`xs`,onClick:()=>f(e),children:`Start`})}),(0,L.jsx)(G.Td,{children:n}),(0,L.jsx)(G.Td,{children:i&&(0,L.jsx)(eN,{to:`/AsyncJob/${i?.id}`,children:i?.id})}),(0,L.jsx)(G.Td,{children:i?.meta?.lastUpdated}),(0,L.jsx)(G.Td,{children:i?.requestTime}),(0,L.jsx)(G.Td,{children:sX(i)}),(0,L.jsx)(G.Td,{display:`flex`,children:(0,L.jsxs)(V,{gap:`xs`,children:[s.length?s.length:``,c&&s.length>1&&(0,L.jsx)(U,{leftSection:(0,L.jsx)(fM,{size:14}),variant:`subtle`,color:`blue`,size:`xs`,radius:`xs`,onClick:()=>o(t=>t.includes(e)?t.filter(t=>t!==e):t),children:`Hide all`}),!c&&s.length>1&&(0,L.jsx)(U,{leftSection:(0,L.jsx)(bM,{size:14}),variant:`subtle`,color:`blue`,size:`xs`,radius:`xs`,onClick:()=>o(t=>t.includes(e)?t:[...t,e]),children:`Show all`})]})})]},e)];return c&&u.push(...s.filter(e=>e.id!==i?.id).map(t=>(0,L.jsxs)(G.Tr,{bg:`gray.1`,children:[(0,L.jsx)(G.Td,{children:e}),(0,L.jsx)(G.Td,{}),(0,L.jsx)(G.Td,{children:t.status}),(0,L.jsx)(G.Td,{children:(0,L.jsx)(eN,{to:`/AsyncJob/${t.id}`,children:t.id})}),(0,L.jsx)(G.Td,{children:t.meta?.lastUpdated}),(0,L.jsx)(G.Td,{children:t.requestTime}),(0,L.jsx)(G.Td,{children:sX(t)}),(0,L.jsx)(G.Td,{})]},t.id))),u})},{isLoading:p})]})}function aX(e,t,n){let r=t.filter(t=>t.dataVersion===e),i=r.find(e=>e.status===`completed`)??r[0],a;return a=n===0?i?.status??`completed`:e>n?i?.status??`pending`:e===n?i?.status??`next`:i?.status??`completed`,{status:a,asyncJob:i,asyncJobs:r}}function oX(e){return`/${e.resourceType}/${e.id}`}function sX(e){let t=e?.requestTime,n=e?.transactionTime??e?.meta?.lastUpdated;if(!t||!n)return``;let r=new Date(t),i=new Date(n).getTime()-r.getTime();if(i<1e3)return`${i.toFixed(0)}ms`;let a=i/1e3;return a<60?`${a.toFixed(2)}s`:a<3600?`${(a/60).toFixed(2)}m`:`${(a/3600).toFixed(2)}h`}function cX(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function lX({entry:e}){return(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:(0,L.jsxs)(`div`,{style:{paddingLeft:50},children:[(0,L.jsxs)(H,{size:`xs`,c:`dimmed`,children:[`Subscription: `,(0,L.jsx)(RI,{value:{reference:`Subscription/${e.subscriptionId}`}})]}),(0,L.jsxs)(H,{size:`xs`,c:`dimmed`,children:[`Author:`,` `,(0,L.jsx)(eN,{to:{reference:e.author},children:(0,L.jsx)(uR,{value:{reference:e.author}})})]}),e.expiration?(0,L.jsxs)(H,{size:`xs`,c:`dimmed`,children:[`Expires at:`,` `,new Date(e.expiration*1e3).toLocaleString(void 0,{timeZoneName:`short`})]}):null]})}),(0,L.jsx)(G.Td,{})]},e.subscriptionId)}function uX({criteria:e,expanded:t,onToggle:n}){return(0,L.jsxs)(b.Fragment,{children:[(0,L.jsxs)(G.Tr,{onClick:n,style:{cursor:`pointer`},children:[(0,L.jsx)(G.Td,{children:(0,L.jsxs)(V,{gap:`xs`,pl:`xl`,children:[(0,L.jsx)(H,{size:`xs`,children:t?`▼`:`▶`}),(0,L.jsx)(H,{size:`sm`,c:`dimmed`,children:e.criteria})]})}),(0,L.jsx)(G.Td,{children:e.count})]}),t&&e.entries?.map(e=>(0,L.jsx)(lX,{entry:e},e.subscriptionId))]})}function dX({projectId:e,rt:t,rtDetail:n,isLoading:r,expanded:i,expandedCriteria:a,onToggle:o,onToggleCriteria:s}){let c=`${e}:${t.resourceType}`;return(0,L.jsxs)(b.Fragment,{children:[(0,L.jsxs)(G.Tr,{onClick:o,style:{cursor:`pointer`},children:[(0,L.jsx)(G.Td,{children:(0,L.jsxs)(V,{gap:`xs`,pl:`md`,children:[(0,L.jsx)(H,{size:`xs`,children:i?`▼`:`▶`}),(0,L.jsx)(H,{children:t.resourceType})]})}),(0,L.jsx)(G.Td,{children:t.count})]}),i&&(0,L.jsxs)(L.Fragment,{children:[r&&!n&&(0,L.jsx)(G.Tr,{children:(0,L.jsx)(G.Td,{colSpan:2,children:(0,L.jsx)(H,{pl:`xl`,size:`sm`,c:`dimmed`,children:`Loading...`})})}),n?.criteria.map(e=>{let t=`${c}:${e.criteria}`;return(0,L.jsx)(uX,{criteria:e,expanded:a.has(t),onToggle:()=>s(t)},t)})]})]})}function fX({project:e,expanded:t,expandedResourceTypes:n,expandedCriteria:r,projectDetail:i,isLoadingDetail:a,onToggle:o,onToggleResourceType:s,onToggleCriteria:c}){return(0,L.jsxs)(b.Fragment,{children:[(0,L.jsxs)(G.Tr,{onClick:o,style:{cursor:`pointer`},children:[(0,L.jsx)(G.Td,{children:(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(H,{size:`xs`,children:t?`▼`:`▶`}),(0,L.jsx)(RI,{value:{reference:`Project/${e.projectId}`,display:e.projectName}})]})}),(0,L.jsx)(G.Td,{children:e.subscriptionCount})]}),t&&e.resourceTypes.map(t=>{let o=`${e.projectId}:${t.resourceType}`;return(0,L.jsx)(dX,{projectId:e.projectId,rt:t,rtDetail:i?.find(e=>e.resourceType===t.resourceType),isLoading:a,expanded:n.has(o),expandedCriteria:r,onToggle:()=>s(e.projectId,t.resourceType),onToggleCriteria:c},o)})]})}function pX(){let e=Z(),[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(!1),[a,{open:o,close:s}]=wn(!1),[c,l]=(0,b.useState)(new Set),[u,d]=(0,b.useState)(new Set),[f,p]=(0,b.useState)(new Set),[m,h]=(0,b.useState)(new Map),[g,_]=(0,b.useState)(new Map);function v(){i(!0),e.get(`fhir/R4/$get-ws-sub-stats`,{cache:`no-cache`}).then(e=>{let t=e.parameter?.find(e=>e.name===`stats`)?.valueString;if(t){let e=JSON.parse(t);n(e.projects)}o()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1})).finally(()=>i(!1))}function y(t,n){let r=`${t}:${n}`;m.has(t)||(_(e=>new Map(e).set(t,!0)),e.get(`fhir/R4/$get-ws-sub-project-stats?projectId=${encodeURIComponent(t)}`,{cache:`no-cache`}).then(e=>{let n=e.parameter?.find(e=>e.name===`stats`)?.valueString;if(n){let e=JSON.parse(n);h(n=>new Map(n).set(t,e.resourceTypes))}}).catch(e=>q({color:`red`,message:J(e),autoClose:!1})).finally(()=>_(e=>{let n=new Map(e);return n.delete(t),n}))),d(e=>cX(e,r))}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(U,{onClick:v,loading:r,children:`Get WS Sub Stats`}),(0,L.jsxs)(pg,{opened:a,onClose:s,title:`WebSocket Subscription Stats`,size:`xl`,centered:!0,children:[!t?.length&&(0,L.jsx)(H,{children:`No active WebSocket subscriptions found.`}),t&&t.length>0&&(0,L.jsxs)(G,{striped:!0,highlightOnHover:!0,withTableBorder:!0,withColumnBorders:!0,tabularNums:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Project / Resource Type / Criteria`}),(0,L.jsx)(G.Th,{children:`Count`})]})}),(0,L.jsx)(G.Tbody,{children:t.map(e=>(0,L.jsx)(fX,{project:e,expanded:c.has(e.projectId),expandedResourceTypes:u,expandedCriteria:f,projectDetail:m.get(e.projectId),isLoadingDetail:g.get(e.projectId)===!0,onToggle:()=>l(t=>cX(t,e.projectId)),onToggleResourceType:y,onToggleCriteria:e=>p(t=>cX(t,e))},e.projectId))})]})]})]})}function mX(){let e=Z(),[t,{open:n,close:r}]=wn(!1),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)();if(!e.isLoading()&&!e.isSuperAdmin())return(0,L.jsx)(oI,{outcome:lS});function u(){iY(e,`Rebuilding Structure Definitions`,`admin/super/structuredefinitions`)}function d(){iY(e,`Rebuilding Search Parameters`,`admin/super/searchparameters`)}function f(){iY(e,`Rebuilding Value Sets`,`admin/super/valuesets`)}function p(t){iY(e,`Reindexing Resources`,`admin/super/reindex`,t)}function m(){iY(e,`Reload Cron Resources`,`admin/super/reloadcron`)}function h(){r();let t=kC(c);e.post(`fhir/R4/$clear-all-ws-subs`,t?{resourceType:`Parameters`,parameter:[{name:`projectId`,valueString:t}]}:void 0).then(()=>q({color:`green`,message:`Done`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1})),l(void 0)}function g(t){e.post(`admin/super/removebotidjobsfromqueue`,t).then(()=>q({color:`green`,message:`Done`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}function _(t){e.post(`admin/super/purge`,{...t,before:fL(t.before)}).then(()=>q({color:`green`,message:`Done`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}function v(t){e.post(`admin/super/setpassword`,t).then(()=>q({color:`green`,message:`Done`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}function y(t){e.post(`fhir/R4/$db-stats`,t.tableNames?{resourceType:`Parameters`,parameter:[{name:`tableNames`,valueString:t.tableNames}]}:void 0).then(e=>{let t=e.parameter?.find(e=>e.name===`tableString`)?.valueString??``;a(`Database Stats`),s((0,L.jsxs)(W,{children:[(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(dm,{value:t,children:({copied:e,copy:t})=>(0,L.jsx)(U,{variant:`light`,size:`xs`,color:e?`teal`:`blue`,onClick:t,children:e?`Copied`:`Copy to clipboard`})})}),(0,L.jsx)(`pre`,{children:t})]})),n()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}function x(){e.post(`fhir/R4/$db-invalid-indexes`).then(e=>{a(`Database Invalid Indexes`),s((0,L.jsx)(`pre`,{children:e.parameter?.filter(e=>e.name===`invalidIndex`).map(e=>e.valueString).join(`
|
|
221
|
-
`)})),n()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}function S(){e.post(`fhir/R4/$db-schema-diff`).then(e=>{a(`Schema Diff`),s((0,L.jsx)(`pre`,{children:e.parameter?.find(e=>e.name===`migrationString`)?.valueString})),n()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}function C(){iY(e,`Reconcile Schema Diff`,`admin/super/reconcile-db-schema-drift`)}function w(t){iY(e,`Rebuilding indexes`,`admin/super/rebuild-index`,{targets:t})}return(0,L.jsxs)(LF,{width:600,children:[(0,L.jsx)(K,{order:1,children:`Super Admin`}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Structure Definitions`}),(0,L.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.`}),(0,L.jsx)(NP,{children:(0,L.jsx)(U,{onClick:u,children:`Rebuild StructureDefinitions`})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Search Parameters`}),(0,L.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.`}),(0,L.jsx)(NP,{children:(0,L.jsx)(U,{onClick:d,children:`Rebuild SearchParameters`})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Value Sets`}),(0,L.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.`}),(0,L.jsx)(NP,{children:(0,L.jsx)(U,{onClick:f,children:`Rebuild ValueSets`})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Reindex Resources`}),(0,L.jsx)(`p`,{children:`When Medplum changes how resources are indexed, the system may require a reindex for old resources to be indexed properly.`}),(0,L.jsx)(_X,{onSubmit:p}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Purge Resources`}),(0,L.jsx)(`p`,{children:`As system generated resources accumulate, the system may require a purge to remove old resources.`}),(0,L.jsx)(NP,{onSubmit:_,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Purge Resource Type`,htmlFor:`purgeResourceType`,children:(0,L.jsx)(Ig,{id:`purgeResourceType`,name:`resourceType`,data:[``,`AuditEvent`,`Login`]})}),(0,L.jsx)(eL,{title:`Purge Before`,htmlFor:`before`,children:(0,L.jsx)(pL,{name:`before`,placeholder:`Before Date`})}),(0,L.jsx)(U,{type:`submit`,children:`Purge`})]})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Remove Bot ID Jobs from Queue`}),(0,L.jsx)(`p`,{children:`Remove all queued jobs for a Bot ID`}),(0,L.jsx)(NP,{onSubmit:g,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Bot ID`,children:(0,L.jsx)(jb,{name:`botId`,placeholder:`Bot Id`})}),(0,L.jsx)(U,{type:`submit`,children:`Remove Jobs by Bot ID`})]})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Force Set Password`}),(0,L.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.`}),(0,L.jsx)(NP,{onSubmit:v,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(jb,{name:`email`,label:`Email`,required:!0}),(0,L.jsx)(zF,{name:`password`,label:`Password`,required:!0}),(0,L.jsx)(jb,{name:`projectId`,label:`Project ID`}),(0,L.jsx)(U,{type:`submit`,children:`Force Set Password`})]})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Database Stats`}),(0,L.jsx)(`p`,{children:`Query current table statistics from the database.`}),(0,L.jsx)(NP,{onSubmit:y,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Table Names (comma-delimited)`,htmlFor:`tableNames`,children:(0,L.jsx)(jb,{id:`tableNames`,name:`tableNames`,placeholder:`Observation,Observation_History`})}),(0,L.jsx)(U,{type:`submit`,children:`Get Database Stats`})]})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Database Invalid Indexes`}),(0,L.jsx)(`p`,{children:`Query invalid indexes from the database.`}),(0,L.jsx)(NP,{onSubmit:x,children:(0,L.jsx)(W,{children:(0,L.jsx)(U,{type:`submit`,children:`Get Database Invalid Indexes`})})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Database Schema Drift`}),(0,L.jsx)(`p`,{children:`Show the schema migration needed to match the expected database schema.`}),(0,L.jsxs)(km,{children:[(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(NP,{onSubmit:S,children:(0,L.jsx)(W,{children:(0,L.jsx)(U,{type:`submit`,children:`Get Schema Drift`})})})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(NP,{onSubmit:C,children:(0,L.jsx)(W,{children:(0,L.jsx)(U,{type:`submit`,children:`Reconcile Schema Drift`})})})})]}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Reload Cron Resources`}),(0,L.jsx)(`p`,{children:`Obliterates the cron queue and rebuilds all the cron job schedulers for cron resources (eg. cron bots).`}),(0,L.jsx)(NP,{onSubmit:m,children:(0,L.jsx)(W,{children:(0,L.jsx)(U,{type:`submit`,children:`Reload Cron Resources`})})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Database Explain Search`}),(0,L.jsx)(`p`,{children:`Runs an EXPLAIN query on the database to show the query plan for a search.`}),(0,L.jsx)(vX,{setModalTitle:a,setModalContent:s,openModal:n}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`WebSocket Subscription Stats`}),(0,L.jsx)(`p`,{children:`View active WebSocket subscription statistics by project, resource type, and criteria.`}),(0,L.jsx)(pX,{}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Clear All WebSocket Subscriptions`}),(0,L.jsx)(`p`,{children:`Removes all active WebSocket subscription records from Redis. This is useful for cleaning up stale subscriptions during maintenance or after a deployment issue. Connected clients will need to re-bind.`}),(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Project (optional)`,htmlFor:`clearWsSubsProject`,children:(0,L.jsx)(ML,{name:`clearWsSubsProject`,placeholder:`All projects`,targetTypes:[`Project`],onChange:l})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(U,{onClick:()=>{a(`Clear All WebSocket Subscriptions`),s((0,L.jsxs)(W,{children:[(0,L.jsxs)(H,{children:[`Are you sure you want to completely clear`,` `,(0,L.jsx)(`strong`,{children:c?`WebSocket subscriptions for "${c.display??c.reference}"`:`ALL WebSocket subscriptions`}),`? Connected clients will need to re-bind their subscriptions.`]}),(0,L.jsx)(V,{align:`center`,children:(0,L.jsx)(U,{color:`red`,onClick:h,children:`Clear`})})]})),n()},children:`Clear All WebSocket Subscriptions`})})]}),(0,L.jsx)(pg,{opened:t,onClose:r,title:i,centered:!0,size:`auto`,children:o}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(kY,{}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Rebuild Indexes`}),(0,L.jsx)(`p`,{children:`Rebuild one or more PostgreSQL table or index targets concurrently. The operation runs asynchronously and may take a long time to complete.`}),(0,L.jsx)(hX,{onSubmit:w})]})}function hX({onSubmit:e}){let[t,n]=(0,b.useState)(()=>[{id:gD(),type:`table`,name:``}]);function r(e,t){n(n=>n.map((n,r)=>r===e?{...n,...t}:n))}function i(e){n(t=>t.filter((t,n)=>n!==e))}function a(){e(t.map(e=>e.type===`table`?{table:e.name.trim()}:{index:e.name.trim()}))}return(0,L.jsx)(NP,{onSubmit:a,children:(0,L.jsxs)(W,{children:[t.map((e,n)=>(0,L.jsxs)(V,{align:`end`,grow:!0,children:[(0,L.jsx)(Ig,{label:`Target type ${n+1}`,value:e.type,data:[{label:`Table`,value:`table`},{label:`Index`,value:`index`}],onChange:e=>r(n,{type:e.currentTarget.value})}),(0,L.jsx)(jb,{required:!0,label:`Target name ${n+1}`,placeholder:e.type===`table`?`Table name`:`Index name`,value:e.name,onChange:e=>r(n,{name:e.currentTarget.value})}),t.length>1&&(0,L.jsx)(U,{type:`button`,variant:`default`,onClick:()=>i(n),children:`Remove`})]},e.id)),(0,L.jsxs)(V,{children:[(0,L.jsx)(U,{type:`button`,variant:`default`,disabled:t.length>=10,onClick:()=>n(e=>[...e,{id:gD(),type:`table`,name:``}]),children:`Add Target`}),(0,L.jsx)(U,{type:`submit`,disabled:t.some(e=>!e.name.trim()),children:`Rebuild Indexes`})]})]})})}function gX(){let[e,t]=(0,b.useState)(`outdated`);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Ig,{id:`reindexType`,name:`reindexType`,value:e,onChange:e=>t(e.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`&&(0,L.jsx)(W_,{required:!0,name:`maxResourceVersion`,placeholder:`Max Resource Version`,min:0})]})}function _X({onSubmit:e}){let[t,n]=(0,b.useState)(!1);function r(t){let n={};for(let[e,r]of Object.entries(t))r!==``&&(n[e]=r);e(n)}return(0,L.jsx)(NP,{onSubmit:r,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Resource Type`,htmlFor:`resourceType`,children:(0,L.jsx)(jb,{id:`resourceType`,name:`resourceType`,placeholder:`Reindex Resource Type`})}),(0,L.jsx)(eL,{title:`Search Filter`,htmlFor:`filter`,children:(0,L.jsx)(jb,{id:`filter`,name:`filter`,placeholder:`e.g. name=Sam&birthdate=lt2000-01-01`})}),(0,L.jsx)(eL,{title:`Max Resource Version`,htmlFor:`maxResourceVersion`,children:(0,L.jsx)(gX,{})}),(0,L.jsx)(U,{variant:`subtle`,size:`xs`,onClick:()=>n(!t),children:t?`Hide Advanced Options`:`Show Advanced Options`}),t&&(0,L.jsx)(W,{gap:`sm`,children:(0,L.jsxs)(km,{children:[(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`batchSize`,label:`Resources per batch`,description:(0,L.jsx)(`span`,{children:`default: 500`}),placeholder:`500`,min:20,max:1e3})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`searchStatementTimeout`,label:`Search query timeout (ms)`,description:(0,L.jsx)(`span`,{children:`default: 3,600,000 (1 hour)`}),placeholder:`3600000`,min:1e3})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`upsertStatementTimeout`,label:`Upsert query timeout (ms)`,description:(0,L.jsx)(`span`,{children:"default: server `database.queryTimeout`"}),placeholder:`database.queryTimeout`,min:1e3})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`delayBetweenBatches`,label:`Delay between batches (ms)`,description:(0,L.jsx)(`span`,{children:`default: 0`}),placeholder:`0`,min:0,max:6e4})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`progressLogThreshold`,label:`Log progress every N resources`,description:(0,L.jsx)(`span`,{children:`default: 50,000`}),placeholder:`50000`,min:1})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`endTimestampBufferMinutes`,label:`End timestamp buffer (minutes)`,description:(0,L.jsx)(`span`,{children:`default: 5`}),placeholder:`5`,min:1})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`maxIterationAttempts`,label:`Max iteration attempts`,description:(0,L.jsx)(`span`,{children:`default: 3`}),placeholder:`3`,min:1,max:20})})]})}),(0,L.jsx)(U,{type:`submit`,children:`Reindex`})]})})}function vX({setModalTitle:e,setModalContent:t,openModal:n}){let r=Z(),[i,a]=(0,b.useState)(),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)(),f=(0,b.useMemo)(()=>{if(i?.reference)return{"_has:ProjectMembership:profile:project":i.reference}},[i]);(0,b.useEffect)(()=>{if(d(void 0),!o?.reference&&!i?.reference){l(void 0);return}r.searchResources(`ProjectMembership`,{profile:o?.reference,project:i?.reference,_count:20}).then(e=>{l(e),e.length===1&&d(DC(e[0]))}).catch(e=>{console.error(e),q({color:`red`,message:J(e),autoClose:!1})})},[r,o,i]);let p=(0,b.useMemo)(()=>{let e={};return o?.reference&&(e.profile=o?.reference),i?.reference&&(e.project=i?.reference),e},[o,i]);function m(i){if(!i.query){q({color:`red`,message:`Query is required`,autoClose:!1});return}let a=i.onBehalfOfProjectMembership;delete i.onBehalfOfProjectMembership;let o={query:i.query,analyze:i.analyze===`on`,count:i.count===`on`,format:`text`},s={};a&&(s[`x-medplum-on-behalf-of`]=a),r.post(`fhir/R4/$explain`,o,void 0,{headers:s}).then(r=>{e(`Database Explain`);let i=r.parameter?.find(e=>e.name===`explain`)?.valueString,a=r.parameter?.find(e=>e.name===`query`)?.valueString,o=r.parameter?.find(e=>e.name===`parameters`)?.valueString,s=r.parameter?.find(e=>e.name===`countEstimate`)?.valueInteger?.toLocaleString(),c=r.parameter?.find(e=>e.name===`countAccurate`)?.valueInteger?.toLocaleString(),l=[a,o,`
|
|
220
|
+
`,1)[0].replace(/:$/,``).replace(RegExp(`^${bY(n)}\\.`),``).replace(/^"|"$/g,``),i=t.get(`index_size`)??`0 bytes`;return{schemaName:n,tableName:t.get(`table`)??``,indexName:r,status:t.get(`index_status`)??``,indexSize:i,indexSizeBytes:yY(i),indexType:t.get(`index_type`)??``,isPrimary:t.get(`is_primary`)===`true`,isUnique:t.get(`is_unique`)===`true`}}function yY(e){let t=/^(\d+(?:\.\d+)?)\s*(bytes|kB|MB|GB|TB)$/.exec(e);return t?Number(t[1])*({bytes:1,kB:1024,MB:1024**2,GB:1024**3,TB:1024**4}[t[2]]??0):0}function bY(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function xY(e,t){let n=e.find(e=>e.name===t);return n?.valueString??n?.valueCode??``}function SY(e,t){return e.find(e=>e.name===t)?.valueDecimal??0}function CY(e,t){return e.find(e=>e.name===t)?.valueDecimal}var wY=[{label:`GIN Indexes`,value:`gin-indexes`},{label:`Index Health`,value:`index-health`},{label:`Column Statistics`,value:`column-statistics`},{label:`Array Column Padding`,value:`array-padding`}];function TY(){let e=Z();return!e.isLoading()&&!e.isSuperAdmin()?(0,L.jsx)(oI,{outcome:lS}):(0,L.jsx)(PF,{maw:`100%`,children:(0,L.jsxs)(IF,{children:[(0,L.jsx)(K,{order:1,children:`Database Tools`}),(0,L.jsxs)(aV,{baseUrl:`/admin/super/db`,tabs:wY,children:[(0,L.jsx)(Ab.Panel,{value:`gin-indexes`,pt:`md`,children:(0,L.jsx)(fY,{})}),(0,L.jsx)(Ab.Panel,{value:`index-health`,pt:`md`,children:(0,L.jsx)(hY,{})}),(0,L.jsx)(Ab.Panel,{value:`column-statistics`,pt:`md`,children:(0,L.jsx)(iY,{})}),(0,L.jsx)(Ab.Panel,{value:`array-padding`,pt:`md`,children:(0,L.jsx)(ZJ,{})})]})]})})}function EY(){let e=Z(),[t,n]=(0,b.useState)(e.getProject()),[r,i]=(0,b.useState)(`Practitioner`),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)(),[d,f]=(0,b.useState)(),[p,m]=(0,b.useState)(!1),[h,g]=(0,b.useState)(void 0),_=(0,b.useCallback)(n=>{f(void 0);let r={resourceType:n.resourceType,firstName:n.firstName,lastName:n.lastName,email:n.email,sendEmail:n.sendEmail===`on`,accessPolicy:s,admin:n.isAdmin===`on`,scope:n.isProjectScoped===`on`?`project`:`server`,mfaRequired:n.mfaRequired===`on`,patient:n.resourceType===`RelatedPerson`?a:void 0};return e.invite(t?.id,r).then(t=>{e.invalidateSearches(`Patient`),e.invalidateSearches(`Practitioner`),e.invalidateSearches(`ProjectMembership`),mS(t)?u(t):g(t),m(r.sendEmail??!1),q({color:`green`,message:`Invite success`})}).catch(e=>{q({color:`red`,message:J(e)}),f(yS(e))})},[e,t,s,a]);return(0,L.jsxs)(NP,{onSubmit:_,children:[!h&&!l&&(0,L.jsxs)(W,{children:[(0,L.jsx)(K,{children:`Invite new member`}),d&&(0,L.jsx)(H,{c:`red`,"data-testid":`invite-error`,children:bS(d)}),e.isSuperAdmin()&&(0,L.jsx)(eL,{title:`Project`,htmlFor:`project`,outcome:d,children:(0,L.jsx)(jL,{resourceType:`Project`,name:`project`,defaultValue:t,onChange:n})}),(0,L.jsx)(Ig,{name:`resourceType`,label:`Role`,defaultValue:`Practitioner`,data:[`Practitioner`,`Patient`,`RelatedPerson`],onChange:e=>{i(e.currentTarget.value),o(void 0)},error:BF(d,`resourceType`)}),(0,L.jsx)(jb,{name:`firstName`,label:`First Name`,required:!0,autoFocus:!0,error:BF(d,`firstName`)}),(0,L.jsx)(jb,{name:`lastName`,label:`Last Name`,required:!0,error:BF(d,`lastName`)}),(0,L.jsx)(jb,{name:`email`,type:`email`,label:`Email`,required:!0,error:BF(d,`email`)}),r===`RelatedPerson`&&(0,L.jsx)(eL,{title:`Patient`,htmlFor:`patient`,outcome:d,children:(0,L.jsx)(jL,{resourceType:`Patient`,name:`patient`,placeholder:`Patient`,onChange:e=>o(e?DC(e):void 0)})}),(0,L.jsx)(eL,{title:`Access Policy`,htmlFor:`accessPolicy`,outcome:d,children:(0,L.jsx)(BJ,{name:`accessPolicy`,onChange:c})}),(0,L.jsx)(pp,{name:`sendEmail`,label:`Send email`,defaultChecked:!0}),(0,L.jsx)(pp,{name:`isAdmin`,label:`Admin`}),(0,L.jsx)(pp,{name:`isProjectScoped`,label:`Project scoped`}),(0,L.jsx)(pp,{name:`mfaRequired`,label:`MFA required`}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(PP,{children:`Invite`})})]}),l&&(0,L.jsxs)(`div`,{"data-testid":`email-failure`,children:[(0,L.jsx)(`p`,{children:`User created, email couldn't be sent`}),(0,L.jsx)(`p`,{children:bS(l)}),(0,L.jsxs)(`p`,{children:[`Click `,(0,L.jsx)(eN,{to:`/admin/project`,children:`here`}),` to return to the project admin page.`]})]}),h&&(0,L.jsxs)(`div`,{"data-testid":`success`,children:[(0,L.jsx)(H,{children:`User created`}),p&&(0,L.jsx)(H,{children:`Email sent`}),(0,L.jsxs)(Oh,{children:[(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:h,children:`Go to new membership`})}),(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:h.profile,children:`Go to new profile`})}),(0,L.jsx)(Oh.Item,{children:(0,L.jsx)(eN,{to:`/admin/users`,children:`Back to users list`})})]})]})]})}function DY(e){let t=Z(),{enrolledMethods:n}=e,r=n&&!n.includes(`totp`)&&n.includes(`email`)?`email`:`totp`,[i,a]=(0,b.useState)(r),[o,s]=(0,b.useState)(!1);function c(e){return n!==void 0&&!n.includes(e)}function l(){s(!0),t.post(`admin/projects/${e.projectId}/members/${e.membershipId}/mfa/reset`,{method:i}).then(()=>{q({color:`green`,message:`Reset ${jJ[i]} MFA. The member has been emailed a notice.`}),e.onSuccess?.(),e.onClose()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1})).finally(()=>s(!1))}return(0,L.jsx)(pg,{opened:e.opened,onClose:e.onClose,title:`Reset MFA`,centered:!0,children:(0,L.jsx)(NP,{onSubmit:l,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(H,{size:`sm`,children:`Reset a multi-factor authentication factor for this member. Resetting the authenticator app rotates their secret so a lost device cannot be reused. Any other enrolled factors are left in place.`}),(0,L.jsx)(Wv.Group,{value:i,onChange:e=>a(e),label:`Factor to reset`,children:(0,L.jsxs)(W,{gap:`xs`,mt:`xs`,children:[(0,L.jsx)(Wv,{value:`totp`,label:jJ.totp,disabled:c(`totp`)}),(0,L.jsx)(Wv,{value:`email`,label:jJ.email,disabled:c(`email`)})]})}),(0,L.jsxs)(V,{justify:`flex-end`,children:[(0,L.jsx)(U,{variant:`default`,onClick:e.onClose,children:`Cancel`}),(0,L.jsx)(U,{type:`submit`,color:`red`,loading:o,disabled:c(i),children:`Reset MFA`})]})]})})})}function OY(e){let t=Z(),[n,r]=(0,b.useState)(!1);function i(){r(!0),t.post(`admin/projects/${e.projectId}/members/${e.membershipId}/resetpassword`,{}).then(()=>{q({color:`green`,message:`Password reset email sent.`}),e.onSuccess?.(),e.onClose()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1})).finally(()=>r(!1))}return(0,L.jsx)(pg,{opened:e.opened,onClose:e.onClose,title:`Send password reset email`,centered:!0,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(H,{size:`sm`,children:`Send this member an email with a single-use link to set a new password. Their current password remains valid until they complete the reset.`}),(0,L.jsxs)(V,{justify:`flex-end`,children:[(0,L.jsx)(U,{variant:`default`,onClick:e.onClose,children:`Cancel`}),(0,L.jsx)(U,{color:`blue`,loading:n,onClick:i,children:`Send email`})]})]})})}function kY(e){let t=Z(),[n,r]=(0,b.useState)(``),[i,a]=(0,b.useState)(!1);function o(){a(!0),t.post(`admin/projects/setpassword`,{email:e.email,password:n}).then(()=>{q({color:`green`,message:`Password updated.`}),r(``),e.onSuccess?.(),e.onClose()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1})).finally(()=>a(!1))}return(0,L.jsx)(pg,{opened:e.opened,onClose:e.onClose,title:`Set password`,centered:!0,children:(0,L.jsx)(NP,{onSubmit:o,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(H,{size:`sm`,children:`Set a new password for this member directly. They are not emailed. Use this only when a manual reset is required; otherwise prefer sending a password reset email.`}),(0,L.jsx)(_v,{label:`New password`,required:!0,minLength:8,value:n,onChange:e=>r(e.currentTarget.value),description:`At least 8 characters`}),(0,L.jsxs)(V,{justify:`flex-end`,children:[(0,L.jsx)(U,{variant:`default`,onClick:e.onClose,children:`Cancel`}),(0,L.jsx)(U,{type:`submit`,color:`red`,loading:i,disabled:n.length<8,children:`Set password`})]})]})})})}function AY(e){let{user:t}=e,n=MJ(t),[r,i]=wn(!1),[a,o]=wn(!1),[s,c]=wn(!1);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{mt:`md`,children:`Account Security`}),(0,L.jsxs)(W,{gap:`sm`,children:[(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(H,{fw:500,size:`sm`,children:`MFA:`}),n.length>0?n.map(e=>(0,L.jsx)(Ip,{color:`green`,variant:`light`,children:jJ[e]},e)):(0,L.jsx)(Ip,{color:`gray`,variant:`light`,children:`Not enrolled`}),t.mfaRequired&&(0,L.jsx)(Ip,{color:`orange`,variant:`light`,children:`Required`})]}),!t.email&&(0,L.jsx)(jd,{color:`yellow`,children:`This member has no email address, so password reset emails cannot be sent.`}),(0,L.jsxs)(V,{children:[(0,L.jsx)(U,{variant:`outline`,color:`red`,onClick:i.open,disabled:n.length===0,children:`Reset MFA`}),(0,L.jsx)(U,{variant:`outline`,onClick:o.open,disabled:!t.email,children:`Send password reset email`}),(0,L.jsx)(U,{variant:`outline`,color:`red`,onClick:c.open,disabled:!t.email,children:`Set password`})]})]}),(0,L.jsx)(DY,{opened:r,onClose:i.close,projectId:e.projectId,membershipId:e.membershipId,enrolledMethods:n}),(0,L.jsx)(OY,{opened:a,onClose:o.close,projectId:e.projectId,membershipId:e.membershipId}),t.email&&(0,L.jsx)(kY,{opened:s,onClose:c.close,email:t.email})]})}function jY(e){return e.includes(`/admin/bots/`)?`/admin/bots`:e.includes(`/admin/clients/`)?`/admin/clients`:`/admin/users`}function MY(){let e=Z(),t=zK(),n=LK(),{membershipId:r}=UK(),i=AJ(e),a=e.getProjectMembership()?.admin,o=e.readResource(`ProjectMembership`,r).read(),s=eA(o.profile),c=eA(o.user?.reference?.startsWith(`User/`)?{reference:o.user.reference}:void 0),l=e.getProject()?.owner?.reference===o.user?.reference,u=jY(n.pathname),d=(0,b.useCallback)(()=>{window.confirm(`Are you sure you want to remove this user from the project?`)&&e.delete(`admin/projects/${i}/members/${r}`).then(()=>{e.invalidateSearches(`ProjectMembership`),t(u)?.catch(console.error)}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[e,i,r,t,u]);return s?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`ProjectMembership Details`}),(0,L.jsx)(eN,{to:o,children:`Go to ProjectMembership`}),(0,L.jsx)(KR,{value:o}),(0,L.jsx)(K,{mt:`md`,children:`Profile Details`}),(0,L.jsxs)(eN,{to:s,children:[`Go to `,s.resourceType]}),(0,L.jsx)(KR,{value:s,ignoreMissingValues:!0}),o.user?.reference?.startsWith(`User/`)&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{mt:`md`,children:`User Details`}),c?.project?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(eN,{to:`/User/${c.id}/email`,children:`Go to User (change login email)`}),(0,L.jsx)(KR,{value:c,ignoreMissingValues:!0})]}):(0,L.jsx)(jd,{color:`yellow`,children:`This User is server-scoped and cannot be viewed in this project.`})]}),a&&c?.project&&i&&(0,L.jsx)(AY,{projectId:i,membershipId:r,user:c}),a&&!l&&(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,children:(0,L.jsx)(U,{type:`button`,color:`red`,variant:`outline`,onClick:d,children:`Remove user`})})]}):(0,L.jsx)(GM,{})}function NY(){let e=Z(),t=e.isSuperAdmin(),n=AJ(e),[r,{open:i,close:a}]=wn(!1),[o,s]=(0,b.useState)(!t&&n?{reference:`Project/${n}`}:void 0),[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)(`loading`),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(0),g=o?.reference,_=g?.split(`/`)[1];(0,b.useEffect)(()=>{if(!c?.id){d(`loading`);return}let t=!1;return d(`loading`),e.readResource(`User`,c.id).then(e=>{t||d(e.meta?.project&&e.meta.project===_?`project`:`server`)}).catch(()=>{t||d(`server`)}),()=>{t=!0}},[e,c,_]);let v;u===`project`?v=`server`:u===`server`&&t&&(v=`project`);let y=!!(g&&c?.id&&v);function x(){y&&i()}function S(){if(!c?.id||!v)return;p(!0);let t={resourceType:`Parameters`,parameter:[{name:`scope`,valueCode:v}]};v===`project`&&o&&t.parameter?.push({name:`project`,valueReference:o}),e.post(e.fhirUrl(`User`,c.id,`$rescope`),t).then(()=>{q({color:`green`,message:`User rescoped successfully`}),e.invalidateSearches(`User`),l(void 0),h(e=>e+1),a()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1})).finally(()=>p(!1))}let C=o?.display??g??`(no project selected)`,w=g?{"_has:ProjectMembership:user:project":g}:void 0,T=c?FY(c):void 0;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{order:2,children:`Rescope User`}),(0,L.jsxs)(`p`,{children:[`Move a User between `,(0,L.jsx)(`strong`,{children:`server`}),` scope (not tied to any Project) and `,(0,L.jsx)(`strong`,{children:`project`}),` scope (owned by a specific Project).`,` `,t?`Selecting a project-scoped User releases them to the server; selecting a server-scoped User assigns them to the chosen Project.`:`Project admins may release a project-scoped User in this Project to server scope. Re-assigning a User to a Project requires a super admin.`]}),(0,L.jsx)(NP,{onSubmit:x,children:(0,L.jsxs)(W,{children:[t&&(0,L.jsx)(eL,{title:`Project (required)`,htmlFor:`rescopeTargetProject`,children:(0,L.jsx)(ML,{name:`rescopeTargetProject`,placeholder:`Select a Project`,targetTypes:[`Project`],onChange:e=>{s(e),l(void 0),h(e=>e+1)}})}),(0,L.jsx)(eL,{title:`User (search by email; filtered to members of the selected Project)`,htmlFor:`rescopeTargetUser`,children:(0,L.jsx)(jL,{name:`rescopeTargetUser`,resourceType:`User`,placeholder:g?`Search by email`:`Select a Project first`,disabled:!g,searchCriteria:w,onChange:e=>l(e??void 0)},m)}),c&&(0,L.jsxs)(V,{gap:`sm`,children:[(0,L.jsx)(H,{children:T}),PY(u)]}),c&&u===`server`&&!t&&(0,L.jsxs)(jd,{color:`yellow`,children:[`This User is in `,(0,L.jsx)(`strong`,{children:`server`}),` scope. Only a super admin can assign a server-scoped User to a Project.`]}),(0,L.jsx)(`div`,{children:(0,L.jsx)(U,{type:`submit`,disabled:!y,children:v===`project`?`Assign User to Project`:`Release User to Server`})})]})}),(0,L.jsx)(pg,{opened:r,onClose:a,title:`Confirm User Rescope`,centered:!0,size:`auto`,children:(0,L.jsxs)(W,{children:[(0,L.jsxs)(H,{children:[`You are about to change the scope of `,(0,L.jsxs)(`strong`,{children:[`User/`,c?.id]}),`.`]}),v===`server`?(0,L.jsxs)(H,{children:[`This will `,(0,L.jsx)(`strong`,{children:`release`}),` the User from project `,(0,L.jsx)(`strong`,{children:C}),` to`,` `,(0,L.jsx)(`strong`,{children:`server`}),` scope. Any existing ProjectMemberships will be left in place and may be left orphaned.`]}):(0,L.jsxs)(H,{children:[`This will `,(0,L.jsx)(`strong`,{children:`assign`}),` the User to project `,(0,L.jsx)(`strong`,{children:C}),`. The User will become a project-scoped resource belonging to that Project.`]}),v===`server`&&!t&&(0,L.jsxs)(jd,{color:`red`,title:`This change cannot be reversed by a project admin`,children:[(0,L.jsx)(`strong`,{children:`You will need the help of a super admin to reverse this change.`}),` Once the User is released to server scope, only a super admin can re-assign the User back to this (or any) Project.`]}),(0,L.jsx)(H,{c:`red`,children:`This is a privileged operation. Double-check the User and target before continuing.`}),(0,L.jsxs)(V,{justify:`flex-end`,children:[(0,L.jsx)(U,{variant:`default`,onClick:a,disabled:f,children:`Cancel`}),(0,L.jsx)(U,{color:`red`,onClick:S,loading:f,children:`Confirm Rescope`})]})]})})]})}function PY(e){return e===`loading`?(0,L.jsx)(Py,{height:22,width:70,radius:`xl`}):e===`project`?(0,L.jsx)(Ip,{color:`blue`,variant:`light`,children:`Project`}):(0,L.jsx)(Ip,{color:`gray`,variant:`light`,children:`Server`})}function FY(e){let t;if(e.firstName||e.lastName){let n={family:e.lastName};e.firstName&&(n.given=[e.firstName]),t=jw(n)}return t&&e.email?`${t} (${e.email})`:t??e.email??`User/${e.id}`}function IY(){let e=Z();if(!e.isLoading()&&!e.isProjectAdmin())return(0,L.jsx)(oI,{outcome:lS});function t(t){e.post(`admin/projects/setpassword`,t).then(()=>q({color:`green`,message:`Done`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}return(0,L.jsxs)(LF,{width:600,children:[(0,L.jsx)(K,{order:1,children:`Project Admin`}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Force Set Password`}),(0,L.jsx)(H,{children:`Sets the password for the specified user in this project.`}),(0,L.jsx)(H,{children:`This action can only be performed by project administrators. Passwords can only be set for users scoped in this project.`}),(0,L.jsx)(NP,{onSubmit:t,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(jb,{name:`email`,label:`Email`,required:!0}),(0,L.jsx)(zF,{name:`password`,label:`Password`,required:!0}),(0,L.jsx)(U,{type:`submit`,children:`Force Set Password`})]})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(NY,{})]})}function LY(){let e=Z(),t=AJ(e),n=e.get(`admin/projects/${t}`).read();return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`Details`}),(0,L.jsxs)(DF,{children:[(0,L.jsx)(OF,{term:`ID`,children:n.project.id}),(0,L.jsx)(OF,{term:`Name`,children:n.project.name})]})]})}var RY=[{label:`Details`,value:`details`},{label:`Users`,value:`users`},{label:`Clients`,value:`clients`},{label:`Bots`,value:`bots`},{label:`Secrets`,value:`secrets`},{label:`Settings`,value:`settings`},{label:`Sites`,value:`sites`},{label:`Rate Limits`,value:`rate-limits`}];function zY(){let e=Z(),t=AJ(e),n=(0,b.useMemo)(()=>e.get(`admin/projects/`+t).read(),[e,t]);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Cl,{children:[(0,L.jsx)(tV,{children:(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(tV.Key,{children:`Project`}),(0,L.jsx)(tV.Value,{children:n.project.name})]})}),(0,L.jsx)(ml,{children:(0,L.jsx)(aV,{baseUrl:`/admin`,tabs:RY})})]}),(0,L.jsx)(PF,{maw:`100%`,children:(0,L.jsx)(IF,{children:(0,L.jsx)(yq,{})})})]})}function BY(e,t){return e?.find(e=>e.name===t)?.valueString}function VY(e,t){return e?.find(e=>e.name===t)?.valueInteger}function HY(e,t){return e?.find(e=>e.name===t)?.valueReference}function UY(e){let t=e.parameter?.find(e=>e.name===`project`);return{project:{id:BY(t?.part,`id`)??``,limit:VY(t?.part,`limit`),consumedPoints:VY(t?.part,`consumedPoints`),remainingPoints:VY(t?.part,`remainingPoints`),msBeforeReset:VY(t?.part,`msBeforeReset`)},memberships:(e.parameter?.filter(e=>e.name===`membership`)??[]).map(e=>({membershipId:BY(e.part,`membershipId`)??``,profile:HY(e.part,`profile`),limit:VY(e.part,`limit`),consumedPoints:VY(e.part,`consumedPoints`),remainingPoints:VY(e.part,`remainingPoints`),msBeforeReset:VY(e.part,`msBeforeReset`)}))}}function WY(e){if(e.limit!==void 0&&e.consumedPoints!==void 0)return e.limit===0?0:e.consumedPoints/e.limit*100}function GY(e){return e>=90?`red`:e>=70?`yellow`:`green`}function KY(e){if(e===void 0)return`--`;let t=Math.ceil(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`}function qY(e){return e===void 0?`--`:e.toLocaleString()}function JY(e){let t=WY(e);return t===void 0?`--`:`${t.toFixed(1)}%`}var YY=`https://www.medplum.com/docs/api/fhir/operations/project-rate-limits`;function XY(){let e=Z(),t=AJ(e),[n,r]=(0,b.useState)(),[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(`desc`),c=(0,b.useCallback)(()=>{a(!0),e.get(e.fhirUrl(`Project`,t,`$rate-limits`),{cache:`no-cache`}).then(e=>{r(UY(e))}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})}).finally(()=>{a(!1)})},[e,t]),l=(0,b.useCallback)(()=>{s(e=>e===`desc`?`asc`:`desc`)},[]),u=(0,b.useMemo)(()=>n?[...n.memberships].sort((e,t)=>{let n=WY(e)??-1,r=WY(t)??-1;return o===`desc`?r-n:n-r}):[],[n,o]);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(V,{justify:`space-between`,mb:`md`,children:[(0,L.jsx)(K,{children:`Rate Limits`}),(0,L.jsxs)(V,{children:[(0,L.jsx)(Rd,{href:YY,target:`_blank`,rel:`noopener noreferrer`,size:`sm`,children:`$rate-limits documentation`}),(0,L.jsx)(U,{leftSection:(0,L.jsx)(SM,{size:14}),loading:i,onClick:c,children:`Refresh`})]})]}),!n&&!i&&(0,L.jsx)(H,{c:`dimmed`,children:`Click Refresh to load current rate limit data.`}),n&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(ZY,{project:n.project}),u.length===0?(0,L.jsx)(H,{c:`dimmed`,mt:`md`,children:`No membership rate limit data found.`}):(0,L.jsx)(QY,{memberships:u,sortDirection:o,onToggleSort:l})]})]})}function ZY({project:e}){let t=WY(e);return(0,L.jsxs)(`div`,{style:{marginBottom:`1rem`},children:[(0,L.jsx)(K,{order:4,mb:`xs`,children:`Project Utilization`}),t===void 0?(0,L.jsx)(H,{c:`dimmed`,size:`sm`,children:`No project-level rate limit data recorded yet.`}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(V,{gap:`xl`,mb:`xs`,children:[(0,L.jsxs)(H,{size:`sm`,children:[(0,L.jsx)(`strong`,{children:`Consumed:`}),` `,qY(e.consumedPoints),` / `,qY(e.limit)]}),(0,L.jsxs)(H,{size:`sm`,children:[(0,L.jsx)(`strong`,{children:`Remaining:`}),` `,qY(e.remainingPoints)]}),(0,L.jsxs)(H,{size:`sm`,children:[(0,L.jsx)(`strong`,{children:`Utilization:`}),` `,JY(e)]}),(0,L.jsxs)(H,{size:`sm`,children:[(0,L.jsx)(`strong`,{children:`Resets in:`}),` `,KY(e.msBeforeReset)]})]}),(0,L.jsx)(Ev,{value:t,color:GY(t),size:`lg`})]})]})}function QY({memberships:e,sortDirection:t,onToggleSort:n}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{order:4,mt:`lg`,mb:`xs`,children:`Membership Utilization`}),(0,L.jsxs)(G,{striped:!0,highlightOnHover:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Membership ID`}),(0,L.jsx)(G.Th,{children:`Profile`}),(0,L.jsx)(G.Th,{children:`Limit`}),(0,L.jsx)(G.Th,{children:`Consumed`}),(0,L.jsx)(G.Th,{children:`Remaining`}),(0,L.jsx)(G.Th,{children:(0,L.jsxs)(vl,{onClick:n,style:{fontWeight:700,display:`flex`,alignItems:`center`,gap:4},children:[`Utilization`,t===`desc`?(0,L.jsx)(hj,{size:14}):(0,L.jsx)(gj,{size:14})]})}),(0,L.jsx)(G.Th,{children:`Resets In`})]})}),(0,L.jsx)(G.Tbody,{children:e.map(e=>(0,L.jsx)($Y,{membership:e},e.membershipId))})]})]})}function $Y({membership:e}){let t=zK(),n=WY(e);return(0,L.jsxs)(G.Tr,{onClick:()=>t(`/admin/users/${e.membershipId}`),style:{cursor:`pointer`},children:[(0,L.jsx)(G.Td,{children:e.membershipId}),(0,L.jsx)(G.Td,{children:(0,L.jsx)(uR,{value:e.profile})}),(0,L.jsx)(G.Td,{children:qY(e.limit)}),(0,L.jsx)(G.Td,{children:qY(e.consumedPoints)}),(0,L.jsx)(G.Td,{children:qY(e.remainingPoints)}),(0,L.jsx)(G.Td,{children:n===void 0?`--`:(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(Ev,{value:n,color:GY(n),size:`sm`,style:{flex:1,minWidth:60}}),(0,L.jsxs)(H,{size:`sm`,w:50,ta:`right`,children:[n.toFixed(1),`%`]})]})}),(0,L.jsx)(G.Td,{children:KY(e.msBeforeReset)})]})}function eX(){let e=Z(),t=AJ(e),n=e.get(`admin/projects/${t}`).read(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)();return(0,b.useEffect)(()=>{e.requestSchema(`Project`).then(()=>i(!0)).catch(console.log)},[e]),(0,b.useEffect)(()=>{n&&o(ew(n.project.secret||[]))},[e,n]),!r||!a?(0,L.jsx)(`div`,{children:`Loading...`}):(0,L.jsxs)(`form`,{noValidate:!0,autoComplete:`off`,onSubmit:n=>{n.preventDefault(),e.post(`admin/projects/${t}/secrets`,a).then(()=>e.get(`admin/projects/${t}`,{cache:`reload`})).then(()=>q({color:`green`,message:`Saved`})).catch(console.log)},children:[(0,L.jsx)(K,{children:`Project Secrets`}),(0,L.jsx)(`p`,{children:`Use project secrets to store sensitive information such as API keys or other access credentials.`}),(0,L.jsx)(YL,{property:uT(`Project`,`secret`),name:`secret`,path:`Project.secret`,defaultValue:a,onChange:o,outcome:void 0}),(0,L.jsx)(U,{type:`submit`,children:`Save`})]})}function tX(){let e=Z(),t=AJ(e),n=e.get(`admin/projects/${t}`).read(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)();return(0,b.useEffect)(()=>{e.requestSchema(`Project`).then(()=>i(!0)).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[e]),(0,b.useEffect)(()=>{n&&o(ew(n.project.setting||[]))},[e,n]),!r||!a?(0,L.jsx)(`div`,{children:`Loading...`}):(0,L.jsxs)(`form`,{noValidate:!0,autoComplete:`off`,onSubmit:n=>{n.preventDefault(),e.post(`admin/projects/${t}/settings`,a).then(()=>e.get(`admin/projects/${t}`,{cache:`reload`})).then(()=>q({color:`green`,message:`Saved`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},children:[(0,L.jsx)(K,{children:`Project Settings`}),(0,L.jsxs)(`p`,{children:[`Use project settings to store non-sensitive configuration visible to all project users. For example, set "aiModels" to a JSON array of `,`{ "value", "label" }`,` objects to control the models available in the Spaces AI assistant.`]}),(0,L.jsx)(YL,{property:uT(`Project`,`setting`),name:`setting`,path:`Project.setting`,defaultValue:a,onChange:o,outcome:void 0}),(0,L.jsx)(U,{type:`submit`,children:`Save`})]})}function nX(){let e=Z(),t=AJ(e),n=e.get(`admin/projects/${t}`).read(),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)();return(0,b.useEffect)(()=>{e.requestSchema(`Project`).then(()=>i(!0)).catch(console.log)},[e]),(0,b.useEffect)(()=>{n&&o(ew(n.project.site||[]))},[e,n]),!r||!a?(0,L.jsx)(`div`,{children:`Loading...`}):(0,L.jsxs)(`form`,{noValidate:!0,autoComplete:`off`,onSubmit:n=>{n.preventDefault(),e.post(`admin/projects/${t}/sites`,a).then(()=>e.get(`admin/projects/${t}`,{cache:`reload`})).then(()=>q({color:`green`,message:`Saved`})).catch(e=>{let t=yS(e);q({color:`red`,message:`Error ${t.issue?.[0].details?.text} ${t.issue?.[0].expression?.[0]}`,autoClose:!1})})},children:[(0,L.jsx)(K,{children:`Project Sites`}),(0,L.jsx)(`p`,{children:`Use project sites configure your project on a separate domain.`}),(0,L.jsx)(YL,{property:uT(`Project`,`site`),name:`site`,path:`Project.site`,defaultValue:a,onChange:o,outcome:void 0}),(0,L.jsx)(U,{type:`submit`,children:`Save`})]})}var rX=[{label:`Post-deploy Migrations`,value:`migrations`},{label:`System AsyncJob`,value:`asyncjob`}];function iX(){let e=Z();return!e.isLoading()&&!e.isSuperAdmin()?(0,L.jsx)(oI,{outcome:lS}):(0,L.jsx)(PF,{miw:`1600`,maw:`2000`,children:(0,L.jsxs)(IF,{children:[(0,L.jsx)(K,{order:1,children:`AsyncJob Dashboard`}),(0,L.jsxs)(aV,{baseUrl:`/admin/super/asyncjob`,tabs:rX,keepMounted:!1,children:[(0,L.jsx)(Ab.Panel,{value:`asyncjob`,pt:`md`,children:(0,L.jsx)(oX,{})}),(0,L.jsx)(Ab.Panel,{value:`migrations`,pt:`md`,children:(0,L.jsx)(cX,{})})]})]})})}var aX={resourceType:`AsyncJob`,fields:[`id`,`_lastUpdated`,`request`,`status`,`type`],filters:[{code:`_project`,operator:X.MISSING,value:`true`}],sortRules:[{code:`_lastUpdated`,descending:!0}]};function oX(){let e=zK(),[t]=(0,b.useState)(aX);return(0,L.jsxs)(W,{children:[(0,L.jsx)(eN,{to:`/${t.resourceType}/${FE(t)}`,children:`Show in search page`}),(0,L.jsx)(UB,{checkboxesEnabled:!1,search:t,onClick:t=>e(uX(t.resource))?.catch(console.error),onAuxClick:e=>window.open(uX(e.resource),`_blank`)})]})}var sX={resourceType:`AsyncJob`,fields:[`id`,`_lastUpdated`,`request`,`status`,`type`],filters:[{code:`_project`,operator:X.MISSING,value:`true`},{code:`type`,operator:X.EQUALS,value:`data-migration`}],count:1e3,sortRules:[{code:`_lastUpdated`,descending:!0}]};function cX(){let e=Z(),[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(),[a,o]=(0,b.useState)([]),[s,c]=(0,b.useState)(0),[l,u]=(0,b.useState)([]);(0,b.useEffect)(()=>{let t=`info`;u(e=>e.includes(t)?e:[...e,t]),e.get(`admin/super/migrations`,{cache:`no-cache`}).then(e=>{e.postDeployMigrations.sort((e,t)=>t-e),n(e)}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})}).finally(()=>u(e=>e.filter(e=>e!==t)))},[e,s]),(0,b.useEffect)(()=>{let t=`jobs`;u(e=>e.includes(t)?e:[...e,t]),e.requestSchema(`AsyncJob`).then(()=>e.search(`AsyncJob`,FE({...sX,total:`accurate`,fields:void 0}),{cache:`no-cache`}).then(e=>{i(e.entry?.map(e=>e.resource))})).catch(e=>{i(void 0),q({color:`red`,message:J(e),autoClose:!1})}).finally(()=>u(e=>e.filter(e=>e!==t)))},[e,s]);function d(){c(e=>e+1)}function f(t){sY(e,`Run pending post-deploy migration`,`admin/super/migrate`,{dataVersion:t}).finally(()=>{d()}).catch(()=>{}),d()}let p=l.length>0;function m(e,{isLoading:t}){return(0,L.jsxs)(`div`,{style:{position:`relative`},children:[(0,L.jsx)(Mh,{visible:t}),(0,L.jsxs)(G,{children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Version`}),(0,L.jsx)(G.Th,{children:`Action`}),(0,L.jsx)(G.Th,{children:`Status`}),(0,L.jsx)(G.Th,{children:`AsyncJob`}),(0,L.jsx)(G.Th,{children:`Last Updated`}),(0,L.jsx)(G.Th,{children:`Request Time`}),(0,L.jsx)(G.Th,{children:`Duration`}),(0,L.jsx)(G.Th,{children:`Attempts`})]})}),(0,L.jsx)(G.Tbody,{children:e()})]})]})}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(U,{size:`xs`,mb:`xs`,variant:`subtle`,leftSection:(0,L.jsx)(SM,{size:14}),onClick:d,loading:p,children:`Refresh`}),m(()=>{if(!p){if(!t)return(0,L.jsx)(G.Tr,{children:(0,L.jsx)(G.Td,{colSpan:6,children:`Failed to load migration info`})});if(!r)return(0,L.jsx)(G.Tr,{children:(0,L.jsx)(G.Td,{colSpan:6,children:`Failed to load async jobs`})})}return!t||!r?null:t.postDeployMigrations?.map(e=>{let{status:n,asyncJob:i,asyncJobs:s}=lX(e,r??[],t?.pendingPostDeployMigration),c=a.includes(e),l=e===t?.pendingPostDeployMigration&&(!i||i?.status===`error`),u=[(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:e}),(0,L.jsx)(G.Td,{children:l&&(0,L.jsx)(U,{color:`green`,size:`xs`,onClick:()=>f(e),children:`Start`})}),(0,L.jsx)(G.Td,{children:n}),(0,L.jsx)(G.Td,{children:i&&(0,L.jsx)(eN,{to:`/AsyncJob/${i?.id}`,children:i?.id})}),(0,L.jsx)(G.Td,{children:i?.meta?.lastUpdated}),(0,L.jsx)(G.Td,{children:i?.requestTime}),(0,L.jsx)(G.Td,{children:dX(i)}),(0,L.jsx)(G.Td,{display:`flex`,children:(0,L.jsxs)(V,{gap:`xs`,children:[s.length?s.length:``,c&&s.length>1&&(0,L.jsx)(U,{leftSection:(0,L.jsx)(fM,{size:14}),variant:`subtle`,color:`blue`,size:`xs`,radius:`xs`,onClick:()=>o(t=>t.includes(e)?t.filter(t=>t!==e):t),children:`Hide all`}),!c&&s.length>1&&(0,L.jsx)(U,{leftSection:(0,L.jsx)(bM,{size:14}),variant:`subtle`,color:`blue`,size:`xs`,radius:`xs`,onClick:()=>o(t=>t.includes(e)?t:[...t,e]),children:`Show all`})]})})]},e)];return c&&u.push(...s.filter(e=>e.id!==i?.id).map(t=>(0,L.jsxs)(G.Tr,{bg:`gray.1`,children:[(0,L.jsx)(G.Td,{children:e}),(0,L.jsx)(G.Td,{}),(0,L.jsx)(G.Td,{children:t.status}),(0,L.jsx)(G.Td,{children:(0,L.jsx)(eN,{to:`/AsyncJob/${t.id}`,children:t.id})}),(0,L.jsx)(G.Td,{children:t.meta?.lastUpdated}),(0,L.jsx)(G.Td,{children:t.requestTime}),(0,L.jsx)(G.Td,{children:dX(t)}),(0,L.jsx)(G.Td,{})]},t.id))),u})},{isLoading:p})]})}function lX(e,t,n){let r=t.filter(t=>t.dataVersion===e),i=r.find(e=>e.status===`completed`)??r[0],a;return a=n===0?i?.status??`completed`:e>n?i?.status??`pending`:e===n?i?.status??`next`:i?.status??`completed`,{status:a,asyncJob:i,asyncJobs:r}}function uX(e){return`/${e.resourceType}/${e.id}`}function dX(e){let t=e?.requestTime,n=e?.transactionTime??e?.meta?.lastUpdated;if(!t||!n)return``;let r=new Date(t),i=new Date(n).getTime()-r.getTime();if(i<1e3)return`${i.toFixed(0)}ms`;let a=i/1e3;return a<60?`${a.toFixed(2)}s`:a<3600?`${(a/60).toFixed(2)}m`:`${(a/3600).toFixed(2)}h`}function fX(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function pX({entry:e}){return(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:(0,L.jsxs)(`div`,{style:{paddingLeft:50},children:[(0,L.jsxs)(H,{size:`xs`,c:`dimmed`,children:[`Subscription: `,(0,L.jsx)(RI,{value:{reference:`Subscription/${e.subscriptionId}`}})]}),(0,L.jsxs)(H,{size:`xs`,c:`dimmed`,children:[`Author:`,` `,(0,L.jsx)(eN,{to:{reference:e.author},children:(0,L.jsx)(uR,{value:{reference:e.author}})})]}),e.expiration?(0,L.jsxs)(H,{size:`xs`,c:`dimmed`,children:[`Expires at:`,` `,new Date(e.expiration*1e3).toLocaleString(void 0,{timeZoneName:`short`})]}):null]})}),(0,L.jsx)(G.Td,{})]},e.subscriptionId)}function mX({criteria:e,expanded:t,onToggle:n}){return(0,L.jsxs)(b.Fragment,{children:[(0,L.jsxs)(G.Tr,{onClick:n,style:{cursor:`pointer`},children:[(0,L.jsx)(G.Td,{children:(0,L.jsxs)(V,{gap:`xs`,pl:`xl`,children:[(0,L.jsx)(H,{size:`xs`,children:t?`▼`:`▶`}),(0,L.jsx)(H,{size:`sm`,c:`dimmed`,children:e.criteria})]})}),(0,L.jsx)(G.Td,{children:e.count})]}),t&&e.entries?.map(e=>(0,L.jsx)(pX,{entry:e},e.subscriptionId))]})}function hX({projectId:e,rt:t,rtDetail:n,isLoading:r,expanded:i,expandedCriteria:a,onToggle:o,onToggleCriteria:s}){let c=`${e}:${t.resourceType}`;return(0,L.jsxs)(b.Fragment,{children:[(0,L.jsxs)(G.Tr,{onClick:o,style:{cursor:`pointer`},children:[(0,L.jsx)(G.Td,{children:(0,L.jsxs)(V,{gap:`xs`,pl:`md`,children:[(0,L.jsx)(H,{size:`xs`,children:i?`▼`:`▶`}),(0,L.jsx)(H,{children:t.resourceType})]})}),(0,L.jsx)(G.Td,{children:t.count})]}),i&&(0,L.jsxs)(L.Fragment,{children:[r&&!n&&(0,L.jsx)(G.Tr,{children:(0,L.jsx)(G.Td,{colSpan:2,children:(0,L.jsx)(H,{pl:`xl`,size:`sm`,c:`dimmed`,children:`Loading...`})})}),n?.criteria.map(e=>{let t=`${c}:${e.criteria}`;return(0,L.jsx)(mX,{criteria:e,expanded:a.has(t),onToggle:()=>s(t)},t)})]})]})}function gX({project:e,expanded:t,expandedResourceTypes:n,expandedCriteria:r,projectDetail:i,isLoadingDetail:a,onToggle:o,onToggleResourceType:s,onToggleCriteria:c}){return(0,L.jsxs)(b.Fragment,{children:[(0,L.jsxs)(G.Tr,{onClick:o,style:{cursor:`pointer`},children:[(0,L.jsx)(G.Td,{children:(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(H,{size:`xs`,children:t?`▼`:`▶`}),(0,L.jsx)(RI,{value:{reference:`Project/${e.projectId}`,display:e.projectName}})]})}),(0,L.jsx)(G.Td,{children:e.subscriptionCount})]}),t&&e.resourceTypes.map(t=>{let o=`${e.projectId}:${t.resourceType}`;return(0,L.jsx)(hX,{projectId:e.projectId,rt:t,rtDetail:i?.find(e=>e.resourceType===t.resourceType),isLoading:a,expanded:n.has(o),expandedCriteria:r,onToggle:()=>s(e.projectId,t.resourceType),onToggleCriteria:c},o)})]})}function _X(){let e=Z(),[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(!1),[a,{open:o,close:s}]=wn(!1),[c,l]=(0,b.useState)(new Set),[u,d]=(0,b.useState)(new Set),[f,p]=(0,b.useState)(new Set),[m,h]=(0,b.useState)(new Map),[g,_]=(0,b.useState)(new Map);function v(){i(!0),e.get(`fhir/R4/$get-ws-sub-stats`,{cache:`no-cache`}).then(e=>{let t=e.parameter?.find(e=>e.name===`stats`)?.valueString;if(t){let e=JSON.parse(t);n(e.projects)}o()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1})).finally(()=>i(!1))}function y(t,n){let r=`${t}:${n}`;m.has(t)||(_(e=>new Map(e).set(t,!0)),e.get(`fhir/R4/$get-ws-sub-project-stats?projectId=${encodeURIComponent(t)}`,{cache:`no-cache`}).then(e=>{let n=e.parameter?.find(e=>e.name===`stats`)?.valueString;if(n){let e=JSON.parse(n);h(n=>new Map(n).set(t,e.resourceTypes))}}).catch(e=>q({color:`red`,message:J(e),autoClose:!1})).finally(()=>_(e=>{let n=new Map(e);return n.delete(t),n}))),d(e=>fX(e,r))}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(U,{onClick:v,loading:r,children:`Get WS Sub Stats`}),(0,L.jsxs)(pg,{opened:a,onClose:s,title:`WebSocket Subscription Stats`,size:`xl`,centered:!0,children:[!t?.length&&(0,L.jsx)(H,{children:`No active WebSocket subscriptions found.`}),t&&t.length>0&&(0,L.jsxs)(G,{striped:!0,highlightOnHover:!0,withTableBorder:!0,withColumnBorders:!0,tabularNums:!0,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Project / Resource Type / Criteria`}),(0,L.jsx)(G.Th,{children:`Count`})]})}),(0,L.jsx)(G.Tbody,{children:t.map(e=>(0,L.jsx)(gX,{project:e,expanded:c.has(e.projectId),expandedResourceTypes:u,expandedCriteria:f,projectDetail:m.get(e.projectId),isLoadingDetail:g.get(e.projectId)===!0,onToggle:()=>l(t=>fX(t,e.projectId)),onToggleResourceType:y,onToggleCriteria:e=>p(t=>fX(t,e))},e.projectId))})]})]})]})}function vX(){let e=Z(),[t,{open:n,close:r}]=wn(!1),[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)();if(!e.isLoading()&&!e.isSuperAdmin())return(0,L.jsx)(oI,{outcome:lS});function u(){cY(e,`Rebuilding Structure Definitions`,`admin/super/structuredefinitions`)}function d(){cY(e,`Rebuilding Search Parameters`,`admin/super/searchparameters`)}function f(){cY(e,`Rebuilding Value Sets`,`admin/super/valuesets`)}function p(t){cY(e,`Reindexing Resources`,`admin/super/reindex`,t)}function m(){cY(e,`Reload Cron Resources`,`admin/super/reloadcron`)}function h(){r();let t=kC(c);e.post(`fhir/R4/$clear-all-ws-subs`,t?{resourceType:`Parameters`,parameter:[{name:`projectId`,valueString:t}]}:void 0).then(()=>q({color:`green`,message:`Done`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1})),l(void 0)}function g(t){e.post(`admin/super/removebotidjobsfromqueue`,t).then(()=>q({color:`green`,message:`Done`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}function _(t){e.post(`admin/super/purge`,{...t,before:fL(t.before)}).then(()=>q({color:`green`,message:`Done`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}function v(t){e.post(`admin/super/setpassword`,t).then(()=>q({color:`green`,message:`Done`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}function y(t){e.post(`fhir/R4/$db-stats`,t.tableNames?{resourceType:`Parameters`,parameter:[{name:`tableNames`,valueString:t.tableNames}]}:void 0).then(e=>{let t=e.parameter?.find(e=>e.name===`tableString`)?.valueString??``;a(`Database Stats`),s((0,L.jsxs)(W,{children:[(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(dm,{value:t,children:({copied:e,copy:t})=>(0,L.jsx)(U,{variant:`light`,size:`xs`,color:e?`teal`:`blue`,onClick:t,children:e?`Copied`:`Copy to clipboard`})})}),(0,L.jsx)(`pre`,{children:t})]})),n()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}function x(){e.post(`fhir/R4/$db-invalid-indexes`).then(e=>{a(`Database Invalid Indexes`),s((0,L.jsx)(`pre`,{children:e.parameter?.filter(e=>e.name===`invalidIndex`).map(e=>e.valueString).join(`
|
|
221
|
+
`)})),n()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}function S(){e.post(`fhir/R4/$db-schema-diff`).then(e=>{a(`Schema Diff`),s((0,L.jsx)(`pre`,{children:e.parameter?.find(e=>e.name===`migrationString`)?.valueString})),n()}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}function C(){cY(e,`Reconcile Schema Diff`,`admin/super/reconcile-db-schema-drift`)}function w(t){cY(e,`Rebuilding indexes`,`admin/super/rebuild-index`,{targets:t})}return(0,L.jsxs)(LF,{width:600,children:[(0,L.jsx)(K,{order:1,children:`Super Admin`}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Structure Definitions`}),(0,L.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.`}),(0,L.jsx)(NP,{children:(0,L.jsx)(U,{onClick:u,children:`Rebuild StructureDefinitions`})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Search Parameters`}),(0,L.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.`}),(0,L.jsx)(NP,{children:(0,L.jsx)(U,{onClick:d,children:`Rebuild SearchParameters`})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Value Sets`}),(0,L.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.`}),(0,L.jsx)(NP,{children:(0,L.jsx)(U,{onClick:f,children:`Rebuild ValueSets`})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Reindex Resources`}),(0,L.jsx)(`p`,{children:`When Medplum changes how resources are indexed, the system may require a reindex for old resources to be indexed properly.`}),(0,L.jsx)(xX,{onSubmit:p}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Purge Resources`}),(0,L.jsx)(`p`,{children:`As system generated resources accumulate, the system may require a purge to remove old resources.`}),(0,L.jsx)(NP,{onSubmit:_,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Purge Resource Type`,htmlFor:`purgeResourceType`,children:(0,L.jsx)(Ig,{id:`purgeResourceType`,name:`resourceType`,data:[``,`AuditEvent`,`Login`]})}),(0,L.jsx)(eL,{title:`Purge Before`,htmlFor:`before`,children:(0,L.jsx)(pL,{name:`before`,placeholder:`Before Date`})}),(0,L.jsx)(U,{type:`submit`,children:`Purge`})]})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Remove Bot ID Jobs from Queue`}),(0,L.jsx)(`p`,{children:`Remove all queued jobs for a Bot ID`}),(0,L.jsx)(NP,{onSubmit:g,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Bot ID`,children:(0,L.jsx)(jb,{name:`botId`,placeholder:`Bot Id`})}),(0,L.jsx)(U,{type:`submit`,children:`Remove Jobs by Bot ID`})]})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Force Set Password`}),(0,L.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.`}),(0,L.jsx)(NP,{onSubmit:v,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(jb,{name:`email`,label:`Email`,required:!0}),(0,L.jsx)(zF,{name:`password`,label:`Password`,required:!0}),(0,L.jsx)(jb,{name:`projectId`,label:`Project ID`}),(0,L.jsx)(U,{type:`submit`,children:`Force Set Password`})]})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Database Stats`}),(0,L.jsx)(`p`,{children:`Query current table statistics from the database.`}),(0,L.jsx)(NP,{onSubmit:y,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Table Names (comma-delimited)`,htmlFor:`tableNames`,children:(0,L.jsx)(jb,{id:`tableNames`,name:`tableNames`,placeholder:`Observation,Observation_History`})}),(0,L.jsx)(U,{type:`submit`,children:`Get Database Stats`})]})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Database Invalid Indexes`}),(0,L.jsx)(`p`,{children:`Query invalid indexes from the database.`}),(0,L.jsx)(NP,{onSubmit:x,children:(0,L.jsx)(W,{children:(0,L.jsx)(U,{type:`submit`,children:`Get Database Invalid Indexes`})})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Database Schema Drift`}),(0,L.jsx)(`p`,{children:`Show the schema migration needed to match the expected database schema.`}),(0,L.jsxs)(km,{children:[(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(NP,{onSubmit:S,children:(0,L.jsx)(W,{children:(0,L.jsx)(U,{type:`submit`,children:`Get Schema Drift`})})})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(NP,{onSubmit:C,children:(0,L.jsx)(W,{children:(0,L.jsx)(U,{type:`submit`,children:`Reconcile Schema Drift`})})})})]}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Reload Cron Resources`}),(0,L.jsx)(`p`,{children:`Obliterates the cron queue and rebuilds all the cron job schedulers for cron resources (eg. cron bots).`}),(0,L.jsx)(NP,{onSubmit:m,children:(0,L.jsx)(W,{children:(0,L.jsx)(U,{type:`submit`,children:`Reload Cron Resources`})})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Database Explain Search`}),(0,L.jsx)(`p`,{children:`Runs an EXPLAIN query on the database to show the query plan for a search.`}),(0,L.jsx)(SX,{setModalTitle:a,setModalContent:s,openModal:n}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`WebSocket Subscription Stats`}),(0,L.jsx)(`p`,{children:`View active WebSocket subscription statistics by project, resource type, and criteria.`}),(0,L.jsx)(_X,{}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Clear All WebSocket Subscriptions`}),(0,L.jsx)(`p`,{children:`Removes all active WebSocket subscription records from Redis. This is useful for cleaning up stale subscriptions during maintenance or after a deployment issue. Connected clients will need to re-bind.`}),(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Project (optional)`,htmlFor:`clearWsSubsProject`,children:(0,L.jsx)(ML,{name:`clearWsSubsProject`,placeholder:`All projects`,targetTypes:[`Project`],onChange:l})}),(0,L.jsx)(`div`,{children:(0,L.jsx)(U,{onClick:()=>{a(`Clear All WebSocket Subscriptions`),s((0,L.jsxs)(W,{children:[(0,L.jsxs)(H,{children:[`Are you sure you want to completely clear`,` `,(0,L.jsx)(`strong`,{children:c?`WebSocket subscriptions for "${c.display??c.reference}"`:`ALL WebSocket subscriptions`}),`? Connected clients will need to re-bind their subscriptions.`]}),(0,L.jsx)(V,{align:`center`,children:(0,L.jsx)(U,{color:`red`,onClick:h,children:`Clear`})})]})),n()},children:`Clear All WebSocket Subscriptions`})})]}),(0,L.jsx)(pg,{opened:t,onClose:r,title:i,centered:!0,size:`auto`,children:o}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(NY,{}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Rebuild Indexes`}),(0,L.jsx)(`p`,{children:`Rebuild one or more PostgreSQL table or index targets concurrently. The operation runs asynchronously and may take a long time to complete.`}),(0,L.jsx)(yX,{onSubmit:w})]})}function yX({onSubmit:e}){let[t,n]=(0,b.useState)(()=>[{id:gD(),type:`table`,name:``}]);function r(e,t){n(n=>n.map((n,r)=>r===e?{...n,...t}:n))}function i(e){n(t=>t.filter((t,n)=>n!==e))}function a(){e(t.map(e=>e.type===`table`?{table:e.name.trim()}:{index:e.name.trim()}))}return(0,L.jsx)(NP,{onSubmit:a,children:(0,L.jsxs)(W,{children:[t.map((e,n)=>(0,L.jsxs)(V,{align:`end`,grow:!0,children:[(0,L.jsx)(Ig,{label:`Target type ${n+1}`,value:e.type,data:[{label:`Table`,value:`table`},{label:`Index`,value:`index`}],onChange:e=>r(n,{type:e.currentTarget.value})}),(0,L.jsx)(jb,{required:!0,label:`Target name ${n+1}`,placeholder:e.type===`table`?`Table name`:`Index name`,value:e.name,onChange:e=>r(n,{name:e.currentTarget.value})}),t.length>1&&(0,L.jsx)(U,{type:`button`,variant:`default`,onClick:()=>i(n),children:`Remove`})]},e.id)),(0,L.jsxs)(V,{children:[(0,L.jsx)(U,{type:`button`,variant:`default`,disabled:t.length>=10,onClick:()=>n(e=>[...e,{id:gD(),type:`table`,name:``}]),children:`Add Target`}),(0,L.jsx)(U,{type:`submit`,disabled:t.some(e=>!e.name.trim()),children:`Rebuild Indexes`})]})]})})}function bX(){let[e,t]=(0,b.useState)(`outdated`);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Ig,{id:`reindexType`,name:`reindexType`,value:e,onChange:e=>t(e.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`&&(0,L.jsx)(W_,{required:!0,name:`maxResourceVersion`,placeholder:`Max Resource Version`,min:0})]})}function xX({onSubmit:e}){let[t,n]=(0,b.useState)(!1);function r(t){let n={};for(let[e,r]of Object.entries(t))r!==``&&(n[e]=r);e(n)}return(0,L.jsx)(NP,{onSubmit:r,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(eL,{title:`Resource Type`,htmlFor:`resourceType`,children:(0,L.jsx)(jb,{id:`resourceType`,name:`resourceType`,placeholder:`Reindex Resource Type`})}),(0,L.jsx)(eL,{title:`Search Filter`,htmlFor:`filter`,children:(0,L.jsx)(jb,{id:`filter`,name:`filter`,placeholder:`e.g. name=Sam&birthdate=lt2000-01-01`})}),(0,L.jsx)(eL,{title:`Max Resource Version`,htmlFor:`maxResourceVersion`,children:(0,L.jsx)(bX,{})}),(0,L.jsx)(U,{variant:`subtle`,size:`xs`,onClick:()=>n(!t),children:t?`Hide Advanced Options`:`Show Advanced Options`}),t&&(0,L.jsx)(W,{gap:`sm`,children:(0,L.jsxs)(km,{children:[(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`batchSize`,label:`Resources per batch`,description:(0,L.jsx)(`span`,{children:`default: 500`}),placeholder:`500`,min:20,max:1e3})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`searchStatementTimeout`,label:`Search query timeout (ms)`,description:(0,L.jsx)(`span`,{children:`default: 3,600,000 (1 hour)`}),placeholder:`3600000`,min:1e3})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`upsertStatementTimeout`,label:`Upsert query timeout (ms)`,description:(0,L.jsx)(`span`,{children:"default: server `database.queryTimeout`"}),placeholder:`database.queryTimeout`,min:1e3})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`delayBetweenBatches`,label:`Delay between batches (ms)`,description:(0,L.jsx)(`span`,{children:`default: 0`}),placeholder:`0`,min:0,max:6e4})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`progressLogThreshold`,label:`Log progress every N resources`,description:(0,L.jsx)(`span`,{children:`default: 50,000`}),placeholder:`50000`,min:1})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`endTimestampBufferMinutes`,label:`End timestamp buffer (minutes)`,description:(0,L.jsx)(`span`,{children:`default: 5`}),placeholder:`5`,min:1})}),(0,L.jsx)(km.Col,{span:6,children:(0,L.jsx)(W_,{name:`maxIterationAttempts`,label:`Max iteration attempts`,description:(0,L.jsx)(`span`,{children:`default: 3`}),placeholder:`3`,min:1,max:20})})]})}),(0,L.jsx)(U,{type:`submit`,children:`Reindex`})]})})}function SX({setModalTitle:e,setModalContent:t,openModal:n}){let r=Z(),[i,a]=(0,b.useState)(),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)(),f=(0,b.useMemo)(()=>{if(i?.reference)return{"_has:ProjectMembership:profile:project":i.reference}},[i]);(0,b.useEffect)(()=>{if(d(void 0),!o?.reference&&!i?.reference){l(void 0);return}r.searchResources(`ProjectMembership`,{profile:o?.reference,project:i?.reference,_count:20}).then(e=>{l(e),e.length===1&&d(DC(e[0]))}).catch(e=>{console.error(e),q({color:`red`,message:J(e),autoClose:!1})})},[r,o,i]);let p=(0,b.useMemo)(()=>{let e={};return o?.reference&&(e.profile=o?.reference),i?.reference&&(e.project=i?.reference),e},[o,i]);function m(i){if(!i.query){q({color:`red`,message:`Query is required`,autoClose:!1});return}let a=i.onBehalfOfProjectMembership;delete i.onBehalfOfProjectMembership;let o={query:i.query,analyze:i.analyze===`on`,count:i.count===`on`,format:`text`},s={};a&&(s[`x-medplum-on-behalf-of`]=a),r.post(`fhir/R4/$explain`,o,void 0,{headers:s}).then(r=>{e(`Database Explain`);let i=r.parameter?.find(e=>e.name===`explain`)?.valueString,a=r.parameter?.find(e=>e.name===`query`)?.valueString,o=r.parameter?.find(e=>e.name===`parameters`)?.valueString,s=r.parameter?.find(e=>e.name===`countEstimate`)?.valueInteger?.toLocaleString(),c=r.parameter?.find(e=>e.name===`countAccurate`)?.valueInteger?.toLocaleString(),l=[a,o,`
|
|
222
222
|
`,i].join(`
|
|
223
|
-
`);t((0,L.jsxs)(W,{children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(H,{fw:700,children:`Query`}),(0,L.jsx)(om,{block:!0,maw:`100%`,style:{whiteSpace:`pre-wrap`},children:l})]}),(s||c)&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(H,{fw:700,children:`Counts`}),s&&(0,L.jsxs)(H,{children:[`Estimate: `,s]}),c&&(0,L.jsxs)(H,{children:[`Accurate: `,c]})]})]})),n()}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})})}return!r.isLoading()&&!r.isSuperAdmin()?(0,L.jsx)(oI,{outcome:lS}):(0,L.jsx)(NP,{onSubmit:m,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(jb,{name:`query`,label:`Search`,required:!0,placeholder:`Observation?code=85354-9&_sort=-date&_count=5`}),(0,L.jsxs)(V,{children:[(0,L.jsx)(pp,{name:`analyze`,label:`Analyze`}),(0,L.jsx)(pp,{name:`count`,label:`Total count`})]}),(0,L.jsx)(fd,{label:`On Behalf Of`,children:(0,L.jsxs)(W,{gap:`sm`,children:[(0,L.jsx)(ML,{required:!0,placeholder:`Project`,targetTypes:[`Project`],name:`onBehalfOfProject`,onChange:a}),(0,L.jsx)(ML,{required:!0,placeholder:`Practitioner or Patient`,name:`onBehalfOfProfile`,targetTypes:[`Practitioner`,`Patient`],onChange:s,searchCriteria:f}),c?.length!==1&&(0,L.jsx)(ML,{required:!0,placeholder:`ProjectMembership`,name:`onBehalfOfProjectMembership`,targetTypes:[`ProjectMembership`],onChange:d,searchCriteria:p}),c?.length===1&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`input`,{type:`hidden`,name:`onBehalfOfProjectMembership`,value:OC(c[0])}),(0,L.jsx)(RI,{value:DC(c[0])})]}),!u&&(0,L.jsx)(H,{fs:`italic`,children:`On Behalf Of not set. Running as super admin`})]})}),(0,L.jsx)(U,{type:`submit`,children:`Explain Search`})]})})}var yX=[{label:`All`,value:`Patient,Practitioner,RelatedPerson`},{label:`Practitioner`,value:`Practitioner`},{label:`Patient`,value:`Patient`},{label:`RelatedPerson`,value:`RelatedPerson`}];function bX(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`ProjectMemberships by User and Profile Type`}),(0,L.jsx)(NJ,{profileTypeOptions:yX,fields:[`user`,`profile`,`profile-type`,`accessPolicy`,`userConfiguration`,`active`,`admin`],showMfaEnrollment:!0,toolbarLeft:(0,L.jsx)(U,{component:eN,to:`/admin/invite`,variant:`outline`,color:`blue`,leftSection:(0,L.jsx)(BM,{size:14}),children:`Invite New User`}),toolbarRight:(0,L.jsx)(Rd,{href:`https://www.medplum.com/docs/user-management`,target:`_blank`,rel:`noopener noreferrer`,size:`sm`,children:`Learn more about roles and user management`})})]})}var xX=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 SX(e,t,n){let r=CX(e),{webkitRelativePath:i}=e,a=typeof t==`string`?t:typeof i==`string`&&i.length>0?i:`./${e.name}`;return typeof r.path!=`string`&&wX(r,`path`,a),n!==void 0&&Object.defineProperty(r,"handle",{value:n,writable:!1,configurable:!1,enumerable:!0}),wX(r,`relativePath`,a),r}function CX(e){let{name:t}=e;if(t&&t.lastIndexOf(`.`)!==-1&&!e.type){let n=t.split(`.`).pop().toLowerCase(),r=xX.get(n);r&&Object.defineProperty(e,"type",{value:r,writable:!1,configurable:!1,enumerable:!0})}return e}function wX(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}var TX=[`.DS_Store`,`Thumbs.db`];function EX(e){return d(this,void 0,void 0,function*(){return kX(e)&&DX(e.dataTransfer)?MX(e.dataTransfer,e.type):OX(e)?AX(e):Array.isArray(e)&&e.every(e=>`getFile`in e&&typeof e.getFile==`function`)?jX(e):[]})}function DX(e){return kX(e)}function OX(e){return kX(e)&&kX(e.target)}function kX(e){return typeof e==`object`&&!!e}function AX(e){return PX(e.target.files).map(e=>SX(e))}function jX(e){return d(this,void 0,void 0,function*(){return(yield Promise.all(e.map(e=>e.getFile()))).map(e=>SX(e))})}function MX(e,t){return d(this,void 0,void 0,function*(){if(e.items){let n=PX(e.items).filter(e=>e.kind===`file`);return t===`drop`?NX(IX(yield Promise.all(n.map(FX)))):n}return NX(PX(e.files).map(e=>SX(e)))})}function NX(e){return e.filter(e=>TX.indexOf(e.name)===-1)}function PX(e){if(e===null)return[];let t=[];for(let n=0;n<e.length;n++){let r=e[n];t.push(r)}return t}function FX(e){if(typeof e.webkitGetAsEntry!=`function`)return LX(e);let t=e.webkitGetAsEntry();return t&&t.isDirectory?zX(t):LX(e,t)}function IX(e){return e.reduce((e,t)=>[...e,...Array.isArray(t)?IX(t):[t]],[])}function LX(e,t){return d(this,void 0,void 0,function*(){if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle==`function`){let t=yield e.getAsFileSystemHandle();if(t===null)throw Error(`${e} is not a File`);if(t!==void 0){let e=yield t.getFile();return e.handle=t,SX(e)}}let n=e.getAsFile();if(!n)throw Error(`${e} is not a File`);return SX(n,t?.fullPath??void 0)})}function RX(e){return d(this,void 0,void 0,function*(){return e.isDirectory?zX(e):BX(e)})}function zX(e){let t=e.createReader();return new Promise((e,n)=>{let r=[];function i(){t.readEntries(t=>d(this,void 0,void 0,function*(){if(t.length){let e=Promise.all(t.map(RX));r.push(e),i()}else try{e(yield Promise.all(r))}catch(e){n(e)}}),e=>{n(e)})}i()})}function BX(e){return d(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(n=>{t(SX(n,e.fullPath))},e=>{n(e)})})})}var VX=c(o((e=>{e.__esModule=!0,e.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||``,i=(e.type||``).toLowerCase(),a=i.replace(/\/.*$/,``);return n.some(function(e){var t=e.trim().toLowerCase();return t.charAt(0)===`.`?r.toLowerCase().endsWith(t):t.endsWith(`/*`)?a===t.replace(/\/.*$/,``):i===t})}return!0}}))());function HX(e){return GX(e)||WX(e)||ZX(e)||UX()}function UX(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
224
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
225
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
226
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
227
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BZ(e,t){if(e){if(typeof e==`string`)return VZ(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 VZ(e,t)}}function VZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function HZ(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function UZ(e){if(Array.isArray(e))return e}function WZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function GZ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?WZ(Object(n),!0).forEach(function(t){KZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):WZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function KZ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qZ(e,t){if(e==null)return{};var n=JZ(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function JZ(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var YZ=(0,b.forwardRef)(function(e,t){var n=e.children,r=QZ(qZ(e,AZ)),i=r.open,a=qZ(r,jZ);return(0,b.useImperativeHandle)(t,function(){return{open:i}},[i]),b.createElement(b.Fragment,null,n(GZ(GZ({},a),{},{open:i})))});YZ.displayName=`Dropzone`;var XZ={disabled:!1,getFilesFromEvent:EX,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};YZ.defaultProps=XZ,YZ.propTypes={children:kZ.default.func,accept:kZ.default.objectOf(kZ.default.arrayOf(kZ.default.string)),multiple:kZ.default.bool,preventDropOnDocument:kZ.default.bool,noClick:kZ.default.bool,noKeyboard:kZ.default.bool,noDrag:kZ.default.bool,noDragEventsBubbling:kZ.default.bool,minSize:kZ.default.number,maxSize:kZ.default.number,maxFiles:kZ.default.number,disabled:kZ.default.bool,getFilesFromEvent:kZ.default.func,onFileDialogCancel:kZ.default.func,onFileDialogOpen:kZ.default.func,useFsAccessApi:kZ.default.bool,autoFocus:kZ.default.bool,onDragEnter:kZ.default.func,onDragLeave:kZ.default.func,onDragOver:kZ.default.func,onDrop:kZ.default.func,onDropAccepted:kZ.default.func,onDropRejected:kZ.default.func,onError:kZ.default.func,validator:kZ.default.func};var ZZ={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function QZ(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=GZ(GZ({},XZ),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,a=t.maxSize,o=t.minSize,s=t.multiple,c=t.maxFiles,l=t.onDragEnter,u=t.onDragLeave,d=t.onDragOver,f=t.onDrop,p=t.onDropAccepted,m=t.onDropRejected,h=t.onFileDialogCancel,g=t.onFileDialogOpen,_=t.useFsAccessApi,v=t.autoFocus,y=t.preventDropOnDocument,x=t.noClick,S=t.noKeyboard,C=t.noDrag,w=t.noDragEventsBubbling,T=t.onError,E=t.validator,D=(0,b.useMemo)(function(){return wZ(n)},[n]),O=(0,b.useMemo)(function(){return CZ(n)},[n]),k=(0,b.useMemo)(function(){return typeof g==`function`?g:eQ},[g]),A=(0,b.useMemo)(function(){return typeof h==`function`?h:eQ},[h]),j=(0,b.useRef)(null),M=(0,b.useRef)(null),N=RZ((0,b.useReducer)($Z,ZZ),2),ee=N[0],P=N[1],te=ee.isFocused,ne=ee.isFileDialogActive,re=(0,b.useRef)(typeof window<`u`&&window.isSecureContext&&_&&SZ()),ie=function(){!re.current&&ne&&setTimeout(function(){M.current&&(M.current.files.length||(P({type:`closeDialog`}),A()))},300)};(0,b.useEffect)(function(){return window.addEventListener(`focus`,ie,!1),function(){window.removeEventListener(`focus`,ie,!1)}},[M,ne,A,re]);var ae=(0,b.useRef)([]),oe=(0,b.useRef)([]),se=function(e){j.current&&j.current.contains(e.target)||(e.preventDefault(),ae.current=[])};(0,b.useEffect)(function(){return y&&(document.addEventListener(`dragover`,_Z,!1),document.addEventListener(`drop`,se,!1)),function(){y&&(document.removeEventListener(`dragover`,_Z),document.removeEventListener(`drop`,se))}},[j,y]),(0,b.useEffect)(function(){var e=function(e){oe.current=[].concat(PZ(oe.current),[e.target]),gZ(e)&&P({isDragGlobal:!0,type:`setDragGlobal`})},t=function(e){oe.current=oe.current.filter(function(t){return t!==e.target&&t!==null}),!(oe.current.length>0)&&P({isDragGlobal:!1,type:`setDragGlobal`})},n=function(){oe.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})},r=function(){oe.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})};return document.addEventListener(`dragenter`,e,!1),document.addEventListener(`dragleave`,t,!1),document.addEventListener(`dragend`,n,!1),document.addEventListener(`drop`,r,!1),function(){document.removeEventListener(`dragenter`,e),document.removeEventListener(`dragleave`,t),document.removeEventListener(`dragend`,n),document.removeEventListener(`drop`,r)}},[j]),(0,b.useEffect)(function(){return!r&&v&&j.current&&j.current.focus(),function(){}},[j,v,r]);var ce=(0,b.useCallback)(function(e){T?T(e):console.error(e)},[T]),le=(0,b.useCallback)(function(e){e.preventDefault(),e.persist(),xe(e),ae.current=[].concat(PZ(ae.current),[e.target]),gZ(e)&&Promise.resolve(i(e)).then(function(t){if(!hZ(e)||w){var n=t.length,r=n>0&&mZ({files:t,accept:D,minSize:o,maxSize:a,multiple:s,maxFiles:c,validator:E});P({isDragAccept:r,isDragReject:n>0&&!r,isDragActive:!0,type:`setDraggedFiles`}),l&&l(e)}}).catch(function(e){return ce(e)})},[i,l,ce,w,D,o,a,s,c,E]),ue=(0,b.useCallback)(function(e){e.preventDefault(),e.persist(),xe(e);var t=gZ(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect=`copy`}catch{}return t&&d&&d(e),!1},[d,w]),de=(0,b.useCallback)(function(e){e.preventDefault(),e.persist(),xe(e);var t=ae.current.filter(function(e){return j.current&&j.current.contains(e)}),n=t.indexOf(e.target);n!==-1&&t.splice(n,1),ae.current=t,!(t.length>0)&&(P({type:`setDraggedFiles`,isDragActive:!1,isDragAccept:!1,isDragReject:!1}),gZ(e)&&u&&u(e))},[j,u,w]),fe=(0,b.useCallback)(function(e,t){var n=[],r=[];e.forEach(function(e){var t=RZ(dZ(e,D),2),i=t[0],s=t[1],c=RZ(fZ(e,o,a),2),l=c[0],u=c[1],d=E?E(e):null;if(i&&l&&!d)n.push(e);else{var f=[s,u];d&&(f=f.concat(d)),r.push({file:e,errors:f.filter(function(e){return e})})}}),(!s&&n.length>1||s&&c>=1&&n.length>c)&&(n.forEach(function(e){r.push({file:e,errors:[lZ]})}),n.splice(0)),P({acceptedFiles:n,fileRejections:r,type:`setFiles`}),f&&f(n,r,t),r.length>0&&m&&m(r,t),n.length>0&&p&&p(n,t)},[P,s,D,o,a,c,f,p,m,E]),pe=(0,b.useCallback)(function(e){e.preventDefault(),e.persist(),xe(e),ae.current=[],gZ(e)&&Promise.resolve(i(e)).then(function(t){(!hZ(e)||w)&&fe(t,e)}).catch(function(e){return ce(e)}),P({type:`reset`})},[i,fe,ce,w]),F=(0,b.useCallback)(function(){if(re.current){P({type:`openDialog`}),k();var e={multiple:s,types:O};window.showOpenFilePicker(e).then(function(e){return i(e)}).then(function(e){fe(e,null),P({type:`closeDialog`})}).catch(function(e){TZ(e)?(A(e),P({type:`closeDialog`})):EZ(e)?(re.current=!1,M.current?(M.current.value=null,M.current.click()):ce(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.`))):ce(e)});return}M.current&&(P({type:`openDialog`}),k(),M.current.value=null,M.current.click())},[P,k,A,_,fe,ce,O,s]),me=(0,b.useCallback)(function(e){j.current&&j.current.isEqualNode(e.target)&&(e.key===` `||e.key===`Enter`||e.keyCode===32||e.keyCode===13)&&(e.preventDefault(),F())},[j,F]),he=(0,b.useCallback)(function(){P({type:`focus`})},[]),ge=(0,b.useCallback)(function(){P({type:`blur`})},[]),_e=(0,b.useCallback)(function(){x||(bZ()?setTimeout(F,0):F())},[x,F]),ve=function(e){return r?null:e},ye=function(e){return S?null:ve(e)},be=function(e){return C?null:ve(e)},xe=function(e){w&&e.stopPropagation()},Se=(0,b.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,i=e.role,a=e.onKeyDown,o=e.onFocus,s=e.onBlur,c=e.onClick,l=e.onDragEnter,u=e.onDragOver,d=e.onDragLeave,f=e.onDrop,p=qZ(e,MZ);return GZ(GZ(KZ({onKeyDown:ye(xZ(a,me)),onFocus:ye(xZ(o,he)),onBlur:ye(xZ(s,ge)),onClick:ve(xZ(c,_e)),onDragEnter:be(xZ(l,le)),onDragOver:be(xZ(u,ue)),onDragLeave:be(xZ(d,de)),onDrop:be(xZ(f,pe)),role:typeof i==`string`&&i!==``?i:`presentation`},n,j),!r&&!S?{tabIndex:0}:{}),p)}},[j,me,he,ge,_e,le,ue,de,pe,S,C,r]),Ce=(0,b.useCallback)(function(e){e.stopPropagation()},[]),we=(0,b.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,r=e.onChange,i=e.onClick,a=qZ(e,NZ);return GZ(GZ({},KZ({accept:D,multiple:s,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:ve(xZ(r,pe)),onClick:ve(xZ(i,Ce)),tabIndex:-1},n,M)),a)}},[M,n,s,pe,r]);return GZ(GZ({},ee),{},{isFocused:te&&!r,getRootProps:Se,getInputProps:we,rootRef:j,inputRef:M,open:ve(F)})}function $Z(e,t){switch(t.type){case`focus`:return GZ(GZ({},e),{},{isFocused:!0});case`blur`:return GZ(GZ({},e),{},{isFocused:!1});case`openDialog`:return GZ(GZ({},ZZ),{},{isFileDialogActive:!0});case`closeDialog`:return GZ(GZ({},e),{},{isFileDialogActive:!1});case`setDraggedFiles`:return GZ(GZ({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case`setFiles`:return GZ(GZ({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case`setDragGlobal`:return GZ(GZ({},e),{},{isDragGlobal:t.isDragGlobal});case`reset`:return GZ({},ZZ);default:return e}}function eQ(){}var[tQ,nQ]=Qe(`Dropzone component was not found in tree`),rQ={root:`m_d46a4834`,inner:`m_b85f7144`,fullScreen:`m_96f6e9ad`,dropzone:`m_7946116d`};function iQ(e){let t=t=>{let{children:n,...r}=R(`Dropzone${wt(e)}`,{},t),i=nQ(),a=Xe(n)?n:(0,L.jsx)(`span`,{children:n});return i[e]?(0,b.cloneElement)(a,r):null};return t.displayName=`@mantine/dropzone/${wt(e)}`,t}var aQ=iQ(`accept`),oQ=iQ(`reject`),sQ=iQ(`idle`),cQ={multiple:!0,maxSize:1/0,activateOnClick:!0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,useFsAccessApi:!0,variant:`light`,rejectColor:`red`},lQ=Fn((e,{radius:t,variant:n,acceptColor:r,rejectColor:i})=>{let a=e.variantColorResolver({color:r||e.primaryColor,theme:e,variant:n}),o=e.variantColorResolver({color:i||`red`,theme:e,variant:n});return{root:{"--dropzone-radius":ft(t),"--dropzone-accept-color":a.color,"--dropzone-accept-bg":a.background,"--dropzone-reject-color":o.color,"--dropzone-reject-bg":o.background}}}),uQ=B((e,t)=>{let n=R(`Dropzone`,cQ,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,radius:l,disabled:u,loading:d,multiple:f,maxSize:p,accept:m,children:h,onDropAny:g,onDrop:_,onReject:v,openRef:y,name:b,maxFiles:x,autoFocus:S,activateOnClick:C,activateOnDrag:w,dragEventsBubbling:T,activateOnKeyboard:E,onDragEnter:D,onDragLeave:O,onDragOver:k,onFileDialogCancel:A,onFileDialogOpen:j,preventDropOnDocument:M,useFsAccessApi:N,getFilesFromEvent:ee,validator:P,rejectColor:te,acceptColor:ne,enablePointerEvents:re,loaderProps:ie,inputProps:ae,mod:oe,attributes:se,...ce}=n,le=ui({name:`Dropzone`,classes:rQ,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:se,vars:c,varsResolver:lQ}),{getRootProps:ue,getInputProps:de,isDragAccept:fe,isDragReject:pe,isDragActive:F,open:me}=QZ({onDrop:g,onDropAccepted:_,onDropRejected:v,disabled:u||d,accept:Array.isArray(m)?m.reduce((e,t)=>({...e,[t]:[]}),{}):m,multiple:f,maxSize:p,maxFiles:x,autoFocus:S,noClick:!C,noDrag:!w,noDragEventsBubbling:!T,noKeyboard:!E,onDragEnter:D,onDragLeave:O,onDragOver:k,onFileDialogCancel:A,onFileDialogOpen:j,preventDropOnDocument:M,useFsAccessApi:N,validator:P,...ee?{getFilesFromEvent:ee}:null});on(y,me);let he=F&&fe,ge=F&&pe,_e=!he&&!ge;return(0,L.jsx)(tQ,{value:{accept:he,reject:ge,idle:_e},children:(0,L.jsxs)(z,{...ue(),...le(`root`,{focusable:!0}),...ce,mod:[{accept:he,reject:ge,idle:_e,disabled:u,loading:d,"activate-on-click":C},oe],children:[(0,L.jsx)(Mh,{visible:d,overlayProps:{radius:l},unstyled:s,loaderProps:ie}),(0,L.jsx)(`input`,{...de(ae),name:b}),(0,L.jsx)(`div`,{...le(`inner`),ref:t,"data-enable-pointer-events":re||void 0,children:h})]})})});uQ.classes=rQ,uQ.displayName=`@mantine/dropzone/Dropzone`,uQ.Accept=aQ,uQ.Idle=sQ,uQ.Reject=oQ;var dQ={maxSize:1/0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,active:!0,zIndex:st(`max`),withinPortal:!0},fQ=B((e,t)=>{let n=R(`DropzoneFullScreen`,dQ,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,active:l,onDrop:u,onReject:d,zIndex:f,withinPortal:p,portalProps:m,attributes:h,...g}=n,_=ui({name:`DropzoneFullScreen`,classes:rQ,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:h,rootSelector:`fullScreen`}),{resolvedClassNames:v,resolvedStyles:y}=qr({classNames:r,styles:o,props:n}),[x,S]=(0,b.useState)(0),[C,{open:w,close:T}]=wn(!1),E=e=>{e.dataTransfer?.types.includes(`Files`)&&(S(e=>e+1),w())},D=()=>{S(e=>e-1)};return(0,b.useEffect)(()=>{x===0&&T()},[x]),(0,b.useEffect)(()=>{if(l)return document.addEventListener(`dragenter`,E,!1),document.addEventListener(`dragleave`,D,!1),()=>{document.removeEventListener(`dragenter`,E,!1),document.removeEventListener(`dragleave`,D,!1)}},[l]),(0,L.jsx)(Rl,{...m,withinPortal:p,children:(0,L.jsx)(z,{ref:t,..._(`fullScreen`,{style:{opacity:+!!C,pointerEvents:C?`all`:`none`,zIndex:f}}),children:(0,L.jsx)(uQ,{activateOnClick:!1,...g,classNames:v,styles:y,unstyled:s,className:rQ.dropzone,onDrop:e=>{u?.(e),T(),S(0)},onReject:e=>{d?.(e),T(),S(0)}})})})});fQ.classes=rQ,fQ.displayName=`@mantine/dropzone/DropzoneFullScreen`,uQ.FullScreen=fQ;var pQ=uQ,mQ=`{"resourceType": "Bundle"}`;function hQ({id:e,title:t,message:n,color:r,icon:i,withCloseButton:a=!1,method:o=`show`,loading:s}){Zb[o]({id:e,loading:s,title:t,message:n,color:r,icon:i,withCloseButton:a,autoClose:!1})}function gQ(){let e=Dr(),t=Z(),[n,r]=(0,b.useState)(mQ),[i,a]=(0,b.useState)({}),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(!1),u=wn(!1),d=(0,b.useCallback)(async(e,n)=>{let r=`batch-upload`;hQ({id:r,title:`Batch Upload in Progress`,message:`Your batch data is being uploaded. This may take a moment...`,method:`show`,loading:!0});try{a({});let i=JSON.parse(e);i.type!==`batch`&&i.type!==`transaction`&&(i=_D(i));let o=await t.executeBatch(i);a(e=>({...e,[n]:o})),hQ({id:r,title:`Batch Upload Successful`,message:`Your batch data was successfully uploaded.`,color:`green`,method:`update`,icon:(0,L.jsx)(jj,{size:`1rem`}),withCloseButton:!0})}catch(e){hQ({id:r,title:`Batch Upload Failed`,color:`red`,message:J(e),method:`update`,icon:(0,L.jsx)(HM,{size:`1rem`}),withCloseButton:!0})}},[t]),f=(0,b.useCallback)(async e=>{for(let t of e){let e=new FileReader;e.onload=e=>d(e.target?.result,t.name),e.readAsText(t)}},[d]),p=(0,b.useCallback)(async e=>{await d(e.input,`JSON Data`)},[d]),m=(0,b.useCallback)(async e=>{if(e=e.trim(),e){if(l(!0),hQ({id:`smart-scan`,title:`SMART Scan in Progress`,message:`Reading SMART data...`,method:`show`,loading:!0}),e.startsWith(`shc:`)){try{let n=await t.post(t.fhirUrl(`$verify-smart-health-card`),{shcUri:e}),i=n.parameter?.find(e=>e.name===`fhirBundle`)?.valueString;if(i){let e=JSON.parse(i);r(VC(e,!0))}n.parameter?.find(e=>e.name===`valid`)?.valueBoolean?hQ({id:`smart-scan`,title:`SMART Health Card Verified`,message:`Your SMART Health Card data was successfully verified.`,color:`green`,method:`update`,icon:(0,L.jsx)(jj,{size:`1rem`}),withCloseButton:!0}):hQ({id:`smart-scan`,title:`SMART Health Card Verification Failed`,color:`red`,message:`Your SMART Health Card data could not be verified.`,method:`update`,icon:(0,L.jsx)(HM,{size:`1rem`}),withCloseButton:!0})}catch(e){hQ({id:`smart-scan`,title:`SMART Health Card Verification Failed`,color:`red`,message:J(e),method:`update`,icon:(0,L.jsx)(HM,{size:`1rem`}),withCloseButton:!0})}finally{l(!1)}return}try{let n=await t.post(t.fhirUrl(`$resolve-smart-health-link`),{shlink:e,recipient:`Medplum App`}),i=n.parameter?.find(e=>e.name===`valid`)?.valueBoolean,a=n.parameter?.find(e=>e.name===`error`)?.valueString,o=n.parameter?.filter(e=>e.name===`warning`).map(e=>e.valueString).filter(Boolean);if(!i)throw Error(a||`SMART Health Link could not be resolved.`);let s=JSON.parse(n.parameter?.find(e=>e.name===`fhirResources`)?.valueString??`[]`).find(e=>e.resourceType===`Bundle`);if(!s)throw Error(`SMART Health Link did not contain a FHIR Bundle.`);r(VC(s,!0)),hQ({id:`smart-scan`,title:`SMART Health Link Resolved`,message:o?.length?o.join(`
|
|
228
|
-
`):`Your SMART Health Link data was successfully resolved.`,color:o?.length?`yellow`:`green`,method:`update`,icon:(0,L.jsx)(jj,{size:`1rem`}),withCloseButton:!0})}catch(e){hQ({id:`smart-scan`,title:`SMART Health Link Failed`,color:`red`,message:J(e),method:`update`,icon:(0,L.jsx)(HM,{size:`1rem`}),withCloseButton:!0})}finally{l(!1)}}},[t]);return(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{order:1,children:`Batch Create`}),(0,L.jsxs)(H,{children:[`Use this page to create, read, or update multiple resources. For more details, see`,` `,(0,L.jsx)(Rd,{href:`https://www.hl7.org/fhir/http.html#transaction`,children:`FHIR Batch and Transaction`}),`.`]}),Object.keys(i).length===0&&(0,L.jsxs)(Ab,{defaultValue:`upload`,mt:`xl`,children:[(0,L.jsxs)(Ab.List,{children:[(0,L.jsx)(Ab.Tab,{value:`upload`,children:`File Upload`}),(0,L.jsx)(Ab.Tab,{value:`json`,children:`JSON`})]}),(0,L.jsx)(Ab.Panel,{value:`upload`,pt:`xs`,children:(0,L.jsx)(pQ,{onDrop:f,accept:[`application/json`],children:(0,L.jsxs)(V,{justify:`center`,gap:`xl`,style:{minHeight:220,pointerEvents:`none`},children:[(0,L.jsx)(pQ.Accept,{children:(0,L.jsx)(zM,{size:50,stroke:1.5,color:e.colors[e.primaryColor][5]})}),(0,L.jsx)(pQ.Reject,{children:(0,L.jsx)(HM,{size:50,stroke:1.5,color:e.colors.red[5]})}),(0,L.jsx)(pQ.Idle,{children:(0,L.jsx)(zM,{size:50,stroke:1.5})}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(H,{size:`xl`,inline:!0,children:`Drag files here or click to select files`}),(0,L.jsx)(H,{size:`sm`,color:`dimmed`,inline:!0,mt:7,children:`Attach as many files as you like`})]})]})})}),(0,L.jsx)(Ab.Panel,{value:`json`,pt:`xs`,children:(0,L.jsxs)(NP,{onSubmit:p,children:[(0,L.jsx)(vh,{"data-testid":`batch-input`,name:`input`,autosize:!0,minRows:20,value:n,onChange:r,deserialize:JSON.parse}),(0,L.jsxs)(V,{justify:`flex-end`,mt:`xl`,wrap:`nowrap`,children:[(0,L.jsx)(U,{type:`submit`,children:`Submit`}),(0,L.jsx)(U,{variant:`default`,onClick:()=>u[1].open(),children:`SMART`})]})]})})]}),Object.keys(i).length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h3`,{children:`Output`}),(0,L.jsxs)(Ab,{defaultValue:Object.keys(i)[0],children:[(0,L.jsx)(Ab.List,{children:Object.keys(i).map(e=>(0,L.jsx)(Ab.Tab,{value:e,children:e},e))}),Object.keys(i).map(e=>(0,L.jsx)(Ab.Panel,{value:e,children:(0,L.jsx)(`pre`,{style:{border:`1px solid #888`},children:JSON.stringify(i[e],void 0,2)})},e))]}),(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,wrap:`nowrap`,children:(0,L.jsx)(U,{onClick:()=>a({}),children:`Start over`})})]}),(0,L.jsx)(pg,{title:`SMART`,size:`xl`,opened:u[0],onClose:u[1].close,children:(0,L.jsxs)(W,{children:[(0,L.jsxs)(V,{align:`end`,children:[(0,L.jsx)(jb,{label:`SMART Health Link`,placeholder:`shlink:/...`,value:o,onChange:e=>s(e.currentTarget.value),style:{flex:1}}),(0,L.jsx)(U,{loading:c,onClick:()=>{u[1].close(),m(o).catch(console.error)},children:`Resolve`})]}),(0,L.jsx)(HV,{onScan:e=>{u[1].close(),m(e).catch(console.error)}})]})})]})}function _Q(){let{resourceType:e}=zK(),t=(Object.fromEntries(new URLSearchParams(location.search).entries()).ids||``).split(`,`).filter(e=>!!e),[n]=YA(`Questionnaire`,`subject-type=${e}`);return n?n.length===0?(0,L.jsxs)(LF,{children:[(0,L.jsxs)(K,{children:[`No apps for `,e]}),(0,L.jsx)(eN,{to:`/${e}`,children:`Return to search page`})]}):(0,L.jsx)(LF,{children:(0,L.jsx)(`div`,{children:n.map(n=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{children:(0,L.jsx)(eN,{to:`/forms/${n.id}?subject=`+t.map(t=>`${e}/${t}`).join(`,`),children:n.name})}),(0,L.jsx)(`p`,{children:n.description})]},n.id))})}):(0,L.jsx)(GM,{})}function vQ(){return(0,L.jsx)(WF,{})}var yQ=[`Form`,`JSON`,`Profiles`];function bQ(){let{resourceType:e}=zK();return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Cl,{children:[(0,L.jsxs)(H,{p:`md`,fw:500,children:[`New\xA0`,e]}),(0,L.jsx)(ml,{children:(0,L.jsx)(tV,{baseUrl:`/${e}/new`,tabs:yQ})})]}),(0,L.jsx)(hq,{})]})}function xQ(){return(0,L.jsx)(LF,{children:(0,L.jsxs)(W,{children:[(0,L.jsx)(K,{order:1,children:`Unexpected Error`}),(0,L.jsx)(H,{children:`We're sorry, something went wrong.`}),(0,L.jsxs)(H,{children:[`Please contact `,(0,L.jsx)(Rd,{href:`mailto:support@medplum.com`,children:`support`}),` for assistance.`]})]})})}function SQ(e){let t=eA(e.resource);if(!t)return null;let n=[{key:`Type`,value:(0,L.jsx)(eN,{to:`/${t.resourceType}`,children:t.resourceType})}];function r(e,t){e&&t&&n.push({key:e,value:t})}function i(e){e&&r(e.system,e.value)}function a(e,t){Array.isArray(t)?t.forEach(t=>a(e,t)):typeof t==`string`?r(e,t):t&&(Array.isArray(t.coding)?r(e,t.coding.map(e=>e.display||e.code).join(`, `)):r(e,t.text))}if(`name`in t){let e=MC(t);e!==OC(t)&&r(`Name`,e)}return`category`in t&&a(`Category`,t.category),t.resourceType!==`Bot`&&`code`in t&&a(`Code`,t.code),`identifier`in t&&(Array.isArray(t.identifier)?t.identifier.forEach(i):i(t.identifier)),n.length===1&&n.push({key:`ID`,value:t.id}),(0,L.jsx)(ZB,{children:n.map((e,t)=>(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(ZB.Key,{children:e.key}),(0,L.jsx)(ZB.Value,{children:e.value})]},`${e.key}-${t}`))})}function CQ(){let{id:e}=zK(),t=NK(),n=Object.fromEntries(new URLSearchParams(t.search).entries()).subject,r=Z(),[i,a]=(0,b.useState)(!0),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)(),[f,p]=(0,b.useState)(),[m,h]=(0,b.useState)();if((0,b.useEffect)(()=>{let t={resourceType:`Bundle`,type:`batch`,entry:[{request:{method:`GET`,url:`Questionnaire/${e}`}}]};if(n){let e=n.split(`,`).filter(e=>!!e);e.length===1&&t.entry.push({request:{method:`GET`,url:e[0]}}),l(e)}r.executeBatch(t).then(e=>{e.entry?.[0]?.response?.status===`200`?(s(e.entry[0]?.resource),d(e.entry[1]?.resource)):p(e.entry?.[0]?.response?.outcome),a(!1)}).catch(e=>{p(e),a(!1)})},[r,e,n]),f)return(0,L.jsx)(LF,{children:(0,L.jsx)(`pre`,{"data-testid":`error`,children:JSON.stringify(f,void 0,2)})});if(m)return(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:o?.title}),(0,L.jsx)(`p`,{children:`Your response has been recorded.`}),(0,L.jsxs)(`ul`,{children:[m.length===1&&(0,L.jsx)(`li`,{children:(0,L.jsx)(eN,{to:m[0],children:`Review your answers`})}),m.length>1&&(0,L.jsxs)(`li`,{children:[`Review your answers:`,(0,L.jsx)(`ul`,{children:m.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(eN,{to:e,children:OC(e)})},e.id))})]}),u&&(0,L.jsx)(`li`,{children:(0,L.jsxs)(eN,{to:u,children:[`Back to\xA0`,MC(u)]})}),(0,L.jsx)(`li`,{children:(0,L.jsx)(eN,{to:`/`,children:`Go back home`})})]})]});if(i||!o)return(0,L.jsx)(GM,{});let g=u&&wJ(u);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Cl,{shadow:`xs`,radius:0,children:[g&&(0,L.jsx)(SV,{patient:g}),u&&u.resourceType!==`Patient`&&(0,L.jsx)(SQ,{resource:u}),(0,L.jsx)(z,{px:`xl`,py:`md`,children:(0,L.jsxs)(H,{children:[MC(o),c&&c.length>1&&(0,L.jsxs)(L.Fragment,{children:[`\xA0(for `,c.length,` resources)`]})]})})]}),(0,L.jsx)(LF,{children:(0,L.jsx)(NH,{questionnaire:o,subject:u&&DC(u),onSubmit:_})})]});async function _(e){let t=[];if(!c||c.length===0)t.push(await r.createResource(e));else for(let n of c)t.push(await r.createResource({...e,subject:{reference:n}}));h(t)}}var wQ={paper:`_paper_unw9o_1`},TQ={Bot:`/admin/bots/new`,ClientApplication:`/admin/clients/new`};function EQ(e,t){let n=e.resourceType||DQ(t),r=e.fields??OQ(n),i=e.filters??(e.resourceType?void 0:kQ(n)),a=e.sortRules??AQ(n),o=e.offset??0,s=e.count??20;return{...e,resourceType:n,fields:r,filters:i,sortRules:a,offset:o,count:s}}function DQ(e){return localStorage.getItem(`defaultResourceType`)??e?.option?.find(e=>e.id===`defaultResourceType`)?.valueString??`Patient`}function OQ(e){let t=jQ(e);if(t?.fields)return t.fields;let 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`)}return n}function kQ(e){return jQ(e)?.filters}function AQ(e){let t=jQ(e);return t?.sortRules?t.sortRules:[{code:`_lastUpdated`,descending:!0}]}function jQ(e){let t=localStorage.getItem(e+`-defaultSearch`);return t?JSON.parse(t):void 0}function MQ(e){localStorage.setItem(`defaultResourceType`,e.resourceType),localStorage.setItem(e.resourceType+`-defaultSearch`,JSON.stringify(e))}async function NQ(e,t){let n=EQ({...e,count:1e3,offset:0},t.getUserConfiguration());return _D(await t.search(n.resourceType,FE({...n,total:`accurate`,fields:void 0})))}function PQ(){let e=Z(),t=FK(),n=NK(),[r,i]=(0,b.useState)();return(0,b.useEffect)(()=>{let r=EQ(CE(n.pathname+n.search),e.getUserConfiguration());n.pathname===`/${r.resourceType}`&&n.search===FE(r)?(MQ(r),i(r)):t(`/${r.resourceType}${FE(r)}`,{replace:!0})?.catch(console.error)},[e,t,n]),!r?.resourceType||!r.fields||r.fields.length===0?(0,L.jsx)(GM,{}):(0,L.jsxs)(Cl,{shadow:`xs`,m:`md`,p:`md`,className:wQ.paper,children:[(0,L.jsx)(K,{order:4,mb:`md`,children:r.resourceType}),(0,L.jsx)(hm,{mb:`md`}),(0,L.jsx)(zB,{checkboxesEnabled:!0,search:r,onClick:e=>t(`/${e.resource.resourceType}/${e.resource.id}`)?.catch(console.error),onAuxClick:e=>window.open(`/${e.resource.resourceType}/${e.resource.id}`,`_blank`),onChange:e=>{t(`/${r.resourceType}${FE(e.definition)}`)?.catch(console.error)},onNew:()=>{t(TQ[r.resourceType]??`/${r.resourceType}/new`)?.catch(console.error)},onExportCsv:()=>{let t=e.fhirUrl(r.resourceType,`$csv`)+FE(r);e.download(t).then(e=>{window.open(window.URL.createObjectURL(e),`_blank`)}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},onExportTransactionBundle:async()=>{NQ(r,e).then(e=>$M(JSON.stringify(e,void 0,2))).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},onDelete:t=>(e.invalidateSearches(r.resourceType),e.executeBatch({resourceType:`Bundle`,type:`batch`,entry:t.map(e=>({request:{method:`DELETE`,url:`${r.resourceType}/${e}`}}))}).then(()=>void 0).catch(e=>{throw q({color:`red`,message:J(e),autoClose:!1}),e})),onBulk:e=>{t(`/bulk/${r.resourceType}?ids=${e.join(`,`)}`)?.catch(console.error)}})]})}function FQ(){let[e]=YA(`ObservationDefinition`,`_count=100`);return e?(0,L.jsxs)(G,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Category`}),(0,L.jsx)(`th`,{children:`Code`}),(0,L.jsx)(`th`,{children:`Method`}),(0,L.jsx)(`th`,{children:`Unit`}),(0,L.jsx)(`th`,{children:`Precision`}),(0,L.jsx)(`th`,{children:`Ranges`})]})}),(0,L.jsx)(`tbody`,{children:e.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(TI,{value:e.category?.[0]})}),(0,L.jsx)(`td`,{children:(0,L.jsx)(TI,{value:e.code})}),(0,L.jsx)(`td`,{children:(0,L.jsx)(TI,{value:e.method})}),(0,L.jsx)(`td`,{children:e.quantitativeDetails?.unit?.text}),(0,L.jsx)(`td`,{children:e.quantitativeDetails?.decimalPrecision}),(0,L.jsx)(`td`,{children:(0,L.jsx)(IQ,{ranges:e.qualifiedInterval})})]},e.id))})]}):(0,L.jsx)(GM,{})}function IQ(e){let{ranges:t}=e;if(!t)return null;let n=LQ(t.map(e=>e.gender));if(n.length>1)return yw(n),(0,L.jsx)(L.Fragment,{children:n.map(t=>(0,L.jsxs)(b.Fragment,{children:[(0,L.jsx)(`div`,{children:(0,L.jsx)(`strong`,{children:dw(t)})}),(0,L.jsx)(IQ,{ranges:e.ranges?.filter(e=>e.gender===t)})]},t))});let r=LQ(t.map(e=>e.age&&Vw(e.age)));return r.length>1?(yw(r),(0,L.jsx)(L.Fragment,{children:r.map(t=>(0,L.jsxs)(b.Fragment,{children:[(0,L.jsx)(`div`,{children:(0,L.jsx)(`strong`,{children:dw(t)})}),(0,L.jsx)(IQ,{ranges:e.ranges?.filter(e=>Vw(e.age)===t)})]},t))})):(0,L.jsx)(L.Fragment,{children:t.map(e=>(0,L.jsx)(`table`,{children:(0,L.jsx)(`tbody`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:e.condition}),(0,L.jsx)(`td`,{children:(0,L.jsx)(II,{value:e.range})})]})})},`range-${e.condition}`))})}function LQ(e){return[...new Set(e.filter(e=>!!e))]}function RQ(){let[e]=YA(`ActivityDefinition`,`_count=100`),[t]=YA(`ObservationDefinition`,`_count=100`);return!e||!t?(0,L.jsx)(GM,{}):(0,L.jsxs)(G,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Category`}),(0,L.jsx)(`th`,{children:`Assay`}),e.map(e=>(0,L.jsx)(`th`,{children:e.name},e.id))]})}),(0,L.jsx)(`tbody`,{children:t.map(t=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(TI,{value:t.category?.[0]})}),(0,L.jsx)(`td`,{children:(0,L.jsx)(TI,{value:t.code})}),e.map(e=>(0,L.jsx)(`td`,{children:e.observationResultRequirement?.find(e=>e.reference?.includes(t.id))?`✅`:``},e.id))]},t.id))})]})}var zQ={totp:`Authenticator app`,email:`Email`};function BQ(){let e=Z(),[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(void 0),[a,o]=(0,b.useState)([]),[s,c]=(0,b.useState)([]),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(),[p,m]=(0,b.useState)(!1),[h,g]=(0,b.useState)(!1),[_,v]=(0,b.useState)(!1),[y,x]=(0,b.useState)(),S=(0,b.useCallback)(()=>{e.get(`auth/mfa/status`,{cache:`no-cache`}).then(e=>{n(e.enrollQrCode),i(e.enrolled),o(e.enrolledMethods??[]),c(e.allowedMethods??[`totp`]),u(!!e.mfaRequired),f(e.email)}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[e]);(0,b.useEffect)(()=>{S()},[S]);let C=(0,b.useCallback)(e=>{i(!0),o(t=>t.includes(e)?t:[...t,e])},[]),w=(0,b.useCallback)(t=>{e.post(`auth/mfa/enroll`,{method:`totp`,token:t}).then(()=>{m(!1),C(`totp`),q({color:`green`,message:`Authenticator app enabled`})}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[e,C]),T=(0,b.useCallback)(async()=>{await e.post(`auth/mfa/send-email-challenge`,{})},[e]),E=(0,b.useCallback)(()=>{T().then(()=>g(!0)).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[T]),D=(0,b.useCallback)(async t=>{await e.post(`auth/mfa/enroll`,{method:`email`,token:t}),g(!1),C(`email`),q({color:`green`,message:`Email-based MFA enabled`})},[e,C]),O=(0,b.useCallback)(async t=>e.post(`auth/mfa/disable`,{token:t}),[e]),k=(0,b.useCallback)(async(t,n)=>{await e.post(`auth/mfa/disable`,{method:t,token:n}),x(void 0),q({color:`green`,message:`${zQ[t]} removed`}),S()},[e,S]);if(r===void 0)return null;let A=s.includes(`email`),j=s.includes(`totp`),M=a.includes(`email`),N=a.includes(`totp`),ee=(0,L.jsx)(pg,{title:`Verify your email`,opened:h,onClose:()=>g(!1),children:(0,L.jsx)(aI,{methods:[`email`],email:d,initialEmailMode:!0,onRequestEmailCode:T,onSubmit:D,buttonText:`Verify and enable`})});if(r){let e=A&&!M,n=j&&!N,r=a.length>1,s=M&&!N,c=()=>{s&&T().catch(e=>q({color:`red`,message:J(e),autoClose:!1})),v(!0)},u=e=>{s&&T().catch(e=>q({color:`red`,message:J(e),autoClose:!1})),x(e)};return(0,L.jsxs)(LF,{width:400,children:[ee,(0,L.jsx)(pg,{title:`Disable MFA`,opened:_,onClose:()=>v(!1),children:(0,L.jsx)(aI,{methods:a,email:d,initialEmailMode:s,onRequestEmailCode:T,onSubmit:async e=>{await O(e),v(!1),i(!1),o([]),m(!1),q({id:`mfa-disabled`,color:`green`,title:`Success`,message:`MFA disabled`,icon:(0,L.jsx)(Pj,{})}),S()}})}),(0,L.jsx)(pg,{title:y?`Remove ${zQ[y]}`:void 0,opened:!!y,onClose:()=>x(void 0),children:y&&(0,L.jsx)(aI,{methods:a,email:d,initialEmailMode:s,onRequestEmailCode:T,onSubmit:e=>k(y,e)})}),(0,L.jsx)(pg,{opened:p,onClose:()=>m(!1),children:(0,L.jsx)(rI,{title:`Add an authenticator app`,description:`Scan this QR code with your authenticator app, then enter the code it generates.`,buttonText:`Enroll`,qrCodeUrl:t,onSubmit:e=>w(e.token)})}),(0,L.jsxs)(W,{children:[(0,L.jsxs)(Xp,{py:`xs`,style:{flexDirection:`column`},children:[(0,L.jsx)(RF,{size:32}),(0,L.jsx)(K,{order:3,py:`md`,ta:`center`,children:`Multi-factor authentication`})]}),(0,L.jsxs)(W,{pb:`lg`,children:[(0,L.jsx)(H,{c:`dimmed`,children:`Enabled methods:`}),(0,L.jsx)(Oh,{children:a.map(e=>(0,L.jsx)(Oh.Item,{children:(0,L.jsxs)(V,{justify:`space-between`,wrap:`nowrap`,children:[(0,L.jsx)(H,{children:zQ[e]}),r&&(0,L.jsx)(Rd,{href:`#`,c:`red`,onClick:()=>u(e),children:`Remove`})]})},e))})]}),(e||n)&&(0,L.jsxs)(W,{children:[e&&(0,L.jsx)(U,{variant:`default`,onClick:E,children:`Add email-based MFA`}),n&&(0,L.jsx)(U,{variant:`default`,onClick:()=>m(!0),children:`Add an authenticator app`})]}),!l&&(0,L.jsx)(V,{children:(0,L.jsx)(U,{color:`red`,variant:`outline`,onClick:c,fullWidth:!0,children:`Disable MFA`})})]})]})}return(0,L.jsxs)(LF,{width:400,children:[ee,(0,L.jsx)(iI,{allowedMethods:s,qrCodeUrl:t,onEnrollEmail:E,onEnrollTotp:w,totpTitle:`Multi Factor Auth Setup`})]})}var VQ={baseUrl:`__MEDPLUM_BASE_URL__`,clientId:`__MEDPLUM_CLIENT_ID__`,googleClientId:`__GOOGLE_CLIENT_ID__`,recaptchaSiteKey:`__RECAPTCHA_SITE_KEY__`,registerEnabled:`__MEDPLUM_REGISTER_ENABLED__`,awsTextractEnabled:void 0};function HQ(){return VQ}function UQ(){return GQ(`registerEnabled`)}function WQ(){return GQ(`awsTextractEnabled`)}function GQ(e){try{return VQ[e]!==!1&&VQ[e]!==`false`}catch{return!0}}function KQ(){let e=FK(),[t]=dJ(),n=Z(),r=t.get(`scope`)||`openid`,i=t.get(`client_id`),a=t.get(`login`),o=!!i&&i!==`medplum-cli`,[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)(o);if((0,b.useEffect)(()=>{if(!o)return;async function e(){try{let e=await n.get(`/auth/clientinfo/${i}`);c(e)}catch(e){q({id:`clientinfofail`,title:`Failed to retrieve client information.`,color:`red`,message:J(e),withCloseButton:!0})}finally{u(!1)}}e().catch(console.error)},[n,i,o]),!i)return null;if(l)return(0,L.jsx)(GM,{});function d(e){let n=new URL(t.get(`redirect_uri`));for(let e of[`scope`,`state`,`nonce`])t.has(e)&&n.searchParams.set(e,t.get(e));n.searchParams.set(`code`,e),uD.assign(n.toString())}return(0,L.jsxs)(wI,{onCode:d,onForgotPassword:()=>e(`/resetpassword`)?.catch(console.error),onRegister:()=>e(`/register`)?.catch(console.error),googleClientId:HQ().googleClientId,clientId:i||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:s?.showScopeSelection??r!==`openid`,login:a||void 0,children:[s?.logo?.url?(0,L.jsx)(`img`,{src:s?.logo?.url,alt:`Welcome Logo`,height:60,style:{width:`auto`}}):(0,L.jsx)(RF,{size:32}),(0,L.jsx)(K,{children:s?.welcomeString??`Sign in to Medplum`})]})}function qQ(){let e=Z(),t=FK(),[n]=dJ(),r=HQ();return(0,b.useEffect)(()=>{e.getProfile()&&t(`/signin?project=new`)?.catch(console.error)},[e,t]),UQ()?(0,L.jsxs)(mI,{type:`project`,projectId:`new`,onSuccess:()=>{window.location.href=`/`},googleClientId:r.googleClientId,recaptchaSiteKey:r.recaptchaSiteKey,login:n.get(`login`)||void 0,onSignIn:()=>t(`/signin`)?.catch(console.error),children:[(0,L.jsx)(RF,{size:32}),(0,L.jsx)(K,{order:3,py:`lg`,children:`Register a new account`})]}):(0,L.jsx)(LF,{width:450,children:(0,L.jsx)(jd,{icon:(0,L.jsx)(pj,{size:16}),title:`New projects disabled`,color:`red`,children:`New projects are disabled on this server.`})})}function JQ(){let e=FK(),[t]=dJ(),n=HQ(),r=t.get(`project`)||void 0;return(0,L.jsx)(hI,{projectId:r,recaptchaSiteKey:n.recaptchaSiteKey,onSignIn:()=>e(`/signin`)?.catch(console.error),onRegister:UQ()?()=>e(`/register`)?.catch(console.error):void 0})}function YQ(){let{resourceType:e,id:t}=zK(),n=eA({reference:e+`/`+t}),r=FK(),i=(0,b.useCallback)(()=>{r(0)?.catch(console.error)},[r]);return n?(0,L.jsx)(LF,{maw:700,children:n.resourceType===`Patient`?(0,L.jsx)(mV,{patient:n,onSaved:i}):(0,L.jsx)(jd,{icon:(0,L.jsx)(pj,{size:16}),title:`Unsupported resource type`,color:`red`,children:`Account management is only supported for Patient resources`})}):null}function XQ(e){let t=Z(),[n,r]=(0,b.useState)(),[i,a]=(0,b.useState)();return i?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{children:`Request group created successfully.`}),(0,L.jsxs)(`ul`,{children:[(0,L.jsxs)(`li`,{children:[`Go to the`,` `,(0,L.jsx)(eN,{to:i,suffix:`checklist`,children:`Request Group`})]}),(0,L.jsxs)(`li`,{children:[`Back to the `,(0,L.jsx)(eN,{to:e.planDefinition,children:`Plan Definition`})]})]})]}):(0,L.jsx)(NP,{onSubmit:()=>{t.post(t.fhirUrl(`PlanDefinition`,e.planDefinition.id,`$apply`),{resourceType:`Parameters`,parameter:[{name:`subject`,valueString:n?.reference}]}).then(a).catch(console.log)},children:(0,L.jsxs)(W,{children:[(0,L.jsxs)(K,{children:[`Start "`,e.planDefinition.title,`"`]}),(0,L.jsxs)(H,{children:[`Use the `,(0,L.jsx)(`strong`,{children:`Apply`}),` operation to create a group of tasks for a workflow.`]}),(0,L.jsx)(H,{children:`The following tasks will be created:`}),(0,L.jsx)(`ul`,{children:e.planDefinition.action?.map((e,t)=>(0,L.jsxs)(`li`,{children:[e.definitionCanonical?.startsWith(`Questionnaire/`)&&`Questionnaire request: `,e.title&&(0,L.jsx)(L.Fragment,{children:e.title}),e.code&&(0,L.jsx)(TI,{value:e.code[0]})]},`action-${t}`))}),(0,L.jsx)(eL,{title:`Subject`,children:(0,L.jsx)(ML,{name:`subject`,targetTypes:[`Patient`,`Practitioner`],defaultValue:n,onChange:r})}),(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,children:(0,L.jsx)(U,{type:`submit`,children:`Go`})})]})})}function ZQ(){let{resourceType:e,id:t}=zK(),n=eA({reference:e+`/`+t});return n?(0,L.jsx)(LF,{children:(0,L.jsx)(XQ,{planDefinition:n})}):null}function QQ(){let{resourceType:e,id:t}=zK(),n=eA({reference:e+`/`+t}),[r,i]=YA(`Questionnaire`,`subject-type=`+e),[a,o]=YA(`ClientApplication`,{_count:1e3});if(!n||i||o)return(0,L.jsx)(GM,{});let s=a?.filter(t=>$Q(e)&&!!t.launchUri);if((!r||r.length===0)&&(!s||s.length===0))return(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Apps`}),(0,L.jsxs)(`p`,{children:[`No apps found. Contact your administrator or `,(0,L.jsx)(`a`,{href:`mailto:support@medplum.com`,children:`Medplum Support`}),` to add automation here.`]})]});let c,l;return n.resourceType===`Patient`?c=DC(n):n.resourceType===`Encounter`&&(c=n.subject,l=DC(n)),(0,L.jsxs)(LF,{children:[r?.map(e=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(K,{order:3,children:(0,L.jsx)(eN,{to:`/forms/${e.id}?subject=${OC(n)}`,children:e.title||e.name})}),(0,L.jsx)(H,{children:e.description})]},e.id)),s?.map(e=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(K,{order:3,children:(0,L.jsx)(yJ,{client:e,patient:c,encounter:l,children:e.name})}),(0,L.jsx)(H,{children:e.description})]},e.id))]})}function $Q(e){return e===`Patient`||e===`Encounter`}function e$(){let{resourceType:e,id:t}=zK(),n=FK(),[r,i]=(0,b.useState)({resourceType:`AuditEvent`,filters:[{code:`entity`,operator:X.EQUALS,value:`${e}/${t}`}],fields:[`id`,`outcome`,`outcomeDesc`,`_lastUpdated`],sortRules:[{code:`-_lastUpdated`}],count:20});return(0,L.jsx)(LF,{children:(0,L.jsx)(zB,{search:r,onClick:e=>n(`/${e.resource.resourceType}/${e.resource.id}`)?.catch(console.error),onChange:e=>i(e.definition),hideFilters:!0})})}function t$(){let e=Z(),{resourceType:t,id:n}=zK(),r=e.readHistory(t,n).read();return(0,L.jsx)(lm,{maw:1200,children:(0,L.jsx)(IF,{children:(0,L.jsx)(rU,{history:r})})})}var n$={hl7Input:`_hl7Input_1tb0t_1`,splitButton:`_splitButton_1tb0t_10`,menuControl:`_menuControl_1tb0t_15`,eventData:`_eventData_1tb0t_22`};function r$(e){return(0,L.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 i$(e){let t=e.defaultValue,n=new URL(`https://codeeditor.medplum.com/${e.language}-editor.html`);return e.module&&n.searchParams.set(`module`,e.module),(0,L.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:e=>{QM(e.currentTarget,{command:`setValue`,value:t}).catch(console.error)}})}var a$=`{
|
|
223
|
+
`);t((0,L.jsxs)(W,{children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(H,{fw:700,children:`Query`}),(0,L.jsx)(om,{block:!0,maw:`100%`,style:{whiteSpace:`pre-wrap`},children:l})]}),(s||c)&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(H,{fw:700,children:`Counts`}),s&&(0,L.jsxs)(H,{children:[`Estimate: `,s]}),c&&(0,L.jsxs)(H,{children:[`Accurate: `,c]})]})]})),n()}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})})}return!r.isLoading()&&!r.isSuperAdmin()?(0,L.jsx)(oI,{outcome:lS}):(0,L.jsx)(NP,{onSubmit:m,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(jb,{name:`query`,label:`Search`,required:!0,placeholder:`Observation?code=85354-9&_sort=-date&_count=5`}),(0,L.jsxs)(V,{children:[(0,L.jsx)(pp,{name:`analyze`,label:`Analyze`}),(0,L.jsx)(pp,{name:`count`,label:`Total count`})]}),(0,L.jsx)(fd,{label:`On Behalf Of`,children:(0,L.jsxs)(W,{gap:`sm`,children:[(0,L.jsx)(ML,{required:!0,placeholder:`Project`,targetTypes:[`Project`],name:`onBehalfOfProject`,onChange:a}),(0,L.jsx)(ML,{required:!0,placeholder:`Practitioner or Patient`,name:`onBehalfOfProfile`,targetTypes:[`Practitioner`,`Patient`],onChange:s,searchCriteria:f}),c?.length!==1&&(0,L.jsx)(ML,{required:!0,placeholder:`ProjectMembership`,name:`onBehalfOfProjectMembership`,targetTypes:[`ProjectMembership`],onChange:d,searchCriteria:p}),c?.length===1&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`input`,{type:`hidden`,name:`onBehalfOfProjectMembership`,value:OC(c[0])}),(0,L.jsx)(RI,{value:DC(c[0])})]}),!u&&(0,L.jsx)(H,{fs:`italic`,children:`On Behalf Of not set. Running as super admin`})]})}),(0,L.jsx)(U,{type:`submit`,children:`Explain Search`})]})})}var CX=[{label:`All`,value:`Patient,Practitioner,RelatedPerson`},{label:`Practitioner`,value:`Practitioner`},{label:`Patient`,value:`Patient`},{label:`RelatedPerson`,value:`RelatedPerson`}];function wX(){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{children:`ProjectMemberships by User and Profile Type`}),(0,L.jsx)(LJ,{profileTypeOptions:CX,fields:[`user`,`profile`,`profile-type`,`accessPolicy`,`userConfiguration`,`active`,`admin`],showMfaEnrollment:!0,toolbarLeft:(0,L.jsx)(U,{component:eN,to:`/admin/invite`,variant:`outline`,color:`blue`,leftSection:(0,L.jsx)(BM,{size:14}),children:`Invite New User`}),toolbarRight:(0,L.jsx)(Rd,{href:`https://www.medplum.com/docs/user-management`,target:`_blank`,rel:`noopener noreferrer`,size:`sm`,children:`Learn more about roles and user management`})})]})}var TX=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 EX(e,t,n){let r=DX(e),{webkitRelativePath:i}=e,a=typeof t==`string`?t:typeof i==`string`&&i.length>0?i:`./${e.name}`;return typeof r.path!=`string`&&OX(r,`path`,a),n!==void 0&&Object.defineProperty(r,"handle",{value:n,writable:!1,configurable:!1,enumerable:!0}),OX(r,`relativePath`,a),r}function DX(e){let{name:t}=e;if(t&&t.lastIndexOf(`.`)!==-1&&!e.type){let n=t.split(`.`).pop().toLowerCase(),r=TX.get(n);r&&Object.defineProperty(e,"type",{value:r,writable:!1,configurable:!1,enumerable:!0})}return e}function OX(e,t,n){Object.defineProperty(e,t,{value:n,writable:!1,configurable:!1,enumerable:!0})}var kX=[`.DS_Store`,`Thumbs.db`];function AX(e){return d(this,void 0,void 0,function*(){return NX(e)&&jX(e.dataTransfer)?IX(e.dataTransfer,e.type):MX(e)?PX(e):Array.isArray(e)&&e.every(e=>`getFile`in e&&typeof e.getFile==`function`)?FX(e):[]})}function jX(e){return NX(e)}function MX(e){return NX(e)&&NX(e.target)}function NX(e){return typeof e==`object`&&!!e}function PX(e){return RX(e.target.files).map(e=>EX(e))}function FX(e){return d(this,void 0,void 0,function*(){return(yield Promise.all(e.map(e=>e.getFile()))).map(e=>EX(e))})}function IX(e,t){return d(this,void 0,void 0,function*(){if(e.items){let n=RX(e.items).filter(e=>e.kind===`file`);return t===`drop`?LX(BX(yield Promise.all(n.map(zX)))):n}return LX(RX(e.files).map(e=>EX(e)))})}function LX(e){return e.filter(e=>kX.indexOf(e.name)===-1)}function RX(e){if(e===null)return[];let t=[];for(let n=0;n<e.length;n++){let r=e[n];t.push(r)}return t}function zX(e){if(typeof e.webkitGetAsEntry!=`function`)return VX(e);let t=e.webkitGetAsEntry();return t&&t.isDirectory?UX(t):VX(e,t)}function BX(e){return e.reduce((e,t)=>[...e,...Array.isArray(t)?BX(t):[t]],[])}function VX(e,t){return d(this,void 0,void 0,function*(){if(globalThis.isSecureContext&&typeof e.getAsFileSystemHandle==`function`){let t=yield e.getAsFileSystemHandle();if(t===null)throw Error(`${e} is not a File`);if(t!==void 0){let e=yield t.getFile();return e.handle=t,EX(e)}}let n=e.getAsFile();if(!n)throw Error(`${e} is not a File`);return EX(n,t?.fullPath??void 0)})}function HX(e){return d(this,void 0,void 0,function*(){return e.isDirectory?UX(e):WX(e)})}function UX(e){let t=e.createReader();return new Promise((e,n)=>{let r=[];function i(){t.readEntries(t=>d(this,void 0,void 0,function*(){if(t.length){let e=Promise.all(t.map(HX));r.push(e),i()}else try{e(yield Promise.all(r))}catch(e){n(e)}}),e=>{n(e)})}i()})}function WX(e){return d(this,void 0,void 0,function*(){return new Promise((t,n)=>{e.file(n=>{t(EX(n,e.fullPath))},e=>{n(e)})})})}var GX=c(o((e=>{e.__esModule=!0,e.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||``,i=(e.type||``).toLowerCase(),a=i.replace(/\/.*$/,``);return n.some(function(e){var t=e.trim().toLowerCase();return t.charAt(0)===`.`?r.toLowerCase().endsWith(t):t.endsWith(`/*`)?a===t.replace(/\/.*$/,``):i===t})}return!0}}))());function KX(e){return YX(e)||JX(e)||tZ(e)||qX()}function qX(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
224
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function JX(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function YX(e){if(Array.isArray(e))return nZ(e)}function XX(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function ZX(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?XX(Object(n),!0).forEach(function(t){QX(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):XX(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function QX(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function $X(e,t){return iZ(e)||rZ(e,t)||tZ(e,t)||eZ()}function eZ(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
225
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tZ(e,t){if(e){if(typeof e==`string`)return nZ(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 nZ(e,t)}}function nZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function rZ(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function iZ(e){if(Array.isArray(e))return e}var aZ=typeof GX.default==`function`?GX.default:GX.default.default,oZ=`file-invalid-type`,sZ=`file-too-large`,cZ=`file-too-small`,lZ=`too-many-files`,uZ=function(){var e=(arguments.length>0&&arguments[0]!==void 0?arguments[0]:``).split(`,`);return{code:oZ,message:`File type must be ${e.length>1?`one of ${e.join(`, `)}`:e[0]}`}},dZ=function(e){return{code:sZ,message:`File is larger than ${e} ${e===1?`byte`:`bytes`}`}},fZ=function(e){return{code:cZ,message:`File is smaller than ${e} ${e===1?`byte`:`bytes`}`}},pZ={code:lZ,message:`Too many files`};function mZ(e){return e.type===``&&typeof e.getAsFile==`function`}function hZ(e,t){var n=e.type===`application/x-moz-file`||aZ(e,t)||mZ(e);return[n,n?null:uZ(t)]}function gZ(e,t,n){if(_Z(e.size)){if(_Z(t)&&_Z(n)){if(e.size>n)return[!1,dZ(n)];if(e.size<t)return[!1,fZ(t)]}else if(_Z(t)&&e.size<t)return[!1,fZ(t)];else if(_Z(n)&&e.size>n)return[!1,dZ(n)]}return[!0,null]}function _Z(e){return e!=null}function vZ(e){var t=e.files,n=e.accept,r=e.minSize,i=e.maxSize,a=e.multiple,o=e.maxFiles,s=e.validator;return!a&&t.length>1||a&&o>=1&&t.length>o?!1:t.every(function(e){var t=$X(hZ(e,n),1)[0],a=$X(gZ(e,r,i),1)[0],o=s?s(e):null;return t&&a&&!o})}function yZ(e){return typeof e.isPropagationStopped==`function`?e.isPropagationStopped():e.cancelBubble!==void 0&&e.cancelBubble}function bZ(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(e){return e===`Files`||e===`application/x-moz-file`}):!!e.target&&!!e.target.files}function xZ(e){e.preventDefault()}function SZ(e){return e.indexOf(`MSIE`)!==-1||e.indexOf(`Trident/`)!==-1}function CZ(e){return e.indexOf(`Edge/`)!==-1}function wZ(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return SZ(e)||CZ(e)}function TZ(){var e=[...arguments];return function(t){var n=[...arguments].slice(1);return e.some(function(e){return!yZ(t)&&e&&e.apply(void 0,[t].concat(n)),yZ(t)})}}function EZ(){return`showOpenFilePicker`in window}function DZ(e){return _Z(e)?[{description:`Files`,accept:Object.entries(e).filter(function(e){var t=$X(e,2),n=t[0],r=t[1],i=!0;return jZ(n)||(console.warn(`Skipped "${n}" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.`),i=!1),(!Array.isArray(r)||!r.every(MZ))&&(console.warn(`Skipped "${n}" because an invalid file extension was provided.`),i=!1),i}).reduce(function(e,t){var n=$X(t,2),r=n[0],i=n[1];return ZX(ZX({},e),{},QX({},r,i))},{})}]:e}function OZ(e){if(_Z(e))return Object.entries(e).reduce(function(e,t){var n=$X(t,2),r=n[0],i=n[1];return[].concat(KX(e),[r],KX(i))},[]).filter(function(e){return jZ(e)||MZ(e)}).join(`,`)}function kZ(e){return e instanceof DOMException&&(e.name===`AbortError`||e.code===e.ABORT_ERR)}function AZ(e){return e instanceof DOMException&&(e.name===`SecurityError`||e.code===e.SECURITY_ERR)}function jZ(e){return e===`audio/*`||e===`video/*`||e===`image/*`||e===`text/*`||e===`application/*`||/\w+\/[-+.\w]+/g.test(e)}function MZ(e){return/^.*\.[\w]+$/.test(e)}var NZ=c(nx()),PZ=[`children`],FZ=[`open`],IZ=[`refKey`,`role`,`onKeyDown`,`onFocus`,`onBlur`,`onClick`,`onDragEnter`,`onDragOver`,`onDragLeave`,`onDrop`],LZ=[`refKey`,`onChange`,`onClick`];function RZ(e){return VZ(e)||BZ(e)||WZ(e)||zZ()}function zZ(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
226
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BZ(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function VZ(e){if(Array.isArray(e))return GZ(e)}function HZ(e,t){return qZ(e)||KZ(e,t)||WZ(e,t)||UZ()}function UZ(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
227
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WZ(e,t){if(e){if(typeof e==`string`)return GZ(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 GZ(e,t)}}function GZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function KZ(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r=[],i=!0,a=!1,o,s;try{for(n=n.call(e);!(i=(o=n.next()).done)&&(r.push(o.value),!(t&&r.length===t));i=!0);}catch(e){a=!0,s=e}finally{try{!i&&n.return!=null&&n.return()}finally{if(a)throw s}}return r}}function qZ(e){if(Array.isArray(e))return e}function JZ(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function YZ(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?JZ(Object(n),!0).forEach(function(t){XZ(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):JZ(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function XZ(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ZZ(e,t){if(e==null)return{};var n=QZ(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function QZ(e,t){if(e==null)return{};for(var n={},r=Object.keys(e),i,a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}var $Z=(0,b.forwardRef)(function(e,t){var n=e.children,r=nQ(ZZ(e,PZ)),i=r.open,a=ZZ(r,FZ);return(0,b.useImperativeHandle)(t,function(){return{open:i}},[i]),b.createElement(b.Fragment,null,n(YZ(YZ({},a),{},{open:i})))});$Z.displayName=`Dropzone`;var eQ={disabled:!1,getFilesFromEvent:AX,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};$Z.defaultProps=eQ,$Z.propTypes={children:NZ.default.func,accept:NZ.default.objectOf(NZ.default.arrayOf(NZ.default.string)),multiple:NZ.default.bool,preventDropOnDocument:NZ.default.bool,noClick:NZ.default.bool,noKeyboard:NZ.default.bool,noDrag:NZ.default.bool,noDragEventsBubbling:NZ.default.bool,minSize:NZ.default.number,maxSize:NZ.default.number,maxFiles:NZ.default.number,disabled:NZ.default.bool,getFilesFromEvent:NZ.default.func,onFileDialogCancel:NZ.default.func,onFileDialogOpen:NZ.default.func,useFsAccessApi:NZ.default.bool,autoFocus:NZ.default.bool,onDragEnter:NZ.default.func,onDragLeave:NZ.default.func,onDragOver:NZ.default.func,onDrop:NZ.default.func,onDropAccepted:NZ.default.func,onDropRejected:NZ.default.func,onError:NZ.default.func,validator:NZ.default.func};var tQ={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,isDragGlobal:!1,acceptedFiles:[],fileRejections:[]};function nQ(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=YZ(YZ({},eQ),e),n=t.accept,r=t.disabled,i=t.getFilesFromEvent,a=t.maxSize,o=t.minSize,s=t.multiple,c=t.maxFiles,l=t.onDragEnter,u=t.onDragLeave,d=t.onDragOver,f=t.onDrop,p=t.onDropAccepted,m=t.onDropRejected,h=t.onFileDialogCancel,g=t.onFileDialogOpen,_=t.useFsAccessApi,v=t.autoFocus,y=t.preventDropOnDocument,x=t.noClick,S=t.noKeyboard,C=t.noDrag,w=t.noDragEventsBubbling,T=t.onError,E=t.validator,D=(0,b.useMemo)(function(){return OZ(n)},[n]),O=(0,b.useMemo)(function(){return DZ(n)},[n]),k=(0,b.useMemo)(function(){return typeof g==`function`?g:iQ},[g]),A=(0,b.useMemo)(function(){return typeof h==`function`?h:iQ},[h]),j=(0,b.useRef)(null),M=(0,b.useRef)(null),N=HZ((0,b.useReducer)(rQ,tQ),2),ee=N[0],P=N[1],te=ee.isFocused,ne=ee.isFileDialogActive,re=(0,b.useRef)(typeof window<`u`&&window.isSecureContext&&_&&EZ()),ie=function(){!re.current&&ne&&setTimeout(function(){M.current&&(M.current.files.length||(P({type:`closeDialog`}),A()))},300)};(0,b.useEffect)(function(){return window.addEventListener(`focus`,ie,!1),function(){window.removeEventListener(`focus`,ie,!1)}},[M,ne,A,re]);var ae=(0,b.useRef)([]),oe=(0,b.useRef)([]),se=function(e){j.current&&j.current.contains(e.target)||(e.preventDefault(),ae.current=[])};(0,b.useEffect)(function(){return y&&(document.addEventListener(`dragover`,xZ,!1),document.addEventListener(`drop`,se,!1)),function(){y&&(document.removeEventListener(`dragover`,xZ),document.removeEventListener(`drop`,se))}},[j,y]),(0,b.useEffect)(function(){var e=function(e){oe.current=[].concat(RZ(oe.current),[e.target]),bZ(e)&&P({isDragGlobal:!0,type:`setDragGlobal`})},t=function(e){oe.current=oe.current.filter(function(t){return t!==e.target&&t!==null}),!(oe.current.length>0)&&P({isDragGlobal:!1,type:`setDragGlobal`})},n=function(){oe.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})},r=function(){oe.current=[],P({isDragGlobal:!1,type:`setDragGlobal`})};return document.addEventListener(`dragenter`,e,!1),document.addEventListener(`dragleave`,t,!1),document.addEventListener(`dragend`,n,!1),document.addEventListener(`drop`,r,!1),function(){document.removeEventListener(`dragenter`,e),document.removeEventListener(`dragleave`,t),document.removeEventListener(`dragend`,n),document.removeEventListener(`drop`,r)}},[j]),(0,b.useEffect)(function(){return!r&&v&&j.current&&j.current.focus(),function(){}},[j,v,r]);var ce=(0,b.useCallback)(function(e){T?T(e):console.error(e)},[T]),le=(0,b.useCallback)(function(e){e.preventDefault(),e.persist(),xe(e),ae.current=[].concat(RZ(ae.current),[e.target]),bZ(e)&&Promise.resolve(i(e)).then(function(t){if(!yZ(e)||w){var n=t.length,r=n>0&&vZ({files:t,accept:D,minSize:o,maxSize:a,multiple:s,maxFiles:c,validator:E});P({isDragAccept:r,isDragReject:n>0&&!r,isDragActive:!0,type:`setDraggedFiles`}),l&&l(e)}}).catch(function(e){return ce(e)})},[i,l,ce,w,D,o,a,s,c,E]),ue=(0,b.useCallback)(function(e){e.preventDefault(),e.persist(),xe(e);var t=bZ(e);if(t&&e.dataTransfer)try{e.dataTransfer.dropEffect=`copy`}catch{}return t&&d&&d(e),!1},[d,w]),de=(0,b.useCallback)(function(e){e.preventDefault(),e.persist(),xe(e);var t=ae.current.filter(function(e){return j.current&&j.current.contains(e)}),n=t.indexOf(e.target);n!==-1&&t.splice(n,1),ae.current=t,!(t.length>0)&&(P({type:`setDraggedFiles`,isDragActive:!1,isDragAccept:!1,isDragReject:!1}),bZ(e)&&u&&u(e))},[j,u,w]),fe=(0,b.useCallback)(function(e,t){var n=[],r=[];e.forEach(function(e){var t=HZ(hZ(e,D),2),i=t[0],s=t[1],c=HZ(gZ(e,o,a),2),l=c[0],u=c[1],d=E?E(e):null;if(i&&l&&!d)n.push(e);else{var f=[s,u];d&&(f=f.concat(d)),r.push({file:e,errors:f.filter(function(e){return e})})}}),(!s&&n.length>1||s&&c>=1&&n.length>c)&&(n.forEach(function(e){r.push({file:e,errors:[pZ]})}),n.splice(0)),P({acceptedFiles:n,fileRejections:r,type:`setFiles`}),f&&f(n,r,t),r.length>0&&m&&m(r,t),n.length>0&&p&&p(n,t)},[P,s,D,o,a,c,f,p,m,E]),pe=(0,b.useCallback)(function(e){e.preventDefault(),e.persist(),xe(e),ae.current=[],bZ(e)&&Promise.resolve(i(e)).then(function(t){(!yZ(e)||w)&&fe(t,e)}).catch(function(e){return ce(e)}),P({type:`reset`})},[i,fe,ce,w]),F=(0,b.useCallback)(function(){if(re.current){P({type:`openDialog`}),k();var e={multiple:s,types:O};window.showOpenFilePicker(e).then(function(e){return i(e)}).then(function(e){fe(e,null),P({type:`closeDialog`})}).catch(function(e){kZ(e)?(A(e),P({type:`closeDialog`})):AZ(e)?(re.current=!1,M.current?(M.current.value=null,M.current.click()):ce(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.`))):ce(e)});return}M.current&&(P({type:`openDialog`}),k(),M.current.value=null,M.current.click())},[P,k,A,_,fe,ce,O,s]),me=(0,b.useCallback)(function(e){j.current&&j.current.isEqualNode(e.target)&&(e.key===` `||e.key===`Enter`||e.keyCode===32||e.keyCode===13)&&(e.preventDefault(),F())},[j,F]),he=(0,b.useCallback)(function(){P({type:`focus`})},[]),ge=(0,b.useCallback)(function(){P({type:`blur`})},[]),_e=(0,b.useCallback)(function(){x||(wZ()?setTimeout(F,0):F())},[x,F]),ve=function(e){return r?null:e},ye=function(e){return S?null:ve(e)},be=function(e){return C?null:ve(e)},xe=function(e){w&&e.stopPropagation()},Se=(0,b.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,i=e.role,a=e.onKeyDown,o=e.onFocus,s=e.onBlur,c=e.onClick,l=e.onDragEnter,u=e.onDragOver,d=e.onDragLeave,f=e.onDrop,p=ZZ(e,IZ);return YZ(YZ(XZ({onKeyDown:ye(TZ(a,me)),onFocus:ye(TZ(o,he)),onBlur:ye(TZ(s,ge)),onClick:ve(TZ(c,_e)),onDragEnter:be(TZ(l,le)),onDragOver:be(TZ(u,ue)),onDragLeave:be(TZ(d,de)),onDrop:be(TZ(f,pe)),role:typeof i==`string`&&i!==``?i:`presentation`},n,j),!r&&!S?{tabIndex:0}:{}),p)}},[j,me,he,ge,_e,le,ue,de,pe,S,C,r]),Ce=(0,b.useCallback)(function(e){e.stopPropagation()},[]),we=(0,b.useMemo)(function(){return function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.refKey,n=t===void 0?`ref`:t,r=e.onChange,i=e.onClick,a=ZZ(e,LZ);return YZ(YZ({},XZ({accept:D,multiple:s,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:ve(TZ(r,pe)),onClick:ve(TZ(i,Ce)),tabIndex:-1},n,M)),a)}},[M,n,s,pe,r]);return YZ(YZ({},ee),{},{isFocused:te&&!r,getRootProps:Se,getInputProps:we,rootRef:j,inputRef:M,open:ve(F)})}function rQ(e,t){switch(t.type){case`focus`:return YZ(YZ({},e),{},{isFocused:!0});case`blur`:return YZ(YZ({},e),{},{isFocused:!1});case`openDialog`:return YZ(YZ({},tQ),{},{isFileDialogActive:!0});case`closeDialog`:return YZ(YZ({},e),{},{isFileDialogActive:!1});case`setDraggedFiles`:return YZ(YZ({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case`setFiles`:return YZ(YZ({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections,isDragReject:!1});case`setDragGlobal`:return YZ(YZ({},e),{},{isDragGlobal:t.isDragGlobal});case`reset`:return YZ({},tQ);default:return e}}function iQ(){}var[aQ,oQ]=Qe(`Dropzone component was not found in tree`),sQ={root:`m_d46a4834`,inner:`m_b85f7144`,fullScreen:`m_96f6e9ad`,dropzone:`m_7946116d`};function cQ(e){let t=t=>{let{children:n,...r}=R(`Dropzone${wt(e)}`,{},t),i=oQ(),a=Xe(n)?n:(0,L.jsx)(`span`,{children:n});return i[e]?(0,b.cloneElement)(a,r):null};return t.displayName=`@mantine/dropzone/${wt(e)}`,t}var lQ=cQ(`accept`),uQ=cQ(`reject`),dQ=cQ(`idle`),fQ={multiple:!0,maxSize:1/0,activateOnClick:!0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,useFsAccessApi:!0,variant:`light`,rejectColor:`red`},pQ=Fn((e,{radius:t,variant:n,acceptColor:r,rejectColor:i})=>{let a=e.variantColorResolver({color:r||e.primaryColor,theme:e,variant:n}),o=e.variantColorResolver({color:i||`red`,theme:e,variant:n});return{root:{"--dropzone-radius":ft(t),"--dropzone-accept-color":a.color,"--dropzone-accept-bg":a.background,"--dropzone-reject-color":o.color,"--dropzone-reject-bg":o.background}}}),mQ=B((e,t)=>{let n=R(`Dropzone`,fQ,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,radius:l,disabled:u,loading:d,multiple:f,maxSize:p,accept:m,children:h,onDropAny:g,onDrop:_,onReject:v,openRef:y,name:b,maxFiles:x,autoFocus:S,activateOnClick:C,activateOnDrag:w,dragEventsBubbling:T,activateOnKeyboard:E,onDragEnter:D,onDragLeave:O,onDragOver:k,onFileDialogCancel:A,onFileDialogOpen:j,preventDropOnDocument:M,useFsAccessApi:N,getFilesFromEvent:ee,validator:P,rejectColor:te,acceptColor:ne,enablePointerEvents:re,loaderProps:ie,inputProps:ae,mod:oe,attributes:se,...ce}=n,le=ui({name:`Dropzone`,classes:sQ,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:se,vars:c,varsResolver:pQ}),{getRootProps:ue,getInputProps:de,isDragAccept:fe,isDragReject:pe,isDragActive:F,open:me}=nQ({onDrop:g,onDropAccepted:_,onDropRejected:v,disabled:u||d,accept:Array.isArray(m)?m.reduce((e,t)=>({...e,[t]:[]}),{}):m,multiple:f,maxSize:p,maxFiles:x,autoFocus:S,noClick:!C,noDrag:!w,noDragEventsBubbling:!T,noKeyboard:!E,onDragEnter:D,onDragLeave:O,onDragOver:k,onFileDialogCancel:A,onFileDialogOpen:j,preventDropOnDocument:M,useFsAccessApi:N,validator:P,...ee?{getFilesFromEvent:ee}:null});on(y,me);let he=F&&fe,ge=F&&pe,_e=!he&&!ge;return(0,L.jsx)(aQ,{value:{accept:he,reject:ge,idle:_e},children:(0,L.jsxs)(z,{...ue(),...le(`root`,{focusable:!0}),...ce,mod:[{accept:he,reject:ge,idle:_e,disabled:u,loading:d,"activate-on-click":C},oe],children:[(0,L.jsx)(Mh,{visible:d,overlayProps:{radius:l},unstyled:s,loaderProps:ie}),(0,L.jsx)(`input`,{...de(ae),name:b}),(0,L.jsx)(`div`,{...le(`inner`),ref:t,"data-enable-pointer-events":re||void 0,children:h})]})})});mQ.classes=sQ,mQ.displayName=`@mantine/dropzone/Dropzone`,mQ.Accept=lQ,mQ.Idle=dQ,mQ.Reject=uQ;var hQ={maxSize:1/0,activateOnDrag:!0,dragEventsBubbling:!0,activateOnKeyboard:!0,active:!0,zIndex:st(`max`),withinPortal:!0},gQ=B((e,t)=>{let n=R(`DropzoneFullScreen`,hQ,e),{classNames:r,className:i,style:a,styles:o,unstyled:s,vars:c,active:l,onDrop:u,onReject:d,zIndex:f,withinPortal:p,portalProps:m,attributes:h,...g}=n,_=ui({name:`DropzoneFullScreen`,classes:sQ,props:n,className:i,style:a,classNames:r,styles:o,unstyled:s,attributes:h,rootSelector:`fullScreen`}),{resolvedClassNames:v,resolvedStyles:y}=qr({classNames:r,styles:o,props:n}),[x,S]=(0,b.useState)(0),[C,{open:w,close:T}]=wn(!1),E=e=>{e.dataTransfer?.types.includes(`Files`)&&(S(e=>e+1),w())},D=()=>{S(e=>e-1)};return(0,b.useEffect)(()=>{x===0&&T()},[x]),(0,b.useEffect)(()=>{if(l)return document.addEventListener(`dragenter`,E,!1),document.addEventListener(`dragleave`,D,!1),()=>{document.removeEventListener(`dragenter`,E,!1),document.removeEventListener(`dragleave`,D,!1)}},[l]),(0,L.jsx)(Rl,{...m,withinPortal:p,children:(0,L.jsx)(z,{ref:t,..._(`fullScreen`,{style:{opacity:+!!C,pointerEvents:C?`all`:`none`,zIndex:f}}),children:(0,L.jsx)(mQ,{activateOnClick:!1,...g,classNames:v,styles:y,unstyled:s,className:sQ.dropzone,onDrop:e=>{u?.(e),T(),S(0)},onReject:e=>{d?.(e),T(),S(0)}})})})});gQ.classes=sQ,gQ.displayName=`@mantine/dropzone/DropzoneFullScreen`,mQ.FullScreen=gQ;var _Q=mQ,vQ=`{"resourceType": "Bundle"}`;function yQ({id:e,title:t,message:n,color:r,icon:i,withCloseButton:a=!1,method:o=`show`,loading:s}){Zb[o]({id:e,loading:s,title:t,message:n,color:r,icon:i,withCloseButton:a,autoClose:!1})}function bQ(){let e=Dr(),t=Z(),[n,r]=(0,b.useState)(vQ),[i,a]=(0,b.useState)({}),[o,s]=(0,b.useState)(``),[c,l]=(0,b.useState)(!1),u=wn(!1),d=(0,b.useCallback)(async(e,n)=>{let r=`batch-upload`;yQ({id:r,title:`Batch Upload in Progress`,message:`Your batch data is being uploaded. This may take a moment...`,method:`show`,loading:!0});try{a({});let i=JSON.parse(e);i.type!==`batch`&&i.type!==`transaction`&&(i=_D(i));let o=await t.executeBatch(i);a(e=>({...e,[n]:o})),yQ({id:r,title:`Batch Upload Successful`,message:`Your batch data was successfully uploaded.`,color:`green`,method:`update`,icon:(0,L.jsx)(jj,{size:`1rem`}),withCloseButton:!0})}catch(e){yQ({id:r,title:`Batch Upload Failed`,color:`red`,message:J(e),method:`update`,icon:(0,L.jsx)(HM,{size:`1rem`}),withCloseButton:!0})}},[t]),f=(0,b.useCallback)(async e=>{for(let t of e){let e=new FileReader;e.onload=e=>d(e.target?.result,t.name),e.readAsText(t)}},[d]),p=(0,b.useCallback)(async e=>{await d(e.input,`JSON Data`)},[d]),m=(0,b.useCallback)(async e=>{if(e=e.trim(),e){if(l(!0),yQ({id:`smart-scan`,title:`SMART Scan in Progress`,message:`Reading SMART data...`,method:`show`,loading:!0}),e.startsWith(`shc:`)){try{let n=await t.post(t.fhirUrl(`$verify-smart-health-card`),{shcUri:e}),i=n.parameter?.find(e=>e.name===`fhirBundle`)?.valueString;if(i){let e=JSON.parse(i);r(VC(e,!0))}n.parameter?.find(e=>e.name===`valid`)?.valueBoolean?yQ({id:`smart-scan`,title:`SMART Health Card Verified`,message:`Your SMART Health Card data was successfully verified.`,color:`green`,method:`update`,icon:(0,L.jsx)(jj,{size:`1rem`}),withCloseButton:!0}):yQ({id:`smart-scan`,title:`SMART Health Card Verification Failed`,color:`red`,message:`Your SMART Health Card data could not be verified.`,method:`update`,icon:(0,L.jsx)(HM,{size:`1rem`}),withCloseButton:!0})}catch(e){yQ({id:`smart-scan`,title:`SMART Health Card Verification Failed`,color:`red`,message:J(e),method:`update`,icon:(0,L.jsx)(HM,{size:`1rem`}),withCloseButton:!0})}finally{l(!1)}return}try{let n=await t.post(t.fhirUrl(`$resolve-smart-health-link`),{shlink:e,recipient:`Medplum App`}),i=n.parameter?.find(e=>e.name===`valid`)?.valueBoolean,a=n.parameter?.find(e=>e.name===`error`)?.valueString,o=n.parameter?.filter(e=>e.name===`warning`).map(e=>e.valueString).filter(Boolean);if(!i)throw Error(a||`SMART Health Link could not be resolved.`);let s=JSON.parse(n.parameter?.find(e=>e.name===`fhirResources`)?.valueString??`[]`).find(e=>e.resourceType===`Bundle`);if(!s)throw Error(`SMART Health Link did not contain a FHIR Bundle.`);r(VC(s,!0)),yQ({id:`smart-scan`,title:`SMART Health Link Resolved`,message:o?.length?o.join(`
|
|
228
|
+
`):`Your SMART Health Link data was successfully resolved.`,color:o?.length?`yellow`:`green`,method:`update`,icon:(0,L.jsx)(jj,{size:`1rem`}),withCloseButton:!0})}catch(e){yQ({id:`smart-scan`,title:`SMART Health Link Failed`,color:`red`,message:J(e),method:`update`,icon:(0,L.jsx)(HM,{size:`1rem`}),withCloseButton:!0})}finally{l(!1)}}},[t]);return(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{order:1,children:`Batch Create`}),(0,L.jsxs)(H,{children:[`Use this page to create, read, or update multiple resources. For more details, see`,` `,(0,L.jsx)(Rd,{href:`https://www.hl7.org/fhir/http.html#transaction`,children:`FHIR Batch and Transaction`}),`.`]}),Object.keys(i).length===0&&(0,L.jsxs)(Ab,{defaultValue:`upload`,mt:`xl`,children:[(0,L.jsxs)(Ab.List,{children:[(0,L.jsx)(Ab.Tab,{value:`upload`,children:`File Upload`}),(0,L.jsx)(Ab.Tab,{value:`json`,children:`JSON`})]}),(0,L.jsx)(Ab.Panel,{value:`upload`,pt:`xs`,children:(0,L.jsx)(_Q,{onDrop:f,accept:[`application/json`],children:(0,L.jsxs)(V,{justify:`center`,gap:`xl`,style:{minHeight:220,pointerEvents:`none`},children:[(0,L.jsx)(_Q.Accept,{children:(0,L.jsx)(zM,{size:50,stroke:1.5,color:e.colors[e.primaryColor][5]})}),(0,L.jsx)(_Q.Reject,{children:(0,L.jsx)(HM,{size:50,stroke:1.5,color:e.colors.red[5]})}),(0,L.jsx)(_Q.Idle,{children:(0,L.jsx)(zM,{size:50,stroke:1.5})}),(0,L.jsxs)(`div`,{children:[(0,L.jsx)(H,{size:`xl`,inline:!0,children:`Drag files here or click to select files`}),(0,L.jsx)(H,{size:`sm`,color:`dimmed`,inline:!0,mt:7,children:`Attach as many files as you like`})]})]})})}),(0,L.jsx)(Ab.Panel,{value:`json`,pt:`xs`,children:(0,L.jsxs)(NP,{onSubmit:p,children:[(0,L.jsx)(vh,{"data-testid":`batch-input`,name:`input`,autosize:!0,minRows:20,value:n,onChange:r,deserialize:JSON.parse}),(0,L.jsxs)(V,{justify:`flex-end`,mt:`xl`,wrap:`nowrap`,children:[(0,L.jsx)(U,{type:`submit`,children:`Submit`}),(0,L.jsx)(U,{variant:`default`,onClick:()=>u[1].open(),children:`SMART`})]})]})})]}),Object.keys(i).length>0&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`h3`,{children:`Output`}),(0,L.jsxs)(Ab,{defaultValue:Object.keys(i)[0],children:[(0,L.jsx)(Ab.List,{children:Object.keys(i).map(e=>(0,L.jsx)(Ab.Tab,{value:e,children:e},e))}),Object.keys(i).map(e=>(0,L.jsx)(Ab.Panel,{value:e,children:(0,L.jsx)(`pre`,{style:{border:`1px solid #888`},children:JSON.stringify(i[e],void 0,2)})},e))]}),(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,wrap:`nowrap`,children:(0,L.jsx)(U,{onClick:()=>a({}),children:`Start over`})})]}),(0,L.jsx)(pg,{title:`SMART`,size:`xl`,opened:u[0],onClose:u[1].close,children:(0,L.jsxs)(W,{children:[(0,L.jsxs)(V,{align:`end`,children:[(0,L.jsx)(jb,{label:`SMART Health Link`,placeholder:`shlink:/...`,value:o,onChange:e=>s(e.currentTarget.value),style:{flex:1}}),(0,L.jsx)(U,{loading:c,onClick:()=>{u[1].close(),m(o).catch(console.error)},children:`Resolve`})]}),(0,L.jsx)(KV,{onScan:e=>{u[1].close(),m(e).catch(console.error)}})]})})]})}function xQ(){let{resourceType:e}=UK(),t=(Object.fromEntries(new URLSearchParams(location.search).entries()).ids||``).split(`,`).filter(e=>!!e),[n]=YA(`Questionnaire`,`subject-type=${e}`);return n?n.length===0?(0,L.jsxs)(LF,{children:[(0,L.jsxs)(K,{children:[`No apps for `,e]}),(0,L.jsx)(eN,{to:`/${e}`,children:`Return to search page`})]}):(0,L.jsx)(LF,{children:(0,L.jsx)(`div`,{children:n.map(n=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{children:(0,L.jsx)(eN,{to:`/forms/${n.id}?subject=`+t.map(t=>`${e}/${t}`).join(`,`),children:n.name})}),(0,L.jsx)(`p`,{children:n.description})]},n.id))})}):(0,L.jsx)(GM,{})}function SQ(){return(0,L.jsx)(WF,{})}var CQ=[`Form`,`JSON`,`Profiles`];function wQ(){let{resourceType:e}=UK();return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Cl,{children:[(0,L.jsxs)(H,{p:`md`,fw:500,children:[`New\xA0`,e]}),(0,L.jsx)(ml,{children:(0,L.jsx)(aV,{baseUrl:`/${e}/new`,tabs:CQ})})]}),(0,L.jsx)(yq,{})]})}function TQ(){return(0,L.jsx)(LF,{children:(0,L.jsxs)(W,{children:[(0,L.jsx)(K,{order:1,children:`Unexpected Error`}),(0,L.jsx)(H,{children:`We're sorry, something went wrong.`}),(0,L.jsxs)(H,{children:[`Please contact `,(0,L.jsx)(Rd,{href:`mailto:support@medplum.com`,children:`support`}),` for assistance.`]})]})})}function EQ(e){let t=eA(e.resource);if(!t)return null;let n=[{key:`Type`,value:(0,L.jsx)(eN,{to:`/${t.resourceType}`,children:t.resourceType})}];function r(e,t){e&&t&&n.push({key:e,value:t})}function i(e){e&&r(e.system,e.value)}function a(e,t){Array.isArray(t)?t.forEach(t=>a(e,t)):typeof t==`string`?r(e,t):t&&(Array.isArray(t.coding)?r(e,t.coding.map(e=>e.display||e.code).join(`, `)):r(e,t.text))}if(`name`in t){let e=MC(t);e!==OC(t)&&r(`Name`,e)}return`category`in t&&a(`Category`,t.category),t.resourceType!==`Bot`&&`code`in t&&a(`Code`,t.code),`identifier`in t&&(Array.isArray(t.identifier)?t.identifier.forEach(i):i(t.identifier)),n.length===1&&n.push({key:`ID`,value:t.id}),(0,L.jsx)(tV,{children:n.map((e,t)=>(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(tV.Key,{children:e.key}),(0,L.jsx)(tV.Value,{children:e.value})]},`${e.key}-${t}`))})}function DQ(){let{id:e}=UK(),t=LK(),n=Object.fromEntries(new URLSearchParams(t.search).entries()).subject,r=Z(),[i,a]=(0,b.useState)(!0),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)(),[f,p]=(0,b.useState)(),[m,h]=(0,b.useState)();if((0,b.useEffect)(()=>{let t={resourceType:`Bundle`,type:`batch`,entry:[{request:{method:`GET`,url:`Questionnaire/${e}`}}]};if(n){let e=n.split(`,`).filter(e=>!!e);e.length===1&&t.entry.push({request:{method:`GET`,url:e[0]}}),l(e)}r.executeBatch(t).then(e=>{e.entry?.[0]?.response?.status===`200`?(s(e.entry[0]?.resource),d(e.entry[1]?.resource)):p(e.entry?.[0]?.response?.outcome),a(!1)}).catch(e=>{p(e),a(!1)})},[r,e,n]),f)return(0,L.jsx)(LF,{children:(0,L.jsx)(`pre`,{"data-testid":`error`,children:JSON.stringify(f,void 0,2)})});if(m)return(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:o?.title}),(0,L.jsx)(`p`,{children:`Your response has been recorded.`}),(0,L.jsxs)(`ul`,{children:[m.length===1&&(0,L.jsx)(`li`,{children:(0,L.jsx)(eN,{to:m[0],children:`Review your answers`})}),m.length>1&&(0,L.jsxs)(`li`,{children:[`Review your answers:`,(0,L.jsx)(`ul`,{children:m.map(e=>(0,L.jsx)(`li`,{children:(0,L.jsx)(eN,{to:e,children:OC(e)})},e.id))})]}),u&&(0,L.jsx)(`li`,{children:(0,L.jsxs)(eN,{to:u,children:[`Back to\xA0`,MC(u)]})}),(0,L.jsx)(`li`,{children:(0,L.jsx)(eN,{to:`/`,children:`Go back home`})})]})]});if(i||!o)return(0,L.jsx)(GM,{});let g=u&&OJ(u);return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(Cl,{shadow:`xs`,radius:0,children:[g&&(0,L.jsx)(EV,{patient:g}),u&&u.resourceType!==`Patient`&&(0,L.jsx)(EQ,{resource:u}),(0,L.jsx)(z,{px:`xl`,py:`md`,children:(0,L.jsxs)(H,{children:[MC(o),c&&c.length>1&&(0,L.jsxs)(L.Fragment,{children:[`\xA0(for `,c.length,` resources)`]})]})})]}),(0,L.jsx)(LF,{children:(0,L.jsx)(LH,{questionnaire:o,subject:u&&DC(u),onSubmit:_})})]});async function _(e){let t=[];if(!c||c.length===0)t.push(await r.createResource(e));else for(let n of c)t.push(await r.createResource({...e,subject:{reference:n}}));h(t)}}var OQ={paper:`_paper_unw9o_1`},kQ={Bot:`/admin/bots/new`,ClientApplication:`/admin/clients/new`};function AQ(e,t){let n=e.resourceType||jQ(t),r=e.fields??MQ(n),i=e.filters??(e.resourceType?void 0:NQ(n)),a=e.sortRules??PQ(n),o=e.offset??0,s=e.count??20;return{...e,resourceType:n,fields:r,filters:i,sortRules:a,offset:o,count:s}}function jQ(e){return localStorage.getItem(`defaultResourceType`)??e?.option?.find(e=>e.id===`defaultResourceType`)?.valueString??`Patient`}function MQ(e){let t=FQ(e);if(t?.fields)return t.fields;let 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`)}return n}function NQ(e){return FQ(e)?.filters}function PQ(e){let t=FQ(e);return t?.sortRules?t.sortRules:[{code:`_lastUpdated`,descending:!0}]}function FQ(e){let t=localStorage.getItem(e+`-defaultSearch`);return t?JSON.parse(t):void 0}function IQ(e){localStorage.setItem(`defaultResourceType`,e.resourceType),localStorage.setItem(e.resourceType+`-defaultSearch`,JSON.stringify(e))}async function LQ(e,t){let n=AQ({...e,count:1e3,offset:0},t.getUserConfiguration());return _D(await t.search(n.resourceType,FE({...n,total:`accurate`,fields:void 0})))}function RQ(){let e=Z(),t=zK(),n=LK(),[r,i]=(0,b.useState)();return(0,b.useEffect)(()=>{let r=AQ(CE(n.pathname+n.search),e.getUserConfiguration());n.pathname===`/${r.resourceType}`&&n.search===FE(r)?(IQ(r),i(r)):t(`/${r.resourceType}${FE(r)}`,{replace:!0})?.catch(console.error)},[e,t,n]),!r?.resourceType||!r.fields||r.fields.length===0?(0,L.jsx)(GM,{}):(0,L.jsxs)(Cl,{shadow:`xs`,m:`md`,p:`md`,className:OQ.paper,children:[(0,L.jsx)(K,{order:4,mb:`md`,children:r.resourceType}),(0,L.jsx)(hm,{mb:`md`}),(0,L.jsx)(UB,{checkboxesEnabled:!0,search:r,onClick:e=>t(`/${e.resource.resourceType}/${e.resource.id}`)?.catch(console.error),onAuxClick:e=>window.open(`/${e.resource.resourceType}/${e.resource.id}`,`_blank`),onChange:e=>{t(`/${r.resourceType}${FE(e.definition)}`)?.catch(console.error)},onNew:()=>{t(kQ[r.resourceType]??`/${r.resourceType}/new`)?.catch(console.error)},onExportCsv:()=>{let t=e.fhirUrl(r.resourceType,`$csv`)+FE(r);e.download(t).then(e=>{window.open(window.URL.createObjectURL(e),`_blank`)}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},onExportTransactionBundle:async()=>{LQ(r,e).then(e=>$M(JSON.stringify(e,void 0,2))).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},onDelete:t=>(e.invalidateSearches(r.resourceType),e.executeBatch({resourceType:`Bundle`,type:`batch`,entry:t.map(e=>({request:{method:`DELETE`,url:`${r.resourceType}/${e}`}}))}).then(()=>void 0).catch(e=>{throw q({color:`red`,message:J(e),autoClose:!1}),e})),onBulk:e=>{t(`/bulk/${r.resourceType}?ids=${e.join(`,`)}`)?.catch(console.error)}})]})}function zQ(){let[e]=YA(`ObservationDefinition`,`_count=100`);return e?(0,L.jsxs)(G,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Category`}),(0,L.jsx)(`th`,{children:`Code`}),(0,L.jsx)(`th`,{children:`Method`}),(0,L.jsx)(`th`,{children:`Unit`}),(0,L.jsx)(`th`,{children:`Precision`}),(0,L.jsx)(`th`,{children:`Ranges`})]})}),(0,L.jsx)(`tbody`,{children:e.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(TI,{value:e.category?.[0]})}),(0,L.jsx)(`td`,{children:(0,L.jsx)(TI,{value:e.code})}),(0,L.jsx)(`td`,{children:(0,L.jsx)(TI,{value:e.method})}),(0,L.jsx)(`td`,{children:e.quantitativeDetails?.unit?.text}),(0,L.jsx)(`td`,{children:e.quantitativeDetails?.decimalPrecision}),(0,L.jsx)(`td`,{children:(0,L.jsx)(BQ,{ranges:e.qualifiedInterval})})]},e.id))})]}):(0,L.jsx)(GM,{})}function BQ(e){let{ranges:t}=e;if(!t)return null;let n=VQ(t.map(e=>e.gender));if(n.length>1)return yw(n),(0,L.jsx)(L.Fragment,{children:n.map(t=>(0,L.jsxs)(b.Fragment,{children:[(0,L.jsx)(`div`,{children:(0,L.jsx)(`strong`,{children:dw(t)})}),(0,L.jsx)(BQ,{ranges:e.ranges?.filter(e=>e.gender===t)})]},t))});let r=VQ(t.map(e=>e.age&&Vw(e.age)));return r.length>1?(yw(r),(0,L.jsx)(L.Fragment,{children:r.map(t=>(0,L.jsxs)(b.Fragment,{children:[(0,L.jsx)(`div`,{children:(0,L.jsx)(`strong`,{children:dw(t)})}),(0,L.jsx)(BQ,{ranges:e.ranges?.filter(e=>Vw(e.age)===t)})]},t))})):(0,L.jsx)(L.Fragment,{children:t.map(e=>(0,L.jsx)(`table`,{children:(0,L.jsx)(`tbody`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:e.condition}),(0,L.jsx)(`td`,{children:(0,L.jsx)(II,{value:e.range})})]})})},`range-${e.condition}`))})}function VQ(e){return[...new Set(e.filter(e=>!!e))]}function HQ(){let[e]=YA(`ActivityDefinition`,`_count=100`),[t]=YA(`ObservationDefinition`,`_count=100`);return!e||!t?(0,L.jsx)(GM,{}):(0,L.jsxs)(G,{withTableBorder:!0,withRowBorders:!0,withColumnBorders:!0,children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Category`}),(0,L.jsx)(`th`,{children:`Assay`}),e.map(e=>(0,L.jsx)(`th`,{children:e.name},e.id))]})}),(0,L.jsx)(`tbody`,{children:t.map(t=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:(0,L.jsx)(TI,{value:t.category?.[0]})}),(0,L.jsx)(`td`,{children:(0,L.jsx)(TI,{value:t.code})}),e.map(e=>(0,L.jsx)(`td`,{children:e.observationResultRequirement?.find(e=>e.reference?.includes(t.id))?`✅`:``},e.id))]},t.id))})]})}var UQ={totp:`Authenticator app`,email:`Email`};function WQ(){let e=Z(),[t,n]=(0,b.useState)(),[r,i]=(0,b.useState)(void 0),[a,o]=(0,b.useState)([]),[s,c]=(0,b.useState)([]),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(),[p,m]=(0,b.useState)(!1),[h,g]=(0,b.useState)(!1),[_,v]=(0,b.useState)(!1),[y,x]=(0,b.useState)(),S=(0,b.useCallback)(()=>{e.get(`auth/mfa/status`,{cache:`no-cache`}).then(e=>{n(e.enrollQrCode),i(e.enrolled),o(e.enrolledMethods??[]),c(e.allowedMethods??[`totp`]),u(!!e.mfaRequired),f(e.email)}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[e]);(0,b.useEffect)(()=>{S()},[S]);let C=(0,b.useCallback)(e=>{i(!0),o(t=>t.includes(e)?t:[...t,e])},[]),w=(0,b.useCallback)(t=>{e.post(`auth/mfa/enroll`,{method:`totp`,token:t}).then(()=>{m(!1),C(`totp`),q({color:`green`,message:`Authenticator app enabled`})}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[e,C]),T=(0,b.useCallback)(async()=>{await e.post(`auth/mfa/send-email-challenge`,{})},[e]),E=(0,b.useCallback)(()=>{T().then(()=>g(!0)).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[T]),D=(0,b.useCallback)(async t=>{await e.post(`auth/mfa/enroll`,{method:`email`,token:t}),g(!1),C(`email`),q({color:`green`,message:`Email-based MFA enabled`})},[e,C]),O=(0,b.useCallback)(async t=>e.post(`auth/mfa/disable`,{token:t}),[e]),k=(0,b.useCallback)(async(t,n)=>{await e.post(`auth/mfa/disable`,{method:t,token:n}),x(void 0),q({color:`green`,message:`${UQ[t]} removed`}),S()},[e,S]);if(r===void 0)return null;let A=s.includes(`email`),j=s.includes(`totp`),M=a.includes(`email`),N=a.includes(`totp`),ee=(0,L.jsx)(pg,{title:`Verify your email`,opened:h,onClose:()=>g(!1),children:(0,L.jsx)(aI,{methods:[`email`],email:d,initialEmailMode:!0,onRequestEmailCode:T,onSubmit:D,buttonText:`Verify and enable`})});if(r){let e=A&&!M,n=j&&!N,r=a.length>1,s=M&&!N,c=()=>{s&&T().catch(e=>q({color:`red`,message:J(e),autoClose:!1})),v(!0)},u=e=>{s&&T().catch(e=>q({color:`red`,message:J(e),autoClose:!1})),x(e)};return(0,L.jsxs)(LF,{width:400,children:[ee,(0,L.jsx)(pg,{title:`Disable MFA`,opened:_,onClose:()=>v(!1),children:(0,L.jsx)(aI,{methods:a,email:d,initialEmailMode:s,onRequestEmailCode:T,onSubmit:async e=>{await O(e),v(!1),i(!1),o([]),m(!1),q({id:`mfa-disabled`,color:`green`,title:`Success`,message:`MFA disabled`,icon:(0,L.jsx)(Pj,{})}),S()}})}),(0,L.jsx)(pg,{title:y?`Remove ${UQ[y]}`:void 0,opened:!!y,onClose:()=>x(void 0),children:y&&(0,L.jsx)(aI,{methods:a,email:d,initialEmailMode:s,onRequestEmailCode:T,onSubmit:e=>k(y,e)})}),(0,L.jsx)(pg,{opened:p,onClose:()=>m(!1),children:(0,L.jsx)(rI,{title:`Add an authenticator app`,description:`Scan this QR code with your authenticator app, then enter the code it generates.`,buttonText:`Enroll`,qrCodeUrl:t,onSubmit:e=>w(e.token)})}),(0,L.jsxs)(W,{children:[(0,L.jsxs)(Xp,{py:`xs`,style:{flexDirection:`column`},children:[(0,L.jsx)(RF,{size:32}),(0,L.jsx)(K,{order:3,py:`md`,ta:`center`,children:`Multi-factor authentication`})]}),(0,L.jsxs)(W,{pb:`lg`,children:[(0,L.jsx)(H,{c:`dimmed`,children:`Enabled methods:`}),(0,L.jsx)(Oh,{children:a.map(e=>(0,L.jsx)(Oh.Item,{children:(0,L.jsxs)(V,{justify:`space-between`,wrap:`nowrap`,children:[(0,L.jsx)(H,{children:UQ[e]}),r&&(0,L.jsx)(Rd,{href:`#`,c:`red`,onClick:()=>u(e),children:`Remove`})]})},e))})]}),(e||n)&&(0,L.jsxs)(W,{children:[e&&(0,L.jsx)(U,{variant:`default`,onClick:E,children:`Add email-based MFA`}),n&&(0,L.jsx)(U,{variant:`default`,onClick:()=>m(!0),children:`Add an authenticator app`})]}),!l&&(0,L.jsx)(V,{children:(0,L.jsx)(U,{color:`red`,variant:`outline`,onClick:c,fullWidth:!0,children:`Disable MFA`})})]})]})}return(0,L.jsxs)(LF,{width:400,children:[ee,(0,L.jsx)(iI,{allowedMethods:s,qrCodeUrl:t,onEnrollEmail:E,onEnrollTotp:w,totpTitle:`Multi Factor Auth Setup`})]})}var GQ={baseUrl:`__MEDPLUM_BASE_URL__`,clientId:`__MEDPLUM_CLIENT_ID__`,googleClientId:`__GOOGLE_CLIENT_ID__`,recaptchaSiteKey:`__RECAPTCHA_SITE_KEY__`,registerEnabled:`__MEDPLUM_REGISTER_ENABLED__`,awsTextractEnabled:void 0};function KQ(){return GQ}function qQ(){return YQ(`registerEnabled`)}function JQ(){return YQ(`awsTextractEnabled`)}function YQ(e){try{return GQ[e]!==!1&&GQ[e]!==`false`}catch{return!0}}function XQ(){let e=zK(),[t]=hJ(),n=Z(),r=t.get(`scope`)||`openid`,i=t.get(`client_id`),a=t.get(`login`),o=!!i&&i!==`medplum-cli`,[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)(o);if((0,b.useEffect)(()=>{if(!o)return;async function e(){try{let e=await n.get(`/auth/clientinfo/${i}`);c(e)}catch(e){q({id:`clientinfofail`,title:`Failed to retrieve client information.`,color:`red`,message:J(e),withCloseButton:!0})}finally{u(!1)}}e().catch(console.error)},[n,i,o]),!i)return null;if(l)return(0,L.jsx)(GM,{});function d(e){let n=new URL(t.get(`redirect_uri`));for(let e of[`scope`,`state`,`nonce`])t.has(e)&&n.searchParams.set(e,t.get(e));n.searchParams.set(`code`,e),uD.assign(n.toString())}return(0,L.jsxs)(wI,{onCode:d,onForgotPassword:()=>e(`/resetpassword`)?.catch(console.error),onRegister:()=>e(`/register`)?.catch(console.error),googleClientId:KQ().googleClientId,clientId:i||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:s?.showScopeSelection??r!==`openid`,login:a||void 0,children:[s?.logo?.url?(0,L.jsx)(`img`,{src:s?.logo?.url,alt:`Welcome Logo`,height:60,style:{width:`auto`}}):(0,L.jsx)(RF,{size:32}),(0,L.jsx)(K,{children:s?.welcomeString??`Sign in to Medplum`})]})}function ZQ(){let e=Z(),t=zK(),[n]=hJ(),r=KQ();return(0,b.useEffect)(()=>{e.getProfile()&&t(`/signin?project=new`)?.catch(console.error)},[e,t]),qQ()?(0,L.jsxs)(mI,{type:`project`,projectId:`new`,onSuccess:()=>{window.location.href=`/`},googleClientId:r.googleClientId,recaptchaSiteKey:r.recaptchaSiteKey,login:n.get(`login`)||void 0,onSignIn:()=>t(`/signin`)?.catch(console.error),children:[(0,L.jsx)(RF,{size:32}),(0,L.jsx)(K,{order:3,py:`lg`,children:`Register a new account`})]}):(0,L.jsx)(LF,{width:450,children:(0,L.jsx)(jd,{icon:(0,L.jsx)(pj,{size:16}),title:`New projects disabled`,color:`red`,children:`New projects are disabled on this server.`})})}function QQ(){let e=zK(),[t]=hJ(),n=KQ(),r=t.get(`project`)||void 0;return(0,L.jsx)(hI,{projectId:r,recaptchaSiteKey:n.recaptchaSiteKey,onSignIn:()=>e(`/signin`)?.catch(console.error),onRegister:qQ()?()=>e(`/register`)?.catch(console.error):void 0})}function $Q(){let{resourceType:e,id:t}=UK(),n=eA({reference:e+`/`+t}),r=zK(),i=(0,b.useCallback)(()=>{r(0)?.catch(console.error)},[r]);return n?(0,L.jsx)(LF,{maw:700,children:n.resourceType===`Patient`?(0,L.jsx)(vV,{patient:n,onSaved:i}):(0,L.jsx)(jd,{icon:(0,L.jsx)(pj,{size:16}),title:`Unsupported resource type`,color:`red`,children:`Account management is only supported for Patient resources`})}):null}function e$(e){let t=Z(),[n,r]=(0,b.useState)(),[i,a]=(0,b.useState)();return i?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`p`,{children:`Request group created successfully.`}),(0,L.jsxs)(`ul`,{children:[(0,L.jsxs)(`li`,{children:[`Go to the`,` `,(0,L.jsx)(eN,{to:i,suffix:`checklist`,children:`Request Group`})]}),(0,L.jsxs)(`li`,{children:[`Back to the `,(0,L.jsx)(eN,{to:e.planDefinition,children:`Plan Definition`})]})]})]}):(0,L.jsx)(NP,{onSubmit:()=>{t.post(t.fhirUrl(`PlanDefinition`,e.planDefinition.id,`$apply`),{resourceType:`Parameters`,parameter:[{name:`subject`,valueString:n?.reference}]}).then(a).catch(console.log)},children:(0,L.jsxs)(W,{children:[(0,L.jsxs)(K,{children:[`Start "`,e.planDefinition.title,`"`]}),(0,L.jsxs)(H,{children:[`Use the `,(0,L.jsx)(`strong`,{children:`Apply`}),` operation to create a group of tasks for a workflow.`]}),(0,L.jsx)(H,{children:`The following tasks will be created:`}),(0,L.jsx)(`ul`,{children:e.planDefinition.action?.map((e,t)=>(0,L.jsxs)(`li`,{children:[e.definitionCanonical?.startsWith(`Questionnaire/`)&&`Questionnaire request: `,e.title&&(0,L.jsx)(L.Fragment,{children:e.title}),e.code&&(0,L.jsx)(TI,{value:e.code[0]})]},`action-${t}`))}),(0,L.jsx)(eL,{title:`Subject`,children:(0,L.jsx)(ML,{name:`subject`,targetTypes:[`Patient`,`Practitioner`],defaultValue:n,onChange:r})}),(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,children:(0,L.jsx)(U,{type:`submit`,children:`Go`})})]})})}function t$(){let{resourceType:e,id:t}=UK(),n=eA({reference:e+`/`+t});return n?(0,L.jsx)(LF,{children:(0,L.jsx)(e$,{planDefinition:n})}):null}function n$(){let{resourceType:e,id:t}=UK(),n=eA({reference:e+`/`+t}),[r,i]=YA(`Questionnaire`,`subject-type=`+e),[a,o]=YA(`ClientApplication`,{_count:1e3});if(!n||i||o)return(0,L.jsx)(GM,{});let s=a?.filter(t=>r$(e)&&!!t.launchUri);if((!r||r.length===0)&&(!s||s.length===0))return(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Apps`}),(0,L.jsxs)(`p`,{children:[`No apps found. Contact your administrator or `,(0,L.jsx)(`a`,{href:`mailto:support@medplum.com`,children:`Medplum Support`}),` to add automation here.`]})]});let c,l;return n.resourceType===`Patient`?c=DC(n):n.resourceType===`Encounter`&&(c=n.subject,l=DC(n)),(0,L.jsxs)(LF,{children:[r?.map(e=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(K,{order:3,children:(0,L.jsx)(eN,{to:`/forms/${e.id}?subject=${OC(n)}`,children:e.title||e.name})}),(0,L.jsx)(H,{children:e.description})]},e.id)),s?.map(e=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(K,{order:3,children:(0,L.jsx)(CJ,{client:e,patient:c,encounter:l,children:e.name})}),(0,L.jsx)(H,{children:e.description})]},e.id))]})}function r$(e){return e===`Patient`||e===`Encounter`}function i$(){let{resourceType:e,id:t}=UK(),n=zK(),[r,i]=(0,b.useState)({resourceType:`AuditEvent`,filters:[{code:`entity`,operator:X.EQUALS,value:`${e}/${t}`}],fields:[`id`,`outcome`,`outcomeDesc`,`_lastUpdated`],sortRules:[{code:`-_lastUpdated`}],count:20});return(0,L.jsx)(LF,{children:(0,L.jsx)(UB,{search:r,onClick:e=>n(`/${e.resource.resourceType}/${e.resource.id}`)?.catch(console.error),onChange:e=>i(e.definition),hideFilters:!0})})}function a$(){let e=Z(),{resourceType:t,id:n}=UK(),r=e.readHistory(t,n).read();return(0,L.jsx)(lm,{maw:1200,children:(0,L.jsx)(IF,{children:(0,L.jsx)(sU,{history:r})})})}var o$={hl7Input:`_hl7Input_1tb0t_1`,splitButton:`_splitButton_1tb0t_10`,menuControl:`_menuControl_1tb0t_15`,eventData:`_eventData_1tb0t_22`};function s$(e){return(0,L.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 c$(e){let t=e.defaultValue,n=new URL(`https://codeeditor.medplum.com/${e.language}-editor.html`);return e.module&&n.searchParams.set(`module`,e.module),(0,L.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:e=>{QM(e.currentTarget,{command:`setValue`,value:t}).catch(console.error)}})}var l$=`{
|
|
229
229
|
"resourceType": "Patient",
|
|
230
230
|
"name": [
|
|
231
231
|
{
|
|
@@ -235,12 +235,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
235
235
|
"family": "Smith"
|
|
236
236
|
}
|
|
237
237
|
]
|
|
238
|
-
}`,
|
|
238
|
+
}`,u$=`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 d$(){let e=Z(),t=Dr(),{id:n}=UK(),[r,i]=(0,b.useState)(),[a,o]=(0,b.useState)(),[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)(l$),[d,f]=(0,b.useState)(u$),[p,m]=(0,b.useState)(wD.FHIR_JSON),h=(0,b.useRef)(null),g=(0,b.useRef)(null),[_,v]=(0,b.useState)(!1),[y,x]=(0,b.useState)(!1),[S,C]=(0,b.useState)(`sync`),[w,T]=(0,b.useState)();(0,b.useEffect)(()=>{e.readResource(`Bot`,n).then(async t=>{i(t);let n=t.runtimeVersion===`vmcontext`||t.runtimeVersion===`awslambda`;x(n),C(n&&t.streamingEnabled?`sse`:`sync`),o(t.runtimeVersion===`vmcontext`?`commonjs`:`esnext`),c(await m$(e,t))}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[e,n]);let E=(0,b.useCallback)(async()=>QM(h.current,{command:`getValue`}),[]),D=(0,b.useCallback)(async()=>QM(h.current,{command:`getOutput`}),[]),O=(0,b.useCallback)(async()=>p===wD.FHIR_JSON?JSON.parse(l):d,[p,l,d]),k=(0,b.useCallback)(async t=>{t.preventDefault(),t.stopPropagation(),v(!0);try{let t=await E(),r=await D(),i=await e.createAttachment({data:t,filename:`index.ts`,contentType:wD.TYPESCRIPT}),o=await e.createAttachment({data:r,filename:a===`commonjs`?`index.cjs`:`index.mjs`,contentType:wD.JAVASCRIPT}),s=[{op:`add`,path:`/sourceCode`,value:i},{op:`add`,path:`/executableCode`,value:o}];await e.patchResource(`Bot`,n,s),q({color:`green`,message:`Saved`})}catch(e){q({color:`red`,message:J(e),autoClose:!1})}finally{v(!1)}},[e,n,a,E,D]),A=(0,b.useCallback)(async t=>{t.preventDefault(),t.stopPropagation(),v(!0);try{await e.post(e.fhirUrl(`Bot`,n,`$deploy`)),q({color:`green`,message:`Deployed`})}catch(e){q({color:`red`,message:J(e),autoClose:!1})}finally{v(!1)}},[e,n]),j=(0,b.useCallback)(async t=>{t.preventDefault(),t.stopPropagation(),v(!0),T(void 0);try{let t=await O(),r=await e.post(e.fhirUrl(`Bot`,n,`$execute`),t,p);await QM(g.current,{command:`setValue`,value:r}),q({color:`green`,message:`Success`})}catch(e){q({color:`red`,message:J(e),autoClose:!1})}finally{v(!1)}},[e,n,O,p]),M=(0,b.useCallback)(async t=>{t.preventDefault(),t.stopPropagation(),v(!0),T([]);let r=0;try{let t=await O(),i=p===wD.FHIR_JSON?JSON.stringify(t):t,a=await e.downloadResponse(e.fhirUrl(`Bot`,n,`$execute`),{method:`POST`,body:i,headers:{"Content-Type":p,Accept:wD.EVENT_STREAM}});if(!a.ok){let e=await a.text(),t=e;try{t=JSON.parse(e)}catch{}throw new vS(yS(t))}if(!a.body)throw Error(`Streaming is not supported in this environment`);let o=a.body.pipeThrough(new TextDecoderStream).getReader(),s=``;for(;;){let{done:e,value:t}=await o.read();if(e)break;s+=t.replace(/\r\n/g,`
|
|
239
239
|
`);let n=s.indexOf(`
|
|
240
240
|
|
|
241
|
-
`);for(;n!==-1;){let e=s.slice(0,n);s=s.slice(n+2);let t=
|
|
241
|
+
`);for(;n!==-1;){let e=s.slice(0,n);s=s.slice(n+2);let t=p$(e);if(t){let e={key:r++,...t};T(t=>[...t??[],e])}n=s.indexOf(`
|
|
242
242
|
|
|
243
|
-
`)}}q({color:`green`,message:`Stream complete`})}catch(e){q({color:`red`,message:J(e),autoClose:!1})}finally{v(!1)}},[e,n,O,p]);if(!r||s===void 0)return null;let N=y?S:`sync`;return(0,L.jsxs)(km,{m:0,gutter:0,style:{overflow:`hidden`},children:[(0,L.jsx)(km.Col,{span:8,children:(0,L.jsxs)(Cl,{m:2,pb:`xs`,pr:`xs`,pt:`xs`,shadow:`md`,mih:400,children:[(0,L.jsx)(
|
|
243
|
+
`)}}q({color:`green`,message:`Stream complete`})}catch(e){q({color:`red`,message:J(e),autoClose:!1})}finally{v(!1)}},[e,n,O,p]);if(!r||s===void 0)return null;let N=y?S:`sync`;return(0,L.jsxs)(km,{m:0,gutter:0,style:{overflow:`hidden`},children:[(0,L.jsx)(km.Col,{span:8,children:(0,L.jsxs)(Cl,{m:2,pb:`xs`,pr:`xs`,pt:`xs`,shadow:`md`,mih:400,children:[(0,L.jsx)(c$,{iframeRef:h,language:`typescript`,module:a,testId:`code-frame`,defaultValue:s,minHeight:`528px`}),(0,L.jsxs)(V,{justify:`flex-end`,gap:`xs`,children:[(0,L.jsx)(U,{type:`button`,onClick:k,loading:_,leftSection:(0,L.jsx)(Uj,{size:`1rem`}),children:`Save`}),(0,L.jsx)(U,{type:`button`,onClick:A,loading:_,leftSection:(0,L.jsx)(Lj,{size:`1rem`}),children:`Deploy`}),(0,L.jsxs)(V,{wrap:`nowrap`,gap:0,children:[(0,L.jsx)(U,{type:`button`,onClick:N===`sse`?M:j,loading:_,leftSection:N===`sse`?(0,L.jsx)(bj,{size:`1rem`}):(0,L.jsx)(yM,{size:`1rem`}),className:y?o$.splitButton:void 0,children:N===`sse`?`Execute SSE`:`Execute`}),y&&(0,L.jsxs)(Xh,{transitionProps:{transition:`pop`},position:`bottom-end`,withinPortal:!0,children:[(0,L.jsx)(Xh.Target,{children:(0,L.jsx)(bu,{variant:`filled`,color:t.primaryColor,size:36,className:o$.menuControl,"aria-label":`Execute options`,loading:_,children:(0,L.jsx)(Nj,{size:14,stroke:1.5})})}),(0,L.jsx)(Xh.Dropdown,{children:N===`sse`?(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(yM,{size:14,stroke:1.5}),onClick:e=>(C(`sync`),j(e)),children:`Execute`}):(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(bj,{size:14,stroke:1.5}),onClick:e=>(C(`sse`),M(e)),children:`Execute SSE`})})]})]})]})]})}),(0,L.jsxs)(km.Col,{span:4,children:[(0,L.jsxs)(Cl,{m:2,pb:`xs`,pr:`xs`,pt:`xs`,shadow:`md`,children:[(0,L.jsx)(Ig,{data:[{label:`FHIR`,value:wD.FHIR_JSON},{label:`HL7`,value:wD.HL7_V2}],onChange:e=>m(e.currentTarget.value)}),p===wD.FHIR_JSON?(0,L.jsx)(vh,{value:l,onChange:e=>u(e),autosize:!0,minRows:15}):(0,L.jsx)(`textarea`,{className:o$.hl7Input,value:d,onChange:e=>f(e.currentTarget.value),rows:15})]}),(0,L.jsx)(Cl,{m:2,p:`xs`,shadow:`md`,children:w===void 0?(0,L.jsx)(s$,{iframeRef:g,className:`medplum-bot-output-frame`,testId:`output-frame`,minHeight:`200px`}):(0,L.jsx)(f$,{events:w,loading:_})})]})]})}function f$(e){let{events:t,loading:n}=e;return(0,L.jsxs)(W,{gap:`xs`,"data-testid":`sse-output`,children:[(0,L.jsxs)(V,{justify:`space-between`,children:[(0,L.jsx)(H,{fw:500,size:`sm`,children:`Event stream`}),(0,L.jsxs)(Ip,{color:n?`blue`:`gray`,variant:`light`,children:[n?`Listening`:`Closed`,` · `,t.length]})]}),(0,L.jsx)(ml.Autosize,{mah:400,type:`auto`,children:t.length===0?(0,L.jsx)(H,{c:`dimmed`,size:`sm`,children:n?`Waiting for events…`:`No events received.`}):(0,L.jsx)(W,{gap:`xs`,children:t.map(e=>(0,L.jsx)(om,{block:!0,className:o$.eventData,children:e.data},e.key))})})]})}function p$(e){let t,n=[];for(let r of e.split(`
|
|
244
244
|
`)){if(r===``||r.startsWith(`:`))continue;let e=r.indexOf(`:`),i=e===-1?r:r.slice(0,e),a=e===-1?``:r.slice(e+1);a.startsWith(` `)&&(a=a.slice(1)),i===`event`?t=a:i===`data`&&n.push(a)}if(t!==void 0||n.length!==0)return{event:t,data:n.join(`
|
|
245
|
-
`)}}async function u$(e,t){if(t.sourceCode?.url){let n=t.sourceCode.url?.split(`/`)?.find(tw);return(await e.download(e.fhirUrl(`Binary`,n))).text()}return t.code??``}function d$(e){let t=e.meta;return t&&={...t,lastUpdated:void 0,versionId:void 0,author:void 0},{...e,meta:t}}function f$(){let e=Z(),{resourceType:t,id:n}=zK(),r={reference:t+`/`+n},i=(0,b.useCallback)(t=>{e.updateResource(d$(t)).then(()=>{q({color:`green`,message:`Success`})}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})})},[e]);switch(t){case`PlanDefinition`:return(0,L.jsx)(LF,{children:(0,L.jsx)(TV,{value:r,onSubmit:i})});case`Questionnaire`:return(0,L.jsx)(LF,{children:(0,L.jsx)(cH,{questionnaire:r,onSubmit:i})});default:return null}}function p$(){let{resourceType:e,id:t}=zK(),n=eA({reference:e+`/`+t}),r=FK();return n?(0,L.jsx)(LF,{children:(0,L.jsx)(GH,{value:n,onStart:(e,t)=>r(`/forms/${kC(t)}`)?.catch(console.error),onEdit:(e,t,n)=>r(`/${n.reference}}`)?.catch(console.error)})}):null}function m$(){let e=Z(),{resourceType:t,id:n}=zK(),r=eA({reference:t+`/`+n}),i=(0,b.useRef)(0),[a,o]=(0,b.useState)([]);(0,b.useEffect)(()=>{r&&o((r.payload??Dw).map(e=>({key:i.current++,item:e})))},[r]);let s=(0,b.useCallback)((e,t)=>{o(n=>n.map(n=>n.key===e?{...n,item:{...n.item,contentString:t}}:n))},[]),c=(0,b.useCallback)(()=>{o(e=>[...e,{key:i.current++,item:{contentString:``}}])},[]),l=(0,b.useCallback)(()=>{r&&e.updateResource(d$({...r,payload:a.map(e=>e.item)})).then(()=>q({color:`green`,message:`Saved`})).catch(e=>q({color:`red`,message:J(e)}))},[e,r,a]);return r?(0,L.jsx)(LF,{children:(0,L.jsxs)(W,{children:[a.filter(({item:e})=>`contentString`in e).map(({key:e,item:t})=>(0,L.jsx)(hh,{autosize:!0,minRows:3,maxRows:20,value:t.contentString??``,onChange:t=>s(e,t.currentTarget.value),placeholder:`Enter content...`},e)),(0,L.jsxs)(V,{justify:`flex-end`,children:[(0,L.jsx)(U,{variant:`outline`,onClick:c,children:`Add payload`}),(0,L.jsx)(U,{onClick:l,children:`Save`})]}),(0,L.jsx)(H,{size:`xs`,c:`dimmed`,children:`This tab manages string payloads only. Attachments and References can be managed in the Edit tab.`})]})}):null}function h$(){let e=Z(),{resourceType:t,id:n}=zK(),r=FK();return(0,L.jsxs)(LF,{children:[(0,L.jsxs)(`p`,{children:[`Are you sure you want to delete this `,t,`?`]}),(0,L.jsx)(U,{color:`red`,onClick:()=>{e.deleteResource(t,n).then(()=>r(`/${t}`)?.catch(console.error)).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},children:`Delete`})]})}var g$={selectProfileBtn:`_selectProfileBtn_tbaz6_1`,chevron:`_chevron_tbaz6_13`};function _$(){let{resourceType:e,id:t}=zK(),n=eA({reference:e+`/`+t}),[r,i]=(0,b.useState)(),a=Bf({onDropdownClose:()=>a.resetSelectedOption()}),o=(0,b.useMemo)(()=>{if(KC(n?.meta?.profile))return[(0,L.jsx)(Uf.Option,{value:``,children:`None`},``),...n.meta.profile.map(e=>(0,L.jsx)(Uf.Option,{value:e,children:e},e))]},[n?.meta?.profile]);if((0,b.useEffect)(()=>{n?.meta?.profile?.length===1&&i(n.meta.profile[0])},[n?.meta?.profile]),!n)return null;let s;return KC(o)&&(s=(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsxs)(W,{align:`flex-end`,gap:`xs`,children:[(0,L.jsxs)(Uf,{store:a,width:250,position:`bottom-end`,withinPortal:!1,onOptionSubmit:e=>{i(e),a.closeDropdown()},children:[(0,L.jsx)(Uf.Target,{children:(0,L.jsx)(vl,{onClick:()=>a.toggleDropdown(),children:(0,L.jsxs)(om,{fw:`bold`,fs:`sm`,className:g$.selectProfileBtn,children:[(0,L.jsx)(`span`,{children:`Pick profile`}),(0,L.jsx)(Nj,{stroke:1.5,className:g$.chevron})]})})}),(0,L.jsx)(Uf.Dropdown,{w:`max-content`,children:(0,L.jsx)(Uf.Options,{children:o})})]}),(0,L.jsx)(z,{children:r?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(H,{span:!0,size:`sm`,c:`dimmed`,children:`Displaying profile:\xA0`}),(0,L.jsx)(H,{span:!0,size:`sm`,children:r||`Nothing selected`})]}):(0,L.jsx)(H,{span:!0,size:`sm`,c:`dimmed`,children:`No profile displayed`})})]})})),(0,L.jsx)(LF,{children:(0,L.jsxs)(W,{gap:`xl`,children:[s,(0,L.jsx)(KR,{value:n,profileUrl:r})]})})}function v$(){let e=Z(),{resourceType:t,id:n}=zK(),[r,i]=(0,b.useState)(),[a,o]=(0,b.useState)(),s=FK(),[c,l]=(0,b.useState)();(0,b.useEffect)(()=>{e.readResource(t,n).then(e=>{i(ew(e)),o(ew(e))}).catch(e=>{l(yS(e)),q({color:`red`,message:J(e),autoClose:!1})})},[e,t,n]);let u=(0,b.useCallback)(r=>{l(void 0),e.updateResource(d$(r)).then(()=>{s(`/${t}/${n}/details`)?.catch(console.error),q({id:`succes`,color:`green`,message:`Success`})}).catch(e=>{l(yS(e)),q({color:`red`,message:J(e),autoClose:!1})})},[e,t,n,s]),d=(0,b.useCallback)(i=>{l(void 0);let a=mk(r,d$(i));e.patchResource(t,n,a).then(()=>{s(`/${t}/${n}/details`)?.catch(console.error),q({id:`succes`,color:`green`,message:`Success`})}).catch(e=>{l(yS(e)),q({color:`red`,message:J(e),autoClose:!1})})},[e,t,n,r,s]),f=(0,b.useCallback)(()=>s(`/${t}/${n}/delete`)?.catch(console.error),[s,t,n]);return a?(0,L.jsx)(LF,{children:(0,L.jsx)(cU,{defaultValue:a,onSubmit:u,onPatch:d,onDelete:f,outcome:c})}):null}function y$(){let{resourceType:e,id:t}=zK(),n=eA({reference:e+`/`+t});return n?(0,L.jsx)(LF,{maw:700,children:n.resourceType===`Patient`?(0,L.jsx)(yV,{patient:n}):(0,L.jsx)(jd,{icon:(0,L.jsx)(pj,{size:16}),title:`Unsupported export type`,color:`red`,children:`This page is only supported for Patient resources`})}):null}function b$({resource:e,currentProfile:t,onChange:n}){let r=e.resourceType,i=Z(),[a,o]=(0,b.useState)();return(0,b.useEffect)(()=>{i.searchResources(`StructureDefinition`,{type:r,derivation:`constraint`,_count:50}).then(e=>{o(e.filter(nL))}).catch(console.error)},[i,n,r]),(0,L.jsx)(Ab,{value:t?.url,onChange:e=>{let t=a?.find(t=>t.url===e);t&&n(t)},children:(0,L.jsx)(Ab.List,{children:a?.map(t=>{let n=e.meta?.profile?.includes(t.url),r=n?`This profile is present in this resource's meta.profile property.`:`This profile is not included in this resource's meta.profile property.`;return(0,L.jsx)(Ab.Tab,{value:t.url,title:r,rightSection:n&&(0,L.jsx)(Pb,{variant:`outline`,color:`green`,size:`xs`,style:{borderStyle:`none`},children:(0,L.jsx)(UM,{size:`90%`})}),children:t.title||t.name},t.url)})})})}function x$(e,t){let n=Z(),r=FK();return{defaultValue:{resourceType:e},handleSubmit:e=>{t&&t(void 0),n.createResource(e).then(e=>r(`/`+e.resourceType+`/`+e.id)).catch(e=>{t&&t(yS(e)),q({color:`red`,message:J(e),autoClose:!1,styles:{description:{whiteSpace:`pre-line`}}})})}}}function S$(){let{resourceType:e}=zK(),t=NK(),[n,r]=(0,b.useState)(),{defaultValue:i,handleSubmit:a}=x$(e,r),[o,s]=(0,b.useState)(),c=t.pathname.toLowerCase().endsWith(`profiles`),l=(0,b.useCallback)(e=>{let t=d$(e);o&&Tw(t,o.url),a(t)},[o,a]);return c?(0,L.jsx)(LF,{children:(0,L.jsxs)(W,{children:[(0,L.jsx)(b$,{resource:i,currentProfile:o,onChange:s}),o?(0,L.jsx)(cU,{defaultValue:i,onSubmit:l,outcome:n,profileUrl:o.url},o.url):(0,L.jsx)(H,{my:`lg`,fz:`lg`,fs:`italic`,ta:`center`,children:`Select a profile above`})]})}):(0,L.jsx)(LF,{children:(0,L.jsx)(cU,{defaultValue:i,onSubmit:a,outcome:n})})}function C$(){let e=Z(),{resourceType:t,id:n}=zK(),r=e.readHistory(t,n).read();return(0,L.jsx)(LF,{children:(0,L.jsx)(lU,{history:r})})}function w$(){let{resourceType:e}=zK(),[t,n]=(0,b.useState)(),{defaultValue:r,handleSubmit:i}=x$(e,n),a=(0,b.useCallback)(e=>{i(JSON.parse(e[`new-resource`]))},[i]);return(0,L.jsxs)(LF,{children:[t&&(0,L.jsx)(oI,{outcome:t}),(0,L.jsxs)(NP,{onSubmit:a,children:[(0,L.jsx)(vh,{name:`new-resource`,"data-testid":`create-resource-json`,autosize:!0,minRows:24,defaultValue:VC(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,wrap:`nowrap`,children:(0,L.jsx)(U,{type:`submit`,children:`OK`})})]})]})}function T$(){let e=Z(),{resourceType:t,id:n}=zK(),r=eA({reference:t+`/`+n}),i=FK(),[a,o]=(0,b.useState)(),s=(0,b.useCallback)(r=>{e.updateResource(d$(JSON.parse(r.resource))).then(()=>{o(void 0),i(`/${t}/${n}/details`)?.catch(console.error),q({color:`green`,message:`Success`})}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})})},[e,t,n,i]);return r?(0,L.jsxs)(LF,{children:[a&&(0,L.jsx)(oI,{outcome:a}),(0,L.jsxs)(NP,{onSubmit:s,children:[(0,L.jsx)(vh,{name:`resource`,"data-testid":`resource-json`,autosize:!0,minRows:24,defaultValue:VC(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,wrap:`nowrap`,children:(0,L.jsx)(U,{type:`submit`,children:`OK`})})]})]}):null}function E$(e){let{resourceType:t,id:n}=e;return(0,L.jsxs)(LF,{children:[(0,L.jsxs)(jd,{icon:(0,L.jsx)(pj,{size:16}),mb:`xl`,children:[`This is just a preview! Access your form here:`,(0,L.jsx)(`br`,{}),(0,L.jsx)(Rd,{href:`/forms/${n}`,children:`/forms/${n}`})]}),(0,L.jsx)(NH,{questionnaire:{reference:t+`/`+n},onSubmit:()=>alert(`You submitted the preview`)})]})}var D$={propertyTable:`_propertyTable_1xts4_1`,propertiesTitle:`_propertiesTitle_1xts4_17`};function O$(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 k$(e){let{properties:t}=e,n=t.map(e=>{let t=``,n=``,r=``;return e.part?.forEach(e=>{e.name===`code`?t=e.valueCode||``:e.name===`description`?n=e.valueString||``:e.name===`value`&&(r=O$(e))}),{code:t,description:n,value:r}});return(0,L.jsxs)(G,{className:D$.propertyTable,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Code`}),(0,L.jsx)(G.Th,{children:`Description`}),(0,L.jsx)(G.Th,{children:`Value`})]})}),(0,L.jsx)(G.Tbody,{children:n.map((e,t)=>(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:e.code}),(0,L.jsx)(G.Td,{children:e.description}),(0,L.jsx)(G.Td,{children:e.value})]},`property-${t}`))})]})}function A$(e){let{valueSet:t}=e,n=Z(),r=t.url,[i,a]=(0,b.useState)(),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(),f=(0,b.useCallback)(async e=>{if(a(e),s(void 0),d(void 0),!e?.code||!e?.system){l(!1);return}l(!0);try{let t=new URLSearchParams({system:e.system,code:e.code}),r=n.fhirUrl(`CodeSystem`,`$lookup`)+`?`+t.toString(),i=await n.get(r);s(i)}catch(e){d(e instanceof Error?e:Error(String(e)))}finally{l(!1)}},[n]),p=(0,b.useMemo)(()=>o?.parameter?.filter(e=>e.name===`property`&&e.part)??[],[o]),m=p.length>0;return(0,L.jsx)(LF,{children:(0,L.jsxs)(W,{gap:`xl`,children:[(0,L.jsx)(UP,{binding:r,placeholder:`Select a value from the ValueSet`,onChange:e=>f(e[0]),defaultValue:i,maxValues:1}),i?(0,L.jsxs)(W,{gap:`md`,children:[(0,L.jsxs)(DF,{children:[(0,L.jsx)(OF,{term:`Code`,children:i.code}),i.system&&(0,L.jsx)(OF,{term:`System`,children:i.system}),i.display&&(0,L.jsx)(OF,{term:`Display`,children:i.display})]}),c&&(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(fu,{size:`sm`}),(0,L.jsx)(H,{size:`sm`,c:`dimmed`,children:`Loading properties...`})]}),!c&&u&&(0,L.jsxs)(jd,{icon:(0,L.jsx)(pj,{size:16}),title:`Lookup Failed`,color:`red`,children:[`Failed to retrieve code information: `,J(u)]}),!c&&!u&&m&&(0,L.jsx)(WM,{children:(0,L.jsxs)(W,{gap:`xs`,mt:`lg`,children:[(0,L.jsx)(H,{fw:500,size:`sm`,c:`dimmed`,className:D$.propertiesTitle,children:`Properties`}),(0,L.jsx)(k$,{properties:p})]})})]}):null]})})}function j$(){let{resourceType:e,id:t}=zK(),n=eA({reference:e+`/`+t});return n?n.resourceType===`Questionnaire`?(0,L.jsx)(E$,{resourceType:e,id:t}):n.resourceType===`ValueSet`?(0,L.jsx)(A$,{valueSet:n}):null:null}function M$(){let e=Z(),{resourceType:t,id:n}=zK(),[r,i]=(0,b.useState)(),[a,o]=(0,b.useState)();return(0,b.useEffect)(()=>{e.readResource(t,n).then(e=>i(ew(e))).catch(e=>{q({color:`red`,message:J(e)})})},[e,t,n]),r?(0,L.jsxs)(LF,{children:[(0,L.jsxs)(K,{order:2,children:[`Available `,t,` profiles`]}),(0,L.jsx)(W,{children:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(b$,{resource:r,currentProfile:a,onChange:o}),a?(0,L.jsx)(N$,{profile:a,resource:r,onResourceUpdated:e=>i(e)},a.url):(0,L.jsx)(H,{my:`lg`,fz:`lg`,fs:`italic`,ta:`center`,children:`Select a profile above`})]})})]}):null}var N$=({profile:e,resource:t,onResourceUpdated:n})=>{let r=Z(),[i,a]=(0,b.useState)(),[o,s]=(0,b.useState)(()=>t.meta?.profile?.includes(e.url)),c=(0,b.useCallback)(t=>{a(void 0);let i=d$(t);o?Tw(i,e.url):Ew(i,e.url),r.updateResource(i).then(e=>{n(e),q({color:`green`,message:`Success`})}).catch(e=>{a(yS(e)),q({color:`red`,message:J(e),autoClose:!1})})},[r,e.url,n,o]);return(0,L.jsxs)(W,{children:[(0,L.jsx)(nb,{size:`md`,checked:o,label:`Conform resource to ${e.title}`,onChange:e=>s(e.currentTarget.checked),"data-testid":`profile-toggle`}),o?(0,L.jsx)(cU,{profileUrl:e.url,defaultValue:t,onSubmit:c,outcome:i}):(0,L.jsx)(`form`,{noValidate:!0,onSubmit:e=>{e.preventDefault(),c(t)},children:(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,children:(0,L.jsx)(U,{type:`submit`,children:`OK`})})})]})},P$={"Create Only":`create`,"Update Only":`update`,"Delete Only":`delete`,"All Interactions":void 0},F$=Object.keys(P$);function I$(){let e=Z(),{id:t}=zK(),n=eA({reference:`Questionnaire/${t}`}),[r,i]=(0,b.useState)(),[a,o]=(0,b.useState)(`create`),[s,c]=(0,b.useState)(0),l=e.searchResources(`Subscription`,`status=active&_count=100`).read().filter(e=>L$(e,n));function u(){r&&n&&e.createResource({resourceType:`Subscription`,status:`active`,reason:`Connect bot ${r.name} to questionnaire responses`,criteria:`QuestionnaireResponse?questionnaire=${n.url?`${n.url},${OC(n)}`:OC(n)}`,channel:{type:`rest-hook`,endpoint:OC(r)},...a?{extension:[{url:`https://medplum.com/fhir/StructureDefinition/subscription-supported-interaction`,valueCode:a}]}:void 0}).then(()=>{i(void 0),c(Date.now()),e.invalidateSearches(`Subscription`),q({color:`green`,message:`Success`})}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}return(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Bots`}),(0,L.jsxs)(W,{children:[l.length===0&&(0,L.jsx)(`p`,{children:`No bots found.`}),l.map(e=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{children:(0,L.jsx)(uR,{value:{reference:e.channel?.endpoint},link:!0})}),(0,L.jsxs)(`p`,{children:[`Criteria: `,e.criteria]})]},e.id))]}),(0,L.jsx)(hm,{}),(0,L.jsxs)(W,{mt:10,children:[(0,L.jsx)(sd,{size:`lg`,htmlFor:`bot`,children:`Connect to bot`}),(0,L.jsxs)(V,{children:[(0,L.jsx)(jL,{name:`bot`,resourceType:`Bot`,onChange:e=>i(e)}),(0,L.jsx)(U,{onClick:u,children:`Connect`})]}),(0,L.jsx)(V,{children:(0,L.jsx)(Ig,{name:`subscription-trigger-event`,defaultValue:`Create Only`,label:`Subscription Trigger Event`,data:F$,onChange:e=>o(P$[e.target.value])})})]}),(0,L.jsx)(`div`,{style:{display:`none`},children:s})]})}function L$(e,t){if(!t)return!1;let n=e.criteria||``,r=e.channel?.endpoint||``;return n.startsWith(`QuestionnaireResponse?`)&&r.startsWith(`Bot/`)&&(n.includes(OC(t))||(t.url?n.includes(t.url):!1))}function R$(){let{id:e}=zK(),t=FK(),n=Z().readReference({reference:`Questionnaire/${e}`}).read(),[r,i]=(0,b.useState)({resourceType:`QuestionnaireResponse`,filters:[{code:`questionnaire`,operator:X.EQUALS,value:n.url?`${n.url},Questionnaire/${e}`:`Questionnaire/${e}`}],fields:[`id`,`_lastUpdated`]});return(0,L.jsx)(LF,{children:(0,L.jsx)(zB,{search:r,onClick:e=>t(`/${e.resource.resourceType}/${e.resource.id}`)?.catch(console.error),onChange:e=>i(e.definition),hideFilters:!0,hideToolbar:!0})})}function z$(){let e=Z(),{resourceType:t,id:n}=zK(),r=eA({reference:t+`/`+n}),i=(0,b.useCallback)(t=>{e.updateResource(d$(t)).then(()=>{q({color:`green`,message:`Success`})}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})})},[e]);return r?(0,L.jsx)(LF,{children:(0,L.jsx)(LH,{onSubmit:i,definition:r})}):null}function B$(){let{resourceType:e,id:t}=zK(),n=eA({reference:e+`/`+t});return n?(0,L.jsx)(LF,{children:e===`MeasureReport`?(0,L.jsx)(uV,{measureReport:n}):(0,L.jsx)(pR,{value:n})}):null}var V$={container:`_container_1ue98_1`,entry:`_entry_1ue98_14`,active:`_active_1ue98_21`};function H$(e){let t=Z(),n=eA(e.value),[r,i]=(0,b.useState)();return(0,b.useEffect)(()=>{if(!n)return;let e=wJ(n);if(!e)return;let r=`reference`in e?e.reference:OC(e);t.search(`ServiceRequest`,`subject=`+r).then(e=>{let t=(e.entry??[]).map(e=>e.resource);NR(t),t.reverse(),i(t)}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[t,n]),r?(0,L.jsx)(`div`,{"data-testid":`quick-service-requests`,className:V$.container,children:r.map(e=>(0,L.jsxs)(`div`,{className:Ln(V$.entry,{[V$.active]:e.id===n?.id}),children:[(0,L.jsx)(`p`,{children:(0,L.jsx)(eN,{to:e,children:U$(e)})}),e.category?.[0]?.text&&(0,L.jsx)(`p`,{children:e.category[0]?.text}),e.code?.coding?.[0]?.code&&(0,L.jsx)(`p`,{children:e.code.coding[0]?.code}),(0,L.jsx)(`p`,{children:W$(e)})]},e.id))}):null}function U$(e){if(e.identifier){for(let t of e.identifier)if(t.value)return t.value}return e.id||``}function W$(e){return e.authoredOn?e.authoredOn.substring(0,10):e.meta?.lastUpdated?e.meta.lastUpdated.substring(0,10):``}var G$={container:`_container_1l2dh_1`};function K$(e){let t=eA(e.valueSet);if(!t)return null;let n=[``],r=t.compose?.include?.[0]?.concept?.map(e=>e.code);return r&&n.push(...r),e.defaultValue&&!n.includes(e.defaultValue)&&n.push(e.defaultValue),(0,L.jsx)(`div`,{className:G$.container,children:(0,L.jsx)(Ig,{defaultValue:e.defaultValue,onChange:t=>e.onChange(t.currentTarget.value),data:n})})}function q$(e){let t=eA(e.specimen);return t?(0,L.jsxs)(ZB,{children:[(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(ZB.Key,{children:`Type`}),(0,L.jsx)(ZB.Value,{children:`Specimen`})]}),(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(ZB.Key,{children:`Collected`}),(0,L.jsx)(ZB.Value,{children:Pw(t.collection?.collectedDateTime)})]}),(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(ZB.Key,{children:`Specimen Age`}),(0,L.jsx)(ZB.Value,{children:J$(t)})]}),t.collection?.collectedDateTime&&t.receivedTime?(0,L.jsxs)(ZB.Entry,{children:[(0,L.jsx)(ZB.Key,{children:`Specimen Stability`}),(0,L.jsx)(ZB.Value,{children:Y$(t)})]}):(0,L.jsx)(L.Fragment,{})]}):null}function J$(e){let t=e.collection?.collectedDateTime;if(t)return X$(Z$(new Date(t),new Date))}function Y$(e){if(e.collection?.collectedDateTime&&e.receivedTime)return X$(Z$(new Date(e.collection.collectedDateTime),new Date(e.receivedTime)))}function X$(e){return e.toString().padStart(3,`0`)+`D`}function Z$(e,t){let n=t.getTime()-e.getTime();return Math.floor(n/864e5)}function Q$(e){let 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`),e===`User`&&t.push(`Email`),e===`Communication`&&t.push(`Payload`),t.push(`Details`,`Edit`,`Event`,`History`,`Blame`,`JSON`,`Apps`,`Profiles`),e===`Patient`&&t.push(`Accounts`,`Export`),t}function $$(){let e=Z(),{resourceType:t,id:n}=zK(),r={reference:t+`/`+n},[i,a]=(0,b.useState)(),o=eA(r,a),s=Q$(t);async function c(){let r=(await e.readHistory(t,n)).entry?.find(e=>!!e.resource)?.resource;r?l(r):q({color:`red`,message:`No history to restore`,autoClose:!1})}function l(t){e.updateResource(d$(t)).then(()=>{a(void 0),q({color:`green`,message:`Success`})}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})})}if(i)return gS(i)?(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Deleted`}),(0,L.jsx)(`p`,{children:`The resource was deleted.`}),(0,L.jsx)(U,{color:`red`,onClick:c,children:`Restore`})]}):(0,L.jsx)(oI,{outcome:i});function u(e){let t=o,n=t.orderDetail||[];n.length===0&&n.push({}),n[0].text!==e&&(n[0].text=e,l({...t,orderDetail:n}))}let d=o&&wJ(o),f=o&&TJ(o),p=e.getUserConfiguration()?.option?.find(e=>e.id===`statusValueSet`)?.valueString;return(0,L.jsxs)(L.Fragment,{children:[o?.resourceType===`ServiceRequest`&&p&&(0,L.jsx)(K$,{valueSet:{reference:p},defaultValue:o.orderDetail?.[0]?.text,onChange:u},OC(o)+`-`+o.orderDetail?.[0]?.text),o&&(0,L.jsx)(H$,{value:o}),(0,L.jsxs)(Cl,{children:[!o&&(0,L.jsx)($B,{withAvatar:t===`Patient`}),d&&(0,L.jsx)(SV,{patient:d}),f&&(0,L.jsx)(q$,{specimen:f}),o&&t!==`Patient`&&(0,L.jsx)(SQ,{resource:r}),(0,L.jsx)(ml,{children:(0,L.jsx)(tV,{baseUrl:`/${t}/${n}`,tabs:s})})]}),(0,L.jsx)(hq,{})]})}function e1(){let e=FK(),{resourceType:t,id:n,versionId:r,tab:i}=zK(),a=Z(),[o,s]=(0,b.useState)(!0),[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)();if((0,b.useEffect)(()=>{d(void 0),s(!0),a.readHistory(t,n).then(e=>l(e)).then(()=>s(!1)).catch(e=>{d(e),s(!1)})},[a,t,n]),o)return(0,L.jsx)(GM,{});let f=c?.entry??[],p=f.findIndex(e=>e.resource?.meta?.versionId===r);if(p===-1)return(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Version not found`}),(0,L.jsx)(eN,{to:`/${t}/${n}`,children:`Return to resource`})]});let m=f[p].resource,h=p<f.length-1?f[p+1].resource:void 0,g=`diff`,_=i||g,v=f.length-p;return(0,L.jsx)(lm,{maw:1200,children:(0,L.jsx)(IF,{children:(0,L.jsxs)(W,{gap:`lg`,children:[u&&(0,L.jsx)(`pre`,{"data-testid":`error`,children:JSON.stringify(u,void 0,2)}),(0,L.jsxs)(Ay,{cols:2,mb:`lg`,children:[(0,L.jsx)(pv,{total:f.length,value:v,getControlProps:NB,onChange:r=>e(`/${t}/${n}/_history/${f[f.length-r]?.resource?.meta?.versionId}/${_}`)?.catch(console.error)}),(0,L.jsx)(V,{justify:`right`,children:(0,L.jsx)(by,{data:[{value:`diff`,label:`Diff`},{value:`raw`,label:`Raw`}],value:_,onChange:i=>e(`/${t}/${n}/_history/${r}/${i||g}`)?.catch(console.error)})})]}),(0,L.jsx)(z,{mb:`lg`,children:(0,L.jsxs)(DF,{compact:!0,children:[(0,L.jsx)(OF,{term:`Version ID`,children:m.meta?.versionId}),(0,L.jsx)(OF,{term:`Author`,children:(0,L.jsx)(dR,{value:m.meta?.author,link:!0},m.meta?.author?.reference)}),(0,L.jsx)(OF,{term:`Date/Time`,children:Pw(m.meta?.lastUpdated)})]})}),_===`diff`&&(0,L.jsx)(aU,{original:h??{},revised:m}),_===`raw`&&(0,L.jsx)(`pre`,{style:{fontSize:`9pt`},children:JSON.stringify(m,void 0,2)})]})})})}function t1(){let{resourceType:e,id:t}=zK(),n=FK(),[r,i]=(0,b.useState)({resourceType:`Subscription`,filters:[{code:`url`,operator:X.EQUALS,value:`${e}/${t}`}],fields:[`id`,`criteria`,`status`,`_lastUpdated`]});return(0,L.jsx)(LF,{children:(0,L.jsx)(zB,{search:r,onClick:e=>n(`/${e.resource.resourceType}/${e.resource.id}`)?.catch(console.error),onChange:e=>i(e.definition),hideFilters:!0})})}function n1(e){let t=Z(),{resource:n,opened:r,onClose:i}=e,[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)(`update`),[d,f]=(0,b.useState)(!1),p=(0,b.useCallback)(async()=>{if(n?.id)try{await t.post(t.fhirUrl(n.resourceType,n.id,`$resend`),{subscription:a&&s?OC(s):void 0,interaction:l,verbose:d}),q({color:`green`,message:`Done`}),i()}catch(e){q({color:`red`,message:J(e),autoClose:!1})}},[t,n,i,a,s,l,d]);return(0,L.jsx)(pg,{opened:r,onClose:i,title:`Resend Subscriptions`,children:(0,L.jsx)(NP,{onSubmit:p,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(pp,{label:`Choose subscription (all subscriptions by default)`,onChange:e=>o(e.currentTarget.checked)}),a&&(0,L.jsx)(jL,{name:`subscription`,resourceType:`Subscription`,placeholder:`Subscription`,onChange:c}),(0,L.jsx)(Ig,{label:`Interaction`,description:`The interaction type to resend (update by default)`,defaultValue:`update`,data:[{label:`Update`,value:`update`},{label:`Create`,value:`create`},{label:`Delete`,value:`delete`}],onChange:e=>u(e.currentTarget.value)}),(0,L.jsx)(pp,{label:`Verbose mode`,onChange:e=>f(e.currentTarget.checked)}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(U,{type:`submit`,children:`Resend`})})]})})})}function r1(){let e=Z(),t=Uk(),{resourceType:n,id:r}=zK(),i={reference:n+`/`+r},[a,o]=(0,b.useState)(),s=wn(!1);function c(t,n){return e.updateResource({...t,priority:n})}function l(e,t){c(e,`stat`).then(t).catch(console.error)}function u(e,t){c(e,`routine`).then(t).catch(console.error)}function d(e){t(`/${e.resourceType}/${e.id}`)}function f(e){t(`/${e.resourceType}/${e.id}/edit`)}function p(e){t(`/${e.resourceType}/${e.id}/delete`)}function m(e){o(e),s[1].open()}function h(e){t(`/${e.resourceType}/${e.id}/_history/${e.meta?.versionId}`)}function g(t,n){let r=`aws-textract`;q({id:r,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(()=>{n(),Jb({id:r,title:`AWS Textract Successful`,message:`Text successfully extracted.`,color:`green`,icon:(0,L.jsx)(jj,{size:`1rem`}),loading:!1,withCloseButton:!0})}).catch(e=>Jb({id:r,title:`AWS Textract Error`,color:`red`,message:J(e),icon:(0,L.jsx)(HM,{size:`1rem`}),loading:!1,withCloseButton:!0}))}function _(t){let{primaryResource:n,currentResource:r,reloadTimeline:i}=t,a=r.resourceType===n.resourceType&&r.id===n.id,o=r.resourceType===`Communication`&&r.priority!==`stat`,s=r.resourceType===`Communication`&&r.priority===`stat`,c=a,_=!a,v=!a,y=!a,b=e.getProjectMembership()?.admin,x=b,S=WQ()&&(r.resourceType===`DocumentReference`||r.resourceType===`Media`);return(0,L.jsxs)(Xh.Dropdown,{children:[(0,L.jsx)(Xh.Label,{children:`Resource`}),o&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(_M,{size:14}),onClick:()=>l(r,i),"aria-label":`Pin ${OC(r)}`,children:`Pin`}),s&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(vM,{size:14}),onClick:()=>u(r,i),"aria-label":`Unpin ${OC(r)}`,children:`Unpin`}),_&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(iM,{size:14}),onClick:()=>d(r),"aria-label":`Details ${OC(r)}`,children:`Details`}),c&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(iM,{size:14}),onClick:()=>h(r),"aria-label":`Details ${OC(r)}`,children:`Details`}),v&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(Gj,{size:14}),onClick:()=>f(r),"aria-label":`Edit ${OC(r)}`,children:`Edit`}),b&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(Xh.Label,{children:`Admin`}),x&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(wM,{size:14}),onClick:()=>m(r),"aria-label":`Resend Subscriptions ${OC(r)}`,children:`Resend Subscriptions`})]}),S&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(Xh.Label,{children:`AWS AI`}),(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(LM,{size:14}),onClick:()=>g(r,i),"aria-label":`AWS Textract ${OC(r)}`,children:`AWS Textract`})]}),y&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(Xh.Label,{children:`Danger zone`}),(0,L.jsx)(Xh.Item,{color:`red`,leftSection:(0,L.jsx)(RM,{size:14}),onClick:()=>p(r),"aria-label":`Delete ${OC(r)}`,children:`Delete`})]})]})}return(0,L.jsxs)(L.Fragment,{children:[n===`Encounter`&&(0,L.jsx)(lz,{encounter:i,getMenu:_}),n===`Patient`&&(0,L.jsx)(CV,{patient:i,getMenu:_}),n===`ServiceRequest`&&(0,L.jsx)(vJ,{serviceRequest:i,getMenu:_}),n!==`Encounter`&&n!==`Patient`&&n!==`ServiceRequest`&&(0,L.jsx)(cz,{resource:i,getMenu:_}),(0,L.jsx)(n1,{resource:a,opened:s[0],onClose:s[1].close},`resend-subscriptions-${a?.id}`)]})}var i1=5,a1=`The Medplum Agent is frequently patched with new features and bugfixes. Downgrading your agent can result in picking up old bugs or losing features you may be relying on. Are you sure you want to downgrade?`;function o1(e){let{opened:t,close:n,version:r,loadingStatus:i,handleStatus:a,handleUpgrade:o}=e,[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)(),[d,f]=(0,b.useState)(),[p,m]=(0,b.useState)(!1);if((0,b.useEffect)(()=>{t&&(s||zk(`app-tools-page`).then(c).catch(console.error),l||Bk(`app-tools-page`).then(u).catch(e=>{console.error(e),u([])}),a())},[t,s,l,a]),!r||i)return(0,L.jsx)(GM,{});if(r===`unknown`)return(0,L.jsx)(`p`,{children:`Unable to determine the current version of the agent. Check the network connectivity of the agent.`});if(!(s&&l))return(0,L.jsx)(GM,{});let h=d??s,g=l.filter(e=>Rk(e,r)>0),_=l.filter(e=>Rk(e,r)<0),v=g.slice(0,i1),y=_.slice(0,i1),x=v.includes(s)?[...v,...y]:[s,...v,...y],S=Rk(h,r)<0,C=Rk(h,r)===0;function w(e){return{value:e,label:e===s?`${e} (Latest)`:e,resource:e}}let T=l;async function E(e){if(!e)return x;let t=e.toLowerCase();return T.filter(e=>e.toLowerCase().includes(t))}function D(){(!S||window.confirm(a1))&&(o(p,h),n())}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(SN,{label:`Target Version`,placeholder:`Search versions...`,defaultValue:h,toOption:w,loadOptions:E,onChange:([e])=>{e&&f(e)},maxValues:1,clearable:!1}),C?(0,L.jsxs)(`p`,{children:[`This agent is already on version `,h,`.`]}):(0,L.jsxs)(`p`,{children:[`Are you sure you want to `,S?`downgrade`:`upgrade`,` this agent from version `,r,` to version`,` `,h,`?`]}),(0,L.jsxs)(V,{children:[(0,L.jsx)(U,{onClick:D,"aria-label":`Confirm upgrade`,children:`Confirm Upgrade`}),(0,L.jsx)(pp,{label:`Force`,onChange:e=>m(e.currentTarget.checked)})]})]})}var s1=[`live`,`ping`,`hl7ConnectionsOpen`,`hl7ClientCount`,`hl7QueueDepth`,`webSocketQueueDepth`,`outstandingHeartbeats`];function c1(e){return e==null?``:typeof e==`object`?JSON.stringify(e):typeof e==`number`?e.toLocaleString():e.toString()}function l1(e){let t=Object.keys(e.entries).filter(t=>e.entries[t]?.rtt);return t.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{order:3,mt:`md`,children:e.title}),(0,L.jsxs)(G,{children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Name`}),(0,L.jsx)(G.Th,{children:`Count`}),(0,L.jsx)(G.Th,{children:`Pending`}),(0,L.jsx)(G.Th,{children:`Min (ms)`}),(0,L.jsx)(G.Th,{children:`Avg (ms)`}),(0,L.jsx)(G.Th,{children:`Max (ms)`}),(0,L.jsx)(G.Th,{children:`p50 (ms)`}),(0,L.jsx)(G.Th,{children:`p95 (ms)`}),(0,L.jsx)(G.Th,{children:`p99 (ms)`})]})}),(0,L.jsx)(G.Tbody,{children:t.map(t=>{let n=e.entries[t].rtt;return(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:t}),(0,L.jsx)(G.Td,{children:n.count}),(0,L.jsx)(G.Td,{children:n.pendingCount}),(0,L.jsx)(G.Td,{children:n.min}),(0,L.jsx)(G.Td,{children:n.average}),(0,L.jsx)(G.Td,{children:n.max}),(0,L.jsx)(G.Td,{children:n.p50}),(0,L.jsx)(G.Td,{children:n.p95}),(0,L.jsx)(G.Td,{children:n.p99})]},t)})})]})]}):null}function u1(e){let{stats:t}=e,n=new Set([...s1,`channelStats`,`clientStats`]),r=Object.entries(t).filter(([e])=>!n.has(e));return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(G,{mt:`sm`,children:(0,L.jsxs)(G.Tbody,{children:[s1.map(e=>(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:e}),(0,L.jsx)(G.Td,{children:c1(t[e])})]},e)),r.map(([e,t])=>(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:e}),(0,L.jsx)(G.Td,{children:c1(t)})]},e))]})}),(0,L.jsx)(l1,{title:`Channel Stats`,entries:t.channelStats}),(0,L.jsx)(l1,{title:`Client Stats`,entries:t.clientStats})]})}function d1(){let e=Z(),{id:t}=zK(),n=(0,b.useMemo)(()=>({reference:`Agent/`+t}),[t]),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(),[h,g]=(0,b.useState)(),[_,v]=(0,b.useState)(),[y,x]=(0,b.useState)(),[S,C]=(0,b.useState)(!1),[w,T]=(0,b.useState)(),[E,D]=(0,b.useState)(!1),[O,k]=(0,b.useState)(),[A,j]=(0,b.useState)(20),[M,N]=(0,b.useState)(),[ee,{open:P,close:te}]=wn(!1),ne=r||a||s||S||l||d,re=(0,b.useCallback)(()=>{i(!0),e.get(e.fhirUrl(`Agent`,t,`$status`),{cache:`reload`}).then(e=>{m(e.parameter?.find(e=>e.name===`status`)?.valueCode),v(e.parameter?.find(e=>e.name===`lastUpdated`)?.valueInstant);let t=e.parameter?.find(e=>e.name===`version`)?.valueString;t===void 0||t===`unknown`||Ik(t)?g(t):p1(`Invalid version received from $status operation`)}).catch(e=>p1(J(e))).finally(()=>i(!1))},[e,t]),ie=(0,b.useCallback)(t=>{let r=t.host,i=t.pingCount||1;r&&(C(!0),e.pushToAgent(n,r,`PING ${i}`,wD.PING,!0).then(e=>x(e)).catch(e=>p1(J(e))).finally(()=>C(!1)))},[e,n]),ae=(0,b.useCallback)(()=>{o(!0),e.get(e.fhirUrl(`Agent`,t,`$reload-config`),{cache:`reload`}).then(e=>{f1(`Agent config reloaded successfully.`)}).catch(e=>p1(J(e))).finally(()=>o(!1))},[e,t]),oe=(0,b.useCallback)((n,r)=>{c(!0);let i=e.fhirUrl(`Agent`,t,`$upgrade`);i.searchParams.set(`force`,String(n)),i.searchParams.set(`version`,r),e.get(i,{cache:`reload`}).then(e=>{f1(`Agent upgraded successfully.`)}).catch(e=>p1(J(e))).finally(()=>c(!1))},[e,t]),se=(0,b.useCallback)((n,r)=>{u(!0);let i=e.fhirUrl(`Agent`,t,`$fetch-logs`);i.searchParams.set(`limit`,String(n)),r&&i.searchParams.set(`before`,r),e.get(i,{cache:`reload`}).then(e=>{let t=e?.parameter?.find(e=>e.name===`logs`)?.valueString,n=e?.parameter?.find(e=>e.name===`hasMore`)?.valueBoolean??!1,i=e?.parameter?.find(e=>e.name===`nextBefore`)?.valueString;T(e=>r&&e?t?`${e}\n${t}`:e:t),D(n),k(i)}).catch(e=>p1(J(e))).finally(()=>u(!1))},[e,t]),ce=(0,b.useCallback)(e=>{let t=Number(e.logLimit)||20;j(t),se(t)},[se]),le=(0,b.useCallback)(()=>{se(A,O)},[se,A,O]),ue=(0,b.useCallback)(()=>{f(!0),e.get(e.fhirUrl(`Agent`,t,`$stats`),{cache:`reload`}).then(e=>{let t=e.parameter?.find(e=>e.name===`stats`)?.valueString;if(t)try{N(JSON.parse(t))}catch(e){p1(J(e))}}).catch(e=>p1(J(e))).finally(()=>f(!1))},[e,t]);return(0,L.jsxs)(LF,{children:[(0,L.jsx)(pg,{opened:ee,onClose:te,title:`Upgrade Agent`,centered:!0,children:(0,L.jsx)(o1,{opened:ee,close:te,version:h,loadingStatus:r,handleStatus:re,handleUpgrade:oe})}),(0,L.jsx)(K,{order:1,children:`Agent Tools`}),(0,L.jsxs)(`div`,{style:{marginBottom:10},children:[`Agent: `,(0,L.jsx)(uR,{value:n,link:!0})]}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Agent Status`}),(0,L.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.`}),(0,L.jsx)(U,{onClick:re,loading:r,disabled:ne&&!r,children:`Get Status`}),!r&&p&&(0,L.jsx)(G,{children:(0,L.jsxs)(G.Tbody,{children:[(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:`Status`}),(0,L.jsx)(G.Td,{children:(0,L.jsx)(sR,{status:p})})]}),(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:`Version`}),(0,L.jsx)(G.Td,{children:h})]}),(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:`Last Updated`}),(0,L.jsx)(G.Td,{children:Pw(_,void 0,{timeZoneName:`longOffset`})})]})]})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Reload Config`}),(0,L.jsx)(`p`,{children:`Reload the configuration of this agent, syncing it with the current version of the Agent resource on the Medplum server.`}),(0,L.jsx)(U,{onClick:ae,loading:a,disabled:ne&&!a,"aria-label":`Reload config`,children:`Reload Config`}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Upgrade Agent`}),(0,L.jsx)(`p`,{children:`Upgrade the version of this agent, to either the latest (default) or a specified version.`}),(0,L.jsx)(U,{onClick:P,loading:s,disabled:ne&&!s,"aria-label":`Upgrade agent`,children:`Upgrade`}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsxs)(NP,{onSubmit:ce,children:[(0,L.jsx)(K,{order:2,children:`Fetch Logs`}),(0,L.jsx)(`p`,{children:`Fetch logs from the agent.`}),w?.length?(0,L.jsx)(om,{block:!0,mb:15,children:w}):null,(0,L.jsxs)(V,{children:[(0,L.jsx)(W_,{w:100,id:`logLimit`,name:`logLimit`,placeholder:`20`,label:`Log Limit`}),(0,L.jsx)(U,{mt:22,loading:l,disabled:ne&&!l,"aria-label":`Fetch logs`,type:`submit`,children:`Fetch Logs`}),E?(0,L.jsx)(U,{mt:22,type:`button`,variant:`default`,onClick:le,loading:l,disabled:ne&&!l,"aria-label":`Load more logs`,children:`Load More`}):null]})]}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Agent Stats`}),(0,L.jsx)(`p`,{children:`Fetch runtime statistics from the agent, including connection counts, queue depths, RTT metrics, and overall agent health.`}),(0,L.jsx)(U,{onClick:ue,loading:d,disabled:ne&&!d,"aria-label":`Get stats`,children:`Get Stats`}),!d&&M&&(0,L.jsx)(u1,{stats:M}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Ping from Agent`}),(0,L.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.`}),(0,L.jsx)(NP,{onSubmit:ie,children:(0,L.jsxs)(V,{children:[(0,L.jsx)(jb,{id:`host`,name:`host`,placeholder:`ex. 127.0.0.1`,label:`IP Address / Hostname`,rightSection:(0,L.jsx)(bu,{size:24,radius:`xl`,variant:`filled`,type:`submit`,"aria-label":`Ping`,loading:S,disabled:ne&&!S,children:(0,L.jsx)(EM,{style:{width:`1rem`,height:`1rem`},stroke:1.5})})}),(0,L.jsx)(W_,{id:`pingCount`,name:`pingCount`,placeholder:`1`,label:`Ping Count`})]})}),!S&&y&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{order:5,mt:`sm`,mb:0,children:`Last Ping`}),(0,L.jsx)(`pre`,{children:y})]})]})}function f1(e){q({color:`green`,title:`Success`,icon:(0,L.jsx)(jj,{size:`1rem`}),message:e})}function p1(e){q({color:`red`,title:`Error`,message:e,autoClose:!1})}function m1(){let e=Z(),{id:t}=zK(),n=eA({reference:`User/${t}`}),[r,i]=(0,b.useState)(``),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!1);if(!n)return null;if(!n.project)return(0,L.jsx)(LF,{children:(0,L.jsx)(jd,{color:`yellow`,children:`Update Email is only available for project-scoped Users.`})});function d(){if(!r)return;u(!0);let n={resourceType:`Parameters`,parameter:[{name:`email`,valueString:r}]};a&&n.parameter?.push({name:`updateProfileTelecom`,valueBoolean:!0}),s&&n.parameter?.push({name:`skipEmailVerification`,valueBoolean:!0}),e.post(e.fhirUrl(`User`,t,`$update-email`),n).then(()=>{q({color:`green`,message:`Email updated successfully`}),i(``)}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})}).finally(()=>u(!1))}return(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{order:1,children:`Update Email`}),(0,L.jsxs)(`p`,{children:[`Update the email address for this User. The current email is `,(0,L.jsx)(`strong`,{children:n.email}),`.`]}),(0,L.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),d()},children:(0,L.jsxs)(W,{children:[(0,L.jsx)(jb,{label:`New Email`,type:`email`,required:!0,placeholder:`new@example.com`,value:r,onChange:e=>i(e.currentTarget.value)}),(0,L.jsx)(pp,{label:`Update profile telecom`,description:`Add the new email to the associated profile resource's telecom and mark the old email as old`,checked:a,onChange:e=>o(e.currentTarget.checked)}),(0,L.jsx)(pp,{label:`Skip email verification`,description:`Do not send a verification email to the new address`,checked:s,onChange:e=>c(e.currentTarget.checked)}),(0,L.jsx)(`div`,{children:(0,L.jsx)(U,{type:`submit`,loading:l,disabled:!r,children:`Update Email`})})]})})]})}function h1(){let e=FK(),t=Z(),[n,r]=(0,b.useState)();(0,b.useEffect)(()=>{t.get(`auth/me`,{cache:`no-cache`}).then(r).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[t]);function i(e){t.post(`auth/revoke`,{loginId:e}).then(()=>t.get(`auth/me`,{cache:`no-cache`})).then(r).then(()=>q({color:`green`,message:`Login revoked`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}return n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Security`}),(0,L.jsxs)(DF,{children:[(0,L.jsx)(OF,{term:`ID`,children:(0,L.jsx)(Rd,{href:`/${OC(n.profile)}`,children:n.profile.id})}),(0,L.jsx)(OF,{term:`Resource Type`,children:n.profile.resourceType}),(0,L.jsx)(OF,{term:`Name`,children:jw(n.profile.name?.[0])})]})]}),(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Sessions`}),(0,L.jsxs)(G,{children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Project`}),(0,L.jsx)(`th`,{children:`OS`}),(0,L.jsx)(`th`,{children:`Browser`}),(0,L.jsx)(`th`,{children:`IP Address`}),(0,L.jsx)(`th`,{children:`Auth Method`}),(0,L.jsx)(`th`,{children:`Last Updated`}),(0,L.jsx)(`th`,{})]})}),(0,L.jsx)(`tbody`,{children:n.security.sessions.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:e.project?.display??`Unknown`}),(0,L.jsx)(`td`,{children:e.os}),(0,L.jsx)(`td`,{children:e.browser}),(0,L.jsx)(`td`,{children:e.remoteAddress}),(0,L.jsx)(`td`,{children:e.authMethod}),(0,L.jsx)(`td`,{children:Pw(e.lastUpdated)}),(0,L.jsx)(`td`,{children:(0,L.jsx)(Rd,{href:`#`,onClick:()=>i(e.id),children:`Revoke`})})]},e.id))})]})]}),(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Password`}),(0,L.jsx)(U,{onClick:()=>e(`/changepassword`)?.catch(console.error),children:`Change password`})]}),(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Multi Factor Auth`}),(0,L.jsxs)(`p`,{children:[`Enrolled: `,n.security.mfaEnrolled.toString()]}),(0,L.jsx)(U,{onClick:()=>e(`/mfa`)?.catch(console.error),children:n.security.mfaEnrolled?`Manage MFA`:`Enroll`})]})]}):null}function g1(){let{id:e,secret:t}=zK(),n=FK();return(0,L.jsx)(gI,{id:e,secret:t,onSignIn:()=>n(`/signin`)?.catch(console.error)})}function _1(){let e=Wk(),t=FK(),[n]=dJ(),r=HQ(),i=(0,b.useCallback)(()=>{let e=n.get(`next`);t(e?.startsWith(`/`)?e:`/`)?.catch(console.error)},[n,t]);return(0,b.useEffect)(()=>{e&&n.has(`next`)&&i()},[e,n,i]),(0,L.jsxs)(wI,{onSuccess:()=>i(),onForgotPassword:()=>t(`/resetpassword`)?.catch(console.error),onRegister:UQ()?()=>t(`/register`)?.catch(console.error):void 0,googleClientId:r.googleClientId,login:n.get(`login`)||void 0,projectId:n.get(`project`)||void 0,children:[(0,L.jsx)(RF,{size:32}),n.get(`project`)!==`new`&&(0,L.jsxs)(K,{order:3,py:`lg`,ta:`center`,children:[`Sign in to `,dN()]}),n.get(`project`)===`new`&&(0,L.jsx)(K,{order:3,py:`lg`,ta:`center`,children:`Sign in again to create a new project`})]})}function v1(){let e=FK(),t=NK(),[n,r]=(0,b.useState)(),[i,a]=(0,b.useState)(),[o,s]=(0,b.useState)();return(0,b.useEffect)(()=>{let e=Object.fromEntries(new URLSearchParams(t.search).entries());r(e.resourceType),a(e.query),s(JSON.parse(e.fields))},[t]),!n||!i||!o?null:(0,L.jsx)(YB,{resourceType:n,checkboxesEnabled:!0,query:i,fields:o,onClick:t=>e(`/${n}/${t.resource.id}`)?.catch(console.error),onAuxClick:e=>window.open(`/${n}/${e.resource.id}`,`_blank`),onBulk:t=>{e(`/bulk/${n}?ids=${t.join(`,`)}`)?.catch(console.error)}})}function y1(){let{id:e,secret:t}=zK(),n=Z(),[r,i]=(0,b.useState)(),[a,o]=(0,b.useState)(!1),s=VF(r,void 0);return(0,L.jsxs)(LF,{width:450,children:[(0,L.jsx)(oI,{issues:s}),(0,L.jsxs)(NP,{onSubmit:async()=>{i(void 0);try{let r=fS(await n.post(`auth/verifyemail`,{id:e,secret:t}));r?uD.assign(r):o(!0)}catch(e){i(yS(e))}},children:[(0,L.jsxs)(xd,{direction:`column`,align:`center`,justify:`center`,children:[(0,L.jsx)(RF,{size:32}),(0,L.jsx)(K,{children:`Email address verification required`})]}),!a&&(0,L.jsxs)(W,{children:[(0,L.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.`}),(0,L.jsx)(V,{justify:`center`,mt:`xl`,children:(0,L.jsx)(PP,{children:`Verify email`})})]}),a&&(0,L.jsxs)(`div`,{"data-testid":`success`,children:[`Email verified. You can now\xA0`,(0,L.jsx)(eN,{to:`/signin`,children:`sign in`}),`.`]})]})]})}function b1(){return(0,L.jsx)(_q,{children:(0,L.jsxs)($,{errorElement:(0,L.jsx)(xQ,{}),children:[(0,L.jsx)($,{path:`/signin`,element:(0,L.jsx)(_1,{})}),(0,L.jsx)($,{path:`/oauth`,element:(0,L.jsx)(KQ,{})}),(0,L.jsx)($,{path:`/resetpassword`,element:(0,L.jsx)(JQ,{})}),(0,L.jsx)($,{path:`/setpassword/:id/:secret`,element:(0,L.jsx)(g1,{})}),(0,L.jsx)($,{path:`/verifyemail/:id/:secret`,element:(0,L.jsx)(y1,{})}),(0,L.jsx)($,{path:`/register`,element:(0,L.jsx)(qQ,{})}),(0,L.jsx)($,{path:`/changepassword`,element:(0,L.jsx)(vQ,{})}),(0,L.jsx)($,{path:`/security`,element:(0,L.jsx)(h1,{})}),(0,L.jsx)($,{path:`/mfa`,element:(0,L.jsx)(BQ,{})}),(0,L.jsx)($,{path:`/batch`,element:(0,L.jsx)(gQ,{})}),(0,L.jsx)($,{path:`/bulk/:resourceType`,element:(0,L.jsx)(_Q,{})}),(0,L.jsx)($,{path:`/smart`,element:(0,L.jsx)(v1,{})}),(0,L.jsx)($,{path:`/forms/:id`,element:(0,L.jsx)(CQ,{})}),(0,L.jsx)($,{path:`/admin/super`,element:(0,L.jsx)(mX,{})}),(0,L.jsx)($,{path:`/admin/super/asyncjob/:tab`,element:(0,L.jsx)(eX,{})}),(0,L.jsx)($,{path:`/admin/super/asyncjob`,element:(0,L.jsx)(eX,{})}),(0,L.jsx)($,{path:`/admin/super/db/:tab`,element:(0,L.jsx)(xY,{})}),(0,L.jsx)($,{path:`/admin/super/db`,element:(0,L.jsx)(xY,{})}),(0,L.jsx)($,{path:`/admin/config`,element:(0,L.jsx)(MY,{})}),(0,L.jsxs)($,{path:`/admin`,element:(0,L.jsx)(FY,{}),children:[(0,L.jsx)($,{path:`bots/:membershipId`,element:(0,L.jsx)(OY,{})}),(0,L.jsx)($,{path:`bots/new`,element:(0,L.jsx)(LJ,{})}),(0,L.jsx)($,{path:`bots`,element:(0,L.jsx)(PJ,{})}),(0,L.jsx)($,{path:`clients/:membershipId`,element:(0,L.jsx)(OY,{})}),(0,L.jsx)($,{path:`clients/new`,element:(0,L.jsx)(RJ,{})}),(0,L.jsx)($,{path:`clients`,element:(0,L.jsx)(FJ,{})}),(0,L.jsx)($,{path:`details`,element:(0,L.jsx)(NY,{})}),(0,L.jsx)($,{path:`invite`,element:(0,L.jsx)(SY,{})}),(0,L.jsx)($,{path:`patients`,element:(0,L.jsx)(mq,{to:`/admin/users`,replace:!0})}),(0,L.jsx)($,{path:`users/:membershipId`,element:(0,L.jsx)(OY,{})}),(0,L.jsx)($,{path:`users`,element:(0,L.jsx)(bX,{})}),(0,L.jsx)($,{path:`project`,element:(0,L.jsx)(NY,{})}),(0,L.jsx)($,{path:`secrets`,element:(0,L.jsx)(XY,{})}),(0,L.jsx)($,{path:`settings`,element:(0,L.jsx)(ZY,{})}),(0,L.jsx)($,{path:`sites`,element:(0,L.jsx)(QY,{})}),(0,L.jsx)($,{path:`rate-limits`,element:(0,L.jsx)(KY,{})})]}),(0,L.jsx)($,{path:`/lab/assays`,element:(0,L.jsx)(FQ,{})}),(0,L.jsx)($,{path:`/lab/panels`,element:(0,L.jsx)(RQ,{})}),(0,L.jsxs)($,{path:`/:resourceType/new`,element:(0,L.jsx)(bQ,{}),children:[(0,L.jsx)($,{index:!0,element:(0,L.jsx)(S$,{})}),(0,L.jsx)($,{path:`form`,element:(0,L.jsx)(S$,{})}),(0,L.jsx)($,{path:`json`,element:(0,L.jsx)(w$,{})}),(0,L.jsx)($,{path:`profiles`,element:(0,L.jsx)(S$,{})})]}),(0,L.jsxs)($,{path:`/:resourceType/:id`,element:(0,L.jsx)($$,{}),children:[(0,L.jsx)($,{index:!0,element:(0,L.jsx)(r1,{})}),(0,L.jsx)($,{path:`apply`,element:(0,L.jsx)(ZQ,{})}),(0,L.jsx)($,{path:`apps`,element:(0,L.jsx)(QQ,{})}),(0,L.jsx)($,{path:`event`,element:(0,L.jsx)(e$,{})}),(0,L.jsx)($,{path:`blame`,element:(0,L.jsx)(t$,{})}),(0,L.jsx)($,{path:`bots`,element:(0,L.jsx)(I$,{})}),(0,L.jsx)($,{path:`builder`,element:(0,L.jsx)(f$,{})}),(0,L.jsx)($,{path:`checklist`,element:(0,L.jsx)(p$,{})}),(0,L.jsx)($,{path:`delete`,element:(0,L.jsx)(h$,{})}),(0,L.jsx)($,{path:`details`,element:(0,L.jsx)(_$,{})}),(0,L.jsx)($,{path:`edit`,element:(0,L.jsx)(v$,{})}),(0,L.jsx)($,{path:`editor`,element:(0,L.jsx)(s$,{})}),(0,L.jsxs)($,{path:`history`,children:[(0,L.jsx)($,{index:!0,element:(0,L.jsx)(C$,{})}),(0,L.jsx)($,{path:`:versionId/:tab`,element:(0,L.jsx)(e1,{})}),(0,L.jsx)($,{path:`:versionId`,element:(0,L.jsx)(e1,{})})]}),(0,L.jsxs)($,{path:`_history`,children:[(0,L.jsx)($,{index:!0,element:(0,L.jsx)(C$,{})}),(0,L.jsx)($,{path:`:versionId/:tab`,element:(0,L.jsx)(e1,{})}),(0,L.jsx)($,{path:`:versionId`,element:(0,L.jsx)(e1,{})})]}),(0,L.jsx)($,{path:`json`,element:(0,L.jsx)(T$,{})}),(0,L.jsx)($,{path:`preview`,element:(0,L.jsx)(j$,{})}),(0,L.jsx)($,{path:`responses`,element:(0,L.jsx)(R$,{})}),(0,L.jsx)($,{path:`report`,element:(0,L.jsx)(B$,{})}),(0,L.jsx)($,{path:`ranges`,element:(0,L.jsx)(z$,{})}),(0,L.jsx)($,{path:`subscriptions`,element:(0,L.jsx)(t1,{})}),(0,L.jsx)($,{path:`timeline`,element:(0,L.jsx)(r1,{})}),(0,L.jsx)($,{path:`tools`,element:(0,L.jsx)(d1,{})}),(0,L.jsx)($,{path:`email`,element:(0,L.jsx)(m1,{})}),(0,L.jsx)($,{path:`payload`,element:(0,L.jsx)(m$,{})}),(0,L.jsx)($,{path:`profiles`,element:(0,L.jsx)(M$,{})}),(0,L.jsx)($,{path:`accounts`,element:(0,L.jsx)(YQ,{})}),(0,L.jsx)($,{path:`export`,element:(0,L.jsx)(y$,{})})]}),(0,L.jsx)($,{path:`/:resourceType`,element:(0,L.jsx)(PQ,{})}),(0,L.jsx)($,{path:`/`,element:(0,L.jsx)(PQ,{})})]})})}function x1(){let e=Z(),t=e.getUserConfiguration(),n=e.getProject(),r=NK(),[i]=dJ();return e.isLoading()?(0,L.jsx)(GM,{}):(0,L.jsxs)(yF,{logo:(0,L.jsx)(RF,{size:24}),pathname:r.pathname,searchParams:i,version:pO,menus:S1(t),displayAddBookmark:!!t?.id,announcements:n?.superAdmin?[{message:(0,L.jsxs)(L.Fragment,{children:[`Warning: logged in as`,` `,(0,L.jsx)(aJ,{to:`https://www.medplum.com/docs/self-hosting/super-admin-guide`,target:`_blank`,rel:`noopener noreferrer`,children:`Medplum Super Admin`}),`.`]}),color:`red`,icon:(0,L.jsx)(mj,{size:16}),role:`alert`}]:void 0,children:[(0,L.jsx)(_J,{}),(0,L.jsx)(b.Suspense,{fallback:(0,L.jsx)(GM,{}),children:(0,L.jsx)(b1,{})})]})}function S1(e){let t=e?.menu?.map(e=>({title:e.title,links:e.link?.map(e=>({label:e.name,href:e.target,icon:w1(e.target)}))||[]}))||[];return t.push({title:`Settings`,links:[{label:`Security`,href:`/security`,icon:(0,L.jsx)(oM,{})}]}),t}var C1={Patient:MM,Practitioner:eM,Organization:Dj,ServiceRequest:xM,DiagnosticReport:TM,Questionnaire:$j,Project:Qj,admin:Cj,AccessPolicy:aM,Subscription:VM,batch:mM,Observation:dM};function w1(e){if(e.includes(`admin/super/db`))return(0,L.jsx)(Vj,{});try{let t=new URL(e,`https://app.medplum.com`).pathname.split(`/`)[1];if(t in C1){let e=C1[t];return(0,L.jsx)(e,{})}}catch{}}async function T1(){let e=HQ(),t=new EO({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=mi({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=nJ([{path:`*`,element:(0,L.jsx)(x1,{})}]);(0,CJ.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(b.StrictMode,{children:(0,L.jsx)(Kk,{medplum:t,navigate:e=>r.navigate(e),children:(0,L.jsxs)(Kr,{theme:n,children:[(0,L.jsx)(Nx,{position:`bottom-right`}),(0,L.jsx)(uq,{router:r})]})})}))}T1().catch(console.error);export{o as t};
|
|
246
|
-
//# sourceMappingURL=index-
|
|
245
|
+
`)}}async function m$(e,t){if(t.sourceCode?.url){let n=t.sourceCode.url?.split(`/`)?.find(tw);return(await e.download(e.fhirUrl(`Binary`,n))).text()}return t.code??``}function h$(e){let t=e.meta;return t&&={...t,lastUpdated:void 0,versionId:void 0,author:void 0},{...e,meta:t}}function g$(){let e=Z(),{resourceType:t,id:n}=UK(),r={reference:t+`/`+n},i=(0,b.useCallback)(t=>{e.updateResource(h$(t)).then(()=>{q({color:`green`,message:`Success`})}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})})},[e]);switch(t){case`PlanDefinition`:return(0,L.jsx)(LF,{children:(0,L.jsx)(kV,{value:r,onSubmit:i})});case`Questionnaire`:return(0,L.jsx)(LF,{children:(0,L.jsx)(fH,{questionnaire:r,onSubmit:i})});default:return null}}function _$(){let{resourceType:e,id:t}=UK(),n=eA({reference:e+`/`+t}),r=zK();return n?(0,L.jsx)(LF,{children:(0,L.jsx)(YH,{value:n,onStart:(e,t)=>r(`/forms/${kC(t)}`)?.catch(console.error),onEdit:(e,t,n)=>r(`/${n.reference}}`)?.catch(console.error)})}):null}function v$(){let e=Z(),{resourceType:t,id:n}=UK(),r=eA({reference:t+`/`+n}),i=(0,b.useRef)(0),[a,o]=(0,b.useState)([]);(0,b.useEffect)(()=>{r&&o((r.payload??Dw).map(e=>({key:i.current++,item:e})))},[r]);let s=(0,b.useCallback)((e,t)=>{o(n=>n.map(n=>n.key===e?{...n,item:{...n.item,contentString:t}}:n))},[]),c=(0,b.useCallback)(()=>{o(e=>[...e,{key:i.current++,item:{contentString:``}}])},[]),l=(0,b.useCallback)(()=>{r&&e.updateResource(h$({...r,payload:a.map(e=>e.item)})).then(()=>q({color:`green`,message:`Saved`})).catch(e=>q({color:`red`,message:J(e)}))},[e,r,a]);return r?(0,L.jsx)(LF,{children:(0,L.jsxs)(W,{children:[a.filter(({item:e})=>`contentString`in e).map(({key:e,item:t})=>(0,L.jsx)(hh,{autosize:!0,minRows:3,maxRows:20,value:t.contentString??``,onChange:t=>s(e,t.currentTarget.value),placeholder:`Enter content...`},e)),(0,L.jsxs)(V,{justify:`flex-end`,children:[(0,L.jsx)(U,{variant:`outline`,onClick:c,children:`Add payload`}),(0,L.jsx)(U,{onClick:l,children:`Save`})]}),(0,L.jsx)(H,{size:`xs`,c:`dimmed`,children:`This tab manages string payloads only. Attachments and References can be managed in the Edit tab.`})]})}):null}function y$(){let e=Z(),{resourceType:t,id:n}=UK(),r=zK();return(0,L.jsxs)(LF,{children:[(0,L.jsxs)(`p`,{children:[`Are you sure you want to delete this `,t,`?`]}),(0,L.jsx)(U,{color:`red`,onClick:()=>{e.deleteResource(t,n).then(()=>r(`/${t}`)?.catch(console.error)).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},children:`Delete`})]})}var b$={selectProfileBtn:`_selectProfileBtn_tbaz6_1`,chevron:`_chevron_tbaz6_13`};function x$(){let{resourceType:e,id:t}=UK(),n=eA({reference:e+`/`+t}),[r,i]=(0,b.useState)(),a=Bf({onDropdownClose:()=>a.resetSelectedOption()}),o=(0,b.useMemo)(()=>{if(KC(n?.meta?.profile))return[(0,L.jsx)(Uf.Option,{value:``,children:`None`},``),...n.meta.profile.map(e=>(0,L.jsx)(Uf.Option,{value:e,children:e},e))]},[n?.meta?.profile]);if((0,b.useEffect)(()=>{n?.meta?.profile?.length===1&&i(n.meta.profile[0])},[n?.meta?.profile]),!n)return null;let s;return KC(o)&&(s=(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsxs)(W,{align:`flex-end`,gap:`xs`,children:[(0,L.jsxs)(Uf,{store:a,width:250,position:`bottom-end`,withinPortal:!1,onOptionSubmit:e=>{i(e),a.closeDropdown()},children:[(0,L.jsx)(Uf.Target,{children:(0,L.jsx)(vl,{onClick:()=>a.toggleDropdown(),children:(0,L.jsxs)(om,{fw:`bold`,fs:`sm`,className:b$.selectProfileBtn,children:[(0,L.jsx)(`span`,{children:`Pick profile`}),(0,L.jsx)(Nj,{stroke:1.5,className:b$.chevron})]})})}),(0,L.jsx)(Uf.Dropdown,{w:`max-content`,children:(0,L.jsx)(Uf.Options,{children:o})})]}),(0,L.jsx)(z,{children:r?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(H,{span:!0,size:`sm`,c:`dimmed`,children:`Displaying profile:\xA0`}),(0,L.jsx)(H,{span:!0,size:`sm`,children:r||`Nothing selected`})]}):(0,L.jsx)(H,{span:!0,size:`sm`,c:`dimmed`,children:`No profile displayed`})})]})})),(0,L.jsx)(LF,{children:(0,L.jsxs)(W,{gap:`xl`,children:[s,(0,L.jsx)(KR,{value:n,profileUrl:r})]})})}function S$(){let e=Z(),{resourceType:t,id:n}=UK(),[r,i]=(0,b.useState)(),[a,o]=(0,b.useState)(),s=zK(),[c,l]=(0,b.useState)();(0,b.useEffect)(()=>{e.readResource(t,n).then(e=>{i(ew(e)),o(ew(e))}).catch(e=>{l(yS(e)),q({color:`red`,message:J(e),autoClose:!1})})},[e,t,n]);let u=(0,b.useCallback)(r=>{l(void 0),e.updateResource(h$(r)).then(()=>{s(`/${t}/${n}/details`)?.catch(console.error),q({id:`succes`,color:`green`,message:`Success`})}).catch(e=>{l(yS(e)),q({color:`red`,message:J(e),autoClose:!1})})},[e,t,n,s]),d=(0,b.useCallback)(i=>{l(void 0);let a=mk(r,h$(i));e.patchResource(t,n,a).then(()=>{s(`/${t}/${n}/details`)?.catch(console.error),q({id:`succes`,color:`green`,message:`Success`})}).catch(e=>{l(yS(e)),q({color:`red`,message:J(e),autoClose:!1})})},[e,t,n,r,s]),f=(0,b.useCallback)(()=>s(`/${t}/${n}/delete`)?.catch(console.error),[s,t,n]);return a?(0,L.jsx)(LF,{children:(0,L.jsx)(fU,{defaultValue:a,onSubmit:u,onPatch:d,onDelete:f,outcome:c})}):null}function C$(){let{resourceType:e,id:t}=UK(),n=eA({reference:e+`/`+t});return n?(0,L.jsx)(LF,{maw:700,children:n.resourceType===`Patient`?(0,L.jsx)(CV,{patient:n}):(0,L.jsx)(jd,{icon:(0,L.jsx)(pj,{size:16}),title:`Unsupported export type`,color:`red`,children:`This page is only supported for Patient resources`})}):null}function w$({resource:e,currentProfile:t,onChange:n}){let r=e.resourceType,i=Z(),[a,o]=(0,b.useState)();return(0,b.useEffect)(()=>{i.searchResources(`StructureDefinition`,{type:r,derivation:`constraint`,_count:50}).then(e=>{o(e.filter(nL))}).catch(console.error)},[i,n,r]),(0,L.jsx)(Ab,{value:t?.url,onChange:e=>{let t=a?.find(t=>t.url===e);t&&n(t)},children:(0,L.jsx)(Ab.List,{children:a?.map(t=>{let n=e.meta?.profile?.includes(t.url),r=n?`This profile is present in this resource's meta.profile property.`:`This profile is not included in this resource's meta.profile property.`;return(0,L.jsx)(Ab.Tab,{value:t.url,title:r,rightSection:n&&(0,L.jsx)(Pb,{variant:`outline`,color:`green`,size:`xs`,style:{borderStyle:`none`},children:(0,L.jsx)(UM,{size:`90%`})}),children:t.title||t.name},t.url)})})})}function T$(e,t){let n=Z(),r=zK();return{defaultValue:{resourceType:e},handleSubmit:e=>{t&&t(void 0),n.createResource(e).then(e=>r(`/`+e.resourceType+`/`+e.id)).catch(e=>{t&&t(yS(e)),q({color:`red`,message:J(e),autoClose:!1,styles:{description:{whiteSpace:`pre-line`}}})})}}}function E$(){let{resourceType:e}=UK(),t=LK(),[n,r]=(0,b.useState)(),{defaultValue:i,handleSubmit:a}=T$(e,r),[o,s]=(0,b.useState)(),c=t.pathname.toLowerCase().endsWith(`profiles`),l=(0,b.useCallback)(e=>{let t=h$(e);o&&Tw(t,o.url),a(t)},[o,a]);return c?(0,L.jsx)(LF,{children:(0,L.jsxs)(W,{children:[(0,L.jsx)(w$,{resource:i,currentProfile:o,onChange:s}),o?(0,L.jsx)(fU,{defaultValue:i,onSubmit:l,outcome:n,profileUrl:o.url},o.url):(0,L.jsx)(H,{my:`lg`,fz:`lg`,fs:`italic`,ta:`center`,children:`Select a profile above`})]})}):(0,L.jsx)(LF,{children:(0,L.jsx)(fU,{defaultValue:i,onSubmit:a,outcome:n})})}function D$(){let e=Z(),{resourceType:t,id:n}=UK(),r=e.readHistory(t,n).read();return(0,L.jsx)(LF,{children:(0,L.jsx)(pU,{history:r})})}function O$(){let{resourceType:e}=UK(),[t,n]=(0,b.useState)(),{defaultValue:r,handleSubmit:i}=T$(e,n),a=(0,b.useCallback)(e=>{i(JSON.parse(e[`new-resource`]))},[i]);return(0,L.jsxs)(LF,{children:[t&&(0,L.jsx)(oI,{outcome:t}),(0,L.jsxs)(NP,{onSubmit:a,children:[(0,L.jsx)(vh,{name:`new-resource`,"data-testid":`create-resource-json`,autosize:!0,minRows:24,defaultValue:VC(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,wrap:`nowrap`,children:(0,L.jsx)(U,{type:`submit`,children:`OK`})})]})]})}function k$(){let e=Z(),{resourceType:t,id:n}=UK(),r=eA({reference:t+`/`+n}),i=zK(),[a,o]=(0,b.useState)(),s=(0,b.useCallback)(r=>{e.updateResource(h$(JSON.parse(r.resource))).then(()=>{o(void 0),i(`/${t}/${n}/details`)?.catch(console.error),q({color:`green`,message:`Success`})}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})})},[e,t,n,i]);return r?(0,L.jsxs)(LF,{children:[a&&(0,L.jsx)(oI,{outcome:a}),(0,L.jsxs)(NP,{onSubmit:s,children:[(0,L.jsx)(vh,{name:`resource`,"data-testid":`resource-json`,autosize:!0,minRows:24,defaultValue:VC(r,!0),formatOnBlur:!0,deserialize:JSON.parse}),(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,wrap:`nowrap`,children:(0,L.jsx)(U,{type:`submit`,children:`OK`})})]})]}):null}function A$(e){let{resourceType:t,id:n}=e;return(0,L.jsxs)(LF,{children:[(0,L.jsxs)(jd,{icon:(0,L.jsx)(pj,{size:16}),mb:`xl`,children:[`This is just a preview! Access your form here:`,(0,L.jsx)(`br`,{}),(0,L.jsx)(Rd,{href:`/forms/${n}`,children:`/forms/${n}`})]}),(0,L.jsx)(LH,{questionnaire:{reference:t+`/`+n},onSubmit:()=>alert(`You submitted the preview`)})]})}var j$={propertyTable:`_propertyTable_1xts4_1`,propertiesTitle:`_propertiesTitle_1xts4_17`};function M$(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 N$(e){let{properties:t}=e,n=t.map(e=>{let t=``,n=``,r=``;return e.part?.forEach(e=>{e.name===`code`?t=e.valueCode||``:e.name===`description`?n=e.valueString||``:e.name===`value`&&(r=M$(e))}),{code:t,description:n,value:r}});return(0,L.jsxs)(G,{className:j$.propertyTable,children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Code`}),(0,L.jsx)(G.Th,{children:`Description`}),(0,L.jsx)(G.Th,{children:`Value`})]})}),(0,L.jsx)(G.Tbody,{children:n.map((e,t)=>(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:e.code}),(0,L.jsx)(G.Td,{children:e.description}),(0,L.jsx)(G.Td,{children:e.value})]},`property-${t}`))})]})}function P$(e){let{valueSet:t}=e,n=Z(),r=t.url,[i,a]=(0,b.useState)(),[o,s]=(0,b.useState)(),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(),f=(0,b.useCallback)(async e=>{if(a(e),s(void 0),d(void 0),!e?.code||!e?.system){l(!1);return}l(!0);try{let t=new URLSearchParams({system:e.system,code:e.code}),r=n.fhirUrl(`CodeSystem`,`$lookup`)+`?`+t.toString(),i=await n.get(r);s(i)}catch(e){d(e instanceof Error?e:Error(String(e)))}finally{l(!1)}},[n]),p=(0,b.useMemo)(()=>o?.parameter?.filter(e=>e.name===`property`&&e.part)??[],[o]),m=p.length>0;return(0,L.jsx)(LF,{children:(0,L.jsxs)(W,{gap:`xl`,children:[(0,L.jsx)(UP,{binding:r,placeholder:`Select a value from the ValueSet`,onChange:e=>f(e[0]),defaultValue:i,maxValues:1}),i?(0,L.jsxs)(W,{gap:`md`,children:[(0,L.jsxs)(DF,{children:[(0,L.jsx)(OF,{term:`Code`,children:i.code}),i.system&&(0,L.jsx)(OF,{term:`System`,children:i.system}),i.display&&(0,L.jsx)(OF,{term:`Display`,children:i.display})]}),c&&(0,L.jsxs)(V,{gap:`xs`,children:[(0,L.jsx)(fu,{size:`sm`}),(0,L.jsx)(H,{size:`sm`,c:`dimmed`,children:`Loading properties...`})]}),!c&&u&&(0,L.jsxs)(jd,{icon:(0,L.jsx)(pj,{size:16}),title:`Lookup Failed`,color:`red`,children:[`Failed to retrieve code information: `,J(u)]}),!c&&!u&&m&&(0,L.jsx)(WM,{children:(0,L.jsxs)(W,{gap:`xs`,mt:`lg`,children:[(0,L.jsx)(H,{fw:500,size:`sm`,c:`dimmed`,className:j$.propertiesTitle,children:`Properties`}),(0,L.jsx)(N$,{properties:p})]})})]}):null]})})}function F$(){let{resourceType:e,id:t}=UK(),n=eA({reference:e+`/`+t});return n?n.resourceType===`Questionnaire`?(0,L.jsx)(A$,{resourceType:e,id:t}):n.resourceType===`ValueSet`?(0,L.jsx)(P$,{valueSet:n}):null:null}function I$(){let e=Z(),{resourceType:t,id:n}=UK(),[r,i]=(0,b.useState)(),[a,o]=(0,b.useState)();return(0,b.useEffect)(()=>{e.readResource(t,n).then(e=>i(ew(e))).catch(e=>{q({color:`red`,message:J(e)})})},[e,t,n]),r?(0,L.jsxs)(LF,{children:[(0,L.jsxs)(K,{order:2,children:[`Available `,t,` profiles`]}),(0,L.jsx)(W,{children:(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(w$,{resource:r,currentProfile:a,onChange:o}),a?(0,L.jsx)(L$,{profile:a,resource:r,onResourceUpdated:e=>i(e)},a.url):(0,L.jsx)(H,{my:`lg`,fz:`lg`,fs:`italic`,ta:`center`,children:`Select a profile above`})]})})]}):null}var L$=({profile:e,resource:t,onResourceUpdated:n})=>{let r=Z(),[i,a]=(0,b.useState)(),[o,s]=(0,b.useState)(()=>t.meta?.profile?.includes(e.url)),c=(0,b.useCallback)(t=>{a(void 0);let i=h$(t);o?Tw(i,e.url):Ew(i,e.url),r.updateResource(i).then(e=>{n(e),q({color:`green`,message:`Success`})}).catch(e=>{a(yS(e)),q({color:`red`,message:J(e),autoClose:!1})})},[r,e.url,n,o]);return(0,L.jsxs)(W,{children:[(0,L.jsx)(nb,{size:`md`,checked:o,label:`Conform resource to ${e.title}`,onChange:e=>s(e.currentTarget.checked),"data-testid":`profile-toggle`}),o?(0,L.jsx)(fU,{profileUrl:e.url,defaultValue:t,onSubmit:c,outcome:i}):(0,L.jsx)(`form`,{noValidate:!0,onSubmit:e=>{e.preventDefault(),c(t)},children:(0,L.jsx)(V,{justify:`flex-end`,mt:`xl`,children:(0,L.jsx)(U,{type:`submit`,children:`OK`})})})]})},R$={"Create Only":`create`,"Update Only":`update`,"Delete Only":`delete`,"All Interactions":void 0},z$=Object.keys(R$);function B$(){let e=Z(),{id:t}=UK(),n=eA({reference:`Questionnaire/${t}`}),[r,i]=(0,b.useState)(),[a,o]=(0,b.useState)(`create`),[s,c]=(0,b.useState)(0),l=e.searchResources(`Subscription`,`status=active&_count=100`).read().filter(e=>V$(e,n));function u(){r&&n&&e.createResource({resourceType:`Subscription`,status:`active`,reason:`Connect bot ${r.name} to questionnaire responses`,criteria:`QuestionnaireResponse?questionnaire=${n.url?`${n.url},${OC(n)}`:OC(n)}`,channel:{type:`rest-hook`,endpoint:OC(r)},...a?{extension:[{url:`https://medplum.com/fhir/StructureDefinition/subscription-supported-interaction`,valueCode:a}]}:void 0}).then(()=>{i(void 0),c(Date.now()),e.invalidateSearches(`Subscription`),q({color:`green`,message:`Success`})}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}return(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Bots`}),(0,L.jsxs)(W,{children:[l.length===0&&(0,L.jsx)(`p`,{children:`No bots found.`}),l.map(e=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{children:(0,L.jsx)(uR,{value:{reference:e.channel?.endpoint},link:!0})}),(0,L.jsxs)(`p`,{children:[`Criteria: `,e.criteria]})]},e.id))]}),(0,L.jsx)(hm,{}),(0,L.jsxs)(W,{mt:10,children:[(0,L.jsx)(sd,{size:`lg`,htmlFor:`bot`,children:`Connect to bot`}),(0,L.jsxs)(V,{children:[(0,L.jsx)(jL,{name:`bot`,resourceType:`Bot`,onChange:e=>i(e)}),(0,L.jsx)(U,{onClick:u,children:`Connect`})]}),(0,L.jsx)(V,{children:(0,L.jsx)(Ig,{name:`subscription-trigger-event`,defaultValue:`Create Only`,label:`Subscription Trigger Event`,data:z$,onChange:e=>o(R$[e.target.value])})})]}),(0,L.jsx)(`div`,{style:{display:`none`},children:s})]})}function V$(e,t){if(!t)return!1;let n=e.criteria||``,r=e.channel?.endpoint||``;return n.startsWith(`QuestionnaireResponse?`)&&r.startsWith(`Bot/`)&&(n.includes(OC(t))||(t.url?n.includes(t.url):!1))}function H$(){let{id:e}=UK(),t=zK(),n=Z().readReference({reference:`Questionnaire/${e}`}).read(),[r,i]=(0,b.useState)({resourceType:`QuestionnaireResponse`,filters:[{code:`questionnaire`,operator:X.EQUALS,value:n.url?`${n.url},Questionnaire/${e}`:`Questionnaire/${e}`}],fields:[`id`,`_lastUpdated`]});return(0,L.jsx)(LF,{children:(0,L.jsx)(UB,{search:r,onClick:e=>t(`/${e.resource.resourceType}/${e.resource.id}`)?.catch(console.error),onChange:e=>i(e.definition),hideFilters:!0,hideToolbar:!0})})}function U$(){let e=Z(),{resourceType:t,id:n}=UK(),r=eA({reference:t+`/`+n}),i=(0,b.useCallback)(t=>{e.updateResource(h$(t)).then(()=>{q({color:`green`,message:`Success`})}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})})},[e]);return r?(0,L.jsx)(LF,{children:(0,L.jsx)(VH,{onSubmit:i,definition:r})}):null}function W$(){let{resourceType:e,id:t}=UK(),n=eA({reference:e+`/`+t});return n?(0,L.jsx)(LF,{children:e===`MeasureReport`?(0,L.jsx)(mV,{measureReport:n}):(0,L.jsx)(pR,{value:n})}):null}var G$={container:`_container_1ue98_1`,entry:`_entry_1ue98_14`,active:`_active_1ue98_21`};function K$(e){let t=Z(),n=eA(e.value),[r,i]=(0,b.useState)();return(0,b.useEffect)(()=>{if(!n)return;let e=OJ(n);if(!e)return;let r=`reference`in e?e.reference:OC(e);t.search(`ServiceRequest`,`subject=`+r).then(e=>{let t=(e.entry??[]).map(e=>e.resource);NR(t),t.reverse(),i(t)}).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[t,n]),r?(0,L.jsx)(`div`,{"data-testid":`quick-service-requests`,className:G$.container,children:r.map(e=>(0,L.jsxs)(`div`,{className:Ln(G$.entry,{[G$.active]:e.id===n?.id}),children:[(0,L.jsx)(`p`,{children:(0,L.jsx)(eN,{to:e,children:q$(e)})}),e.category?.[0]?.text&&(0,L.jsx)(`p`,{children:e.category[0]?.text}),e.code?.coding?.[0]?.code&&(0,L.jsx)(`p`,{children:e.code.coding[0]?.code}),(0,L.jsx)(`p`,{children:J$(e)})]},e.id))}):null}function q$(e){if(e.identifier){for(let t of e.identifier)if(t.value)return t.value}return e.id||``}function J$(e){return e.authoredOn?e.authoredOn.substring(0,10):e.meta?.lastUpdated?e.meta.lastUpdated.substring(0,10):``}var Y$={container:`_container_1l2dh_1`};function X$(e){let t=eA(e.valueSet);if(!t)return null;let n=[``],r=t.compose?.include?.[0]?.concept?.map(e=>e.code);return r&&n.push(...r),e.defaultValue&&!n.includes(e.defaultValue)&&n.push(e.defaultValue),(0,L.jsx)(`div`,{className:Y$.container,children:(0,L.jsx)(Ig,{defaultValue:e.defaultValue,onChange:t=>e.onChange(t.currentTarget.value),data:n})})}function Z$(e){let t=eA(e.specimen);return t?(0,L.jsxs)(tV,{children:[(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(tV.Key,{children:`Type`}),(0,L.jsx)(tV.Value,{children:`Specimen`})]}),(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(tV.Key,{children:`Collected`}),(0,L.jsx)(tV.Value,{children:Pw(t.collection?.collectedDateTime)})]}),(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(tV.Key,{children:`Specimen Age`}),(0,L.jsx)(tV.Value,{children:Q$(t)})]}),t.collection?.collectedDateTime&&t.receivedTime?(0,L.jsxs)(tV.Entry,{children:[(0,L.jsx)(tV.Key,{children:`Specimen Stability`}),(0,L.jsx)(tV.Value,{children:$$(t)})]}):(0,L.jsx)(L.Fragment,{})]}):null}function Q$(e){let t=e.collection?.collectedDateTime;if(t)return e1(t1(new Date(t),new Date))}function $$(e){if(e.collection?.collectedDateTime&&e.receivedTime)return e1(t1(new Date(e.collection.collectedDateTime),new Date(e.receivedTime)))}function e1(e){return e.toString().padStart(3,`0`)+`D`}function t1(e,t){let n=t.getTime()-e.getTime();return Math.floor(n/864e5)}function n1(e){let 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`),e===`User`&&t.push(`Email`),e===`Communication`&&t.push(`Payload`),t.push(`Details`,`Edit`,`Event`,`History`,`Blame`,`JSON`,`Apps`,`Profiles`),e===`Patient`&&t.push(`Accounts`,`Export`),t}function r1(){let e=Z(),{resourceType:t,id:n}=UK(),r={reference:t+`/`+n},[i,a]=(0,b.useState)(),o=eA(r,a),s=n1(t);async function c(){let r=(await e.readHistory(t,n)).entry?.find(e=>!!e.resource)?.resource;r?l(r):q({color:`red`,message:`No history to restore`,autoClose:!1})}function l(t){e.updateResource(h$(t)).then(()=>{a(void 0),q({color:`green`,message:`Success`})}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})})}if(i)return gS(i)?(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Deleted`}),(0,L.jsx)(`p`,{children:`The resource was deleted.`}),(0,L.jsx)(U,{color:`red`,onClick:c,children:`Restore`})]}):(0,L.jsx)(oI,{outcome:i});function u(e){let t=o,n=t.orderDetail||[];n.length===0&&n.push({}),n[0].text!==e&&(n[0].text=e,l({...t,orderDetail:n}))}let d=o&&OJ(o),f=o&&kJ(o),p=e.getUserConfiguration()?.option?.find(e=>e.id===`statusValueSet`)?.valueString;return(0,L.jsxs)(L.Fragment,{children:[o?.resourceType===`ServiceRequest`&&p&&(0,L.jsx)(X$,{valueSet:{reference:p},defaultValue:o.orderDetail?.[0]?.text,onChange:u},OC(o)+`-`+o.orderDetail?.[0]?.text),o&&(0,L.jsx)(K$,{value:o}),(0,L.jsxs)(Cl,{children:[!o&&(0,L.jsx)(rV,{withAvatar:t===`Patient`}),d&&(0,L.jsx)(EV,{patient:d}),f&&(0,L.jsx)(Z$,{specimen:f}),o&&t!==`Patient`&&(0,L.jsx)(EQ,{resource:r}),(0,L.jsx)(ml,{children:(0,L.jsx)(aV,{baseUrl:`/${t}/${n}`,tabs:s})})]}),(0,L.jsx)(yq,{})]})}function i1(){let e=zK(),{resourceType:t,id:n,versionId:r,tab:i}=UK(),a=Z(),[o,s]=(0,b.useState)(!0),[c,l]=(0,b.useState)(),[u,d]=(0,b.useState)();if((0,b.useEffect)(()=>{d(void 0),s(!0),a.readHistory(t,n).then(e=>l(e)).then(()=>s(!1)).catch(e=>{d(e),s(!1)})},[a,t,n]),o)return(0,L.jsx)(GM,{});let f=c?.entry??[],p=f.findIndex(e=>e.resource?.meta?.versionId===r);if(p===-1)return(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Version not found`}),(0,L.jsx)(eN,{to:`/${t}/${n}`,children:`Return to resource`})]});let m=f[p].resource,h=p<f.length-1?f[p+1].resource:void 0,g=`diff`,_=i||g,v=f.length-p;return(0,L.jsx)(lm,{maw:1200,children:(0,L.jsx)(IF,{children:(0,L.jsxs)(W,{gap:`lg`,children:[u&&(0,L.jsx)(`pre`,{"data-testid":`error`,children:JSON.stringify(u,void 0,2)}),(0,L.jsxs)(Ay,{cols:2,mb:`lg`,children:[(0,L.jsx)(pv,{total:f.length,value:v,getControlProps:LB,onChange:r=>e(`/${t}/${n}/_history/${f[f.length-r]?.resource?.meta?.versionId}/${_}`)?.catch(console.error)}),(0,L.jsx)(V,{justify:`right`,children:(0,L.jsx)(by,{data:[{value:`diff`,label:`Diff`},{value:`raw`,label:`Raw`}],value:_,onChange:i=>e(`/${t}/${n}/_history/${r}/${i||g}`)?.catch(console.error)})})]}),(0,L.jsx)(z,{mb:`lg`,children:(0,L.jsxs)(DF,{compact:!0,children:[(0,L.jsx)(OF,{term:`Version ID`,children:m.meta?.versionId}),(0,L.jsx)(OF,{term:`Author`,children:(0,L.jsx)(dR,{value:m.meta?.author,link:!0},m.meta?.author?.reference)}),(0,L.jsx)(OF,{term:`Date/Time`,children:Pw(m.meta?.lastUpdated)})]})}),_===`diff`&&(0,L.jsx)(lU,{original:h??{},revised:m}),_===`raw`&&(0,L.jsx)(`pre`,{style:{fontSize:`9pt`},children:JSON.stringify(m,void 0,2)})]})})})}function a1(){let{resourceType:e,id:t}=UK(),n=zK(),[r,i]=(0,b.useState)({resourceType:`Subscription`,filters:[{code:`url`,operator:X.EQUALS,value:`${e}/${t}`}],fields:[`id`,`criteria`,`status`,`_lastUpdated`]});return(0,L.jsx)(LF,{children:(0,L.jsx)(UB,{search:r,onClick:e=>n(`/${e.resource.resourceType}/${e.resource.id}`)?.catch(console.error),onChange:e=>i(e.definition),hideFilters:!0})})}function o1(e){let t=Z(),{resource:n,opened:r,onClose:i}=e,[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)(`update`),[d,f]=(0,b.useState)(!1),p=(0,b.useCallback)(async()=>{if(n?.id)try{await t.post(t.fhirUrl(n.resourceType,n.id,`$resend`),{subscription:a&&s?OC(s):void 0,interaction:l,verbose:d}),q({color:`green`,message:`Done`}),i()}catch(e){q({color:`red`,message:J(e),autoClose:!1})}},[t,n,i,a,s,l,d]);return(0,L.jsx)(pg,{opened:r,onClose:i,title:`Resend Subscriptions`,children:(0,L.jsx)(NP,{onSubmit:p,children:(0,L.jsxs)(W,{children:[(0,L.jsx)(pp,{label:`Choose subscription (all subscriptions by default)`,onChange:e=>o(e.currentTarget.checked)}),a&&(0,L.jsx)(jL,{name:`subscription`,resourceType:`Subscription`,placeholder:`Subscription`,onChange:c}),(0,L.jsx)(Ig,{label:`Interaction`,description:`The interaction type to resend (update by default)`,defaultValue:`update`,data:[{label:`Update`,value:`update`},{label:`Create`,value:`create`},{label:`Delete`,value:`delete`}],onChange:e=>u(e.currentTarget.value)}),(0,L.jsx)(pp,{label:`Verbose mode`,onChange:e=>f(e.currentTarget.checked)}),(0,L.jsx)(V,{justify:`flex-end`,children:(0,L.jsx)(U,{type:`submit`,children:`Resend`})})]})})})}function s1(){let e=Z(),t=Uk(),{resourceType:n,id:r}=UK(),i={reference:n+`/`+r},[a,o]=(0,b.useState)(),s=wn(!1);function c(t,n){return e.updateResource({...t,priority:n})}function l(e,t){c(e,`stat`).then(t).catch(console.error)}function u(e,t){c(e,`routine`).then(t).catch(console.error)}function d(e){t(`/${e.resourceType}/${e.id}`)}function f(e){t(`/${e.resourceType}/${e.id}/edit`)}function p(e){t(`/${e.resourceType}/${e.id}/delete`)}function m(e){o(e),s[1].open()}function h(e){t(`/${e.resourceType}/${e.id}/_history/${e.meta?.versionId}`)}function g(t,n){let r=`aws-textract`;q({id:r,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(()=>{n(),Jb({id:r,title:`AWS Textract Successful`,message:`Text successfully extracted.`,color:`green`,icon:(0,L.jsx)(jj,{size:`1rem`}),loading:!1,withCloseButton:!0})}).catch(e=>Jb({id:r,title:`AWS Textract Error`,color:`red`,message:J(e),icon:(0,L.jsx)(HM,{size:`1rem`}),loading:!1,withCloseButton:!0}))}function _(t){let{primaryResource:n,currentResource:r,reloadTimeline:i}=t,a=r.resourceType===n.resourceType&&r.id===n.id,o=r.resourceType===`Communication`&&r.priority!==`stat`,s=r.resourceType===`Communication`&&r.priority===`stat`,c=a,_=!a,v=!a,y=!a,b=e.getProjectMembership()?.admin,x=b,S=JQ()&&(r.resourceType===`DocumentReference`||r.resourceType===`Media`);return(0,L.jsxs)(Xh.Dropdown,{children:[(0,L.jsx)(Xh.Label,{children:`Resource`}),o&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(_M,{size:14}),onClick:()=>l(r,i),"aria-label":`Pin ${OC(r)}`,children:`Pin`}),s&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(vM,{size:14}),onClick:()=>u(r,i),"aria-label":`Unpin ${OC(r)}`,children:`Unpin`}),_&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(iM,{size:14}),onClick:()=>d(r),"aria-label":`Details ${OC(r)}`,children:`Details`}),c&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(iM,{size:14}),onClick:()=>h(r),"aria-label":`Details ${OC(r)}`,children:`Details`}),v&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(Gj,{size:14}),onClick:()=>f(r),"aria-label":`Edit ${OC(r)}`,children:`Edit`}),b&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(Xh.Label,{children:`Admin`}),x&&(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(wM,{size:14}),onClick:()=>m(r),"aria-label":`Resend Subscriptions ${OC(r)}`,children:`Resend Subscriptions`})]}),S&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(Xh.Label,{children:`AWS AI`}),(0,L.jsx)(Xh.Item,{leftSection:(0,L.jsx)(LM,{size:14}),onClick:()=>g(r,i),"aria-label":`AWS Textract ${OC(r)}`,children:`AWS Textract`})]}),y&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(Xh.Divider,{}),(0,L.jsx)(Xh.Label,{children:`Danger zone`}),(0,L.jsx)(Xh.Item,{color:`red`,leftSection:(0,L.jsx)(RM,{size:14}),onClick:()=>p(r),"aria-label":`Delete ${OC(r)}`,children:`Delete`})]})]})}return(0,L.jsxs)(L.Fragment,{children:[n===`Encounter`&&(0,L.jsx)(lz,{encounter:i,getMenu:_}),n===`Patient`&&(0,L.jsx)(DV,{patient:i,getMenu:_}),n===`ServiceRequest`&&(0,L.jsx)(SJ,{serviceRequest:i,getMenu:_}),n!==`Encounter`&&n!==`Patient`&&n!==`ServiceRequest`&&(0,L.jsx)(cz,{resource:i,getMenu:_}),(0,L.jsx)(o1,{resource:a,opened:s[0],onClose:s[1].close},`resend-subscriptions-${a?.id}`)]})}var c1=5,l1=`The Medplum Agent is frequently patched with new features and bugfixes. Downgrading your agent can result in picking up old bugs or losing features you may be relying on. Are you sure you want to downgrade?`;function u1(e){let{opened:t,close:n,version:r,loadingStatus:i,handleStatus:a,handleUpgrade:o}=e,[s,c]=(0,b.useState)(),[l,u]=(0,b.useState)(),[d,f]=(0,b.useState)(),[p,m]=(0,b.useState)(!1);if((0,b.useEffect)(()=>{t&&(s||zk(`app-tools-page`).then(c).catch(console.error),l||Bk(`app-tools-page`).then(u).catch(e=>{console.error(e),u([])}),a())},[t,s,l,a]),!r||i)return(0,L.jsx)(GM,{});if(r===`unknown`)return(0,L.jsx)(`p`,{children:`Unable to determine the current version of the agent. Check the network connectivity of the agent.`});if(!(s&&l))return(0,L.jsx)(GM,{});let h=d??s,g=l.filter(e=>Rk(e,r)>0),_=l.filter(e=>Rk(e,r)<0),v=g.slice(0,c1),y=_.slice(0,c1),x=v.includes(s)?[...v,...y]:[s,...v,...y],S=Rk(h,r)<0,C=Rk(h,r)===0;function w(e){return{value:e,label:e===s?`${e} (Latest)`:e,resource:e}}let T=l;async function E(e){if(!e)return x;let t=e.toLowerCase();return T.filter(e=>e.toLowerCase().includes(t))}function D(){(!S||window.confirm(l1))&&(o(p,h),n())}return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(SN,{label:`Target Version`,placeholder:`Search versions...`,defaultValue:h,toOption:w,loadOptions:E,onChange:([e])=>{e&&f(e)},maxValues:1,clearable:!1}),C?(0,L.jsxs)(`p`,{children:[`This agent is already on version `,h,`.`]}):(0,L.jsxs)(`p`,{children:[`Are you sure you want to `,S?`downgrade`:`upgrade`,` this agent from version `,r,` to version`,` `,h,`?`]}),(0,L.jsxs)(V,{children:[(0,L.jsx)(U,{onClick:D,"aria-label":`Confirm upgrade`,children:`Confirm Upgrade`}),(0,L.jsx)(pp,{label:`Force`,onChange:e=>m(e.currentTarget.checked)})]})]})}var d1=[`live`,`ping`,`hl7ConnectionsOpen`,`hl7ClientCount`,`hl7QueueDepth`,`webSocketQueueDepth`,`outstandingHeartbeats`];function f1(e){return e==null?``:typeof e==`object`?JSON.stringify(e):typeof e==`number`?e.toLocaleString():e.toString()}function p1(e){let t=Object.keys(e.entries).filter(t=>e.entries[t]?.rtt);return t.length?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{order:3,mt:`md`,children:e.title}),(0,L.jsxs)(G,{children:[(0,L.jsx)(G.Thead,{children:(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Th,{children:`Name`}),(0,L.jsx)(G.Th,{children:`Count`}),(0,L.jsx)(G.Th,{children:`Pending`}),(0,L.jsx)(G.Th,{children:`Min (ms)`}),(0,L.jsx)(G.Th,{children:`Avg (ms)`}),(0,L.jsx)(G.Th,{children:`Max (ms)`}),(0,L.jsx)(G.Th,{children:`p50 (ms)`}),(0,L.jsx)(G.Th,{children:`p95 (ms)`}),(0,L.jsx)(G.Th,{children:`p99 (ms)`})]})}),(0,L.jsx)(G.Tbody,{children:t.map(t=>{let n=e.entries[t].rtt;return(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:t}),(0,L.jsx)(G.Td,{children:n.count}),(0,L.jsx)(G.Td,{children:n.pendingCount}),(0,L.jsx)(G.Td,{children:n.min}),(0,L.jsx)(G.Td,{children:n.average}),(0,L.jsx)(G.Td,{children:n.max}),(0,L.jsx)(G.Td,{children:n.p50}),(0,L.jsx)(G.Td,{children:n.p95}),(0,L.jsx)(G.Td,{children:n.p99})]},t)})})]})]}):null}function m1(e){let{stats:t}=e,n=new Set([...d1,`channelStats`,`clientStats`]),r=Object.entries(t).filter(([e])=>!n.has(e));return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(G,{mt:`sm`,children:(0,L.jsxs)(G.Tbody,{children:[d1.map(e=>(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:e}),(0,L.jsx)(G.Td,{children:f1(t[e])})]},e)),r.map(([e,t])=>(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:e}),(0,L.jsx)(G.Td,{children:f1(t)})]},e))]})}),(0,L.jsx)(p1,{title:`Channel Stats`,entries:t.channelStats}),(0,L.jsx)(p1,{title:`Client Stats`,entries:t.clientStats})]})}function h1(){let e=Z(),{id:t}=UK(),n=(0,b.useMemo)(()=>({reference:`Agent/`+t}),[t]),[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(),[h,g]=(0,b.useState)(),[_,v]=(0,b.useState)(),[y,x]=(0,b.useState)(),[S,C]=(0,b.useState)(!1),[w,T]=(0,b.useState)(),[E,D]=(0,b.useState)(!1),[O,k]=(0,b.useState)(),[A,j]=(0,b.useState)(20),[M,N]=(0,b.useState)(),[ee,{open:P,close:te}]=wn(!1),ne=r||a||s||S||l||d,re=(0,b.useCallback)(()=>{i(!0),e.get(e.fhirUrl(`Agent`,t,`$status`),{cache:`reload`}).then(e=>{m(e.parameter?.find(e=>e.name===`status`)?.valueCode),v(e.parameter?.find(e=>e.name===`lastUpdated`)?.valueInstant);let t=e.parameter?.find(e=>e.name===`version`)?.valueString;t===void 0||t===`unknown`||Ik(t)?g(t):_1(`Invalid version received from $status operation`)}).catch(e=>_1(J(e))).finally(()=>i(!1))},[e,t]),ie=(0,b.useCallback)(t=>{let r=t.host,i=t.pingCount||1;r&&(C(!0),e.pushToAgent(n,r,`PING ${i}`,wD.PING,!0).then(e=>x(e)).catch(e=>_1(J(e))).finally(()=>C(!1)))},[e,n]),ae=(0,b.useCallback)(()=>{o(!0),e.get(e.fhirUrl(`Agent`,t,`$reload-config`),{cache:`reload`}).then(e=>{g1(`Agent config reloaded successfully.`)}).catch(e=>_1(J(e))).finally(()=>o(!1))},[e,t]),oe=(0,b.useCallback)((n,r)=>{c(!0);let i=e.fhirUrl(`Agent`,t,`$upgrade`);i.searchParams.set(`force`,String(n)),i.searchParams.set(`version`,r),e.get(i,{cache:`reload`}).then(e=>{g1(`Agent upgraded successfully.`)}).catch(e=>_1(J(e))).finally(()=>c(!1))},[e,t]),se=(0,b.useCallback)((n,r)=>{u(!0);let i=e.fhirUrl(`Agent`,t,`$fetch-logs`);i.searchParams.set(`limit`,String(n)),r&&i.searchParams.set(`before`,r),e.get(i,{cache:`reload`}).then(e=>{let t=e?.parameter?.find(e=>e.name===`logs`)?.valueString,n=e?.parameter?.find(e=>e.name===`hasMore`)?.valueBoolean??!1,i=e?.parameter?.find(e=>e.name===`nextBefore`)?.valueString;T(e=>r&&e?t?`${e}\n${t}`:e:t),D(n),k(i)}).catch(e=>_1(J(e))).finally(()=>u(!1))},[e,t]),ce=(0,b.useCallback)(e=>{let t=Number(e.logLimit)||20;j(t),se(t)},[se]),le=(0,b.useCallback)(()=>{se(A,O)},[se,A,O]),ue=(0,b.useCallback)(()=>{f(!0),e.get(e.fhirUrl(`Agent`,t,`$stats`),{cache:`reload`}).then(e=>{let t=e.parameter?.find(e=>e.name===`stats`)?.valueString;if(t)try{N(JSON.parse(t))}catch(e){_1(J(e))}}).catch(e=>_1(J(e))).finally(()=>f(!1))},[e,t]);return(0,L.jsxs)(LF,{children:[(0,L.jsx)(pg,{opened:ee,onClose:te,title:`Upgrade Agent`,centered:!0,children:(0,L.jsx)(u1,{opened:ee,close:te,version:h,loadingStatus:r,handleStatus:re,handleUpgrade:oe})}),(0,L.jsx)(K,{order:1,children:`Agent Tools`}),(0,L.jsxs)(`div`,{style:{marginBottom:10},children:[`Agent: `,(0,L.jsx)(uR,{value:n,link:!0})]}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Agent Status`}),(0,L.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.`}),(0,L.jsx)(U,{onClick:re,loading:r,disabled:ne&&!r,children:`Get Status`}),!r&&p&&(0,L.jsx)(G,{children:(0,L.jsxs)(G.Tbody,{children:[(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:`Status`}),(0,L.jsx)(G.Td,{children:(0,L.jsx)(sR,{status:p})})]}),(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:`Version`}),(0,L.jsx)(G.Td,{children:h})]}),(0,L.jsxs)(G.Tr,{children:[(0,L.jsx)(G.Td,{children:`Last Updated`}),(0,L.jsx)(G.Td,{children:Pw(_,void 0,{timeZoneName:`longOffset`})})]})]})}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Reload Config`}),(0,L.jsx)(`p`,{children:`Reload the configuration of this agent, syncing it with the current version of the Agent resource on the Medplum server.`}),(0,L.jsx)(U,{onClick:ae,loading:a,disabled:ne&&!a,"aria-label":`Reload config`,children:`Reload Config`}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Upgrade Agent`}),(0,L.jsx)(`p`,{children:`Upgrade the version of this agent, to either the latest (default) or a specified version.`}),(0,L.jsx)(U,{onClick:P,loading:s,disabled:ne&&!s,"aria-label":`Upgrade agent`,children:`Upgrade`}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsxs)(NP,{onSubmit:ce,children:[(0,L.jsx)(K,{order:2,children:`Fetch Logs`}),(0,L.jsx)(`p`,{children:`Fetch logs from the agent.`}),w?.length?(0,L.jsx)(om,{block:!0,mb:15,children:w}):null,(0,L.jsxs)(V,{children:[(0,L.jsx)(W_,{w:100,id:`logLimit`,name:`logLimit`,placeholder:`20`,label:`Log Limit`}),(0,L.jsx)(U,{mt:22,loading:l,disabled:ne&&!l,"aria-label":`Fetch logs`,type:`submit`,children:`Fetch Logs`}),E?(0,L.jsx)(U,{mt:22,type:`button`,variant:`default`,onClick:le,loading:l,disabled:ne&&!l,"aria-label":`Load more logs`,children:`Load More`}):null]})]}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Agent Stats`}),(0,L.jsx)(`p`,{children:`Fetch runtime statistics from the agent, including connection counts, queue depths, RTT metrics, and overall agent health.`}),(0,L.jsx)(U,{onClick:ue,loading:d,disabled:ne&&!d,"aria-label":`Get stats`,children:`Get Stats`}),!d&&M&&(0,L.jsx)(m1,{stats:M}),(0,L.jsx)(hm,{my:`lg`}),(0,L.jsx)(K,{order:2,children:`Ping from Agent`}),(0,L.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.`}),(0,L.jsx)(NP,{onSubmit:ie,children:(0,L.jsxs)(V,{children:[(0,L.jsx)(jb,{id:`host`,name:`host`,placeholder:`ex. 127.0.0.1`,label:`IP Address / Hostname`,rightSection:(0,L.jsx)(bu,{size:24,radius:`xl`,variant:`filled`,type:`submit`,"aria-label":`Ping`,loading:S,disabled:ne&&!S,children:(0,L.jsx)(EM,{style:{width:`1rem`,height:`1rem`},stroke:1.5})})}),(0,L.jsx)(W_,{id:`pingCount`,name:`pingCount`,placeholder:`1`,label:`Ping Count`})]})}),!S&&y&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(K,{order:5,mt:`sm`,mb:0,children:`Last Ping`}),(0,L.jsx)(`pre`,{children:y})]})]})}function g1(e){q({color:`green`,title:`Success`,icon:(0,L.jsx)(jj,{size:`1rem`}),message:e})}function _1(e){q({color:`red`,title:`Error`,message:e,autoClose:!1})}function v1(){let e=Z(),{id:t}=UK(),n=eA({reference:`User/${t}`}),[r,i]=(0,b.useState)(``),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(!1),[l,u]=(0,b.useState)(!1);if(!n)return null;if(!n.project)return(0,L.jsx)(LF,{children:(0,L.jsx)(jd,{color:`yellow`,children:`Update Email is only available for project-scoped Users.`})});function d(){if(!r)return;u(!0);let n={resourceType:`Parameters`,parameter:[{name:`email`,valueString:r}]};a&&n.parameter?.push({name:`updateProfileTelecom`,valueBoolean:!0}),s&&n.parameter?.push({name:`skipEmailVerification`,valueBoolean:!0}),e.post(e.fhirUrl(`User`,t,`$update-email`),n).then(()=>{q({color:`green`,message:`Email updated successfully`}),i(``)}).catch(e=>{q({color:`red`,message:J(e),autoClose:!1})}).finally(()=>u(!1))}return(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{order:1,children:`Update Email`}),(0,L.jsxs)(`p`,{children:[`Update the email address for this User. The current email is `,(0,L.jsx)(`strong`,{children:n.email}),`.`]}),(0,L.jsx)(`form`,{onSubmit:e=>{e.preventDefault(),d()},children:(0,L.jsxs)(W,{children:[(0,L.jsx)(jb,{label:`New Email`,type:`email`,required:!0,placeholder:`new@example.com`,value:r,onChange:e=>i(e.currentTarget.value)}),(0,L.jsx)(pp,{label:`Update profile telecom`,description:`Add the new email to the associated profile resource's telecom and mark the old email as old`,checked:a,onChange:e=>o(e.currentTarget.checked)}),(0,L.jsx)(pp,{label:`Skip email verification`,description:`Do not send a verification email to the new address`,checked:s,onChange:e=>c(e.currentTarget.checked)}),(0,L.jsx)(`div`,{children:(0,L.jsx)(U,{type:`submit`,loading:l,disabled:!r,children:`Update Email`})})]})})]})}function y1(){let e=zK(),t=Z(),[n,r]=(0,b.useState)();(0,b.useEffect)(()=>{t.get(`auth/me`,{cache:`no-cache`}).then(r).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))},[t]);function i(e){t.post(`auth/revoke`,{loginId:e}).then(()=>t.get(`auth/me`,{cache:`no-cache`})).then(r).then(()=>q({color:`green`,message:`Login revoked`})).catch(e=>q({color:`red`,message:J(e),autoClose:!1}))}return n?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Security`}),(0,L.jsxs)(DF,{children:[(0,L.jsx)(OF,{term:`ID`,children:(0,L.jsx)(Rd,{href:`/${OC(n.profile)}`,children:n.profile.id})}),(0,L.jsx)(OF,{term:`Resource Type`,children:n.profile.resourceType}),(0,L.jsx)(OF,{term:`Name`,children:jw(n.profile.name?.[0])})]})]}),(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Sessions`}),(0,L.jsxs)(G,{children:[(0,L.jsx)(`thead`,{children:(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`th`,{children:`Project`}),(0,L.jsx)(`th`,{children:`OS`}),(0,L.jsx)(`th`,{children:`Browser`}),(0,L.jsx)(`th`,{children:`IP Address`}),(0,L.jsx)(`th`,{children:`Auth Method`}),(0,L.jsx)(`th`,{children:`Last Updated`}),(0,L.jsx)(`th`,{})]})}),(0,L.jsx)(`tbody`,{children:n.security.sessions.map(e=>(0,L.jsxs)(`tr`,{children:[(0,L.jsx)(`td`,{children:e.project?.display??`Unknown`}),(0,L.jsx)(`td`,{children:e.os}),(0,L.jsx)(`td`,{children:e.browser}),(0,L.jsx)(`td`,{children:e.remoteAddress}),(0,L.jsx)(`td`,{children:e.authMethod}),(0,L.jsx)(`td`,{children:Pw(e.lastUpdated)}),(0,L.jsx)(`td`,{children:(0,L.jsx)(Rd,{href:`#`,onClick:()=>i(e.id),children:`Revoke`})})]},e.id))})]})]}),(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Password`}),(0,L.jsx)(U,{onClick:()=>e(`/changepassword`)?.catch(console.error),children:`Change password`})]}),(0,L.jsxs)(LF,{children:[(0,L.jsx)(K,{children:`Multi Factor Auth`}),(0,L.jsxs)(`p`,{children:[`Enrolled: `,n.security.mfaEnrolled.toString()]}),(0,L.jsx)(U,{onClick:()=>e(`/mfa`)?.catch(console.error),children:n.security.mfaEnrolled?`Manage MFA`:`Enroll`})]})]}):null}function b1(){let{id:e,secret:t}=UK(),n=zK();return(0,L.jsx)(gI,{id:e,secret:t,onSignIn:()=>n(`/signin`)?.catch(console.error)})}function x1(){let e=Wk(),t=zK(),[n]=hJ(),r=KQ(),i=(0,b.useCallback)(()=>{let e=n.get(`next`);t(e?.startsWith(`/`)?e:`/`)?.catch(console.error)},[n,t]);return(0,b.useEffect)(()=>{e&&n.has(`next`)&&i()},[e,n,i]),(0,L.jsxs)(wI,{onSuccess:()=>i(),onForgotPassword:()=>t(`/resetpassword`)?.catch(console.error),onRegister:qQ()?()=>t(`/register`)?.catch(console.error):void 0,googleClientId:r.googleClientId,login:n.get(`login`)||void 0,projectId:n.get(`project`)||void 0,children:[(0,L.jsx)(RF,{size:32}),n.get(`project`)!==`new`&&(0,L.jsxs)(K,{order:3,py:`lg`,ta:`center`,children:[`Sign in to `,dN()]}),n.get(`project`)===`new`&&(0,L.jsx)(K,{order:3,py:`lg`,ta:`center`,children:`Sign in again to create a new project`})]})}function S1(){let e=zK(),t=LK(),[n,r]=(0,b.useState)(),[i,a]=(0,b.useState)(),[o,s]=(0,b.useState)();return(0,b.useEffect)(()=>{let e=Object.fromEntries(new URLSearchParams(t.search).entries());r(e.resourceType),a(e.query),s(JSON.parse(e.fields))},[t]),!n||!i||!o?null:(0,L.jsx)($B,{resourceType:n,checkboxesEnabled:!0,query:i,fields:o,onClick:t=>e(`/${n}/${t.resource.id}`)?.catch(console.error),onAuxClick:e=>window.open(`/${n}/${e.resource.id}`,`_blank`),onBulk:t=>{e(`/bulk/${n}?ids=${t.join(`,`)}`)?.catch(console.error)}})}function C1(){let{id:e,secret:t}=UK(),n=Z(),[r,i]=(0,b.useState)(),[a,o]=(0,b.useState)(!1),s=VF(r,void 0);return(0,L.jsxs)(LF,{width:450,children:[(0,L.jsx)(oI,{issues:s}),(0,L.jsxs)(NP,{onSubmit:async()=>{i(void 0);try{let r=fS(await n.post(`auth/verifyemail`,{id:e,secret:t}));r?uD.assign(r):o(!0)}catch(e){i(yS(e))}},children:[(0,L.jsxs)(xd,{direction:`column`,align:`center`,justify:`center`,children:[(0,L.jsx)(RF,{size:32}),(0,L.jsx)(K,{children:`Email address verification required`})]}),!a&&(0,L.jsxs)(W,{children:[(0,L.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.`}),(0,L.jsx)(V,{justify:`center`,mt:`xl`,children:(0,L.jsx)(PP,{children:`Verify email`})})]}),a&&(0,L.jsxs)(`div`,{"data-testid":`success`,children:[`Email verified. You can now\xA0`,(0,L.jsx)(eN,{to:`/signin`,children:`sign in`}),`.`]})]})]})}function w1(){return(0,L.jsx)(xq,{children:(0,L.jsxs)($,{errorElement:(0,L.jsx)(TQ,{}),children:[(0,L.jsx)($,{path:`/signin`,element:(0,L.jsx)(x1,{})}),(0,L.jsx)($,{path:`/oauth`,element:(0,L.jsx)(XQ,{})}),(0,L.jsx)($,{path:`/resetpassword`,element:(0,L.jsx)(QQ,{})}),(0,L.jsx)($,{path:`/setpassword/:id/:secret`,element:(0,L.jsx)(b1,{})}),(0,L.jsx)($,{path:`/verifyemail/:id/:secret`,element:(0,L.jsx)(C1,{})}),(0,L.jsx)($,{path:`/register`,element:(0,L.jsx)(ZQ,{})}),(0,L.jsx)($,{path:`/changepassword`,element:(0,L.jsx)(SQ,{})}),(0,L.jsx)($,{path:`/security`,element:(0,L.jsx)(y1,{})}),(0,L.jsx)($,{path:`/mfa`,element:(0,L.jsx)(WQ,{})}),(0,L.jsx)($,{path:`/batch`,element:(0,L.jsx)(bQ,{})}),(0,L.jsx)($,{path:`/bulk/:resourceType`,element:(0,L.jsx)(xQ,{})}),(0,L.jsx)($,{path:`/smart`,element:(0,L.jsx)(S1,{})}),(0,L.jsx)($,{path:`/forms/:id`,element:(0,L.jsx)(DQ,{})}),(0,L.jsx)($,{path:`/admin/super`,element:(0,L.jsx)(vX,{})}),(0,L.jsx)($,{path:`/admin/super/asyncjob/:tab`,element:(0,L.jsx)(iX,{})}),(0,L.jsx)($,{path:`/admin/super/asyncjob`,element:(0,L.jsx)(iX,{})}),(0,L.jsx)($,{path:`/admin/super/db/:tab`,element:(0,L.jsx)(TY,{})}),(0,L.jsx)($,{path:`/admin/super/db`,element:(0,L.jsx)(TY,{})}),(0,L.jsx)($,{path:`/admin/config`,element:(0,L.jsx)(IY,{})}),(0,L.jsxs)($,{path:`/admin`,element:(0,L.jsx)(zY,{}),children:[(0,L.jsx)($,{path:`bots/:membershipId`,element:(0,L.jsx)(MY,{})}),(0,L.jsx)($,{path:`bots/new`,element:(0,L.jsx)(VJ,{})}),(0,L.jsx)($,{path:`bots`,element:(0,L.jsx)(RJ,{})}),(0,L.jsx)($,{path:`clients/:membershipId`,element:(0,L.jsx)(MY,{})}),(0,L.jsx)($,{path:`clients/new`,element:(0,L.jsx)(HJ,{})}),(0,L.jsx)($,{path:`clients`,element:(0,L.jsx)(zJ,{})}),(0,L.jsx)($,{path:`details`,element:(0,L.jsx)(LY,{})}),(0,L.jsx)($,{path:`invite`,element:(0,L.jsx)(EY,{})}),(0,L.jsx)($,{path:`patients`,element:(0,L.jsx)(vq,{to:`/admin/users`,replace:!0})}),(0,L.jsx)($,{path:`users/:membershipId`,element:(0,L.jsx)(MY,{})}),(0,L.jsx)($,{path:`users`,element:(0,L.jsx)(wX,{})}),(0,L.jsx)($,{path:`project`,element:(0,L.jsx)(LY,{})}),(0,L.jsx)($,{path:`secrets`,element:(0,L.jsx)(eX,{})}),(0,L.jsx)($,{path:`settings`,element:(0,L.jsx)(tX,{})}),(0,L.jsx)($,{path:`sites`,element:(0,L.jsx)(nX,{})}),(0,L.jsx)($,{path:`rate-limits`,element:(0,L.jsx)(XY,{})})]}),(0,L.jsx)($,{path:`/lab/assays`,element:(0,L.jsx)(zQ,{})}),(0,L.jsx)($,{path:`/lab/panels`,element:(0,L.jsx)(HQ,{})}),(0,L.jsxs)($,{path:`/:resourceType/new`,element:(0,L.jsx)(wQ,{}),children:[(0,L.jsx)($,{index:!0,element:(0,L.jsx)(E$,{})}),(0,L.jsx)($,{path:`form`,element:(0,L.jsx)(E$,{})}),(0,L.jsx)($,{path:`json`,element:(0,L.jsx)(O$,{})}),(0,L.jsx)($,{path:`profiles`,element:(0,L.jsx)(E$,{})})]}),(0,L.jsxs)($,{path:`/:resourceType/:id`,element:(0,L.jsx)(r1,{}),children:[(0,L.jsx)($,{index:!0,element:(0,L.jsx)(s1,{})}),(0,L.jsx)($,{path:`apply`,element:(0,L.jsx)(t$,{})}),(0,L.jsx)($,{path:`apps`,element:(0,L.jsx)(n$,{})}),(0,L.jsx)($,{path:`event`,element:(0,L.jsx)(i$,{})}),(0,L.jsx)($,{path:`blame`,element:(0,L.jsx)(a$,{})}),(0,L.jsx)($,{path:`bots`,element:(0,L.jsx)(B$,{})}),(0,L.jsx)($,{path:`builder`,element:(0,L.jsx)(g$,{})}),(0,L.jsx)($,{path:`checklist`,element:(0,L.jsx)(_$,{})}),(0,L.jsx)($,{path:`delete`,element:(0,L.jsx)(y$,{})}),(0,L.jsx)($,{path:`details`,element:(0,L.jsx)(x$,{})}),(0,L.jsx)($,{path:`edit`,element:(0,L.jsx)(S$,{})}),(0,L.jsx)($,{path:`editor`,element:(0,L.jsx)(d$,{})}),(0,L.jsxs)($,{path:`history`,children:[(0,L.jsx)($,{index:!0,element:(0,L.jsx)(D$,{})}),(0,L.jsx)($,{path:`:versionId/:tab`,element:(0,L.jsx)(i1,{})}),(0,L.jsx)($,{path:`:versionId`,element:(0,L.jsx)(i1,{})})]}),(0,L.jsxs)($,{path:`_history`,children:[(0,L.jsx)($,{index:!0,element:(0,L.jsx)(D$,{})}),(0,L.jsx)($,{path:`:versionId/:tab`,element:(0,L.jsx)(i1,{})}),(0,L.jsx)($,{path:`:versionId`,element:(0,L.jsx)(i1,{})})]}),(0,L.jsx)($,{path:`json`,element:(0,L.jsx)(k$,{})}),(0,L.jsx)($,{path:`preview`,element:(0,L.jsx)(F$,{})}),(0,L.jsx)($,{path:`responses`,element:(0,L.jsx)(H$,{})}),(0,L.jsx)($,{path:`report`,element:(0,L.jsx)(W$,{})}),(0,L.jsx)($,{path:`ranges`,element:(0,L.jsx)(U$,{})}),(0,L.jsx)($,{path:`subscriptions`,element:(0,L.jsx)(a1,{})}),(0,L.jsx)($,{path:`timeline`,element:(0,L.jsx)(s1,{})}),(0,L.jsx)($,{path:`tools`,element:(0,L.jsx)(h1,{})}),(0,L.jsx)($,{path:`email`,element:(0,L.jsx)(v1,{})}),(0,L.jsx)($,{path:`payload`,element:(0,L.jsx)(v$,{})}),(0,L.jsx)($,{path:`profiles`,element:(0,L.jsx)(I$,{})}),(0,L.jsx)($,{path:`accounts`,element:(0,L.jsx)($Q,{})}),(0,L.jsx)($,{path:`export`,element:(0,L.jsx)(C$,{})})]}),(0,L.jsx)($,{path:`/:resourceType`,element:(0,L.jsx)(RQ,{})}),(0,L.jsx)($,{path:`/`,element:(0,L.jsx)(RQ,{})})]})})}function T1(){let e=Z(),t=e.getUserConfiguration(),n=e.getProject(),r=LK(),[i]=hJ();return e.isLoading()?(0,L.jsx)(GM,{}):(0,L.jsxs)(yF,{logo:(0,L.jsx)(RF,{size:24}),pathname:r.pathname,searchParams:i,version:pO,menus:E1(t),displayAddBookmark:!!t?.id,announcements:n?.superAdmin?[{message:(0,L.jsxs)(L.Fragment,{children:[`Warning: logged in as`,` `,(0,L.jsx)(lJ,{to:`https://www.medplum.com/docs/self-hosting/super-admin-guide`,target:`_blank`,rel:`noopener noreferrer`,children:`Medplum Super Admin`}),`.`]}),color:`red`,icon:(0,L.jsx)(mj,{size:16}),role:`alert`}]:void 0,children:[(0,L.jsx)(xJ,{}),(0,L.jsx)(b.Suspense,{fallback:(0,L.jsx)(GM,{}),children:(0,L.jsx)(w1,{})})]})}function E1(e){let t=e?.menu?.map(e=>({title:e.title,links:e.link?.map(e=>({label:e.name,href:e.target,icon:O1(e.target)}))||[]}))||[];return t.push({title:`Settings`,links:[{label:`Security`,href:`/security`,icon:(0,L.jsx)(oM,{})}]}),t}var D1={Patient:MM,Practitioner:eM,Organization:Dj,ServiceRequest:xM,DiagnosticReport:TM,Questionnaire:$j,Project:Qj,admin:Cj,AccessPolicy:aM,Subscription:VM,batch:mM,Observation:dM};function O1(e){if(e.includes(`admin/super/db`))return(0,L.jsx)(Vj,{});try{let t=new URL(e,`https://app.medplum.com`).pathname.split(`/`)[1];if(t in D1){let e=D1[t];return(0,L.jsx)(e,{})}}catch{}}async function k1(){let e=KQ(),t=new EO({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=mi({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=oJ([{path:`*`,element:(0,L.jsx)(T1,{})}]);(0,DJ.createRoot)(document.getElementById(`root`)).render((0,L.jsx)(b.StrictMode,{children:(0,L.jsx)(Kk,{medplum:t,navigate:e=>r.navigate(e),children:(0,L.jsxs)(Kr,{theme:n,children:[(0,L.jsx)(Nx,{position:`bottom-right`}),(0,L.jsx)(mq,{router:r})]})})}))}k1().catch(console.error);export{o as t};
|
|
246
|
+
//# sourceMappingURL=index-CTTKsohl.js.map
|