From 1252eaaa71e9f5a9314701e51252aa6c545b18d0 Mon Sep 17 00:00:00 2001 From: olimsaidov Date: Mon, 11 Nov 2024 08:24:18 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20Aidbox/e?= =?UTF-8?q?xamples@14aa959a72846c39a37a60b8b444b1a8f53603e3=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{index-BheHAz83.js => index-C1oXZgfU.js} | 108 +++++++++--------- aidbox-forms-smart-launch/index.html | 2 +- 2 files changed, 55 insertions(+), 55 deletions(-) rename aidbox-forms-smart-launch/assets/{index-BheHAz83.js => index-C1oXZgfU.js} (69%) diff --git a/aidbox-forms-smart-launch/assets/index-BheHAz83.js b/aidbox-forms-smart-launch/assets/index-C1oXZgfU.js similarity index 69% rename from aidbox-forms-smart-launch/assets/index-BheHAz83.js rename to aidbox-forms-smart-launch/assets/index-C1oXZgfU.js index 5f4aa5c..e0db0ef 100644 --- a/aidbox-forms-smart-launch/assets/index-BheHAz83.js +++ b/aidbox-forms-smart-launch/assets/index-C1oXZgfU.js @@ -1,4 +1,4 @@ -var dm=e=>{throw TypeError(e)};var sE=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var zc=(e,t,n)=>t.has(e)||dm("Cannot "+n);var _=(e,t,n)=>(zc(e,t,"read from private field"),n?n.call(e):t.get(e)),ne=(e,t,n)=>t.has(e)?dm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),q=(e,t,n,r)=>(zc(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),se=(e,t,n)=>(zc(e,t,"access private method"),n);var nl=(e,t,n,r)=>({set _(o){q(e,t,o,n)},get _(){return _(e,t,r)}});var yL=sE((AL,nu)=>{function Xy(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var Us=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Jy(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function aE(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var Zy={exports:{}},Wu={},e0={exports:{}},ve={};/** +var fm=e=>{throw TypeError(e)};var lE=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var zc=(e,t,n)=>t.has(e)||fm("Cannot "+n);var _=(e,t,n)=>(zc(e,t,"read from private field"),n?n.call(e):t.get(e)),ne=(e,t,n)=>t.has(e)?fm("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),q=(e,t,n,r)=>(zc(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n),se=(e,t,n)=>(zc(e,t,"access private method"),n);var nl=(e,t,n,r)=>({set _(o){q(e,t,o,n)},get _(){return _(e,t,r)}});var SL=lE((NL,nu)=>{function Zy(e,t){for(var n=0;nr[o]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const i of o)if(i.type==="childList")for(const s of i.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(o){const i={};return o.integrity&&(i.integrity=o.integrity),o.referrerPolicy&&(i.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?i.credentials="include":o.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(o){if(o.ep)return;o.ep=!0;const i=n(o);fetch(o.href,i)}})();var Us=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function e0(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function uE(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var t0={exports:{}},Wu={},n0={exports:{}},ve={};/** * @license React * react.production.min.js * @@ -6,7 +6,7 @@ var dm=e=>{throw TypeError(e)};var sE=(e,t)=>()=>(t||e((t={exports:{}}).exports, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ja=Symbol.for("react.element"),lE=Symbol.for("react.portal"),uE=Symbol.for("react.fragment"),cE=Symbol.for("react.strict_mode"),dE=Symbol.for("react.profiler"),fE=Symbol.for("react.provider"),pE=Symbol.for("react.context"),hE=Symbol.for("react.forward_ref"),gE=Symbol.for("react.suspense"),mE=Symbol.for("react.memo"),vE=Symbol.for("react.lazy"),fm=Symbol.iterator;function yE(e){return e===null||typeof e!="object"?null:(e=fm&&e[fm]||e["@@iterator"],typeof e=="function"?e:null)}var t0={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},n0=Object.assign,r0={};function ts(e,t,n){this.props=e,this.context=t,this.refs=r0,this.updater=n||t0}ts.prototype.isReactComponent={};ts.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ts.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function o0(){}o0.prototype=ts.prototype;function Up(e,t,n){this.props=e,this.context=t,this.refs=r0,this.updater=n||t0}var zp=Up.prototype=new o0;zp.constructor=Up;n0(zp,ts.prototype);zp.isPureReactComponent=!0;var pm=Array.isArray,i0=Object.prototype.hasOwnProperty,Bp={current:null},s0={key:!0,ref:!0,__self:!0,__source:!0};function a0(e,t,n){var r,o={},i=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(i=""+t.key),t)i0.call(t,r)&&!s0.hasOwnProperty(r)&&(o[r]=t[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1{throw TypeError(e)};var sE=(e,t)=>()=>(t||e((t={exports:{}}).exports, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var bE=h,RE=Symbol.for("react.element"),EE=Symbol.for("react.fragment"),PE=Object.prototype.hasOwnProperty,_E=bE.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,TE={key:!0,ref:!0,__self:!0,__source:!0};function c0(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)PE.call(t,r)&&!TE.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:RE,type:e,key:i,ref:s,props:o,_owner:_E.current}}Wu.Fragment=EE;Wu.jsx=c0;Wu.jsxs=c0;Zy.exports=Wu;var p=Zy.exports,d0={exports:{}},Wt={},f0={exports:{}},p0={};/** + */var EE=h,PE=Symbol.for("react.element"),_E=Symbol.for("react.fragment"),TE=Object.prototype.hasOwnProperty,AE=EE.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,ME={key:!0,ref:!0,__self:!0,__source:!0};function f0(e,t,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),t.key!==void 0&&(i=""+t.key),t.ref!==void 0&&(s=t.ref);for(r in t)TE.call(t,r)&&!ME.hasOwnProperty(r)&&(o[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps,t)o[r]===void 0&&(o[r]=t[r]);return{$$typeof:PE,type:e,key:i,ref:s,props:o,_owner:AE.current}}Wu.Fragment=_E;Wu.jsx=f0;Wu.jsxs=f0;t0.exports=Wu;var p=t0.exports,p0={exports:{}},Wt={},h0={exports:{}},g0={};/** * @license React * scheduler.production.min.js * @@ -22,7 +22,7 @@ var dm=e=>{throw TypeError(e)};var sE=(e,t)=>()=>(t||e((t={exports:{}}).exports, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(e){function t(L,j){var B=L.length;L.push(j);e:for(;0>>1,te=L[Q];if(0>>1;Qo(z,B))Wo(pe,z)?(L[Q]=pe,L[W]=B,Q=W):(L[Q]=z,L[ge]=B,Q=ge);else if(Wo(pe,B))L[Q]=pe,L[W]=B,Q=W;else break e}}return j}function o(L,j){var B=L.sortIndex-j.sortIndex;return B!==0?B:L.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],u=[],d=1,c=null,f=3,m=!1,v=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(L){for(var j=n(u);j!==null;){if(j.callback===null)r(u);else if(j.startTime<=L)r(u),j.sortIndex=j.expirationTime,t(l,j);else break;j=n(u)}}function C(L){if(y=!1,S(L),!v)if(n(l)!==null)v=!0,D(P);else{var j=n(u);j!==null&&V(C,j.startTime-L)}}function P(L,j){v=!1,y&&(y=!1,w(A),A=-1),m=!0;var B=f;try{for(S(j),c=n(l);c!==null&&(!(c.expirationTime>j)||L&&!O());){var Q=c.callback;if(typeof Q=="function"){c.callback=null,f=c.priorityLevel;var te=Q(c.expirationTime<=j);j=e.unstable_now(),typeof te=="function"?c.callback=te:c===n(l)&&r(l),S(j)}else r(l);c=n(l)}if(c!==null)var fe=!0;else{var ge=n(u);ge!==null&&V(C,ge.startTime-j),fe=!1}return fe}finally{c=null,f=B,m=!1}}var b=!1,M=null,A=-1,$=5,R=-1;function O(){return!(e.unstable_now()-R<$)}function F(){if(M!==null){var L=e.unstable_now();R=L;var j=!0;try{j=M(!0,L)}finally{j?N():(b=!1,M=null)}}else b=!1}var N;if(typeof g=="function")N=function(){g(F)};else if(typeof MessageChannel<"u"){var E=new MessageChannel,T=E.port2;E.port1.onmessage=F,N=function(){T.postMessage(null)}}else N=function(){x(F,0)};function D(L){M=L,b||(b=!0,N())}function V(L,j){A=x(function(){L(e.unstable_now())},j)}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(L){L.callback=null},e.unstable_continueExecution=function(){v||m||(v=!0,D(P))},e.unstable_forceFrameRate=function(L){0>L||125Q?(L.sortIndex=B,t(u,L),n(l)===null&&L===n(u)&&(y?(w(A),A=-1):y=!0,V(C,B-Q))):(L.sortIndex=te,t(l,L),v||m||(v=!0,D(P))),L},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(L){var j=f;return function(){var B=f;f=j;try{return L.apply(this,arguments)}finally{f=B}}}})(p0);f0.exports=p0;var AE=f0.exports;/** + */(function(e){function t(L,j){var B=L.length;L.push(j);e:for(;0>>1,te=L[Q];if(0>>1;Qo(z,B))Wo(pe,z)?(L[Q]=pe,L[W]=B,Q=W):(L[Q]=z,L[ge]=B,Q=ge);else if(Wo(pe,B))L[Q]=pe,L[W]=B,Q=W;else break e}}return j}function o(L,j){var B=L.sortIndex-j.sortIndex;return B!==0?B:L.id-j.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;e.unstable_now=function(){return i.now()}}else{var s=Date,a=s.now();e.unstable_now=function(){return s.now()-a}}var l=[],u=[],d=1,c=null,f=3,m=!1,v=!1,y=!1,x=typeof setTimeout=="function"?setTimeout:null,w=typeof clearTimeout=="function"?clearTimeout:null,g=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function S(L){for(var j=n(u);j!==null;){if(j.callback===null)r(u);else if(j.startTime<=L)r(u),j.sortIndex=j.expirationTime,t(l,j);else break;j=n(u)}}function C(L){if(y=!1,S(L),!v)if(n(l)!==null)v=!0,D(P);else{var j=n(u);j!==null&&V(C,j.startTime-L)}}function P(L,j){v=!1,y&&(y=!1,w(A),A=-1),m=!0;var B=f;try{for(S(j),c=n(l);c!==null&&(!(c.expirationTime>j)||L&&!O());){var Q=c.callback;if(typeof Q=="function"){c.callback=null,f=c.priorityLevel;var te=Q(c.expirationTime<=j);j=e.unstable_now(),typeof te=="function"?c.callback=te:c===n(l)&&r(l),S(j)}else r(l);c=n(l)}if(c!==null)var fe=!0;else{var ge=n(u);ge!==null&&V(C,ge.startTime-j),fe=!1}return fe}finally{c=null,f=B,m=!1}}var b=!1,M=null,A=-1,$=5,R=-1;function O(){return!(e.unstable_now()-R<$)}function F(){if(M!==null){var L=e.unstable_now();R=L;var j=!0;try{j=M(!0,L)}finally{j?N():(b=!1,M=null)}}else b=!1}var N;if(typeof g=="function")N=function(){g(F)};else if(typeof MessageChannel<"u"){var E=new MessageChannel,T=E.port2;E.port1.onmessage=F,N=function(){T.postMessage(null)}}else N=function(){x(F,0)};function D(L){M=L,b||(b=!0,N())}function V(L,j){A=x(function(){L(e.unstable_now())},j)}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(L){L.callback=null},e.unstable_continueExecution=function(){v||m||(v=!0,D(P))},e.unstable_forceFrameRate=function(L){0>L||125Q?(L.sortIndex=B,t(u,L),n(l)===null&&L===n(u)&&(y?(w(A),A=-1):y=!0,V(C,B-Q))):(L.sortIndex=te,t(l,L),v||m||(v=!0,D(P))),L},e.unstable_shouldYield=O,e.unstable_wrapCallback=function(L){var j=f;return function(){var B=f;f=j;try{return L.apply(this,arguments)}finally{f=B}}}})(g0);h0.exports=g0;var kE=h0.exports;/** * @license React * react-dom.production.min.js * @@ -30,14 +30,14 @@ var dm=e=>{throw TypeError(e)};var sE=(e,t)=>()=>(t||e((t={exports:{}}).exports, * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var ME=h,Kt=AE;function K(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wd=Object.prototype.hasOwnProperty,kE=/^[: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]*$/,gm={},mm={};function NE(e){return Wd.call(mm,e)?!0:Wd.call(gm,e)?!1:kE.test(e)?mm[e]=!0:(gm[e]=!0,!1)}function jE(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function OE(e,t,n,r){if(t===null||typeof t>"u"||jE(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ct(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var ut={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ut[e]=new Ct(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ut[t]=new Ct(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ut[e]=new Ct(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ut[e]=new Ct(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ut[e]=new Ct(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ut[e]=new Ct(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ut[e]=new Ct(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ut[e]=new Ct(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ut[e]=new Ct(e,5,!1,e.toLowerCase(),null,!1,!1)});var Hp=/[\-:]([a-z])/g;function Kp(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Hp,Kp);ut[t]=new Ct(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Hp,Kp);ut[t]=new Ct(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Hp,Kp);ut[t]=new Ct(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ut[e]=new Ct(e,1,!1,e.toLowerCase(),null,!1,!1)});ut.xlinkHref=new Ct("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ut[e]=new Ct(e,1,!1,e.toLowerCase(),null,!0,!0)});function Gp(e,t,n,r){var o=ut.hasOwnProperty(t)?ut[t]:null;(o!==null?o.type!==0:r||!(2"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Wd=Object.prototype.hasOwnProperty,jE=/^[: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]*$/,mm={},vm={};function OE(e){return Wd.call(vm,e)?!0:Wd.call(mm,e)?!1:jE.test(e)?vm[e]=!0:(mm[e]=!0,!1)}function DE(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function IE(e,t,n,r){if(t===null||typeof t>"u"||DE(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Ct(e,t,n,r,o,i,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=i,this.removeEmptyString=s}var ut={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ut[e]=new Ct(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ut[t]=new Ct(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ut[e]=new Ct(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ut[e]=new Ct(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ut[e]=new Ct(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ut[e]=new Ct(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ut[e]=new Ct(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ut[e]=new Ct(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ut[e]=new Ct(e,5,!1,e.toLowerCase(),null,!1,!1)});var Kp=/[\-:]([a-z])/g;function Gp(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(Kp,Gp);ut[t]=new Ct(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(Kp,Gp);ut[t]=new Ct(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(Kp,Gp);ut[t]=new Ct(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ut[e]=new Ct(e,1,!1,e.toLowerCase(),null,!1,!1)});ut.xlinkHref=new Ct("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ut[e]=new Ct(e,1,!1,e.toLowerCase(),null,!0,!0)});function Wp(e,t,n,r){var o=ut.hasOwnProperty(t)?ut[t]:null;(o!==null?o.type!==0:r||!(2a||o[s]!==i[a]){var l=` -`+o[s].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{Hc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ns(e):""}function DE(e){switch(e.tag){case 5:return Ns(e.type);case 16:return Ns("Lazy");case 13:return Ns("Suspense");case 19:return Ns("SuspenseList");case 0:case 2:case 15:return e=Kc(e.type,!1),e;case 11:return e=Kc(e.type.render,!1),e;case 1:return e=Kc(e.type,!0),e;default:return""}}function Xd(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ai:return"Fragment";case si:return"Portal";case qd:return"Profiler";case Wp:return"StrictMode";case Qd:return"Suspense";case Yd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case m0:return(e.displayName||"Context")+".Consumer";case g0:return(e._context.displayName||"Context")+".Provider";case qp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Qp:return t=e.displayName||null,t!==null?t:Xd(e.type)||"Memo";case Rr:t=e._payload,e=e._init;try{return Xd(e(t))}catch{}}return null}function IE(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Xd(t);case 8:return t===Wp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Xr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function y0(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function FE(e){var t=y0(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function il(e){e._valueTracker||(e._valueTracker=FE(e))}function w0(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=y0(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ru(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Jd(e,t){var n=t.checked;return Be({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function ym(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Xr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function x0(e,t){t=t.checked,t!=null&&Gp(e,"checked",t,!1)}function Zd(e,t){x0(e,t);var n=Xr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ef(e,t.type,n):t.hasOwnProperty("defaultValue")&&ef(e,t.type,Xr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function wm(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ef(e,t,n){(t!=="number"||ru(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var js=Array.isArray;function yi(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=sl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function na(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var zs={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},LE=["Webkit","ms","Moz","O"];Object.keys(zs).forEach(function(e){LE.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),zs[t]=zs[e]})});function R0(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||zs.hasOwnProperty(e)&&zs[e]?(""+t).trim():t+"px"}function E0(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=R0(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var $E=Be({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function rf(e,t){if(t){if($E[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(K(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(K(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(K(61))}if(t.style!=null&&typeof t.style!="object")throw Error(K(62))}}function of(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var sf=null;function Yp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var af=null,wi=null,xi=null;function Cm(e){if(e=Ia(e)){if(typeof af!="function")throw Error(K(280));var t=e.stateNode;t&&(t=Ju(t),af(e.stateNode,e.type,t))}}function P0(e){wi?xi?xi.push(e):xi=[e]:wi=e}function _0(){if(wi){var e=wi,t=xi;if(xi=wi=null,Cm(e),t)for(e=0;e>>=0,e===0?32:31-(YE(e)/XE|0)|0}var al=64,ll=4194304;function Os(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function au(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=Os(a):(i&=s,i!==0&&(r=Os(i)))}else s=n&~o,s!==0?r=Os(s):i!==0&&(r=Os(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Oa(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-yn(t),e[t]=n}function tP(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Vs),km=" ",Nm=!1;function W0(e,t){switch(e){case"keyup":return AP.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function q0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var li=!1;function kP(e,t){switch(e){case"compositionend":return q0(t);case"keypress":return t.which!==32?null:(Nm=!0,km);case"textInput":return e=t.data,e===km&&Nm?null:e;default:return null}}function NP(e,t){if(li)return e==="compositionend"||!oh&&W0(e,t)?(e=K0(),Ll=th=$r=null,li=!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)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Im(n)}}function J0(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?J0(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Z0(){for(var e=window,t=ru();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ru(e.document)}return t}function ih(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function zP(e){var t=Z0(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&J0(n.ownerDocument.documentElement,n)){if(r!==null&&ih(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=Fm(n,i);var s=Fm(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,ui=null,pf=null,Ks=null,hf=!1;function Lm(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;hf||ui==null||ui!==ru(r)||(r=ui,"selectionStart"in r&&ih(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}),Ks&&la(Ks,r)||(Ks=r,r=cu(pf,"onSelect"),0fi||(e.current=xf[fi],xf[fi]=null,fi--)}function Ne(e,t){fi++,xf[fi]=e.current,e.current=t}var Jr={},gt=io(Jr),Mt=io(!1),Mo=Jr;function Gi(e,t){var n=e.type.contextTypes;if(!n)return Jr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function kt(e){return e=e.childContextTypes,e!=null}function fu(){De(Mt),De(gt)}function Km(e,t,n){if(gt.current!==Jr)throw Error(K(168));Ne(gt,t),Ne(Mt,n)}function lw(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(K(108,IE(e)||"Unknown",o));return Be({},n,r)}function pu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Jr,Mo=gt.current,Ne(gt,e),Ne(Mt,Mt.current),!0}function Gm(e,t,n){var r=e.stateNode;if(!r)throw Error(K(169));n?(e=lw(e,t,Mo),r.__reactInternalMemoizedMergedChildContext=e,De(Mt),De(gt),Ne(gt,e)):De(Mt),Ne(Mt,n)}var Yn=null,Zu=!1,id=!1;function uw(e){Yn===null?Yn=[e]:Yn.push(e)}function ZP(e){Zu=!0,uw(e)}function so(){if(!id&&Yn!==null){id=!0;var e=0,t=Ae;try{var n=Yn;for(Ae=1;e>=s,o-=s,Jn=1<<32-yn(t)+o|n<A?($=M,M=null):$=M.sibling;var R=f(w,M,S[A],C);if(R===null){M===null&&(M=$);break}e&&M&&R.alternate===null&&t(w,M),g=i(R,g,A),b===null?P=R:b.sibling=R,b=R,M=$}if(A===S.length)return n(w,M),Fe&&co(w,A),P;if(M===null){for(;AA?($=M,M=null):$=M.sibling;var O=f(w,M,R.value,C);if(O===null){M===null&&(M=$);break}e&&M&&O.alternate===null&&t(w,M),g=i(O,g,A),b===null?P=O:b.sibling=O,b=O,M=$}if(R.done)return n(w,M),Fe&&co(w,A),P;if(M===null){for(;!R.done;A++,R=S.next())R=c(w,R.value,C),R!==null&&(g=i(R,g,A),b===null?P=R:b.sibling=R,b=R);return Fe&&co(w,A),P}for(M=r(w,M);!R.done;A++,R=S.next())R=m(M,w,A,R.value,C),R!==null&&(e&&R.alternate!==null&&M.delete(R.key===null?A:R.key),g=i(R,g,A),b===null?P=R:b.sibling=R,b=R);return e&&M.forEach(function(F){return t(w,F)}),Fe&&co(w,A),P}function x(w,g,S,C){if(typeof S=="object"&&S!==null&&S.type===ai&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case ol:e:{for(var P=S.key,b=g;b!==null;){if(b.key===P){if(P=S.type,P===ai){if(b.tag===7){n(w,b.sibling),g=o(b,S.props.children),g.return=w,w=g;break e}}else if(b.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Rr&&Qm(P)===b.type){n(w,b.sibling),g=o(b,S.props),g.ref=bs(w,b,S),g.return=w,w=g;break e}n(w,b);break}else t(w,b);b=b.sibling}S.type===ai?(g=Ao(S.props.children,w.mode,C,S.key),g.return=w,w=g):(C=Gl(S.type,S.key,S.props,null,w.mode,C),C.ref=bs(w,g,S),C.return=w,w=C)}return s(w);case si:e:{for(b=S.key;g!==null;){if(g.key===b)if(g.tag===4&&g.stateNode.containerInfo===S.containerInfo&&g.stateNode.implementation===S.implementation){n(w,g.sibling),g=o(g,S.children||[]),g.return=w,w=g;break e}else{n(w,g);break}else t(w,g);g=g.sibling}g=pd(S,w.mode,C),g.return=w,w=g}return s(w);case Rr:return b=S._init,x(w,g,b(S._payload),C)}if(js(S))return v(w,g,S,C);if(ys(S))return y(w,g,S,C);gl(w,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,g!==null&&g.tag===6?(n(w,g.sibling),g=o(g,S),g.return=w,w=g):(n(w,g),g=fd(S,w.mode,C),g.return=w,w=g),s(w)):n(w,g)}return x}var qi=pw(!0),hw=pw(!1),mu=io(null),vu=null,gi=null,uh=null;function ch(){uh=gi=vu=null}function dh(e){var t=mu.current;De(mu),e._currentValue=t}function bf(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ci(e,t){vu=e,uh=gi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(At=!0),e.firstContext=null)}function an(e){var t=e._currentValue;if(uh!==e)if(e={context:e,memoizedValue:t,next:null},gi===null){if(vu===null)throw Error(K(308));gi=e,vu.dependencies={lanes:0,firstContext:e}}else gi=gi.next=e;return t}var yo=null;function fh(e){yo===null?yo=[e]:yo.push(e)}function gw(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,fh(t)):(n.next=o.next,o.next=n),t.interleaved=n,ar(e,r)}function ar(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Er=!1;function ph(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function mw(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function tr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Wr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Re&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,ar(e,n)}return o=r.interleaved,o===null?(t.next=t,fh(r)):(t.next=o.next,o.next=t),r.interleaved=t,ar(e,n)}function Ul(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Jp(e,n)}}function Ym(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function yu(e,t,n,r){var o=e.updateQueue;Er=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,u=l.next;l.next=null,s===null?i=u:s.next=u,s=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==s&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(i!==null){var c=o.baseState;s=0,d=u=l=null,a=i;do{var f=a.lane,m=a.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var v=e,y=a;switch(f=t,m=n,y.tag){case 1:if(v=y.payload,typeof v=="function"){c=v.call(m,c,f);break e}c=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=y.payload,f=typeof v=="function"?v.call(m,c,f):v,f==null)break e;c=Be({},c,f);break e;case 2:Er=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=o.effects,f===null?o.effects=[a]:f.push(a))}else m={eventTime:m,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=m,l=c):d=d.next=m,s|=f;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;f=a,a=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(d===null&&(l=c),o.baseState=l,o.firstBaseUpdate=u,o.lastBaseUpdate=d,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);jo|=s,e.lanes=s,e.memoizedState=c}}function Xm(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ad.transition;ad.transition={};try{e(!1),t()}finally{Ae=n,ad.transition=r}}function jw(){return ln().memoizedState}function r_(e,t,n){var r=Qr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Ow(e))Dw(t,n);else if(n=gw(e,t,n,r),n!==null){var o=xt();wn(n,e,r,o),Iw(n,t,r)}}function o_(e,t,n){var r=Qr(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ow(e))Dw(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Sn(a,s)){var l=t.interleaved;l===null?(o.next=o,fh(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=gw(e,t,o,r),n!==null&&(o=xt(),wn(n,e,r,o),Iw(n,t,r))}}function Ow(e){var t=e.alternate;return e===ze||t!==null&&t===ze}function Dw(e,t){Gs=xu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Iw(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Jp(e,n)}}var Su={readContext:an,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useInsertionEffect:ct,useLayoutEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useMutableSource:ct,useSyncExternalStore:ct,useId:ct,unstable_isNewReconciler:!1},i_={readContext:an,useCallback:function(e,t){return kn().memoizedState=[e,t===void 0?null:t],e},useContext:an,useEffect:Zm,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Bl(4194308,4,Tw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Bl(4,2,e,t)},useMemo:function(e,t){var n=kn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=kn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=r_.bind(null,ze,e),[r.memoizedState,e]},useRef:function(e){var t=kn();return e={current:e},t.memoizedState=e},useState:Jm,useDebugValue:Sh,useDeferredValue:function(e){return kn().memoizedState=e},useTransition:function(){var e=Jm(!1),t=e[0];return e=n_.bind(null,e[1]),kn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ze,o=kn();if(Fe){if(n===void 0)throw Error(K(407));n=n()}else{if(n=t(),ot===null)throw Error(K(349));No&30||xw(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,Zm(Cw.bind(null,r,i,e),[e]),r.flags|=2048,ma(9,Sw.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=kn(),t=ot.identifierPrefix;if(Fe){var n=Zn,r=Jn;n=(r&~(1<<32-yn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ha++,0")&&(l=l.replace("",e.displayName)),l}while(1<=s&&0<=a);break}}}finally{Hc=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ns(e):""}function FE(e){switch(e.tag){case 5:return Ns(e.type);case 16:return Ns("Lazy");case 13:return Ns("Suspense");case 19:return Ns("SuspenseList");case 0:case 2:case 15:return e=Kc(e.type,!1),e;case 11:return e=Kc(e.type.render,!1),e;case 1:return e=Kc(e.type,!0),e;default:return""}}function Xd(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ai:return"Fragment";case si:return"Portal";case qd:return"Profiler";case qp:return"StrictMode";case Qd:return"Suspense";case Yd:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case y0:return(e.displayName||"Context")+".Consumer";case v0:return(e._context.displayName||"Context")+".Provider";case Qp:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Yp:return t=e.displayName||null,t!==null?t:Xd(e.type)||"Memo";case Rr:t=e._payload,e=e._init;try{return Xd(e(t))}catch{}}return null}function LE(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Xd(t);case 8:return t===qp?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Xr(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function x0(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function $E(e){var t=x0(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function il(e){e._valueTracker||(e._valueTracker=$E(e))}function S0(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=x0(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function ru(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Jd(e,t){var n=t.checked;return Be({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function wm(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Xr(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function C0(e,t){t=t.checked,t!=null&&Wp(e,"checked",t,!1)}function Zd(e,t){C0(e,t);var n=Xr(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?ef(e,t.type,n):t.hasOwnProperty("defaultValue")&&ef(e,t.type,Xr(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function xm(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function ef(e,t,n){(t!=="number"||ru(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var js=Array.isArray;function yi(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o"+t.valueOf().toString()+"",t=sl.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function na(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var zs={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},UE=["Webkit","ms","Moz","O"];Object.keys(zs).forEach(function(e){UE.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),zs[t]=zs[e]})});function P0(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||zs.hasOwnProperty(e)&&zs[e]?(""+t).trim():t+"px"}function _0(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=P0(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}var zE=Be({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function rf(e,t){if(t){if(zE[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(K(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(K(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(K(61))}if(t.style!=null&&typeof t.style!="object")throw Error(K(62))}}function of(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var sf=null;function Xp(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var af=null,wi=null,xi=null;function bm(e){if(e=Ia(e)){if(typeof af!="function")throw Error(K(280));var t=e.stateNode;t&&(t=Ju(t),af(e.stateNode,e.type,t))}}function T0(e){wi?xi?xi.push(e):xi=[e]:wi=e}function A0(){if(wi){var e=wi,t=xi;if(xi=wi=null,bm(e),t)for(e=0;e>>=0,e===0?32:31-(JE(e)/ZE|0)|0}var al=64,ll=4194304;function Os(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function au(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,o=e.suspendedLanes,i=e.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=Os(a):(i&=s,i!==0&&(r=Os(i)))}else s=n&~o,s!==0?r=Os(s):i!==0&&(r=Os(i));if(r===0)return 0;if(t!==0&&t!==r&&!(t&o)&&(o=r&-r,i=t&-t,o>=i||o===16&&(i&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Oa(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-yn(t),e[t]=n}function rP(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Vs),Nm=" ",jm=!1;function Q0(e,t){switch(e){case"keyup":return kP.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Y0(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var li=!1;function jP(e,t){switch(e){case"compositionend":return Y0(t);case"keypress":return t.which!==32?null:(jm=!0,Nm);case"textInput":return e=t.data,e===Nm&&jm?null:e;default:return null}}function OP(e,t){if(li)return e==="compositionend"||!ih&&Q0(e,t)?(e=W0(),Ll=nh=$r=null,li=!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)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Fm(n)}}function ew(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ew(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function tw(){for(var e=window,t=ru();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=ru(e.document)}return t}function sh(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function VP(e){var t=tw(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ew(n.ownerDocument.documentElement,n)){if(r!==null&&sh(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!e.extend&&i>r&&(o=r,r=i,i=o),o=Lm(n,i);var s=Lm(n,r);o&&s&&(e.rangeCount!==1||e.anchorNode!==o.node||e.anchorOffset!==o.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(o.node,o.offset),e.removeAllRanges(),i>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,ui=null,pf=null,Ks=null,hf=!1;function $m(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;hf||ui==null||ui!==ru(r)||(r=ui,"selectionStart"in r&&sh(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}),Ks&&la(Ks,r)||(Ks=r,r=cu(pf,"onSelect"),0fi||(e.current=xf[fi],xf[fi]=null,fi--)}function Ne(e,t){fi++,xf[fi]=e.current,e.current=t}var Jr={},gt=io(Jr),Mt=io(!1),Mo=Jr;function Gi(e,t){var n=e.type.contextTypes;if(!n)return Jr;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=t[i];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=o),o}function kt(e){return e=e.childContextTypes,e!=null}function fu(){De(Mt),De(gt)}function Gm(e,t,n){if(gt.current!==Jr)throw Error(K(168));Ne(gt,t),Ne(Mt,n)}function cw(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(K(108,LE(e)||"Unknown",o));return Be({},n,r)}function pu(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Jr,Mo=gt.current,Ne(gt,e),Ne(Mt,Mt.current),!0}function Wm(e,t,n){var r=e.stateNode;if(!r)throw Error(K(169));n?(e=cw(e,t,Mo),r.__reactInternalMemoizedMergedChildContext=e,De(Mt),De(gt),Ne(gt,e)):De(Mt),Ne(Mt,n)}var Yn=null,Zu=!1,id=!1;function dw(e){Yn===null?Yn=[e]:Yn.push(e)}function t_(e){Zu=!0,dw(e)}function so(){if(!id&&Yn!==null){id=!0;var e=0,t=Ae;try{var n=Yn;for(Ae=1;e>=s,o-=s,Jn=1<<32-yn(t)+o|n<A?($=M,M=null):$=M.sibling;var R=f(w,M,S[A],C);if(R===null){M===null&&(M=$);break}e&&M&&R.alternate===null&&t(w,M),g=i(R,g,A),b===null?P=R:b.sibling=R,b=R,M=$}if(A===S.length)return n(w,M),Fe&&co(w,A),P;if(M===null){for(;AA?($=M,M=null):$=M.sibling;var O=f(w,M,R.value,C);if(O===null){M===null&&(M=$);break}e&&M&&O.alternate===null&&t(w,M),g=i(O,g,A),b===null?P=O:b.sibling=O,b=O,M=$}if(R.done)return n(w,M),Fe&&co(w,A),P;if(M===null){for(;!R.done;A++,R=S.next())R=c(w,R.value,C),R!==null&&(g=i(R,g,A),b===null?P=R:b.sibling=R,b=R);return Fe&&co(w,A),P}for(M=r(w,M);!R.done;A++,R=S.next())R=m(M,w,A,R.value,C),R!==null&&(e&&R.alternate!==null&&M.delete(R.key===null?A:R.key),g=i(R,g,A),b===null?P=R:b.sibling=R,b=R);return e&&M.forEach(function(F){return t(w,F)}),Fe&&co(w,A),P}function x(w,g,S,C){if(typeof S=="object"&&S!==null&&S.type===ai&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case ol:e:{for(var P=S.key,b=g;b!==null;){if(b.key===P){if(P=S.type,P===ai){if(b.tag===7){n(w,b.sibling),g=o(b,S.props.children),g.return=w,w=g;break e}}else if(b.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===Rr&&Ym(P)===b.type){n(w,b.sibling),g=o(b,S.props),g.ref=bs(w,b,S),g.return=w,w=g;break e}n(w,b);break}else t(w,b);b=b.sibling}S.type===ai?(g=Ao(S.props.children,w.mode,C,S.key),g.return=w,w=g):(C=Gl(S.type,S.key,S.props,null,w.mode,C),C.ref=bs(w,g,S),C.return=w,w=C)}return s(w);case si:e:{for(b=S.key;g!==null;){if(g.key===b)if(g.tag===4&&g.stateNode.containerInfo===S.containerInfo&&g.stateNode.implementation===S.implementation){n(w,g.sibling),g=o(g,S.children||[]),g.return=w,w=g;break e}else{n(w,g);break}else t(w,g);g=g.sibling}g=pd(S,w.mode,C),g.return=w,w=g}return s(w);case Rr:return b=S._init,x(w,g,b(S._payload),C)}if(js(S))return v(w,g,S,C);if(ys(S))return y(w,g,S,C);gl(w,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,g!==null&&g.tag===6?(n(w,g.sibling),g=o(g,S),g.return=w,w=g):(n(w,g),g=fd(S,w.mode,C),g.return=w,w=g),s(w)):n(w,g)}return x}var qi=gw(!0),mw=gw(!1),mu=io(null),vu=null,gi=null,ch=null;function dh(){ch=gi=vu=null}function fh(e){var t=mu.current;De(mu),e._currentValue=t}function bf(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function Ci(e,t){vu=e,ch=gi=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(At=!0),e.firstContext=null)}function an(e){var t=e._currentValue;if(ch!==e)if(e={context:e,memoizedValue:t,next:null},gi===null){if(vu===null)throw Error(K(308));gi=e,vu.dependencies={lanes:0,firstContext:e}}else gi=gi.next=e;return t}var yo=null;function ph(e){yo===null?yo=[e]:yo.push(e)}function vw(e,t,n,r){var o=t.interleaved;return o===null?(n.next=n,ph(t)):(n.next=o.next,o.next=n),t.interleaved=n,ar(e,r)}function ar(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var Er=!1;function hh(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function yw(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function tr(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function Wr(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Re&2){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,ar(e,n)}return o=r.interleaved,o===null?(t.next=t,ph(r)):(t.next=o.next,o.next=t),r.interleaved=t,ar(e,n)}function Ul(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zp(e,n)}}function Xm(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=t:i=i.next=t}else o=i=t;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function yu(e,t,n,r){var o=e.updateQueue;Er=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,a=o.shared.pending;if(a!==null){o.shared.pending=null;var l=a,u=l.next;l.next=null,s===null?i=u:s.next=u,s=l;var d=e.alternate;d!==null&&(d=d.updateQueue,a=d.lastBaseUpdate,a!==s&&(a===null?d.firstBaseUpdate=u:a.next=u,d.lastBaseUpdate=l))}if(i!==null){var c=o.baseState;s=0,d=u=l=null,a=i;do{var f=a.lane,m=a.eventTime;if((r&f)===f){d!==null&&(d=d.next={eventTime:m,lane:0,tag:a.tag,payload:a.payload,callback:a.callback,next:null});e:{var v=e,y=a;switch(f=t,m=n,y.tag){case 1:if(v=y.payload,typeof v=="function"){c=v.call(m,c,f);break e}c=v;break e;case 3:v.flags=v.flags&-65537|128;case 0:if(v=y.payload,f=typeof v=="function"?v.call(m,c,f):v,f==null)break e;c=Be({},c,f);break e;case 2:Er=!0}}a.callback!==null&&a.lane!==0&&(e.flags|=64,f=o.effects,f===null?o.effects=[a]:f.push(a))}else m={eventTime:m,lane:f,tag:a.tag,payload:a.payload,callback:a.callback,next:null},d===null?(u=d=m,l=c):d=d.next=m,s|=f;if(a=a.next,a===null){if(a=o.shared.pending,a===null)break;f=a,a=f.next,f.next=null,o.lastBaseUpdate=f,o.shared.pending=null}}while(!0);if(d===null&&(l=c),o.baseState=l,o.firstBaseUpdate=u,o.lastBaseUpdate=d,t=o.shared.interleaved,t!==null){o=t;do s|=o.lane,o=o.next;while(o!==t)}else i===null&&(o.shared.lanes=0);jo|=s,e.lanes=s,e.memoizedState=c}}function Jm(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=ad.transition;ad.transition={};try{e(!1),t()}finally{Ae=n,ad.transition=r}}function Dw(){return ln().memoizedState}function i_(e,t,n){var r=Qr(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Iw(e))Fw(t,n);else if(n=vw(e,t,n,r),n!==null){var o=xt();wn(n,e,r,o),Lw(n,t,r)}}function s_(e,t,n){var r=Qr(e),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Iw(e))Fw(t,o);else{var i=e.alternate;if(e.lanes===0&&(i===null||i.lanes===0)&&(i=t.lastRenderedReducer,i!==null))try{var s=t.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Sn(a,s)){var l=t.interleaved;l===null?(o.next=o,ph(t)):(o.next=l.next,l.next=o),t.interleaved=o;return}}catch{}finally{}n=vw(e,t,o,r),n!==null&&(o=xt(),wn(n,e,r,o),Lw(n,t,r))}}function Iw(e){var t=e.alternate;return e===ze||t!==null&&t===ze}function Fw(e,t){Gs=xu=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Lw(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Zp(e,n)}}var Su={readContext:an,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useInsertionEffect:ct,useLayoutEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useMutableSource:ct,useSyncExternalStore:ct,useId:ct,unstable_isNewReconciler:!1},a_={readContext:an,useCallback:function(e,t){return kn().memoizedState=[e,t===void 0?null:t],e},useContext:an,useEffect:ev,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Bl(4194308,4,Mw.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Bl(4194308,4,e,t)},useInsertionEffect:function(e,t){return Bl(4,2,e,t)},useMemo:function(e,t){var n=kn();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=kn();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=i_.bind(null,ze,e),[r.memoizedState,e]},useRef:function(e){var t=kn();return e={current:e},t.memoizedState=e},useState:Zm,useDebugValue:Ch,useDeferredValue:function(e){return kn().memoizedState=e},useTransition:function(){var e=Zm(!1),t=e[0];return e=o_.bind(null,e[1]),kn().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=ze,o=kn();if(Fe){if(n===void 0)throw Error(K(407));n=n()}else{if(n=t(),ot===null)throw Error(K(349));No&30||Cw(r,t,n)}o.memoizedState=n;var i={value:n,getSnapshot:t};return o.queue=i,ev(Rw.bind(null,r,i,e),[e]),r.flags|=2048,ma(9,bw.bind(null,r,i,n,t),void 0,null),n},useId:function(){var e=kn(),t=ot.identifierPrefix;if(Fe){var n=Zn,r=Jn;n=(r&~(1<<32-yn(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=ha++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[In]=t,e[da]=r,Gw(e,t,!1,!1),t.stateNode=e;e:{switch(s=of(n,r),n){case"dialog":Oe("cancel",e),Oe("close",e),o=r;break;case"iframe":case"object":case"embed":Oe("load",e),o=r;break;case"video":case"audio":for(o=0;oXi&&(t.flags|=128,r=!0,Rs(i,!1),t.lanes=4194304)}else{if(!r)if(e=wu(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Fe)return dt(t),null}else 2*Qe()-i.renderingStartTime>Xi&&n!==1073741824&&(t.flags|=128,r=!0,Rs(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Qe(),t.sibling=null,n=Ue.current,Ne(Ue,r?n&1|2:n&1),t):(dt(t),null);case 22:case 23:return _h(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Lt&1073741824&&(dt(t),t.subtreeFlags&6&&(t.flags|=8192)):dt(t),null;case 24:return null;case 25:return null}throw Error(K(156,t.tag))}function p_(e,t){switch(ah(t),t.tag){case 1:return kt(t.type)&&fu(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qi(),De(Mt),De(gt),mh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return gh(t),null;case 13:if(De(Ue),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(K(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return De(Ue),null;case 4:return Qi(),null;case 10:return dh(t.type._context),null;case 22:case 23:return _h(),null;case 24:return null;default:return null}}var vl=!1,ht=!1,h_=typeof WeakSet=="function"?WeakSet:Set,Y=null;function mi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){We(e,t,r)}else n.current=null}function Nf(e,t,n){try{n()}catch(r){We(e,t,r)}}var cv=!1;function g_(e,t){if(gf=lu,e=Z0(),ih(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,d=0,c=e,f=null;t:for(;;){for(var m;c!==n||o!==0&&c.nodeType!==3||(a=s+o),c!==i||r!==0&&c.nodeType!==3||(l=s+r),c.nodeType===3&&(s+=c.nodeValue.length),(m=c.firstChild)!==null;)f=c,c=m;for(;;){if(c===e)break t;if(f===n&&++u===o&&(a=s),f===i&&++d===r&&(l=s),(m=c.nextSibling)!==null)break;c=f,f=c.parentNode}c=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(mf={focusedElem:e,selectionRange:n},lu=!1,Y=t;Y!==null;)if(t=Y,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Y=e;else for(;Y!==null;){t=Y;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var y=v.memoizedProps,x=v.memoizedState,w=t.stateNode,g=w.getSnapshotBeforeUpdate(t.elementType===t.type?y:fn(t.type,y),x);w.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(K(163))}}catch(C){We(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,Y=e;break}Y=t.return}return v=cv,cv=!1,v}function Ws(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Nf(t,n,i)}o=o.next}while(o!==r)}}function nc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function jf(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Qw(e){var t=e.alternate;t!==null&&(e.alternate=null,Qw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[In],delete t[da],delete t[wf],delete t[XP],delete t[JP])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Yw(e){return e.tag===5||e.tag===3||e.tag===4}function dv(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Yw(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Of(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=du));else if(r!==4&&(e=e.child,e!==null))for(Of(e,t,n),e=e.sibling;e!==null;)Of(e,t,n),e=e.sibling}function Df(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Df(e,t,n),e=e.sibling;e!==null;)Df(e,t,n),e=e.sibling}var at=null,hn=!1;function vr(e,t,n){for(n=n.child;n!==null;)Xw(e,t,n),n=n.sibling}function Xw(e,t,n){if(Ln&&typeof Ln.onCommitFiberUnmount=="function")try{Ln.onCommitFiberUnmount(qu,n)}catch{}switch(n.tag){case 5:ht||mi(n,t);case 6:var r=at,o=hn;at=null,vr(e,t,n),at=r,hn=o,at!==null&&(hn?(e=at,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):at.removeChild(n.stateNode));break;case 18:at!==null&&(hn?(e=at,n=n.stateNode,e.nodeType===8?od(e.parentNode,n):e.nodeType===1&&od(e,n),sa(e)):od(at,n.stateNode));break;case 4:r=at,o=hn,at=n.stateNode.containerInfo,hn=!0,vr(e,t,n),at=r,hn=o;break;case 0:case 11:case 14:case 15:if(!ht&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Nf(n,t,s),o=o.next}while(o!==r)}vr(e,t,n);break;case 1:if(!ht&&(mi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){We(n,t,a)}vr(e,t,n);break;case 21:vr(e,t,n);break;case 22:n.mode&1?(ht=(r=ht)||n.memoizedState!==null,vr(e,t,n),ht=r):vr(e,t,n);break;default:vr(e,t,n)}}function fv(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new h_),t.forEach(function(r){var o=R_.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function dn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=s),r&=~i}if(r=o,r=Qe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*v_(r/1960))-r,10e?16:e,Ur===null)var r=!1;else{if(e=Ur,Ur=null,Ru=0,Re&6)throw Error(K(331));var o=Re;for(Re|=4,Y=e.current;Y!==null;){var i=Y,s=i.child;if(Y.flags&16){var a=i.deletions;if(a!==null){for(var l=0;lQe()-Eh?To(e,0):Rh|=n),Nt(e,t)}function ix(e,t){t===0&&(e.mode&1?(t=ll,ll<<=1,!(ll&130023424)&&(ll=4194304)):t=1);var n=xt();e=ar(e,t),e!==null&&(Oa(e,t,n),Nt(e,n))}function b_(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ix(e,n)}function R_(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(K(314))}r!==null&&r.delete(t),ix(e,n)}var sx;sx=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Mt.current)At=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return At=!1,d_(e,t,n);At=!!(e.flags&131072)}else At=!1,Fe&&t.flags&1048576&&cw(t,gu,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Vl(e,t),e=t.pendingProps;var o=Gi(t,gt.current);Ci(t,n),o=yh(null,t,r,e,o,n);var i=wh();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,kt(r)?(i=!0,pu(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,ph(t),o.updater=tc,t.stateNode=o,o._reactInternals=t,Ef(t,r,e,n),t=Tf(null,t,r,!0,i,n)):(t.tag=0,Fe&&i&&sh(t),wt(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Vl(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=P_(r),e=fn(r,e),o){case 0:t=_f(null,t,r,e,n);break e;case 1:t=av(null,t,r,e,n);break e;case 11:t=iv(null,t,r,e,n);break e;case 14:t=sv(null,t,r,fn(r.type,e),n);break e}throw Error(K(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:fn(r,o),_f(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:fn(r,o),av(e,t,r,o,n);case 3:e:{if(Vw(t),e===null)throw Error(K(387));r=t.pendingProps,i=t.memoizedState,o=i.element,mw(e,t),yu(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Yi(Error(K(423)),t),t=lv(e,t,r,n,o);break e}else if(r!==o){o=Yi(Error(K(424)),t),t=lv(e,t,r,n,o);break e}else for(Bt=Gr(t.stateNode.containerInfo.firstChild),Vt=t,Fe=!0,mn=null,n=hw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Wi(),r===o){t=lr(e,t,n);break e}wt(e,t,r,n)}t=t.child}return t;case 5:return vw(t),e===null&&Cf(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,vf(r,o)?s=null:i!==null&&vf(r,i)&&(t.flags|=32),Bw(e,t),wt(e,t,s,n),t.child;case 6:return e===null&&Cf(t),null;case 13:return Hw(e,t,n);case 4:return hh(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=qi(t,null,r,n):wt(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:fn(r,o),iv(e,t,r,o,n);case 7:return wt(e,t,t.pendingProps,n),t.child;case 8:return wt(e,t,t.pendingProps.children,n),t.child;case 12:return wt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,Ne(mu,r._currentValue),r._currentValue=s,i!==null)if(Sn(i.value,s)){if(i.children===o.children&&!Mt.current){t=lr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=tr(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),bf(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(K(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),bf(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}wt(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Ci(t,n),o=an(o),r=r(o),t.flags|=1,wt(e,t,r,n),t.child;case 14:return r=t.type,o=fn(r,t.pendingProps),o=fn(r.type,o),sv(e,t,r,o,n);case 15:return Uw(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:fn(r,o),Vl(e,t),t.tag=1,kt(r)?(e=!0,pu(t)):e=!1,Ci(t,n),Fw(t,r,o),Ef(t,r,o,n),Tf(null,t,r,!0,e,n);case 19:return Kw(e,t,n);case 22:return zw(e,t,n)}throw Error(K(156,t.tag))};function ax(e,t){return O0(e,t)}function E_(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nn(e,t,n,r){return new E_(e,t,n,r)}function Ah(e){return e=e.prototype,!(!e||!e.isReactComponent)}function P_(e){if(typeof e=="function")return Ah(e)?1:0;if(e!=null){if(e=e.$$typeof,e===qp)return 11;if(e===Qp)return 14}return 2}function Yr(e,t){var n=e.alternate;return n===null?(n=nn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Gl(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")Ah(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case ai:return Ao(n.children,o,i,t);case Wp:s=8,o|=8;break;case qd:return e=nn(12,n,t,o|2),e.elementType=qd,e.lanes=i,e;case Qd:return e=nn(13,n,t,o),e.elementType=Qd,e.lanes=i,e;case Yd:return e=nn(19,n,t,o),e.elementType=Yd,e.lanes=i,e;case v0:return oc(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case g0:s=10;break e;case m0:s=9;break e;case qp:s=11;break e;case Qp:s=14;break e;case Rr:s=16,r=null;break e}throw Error(K(130,e==null?e:typeof e,""))}return t=nn(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Ao(e,t,n,r){return e=nn(7,e,r,t),e.lanes=n,e}function oc(e,t,n,r){return e=nn(22,e,r,t),e.elementType=v0,e.lanes=n,e.stateNode={isHidden:!1},e}function fd(e,t,n){return e=nn(6,e,null,t),e.lanes=n,e}function pd(e,t,n){return t=nn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function __(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wc(0),this.expirationTimes=Wc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wc(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function Mh(e,t,n,r,o,i,s,a,l){return e=new __(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=nn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ph(i),e}function T_(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(dx)}catch(e){console.error(e)}}dx(),d0.exports=Wt;var os=d0.exports;const fx=Jy(os),j_=Xy({__proto__:null,default:fx},[os]);var px,xv=os;px=xv.createRoot,xv.hydrateRoot;/** +`+i.stack}return{value:e,source:t,stack:o,digest:null}}function cd(e,t,n){return{value:e,source:null,stack:n??null,digest:t??null}}function Pf(e,t){try{console.error(t.value)}catch(n){setTimeout(function(){throw n})}}var c_=typeof WeakMap=="function"?WeakMap:Map;function Uw(e,t,n){n=tr(-1,n),n.tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){bu||(bu=!0,If=r),Pf(e,t)},n}function zw(e,t,n){n=tr(-1,n),n.tag=3;var r=e.type.getDerivedStateFromError;if(typeof r=="function"){var o=t.value;n.payload=function(){return r(o)},n.callback=function(){Pf(e,t)}}var i=e.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Pf(e,t),typeof r!="function"&&(qr===null?qr=new Set([this]):qr.add(this));var s=t.stack;this.componentDidCatch(t.value,{componentStack:s!==null?s:""})}),n}function rv(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new c_;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(n)||(o.add(n),e=R_.bind(null,e,t,n),t.then(e,e))}function ov(e){do{var t;if((t=e.tag===13)&&(t=e.memoizedState,t=t!==null?t.dehydrated!==null:!0),t)return e;e=e.return}while(e!==null);return null}function iv(e,t,n,r,o){return e.mode&1?(e.flags|=65536,e.lanes=o,e):(e===t?e.flags|=65536:(e.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(t=tr(-1,1),t.tag=2,Wr(n,t,1))),n.lanes|=1),e)}var d_=dr.ReactCurrentOwner,At=!1;function wt(e,t,n,r){t.child=e===null?mw(t,null,n,r):qi(t,e.child,n,r)}function sv(e,t,n,r,o){n=n.render;var i=t.ref;return Ci(t,o),r=wh(e,t,n,r,i,o),n=xh(),e!==null&&!At?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,lr(e,t,o)):(Fe&&n&&ah(t),t.flags|=1,wt(e,t,r,o),t.child)}function av(e,t,n,r,o){if(e===null){var i=n.type;return typeof i=="function"&&!Mh(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(t.tag=15,t.type=i,Bw(e,t,i,r,o)):(e=Gl(n.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(i=e.child,!(e.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:la,n(s,r)&&e.ref===t.ref)return lr(e,t,o)}return t.flags|=1,e=Yr(i,r),e.ref=t.ref,e.return=t,t.child=e}function Bw(e,t,n,r,o){if(e!==null){var i=e.memoizedProps;if(la(i,r)&&e.ref===t.ref)if(At=!1,t.pendingProps=r=i,(e.lanes&o)!==0)e.flags&131072&&(At=!0);else return t.lanes=e.lanes,lr(e,t,o)}return _f(e,t,n,r,o)}function Vw(e,t,n){var r=t.pendingProps,o=r.children,i=e!==null?e.memoizedState:null;if(r.mode==="hidden")if(!(t.mode&1))t.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ne(vi,Lt),Lt|=n;else{if(!(n&1073741824))return e=i!==null?i.baseLanes|n:n,t.lanes=t.childLanes=1073741824,t.memoizedState={baseLanes:e,cachePool:null,transitions:null},t.updateQueue=null,Ne(vi,Lt),Lt|=e,null;t.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ne(vi,Lt),Lt|=r}else i!==null?(r=i.baseLanes|n,t.memoizedState=null):r=n,Ne(vi,Lt),Lt|=r;return wt(e,t,o,n),t.child}function Hw(e,t){var n=t.ref;(e===null&&n!==null||e!==null&&e.ref!==n)&&(t.flags|=512,t.flags|=2097152)}function _f(e,t,n,r,o){var i=kt(n)?Mo:gt.current;return i=Gi(t,i),Ci(t,o),n=wh(e,t,n,r,i,o),r=xh(),e!==null&&!At?(t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~o,lr(e,t,o)):(Fe&&r&&ah(t),t.flags|=1,wt(e,t,n,o),t.child)}function lv(e,t,n,r,o){if(kt(n)){var i=!0;pu(t)}else i=!1;if(Ci(t,o),t.stateNode===null)Vl(e,t),$w(t,n,r),Ef(t,n,r,o),r=!0;else if(e===null){var s=t.stateNode,a=t.memoizedProps;s.props=a;var l=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=an(u):(u=kt(n)?Mo:gt.current,u=Gi(t,u));var d=n.getDerivedStateFromProps,c=typeof d=="function"||typeof s.getSnapshotBeforeUpdate=="function";c||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==u)&&nv(t,s,r,u),Er=!1;var f=t.memoizedState;s.state=f,yu(t,r,s,o),l=t.memoizedState,a!==r||f!==l||Mt.current||Er?(typeof d=="function"&&(Rf(t,n,d,r),l=t.memoizedState),(a=Er||tv(t,n,a,r,f,l,u))?(c||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(t.flags|=4194308)):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),s.props=r,s.state=l,s.context=u,r=a):(typeof s.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{s=t.stateNode,yw(e,t),a=t.memoizedProps,u=t.type===t.elementType?a:fn(t.type,a),s.props=u,c=t.pendingProps,f=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=an(l):(l=kt(n)?Mo:gt.current,l=Gi(t,l));var m=n.getDerivedStateFromProps;(d=typeof m=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==c||f!==l)&&nv(t,s,r,l),Er=!1,f=t.memoizedState,s.state=f,yu(t,r,s,o);var v=t.memoizedState;a!==c||f!==v||Mt.current||Er?(typeof m=="function"&&(Rf(t,n,m,r),v=t.memoizedState),(u=Er||tv(t,n,u,r,f,v,l)||!1)?(d||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,v,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,v,l)),typeof s.componentDidUpdate=="function"&&(t.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=v),s.props=r,s.state=v,s.context=l,r=u):(typeof s.componentDidUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return Tf(e,t,n,r,i,o)}function Tf(e,t,n,r,o,i){Hw(e,t);var s=(t.flags&128)!==0;if(!r&&!s)return o&&Wm(t,n,!1),lr(e,t,i);r=t.stateNode,d_.current=t;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return t.flags|=1,e!==null&&s?(t.child=qi(t,e.child,null,i),t.child=qi(t,null,a,i)):wt(e,t,a,i),t.memoizedState=r.state,o&&Wm(t,n,!0),t.child}function Kw(e){var t=e.stateNode;t.pendingContext?Gm(e,t.pendingContext,t.pendingContext!==t.context):t.context&&Gm(e,t.context,!1),gh(e,t.containerInfo)}function uv(e,t,n,r,o){return Wi(),uh(o),t.flags|=256,wt(e,t,n,r),t.child}var Af={dehydrated:null,treeContext:null,retryLane:0};function Mf(e){return{baseLanes:e,cachePool:null,transitions:null}}function Gw(e,t,n){var r=t.pendingProps,o=Ue.current,i=!1,s=(t.flags&128)!==0,a;if((a=s)||(a=e!==null&&e.memoizedState===null?!1:(o&2)!==0),a?(i=!0,t.flags&=-129):(e===null||e.memoizedState!==null)&&(o|=1),Ne(Ue,o&1),e===null)return Cf(t),e=t.memoizedState,e!==null&&(e=e.dehydrated,e!==null)?(t.mode&1?e.data==="$!"?t.lanes=8:t.lanes=1073741824:t.lanes=1,null):(s=r.children,e=r.fallback,i?(r=t.mode,i=t.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=oc(s,r,0,null),e=Ao(e,r,n,null),i.return=t,e.return=t,i.sibling=e,t.child=i,t.child.memoizedState=Mf(n),t.memoizedState=Af,e):bh(t,s));if(o=e.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return f_(e,t,s,r,a,o,n);if(i){i=r.fallback,s=t.mode,o=e.child,a=o.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&t.child!==o?(r=t.child,r.childLanes=0,r.pendingProps=l,t.deletions=null):(r=Yr(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=Yr(a,i):(i=Ao(i,s,n,null),i.flags|=2),i.return=t,r.return=t,r.sibling=i,t.child=r,r=i,i=t.child,s=e.child.memoizedState,s=s===null?Mf(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=e.childLanes&~n,t.memoizedState=Af,r}return i=e.child,e=i.sibling,r=Yr(i,{mode:"visible",children:r.children}),!(t.mode&1)&&(r.lanes=n),r.return=t,r.sibling=null,e!==null&&(n=t.deletions,n===null?(t.deletions=[e],t.flags|=16):n.push(e)),t.child=r,t.memoizedState=null,r}function bh(e,t){return t=oc({mode:"visible",children:t},e.mode,0,null),t.return=e,e.child=t}function ml(e,t,n,r){return r!==null&&uh(r),qi(t,e.child,null,n),e=bh(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function f_(e,t,n,r,o,i,s){if(n)return t.flags&256?(t.flags&=-257,r=cd(Error(K(422))),ml(e,t,s,r)):t.memoizedState!==null?(t.child=e.child,t.flags|=128,null):(i=r.fallback,o=t.mode,r=oc({mode:"visible",children:r.children},o,0,null),i=Ao(i,o,s,null),i.flags|=2,r.return=t,i.return=t,r.sibling=i,t.child=r,t.mode&1&&qi(t,e.child,null,s),t.child.memoizedState=Mf(s),t.memoizedState=Af,i);if(!(t.mode&1))return ml(e,t,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error(K(419)),r=cd(i,r,void 0),ml(e,t,s,r)}if(a=(s&e.childLanes)!==0,At||a){if(r=ot,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,ar(e,o),wn(r,e,o,-1))}return Ah(),r=cd(Error(K(421))),ml(e,t,s,r)}return o.data==="$?"?(t.flags|=128,t.child=e.child,t=E_.bind(null,e),o._reactRetry=t,null):(e=i.treeContext,Bt=Gr(o.nextSibling),Vt=t,Fe=!0,mn=null,e!==null&&(Zt[en++]=Jn,Zt[en++]=Zn,Zt[en++]=ko,Jn=e.id,Zn=e.overflow,ko=t),t=bh(t,r.children),t.flags|=4096,t)}function cv(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),bf(e.return,t,n)}function dd(e,t,n,r,o){var i=e.memoizedState;i===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=t,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function Ww(e,t,n){var r=t.pendingProps,o=r.revealOrder,i=r.tail;if(wt(e,t,r.children,n),r=Ue.current,r&2)r=r&1|2,t.flags|=128;else{if(e!==null&&e.flags&128)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&cv(e,n,t);else if(e.tag===19)cv(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}r&=1}if(Ne(Ue,r),!(t.mode&1))t.memoizedState=null;else switch(o){case"forwards":for(n=t.child,o=null;n!==null;)e=n.alternate,e!==null&&wu(e)===null&&(o=n),n=n.sibling;n=o,n===null?(o=t.child,t.child=null):(o=n.sibling,n.sibling=null),dd(t,!1,o,n,i);break;case"backwards":for(n=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&wu(e)===null){t.child=o;break}e=o.sibling,o.sibling=n,n=o,o=e}dd(t,!0,n,null,i);break;case"together":dd(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Vl(e,t){!(t.mode&1)&&e!==null&&(e.alternate=null,t.alternate=null,t.flags|=2)}function lr(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),jo|=t.lanes,!(n&t.childLanes))return null;if(e!==null&&t.child!==e.child)throw Error(K(153));if(t.child!==null){for(e=t.child,n=Yr(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=Yr(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function p_(e,t,n){switch(t.tag){case 3:Kw(t),Wi();break;case 5:ww(t);break;case 1:kt(t.type)&&pu(t);break;case 4:gh(t,t.stateNode.containerInfo);break;case 10:var r=t.type._context,o=t.memoizedProps.value;Ne(mu,r._currentValue),r._currentValue=o;break;case 13:if(r=t.memoizedState,r!==null)return r.dehydrated!==null?(Ne(Ue,Ue.current&1),t.flags|=128,null):n&t.child.childLanes?Gw(e,t,n):(Ne(Ue,Ue.current&1),e=lr(e,t,n),e!==null?e.sibling:null);Ne(Ue,Ue.current&1);break;case 19:if(r=(n&t.childLanes)!==0,e.flags&128){if(r)return Ww(e,t,n);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Ne(Ue,Ue.current),r)break;return null;case 22:case 23:return t.lanes=0,Vw(e,t,n)}return lr(e,t,n)}var qw,kf,Qw,Yw;qw=function(e,t){for(var n=t.child;n!==null;){if(n.tag===5||n.tag===6)e.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};kf=function(){};Qw=function(e,t,n,r){var o=e.memoizedProps;if(o!==r){e=t.stateNode,wo($n.current);var i=null;switch(n){case"input":o=Jd(e,o),r=Jd(e,r),i=[];break;case"select":o=Be({},o,{value:void 0}),r=Be({},r,{value:void 0}),i=[];break;case"textarea":o=tf(e,o),r=tf(e,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(e.onclick=du)}rf(n,r);var s;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var a=o[u];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(ta.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var l=r[u];if(a=o!=null?o[u]:void 0,r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(i||(i=[]),i.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(ta.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&Oe("scroll",e),i||a===l||(i=[])):(i=i||[]).push(u,l))}n&&(i=i||[]).push("style",n);var u=i;(t.updateQueue=u)&&(t.flags|=4)}};Yw=function(e,t,n,r){n!==r&&(t.flags|=4)};function Rs(e,t){if(!Fe)switch(e.tailMode){case"hidden":t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case"collapsed":n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function dt(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function h_(e,t,n){var r=t.pendingProps;switch(lh(t),t.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return dt(t),null;case 1:return kt(t.type)&&fu(),dt(t),null;case 3:return r=t.stateNode,Qi(),De(Mt),De(gt),vh(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(e===null||e.child===null)&&(hl(t)?t.flags|=4:e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,mn!==null&&($f(mn),mn=null))),kf(e,t),dt(t),null;case 5:mh(t);var o=wo(pa.current);if(n=t.type,e!==null&&t.stateNode!=null)Qw(e,t,n,r,o),e.ref!==t.ref&&(t.flags|=512,t.flags|=2097152);else{if(!r){if(t.stateNode===null)throw Error(K(166));return dt(t),null}if(e=wo($n.current),hl(t)){r=t.stateNode,n=t.type;var i=t.memoizedProps;switch(r[In]=t,r[da]=i,e=(t.mode&1)!==0,n){case"dialog":Oe("cancel",r),Oe("close",r);break;case"iframe":case"object":case"embed":Oe("load",r);break;case"video":case"audio":for(o=0;o<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[In]=t,e[da]=r,qw(e,t,!1,!1),t.stateNode=e;e:{switch(s=of(n,r),n){case"dialog":Oe("cancel",e),Oe("close",e),o=r;break;case"iframe":case"object":case"embed":Oe("load",e),o=r;break;case"video":case"audio":for(o=0;oXi&&(t.flags|=128,r=!0,Rs(i,!1),t.lanes=4194304)}else{if(!r)if(e=wu(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Rs(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!Fe)return dt(t),null}else 2*Qe()-i.renderingStartTime>Xi&&n!==1073741824&&(t.flags|=128,r=!0,Rs(i,!1),t.lanes=4194304);i.isBackwards?(s.sibling=t.child,t.child=s):(n=i.last,n!==null?n.sibling=s:t.child=s,i.last=s)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=Qe(),t.sibling=null,n=Ue.current,Ne(Ue,r?n&1|2:n&1),t):(dt(t),null);case 22:case 23:return Th(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Lt&1073741824&&(dt(t),t.subtreeFlags&6&&(t.flags|=8192)):dt(t),null;case 24:return null;case 25:return null}throw Error(K(156,t.tag))}function g_(e,t){switch(lh(t),t.tag){case 1:return kt(t.type)&&fu(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Qi(),De(Mt),De(gt),vh(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return mh(t),null;case 13:if(De(Ue),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(K(340));Wi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return De(Ue),null;case 4:return Qi(),null;case 10:return fh(t.type._context),null;case 22:case 23:return Th(),null;case 24:return null;default:return null}}var vl=!1,ht=!1,m_=typeof WeakSet=="function"?WeakSet:Set,Y=null;function mi(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){We(e,t,r)}else n.current=null}function Nf(e,t,n){try{n()}catch(r){We(e,t,r)}}var dv=!1;function v_(e,t){if(gf=lu,e=tw(),sh(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,d=0,c=e,f=null;t:for(;;){for(var m;c!==n||o!==0&&c.nodeType!==3||(a=s+o),c!==i||r!==0&&c.nodeType!==3||(l=s+r),c.nodeType===3&&(s+=c.nodeValue.length),(m=c.firstChild)!==null;)f=c,c=m;for(;;){if(c===e)break t;if(f===n&&++u===o&&(a=s),f===i&&++d===r&&(l=s),(m=c.nextSibling)!==null)break;c=f,f=c.parentNode}c=m}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(mf={focusedElem:e,selectionRange:n},lu=!1,Y=t;Y!==null;)if(t=Y,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Y=e;else for(;Y!==null;){t=Y;try{var v=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var y=v.memoizedProps,x=v.memoizedState,w=t.stateNode,g=w.getSnapshotBeforeUpdate(t.elementType===t.type?y:fn(t.type,y),x);w.__reactInternalSnapshotBeforeUpdate=g}break;case 3:var S=t.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(K(163))}}catch(C){We(t,t.return,C)}if(e=t.sibling,e!==null){e.return=t.return,Y=e;break}Y=t.return}return v=dv,dv=!1,v}function Ws(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&e)===e){var i=o.destroy;o.destroy=void 0,i!==void 0&&Nf(t,n,i)}o=o.next}while(o!==r)}}function nc(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function jf(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function Xw(e){var t=e.alternate;t!==null&&(e.alternate=null,Xw(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[In],delete t[da],delete t[wf],delete t[ZP],delete t[e_])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Jw(e){return e.tag===5||e.tag===3||e.tag===4}function fv(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Jw(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Of(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=du));else if(r!==4&&(e=e.child,e!==null))for(Of(e,t,n),e=e.sibling;e!==null;)Of(e,t,n),e=e.sibling}function Df(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(Df(e,t,n),e=e.sibling;e!==null;)Df(e,t,n),e=e.sibling}var at=null,hn=!1;function vr(e,t,n){for(n=n.child;n!==null;)Zw(e,t,n),n=n.sibling}function Zw(e,t,n){if(Ln&&typeof Ln.onCommitFiberUnmount=="function")try{Ln.onCommitFiberUnmount(qu,n)}catch{}switch(n.tag){case 5:ht||mi(n,t);case 6:var r=at,o=hn;at=null,vr(e,t,n),at=r,hn=o,at!==null&&(hn?(e=at,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):at.removeChild(n.stateNode));break;case 18:at!==null&&(hn?(e=at,n=n.stateNode,e.nodeType===8?od(e.parentNode,n):e.nodeType===1&&od(e,n),sa(e)):od(at,n.stateNode));break;case 4:r=at,o=hn,at=n.stateNode.containerInfo,hn=!0,vr(e,t,n),at=r,hn=o;break;case 0:case 11:case 14:case 15:if(!ht&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&Nf(n,t,s),o=o.next}while(o!==r)}vr(e,t,n);break;case 1:if(!ht&&(mi(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){We(n,t,a)}vr(e,t,n);break;case 21:vr(e,t,n);break;case 22:n.mode&1?(ht=(r=ht)||n.memoizedState!==null,vr(e,t,n),ht=r):vr(e,t,n);break;default:vr(e,t,n)}}function pv(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new m_),t.forEach(function(r){var o=P_.bind(null,e,r);n.has(r)||(n.add(r),r.then(o,o))})}}function dn(e,t){var n=t.deletions;if(n!==null)for(var r=0;ro&&(o=s),r&=~i}if(r=o,r=Qe()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*w_(r/1960))-r,10e?16:e,Ur===null)var r=!1;else{if(e=Ur,Ur=null,Ru=0,Re&6)throw Error(K(331));var o=Re;for(Re|=4,Y=e.current;Y!==null;){var i=Y,s=i.child;if(Y.flags&16){var a=i.deletions;if(a!==null){for(var l=0;lQe()-Ph?To(e,0):Eh|=n),Nt(e,t)}function ax(e,t){t===0&&(e.mode&1?(t=ll,ll<<=1,!(ll&130023424)&&(ll=4194304)):t=1);var n=xt();e=ar(e,t),e!==null&&(Oa(e,t,n),Nt(e,n))}function E_(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ax(e,n)}function P_(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(K(314))}r!==null&&r.delete(t),ax(e,n)}var lx;lx=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Mt.current)At=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return At=!1,p_(e,t,n);At=!!(e.flags&131072)}else At=!1,Fe&&t.flags&1048576&&fw(t,gu,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Vl(e,t),e=t.pendingProps;var o=Gi(t,gt.current);Ci(t,n),o=wh(null,t,r,e,o,n);var i=xh();return t.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,kt(r)?(i=!0,pu(t)):i=!1,t.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,hh(t),o.updater=tc,t.stateNode=o,o._reactInternals=t,Ef(t,r,e,n),t=Tf(null,t,r,!0,i,n)):(t.tag=0,Fe&&i&&ah(t),wt(null,t,o,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Vl(e,t),e=t.pendingProps,o=r._init,r=o(r._payload),t.type=r,o=t.tag=T_(r),e=fn(r,e),o){case 0:t=_f(null,t,r,e,n);break e;case 1:t=lv(null,t,r,e,n);break e;case 11:t=sv(null,t,r,e,n);break e;case 14:t=av(null,t,r,fn(r.type,e),n);break e}throw Error(K(306,r,""))}return t;case 0:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:fn(r,o),_f(e,t,r,o,n);case 1:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:fn(r,o),lv(e,t,r,o,n);case 3:e:{if(Kw(t),e===null)throw Error(K(387));r=t.pendingProps,i=t.memoizedState,o=i.element,yw(e,t),yu(t,r,null,n);var s=t.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=i,t.memoizedState=i,t.flags&256){o=Yi(Error(K(423)),t),t=uv(e,t,r,n,o);break e}else if(r!==o){o=Yi(Error(K(424)),t),t=uv(e,t,r,n,o);break e}else for(Bt=Gr(t.stateNode.containerInfo.firstChild),Vt=t,Fe=!0,mn=null,n=mw(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Wi(),r===o){t=lr(e,t,n);break e}wt(e,t,r,n)}t=t.child}return t;case 5:return ww(t),e===null&&Cf(t),r=t.type,o=t.pendingProps,i=e!==null?e.memoizedProps:null,s=o.children,vf(r,o)?s=null:i!==null&&vf(r,i)&&(t.flags|=32),Hw(e,t),wt(e,t,s,n),t.child;case 6:return e===null&&Cf(t),null;case 13:return Gw(e,t,n);case 4:return gh(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=qi(t,null,r,n):wt(e,t,r,n),t.child;case 11:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:fn(r,o),sv(e,t,r,o,n);case 7:return wt(e,t,t.pendingProps,n),t.child;case 8:return wt(e,t,t.pendingProps.children,n),t.child;case 12:return wt(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,o=t.pendingProps,i=t.memoizedProps,s=o.value,Ne(mu,r._currentValue),r._currentValue=s,i!==null)if(Sn(i.value,s)){if(i.children===o.children&&!Mt.current){t=lr(e,t,n);break e}}else for(i=t.child,i!==null&&(i.return=t);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=tr(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),bf(i.return,n,t),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===t.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error(K(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),bf(s,n,t),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===t){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}wt(e,t,o.children,n),t=t.child}return t;case 9:return o=t.type,r=t.pendingProps.children,Ci(t,n),o=an(o),r=r(o),t.flags|=1,wt(e,t,r,n),t.child;case 14:return r=t.type,o=fn(r,t.pendingProps),o=fn(r.type,o),av(e,t,r,o,n);case 15:return Bw(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,o=t.pendingProps,o=t.elementType===r?o:fn(r,o),Vl(e,t),t.tag=1,kt(r)?(e=!0,pu(t)):e=!1,Ci(t,n),$w(t,r,o),Ef(t,r,o,n),Tf(null,t,r,!0,e,n);case 19:return Ww(e,t,n);case 22:return Vw(e,t,n)}throw Error(K(156,t.tag))};function ux(e,t){return I0(e,t)}function __(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function nn(e,t,n,r){return new __(e,t,n,r)}function Mh(e){return e=e.prototype,!(!e||!e.isReactComponent)}function T_(e){if(typeof e=="function")return Mh(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Qp)return 11;if(e===Yp)return 14}return 2}function Yr(e,t){var n=e.alternate;return n===null?(n=nn(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Gl(e,t,n,r,o,i){var s=2;if(r=e,typeof e=="function")Mh(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case ai:return Ao(n.children,o,i,t);case qp:s=8,o|=8;break;case qd:return e=nn(12,n,t,o|2),e.elementType=qd,e.lanes=i,e;case Qd:return e=nn(13,n,t,o),e.elementType=Qd,e.lanes=i,e;case Yd:return e=nn(19,n,t,o),e.elementType=Yd,e.lanes=i,e;case w0:return oc(n,o,i,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case v0:s=10;break e;case y0:s=9;break e;case Qp:s=11;break e;case Yp:s=14;break e;case Rr:s=16,r=null;break e}throw Error(K(130,e==null?e:typeof e,""))}return t=nn(s,n,t,o),t.elementType=e,t.type=r,t.lanes=i,t}function Ao(e,t,n,r){return e=nn(7,e,r,t),e.lanes=n,e}function oc(e,t,n,r){return e=nn(22,e,r,t),e.elementType=w0,e.lanes=n,e.stateNode={isHidden:!1},e}function fd(e,t,n){return e=nn(6,e,null,t),e.lanes=n,e}function pd(e,t,n){return t=nn(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function A_(e,t,n,r,o){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wc(0),this.expirationTimes=Wc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wc(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function kh(e,t,n,r,o,i,s,a,l){return e=new A_(e,t,n,a,l),t===1?(t=1,i===!0&&(t|=8)):t=0,i=nn(3,null,null,t),e.current=i,i.stateNode=e,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},hh(i),e}function M_(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(px)}catch(e){console.error(e)}}px(),p0.exports=Wt;var os=p0.exports;const hx=e0(os),D_=Zy({__proto__:null,default:hx},[os]);var gx,Sv=os;gx=Sv.createRoot,Sv.hydrateRoot;/** * @remix-run/router v1.20.0 * * Copyright (c) Remix Software Inc. @@ -46,8 +46,8 @@ Error generating stack: `+i.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Ie(){return Ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Do(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function D_(){return Math.random().toString(36).substr(2,8)}function Cv(e,t){return{usr:e.state,key:e.key,idx:t}}function ya(e,t,n,r){return n===void 0&&(n=null),Ie({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?fr(t):t,{state:n,key:t&&t.key||r||D_()})}function Io(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function fr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function I_(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:i=!1}=r,s=o.history,a=Xe.Pop,l=null,u=d();u==null&&(u=0,s.replaceState(Ie({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function c(){a=Xe.Pop;let x=d(),w=x==null?null:x-u;u=x,l&&l({action:a,location:y.location,delta:w})}function f(x,w){a=Xe.Push;let g=ya(y.location,x,w);n&&n(g,x),u=d()+1;let S=Cv(g,u),C=y.createHref(g);try{s.pushState(S,"",C)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;o.location.assign(C)}i&&l&&l({action:a,location:y.location,delta:1})}function m(x,w){a=Xe.Replace;let g=ya(y.location,x,w);n&&n(g,x),u=d();let S=Cv(g,u),C=y.createHref(g);s.replaceState(S,"",C),i&&l&&l({action:a,location:y.location,delta:0})}function v(x){let w=o.location.origin!=="null"?o.location.origin:o.location.href,g=typeof x=="string"?x:Io(x);return g=g.replace(/ $/,"%20"),me(w,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,w)}let y={get action(){return a},get location(){return e(o,s)},listen(x){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(Sv,c),l=x,()=>{o.removeEventListener(Sv,c),l=null}},createHref(x){return t(o,x)},createURL:v,encodeLocation(x){let w=v(x);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:f,replace:m,go(x){return s.go(x)}};return y}var Me;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Me||(Me={}));const F_=new Set(["lazy","caseSensitive","path","id","index","children"]);function L_(e){return e.index===!0}function _u(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((o,i)=>{let s=[...n,String(i)],a=typeof o.id=="string"?o.id:s.join("-");if(me(o.index!==!0||!o.children,"Cannot specify children on an index route"),me(!r[a],'Found a route id collision on id "'+a+`". Route id's must be globally unique within Data Router usages`),L_(o)){let l=Ie({},o,t(o),{id:a});return r[a]=l,l}else{let l=Ie({},o,t(o),{id:a,children:void 0});return r[a]=l,o.children&&(l.children=_u(o.children,t,s,r)),l}})}function go(e,t,n){return n===void 0&&(n="/"),Wl(e,t,n,!1)}function Wl(e,t,n,r){let o=typeof t=="string"?fr(t):t,i=is(o.pathname||"/",n);if(i==null)return null;let s=hx(e);U_(s);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};l.relativePath.startsWith("/")&&(me(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=nr([r,l.relativePath]),d=n.concat(l);i.children&&i.children.length>0&&(me(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),hx(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:W_(u,i.index),routesMeta:d})};return e.forEach((i,s)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))o(i,s);else for(let l of gx(i.path))o(i,s,l)}),t}function gx(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let s=gx(r.join("/")),a=[];return a.push(...s.map(l=>l===""?i:[i,l].join("/"))),o&&a.push(...s),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function U_(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:q_(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const z_=/^:[\w-]+$/,B_=3,V_=2,H_=1,K_=10,G_=-2,bv=e=>e==="*";function W_(e,t){let n=e.split("/"),r=n.length;return n.some(bv)&&(r+=G_),t&&(r+=V_),n.filter(o=>!bv(o)).reduce((o,i)=>o+(z_.test(i)?B_:i===""?H_:K_),r)}function q_(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function Q_(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,o={},i="/",s=[];for(let a=0;a{let{paramName:f,isOptional:m}=d;if(f==="*"){let y=a[c]||"";s=i.slice(0,i.length-y.length).replace(/(.)\/+$/,"$1")}const v=a[c];return m&&!v?u[f]=void 0:u[f]=(v||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:s,pattern:e}}function Y_(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Do(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function X_(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Do(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function is(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 J_(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?fr(e):e;return{pathname:n?n.startsWith("/")?n:Z_(n,t):t,search:tT(r),hash:nT(o)}}function Z_(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function hd(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 and the router will parse it for you.'}function mx(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function uc(e,t){let n=mx(e);return t?n.map((r,o)=>o===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function cc(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=fr(e):(o=Ie({},e),me(!o.pathname||!o.pathname.includes("?"),hd("?","pathname","search",o)),me(!o.pathname||!o.pathname.includes("#"),hd("#","pathname","hash",o)),me(!o.search||!o.search.includes("#"),hd("#","search","hash",o)));let i=e===""||o.pathname==="",s=i?"/":o.pathname,a;if(s==null)a=n;else{let c=t.length-1;if(!r&&s.startsWith("..")){let f=s.split("/");for(;f[0]==="..";)f.shift(),c-=1;o.pathname=f.join("/")}a=c>=0?t[c]:"/"}let l=J_(o,a),u=s&&s!=="/"&&s.endsWith("/"),d=(i||s===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const nr=e=>e.join("/").replace(/\/\/+/g,"/"),eT=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),tT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,nT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Tu{constructor(t,n,r,o){o===void 0&&(o=!1),this.status=t,this.statusText=n||"",this.internal=o,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function dc(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const vx=["post","put","patch","delete"],rT=new Set(vx),oT=["get",...vx],iT=new Set(oT),sT=new Set([301,302,303,307,308]),aT=new Set([307,308]),gd={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},lT={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ps={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Oh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,uT=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),yx="remix-router-transitions";function cT(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",r=!n;me(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let o;if(e.mapRouteProperties)o=e.mapRouteProperties;else if(e.detectErrorBoundary){let k=e.detectErrorBoundary;o=I=>({hasErrorBoundary:k(I)})}else o=uT;let i={},s=_u(e.routes,o,void 0,i),a,l=e.basename||"/",u=e.dataStrategy||hT,d=e.patchRoutesOnNavigation,c=Ie({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),f=null,m=new Set,v=null,y=null,x=null,w=e.hydrationData!=null,g=go(s,e.history.location,l),S=null;if(g==null&&!d){let k=Pt(404,{pathname:e.history.location.pathname}),{matches:I,route:U}=Dv(s);g=I,S={[U.id]:k}}g&&!e.hydrationData&&Ja(g,s,e.history.location.pathname).active&&(g=null);let C;if(g)if(g.some(k=>k.route.lazy))C=!1;else if(!g.some(k=>k.route.loader))C=!0;else if(c.v7_partialHydration){let k=e.hydrationData?e.hydrationData.loaderData:null,I=e.hydrationData?e.hydrationData.errors:null;if(I){let U=g.findIndex(H=>I[H.route.id]!==void 0);C=g.slice(0,U+1).every(H=>!zf(H.route,k,I))}else C=g.every(U=>!zf(U.route,k,I))}else C=e.hydrationData!=null;else if(C=!1,g=[],c.v7_partialHydration){let k=Ja(null,s,e.history.location.pathname);k.active&&k.matches&&(g=k.matches)}let P,b={historyAction:e.history.action,location:e.history.location,matches:g,initialized:C,navigation:gd,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||S,fetchers:new Map,blockers:new Map},M=Xe.Pop,A=!1,$,R=!1,O=new Map,F=null,N=!1,E=!1,T=[],D=new Set,V=new Map,L=0,j=-1,B=new Map,Q=new Set,te=new Map,fe=new Map,ge=new Set,z=new Map,W=new Map,pe;function Te(){if(f=e.history.listen(k=>{let{action:I,location:U,delta:H}=k;if(pe){pe(),pe=void 0;return}Do(W.size===0||H!=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 X=am({currentLocation:b.location,nextLocation:U,historyAction:I});if(X&&H!=null){let oe=new Promise(ce=>{pe=ce});e.history.go(H*-1),Xa(X,{state:"blocked",location:U,proceed(){Xa(X,{state:"proceeding",proceed:void 0,reset:void 0,location:U}),oe.then(()=>e.history.go(H))},reset(){let ce=new Map(b.blockers);ce.set(X,Ps),Ce({blockers:ce})}});return}return nt(I,U)}),n){TT(t,O);let k=()=>AT(t,O);t.addEventListener("pagehide",k),F=()=>t.removeEventListener("pagehide",k)}return b.initialized||nt(Xe.Pop,b.location,{initialHydration:!0}),P}function we(){f&&f(),F&&F(),m.clear(),$&&$.abort(),b.fetchers.forEach((k,I)=>Ya(I)),b.blockers.forEach((k,I)=>sm(I))}function tt(k){return m.add(k),()=>m.delete(k)}function Ce(k,I){I===void 0&&(I={}),b=Ie({},b,k);let U=[],H=[];c.v7_fetcherPersist&&b.fetchers.forEach((X,oe)=>{X.state==="idle"&&(ge.has(oe)?H.push(oe):U.push(oe))}),[...m].forEach(X=>X(b,{deletedFetchers:H,viewTransitionOpts:I.viewTransitionOpts,flushSync:I.flushSync===!0})),c.v7_fetcherPersist&&(U.forEach(X=>b.fetchers.delete(X)),H.forEach(X=>Ya(X)))}function it(k,I,U){var H,X;let{flushSync:oe}=U===void 0?{}:U,ce=b.actionData!=null&&b.navigation.formMethod!=null&&gn(b.navigation.formMethod)&&b.navigation.state==="loading"&&((H=k.state)==null?void 0:H._isRedirect)!==!0,Z;I.actionData?Object.keys(I.actionData).length>0?Z=I.actionData:Z=null:ce?Z=b.actionData:Z=null;let ee=I.loaderData?jv(b.loaderData,I.loaderData,I.matches||[],I.errors):b.loaderData,J=b.blockers;J.size>0&&(J=new Map(J),J.forEach((be,st)=>J.set(st,Ps)));let ie=A===!0||b.navigation.formMethod!=null&&gn(b.navigation.formMethod)&&((X=k.state)==null?void 0:X._isRedirect)!==!0;a&&(s=a,a=void 0),N||M===Xe.Pop||(M===Xe.Push?e.history.push(k,k.state):M===Xe.Replace&&e.history.replace(k,k.state));let ye;if(M===Xe.Pop){let be=O.get(b.location.pathname);be&&be.has(k.pathname)?ye={currentLocation:b.location,nextLocation:k}:O.has(k.pathname)&&(ye={currentLocation:k,nextLocation:b.location})}else if(R){let be=O.get(b.location.pathname);be?be.add(k.pathname):(be=new Set([k.pathname]),O.set(b.location.pathname,be)),ye={currentLocation:b.location,nextLocation:k}}Ce(Ie({},I,{actionData:Z,loaderData:ee,historyAction:M,location:k,initialized:!0,navigation:gd,revalidation:"idle",restoreScrollPosition:um(k,I.matches||b.matches),preventScrollReset:ie,blockers:J}),{viewTransitionOpts:ye,flushSync:oe===!0}),M=Xe.Pop,A=!1,R=!1,N=!1,E=!1,T=[]}async function Ot(k,I){if(typeof k=="number"){e.history.go(k);return}let U=Uf(b.location,b.matches,l,c.v7_prependBasename,k,c.v7_relativeSplatPath,I==null?void 0:I.fromRouteId,I==null?void 0:I.relative),{path:H,submission:X,error:oe}=Ev(c.v7_normalizeFormMethod,!1,U,I),ce=b.location,Z=ya(b.location,H,I&&I.state);Z=Ie({},Z,e.history.encodeLocation(Z));let ee=I&&I.replace!=null?I.replace:void 0,J=Xe.Push;ee===!0?J=Xe.Replace:ee===!1||X!=null&&gn(X.formMethod)&&X.formAction===b.location.pathname+b.location.search&&(J=Xe.Replace);let ie=I&&"preventScrollReset"in I?I.preventScrollReset===!0:void 0,ye=(I&&I.flushSync)===!0,be=am({currentLocation:ce,nextLocation:Z,historyAction:J});if(be){Xa(be,{state:"blocked",location:Z,proceed(){Xa(be,{state:"proceeding",proceed:void 0,reset:void 0,location:Z}),Ot(k,I)},reset(){let st=new Map(b.blockers);st.set(be,Ps),Ce({blockers:st})}});return}return await nt(J,Z,{submission:X,pendingError:oe,preventScrollReset:ie,replace:I&&I.replace,enableViewTransition:I&&I.viewTransition,flushSync:ye})}function $e(){if(Fc(),Ce({revalidation:"loading"}),b.navigation.state!=="submitting"){if(b.navigation.state==="idle"){nt(b.historyAction,b.location,{startUninterruptedRevalidation:!0});return}nt(M||b.historyAction,b.navigation.location,{overrideNavigation:b.navigation,enableViewTransition:R===!0})}}async function nt(k,I,U){$&&$.abort(),$=null,M=k,N=(U&&U.startUninterruptedRevalidation)===!0,nE(b.location,b.matches),A=(U&&U.preventScrollReset)===!0,R=(U&&U.enableViewTransition)===!0;let H=a||s,X=U&&U.overrideNavigation,oe=go(H,I,l),ce=(U&&U.flushSync)===!0,Z=Ja(oe,H,I.pathname);if(Z.active&&Z.matches&&(oe=Z.matches),!oe){let{error:ke,notFoundMatches:Pe,route:He}=Lc(I.pathname);it(I,{matches:Pe,loaderData:{},errors:{[He.id]:ke}},{flushSync:ce});return}if(b.initialized&&!E&&xT(b.location,I)&&!(U&&U.submission&&gn(U.submission.formMethod))){it(I,{matches:oe},{flushSync:ce});return}$=new AbortController;let ee=ti(e.history,I,$.signal,U&&U.submission),J;if(U&&U.pendingError)J=[mo(oe).route.id,{type:Me.error,error:U.pendingError}];else if(U&&U.submission&&gn(U.submission.formMethod)){let ke=await cn(ee,I,U.submission,oe,Z.active,{replace:U.replace,flushSync:ce});if(ke.shortCircuited)return;if(ke.pendingActionResult){let[Pe,He]=ke.pendingActionResult;if($t(He)&&dc(He.error)&&He.error.status===404){$=null,it(I,{matches:ke.matches,loaderData:{},errors:{[Pe]:He.error}});return}}oe=ke.matches||oe,J=ke.pendingActionResult,X=md(I,U.submission),ce=!1,Z.active=!1,ee=ti(e.history,ee.url,ee.signal)}let{shortCircuited:ie,matches:ye,loaderData:be,errors:st}=await Ic(ee,I,oe,Z.active,X,U&&U.submission,U&&U.fetcherSubmission,U&&U.replace,U&&U.initialHydration===!0,ce,J);ie||($=null,it(I,Ie({matches:ye||oe},Ov(J),{loaderData:be,errors:st})))}async function cn(k,I,U,H,X,oe){oe===void 0&&(oe={}),Fc();let ce=PT(I,U);if(Ce({navigation:ce},{flushSync:oe.flushSync===!0}),X){let J=await Za(H,I.pathname,k.signal);if(J.type==="aborted")return{shortCircuited:!0};if(J.type==="error"){let ie=mo(J.partialMatches).route.id;return{matches:J.partialMatches,pendingActionResult:[ie,{type:Me.error,error:J.error}]}}else if(J.matches)H=J.matches;else{let{notFoundMatches:ie,error:ye,route:be}=Lc(I.pathname);return{matches:ie,pendingActionResult:[be.id,{type:Me.error,error:ye}]}}}let Z,ee=Is(H,I);if(!ee.route.action&&!ee.route.lazy)Z={type:Me.error,error:Pt(405,{method:k.method,pathname:I.pathname,routeId:ee.route.id})};else if(Z=(await hs("action",b,k,[ee],H,null))[ee.route.id],k.signal.aborted)return{shortCircuited:!0};if(xo(Z)){let J;return oe&&oe.replace!=null?J=oe.replace:J=Mv(Z.response.headers.get("Location"),new URL(k.url),l)===b.location.pathname+b.location.search,await lo(k,Z,!0,{submission:U,replace:J}),{shortCircuited:!0}}if(zr(Z))throw Pt(400,{type:"defer-action"});if($t(Z)){let J=mo(H,ee.route.id);return(oe&&oe.replace)!==!0&&(M=Xe.Push),{matches:H,pendingActionResult:[J.route.id,Z]}}return{matches:H,pendingActionResult:[ee.route.id,Z]}}async function Ic(k,I,U,H,X,oe,ce,Z,ee,J,ie){let ye=X||md(I,oe),be=oe||ce||Fv(ye),st=!N&&(!c.v7_partialHydration||!ee);if(H){if(st){let Ke=Qa(ie);Ce(Ie({navigation:ye},Ke!==void 0?{actionData:Ke}:{}),{flushSync:J})}let Ee=await Za(U,I.pathname,k.signal);if(Ee.type==="aborted")return{shortCircuited:!0};if(Ee.type==="error"){let Ke=mo(Ee.partialMatches).route.id;return{matches:Ee.partialMatches,loaderData:{},errors:{[Ke]:Ee.error}}}else if(Ee.matches)U=Ee.matches;else{let{error:Ke,notFoundMatches:Jo,route:vs}=Lc(I.pathname);return{matches:Jo,loaderData:{},errors:{[vs.id]:Ke}}}}let ke=a||s,[Pe,He]=_v(e.history,b,U,be,I,c.v7_partialHydration&&ee===!0,c.v7_skipActionErrorRevalidation,E,T,D,ge,te,Q,ke,l,ie);if($c(Ee=>!(U&&U.some(Ke=>Ke.route.id===Ee))||Pe&&Pe.some(Ke=>Ke.route.id===Ee)),j=++L,Pe.length===0&&He.length===0){let Ee=om();return it(I,Ie({matches:U,loaderData:{},errors:ie&&$t(ie[1])?{[ie[0]]:ie[1].error}:null},Ov(ie),Ee?{fetchers:new Map(b.fetchers)}:{}),{flushSync:J}),{shortCircuited:!0}}if(st){let Ee={};if(!H){Ee.navigation=ye;let Ke=Qa(ie);Ke!==void 0&&(Ee.actionData=Ke)}He.length>0&&(Ee.fetchers=Yo(He)),Ce(Ee,{flushSync:J})}He.forEach(Ee=>{mr(Ee.key),Ee.controller&&V.set(Ee.key,Ee.controller)});let Xo=()=>He.forEach(Ee=>mr(Ee.key));$&&$.signal.addEventListener("abort",Xo);let{loaderResults:gs,fetcherResults:Kn}=await tm(b,U,Pe,He,k);if(k.signal.aborted)return{shortCircuited:!0};$&&$.signal.removeEventListener("abort",Xo),He.forEach(Ee=>V.delete(Ee.key));let Pn=xl(gs);if(Pn)return await lo(k,Pn.result,!0,{replace:Z}),{shortCircuited:!0};if(Pn=xl(Kn),Pn)return Q.add(Pn.key),await lo(k,Pn.result,!0,{replace:Z}),{shortCircuited:!0};let{loaderData:Uc,errors:ms}=Nv(b,U,gs,ie,He,Kn,z);z.forEach((Ee,Ke)=>{Ee.subscribe(Jo=>{(Jo||Ee.done)&&z.delete(Ke)})}),c.v7_partialHydration&&ee&&b.errors&&(ms=Ie({},b.errors,ms));let uo=om(),el=im(j),tl=uo||el||He.length>0;return Ie({matches:U,loaderData:Uc,errors:ms},tl?{fetchers:new Map(b.fetchers)}:{})}function Qa(k){if(k&&!$t(k[1]))return{[k[0]]:k[1].data};if(b.actionData)return Object.keys(b.actionData).length===0?null:b.actionData}function Yo(k){return k.forEach(I=>{let U=b.fetchers.get(I.key),H=_s(void 0,U?U.data:void 0);b.fetchers.set(I.key,H)}),new Map(b.fetchers)}function YR(k,I,U,H){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");mr(k);let X=(H&&H.flushSync)===!0,oe=a||s,ce=Uf(b.location,b.matches,l,c.v7_prependBasename,U,c.v7_relativeSplatPath,I,H==null?void 0:H.relative),Z=go(oe,ce,l),ee=Ja(Z,oe,ce);if(ee.active&&ee.matches&&(Z=ee.matches),!Z){Hn(k,I,Pt(404,{pathname:ce}),{flushSync:X});return}let{path:J,submission:ie,error:ye}=Ev(c.v7_normalizeFormMethod,!0,ce,H);if(ye){Hn(k,I,ye,{flushSync:X});return}let be=Is(Z,J),st=(H&&H.preventScrollReset)===!0;if(ie&&gn(ie.formMethod)){XR(k,I,J,be,Z,ee.active,X,st,ie);return}te.set(k,{routeId:I,path:J}),JR(k,I,J,be,Z,ee.active,X,st,ie)}async function XR(k,I,U,H,X,oe,ce,Z,ee){Fc(),te.delete(k);function J(Ye){if(!Ye.route.action&&!Ye.route.lazy){let Zo=Pt(405,{method:ee.formMethod,pathname:U,routeId:I});return Hn(k,I,Zo,{flushSync:ce}),!0}return!1}if(!oe&&J(H))return;let ie=b.fetchers.get(k);gr(k,_T(ee,ie),{flushSync:ce});let ye=new AbortController,be=ti(e.history,U,ye.signal,ee);if(oe){let Ye=await Za(X,U,be.signal);if(Ye.type==="aborted")return;if(Ye.type==="error"){Hn(k,I,Ye.error,{flushSync:ce});return}else if(Ye.matches){if(X=Ye.matches,H=Is(X,U),J(H))return}else{Hn(k,I,Pt(404,{pathname:U}),{flushSync:ce});return}}V.set(k,ye);let st=L,Pe=(await hs("action",b,be,[H],X,k))[H.route.id];if(be.signal.aborted){V.get(k)===ye&&V.delete(k);return}if(c.v7_fetcherPersist&&ge.has(k)){if(xo(Pe)||$t(Pe)){gr(k,Sr(void 0));return}}else{if(xo(Pe))if(V.delete(k),j>st){gr(k,Sr(void 0));return}else return Q.add(k),gr(k,_s(ee)),lo(be,Pe,!1,{fetcherSubmission:ee,preventScrollReset:Z});if($t(Pe)){Hn(k,I,Pe.error);return}}if(zr(Pe))throw Pt(400,{type:"defer-action"});let He=b.navigation.location||b.location,Xo=ti(e.history,He,ye.signal),gs=a||s,Kn=b.navigation.state!=="idle"?go(gs,b.navigation.location,l):b.matches;me(Kn,"Didn't find any matches after fetcher action");let Pn=++L;B.set(k,Pn);let Uc=_s(ee,Pe.data);b.fetchers.set(k,Uc);let[ms,uo]=_v(e.history,b,Kn,ee,He,!1,c.v7_skipActionErrorRevalidation,E,T,D,ge,te,Q,gs,l,[H.route.id,Pe]);uo.filter(Ye=>Ye.key!==k).forEach(Ye=>{let Zo=Ye.key,cm=b.fetchers.get(Zo),iE=_s(void 0,cm?cm.data:void 0);b.fetchers.set(Zo,iE),mr(Zo),Ye.controller&&V.set(Zo,Ye.controller)}),Ce({fetchers:new Map(b.fetchers)});let el=()=>uo.forEach(Ye=>mr(Ye.key));ye.signal.addEventListener("abort",el);let{loaderResults:tl,fetcherResults:Ee}=await tm(b,Kn,ms,uo,Xo);if(ye.signal.aborted)return;ye.signal.removeEventListener("abort",el),B.delete(k),V.delete(k),uo.forEach(Ye=>V.delete(Ye.key));let Ke=xl(tl);if(Ke)return lo(Xo,Ke.result,!1,{preventScrollReset:Z});if(Ke=xl(Ee),Ke)return Q.add(Ke.key),lo(Xo,Ke.result,!1,{preventScrollReset:Z});let{loaderData:Jo,errors:vs}=Nv(b,Kn,tl,void 0,uo,Ee,z);if(b.fetchers.has(k)){let Ye=Sr(Pe.data);b.fetchers.set(k,Ye)}im(Pn),b.navigation.state==="loading"&&Pn>j?(me(M,"Expected pending action"),$&&$.abort(),it(b.navigation.location,{matches:Kn,loaderData:Jo,errors:vs,fetchers:new Map(b.fetchers)})):(Ce({errors:vs,loaderData:jv(b.loaderData,Jo,Kn,vs),fetchers:new Map(b.fetchers)}),E=!1)}async function JR(k,I,U,H,X,oe,ce,Z,ee){let J=b.fetchers.get(k);gr(k,_s(ee,J?J.data:void 0),{flushSync:ce});let ie=new AbortController,ye=ti(e.history,U,ie.signal);if(oe){let Pe=await Za(X,U,ye.signal);if(Pe.type==="aborted")return;if(Pe.type==="error"){Hn(k,I,Pe.error,{flushSync:ce});return}else if(Pe.matches)X=Pe.matches,H=Is(X,U);else{Hn(k,I,Pt(404,{pathname:U}),{flushSync:ce});return}}V.set(k,ie);let be=L,ke=(await hs("loader",b,ye,[H],X,k))[H.route.id];if(zr(ke)&&(ke=await Dh(ke,ye.signal,!0)||ke),V.get(k)===ie&&V.delete(k),!ye.signal.aborted){if(ge.has(k)){gr(k,Sr(void 0));return}if(xo(ke))if(j>be){gr(k,Sr(void 0));return}else{Q.add(k),await lo(ye,ke,!1,{preventScrollReset:Z});return}if($t(ke)){Hn(k,I,ke.error);return}me(!zr(ke),"Unhandled fetcher deferred data"),gr(k,Sr(ke.data))}}async function lo(k,I,U,H){let{submission:X,fetcherSubmission:oe,preventScrollReset:ce,replace:Z}=H===void 0?{}:H;I.response.headers.has("X-Remix-Revalidate")&&(E=!0);let ee=I.response.headers.get("Location");me(ee,"Expected a Location header on the redirect Response"),ee=Mv(ee,new URL(k.url),l);let J=ya(b.location,ee,{_isRedirect:!0});if(n){let Pe=!1;if(I.response.headers.has("X-Remix-Reload-Document"))Pe=!0;else if(Oh.test(ee)){const He=e.history.createURL(ee);Pe=He.origin!==t.location.origin||is(He.pathname,l)==null}if(Pe){Z?t.location.replace(ee):t.location.assign(ee);return}}$=null;let ie=Z===!0||I.response.headers.has("X-Remix-Replace")?Xe.Replace:Xe.Push,{formMethod:ye,formAction:be,formEncType:st}=b.navigation;!X&&!oe&&ye&&be&&st&&(X=Fv(b.navigation));let ke=X||oe;if(aT.has(I.response.status)&&ke&&gn(ke.formMethod))await nt(ie,J,{submission:Ie({},ke,{formAction:ee}),preventScrollReset:ce||A,enableViewTransition:U?R:void 0});else{let Pe=md(J,X);await nt(ie,J,{overrideNavigation:Pe,fetcherSubmission:oe,preventScrollReset:ce||A,enableViewTransition:U?R:void 0})}}async function hs(k,I,U,H,X,oe){let ce,Z={};try{ce=await gT(u,k,I,U,H,X,oe,i,o)}catch(ee){return H.forEach(J=>{Z[J.route.id]={type:Me.error,error:ee}}),Z}for(let[ee,J]of Object.entries(ce))if(ST(J)){let ie=J.result;Z[ee]={type:Me.redirect,response:yT(ie,U,ee,X,l,c.v7_relativeSplatPath)}}else Z[ee]=await vT(J);return Z}async function tm(k,I,U,H,X){let oe=k.matches,ce=hs("loader",k,X,U,I,null),Z=Promise.all(H.map(async ie=>{if(ie.matches&&ie.match&&ie.controller){let be=(await hs("loader",k,ti(e.history,ie.path,ie.controller.signal),[ie.match],ie.matches,ie.key))[ie.match.route.id];return{[ie.key]:be}}else return Promise.resolve({[ie.key]:{type:Me.error,error:Pt(404,{pathname:ie.path})}})})),ee=await ce,J=(await Z).reduce((ie,ye)=>Object.assign(ie,ye),{});return await Promise.all([RT(I,ee,X.signal,oe,k.loaderData),ET(I,J,H)]),{loaderResults:ee,fetcherResults:J}}function Fc(){E=!0,T.push(...$c()),te.forEach((k,I)=>{V.has(I)&&D.add(I),mr(I)})}function gr(k,I,U){U===void 0&&(U={}),b.fetchers.set(k,I),Ce({fetchers:new Map(b.fetchers)},{flushSync:(U&&U.flushSync)===!0})}function Hn(k,I,U,H){H===void 0&&(H={});let X=mo(b.matches,I);Ya(k),Ce({errors:{[X.route.id]:U},fetchers:new Map(b.fetchers)},{flushSync:(H&&H.flushSync)===!0})}function nm(k){return c.v7_fetcherPersist&&(fe.set(k,(fe.get(k)||0)+1),ge.has(k)&&ge.delete(k)),b.fetchers.get(k)||lT}function Ya(k){let I=b.fetchers.get(k);V.has(k)&&!(I&&I.state==="loading"&&B.has(k))&&mr(k),te.delete(k),B.delete(k),Q.delete(k),ge.delete(k),D.delete(k),b.fetchers.delete(k)}function ZR(k){if(c.v7_fetcherPersist){let I=(fe.get(k)||0)-1;I<=0?(fe.delete(k),ge.add(k)):fe.set(k,I)}else Ya(k);Ce({fetchers:new Map(b.fetchers)})}function mr(k){let I=V.get(k);I&&(I.abort(),V.delete(k))}function rm(k){for(let I of k){let U=nm(I),H=Sr(U.data);b.fetchers.set(I,H)}}function om(){let k=[],I=!1;for(let U of Q){let H=b.fetchers.get(U);me(H,"Expected fetcher: "+U),H.state==="loading"&&(Q.delete(U),k.push(U),I=!0)}return rm(k),I}function im(k){let I=[];for(let[U,H]of B)if(H0}function eE(k,I){let U=b.blockers.get(k)||Ps;return W.get(k)!==I&&W.set(k,I),U}function sm(k){b.blockers.delete(k),W.delete(k)}function Xa(k,I){let U=b.blockers.get(k)||Ps;me(U.state==="unblocked"&&I.state==="blocked"||U.state==="blocked"&&I.state==="blocked"||U.state==="blocked"&&I.state==="proceeding"||U.state==="blocked"&&I.state==="unblocked"||U.state==="proceeding"&&I.state==="unblocked","Invalid blocker state transition: "+U.state+" -> "+I.state);let H=new Map(b.blockers);H.set(k,I),Ce({blockers:H})}function am(k){let{currentLocation:I,nextLocation:U,historyAction:H}=k;if(W.size===0)return;W.size>1&&Do(!1,"A router only supports one blocker at a time");let X=Array.from(W.entries()),[oe,ce]=X[X.length-1],Z=b.blockers.get(oe);if(!(Z&&Z.state==="proceeding")&&ce({currentLocation:I,nextLocation:U,historyAction:H}))return oe}function Lc(k){let I=Pt(404,{pathname:k}),U=a||s,{matches:H,route:X}=Dv(U);return $c(),{notFoundMatches:H,route:X,error:I}}function $c(k){let I=[];return z.forEach((U,H)=>{(!k||k(H))&&(U.cancel(),I.push(H),z.delete(H))}),I}function tE(k,I,U){if(v=k,x=I,y=U||null,!w&&b.navigation===gd){w=!0;let H=um(b.location,b.matches);H!=null&&Ce({restoreScrollPosition:H})}return()=>{v=null,x=null,y=null}}function lm(k,I){return y&&y(k,I.map(H=>$_(H,b.loaderData)))||k.key}function nE(k,I){if(v&&x){let U=lm(k,I);v[U]=x()}}function um(k,I){if(v){let U=lm(k,I),H=v[U];if(typeof H=="number")return H}return null}function Ja(k,I,U){if(d)if(k){if(Object.keys(k[0].params).length>0)return{active:!0,matches:Wl(I,U,l,!0)}}else return{active:!0,matches:Wl(I,U,l,!0)||[]};return{active:!1,matches:null}}async function Za(k,I,U){if(!d)return{type:"success",matches:k};let H=k;for(;;){let X=a==null,oe=a||s,ce=i;try{await d({path:I,matches:H,patch:(J,ie)=>{U.aborted||Av(J,ie,oe,ce,o)}})}catch(J){return{type:"error",error:J,partialMatches:H}}finally{X&&!U.aborted&&(s=[...s])}if(U.aborted)return{type:"aborted"};let Z=go(oe,I,l);if(Z)return{type:"success",matches:Z};let ee=Wl(oe,I,l,!0);if(!ee||H.length===ee.length&&H.every((J,ie)=>J.route.id===ee[ie].route.id))return{type:"success",matches:null};H=ee}}function rE(k){i={},a=_u(k,o,void 0,i)}function oE(k,I){let U=a==null;Av(k,I,a||s,i,o),U&&(s=[...s],Ce({}))}return P={get basename(){return l},get future(){return c},get state(){return b},get routes(){return s},get window(){return t},initialize:Te,subscribe:tt,enableScrollRestoration:tE,navigate:Ot,fetch:YR,revalidate:$e,createHref:k=>e.history.createHref(k),encodeLocation:k=>e.history.encodeLocation(k),getFetcher:nm,deleteFetcher:ZR,dispose:we,getBlocker:eE,deleteBlocker:sm,patchRoutes:oE,_internalFetchControllers:V,_internalActiveDeferreds:z,_internalSetRoutes:rE},P}function dT(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Uf(e,t,n,r,o,i,s,a){let l,u;if(s){l=[];for(let c of t)if(l.push(c),c.route.id===s){u=c;break}}else l=t,u=t[t.length-1];let d=cc(o||".",uc(l,i),is(e.pathname,n)||e.pathname,a==="path");if(o==null&&(d.search=e.search,d.hash=e.hash),(o==null||o===""||o===".")&&u){let c=Ih(d.search);if(u.route.index&&!c)d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index";else if(!u.route.index&&c){let f=new URLSearchParams(d.search),m=f.getAll("index");f.delete("index"),m.filter(y=>y).forEach(y=>f.append("index",y));let v=f.toString();d.search=v?"?"+v:""}}return r&&n!=="/"&&(d.pathname=d.pathname==="/"?n:nr([n,d.pathname])),Io(d)}function Ev(e,t,n,r){if(!r||!dT(r))return{path:n};if(r.formMethod&&!bT(r.formMethod))return{path:n,error:Pt(405,{method:r.formMethod})};let o=()=>({path:n,error:Pt(400,{type:"invalid-body"})}),i=r.formMethod||"get",s=e?i.toUpperCase():i.toLowerCase(),a=Sx(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!gn(s))return o();let f=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((m,v)=>{let[y,x]=v;return""+m+y+"="+x+` -`},""):String(r.body);return{path:n,submission:{formMethod:s,formAction:a,formEncType:r.formEncType,formData:void 0,json:void 0,text:f}}}else if(r.formEncType==="application/json"){if(!gn(s))return o();try{let f=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:s,formAction:a,formEncType:r.formEncType,formData:void 0,json:f,text:void 0}}}catch{return o()}}}me(typeof FormData=="function","FormData is not available in this environment");let l,u;if(r.formData)l=Bf(r.formData),u=r.formData;else if(r.body instanceof FormData)l=Bf(r.body),u=r.body;else if(r.body instanceof URLSearchParams)l=r.body,u=kv(l);else if(r.body==null)l=new URLSearchParams,u=new FormData;else try{l=new URLSearchParams(r.body),u=kv(l)}catch{return o()}let d={formMethod:s,formAction:a,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(gn(d.formMethod))return{path:n,submission:d};let c=fr(n);return t&&c.search&&Ih(c.search)&&l.append("index",""),c.search="?"+l,{path:Io(c),submission:d}}function Pv(e,t,n){n===void 0&&(n=!1);let r=e.findIndex(o=>o.route.id===t);return r>=0?e.slice(0,n?r+1:r):e}function _v(e,t,n,r,o,i,s,a,l,u,d,c,f,m,v,y){let x=y?$t(y[1])?y[1].error:y[1].data:void 0,w=e.createURL(t.location),g=e.createURL(o),S=n;i&&t.errors?S=Pv(n,Object.keys(t.errors)[0],!0):y&&$t(y[1])&&(S=Pv(n,y[0]));let C=y?y[1].statusCode:void 0,P=s&&C&&C>=400,b=S.filter((A,$)=>{let{route:R}=A;if(R.lazy)return!0;if(R.loader==null)return!1;if(i)return zf(R,t.loaderData,t.errors);if(fT(t.loaderData,t.matches[$],A)||l.some(N=>N===A.route.id))return!0;let O=t.matches[$],F=A;return Tv(A,Ie({currentUrl:w,currentParams:O.params,nextUrl:g,nextParams:F.params},r,{actionResult:x,actionStatus:C,defaultShouldRevalidate:P?!1:a||w.pathname+w.search===g.pathname+g.search||w.search!==g.search||wx(O,F)}))}),M=[];return c.forEach((A,$)=>{if(i||!n.some(E=>E.route.id===A.routeId)||d.has($))return;let R=go(m,A.path,v);if(!R){M.push({key:$,routeId:A.routeId,path:A.path,matches:null,match:null,controller:null});return}let O=t.fetchers.get($),F=Is(R,A.path),N=!1;f.has($)?N=!1:u.has($)?(u.delete($),N=!0):O&&O.state!=="idle"&&O.data===void 0?N=a:N=Tv(F,Ie({currentUrl:w,currentParams:t.matches[t.matches.length-1].params,nextUrl:g,nextParams:n[n.length-1].params},r,{actionResult:x,actionStatus:C,defaultShouldRevalidate:P?!1:a})),N&&M.push({key:$,routeId:A.routeId,path:A.path,matches:R,match:F,controller:new AbortController})}),[b,M]}function zf(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let r=t!=null&&t[e.id]!==void 0,o=n!=null&&n[e.id]!==void 0;return!r&&o?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!r&&!o}function fT(e,t,n){let r=!t||n.route.id!==t.route.id,o=e[n.route.id]===void 0;return r||o}function wx(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Tv(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Av(e,t,n,r,o){var i;let s;if(e){let u=r[e];me(u,"No route found to patch children into: routeId = "+e),u.children||(u.children=[]),s=u.children}else s=n;let a=t.filter(u=>!s.some(d=>xx(u,d))),l=_u(a,o,[e||"_","patch",String(((i=s)==null?void 0:i.length)||"0")],r);s.push(...l)}function xx(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,r)=>{var o;return(o=t.children)==null?void 0:o.some(i=>xx(n,i))}):!1}async function pT(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let o=n[e.id];me(o,"No route found in manifest");let i={};for(let s in r){let l=o[s]!==void 0&&s!=="hasErrorBoundary";Do(!l,'Route "'+o.id+'" has a static property "'+s+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+s+'" will be ignored.')),!l&&!F_.has(s)&&(i[s]=r[s])}Object.assign(o,i),Object.assign(o,Ie({},t(o),{lazy:void 0}))}async function hT(e){let{matches:t}=e,n=t.filter(o=>o.shouldLoad);return(await Promise.all(n.map(o=>o.resolve()))).reduce((o,i,s)=>Object.assign(o,{[n[s].route.id]:i}),{})}async function gT(e,t,n,r,o,i,s,a,l,u){let d=i.map(m=>m.route.lazy?pT(m.route,l,a):void 0),c=i.map((m,v)=>{let y=d[v],x=o.some(g=>g.route.id===m.route.id);return Ie({},m,{shouldLoad:x,resolve:async g=>(g&&r.method==="GET"&&(m.route.lazy||m.route.loader)&&(x=!0),x?mT(t,r,m,y,g,u):Promise.resolve({type:Me.data,result:void 0}))})}),f=await e({matches:c,request:r,params:i[0].params,fetcherKey:s,context:u});try{await Promise.all(d)}catch{}return f}async function mT(e,t,n,r,o,i){let s,a,l=u=>{let d,c=new Promise((v,y)=>d=y);a=()=>d(),t.signal.addEventListener("abort",a);let f=v=>typeof u!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):u({request:t,params:n.params,context:i},...v!==void 0?[v]:[]),m=(async()=>{try{return{type:"data",result:await(o?o(y=>f(y)):f())}}catch(v){return{type:"error",result:v}}})();return Promise.race([m,c])};try{let u=n.route[e];if(r)if(u){let d,[c]=await Promise.all([l(u).catch(f=>{d=f}),r]);if(d!==void 0)throw d;s=c}else if(await r,u=n.route[e],u)s=await l(u);else if(e==="action"){let d=new URL(t.url),c=d.pathname+d.search;throw Pt(405,{method:t.method,pathname:c,routeId:n.route.id})}else return{type:Me.data,result:void 0};else if(u)s=await l(u);else{let d=new URL(t.url),c=d.pathname+d.search;throw Pt(404,{pathname:c})}me(s.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(u){return{type:Me.error,result:u}}finally{a&&t.signal.removeEventListener("abort",a)}return s}async function vT(e){let{result:t,type:n}=e;if(Cx(t)){let u;try{let d=t.headers.get("Content-Type");d&&/\bapplication\/json\b/.test(d)?t.body==null?u=null:u=await t.json():u=await t.text()}catch(d){return{type:Me.error,error:d}}return n===Me.error?{type:Me.error,error:new Tu(t.status,t.statusText,u),statusCode:t.status,headers:t.headers}:{type:Me.data,data:u,statusCode:t.status,headers:t.headers}}if(n===Me.error){if(Iv(t)){var r;if(t.data instanceof Error){var o;return{type:Me.error,error:t.data,statusCode:(o=t.init)==null?void 0:o.status}}t=new Tu(((r=t.init)==null?void 0:r.status)||500,void 0,t.data)}return{type:Me.error,error:t,statusCode:dc(t)?t.status:void 0}}if(CT(t)){var i,s;return{type:Me.deferred,deferredData:t,statusCode:(i=t.init)==null?void 0:i.status,headers:((s=t.init)==null?void 0:s.headers)&&new Headers(t.init.headers)}}if(Iv(t)){var a,l;return{type:Me.data,data:t.data,statusCode:(a=t.init)==null?void 0:a.status,headers:(l=t.init)!=null&&l.headers?new Headers(t.init.headers):void 0}}return{type:Me.data,data:t}}function yT(e,t,n,r,o,i){let s=e.headers.get("Location");if(me(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!Oh.test(s)){let a=r.slice(0,r.findIndex(l=>l.route.id===n)+1);s=Uf(new URL(t.url),a,o,!0,s,i),e.headers.set("Location",s)}return e}function Mv(e,t,n){if(Oh.test(e)){let r=e,o=r.startsWith("//")?new URL(t.protocol+r):new URL(r),i=is(o.pathname,n)!=null;if(o.origin===t.origin&&i)return o.pathname+o.search+o.hash}return e}function ti(e,t,n,r){let o=e.createURL(Sx(t)).toString(),i={signal:n};if(r&&gn(r.formMethod)){let{formMethod:s,formEncType:a}=r;i.method=s.toUpperCase(),a==="application/json"?(i.headers=new Headers({"Content-Type":a}),i.body=JSON.stringify(r.json)):a==="text/plain"?i.body=r.text:a==="application/x-www-form-urlencoded"&&r.formData?i.body=Bf(r.formData):i.body=r.formData}return new Request(o,i)}function Bf(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function kv(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function wT(e,t,n,r,o){let i={},s=null,a,l=!1,u={},d=n&&$t(n[1])?n[1].error:void 0;return e.forEach(c=>{if(!(c.route.id in t))return;let f=c.route.id,m=t[f];if(me(!xo(m),"Cannot handle redirect results in processLoaderData"),$t(m)){let v=m.error;d!==void 0&&(v=d,d=void 0),s=s||{};{let y=mo(e,f);s[y.route.id]==null&&(s[y.route.id]=v)}i[f]=void 0,l||(l=!0,a=dc(m.error)?m.error.status:500),m.headers&&(u[f]=m.headers)}else zr(m)?(r.set(f,m.deferredData),i[f]=m.deferredData.data,m.statusCode!=null&&m.statusCode!==200&&!l&&(a=m.statusCode),m.headers&&(u[f]=m.headers)):(i[f]=m.data,m.statusCode&&m.statusCode!==200&&!l&&(a=m.statusCode),m.headers&&(u[f]=m.headers))}),d!==void 0&&n&&(s={[n[0]]:d},i[n[0]]=void 0),{loaderData:i,errors:s,statusCode:a||200,loaderHeaders:u}}function Nv(e,t,n,r,o,i,s){let{loaderData:a,errors:l}=wT(t,n,r,s);return o.forEach(u=>{let{key:d,match:c,controller:f}=u,m=i[d];if(me(m,"Did not find corresponding fetcher result"),!(f&&f.signal.aborted))if($t(m)){let v=mo(e.matches,c==null?void 0:c.route.id);l&&l[v.route.id]||(l=Ie({},l,{[v.route.id]:m.error})),e.fetchers.delete(d)}else if(xo(m))me(!1,"Unhandled fetcher revalidation redirect");else if(zr(m))me(!1,"Unhandled fetcher deferred data");else{let v=Sr(m.data);e.fetchers.set(d,v)}}),{loaderData:a,errors:l}}function jv(e,t,n,r){let o=Ie({},t);for(let i of n){let s=i.route.id;if(t.hasOwnProperty(s)?t[s]!==void 0&&(o[s]=t[s]):e[s]!==void 0&&i.route.loader&&(o[s]=e[s]),r&&r.hasOwnProperty(s))break}return o}function Ov(e){return e?$t(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function mo(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function Dv(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Pt(e,t){let{pathname:n,routeId:r,method:o,type:i,message:s}=t===void 0?{}:t,a="Unknown Server Error",l="Unknown @remix-run/router error";return e===400?(a="Bad Request",o&&n&&r?l="You made a "+o+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":i==="defer-action"?l="defer() is not supported in actions":i==="invalid-body"&&(l="Unable to encode submission body")):e===403?(a="Forbidden",l='Route "'+r+'" does not match URL "'+n+'"'):e===404?(a="Not Found",l='No route matches URL "'+n+'"'):e===405&&(a="Method Not Allowed",o&&n&&r?l="You made a "+o.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":o&&(l='Invalid request method "'+o.toUpperCase()+'"')),new Tu(e||500,a,new Error(l),!0)}function xl(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,o]=t[n];if(xo(o))return{key:r,result:o}}}function Sx(e){let t=typeof e=="string"?fr(e):e;return Io(Ie({},t,{hash:""}))}function xT(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function ST(e){return Cx(e.result)&&sT.has(e.result.status)}function zr(e){return e.type===Me.deferred}function $t(e){return e.type===Me.error}function xo(e){return(e&&e.type)===Me.redirect}function Iv(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function CT(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function Cx(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function bT(e){return iT.has(e.toLowerCase())}function gn(e){return rT.has(e.toLowerCase())}async function RT(e,t,n,r,o){let i=Object.entries(t);for(let s=0;s(f==null?void 0:f.route.id)===a);if(!u)continue;let d=r.find(f=>f.route.id===u.route.id),c=d!=null&&!wx(d,u)&&(o&&o[u.route.id])!==void 0;zr(l)&&c&&await Dh(l,n,!1).then(f=>{f&&(t[a]=f)})}}async function ET(e,t,n){for(let r=0;r(u==null?void 0:u.route.id)===i)&&zr(a)&&(me(s,"Expected an AbortController for revalidating fetcher deferred result"),await Dh(a,s.signal,!0).then(u=>{u&&(t[o]=u)}))}}async function Dh(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:Me.data,data:e.deferredData.unwrappedData}}catch(o){return{type:Me.error,error:o}}return{type:Me.data,data:e.deferredData.data}}}function Ih(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Is(e,t){let n=typeof t=="string"?fr(t).search:t.search;if(e[e.length-1].route.index&&Ih(n||""))return e[e.length-1];let r=mx(e);return r[r.length-1]}function Fv(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:i,json:s}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(s!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:s,text:void 0}}}function md(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function PT(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function _s(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 _T(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 Sr(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 TT(e,t){try{let n=e.sessionStorage.getItem(yx);if(n){let r=JSON.parse(n);for(let[o,i]of Object.entries(r||{}))i&&Array.isArray(i)&&t.set(o,new Set(i||[]))}}catch{}}function AT(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(yx,JSON.stringify(n))}catch(r){Do(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/** + */function Ie(){return Ie=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function Do(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function F_(){return Math.random().toString(36).substr(2,8)}function bv(e,t){return{usr:e.state,key:e.key,idx:t}}function ya(e,t,n,r){return n===void 0&&(n=null),Ie({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?fr(t):t,{state:n,key:t&&t.key||r||F_()})}function Io(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function fr(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function L_(e,t,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:i=!1}=r,s=o.history,a=Xe.Pop,l=null,u=d();u==null&&(u=0,s.replaceState(Ie({},s.state,{idx:u}),""));function d(){return(s.state||{idx:null}).idx}function c(){a=Xe.Pop;let x=d(),w=x==null?null:x-u;u=x,l&&l({action:a,location:y.location,delta:w})}function f(x,w){a=Xe.Push;let g=ya(y.location,x,w);n&&n(g,x),u=d()+1;let S=bv(g,u),C=y.createHref(g);try{s.pushState(S,"",C)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;o.location.assign(C)}i&&l&&l({action:a,location:y.location,delta:1})}function m(x,w){a=Xe.Replace;let g=ya(y.location,x,w);n&&n(g,x),u=d();let S=bv(g,u),C=y.createHref(g);s.replaceState(S,"",C),i&&l&&l({action:a,location:y.location,delta:0})}function v(x){let w=o.location.origin!=="null"?o.location.origin:o.location.href,g=typeof x=="string"?x:Io(x);return g=g.replace(/ $/,"%20"),me(w,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,w)}let y={get action(){return a},get location(){return e(o,s)},listen(x){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(Cv,c),l=x,()=>{o.removeEventListener(Cv,c),l=null}},createHref(x){return t(o,x)},createURL:v,encodeLocation(x){let w=v(x);return{pathname:w.pathname,search:w.search,hash:w.hash}},push:f,replace:m,go(x){return s.go(x)}};return y}var Me;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Me||(Me={}));const $_=new Set(["lazy","caseSensitive","path","id","index","children"]);function U_(e){return e.index===!0}function _u(e,t,n,r){return n===void 0&&(n=[]),r===void 0&&(r={}),e.map((o,i)=>{let s=[...n,String(i)],a=typeof o.id=="string"?o.id:s.join("-");if(me(o.index!==!0||!o.children,"Cannot specify children on an index route"),me(!r[a],'Found a route id collision on id "'+a+`". Route id's must be globally unique within Data Router usages`),U_(o)){let l=Ie({},o,t(o),{id:a});return r[a]=l,l}else{let l=Ie({},o,t(o),{id:a,children:void 0});return r[a]=l,o.children&&(l.children=_u(o.children,t,s,r)),l}})}function go(e,t,n){return n===void 0&&(n="/"),Wl(e,t,n,!1)}function Wl(e,t,n,r){let o=typeof t=="string"?fr(t):t,i=is(o.pathname||"/",n);if(i==null)return null;let s=mx(e);B_(s);let a=null;for(let l=0;a==null&&l{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};l.relativePath.startsWith("/")&&(me(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=nr([r,l.relativePath]),d=n.concat(l);i.children&&i.children.length>0&&(me(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),mx(i.children,t,d,u)),!(i.path==null&&!i.index)&&t.push({path:u,score:Q_(u,i.index),routesMeta:d})};return e.forEach((i,s)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))o(i,s);else for(let l of vx(i.path))o(i,s,l)}),t}function vx(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let s=vx(r.join("/")),a=[];return a.push(...s.map(l=>l===""?i:[i,l].join("/"))),o&&a.push(...s),a.map(l=>e.startsWith("/")&&l===""?"/":l)}function B_(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:Y_(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const V_=/^:[\w-]+$/,H_=3,K_=2,G_=1,W_=10,q_=-2,Rv=e=>e==="*";function Q_(e,t){let n=e.split("/"),r=n.length;return n.some(Rv)&&(r+=q_),t&&(r+=K_),n.filter(o=>!Rv(o)).reduce((o,i)=>o+(V_.test(i)?H_:i===""?G_:W_),r)}function Y_(e,t){return e.length===t.length&&e.slice(0,-1).every((r,o)=>r===t[o])?e[e.length-1]-t[t.length-1]:0}function X_(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,o={},i="/",s=[];for(let a=0;a{let{paramName:f,isOptional:m}=d;if(f==="*"){let y=a[c]||"";s=i.slice(0,i.length-y.length).replace(/(.)\/+$/,"$1")}const v=a[c];return m&&!v?u[f]=void 0:u[f]=(v||"").replace(/%2F/g,"/"),u},{}),pathname:i,pathnameBase:s,pattern:e}}function J_(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),Do(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],o="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,a,l)=>(r.push({paramName:a,isOptional:l!=null}),l?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),o+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":e!==""&&e!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,t?void 0:"i"),r]}function Z_(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return Do(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function is(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 eT(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:o=""}=typeof e=="string"?fr(e):e;return{pathname:n?n.startsWith("/")?n:tT(n,t):t,search:rT(r),hash:oT(o)}}function tT(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(o=>{o===".."?n.length>1&&n.pop():o!=="."&&n.push(o)}),n.length>1?n.join("/"):"/"}function hd(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 and the router will parse it for you.'}function yx(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function uc(e,t){let n=yx(e);return t?n.map((r,o)=>o===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function cc(e,t,n,r){r===void 0&&(r=!1);let o;typeof e=="string"?o=fr(e):(o=Ie({},e),me(!o.pathname||!o.pathname.includes("?"),hd("?","pathname","search",o)),me(!o.pathname||!o.pathname.includes("#"),hd("#","pathname","hash",o)),me(!o.search||!o.search.includes("#"),hd("#","search","hash",o)));let i=e===""||o.pathname==="",s=i?"/":o.pathname,a;if(s==null)a=n;else{let c=t.length-1;if(!r&&s.startsWith("..")){let f=s.split("/");for(;f[0]==="..";)f.shift(),c-=1;o.pathname=f.join("/")}a=c>=0?t[c]:"/"}let l=eT(o,a),u=s&&s!=="/"&&s.endsWith("/"),d=(i||s===".")&&n.endsWith("/");return!l.pathname.endsWith("/")&&(u||d)&&(l.pathname+="/"),l}const nr=e=>e.join("/").replace(/\/\/+/g,"/"),nT=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),rT=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,oT=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class Tu{constructor(t,n,r,o){o===void 0&&(o=!1),this.status=t,this.statusText=n||"",this.internal=o,r instanceof Error?(this.data=r.toString(),this.error=r):this.data=r}}function dc(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const wx=["post","put","patch","delete"],iT=new Set(wx),sT=["get",...wx],aT=new Set(sT),lT=new Set([301,302,303,307,308]),uT=new Set([307,308]),gd={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},cT={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Ps={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},Dh=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,dT=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),xx="remix-router-transitions";function fT(e){const t=e.window?e.window:typeof window<"u"?window:void 0,n=typeof t<"u"&&typeof t.document<"u"&&typeof t.document.createElement<"u",r=!n;me(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let o;if(e.mapRouteProperties)o=e.mapRouteProperties;else if(e.detectErrorBoundary){let k=e.detectErrorBoundary;o=I=>({hasErrorBoundary:k(I)})}else o=dT;let i={},s=_u(e.routes,o,void 0,i),a,l=e.basename||"/",u=e.dataStrategy||mT,d=e.patchRoutesOnNavigation,c=Ie({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1,v7_skipActionErrorRevalidation:!1},e.future),f=null,m=new Set,v=null,y=null,x=null,w=e.hydrationData!=null,g=go(s,e.history.location,l),S=null;if(g==null&&!d){let k=Pt(404,{pathname:e.history.location.pathname}),{matches:I,route:U}=Iv(s);g=I,S={[U.id]:k}}g&&!e.hydrationData&&Ja(g,s,e.history.location.pathname).active&&(g=null);let C;if(g)if(g.some(k=>k.route.lazy))C=!1;else if(!g.some(k=>k.route.loader))C=!0;else if(c.v7_partialHydration){let k=e.hydrationData?e.hydrationData.loaderData:null,I=e.hydrationData?e.hydrationData.errors:null;if(I){let U=g.findIndex(H=>I[H.route.id]!==void 0);C=g.slice(0,U+1).every(H=>!zf(H.route,k,I))}else C=g.every(U=>!zf(U.route,k,I))}else C=e.hydrationData!=null;else if(C=!1,g=[],c.v7_partialHydration){let k=Ja(null,s,e.history.location.pathname);k.active&&k.matches&&(g=k.matches)}let P,b={historyAction:e.history.action,location:e.history.location,matches:g,initialized:C,navigation:gd,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||S,fetchers:new Map,blockers:new Map},M=Xe.Pop,A=!1,$,R=!1,O=new Map,F=null,N=!1,E=!1,T=[],D=new Set,V=new Map,L=0,j=-1,B=new Map,Q=new Set,te=new Map,fe=new Map,ge=new Set,z=new Map,W=new Map,pe;function Te(){if(f=e.history.listen(k=>{let{action:I,location:U,delta:H}=k;if(pe){pe(),pe=void 0;return}Do(W.size===0||H!=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 X=lm({currentLocation:b.location,nextLocation:U,historyAction:I});if(X&&H!=null){let oe=new Promise(ce=>{pe=ce});e.history.go(H*-1),Xa(X,{state:"blocked",location:U,proceed(){Xa(X,{state:"proceeding",proceed:void 0,reset:void 0,location:U}),oe.then(()=>e.history.go(H))},reset(){let ce=new Map(b.blockers);ce.set(X,Ps),Ce({blockers:ce})}});return}return nt(I,U)}),n){MT(t,O);let k=()=>kT(t,O);t.addEventListener("pagehide",k),F=()=>t.removeEventListener("pagehide",k)}return b.initialized||nt(Xe.Pop,b.location,{initialHydration:!0}),P}function we(){f&&f(),F&&F(),m.clear(),$&&$.abort(),b.fetchers.forEach((k,I)=>Ya(I)),b.blockers.forEach((k,I)=>am(I))}function tt(k){return m.add(k),()=>m.delete(k)}function Ce(k,I){I===void 0&&(I={}),b=Ie({},b,k);let U=[],H=[];c.v7_fetcherPersist&&b.fetchers.forEach((X,oe)=>{X.state==="idle"&&(ge.has(oe)?H.push(oe):U.push(oe))}),[...m].forEach(X=>X(b,{deletedFetchers:H,viewTransitionOpts:I.viewTransitionOpts,flushSync:I.flushSync===!0})),c.v7_fetcherPersist&&(U.forEach(X=>b.fetchers.delete(X)),H.forEach(X=>Ya(X)))}function it(k,I,U){var H,X;let{flushSync:oe}=U===void 0?{}:U,ce=b.actionData!=null&&b.navigation.formMethod!=null&&gn(b.navigation.formMethod)&&b.navigation.state==="loading"&&((H=k.state)==null?void 0:H._isRedirect)!==!0,Z;I.actionData?Object.keys(I.actionData).length>0?Z=I.actionData:Z=null:ce?Z=b.actionData:Z=null;let ee=I.loaderData?Ov(b.loaderData,I.loaderData,I.matches||[],I.errors):b.loaderData,J=b.blockers;J.size>0&&(J=new Map(J),J.forEach((be,st)=>J.set(st,Ps)));let ie=A===!0||b.navigation.formMethod!=null&&gn(b.navigation.formMethod)&&((X=k.state)==null?void 0:X._isRedirect)!==!0;a&&(s=a,a=void 0),N||M===Xe.Pop||(M===Xe.Push?e.history.push(k,k.state):M===Xe.Replace&&e.history.replace(k,k.state));let ye;if(M===Xe.Pop){let be=O.get(b.location.pathname);be&&be.has(k.pathname)?ye={currentLocation:b.location,nextLocation:k}:O.has(k.pathname)&&(ye={currentLocation:k,nextLocation:b.location})}else if(R){let be=O.get(b.location.pathname);be?be.add(k.pathname):(be=new Set([k.pathname]),O.set(b.location.pathname,be)),ye={currentLocation:b.location,nextLocation:k}}Ce(Ie({},I,{actionData:Z,loaderData:ee,historyAction:M,location:k,initialized:!0,navigation:gd,revalidation:"idle",restoreScrollPosition:cm(k,I.matches||b.matches),preventScrollReset:ie,blockers:J}),{viewTransitionOpts:ye,flushSync:oe===!0}),M=Xe.Pop,A=!1,R=!1,N=!1,E=!1,T=[]}async function Ot(k,I){if(typeof k=="number"){e.history.go(k);return}let U=Uf(b.location,b.matches,l,c.v7_prependBasename,k,c.v7_relativeSplatPath,I==null?void 0:I.fromRouteId,I==null?void 0:I.relative),{path:H,submission:X,error:oe}=Pv(c.v7_normalizeFormMethod,!1,U,I),ce=b.location,Z=ya(b.location,H,I&&I.state);Z=Ie({},Z,e.history.encodeLocation(Z));let ee=I&&I.replace!=null?I.replace:void 0,J=Xe.Push;ee===!0?J=Xe.Replace:ee===!1||X!=null&&gn(X.formMethod)&&X.formAction===b.location.pathname+b.location.search&&(J=Xe.Replace);let ie=I&&"preventScrollReset"in I?I.preventScrollReset===!0:void 0,ye=(I&&I.flushSync)===!0,be=lm({currentLocation:ce,nextLocation:Z,historyAction:J});if(be){Xa(be,{state:"blocked",location:Z,proceed(){Xa(be,{state:"proceeding",proceed:void 0,reset:void 0,location:Z}),Ot(k,I)},reset(){let st=new Map(b.blockers);st.set(be,Ps),Ce({blockers:st})}});return}return await nt(J,Z,{submission:X,pendingError:oe,preventScrollReset:ie,replace:I&&I.replace,enableViewTransition:I&&I.viewTransition,flushSync:ye})}function $e(){if(Fc(),Ce({revalidation:"loading"}),b.navigation.state!=="submitting"){if(b.navigation.state==="idle"){nt(b.historyAction,b.location,{startUninterruptedRevalidation:!0});return}nt(M||b.historyAction,b.navigation.location,{overrideNavigation:b.navigation,enableViewTransition:R===!0})}}async function nt(k,I,U){$&&$.abort(),$=null,M=k,N=(U&&U.startUninterruptedRevalidation)===!0,oE(b.location,b.matches),A=(U&&U.preventScrollReset)===!0,R=(U&&U.enableViewTransition)===!0;let H=a||s,X=U&&U.overrideNavigation,oe=go(H,I,l),ce=(U&&U.flushSync)===!0,Z=Ja(oe,H,I.pathname);if(Z.active&&Z.matches&&(oe=Z.matches),!oe){let{error:ke,notFoundMatches:Pe,route:He}=Lc(I.pathname);it(I,{matches:Pe,loaderData:{},errors:{[He.id]:ke}},{flushSync:ce});return}if(b.initialized&&!E&&CT(b.location,I)&&!(U&&U.submission&&gn(U.submission.formMethod))){it(I,{matches:oe},{flushSync:ce});return}$=new AbortController;let ee=ti(e.history,I,$.signal,U&&U.submission),J;if(U&&U.pendingError)J=[mo(oe).route.id,{type:Me.error,error:U.pendingError}];else if(U&&U.submission&&gn(U.submission.formMethod)){let ke=await cn(ee,I,U.submission,oe,Z.active,{replace:U.replace,flushSync:ce});if(ke.shortCircuited)return;if(ke.pendingActionResult){let[Pe,He]=ke.pendingActionResult;if($t(He)&&dc(He.error)&&He.error.status===404){$=null,it(I,{matches:ke.matches,loaderData:{},errors:{[Pe]:He.error}});return}}oe=ke.matches||oe,J=ke.pendingActionResult,X=md(I,U.submission),ce=!1,Z.active=!1,ee=ti(e.history,ee.url,ee.signal)}let{shortCircuited:ie,matches:ye,loaderData:be,errors:st}=await Ic(ee,I,oe,Z.active,X,U&&U.submission,U&&U.fetcherSubmission,U&&U.replace,U&&U.initialHydration===!0,ce,J);ie||($=null,it(I,Ie({matches:ye||oe},Dv(J),{loaderData:be,errors:st})))}async function cn(k,I,U,H,X,oe){oe===void 0&&(oe={}),Fc();let ce=TT(I,U);if(Ce({navigation:ce},{flushSync:oe.flushSync===!0}),X){let J=await Za(H,I.pathname,k.signal);if(J.type==="aborted")return{shortCircuited:!0};if(J.type==="error"){let ie=mo(J.partialMatches).route.id;return{matches:J.partialMatches,pendingActionResult:[ie,{type:Me.error,error:J.error}]}}else if(J.matches)H=J.matches;else{let{notFoundMatches:ie,error:ye,route:be}=Lc(I.pathname);return{matches:ie,pendingActionResult:[be.id,{type:Me.error,error:ye}]}}}let Z,ee=Is(H,I);if(!ee.route.action&&!ee.route.lazy)Z={type:Me.error,error:Pt(405,{method:k.method,pathname:I.pathname,routeId:ee.route.id})};else if(Z=(await hs("action",b,k,[ee],H,null))[ee.route.id],k.signal.aborted)return{shortCircuited:!0};if(xo(Z)){let J;return oe&&oe.replace!=null?J=oe.replace:J=kv(Z.response.headers.get("Location"),new URL(k.url),l)===b.location.pathname+b.location.search,await lo(k,Z,!0,{submission:U,replace:J}),{shortCircuited:!0}}if(zr(Z))throw Pt(400,{type:"defer-action"});if($t(Z)){let J=mo(H,ee.route.id);return(oe&&oe.replace)!==!0&&(M=Xe.Push),{matches:H,pendingActionResult:[J.route.id,Z]}}return{matches:H,pendingActionResult:[ee.route.id,Z]}}async function Ic(k,I,U,H,X,oe,ce,Z,ee,J,ie){let ye=X||md(I,oe),be=oe||ce||Lv(ye),st=!N&&(!c.v7_partialHydration||!ee);if(H){if(st){let Ke=Qa(ie);Ce(Ie({navigation:ye},Ke!==void 0?{actionData:Ke}:{}),{flushSync:J})}let Ee=await Za(U,I.pathname,k.signal);if(Ee.type==="aborted")return{shortCircuited:!0};if(Ee.type==="error"){let Ke=mo(Ee.partialMatches).route.id;return{matches:Ee.partialMatches,loaderData:{},errors:{[Ke]:Ee.error}}}else if(Ee.matches)U=Ee.matches;else{let{error:Ke,notFoundMatches:Jo,route:vs}=Lc(I.pathname);return{matches:Jo,loaderData:{},errors:{[vs.id]:Ke}}}}let ke=a||s,[Pe,He]=Tv(e.history,b,U,be,I,c.v7_partialHydration&&ee===!0,c.v7_skipActionErrorRevalidation,E,T,D,ge,te,Q,ke,l,ie);if($c(Ee=>!(U&&U.some(Ke=>Ke.route.id===Ee))||Pe&&Pe.some(Ke=>Ke.route.id===Ee)),j=++L,Pe.length===0&&He.length===0){let Ee=im();return it(I,Ie({matches:U,loaderData:{},errors:ie&&$t(ie[1])?{[ie[0]]:ie[1].error}:null},Dv(ie),Ee?{fetchers:new Map(b.fetchers)}:{}),{flushSync:J}),{shortCircuited:!0}}if(st){let Ee={};if(!H){Ee.navigation=ye;let Ke=Qa(ie);Ke!==void 0&&(Ee.actionData=Ke)}He.length>0&&(Ee.fetchers=Yo(He)),Ce(Ee,{flushSync:J})}He.forEach(Ee=>{mr(Ee.key),Ee.controller&&V.set(Ee.key,Ee.controller)});let Xo=()=>He.forEach(Ee=>mr(Ee.key));$&&$.signal.addEventListener("abort",Xo);let{loaderResults:gs,fetcherResults:Kn}=await nm(b,U,Pe,He,k);if(k.signal.aborted)return{shortCircuited:!0};$&&$.signal.removeEventListener("abort",Xo),He.forEach(Ee=>V.delete(Ee.key));let Pn=xl(gs);if(Pn)return await lo(k,Pn.result,!0,{replace:Z}),{shortCircuited:!0};if(Pn=xl(Kn),Pn)return Q.add(Pn.key),await lo(k,Pn.result,!0,{replace:Z}),{shortCircuited:!0};let{loaderData:Uc,errors:ms}=jv(b,U,gs,ie,He,Kn,z);z.forEach((Ee,Ke)=>{Ee.subscribe(Jo=>{(Jo||Ee.done)&&z.delete(Ke)})}),c.v7_partialHydration&&ee&&b.errors&&(ms=Ie({},b.errors,ms));let uo=im(),el=sm(j),tl=uo||el||He.length>0;return Ie({matches:U,loaderData:Uc,errors:ms},tl?{fetchers:new Map(b.fetchers)}:{})}function Qa(k){if(k&&!$t(k[1]))return{[k[0]]:k[1].data};if(b.actionData)return Object.keys(b.actionData).length===0?null:b.actionData}function Yo(k){return k.forEach(I=>{let U=b.fetchers.get(I.key),H=_s(void 0,U?U.data:void 0);b.fetchers.set(I.key,H)}),new Map(b.fetchers)}function JR(k,I,U,H){if(r)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");mr(k);let X=(H&&H.flushSync)===!0,oe=a||s,ce=Uf(b.location,b.matches,l,c.v7_prependBasename,U,c.v7_relativeSplatPath,I,H==null?void 0:H.relative),Z=go(oe,ce,l),ee=Ja(Z,oe,ce);if(ee.active&&ee.matches&&(Z=ee.matches),!Z){Hn(k,I,Pt(404,{pathname:ce}),{flushSync:X});return}let{path:J,submission:ie,error:ye}=Pv(c.v7_normalizeFormMethod,!0,ce,H);if(ye){Hn(k,I,ye,{flushSync:X});return}let be=Is(Z,J),st=(H&&H.preventScrollReset)===!0;if(ie&&gn(ie.formMethod)){ZR(k,I,J,be,Z,ee.active,X,st,ie);return}te.set(k,{routeId:I,path:J}),eE(k,I,J,be,Z,ee.active,X,st,ie)}async function ZR(k,I,U,H,X,oe,ce,Z,ee){Fc(),te.delete(k);function J(Ye){if(!Ye.route.action&&!Ye.route.lazy){let Zo=Pt(405,{method:ee.formMethod,pathname:U,routeId:I});return Hn(k,I,Zo,{flushSync:ce}),!0}return!1}if(!oe&&J(H))return;let ie=b.fetchers.get(k);gr(k,AT(ee,ie),{flushSync:ce});let ye=new AbortController,be=ti(e.history,U,ye.signal,ee);if(oe){let Ye=await Za(X,U,be.signal);if(Ye.type==="aborted")return;if(Ye.type==="error"){Hn(k,I,Ye.error,{flushSync:ce});return}else if(Ye.matches){if(X=Ye.matches,H=Is(X,U),J(H))return}else{Hn(k,I,Pt(404,{pathname:U}),{flushSync:ce});return}}V.set(k,ye);let st=L,Pe=(await hs("action",b,be,[H],X,k))[H.route.id];if(be.signal.aborted){V.get(k)===ye&&V.delete(k);return}if(c.v7_fetcherPersist&&ge.has(k)){if(xo(Pe)||$t(Pe)){gr(k,Sr(void 0));return}}else{if(xo(Pe))if(V.delete(k),j>st){gr(k,Sr(void 0));return}else return Q.add(k),gr(k,_s(ee)),lo(be,Pe,!1,{fetcherSubmission:ee,preventScrollReset:Z});if($t(Pe)){Hn(k,I,Pe.error);return}}if(zr(Pe))throw Pt(400,{type:"defer-action"});let He=b.navigation.location||b.location,Xo=ti(e.history,He,ye.signal),gs=a||s,Kn=b.navigation.state!=="idle"?go(gs,b.navigation.location,l):b.matches;me(Kn,"Didn't find any matches after fetcher action");let Pn=++L;B.set(k,Pn);let Uc=_s(ee,Pe.data);b.fetchers.set(k,Uc);let[ms,uo]=Tv(e.history,b,Kn,ee,He,!1,c.v7_skipActionErrorRevalidation,E,T,D,ge,te,Q,gs,l,[H.route.id,Pe]);uo.filter(Ye=>Ye.key!==k).forEach(Ye=>{let Zo=Ye.key,dm=b.fetchers.get(Zo),aE=_s(void 0,dm?dm.data:void 0);b.fetchers.set(Zo,aE),mr(Zo),Ye.controller&&V.set(Zo,Ye.controller)}),Ce({fetchers:new Map(b.fetchers)});let el=()=>uo.forEach(Ye=>mr(Ye.key));ye.signal.addEventListener("abort",el);let{loaderResults:tl,fetcherResults:Ee}=await nm(b,Kn,ms,uo,Xo);if(ye.signal.aborted)return;ye.signal.removeEventListener("abort",el),B.delete(k),V.delete(k),uo.forEach(Ye=>V.delete(Ye.key));let Ke=xl(tl);if(Ke)return lo(Xo,Ke.result,!1,{preventScrollReset:Z});if(Ke=xl(Ee),Ke)return Q.add(Ke.key),lo(Xo,Ke.result,!1,{preventScrollReset:Z});let{loaderData:Jo,errors:vs}=jv(b,Kn,tl,void 0,uo,Ee,z);if(b.fetchers.has(k)){let Ye=Sr(Pe.data);b.fetchers.set(k,Ye)}sm(Pn),b.navigation.state==="loading"&&Pn>j?(me(M,"Expected pending action"),$&&$.abort(),it(b.navigation.location,{matches:Kn,loaderData:Jo,errors:vs,fetchers:new Map(b.fetchers)})):(Ce({errors:vs,loaderData:Ov(b.loaderData,Jo,Kn,vs),fetchers:new Map(b.fetchers)}),E=!1)}async function eE(k,I,U,H,X,oe,ce,Z,ee){let J=b.fetchers.get(k);gr(k,_s(ee,J?J.data:void 0),{flushSync:ce});let ie=new AbortController,ye=ti(e.history,U,ie.signal);if(oe){let Pe=await Za(X,U,ye.signal);if(Pe.type==="aborted")return;if(Pe.type==="error"){Hn(k,I,Pe.error,{flushSync:ce});return}else if(Pe.matches)X=Pe.matches,H=Is(X,U);else{Hn(k,I,Pt(404,{pathname:U}),{flushSync:ce});return}}V.set(k,ie);let be=L,ke=(await hs("loader",b,ye,[H],X,k))[H.route.id];if(zr(ke)&&(ke=await Ih(ke,ye.signal,!0)||ke),V.get(k)===ie&&V.delete(k),!ye.signal.aborted){if(ge.has(k)){gr(k,Sr(void 0));return}if(xo(ke))if(j>be){gr(k,Sr(void 0));return}else{Q.add(k),await lo(ye,ke,!1,{preventScrollReset:Z});return}if($t(ke)){Hn(k,I,ke.error);return}me(!zr(ke),"Unhandled fetcher deferred data"),gr(k,Sr(ke.data))}}async function lo(k,I,U,H){let{submission:X,fetcherSubmission:oe,preventScrollReset:ce,replace:Z}=H===void 0?{}:H;I.response.headers.has("X-Remix-Revalidate")&&(E=!0);let ee=I.response.headers.get("Location");me(ee,"Expected a Location header on the redirect Response"),ee=kv(ee,new URL(k.url),l);let J=ya(b.location,ee,{_isRedirect:!0});if(n){let Pe=!1;if(I.response.headers.has("X-Remix-Reload-Document"))Pe=!0;else if(Dh.test(ee)){const He=e.history.createURL(ee);Pe=He.origin!==t.location.origin||is(He.pathname,l)==null}if(Pe){Z?t.location.replace(ee):t.location.assign(ee);return}}$=null;let ie=Z===!0||I.response.headers.has("X-Remix-Replace")?Xe.Replace:Xe.Push,{formMethod:ye,formAction:be,formEncType:st}=b.navigation;!X&&!oe&&ye&&be&&st&&(X=Lv(b.navigation));let ke=X||oe;if(uT.has(I.response.status)&&ke&&gn(ke.formMethod))await nt(ie,J,{submission:Ie({},ke,{formAction:ee}),preventScrollReset:ce||A,enableViewTransition:U?R:void 0});else{let Pe=md(J,X);await nt(ie,J,{overrideNavigation:Pe,fetcherSubmission:oe,preventScrollReset:ce||A,enableViewTransition:U?R:void 0})}}async function hs(k,I,U,H,X,oe){let ce,Z={};try{ce=await vT(u,k,I,U,H,X,oe,i,o)}catch(ee){return H.forEach(J=>{Z[J.route.id]={type:Me.error,error:ee}}),Z}for(let[ee,J]of Object.entries(ce))if(bT(J)){let ie=J.result;Z[ee]={type:Me.redirect,response:xT(ie,U,ee,X,l,c.v7_relativeSplatPath)}}else Z[ee]=await wT(J);return Z}async function nm(k,I,U,H,X){let oe=k.matches,ce=hs("loader",k,X,U,I,null),Z=Promise.all(H.map(async ie=>{if(ie.matches&&ie.match&&ie.controller){let be=(await hs("loader",k,ti(e.history,ie.path,ie.controller.signal),[ie.match],ie.matches,ie.key))[ie.match.route.id];return{[ie.key]:be}}else return Promise.resolve({[ie.key]:{type:Me.error,error:Pt(404,{pathname:ie.path})}})})),ee=await ce,J=(await Z).reduce((ie,ye)=>Object.assign(ie,ye),{});return await Promise.all([PT(I,ee,X.signal,oe,k.loaderData),_T(I,J,H)]),{loaderResults:ee,fetcherResults:J}}function Fc(){E=!0,T.push(...$c()),te.forEach((k,I)=>{V.has(I)&&D.add(I),mr(I)})}function gr(k,I,U){U===void 0&&(U={}),b.fetchers.set(k,I),Ce({fetchers:new Map(b.fetchers)},{flushSync:(U&&U.flushSync)===!0})}function Hn(k,I,U,H){H===void 0&&(H={});let X=mo(b.matches,I);Ya(k),Ce({errors:{[X.route.id]:U},fetchers:new Map(b.fetchers)},{flushSync:(H&&H.flushSync)===!0})}function rm(k){return c.v7_fetcherPersist&&(fe.set(k,(fe.get(k)||0)+1),ge.has(k)&&ge.delete(k)),b.fetchers.get(k)||cT}function Ya(k){let I=b.fetchers.get(k);V.has(k)&&!(I&&I.state==="loading"&&B.has(k))&&mr(k),te.delete(k),B.delete(k),Q.delete(k),ge.delete(k),D.delete(k),b.fetchers.delete(k)}function tE(k){if(c.v7_fetcherPersist){let I=(fe.get(k)||0)-1;I<=0?(fe.delete(k),ge.add(k)):fe.set(k,I)}else Ya(k);Ce({fetchers:new Map(b.fetchers)})}function mr(k){let I=V.get(k);I&&(I.abort(),V.delete(k))}function om(k){for(let I of k){let U=rm(I),H=Sr(U.data);b.fetchers.set(I,H)}}function im(){let k=[],I=!1;for(let U of Q){let H=b.fetchers.get(U);me(H,"Expected fetcher: "+U),H.state==="loading"&&(Q.delete(U),k.push(U),I=!0)}return om(k),I}function sm(k){let I=[];for(let[U,H]of B)if(H0}function nE(k,I){let U=b.blockers.get(k)||Ps;return W.get(k)!==I&&W.set(k,I),U}function am(k){b.blockers.delete(k),W.delete(k)}function Xa(k,I){let U=b.blockers.get(k)||Ps;me(U.state==="unblocked"&&I.state==="blocked"||U.state==="blocked"&&I.state==="blocked"||U.state==="blocked"&&I.state==="proceeding"||U.state==="blocked"&&I.state==="unblocked"||U.state==="proceeding"&&I.state==="unblocked","Invalid blocker state transition: "+U.state+" -> "+I.state);let H=new Map(b.blockers);H.set(k,I),Ce({blockers:H})}function lm(k){let{currentLocation:I,nextLocation:U,historyAction:H}=k;if(W.size===0)return;W.size>1&&Do(!1,"A router only supports one blocker at a time");let X=Array.from(W.entries()),[oe,ce]=X[X.length-1],Z=b.blockers.get(oe);if(!(Z&&Z.state==="proceeding")&&ce({currentLocation:I,nextLocation:U,historyAction:H}))return oe}function Lc(k){let I=Pt(404,{pathname:k}),U=a||s,{matches:H,route:X}=Iv(U);return $c(),{notFoundMatches:H,route:X,error:I}}function $c(k){let I=[];return z.forEach((U,H)=>{(!k||k(H))&&(U.cancel(),I.push(H),z.delete(H))}),I}function rE(k,I,U){if(v=k,x=I,y=U||null,!w&&b.navigation===gd){w=!0;let H=cm(b.location,b.matches);H!=null&&Ce({restoreScrollPosition:H})}return()=>{v=null,x=null,y=null}}function um(k,I){return y&&y(k,I.map(H=>z_(H,b.loaderData)))||k.key}function oE(k,I){if(v&&x){let U=um(k,I);v[U]=x()}}function cm(k,I){if(v){let U=um(k,I),H=v[U];if(typeof H=="number")return H}return null}function Ja(k,I,U){if(d)if(k){if(Object.keys(k[0].params).length>0)return{active:!0,matches:Wl(I,U,l,!0)}}else return{active:!0,matches:Wl(I,U,l,!0)||[]};return{active:!1,matches:null}}async function Za(k,I,U){if(!d)return{type:"success",matches:k};let H=k;for(;;){let X=a==null,oe=a||s,ce=i;try{await d({path:I,matches:H,patch:(J,ie)=>{U.aborted||Mv(J,ie,oe,ce,o)}})}catch(J){return{type:"error",error:J,partialMatches:H}}finally{X&&!U.aborted&&(s=[...s])}if(U.aborted)return{type:"aborted"};let Z=go(oe,I,l);if(Z)return{type:"success",matches:Z};let ee=Wl(oe,I,l,!0);if(!ee||H.length===ee.length&&H.every((J,ie)=>J.route.id===ee[ie].route.id))return{type:"success",matches:null};H=ee}}function iE(k){i={},a=_u(k,o,void 0,i)}function sE(k,I){let U=a==null;Mv(k,I,a||s,i,o),U&&(s=[...s],Ce({}))}return P={get basename(){return l},get future(){return c},get state(){return b},get routes(){return s},get window(){return t},initialize:Te,subscribe:tt,enableScrollRestoration:rE,navigate:Ot,fetch:JR,revalidate:$e,createHref:k=>e.history.createHref(k),encodeLocation:k=>e.history.encodeLocation(k),getFetcher:rm,deleteFetcher:tE,dispose:we,getBlocker:nE,deleteBlocker:am,patchRoutes:sE,_internalFetchControllers:V,_internalActiveDeferreds:z,_internalSetRoutes:iE},P}function pT(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function Uf(e,t,n,r,o,i,s,a){let l,u;if(s){l=[];for(let c of t)if(l.push(c),c.route.id===s){u=c;break}}else l=t,u=t[t.length-1];let d=cc(o||".",uc(l,i),is(e.pathname,n)||e.pathname,a==="path");if(o==null&&(d.search=e.search,d.hash=e.hash),(o==null||o===""||o===".")&&u){let c=Fh(d.search);if(u.route.index&&!c)d.search=d.search?d.search.replace(/^\?/,"?index&"):"?index";else if(!u.route.index&&c){let f=new URLSearchParams(d.search),m=f.getAll("index");f.delete("index"),m.filter(y=>y).forEach(y=>f.append("index",y));let v=f.toString();d.search=v?"?"+v:""}}return r&&n!=="/"&&(d.pathname=d.pathname==="/"?n:nr([n,d.pathname])),Io(d)}function Pv(e,t,n,r){if(!r||!pT(r))return{path:n};if(r.formMethod&&!ET(r.formMethod))return{path:n,error:Pt(405,{method:r.formMethod})};let o=()=>({path:n,error:Pt(400,{type:"invalid-body"})}),i=r.formMethod||"get",s=e?i.toUpperCase():i.toLowerCase(),a=bx(n);if(r.body!==void 0){if(r.formEncType==="text/plain"){if(!gn(s))return o();let f=typeof r.body=="string"?r.body:r.body instanceof FormData||r.body instanceof URLSearchParams?Array.from(r.body.entries()).reduce((m,v)=>{let[y,x]=v;return""+m+y+"="+x+` +`},""):String(r.body);return{path:n,submission:{formMethod:s,formAction:a,formEncType:r.formEncType,formData:void 0,json:void 0,text:f}}}else if(r.formEncType==="application/json"){if(!gn(s))return o();try{let f=typeof r.body=="string"?JSON.parse(r.body):r.body;return{path:n,submission:{formMethod:s,formAction:a,formEncType:r.formEncType,formData:void 0,json:f,text:void 0}}}catch{return o()}}}me(typeof FormData=="function","FormData is not available in this environment");let l,u;if(r.formData)l=Bf(r.formData),u=r.formData;else if(r.body instanceof FormData)l=Bf(r.body),u=r.body;else if(r.body instanceof URLSearchParams)l=r.body,u=Nv(l);else if(r.body==null)l=new URLSearchParams,u=new FormData;else try{l=new URLSearchParams(r.body),u=Nv(l)}catch{return o()}let d={formMethod:s,formAction:a,formEncType:r&&r.formEncType||"application/x-www-form-urlencoded",formData:u,json:void 0,text:void 0};if(gn(d.formMethod))return{path:n,submission:d};let c=fr(n);return t&&c.search&&Fh(c.search)&&l.append("index",""),c.search="?"+l,{path:Io(c),submission:d}}function _v(e,t,n){n===void 0&&(n=!1);let r=e.findIndex(o=>o.route.id===t);return r>=0?e.slice(0,n?r+1:r):e}function Tv(e,t,n,r,o,i,s,a,l,u,d,c,f,m,v,y){let x=y?$t(y[1])?y[1].error:y[1].data:void 0,w=e.createURL(t.location),g=e.createURL(o),S=n;i&&t.errors?S=_v(n,Object.keys(t.errors)[0],!0):y&&$t(y[1])&&(S=_v(n,y[0]));let C=y?y[1].statusCode:void 0,P=s&&C&&C>=400,b=S.filter((A,$)=>{let{route:R}=A;if(R.lazy)return!0;if(R.loader==null)return!1;if(i)return zf(R,t.loaderData,t.errors);if(hT(t.loaderData,t.matches[$],A)||l.some(N=>N===A.route.id))return!0;let O=t.matches[$],F=A;return Av(A,Ie({currentUrl:w,currentParams:O.params,nextUrl:g,nextParams:F.params},r,{actionResult:x,actionStatus:C,defaultShouldRevalidate:P?!1:a||w.pathname+w.search===g.pathname+g.search||w.search!==g.search||Sx(O,F)}))}),M=[];return c.forEach((A,$)=>{if(i||!n.some(E=>E.route.id===A.routeId)||d.has($))return;let R=go(m,A.path,v);if(!R){M.push({key:$,routeId:A.routeId,path:A.path,matches:null,match:null,controller:null});return}let O=t.fetchers.get($),F=Is(R,A.path),N=!1;f.has($)?N=!1:u.has($)?(u.delete($),N=!0):O&&O.state!=="idle"&&O.data===void 0?N=a:N=Av(F,Ie({currentUrl:w,currentParams:t.matches[t.matches.length-1].params,nextUrl:g,nextParams:n[n.length-1].params},r,{actionResult:x,actionStatus:C,defaultShouldRevalidate:P?!1:a})),N&&M.push({key:$,routeId:A.routeId,path:A.path,matches:R,match:F,controller:new AbortController})}),[b,M]}function zf(e,t,n){if(e.lazy)return!0;if(!e.loader)return!1;let r=t!=null&&t[e.id]!==void 0,o=n!=null&&n[e.id]!==void 0;return!r&&o?!1:typeof e.loader=="function"&&e.loader.hydrate===!0?!0:!r&&!o}function hT(e,t,n){let r=!t||n.route.id!==t.route.id,o=e[n.route.id]===void 0;return r||o}function Sx(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith("*")&&e.params["*"]!==t.params["*"]}function Av(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n=="boolean")return n}return t.defaultShouldRevalidate}function Mv(e,t,n,r,o){var i;let s;if(e){let u=r[e];me(u,"No route found to patch children into: routeId = "+e),u.children||(u.children=[]),s=u.children}else s=n;let a=t.filter(u=>!s.some(d=>Cx(u,d))),l=_u(a,o,[e||"_","patch",String(((i=s)==null?void 0:i.length)||"0")],r);s.push(...l)}function Cx(e,t){return"id"in e&&"id"in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children.every((n,r)=>{var o;return(o=t.children)==null?void 0:o.some(i=>Cx(n,i))}):!1}async function gT(e,t,n){if(!e.lazy)return;let r=await e.lazy();if(!e.lazy)return;let o=n[e.id];me(o,"No route found in manifest");let i={};for(let s in r){let l=o[s]!==void 0&&s!=="hasErrorBoundary";Do(!l,'Route "'+o.id+'" has a static property "'+s+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+s+'" will be ignored.')),!l&&!$_.has(s)&&(i[s]=r[s])}Object.assign(o,i),Object.assign(o,Ie({},t(o),{lazy:void 0}))}async function mT(e){let{matches:t}=e,n=t.filter(o=>o.shouldLoad);return(await Promise.all(n.map(o=>o.resolve()))).reduce((o,i,s)=>Object.assign(o,{[n[s].route.id]:i}),{})}async function vT(e,t,n,r,o,i,s,a,l,u){let d=i.map(m=>m.route.lazy?gT(m.route,l,a):void 0),c=i.map((m,v)=>{let y=d[v],x=o.some(g=>g.route.id===m.route.id);return Ie({},m,{shouldLoad:x,resolve:async g=>(g&&r.method==="GET"&&(m.route.lazy||m.route.loader)&&(x=!0),x?yT(t,r,m,y,g,u):Promise.resolve({type:Me.data,result:void 0}))})}),f=await e({matches:c,request:r,params:i[0].params,fetcherKey:s,context:u});try{await Promise.all(d)}catch{}return f}async function yT(e,t,n,r,o,i){let s,a,l=u=>{let d,c=new Promise((v,y)=>d=y);a=()=>d(),t.signal.addEventListener("abort",a);let f=v=>typeof u!="function"?Promise.reject(new Error("You cannot call the handler for a route which defines a boolean "+('"'+e+'" [routeId: '+n.route.id+"]"))):u({request:t,params:n.params,context:i},...v!==void 0?[v]:[]),m=(async()=>{try{return{type:"data",result:await(o?o(y=>f(y)):f())}}catch(v){return{type:"error",result:v}}})();return Promise.race([m,c])};try{let u=n.route[e];if(r)if(u){let d,[c]=await Promise.all([l(u).catch(f=>{d=f}),r]);if(d!==void 0)throw d;s=c}else if(await r,u=n.route[e],u)s=await l(u);else if(e==="action"){let d=new URL(t.url),c=d.pathname+d.search;throw Pt(405,{method:t.method,pathname:c,routeId:n.route.id})}else return{type:Me.data,result:void 0};else if(u)s=await l(u);else{let d=new URL(t.url),c=d.pathname+d.search;throw Pt(404,{pathname:c})}me(s.result!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+n.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(u){return{type:Me.error,result:u}}finally{a&&t.signal.removeEventListener("abort",a)}return s}async function wT(e){let{result:t,type:n}=e;if(Rx(t)){let u;try{let d=t.headers.get("Content-Type");d&&/\bapplication\/json\b/.test(d)?t.body==null?u=null:u=await t.json():u=await t.text()}catch(d){return{type:Me.error,error:d}}return n===Me.error?{type:Me.error,error:new Tu(t.status,t.statusText,u),statusCode:t.status,headers:t.headers}:{type:Me.data,data:u,statusCode:t.status,headers:t.headers}}if(n===Me.error){if(Fv(t)){var r;if(t.data instanceof Error){var o;return{type:Me.error,error:t.data,statusCode:(o=t.init)==null?void 0:o.status}}t=new Tu(((r=t.init)==null?void 0:r.status)||500,void 0,t.data)}return{type:Me.error,error:t,statusCode:dc(t)?t.status:void 0}}if(RT(t)){var i,s;return{type:Me.deferred,deferredData:t,statusCode:(i=t.init)==null?void 0:i.status,headers:((s=t.init)==null?void 0:s.headers)&&new Headers(t.init.headers)}}if(Fv(t)){var a,l;return{type:Me.data,data:t.data,statusCode:(a=t.init)==null?void 0:a.status,headers:(l=t.init)!=null&&l.headers?new Headers(t.init.headers):void 0}}return{type:Me.data,data:t}}function xT(e,t,n,r,o,i){let s=e.headers.get("Location");if(me(s,"Redirects returned/thrown from loaders/actions must have a Location header"),!Dh.test(s)){let a=r.slice(0,r.findIndex(l=>l.route.id===n)+1);s=Uf(new URL(t.url),a,o,!0,s,i),e.headers.set("Location",s)}return e}function kv(e,t,n){if(Dh.test(e)){let r=e,o=r.startsWith("//")?new URL(t.protocol+r):new URL(r),i=is(o.pathname,n)!=null;if(o.origin===t.origin&&i)return o.pathname+o.search+o.hash}return e}function ti(e,t,n,r){let o=e.createURL(bx(t)).toString(),i={signal:n};if(r&&gn(r.formMethod)){let{formMethod:s,formEncType:a}=r;i.method=s.toUpperCase(),a==="application/json"?(i.headers=new Headers({"Content-Type":a}),i.body=JSON.stringify(r.json)):a==="text/plain"?i.body=r.text:a==="application/x-www-form-urlencoded"&&r.formData?i.body=Bf(r.formData):i.body=r.formData}return new Request(o,i)}function Bf(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r=="string"?r:r.name);return t}function Nv(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function ST(e,t,n,r,o){let i={},s=null,a,l=!1,u={},d=n&&$t(n[1])?n[1].error:void 0;return e.forEach(c=>{if(!(c.route.id in t))return;let f=c.route.id,m=t[f];if(me(!xo(m),"Cannot handle redirect results in processLoaderData"),$t(m)){let v=m.error;d!==void 0&&(v=d,d=void 0),s=s||{};{let y=mo(e,f);s[y.route.id]==null&&(s[y.route.id]=v)}i[f]=void 0,l||(l=!0,a=dc(m.error)?m.error.status:500),m.headers&&(u[f]=m.headers)}else zr(m)?(r.set(f,m.deferredData),i[f]=m.deferredData.data,m.statusCode!=null&&m.statusCode!==200&&!l&&(a=m.statusCode),m.headers&&(u[f]=m.headers)):(i[f]=m.data,m.statusCode&&m.statusCode!==200&&!l&&(a=m.statusCode),m.headers&&(u[f]=m.headers))}),d!==void 0&&n&&(s={[n[0]]:d},i[n[0]]=void 0),{loaderData:i,errors:s,statusCode:a||200,loaderHeaders:u}}function jv(e,t,n,r,o,i,s){let{loaderData:a,errors:l}=ST(t,n,r,s);return o.forEach(u=>{let{key:d,match:c,controller:f}=u,m=i[d];if(me(m,"Did not find corresponding fetcher result"),!(f&&f.signal.aborted))if($t(m)){let v=mo(e.matches,c==null?void 0:c.route.id);l&&l[v.route.id]||(l=Ie({},l,{[v.route.id]:m.error})),e.fetchers.delete(d)}else if(xo(m))me(!1,"Unhandled fetcher revalidation redirect");else if(zr(m))me(!1,"Unhandled fetcher deferred data");else{let v=Sr(m.data);e.fetchers.set(d,v)}}),{loaderData:a,errors:l}}function Ov(e,t,n,r){let o=Ie({},t);for(let i of n){let s=i.route.id;if(t.hasOwnProperty(s)?t[s]!==void 0&&(o[s]=t[s]):e[s]!==void 0&&i.route.loader&&(o[s]=e[s]),r&&r.hasOwnProperty(s))break}return o}function Dv(e){return e?$t(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function mo(e,t){return(t?e.slice(0,e.findIndex(r=>r.route.id===t)+1):[...e]).reverse().find(r=>r.route.hasErrorBoundary===!0)||e[0]}function Iv(e){let t=e.length===1?e[0]:e.find(n=>n.index||!n.path||n.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:t}],route:t}}function Pt(e,t){let{pathname:n,routeId:r,method:o,type:i,message:s}=t===void 0?{}:t,a="Unknown Server Error",l="Unknown @remix-run/router error";return e===400?(a="Bad Request",o&&n&&r?l="You made a "+o+' request to "'+n+'" but '+('did not provide a `loader` for route "'+r+'", ')+"so there is no way to handle the request.":i==="defer-action"?l="defer() is not supported in actions":i==="invalid-body"&&(l="Unable to encode submission body")):e===403?(a="Forbidden",l='Route "'+r+'" does not match URL "'+n+'"'):e===404?(a="Not Found",l='No route matches URL "'+n+'"'):e===405&&(a="Method Not Allowed",o&&n&&r?l="You made a "+o.toUpperCase()+' request to "'+n+'" but '+('did not provide an `action` for route "'+r+'", ')+"so there is no way to handle the request.":o&&(l='Invalid request method "'+o.toUpperCase()+'"')),new Tu(e||500,a,new Error(l),!0)}function xl(e){let t=Object.entries(e);for(let n=t.length-1;n>=0;n--){let[r,o]=t[n];if(xo(o))return{key:r,result:o}}}function bx(e){let t=typeof e=="string"?fr(e):e;return Io(Ie({},t,{hash:""}))}function CT(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===""?t.hash!=="":e.hash===t.hash?!0:t.hash!==""}function bT(e){return Rx(e.result)&&lT.has(e.result.status)}function zr(e){return e.type===Me.deferred}function $t(e){return e.type===Me.error}function xo(e){return(e&&e.type)===Me.redirect}function Fv(e){return typeof e=="object"&&e!=null&&"type"in e&&"data"in e&&"init"in e&&e.type==="DataWithResponseInit"}function RT(e){let t=e;return t&&typeof t=="object"&&typeof t.data=="object"&&typeof t.subscribe=="function"&&typeof t.cancel=="function"&&typeof t.resolveData=="function"}function Rx(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function ET(e){return aT.has(e.toLowerCase())}function gn(e){return iT.has(e.toLowerCase())}async function PT(e,t,n,r,o){let i=Object.entries(t);for(let s=0;s(f==null?void 0:f.route.id)===a);if(!u)continue;let d=r.find(f=>f.route.id===u.route.id),c=d!=null&&!Sx(d,u)&&(o&&o[u.route.id])!==void 0;zr(l)&&c&&await Ih(l,n,!1).then(f=>{f&&(t[a]=f)})}}async function _T(e,t,n){for(let r=0;r(u==null?void 0:u.route.id)===i)&&zr(a)&&(me(s,"Expected an AbortController for revalidating fetcher deferred result"),await Ih(a,s.signal,!0).then(u=>{u&&(t[o]=u)}))}}async function Ih(e,t,n){if(n===void 0&&(n=!1),!await e.deferredData.resolveData(t)){if(n)try{return{type:Me.data,data:e.deferredData.unwrappedData}}catch(o){return{type:Me.error,error:o}}return{type:Me.data,data:e.deferredData.data}}}function Fh(e){return new URLSearchParams(e).getAll("index").some(t=>t==="")}function Is(e,t){let n=typeof t=="string"?fr(t).search:t.search;if(e[e.length-1].route.index&&Fh(n||""))return e[e.length-1];let r=yx(e);return r[r.length-1]}function Lv(e){let{formMethod:t,formAction:n,formEncType:r,text:o,formData:i,json:s}=e;if(!(!t||!n||!r)){if(o!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:o};if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:i,json:void 0,text:void 0};if(s!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:s,text:void 0}}}function md(e,t){return t?{state:"loading",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function TT(e,t){return{state:"submitting",location:e,formMethod:t.formMethod,formAction:t.formAction,formEncType:t.formEncType,formData:t.formData,json:t.json,text:t.text}}function _s(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 AT(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 Sr(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 MT(e,t){try{let n=e.sessionStorage.getItem(xx);if(n){let r=JSON.parse(n);for(let[o,i]of Object.entries(r||{}))i&&Array.isArray(i)&&t.set(o,new Set(i||[]))}}catch{}}function kT(e,t){if(t.size>0){let n={};for(let[r,o]of t)n[r]=[...o];try{e.sessionStorage.setItem(xx,JSON.stringify(n))}catch(r){Do(!1,"Failed to save applied view transitions in sessionStorage ("+r+").")}}}/** * React Router v6.27.0 * * Copyright (c) Remix Software Inc. @@ -56,7 +56,7 @@ Error generating stack: `+i.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Au(){return Au=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),h.useCallback(function(u,d){if(d===void 0&&(d={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let c=cc(u,JSON.parse(s),i,d.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:nr([t,c.pathname])),(d.replace?r.replace:r.push)(c,d.state,d)},[t,r,s,i,e])}const NT=h.createContext(null);function jT(e){let t=h.useContext(Bn).outlet;return t&&h.createElement(NT.Provider,{value:e},t)}function Px(){let{matches:e}=h.useContext(Bn),t=e[e.length-1];return t?t.params:{}}function _x(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=h.useContext(ao),{matches:o}=h.useContext(Bn),{pathname:i}=Vo(),s=JSON.stringify(uc(o,r.v7_relativeSplatPath));return h.useMemo(()=>cc(e,JSON.parse(s),i,n==="path"),[e,s,i,n])}function OT(e,t,n,r){ss()||me(!1);let{navigator:o}=h.useContext(ao),{matches:i}=h.useContext(Bn),s=i[i.length-1],a=s?s.params:{};s&&s.pathname;let l=s?s.pathnameBase:"/";s&&s.route;let u=Vo(),d;d=u;let c=d.pathname||"/",f=c;if(l!=="/"){let y=l.replace(/^\//,"").split("/");f="/"+c.replace(/^\//,"").split("/").slice(y.length).join("/")}let m=go(e,{pathname:f});return $T(m&&m.map(y=>Object.assign({},y,{params:Object.assign({},a,y.params),pathname:nr([l,o.encodeLocation?o.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:nr([l,o.encodeLocation?o.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,n,r)}function DT(){let e=Mx(),t=dc(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),n?h.createElement("pre",{style:o},n):null,null)}const IT=h.createElement(DT,null);class FT extends h.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?h.createElement(Bn.Provider,{value:this.props.routeContext},h.createElement(Rx.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function LT(e){let{routeContext:t,match:n,children:r}=e,o=h.useContext(fc);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),h.createElement(Bn.Provider,{value:t},r)}function $T(e,t,n,r){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let s=e,a=(o=n)==null?void 0:o.errors;if(a!=null){let d=s.findIndex(c=>c.route.id&&(a==null?void 0:a[c.route.id])!==void 0);d>=0||me(!1),s=s.slice(0,Math.min(s.length,d+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,c,f)=>{let m,v=!1,y=null,x=null;n&&(m=a&&c.route.id?a[c.route.id]:void 0,y=c.route.errorElement||IT,l&&(u<0&&f===0?(HT("route-fallback"),v=!0,x=null):u===f&&(v=!0,x=c.route.hydrateFallbackElement||null)));let w=t.concat(s.slice(0,f+1)),g=()=>{let S;return m?S=y:v?S=x:c.route.Component?S=h.createElement(c.route.Component,null):c.route.element?S=c.route.element:S=d,h.createElement(LT,{match:c,routeContext:{outlet:d,matches:w,isDataRoute:n!=null},children:S})};return n&&(c.route.ErrorBoundary||c.route.errorElement||f===0)?h.createElement(FT,{location:n.location,revalidation:n.revalidation,component:y,error:m,children:g(),routeContext:{outlet:null,matches:w,isDataRoute:!0}}):g()},null)}var Tx=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Tx||{}),Mu=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Mu||{});function UT(e){let t=h.useContext(fc);return t||me(!1),t}function zT(e){let t=h.useContext(bx);return t||me(!1),t}function BT(e){let t=h.useContext(Bn);return t||me(!1),t}function Ax(e){let t=BT(),n=t.matches[t.matches.length-1];return n.route.id||me(!1),n.route.id}function Mx(){var e;let t=h.useContext(Rx),n=zT(Mu.UseRouteError),r=Ax(Mu.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function VT(){let{router:e}=UT(Tx.UseNavigateStable),t=Ax(Mu.UseNavigateStable),n=h.useRef(!1);return Ex(()=>{n.current=!0}),h.useCallback(function(o,i){i===void 0&&(i={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,Au({fromRouteId:t},i)))},[e,t])}const Lv={};function HT(e,t,n){Lv[e]||(Lv[e]=!0)}function KT(e){let{to:t,replace:n,state:r,relative:o}=e;ss()||me(!1);let{future:i,static:s}=h.useContext(ao),{matches:a}=h.useContext(Bn),{pathname:l}=Vo(),u=as(),d=cc(t,uc(a,i.v7_relativeSplatPath),l,o==="path"),c=JSON.stringify(d);return h.useEffect(()=>u(JSON.parse(c),{replace:n,state:r,relative:o}),[u,c,o,n,r]),null}function kx(e){return jT(e.context)}function GT(e){let{basename:t="/",children:n=null,location:r,navigationType:o=Xe.Pop,navigator:i,static:s=!1,future:a}=e;ss()&&me(!1);let l=t.replace(/^\/*/,"/"),u=h.useMemo(()=>({basename:l,navigator:i,static:s,future:Au({v7_relativeSplatPath:!1},a)}),[l,a,i,s]);typeof r=="string"&&(r=fr(r));let{pathname:d="/",search:c="",hash:f="",state:m=null,key:v="default"}=r,y=h.useMemo(()=>{let x=is(d,l);return x==null?null:{location:{pathname:x,search:c,hash:f,state:m,key:v},navigationType:o}},[l,d,c,f,m,v,o]);return y==null?null:h.createElement(ao.Provider,{value:u},h.createElement(Fh.Provider,{children:n,value:y}))}new Promise(()=>{});function WT(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:h.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:h.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:h.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/** + */function Au(){return Au=Object.assign?Object.assign.bind():function(e){for(var t=1;t{a.current=!0}),h.useCallback(function(u,d){if(d===void 0&&(d={}),!a.current)return;if(typeof u=="number"){r.go(u);return}let c=cc(u,JSON.parse(s),i,d.relative==="path");e==null&&t!=="/"&&(c.pathname=c.pathname==="/"?t:nr([t,c.pathname])),(d.replace?r.replace:r.push)(c,d.state,d)},[t,r,s,i,e])}const OT=h.createContext(null);function DT(e){let t=h.useContext(Bn).outlet;return t&&h.createElement(OT.Provider,{value:e},t)}function Tx(){let{matches:e}=h.useContext(Bn),t=e[e.length-1];return t?t.params:{}}function Ax(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=h.useContext(ao),{matches:o}=h.useContext(Bn),{pathname:i}=Vo(),s=JSON.stringify(uc(o,r.v7_relativeSplatPath));return h.useMemo(()=>cc(e,JSON.parse(s),i,n==="path"),[e,s,i,n])}function IT(e,t,n,r){ss()||me(!1);let{navigator:o}=h.useContext(ao),{matches:i}=h.useContext(Bn),s=i[i.length-1],a=s?s.params:{};s&&s.pathname;let l=s?s.pathnameBase:"/";s&&s.route;let u=Vo(),d;d=u;let c=d.pathname||"/",f=c;if(l!=="/"){let y=l.replace(/^\//,"").split("/");f="/"+c.replace(/^\//,"").split("/").slice(y.length).join("/")}let m=go(e,{pathname:f});return zT(m&&m.map(y=>Object.assign({},y,{params:Object.assign({},a,y.params),pathname:nr([l,o.encodeLocation?o.encodeLocation(y.pathname).pathname:y.pathname]),pathnameBase:y.pathnameBase==="/"?l:nr([l,o.encodeLocation?o.encodeLocation(y.pathnameBase).pathname:y.pathnameBase])})),i,n,r)}function FT(){let e=Nx(),t=dc(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,o={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return h.createElement(h.Fragment,null,h.createElement("h2",null,"Unexpected Application Error!"),h.createElement("h3",{style:{fontStyle:"italic"}},t),n?h.createElement("pre",{style:o},n):null,null)}const LT=h.createElement(FT,null);class $T extends h.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?h.createElement(Bn.Provider,{value:this.props.routeContext},h.createElement(Px.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function UT(e){let{routeContext:t,match:n,children:r}=e,o=h.useContext(fc);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),h.createElement(Bn.Provider,{value:t},r)}function zT(e,t,n,r){var o;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let s=e,a=(o=n)==null?void 0:o.errors;if(a!=null){let d=s.findIndex(c=>c.route.id&&(a==null?void 0:a[c.route.id])!==void 0);d>=0||me(!1),s=s.slice(0,Math.min(s.length,d+1))}let l=!1,u=-1;if(n&&r&&r.v7_partialHydration)for(let d=0;d=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((d,c,f)=>{let m,v=!1,y=null,x=null;n&&(m=a&&c.route.id?a[c.route.id]:void 0,y=c.route.errorElement||LT,l&&(u<0&&f===0?(GT("route-fallback"),v=!0,x=null):u===f&&(v=!0,x=c.route.hydrateFallbackElement||null)));let w=t.concat(s.slice(0,f+1)),g=()=>{let S;return m?S=y:v?S=x:c.route.Component?S=h.createElement(c.route.Component,null):c.route.element?S=c.route.element:S=d,h.createElement(UT,{match:c,routeContext:{outlet:d,matches:w,isDataRoute:n!=null},children:S})};return n&&(c.route.ErrorBoundary||c.route.errorElement||f===0)?h.createElement($T,{location:n.location,revalidation:n.revalidation,component:y,error:m,children:g(),routeContext:{outlet:null,matches:w,isDataRoute:!0}}):g()},null)}var Mx=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(Mx||{}),Mu=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(Mu||{});function BT(e){let t=h.useContext(fc);return t||me(!1),t}function VT(e){let t=h.useContext(Ex);return t||me(!1),t}function HT(e){let t=h.useContext(Bn);return t||me(!1),t}function kx(e){let t=HT(),n=t.matches[t.matches.length-1];return n.route.id||me(!1),n.route.id}function Nx(){var e;let t=h.useContext(Px),n=VT(Mu.UseRouteError),r=kx(Mu.UseRouteError);return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function KT(){let{router:e}=BT(Mx.UseNavigateStable),t=kx(Mu.UseNavigateStable),n=h.useRef(!1);return _x(()=>{n.current=!0}),h.useCallback(function(o,i){i===void 0&&(i={}),n.current&&(typeof o=="number"?e.navigate(o):e.navigate(o,Au({fromRouteId:t},i)))},[e,t])}const $v={};function GT(e,t,n){$v[e]||($v[e]=!0)}function WT(e){let{to:t,replace:n,state:r,relative:o}=e;ss()||me(!1);let{future:i,static:s}=h.useContext(ao),{matches:a}=h.useContext(Bn),{pathname:l}=Vo(),u=as(),d=cc(t,uc(a,i.v7_relativeSplatPath),l,o==="path"),c=JSON.stringify(d);return h.useEffect(()=>u(JSON.parse(c),{replace:n,state:r,relative:o}),[u,c,o,n,r]),null}function jx(e){return DT(e.context)}function qT(e){let{basename:t="/",children:n=null,location:r,navigationType:o=Xe.Pop,navigator:i,static:s=!1,future:a}=e;ss()&&me(!1);let l=t.replace(/^\/*/,"/"),u=h.useMemo(()=>({basename:l,navigator:i,static:s,future:Au({v7_relativeSplatPath:!1},a)}),[l,a,i,s]);typeof r=="string"&&(r=fr(r));let{pathname:d="/",search:c="",hash:f="",state:m=null,key:v="default"}=r,y=h.useMemo(()=>{let x=is(d,l);return x==null?null:{location:{pathname:x,search:c,hash:f,state:m,key:v},navigationType:o}},[l,d,c,f,m,v,o]);return y==null?null:h.createElement(ao.Provider,{value:u},h.createElement(Lh.Provider,{children:n,value:y}))}new Promise(()=>{});function QT(e){let t={hasErrorBoundary:e.ErrorBoundary!=null||e.errorElement!=null};return e.Component&&Object.assign(t,{element:h.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:h.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:h.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}/** * React Router DOM v6.27.0 * * Copyright (c) Remix Software Inc. @@ -65,156 +65,156 @@ Error generating stack: `+i.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function wa(){return wa=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[o]=e[o]);return n}function QT(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function YT(e,t){return e.button===0&&(!t||t==="_self")&&!QT(e)}function Vf(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function XT(e,t){let n=Vf(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}const JT=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],ZT="6";try{window.__reactRouterVersion=ZT}catch{}function e2(e,t){return cT({basename:void 0,future:wa({},void 0,{v7_prependBasename:!0}),history:O_({window:void 0}),hydrationData:t2(),routes:e,mapRouteProperties:WT,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function t2(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=wa({},t,{errors:n2(t.errors)})),t}function n2(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Tu(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let i=window[o.__subType];if(typeof i=="function")try{let s=new i(o.message);s.stack="",n[r]=s}catch{}}if(n[r]==null){let i=new Error(o.message);i.stack="",n[r]=i}}else n[r]=o;return n}const r2=h.createContext({isTransitioning:!1}),o2=h.createContext(new Map),i2="startTransition",$v=u0[i2],s2="flushSync",Uv=j_[s2];function a2(e){$v?$v(e):e()}function Ts(e){Uv?Uv(e):e()}class l2{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function u2(e){let{fallbackElement:t,router:n,future:r}=e,[o,i]=h.useState(n.state),[s,a]=h.useState(),[l,u]=h.useState({isTransitioning:!1}),[d,c]=h.useState(),[f,m]=h.useState(),[v,y]=h.useState(),x=h.useRef(new Map),{v7_startTransition:w}=r||{},g=h.useCallback(A=>{w?a2(A):A()},[w]),S=h.useCallback((A,$)=>{let{deletedFetchers:R,flushSync:O,viewTransitionOpts:F}=$;R.forEach(E=>x.current.delete(E)),A.fetchers.forEach((E,T)=>{E.data!==void 0&&x.current.set(T,E.data)});let N=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!F||N){O?Ts(()=>i(A)):g(()=>i(A));return}if(O){Ts(()=>{f&&(d&&d.resolve(),f.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:F.currentLocation,nextLocation:F.nextLocation})});let E=n.window.document.startViewTransition(()=>{Ts(()=>i(A))});E.finished.finally(()=>{Ts(()=>{c(void 0),m(void 0),a(void 0),u({isTransitioning:!1})})}),Ts(()=>m(E));return}f?(d&&d.resolve(),f.skipTransition(),y({state:A,currentLocation:F.currentLocation,nextLocation:F.nextLocation})):(a(A),u({isTransitioning:!0,flushSync:!1,currentLocation:F.currentLocation,nextLocation:F.nextLocation}))},[n.window,f,d,x,g]);h.useLayoutEffect(()=>n.subscribe(S),[n,S]),h.useEffect(()=>{l.isTransitioning&&!l.flushSync&&c(new l2)},[l]),h.useEffect(()=>{if(d&&s&&n.window){let A=s,$=d.promise,R=n.window.document.startViewTransition(async()=>{g(()=>i(A)),await $});R.finished.finally(()=>{c(void 0),m(void 0),a(void 0),u({isTransitioning:!1})}),m(R)}},[g,s,d,n.window]),h.useEffect(()=>{d&&s&&o.location.key===s.location.key&&d.resolve()},[d,f,o.location,s]),h.useEffect(()=>{!l.isTransitioning&&v&&(a(v.state),u({isTransitioning:!0,flushSync:!1,currentLocation:v.currentLocation,nextLocation:v.nextLocation}),y(void 0))},[l.isTransitioning,v]),h.useEffect(()=>{},[]);let C=h.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:A=>n.navigate(A),push:(A,$,R)=>n.navigate(A,{state:$,preventScrollReset:R==null?void 0:R.preventScrollReset}),replace:(A,$,R)=>n.navigate(A,{replace:!0,state:$,preventScrollReset:R==null?void 0:R.preventScrollReset})}),[n]),P=n.basename||"/",b=h.useMemo(()=>({router:n,navigator:C,static:!1,basename:P}),[n,C,P]),M=h.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return h.createElement(h.Fragment,null,h.createElement(fc.Provider,{value:b},h.createElement(bx.Provider,{value:o},h.createElement(o2.Provider,{value:x.current},h.createElement(r2.Provider,{value:l},h.createElement(GT,{basename:P,location:o.location,navigationType:o.historyAction,navigator:C,future:M},o.initialized||n.future.v7_partialHydration?h.createElement(c2,{routes:n.routes,future:n.future,state:o}):t))))),null)}const c2=h.memo(d2);function d2(e){let{routes:t,future:n,state:r}=e;return OT(t,void 0,r,n)}const f2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",p2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ys=h.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:i,replace:s,state:a,target:l,to:u,preventScrollReset:d,viewTransition:c}=t,f=qT(t,JT),{basename:m}=h.useContext(ao),v,y=!1;if(typeof u=="string"&&p2.test(u)&&(v=u,f2))try{let S=new URL(window.location.href),C=u.startsWith("//")?new URL(S.protocol+u):new URL(u),P=is(C.pathname,m);C.origin===S.origin&&P!=null?u=P+C.search+C.hash:y=!0}catch{}let x=MT(u,{relative:o}),w=h2(u,{replace:s,state:a,target:l,preventScrollReset:d,relative:o,viewTransition:c});function g(S){r&&r(S),S.defaultPrevented||w(S)}return h.createElement("a",wa({},f,{href:v||x,onClick:y||i?r:g,ref:n,target:l}))});var zv;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(zv||(zv={}));var Bv;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Bv||(Bv={}));function h2(e,t){let{target:n,replace:r,state:o,preventScrollReset:i,relative:s,viewTransition:a}=t===void 0?{}:t,l=as(),u=Vo(),d=_x(e,{relative:s});return h.useCallback(c=>{if(YT(c,n)){c.preventDefault();let f=r!==void 0?r:Io(u)===Io(d);l(e,{replace:f,state:o,preventScrollReset:i,relative:s,viewTransition:a})}},[u,l,d,r,o,n,e,i,s,a])}function Lh(e){let t=h.useRef(Vf(e)),n=h.useRef(!1),r=Vo(),o=h.useMemo(()=>XT(r.search,n.current?null:t.current),[r.search]),i=as(),s=h.useCallback((a,l)=>{const u=Vf(typeof a=="function"?a(o):a);n.current=!0,i("?"+u,l)},[i,o]);return[o,s]}var $h={},Nx={},ae={},Uh={};Object.defineProperty(Uh,"__esModule",{value:!0});class g2 extends Error{constructor(t){super(`${t.status} ${t.statusText} + */function wa(){return wa=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[o]=e[o]);return n}function XT(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function JT(e,t){return e.button===0&&(!t||t==="_self")&&!XT(e)}function Vf(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let r=e[n];return t.concat(Array.isArray(r)?r.map(o=>[n,o]):[[n,r]])},[]))}function ZT(e,t){let n=Vf(e);return t&&t.forEach((r,o)=>{n.has(o)||t.getAll(o).forEach(i=>{n.append(o,i)})}),n}const e2=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],t2="6";try{window.__reactRouterVersion=t2}catch{}function n2(e,t){return fT({basename:void 0,future:wa({},void 0,{v7_prependBasename:!0}),history:I_({window:void 0}),hydrationData:r2(),routes:e,mapRouteProperties:QT,dataStrategy:void 0,patchRoutesOnNavigation:void 0,window:void 0}).initialize()}function r2(){var e;let t=(e=window)==null?void 0:e.__staticRouterHydrationData;return t&&t.errors&&(t=wa({},t,{errors:o2(t.errors)})),t}function o2(e){if(!e)return null;let t=Object.entries(e),n={};for(let[r,o]of t)if(o&&o.__type==="RouteErrorResponse")n[r]=new Tu(o.status,o.statusText,o.data,o.internal===!0);else if(o&&o.__type==="Error"){if(o.__subType){let i=window[o.__subType];if(typeof i=="function")try{let s=new i(o.message);s.stack="",n[r]=s}catch{}}if(n[r]==null){let i=new Error(o.message);i.stack="",n[r]=i}}else n[r]=o;return n}const i2=h.createContext({isTransitioning:!1}),s2=h.createContext(new Map),a2="startTransition",Uv=d0[a2],l2="flushSync",zv=D_[l2];function u2(e){Uv?Uv(e):e()}function Ts(e){zv?zv(e):e()}class c2{constructor(){this.status="pending",this.promise=new Promise((t,n)=>{this.resolve=r=>{this.status==="pending"&&(this.status="resolved",t(r))},this.reject=r=>{this.status==="pending"&&(this.status="rejected",n(r))}})}}function d2(e){let{fallbackElement:t,router:n,future:r}=e,[o,i]=h.useState(n.state),[s,a]=h.useState(),[l,u]=h.useState({isTransitioning:!1}),[d,c]=h.useState(),[f,m]=h.useState(),[v,y]=h.useState(),x=h.useRef(new Map),{v7_startTransition:w}=r||{},g=h.useCallback(A=>{w?u2(A):A()},[w]),S=h.useCallback((A,$)=>{let{deletedFetchers:R,flushSync:O,viewTransitionOpts:F}=$;R.forEach(E=>x.current.delete(E)),A.fetchers.forEach((E,T)=>{E.data!==void 0&&x.current.set(T,E.data)});let N=n.window==null||n.window.document==null||typeof n.window.document.startViewTransition!="function";if(!F||N){O?Ts(()=>i(A)):g(()=>i(A));return}if(O){Ts(()=>{f&&(d&&d.resolve(),f.skipTransition()),u({isTransitioning:!0,flushSync:!0,currentLocation:F.currentLocation,nextLocation:F.nextLocation})});let E=n.window.document.startViewTransition(()=>{Ts(()=>i(A))});E.finished.finally(()=>{Ts(()=>{c(void 0),m(void 0),a(void 0),u({isTransitioning:!1})})}),Ts(()=>m(E));return}f?(d&&d.resolve(),f.skipTransition(),y({state:A,currentLocation:F.currentLocation,nextLocation:F.nextLocation})):(a(A),u({isTransitioning:!0,flushSync:!1,currentLocation:F.currentLocation,nextLocation:F.nextLocation}))},[n.window,f,d,x,g]);h.useLayoutEffect(()=>n.subscribe(S),[n,S]),h.useEffect(()=>{l.isTransitioning&&!l.flushSync&&c(new c2)},[l]),h.useEffect(()=>{if(d&&s&&n.window){let A=s,$=d.promise,R=n.window.document.startViewTransition(async()=>{g(()=>i(A)),await $});R.finished.finally(()=>{c(void 0),m(void 0),a(void 0),u({isTransitioning:!1})}),m(R)}},[g,s,d,n.window]),h.useEffect(()=>{d&&s&&o.location.key===s.location.key&&d.resolve()},[d,f,o.location,s]),h.useEffect(()=>{!l.isTransitioning&&v&&(a(v.state),u({isTransitioning:!0,flushSync:!1,currentLocation:v.currentLocation,nextLocation:v.nextLocation}),y(void 0))},[l.isTransitioning,v]),h.useEffect(()=>{},[]);let C=h.useMemo(()=>({createHref:n.createHref,encodeLocation:n.encodeLocation,go:A=>n.navigate(A),push:(A,$,R)=>n.navigate(A,{state:$,preventScrollReset:R==null?void 0:R.preventScrollReset}),replace:(A,$,R)=>n.navigate(A,{replace:!0,state:$,preventScrollReset:R==null?void 0:R.preventScrollReset})}),[n]),P=n.basename||"/",b=h.useMemo(()=>({router:n,navigator:C,static:!1,basename:P}),[n,C,P]),M=h.useMemo(()=>({v7_relativeSplatPath:n.future.v7_relativeSplatPath}),[n.future.v7_relativeSplatPath]);return h.createElement(h.Fragment,null,h.createElement(fc.Provider,{value:b},h.createElement(Ex.Provider,{value:o},h.createElement(s2.Provider,{value:x.current},h.createElement(i2.Provider,{value:l},h.createElement(qT,{basename:P,location:o.location,navigationType:o.historyAction,navigator:C,future:M},o.initialized||n.future.v7_partialHydration?h.createElement(f2,{routes:n.routes,future:n.future,state:o}):t))))),null)}const f2=h.memo(p2);function p2(e){let{routes:t,future:n,state:r}=e;return IT(t,void 0,r,n)}const h2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",g2=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Ys=h.forwardRef(function(t,n){let{onClick:r,relative:o,reloadDocument:i,replace:s,state:a,target:l,to:u,preventScrollReset:d,viewTransition:c}=t,f=YT(t,e2),{basename:m}=h.useContext(ao),v,y=!1;if(typeof u=="string"&&g2.test(u)&&(v=u,h2))try{let S=new URL(window.location.href),C=u.startsWith("//")?new URL(S.protocol+u):new URL(u),P=is(C.pathname,m);C.origin===S.origin&&P!=null?u=P+C.search+C.hash:y=!0}catch{}let x=NT(u,{relative:o}),w=m2(u,{replace:s,state:a,target:l,preventScrollReset:d,relative:o,viewTransition:c});function g(S){r&&r(S),S.defaultPrevented||w(S)}return h.createElement("a",wa({},f,{href:v||x,onClick:y||i?r:g,ref:n,target:l}))});var Bv;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Bv||(Bv={}));var Vv;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Vv||(Vv={}));function m2(e,t){let{target:n,replace:r,state:o,preventScrollReset:i,relative:s,viewTransition:a}=t===void 0?{}:t,l=as(),u=Vo(),d=Ax(e,{relative:s});return h.useCallback(c=>{if(JT(c,n)){c.preventDefault();let f=r!==void 0?r:Io(u)===Io(d);l(e,{replace:f,state:o,preventScrollReset:i,relative:s,viewTransition:a})}},[u,l,d,r,o,n,e,i,s,a])}function $h(e){let t=h.useRef(Vf(e)),n=h.useRef(!1),r=Vo(),o=h.useMemo(()=>ZT(r.search,n.current?null:t.current),[r.search]),i=as(),s=h.useCallback((a,l)=>{const u=Vf(typeof a=="function"?a(o):a);n.current=!0,i("?"+u,l)},[i,o]);return[o,s]}var Uh={},Ox={},ae={},zh={};Object.defineProperty(zh,"__esModule",{value:!0});class v2 extends Error{constructor(t){super(`${t.status} ${t.statusText} URL: ${t.url}`),this.name="HttpError",this.response=t,this.statusCode=t.status,this.status=t.status,this.statusText=t.statusText}async parse(){if(!this.response.bodyUsed)try{const t=this.response.headers.get("content-type")||"text/plain";if(t.match(/\bjson\b/i)){let n=await this.response.json();n.error?(this.message+=` `+n.error,n.error_description&&(this.message+=": "+n.error_description)):this.message+=` `+JSON.stringify(n,null,4)}else if(t.match(/^text\//i)){let n=await this.response.text();n&&(this.message+=` -`+n)}}catch{}return this}toJSON(){return{name:this.name,statusCode:this.statusCode,status:this.status,statusText:this.statusText,message:this.message}}}Uh.default=g2;var rn={};Object.defineProperty(rn,"__esModule",{value:!0});rn.SMART_KEY=rn.patientParams=rn.fhirVersions=rn.patientCompartment=void 0;rn.patientCompartment=["Account","AdverseEvent","AllergyIntolerance","Appointment","AppointmentResponse","AuditEvent","Basic","BodySite","BodyStructure","CarePlan","CareTeam","ChargeItem","Claim","ClaimResponse","ClinicalImpression","Communication","CommunicationRequest","Composition","Condition","Consent","Coverage","CoverageEligibilityRequest","CoverageEligibilityResponse","DetectedIssue","DeviceRequest","DeviceUseRequest","DeviceUseStatement","DiagnosticOrder","DiagnosticReport","DocumentManifest","DocumentReference","EligibilityRequest","Encounter","EnrollmentRequest","EpisodeOfCare","ExplanationOfBenefit","FamilyMemberHistory","Flag","Goal","Group","ImagingManifest","ImagingObjectSelection","ImagingStudy","Immunization","ImmunizationEvaluation","ImmunizationRecommendation","Invoice","List","MeasureReport","Media","MedicationAdministration","MedicationDispense","MedicationOrder","MedicationRequest","MedicationStatement","MolecularSequence","NutritionOrder","Observation","Order","Patient","Person","Procedure","ProcedureRequest","Provenance","QuestionnaireResponse","ReferralRequest","RelatedPerson","RequestGroup","ResearchSubject","RiskAssessment","Schedule","ServiceRequest","Specimen","SupplyDelivery","SupplyRequest","VisionPrescription"];rn.fhirVersions={"0.4.0":2,"0.5.0":2,"1.0.0":2,"1.0.1":2,"1.0.2":2,"1.1.0":3,"1.4.0":3,"1.6.0":3,"1.8.0":3,"3.0.0":3,"3.0.1":3,"3.3.0":4,"3.5.0":4,"4.0.0":4,"4.0.1":4};rn.patientParams=["patient","subject","requester","member","actor","beneficiary"];rn.SMART_KEY="SMART_KEY";var Hf={exports:{}},vd,Vv;function m2(){if(Vv)return vd;Vv=1;var e=1e3,t=e*60,n=t*60,r=n*24,o=r*7,i=r*365.25;vd=function(d,c){c=c||{};var f=typeof d;if(f==="string"&&d.length>0)return s(d);if(f==="number"&&isFinite(d))return c.long?l(d):a(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))};function s(d){if(d=String(d),!(d.length>100)){var c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(c){var f=parseFloat(c[1]),m=(c[2]||"ms").toLowerCase();switch(m){case"years":case"year":case"yrs":case"yr":case"y":return f*i;case"weeks":case"week":case"w":return f*o;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*t;case"seconds":case"second":case"secs":case"sec":case"s":return f*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(d){var c=Math.abs(d);return c>=r?Math.round(d/r)+"d":c>=n?Math.round(d/n)+"h":c>=t?Math.round(d/t)+"m":c>=e?Math.round(d/e)+"s":d+"ms"}function l(d){var c=Math.abs(d);return c>=r?u(d,c,r,"day"):c>=n?u(d,c,n,"hour"):c>=t?u(d,c,t,"minute"):c>=e?u(d,c,e,"second"):d+" ms"}function u(d,c,f,m){var v=c>=f*1.5;return Math.round(d/f)+" "+m+(v?"s":"")}return vd}function v2(e){n.debug=n,n.default=n,n.coerce=l,n.disable=i,n.enable=o,n.enabled=s,n.humanize=m2(),n.destroy=u,Object.keys(e).forEach(d=>{n[d]=e[d]}),n.names=[],n.skips=[],n.formatters={};function t(d){let c=0;for(let f=0;f{if(b==="%%")return"%";C++;const A=n.formatters[M];if(typeof A=="function"){const $=x[C];b=A.call(w,$),x.splice(C,1),C--}return b}),n.formatArgs.call(w,x),(w.log||n.log).apply(w,x)}return y.namespace=d,y.useColors=n.useColors(),y.color=n.selectColor(d),y.extend=r,y.destroy=n.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==n.namespaces&&(m=n.namespaces,v=n.enabled(d)),v),set:x=>{f=x}}),typeof n.init=="function"&&n.init(y),y}function r(d,c){const f=n(this.namespace+(typeof c>"u"?":":c)+d);return f.log=this.log,f}function o(d){n.save(d),n.namespaces=d,n.names=[],n.skips=[];let c;const f=(typeof d=="string"?d:"").split(/[\s,]+/),m=f.length;for(c=0;c"-"+c)].join(",");return n.enable(""),d}function s(d){if(d[d.length-1]==="*")return!0;let c,f;for(c=0,f=n.skips.length;c{let u=!1;return()=>{u||(u=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let u;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(u=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(u[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(u){if(u[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+u[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;u.splice(1,0,d,"color: inherit");let c=0,f=0;u[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(c++,m==="%c"&&(f=c))}),u.splice(f,0,d)}t.log=console.debug||console.log||(()=>{});function i(u){try{u?t.storage.setItem("debug",u):t.storage.removeItem("debug")}catch{}}function s(){let u;try{u=t.storage.getItem("debug")}catch{}return!u&&typeof process<"u"&&"env"in process&&(u=n.DEBUG),u}function a(){try{return localStorage}catch{}}e.exports=y2(t);const{formatters:l}=e.exports;l.j=function(u){try{return JSON.stringify(u)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(Hf,Hf.exports);var w2=Hf.exports,Sl={exports:{}},Hv;function zh(){return Hv||(Hv=1,function(e,t){var n=typeof self<"u"?self:Us,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(s){var a={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function l(E){return E&&DataView.prototype.isPrototypeOf(E)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(E){return E&&u.indexOf(Object.prototype.toString.call(E))>-1};function c(E){if(typeof E!="string"&&(E=String(E)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(E))throw new TypeError("Invalid character in header field name");return E.toLowerCase()}function f(E){return typeof E!="string"&&(E=String(E)),E}function m(E){var T={next:function(){var D=E.shift();return{done:D===void 0,value:D}}};return a.iterable&&(T[Symbol.iterator]=function(){return T}),T}function v(E){this.map={},E instanceof v?E.forEach(function(T,D){this.append(D,T)},this):Array.isArray(E)?E.forEach(function(T){this.append(T[0],T[1])},this):E&&Object.getOwnPropertyNames(E).forEach(function(T){this.append(T,E[T])},this)}v.prototype.append=function(E,T){E=c(E),T=f(T);var D=this.map[E];this.map[E]=D?D+", "+T:T},v.prototype.delete=function(E){delete this.map[c(E)]},v.prototype.get=function(E){return E=c(E),this.has(E)?this.map[E]:null},v.prototype.has=function(E){return this.map.hasOwnProperty(c(E))},v.prototype.set=function(E,T){this.map[c(E)]=f(T)},v.prototype.forEach=function(E,T){for(var D in this.map)this.map.hasOwnProperty(D)&&E.call(T,this.map[D],D,this)},v.prototype.keys=function(){var E=[];return this.forEach(function(T,D){E.push(D)}),m(E)},v.prototype.values=function(){var E=[];return this.forEach(function(T){E.push(T)}),m(E)},v.prototype.entries=function(){var E=[];return this.forEach(function(T,D){E.push([D,T])}),m(E)},a.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function y(E){if(E.bodyUsed)return Promise.reject(new TypeError("Already read"));E.bodyUsed=!0}function x(E){return new Promise(function(T,D){E.onload=function(){T(E.result)},E.onerror=function(){D(E.error)}})}function w(E){var T=new FileReader,D=x(T);return T.readAsArrayBuffer(E),D}function g(E){var T=new FileReader,D=x(T);return T.readAsText(E),D}function S(E){for(var T=new Uint8Array(E),D=new Array(T.length),V=0;V-1?T:E}function A(E,T){T=T||{};var D=T.body;if(E instanceof A){if(E.bodyUsed)throw new TypeError("Already read");this.url=E.url,this.credentials=E.credentials,T.headers||(this.headers=new v(E.headers)),this.method=E.method,this.mode=E.mode,this.signal=E.signal,!D&&E._bodyInit!=null&&(D=E._bodyInit,E.bodyUsed=!0)}else this.url=String(E);if(this.credentials=T.credentials||this.credentials||"same-origin",(T.headers||!this.headers)&&(this.headers=new v(T.headers)),this.method=M(T.method||this.method||"GET"),this.mode=T.mode||this.mode||null,this.signal=T.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(D)}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})};function $(E){var T=new FormData;return E.trim().split("&").forEach(function(D){if(D){var V=D.split("="),L=V.shift().replace(/\+/g," "),j=V.join("=").replace(/\+/g," ");T.append(decodeURIComponent(L),decodeURIComponent(j))}}),T}function R(E){var T=new v,D=E.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(V){var L=V.split(":"),j=L.shift().trim();if(j){var B=L.join(":").trim();T.append(j,B)}}),T}P.call(A.prototype);function O(E,T){T||(T={}),this.type="default",this.status=T.status===void 0?200:T.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in T?T.statusText:"OK",this.headers=new v(T.headers),this.url=T.url||"",this._initBody(E)}P.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},O.error=function(){var E=new O(null,{status:0,statusText:""});return E.type="error",E};var F=[301,302,303,307,308];O.redirect=function(E,T){if(F.indexOf(T)===-1)throw new RangeError("Invalid status code");return new O(null,{status:T,headers:{location:E}})},s.DOMException=i.DOMException;try{new s.DOMException}catch{s.DOMException=function(T,D){this.message=T,this.name=D;var V=Error(T);this.stack=V.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function N(E,T){return new Promise(function(D,V){var L=new A(E,T);if(L.signal&&L.signal.aborted)return V(new s.DOMException("Aborted","AbortError"));var j=new XMLHttpRequest;function B(){j.abort()}j.onload=function(){var Q={status:j.status,statusText:j.statusText,headers:R(j.getAllResponseHeaders()||"")};Q.url="responseURL"in j?j.responseURL:Q.headers.get("X-Request-URL");var te="response"in j?j.response:j.responseText;D(new O(te,Q))},j.onerror=function(){V(new TypeError("Network request failed"))},j.ontimeout=function(){V(new TypeError("Network request failed"))},j.onabort=function(){V(new s.DOMException("Aborted","AbortError"))},j.open(L.method,L.url,!0),L.credentials==="include"?j.withCredentials=!0:L.credentials==="omit"&&(j.withCredentials=!1),"responseType"in j&&a.blob&&(j.responseType="blob"),L.headers.forEach(function(Q,te){j.setRequestHeader(te,Q)}),L.signal&&(L.signal.addEventListener("abort",B),j.onreadystatechange=function(){j.readyState===4&&L.signal.removeEventListener("abort",B)}),j.send(typeof L._bodyInit>"u"?null:L._bodyInit)})}return N.polyfill=!0,i.fetch||(i.fetch=N,i.Headers=v,i.Request=A,i.Response=O),s.Headers=v,s.Request=A,s.Response=O,s.fetch=N,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var o=r;t=o.fetch,t.default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(Sl,Sl.exports)),Sl.exports}var x2=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);ot.length?JSON.parse(t):"")}ae.responseToJSON=Ox;function ku(e){if(!e)return e;if(Array.isArray(e))return e.map(n=>n&&typeof n=="object"?ku(n):n);let t={};return Object.keys(e).forEach(n=>{const r=n.toLowerCase(),o=e[n];t[r]=o&&typeof o=="object"?ku(o):o}),t}ae.loweCaseKeys=ku;function Bh(e,t={}){const{includeResponse:n}=t,r=x2(t,["includeResponse"]);return R2(e,Object.assign(Object.assign({mode:"cors"},r),{headers:Object.assign({accept:"application/json"},ku(r.headers))})).then(jx).then(o=>{const i=o.headers.get("content-type")+"";return i.match(/\bjson\b/i)?Ox(o).then(s=>({res:o,body:s})):i.match(/^text\//i)?o.text().then(s=>({res:o,body:s})):{res:o}}).then(({res:o,body:i})=>{if(!i&&o.status==201){const s=o.headers.get("location");if(s)return Bh(s,Object.assign(Object.assign({},r),{method:"GET",body:null,includeResponse:n}))}return n?{body:i,response:o}:i===void 0?o:i})}ae.request=Bh;function Dx(e,t,n=!1){return n||!Cl[e]?(Cl[e]=Bh(e,t),Cl[e]):Promise.resolve(Cl[e])}ae.getAndCache=Dx;function E2(e="/",t){const n=String(e).replace(/\/*$/,"/")+"metadata";return Dx(n,t).catch(r=>{throw new Error(`Failed to fetch the conformance statement from "${n}". ${r}`)})}ae.fetchConformanceStatement=E2;function Vh(e,t=""){if(t=t.trim(),!t)return e;let n=t.split("."),r=e;for(;r&&n.length;){const o=n.shift();if(!o&&Array.isArray(r))return r.map(i=>Vh(i,n.join(".")));r=r[o]}return r}ae.getPath=Vh;function P2(e,t,n,r=!1){return t.trim().split(".").reduce((o,i,s,a)=>{if(o&&s===a.length-1)o[i]=n;else return o&&o[i]===void 0&&r&&(o[i]=a[s+1].match(/^[0-9]+$/)?[]:{}),o?o[i]:void 0},e),e}ae.setPath=P2;function Ix(e){return Array.isArray(e)?e:[e]}ae.makeArray=Ix;function _2(e,t){return e.match(/^http/)||e.match(/^urn/)?e:String(t||"").replace(/\/+$/,"")+"/"+e.replace(/^\/+/,"")}ae.absolute=_2;function T2(e=8,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"){const n=[],r=t.length;for(;e--;)n.push(t.charAt(Math.floor(Math.random()*r)));return n.join("")}ae.randomString=T2;function Fx(e,t){const n=e.split(".")[1];return n?JSON.parse(t.atob(n)):null}ae.jwtDecode=Fx;function A2(e=120,t){return Math.floor(+(t||new Date)/1e3+e)}ae.getTimeInFuture=A2;function M2(e,t){const n=Math.floor(Date.now()/1e3);if(e.expires_in)return n+e.expires_in;if(e.access_token){let r=Fx(e.access_token,t);if(r&&r.exp)return r.exp}return n+300}ae.getAccessTokenExpiration=M2;function Lx(e,t){const n={};function r(o,i){o&&Array.isArray(o.coding)&&o.coding.forEach(({code:s})=>{s&&(n[s]=n[s]||[],n[s].push(i))})}return Ix(e).forEach(o=>{o.resourceType==="Observation"&&o[t]&&(Array.isArray(o[t])?o[t].forEach(i=>r(i,o)):r(o[t],o))}),n}ae.byCode=Lx;function k2(e,t){const n=Lx(e,t);return(...r)=>r.filter(o=>o+""in n).reduce((o,i)=>o.concat(n[i+""]),[])}ae.byCodes=k2;function N2(e,t){const r=(Vh(e,"rest.0.resource")||[]).find(i=>i.type===t);if(!r)throw new Error(`Resource "${t}" is not supported by this FHIR server`);if(!Array.isArray(r.searchParam))throw new Error(`No search parameters supported for "${t}" on this FHIR server`);if(t=="Patient"&&r.searchParam.find(i=>i.name=="_id"))return"_id";const o=C2.patientParams.find(i=>r.searchParam.find(s=>s.name==i));if(!o)throw new Error("I don't know what param to use for "+t);return o}ae.getPatientParam=N2;async function j2(e,t=800,n=720){if(typeof e=="function"&&(e=await e()),e&&typeof e=="object")return e;if(typeof e!="string")return Fs("Invalid target type '%s'. Failing back to '_self'.",typeof e),self;if(e=="_self")return self;if(e=="_parent")return parent;if(e=="_top")return top||self;if(e=="_blank"){let o,i=null;try{if(i=window.open("","SMARTAuthPopup"),!i)throw new Error("Perhaps window.open was blocked")}catch(s){o=s}return i||(Fs("Cannot open window. Failing back to '_self'. %s",o),self)}if(e=="popup"){let o,i=null;try{if(i=window.open("","SMARTAuthPopup",["height="+n,"width="+t,"menubar=0","resizable=1","status=0","top="+(screen.height-n)/2,"left="+(screen.width-t)/2].join(",")),!i)throw new Error("Perhaps the popup window was blocked")}catch(s){o=s}return i||(Fs("Cannot open window. Failing back to '_self'. %s",o),self)}const r=frames[e];return r||(Fs("Unknown target '%s'. Failing back to '_self'.",e),self)}ae.getTargetWindow=j2;function An(e,t){if(!e)throw new Error(t)}ae.assert=An;function O2(e){An(Array.isArray(e),"The JSON patch must be an array"),An(e.length>0,"The JSON patch array should not be empty"),e.forEach(t=>{An(["add","replace","test","move","copy","remove"].indexOf(t.op)>-1,'Each patch operation must have an "op" property which must be one of: "add", "replace", "test", "move", "copy", "remove"'),An(t.path&&typeof t.path,`Invalid "${t.op}" operation. Missing "path" property`),t.op=="add"||t.op=="replace"||t.op=="test"?(An("value"in t,`Invalid "${t.op}" operation. Missing "value" property`),An(Object.keys(t).length==3,`Invalid "${t.op}" operation. Contains unknown properties`)):t.op=="move"||t.op=="copy"?(An(typeof t.from=="string",`Invalid "${t.op}" operation. Requires a string "from" property`),An(Object.keys(t).length==3,`Invalid "${t.op}" operation. Contains unknown properties`)):An(Object.keys(t).length==2,`Invalid "${t.op}" operation. Contains unknown properties`)})}ae.assertJsonPatch=O2;var pc={},Hh={};Object.defineProperty(Hh,"__esModule",{value:!0});Hh.default={expired:"Session expired! Please re-launch the app",noScopeForId:"Trying to get the ID of the selected %s. Please add 'launch' or 'launch/%s' to the requested scopes and try again.",noIfNoAuth:"You are trying to get %s but the app is not authorized yet.",noFreeContext:"Please don't use open fhir servers if you need to access launch context items like the %S."};Object.defineProperty(pc,"__esModule",{value:!0});const Se=ae,Tn=Hh,ql=rn,{Response:D2}=typeof FHIRCLIENT_PURE<"u"?window:zh(),Dt=Se.debug.extend("client");async function I2(e,t){const n=(0,Se.absolute)("/",t.state.serverUrl);async function r(o){const i=o.pathname.split("/").pop();(0,Se.assert)(i,`Invalid url "${o}"`),(0,Se.assert)(ql.patientCompartment.indexOf(i)>-1,`Cannot filter "${i}" resources by patient`);const s=await(0,Se.fetchConformanceStatement)(t.state.serverUrl),a=(0,Se.getPatientParam)(s,i);return o.searchParams.set(a,t.patient.id),o.href}return typeof e=="string"||e instanceof URL?{url:await r(new URL(e+"",n))}:(e.url=await r(new URL(e.url+"",n)),e)}function F2(e,t,n,r){if(!t[e]){const{signal:o,headers:i}=r;t[e]=n.request({url:e,headers:i,signal:o}).then(s=>(t[e]=s,s),s=>{throw delete t[e],s})}return Promise.resolve(t[e])}function L2(e,t,n,r,o,i){const s=(0,Se.getPath)(e,t);if(s){const a=Array.isArray(s);return Promise.all((0,Se.makeArray)(s).filter(Boolean).map((l,u)=>{const d=l.reference;if(d)return F2(d,r,o,i).then(c=>{n&&(a?t.indexOf("..")>-1?(0,Se.setPath)(e,`${t.replace("..",`.${u}.`)}`,c):(0,Se.setPath)(e,`${t}.${u}`,c):(0,Se.setPath)(e,t,c))}).catch(c=>{if(c.status!==404)throw c})}))}}function Kv(e,t,n,r,o){let i=(0,Se.makeArray)(t.resolveReferences).filter(Boolean).map(l=>String(l).trim()).filter(Boolean);if(i=i.filter((l,u)=>i.indexOf(l,u+1)>-1?(Dt('Duplicated reference path "%s"',l),!1):!0),!i.length)return Promise.resolve();const s={};i.forEach(l=>{const u=l.split(".").length;s[u]||(s[u]=[]),s[u].push(l)});let a=Promise.resolve();return Object.keys(s).sort().forEach(l=>{const u=s[l];a=a.then(()=>Promise.all(u.map(d=>L2(e,d,!!t.graph,n,r,o))))}),a}class $2{constructor(t,n){this.units=Se.units;const r=typeof n=="string"?{serverUrl:n}:n;(0,Se.assert)(r.serverUrl&&r.serverUrl.match(/https?:\/\/.+/),'A "serverUrl" option is required and must begin with "http(s)"'),this.state=r,this.environment=t,this._refreshTask=null;const o=this;this.patient={get id(){return o.getPatientId()},read:i=>{const s=this.patient.id;return s?this.request(Object.assign(Object.assign({},i),{url:`Patient/${s}`})):Promise.reject(new Error("Patient is not available"))},request:(i,s={})=>this.patient.id?(async()=>{const a=await I2(i,this);return this.request(a,s)})():Promise.reject(new Error("Patient is not available"))},this.encounter={get id(){return o.getEncounterId()},read:i=>{const s=this.encounter.id;return s?this.request(Object.assign(Object.assign({},i),{url:`Encounter/${s}`})):Promise.reject(new Error("Encounter is not available"))}},this.user={get fhirUser(){return o.getFhirUser()},get id(){return o.getUserId()},get resourceType(){return o.getUserType()},read:i=>{const s=this.user.fhirUser;return s?this.request(Object.assign(Object.assign({},i),{url:s})):Promise.reject(new Error("User is not available"))}},this.connect(t.fhir)}connect(t){if(typeof t=="function"){const n={baseUrl:this.state.serverUrl.replace(/\/$/,"")},r=this.getState("tokenResponse.access_token");if(r)n.auth={token:r};else{const{username:i,password:s}=this.state;i&&s&&(n.auth={user:i,pass:s})}this.api=t(n);const o=this.getState("tokenResponse.patient");o&&(this.patient.api=t(Object.assign(Object.assign({},n),{patient:o})))}return this}getPatientId(){const t=this.state.tokenResponse;return t?t.patient?t.patient:((this.state.scope||"").match(/\blaunch(\/patient)?\b/)?Dt("The ID of the selected patient is not available. Please check if your server supports that."):Dt(Tn.default.noScopeForId,"patient","patient"),null):(this.state.authorizeUri?Dt(Tn.default.noIfNoAuth,"the ID of the selected patient"):Dt(Tn.default.noFreeContext,"selected patient"),null)}getEncounterId(){const t=this.state.tokenResponse;return t?t.encounter?t.encounter:((this.state.scope||"").match(/\blaunch(\/encounter)?\b/)?Dt("The ID of the selected encounter is not available. Please check if your server supports that, and that the selected patient has any recorded encounters."):Dt(Tn.default.noScopeForId,"encounter","encounter"),null):(this.state.authorizeUri?Dt(Tn.default.noIfNoAuth,"the ID of the selected encounter"):Dt(Tn.default.noFreeContext,"selected encounter"),null)}getIdToken(){const t=this.state.tokenResponse;if(t){const n=t.id_token,r=this.state.scope||"";if(!n){const o=r.match(/\bopenid\b/),i=r.match(/\bprofile\b/),s=r.match(/\bfhirUser\b/);return Dt(!o||!(s||i)?"You are trying to get the id_token but you are not using the right scopes. Please add 'openid' and 'fhirUser' or 'profile' to the scopes you are requesting.":"The id_token is not available. Please check if your server supports that."),null}return(0,Se.jwtDecode)(n,this.environment)}return this.state.authorizeUri?Dt(Tn.default.noIfNoAuth,"the id_token"):Dt(Tn.default.noFreeContext,"id_token"),null}getFhirUser(){const t=this.getIdToken();return t?t.fhirUser?t.fhirUser.split("/").slice(-2).join("/"):t.profile:null}getUserId(){const t=this.getFhirUser();return t?t.split("/")[1]:null}getUserType(){const t=this.getFhirUser();return t?t.split("/")[0]:null}getAuthorizationHeader(){const t=this.getState("tokenResponse.access_token");if(t)return"Bearer "+t;const{username:n,password:r}=this.state;return n&&r?"Basic "+this.environment.btoa(n+":"+r):null}async _clearState(){const t=this.environment.getStorage(),n=await t.get(ql.SMART_KEY);n&&await t.unset(n),await t.unset(ql.SMART_KEY),this.state.tokenResponse={}}create(t,n){return this.request(Object.assign(Object.assign({},n),{url:`${t.resourceType}`,method:"POST",body:JSON.stringify(t),headers:Object.assign({"content-type":"application/json"},(n||{}).headers)}))}update(t,n){return this.request(Object.assign(Object.assign({},n),{url:`${t.resourceType}/${t.id}`,method:"PUT",body:JSON.stringify(t),headers:Object.assign({"content-type":"application/json"},(n||{}).headers)}))}delete(t,n={}){return this.request(Object.assign(Object.assign({},n),{url:t,method:"DELETE"}))}async patch(t,n,r={}){return(0,Se.assertJsonPatch)(n),this.request(Object.assign(Object.assign({},r),{url:t,method:"PATCH",body:JSON.stringify(n),headers:Object.assign({prefer:"return=presentation","content-type":"application/json-patch+json; charset=UTF-8"},r.headers)}))}async request(t,n={},r={}){var o;const i=Se.debug.extend("client:request");(0,Se.assert)(t,"request requires an url or request options as argument");let s;typeof t=="string"||t instanceof URL?(s=String(t),t={}):s=String(t.url),s=(0,Se.absolute)(s,this.state.serverUrl);const a={graph:n.graph!==!1,flat:!!n.flat,pageLimit:(o=n.pageLimit)!==null&&o!==void 0?o:1,resolveReferences:n.resolveReferences||[],useRefreshToken:n.useRefreshToken!==!1,onPage:typeof n.onPage=="function"?n.onPage:void 0},l=t.signal||void 0,u=a.useRefreshToken?this.refreshIfNeeded({signal:l}).then(()=>t):Promise.resolve(t);let d;return u.then(c=>{const f=this.getAuthorizationHeader();return f&&(c.headers=Object.assign(Object.assign({},c.headers),{authorization:f})),c}).then(c=>(i("%s, options: %O, fhirOptions: %O",s,c,a),(0,Se.request)(s,c).then(f=>c.includeResponse?(d=f.response,f.body):f))).catch(async c=>{throw c.status==401?this.getState("tokenResponse.access_token")?a.useRefreshToken?(i("Auto-refresh failed! Please re-launch the app."),await this._clearState(),c.message+=` +`+n)}}catch{}return this}toJSON(){return{name:this.name,statusCode:this.statusCode,status:this.status,statusText:this.statusText,message:this.message}}}zh.default=v2;var rn={};Object.defineProperty(rn,"__esModule",{value:!0});rn.SMART_KEY=rn.patientParams=rn.fhirVersions=rn.patientCompartment=void 0;rn.patientCompartment=["Account","AdverseEvent","AllergyIntolerance","Appointment","AppointmentResponse","AuditEvent","Basic","BodySite","BodyStructure","CarePlan","CareTeam","ChargeItem","Claim","ClaimResponse","ClinicalImpression","Communication","CommunicationRequest","Composition","Condition","Consent","Coverage","CoverageEligibilityRequest","CoverageEligibilityResponse","DetectedIssue","DeviceRequest","DeviceUseRequest","DeviceUseStatement","DiagnosticOrder","DiagnosticReport","DocumentManifest","DocumentReference","EligibilityRequest","Encounter","EnrollmentRequest","EpisodeOfCare","ExplanationOfBenefit","FamilyMemberHistory","Flag","Goal","Group","ImagingManifest","ImagingObjectSelection","ImagingStudy","Immunization","ImmunizationEvaluation","ImmunizationRecommendation","Invoice","List","MeasureReport","Media","MedicationAdministration","MedicationDispense","MedicationOrder","MedicationRequest","MedicationStatement","MolecularSequence","NutritionOrder","Observation","Order","Patient","Person","Procedure","ProcedureRequest","Provenance","QuestionnaireResponse","ReferralRequest","RelatedPerson","RequestGroup","ResearchSubject","RiskAssessment","Schedule","ServiceRequest","Specimen","SupplyDelivery","SupplyRequest","VisionPrescription"];rn.fhirVersions={"0.4.0":2,"0.5.0":2,"1.0.0":2,"1.0.1":2,"1.0.2":2,"1.1.0":3,"1.4.0":3,"1.6.0":3,"1.8.0":3,"3.0.0":3,"3.0.1":3,"3.3.0":4,"3.5.0":4,"4.0.0":4,"4.0.1":4};rn.patientParams=["patient","subject","requester","member","actor","beneficiary"];rn.SMART_KEY="SMART_KEY";var Hf={exports:{}},vd,Hv;function y2(){if(Hv)return vd;Hv=1;var e=1e3,t=e*60,n=t*60,r=n*24,o=r*7,i=r*365.25;vd=function(d,c){c=c||{};var f=typeof d;if(f==="string"&&d.length>0)return s(d);if(f==="number"&&isFinite(d))return c.long?l(d):a(d);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(d))};function s(d){if(d=String(d),!(d.length>100)){var c=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(d);if(c){var f=parseFloat(c[1]),m=(c[2]||"ms").toLowerCase();switch(m){case"years":case"year":case"yrs":case"yr":case"y":return f*i;case"weeks":case"week":case"w":return f*o;case"days":case"day":case"d":return f*r;case"hours":case"hour":case"hrs":case"hr":case"h":return f*n;case"minutes":case"minute":case"mins":case"min":case"m":return f*t;case"seconds":case"second":case"secs":case"sec":case"s":return f*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return f;default:return}}}}function a(d){var c=Math.abs(d);return c>=r?Math.round(d/r)+"d":c>=n?Math.round(d/n)+"h":c>=t?Math.round(d/t)+"m":c>=e?Math.round(d/e)+"s":d+"ms"}function l(d){var c=Math.abs(d);return c>=r?u(d,c,r,"day"):c>=n?u(d,c,n,"hour"):c>=t?u(d,c,t,"minute"):c>=e?u(d,c,e,"second"):d+" ms"}function u(d,c,f,m){var v=c>=f*1.5;return Math.round(d/f)+" "+m+(v?"s":"")}return vd}function w2(e){n.debug=n,n.default=n,n.coerce=l,n.disable=i,n.enable=o,n.enabled=s,n.humanize=y2(),n.destroy=u,Object.keys(e).forEach(d=>{n[d]=e[d]}),n.names=[],n.skips=[],n.formatters={};function t(d){let c=0;for(let f=0;f{if(b==="%%")return"%";C++;const A=n.formatters[M];if(typeof A=="function"){const $=x[C];b=A.call(w,$),x.splice(C,1),C--}return b}),n.formatArgs.call(w,x),(w.log||n.log).apply(w,x)}return y.namespace=d,y.useColors=n.useColors(),y.color=n.selectColor(d),y.extend=r,y.destroy=n.destroy,Object.defineProperty(y,"enabled",{enumerable:!0,configurable:!1,get:()=>f!==null?f:(m!==n.namespaces&&(m=n.namespaces,v=n.enabled(d)),v),set:x=>{f=x}}),typeof n.init=="function"&&n.init(y),y}function r(d,c){const f=n(this.namespace+(typeof c>"u"?":":c)+d);return f.log=this.log,f}function o(d){n.save(d),n.namespaces=d,n.names=[],n.skips=[];let c;const f=(typeof d=="string"?d:"").split(/[\s,]+/),m=f.length;for(c=0;c"-"+c)].join(",");return n.enable(""),d}function s(d){if(d[d.length-1]==="*")return!0;let c,f;for(c=0,f=n.skips.length;c{let u=!1;return()=>{u||(u=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let u;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(u=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(u[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function o(u){if(u[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+u[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const d="color: "+this.color;u.splice(1,0,d,"color: inherit");let c=0,f=0;u[0].replace(/%[a-zA-Z%]/g,m=>{m!=="%%"&&(c++,m==="%c"&&(f=c))}),u.splice(f,0,d)}t.log=console.debug||console.log||(()=>{});function i(u){try{u?t.storage.setItem("debug",u):t.storage.removeItem("debug")}catch{}}function s(){let u;try{u=t.storage.getItem("debug")}catch{}return!u&&typeof process<"u"&&"env"in process&&(u=n.DEBUG),u}function a(){try{return localStorage}catch{}}e.exports=x2(t);const{formatters:l}=e.exports;l.j=function(u){try{return JSON.stringify(u)}catch(d){return"[UnexpectedJSONParseError]: "+d.message}}})(Hf,Hf.exports);var S2=Hf.exports,Sl={exports:{}},Kv;function Bh(){return Kv||(Kv=1,function(e,t){var n=typeof self<"u"?self:Us,r=function(){function i(){this.fetch=!1,this.DOMException=n.DOMException}return i.prototype=n,new i}();(function(i){(function(s){var a={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function l(E){return E&&DataView.prototype.isPrototypeOf(E)}if(a.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(E){return E&&u.indexOf(Object.prototype.toString.call(E))>-1};function c(E){if(typeof E!="string"&&(E=String(E)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(E))throw new TypeError("Invalid character in header field name");return E.toLowerCase()}function f(E){return typeof E!="string"&&(E=String(E)),E}function m(E){var T={next:function(){var D=E.shift();return{done:D===void 0,value:D}}};return a.iterable&&(T[Symbol.iterator]=function(){return T}),T}function v(E){this.map={},E instanceof v?E.forEach(function(T,D){this.append(D,T)},this):Array.isArray(E)?E.forEach(function(T){this.append(T[0],T[1])},this):E&&Object.getOwnPropertyNames(E).forEach(function(T){this.append(T,E[T])},this)}v.prototype.append=function(E,T){E=c(E),T=f(T);var D=this.map[E];this.map[E]=D?D+", "+T:T},v.prototype.delete=function(E){delete this.map[c(E)]},v.prototype.get=function(E){return E=c(E),this.has(E)?this.map[E]:null},v.prototype.has=function(E){return this.map.hasOwnProperty(c(E))},v.prototype.set=function(E,T){this.map[c(E)]=f(T)},v.prototype.forEach=function(E,T){for(var D in this.map)this.map.hasOwnProperty(D)&&E.call(T,this.map[D],D,this)},v.prototype.keys=function(){var E=[];return this.forEach(function(T,D){E.push(D)}),m(E)},v.prototype.values=function(){var E=[];return this.forEach(function(T){E.push(T)}),m(E)},v.prototype.entries=function(){var E=[];return this.forEach(function(T,D){E.push([D,T])}),m(E)},a.iterable&&(v.prototype[Symbol.iterator]=v.prototype.entries);function y(E){if(E.bodyUsed)return Promise.reject(new TypeError("Already read"));E.bodyUsed=!0}function x(E){return new Promise(function(T,D){E.onload=function(){T(E.result)},E.onerror=function(){D(E.error)}})}function w(E){var T=new FileReader,D=x(T);return T.readAsArrayBuffer(E),D}function g(E){var T=new FileReader,D=x(T);return T.readAsText(E),D}function S(E){for(var T=new Uint8Array(E),D=new Array(T.length),V=0;V-1?T:E}function A(E,T){T=T||{};var D=T.body;if(E instanceof A){if(E.bodyUsed)throw new TypeError("Already read");this.url=E.url,this.credentials=E.credentials,T.headers||(this.headers=new v(E.headers)),this.method=E.method,this.mode=E.mode,this.signal=E.signal,!D&&E._bodyInit!=null&&(D=E._bodyInit,E.bodyUsed=!0)}else this.url=String(E);if(this.credentials=T.credentials||this.credentials||"same-origin",(T.headers||!this.headers)&&(this.headers=new v(T.headers)),this.method=M(T.method||this.method||"GET"),this.mode=T.mode||this.mode||null,this.signal=T.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&D)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(D)}A.prototype.clone=function(){return new A(this,{body:this._bodyInit})};function $(E){var T=new FormData;return E.trim().split("&").forEach(function(D){if(D){var V=D.split("="),L=V.shift().replace(/\+/g," "),j=V.join("=").replace(/\+/g," ");T.append(decodeURIComponent(L),decodeURIComponent(j))}}),T}function R(E){var T=new v,D=E.replace(/\r?\n[\t ]+/g," ");return D.split(/\r?\n/).forEach(function(V){var L=V.split(":"),j=L.shift().trim();if(j){var B=L.join(":").trim();T.append(j,B)}}),T}P.call(A.prototype);function O(E,T){T||(T={}),this.type="default",this.status=T.status===void 0?200:T.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in T?T.statusText:"OK",this.headers=new v(T.headers),this.url=T.url||"",this._initBody(E)}P.call(O.prototype),O.prototype.clone=function(){return new O(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new v(this.headers),url:this.url})},O.error=function(){var E=new O(null,{status:0,statusText:""});return E.type="error",E};var F=[301,302,303,307,308];O.redirect=function(E,T){if(F.indexOf(T)===-1)throw new RangeError("Invalid status code");return new O(null,{status:T,headers:{location:E}})},s.DOMException=i.DOMException;try{new s.DOMException}catch{s.DOMException=function(T,D){this.message=T,this.name=D;var V=Error(T);this.stack=V.stack},s.DOMException.prototype=Object.create(Error.prototype),s.DOMException.prototype.constructor=s.DOMException}function N(E,T){return new Promise(function(D,V){var L=new A(E,T);if(L.signal&&L.signal.aborted)return V(new s.DOMException("Aborted","AbortError"));var j=new XMLHttpRequest;function B(){j.abort()}j.onload=function(){var Q={status:j.status,statusText:j.statusText,headers:R(j.getAllResponseHeaders()||"")};Q.url="responseURL"in j?j.responseURL:Q.headers.get("X-Request-URL");var te="response"in j?j.response:j.responseText;D(new O(te,Q))},j.onerror=function(){V(new TypeError("Network request failed"))},j.ontimeout=function(){V(new TypeError("Network request failed"))},j.onabort=function(){V(new s.DOMException("Aborted","AbortError"))},j.open(L.method,L.url,!0),L.credentials==="include"?j.withCredentials=!0:L.credentials==="omit"&&(j.withCredentials=!1),"responseType"in j&&a.blob&&(j.responseType="blob"),L.headers.forEach(function(Q,te){j.setRequestHeader(te,Q)}),L.signal&&(L.signal.addEventListener("abort",B),j.onreadystatechange=function(){j.readyState===4&&L.signal.removeEventListener("abort",B)}),j.send(typeof L._bodyInit>"u"?null:L._bodyInit)})}return N.polyfill=!0,i.fetch||(i.fetch=N,i.Headers=v,i.Request=A,i.Response=O),s.Headers=v,s.Request=A,s.Response=O,s.fetch=N,Object.defineProperty(s,"__esModule",{value:!0}),s})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var o=r;t=o.fetch,t.default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}(Sl,Sl.exports)),Sl.exports}var C2=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);ot.length?JSON.parse(t):"")}ae.responseToJSON=Ix;function ku(e){if(!e)return e;if(Array.isArray(e))return e.map(n=>n&&typeof n=="object"?ku(n):n);let t={};return Object.keys(e).forEach(n=>{const r=n.toLowerCase(),o=e[n];t[r]=o&&typeof o=="object"?ku(o):o}),t}ae.loweCaseKeys=ku;function Vh(e,t={}){const{includeResponse:n}=t,r=C2(t,["includeResponse"]);return P2(e,Object.assign(Object.assign({mode:"cors"},r),{headers:Object.assign({accept:"application/json"},ku(r.headers))})).then(Dx).then(o=>{const i=o.headers.get("content-type")+"";return i.match(/\bjson\b/i)?Ix(o).then(s=>({res:o,body:s})):i.match(/^text\//i)?o.text().then(s=>({res:o,body:s})):{res:o}}).then(({res:o,body:i})=>{if(!i&&o.status==201){const s=o.headers.get("location");if(s)return Vh(s,Object.assign(Object.assign({},r),{method:"GET",body:null,includeResponse:n}))}return n?{body:i,response:o}:i===void 0?o:i})}ae.request=Vh;function Fx(e,t,n=!1){return n||!Cl[e]?(Cl[e]=Vh(e,t),Cl[e]):Promise.resolve(Cl[e])}ae.getAndCache=Fx;function _2(e="/",t){const n=String(e).replace(/\/*$/,"/")+"metadata";return Fx(n,t).catch(r=>{throw new Error(`Failed to fetch the conformance statement from "${n}". ${r}`)})}ae.fetchConformanceStatement=_2;function Hh(e,t=""){if(t=t.trim(),!t)return e;let n=t.split("."),r=e;for(;r&&n.length;){const o=n.shift();if(!o&&Array.isArray(r))return r.map(i=>Hh(i,n.join(".")));r=r[o]}return r}ae.getPath=Hh;function T2(e,t,n,r=!1){return t.trim().split(".").reduce((o,i,s,a)=>{if(o&&s===a.length-1)o[i]=n;else return o&&o[i]===void 0&&r&&(o[i]=a[s+1].match(/^[0-9]+$/)?[]:{}),o?o[i]:void 0},e),e}ae.setPath=T2;function Lx(e){return Array.isArray(e)?e:[e]}ae.makeArray=Lx;function A2(e,t){return e.match(/^http/)||e.match(/^urn/)?e:String(t||"").replace(/\/+$/,"")+"/"+e.replace(/^\/+/,"")}ae.absolute=A2;function M2(e=8,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"){const n=[],r=t.length;for(;e--;)n.push(t.charAt(Math.floor(Math.random()*r)));return n.join("")}ae.randomString=M2;function $x(e,t){const n=e.split(".")[1];return n?JSON.parse(t.atob(n)):null}ae.jwtDecode=$x;function k2(e=120,t){return Math.floor(+(t||new Date)/1e3+e)}ae.getTimeInFuture=k2;function N2(e,t){const n=Math.floor(Date.now()/1e3);if(e.expires_in)return n+e.expires_in;if(e.access_token){let r=$x(e.access_token,t);if(r&&r.exp)return r.exp}return n+300}ae.getAccessTokenExpiration=N2;function Ux(e,t){const n={};function r(o,i){o&&Array.isArray(o.coding)&&o.coding.forEach(({code:s})=>{s&&(n[s]=n[s]||[],n[s].push(i))})}return Lx(e).forEach(o=>{o.resourceType==="Observation"&&o[t]&&(Array.isArray(o[t])?o[t].forEach(i=>r(i,o)):r(o[t],o))}),n}ae.byCode=Ux;function j2(e,t){const n=Ux(e,t);return(...r)=>r.filter(o=>o+""in n).reduce((o,i)=>o.concat(n[i+""]),[])}ae.byCodes=j2;function O2(e,t){const r=(Hh(e,"rest.0.resource")||[]).find(i=>i.type===t);if(!r)throw new Error(`Resource "${t}" is not supported by this FHIR server`);if(!Array.isArray(r.searchParam))throw new Error(`No search parameters supported for "${t}" on this FHIR server`);if(t=="Patient"&&r.searchParam.find(i=>i.name=="_id"))return"_id";const o=R2.patientParams.find(i=>r.searchParam.find(s=>s.name==i));if(!o)throw new Error("I don't know what param to use for "+t);return o}ae.getPatientParam=O2;async function D2(e,t=800,n=720){if(typeof e=="function"&&(e=await e()),e&&typeof e=="object")return e;if(typeof e!="string")return Fs("Invalid target type '%s'. Failing back to '_self'.",typeof e),self;if(e=="_self")return self;if(e=="_parent")return parent;if(e=="_top")return top||self;if(e=="_blank"){let o,i=null;try{if(i=window.open("","SMARTAuthPopup"),!i)throw new Error("Perhaps window.open was blocked")}catch(s){o=s}return i||(Fs("Cannot open window. Failing back to '_self'. %s",o),self)}if(e=="popup"){let o,i=null;try{if(i=window.open("","SMARTAuthPopup",["height="+n,"width="+t,"menubar=0","resizable=1","status=0","top="+(screen.height-n)/2,"left="+(screen.width-t)/2].join(",")),!i)throw new Error("Perhaps the popup window was blocked")}catch(s){o=s}return i||(Fs("Cannot open window. Failing back to '_self'. %s",o),self)}const r=frames[e];return r||(Fs("Unknown target '%s'. Failing back to '_self'.",e),self)}ae.getTargetWindow=D2;function An(e,t){if(!e)throw new Error(t)}ae.assert=An;function I2(e){An(Array.isArray(e),"The JSON patch must be an array"),An(e.length>0,"The JSON patch array should not be empty"),e.forEach(t=>{An(["add","replace","test","move","copy","remove"].indexOf(t.op)>-1,'Each patch operation must have an "op" property which must be one of: "add", "replace", "test", "move", "copy", "remove"'),An(t.path&&typeof t.path,`Invalid "${t.op}" operation. Missing "path" property`),t.op=="add"||t.op=="replace"||t.op=="test"?(An("value"in t,`Invalid "${t.op}" operation. Missing "value" property`),An(Object.keys(t).length==3,`Invalid "${t.op}" operation. Contains unknown properties`)):t.op=="move"||t.op=="copy"?(An(typeof t.from=="string",`Invalid "${t.op}" operation. Requires a string "from" property`),An(Object.keys(t).length==3,`Invalid "${t.op}" operation. Contains unknown properties`)):An(Object.keys(t).length==2,`Invalid "${t.op}" operation. Contains unknown properties`)})}ae.assertJsonPatch=I2;var pc={},Kh={};Object.defineProperty(Kh,"__esModule",{value:!0});Kh.default={expired:"Session expired! Please re-launch the app",noScopeForId:"Trying to get the ID of the selected %s. Please add 'launch' or 'launch/%s' to the requested scopes and try again.",noIfNoAuth:"You are trying to get %s but the app is not authorized yet.",noFreeContext:"Please don't use open fhir servers if you need to access launch context items like the %S."};Object.defineProperty(pc,"__esModule",{value:!0});const Se=ae,Tn=Kh,ql=rn,{Response:F2}=typeof FHIRCLIENT_PURE<"u"?window:Bh(),Dt=Se.debug.extend("client");async function L2(e,t){const n=(0,Se.absolute)("/",t.state.serverUrl);async function r(o){const i=o.pathname.split("/").pop();(0,Se.assert)(i,`Invalid url "${o}"`),(0,Se.assert)(ql.patientCompartment.indexOf(i)>-1,`Cannot filter "${i}" resources by patient`);const s=await(0,Se.fetchConformanceStatement)(t.state.serverUrl),a=(0,Se.getPatientParam)(s,i);return o.searchParams.set(a,t.patient.id),o.href}return typeof e=="string"||e instanceof URL?{url:await r(new URL(e+"",n))}:(e.url=await r(new URL(e.url+"",n)),e)}function $2(e,t,n,r){if(!t[e]){const{signal:o,headers:i}=r;t[e]=n.request({url:e,headers:i,signal:o}).then(s=>(t[e]=s,s),s=>{throw delete t[e],s})}return Promise.resolve(t[e])}function U2(e,t,n,r,o,i){const s=(0,Se.getPath)(e,t);if(s){const a=Array.isArray(s);return Promise.all((0,Se.makeArray)(s).filter(Boolean).map((l,u)=>{const d=l.reference;if(d)return $2(d,r,o,i).then(c=>{n&&(a?t.indexOf("..")>-1?(0,Se.setPath)(e,`${t.replace("..",`.${u}.`)}`,c):(0,Se.setPath)(e,`${t}.${u}`,c):(0,Se.setPath)(e,t,c))}).catch(c=>{if(c.status!==404)throw c})}))}}function Gv(e,t,n,r,o){let i=(0,Se.makeArray)(t.resolveReferences).filter(Boolean).map(l=>String(l).trim()).filter(Boolean);if(i=i.filter((l,u)=>i.indexOf(l,u+1)>-1?(Dt('Duplicated reference path "%s"',l),!1):!0),!i.length)return Promise.resolve();const s={};i.forEach(l=>{const u=l.split(".").length;s[u]||(s[u]=[]),s[u].push(l)});let a=Promise.resolve();return Object.keys(s).sort().forEach(l=>{const u=s[l];a=a.then(()=>Promise.all(u.map(d=>U2(e,d,!!t.graph,n,r,o))))}),a}class z2{constructor(t,n){this.units=Se.units;const r=typeof n=="string"?{serverUrl:n}:n;(0,Se.assert)(r.serverUrl&&r.serverUrl.match(/https?:\/\/.+/),'A "serverUrl" option is required and must begin with "http(s)"'),this.state=r,this.environment=t,this._refreshTask=null;const o=this;this.patient={get id(){return o.getPatientId()},read:i=>{const s=this.patient.id;return s?this.request(Object.assign(Object.assign({},i),{url:`Patient/${s}`})):Promise.reject(new Error("Patient is not available"))},request:(i,s={})=>this.patient.id?(async()=>{const a=await L2(i,this);return this.request(a,s)})():Promise.reject(new Error("Patient is not available"))},this.encounter={get id(){return o.getEncounterId()},read:i=>{const s=this.encounter.id;return s?this.request(Object.assign(Object.assign({},i),{url:`Encounter/${s}`})):Promise.reject(new Error("Encounter is not available"))}},this.user={get fhirUser(){return o.getFhirUser()},get id(){return o.getUserId()},get resourceType(){return o.getUserType()},read:i=>{const s=this.user.fhirUser;return s?this.request(Object.assign(Object.assign({},i),{url:s})):Promise.reject(new Error("User is not available"))}},this.connect(t.fhir)}connect(t){if(typeof t=="function"){const n={baseUrl:this.state.serverUrl.replace(/\/$/,"")},r=this.getState("tokenResponse.access_token");if(r)n.auth={token:r};else{const{username:i,password:s}=this.state;i&&s&&(n.auth={user:i,pass:s})}this.api=t(n);const o=this.getState("tokenResponse.patient");o&&(this.patient.api=t(Object.assign(Object.assign({},n),{patient:o})))}return this}getPatientId(){const t=this.state.tokenResponse;return t?t.patient?t.patient:((this.state.scope||"").match(/\blaunch(\/patient)?\b/)?Dt("The ID of the selected patient is not available. Please check if your server supports that."):Dt(Tn.default.noScopeForId,"patient","patient"),null):(this.state.authorizeUri?Dt(Tn.default.noIfNoAuth,"the ID of the selected patient"):Dt(Tn.default.noFreeContext,"selected patient"),null)}getEncounterId(){const t=this.state.tokenResponse;return t?t.encounter?t.encounter:((this.state.scope||"").match(/\blaunch(\/encounter)?\b/)?Dt("The ID of the selected encounter is not available. Please check if your server supports that, and that the selected patient has any recorded encounters."):Dt(Tn.default.noScopeForId,"encounter","encounter"),null):(this.state.authorizeUri?Dt(Tn.default.noIfNoAuth,"the ID of the selected encounter"):Dt(Tn.default.noFreeContext,"selected encounter"),null)}getIdToken(){const t=this.state.tokenResponse;if(t){const n=t.id_token,r=this.state.scope||"";if(!n){const o=r.match(/\bopenid\b/),i=r.match(/\bprofile\b/),s=r.match(/\bfhirUser\b/);return Dt(!o||!(s||i)?"You are trying to get the id_token but you are not using the right scopes. Please add 'openid' and 'fhirUser' or 'profile' to the scopes you are requesting.":"The id_token is not available. Please check if your server supports that."),null}return(0,Se.jwtDecode)(n,this.environment)}return this.state.authorizeUri?Dt(Tn.default.noIfNoAuth,"the id_token"):Dt(Tn.default.noFreeContext,"id_token"),null}getFhirUser(){const t=this.getIdToken();return t?t.fhirUser?t.fhirUser.split("/").slice(-2).join("/"):t.profile:null}getUserId(){const t=this.getFhirUser();return t?t.split("/")[1]:null}getUserType(){const t=this.getFhirUser();return t?t.split("/")[0]:null}getAuthorizationHeader(){const t=this.getState("tokenResponse.access_token");if(t)return"Bearer "+t;const{username:n,password:r}=this.state;return n&&r?"Basic "+this.environment.btoa(n+":"+r):null}async _clearState(){const t=this.environment.getStorage(),n=await t.get(ql.SMART_KEY);n&&await t.unset(n),await t.unset(ql.SMART_KEY),this.state.tokenResponse={}}create(t,n){return this.request(Object.assign(Object.assign({},n),{url:`${t.resourceType}`,method:"POST",body:JSON.stringify(t),headers:Object.assign({"content-type":"application/json"},(n||{}).headers)}))}update(t,n){return this.request(Object.assign(Object.assign({},n),{url:`${t.resourceType}/${t.id}`,method:"PUT",body:JSON.stringify(t),headers:Object.assign({"content-type":"application/json"},(n||{}).headers)}))}delete(t,n={}){return this.request(Object.assign(Object.assign({},n),{url:t,method:"DELETE"}))}async patch(t,n,r={}){return(0,Se.assertJsonPatch)(n),this.request(Object.assign(Object.assign({},r),{url:t,method:"PATCH",body:JSON.stringify(n),headers:Object.assign({prefer:"return=presentation","content-type":"application/json-patch+json; charset=UTF-8"},r.headers)}))}async request(t,n={},r={}){var o;const i=Se.debug.extend("client:request");(0,Se.assert)(t,"request requires an url or request options as argument");let s;typeof t=="string"||t instanceof URL?(s=String(t),t={}):s=String(t.url),s=(0,Se.absolute)(s,this.state.serverUrl);const a={graph:n.graph!==!1,flat:!!n.flat,pageLimit:(o=n.pageLimit)!==null&&o!==void 0?o:1,resolveReferences:n.resolveReferences||[],useRefreshToken:n.useRefreshToken!==!1,onPage:typeof n.onPage=="function"?n.onPage:void 0},l=t.signal||void 0,u=a.useRefreshToken?this.refreshIfNeeded({signal:l}).then(()=>t):Promise.resolve(t);let d;return u.then(c=>{const f=this.getAuthorizationHeader();return f&&(c.headers=Object.assign(Object.assign({},c.headers),{authorization:f})),c}).then(c=>(i("%s, options: %O, fhirOptions: %O",s,c,a),(0,Se.request)(s,c).then(f=>c.includeResponse?(d=f.response,f.body):f))).catch(async c=>{throw c.status==401?this.getState("tokenResponse.access_token")?a.useRefreshToken?(i("Auto-refresh failed! Please re-launch the app."),await this._clearState(),c.message+=` `+Tn.default.expired,c):(i("Your session has expired and the useRefreshToken option is set to false. Please re-launch the app."),await this._clearState(),c.message+=` `+Tn.default.expired,c):(c.message+=` -This app cannot be accessed directly. Please launch it as SMART app!`,c):c}).catch(c=>{throw c.status==403&&i("Permission denied! Please make sure that you have requested the proper scopes."),c}).then(c=>!c||typeof c=="string"||c instanceof D2?t.includeResponse?{body:c,response:d}:c:(async f=>(f.resourceType=="Bundle"?await Promise.all((f.entry||[]).map(m=>Kv(m.resource,a,r,this,t))):await Kv(f,a,r,this,t),f))(c).then(async f=>{if(f&&f.resourceType=="Bundle"){const m=f.link||[];if(a.flat&&(f=(f.entry||[]).map(v=>v.resource)),a.onPage&&await a.onPage(f,Object.assign({},r)),--a.pageLimit){const v=m.find(y=>y.relation=="next");if(f=(0,Se.makeArray)(f),v&&v.url){const y=await this.request({url:v.url,signal:l},a,r);return a.onPage?null:a.resolveReferences.length?(Object.assign(r,y.references),f.concat((0,Se.makeArray)(y.data||y))):f.concat((0,Se.makeArray)(y))}}}return f}).then(f=>{if(a.graph)r={};else if(!a.onPage&&a.resolveReferences.length)return{data:f,references:r};return f}).then(f=>t.includeResponse?{body:f,response:d}:f))}refreshIfNeeded(t={}){const n=this.getState("tokenResponse.access_token"),r=this.getState("tokenResponse.refresh_token"),o=this.state.expiresAt||0;return n&&r&&o-10-1,u=a.search(/\bonline_access\b/)>-1;if((0,Se.assert)(l||u,"Unable to refresh. No offline_access or online_access scope found."),!this._refreshTask){const d=Object.assign(Object.assign({credentials:this.environment.options.refreshTokenWithCredentials||"same-origin"},t),{method:"POST",mode:"cors",headers:Object.assign(Object.assign({},t.headers||{}),{"content-type":"application/x-www-form-urlencoded"}),body:`grant_type=refresh_token&refresh_token=${encodeURIComponent(i)}`});if(!("authorization"in d.headers)){const{clientSecret:c,clientId:f}=this.state;c&&(d.headers.authorization="Basic "+this.environment.btoa(f+":"+c))}this._refreshTask=(0,Se.request)(s,d).then(c=>((0,Se.assert)(c.access_token,"No access token received"),o("Received new access token response %O",c),this.state.tokenResponse=Object.assign(Object.assign({},this.state.tokenResponse),c),this.state.expiresAt=(0,Se.getAccessTokenExpiration)(c,this.environment),this.state)).catch(c=>{var f,m;throw!((m=(f=this.state)===null||f===void 0?void 0:f.tokenResponse)===null||m===void 0)&&m.refresh_token&&(o("Deleting the expired or invalid refresh token."),delete this.state.tokenResponse.refresh_token),c}).finally(()=>{this._refreshTask=null;const c=this.state.key;c?this.environment.getStorage().set(c,this.state):o("No 'key' found in Clint.state. Cannot persist the instance.")})}return this._refreshTask}byCode(t,n){return(0,Se.byCode)(t,n)}byCodes(t,n){return(0,Se.byCodes)(t,n)}getPath(t,n=""){return(0,Se.getPath)(t,n)}getState(t=""){return(0,Se.getPath)(Object.assign({},this.state),t)}getFhirVersion(){return(0,Se.fetchConformanceStatement)(this.state.serverUrl).then(t=>t.fhirVersion)}getFhirRelease(){return this.getFhirVersion().then(t=>{var n;return(n=ql.fhirVersions[t])!==null&&n!==void 0?n:0})}}pc.default=$2;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.init=e.buildTokenRequest=e.ready=e.onMessage=e.isInPopUp=e.isInFrame=e.authorize=e.getSecurityExtensions=e.fetchWellKnownJson=e.KEY=void 0;const t=ae,n=pc,r=rn;Object.defineProperty(e,"KEY",{enumerable:!0,get:function(){return r.SMART_KEY}});const o=t.debug.extend("oauth2");function i(){return typeof window=="object"}function s(g="/",S){const C=String(g).replace(/\/*$/,"/")+".well-known/smart-configuration";return(0,t.getAndCache)(C,S).catch(P=>{throw new Error(`Failed to fetch the well-known json "${C}". ${P.message}`)})}e.fetchWellKnownJson=s;function a(g="/",S){return s(g,S).then(C=>{if(!C.authorization_endpoint||!C.token_endpoint)throw new Error("Invalid wellKnownJson");return{registrationUri:C.registration_endpoint||"",authorizeUri:C.authorization_endpoint,tokenUri:C.token_endpoint,codeChallengeMethods:C.code_challenge_methods_supported||[]}})}function l(g="/",S){return(0,t.fetchConformanceStatement)(g,S).then(C=>{const P="http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris",b=((0,t.getPath)(C||{},"rest.0.security.extension")||[]).filter(A=>A.url===P).map(A=>A.extension)[0],M={registrationUri:"",authorizeUri:"",tokenUri:"",codeChallengeMethods:[]};return b&&b.forEach(A=>{A.url==="register"&&(M.registrationUri=A.valueUri),A.url==="authorize"&&(M.authorizeUri=A.valueUri),A.url==="token"&&(M.tokenUri=A.valueUri)}),M})}function u(g="/"){return a(g).catch(()=>l(g))}e.getSecurityExtensions=u;async function d(g,S={}){const C=g.getUrl();if(Array.isArray(S)){const $e=C.searchParams.get("iss")||C.searchParams.get("fhirServiceUrl");if(!$e)throw new Error('Passing in an "iss" url parameter is required if authorize uses multiple configurations');const nt=S.find(cn=>{if(cn.issMatch){if(typeof cn.issMatch=="function")return!!cn.issMatch($e);if(typeof cn.issMatch=="string")return cn.issMatch===$e;if(cn.issMatch instanceof RegExp)return cn.issMatch.test($e)}return!1});return(0,t.assert)(nt,`No configuration found matching the current "iss" parameter "${$e}"`),await d(g,nt)}const{clientSecret:P,fakeTokenResponse:b,encounterId:M,target:A,width:$,height:R,pkceMode:O,clientPublicKeySetUrl:F,redirect_uri:N,client_id:E}=S;let{iss:T,launch:D,patientId:V,fhirServiceUrl:L,redirectUri:j,noRedirect:B,scope:Q="",clientId:te,completeInTarget:fe,clientPrivateJwk:ge}=S;const z=g.getStorage();T=C.searchParams.get("iss")||T,L=C.searchParams.get("fhirServiceUrl")||L,D=C.searchParams.get("launch")||D,V=C.searchParams.get("patientId")||V,te=C.searchParams.get("clientId")||te,te||(te=E),j||(j=N),j?j.match(/^https?\:\/\//)||(j=g.relative(j)):j=g.relative(".");const W=String(T||L||"");if(!W)throw new Error("No server url found. It must be specified as `iss` or as `fhirServiceUrl` parameter");if(T&&o("Making %s launch...",D?"EHR":"standalone"),D&&!Q.match(/launch/)&&(Q+=" launch"),i()){const $e=f(),nt=m();($e||nt)&&fe!==!0&&fe!==!1&&(fe=$e,console.warn('Your app is being authorized from within an iframe or popup window. Please be explicit and provide a "completeInTarget" option. Use "true" to complete the authorization in the same window, or "false" to try to complete it in the parent or the opener window. See http://docs.smarthealthit.org/client-js/api.html'))}const pe=await z.get(r.SMART_KEY);await z.unset(pe);const Te=(0,t.randomString)(16),we={clientId:te,scope:Q,redirectUri:j,serverUrl:W,clientSecret:P,clientPrivateJwk:ge,tokenResponse:{},key:Te,completeInTarget:fe,clientPublicKeySetUrl:F};(i()?(0,t.getPath)(g,"options.fullSessionStorageSupport"):!0)&&await z.set(r.SMART_KEY,Te),b&&Object.assign(we.tokenResponse,b),V&&Object.assign(we.tokenResponse,{patient:V}),M&&Object.assign(we.tokenResponse,{encounter:M});let Ce=j+"?state="+encodeURIComponent(Te);if(L&&!T)return o("Making fake launch..."),await z.set(Te,we),B?Ce:await g.redirect(Ce);const it=await u(W);if(Object.assign(we,it),await z.set(Te,we),!we.authorizeUri)return B?Ce:await g.redirect(Ce);const Ot=["response_type=code","client_id="+encodeURIComponent(te||""),"scope="+encodeURIComponent(Q),"redirect_uri="+encodeURIComponent(j),"aud="+encodeURIComponent(W),"state="+encodeURIComponent(Te)];if(D&&Ot.push("launch="+encodeURIComponent(D)),c(it.codeChallengeMethods.includes("S256"),O)){let $e=await g.security.generatePKCEChallenge();Object.assign(we,$e),await z.set(Te,we),Ot.push("code_challenge="+we.codeChallenge),Ot.push("code_challenge_method=S256")}if(Ce=we.authorizeUri+"?"+Ot.join("&"),B)return Ce;if(A&&i()){let $e;if($e=await(0,t.getTargetWindow)(A,$,R),$e!==self)try{$e.sessionStorage.removeItem(pe),$e.sessionStorage.setItem(Te,JSON.stringify(we))}catch(nt){(0,t.debug)('Failed to modify window.sessionStorage. Perhaps it is from different origin?. Failing back to "_self". %s',nt),$e=self}if($e!==self)try{$e.location.href=Ce,self.addEventListener("message",v)}catch(nt){(0,t.debug)('Failed to modify window.location. Perhaps it is from different origin?. Failing back to "_self". %s',nt),self.location.href=Ce}else self.location.href=Ce;return}else return await g.redirect(Ce)}e.authorize=d;function c(g,S){if(S==="disabled")return!1;if(S==="unsafeV1")return!0;if(S==="required"){if(!g)throw new Error("Required PKCE code challenge method (`S256`) was not found in the server's codeChallengeMethods declaration.");return!0}return g}function f(){try{return self!==top&&parent!==self}catch{return!0}}e.isInFrame=f;function m(){try{return self===top&&!!opener&&opener!==self&&!!window.name}catch{return!1}}e.isInPopUp=m;function v(g){g.data.type=="completeAuth"&&g.origin===new URL(self.location.href).origin&&(window.removeEventListener("message",v),window.location.href=g.data.url)}e.onMessage=v;async function y(g,S={}){var C,P;const b=g.getUrl(),M=g.getStorage(),A=b.searchParams;let $=A.get("state");const R=A.get("code"),O=A.get("error"),F=A.get("error_description");if($||($=await M.get(r.SMART_KEY)),O||F)throw new Error([O,F].filter(Boolean).join(": "));o("key: %s, code: %s",$,R),(0,t.assert)($,"No 'state' parameter found. Please (re)launch the app.");let N=await M.get($);const E=i()?(0,t.getPath)(g,"options.fullSessionStorageSupport"):!0;if(i()&&N&&!N.completeInTarget){const L=f(),j=m();if((L||j)&&!b.searchParams.get("complete")){b.searchParams.set("complete","1");const{href:B,origin:Q}=b;return L&&parent.postMessage({type:"completeAuth",url:B},Q),j&&(opener.postMessage({type:"completeAuth",url:B},Q),window.close()),new Promise(()=>{})}}b.searchParams.delete("complete");const T=A.has("state");if(i()&&(0,t.getPath)(g,"options.replaceBrowserHistory")&&(R||T)&&(R&&(A.delete("code"),o("Removed code parameter from the url.")),T&&E&&(A.delete("state"),o("Removed state parameter from the url.")),window.history.replaceState&&window.history.replaceState({},"",b.href)),(0,t.assert)(N,"No state found! Please (re)launch the app."),!(!R||((C=N.tokenResponse)===null||C===void 0?void 0:C.access_token))&&N.tokenUri){(0,t.assert)(R,"'code' url parameter is required"),o("Preparing to exchange the code for access token...");const L=await x(g,{code:R,state:N,clientPublicKeySetUrl:S.clientPublicKeySetUrl,privateKey:S.privateKey||N.clientPrivateJwk});o("Token request options: %O",L);const j=await(0,t.request)(N.tokenUri,L);o("Token response: %O",j),(0,t.assert)(j.access_token,"Failed to obtain access token."),N.expiresAt=(0,t.getAccessTokenExpiration)(j,g),N=Object.assign(Object.assign({},N),{tokenResponse:j}),await M.set($,N),o("Authorization successful!")}else o(!((P=N.tokenResponse)===null||P===void 0)&&P.access_token?"Already authorized":"No authorization needed");E&&await M.set(r.SMART_KEY,$);const V=new n.default(g,N);return o("Created client instance: %O",V),V}e.ready=y;async function x(g,{code:S,state:C,clientPublicKeySetUrl:P,privateKey:b}){const{redirectUri:M,clientSecret:A,tokenUri:$,clientId:R,codeVerifier:O}=C;(0,t.assert)(M,"Missing state.redirectUri"),(0,t.assert)($,"Missing state.tokenUri"),(0,t.assert)(R,"Missing state.clientId");const F={method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:`code=${S}&grant_type=authorization_code&redirect_uri=${encodeURIComponent(M)}`};if(A)F.headers.authorization="Basic "+g.btoa(R+":"+A),o("Using state.clientSecret to construct the authorization header: %s",F.headers.authorization);else if(b){const N="key"in b?b.key:await g.security.importJWK(b),E={typ:"JWT",kid:b.kid,jku:P||C.clientPublicKeySetUrl},T={iss:R,sub:R,aud:$,jti:g.base64urlencode(g.security.randomBytes(32)),exp:(0,t.getTimeInFuture)(120)},D=await g.security.signCompactJws(b.alg,N,E,T);F.body+=`&client_assertion_type=${encodeURIComponent("urn:ietf:params:oauth:client-assertion-type:jwt-bearer")}`,F.body+=`&client_assertion=${encodeURIComponent(D)}`,o("Using state.clientPrivateJwk to add a client_assertion to the POST body")}else o("Public client detected; adding state.clientId to the POST body"),F.body+=`&client_id=${encodeURIComponent(R)}`;return O&&(o("Found state.codeVerifier, adding to the POST body"),F.body+="&code_verifier="+O),F}e.buildTokenRequest=x;async function w(g,S,C){const P=g.getUrl(),b=P.searchParams.get("code"),M=P.searchParams.get("state");if(b&&M)return y(g,C);const A=g.getStorage(),$=M||await A.get(r.SMART_KEY),R=await A.get($);return R?new n.default(g,R):d(g,S).then(()=>new Promise(()=>{}))}e.init=w})(Nx);var Kh={};Object.defineProperty(Kh,"__esModule",{value:!0});class U2{async get(t){const n=sessionStorage[t];return n?JSON.parse(n):null}async set(t,n){return sessionStorage[t]=JSON.stringify(n),n}async unset(t){return t in sessionStorage?(delete sessionStorage[t],!0):!1}}Kh.default=U2;var tn={},$x={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:typeof window<"u"?window:Us,function(){var n="3.7.7",r=n,o=typeof Buffer=="function",i=typeof TextDecoder=="function"?new TextDecoder:void 0,s=typeof TextEncoder=="function"?new TextEncoder:void 0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=Array.prototype.slice.call(a),u=function(z){var W={};return z.forEach(function(pe,Te){return W[pe]=Te}),W}(l),d=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),f=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(z){return new Uint8Array(Array.prototype.slice.call(z,0))},m=function(z){return z.replace(/=/g,"").replace(/[+\/]/g,function(W){return W=="+"?"-":"_"})},v=function(z){return z.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(z){for(var W,pe,Te,we,tt="",Ce=z.length%3,it=0;it255||(Te=z.charCodeAt(it++))>255||(we=z.charCodeAt(it++))>255)throw new TypeError("invalid character found");W=pe<<16|Te<<8|we,tt+=l[W>>18&63]+l[W>>12&63]+l[W>>6&63]+l[W&63]}return Ce?tt.slice(0,Ce-3)+"===".substring(Ce):tt},x=typeof btoa=="function"?function(z){return btoa(z)}:o?function(z){return Buffer.from(z,"binary").toString("base64")}:y,w=o?function(z){return Buffer.from(z).toString("base64")}:function(z){for(var W=4096,pe=[],Te=0,we=z.length;Te>>6)+c(128|W&63):c(224|W>>>12&15)+c(128|W>>>6&63)+c(128|W&63)}else{var W=65536+(z.charCodeAt(0)-55296)*1024+(z.charCodeAt(1)-56320);return c(240|W>>>18&7)+c(128|W>>>12&63)+c(128|W>>>6&63)+c(128|W&63)}},C=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,P=function(z){return z.replace(C,S)},b=o?function(z){return Buffer.from(z,"utf8").toString("base64")}:s?function(z){return w(s.encode(z))}:function(z){return x(P(z))},M=function(z,W){return W===void 0&&(W=!1),W?m(b(z)):b(z)},A=function(z){return M(z,!0)},$=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,R=function(z){switch(z.length){case 4:var W=(7&z.charCodeAt(0))<<18|(63&z.charCodeAt(1))<<12|(63&z.charCodeAt(2))<<6|63&z.charCodeAt(3),pe=W-65536;return c((pe>>>10)+55296)+c((pe&1023)+56320);case 3:return c((15&z.charCodeAt(0))<<12|(63&z.charCodeAt(1))<<6|63&z.charCodeAt(2));default:return c((31&z.charCodeAt(0))<<6|63&z.charCodeAt(1))}},O=function(z){return z.replace($,R)},F=function(z){if(z=z.replace(/\s+/g,""),!d.test(z))throw new TypeError("malformed base64.");z+="==".slice(2-(z.length&3));for(var W,pe="",Te,we,tt=0;tt>16&255):we===64?c(W>>16&255,W>>8&255):c(W>>16&255,W>>8&255,W&255);return pe},N=typeof atob=="function"?function(z){return atob(v(z))}:o?function(z){return Buffer.from(z,"base64").toString("binary")}:F,E=o?function(z){return f(Buffer.from(z,"base64"))}:function(z){return f(N(z).split("").map(function(W){return W.charCodeAt(0)}))},T=function(z){return E(V(z))},D=o?function(z){return Buffer.from(z,"base64").toString("utf8")}:i?function(z){return i.decode(E(z))}:function(z){return O(N(z))},V=function(z){return v(z.replace(/[-_]/g,function(W){return W=="-"?"+":"/"}))},L=function(z){return D(V(z))},j=function(z){if(typeof z!="string")return!1;var W=z.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(W)||!/[^\s0-9a-zA-Z\-_]/.test(W)},B=function(z){return{value:z,enumerable:!1,writable:!0,configurable:!0}},Q=function(){var z=function(W,pe){return Object.defineProperty(String.prototype,W,B(pe))};z("fromBase64",function(){return L(this)}),z("toBase64",function(W){return M(this,W)}),z("toBase64URI",function(){return M(this,!0)}),z("toBase64URL",function(){return M(this,!0)}),z("toUint8Array",function(){return T(this)})},te=function(){var z=function(W,pe){return Object.defineProperty(Uint8Array.prototype,W,B(pe))};z("toBase64",function(W){return g(this,W)}),z("toBase64URI",function(){return g(this,!0)}),z("toBase64URL",function(){return g(this,!0)})},fe=function(){Q(),te()},ge={version:n,VERSION:r,atob:N,atobPolyfill:F,btoa:x,btoaPolyfill:y,fromBase64:L,toBase64:M,encode:M,encodeURI:A,encodeURL:A,utob:P,btou:O,decode:L,isValid:j,fromUint8Array:g,toUint8Array:T,extendString:Q,extendUint8Array:te,extendBuiltins:fe};return ge.Base64={},Object.keys(ge).forEach(function(z){return ge.Base64[z]=ge[z]}),ge})})($x);var Ux=$x.exports;/** +This app cannot be accessed directly. Please launch it as SMART app!`,c):c}).catch(c=>{throw c.status==403&&i("Permission denied! Please make sure that you have requested the proper scopes."),c}).then(c=>!c||typeof c=="string"||c instanceof F2?t.includeResponse?{body:c,response:d}:c:(async f=>(f.resourceType=="Bundle"?await Promise.all((f.entry||[]).map(m=>Gv(m.resource,a,r,this,t))):await Gv(f,a,r,this,t),f))(c).then(async f=>{if(f&&f.resourceType=="Bundle"){const m=f.link||[];if(a.flat&&(f=(f.entry||[]).map(v=>v.resource)),a.onPage&&await a.onPage(f,Object.assign({},r)),--a.pageLimit){const v=m.find(y=>y.relation=="next");if(f=(0,Se.makeArray)(f),v&&v.url){const y=await this.request({url:v.url,signal:l},a,r);return a.onPage?null:a.resolveReferences.length?(Object.assign(r,y.references),f.concat((0,Se.makeArray)(y.data||y))):f.concat((0,Se.makeArray)(y))}}}return f}).then(f=>{if(a.graph)r={};else if(!a.onPage&&a.resolveReferences.length)return{data:f,references:r};return f}).then(f=>t.includeResponse?{body:f,response:d}:f))}refreshIfNeeded(t={}){const n=this.getState("tokenResponse.access_token"),r=this.getState("tokenResponse.refresh_token"),o=this.state.expiresAt||0;return n&&r&&o-10-1,u=a.search(/\bonline_access\b/)>-1;if((0,Se.assert)(l||u,"Unable to refresh. No offline_access or online_access scope found."),!this._refreshTask){const d=Object.assign(Object.assign({credentials:this.environment.options.refreshTokenWithCredentials||"same-origin"},t),{method:"POST",mode:"cors",headers:Object.assign(Object.assign({},t.headers||{}),{"content-type":"application/x-www-form-urlencoded"}),body:`grant_type=refresh_token&refresh_token=${encodeURIComponent(i)}`});if(!("authorization"in d.headers)){const{clientSecret:c,clientId:f}=this.state;c&&(d.headers.authorization="Basic "+this.environment.btoa(f+":"+c))}this._refreshTask=(0,Se.request)(s,d).then(c=>((0,Se.assert)(c.access_token,"No access token received"),o("Received new access token response %O",c),this.state.tokenResponse=Object.assign(Object.assign({},this.state.tokenResponse),c),this.state.expiresAt=(0,Se.getAccessTokenExpiration)(c,this.environment),this.state)).catch(c=>{var f,m;throw!((m=(f=this.state)===null||f===void 0?void 0:f.tokenResponse)===null||m===void 0)&&m.refresh_token&&(o("Deleting the expired or invalid refresh token."),delete this.state.tokenResponse.refresh_token),c}).finally(()=>{this._refreshTask=null;const c=this.state.key;c?this.environment.getStorage().set(c,this.state):o("No 'key' found in Clint.state. Cannot persist the instance.")})}return this._refreshTask}byCode(t,n){return(0,Se.byCode)(t,n)}byCodes(t,n){return(0,Se.byCodes)(t,n)}getPath(t,n=""){return(0,Se.getPath)(t,n)}getState(t=""){return(0,Se.getPath)(Object.assign({},this.state),t)}getFhirVersion(){return(0,Se.fetchConformanceStatement)(this.state.serverUrl).then(t=>t.fhirVersion)}getFhirRelease(){return this.getFhirVersion().then(t=>{var n;return(n=ql.fhirVersions[t])!==null&&n!==void 0?n:0})}}pc.default=z2;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.init=e.buildTokenRequest=e.ready=e.onMessage=e.isInPopUp=e.isInFrame=e.authorize=e.getSecurityExtensions=e.fetchWellKnownJson=e.KEY=void 0;const t=ae,n=pc,r=rn;Object.defineProperty(e,"KEY",{enumerable:!0,get:function(){return r.SMART_KEY}});const o=t.debug.extend("oauth2");function i(){return typeof window=="object"}function s(g="/",S){const C=String(g).replace(/\/*$/,"/")+".well-known/smart-configuration";return(0,t.getAndCache)(C,S).catch(P=>{throw new Error(`Failed to fetch the well-known json "${C}". ${P.message}`)})}e.fetchWellKnownJson=s;function a(g="/",S){return s(g,S).then(C=>{if(!C.authorization_endpoint||!C.token_endpoint)throw new Error("Invalid wellKnownJson");return{registrationUri:C.registration_endpoint||"",authorizeUri:C.authorization_endpoint,tokenUri:C.token_endpoint,codeChallengeMethods:C.code_challenge_methods_supported||[]}})}function l(g="/",S){return(0,t.fetchConformanceStatement)(g,S).then(C=>{const P="http://fhir-registry.smarthealthit.org/StructureDefinition/oauth-uris",b=((0,t.getPath)(C||{},"rest.0.security.extension")||[]).filter(A=>A.url===P).map(A=>A.extension)[0],M={registrationUri:"",authorizeUri:"",tokenUri:"",codeChallengeMethods:[]};return b&&b.forEach(A=>{A.url==="register"&&(M.registrationUri=A.valueUri),A.url==="authorize"&&(M.authorizeUri=A.valueUri),A.url==="token"&&(M.tokenUri=A.valueUri)}),M})}function u(g="/"){return a(g).catch(()=>l(g))}e.getSecurityExtensions=u;async function d(g,S={}){const C=g.getUrl();if(Array.isArray(S)){const $e=C.searchParams.get("iss")||C.searchParams.get("fhirServiceUrl");if(!$e)throw new Error('Passing in an "iss" url parameter is required if authorize uses multiple configurations');const nt=S.find(cn=>{if(cn.issMatch){if(typeof cn.issMatch=="function")return!!cn.issMatch($e);if(typeof cn.issMatch=="string")return cn.issMatch===$e;if(cn.issMatch instanceof RegExp)return cn.issMatch.test($e)}return!1});return(0,t.assert)(nt,`No configuration found matching the current "iss" parameter "${$e}"`),await d(g,nt)}const{clientSecret:P,fakeTokenResponse:b,encounterId:M,target:A,width:$,height:R,pkceMode:O,clientPublicKeySetUrl:F,redirect_uri:N,client_id:E}=S;let{iss:T,launch:D,patientId:V,fhirServiceUrl:L,redirectUri:j,noRedirect:B,scope:Q="",clientId:te,completeInTarget:fe,clientPrivateJwk:ge}=S;const z=g.getStorage();T=C.searchParams.get("iss")||T,L=C.searchParams.get("fhirServiceUrl")||L,D=C.searchParams.get("launch")||D,V=C.searchParams.get("patientId")||V,te=C.searchParams.get("clientId")||te,te||(te=E),j||(j=N),j?j.match(/^https?\:\/\//)||(j=g.relative(j)):j=g.relative(".");const W=String(T||L||"");if(!W)throw new Error("No server url found. It must be specified as `iss` or as `fhirServiceUrl` parameter");if(T&&o("Making %s launch...",D?"EHR":"standalone"),D&&!Q.match(/launch/)&&(Q+=" launch"),i()){const $e=f(),nt=m();($e||nt)&&fe!==!0&&fe!==!1&&(fe=$e,console.warn('Your app is being authorized from within an iframe or popup window. Please be explicit and provide a "completeInTarget" option. Use "true" to complete the authorization in the same window, or "false" to try to complete it in the parent or the opener window. See http://docs.smarthealthit.org/client-js/api.html'))}const pe=await z.get(r.SMART_KEY);await z.unset(pe);const Te=(0,t.randomString)(16),we={clientId:te,scope:Q,redirectUri:j,serverUrl:W,clientSecret:P,clientPrivateJwk:ge,tokenResponse:{},key:Te,completeInTarget:fe,clientPublicKeySetUrl:F};(i()?(0,t.getPath)(g,"options.fullSessionStorageSupport"):!0)&&await z.set(r.SMART_KEY,Te),b&&Object.assign(we.tokenResponse,b),V&&Object.assign(we.tokenResponse,{patient:V}),M&&Object.assign(we.tokenResponse,{encounter:M});let Ce=j+"?state="+encodeURIComponent(Te);if(L&&!T)return o("Making fake launch..."),await z.set(Te,we),B?Ce:await g.redirect(Ce);const it=await u(W);if(Object.assign(we,it),await z.set(Te,we),!we.authorizeUri)return B?Ce:await g.redirect(Ce);const Ot=["response_type=code","client_id="+encodeURIComponent(te||""),"scope="+encodeURIComponent(Q),"redirect_uri="+encodeURIComponent(j),"aud="+encodeURIComponent(W),"state="+encodeURIComponent(Te)];if(D&&Ot.push("launch="+encodeURIComponent(D)),c(it.codeChallengeMethods.includes("S256"),O)){let $e=await g.security.generatePKCEChallenge();Object.assign(we,$e),await z.set(Te,we),Ot.push("code_challenge="+we.codeChallenge),Ot.push("code_challenge_method=S256")}if(Ce=we.authorizeUri+"?"+Ot.join("&"),B)return Ce;if(A&&i()){let $e;if($e=await(0,t.getTargetWindow)(A,$,R),$e!==self)try{$e.sessionStorage.removeItem(pe),$e.sessionStorage.setItem(Te,JSON.stringify(we))}catch(nt){(0,t.debug)('Failed to modify window.sessionStorage. Perhaps it is from different origin?. Failing back to "_self". %s',nt),$e=self}if($e!==self)try{$e.location.href=Ce,self.addEventListener("message",v)}catch(nt){(0,t.debug)('Failed to modify window.location. Perhaps it is from different origin?. Failing back to "_self". %s',nt),self.location.href=Ce}else self.location.href=Ce;return}else return await g.redirect(Ce)}e.authorize=d;function c(g,S){if(S==="disabled")return!1;if(S==="unsafeV1")return!0;if(S==="required"){if(!g)throw new Error("Required PKCE code challenge method (`S256`) was not found in the server's codeChallengeMethods declaration.");return!0}return g}function f(){try{return self!==top&&parent!==self}catch{return!0}}e.isInFrame=f;function m(){try{return self===top&&!!opener&&opener!==self&&!!window.name}catch{return!1}}e.isInPopUp=m;function v(g){g.data.type=="completeAuth"&&g.origin===new URL(self.location.href).origin&&(window.removeEventListener("message",v),window.location.href=g.data.url)}e.onMessage=v;async function y(g,S={}){var C,P;const b=g.getUrl(),M=g.getStorage(),A=b.searchParams;let $=A.get("state");const R=A.get("code"),O=A.get("error"),F=A.get("error_description");if($||($=await M.get(r.SMART_KEY)),O||F)throw new Error([O,F].filter(Boolean).join(": "));o("key: %s, code: %s",$,R),(0,t.assert)($,"No 'state' parameter found. Please (re)launch the app.");let N=await M.get($);const E=i()?(0,t.getPath)(g,"options.fullSessionStorageSupport"):!0;if(i()&&N&&!N.completeInTarget){const L=f(),j=m();if((L||j)&&!b.searchParams.get("complete")){b.searchParams.set("complete","1");const{href:B,origin:Q}=b;return L&&parent.postMessage({type:"completeAuth",url:B},Q),j&&(opener.postMessage({type:"completeAuth",url:B},Q),window.close()),new Promise(()=>{})}}b.searchParams.delete("complete");const T=A.has("state");if(i()&&(0,t.getPath)(g,"options.replaceBrowserHistory")&&(R||T)&&(R&&(A.delete("code"),o("Removed code parameter from the url.")),T&&E&&(A.delete("state"),o("Removed state parameter from the url.")),window.history.replaceState&&window.history.replaceState({},"",b.href)),(0,t.assert)(N,"No state found! Please (re)launch the app."),!(!R||((C=N.tokenResponse)===null||C===void 0?void 0:C.access_token))&&N.tokenUri){(0,t.assert)(R,"'code' url parameter is required"),o("Preparing to exchange the code for access token...");const L=await x(g,{code:R,state:N,clientPublicKeySetUrl:S.clientPublicKeySetUrl,privateKey:S.privateKey||N.clientPrivateJwk});o("Token request options: %O",L);const j=await(0,t.request)(N.tokenUri,L);o("Token response: %O",j),(0,t.assert)(j.access_token,"Failed to obtain access token."),N.expiresAt=(0,t.getAccessTokenExpiration)(j,g),N=Object.assign(Object.assign({},N),{tokenResponse:j}),await M.set($,N),o("Authorization successful!")}else o(!((P=N.tokenResponse)===null||P===void 0)&&P.access_token?"Already authorized":"No authorization needed");E&&await M.set(r.SMART_KEY,$);const V=new n.default(g,N);return o("Created client instance: %O",V),V}e.ready=y;async function x(g,{code:S,state:C,clientPublicKeySetUrl:P,privateKey:b}){const{redirectUri:M,clientSecret:A,tokenUri:$,clientId:R,codeVerifier:O}=C;(0,t.assert)(M,"Missing state.redirectUri"),(0,t.assert)($,"Missing state.tokenUri"),(0,t.assert)(R,"Missing state.clientId");const F={method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:`code=${S}&grant_type=authorization_code&redirect_uri=${encodeURIComponent(M)}`};if(A)F.headers.authorization="Basic "+g.btoa(R+":"+A),o("Using state.clientSecret to construct the authorization header: %s",F.headers.authorization);else if(b){const N="key"in b?b.key:await g.security.importJWK(b),E={typ:"JWT",kid:b.kid,jku:P||C.clientPublicKeySetUrl},T={iss:R,sub:R,aud:$,jti:g.base64urlencode(g.security.randomBytes(32)),exp:(0,t.getTimeInFuture)(120)},D=await g.security.signCompactJws(b.alg,N,E,T);F.body+=`&client_assertion_type=${encodeURIComponent("urn:ietf:params:oauth:client-assertion-type:jwt-bearer")}`,F.body+=`&client_assertion=${encodeURIComponent(D)}`,o("Using state.clientPrivateJwk to add a client_assertion to the POST body")}else o("Public client detected; adding state.clientId to the POST body"),F.body+=`&client_id=${encodeURIComponent(R)}`;return O&&(o("Found state.codeVerifier, adding to the POST body"),F.body+="&code_verifier="+O),F}e.buildTokenRequest=x;async function w(g,S,C){const P=g.getUrl(),b=P.searchParams.get("code"),M=P.searchParams.get("state");if(b&&M)return y(g,C);const A=g.getStorage(),$=M||await A.get(r.SMART_KEY),R=await A.get($);return R?new n.default(g,R):d(g,S).then(()=>new Promise(()=>{}))}e.init=w})(Ox);var Gh={};Object.defineProperty(Gh,"__esModule",{value:!0});class B2{async get(t){const n=sessionStorage[t];return n?JSON.parse(n):null}async set(t,n){return sessionStorage[t]=JSON.stringify(n),n}async unset(t){return t in sessionStorage?(delete sessionStorage[t],!0):!1}}Gh.default=B2;var tn={},zx={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(typeof self<"u"?self:typeof window<"u"?window:Us,function(){var n="3.7.7",r=n,o=typeof Buffer=="function",i=typeof TextDecoder=="function"?new TextDecoder:void 0,s=typeof TextEncoder=="function"?new TextEncoder:void 0,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=Array.prototype.slice.call(a),u=function(z){var W={};return z.forEach(function(pe,Te){return W[pe]=Te}),W}(l),d=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,c=String.fromCharCode.bind(String),f=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(z){return new Uint8Array(Array.prototype.slice.call(z,0))},m=function(z){return z.replace(/=/g,"").replace(/[+\/]/g,function(W){return W=="+"?"-":"_"})},v=function(z){return z.replace(/[^A-Za-z0-9\+\/]/g,"")},y=function(z){for(var W,pe,Te,we,tt="",Ce=z.length%3,it=0;it255||(Te=z.charCodeAt(it++))>255||(we=z.charCodeAt(it++))>255)throw new TypeError("invalid character found");W=pe<<16|Te<<8|we,tt+=l[W>>18&63]+l[W>>12&63]+l[W>>6&63]+l[W&63]}return Ce?tt.slice(0,Ce-3)+"===".substring(Ce):tt},x=typeof btoa=="function"?function(z){return btoa(z)}:o?function(z){return Buffer.from(z,"binary").toString("base64")}:y,w=o?function(z){return Buffer.from(z).toString("base64")}:function(z){for(var W=4096,pe=[],Te=0,we=z.length;Te>>6)+c(128|W&63):c(224|W>>>12&15)+c(128|W>>>6&63)+c(128|W&63)}else{var W=65536+(z.charCodeAt(0)-55296)*1024+(z.charCodeAt(1)-56320);return c(240|W>>>18&7)+c(128|W>>>12&63)+c(128|W>>>6&63)+c(128|W&63)}},C=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,P=function(z){return z.replace(C,S)},b=o?function(z){return Buffer.from(z,"utf8").toString("base64")}:s?function(z){return w(s.encode(z))}:function(z){return x(P(z))},M=function(z,W){return W===void 0&&(W=!1),W?m(b(z)):b(z)},A=function(z){return M(z,!0)},$=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,R=function(z){switch(z.length){case 4:var W=(7&z.charCodeAt(0))<<18|(63&z.charCodeAt(1))<<12|(63&z.charCodeAt(2))<<6|63&z.charCodeAt(3),pe=W-65536;return c((pe>>>10)+55296)+c((pe&1023)+56320);case 3:return c((15&z.charCodeAt(0))<<12|(63&z.charCodeAt(1))<<6|63&z.charCodeAt(2));default:return c((31&z.charCodeAt(0))<<6|63&z.charCodeAt(1))}},O=function(z){return z.replace($,R)},F=function(z){if(z=z.replace(/\s+/g,""),!d.test(z))throw new TypeError("malformed base64.");z+="==".slice(2-(z.length&3));for(var W,pe="",Te,we,tt=0;tt>16&255):we===64?c(W>>16&255,W>>8&255):c(W>>16&255,W>>8&255,W&255);return pe},N=typeof atob=="function"?function(z){return atob(v(z))}:o?function(z){return Buffer.from(z,"base64").toString("binary")}:F,E=o?function(z){return f(Buffer.from(z,"base64"))}:function(z){return f(N(z).split("").map(function(W){return W.charCodeAt(0)}))},T=function(z){return E(V(z))},D=o?function(z){return Buffer.from(z,"base64").toString("utf8")}:i?function(z){return i.decode(E(z))}:function(z){return O(N(z))},V=function(z){return v(z.replace(/[-_]/g,function(W){return W=="-"?"+":"/"}))},L=function(z){return D(V(z))},j=function(z){if(typeof z!="string")return!1;var W=z.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(W)||!/[^\s0-9a-zA-Z\-_]/.test(W)},B=function(z){return{value:z,enumerable:!1,writable:!0,configurable:!0}},Q=function(){var z=function(W,pe){return Object.defineProperty(String.prototype,W,B(pe))};z("fromBase64",function(){return L(this)}),z("toBase64",function(W){return M(this,W)}),z("toBase64URI",function(){return M(this,!0)}),z("toBase64URL",function(){return M(this,!0)}),z("toUint8Array",function(){return T(this)})},te=function(){var z=function(W,pe){return Object.defineProperty(Uint8Array.prototype,W,B(pe))};z("toBase64",function(W){return g(this,W)}),z("toBase64URI",function(){return g(this,!0)}),z("toBase64URL",function(){return g(this,!0)})},fe=function(){Q(),te()},ge={version:n,VERSION:r,atob:N,atobPolyfill:F,btoa:x,btoaPolyfill:y,fromBase64:L,toBase64:M,encode:M,encodeURI:A,encodeURL:A,utob:P,btou:O,decode:L,isValid:j,fromUint8Array:g,toUint8Array:T,extendString:Q,extendUint8Array:te,extendBuiltins:fe};return ge.Base64={},Object.keys(ge).forEach(function(z){return ge.Base64[z]=ge[z]}),ge})})(zx);var Bx=zx.exports;/** * @file Web Cryptography API shim * @author Artem S Vybornov * @license MIT - */(function(e,t){typeof define=="function"&&define.amd?define([],function(){return t(e)}):typeof nu=="object"&&nu.exports?nu.exports=t(e):t(e)})(typeof self<"u"?self:void 0,function(e){if(typeof Promise!="function")throw"Promise support required";var t=e.crypto||e.msCrypto;if(!t)return;var n=t.subtle||t.webkitSubtle;if(!n)return;var r=e.Crypto||t.constructor||Object,o=e.SubtleCrypto||n.constructor||Object;e.CryptoKey||e.Key;var i=e.navigator.userAgent.indexOf("Edge/")>-1,s=!!e.msCrypto&&!i,a=!t.subtle&&!!t.webkitSubtle;if(!s&&!a)return;function l(R){return btoa(R).replace(/\=+$/,"").replace(/\+/g,"-").replace(/\//g,"_")}function u(R){return R+="===",R=R.slice(0,-R.length%4),atob(R.replace(/-/g,"+").replace(/_/g,"/"))}function d(R){for(var O=new Uint8Array(R.length),F=0;F2&&(F=!0,O.shift());var N={ext:!0};switch(O[0][0]){case"1.2.840.113549.1.1.1":var E=["n","e","d","p","q","dp","dq","qi"],T=C(O[1]);F&&T.shift();for(var D=0;D2&&(N=!0,T.unshift(new Uint8Array([0]))),F[0][0]="1.2.840.113549.1.1.1",O=T;break;default:throw new TypeError("Unsupported key type")}return F.push(new Uint8Array(P(O)).buffer),N?F.unshift(new Uint8Array([0])):F[1]={tag:3,value:F[1]},new Uint8Array(P(F)).buffer}var g={KoZIhvcNAQEB:"1.2.840.113549.1.1.1"},S={"1.2.840.113549.1.1.1":"KoZIhvcNAQEB"};function C(R,O){if(R instanceof ArrayBuffer&&(R=new Uint8Array(R)),O||(O={pos:0,end:R.length}),O.end-O.pos<2||O.end>R.length)throw new RangeError("Malformed DER");var F=R[O.pos++],N=R[O.pos++];if(N>=128){if(N&=127,O.end-O.pos=128){var V=N,N=4;for(O.splice(E,0,V>>24&255,V>>16&255,V>>8&255,V&255);N>1&&!(V>>24);)V<<=8,N--;N<4&&O.splice(E,4-N),N|=128}return O.splice(E-2,2,F,N),O}function b(R,O,F,N){Object.defineProperties(this,{_key:{value:R},type:{value:R.type,enumerable:!0},extractable:{value:F===void 0?R.extractable:F,enumerable:!0},algorithm:{value:O===void 0?R.algorithm:O,enumerable:!0},usages:{value:N===void 0?R.usages:N,enumerable:!0}})}function M(R){return R==="verify"||R==="encrypt"||R==="wrapKey"}function A(R){return R==="sign"||R==="decrypt"||R==="unwrapKey"}if(["generateKey","importKey","unwrapKey"].forEach(function(R){var O=n[R];n[R]=function(F,N,E){var T=[].slice.call(arguments),D,V,L;switch(R){case"generateKey":D=f(F),V=N,L=E;break;case"importKey":D=f(E),V=T[3],L=T[4],F==="jwk"&&(N=v(N),N.alg||(N.alg=m(D)),N.key_ops||(N.key_ops=N.kty!=="oct"?"d"in N?L.filter(A):L.filter(M):L.slice()),T[1]=y(N));break;case"unwrapKey":D=T[4],V=T[5],L=T[6],T[2]=E._key;break}if(R==="generateKey"&&D.name==="HMAC"&&D.hash)return D.length=D.length||{"SHA-1":512,"SHA-256":512,"SHA-384":1024,"SHA-512":1024}[D.hash.name],n.importKey("raw",t.getRandomValues(new Uint8Array(D.length+7>>3)),D,V,L);if(a&&R==="generateKey"&&D.name==="RSASSA-PKCS1-v1_5"&&(!D.modulusLength||D.modulusLength>=2048))return F=f(F),F.name="RSAES-PKCS1-v1_5",delete F.hash,n.generateKey(F,!0,["encrypt","decrypt"]).then(function(B){return Promise.all([n.exportKey("jwk",B.publicKey),n.exportKey("jwk",B.privateKey)])}).then(function(B){return B[0].alg=B[1].alg=m(D),B[0].key_ops=L.filter(M),B[1].key_ops=L.filter(A),Promise.all([n.importKey("jwk",B[0],D,!0,B[0].key_ops),n.importKey("jwk",B[1],D,V,B[1].key_ops)])}).then(function(B){return{publicKey:B[0],privateKey:B[1]}});if((a||s&&(D.hash||{}).name==="SHA-1")&&R==="importKey"&&F==="jwk"&&D.name==="HMAC"&&N.kty==="oct")return n.importKey("raw",d(u(N.k)),E,T[3],T[4]);if(a&&R==="importKey"&&(F==="spki"||F==="pkcs8"))return n.importKey("jwk",x(N),E,T[3],T[4]);if(s&&R==="unwrapKey")return n.decrypt(T[3],E,N).then(function(B){return n.importKey(F,B,T[4],T[5],T[6])});var j;try{j=O.apply(n,T)}catch(B){return Promise.reject(B)}return s&&(j=new Promise(function(B,Q){j.onabort=j.onerror=function(te){Q(te)},j.oncomplete=function(te){B(te.target.result)}})),j=j.then(function(B){return D.name==="HMAC"&&(D.length||(D.length=8*B.algorithm.length)),D.name.search("RSA")==0&&(D.modulusLength||(D.modulusLength=(B.publicKey||B).algorithm.modulusLength),D.publicExponent||(D.publicExponent=(B.publicKey||B).algorithm.publicExponent)),B.publicKey&&B.privateKey?B={publicKey:new b(B.publicKey,D,V,L.filter(M)),privateKey:new b(B.privateKey,D,V,L.filter(A))}:B=new b(B,D,V,L),B}),j}}),["exportKey","wrapKey"].forEach(function(R){var O=n[R];n[R]=function(F,N,E){var T=[].slice.call(arguments);switch(R){case"exportKey":T[1]=N._key;break;case"wrapKey":T[1]=N._key,T[2]=E._key;break}if((a||s&&(N.algorithm.hash||{}).name==="SHA-1")&&R==="exportKey"&&F==="jwk"&&N.algorithm.name==="HMAC"&&(T[0]="raw"),a&&R==="exportKey"&&(F==="spki"||F==="pkcs8")&&(T[0]="jwk"),s&&R==="wrapKey")return n.exportKey(F,N).then(function(V){return F==="jwk"&&(V=d(unescape(encodeURIComponent(JSON.stringify(v(V)))))),n.encrypt(T[3],E,V)});var D;try{D=O.apply(n,T)}catch(V){return Promise.reject(V)}return s&&(D=new Promise(function(V,L){D.onabort=D.onerror=function(j){L(j)},D.oncomplete=function(j){V(j.target.result)}})),R==="exportKey"&&F==="jwk"&&(D=D.then(function(V){return(a||s&&(N.algorithm.hash||{}).name==="SHA-1")&&N.algorithm.name==="HMAC"?{kty:"oct",alg:m(N.algorithm),key_ops:N.usages.slice(),ext:!0,k:l(c(V))}:(V=v(V),V.alg||(V.alg=m(N.algorithm)),V.key_ops||(V.key_ops=N.type==="public"?N.usages.filter(M):N.type==="private"?N.usages.filter(A):N.usages.slice()),V)})),a&&R==="exportKey"&&(F==="spki"||F==="pkcs8")&&(D=D.then(function(V){return V=w(v(V)),V})),D}}),["encrypt","decrypt","sign","verify"].forEach(function(R){var O=n[R];n[R]=function(F,N,E,T){if(s&&(!E.byteLength||T&&!T.byteLength))throw new Error("Empy input is not allowed");var D=[].slice.call(arguments),V=f(F);if(s&&R==="decrypt"&&V.name==="AES-GCM"){var L=F.tagLength>>3;D[2]=(E.buffer||E).slice(0,E.byteLength-L),F.tag=(E.buffer||E).slice(E.byteLength-L)}D[1]=N._key;var j;try{j=O.apply(n,D)}catch(B){return Promise.reject(B)}return s&&(j=new Promise(function(B,Q){j.onabort=j.onerror=function(te){Q(te)},j.oncomplete=function(fe){var fe=fe.target.result;if(R==="encrypt"&&fe instanceof AesGcmEncryptResult){var ge=fe.ciphertext,z=fe.tag;fe=new Uint8Array(ge.byteLength+z.byteLength),fe.set(new Uint8Array(ge),0),fe.set(new Uint8Array(z),ge.byteLength),fe=fe.buffer}B(fe)}})),j}}),s){var $=n.digest;n.digest=function(R,O){if(!O.byteLength)throw new Error("Empy input is not allowed");var F;try{F=$.call(n,R,O)}catch(N){return Promise.reject(N)}return F=new Promise(function(N,E){F.onabort=F.onerror=function(T){E(T)},F.oncomplete=function(T){N(T.target.result)}}),F},e.crypto=Object.create(t,{getRandomValues:{value:function(R){return t.getRandomValues(R)}},subtle:{value:n}}),e.CryptoKey=b}a&&(t.subtle=n,e.Crypto=r,e.SubtleCrypto=o,e.CryptoKey=b)});const z2=window.crypto,B2=Object.freeze(Object.defineProperty({__proto__:null,default:z2},Symbol.toStringTag,{value:"Module"})),V2=aE(B2);Object.defineProperty(tn,"__esModule",{value:!0});tn.signCompactJws=tn.importJWK=tn.generatePKCEChallenge=tn.digestSha256=tn.randomBytes=void 0;const Xs=Ux,Kf=typeof globalThis=="object"&&globalThis.crypto?globalThis.crypto:V2.default,Gh=()=>{if(!Kf.subtle)throw globalThis.isSecureContext?new Error("Some of the required subtle crypto functionality is not available in the current environment (no crypto.subtle)"):new Error("Some of the required subtle crypto functionality is not available unless you run this app in secure context (using HTTPS or running locally). See https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts");return Kf.subtle},H2={ES384:{name:"ECDSA",namedCurve:"P-384"},RS384:{name:"RSASSA-PKCS1-v1_5",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-384"}}};function zx(e){return Kf.getRandomValues(new Uint8Array(e))}tn.randomBytes=zx;async function Bx(e){const t=new TextEncoder().encode(e),n=await Gh().digest("SHA-256",t);return new Uint8Array(n)}tn.digestSha256=Bx;const K2=async(e=96)=>{const t=zx(e),n=(0,Xs.fromUint8Array)(t,!0);return{codeChallenge:(0,Xs.fromUint8Array)(await Bx(n),!0),codeVerifier:n}};tn.generatePKCEChallenge=K2;async function G2(e){if(!e.alg)throw new Error('The "alg" property of the JWK must be set to "ES384" or "RS384"');if(Array.isArray(e.key_ops)||(e.key_ops=["sign"]),!e.key_ops.includes("sign"))throw new Error('The "key_ops" property of the JWK does not contain "sign"');try{return await Gh().importKey("jwk",e,H2[e.alg],e.ext===!0,e.key_ops)}catch(t){throw new Error(`The ${e.alg} is not supported by this browser: ${t}`)}}tn.importJWK=G2;async function W2(e,t,n,r){const o=JSON.stringify(Object.assign(Object.assign({},n),{alg:e})),i=JSON.stringify(r),s=`${(0,Xs.encodeURL)(o)}.${(0,Xs.encodeURL)(i)}`,a=await Gh().sign(Object.assign(Object.assign({},t.algorithm),{hash:"SHA-384"}),t,new TextEncoder().encode(s));return`${s}.${(0,Xs.fromUint8Array)(new Uint8Array(a),!0)}`}tn.signCompactJws=W2;Object.defineProperty($h,"__esModule",{value:!0});const wd=Nx,q2=pc,Q2=Kh,Gv=tn,xd=Ux;class Y2{constructor(t={}){this._url=null,this._storage=null,this.security=Gv,this.options=Object.assign({replaceBrowserHistory:!0,fullSessionStorageSupport:!0,refreshTokenWithCredentials:"same-origin"},t)}relative(t){return new URL(t,this.getUrl().href).href}get fhir(){return typeof fhir=="function"?fhir:null}getUrl(){return this._url||(this._url=new URL(location+"")),this._url}redirect(t){location.href=t}getStorage(){return this._storage||(this._storage=new Q2.default),this._storage}getAbortController(){return AbortController}atob(t){return window.atob(t)}btoa(t){return window.btoa(t)}base64urlencode(t){return typeof t=="string"?(0,xd.encodeURL)(t):(0,xd.fromUint8Array)(t,!0)}base64urldecode(t){return(0,xd.decode)(t)}getSmartApi(){return{ready:(...t)=>(0,wd.ready)(this,...t),authorize:t=>(0,wd.authorize)(this,t),init:t=>(0,wd.init)(this,t),client:t=>new q2.default(this,t),options:this.options,utils:{security:Gv}}}}$h.default=Y2;var Wv={},qv;function X2(){return qv||(qv=1,function(e){e()}(function(){function e(x,w){if(!(x instanceof w))throw new TypeError("Cannot call a class as a function")}function t(x,w){for(var g=0;g"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function a(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function l(x,w){if(w&&(typeof w=="object"||typeof w=="function"))return w;if(w!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return a(x)}function u(x){var w=s();return function(){var S=o(x),C;if(w){var P=o(this).constructor;C=Reflect.construct(S,arguments,P)}else C=S.apply(this,arguments);return l(this,C)}}function d(x,w){for(;!Object.prototype.hasOwnProperty.call(x,w)&&(x=o(x),x!==null););return x}function c(){return typeof Reflect<"u"&&Reflect.get?c=Reflect.get.bind():c=function(w,g,S){var C=d(w,g);if(C){var P=Object.getOwnPropertyDescriptor(C,g);return P.get?P.get.call(arguments.length<3?w:S):P.value}},c.apply(this,arguments)}var f=function(){function x(){e(this,x),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return n(x,[{key:"addEventListener",value:function(g,S,C){g in this.listeners||(this.listeners[g]=[]),this.listeners[g].push({callback:S,options:C})}},{key:"removeEventListener",value:function(g,S){if(g in this.listeners){for(var C=this.listeners[g],P=0,b=C.length;P"u")C=new Error("This operation was aborted"),C.name="AbortError";else try{C=new DOMException("signal is aborted without reason")}catch{C=new Error("This operation was aborted"),C.name="AbortError"}this.signal.reason=C,this.signal.dispatchEvent(S)}},{key:"toString",value:function(){return"[object AbortController]"}}]),x}();typeof Symbol<"u"&&Symbol.toStringTag&&(v.prototype[Symbol.toStringTag]="AbortController",m.prototype[Symbol.toStringTag]="AbortSignal");function y(x){return x.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof x.Request=="function"&&!x.Request.prototype.hasOwnProperty("signal")||!x.AbortController}(function(x){y(x)&&(x.AbortController=v,x.AbortSignal=m)})(typeof self<"u"?self:Us)})),Wv}const J2=$h,Z2=new J2.default,{ready:eA,authorize:tA,init:nA,client:rA,options:oA,utils:iA}=Z2.getSmartApi();if(typeof FHIRCLIENT_PURE>"u"){const e=zh();X2(),window.fetch||(window.fetch=e.default,window.Headers=e.Headers,window.Request=e.Request,window.Response=e.Response)}const sA={AbortController:window.AbortController,client:rA,utils:iA,oauth2:{settings:oA,ready:eA,authorize:tA,init:nA}};var Nu=sA,Ho=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Fo=typeof window>"u"||"Deno"in globalThis;function Jt(){}function aA(e,t){return typeof e=="function"?e(t):e}function Gf(e){return typeof e=="number"&&e>=0&&e!==1/0}function Vx(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ri(e,t){return typeof e=="function"?e(t):e}function vn(e,t){return typeof e=="function"?e(t):e}function Qv(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==Wh(s,t.options))return!1}else if(!xa(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function Yv(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Lo(t.options.mutationKey)!==Lo(i))return!1}else if(!xa(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function Wh(e,t){return((t==null?void 0:t.queryKeyHashFn)||Lo)(e)}function Lo(e){return JSON.stringify(e,(t,n)=>Wf(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function xa(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!xa(e[n],t[n])):!1}function qh(e,t){if(e===t)return e;const n=Xv(e)&&Xv(t);if(n||Wf(e)&&Wf(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=0;for(let u=0;u{setTimeout(t,e)})}function qf(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?qh(e,t):t}function uA(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function cA(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Qh=Symbol();function Hx(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Qh?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var So,Ar,Ai,Uy,dA=(Uy=class extends Ho{constructor(){super();ne(this,So);ne(this,Ar);ne(this,Ai);q(this,Ai,t=>{if(!Fo&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,Ar)||this.setEventListener(_(this,Ai))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Ar))==null||t.call(this),q(this,Ar,void 0))}setEventListener(t){var n;q(this,Ai,t),(n=_(this,Ar))==null||n.call(this),q(this,Ar,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,So)!==t&&(q(this,So,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,So)=="boolean"?_(this,So):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},So=new WeakMap,Ar=new WeakMap,Ai=new WeakMap,Uy),Yh=new dA,Mi,Mr,ki,zy,fA=(zy=class extends Ho{constructor(){super();ne(this,Mi,!0);ne(this,Mr);ne(this,ki);q(this,ki,t=>{if(!Fo&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){_(this,Mr)||this.setEventListener(_(this,ki))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Mr))==null||t.call(this),q(this,Mr,void 0))}setEventListener(t){var n;q(this,ki,t),(n=_(this,Mr))==null||n.call(this),q(this,Mr,t(this.setOnline.bind(this)))}setOnline(t){_(this,Mi)!==t&&(q(this,Mi,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,Mi)}},Mi=new WeakMap,Mr=new WeakMap,ki=new WeakMap,zy),Ou=new fA;function Qf(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function pA(e){return Math.min(1e3*2**e,3e4)}function Kx(e){return(e??"online")==="online"?Ou.isOnline():!0}var Gx=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Sd(e){return e instanceof Gx}function Wx(e){let t=!1,n=0,r=!1,o;const i=Qf(),s=y=>{var x;r||(f(new Gx(y)),(x=e.abort)==null||x.call(e))},a=()=>{t=!0},l=()=>{t=!1},u=()=>Yh.isFocused()&&(e.networkMode==="always"||Ou.isOnline())&&e.canRun(),d=()=>Kx(e.networkMode)&&e.canRun(),c=y=>{var x;r||(r=!0,(x=e.onSuccess)==null||x.call(e,y),o==null||o(),i.resolve(y))},f=y=>{var x;r||(r=!0,(x=e.onError)==null||x.call(e,y),o==null||o(),i.reject(y))},m=()=>new Promise(y=>{var x;o=w=>{(r||u())&&y(w)},(x=e.onPause)==null||x.call(e)}).then(()=>{var y;o=void 0,r||(y=e.onContinue)==null||y.call(e)}),v=()=>{if(r)return;let y;const x=n===0?e.initialPromise:void 0;try{y=x??e.fn()}catch(w){y=Promise.reject(w)}Promise.resolve(y).then(c).catch(w=>{var b;if(r)return;const g=e.retry??(Fo?0:3),S=e.retryDelay??pA,C=typeof S=="function"?S(n,w):S,P=g===!0||typeof g=="number"&&nu()?void 0:m()).then(()=>{t?f(w):v()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?v():m().then(v),i)}}function hA(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var qe=hA(),Co,By,qx=(By=class{constructor(){ne(this,Co)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gf(this.gcTime)&&q(this,Co,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Fo?1/0:5*60*1e3))}clearGcTimeout(){_(this,Co)&&(clearTimeout(_(this,Co)),q(this,Co,void 0))}},Co=new WeakMap,By),Ni,ji,Yt,pt,_a,bo,pn,Wn,Vy,gA=(Vy=class extends qx{constructor(t){super();ne(this,pn);ne(this,Ni);ne(this,ji);ne(this,Yt);ne(this,pt);ne(this,_a);ne(this,bo);q(this,bo,!1),q(this,_a,t.defaultOptions),this.setOptions(t.options),this.observers=[],q(this,Yt,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,q(this,Ni,mA(this.options)),this.state=t.state??_(this,Ni),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=_(this,pt))==null?void 0:t.promise}setOptions(t){this.options={..._(this,_a),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,Yt).remove(this)}setData(t,n){const r=qf(this.state.data,t,this.options);return se(this,pn,Wn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){se(this,pn,Wn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=_(this,pt))==null?void 0:r.promise;return(o=_(this,pt))==null||o.cancel(t),n?n.then(Jt).catch(Jt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,Ni))}isActive(){return this.observers.some(t=>vn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Qh||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Vx(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,pt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,pt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(this,Yt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(_(this,pt)&&(_(this,bo)?_(this,pt).cancel({revert:!0}):_(this,pt).cancelRetry()),this.scheduleGc()),_(this,Yt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||se(this,pn,Wn).call(this,{type:"invalidate"})}fetch(t,n){var l,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,pt))return _(this,pt).continueRetry(),_(this,pt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const c=this.observers.find(f=>f.options.queryFn);c&&this.setOptions(c.options)}const r=new AbortController,o=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(q(this,bo,!0),r.signal)})},i=()=>{const c=Hx(this.options,n),f={queryKey:this.queryKey,meta:this.meta};return o(f),q(this,bo,!1),this.options.persister?this.options.persister(c,f,this):c(f)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};o(s),(l=this.options.behavior)==null||l.onFetch(s,this),q(this,ji,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&se(this,pn,Wn).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const a=c=>{var f,m,v,y;Sd(c)&&c.silent||se(this,pn,Wn).call(this,{type:"error",error:c}),Sd(c)||((m=(f=_(this,Yt).config).onError)==null||m.call(f,c,this),(y=(v=_(this,Yt).config).onSettled)==null||y.call(v,this.state.data,c,this)),this.scheduleGc()};return q(this,pt,Wx({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:c=>{var f,m,v,y;if(c===void 0){a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(c)}catch(x){a(x);return}(m=(f=_(this,Yt).config).onSuccess)==null||m.call(f,c,this),(y=(v=_(this,Yt).config).onSettled)==null||y.call(v,c,this.state.error,this),this.scheduleGc()},onError:a,onFail:(c,f)=>{se(this,pn,Wn).call(this,{type:"failed",failureCount:c,error:f})},onPause:()=>{se(this,pn,Wn).call(this,{type:"pause"})},onContinue:()=>{se(this,pn,Wn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),_(this,pt).start()}},Ni=new WeakMap,ji=new WeakMap,Yt=new WeakMap,pt=new WeakMap,_a=new WeakMap,bo=new WeakMap,pn=new WeakSet,Wn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Qx(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Sd(o)&&o.revert&&_(this,ji)?{..._(this,ji),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),qe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,Yt).notify({query:this,type:"updated",action:t})})},Vy);function Qx(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Kx(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function mA(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Nn,Hy,vA=(Hy=class extends Ho{constructor(t={}){super();ne(this,Nn);this.config=t,q(this,Nn,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??Wh(o,n);let s=this.get(i);return s||(s=new gA({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){_(this,Nn).has(t.queryHash)||(_(this,Nn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,Nn).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,Nn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){qe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,Nn).get(t)}getAll(){return[..._(this,Nn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Qv(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Qv(t,r)):n}notify(t){qe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){qe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){qe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Nn=new WeakMap,Hy),jn,vt,Ro,On,Cr,Ky,yA=(Ky=class extends qx{constructor(t){super();ne(this,On);ne(this,jn);ne(this,vt);ne(this,Ro);this.mutationId=t.mutationId,q(this,vt,t.mutationCache),q(this,jn,[]),this.state=t.state||Yx(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,jn).includes(t)||(_(this,jn).push(t),this.clearGcTimeout(),_(this,vt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){q(this,jn,_(this,jn).filter(n=>n!==t)),this.scheduleGc(),_(this,vt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,jn).length||(this.state.status==="pending"?this.scheduleGc():_(this,vt).remove(this))}continue(){var t;return((t=_(this,Ro))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,u,d,c,f,m,v,y,x,w,g,S,C,P,b,M;q(this,Ro,Wx({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,$)=>{se(this,On,Cr).call(this,{type:"failed",failureCount:A,error:$})},onPause:()=>{se(this,On,Cr).call(this,{type:"pause"})},onContinue:()=>{se(this,On,Cr).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,vt).canRun(this)}));const n=this.state.status==="pending",r=!_(this,Ro).canStart();try{if(!n){se(this,On,Cr).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=_(this,vt).config).onMutate)==null?void 0:i.call(o,t,this));const $=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));$!==this.state.context&&se(this,On,Cr).call(this,{type:"pending",context:$,variables:t,isPaused:r})}const A=await _(this,Ro).start();return await((u=(l=_(this,vt).config).onSuccess)==null?void 0:u.call(l,A,t,this.state.context,this)),await((c=(d=this.options).onSuccess)==null?void 0:c.call(d,A,t,this.state.context)),await((m=(f=_(this,vt).config).onSettled)==null?void 0:m.call(f,A,null,this.state.variables,this.state.context,this)),await((y=(v=this.options).onSettled)==null?void 0:y.call(v,A,null,t,this.state.context)),se(this,On,Cr).call(this,{type:"success",data:A}),A}catch(A){try{throw await((w=(x=_(this,vt).config).onError)==null?void 0:w.call(x,A,t,this.state.context,this)),await((S=(g=this.options).onError)==null?void 0:S.call(g,A,t,this.state.context)),await((P=(C=_(this,vt).config).onSettled)==null?void 0:P.call(C,void 0,A,this.state.variables,this.state.context,this)),await((M=(b=this.options).onSettled)==null?void 0:M.call(b,void 0,A,t,this.state.context)),A}finally{se(this,On,Cr).call(this,{type:"error",error:A})}}finally{_(this,vt).runNext(this)}}},jn=new WeakMap,vt=new WeakMap,Ro=new WeakMap,On=new WeakSet,Cr=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),qe.batch(()=>{_(this,jn).forEach(r=>{r.onMutationUpdate(t)}),_(this,vt).notify({mutation:this,type:"updated",action:t})})},Ky);function Yx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var It,Ta,Gy,wA=(Gy=class extends Ho{constructor(t={}){super();ne(this,It);ne(this,Ta);this.config=t,q(this,It,new Map),q(this,Ta,Date.now())}build(t,n,r){const o=new yA({mutationCache:this,mutationId:++nl(this,Ta)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){const n=bl(t),r=_(this,It).get(n)??[];r.push(t),_(this,It).set(n,r),this.notify({type:"added",mutation:t})}remove(t){var r;const n=bl(t);if(_(this,It).has(n)){const o=(r=_(this,It).get(n))==null?void 0:r.filter(i=>i!==t);o&&(o.length===0?_(this,It).delete(n):_(this,It).set(n,o))}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=(r=_(this,It).get(bl(t)))==null?void 0:r.find(o=>o.state.status==="pending");return!n||n===t}runNext(t){var r;const n=(r=_(this,It).get(bl(t)))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){qe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[..._(this,It).values()].flat()}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Yv(n,r))}findAll(t={}){return this.getAll().filter(n=>Yv(t,n))}notify(t){qe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return qe.batch(()=>Promise.all(t.map(n=>n.continue().catch(Jt))))}},It=new WeakMap,Ta=new WeakMap,Gy);function bl(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function Zv(e){return{onFetch:(t,n)=>{var d,c,f,m,v;const r=t.options,o=(f=(c=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:c.fetchMore)==null?void 0:f.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],s=((v=t.state.data)==null?void 0:v.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let y=!1;const x=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?y=!0:t.signal.addEventListener("abort",()=>{y=!0}),t.signal)})},w=Hx(t.options,t.fetchOptions),g=async(S,C,P)=>{if(y)return Promise.reject();if(C==null&&S.pages.length)return Promise.resolve(S);const b={queryKey:t.queryKey,pageParam:C,direction:P?"backward":"forward",meta:t.options.meta};x(b);const M=await w(b),{maxPages:A}=t.options,$=P?cA:uA;return{pages:$(S.pages,M,A),pageParams:$(S.pageParams,C,A)}};if(o&&i.length){const S=o==="backward",C=S?xA:ey,P={pages:i,pageParams:s},b=C(r,P);a=await g(P,b,S)}else{const S=e??i.length;do{const C=l===0?s[0]??r.initialPageParam:ey(r,a);if(l>0&&C==null)break;a=await g(a,C),l++}while(l{var y,x;return(x=(y=t.options).persister)==null?void 0:x.call(y,u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function ey(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function xA(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Ge,kr,Nr,Oi,Di,jr,Ii,Fi,Wy,SA=(Wy=class{constructor(e={}){ne(this,Ge);ne(this,kr);ne(this,Nr);ne(this,Oi);ne(this,Di);ne(this,jr);ne(this,Ii);ne(this,Fi);q(this,Ge,e.queryCache||new vA),q(this,kr,e.mutationCache||new wA),q(this,Nr,e.defaultOptions||{}),q(this,Oi,new Map),q(this,Di,new Map),q(this,jr,0)}mount(){nl(this,jr)._++,_(this,jr)===1&&(q(this,Ii,Yh.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,Ge).onFocus())})),q(this,Fi,Ou.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,Ge).onOnline())})))}unmount(){var e,t;nl(this,jr)._--,_(this,jr)===0&&((e=_(this,Ii))==null||e.call(this),q(this,Ii,void 0),(t=_(this,Fi))==null||t.call(this),q(this,Fi,void 0))}isFetching(e){return _(this,Ge).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,kr).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,Ge).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(t===void 0)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),r=_(this,Ge).build(this,n);return e.revalidateIfStale&&r.isStaleByTime(Ri(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return _(this,Ge).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=_(this,Ge).get(r.queryHash),i=o==null?void 0:o.state.data,s=aA(t,i);if(s!==void 0)return _(this,Ge).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return qe.batch(()=>_(this,Ge).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,Ge).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,Ge);qe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(this,Ge),r={type:"active",...e};return qe.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=qe.batch(()=>_(this,Ge).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Jt).catch(Jt)}invalidateQueries(e={},t={}){return qe.batch(()=>{if(_(this,Ge).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=qe.batch(()=>_(this,Ge).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Jt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Jt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(this,Ge).build(this,t);return n.isStaleByTime(Ri(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Jt).catch(Jt)}fetchInfiniteQuery(e){return e.behavior=Zv(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Jt).catch(Jt)}ensureInfiniteQueryData(e){return e.behavior=Zv(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ou.isOnline()?_(this,kr).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,Ge)}getMutationCache(){return _(this,kr)}getDefaultOptions(){return _(this,Nr)}setDefaultOptions(e){q(this,Nr,e)}setQueryDefaults(e,t){_(this,Oi).set(Lo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,Oi).values()];let n={};return t.forEach(r=>{xa(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){_(this,Di).set(Lo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,Di).values()];let n={};return t.forEach(r=>{xa(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,Nr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=Wh(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.enabled!==!0&&t.queryFn===Qh&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Nr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,Ge).clear(),_(this,kr).clear()}},Ge=new WeakMap,kr=new WeakMap,Nr=new WeakMap,Oi=new WeakMap,Di=new WeakMap,jr=new WeakMap,Ii=new WeakMap,Fi=new WeakMap,Wy),Rt,xe,Aa,yt,Eo,Li,Or,Dn,Ma,$i,Ui,Po,_o,Dr,zi,_e,Ls,Yf,Xf,Jf,Zf,ep,tp,np,Xx,qy,Xh=(qy=class extends Ho{constructor(t,n){super();ne(this,_e);ne(this,Rt);ne(this,xe);ne(this,Aa);ne(this,yt);ne(this,Eo);ne(this,Li);ne(this,Or);ne(this,Dn);ne(this,Ma);ne(this,$i);ne(this,Ui);ne(this,Po);ne(this,_o);ne(this,Dr);ne(this,zi,new Set);this.options=n,q(this,Rt,t),q(this,Dn,null),q(this,Or,Qf()),this.options.experimental_prefetchInRender||_(this,Or).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,xe).addObserver(this),ty(_(this,xe),this.options)?se(this,_e,Ls).call(this):this.updateResult(),se(this,_e,Zf).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rp(_(this,xe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rp(_(this,xe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,se(this,_e,ep).call(this),se(this,_e,tp).call(this),_(this,xe).removeObserver(this)}setOptions(t,n){const r=this.options,o=_(this,xe);if(this.options=_(this,Rt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof vn(this.options.enabled,_(this,xe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");se(this,_e,np).call(this),_(this,xe).setOptions(this.options),r._defaulted&&!ju(this.options,r)&&_(this,Rt).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,xe),observer:this});const i=this.hasListeners();i&&ny(_(this,xe),o,this.options,r)&&se(this,_e,Ls).call(this),this.updateResult(n),i&&(_(this,xe)!==o||vn(this.options.enabled,_(this,xe))!==vn(r.enabled,_(this,xe))||Ri(this.options.staleTime,_(this,xe))!==Ri(r.staleTime,_(this,xe)))&&se(this,_e,Yf).call(this);const s=se(this,_e,Xf).call(this);i&&(_(this,xe)!==o||vn(this.options.enabled,_(this,xe))!==vn(r.enabled,_(this,xe))||s!==_(this,Dr))&&se(this,_e,Jf).call(this,s)}getOptimisticResult(t){const n=_(this,Rt).getQueryCache().build(_(this,Rt),t),r=this.createResult(n,t);return bA(this,r)&&(q(this,yt,r),q(this,Li,this.options),q(this,Eo,_(this,xe).state)),r}getCurrentResult(){return _(this,yt)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){_(this,zi).add(t)}getCurrentQuery(){return _(this,xe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=_(this,Rt).defaultQueryOptions(t),r=_(this,Rt).getQueryCache().build(_(this,Rt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return se(this,_e,Ls).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,yt)))}createResult(t,n){var A;const r=_(this,xe),o=this.options,i=_(this,yt),s=_(this,Eo),a=_(this,Li),u=t!==r?t.state:_(this,Aa),{state:d}=t;let c={...d},f=!1,m;if(n._optimisticResults){const $=this.hasListeners(),R=!$&&ty(t,n),O=$&&ny(t,r,n,o);(R||O)&&(c={...c,...Qx(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(c.fetchStatus="idle")}let{error:v,errorUpdatedAt:y,status:x}=c;if(n.select&&c.data!==void 0)if(i&&c.data===(s==null?void 0:s.data)&&n.select===_(this,Ma))m=_(this,$i);else try{q(this,Ma,n.select),m=n.select(c.data),m=qf(i==null?void 0:i.data,m,n),q(this,$i,m),q(this,Dn,null)}catch($){q(this,Dn,$)}else m=c.data;if(n.placeholderData!==void 0&&m===void 0&&x==="pending"){let $;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))$=i.data;else if($=typeof n.placeholderData=="function"?n.placeholderData((A=_(this,Ui))==null?void 0:A.state.data,_(this,Ui)):n.placeholderData,n.select&&$!==void 0)try{$=n.select($),q(this,Dn,null)}catch(R){q(this,Dn,R)}$!==void 0&&(x="success",m=qf(i==null?void 0:i.data,$,n),f=!0)}_(this,Dn)&&(v=_(this,Dn),m=_(this,$i),y=Date.now(),x="error");const w=c.fetchStatus==="fetching",g=x==="pending",S=x==="error",C=g&&w,P=m!==void 0,M={status:x,fetchStatus:c.fetchStatus,isPending:g,isSuccess:x==="success",isError:S,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:c.dataUpdatedAt,error:v,errorUpdatedAt:y,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>u.dataUpdateCount||c.errorUpdateCount>u.errorUpdateCount,isFetching:w,isRefetching:w&&!g,isLoadingError:S&&!P,isPaused:c.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:S&&P,isStale:Jh(t,n),refetch:this.refetch,promise:_(this,Or)};if(this.options.experimental_prefetchInRender){const $=F=>{M.status==="error"?F.reject(M.error):M.data!==void 0&&F.resolve(M.data)},R=()=>{const F=q(this,Or,M.promise=Qf());$(F)},O=_(this,Or);switch(O.status){case"pending":t.queryHash===r.queryHash&&$(O);break;case"fulfilled":(M.status==="error"||M.data!==O.value)&&R();break;case"rejected":(M.status!=="error"||M.error!==O.reason)&&R();break}}return M}updateResult(t){const n=_(this,yt),r=this.createResult(_(this,xe),this.options);if(q(this,Eo,_(this,xe).state),q(this,Li,this.options),_(this,Eo).data!==void 0&&q(this,Ui,_(this,xe)),ju(r,n))return;q(this,yt,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!_(this,zi).size)return!0;const l=new Set(a??_(this,zi));return this.options.throwOnError&&l.add("error"),Object.keys(_(this,yt)).some(u=>{const d=u;return _(this,yt)[d]!==n[d]&&l.has(d)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),se(this,_e,Xx).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&se(this,_e,Zf).call(this)}},Rt=new WeakMap,xe=new WeakMap,Aa=new WeakMap,yt=new WeakMap,Eo=new WeakMap,Li=new WeakMap,Or=new WeakMap,Dn=new WeakMap,Ma=new WeakMap,$i=new WeakMap,Ui=new WeakMap,Po=new WeakMap,_o=new WeakMap,Dr=new WeakMap,zi=new WeakMap,_e=new WeakSet,Ls=function(t){se(this,_e,np).call(this);let n=_(this,xe).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Jt)),n},Yf=function(){se(this,_e,ep).call(this);const t=Ri(this.options.staleTime,_(this,xe));if(Fo||_(this,yt).isStale||!Gf(t))return;const r=Vx(_(this,yt).dataUpdatedAt,t)+1;q(this,Po,setTimeout(()=>{_(this,yt).isStale||this.updateResult()},r))},Xf=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,xe)):this.options.refetchInterval)??!1},Jf=function(t){se(this,_e,tp).call(this),q(this,Dr,t),!(Fo||vn(this.options.enabled,_(this,xe))===!1||!Gf(_(this,Dr))||_(this,Dr)===0)&&q(this,_o,setInterval(()=>{(this.options.refetchIntervalInBackground||Yh.isFocused())&&se(this,_e,Ls).call(this)},_(this,Dr)))},Zf=function(){se(this,_e,Yf).call(this),se(this,_e,Jf).call(this,se(this,_e,Xf).call(this))},ep=function(){_(this,Po)&&(clearTimeout(_(this,Po)),q(this,Po,void 0))},tp=function(){_(this,_o)&&(clearInterval(_(this,_o)),q(this,_o,void 0))},np=function(){const t=_(this,Rt).getQueryCache().build(_(this,Rt),this.options);if(t===_(this,xe))return;const n=_(this,xe);q(this,xe,t),q(this,Aa,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Xx=function(t){qe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(_(this,yt))}),_(this,Rt).getQueryCache().notify({query:_(this,xe),type:"observerResultsUpdated"})})},qy);function CA(e,t){return vn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function ty(e,t){return CA(e,t)||e.state.data!==void 0&&rp(e,t,t.refetchOnMount)}function rp(e,t,n){if(vn(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Jh(e,t)}return!1}function ny(e,t,n,r){return(e!==t||vn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Jh(e,n)}function Jh(e,t){return vn(t.enabled,e)!==!1&&e.isStaleByTime(Ri(t.staleTime,e))}function bA(e,t){return!ju(e.getCurrentResult(),t)}function ry(e,t){return e.filter(n=>!t.includes(n))}function RA(e,t,n){const r=e.slice(0);return r[t]=n,r}var Bi,Xt,Vi,Hi,Ft,Ir,ka,Na,jt,op,ip,sp,ap,Qy,EA=(Qy=class extends Ho{constructor(t,n,r){super();ne(this,jt);ne(this,Bi);ne(this,Xt);ne(this,Vi);ne(this,Hi);ne(this,Ft);ne(this,Ir);ne(this,ka);ne(this,Na);q(this,Bi,t),q(this,Hi,r),q(this,Vi,[]),q(this,Ft,[]),q(this,Xt,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&_(this,Ft).forEach(t=>{t.subscribe(n=>{se(this,jt,sp).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,_(this,Ft).forEach(t=>{t.destroy()})}setQueries(t,n,r){q(this,Vi,t),q(this,Hi,n),qe.batch(()=>{const o=_(this,Ft),i=se(this,jt,ip).call(this,_(this,Vi));i.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions,r));const s=i.map(u=>u.observer),a=s.map(u=>u.getCurrentResult()),l=s.some((u,d)=>u!==o[d]);o.length===s.length&&!l||(q(this,Ft,s),q(this,Xt,a),this.hasListeners()&&(ry(o,s).forEach(u=>{u.destroy()}),ry(s,o).forEach(u=>{u.subscribe(d=>{se(this,jt,sp).call(this,u,d)})}),se(this,jt,ap).call(this)))})}getCurrentResult(){return _(this,Xt)}getQueries(){return _(this,Ft).map(t=>t.getCurrentQuery())}getObservers(){return _(this,Ft)}getOptimisticResult(t,n){const r=se(this,jt,ip).call(this,t),o=r.map(i=>i.observer.getOptimisticResult(i.defaultedQueryOptions));return[o,i=>se(this,jt,op).call(this,i??o,n),()=>r.map((i,s)=>{const a=o[s];return i.defaultedQueryOptions.notifyOnChangeProps?a:i.observer.trackResult(a,l=>{r.forEach(u=>{u.observer.trackProp(l)})})})]}},Bi=new WeakMap,Xt=new WeakMap,Vi=new WeakMap,Hi=new WeakMap,Ft=new WeakMap,Ir=new WeakMap,ka=new WeakMap,Na=new WeakMap,jt=new WeakSet,op=function(t,n){return n?((!_(this,Ir)||_(this,Xt)!==_(this,Na)||n!==_(this,ka))&&(q(this,ka,n),q(this,Na,_(this,Xt)),q(this,Ir,qh(_(this,Ir),n(t)))),_(this,Ir)):t},ip=function(t){const n=new Map(_(this,Ft).map(o=>[o.options.queryHash,o])),r=[];return t.forEach(o=>{const i=_(this,Bi).defaultQueryOptions(o),s=n.get(i.queryHash);if(s)r.push({defaultedQueryOptions:i,observer:s});else{const a=_(this,Ft).find(l=>l.options.queryHash===i.queryHash);r.push({defaultedQueryOptions:i,observer:a??new Xh(_(this,Bi),i)})}}),r.sort((o,i)=>t.findIndex(s=>s.queryHash===o.defaultedQueryOptions.queryHash)-t.findIndex(s=>s.queryHash===i.defaultedQueryOptions.queryHash))},sp=function(t,n){const r=_(this,Ft).indexOf(t);r!==-1&&(q(this,Xt,RA(_(this,Xt),r,n)),se(this,jt,ap).call(this))},ap=function(){var t;if(this.hasListeners()){const n=_(this,Ir),r=se(this,jt,op).call(this,_(this,Xt),(t=_(this,Hi))==null?void 0:t.combine);n!==r&&qe.batch(()=>{this.listeners.forEach(o=>{o(_(this,Xt))})})}},Qy),Fr,Lr,Et,Xn,or,Ql,lp,Yy,PA=(Yy=class extends Ho{constructor(n,r){super();ne(this,or);ne(this,Fr);ne(this,Lr);ne(this,Et);ne(this,Xn);q(this,Fr,n),this.setOptions(r),this.bindMethods(),se(this,or,Ql).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=_(this,Fr).defaultMutationOptions(n),ju(this.options,r)||_(this,Fr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,Et),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Lo(r.mutationKey)!==Lo(this.options.mutationKey)?this.reset():((o=_(this,Et))==null?void 0:o.state.status)==="pending"&&_(this,Et).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=_(this,Et))==null||n.removeObserver(this)}onMutationUpdate(n){se(this,or,Ql).call(this),se(this,or,lp).call(this,n)}getCurrentResult(){return _(this,Lr)}reset(){var n;(n=_(this,Et))==null||n.removeObserver(this),q(this,Et,void 0),se(this,or,Ql).call(this),se(this,or,lp).call(this)}mutate(n,r){var o;return q(this,Xn,r),(o=_(this,Et))==null||o.removeObserver(this),q(this,Et,_(this,Fr).getMutationCache().build(_(this,Fr),this.options)),_(this,Et).addObserver(this),_(this,Et).execute(n)}},Fr=new WeakMap,Lr=new WeakMap,Et=new WeakMap,Xn=new WeakMap,or=new WeakSet,Ql=function(){var r;const n=((r=_(this,Et))==null?void 0:r.state)??Yx();q(this,Lr,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},lp=function(n){qe.batch(()=>{var r,o,i,s,a,l,u,d;if(_(this,Xn)&&this.hasListeners()){const c=_(this,Lr).variables,f=_(this,Lr).context;(n==null?void 0:n.type)==="success"?((o=(r=_(this,Xn)).onSuccess)==null||o.call(r,n.data,c,f),(s=(i=_(this,Xn)).onSettled)==null||s.call(i,n.data,null,c,f)):(n==null?void 0:n.type)==="error"&&((l=(a=_(this,Xn)).onError)==null||l.call(a,n.error,c,f),(d=(u=_(this,Xn)).onSettled)==null||d.call(u,void 0,n.error,c,f))}this.listeners.forEach(c=>{c(_(this,Lr))})})},Yy),Jx=h.createContext(void 0),hc=e=>{const t=h.useContext(Jx);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},_A=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(Jx.Provider,{value:e,children:t})),Zx=h.createContext(!1),e1=()=>h.useContext(Zx);Zx.Provider;function TA(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var AA=h.createContext(TA()),t1=()=>h.useContext(AA);function n1(e,t){return typeof e=="function"?e(...t):!!e}function r1(){}var o1=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},i1=e=>{h.useEffect(()=>{e.clearReset()},[e])},s1=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&n1(n,[e.error,r]),a1=e=>{e.suspense&&(e.staleTime===void 0&&(e.staleTime=1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},l1=(e,t)=>e.isLoading&&e.isFetching&&!t,up=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Du=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function oy({queries:e,...t},n){const r=hc(),o=e1(),i=t1(),s=h.useMemo(()=>e.map(v=>{const y=r.defaultQueryOptions(v);return y._optimisticResults=o?"isRestoring":"optimistic",y}),[e,r,o]);s.forEach(v=>{a1(v),o1(v,i)}),i1(i);const[a]=h.useState(()=>new EA(r,s,t)),[l,u,d]=a.getOptimisticResult(s,t.combine);h.useSyncExternalStore(h.useCallback(v=>o?()=>{}:a.subscribe(qe.batchCalls(v)),[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),h.useEffect(()=>{a.setQueries(s,t,{listeners:!1})},[s,t,a]);const f=l.some((v,y)=>up(s[y],v))?l.flatMap((v,y)=>{const x=s[y];if(x){const w=new Xh(r,x);if(up(x,v))return Du(x,w,i);l1(v,o)&&Du(x,w,i)}return[]}):[];if(f.length>0)throw Promise.all(f);const m=l.find((v,y)=>{const x=s[y];return x&&s1({result:v,errorResetBoundary:i,throwOnError:x.throwOnError,query:r.getQueryCache().get(x.queryHash)})});if(m!=null&&m.error)throw m.error;return u(d())}function MA(e,t,n){var d,c,f,m,v;const r=hc(),o=e1(),i=t1(),s=r.defaultQueryOptions(e);(c=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||c.call(d,s),s._optimisticResults=o?"isRestoring":"optimistic",a1(s),o1(s,i),i1(i);const a=!r.getQueryCache().get(s.queryHash),[l]=h.useState(()=>new t(r,s)),u=l.getOptimisticResult(s);if(h.useSyncExternalStore(h.useCallback(y=>{const x=o?()=>{}:l.subscribe(qe.batchCalls(y));return l.updateResult(),x},[l,o]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),h.useEffect(()=>{l.setOptions(s,{listeners:!1})},[s,l]),up(s,u))throw Du(s,l,i);if(s1({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw u.error;if((m=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||m.call(f,s,u),s.experimental_prefetchInRender&&!Fo&&l1(u,o)){const y=a?Du(s,l,i):(v=r.getQueryCache().get(s.queryHash))==null?void 0:v.promise;y==null||y.catch(r1).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?u:l.trackResult(u)}function Un(e,t){return MA(e,Xh)}function Js(e,t){const n=hc(),[r]=h.useState(()=>new PA(n,e));h.useEffect(()=>{r.setOptions(e)},[r,e]);const o=h.useSyncExternalStore(h.useCallback(s=>r.subscribe(qe.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=h.useCallback((s,a)=>{r.mutate(s,a).catch(r1)},[r]);if(o.error&&n1(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const Iu="aidbox-forms",u1=["openid fhirUser","profile","online_access","launch/patient","launch/questionnaire","launch/questionnaireresponse","user/Questionnaire.crus","patient/Patient.r","patient/QuestionnaireResponse.crus"],er=Nu.client("https://form-builder.aidbox.app/fhir"),c1=h.createContext(null),kA=e=>{const t=window.location.pathname+window.location.hash;return Nu.oauth2.authorize({clientId:Iu,redirectUri:t,...e})},Ko=()=>{const e=h.useContext(c1);if(!e)throw new Error("No client found in the context");return e},NA=({children:e})=>{const{searchParams:t}=new URL(window.location),{data:n}=Un({queryKey:["client"],queryFn:()=>{const r=window.location.pathname+window.location.hash;return t.has("error")||t.has("error_description")?Nu.oauth2.ready({clientId:Iu,redirectUri:r}).catch(o=>{throw sessionStorage.clear(),o}):Nu.oauth2.init({clientId:Iu,scope:u1.join(" "),redirectUri:r})},retry:!1});return p.jsx(c1.Provider,{value:n,children:e})},iy=async(e,t)=>{var o;const{fhirContext:n}=(o=e==null?void 0:e.state)==null?void 0:o.tokenResponse,[r]=n==null?void 0:n.filter(({reference:i})=>{if(i.startsWith(`${t}/`))return i.split("/")[1]});if(r)return(t==="Questionnaire"?er:e).request(`${t}/${r}`);throw new Error(`No ${t} in the launch context`)},jA=async e=>{const[t,n,r,o,i]=await Promise.allSettled([e.patient.read(),e.encounter.read(),e.user.read(),iy(e,"Questionnaire"),iy(e,"QuestionnaireResponse")]);if(r.status==="rejected")throw r.reason;return{patient:t.status==="fulfilled"?t.value:null,encounter:n.status==="fulfilled"?n.value:null,user:r.value,questionnaire:o.status==="fulfilled"?o.value:null,questionnaireResponse:i.status==="fulfilled"?i.value:null}},d1=h.createContext(null),Go=()=>{const e=h.useContext(d1);if(!e)throw new Error("No launch context found in the context");return e},OA=({children:e})=>{const t=Ko(),{data:n}=Un({queryKey:["launch-context"],queryFn:()=>jA(t)});return p.jsx(d1.Provider,{value:n,children:e})};function f1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t{const t=LA(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(Zh);return a[0]===""&&a.length!==1&&a.shift(),p1(a,t)||FA(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},p1=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?p1(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(Zh);return(s=t.validators.find(({validator:a})=>a(i)))==null?void 0:s.classGroupId},sy=/^\[(.+)\]$/,FA=e=>{if(sy.test(e)){const t=sy.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},LA=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return UA(Object.entries(e.classGroups),n).forEach(([i,s])=>{cp(s,r,i,t)}),r},cp=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:ay(t,o);i.classGroupId=n;return}if(typeof o=="function"){if($A(o)){cp(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{cp(s,ay(t,i),n,r)})})},ay=(e,t)=>{let n=e;return t.split(Zh).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},$A=e=>e.isThemeGetter,UA=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[t+s,a])):i);return[n,o]}):e,zA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},h1="!",BA=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,s=a=>{const l=[];let u=0,d=0,c;for(let x=0;xd?c-d:void 0;return{modifiers:l,hasImportantModifier:m,baseClassName:v,maybePostfixModifierPosition:y}};return n?a=>n({className:a,parseClassName:s}):s},VA=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},HA=e=>({cache:zA(e.cacheSize),parseClassName:BA(e),...IA(e)}),KA=/\s+/,GA=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],s=e.trim().split(KA);let a="";for(let l=s.length-1;l>=0;l-=1){const u=s[l],{modifiers:d,hasImportantModifier:c,baseClassName:f,maybePostfixModifierPosition:m}=n(u);let v=!!m,y=r(v?f.substring(0,m):f);if(!y){if(!v){a=u+(a.length>0?" "+a:a);continue}if(y=r(f),!y){a=u+(a.length>0?" "+a:a);continue}v=!1}const x=VA(d).join(":"),w=c?x+h1:x,g=w+y;if(i.includes(g))continue;i.push(g);const S=o(y,v);for(let C=0;C0?" "+a:a)}return a};function WA(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rc(d),e());return n=HA(u),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const u=r(l);if(u)return u;const d=GA(l,n);return o(l,d),d}return function(){return i(WA.apply(null,arguments))}}const je=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},m1=/^\[(?:([a-z-]+):)?(.+)\]$/i,QA=/^\d+\/\d+$/,YA=new Set(["px","full","screen"]),XA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,JA=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,ZA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,eM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,tM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gn=e=>Ei(e)||YA.has(e)||QA.test(e),yr=e=>ls(e,"length",uM),Ei=e=>!!e&&!Number.isNaN(Number(e)),Cd=e=>ls(e,"number",Ei),As=e=>!!e&&Number.isInteger(Number(e)),nM=e=>e.endsWith("%")&&Ei(e.slice(0,-1)),de=e=>m1.test(e),wr=e=>XA.test(e),rM=new Set(["length","size","percentage"]),oM=e=>ls(e,rM,v1),iM=e=>ls(e,"position",v1),sM=new Set(["image","url"]),aM=e=>ls(e,sM,dM),lM=e=>ls(e,"",cM),Ms=()=>!0,ls=(e,t,n)=>{const r=m1.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},uM=e=>JA.test(e)&&!ZA.test(e),v1=()=>!1,cM=e=>eM.test(e),dM=e=>tM.test(e),fM=()=>{const e=je("colors"),t=je("spacing"),n=je("blur"),r=je("brightness"),o=je("borderColor"),i=je("borderRadius"),s=je("borderSpacing"),a=je("borderWidth"),l=je("contrast"),u=je("grayscale"),d=je("hueRotate"),c=je("invert"),f=je("gap"),m=je("gradientColorStops"),v=je("gradientColorStopPositions"),y=je("inset"),x=je("margin"),w=je("opacity"),g=je("padding"),S=je("saturate"),C=je("scale"),P=je("sepia"),b=je("skew"),M=je("space"),A=je("translate"),$=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",de,t],F=()=>[de,t],N=()=>["",Gn,yr],E=()=>["auto",Ei,de],T=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],D=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>["start","end","center","between","around","evenly","stretch"],j=()=>["","0",de],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>[Ei,de];return{cacheSize:500,separator:":",theme:{colors:[Ms],spacing:[Gn,yr],blur:["none","",wr,de],brightness:Q(),borderColor:[e],borderRadius:["none","","full",wr,de],borderSpacing:F(),borderWidth:N(),contrast:Q(),grayscale:j(),hueRotate:Q(),invert:j(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[nM,yr],inset:O(),margin:O(),opacity:Q(),padding:F(),saturate:Q(),scale:Q(),sepia:j(),skew:Q(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",de]}],container:["container"],columns:[{columns:[wr]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...T(),de]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",As,de]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",de]}],grow:[{grow:j()}],shrink:[{shrink:j()}],order:[{order:["first","last","none",As,de]}],"grid-cols":[{"grid-cols":[Ms]}],"col-start-end":[{col:["auto",{span:["full",As,de]},de]}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":[Ms]}],"row-start-end":[{row:["auto",{span:[As,de]},de]}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",de]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",de]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...L()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...L(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...L(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[g]}],px:[{px:[g]}],py:[{py:[g]}],ps:[{ps:[g]}],pe:[{pe:[g]}],pt:[{pt:[g]}],pr:[{pr:[g]}],pb:[{pb:[g]}],pl:[{pl:[g]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[M]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[M]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",de,t]}],"min-w":[{"min-w":[de,t,"min","max","fit"]}],"max-w":[{"max-w":[de,t,"none","full","min","max","fit","prose",{screen:[wr]},wr]}],h:[{h:[de,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[de,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[de,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[de,t,"auto","min","max","fit"]}],"font-size":[{text:["base",wr,yr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Cd]}],"font-family":[{font:[Ms]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",de]}],"line-clamp":[{"line-clamp":["none",Ei,Cd]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Gn,de]}],"list-image":[{"list-image":["none",de]}],"list-style-type":[{list:["none","disc","decimal",de]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...D(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Gn,yr]}],"underline-offset":[{"underline-offset":["auto",Gn,de]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",de]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",de]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...T(),iM]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",oM]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},aM]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...D(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:D()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...D()]}],"outline-offset":[{"outline-offset":[Gn,de]}],"outline-w":[{outline:[Gn,yr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:N()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[Gn,yr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",wr,lM]}],"shadow-color":[{shadow:[Ms]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",wr,de]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[c]}],saturate:[{saturate:[S]}],sepia:[{sepia:[P]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[c]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[P]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",de]}],duration:[{duration:Q()}],ease:[{ease:["linear","in","out","in-out",de]}],delay:[{delay:Q()}],animate:[{animate:["none","spin","ping","pulse","bounce",de]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[As,de]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[b]}],"skew-y":[{"skew-y":[b]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",de]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",de]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",de]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Gn,yr,Cd]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},pM=qA(fM);function G(...e){return pM(DA(e))}function us(e){var t,n;if(e){if(e!=null&&e[0].text)return`${e==null?void 0:e[0].text}`;{const r=((t=e==null?void 0:e[0].prefix)==null?void 0:t[0])??"",o=((n=e==null?void 0:e[0].given)==null?void 0:n[0])??"",i=(e==null?void 0:e[0].family)??"";return`${r} ${o} ${i}`.replace(/\s+/g," ").trim()}}else return"Unknown"}const hM=e=>{var s;const t=((s=e[0].line)==null?void 0:s[0])??"",n=e[0].city??"",r=e[0].state??"",o=e[0].postalCode??"",i=e[0].country??"";return`${t}, ${n}, ${r} ${o}, ${i}`};function gM(e){return e?e.charAt(0).toUpperCase()+e.slice(1):"unknown"}function mM(e){const[t,n]=us(e).split(" ");return n?`${t.charAt(0)}${n.charAt(0)}`.toUpperCase():t.substring(0,2).toUpperCase()}function vM(e,t){e=Math.max(1,Math.min(e,t));const i=e>1,s=e1||l1&&a--,l1,c=l2,m=lvv>e),showLastEllipsis:m,showLastPageButton:c,nextButtonEnabled:s}}async function yM({questionnaire:e,subject:t,encounter:n,author:r}){const{parameter:[{resource:o}]}=await er.request({url:"Questionnaire/$populate",method:"POST",headers:{"Content-Type":"application/fhir+json"},body:JSON.stringify({resourceType:"Parameters",parameter:[{name:"questionnaire",resource:e},{name:"subject",resource:t},{name:"context",part:[...n?[{name:"name",valueString:"encounter"},{name:"content",resource:n}]:[],...r?[{name:"name",valueString:"author"},{name:"content",resource:r}]:[]]}]})});return o}function y1(e,t,n){let r="QuestionnaireResponse",o="POST";return n.id&&(r+=`/${n.id}`,o="PUT"),e.request({url:r,method:o,headers:{"Content-Type":"application/fhir+json"},body:JSON.stringify({...n,questionnaire:t.url?t.url:`Questionnaire/${t.id}`,meta:{...n.meta,source:"https://aidbox.github.io/examples/aidbox-forms-smart-launch"}})})}function w1(e,t){let n="Questionnaire",r="POST";return t.id&&(n+=`/${t.id}`,r="PUT"),e.request({url:n,method:r,headers:{"Content-Type":"application/fhir+json"},body:JSON.stringify(t)})}function wM(e,t){return e.request({url:`Questionnaire/${t.id}`,method:"DELETE"})}async function xM({client:e,questionnaire:t,subject:n,encounter:r,author:o}){const i=await yM({questionnaire:t,subject:n,encounter:r,author:o});return y1(e,t,i)}function ly({launchUrl:e,launchType:t,fhirVersion:n}){const r=["provider-ehr","patient-portal","provider-standalone","patient-standalone","backend-service"],o=new URLSearchParams;return o.set("fhir_version",n||"r4"),o.set("launch_url",e.toString()),o.set("launch",btoa(JSON.stringify([r.indexOf(t)]))),`https://launch.smarthealthit.org/?${o.toString()}`}function bd(e){var n,r;const t=e.resourceType==="Bundle"?(r=(n=e.entry)==null?void 0:n[0])==null?void 0:r.resource:e;if(!t)throw new Error("Resource not found");return t}async function x1(e,t){const n=t.startsWith("http")?`Questionnaire?url=${t.replace(/\|.*$/,"")}`:`Questionnaire/${t.replace(/^Questionnaire\//,"")}`;return Promise.any([er.request(n).then(r=>[er,bd(r)]),e.request(n).then(r=>[e,bd(r)]),er.request(t).then(r=>[er,bd(r)])])}async function eg(e,t){return x1(e,t).then(([,n])=>n)}async function uy(e,t,n){var a;const r=e.state.serverUrl.endsWith("/")?e.state.serverUrl:`${e.state.serverUrl}/`,o=new URL(t,r),s=(a=(await e.request(o.toString())).link.filter(l=>l.relation==="self"||l.relation==="first"))==null?void 0:a[0];if(s){const l=new URL(s.url,r),u=[...l.searchParams].map(([d])=>{if(d.toLocaleLowerCase().includes("offset"))return{param:d,type:"offset"};if(d.toLocaleLowerCase().includes("page"))return{param:d,type:"page"}}).filter(Boolean)[0];if(u)return l.searchParams.set("_count",n),d=>(u.type==="offset"?l.searchParams.set(u.param,`${n*(d-1)}`):l.searchParams.set(u.param,`${d}`),e.request(l.toString()))}return l=>(o.searchParams.delete("_count"),e.request(o.toString()).then(u=>{var d;return{...u,total:((d=u.entry)==null?void 0:d.length)||0}}))}function SM(){const{user:e}=Go();return p.jsxs("div",{className:"p-6 overflow-auto flex-1",children:[p.jsxs("h1",{className:"mb-4 text-2xl font-bold",children:["Welcome, ",us(e.name)]}),p.jsx("div",{className:"text-muted-foreground",children:e.resourceType==="Patient"?p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{children:"This is a demo patient portal dashboard. Currently, only the questionnaire and questionnaire response functionalities are available."}),p.jsx("p",{children:"In a fully functional version, you could:"}),p.jsxs("ul",{className:"list-disc ml-6",children:[p.jsx("li",{children:"View and manage your upcoming appointments."}),p.jsx("li",{children:"Access your medical records, including lab results, diagnoses, and treatment history."}),p.jsx("li",{children:"Communicate securely with your healthcare providers."}),p.jsx("li",{children:"Maintain and update your personal health information."}),p.jsx("li",{children:"Explore educational resources related to your health conditions and treatments."})]}),p.jsx("p",{children:"For now, you can explore and submit/amend your responses."})]}):p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{children:"This is a demo practitioner EHR dashboard. Currently, only the questionnaire and questionnaire response functionalities are available."}),p.jsx("p",{children:"In a fully functional version, you could:"}),p.jsxs("ul",{className:"list-disc ml-6",children:[p.jsx("li",{children:"Access and manage patient records."}),p.jsx("li",{children:"Schedule and manage patient appointments."}),p.jsx("li",{children:"Review lab results and other diagnostic information."}),p.jsx("li",{children:"Prescribe medications and generate referrals."}),p.jsx("li",{children:"Communicate with patients and other healthcare professionals."}),p.jsx("li",{children:"Generate reports and analyze data."})]}),p.jsx("p",{children:"For now, you can create and manage questionnaires, and review patient responses."})]})})]})}function CM(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function gc(...e){return t=>e.forEach(n=>CM(n,t))}function Le(...e){return h.useCallback(gc(...e),e)}var un=h.forwardRef((e,t)=>{const{children:n,...r}=e,o=h.Children.toArray(n),i=o.find(bM);if(i){const s=i.props.children,a=o.map(l=>l===i?h.Children.count(s)>1?h.Children.only(null):h.isValidElement(s)?s.props.children:null:l);return p.jsx(dp,{...r,ref:t,children:h.isValidElement(s)?h.cloneElement(s,void 0,a):null})}return p.jsx(dp,{...r,ref:t,children:n})});un.displayName="Slot";var dp=h.forwardRef((e,t)=>{const{children:n,...r}=e;if(h.isValidElement(n)){const o=EM(n);return h.cloneElement(n,{...RM(r,n.props),ref:t?gc(t,o):o})}return h.Children.count(n)>1?h.Children.only(null):null});dp.displayName="SlotClone";var tg=({children:e})=>p.jsx(p.Fragment,{children:e});function bM(e){return h.isValidElement(e)&&e.type===tg}function RM(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function EM(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function S1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;ttypeof e=="boolean"?"".concat(e):e===0?"0":e,dy=PM,La=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return dy(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(u=>{const d=n==null?void 0:n[u],c=i==null?void 0:i[u];if(d===null)return null;const f=cy(d)||cy(c);return o[u][f]}),a=n&&Object.entries(n).reduce((u,d)=>{let[c,f]=d;return f===void 0||(u[c]=f),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:c,className:f,...m}=d;return Object.entries(m).every(v=>{let[y,x]=v;return Array.isArray(x)?x.includes({...i,...a}[y]):{...i,...a}[y]===x})?[...u,c,f]:u},[]);return dy(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)};/** + */(function(e,t){typeof define=="function"&&define.amd?define([],function(){return t(e)}):typeof nu=="object"&&nu.exports?nu.exports=t(e):t(e)})(typeof self<"u"?self:void 0,function(e){if(typeof Promise!="function")throw"Promise support required";var t=e.crypto||e.msCrypto;if(!t)return;var n=t.subtle||t.webkitSubtle;if(!n)return;var r=e.Crypto||t.constructor||Object,o=e.SubtleCrypto||n.constructor||Object;e.CryptoKey||e.Key;var i=e.navigator.userAgent.indexOf("Edge/")>-1,s=!!e.msCrypto&&!i,a=!t.subtle&&!!t.webkitSubtle;if(!s&&!a)return;function l(R){return btoa(R).replace(/\=+$/,"").replace(/\+/g,"-").replace(/\//g,"_")}function u(R){return R+="===",R=R.slice(0,-R.length%4),atob(R.replace(/-/g,"+").replace(/_/g,"/"))}function d(R){for(var O=new Uint8Array(R.length),F=0;F2&&(F=!0,O.shift());var N={ext:!0};switch(O[0][0]){case"1.2.840.113549.1.1.1":var E=["n","e","d","p","q","dp","dq","qi"],T=C(O[1]);F&&T.shift();for(var D=0;D2&&(N=!0,T.unshift(new Uint8Array([0]))),F[0][0]="1.2.840.113549.1.1.1",O=T;break;default:throw new TypeError("Unsupported key type")}return F.push(new Uint8Array(P(O)).buffer),N?F.unshift(new Uint8Array([0])):F[1]={tag:3,value:F[1]},new Uint8Array(P(F)).buffer}var g={KoZIhvcNAQEB:"1.2.840.113549.1.1.1"},S={"1.2.840.113549.1.1.1":"KoZIhvcNAQEB"};function C(R,O){if(R instanceof ArrayBuffer&&(R=new Uint8Array(R)),O||(O={pos:0,end:R.length}),O.end-O.pos<2||O.end>R.length)throw new RangeError("Malformed DER");var F=R[O.pos++],N=R[O.pos++];if(N>=128){if(N&=127,O.end-O.pos=128){var V=N,N=4;for(O.splice(E,0,V>>24&255,V>>16&255,V>>8&255,V&255);N>1&&!(V>>24);)V<<=8,N--;N<4&&O.splice(E,4-N),N|=128}return O.splice(E-2,2,F,N),O}function b(R,O,F,N){Object.defineProperties(this,{_key:{value:R},type:{value:R.type,enumerable:!0},extractable:{value:F===void 0?R.extractable:F,enumerable:!0},algorithm:{value:O===void 0?R.algorithm:O,enumerable:!0},usages:{value:N===void 0?R.usages:N,enumerable:!0}})}function M(R){return R==="verify"||R==="encrypt"||R==="wrapKey"}function A(R){return R==="sign"||R==="decrypt"||R==="unwrapKey"}if(["generateKey","importKey","unwrapKey"].forEach(function(R){var O=n[R];n[R]=function(F,N,E){var T=[].slice.call(arguments),D,V,L;switch(R){case"generateKey":D=f(F),V=N,L=E;break;case"importKey":D=f(E),V=T[3],L=T[4],F==="jwk"&&(N=v(N),N.alg||(N.alg=m(D)),N.key_ops||(N.key_ops=N.kty!=="oct"?"d"in N?L.filter(A):L.filter(M):L.slice()),T[1]=y(N));break;case"unwrapKey":D=T[4],V=T[5],L=T[6],T[2]=E._key;break}if(R==="generateKey"&&D.name==="HMAC"&&D.hash)return D.length=D.length||{"SHA-1":512,"SHA-256":512,"SHA-384":1024,"SHA-512":1024}[D.hash.name],n.importKey("raw",t.getRandomValues(new Uint8Array(D.length+7>>3)),D,V,L);if(a&&R==="generateKey"&&D.name==="RSASSA-PKCS1-v1_5"&&(!D.modulusLength||D.modulusLength>=2048))return F=f(F),F.name="RSAES-PKCS1-v1_5",delete F.hash,n.generateKey(F,!0,["encrypt","decrypt"]).then(function(B){return Promise.all([n.exportKey("jwk",B.publicKey),n.exportKey("jwk",B.privateKey)])}).then(function(B){return B[0].alg=B[1].alg=m(D),B[0].key_ops=L.filter(M),B[1].key_ops=L.filter(A),Promise.all([n.importKey("jwk",B[0],D,!0,B[0].key_ops),n.importKey("jwk",B[1],D,V,B[1].key_ops)])}).then(function(B){return{publicKey:B[0],privateKey:B[1]}});if((a||s&&(D.hash||{}).name==="SHA-1")&&R==="importKey"&&F==="jwk"&&D.name==="HMAC"&&N.kty==="oct")return n.importKey("raw",d(u(N.k)),E,T[3],T[4]);if(a&&R==="importKey"&&(F==="spki"||F==="pkcs8"))return n.importKey("jwk",x(N),E,T[3],T[4]);if(s&&R==="unwrapKey")return n.decrypt(T[3],E,N).then(function(B){return n.importKey(F,B,T[4],T[5],T[6])});var j;try{j=O.apply(n,T)}catch(B){return Promise.reject(B)}return s&&(j=new Promise(function(B,Q){j.onabort=j.onerror=function(te){Q(te)},j.oncomplete=function(te){B(te.target.result)}})),j=j.then(function(B){return D.name==="HMAC"&&(D.length||(D.length=8*B.algorithm.length)),D.name.search("RSA")==0&&(D.modulusLength||(D.modulusLength=(B.publicKey||B).algorithm.modulusLength),D.publicExponent||(D.publicExponent=(B.publicKey||B).algorithm.publicExponent)),B.publicKey&&B.privateKey?B={publicKey:new b(B.publicKey,D,V,L.filter(M)),privateKey:new b(B.privateKey,D,V,L.filter(A))}:B=new b(B,D,V,L),B}),j}}),["exportKey","wrapKey"].forEach(function(R){var O=n[R];n[R]=function(F,N,E){var T=[].slice.call(arguments);switch(R){case"exportKey":T[1]=N._key;break;case"wrapKey":T[1]=N._key,T[2]=E._key;break}if((a||s&&(N.algorithm.hash||{}).name==="SHA-1")&&R==="exportKey"&&F==="jwk"&&N.algorithm.name==="HMAC"&&(T[0]="raw"),a&&R==="exportKey"&&(F==="spki"||F==="pkcs8")&&(T[0]="jwk"),s&&R==="wrapKey")return n.exportKey(F,N).then(function(V){return F==="jwk"&&(V=d(unescape(encodeURIComponent(JSON.stringify(v(V)))))),n.encrypt(T[3],E,V)});var D;try{D=O.apply(n,T)}catch(V){return Promise.reject(V)}return s&&(D=new Promise(function(V,L){D.onabort=D.onerror=function(j){L(j)},D.oncomplete=function(j){V(j.target.result)}})),R==="exportKey"&&F==="jwk"&&(D=D.then(function(V){return(a||s&&(N.algorithm.hash||{}).name==="SHA-1")&&N.algorithm.name==="HMAC"?{kty:"oct",alg:m(N.algorithm),key_ops:N.usages.slice(),ext:!0,k:l(c(V))}:(V=v(V),V.alg||(V.alg=m(N.algorithm)),V.key_ops||(V.key_ops=N.type==="public"?N.usages.filter(M):N.type==="private"?N.usages.filter(A):N.usages.slice()),V)})),a&&R==="exportKey"&&(F==="spki"||F==="pkcs8")&&(D=D.then(function(V){return V=w(v(V)),V})),D}}),["encrypt","decrypt","sign","verify"].forEach(function(R){var O=n[R];n[R]=function(F,N,E,T){if(s&&(!E.byteLength||T&&!T.byteLength))throw new Error("Empy input is not allowed");var D=[].slice.call(arguments),V=f(F);if(s&&R==="decrypt"&&V.name==="AES-GCM"){var L=F.tagLength>>3;D[2]=(E.buffer||E).slice(0,E.byteLength-L),F.tag=(E.buffer||E).slice(E.byteLength-L)}D[1]=N._key;var j;try{j=O.apply(n,D)}catch(B){return Promise.reject(B)}return s&&(j=new Promise(function(B,Q){j.onabort=j.onerror=function(te){Q(te)},j.oncomplete=function(fe){var fe=fe.target.result;if(R==="encrypt"&&fe instanceof AesGcmEncryptResult){var ge=fe.ciphertext,z=fe.tag;fe=new Uint8Array(ge.byteLength+z.byteLength),fe.set(new Uint8Array(ge),0),fe.set(new Uint8Array(z),ge.byteLength),fe=fe.buffer}B(fe)}})),j}}),s){var $=n.digest;n.digest=function(R,O){if(!O.byteLength)throw new Error("Empy input is not allowed");var F;try{F=$.call(n,R,O)}catch(N){return Promise.reject(N)}return F=new Promise(function(N,E){F.onabort=F.onerror=function(T){E(T)},F.oncomplete=function(T){N(T.target.result)}}),F},e.crypto=Object.create(t,{getRandomValues:{value:function(R){return t.getRandomValues(R)}},subtle:{value:n}}),e.CryptoKey=b}a&&(t.subtle=n,e.Crypto=r,e.SubtleCrypto=o,e.CryptoKey=b)});const V2=window.crypto,H2=Object.freeze(Object.defineProperty({__proto__:null,default:V2},Symbol.toStringTag,{value:"Module"})),K2=uE(H2);Object.defineProperty(tn,"__esModule",{value:!0});tn.signCompactJws=tn.importJWK=tn.generatePKCEChallenge=tn.digestSha256=tn.randomBytes=void 0;const Xs=Bx,Kf=typeof globalThis=="object"&&globalThis.crypto?globalThis.crypto:K2.default,Wh=()=>{if(!Kf.subtle)throw globalThis.isSecureContext?new Error("Some of the required subtle crypto functionality is not available in the current environment (no crypto.subtle)"):new Error("Some of the required subtle crypto functionality is not available unless you run this app in secure context (using HTTPS or running locally). See https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts");return Kf.subtle},G2={ES384:{name:"ECDSA",namedCurve:"P-384"},RS384:{name:"RSASSA-PKCS1-v1_5",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-384"}}};function Vx(e){return Kf.getRandomValues(new Uint8Array(e))}tn.randomBytes=Vx;async function Hx(e){const t=new TextEncoder().encode(e),n=await Wh().digest("SHA-256",t);return new Uint8Array(n)}tn.digestSha256=Hx;const W2=async(e=96)=>{const t=Vx(e),n=(0,Xs.fromUint8Array)(t,!0);return{codeChallenge:(0,Xs.fromUint8Array)(await Hx(n),!0),codeVerifier:n}};tn.generatePKCEChallenge=W2;async function q2(e){if(!e.alg)throw new Error('The "alg" property of the JWK must be set to "ES384" or "RS384"');if(Array.isArray(e.key_ops)||(e.key_ops=["sign"]),!e.key_ops.includes("sign"))throw new Error('The "key_ops" property of the JWK does not contain "sign"');try{return await Wh().importKey("jwk",e,G2[e.alg],e.ext===!0,e.key_ops)}catch(t){throw new Error(`The ${e.alg} is not supported by this browser: ${t}`)}}tn.importJWK=q2;async function Q2(e,t,n,r){const o=JSON.stringify(Object.assign(Object.assign({},n),{alg:e})),i=JSON.stringify(r),s=`${(0,Xs.encodeURL)(o)}.${(0,Xs.encodeURL)(i)}`,a=await Wh().sign(Object.assign(Object.assign({},t.algorithm),{hash:"SHA-384"}),t,new TextEncoder().encode(s));return`${s}.${(0,Xs.fromUint8Array)(new Uint8Array(a),!0)}`}tn.signCompactJws=Q2;Object.defineProperty(Uh,"__esModule",{value:!0});const wd=Ox,Y2=pc,X2=Gh,Wv=tn,xd=Bx;class J2{constructor(t={}){this._url=null,this._storage=null,this.security=Wv,this.options=Object.assign({replaceBrowserHistory:!0,fullSessionStorageSupport:!0,refreshTokenWithCredentials:"same-origin"},t)}relative(t){return new URL(t,this.getUrl().href).href}get fhir(){return typeof fhir=="function"?fhir:null}getUrl(){return this._url||(this._url=new URL(location+"")),this._url}redirect(t){location.href=t}getStorage(){return this._storage||(this._storage=new X2.default),this._storage}getAbortController(){return AbortController}atob(t){return window.atob(t)}btoa(t){return window.btoa(t)}base64urlencode(t){return typeof t=="string"?(0,xd.encodeURL)(t):(0,xd.fromUint8Array)(t,!0)}base64urldecode(t){return(0,xd.decode)(t)}getSmartApi(){return{ready:(...t)=>(0,wd.ready)(this,...t),authorize:t=>(0,wd.authorize)(this,t),init:t=>(0,wd.init)(this,t),client:t=>new Y2.default(this,t),options:this.options,utils:{security:Wv}}}}Uh.default=J2;var qv={},Qv;function Z2(){return Qv||(Qv=1,function(e){e()}(function(){function e(x,w){if(!(x instanceof w))throw new TypeError("Cannot call a class as a function")}function t(x,w){for(var g=0;g"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function a(x){if(x===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return x}function l(x,w){if(w&&(typeof w=="object"||typeof w=="function"))return w;if(w!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return a(x)}function u(x){var w=s();return function(){var S=o(x),C;if(w){var P=o(this).constructor;C=Reflect.construct(S,arguments,P)}else C=S.apply(this,arguments);return l(this,C)}}function d(x,w){for(;!Object.prototype.hasOwnProperty.call(x,w)&&(x=o(x),x!==null););return x}function c(){return typeof Reflect<"u"&&Reflect.get?c=Reflect.get.bind():c=function(w,g,S){var C=d(w,g);if(C){var P=Object.getOwnPropertyDescriptor(C,g);return P.get?P.get.call(arguments.length<3?w:S):P.value}},c.apply(this,arguments)}var f=function(){function x(){e(this,x),Object.defineProperty(this,"listeners",{value:{},writable:!0,configurable:!0})}return n(x,[{key:"addEventListener",value:function(g,S,C){g in this.listeners||(this.listeners[g]=[]),this.listeners[g].push({callback:S,options:C})}},{key:"removeEventListener",value:function(g,S){if(g in this.listeners){for(var C=this.listeners[g],P=0,b=C.length;P"u")C=new Error("This operation was aborted"),C.name="AbortError";else try{C=new DOMException("signal is aborted without reason")}catch{C=new Error("This operation was aborted"),C.name="AbortError"}this.signal.reason=C,this.signal.dispatchEvent(S)}},{key:"toString",value:function(){return"[object AbortController]"}}]),x}();typeof Symbol<"u"&&Symbol.toStringTag&&(v.prototype[Symbol.toStringTag]="AbortController",m.prototype[Symbol.toStringTag]="AbortSignal");function y(x){return x.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL?(console.log("__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill"),!0):typeof x.Request=="function"&&!x.Request.prototype.hasOwnProperty("signal")||!x.AbortController}(function(x){y(x)&&(x.AbortController=v,x.AbortSignal=m)})(typeof self<"u"?self:Us)})),qv}const eA=Uh,tA=new eA.default,{ready:nA,authorize:rA,init:oA,client:iA,options:sA,utils:aA}=tA.getSmartApi();if(typeof FHIRCLIENT_PURE>"u"){const e=Bh();Z2(),window.fetch||(window.fetch=e.default,window.Headers=e.Headers,window.Request=e.Request,window.Response=e.Response)}const lA={AbortController:window.AbortController,client:iA,utils:aA,oauth2:{settings:sA,ready:nA,authorize:rA,init:oA}};var Nu=lA,Ho=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Fo=typeof window>"u"||"Deno"in globalThis;function Jt(){}function uA(e,t){return typeof e=="function"?e(t):e}function Gf(e){return typeof e=="number"&&e>=0&&e!==1/0}function Kx(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ri(e,t){return typeof e=="function"?e(t):e}function vn(e,t){return typeof e=="function"?e(t):e}function Yv(e,t){const{type:n="all",exact:r,fetchStatus:o,predicate:i,queryKey:s,stale:a}=e;if(s){if(r){if(t.queryHash!==qh(s,t.options))return!1}else if(!xa(t.queryKey,s))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||o&&o!==t.state.fetchStatus||i&&!i(t))}function Xv(e,t){const{exact:n,status:r,predicate:o,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(Lo(t.options.mutationKey)!==Lo(i))return!1}else if(!xa(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||o&&!o(t))}function qh(e,t){return((t==null?void 0:t.queryKeyHashFn)||Lo)(e)}function Lo(e){return JSON.stringify(e,(t,n)=>Wf(n)?Object.keys(n).sort().reduce((r,o)=>(r[o]=n[o],r),{}):n)}function xa(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?!Object.keys(t).some(n=>!xa(e[n],t[n])):!1}function Qh(e,t){if(e===t)return e;const n=Jv(e)&&Jv(t);if(n||Wf(e)&&Wf(t)){const r=n?e:Object.keys(e),o=r.length,i=n?t:Object.keys(t),s=i.length,a=n?[]:{};let l=0;for(let u=0;u{setTimeout(t,e)})}function qf(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Qh(e,t):t}function dA(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function fA(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Yh=Symbol();function Gx(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===Yh?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var So,Ar,Ai,By,pA=(By=class extends Ho{constructor(){super();ne(this,So);ne(this,Ar);ne(this,Ai);q(this,Ai,t=>{if(!Fo&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){_(this,Ar)||this.setEventListener(_(this,Ai))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Ar))==null||t.call(this),q(this,Ar,void 0))}setEventListener(t){var n;q(this,Ai,t),(n=_(this,Ar))==null||n.call(this),q(this,Ar,t(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(t){_(this,So)!==t&&(q(this,So,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof _(this,So)=="boolean"?_(this,So):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},So=new WeakMap,Ar=new WeakMap,Ai=new WeakMap,By),Xh=new pA,Mi,Mr,ki,Vy,hA=(Vy=class extends Ho{constructor(){super();ne(this,Mi,!0);ne(this,Mr);ne(this,ki);q(this,ki,t=>{if(!Fo&&window.addEventListener){const n=()=>t(!0),r=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){_(this,Mr)||this.setEventListener(_(this,ki))}onUnsubscribe(){var t;this.hasListeners()||((t=_(this,Mr))==null||t.call(this),q(this,Mr,void 0))}setEventListener(t){var n;q(this,ki,t),(n=_(this,Mr))==null||n.call(this),q(this,Mr,t(this.setOnline.bind(this)))}setOnline(t){_(this,Mi)!==t&&(q(this,Mi,t),this.listeners.forEach(r=>{r(t)}))}isOnline(){return _(this,Mi)}},Mi=new WeakMap,Mr=new WeakMap,ki=new WeakMap,Vy),Ou=new hA;function Qf(){let e,t;const n=new Promise((o,i)=>{e=o,t=i});n.status="pending",n.catch(()=>{});function r(o){Object.assign(n,o),delete n.resolve,delete n.reject}return n.resolve=o=>{r({status:"fulfilled",value:o}),e(o)},n.reject=o=>{r({status:"rejected",reason:o}),t(o)},n}function gA(e){return Math.min(1e3*2**e,3e4)}function Wx(e){return(e??"online")==="online"?Ou.isOnline():!0}var qx=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function Sd(e){return e instanceof qx}function Qx(e){let t=!1,n=0,r=!1,o;const i=Qf(),s=y=>{var x;r||(f(new qx(y)),(x=e.abort)==null||x.call(e))},a=()=>{t=!0},l=()=>{t=!1},u=()=>Xh.isFocused()&&(e.networkMode==="always"||Ou.isOnline())&&e.canRun(),d=()=>Wx(e.networkMode)&&e.canRun(),c=y=>{var x;r||(r=!0,(x=e.onSuccess)==null||x.call(e,y),o==null||o(),i.resolve(y))},f=y=>{var x;r||(r=!0,(x=e.onError)==null||x.call(e,y),o==null||o(),i.reject(y))},m=()=>new Promise(y=>{var x;o=w=>{(r||u())&&y(w)},(x=e.onPause)==null||x.call(e)}).then(()=>{var y;o=void 0,r||(y=e.onContinue)==null||y.call(e)}),v=()=>{if(r)return;let y;const x=n===0?e.initialPromise:void 0;try{y=x??e.fn()}catch(w){y=Promise.reject(w)}Promise.resolve(y).then(c).catch(w=>{var b;if(r)return;const g=e.retry??(Fo?0:3),S=e.retryDelay??gA,C=typeof S=="function"?S(n,w):S,P=g===!0||typeof g=="number"&&nu()?void 0:m()).then(()=>{t?f(w):v()})})};return{promise:i,cancel:s,continue:()=>(o==null||o(),i),cancelRetry:a,continueRetry:l,canStart:d,start:()=>(d()?v():m().then(v),i)}}function mA(){let e=[],t=0,n=a=>{a()},r=a=>{a()},o=a=>setTimeout(a,0);const i=a=>{t?e.push(a):o(()=>{n(a)})},s=()=>{const a=e;e=[],a.length&&o(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||s()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{o=a}}}var qe=mA(),Co,Hy,Yx=(Hy=class{constructor(){ne(this,Co)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Gf(this.gcTime)&&q(this,Co,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Fo?1/0:5*60*1e3))}clearGcTimeout(){_(this,Co)&&(clearTimeout(_(this,Co)),q(this,Co,void 0))}},Co=new WeakMap,Hy),Ni,ji,Yt,pt,_a,bo,pn,Wn,Ky,vA=(Ky=class extends Yx{constructor(t){super();ne(this,pn);ne(this,Ni);ne(this,ji);ne(this,Yt);ne(this,pt);ne(this,_a);ne(this,bo);q(this,bo,!1),q(this,_a,t.defaultOptions),this.setOptions(t.options),this.observers=[],q(this,Yt,t.cache),this.queryKey=t.queryKey,this.queryHash=t.queryHash,q(this,Ni,yA(this.options)),this.state=t.state??_(this,Ni),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=_(this,pt))==null?void 0:t.promise}setOptions(t){this.options={..._(this,_a),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&_(this,Yt).remove(this)}setData(t,n){const r=qf(this.state.data,t,this.options);return se(this,pn,Wn).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(t,n){se(this,pn,Wn).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var r,o;const n=(r=_(this,pt))==null?void 0:r.promise;return(o=_(this,pt))==null||o.cancel(t),n?n.then(Jt).catch(Jt):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(_(this,Ni))}isActive(){return this.observers.some(t=>vn(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Yh||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(t=0){return this.state.isInvalidated||this.state.data===void 0||!Kx(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(r=>r.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,pt))==null||n.continue()}onOnline(){var n;const t=this.observers.find(r=>r.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=_(this,pt))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),_(this,Yt).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(_(this,pt)&&(_(this,bo)?_(this,pt).cancel({revert:!0}):_(this,pt).cancelRetry()),this.scheduleGc()),_(this,Yt).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||se(this,pn,Wn).call(this,{type:"invalidate"})}fetch(t,n){var l,u,d;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(_(this,pt))return _(this,pt).continueRetry(),_(this,pt).promise}if(t&&this.setOptions(t),!this.options.queryFn){const c=this.observers.find(f=>f.options.queryFn);c&&this.setOptions(c.options)}const r=new AbortController,o=c=>{Object.defineProperty(c,"signal",{enumerable:!0,get:()=>(q(this,bo,!0),r.signal)})},i=()=>{const c=Gx(this.options,n),f={queryKey:this.queryKey,meta:this.meta};return o(f),q(this,bo,!1),this.options.persister?this.options.persister(c,f,this):c(f)},s={fetchOptions:n,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:i};o(s),(l=this.options.behavior)==null||l.onFetch(s,this),q(this,ji,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=s.fetchOptions)==null?void 0:u.meta))&&se(this,pn,Wn).call(this,{type:"fetch",meta:(d=s.fetchOptions)==null?void 0:d.meta});const a=c=>{var f,m,v,y;Sd(c)&&c.silent||se(this,pn,Wn).call(this,{type:"error",error:c}),Sd(c)||((m=(f=_(this,Yt).config).onError)==null||m.call(f,c,this),(y=(v=_(this,Yt).config).onSettled)==null||y.call(v,this.state.data,c,this)),this.scheduleGc()};return q(this,pt,Qx({initialPromise:n==null?void 0:n.initialPromise,fn:s.fetchFn,abort:r.abort.bind(r),onSuccess:c=>{var f,m,v,y;if(c===void 0){a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(c)}catch(x){a(x);return}(m=(f=_(this,Yt).config).onSuccess)==null||m.call(f,c,this),(y=(v=_(this,Yt).config).onSettled)==null||y.call(v,c,this.state.error,this),this.scheduleGc()},onError:a,onFail:(c,f)=>{se(this,pn,Wn).call(this,{type:"failed",failureCount:c,error:f})},onPause:()=>{se(this,pn,Wn).call(this,{type:"pause"})},onContinue:()=>{se(this,pn,Wn).call(this,{type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0})),_(this,pt).start()}},Ni=new WeakMap,ji=new WeakMap,Yt=new WeakMap,pt=new WeakMap,_a=new WeakMap,bo=new WeakMap,pn=new WeakSet,Wn=function(t){const n=r=>{switch(t.type){case"failed":return{...r,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Xx(r.data,this.options),fetchMeta:t.meta??null};case"success":return{...r,data:t.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const o=t.error;return Sd(o)&&o.revert&&_(this,ji)?{..._(this,ji),fetchStatus:"idle"}:{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...t.state}}};this.state=n(this.state),qe.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),_(this,Yt).notify({query:this,type:"updated",action:t})})},Ky);function Xx(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Wx(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function yA(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var Nn,Gy,wA=(Gy=class extends Ho{constructor(t={}){super();ne(this,Nn);this.config=t,q(this,Nn,new Map)}build(t,n,r){const o=n.queryKey,i=n.queryHash??qh(o,n);let s=this.get(i);return s||(s=new vA({cache:this,queryKey:o,queryHash:i,options:t.defaultQueryOptions(n),state:r,defaultOptions:t.getQueryDefaults(o)}),this.add(s)),s}add(t){_(this,Nn).has(t.queryHash)||(_(this,Nn).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=_(this,Nn).get(t.queryHash);n&&(t.destroy(),n===t&&_(this,Nn).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){qe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return _(this,Nn).get(t)}getAll(){return[..._(this,Nn).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Yv(n,r))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(r=>Yv(t,r)):n}notify(t){qe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){qe.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){qe.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},Nn=new WeakMap,Gy),jn,vt,Ro,On,Cr,Wy,xA=(Wy=class extends Yx{constructor(t){super();ne(this,On);ne(this,jn);ne(this,vt);ne(this,Ro);this.mutationId=t.mutationId,q(this,vt,t.mutationCache),q(this,jn,[]),this.state=t.state||Jx(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){_(this,jn).includes(t)||(_(this,jn).push(t),this.clearGcTimeout(),_(this,vt).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){q(this,jn,_(this,jn).filter(n=>n!==t)),this.scheduleGc(),_(this,vt).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){_(this,jn).length||(this.state.status==="pending"?this.scheduleGc():_(this,vt).remove(this))}continue(){var t;return((t=_(this,Ro))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,i,s,a,l,u,d,c,f,m,v,y,x,w,g,S,C,P,b,M;q(this,Ro,Qx({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(A,$)=>{se(this,On,Cr).call(this,{type:"failed",failureCount:A,error:$})},onPause:()=>{se(this,On,Cr).call(this,{type:"pause"})},onContinue:()=>{se(this,On,Cr).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>_(this,vt).canRun(this)}));const n=this.state.status==="pending",r=!_(this,Ro).canStart();try{if(!n){se(this,On,Cr).call(this,{type:"pending",variables:t,isPaused:r}),await((i=(o=_(this,vt).config).onMutate)==null?void 0:i.call(o,t,this));const $=await((a=(s=this.options).onMutate)==null?void 0:a.call(s,t));$!==this.state.context&&se(this,On,Cr).call(this,{type:"pending",context:$,variables:t,isPaused:r})}const A=await _(this,Ro).start();return await((u=(l=_(this,vt).config).onSuccess)==null?void 0:u.call(l,A,t,this.state.context,this)),await((c=(d=this.options).onSuccess)==null?void 0:c.call(d,A,t,this.state.context)),await((m=(f=_(this,vt).config).onSettled)==null?void 0:m.call(f,A,null,this.state.variables,this.state.context,this)),await((y=(v=this.options).onSettled)==null?void 0:y.call(v,A,null,t,this.state.context)),se(this,On,Cr).call(this,{type:"success",data:A}),A}catch(A){try{throw await((w=(x=_(this,vt).config).onError)==null?void 0:w.call(x,A,t,this.state.context,this)),await((S=(g=this.options).onError)==null?void 0:S.call(g,A,t,this.state.context)),await((P=(C=_(this,vt).config).onSettled)==null?void 0:P.call(C,void 0,A,this.state.variables,this.state.context,this)),await((M=(b=this.options).onSettled)==null?void 0:M.call(b,void 0,A,t,this.state.context)),A}finally{se(this,On,Cr).call(this,{type:"error",error:A})}}finally{_(this,vt).runNext(this)}}},jn=new WeakMap,vt=new WeakMap,Ro=new WeakMap,On=new WeakSet,Cr=function(t){const n=r=>{switch(t.type){case"failed":return{...r,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...r,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:t.error,failureCount:r.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),qe.batch(()=>{_(this,jn).forEach(r=>{r.onMutationUpdate(t)}),_(this,vt).notify({mutation:this,type:"updated",action:t})})},Wy);function Jx(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var It,Ta,qy,SA=(qy=class extends Ho{constructor(t={}){super();ne(this,It);ne(this,Ta);this.config=t,q(this,It,new Map),q(this,Ta,Date.now())}build(t,n,r){const o=new xA({mutationCache:this,mutationId:++nl(this,Ta)._,options:t.defaultMutationOptions(n),state:r});return this.add(o),o}add(t){const n=bl(t),r=_(this,It).get(n)??[];r.push(t),_(this,It).set(n,r),this.notify({type:"added",mutation:t})}remove(t){var r;const n=bl(t);if(_(this,It).has(n)){const o=(r=_(this,It).get(n))==null?void 0:r.filter(i=>i!==t);o&&(o.length===0?_(this,It).delete(n):_(this,It).set(n,o))}this.notify({type:"removed",mutation:t})}canRun(t){var r;const n=(r=_(this,It).get(bl(t)))==null?void 0:r.find(o=>o.state.status==="pending");return!n||n===t}runNext(t){var r;const n=(r=_(this,It).get(bl(t)))==null?void 0:r.find(o=>o!==t&&o.state.isPaused);return(n==null?void 0:n.continue())??Promise.resolve()}clear(){qe.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}getAll(){return[..._(this,It).values()].flat()}find(t){const n={exact:!0,...t};return this.getAll().find(r=>Xv(n,r))}findAll(t={}){return this.getAll().filter(n=>Xv(t,n))}notify(t){qe.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return qe.batch(()=>Promise.all(t.map(n=>n.continue().catch(Jt))))}},It=new WeakMap,Ta=new WeakMap,qy);function bl(e){var t;return((t=e.options.scope)==null?void 0:t.id)??String(e.mutationId)}function ey(e){return{onFetch:(t,n)=>{var d,c,f,m,v;const r=t.options,o=(f=(c=(d=t.fetchOptions)==null?void 0:d.meta)==null?void 0:c.fetchMore)==null?void 0:f.direction,i=((m=t.state.data)==null?void 0:m.pages)||[],s=((v=t.state.data)==null?void 0:v.pageParams)||[];let a={pages:[],pageParams:[]},l=0;const u=async()=>{let y=!1;const x=S=>{Object.defineProperty(S,"signal",{enumerable:!0,get:()=>(t.signal.aborted?y=!0:t.signal.addEventListener("abort",()=>{y=!0}),t.signal)})},w=Gx(t.options,t.fetchOptions),g=async(S,C,P)=>{if(y)return Promise.reject();if(C==null&&S.pages.length)return Promise.resolve(S);const b={queryKey:t.queryKey,pageParam:C,direction:P?"backward":"forward",meta:t.options.meta};x(b);const M=await w(b),{maxPages:A}=t.options,$=P?fA:dA;return{pages:$(S.pages,M,A),pageParams:$(S.pageParams,C,A)}};if(o&&i.length){const S=o==="backward",C=S?CA:ty,P={pages:i,pageParams:s},b=C(r,P);a=await g(P,b,S)}else{const S=e??i.length;do{const C=l===0?s[0]??r.initialPageParam:ty(r,a);if(l>0&&C==null)break;a=await g(a,C),l++}while(l{var y,x;return(x=(y=t.options).persister)==null?void 0:x.call(y,u,{queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=u}}}function ty(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function CA(e,{pages:t,pageParams:n}){var r;return t.length>0?(r=e.getPreviousPageParam)==null?void 0:r.call(e,t[0],t,n[0],n):void 0}var Ge,kr,Nr,Oi,Di,jr,Ii,Fi,Qy,bA=(Qy=class{constructor(e={}){ne(this,Ge);ne(this,kr);ne(this,Nr);ne(this,Oi);ne(this,Di);ne(this,jr);ne(this,Ii);ne(this,Fi);q(this,Ge,e.queryCache||new wA),q(this,kr,e.mutationCache||new SA),q(this,Nr,e.defaultOptions||{}),q(this,Oi,new Map),q(this,Di,new Map),q(this,jr,0)}mount(){nl(this,jr)._++,_(this,jr)===1&&(q(this,Ii,Xh.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,Ge).onFocus())})),q(this,Fi,Ou.subscribe(async e=>{e&&(await this.resumePausedMutations(),_(this,Ge).onOnline())})))}unmount(){var e,t;nl(this,jr)._--,_(this,jr)===0&&((e=_(this,Ii))==null||e.call(this),q(this,Ii,void 0),(t=_(this,Fi))==null||t.call(this),q(this,Fi,void 0))}isFetching(e){return _(this,Ge).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return _(this,kr).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,Ge).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.getQueryData(e.queryKey);if(t===void 0)return this.fetchQuery(e);{const n=this.defaultQueryOptions(e),r=_(this,Ge).build(this,n);return e.revalidateIfStale&&r.isStaleByTime(Ri(n.staleTime,r))&&this.prefetchQuery(n),Promise.resolve(t)}}getQueriesData(e){return _(this,Ge).findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),o=_(this,Ge).get(r.queryHash),i=o==null?void 0:o.state.data,s=uA(t,i);if(s!==void 0)return _(this,Ge).build(this,r).setData(s,{...n,manual:!0})}setQueriesData(e,t,n){return qe.batch(()=>_(this,Ge).findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=_(this,Ge).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=_(this,Ge);qe.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=_(this,Ge),r={type:"active",...e};return qe.batch(()=>(n.findAll(e).forEach(o=>{o.reset()}),this.refetchQueries(r,t)))}cancelQueries(e={},t={}){const n={revert:!0,...t},r=qe.batch(()=>_(this,Ge).findAll(e).map(o=>o.cancel(n)));return Promise.all(r).then(Jt).catch(Jt)}invalidateQueries(e={},t={}){return qe.batch(()=>{if(_(this,Ge).findAll(e).forEach(r=>{r.invalidate()}),e.refetchType==="none")return Promise.resolve();const n={...e,type:e.refetchType??e.type??"active"};return this.refetchQueries(n,t)})}refetchQueries(e={},t){const n={...t,cancelRefetch:(t==null?void 0:t.cancelRefetch)??!0},r=qe.batch(()=>_(this,Ge).findAll(e).filter(o=>!o.isDisabled()).map(o=>{let i=o.fetch(void 0,n);return n.throwOnError||(i=i.catch(Jt)),o.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Jt)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=_(this,Ge).build(this,t);return n.isStaleByTime(Ri(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Jt).catch(Jt)}fetchInfiniteQuery(e){return e.behavior=ey(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Jt).catch(Jt)}ensureInfiniteQueryData(e){return e.behavior=ey(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ou.isOnline()?_(this,kr).resumePausedMutations():Promise.resolve()}getQueryCache(){return _(this,Ge)}getMutationCache(){return _(this,kr)}getDefaultOptions(){return _(this,Nr)}setDefaultOptions(e){q(this,Nr,e)}setQueryDefaults(e,t){_(this,Oi).set(Lo(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[..._(this,Oi).values()];let n={};return t.forEach(r=>{xa(e,r.queryKey)&&(n={...n,...r.defaultOptions})}),n}setMutationDefaults(e,t){_(this,Di).set(Lo(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[..._(this,Di).values()];let n={};return t.forEach(r=>{xa(e,r.mutationKey)&&(n={...n,...r.defaultOptions})}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={..._(this,Nr).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=qh(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.enabled!==!0&&t.queryFn===Yh&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{..._(this,Nr).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){_(this,Ge).clear(),_(this,kr).clear()}},Ge=new WeakMap,kr=new WeakMap,Nr=new WeakMap,Oi=new WeakMap,Di=new WeakMap,jr=new WeakMap,Ii=new WeakMap,Fi=new WeakMap,Qy),Rt,xe,Aa,yt,Eo,Li,Or,Dn,Ma,$i,Ui,Po,_o,Dr,zi,_e,Ls,Yf,Xf,Jf,Zf,ep,tp,np,Zx,Yy,Jh=(Yy=class extends Ho{constructor(t,n){super();ne(this,_e);ne(this,Rt);ne(this,xe);ne(this,Aa);ne(this,yt);ne(this,Eo);ne(this,Li);ne(this,Or);ne(this,Dn);ne(this,Ma);ne(this,$i);ne(this,Ui);ne(this,Po);ne(this,_o);ne(this,Dr);ne(this,zi,new Set);this.options=n,q(this,Rt,t),q(this,Dn,null),q(this,Or,Qf()),this.options.experimental_prefetchInRender||_(this,Or).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(_(this,xe).addObserver(this),ny(_(this,xe),this.options)?se(this,_e,Ls).call(this):this.updateResult(),se(this,_e,Zf).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rp(_(this,xe),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rp(_(this,xe),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,se(this,_e,ep).call(this),se(this,_e,tp).call(this),_(this,xe).removeObserver(this)}setOptions(t,n){const r=this.options,o=_(this,xe);if(this.options=_(this,Rt).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof vn(this.options.enabled,_(this,xe))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");se(this,_e,np).call(this),_(this,xe).setOptions(this.options),r._defaulted&&!ju(this.options,r)&&_(this,Rt).getQueryCache().notify({type:"observerOptionsUpdated",query:_(this,xe),observer:this});const i=this.hasListeners();i&&ry(_(this,xe),o,this.options,r)&&se(this,_e,Ls).call(this),this.updateResult(n),i&&(_(this,xe)!==o||vn(this.options.enabled,_(this,xe))!==vn(r.enabled,_(this,xe))||Ri(this.options.staleTime,_(this,xe))!==Ri(r.staleTime,_(this,xe)))&&se(this,_e,Yf).call(this);const s=se(this,_e,Xf).call(this);i&&(_(this,xe)!==o||vn(this.options.enabled,_(this,xe))!==vn(r.enabled,_(this,xe))||s!==_(this,Dr))&&se(this,_e,Jf).call(this,s)}getOptimisticResult(t){const n=_(this,Rt).getQueryCache().build(_(this,Rt),t),r=this.createResult(n,t);return EA(this,r)&&(q(this,yt,r),q(this,Li,this.options),q(this,Eo,_(this,xe).state)),r}getCurrentResult(){return _(this,yt)}trackResult(t,n){const r={};return Object.keys(t).forEach(o=>{Object.defineProperty(r,o,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(o),n==null||n(o),t[o])})}),r}trackProp(t){_(this,zi).add(t)}getCurrentQuery(){return _(this,xe)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=_(this,Rt).defaultQueryOptions(t),r=_(this,Rt).getQueryCache().build(_(this,Rt),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(t){return se(this,_e,Ls).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),_(this,yt)))}createResult(t,n){var A;const r=_(this,xe),o=this.options,i=_(this,yt),s=_(this,Eo),a=_(this,Li),u=t!==r?t.state:_(this,Aa),{state:d}=t;let c={...d},f=!1,m;if(n._optimisticResults){const $=this.hasListeners(),R=!$&&ny(t,n),O=$&&ry(t,r,n,o);(R||O)&&(c={...c,...Xx(d.data,t.options)}),n._optimisticResults==="isRestoring"&&(c.fetchStatus="idle")}let{error:v,errorUpdatedAt:y,status:x}=c;if(n.select&&c.data!==void 0)if(i&&c.data===(s==null?void 0:s.data)&&n.select===_(this,Ma))m=_(this,$i);else try{q(this,Ma,n.select),m=n.select(c.data),m=qf(i==null?void 0:i.data,m,n),q(this,$i,m),q(this,Dn,null)}catch($){q(this,Dn,$)}else m=c.data;if(n.placeholderData!==void 0&&m===void 0&&x==="pending"){let $;if(i!=null&&i.isPlaceholderData&&n.placeholderData===(a==null?void 0:a.placeholderData))$=i.data;else if($=typeof n.placeholderData=="function"?n.placeholderData((A=_(this,Ui))==null?void 0:A.state.data,_(this,Ui)):n.placeholderData,n.select&&$!==void 0)try{$=n.select($),q(this,Dn,null)}catch(R){q(this,Dn,R)}$!==void 0&&(x="success",m=qf(i==null?void 0:i.data,$,n),f=!0)}_(this,Dn)&&(v=_(this,Dn),m=_(this,$i),y=Date.now(),x="error");const w=c.fetchStatus==="fetching",g=x==="pending",S=x==="error",C=g&&w,P=m!==void 0,M={status:x,fetchStatus:c.fetchStatus,isPending:g,isSuccess:x==="success",isError:S,isInitialLoading:C,isLoading:C,data:m,dataUpdatedAt:c.dataUpdatedAt,error:v,errorUpdatedAt:y,failureCount:c.fetchFailureCount,failureReason:c.fetchFailureReason,errorUpdateCount:c.errorUpdateCount,isFetched:c.dataUpdateCount>0||c.errorUpdateCount>0,isFetchedAfterMount:c.dataUpdateCount>u.dataUpdateCount||c.errorUpdateCount>u.errorUpdateCount,isFetching:w,isRefetching:w&&!g,isLoadingError:S&&!P,isPaused:c.fetchStatus==="paused",isPlaceholderData:f,isRefetchError:S&&P,isStale:Zh(t,n),refetch:this.refetch,promise:_(this,Or)};if(this.options.experimental_prefetchInRender){const $=F=>{M.status==="error"?F.reject(M.error):M.data!==void 0&&F.resolve(M.data)},R=()=>{const F=q(this,Or,M.promise=Qf());$(F)},O=_(this,Or);switch(O.status){case"pending":t.queryHash===r.queryHash&&$(O);break;case"fulfilled":(M.status==="error"||M.data!==O.value)&&R();break;case"rejected":(M.status!=="error"||M.error!==O.reason)&&R();break}}return M}updateResult(t){const n=_(this,yt),r=this.createResult(_(this,xe),this.options);if(q(this,Eo,_(this,xe).state),q(this,Li,this.options),_(this,Eo).data!==void 0&&q(this,Ui,_(this,xe)),ju(r,n))return;q(this,yt,r);const o={},i=()=>{if(!n)return!0;const{notifyOnChangeProps:s}=this.options,a=typeof s=="function"?s():s;if(a==="all"||!a&&!_(this,zi).size)return!0;const l=new Set(a??_(this,zi));return this.options.throwOnError&&l.add("error"),Object.keys(_(this,yt)).some(u=>{const d=u;return _(this,yt)[d]!==n[d]&&l.has(d)})};(t==null?void 0:t.listeners)!==!1&&i()&&(o.listeners=!0),se(this,_e,Zx).call(this,{...o,...t})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&se(this,_e,Zf).call(this)}},Rt=new WeakMap,xe=new WeakMap,Aa=new WeakMap,yt=new WeakMap,Eo=new WeakMap,Li=new WeakMap,Or=new WeakMap,Dn=new WeakMap,Ma=new WeakMap,$i=new WeakMap,Ui=new WeakMap,Po=new WeakMap,_o=new WeakMap,Dr=new WeakMap,zi=new WeakMap,_e=new WeakSet,Ls=function(t){se(this,_e,np).call(this);let n=_(this,xe).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Jt)),n},Yf=function(){se(this,_e,ep).call(this);const t=Ri(this.options.staleTime,_(this,xe));if(Fo||_(this,yt).isStale||!Gf(t))return;const r=Kx(_(this,yt).dataUpdatedAt,t)+1;q(this,Po,setTimeout(()=>{_(this,yt).isStale||this.updateResult()},r))},Xf=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(_(this,xe)):this.options.refetchInterval)??!1},Jf=function(t){se(this,_e,tp).call(this),q(this,Dr,t),!(Fo||vn(this.options.enabled,_(this,xe))===!1||!Gf(_(this,Dr))||_(this,Dr)===0)&&q(this,_o,setInterval(()=>{(this.options.refetchIntervalInBackground||Xh.isFocused())&&se(this,_e,Ls).call(this)},_(this,Dr)))},Zf=function(){se(this,_e,Yf).call(this),se(this,_e,Jf).call(this,se(this,_e,Xf).call(this))},ep=function(){_(this,Po)&&(clearTimeout(_(this,Po)),q(this,Po,void 0))},tp=function(){_(this,_o)&&(clearInterval(_(this,_o)),q(this,_o,void 0))},np=function(){const t=_(this,Rt).getQueryCache().build(_(this,Rt),this.options);if(t===_(this,xe))return;const n=_(this,xe);q(this,xe,t),q(this,Aa,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},Zx=function(t){qe.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(_(this,yt))}),_(this,Rt).getQueryCache().notify({query:_(this,xe),type:"observerResultsUpdated"})})},Yy);function RA(e,t){return vn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function ny(e,t){return RA(e,t)||e.state.data!==void 0&&rp(e,t,t.refetchOnMount)}function rp(e,t,n){if(vn(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&Zh(e,t)}return!1}function ry(e,t,n,r){return(e!==t||vn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Zh(e,n)}function Zh(e,t){return vn(t.enabled,e)!==!1&&e.isStaleByTime(Ri(t.staleTime,e))}function EA(e,t){return!ju(e.getCurrentResult(),t)}function oy(e,t){return e.filter(n=>!t.includes(n))}function PA(e,t,n){const r=e.slice(0);return r[t]=n,r}var Bi,Xt,Vi,Hi,Ft,Ir,ka,Na,jt,op,ip,sp,ap,Xy,_A=(Xy=class extends Ho{constructor(t,n,r){super();ne(this,jt);ne(this,Bi);ne(this,Xt);ne(this,Vi);ne(this,Hi);ne(this,Ft);ne(this,Ir);ne(this,ka);ne(this,Na);q(this,Bi,t),q(this,Hi,r),q(this,Vi,[]),q(this,Ft,[]),q(this,Xt,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&_(this,Ft).forEach(t=>{t.subscribe(n=>{se(this,jt,sp).call(this,t,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,_(this,Ft).forEach(t=>{t.destroy()})}setQueries(t,n,r){q(this,Vi,t),q(this,Hi,n),qe.batch(()=>{const o=_(this,Ft),i=se(this,jt,ip).call(this,_(this,Vi));i.forEach(u=>u.observer.setOptions(u.defaultedQueryOptions,r));const s=i.map(u=>u.observer),a=s.map(u=>u.getCurrentResult()),l=s.some((u,d)=>u!==o[d]);o.length===s.length&&!l||(q(this,Ft,s),q(this,Xt,a),this.hasListeners()&&(oy(o,s).forEach(u=>{u.destroy()}),oy(s,o).forEach(u=>{u.subscribe(d=>{se(this,jt,sp).call(this,u,d)})}),se(this,jt,ap).call(this)))})}getCurrentResult(){return _(this,Xt)}getQueries(){return _(this,Ft).map(t=>t.getCurrentQuery())}getObservers(){return _(this,Ft)}getOptimisticResult(t,n){const r=se(this,jt,ip).call(this,t),o=r.map(i=>i.observer.getOptimisticResult(i.defaultedQueryOptions));return[o,i=>se(this,jt,op).call(this,i??o,n),()=>r.map((i,s)=>{const a=o[s];return i.defaultedQueryOptions.notifyOnChangeProps?a:i.observer.trackResult(a,l=>{r.forEach(u=>{u.observer.trackProp(l)})})})]}},Bi=new WeakMap,Xt=new WeakMap,Vi=new WeakMap,Hi=new WeakMap,Ft=new WeakMap,Ir=new WeakMap,ka=new WeakMap,Na=new WeakMap,jt=new WeakSet,op=function(t,n){return n?((!_(this,Ir)||_(this,Xt)!==_(this,Na)||n!==_(this,ka))&&(q(this,ka,n),q(this,Na,_(this,Xt)),q(this,Ir,Qh(_(this,Ir),n(t)))),_(this,Ir)):t},ip=function(t){const n=new Map(_(this,Ft).map(o=>[o.options.queryHash,o])),r=[];return t.forEach(o=>{const i=_(this,Bi).defaultQueryOptions(o),s=n.get(i.queryHash);if(s)r.push({defaultedQueryOptions:i,observer:s});else{const a=_(this,Ft).find(l=>l.options.queryHash===i.queryHash);r.push({defaultedQueryOptions:i,observer:a??new Jh(_(this,Bi),i)})}}),r.sort((o,i)=>t.findIndex(s=>s.queryHash===o.defaultedQueryOptions.queryHash)-t.findIndex(s=>s.queryHash===i.defaultedQueryOptions.queryHash))},sp=function(t,n){const r=_(this,Ft).indexOf(t);r!==-1&&(q(this,Xt,PA(_(this,Xt),r,n)),se(this,jt,ap).call(this))},ap=function(){var t;if(this.hasListeners()){const n=_(this,Ir),r=se(this,jt,op).call(this,_(this,Xt),(t=_(this,Hi))==null?void 0:t.combine);n!==r&&qe.batch(()=>{this.listeners.forEach(o=>{o(_(this,Xt))})})}},Xy),Fr,Lr,Et,Xn,or,Ql,lp,Jy,TA=(Jy=class extends Ho{constructor(n,r){super();ne(this,or);ne(this,Fr);ne(this,Lr);ne(this,Et);ne(this,Xn);q(this,Fr,n),this.setOptions(r),this.bindMethods(),se(this,or,Ql).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var o;const r=this.options;this.options=_(this,Fr).defaultMutationOptions(n),ju(this.options,r)||_(this,Fr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:_(this,Et),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&Lo(r.mutationKey)!==Lo(this.options.mutationKey)?this.reset():((o=_(this,Et))==null?void 0:o.state.status)==="pending"&&_(this,Et).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=_(this,Et))==null||n.removeObserver(this)}onMutationUpdate(n){se(this,or,Ql).call(this),se(this,or,lp).call(this,n)}getCurrentResult(){return _(this,Lr)}reset(){var n;(n=_(this,Et))==null||n.removeObserver(this),q(this,Et,void 0),se(this,or,Ql).call(this),se(this,or,lp).call(this)}mutate(n,r){var o;return q(this,Xn,r),(o=_(this,Et))==null||o.removeObserver(this),q(this,Et,_(this,Fr).getMutationCache().build(_(this,Fr),this.options)),_(this,Et).addObserver(this),_(this,Et).execute(n)}},Fr=new WeakMap,Lr=new WeakMap,Et=new WeakMap,Xn=new WeakMap,or=new WeakSet,Ql=function(){var r;const n=((r=_(this,Et))==null?void 0:r.state)??Jx();q(this,Lr,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},lp=function(n){qe.batch(()=>{var r,o,i,s,a,l,u,d;if(_(this,Xn)&&this.hasListeners()){const c=_(this,Lr).variables,f=_(this,Lr).context;(n==null?void 0:n.type)==="success"?((o=(r=_(this,Xn)).onSuccess)==null||o.call(r,n.data,c,f),(s=(i=_(this,Xn)).onSettled)==null||s.call(i,n.data,null,c,f)):(n==null?void 0:n.type)==="error"&&((l=(a=_(this,Xn)).onError)==null||l.call(a,n.error,c,f),(d=(u=_(this,Xn)).onSettled)==null||d.call(u,void 0,n.error,c,f))}this.listeners.forEach(c=>{c(_(this,Lr))})})},Jy),e1=h.createContext(void 0),hc=e=>{const t=h.useContext(e1);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},AA=({client:e,children:t})=>(h.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),p.jsx(e1.Provider,{value:e,children:t})),t1=h.createContext(!1),n1=()=>h.useContext(t1);t1.Provider;function MA(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var kA=h.createContext(MA()),r1=()=>h.useContext(kA);function o1(e,t){return typeof e=="function"?e(...t):!!e}function i1(){}var s1=(e,t)=>{(e.suspense||e.throwOnError)&&(t.isReset()||(e.retryOnMount=!1))},a1=e=>{h.useEffect(()=>{e.clearReset()},[e])},l1=({result:e,errorResetBoundary:t,throwOnError:n,query:r})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&o1(n,[e.error,r]),u1=e=>{e.suspense&&(e.staleTime===void 0&&(e.staleTime=1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},c1=(e,t)=>e.isLoading&&e.isFetching&&!t,up=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,Du=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function iy({queries:e,...t},n){const r=hc(),o=n1(),i=r1(),s=h.useMemo(()=>e.map(v=>{const y=r.defaultQueryOptions(v);return y._optimisticResults=o?"isRestoring":"optimistic",y}),[e,r,o]);s.forEach(v=>{u1(v),s1(v,i)}),a1(i);const[a]=h.useState(()=>new _A(r,s,t)),[l,u,d]=a.getOptimisticResult(s,t.combine);h.useSyncExternalStore(h.useCallback(v=>o?()=>{}:a.subscribe(qe.batchCalls(v)),[a,o]),()=>a.getCurrentResult(),()=>a.getCurrentResult()),h.useEffect(()=>{a.setQueries(s,t,{listeners:!1})},[s,t,a]);const f=l.some((v,y)=>up(s[y],v))?l.flatMap((v,y)=>{const x=s[y];if(x){const w=new Jh(r,x);if(up(x,v))return Du(x,w,i);c1(v,o)&&Du(x,w,i)}return[]}):[];if(f.length>0)throw Promise.all(f);const m=l.find((v,y)=>{const x=s[y];return x&&l1({result:v,errorResetBoundary:i,throwOnError:x.throwOnError,query:r.getQueryCache().get(x.queryHash)})});if(m!=null&&m.error)throw m.error;return u(d())}function NA(e,t,n){var d,c,f,m,v;const r=hc(),o=n1(),i=r1(),s=r.defaultQueryOptions(e);(c=(d=r.getDefaultOptions().queries)==null?void 0:d._experimental_beforeQuery)==null||c.call(d,s),s._optimisticResults=o?"isRestoring":"optimistic",u1(s),s1(s,i),a1(i);const a=!r.getQueryCache().get(s.queryHash),[l]=h.useState(()=>new t(r,s)),u=l.getOptimisticResult(s);if(h.useSyncExternalStore(h.useCallback(y=>{const x=o?()=>{}:l.subscribe(qe.batchCalls(y));return l.updateResult(),x},[l,o]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),h.useEffect(()=>{l.setOptions(s,{listeners:!1})},[s,l]),up(s,u))throw Du(s,l,i);if(l1({result:u,errorResetBoundary:i,throwOnError:s.throwOnError,query:r.getQueryCache().get(s.queryHash)}))throw u.error;if((m=(f=r.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||m.call(f,s,u),s.experimental_prefetchInRender&&!Fo&&c1(u,o)){const y=a?Du(s,l,i):(v=r.getQueryCache().get(s.queryHash))==null?void 0:v.promise;y==null||y.catch(i1).finally(()=>{l.updateResult()})}return s.notifyOnChangeProps?u:l.trackResult(u)}function Un(e,t){return NA(e,Jh)}function Js(e,t){const n=hc(),[r]=h.useState(()=>new TA(n,e));h.useEffect(()=>{r.setOptions(e)},[r,e]);const o=h.useSyncExternalStore(h.useCallback(s=>r.subscribe(qe.batchCalls(s)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=h.useCallback((s,a)=>{r.mutate(s,a).catch(i1)},[r]);if(o.error&&o1(r.options.throwOnError,[o.error]))throw o.error;return{...o,mutate:i,mutateAsync:o.mutate}}const Iu="aidbox-forms",d1=["openid fhirUser","profile","online_access","launch/patient","launch/questionnaire","launch/questionnaireresponse","user/Questionnaire.crus","patient/Patient.r","patient/QuestionnaireResponse.crus"],sy="https://form-builder.aidbox.app",cp="https://form-builder.aidbox.app/fhir",er=Nu.client(cp),jA=e=>e.startsWith(sy)&&!e.startsWith(cp)?e.replace(sy,cp):e,f1=h.createContext(null),OA=e=>{const t=window.location.pathname+window.location.hash;return Nu.oauth2.authorize({clientId:Iu,redirectUri:t,...e})},Ko=()=>{const e=h.useContext(f1);if(!e)throw new Error("No client found in the context");return e},DA=({children:e})=>{const{searchParams:t}=new URL(window.location),{data:n}=Un({queryKey:["client"],queryFn:()=>{const r=window.location.pathname+window.location.hash;return t.has("error")||t.has("error_description")?Nu.oauth2.ready({clientId:Iu,redirectUri:r}).catch(o=>{throw sessionStorage.clear(),o}):Nu.oauth2.init({clientId:Iu,scope:d1.join(" "),redirectUri:r})},retry:!1});return p.jsx(f1.Provider,{value:n,children:e})},ay=async(e,t)=>{var o;const{fhirContext:n}=(o=e==null?void 0:e.state)==null?void 0:o.tokenResponse,[r]=n==null?void 0:n.filter(({reference:i})=>{if(i.startsWith(`${t}/`))return i.split("/")[1]});if(r)return(t==="Questionnaire"?er:e).request(`${t}/${r}`);throw new Error(`No ${t} in the launch context`)},IA=async e=>{const[t,n,r,o,i]=await Promise.allSettled([e.patient.read(),e.encounter.read(),e.user.read(),ay(e,"Questionnaire"),ay(e,"QuestionnaireResponse")]);if(r.status==="rejected")throw r.reason;return{patient:t.status==="fulfilled"?t.value:null,encounter:n.status==="fulfilled"?n.value:null,user:r.value,questionnaire:o.status==="fulfilled"?o.value:null,questionnaireResponse:i.status==="fulfilled"?i.value:null}},p1=h.createContext(null),Go=()=>{const e=h.useContext(p1);if(!e)throw new Error("No launch context found in the context");return e},FA=({children:e})=>{const t=Ko(),{data:n}=Un({queryKey:["launch-context"],queryFn:()=>IA(t)});return p.jsx(p1.Provider,{value:n,children:e})};function h1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t{const t=zA(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:s=>{const a=s.split(eg);return a[0]===""&&a.length!==1&&a.shift(),g1(a,t)||UA(s)},getConflictingClassGroupIds:(s,a)=>{const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}}},g1=(e,t)=>{var s;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?g1(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const i=e.join(eg);return(s=t.validators.find(({validator:a})=>a(i)))==null?void 0:s.classGroupId},ly=/^\[(.+)\]$/,UA=e=>{if(ly.test(e)){const t=ly.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},zA=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return VA(Object.entries(e.classGroups),n).forEach(([i,s])=>{dp(s,r,i,t)}),r},dp=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const i=o===""?t:uy(t,o);i.classGroupId=n;return}if(typeof o=="function"){if(BA(o)){dp(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([i,s])=>{dp(s,uy(t,i),n,r)})})},uy=(e,t)=>{let n=e;return t.split(eg).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},BA=e=>e.isThemeGetter,VA=(e,t)=>t?e.map(([n,r])=>{const o=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([s,a])=>[t+s,a])):i);return[n,o]}):e,HA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(i,s)=>{n.set(i,s),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let s=n.get(i);if(s!==void 0)return s;if((s=r.get(i))!==void 0)return o(i,s),s},set(i,s){n.has(i)?n.set(i,s):o(i,s)}}},m1="!",KA=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],i=t.length,s=a=>{const l=[];let u=0,d=0,c;for(let x=0;xd?c-d:void 0;return{modifiers:l,hasImportantModifier:m,baseClassName:v,maybePostfixModifierPosition:y}};return n?a=>n({className:a,parseClassName:s}):s},GA=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},WA=e=>({cache:HA(e.cacheSize),parseClassName:KA(e),...$A(e)}),qA=/\s+/,QA=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,i=[],s=e.trim().split(qA);let a="";for(let l=s.length-1;l>=0;l-=1){const u=s[l],{modifiers:d,hasImportantModifier:c,baseClassName:f,maybePostfixModifierPosition:m}=n(u);let v=!!m,y=r(v?f.substring(0,m):f);if(!y){if(!v){a=u+(a.length>0?" "+a:a);continue}if(y=r(f),!y){a=u+(a.length>0?" "+a:a);continue}v=!1}const x=GA(d).join(":"),w=c?x+m1:x,g=w+y;if(i.includes(g))continue;i.push(g);const S=o(y,v);for(let C=0;C0?" "+a:a)}return a};function YA(){let e=0,t,n,r="";for(;e{if(typeof e=="string")return e;let t,n="";for(let r=0;rc(d),e());return n=WA(u),r=n.cache.get,o=n.cache.set,i=a,a(l)}function a(l){const u=r(l);if(u)return u;const d=QA(l,n);return o(l,d),d}return function(){return i(YA.apply(null,arguments))}}const je=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},y1=/^\[(?:([a-z-]+):)?(.+)\]$/i,JA=/^\d+\/\d+$/,ZA=new Set(["px","full","screen"]),eM=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,tM=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,nM=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,rM=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,oM=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Gn=e=>Ei(e)||ZA.has(e)||JA.test(e),yr=e=>ls(e,"length",fM),Ei=e=>!!e&&!Number.isNaN(Number(e)),Cd=e=>ls(e,"number",Ei),As=e=>!!e&&Number.isInteger(Number(e)),iM=e=>e.endsWith("%")&&Ei(e.slice(0,-1)),de=e=>y1.test(e),wr=e=>eM.test(e),sM=new Set(["length","size","percentage"]),aM=e=>ls(e,sM,w1),lM=e=>ls(e,"position",w1),uM=new Set(["image","url"]),cM=e=>ls(e,uM,hM),dM=e=>ls(e,"",pM),Ms=()=>!0,ls=(e,t,n)=>{const r=y1.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},fM=e=>tM.test(e)&&!nM.test(e),w1=()=>!1,pM=e=>rM.test(e),hM=e=>oM.test(e),gM=()=>{const e=je("colors"),t=je("spacing"),n=je("blur"),r=je("brightness"),o=je("borderColor"),i=je("borderRadius"),s=je("borderSpacing"),a=je("borderWidth"),l=je("contrast"),u=je("grayscale"),d=je("hueRotate"),c=je("invert"),f=je("gap"),m=je("gradientColorStops"),v=je("gradientColorStopPositions"),y=je("inset"),x=je("margin"),w=je("opacity"),g=je("padding"),S=je("saturate"),C=je("scale"),P=je("sepia"),b=je("skew"),M=je("space"),A=je("translate"),$=()=>["auto","contain","none"],R=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",de,t],F=()=>[de,t],N=()=>["",Gn,yr],E=()=>["auto",Ei,de],T=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],D=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>["start","end","center","between","around","evenly","stretch"],j=()=>["","0",de],B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Q=()=>[Ei,de];return{cacheSize:500,separator:":",theme:{colors:[Ms],spacing:[Gn,yr],blur:["none","",wr,de],brightness:Q(),borderColor:[e],borderRadius:["none","","full",wr,de],borderSpacing:F(),borderWidth:N(),contrast:Q(),grayscale:j(),hueRotate:Q(),invert:j(),gap:F(),gradientColorStops:[e],gradientColorStopPositions:[iM,yr],inset:O(),margin:O(),opacity:Q(),padding:F(),saturate:Q(),scale:Q(),sepia:j(),skew:Q(),space:F(),translate:F()},classGroups:{aspect:[{aspect:["auto","square","video",de]}],container:["container"],columns:[{columns:[wr]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...T(),de]}],overflow:[{overflow:R()}],"overflow-x":[{"overflow-x":R()}],"overflow-y":[{"overflow-y":R()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",As,de]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",de]}],grow:[{grow:j()}],shrink:[{shrink:j()}],order:[{order:["first","last","none",As,de]}],"grid-cols":[{"grid-cols":[Ms]}],"col-start-end":[{col:["auto",{span:["full",As,de]},de]}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":[Ms]}],"row-start-end":[{row:["auto",{span:[As,de]},de]}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",de]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",de]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...L()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...L(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...L(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[g]}],px:[{px:[g]}],py:[{py:[g]}],ps:[{ps:[g]}],pe:[{pe:[g]}],pt:[{pt:[g]}],pr:[{pr:[g]}],pb:[{pb:[g]}],pl:[{pl:[g]}],m:[{m:[x]}],mx:[{mx:[x]}],my:[{my:[x]}],ms:[{ms:[x]}],me:[{me:[x]}],mt:[{mt:[x]}],mr:[{mr:[x]}],mb:[{mb:[x]}],ml:[{ml:[x]}],"space-x":[{"space-x":[M]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[M]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",de,t]}],"min-w":[{"min-w":[de,t,"min","max","fit"]}],"max-w":[{"max-w":[de,t,"none","full","min","max","fit","prose",{screen:[wr]},wr]}],h:[{h:[de,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[de,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[de,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[de,t,"auto","min","max","fit"]}],"font-size":[{text:["base",wr,yr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Cd]}],"font-family":[{font:[Ms]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",de]}],"line-clamp":[{"line-clamp":["none",Ei,Cd]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Gn,de]}],"list-image":[{"list-image":["none",de]}],"list-style-type":[{list:["none","disc","decimal",de]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...D(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Gn,yr]}],"underline-offset":[{"underline-offset":["auto",Gn,de]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:F()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",de]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",de]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...T(),lM]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",aM]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},cM]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...D(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:D()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...D()]}],"outline-offset":[{"outline-offset":[Gn,de]}],"outline-w":[{outline:[Gn,yr]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:N()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[Gn,yr]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",wr,dM]}],"shadow-color":[{shadow:[Ms]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",wr,de]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[c]}],saturate:[{saturate:[S]}],sepia:[{sepia:[P]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[c]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[P]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",de]}],duration:[{duration:Q()}],ease:[{ease:["linear","in","out","in-out",de]}],delay:[{delay:Q()}],animate:[{animate:["none","spin","ping","pulse","bounce",de]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[C]}],"scale-x":[{"scale-x":[C]}],"scale-y":[{"scale-y":[C]}],rotate:[{rotate:[As,de]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[b]}],"skew-y":[{"skew-y":[b]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",de]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",de]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":F()}],"scroll-mx":[{"scroll-mx":F()}],"scroll-my":[{"scroll-my":F()}],"scroll-ms":[{"scroll-ms":F()}],"scroll-me":[{"scroll-me":F()}],"scroll-mt":[{"scroll-mt":F()}],"scroll-mr":[{"scroll-mr":F()}],"scroll-mb":[{"scroll-mb":F()}],"scroll-ml":[{"scroll-ml":F()}],"scroll-p":[{"scroll-p":F()}],"scroll-px":[{"scroll-px":F()}],"scroll-py":[{"scroll-py":F()}],"scroll-ps":[{"scroll-ps":F()}],"scroll-pe":[{"scroll-pe":F()}],"scroll-pt":[{"scroll-pt":F()}],"scroll-pr":[{"scroll-pr":F()}],"scroll-pb":[{"scroll-pb":F()}],"scroll-pl":[{"scroll-pl":F()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",de]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Gn,yr,Cd]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},mM=XA(gM);function G(...e){return mM(LA(e))}function us(e){var t,n;if(e){if(e!=null&&e[0].text)return`${e==null?void 0:e[0].text}`;{const r=((t=e==null?void 0:e[0].prefix)==null?void 0:t[0])??"",o=((n=e==null?void 0:e[0].given)==null?void 0:n[0])??"",i=(e==null?void 0:e[0].family)??"";return`${r} ${o} ${i}`.replace(/\s+/g," ").trim()}}else return"Unknown"}const vM=e=>{var s;const t=((s=e[0].line)==null?void 0:s[0])??"",n=e[0].city??"",r=e[0].state??"",o=e[0].postalCode??"",i=e[0].country??"";return`${t}, ${n}, ${r} ${o}, ${i}`};function yM(e){return e?e.charAt(0).toUpperCase()+e.slice(1):"unknown"}function wM(e){const[t,n]=us(e).split(" ");return n?`${t.charAt(0)}${n.charAt(0)}`.toUpperCase():t.substring(0,2).toUpperCase()}function xM(e,t){e=Math.max(1,Math.min(e,t));const i=e>1,s=e1||l1&&a--,l1,c=l2,m=lvv>e),showLastEllipsis:m,showLastPageButton:c,nextButtonEnabled:s}}async function SM({questionnaire:e,subject:t,encounter:n,author:r}){const{parameter:[{resource:o}]}=await er.request({url:"Questionnaire/$populate",method:"POST",headers:{"Content-Type":"application/fhir+json"},body:JSON.stringify({resourceType:"Parameters",parameter:[{name:"questionnaire",resource:e},{name:"subject",resource:t},{name:"context",part:[...n?[{name:"name",valueString:"encounter"},{name:"content",resource:n}]:[],...r?[{name:"name",valueString:"author"},{name:"content",resource:r}]:[]]}]})});return o}function x1(e,t,n){let r="QuestionnaireResponse",o="POST";return n.id&&(r+=`/${n.id}`,o="PUT"),e.request({url:r,method:o,headers:{"Content-Type":"application/fhir+json"},body:JSON.stringify({...n,questionnaire:t.url?t.url:`Questionnaire/${t.id}`,meta:{...n.meta,source:"https://aidbox.github.io/examples/aidbox-forms-smart-launch"}})})}function S1(e,t){let n="Questionnaire",r="POST";return t.id&&(n+=`/${t.id}`,r="PUT"),e.request({url:n,method:r,headers:{"Content-Type":"application/fhir+json"},body:JSON.stringify(t)})}function CM(e,t){return e.request({url:`Questionnaire/${t.id}`,method:"DELETE"})}async function bM({client:e,questionnaire:t,subject:n,encounter:r,author:o}){const i=await SM({questionnaire:t,subject:n,encounter:r,author:o});return x1(e,t,i)}function cy({launchUrl:e,launchType:t,fhirVersion:n}){const r=["provider-ehr","patient-portal","provider-standalone","patient-standalone","backend-service"],o=new URLSearchParams;return o.set("fhir_version",n||"r4"),o.set("launch_url",e.toString()),o.set("launch",btoa(JSON.stringify([r.indexOf(t)]))),`https://launch.smarthealthit.org/?${o.toString()}`}function bd(e){var n,r;const t=e.resourceType==="Bundle"?(r=(n=e.entry)==null?void 0:n[0])==null?void 0:r.resource:e;if(!t)throw new Error("Resource not found");return t}async function C1(e,t){const n=t.startsWith("http")?`Questionnaire?url=${t.replace(/\|.*$/,"")}`:`Questionnaire/${t.replace(/^Questionnaire\//,"")}`;return Promise.any([er.request(n).then(r=>[er,bd(r)]),e.request(n).then(r=>[e,bd(r)]),er.request(jA(t)).then(r=>[er,bd(r)])])}async function tg(e,t){return C1(e,t).then(([,n])=>n)}async function dy(e,t,n){var a;const r=e.state.serverUrl.endsWith("/")?e.state.serverUrl:`${e.state.serverUrl}/`,o=new URL(t,r),s=(a=(await e.request(o.toString())).link.filter(l=>l.relation==="self"||l.relation==="first"))==null?void 0:a[0];if(s){const l=new URL(s.url,r),u=[...l.searchParams].map(([d])=>{if(d.toLocaleLowerCase().includes("offset"))return{param:d,type:"offset"};if(d.toLocaleLowerCase().includes("page"))return{param:d,type:"page"}}).filter(Boolean)[0];if(u)return l.searchParams.set("_count",n),d=>(u.type==="offset"?l.searchParams.set(u.param,`${n*(d-1)}`):l.searchParams.set(u.param,`${d}`),e.request(l.toString()))}return l=>(o.searchParams.delete("_count"),e.request(o.toString()).then(u=>{var d;return{...u,total:((d=u.entry)==null?void 0:d.length)||0}}))}function RM(){const{user:e}=Go();return p.jsxs("div",{className:"p-6 overflow-auto flex-1",children:[p.jsxs("h1",{className:"mb-4 text-2xl font-bold",children:["Welcome, ",us(e.name)]}),p.jsx("div",{className:"text-muted-foreground",children:e.resourceType==="Patient"?p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{children:"This is a demo patient portal dashboard. Currently, only the questionnaire and questionnaire response functionalities are available."}),p.jsx("p",{children:"In a fully functional version, you could:"}),p.jsxs("ul",{className:"list-disc ml-6",children:[p.jsx("li",{children:"View and manage your upcoming appointments."}),p.jsx("li",{children:"Access your medical records, including lab results, diagnoses, and treatment history."}),p.jsx("li",{children:"Communicate securely with your healthcare providers."}),p.jsx("li",{children:"Maintain and update your personal health information."}),p.jsx("li",{children:"Explore educational resources related to your health conditions and treatments."})]}),p.jsx("p",{children:"For now, you can explore and submit/amend your responses."})]}):p.jsxs("div",{className:"space-y-2",children:[p.jsx("p",{children:"This is a demo practitioner EHR dashboard. Currently, only the questionnaire and questionnaire response functionalities are available."}),p.jsx("p",{children:"In a fully functional version, you could:"}),p.jsxs("ul",{className:"list-disc ml-6",children:[p.jsx("li",{children:"Access and manage patient records."}),p.jsx("li",{children:"Schedule and manage patient appointments."}),p.jsx("li",{children:"Review lab results and other diagnostic information."}),p.jsx("li",{children:"Prescribe medications and generate referrals."}),p.jsx("li",{children:"Communicate with patients and other healthcare professionals."}),p.jsx("li",{children:"Generate reports and analyze data."})]}),p.jsx("p",{children:"For now, you can create and manage questionnaires, and review patient responses."})]})})]})}function EM(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function gc(...e){return t=>e.forEach(n=>EM(n,t))}function Le(...e){return h.useCallback(gc(...e),e)}var un=h.forwardRef((e,t)=>{const{children:n,...r}=e,o=h.Children.toArray(n),i=o.find(PM);if(i){const s=i.props.children,a=o.map(l=>l===i?h.Children.count(s)>1?h.Children.only(null):h.isValidElement(s)?s.props.children:null:l);return p.jsx(fp,{...r,ref:t,children:h.isValidElement(s)?h.cloneElement(s,void 0,a):null})}return p.jsx(fp,{...r,ref:t,children:n})});un.displayName="Slot";var fp=h.forwardRef((e,t)=>{const{children:n,...r}=e;if(h.isValidElement(n)){const o=TM(n);return h.cloneElement(n,{..._M(r,n.props),ref:t?gc(t,o):o})}return h.Children.count(n)>1?h.Children.only(null):null});fp.displayName="SlotClone";var ng=({children:e})=>p.jsx(p.Fragment,{children:e});function PM(e){return h.isValidElement(e)&&e.type===ng}function _M(e,t){const n={...t};for(const r in t){const o=e[r],i=t[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...a)=>{i(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"&&(n[r]=[o,i].filter(Boolean).join(" "))}return{...e,...n}}function TM(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function b1(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;ttypeof e=="boolean"?"".concat(e):e===0?"0":e,py=AM,La=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return py(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:i}=t,s=Object.keys(o).map(u=>{const d=n==null?void 0:n[u],c=i==null?void 0:i[u];if(d===null)return null;const f=fy(d)||fy(c);return o[u][f]}),a=n&&Object.entries(n).reduce((u,d)=>{let[c,f]=d;return f===void 0||(u[c]=f),u},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((u,d)=>{let{class:c,className:f,...m}=d;return Object.entries(m).every(v=>{let[y,x]=v;return Array.isArray(x)?x.includes({...i,...a}[y]):{...i,...a}[y]===x})?[...u,c,f]:u},[]);return py(e,s,l,n==null?void 0:n.class,n==null?void 0:n.className)};/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const _M=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),C1=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/** + */const MM=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),R1=(...e)=>e.filter((t,n,r)=>!!t&&r.indexOf(t)===n).join(" ");/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */var TM={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"};/** + */var kM={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"};/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const AM=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>h.createElement("svg",{ref:l,...TM,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:C1("lucide",o),...a},[...s.map(([u,d])=>h.createElement(u,d)),...Array.isArray(i)?i:[i]]));/** + */const NM=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:i,iconNode:s,...a},l)=>h.createElement("svg",{ref:l,...kM,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:R1("lucide",o),...a},[...s.map(([u,d])=>h.createElement(u,d)),...Array.isArray(i)?i:[i]]));/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const Ve=(e,t)=>{const n=h.forwardRef(({className:r,...o},i)=>h.createElement(AM,{ref:i,iconNode:t,className:C1(`lucide-${_M(e)}`,r),...o}));return n.displayName=`${e}`,n};/** + */const Ve=(e,t)=>{const n=h.forwardRef(({className:r,...o},i)=>h.createElement(NM,{ref:i,iconNode:t,className:R1(`lucide-${MM(e)}`,r),...o}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const MM=Ve("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** + */const jM=Ve("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const b1=Ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** + */const E1=Ve("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const kM=Ve("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** + */const OM=Ve("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const NM=Ve("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** + */const DM=Ve("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const ng=Ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** + */const rg=Ve("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const rg=Ve("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** + */const og=Ve("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const jM=Ve("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const IM=Ve("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const OM=Ve("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/** + */const FM=Ve("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const DM=Ve("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** + */const LM=Ve("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const IM=Ve("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/** + */const $M=Ve("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const FM=Ve("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** + */const UM=Ve("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LM=Ve("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** + */const zM=Ve("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const $M=Ve("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** + */const BM=Ve("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const UM=Ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** + */const VM=Ve("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const zM=Ve("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** + */const HM=Ve("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const BM=Ve("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** + */const KM=Ve("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const VM=Ve("SquareMenu",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** + */const GM=Ve("SquareMenu",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const R1=Ve("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** + */const P1=Ve("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const HM=Ve("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/** + */const WM=Ve("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const KM=Ve("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** + */const qM=Ve("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const GM=Ve("UserPen",[["path",{d:"M11.5 15H7a4 4 0 0 0-4 4v2",key:"15lzij"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}]]);/** + */const QM=Ve("UserPen",[["path",{d:"M11.5 15H7a4 4 0 0 0-4 4v2",key:"15lzij"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const WM=Ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** + */const YM=Ve("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const qM=Ve("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),Rd=768;function QM(){const[e,t]=h.useState(void 0);return h.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Rd-1}px)`),r=()=>{t(window.innerWidthn.removeEventListener("change",r)},[]),!!e}const mc=La("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Tt=h.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?un:"button";return p.jsx(s,{className:G(mc({variant:t,size:n,className:e})),ref:i,...o})});Tt.displayName="Button";const og=h.forwardRef(({className:e,type:t,...n},r)=>p.jsx("input",{type:t,className:G("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));og.displayName="Input";var YM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],he=YM.reduce((e,t)=>{const n=h.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?un:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function ig(e,t){e&&os.flushSync(()=>e.dispatchEvent(t))}var XM="Separator",fy="horizontal",JM=["horizontal","vertical"],E1=h.forwardRef((e,t)=>{const{decorative:n,orientation:r=fy,...o}=e,i=ZM(r)?r:fy,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return p.jsx(he.div,{"data-orientation":i,...a,...o,ref:t})});E1.displayName=XM;function ZM(e){return JM.includes(e)}var P1=E1;const _1=h.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>p.jsx(P1,{ref:o,decorative:n,orientation:t,className:G("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));_1.displayName=P1.displayName;function re(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function ek(e,t){const n=h.createContext(t),r=i=>{const{children:s,...a}=i,l=h.useMemo(()=>a,Object.values(a));return p.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function o(i){const s=h.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function pr(e,t=[]){let n=[];function r(i,s){const a=h.createContext(s),l=n.length;n=[...n,s];const u=c=>{var w;const{scope:f,children:m,...v}=c,y=((w=f==null?void 0:f[e])==null?void 0:w[l])||a,x=h.useMemo(()=>v,Object.values(v));return p.jsx(y.Provider,{value:x,children:m})};u.displayName=i+"Provider";function d(c,f){var y;const m=((y=f==null?void 0:f[e])==null?void 0:y[l])||a,v=h.useContext(m);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${c}\` must be used within \`${i}\``)}return[u,d]}const o=()=>{const i=n.map(s=>h.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,tk(o,...t)]}function tk(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const c=l(i)[`__scope${u}`];return{...a,...c}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var Cn=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},nk=u0.useId||(()=>{}),rk=0;function rr(e){const[t,n]=h.useState(nk());return Cn(()=>{e||n(r=>r??String(rk++))},[e]),e||(t?`radix-${t}`:"")}function mt(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Wo({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=ok({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=mt(n),l=h.useCallback(u=>{if(i){const c=typeof u=="function"?u(e):u;c!==e&&a(c)}else o(u)},[i,e,o,a]);return[s,l]}function ok({defaultProp:e,onChange:t}){const n=h.useState(e),[r]=n,o=h.useRef(r),i=mt(t);return h.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function ik(e,t=globalThis==null?void 0:globalThis.document){const n=mt(e);h.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var sk="DismissableLayer",fp="dismissableLayer.update",ak="dismissableLayer.pointerDownOutside",lk="dismissableLayer.focusOutside",py,T1=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$a=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,u=h.useContext(T1),[d,c]=h.useState(null),f=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=h.useState({}),v=Le(t,M=>c(M)),y=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=y.indexOf(x),g=d?y.indexOf(d):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,C=g>=w,P=ck(M=>{const A=M.target,$=[...u.branches].some(R=>R.contains(A));!C||$||(o==null||o(M),s==null||s(M),M.defaultPrevented||a==null||a())},f),b=dk(M=>{const A=M.target;[...u.branches].some(R=>R.contains(A))||(i==null||i(M),s==null||s(M),M.defaultPrevented||a==null||a())},f);return ik(M=>{g===u.layers.size-1&&(r==null||r(M),!M.defaultPrevented&&a&&(M.preventDefault(),a()))},f),h.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(py=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),hy(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=py)}},[d,f,n,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),hy())},[d,u]),h.useEffect(()=>{const M=()=>m({});return document.addEventListener(fp,M),()=>document.removeEventListener(fp,M)},[]),p.jsx(he.div,{...l,ref:v,style:{pointerEvents:S?C?"auto":"none":void 0,...e.style},onFocusCapture:re(e.onFocusCapture,b.onFocusCapture),onBlurCapture:re(e.onBlurCapture,b.onBlurCapture),onPointerDownCapture:re(e.onPointerDownCapture,P.onPointerDownCapture)})});$a.displayName=sk;var uk="DismissableLayerBranch",A1=h.forwardRef((e,t)=>{const n=h.useContext(T1),r=h.useRef(null),o=Le(t,r);return h.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),p.jsx(he.div,{...e,ref:o})});A1.displayName=uk;function ck(e,t=globalThis==null?void 0:globalThis.document){const n=mt(e),r=h.useRef(!1),o=h.useRef(()=>{});return h.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){M1(ak,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function dk(e,t=globalThis==null?void 0:globalThis.document){const n=mt(e),r=h.useRef(!1);return h.useEffect(()=>{const o=i=>{i.target&&!r.current&&M1(lk,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function hy(){const e=new CustomEvent(fp);document.dispatchEvent(e)}function M1(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ig(o,i):o.dispatchEvent(i)}var fk=$a,pk=A1,Ed="focusScope.autoFocusOnMount",Pd="focusScope.autoFocusOnUnmount",gy={bubbles:!1,cancelable:!0},hk="FocusScope",sg=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,l]=h.useState(null),u=mt(o),d=mt(i),c=h.useRef(null),f=Le(t,y=>l(y)),m=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let y=function(S){if(m.paused||!a)return;const C=S.target;a.contains(C)?c.current=C:br(c.current,{select:!0})},x=function(S){if(m.paused||!a)return;const C=S.relatedTarget;C!==null&&(a.contains(C)||br(c.current,{select:!0}))},w=function(S){if(document.activeElement===document.body)for(const P of S)P.removedNodes.length>0&&br(a)};document.addEventListener("focusin",y),document.addEventListener("focusout",x);const g=new MutationObserver(w);return a&&g.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),g.disconnect()}}},[r,a,m.paused]),h.useEffect(()=>{if(a){vy.add(m);const y=document.activeElement;if(!a.contains(y)){const w=new CustomEvent(Ed,gy);a.addEventListener(Ed,u),a.dispatchEvent(w),w.defaultPrevented||(gk(xk(k1(a)),{select:!0}),document.activeElement===y&&br(a))}return()=>{a.removeEventListener(Ed,u),setTimeout(()=>{const w=new CustomEvent(Pd,gy);a.addEventListener(Pd,d),a.dispatchEvent(w),w.defaultPrevented||br(y??document.body,{select:!0}),a.removeEventListener(Pd,d),vy.remove(m)},0)}}},[a,u,d,m]);const v=h.useCallback(y=>{if(!n&&!r||m.paused)return;const x=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,w=document.activeElement;if(x&&w){const g=y.currentTarget,[S,C]=mk(g);S&&C?!y.shiftKey&&w===C?(y.preventDefault(),n&&br(S,{select:!0})):y.shiftKey&&w===S&&(y.preventDefault(),n&&br(C,{select:!0})):w===g&&y.preventDefault()}},[n,r,m.paused]);return p.jsx(he.div,{tabIndex:-1,...s,ref:f,onKeyDown:v})});sg.displayName=hk;function gk(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(br(r,{select:t}),document.activeElement!==n)return}function mk(e){const t=k1(e),n=my(t,e),r=my(t.reverse(),e);return[n,r]}function k1(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function my(e,t){for(const n of e)if(!vk(n,{upTo:t}))return n}function vk(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function yk(e){return e instanceof HTMLInputElement&&"select"in e}function br(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&yk(e)&&t&&e.select()}}var vy=wk();function wk(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=yy(e,t),e.unshift(t)},remove(t){var n;e=yy(e,t),(n=e[0])==null||n.resume()}}}function yy(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function xk(e){return e.filter(t=>t.tagName!=="A")}var Sk="Portal",Ua=h.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=h.useState(!1);Cn(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?fx.createPortal(p.jsx(he.div,{...r,ref:t}),s):null});Ua.displayName=Sk;function Ck(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var Qt=e=>{const{present:t,children:n}=e,r=bk(t),o=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),i=Le(r.ref,Rk(o));return typeof n=="function"||r.isPresent?h.cloneElement(o,{ref:i}):null};Qt.displayName="Presence";function bk(e){const[t,n]=h.useState(),r=h.useRef({}),o=h.useRef(e),i=h.useRef("none"),s=e?"mounted":"unmounted",[a,l]=Ck(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=Rl(r.current);i.current=a==="mounted"?u:"none"},[a]),Cn(()=>{const u=r.current,d=o.current;if(d!==e){const f=i.current,m=Rl(u);e?l("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&f!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Cn(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,c=m=>{const y=Rl(r.current).includes(m.animationName);if(m.target===t&&y&&(l("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},f=m=>{m.target===t&&(i.current=Rl(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:h.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Rl(e){return(e==null?void 0:e.animationName)||"none"}function Rk(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _d=0;function N1(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??wy()),document.body.insertAdjacentElement("beforeend",e[1]??wy()),_d++,()=>{_d===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),_d--}},[])}function wy(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Fn=function(){return Fn=Object.assign||function(t){for(var n,r=1,o=arguments.length;r"u")return zk;var t=Bk(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Hk=I1(),Pi="data-scroll-locked",Kk=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),` - .`.concat(Pk,` { + */const XM=Ve("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]),Rd=768;function JM(){const[e,t]=h.useState(void 0);return h.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Rd-1}px)`),r=()=>{t(window.innerWidthn.removeEventListener("change",r)},[]),!!e}const mc=La("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Tt=h.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},i)=>{const s=r?un:"button";return p.jsx(s,{className:G(mc({variant:t,size:n,className:e})),ref:i,...o})});Tt.displayName="Button";const ig=h.forwardRef(({className:e,type:t,...n},r)=>p.jsx("input",{type:t,className:G("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));ig.displayName="Input";var ZM=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],he=ZM.reduce((e,t)=>{const n=h.forwardRef((r,o)=>{const{asChild:i,...s}=r,a=i?un:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),p.jsx(a,{...s,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function sg(e,t){e&&os.flushSync(()=>e.dispatchEvent(t))}var ek="Separator",hy="horizontal",tk=["horizontal","vertical"],_1=h.forwardRef((e,t)=>{const{decorative:n,orientation:r=hy,...o}=e,i=nk(r)?r:hy,a=n?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return p.jsx(he.div,{"data-orientation":i,...a,...o,ref:t})});_1.displayName=ek;function nk(e){return tk.includes(e)}var T1=_1;const A1=h.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>p.jsx(T1,{ref:o,decorative:n,orientation:t,className:G("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...r}));A1.displayName=T1.displayName;function re(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function rk(e,t){const n=h.createContext(t),r=i=>{const{children:s,...a}=i,l=h.useMemo(()=>a,Object.values(a));return p.jsx(n.Provider,{value:l,children:s})};r.displayName=e+"Provider";function o(i){const s=h.useContext(n);if(s)return s;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[r,o]}function pr(e,t=[]){let n=[];function r(i,s){const a=h.createContext(s),l=n.length;n=[...n,s];const u=c=>{var w;const{scope:f,children:m,...v}=c,y=((w=f==null?void 0:f[e])==null?void 0:w[l])||a,x=h.useMemo(()=>v,Object.values(v));return p.jsx(y.Provider,{value:x,children:m})};u.displayName=i+"Provider";function d(c,f){var y;const m=((y=f==null?void 0:f[e])==null?void 0:y[l])||a,v=h.useContext(m);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${c}\` must be used within \`${i}\``)}return[u,d]}const o=()=>{const i=n.map(s=>h.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,ok(o,...t)]}function ok(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const c=l(i)[`__scope${u}`];return{...a,...c}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var Cn=globalThis!=null&&globalThis.document?h.useLayoutEffect:()=>{},ik=d0.useId||(()=>{}),sk=0;function rr(e){const[t,n]=h.useState(ik());return Cn(()=>{e||n(r=>r??String(sk++))},[e]),e||(t?`radix-${t}`:"")}function mt(e){const t=h.useRef(e);return h.useEffect(()=>{t.current=e}),h.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function Wo({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=ak({defaultProp:t,onChange:n}),i=e!==void 0,s=i?e:r,a=mt(n),l=h.useCallback(u=>{if(i){const c=typeof u=="function"?u(e):u;c!==e&&a(c)}else o(u)},[i,e,o,a]);return[s,l]}function ak({defaultProp:e,onChange:t}){const n=h.useState(e),[r]=n,o=h.useRef(r),i=mt(t);return h.useEffect(()=>{o.current!==r&&(i(r),o.current=r)},[r,o,i]),n}function lk(e,t=globalThis==null?void 0:globalThis.document){const n=mt(e);h.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var uk="DismissableLayer",pp="dismissableLayer.update",ck="dismissableLayer.pointerDownOutside",dk="dismissableLayer.focusOutside",gy,M1=h.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),$a=h.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:i,onInteractOutside:s,onDismiss:a,...l}=e,u=h.useContext(M1),[d,c]=h.useState(null),f=(d==null?void 0:d.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,m]=h.useState({}),v=Le(t,M=>c(M)),y=Array.from(u.layers),[x]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),w=y.indexOf(x),g=d?y.indexOf(d):-1,S=u.layersWithOutsidePointerEventsDisabled.size>0,C=g>=w,P=pk(M=>{const A=M.target,$=[...u.branches].some(R=>R.contains(A));!C||$||(o==null||o(M),s==null||s(M),M.defaultPrevented||a==null||a())},f),b=hk(M=>{const A=M.target;[...u.branches].some(R=>R.contains(A))||(i==null||i(M),s==null||s(M),M.defaultPrevented||a==null||a())},f);return lk(M=>{g===u.layers.size-1&&(r==null||r(M),!M.defaultPrevented&&a&&(M.preventDefault(),a()))},f),h.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(gy=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),my(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=gy)}},[d,f,n,u]),h.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),my())},[d,u]),h.useEffect(()=>{const M=()=>m({});return document.addEventListener(pp,M),()=>document.removeEventListener(pp,M)},[]),p.jsx(he.div,{...l,ref:v,style:{pointerEvents:S?C?"auto":"none":void 0,...e.style},onFocusCapture:re(e.onFocusCapture,b.onFocusCapture),onBlurCapture:re(e.onBlurCapture,b.onBlurCapture),onPointerDownCapture:re(e.onPointerDownCapture,P.onPointerDownCapture)})});$a.displayName=uk;var fk="DismissableLayerBranch",k1=h.forwardRef((e,t)=>{const n=h.useContext(M1),r=h.useRef(null),o=Le(t,r);return h.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),p.jsx(he.div,{...e,ref:o})});k1.displayName=fk;function pk(e,t=globalThis==null?void 0:globalThis.document){const n=mt(e),r=h.useRef(!1),o=h.useRef(()=>{});return h.useEffect(()=>{const i=a=>{if(a.target&&!r.current){let l=function(){N1(ck,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(s),t.removeEventListener("pointerdown",i),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function hk(e,t=globalThis==null?void 0:globalThis.document){const n=mt(e),r=h.useRef(!1);return h.useEffect(()=>{const o=i=>{i.target&&!r.current&&N1(dk,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function my(){const e=new CustomEvent(pp);document.dispatchEvent(e)}function N1(e,t,n,{discrete:r}){const o=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?sg(o,i):o.dispatchEvent(i)}var gk=$a,mk=k1,Ed="focusScope.autoFocusOnMount",Pd="focusScope.autoFocusOnUnmount",vy={bubbles:!1,cancelable:!0},vk="FocusScope",ag=h.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:i,...s}=e,[a,l]=h.useState(null),u=mt(o),d=mt(i),c=h.useRef(null),f=Le(t,y=>l(y)),m=h.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;h.useEffect(()=>{if(r){let y=function(S){if(m.paused||!a)return;const C=S.target;a.contains(C)?c.current=C:br(c.current,{select:!0})},x=function(S){if(m.paused||!a)return;const C=S.relatedTarget;C!==null&&(a.contains(C)||br(c.current,{select:!0}))},w=function(S){if(document.activeElement===document.body)for(const P of S)P.removedNodes.length>0&&br(a)};document.addEventListener("focusin",y),document.addEventListener("focusout",x);const g=new MutationObserver(w);return a&&g.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",y),document.removeEventListener("focusout",x),g.disconnect()}}},[r,a,m.paused]),h.useEffect(()=>{if(a){wy.add(m);const y=document.activeElement;if(!a.contains(y)){const w=new CustomEvent(Ed,vy);a.addEventListener(Ed,u),a.dispatchEvent(w),w.defaultPrevented||(yk(bk(j1(a)),{select:!0}),document.activeElement===y&&br(a))}return()=>{a.removeEventListener(Ed,u),setTimeout(()=>{const w=new CustomEvent(Pd,vy);a.addEventListener(Pd,d),a.dispatchEvent(w),w.defaultPrevented||br(y??document.body,{select:!0}),a.removeEventListener(Pd,d),wy.remove(m)},0)}}},[a,u,d,m]);const v=h.useCallback(y=>{if(!n&&!r||m.paused)return;const x=y.key==="Tab"&&!y.altKey&&!y.ctrlKey&&!y.metaKey,w=document.activeElement;if(x&&w){const g=y.currentTarget,[S,C]=wk(g);S&&C?!y.shiftKey&&w===C?(y.preventDefault(),n&&br(S,{select:!0})):y.shiftKey&&w===S&&(y.preventDefault(),n&&br(C,{select:!0})):w===g&&y.preventDefault()}},[n,r,m.paused]);return p.jsx(he.div,{tabIndex:-1,...s,ref:f,onKeyDown:v})});ag.displayName=vk;function yk(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(br(r,{select:t}),document.activeElement!==n)return}function wk(e){const t=j1(e),n=yy(t,e),r=yy(t.reverse(),e);return[n,r]}function j1(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function yy(e,t){for(const n of e)if(!xk(n,{upTo:t}))return n}function xk(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Sk(e){return e instanceof HTMLInputElement&&"select"in e}function br(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Sk(e)&&t&&e.select()}}var wy=Ck();function Ck(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=xy(e,t),e.unshift(t)},remove(t){var n;e=xy(e,t),(n=e[0])==null||n.resume()}}}function xy(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function bk(e){return e.filter(t=>t.tagName!=="A")}var Rk="Portal",Ua=h.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,i]=h.useState(!1);Cn(()=>i(!0),[]);const s=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return s?hx.createPortal(p.jsx(he.div,{...r,ref:t}),s):null});Ua.displayName=Rk;function Ek(e,t){return h.useReducer((n,r)=>t[n][r]??n,e)}var Qt=e=>{const{present:t,children:n}=e,r=Pk(t),o=typeof n=="function"?n({present:r.isPresent}):h.Children.only(n),i=Le(r.ref,_k(o));return typeof n=="function"||r.isPresent?h.cloneElement(o,{ref:i}):null};Qt.displayName="Presence";function Pk(e){const[t,n]=h.useState(),r=h.useRef({}),o=h.useRef(e),i=h.useRef("none"),s=e?"mounted":"unmounted",[a,l]=Ek(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return h.useEffect(()=>{const u=Rl(r.current);i.current=a==="mounted"?u:"none"},[a]),Cn(()=>{const u=r.current,d=o.current;if(d!==e){const f=i.current,m=Rl(u);e?l("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&f!==m?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,l]),Cn(()=>{if(t){let u;const d=t.ownerDocument.defaultView??window,c=m=>{const y=Rl(r.current).includes(m.animationName);if(m.target===t&&y&&(l("ANIMATION_END"),!o.current)){const x=t.style.animationFillMode;t.style.animationFillMode="forwards",u=d.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=x)})}},f=m=>{m.target===t&&(i.current=Rl(r.current))};return t.addEventListener("animationstart",f),t.addEventListener("animationcancel",c),t.addEventListener("animationend",c),()=>{d.clearTimeout(u),t.removeEventListener("animationstart",f),t.removeEventListener("animationcancel",c),t.removeEventListener("animationend",c)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:h.useCallback(u=>{u&&(r.current=getComputedStyle(u)),n(u)},[])}}function Rl(e){return(e==null?void 0:e.animationName)||"none"}function _k(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var _d=0;function O1(){h.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Sy()),document.body.insertAdjacentElement("beforeend",e[1]??Sy()),_d++,()=>{_d===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),_d--}},[])}function Sy(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Fn=function(){return Fn=Object.assign||function(t){for(var n,r=1,o=arguments.length;r"u")return Hk;var t=Kk(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Wk=L1(),Pi="data-scroll-locked",qk=function(e,t,n,r){var o=e.left,i=e.top,s=e.right,a=e.gap;return n===void 0&&(n="margin"),` + .`.concat(Ak,` { overflow: hidden `).concat(r,`; padding-right: `).concat(a,"px ").concat(r,`; } @@ -248,16 +248,16 @@ This app cannot be accessed directly. Please launch it as SMART app!`,c):c}).cat } body[`).concat(Pi,`] { - `).concat(_k,": ").concat(a,`px; + `).concat(Mk,": ").concat(a,`px; } -`)},Sy=function(){var e=parseInt(document.body.getAttribute(Pi)||"0",10);return isFinite(e)?e:0},Gk=function(){h.useEffect(function(){return document.body.setAttribute(Pi,(Sy()+1).toString()),function(){var e=Sy()-1;e<=0?document.body.removeAttribute(Pi):document.body.setAttribute(Pi,e.toString())}},[])},Wk=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Gk();var i=h.useMemo(function(){return Vk(o)},[o]);return h.createElement(Hk,{styles:Kk(i,!t,o,n?"":"!important")})},pp=!1;if(typeof window<"u")try{var El=Object.defineProperty({},"passive",{get:function(){return pp=!0,!0}});window.addEventListener("test",El,El),window.removeEventListener("test",El,El)}catch{pp=!1}var ni=pp?{passive:!1}:!1,qk=function(e){return e.tagName==="TEXTAREA"},F1=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!qk(e)&&n[t]==="visible")},Qk=function(e){return F1(e,"overflowY")},Yk=function(e){return F1(e,"overflowX")},Cy=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=L1(e,r);if(o){var i=$1(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Xk=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},Jk=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},L1=function(e,t){return e==="v"?Qk(t):Yk(t)},$1=function(e,t){return e==="v"?Xk(t):Jk(t)},Zk=function(e,t){return e==="h"&&t==="rtl"?-1:1},eN=function(e,t,n,r,o){var i=Zk(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,l=t.contains(a),u=!1,d=s>0,c=0,f=0;do{var m=$1(e,a),v=m[0],y=m[1],x=m[2],w=y-x-i*v;(v||w)&&L1(e,a)&&(c+=w,f+=v),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(d&&(Math.abs(c)<1||!o)||!d&&(Math.abs(f)<1||!o))&&(u=!0),u},Pl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},by=function(e){return[e.deltaX,e.deltaY]},Ry=function(e){return e&&"current"in e?e.current:e},tN=function(e,t){return e[0]===t[0]&&e[1]===t[1]},nN=function(e){return` +`)},by=function(){var e=parseInt(document.body.getAttribute(Pi)||"0",10);return isFinite(e)?e:0},Qk=function(){h.useEffect(function(){return document.body.setAttribute(Pi,(by()+1).toString()),function(){var e=by()-1;e<=0?document.body.removeAttribute(Pi):document.body.setAttribute(Pi,e.toString())}},[])},Yk=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Qk();var i=h.useMemo(function(){return Gk(o)},[o]);return h.createElement(Wk,{styles:qk(i,!t,o,n?"":"!important")})},hp=!1;if(typeof window<"u")try{var El=Object.defineProperty({},"passive",{get:function(){return hp=!0,!0}});window.addEventListener("test",El,El),window.removeEventListener("test",El,El)}catch{hp=!1}var ni=hp?{passive:!1}:!1,Xk=function(e){return e.tagName==="TEXTAREA"},$1=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Xk(e)&&n[t]==="visible")},Jk=function(e){return $1(e,"overflowY")},Zk=function(e){return $1(e,"overflowX")},Ry=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=U1(e,r);if(o){var i=z1(e,r),s=i[1],a=i[2];if(s>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},eN=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},tN=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},U1=function(e,t){return e==="v"?Jk(t):Zk(t)},z1=function(e,t){return e==="v"?eN(t):tN(t)},nN=function(e,t){return e==="h"&&t==="rtl"?-1:1},rN=function(e,t,n,r,o){var i=nN(e,window.getComputedStyle(t).direction),s=i*r,a=n.target,l=t.contains(a),u=!1,d=s>0,c=0,f=0;do{var m=z1(e,a),v=m[0],y=m[1],x=m[2],w=y-x-i*v;(v||w)&&U1(e,a)&&(c+=w,f+=v),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(d&&(Math.abs(c)<1||!o)||!d&&(Math.abs(f)<1||!o))&&(u=!0),u},Pl=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ey=function(e){return[e.deltaX,e.deltaY]},Py=function(e){return e&&"current"in e?e.current:e},oN=function(e,t){return e[0]===t[0]&&e[1]===t[1]},iN=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},rN=0,ri=[];function oN(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),o=h.useState(rN++)[0],i=h.useState(I1)[0],s=h.useRef(e);h.useEffect(function(){s.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var y=Ek([e.lockRef.current],(e.shards||[]).map(Ry),!0).filter(Boolean);return y.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),y.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=h.useCallback(function(y,x){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!s.current.allowPinchZoom;var w=Pl(y),g=n.current,S="deltaX"in y?y.deltaX:g[0]-w[0],C="deltaY"in y?y.deltaY:g[1]-w[1],P,b=y.target,M=Math.abs(S)>Math.abs(C)?"h":"v";if("touches"in y&&M==="h"&&b.type==="range")return!1;var A=Cy(M,b);if(!A)return!0;if(A?P=M:(P=M==="v"?"h":"v",A=Cy(M,b)),!A)return!1;if(!r.current&&"changedTouches"in y&&(S||C)&&(r.current=P),!P)return!0;var $=r.current||P;return eN($,x,y,$==="h"?S:C,!0)},[]),l=h.useCallback(function(y){var x=y;if(!(!ri.length||ri[ri.length-1]!==i)){var w="deltaY"in x?by(x):Pl(x),g=t.current.filter(function(P){return P.name===x.type&&(P.target===x.target||x.target===P.shadowParent)&&tN(P.delta,w)})[0];if(g&&g.should){x.cancelable&&x.preventDefault();return}if(!g){var S=(s.current.shards||[]).map(Ry).filter(Boolean).filter(function(P){return P.contains(x.target)}),C=S.length>0?a(x,S[0]):!s.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),u=h.useCallback(function(y,x,w,g){var S={name:y,delta:x,target:w,should:g,shadowParent:iN(w)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(C){return C!==S})},1)},[]),d=h.useCallback(function(y){n.current=Pl(y),r.current=void 0},[]),c=h.useCallback(function(y){u(y.type,by(y),y.target,a(y,e.lockRef.current))},[]),f=h.useCallback(function(y){u(y.type,Pl(y),y.target,a(y,e.lockRef.current))},[]);h.useEffect(function(){return ri.push(i),e.setCallbacks({onScrollCapture:c,onWheelCapture:c,onTouchMoveCapture:f}),document.addEventListener("wheel",l,ni),document.addEventListener("touchmove",l,ni),document.addEventListener("touchstart",d,ni),function(){ri=ri.filter(function(y){return y!==i}),document.removeEventListener("wheel",l,ni),document.removeEventListener("touchmove",l,ni),document.removeEventListener("touchstart",d,ni)}},[]);var m=e.removeScrollBar,v=e.inert;return h.createElement(h.Fragment,null,v?h.createElement(i,{styles:nN(o)}):null,m?h.createElement(Wk,{gapMode:e.gapMode}):null)}function iN(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const sN=Ok(D1,oN);var ag=h.forwardRef(function(e,t){return h.createElement(vc,Fn({},e,{ref:t,sideCar:sN}))});ag.classNames=vc.classNames;var aN=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},oi=new WeakMap,_l=new WeakMap,Tl={},kd=0,U1=function(e){return e&&(e.host||U1(e.parentNode))},lN=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=U1(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},uN=function(e,t,n,r){var o=lN(t,Array.isArray(e)?e:[e]);Tl[n]||(Tl[n]=new WeakMap);var i=Tl[n],s=[],a=new Set,l=new Set(o),u=function(c){!c||a.has(c)||(a.add(c),u(c.parentNode))};o.forEach(u);var d=function(c){!c||l.has(c)||Array.prototype.forEach.call(c.children,function(f){if(a.has(f))d(f);else try{var m=f.getAttribute(r),v=m!==null&&m!=="false",y=(oi.get(f)||0)+1,x=(i.get(f)||0)+1;oi.set(f,y),i.set(f,x),s.push(f),y===1&&v&&_l.set(f,!0),x===1&&f.setAttribute(n,"true"),v||f.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",f,w)}})};return d(t),a.clear(),kd++,function(){s.forEach(function(c){var f=oi.get(c)-1,m=i.get(c)-1;oi.set(c,f),i.set(c,m),f||(_l.has(c)||c.removeAttribute(r),_l.delete(c)),m||c.removeAttribute(n)}),kd--,kd||(oi=new WeakMap,oi=new WeakMap,_l=new WeakMap,Tl={})}},z1=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=aN(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),uN(r,o,n,"aria-hidden")):function(){return null}},lg="Dialog",[B1,V1]=pr(lg),[cN,En]=B1(lg),H1=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=h.useRef(null),l=h.useRef(null),[u=!1,d]=Wo({prop:r,defaultProp:o,onChange:i});return p.jsx(cN,{scope:t,triggerRef:a,contentRef:l,contentId:rr(),titleId:rr(),descriptionId:rr(),open:u,onOpenChange:d,onOpenToggle:h.useCallback(()=>d(c=>!c),[d]),modal:s,children:n})};H1.displayName=lg;var K1="DialogTrigger",G1=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(K1,n),i=Le(t,o.triggerRef);return p.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":dg(o.open),...r,ref:i,onClick:re(e.onClick,o.onOpenToggle)})});G1.displayName=K1;var ug="DialogPortal",[dN,W1]=B1(ug,{forceMount:void 0}),q1=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=En(ug,t);return p.jsx(dN,{scope:t,forceMount:n,children:h.Children.map(r,s=>p.jsx(Qt,{present:n||i.open,children:p.jsx(Ua,{asChild:!0,container:o,children:s})}))})};q1.displayName=ug;var Fu="DialogOverlay",Q1=h.forwardRef((e,t)=>{const n=W1(Fu,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=En(Fu,e.__scopeDialog);return i.modal?p.jsx(Qt,{present:r||i.open,children:p.jsx(fN,{...o,ref:t})}):null});Q1.displayName=Fu;var fN=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(Fu,n);return p.jsx(ag,{as:un,allowPinchZoom:!0,shards:[o.contentRef],children:p.jsx(he.div,{"data-state":dg(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),$o="DialogContent",Y1=h.forwardRef((e,t)=>{const n=W1($o,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=En($o,e.__scopeDialog);return p.jsx(Qt,{present:r||i.open,children:i.modal?p.jsx(pN,{...o,ref:t}):p.jsx(hN,{...o,ref:t})})});Y1.displayName=$o;var pN=h.forwardRef((e,t)=>{const n=En($o,e.__scopeDialog),r=h.useRef(null),o=Le(t,n.contentRef,r);return h.useEffect(()=>{const i=r.current;if(i)return z1(i)},[]),p.jsx(X1,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:re(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:re(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:re(e.onFocusOutside,i=>i.preventDefault())})}),hN=h.forwardRef((e,t)=>{const n=En($o,e.__scopeDialog),r=h.useRef(!1),o=h.useRef(!1);return p.jsx(X1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),X1=h.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=En($o,n),l=h.useRef(null),u=Le(t,l);return N1(),p.jsxs(p.Fragment,{children:[p.jsx(sg,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:p.jsx($a,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":dg(a.open),...s,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(mN,{titleId:a.titleId}),p.jsx(yN,{contentRef:l,descriptionId:a.descriptionId})]})]})}),cg="DialogTitle",J1=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(cg,n);return p.jsx(he.h2,{id:o.titleId,...r,ref:t})});J1.displayName=cg;var Z1="DialogDescription",eS=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(Z1,n);return p.jsx(he.p,{id:o.descriptionId,...r,ref:t})});eS.displayName=Z1;var tS="DialogClose",nS=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(tS,n);return p.jsx(he.button,{type:"button",...r,ref:t,onClick:re(e.onClick,()=>o.onOpenChange(!1))})});nS.displayName=tS;function dg(e){return e?"open":"closed"}var rS="DialogTitleWarning",[gN,oS]=ek(rS,{contentName:$o,titleName:cg,docsSlug:"dialog"}),mN=({titleId:e})=>{const t=oS(rS),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. +`)},sN=0,ri=[];function aN(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),o=h.useState(sN++)[0],i=h.useState(L1)[0],s=h.useRef(e);h.useEffect(function(){s.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var y=Tk([e.lockRef.current],(e.shards||[]).map(Py),!0).filter(Boolean);return y.forEach(function(x){return x.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),y.forEach(function(x){return x.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=h.useCallback(function(y,x){if("touches"in y&&y.touches.length===2||y.type==="wheel"&&y.ctrlKey)return!s.current.allowPinchZoom;var w=Pl(y),g=n.current,S="deltaX"in y?y.deltaX:g[0]-w[0],C="deltaY"in y?y.deltaY:g[1]-w[1],P,b=y.target,M=Math.abs(S)>Math.abs(C)?"h":"v";if("touches"in y&&M==="h"&&b.type==="range")return!1;var A=Ry(M,b);if(!A)return!0;if(A?P=M:(P=M==="v"?"h":"v",A=Ry(M,b)),!A)return!1;if(!r.current&&"changedTouches"in y&&(S||C)&&(r.current=P),!P)return!0;var $=r.current||P;return rN($,x,y,$==="h"?S:C,!0)},[]),l=h.useCallback(function(y){var x=y;if(!(!ri.length||ri[ri.length-1]!==i)){var w="deltaY"in x?Ey(x):Pl(x),g=t.current.filter(function(P){return P.name===x.type&&(P.target===x.target||x.target===P.shadowParent)&&oN(P.delta,w)})[0];if(g&&g.should){x.cancelable&&x.preventDefault();return}if(!g){var S=(s.current.shards||[]).map(Py).filter(Boolean).filter(function(P){return P.contains(x.target)}),C=S.length>0?a(x,S[0]):!s.current.noIsolation;C&&x.cancelable&&x.preventDefault()}}},[]),u=h.useCallback(function(y,x,w,g){var S={name:y,delta:x,target:w,should:g,shadowParent:lN(w)};t.current.push(S),setTimeout(function(){t.current=t.current.filter(function(C){return C!==S})},1)},[]),d=h.useCallback(function(y){n.current=Pl(y),r.current=void 0},[]),c=h.useCallback(function(y){u(y.type,Ey(y),y.target,a(y,e.lockRef.current))},[]),f=h.useCallback(function(y){u(y.type,Pl(y),y.target,a(y,e.lockRef.current))},[]);h.useEffect(function(){return ri.push(i),e.setCallbacks({onScrollCapture:c,onWheelCapture:c,onTouchMoveCapture:f}),document.addEventListener("wheel",l,ni),document.addEventListener("touchmove",l,ni),document.addEventListener("touchstart",d,ni),function(){ri=ri.filter(function(y){return y!==i}),document.removeEventListener("wheel",l,ni),document.removeEventListener("touchmove",l,ni),document.removeEventListener("touchstart",d,ni)}},[]);var m=e.removeScrollBar,v=e.inert;return h.createElement(h.Fragment,null,v?h.createElement(i,{styles:iN(o)}):null,m?h.createElement(Yk,{gapMode:e.gapMode}):null)}function lN(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const uN=Fk(F1,aN);var lg=h.forwardRef(function(e,t){return h.createElement(vc,Fn({},e,{ref:t,sideCar:uN}))});lg.classNames=vc.classNames;var cN=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},oi=new WeakMap,_l=new WeakMap,Tl={},kd=0,B1=function(e){return e&&(e.host||B1(e.parentNode))},dN=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=B1(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},fN=function(e,t,n,r){var o=dN(t,Array.isArray(e)?e:[e]);Tl[n]||(Tl[n]=new WeakMap);var i=Tl[n],s=[],a=new Set,l=new Set(o),u=function(c){!c||a.has(c)||(a.add(c),u(c.parentNode))};o.forEach(u);var d=function(c){!c||l.has(c)||Array.prototype.forEach.call(c.children,function(f){if(a.has(f))d(f);else try{var m=f.getAttribute(r),v=m!==null&&m!=="false",y=(oi.get(f)||0)+1,x=(i.get(f)||0)+1;oi.set(f,y),i.set(f,x),s.push(f),y===1&&v&&_l.set(f,!0),x===1&&f.setAttribute(n,"true"),v||f.setAttribute(r,"true")}catch(w){console.error("aria-hidden: cannot operate on ",f,w)}})};return d(t),a.clear(),kd++,function(){s.forEach(function(c){var f=oi.get(c)-1,m=i.get(c)-1;oi.set(c,f),i.set(c,m),f||(_l.has(c)||c.removeAttribute(r),_l.delete(c)),m||c.removeAttribute(n)}),kd--,kd||(oi=new WeakMap,oi=new WeakMap,_l=new WeakMap,Tl={})}},V1=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=cN(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),fN(r,o,n,"aria-hidden")):function(){return null}},ug="Dialog",[H1,K1]=pr(ug),[pN,En]=H1(ug),G1=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=e,a=h.useRef(null),l=h.useRef(null),[u=!1,d]=Wo({prop:r,defaultProp:o,onChange:i});return p.jsx(pN,{scope:t,triggerRef:a,contentRef:l,contentId:rr(),titleId:rr(),descriptionId:rr(),open:u,onOpenChange:d,onOpenToggle:h.useCallback(()=>d(c=>!c),[d]),modal:s,children:n})};G1.displayName=ug;var W1="DialogTrigger",q1=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(W1,n),i=Le(t,o.triggerRef);return p.jsx(he.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":fg(o.open),...r,ref:i,onClick:re(e.onClick,o.onOpenToggle)})});q1.displayName=W1;var cg="DialogPortal",[hN,Q1]=H1(cg,{forceMount:void 0}),Y1=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,i=En(cg,t);return p.jsx(hN,{scope:t,forceMount:n,children:h.Children.map(r,s=>p.jsx(Qt,{present:n||i.open,children:p.jsx(Ua,{asChild:!0,container:o,children:s})}))})};Y1.displayName=cg;var Fu="DialogOverlay",X1=h.forwardRef((e,t)=>{const n=Q1(Fu,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=En(Fu,e.__scopeDialog);return i.modal?p.jsx(Qt,{present:r||i.open,children:p.jsx(gN,{...o,ref:t})}):null});X1.displayName=Fu;var gN=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(Fu,n);return p.jsx(lg,{as:un,allowPinchZoom:!0,shards:[o.contentRef],children:p.jsx(he.div,{"data-state":fg(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),$o="DialogContent",J1=h.forwardRef((e,t)=>{const n=Q1($o,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,i=En($o,e.__scopeDialog);return p.jsx(Qt,{present:r||i.open,children:i.modal?p.jsx(mN,{...o,ref:t}):p.jsx(vN,{...o,ref:t})})});J1.displayName=$o;var mN=h.forwardRef((e,t)=>{const n=En($o,e.__scopeDialog),r=h.useRef(null),o=Le(t,n.contentRef,r);return h.useEffect(()=>{const i=r.current;if(i)return V1(i)},[]),p.jsx(Z1,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:re(e.onCloseAutoFocus,i=>{var s;i.preventDefault(),(s=n.triggerRef.current)==null||s.focus()}),onPointerDownOutside:re(e.onPointerDownOutside,i=>{const s=i.detail.originalEvent,a=s.button===0&&s.ctrlKey===!0;(s.button===2||a)&&i.preventDefault()}),onFocusOutside:re(e.onFocusOutside,i=>i.preventDefault())})}),vN=h.forwardRef((e,t)=>{const n=En($o,e.__scopeDialog),r=h.useRef(!1),o=h.useRef(!1);return p.jsx(Z1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var s,a;(s=e.onCloseAutoFocus)==null||s.call(e,i),i.defaultPrevented||(r.current||(a=n.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:i=>{var l,u;(l=e.onInteractOutside)==null||l.call(e,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const s=i.target;((u=n.triggerRef.current)==null?void 0:u.contains(s))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&o.current&&i.preventDefault()}})}),Z1=h.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:i,...s}=e,a=En($o,n),l=h.useRef(null),u=Le(t,l);return O1(),p.jsxs(p.Fragment,{children:[p.jsx(ag,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:i,children:p.jsx($a,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":fg(a.open),...s,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),p.jsxs(p.Fragment,{children:[p.jsx(wN,{titleId:a.titleId}),p.jsx(SN,{contentRef:l,descriptionId:a.descriptionId})]})]})}),dg="DialogTitle",eS=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(dg,n);return p.jsx(he.h2,{id:o.titleId,...r,ref:t})});eS.displayName=dg;var tS="DialogDescription",nS=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(tS,n);return p.jsx(he.p,{id:o.descriptionId,...r,ref:t})});nS.displayName=tS;var rS="DialogClose",oS=h.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=En(rS,n);return p.jsx(he.button,{type:"button",...r,ref:t,onClick:re(e.onClick,()=>o.onOpenChange(!1))})});oS.displayName=rS;function fg(e){return e?"open":"closed"}var iS="DialogTitleWarning",[yN,sS]=rk(iS,{contentName:$o,titleName:dg,docsSlug:"dialog"}),wN=({titleId:e})=>{const t=sS(iS),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},vN="DialogDescriptionWarning",yN=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${oS(vN).contentName}}.`;return h.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},fg=H1,wN=G1,pg=q1,za=Q1,Ba=Y1,Va=J1,Ha=eS,yc=nS;function cs(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}var xN=["color"],SN=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=cs(e,xN);return h.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),h.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),CN=["color"],bN=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=cs(e,CN);return h.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),h.createElement("path",{d:"M8.84182 3.13514C9.04327 3.32401 9.05348 3.64042 8.86462 3.84188L5.43521 7.49991L8.86462 11.1579C9.05348 11.3594 9.04327 11.6758 8.84182 11.8647C8.64036 12.0535 8.32394 12.0433 8.13508 11.8419L4.38508 7.84188C4.20477 7.64955 4.20477 7.35027 4.38508 7.15794L8.13508 3.15794C8.32394 2.95648 8.64036 2.94628 8.84182 3.13514Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),RN=["color"],iS=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=cs(e,RN);return h.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),h.createElement("path",{d:"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),EN=["color"],hg=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=cs(e,EN);return h.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),h.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),PN=["color"],_N=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=cs(e,PN);return h.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),h.createElement("path",{d:"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",fill:r}))}),TN=["color"],AN=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=cs(e,TN);return h.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),h.createElement("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const MN=fg,kN=pg,sS=h.forwardRef(({className:e,...t},n)=>p.jsx(za,{className:G("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));sS.displayName=za.displayName;const NN=La("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),aS=h.forwardRef(({side:e="right",className:t,children:n,...r},o)=>p.jsxs(kN,{children:[p.jsx(sS,{}),p.jsxs(Ba,{ref:o,className:G(NN({side:e}),t),...r,children:[p.jsxs(yc,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[p.jsx(hg,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]}),n]})]}));aS.displayName=Ba.displayName;const jN=h.forwardRef(({className:e,...t},n)=>p.jsx(Va,{ref:n,className:G("text-lg font-semibold text-foreground",e),...t}));jN.displayName=Va.displayName;const ON=h.forwardRef(({className:e,...t},n)=>p.jsx(Ha,{ref:n,className:G("text-sm text-muted-foreground",e),...t}));ON.displayName=Ha.displayName;function Ey({className:e,...t}){return p.jsx("div",{className:G("animate-pulse rounded-md bg-primary/10",e),...t})}const DN=["top","right","bottom","left"],Zr=Math.min,Ut=Math.max,Lu=Math.round,Al=Math.floor,eo=e=>({x:e,y:e}),IN={left:"right",right:"left",bottom:"top",top:"bottom"},FN={start:"end",end:"start"};function hp(e,t,n){return Ut(e,Zr(t,n))}function ur(e,t){return typeof e=="function"?e(t):e}function cr(e){return e.split("-")[0]}function ds(e){return e.split("-")[1]}function gg(e){return e==="x"?"y":"x"}function mg(e){return e==="y"?"height":"width"}function to(e){return["top","bottom"].includes(cr(e))?"y":"x"}function vg(e){return gg(to(e))}function LN(e,t,n){n===void 0&&(n=!1);const r=ds(e),o=vg(e),i=mg(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=$u(s)),[s,$u(s)]}function $N(e){const t=$u(e);return[gp(e),t,gp(t)]}function gp(e){return e.replace(/start|end/g,t=>FN[t])}function UN(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function zN(e,t,n,r){const o=ds(e);let i=UN(cr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(gp)))),i}function $u(e){return e.replace(/left|right|bottom|top/g,t=>IN[t])}function BN(e){return{top:0,right:0,bottom:0,left:0,...e}}function lS(e){return typeof e!="number"?BN(e):{top:e,right:e,bottom:e,left:e}}function Uu(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Py(e,t,n){let{reference:r,floating:o}=e;const i=to(t),s=vg(t),a=mg(s),l=cr(t),u=i==="y",d=r.x+r.width/2-o.width/2,c=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let m;switch(l){case"top":m={x:d,y:r.y-o.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:c};break;case"left":m={x:r.x-o.width,y:c};break;default:m={x:r.x,y:r.y}}switch(ds(t)){case"start":m[s]-=f*(n&&u?-1:1);break;case"end":m[s]+=f*(n&&u?-1:1);break}return m}const VN=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:c}=Py(u,r,l),f=r,m={},v=0;for(let y=0;y({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:u,padding:d=0}=ur(e,t)||{};if(u==null)return{};const c=lS(d),f={x:n,y:r},m=vg(o),v=mg(m),y=await s.getDimensions(u),x=m==="y",w=x?"top":"left",g=x?"bottom":"right",S=x?"clientHeight":"clientWidth",C=i.reference[v]+i.reference[m]-f[m]-i.floating[v],P=f[m]-i.reference[m],b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let M=b?b[S]:0;(!M||!await(s.isElement==null?void 0:s.isElement(b)))&&(M=a.floating[S]||i.floating[v]);const A=C/2-P/2,$=M/2-y[v]/2-1,R=Zr(c[w],$),O=Zr(c[g],$),F=R,N=M-y[v]-O,E=M/2-y[v]/2+A,T=hp(F,E,N),D=!l.arrow&&ds(o)!=null&&E!==T&&i.reference[v]/2-(EE<=0)){var O,F;const E=(((O=i.flip)==null?void 0:O.index)||0)+1,T=M[E];if(T)return{data:{index:E,overflows:R},reset:{placement:T}};let D=(F=R.filter(V=>V.overflows[0]<=0).sort((V,L)=>V.overflows[1]-L.overflows[1])[0])==null?void 0:F.placement;if(!D)switch(m){case"bestFit":{var N;const V=(N=R.filter(L=>{if(b){const j=to(L.placement);return j===g||j==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(j=>j>0).reduce((j,B)=>j+B,0)]).sort((L,j)=>L[1]-j[1])[0])==null?void 0:N[0];V&&(D=V);break}case"initialPlacement":D=a;break}if(o!==D)return{reset:{placement:D}}}return{}}}};function _y(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ty(e){return DN.some(t=>e[t]>=0)}const GN=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ur(e,t);switch(r){case"referenceHidden":{const i=await Sa(t,{...o,elementContext:"reference"}),s=_y(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:Ty(s)}}}case"escaped":{const i=await Sa(t,{...o,altBoundary:!0}),s=_y(i,n.floating);return{data:{escapedOffsets:s,escaped:Ty(s)}}}default:return{}}}}};async function WN(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=cr(n),a=ds(n),l=to(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&l?-1:1,c=ur(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:v}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return a&&typeof v=="number"&&(m=a==="end"?v*-1:v),l?{x:m*d,y:f*u}:{x:f*u,y:m*d}}const qN=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await WN(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},QN=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:w,y:g}=x;return{x:w,y:g}}},...l}=ur(e,t),u={x:n,y:r},d=await Sa(t,l),c=to(cr(o)),f=gg(c);let m=u[f],v=u[c];if(i){const x=f==="y"?"top":"left",w=f==="y"?"bottom":"right",g=m+d[x],S=m-d[w];m=hp(g,m,S)}if(s){const x=c==="y"?"top":"left",w=c==="y"?"bottom":"right",g=v+d[x],S=v-d[w];v=hp(g,v,S)}const y=a.fn({...t,[f]:m,[c]:v});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[f]:i,[c]:s}}}}}},YN=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=ur(e,t),d={x:n,y:r},c=to(o),f=gg(c);let m=d[f],v=d[c];const y=ur(a,t),x=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(l){const S=f==="y"?"height":"width",C=i.reference[f]-i.floating[S]+x.mainAxis,P=i.reference[f]+i.reference[S]-x.mainAxis;mP&&(m=P)}if(u){var w,g;const S=f==="y"?"width":"height",C=["top","left"].includes(cr(o)),P=i.reference[c]-i.floating[S]+(C&&((w=s.offset)==null?void 0:w[c])||0)+(C?0:x.crossAxis),b=i.reference[c]+i.reference[S]+(C?0:((g=s.offset)==null?void 0:g[c])||0)-(C?x.crossAxis:0);vb&&(v=b)}return{[f]:m,[c]:v}}}},XN=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...u}=ur(e,t),d=await Sa(t,u),c=cr(o),f=ds(o),m=to(o)==="y",{width:v,height:y}=i.floating;let x,w;c==="top"||c==="bottom"?(x=c,w=f===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(w=c,x=f==="end"?"top":"bottom");const g=y-d.top-d.bottom,S=v-d.left-d.right,C=Zr(y-d[x],g),P=Zr(v-d[w],S),b=!t.middlewareData.shift;let M=C,A=P;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(M=g),b&&!f){const R=Ut(d.left,0),O=Ut(d.right,0),F=Ut(d.top,0),N=Ut(d.bottom,0);m?A=v-2*(R!==0||O!==0?R+O:Ut(d.left,d.right)):M=y-2*(F!==0||N!==0?F+N:Ut(d.top,d.bottom))}await l({...t,availableWidth:A,availableHeight:M});const $=await s.getDimensions(a.floating);return v!==$.width||y!==$.height?{reset:{rects:!0}}:{}}}};function wc(){return typeof window<"u"}function fs(e){return uS(e)?(e.nodeName||"").toLowerCase():"#document"}function Ht(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Vn(e){var t;return(t=(uS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function uS(e){return wc()?e instanceof Node||e instanceof Ht(e).Node:!1}function bn(e){return wc()?e instanceof Element||e instanceof Ht(e).Element:!1}function zn(e){return wc()?e instanceof HTMLElement||e instanceof Ht(e).HTMLElement:!1}function Ay(e){return!wc()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ht(e).ShadowRoot}function Ka(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Rn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function JN(e){return["table","td","th"].includes(fs(e))}function xc(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function yg(e){const t=wg(),n=bn(e)?Rn(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function ZN(e){let t=no(e);for(;zn(t)&&!Ji(t);){if(yg(t))return t;if(xc(t))return null;t=no(t)}return null}function wg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ji(e){return["html","body","#document"].includes(fs(e))}function Rn(e){return Ht(e).getComputedStyle(e)}function Sc(e){return bn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function no(e){if(fs(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ay(e)&&e.host||Vn(e);return Ay(t)?t.host:t}function cS(e){const t=no(e);return Ji(t)?e.ownerDocument?e.ownerDocument.body:e.body:zn(t)&&Ka(t)?t:cS(t)}function Ca(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=cS(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Ht(o);if(i){const a=mp(s);return t.concat(s,s.visualViewport||[],Ka(o)?o:[],a&&n?Ca(a):[])}return t.concat(o,Ca(o,[],n))}function mp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dS(e){const t=Rn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=zn(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Lu(n)!==i||Lu(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function xg(e){return bn(e)?e:e.contextElement}function _i(e){const t=xg(e);if(!zn(t))return eo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=dS(t);let s=(i?Lu(n.width):n.width)/r,a=(i?Lu(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const ej=eo(0);function fS(e){const t=Ht(e);return!wg()||!t.visualViewport?ej:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function tj(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ht(e)?!1:t}function Uo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=xg(e);let s=eo(1);t&&(r?bn(r)&&(s=_i(r)):s=_i(e));const a=tj(i,n,r)?fS(i):eo(0);let l=(o.left+a.x)/s.x,u=(o.top+a.y)/s.y,d=o.width/s.x,c=o.height/s.y;if(i){const f=Ht(i),m=r&&bn(r)?Ht(r):r;let v=f,y=mp(v);for(;y&&r&&m!==v;){const x=_i(y),w=y.getBoundingClientRect(),g=Rn(y),S=w.left+(y.clientLeft+parseFloat(g.paddingLeft))*x.x,C=w.top+(y.clientTop+parseFloat(g.paddingTop))*x.y;l*=x.x,u*=x.y,d*=x.x,c*=x.y,l+=S,u+=C,v=Ht(y),y=mp(v)}}return Uu({width:d,height:c,x:l,y:u})}function nj(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Vn(r),a=t?xc(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},u=eo(1);const d=eo(0),c=zn(r);if((c||!c&&!i)&&((fs(r)!=="body"||Ka(s))&&(l=Sc(r)),zn(r))){const f=Uo(r);u=_i(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x,y:n.y*u.y-l.scrollTop*u.y+d.y}}function rj(e){return Array.from(e.getClientRects())}function vp(e,t){const n=Sc(e).scrollLeft;return t?t.left+n:Uo(Vn(e)).left+n}function oj(e){const t=Vn(e),n=Sc(e),r=e.ownerDocument.body,o=Ut(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Ut(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+vp(e);const a=-n.scrollTop;return Rn(r).direction==="rtl"&&(s+=Ut(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function ij(e,t){const n=Ht(e),r=Vn(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const u=wg();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function sj(e,t){const n=Uo(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=zn(e)?_i(e):eo(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,u=r*i.y;return{width:s,height:a,x:l,y:u}}function My(e,t,n){let r;if(t==="viewport")r=ij(e,n);else if(t==="document")r=oj(Vn(e));else if(bn(t))r=sj(t,n);else{const o=fS(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Uu(r)}function pS(e,t){const n=no(e);return n===t||!bn(n)||Ji(n)?!1:Rn(n).position==="fixed"||pS(n,t)}function aj(e,t){const n=t.get(e);if(n)return n;let r=Ca(e,[],!1).filter(a=>bn(a)&&fs(a)!=="body"),o=null;const i=Rn(e).position==="fixed";let s=i?no(e):e;for(;bn(s)&&!Ji(s);){const a=Rn(s),l=yg(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Ka(s)&&!l&&pS(e,s))?r=r.filter(d=>d!==s):o=a,s=no(s)}return t.set(e,r),r}function lj(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?xc(t)?[]:aj(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((u,d)=>{const c=My(t,d,o);return u.top=Ut(c.top,u.top),u.right=Zr(c.right,u.right),u.bottom=Zr(c.bottom,u.bottom),u.left=Ut(c.left,u.left),u},My(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function uj(e){const{width:t,height:n}=dS(e);return{width:t,height:n}}function cj(e,t,n){const r=zn(t),o=Vn(t),i=n==="fixed",s=Uo(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=eo(0);if(r||!r&&!i)if((fs(t)!=="body"||Ka(o))&&(a=Sc(t)),r){const m=Uo(t,!0,i,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else o&&(l.x=vp(o));let u=0,d=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();d=m.top+a.scrollTop,u=m.left+a.scrollLeft-vp(o,m)}const c=s.left+a.scrollLeft-l.x-u,f=s.top+a.scrollTop-l.y-d;return{x:c,y:f,width:s.width,height:s.height}}function Nd(e){return Rn(e).position==="static"}function ky(e,t){if(!zn(e)||Rn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Vn(e)===n&&(n=n.ownerDocument.body),n}function hS(e,t){const n=Ht(e);if(xc(e))return n;if(!zn(e)){let o=no(e);for(;o&&!Ji(o);){if(bn(o)&&!Nd(o))return o;o=no(o)}return n}let r=ky(e,t);for(;r&&JN(r)&&Nd(r);)r=ky(r,t);return r&&Ji(r)&&Nd(r)&&!yg(r)?n:r||ZN(e)||n}const dj=async function(e){const t=this.getOffsetParent||hS,n=this.getDimensions,r=await n(e.floating);return{reference:cj(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function fj(e){return Rn(e).direction==="rtl"}const pj={convertOffsetParentRelativeRectToViewportRelativeRect:nj,getDocumentElement:Vn,getClippingRect:lj,getOffsetParent:hS,getElementRects:dj,getClientRects:rj,getDimensions:uj,getScale:_i,isElement:bn,isRTL:fj};function hj(e,t){let n=null,r;const o=Vn(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:u,top:d,width:c,height:f}=e.getBoundingClientRect();if(a||t(),!c||!f)return;const m=Al(d),v=Al(o.clientWidth-(u+c)),y=Al(o.clientHeight-(d+f)),x=Al(u),g={rootMargin:-m+"px "+-v+"px "+-y+"px "+-x+"px",threshold:Ut(0,Zr(1,l))||1};let S=!0;function C(P){const b=P[0].intersectionRatio;if(b!==l){if(!S)return s();b?s(!1,b):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{n=new IntersectionObserver(C,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,g)}n.observe(e)}return s(!0),i}function gj(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=xg(e),d=o||i?[...u?Ca(u):[],...Ca(t)]:[];d.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const c=u&&a?hj(u,n):null;let f=-1,m=null;s&&(m=new ResizeObserver(w=>{let[g]=w;g&&g.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var S;(S=m)==null||S.observe(t)})),n()}),u&&!l&&m.observe(u),m.observe(t));let v,y=l?Uo(e):null;l&&x();function x(){const w=Uo(e);y&&(w.x!==y.x||w.y!==y.y||w.width!==y.width||w.height!==y.height)&&n(),y=w,v=requestAnimationFrame(x)}return n(),()=>{var w;d.forEach(g=>{o&&g.removeEventListener("scroll",n),i&&g.removeEventListener("resize",n)}),c==null||c(),(w=m)==null||w.disconnect(),m=null,l&&cancelAnimationFrame(v)}}const mj=qN,vj=QN,yj=KN,wj=XN,xj=GN,Ny=HN,Sj=YN,Cj=(e,t,n)=>{const r=new Map,o={platform:pj,...n},i={...o.platform,_c:r};return VN(e,t,{...o,platform:i})};var Jl=typeof document<"u"?h.useLayoutEffect:h.useEffect;function zu(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!zu(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!zu(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function gS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function jy(e,t){const n=gS(e);return Math.round(t*n)/n}function jd(e){const t=h.useRef(e);return Jl(()=>{t.current=e}),t}function bj(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:u}=e,[d,c]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=h.useState(r);zu(f,r)||m(r);const[v,y]=h.useState(null),[x,w]=h.useState(null),g=h.useCallback(L=>{L!==b.current&&(b.current=L,y(L))},[]),S=h.useCallback(L=>{L!==M.current&&(M.current=L,w(L))},[]),C=i||v,P=s||x,b=h.useRef(null),M=h.useRef(null),A=h.useRef(d),$=l!=null,R=jd(l),O=jd(o),F=jd(u),N=h.useCallback(()=>{if(!b.current||!M.current)return;const L={placement:t,strategy:n,middleware:f};O.current&&(L.platform=O.current),Cj(b.current,M.current,L).then(j=>{const B={...j,isPositioned:F.current!==!1};E.current&&!zu(A.current,B)&&(A.current=B,os.flushSync(()=>{c(B)}))})},[f,t,n,O,F]);Jl(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,c(L=>({...L,isPositioned:!1})))},[u]);const E=h.useRef(!1);Jl(()=>(E.current=!0,()=>{E.current=!1}),[]),Jl(()=>{if(C&&(b.current=C),P&&(M.current=P),C&&P){if(R.current)return R.current(C,P,N);N()}},[C,P,N,R,$]);const T=h.useMemo(()=>({reference:b,floating:M,setReference:g,setFloating:S}),[g,S]),D=h.useMemo(()=>({reference:C,floating:P}),[C,P]),V=h.useMemo(()=>{const L={position:n,left:0,top:0};if(!D.floating)return L;const j=jy(D.floating,d.x),B=jy(D.floating,d.y);return a?{...L,transform:"translate("+j+"px, "+B+"px)",...gS(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:j,top:B}},[n,a,D.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:N,refs:T,elements:D,floatingStyles:V}),[d,N,T,D,V])}const Rj=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Ny({element:r.current,padding:o}).fn(n):{}:r?Ny({element:r,padding:o}).fn(n):{}}}},Ej=(e,t)=>({...mj(e),options:[e,t]}),Pj=(e,t)=>({...vj(e),options:[e,t]}),_j=(e,t)=>({...Sj(e),options:[e,t]}),Tj=(e,t)=>({...yj(e),options:[e,t]}),Aj=(e,t)=>({...wj(e),options:[e,t]}),Mj=(e,t)=>({...xj(e),options:[e,t]}),kj=(e,t)=>({...Rj(e),options:[e,t]});var Nj="Arrow",mS=h.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return p.jsx(he.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});mS.displayName=Nj;var jj=mS;function Oj(e,t=[]){let n=[];function r(i,s){const a=h.createContext(s),l=n.length;n=[...n,s];function u(c){const{scope:f,children:m,...v}=c,y=(f==null?void 0:f[e][l])||a,x=h.useMemo(()=>v,Object.values(v));return p.jsx(y.Provider,{value:x,children:m})}function d(c,f){const m=(f==null?void 0:f[e][l])||a,v=h.useContext(m);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${c}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const o=()=>{const i=n.map(s=>h.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,Dj(o,...t)]}function Dj(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const c=l(i)[`__scope${u}`];return{...a,...c}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Ij(e){const[t,n]=h.useState(void 0);return Cn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Sg="Popper",[vS,Cc]=Oj(Sg),[Fj,yS]=vS(Sg),wS=e=>{const{__scopePopper:t,children:n}=e,[r,o]=h.useState(null);return p.jsx(Fj,{scope:t,anchor:r,onAnchorChange:o,children:n})};wS.displayName=Sg;var xS="PopperAnchor",SS=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=yS(xS,n),s=h.useRef(null),a=Le(t,s);return h.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:p.jsx(he.div,{...o,ref:a})});SS.displayName=xS;var Cg="PopperContent",[Lj,$j]=vS(Cg),CS=h.forwardRef((e,t)=>{var pe,Te,we,tt,Ce,it;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:c="partial",hideWhenDetached:f=!1,updatePositionStrategy:m="optimized",onPlaced:v,...y}=e,x=yS(Cg,n),[w,g]=h.useState(null),S=Le(t,Ot=>g(Ot)),[C,P]=h.useState(null),b=Ij(C),M=(b==null?void 0:b.width)??0,A=(b==null?void 0:b.height)??0,$=r+(i!=="center"?"-"+i:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},O=Array.isArray(u)?u:[u],F=O.length>0,N={padding:R,boundary:O.filter(zj),altBoundary:F},{refs:E,floatingStyles:T,placement:D,isPositioned:V,middlewareData:L}=bj({strategy:"fixed",placement:$,whileElementsMounted:(...Ot)=>gj(...Ot,{animationFrame:m==="always"}),elements:{reference:x.anchor},middleware:[Ej({mainAxis:o+A,alignmentAxis:s}),l&&Pj({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?_j():void 0,...N}),l&&Tj({...N}),Aj({...N,apply:({elements:Ot,rects:$e,availableWidth:nt,availableHeight:cn})=>{const{width:Ic,height:Qa}=$e.reference,Yo=Ot.floating.style;Yo.setProperty("--radix-popper-available-width",`${nt}px`),Yo.setProperty("--radix-popper-available-height",`${cn}px`),Yo.setProperty("--radix-popper-anchor-width",`${Ic}px`),Yo.setProperty("--radix-popper-anchor-height",`${Qa}px`)}}),C&&kj({element:C,padding:a}),Bj({arrowWidth:M,arrowHeight:A}),f&&Mj({strategy:"referenceHidden",...N})]}),[j,B]=ES(D),Q=mt(v);Cn(()=>{V&&(Q==null||Q())},[V,Q]);const te=(pe=L.arrow)==null?void 0:pe.x,fe=(Te=L.arrow)==null?void 0:Te.y,ge=((we=L.arrow)==null?void 0:we.centerOffset)!==0,[z,W]=h.useState();return Cn(()=>{w&&W(window.getComputedStyle(w).zIndex)},[w]),p.jsx("div",{ref:E.setFloating,"data-radix-popper-content-wrapper":"",style:{...T,transform:V?T.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[(tt=L.transformOrigin)==null?void 0:tt.x,(Ce=L.transformOrigin)==null?void 0:Ce.y].join(" "),...((it=L.hide)==null?void 0:it.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(Lj,{scope:n,placedSide:j,onArrowChange:P,arrowX:te,arrowY:fe,shouldHideArrow:ge,children:p.jsx(he.div,{"data-side":j,"data-align":B,...y,ref:S,style:{...y.style,animation:V?void 0:"none"}})})})});CS.displayName=Cg;var bS="PopperArrow",Uj={top:"bottom",right:"left",bottom:"top",left:"right"},RS=h.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=$j(bS,r),s=Uj[i.placedSide];return p.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:p.jsx(jj,{...o,ref:n,style:{...o.style,display:"block"}})})});RS.displayName=bS;function zj(e){return e!==null}var Bj=e=>({name:"transformOrigin",options:e,fn(t){var x,w,g;const{placement:n,rects:r,middlewareData:o}=t,s=((x=o.arrow)==null?void 0:x.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[u,d]=ES(n),c={start:"0%",center:"50%",end:"100%"}[d],f=(((w=o.arrow)==null?void 0:w.x)??0)+a/2,m=(((g=o.arrow)==null?void 0:g.y)??0)+l/2;let v="",y="";return u==="bottom"?(v=s?c:`${f}px`,y=`${-l}px`):u==="top"?(v=s?c:`${f}px`,y=`${r.floating.height+l}px`):u==="right"?(v=`${-l}px`,y=s?c:`${m}px`):u==="left"&&(v=`${r.floating.width+l}px`,y=s?c:`${m}px`),{data:{x:v,y}}}});function ES(e){const[t,n="center"]=e.split("-");return[t,n]}var PS=wS,_S=SS,TS=CS,AS=RS,Vj="VisuallyHidden",bc=h.forwardRef((e,t)=>p.jsx(he.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));bc.displayName=Vj;var Hj=bc,[Rc,SL]=pr("Tooltip",[Cc]),Ec=Cc(),MS="TooltipProvider",Kj=700,yp="tooltip.open",[Gj,bg]=Rc(MS),kS=e=>{const{__scopeTooltip:t,delayDuration:n=Kj,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=h.useState(!0),l=h.useRef(!1),u=h.useRef(0);return h.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),p.jsx(Gj,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:h.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:h.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:h.useCallback(d=>{l.current=d},[]),disableHoverableContent:o,children:i})};kS.displayName=MS;var Pc="Tooltip",[Wj,Ga]=Rc(Pc),NS=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=bg(Pc,e.__scopeTooltip),u=Ec(t),[d,c]=h.useState(null),f=rr(),m=h.useRef(0),v=s??l.disableHoverableContent,y=a??l.delayDuration,x=h.useRef(!1),[w=!1,g]=Wo({prop:r,defaultProp:o,onChange:M=>{M?(l.onOpen(),document.dispatchEvent(new CustomEvent(yp))):l.onClose(),i==null||i(M)}}),S=h.useMemo(()=>w?x.current?"delayed-open":"instant-open":"closed",[w]),C=h.useCallback(()=>{window.clearTimeout(m.current),x.current=!1,g(!0)},[g]),P=h.useCallback(()=>{window.clearTimeout(m.current),g(!1)},[g]),b=h.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{x.current=!0,g(!0)},y)},[y,g]);return h.useEffect(()=>()=>window.clearTimeout(m.current),[]),p.jsx(PS,{...u,children:p.jsx(Wj,{scope:t,contentId:f,open:w,stateAttribute:S,trigger:d,onTriggerChange:c,onTriggerEnter:h.useCallback(()=>{l.isOpenDelayed?b():C()},[l.isOpenDelayed,b,C]),onTriggerLeave:h.useCallback(()=>{v?P():window.clearTimeout(m.current)},[P,v]),onOpen:C,onClose:P,disableHoverableContent:v,children:n})})};NS.displayName=Pc;var wp="TooltipTrigger",jS=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ga(wp,n),i=bg(wp,n),s=Ec(n),a=h.useRef(null),l=Le(t,a,o.onTriggerChange),u=h.useRef(!1),d=h.useRef(!1),c=h.useCallback(()=>u.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),p.jsx(_S,{asChild:!0,...s,children:p.jsx(he.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:re(e.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:re(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:re(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:re(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:re(e.onBlur,o.onClose),onClick:re(e.onClick,o.onClose)})})});jS.displayName=wp;var Rg="TooltipPortal",[qj,Qj]=Rc(Rg,{forceMount:void 0}),OS=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Ga(Rg,t);return p.jsx(qj,{scope:t,forceMount:n,children:p.jsx(Qt,{present:n||i.open,children:p.jsx(Ua,{asChild:!0,container:o,children:r})})})};OS.displayName=Rg;var Zi="TooltipContent",DS=h.forwardRef((e,t)=>{const n=Qj(Zi,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=Ga(Zi,e.__scopeTooltip);return p.jsx(Qt,{present:r||s.open,children:s.disableHoverableContent?p.jsx(IS,{side:o,...i,ref:t}):p.jsx(Yj,{side:o,...i,ref:t})})}),Yj=h.forwardRef((e,t)=>{const n=Ga(Zi,e.__scopeTooltip),r=bg(Zi,e.__scopeTooltip),o=h.useRef(null),i=Le(t,o),[s,a]=h.useState(null),{trigger:l,onClose:u}=n,d=o.current,{onPointerInTransitChange:c}=r,f=h.useCallback(()=>{a(null),c(!1)},[c]),m=h.useCallback((v,y)=>{const x=v.currentTarget,w={x:v.clientX,y:v.clientY},g=eO(w,x.getBoundingClientRect()),S=tO(w,g),C=nO(y.getBoundingClientRect()),P=oO([...S,...C]);a(P),c(!0)},[c]);return h.useEffect(()=>()=>f(),[f]),h.useEffect(()=>{if(l&&d){const v=x=>m(x,d),y=x=>m(x,l);return l.addEventListener("pointerleave",v),d.addEventListener("pointerleave",y),()=>{l.removeEventListener("pointerleave",v),d.removeEventListener("pointerleave",y)}}},[l,d,m,f]),h.useEffect(()=>{if(s){const v=y=>{const x=y.target,w={x:y.clientX,y:y.clientY},g=(l==null?void 0:l.contains(x))||(d==null?void 0:d.contains(x)),S=!rO(w,s);g?f():S&&(f(),u())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,d,s,u,f]),p.jsx(IS,{...e,ref:i})}),[Xj,Jj]=Rc(Pc,{isInside:!1}),IS=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=Ga(Zi,n),u=Ec(n),{onClose:d}=l;return h.useEffect(()=>(document.addEventListener(yp,d),()=>document.removeEventListener(yp,d)),[d]),h.useEffect(()=>{if(l.trigger){const c=f=>{const m=f.target;m!=null&&m.contains(l.trigger)&&d()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[l.trigger,d]),p.jsx($a,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:c=>c.preventDefault(),onDismiss:d,children:p.jsxs(TS,{"data-state":l.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(tg,{children:r}),p.jsx(Xj,{scope:n,isInside:!0,children:p.jsx(Hj,{id:l.contentId,role:"tooltip",children:o||r})})]})})});DS.displayName=Zi;var FS="TooltipArrow",Zj=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ec(n);return Jj(FS,n).isInside?null:p.jsx(AS,{...o,...r,ref:t})});Zj.displayName=FS;function eO(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function tO(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function nO(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function rO(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;ir!=d>r&&n<(u-a)*(r-l)/(d-l)+a&&(o=!o)}return o}function oO(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),iO(t)}function iO(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var sO=kS,aO=NS,lO=jS,uO=OS,LS=DS;const cO=sO,dO=aO,fO=lO,$S=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(uO,{children:p.jsx(LS,{ref:r,sideOffset:t,className:G("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));$S.displayName=LS.displayName;const pO="sidebar:state",hO=60*60*24*7,gO="16rem",mO="18rem",vO="3rem",yO="b",US=h.createContext(null);function _c(){const e=h.useContext(US);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const zS=h.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:o,children:i,...s},a)=>{const l=QM(),[u,d]=h.useState(!1),[c,f]=h.useState(e),m=t??c,v=h.useCallback(g=>{if(n)return n==null?void 0:n(typeof g=="function"?g(m):g);f(g),document.cookie=`${pO}=${m}; path=/; max-age=${hO}`},[n,m]),y=h.useCallback(()=>l?d(g=>!g):v(g=>!g),[l,v,d]);h.useEffect(()=>{const g=S=>{S.key===yO&&(S.metaKey||S.ctrlKey)&&(S.preventDefault(),y())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[y]);const x=m?"expanded":"collapsed",w=h.useMemo(()=>({state:x,open:m,setOpen:v,isMobile:l,openMobile:u,setOpenMobile:d,toggleSidebar:y}),[x,m,v,l,u,d,y]);return p.jsx(US.Provider,{value:w,children:p.jsx(cO,{delayDuration:0,children:p.jsx("div",{style:{"--sidebar-width":gO,"--sidebar-width-icon":vO,...o},className:G("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",r),ref:a,...s,children:i})})})});zS.displayName="SidebarProvider";const BS=h.forwardRef(({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:o,...i},s)=>{const{isMobile:a,state:l,openMobile:u,setOpenMobile:d}=_c();return n==="none"?p.jsx("div",{className:G("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",r),ref:s,...i,children:o}):a?p.jsx(MN,{open:u,onOpenChange:d,...i,children:p.jsx(aS,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":mO},side:e,children:p.jsx("div",{className:"flex h-full w-full flex-col",children:o})})}):p.jsxs("div",{ref:s,className:"group peer hidden md:block text-sidebar-foreground","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":t,"data-side":e,children:[p.jsx("div",{className:G("duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),p.jsx("div",{className:G("duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...i,children:p.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:o})})]})});BS.displayName="Sidebar";const VS=h.forwardRef(({className:e,onClick:t,...n},r)=>{const{toggleSidebar:o}=_c();return p.jsxs(Tt,{ref:r,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:G("h-7 w-7",e),onClick:i=>{t==null||t(i),o()},...n,children:[p.jsx(LM,{}),p.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});VS.displayName="SidebarTrigger";const HS=h.forwardRef(({className:e,...t},n)=>{const{toggleSidebar:r}=_c();return p.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:G("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});HS.displayName="SidebarRail";const KS=h.forwardRef(({className:e,...t},n)=>p.jsx("main",{ref:n,className:G("relative flex min-h-[calc(100svh_-_4rem)] flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));KS.displayName="SidebarInset";const wO=h.forwardRef(({className:e,...t},n)=>p.jsx(og,{ref:n,"data-sidebar":"input",className:G("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));wO.displayName="SidebarInput";const GS=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,"data-sidebar":"header",className:G("flex flex-col gap-2 p-2",e),...t}));GS.displayName="SidebarHeader";const WS=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,"data-sidebar":"footer",className:G("flex flex-col gap-2 p-2",e),...t}));WS.displayName="SidebarFooter";const xp=h.forwardRef(({className:e,...t},n)=>p.jsx(_1,{ref:n,"data-sidebar":"separator",className:G("mx-2 w-auto bg-sidebar-border",e),...t}));xp.displayName="SidebarSeparator";const qS=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,"data-sidebar":"content",className:G("flex min-h-0 flex-1 flex-col gap-2 p-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));qS.displayName="SidebarContent";const xO=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,"data-sidebar":"group",className:G("relative flex w-full min-w-0 flex-col p-2",e),...t}));xO.displayName="SidebarGroup";const SO=h.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const o=t?un:"div";return p.jsx(o,{ref:r,"data-sidebar":"group-label",className:G("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...n})});SO.displayName="SidebarGroupLabel";const CO=h.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const o=t?un:"button";return p.jsx(o,{ref:r,"data-sidebar":"group-action",className:G("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...n})});CO.displayName="SidebarGroupAction";const bO=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,"data-sidebar":"group-content",className:G("w-full text-sm",e),...t}));bO.displayName="SidebarGroupContent";const QS=h.forwardRef(({className:e,...t},n)=>p.jsx("ul",{ref:n,"data-sidebar":"menu",className:G("flex w-full min-w-0 flex-col gap-1",e),...t}));QS.displayName="SidebarMenu";const po=h.forwardRef(({className:e,...t},n)=>p.jsx("li",{ref:n,"data-sidebar":"menu-item",className:G("group/menu-item relative",e),...t}));po.displayName="SidebarMenuItem";const RO=La("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),ho=h.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n="default",size:r="default",tooltip:o,className:i,...s},a)=>{const l=e?un:"button",{isMobile:u,state:d}=_c(),c=p.jsx(l,{ref:a,"data-sidebar":"menu-button","data-size":r,"data-active":t,className:G(RO({variant:n,size:r}),i),...s});return o?(typeof o=="string"&&(o={children:o}),p.jsxs(dO,{children:[p.jsx(fO,{asChild:!0,children:c}),p.jsx($S,{side:"right",align:"center",hidden:d!=="collapsed"||u,...o})]})):c});ho.displayName="SidebarMenuButton";const EO=h.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},o)=>{const i=t?un:"button";return p.jsx(i,{ref:o,"data-sidebar":"menu-action",className:G("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...r})});EO.displayName="SidebarMenuAction";const PO=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:G("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));PO.displayName="SidebarMenuBadge";const _O=h.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{const o=h.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return p.jsxs("div",{ref:r,"data-sidebar":"menu-skeleton",className:G("rounded-md h-8 flex gap-2 px-2 items-center",e),...n,children:[t&&p.jsx(Ey,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),p.jsx(Ey,{className:"h-4 flex-1 max-w-[--skeleton-width]","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":o}})]})});_O.displayName="SidebarMenuSkeleton";const TO=h.forwardRef(({className:e,...t},n)=>p.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:G("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));TO.displayName="SidebarMenuSub";const AO=h.forwardRef(({...e},t)=>p.jsx("li",{ref:t,...e}));AO.displayName="SidebarMenuSubItem";const MO=h.forwardRef(({asChild:e=!1,size:t="md",isActive:n,className:r,...o},i)=>{const s=e?un:"a";return p.jsx(s,{ref:i,"data-sidebar":"menu-sub-button","data-size":t,"data-active":n,className:G("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",r),...o})});MO.displayName="SidebarMenuSubButton";function kO(e,t=[]){let n=[];function r(i,s){const a=h.createContext(s),l=n.length;n=[...n,s];function u(c){const{scope:f,children:m,...v}=c,y=(f==null?void 0:f[e][l])||a,x=h.useMemo(()=>v,Object.values(v));return p.jsx(y.Provider,{value:x,children:m})}function d(c,f){const m=(f==null?void 0:f[e][l])||a,v=h.useContext(m);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${c}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const o=()=>{const i=n.map(s=>h.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,NO(o,...t)]}function NO(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const c=l(i)[`__scope${u}`];return{...a,...c}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Eg(e){const t=e+"CollectionProvider",[n,r]=kO(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:v,children:y}=m,x=xr.useRef(null),w=xr.useRef(new Map).current;return p.jsx(o,{scope:v,itemMap:w,collectionRef:x,children:y})};s.displayName=t;const a=e+"CollectionSlot",l=xr.forwardRef((m,v)=>{const{scope:y,children:x}=m,w=i(a,y),g=Le(v,w.collectionRef);return p.jsx(un,{ref:g,children:x})});l.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",c=xr.forwardRef((m,v)=>{const{scope:y,children:x,...w}=m,g=xr.useRef(null),S=Le(v,g),C=i(u,y);return xr.useEffect(()=>(C.itemMap.set(g,{ref:g,...w}),()=>void C.itemMap.delete(g))),p.jsx(un,{[d]:"",ref:S,children:x})});c.displayName=u;function f(m){const v=i(e+"CollectionConsumer",m);return xr.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((C,P)=>w.indexOf(C.ref.current)-w.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:l,ItemSlot:c},f,r]}var jO=h.createContext(void 0);function Pg(e){const t=h.useContext(jO);return e||t||"ltr"}function OO(e,t=[]){let n=[];function r(i,s){const a=h.createContext(s),l=n.length;n=[...n,s];function u(c){const{scope:f,children:m,...v}=c,y=(f==null?void 0:f[e][l])||a,x=h.useMemo(()=>v,Object.values(v));return p.jsx(y.Provider,{value:x,children:m})}function d(c,f){const m=(f==null?void 0:f[e][l])||a,v=h.useContext(m);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${c}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const o=()=>{const i=n.map(s=>h.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,DO(o,...t)]}function DO(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const c=l(i)[`__scope${u}`];return{...a,...c}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var Od="rovingFocusGroup.onEntryFocus",IO={bubbles:!1,cancelable:!0},Tc="RovingFocusGroup",[Sp,YS,FO]=Eg(Tc),[LO,Ac]=OO(Tc,[FO]),[$O,UO]=LO(Tc),XS=h.forwardRef((e,t)=>p.jsx(Sp.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(Sp.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(zO,{...e,ref:t})})}));XS.displayName=Tc;var zO=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...c}=e,f=h.useRef(null),m=Le(t,f),v=Pg(i),[y=null,x]=Wo({prop:s,defaultProp:a,onChange:l}),[w,g]=h.useState(!1),S=mt(u),C=YS(n),P=h.useRef(!1),[b,M]=h.useState(0);return h.useEffect(()=>{const A=f.current;if(A)return A.addEventListener(Od,S),()=>A.removeEventListener(Od,S)},[S]),p.jsx($O,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:y,onItemFocus:h.useCallback(A=>x(A),[x]),onItemShiftTab:h.useCallback(()=>g(!0),[]),onFocusableItemAdd:h.useCallback(()=>M(A=>A+1),[]),onFocusableItemRemove:h.useCallback(()=>M(A=>A-1),[]),children:p.jsx(he.div,{tabIndex:w||b===0?-1:0,"data-orientation":r,...c,ref:m,style:{outline:"none",...e.style},onMouseDown:re(e.onMouseDown,()=>{P.current=!0}),onFocus:re(e.onFocus,A=>{const $=!P.current;if(A.target===A.currentTarget&&$&&!w){const R=new CustomEvent(Od,IO);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){const O=C().filter(D=>D.focusable),F=O.find(D=>D.active),N=O.find(D=>D.id===y),T=[F,N,...O].filter(Boolean).map(D=>D.ref.current);eC(T,d)}}P.current=!1}),onBlur:re(e.onBlur,()=>g(!1))})})}),JS="RovingFocusGroupItem",ZS=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=rr(),l=i||a,u=UO(JS,n),d=u.currentTabStopId===l,c=YS(n),{onFocusableItemAdd:f,onFocusableItemRemove:m}=u;return h.useEffect(()=>{if(r)return f(),()=>m()},[r,f,m]),p.jsx(Sp.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:p.jsx(he.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:re(e.onMouseDown,v=>{r?u.onItemFocus(l):v.preventDefault()}),onFocus:re(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:re(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=HO(v,u.orientation,u.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=c().filter(g=>g.focusable).map(g=>g.ref.current);if(y==="last")w.reverse();else if(y==="prev"||y==="next"){y==="prev"&&w.reverse();const g=w.indexOf(v.currentTarget);w=u.loop?KO(w,g+1):w.slice(g+1)}setTimeout(()=>eC(w))}})})})});ZS.displayName=JS;var BO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function VO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function HO(e,t,n){const r=VO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return BO[r]}function eC(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function KO(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var tC=XS,nC=ZS,Cp=["Enter"," "],GO=["ArrowDown","PageUp","Home"],rC=["ArrowUp","PageDown","End"],WO=[...GO,...rC],qO={ltr:[...Cp,"ArrowRight"],rtl:[...Cp,"ArrowLeft"]},QO={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Wa="Menu",[ba,YO,XO]=Eg(Wa),[qo,oC]=pr(Wa,[XO,Cc,Ac]),Mc=Cc(),iC=Ac(),[JO,Qo]=qo(Wa),[ZO,qa]=qo(Wa),sC=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=Mc(t),[l,u]=h.useState(null),d=h.useRef(!1),c=mt(i),f=Pg(o);return h.useEffect(()=>{const m=()=>{d.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>d.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),p.jsx(PS,{...a,children:p.jsx(JO,{scope:t,open:n,onOpenChange:c,content:l,onContentChange:u,children:p.jsx(ZO,{scope:t,onClose:h.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:d,dir:f,modal:s,children:r})})})};sC.displayName=Wa;var eD="MenuAnchor",_g=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Mc(n);return p.jsx(_S,{...o,...r,ref:t})});_g.displayName=eD;var Tg="MenuPortal",[tD,aC]=qo(Tg,{forceMount:void 0}),lC=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=Qo(Tg,t);return p.jsx(tD,{scope:t,forceMount:n,children:p.jsx(Qt,{present:n||i.open,children:p.jsx(Ua,{asChild:!0,container:o,children:r})})})};lC.displayName=Tg;var sn="MenuContent",[nD,Ag]=qo(sn),uC=h.forwardRef((e,t)=>{const n=aC(sn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Qo(sn,e.__scopeMenu),s=qa(sn,e.__scopeMenu);return p.jsx(ba.Provider,{scope:e.__scopeMenu,children:p.jsx(Qt,{present:r||i.open,children:p.jsx(ba.Slot,{scope:e.__scopeMenu,children:s.modal?p.jsx(rD,{...o,ref:t}):p.jsx(oD,{...o,ref:t})})})})}),rD=h.forwardRef((e,t)=>{const n=Qo(sn,e.__scopeMenu),r=h.useRef(null),o=Le(t,r);return h.useEffect(()=>{const i=r.current;if(i)return z1(i)},[]),p.jsx(Mg,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:re(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),oD=h.forwardRef((e,t)=>{const n=Qo(sn,e.__scopeMenu);return p.jsx(Mg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Mg=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:f,onDismiss:m,disableOutsideScroll:v,...y}=e,x=Qo(sn,n),w=qa(sn,n),g=Mc(n),S=iC(n),C=YO(n),[P,b]=h.useState(null),M=h.useRef(null),A=Le(t,M,x.onContentChange),$=h.useRef(0),R=h.useRef(""),O=h.useRef(0),F=h.useRef(null),N=h.useRef("right"),E=h.useRef(0),T=v?ag:h.Fragment,D=v?{as:un,allowPinchZoom:!0}:void 0,V=j=>{var pe,Te;const B=R.current+j,Q=C().filter(we=>!we.disabled),te=document.activeElement,fe=(pe=Q.find(we=>we.ref.current===te))==null?void 0:pe.textValue,ge=Q.map(we=>we.textValue),z=mD(ge,B,fe),W=(Te=Q.find(we=>we.textValue===z))==null?void 0:Te.ref.current;(function we(tt){R.current=tt,window.clearTimeout($.current),tt!==""&&($.current=window.setTimeout(()=>we(""),1e3))})(B),W&&setTimeout(()=>W.focus())};h.useEffect(()=>()=>window.clearTimeout($.current),[]),N1();const L=h.useCallback(j=>{var Q,te;return N.current===((Q=F.current)==null?void 0:Q.side)&&yD(j,(te=F.current)==null?void 0:te.area)},[]);return p.jsx(nD,{scope:n,searchRef:R,onItemEnter:h.useCallback(j=>{L(j)&&j.preventDefault()},[L]),onItemLeave:h.useCallback(j=>{var B;L(j)||((B=M.current)==null||B.focus(),b(null))},[L]),onTriggerLeave:h.useCallback(j=>{L(j)&&j.preventDefault()},[L]),pointerGraceTimerRef:O,onPointerGraceIntentChange:h.useCallback(j=>{F.current=j},[]),children:p.jsx(T,{...D,children:p.jsx(sg,{asChild:!0,trapped:o,onMountAutoFocus:re(i,j=>{var B;j.preventDefault(),(B=M.current)==null||B.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:p.jsx($a,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:f,onDismiss:m,children:p.jsx(tC,{asChild:!0,...S,dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:P,onCurrentTabStopIdChange:b,onEntryFocus:re(l,j=>{w.isUsingKeyboardRef.current||j.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(TS,{role:"menu","aria-orientation":"vertical","data-state":EC(x.open),"data-radix-menu-content":"",dir:w.dir,...g,...y,ref:A,style:{outline:"none",...y.style},onKeyDown:re(y.onKeyDown,j=>{const Q=j.target.closest("[data-radix-menu-content]")===j.currentTarget,te=j.ctrlKey||j.altKey||j.metaKey,fe=j.key.length===1;Q&&(j.key==="Tab"&&j.preventDefault(),!te&&fe&&V(j.key));const ge=M.current;if(j.target!==ge||!WO.includes(j.key))return;j.preventDefault();const W=C().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);rC.includes(j.key)&&W.reverse(),hD(W)}),onBlur:re(e.onBlur,j=>{j.currentTarget.contains(j.target)||(window.clearTimeout($.current),R.current="")}),onPointerMove:re(e.onPointerMove,Ra(j=>{const B=j.target,Q=E.current!==j.clientX;if(j.currentTarget.contains(B)&&Q){const te=j.clientX>E.current?"right":"left";N.current=te,E.current=j.clientX}}))})})})})})})});uC.displayName=sn;var iD="MenuGroup",kg=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(he.div,{role:"group",...r,ref:t})});kg.displayName=iD;var sD="MenuLabel",cC=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(he.div,{...r,ref:t})});cC.displayName=sD;var Bu="MenuItem",Oy="menu.itemSelect",kc=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=h.useRef(null),s=qa(Bu,e.__scopeMenu),a=Ag(Bu,e.__scopeMenu),l=Le(t,i),u=h.useRef(!1),d=()=>{const c=i.current;if(!n&&c){const f=new CustomEvent(Oy,{bubbles:!0,cancelable:!0});c.addEventListener(Oy,m=>r==null?void 0:r(m),{once:!0}),ig(c,f),f.defaultPrevented?u.current=!1:s.onClose()}};return p.jsx(dC,{...o,ref:l,disabled:n,onClick:re(e.onClick,d),onPointerDown:c=>{var f;(f=e.onPointerDown)==null||f.call(e,c),u.current=!0},onPointerUp:re(e.onPointerUp,c=>{var f;u.current||(f=c.currentTarget)==null||f.click()}),onKeyDown:re(e.onKeyDown,c=>{const f=a.searchRef.current!=="";n||f&&c.key===" "||Cp.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});kc.displayName=Bu;var dC=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=Ag(Bu,n),a=iC(n),l=h.useRef(null),u=Le(t,l),[d,c]=h.useState(!1),[f,m]=h.useState("");return h.useEffect(()=>{const v=l.current;v&&m((v.textContent??"").trim())},[i.children]),p.jsx(ba.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:p.jsx(nC,{asChild:!0,...a,focusable:!r,children:p.jsx(he.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:u,onPointerMove:re(e.onPointerMove,Ra(v=>{r?s.onItemLeave(v):(s.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:re(e.onPointerLeave,Ra(v=>s.onItemLeave(v))),onFocus:re(e.onFocus,()=>c(!0)),onBlur:re(e.onBlur,()=>c(!1))})})})}),aD="MenuCheckboxItem",fC=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return p.jsx(vC,{scope:e.__scopeMenu,checked:n,children:p.jsx(kc,{role:"menuitemcheckbox","aria-checked":Vu(n)?"mixed":n,...o,ref:t,"data-state":jg(n),onSelect:re(o.onSelect,()=>r==null?void 0:r(Vu(n)?!0:!n),{checkForDefaultPrevented:!1})})})});fC.displayName=aD;var pC="MenuRadioGroup",[lD,uD]=qo(pC,{value:void 0,onValueChange:()=>{}}),hC=h.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=mt(r);return p.jsx(lD,{scope:e.__scopeMenu,value:n,onValueChange:i,children:p.jsx(kg,{...o,ref:t})})});hC.displayName=pC;var gC="MenuRadioItem",mC=h.forwardRef((e,t)=>{const{value:n,...r}=e,o=uD(gC,e.__scopeMenu),i=n===o.value;return p.jsx(vC,{scope:e.__scopeMenu,checked:i,children:p.jsx(kc,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":jg(i),onSelect:re(r.onSelect,()=>{var s;return(s=o.onValueChange)==null?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})})});mC.displayName=gC;var Ng="MenuItemIndicator",[vC,cD]=qo(Ng,{checked:!1}),yC=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=cD(Ng,n);return p.jsx(Qt,{present:r||Vu(i.checked)||i.checked===!0,children:p.jsx(he.span,{...o,ref:t,"data-state":jg(i.checked)})})});yC.displayName=Ng;var dD="MenuSeparator",wC=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(he.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});wC.displayName=dD;var fD="MenuArrow",xC=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Mc(n);return p.jsx(AS,{...o,...r,ref:t})});xC.displayName=fD;var pD="MenuSub",[CL,SC]=qo(pD),$s="MenuSubTrigger",CC=h.forwardRef((e,t)=>{const n=Qo($s,e.__scopeMenu),r=qa($s,e.__scopeMenu),o=SC($s,e.__scopeMenu),i=Ag($s,e.__scopeMenu),s=h.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,u={__scopeMenu:e.__scopeMenu},d=h.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return h.useEffect(()=>d,[d]),h.useEffect(()=>{const c=a.current;return()=>{window.clearTimeout(c),l(null)}},[a,l]),p.jsx(_g,{asChild:!0,...u,children:p.jsx(dC,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":EC(n.open),...e,ref:gc(t,o.onTriggerChange),onClick:c=>{var f;(f=e.onClick)==null||f.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:re(e.onPointerMove,Ra(c=>{i.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:re(e.onPointerLeave,Ra(c=>{var m,v;d();const f=(m=n.content)==null?void 0:m.getBoundingClientRect();if(f){const y=(v=n.content)==null?void 0:v.dataset.side,x=y==="right",w=x?-5:5,g=f[x?"left":"right"],S=f[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:c.clientX+w,y:c.clientY},{x:g,y:f.top},{x:S,y:f.top},{x:S,y:f.bottom},{x:g,y:f.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(c),c.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:re(e.onKeyDown,c=>{var m;const f=i.searchRef.current!=="";e.disabled||f&&c.key===" "||qO[r.dir].includes(c.key)&&(n.onOpenChange(!0),(m=n.content)==null||m.focus(),c.preventDefault())})})})});CC.displayName=$s;var bC="MenuSubContent",RC=h.forwardRef((e,t)=>{const n=aC(sn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Qo(sn,e.__scopeMenu),s=qa(sn,e.__scopeMenu),a=SC(bC,e.__scopeMenu),l=h.useRef(null),u=Le(t,l);return p.jsx(ba.Provider,{scope:e.__scopeMenu,children:p.jsx(Qt,{present:r||i.open,children:p.jsx(ba.Slot,{scope:e.__scopeMenu,children:p.jsx(Mg,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:u,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var c;s.isUsingKeyboardRef.current&&((c=l.current)==null||c.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:re(e.onFocusOutside,d=>{d.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:re(e.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault()}),onKeyDown:re(e.onKeyDown,d=>{var m;const c=d.currentTarget.contains(d.target),f=QO[s.dir].includes(d.key);c&&f&&(i.onOpenChange(!1),(m=a.trigger)==null||m.focus(),d.preventDefault())})})})})})});RC.displayName=bC;function EC(e){return e?"open":"closed"}function Vu(e){return e==="indeterminate"}function jg(e){return Vu(e)?"indeterminate":e?"checked":"unchecked"}function hD(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function gD(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function mD(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=gD(e,Math.max(i,0));o.length===1&&(s=s.filter(u=>u!==n));const l=s.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function vD(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;ir!=d>r&&n<(u-a)*(r-l)/(d-l)+a&&(o=!o)}return o}function yD(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return vD(n,t)}function Ra(e){return t=>t.pointerType==="mouse"?e(t):void 0}var wD=sC,xD=_g,SD=lC,CD=uC,bD=kg,RD=cC,ED=kc,PD=fC,_D=hC,TD=mC,AD=yC,MD=wC,kD=xC,ND=CC,jD=RC,Og="DropdownMenu",[OD,bL]=pr(Og,[oC]),bt=oC(),[DD,PC]=OD(Og),_C=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=bt(t),u=h.useRef(null),[d=!1,c]=Wo({prop:o,defaultProp:i,onChange:s});return p.jsx(DD,{scope:t,triggerId:rr(),triggerRef:u,contentId:rr(),open:d,onOpenChange:c,onOpenToggle:h.useCallback(()=>c(f=>!f),[c]),modal:a,children:p.jsx(wD,{...l,open:d,onOpenChange:c,dir:r,modal:a,children:n})})};_C.displayName=Og;var TC="DropdownMenuTrigger",AC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=PC(TC,n),s=bt(n);return p.jsx(xD,{asChild:!0,...s,children:p.jsx(he.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:gc(t,i.triggerRef),onPointerDown:re(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:re(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});AC.displayName=TC;var ID="DropdownMenuPortal",MC=e=>{const{__scopeDropdownMenu:t,...n}=e,r=bt(t);return p.jsx(SD,{...r,...n})};MC.displayName=ID;var kC="DropdownMenuContent",NC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=PC(kC,n),i=bt(n),s=h.useRef(!1);return p.jsx(CD,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:t,onCloseAutoFocus:re(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)==null||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:re(e.onInteractOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;(!o.modal||d)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});NC.displayName=kC;var FD="DropdownMenuGroup",LD=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(bD,{...o,...r,ref:t})});LD.displayName=FD;var $D="DropdownMenuLabel",jC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(RD,{...o,...r,ref:t})});jC.displayName=$D;var UD="DropdownMenuItem",OC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(ED,{...o,...r,ref:t})});OC.displayName=UD;var zD="DropdownMenuCheckboxItem",DC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(PD,{...o,...r,ref:t})});DC.displayName=zD;var BD="DropdownMenuRadioGroup",IC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(_D,{...o,...r,ref:t})});IC.displayName=BD;var VD="DropdownMenuRadioItem",FC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(TD,{...o,...r,ref:t})});FC.displayName=VD;var HD="DropdownMenuItemIndicator",LC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(AD,{...o,...r,ref:t})});LC.displayName=HD;var KD="DropdownMenuSeparator",$C=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(MD,{...o,...r,ref:t})});$C.displayName=KD;var GD="DropdownMenuArrow",WD=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(kD,{...o,...r,ref:t})});WD.displayName=GD;var qD="DropdownMenuSubTrigger",UC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(ND,{...o,...r,ref:t})});UC.displayName=qD;var QD="DropdownMenuSubContent",zC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(jD,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});zC.displayName=QD;var YD=_C,XD=AC,JD=MC,BC=NC,VC=jC,HC=OC,KC=DC,ZD=IC,GC=FC,WC=LC,qC=$C,QC=UC,YC=zC;const Ea=YD,Pa=XD,eI=ZD,tI=h.forwardRef(({className:e,inset:t,children:n,...r},o)=>p.jsxs(QC,{ref:o,className:G("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,p.jsx(iS,{className:"ml-auto h-4 w-4"})]}));tI.displayName=QC.displayName;const nI=h.forwardRef(({className:e,...t},n)=>p.jsx(YC,{ref:n,className:G("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));nI.displayName=YC.displayName;const es=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(JD,{children:p.jsx(BC,{ref:r,sideOffset:t,className:G("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));es.displayName=BC.displayName;const zt=h.forwardRef(({className:e,inset:t,...n},r)=>p.jsx(HC,{ref:r,className:G("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));zt.displayName=HC.displayName;const rI=h.forwardRef(({className:e,children:t,checked:n,...r},o)=>p.jsxs(KC,{ref:o,className:G("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(WC,{children:p.jsx(SN,{className:"h-4 w-4"})})}),t]}));rI.displayName=KC.displayName;const bp=h.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(GC,{ref:r,className:G("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(WC,{children:p.jsx(_N,{className:"h-4 w-4 fill-current"})})}),t]}));bp.displayName=GC.displayName;const Dg=h.forwardRef(({className:e,inset:t,...n},r)=>p.jsx(VC,{ref:r,className:G("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Dg.displayName=VC.displayName;const Nc=h.forwardRef(({className:e,...t},n)=>p.jsx(qC,{ref:n,className:G("-mx-1 my-1 h-px bg-muted",e),...t}));Nc.displayName=qC.displayName;var Ig="Avatar",[oI,RL]=pr(Ig),[iI,XC]=oI(Ig),JC=h.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[o,i]=h.useState("idle");return p.jsx(iI,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:p.jsx(he.span,{...r,ref:t})})});JC.displayName=Ig;var ZC="AvatarImage",eb=h.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...i}=e,s=XC(ZC,n),a=sI(r,i.referrerPolicy),l=mt(u=>{o(u),s.onImageLoadingStatusChange(u)});return Cn(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?p.jsx(he.img,{...i,ref:t,src:r}):null});eb.displayName=ZC;var tb="AvatarFallback",nb=h.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...o}=e,i=XC(tb,n),[s,a]=h.useState(r===void 0);return h.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),s&&i.imageLoadingStatus!=="loaded"?p.jsx(he.span,{...o,ref:t}):null});nb.displayName=tb;function sI(e,t){const[n,r]=h.useState("idle");return Cn(()=>{if(!e){r("error");return}let o=!0;const i=new window.Image,s=a=>()=>{o&&r(a)};return r("loading"),i.onload=s("loaded"),i.onerror=s("error"),i.src=e,t&&(i.referrerPolicy=t),()=>{o=!1}},[e,t]),n}var rb=JC,ob=eb,ib=nb;const sb=h.forwardRef(({className:e,...t},n)=>p.jsx(rb,{ref:n,className:G("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));sb.displayName=rb.displayName;const ab=h.forwardRef(({className:e,...t},n)=>p.jsx(ob,{ref:n,className:G("aspect-square h-full w-full",e),...t}));ab.displayName=ob.displayName;const lb=h.forwardRef(({className:e,...t},n)=>p.jsx(ib,{ref:n,className:G("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));lb.displayName=ib.displayName;const ub=({user:e})=>{var n,r,o,i,s,a,l,u;const t=mM(e.name);return p.jsx(sb,{className:"h-8 w-8",children:(r=(n=e.photo)==null?void 0:n[0])!=null&&r.url||(i=(o=e.photo)==null?void 0:o[0])!=null&&i.data?p.jsx(ab,{src:((a=(s=e.photo)==null?void 0:s[0])==null?void 0:a.url)||((u=(l=e.photo)==null?void 0:l[0])==null?void 0:u.data),alt:name}):p.jsx(lb,{className:e.resourceType==="Patient"?"bg-pink-400 text-pink-50":"bg-teal-400 text-teal-50",children:t})})},aI=()=>{const{user:e}=Go(),t=Ko(),n=as(),r=()=>{var o;(o=t._clearState)==null||o.call(t),n("/"),window.location.reload()};return p.jsxs(Ea,{children:[p.jsx(Pa,{asChild:!0,children:p.jsxs(Tt,{variant:"ghost",className:"flex items-center h-11",children:[p.jsx(ub,{user:e}),p.jsx("span",{className:"hidden md:block",children:us(e.name)}),p.jsx(b1,{className:"h-4 w-4 opacity-50"})]})}),p.jsxs(es,{align:"end",className:"w-56",children:[p.jsxs(zt,{children:[p.jsx(GM,{}),e.resourceType," profile"]}),p.jsxs(zt,{children:[p.jsx(zM,{}),"Settings"]}),p.jsx(Nc,{}),p.jsxs(zt,{onClick:r,children:[p.jsx(FM,{className:"h-4 w-4"}),p.jsx("span",{children:"Log out"})]})]})]})};function lI({title:e}){return p.jsxs("header",{className:"flex h-16 items-center border-b px-4 flex-shrink-0 gap-4",children:[p.jsx(VS,{}),e,p.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[p.jsxs(Tt,{variant:"ghost",size:"icon",children:[p.jsx(MM,{className:"h-5 w-5"}),p.jsx("span",{className:"sr-only",children:"Notifications"})]}),p.jsx(aI,{})]})]})}const Hu=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:G("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Hu.displayName="Card";const Ku=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:G("flex flex-col space-y-1.5 p-6",e),...t}));Ku.displayName="CardHeader";const Gu=h.forwardRef(({className:e,...t},n)=>p.jsx("h3",{ref:n,className:G("font-semibold leading-none tracking-tight",e),...t}));Gu.displayName="CardTitle";const Rp=h.forwardRef(({className:e,...t},n)=>p.jsx("p",{ref:n,className:G("text-sm text-muted-foreground",e),...t}));Rp.displayName="CardDescription";const Fg=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:G("p-6 pt-0",e),...t}));Fg.displayName="CardContent";const Ep=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:G("flex items-center p-6 pt-0",e),...t}));Ep.displayName="CardFooter";const uI=()=>{const{patient:e,user:t}=Go();if(!e||t.resourceType==="Patient")return;const n=us(e.name),r=e.birthDate?new Date().getFullYear()-new Date(e.birthDate).getFullYear():"unknown",o=e.address?hM(e.address):"unknown",i=gM(e.gender);return p.jsxs(Hu,{className:"mx-4 mb-4 shadow-none",children:[p.jsxs(Ku,{className:"px-4 space-y-0 py-2 border-b flex-row items-center",children:[p.jsx(Gu,{children:"Current Patient"}),p.jsxs(Ea,{children:[p.jsx(Pa,{asChild:!0,children:p.jsxs(Tt,{variant:"ghost",className:"h-8 w-8 ml-auto",children:[p.jsx("span",{className:"sr-only",children:"Open menu"}),p.jsx(rg,{className:"h-4 w-4"})]})}),p.jsx(es,{align:"start",children:p.jsxs(zt,{onClick:()=>navigator.clipboard.writeText(e.id),children:[p.jsx(ng,{}),"Copy ID"]})})]})]}),p.jsxs(Fg,{className:"px-4 py-3",children:[p.jsxs("div",{className:"flex items-start gap-3 mb-2",children:[p.jsx(ub,{user:e}),p.jsxs("div",{className:"flex flex-col text-sm",children:[p.jsx("div",{className:" font-medium",children:n}),p.jsxs("div",{className:"text-xs text-muted-foreground",children:[i,", ",r," years old"]})]})]}),p.jsx("div",{className:"text-xs text-muted-foreground",children:o})]})]})},cI=()=>{const{user:e}=Go(),t=Vo();return p.jsxs(BS,{className:"border-r",children:[p.jsx(GS,{className:"h-16 items-center flex-row px-4",children:p.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e.resourceType==="Patient"?"Patient Portal":"Provider EHR"})}),p.jsx(qS,{children:p.jsxs(QS,{children:[p.jsx(po,{children:p.jsx(ho,{asChild:!0,isActive:t.pathname==="/",children:p.jsxs(Ys,{to:"/",children:[p.jsx(DM,{className:"mr-2 h-5 w-5"}),"Dashboard"]})})}),e.resourceType==="Practitioner"&&p.jsxs(p.Fragment,{children:[p.jsx(po,{children:p.jsxs(ho,{children:[p.jsx(qM,{className:"mr-2 h-5 w-5"}),"Patients"]})}),p.jsx(po,{children:p.jsxs(ho,{children:[p.jsx(NM,{className:"mr-2 h-5 w-5"}),"Appointments"]})}),p.jsx(xp,{}),p.jsx(po,{children:p.jsx(ho,{asChild:!0,isActive:t.pathname==="/questionnaires",children:p.jsxs(Ys,{to:"/questionnaires",children:[p.jsx(OM,{className:"mr-2 h-5 w-5"}),"Questionnaires"]})})})]}),p.jsx(po,{children:p.jsx(ho,{asChild:!0,isActive:t.pathname==="/questionnaire-responses",children:p.jsxs(Ys,{to:"/questionnaire-responses",children:[p.jsx(VM,{className:"mr-2 h-5 w-5"}),"Questionnaire Responses"]})})}),p.jsx(xp,{}),p.jsx(po,{children:p.jsxs(ho,{children:[p.jsx(BM,{className:"mr-2 h-5 w-5"}),"Settings"]})})]})}),p.jsx(WS,{children:p.jsx(uI,{})}),p.jsx(HS,{})]})},cb=e=>p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 300 150",...e,children:p.jsx("path",{fill:"none",stroke:"#EA4A35",strokeWidth:"15",strokeLinecap:"round",strokeDasharray:"300 385",strokeDashoffset:"0",d:"M275 75c0 31-27 50-50 50-58 0-92-100-150-100-28 0-50 22-50 50s23 50 50 50c58 0 92-100 150-100 24 0 50 19 50 50Z",children:p.jsx("animate",{attributeName:"stroke-dashoffset",calcMode:"spline",dur:"2",values:"685;-685",keySplines:"0 0 1 1",repeatCount:"indefinite"})})}),Lg=()=>p.jsx("div",{className:"flex-1 grid place-items-center",children:p.jsx(cb,{width:"80"})}),dI=()=>p.jsx(NA,{children:p.jsx(OA,{children:p.jsx(zS,{style:{"--sidebar-width":"18rem"},children:p.jsx("div",{className:"flex h-screen flex-col w-full",children:p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsx(cI,{}),p.jsxs(KS,{className:"flex-1",children:[p.jsx(lI,{}),p.jsx(h.Suspense,{fallback:p.jsx(Lg,{}),children:p.jsx(kx,{})})]})]})})})})});/** +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return h.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},xN="DialogDescriptionWarning",SN=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${sS(xN).contentName}}.`;return h.useEffect(()=>{var i;const o=(i=e.current)==null?void 0:i.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},pg=G1,CN=q1,hg=Y1,za=X1,Ba=J1,Va=eS,Ha=nS,yc=oS;function cs(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,i;for(i=0;i=0)&&(n[o]=e[o]);return n}var bN=["color"],RN=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=cs(e,bN);return h.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),h.createElement("path",{d:"M11.4669 3.72684C11.7558 3.91574 11.8369 4.30308 11.648 4.59198L7.39799 11.092C7.29783 11.2452 7.13556 11.3467 6.95402 11.3699C6.77247 11.3931 6.58989 11.3355 6.45446 11.2124L3.70446 8.71241C3.44905 8.48022 3.43023 8.08494 3.66242 7.82953C3.89461 7.57412 4.28989 7.55529 4.5453 7.78749L6.75292 9.79441L10.6018 3.90792C10.7907 3.61902 11.178 3.53795 11.4669 3.72684Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),EN=["color"],PN=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=cs(e,EN);return h.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),h.createElement("path",{d:"M8.84182 3.13514C9.04327 3.32401 9.05348 3.64042 8.86462 3.84188L5.43521 7.49991L8.86462 11.1579C9.05348 11.3594 9.04327 11.6758 8.84182 11.8647C8.64036 12.0535 8.32394 12.0433 8.13508 11.8419L4.38508 7.84188C4.20477 7.64955 4.20477 7.35027 4.38508 7.15794L8.13508 3.15794C8.32394 2.95648 8.64036 2.94628 8.84182 3.13514Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),_N=["color"],aS=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=cs(e,_N);return h.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),h.createElement("path",{d:"M6.1584 3.13508C6.35985 2.94621 6.67627 2.95642 6.86514 3.15788L10.6151 7.15788C10.7954 7.3502 10.7954 7.64949 10.6151 7.84182L6.86514 11.8418C6.67627 12.0433 6.35985 12.0535 6.1584 11.8646C5.95694 11.6757 5.94673 11.3593 6.1356 11.1579L9.565 7.49985L6.1356 3.84182C5.94673 3.64036 5.95694 3.32394 6.1584 3.13508Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),TN=["color"],gg=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=cs(e,TN);return h.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),h.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))}),AN=["color"],MN=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=cs(e,AN);return h.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),h.createElement("path",{d:"M9.875 7.5C9.875 8.81168 8.81168 9.875 7.5 9.875C6.18832 9.875 5.125 8.81168 5.125 7.5C5.125 6.18832 6.18832 5.125 7.5 5.125C8.81168 5.125 9.875 6.18832 9.875 7.5Z",fill:r}))}),kN=["color"],NN=h.forwardRef(function(e,t){var n=e.color,r=n===void 0?"currentColor":n,o=cs(e,kN);return h.createElement("svg",Object.assign({width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},o,{ref:t}),h.createElement("path",{d:"M3.625 7.5C3.625 8.12132 3.12132 8.625 2.5 8.625C1.87868 8.625 1.375 8.12132 1.375 7.5C1.375 6.87868 1.87868 6.375 2.5 6.375C3.12132 6.375 3.625 6.87868 3.625 7.5ZM8.625 7.5C8.625 8.12132 8.12132 8.625 7.5 8.625C6.87868 8.625 6.375 8.12132 6.375 7.5C6.375 6.87868 6.87868 6.375 7.5 6.375C8.12132 6.375 8.625 6.87868 8.625 7.5ZM12.5 8.625C13.1213 8.625 13.625 8.12132 13.625 7.5C13.625 6.87868 13.1213 6.375 12.5 6.375C11.8787 6.375 11.375 6.87868 11.375 7.5C11.375 8.12132 11.8787 8.625 12.5 8.625Z",fill:r,fillRule:"evenodd",clipRule:"evenodd"}))});const jN=pg,ON=hg,lS=h.forwardRef(({className:e,...t},n)=>p.jsx(za,{className:G("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));lS.displayName=za.displayName;const DN=La("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),uS=h.forwardRef(({side:e="right",className:t,children:n,...r},o)=>p.jsxs(ON,{children:[p.jsx(lS,{}),p.jsxs(Ba,{ref:o,className:G(DN({side:e}),t),...r,children:[p.jsxs(yc,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[p.jsx(gg,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]}),n]})]}));uS.displayName=Ba.displayName;const IN=h.forwardRef(({className:e,...t},n)=>p.jsx(Va,{ref:n,className:G("text-lg font-semibold text-foreground",e),...t}));IN.displayName=Va.displayName;const FN=h.forwardRef(({className:e,...t},n)=>p.jsx(Ha,{ref:n,className:G("text-sm text-muted-foreground",e),...t}));FN.displayName=Ha.displayName;function _y({className:e,...t}){return p.jsx("div",{className:G("animate-pulse rounded-md bg-primary/10",e),...t})}const LN=["top","right","bottom","left"],Zr=Math.min,Ut=Math.max,Lu=Math.round,Al=Math.floor,eo=e=>({x:e,y:e}),$N={left:"right",right:"left",bottom:"top",top:"bottom"},UN={start:"end",end:"start"};function gp(e,t,n){return Ut(e,Zr(t,n))}function ur(e,t){return typeof e=="function"?e(t):e}function cr(e){return e.split("-")[0]}function ds(e){return e.split("-")[1]}function mg(e){return e==="x"?"y":"x"}function vg(e){return e==="y"?"height":"width"}function to(e){return["top","bottom"].includes(cr(e))?"y":"x"}function yg(e){return mg(to(e))}function zN(e,t,n){n===void 0&&(n=!1);const r=ds(e),o=yg(e),i=vg(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(s=$u(s)),[s,$u(s)]}function BN(e){const t=$u(e);return[mp(e),t,mp(t)]}function mp(e){return e.replace(/start|end/g,t=>UN[t])}function VN(e,t,n){const r=["left","right"],o=["right","left"],i=["top","bottom"],s=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?i:s;default:return[]}}function HN(e,t,n,r){const o=ds(e);let i=VN(cr(e),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),t&&(i=i.concat(i.map(mp)))),i}function $u(e){return e.replace(/left|right|bottom|top/g,t=>$N[t])}function KN(e){return{top:0,right:0,bottom:0,left:0,...e}}function cS(e){return typeof e!="number"?KN(e):{top:e,right:e,bottom:e,left:e}}function Uu(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Ty(e,t,n){let{reference:r,floating:o}=e;const i=to(t),s=yg(t),a=vg(s),l=cr(t),u=i==="y",d=r.x+r.width/2-o.width/2,c=r.y+r.height/2-o.height/2,f=r[a]/2-o[a]/2;let m;switch(l){case"top":m={x:d,y:r.y-o.height};break;case"bottom":m={x:d,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:c};break;case"left":m={x:r.x-o.width,y:c};break;default:m={x:r.x,y:r.y}}switch(ds(t)){case"start":m[s]-=f*(n&&u?-1:1);break;case"end":m[s]+=f*(n&&u?-1:1);break}return m}const GN=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,a=i.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t));let u=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:c}=Ty(u,r,l),f=r,m={},v=0;for(let y=0;y({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:i,platform:s,elements:a,middlewareData:l}=t,{element:u,padding:d=0}=ur(e,t)||{};if(u==null)return{};const c=cS(d),f={x:n,y:r},m=yg(o),v=vg(m),y=await s.getDimensions(u),x=m==="y",w=x?"top":"left",g=x?"bottom":"right",S=x?"clientHeight":"clientWidth",C=i.reference[v]+i.reference[m]-f[m]-i.floating[v],P=f[m]-i.reference[m],b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let M=b?b[S]:0;(!M||!await(s.isElement==null?void 0:s.isElement(b)))&&(M=a.floating[S]||i.floating[v]);const A=C/2-P/2,$=M/2-y[v]/2-1,R=Zr(c[w],$),O=Zr(c[g],$),F=R,N=M-y[v]-O,E=M/2-y[v]/2+A,T=gp(F,E,N),D=!l.arrow&&ds(o)!=null&&E!==T&&i.reference[v]/2-(EE<=0)){var O,F;const E=(((O=i.flip)==null?void 0:O.index)||0)+1,T=M[E];if(T)return{data:{index:E,overflows:R},reset:{placement:T}};let D=(F=R.filter(V=>V.overflows[0]<=0).sort((V,L)=>V.overflows[1]-L.overflows[1])[0])==null?void 0:F.placement;if(!D)switch(m){case"bestFit":{var N;const V=(N=R.filter(L=>{if(b){const j=to(L.placement);return j===g||j==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(j=>j>0).reduce((j,B)=>j+B,0)]).sort((L,j)=>L[1]-j[1])[0])==null?void 0:N[0];V&&(D=V);break}case"initialPlacement":D=a;break}if(o!==D)return{reset:{placement:D}}}return{}}}};function Ay(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function My(e){return LN.some(t=>e[t]>=0)}const QN=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ur(e,t);switch(r){case"referenceHidden":{const i=await Sa(t,{...o,elementContext:"reference"}),s=Ay(i,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:My(s)}}}case"escaped":{const i=await Sa(t,{...o,altBoundary:!0}),s=Ay(i,n.floating);return{data:{escapedOffsets:s,escaped:My(s)}}}default:return{}}}}};async function YN(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=cr(n),a=ds(n),l=to(n)==="y",u=["left","top"].includes(s)?-1:1,d=i&&l?-1:1,c=ur(t,e);let{mainAxis:f,crossAxis:m,alignmentAxis:v}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return a&&typeof v=="number"&&(m=a==="end"?v*-1:v),l?{x:m*d,y:f*u}:{x:f*u,y:m*d}}const XN=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:a}=t,l=await YN(t,e);return s===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},JN=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:i=!0,crossAxis:s=!1,limiter:a={fn:x=>{let{x:w,y:g}=x;return{x:w,y:g}}},...l}=ur(e,t),u={x:n,y:r},d=await Sa(t,l),c=to(cr(o)),f=mg(c);let m=u[f],v=u[c];if(i){const x=f==="y"?"top":"left",w=f==="y"?"bottom":"right",g=m+d[x],S=m-d[w];m=gp(g,m,S)}if(s){const x=c==="y"?"top":"left",w=c==="y"?"bottom":"right",g=v+d[x],S=v-d[w];v=gp(g,v,S)}const y=a.fn({...t,[f]:m,[c]:v});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[f]:i,[c]:s}}}}}},ZN=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:i,middlewareData:s}=t,{offset:a=0,mainAxis:l=!0,crossAxis:u=!0}=ur(e,t),d={x:n,y:r},c=to(o),f=mg(c);let m=d[f],v=d[c];const y=ur(a,t),x=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(l){const S=f==="y"?"height":"width",C=i.reference[f]-i.floating[S]+x.mainAxis,P=i.reference[f]+i.reference[S]-x.mainAxis;mP&&(m=P)}if(u){var w,g;const S=f==="y"?"width":"height",C=["top","left"].includes(cr(o)),P=i.reference[c]-i.floating[S]+(C&&((w=s.offset)==null?void 0:w[c])||0)+(C?0:x.crossAxis),b=i.reference[c]+i.reference[S]+(C?0:((g=s.offset)==null?void 0:g[c])||0)-(C?x.crossAxis:0);vb&&(v=b)}return{[f]:m,[c]:v}}}},ej=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:a}=t,{apply:l=()=>{},...u}=ur(e,t),d=await Sa(t,u),c=cr(o),f=ds(o),m=to(o)==="y",{width:v,height:y}=i.floating;let x,w;c==="top"||c==="bottom"?(x=c,w=f===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(w=c,x=f==="end"?"top":"bottom");const g=y-d.top-d.bottom,S=v-d.left-d.right,C=Zr(y-d[x],g),P=Zr(v-d[w],S),b=!t.middlewareData.shift;let M=C,A=P;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(M=g),b&&!f){const R=Ut(d.left,0),O=Ut(d.right,0),F=Ut(d.top,0),N=Ut(d.bottom,0);m?A=v-2*(R!==0||O!==0?R+O:Ut(d.left,d.right)):M=y-2*(F!==0||N!==0?F+N:Ut(d.top,d.bottom))}await l({...t,availableWidth:A,availableHeight:M});const $=await s.getDimensions(a.floating);return v!==$.width||y!==$.height?{reset:{rects:!0}}:{}}}};function wc(){return typeof window<"u"}function fs(e){return dS(e)?(e.nodeName||"").toLowerCase():"#document"}function Ht(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Vn(e){var t;return(t=(dS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function dS(e){return wc()?e instanceof Node||e instanceof Ht(e).Node:!1}function bn(e){return wc()?e instanceof Element||e instanceof Ht(e).Element:!1}function zn(e){return wc()?e instanceof HTMLElement||e instanceof Ht(e).HTMLElement:!1}function ky(e){return!wc()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ht(e).ShadowRoot}function Ka(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Rn(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function tj(e){return["table","td","th"].includes(fs(e))}function xc(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function wg(e){const t=xg(),n=bn(e)?Rn(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function nj(e){let t=no(e);for(;zn(t)&&!Ji(t);){if(wg(t))return t;if(xc(t))return null;t=no(t)}return null}function xg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ji(e){return["html","body","#document"].includes(fs(e))}function Rn(e){return Ht(e).getComputedStyle(e)}function Sc(e){return bn(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function no(e){if(fs(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ky(e)&&e.host||Vn(e);return ky(t)?t.host:t}function fS(e){const t=no(e);return Ji(t)?e.ownerDocument?e.ownerDocument.body:e.body:zn(t)&&Ka(t)?t:fS(t)}function Ca(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=fS(e),i=o===((r=e.ownerDocument)==null?void 0:r.body),s=Ht(o);if(i){const a=vp(s);return t.concat(s,s.visualViewport||[],Ka(o)?o:[],a&&n?Ca(a):[])}return t.concat(o,Ca(o,[],n))}function vp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function pS(e){const t=Rn(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=zn(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,a=Lu(n)!==i||Lu(r)!==s;return a&&(n=i,r=s),{width:n,height:r,$:a}}function Sg(e){return bn(e)?e:e.contextElement}function _i(e){const t=Sg(e);if(!zn(t))return eo(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=pS(t);let s=(i?Lu(n.width):n.width)/r,a=(i?Lu(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}const rj=eo(0);function hS(e){const t=Ht(e);return!xg()||!t.visualViewport?rj:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function oj(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ht(e)?!1:t}function Uo(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Sg(e);let s=eo(1);t&&(r?bn(r)&&(s=_i(r)):s=_i(e));const a=oj(i,n,r)?hS(i):eo(0);let l=(o.left+a.x)/s.x,u=(o.top+a.y)/s.y,d=o.width/s.x,c=o.height/s.y;if(i){const f=Ht(i),m=r&&bn(r)?Ht(r):r;let v=f,y=vp(v);for(;y&&r&&m!==v;){const x=_i(y),w=y.getBoundingClientRect(),g=Rn(y),S=w.left+(y.clientLeft+parseFloat(g.paddingLeft))*x.x,C=w.top+(y.clientTop+parseFloat(g.paddingTop))*x.y;l*=x.x,u*=x.y,d*=x.x,c*=x.y,l+=S,u+=C,v=Ht(y),y=vp(v)}}return Uu({width:d,height:c,x:l,y:u})}function ij(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=Vn(r),a=t?xc(t.floating):!1;if(r===s||a&&i)return n;let l={scrollLeft:0,scrollTop:0},u=eo(1);const d=eo(0),c=zn(r);if((c||!c&&!i)&&((fs(r)!=="body"||Ka(s))&&(l=Sc(r)),zn(r))){const f=Uo(r);u=_i(r),d.x=f.x+r.clientLeft,d.y=f.y+r.clientTop}return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+d.x,y:n.y*u.y-l.scrollTop*u.y+d.y}}function sj(e){return Array.from(e.getClientRects())}function yp(e,t){const n=Sc(e).scrollLeft;return t?t.left+n:Uo(Vn(e)).left+n}function aj(e){const t=Vn(e),n=Sc(e),r=e.ownerDocument.body,o=Ut(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Ut(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+yp(e);const a=-n.scrollTop;return Rn(r).direction==="rtl"&&(s+=Ut(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:a}}function lj(e,t){const n=Ht(e),r=Vn(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;const u=xg();(!u||u&&t==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a,y:l}}function uj(e,t){const n=Uo(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=zn(e)?_i(e):eo(1),s=e.clientWidth*i.x,a=e.clientHeight*i.y,l=o*i.x,u=r*i.y;return{width:s,height:a,x:l,y:u}}function Ny(e,t,n){let r;if(t==="viewport")r=lj(e,n);else if(t==="document")r=aj(Vn(e));else if(bn(t))r=uj(t,n);else{const o=hS(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return Uu(r)}function gS(e,t){const n=no(e);return n===t||!bn(n)||Ji(n)?!1:Rn(n).position==="fixed"||gS(n,t)}function cj(e,t){const n=t.get(e);if(n)return n;let r=Ca(e,[],!1).filter(a=>bn(a)&&fs(a)!=="body"),o=null;const i=Rn(e).position==="fixed";let s=i?no(e):e;for(;bn(s)&&!Ji(s);){const a=Rn(s),l=wg(s);!l&&a.position==="fixed"&&(o=null),(i?!l&&!o:!l&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Ka(s)&&!l&&gS(e,s))?r=r.filter(d=>d!==s):o=a,s=no(s)}return t.set(e,r),r}function dj(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?xc(t)?[]:cj(t,this._c):[].concat(n),r],a=s[0],l=s.reduce((u,d)=>{const c=Ny(t,d,o);return u.top=Ut(c.top,u.top),u.right=Zr(c.right,u.right),u.bottom=Zr(c.bottom,u.bottom),u.left=Ut(c.left,u.left),u},Ny(t,a,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function fj(e){const{width:t,height:n}=pS(e);return{width:t,height:n}}function pj(e,t,n){const r=zn(t),o=Vn(t),i=n==="fixed",s=Uo(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const l=eo(0);if(r||!r&&!i)if((fs(t)!=="body"||Ka(o))&&(a=Sc(t)),r){const m=Uo(t,!0,i,t);l.x=m.x+t.clientLeft,l.y=m.y+t.clientTop}else o&&(l.x=yp(o));let u=0,d=0;if(o&&!r&&!i){const m=o.getBoundingClientRect();d=m.top+a.scrollTop,u=m.left+a.scrollLeft-yp(o,m)}const c=s.left+a.scrollLeft-l.x-u,f=s.top+a.scrollTop-l.y-d;return{x:c,y:f,width:s.width,height:s.height}}function Nd(e){return Rn(e).position==="static"}function jy(e,t){if(!zn(e)||Rn(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Vn(e)===n&&(n=n.ownerDocument.body),n}function mS(e,t){const n=Ht(e);if(xc(e))return n;if(!zn(e)){let o=no(e);for(;o&&!Ji(o);){if(bn(o)&&!Nd(o))return o;o=no(o)}return n}let r=jy(e,t);for(;r&&tj(r)&&Nd(r);)r=jy(r,t);return r&&Ji(r)&&Nd(r)&&!wg(r)?n:r||nj(e)||n}const hj=async function(e){const t=this.getOffsetParent||mS,n=this.getDimensions,r=await n(e.floating);return{reference:pj(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function gj(e){return Rn(e).direction==="rtl"}const mj={convertOffsetParentRelativeRectToViewportRelativeRect:ij,getDocumentElement:Vn,getClippingRect:dj,getOffsetParent:mS,getElementRects:hj,getClientRects:sj,getDimensions:fj,getScale:_i,isElement:bn,isRTL:gj};function vj(e,t){let n=null,r;const o=Vn(e);function i(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:u,top:d,width:c,height:f}=e.getBoundingClientRect();if(a||t(),!c||!f)return;const m=Al(d),v=Al(o.clientWidth-(u+c)),y=Al(o.clientHeight-(d+f)),x=Al(u),g={rootMargin:-m+"px "+-v+"px "+-y+"px "+-x+"px",threshold:Ut(0,Zr(1,l))||1};let S=!0;function C(P){const b=P[0].intersectionRatio;if(b!==l){if(!S)return s();b?s(!1,b):r=setTimeout(()=>{s(!1,1e-7)},1e3)}S=!1}try{n=new IntersectionObserver(C,{...g,root:o.ownerDocument})}catch{n=new IntersectionObserver(C,g)}n.observe(e)}return s(!0),i}function yj(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=Sg(e),d=o||i?[...u?Ca(u):[],...Ca(t)]:[];d.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),i&&w.addEventListener("resize",n)});const c=u&&a?vj(u,n):null;let f=-1,m=null;s&&(m=new ResizeObserver(w=>{let[g]=w;g&&g.target===u&&m&&(m.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var S;(S=m)==null||S.observe(t)})),n()}),u&&!l&&m.observe(u),m.observe(t));let v,y=l?Uo(e):null;l&&x();function x(){const w=Uo(e);y&&(w.x!==y.x||w.y!==y.y||w.width!==y.width||w.height!==y.height)&&n(),y=w,v=requestAnimationFrame(x)}return n(),()=>{var w;d.forEach(g=>{o&&g.removeEventListener("scroll",n),i&&g.removeEventListener("resize",n)}),c==null||c(),(w=m)==null||w.disconnect(),m=null,l&&cancelAnimationFrame(v)}}const wj=XN,xj=JN,Sj=qN,Cj=ej,bj=QN,Oy=WN,Rj=ZN,Ej=(e,t,n)=>{const r=new Map,o={platform:mj,...n},i={...o.platform,_c:r};return GN(e,t,{...o,platform:i})};var Jl=typeof document<"u"?h.useLayoutEffect:h.useEffect;function zu(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!zu(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!zu(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function vS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Dy(e,t){const n=vS(e);return Math.round(t*n)/n}function jd(e){const t=h.useRef(e);return Jl(()=>{t.current=e}),t}function Pj(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:a=!0,whileElementsMounted:l,open:u}=e,[d,c]=h.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,m]=h.useState(r);zu(f,r)||m(r);const[v,y]=h.useState(null),[x,w]=h.useState(null),g=h.useCallback(L=>{L!==b.current&&(b.current=L,y(L))},[]),S=h.useCallback(L=>{L!==M.current&&(M.current=L,w(L))},[]),C=i||v,P=s||x,b=h.useRef(null),M=h.useRef(null),A=h.useRef(d),$=l!=null,R=jd(l),O=jd(o),F=jd(u),N=h.useCallback(()=>{if(!b.current||!M.current)return;const L={placement:t,strategy:n,middleware:f};O.current&&(L.platform=O.current),Ej(b.current,M.current,L).then(j=>{const B={...j,isPositioned:F.current!==!1};E.current&&!zu(A.current,B)&&(A.current=B,os.flushSync(()=>{c(B)}))})},[f,t,n,O,F]);Jl(()=>{u===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,c(L=>({...L,isPositioned:!1})))},[u]);const E=h.useRef(!1);Jl(()=>(E.current=!0,()=>{E.current=!1}),[]),Jl(()=>{if(C&&(b.current=C),P&&(M.current=P),C&&P){if(R.current)return R.current(C,P,N);N()}},[C,P,N,R,$]);const T=h.useMemo(()=>({reference:b,floating:M,setReference:g,setFloating:S}),[g,S]),D=h.useMemo(()=>({reference:C,floating:P}),[C,P]),V=h.useMemo(()=>{const L={position:n,left:0,top:0};if(!D.floating)return L;const j=Dy(D.floating,d.x),B=Dy(D.floating,d.y);return a?{...L,transform:"translate("+j+"px, "+B+"px)",...vS(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:j,top:B}},[n,a,D.floating,d.x,d.y]);return h.useMemo(()=>({...d,update:N,refs:T,elements:D,floatingStyles:V}),[d,N,T,D,V])}const _j=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?Oy({element:r.current,padding:o}).fn(n):{}:r?Oy({element:r,padding:o}).fn(n):{}}}},Tj=(e,t)=>({...wj(e),options:[e,t]}),Aj=(e,t)=>({...xj(e),options:[e,t]}),Mj=(e,t)=>({...Rj(e),options:[e,t]}),kj=(e,t)=>({...Sj(e),options:[e,t]}),Nj=(e,t)=>({...Cj(e),options:[e,t]}),jj=(e,t)=>({...bj(e),options:[e,t]}),Oj=(e,t)=>({..._j(e),options:[e,t]});var Dj="Arrow",yS=h.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...i}=e;return p.jsx(he.svg,{...i,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:p.jsx("polygon",{points:"0,0 30,0 15,10"})})});yS.displayName=Dj;var Ij=yS;function Fj(e,t=[]){let n=[];function r(i,s){const a=h.createContext(s),l=n.length;n=[...n,s];function u(c){const{scope:f,children:m,...v}=c,y=(f==null?void 0:f[e][l])||a,x=h.useMemo(()=>v,Object.values(v));return p.jsx(y.Provider,{value:x,children:m})}function d(c,f){const m=(f==null?void 0:f[e][l])||a,v=h.useContext(m);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${c}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const o=()=>{const i=n.map(s=>h.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,Lj(o,...t)]}function Lj(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const c=l(i)[`__scope${u}`];return{...a,...c}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function $j(e){const[t,n]=h.useState(void 0);return Cn(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const i=o[0];let s,a;if("borderBoxSize"in i){const l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;s=u.inlineSize,a=u.blockSize}else s=e.offsetWidth,a=e.offsetHeight;n({width:s,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var Cg="Popper",[wS,Cc]=Fj(Cg),[Uj,xS]=wS(Cg),SS=e=>{const{__scopePopper:t,children:n}=e,[r,o]=h.useState(null);return p.jsx(Uj,{scope:t,anchor:r,onAnchorChange:o,children:n})};SS.displayName=Cg;var CS="PopperAnchor",bS=h.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,i=xS(CS,n),s=h.useRef(null),a=Le(t,s);return h.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:p.jsx(he.div,{...o,ref:a})});bS.displayName=CS;var bg="PopperContent",[zj,Bj]=wS(bg),RS=h.forwardRef((e,t)=>{var pe,Te,we,tt,Ce,it;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:i="center",alignOffset:s=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:c="partial",hideWhenDetached:f=!1,updatePositionStrategy:m="optimized",onPlaced:v,...y}=e,x=xS(bg,n),[w,g]=h.useState(null),S=Le(t,Ot=>g(Ot)),[C,P]=h.useState(null),b=$j(C),M=(b==null?void 0:b.width)??0,A=(b==null?void 0:b.height)??0,$=r+(i!=="center"?"-"+i:""),R=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},O=Array.isArray(u)?u:[u],F=O.length>0,N={padding:R,boundary:O.filter(Hj),altBoundary:F},{refs:E,floatingStyles:T,placement:D,isPositioned:V,middlewareData:L}=Pj({strategy:"fixed",placement:$,whileElementsMounted:(...Ot)=>yj(...Ot,{animationFrame:m==="always"}),elements:{reference:x.anchor},middleware:[Tj({mainAxis:o+A,alignmentAxis:s}),l&&Aj({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?Mj():void 0,...N}),l&&kj({...N}),Nj({...N,apply:({elements:Ot,rects:$e,availableWidth:nt,availableHeight:cn})=>{const{width:Ic,height:Qa}=$e.reference,Yo=Ot.floating.style;Yo.setProperty("--radix-popper-available-width",`${nt}px`),Yo.setProperty("--radix-popper-available-height",`${cn}px`),Yo.setProperty("--radix-popper-anchor-width",`${Ic}px`),Yo.setProperty("--radix-popper-anchor-height",`${Qa}px`)}}),C&&Oj({element:C,padding:a}),Kj({arrowWidth:M,arrowHeight:A}),f&&jj({strategy:"referenceHidden",...N})]}),[j,B]=_S(D),Q=mt(v);Cn(()=>{V&&(Q==null||Q())},[V,Q]);const te=(pe=L.arrow)==null?void 0:pe.x,fe=(Te=L.arrow)==null?void 0:Te.y,ge=((we=L.arrow)==null?void 0:we.centerOffset)!==0,[z,W]=h.useState();return Cn(()=>{w&&W(window.getComputedStyle(w).zIndex)},[w]),p.jsx("div",{ref:E.setFloating,"data-radix-popper-content-wrapper":"",style:{...T,transform:V?T.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:z,"--radix-popper-transform-origin":[(tt=L.transformOrigin)==null?void 0:tt.x,(Ce=L.transformOrigin)==null?void 0:Ce.y].join(" "),...((it=L.hide)==null?void 0:it.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:p.jsx(zj,{scope:n,placedSide:j,onArrowChange:P,arrowX:te,arrowY:fe,shouldHideArrow:ge,children:p.jsx(he.div,{"data-side":j,"data-align":B,...y,ref:S,style:{...y.style,animation:V?void 0:"none"}})})})});RS.displayName=bg;var ES="PopperArrow",Vj={top:"bottom",right:"left",bottom:"top",left:"right"},PS=h.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,i=Bj(ES,r),s=Vj[i.placedSide];return p.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:p.jsx(Ij,{...o,ref:n,style:{...o.style,display:"block"}})})});PS.displayName=ES;function Hj(e){return e!==null}var Kj=e=>({name:"transformOrigin",options:e,fn(t){var x,w,g;const{placement:n,rects:r,middlewareData:o}=t,s=((x=o.arrow)==null?void 0:x.centerOffset)!==0,a=s?0:e.arrowWidth,l=s?0:e.arrowHeight,[u,d]=_S(n),c={start:"0%",center:"50%",end:"100%"}[d],f=(((w=o.arrow)==null?void 0:w.x)??0)+a/2,m=(((g=o.arrow)==null?void 0:g.y)??0)+l/2;let v="",y="";return u==="bottom"?(v=s?c:`${f}px`,y=`${-l}px`):u==="top"?(v=s?c:`${f}px`,y=`${r.floating.height+l}px`):u==="right"?(v=`${-l}px`,y=s?c:`${m}px`):u==="left"&&(v=`${r.floating.width+l}px`,y=s?c:`${m}px`),{data:{x:v,y}}}});function _S(e){const[t,n="center"]=e.split("-");return[t,n]}var TS=SS,AS=bS,MS=RS,kS=PS,Gj="VisuallyHidden",bc=h.forwardRef((e,t)=>p.jsx(he.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));bc.displayName=Gj;var Wj=bc,[Rc,RL]=pr("Tooltip",[Cc]),Ec=Cc(),NS="TooltipProvider",qj=700,wp="tooltip.open",[Qj,Rg]=Rc(NS),jS=e=>{const{__scopeTooltip:t,delayDuration:n=qj,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=e,[s,a]=h.useState(!0),l=h.useRef(!1),u=h.useRef(0);return h.useEffect(()=>{const d=u.current;return()=>window.clearTimeout(d)},[]),p.jsx(Qj,{scope:t,isOpenDelayed:s,delayDuration:n,onOpen:h.useCallback(()=>{window.clearTimeout(u.current),a(!1)},[]),onClose:h.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:h.useCallback(d=>{l.current=d},[]),disableHoverableContent:o,children:i})};jS.displayName=NS;var Pc="Tooltip",[Yj,Ga]=Rc(Pc),OS=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:i,disableHoverableContent:s,delayDuration:a}=e,l=Rg(Pc,e.__scopeTooltip),u=Ec(t),[d,c]=h.useState(null),f=rr(),m=h.useRef(0),v=s??l.disableHoverableContent,y=a??l.delayDuration,x=h.useRef(!1),[w=!1,g]=Wo({prop:r,defaultProp:o,onChange:M=>{M?(l.onOpen(),document.dispatchEvent(new CustomEvent(wp))):l.onClose(),i==null||i(M)}}),S=h.useMemo(()=>w?x.current?"delayed-open":"instant-open":"closed",[w]),C=h.useCallback(()=>{window.clearTimeout(m.current),x.current=!1,g(!0)},[g]),P=h.useCallback(()=>{window.clearTimeout(m.current),g(!1)},[g]),b=h.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{x.current=!0,g(!0)},y)},[y,g]);return h.useEffect(()=>()=>window.clearTimeout(m.current),[]),p.jsx(TS,{...u,children:p.jsx(Yj,{scope:t,contentId:f,open:w,stateAttribute:S,trigger:d,onTriggerChange:c,onTriggerEnter:h.useCallback(()=>{l.isOpenDelayed?b():C()},[l.isOpenDelayed,b,C]),onTriggerLeave:h.useCallback(()=>{v?P():window.clearTimeout(m.current)},[P,v]),onOpen:C,onClose:P,disableHoverableContent:v,children:n})})};OS.displayName=Pc;var xp="TooltipTrigger",DS=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ga(xp,n),i=Rg(xp,n),s=Ec(n),a=h.useRef(null),l=Le(t,a,o.onTriggerChange),u=h.useRef(!1),d=h.useRef(!1),c=h.useCallback(()=>u.current=!1,[]);return h.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),p.jsx(AS,{asChild:!0,...s,children:p.jsx(he.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:l,onPointerMove:re(e.onPointerMove,f=>{f.pointerType!=="touch"&&!d.current&&!i.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:re(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:re(e.onPointerDown,()=>{u.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:re(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:re(e.onBlur,o.onClose),onClick:re(e.onClick,o.onClose)})})});DS.displayName=xp;var Eg="TooltipPortal",[Xj,Jj]=Rc(Eg,{forceMount:void 0}),IS=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,i=Ga(Eg,t);return p.jsx(Xj,{scope:t,forceMount:n,children:p.jsx(Qt,{present:n||i.open,children:p.jsx(Ua,{asChild:!0,container:o,children:r})})})};IS.displayName=Eg;var Zi="TooltipContent",FS=h.forwardRef((e,t)=>{const n=Jj(Zi,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...i}=e,s=Ga(Zi,e.__scopeTooltip);return p.jsx(Qt,{present:r||s.open,children:s.disableHoverableContent?p.jsx(LS,{side:o,...i,ref:t}):p.jsx(Zj,{side:o,...i,ref:t})})}),Zj=h.forwardRef((e,t)=>{const n=Ga(Zi,e.__scopeTooltip),r=Rg(Zi,e.__scopeTooltip),o=h.useRef(null),i=Le(t,o),[s,a]=h.useState(null),{trigger:l,onClose:u}=n,d=o.current,{onPointerInTransitChange:c}=r,f=h.useCallback(()=>{a(null),c(!1)},[c]),m=h.useCallback((v,y)=>{const x=v.currentTarget,w={x:v.clientX,y:v.clientY},g=rO(w,x.getBoundingClientRect()),S=oO(w,g),C=iO(y.getBoundingClientRect()),P=aO([...S,...C]);a(P),c(!0)},[c]);return h.useEffect(()=>()=>f(),[f]),h.useEffect(()=>{if(l&&d){const v=x=>m(x,d),y=x=>m(x,l);return l.addEventListener("pointerleave",v),d.addEventListener("pointerleave",y),()=>{l.removeEventListener("pointerleave",v),d.removeEventListener("pointerleave",y)}}},[l,d,m,f]),h.useEffect(()=>{if(s){const v=y=>{const x=y.target,w={x:y.clientX,y:y.clientY},g=(l==null?void 0:l.contains(x))||(d==null?void 0:d.contains(x)),S=!sO(w,s);g?f():S&&(f(),u())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[l,d,s,u,f]),p.jsx(LS,{...e,ref:i})}),[eO,tO]=Rc(Pc,{isInside:!1}),LS=h.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:i,onPointerDownOutside:s,...a}=e,l=Ga(Zi,n),u=Ec(n),{onClose:d}=l;return h.useEffect(()=>(document.addEventListener(wp,d),()=>document.removeEventListener(wp,d)),[d]),h.useEffect(()=>{if(l.trigger){const c=f=>{const m=f.target;m!=null&&m.contains(l.trigger)&&d()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[l.trigger,d]),p.jsx($a,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:c=>c.preventDefault(),onDismiss:d,children:p.jsxs(MS,{"data-state":l.stateAttribute,...u,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[p.jsx(ng,{children:r}),p.jsx(eO,{scope:n,isInside:!0,children:p.jsx(Wj,{id:l.contentId,role:"tooltip",children:o||r})})]})})});FS.displayName=Zi;var $S="TooltipArrow",nO=h.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Ec(n);return tO($S,n).isInside?null:p.jsx(kS,{...o,...r,ref:t})});nO.displayName=$S;function rO(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function oO(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function iO(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function sO(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;ir!=d>r&&n<(u-a)*(r-l)/(d-l)+a&&(o=!o)}return o}function aO(e){const t=e.slice();return t.sort((n,r)=>n.xr.x?1:n.yr.y?1:0),lO(t)}function lO(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r=2;){const i=t[t.length-1],s=t[t.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var uO=jS,cO=OS,dO=DS,fO=IS,US=FS;const pO=uO,hO=cO,gO=dO,zS=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(fO,{children:p.jsx(US,{ref:r,sideOffset:t,className:G("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));zS.displayName=US.displayName;const mO="sidebar:state",vO=60*60*24*7,yO="16rem",wO="18rem",xO="3rem",SO="b",BS=h.createContext(null);function _c(){const e=h.useContext(BS);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const VS=h.forwardRef(({defaultOpen:e=!0,open:t,onOpenChange:n,className:r,style:o,children:i,...s},a)=>{const l=JM(),[u,d]=h.useState(!1),[c,f]=h.useState(e),m=t??c,v=h.useCallback(g=>{if(n)return n==null?void 0:n(typeof g=="function"?g(m):g);f(g),document.cookie=`${mO}=${m}; path=/; max-age=${vO}`},[n,m]),y=h.useCallback(()=>l?d(g=>!g):v(g=>!g),[l,v,d]);h.useEffect(()=>{const g=S=>{S.key===SO&&(S.metaKey||S.ctrlKey)&&(S.preventDefault(),y())};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[y]);const x=m?"expanded":"collapsed",w=h.useMemo(()=>({state:x,open:m,setOpen:v,isMobile:l,openMobile:u,setOpenMobile:d,toggleSidebar:y}),[x,m,v,l,u,d,y]);return p.jsx(BS.Provider,{value:w,children:p.jsx(pO,{delayDuration:0,children:p.jsx("div",{style:{"--sidebar-width":yO,"--sidebar-width-icon":xO,...o},className:G("group/sidebar-wrapper flex min-h-svh w-full has-[[data-variant=inset]]:bg-sidebar",r),ref:a,...s,children:i})})})});VS.displayName="SidebarProvider";const HS=h.forwardRef(({side:e="left",variant:t="sidebar",collapsible:n="offcanvas",className:r,children:o,...i},s)=>{const{isMobile:a,state:l,openMobile:u,setOpenMobile:d}=_c();return n==="none"?p.jsx("div",{className:G("flex h-full w-[--sidebar-width] flex-col bg-sidebar text-sidebar-foreground",r),ref:s,...i,children:o}):a?p.jsx(jN,{open:u,onOpenChange:d,...i,children:p.jsx(uS,{"data-sidebar":"sidebar","data-mobile":"true",className:"w-[--sidebar-width] bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden",style:{"--sidebar-width":wO},side:e,children:p.jsx("div",{className:"flex h-full w-full flex-col",children:o})})}):p.jsxs("div",{ref:s,className:"group peer hidden md:block text-sidebar-foreground","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":t,"data-side":e,children:[p.jsx("div",{className:G("duration-200 relative h-svh w-[--sidebar-width] bg-transparent transition-[width] ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),p.jsx("div",{className:G("duration-200 fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...i,children:p.jsx("div",{"data-sidebar":"sidebar",className:"flex h-full w-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:border-sidebar-border group-data-[variant=floating]:shadow",children:o})})]})});HS.displayName="Sidebar";const KS=h.forwardRef(({className:e,onClick:t,...n},r)=>{const{toggleSidebar:o}=_c();return p.jsxs(Tt,{ref:r,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:G("h-7 w-7",e),onClick:i=>{t==null||t(i),o()},...n,children:[p.jsx(zM,{}),p.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});KS.displayName="SidebarTrigger";const GS=h.forwardRef(({className:e,...t},n)=>{const{toggleSidebar:r}=_c();return p.jsx("button",{ref:n,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:r,title:"Toggle Sidebar",className:G("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] hover:after:bg-sidebar-border group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full group-data-[collapsible=offcanvas]:hover:bg-sidebar","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...t})});GS.displayName="SidebarRail";const WS=h.forwardRef(({className:e,...t},n)=>p.jsx("main",{ref:n,className:G("relative flex min-h-[calc(100svh_-_4rem)] flex-1 flex-col bg-background","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...t}));WS.displayName="SidebarInset";const CO=h.forwardRef(({className:e,...t},n)=>p.jsx(ig,{ref:n,"data-sidebar":"input",className:G("h-8 w-full bg-background shadow-none focus-visible:ring-2 focus-visible:ring-sidebar-ring",e),...t}));CO.displayName="SidebarInput";const qS=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,"data-sidebar":"header",className:G("flex flex-col gap-2 p-2",e),...t}));qS.displayName="SidebarHeader";const QS=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,"data-sidebar":"footer",className:G("flex flex-col gap-2 p-2",e),...t}));QS.displayName="SidebarFooter";const Sp=h.forwardRef(({className:e,...t},n)=>p.jsx(A1,{ref:n,"data-sidebar":"separator",className:G("mx-2 w-auto bg-sidebar-border",e),...t}));Sp.displayName="SidebarSeparator";const YS=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,"data-sidebar":"content",className:G("flex min-h-0 flex-1 flex-col gap-2 p-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t}));YS.displayName="SidebarContent";const bO=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,"data-sidebar":"group",className:G("relative flex w-full min-w-0 flex-col p-2",e),...t}));bO.displayName="SidebarGroup";const RO=h.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const o=t?un:"div";return p.jsx(o,{ref:r,"data-sidebar":"group-label",className:G("duration-200 flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opa] ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...n})});RO.displayName="SidebarGroupLabel";const EO=h.forwardRef(({className:e,asChild:t=!1,...n},r)=>{const o=t?un:"button";return p.jsx(o,{ref:r,"data-sidebar":"group-action",className:G("absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...n})});EO.displayName="SidebarGroupAction";const PO=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,"data-sidebar":"group-content",className:G("w-full text-sm",e),...t}));PO.displayName="SidebarGroupContent";const XS=h.forwardRef(({className:e,...t},n)=>p.jsx("ul",{ref:n,"data-sidebar":"menu",className:G("flex w-full min-w-0 flex-col gap-1",e),...t}));XS.displayName="SidebarMenu";const po=h.forwardRef(({className:e,...t},n)=>p.jsx("li",{ref:n,"data-sidebar":"menu-item",className:G("group/menu-item relative",e),...t}));po.displayName="SidebarMenuItem";const _O=La("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),ho=h.forwardRef(({asChild:e=!1,isActive:t=!1,variant:n="default",size:r="default",tooltip:o,className:i,...s},a)=>{const l=e?un:"button",{isMobile:u,state:d}=_c(),c=p.jsx(l,{ref:a,"data-sidebar":"menu-button","data-size":r,"data-active":t,className:G(_O({variant:n,size:r}),i),...s});return o?(typeof o=="string"&&(o={children:o}),p.jsxs(hO,{children:[p.jsx(gO,{asChild:!0,children:c}),p.jsx(zS,{side:"right",align:"center",hidden:d!=="collapsed"||u,...o})]})):c});ho.displayName="SidebarMenuButton";const TO=h.forwardRef(({className:e,asChild:t=!1,showOnHover:n=!1,...r},o)=>{const i=t?un:"button";return p.jsx(i,{ref:o,"data-sidebar":"menu-action",className:G("absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground outline-none ring-sidebar-ring transition-transform hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 peer-hover/menu-button:text-sidebar-accent-foreground [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",n&&"group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground md:opacity-0",e),...r})});TO.displayName="SidebarMenuAction";const AO=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,"data-sidebar":"menu-badge",className:G("absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums text-sidebar-foreground select-none pointer-events-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...t}));AO.displayName="SidebarMenuBadge";const MO=h.forwardRef(({className:e,showIcon:t=!1,...n},r)=>{const o=h.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return p.jsxs("div",{ref:r,"data-sidebar":"menu-skeleton",className:G("rounded-md h-8 flex gap-2 px-2 items-center",e),...n,children:[t&&p.jsx(_y,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),p.jsx(_y,{className:"h-4 flex-1 max-w-[--skeleton-width]","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":o}})]})});MO.displayName="SidebarMenuSkeleton";const kO=h.forwardRef(({className:e,...t},n)=>p.jsx("ul",{ref:n,"data-sidebar":"menu-sub",className:G("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...t}));kO.displayName="SidebarMenuSub";const NO=h.forwardRef(({...e},t)=>p.jsx("li",{ref:t,...e}));NO.displayName="SidebarMenuSubItem";const jO=h.forwardRef(({asChild:e=!1,size:t="md",isActive:n,className:r,...o},i)=>{const s=e?un:"a";return p.jsx(s,{ref:i,"data-sidebar":"menu-sub-button","data-size":t,"data-active":n,className:G("flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground outline-none ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",r),...o})});jO.displayName="SidebarMenuSubButton";function OO(e,t=[]){let n=[];function r(i,s){const a=h.createContext(s),l=n.length;n=[...n,s];function u(c){const{scope:f,children:m,...v}=c,y=(f==null?void 0:f[e][l])||a,x=h.useMemo(()=>v,Object.values(v));return p.jsx(y.Provider,{value:x,children:m})}function d(c,f){const m=(f==null?void 0:f[e][l])||a,v=h.useContext(m);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${c}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const o=()=>{const i=n.map(s=>h.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,DO(o,...t)]}function DO(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const c=l(i)[`__scope${u}`];return{...a,...c}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}function Pg(e){const t=e+"CollectionProvider",[n,r]=OO(t),[o,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),s=m=>{const{scope:v,children:y}=m,x=xr.useRef(null),w=xr.useRef(new Map).current;return p.jsx(o,{scope:v,itemMap:w,collectionRef:x,children:y})};s.displayName=t;const a=e+"CollectionSlot",l=xr.forwardRef((m,v)=>{const{scope:y,children:x}=m,w=i(a,y),g=Le(v,w.collectionRef);return p.jsx(un,{ref:g,children:x})});l.displayName=a;const u=e+"CollectionItemSlot",d="data-radix-collection-item",c=xr.forwardRef((m,v)=>{const{scope:y,children:x,...w}=m,g=xr.useRef(null),S=Le(v,g),C=i(u,y);return xr.useEffect(()=>(C.itemMap.set(g,{ref:g,...w}),()=>void C.itemMap.delete(g))),p.jsx(un,{[d]:"",ref:S,children:x})});c.displayName=u;function f(m){const v=i(e+"CollectionConsumer",m);return xr.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${d}]`));return Array.from(v.itemMap.values()).sort((C,P)=>w.indexOf(C.ref.current)-w.indexOf(P.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:s,Slot:l,ItemSlot:c},f,r]}var IO=h.createContext(void 0);function _g(e){const t=h.useContext(IO);return e||t||"ltr"}function FO(e,t=[]){let n=[];function r(i,s){const a=h.createContext(s),l=n.length;n=[...n,s];function u(c){const{scope:f,children:m,...v}=c,y=(f==null?void 0:f[e][l])||a,x=h.useMemo(()=>v,Object.values(v));return p.jsx(y.Provider,{value:x,children:m})}function d(c,f){const m=(f==null?void 0:f[e][l])||a,v=h.useContext(m);if(v)return v;if(s!==void 0)return s;throw new Error(`\`${c}\` must be used within \`${i}\``)}return u.displayName=i+"Provider",[u,d]}const o=()=>{const i=n.map(s=>h.createContext(s));return function(a){const l=(a==null?void 0:a[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return o.scopeName=e,[r,LO(o,...t)]}function LO(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(i){const s=r.reduce((a,{useScope:l,scopeName:u})=>{const c=l(i)[`__scope${u}`];return{...a,...c}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:s}),[s])}};return n.scopeName=t.scopeName,n}var Od="rovingFocusGroup.onEntryFocus",$O={bubbles:!1,cancelable:!0},Tc="RovingFocusGroup",[Cp,JS,UO]=Pg(Tc),[zO,Ac]=FO(Tc,[UO]),[BO,VO]=zO(Tc),ZS=h.forwardRef((e,t)=>p.jsx(Cp.Provider,{scope:e.__scopeRovingFocusGroup,children:p.jsx(Cp.Slot,{scope:e.__scopeRovingFocusGroup,children:p.jsx(HO,{...e,ref:t})})}));ZS.displayName=Tc;var HO=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:i,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...c}=e,f=h.useRef(null),m=Le(t,f),v=_g(i),[y=null,x]=Wo({prop:s,defaultProp:a,onChange:l}),[w,g]=h.useState(!1),S=mt(u),C=JS(n),P=h.useRef(!1),[b,M]=h.useState(0);return h.useEffect(()=>{const A=f.current;if(A)return A.addEventListener(Od,S),()=>A.removeEventListener(Od,S)},[S]),p.jsx(BO,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:y,onItemFocus:h.useCallback(A=>x(A),[x]),onItemShiftTab:h.useCallback(()=>g(!0),[]),onFocusableItemAdd:h.useCallback(()=>M(A=>A+1),[]),onFocusableItemRemove:h.useCallback(()=>M(A=>A-1),[]),children:p.jsx(he.div,{tabIndex:w||b===0?-1:0,"data-orientation":r,...c,ref:m,style:{outline:"none",...e.style},onMouseDown:re(e.onMouseDown,()=>{P.current=!0}),onFocus:re(e.onFocus,A=>{const $=!P.current;if(A.target===A.currentTarget&&$&&!w){const R=new CustomEvent(Od,$O);if(A.currentTarget.dispatchEvent(R),!R.defaultPrevented){const O=C().filter(D=>D.focusable),F=O.find(D=>D.active),N=O.find(D=>D.id===y),T=[F,N,...O].filter(Boolean).map(D=>D.ref.current);nC(T,d)}}P.current=!1}),onBlur:re(e.onBlur,()=>g(!1))})})}),eC="RovingFocusGroupItem",tC=h.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:i,...s}=e,a=rr(),l=i||a,u=VO(eC,n),d=u.currentTabStopId===l,c=JS(n),{onFocusableItemAdd:f,onFocusableItemRemove:m}=u;return h.useEffect(()=>{if(r)return f(),()=>m()},[r,f,m]),p.jsx(Cp.ItemSlot,{scope:n,id:l,focusable:r,active:o,children:p.jsx(he.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:re(e.onMouseDown,v=>{r?u.onItemFocus(l):v.preventDefault()}),onFocus:re(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:re(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=WO(v,u.orientation,u.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=c().filter(g=>g.focusable).map(g=>g.ref.current);if(y==="last")w.reverse();else if(y==="prev"||y==="next"){y==="prev"&&w.reverse();const g=w.indexOf(v.currentTarget);w=u.loop?qO(w,g+1):w.slice(g+1)}setTimeout(()=>nC(w))}})})})});tC.displayName=eC;var KO={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function GO(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function WO(e,t,n){const r=GO(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return KO[r]}function nC(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function qO(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var rC=ZS,oC=tC,bp=["Enter"," "],QO=["ArrowDown","PageUp","Home"],iC=["ArrowUp","PageDown","End"],YO=[...QO,...iC],XO={ltr:[...bp,"ArrowRight"],rtl:[...bp,"ArrowLeft"]},JO={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Wa="Menu",[ba,ZO,eD]=Pg(Wa),[qo,sC]=pr(Wa,[eD,Cc,Ac]),Mc=Cc(),aC=Ac(),[tD,Qo]=qo(Wa),[nD,qa]=qo(Wa),lC=e=>{const{__scopeMenu:t,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=e,a=Mc(t),[l,u]=h.useState(null),d=h.useRef(!1),c=mt(i),f=_g(o);return h.useEffect(()=>{const m=()=>{d.current=!0,document.addEventListener("pointerdown",v,{capture:!0,once:!0}),document.addEventListener("pointermove",v,{capture:!0,once:!0})},v=()=>d.current=!1;return document.addEventListener("keydown",m,{capture:!0}),()=>{document.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("pointerdown",v,{capture:!0}),document.removeEventListener("pointermove",v,{capture:!0})}},[]),p.jsx(TS,{...a,children:p.jsx(tD,{scope:t,open:n,onOpenChange:c,content:l,onContentChange:u,children:p.jsx(nD,{scope:t,onClose:h.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:d,dir:f,modal:s,children:r})})})};lC.displayName=Wa;var rD="MenuAnchor",Tg=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Mc(n);return p.jsx(AS,{...o,...r,ref:t})});Tg.displayName=rD;var Ag="MenuPortal",[oD,uC]=qo(Ag,{forceMount:void 0}),cC=e=>{const{__scopeMenu:t,forceMount:n,children:r,container:o}=e,i=Qo(Ag,t);return p.jsx(oD,{scope:t,forceMount:n,children:p.jsx(Qt,{present:n||i.open,children:p.jsx(Ua,{asChild:!0,container:o,children:r})})})};cC.displayName=Ag;var sn="MenuContent",[iD,Mg]=qo(sn),dC=h.forwardRef((e,t)=>{const n=uC(sn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Qo(sn,e.__scopeMenu),s=qa(sn,e.__scopeMenu);return p.jsx(ba.Provider,{scope:e.__scopeMenu,children:p.jsx(Qt,{present:r||i.open,children:p.jsx(ba.Slot,{scope:e.__scopeMenu,children:s.modal?p.jsx(sD,{...o,ref:t}):p.jsx(aD,{...o,ref:t})})})})}),sD=h.forwardRef((e,t)=>{const n=Qo(sn,e.__scopeMenu),r=h.useRef(null),o=Le(t,r);return h.useEffect(()=>{const i=r.current;if(i)return V1(i)},[]),p.jsx(kg,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:re(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),aD=h.forwardRef((e,t)=>{const n=Qo(sn,e.__scopeMenu);return p.jsx(kg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),kg=h.forwardRef((e,t)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,disableOutsidePointerEvents:a,onEntryFocus:l,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:f,onDismiss:m,disableOutsideScroll:v,...y}=e,x=Qo(sn,n),w=qa(sn,n),g=Mc(n),S=aC(n),C=ZO(n),[P,b]=h.useState(null),M=h.useRef(null),A=Le(t,M,x.onContentChange),$=h.useRef(0),R=h.useRef(""),O=h.useRef(0),F=h.useRef(null),N=h.useRef("right"),E=h.useRef(0),T=v?lg:h.Fragment,D=v?{as:un,allowPinchZoom:!0}:void 0,V=j=>{var pe,Te;const B=R.current+j,Q=C().filter(we=>!we.disabled),te=document.activeElement,fe=(pe=Q.find(we=>we.ref.current===te))==null?void 0:pe.textValue,ge=Q.map(we=>we.textValue),z=wD(ge,B,fe),W=(Te=Q.find(we=>we.textValue===z))==null?void 0:Te.ref.current;(function we(tt){R.current=tt,window.clearTimeout($.current),tt!==""&&($.current=window.setTimeout(()=>we(""),1e3))})(B),W&&setTimeout(()=>W.focus())};h.useEffect(()=>()=>window.clearTimeout($.current),[]),O1();const L=h.useCallback(j=>{var Q,te;return N.current===((Q=F.current)==null?void 0:Q.side)&&SD(j,(te=F.current)==null?void 0:te.area)},[]);return p.jsx(iD,{scope:n,searchRef:R,onItemEnter:h.useCallback(j=>{L(j)&&j.preventDefault()},[L]),onItemLeave:h.useCallback(j=>{var B;L(j)||((B=M.current)==null||B.focus(),b(null))},[L]),onTriggerLeave:h.useCallback(j=>{L(j)&&j.preventDefault()},[L]),pointerGraceTimerRef:O,onPointerGraceIntentChange:h.useCallback(j=>{F.current=j},[]),children:p.jsx(T,{...D,children:p.jsx(ag,{asChild:!0,trapped:o,onMountAutoFocus:re(i,j=>{var B;j.preventDefault(),(B=M.current)==null||B.focus({preventScroll:!0})}),onUnmountAutoFocus:s,children:p.jsx($a,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:f,onDismiss:m,children:p.jsx(rC,{asChild:!0,...S,dir:w.dir,orientation:"vertical",loop:r,currentTabStopId:P,onCurrentTabStopIdChange:b,onEntryFocus:re(l,j=>{w.isUsingKeyboardRef.current||j.preventDefault()}),preventScrollOnEntryFocus:!0,children:p.jsx(MS,{role:"menu","aria-orientation":"vertical","data-state":_C(x.open),"data-radix-menu-content":"",dir:w.dir,...g,...y,ref:A,style:{outline:"none",...y.style},onKeyDown:re(y.onKeyDown,j=>{const Q=j.target.closest("[data-radix-menu-content]")===j.currentTarget,te=j.ctrlKey||j.altKey||j.metaKey,fe=j.key.length===1;Q&&(j.key==="Tab"&&j.preventDefault(),!te&&fe&&V(j.key));const ge=M.current;if(j.target!==ge||!YO.includes(j.key))return;j.preventDefault();const W=C().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);iC.includes(j.key)&&W.reverse(),vD(W)}),onBlur:re(e.onBlur,j=>{j.currentTarget.contains(j.target)||(window.clearTimeout($.current),R.current="")}),onPointerMove:re(e.onPointerMove,Ra(j=>{const B=j.target,Q=E.current!==j.clientX;if(j.currentTarget.contains(B)&&Q){const te=j.clientX>E.current?"right":"left";N.current=te,E.current=j.clientX}}))})})})})})})});dC.displayName=sn;var lD="MenuGroup",Ng=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(he.div,{role:"group",...r,ref:t})});Ng.displayName=lD;var uD="MenuLabel",fC=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(he.div,{...r,ref:t})});fC.displayName=uD;var Bu="MenuItem",Iy="menu.itemSelect",kc=h.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:r,...o}=e,i=h.useRef(null),s=qa(Bu,e.__scopeMenu),a=Mg(Bu,e.__scopeMenu),l=Le(t,i),u=h.useRef(!1),d=()=>{const c=i.current;if(!n&&c){const f=new CustomEvent(Iy,{bubbles:!0,cancelable:!0});c.addEventListener(Iy,m=>r==null?void 0:r(m),{once:!0}),sg(c,f),f.defaultPrevented?u.current=!1:s.onClose()}};return p.jsx(pC,{...o,ref:l,disabled:n,onClick:re(e.onClick,d),onPointerDown:c=>{var f;(f=e.onPointerDown)==null||f.call(e,c),u.current=!0},onPointerUp:re(e.onPointerUp,c=>{var f;u.current||(f=c.currentTarget)==null||f.click()}),onKeyDown:re(e.onKeyDown,c=>{const f=a.searchRef.current!=="";n||f&&c.key===" "||bp.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});kc.displayName=Bu;var pC=h.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:r=!1,textValue:o,...i}=e,s=Mg(Bu,n),a=aC(n),l=h.useRef(null),u=Le(t,l),[d,c]=h.useState(!1),[f,m]=h.useState("");return h.useEffect(()=>{const v=l.current;v&&m((v.textContent??"").trim())},[i.children]),p.jsx(ba.ItemSlot,{scope:n,disabled:r,textValue:o??f,children:p.jsx(oC,{asChild:!0,...a,focusable:!r,children:p.jsx(he.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:u,onPointerMove:re(e.onPointerMove,Ra(v=>{r?s.onItemLeave(v):(s.onItemEnter(v),v.defaultPrevented||v.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:re(e.onPointerLeave,Ra(v=>s.onItemLeave(v))),onFocus:re(e.onFocus,()=>c(!0)),onBlur:re(e.onBlur,()=>c(!1))})})})}),cD="MenuCheckboxItem",hC=h.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:r,...o}=e;return p.jsx(wC,{scope:e.__scopeMenu,checked:n,children:p.jsx(kc,{role:"menuitemcheckbox","aria-checked":Vu(n)?"mixed":n,...o,ref:t,"data-state":Og(n),onSelect:re(o.onSelect,()=>r==null?void 0:r(Vu(n)?!0:!n),{checkForDefaultPrevented:!1})})})});hC.displayName=cD;var gC="MenuRadioGroup",[dD,fD]=qo(gC,{value:void 0,onValueChange:()=>{}}),mC=h.forwardRef((e,t)=>{const{value:n,onValueChange:r,...o}=e,i=mt(r);return p.jsx(dD,{scope:e.__scopeMenu,value:n,onValueChange:i,children:p.jsx(Ng,{...o,ref:t})})});mC.displayName=gC;var vC="MenuRadioItem",yC=h.forwardRef((e,t)=>{const{value:n,...r}=e,o=fD(vC,e.__scopeMenu),i=n===o.value;return p.jsx(wC,{scope:e.__scopeMenu,checked:i,children:p.jsx(kc,{role:"menuitemradio","aria-checked":i,...r,ref:t,"data-state":Og(i),onSelect:re(r.onSelect,()=>{var s;return(s=o.onValueChange)==null?void 0:s.call(o,n)},{checkForDefaultPrevented:!1})})})});yC.displayName=vC;var jg="MenuItemIndicator",[wC,pD]=qo(jg,{checked:!1}),xC=h.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:r,...o}=e,i=pD(jg,n);return p.jsx(Qt,{present:r||Vu(i.checked)||i.checked===!0,children:p.jsx(he.span,{...o,ref:t,"data-state":Og(i.checked)})})});xC.displayName=jg;var hD="MenuSeparator",SC=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e;return p.jsx(he.div,{role:"separator","aria-orientation":"horizontal",...r,ref:t})});SC.displayName=hD;var gD="MenuArrow",CC=h.forwardRef((e,t)=>{const{__scopeMenu:n,...r}=e,o=Mc(n);return p.jsx(kS,{...o,...r,ref:t})});CC.displayName=gD;var mD="MenuSub",[EL,bC]=qo(mD),$s="MenuSubTrigger",RC=h.forwardRef((e,t)=>{const n=Qo($s,e.__scopeMenu),r=qa($s,e.__scopeMenu),o=bC($s,e.__scopeMenu),i=Mg($s,e.__scopeMenu),s=h.useRef(null),{pointerGraceTimerRef:a,onPointerGraceIntentChange:l}=i,u={__scopeMenu:e.__scopeMenu},d=h.useCallback(()=>{s.current&&window.clearTimeout(s.current),s.current=null},[]);return h.useEffect(()=>d,[d]),h.useEffect(()=>{const c=a.current;return()=>{window.clearTimeout(c),l(null)}},[a,l]),p.jsx(Tg,{asChild:!0,...u,children:p.jsx(pC,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":o.contentId,"data-state":_C(n.open),...e,ref:gc(t,o.onTriggerChange),onClick:c=>{var f;(f=e.onClick)==null||f.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:re(e.onPointerMove,Ra(c=>{i.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!n.open&&!s.current&&(i.onPointerGraceIntentChange(null),s.current=window.setTimeout(()=>{n.onOpenChange(!0),d()},100))})),onPointerLeave:re(e.onPointerLeave,Ra(c=>{var m,v;d();const f=(m=n.content)==null?void 0:m.getBoundingClientRect();if(f){const y=(v=n.content)==null?void 0:v.dataset.side,x=y==="right",w=x?-5:5,g=f[x?"left":"right"],S=f[x?"right":"left"];i.onPointerGraceIntentChange({area:[{x:c.clientX+w,y:c.clientY},{x:g,y:f.top},{x:S,y:f.top},{x:S,y:f.bottom},{x:g,y:f.bottom}],side:y}),window.clearTimeout(a.current),a.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(c),c.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:re(e.onKeyDown,c=>{var m;const f=i.searchRef.current!=="";e.disabled||f&&c.key===" "||XO[r.dir].includes(c.key)&&(n.onOpenChange(!0),(m=n.content)==null||m.focus(),c.preventDefault())})})})});RC.displayName=$s;var EC="MenuSubContent",PC=h.forwardRef((e,t)=>{const n=uC(sn,e.__scopeMenu),{forceMount:r=n.forceMount,...o}=e,i=Qo(sn,e.__scopeMenu),s=qa(sn,e.__scopeMenu),a=bC(EC,e.__scopeMenu),l=h.useRef(null),u=Le(t,l);return p.jsx(ba.Provider,{scope:e.__scopeMenu,children:p.jsx(Qt,{present:r||i.open,children:p.jsx(ba.Slot,{scope:e.__scopeMenu,children:p.jsx(kg,{id:a.contentId,"aria-labelledby":a.triggerId,...o,ref:u,align:"start",side:s.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:d=>{var c;s.isUsingKeyboardRef.current&&((c=l.current)==null||c.focus()),d.preventDefault()},onCloseAutoFocus:d=>d.preventDefault(),onFocusOutside:re(e.onFocusOutside,d=>{d.target!==a.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:re(e.onEscapeKeyDown,d=>{s.onClose(),d.preventDefault()}),onKeyDown:re(e.onKeyDown,d=>{var m;const c=d.currentTarget.contains(d.target),f=JO[s.dir].includes(d.key);c&&f&&(i.onOpenChange(!1),(m=a.trigger)==null||m.focus(),d.preventDefault())})})})})})});PC.displayName=EC;function _C(e){return e?"open":"closed"}function Vu(e){return e==="indeterminate"}function Og(e){return Vu(e)?"indeterminate":e?"checked":"unchecked"}function vD(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function yD(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function wD(e,t,n){const o=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let s=yD(e,Math.max(i,0));o.length===1&&(s=s.filter(u=>u!==n));const l=s.find(u=>u.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function xD(e,t){const{x:n,y:r}=e;let o=!1;for(let i=0,s=t.length-1;ir!=d>r&&n<(u-a)*(r-l)/(d-l)+a&&(o=!o)}return o}function SD(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return xD(n,t)}function Ra(e){return t=>t.pointerType==="mouse"?e(t):void 0}var CD=lC,bD=Tg,RD=cC,ED=dC,PD=Ng,_D=fC,TD=kc,AD=hC,MD=mC,kD=yC,ND=xC,jD=SC,OD=CC,DD=RC,ID=PC,Dg="DropdownMenu",[FD,PL]=pr(Dg,[sC]),bt=sC(),[LD,TC]=FD(Dg),AC=e=>{const{__scopeDropdownMenu:t,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:a=!0}=e,l=bt(t),u=h.useRef(null),[d=!1,c]=Wo({prop:o,defaultProp:i,onChange:s});return p.jsx(LD,{scope:t,triggerId:rr(),triggerRef:u,contentId:rr(),open:d,onOpenChange:c,onOpenToggle:h.useCallback(()=>c(f=>!f),[c]),modal:a,children:p.jsx(CD,{...l,open:d,onOpenChange:c,dir:r,modal:a,children:n})})};AC.displayName=Dg;var MC="DropdownMenuTrigger",kC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...o}=e,i=TC(MC,n),s=bt(n);return p.jsx(bD,{asChild:!0,...s,children:p.jsx(he.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...o,ref:gc(t,i.triggerRef),onPointerDown:re(e.onPointerDown,a=>{!r&&a.button===0&&a.ctrlKey===!1&&(i.onOpenToggle(),i.open||a.preventDefault())}),onKeyDown:re(e.onKeyDown,a=>{r||(["Enter"," "].includes(a.key)&&i.onOpenToggle(),a.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(a.key)&&a.preventDefault())})})})});kC.displayName=MC;var $D="DropdownMenuPortal",NC=e=>{const{__scopeDropdownMenu:t,...n}=e,r=bt(t);return p.jsx(RD,{...r,...n})};NC.displayName=$D;var jC="DropdownMenuContent",OC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=TC(jC,n),i=bt(n),s=h.useRef(!1);return p.jsx(ED,{id:o.contentId,"aria-labelledby":o.triggerId,...i,...r,ref:t,onCloseAutoFocus:re(e.onCloseAutoFocus,a=>{var l;s.current||(l=o.triggerRef.current)==null||l.focus(),s.current=!1,a.preventDefault()}),onInteractOutside:re(e.onInteractOutside,a=>{const l=a.detail.originalEvent,u=l.button===0&&l.ctrlKey===!0,d=l.button===2||u;(!o.modal||d)&&(s.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});OC.displayName=jC;var UD="DropdownMenuGroup",zD=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(PD,{...o,...r,ref:t})});zD.displayName=UD;var BD="DropdownMenuLabel",DC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(_D,{...o,...r,ref:t})});DC.displayName=BD;var VD="DropdownMenuItem",IC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(TD,{...o,...r,ref:t})});IC.displayName=VD;var HD="DropdownMenuCheckboxItem",FC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(AD,{...o,...r,ref:t})});FC.displayName=HD;var KD="DropdownMenuRadioGroup",LC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(MD,{...o,...r,ref:t})});LC.displayName=KD;var GD="DropdownMenuRadioItem",$C=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(kD,{...o,...r,ref:t})});$C.displayName=GD;var WD="DropdownMenuItemIndicator",UC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(ND,{...o,...r,ref:t})});UC.displayName=WD;var qD="DropdownMenuSeparator",zC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(jD,{...o,...r,ref:t})});zC.displayName=qD;var QD="DropdownMenuArrow",YD=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(OD,{...o,...r,ref:t})});YD.displayName=QD;var XD="DropdownMenuSubTrigger",BC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(DD,{...o,...r,ref:t})});BC.displayName=XD;var JD="DropdownMenuSubContent",VC=h.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...r}=e,o=bt(n);return p.jsx(ID,{...o,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});VC.displayName=JD;var ZD=AC,eI=kC,tI=NC,HC=OC,KC=DC,GC=IC,WC=FC,nI=LC,qC=$C,QC=UC,YC=zC,XC=BC,JC=VC;const Ea=ZD,Pa=eI,rI=nI,oI=h.forwardRef(({className:e,inset:t,children:n,...r},o)=>p.jsxs(XC,{ref:o,className:G("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent",t&&"pl-8",e),...r,children:[n,p.jsx(aS,{className:"ml-auto h-4 w-4"})]}));oI.displayName=XC.displayName;const iI=h.forwardRef(({className:e,...t},n)=>p.jsx(JC,{ref:n,className:G("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...t}));iI.displayName=JC.displayName;const es=h.forwardRef(({className:e,sideOffset:t=4,...n},r)=>p.jsx(tI,{children:p.jsx(HC,{ref:r,sideOffset:t,className:G("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));es.displayName=HC.displayName;const zt=h.forwardRef(({className:e,inset:t,...n},r)=>p.jsx(GC,{ref:r,className:G("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",t&&"pl-8",e),...n}));zt.displayName=GC.displayName;const sI=h.forwardRef(({className:e,children:t,checked:n,...r},o)=>p.jsxs(WC,{ref:o,className:G("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:n,...r,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(QC,{children:p.jsx(RN,{className:"h-4 w-4"})})}),t]}));sI.displayName=WC.displayName;const Rp=h.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(qC,{ref:r,className:G("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(QC,{children:p.jsx(MN,{className:"h-4 w-4 fill-current"})})}),t]}));Rp.displayName=qC.displayName;const Ig=h.forwardRef(({className:e,inset:t,...n},r)=>p.jsx(KC,{ref:r,className:G("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));Ig.displayName=KC.displayName;const Nc=h.forwardRef(({className:e,...t},n)=>p.jsx(YC,{ref:n,className:G("-mx-1 my-1 h-px bg-muted",e),...t}));Nc.displayName=YC.displayName;var Fg="Avatar",[aI,_L]=pr(Fg),[lI,ZC]=aI(Fg),eb=h.forwardRef((e,t)=>{const{__scopeAvatar:n,...r}=e,[o,i]=h.useState("idle");return p.jsx(lI,{scope:n,imageLoadingStatus:o,onImageLoadingStatusChange:i,children:p.jsx(he.span,{...r,ref:t})})});eb.displayName=Fg;var tb="AvatarImage",nb=h.forwardRef((e,t)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:o=()=>{},...i}=e,s=ZC(tb,n),a=uI(r,i.referrerPolicy),l=mt(u=>{o(u),s.onImageLoadingStatusChange(u)});return Cn(()=>{a!=="idle"&&l(a)},[a,l]),a==="loaded"?p.jsx(he.img,{...i,ref:t,src:r}):null});nb.displayName=tb;var rb="AvatarFallback",ob=h.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:r,...o}=e,i=ZC(rb,n),[s,a]=h.useState(r===void 0);return h.useEffect(()=>{if(r!==void 0){const l=window.setTimeout(()=>a(!0),r);return()=>window.clearTimeout(l)}},[r]),s&&i.imageLoadingStatus!=="loaded"?p.jsx(he.span,{...o,ref:t}):null});ob.displayName=rb;function uI(e,t){const[n,r]=h.useState("idle");return Cn(()=>{if(!e){r("error");return}let o=!0;const i=new window.Image,s=a=>()=>{o&&r(a)};return r("loading"),i.onload=s("loaded"),i.onerror=s("error"),i.src=e,t&&(i.referrerPolicy=t),()=>{o=!1}},[e,t]),n}var ib=eb,sb=nb,ab=ob;const lb=h.forwardRef(({className:e,...t},n)=>p.jsx(ib,{ref:n,className:G("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));lb.displayName=ib.displayName;const ub=h.forwardRef(({className:e,...t},n)=>p.jsx(sb,{ref:n,className:G("aspect-square h-full w-full",e),...t}));ub.displayName=sb.displayName;const cb=h.forwardRef(({className:e,...t},n)=>p.jsx(ab,{ref:n,className:G("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));cb.displayName=ab.displayName;const db=({user:e})=>{var n,r,o,i,s,a,l,u;const t=wM(e.name);return p.jsx(lb,{className:"h-8 w-8",children:(r=(n=e.photo)==null?void 0:n[0])!=null&&r.url||(i=(o=e.photo)==null?void 0:o[0])!=null&&i.data?p.jsx(ub,{src:((a=(s=e.photo)==null?void 0:s[0])==null?void 0:a.url)||((u=(l=e.photo)==null?void 0:l[0])==null?void 0:u.data),alt:name}):p.jsx(cb,{className:e.resourceType==="Patient"?"bg-pink-400 text-pink-50":"bg-teal-400 text-teal-50",children:t})})},cI=()=>{const{user:e}=Go(),t=Ko(),n=as(),r=()=>{var o;(o=t._clearState)==null||o.call(t),n("/"),window.location.reload()};return p.jsxs(Ea,{children:[p.jsx(Pa,{asChild:!0,children:p.jsxs(Tt,{variant:"ghost",className:"flex items-center h-11",children:[p.jsx(db,{user:e}),p.jsx("span",{className:"hidden md:block",children:us(e.name)}),p.jsx(E1,{className:"h-4 w-4 opacity-50"})]})}),p.jsxs(es,{align:"end",className:"w-56",children:[p.jsxs(zt,{children:[p.jsx(QM,{}),e.resourceType," profile"]}),p.jsxs(zt,{children:[p.jsx(HM,{}),"Settings"]}),p.jsx(Nc,{}),p.jsxs(zt,{onClick:r,children:[p.jsx(UM,{className:"h-4 w-4"}),p.jsx("span",{children:"Log out"})]})]})]})};function dI({title:e}){return p.jsxs("header",{className:"flex h-16 items-center border-b px-4 flex-shrink-0 gap-4",children:[p.jsx(KS,{}),e,p.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[p.jsxs(Tt,{variant:"ghost",size:"icon",children:[p.jsx(jM,{className:"h-5 w-5"}),p.jsx("span",{className:"sr-only",children:"Notifications"})]}),p.jsx(cI,{})]})]})}const Hu=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:G("rounded-xl border bg-card text-card-foreground shadow",e),...t}));Hu.displayName="Card";const Ku=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:G("flex flex-col space-y-1.5 p-6",e),...t}));Ku.displayName="CardHeader";const Gu=h.forwardRef(({className:e,...t},n)=>p.jsx("h3",{ref:n,className:G("font-semibold leading-none tracking-tight",e),...t}));Gu.displayName="CardTitle";const Ep=h.forwardRef(({className:e,...t},n)=>p.jsx("p",{ref:n,className:G("text-sm text-muted-foreground",e),...t}));Ep.displayName="CardDescription";const Lg=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:G("p-6 pt-0",e),...t}));Lg.displayName="CardContent";const Pp=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{ref:n,className:G("flex items-center p-6 pt-0",e),...t}));Pp.displayName="CardFooter";const fI=()=>{const{patient:e,user:t}=Go();if(!e||t.resourceType==="Patient")return;const n=us(e.name),r=e.birthDate?new Date().getFullYear()-new Date(e.birthDate).getFullYear():"unknown",o=e.address?vM(e.address):"unknown",i=yM(e.gender);return p.jsxs(Hu,{className:"mx-4 mb-4 shadow-none",children:[p.jsxs(Ku,{className:"px-4 space-y-0 py-2 border-b flex-row items-center",children:[p.jsx(Gu,{children:"Current Patient"}),p.jsxs(Ea,{children:[p.jsx(Pa,{asChild:!0,children:p.jsxs(Tt,{variant:"ghost",className:"h-8 w-8 ml-auto",children:[p.jsx("span",{className:"sr-only",children:"Open menu"}),p.jsx(og,{className:"h-4 w-4"})]})}),p.jsx(es,{align:"start",children:p.jsxs(zt,{onClick:()=>navigator.clipboard.writeText(e.id),children:[p.jsx(rg,{}),"Copy ID"]})})]})]}),p.jsxs(Lg,{className:"px-4 py-3",children:[p.jsxs("div",{className:"flex items-start gap-3 mb-2",children:[p.jsx(db,{user:e}),p.jsxs("div",{className:"flex flex-col text-sm",children:[p.jsx("div",{className:" font-medium",children:n}),p.jsxs("div",{className:"text-xs text-muted-foreground",children:[i,", ",r," years old"]})]})]}),p.jsx("div",{className:"text-xs text-muted-foreground",children:o})]})]})},pI=()=>{const{user:e}=Go(),t=Vo();return p.jsxs(HS,{className:"border-r",children:[p.jsx(qS,{className:"h-16 items-center flex-row px-4",children:p.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:e.resourceType==="Patient"?"Patient Portal":"Provider EHR"})}),p.jsx(YS,{children:p.jsxs(XS,{children:[p.jsx(po,{children:p.jsx(ho,{asChild:!0,isActive:t.pathname==="/",children:p.jsxs(Ys,{to:"/",children:[p.jsx(LM,{className:"mr-2 h-5 w-5"}),"Dashboard"]})})}),e.resourceType==="Practitioner"&&p.jsxs(p.Fragment,{children:[p.jsx(po,{children:p.jsxs(ho,{children:[p.jsx(XM,{className:"mr-2 h-5 w-5"}),"Patients"]})}),p.jsx(po,{children:p.jsxs(ho,{children:[p.jsx(DM,{className:"mr-2 h-5 w-5"}),"Appointments"]})}),p.jsx(Sp,{}),p.jsx(po,{children:p.jsx(ho,{asChild:!0,isActive:t.pathname==="/questionnaires",children:p.jsxs(Ys,{to:"/questionnaires",children:[p.jsx(FM,{className:"mr-2 h-5 w-5"}),"Questionnaires"]})})})]}),p.jsx(po,{children:p.jsx(ho,{asChild:!0,isActive:t.pathname==="/questionnaire-responses",children:p.jsxs(Ys,{to:"/questionnaire-responses",children:[p.jsx(GM,{className:"mr-2 h-5 w-5"}),"Questionnaire Responses"]})})}),p.jsx(Sp,{}),p.jsx(po,{children:p.jsxs(ho,{children:[p.jsx(KM,{className:"mr-2 h-5 w-5"}),"Settings"]})})]})}),p.jsx(QS,{children:p.jsx(fI,{})}),p.jsx(GS,{})]})},fb=e=>p.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 300 150",...e,children:p.jsx("path",{fill:"none",stroke:"#EA4A35",strokeWidth:"15",strokeLinecap:"round",strokeDasharray:"300 385",strokeDashoffset:"0",d:"M275 75c0 31-27 50-50 50-58 0-92-100-150-100-28 0-50 22-50 50s23 50 50 50c58 0 92-100 150-100 24 0 50 19 50 50Z",children:p.jsx("animate",{attributeName:"stroke-dashoffset",calcMode:"spline",dur:"2",values:"685;-685",keySplines:"0 0 1 1",repeatCount:"indefinite"})})}),$g=()=>p.jsx("div",{className:"flex-1 grid place-items-center",children:p.jsx(fb,{width:"80"})}),hI=()=>p.jsx(DA,{children:p.jsx(FA,{children:p.jsx(VS,{style:{"--sidebar-width":"18rem"},children:p.jsx("div",{className:"flex h-screen flex-col w-full",children:p.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[p.jsx(pI,{}),p.jsxs(WS,{className:"flex-1",children:[p.jsx(dI,{}),p.jsx(h.Suspense,{fallback:p.jsx($g,{}),children:p.jsx(jx,{})})]})]})})})})});/** * table-core * * Copyright (c) TanStack @@ -266,10 +266,10 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Br(e,t){return typeof e=="function"?e(t):e}function Gt(e,t){return n=>{t.setState(r=>({...r,[e]:Br(n,r[e])}))}}function jc(e){return e instanceof Function}function fI(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function pI(e,t){const n=[],r=o=>{o.forEach(i=>{n.push(i);const s=t(i);s!=null&&s.length&&r(s)})};return r(e),n}function le(e,t,n){let r=[],o;return i=>{let s;n.key&&n.debug&&(s=Date.now());const a=e(i);if(!(a.length!==r.length||a.some((d,c)=>r[c]!==d)))return o;r=a;let u;if(n.key&&n.debug&&(u=Date.now()),o=t(...a),n==null||n.onChange==null||n.onChange(o),n.key&&n.debug&&n!=null&&n.debug()){const d=Math.round((Date.now()-s)*100)/100,c=Math.round((Date.now()-u)*100)/100,f=c/16,m=(v,y)=>{for(v=String(v);v.length{t.setState(r=>({...r,[e]:Br(n,r[e])}))}}function jc(e){return e instanceof Function}function gI(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function mI(e,t){const n=[],r=o=>{o.forEach(i=>{n.push(i);const s=t(i);s!=null&&s.length&&r(s)})};return r(e),n}function le(e,t,n){let r=[],o;return i=>{let s;n.key&&n.debug&&(s=Date.now());const a=e(i);if(!(a.length!==r.length||a.some((d,c)=>r[c]!==d)))return o;r=a;let u;if(n.key&&n.debug&&(u=Date.now()),o=t(...a),n==null||n.onChange==null||n.onChange(o),n.key&&n.debug&&n!=null&&n.debug()){const d=Math.round((Date.now()-s)*100)/100,c=Math.round((Date.now()-u)*100)/100,f=c/16,m=(v,y)=>{for(v=String(v);v.length{var o;return(o=e==null?void 0:e.debugAll)!=null?o:e[t]},key:!1,onChange:r}}function hI(e,t,n,r){const o=()=>{var s;return(s=i.getValue())!=null?s:e.options.renderFallbackValue},i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:o,getContext:le(()=>[e,n,t,i],(s,a,l,u)=>({table:s,column:a,row:l,cell:u,getValue:u.getValue,renderValue:u.renderValue}),ue(e.options,"debugCells"))};return e._features.forEach(s=>{s.createCell==null||s.createCell(i,n,t,e)},{}),i}function gI(e,t,n,r){var o,i;const a={...e._getDefaultColumnDef(),...t},l=a.accessorKey;let u=(o=(i=a.id)!=null?i:l?typeof String.prototype.replaceAll=="function"?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)!=null?o:typeof a.header=="string"?a.header:void 0,d;if(a.accessorFn?d=a.accessorFn:l&&(l.includes(".")?d=f=>{let m=f;for(const y of l.split(".")){var v;m=(v=m)==null?void 0:v[y]}return m}:d=f=>f[a.accessorKey]),!u)throw new Error;let c={id:`${String(u)}`,accessorFn:d,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:le(()=>[!0],()=>{var f;return[c,...(f=c.columns)==null?void 0:f.flatMap(m=>m.getFlatColumns())]},ue(e.options,"debugColumns")),getLeafColumns:le(()=>[e._getOrderColumnsFn()],f=>{var m;if((m=c.columns)!=null&&m.length){let v=c.columns.flatMap(y=>y.getLeafColumns());return f(v)}return[c]},ue(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(c,e);return c}const ft="debugHeaders";function Dy(e,t,n){var r;let i={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const s=[],a=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(a),s.push(l)};return a(i),s},getContext:()=>({table:e,header:i,column:t})};return e._features.forEach(s=>{s.createHeader==null||s.createHeader(i,e)}),i}const mI={createTable:e=>{e.getHeaderGroups=le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>{var i,s;const a=(i=r==null?void 0:r.map(c=>n.find(f=>f.id===c)).filter(Boolean))!=null?i:[],l=(s=o==null?void 0:o.map(c=>n.find(f=>f.id===c)).filter(Boolean))!=null?s:[],u=n.filter(c=>!(r!=null&&r.includes(c.id))&&!(o!=null&&o.includes(c.id)));return Ml(t,[...a,...u,...l],e)},ue(e.options,ft)),e.getCenterHeaderGroups=le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>(n=n.filter(i=>!(r!=null&&r.includes(i.id))&&!(o!=null&&o.includes(i.id))),Ml(t,n,e,"center")),ue(e.options,ft)),e.getLeftHeaderGroups=le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var o;const i=(o=r==null?void 0:r.map(s=>n.find(a=>a.id===s)).filter(Boolean))!=null?o:[];return Ml(t,i,e,"left")},ue(e.options,ft)),e.getRightHeaderGroups=le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var o;const i=(o=r==null?void 0:r.map(s=>n.find(a=>a.id===s)).filter(Boolean))!=null?o:[];return Ml(t,i,e,"right")},ue(e.options,ft)),e.getFooterGroups=le(()=>[e.getHeaderGroups()],t=>[...t].reverse(),ue(e.options,ft)),e.getLeftFooterGroups=le(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),ue(e.options,ft)),e.getCenterFooterGroups=le(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),ue(e.options,ft)),e.getRightFooterGroups=le(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),ue(e.options,ft)),e.getFlatHeaders=le(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),ue(e.options,ft)),e.getLeftFlatHeaders=le(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),ue(e.options,ft)),e.getCenterFlatHeaders=le(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),ue(e.options,ft)),e.getRightFlatHeaders=le(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),ue(e.options,ft)),e.getCenterLeafHeaders=le(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),ue(e.options,ft)),e.getLeftLeafHeaders=le(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),ue(e.options,ft)),e.getRightLeafHeaders=le(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),ue(e.options,ft)),e.getLeafHeaders=le(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var o,i,s,a,l,u;return[...(o=(i=t[0])==null?void 0:i.headers)!=null?o:[],...(s=(a=n[0])==null?void 0:a.headers)!=null?s:[],...(l=(u=r[0])==null?void 0:u.headers)!=null?l:[]].map(d=>d.getLeafHeaders()).flat()},ue(e.options,ft))}};function Ml(e,t,n,r){var o,i;let s=0;const a=function(f,m){m===void 0&&(m=1),s=Math.max(s,m),f.filter(v=>v.getIsVisible()).forEach(v=>{var y;(y=v.columns)!=null&&y.length&&a(v.columns,m+1)},0)};a(e);let l=[];const u=(f,m)=>{const v={depth:m,id:[r,`${m}`].filter(Boolean).join("_"),headers:[]},y=[];f.forEach(x=>{const w=[...y].reverse()[0],g=x.column.depth===v.depth;let S,C=!1;if(g&&x.column.parent?S=x.column.parent:(S=x.column,C=!0),w&&(w==null?void 0:w.column)===S)w.subHeaders.push(x);else{const P=Dy(n,S,{id:[r,m,S.id,x==null?void 0:x.id].filter(Boolean).join("_"),isPlaceholder:C,placeholderId:C?`${y.filter(b=>b.column===S).length}`:void 0,depth:m,index:y.length});P.subHeaders.push(x),y.push(P)}v.headers.push(x),x.headerGroup=v}),l.push(v),m>0&&u(y,m-1)},d=t.map((f,m)=>Dy(n,f,{depth:s,index:m}));u(d,s-1),l.reverse();const c=f=>f.filter(v=>v.column.getIsVisible()).map(v=>{let y=0,x=0,w=[0];v.subHeaders&&v.subHeaders.length?(w=[],c(v.subHeaders).forEach(S=>{let{colSpan:C,rowSpan:P}=S;y+=C,w.push(P)})):y=1;const g=Math.min(...w);return x=x+g,v.colSpan=y,v.rowSpan=x,{colSpan:y,rowSpan:x}});return c((o=(i=l[0])==null?void 0:i.headers)!=null?o:[]),l}const vI=(e,t,n,r,o,i,s)=>{let a={id:t,index:r,original:n,depth:o,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(a._valuesCache.hasOwnProperty(l))return a._valuesCache[l];const u=e.getColumn(l);if(u!=null&&u.accessorFn)return a._valuesCache[l]=u.accessorFn(a.original,r),a._valuesCache[l]},getUniqueValues:l=>{if(a._uniqueValuesCache.hasOwnProperty(l))return a._uniqueValuesCache[l];const u=e.getColumn(l);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(a._uniqueValuesCache[l]=u.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[l]):(a._uniqueValuesCache[l]=[a.getValue(l)],a._uniqueValuesCache[l])},renderValue:l=>{var u;return(u=a.getValue(l))!=null?u:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>pI(a.subRows,l=>l.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let l=[],u=a;for(;;){const d=u.getParentRow();if(!d)break;l.push(d),u=d}return l.reverse()},getAllCells:le(()=>[e.getAllLeafColumns()],l=>l.map(u=>hI(e,a,u,u.id)),ue(e.options,"debugRows")),_getAllCellsByColumnId:le(()=>[a.getAllCells()],l=>l.reduce((u,d)=>(u[d.column.id]=d,u),{}),ue(e.options,"debugRows"))};for(let l=0;l{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},db=(e,t,n)=>{var r,o;const i=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((o=e.getValue(t))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(i))};db.autoRemove=e=>xn(e);const fb=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};fb.autoRemove=e=>xn(e);const pb=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};pb.autoRemove=e=>xn(e);const hb=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};hb.autoRemove=e=>xn(e)||!(e!=null&&e.length);const gb=(e,t,n)=>!n.some(r=>{var o;return!((o=e.getValue(t))!=null&&o.includes(r))});gb.autoRemove=e=>xn(e)||!(e!=null&&e.length);const mb=(e,t,n)=>n.some(r=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(r)});mb.autoRemove=e=>xn(e)||!(e!=null&&e.length);const vb=(e,t,n)=>e.getValue(t)===n;vb.autoRemove=e=>xn(e);const yb=(e,t,n)=>e.getValue(t)==n;yb.autoRemove=e=>xn(e);const $g=(e,t,n)=>{let[r,o]=n;const i=e.getValue(t);return i>=r&&i<=o};$g.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,o=typeof n!="number"?parseFloat(n):n,i=t===null||Number.isNaN(r)?-1/0:r,s=n===null||Number.isNaN(o)?1/0:o;if(i>s){const a=i;i=s,s=a}return[i,s]};$g.autoRemove=e=>xn(e)||xn(e[0])&&xn(e[1]);const Qn={includesString:db,includesStringSensitive:fb,equalsString:pb,arrIncludes:hb,arrIncludesAll:gb,arrIncludesSome:mb,equals:vb,weakEquals:yb,inNumberRange:$g};function xn(e){return e==null||e===""}const wI={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Gt("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?Qn.includesString:typeof r=="number"?Qn.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?Qn.equals:Array.isArray(r)?Qn.arrIncludes:Qn.weakEquals},e.getFilterFn=()=>{var n,r;return jc(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:Qn[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,o;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const o=e.getFilterFn(),i=r==null?void 0:r.find(d=>d.id===e.id),s=Br(n,i?i.value:void 0);if(Iy(o,s,e)){var a;return(a=r==null?void 0:r.filter(d=>d.id!==e.id))!=null?a:[]}const l={id:e.id,value:s};if(i){var u;return(u=r==null?void 0:r.map(d=>d.id===e.id?l:d))!=null?u:[]}return r!=null&&r.length?[...r,l]:[l]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=o=>{var i;return(i=Br(t,o))==null?void 0:i.filter(s=>{const a=n.find(l=>l.id===s.id);if(a){const l=a.getFilterFn();if(Iy(l,s.value,a))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Iy(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const xI=(e,t,n)=>n.reduce((r,o)=>{const i=o.getValue(e);return r+(typeof i=="number"?i:0)},0),SI=(e,t,n)=>{let r;return n.forEach(o=>{const i=o.getValue(e);i!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}),r},CI=(e,t,n)=>{let r;return n.forEach(o=>{const i=o.getValue(e);i!=null&&(r=i)&&(r=i)}),r},bI=(e,t,n)=>{let r,o;return n.forEach(i=>{const s=i.getValue(e);s!=null&&(r===void 0?s>=s&&(r=o=s):(r>s&&(r=s),o{let n=0,r=0;if(t.forEach(o=>{let i=o.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},EI=(e,t)=>{if(!t.length)return;const n=t.map(i=>i.getValue(e));if(!fI(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),o=n.sort((i,s)=>i-s);return n.length%2!==0?o[r]:(o[r-1]+o[r])/2},PI=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),_I=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,TI=(e,t)=>t.length,Dd={sum:xI,min:SI,max:CI,extent:bI,mean:RI,median:EI,unique:PI,uniqueCount:_I,count:TI},AI={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Gt("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return Dd.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Dd.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return jc(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:Dd[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=n.subRows)!=null&&o.length)}}};function MI(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(i=>!t.includes(i.id));return n==="remove"?r:[...t.map(i=>e.find(s=>s.id===i)).filter(Boolean),...r]}const kI={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Gt("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=le(n=>[Zs(t,n)],n=>n.findIndex(r=>r.id===e.id),ue(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=Zs(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const o=Zs(t,n);return((r=o[o.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=le(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>o=>{let i=[];if(!(t!=null&&t.length))i=o;else{const s=[...t],a=[...o];for(;a.length&&s.length;){const l=s.shift(),u=a.findIndex(d=>d.id===l);u>-1&&i.push(a.splice(u,1)[0])}i=[...i,...a]}return MI(i,n,r)},ue(e.options,"debugTable"))}},Id=()=>({left:[],right:[]}),NI={getInitialState:e=>({columnPinning:Id(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Gt("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(o=>o.id).filter(Boolean);t.setColumnPinning(o=>{var i,s;if(n==="right"){var a,l;return{left:((a=o==null?void 0:o.left)!=null?a:[]).filter(c=>!(r!=null&&r.includes(c))),right:[...((l=o==null?void 0:o.right)!=null?l:[]).filter(c=>!(r!=null&&r.includes(c))),...r]}}if(n==="left"){var u,d;return{left:[...((u=o==null?void 0:o.left)!=null?u:[]).filter(c=>!(r!=null&&r.includes(c))),...r],right:((d=o==null?void 0:o.right)!=null?d:[]).filter(c=>!(r!=null&&r.includes(c)))}}return{left:((i=o==null?void 0:o.left)!=null?i:[]).filter(c=>!(r!=null&&r.includes(c))),right:((s=o==null?void 0:o.right)!=null?s:[]).filter(c=>!(r!=null&&r.includes(c)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var o,i,s;return((o=r.columnDef.enablePinning)!=null?o:!0)&&((i=(s=t.options.enableColumnPinning)!=null?s:t.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(a=>a.id),{left:r,right:o}=t.getState().columnPinning,i=n.some(a=>r==null?void 0:r.includes(a)),s=n.some(a=>o==null?void 0:o.includes(a));return i?"left":s?"right":!1},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();return o?(n=(r=t.getState().columnPinning)==null||(r=r[o])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,o)=>{const i=[...r??[],...o??[]];return n.filter(s=>!i.includes(s.column.id))},ue(t.options,"debugRows")),e.getLeftVisibleCells=le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(i=>n.find(s=>s.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),ue(t.options,"debugRows")),e.getRightVisibleCells=le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(i=>n.find(s=>s.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),ue(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?Id():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:Id())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var o,i;return!!((o=r.left)!=null&&o.length||(i=r.right)!=null&&i.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(o=>o.id===r)).filter(Boolean),ue(e.options,"debugColumns")),e.getRightLeafColumns=le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(o=>o.id===r)).filter(Boolean),ue(e.options,"debugColumns")),e.getCenterLeafColumns=le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const o=[...n??[],...r??[]];return t.filter(i=>!o.includes(i.id))},ue(e.options,"debugColumns"))}},kl={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Fd=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),jI={getDefaultColumnDef:()=>kl,getInitialState:e=>({columnSizing:{},columnSizingInfo:Fd(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Gt("columnSizing",e),onColumnSizingInfoChange:Gt("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,o;const i=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:kl.minSize,(r=i??e.columnDef.size)!=null?r:kl.size),(o=e.columnDef.maxSize)!=null?o:kl.maxSize)},e.getStart=le(n=>[n,Zs(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((o,i)=>o+i.getSize(),0),ue(t.options,"debugColumns")),e.getAfter=le(n=>[n,Zs(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((o,i)=>o+i.getSize(),0),ue(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...o}=n;return o})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=o=>{if(o.subHeaders.length)o.subHeaders.forEach(r);else{var i;n+=(i=o.column.getSize())!=null?i:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),o=r==null?void 0:r.getCanResize();return i=>{if(!r||!o||(i.persist==null||i.persist(),Ld(i)&&i.touches&&i.touches.length>1))return;const s=e.getSize(),a=e?e.getLeafHeaders().map(w=>[w.column.id,w.column.getSize()]):[[r.id,r.getSize()]],l=Ld(i)?Math.round(i.touches[0].clientX):i.clientX,u={},d=(w,g)=>{typeof g=="number"&&(t.setColumnSizingInfo(S=>{var C,P;const b=t.options.columnResizeDirection==="rtl"?-1:1,M=(g-((C=S==null?void 0:S.startOffset)!=null?C:0))*b,A=Math.max(M/((P=S==null?void 0:S.startSize)!=null?P:0),-.999999);return S.columnSizingStart.forEach($=>{let[R,O]=$;u[R]=Math.round(Math.max(O+O*A,0)*100)/100}),{...S,deltaOffset:M,deltaPercentage:A}}),(t.options.columnResizeMode==="onChange"||w==="end")&&t.setColumnSizing(S=>({...S,...u})))},c=w=>d("move",w),f=w=>{d("end",w),t.setColumnSizingInfo(g=>({...g,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},m=n||typeof document<"u"?document:null,v={moveHandler:w=>c(w.clientX),upHandler:w=>{m==null||m.removeEventListener("mousemove",v.moveHandler),m==null||m.removeEventListener("mouseup",v.upHandler),f(w.clientX)}},y={moveHandler:w=>(w.cancelable&&(w.preventDefault(),w.stopPropagation()),c(w.touches[0].clientX),!1),upHandler:w=>{var g;m==null||m.removeEventListener("touchmove",y.moveHandler),m==null||m.removeEventListener("touchend",y.upHandler),w.cancelable&&(w.preventDefault(),w.stopPropagation()),f((g=w.touches[0])==null?void 0:g.clientX)}},x=OI()?{passive:!1}:!1;Ld(i)?(m==null||m.addEventListener("touchmove",y.moveHandler,x),m==null||m.addEventListener("touchend",y.upHandler,x)):(m==null||m.addEventListener("mousemove",v.moveHandler,x),m==null||m.addEventListener("mouseup",v.upHandler,x)),t.setColumnSizingInfo(w=>({...w,startOffset:l,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?Fd():(n=e.initialState.columnSizingInfo)!=null?n:Fd())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0}}};let Nl=null;function OI(){if(typeof Nl=="boolean")return Nl;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Nl=e,Nl}function Ld(e){return e.type==="touchstart"}const DI={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Gt("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const o=e.columns;return(n=o.length?o.some(i=>i.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=le(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),ue(t.options,"debugRows")),e.getVisibleCells=le(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,o)=>[...n,...r,...o],ue(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>le(()=>[r(),r().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),ue(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,i)=>({...o,[i.id]:n||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function Zs(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const II={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},FI={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Gt("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,o,i;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&((i=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Qn.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return jc(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:Qn[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},LI={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Gt("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,o;if(!t){e._queue(()=>{t=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var o,i;e.setExpanded(r?{}:(o=(i=e.initialState)==null?void 0:i.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const s=i.split(".");r=Math.max(r,s.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var o;const i=r===!0?!0:!!(r!=null&&r[e.id]);let s={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(a=>{s[a]=!0}):s=r,n=(o=n)!=null?o:!i,!i&&n)return{...s,[e.id]:!0};if(i&&!n){const{[e.id]:a,...l}=s;return l}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},e.getCanExpand=()=>{var n,r,o;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},Pp=0,_p=10,$d=()=>({pageIndex:Pp,pageSize:_p}),$I={getInitialState:e=>({...e,pagination:{...$d(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Gt("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,o;if(!t){e._queue(()=>{t=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const o=i=>Br(r,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=r=>{var o;e.setPagination(r?$d():(o=e.initialState.pagination)!=null?o:$d())},e.setPageIndex=r=>{e.setPagination(o=>{let i=Br(r,o.pageIndex);const s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,s)),{...o,pageIndex:i}})},e.resetPageIndex=r=>{var o,i;e.setPageIndex(r?Pp:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?o:Pp)},e.resetPageSize=r=>{var o,i;e.setPageSize(r?_p:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?o:_p)},e.setPageSize=r=>{e.setPagination(o=>{const i=Math.max(1,Br(r,o.pageSize)),s=o.pageSize*o.pageIndex,a=Math.floor(s/i);return{...o,pageIndex:a,pageSize:i}})},e.setPageCount=r=>e.setPagination(o=>{var i;let s=Br(r,(i=e.options.pageCount)!=null?i:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...o,pageCount:s}}),e.getPageOptions=le(()=>[e.getPageCount()],r=>{let o=[];return r&&r>0&&(o=[...new Array(r)].fill(null).map((i,s)=>s)),o},ue(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},Ud=()=>({top:[],bottom:[]}),UI={getInitialState:e=>({rowPinning:Ud(),...e}),getDefaultOptions:e=>({onRowPinningChange:Gt("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,o)=>{const i=r?e.getLeafRows().map(l=>{let{id:u}=l;return u}):[],s=o?e.getParentRows().map(l=>{let{id:u}=l;return u}):[],a=new Set([...s,e.id,...i]);t.setRowPinning(l=>{var u,d;if(n==="bottom"){var c,f;return{top:((c=l==null?void 0:l.top)!=null?c:[]).filter(y=>!(a!=null&&a.has(y))),bottom:[...((f=l==null?void 0:l.bottom)!=null?f:[]).filter(y=>!(a!=null&&a.has(y))),...Array.from(a)]}}if(n==="top"){var m,v;return{top:[...((m=l==null?void 0:l.top)!=null?m:[]).filter(y=>!(a!=null&&a.has(y))),...Array.from(a)],bottom:((v=l==null?void 0:l.bottom)!=null?v:[]).filter(y=>!(a!=null&&a.has(y)))}}return{top:((u=l==null?void 0:l.top)!=null?u:[]).filter(y=>!(a!=null&&a.has(y))),bottom:((d=l==null?void 0:l.bottom)!=null?d:[]).filter(y=>!(a!=null&&a.has(y)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:o}=t.options;return typeof r=="function"?r(e):(n=r??o)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:o}=t.getState().rowPinning,i=n.some(a=>r==null?void 0:r.includes(a)),s=n.some(a=>o==null?void 0:o.includes(a));return i?"top":s?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();if(!o)return-1;const i=(n=o==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(s=>{let{id:a}=s;return a});return(r=i==null?void 0:i.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?Ud():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:Ud())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var o,i;return!!((o=r.top)!=null&&o.length||(i=r.bottom)!=null&&i.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(n??[]).map(s=>{const a=e.getRow(s,!0);return a.getIsAllParentsExpanded()?a:null}):(n??[]).map(s=>t.find(a=>a.id===s))).filter(Boolean).map(s=>({...s,position:r}))},e.getTopRows=le(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),ue(e.options,"debugRows")),e.getBottomRows=le(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),ue(e.options,"debugRows")),e.getCenterRows=le(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const o=new Set([...n??[],...r??[]]);return t.filter(i=>!o.has(i.id))},ue(e.options,"debugRows"))}},zI={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Gt("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(i=>{i.getCanSelect()&&(r[i.id]=!0)}):o.forEach(i=>{delete r[i.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach(i=>{Tp(o,i.id,r,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=le(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?zd(e,n):{rows:[],flatRows:[],rowsById:{}},ue(e.options,"debugTable")),e.getFilteredSelectedRowModel=le(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?zd(e,n):{rows:[],flatRows:[],rowsById:{}},ue(e.options,"debugTable")),e.getGroupedSelectedRowModel=le(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?zd(e,n):{rows:[],flatRows:[],rowsById:{}},ue(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(o=>o.getCanSelect()&&!n[o.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(o=>!n[o.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const o=e.getIsSelected();t.setRowSelection(i=>{var s;if(n=typeof n<"u"?n:!o,e.getCanSelect()&&o===n)return i;const a={...i};return Tp(a,e.id,n,(s=r==null?void 0:r.selectChildren)!=null?s:!0,t),a})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return Ug(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return Ap(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return Ap(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var o;n&&e.toggleSelected((o=r.target)==null?void 0:o.checked)}}}},Tp=(e,t,n,r,o)=>{var i;const s=o.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(a=>delete e[a]),s.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(i=s.subRows)!=null&&i.length&&s.getCanSelectSubRows()&&s.subRows.forEach(a=>Tp(e,a.id,n,r,o))};function zd(e,t){const n=e.getState().rowSelection,r=[],o={},i=function(s,a){return s.map(l=>{var u;const d=Ug(l,n);if(d&&(r.push(l),o[l.id]=l),(u=l.subRows)!=null&&u.length&&(l={...l,subRows:i(l.subRows)}),d)return l}).filter(Boolean)};return{rows:i(t.rows),flatRows:r,rowsById:o}}function Ug(e,t){var n;return(n=t[e.id])!=null?n:!1}function Ap(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let o=!0,i=!1;return e.subRows.forEach(s=>{if(!(i&&!o)&&(s.getCanSelect()&&(Ug(s,t)?i=!0:o=!1),s.subRows&&s.subRows.length)){const a=Ap(s,t);a==="all"?i=!0:(a==="some"&&(i=!0),o=!1)}}),o?"all":i?"some":!1}const Mp=/([0-9]+)/gm,BI=(e,t,n)=>wb(ro(e.getValue(n)).toLowerCase(),ro(t.getValue(n)).toLowerCase()),VI=(e,t,n)=>wb(ro(e.getValue(n)),ro(t.getValue(n))),HI=(e,t,n)=>zg(ro(e.getValue(n)).toLowerCase(),ro(t.getValue(n)).toLowerCase()),KI=(e,t,n)=>zg(ro(e.getValue(n)),ro(t.getValue(n))),GI=(e,t,n)=>{const r=e.getValue(n),o=t.getValue(n);return r>o?1:rzg(e.getValue(n),t.getValue(n));function zg(e,t){return e===t?0:e>t?1:-1}function ro(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function wb(e,t){const n=e.split(Mp).filter(Boolean),r=t.split(Mp).filter(Boolean);for(;n.length&&r.length;){const o=n.shift(),i=r.shift(),s=parseInt(o,10),a=parseInt(i,10),l=[s,a].sort();if(isNaN(l[0])){if(o>i)return 1;if(i>o)return-1;continue}if(isNaN(l[1]))return isNaN(s)?-1:1;if(s>a)return 1;if(a>s)return-1}return n.length-r.length}const ks={alphanumeric:BI,alphanumericCaseSensitive:VI,text:HI,textCaseSensitive:KI,datetime:GI,basic:WI},qI={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Gt("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const o of n){const i=o==null?void 0:o.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return ks.datetime;if(typeof i=="string"&&(r=!0,i.split(Mp).length>1))return ks.alphanumeric}return r?ks.text:ks.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return jc(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:ks[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const o=e.getNextSortingOrder(),i=typeof n<"u"&&n!==null;t.setSorting(s=>{const a=s==null?void 0:s.find(m=>m.id===e.id),l=s==null?void 0:s.findIndex(m=>m.id===e.id);let u=[],d,c=i?n:o==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&r?a?d="toggle":d="add":s!=null&&s.length&&l!==s.length-1?d="replace":a?d="toggle":d="replace",d==="toggle"&&(i||o||(d="remove")),d==="add"){var f;u=[...s,{id:e.id,desc:c}],u.splice(0,u.length-((f=t.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else d==="toggle"?u=s.map(m=>m.id===e.id?{...m,desc:c}:m):d==="remove"?u=s.filter(m=>m.id!==e.id):u=[{id:e.id,desc:c}];return u})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,o;const i=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==i&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(o=t.options.enableMultiRemove)!=null)||o)?!1:s==="desc"?"asc":"desc":i},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(o=>o.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},QI=[mI,DI,kI,NI,yI,wI,II,FI,qI,AI,LI,$I,UI,zI,jI];function YI(e){var t,n;const r=[...QI,...(t=e._features)!=null?t:[]];let o={_features:r};const i=o._features.reduce((f,m)=>Object.assign(f,m.getDefaultOptions==null?void 0:m.getDefaultOptions(o)),{}),s=f=>o.options.mergeOptions?o.options.mergeOptions(i,f):{...i,...f};let l={...{},...(n=e.initialState)!=null?n:{}};o._features.forEach(f=>{var m;l=(m=f.getInitialState==null?void 0:f.getInitialState(l))!=null?m:l});const u=[];let d=!1;const c={_features:r,options:{...i,...e},initialState:l,_queue:f=>{u.push(f),d||(d=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();d=!1}).catch(m=>setTimeout(()=>{throw m})))},reset:()=>{o.setState(o.initialState)},setOptions:f=>{const m=Br(f,o.options);o.options=s(m)},getState:()=>o.options.state,setState:f=>{o.options.onStateChange==null||o.options.onStateChange(f)},_getRowId:(f,m,v)=>{var y;return(y=o.options.getRowId==null?void 0:o.options.getRowId(f,m,v))!=null?y:`${v?[v.id,m].join("."):m}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(f,m)=>{let v=(m?o.getPrePaginationRowModel():o.getRowModel()).rowsById[f];if(!v&&(v=o.getCoreRowModel().rowsById[f],!v))throw new Error;return v},_getDefaultColumnDef:le(()=>[o.options.defaultColumn],f=>{var m;return f=(m=f)!=null?m:{},{header:v=>{const y=v.header.column.columnDef;return y.accessorKey?y.accessorKey:y.accessorFn?y.id:null},cell:v=>{var y,x;return(y=(x=v.renderValue())==null||x.toString==null?void 0:x.toString())!=null?y:null},...o._features.reduce((v,y)=>Object.assign(v,y.getDefaultColumnDef==null?void 0:y.getDefaultColumnDef()),{}),...f}},ue(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:le(()=>[o._getColumnDefs()],f=>{const m=function(v,y,x){return x===void 0&&(x=0),v.map(w=>{const g=gI(o,w,x,y),S=w;return g.columns=S.columns?m(S.columns,g,x+1):[],g})};return m(f)},ue(e,"debugColumns")),getAllFlatColumns:le(()=>[o.getAllColumns()],f=>f.flatMap(m=>m.getFlatColumns()),ue(e,"debugColumns")),_getAllFlatColumnsById:le(()=>[o.getAllFlatColumns()],f=>f.reduce((m,v)=>(m[v.id]=v,m),{}),ue(e,"debugColumns")),getAllLeafColumns:le(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(f,m)=>{let v=f.flatMap(y=>y.getLeafColumns());return m(v)},ue(e,"debugColumns")),getColumn:f=>o._getAllFlatColumnsById()[f]};Object.assign(o,c);for(let f=0;fle(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(o,i,s){i===void 0&&(i=0);const a=[];for(let u=0;ue._autoResetPageIndex()))}/** + color: hsl(${Math.max(0,Math.min(120-120*f,120))}deg 100% 31%);`,n==null?void 0:n.key)}return o}}function ue(e,t,n,r){return{debug:()=>{var o;return(o=e==null?void 0:e.debugAll)!=null?o:e[t]},key:!1,onChange:r}}function vI(e,t,n,r){const o=()=>{var s;return(s=i.getValue())!=null?s:e.options.renderFallbackValue},i={id:`${t.id}_${n.id}`,row:t,column:n,getValue:()=>t.getValue(r),renderValue:o,getContext:le(()=>[e,n,t,i],(s,a,l,u)=>({table:s,column:a,row:l,cell:u,getValue:u.getValue,renderValue:u.renderValue}),ue(e.options,"debugCells"))};return e._features.forEach(s=>{s.createCell==null||s.createCell(i,n,t,e)},{}),i}function yI(e,t,n,r){var o,i;const a={...e._getDefaultColumnDef(),...t},l=a.accessorKey;let u=(o=(i=a.id)!=null?i:l?typeof String.prototype.replaceAll=="function"?l.replaceAll(".","_"):l.replace(/\./g,"_"):void 0)!=null?o:typeof a.header=="string"?a.header:void 0,d;if(a.accessorFn?d=a.accessorFn:l&&(l.includes(".")?d=f=>{let m=f;for(const y of l.split(".")){var v;m=(v=m)==null?void 0:v[y]}return m}:d=f=>f[a.accessorKey]),!u)throw new Error;let c={id:`${String(u)}`,accessorFn:d,parent:r,depth:n,columnDef:a,columns:[],getFlatColumns:le(()=>[!0],()=>{var f;return[c,...(f=c.columns)==null?void 0:f.flatMap(m=>m.getFlatColumns())]},ue(e.options,"debugColumns")),getLeafColumns:le(()=>[e._getOrderColumnsFn()],f=>{var m;if((m=c.columns)!=null&&m.length){let v=c.columns.flatMap(y=>y.getLeafColumns());return f(v)}return[c]},ue(e.options,"debugColumns"))};for(const f of e._features)f.createColumn==null||f.createColumn(c,e);return c}const ft="debugHeaders";function Fy(e,t,n){var r;let i={id:(r=n.id)!=null?r:t.id,column:t,index:n.index,isPlaceholder:!!n.isPlaceholder,placeholderId:n.placeholderId,depth:n.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const s=[],a=l=>{l.subHeaders&&l.subHeaders.length&&l.subHeaders.map(a),s.push(l)};return a(i),s},getContext:()=>({table:e,header:i,column:t})};return e._features.forEach(s=>{s.createHeader==null||s.createHeader(i,e)}),i}const wI={createTable:e=>{e.getHeaderGroups=le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>{var i,s;const a=(i=r==null?void 0:r.map(c=>n.find(f=>f.id===c)).filter(Boolean))!=null?i:[],l=(s=o==null?void 0:o.map(c=>n.find(f=>f.id===c)).filter(Boolean))!=null?s:[],u=n.filter(c=>!(r!=null&&r.includes(c.id))&&!(o!=null&&o.includes(c.id)));return Ml(t,[...a,...u,...l],e)},ue(e.options,ft)),e.getCenterHeaderGroups=le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r,o)=>(n=n.filter(i=>!(r!=null&&r.includes(i.id))&&!(o!=null&&o.includes(i.id))),Ml(t,n,e,"center")),ue(e.options,ft)),e.getLeftHeaderGroups=le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,n,r)=>{var o;const i=(o=r==null?void 0:r.map(s=>n.find(a=>a.id===s)).filter(Boolean))!=null?o:[];return Ml(t,i,e,"left")},ue(e.options,ft)),e.getRightHeaderGroups=le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,n,r)=>{var o;const i=(o=r==null?void 0:r.map(s=>n.find(a=>a.id===s)).filter(Boolean))!=null?o:[];return Ml(t,i,e,"right")},ue(e.options,ft)),e.getFooterGroups=le(()=>[e.getHeaderGroups()],t=>[...t].reverse(),ue(e.options,ft)),e.getLeftFooterGroups=le(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),ue(e.options,ft)),e.getCenterFooterGroups=le(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),ue(e.options,ft)),e.getRightFooterGroups=le(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),ue(e.options,ft)),e.getFlatHeaders=le(()=>[e.getHeaderGroups()],t=>t.map(n=>n.headers).flat(),ue(e.options,ft)),e.getLeftFlatHeaders=le(()=>[e.getLeftHeaderGroups()],t=>t.map(n=>n.headers).flat(),ue(e.options,ft)),e.getCenterFlatHeaders=le(()=>[e.getCenterHeaderGroups()],t=>t.map(n=>n.headers).flat(),ue(e.options,ft)),e.getRightFlatHeaders=le(()=>[e.getRightHeaderGroups()],t=>t.map(n=>n.headers).flat(),ue(e.options,ft)),e.getCenterLeafHeaders=le(()=>[e.getCenterFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),ue(e.options,ft)),e.getLeftLeafHeaders=le(()=>[e.getLeftFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),ue(e.options,ft)),e.getRightLeafHeaders=le(()=>[e.getRightFlatHeaders()],t=>t.filter(n=>{var r;return!((r=n.subHeaders)!=null&&r.length)}),ue(e.options,ft)),e.getLeafHeaders=le(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,n,r)=>{var o,i,s,a,l,u;return[...(o=(i=t[0])==null?void 0:i.headers)!=null?o:[],...(s=(a=n[0])==null?void 0:a.headers)!=null?s:[],...(l=(u=r[0])==null?void 0:u.headers)!=null?l:[]].map(d=>d.getLeafHeaders()).flat()},ue(e.options,ft))}};function Ml(e,t,n,r){var o,i;let s=0;const a=function(f,m){m===void 0&&(m=1),s=Math.max(s,m),f.filter(v=>v.getIsVisible()).forEach(v=>{var y;(y=v.columns)!=null&&y.length&&a(v.columns,m+1)},0)};a(e);let l=[];const u=(f,m)=>{const v={depth:m,id:[r,`${m}`].filter(Boolean).join("_"),headers:[]},y=[];f.forEach(x=>{const w=[...y].reverse()[0],g=x.column.depth===v.depth;let S,C=!1;if(g&&x.column.parent?S=x.column.parent:(S=x.column,C=!0),w&&(w==null?void 0:w.column)===S)w.subHeaders.push(x);else{const P=Fy(n,S,{id:[r,m,S.id,x==null?void 0:x.id].filter(Boolean).join("_"),isPlaceholder:C,placeholderId:C?`${y.filter(b=>b.column===S).length}`:void 0,depth:m,index:y.length});P.subHeaders.push(x),y.push(P)}v.headers.push(x),x.headerGroup=v}),l.push(v),m>0&&u(y,m-1)},d=t.map((f,m)=>Fy(n,f,{depth:s,index:m}));u(d,s-1),l.reverse();const c=f=>f.filter(v=>v.column.getIsVisible()).map(v=>{let y=0,x=0,w=[0];v.subHeaders&&v.subHeaders.length?(w=[],c(v.subHeaders).forEach(S=>{let{colSpan:C,rowSpan:P}=S;y+=C,w.push(P)})):y=1;const g=Math.min(...w);return x=x+g,v.colSpan=y,v.rowSpan=x,{colSpan:y,rowSpan:x}});return c((o=(i=l[0])==null?void 0:i.headers)!=null?o:[]),l}const xI=(e,t,n,r,o,i,s)=>{let a={id:t,index:r,original:n,depth:o,parentId:s,_valuesCache:{},_uniqueValuesCache:{},getValue:l=>{if(a._valuesCache.hasOwnProperty(l))return a._valuesCache[l];const u=e.getColumn(l);if(u!=null&&u.accessorFn)return a._valuesCache[l]=u.accessorFn(a.original,r),a._valuesCache[l]},getUniqueValues:l=>{if(a._uniqueValuesCache.hasOwnProperty(l))return a._uniqueValuesCache[l];const u=e.getColumn(l);if(u!=null&&u.accessorFn)return u.columnDef.getUniqueValues?(a._uniqueValuesCache[l]=u.columnDef.getUniqueValues(a.original,r),a._uniqueValuesCache[l]):(a._uniqueValuesCache[l]=[a.getValue(l)],a._uniqueValuesCache[l])},renderValue:l=>{var u;return(u=a.getValue(l))!=null?u:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>mI(a.subRows,l=>l.subRows),getParentRow:()=>a.parentId?e.getRow(a.parentId,!0):void 0,getParentRows:()=>{let l=[],u=a;for(;;){const d=u.getParentRow();if(!d)break;l.push(d),u=d}return l.reverse()},getAllCells:le(()=>[e.getAllLeafColumns()],l=>l.map(u=>vI(e,a,u,u.id)),ue(e.options,"debugRows")),_getAllCellsByColumnId:le(()=>[a.getAllCells()],l=>l.reduce((u,d)=>(u[d.column.id]=d,u),{}),ue(e.options,"debugRows"))};for(let l=0;l{e._getFacetedRowModel=t.options.getFacetedRowModel&&t.options.getFacetedRowModel(t,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():t.getPreFilteredRowModel(),e._getFacetedUniqueValues=t.options.getFacetedUniqueValues&&t.options.getFacetedUniqueValues(t,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=t.options.getFacetedMinMaxValues&&t.options.getFacetedMinMaxValues(t,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},pb=(e,t,n)=>{var r,o;const i=n==null||(r=n.toString())==null?void 0:r.toLowerCase();return!!(!((o=e.getValue(t))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(i))};pb.autoRemove=e=>xn(e);const hb=(e,t,n)=>{var r;return!!(!((r=e.getValue(t))==null||(r=r.toString())==null)&&r.includes(n))};hb.autoRemove=e=>xn(e);const gb=(e,t,n)=>{var r;return((r=e.getValue(t))==null||(r=r.toString())==null?void 0:r.toLowerCase())===(n==null?void 0:n.toLowerCase())};gb.autoRemove=e=>xn(e);const mb=(e,t,n)=>{var r;return(r=e.getValue(t))==null?void 0:r.includes(n)};mb.autoRemove=e=>xn(e)||!(e!=null&&e.length);const vb=(e,t,n)=>!n.some(r=>{var o;return!((o=e.getValue(t))!=null&&o.includes(r))});vb.autoRemove=e=>xn(e)||!(e!=null&&e.length);const yb=(e,t,n)=>n.some(r=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(r)});yb.autoRemove=e=>xn(e)||!(e!=null&&e.length);const wb=(e,t,n)=>e.getValue(t)===n;wb.autoRemove=e=>xn(e);const xb=(e,t,n)=>e.getValue(t)==n;xb.autoRemove=e=>xn(e);const Ug=(e,t,n)=>{let[r,o]=n;const i=e.getValue(t);return i>=r&&i<=o};Ug.resolveFilterValue=e=>{let[t,n]=e,r=typeof t!="number"?parseFloat(t):t,o=typeof n!="number"?parseFloat(n):n,i=t===null||Number.isNaN(r)?-1/0:r,s=n===null||Number.isNaN(o)?1/0:o;if(i>s){const a=i;i=s,s=a}return[i,s]};Ug.autoRemove=e=>xn(e)||xn(e[0])&&xn(e[1]);const Qn={includesString:pb,includesStringSensitive:hb,equalsString:gb,arrIncludes:mb,arrIncludesAll:vb,arrIncludesSome:yb,equals:wb,weakEquals:xb,inNumberRange:Ug};function xn(e){return e==null||e===""}const CI={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Gt("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);return typeof r=="string"?Qn.includesString:typeof r=="number"?Qn.inNumberRange:typeof r=="boolean"||r!==null&&typeof r=="object"?Qn.equals:Array.isArray(r)?Qn.arrIncludes:Qn.weakEquals},e.getFilterFn=()=>{var n,r;return jc(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(n=(r=t.options.filterFns)==null?void 0:r[e.columnDef.filterFn])!=null?n:Qn[e.columnDef.filterFn]},e.getCanFilter=()=>{var n,r,o;return((n=e.columnDef.enableColumnFilter)!=null?n:!0)&&((r=t.options.enableColumnFilters)!=null?r:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var n;return(n=t.getState().columnFilters)==null||(n=n.find(r=>r.id===e.id))==null?void 0:n.value},e.getFilterIndex=()=>{var n,r;return(n=(r=t.getState().columnFilters)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?n:-1},e.setFilterValue=n=>{t.setColumnFilters(r=>{const o=e.getFilterFn(),i=r==null?void 0:r.find(d=>d.id===e.id),s=Br(n,i?i.value:void 0);if(Ly(o,s,e)){var a;return(a=r==null?void 0:r.filter(d=>d.id!==e.id))!=null?a:[]}const l={id:e.id,value:s};if(i){var u;return(u=r==null?void 0:r.map(d=>d.id===e.id?l:d))!=null?u:[]}return r!=null&&r.length?[...r,l]:[l]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const n=e.getAllLeafColumns(),r=o=>{var i;return(i=Br(t,o))==null?void 0:i.filter(s=>{const a=n.find(l=>l.id===s.id);if(a){const l=a.getFilterFn();if(Ly(l,s.value,a))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(r)},e.resetColumnFilters=t=>{var n,r;e.setColumnFilters(t?[]:(n=(r=e.initialState)==null?void 0:r.columnFilters)!=null?n:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function Ly(e,t,n){return(e&&e.autoRemove?e.autoRemove(t,n):!1)||typeof t>"u"||typeof t=="string"&&!t}const bI=(e,t,n)=>n.reduce((r,o)=>{const i=o.getValue(e);return r+(typeof i=="number"?i:0)},0),RI=(e,t,n)=>{let r;return n.forEach(o=>{const i=o.getValue(e);i!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}),r},EI=(e,t,n)=>{let r;return n.forEach(o=>{const i=o.getValue(e);i!=null&&(r=i)&&(r=i)}),r},PI=(e,t,n)=>{let r,o;return n.forEach(i=>{const s=i.getValue(e);s!=null&&(r===void 0?s>=s&&(r=o=s):(r>s&&(r=s),o{let n=0,r=0;if(t.forEach(o=>{let i=o.getValue(e);i!=null&&(i=+i)>=i&&(++n,r+=i)}),n)return r/n},TI=(e,t)=>{if(!t.length)return;const n=t.map(i=>i.getValue(e));if(!gI(n))return;if(n.length===1)return n[0];const r=Math.floor(n.length/2),o=n.sort((i,s)=>i-s);return n.length%2!==0?o[r]:(o[r-1]+o[r])/2},AI=(e,t)=>Array.from(new Set(t.map(n=>n.getValue(e))).values()),MI=(e,t)=>new Set(t.map(n=>n.getValue(e))).size,kI=(e,t)=>t.length,Dd={sum:bI,min:RI,max:EI,extent:PI,mean:_I,median:TI,unique:AI,uniqueCount:MI,count:kI},NI={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,n;return(t=(n=e.getValue())==null||n.toString==null?void 0:n.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Gt("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(n=>n!=null&&n.includes(e.id)?n.filter(r=>r!==e.id):[...n??[],e.id])},e.getCanGroup=()=>{var n,r;return((n=e.columnDef.enableGrouping)!=null?n:!0)&&((r=t.options.enableGrouping)!=null?r:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.includes(e.id)},e.getGroupedIndex=()=>{var n;return(n=t.getState().grouping)==null?void 0:n.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const n=e.getCanGroup();return()=>{n&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const n=t.getCoreRowModel().flatRows[0],r=n==null?void 0:n.getValue(e.id);if(typeof r=="number")return Dd.sum;if(Object.prototype.toString.call(r)==="[object Date]")return Dd.extent},e.getAggregationFn=()=>{var n,r;if(!e)throw new Error;return jc(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(n=(r=t.options.aggregationFns)==null?void 0:r[e.columnDef.aggregationFn])!=null?n:Dd[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var n,r;e.setGrouping(t?[]:(n=(r=e.initialState)==null?void 0:r.grouping)!=null?n:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,t)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=n=>{if(e._groupingValuesCache.hasOwnProperty(n))return e._groupingValuesCache[n];const r=t.getColumn(n);return r!=null&&r.columnDef.getGroupingValue?(e._groupingValuesCache[n]=r.columnDef.getGroupingValue(e.original),e._groupingValuesCache[n]):e.getValue(n)},e._groupingValuesCache={}},createCell:(e,t,n,r)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===n.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=n.subRows)!=null&&o.length)}}};function jI(e,t,n){if(!(t!=null&&t.length)||!n)return e;const r=e.filter(i=>!t.includes(i.id));return n==="remove"?r:[...t.map(i=>e.find(s=>s.id===i)).filter(Boolean),...r]}const OI={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Gt("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=le(n=>[Zs(t,n)],n=>n.findIndex(r=>r.id===e.id),ue(t.options,"debugColumns")),e.getIsFirstColumn=n=>{var r;return((r=Zs(t,n)[0])==null?void 0:r.id)===e.id},e.getIsLastColumn=n=>{var r;const o=Zs(t,n);return((r=o[o.length-1])==null?void 0:r.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var n;e.setColumnOrder(t?[]:(n=e.initialState.columnOrder)!=null?n:[])},e._getOrderColumnsFn=le(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,n,r)=>o=>{let i=[];if(!(t!=null&&t.length))i=o;else{const s=[...t],a=[...o];for(;a.length&&s.length;){const l=s.shift(),u=a.findIndex(d=>d.id===l);u>-1&&i.push(a.splice(u,1)[0])}i=[...i,...a]}return jI(i,n,r)},ue(e.options,"debugTable"))}},Id=()=>({left:[],right:[]}),DI={getInitialState:e=>({columnPinning:Id(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Gt("columnPinning",e)}),createColumn:(e,t)=>{e.pin=n=>{const r=e.getLeafColumns().map(o=>o.id).filter(Boolean);t.setColumnPinning(o=>{var i,s;if(n==="right"){var a,l;return{left:((a=o==null?void 0:o.left)!=null?a:[]).filter(c=>!(r!=null&&r.includes(c))),right:[...((l=o==null?void 0:o.right)!=null?l:[]).filter(c=>!(r!=null&&r.includes(c))),...r]}}if(n==="left"){var u,d;return{left:[...((u=o==null?void 0:o.left)!=null?u:[]).filter(c=>!(r!=null&&r.includes(c))),...r],right:((d=o==null?void 0:o.right)!=null?d:[]).filter(c=>!(r!=null&&r.includes(c)))}}return{left:((i=o==null?void 0:o.left)!=null?i:[]).filter(c=>!(r!=null&&r.includes(c))),right:((s=o==null?void 0:o.right)!=null?s:[]).filter(c=>!(r!=null&&r.includes(c)))}})},e.getCanPin=()=>e.getLeafColumns().some(r=>{var o,i,s;return((o=r.columnDef.enablePinning)!=null?o:!0)&&((i=(s=t.options.enableColumnPinning)!=null?s:t.options.enablePinning)!=null?i:!0)}),e.getIsPinned=()=>{const n=e.getLeafColumns().map(a=>a.id),{left:r,right:o}=t.getState().columnPinning,i=n.some(a=>r==null?void 0:r.includes(a)),s=n.some(a=>o==null?void 0:o.includes(a));return i?"left":s?"right":!1},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();return o?(n=(r=t.getState().columnPinning)==null||(r=r[o])==null?void 0:r.indexOf(e.id))!=null?n:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(n,r,o)=>{const i=[...r??[],...o??[]];return n.filter(s=>!i.includes(s.column.id))},ue(t.options,"debugRows")),e.getLeftVisibleCells=le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(n,r)=>(r??[]).map(i=>n.find(s=>s.column.id===i)).filter(Boolean).map(i=>({...i,position:"left"})),ue(t.options,"debugRows")),e.getRightVisibleCells=le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(n,r)=>(r??[]).map(i=>n.find(s=>s.column.id===i)).filter(Boolean).map(i=>({...i,position:"right"})),ue(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var n,r;return e.setColumnPinning(t?Id():(n=(r=e.initialState)==null?void 0:r.columnPinning)!=null?n:Id())},e.getIsSomeColumnsPinned=t=>{var n;const r=e.getState().columnPinning;if(!t){var o,i;return!!((o=r.left)!=null&&o.length||(i=r.right)!=null&&i.length)}return!!((n=r[t])!=null&&n.length)},e.getLeftLeafColumns=le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(o=>o.id===r)).filter(Boolean),ue(e.options,"debugColumns")),e.getRightLeafColumns=le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(o=>o.id===r)).filter(Boolean),ue(e.options,"debugColumns")),e.getCenterLeafColumns=le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,n,r)=>{const o=[...n??[],...r??[]];return t.filter(i=>!o.includes(i.id))},ue(e.options,"debugColumns"))}},kl={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Fd=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),II={getDefaultColumnDef:()=>kl,getInitialState:e=>({columnSizing:{},columnSizingInfo:Fd(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Gt("columnSizing",e),onColumnSizingInfoChange:Gt("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var n,r,o;const i=t.getState().columnSizing[e.id];return Math.min(Math.max((n=e.columnDef.minSize)!=null?n:kl.minSize,(r=i??e.columnDef.size)!=null?r:kl.size),(o=e.columnDef.maxSize)!=null?o:kl.maxSize)},e.getStart=le(n=>[n,Zs(t,n),t.getState().columnSizing],(n,r)=>r.slice(0,e.getIndex(n)).reduce((o,i)=>o+i.getSize(),0),ue(t.options,"debugColumns")),e.getAfter=le(n=>[n,Zs(t,n),t.getState().columnSizing],(n,r)=>r.slice(e.getIndex(n)+1).reduce((o,i)=>o+i.getSize(),0),ue(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(n=>{let{[e.id]:r,...o}=n;return o})},e.getCanResize=()=>{var n,r;return((n=e.columnDef.enableResizing)!=null?n:!0)&&((r=t.options.enableColumnResizing)!=null?r:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let n=0;const r=o=>{if(o.subHeaders.length)o.subHeaders.forEach(r);else{var i;n+=(i=o.column.getSize())!=null?i:0}};return r(e),n},e.getStart=()=>{if(e.index>0){const n=e.headerGroup.headers[e.index-1];return n.getStart()+n.getSize()}return 0},e.getResizeHandler=n=>{const r=t.getColumn(e.column.id),o=r==null?void 0:r.getCanResize();return i=>{if(!r||!o||(i.persist==null||i.persist(),Ld(i)&&i.touches&&i.touches.length>1))return;const s=e.getSize(),a=e?e.getLeafHeaders().map(w=>[w.column.id,w.column.getSize()]):[[r.id,r.getSize()]],l=Ld(i)?Math.round(i.touches[0].clientX):i.clientX,u={},d=(w,g)=>{typeof g=="number"&&(t.setColumnSizingInfo(S=>{var C,P;const b=t.options.columnResizeDirection==="rtl"?-1:1,M=(g-((C=S==null?void 0:S.startOffset)!=null?C:0))*b,A=Math.max(M/((P=S==null?void 0:S.startSize)!=null?P:0),-.999999);return S.columnSizingStart.forEach($=>{let[R,O]=$;u[R]=Math.round(Math.max(O+O*A,0)*100)/100}),{...S,deltaOffset:M,deltaPercentage:A}}),(t.options.columnResizeMode==="onChange"||w==="end")&&t.setColumnSizing(S=>({...S,...u})))},c=w=>d("move",w),f=w=>{d("end",w),t.setColumnSizingInfo(g=>({...g,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},m=n||typeof document<"u"?document:null,v={moveHandler:w=>c(w.clientX),upHandler:w=>{m==null||m.removeEventListener("mousemove",v.moveHandler),m==null||m.removeEventListener("mouseup",v.upHandler),f(w.clientX)}},y={moveHandler:w=>(w.cancelable&&(w.preventDefault(),w.stopPropagation()),c(w.touches[0].clientX),!1),upHandler:w=>{var g;m==null||m.removeEventListener("touchmove",y.moveHandler),m==null||m.removeEventListener("touchend",y.upHandler),w.cancelable&&(w.preventDefault(),w.stopPropagation()),f((g=w.touches[0])==null?void 0:g.clientX)}},x=FI()?{passive:!1}:!1;Ld(i)?(m==null||m.addEventListener("touchmove",y.moveHandler,x),m==null||m.addEventListener("touchend",y.upHandler,x)):(m==null||m.addEventListener("mousemove",v.moveHandler,x),m==null||m.addEventListener("mouseup",v.upHandler,x)),t.setColumnSizingInfo(w=>({...w,startOffset:l,startSize:s,deltaOffset:0,deltaPercentage:0,columnSizingStart:a,isResizingColumn:r.id}))}}},createTable:e=>{e.setColumnSizing=t=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(t),e.setColumnSizingInfo=t=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(t),e.resetColumnSizing=t=>{var n;e.setColumnSizing(t?{}:(n=e.initialState.columnSizing)!=null?n:{})},e.resetHeaderSizeInfo=t=>{var n;e.setColumnSizingInfo(t?Fd():(n=e.initialState.columnSizingInfo)!=null?n:Fd())},e.getTotalSize=()=>{var t,n;return(t=(n=e.getHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,n;return(t=(n=e.getLeftHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,n;return(t=(n=e.getCenterHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,n;return(t=(n=e.getRightHeaderGroups()[0])==null?void 0:n.headers.reduce((r,o)=>r+o.getSize(),0))!=null?t:0}}};let Nl=null;function FI(){if(typeof Nl=="boolean")return Nl;let e=!1;try{const t={get passive(){return e=!0,!1}},n=()=>{};window.addEventListener("test",n,t),window.removeEventListener("test",n)}catch{e=!1}return Nl=e,Nl}function Ld(e){return e.type==="touchstart"}const LI={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Gt("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=n=>{e.getCanHide()&&t.setColumnVisibility(r=>({...r,[e.id]:n??!e.getIsVisible()}))},e.getIsVisible=()=>{var n,r;const o=e.columns;return(n=o.length?o.some(i=>i.getIsVisible()):(r=t.getState().columnVisibility)==null?void 0:r[e.id])!=null?n:!0},e.getCanHide=()=>{var n,r;return((n=e.columnDef.enableHiding)!=null?n:!0)&&((r=t.options.enableHiding)!=null?r:!0)},e.getToggleVisibilityHandler=()=>n=>{e.toggleVisibility==null||e.toggleVisibility(n.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=le(()=>[e.getAllCells(),t.getState().columnVisibility],n=>n.filter(r=>r.column.getIsVisible()),ue(t.options,"debugRows")),e.getVisibleCells=le(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(n,r,o)=>[...n,...r,...o],ue(t.options,"debugRows"))},createTable:e=>{const t=(n,r)=>le(()=>[r(),r().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(i=>i.getIsVisible==null?void 0:i.getIsVisible()),ue(e.options,"debugColumns"));e.getVisibleFlatColumns=t("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=t("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=t("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=t("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=t("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=n=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(n),e.resetColumnVisibility=n=>{var r;e.setColumnVisibility(n?{}:(r=e.initialState.columnVisibility)!=null?r:{})},e.toggleAllColumnsVisible=n=>{var r;n=(r=n)!=null?r:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,i)=>({...o,[i.id]:n||!(i.getCanHide!=null&&i.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(n=>!(n.getIsVisible!=null&&n.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(n=>n.getIsVisible==null?void 0:n.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>n=>{var r;e.toggleAllColumnsVisible((r=n.target)==null?void 0:r.checked)}}};function Zs(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const $I={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},UI={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Gt("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var n;const r=(n=e.getCoreRowModel().flatRows[0])==null||(n=n._getAllCellsByColumnId()[t.id])==null?void 0:n.getValue();return typeof r=="string"||typeof r=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var n,r,o,i;return((n=e.columnDef.enableGlobalFilter)!=null?n:!0)&&((r=t.options.enableGlobalFilter)!=null?r:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&((i=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?i:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Qn.includesString,e.getGlobalFilterFn=()=>{var t,n;const{globalFilterFn:r}=e.options;return jc(r)?r:r==="auto"?e.getGlobalAutoFilterFn():(t=(n=e.options.filterFns)==null?void 0:n[r])!=null?t:Qn[r]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},zI={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Gt("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,n=!1;e._autoResetExpanded=()=>{var r,o;if(!t){e._queue(()=>{t=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?r:!e.options.manualExpanding){if(n)return;n=!0,e._queue(()=>{e.resetExpanded(),n=!1})}},e.setExpanded=r=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(r),e.toggleAllRowsExpanded=r=>{r??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=r=>{var o,i;e.setExpanded(r?{}:(o=(i=e.initialState)==null?void 0:i.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(r=>r.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>r=>{r.persist==null||r.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const r=e.getState().expanded;return r===!0||Object.values(r).some(Boolean)},e.getIsAllRowsExpanded=()=>{const r=e.getState().expanded;return typeof r=="boolean"?r===!0:!(!Object.keys(r).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let r=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(i=>{const s=i.split(".");r=Math.max(r,s.length)}),r},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,t)=>{e.toggleExpanded=n=>{t.setExpanded(r=>{var o;const i=r===!0?!0:!!(r!=null&&r[e.id]);let s={};if(r===!0?Object.keys(t.getRowModel().rowsById).forEach(a=>{s[a]=!0}):s=r,n=(o=n)!=null?o:!i,!i&&n)return{...s,[e.id]:!0};if(i&&!n){const{[e.id]:a,...l}=s;return l}return r})},e.getIsExpanded=()=>{var n;const r=t.getState().expanded;return!!((n=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?n:r===!0||r!=null&&r[e.id])},e.getCanExpand=()=>{var n,r,o;return(n=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?n:((r=t.options.enableExpanding)!=null?r:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let n=!0,r=e;for(;n&&r.parentId;)r=t.getRow(r.parentId,!0),n=r.getIsExpanded();return n},e.getToggleExpandedHandler=()=>{const n=e.getCanExpand();return()=>{n&&e.toggleExpanded()}}}},_p=0,Tp=10,$d=()=>({pageIndex:_p,pageSize:Tp}),BI={getInitialState:e=>({...e,pagination:{...$d(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:Gt("pagination",e)}),createTable:e=>{let t=!1,n=!1;e._autoResetPageIndex=()=>{var r,o;if(!t){e._queue(()=>{t=!0});return}if((r=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?r:!e.options.manualPagination){if(n)return;n=!0,e._queue(()=>{e.resetPageIndex(),n=!1})}},e.setPagination=r=>{const o=i=>Br(r,i);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=r=>{var o;e.setPagination(r?$d():(o=e.initialState.pagination)!=null?o:$d())},e.setPageIndex=r=>{e.setPagination(o=>{let i=Br(r,o.pageIndex);const s=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return i=Math.max(0,Math.min(i,s)),{...o,pageIndex:i}})},e.resetPageIndex=r=>{var o,i;e.setPageIndex(r?_p:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageIndex)!=null?o:_p)},e.resetPageSize=r=>{var o,i;e.setPageSize(r?Tp:(o=(i=e.initialState)==null||(i=i.pagination)==null?void 0:i.pageSize)!=null?o:Tp)},e.setPageSize=r=>{e.setPagination(o=>{const i=Math.max(1,Br(r,o.pageSize)),s=o.pageSize*o.pageIndex,a=Math.floor(s/i);return{...o,pageIndex:a,pageSize:i}})},e.setPageCount=r=>e.setPagination(o=>{var i;let s=Br(r,(i=e.options.pageCount)!=null?i:-1);return typeof s=="number"&&(s=Math.max(-1,s)),{...o,pageCount:s}}),e.getPageOptions=le(()=>[e.getPageCount()],r=>{let o=[];return r&&r>0&&(o=[...new Array(r)].fill(null).map((i,s)=>s)),o},ue(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:r}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:re.setPageIndex(r=>r-1),e.nextPage=()=>e.setPageIndex(r=>r+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var r;return(r=e.options.pageCount)!=null?r:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var r;return(r=e.options.rowCount)!=null?r:e.getPrePaginationRowModel().rows.length}}},Ud=()=>({top:[],bottom:[]}),VI={getInitialState:e=>({rowPinning:Ud(),...e}),getDefaultOptions:e=>({onRowPinningChange:Gt("rowPinning",e)}),createRow:(e,t)=>{e.pin=(n,r,o)=>{const i=r?e.getLeafRows().map(l=>{let{id:u}=l;return u}):[],s=o?e.getParentRows().map(l=>{let{id:u}=l;return u}):[],a=new Set([...s,e.id,...i]);t.setRowPinning(l=>{var u,d;if(n==="bottom"){var c,f;return{top:((c=l==null?void 0:l.top)!=null?c:[]).filter(y=>!(a!=null&&a.has(y))),bottom:[...((f=l==null?void 0:l.bottom)!=null?f:[]).filter(y=>!(a!=null&&a.has(y))),...Array.from(a)]}}if(n==="top"){var m,v;return{top:[...((m=l==null?void 0:l.top)!=null?m:[]).filter(y=>!(a!=null&&a.has(y))),...Array.from(a)],bottom:((v=l==null?void 0:l.bottom)!=null?v:[]).filter(y=>!(a!=null&&a.has(y)))}}return{top:((u=l==null?void 0:l.top)!=null?u:[]).filter(y=>!(a!=null&&a.has(y))),bottom:((d=l==null?void 0:l.bottom)!=null?d:[]).filter(y=>!(a!=null&&a.has(y)))}})},e.getCanPin=()=>{var n;const{enableRowPinning:r,enablePinning:o}=t.options;return typeof r=="function"?r(e):(n=r??o)!=null?n:!0},e.getIsPinned=()=>{const n=[e.id],{top:r,bottom:o}=t.getState().rowPinning,i=n.some(a=>r==null?void 0:r.includes(a)),s=n.some(a=>o==null?void 0:o.includes(a));return i?"top":s?"bottom":!1},e.getPinnedIndex=()=>{var n,r;const o=e.getIsPinned();if(!o)return-1;const i=(n=o==="top"?t.getTopRows():t.getBottomRows())==null?void 0:n.map(s=>{let{id:a}=s;return a});return(r=i==null?void 0:i.indexOf(e.id))!=null?r:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var n,r;return e.setRowPinning(t?Ud():(n=(r=e.initialState)==null?void 0:r.rowPinning)!=null?n:Ud())},e.getIsSomeRowsPinned=t=>{var n;const r=e.getState().rowPinning;if(!t){var o,i;return!!((o=r.top)!=null&&o.length||(i=r.bottom)!=null&&i.length)}return!!((n=r[t])!=null&&n.length)},e._getPinnedRows=(t,n,r)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(n??[]).map(s=>{const a=e.getRow(s,!0);return a.getIsAllParentsExpanded()?a:null}):(n??[]).map(s=>t.find(a=>a.id===s))).filter(Boolean).map(s=>({...s,position:r}))},e.getTopRows=le(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,n)=>e._getPinnedRows(t,n,"top"),ue(e.options,"debugRows")),e.getBottomRows=le(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,n)=>e._getPinnedRows(t,n,"bottom"),ue(e.options,"debugRows")),e.getCenterRows=le(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,n,r)=>{const o=new Set([...n??[],...r??[]]);return t.filter(i=>!o.has(i.id))},ue(e.options,"debugRows"))}},HI={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Gt("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=t=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(t),e.resetRowSelection=t=>{var n;return e.setRowSelection(t?{}:(n=e.initialState.rowSelection)!=null?n:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(n=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const r={...n},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(i=>{i.getCanSelect()&&(r[i.id]=!0)}):o.forEach(i=>{delete r[i.id]}),r})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(n=>{const r=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),o={...n};return e.getRowModel().rows.forEach(i=>{Ap(o,i.id,r,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=le(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,n)=>Object.keys(t).length?zd(e,n):{rows:[],flatRows:[],rowsById:{}},ue(e.options,"debugTable")),e.getFilteredSelectedRowModel=le(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,n)=>Object.keys(t).length?zd(e,n):{rows:[],flatRows:[],rowsById:{}},ue(e.options,"debugTable")),e.getGroupedSelectedRowModel=le(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,n)=>Object.keys(t).length?zd(e,n):{rows:[],flatRows:[],rowsById:{}},ue(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:n}=e.getState();let r=!!(t.length&&Object.keys(n).length);return r&&t.some(o=>o.getCanSelect()&&!n[o.id])&&(r=!1),r},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:n}=e.getState();let r=!!t.length;return r&&t.some(o=>!n[o.id])&&(r=!1),r},e.getIsSomeRowsSelected=()=>{var t;const n=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return n>0&&n{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(n=>n.getCanSelect()).some(n=>n.getIsSelected()||n.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(n,r)=>{const o=e.getIsSelected();t.setRowSelection(i=>{var s;if(n=typeof n<"u"?n:!o,e.getCanSelect()&&o===n)return i;const a={...i};return Ap(a,e.id,n,(s=r==null?void 0:r.selectChildren)!=null?s:!0,t),a})},e.getIsSelected=()=>{const{rowSelection:n}=t.getState();return zg(e,n)},e.getIsSomeSelected=()=>{const{rowSelection:n}=t.getState();return Mp(e,n)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:n}=t.getState();return Mp(e,n)==="all"},e.getCanSelect=()=>{var n;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(n=t.options.enableRowSelection)!=null?n:!0},e.getCanSelectSubRows=()=>{var n;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(n=t.options.enableSubRowSelection)!=null?n:!0},e.getCanMultiSelect=()=>{var n;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(n=t.options.enableMultiRowSelection)!=null?n:!0},e.getToggleSelectedHandler=()=>{const n=e.getCanSelect();return r=>{var o;n&&e.toggleSelected((o=r.target)==null?void 0:o.checked)}}}},Ap=(e,t,n,r,o)=>{var i;const s=o.getRow(t,!0);n?(s.getCanMultiSelect()||Object.keys(e).forEach(a=>delete e[a]),s.getCanSelect()&&(e[t]=!0)):delete e[t],r&&(i=s.subRows)!=null&&i.length&&s.getCanSelectSubRows()&&s.subRows.forEach(a=>Ap(e,a.id,n,r,o))};function zd(e,t){const n=e.getState().rowSelection,r=[],o={},i=function(s,a){return s.map(l=>{var u;const d=zg(l,n);if(d&&(r.push(l),o[l.id]=l),(u=l.subRows)!=null&&u.length&&(l={...l,subRows:i(l.subRows)}),d)return l}).filter(Boolean)};return{rows:i(t.rows),flatRows:r,rowsById:o}}function zg(e,t){var n;return(n=t[e.id])!=null?n:!1}function Mp(e,t,n){var r;if(!((r=e.subRows)!=null&&r.length))return!1;let o=!0,i=!1;return e.subRows.forEach(s=>{if(!(i&&!o)&&(s.getCanSelect()&&(zg(s,t)?i=!0:o=!1),s.subRows&&s.subRows.length)){const a=Mp(s,t);a==="all"?i=!0:(a==="some"&&(i=!0),o=!1)}}),o?"all":i?"some":!1}const kp=/([0-9]+)/gm,KI=(e,t,n)=>Sb(ro(e.getValue(n)).toLowerCase(),ro(t.getValue(n)).toLowerCase()),GI=(e,t,n)=>Sb(ro(e.getValue(n)),ro(t.getValue(n))),WI=(e,t,n)=>Bg(ro(e.getValue(n)).toLowerCase(),ro(t.getValue(n)).toLowerCase()),qI=(e,t,n)=>Bg(ro(e.getValue(n)),ro(t.getValue(n))),QI=(e,t,n)=>{const r=e.getValue(n),o=t.getValue(n);return r>o?1:rBg(e.getValue(n),t.getValue(n));function Bg(e,t){return e===t?0:e>t?1:-1}function ro(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Sb(e,t){const n=e.split(kp).filter(Boolean),r=t.split(kp).filter(Boolean);for(;n.length&&r.length;){const o=n.shift(),i=r.shift(),s=parseInt(o,10),a=parseInt(i,10),l=[s,a].sort();if(isNaN(l[0])){if(o>i)return 1;if(i>o)return-1;continue}if(isNaN(l[1]))return isNaN(s)?-1:1;if(s>a)return 1;if(a>s)return-1}return n.length-r.length}const ks={alphanumeric:KI,alphanumericCaseSensitive:GI,text:WI,textCaseSensitive:qI,datetime:QI,basic:YI},XI={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Gt("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const n=t.getFilteredRowModel().flatRows.slice(10);let r=!1;for(const o of n){const i=o==null?void 0:o.getValue(e.id);if(Object.prototype.toString.call(i)==="[object Date]")return ks.datetime;if(typeof i=="string"&&(r=!0,i.split(kp).length>1))return ks.alphanumeric}return r?ks.text:ks.basic},e.getAutoSortDir=()=>{const n=t.getFilteredRowModel().flatRows[0];return typeof(n==null?void 0:n.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var n,r;if(!e)throw new Error;return jc(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(n=(r=t.options.sortingFns)==null?void 0:r[e.columnDef.sortingFn])!=null?n:ks[e.columnDef.sortingFn]},e.toggleSorting=(n,r)=>{const o=e.getNextSortingOrder(),i=typeof n<"u"&&n!==null;t.setSorting(s=>{const a=s==null?void 0:s.find(m=>m.id===e.id),l=s==null?void 0:s.findIndex(m=>m.id===e.id);let u=[],d,c=i?n:o==="desc";if(s!=null&&s.length&&e.getCanMultiSort()&&r?a?d="toggle":d="add":s!=null&&s.length&&l!==s.length-1?d="replace":a?d="toggle":d="replace",d==="toggle"&&(i||o||(d="remove")),d==="add"){var f;u=[...s,{id:e.id,desc:c}],u.splice(0,u.length-((f=t.options.maxMultiSortColCount)!=null?f:Number.MAX_SAFE_INTEGER))}else d==="toggle"?u=s.map(m=>m.id===e.id?{...m,desc:c}:m):d==="remove"?u=s.filter(m=>m.id!==e.id):u=[{id:e.id,desc:c}];return u})},e.getFirstSortDir=()=>{var n,r;return((n=(r=e.columnDef.sortDescFirst)!=null?r:t.options.sortDescFirst)!=null?n:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=n=>{var r,o;const i=e.getFirstSortDir(),s=e.getIsSorted();return s?s!==i&&((r=t.options.enableSortingRemoval)==null||r)&&(!(n&&(o=t.options.enableMultiRemove)!=null)||o)?!1:s==="desc"?"asc":"desc":i},e.getCanSort=()=>{var n,r;return((n=e.columnDef.enableSorting)!=null?n:!0)&&((r=t.options.enableSorting)!=null?r:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var n,r;return(n=(r=e.columnDef.enableMultiSort)!=null?r:t.options.enableMultiSort)!=null?n:!!e.accessorFn},e.getIsSorted=()=>{var n;const r=(n=t.getState().sorting)==null?void 0:n.find(o=>o.id===e.id);return r?r.desc?"desc":"asc":!1},e.getSortIndex=()=>{var n,r;return(n=(r=t.getState().sorting)==null?void 0:r.findIndex(o=>o.id===e.id))!=null?n:-1},e.clearSorting=()=>{t.setSorting(n=>n!=null&&n.length?n.filter(r=>r.id!==e.id):[])},e.getToggleSortingHandler=()=>{const n=e.getCanSort();return r=>{n&&(r.persist==null||r.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(r):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var n,r;e.setSorting(t?[]:(n=(r=e.initialState)==null?void 0:r.sorting)!=null?n:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},JI=[wI,LI,OI,DI,SI,CI,$I,UI,XI,NI,zI,BI,VI,HI,II];function ZI(e){var t,n;const r=[...JI,...(t=e._features)!=null?t:[]];let o={_features:r};const i=o._features.reduce((f,m)=>Object.assign(f,m.getDefaultOptions==null?void 0:m.getDefaultOptions(o)),{}),s=f=>o.options.mergeOptions?o.options.mergeOptions(i,f):{...i,...f};let l={...{},...(n=e.initialState)!=null?n:{}};o._features.forEach(f=>{var m;l=(m=f.getInitialState==null?void 0:f.getInitialState(l))!=null?m:l});const u=[];let d=!1;const c={_features:r,options:{...i,...e},initialState:l,_queue:f=>{u.push(f),d||(d=!0,Promise.resolve().then(()=>{for(;u.length;)u.shift()();d=!1}).catch(m=>setTimeout(()=>{throw m})))},reset:()=>{o.setState(o.initialState)},setOptions:f=>{const m=Br(f,o.options);o.options=s(m)},getState:()=>o.options.state,setState:f=>{o.options.onStateChange==null||o.options.onStateChange(f)},_getRowId:(f,m,v)=>{var y;return(y=o.options.getRowId==null?void 0:o.options.getRowId(f,m,v))!=null?y:`${v?[v.id,m].join("."):m}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(f,m)=>{let v=(m?o.getPrePaginationRowModel():o.getRowModel()).rowsById[f];if(!v&&(v=o.getCoreRowModel().rowsById[f],!v))throw new Error;return v},_getDefaultColumnDef:le(()=>[o.options.defaultColumn],f=>{var m;return f=(m=f)!=null?m:{},{header:v=>{const y=v.header.column.columnDef;return y.accessorKey?y.accessorKey:y.accessorFn?y.id:null},cell:v=>{var y,x;return(y=(x=v.renderValue())==null||x.toString==null?void 0:x.toString())!=null?y:null},...o._features.reduce((v,y)=>Object.assign(v,y.getDefaultColumnDef==null?void 0:y.getDefaultColumnDef()),{}),...f}},ue(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:le(()=>[o._getColumnDefs()],f=>{const m=function(v,y,x){return x===void 0&&(x=0),v.map(w=>{const g=yI(o,w,x,y),S=w;return g.columns=S.columns?m(S.columns,g,x+1):[],g})};return m(f)},ue(e,"debugColumns")),getAllFlatColumns:le(()=>[o.getAllColumns()],f=>f.flatMap(m=>m.getFlatColumns()),ue(e,"debugColumns")),_getAllFlatColumnsById:le(()=>[o.getAllFlatColumns()],f=>f.reduce((m,v)=>(m[v.id]=v,m),{}),ue(e,"debugColumns")),getAllLeafColumns:le(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(f,m)=>{let v=f.flatMap(y=>y.getLeafColumns());return m(v)},ue(e,"debugColumns")),getColumn:f=>o._getAllFlatColumnsById()[f]};Object.assign(o,c);for(let f=0;fle(()=>[e.options.data],t=>{const n={rows:[],flatRows:[],rowsById:{}},r=function(o,i,s){i===void 0&&(i=0);const a=[];for(let u=0;ue._autoResetPageIndex()))}/** * react-table * * Copyright (c) TanStack @@ -278,12 +278,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Fy(e,t){return e?JI(e)?h.createElement(e,t):e:null}function JI(e){return ZI(e)||typeof e=="function"||eF(e)}function ZI(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function eF(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function tF(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=h.useState(()=>({current:YI(t)})),[r,o]=h.useState(()=>n.current.initialState);return n.current.setOptions(i=>({...i,...e,state:{...r,...e.state},onStateChange:s=>{o(s),e.onStateChange==null||e.onStateChange(s)}})),n.current}const xb=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{className:"relative w-full overflow-auto",children:p.jsx("table",{ref:n,className:G("w-full caption-bottom text-sm",e),...t})}));xb.displayName="Table";const Sb=h.forwardRef(({className:e,...t},n)=>p.jsx("thead",{ref:n,className:G("[&_tr]:border-b",e),...t}));Sb.displayName="TableHeader";const Cb=h.forwardRef(({className:e,...t},n)=>p.jsx("tbody",{ref:n,className:G("[&_tr:last-child]:border-0",e),...t}));Cb.displayName="TableBody";const nF=h.forwardRef(({className:e,...t},n)=>p.jsx("tfoot",{ref:n,className:G("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));nF.displayName="TableFooter";const Zl=h.forwardRef(({className:e,...t},n)=>p.jsx("tr",{ref:n,className:G("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Zl.displayName="TableRow";const bb=h.forwardRef(({className:e,...t},n)=>p.jsx("th",{ref:n,className:G("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] first:pl-4",e),...t}));bb.displayName="TableHead";const kp=h.forwardRef(({className:e,...t},n)=>p.jsx("td",{ref:n,className:G("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] first:pl-4",e),...t}));kp.displayName="TableCell";const rF=h.forwardRef(({className:e,...t},n)=>p.jsx("caption",{ref:n,className:G("mt-4 text-sm text-muted-foreground",e),...t}));rF.displayName="TableCaption";const Rb=({columns:e,data:t})=>{var r;const n=tF({data:t,columns:e,getCoreRowModel:XI()});return p.jsx("div",{className:"rounded-md border",children:p.jsxs(xb,{children:[p.jsx(Sb,{children:n.getHeaderGroups().map(o=>p.jsx(Zl,{children:o.headers.map(i=>p.jsx(bb,{children:i.isPlaceholder?null:Fy(i.column.columnDef.header,i.getContext())},i.id))},o.id))}),p.jsx(Cb,{children:(r=n.getRowModel().rows)!=null&&r.length?n.getRowModel().rows.map(o=>p.jsx(Zl,{"data-state":o.getIsSelected()&&"selected",children:o.getVisibleCells().map(i=>p.jsx(kp,{children:Fy(i.column.columnDef.cell,i.getContext())},i.id))},o.id)):p.jsx(Zl,{children:p.jsx(kp,{colSpan:e.length,className:"h-24 text-center",children:"No results."})})})]})})};var Eb="AlertDialog",[oF,EL]=pr(Eb,[V1]),hr=V1(),Pb=e=>{const{__scopeAlertDialog:t,...n}=e,r=hr(t);return p.jsx(fg,{...r,...n,modal:!0})};Pb.displayName=Eb;var iF="AlertDialogTrigger",sF=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=hr(n);return p.jsx(wN,{...o,...r,ref:t})});sF.displayName=iF;var aF="AlertDialogPortal",_b=e=>{const{__scopeAlertDialog:t,...n}=e,r=hr(t);return p.jsx(pg,{...r,...n})};_b.displayName=aF;var lF="AlertDialogOverlay",Tb=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=hr(n);return p.jsx(za,{...o,...r,ref:t})});Tb.displayName=lF;var Ti="AlertDialogContent",[uF,cF]=oF(Ti),Ab=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,i=hr(n),s=h.useRef(null),a=Le(t,s),l=h.useRef(null);return p.jsx(gN,{contentName:Ti,titleName:Mb,docsSlug:"alert-dialog",children:p.jsx(uF,{scope:n,cancelRef:l,children:p.jsxs(Ba,{role:"alertdialog",...i,...o,ref:a,onOpenAutoFocus:re(o.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=l.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[p.jsx(tg,{children:r}),p.jsx(fF,{contentRef:s})]})})})});Ab.displayName=Ti;var Mb="AlertDialogTitle",kb=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=hr(n);return p.jsx(Va,{...o,...r,ref:t})});kb.displayName=Mb;var Nb="AlertDialogDescription",jb=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=hr(n);return p.jsx(Ha,{...o,...r,ref:t})});jb.displayName=Nb;var dF="AlertDialogAction",Ob=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=hr(n);return p.jsx(yc,{...o,...r,ref:t})});Ob.displayName=dF;var Db="AlertDialogCancel",Ib=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=cF(Db,n),i=hr(n),s=Le(t,o);return p.jsx(yc,{...i,...r,ref:s})});Ib.displayName=Db;var fF=({contentRef:e})=>{const t=`\`${Ti}\` requires a description for the component to be accessible for screen reader users. + */function $y(e,t){return e?tF(e)?h.createElement(e,t):e:null}function tF(e){return nF(e)||typeof e=="function"||rF(e)}function nF(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function rF(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function oF(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[n]=h.useState(()=>({current:ZI(t)})),[r,o]=h.useState(()=>n.current.initialState);return n.current.setOptions(i=>({...i,...e,state:{...r,...e.state},onStateChange:s=>{o(s),e.onStateChange==null||e.onStateChange(s)}})),n.current}const Cb=h.forwardRef(({className:e,...t},n)=>p.jsx("div",{className:"relative w-full overflow-auto",children:p.jsx("table",{ref:n,className:G("w-full caption-bottom text-sm",e),...t})}));Cb.displayName="Table";const bb=h.forwardRef(({className:e,...t},n)=>p.jsx("thead",{ref:n,className:G("[&_tr]:border-b",e),...t}));bb.displayName="TableHeader";const Rb=h.forwardRef(({className:e,...t},n)=>p.jsx("tbody",{ref:n,className:G("[&_tr:last-child]:border-0",e),...t}));Rb.displayName="TableBody";const iF=h.forwardRef(({className:e,...t},n)=>p.jsx("tfoot",{ref:n,className:G("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));iF.displayName="TableFooter";const Zl=h.forwardRef(({className:e,...t},n)=>p.jsx("tr",{ref:n,className:G("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t}));Zl.displayName="TableRow";const Eb=h.forwardRef(({className:e,...t},n)=>p.jsx("th",{ref:n,className:G("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] first:pl-4",e),...t}));Eb.displayName="TableHead";const Np=h.forwardRef(({className:e,...t},n)=>p.jsx("td",{ref:n,className:G("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] first:pl-4",e),...t}));Np.displayName="TableCell";const sF=h.forwardRef(({className:e,...t},n)=>p.jsx("caption",{ref:n,className:G("mt-4 text-sm text-muted-foreground",e),...t}));sF.displayName="TableCaption";const Pb=({columns:e,data:t})=>{var r;const n=oF({data:t,columns:e,getCoreRowModel:eF()});return p.jsx("div",{className:"rounded-md border",children:p.jsxs(Cb,{children:[p.jsx(bb,{children:n.getHeaderGroups().map(o=>p.jsx(Zl,{children:o.headers.map(i=>p.jsx(Eb,{children:i.isPlaceholder?null:$y(i.column.columnDef.header,i.getContext())},i.id))},o.id))}),p.jsx(Rb,{children:(r=n.getRowModel().rows)!=null&&r.length?n.getRowModel().rows.map(o=>p.jsx(Zl,{"data-state":o.getIsSelected()&&"selected",children:o.getVisibleCells().map(i=>p.jsx(Np,{children:$y(i.column.columnDef.cell,i.getContext())},i.id))},o.id)):p.jsx(Zl,{children:p.jsx(Np,{colSpan:e.length,className:"h-24 text-center",children:"No results."})})})]})})};var _b="AlertDialog",[aF,TL]=pr(_b,[K1]),hr=K1(),Tb=e=>{const{__scopeAlertDialog:t,...n}=e,r=hr(t);return p.jsx(pg,{...r,...n,modal:!0})};Tb.displayName=_b;var lF="AlertDialogTrigger",uF=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=hr(n);return p.jsx(CN,{...o,...r,ref:t})});uF.displayName=lF;var cF="AlertDialogPortal",Ab=e=>{const{__scopeAlertDialog:t,...n}=e,r=hr(t);return p.jsx(hg,{...r,...n})};Ab.displayName=cF;var dF="AlertDialogOverlay",Mb=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=hr(n);return p.jsx(za,{...o,...r,ref:t})});Mb.displayName=dF;var Ti="AlertDialogContent",[fF,pF]=aF(Ti),kb=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...o}=e,i=hr(n),s=h.useRef(null),a=Le(t,s),l=h.useRef(null);return p.jsx(yN,{contentName:Ti,titleName:Nb,docsSlug:"alert-dialog",children:p.jsx(fF,{scope:n,cancelRef:l,children:p.jsxs(Ba,{role:"alertdialog",...i,...o,ref:a,onOpenAutoFocus:re(o.onOpenAutoFocus,u=>{var d;u.preventDefault(),(d=l.current)==null||d.focus({preventScroll:!0})}),onPointerDownOutside:u=>u.preventDefault(),onInteractOutside:u=>u.preventDefault(),children:[p.jsx(ng,{children:r}),p.jsx(gF,{contentRef:s})]})})})});kb.displayName=Ti;var Nb="AlertDialogTitle",jb=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=hr(n);return p.jsx(Va,{...o,...r,ref:t})});jb.displayName=Nb;var Ob="AlertDialogDescription",Db=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=hr(n);return p.jsx(Ha,{...o,...r,ref:t})});Db.displayName=Ob;var hF="AlertDialogAction",Ib=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,o=hr(n);return p.jsx(yc,{...o,...r,ref:t})});Ib.displayName=hF;var Fb="AlertDialogCancel",Lb=h.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:o}=pF(Fb,n),i=hr(n),s=Le(t,o);return p.jsx(yc,{...i,...r,ref:s})});Lb.displayName=Fb;var gF=({contentRef:e})=>{const t=`\`${Ti}\` requires a description for the component to be accessible for screen reader users. -You can add a description to the \`${Ti}\` by passing a \`${Nb}\` component as a child, which also benefits sighted users by adding visible context to the dialog. +You can add a description to the \`${Ti}\` by passing a \`${Ob}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ti}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return h.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},pF=Pb,hF=_b,Fb=Tb,Lb=Ab,$b=Ob,Ub=Ib,zb=kb,Bb=jb;const gF=pF,mF=hF,Vb=h.forwardRef(({className:e,...t},n)=>p.jsx(Fb,{className:G("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));Vb.displayName=Fb.displayName;const Hb=h.forwardRef(({className:e,...t},n)=>p.jsxs(mF,{children:[p.jsx(Vb,{}),p.jsx(Lb,{ref:n,className:G("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));Hb.displayName=Lb.displayName;const Kb=({className:e,...t})=>p.jsx("div",{className:G("flex flex-col space-y-2 text-center sm:text-left",e),...t});Kb.displayName="AlertDialogHeader";const Gb=({className:e,...t})=>p.jsx("div",{className:G("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Gb.displayName="AlertDialogFooter";const Wb=h.forwardRef(({className:e,...t},n)=>p.jsx(zb,{ref:n,className:G("text-lg font-semibold",e),...t}));Wb.displayName=zb.displayName;const qb=h.forwardRef(({className:e,...t},n)=>p.jsx(Bb,{ref:n,className:G("text-sm text-muted-foreground",e),...t}));qb.displayName=Bb.displayName;const Qb=h.forwardRef(({className:e,...t},n)=>p.jsx($b,{ref:n,className:G(mc(),e),...t}));Qb.displayName=$b.displayName;const Yb=h.forwardRef(({className:e,...t},n)=>p.jsx(Ub,{ref:n,className:G(mc({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Yb.displayName=Ub.displayName;const Xb=fg,vF=pg,Jb=h.forwardRef(({className:e,...t},n)=>p.jsx(za,{ref:n,className:G("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));Jb.displayName=za.displayName;const Bg=h.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(vF,{children:[p.jsx(Jb,{}),p.jsxs(Ba,{ref:r,className:G("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,p.jsxs(yc,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[p.jsx(hg,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Bg.displayName=Ba.displayName;const Vg=({className:e,...t})=>p.jsx("div",{className:G("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Vg.displayName="DialogHeader";const Hg=h.forwardRef(({className:e,...t},n)=>p.jsx(Va,{ref:n,className:G("text-lg font-semibold leading-none tracking-tight",e),...t}));Hg.displayName=Va.displayName;const yF=h.forwardRef(({className:e,...t},n)=>p.jsx(Ha,{ref:n,className:G("text-sm text-muted-foreground",e),...t}));yF.displayName=Ha.displayName;const wF=3,xF=1e6;let Bd=0;function SF(){return Bd=(Bd+1)%Number.MAX_SAFE_INTEGER,Bd.toString()}const Vd=new Map,Ly=e=>{if(Vd.has(e))return;const t=setTimeout(()=>{Vd.delete(e),ea({type:"REMOVE_TOAST",toastId:e})},xF);Vd.set(e,t)},CF=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,wF)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Ly(n):e.toasts.forEach(r=>{Ly(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},eu=[];let tu={toasts:[]};function ea(e){tu=CF(tu,e),eu.forEach(t=>{t(tu)})}function bF({...e}){const t=SF(),n=o=>ea({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>ea({type:"DISMISS_TOAST",toastId:t});return ea({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function ps(){const[e,t]=h.useState(tu);return h.useEffect(()=>(eu.push(t),()=>{const n=eu.indexOf(t);n>-1&&eu.splice(n,1)}),[e]),{...e,toast:bF,dismiss:n=>ea({type:"DISMISS_TOAST",toastId:n})}}const Kg=e=>{var r;const[,t]=h.useState(!1),n=h.useRef(null);if((r=n.current)!=null&&r.promise)throw n.current.promise;h.useLayoutEffect(()=>{n.current===null&&(n.current={},n.current.promise=new Promise(o=>{n.current.resolve=o}),t(!0))},[]),h.useEffect(()=>{const o=e.current;if(o){const i=()=>{setTimeout(()=>{var s;(s=n.current)==null||s.resolve(),n.current.promise=null},300)};return o.addEventListener("ready",i),()=>{o.removeEventListener("ready",i)}}},[])},RF=({id:e})=>{const t=h.useRef(),n=Ko(),{data:r}=Un({queryKey:["questionnaire",e],queryFn:()=>eg(n,e)}),{toast:o}=ps();return h.useEffect(()=>{const i=t.current,s=a=>{(a.detail.status==="completed"||a.detail.status==="amended")&&o({title:"Not saved",description:"This is a preview, changes will not be saved"})};return i.addEventListener("change",s),()=>{i.removeEventListener("change",s)}},[]),Kg(t),p.jsx("aidbox-form-renderer",{ref:t,questionnaire:JSON.stringify(r),style:{width:"100%",height:"100%",border:"none",flex:1}})},Zb=({className:e,...t})=>p.jsx("nav",{role:"navigation","aria-label":"pagination",className:G("mx-auto flex w-full justify-center",e),...t});Zb.displayName="Pagination";const eR=h.forwardRef(({className:e,...t},n)=>p.jsx("ul",{ref:n,className:G("flex flex-row items-center gap-1",e),...t}));eR.displayName="PaginationContent";const Mn=h.forwardRef(({className:e,...t},n)=>p.jsx("li",{ref:n,className:G("",e),...t}));Mn.displayName="PaginationItem";const Tr=({className:e,isActive:t,size:n="icon",...r})=>p.jsx(Ys,{"aria-current":t?"page":void 0,className:G(mc({variant:t?"outline":"ghost",size:n}),e),...r});Tr.displayName="PaginationLink";const tR=({className:e,...t})=>p.jsxs(Tr,{"aria-label":"Go to previous page",size:"default",className:G("gap-1 pl-2.5",e),...t,children:[p.jsx(bN,{className:"h-4 w-4"}),p.jsx("span",{children:"Previous"})]});tR.displayName="PaginationPrevious";const nR=({className:e,...t})=>p.jsxs(Tr,{"aria-label":"Go to next page",size:"default",className:G("gap-1 pr-2.5",e),...t,children:[p.jsx("span",{children:"Next"}),p.jsx(iS,{className:"h-4 w-4"})]});nR.displayName="PaginationNext";const Np=({className:e,...t})=>p.jsxs("span",{"aria-hidden":!0,className:G("flex h-9 w-9 items-center justify-center",e),...t,children:[p.jsx(AN,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"More pages"})]});Np.displayName="PaginationEllipsis";const rR=({currentPage:e,totalPages:t})=>{const[n]=Lh(),r=i=>(n.set("page",i),`?${n}`);if(t<=1)return null;const o=vM(e,t);return p.jsx(Zb,{className:"mt-4",children:p.jsxs(eR,{children:[o.prevButtonEnabled&&p.jsx(Mn,{children:p.jsx(tR,{to:r(e-1)})}),o.showFirstPageButton&&p.jsx(Mn,{children:p.jsx(Tr,{to:r(1),children:1})}),o.showFirstEllipsis&&p.jsx(Mn,{children:p.jsx(Np,{})}),o.pagesBeforeCurrent.map(i=>p.jsx(Mn,{children:p.jsx(Tr,{to:r(i),children:i})},i)),p.jsx(Mn,{children:p.jsx(Tr,{isActive:!0,children:e})}),o.pagesAfterCurrent.map(i=>p.jsx(Mn,{children:p.jsx(Tr,{to:r(i),children:i})},i)),o.showLastEllipsis&&p.jsx(Mn,{children:p.jsx(Np,{})}),o.showLastPageButton&&p.jsx(Mn,{children:p.jsx(Tr,{to:r(t),children:t})}),o.nextButtonEnabled&&p.jsx(Mn,{children:p.jsx(nR,{to:r(e+1)})})]})})};var Gg="ToastProvider",[Wg,EF,PF]=Eg("Toast"),[oR,PL]=pr("Toast",[PF]),[_F,Oc]=oR(Gg),iR=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:i=50,children:s}=e,[a,l]=h.useState(null),[u,d]=h.useState(0),c=h.useRef(!1),f=h.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Gg}\`. Expected non-empty \`string\`.`),p.jsx(Wg.Provider,{scope:t,children:p.jsx(_F,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:i,toastCount:u,viewport:a,onViewportChange:l,onToastAdd:h.useCallback(()=>d(m=>m+1),[]),onToastRemove:h.useCallback(()=>d(m=>m-1),[]),isFocusedToastEscapeKeyDownRef:c,isClosePausedRef:f,children:s})})};iR.displayName=Gg;var sR="ToastViewport",TF=["F8"],jp="toast.viewportPause",Op="toast.viewportResume",aR=h.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=TF,label:o="Notifications ({hotkey})",...i}=e,s=Oc(sR,n),a=EF(n),l=h.useRef(null),u=h.useRef(null),d=h.useRef(null),c=h.useRef(null),f=Le(t,c,s.onViewportChange),m=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=s.toastCount>0;h.useEffect(()=>{const x=w=>{var S;r.length!==0&&r.every(C=>w[C]||w.code===C)&&((S=c.current)==null||S.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[r]),h.useEffect(()=>{const x=l.current,w=c.current;if(v&&x&&w){const g=()=>{if(!s.isClosePausedRef.current){const b=new CustomEvent(jp);w.dispatchEvent(b),s.isClosePausedRef.current=!0}},S=()=>{if(s.isClosePausedRef.current){const b=new CustomEvent(Op);w.dispatchEvent(b),s.isClosePausedRef.current=!1}},C=b=>{!x.contains(b.relatedTarget)&&S()},P=()=>{x.contains(document.activeElement)||S()};return x.addEventListener("focusin",g),x.addEventListener("focusout",C),x.addEventListener("pointermove",g),x.addEventListener("pointerleave",P),window.addEventListener("blur",g),window.addEventListener("focus",S),()=>{x.removeEventListener("focusin",g),x.removeEventListener("focusout",C),x.removeEventListener("pointermove",g),x.removeEventListener("pointerleave",P),window.removeEventListener("blur",g),window.removeEventListener("focus",S)}}},[v,s.isClosePausedRef]);const y=h.useCallback(({tabbingDirection:x})=>{const g=a().map(S=>{const C=S.ref.current,P=[C,...zF(C)];return x==="forwards"?P:P.reverse()});return(x==="forwards"?g.reverse():g).flat()},[a]);return h.useEffect(()=>{const x=c.current;if(x){const w=g=>{var P,b,M;const S=g.altKey||g.ctrlKey||g.metaKey;if(g.key==="Tab"&&!S){const A=document.activeElement,$=g.shiftKey;if(g.target===x&&$){(P=u.current)==null||P.focus();return}const F=y({tabbingDirection:$?"backwards":"forwards"}),N=F.findIndex(E=>E===A);Hd(F.slice(N+1))?g.preventDefault():$?(b=u.current)==null||b.focus():(M=d.current)==null||M.focus()}};return x.addEventListener("keydown",w),()=>x.removeEventListener("keydown",w)}},[a,y]),p.jsxs(pk,{ref:l,role:"region","aria-label":o.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&p.jsx(Dp,{ref:u,onFocusFromOutsideViewport:()=>{const x=y({tabbingDirection:"forwards"});Hd(x)}}),p.jsx(Wg.Slot,{scope:n,children:p.jsx(he.ol,{tabIndex:-1,...i,ref:f})}),v&&p.jsx(Dp,{ref:d,onFocusFromOutsideViewport:()=>{const x=y({tabbingDirection:"backwards"});Hd(x)}})]})});aR.displayName=sR;var lR="ToastFocusProxy",Dp=h.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,i=Oc(lR,n);return p.jsx(bc,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:s=>{var u;const a=s.relatedTarget;!((u=i.viewport)!=null&&u.contains(a))&&r()}})});Dp.displayName=lR;var Dc="Toast",AF="toast.swipeStart",MF="toast.swipeMove",kF="toast.swipeCancel",NF="toast.swipeEnd",uR=h.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:i,...s}=e,[a=!0,l]=Wo({prop:r,defaultProp:o,onChange:i});return p.jsx(Qt,{present:n||a,children:p.jsx(DF,{open:a,...s,ref:t,onClose:()=>l(!1),onPause:mt(e.onPause),onResume:mt(e.onResume),onSwipeStart:re(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:re(e.onSwipeMove,u=>{const{x:d,y:c}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${c}px`)}),onSwipeCancel:re(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:re(e.onSwipeEnd,u=>{const{x:d,y:c}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${c}px`),l(!1)})})})});uR.displayName=Dc;var[jF,OF]=oR(Dc,{onClose(){}}),DF=h.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:i,onClose:s,onEscapeKeyDown:a,onPause:l,onResume:u,onSwipeStart:d,onSwipeMove:c,onSwipeCancel:f,onSwipeEnd:m,...v}=e,y=Oc(Dc,n),[x,w]=h.useState(null),g=Le(t,E=>w(E)),S=h.useRef(null),C=h.useRef(null),P=o||y.duration,b=h.useRef(0),M=h.useRef(P),A=h.useRef(0),{onToastAdd:$,onToastRemove:R}=y,O=mt(()=>{var T;(x==null?void 0:x.contains(document.activeElement))&&((T=y.viewport)==null||T.focus()),s()}),F=h.useCallback(E=>{!E||E===1/0||(window.clearTimeout(A.current),b.current=new Date().getTime(),A.current=window.setTimeout(O,E))},[O]);h.useEffect(()=>{const E=y.viewport;if(E){const T=()=>{F(M.current),u==null||u()},D=()=>{const V=new Date().getTime()-b.current;M.current=M.current-V,window.clearTimeout(A.current),l==null||l()};return E.addEventListener(jp,D),E.addEventListener(Op,T),()=>{E.removeEventListener(jp,D),E.removeEventListener(Op,T)}}},[y.viewport,P,l,u,F]),h.useEffect(()=>{i&&!y.isClosePausedRef.current&&F(P)},[i,P,y.isClosePausedRef,F]),h.useEffect(()=>($(),()=>R()),[$,R]);const N=h.useMemo(()=>x?mR(x):null,[x]);return y.viewport?p.jsxs(p.Fragment,{children:[N&&p.jsx(IF,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:N}),p.jsx(jF,{scope:n,onClose:O,children:os.createPortal(p.jsx(Wg.ItemSlot,{scope:n,children:p.jsx(fk,{asChild:!0,onEscapeKeyDown:re(a,()=>{y.isFocusedToastEscapeKeyDownRef.current||O(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:p.jsx(he.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":y.swipeDirection,...v,ref:g,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:re(e.onKeyDown,E=>{E.key==="Escape"&&(a==null||a(E.nativeEvent),E.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,O()))}),onPointerDown:re(e.onPointerDown,E=>{E.button===0&&(S.current={x:E.clientX,y:E.clientY})}),onPointerMove:re(e.onPointerMove,E=>{if(!S.current)return;const T=E.clientX-S.current.x,D=E.clientY-S.current.y,V=!!C.current,L=["left","right"].includes(y.swipeDirection),j=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,B=L?j(0,T):0,Q=L?0:j(0,D),te=E.pointerType==="touch"?10:2,fe={x:B,y:Q},ge={originalEvent:E,delta:fe};V?(C.current=fe,jl(MF,c,ge,{discrete:!1})):$y(fe,y.swipeDirection,te)?(C.current=fe,jl(AF,d,ge,{discrete:!1}),E.target.setPointerCapture(E.pointerId)):(Math.abs(T)>te||Math.abs(D)>te)&&(S.current=null)}),onPointerUp:re(e.onPointerUp,E=>{const T=C.current,D=E.target;if(D.hasPointerCapture(E.pointerId)&&D.releasePointerCapture(E.pointerId),C.current=null,S.current=null,T){const V=E.currentTarget,L={originalEvent:E,delta:T};$y(T,y.swipeDirection,y.swipeThreshold)?jl(NF,m,L,{discrete:!0}):jl(kF,f,L,{discrete:!0}),V.addEventListener("click",j=>j.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),IF=e=>{const{__scopeToast:t,children:n,...r}=e,o=Oc(Dc,t),[i,s]=h.useState(!1),[a,l]=h.useState(!1);return $F(()=>s(!0)),h.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:p.jsx(Ua,{asChild:!0,children:p.jsx(bc,{...r,children:i&&p.jsxs(p.Fragment,{children:[o.label," ",n]})})})},FF="ToastTitle",cR=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(he.div,{...r,ref:t})});cR.displayName=FF;var LF="ToastDescription",dR=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(he.div,{...r,ref:t})});dR.displayName=LF;var fR="ToastAction",pR=h.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?p.jsx(gR,{altText:n,asChild:!0,children:p.jsx(qg,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${fR}\`. Expected non-empty \`string\`.`),null)});pR.displayName=fR;var hR="ToastClose",qg=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=OF(hR,n);return p.jsx(gR,{asChild:!0,children:p.jsx(he.button,{type:"button",...r,ref:t,onClick:re(e.onClick,o.onClose)})})});qg.displayName=hR;var gR=h.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return p.jsx(he.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function mR(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),UF(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!o)if(i){const s=r.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...mR(r))}}),t}function jl(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ig(o,i):o.dispatchEvent(i)}var $y=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),i=r>o;return t==="left"||t==="right"?i&&r>n:!i&&o>n};function $F(e=()=>{}){const t=mt(e);Cn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function UF(e){return e.nodeType===e.ELEMENT_NODE}function zF(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Hd(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var BF=iR,vR=aR,yR=uR,wR=cR,xR=dR,SR=pR,CR=qg;const VF=BF,bR=h.forwardRef(({className:e,...t},n)=>p.jsx(vR,{ref:n,className:G("fixed top-0 left-1/2 -translate-x-1/2 z-[100] gap-2 flex max-h-screen w-full flex-col-reverse p-4 md:max-w-[420px]",e),...t}));bR.displayName=vR.displayName;const HF=La("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-top-full data-[state=open]:slide-in-from-top-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),RR=h.forwardRef(({className:e,variant:t,...n},r)=>p.jsx(yR,{ref:r,className:G(HF({variant:t}),e),...n}));RR.displayName=yR.displayName;const ER=h.forwardRef(({className:e,...t},n)=>p.jsx(SR,{ref:n,className:G("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));ER.displayName=SR.displayName;const PR=h.forwardRef(({className:e,...t},n)=>p.jsx(CR,{ref:n,className:G("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:p.jsx(hg,{className:"h-4 w-4"})}));PR.displayName=CR.displayName;const _R=h.forwardRef(({className:e,...t},n)=>p.jsx(wR,{ref:n,className:G("text-sm font-semibold [&+div]:text-xs",e),...t}));_R.displayName=wR.displayName;const TR=h.forwardRef(({className:e,...t},n)=>p.jsx(xR,{ref:n,className:G("text-sm opacity-90",e),...t}));TR.displayName=xR.displayName;const KF=()=>{var F;const e=hc(),[t,n]=Lh(),{user:r,patient:o,encounter:i}=Go(),s=Ko(),{toast:a}=ps(),l=as(),u=Number(t.get("page"))||1,d=15,c=t.get("source")||"library",f=N=>{t.set("source",N),n(t)},m=["questionnaires",c,u],v=["questionnaires","ehr",1],{data:y}=Un({queryKey:["questionnaire-pager","library"],queryFn:()=>uy(er,"Questionnaire",d)}),{data:x}=Un({queryKey:["questionnaire-pager","ehr"],queryFn:()=>uy(s,"Questionnaire",d)}),{data:w}=Un({queryKey:m,queryFn:()=>c==="library"?y(u):x(u)}),g=Js({mutationFn:xM,onSuccess:N=>{a({title:"Response created",description:`New response created for ${us(o.name)}`}),l(`/questionnaire-responses/${N.id}`)}}),S=Js({mutationFn:N=>w1(s,N),onMutate:async N=>{await e.cancelQueries({queryKey:v});const E=e.getQueryData(v);return e.setQueryData(v,T=>({...T,entry:[{resource:N},...(T==null?void 0:T.entry)||[]]})),l("?source=ehr&page=1"),{previousData:E}},onSuccess:async(N,E,T)=>{var D;await e.cancelQueries({queryKey:v}),e.setQueryData(v,{...T.previousData,entry:[{resource:N},...((D=T.previousData)==null?void 0:D.entry)||[]]}),a({title:"Questionnaire imported",description:"Questionnaire imported successfully",action:p.jsx(ER,{altText:"Edit",onClick:()=>{l(`/questionnaires/${N.id}`)},children:"Edit"})})},onError:(N,E,T)=>{e.setQueryData(v,T.previousData),a({variant:"destructive",title:"Import questionnaire",description:`Unable to import questionnaire: ${N.message}`})},onSettled:()=>{e.invalidateQueries({queryKey:v})}}),C=Js({mutationFn:N=>wM(s,N),onSuccess:async(N,E)=>{await e.cancelQueries({queryKey:m}),e.setQueryData(m,T=>{var D;return{...T,entry:(D=T.entry)==null?void 0:D.filter(V=>V.resource.id!==E.id)}}),a({title:"Questionnaire deleted",description:"Questionnaire deleted successfully"})},onError:(N,E,T)=>{a({variant:"destructive",title:"Delete questionnaire",description:`Unable to delete questionnaire: ${N.message}`})},onSettled:()=>{e.invalidateQueries({queryKey:m})}}),P=Math.ceil(w.total/d),b=((F=w.entry)==null?void 0:F.map(N=>({publisher:c==="library"?"Health Samurai":void 0,...N.resource})))||[],[M,A]=h.useState(null),[$,R]=h.useState(null),O=[{accessorKey:"title",header:"Title"},{accessorKey:"status",header:"Status"},{accessorKey:"version",header:"Version"},{accessorKey:"publisher",header:"Publisher"},{id:"actions",cell:({row:{original:N}})=>{var T;const E=g.isPending&&g.variables.questionnaire.id===N.id||N.id===((T=C.variables)==null?void 0:T.id)||N.id===void 0;return E?p.jsx(cb,{className:"h-4 my-2"}):p.jsxs(Ea,{children:[p.jsx(Pa,{asChild:!0,children:p.jsxs(Tt,{variant:"ghost",className:"h-8 w-8 p-0",disabled:E,children:[p.jsx("span",{className:"sr-only",children:"Open menu"}),p.jsx(rg,{className:"h-4 w-4"})]})}),p.jsxs(es,{align:"end",children:[p.jsx(Dg,{children:"Actions"}),p.jsxs(zt,{onClick:()=>navigator.clipboard.writeText(N.id),children:[p.jsx(ng,{}),"Copy ID"]}),p.jsx(Nc,{}),p.jsxs(zt,{onClick:()=>A(N.id),children:[p.jsx(jM,{}),"Preview"]}),p.jsx(zt,{asChild:!0,children:p.jsxs(Ys,{to:`/questionnaires/${N.id}`,children:[p.jsx(R1,{}),"Edit"]})}),c==="library"&&p.jsxs(zt,{onClick:()=>{S.mutate({...N,id:void 0})},children:[p.jsx(IM,{}),"Import"]}),c!=="library"&&p.jsxs(zt,{className:"text-destructive focus:text-destructive",onClick:()=>R(N),children:[p.jsx(KM,{}),"Delete"]}),p.jsxs(zt,{onClick:()=>{g.mutate({client:s,questionnaire:{...N,url:c==="library"?`${er.state.serverUrl}/Questionnaire/${N.id}`:void 0},subject:o,encounter:i,author:r})},children:[p.jsx(UM,{}),"Create response"]})]})]})}}];return p.jsxs("div",{className:"p-6 overflow-auto flex-1",children:[p.jsx("div",{className:"mb-4 flex justify-end",children:p.jsxs(Ea,{children:[p.jsx(Pa,{asChild:!0,children:p.jsxs(Tt,{variant:"outline",className:"ml-auto",children:["Source: ",c==="library"?"Forms Public Library":"EHR",p.jsx(b1,{className:"ml-2 h-4 w-4"})]})}),p.jsx(es,{align:"end",children:p.jsxs(eI,{value:c,onValueChange:f,children:[p.jsx(bp,{value:"library",children:"Forms Library"}),p.jsx(bp,{value:"ehr",children:"EHR"})]})})]})}),p.jsx(Rb,{columns:O,data:b}),p.jsx(rR,{currentPage:u,totalPages:P}),p.jsx(gF,{onOpenChange:N=>{N||R(null)},open:!!$,children:p.jsxs(Hb,{children:[p.jsxs(Kb,{children:[p.jsx(Wb,{children:"Are you absolutely sure?"}),p.jsx(qb,{children:"This action cannot be undone. Proceeding will permanently delete this questionnaire from the system."})]}),p.jsxs(Gb,{children:[p.jsx(Yb,{children:"Cancel"}),p.jsx(Qb,{onClick:()=>{C.mutate($),R(null)},children:"Continue"})]})]})}),p.jsx(Xb,{onOpenChange:N=>{N||A(null)},open:!!M,children:p.jsxs(Bg,{className:"flex flex-col max-w-[calc(100vw_-_4rem)] h-[calc(100vh_-_4rem)]",children:[p.jsx(Vg,{children:p.jsx(Hg,{children:"Preview"})}),M&&p.jsx(h.Suspense,{fallback:p.jsx(Lg,{}),children:p.jsx(RF,{id:M})})]})})]})},GF=({id:e})=>{const t=h.useRef(),n=Ko(),{toast:r}=ps(),o=h.useRef(!1),{data:[i,s]}=Un({queryKey:["questionnaire",e],queryFn:()=>x1(n,e)}),a=Js({mutationFn:l=>w1(i,l),onSuccess:()=>{o.current||(o.current=!0,r({title:"Questionnaire is autosaved",description:"All changes are saved automatically"}))}});return Kg(t),h.useEffect(()=>{if(i!==er){const l=t.current,u=d=>a.mutate(d.detail);return l.addEventListener("change",u),()=>{l.removeEventListener("change",u)}}else r({title:"This questionnaire is read-only",description:"You can't save changes to questionnaires from the library. Please import it first to your EHR to make changes."})},[]),p.jsx("aidbox-form-builder",{"hide-back":!0,"show-share":!1,"hide-population":!0,"hide-extraction":!0,"hide-publish":!0,"hide-add-theme":!0,"hide-edit-theme":!0,"hide-save-theme":!0,"hide-convert":!0,"hide-save":!0,"disable-save":!0,ref:t,value:JSON.stringify(s),style:{width:"100%",height:"100%",border:"none",flex:1}})},WF=()=>{const{id:e}=Px();return p.jsx(GF,{id:e})};function qF(){const{toasts:e}=ps();return p.jsxs(VF,{children:[e.map(function({id:t,title:n,description:r,action:o,...i}){return p.jsxs(RR,{...i,children:[p.jsxs("div",{className:"grid gap-1",children:[n&&p.jsx(_R,{children:n}),r&&p.jsx(TR,{children:r})]}),o,p.jsx(PR,{})]},t)}),p.jsx(bR,{})]})}var Qg="Tabs",[QF,_L]=pr(Qg,[Ac]),AR=Ac(),[YF,Yg]=QF(Qg),MR=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...u}=e,d=Pg(a),[c,f]=Wo({prop:r,onChange:o,defaultProp:i});return p.jsx(YF,{scope:n,baseId:rr(),value:c,onValueChange:f,orientation:s,dir:d,activationMode:l,children:p.jsx(he.div,{dir:d,"data-orientation":s,...u,ref:t})})});MR.displayName=Qg;var kR="TabsList",NR=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Yg(kR,n),s=AR(n);return p.jsx(tC,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:p.jsx(he.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});NR.displayName=kR;var jR="TabsTrigger",OR=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Yg(jR,n),a=AR(n),l=FR(s.baseId,r),u=LR(s.baseId,r),d=r===s.value;return p.jsx(nC,{asChild:!0,...a,focusable:!o,active:d,children:p.jsx(he.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:re(e.onMouseDown,c=>{!o&&c.button===0&&c.ctrlKey===!1?s.onValueChange(r):c.preventDefault()}),onKeyDown:re(e.onKeyDown,c=>{[" ","Enter"].includes(c.key)&&s.onValueChange(r)}),onFocus:re(e.onFocus,()=>{const c=s.activationMode!=="manual";!d&&!o&&c&&s.onValueChange(r)})})})});OR.displayName=jR;var DR="TabsContent",IR=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Yg(DR,n),l=FR(a.baseId,r),u=LR(a.baseId,r),d=r===a.value,c=h.useRef(d);return h.useEffect(()=>{const f=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(f)},[]),p.jsx(Qt,{present:o||d,children:({present:f})=>p.jsx(he.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:c.current?"0s":void 0},children:f&&i})})});IR.displayName=DR;function FR(e,t){return`${e}-trigger-${t}`}function LR(e,t){return`${e}-content-${t}`}var XF=MR,$R=NR,UR=OR,zR=IR;const JF=XF,BR=h.forwardRef(({className:e,...t},n)=>p.jsx($R,{ref:n,className:G("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));BR.displayName=$R.displayName;const Ip=h.forwardRef(({className:e,...t},n)=>p.jsx(UR,{ref:n,className:G("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Ip.displayName=UR.displayName;const Fp=h.forwardRef(({className:e,...t},n)=>p.jsx(zR,{ref:n,className:G("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Fp.displayName=zR.displayName;var ZF="Label",VR=h.forwardRef((e,t)=>p.jsx(he.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));VR.displayName=ZF;var HR=VR;const eL=La("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Lp=h.forwardRef(({className:e,...t},n)=>p.jsx(HR,{ref:n,className:G(eL(),e),...t}));Lp.displayName=HR.displayName;var Xg="Collapsible",[tL,TL]=pr(Xg),[nL,Jg]=tL(Xg),KR=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[l=!1,u]=Wo({prop:r,defaultProp:o,onChange:s});return p.jsx(nL,{scope:n,disabled:i,contentId:rr(),open:l,onOpenToggle:h.useCallback(()=>u(d=>!d),[u]),children:p.jsx(he.div,{"data-state":em(l),"data-disabled":i?"":void 0,...a,ref:t})})});KR.displayName=Xg;var GR="CollapsibleTrigger",WR=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Jg(GR,n);return p.jsx(he.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":em(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:re(e.onClick,o.onOpenToggle)})});WR.displayName=GR;var Zg="CollapsibleContent",qR=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Jg(Zg,e.__scopeCollapsible);return p.jsx(Qt,{present:n||o.open,children:({present:i})=>p.jsx(rL,{...r,ref:t,present:i})})});qR.displayName=Zg;var rL=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=Jg(Zg,n),[a,l]=h.useState(r),u=h.useRef(null),d=Le(t,u),c=h.useRef(0),f=c.current,m=h.useRef(0),v=m.current,y=s.open||a,x=h.useRef(y),w=h.useRef();return h.useEffect(()=>{const g=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(g)},[]),Cn(()=>{const g=u.current;if(g){w.current=w.current||{transitionDuration:g.style.transitionDuration,animationName:g.style.animationName},g.style.transitionDuration="0s",g.style.animationName="none";const S=g.getBoundingClientRect();c.current=S.height,m.current=S.width,x.current||(g.style.transitionDuration=w.current.transitionDuration,g.style.animationName=w.current.animationName),l(r)}},[s.open,r]),p.jsx(he.div,{"data-state":em(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!y,...i,ref:d,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style},children:y&&o})});function em(e){return e?"open":"closed"}var oL=KR;const iL=oL,sL=WR,aL=qR,QR=h.forwardRef(({className:e,...t},n)=>p.jsx("textarea",{className:G("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));QR.displayName="Textarea";const ii=new Map;function Kd(e,t){const n=t==null?void 0:t.serializer,[r]=h.useState(t==null?void 0:t.defaultValue);return lL(e,r,t==null?void 0:t.storageSync,n==null?void 0:n.parse,n==null?void 0:n.stringify)}function lL(e,t,n=!0,r=uL,o=JSON.stringify){const i=h.useRef({string:null,parsed:void 0}),s=h.useSyncExternalStore(h.useCallback(u=>{const d=c=>{e===c&&u()};return $p.add(d),()=>{$p.delete(d)}},[e]),()=>{const u=Ol(()=>localStorage.getItem(e))??null;if(ii.has(e))i.current.parsed=ii.get(e);else if(u!==i.current.string){let d;try{d=u===null?t:r(u)}catch{d=t}i.current.parsed=d}return i.current.string=u,t!==void 0&&u===null&&Ol(()=>{const d=o(t);localStorage.setItem(e,d),i.current={string:d,parsed:t}}),i.current.parsed},()=>t),a=h.useCallback(u=>{const d=u instanceof Function?u(i.current.parsed):u;try{localStorage.setItem(e,o(d)),ii.delete(e)}catch{ii.set(e,d)}Gd(e)},[e,o]),l=h.useCallback(()=>{Ol(()=>localStorage.removeItem(e)),ii.delete(e),Gd(e)},[e]);return h.useEffect(()=>{if(!n)return;const u=d=>{d.key===e&&d.storageArea===Ol(()=>localStorage)&&Gd(e)};return window.addEventListener("storage",u),()=>window.removeEventListener("storage",u)},[e,n]),h.useMemo(()=>[s,a,{isPersistent:s===t||!ii.has(e),removeItem:l}],[e,a,s,t,l])}const $p=new Set;function Gd(e){for(const t of[...$p])t(e)}function uL(e){return e==="undefined"?void 0:JSON.parse(e)}function Ol(e){try{return e()}catch{}}const cL="/examples/aidbox-forms-smart-launch/health-samurai.svg",dL=()=>{const{toast:e}=ps(),[t,n]=h.useState(!1),[r,o]=Kd("welcome-tab",{defaultValue:"ehr"}),[i,s,{removeItem:a}]=Kd("issuer",{defaultValue:"https://launch.smarthealthit.org/v/r4/fhir"}),[l,u,{removeItem:d}]=Kd("scope",{defaultValue:u1.join(` -`)}),c=new URL(window.location);return c.search="",p.jsxs(p.Fragment,{children:[p.jsx(Xb,{open:t,onOpenChange:n,children:p.jsxs(Bg,{children:[p.jsx(Vg,{children:p.jsx(Hg,{children:"Instructions"})}),p.jsxs("div",{className:"mb-4 text-sm",children:["To run this app from within your own EHR system, you can register it as a SMART App with the following parameters:",p.jsxs("ul",{className:"list-disc ml-6 mt-2",children:[p.jsxs("li",{children:[p.jsx("span",{className:"font-semibold",children:"Launch URL:"})," ",p.jsx("code",{className:"bg-black text-white px-1 py-0.5 rounded text-xs",children:c.toString()})]}),p.jsxs("li",{children:[p.jsx("span",{className:"font-semibold",children:"Redirect URL:"})," ",p.jsx("code",{className:"bg-black text-white px-1 py-0.5 rounded text-xs",children:c.toString()})]}),p.jsxs("li",{children:[p.jsx("span",{className:"font-semibold",children:"Client ID:"})," ",p.jsx("code",{className:"bg-black text-white px-1 py-0.5 rounded text-xs",children:Iu})]}),p.jsxs("li",{children:[p.jsx("span",{className:"font-semibold",children:"PKCE:"})," ",p.jsx("code",{className:"bg-black text-white px-1 py-0.5 rounded text-xs",children:"true"})]})]})]}),p.jsxs("div",{className:"mb-4",children:["All pages in this app can serve as entry points. For example, you can directly access a form filling page for a patient using a Launch/Redirect URL like this:",p.jsx("br",{}),p.jsx("code",{className:"bg-black text-white px-1 py-0.5 rounded text-xs",children:"/questionnaire-response/[your-id]"})]})]})}),p.jsx("div",{className:"mb-4"}),p.jsxs("div",{className:"flex flex-col items-center gap-8 max-w-[24rem] mx-auto",children:[p.jsx("img",{alt:"Health Samurai",src:cL,width:"64"}),p.jsx("h1",{className:"text-2xl font-bold text-center text-pretty",children:"Welcome to Aidbox Forms Smart App"}),p.jsx("div",{className:"text-sm",children:"This is a demo smart app for launching Aidbox Forms"}),p.jsxs(JF,{defaultValue:"account",className:"w-full",value:r,onValueChange:o,children:[p.jsxs(BR,{className:"grid w-full grid-cols-2",children:[p.jsx(Ip,{value:"ehr",children:"EHR Launch"}),p.jsx(Ip,{value:"standalone",children:"Standalone Launch"})]}),p.jsx(Fp,{value:"ehr",children:p.jsxs(Hu,{children:[p.jsxs(Ku,{children:[p.jsx(Gu,{children:"Heads up!"}),p.jsxs(Rp,{className:"space-y-2",children:[p.jsx("p",{children:"If you’re seeing this page, it means the app wasn’t launched with the correct context."}),p.jsxs("p",{children:["Please refer to the"," ",p.jsx(Tt,{variant:"link",className:"underline p-0 h-auto",onClick:()=>n(!0),children:"instructions"})," ","for registering the app in your EHR."]}),p.jsx("p",{children:"Alternatively, use one of the following links to simulate launching the app from:"})]})]}),p.jsxs(Ep,{className:"gap-2",children:[p.jsx(Tt,{variant:"outline",className:"flex-1",asChild:!0,children:p.jsxs("a",{href:ly({launchUrl:c,launchType:"provider-ehr"}),children:[p.jsx(HM,{className:"text-orange-500 my-4"}),"Provider EHR"]})}),p.jsx(Tt,{variant:"outline",className:"flex-1",asChild:!0,children:p.jsxs("a",{href:ly({launchUrl:c,launchType:"patient-portal"}),children:[p.jsx(WM,{className:"text-orange-500 my-4"}),"Patient Portal"]})})]})]})}),p.jsx(Fp,{value:"standalone",children:p.jsx(iL,{children:p.jsxs(Hu,{children:[p.jsxs(Ku,{children:[p.jsxs(Gu,{className:"flex items-center justify-between",children:["Launch Parameters",p.jsx(sL,{asChild:!0,children:p.jsxs(Tt,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[p.jsx(kM,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Toggle"})]})})]}),p.jsx(Rp,{children:"Use the following parameters to launch the app standalone:"})]}),p.jsxs(Fg,{className:"space-y-2",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx(Lp,{htmlFor:"name",children:"Issuer"}),p.jsx(og,{value:i,onChange:f=>s(f.target.value)})]}),p.jsx(aL,{className:"space-y-2",children:p.jsxs("div",{className:"space-y-1",children:[p.jsx(Lp,{htmlFor:"name",children:"Scope"}),p.jsx(QR,{value:l,onChange:f=>u(f.target.value),rows:10})]})})]}),p.jsxs(Ep,{className:"justify-between",children:[p.jsx(Tt,{variant:"ghost",onClick:()=>{a(),d()},children:"Reset"}),p.jsxs(Tt,{disabled:!i||!l,variant:"outline",onClick:()=>{var m,v,y;const f=(y=(v=(m=l==null?void 0:l.split(` -`))==null?void 0:m.map(x=>x.trim()))==null?void 0:v.filter(Boolean))==null?void 0:y.join(" ");!i||!f?e({variant:"destructive",title:"Error",description:"Issuer and Scope are required"}):kA({iss:i,scope:f})},children:[p.jsx($M,{className:"text-orange-500 my-4"}),"Launch"]})]})]})})})]})]})]})};function fL(){var t;let e=Mx();return p.jsx("div",{className:"p-10",children:(t=e==null?void 0:e.message)!=null&&t.includes("fhirServiceUrl")?p.jsx(dL,{}):p.jsxs(p.Fragment,{children:[p.jsx("h1",{className:"text-4xl font-bold mb-4",children:e.status?`${e.status} - ${e.statusText}`:"Error"}),p.jsx("div",{className:"mb-2",children:"An error occurred while rendering this page."}),p.jsx("pre",{className:"text-xs bg-gray-50 px-1 py-0.5 rounded border overflow-auto empty:hidden",children:e.message})]})})}const pL=()=>{const e=h.useRef(),{id:t}=Px(),n=Ko(),{data:r}=Un({queryKey:["questionnaire-response",t],queryFn:()=>n.request(`QuestionnaireResponse/${t}`)}),o=r.questionnaire,{data:i}=Un({queryKey:["questionnaire",o],queryFn:()=>eg(n,o)}),s=Js({mutationFn:y1.bind(null,n,i)});return h.useEffect(()=>{const a=e.current,l=u=>s.mutate(u.detail);return a.addEventListener("change",l),()=>{a.removeEventListener("change",l)}},[]),Kg(e),p.jsx("aidbox-form-renderer",{ref:e,questionnaire:JSON.stringify(i),"questionnaire-response":JSON.stringify(r),style:{width:"100%",height:"100%",border:"none",flex:1}})},hL=()=>{var m;const[e]=Lh(),{patient:t}=Go(),n=Ko(),r=as(),o=Number(e.get("page"))||1,i=15,{data:s}=Un({queryKey:["questionnaire-responses",o],queryFn:()=>n.request(`QuestionnaireResponse?_subject=${t.id}&_count=${i}&_page=${o}`)}),a=Math.ceil(s.total/i),l=((m=s.entry)==null?void 0:m.map(v=>v.resource))||[],u=Symbol("dummy"),d=oy({queries:l.filter(({author:v})=>v==null?void 0:v.id).map(({author:v})=>({queryKey:["author",v.id],queryFn:()=>n.request(`Practitioner/${v.id}`).catch(()=>u)})),combine:v=>v.reduce((y,{data:x})=>(x!==u&&(y[x.id]=x),y),{})}),c=oy({queries:l.filter(({questionnaire:v})=>v).map(({questionnaire:v})=>({queryKey:["questionnaire",v],queryFn:()=>eg(n,v).then(y=>({key:v,result:y}),()=>u)})),combine:v=>v.reduce((y,{data:x})=>(x!==u&&(y[x.key]=x.result),y),{})}),f=[{header:"Author",accessorFn:v=>{var y,x,w;return(y=v.author)!=null&&y.id&&((x=d[v.author.id])!=null&&x.name)?us((w=d[v.author.id])==null?void 0:w.name):"Unknown"}},{header:"Questionnaire",accessorFn:v=>{var y,x;return(y=c[v.questionnaire])!=null&&y.title?(x=c[v.questionnaire])==null?void 0:x.title:v.questionnaire}},{header:"Last Updated",accessorFn:v=>new Date(v.meta.lastUpdated).toLocaleString()},{header:"Status",accessorKey:"status"},{id:"actions",cell:({row:{original:v}})=>p.jsxs(Ea,{modal:!0,children:[p.jsx(Pa,{asChild:!0,children:p.jsxs(Tt,{variant:"ghost",className:"h-8 w-8 p-0",children:[p.jsx("span",{className:"sr-only",children:"Open menu"}),p.jsx(rg,{className:"h-4 w-4"})]})}),p.jsxs(es,{align:"end",children:[p.jsx(Dg,{children:"Actions"}),p.jsxs(zt,{onClick:()=>navigator.clipboard.writeText(v.id),children:[p.jsx(ng,{}),"Copy ID"]}),p.jsx(Nc,{}),p.jsxs(zt,{onClick:()=>r(`/questionnaire-responses/${v.id}`),children:[p.jsx(R1,{}),"Edit response"]})]})]})}];return p.jsxs("div",{className:"p-6 overflow-auto flex-1",children:[p.jsx(Rb,{columns:f,data:l}),p.jsx(rR,{currentPage:o,totalPages:a})]})},gL=()=>{const{user:e}=Go(),{toast:t}=ps(),n=e.resourceType==="Practitioner";return h.useEffect(()=>{n||t({variant:"destructive",title:"Unauthorized",description:"Only practitioners can access this page."})},[]),n?p.jsx(kx,{}):p.jsx(KT,{to:"/"})},mL=new SA({defaultOptions:{mutations:{throwOnError:!0},queries:{suspense:!0}}}),vL=e2([{path:"/",Component:dI,ErrorBoundary:fL,children:[{index:!0,Component:SM},{path:"/questionnaire-responses",Component:hL},{path:"/questionnaire-responses/:id",Component:pL},{Component:gL,children:[{path:"/questionnaires",Component:KF},{path:"/questionnaires/:id",Component:WF}]}]}]);px(document.getElementById("root")).render(p.jsx(h.StrictMode,{children:p.jsxs(_A,{client:mL,children:[p.jsx(h.Suspense,{fallback:p.jsx(Lg,{}),children:p.jsx(u2,{router:vL})}),p.jsx(qF,{})]})}))});export default yL(); +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return h.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},mF=Tb,vF=Ab,$b=Mb,Ub=kb,zb=Ib,Bb=Lb,Vb=jb,Hb=Db;const yF=mF,wF=vF,Kb=h.forwardRef(({className:e,...t},n)=>p.jsx($b,{className:G("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));Kb.displayName=$b.displayName;const Gb=h.forwardRef(({className:e,...t},n)=>p.jsxs(wF,{children:[p.jsx(Kb,{}),p.jsx(Ub,{ref:n,className:G("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));Gb.displayName=Ub.displayName;const Wb=({className:e,...t})=>p.jsx("div",{className:G("flex flex-col space-y-2 text-center sm:text-left",e),...t});Wb.displayName="AlertDialogHeader";const qb=({className:e,...t})=>p.jsx("div",{className:G("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});qb.displayName="AlertDialogFooter";const Qb=h.forwardRef(({className:e,...t},n)=>p.jsx(Vb,{ref:n,className:G("text-lg font-semibold",e),...t}));Qb.displayName=Vb.displayName;const Yb=h.forwardRef(({className:e,...t},n)=>p.jsx(Hb,{ref:n,className:G("text-sm text-muted-foreground",e),...t}));Yb.displayName=Hb.displayName;const Xb=h.forwardRef(({className:e,...t},n)=>p.jsx(zb,{ref:n,className:G(mc(),e),...t}));Xb.displayName=zb.displayName;const Jb=h.forwardRef(({className:e,...t},n)=>p.jsx(Bb,{ref:n,className:G(mc({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Jb.displayName=Bb.displayName;const Zb=pg,xF=hg,eR=h.forwardRef(({className:e,...t},n)=>p.jsx(za,{ref:n,className:G("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));eR.displayName=za.displayName;const Vg=h.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(xF,{children:[p.jsx(eR,{}),p.jsxs(Ba,{ref:r,className:G("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:[t,p.jsxs(yc,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[p.jsx(gg,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Vg.displayName=Ba.displayName;const Hg=({className:e,...t})=>p.jsx("div",{className:G("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Hg.displayName="DialogHeader";const Kg=h.forwardRef(({className:e,...t},n)=>p.jsx(Va,{ref:n,className:G("text-lg font-semibold leading-none tracking-tight",e),...t}));Kg.displayName=Va.displayName;const SF=h.forwardRef(({className:e,...t},n)=>p.jsx(Ha,{ref:n,className:G("text-sm text-muted-foreground",e),...t}));SF.displayName=Ha.displayName;const CF=3,bF=1e6;let Bd=0;function RF(){return Bd=(Bd+1)%Number.MAX_SAFE_INTEGER,Bd.toString()}const Vd=new Map,Uy=e=>{if(Vd.has(e))return;const t=setTimeout(()=>{Vd.delete(e),ea({type:"REMOVE_TOAST",toastId:e})},bF);Vd.set(e,t)},EF=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,CF)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Uy(n):e.toasts.forEach(r=>{Uy(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},eu=[];let tu={toasts:[]};function ea(e){tu=EF(tu,e),eu.forEach(t=>{t(tu)})}function PF({...e}){const t=RF(),n=o=>ea({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>ea({type:"DISMISS_TOAST",toastId:t});return ea({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function ps(){const[e,t]=h.useState(tu);return h.useEffect(()=>(eu.push(t),()=>{const n=eu.indexOf(t);n>-1&&eu.splice(n,1)}),[e]),{...e,toast:PF,dismiss:n=>ea({type:"DISMISS_TOAST",toastId:n})}}const Gg=e=>{var r;const[,t]=h.useState(!1),n=h.useRef(null);if((r=n.current)!=null&&r.promise)throw n.current.promise;h.useLayoutEffect(()=>{n.current===null&&(n.current={},n.current.promise=new Promise(o=>{n.current.resolve=o}),t(!0))},[]),h.useEffect(()=>{const o=e.current;if(o){const i=()=>{setTimeout(()=>{var s;(s=n.current)==null||s.resolve(),n.current.promise=null},300)};return o.addEventListener("ready",i),()=>{o.removeEventListener("ready",i)}}},[])},_F=({id:e})=>{const t=h.useRef(),n=Ko(),{data:r}=Un({queryKey:["questionnaire",e],queryFn:()=>tg(n,e)}),{toast:o}=ps();return h.useEffect(()=>{const i=t.current,s=a=>{(a.detail.status==="completed"||a.detail.status==="amended")&&o({title:"Not saved",description:"This is a preview, changes will not be saved"})};return i.addEventListener("change",s),()=>{i.removeEventListener("change",s)}},[]),Gg(t),p.jsx("aidbox-form-renderer",{ref:t,questionnaire:JSON.stringify(r),style:{width:"100%",height:"100%",border:"none",flex:1}})},tR=({className:e,...t})=>p.jsx("nav",{role:"navigation","aria-label":"pagination",className:G("mx-auto flex w-full justify-center",e),...t});tR.displayName="Pagination";const nR=h.forwardRef(({className:e,...t},n)=>p.jsx("ul",{ref:n,className:G("flex flex-row items-center gap-1",e),...t}));nR.displayName="PaginationContent";const Mn=h.forwardRef(({className:e,...t},n)=>p.jsx("li",{ref:n,className:G("",e),...t}));Mn.displayName="PaginationItem";const Tr=({className:e,isActive:t,size:n="icon",...r})=>p.jsx(Ys,{"aria-current":t?"page":void 0,className:G(mc({variant:t?"outline":"ghost",size:n}),e),...r});Tr.displayName="PaginationLink";const rR=({className:e,...t})=>p.jsxs(Tr,{"aria-label":"Go to previous page",size:"default",className:G("gap-1 pl-2.5",e),...t,children:[p.jsx(PN,{className:"h-4 w-4"}),p.jsx("span",{children:"Previous"})]});rR.displayName="PaginationPrevious";const oR=({className:e,...t})=>p.jsxs(Tr,{"aria-label":"Go to next page",size:"default",className:G("gap-1 pr-2.5",e),...t,children:[p.jsx("span",{children:"Next"}),p.jsx(aS,{className:"h-4 w-4"})]});oR.displayName="PaginationNext";const jp=({className:e,...t})=>p.jsxs("span",{"aria-hidden":!0,className:G("flex h-9 w-9 items-center justify-center",e),...t,children:[p.jsx(NN,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"More pages"})]});jp.displayName="PaginationEllipsis";const iR=({currentPage:e,totalPages:t})=>{const[n]=$h(),r=i=>(n.set("page",i),`?${n}`);if(t<=1)return null;const o=xM(e,t);return p.jsx(tR,{className:"mt-4",children:p.jsxs(nR,{children:[o.prevButtonEnabled&&p.jsx(Mn,{children:p.jsx(rR,{to:r(e-1)})}),o.showFirstPageButton&&p.jsx(Mn,{children:p.jsx(Tr,{to:r(1),children:1})}),o.showFirstEllipsis&&p.jsx(Mn,{children:p.jsx(jp,{})}),o.pagesBeforeCurrent.map(i=>p.jsx(Mn,{children:p.jsx(Tr,{to:r(i),children:i})},i)),p.jsx(Mn,{children:p.jsx(Tr,{isActive:!0,children:e})}),o.pagesAfterCurrent.map(i=>p.jsx(Mn,{children:p.jsx(Tr,{to:r(i),children:i})},i)),o.showLastEllipsis&&p.jsx(Mn,{children:p.jsx(jp,{})}),o.showLastPageButton&&p.jsx(Mn,{children:p.jsx(Tr,{to:r(t),children:t})}),o.nextButtonEnabled&&p.jsx(Mn,{children:p.jsx(oR,{to:r(e+1)})})]})})};var Wg="ToastProvider",[qg,TF,AF]=Pg("Toast"),[sR,AL]=pr("Toast",[AF]),[MF,Oc]=sR(Wg),aR=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:i=50,children:s}=e,[a,l]=h.useState(null),[u,d]=h.useState(0),c=h.useRef(!1),f=h.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Wg}\`. Expected non-empty \`string\`.`),p.jsx(qg.Provider,{scope:t,children:p.jsx(MF,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:i,toastCount:u,viewport:a,onViewportChange:l,onToastAdd:h.useCallback(()=>d(m=>m+1),[]),onToastRemove:h.useCallback(()=>d(m=>m-1),[]),isFocusedToastEscapeKeyDownRef:c,isClosePausedRef:f,children:s})})};aR.displayName=Wg;var lR="ToastViewport",kF=["F8"],Op="toast.viewportPause",Dp="toast.viewportResume",uR=h.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=kF,label:o="Notifications ({hotkey})",...i}=e,s=Oc(lR,n),a=TF(n),l=h.useRef(null),u=h.useRef(null),d=h.useRef(null),c=h.useRef(null),f=Le(t,c,s.onViewportChange),m=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=s.toastCount>0;h.useEffect(()=>{const x=w=>{var S;r.length!==0&&r.every(C=>w[C]||w.code===C)&&((S=c.current)==null||S.focus())};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[r]),h.useEffect(()=>{const x=l.current,w=c.current;if(v&&x&&w){const g=()=>{if(!s.isClosePausedRef.current){const b=new CustomEvent(Op);w.dispatchEvent(b),s.isClosePausedRef.current=!0}},S=()=>{if(s.isClosePausedRef.current){const b=new CustomEvent(Dp);w.dispatchEvent(b),s.isClosePausedRef.current=!1}},C=b=>{!x.contains(b.relatedTarget)&&S()},P=()=>{x.contains(document.activeElement)||S()};return x.addEventListener("focusin",g),x.addEventListener("focusout",C),x.addEventListener("pointermove",g),x.addEventListener("pointerleave",P),window.addEventListener("blur",g),window.addEventListener("focus",S),()=>{x.removeEventListener("focusin",g),x.removeEventListener("focusout",C),x.removeEventListener("pointermove",g),x.removeEventListener("pointerleave",P),window.removeEventListener("blur",g),window.removeEventListener("focus",S)}}},[v,s.isClosePausedRef]);const y=h.useCallback(({tabbingDirection:x})=>{const g=a().map(S=>{const C=S.ref.current,P=[C,...HF(C)];return x==="forwards"?P:P.reverse()});return(x==="forwards"?g.reverse():g).flat()},[a]);return h.useEffect(()=>{const x=c.current;if(x){const w=g=>{var P,b,M;const S=g.altKey||g.ctrlKey||g.metaKey;if(g.key==="Tab"&&!S){const A=document.activeElement,$=g.shiftKey;if(g.target===x&&$){(P=u.current)==null||P.focus();return}const F=y({tabbingDirection:$?"backwards":"forwards"}),N=F.findIndex(E=>E===A);Hd(F.slice(N+1))?g.preventDefault():$?(b=u.current)==null||b.focus():(M=d.current)==null||M.focus()}};return x.addEventListener("keydown",w),()=>x.removeEventListener("keydown",w)}},[a,y]),p.jsxs(mk,{ref:l,role:"region","aria-label":o.replace("{hotkey}",m),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&p.jsx(Ip,{ref:u,onFocusFromOutsideViewport:()=>{const x=y({tabbingDirection:"forwards"});Hd(x)}}),p.jsx(qg.Slot,{scope:n,children:p.jsx(he.ol,{tabIndex:-1,...i,ref:f})}),v&&p.jsx(Ip,{ref:d,onFocusFromOutsideViewport:()=>{const x=y({tabbingDirection:"backwards"});Hd(x)}})]})});uR.displayName=lR;var cR="ToastFocusProxy",Ip=h.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,i=Oc(cR,n);return p.jsx(bc,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:s=>{var u;const a=s.relatedTarget;!((u=i.viewport)!=null&&u.contains(a))&&r()}})});Ip.displayName=cR;var Dc="Toast",NF="toast.swipeStart",jF="toast.swipeMove",OF="toast.swipeCancel",DF="toast.swipeEnd",dR=h.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:i,...s}=e,[a=!0,l]=Wo({prop:r,defaultProp:o,onChange:i});return p.jsx(Qt,{present:n||a,children:p.jsx(LF,{open:a,...s,ref:t,onClose:()=>l(!1),onPause:mt(e.onPause),onResume:mt(e.onResume),onSwipeStart:re(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:re(e.onSwipeMove,u=>{const{x:d,y:c}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${c}px`)}),onSwipeCancel:re(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:re(e.onSwipeEnd,u=>{const{x:d,y:c}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${c}px`),l(!1)})})})});dR.displayName=Dc;var[IF,FF]=sR(Dc,{onClose(){}}),LF=h.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:i,onClose:s,onEscapeKeyDown:a,onPause:l,onResume:u,onSwipeStart:d,onSwipeMove:c,onSwipeCancel:f,onSwipeEnd:m,...v}=e,y=Oc(Dc,n),[x,w]=h.useState(null),g=Le(t,E=>w(E)),S=h.useRef(null),C=h.useRef(null),P=o||y.duration,b=h.useRef(0),M=h.useRef(P),A=h.useRef(0),{onToastAdd:$,onToastRemove:R}=y,O=mt(()=>{var T;(x==null?void 0:x.contains(document.activeElement))&&((T=y.viewport)==null||T.focus()),s()}),F=h.useCallback(E=>{!E||E===1/0||(window.clearTimeout(A.current),b.current=new Date().getTime(),A.current=window.setTimeout(O,E))},[O]);h.useEffect(()=>{const E=y.viewport;if(E){const T=()=>{F(M.current),u==null||u()},D=()=>{const V=new Date().getTime()-b.current;M.current=M.current-V,window.clearTimeout(A.current),l==null||l()};return E.addEventListener(Op,D),E.addEventListener(Dp,T),()=>{E.removeEventListener(Op,D),E.removeEventListener(Dp,T)}}},[y.viewport,P,l,u,F]),h.useEffect(()=>{i&&!y.isClosePausedRef.current&&F(P)},[i,P,y.isClosePausedRef,F]),h.useEffect(()=>($(),()=>R()),[$,R]);const N=h.useMemo(()=>x?yR(x):null,[x]);return y.viewport?p.jsxs(p.Fragment,{children:[N&&p.jsx($F,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:N}),p.jsx(IF,{scope:n,onClose:O,children:os.createPortal(p.jsx(qg.ItemSlot,{scope:n,children:p.jsx(gk,{asChild:!0,onEscapeKeyDown:re(a,()=>{y.isFocusedToastEscapeKeyDownRef.current||O(),y.isFocusedToastEscapeKeyDownRef.current=!1}),children:p.jsx(he.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":y.swipeDirection,...v,ref:g,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:re(e.onKeyDown,E=>{E.key==="Escape"&&(a==null||a(E.nativeEvent),E.nativeEvent.defaultPrevented||(y.isFocusedToastEscapeKeyDownRef.current=!0,O()))}),onPointerDown:re(e.onPointerDown,E=>{E.button===0&&(S.current={x:E.clientX,y:E.clientY})}),onPointerMove:re(e.onPointerMove,E=>{if(!S.current)return;const T=E.clientX-S.current.x,D=E.clientY-S.current.y,V=!!C.current,L=["left","right"].includes(y.swipeDirection),j=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,B=L?j(0,T):0,Q=L?0:j(0,D),te=E.pointerType==="touch"?10:2,fe={x:B,y:Q},ge={originalEvent:E,delta:fe};V?(C.current=fe,jl(jF,c,ge,{discrete:!1})):zy(fe,y.swipeDirection,te)?(C.current=fe,jl(NF,d,ge,{discrete:!1}),E.target.setPointerCapture(E.pointerId)):(Math.abs(T)>te||Math.abs(D)>te)&&(S.current=null)}),onPointerUp:re(e.onPointerUp,E=>{const T=C.current,D=E.target;if(D.hasPointerCapture(E.pointerId)&&D.releasePointerCapture(E.pointerId),C.current=null,S.current=null,T){const V=E.currentTarget,L={originalEvent:E,delta:T};zy(T,y.swipeDirection,y.swipeThreshold)?jl(DF,m,L,{discrete:!0}):jl(OF,f,L,{discrete:!0}),V.addEventListener("click",j=>j.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null}),$F=e=>{const{__scopeToast:t,children:n,...r}=e,o=Oc(Dc,t),[i,s]=h.useState(!1),[a,l]=h.useState(!1);return BF(()=>s(!0)),h.useEffect(()=>{const u=window.setTimeout(()=>l(!0),1e3);return()=>window.clearTimeout(u)},[]),a?null:p.jsx(Ua,{asChild:!0,children:p.jsx(bc,{...r,children:i&&p.jsxs(p.Fragment,{children:[o.label," ",n]})})})},UF="ToastTitle",fR=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(he.div,{...r,ref:t})});fR.displayName=UF;var zF="ToastDescription",pR=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return p.jsx(he.div,{...r,ref:t})});pR.displayName=zF;var hR="ToastAction",gR=h.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?p.jsx(vR,{altText:n,asChild:!0,children:p.jsx(Qg,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${hR}\`. Expected non-empty \`string\`.`),null)});gR.displayName=hR;var mR="ToastClose",Qg=h.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=FF(mR,n);return p.jsx(vR,{asChild:!0,children:p.jsx(he.button,{type:"button",...r,ref:t,onClick:re(e.onClick,o.onClose)})})});Qg.displayName=mR;var vR=h.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return p.jsx(he.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function yR(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),VF(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!o)if(i){const s=r.dataset.radixToastAnnounceAlt;s&&t.push(s)}else t.push(...yR(r))}}),t}function jl(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?sg(o,i):o.dispatchEvent(i)}var zy=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),i=r>o;return t==="left"||t==="right"?i&&r>n:!i&&o>n};function BF(e=()=>{}){const t=mt(e);Cn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function VF(e){return e.nodeType===e.ELEMENT_NODE}function HF(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function Hd(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var KF=aR,wR=uR,xR=dR,SR=fR,CR=pR,bR=gR,RR=Qg;const GF=KF,ER=h.forwardRef(({className:e,...t},n)=>p.jsx(wR,{ref:n,className:G("fixed top-0 left-1/2 -translate-x-1/2 z-[100] gap-2 flex max-h-screen w-full flex-col-reverse p-4 md:max-w-[420px]",e),...t}));ER.displayName=wR.displayName;const WF=La("group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-top-full data-[state=open]:slide-in-from-top-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),PR=h.forwardRef(({className:e,variant:t,...n},r)=>p.jsx(xR,{ref:r,className:G(WF({variant:t}),e),...n}));PR.displayName=xR.displayName;const _R=h.forwardRef(({className:e,...t},n)=>p.jsx(bR,{ref:n,className:G("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",e),...t}));_R.displayName=bR.displayName;const TR=h.forwardRef(({className:e,...t},n)=>p.jsx(RR,{ref:n,className:G("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",e),"toast-close":"",...t,children:p.jsx(gg,{className:"h-4 w-4"})}));TR.displayName=RR.displayName;const AR=h.forwardRef(({className:e,...t},n)=>p.jsx(SR,{ref:n,className:G("text-sm font-semibold [&+div]:text-xs",e),...t}));AR.displayName=SR.displayName;const MR=h.forwardRef(({className:e,...t},n)=>p.jsx(CR,{ref:n,className:G("text-sm opacity-90",e),...t}));MR.displayName=CR.displayName;const qF=()=>{var F;const e=hc(),[t,n]=$h(),{user:r,patient:o,encounter:i}=Go(),s=Ko(),{toast:a}=ps(),l=as(),u=Number(t.get("page"))||1,d=15,c=t.get("source")||"library",f=N=>{t.set("source",N),n(t)},m=["questionnaires",c,u],v=["questionnaires","ehr",1],{data:y}=Un({queryKey:["questionnaire-pager","library"],queryFn:()=>dy(er,"Questionnaire",d)}),{data:x}=Un({queryKey:["questionnaire-pager","ehr"],queryFn:()=>dy(s,"Questionnaire",d)}),{data:w}=Un({queryKey:m,queryFn:()=>c==="library"?y(u):x(u)}),g=Js({mutationFn:bM,onSuccess:N=>{a({title:"Response created",description:`New response created for ${us(o.name)}`}),l(`/questionnaire-responses/${N.id}`)}}),S=Js({mutationFn:N=>S1(s,N),onMutate:async N=>{await e.cancelQueries({queryKey:v});const E=e.getQueryData(v);return e.setQueryData(v,T=>({...T,entry:[{resource:N},...(T==null?void 0:T.entry)||[]]})),l("?source=ehr&page=1"),{previousData:E}},onSuccess:async(N,E,T)=>{var D;await e.cancelQueries({queryKey:v}),e.setQueryData(v,{...T.previousData,entry:[{resource:N},...((D=T.previousData)==null?void 0:D.entry)||[]]}),a({title:"Questionnaire imported",description:"Questionnaire imported successfully",action:p.jsx(_R,{altText:"Edit",onClick:()=>{l(`/questionnaires/${N.id}`)},children:"Edit"})})},onError:(N,E,T)=>{e.setQueryData(v,T.previousData),a({variant:"destructive",title:"Import questionnaire",description:`Unable to import questionnaire: ${N.message}`})},onSettled:()=>{e.invalidateQueries({queryKey:v})}}),C=Js({mutationFn:N=>CM(s,N),onSuccess:async(N,E)=>{await e.cancelQueries({queryKey:m}),e.setQueryData(m,T=>{var D;return{...T,entry:(D=T.entry)==null?void 0:D.filter(V=>V.resource.id!==E.id)}}),a({title:"Questionnaire deleted",description:"Questionnaire deleted successfully"})},onError:(N,E,T)=>{a({variant:"destructive",title:"Delete questionnaire",description:`Unable to delete questionnaire: ${N.message}`})},onSettled:()=>{e.invalidateQueries({queryKey:m})}}),P=Math.ceil(w.total/d),b=((F=w.entry)==null?void 0:F.map(N=>({publisher:c==="library"?"Health Samurai":void 0,...N.resource})))||[],[M,A]=h.useState(null),[$,R]=h.useState(null),O=[{accessorKey:"title",header:"Title"},{accessorKey:"status",header:"Status"},{accessorKey:"version",header:"Version"},{accessorKey:"publisher",header:"Publisher"},{id:"actions",cell:({row:{original:N}})=>{var T;const E=g.isPending&&g.variables.questionnaire.id===N.id||N.id===((T=C.variables)==null?void 0:T.id)||N.id===void 0;return E?p.jsx(fb,{className:"h-4 my-2"}):p.jsxs(Ea,{children:[p.jsx(Pa,{asChild:!0,children:p.jsxs(Tt,{variant:"ghost",className:"h-8 w-8 p-0",disabled:E,children:[p.jsx("span",{className:"sr-only",children:"Open menu"}),p.jsx(og,{className:"h-4 w-4"})]})}),p.jsxs(es,{align:"end",children:[p.jsx(Ig,{children:"Actions"}),p.jsxs(zt,{onClick:()=>navigator.clipboard.writeText(N.id),children:[p.jsx(rg,{}),"Copy ID"]}),p.jsx(Nc,{}),p.jsxs(zt,{onClick:()=>A(N.id),children:[p.jsx(IM,{}),"Preview"]}),p.jsx(zt,{asChild:!0,children:p.jsxs(Ys,{to:`/questionnaires/${N.id}`,children:[p.jsx(P1,{}),"Edit"]})}),c==="library"&&p.jsxs(zt,{onClick:()=>{S.mutate({...N,id:void 0})},children:[p.jsx($M,{}),"Import"]}),c!=="library"&&p.jsxs(zt,{className:"text-destructive focus:text-destructive",onClick:()=>R(N),children:[p.jsx(qM,{}),"Delete"]}),p.jsxs(zt,{onClick:()=>{g.mutate({client:s,questionnaire:{...N,url:c==="library"?`${er.state.serverUrl}/Questionnaire/${N.id}`:void 0},subject:o,encounter:i,author:r})},children:[p.jsx(VM,{}),"Create response"]})]})]})}}];return p.jsxs("div",{className:"p-6 overflow-auto flex-1",children:[p.jsx("div",{className:"mb-4 flex justify-end",children:p.jsxs(Ea,{children:[p.jsx(Pa,{asChild:!0,children:p.jsxs(Tt,{variant:"outline",className:"ml-auto",children:["Source: ",c==="library"?"Forms Public Library":"EHR",p.jsx(E1,{className:"ml-2 h-4 w-4"})]})}),p.jsx(es,{align:"end",children:p.jsxs(rI,{value:c,onValueChange:f,children:[p.jsx(Rp,{value:"library",children:"Forms Library"}),p.jsx(Rp,{value:"ehr",children:"EHR"})]})})]})}),p.jsx(Pb,{columns:O,data:b}),p.jsx(iR,{currentPage:u,totalPages:P}),p.jsx(yF,{onOpenChange:N=>{N||R(null)},open:!!$,children:p.jsxs(Gb,{children:[p.jsxs(Wb,{children:[p.jsx(Qb,{children:"Are you absolutely sure?"}),p.jsx(Yb,{children:"This action cannot be undone. Proceeding will permanently delete this questionnaire from the system."})]}),p.jsxs(qb,{children:[p.jsx(Jb,{children:"Cancel"}),p.jsx(Xb,{onClick:()=>{C.mutate($),R(null)},children:"Continue"})]})]})}),p.jsx(Zb,{onOpenChange:N=>{N||A(null)},open:!!M,children:p.jsxs(Vg,{className:"flex flex-col max-w-[calc(100vw_-_4rem)] h-[calc(100vh_-_4rem)]",children:[p.jsx(Hg,{children:p.jsx(Kg,{children:"Preview"})}),M&&p.jsx(h.Suspense,{fallback:p.jsx($g,{}),children:p.jsx(_F,{id:M})})]})})]})},QF=({id:e})=>{const t=h.useRef(),n=Ko(),{toast:r}=ps(),o=h.useRef(!1),{data:[i,s]}=Un({queryKey:["questionnaire",e],queryFn:()=>C1(n,e)}),a=Js({mutationFn:l=>S1(i,l),onSuccess:()=>{o.current||(o.current=!0,r({title:"Questionnaire is autosaved",description:"All changes are saved automatically"}))}});return Gg(t),h.useEffect(()=>{if(i!==er){const l=t.current,u=d=>a.mutate(d.detail);return l.addEventListener("change",u),()=>{l.removeEventListener("change",u)}}else r({title:"This questionnaire is read-only",description:"You can't save changes to questionnaires from the library. Please import it first to your EHR to make changes."})},[]),p.jsx("aidbox-form-builder",{"hide-back":!0,"show-share":!1,"hide-population":!0,"hide-extraction":!0,"hide-publish":!0,"hide-add-theme":!0,"hide-edit-theme":!0,"hide-save-theme":!0,"hide-convert":!0,"hide-save":!0,"disable-save":!0,ref:t,value:JSON.stringify(s),style:{width:"100%",height:"100%",border:"none",flex:1}})},YF=()=>{const{id:e}=Tx();return p.jsx(QF,{id:e})};function XF(){const{toasts:e}=ps();return p.jsxs(GF,{children:[e.map(function({id:t,title:n,description:r,action:o,...i}){return p.jsxs(PR,{...i,children:[p.jsxs("div",{className:"grid gap-1",children:[n&&p.jsx(AR,{children:n}),r&&p.jsx(MR,{children:r})]}),o,p.jsx(TR,{})]},t)}),p.jsx(ER,{})]})}var Yg="Tabs",[JF,ML]=pr(Yg,[Ac]),kR=Ac(),[ZF,Xg]=JF(Yg),NR=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:i,orientation:s="horizontal",dir:a,activationMode:l="automatic",...u}=e,d=_g(a),[c,f]=Wo({prop:r,onChange:o,defaultProp:i});return p.jsx(ZF,{scope:n,baseId:rr(),value:c,onValueChange:f,orientation:s,dir:d,activationMode:l,children:p.jsx(he.div,{dir:d,"data-orientation":s,...u,ref:t})})});NR.displayName=Yg;var jR="TabsList",OR=h.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,i=Xg(jR,n),s=kR(n);return p.jsx(rC,{asChild:!0,...s,orientation:i.orientation,dir:i.dir,loop:r,children:p.jsx(he.div,{role:"tablist","aria-orientation":i.orientation,...o,ref:t})})});OR.displayName=jR;var DR="TabsTrigger",IR=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...i}=e,s=Xg(DR,n),a=kR(n),l=$R(s.baseId,r),u=UR(s.baseId,r),d=r===s.value;return p.jsx(oC,{asChild:!0,...a,focusable:!o,active:d,children:p.jsx(he.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:l,...i,ref:t,onMouseDown:re(e.onMouseDown,c=>{!o&&c.button===0&&c.ctrlKey===!1?s.onValueChange(r):c.preventDefault()}),onKeyDown:re(e.onKeyDown,c=>{[" ","Enter"].includes(c.key)&&s.onValueChange(r)}),onFocus:re(e.onFocus,()=>{const c=s.activationMode!=="manual";!d&&!o&&c&&s.onValueChange(r)})})})});IR.displayName=DR;var FR="TabsContent",LR=h.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:i,...s}=e,a=Xg(FR,n),l=$R(a.baseId,r),u=UR(a.baseId,r),d=r===a.value,c=h.useRef(d);return h.useEffect(()=>{const f=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(f)},[]),p.jsx(Qt,{present:o||d,children:({present:f})=>p.jsx(he.div,{"data-state":d?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!f,id:u,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:c.current?"0s":void 0},children:f&&i})})});LR.displayName=FR;function $R(e,t){return`${e}-trigger-${t}`}function UR(e,t){return`${e}-content-${t}`}var eL=NR,zR=OR,BR=IR,VR=LR;const tL=eL,HR=h.forwardRef(({className:e,...t},n)=>p.jsx(zR,{ref:n,className:G("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));HR.displayName=zR.displayName;const Fp=h.forwardRef(({className:e,...t},n)=>p.jsx(BR,{ref:n,className:G("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",e),...t}));Fp.displayName=BR.displayName;const Lp=h.forwardRef(({className:e,...t},n)=>p.jsx(VR,{ref:n,className:G("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Lp.displayName=VR.displayName;var nL="Label",KR=h.forwardRef((e,t)=>p.jsx(he.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));KR.displayName=nL;var GR=KR;const rL=La("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),$p=h.forwardRef(({className:e,...t},n)=>p.jsx(GR,{ref:n,className:G(rL(),e),...t}));$p.displayName=GR.displayName;var Jg="Collapsible",[oL,kL]=pr(Jg),[iL,Zg]=oL(Jg),WR=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:r,defaultOpen:o,disabled:i,onOpenChange:s,...a}=e,[l=!1,u]=Wo({prop:r,defaultProp:o,onChange:s});return p.jsx(iL,{scope:n,disabled:i,contentId:rr(),open:l,onOpenToggle:h.useCallback(()=>u(d=>!d),[u]),children:p.jsx(he.div,{"data-state":tm(l),"data-disabled":i?"":void 0,...a,ref:t})})});WR.displayName=Jg;var qR="CollapsibleTrigger",QR=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,...r}=e,o=Zg(qR,n);return p.jsx(he.button,{type:"button","aria-controls":o.contentId,"aria-expanded":o.open||!1,"data-state":tm(o.open),"data-disabled":o.disabled?"":void 0,disabled:o.disabled,...r,ref:t,onClick:re(e.onClick,o.onOpenToggle)})});QR.displayName=qR;var em="CollapsibleContent",YR=h.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=Zg(em,e.__scopeCollapsible);return p.jsx(Qt,{present:n||o.open,children:({present:i})=>p.jsx(sL,{...r,ref:t,present:i})})});YR.displayName=em;var sL=h.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:r,children:o,...i}=e,s=Zg(em,n),[a,l]=h.useState(r),u=h.useRef(null),d=Le(t,u),c=h.useRef(0),f=c.current,m=h.useRef(0),v=m.current,y=s.open||a,x=h.useRef(y),w=h.useRef();return h.useEffect(()=>{const g=requestAnimationFrame(()=>x.current=!1);return()=>cancelAnimationFrame(g)},[]),Cn(()=>{const g=u.current;if(g){w.current=w.current||{transitionDuration:g.style.transitionDuration,animationName:g.style.animationName},g.style.transitionDuration="0s",g.style.animationName="none";const S=g.getBoundingClientRect();c.current=S.height,m.current=S.width,x.current||(g.style.transitionDuration=w.current.transitionDuration,g.style.animationName=w.current.animationName),l(r)}},[s.open,r]),p.jsx(he.div,{"data-state":tm(s.open),"data-disabled":s.disabled?"":void 0,id:s.contentId,hidden:!y,...i,ref:d,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style},children:y&&o})});function tm(e){return e?"open":"closed"}var aL=WR;const lL=aL,uL=QR,cL=YR,XR=h.forwardRef(({className:e,...t},n)=>p.jsx("textarea",{className:G("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));XR.displayName="Textarea";const ii=new Map;function Kd(e,t){const n=t==null?void 0:t.serializer,[r]=h.useState(t==null?void 0:t.defaultValue);return dL(e,r,t==null?void 0:t.storageSync,n==null?void 0:n.parse,n==null?void 0:n.stringify)}function dL(e,t,n=!0,r=fL,o=JSON.stringify){const i=h.useRef({string:null,parsed:void 0}),s=h.useSyncExternalStore(h.useCallback(u=>{const d=c=>{e===c&&u()};return Up.add(d),()=>{Up.delete(d)}},[e]),()=>{const u=Ol(()=>localStorage.getItem(e))??null;if(ii.has(e))i.current.parsed=ii.get(e);else if(u!==i.current.string){let d;try{d=u===null?t:r(u)}catch{d=t}i.current.parsed=d}return i.current.string=u,t!==void 0&&u===null&&Ol(()=>{const d=o(t);localStorage.setItem(e,d),i.current={string:d,parsed:t}}),i.current.parsed},()=>t),a=h.useCallback(u=>{const d=u instanceof Function?u(i.current.parsed):u;try{localStorage.setItem(e,o(d)),ii.delete(e)}catch{ii.set(e,d)}Gd(e)},[e,o]),l=h.useCallback(()=>{Ol(()=>localStorage.removeItem(e)),ii.delete(e),Gd(e)},[e]);return h.useEffect(()=>{if(!n)return;const u=d=>{d.key===e&&d.storageArea===Ol(()=>localStorage)&&Gd(e)};return window.addEventListener("storage",u),()=>window.removeEventListener("storage",u)},[e,n]),h.useMemo(()=>[s,a,{isPersistent:s===t||!ii.has(e),removeItem:l}],[e,a,s,t,l])}const Up=new Set;function Gd(e){for(const t of[...Up])t(e)}function fL(e){return e==="undefined"?void 0:JSON.parse(e)}function Ol(e){try{return e()}catch{}}const pL="/examples/aidbox-forms-smart-launch/health-samurai.svg",hL=()=>{const{toast:e}=ps(),[t,n]=h.useState(!1),[r,o]=Kd("welcome-tab",{defaultValue:"ehr"}),[i,s,{removeItem:a}]=Kd("issuer",{defaultValue:"https://launch.smarthealthit.org/v/r4/fhir"}),[l,u,{removeItem:d}]=Kd("scope",{defaultValue:d1.join(` +`)}),c=new URL(window.location);return c.search="",p.jsxs(p.Fragment,{children:[p.jsx(Zb,{open:t,onOpenChange:n,children:p.jsxs(Vg,{children:[p.jsx(Hg,{children:p.jsx(Kg,{children:"Instructions"})}),p.jsxs("div",{className:"mb-4 text-sm",children:["To run this app from within your own EHR system, you can register it as a SMART App with the following parameters:",p.jsxs("ul",{className:"list-disc ml-6 mt-2",children:[p.jsxs("li",{children:[p.jsx("span",{className:"font-semibold",children:"Launch URL:"})," ",p.jsx("code",{className:"bg-black text-white px-1 py-0.5 rounded text-xs",children:c.toString()})]}),p.jsxs("li",{children:[p.jsx("span",{className:"font-semibold",children:"Redirect URL:"})," ",p.jsx("code",{className:"bg-black text-white px-1 py-0.5 rounded text-xs",children:c.toString()})]}),p.jsxs("li",{children:[p.jsx("span",{className:"font-semibold",children:"Client ID:"})," ",p.jsx("code",{className:"bg-black text-white px-1 py-0.5 rounded text-xs",children:Iu})]}),p.jsxs("li",{children:[p.jsx("span",{className:"font-semibold",children:"PKCE:"})," ",p.jsx("code",{className:"bg-black text-white px-1 py-0.5 rounded text-xs",children:"true"})]})]})]}),p.jsxs("div",{className:"mb-4",children:["All pages in this app can serve as entry points. For example, you can directly access a form filling page for a patient using a Launch/Redirect URL like this:",p.jsx("br",{}),p.jsx("code",{className:"bg-black text-white px-1 py-0.5 rounded text-xs",children:"/questionnaire-response/[your-id]"})]})]})}),p.jsx("div",{className:"mb-4"}),p.jsxs("div",{className:"flex flex-col items-center gap-8 max-w-[24rem] mx-auto",children:[p.jsx("img",{alt:"Health Samurai",src:pL,width:"64"}),p.jsx("h1",{className:"text-2xl font-bold text-center text-pretty",children:"Welcome to Aidbox Forms Smart App"}),p.jsx("div",{className:"text-sm",children:"This is a demo smart app for launching Aidbox Forms"}),p.jsxs(tL,{defaultValue:"account",className:"w-full",value:r,onValueChange:o,children:[p.jsxs(HR,{className:"grid w-full grid-cols-2",children:[p.jsx(Fp,{value:"ehr",children:"EHR Launch"}),p.jsx(Fp,{value:"standalone",children:"Standalone Launch"})]}),p.jsx(Lp,{value:"ehr",children:p.jsxs(Hu,{children:[p.jsxs(Ku,{children:[p.jsx(Gu,{children:"Heads up!"}),p.jsxs(Ep,{className:"space-y-2",children:[p.jsx("p",{children:"If you’re seeing this page, it means the app wasn’t launched with the correct context."}),p.jsxs("p",{children:["Please refer to the"," ",p.jsx(Tt,{variant:"link",className:"underline p-0 h-auto",onClick:()=>n(!0),children:"instructions"})," ","for registering the app in your EHR."]}),p.jsx("p",{children:"Alternatively, use one of the following links to simulate launching the app from:"})]})]}),p.jsxs(Pp,{className:"gap-2",children:[p.jsx(Tt,{variant:"outline",className:"flex-1",asChild:!0,children:p.jsxs("a",{href:cy({launchUrl:c,launchType:"provider-ehr"}),children:[p.jsx(WM,{className:"text-orange-500 my-4"}),"Provider EHR"]})}),p.jsx(Tt,{variant:"outline",className:"flex-1",asChild:!0,children:p.jsxs("a",{href:cy({launchUrl:c,launchType:"patient-portal"}),children:[p.jsx(YM,{className:"text-orange-500 my-4"}),"Patient Portal"]})})]})]})}),p.jsx(Lp,{value:"standalone",children:p.jsx(lL,{children:p.jsxs(Hu,{children:[p.jsxs(Ku,{children:[p.jsxs(Gu,{className:"flex items-center justify-between",children:["Launch Parameters",p.jsx(uL,{asChild:!0,children:p.jsxs(Tt,{variant:"ghost",size:"sm",className:"w-9 p-0",children:[p.jsx(OM,{className:"h-4 w-4"}),p.jsx("span",{className:"sr-only",children:"Toggle"})]})})]}),p.jsx(Ep,{children:"Use the following parameters to launch the app standalone:"})]}),p.jsxs(Lg,{className:"space-y-2",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx($p,{htmlFor:"name",children:"Issuer"}),p.jsx(ig,{value:i,onChange:f=>s(f.target.value)})]}),p.jsx(cL,{className:"space-y-2",children:p.jsxs("div",{className:"space-y-1",children:[p.jsx($p,{htmlFor:"name",children:"Scope"}),p.jsx(XR,{value:l,onChange:f=>u(f.target.value),rows:10})]})})]}),p.jsxs(Pp,{className:"justify-between",children:[p.jsx(Tt,{variant:"ghost",onClick:()=>{a(),d()},children:"Reset"}),p.jsxs(Tt,{disabled:!i||!l,variant:"outline",onClick:()=>{var m,v,y;const f=(y=(v=(m=l==null?void 0:l.split(` +`))==null?void 0:m.map(x=>x.trim()))==null?void 0:v.filter(Boolean))==null?void 0:y.join(" ");!i||!f?e({variant:"destructive",title:"Error",description:"Issuer and Scope are required"}):OA({iss:i,scope:f})},children:[p.jsx(BM,{className:"text-orange-500 my-4"}),"Launch"]})]})]})})})]})]})]})};function gL(){var t;let e=Nx();return p.jsx("div",{className:"p-10",children:(t=e==null?void 0:e.message)!=null&&t.includes("fhirServiceUrl")?p.jsx(hL,{}):p.jsxs(p.Fragment,{children:[p.jsx("h1",{className:"text-4xl font-bold mb-4",children:e.status?`${e.status} - ${e.statusText}`:"Error"}),p.jsx("div",{className:"mb-2",children:"An error occurred while rendering this page."}),p.jsx("pre",{className:"text-xs bg-gray-50 px-1 py-0.5 rounded border overflow-auto empty:hidden",children:e.message})]})})}const mL=()=>{const e=h.useRef(),{id:t}=Tx(),n=Ko(),{data:r}=Un({queryKey:["questionnaire-response",t],queryFn:()=>n.request(`QuestionnaireResponse/${t}`)}),o=r.questionnaire,{data:i}=Un({queryKey:["questionnaire",o],queryFn:()=>tg(n,o)}),s=Js({mutationFn:x1.bind(null,n,i)});return h.useEffect(()=>{const a=e.current,l=u=>s.mutate(u.detail);return a.addEventListener("change",l),()=>{a.removeEventListener("change",l)}},[]),Gg(e),p.jsx("aidbox-form-renderer",{ref:e,questionnaire:JSON.stringify(i),"questionnaire-response":JSON.stringify(r),style:{width:"100%",height:"100%",border:"none",flex:1}})},vL=()=>{var m;const[e]=$h(),{patient:t}=Go(),n=Ko(),r=as(),o=Number(e.get("page"))||1,i=15,{data:s}=Un({queryKey:["questionnaire-responses",o],queryFn:()=>n.request(`QuestionnaireResponse?_subject=${t.id}&_count=${i}&_page=${o}`)}),a=Math.ceil(s.total/i),l=((m=s.entry)==null?void 0:m.map(v=>v.resource))||[],u=Symbol("dummy"),d=iy({queries:l.filter(({author:v})=>v==null?void 0:v.id).map(({author:v})=>({queryKey:["author",v.id],queryFn:()=>n.request(`Practitioner/${v.id}`).catch(()=>u)})),combine:v=>v.reduce((y,{data:x})=>(x!==u&&(y[x.id]=x),y),{})}),c=iy({queries:l.filter(({questionnaire:v})=>v).map(({questionnaire:v})=>({queryKey:["questionnaire",v],queryFn:()=>tg(n,v).then(y=>({key:v,result:y}),()=>u)})),combine:v=>v.reduce((y,{data:x})=>(x!==u&&(y[x.key]=x.result),y),{})}),f=[{header:"Author",accessorFn:v=>{var y,x,w;return(y=v.author)!=null&&y.id&&((x=d[v.author.id])!=null&&x.name)?us((w=d[v.author.id])==null?void 0:w.name):"Unknown"}},{header:"Questionnaire",accessorFn:v=>{var y,x;return(y=c[v.questionnaire])!=null&&y.title?(x=c[v.questionnaire])==null?void 0:x.title:v.questionnaire}},{header:"Last Updated",accessorFn:v=>new Date(v.meta.lastUpdated).toLocaleString()},{header:"Status",accessorKey:"status"},{id:"actions",cell:({row:{original:v}})=>p.jsxs(Ea,{modal:!0,children:[p.jsx(Pa,{asChild:!0,children:p.jsxs(Tt,{variant:"ghost",className:"h-8 w-8 p-0",children:[p.jsx("span",{className:"sr-only",children:"Open menu"}),p.jsx(og,{className:"h-4 w-4"})]})}),p.jsxs(es,{align:"end",children:[p.jsx(Ig,{children:"Actions"}),p.jsxs(zt,{onClick:()=>navigator.clipboard.writeText(v.id),children:[p.jsx(rg,{}),"Copy ID"]}),p.jsx(Nc,{}),p.jsxs(zt,{onClick:()=>r(`/questionnaire-responses/${v.id}`),children:[p.jsx(P1,{}),"Edit response"]})]})]})}];return p.jsxs("div",{className:"p-6 overflow-auto flex-1",children:[p.jsx(Pb,{columns:f,data:l}),p.jsx(iR,{currentPage:o,totalPages:a})]})},yL=()=>{const{user:e}=Go(),{toast:t}=ps(),n=e.resourceType==="Practitioner";return h.useEffect(()=>{n||t({variant:"destructive",title:"Unauthorized",description:"Only practitioners can access this page."})},[]),n?p.jsx(jx,{}):p.jsx(WT,{to:"/"})},wL=new bA({defaultOptions:{mutations:{throwOnError:!0},queries:{suspense:!0}}}),xL=n2([{path:"/",Component:hI,ErrorBoundary:gL,children:[{index:!0,Component:RM},{path:"/questionnaire-responses",Component:vL},{path:"/questionnaire-responses/:id",Component:mL},{Component:yL,children:[{path:"/questionnaires",Component:qF},{path:"/questionnaires/:id",Component:YF}]}]}]);gx(document.getElementById("root")).render(p.jsx(h.StrictMode,{children:p.jsxs(AA,{client:wL,children:[p.jsx(h.Suspense,{fallback:p.jsx($g,{}),children:p.jsx(d2,{router:xL})}),p.jsx(XF,{})]})}))});export default SL(); diff --git a/aidbox-forms-smart-launch/index.html b/aidbox-forms-smart-launch/index.html index 4ff5dff..56939f1 100644 --- a/aidbox-forms-smart-launch/index.html +++ b/aidbox-forms-smart-launch/index.html @@ -8,7 +8,7 @@ Aidbox Forms Smart App Launch - +