From 1868228d29d301becd5605a567cd4fa9931af15b Mon Sep 17 00:00:00 2001 From: "Snow Lee (Sungwon)" Date: Wed, 19 Aug 2026 11:29:19 -0700 Subject: [PATCH] fix(webapp): history shows it is loading instead of reading as empty (BEA-131) (#179) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The history filters are part of the react-query key, so changing one drops `data` back to undefined. The feed rendered the filter bar and nothing else, which is pixel-identical to the resolved "No changes match these filters." state — a reader concluded twice that a file had no history when it had three entries. Render the shell unconditionally and put the in-repo `.empty` loading row inside it, so a pending request and an empty result look different. Not while `error`: failures already report through onMeta, and a permanent spinner would hide them. Co-authored-by: Claude Opus 5 (1M context) --- .../frontend/e2e/history-filters.spec.ts | 32 ++++++++++++ .../frontend/src/components/HistoryView.tsx | 19 ++++++- .../{index-BTpeDYWL.js => index-DU4-OSS9.js} | 52 +++++++++---------- internal/webapp/static/index.html | 2 +- 4 files changed, 76 insertions(+), 29 deletions(-) rename internal/webapp/static/assets/{index-BTpeDYWL.js => index-DU4-OSS9.js} (86%) diff --git a/internal/webapp/frontend/e2e/history-filters.spec.ts b/internal/webapp/frontend/e2e/history-filters.spec.ts index 2081d02..23e5fb9 100644 --- a/internal/webapp/frontend/e2e/history-filters.spec.ts +++ b/internal/webapp/frontend/e2e/history-filters.spec.ts @@ -142,3 +142,35 @@ test("?path= lands on that file's feed, normalizes the URL, and keeps filters", await expect(page.locator("#crumb")).toHaveText("History — guide.md"); await expect(page).toHaveURL(`/${pid}/history/guide.md?path=notes/readme.md`); }); + +// BEA-131: the filters are in the query key, so changing one drops the feed +// back to no-data. It used to render the bar and nothing else — pixel-identical +// to "nothing matched", and a reader concluded twice that a file had no history +// when it had three entries. Both strings are asserted here, because the whole +// point is that the two states look different. +test("a filter change shows a loading row, never a premature 'no matches'", async ({ page }) => { + await login(page); + const pid = await wikiId(page); + await page.goto(`/${pid}/history`); + await expect(page.locator(rows).first()).toBeVisible(); + + const stall = (url: URL) => url.pathname.endsWith("/history"); + await page.route(stall, async (route) => { + await new Promise((r) => setTimeout(r, 2000)); + await route.continue(); + }); + + await page.fill(".hfilters input[type=search]", "runbook"); + await page.waitForURL(`/${pid}/history?q=runbook`); + + const empty = page.locator(".history .empty"); + await expect(empty).toHaveText("Loading…"); + await expect(page.locator(".history .empty", { hasText: "No changes match these filters." })).toHaveCount(0); + // and the bar is still there, still holding what was typed + await expect(page.locator(".hfilters input[type=search]")).toHaveValue("runbook"); + + // …then the rows land and the loading row goes away. + await expect(page.locator(rows).first()).toBeVisible({ timeout: 10_000 }); + await expect(page.locator(".history .empty")).toHaveCount(0); + await page.unroute(stall); +}); diff --git a/internal/webapp/frontend/src/components/HistoryView.tsx b/internal/webapp/frontend/src/components/HistoryView.tsx index 9251e22..2abcdfc 100644 --- a/internal/webapp/frontend/src/components/HistoryView.tsx +++ b/internal/webapp/frontend/src/components/HistoryView.tsx @@ -63,7 +63,7 @@ export function HistoryView(props: { // into one array — groupRuns and prevBlob both work over the whole window, // so a run straddling a page boundary becomes one card when its second page // lands, and the oldest loaded row shows no diff base rather than a wrong one. - const { data, error, fetchNextPage, hasNextPage, isFetchingNextPage } = useInfiniteQuery({ + const { data, error, isPending, fetchNextPage, hasNextPage, isFetchingNextPage } = useInfiniteQuery({ queryKey: ["history", apiBase, qs], queryFn: ({ pageParam }) => getJSON<{ entries: HistoryEntry[]; next_cursor?: string }>( @@ -100,7 +100,22 @@ export function HistoryView(props: { onChange={props.onFilters} /> ); - if (!data) return bar ?
{bar}
: null; + // Nothing loaded yet. The filters are in the query key, so every keystroke + // in the path box drops `data` back to undefined — returning a bare filter + // bar here made a pending request pixel-identical to "nothing matched", and + // a reader twice concluded a file had no history when it had three entries + // (BEA-131). The shell always renders so the bar stays interactive, and the + // loading row is the same `.empty` one-liner the empty state uses, so the + // section doesn't jump when the response lands. Not while `error`: failures + // already report through onMeta above, and a permanent spinner would hide + // them. + if (!data) + return ( +
+ {bar} + {isPending && !error &&
Loading…
} +
+ ); // Entries arrive newest-first, so a row's predecessor is the next entry // below it on the same path that still has content. This keeps scanning the // flat list, never a group: it is a per-path lookup, and grouping must not diff --git a/internal/webapp/static/assets/index-BTpeDYWL.js b/internal/webapp/static/assets/index-DU4-OSS9.js similarity index 86% rename from internal/webapp/static/assets/index-BTpeDYWL.js rename to internal/webapp/static/assets/index-DU4-OSS9.js index a957b2d..669bf77 100644 --- a/internal/webapp/static/assets/index-BTpeDYWL.js +++ b/internal/webapp/static/assets/index-DU4-OSS9.js @@ -1,12 +1,12 @@ -import{g as xw}from"./_commonjsHelpers-CqkleIqs.js";import{h as S2,r as _2}from"./mermaid-DQuCJ8Gi.js";function C2(e,t){for(var r=0;ri[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"]'))i(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(o){if(o.ep)return;o.ep=!0;const l=r(o);fetch(o.href,l)}})();var jh={exports:{}},Uo={};var ub;function E2(){if(ub)return Uo;ub=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(i,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var d in o)d!=="key"&&(l[d]=o[d])}else l=o;return o=l.ref,{$$typeof:e,type:i,key:u,ref:o!==void 0?o:null,props:l}}return Uo.Fragment=t,Uo.jsx=r,Uo.jsxs=r,Uo}var db;function R2(){return db||(db=1,jh.exports=E2()),jh.exports}var f=R2(),Th={exports:{}},Ve={};var fb;function j2(){if(fb)return Ve;fb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=b&&D[b]||D["@@iterator"],typeof D=="function"?D:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,E={};function R(D,M,U){this.props=D,this.context=M,this.refs=E,this.updater=U||w}R.prototype.isReactComponent={},R.prototype.setState=function(D,M){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,M,"setState")},R.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function T(){}T.prototype=R.prototype;function O(D,M,U){this.props=D,this.context=M,this.refs=E,this.updater=U||w}var N=O.prototype=new T;N.constructor=O,_(N,R.prototype),N.isPureReactComponent=!0;var k=Array.isArray;function B(){}var H={H:null,A:null,T:null,S:null},$=Object.prototype.hasOwnProperty;function he(D,M,U){var Q=U.ref;return{$$typeof:e,type:D,key:M,ref:Q!==void 0?Q:null,props:U}}function be(D,M){return he(D.type,M,D.props)}function pe(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function fe(D){var M={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(U){return M[U]})}var ue=/\/+/g;function ee(D,M){return typeof D=="object"&&D!==null&&D.key!=null?fe(""+D.key):M.toString(36)}function ve(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(B,B):(D.status="pending",D.then(function(M){D.status==="pending"&&(D.status="fulfilled",D.value=M)},function(M){D.status==="pending"&&(D.status="rejected",D.reason=M)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function L(D,M,U,Q,K){var de=typeof D;(de==="undefined"||de==="boolean")&&(D=null);var re=!1;if(D===null)re=!0;else switch(de){case"bigint":case"string":case"number":re=!0;break;case"object":switch(D.$$typeof){case e:case t:re=!0;break;case y:return re=D._init,L(re(D._payload),M,U,Q,K)}}if(re)return K=K(D),re=Q===""?"."+ee(D,0):Q,k(K)?(U="",re!=null&&(U=re.replace(ue,"$&/")+"/"),L(K,M,U,"",function(Me){return Me})):K!=null&&(pe(K)&&(K=be(K,U+(K.key==null||D&&D.key===K.key?"":(""+K.key).replace(ue,"$&/")+"/")+re)),M.push(K)),1;re=0;var xe=Q===""?".":Q+":";if(k(D))for(var we=0;we>>1,te=L[X];if(0>>1;Xo(U,ne))Qo(K,U)?(L[X]=K,L[Q]=ne,X=Q):(L[X]=U,L[M]=ne,X=M);else if(Qo(K,ne))L[X]=K,L[Q]=ne,X=Q;else break e}}return Z}function o(L,Z){var ne=L.sortIndex-Z.sortIndex;return ne!==0?ne:L.id-Z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var m=[],p=[],y=1,v=null,b=3,x=!1,w=!1,_=!1,E=!1,R=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function N(L){for(var Z=r(p);Z!==null;){if(Z.callback===null)i(p);else if(Z.startTime<=L)i(p),Z.sortIndex=Z.expirationTime,t(m,Z);else break;Z=r(p)}}function k(L){if(_=!1,N(L),!w)if(r(m)!==null)w=!0,B||(B=!0,fe());else{var Z=r(p);Z!==null&&ve(k,Z.startTime-L)}}var B=!1,H=-1,$=5,he=-1;function be(){return E?!0:!(e.unstable_now()-he<$)}function pe(){if(E=!1,B){var L=e.unstable_now();he=L;var Z=!0;try{e:{w=!1,_&&(_=!1,T(H),H=-1),x=!0;var ne=b;try{t:{for(N(L),v=r(m);v!==null&&!(v.expirationTime>L&&be());){var X=v.callback;if(typeof X=="function"){v.callback=null,b=v.priorityLevel;var te=X(v.expirationTime<=L);if(L=e.unstable_now(),typeof te=="function"){v.callback=te,N(L),Z=!0;break t}v===r(m)&&i(m),N(L)}else i(m);v=r(m)}if(v!==null)Z=!0;else{var D=r(p);D!==null&&ve(k,D.startTime-L),Z=!1}}break e}finally{v=null,b=ne,x=!1}Z=void 0}}finally{Z?fe():B=!1}}}var fe;if(typeof O=="function")fe=function(){O(pe)};else if(typeof MessageChannel<"u"){var ue=new MessageChannel,ee=ue.port2;ue.port1.onmessage=pe,fe=function(){ee.postMessage(null)}}else fe=function(){R(pe,0)};function ve(L,Z){H=R(function(){L(e.unstable_now())},Z)}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_forceFrameRate=function(L){0>L||125X?(L.sortIndex=ne,t(p,L),r(m)===null&&L===r(p)&&(_?(T(H),H=-1):_=!0,ve(k,ne-X))):(L.sortIndex=te,t(m,L),w||x||(w=!0,B||(B=!0,fe()))),L},e.unstable_shouldYield=be,e.unstable_wrapCallback=function(L){var Z=b;return function(){var ne=b;b=Z;try{return L.apply(this,arguments)}finally{b=ne}}}})(Mh)),Mh}var pb;function O2(){return pb||(pb=1,Ah.exports=T2()),Ah.exports}var Nh={exports:{}},un={};var gb;function A2(){if(gb)return un;gb=1;var e=ap();function t(m){var p="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Nh.exports=A2(),Nh.exports}var yb;function M2(){if(yb)return Ho;yb=1;var e=O2(),t=ap(),r=ww();function i(n){var a="https://react.dev/errors/"+n;if(1te||(n.current=X[te],X[te]=null,te--)}function U(n,a){te++,X[te]=n.current,n.current=a}var Q=D(null),K=D(null),de=D(null),re=D(null);function xe(n,a){switch(U(de,a),U(K,n),U(Q,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?D0(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=D0(a),n=k0(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}M(Q),U(Q,n)}function we(){M(Q),M(K),M(de)}function Me(n){n.memoizedState!==null&&U(re,n);var a=Q.current,s=k0(a,n.type);a!==s&&(U(K,n),U(Q,s))}function Fe(n){K.current===n&&(M(Q),M(K)),re.current===n&&(M(re),Io._currentValue=ne)}var He,ct;function Je(n){if(He===void 0)try{throw Error()}catch(s){var a=s.stack.trim().match(/\n( *(at )?)/);He=a&&a[1]||"",ct=-1i[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"]'))i(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(o){if(o.ep)return;o.ep=!0;const l=r(o);fetch(o.href,l)}})();var jh={exports:{}},Uo={};var ub;function E2(){if(ub)return Uo;ub=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(i,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var d in o)d!=="key"&&(l[d]=o[d])}else l=o;return o=l.ref,{$$typeof:e,type:i,key:u,ref:o!==void 0?o:null,props:l}}return Uo.Fragment=t,Uo.jsx=r,Uo.jsxs=r,Uo}var db;function R2(){return db||(db=1,jh.exports=E2()),jh.exports}var f=R2(),Th={exports:{}},Ve={};var fb;function j2(){if(fb)return Ve;fb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.for("react.activity"),b=Symbol.iterator;function x(D){return D===null||typeof D!="object"?null:(D=b&&D[b]||D["@@iterator"],typeof D=="function"?D:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,E={};function R(D,M,U){this.props=D,this.context=M,this.refs=E,this.updater=U||w}R.prototype.isReactComponent={},R.prototype.setState=function(D,M){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,M,"setState")},R.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function T(){}T.prototype=R.prototype;function O(D,M,U){this.props=D,this.context=M,this.refs=E,this.updater=U||w}var N=O.prototype=new T;N.constructor=O,_(N,R.prototype),N.isPureReactComponent=!0;var z=Array.isArray;function B(){}var H={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function ne(D,M,U){var Q=U.ref;return{$$typeof:e,type:D,key:M,ref:Q!==void 0?Q:null,props:U}}function ge(D,M){return ne(D.type,M,D.props)}function pe(D){return typeof D=="object"&&D!==null&&D.$$typeof===e}function he(D){var M={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function(U){return M[U]})}var de=/\/+/g;function ee(D,M){return typeof D=="object"&&D!==null&&D.key!=null?he(""+D.key):M.toString(36)}function ye(D){switch(D.status){case"fulfilled":return D.value;case"rejected":throw D.reason;default:switch(typeof D.status=="string"?D.then(B,B):(D.status="pending",D.then(function(M){D.status==="pending"&&(D.status="fulfilled",D.value=M)},function(M){D.status==="pending"&&(D.status="rejected",D.reason=M)})),D.status){case"fulfilled":return D.value;case"rejected":throw D.reason}}throw D}function L(D,M,U,Q,K){var fe=typeof D;(fe==="undefined"||fe==="boolean")&&(D=null);var ae=!1;if(D===null)ae=!0;else switch(fe){case"bigint":case"string":case"number":ae=!0;break;case"object":switch(D.$$typeof){case e:case t:ae=!0;break;case y:return ae=D._init,L(ae(D._payload),M,U,Q,K)}}if(ae)return K=K(D),ae=Q===""?"."+ee(D,0):Q,z(K)?(U="",ae!=null&&(U=ae.replace(de,"$&/")+"/"),L(K,M,U,"",function(Me){return Me})):K!=null&&(pe(K)&&(K=ge(K,U+(K.key==null||D&&D.key===K.key?"":(""+K.key).replace(de,"$&/")+"/")+ae)),M.push(K)),1;ae=0;var xe=Q===""?".":Q+":";if(z(D))for(var we=0;we>>1,te=L[X];if(0>>1;Xo(U,re))Qo(K,U)?(L[X]=K,L[Q]=re,X=Q):(L[X]=U,L[M]=re,X=M);else if(Qo(K,re))L[X]=K,L[Q]=re,X=Q;else break e}}return Z}function o(L,Z){var re=L.sortIndex-Z.sortIndex;return re!==0?re:L.id-Z.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,d=u.now();e.unstable_now=function(){return u.now()-d}}var m=[],p=[],y=1,v=null,b=3,x=!1,w=!1,_=!1,E=!1,R=typeof setTimeout=="function"?setTimeout:null,T=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function N(L){for(var Z=r(p);Z!==null;){if(Z.callback===null)i(p);else if(Z.startTime<=L)i(p),Z.sortIndex=Z.expirationTime,t(m,Z);else break;Z=r(p)}}function z(L){if(_=!1,N(L),!w)if(r(m)!==null)w=!0,B||(B=!0,he());else{var Z=r(p);Z!==null&&ye(z,Z.startTime-L)}}var B=!1,H=-1,I=5,ne=-1;function ge(){return E?!0:!(e.unstable_now()-neL&&ge());){var X=v.callback;if(typeof X=="function"){v.callback=null,b=v.priorityLevel;var te=X(v.expirationTime<=L);if(L=e.unstable_now(),typeof te=="function"){v.callback=te,N(L),Z=!0;break t}v===r(m)&&i(m),N(L)}else i(m);v=r(m)}if(v!==null)Z=!0;else{var D=r(p);D!==null&&ye(z,D.startTime-L),Z=!1}}break e}finally{v=null,b=re,x=!1}Z=void 0}}finally{Z?he():B=!1}}}var he;if(typeof O=="function")he=function(){O(pe)};else if(typeof MessageChannel<"u"){var de=new MessageChannel,ee=de.port2;de.port1.onmessage=pe,he=function(){ee.postMessage(null)}}else he=function(){R(pe,0)};function ye(L,Z){H=R(function(){L(e.unstable_now())},Z)}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_forceFrameRate=function(L){0>L||125X?(L.sortIndex=re,t(p,L),r(m)===null&&L===r(p)&&(_?(T(H),H=-1):_=!0,ye(z,re-X))):(L.sortIndex=te,t(m,L),w||x||(w=!0,B||(B=!0,he()))),L},e.unstable_shouldYield=ge,e.unstable_wrapCallback=function(L){var Z=b;return function(){var re=b;b=Z;try{return L.apply(this,arguments)}finally{b=re}}}})(Mh)),Mh}var pb;function O2(){return pb||(pb=1,Ah.exports=T2()),Ah.exports}var Nh={exports:{}},un={};var gb;function A2(){if(gb)return un;gb=1;var e=ap();function t(m){var p="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Nh.exports=A2(),Nh.exports}var yb;function M2(){if(yb)return Ho;yb=1;var e=O2(),t=ap(),r=ww();function i(n){var a="https://react.dev/errors/"+n;if(1te||(n.current=X[te],X[te]=null,te--)}function U(n,a){te++,X[te]=n.current,n.current=a}var Q=D(null),K=D(null),fe=D(null),ae=D(null);function xe(n,a){switch(U(fe,a),U(K,n),U(Q,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?D0(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=D0(a),n=k0(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}M(Q),U(Q,n)}function we(){M(Q),M(K),M(fe)}function Me(n){n.memoizedState!==null&&U(ae,n);var a=Q.current,s=k0(a,n.type);a!==s&&(U(K,n),U(Q,s))}function Fe(n){K.current===n&&(M(Q),M(K)),ae.current===n&&(M(ae),Io._currentValue=re)}var He,ct;function Je(n){if(He===void 0)try{throw Error()}catch(s){var a=s.stack.trim().match(/\n( *(at )?)/);He=a&&a[1]||"",ct=-1)":-1h||z[c]!==G[h]){var ae=` -`+z[c].replace(" at new "," at ");return n.displayName&&ae.includes("")&&(ae=ae.replace("",n.displayName)),ae}while(1<=c&&0<=h);break}}}finally{hn=!1,Error.prepareStackTrace=s}return(s=n?n.displayName||n.name:"")?Je(s):""}function Xt(n,a){switch(n.tag){case 26:case 27:case 5:return Je(n.type);case 16:return Je("Lazy");case 13:return n.child!==a&&a!==null?Je("Suspense Fallback"):Je("Suspense");case 19:return Je("SuspenseList");case 0:case 15:return mn(n.type,!1);case 11:return mn(n.type.render,!1);case 1:return mn(n.type,!0);case 31:return Je("Activity");default:return""}}function yr(n){try{var a="",s=null;do a+=Xt(n,s),s=n,n=n.return;while(n);return a}catch(c){return` +`);for(h=c=0;ch||k[c]!==G[h]){var ie=` +`+k[c].replace(" at new "," at ");return n.displayName&&ie.includes("")&&(ie=ie.replace("",n.displayName)),ie}while(1<=c&&0<=h);break}}}finally{hn=!1,Error.prepareStackTrace=s}return(s=n?n.displayName||n.name:"")?Je(s):""}function Xt(n,a){switch(n.tag){case 26:case 27:case 5:return Je(n.type);case 16:return Je("Lazy");case 13:return n.child!==a&&a!==null?Je("Suspense Fallback"):Je("Suspense");case 19:return Je("SuspenseList");case 0:case 15:return mn(n.type,!1);case 11:return mn(n.type.render,!1);case 1:return mn(n.type,!0);case 31:return Je("Activity");default:return""}}function yr(n){try{var a="",s=null;do a+=Xt(n,s),s=n,n=n.return;while(n);return a}catch(c){return` Error generating stack: `+c.message+` -`+c.stack}}var At=Object.prototype.hasOwnProperty,rr=e.unstable_scheduleCallback,br=e.unstable_cancelCallback,Rt=e.unstable_shouldYield,Vn=e.unstable_requestPaint,zt=e.unstable_now,Dr=e.unstable_getCurrentPriorityLevel,ar=e.unstable_ImmediatePriority,oa=e.unstable_UserBlockingPriority,ir=e.unstable_NormalPriority,la=e.unstable_LowPriority,Jt=e.unstable_IdlePriority,A=e.log,P=e.unstable_setDisableYieldValue,F=null,ce=null;function se(n){if(typeof A=="function"&&P(n),ce&&typeof ce.setStrictMode=="function")try{ce.setStrictMode(F,n)}catch{}}var ye=Math.clz32?Math.clz32:oe,Se=Math.log,W=Math.LN2;function oe(n){return n>>>=0,n===0?32:31-(Se(n)/W|0)|0}var Re=256,ze=262144,it=4194304;function _t(n){var a=n&42;if(a!==0)return a;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Ae(n,a,s){var c=n.pendingLanes;if(c===0)return 0;var h=0,g=n.suspendedLanes,C=n.pingedLanes;n=n.warmLanes;var j=c&134217727;return j!==0?(c=j&~g,c!==0?h=_t(c):(C&=j,C!==0?h=_t(C):s||(s=j&~n,s!==0&&(h=_t(s))))):(j=c&~g,j!==0?h=_t(j):C!==0?h=_t(C):s||(s=c&~n,s!==0&&(h=_t(s)))),h===0?0:a!==0&&a!==h&&(a&g)===0&&(g=h&-h,s=a&-a,g>=s||g===32&&(s&4194048)!==0)?a:h}function ut(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function st(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Gt(){var n=it;return it<<=1,(it&62914560)===0&&(it=4194304),n}function sr(n){for(var a=[],s=0;31>s;s++)a.push(n);return a}function Ct(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function yn(n,a,s,c,h,g){var C=n.pendingLanes;n.pendingLanes=s,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=s,n.entangledLanes&=s,n.errorRecoveryDisabledLanes&=s,n.shellSuspendCounter=0;var j=n.entanglements,z=n.expirationTimes,G=n.hiddenUpdates;for(s=C&~s;0"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var gE=/[\n"\\]/g;function Hn(n){return n.replace(gE,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function xd(n,a,s,c,h,g,C,j){n.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?n.type=C:n.removeAttribute("type"),a!=null?C==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Un(a)):n.value!==""+Un(a)&&(n.value=""+Un(a)):C!=="submit"&&C!=="reset"||n.removeAttribute("value"),a!=null?wd(n,C,Un(a)):s!=null?wd(n,C,Un(s)):c!=null&&n.removeAttribute("value"),h==null&&g!=null&&(n.defaultChecked=!!g),h!=null&&(n.checked=h&&typeof h!="function"&&typeof h!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?n.name=""+Un(j):n.removeAttribute("name")}function jg(n,a,s,c,h,g,C,j){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(n.type=g),a!=null||s!=null){if(!(g!=="submit"&&g!=="reset"||a!=null)){bd(n);return}s=s!=null?""+Un(s):"",a=a!=null?""+Un(a):s,j||a===n.value||(n.value=a),n.defaultValue=a}c=c??h,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=j?n.checked:!!c,n.defaultChecked=!!c,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(n.name=C),bd(n)}function wd(n,a,s){a==="number"&&Ml(n.ownerDocument)===n||n.defaultValue===""+s||(n.defaultValue=""+s)}function Gi(n,a,s,c){if(n=n.options,a){a={};for(var h=0;h"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rd=!1;if(Lr)try{var to={};Object.defineProperty(to,"passive",{get:function(){Rd=!0}}),window.addEventListener("test",to,to),window.removeEventListener("test",to,to)}catch{Rd=!1}var ua=null,jd=null,Dl=null;function kg(){if(Dl)return Dl;var n,a=jd,s=a.length,c,h="value"in ua?ua.value:ua.textContent,g=h.length;for(n=0;n=ao),Fg=" ",Vg=!1;function Ug(n,a){switch(n){case"keyup":return BE.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hg(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Qi=!1;function GE(n,a){switch(n){case"compositionend":return Hg(a);case"keypress":return a.which!==32?null:(Vg=!0,Fg);case"textInput":return n=a.data,n===Fg&&Vg?null:n;default:return null}}function ZE(n,a){if(Qi)return n==="compositionend"||!Nd&&Ug(n,a)?(n=kg(),Dl=jd=ua=null,Qi=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1=a)return{node:s,offset:a-n};n=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Xg(s)}}function Wg(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Wg(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function ev(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=Ml(n.document);a instanceof n.HTMLIFrameElement;){try{var s=typeof a.contentWindow.location.href=="string"}catch{s=!1}if(s)n=a.contentWindow;else break;a=Ml(n.document)}return a}function zd(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var tR=Lr&&"documentMode"in document&&11>=document.documentMode,Xi=null,Ld=null,lo=null,$d=!1;function tv(n,a,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;$d||Xi==null||Xi!==Ml(c)||(c=Xi,"selectionStart"in c&&zd(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),lo&&oo(lo,c)||(lo=c,c=Rc(Ld,"onSelect"),0>=C,h-=C,xr=1<<32-ye(a)+h|s<Be?(Qe=Oe,Oe=null):Qe=Oe.sibling;var tt=Y(V,Oe,q[Be],ie);if(tt===null){Oe===null&&(Oe=Qe);break}n&&Oe&&tt.alternate===null&&a(V,Oe),I=g(tt,I,Be),et===null?Ne=tt:et.sibling=tt,et=tt,Oe=Qe}if(Be===q.length)return s(V,Oe),Xe&&Ir(V,Be),Ne;if(Oe===null){for(;BeBe?(Qe=Oe,Oe=null):Qe=Oe.sibling;var Na=Y(V,Oe,tt.value,ie);if(Na===null){Oe===null&&(Oe=Qe);break}n&&Oe&&Na.alternate===null&&a(V,Oe),I=g(Na,I,Be),et===null?Ne=Na:et.sibling=Na,et=Na,Oe=Qe}if(tt.done)return s(V,Oe),Xe&&Ir(V,Be),Ne;if(Oe===null){for(;!tt.done;Be++,tt=q.next())tt=le(V,tt.value,ie),tt!==null&&(I=g(tt,I,Be),et===null?Ne=tt:et.sibling=tt,et=tt);return Xe&&Ir(V,Be),Ne}for(Oe=c(Oe);!tt.done;Be++,tt=q.next())tt=J(Oe,V,Be,tt.value,ie),tt!==null&&(n&&tt.alternate!==null&&Oe.delete(tt.key===null?Be:tt.key),I=g(tt,I,Be),et===null?Ne=tt:et.sibling=tt,et=tt);return n&&Oe.forEach(function(w2){return a(V,w2)}),Xe&&Ir(V,Be),Ne}function ht(V,I,q,ie){if(typeof q=="object"&&q!==null&&q.type===_&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case x:e:{for(var Ne=q.key;I!==null;){if(I.key===Ne){if(Ne=q.type,Ne===_){if(I.tag===7){s(V,I.sibling),ie=h(I,q.props.children),ie.return=V,V=ie;break e}}else if(I.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===$&&fi(Ne)===I.type){s(V,I.sibling),ie=h(I,q.props),po(ie,q),ie.return=V,V=ie;break e}s(V,I);break}else a(V,I);I=I.sibling}q.type===_?(ie=oi(q.props.children,V.mode,ie,q.key),ie.return=V,V=ie):(ie=Hl(q.type,q.key,q.props,null,V.mode,ie),po(ie,q),ie.return=V,V=ie)}return C(V);case w:e:{for(Ne=q.key;I!==null;){if(I.key===Ne)if(I.tag===4&&I.stateNode.containerInfo===q.containerInfo&&I.stateNode.implementation===q.implementation){s(V,I.sibling),ie=h(I,q.children||[]),ie.return=V,V=ie;break e}else{s(V,I);break}else a(V,I);I=I.sibling}ie=Bd(q,V.mode,ie),ie.return=V,V=ie}return C(V);case $:return q=fi(q),ht(V,I,q,ie)}if(ve(q))return je(V,I,q,ie);if(fe(q)){if(Ne=fe(q),typeof Ne!="function")throw Error(i(150));return q=Ne.call(q),ke(V,I,q,ie)}if(typeof q.then=="function")return ht(V,I,Ql(q),ie);if(q.$$typeof===O)return ht(V,I,Gl(V,q),ie);Xl(V,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,I!==null&&I.tag===6?(s(V,I.sibling),ie=h(I,q),ie.return=V,V=ie):(s(V,I),ie=Hd(q,V.mode,ie),ie.return=V,V=ie),C(V)):s(V,I)}return function(V,I,q,ie){try{mo=0;var Ne=ht(V,I,q,ie);return ls=null,Ne}catch(Oe){if(Oe===os||Oe===Kl)throw Oe;var et=Nn(29,Oe,null,V.mode);return et.lanes=ie,et.return=V,et}}}var mi=Cv(!0),Ev=Cv(!1),pa=!1;function nf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function rf(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function ga(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function va(n,a,s){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(nt&2)!==0){var h=c.pending;return h===null?a.next=a:(a.next=h.next,h.next=a),c.pending=a,a=Ul(n),lv(n,null,s),a}return Vl(n,c,a,s),Ul(n)}function go(n,a,s){if(a=a.updateQueue,a!==null&&(a=a.shared,(s&4194048)!==0)){var c=a.lanes;c&=n.pendingLanes,s|=c,a.lanes=s,bn(n,s)}}function af(n,a){var s=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var h=null,g=null;if(s=s.firstBaseUpdate,s!==null){do{var C={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};g===null?h=g=C:g=g.next=C,s=s.next}while(s!==null);g===null?h=g=a:g=g.next=a}else h=g=a;s={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:g,shared:c.shared,callbacks:c.callbacks},n.updateQueue=s;return}n=s.lastBaseUpdate,n===null?s.firstBaseUpdate=a:n.next=a,s.lastBaseUpdate=a}var sf=!1;function vo(){if(sf){var n=ss;if(n!==null)throw n}}function yo(n,a,s,c){sf=!1;var h=n.updateQueue;pa=!1;var g=h.firstBaseUpdate,C=h.lastBaseUpdate,j=h.shared.pending;if(j!==null){h.shared.pending=null;var z=j,G=z.next;z.next=null,C===null?g=G:C.next=G,C=z;var ae=n.alternate;ae!==null&&(ae=ae.updateQueue,j=ae.lastBaseUpdate,j!==C&&(j===null?ae.firstBaseUpdate=G:j.next=G,ae.lastBaseUpdate=z))}if(g!==null){var le=h.baseState;C=0,ae=G=z=null,j=g;do{var Y=j.lane&-536870913,J=Y!==j.lane;if(J?(Ye&Y)===Y:(c&Y)===Y){Y!==0&&Y===is&&(sf=!0),ae!==null&&(ae=ae.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var je=n,ke=j;Y=a;var ht=s;switch(ke.tag){case 1:if(je=ke.payload,typeof je=="function"){le=je.call(ht,le,Y);break e}le=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=ke.payload,Y=typeof je=="function"?je.call(ht,le,Y):je,Y==null)break e;le=v({},le,Y);break e;case 2:pa=!0}}Y=j.callback,Y!==null&&(n.flags|=64,J&&(n.flags|=8192),J=h.callbacks,J===null?h.callbacks=[Y]:J.push(Y))}else J={lane:Y,tag:j.tag,payload:j.payload,callback:j.callback,next:null},ae===null?(G=ae=J,z=le):ae=ae.next=J,C|=Y;if(j=j.next,j===null){if(j=h.shared.pending,j===null)break;J=j,j=J.next,J.next=null,h.lastBaseUpdate=J,h.shared.pending=null}}while(!0);ae===null&&(z=le),h.baseState=z,h.firstBaseUpdate=G,h.lastBaseUpdate=ae,g===null&&(h.shared.lanes=0),Sa|=C,n.lanes=C,n.memoizedState=le}}function Rv(n,a){if(typeof n!="function")throw Error(i(191,n));n.call(a)}function jv(n,a){var s=n.callbacks;if(s!==null)for(n.callbacks=null,n=0;ng?g:8;var C=L.T,j={};L.T=j,Ef(n,!1,a,s);try{var z=h(),G=L.S;if(G!==null&&G(j,z),z!==null&&typeof z=="object"&&typeof z.then=="function"){var ae=uR(z,c);wo(n,a,ae,$n(n))}else wo(n,a,c,$n(n))}catch(le){wo(n,a,{then:function(){},status:"rejected",reason:le},$n())}finally{Z.p=g,C!==null&&j.types!==null&&(C.types=j.types),L.T=C}}function gR(){}function _f(n,a,s,c){if(n.tag!==5)throw Error(i(476));var h=iy(n).queue;ay(n,h,a,ne,s===null?gR:function(){return sy(n),s(c)})}function iy(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:ne,baseState:ne,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ur,lastRenderedState:ne},next:null};var s={};return a.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ur,lastRenderedState:s},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function sy(n){var a=iy(n);a.next===null&&(a=n.alternate.memoizedState),wo(n,a.next.queue,{},$n())}function Cf(){return tn(Io)}function oy(){return Nt().memoizedState}function ly(){return Nt().memoizedState}function vR(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var s=$n();n=ga(s);var c=va(a,n,s);c!==null&&(jn(c,a,s),go(c,a,s)),a={cache:Jd()},n.payload=a;return}a=a.return}}function yR(n,a,s){var c=$n();s={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},oc(n)?uy(a,s):(s=Vd(n,a,s,c),s!==null&&(jn(s,n,c),dy(s,a,c)))}function cy(n,a,s){var c=$n();wo(n,a,s,c)}function wo(n,a,s,c){var h={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(oc(n))uy(a,h);else{var g=n.alternate;if(n.lanes===0&&(g===null||g.lanes===0)&&(g=a.lastRenderedReducer,g!==null))try{var C=a.lastRenderedState,j=g(C,s);if(h.hasEagerState=!0,h.eagerState=j,Mn(j,C))return Vl(n,a,h,0),gt===null&&Fl(),!1}catch{}if(s=Vd(n,a,h,c),s!==null)return jn(s,n,c),dy(s,a,c),!0}return!1}function Ef(n,a,s,c){if(c={lane:2,revertLane:rh(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},oc(n)){if(a)throw Error(i(479))}else a=Vd(n,s,c,2),a!==null&&jn(a,n,2)}function oc(n){var a=n.alternate;return n===Ue||a!==null&&a===Ue}function uy(n,a){us=ec=!0;var s=n.pending;s===null?a.next=a:(a.next=s.next,s.next=a),n.pending=a}function dy(n,a,s){if((s&4194048)!==0){var c=a.lanes;c&=n.pendingLanes,s|=c,a.lanes=s,bn(n,s)}}var So={readContext:tn,use:rc,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};So.useEffectEvent=jt;var fy={readContext:tn,use:rc,useCallback:function(n,a){return pn().memoizedState=[n,a===void 0?null:a],n},useContext:tn,useEffect:Yv,useImperativeHandle:function(n,a,s){s=s!=null?s.concat([n]):null,ic(4194308,4,Wv.bind(null,a,n),s)},useLayoutEffect:function(n,a){return ic(4194308,4,n,a)},useInsertionEffect:function(n,a){ic(4,2,n,a)},useMemo:function(n,a){var s=pn();a=a===void 0?null:a;var c=n();if(pi){se(!0);try{n()}finally{se(!1)}}return s.memoizedState=[c,a],c},useReducer:function(n,a,s){var c=pn();if(s!==void 0){var h=s(a);if(pi){se(!0);try{s(a)}finally{se(!1)}}}else h=a;return c.memoizedState=c.baseState=h,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:h},c.queue=n,n=n.dispatch=yR.bind(null,Ue,n),[c.memoizedState,n]},useRef:function(n){var a=pn();return n={current:n},a.memoizedState=n},useState:function(n){n=yf(n);var a=n.queue,s=cy.bind(null,Ue,a);return a.dispatch=s,[n.memoizedState,s]},useDebugValue:wf,useDeferredValue:function(n,a){var s=pn();return Sf(s,n,a)},useTransition:function(){var n=yf(!1);return n=ay.bind(null,Ue,n.queue,!0,!1),pn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,s){var c=Ue,h=pn();if(Xe){if(s===void 0)throw Error(i(407));s=s()}else{if(s=a(),gt===null)throw Error(i(349));(Ye&127)!==0||Dv(c,a,s)}h.memoizedState=s;var g={value:s,getSnapshot:a};return h.queue=g,Yv(zv.bind(null,c,g,n),[n]),c.flags|=2048,fs(9,{destroy:void 0},kv.bind(null,c,g,s,a),null),s},useId:function(){var n=pn(),a=gt.identifierPrefix;if(Xe){var s=wr,c=xr;s=(c&~(1<<32-ye(c)-1)).toString(32)+s,a="_"+a+"R_"+s,s=tc++,0<\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof c.is=="string"?C.createElement("select",{is:c.is}):C.createElement("select"),c.multiple?g.multiple=!0:c.size&&(g.size=c.size);break;default:g=typeof c.is=="string"?C.createElement(h,{is:c.is}):C.createElement(h)}}g[Wt]=a,g[wn]=c;e:for(C=a.child;C!==null;){if(C.tag===5||C.tag===6)g.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===a)break e;for(;C.sibling===null;){if(C.return===null||C.return===a)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}a.stateNode=g;e:switch(rn(g,h,c),h){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Br(a)}}return yt(a),Pf(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,s),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==c&&Br(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(i(166));if(n=de.current,rs(a)){if(n=a.stateNode,s=a.memoizedProps,c=null,h=en,h!==null)switch(h.tag){case 27:case 5:c=h.memoizedProps}n[Wt]=a,n=!!(n.nodeValue===s||c!==null&&c.suppressHydrationWarning===!0||M0(n.nodeValue,s)),n||ha(a,!0)}else n=jc(n).createTextNode(c),n[Wt]=a,a.stateNode=n}return yt(a),null;case 31:if(s=a.memoizedState,n===null||n.memoizedState!==null){if(c=rs(a),s!==null){if(n===null){if(!c)throw Error(i(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(557));n[Wt]=a}else li(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;yt(a),n=!1}else s=Kd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=s),n=!0;if(!n)return a.flags&256?(kn(a),a):(kn(a),null);if((a.flags&128)!==0)throw Error(i(558))}return yt(a),null;case 13:if(c=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=rs(a),c!==null&&c.dehydrated!==null){if(n===null){if(!h)throw Error(i(318));if(h=a.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[Wt]=a}else li(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;yt(a),h=!1}else h=Kd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return a.flags&256?(kn(a),a):(kn(a),null)}return kn(a),(a.flags&128)!==0?(a.lanes=s,a):(s=c!==null,n=n!==null&&n.memoizedState!==null,s&&(c=a.child,h=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(h=c.alternate.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==h&&(c.flags|=2048)),s!==n&&s&&(a.child.flags|=8192),fc(a,a.updateQueue),yt(a),null);case 4:return we(),n===null&&oh(a.stateNode.containerInfo),yt(a),null;case 10:return Fr(a.type),yt(a),null;case 19:if(M(Mt),c=a.memoizedState,c===null)return yt(a),null;if(h=(a.flags&128)!==0,g=c.rendering,g===null)if(h)Co(c,!1);else{if(Tt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(g=Wl(n),g!==null){for(a.flags|=128,Co(c,!1),n=g.updateQueue,a.updateQueue=n,fc(a,n),a.subtreeFlags=0,n=s,s=a.child;s!==null;)cv(s,n),s=s.sibling;return U(Mt,Mt.current&1|2),Xe&&Ir(a,c.treeForkCount),a.child}n=n.sibling}c.tail!==null&&zt()>vc&&(a.flags|=128,h=!0,Co(c,!1),a.lanes=4194304)}else{if(!h)if(n=Wl(g),n!==null){if(a.flags|=128,h=!0,n=n.updateQueue,a.updateQueue=n,fc(a,n),Co(c,!0),c.tail===null&&c.tailMode==="hidden"&&!g.alternate&&!Xe)return yt(a),null}else 2*zt()-c.renderingStartTime>vc&&s!==536870912&&(a.flags|=128,h=!0,Co(c,!1),a.lanes=4194304);c.isBackwards?(g.sibling=a.child,a.child=g):(n=c.last,n!==null?n.sibling=g:a.child=g,c.last=g)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=zt(),n.sibling=null,s=Mt.current,U(Mt,h?s&1|2:s&1),Xe&&Ir(a,c.treeForkCount),n):(yt(a),null);case 22:case 23:return kn(a),lf(),c=a.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(s&536870912)!==0&&(a.flags&128)===0&&(yt(a),a.subtreeFlags&6&&(a.flags|=8192)):yt(a),s=a.updateQueue,s!==null&&fc(a,s.retryQueue),s=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==s&&(a.flags|=2048),n!==null&&M(di),null;case 24:return s=null,n!==null&&(s=n.memoizedState.cache),a.memoizedState.cache!==s&&(a.flags|=2048),Fr(Lt),yt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function _R(n,a){switch(Gd(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Fr(Lt),we(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return Fe(a),null;case 31:if(a.memoizedState!==null){if(kn(a),a.alternate===null)throw Error(i(340));li()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(kn(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(i(340));li()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return M(Mt),null;case 4:return we(),null;case 10:return Fr(a.type),null;case 22:case 23:return kn(a),lf(),n!==null&&M(di),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Fr(Lt),null;case 25:return null;default:return null}}function Ly(n,a){switch(Gd(a),a.tag){case 3:Fr(Lt),we();break;case 26:case 27:case 5:Fe(a);break;case 4:we();break;case 31:a.memoizedState!==null&&kn(a);break;case 13:kn(a);break;case 19:M(Mt);break;case 10:Fr(a.type);break;case 22:case 23:kn(a),lf(),n!==null&&M(di);break;case 24:Fr(Lt)}}function Eo(n,a){try{var s=a.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var h=c.next;s=h;do{if((s.tag&n)===n){c=void 0;var g=s.create,C=s.inst;c=g(),C.destroy=c}s=s.next}while(s!==h)}}catch(j){lt(a,a.return,j)}}function xa(n,a,s){try{var c=a.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var g=h.next;c=g;do{if((c.tag&n)===n){var C=c.inst,j=C.destroy;if(j!==void 0){C.destroy=void 0,h=a;var z=s,G=j;try{G()}catch(ae){lt(h,z,ae)}}}c=c.next}while(c!==g)}}catch(ae){lt(a,a.return,ae)}}function $y(n){var a=n.updateQueue;if(a!==null){var s=n.stateNode;try{jv(a,s)}catch(c){lt(n,n.return,c)}}}function Iy(n,a,s){s.props=gi(n.type,n.memoizedProps),s.state=n.memoizedState;try{s.componentWillUnmount()}catch(c){lt(n,a,c)}}function Ro(n,a){try{var s=n.ref;if(s!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof s=="function"?n.refCleanup=s(c):s.current=c}}catch(h){lt(n,a,h)}}function Sr(n,a){var s=n.ref,c=n.refCleanup;if(s!==null)if(typeof c=="function")try{c()}catch(h){lt(n,a,h)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(h){lt(n,a,h)}else s.current=null}function Py(n){var a=n.type,s=n.memoizedProps,c=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":s.autoFocus&&c.focus();break e;case"img":s.src?c.src=s.src:s.srcSet&&(c.srcset=s.srcSet)}}catch(h){lt(n,n.return,h)}}function Ff(n,a,s){try{var c=n.stateNode;qR(c,n.type,s,a),c[wn]=a}catch(h){lt(n,n.return,h)}}function Fy(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&ja(n.type)||n.tag===4}function Vf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Fy(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&ja(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Uf(n,a,s){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(n,a):(a=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,a.appendChild(n),s=s._reactRootContainer,s!=null||a.onclick!==null||(a.onclick=zr));else if(c!==4&&(c===27&&ja(n.type)&&(s=n.stateNode,a=null),n=n.child,n!==null))for(Uf(n,a,s),n=n.sibling;n!==null;)Uf(n,a,s),n=n.sibling}function hc(n,a,s){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?s.insertBefore(n,a):s.appendChild(n);else if(c!==4&&(c===27&&ja(n.type)&&(s=n.stateNode),n=n.child,n!==null))for(hc(n,a,s),n=n.sibling;n!==null;)hc(n,a,s),n=n.sibling}function Vy(n){var a=n.stateNode,s=n.memoizedProps;try{for(var c=n.type,h=a.attributes;h.length;)a.removeAttributeNode(h[0]);rn(a,c,s),a[Wt]=n,a[wn]=s}catch(g){lt(n,n.return,g)}}var qr=!1,Pt=!1,Hf=!1,Uy=typeof WeakSet=="function"?WeakSet:Set,Kt=null;function CR(n,a){if(n=n.containerInfo,uh=kc,n=ev(n),zd(n)){if("selectionStart"in n)var s={start:n.selectionStart,end:n.selectionEnd};else e:{s=(s=n.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var h=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{s.nodeType,g.nodeType}catch{s=null;break e}var C=0,j=-1,z=-1,G=0,ae=0,le=n,Y=null;t:for(;;){for(var J;le!==s||h!==0&&le.nodeType!==3||(j=C+h),le!==g||c!==0&&le.nodeType!==3||(z=C+c),le.nodeType===3&&(C+=le.nodeValue.length),(J=le.firstChild)!==null;)Y=le,le=J;for(;;){if(le===n)break t;if(Y===s&&++G===h&&(j=C),Y===g&&++ae===c&&(z=C),(J=le.nextSibling)!==null)break;le=Y,Y=le.parentNode}le=J}s=j===-1||z===-1?null:{start:j,end:z}}else s=null}s=s||{start:0,end:0}}else s=null;for(dh={focusedElem:n,selectionRange:s},kc=!1,Kt=a;Kt!==null;)if(a=Kt,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,Kt=n;else for(;Kt!==null;){switch(a=Kt,g=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(s=0;s title"))),rn(g,c,s),g[Wt]=n,Zt(g),c=g;break e;case"link":var C=K0("link","href",h).get(c+(s.href||""));if(C){for(var j=0;jht&&(C=ht,ht=ke,ke=C);var V=Jg(j,ke),I=Jg(j,ht);if(V&&I&&(J.rangeCount!==1||J.anchorNode!==V.node||J.anchorOffset!==V.offset||J.focusNode!==I.node||J.focusOffset!==I.offset)){var q=le.createRange();q.setStart(V.node,V.offset),J.removeAllRanges(),ke>ht?(J.addRange(q),J.extend(I.node,I.offset)):(q.setEnd(I.node,I.offset),J.addRange(q))}}}}for(le=[],J=j;J=J.parentNode;)J.nodeType===1&&le.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;js?32:s,L.T=null,s=Qf,Qf=null;var g=Ca,C=Qr;if(Ht=0,vs=Ca=null,Qr=0,(nt&6)!==0)throw Error(i(331));var j=nt;if(nt|=4,Wy(g.current),Qy(g,g.current,C,s),nt=j,No(0,!1),ce&&typeof ce.onPostCommitFiberRoot=="function")try{ce.onPostCommitFiberRoot(F,g)}catch{}return!0}finally{Z.p=h,L.T=c,v0(n,a)}}function b0(n,a,s){a=qn(s,a),a=Of(n.stateNode,a,2),n=va(n,a,2),n!==null&&(Ct(n,2),_r(n))}function lt(n,a,s){if(n.tag===3)b0(n,n,s);else for(;a!==null;){if(a.tag===3){b0(a,n,s);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(_a===null||!_a.has(c))){n=qn(s,n),s=xy(2),c=va(a,s,2),c!==null&&(wy(s,c,a,n),Ct(c,2),_r(c));break}}a=a.return}}function eh(n,a,s){var c=n.pingCache;if(c===null){c=n.pingCache=new jR;var h=new Set;c.set(a,h)}else h=c.get(a),h===void 0&&(h=new Set,c.set(a,h));h.has(s)||(Gf=!0,h.add(s),n=NR.bind(null,n,a,s),a.then(n,n))}function NR(n,a,s){var c=n.pingCache;c!==null&&c.delete(a),n.pingedLanes|=n.suspendedLanes&s,n.warmLanes&=~s,gt===n&&(Ye&s)===s&&(Tt===4||Tt===3&&(Ye&62914560)===Ye&&300>zt()-gc?(nt&2)===0&&ys(n,0):Zf|=s,gs===Ye&&(gs=0)),_r(n)}function x0(n,a){a===0&&(a=Gt()),n=si(n,a),n!==null&&(Ct(n,a),_r(n))}function DR(n){var a=n.memoizedState,s=0;a!==null&&(s=a.retryLane),x0(n,s)}function kR(n,a){var s=0;switch(n.tag){case 31:case 13:var c=n.stateNode,h=n.memoizedState;h!==null&&(s=h.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(i(314))}c!==null&&c.delete(a),x0(n,s)}function zR(n,a){return rr(n,a)}var _c=null,xs=null,th=!1,Cc=!1,nh=!1,Ra=0;function _r(n){n!==xs&&n.next===null&&(xs===null?_c=xs=n:xs=xs.next=n),Cc=!0,th||(th=!0,$R())}function No(n,a){if(!nh&&Cc){nh=!0;do for(var s=!1,c=_c;c!==null;){if(n!==0){var h=c.pendingLanes;if(h===0)var g=0;else{var C=c.suspendedLanes,j=c.pingedLanes;g=(1<<31-ye(42|n)+1)-1,g&=h&~(C&~j),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(s=!0,C0(c,g))}else g=Ye,g=Ae(c,c===gt?g:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(g&3)===0||ut(c,g)||(s=!0,C0(c,g));c=c.next}while(s);nh=!1}}function LR(){w0()}function w0(){Cc=th=!1;var n=0;Ra!==0&&ZR()&&(n=Ra);for(var a=zt(),s=null,c=_c;c!==null;){var h=c.next,g=S0(c,a);g===0?(c.next=null,s===null?_c=h:s.next=h,h===null&&(xs=s)):(s=c,(n!==0||(g&3)!==0)&&(Cc=!0)),c=h}Ht!==0&&Ht!==5||No(n),Ra!==0&&(Ra=0)}function S0(n,a){for(var s=n.suspendedLanes,c=n.pingedLanes,h=n.expirationTimes,g=n.pendingLanes&-62914561;0j)break;var ae=z.transferSize,le=z.initiatorType;ae&&N0(le)&&(z=z.responseEnd,C+=ae*(z"u"?null:document;function B0(n,a,s){var c=ws;if(c&&typeof a=="string"&&a){var h=Hn(a);h='link[rel="'+n+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),H0.has(h)||(H0.add(h),n={rel:n,crossOrigin:s,href:a},c.querySelector(h)===null&&(a=c.createElement("link"),rn(a,"link",n),Zt(a),c.head.appendChild(a)))}}function n2(n){Xr.D(n),B0("dns-prefetch",n,null)}function r2(n,a){Xr.C(n,a),B0("preconnect",n,a)}function a2(n,a,s){Xr.L(n,a,s);var c=ws;if(c&&n&&a){var h='link[rel="preload"][as="'+Hn(a)+'"]';a==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+Hn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+Hn(s.imageSizes)+'"]')):h+='[href="'+Hn(n)+'"]';var g=h;switch(a){case"style":g=Ss(n);break;case"script":g=_s(n)}Xn.has(g)||(n=v({rel:"preload",href:a==="image"&&s&&s.imageSrcSet?void 0:n,as:a},s),Xn.set(g,n),c.querySelector(h)!==null||a==="style"&&c.querySelector(Lo(g))||a==="script"&&c.querySelector($o(g))||(a=c.createElement("link"),rn(a,"link",n),Zt(a),c.head.appendChild(a)))}}function i2(n,a){Xr.m(n,a);var s=ws;if(s&&n){var c=a&&typeof a.as=="string"?a.as:"script",h='link[rel="modulepreload"][as="'+Hn(c)+'"][href="'+Hn(n)+'"]',g=h;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=_s(n)}if(!Xn.has(g)&&(n=v({rel:"modulepreload",href:n},a),Xn.set(g,n),s.querySelector(h)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector($o(g)))return}c=s.createElement("link"),rn(c,"link",n),Zt(c),s.head.appendChild(c)}}}function s2(n,a,s){Xr.S(n,a,s);var c=ws;if(c&&n){var h=Bi(c).hoistableStyles,g=Ss(n);a=a||"default";var C=h.get(g);if(!C){var j={loading:0,preload:null};if(C=c.querySelector(Lo(g)))j.loading=5;else{n=v({rel:"stylesheet",href:n,"data-precedence":a},s),(s=Xn.get(g))&&yh(n,s);var z=C=c.createElement("link");Zt(z),rn(z,"link",n),z._p=new Promise(function(G,ae){z.onload=G,z.onerror=ae}),z.addEventListener("load",function(){j.loading|=1}),z.addEventListener("error",function(){j.loading|=2}),j.loading|=4,Oc(C,a,c)}C={type:"stylesheet",instance:C,count:1,state:j},h.set(g,C)}}}function o2(n,a){Xr.X(n,a);var s=ws;if(s&&n){var c=Bi(s).hoistableScripts,h=_s(n),g=c.get(h);g||(g=s.querySelector($o(h)),g||(n=v({src:n,async:!0},a),(a=Xn.get(h))&&bh(n,a),g=s.createElement("script"),Zt(g),rn(g,"link",n),s.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(h,g))}}function l2(n,a){Xr.M(n,a);var s=ws;if(s&&n){var c=Bi(s).hoistableScripts,h=_s(n),g=c.get(h);g||(g=s.querySelector($o(h)),g||(n=v({src:n,async:!0,type:"module"},a),(a=Xn.get(h))&&bh(n,a),g=s.createElement("script"),Zt(g),rn(g,"link",n),s.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(h,g))}}function q0(n,a,s,c){var h=(h=de.current)?Tc(h):null;if(!h)throw Error(i(446));switch(n){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(a=Ss(s.href),s=Bi(h).hoistableStyles,c=s.get(a),c||(c={type:"style",instance:null,count:0,state:null},s.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){n=Ss(s.href);var g=Bi(h).hoistableStyles,C=g.get(n);if(C||(h=h.ownerDocument||h,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(n,C),(g=h.querySelector(Lo(n)))&&!g._p&&(C.instance=g,C.state.loading=5),Xn.has(n)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Xn.set(n,s),g||c2(h,n,s,C.state))),a&&c===null)throw Error(i(528,""));return C}if(a&&c!==null)throw Error(i(529,""));return null;case"script":return a=s.async,s=s.src,typeof s=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=_s(s),s=Bi(h).hoistableScripts,c=s.get(a),c||(c={type:"script",instance:null,count:0,state:null},s.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,n))}}function Ss(n){return'href="'+Hn(n)+'"'}function Lo(n){return'link[rel="stylesheet"]['+n+"]"}function G0(n){return v({},n,{"data-precedence":n.precedence,precedence:null})}function c2(n,a,s,c){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?c.loading=1:(a=n.createElement("link"),c.preload=a,a.addEventListener("load",function(){return c.loading|=1}),a.addEventListener("error",function(){return c.loading|=2}),rn(a,"link",s),Zt(a),n.head.appendChild(a))}function _s(n){return'[src="'+Hn(n)+'"]'}function $o(n){return"script[async]"+n}function Z0(n,a,s){if(a.count++,a.instance===null)switch(a.type){case"style":var c=n.querySelector('style[data-href~="'+Hn(s.href)+'"]');if(c)return a.instance=c,Zt(c),c;var h=v({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),Zt(c),rn(c,"style",h),Oc(c,s.precedence,n),a.instance=c;case"stylesheet":h=Ss(s.href);var g=n.querySelector(Lo(h));if(g)return a.state.loading|=4,a.instance=g,Zt(g),g;c=G0(s),(h=Xn.get(h))&&yh(c,h),g=(n.ownerDocument||n).createElement("link"),Zt(g);var C=g;return C._p=new Promise(function(j,z){C.onload=j,C.onerror=z}),rn(g,"link",c),a.state.loading|=4,Oc(g,s.precedence,n),a.instance=g;case"script":return g=_s(s.src),(h=n.querySelector($o(g)))?(a.instance=h,Zt(h),h):(c=s,(h=Xn.get(g))&&(c=v({},s),bh(c,h)),n=n.ownerDocument||n,h=n.createElement("script"),Zt(h),rn(h,"link",c),n.head.appendChild(h),a.instance=h);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(c=a.instance,a.state.loading|=4,Oc(c,s.precedence,n));return a.instance}function Oc(n,a,s){for(var c=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=c.length?c[c.length-1]:null,g=h,C=0;C title"):null)}function u2(n,a,s){if(s===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(n=a.disabled,typeof a.precedence=="string"&&n==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Q0(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function d2(n,a,s,c){if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var h=Ss(c.href),g=a.querySelector(Lo(h));if(g){a=g._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=Mc.bind(n),a.then(n,n)),s.state.loading|=4,s.instance=g,Zt(g);return}g=a.ownerDocument||a,c=G0(c),(h=Xn.get(h))&&yh(c,h),g=g.createElement("link"),Zt(g);var C=g;C._p=new Promise(function(j,z){C.onload=j,C.onerror=z}),rn(g,"link",c),s.instance=g}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(s,a),(a=s.state.preload)&&(s.state.loading&3)===0&&(n.count++,s=Mc.bind(n),a.addEventListener("load",s),a.addEventListener("error",s))}}var xh=0;function f2(n,a){return n.stylesheets&&n.count===0&&Dc(n,n.stylesheets),0xh?50:800)+a);return n.unsuspend=s,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(h)}}:null}function Mc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Dc(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Nc=null;function Dc(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Nc=new Map,a.forEach(h2,n),Nc=null,Mc.call(n))}function h2(n,a){if(!(a.state.loading&4)){var s=Nc.get(n);if(s)var c=s.get(null);else{s=new Map,Nc.set(n,s);for(var h=n.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Oh.exports=M2(),Oh.exports}var D2=N2(),vl=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(){}},k2=class extends vl{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},ip=new k2,z2={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},L2=class{#e=z2;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Si=new L2;function $2(e){setTimeout(e,0)}var I2=typeof window>"u"||"Deno"in globalThis;function On(){}function P2(e,t){return typeof e=="function"?e(t):e}function fm(e){return typeof e=="number"&&e>=0&&e!==1/0}function Sw(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ia(e,t){return typeof e=="function"?e(t):e}function In(e,t){return typeof e=="function"?e(t):e}function xb(e,t){const{type:r="all",exact:i,fetchStatus:o,predicate:l,queryKey:u,stale:d}=e;if(u){if(i){if(t.queryHash!==sp(u,t.options))return!1}else if(!il(t.queryKey,u))return!1}if(r!=="all"){const m=t.isActive();if(r==="active"&&!m||r==="inactive"&&m)return!1}return!(typeof d=="boolean"&&t.isStale()!==d||o&&o!==t.state.fetchStatus||l&&!l(t))}function wb(e,t){const{exact:r,status:i,predicate:o,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(r){if(al(t.options.mutationKey)!==al(l))return!1}else if(!il(t.options.mutationKey,l))return!1}return!(i&&t.state.status!==i||o&&!o(t))}function sp(e,t){return(t?.queryKeyHashFn||al)(e)}function al(e){return JSON.stringify(e,(t,r)=>mm(r)?Object.keys(r).sort().reduce((i,o)=>(i[o]=r[o],i),{}):r)}function il(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>il(e[r],t[r])):!1}var F2=Object.prototype.hasOwnProperty;function _w(e,t,r=0){if(e===t)return e;if(r>500)return t;const i=Sb(e)&&Sb(t);if(!i&&!(mm(e)&&mm(t)))return t;const l=(i?e:Object.keys(e)).length,u=i?t:Object.keys(t),d=u.length,m=i?new Array(d):{};let p=0;for(let y=0;y{Si.setTimeout(t,e)})}function pm(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?_w(e,t):t}function U2(e,t,r=0){const i=[...e,t];return r&&i.length>r?i.slice(1):i}function H2(e,t,r=0){const i=[t,...e];return r&&i.length>r?i.slice(0,-1):i}var op=Symbol();function Cw(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===op?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ew(e,t){return typeof e=="function"?e(...t):!!e}function B2(e,t,r){let i=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??=t(),i||(i=!0,o.aborted?r():o.addEventListener("abort",r,{once:!0})),o)}),e}var sl=(()=>{let e=()=>I2;return{isServer(){return e()},setIsServer(t){e=t}}})();function gm(){let e,t;const r=new Promise((o,l)=>{e=o,t=l});r.status="pending",r.catch(()=>{});function i(o){Object.assign(r,o),delete r.resolve,delete r.reject}return r.resolve=o=>{i({status:"fulfilled",value:o}),e(o)},r.reject=o=>{i({status:"rejected",reason:o}),t(o)},r}var q2=$2;function G2(){let e=[],t=0,r=d=>{d()},i=d=>{d()},o=q2;const l=d=>{t?e.push(d):o(()=>{r(d)})},u=()=>{const d=e;e=[],d.length&&o(()=>{i(()=>{d.forEach(m=>{r(m)})})})};return{batch:d=>{let m;t++;try{m=d()}finally{t--,t||u()}return m},batchCalls:d=>(...m)=>{l(()=>{d(...m)})},schedule:l,setNotifyFunction:d=>{r=d},setBatchNotifyFunction:d=>{i=d},setScheduler:d=>{o=d}}}var on=G2(),Z2=class extends vl{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#e}},hu=new Z2;function K2(e){return Math.min(1e3*2**e,3e4)}function Rw(e){return(e??"online")==="online"?hu.isOnline():!0}var vm=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function jw(e){let t=!1,r=0,i;const o=gm(),l=()=>o.status!=="pending",u=_=>{if(!l()){const E=new vm(_);b(E),e.onCancel?.(E)}},d=()=>{t=!0},m=()=>{t=!1},p=()=>ip.isFocused()&&(e.networkMode==="always"||hu.isOnline())&&e.canRun(),y=()=>Rw(e.networkMode)&&e.canRun(),v=_=>{l()||(i?.(),o.resolve(_))},b=_=>{l()||(i?.(),o.reject(_))},x=()=>new Promise(_=>{i=E=>{(l()||p())&&_(E)},e.onPause?.()}).then(()=>{i=void 0,l()||e.onContinue?.()}),w=()=>{if(l())return;let _;const E=r===0?e.initialPromise:void 0;try{_=E??e.fn()}catch(R){_=Promise.reject(R)}Promise.resolve(_).then(v).catch(R=>{if(l())return;const T=e.retry??(sl.isServer()?0:3),O=e.retryDelay??K2,N=typeof O=="function"?O(r,R):O,k=T===!0||typeof T=="number"&&rp()?void 0:x()).then(()=>{t?b(R):w()})})};return{promise:o,status:()=>o.status,cancel:u,continue:()=>(i?.(),o),cancelRetry:d,continueRetry:m,canStart:y,start:()=>(y()?w():x().then(w),o)}}var Tw=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),fm(this.gcTime)&&(this.#e=Si.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(sl.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Si.clearTimeout(this.#e),this.#e=void 0)}};function Y2(e){return{onFetch:(t,r)=>{const i=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,l=t.state.data?.pages||[],u=t.state.data?.pageParams||[];let d={pages:[],pageParams:[]},m=0;const p=async()=>{let y=!1;const v=w=>{B2(w,()=>t.signal,()=>y=!0)},b=Cw(t.options,t.fetchOptions),x=async(w,_,E)=>{if(y)return Promise.reject(t.signal.reason);if(_==null&&w.pages.length)return Promise.resolve(w);const T=(()=>{const B={client:t.client,queryKey:t.queryKey,pageParam:_,direction:E?"backward":"forward",meta:t.options.meta};return v(B),B})(),O=await b(T),{maxPages:N}=t.options,k=E?H2:U2;return{pages:k(w.pages,O,N),pageParams:k(w.pageParams,_,N)}};if(o&&l.length){const w=o==="backward",_=w?Ow:ym,E={pages:l,pageParams:u},R=_(i,E);d=await x(E,R,w)}else{const w=e??l.length;do{const _=m===0?u[0]??i.initialPageParam:ym(i,d);if(m>0&&_==null)break;d=await x(d,_),m++}while(mt.options.persister?.(p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=p}}}function ym(e,{pages:t,pageParams:r}){const i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,r[i],r):void 0}function Ow(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function Q2(e,t){return t?ym(e,t)!=null:!1}function X2(e,t){return!t||!e.getPreviousPageParam?!1:Ow(e,t)!=null}var J2=class extends Tw{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Eb(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Eb(this.options);t.data!==void 0&&(this.setState(Cb(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=pm(this.state.data,e,this.options);return this.#l({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e){this.#l({type:"setState",state:e})}cancel(e){const t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(On).catch(On):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>In(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===op||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ia(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Sw(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#u()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#a?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){const m=this.observers.find(p=>p.options.queryFn);m&&this.setOptions(m.options)}const r=new AbortController,i=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(this.#s=!0,r.signal)})},o=()=>{const m=Cw(this.options,t),y=(()=>{const v={client:this.#i,queryKey:this.queryKey,meta:this.meta};return i(v),v})();return this.#s=!1,this.options.persister?this.options.persister(m,y,this):m(y)},u=(()=>{const m={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:o};return i(m),m})();(this.#e==="infinite"?Y2(this.options.pages):this.options.behavior)?.onFetch(u,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#l({type:"fetch",meta:u.fetchOptions?.meta}),this.#a=jw({initialPromise:t?.initialPromise,fn:u.fetchFn,onCancel:m=>{m instanceof vm&&m.revert&&this.setState({...this.#n,fetchStatus:"idle"}),r.abort()},onFail:(m,p)=>{this.#l({type:"failed",failureCount:m,error:p})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{const m=await this.#a.start();if(m===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(m),this.#r.config.onSuccess?.(m,this),this.#r.config.onSettled?.(m,this.state.error,this),m}catch(m){if(m instanceof vm){if(m.silent)return this.#a.promise;if(m.revert){if(this.state.data===void 0)throw m;return this.state.data}}throw this.#l({type:"error",error:m}),this.#r.config.onError?.(m,this),this.#r.config.onSettled?.(this.state.data,m,this),m}finally{this.scheduleGc()}}#l(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Aw(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...Cb(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?i:void 0,i;case"error":const o=e.error;return{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),on.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function Aw(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Rw(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Cb(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Eb(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,i=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Mw=class extends vl{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=gm(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#u;#l;#m;#d;#f;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Rb(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return bm(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return bm(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof In(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!hm(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&jb(this.#t,r,this.options,t)&&this.#h(),this.updateResult(),i&&(this.#t!==r||In(this.options.enabled,this.#t)!==In(t.enabled,this.#t)||Ia(this.options.staleTime,this.#t)!==Ia(t.staleTime,this.#t))&&this.#g();const o=this.#v();i&&(this.#t!==r||In(this.options.enabled,this.#t)!==In(t.enabled,this.#t)||o!==this.#c)&&this.#y(o)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(t,e);return ej(this,r)&&(this.#r=r,this.#a=this.options,this.#i=this.#t.state),r}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),t?.(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(On)),t}#g(){this.#x();const e=Ia(this.options.staleTime,this.#t);if(sl.isServer()||this.#r.isStale||!fm(e))return;const r=Sw(this.#r.dataUpdatedAt,e)+1;this.#d=Si.setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#c=e,!(sl.isServer()||In(this.options.enabled,this.#t)===!1||!fm(this.#c)||this.#c===0)&&(this.#f=Si.setInterval(()=>{(this.options.refetchIntervalInBackground||ip.isFocused())&&this.#h()},this.#c))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#d!==void 0&&(Si.clearTimeout(this.#d),this.#d=void 0)}#w(){this.#f!==void 0&&(Si.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){const r=this.#t,i=this.options,o=this.#r,l=this.#i,u=this.#a,m=e!==r?e.state:this.#n,{state:p}=e;let y={...p},v=!1,b;if(t._optimisticResults){const $=this.hasListeners(),he=!$&&Rb(e,t),be=$&&jb(e,r,t,i);(he||be)&&(y={...y,...Aw(p.data,e.options)}),t._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:x,errorUpdatedAt:w,status:_}=y;b=y.data;let E=!1;if(t.placeholderData!==void 0&&b===void 0&&_==="pending"){let $;o?.isPlaceholderData&&t.placeholderData===u?.placeholderData?($=o.data,E=!0):$=typeof t.placeholderData=="function"?t.placeholderData(this.#m?.state.data,this.#m):t.placeholderData,$!==void 0&&(_="success",b=pm(o?.data,$,t),v=!0)}if(t.select&&b!==void 0&&!E)if(o&&b===l?.data&&t.select===this.#u)b=this.#l;else try{this.#u=t.select,b=t.select(b),b=pm(o?.data,b,t),this.#l=b,this.#s=null}catch($){this.#s=$}this.#s&&(x=this.#s,b=this.#l,w=Date.now(),_="error");const R=y.fetchStatus==="fetching",T=_==="pending",O=_==="error",N=T&&R,k=b!==void 0,H={status:_,fetchStatus:y.fetchStatus,isPending:T,isSuccess:_==="success",isError:O,isInitialLoading:N,isLoading:N,data:b,dataUpdatedAt:y.dataUpdatedAt,error:x,errorUpdatedAt:w,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:y.dataUpdateCount>m.dataUpdateCount||y.errorUpdateCount>m.errorUpdateCount,isFetching:R,isRefetching:R&&!T,isLoadingError:O&&!k,isPaused:y.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:O&&k,isStale:lp(e,t),refetch:this.refetch,promise:this.#o,isEnabled:In(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const $=H.data!==void 0,he=H.status==="error"&&!$,be=ue=>{he?ue.reject(H.error):$&&ue.resolve(H.data)},pe=()=>{const ue=this.#o=H.promise=gm();be(ue)},fe=this.#o;switch(fe.status){case"pending":e.queryHash===r.queryHash&&be(fe);break;case"fulfilled":(he||H.data!==fe.value)&&pe();break;case"rejected":(!he||H.error!==fe.reason)&&pe();break}}return H}updateResult(){const e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#m=this.#t),hm(t,e))return;this.#r=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!this.#p.size)return!0;const l=new Set(o??this.#p);return this.options.throwOnError&&l.add("error"),Object.keys(this.#r).some(u=>{const d=u;return this.#r[d]!==e[d]&&l.has(d)})};this.#_({listeners:r()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#_(e){on.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function W2(e,t){return In(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&In(t.retryOnMount,e)===!1)}function Rb(e,t){return W2(e,t)||e.state.data!==void 0&&bm(e,t,t.refetchOnMount)}function bm(e,t,r){if(In(t.enabled,e)!==!1&&Ia(t.staleTime,e)!=="static"){const i=typeof r=="function"?r(e):r;return i==="always"||i!==!1&&lp(e,t)}return!1}function jb(e,t,r,i){return(e!==t||In(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&lp(e,r)}function lp(e,t){return In(t.enabled,e)!==!1&&e.isStaleByTime(Ia(t.staleTime,e))}function ej(e,t){return!hm(e.getCurrentResult(),t)}var tj=class extends Mw{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:r}=e,i=super.createResult(e,t),{isFetching:o,isRefetching:l,isError:u,isRefetchError:d}=i,m=r.fetchMeta?.fetchMore?.direction,p=u&&m==="forward",y=o&&m==="forward",v=u&&m==="backward",b=o&&m==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Q2(t,r.data),hasPreviousPage:X2(t,r.data),isFetchNextPageError:p,isFetchingNextPage:y,isFetchPreviousPageError:v,isFetchingPreviousPage:b,isRefetchError:d&&!p&&!v,isRefetching:l&&!y&&!b}}},nj=class extends Tw{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||rj(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#i({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=jw({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(l,u)=>{this.#i({type:"failed",failureCount:l,error:u})},onPause:()=>{this.#i({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const i=this.state.status==="pending",o=!this.#r.canStart();try{if(i)t();else{this.#i({type:"pending",variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,r);const u=await this.options.onMutate?.(e,r);u!==this.state.context&&this.#i({type:"pending",context:u,variables:e,isPaused:o})}const l=await this.#r.start();return await this.#n.config.onSuccess?.(l,e,this.state.context,this,r),await this.options.onSuccess?.(l,e,this.state.context,r),await this.#n.config.onSettled?.(l,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(l,null,e,this.state.context,r),this.#i({type:"success",data:l}),l}catch(l){try{await this.#n.config.onError?.(l,e,this.state.context,this,r)}catch(u){Promise.reject(u)}try{await this.options.onError?.(l,e,this.state.context,r)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,l,this.state.variables,this.state.context,this,r)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,l,e,this.state.context,r)}catch(u){Promise.reject(u)}throw this.#i({type:"error",error:l}),l}finally{this.#n.runNext(this)}}#i(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),on.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function rj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var aj=class extends vl{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,r){const i=new nj({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:r});return this.add(i),i}add(e){this.#e.add(e);const t=Vc(e);if(typeof t=="string"){const r=this.#t.get(t);r?r.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Vc(e);if(typeof t=="string"){const r=this.#t.get(t);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Vc(e);if(typeof t=="string"){const i=this.#t.get(t)?.find(o=>o.state.status==="pending");return!i||i===e}else return!0}runNext(e){const t=Vc(e);return typeof t=="string"?this.#t.get(t)?.find(i=>i!==e&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){on.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(r=>wb(t,r))}findAll(e={}){return this.getAll().filter(t=>wb(e,t))}notify(e){on.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return on.batch(()=>Promise.all(e.map(t=>t.continue().catch(On))))}};function Vc(e){return e.options.scope?.id}var ij=class extends vl{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){const i=t.queryKey,o=t.queryHash??sp(i,t);let l=this.get(o);return l||(l=new J2({client:e,queryKey:i,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(l)),l}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){on.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>xb(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>xb(e,r)):t}notify(e){on.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){on.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){on.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},sj=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ij,this.#t=e.mutationCache||new aj,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ip.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=hu.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#e.build(this,t),i=r.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Ia(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:r})=>{const i=r.data;return[t,i]})}setQueryData(e,t,r){const i=this.defaultQueryOptions({queryKey:e}),l=this.#e.get(i.queryHash)?.state.data,u=P2(t,l);if(u!==void 0)return this.#e.build(this,i).setData(u,{...r,manual:!0})}setQueriesData(e,t,r){return on.batch(()=>this.#e.findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;on.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#e;return on.batch(()=>(r.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},i=on.batch(()=>this.#e.findAll(e).map(o=>o.cancel(r)));return Promise.all(i).then(On).catch(On)}invalidateQueries(e,t={}){return on.batch(()=>(this.#e.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},i=on.batch(()=>this.#e.findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let l=o.fetch(void 0,r);return r.throwOnError||(l=l.catch(On)),o.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(i).then(On)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#e.build(this,t);return r.isStaleByTime(Ia(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(On).catch(On)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(On).catch(On)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return hu.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(al(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],r={};return t.forEach(i=>{il(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,t){this.#i.set(al(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],r={};return t.forEach(i=>{il(e,i.mutationKey)&&Object.assign(r,i.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=sp(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.queryFn===op&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Nw=S.createContext(void 0),Di=e=>{const t=S.useContext(Nw);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},oj=({client:e,children:t})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),f.jsx(Nw.Provider,{value:e,children:t})),Dw=S.createContext(!1),lj=()=>S.useContext(Dw);Dw.Provider;function cj(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var uj=S.createContext(cj()),dj=()=>S.useContext(uj),fj=(e,t,r)=>{const i=r?.state.error&&typeof e.throwOnError=="function"?Ew(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(t.isReset()||(e.retryOnMount=!1))},hj=e=>{S.useEffect(()=>{e.clearReset()},[e])},mj=({result:e,errorResetBoundary:t,throwOnError:r,query:i,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(o&&e.data===void 0||Ew(r,[e.error,i])),pj=e=>{if(e.suspense){const r=o=>o==="static"?o:Math.max(o??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...o)=>r(i(...o)):r(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},gj=(e,t)=>e.isLoading&&e.isFetching&&!t,vj=(e,t)=>e?.suspense&&t.isPending,Tb=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function kw(e,t,r){const i=lj(),o=dj(),l=Di(),u=l.defaultQueryOptions(e);l.getDefaultOptions().queries?._experimental_beforeQuery?.(u);const d=l.getQueryCache().get(u.queryHash),m=e.subscribed!==!1;u._optimisticResults=i?"isRestoring":m?"optimistic":void 0,pj(u),fj(u,o,d),hj(o);const p=!l.getQueryCache().get(u.queryHash),[y]=S.useState(()=>new t(l,u)),v=y.getOptimisticResult(u),b=!i&&m;if(S.useSyncExternalStore(S.useCallback(x=>{const w=b?y.subscribe(on.batchCalls(x)):On;return y.updateResult(),w},[y,b]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),S.useEffect(()=>{y.setOptions(u)},[u,y]),vj(u,v))throw Tb(u,y,o);if(mj({result:v,errorResetBoundary:o,throwOnError:u.throwOnError,query:d,suspense:u.suspense}))throw v.error;return l.getDefaultOptions().queries?._experimental_afterQuery?.(u,v),u.experimental_prefetchInRender&&!sl.isServer()&&gj(v,i)&&(p?Tb(u,y,o):d?.promise)?.catch(On).finally(()=>{y.updateResult()}),u.notifyOnChangeProps?v:y.trackResult(v)}function Ft(e,t){return kw(e,Mw)}function yj(e,t){return kw(e,tj)}let Ob=!1;function bj(e){const t=e.analytics;if(!t?.key||Ob)return;Ob=!0;const r=document.createElement("script");r.src=t.host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",r.async=!0,r.onload=()=>{const i=window.posthog;i&&(i.init(t.key,{api_host:t.host,defaults:"2026-05-30",capture_pageview:"history_change",session_recording:{maskAllInputs:!0,maskTextSelector:"*"}}),e.me&&i.identify(e.me.email,{email:e.me.email,name:e.me.name,...e.billing?{plan:e.billing.plan}:{}}))},document.head.appendChild(r)}function zw(e,t){window.posthog?.capture(e,t)}const xj=[[/^POST \/api\/projects$/,"project_created"],[/^DELETE \/api\/projects\//,"project_deleted"],[/^POST \/api\/p\/[^/]+\/restore$/,"file_restored"],[/^DELETE \/api\/shares\//,"share_revoked"],[/^PATCH \/api\/shares\//,"share_expiry_changed"],[/^POST \/api\/orgs\/[^/]+\/invites$/,"invite_created"],[/^DELETE \/api\/orgs\/[^/]+\/invites\//,"invite_revoked"],[/^POST \/api\/invites\//,"invite_accepted"],[/^PUT \/api\/p\/[^/]+\/permissions\/./,"project_access_granted"],[/^DELETE \/api\/p\/[^/]+\/permissions\/./,"project_access_revoked"]];function Lw(e,t){const r=e+" "+t.split("?")[0],i=xj.find(([o])=>o.test(r));i&&zw(i[1])}function cp(){throw location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),new Error("signing in…")}function wj(e,t){const r=t.trim();switch(e){case 403:return r.includes("seat")?"This plan is out of seats. Upgrade to add more people.":r.includes("owner")?"Only owners can do that.":"You don't have access to that.";case 409:return r?r[0].toUpperCase()+r.slice(1):"That is managed outside this hub.";case 404:return"That is gone — it may have been removed already.";case 413:return"This project is over its plan limit.";case 429:return"Too many requests. Give it a moment.";default:return e>=500?"The server had a problem. Try again.":r?r[0].toUpperCase()+r.slice(1):"Something went wrong."}}async function Nu(e){throw new Error(wj(e.status,await e.text()))}async function qt(e){const t=await fetch(e,{headers:{Accept:"application/json"}});return t.status===401&&cp(),t.ok||await Nu(t),t.json()}async function Sj(e){const t=await fetch(e);return t.status===401&&cp(),t.ok||await Nu(t),t}async function Wn(e,t,r){const i={method:e};r!==void 0&&(i.headers={"Content-Type":"application/json"},i.body=JSON.stringify(r));const o=await fetch(t,i);return o.ok||await Nu(o),Lw(e,t),o.status===204?{}:o.json()}async function ea(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t||{})});return r.status===401&&cp(),r.ok||await Nu(r),Lw("POST",e),r.json()}function _j(){return Ft({queryKey:["config"],queryFn:async()=>{const e=await qt("/api/config");return e.auth.enabled&&!e.me&&(location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),await new Promise(()=>{})),bj(e),e},staleTime:1/0})}var ki=ww();const Cj=xw(ki);function Ab(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Us(...e){return t=>{let r=!1;const i=e.map(o=>{const l=Ab(o,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let o=0;o{let{children:o,...l}=r,u=null,d=!1;const m=[];Mb(o)&&typeof Uc=="function"&&(o=Uc(o._payload)),S.Children.forEach(o,b=>{if(Aj(b)){d=!0;const x=b;let w="child"in x.props?x.props.child:x.props.children;Mb(w)&&typeof Uc=="function"&&(w=Uc(w._payload)),u=jj(x,w),m.push(u?.props?.children)}else m.push(b)}),u?u=S.cloneElement(u,void 0,m):!d&&S.Children.count(o)===1&&S.isValidElement(o)&&(u=o);const p=u?Oj(u):void 0,y=at(i,p);if(!u){if(o||o===0)throw new Error(d?kj(e):Dj(e));return o}const v=Tj(l,u.props??{});return u.type!==S.Fragment&&(v.ref=i?y:p),S.cloneElement(u,v)});return t.displayName=`${e}.Slot`,t}var Ej=Ei("Slot"),$w=Symbol.for("radix.slottable");function Rj(e){const t=r=>"child"in r?r.children(r.child):r.children;return t.displayName=`${e}.Slottable`,t.__radixId=$w,t}var jj=(e,t)=>{if("child"in e.props){const r=e.props.child;return S.isValidElement(r)?S.cloneElement(r,void 0,e.props.children(r.props.children)):null}return S.isValidElement(t)?t:null};function Tj(e,t){const r={...t};for(const i in t){const o=e[i],l=t[i];/^on[A-Z]/.test(i)?o&&l?r[i]=(...d)=>{const m=l(...d);return o(...d),m}:o&&(r[i]=o):i==="style"?r[i]={...o,...l}:i==="className"&&(r[i]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function Oj(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Aj(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$w}var Mj=Symbol.for("react.lazy");function Mb(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Mj&&"_payload"in e&&Nj(e._payload)}function Nj(e){return typeof e=="object"&&e!==null&&"then"in e}var Dj=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,kj=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Uc=Mu[" use ".trim().toString()],zj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pe=zj.reduce((e,t)=>{const r=Ei(`Primitive.${t}`),i=S.forwardRef((o,l)=>{const{asChild:u,...d}=o,m=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(m,{...d,ref:l})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function Iw(e,t){e&&ki.flushSync(()=>e.dispatchEvent(t))}var Pw=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Lj="VisuallyHidden",Fw=S.forwardRef((e,t)=>f.jsx(Pe.span,{...e,ref:t,style:{...Pw,...e.style}}));Fw.displayName=Lj;var $j=Fw;function Ka(e,t=[]){let r=[];function i(l,u){const d=S.createContext(u);d.displayName=l+"Context";const m=r.length;r=[...r,u];const p=v=>{const{scope:b,children:x,...w}=v,_=b?.[e]?.[m]||d,E=S.useMemo(()=>w,Object.values(w));return f.jsx(_.Provider,{value:E,children:x})};p.displayName=l+"Provider";function y(v,b,x={}){const{optional:w=!1}=x,_=b?.[e]?.[m]||d,E=S.useContext(_);if(E)return E;if(u!==void 0)return u;if(!w)throw new Error(`\`${v}\` must be used within \`${l}\``)}return[p,y]}const o=()=>{const l=r.map(u=>S.createContext(u));return function(d){const m=d?.[e]||l;return S.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return o.scopeName=e,[i,Ij(o,...t)]}function Ij(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const i=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(l){const u=i.reduce((d,{useScope:m,scopeName:p})=>{const v=m(l)[`__scope${p}`];return{...d,...v}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}function up(e){const t=e+"CollectionProvider",[r,i]=Ka(t),[o,l]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=_=>{const{scope:E,children:R}=_,T=S.useRef(null),O=S.useRef(new Map).current;return f.jsx(o,{scope:E,itemMap:O,collectionRef:T,children:R})};u.displayName=t;const d=e+"CollectionSlot",m=Ei(d),p=S.forwardRef((_,E)=>{const{scope:R,children:T}=_,O=l(d,R),N=at(E,O.collectionRef);return f.jsx(m,{ref:N,children:T})});p.displayName=d;const y=e+"CollectionItemSlot",v="data-radix-collection-item",b=Ei(y),x=S.forwardRef((_,E)=>{const{scope:R,children:T,...O}=_,N=S.useRef(null),k=at(E,N),B=l(y,R);return S.useEffect(()=>(B.itemMap.set(N,{ref:N,...O}),()=>{B.itemMap.delete(N)})),f.jsx(b,{[v]:"",ref:k,children:T})});x.displayName=y;function w(_){const E=l(e+"CollectionConsumer",_);return S.useCallback(()=>{const T=E.collectionRef.current;if(!T)return[];const O=Array.from(T.querySelectorAll(`[${v}]`));return Array.from(E.itemMap.values()).sort((B,H)=>O.indexOf(B.ref.current)-O.indexOf(H.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:p,ItemSlot:x},w,i]}function Te(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o||!o.defaultPrevented)return t?.(o)}}var Qt=globalThis?.document?S.useLayoutEffect:()=>{},Pj=Mu[" useInsertionEffect ".trim().toString()]||Qt;function Hs({prop:e,defaultProp:t,onChange:r=()=>{},caller:i}){const[o,l,u]=Fj({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:o;{const y=S.useRef(e!==void 0);S.useEffect(()=>{const v=y.current;v!==d&&console.warn(`${i} is changing from ${v?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=d},[d,i])}const p=S.useCallback(y=>{if(d){const v=Vj(y)?y(e):y;v!==e&&u.current?.(v)}else l(y)},[d,e,l,u]);return[m,p]}function Fj({defaultProp:e,onChange:t}){const[r,i]=S.useState(e),o=S.useRef(r),l=S.useRef(t);return Pj(()=>{l.current=t},[t]),S.useEffect(()=>{o.current!==r&&(l.current?.(r),o.current=r)},[r,o]),[r,i,l]}function Vj(e){return typeof e=="function"}function Uj(e,t){return S.useReducer((r,i)=>t[r][i]??r,e)}var gr=e=>{const{present:t,children:r}=e,i=Hj(t),o=typeof r=="function"?r({present:i.isPresent}):S.Children.only(r),l=Bj(i.ref,qj(o));return typeof r=="function"||i.isPresent?S.cloneElement(o,{ref:l}):null};gr.displayName="Presence";function Hj(e){const[t,r]=S.useState(),i=S.useRef(null),o=S.useRef(e),l=S.useRef("none"),u=S.useRef(void 0),d=e?"mounted":"unmounted",[m,p]=Uj(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{m==="mounted"?(l.current=u.current??Bo(i.current),u.current=void 0):l.current="none"},[m]),Qt(()=>{const y=i.current,v=o.current;if(v!==e){const x=l.current,w=Bo(y);e?(u.current=w,p("MOUNT")):w==="none"||y?.display==="none"?p("UNMOUNT"):p(v&&x!==w?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,p]),Qt(()=>{if(t){let y;const v=t.ownerDocument.defaultView??window,b=w=>{const E=Bo(i.current).includes(CSS.escape(w.animationName));if(w.target===t&&E&&(p("ANIMATION_END"),!o.current)){const R=t.style.animationFillMode;t.style.animationFillMode="forwards",y=v.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=R)})}},x=w=>{w.target===t&&(l.current=Bo(i.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",b),t.addEventListener("animationend",b),()=>{v.clearTimeout(y),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",b),t.removeEventListener("animationend",b)}}else p("ANIMATION_END")},[t,p]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:S.useCallback(y=>{if(y){const v=getComputedStyle(y);i.current=v,u.current=Bo(v)}else i.current=null;r(y)},[])}}function Nb(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Bj(...e){const t=S.useRef(e);return t.current=e,S.useCallback(r=>{const i=t.current;let o=!1;const l=i.map(u=>{const d=Nb(u,r);return!o&&typeof d=="function"&&(o=!0),d});if(o)return()=>{for(let u=0;u{}),Zj=0;function fn(e){const[t,r]=S.useState(Gj());return Qt(()=>{r(i=>i??String(Zj++))},[e]),t?`radix-${t}`:""}var Kj=S.createContext(void 0);function dp(e){const t=S.useContext(Kj);return e||t||"ltr"}function tr(e){const t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>((...r)=>t.current?.(...r)),[])}var Yj="DismissableLayer",xm="dismissableLayer.update",Qj="dismissableLayer.pointerDownOutside",Xj="dismissableLayer.focusOutside",Db,fp=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),yl=S.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,onDismiss:m,...p}=e,y=S.useContext(fp),[v,b]=S.useState(null),x=v?.ownerDocument??globalThis?.document,[,w]=S.useState({}),_=at(t,b),E=Array.from(y.layers),[R]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),T=R?E.indexOf(R):-1,O=v?E.indexOf(v):-1,N=y.layersWithOutsidePointerEventsDisabled.size>0,k=O>=T,B=S.useRef(!1),H=nT(pe=>{l?.(pe),d?.(pe),pe.defaultPrevented||m?.()},{ownerDocument:x,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:B,dismissableSurfaces:y.dismissableSurfaces,shouldHandlePointerDownOutside:S.useCallback(pe=>{if(!(pe instanceof Node))return!1;const fe=[...y.branches].some(ue=>ue.contains(pe));return k&&!fe},[y.branches,k])}),$=rT(pe=>{if(i&&B.current)return;const fe=pe.target;[...y.branches].some(ee=>ee.contains(fe))||(u?.(pe),d?.(pe),pe.defaultPrevented||m?.())},x),he=v?O===E.length-1:!1,be=tr(pe=>{pe.key==="Escape"&&(o?.(pe),!pe.defaultPrevented&&m&&(pe.preventDefault(),m()))});return S.useEffect(()=>{if(he)return x.addEventListener("keydown",be,{capture:!0}),()=>x.removeEventListener("keydown",be,{capture:!0})},[x,he,be]),S.useEffect(()=>{if(v)return r&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(Db=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(v)),y.layers.add(v),kb(),()=>{r&&(y.layersWithOutsidePointerEventsDisabled.delete(v),y.layersWithOutsidePointerEventsDisabled.size===0&&(x.body.style.pointerEvents=Db))}},[v,x,r,y]),S.useEffect(()=>()=>{v&&(y.layers.delete(v),y.layersWithOutsidePointerEventsDisabled.delete(v),kb())},[v,y]),S.useEffect(()=>{const pe=()=>w({});return document.addEventListener(xm,pe),()=>document.removeEventListener(xm,pe)},[]),f.jsx(Pe.div,{...p,ref:_,style:{pointerEvents:N?k?"auto":"none":void 0,...e.style},onFocusCapture:Te(e.onFocusCapture,$.onFocusCapture),onBlurCapture:Te(e.onBlurCapture,$.onBlurCapture),onPointerDownCapture:Te(e.onPointerDownCapture,H.onPointerDownCapture)})});yl.displayName=Yj;var Jj="DismissableLayerBranch",Wj=S.forwardRef((e,t)=>{const r=S.useContext(fp),i=S.useRef(null),o=at(t,i);return S.useEffect(()=>{const l=i.current;if(l)return r.branches.add(l),()=>{r.branches.delete(l)}},[r.branches]),f.jsx(Pe.div,{...e,ref:o})});Wj.displayName=Jj;function eT(){const e=S.useContext(fp),[t,r]=S.useState(null);return S.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}var tT=()=>!0;function nT(e,t){const{ownerDocument:r=globalThis?.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:l,shouldHandlePointerDownOutside:u=tT}=t,d=tr(e),m=S.useRef(!1),p=S.useRef(!1),y=S.useRef(new Map),v=S.useRef(()=>{});return S.useEffect(()=>{function b(){p.current=!1,o.current=!1,y.current.clear()}function x(){return Array.from(y.current.values()).some(Boolean)}function w(O){if(!p.current)return;const N=O.target;N instanceof Node&&[...l].some(B=>B.contains(N))||y.current.set(O.type,!0),O.type==="click"&&window.setTimeout(()=>{p.current&&v.current()},0)}function _(O){p.current&&y.current.set(O.type,!1)}const E=O=>{if(O.target&&!m.current){let N=function(){r.removeEventListener("click",v.current);const B=x();b(),B||Vw(Qj,d,k,{discrete:!0})};if(!u(O.target)){r.removeEventListener("click",v.current),b(),m.current=!1;return}const k={originalEvent:O};p.current=!0,o.current=i&&O.button===0,y.current.clear(),!i||O.button!==0?N():(r.removeEventListener("click",v.current),v.current=N,r.addEventListener("click",v.current,{once:!0}))}else r.removeEventListener("click",v.current),b();m.current=!1},R=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const O of R)r.addEventListener(O,w,!0),r.addEventListener(O,_);const T=window.setTimeout(()=>{r.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(T),r.removeEventListener("pointerdown",E),r.removeEventListener("click",v.current);for(const O of R)r.removeEventListener(O,w,!0),r.removeEventListener(O,_)}},[r,d,i,o,l,u]),{onPointerDownCapture:()=>m.current=!0}}function rT(e,t=globalThis?.document){const r=tr(e),i=S.useRef(!1);return S.useEffect(()=>{const o=l=>{l.target&&!i.current&&Vw(Xj,r,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function kb(){const e=new CustomEvent(xm);document.dispatchEvent(e)}function Vw(e,t,r,{discrete:i}){const o=r.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),i?Iw(o,l):o.dispatchEvent(l)}var Dh="focusScope.autoFocusOnMount",kh="focusScope.autoFocusOnUnmount",zb={bubbles:!1,cancelable:!0},aT="FocusScope",Du=S.forwardRef((e,t)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:l,...u}=e,[d,m]=S.useState(null),p=tr(o),y=tr(l),v=S.useRef(null),b=at(t,m),x=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(i){let _=function(O){if(x.paused||!d)return;const N=O.target;d.contains(N)?v.current=N:ka(v.current,{select:!0})},E=function(O){if(x.paused||!d)return;const N=O.relatedTarget;N!==null&&(d.contains(N)||ka(v.current,{select:!0}))},R=function(O){if(document.activeElement===document.body)for(const k of O)k.removedNodes.length>0&&ka(d)};document.addEventListener("focusin",_),document.addEventListener("focusout",E);const T=new MutationObserver(R);return d&&T.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",E),T.disconnect()}}},[i,d,x.paused]),S.useEffect(()=>{if(d){$b.add(x);const _=document.activeElement;if(!d.contains(_)){const R=new CustomEvent(Dh,zb);d.addEventListener(Dh,p),d.dispatchEvent(R),R.defaultPrevented||(iT(uT(Uw(d)),{select:!0}),document.activeElement===_&&ka(d))}return()=>{d.removeEventListener(Dh,p),setTimeout(()=>{const R=new CustomEvent(kh,zb);d.addEventListener(kh,y),d.dispatchEvent(R),R.defaultPrevented||ka(_??document.body,{select:!0}),d.removeEventListener(kh,y),$b.remove(x)},0)}}},[d,p,y,x]);const w=S.useCallback(_=>{if(!r&&!i||x.paused)return;const E=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,R=document.activeElement;if(E&&R){const T=_.currentTarget,[O,N]=sT(T);O&&N?!_.shiftKey&&R===N?(_.preventDefault(),r&&ka(O,{select:!0})):_.shiftKey&&R===O&&(_.preventDefault(),r&&ka(N,{select:!0})):R===T&&_.preventDefault()}},[r,i,x.paused]);return f.jsx(Pe.div,{tabIndex:-1,...u,ref:b,onKeyDown:w})});Du.displayName=aT;function iT(e,{select:t=!1}={}){const r=document.activeElement;for(const i of e)if(ka(i,{select:t}),document.activeElement!==r)return}function sT(e){const t=Uw(e),r=Lb(t,e),i=Lb(t.reverse(),e);return[r,i]}function Uw(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const o=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||o?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Lb(e,t){const r=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(r?!i.checkVisibility({checkVisibilityCSS:!0}):oT(i,{upTo:t})))return i}function oT(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 lT(e){return e instanceof HTMLInputElement&&"select"in e}function ka(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&lT(e)&&t&&e.select()}}var $b=cT();function cT(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Ib(e,t),e.unshift(t)},remove(t){e=Ib(e,t),e[0]?.resume()}}}function Ib(e,t){const r=[...e],i=r.indexOf(t);return i!==-1&&r.splice(i,1),r}function uT(e){return e.filter(t=>t.tagName!=="A")}var dT="Portal",bl=S.forwardRef((e,t)=>{const{container:r,...i}=e,[o,l]=S.useState(!1);Qt(()=>l(!0),[]);const u=r||o&&globalThis?.document?.body;return u?ki.createPortal(f.jsx(Pe.div,{...i,ref:t}),u):null});bl.displayName=dT;var Hc=0,Es=null;function hp(){S.useEffect(()=>{Es||(Es={start:Pb(),end:Pb()});const{start:e,end:t}=Es;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Hc++,()=>{Hc===1&&(Es?.start.remove(),Es?.end.remove(),Es=null),Hc=Math.max(0,Hc-1)}},[])}function Pb(){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 Tr=function(){return Tr=Object.assign||function(t){for(var r,i=1,o=arguments.length;i"u")return TT;var t=OT(e),r=document.documentElement.clientWidth,i=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,i-r+t[2]-t[0])}},MT=Gw(),$s="data-scroll-locked",NT=function(e,t,r,i){var o=e.left,l=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),` +`+c.stack}}var At=Object.prototype.hasOwnProperty,rr=e.unstable_scheduleCallback,br=e.unstable_cancelCallback,Rt=e.unstable_shouldYield,Vn=e.unstable_requestPaint,zt=e.unstable_now,Dr=e.unstable_getCurrentPriorityLevel,ar=e.unstable_ImmediatePriority,oa=e.unstable_UserBlockingPriority,ir=e.unstable_NormalPriority,la=e.unstable_LowPriority,Jt=e.unstable_IdlePriority,A=e.log,P=e.unstable_setDisableYieldValue,F=null,ue=null;function oe(n){if(typeof A=="function"&&P(n),ue&&typeof ue.setStrictMode=="function")try{ue.setStrictMode(F,n)}catch{}}var be=Math.clz32?Math.clz32:le,Se=Math.log,W=Math.LN2;function le(n){return n>>>=0,n===0?32:31-(Se(n)/W|0)|0}var Re=256,ze=262144,it=4194304;function _t(n){var a=n&42;if(a!==0)return a;switch(n&-n){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function Ae(n,a,s){var c=n.pendingLanes;if(c===0)return 0;var h=0,g=n.suspendedLanes,C=n.pingedLanes;n=n.warmLanes;var j=c&134217727;return j!==0?(c=j&~g,c!==0?h=_t(c):(C&=j,C!==0?h=_t(C):s||(s=j&~n,s!==0&&(h=_t(s))))):(j=c&~g,j!==0?h=_t(j):C!==0?h=_t(C):s||(s=c&~n,s!==0&&(h=_t(s)))),h===0?0:a!==0&&a!==h&&(a&g)===0&&(g=h&-h,s=a&-a,g>=s||g===32&&(s&4194048)!==0)?a:h}function ut(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function st(n,a){switch(n){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Gt(){var n=it;return it<<=1,(it&62914560)===0&&(it=4194304),n}function sr(n){for(var a=[],s=0;31>s;s++)a.push(n);return a}function Ct(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function yn(n,a,s,c,h,g){var C=n.pendingLanes;n.pendingLanes=s,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=s,n.entangledLanes&=s,n.errorRecoveryDisabledLanes&=s,n.shellSuspendCounter=0;var j=n.entanglements,k=n.expirationTimes,G=n.hiddenUpdates;for(s=C&~s;0"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var gE=/[\n"\\]/g;function Hn(n){return n.replace(gE,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function xd(n,a,s,c,h,g,C,j){n.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?n.type=C:n.removeAttribute("type"),a!=null?C==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+Un(a)):n.value!==""+Un(a)&&(n.value=""+Un(a)):C!=="submit"&&C!=="reset"||n.removeAttribute("value"),a!=null?wd(n,C,Un(a)):s!=null?wd(n,C,Un(s)):c!=null&&n.removeAttribute("value"),h==null&&g!=null&&(n.defaultChecked=!!g),h!=null&&(n.checked=h&&typeof h!="function"&&typeof h!="symbol"),j!=null&&typeof j!="function"&&typeof j!="symbol"&&typeof j!="boolean"?n.name=""+Un(j):n.removeAttribute("name")}function jg(n,a,s,c,h,g,C,j){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(n.type=g),a!=null||s!=null){if(!(g!=="submit"&&g!=="reset"||a!=null)){bd(n);return}s=s!=null?""+Un(s):"",a=a!=null?""+Un(a):s,j||a===n.value||(n.value=a),n.defaultValue=a}c=c??h,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=j?n.checked:!!c,n.defaultChecked=!!c,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(n.name=C),bd(n)}function wd(n,a,s){a==="number"&&Ml(n.ownerDocument)===n||n.defaultValue===""+s||(n.defaultValue=""+s)}function Gi(n,a,s,c){if(n=n.options,a){a={};for(var h=0;h"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Rd=!1;if(Lr)try{var to={};Object.defineProperty(to,"passive",{get:function(){Rd=!0}}),window.addEventListener("test",to,to),window.removeEventListener("test",to,to)}catch{Rd=!1}var ua=null,jd=null,Dl=null;function kg(){if(Dl)return Dl;var n,a=jd,s=a.length,c,h="value"in ua?ua.value:ua.textContent,g=h.length;for(n=0;n=ao),Fg=" ",Vg=!1;function Ug(n,a){switch(n){case"keyup":return BE.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hg(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var Qi=!1;function GE(n,a){switch(n){case"compositionend":return Hg(a);case"keypress":return a.which!==32?null:(Vg=!0,Fg);case"textInput":return n=a.data,n===Fg&&Vg?null:n;default:return null}}function ZE(n,a){if(Qi)return n==="compositionend"||!Nd&&Ug(n,a)?(n=kg(),Dl=jd=ua=null,Qi=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1=a)return{node:s,offset:a-n};n=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=Xg(s)}}function Wg(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?Wg(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function ev(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=Ml(n.document);a instanceof n.HTMLIFrameElement;){try{var s=typeof a.contentWindow.location.href=="string"}catch{s=!1}if(s)n=a.contentWindow;else break;a=Ml(n.document)}return a}function zd(n){var a=n&&n.nodeName&&n.nodeName.toLowerCase();return a&&(a==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||a==="textarea"||n.contentEditable==="true")}var tR=Lr&&"documentMode"in document&&11>=document.documentMode,Xi=null,Ld=null,lo=null,$d=!1;function tv(n,a,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;$d||Xi==null||Xi!==Ml(c)||(c=Xi,"selectionStart"in c&&zd(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),lo&&oo(lo,c)||(lo=c,c=Rc(Ld,"onSelect"),0>=C,h-=C,xr=1<<32-be(a)+h|s<Be?(Qe=Oe,Oe=null):Qe=Oe.sibling;var tt=Y(V,Oe,q[Be],se);if(tt===null){Oe===null&&(Oe=Qe);break}n&&Oe&&tt.alternate===null&&a(V,Oe),$=g(tt,$,Be),et===null?Ne=tt:et.sibling=tt,et=tt,Oe=Qe}if(Be===q.length)return s(V,Oe),Xe&&Ir(V,Be),Ne;if(Oe===null){for(;BeBe?(Qe=Oe,Oe=null):Qe=Oe.sibling;var Na=Y(V,Oe,tt.value,se);if(Na===null){Oe===null&&(Oe=Qe);break}n&&Oe&&Na.alternate===null&&a(V,Oe),$=g(Na,$,Be),et===null?Ne=Na:et.sibling=Na,et=Na,Oe=Qe}if(tt.done)return s(V,Oe),Xe&&Ir(V,Be),Ne;if(Oe===null){for(;!tt.done;Be++,tt=q.next())tt=ce(V,tt.value,se),tt!==null&&($=g(tt,$,Be),et===null?Ne=tt:et.sibling=tt,et=tt);return Xe&&Ir(V,Be),Ne}for(Oe=c(Oe);!tt.done;Be++,tt=q.next())tt=J(Oe,V,Be,tt.value,se),tt!==null&&(n&&tt.alternate!==null&&Oe.delete(tt.key===null?Be:tt.key),$=g(tt,$,Be),et===null?Ne=tt:et.sibling=tt,et=tt);return n&&Oe.forEach(function(w2){return a(V,w2)}),Xe&&Ir(V,Be),Ne}function ht(V,$,q,se){if(typeof q=="object"&&q!==null&&q.type===_&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case x:e:{for(var Ne=q.key;$!==null;){if($.key===Ne){if(Ne=q.type,Ne===_){if($.tag===7){s(V,$.sibling),se=h($,q.props.children),se.return=V,V=se;break e}}else if($.elementType===Ne||typeof Ne=="object"&&Ne!==null&&Ne.$$typeof===I&&fi(Ne)===$.type){s(V,$.sibling),se=h($,q.props),po(se,q),se.return=V,V=se;break e}s(V,$);break}else a(V,$);$=$.sibling}q.type===_?(se=oi(q.props.children,V.mode,se,q.key),se.return=V,V=se):(se=Hl(q.type,q.key,q.props,null,V.mode,se),po(se,q),se.return=V,V=se)}return C(V);case w:e:{for(Ne=q.key;$!==null;){if($.key===Ne)if($.tag===4&&$.stateNode.containerInfo===q.containerInfo&&$.stateNode.implementation===q.implementation){s(V,$.sibling),se=h($,q.children||[]),se.return=V,V=se;break e}else{s(V,$);break}else a(V,$);$=$.sibling}se=Bd(q,V.mode,se),se.return=V,V=se}return C(V);case I:return q=fi(q),ht(V,$,q,se)}if(ye(q))return je(V,$,q,se);if(he(q)){if(Ne=he(q),typeof Ne!="function")throw Error(i(150));return q=Ne.call(q),ke(V,$,q,se)}if(typeof q.then=="function")return ht(V,$,Ql(q),se);if(q.$$typeof===O)return ht(V,$,Gl(V,q),se);Xl(V,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,$!==null&&$.tag===6?(s(V,$.sibling),se=h($,q),se.return=V,V=se):(s(V,$),se=Hd(q,V.mode,se),se.return=V,V=se),C(V)):s(V,$)}return function(V,$,q,se){try{mo=0;var Ne=ht(V,$,q,se);return ls=null,Ne}catch(Oe){if(Oe===os||Oe===Kl)throw Oe;var et=Nn(29,Oe,null,V.mode);return et.lanes=se,et.return=V,et}}}var mi=Cv(!0),Ev=Cv(!1),pa=!1;function nf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function rf(n,a){n=n.updateQueue,a.updateQueue===n&&(a.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function ga(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function va(n,a,s){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(nt&2)!==0){var h=c.pending;return h===null?a.next=a:(a.next=h.next,h.next=a),c.pending=a,a=Ul(n),lv(n,null,s),a}return Vl(n,c,a,s),Ul(n)}function go(n,a,s){if(a=a.updateQueue,a!==null&&(a=a.shared,(s&4194048)!==0)){var c=a.lanes;c&=n.pendingLanes,s|=c,a.lanes=s,bn(n,s)}}function af(n,a){var s=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var h=null,g=null;if(s=s.firstBaseUpdate,s!==null){do{var C={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};g===null?h=g=C:g=g.next=C,s=s.next}while(s!==null);g===null?h=g=a:g=g.next=a}else h=g=a;s={baseState:c.baseState,firstBaseUpdate:h,lastBaseUpdate:g,shared:c.shared,callbacks:c.callbacks},n.updateQueue=s;return}n=s.lastBaseUpdate,n===null?s.firstBaseUpdate=a:n.next=a,s.lastBaseUpdate=a}var sf=!1;function vo(){if(sf){var n=ss;if(n!==null)throw n}}function yo(n,a,s,c){sf=!1;var h=n.updateQueue;pa=!1;var g=h.firstBaseUpdate,C=h.lastBaseUpdate,j=h.shared.pending;if(j!==null){h.shared.pending=null;var k=j,G=k.next;k.next=null,C===null?g=G:C.next=G,C=k;var ie=n.alternate;ie!==null&&(ie=ie.updateQueue,j=ie.lastBaseUpdate,j!==C&&(j===null?ie.firstBaseUpdate=G:j.next=G,ie.lastBaseUpdate=k))}if(g!==null){var ce=h.baseState;C=0,ie=G=k=null,j=g;do{var Y=j.lane&-536870913,J=Y!==j.lane;if(J?(Ye&Y)===Y:(c&Y)===Y){Y!==0&&Y===is&&(sf=!0),ie!==null&&(ie=ie.next={lane:0,tag:j.tag,payload:j.payload,callback:null,next:null});e:{var je=n,ke=j;Y=a;var ht=s;switch(ke.tag){case 1:if(je=ke.payload,typeof je=="function"){ce=je.call(ht,ce,Y);break e}ce=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=ke.payload,Y=typeof je=="function"?je.call(ht,ce,Y):je,Y==null)break e;ce=v({},ce,Y);break e;case 2:pa=!0}}Y=j.callback,Y!==null&&(n.flags|=64,J&&(n.flags|=8192),J=h.callbacks,J===null?h.callbacks=[Y]:J.push(Y))}else J={lane:Y,tag:j.tag,payload:j.payload,callback:j.callback,next:null},ie===null?(G=ie=J,k=ce):ie=ie.next=J,C|=Y;if(j=j.next,j===null){if(j=h.shared.pending,j===null)break;J=j,j=J.next,J.next=null,h.lastBaseUpdate=J,h.shared.pending=null}}while(!0);ie===null&&(k=ce),h.baseState=k,h.firstBaseUpdate=G,h.lastBaseUpdate=ie,g===null&&(h.shared.lanes=0),Sa|=C,n.lanes=C,n.memoizedState=ce}}function Rv(n,a){if(typeof n!="function")throw Error(i(191,n));n.call(a)}function jv(n,a){var s=n.callbacks;if(s!==null)for(n.callbacks=null,n=0;ng?g:8;var C=L.T,j={};L.T=j,Ef(n,!1,a,s);try{var k=h(),G=L.S;if(G!==null&&G(j,k),k!==null&&typeof k=="object"&&typeof k.then=="function"){var ie=uR(k,c);wo(n,a,ie,$n(n))}else wo(n,a,c,$n(n))}catch(ce){wo(n,a,{then:function(){},status:"rejected",reason:ce},$n())}finally{Z.p=g,C!==null&&j.types!==null&&(C.types=j.types),L.T=C}}function gR(){}function _f(n,a,s,c){if(n.tag!==5)throw Error(i(476));var h=iy(n).queue;ay(n,h,a,re,s===null?gR:function(){return sy(n),s(c)})}function iy(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:re,baseState:re,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ur,lastRenderedState:re},next:null};var s={};return a.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ur,lastRenderedState:s},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function sy(n){var a=iy(n);a.next===null&&(a=n.alternate.memoizedState),wo(n,a.next.queue,{},$n())}function Cf(){return tn(Io)}function oy(){return Nt().memoizedState}function ly(){return Nt().memoizedState}function vR(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var s=$n();n=ga(s);var c=va(a,n,s);c!==null&&(jn(c,a,s),go(c,a,s)),a={cache:Jd()},n.payload=a;return}a=a.return}}function yR(n,a,s){var c=$n();s={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},oc(n)?uy(a,s):(s=Vd(n,a,s,c),s!==null&&(jn(s,n,c),dy(s,a,c)))}function cy(n,a,s){var c=$n();wo(n,a,s,c)}function wo(n,a,s,c){var h={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(oc(n))uy(a,h);else{var g=n.alternate;if(n.lanes===0&&(g===null||g.lanes===0)&&(g=a.lastRenderedReducer,g!==null))try{var C=a.lastRenderedState,j=g(C,s);if(h.hasEagerState=!0,h.eagerState=j,Mn(j,C))return Vl(n,a,h,0),gt===null&&Fl(),!1}catch{}if(s=Vd(n,a,h,c),s!==null)return jn(s,n,c),dy(s,a,c),!0}return!1}function Ef(n,a,s,c){if(c={lane:2,revertLane:rh(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},oc(n)){if(a)throw Error(i(479))}else a=Vd(n,s,c,2),a!==null&&jn(a,n,2)}function oc(n){var a=n.alternate;return n===Ue||a!==null&&a===Ue}function uy(n,a){us=ec=!0;var s=n.pending;s===null?a.next=a:(a.next=s.next,s.next=a),n.pending=a}function dy(n,a,s){if((s&4194048)!==0){var c=a.lanes;c&=n.pendingLanes,s|=c,a.lanes=s,bn(n,s)}}var So={readContext:tn,use:rc,useCallback:jt,useContext:jt,useEffect:jt,useImperativeHandle:jt,useLayoutEffect:jt,useInsertionEffect:jt,useMemo:jt,useReducer:jt,useRef:jt,useState:jt,useDebugValue:jt,useDeferredValue:jt,useTransition:jt,useSyncExternalStore:jt,useId:jt,useHostTransitionStatus:jt,useFormState:jt,useActionState:jt,useOptimistic:jt,useMemoCache:jt,useCacheRefresh:jt};So.useEffectEvent=jt;var fy={readContext:tn,use:rc,useCallback:function(n,a){return pn().memoizedState=[n,a===void 0?null:a],n},useContext:tn,useEffect:Yv,useImperativeHandle:function(n,a,s){s=s!=null?s.concat([n]):null,ic(4194308,4,Wv.bind(null,a,n),s)},useLayoutEffect:function(n,a){return ic(4194308,4,n,a)},useInsertionEffect:function(n,a){ic(4,2,n,a)},useMemo:function(n,a){var s=pn();a=a===void 0?null:a;var c=n();if(pi){oe(!0);try{n()}finally{oe(!1)}}return s.memoizedState=[c,a],c},useReducer:function(n,a,s){var c=pn();if(s!==void 0){var h=s(a);if(pi){oe(!0);try{s(a)}finally{oe(!1)}}}else h=a;return c.memoizedState=c.baseState=h,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:h},c.queue=n,n=n.dispatch=yR.bind(null,Ue,n),[c.memoizedState,n]},useRef:function(n){var a=pn();return n={current:n},a.memoizedState=n},useState:function(n){n=yf(n);var a=n.queue,s=cy.bind(null,Ue,a);return a.dispatch=s,[n.memoizedState,s]},useDebugValue:wf,useDeferredValue:function(n,a){var s=pn();return Sf(s,n,a)},useTransition:function(){var n=yf(!1);return n=ay.bind(null,Ue,n.queue,!0,!1),pn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,s){var c=Ue,h=pn();if(Xe){if(s===void 0)throw Error(i(407));s=s()}else{if(s=a(),gt===null)throw Error(i(349));(Ye&127)!==0||Dv(c,a,s)}h.memoizedState=s;var g={value:s,getSnapshot:a};return h.queue=g,Yv(zv.bind(null,c,g,n),[n]),c.flags|=2048,fs(9,{destroy:void 0},kv.bind(null,c,g,s,a),null),s},useId:function(){var n=pn(),a=gt.identifierPrefix;if(Xe){var s=wr,c=xr;s=(c&~(1<<32-be(c)-1)).toString(32)+s,a="_"+a+"R_"+s,s=tc++,0<\/script>",g=g.removeChild(g.firstChild);break;case"select":g=typeof c.is=="string"?C.createElement("select",{is:c.is}):C.createElement("select"),c.multiple?g.multiple=!0:c.size&&(g.size=c.size);break;default:g=typeof c.is=="string"?C.createElement(h,{is:c.is}):C.createElement(h)}}g[Wt]=a,g[wn]=c;e:for(C=a.child;C!==null;){if(C.tag===5||C.tag===6)g.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===a)break e;for(;C.sibling===null;){if(C.return===null||C.return===a)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}a.stateNode=g;e:switch(rn(g,h,c),h){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Br(a)}}return yt(a),Pf(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,s),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==c&&Br(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(i(166));if(n=fe.current,rs(a)){if(n=a.stateNode,s=a.memoizedProps,c=null,h=en,h!==null)switch(h.tag){case 27:case 5:c=h.memoizedProps}n[Wt]=a,n=!!(n.nodeValue===s||c!==null&&c.suppressHydrationWarning===!0||M0(n.nodeValue,s)),n||ha(a,!0)}else n=jc(n).createTextNode(c),n[Wt]=a,a.stateNode=n}return yt(a),null;case 31:if(s=a.memoizedState,n===null||n.memoizedState!==null){if(c=rs(a),s!==null){if(n===null){if(!c)throw Error(i(318));if(n=a.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(557));n[Wt]=a}else li(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;yt(a),n=!1}else s=Kd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=s),n=!0;if(!n)return a.flags&256?(kn(a),a):(kn(a),null);if((a.flags&128)!==0)throw Error(i(558))}return yt(a),null;case 13:if(c=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(h=rs(a),c!==null&&c.dehydrated!==null){if(n===null){if(!h)throw Error(i(318));if(h=a.memoizedState,h=h!==null?h.dehydrated:null,!h)throw Error(i(317));h[Wt]=a}else li(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;yt(a),h=!1}else h=Kd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=h),h=!0;if(!h)return a.flags&256?(kn(a),a):(kn(a),null)}return kn(a),(a.flags&128)!==0?(a.lanes=s,a):(s=c!==null,n=n!==null&&n.memoizedState!==null,s&&(c=a.child,h=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(h=c.alternate.memoizedState.cachePool.pool),g=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(g=c.memoizedState.cachePool.pool),g!==h&&(c.flags|=2048)),s!==n&&s&&(a.child.flags|=8192),fc(a,a.updateQueue),yt(a),null);case 4:return we(),n===null&&oh(a.stateNode.containerInfo),yt(a),null;case 10:return Fr(a.type),yt(a),null;case 19:if(M(Mt),c=a.memoizedState,c===null)return yt(a),null;if(h=(a.flags&128)!==0,g=c.rendering,g===null)if(h)Co(c,!1);else{if(Tt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(g=Wl(n),g!==null){for(a.flags|=128,Co(c,!1),n=g.updateQueue,a.updateQueue=n,fc(a,n),a.subtreeFlags=0,n=s,s=a.child;s!==null;)cv(s,n),s=s.sibling;return U(Mt,Mt.current&1|2),Xe&&Ir(a,c.treeForkCount),a.child}n=n.sibling}c.tail!==null&&zt()>vc&&(a.flags|=128,h=!0,Co(c,!1),a.lanes=4194304)}else{if(!h)if(n=Wl(g),n!==null){if(a.flags|=128,h=!0,n=n.updateQueue,a.updateQueue=n,fc(a,n),Co(c,!0),c.tail===null&&c.tailMode==="hidden"&&!g.alternate&&!Xe)return yt(a),null}else 2*zt()-c.renderingStartTime>vc&&s!==536870912&&(a.flags|=128,h=!0,Co(c,!1),a.lanes=4194304);c.isBackwards?(g.sibling=a.child,a.child=g):(n=c.last,n!==null?n.sibling=g:a.child=g,c.last=g)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=zt(),n.sibling=null,s=Mt.current,U(Mt,h?s&1|2:s&1),Xe&&Ir(a,c.treeForkCount),n):(yt(a),null);case 22:case 23:return kn(a),lf(),c=a.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(s&536870912)!==0&&(a.flags&128)===0&&(yt(a),a.subtreeFlags&6&&(a.flags|=8192)):yt(a),s=a.updateQueue,s!==null&&fc(a,s.retryQueue),s=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==s&&(a.flags|=2048),n!==null&&M(di),null;case 24:return s=null,n!==null&&(s=n.memoizedState.cache),a.memoizedState.cache!==s&&(a.flags|=2048),Fr(Lt),yt(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function _R(n,a){switch(Gd(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return Fr(Lt),we(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return Fe(a),null;case 31:if(a.memoizedState!==null){if(kn(a),a.alternate===null)throw Error(i(340));li()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(kn(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(i(340));li()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return M(Mt),null;case 4:return we(),null;case 10:return Fr(a.type),null;case 22:case 23:return kn(a),lf(),n!==null&&M(di),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return Fr(Lt),null;case 25:return null;default:return null}}function Ly(n,a){switch(Gd(a),a.tag){case 3:Fr(Lt),we();break;case 26:case 27:case 5:Fe(a);break;case 4:we();break;case 31:a.memoizedState!==null&&kn(a);break;case 13:kn(a);break;case 19:M(Mt);break;case 10:Fr(a.type);break;case 22:case 23:kn(a),lf(),n!==null&&M(di);break;case 24:Fr(Lt)}}function Eo(n,a){try{var s=a.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var h=c.next;s=h;do{if((s.tag&n)===n){c=void 0;var g=s.create,C=s.inst;c=g(),C.destroy=c}s=s.next}while(s!==h)}}catch(j){lt(a,a.return,j)}}function xa(n,a,s){try{var c=a.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var g=h.next;c=g;do{if((c.tag&n)===n){var C=c.inst,j=C.destroy;if(j!==void 0){C.destroy=void 0,h=a;var k=s,G=j;try{G()}catch(ie){lt(h,k,ie)}}}c=c.next}while(c!==g)}}catch(ie){lt(a,a.return,ie)}}function $y(n){var a=n.updateQueue;if(a!==null){var s=n.stateNode;try{jv(a,s)}catch(c){lt(n,n.return,c)}}}function Iy(n,a,s){s.props=gi(n.type,n.memoizedProps),s.state=n.memoizedState;try{s.componentWillUnmount()}catch(c){lt(n,a,c)}}function Ro(n,a){try{var s=n.ref;if(s!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof s=="function"?n.refCleanup=s(c):s.current=c}}catch(h){lt(n,a,h)}}function Sr(n,a){var s=n.ref,c=n.refCleanup;if(s!==null)if(typeof c=="function")try{c()}catch(h){lt(n,a,h)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(h){lt(n,a,h)}else s.current=null}function Py(n){var a=n.type,s=n.memoizedProps,c=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":s.autoFocus&&c.focus();break e;case"img":s.src?c.src=s.src:s.srcSet&&(c.srcset=s.srcSet)}}catch(h){lt(n,n.return,h)}}function Ff(n,a,s){try{var c=n.stateNode;qR(c,n.type,s,a),c[wn]=a}catch(h){lt(n,n.return,h)}}function Fy(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&ja(n.type)||n.tag===4}function Vf(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||Fy(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&ja(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function Uf(n,a,s){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(n,a):(a=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,a.appendChild(n),s=s._reactRootContainer,s!=null||a.onclick!==null||(a.onclick=zr));else if(c!==4&&(c===27&&ja(n.type)&&(s=n.stateNode,a=null),n=n.child,n!==null))for(Uf(n,a,s),n=n.sibling;n!==null;)Uf(n,a,s),n=n.sibling}function hc(n,a,s){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?s.insertBefore(n,a):s.appendChild(n);else if(c!==4&&(c===27&&ja(n.type)&&(s=n.stateNode),n=n.child,n!==null))for(hc(n,a,s),n=n.sibling;n!==null;)hc(n,a,s),n=n.sibling}function Vy(n){var a=n.stateNode,s=n.memoizedProps;try{for(var c=n.type,h=a.attributes;h.length;)a.removeAttributeNode(h[0]);rn(a,c,s),a[Wt]=n,a[wn]=s}catch(g){lt(n,n.return,g)}}var qr=!1,Pt=!1,Hf=!1,Uy=typeof WeakSet=="function"?WeakSet:Set,Kt=null;function CR(n,a){if(n=n.containerInfo,uh=kc,n=ev(n),zd(n)){if("selectionStart"in n)var s={start:n.selectionStart,end:n.selectionEnd};else e:{s=(s=n.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var h=c.anchorOffset,g=c.focusNode;c=c.focusOffset;try{s.nodeType,g.nodeType}catch{s=null;break e}var C=0,j=-1,k=-1,G=0,ie=0,ce=n,Y=null;t:for(;;){for(var J;ce!==s||h!==0&&ce.nodeType!==3||(j=C+h),ce!==g||c!==0&&ce.nodeType!==3||(k=C+c),ce.nodeType===3&&(C+=ce.nodeValue.length),(J=ce.firstChild)!==null;)Y=ce,ce=J;for(;;){if(ce===n)break t;if(Y===s&&++G===h&&(j=C),Y===g&&++ie===c&&(k=C),(J=ce.nextSibling)!==null)break;ce=Y,Y=ce.parentNode}ce=J}s=j===-1||k===-1?null:{start:j,end:k}}else s=null}s=s||{start:0,end:0}}else s=null;for(dh={focusedElem:n,selectionRange:s},kc=!1,Kt=a;Kt!==null;)if(a=Kt,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,Kt=n;else for(;Kt!==null;){switch(a=Kt,g=a.alternate,n=a.flags,a.tag){case 0:if((n&4)!==0&&(n=a.updateQueue,n=n!==null?n.events:null,n!==null))for(s=0;s title"))),rn(g,c,s),g[Wt]=n,Zt(g),c=g;break e;case"link":var C=K0("link","href",h).get(c+(s.href||""));if(C){for(var j=0;jht&&(C=ht,ht=ke,ke=C);var V=Jg(j,ke),$=Jg(j,ht);if(V&&$&&(J.rangeCount!==1||J.anchorNode!==V.node||J.anchorOffset!==V.offset||J.focusNode!==$.node||J.focusOffset!==$.offset)){var q=ce.createRange();q.setStart(V.node,V.offset),J.removeAllRanges(),ke>ht?(J.addRange(q),J.extend($.node,$.offset)):(q.setEnd($.node,$.offset),J.addRange(q))}}}}for(ce=[],J=j;J=J.parentNode;)J.nodeType===1&&ce.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof j.focus=="function"&&j.focus(),j=0;js?32:s,L.T=null,s=Qf,Qf=null;var g=Ca,C=Qr;if(Ht=0,vs=Ca=null,Qr=0,(nt&6)!==0)throw Error(i(331));var j=nt;if(nt|=4,Wy(g.current),Qy(g,g.current,C,s),nt=j,No(0,!1),ue&&typeof ue.onPostCommitFiberRoot=="function")try{ue.onPostCommitFiberRoot(F,g)}catch{}return!0}finally{Z.p=h,L.T=c,v0(n,a)}}function b0(n,a,s){a=qn(s,a),a=Of(n.stateNode,a,2),n=va(n,a,2),n!==null&&(Ct(n,2),_r(n))}function lt(n,a,s){if(n.tag===3)b0(n,n,s);else for(;a!==null;){if(a.tag===3){b0(a,n,s);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(_a===null||!_a.has(c))){n=qn(s,n),s=xy(2),c=va(a,s,2),c!==null&&(wy(s,c,a,n),Ct(c,2),_r(c));break}}a=a.return}}function eh(n,a,s){var c=n.pingCache;if(c===null){c=n.pingCache=new jR;var h=new Set;c.set(a,h)}else h=c.get(a),h===void 0&&(h=new Set,c.set(a,h));h.has(s)||(Gf=!0,h.add(s),n=NR.bind(null,n,a,s),a.then(n,n))}function NR(n,a,s){var c=n.pingCache;c!==null&&c.delete(a),n.pingedLanes|=n.suspendedLanes&s,n.warmLanes&=~s,gt===n&&(Ye&s)===s&&(Tt===4||Tt===3&&(Ye&62914560)===Ye&&300>zt()-gc?(nt&2)===0&&ys(n,0):Zf|=s,gs===Ye&&(gs=0)),_r(n)}function x0(n,a){a===0&&(a=Gt()),n=si(n,a),n!==null&&(Ct(n,a),_r(n))}function DR(n){var a=n.memoizedState,s=0;a!==null&&(s=a.retryLane),x0(n,s)}function kR(n,a){var s=0;switch(n.tag){case 31:case 13:var c=n.stateNode,h=n.memoizedState;h!==null&&(s=h.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(i(314))}c!==null&&c.delete(a),x0(n,s)}function zR(n,a){return rr(n,a)}var _c=null,xs=null,th=!1,Cc=!1,nh=!1,Ra=0;function _r(n){n!==xs&&n.next===null&&(xs===null?_c=xs=n:xs=xs.next=n),Cc=!0,th||(th=!0,$R())}function No(n,a){if(!nh&&Cc){nh=!0;do for(var s=!1,c=_c;c!==null;){if(n!==0){var h=c.pendingLanes;if(h===0)var g=0;else{var C=c.suspendedLanes,j=c.pingedLanes;g=(1<<31-be(42|n)+1)-1,g&=h&~(C&~j),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(s=!0,C0(c,g))}else g=Ye,g=Ae(c,c===gt?g:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(g&3)===0||ut(c,g)||(s=!0,C0(c,g));c=c.next}while(s);nh=!1}}function LR(){w0()}function w0(){Cc=th=!1;var n=0;Ra!==0&&ZR()&&(n=Ra);for(var a=zt(),s=null,c=_c;c!==null;){var h=c.next,g=S0(c,a);g===0?(c.next=null,s===null?_c=h:s.next=h,h===null&&(xs=s)):(s=c,(n!==0||(g&3)!==0)&&(Cc=!0)),c=h}Ht!==0&&Ht!==5||No(n),Ra!==0&&(Ra=0)}function S0(n,a){for(var s=n.suspendedLanes,c=n.pingedLanes,h=n.expirationTimes,g=n.pendingLanes&-62914561;0j)break;var ie=k.transferSize,ce=k.initiatorType;ie&&N0(ce)&&(k=k.responseEnd,C+=ie*(k"u"?null:document;function B0(n,a,s){var c=ws;if(c&&typeof a=="string"&&a){var h=Hn(a);h='link[rel="'+n+'"][href="'+h+'"]',typeof s=="string"&&(h+='[crossorigin="'+s+'"]'),H0.has(h)||(H0.add(h),n={rel:n,crossOrigin:s,href:a},c.querySelector(h)===null&&(a=c.createElement("link"),rn(a,"link",n),Zt(a),c.head.appendChild(a)))}}function n2(n){Xr.D(n),B0("dns-prefetch",n,null)}function r2(n,a){Xr.C(n,a),B0("preconnect",n,a)}function a2(n,a,s){Xr.L(n,a,s);var c=ws;if(c&&n&&a){var h='link[rel="preload"][as="'+Hn(a)+'"]';a==="image"&&s&&s.imageSrcSet?(h+='[imagesrcset="'+Hn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(h+='[imagesizes="'+Hn(s.imageSizes)+'"]')):h+='[href="'+Hn(n)+'"]';var g=h;switch(a){case"style":g=Ss(n);break;case"script":g=_s(n)}Xn.has(g)||(n=v({rel:"preload",href:a==="image"&&s&&s.imageSrcSet?void 0:n,as:a},s),Xn.set(g,n),c.querySelector(h)!==null||a==="style"&&c.querySelector(Lo(g))||a==="script"&&c.querySelector($o(g))||(a=c.createElement("link"),rn(a,"link",n),Zt(a),c.head.appendChild(a)))}}function i2(n,a){Xr.m(n,a);var s=ws;if(s&&n){var c=a&&typeof a.as=="string"?a.as:"script",h='link[rel="modulepreload"][as="'+Hn(c)+'"][href="'+Hn(n)+'"]',g=h;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=_s(n)}if(!Xn.has(g)&&(n=v({rel:"modulepreload",href:n},a),Xn.set(g,n),s.querySelector(h)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector($o(g)))return}c=s.createElement("link"),rn(c,"link",n),Zt(c),s.head.appendChild(c)}}}function s2(n,a,s){Xr.S(n,a,s);var c=ws;if(c&&n){var h=Bi(c).hoistableStyles,g=Ss(n);a=a||"default";var C=h.get(g);if(!C){var j={loading:0,preload:null};if(C=c.querySelector(Lo(g)))j.loading=5;else{n=v({rel:"stylesheet",href:n,"data-precedence":a},s),(s=Xn.get(g))&&yh(n,s);var k=C=c.createElement("link");Zt(k),rn(k,"link",n),k._p=new Promise(function(G,ie){k.onload=G,k.onerror=ie}),k.addEventListener("load",function(){j.loading|=1}),k.addEventListener("error",function(){j.loading|=2}),j.loading|=4,Oc(C,a,c)}C={type:"stylesheet",instance:C,count:1,state:j},h.set(g,C)}}}function o2(n,a){Xr.X(n,a);var s=ws;if(s&&n){var c=Bi(s).hoistableScripts,h=_s(n),g=c.get(h);g||(g=s.querySelector($o(h)),g||(n=v({src:n,async:!0},a),(a=Xn.get(h))&&bh(n,a),g=s.createElement("script"),Zt(g),rn(g,"link",n),s.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(h,g))}}function l2(n,a){Xr.M(n,a);var s=ws;if(s&&n){var c=Bi(s).hoistableScripts,h=_s(n),g=c.get(h);g||(g=s.querySelector($o(h)),g||(n=v({src:n,async:!0,type:"module"},a),(a=Xn.get(h))&&bh(n,a),g=s.createElement("script"),Zt(g),rn(g,"link",n),s.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},c.set(h,g))}}function q0(n,a,s,c){var h=(h=fe.current)?Tc(h):null;if(!h)throw Error(i(446));switch(n){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(a=Ss(s.href),s=Bi(h).hoistableStyles,c=s.get(a),c||(c={type:"style",instance:null,count:0,state:null},s.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){n=Ss(s.href);var g=Bi(h).hoistableStyles,C=g.get(n);if(C||(h=h.ownerDocument||h,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(n,C),(g=h.querySelector(Lo(n)))&&!g._p&&(C.instance=g,C.state.loading=5),Xn.has(n)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Xn.set(n,s),g||c2(h,n,s,C.state))),a&&c===null)throw Error(i(528,""));return C}if(a&&c!==null)throw Error(i(529,""));return null;case"script":return a=s.async,s=s.src,typeof s=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=_s(s),s=Bi(h).hoistableScripts,c=s.get(a),c||(c={type:"script",instance:null,count:0,state:null},s.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,n))}}function Ss(n){return'href="'+Hn(n)+'"'}function Lo(n){return'link[rel="stylesheet"]['+n+"]"}function G0(n){return v({},n,{"data-precedence":n.precedence,precedence:null})}function c2(n,a,s,c){n.querySelector('link[rel="preload"][as="style"]['+a+"]")?c.loading=1:(a=n.createElement("link"),c.preload=a,a.addEventListener("load",function(){return c.loading|=1}),a.addEventListener("error",function(){return c.loading|=2}),rn(a,"link",s),Zt(a),n.head.appendChild(a))}function _s(n){return'[src="'+Hn(n)+'"]'}function $o(n){return"script[async]"+n}function Z0(n,a,s){if(a.count++,a.instance===null)switch(a.type){case"style":var c=n.querySelector('style[data-href~="'+Hn(s.href)+'"]');if(c)return a.instance=c,Zt(c),c;var h=v({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),Zt(c),rn(c,"style",h),Oc(c,s.precedence,n),a.instance=c;case"stylesheet":h=Ss(s.href);var g=n.querySelector(Lo(h));if(g)return a.state.loading|=4,a.instance=g,Zt(g),g;c=G0(s),(h=Xn.get(h))&&yh(c,h),g=(n.ownerDocument||n).createElement("link"),Zt(g);var C=g;return C._p=new Promise(function(j,k){C.onload=j,C.onerror=k}),rn(g,"link",c),a.state.loading|=4,Oc(g,s.precedence,n),a.instance=g;case"script":return g=_s(s.src),(h=n.querySelector($o(g)))?(a.instance=h,Zt(h),h):(c=s,(h=Xn.get(g))&&(c=v({},s),bh(c,h)),n=n.ownerDocument||n,h=n.createElement("script"),Zt(h),rn(h,"link",c),n.head.appendChild(h),a.instance=h);case"void":return null;default:throw Error(i(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(c=a.instance,a.state.loading|=4,Oc(c,s.precedence,n));return a.instance}function Oc(n,a,s){for(var c=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),h=c.length?c[c.length-1]:null,g=h,C=0;C title"):null)}function u2(n,a,s){if(s===1||a.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(n=a.disabled,typeof a.precedence=="string"&&n==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function Q0(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function d2(n,a,s,c){if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var h=Ss(c.href),g=a.querySelector(Lo(h));if(g){a=g._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=Mc.bind(n),a.then(n,n)),s.state.loading|=4,s.instance=g,Zt(g);return}g=a.ownerDocument||a,c=G0(c),(h=Xn.get(h))&&yh(c,h),g=g.createElement("link"),Zt(g);var C=g;C._p=new Promise(function(j,k){C.onload=j,C.onerror=k}),rn(g,"link",c),s.instance=g}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(s,a),(a=s.state.preload)&&(s.state.loading&3)===0&&(n.count++,s=Mc.bind(n),a.addEventListener("load",s),a.addEventListener("error",s))}}var xh=0;function f2(n,a){return n.stylesheets&&n.count===0&&Dc(n,n.stylesheets),0xh?50:800)+a);return n.unsuspend=s,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(h)}}:null}function Mc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Dc(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var Nc=null;function Dc(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,Nc=new Map,a.forEach(h2,n),Nc=null,Mc.call(n))}function h2(n,a){if(!(a.state.loading&4)){var s=Nc.get(n);if(s)var c=s.get(null);else{s=new Map,Nc.set(n,s);for(var h=n.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Oh.exports=M2(),Oh.exports}var D2=N2(),vl=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(){}},k2=class extends vl{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},ip=new k2,z2={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},L2=class{#e=z2;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},Si=new L2;function $2(e){setTimeout(e,0)}var I2=typeof window>"u"||"Deno"in globalThis;function On(){}function P2(e,t){return typeof e=="function"?e(t):e}function fm(e){return typeof e=="number"&&e>=0&&e!==1/0}function Sw(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Ia(e,t){return typeof e=="function"?e(t):e}function In(e,t){return typeof e=="function"?e(t):e}function xb(e,t){const{type:r="all",exact:i,fetchStatus:o,predicate:l,queryKey:u,stale:d}=e;if(u){if(i){if(t.queryHash!==sp(u,t.options))return!1}else if(!il(t.queryKey,u))return!1}if(r!=="all"){const m=t.isActive();if(r==="active"&&!m||r==="inactive"&&m)return!1}return!(typeof d=="boolean"&&t.isStale()!==d||o&&o!==t.state.fetchStatus||l&&!l(t))}function wb(e,t){const{exact:r,status:i,predicate:o,mutationKey:l}=e;if(l){if(!t.options.mutationKey)return!1;if(r){if(al(t.options.mutationKey)!==al(l))return!1}else if(!il(t.options.mutationKey,l))return!1}return!(i&&t.state.status!==i||o&&!o(t))}function sp(e,t){return(t?.queryKeyHashFn||al)(e)}function al(e){return JSON.stringify(e,(t,r)=>mm(r)?Object.keys(r).sort().reduce((i,o)=>(i[o]=r[o],i),{}):r)}function il(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>il(e[r],t[r])):!1}var F2=Object.prototype.hasOwnProperty;function _w(e,t,r=0){if(e===t)return e;if(r>500)return t;const i=Sb(e)&&Sb(t);if(!i&&!(mm(e)&&mm(t)))return t;const l=(i?e:Object.keys(e)).length,u=i?t:Object.keys(t),d=u.length,m=i?new Array(d):{};let p=0;for(let y=0;y{Si.setTimeout(t,e)})}function pm(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?_w(e,t):t}function U2(e,t,r=0){const i=[...e,t];return r&&i.length>r?i.slice(1):i}function H2(e,t,r=0){const i=[t,...e];return r&&i.length>r?i.slice(0,-1):i}var op=Symbol();function Cw(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===op?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ew(e,t){return typeof e=="function"?e(...t):!!e}function B2(e,t,r){let i=!1,o;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(o??=t(),i||(i=!0,o.aborted?r():o.addEventListener("abort",r,{once:!0})),o)}),e}var sl=(()=>{let e=()=>I2;return{isServer(){return e()},setIsServer(t){e=t}}})();function gm(){let e,t;const r=new Promise((o,l)=>{e=o,t=l});r.status="pending",r.catch(()=>{});function i(o){Object.assign(r,o),delete r.resolve,delete r.reject}return r.resolve=o=>{i({status:"fulfilled",value:o}),e(o)},r.reject=o=>{i({status:"rejected",reason:o}),t(o)},r}var q2=$2;function G2(){let e=[],t=0,r=d=>{d()},i=d=>{d()},o=q2;const l=d=>{t?e.push(d):o(()=>{r(d)})},u=()=>{const d=e;e=[],d.length&&o(()=>{i(()=>{d.forEach(m=>{r(m)})})})};return{batch:d=>{let m;t++;try{m=d()}finally{t--,t||u()}return m},batchCalls:d=>(...m)=>{l(()=>{d(...m)})},schedule:l,setNotifyFunction:d=>{r=d},setBatchNotifyFunction:d=>{i=d},setScheduler:d=>{o=d}}}var on=G2(),Z2=class extends vl{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",r)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#e}},hu=new Z2;function K2(e){return Math.min(1e3*2**e,3e4)}function Rw(e){return(e??"online")==="online"?hu.isOnline():!0}var vm=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function jw(e){let t=!1,r=0,i;const o=gm(),l=()=>o.status!=="pending",u=_=>{if(!l()){const E=new vm(_);b(E),e.onCancel?.(E)}},d=()=>{t=!0},m=()=>{t=!1},p=()=>ip.isFocused()&&(e.networkMode==="always"||hu.isOnline())&&e.canRun(),y=()=>Rw(e.networkMode)&&e.canRun(),v=_=>{l()||(i?.(),o.resolve(_))},b=_=>{l()||(i?.(),o.reject(_))},x=()=>new Promise(_=>{i=E=>{(l()||p())&&_(E)},e.onPause?.()}).then(()=>{i=void 0,l()||e.onContinue?.()}),w=()=>{if(l())return;let _;const E=r===0?e.initialPromise:void 0;try{_=E??e.fn()}catch(R){_=Promise.reject(R)}Promise.resolve(_).then(v).catch(R=>{if(l())return;const T=e.retry??(sl.isServer()?0:3),O=e.retryDelay??K2,N=typeof O=="function"?O(r,R):O,z=T===!0||typeof T=="number"&&rp()?void 0:x()).then(()=>{t?b(R):w()})})};return{promise:o,status:()=>o.status,cancel:u,continue:()=>(i?.(),o),cancelRetry:d,continueRetry:m,canStart:y,start:()=>(y()?w():x().then(w),o)}}var Tw=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),fm(this.gcTime)&&(this.#e=Si.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(sl.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(Si.clearTimeout(this.#e),this.#e=void 0)}};function Y2(e){return{onFetch:(t,r)=>{const i=t.options,o=t.fetchOptions?.meta?.fetchMore?.direction,l=t.state.data?.pages||[],u=t.state.data?.pageParams||[];let d={pages:[],pageParams:[]},m=0;const p=async()=>{let y=!1;const v=w=>{B2(w,()=>t.signal,()=>y=!0)},b=Cw(t.options,t.fetchOptions),x=async(w,_,E)=>{if(y)return Promise.reject(t.signal.reason);if(_==null&&w.pages.length)return Promise.resolve(w);const T=(()=>{const B={client:t.client,queryKey:t.queryKey,pageParam:_,direction:E?"backward":"forward",meta:t.options.meta};return v(B),B})(),O=await b(T),{maxPages:N}=t.options,z=E?H2:U2;return{pages:z(w.pages,O,N),pageParams:z(w.pageParams,_,N)}};if(o&&l.length){const w=o==="backward",_=w?Ow:ym,E={pages:l,pageParams:u},R=_(i,E);d=await x(E,R,w)}else{const w=e??l.length;do{const _=m===0?u[0]??i.initialPageParam:ym(i,d);if(m>0&&_==null)break;d=await x(d,_),m++}while(mt.options.persister?.(p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=p}}}function ym(e,{pages:t,pageParams:r}){const i=t.length-1;return t.length>0?e.getNextPageParam(t[i],t,r[i],r):void 0}function Ow(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}function Q2(e,t){return t?ym(e,t)!=null:!1}function X2(e,t){return!t||!e.getPreviousPageParam?!1:Ow(e,t)!=null}var J2=class extends Tw{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Eb(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Eb(this.options);t.data!==void 0&&(this.setState(Cb(t.data,t.dataUpdatedAt)),this.#t=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=pm(this.state.data,e,this.options);return this.#l({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e){this.#l({type:"setState",state:e})}cancel(e){const t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(On).catch(On):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>In(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===op||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Ia(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Sw(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#u()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}#u(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"}invalidate(){this.state.isInvalidated||this.#l({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#a?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){const m=this.observers.find(p=>p.options.queryFn);m&&this.setOptions(m.options)}const r=new AbortController,i=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(this.#s=!0,r.signal)})},o=()=>{const m=Cw(this.options,t),y=(()=>{const v={client:this.#i,queryKey:this.queryKey,meta:this.meta};return i(v),v})();return this.#s=!1,this.options.persister?this.options.persister(m,y,this):m(y)},u=(()=>{const m={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:o};return i(m),m})();(this.#e==="infinite"?Y2(this.options.pages):this.options.behavior)?.onFetch(u,this),this.#n=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==u.fetchOptions?.meta)&&this.#l({type:"fetch",meta:u.fetchOptions?.meta}),this.#a=jw({initialPromise:t?.initialPromise,fn:u.fetchFn,onCancel:m=>{m instanceof vm&&m.revert&&this.setState({...this.#n,fetchStatus:"idle"}),r.abort()},onFail:(m,p)=>{this.#l({type:"failed",failureCount:m,error:p})},onPause:()=>{this.#l({type:"pause"})},onContinue:()=>{this.#l({type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0});try{const m=await this.#a.start();if(m===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(m),this.#r.config.onSuccess?.(m,this),this.#r.config.onSettled?.(m,this.state.error,this),m}catch(m){if(m instanceof vm){if(m.silent)return this.#a.promise;if(m.revert){if(this.state.data===void 0)throw m;return this.state.data}}throw this.#l({type:"error",error:m}),this.#r.config.onError?.(m,this),this.#r.config.onSettled?.(this.state.data,m,this),m}finally{this.scheduleGc()}}#l(e){const t=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Aw(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...Cb(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?i:void 0,i;case"error":const o=e.error;return{...r,error:o,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),on.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function Aw(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Rw(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Cb(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Eb(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,i=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Mw=class extends vl{constructor(e,t){super(),this.options=t,this.#e=e,this.#s=null,this.#o=gm(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#u;#l;#m;#d;#f;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),Rb(this.#t,this.options)?this.#h():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return bm(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return bm(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,r=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof In(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#t.setOptions(this.options),t._defaulted&&!hm(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&jb(this.#t,r,this.options,t)&&this.#h(),this.updateResult(),i&&(this.#t!==r||In(this.options.enabled,this.#t)!==In(t.enabled,this.#t)||Ia(this.options.staleTime,this.#t)!==Ia(t.staleTime,this.#t))&&this.#g();const o=this.#v();i&&(this.#t!==r||In(this.options.enabled,this.#t)!==In(t.enabled,this.#t)||o!==this.#c)&&this.#y(o)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(t,e);return ej(this,r)&&(this.#r=r,this.#a=this.options,this.#i=this.#t.state),r}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(r,i)=>(this.trackProp(i),t?.(i),i==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#o.status==="pending"&&this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#h({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#h(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(On)),t}#g(){this.#x();const e=Ia(this.options.staleTime,this.#t);if(sl.isServer()||this.#r.isStale||!fm(e))return;const r=Sw(this.#r.dataUpdatedAt,e)+1;this.#d=Si.setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#c=e,!(sl.isServer()||In(this.options.enabled,this.#t)===!1||!fm(this.#c)||this.#c===0)&&(this.#f=Si.setInterval(()=>{(this.options.refetchIntervalInBackground||ip.isFocused())&&this.#h()},this.#c))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#d!==void 0&&(Si.clearTimeout(this.#d),this.#d=void 0)}#w(){this.#f!==void 0&&(Si.clearInterval(this.#f),this.#f=void 0)}createResult(e,t){const r=this.#t,i=this.options,o=this.#r,l=this.#i,u=this.#a,m=e!==r?e.state:this.#n,{state:p}=e;let y={...p},v=!1,b;if(t._optimisticResults){const I=this.hasListeners(),ne=!I&&Rb(e,t),ge=I&&jb(e,r,t,i);(ne||ge)&&(y={...y,...Aw(p.data,e.options)}),t._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:x,errorUpdatedAt:w,status:_}=y;b=y.data;let E=!1;if(t.placeholderData!==void 0&&b===void 0&&_==="pending"){let I;o?.isPlaceholderData&&t.placeholderData===u?.placeholderData?(I=o.data,E=!0):I=typeof t.placeholderData=="function"?t.placeholderData(this.#m?.state.data,this.#m):t.placeholderData,I!==void 0&&(_="success",b=pm(o?.data,I,t),v=!0)}if(t.select&&b!==void 0&&!E)if(o&&b===l?.data&&t.select===this.#u)b=this.#l;else try{this.#u=t.select,b=t.select(b),b=pm(o?.data,b,t),this.#l=b,this.#s=null}catch(I){this.#s=I}this.#s&&(x=this.#s,b=this.#l,w=Date.now(),_="error");const R=y.fetchStatus==="fetching",T=_==="pending",O=_==="error",N=T&&R,z=b!==void 0,H={status:_,fetchStatus:y.fetchStatus,isPending:T,isSuccess:_==="success",isError:O,isInitialLoading:N,isLoading:N,data:b,dataUpdatedAt:y.dataUpdatedAt,error:x,errorUpdatedAt:w,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:y.dataUpdateCount>m.dataUpdateCount||y.errorUpdateCount>m.errorUpdateCount,isFetching:R,isRefetching:R&&!T,isLoadingError:O&&!z,isPaused:y.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:O&&z,isStale:lp(e,t),refetch:this.refetch,promise:this.#o,isEnabled:In(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const I=H.data!==void 0,ne=H.status==="error"&&!I,ge=de=>{ne?de.reject(H.error):I&&de.resolve(H.data)},pe=()=>{const de=this.#o=H.promise=gm();ge(de)},he=this.#o;switch(he.status){case"pending":e.queryHash===r.queryHash&&ge(he);break;case"fulfilled":(ne||H.data!==he.value)&&pe();break;case"rejected":(!ne||H.error!==he.reason)&&pe();break}}return H}updateResult(){const e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#m=this.#t),hm(t,e))return;this.#r=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,o=typeof i=="function"?i():i;if(o==="all"||!o&&!this.#p.size)return!0;const l=new Set(o??this.#p);return this.options.throwOnError&&l.add("error"),Object.keys(this.#r).some(u=>{const d=u;return this.#r[d]!==e[d]&&l.has(d)})};this.#_({listeners:r()})}#S(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#_(e){on.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function W2(e,t){return In(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&In(t.retryOnMount,e)===!1)}function Rb(e,t){return W2(e,t)||e.state.data!==void 0&&bm(e,t,t.refetchOnMount)}function bm(e,t,r){if(In(t.enabled,e)!==!1&&Ia(t.staleTime,e)!=="static"){const i=typeof r=="function"?r(e):r;return i==="always"||i!==!1&&lp(e,t)}return!1}function jb(e,t,r,i){return(e!==t||In(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&lp(e,r)}function lp(e,t){return In(t.enabled,e)!==!1&&e.isStaleByTime(Ia(t.staleTime,e))}function ej(e,t){return!hm(e.getCurrentResult(),t)}var tj=class extends Mw{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){e._type="infinite",super.setOptions(e)}getOptimisticResult(e){return e._type="infinite",super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:r}=e,i=super.createResult(e,t),{isFetching:o,isRefetching:l,isError:u,isRefetchError:d}=i,m=r.fetchMeta?.fetchMore?.direction,p=u&&m==="forward",y=o&&m==="forward",v=u&&m==="backward",b=o&&m==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:Q2(t,r.data),hasPreviousPage:X2(t,r.data),isFetchNextPageError:p,isFetchingNextPage:y,isFetchPreviousPageError:v,isFetchingPreviousPage:b,isRefetchError:d&&!p&&!v,isRefetching:l&&!y&&!b}}},nj=class extends Tw{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||rj(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#i({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=jw({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(l,u)=>{this.#i({type:"failed",failureCount:l,error:u})},onPause:()=>{this.#i({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const i=this.state.status==="pending",o=!this.#r.canStart();try{if(i)t();else{this.#i({type:"pending",variables:e,isPaused:o}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,r);const u=await this.options.onMutate?.(e,r);u!==this.state.context&&this.#i({type:"pending",context:u,variables:e,isPaused:o})}const l=await this.#r.start();return await this.#n.config.onSuccess?.(l,e,this.state.context,this,r),await this.options.onSuccess?.(l,e,this.state.context,r),await this.#n.config.onSettled?.(l,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(l,null,e,this.state.context,r),this.#i({type:"success",data:l}),l}catch(l){try{await this.#n.config.onError?.(l,e,this.state.context,this,r)}catch(u){Promise.reject(u)}try{await this.options.onError?.(l,e,this.state.context,r)}catch(u){Promise.reject(u)}try{await this.#n.config.onSettled?.(void 0,l,this.state.variables,this.state.context,this,r)}catch(u){Promise.reject(u)}try{await this.options.onSettled?.(void 0,l,e,this.state.context,r)}catch(u){Promise.reject(u)}throw this.#i({type:"error",error:l}),l}finally{this.#n.runNext(this)}}#i(e){const t=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),on.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function rj(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var aj=class extends vl{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,r){const i=new nj({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:r});return this.add(i),i}add(e){this.#e.add(e);const t=Vc(e);if(typeof t=="string"){const r=this.#t.get(t);r?r.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Vc(e);if(typeof t=="string"){const r=this.#t.get(t);if(r)if(r.length>1){const i=r.indexOf(e);i!==-1&&r.splice(i,1)}else r[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Vc(e);if(typeof t=="string"){const i=this.#t.get(t)?.find(o=>o.state.status==="pending");return!i||i===e}else return!0}runNext(e){const t=Vc(e);return typeof t=="string"?this.#t.get(t)?.find(i=>i!==e&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){on.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(r=>wb(t,r))}findAll(e={}){return this.getAll().filter(t=>wb(e,t))}notify(e){on.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return on.batch(()=>Promise.all(e.map(t=>t.continue().catch(On))))}};function Vc(e){return e.options.scope?.id}var ij=class extends vl{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){const i=t.queryKey,o=t.queryHash??sp(i,t);let l=this.get(o);return l||(l=new J2({client:e,queryKey:i,queryHash:o,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(l)),l}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){on.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>xb(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>xb(e,r)):t}notify(e){on.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){on.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){on.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},sj=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new ij,this.#t=e.mutationCache||new aj,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=ip.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=hu.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#e.build(this,t),i=r.state.data;return i===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Ia(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(i))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:r})=>{const i=r.data;return[t,i]})}setQueryData(e,t,r){const i=this.defaultQueryOptions({queryKey:e}),l=this.#e.get(i.queryHash)?.state.data,u=P2(t,l);if(u!==void 0)return this.#e.build(this,i).setData(u,{...r,manual:!0})}setQueriesData(e,t,r){return on.batch(()=>this.#e.findAll(e).map(({queryKey:i})=>[i,this.setQueryData(i,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;on.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#e;return on.batch(()=>(r.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},i=on.batch(()=>this.#e.findAll(e).map(o=>o.cancel(r)));return Promise.all(i).then(On).catch(On)}invalidateQueries(e,t={}){return on.batch(()=>(this.#e.findAll(e).forEach(r=>{r.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const r={...t,cancelRefetch:t.cancelRefetch??!0},i=on.batch(()=>this.#e.findAll(e).filter(o=>!o.isDisabled()&&!o.isStatic()).map(o=>{let l=o.fetch(void 0,r);return r.throwOnError||(l=l.catch(On)),o.state.fetchStatus==="paused"?Promise.resolve():l}));return Promise.all(i).then(On)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#e.build(this,t);return r.isStaleByTime(Ia(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(On).catch(On)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(On).catch(On)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return hu.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(al(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],r={};return t.forEach(i=>{il(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,t){this.#i.set(al(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],r={};return t.forEach(i=>{il(e,i.mutationKey)&&Object.assign(r,i.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=sp(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.queryFn===op&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Nw=S.createContext(void 0),Di=e=>{const t=S.useContext(Nw);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},oj=({client:e,children:t})=>(S.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),f.jsx(Nw.Provider,{value:e,children:t})),Dw=S.createContext(!1),lj=()=>S.useContext(Dw);Dw.Provider;function cj(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var uj=S.createContext(cj()),dj=()=>S.useContext(uj),fj=(e,t,r)=>{const i=r?.state.error&&typeof e.throwOnError=="function"?Ew(e.throwOnError,[r.state.error,r]):e.throwOnError;(e.suspense||e.experimental_prefetchInRender||i)&&(t.isReset()||(e.retryOnMount=!1))},hj=e=>{S.useEffect(()=>{e.clearReset()},[e])},mj=({result:e,errorResetBoundary:t,throwOnError:r,query:i,suspense:o})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(o&&e.data===void 0||Ew(r,[e.error,i])),pj=e=>{if(e.suspense){const r=o=>o==="static"?o:Math.max(o??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...o)=>r(i(...o)):r(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},gj=(e,t)=>e.isLoading&&e.isFetching&&!t,vj=(e,t)=>e?.suspense&&t.isPending,Tb=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function kw(e,t,r){const i=lj(),o=dj(),l=Di(),u=l.defaultQueryOptions(e);l.getDefaultOptions().queries?._experimental_beforeQuery?.(u);const d=l.getQueryCache().get(u.queryHash),m=e.subscribed!==!1;u._optimisticResults=i?"isRestoring":m?"optimistic":void 0,pj(u),fj(u,o,d),hj(o);const p=!l.getQueryCache().get(u.queryHash),[y]=S.useState(()=>new t(l,u)),v=y.getOptimisticResult(u),b=!i&&m;if(S.useSyncExternalStore(S.useCallback(x=>{const w=b?y.subscribe(on.batchCalls(x)):On;return y.updateResult(),w},[y,b]),()=>y.getCurrentResult(),()=>y.getCurrentResult()),S.useEffect(()=>{y.setOptions(u)},[u,y]),vj(u,v))throw Tb(u,y,o);if(mj({result:v,errorResetBoundary:o,throwOnError:u.throwOnError,query:d,suspense:u.suspense}))throw v.error;return l.getDefaultOptions().queries?._experimental_afterQuery?.(u,v),u.experimental_prefetchInRender&&!sl.isServer()&&gj(v,i)&&(p?Tb(u,y,o):d?.promise)?.catch(On).finally(()=>{y.updateResult()}),u.notifyOnChangeProps?v:y.trackResult(v)}function Ft(e,t){return kw(e,Mw)}function yj(e,t){return kw(e,tj)}let Ob=!1;function bj(e){const t=e.analytics;if(!t?.key||Ob)return;Ob=!0;const r=document.createElement("script");r.src=t.host.replace(".i.posthog.com","-assets.i.posthog.com")+"/static/array.js",r.async=!0,r.onload=()=>{const i=window.posthog;i&&(i.init(t.key,{api_host:t.host,defaults:"2026-05-30",capture_pageview:"history_change",session_recording:{maskAllInputs:!0,maskTextSelector:"*"}}),e.me&&i.identify(e.me.email,{email:e.me.email,name:e.me.name,...e.billing?{plan:e.billing.plan}:{}}))},document.head.appendChild(r)}function zw(e,t){window.posthog?.capture(e,t)}const xj=[[/^POST \/api\/projects$/,"project_created"],[/^DELETE \/api\/projects\//,"project_deleted"],[/^POST \/api\/p\/[^/]+\/restore$/,"file_restored"],[/^DELETE \/api\/shares\//,"share_revoked"],[/^PATCH \/api\/shares\//,"share_expiry_changed"],[/^POST \/api\/orgs\/[^/]+\/invites$/,"invite_created"],[/^DELETE \/api\/orgs\/[^/]+\/invites\//,"invite_revoked"],[/^POST \/api\/invites\//,"invite_accepted"],[/^PUT \/api\/p\/[^/]+\/permissions\/./,"project_access_granted"],[/^DELETE \/api\/p\/[^/]+\/permissions\/./,"project_access_revoked"]];function Lw(e,t){const r=e+" "+t.split("?")[0],i=xj.find(([o])=>o.test(r));i&&zw(i[1])}function cp(){throw location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),new Error("signing in…")}function wj(e,t){const r=t.trim();switch(e){case 403:return r.includes("seat")?"This plan is out of seats. Upgrade to add more people.":r.includes("owner")?"Only owners can do that.":"You don't have access to that.";case 409:return r?r[0].toUpperCase()+r.slice(1):"That is managed outside this hub.";case 404:return"That is gone — it may have been removed already.";case 413:return"This project is over its plan limit.";case 429:return"Too many requests. Give it a moment.";default:return e>=500?"The server had a problem. Try again.":r?r[0].toUpperCase()+r.slice(1):"Something went wrong."}}async function Nu(e){throw new Error(wj(e.status,await e.text()))}async function qt(e){const t=await fetch(e,{headers:{Accept:"application/json"}});return t.status===401&&cp(),t.ok||await Nu(t),t.json()}async function Sj(e){const t=await fetch(e);return t.status===401&&cp(),t.ok||await Nu(t),t}async function Wn(e,t,r){const i={method:e};r!==void 0&&(i.headers={"Content-Type":"application/json"},i.body=JSON.stringify(r));const o=await fetch(t,i);return o.ok||await Nu(o),Lw(e,t),o.status===204?{}:o.json()}async function ea(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t||{})});return r.status===401&&cp(),r.ok||await Nu(r),Lw("POST",e),r.json()}function _j(){return Ft({queryKey:["config"],queryFn:async()=>{const e=await qt("/api/config");return e.auth.enabled&&!e.me&&(location.href="/auth/login?next="+encodeURIComponent(location.pathname+location.search),await new Promise(()=>{})),bj(e),e},staleTime:1/0})}var ki=ww();const Cj=xw(ki);function Ab(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Us(...e){return t=>{let r=!1;const i=e.map(o=>{const l=Ab(o,t);return!r&&typeof l=="function"&&(r=!0),l});if(r)return()=>{for(let o=0;o{let{children:o,...l}=r,u=null,d=!1;const m=[];Mb(o)&&typeof Uc=="function"&&(o=Uc(o._payload)),S.Children.forEach(o,b=>{if(Aj(b)){d=!0;const x=b;let w="child"in x.props?x.props.child:x.props.children;Mb(w)&&typeof Uc=="function"&&(w=Uc(w._payload)),u=jj(x,w),m.push(u?.props?.children)}else m.push(b)}),u?u=S.cloneElement(u,void 0,m):!d&&S.Children.count(o)===1&&S.isValidElement(o)&&(u=o);const p=u?Oj(u):void 0,y=at(i,p);if(!u){if(o||o===0)throw new Error(d?kj(e):Dj(e));return o}const v=Tj(l,u.props??{});return u.type!==S.Fragment&&(v.ref=i?y:p),S.cloneElement(u,v)});return t.displayName=`${e}.Slot`,t}var Ej=Ei("Slot"),$w=Symbol.for("radix.slottable");function Rj(e){const t=r=>"child"in r?r.children(r.child):r.children;return t.displayName=`${e}.Slottable`,t.__radixId=$w,t}var jj=(e,t)=>{if("child"in e.props){const r=e.props.child;return S.isValidElement(r)?S.cloneElement(r,void 0,e.props.children(r.props.children)):null}return S.isValidElement(t)?t:null};function Tj(e,t){const r={...t};for(const i in t){const o=e[i],l=t[i];/^on[A-Z]/.test(i)?o&&l?r[i]=(...d)=>{const m=l(...d);return o(...d),m}:o&&(r[i]=o):i==="style"?r[i]={...o,...l}:i==="className"&&(r[i]=[o,l].filter(Boolean).join(" "))}return{...e,...r}}function Oj(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}function Aj(e){return S.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===$w}var Mj=Symbol.for("react.lazy");function Mb(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Mj&&"_payload"in e&&Nj(e._payload)}function Nj(e){return typeof e=="object"&&e!==null&&"then"in e}var Dj=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,kj=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,Uc=Mu[" use ".trim().toString()],zj=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Pe=zj.reduce((e,t)=>{const r=Ei(`Primitive.${t}`),i=S.forwardRef((o,l)=>{const{asChild:u,...d}=o,m=u?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),f.jsx(m,{...d,ref:l})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function Iw(e,t){e&&ki.flushSync(()=>e.dispatchEvent(t))}var Pw=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Lj="VisuallyHidden",Fw=S.forwardRef((e,t)=>f.jsx(Pe.span,{...e,ref:t,style:{...Pw,...e.style}}));Fw.displayName=Lj;var $j=Fw;function Ka(e,t=[]){let r=[];function i(l,u){const d=S.createContext(u);d.displayName=l+"Context";const m=r.length;r=[...r,u];const p=v=>{const{scope:b,children:x,...w}=v,_=b?.[e]?.[m]||d,E=S.useMemo(()=>w,Object.values(w));return f.jsx(_.Provider,{value:E,children:x})};p.displayName=l+"Provider";function y(v,b,x={}){const{optional:w=!1}=x,_=b?.[e]?.[m]||d,E=S.useContext(_);if(E)return E;if(u!==void 0)return u;if(!w)throw new Error(`\`${v}\` must be used within \`${l}\``)}return[p,y]}const o=()=>{const l=r.map(u=>S.createContext(u));return function(d){const m=d?.[e]||l;return S.useMemo(()=>({[`__scope${e}`]:{...d,[e]:m}}),[d,m])}};return o.scopeName=e,[i,Ij(o,...t)]}function Ij(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const i=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(l){const u=i.reduce((d,{useScope:m,scopeName:p})=>{const v=m(l)[`__scope${p}`];return{...d,...v}},{});return S.useMemo(()=>({[`__scope${t.scopeName}`]:u}),[u])}};return r.scopeName=t.scopeName,r}function up(e){const t=e+"CollectionProvider",[r,i]=Ka(t),[o,l]=r(t,{collectionRef:{current:null},itemMap:new Map}),u=_=>{const{scope:E,children:R}=_,T=S.useRef(null),O=S.useRef(new Map).current;return f.jsx(o,{scope:E,itemMap:O,collectionRef:T,children:R})};u.displayName=t;const d=e+"CollectionSlot",m=Ei(d),p=S.forwardRef((_,E)=>{const{scope:R,children:T}=_,O=l(d,R),N=at(E,O.collectionRef);return f.jsx(m,{ref:N,children:T})});p.displayName=d;const y=e+"CollectionItemSlot",v="data-radix-collection-item",b=Ei(y),x=S.forwardRef((_,E)=>{const{scope:R,children:T,...O}=_,N=S.useRef(null),z=at(E,N),B=l(y,R);return S.useEffect(()=>(B.itemMap.set(N,{ref:N,...O}),()=>{B.itemMap.delete(N)})),f.jsx(b,{[v]:"",ref:z,children:T})});x.displayName=y;function w(_){const E=l(e+"CollectionConsumer",_);return S.useCallback(()=>{const T=E.collectionRef.current;if(!T)return[];const O=Array.from(T.querySelectorAll(`[${v}]`));return Array.from(E.itemMap.values()).sort((B,H)=>O.indexOf(B.ref.current)-O.indexOf(H.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:u,Slot:p,ItemSlot:x},w,i]}function Te(e,t,{checkForDefaultPrevented:r=!0}={}){return function(o){if(e?.(o),r===!1||!o||!o.defaultPrevented)return t?.(o)}}var Qt=globalThis?.document?S.useLayoutEffect:()=>{},Pj=Mu[" useInsertionEffect ".trim().toString()]||Qt;function Hs({prop:e,defaultProp:t,onChange:r=()=>{},caller:i}){const[o,l,u]=Fj({defaultProp:t,onChange:r}),d=e!==void 0,m=d?e:o;{const y=S.useRef(e!==void 0);S.useEffect(()=>{const v=y.current;v!==d&&console.warn(`${i} is changing from ${v?"controlled":"uncontrolled"} to ${d?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=d},[d,i])}const p=S.useCallback(y=>{if(d){const v=Vj(y)?y(e):y;v!==e&&u.current?.(v)}else l(y)},[d,e,l,u]);return[m,p]}function Fj({defaultProp:e,onChange:t}){const[r,i]=S.useState(e),o=S.useRef(r),l=S.useRef(t);return Pj(()=>{l.current=t},[t]),S.useEffect(()=>{o.current!==r&&(l.current?.(r),o.current=r)},[r,o]),[r,i,l]}function Vj(e){return typeof e=="function"}function Uj(e,t){return S.useReducer((r,i)=>t[r][i]??r,e)}var gr=e=>{const{present:t,children:r}=e,i=Hj(t),o=typeof r=="function"?r({present:i.isPresent}):S.Children.only(r),l=Bj(i.ref,qj(o));return typeof r=="function"||i.isPresent?S.cloneElement(o,{ref:l}):null};gr.displayName="Presence";function Hj(e){const[t,r]=S.useState(),i=S.useRef(null),o=S.useRef(e),l=S.useRef("none"),u=S.useRef(void 0),d=e?"mounted":"unmounted",[m,p]=Uj(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return S.useEffect(()=>{m==="mounted"?(l.current=u.current??Bo(i.current),u.current=void 0):l.current="none"},[m]),Qt(()=>{const y=i.current,v=o.current;if(v!==e){const x=l.current,w=Bo(y);e?(u.current=w,p("MOUNT")):w==="none"||y?.display==="none"?p("UNMOUNT"):p(v&&x!==w?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,p]),Qt(()=>{if(t){let y;const v=t.ownerDocument.defaultView??window,b=w=>{const E=Bo(i.current).includes(CSS.escape(w.animationName));if(w.target===t&&E&&(p("ANIMATION_END"),!o.current)){const R=t.style.animationFillMode;t.style.animationFillMode="forwards",y=v.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=R)})}},x=w=>{w.target===t&&(l.current=Bo(i.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",b),t.addEventListener("animationend",b),()=>{v.clearTimeout(y),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",b),t.removeEventListener("animationend",b)}}else p("ANIMATION_END")},[t,p]),{isPresent:["mounted","unmountSuspended"].includes(m),ref:S.useCallback(y=>{if(y){const v=getComputedStyle(y);i.current=v,u.current=Bo(v)}else i.current=null;r(y)},[])}}function Nb(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Bj(...e){const t=S.useRef(e);return t.current=e,S.useCallback(r=>{const i=t.current;let o=!1;const l=i.map(u=>{const d=Nb(u,r);return!o&&typeof d=="function"&&(o=!0),d});if(o)return()=>{for(let u=0;u{}),Zj=0;function fn(e){const[t,r]=S.useState(Gj());return Qt(()=>{r(i=>i??String(Zj++))},[e]),t?`radix-${t}`:""}var Kj=S.createContext(void 0);function dp(e){const t=S.useContext(Kj);return e||t||"ltr"}function tr(e){const t=S.useRef(e);return S.useEffect(()=>{t.current=e}),S.useMemo(()=>((...r)=>t.current?.(...r)),[])}var Yj="DismissableLayer",xm="dismissableLayer.update",Qj="dismissableLayer.pointerDownOutside",Xj="dismissableLayer.focusOutside",Db,fp=S.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),yl=S.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:i=!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,onDismiss:m,...p}=e,y=S.useContext(fp),[v,b]=S.useState(null),x=v?.ownerDocument??globalThis?.document,[,w]=S.useState({}),_=at(t,b),E=Array.from(y.layers),[R]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),T=R?E.indexOf(R):-1,O=v?E.indexOf(v):-1,N=y.layersWithOutsidePointerEventsDisabled.size>0,z=O>=T,B=S.useRef(!1),H=nT(pe=>{l?.(pe),d?.(pe),pe.defaultPrevented||m?.()},{ownerDocument:x,deferPointerDownOutside:i,isDeferredPointerDownOutsideRef:B,dismissableSurfaces:y.dismissableSurfaces,shouldHandlePointerDownOutside:S.useCallback(pe=>{if(!(pe instanceof Node))return!1;const he=[...y.branches].some(de=>de.contains(pe));return z&&!he},[y.branches,z])}),I=rT(pe=>{if(i&&B.current)return;const he=pe.target;[...y.branches].some(ee=>ee.contains(he))||(u?.(pe),d?.(pe),pe.defaultPrevented||m?.())},x),ne=v?O===E.length-1:!1,ge=tr(pe=>{pe.key==="Escape"&&(o?.(pe),!pe.defaultPrevented&&m&&(pe.preventDefault(),m()))});return S.useEffect(()=>{if(ne)return x.addEventListener("keydown",ge,{capture:!0}),()=>x.removeEventListener("keydown",ge,{capture:!0})},[x,ne,ge]),S.useEffect(()=>{if(v)return r&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(Db=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(v)),y.layers.add(v),kb(),()=>{r&&(y.layersWithOutsidePointerEventsDisabled.delete(v),y.layersWithOutsidePointerEventsDisabled.size===0&&(x.body.style.pointerEvents=Db))}},[v,x,r,y]),S.useEffect(()=>()=>{v&&(y.layers.delete(v),y.layersWithOutsidePointerEventsDisabled.delete(v),kb())},[v,y]),S.useEffect(()=>{const pe=()=>w({});return document.addEventListener(xm,pe),()=>document.removeEventListener(xm,pe)},[]),f.jsx(Pe.div,{...p,ref:_,style:{pointerEvents:N?z?"auto":"none":void 0,...e.style},onFocusCapture:Te(e.onFocusCapture,I.onFocusCapture),onBlurCapture:Te(e.onBlurCapture,I.onBlurCapture),onPointerDownCapture:Te(e.onPointerDownCapture,H.onPointerDownCapture)})});yl.displayName=Yj;var Jj="DismissableLayerBranch",Wj=S.forwardRef((e,t)=>{const r=S.useContext(fp),i=S.useRef(null),o=at(t,i);return S.useEffect(()=>{const l=i.current;if(l)return r.branches.add(l),()=>{r.branches.delete(l)}},[r.branches]),f.jsx(Pe.div,{...e,ref:o})});Wj.displayName=Jj;function eT(){const e=S.useContext(fp),[t,r]=S.useState(null);return S.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),r}var tT=()=>!0;function nT(e,t){const{ownerDocument:r=globalThis?.document,deferPointerDownOutside:i=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:l,shouldHandlePointerDownOutside:u=tT}=t,d=tr(e),m=S.useRef(!1),p=S.useRef(!1),y=S.useRef(new Map),v=S.useRef(()=>{});return S.useEffect(()=>{function b(){p.current=!1,o.current=!1,y.current.clear()}function x(){return Array.from(y.current.values()).some(Boolean)}function w(O){if(!p.current)return;const N=O.target;N instanceof Node&&[...l].some(B=>B.contains(N))||y.current.set(O.type,!0),O.type==="click"&&window.setTimeout(()=>{p.current&&v.current()},0)}function _(O){p.current&&y.current.set(O.type,!1)}const E=O=>{if(O.target&&!m.current){let N=function(){r.removeEventListener("click",v.current);const B=x();b(),B||Vw(Qj,d,z,{discrete:!0})};if(!u(O.target)){r.removeEventListener("click",v.current),b(),m.current=!1;return}const z={originalEvent:O};p.current=!0,o.current=i&&O.button===0,y.current.clear(),!i||O.button!==0?N():(r.removeEventListener("click",v.current),v.current=N,r.addEventListener("click",v.current,{once:!0}))}else r.removeEventListener("click",v.current),b();m.current=!1},R=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(const O of R)r.addEventListener(O,w,!0),r.addEventListener(O,_);const T=window.setTimeout(()=>{r.addEventListener("pointerdown",E)},0);return()=>{window.clearTimeout(T),r.removeEventListener("pointerdown",E),r.removeEventListener("click",v.current);for(const O of R)r.removeEventListener(O,w,!0),r.removeEventListener(O,_)}},[r,d,i,o,l,u]),{onPointerDownCapture:()=>m.current=!0}}function rT(e,t=globalThis?.document){const r=tr(e),i=S.useRef(!1);return S.useEffect(()=>{const o=l=>{l.target&&!i.current&&Vw(Xj,r,{originalEvent:l},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function kb(){const e=new CustomEvent(xm);document.dispatchEvent(e)}function Vw(e,t,r,{discrete:i}){const o=r.originalEvent.target,l=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&o.addEventListener(e,t,{once:!0}),i?Iw(o,l):o.dispatchEvent(l)}var Dh="focusScope.autoFocusOnMount",kh="focusScope.autoFocusOnUnmount",zb={bubbles:!1,cancelable:!0},aT="FocusScope",Du=S.forwardRef((e,t)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:o,onUnmountAutoFocus:l,...u}=e,[d,m]=S.useState(null),p=tr(o),y=tr(l),v=S.useRef(null),b=at(t,m),x=S.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;S.useEffect(()=>{if(i){let _=function(O){if(x.paused||!d)return;const N=O.target;d.contains(N)?v.current=N:ka(v.current,{select:!0})},E=function(O){if(x.paused||!d)return;const N=O.relatedTarget;N!==null&&(d.contains(N)||ka(v.current,{select:!0}))},R=function(O){if(document.activeElement===document.body)for(const z of O)z.removedNodes.length>0&&ka(d)};document.addEventListener("focusin",_),document.addEventListener("focusout",E);const T=new MutationObserver(R);return d&&T.observe(d,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",_),document.removeEventListener("focusout",E),T.disconnect()}}},[i,d,x.paused]),S.useEffect(()=>{if(d){$b.add(x);const _=document.activeElement;if(!d.contains(_)){const R=new CustomEvent(Dh,zb);d.addEventListener(Dh,p),d.dispatchEvent(R),R.defaultPrevented||(iT(uT(Uw(d)),{select:!0}),document.activeElement===_&&ka(d))}return()=>{d.removeEventListener(Dh,p),setTimeout(()=>{const R=new CustomEvent(kh,zb);d.addEventListener(kh,y),d.dispatchEvent(R),R.defaultPrevented||ka(_??document.body,{select:!0}),d.removeEventListener(kh,y),$b.remove(x)},0)}}},[d,p,y,x]);const w=S.useCallback(_=>{if(!r&&!i||x.paused)return;const E=_.key==="Tab"&&!_.altKey&&!_.ctrlKey&&!_.metaKey,R=document.activeElement;if(E&&R){const T=_.currentTarget,[O,N]=sT(T);O&&N?!_.shiftKey&&R===N?(_.preventDefault(),r&&ka(O,{select:!0})):_.shiftKey&&R===O&&(_.preventDefault(),r&&ka(N,{select:!0})):R===T&&_.preventDefault()}},[r,i,x.paused]);return f.jsx(Pe.div,{tabIndex:-1,...u,ref:b,onKeyDown:w})});Du.displayName=aT;function iT(e,{select:t=!1}={}){const r=document.activeElement;for(const i of e)if(ka(i,{select:t}),document.activeElement!==r)return}function sT(e){const t=Uw(e),r=Lb(t,e),i=Lb(t.reverse(),e);return[r,i]}function Uw(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const o=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||o?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Lb(e,t){const r=typeof t.checkVisibility=="function"&&t.checkVisibility({checkVisibilityCSS:!0});for(const i of e)if(!(r?!i.checkVisibility({checkVisibilityCSS:!0}):oT(i,{upTo:t})))return i}function oT(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 lT(e){return e instanceof HTMLInputElement&&"select"in e}function ka(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&lT(e)&&t&&e.select()}}var $b=cT();function cT(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Ib(e,t),e.unshift(t)},remove(t){e=Ib(e,t),e[0]?.resume()}}}function Ib(e,t){const r=[...e],i=r.indexOf(t);return i!==-1&&r.splice(i,1),r}function uT(e){return e.filter(t=>t.tagName!=="A")}var dT="Portal",bl=S.forwardRef((e,t)=>{const{container:r,...i}=e,[o,l]=S.useState(!1);Qt(()=>l(!0),[]);const u=r||o&&globalThis?.document?.body;return u?ki.createPortal(f.jsx(Pe.div,{...i,ref:t}),u):null});bl.displayName=dT;var Hc=0,Es=null;function hp(){S.useEffect(()=>{Es||(Es={start:Pb(),end:Pb()});const{start:e,end:t}=Es;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement("afterbegin",e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement("beforeend",t),Hc++,()=>{Hc===1&&(Es?.start.remove(),Es?.end.remove(),Es=null),Hc=Math.max(0,Hc-1)}},[])}function Pb(){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 Tr=function(){return Tr=Object.assign||function(t){for(var r,i=1,o=arguments.length;i"u")return TT;var t=OT(e),r=document.documentElement.clientWidth,i=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,i-r+t[2]-t[0])}},MT=Gw(),$s="data-scroll-locked",NT=function(e,t,r,i){var o=e.left,l=e.top,u=e.right,d=e.gap;return r===void 0&&(r="margin"),` .`.concat(hT,` { overflow: hidden `).concat(i,`; padding-right: `).concat(d,"px ").concat(i,`; @@ -46,51 +46,51 @@ Error generating stack: `+c.message+` `)},Vb=function(){var e=parseInt(document.body.getAttribute($s)||"0",10);return isFinite(e)?e:0},DT=function(){S.useEffect(function(){return document.body.setAttribute($s,(Vb()+1).toString()),function(){var e=Vb()-1;e<=0?document.body.removeAttribute($s):document.body.setAttribute($s,e.toString())}},[])},kT=function(e){var t=e.noRelative,r=e.noImportant,i=e.gapMode,o=i===void 0?"margin":i;DT();var l=S.useMemo(function(){return AT(o)},[o]);return S.createElement(MT,{styles:NT(l,!t,o,r?"":"!important")})},wm=!1;if(typeof window<"u")try{var Bc=Object.defineProperty({},"passive",{get:function(){return wm=!0,!0}});window.addEventListener("test",Bc,Bc),window.removeEventListener("test",Bc,Bc)}catch{wm=!1}var Rs=wm?{passive:!1}:!1,zT=function(e){return e.tagName==="TEXTAREA"},Zw=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!zT(e)&&r[t]==="visible")},LT=function(e){return Zw(e,"overflowY")},$T=function(e){return Zw(e,"overflowX")},Ub=function(e,t){var r=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var o=Kw(e,i);if(o){var l=Yw(e,i),u=l[1],d=l[2];if(u>d)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},IT=function(e){var t=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[t,r,i]},PT=function(e){var t=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[t,r,i]},Kw=function(e,t){return e==="v"?LT(t):$T(t)},Yw=function(e,t){return e==="v"?IT(t):PT(t)},FT=function(e,t){return e==="h"&&t==="rtl"?-1:1},VT=function(e,t,r,i,o){var l=FT(e,window.getComputedStyle(t).direction),u=l*i,d=r.target,m=t.contains(d),p=!1,y=u>0,v=0,b=0;do{if(!d)break;var x=Yw(e,d),w=x[0],_=x[1],E=x[2],R=_-E-l*w;(w||R)&&Kw(e,d)&&(v+=R,b+=w);var T=d.parentNode;d=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!m&&d!==document.body||m&&(t.contains(d)||t===d));return(y&&Math.abs(v)<1||!y&&Math.abs(b)<1)&&(p=!0),p},qc=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Hb=function(e){return[e.deltaX,e.deltaY]},Bb=function(e){return e&&"current"in e?e.current:e},UT=function(e,t){return e[0]===t[0]&&e[1]===t[1]},HT=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} -`)},BT=0,js=[];function qT(e){var t=S.useRef([]),r=S.useRef([0,0]),i=S.useRef(),o=S.useState(BT++)[0],l=S.useState(Gw)[0],u=S.useRef(e);S.useEffect(function(){u.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var _=fT([e.lockRef.current],(e.shards||[]).map(Bb),!0).filter(Boolean);return _.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),_.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var d=S.useCallback(function(_,E){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!u.current.allowPinchZoom;var R=qc(_),T=r.current,O="deltaX"in _?_.deltaX:T[0]-R[0],N="deltaY"in _?_.deltaY:T[1]-R[1],k,B=_.target,H=Math.abs(O)>Math.abs(N)?"h":"v";if("touches"in _&&H==="h"&&B.type==="range")return!1;var $=window.getSelection(),he=$&&$.anchorNode,be=he?he===B||he.contains(B):!1;if(be)return!1;var pe=Ub(H,B);if(!pe)return!0;if(pe?k=H:(k=H==="v"?"h":"v",pe=Ub(H,B)),!pe)return!1;if(!i.current&&"changedTouches"in _&&(O||N)&&(i.current=k),!k)return!0;var fe=i.current||k;return VT(fe,E,_,fe==="h"?O:N)},[]),m=S.useCallback(function(_){var E=_;if(!(!js.length||js[js.length-1]!==l)){var R="deltaY"in E?Hb(E):qc(E),T=t.current.filter(function(k){return k.name===E.type&&(k.target===E.target||E.target===k.shadowParent)&&UT(k.delta,R)})[0];if(T&&T.should){E.cancelable&&E.preventDefault();return}if(!T){var O=(u.current.shards||[]).map(Bb).filter(Boolean).filter(function(k){return k.contains(E.target)}),N=O.length>0?d(E,O[0]):!u.current.noIsolation;N&&E.cancelable&&E.preventDefault()}}},[]),p=S.useCallback(function(_,E,R,T){var O={name:_,delta:E,target:R,should:T,shadowParent:GT(R)};t.current.push(O),setTimeout(function(){t.current=t.current.filter(function(N){return N!==O})},1)},[]),y=S.useCallback(function(_){r.current=qc(_),i.current=void 0},[]),v=S.useCallback(function(_){p(_.type,Hb(_),_.target,d(_,e.lockRef.current))},[]),b=S.useCallback(function(_){p(_.type,qc(_),_.target,d(_,e.lockRef.current))},[]);S.useEffect(function(){return js.push(l),e.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:b}),document.addEventListener("wheel",m,Rs),document.addEventListener("touchmove",m,Rs),document.addEventListener("touchstart",y,Rs),function(){js=js.filter(function(_){return _!==l}),document.removeEventListener("wheel",m,Rs),document.removeEventListener("touchmove",m,Rs),document.removeEventListener("touchstart",y,Rs)}},[]);var x=e.removeScrollBar,w=e.inert;return S.createElement(S.Fragment,null,w?S.createElement(l,{styles:HT(o)}):null,x?S.createElement(kT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function GT(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ZT=wT(qw,qT);var zu=S.forwardRef(function(e,t){return S.createElement(ku,Tr({},e,{ref:t,sideCar:ZT}))});zu.classNames=ku.classNames;var KT=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ts=new WeakMap,Gc=new WeakMap,Zc={},Ih=0,Qw=function(e){return e&&(e.host||Qw(e.parentNode))},YT=function(e,t){return t.map(function(r){if(e.contains(r))return r;var i=Qw(r);return i&&e.contains(i)?i:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},QT=function(e,t,r,i){var o=YT(t,Array.isArray(e)?e:[e]);Zc[r]||(Zc[r]=new WeakMap);var l=Zc[r],u=[],d=new Set,m=new Set(o),p=function(v){!v||d.has(v)||(d.add(v),p(v.parentNode))};o.forEach(p);var y=function(v){!v||m.has(v)||Array.prototype.forEach.call(v.children,function(b){if(d.has(b))y(b);else try{var x=b.getAttribute(i),w=x!==null&&x!=="false",_=(Ts.get(b)||0)+1,E=(l.get(b)||0)+1;Ts.set(b,_),l.set(b,E),u.push(b),_===1&&w&&Gc.set(b,!0),E===1&&b.setAttribute(r,"true"),w||b.setAttribute(i,"true")}catch(R){console.error("aria-hidden: cannot operate on ",b,R)}})};return y(t),d.clear(),Ih++,function(){u.forEach(function(v){var b=Ts.get(v)-1,x=l.get(v)-1;Ts.set(v,b),l.set(v,x),b||(Gc.has(v)||v.removeAttribute(i),Gc.delete(v)),x||v.removeAttribute(r)}),Ih--,Ih||(Ts=new WeakMap,Ts=new WeakMap,Gc=new WeakMap,Zc={})}},mp=function(e,t,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),o=KT(e);return o?(i.push.apply(i,Array.from(o.querySelectorAll("[aria-live], script"))),QT(i,o,r,"aria-hidden")):function(){return null}},Lu="Dialog",[Xw]=Ka(Lu),[XT,vr]=Xw(Lu),pp=e=>{const{__scopeDialog:t,children:r,open:i,defaultOpen:o,onOpenChange:l,modal:u=!0}=e,d=S.useRef(null),m=S.useRef(null),[p,y]=Hs({prop:i,defaultProp:o??!1,onChange:l,caller:Lu});return f.jsx(XT,{scope:t,triggerRef:d,contentRef:m,contentId:fn(),titleId:fn(),descriptionId:fn(),open:p,onOpenChange:y,onOpenToggle:S.useCallback(()=>y(v=>!v),[y]),modal:u,children:r})};pp.displayName=Lu;var Jw="DialogTrigger",JT=S.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,o=vr(Jw,r),l=at(t,o.triggerRef);return f.jsx(Pe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":xp(o.open),...i,ref:l,onClick:Te(e.onClick,o.onOpenToggle)})});JT.displayName=Jw;var gp="DialogPortal",[WT,Ww]=Xw(gp,{forceMount:void 0}),vp=e=>{const{__scopeDialog:t,forceMount:r,children:i,container:o}=e,l=vr(gp,t);return f.jsx(WT,{scope:t,forceMount:r,children:S.Children.map(i,u=>f.jsx(gr,{present:r||l.open,children:f.jsx(bl,{asChild:!0,container:o,children:u})}))})};vp.displayName=gp;var mu="DialogOverlay",yp=S.forwardRef((e,t)=>{const r=Ww(mu,e.__scopeDialog),{forceMount:i=r.forceMount,...o}=e,l=vr(mu,e.__scopeDialog);return l.modal?f.jsx(gr,{present:i||l.open,children:f.jsx(tO,{...o,ref:t})}):null});yp.displayName=mu;var eO=Ei("DialogOverlay.RemoveScroll"),tO=S.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,o=vr(mu,r),l=eT(),u=at(t,l);return f.jsx(zu,{as:eO,allowPinchZoom:!0,shards:[o.contentRef],children:f.jsx(Pe.div,{"data-state":xp(o.open),...i,ref:u,style:{pointerEvents:"auto",...i.style}})})}),Bs="DialogContent",bp=S.forwardRef((e,t)=>{const r=Ww(Bs,e.__scopeDialog),{forceMount:i=r.forceMount,...o}=e,l=vr(Bs,e.__scopeDialog);return f.jsx(gr,{present:i||l.open,children:l.modal?f.jsx(nO,{...o,ref:t}):f.jsx(rO,{...o,ref:t})})});bp.displayName=Bs;var nO=S.forwardRef((e,t)=>{const r=vr(Bs,e.__scopeDialog),i=S.useRef(null),o=at(t,r.contentRef,i);return S.useEffect(()=>{const l=i.current;if(l)return mp(l)},[]),f.jsx(eS,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Te(e.onCloseAutoFocus,l=>{l.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Te(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:Te(e.onFocusOutside,l=>l.preventDefault())})}),rO=S.forwardRef((e,t)=>{const r=vr(Bs,e.__scopeDialog),i=S.useRef(!1),o=S.useRef(!1);return f.jsx(eS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(i.current||r.triggerRef.current?.focus(),l.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(i.current=!0,l.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=l.target;r.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&o.current&&l.preventDefault()}})}),eS=S.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:l,...u}=e,d=vr(Bs,r);return hp(),f.jsx(f.Fragment,{children:f.jsx(Du,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:l,children:f.jsx(yl,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":xp(d.open),...u,ref:t,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),tS="DialogTitle",nS=S.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,o=vr(tS,r);return f.jsx(Pe.h2,{id:o.titleId,...i,ref:t})});nS.displayName=tS;var rS="DialogDescription",aO=S.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,o=vr(rS,r);return f.jsx(Pe.p,{id:o.descriptionId,...i,ref:t})});aO.displayName=rS;var aS="DialogClose",iS=S.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,o=vr(aS,r);return f.jsx(Pe.button,{type:"button",...i,ref:t,onClick:Te(e.onClick,()=>o.onOpenChange(!1))})});iS.displayName=aS;function xp(e){return e?"open":"closed"}function iO(e){const t=S.useRef({value:e,previous:e});return S.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function sO(e){const[t,r]=S.useState(void 0);return Qt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const l=o[0];let u,d;if("borderBoxSize"in l){const m=l.borderBoxSize,p=Array.isArray(m)?m[0]:m;u=p.inlineSize,d=p.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else r(void 0)},[e]),t}const oO=["top","right","bottom","left"],Ha=Math.min,ra=Math.max,pu=Math.round,Kc=Math.floor,aa=e=>({x:e,y:e}),lO={left:"right",right:"left",bottom:"top",top:"bottom"};function sS(e,t,r){return ra(e,Ha(t,r))}function ia(e,t){return typeof e=="function"?e(t):e}function Ba(e){return e.split("-")[0]}function Ks(e){return e.split("-")[1]}function wp(e){return e==="x"?"y":"x"}function Sp(e){return e==="y"?"height":"width"}function Or(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function _p(e){return wp(Or(e))}function cO(e,t,r){r===void 0&&(r=!1);const i=Ks(e),o=_p(e),l=Sp(o);let u=o==="x"?i===(r?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=gu(u)),[u,gu(u)]}function uO(e){const t=gu(e);return[Sm(e),t,Sm(t)]}function Sm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const qb=["left","right"],Gb=["right","left"],dO=["top","bottom"],fO=["bottom","top"];function hO(e,t,r){switch(e){case"top":case"bottom":return r?t?Gb:qb:t?qb:Gb;case"left":case"right":return t?dO:fO;default:return[]}}function mO(e,t,r,i){const o=Ks(e);let l=hO(Ba(e),r==="start",i);return o&&(l=l.map(u=>u+"-"+o),t&&(l=l.concat(l.map(Sm)))),l}function gu(e){const t=Ba(e);return lO[t]+e.slice(t.length)}function pO(e){var t,r,i,o;return{top:(t=e.top)!=null?t:0,right:(r=e.right)!=null?r:0,bottom:(i=e.bottom)!=null?i:0,left:(o=e.left)!=null?o:0}}function oS(e){return typeof e!="number"?pO(e):{top:e,right:e,bottom:e,left:e}}function vu(e){const{x:t,y:r,width:i,height:o}=e;return{width:i,height:o,top:r,left:t,right:t+i,bottom:r+o,x:t,y:r}}function Zb(e,t,r){let{reference:i,floating:o}=e;const l=Or(t),u=_p(t),d=Sp(u),m=Ba(t),p=l==="y",y=i.x+i.width/2-o.width/2,v=i.y+i.height/2-o.height/2,b=i[d]/2-o[d]/2;let x;switch(m){case"top":x={x:y,y:i.y-o.height};break;case"bottom":x={x:y,y:i.y+i.height};break;case"right":x={x:i.x+i.width,y:v};break;case"left":x={x:i.x-o.width,y:v};break;default:x={x:i.x,y:i.y}}const w=Ks(t);return w&&(x[u]+=b*(w==="end"?1:-1)*(r&&p?-1:1)),x}async function gO(e,t){var r;t===void 0&&(t={});const{x:i,y:o,platform:l,rects:u,elements:d,strategy:m}=e,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:b=!1,padding:x=0}=ia(t,e),w=oS(x),E=d[b?v==="floating"?"reference":"floating":v],R=vu(await l.getClippingRect({element:(r=await(l.isElement==null?void 0:l.isElement(E)))==null||r?E:E.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:p,rootBoundary:y,strategy:m})),T=v==="floating"?{x:i,y:o,width:u.floating.width,height:u.floating.height}:u.reference,O=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),N=await(l.isElement==null?void 0:l.isElement(O))&&await(l.getScale==null?void 0:l.getScale(O))||{x:1,y:1},k=vu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:T,offsetParent:O,strategy:m}):T);return{top:(R.top-k.top+w.top)/N.y,bottom:(k.bottom-R.bottom+w.bottom)/N.y,left:(R.left-k.left+w.left)/N.x,right:(k.right-R.right+w.right)/N.x}}const vO=50,yO=async(e,t,r)=>{const{placement:i="bottom",strategy:o="absolute",middleware:l=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:gO},m=await(u.isRTL==null?void 0:u.isRTL(t));let p=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:y,y:v}=Zb(p,i,m),b=i,x=0;const w={};for(let _=0;_({name:"arrow",options:e,async fn(t){const{x:r,y:i,placement:o,rects:l,platform:u,elements:d,middlewareData:m}=t,{element:p,padding:y=0}=ia(e,t)||{};if(p==null)return{};const v=oS(y),b={x:r,y:i},x=_p(o),w=Sp(x),_=await u.getDimensions(p),E=x==="y",R=E?"top":"left",T=E?"bottom":"right",O=E?"clientHeight":"clientWidth",N=l.reference[w]+l.reference[x]-b[x]-l.floating[w],k=b[x]-l.reference[x],B=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p));let H=B?B[O]:0;(!H||!await(u.isElement==null?void 0:u.isElement(B)))&&(H=d.floating[O]||l.floating[w]);const $=N/2-k/2,he=H/2-_[w]/2-1,be=Ha(v[R],he),pe=Ha(v[T],he),fe=H-_[w]-pe,ue=H/2-_[w]/2+$,ee=sS(be,ue,fe),ve=!m.arrow&&Ks(o)!=null&&ue!==ee&&l.reference[w]/2-(ueee<=0)){var pe,fe;const ee=(((pe=l.flip)==null?void 0:pe.index)||0)+1,ve=H[ee];if(ve&&(!(v==="alignment"?T!==Or(ve):!1)||be.every(ne=>Or(ne.placement)===T?ne.overflows[0]>0:!0)))return{data:{index:ee,overflows:be},reset:{placement:ve}};let L=(fe=be.filter(Z=>Z.overflows[0]<=0).sort((Z,ne)=>Z.overflows[1]-ne.overflows[1])[0])==null?void 0:fe.placement;if(!L)switch(x){case"bestFit":{var ue;const Z=(ue=be.filter(ne=>{if(B){const X=Or(ne.placement);return X===T||X==="y"}return!0}).map(ne=>[ne.placement,ne.overflows.filter(X=>X>0).reduce((X,te)=>X+te,0)]).sort((ne,X)=>ne[1]-X[1])[0])==null?void 0:ue[0];Z&&(L=Z);break}case"initialPlacement":L=d;break}if(o!==L)return{reset:{placement:L}}}return{}}}};function Kb(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Yb(e){return oO.some(t=>e[t]>=0)}const wO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:i}=t,{strategy:o="referenceHidden",...l}=ia(e,t);switch(o){case"referenceHidden":{const u=await i.detectOverflow(t,{...l,elementContext:"reference"}),d=Kb(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:Yb(d)}}}case"escaped":{const u=await i.detectOverflow(t,{...l,altBoundary:!0}),d=Kb(u,r.floating);return{data:{escapedOffsets:d,escaped:Yb(d)}}}default:return{}}}}},lS=new Set(["left","top"]);async function SO(e,t){const{placement:r,platform:i,elements:o}=e,l=await(i.isRTL==null?void 0:i.isRTL(o.floating)),u=Ba(r),d=Ks(r),m=Or(r)==="y",p=lS.has(u)?-1:1,y=l&&m?-1:1,v=ia(t,e);let{mainAxis:b,crossAxis:x,alignmentAxis:w}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return d&&typeof w=="number"&&(x=d==="end"?w*-1:w),m?{x:x*y,y:b*p}:{x:b*p,y:x*y}}const _O=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,i;const{x:o,y:l,placement:u,middlewareData:d}=t,m=await SO(t,e);return u===((r=d.offset)==null?void 0:r.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:o+m.x,y:l+m.y,data:{...m,placement:u}}}}},CO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:i,placement:o,platform:l}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:m={fn:T=>{let{x:O,y:N}=T;return{x:O,y:N}}},...p}=ia(e,t),y={x:r,y:i},v=await l.detectOverflow(t,p),b=Or(o),x=wp(b);let w=y[x],_=y[b];const E=(T,O)=>sS(O+v[T==="y"?"top":"left"],O,O-v[T==="y"?"bottom":"right"]);u&&(w=E(x,w)),d&&(_=E(b,_));const R=m.fn({...t,[x]:w,[b]:_});return{...R,data:{x:R.x-r,y:R.y-i,enabled:{[x]:u,[b]:d}}}}}},EO=function(e){return e===void 0&&(e={}),{options:e,fn(t){var r,i;const{x:o,y:l,placement:u,rects:d,middlewareData:m}=t,{offset:p=0,mainAxis:y=!0,crossAxis:v=!0}=ia(e,t),b={x:o,y:l},x=Or(u),w=wp(x);let _=b[w],E=b[x];const R=ia(p,t),T=typeof R=="number"?{mainAxis:R,crossAxis:0}:{mainAxis:(r=R.mainAxis)!=null?r:0,crossAxis:(i=R.crossAxis)!=null?i:0};if(y){const k=w==="y"?"height":"width",B=d.reference[w]-d.floating[k]+T.mainAxis,H=d.reference[w]+d.reference[k]-T.mainAxis;_H&&(_=H)}if(v){var O,N;const k=w==="y"?"width":"height",B=lS.has(Ba(u)),H=d.reference[x]-d.floating[k]+(B&&((O=m.offset)==null?void 0:O[x])||0)+(B?0:T.crossAxis),$=d.reference[x]+d.reference[k]+(B?0:((N=m.offset)==null?void 0:N[x])||0)-(B?T.crossAxis:0);E$&&(E=$)}return{[w]:_,[x]:E}}}},RO=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:i,platform:o,elements:l}=t,{apply:u=()=>{},...d}=ia(e,t),m=await o.detectOverflow(t,d),p=Ba(r),y=Ks(r),v=Or(r)==="y",{width:b,height:x}=i.floating;let w,_;p==="top"||p==="bottom"?(w=p,_=y===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(_=p,w=y==="end"?"top":"bottom");const E=x-m.top-m.bottom,R=b-m.left-m.right,T=Ha(x-m[w],E),O=Ha(b-m[_],R),N=t.middlewareData.shift,k=!N;let B=T,H=O;N!=null&&N.enabled.x&&(H=R),N!=null&&N.enabled.y&&(B=E),k&&!y&&(v?H=b-2*ra(m.left,m.right):B=x-2*ra(m.top,m.bottom)),await u({...t,availableWidth:H,availableHeight:B});const $=await o.getDimensions(l.floating);return b!==$.width||x!==$.height?{reset:{rects:!0}}:{}}}};function $u(){return typeof window<"u"}function Ys(e){return cS(e)?(e.nodeName||"").toLowerCase():"#document"}function An(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function sa(e){var t;return(t=(cS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function cS(e){return $u()?e instanceof Node||e instanceof An(e).Node:!1}function Ar(e){return $u()?e instanceof Element||e instanceof An(e).Element:!1}function Ya(e){return $u()?e instanceof HTMLElement||e instanceof An(e).HTMLElement:!1}function Qb(e){return!$u()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof An(e).ShadowRoot}function Iu(e){const{overflow:t,overflowX:r,overflowY:i,display:o}=Mr(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+r)&&o!=="inline"&&o!=="contents"}function jO(e){return/^(table|td|th)$/.test(Ys(e))}function Pu(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const TO=/transform|translate|scale|rotate|perspective|filter/,OO=/paint|layout|strict|content/,bi=e=>!!e&&e!=="none";let Ph;function Cp(e){const t=Ar(e)?Mr(e):e;return bi(t.transform)||bi(t.translate)||bi(t.scale)||bi(t.rotate)||bi(t.perspective)||!Ep()&&(bi(t.backdropFilter)||bi(t.filter))||TO.test(t.willChange||"")||OO.test(t.contain||"")}function AO(e){let t=Ri(e);for(;Ya(t)&&!ol(t);){if(Cp(t))return t;if(Pu(t))return null;t=Ri(t)}return null}function Ep(){return Ph==null&&(Ph=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ph}function ol(e){return/^(html|body|#document)$/.test(Ys(e))}function Mr(e){return An(e).getComputedStyle(e)}function Fu(e){return Ar(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ri(e){if(Ys(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Qb(e)&&e.host||sa(e);return Qb(t)?t.host:t}function uS(e){const t=Ri(e);return ol(t)?(e.ownerDocument||e).body:Ya(t)&&Iu(t)?t:uS(t)}function ll(e,t,r){var i;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=uS(e),l=o===((i=e.ownerDocument)==null?void 0:i.body),u=An(o);if(l){const d=_m(u);return t.concat(u,u.visualViewport||[],Iu(o)?o:[],d&&r?ll(d):[])}else return t.concat(o,ll(o,[],r))}function _m(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dS(e){const t=Mr(e);let r=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const o=Ya(e),l=o?e.offsetWidth:r,u=o?e.offsetHeight:i,d=pu(r)!==l||pu(i)!==u;return d&&(r=l,i=u),{width:r,height:i,$:d}}function Rp(e){return Ar(e)?e:e.contextElement}function Is(e){const t=Rp(e);if(!Ya(t))return aa(1);const r=t.getBoundingClientRect(),{width:i,height:o,$:l}=dS(t);let u=(l?pu(r.width):r.width)/i,d=(l?pu(r.height):r.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const MO=aa(0);function fS(e){const t=An(e);return!Ep()||!t.visualViewport?MO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function NO(e,t,r){return t===void 0&&(t=!1),!!r&&t&&r===An(e)}function ji(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),l=Rp(e);let u=aa(1);t&&(i?Ar(i)&&(u=Is(i)):u=Is(e));const d=NO(l,r,i)?fS(l):aa(0);let m=(o.left+d.x)/u.x,p=(o.top+d.y)/u.y,y=o.width/u.x,v=o.height/u.y;if(l&&i){const b=An(l),x=Ar(i)?An(i):i;let w=b,_=_m(w);for(;_&&x!==w;){const E=Is(_),R=_.getBoundingClientRect(),T=Mr(_),O=R.left+(_.clientLeft+parseFloat(T.paddingLeft))*E.x,N=R.top+(_.clientTop+parseFloat(T.paddingTop))*E.y;m*=E.x,p*=E.y,y*=E.x,v*=E.y,m+=O,p+=N,w=An(_),_=_m(w)}}return vu({width:y,height:v,x:m,y:p})}function Vu(e,t){const r=Fu(e).scrollLeft;return t?t.left+r:ji(sa(e)).left+r}function hS(e,t){const r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-Vu(e,r),o=r.top+t.scrollTop;return{x:i,y:o}}function DO(e){let{elements:t,rect:r,offsetParent:i,strategy:o}=e;const l=o==="fixed",u=sa(i),d=t?Pu(t.floating):!1;if(i===u||d&&l)return r;let m={scrollLeft:0,scrollTop:0},p=aa(1);const y=aa(0),v=Ya(i);if((v||!l)&&((Ys(i)!=="body"||Iu(u))&&(m=Fu(i)),v)){const x=ji(i);p=Is(i),y.x=x.x+i.clientLeft,y.y=x.y+i.clientTop}const b=u&&!v&&!l?hS(u,m):aa(0);return{width:r.width*p.x,height:r.height*p.y,x:r.x*p.x-m.scrollLeft*p.x+y.x+b.x,y:r.y*p.y-m.scrollTop*p.y+y.y+b.y}}function kO(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function zO(e){const t=Fu(e),r=e.ownerDocument.body,i=ra(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=ra(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-t.scrollLeft+Vu(e);const u=-t.scrollTop;return Mr(r).direction==="rtl"&&(l+=ra(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:l,y:u}}const LO=25;function $O(e,t,r){r===void 0&&(r="viewport");const i=r==="layoutViewport",o=An(e),l=sa(e),u=o.visualViewport;let d=l.clientWidth,m=l.clientHeight,p=0,y=0;if(u){const b=!Ep()||t==="fixed";i?b||(p=-u.offsetLeft,y=-u.offsetTop):(d=u.width,m=u.height,b&&(p=u.offsetLeft,y=u.offsetTop))}if(Vu(l)<=0){const b=l.ownerDocument,x=b.body,w=getComputedStyle(x),_=b.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,E=Math.abs(l.clientWidth-x.clientWidth-_),R=getComputedStyle(l).scrollbarGutter==="stable both-edges"?E/2:E;R<=LO&&(d-=R)}return{width:d,height:m,x:p,y}}function IO(e,t){const r=ji(e,!0,t==="fixed"),i=r.top+e.clientTop,o=r.left+e.clientLeft,l=Is(e),u=e.clientWidth*l.x,d=e.clientHeight*l.y,m=o*l.x,p=i*l.y;return{width:u,height:d,x:m,y:p}}function Xb(e,t,r){let i;if(t==="viewport"||t==="layoutViewport")i=$O(e,r,t);else if(t==="document")i=zO(sa(e));else if(Ar(t))i=IO(t,r);else{const o=fS(e);i={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return vu(i)}function PO(e,t){const r=t.get(e);if(r)return r;let i=ll(e,[],!1).filter(d=>Ar(d)&&Ys(d)!=="body"),o=null;const l=Mr(e).position==="fixed";let u=l?Ri(e):e;for(;Ar(u)&&!ol(u);){const d=Mr(u),m=Cp(u),p=o?o.position:l?"fixed":"";!m&&(p==="fixed"||p==="absolute"&&d.position==="static")?i=i.filter(v=>v!==u):o=d,u=Ri(u)}return t.set(e,i),i}function FO(e){let{element:t,boundary:r,rootBoundary:i,strategy:o}=e;const u=[...r==="clippingAncestors"?Pu(t)?[]:PO(t,this._c):[].concat(r),i],d=Xb(t,u[0],o);let m=d.top,p=d.right,y=d.bottom,v=d.left;for(let b=1;b{d(!1,1e-7)},1e3)}H=!1}try{i=new IntersectionObserver($,{...B,root:l.ownerDocument})}catch{i=new IntersectionObserver($,B)}i.observe(e)}const m=An(e),p=()=>d(r);return m.addEventListener("resize",p),d(!0),()=>{m.removeEventListener("resize",p),u()}}function ZO(e,t,r,i){i===void 0&&(i={});const{ancestorScroll:o=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=i,p=Rp(e),y=o||l?[...p?ll(p):[],...t?ll(t):[]]:[];y.forEach(R=>{o&&R.addEventListener("scroll",r),l&&R.addEventListener("resize",r)});const v=p&&d?GO(p,r,l):null;let b=-1,x=null;u&&(x=new ResizeObserver(R=>{let[T]=R;T&&T.target===p&&x&&t&&(x.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var O;(O=x)==null||O.observe(t)})),r()}),p&&!m&&x.observe(p),t&&x.observe(t));let w,_=m?ji(e):null;m&&E();function E(){const R=ji(e);_&&!pS(_,R)&&r(),_=R,w=requestAnimationFrame(E)}return r(),()=>{var R;y.forEach(T=>{o&&T.removeEventListener("scroll",r),l&&T.removeEventListener("resize",r)}),v?.(),(R=x)==null||R.disconnect(),x=null,m&&cancelAnimationFrame(w)}}const KO=_O,YO=CO,QO=xO,XO=RO,JO=wO,Wb=bO,WO=EO,eA=(e,t,r)=>{const i=new Map,o=r??{},l={...qO,...o.platform,_c:i};return yO(e,t,{...o,platform:l})};var tA=typeof document<"u",nA=function(){},ou=tA?S.useLayoutEffect:nA;function yu(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 r,i,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(i=r;i--!==0;)if(!yu(e[i],t[i]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!{}.hasOwnProperty.call(t,o[i]))return!1;for(i=r;i--!==0;){const l=o[i];if(!(l==="_owner"&&e.$$typeof)&&!yu(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function gS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ex(e,t){const r=gS(e);return Math.round(t*r)/r}function Vh(e){const t=S.useRef(e);return ou(()=>{t.current=e}),t}function rA(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:i=[],platform:o,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:m,open:p}=e,[y,v]=S.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[b,x]=S.useState(i);yu(b,i)||x(i);const[w,_]=S.useState(null),[E,R]=S.useState(null),T=S.useCallback(ne=>{ne!==B.current&&(B.current=ne,_(ne))},[]),O=S.useCallback(ne=>{ne!==H.current&&(H.current=ne,R(ne))},[]),N=l||w,k=u||E,B=S.useRef(null),H=S.useRef(null),$=S.useRef(y),he=m!=null,be=Vh(m),pe=Vh(o),fe=Vh(p),ue=S.useCallback(()=>{if(!B.current||!H.current)return;const ne={placement:t,strategy:r,middleware:b};pe.current&&(ne.platform=pe.current),eA(B.current,H.current,ne).then(X=>{const te={...X,isPositioned:fe.current!==!1};ee.current&&!yu($.current,te)&&($.current=te,ki.flushSync(()=>{v(te)}))})},[b,t,r,pe,fe]);ou(()=>{p===!1&&$.current.isPositioned&&($.current.isPositioned=!1,v(ne=>({...ne,isPositioned:!1})))},[p]);const ee=S.useRef(!1);ou(()=>(ee.current=!0,()=>{ee.current=!1}),[]),ou(()=>{if(N&&(B.current=N),k&&(H.current=k),N&&k){if(be.current)return be.current(N,k,ue);ue()}},[N,k,ue,be,he]);const ve=S.useMemo(()=>({reference:B,floating:H,setReference:T,setFloating:O}),[T,O]),L=S.useMemo(()=>({reference:N,floating:k}),[N,k]),Z=S.useMemo(()=>{const ne={position:r,left:0,top:0};if(!L.floating)return ne;const X=ex(L.floating,y.x),te=ex(L.floating,y.y);return d?{...ne,transform:"translate("+X+"px, "+te+"px)",...gS(L.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:X,top:te}},[r,d,L.floating,y.x,y.y]);return S.useMemo(()=>({...y,update:ue,refs:ve,elements:L,floatingStyles:Z}),[y,ue,ve,L,Z])}const aA=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:i,padding:o}=typeof e=="function"?e(r):e;return i&&t(i)?i.current!=null?Wb({element:i.current,padding:o}).fn(r):{}:i?Wb({element:i,padding:o}).fn(r):{}}}},iA=(e,t)=>{const r=KO(e);return{name:r.name,fn:r.fn,options:[e,t]}},sA=(e,t)=>{const r=YO(e);return{name:r.name,fn:r.fn,options:[e,t]}},oA=(e,t)=>({fn:WO(e).fn,options:[e,t]}),lA=(e,t)=>{const r=QO(e);return{name:r.name,fn:r.fn,options:[e,t]}},cA=(e,t)=>{const r=XO(e);return{name:r.name,fn:r.fn,options:[e,t]}},uA=(e,t)=>{const r=JO(e);return{name:r.name,fn:r.fn,options:[e,t]}},dA=(e,t)=>{const r=aA(e);return{name:r.name,fn:r.fn,options:[e,t]}};var fA="Arrow",vS=S.forwardRef((e,t)=>{const{children:r,width:i=10,height:o=5,...l}=e;return f.jsx(Pe.svg,{...l,ref:t,width:i,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});vS.displayName=fA;var hA=vS,jp="Popper",[yS,Qs]=Ka(jp),[mA,bS]=yS(jp),xS=e=>{const{__scopePopper:t,children:r}=e,[i,o]=S.useState(null),[l,u]=S.useState(void 0);return f.jsx(mA,{scope:t,anchor:i,onAnchorChange:o,placementState:l,setPlacementState:u,children:r})};xS.displayName=jp;var wS="PopperAnchor",SS=S.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:i,...o}=e,l=bS(wS,r),u=S.useRef(null),d=l.onAnchorChange,m=S.useCallback(w=>{u.current=w,w&&d(w)},[d]),p=at(t,m),y=S.useRef(null);S.useEffect(()=>{if(!i)return;const w=y.current;y.current=i.current,w!==y.current&&d(y.current)});const v=l.placementState&&Op(l.placementState),b=v?.[0],x=v?.[1];return i?null:f.jsx(Pe.div,{"data-radix-popper-side":b,"data-radix-popper-align":x,...o,ref:p})});SS.displayName=wS;var Tp="PopperContent",[pA,gA]=yS(Tp),_S=S.forwardRef((e,t)=>{const{__scopePopper:r,side:i="bottom",sideOffset:o=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:p=[],collisionPadding:y=0,sticky:v="partial",hideWhenDetached:b=!1,updatePositionStrategy:x="optimized",onPlaced:w,..._}=e,E=bS(Tp,r),[R,T]=S.useState(null),O=at(t,T),[N,k]=S.useState(null),B=sO(N),H=B?.width??0,$=B?.height??0,he=i+(l!=="center"?"-"+l:""),be=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},pe=Array.isArray(p)?p:[p],fe=pe.length>0,ue={padding:be,boundary:pe.filter(yA),altBoundary:fe},{refs:ee,floatingStyles:ve,placement:L,isPositioned:Z,middlewareData:ne}=rA({strategy:"fixed",placement:he,whileElementsMounted:(...xe)=>ZO(...xe,{animationFrame:x==="always"}),elements:{reference:E.anchor},middleware:[iA({mainAxis:o+$,alignmentAxis:u}),m&&sA({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?oA():void 0,...ue}),m&&lA({...ue}),cA({...ue,apply:({elements:xe,rects:we,availableWidth:Me,availableHeight:Fe})=>{const{width:He,height:ct}=we.reference,Je=xe.floating.style;Je.setProperty("--radix-popper-available-width",`${Me}px`),Je.setProperty("--radix-popper-available-height",`${Fe}px`),Je.setProperty("--radix-popper-anchor-width",`${He}px`),Je.setProperty("--radix-popper-anchor-height",`${ct}px`)}}),N&&dA({element:N,padding:d}),bA({arrowWidth:H,arrowHeight:$}),b&&uA({strategy:"referenceHidden",...ue,boundary:fe?ue.boundary:void 0})]}),X=E.setPlacementState;Qt(()=>(X(L),()=>{X(void 0)}),[L,X]);const[te,D]=Op(L),M=tr(w);Qt(()=>{Z&&M?.()},[Z,M]);const U=ne.arrow?.x,Q=ne.arrow?.y,K=ne.arrow?.centerOffset!==0,[de,re]=S.useState();return Qt(()=>{R&&re(window.getComputedStyle(R).zIndex)},[R]),f.jsx("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...ve,transform:Z?ve.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:de,"--radix-popper-transform-origin":[ne.transformOrigin?.x,ne.transformOrigin?.y].join(" "),...ne.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(pA,{scope:r,placedSide:te,placedAlign:D,onArrowChange:k,arrowX:U,arrowY:Q,shouldHideArrow:K,children:f.jsx(Pe.div,{"data-side":te,"data-align":D,..._,ref:O,style:{..._.style,animation:Z?void 0:"none"}})})})});_S.displayName=Tp;var CS="PopperArrow",vA={top:"bottom",right:"left",bottom:"top",left:"right"},ES=S.forwardRef(function(t,r){const{__scopePopper:i,...o}=t,l=gA(CS,i),u=vA[l.placedSide];return f.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:f.jsx(hA,{...o,ref:r,style:{...o.style,display:"block"}})})});ES.displayName=CS;function yA(e){return e!==null}var bA=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:i,middlewareData:o}=t,u=o.arrow?.centerOffset!==0,d=u?0:e.arrowWidth,m=u?0:e.arrowHeight,[p,y]=Op(r),v={start:"0%",center:"50%",end:"100%"}[y],b=(o.arrow?.x??0)+d/2,x=(o.arrow?.y??0)+m/2;let w="",_="";return p==="bottom"?(w=u?v:`${b}px`,_=`${-m}px`):p==="top"?(w=u?v:`${b}px`,_=`${i.floating.height+m}px`):p==="right"?(w=`${-m}px`,_=u?v:`${x}px`):p==="left"&&(w=`${i.floating.width+m}px`,_=u?v:`${x}px`),{data:{x:w,y:_}}}});function Op(e){const[t,r="center"]=e.split("-");return[t,r]}var Ap=xS,Mp=SS,Np=_S,Dp=ES,Uh=!1;function xA(){const[e,t]=S.useState(Uh);return S.useEffect(()=>{Uh||(Uh=!0,t(!0))},[]),e}var RS=Mu[" useSyncExternalStore ".trim().toString()];function wA(){return()=>{}}function SA(){return RS(wA,()=>!0,()=>!1)}var _A=typeof RS=="function"?SA:xA,Hh="rovingFocusGroup.onEntryFocus",CA={bubbles:!1,cancelable:!0},xl="RovingFocusGroup",[Cm,jS,EA]=up(xl),[RA,TS]=Ka(xl,[EA]),[jA,TA]=RA(xl),OS=S.forwardRef((e,t)=>f.jsx(Cm.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Cm.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(OA,{...e,ref:t})})}));OS.displayName=xl;var OA=S.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:o=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:p,preventScrollOnEntryFocus:y=!1,...v}=e,b=S.useRef(null),x=at(t,b),w=dp(l),[_,E]=Hs({prop:u,defaultProp:d??null,onChange:m,caller:xl}),[R,T]=S.useState(!1),O=tr(p),N=jS(r),k=S.useRef(!1),[B,H]=S.useState(0);return S.useEffect(()=>{const $=b.current;if($)return $.addEventListener(Hh,O),()=>$.removeEventListener(Hh,O)},[O]),f.jsx(jA,{scope:r,orientation:i,dir:w,loop:o,currentTabStopId:_,onItemFocus:S.useCallback($=>E($),[E]),onItemShiftTab:S.useCallback(()=>T(!0),[]),onFocusableItemAdd:S.useCallback(()=>H($=>$+1),[]),onFocusableItemRemove:S.useCallback(()=>H($=>$-1),[]),children:f.jsx(Pe.div,{tabIndex:R||B===0?-1:0,"data-orientation":i,...v,ref:x,style:{outline:"none",...e.style},onMouseDown:Te(e.onMouseDown,()=>{k.current=!0}),onFocus:Te(e.onFocus,$=>{const he=!k.current;if($.target===$.currentTarget&&he&&!R){const be=new CustomEvent(Hh,CA);if($.currentTarget.dispatchEvent(be),!be.defaultPrevented){const pe=N().filter(L=>L.focusable),fe=pe.find(L=>L.active),ue=pe.find(L=>L.id===_),ve=[fe,ue,...pe].filter(Boolean).map(L=>L.ref.current);NS(ve,y)}}k.current=!1}),onBlur:Te(e.onBlur,()=>T(!1))})})}),AS="RovingFocusGroupItem",MS=S.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:o=!1,tabStopId:l,children:u,...d}=e,m=fn(),p=l||m,y=TA(AS,r),v=y.currentTabStopId===p,b=jS(r),{onFocusableItemAdd:x,onFocusableItemRemove:w,currentTabStopId:_}=y,E=_A();return Qt(()=>{if(!(!E||!i))return x(),()=>w()},[E,i,x,w]),S.useEffect(()=>{if(!(E||!i))return x(),()=>w()},[E,i,x,w]),f.jsx(Cm.ItemSlot,{scope:r,id:p,focusable:i,active:o,children:f.jsx(Pe.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...d,ref:t,onMouseDown:Te(e.onMouseDown,R=>{i?y.onItemFocus(p):R.preventDefault()}),onFocus:Te(e.onFocus,()=>y.onItemFocus(p)),onKeyDown:Te(e.onKeyDown,R=>{if(R.key==="Tab"&&R.shiftKey){y.onItemShiftTab();return}if(R.target!==R.currentTarget)return;const T=NA(R,y.orientation,y.dir);if(T!==void 0){if(R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;R.preventDefault();let N=b().filter(k=>k.focusable).map(k=>k.ref.current);if(T==="last")N.reverse();else if(T==="prev"||T==="next"){T==="prev"&&N.reverse();const k=N.indexOf(R.currentTarget);N=y.loop?DA(N,k+1):N.slice(k+1)}setTimeout(()=>NS(N))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:_!=null}):u})})});MS.displayName=AS;var AA={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function MA(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function NA(e,t,r){const i=MA(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return AA[i]}function NS(e,t=!1){const r=document.activeElement;for(const i of e)if(i===r||(i.focus({preventScroll:t}),document.activeElement!==r))return}function DA(e,t){return e.map((r,i)=>e[(t+i)%e.length])}var kA=OS,zA=MS,Em=["Enter"," "],LA=["ArrowDown","PageUp","Home"],DS=["ArrowUp","PageDown","End"],$A=[...LA,...DS],IA={ltr:[...Em,"ArrowRight"],rtl:[...Em,"ArrowLeft"]},PA={ltr:["ArrowLeft"],rtl:["ArrowRight"]},wl="Menu",[cl,FA,VA]=up(wl),[zi,kS]=Ka(wl,[VA,Qs,TS]),Uu=Qs(),zS=TS(),[UA,Li]=zi(wl),[HA,Sl]=zi(wl),LS=e=>{const{__scopeMenu:t,open:r=!1,children:i,dir:o,onOpenChange:l,modal:u=!0}=e,d=Uu(t),[m,p]=S.useState(null),y=S.useRef(!1),v=tr(l),b=dp(o);return S.useEffect(()=>{const x=()=>{y.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>y.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),S.useEffect(()=>{if(!r)return;const x=()=>v(!1);return window.addEventListener("blur",x),()=>window.removeEventListener("blur",x)},[r,v]),f.jsx(Ap,{...d,children:f.jsx(UA,{scope:t,open:r,onOpenChange:v,content:m,onContentChange:p,children:f.jsx(HA,{scope:t,onClose:S.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:b,modal:u,children:i})})})};LS.displayName=wl;var BA="MenuAnchor",kp=S.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,o=Uu(r);return f.jsx(Mp,{...o,...i,ref:t})});kp.displayName=BA;var zp="MenuPortal",[qA,$S]=zi(zp,{forceMount:void 0}),IS=e=>{const{__scopeMenu:t,forceMount:r,children:i,container:o}=e,l=Li(zp,t);return f.jsx(qA,{scope:t,forceMount:r,children:f.jsx(gr,{present:r||l.open,children:f.jsx(bl,{asChild:!0,container:o,children:i})})})};IS.displayName=zp;var er="MenuContent",[GA,Lp]=zi(er),PS=S.forwardRef((e,t)=>{const r=$S(er,e.__scopeMenu),{forceMount:i=r.forceMount,...o}=e,l=Li(er,e.__scopeMenu),u=Sl(er,e.__scopeMenu);return f.jsx(cl.Provider,{scope:e.__scopeMenu,children:f.jsx(gr,{present:i||l.open,children:f.jsx(cl.Slot,{scope:e.__scopeMenu,children:u.modal?f.jsx(ZA,{...o,ref:t}):f.jsx(KA,{...o,ref:t})})})})}),ZA=S.forwardRef((e,t)=>{const r=Li(er,e.__scopeMenu),i=S.useRef(null),o=at(t,i);return S.useEffect(()=>{const l=i.current;if(l)return mp(l)},[]),f.jsx($p,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Te(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),KA=S.forwardRef((e,t)=>{const r=Li(er,e.__scopeMenu);return f.jsx($p,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),YA=Ei("MenuContent.ScrollLock"),$p=S.forwardRef((e,t)=>{const{__scopeMenu:r,loop:i=!1,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:p,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:x,disableOutsideScroll:w,..._}=e,E=Li(er,r),R=Sl(er,r),T=Uu(r),O=zS(r),N=FA(r),[k,B]=S.useState(null),H=S.useRef(null),$=at(t,H,E.onContentChange),he=S.useRef(0),be=S.useRef(""),pe=S.useRef(0),fe=S.useRef(null),ue=S.useRef("right"),ee=S.useRef(0),ve=w?zu:S.Fragment,L=w?{as:YA,allowPinchZoom:!0}:void 0,Z=X=>{const te=be.current+X,D=N().filter(re=>!re.disabled),M=document.activeElement,U=D.find(re=>re.ref.current===M)?.textValue,Q=D.map(re=>re.textValue),K=oM(Q,te,U),de=D.find(re=>re.textValue===K)?.ref.current;(function re(xe){be.current=xe,window.clearTimeout(he.current),xe!==""&&(he.current=window.setTimeout(()=>re(""),1e3))})(te),de&&setTimeout(()=>de.focus())};S.useEffect(()=>()=>window.clearTimeout(he.current),[]),hp();const ne=S.useCallback(X=>ue.current===fe.current?.side&&cM(X,fe.current?.area),[]);return f.jsx(GA,{scope:r,searchRef:be,onItemEnter:S.useCallback(X=>{ne(X)&&X.preventDefault()},[ne]),onItemLeave:S.useCallback(X=>{ne(X)||(H.current?.focus(),B(null))},[ne]),onTriggerLeave:S.useCallback(X=>{ne(X)&&X.preventDefault()},[ne]),pointerGraceTimerRef:pe,onPointerGraceIntentChange:S.useCallback(X=>{fe.current=X},[]),children:f.jsx(ve,{...L,children:f.jsx(Du,{asChild:!0,trapped:o,onMountAutoFocus:Te(l,X=>{X.preventDefault(),H.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:f.jsx(yl,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:p,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:x,children:f.jsx(kA,{asChild:!0,...O,dir:R.dir,orientation:"vertical",loop:i,currentTabStopId:k,onCurrentTabStopIdChange:B,onEntryFocus:Te(m,X=>{R.isUsingKeyboardRef.current||X.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(Np,{role:"menu","aria-orientation":"vertical","data-state":t1(E.open),"data-radix-menu-content":"",dir:R.dir,...T,..._,ref:$,style:{outline:"none",..._.style},onKeyDown:Te(_.onKeyDown,X=>{const D=X.target.closest("[data-radix-menu-content]")===X.currentTarget,M=X.ctrlKey||X.altKey||X.metaKey,U=X.key.length===1;D&&(X.key==="Tab"&&X.preventDefault(),!M&&U&&Z(X.key));const Q=H.current;if(X.target!==Q||!$A.includes(X.key))return;X.preventDefault();const de=N().filter(re=>!re.disabled).map(re=>re.ref.current);DS.includes(X.key)&&de.reverse(),iM(de)}),onBlur:Te(e.onBlur,X=>{X.currentTarget.contains(X.target)||(window.clearTimeout(he.current),be.current="")}),onPointerMove:Te(e.onPointerMove,ul(X=>{const te=X.target,D=ee.current!==X.clientX;if(X.currentTarget.contains(te)&&D){const M=X.clientX>ee.current?"right":"left";ue.current=M,ee.current=X.clientX}}))})})})})})})});PS.displayName=er;var QA="MenuGroup",Ip=S.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return f.jsx(Pe.div,{role:"group",...i,ref:t})});Ip.displayName=QA;var XA="MenuLabel",FS=S.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return f.jsx(Pe.div,{...i,ref:t})});FS.displayName=XA;var bu="MenuItem",tx="menu.itemSelect",Hu=S.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:i,...o}=e,l=S.useRef(null),u=Sl(bu,e.__scopeMenu),d=Lp(bu,e.__scopeMenu),m=at(t,l),p=S.useRef(!1),y=()=>{const v=l.current;if(!r&&v){const b=new CustomEvent(tx,{bubbles:!0,cancelable:!0});v.addEventListener(tx,x=>i?.(x),{once:!0}),Iw(v,b),b.defaultPrevented?p.current=!1:u.onClose()}};return f.jsx(VS,{...o,ref:m,disabled:r,onClick:Te(e.onClick,y),onPointerDown:v=>{e.onPointerDown?.(v),p.current=!0},onPointerUp:Te(e.onPointerUp,v=>{p.current||v.currentTarget?.click()}),onKeyDown:Te(e.onKeyDown,v=>{r||v.target!==v.currentTarget||d.searchRef.current!==""&&v.key===" "||Em.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});Hu.displayName=bu;var VS=S.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:i=!1,textValue:o,...l}=e,u=Lp(bu,r),d=zS(r),m=S.useRef(null),p=at(t,m),[y,v]=S.useState(!1),[b,x]=S.useState("");return S.useEffect(()=>{const w=m.current;w&&x((w.textContent??"").trim())},[l.children]),f.jsx(cl.ItemSlot,{scope:r,disabled:i,textValue:o??b,children:f.jsx(zA,{asChild:!0,...d,focusable:!i,children:f.jsx(Pe.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...l,ref:p,onPointerMove:Te(e.onPointerMove,ul(w=>{i?u.onItemLeave(w):(u.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Te(e.onPointerLeave,ul(w=>u.onItemLeave(w))),onFocus:Te(e.onFocus,()=>v(!0)),onBlur:Te(e.onBlur,()=>v(!1))})})})}),JA="MenuCheckboxItem",US=S.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:i,...o}=e;return f.jsx(ZS,{scope:e.__scopeMenu,checked:r,children:f.jsx(Hu,{role:"menuitemcheckbox","aria-checked":xu(r)?"mixed":r,...o,ref:t,"data-state":Fp(r),onSelect:Te(o.onSelect,()=>i?.(xu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});US.displayName=JA;var HS="MenuRadioGroup",[WA,eM]=zi(HS,{value:void 0,onValueChange:()=>{}}),BS=S.forwardRef((e,t)=>{const{value:r,onValueChange:i,...o}=e,l=tr(i);return f.jsx(WA,{scope:e.__scopeMenu,value:r,onValueChange:l,children:f.jsx(Ip,{...o,ref:t})})});BS.displayName=HS;var qS="MenuRadioItem",GS=S.forwardRef((e,t)=>{const{value:r,...i}=e,o=eM(qS,e.__scopeMenu),l=r===o.value;return f.jsx(ZS,{scope:e.__scopeMenu,checked:l,children:f.jsx(Hu,{role:"menuitemradio","aria-checked":l,...i,ref:t,"data-state":Fp(l),onSelect:Te(i.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});GS.displayName=qS;var Pp="MenuItemIndicator",[ZS,tM]=zi(Pp,{checked:!1}),KS=S.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:i,...o}=e,l=tM(Pp,r);return f.jsx(gr,{present:i||xu(l.checked)||l.checked===!0,children:f.jsx(Pe.span,{...o,ref:t,"data-state":Fp(l.checked)})})});KS.displayName=Pp;var nM="MenuSeparator",YS=S.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return f.jsx(Pe.div,{role:"separator","aria-orientation":"horizontal",...i,ref:t})});YS.displayName=nM;var rM="MenuArrow",QS=S.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,o=Uu(r);return f.jsx(Dp,{...o,...i,ref:t})});QS.displayName=rM;var aM="MenuSub",[wF,XS]=zi(aM),Qo="MenuSubTrigger",JS=S.forwardRef((e,t)=>{const r=Li(Qo,e.__scopeMenu),i=Sl(Qo,e.__scopeMenu),o=XS(Qo,e.__scopeMenu),l=Lp(Qo,e.__scopeMenu),u=S.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=l,p={__scopeMenu:e.__scopeMenu},y=S.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);S.useEffect(()=>y,[y]),S.useEffect(()=>{const b=d.current;return()=>{window.clearTimeout(b),m(null)}},[d,m]);const v=at(t,o.onTriggerChange);return f.jsx(kp,{asChild:!0,...p,children:f.jsx(VS,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?o.contentId:void 0,"data-state":t1(r.open),...e,ref:v,onClick:b=>{e.onClick?.(b),!(e.disabled||b.defaultPrevented)&&(b.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Te(e.onPointerMove,ul(b=>{l.onItemEnter(b),!b.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),y()},100))})),onPointerLeave:Te(e.onPointerLeave,ul(b=>{y();const x=r.content?.getBoundingClientRect();if(x){const w=r.content?.dataset.side,_=w==="right",E=_?-5:5,R=x[_?"left":"right"],T=x[_?"right":"left"];l.onPointerGraceIntentChange({area:[{x:b.clientX+E,y:b.clientY},{x:R,y:x.top},{x:T,y:x.top},{x:T,y:x.bottom},{x:R,y:x.bottom}],side:w}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(b),b.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Te(e.onKeyDown,b=>{e.disabled||b.target!==b.currentTarget||l.searchRef.current!==""&&b.key===" "||IA[i.dir].includes(b.key)&&(r.onOpenChange(!0),r.content?.focus(),b.preventDefault())})})})});JS.displayName=Qo;var WS="MenuSubContent",e1=S.forwardRef((e,t)=>{const r=$S(er,e.__scopeMenu),{forceMount:i=r.forceMount,align:o="start",...l}=e,u=Li(er,e.__scopeMenu),d=Sl(er,e.__scopeMenu),m=XS(WS,e.__scopeMenu),p=S.useRef(null),y=at(t,p);return f.jsx(cl.Provider,{scope:e.__scopeMenu,children:f.jsx(gr,{present:i||u.open,children:f.jsx(cl.Slot,{scope:e.__scopeMenu,children:f.jsx($p,{id:m.contentId,"aria-labelledby":m.triggerId,...l,ref:y,align:o,side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:v=>{d.isUsingKeyboardRef.current&&p.current?.focus(),v.preventDefault()},onCloseAutoFocus:v=>v.preventDefault(),onFocusOutside:Te(e.onFocusOutside,v=>{v.target!==m.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:Te(e.onEscapeKeyDown,v=>{d.onClose(),v.preventDefault()}),onKeyDown:Te(e.onKeyDown,v=>{const b=v.currentTarget.contains(v.target),x=PA[d.dir].includes(v.key);b&&x&&(u.onOpenChange(!1),m.trigger?.focus(),v.preventDefault())})})})})})});e1.displayName=WS;function t1(e){return e?"open":"closed"}function xu(e){return e==="indeterminate"}function Fp(e){return xu(e)?"indeterminate":e?"checked":"unchecked"}function iM(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function sM(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function oM(e,t,r){const o=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=sM(e,Math.max(l,0));o.length===1&&(u=u.filter(p=>p!==r));const m=u.find(p=>p.toLowerCase().startsWith(o.toLowerCase()));return m!==r?m:void 0}function lM(e,t){const{x:r,y:i}=e;let o=!1;for(let l=0,u=t.length-1;li!=b>i&&r<(v-p)*(i-y)/(b-y)+p&&(o=!o)}return o}function cM(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return lM(r,t)}function ul(e){return t=>t.pointerType==="mouse"?e(t):void 0}var uM=LS,dM=kp,fM=IS,hM=PS,mM=Ip,pM=FS,gM=Hu,vM=US,yM=BS,bM=GS,xM=KS,wM=YS,SM=QS,_M=JS,CM=e1,Bu="DropdownMenu",[EM]=Ka(Bu,[kS]),vn=kS(),[RM,n1]=EM(Bu),r1=e=>{const{__scopeDropdownMenu:t,children:r,dir:i,open:o,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,m=vn(t),p=S.useRef(null),[y,v]=Hs({prop:o,defaultProp:l??!1,onChange:u,caller:Bu});return f.jsx(RM,{scope:t,triggerId:fn(),triggerRef:p,contentId:fn(),open:y,onOpenChange:v,onOpenToggle:S.useCallback(()=>v(b=>!b),[v]),modal:d,children:f.jsx(uM,{...m,open:y,onOpenChange:v,dir:i,modal:d,children:r})})};r1.displayName=Bu;var a1="DropdownMenuTrigger",i1=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:i=!1,...o}=e,l=n1(a1,r),u=vn(r),d=at(t,l.triggerRef);return f.jsx(dM,{asChild:!0,...u,children:f.jsx(Pe.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...o,ref:d,onPointerDown:Te(e.onPointerDown,m=>{!i&&m.button===0&&m.ctrlKey===!1&&(l.onOpenToggle(),l.open||m.preventDefault())}),onKeyDown:Te(e.onKeyDown,m=>{i||(["Enter"," "].includes(m.key)&&l.onOpenToggle(),m.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(m.key)&&m.preventDefault())})})})});i1.displayName=a1;var jM="DropdownMenuPortal",s1=e=>{const{__scopeDropdownMenu:t,...r}=e,i=vn(t);return f.jsx(fM,{...i,...r})};s1.displayName=jM;var o1="DropdownMenuContent",l1=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=n1(o1,r),l=vn(r),u=S.useRef(!1);return f.jsx(hM,{id:o.contentId,"aria-labelledby":o.triggerId,...l,...i,ref:t,onCloseAutoFocus:Te(e.onCloseAutoFocus,d=>{u.current||o.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Te(e.onInteractOutside,d=>{const m=d.detail.originalEvent,p=m.button===0&&m.ctrlKey===!0,y=m.button===2||p;(!o.modal||y)&&(u.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)"}})});l1.displayName=o1;var TM="DropdownMenuGroup",OM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(mM,{...o,...i,ref:t})});OM.displayName=TM;var AM="DropdownMenuLabel",c1=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(pM,{...o,...i,ref:t})});c1.displayName=AM;var MM="DropdownMenuItem",u1=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(gM,{...o,...i,ref:t})});u1.displayName=MM;var NM="DropdownMenuCheckboxItem",DM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(vM,{...o,...i,ref:t})});DM.displayName=NM;var kM="DropdownMenuRadioGroup",zM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(yM,{...o,...i,ref:t})});zM.displayName=kM;var LM="DropdownMenuRadioItem",$M=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(bM,{...o,...i,ref:t})});$M.displayName=LM;var IM="DropdownMenuItemIndicator",PM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(xM,{...o,...i,ref:t})});PM.displayName=IM;var FM="DropdownMenuSeparator",VM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(wM,{...o,...i,ref:t})});VM.displayName=FM;var UM="DropdownMenuArrow",HM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(SM,{...o,...i,ref:t})});HM.displayName=UM;var BM="DropdownMenuSubTrigger",qM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(_M,{...o,...i,ref:t})});qM.displayName=BM;var GM="DropdownMenuSubContent",ZM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(CM,{...o,...i,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)"}})});ZM.displayName=GM;var KM=r1,YM=i1,QM=s1,XM=l1,JM=c1,WM=u1,eN="Label",d1=S.forwardRef((e,t)=>f.jsx(Pe.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));d1.displayName=eN;var tN=d1;function nx(e,[t,r]){return Math.min(r,Math.max(t,e))}var nN=[" ","Enter","ArrowUp","ArrowDown"],rN=[" ","Enter"],Ti="Select",[qu,Gu,aN]=up(Ti),[$i]=Ka(Ti,[aN,Qs]),Zu=Qs(),[iN,Qa]=$i(Ti),[sN,oN]=$i(Ti),lN="SelectProvider";function f1(e){const{__scopeSelect:t,children:r,open:i,defaultOpen:o,onOpenChange:l,value:u,defaultValue:d,onValueChange:m,dir:p,name:y,autoComplete:v,disabled:b,required:x,form:w,internal_do_not_use_render:_}=e,E=Zu(t),[R,T]=S.useState(null),[O,N]=S.useState(null),[k,B]=S.useState(!1),H=dp(p),[$,he]=Hs({prop:i,defaultProp:o??!1,onChange:l,caller:Ti}),[be,pe]=Hs({prop:u,defaultProp:d,onChange:m,caller:Ti}),fe=S.useRef(null),ue=S.useRef(be);S.useEffect(()=>{const M=w?R?.ownerDocument.getElementById(w):R?.form;if(M instanceof HTMLFormElement){const U=()=>pe(ue.current);return M.addEventListener("reset",U),()=>M.removeEventListener("reset",U)}},[w,R,pe]);const ee=R?!!w||!!R.closest("form"):!0,[ve,L]=S.useState(new Set),Z=fn(),ne=Array.from(ve).map(M=>M.props.value).join(";"),X=S.useCallback(M=>{L(U=>new Set(U).add(M))},[]),te=S.useCallback(M=>{L(U=>{const Q=new Set(U);return Q.delete(M),Q})},[]),D={required:x,trigger:R,onTriggerChange:T,valueNode:O,onValueNodeChange:N,valueNodeHasChildren:k,onValueNodeHasChildrenChange:B,contentId:Z,value:be,onValueChange:pe,open:$,onOpenChange:he,dir:H,triggerPointerDownPosRef:fe,disabled:b,name:y,autoComplete:v,form:w,nativeOptions:ve,nativeSelectKey:ne,isFormControl:ee};return f.jsx(Ap,{...E,children:f.jsx(iN,{scope:t,...D,children:f.jsx(qu.Provider,{scope:t,children:f.jsx(sN,{scope:t,onNativeOptionAdd:X,onNativeOptionRemove:te,children:EN(_)?_(D):r})})})})}f1.displayName=lN;var h1=e=>{const{__scopeSelect:t,children:r,...i}=e;return f.jsx(f1,{__scopeSelect:t,...i,internal_do_not_use_render:({isFormControl:o})=>f.jsxs(f.Fragment,{children:[r,o?f.jsx(P1,{__scopeSelect:t}):null]})})};h1.displayName=Ti;var m1="SelectTrigger",p1=S.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:i=!1,...o}=e,l=Zu(r),u=Qa(m1,r),d=u.disabled||i,m=at(t,u.onTriggerChange),p=Gu(r),y=S.useRef("touch"),[v,b,x]=F1(_=>{const E=p().filter(O=>!O.disabled),R=E.find(O=>O.value===u.value),T=V1(E,_,R);T!==void 0&&u.onValueChange(T.value)}),w=_=>{d||(u.onOpenChange(!0),x()),_&&(u.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return f.jsx(Mp,{asChild:!0,...l,children:f.jsx(Pe.button,{type:"button",role:"combobox","aria-controls":u.open?u.contentId:void 0,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":Ku(u.value)?"":void 0,...o,ref:m,onClick:Te(o.onClick,_=>{_.currentTarget.focus(),y.current!=="mouse"&&w(_)}),onPointerDown:Te(o.onPointerDown,_=>{y.current=_.pointerType;const E=_.target;E.hasPointerCapture(_.pointerId)&&E.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(w(_),_.preventDefault())}),onKeyDown:Te(o.onKeyDown,_=>{const E=v.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&b(_.key),!(E&&_.key===" ")&&nN.includes(_.key)&&(w(),_.preventDefault())})})})});p1.displayName=m1;var g1="SelectValue",v1=S.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:o,children:l,placeholder:u="",...d}=e,m=Qa(g1,r),{onValueNodeHasChildrenChange:p}=m,y=l!==void 0,v=at(t,m.onValueNodeChange);Qt(()=>{p(y)},[p,y]);const b=Ku(m.value);return f.jsx(Pe.span,{...d,asChild:b?!1:d.asChild,ref:v,style:{pointerEvents:"none"},children:f.jsx(S.Fragment,{children:b?u:l},b?"placeholder":"value")})});v1.displayName=g1;var cN="SelectIcon",y1=S.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,...o}=e;return f.jsx(Pe.span,{"aria-hidden":!0,...o,ref:t,children:i||"▼"})});y1.displayName=cN;var b1="SelectPortal",[uN,dN]=$i(b1,{forceMount:void 0}),x1=e=>{const{__scopeSelect:t,forceMount:r,...i}=e;return f.jsx(uN,{scope:e.__scopeSelect,forceMount:r,children:f.jsx(bl,{asChild:!0,...i})})};x1.displayName=b1;var qa="SelectContent",w1=S.forwardRef((e,t)=>{const r=dN(qa,e.__scopeSelect),{forceMount:i=r.forceMount,...o}=e,l=Qa(qa,e.__scopeSelect),[u,d]=S.useState();return Qt(()=>{d(new DocumentFragment)},[]),f.jsx(gr,{present:i||l.open,children:({present:m})=>m?f.jsx(C1,{...o,ref:t}):f.jsx(S1,{...o,fragment:u})})});w1.displayName=qa;var S1=S.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,fragment:o}=e;return o?ki.createPortal(f.jsx(_1,{scope:r,children:f.jsx(qu.Slot,{scope:r,children:f.jsx("div",{ref:t,children:i})})}),o):null});S1.displayName="SelectContentFragment";var dr=10,[_1,Xa]=$i(qa),fN="SelectContentImpl",hN=Ei("SelectContent.RemoveScroll"),C1=S.forwardRef((e,t)=>{const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:m,align:p,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:x,sticky:w,hideWhenDetached:_,avoidCollisions:E,...R}=e,T=Qa(qa,r),[O,N]=S.useState(null),[k,B]=S.useState(null),H=at(t,N),[$,he]=S.useState(null),[be,pe]=S.useState(null),fe=Gu(r),[ue,ee]=S.useState(!1),ve=S.useRef(!1);S.useEffect(()=>{if(O)return mp(O)},[O]),hp();const L=S.useCallback(re=>{const[xe,...we]=fe().map(He=>He.ref.current),[Me]=we.slice(-1),Fe=document.activeElement;for(const He of re)if(He===Fe||(He?.scrollIntoView({block:"nearest"}),He===xe&&k&&(k.scrollTop=0),He===Me&&k&&(k.scrollTop=k.scrollHeight),He?.focus(),document.activeElement!==Fe))return},[fe,k]),Z=S.useCallback(()=>L([$,O]),[L,$,O]);S.useEffect(()=>{ue&&Z()},[ue,Z]);const{onOpenChange:ne,triggerPointerDownPosRef:X}=T;S.useEffect(()=>{if(O){let re={x:0,y:0};const xe=Me=>{re={x:Math.abs(Math.round(Me.pageX)-(X.current?.x??0)),y:Math.abs(Math.round(Me.pageY)-(X.current?.y??0))}},we=Me=>{re.x<=10&&re.y<=10?Me.preventDefault():Me.composedPath().includes(O)||ne(!1),document.removeEventListener("pointermove",xe),X.current=null};return X.current!==null&&(document.addEventListener("pointermove",xe),document.addEventListener("pointerup",we,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",we,{capture:!0})}}},[O,ne,X]),S.useEffect(()=>{const re=()=>ne(!1);return window.addEventListener("blur",re),window.addEventListener("resize",re),()=>{window.removeEventListener("blur",re),window.removeEventListener("resize",re)}},[ne]);const[te,D]=F1(re=>{const xe=fe().filter(Fe=>!Fe.disabled),we=xe.find(Fe=>Fe.ref.current===document.activeElement),Me=V1(xe,re,we);Me&&setTimeout(()=>Me.ref.current?.focus())}),M=S.useCallback((re,xe,we)=>{const Me=!ve.current&&!we;(T.value!==void 0&&T.value===xe||Me)&&(he(re),Me&&(ve.current=!0))},[T.value]),U=S.useCallback(()=>O?.focus(),[O]),Q=S.useCallback((re,xe,we)=>{const Me=!ve.current&&!we;(T.value!==void 0&&T.value===xe||Me)&&pe(re)},[T.value]),K=i==="popper"?Rm:E1,de=K===Rm?{side:d,sideOffset:m,align:p,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:x,sticky:w,hideWhenDetached:_,avoidCollisions:E}:{};return f.jsx(_1,{scope:r,content:O,viewport:k,onViewportChange:B,itemRefCallback:M,selectedItem:$,onItemLeave:U,itemTextRefCallback:Q,focusSelectedItem:Z,selectedItemText:be,position:i,isPositioned:ue,searchRef:te,children:f.jsx(zu,{as:hN,allowPinchZoom:!0,children:f.jsx(Du,{asChild:!0,trapped:T.open,onMountAutoFocus:re=>{re.preventDefault()},onUnmountAutoFocus:Te(o,re=>{T.trigger?.focus({preventScroll:!0}),re.preventDefault()}),children:f.jsx(yl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:re=>re.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:f.jsx(K,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:re=>re.preventDefault(),...R,...de,onPlaced:()=>ee(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...R.style},onKeyDown:Te(R.onKeyDown,re=>{const xe=re.ctrlKey||re.altKey||re.metaKey;if(re.key==="Tab"&&re.preventDefault(),!xe&&re.key.length===1&&D(re.key),["ArrowUp","ArrowDown","Home","End"].includes(re.key)){let Me=fe().filter(Fe=>!Fe.disabled).map(Fe=>Fe.ref.current);if(["ArrowUp","End"].includes(re.key)&&(Me=Me.slice().reverse()),["ArrowUp","ArrowDown"].includes(re.key)){const Fe=re.target,He=Me.indexOf(Fe);Me=Me.slice(He+1)}setTimeout(()=>L(Me)),re.preventDefault()}})})})})})})});C1.displayName=fN;var mN="SelectItemAlignedPosition",E1=S.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:i,...o}=e,l=Qa(qa,r),u=Xa(qa,r),[d,m]=S.useState(null),[p,y]=S.useState(null),v=at(t,y),b=Gu(r),x=S.useRef(!1),w=S.useRef(!0),{viewport:_,selectedItem:E,selectedItemText:R,focusSelectedItem:T}=u,O=S.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&p&&_&&E&&R){const H=l.trigger.getBoundingClientRect(),$=p.getBoundingClientRect(),he=l.valueNode.getBoundingClientRect(),be=R.getBoundingClientRect();if(l.dir!=="rtl"){const Fe=be.left-$.left,He=he.left-Fe,ct=H.left-He,Je=H.width+ct,hn=Math.max(Je,$.width),mn=window.innerWidth-dr,Xt=nx(He,[dr,Math.max(dr,mn-hn)]);d.style.minWidth=Je+"px",d.style.left=Xt+"px"}else{const Fe=$.right-be.right,He=window.innerWidth-he.right-Fe,ct=window.innerWidth-H.right-He,Je=H.width+ct,hn=Math.max(Je,$.width),mn=window.innerWidth-dr,Xt=nx(He,[dr,Math.max(dr,mn-hn)]);d.style.minWidth=Je+"px",d.style.right=Xt+"px"}const pe=b(),fe=window.innerHeight-dr*2,ue=_.scrollHeight,ee=window.getComputedStyle(p),ve=parseInt(ee.borderTopWidth,10),L=parseInt(ee.paddingTop,10),Z=parseInt(ee.borderBottomWidth,10),ne=parseInt(ee.paddingBottom,10),X=ve+L+ue+ne+Z,te=Math.min(E.offsetHeight*5,X),D=window.getComputedStyle(_),M=parseInt(D.paddingTop,10),U=parseInt(D.paddingBottom,10),Q=H.top+H.height/2-dr,K=fe-Q,de=E.offsetHeight/2,re=E.offsetTop+de,xe=ve+L+re,we=X-xe;if(xe<=Q){const Fe=pe.length>0&&E===pe[pe.length-1].ref.current;d.style.bottom="0px";const He=p.clientHeight-_.offsetTop-_.offsetHeight,ct=Math.max(K,de+(Fe?U:0)+He+Z),Je=xe+ct;d.style.height=Je+"px"}else{const Fe=pe.length>0&&E===pe[0].ref.current;d.style.top="0px";const ct=Math.max(Q,ve+_.offsetTop+(Fe?M:0)+de)+we;d.style.height=ct+"px",_.scrollTop=xe-Q+_.offsetTop}d.style.margin=`${dr}px 0`,d.style.minHeight=te+"px",d.style.maxHeight=fe+"px",i?.(),requestAnimationFrame(()=>x.current=!0)}},[b,l.trigger,l.valueNode,d,p,_,E,R,l.dir,i]);Qt(()=>O(),[O]);const[N,k]=S.useState();Qt(()=>{p&&k(window.getComputedStyle(p).zIndex)},[p]);const B=S.useCallback(H=>{H&&w.current===!0&&(O(),T?.(),w.current=!1)},[O,T]);return f.jsx(gN,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:x,onScrollButtonChange:B,children:f.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:f.jsx(Pe.div,{...o,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});E1.displayName=mN;var pN="SelectPopperPosition",Rm=S.forwardRef((e,t)=>{const{__scopeSelect:r,align:i="start",collisionPadding:o=dr,...l}=e,u=Zu(r);return f.jsx(Np,{...u,...l,ref:t,align:i,collisionPadding:o,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Rm.displayName=pN;var[gN,Vp]=$i(qa,{}),jm="SelectViewport",R1=S.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:i,...o}=e,l=Xa(jm,r),u=Vp(jm,r),d=at(t,l.onViewportChange),m=S.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),f.jsx(qu.Slot,{scope:r,children:f.jsx(Pe.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Te(o.onScroll,p=>{const y=p.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:b}=u;if(b?.current&&v){const x=Math.abs(m.current-y.scrollTop);if(x>0){const w=window.innerHeight-dr*2,_=parseFloat(v.style.minHeight),E=parseFloat(v.style.height),R=Math.max(_,E);if(R0?N:0,v.style.justifyContent="flex-end")}}}m.current=y.scrollTop})})})]})});R1.displayName=jm;var j1="SelectGroup",[vN,yN]=$i(j1),bN=S.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,o=fn();return f.jsx(vN,{scope:r,id:o,children:f.jsx(Pe.div,{role:"group","aria-labelledby":o,...i,ref:t})})});bN.displayName=j1;var T1="SelectLabel",xN=S.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,o=yN(T1,r);return f.jsx(Pe.div,{id:o.id,...i,ref:t})});xN.displayName=T1;var wu="SelectItem",[wN,O1]=$i(wu),A1=S.forwardRef((e,t)=>{const{__scopeSelect:r,value:i,disabled:o=!1,textValue:l,...u}=e,d=Qa(wu,r),m=Xa(wu,r),p=d.value===i,[y,v]=S.useState(l??""),[b,x]=S.useState(!1),w=tr(O=>m.itemRefCallback?.(O,i,o)),_=at(t,w),E=fn(),R=S.useRef("touch"),T=()=>{o||(d.onValueChange(i),d.onOpenChange(!1))};return f.jsx(wN,{scope:r,value:i,disabled:o,textId:E,isSelected:p,onItemTextChange:S.useCallback(O=>{v(N=>N||(O?.textContent??"").trim())},[]),children:f.jsx(qu.ItemSlot,{scope:r,value:i,disabled:o,textValue:y,children:f.jsx(Pe.div,{role:"option","aria-labelledby":E,"data-highlighted":b?"":void 0,"aria-selected":p&&b,"data-state":p?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...u,ref:_,onFocus:Te(u.onFocus,()=>x(!0)),onBlur:Te(u.onBlur,()=>x(!1)),onClick:Te(u.onClick,()=>{R.current!=="mouse"&&T()}),onPointerUp:Te(u.onPointerUp,()=>{R.current==="mouse"&&T()}),onPointerDown:Te(u.onPointerDown,O=>{R.current=O.pointerType}),onPointerMove:Te(u.onPointerMove,O=>{R.current=O.pointerType,o?m.onItemLeave?.():R.current==="mouse"&&O.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(u.onPointerLeave,O=>{O.currentTarget===document.activeElement&&m.onItemLeave?.()}),onKeyDown:Te(u.onKeyDown,O=>{o||O.target!==O.currentTarget||m.searchRef?.current!==""&&O.key===" "||(rN.includes(O.key)&&T(),O.key===" "&&O.preventDefault())})})})})});A1.displayName=wu;var Xo="SelectItemText",M1=S.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:o,...l}=e,u=Qa(Xo,r),d=Xa(Xo,r),m=O1(Xo,r),p=oN(Xo,r),[y,v]=S.useState(null),b=tr(T=>d.itemTextRefCallback?.(T,m.value,m.disabled)),x=at(t,v,m.onItemTextChange,b),w=y?.textContent,_=S.useMemo(()=>f.jsx("option",{value:m.value,disabled:m.disabled,children:w},m.value),[m.disabled,m.value,w]),{onNativeOptionAdd:E,onNativeOptionRemove:R}=p;return Qt(()=>(E(_),()=>R(_)),[E,R,_]),f.jsxs(f.Fragment,{children:[f.jsx(Pe.span,{id:m.textId,...l,ref:x}),m.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!Ku(u.value)?ki.createPortal(l.children,u.valueNode):null]})});M1.displayName=Xo;var N1="SelectItemIndicator",D1=S.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return O1(N1,r).isSelected?f.jsx(Pe.span,{"aria-hidden":!0,...i,ref:t}):null});D1.displayName=N1;var Tm="SelectScrollUpButton",k1=S.forwardRef((e,t)=>{const r=Xa(Tm,e.__scopeSelect),i=Vp(Tm,e.__scopeSelect),[o,l]=S.useState(!1),u=at(t,i.onScrollButtonChange);return Qt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const p=m.scrollTop>0;l(p)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),o?f.jsx(L1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});k1.displayName=Tm;var Om="SelectScrollDownButton",z1=S.forwardRef((e,t)=>{const r=Xa(Om,e.__scopeSelect),i=Vp(Om,e.__scopeSelect),[o,l]=S.useState(!1),u=at(t,i.onScrollButtonChange);return Qt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const p=m.scrollHeight-m.clientHeight,y=Math.ceil(m.scrollTop)m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),o?f.jsx(L1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});z1.displayName=Om;var L1=S.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:i,...o}=e,l=Xa("SelectScrollButton",r),u=S.useRef(null),d=Gu(r),m=S.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return S.useEffect(()=>()=>m(),[m]),Qt(()=>{d().find(y=>y.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),f.jsx(Pe.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Te(o.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(i,50))}),onPointerMove:Te(o.onPointerMove,()=>{l.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(i,50))}),onPointerLeave:Te(o.onPointerLeave,()=>{m()})})}),SN="SelectSeparator",_N=S.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return f.jsx(Pe.div,{"aria-hidden":!0,...i,ref:t})});_N.displayName=SN;var $1="SelectArrow",CN=S.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,o=Zu(r);return Xa($1,r).position==="popper"?f.jsx(Dp,{...o,...i,ref:t}):null});CN.displayName=$1;var I1="SelectBubbleInput",P1=S.forwardRef(({__scopeSelect:e,...t},r)=>{const i=Qa(I1,e),{value:o,onValueChange:l,required:u,disabled:d,name:m,autoComplete:p,form:y}=i,{nativeOptions:v,nativeSelectKey:b}=i,x=S.useRef(null),w=at(r,x),_=o??"",E=iO(_),R=Array.from(v).some(T=>(T.props.value??"")==="");return S.useEffect(()=>{const T=x.current;if(!T)return;const O=window.HTMLSelectElement.prototype,k=Object.getOwnPropertyDescriptor(O,"value").set;if(E!==_&&k){const B=new Event("change",{bubbles:!0});k.call(T,_),T.dispatchEvent(B)}},[E,_]),f.jsxs(Pe.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:m,autoComplete:p,disabled:d,form:y,onChange:T=>l(T.target.value),...t,style:{...Pw,...t.style},ref:w,defaultValue:_,children:[Ku(o)&&!R?f.jsx("option",{value:""}):null,Array.from(v)]},b)});P1.displayName=I1;function EN(e){return typeof e=="function"}function Ku(e){return e===""||e===void 0}function F1(e){const t=tr(e),r=S.useRef(""),i=S.useRef(0),o=S.useCallback(u=>{const d=r.current+u;t(d),(function m(p){r.current=p,window.clearTimeout(i.current),p!==""&&(i.current=window.setTimeout(()=>m(""),1e3))})(d)},[t]),l=S.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return S.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,o,l]}function V1(e,t,r){const o=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=RN(e,Math.max(l,0));o.length===1&&(u=u.filter(p=>p!==r));const m=u.find(p=>p.textValue.toLowerCase().startsWith(o.toLowerCase()));return m!==r?m:void 0}function RN(e,t){return e.map((r,i)=>e[(t+i)%e.length])}var jN="Separator",rx="horizontal",TN=["horizontal","vertical"],U1=S.forwardRef((e,t)=>{const{decorative:r,orientation:i=rx,...o}=e,l=ON(i)?i:rx,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return f.jsx(Pe.div,{"data-orientation":l,...d,...o,ref:t})});U1.displayName=jN;function ON(e){return TN.includes(e)}var AN=U1,[Yu]=Ka("Tooltip",[Qs]),Qu=Qs(),H1="TooltipProvider",MN=700,Am="tooltip.open",[NN,Up]=Yu(H1),B1=e=>{const{__scopeTooltip:t,delayDuration:r=MN,skipDelayDuration:i=300,disableHoverableContent:o=!1,children:l}=e,u=S.useRef(!0),d=S.useRef(!1),m=S.useRef(0);return S.useEffect(()=>{const p=m.current;return()=>window.clearTimeout(p)},[]),f.jsx(NN,{scope:t,isOpenDelayedRef:u,delayDuration:r,onOpen:S.useCallback(()=>{i<=0||(window.clearTimeout(m.current),u.current=!1)},[i]),onClose:S.useCallback(()=>{i<=0||(window.clearTimeout(m.current),m.current=window.setTimeout(()=>u.current=!0,i))},[i]),isPointerInTransitRef:d,onPointerInTransitChange:S.useCallback(p=>{d.current=p},[]),disableHoverableContent:o,children:l})};B1.displayName=H1;var dl="Tooltip",[DN,_l]=Yu(dl),q1=e=>{const{__scopeTooltip:t,children:r,open:i,defaultOpen:o,onOpenChange:l,disableHoverableContent:u,delayDuration:d}=e,m=Up(dl,e.__scopeTooltip),p=Qu(t),[y,v]=S.useState(null),b=fn(),x=S.useRef(0),w=u??m.disableHoverableContent,_=d??m.delayDuration,E=S.useRef(!1),[R,T]=Hs({prop:i,defaultProp:o??!1,onChange:H=>{H?(m.onOpen(),document.dispatchEvent(new CustomEvent(Am))):m.onClose(),l?.(H)},caller:dl}),O=S.useMemo(()=>R?E.current?"delayed-open":"instant-open":"closed",[R]),N=S.useCallback(()=>{window.clearTimeout(x.current),x.current=0,E.current=!1,T(!0)},[T]),k=S.useCallback(()=>{window.clearTimeout(x.current),x.current=0,T(!1)},[T]),B=S.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{E.current=!0,T(!0),x.current=0},_)},[_,T]);return S.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),f.jsx(Ap,{...p,children:f.jsx(DN,{scope:t,contentId:b,open:R,stateAttribute:O,trigger:y,onTriggerChange:v,onTriggerEnter:S.useCallback(()=>{m.isOpenDelayedRef.current?B():N()},[m.isOpenDelayedRef,B,N]),onTriggerLeave:S.useCallback(()=>{w?k():(window.clearTimeout(x.current),x.current=0)},[k,w]),onOpen:N,onClose:k,disableHoverableContent:w,children:r})})};q1.displayName=dl;var Mm="TooltipTrigger",G1=S.forwardRef((e,t)=>{const{__scopeTooltip:r,...i}=e,o=_l(Mm,r),l=Up(Mm,r),u=Qu(r),d=S.useRef(null),m=at(t,d,o.onTriggerChange),p=S.useRef(!1),y=S.useRef(!1),v=S.useCallback(()=>p.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),f.jsx(Mp,{asChild:!0,...u,children:f.jsx(Pe.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...i,ref:m,onPointerMove:Te(e.onPointerMove,b=>{b.pointerType!=="touch"&&!y.current&&!l.isPointerInTransitRef.current&&(o.onTriggerEnter(),y.current=!0)}),onPointerLeave:Te(e.onPointerLeave,()=>{o.onTriggerLeave(),y.current=!1}),onPointerDown:Te(e.onPointerDown,()=>{o.open&&o.onClose(),p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:Te(e.onFocus,()=>{p.current||o.onOpen()}),onBlur:Te(e.onBlur,o.onClose),onClick:Te(e.onClick,o.onClose)})})});G1.displayName=Mm;var Hp="TooltipPortal",[kN,zN]=Yu(Hp,{forceMount:void 0}),Z1=e=>{const{__scopeTooltip:t,forceMount:r,children:i,container:o}=e,l=_l(Hp,t);return f.jsx(kN,{scope:t,forceMount:r,children:f.jsx(gr,{present:r||l.open,children:f.jsx(bl,{asChild:!0,container:o,children:i})})})};Z1.displayName=Hp;var qs="TooltipContent",K1=S.forwardRef((e,t)=>{const r=zN(qs,e.__scopeTooltip),{forceMount:i=r.forceMount,side:o="top",...l}=e,u=_l(qs,e.__scopeTooltip);return f.jsx(gr,{present:i||u.open,children:u.disableHoverableContent?f.jsx(Y1,{side:o,...l,ref:t}):f.jsx(LN,{side:o,...l,ref:t})})}),LN=S.forwardRef((e,t)=>{const r=_l(qs,e.__scopeTooltip),i=Up(qs,e.__scopeTooltip),o=S.useRef(null),l=at(t,o),[u,d]=S.useState(null),{trigger:m,onClose:p}=r,y=o.current,{onPointerInTransitChange:v}=i,b=S.useCallback(()=>{d(null),v(!1)},[v]),x=S.useCallback((w,_)=>{const E=w.currentTarget,R={x:w.clientX,y:w.clientY},T=FN(R,E.getBoundingClientRect()),O=VN(R,T),N=UN(_.getBoundingClientRect()),k=BN([...O,...N]);d(k),v(!0)},[v]);return S.useEffect(()=>()=>b(),[b]),S.useEffect(()=>{if(m&&y){const w=E=>x(E,y),_=E=>x(E,m);return m.addEventListener("pointerleave",w),y.addEventListener("pointerleave",_),()=>{m.removeEventListener("pointerleave",w),y.removeEventListener("pointerleave",_)}}},[m,y,x,b]),S.useEffect(()=>{if(u){const w=_=>{const E=_.target,R={x:_.clientX,y:_.clientY},T=m?.contains(E)||y?.contains(E),O=!HN(R,u);T?b():O&&(b(),p())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[m,y,u,p,b]),f.jsx(Y1,{...e,ref:l})}),[$N,IN]=Yu(dl,{isInside:!1}),PN=Rj("TooltipContent"),Y1=S.forwardRef((e,t)=>{const{__scopeTooltip:r,children:i,"aria-label":o,onEscapeKeyDown:l,onPointerDownOutside:u,...d}=e,m=_l(qs,r),p=Qu(r),{onClose:y}=m;return S.useEffect(()=>(document.addEventListener(Am,y),()=>document.removeEventListener(Am,y)),[y]),S.useEffect(()=>{if(m.trigger){const v=b=>{b.target instanceof Node&&b.target.contains(m.trigger)&&y()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[m.trigger,y]),f.jsx(yl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:v=>v.preventDefault(),onDismiss:y,children:f.jsxs(Np,{"data-state":m.stateAttribute,...p,...d,ref:t,style:{...d.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:[f.jsx(PN,{children:i}),f.jsx($N,{scope:r,isInside:!0,children:f.jsx($j,{id:m.contentId,role:"tooltip",children:o||i})})]})})});K1.displayName=qs;var Q1="TooltipArrow",X1=S.forwardRef((e,t)=>{const{__scopeTooltip:r,...i}=e,o=Qu(r);return IN(Q1,r).isInside?null:f.jsx(Dp,{...o,...i,ref:t})});X1.displayName=Q1;function FN(e,t){const r=Math.abs(t.top-e.y),i=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(r,i,o,l)){case l:return"left";case o:return"right";case r:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function VN(e,t,r=5){const i=[];switch(t){case"top":i.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":i.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":i.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":i.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return i}function UN(e){const{top:t,right:r,bottom:i,left:o}=e;return[{x:o,y:t},{x:r,y:t},{x:r,y:i},{x:o,y:i}]}function HN(e,t){const{x:r,y:i}=e;let o=!1;for(let l=0,u=t.length-1;li!=b>i&&r<(v-p)*(i-y)/(b-y)+p&&(o=!o)}return o}function BN(e){const t=e.slice();return t.sort((r,i)=>r.xi.x?1:r.yi.y?1:0),qN(t)}function qN(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i=2;){const l=t[t.length-1],u=t[t.length-2];if((l.x-u.x)*(o.y-u.y)>=(l.y-u.y)*(o.x-u.x))t.pop();else break}t.push(o)}t.pop();const r=[];for(let i=e.length-1;i>=0;i--){const o=e[i];for(;r.length>=2;){const l=r[r.length-1],u=r[r.length-2];if((l.x-u.x)*(o.y-u.y)>=(l.y-u.y)*(o.x-u.x))r.pop();else break}r.push(o)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var GN=B1,ZN=q1,KN=G1,YN=Z1,QN=K1,XN=X1;function J1(e){var t,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t{const r=new Array(e.length+t.length);for(let i=0;i({classGroupId:e,validator:t}),e_=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Su="-",ax=[],eD="arbitrary..",tD=e=>{const t=rD(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return nD(u);const d=u.split(Su),m=d[0]===""&&d.length>1?1:0;return t_(d,m,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const m=i[u],p=r[u];return m?p?JN(p,m):m:p||ax}return r[u]||ax}}},t_=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],l=r.nextPart.get(o);if(l){const p=t_(e,t+1,l);if(p)return p}const u=r.validators;if(u===null)return;const d=t===0?e.join(Su):e.slice(t).join(Su),m=u.length;for(let p=0;pe.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),i=t.slice(0,r);return i?eD+i:void 0})(),rD=e=>{const{theme:t,classGroups:r}=e;return aD(r,t)},aD=(e,t)=>{const r=e_();for(const i in e){const o=e[i];Bp(o,r,i,t)}return r},Bp=(e,t,r,i)=>{const o=e.length;for(let l=0;l{if(typeof e=="string"){sD(e,t,r);return}if(typeof e=="function"){oD(e,t,r,i);return}lD(e,t,r,i)},sD=(e,t,r)=>{const i=e===""?t:n_(t,e);i.classGroupId=r},oD=(e,t,r,i)=>{if(cD(e)){Bp(e(i),t,r,i);return}t.validators===null&&(t.validators=[]),t.validators.push(WN(r,e))},lD=(e,t,r,i)=>{const o=Object.entries(e),l=o.length;for(let u=0;u{let r=e;const i=t.split(Su),o=i.length;for(let l=0;l"isThemeGetter"in e&&e.isThemeGetter===!0,uD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),i=Object.create(null);const o=(l,u)=>{r[l]=u,t++,t>e&&(t=0,i=r,r=Object.create(null))};return{get(l){let u=r[l];if(u!==void 0)return u;if((u=i[l])!==void 0)return o(l,u),u},set(l,u){l in r?r[l]=u:o(l,u)}}},Nm="!",ix=":",dD=[],sx=(e,t,r,i,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:i,isExternal:o}),fD=e=>{const{prefix:t,experimentalParseClassName:r}=e;let i=o=>{const l=[];let u=0,d=0,m=0,p;const y=o.length;for(let _=0;_m?p-m:void 0;return sx(l,x,b,w)};if(t){const o=t+ix,l=i;i=u=>u.startsWith(o)?l(u.slice(o.length)):sx(dD,!1,u,void 0,!0)}if(r){const o=i;i=l=>r({className:l,parseClassName:o})}return i},hD=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,i)=>{t.set(r,1e6+i)}),r=>{const i=[];let o=[];for(let l=0;l0&&(o.sort(),i.push(...o),o=[]),i.push(u)):o.push(u)}return o.length>0&&(o.sort(),i.push(...o)),i}},mD=e=>({cache:uD(e.cacheSize),parseClassName:fD(e),sortModifiers:hD(e),postfixLookupClassGroupIds:pD(e),...tD(e)}),pD=e=>{const t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let i=0;i{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:u}=t,d=[],m=e.trim().split(gD);let p="";for(let y=m.length-1;y>=0;y-=1){const v=m[y],{isExternal:b,modifiers:x,hasImportantModifier:w,baseClassName:_,maybePostfixModifierPosition:E}=r(v);if(b){p=v+(p.length>0?" "+p:p);continue}let R=!!E,T;if(R){const H=_.substring(0,E);T=i(H);const $=T&&u[T]?i(_):void 0;$&&$!==T&&(T=$,R=!1)}else T=i(_);if(!T){if(!R){p=v+(p.length>0?" "+p:p);continue}if(T=i(_),!T){p=v+(p.length>0?" "+p:p);continue}R=!1}const O=x.length===0?"":x.length===1?x[0]:l(x).join(":"),N=w?O+Nm:O,k=N+T;if(d.indexOf(k)>-1)continue;d.push(k);const B=o(T,R);for(let H=0;H0?" "+p:p)}return p},yD=(...e)=>{let t=0,r,i,o="";for(;t{if(typeof e=="string")return e;let t,r="";for(let i=0;i{let r,i,o,l;const u=m=>{const p=t.reduce((y,v)=>v(y),e());return r=mD(p),i=r.cache.get,o=r.cache.set,l=d,d(m)},d=m=>{const p=i(m);if(p)return p;const y=vD(m,r);return o(m,y),y};return l=u,(...m)=>l(yD(...m))},xD=[],Bt=e=>{const t=r=>r[e]||xD;return t.isThemeGetter=!0,t},a_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,i_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wD=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,SD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_D=/\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$/,CD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ED=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Da=e=>wD.test(e),Ge=e=>!!e&&!Number.isNaN(Number(e)),Cr=e=>!!e&&Number.isInteger(Number(e)),Bh=e=>e.endsWith("%")&&Ge(e.slice(0,-1)),Jr=e=>SD.test(e),s_=()=>!0,jD=e=>_D.test(e)&&!CD.test(e),qp=()=>!1,TD=e=>ED.test(e),OD=e=>RD.test(e),AD=e=>!Ce(e)&&!Ee(e),MD=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),ND=e=>Ja(e,c_,qp),Ce=e=>a_.test(e),xi=e=>Ja(e,u_,jD),ox=e=>Ja(e,FD,Ge),DD=e=>Ja(e,f_,s_),kD=e=>Ja(e,d_,qp),lx=e=>Ja(e,o_,qp),zD=e=>Ja(e,l_,OD),Yc=e=>Ja(e,h_,TD),Ee=e=>i_.test(e),qo=e=>Ii(e,u_),LD=e=>Ii(e,d_),cx=e=>Ii(e,o_),$D=e=>Ii(e,c_),ID=e=>Ii(e,l_),Qc=e=>Ii(e,h_,!0),PD=e=>Ii(e,f_,!0),Ja=(e,t,r)=>{const i=a_.exec(e);return i?i[1]?t(i[1]):r(i[2]):!1},Ii=(e,t,r=!1)=>{const i=i_.exec(e);return i?i[1]?t(i[1]):r:!1},o_=e=>e==="position"||e==="percentage",l_=e=>e==="image"||e==="url",c_=e=>e==="length"||e==="size"||e==="bg-size",u_=e=>e==="length",FD=e=>e==="number",d_=e=>e==="family-name",f_=e=>e==="number"||e==="weight",h_=e=>e==="shadow",VD=()=>{const e=Bt("color"),t=Bt("font"),r=Bt("text"),i=Bt("font-weight"),o=Bt("tracking"),l=Bt("leading"),u=Bt("breakpoint"),d=Bt("container"),m=Bt("spacing"),p=Bt("radius"),y=Bt("shadow"),v=Bt("inset-shadow"),b=Bt("text-shadow"),x=Bt("drop-shadow"),w=Bt("blur"),_=Bt("perspective"),E=Bt("aspect"),R=Bt("ease"),T=Bt("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],k=()=>[...N(),Ee,Ce],B=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto","contain","none"],$=()=>[Ee,Ce,m],he=()=>[Da,"full","auto",...$()],be=()=>[Cr,"none","subgrid",Ee,Ce],pe=()=>["auto",{span:["full",Cr,Ee,Ce]},Cr,Ee,Ce],fe=()=>[Cr,"auto",Ee,Ce],ue=()=>["auto","min","max","fr",Ee,Ce],ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ve=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...$()],Z=()=>[Da,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...$()],ne=()=>[Da,"screen","full","dvw","lvw","svw","min","max","fit",...$()],X=()=>[Da,"screen","full","lh","dvh","lvh","svh","min","max","fit",...$()],te=()=>[e,Ee,Ce],D=()=>[...N(),cx,lx,{position:[Ee,Ce]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",$D,ND,{size:[Ee,Ce]}],Q=()=>[Bh,qo,xi],K=()=>["","none","full",p,Ee,Ce],de=()=>["",Ge,qo,xi],re=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],we=()=>[Ge,Bh,cx,lx],Me=()=>["","none",w,Ee,Ce],Fe=()=>["none",Ge,Ee,Ce],He=()=>["none",Ge,Ee,Ce],ct=()=>[Ge,Ee,Ce],Je=()=>[Da,"full",...$()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Jr],breakpoint:[Jr],color:[s_],container:[Jr],"drop-shadow":[Jr],ease:["in","out","in-out"],font:[AD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Jr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Jr],shadow:[Jr],spacing:["px",Ge],text:[Jr],"text-shadow":[Jr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Da,Ce,Ee,E]}],container:["container"],"container-type":[{"@container":["","normal","size",Ee,Ce]}],"container-named":[MD],columns:[{columns:[Ge,Ce,Ee,d]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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"],sr:["sr-only","not-sr-only"],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:k()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:H()}],"overscroll-x":[{"overscroll-x":H()}],"overscroll-y":[{"overscroll-y":H()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:he()}],"inset-x":[{"inset-x":he()}],"inset-y":[{"inset-y":he()}],start:[{"inset-s":he(),start:he()}],end:[{"inset-e":he(),end:he()}],"inset-bs":[{"inset-bs":he()}],"inset-be":[{"inset-be":he()}],top:[{top:he()}],right:[{right:he()}],bottom:[{bottom:he()}],left:[{left:he()}],visibility:["visible","invisible","collapse"],z:[{z:[Cr,"auto",Ee,Ce]}],basis:[{basis:[Da,"full","auto",d,...$()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ge,Da,"auto","initial","none",Ce]}],grow:[{grow:["",Ge,Ee,Ce]}],shrink:[{shrink:["",Ge,Ee,Ce]}],order:[{order:[Cr,"first","last","none",Ee,Ce]}],"grid-cols":[{"grid-cols":be()}],"col-start-end":[{col:pe()}],"col-start":[{"col-start":fe()}],"col-end":[{"col-end":fe()}],"grid-rows":[{"grid-rows":be()}],"row-start-end":[{row:pe()}],"row-start":[{"row-start":fe()}],"row-end":[{"row-end":fe()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ue()}],"auto-rows":[{"auto-rows":ue()}],gap:[{gap:$()}],"gap-x":[{"gap-x":$()}],"gap-y":[{"gap-y":$()}],"justify-content":[{justify:[...ee(),"normal"]}],"justify-items":[{"justify-items":[...ve(),"normal"]}],"justify-self":[{"justify-self":["auto",...ve()]}],"align-content":[{content:["normal",...ee()]}],"align-items":[{items:[...ve(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ve(),{baseline:["","last"]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...ve(),"baseline"]}],"place-self":[{"place-self":["auto",...ve()]}],p:[{p:$()}],px:[{px:$()}],py:[{py:$()}],ps:[{ps:$()}],pe:[{pe:$()}],pbs:[{pbs:$()}],pbe:[{pbe:$()}],pt:[{pt:$()}],pr:[{pr:$()}],pb:[{pb:$()}],pl:[{pl:$()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mbs:[{mbs:L()}],mbe:[{mbe:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":$()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":$()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...ne()]}],"min-inline-size":[{"min-inline":["auto",...ne()]}],"max-inline-size":[{"max-inline":["none",...ne()]}],"block-size":[{block:["auto",...X()]}],"min-block-size":[{"min-block":["auto",...X()]}],"max-block-size":[{"max-block":["none",...X()]}],w:[{w:[d,"screen",...Z()]}],"min-w":[{"min-w":[d,"screen","none",...Z()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,qo,xi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,PD,DD]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Bh,Ce]}],"font-family":[{font:[LD,kD,t]}],"font-features":[{"font-features":[Ce]}],"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-fractions"],tracking:[{tracking:[o,Ee,Ce]}],"line-clamp":[{"line-clamp":[Ge,"none",Ee,ox]}],leading:[{leading:[l,...$()]}],"list-image":[{"list-image":["none",Ee,Ce]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ee,Ce]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:te()}],"text-color":[{text:te()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...re(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ge,"from-font","auto",Ee,xi]}],"text-decoration-color":[{decoration:te()}],"underline-offset":[{"underline-offset":[Ge,"auto",Ee,Ce]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"tab-size":[{tab:[Cr,Ee,Ce]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ee,Ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ee,Ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Cr,Ee,Ce],radial:["",Ee,Ce],conic:[Cr,Ee,Ce]},ID,zD]}],"bg-color":[{bg:te()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:te()}],"gradient-via":[{via:te()}],"gradient-to":[{to:te()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:de()}],"border-w-x":[{"border-x":de()}],"border-w-y":[{"border-y":de()}],"border-w-s":[{"border-s":de()}],"border-w-e":[{"border-e":de()}],"border-w-bs":[{"border-bs":de()}],"border-w-be":[{"border-be":de()}],"border-w-t":[{"border-t":de()}],"border-w-r":[{"border-r":de()}],"border-w-b":[{"border-b":de()}],"border-w-l":[{"border-l":de()}],"divide-x":[{"divide-x":de()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":de()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...re(),"hidden","none"]}],"divide-style":[{divide:[...re(),"hidden","none"]}],"border-color":[{border:te()}],"border-color-x":[{"border-x":te()}],"border-color-y":[{"border-y":te()}],"border-color-s":[{"border-s":te()}],"border-color-e":[{"border-e":te()}],"border-color-bs":[{"border-bs":te()}],"border-color-be":[{"border-be":te()}],"border-color-t":[{"border-t":te()}],"border-color-r":[{"border-r":te()}],"border-color-b":[{"border-b":te()}],"border-color-l":[{"border-l":te()}],"divide-color":[{divide:te()}],"outline-style":[{outline:[...re(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ge,Ee,Ce]}],"outline-w":[{outline:["",Ge,qo,xi]}],"outline-color":[{outline:te()}],shadow:[{shadow:["","none",y,Qc,Yc]}],"shadow-color":[{shadow:te()}],"inset-shadow":[{"inset-shadow":["none",v,Qc,Yc]}],"inset-shadow-color":[{"inset-shadow":te()}],"ring-w":[{ring:de()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:te()}],"ring-offset-w":[{"ring-offset":[Ge,xi]}],"ring-offset-color":[{"ring-offset":te()}],"inset-ring-w":[{"inset-ring":de()}],"inset-ring-color":[{"inset-ring":te()}],"text-shadow":[{"text-shadow":["none",b,Qc,Yc]}],"text-shadow-color":[{"text-shadow":te()}],opacity:[{opacity:[Ge,Ee,Ce]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":we()}],"mask-image-linear-to-pos":[{"mask-linear-to":we()}],"mask-image-linear-from-color":[{"mask-linear-from":te()}],"mask-image-linear-to-color":[{"mask-linear-to":te()}],"mask-image-t-from-pos":[{"mask-t-from":we()}],"mask-image-t-to-pos":[{"mask-t-to":we()}],"mask-image-t-from-color":[{"mask-t-from":te()}],"mask-image-t-to-color":[{"mask-t-to":te()}],"mask-image-r-from-pos":[{"mask-r-from":we()}],"mask-image-r-to-pos":[{"mask-r-to":we()}],"mask-image-r-from-color":[{"mask-r-from":te()}],"mask-image-r-to-color":[{"mask-r-to":te()}],"mask-image-b-from-pos":[{"mask-b-from":we()}],"mask-image-b-to-pos":[{"mask-b-to":we()}],"mask-image-b-from-color":[{"mask-b-from":te()}],"mask-image-b-to-color":[{"mask-b-to":te()}],"mask-image-l-from-pos":[{"mask-l-from":we()}],"mask-image-l-to-pos":[{"mask-l-to":we()}],"mask-image-l-from-color":[{"mask-l-from":te()}],"mask-image-l-to-color":[{"mask-l-to":te()}],"mask-image-x-from-pos":[{"mask-x-from":we()}],"mask-image-x-to-pos":[{"mask-x-to":we()}],"mask-image-x-from-color":[{"mask-x-from":te()}],"mask-image-x-to-color":[{"mask-x-to":te()}],"mask-image-y-from-pos":[{"mask-y-from":we()}],"mask-image-y-to-pos":[{"mask-y-to":we()}],"mask-image-y-from-color":[{"mask-y-from":te()}],"mask-image-y-to-color":[{"mask-y-to":te()}],"mask-image-radial":[{"mask-radial":[Ee,Ce]}],"mask-image-radial-from-pos":[{"mask-radial-from":we()}],"mask-image-radial-to-pos":[{"mask-radial-to":we()}],"mask-image-radial-from-color":[{"mask-radial-from":te()}],"mask-image-radial-to-color":[{"mask-radial-to":te()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[Ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":we()}],"mask-image-conic-to-pos":[{"mask-conic-to":we()}],"mask-image-conic-from-color":[{"mask-conic-from":te()}],"mask-image-conic-to-color":[{"mask-conic-to":te()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ee,Ce]}],filter:[{filter:["","none",Ee,Ce]}],blur:[{blur:Me()}],brightness:[{brightness:[Ge,Ee,Ce]}],contrast:[{contrast:[Ge,Ee,Ce]}],"drop-shadow":[{"drop-shadow":["","none",x,Qc,Yc]}],"drop-shadow-color":[{"drop-shadow":te()}],grayscale:[{grayscale:["",Ge,Ee,Ce]}],"hue-rotate":[{"hue-rotate":[Ge,Ee,Ce]}],invert:[{invert:["",Ge,Ee,Ce]}],saturate:[{saturate:[Ge,Ee,Ce]}],sepia:[{sepia:["",Ge,Ee,Ce]}],"backdrop-filter":[{"backdrop-filter":["","none",Ee,Ce]}],"backdrop-blur":[{"backdrop-blur":Me()}],"backdrop-brightness":[{"backdrop-brightness":[Ge,Ee,Ce]}],"backdrop-contrast":[{"backdrop-contrast":[Ge,Ee,Ce]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ge,Ee,Ce]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ge,Ee,Ce]}],"backdrop-invert":[{"backdrop-invert":["",Ge,Ee,Ce]}],"backdrop-opacity":[{"backdrop-opacity":[Ge,Ee,Ce]}],"backdrop-saturate":[{"backdrop-saturate":[Ge,Ee,Ce]}],"backdrop-sepia":[{"backdrop-sepia":["",Ge,Ee,Ce]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":$()}],"border-spacing-x":[{"border-spacing-x":$()}],"border-spacing-y":[{"border-spacing-y":$()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ee,Ce]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ge,"initial",Ee,Ce]}],ease:[{ease:["linear","initial",R,Ee,Ce]}],delay:[{delay:[Ge,Ee,Ce]}],animate:[{animate:["none",T,Ee,Ce]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,Ee,Ce]}],"perspective-origin":[{"perspective-origin":k()}],rotate:[{rotate:Fe()}],"rotate-x":[{"rotate-x":Fe()}],"rotate-y":[{"rotate-y":Fe()}],"rotate-z":[{"rotate-z":Fe()}],scale:[{scale:He()}],"scale-x":[{"scale-x":He()}],"scale-y":[{"scale-y":He()}],"scale-z":[{"scale-z":He()}],"scale-3d":["scale-3d"],skew:[{skew:ct()}],"skew-x":[{"skew-x":ct()}],"skew-y":[{"skew-y":ct()}],transform:[{transform:[Ee,Ce,"","none","gpu","cpu"]}],"transform-origin":[{origin:k()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Je()}],"translate-x":[{"translate-x":Je()}],"translate-y":[{"translate-y":Je()}],"translate-z":[{"translate-z":Je()}],"translate-none":["translate-none"],zoom:[{zoom:[Cr,Ee,Ce]}],accent:[{accent:te()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:te()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Ee,Ce]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":te()}],"scrollbar-track-color":[{"scrollbar-track":te()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mbs":[{"scroll-mbs":$()}],"scroll-mbe":[{"scroll-mbe":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pbs":[{"scroll-pbs":$()}],"scroll-pbe":[{"scroll-pbe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"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",Ee,Ce]}],fill:[{fill:["none",...te()]}],"stroke-w":[{stroke:[Ge,qo,xi,ox]}],stroke:[{stroke:["none",...te()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","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-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","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-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","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-pbs","scroll-pbe","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"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},UD=bD(VD);function We(...e){return UD(W1(e))}function HD({delayDuration:e=0,...t}){return f.jsx(GN,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function BD({...e}){return f.jsx(ZN,{"data-slot":"tooltip",...e})}function qD({...e}){return f.jsx(KN,{"data-slot":"tooltip-trigger",...e})}function GD({className:e,sideOffset:t=0,children:r,...i}){return f.jsx(YN,{children:f.jsxs(QN,{"data-slot":"tooltip-content",sideOffset:t,className:We("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...i,children:[r,f.jsx(XN,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}const Dm=new Set;function ZD(e){return Dm.add(e),()=>Dm.delete(e)}function KD(){for(const e of Dm)e()}const m_=(...e)=>e.filter((t,r,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===r).join(" ").trim();const YD=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const QD=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,i)=>i?i.toUpperCase():r.toLowerCase());const ux=e=>{const t=QD(e);return t.charAt(0).toUpperCase()+t.slice(1)};var qh={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"};const XD=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},JD=S.createContext({}),WD=()=>S.useContext(JD),ek=S.forwardRef(({color:e,size:t,strokeWidth:r,absoluteStrokeWidth:i,className:o="",children:l,iconNode:u,...d},m)=>{const{size:p=24,strokeWidth:y=2,absoluteStrokeWidth:v=!1,color:b="currentColor",className:x=""}=WD()??{},w=i??v?Number(r??y)*24/Number(t??p):r??y;return S.createElement("svg",{ref:m,...qh,width:t??p??qh.width,height:t??p??qh.height,stroke:e??b,strokeWidth:w,className:m_("lucide",x,o),...!l&&!XD(d)&&{"aria-hidden":"true"},...d},[...u.map(([_,E])=>S.createElement(_,E)),...Array.isArray(l)?l:[l]])});const De=(e,t)=>{const r=S.forwardRef(({className:i,...o},l)=>S.createElement(ek,{ref:l,iconNode:t,className:m_(`lucide-${YD(ux(e))}`,`lucide-${e}`,i),...o}));return r.displayName=ux(e),r};const tk=[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]],nk=De("beaker",tk);const rk=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],ak=De("book-open",rk);const ik=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],sk=De("briefcase",ik);const ok=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],lk=De("bug",ok);const ck=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],uk=De("calendar",ck);const dk=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],p_=De("check",dk);const fk=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Gp=De("chevron-down",fk);const hk=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],mk=De("chevron-right",hk);const pk=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],gk=De("chevron-up",pk);const vk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],yk=De("circle-check",vk);const bk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],g_=De("clock",bk);const xk=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],wk=De("code",xk);const Sk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]],_k=De("compass",Sk);const Ck=[["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"}]],Ek=De("copy",Ck);const Rk=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],jk=De("credit-card",Rk);const Tk=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Ok=De("database",Tk);const Ak=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Mk=De("download",Ak);const Nk=[["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"}]],Dk=De("ellipsis",Nk);const kk=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],v_=De("file-text",kk);const zk=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],Lk=De("flag",zk);const $k=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Zp=De("folder",$k);const Ik=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Pk=De("gauge",Ik);const Fk=[["path",{d:"m14 13-8.381 8.38a1 1 0 0 1-3.001-3l8.384-8.381",key:"pgg06f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m21.5 10.5-8-8",key:"a17d9x"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m8.5 7.5 8 8",key:"1oyaui"}]],Vk=De("gavel",Fk);const Uk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],y_=De("globe",Uk);const Hk=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],Bk=De("graduation-cap",Hk);const qk=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Gk=De("heart",qk);const Zk=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Kk=De("history",Zk);const Yk=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Qk=De("image",Yk);const Xk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Jk=De("info",Xk);const Wk=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],ez=De("layout-dashboard",Wk);const tz=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],nz=De("lightbulb",tz);const rz=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],az=De("link",rz);const iz=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],sz=De("loader-circle",iz);const oz=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],b_=De("lock",oz);const lz=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],cz=De("log-out",lz);const uz=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],dz=De("megaphone",uz);const fz=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],hz=De("menu",fz);const mz=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],pz=De("music",mz);const gz=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],vz=De("octagon-x",gz);const yz=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],bz=De("package",yz);const xz=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],wz=De("pen-line",xz);const Sz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],_z=De("plus",Sz);const Cz=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],Ez=De("rocket",Cz);const Rz=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],x_=De("search",Rz);const jz=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Tz=De("settings",jz);const Oz=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Az=De("share-2",Oz);const Mz=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],w_=De("shield",Mz);const Nz=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],S_=De("square-terminal",Nz);const Dz=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],kz=De("star",Dz);const zz=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Lz=De("trash-2",zz);const $z=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],__=De("triangle-alert",$z);const Iz=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Pz=De("upload",Iz);const Fz=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],C_=De("users",Fz);const Vz=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Uz=De("wrench",Vz);const Hz=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],E_=De("x",Hz);function Bz(){const e=!document.body.classList.contains("sb-open");document.body.classList.toggle("sb-open"),Xu(),e?document.getElementById("sidebar")?.querySelector(qz)?.focus():document.getElementById("menu-btn")?.focus()}const qz='a[href], button:not(:disabled), select, input, [tabindex]:not([tabindex="-1"])';function hr(){const e=document.body.classList.contains("sb-open");document.body.classList.remove("sb-open"),Xu(),e&&window.innerWidth<=lu&&document.getElementById("menu-btn")?.focus()}const lu=900;function Xu(){const e=document.getElementById("sidebar");if(!e)return;const t=document.body.classList.contains("sb-open");window.innerWidth<=lu&&!t?e.setAttribute("inert",""):e.removeAttribute("inert");const i=document.getElementById("main");i&&(t&&window.innerWidth<=lu?i.setAttribute("inert",""):i.removeAttribute("inert")),e.setAttribute("aria-modal",String(t&&window.innerWidth<=lu)),document.getElementById("menu-btn")?.setAttribute("aria-expanded",String(t))}typeof window<"u"&&(window.addEventListener("resize",Xu),window.addEventListener("keydown",e=>{e.key==="Escape"&&document.body.classList.contains("sb-open")&&hr()}));const Gz={alert:__,card:jk,check:p_,chev:mk,chevd:Gp,clock:g_,copy:Ek,doc:v_,dots:Dk,download:Mk,folder:Zp,dashboard:ez,gear:Tz,globe:y_,hist:Kk,link:az,lock:b_,menu:hz,plus:_z,power:cz,search:x_,share:Az,shield:w_,terminal:S_,trash:Lz,upload:Pz,users:C_,x:E_};function rt({name:e}){const t=Gz[e];return t?f.jsx(t,{className:"ico","aria-hidden":"true"}):null}const km={folder:Zp,"book-open":ak,"file-text":v_,"pen-line":wz,users:C_,briefcase:sk,megaphone:dz,rocket:Ez,lightbulb:nz,flag:Lk,star:kz,heart:Gk,code:wk,"square-terminal":S_,bug:lk,wrench:Uz,database:Ok,package:bz,beaker:nk,gauge:Pk,shield:w_,lock:b_,gavel:Vk,globe:y_,compass:_k,calendar:uk,clock:g_,"graduation-cap":Bk,image:Qk,music:pz};function Ps({name:e,className:t}){const r=e??"",i=Object.hasOwn(km,r)?km[r]:Zp;return f.jsx(i,{className:t,"aria-hidden":"true"})}function Zz({size:e=22}){return f.jsxs("svg",{width:e,height:e,viewBox:"0 0 32 32",fill:"currentColor",role:"img","aria-label":"BearDrive",children:[f.jsx("rect",{x:"4",y:"4",width:"5.6",height:"24"}),f.jsx("rect",{x:"11.2",y:"4",width:"14.4",height:"11.2"}),f.jsx("rect",{x:"11.2",y:"16.8",width:"16.8",height:"11.2"})]})}function _u(e){const t=["page",e.width??"app",e.className].filter(Boolean).join(" ");return f.jsx("div",{className:t,children:e.children})}function Kz(e){e&&Xu()}function fl(e){return f.jsxs(f.Fragment,{children:[f.jsx("div",{id:"sb-backdrop",onClick:hr}),f.jsxs("aside",{id:"sidebar",ref:Kz,children:[e.vault,e.projectsNav,e.tree??f.jsx("nav",{id:"tree","aria-label":"Files"}),e.orgBar]}),f.jsxs("main",{id:"main",children:[e.topbar,f.jsx("article",{id:"content",ref:e.contentRef,onScroll:e.onContentScroll,children:e.children})]})]})}function Ju(e){const{name:t,onHome:r,showSignout:i,search:o,beta:l}=e;return f.jsxs("header",{id:"vault",children:[f.jsx("span",{id:"vault-badge",children:f.jsx(Zz,{size:22})}),f.jsx("span",{id:"vault-name",className:r?"vault-link":void 0,onClick:r,role:r?"button":void 0,tabIndex:r?0:void 0,onKeyDown:u=>{r&&(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r())},children:t}),l&&f.jsx("span",{id:"vault-beta",children:"Beta"}),f.jsxs("div",{className:"vault-actions",children:[o&&f.jsxs(BD,{delayDuration:150,children:[f.jsx(qD,{asChild:!0,children:f.jsx("button",{id:"search-btn",className:"icon-btn2","aria-label":"Search",onClick:()=>{KD(),hr()},children:f.jsx(rt,{name:"search"})})}),f.jsxs(GD,{className:"tipcard",sideOffset:6,children:["Search ",f.jsx("kbd",{children:"⌘K"})]})]}),i&&f.jsx("a",{id:"signout",href:"/auth/logout",title:"Sign out","aria-label":"Sign out",children:f.jsx(rt,{name:"power"})})]})]})}function hl(e){return f.jsxs("header",{id:"topbar",children:[f.jsx("button",{id:"menu-btn",className:"icon-btn",title:"Menu","aria-label":"Menu","aria-controls":"sidebar","aria-expanded":"false",onClick:Bz,children:f.jsx(rt,{name:"menu"})}),f.jsx("span",{id:"crumb",children:e.crumb}),f.jsx("span",{id:"meta",children:e.meta}),e.actions]})}function Yz(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const Qz=e=>{switch(e){case"success":return Wz;case"info":return t3;case"warning":return e3;case"error":return n3;default:return null}},Xz=Array(12).fill(0),Jz=({visible:e,className:t})=>ge.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ge.createElement("div",{className:"sonner-spinner"},Xz.map((r,i)=>ge.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),Wz=ge.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ge.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),e3=ge.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ge.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),t3=ge.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ge.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),n3=ge.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ge.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),r3=ge.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ge.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ge.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),a3=()=>{const[e,t]=ge.useState(document.hidden);return ge.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let zm=1;class i3{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:i,...o}=t,l=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:zm++,u=this.toasts.find(m=>m.id===l),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(m=>m.id===l?(this.publish({...m,...t,id:l,title:i}),{...m,...t,id:l,dismissible:d,title:i}):m):this.addToast({title:i,...o,dismissible:d,id:l}),l},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(i=>i({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let i;r.loading!==void 0&&(i=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const o=Promise.resolve(t instanceof Function?t():t);let l=i!==void 0,u;const d=o.then(async p=>{if(u=["resolve",p],ge.isValidElement(p))l=!1,this.create({id:i,type:"default",message:p});else if(o3(p)&&!p.ok){l=!1;const v=typeof r.error=="function"?await r.error(`HTTP error! status: ${p.status}`):r.error,b=typeof r.description=="function"?await r.description(`HTTP error! status: ${p.status}`):r.description,w=typeof v=="object"&&!ge.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:b,...w})}else if(p instanceof Error){l=!1;const v=typeof r.error=="function"?await r.error(p):r.error,b=typeof r.description=="function"?await r.description(p):r.description,w=typeof v=="object"&&!ge.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:b,...w})}else if(r.success!==void 0){l=!1;const v=typeof r.success=="function"?await r.success(p):r.success,b=typeof r.description=="function"?await r.description(p):r.description,w=typeof v=="object"&&!ge.isValidElement(v)?v:{message:v};this.create({id:i,type:"success",description:b,...w})}}).catch(async p=>{if(u=["reject",p],r.error!==void 0){l=!1;const y=typeof r.error=="function"?await r.error(p):r.error,v=typeof r.description=="function"?await r.description(p):r.description,x=typeof y=="object"&&!ge.isValidElement(y)?y:{message:y};this.create({id:i,type:"error",description:v,...x})}}).finally(()=>{l&&(this.dismiss(i),i=void 0),r.finally==null||r.finally.call(r)}),m=()=>new Promise((p,y)=>d.then(()=>u[0]==="reject"?y(u[1]):p(u[1])).catch(y));return typeof i!="string"&&typeof i!="number"?{unwrap:m}:Object.assign(i,{unwrap:m})},this.custom=(t,r)=>{const i=r?.id||zm++;return this.create({jsx:t(i),id:i,...r}),i},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Tn=new i3,s3=(e,t)=>{const r=t?.id||zm++;return Tn.addToast({title:e,...t,id:r}),r},o3=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",l3=s3,c3=()=>Tn.toasts,u3=()=>Tn.getActiveToasts(),dx=Object.assign(l3,{success:Tn.success,info:Tn.info,warning:Tn.warning,error:Tn.error,custom:Tn.custom,message:Tn.message,promise:Tn.promise,dismiss:Tn.dismiss,loading:Tn.loading},{getHistory:c3,getToasts:u3});Yz("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Xc(e){return e.label!==void 0}const d3=3,f3="24px",h3="16px",fx=4e3,m3=356,p3=14,g3=45,v3=200;function Er(...e){return e.filter(Boolean).join(" ")}function y3(e){const[t,r]=e.split("-"),i=[];return t&&i.push(t),r&&i.push(r),i}const b3=e=>{var t,r,i,o,l,u,d,m,p;const{invert:y,toast:v,unstyled:b,interacting:x,setHeights:w,visibleToasts:_,heights:E,index:R,toasts:T,expanded:O,removeToast:N,defaultRichColors:k,closeButton:B,style:H,cancelButtonStyle:$,actionButtonStyle:he,className:be="",descriptionClassName:pe="",duration:fe,position:ue,gap:ee,expandByDefault:ve,classNames:L,icons:Z,closeButtonAriaLabel:ne="Close toast"}=e,[X,te]=ge.useState(null),[D,M]=ge.useState(null),[U,Q]=ge.useState(!1),[K,de]=ge.useState(!1),[re,xe]=ge.useState(!1),[we,Me]=ge.useState(!1),[Fe,He]=ge.useState(!1),[ct,Je]=ge.useState(0),[hn,mn]=ge.useState(0),Xt=ge.useRef(v.duration||fe||fx),yr=ge.useRef(null),At=ge.useRef(null),rr=R===0,br=R+1<=_,Rt=v.type,Vn=v.dismissible!==!1,zt=v.className||"",Dr=v.descriptionClassName||"",ar=ge.useMemo(()=>E.findIndex(Ae=>Ae.toastId===v.id)||0,[E,v.id]),oa=ge.useMemo(()=>{var Ae;return(Ae=v.closeButton)!=null?Ae:B},[v.closeButton,B]),ir=ge.useMemo(()=>v.duration||fe||fx,[v.duration,fe]),la=ge.useRef(0),Jt=ge.useRef(0),A=ge.useRef(0),P=ge.useRef(null),[F,ce]=ue.split("-"),se=ge.useMemo(()=>E.reduce((Ae,ut,st)=>st>=ar?Ae:Ae+ut.height,0),[E,ar]),ye=a3(),Se=v.invert||y,W=Rt==="loading";Jt.current=ge.useMemo(()=>ar*ee+se,[ar,se]),ge.useEffect(()=>{Xt.current=ir},[ir]),ge.useEffect(()=>{Q(!0)},[]),ge.useEffect(()=>{const Ae=At.current;if(Ae){const ut=Ae.getBoundingClientRect().height;return mn(ut),w(st=>[{toastId:v.id,height:ut,position:v.position},...st]),()=>w(st=>st.filter(Gt=>Gt.toastId!==v.id))}},[w,v.id]),ge.useLayoutEffect(()=>{if(!U)return;const Ae=At.current,ut=Ae.style.height;Ae.style.height="auto";const st=Ae.getBoundingClientRect().height;Ae.style.height=ut,mn(st),w(Gt=>Gt.find(Ct=>Ct.toastId===v.id)?Gt.map(Ct=>Ct.toastId===v.id?{...Ct,height:st}:Ct):[{toastId:v.id,height:st,position:v.position},...Gt])},[U,v.title,v.description,w,v.id,v.jsx,v.action,v.cancel]);const oe=ge.useCallback(()=>{de(!0),Je(Jt.current),w(Ae=>Ae.filter(ut=>ut.toastId!==v.id)),setTimeout(()=>{N(v)},v3)},[v,N,w,Jt]);ge.useEffect(()=>{if(v.promise&&Rt==="loading"||v.duration===1/0||v.type==="loading")return;let Ae;return O||x||ye?(()=>{if(A.current{v.onAutoClose==null||v.onAutoClose.call(v,v),oe()},Xt.current)),()=>clearTimeout(Ae)},[O,x,v,Rt,ye,oe]),ge.useEffect(()=>{v.delete&&(oe(),v.onDismiss==null||v.onDismiss.call(v,v))},[oe,v.delete]);function Re(){var Ae;if(Z?.loading){var ut;return ge.createElement("div",{className:Er(L?.loader,v==null||(ut=v.classNames)==null?void 0:ut.loader,"sonner-loader"),"data-visible":Rt==="loading"},Z.loading)}return ge.createElement(Jz,{className:Er(L?.loader,v==null||(Ae=v.classNames)==null?void 0:Ae.loader),visible:Rt==="loading"})}const ze=v.icon||Z?.[Rt]||Qz(Rt);var it,_t;return ge.createElement("li",{tabIndex:0,ref:At,className:Er(be,zt,L?.toast,v==null||(t=v.classNames)==null?void 0:t.toast,L?.default,L?.[Rt],v==null||(r=v.classNames)==null?void 0:r[Rt]),"data-sonner-toast":"","data-rich-colors":(it=v.richColors)!=null?it:k,"data-styled":!(v.jsx||v.unstyled||b),"data-mounted":U,"data-promise":!!v.promise,"data-swiped":Fe,"data-removed":K,"data-visible":br,"data-y-position":F,"data-x-position":ce,"data-index":R,"data-front":rr,"data-swiping":re,"data-dismissible":Vn,"data-type":Rt,"data-invert":Se,"data-swipe-out":we,"data-swipe-direction":D,"data-expanded":!!(O||ve&&U),"data-testid":v.testId,style:{"--index":R,"--toasts-before":R,"--z-index":T.length-R,"--offset":`${K?ct:Jt.current}px`,"--initial-height":ve?"auto":`${hn}px`,...H,...v.style},onDragEnd:()=>{xe(!1),te(null),P.current=null},onPointerDown:Ae=>{Ae.button!==2&&(W||!Vn||(yr.current=new Date,Je(Jt.current),Ae.target.setPointerCapture(Ae.pointerId),Ae.target.tagName!=="BUTTON"&&(xe(!0),P.current={x:Ae.clientX,y:Ae.clientY})))},onPointerUp:()=>{var Ae,ut,st;if(we||!Vn)return;P.current=null;const Gt=Number(((Ae=At.current)==null?void 0:Ae.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),sr=Number(((ut=At.current)==null?void 0:ut.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ct=new Date().getTime()-((st=yr.current)==null?void 0:st.getTime()),yn=X==="x"?Gt:sr,ti=Math.abs(yn)/Ct;if(Math.abs(yn)>=g3||ti>.11){Je(Jt.current),v.onDismiss==null||v.onDismiss.call(v,v),M(X==="x"?Gt>0?"right":"left":sr>0?"down":"up"),oe(),Me(!0);return}else{var bn,xn;(bn=At.current)==null||bn.style.setProperty("--swipe-amount-x","0px"),(xn=At.current)==null||xn.style.setProperty("--swipe-amount-y","0px")}He(!1),xe(!1),te(null)},onPointerMove:Ae=>{var ut,st,Gt;if(!P.current||!Vn||((ut=window.getSelection())==null?void 0:ut.toString().length)>0)return;const Ct=Ae.clientY-P.current.y,yn=Ae.clientX-P.current.x;var ti;const bn=(ti=e.swipeDirections)!=null?ti:y3(ue);!X&&(Math.abs(yn)>1||Math.abs(Ct)>1)&&te(Math.abs(yn)>Math.abs(Ct)?"x":"y");let xn={x:0,y:0};const Fi=or=>1/(1.5+Math.abs(or)/20);if(X==="y"){if(bn.includes("top")||bn.includes("bottom"))if(bn.includes("top")&&Ct<0||bn.includes("bottom")&&Ct>0)xn.y=Ct;else{const or=Ct*Fi(Ct);xn.y=Math.abs(or)0)xn.x=yn;else{const or=yn*Fi(yn);xn.x=Math.abs(or)0||Math.abs(xn.y)>0)&&He(!0),(st=At.current)==null||st.style.setProperty("--swipe-amount-x",`${xn.x}px`),(Gt=At.current)==null||Gt.style.setProperty("--swipe-amount-y",`${xn.y}px`)}},oa&&!v.jsx&&Rt!=="loading"?ge.createElement("button",{"aria-label":ne,"data-disabled":W,"data-close-button":!0,onClick:W||!Vn?()=>{}:()=>{oe(),v.onDismiss==null||v.onDismiss.call(v,v)},className:Er(L?.closeButton,v==null||(i=v.classNames)==null?void 0:i.closeButton)},(_t=Z?.close)!=null?_t:r3):null,(Rt||v.icon||v.promise)&&v.icon!==null&&(Z?.[Rt]!==null||v.icon)?ge.createElement("div",{"data-icon":"",className:Er(L?.icon,v==null||(o=v.classNames)==null?void 0:o.icon)},v.promise||v.type==="loading"&&!v.icon?v.icon||Re():null,v.type!=="loading"?ze:null):null,ge.createElement("div",{"data-content":"",className:Er(L?.content,v==null||(l=v.classNames)==null?void 0:l.content)},ge.createElement("div",{"data-title":"",className:Er(L?.title,v==null||(u=v.classNames)==null?void 0:u.title)},v.jsx?v.jsx:typeof v.title=="function"?v.title():v.title),v.description?ge.createElement("div",{"data-description":"",className:Er(pe,Dr,L?.description,v==null||(d=v.classNames)==null?void 0:d.description)},typeof v.description=="function"?v.description():v.description):null),ge.isValidElement(v.cancel)?v.cancel:v.cancel&&Xc(v.cancel)?ge.createElement("button",{"data-button":!0,"data-cancel":!0,style:v.cancelButtonStyle||$,onClick:Ae=>{Xc(v.cancel)&&Vn&&(v.cancel.onClick==null||v.cancel.onClick.call(v.cancel,Ae),oe())},className:Er(L?.cancelButton,v==null||(m=v.classNames)==null?void 0:m.cancelButton)},v.cancel.label):null,ge.isValidElement(v.action)?v.action:v.action&&Xc(v.action)?ge.createElement("button",{"data-button":!0,"data-action":!0,style:v.actionButtonStyle||he,onClick:Ae=>{Xc(v.action)&&(v.action.onClick==null||v.action.onClick.call(v.action,Ae),!Ae.defaultPrevented&&oe())},className:Er(L?.actionButton,v==null||(p=v.classNames)==null?void 0:p.actionButton)},v.action.label):null)};function hx(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function x3(e,t){const r={};return[e,t].forEach((i,o)=>{const l=o===1,u=l?"--mobile-offset":"--offset",d=l?h3:f3;function m(p){["top","right","bottom","left"].forEach(y=>{r[`${u}-${y}`]=typeof p=="number"?`${p}px`:p})}typeof i=="number"||typeof i=="string"?m(i):typeof i=="object"?["top","right","bottom","left"].forEach(p=>{i[p]===void 0?r[`${u}-${p}`]=d:r[`${u}-${p}`]=typeof i[p]=="number"?`${i[p]}px`:i[p]}):m(d)}),r}const w3=ge.forwardRef(function(t,r){const{id:i,invert:o,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:m,className:p,offset:y,mobileOffset:v,theme:b="light",richColors:x,duration:w,style:_,visibleToasts:E=d3,toastOptions:R,dir:T=hx(),gap:O=p3,icons:N,containerAriaLabel:k="Notifications"}=t,[B,H]=ge.useState([]),$=ge.useMemo(()=>i?B.filter(U=>U.toasterId===i):B.filter(U=>!U.toasterId),[B,i]),he=ge.useMemo(()=>Array.from(new Set([l].concat($.filter(U=>U.position).map(U=>U.position)))),[$,l]),[be,pe]=ge.useState([]),[fe,ue]=ge.useState(!1),[ee,ve]=ge.useState(!1),[L,Z]=ge.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),ne=ge.useRef(null),X=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),te=ge.useRef(null),D=ge.useRef(!1),M=ge.useCallback(U=>{H(Q=>{var K;return(K=Q.find(de=>de.id===U.id))!=null&&K.delete||Tn.dismiss(U.id),Q.filter(({id:de})=>de!==U.id)})},[]);return ge.useEffect(()=>Tn.subscribe(U=>{if(U.dismiss){requestAnimationFrame(()=>{H(Q=>Q.map(K=>K.id===U.id?{...K,delete:!0}:K))});return}setTimeout(()=>{Cj.flushSync(()=>{H(Q=>{const K=Q.findIndex(de=>de.id===U.id);return K!==-1?[...Q.slice(0,K),{...Q[K],...U},...Q.slice(K+1)]:[U,...Q]})})})}),[B]),ge.useEffect(()=>{if(b!=="system"){Z(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Z("dark"):Z("light")),typeof window>"u")return;const U=window.matchMedia("(prefers-color-scheme: dark)");try{U.addEventListener("change",({matches:Q})=>{Z(Q?"dark":"light")})}catch{U.addListener(({matches:K})=>{try{Z(K?"dark":"light")}catch(de){console.error(de)}})}},[b]),ge.useEffect(()=>{B.length<=1&&ue(!1)},[B]),ge.useEffect(()=>{const U=Q=>{var K;if(u.every(xe=>Q[xe]||Q.code===xe)){var re;ue(!0),(re=ne.current)==null||re.focus()}Q.code==="Escape"&&(document.activeElement===ne.current||(K=ne.current)!=null&&K.contains(document.activeElement))&&ue(!1)};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[u]),ge.useEffect(()=>{if(ne.current)return()=>{te.current&&(te.current.focus({preventScroll:!0}),te.current=null,D.current=!1)}},[ne.current]),ge.createElement("section",{ref:r,"aria-label":`${k} ${X}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},he.map((U,Q)=>{var K;const[de,re]=U.split("-");return $.length?ge.createElement("ol",{key:U,dir:T==="auto"?hx():T,tabIndex:-1,ref:ne,className:p,"data-sonner-toaster":!0,"data-sonner-theme":L,"data-y-position":de,"data-x-position":re,style:{"--front-toast-height":`${((K=be[0])==null?void 0:K.height)||0}px`,"--width":`${m3}px`,"--gap":`${O}px`,..._,...x3(y,v)},onBlur:xe=>{D.current&&!xe.currentTarget.contains(xe.relatedTarget)&&(D.current=!1,te.current&&(te.current.focus({preventScroll:!0}),te.current=null))},onFocus:xe=>{xe.target instanceof HTMLElement&&xe.target.dataset.dismissible==="false"||D.current||(D.current=!0,te.current=xe.relatedTarget)},onMouseEnter:()=>ue(!0),onMouseMove:()=>ue(!0),onMouseLeave:()=>{ee||ue(!1)},onDragEnd:()=>ue(!1),onPointerDown:xe=>{xe.target instanceof HTMLElement&&xe.target.dataset.dismissible==="false"||ve(!0)},onPointerUp:()=>ve(!1)},$.filter(xe=>!xe.position&&Q===0||xe.position===U).map((xe,we)=>{var Me,Fe;return ge.createElement(b3,{key:xe.id,icons:N,index:we,toast:xe,defaultRichColors:x,duration:(Me=R?.duration)!=null?Me:w,className:R?.className,descriptionClassName:R?.descriptionClassName,invert:o,visibleToasts:E,closeButton:(Fe=R?.closeButton)!=null?Fe:m,interacting:ee,position:U,style:R?.style,unstyled:R?.unstyled,classNames:R?.classNames,cancelButtonStyle:R?.cancelButtonStyle,actionButtonStyle:R?.actionButtonStyle,closeButtonAriaLabel:R?.closeButtonAriaLabel,removeToast:M,toasts:$.filter(He=>He.position==xe.position),heights:be.filter(He=>He.position==xe.position),setHeights:pe,expandByDefault:d,gap:O,expanded:fe,swipeDirections:t.swipeDirections})})):null}))}),S3=({...e})=>f.jsx(w3,{theme:"dark",className:"toaster group",icons:{success:f.jsx(yk,{className:"size-4"}),info:f.jsx(Jk,{className:"size-4"}),warning:f.jsx(__,{className:"size-4"}),error:f.jsx(vz,{className:"size-4"}),loading:f.jsx(sz,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius-ctl)"},...e});function qe(e,t=!1){t?dx.error(e,{duration:1/0,closeButton:!0}):dx(e)}function _3(){return f.jsx(S3,{position:"bottom-center"})}const mx=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,px=W1,C3=(e,t)=>r=>{var i;if(t?.variants==null)return px(e,r?.class,r?.className);const{variants:o,defaultVariants:l}=t,u=Object.keys(o).map(p=>{const y=r?.[p],v=l?.[p];if(y===null)return null;const b=mx(y)||mx(v);return o[p][b]}),d=r&&Object.entries(r).reduce((p,y)=>{let[v,b]=y;return b===void 0||(p[v]=b),p},{}),m=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((p,y)=>{let{class:v,className:b,...x}=y;return Object.entries(x).every(w=>{let[_,E]=w;return Array.isArray(E)?E.includes({...l,...d}[_]):{...l,...d}[_]===E})?[...p,v,b]:p},[]);return px(e,u,m,r?.class,r?.className)},E3=C3("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[background-color,border-color,color] disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",primary:"pbtn",danger:"danger-btn",subtle:"ai-btn",toolbar:"btn",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function xt({className:e,variant:t="default",size:r="default",asChild:i=!1,...o}){const l=i?Ej:"button";return f.jsx(l,{"data-slot":"button","data-variant":t,"data-size":r,className:We(E3({variant:t,size:r,className:e})),...o})}function Wu({...e}){return f.jsx(pp,{"data-slot":"dialog",...e})}function R3({...e}){return f.jsx(vp,{"data-slot":"dialog-portal",...e})}function j3({className:e,...t}){return f.jsx(yp,{"data-slot":"dialog-overlay",className:We("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",e),...t})}function ed({className:e,children:t,showCloseButton:r=!0,...i}){return f.jsxs(R3,{"data-slot":"dialog-portal",children:[f.jsx(j3,{}),f.jsxs(bp,{"data-slot":"dialog-content",className:We("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",e),...i,children:[t,r&&f.jsxs(iS,{"data-slot":"dialog-close",className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[f.jsx(E_,{}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Cl({className:e,...t}){return f.jsx(nS,{"data-slot":"dialog-title",className:We("text-lg leading-none font-semibold",e),...t})}let R_=null,cu=[];function El(e){R_=e,cu.forEach(t=>t())}function j_(e,t,r="",i="OK",o={}){return new Promise(l=>El({kind:"prompt",title:e,label:t,value:r,okLabel:i,...o,resolve:l}))}function za(e,t,r="Confirm",i=!1){return new Promise(o=>El({kind:"confirm",title:e,message:t,confirmLabel:r,danger:i,resolve:o}))}function T3(){const e=S.useSyncExternalStore(r=>(cu.push(r),()=>{cu=cu.filter(i=>i!==r)}),()=>R_);if(!e)return null;const t=()=>{El(null),e.kind==="prompt"?e.resolve(null):e.resolve(!1)};return f.jsx(Wu,{open:!0,onOpenChange:r=>!r&&t(),children:f.jsx(ed,{className:"modal",showCloseButton:!1,children:e.kind==="prompt"?f.jsx(O3,{m:e}):f.jsx(A3,{m:e})})})}function O3({m:e}){const t=S.useRef(null),r=p=>{El(null),e.resolve(p)},[i,o]=S.useState(""),[l,u]=S.useState(e.value),d=e.match===void 0||l.trim()===e.match,m=()=>{const p=l;if(d){if(!p.trim()){o("Give it a name."),t.current.focus();return}r(p)}};return f.jsxs(f.Fragment,{children:[f.jsx(Cl,{asChild:!0,children:f.jsx("h3",{children:e.title})}),f.jsx("label",{className:"modal-label",htmlFor:"modal-input",children:e.label}),f.jsx("input",{className:"modal-input",type:"text",autoComplete:"off",value:l,ref:t,id:"modal-input",autoFocus:!0,onFocus:p=>p.currentTarget.select(),"aria-invalid":!!i,"aria-describedby":i?"modal-input-err":void 0,onChange:p=>{u(p.currentTarget.value),i&&o("")},onKeyDown:p=>p.key==="Enter"&&m()}),i&&f.jsx("span",{id:"modal-input-err",role:"alert",className:"field-err",children:i}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(xt,{variant:"subtle",onClick:()=>r(null),children:"Cancel"}),f.jsx(xt,{variant:e.danger?"danger":"primary",onClick:m,disabled:!d,children:e.okLabel})]})]})}function A3({m:e}){const t=r=>{El(null),e.resolve(r)};return f.jsxs(f.Fragment,{children:[f.jsx(Cl,{asChild:!0,children:f.jsx("h3",{children:e.title})}),f.jsx("div",{className:"modal-msg",children:e.message}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(xt,{variant:"subtle",onClick:()=>t(!1),autoFocus:e.danger,children:"Cancel"}),f.jsx(xt,{variant:e.danger?"danger":"primary",onClick:()=>t(!0),autoFocus:!e.danger,children:e.confirmLabel})]})]})}function M3(e){return Ft({queryKey:["projects"],queryFn:()=>qt("/api/projects"),enabled:e,refetchInterval:3e4,select:t=>t.projects||[]})}function N3(e){return Ft({queryKey:["orgs"],queryFn:()=>qt("/api/orgs"),enabled:e,select:t=>t.orgs||[]})}function D3(e){return Ft({queryKey:["permissions",e],queryFn:()=>qt(`/api/p/${e}/permissions`),enabled:!!e})}function T_(e,t=!0){return Ft({queryKey:["shares",e],queryFn:()=>qt(`/api/p/${e}/shares`),enabled:!!e&&t,select:r=>r.shares||[]})}function O_(e){return Ft({queryKey:["admin","pending"],queryFn:()=>qt("/api/admin/pending"),enabled:e,select:t=>t.pending||[]})}function A_(){const e=Di();return()=>Promise.all([e.invalidateQueries({queryKey:["projects"]}),e.invalidateQueries({queryKey:["orgs"]})]).then(()=>{})}function M_(e){return e.split("/").map(encodeURIComponent).join("/")}function k3(e){try{return decodeURIComponent(e)}catch{return e}}function N_(e){return e.split("/").map(k3).join("/")}const z3=new Set(["dashboard","history","install","settings"]),gx={insights:"dashboard"};function L3(e){return Object.hasOwn(gx,e)?gx[e]:void 0}const Kp=["q","user","since","until"];function Yp(e){return!!e&&Kp.some(t=>!!e[t])}function D_(e){const t=new URLSearchParams;for(const i of Kp)e?.[i]&&t.set(i,e[i]);const r=t.toString();return r?"?"+r:""}function k_(e,t){const r=e.indexOf("?"),i=r===-1?null:new URLSearchParams(e.slice(r)),o=i?.get("v")||"",l=i?.get("connect")||"",u=$3(r===-1?e:e.slice(0,r),t);o&&(u.version=o),l&&(u.connect=l);const d={};for(const m of Kp){const p=i?.get(m);p&&(d[m]=p)}if(Yp(d)&&(u.filters=d),u.view==="history"&&!u.viewTarget){const m=(i?.get("path")||i?.get("prefix")||"").replace(/^\/+|\/+$/g,"");m&&(u.viewTarget=N_(m),u.queryTarget=!0)}return u}function vx(e,t){const r=t.replace(/\/+$/,"");return r!==t&&(e.trailingSlash=!0),e.path=r?N_(r):"",e}function $3(e,t){const r=e.replace(/^\/+/,"");if(t!=="hub")return vx({path:""},r);if(r==="orgs"||r.startsWith("orgs/"))return{org:r.slice(5).replace(/\/+$/,""),path:""};if(r==="billing"||r.startsWith("billing/"))return{billing:!0,path:""};const i=r.indexOf("/");if(i===-1)return{project:r,path:""};const o=vx({project:r.slice(0,i),path:""},r.slice(i+1)),l=o.path.indexOf("/"),u=l===-1?o.path:o.path.slice(0,l),d=L3(u);return(z3.has(u)||d)&&(o.view=d||u,d&&(o.legacyView=!0),o.viewTarget=l===-1?"":o.path.slice(l+1).replace(/\/+$/,""),o.path=""),o}function Gs(e,t,r){const i=M_(e),o=r?"?v="+r:"";return t?"/"+t+(i?"/"+i:"")+o:"/"+i+o}function Pn(e,t,r,i){let o=(t?"/"+t:"")+"/"+e;return r&&(o+="/"+M_(r.replace(/\/+$/,""))),o+(e==="history"?D_(i):"")}let Qp="POP";const Lm=new Set;function z_(){for(const e of Lm)e()}window.addEventListener("popstate",()=>{Qp="POP",z_()});function Yt(e,t){const r=location.pathname+location.search;!t?.replace&&r===e||(history[t?.replace?"replaceState":"pushState"](null,"",e),Qp=t?.replace?"REPLACE":"PUSH",z_())}function Xp(){return S.useSyncExternalStore(e=>(Lm.add(e),()=>{Lm.delete(e)}),()=>location.pathname+location.search)}function I3(){return Qp}function Zs(e){return e.startsWith("/")&&!e.startsWith("//")?{href:e,onClick:r=>{r.defaultPrevented||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.button!==0||(r.preventDefault(),Yt(e),document.body.classList.remove("sb-open"))}}:{href:e,target:"_blank",rel:"noopener noreferrer"}}function Jo({to:e}){return S.useEffect(()=>{Yt(e,{replace:!0})},[e]),null}function L_(){return{accessor:(e,t)=>typeof e=="function"?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function La(e,t){return typeof e=="function"?e(t):e}function Fn(e,t){return r=>{t.setState(i=>({...i,[e]:La(r,i[e])}))}}function td(e){return e instanceof Function}function P3(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function F3(e,t){const r=[],i=o=>{o.forEach(l=>{r.push(l);const u=t(l);u!=null&&u.length&&i(u)})};return i(e),r}function Le(e,t,r){let i=[],o;return l=>{let u;r.key&&r.debug&&(u=Date.now());const d=e(l);if(!(d.length!==i.length||d.some((y,v)=>i[v]!==y)))return o;i=d;let p;if(r.key&&r.debug&&(p=Date.now()),o=t(...d),r==null||r.onChange==null||r.onChange(o),r.key&&r.debug&&r!=null&&r.debug()){const y=Math.round((Date.now()-u)*100)/100,v=Math.round((Date.now()-p)*100)/100,b=v/16,x=(w,_)=>{for(w=String(w);w.length<_;)w=" "+w;return w};console.info(`%c⏱ ${x(v,5)} /${x(y,5)} ms`,` +`)},BT=0,js=[];function qT(e){var t=S.useRef([]),r=S.useRef([0,0]),i=S.useRef(),o=S.useState(BT++)[0],l=S.useState(Gw)[0],u=S.useRef(e);S.useEffect(function(){u.current=e},[e]),S.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var _=fT([e.lockRef.current],(e.shards||[]).map(Bb),!0).filter(Boolean);return _.forEach(function(E){return E.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),_.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var d=S.useCallback(function(_,E){if("touches"in _&&_.touches.length===2||_.type==="wheel"&&_.ctrlKey)return!u.current.allowPinchZoom;var R=qc(_),T=r.current,O="deltaX"in _?_.deltaX:T[0]-R[0],N="deltaY"in _?_.deltaY:T[1]-R[1],z,B=_.target,H=Math.abs(O)>Math.abs(N)?"h":"v";if("touches"in _&&H==="h"&&B.type==="range")return!1;var I=window.getSelection(),ne=I&&I.anchorNode,ge=ne?ne===B||ne.contains(B):!1;if(ge)return!1;var pe=Ub(H,B);if(!pe)return!0;if(pe?z=H:(z=H==="v"?"h":"v",pe=Ub(H,B)),!pe)return!1;if(!i.current&&"changedTouches"in _&&(O||N)&&(i.current=z),!z)return!0;var he=i.current||z;return VT(he,E,_,he==="h"?O:N)},[]),m=S.useCallback(function(_){var E=_;if(!(!js.length||js[js.length-1]!==l)){var R="deltaY"in E?Hb(E):qc(E),T=t.current.filter(function(z){return z.name===E.type&&(z.target===E.target||E.target===z.shadowParent)&&UT(z.delta,R)})[0];if(T&&T.should){E.cancelable&&E.preventDefault();return}if(!T){var O=(u.current.shards||[]).map(Bb).filter(Boolean).filter(function(z){return z.contains(E.target)}),N=O.length>0?d(E,O[0]):!u.current.noIsolation;N&&E.cancelable&&E.preventDefault()}}},[]),p=S.useCallback(function(_,E,R,T){var O={name:_,delta:E,target:R,should:T,shadowParent:GT(R)};t.current.push(O),setTimeout(function(){t.current=t.current.filter(function(N){return N!==O})},1)},[]),y=S.useCallback(function(_){r.current=qc(_),i.current=void 0},[]),v=S.useCallback(function(_){p(_.type,Hb(_),_.target,d(_,e.lockRef.current))},[]),b=S.useCallback(function(_){p(_.type,qc(_),_.target,d(_,e.lockRef.current))},[]);S.useEffect(function(){return js.push(l),e.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:b}),document.addEventListener("wheel",m,Rs),document.addEventListener("touchmove",m,Rs),document.addEventListener("touchstart",y,Rs),function(){js=js.filter(function(_){return _!==l}),document.removeEventListener("wheel",m,Rs),document.removeEventListener("touchmove",m,Rs),document.removeEventListener("touchstart",y,Rs)}},[]);var x=e.removeScrollBar,w=e.inert;return S.createElement(S.Fragment,null,w?S.createElement(l,{styles:HT(o)}):null,x?S.createElement(kT,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function GT(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const ZT=wT(qw,qT);var zu=S.forwardRef(function(e,t){return S.createElement(ku,Tr({},e,{ref:t,sideCar:ZT}))});zu.classNames=ku.classNames;var KT=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ts=new WeakMap,Gc=new WeakMap,Zc={},Ih=0,Qw=function(e){return e&&(e.host||Qw(e.parentNode))},YT=function(e,t){return t.map(function(r){if(e.contains(r))return r;var i=Qw(r);return i&&e.contains(i)?i:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},QT=function(e,t,r,i){var o=YT(t,Array.isArray(e)?e:[e]);Zc[r]||(Zc[r]=new WeakMap);var l=Zc[r],u=[],d=new Set,m=new Set(o),p=function(v){!v||d.has(v)||(d.add(v),p(v.parentNode))};o.forEach(p);var y=function(v){!v||m.has(v)||Array.prototype.forEach.call(v.children,function(b){if(d.has(b))y(b);else try{var x=b.getAttribute(i),w=x!==null&&x!=="false",_=(Ts.get(b)||0)+1,E=(l.get(b)||0)+1;Ts.set(b,_),l.set(b,E),u.push(b),_===1&&w&&Gc.set(b,!0),E===1&&b.setAttribute(r,"true"),w||b.setAttribute(i,"true")}catch(R){console.error("aria-hidden: cannot operate on ",b,R)}})};return y(t),d.clear(),Ih++,function(){u.forEach(function(v){var b=Ts.get(v)-1,x=l.get(v)-1;Ts.set(v,b),l.set(v,x),b||(Gc.has(v)||v.removeAttribute(i),Gc.delete(v)),x||v.removeAttribute(r)}),Ih--,Ih||(Ts=new WeakMap,Ts=new WeakMap,Gc=new WeakMap,Zc={})}},mp=function(e,t,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),o=KT(e);return o?(i.push.apply(i,Array.from(o.querySelectorAll("[aria-live], script"))),QT(i,o,r,"aria-hidden")):function(){return null}},Lu="Dialog",[Xw]=Ka(Lu),[XT,vr]=Xw(Lu),pp=e=>{const{__scopeDialog:t,children:r,open:i,defaultOpen:o,onOpenChange:l,modal:u=!0}=e,d=S.useRef(null),m=S.useRef(null),[p,y]=Hs({prop:i,defaultProp:o??!1,onChange:l,caller:Lu});return f.jsx(XT,{scope:t,triggerRef:d,contentRef:m,contentId:fn(),titleId:fn(),descriptionId:fn(),open:p,onOpenChange:y,onOpenToggle:S.useCallback(()=>y(v=>!v),[y]),modal:u,children:r})};pp.displayName=Lu;var Jw="DialogTrigger",JT=S.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,o=vr(Jw,r),l=at(t,o.triggerRef);return f.jsx(Pe.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":xp(o.open),...i,ref:l,onClick:Te(e.onClick,o.onOpenToggle)})});JT.displayName=Jw;var gp="DialogPortal",[WT,Ww]=Xw(gp,{forceMount:void 0}),vp=e=>{const{__scopeDialog:t,forceMount:r,children:i,container:o}=e,l=vr(gp,t);return f.jsx(WT,{scope:t,forceMount:r,children:S.Children.map(i,u=>f.jsx(gr,{present:r||l.open,children:f.jsx(bl,{asChild:!0,container:o,children:u})}))})};vp.displayName=gp;var mu="DialogOverlay",yp=S.forwardRef((e,t)=>{const r=Ww(mu,e.__scopeDialog),{forceMount:i=r.forceMount,...o}=e,l=vr(mu,e.__scopeDialog);return l.modal?f.jsx(gr,{present:i||l.open,children:f.jsx(tO,{...o,ref:t})}):null});yp.displayName=mu;var eO=Ei("DialogOverlay.RemoveScroll"),tO=S.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,o=vr(mu,r),l=eT(),u=at(t,l);return f.jsx(zu,{as:eO,allowPinchZoom:!0,shards:[o.contentRef],children:f.jsx(Pe.div,{"data-state":xp(o.open),...i,ref:u,style:{pointerEvents:"auto",...i.style}})})}),Bs="DialogContent",bp=S.forwardRef((e,t)=>{const r=Ww(Bs,e.__scopeDialog),{forceMount:i=r.forceMount,...o}=e,l=vr(Bs,e.__scopeDialog);return f.jsx(gr,{present:i||l.open,children:l.modal?f.jsx(nO,{...o,ref:t}):f.jsx(rO,{...o,ref:t})})});bp.displayName=Bs;var nO=S.forwardRef((e,t)=>{const r=vr(Bs,e.__scopeDialog),i=S.useRef(null),o=at(t,r.contentRef,i);return S.useEffect(()=>{const l=i.current;if(l)return mp(l)},[]),f.jsx(eS,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:Te(e.onCloseAutoFocus,l=>{l.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Te(e.onPointerDownOutside,l=>{const u=l.detail.originalEvent,d=u.button===0&&u.ctrlKey===!0;(u.button===2||d)&&l.preventDefault()}),onFocusOutside:Te(e.onFocusOutside,l=>l.preventDefault())})}),rO=S.forwardRef((e,t)=>{const r=vr(Bs,e.__scopeDialog),i=S.useRef(!1),o=S.useRef(!1);return f.jsx(eS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:l=>{e.onCloseAutoFocus?.(l),l.defaultPrevented||(i.current||r.triggerRef.current?.focus(),l.preventDefault()),i.current=!1,o.current=!1},onInteractOutside:l=>{e.onInteractOutside?.(l),l.defaultPrevented||(i.current=!0,l.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const u=l.target;r.triggerRef.current?.contains(u)&&l.preventDefault(),l.detail.originalEvent.type==="focusin"&&o.current&&l.preventDefault()}})}),eS=S.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:o,onCloseAutoFocus:l,...u}=e,d=vr(Bs,r);return hp(),f.jsx(f.Fragment,{children:f.jsx(Du,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:o,onUnmountAutoFocus:l,children:f.jsx(yl,{role:"dialog",id:d.contentId,"aria-describedby":d.descriptionId,"aria-labelledby":d.titleId,"data-state":xp(d.open),...u,ref:t,deferPointerDownOutside:!0,onDismiss:()=>d.onOpenChange(!1)})})})}),tS="DialogTitle",nS=S.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,o=vr(tS,r);return f.jsx(Pe.h2,{id:o.titleId,...i,ref:t})});nS.displayName=tS;var rS="DialogDescription",aO=S.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,o=vr(rS,r);return f.jsx(Pe.p,{id:o.descriptionId,...i,ref:t})});aO.displayName=rS;var aS="DialogClose",iS=S.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,o=vr(aS,r);return f.jsx(Pe.button,{type:"button",...i,ref:t,onClick:Te(e.onClick,()=>o.onOpenChange(!1))})});iS.displayName=aS;function xp(e){return e?"open":"closed"}function iO(e){const t=S.useRef({value:e,previous:e});return S.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function sO(e){const[t,r]=S.useState(void 0);return Qt(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const l=o[0];let u,d;if("borderBoxSize"in l){const m=l.borderBoxSize,p=Array.isArray(m)?m[0]:m;u=p.inlineSize,d=p.blockSize}else u=e.offsetWidth,d=e.offsetHeight;r({width:u,height:d})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else r(void 0)},[e]),t}const oO=["top","right","bottom","left"],Ha=Math.min,ra=Math.max,pu=Math.round,Kc=Math.floor,aa=e=>({x:e,y:e}),lO={left:"right",right:"left",bottom:"top",top:"bottom"};function sS(e,t,r){return ra(e,Ha(t,r))}function ia(e,t){return typeof e=="function"?e(t):e}function Ba(e){return e.split("-")[0]}function Ks(e){return e.split("-")[1]}function wp(e){return e==="x"?"y":"x"}function Sp(e){return e==="y"?"height":"width"}function Or(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function _p(e){return wp(Or(e))}function cO(e,t,r){r===void 0&&(r=!1);const i=Ks(e),o=_p(e),l=Sp(o);let u=o==="x"?i===(r?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=gu(u)),[u,gu(u)]}function uO(e){const t=gu(e);return[Sm(e),t,Sm(t)]}function Sm(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const qb=["left","right"],Gb=["right","left"],dO=["top","bottom"],fO=["bottom","top"];function hO(e,t,r){switch(e){case"top":case"bottom":return r?t?Gb:qb:t?qb:Gb;case"left":case"right":return t?dO:fO;default:return[]}}function mO(e,t,r,i){const o=Ks(e);let l=hO(Ba(e),r==="start",i);return o&&(l=l.map(u=>u+"-"+o),t&&(l=l.concat(l.map(Sm)))),l}function gu(e){const t=Ba(e);return lO[t]+e.slice(t.length)}function pO(e){var t,r,i,o;return{top:(t=e.top)!=null?t:0,right:(r=e.right)!=null?r:0,bottom:(i=e.bottom)!=null?i:0,left:(o=e.left)!=null?o:0}}function oS(e){return typeof e!="number"?pO(e):{top:e,right:e,bottom:e,left:e}}function vu(e){const{x:t,y:r,width:i,height:o}=e;return{width:i,height:o,top:r,left:t,right:t+i,bottom:r+o,x:t,y:r}}function Zb(e,t,r){let{reference:i,floating:o}=e;const l=Or(t),u=_p(t),d=Sp(u),m=Ba(t),p=l==="y",y=i.x+i.width/2-o.width/2,v=i.y+i.height/2-o.height/2,b=i[d]/2-o[d]/2;let x;switch(m){case"top":x={x:y,y:i.y-o.height};break;case"bottom":x={x:y,y:i.y+i.height};break;case"right":x={x:i.x+i.width,y:v};break;case"left":x={x:i.x-o.width,y:v};break;default:x={x:i.x,y:i.y}}const w=Ks(t);return w&&(x[u]+=b*(w==="end"?1:-1)*(r&&p?-1:1)),x}async function gO(e,t){var r;t===void 0&&(t={});const{x:i,y:o,platform:l,rects:u,elements:d,strategy:m}=e,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:v="floating",altBoundary:b=!1,padding:x=0}=ia(t,e),w=oS(x),E=d[b?v==="floating"?"reference":"floating":v],R=vu(await l.getClippingRect({element:(r=await(l.isElement==null?void 0:l.isElement(E)))==null||r?E:E.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:p,rootBoundary:y,strategy:m})),T=v==="floating"?{x:i,y:o,width:u.floating.width,height:u.floating.height}:u.reference,O=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),N=await(l.isElement==null?void 0:l.isElement(O))&&await(l.getScale==null?void 0:l.getScale(O))||{x:1,y:1},z=vu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:T,offsetParent:O,strategy:m}):T);return{top:(R.top-z.top+w.top)/N.y,bottom:(z.bottom-R.bottom+w.bottom)/N.y,left:(R.left-z.left+w.left)/N.x,right:(z.right-R.right+w.right)/N.x}}const vO=50,yO=async(e,t,r)=>{const{placement:i="bottom",strategy:o="absolute",middleware:l=[],platform:u}=r,d=u.detectOverflow?u:{...u,detectOverflow:gO},m=await(u.isRTL==null?void 0:u.isRTL(t));let p=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:y,y:v}=Zb(p,i,m),b=i,x=0;const w={};for(let _=0;_({name:"arrow",options:e,async fn(t){const{x:r,y:i,placement:o,rects:l,platform:u,elements:d,middlewareData:m}=t,{element:p,padding:y=0}=ia(e,t)||{};if(p==null)return{};const v=oS(y),b={x:r,y:i},x=_p(o),w=Sp(x),_=await u.getDimensions(p),E=x==="y",R=E?"top":"left",T=E?"bottom":"right",O=E?"clientHeight":"clientWidth",N=l.reference[w]+l.reference[x]-b[x]-l.floating[w],z=b[x]-l.reference[x],B=await(u.getOffsetParent==null?void 0:u.getOffsetParent(p));let H=B?B[O]:0;(!H||!await(u.isElement==null?void 0:u.isElement(B)))&&(H=d.floating[O]||l.floating[w]);const I=N/2-z/2,ne=H/2-_[w]/2-1,ge=Ha(v[R],ne),pe=Ha(v[T],ne),he=H-_[w]-pe,de=H/2-_[w]/2+I,ee=sS(ge,de,he),ye=!m.arrow&&Ks(o)!=null&&de!==ee&&l.reference[w]/2-(deee<=0)){var pe,he;const ee=(((pe=l.flip)==null?void 0:pe.index)||0)+1,ye=H[ee];if(ye&&(!(v==="alignment"?T!==Or(ye):!1)||ge.every(re=>Or(re.placement)===T?re.overflows[0]>0:!0)))return{data:{index:ee,overflows:ge},reset:{placement:ye}};let L=(he=ge.filter(Z=>Z.overflows[0]<=0).sort((Z,re)=>Z.overflows[1]-re.overflows[1])[0])==null?void 0:he.placement;if(!L)switch(x){case"bestFit":{var de;const Z=(de=ge.filter(re=>{if(B){const X=Or(re.placement);return X===T||X==="y"}return!0}).map(re=>[re.placement,re.overflows.filter(X=>X>0).reduce((X,te)=>X+te,0)]).sort((re,X)=>re[1]-X[1])[0])==null?void 0:de[0];Z&&(L=Z);break}case"initialPlacement":L=d;break}if(o!==L)return{reset:{placement:L}}}return{}}}};function Kb(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Yb(e){return oO.some(t=>e[t]>=0)}const wO=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:i}=t,{strategy:o="referenceHidden",...l}=ia(e,t);switch(o){case"referenceHidden":{const u=await i.detectOverflow(t,{...l,elementContext:"reference"}),d=Kb(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:Yb(d)}}}case"escaped":{const u=await i.detectOverflow(t,{...l,altBoundary:!0}),d=Kb(u,r.floating);return{data:{escapedOffsets:d,escaped:Yb(d)}}}default:return{}}}}},lS=new Set(["left","top"]);async function SO(e,t){const{placement:r,platform:i,elements:o}=e,l=await(i.isRTL==null?void 0:i.isRTL(o.floating)),u=Ba(r),d=Ks(r),m=Or(r)==="y",p=lS.has(u)?-1:1,y=l&&m?-1:1,v=ia(t,e);let{mainAxis:b,crossAxis:x,alignmentAxis:w}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return d&&typeof w=="number"&&(x=d==="end"?w*-1:w),m?{x:x*y,y:b*p}:{x:b*p,y:x*y}}const _O=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,i;const{x:o,y:l,placement:u,middlewareData:d}=t,m=await SO(t,e);return u===((r=d.offset)==null?void 0:r.placement)&&(i=d.arrow)!=null&&i.alignmentOffset?{}:{x:o+m.x,y:l+m.y,data:{...m,placement:u}}}}},CO=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:i,placement:o,platform:l}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:m={fn:T=>{let{x:O,y:N}=T;return{x:O,y:N}}},...p}=ia(e,t),y={x:r,y:i},v=await l.detectOverflow(t,p),b=Or(o),x=wp(b);let w=y[x],_=y[b];const E=(T,O)=>sS(O+v[T==="y"?"top":"left"],O,O-v[T==="y"?"bottom":"right"]);u&&(w=E(x,w)),d&&(_=E(b,_));const R=m.fn({...t,[x]:w,[b]:_});return{...R,data:{x:R.x-r,y:R.y-i,enabled:{[x]:u,[b]:d}}}}}},EO=function(e){return e===void 0&&(e={}),{options:e,fn(t){var r,i;const{x:o,y:l,placement:u,rects:d,middlewareData:m}=t,{offset:p=0,mainAxis:y=!0,crossAxis:v=!0}=ia(e,t),b={x:o,y:l},x=Or(u),w=wp(x);let _=b[w],E=b[x];const R=ia(p,t),T=typeof R=="number"?{mainAxis:R,crossAxis:0}:{mainAxis:(r=R.mainAxis)!=null?r:0,crossAxis:(i=R.crossAxis)!=null?i:0};if(y){const z=w==="y"?"height":"width",B=d.reference[w]-d.floating[z]+T.mainAxis,H=d.reference[w]+d.reference[z]-T.mainAxis;_H&&(_=H)}if(v){var O,N;const z=w==="y"?"width":"height",B=lS.has(Ba(u)),H=d.reference[x]-d.floating[z]+(B&&((O=m.offset)==null?void 0:O[x])||0)+(B?0:T.crossAxis),I=d.reference[x]+d.reference[z]+(B?0:((N=m.offset)==null?void 0:N[x])||0)-(B?T.crossAxis:0);EI&&(E=I)}return{[w]:_,[x]:E}}}},RO=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:r,rects:i,platform:o,elements:l}=t,{apply:u=()=>{},...d}=ia(e,t),m=await o.detectOverflow(t,d),p=Ba(r),y=Ks(r),v=Or(r)==="y",{width:b,height:x}=i.floating;let w,_;p==="top"||p==="bottom"?(w=p,_=y===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(_=p,w=y==="end"?"top":"bottom");const E=x-m.top-m.bottom,R=b-m.left-m.right,T=Ha(x-m[w],E),O=Ha(b-m[_],R),N=t.middlewareData.shift,z=!N;let B=T,H=O;N!=null&&N.enabled.x&&(H=R),N!=null&&N.enabled.y&&(B=E),z&&!y&&(v?H=b-2*ra(m.left,m.right):B=x-2*ra(m.top,m.bottom)),await u({...t,availableWidth:H,availableHeight:B});const I=await o.getDimensions(l.floating);return b!==I.width||x!==I.height?{reset:{rects:!0}}:{}}}};function $u(){return typeof window<"u"}function Ys(e){return cS(e)?(e.nodeName||"").toLowerCase():"#document"}function An(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function sa(e){var t;return(t=(cS(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function cS(e){return $u()?e instanceof Node||e instanceof An(e).Node:!1}function Ar(e){return $u()?e instanceof Element||e instanceof An(e).Element:!1}function Ya(e){return $u()?e instanceof HTMLElement||e instanceof An(e).HTMLElement:!1}function Qb(e){return!$u()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof An(e).ShadowRoot}function Iu(e){const{overflow:t,overflowX:r,overflowY:i,display:o}=Mr(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+r)&&o!=="inline"&&o!=="contents"}function jO(e){return/^(table|td|th)$/.test(Ys(e))}function Pu(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const TO=/transform|translate|scale|rotate|perspective|filter/,OO=/paint|layout|strict|content/,bi=e=>!!e&&e!=="none";let Ph;function Cp(e){const t=Ar(e)?Mr(e):e;return bi(t.transform)||bi(t.translate)||bi(t.scale)||bi(t.rotate)||bi(t.perspective)||!Ep()&&(bi(t.backdropFilter)||bi(t.filter))||TO.test(t.willChange||"")||OO.test(t.contain||"")}function AO(e){let t=Ri(e);for(;Ya(t)&&!ol(t);){if(Cp(t))return t;if(Pu(t))return null;t=Ri(t)}return null}function Ep(){return Ph==null&&(Ph=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ph}function ol(e){return/^(html|body|#document)$/.test(Ys(e))}function Mr(e){return An(e).getComputedStyle(e)}function Fu(e){return Ar(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ri(e){if(Ys(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Qb(e)&&e.host||sa(e);return Qb(t)?t.host:t}function uS(e){const t=Ri(e);return ol(t)?(e.ownerDocument||e).body:Ya(t)&&Iu(t)?t:uS(t)}function ll(e,t,r){var i;t===void 0&&(t=[]),r===void 0&&(r=!0);const o=uS(e),l=o===((i=e.ownerDocument)==null?void 0:i.body),u=An(o);if(l){const d=_m(u);return t.concat(u,u.visualViewport||[],Iu(o)?o:[],d&&r?ll(d):[])}else return t.concat(o,ll(o,[],r))}function _m(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dS(e){const t=Mr(e);let r=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const o=Ya(e),l=o?e.offsetWidth:r,u=o?e.offsetHeight:i,d=pu(r)!==l||pu(i)!==u;return d&&(r=l,i=u),{width:r,height:i,$:d}}function Rp(e){return Ar(e)?e:e.contextElement}function Is(e){const t=Rp(e);if(!Ya(t))return aa(1);const r=t.getBoundingClientRect(),{width:i,height:o,$:l}=dS(t);let u=(l?pu(r.width):r.width)/i,d=(l?pu(r.height):r.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const MO=aa(0);function fS(e){const t=An(e);return!Ep()||!t.visualViewport?MO:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function NO(e,t,r){return t===void 0&&(t=!1),!!r&&t&&r===An(e)}function ji(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=!1);const o=e.getBoundingClientRect(),l=Rp(e);let u=aa(1);t&&(i?Ar(i)&&(u=Is(i)):u=Is(e));const d=NO(l,r,i)?fS(l):aa(0);let m=(o.left+d.x)/u.x,p=(o.top+d.y)/u.y,y=o.width/u.x,v=o.height/u.y;if(l&&i){const b=An(l),x=Ar(i)?An(i):i;let w=b,_=_m(w);for(;_&&x!==w;){const E=Is(_),R=_.getBoundingClientRect(),T=Mr(_),O=R.left+(_.clientLeft+parseFloat(T.paddingLeft))*E.x,N=R.top+(_.clientTop+parseFloat(T.paddingTop))*E.y;m*=E.x,p*=E.y,y*=E.x,v*=E.y,m+=O,p+=N,w=An(_),_=_m(w)}}return vu({width:y,height:v,x:m,y:p})}function Vu(e,t){const r=Fu(e).scrollLeft;return t?t.left+r:ji(sa(e)).left+r}function hS(e,t){const r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-Vu(e,r),o=r.top+t.scrollTop;return{x:i,y:o}}function DO(e){let{elements:t,rect:r,offsetParent:i,strategy:o}=e;const l=o==="fixed",u=sa(i),d=t?Pu(t.floating):!1;if(i===u||d&&l)return r;let m={scrollLeft:0,scrollTop:0},p=aa(1);const y=aa(0),v=Ya(i);if((v||!l)&&((Ys(i)!=="body"||Iu(u))&&(m=Fu(i)),v)){const x=ji(i);p=Is(i),y.x=x.x+i.clientLeft,y.y=x.y+i.clientTop}const b=u&&!v&&!l?hS(u,m):aa(0);return{width:r.width*p.x,height:r.height*p.y,x:r.x*p.x-m.scrollLeft*p.x+y.x+b.x,y:r.y*p.y-m.scrollTop*p.y+y.y+b.y}}function kO(e){return e.getClientRects?Array.from(e.getClientRects()):[]}function zO(e){const t=Fu(e),r=e.ownerDocument.body,i=ra(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=ra(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let l=-t.scrollLeft+Vu(e);const u=-t.scrollTop;return Mr(r).direction==="rtl"&&(l+=ra(e.clientWidth,r.clientWidth)-i),{width:i,height:o,x:l,y:u}}const LO=25;function $O(e,t,r){r===void 0&&(r="viewport");const i=r==="layoutViewport",o=An(e),l=sa(e),u=o.visualViewport;let d=l.clientWidth,m=l.clientHeight,p=0,y=0;if(u){const b=!Ep()||t==="fixed";i?b||(p=-u.offsetLeft,y=-u.offsetTop):(d=u.width,m=u.height,b&&(p=u.offsetLeft,y=u.offsetTop))}if(Vu(l)<=0){const b=l.ownerDocument,x=b.body,w=getComputedStyle(x),_=b.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,E=Math.abs(l.clientWidth-x.clientWidth-_),R=getComputedStyle(l).scrollbarGutter==="stable both-edges"?E/2:E;R<=LO&&(d-=R)}return{width:d,height:m,x:p,y}}function IO(e,t){const r=ji(e,!0,t==="fixed"),i=r.top+e.clientTop,o=r.left+e.clientLeft,l=Is(e),u=e.clientWidth*l.x,d=e.clientHeight*l.y,m=o*l.x,p=i*l.y;return{width:u,height:d,x:m,y:p}}function Xb(e,t,r){let i;if(t==="viewport"||t==="layoutViewport")i=$O(e,r,t);else if(t==="document")i=zO(sa(e));else if(Ar(t))i=IO(t,r);else{const o=fS(e);i={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return vu(i)}function PO(e,t){const r=t.get(e);if(r)return r;let i=ll(e,[],!1).filter(d=>Ar(d)&&Ys(d)!=="body"),o=null;const l=Mr(e).position==="fixed";let u=l?Ri(e):e;for(;Ar(u)&&!ol(u);){const d=Mr(u),m=Cp(u),p=o?o.position:l?"fixed":"";!m&&(p==="fixed"||p==="absolute"&&d.position==="static")?i=i.filter(v=>v!==u):o=d,u=Ri(u)}return t.set(e,i),i}function FO(e){let{element:t,boundary:r,rootBoundary:i,strategy:o}=e;const u=[...r==="clippingAncestors"?Pu(t)?[]:PO(t,this._c):[].concat(r),i],d=Xb(t,u[0],o);let m=d.top,p=d.right,y=d.bottom,v=d.left;for(let b=1;b{d(!1,1e-7)},1e3)}H=!1}try{i=new IntersectionObserver(I,{...B,root:l.ownerDocument})}catch{i=new IntersectionObserver(I,B)}i.observe(e)}const m=An(e),p=()=>d(r);return m.addEventListener("resize",p),d(!0),()=>{m.removeEventListener("resize",p),u()}}function ZO(e,t,r,i){i===void 0&&(i={});const{ancestorScroll:o=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:m=!1}=i,p=Rp(e),y=o||l?[...p?ll(p):[],...t?ll(t):[]]:[];y.forEach(R=>{o&&R.addEventListener("scroll",r),l&&R.addEventListener("resize",r)});const v=p&&d?GO(p,r,l):null;let b=-1,x=null;u&&(x=new ResizeObserver(R=>{let[T]=R;T&&T.target===p&&x&&t&&(x.unobserve(t),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var O;(O=x)==null||O.observe(t)})),r()}),p&&!m&&x.observe(p),t&&x.observe(t));let w,_=m?ji(e):null;m&&E();function E(){const R=ji(e);_&&!pS(_,R)&&r(),_=R,w=requestAnimationFrame(E)}return r(),()=>{var R;y.forEach(T=>{o&&T.removeEventListener("scroll",r),l&&T.removeEventListener("resize",r)}),v?.(),(R=x)==null||R.disconnect(),x=null,m&&cancelAnimationFrame(w)}}const KO=_O,YO=CO,QO=xO,XO=RO,JO=wO,Wb=bO,WO=EO,eA=(e,t,r)=>{const i=new Map,o=r??{},l={...qO,...o.platform,_c:i};return yO(e,t,{...o,platform:l})};var tA=typeof document<"u",nA=function(){},ou=tA?S.useLayoutEffect:nA;function yu(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 r,i,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(i=r;i--!==0;)if(!yu(e[i],t[i]))return!1;return!0}if(o=Object.keys(e),r=o.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!{}.hasOwnProperty.call(t,o[i]))return!1;for(i=r;i--!==0;){const l=o[i];if(!(l==="_owner"&&e.$$typeof)&&!yu(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function gS(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ex(e,t){const r=gS(e);return Math.round(t*r)/r}function Vh(e){const t=S.useRef(e);return ou(()=>{t.current=e}),t}function rA(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:i=[],platform:o,elements:{reference:l,floating:u}={},transform:d=!0,whileElementsMounted:m,open:p}=e,[y,v]=S.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[b,x]=S.useState(i);yu(b,i)||x(i);const[w,_]=S.useState(null),[E,R]=S.useState(null),T=S.useCallback(re=>{re!==B.current&&(B.current=re,_(re))},[]),O=S.useCallback(re=>{re!==H.current&&(H.current=re,R(re))},[]),N=l||w,z=u||E,B=S.useRef(null),H=S.useRef(null),I=S.useRef(y),ne=m!=null,ge=Vh(m),pe=Vh(o),he=Vh(p),de=S.useCallback(()=>{if(!B.current||!H.current)return;const re={placement:t,strategy:r,middleware:b};pe.current&&(re.platform=pe.current),eA(B.current,H.current,re).then(X=>{const te={...X,isPositioned:he.current!==!1};ee.current&&!yu(I.current,te)&&(I.current=te,ki.flushSync(()=>{v(te)}))})},[b,t,r,pe,he]);ou(()=>{p===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,v(re=>({...re,isPositioned:!1})))},[p]);const ee=S.useRef(!1);ou(()=>(ee.current=!0,()=>{ee.current=!1}),[]),ou(()=>{if(N&&(B.current=N),z&&(H.current=z),N&&z){if(ge.current)return ge.current(N,z,de);de()}},[N,z,de,ge,ne]);const ye=S.useMemo(()=>({reference:B,floating:H,setReference:T,setFloating:O}),[T,O]),L=S.useMemo(()=>({reference:N,floating:z}),[N,z]),Z=S.useMemo(()=>{const re={position:r,left:0,top:0};if(!L.floating)return re;const X=ex(L.floating,y.x),te=ex(L.floating,y.y);return d?{...re,transform:"translate("+X+"px, "+te+"px)",...gS(L.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:X,top:te}},[r,d,L.floating,y.x,y.y]);return S.useMemo(()=>({...y,update:de,refs:ye,elements:L,floatingStyles:Z}),[y,de,ye,L,Z])}const aA=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:i,padding:o}=typeof e=="function"?e(r):e;return i&&t(i)?i.current!=null?Wb({element:i.current,padding:o}).fn(r):{}:i?Wb({element:i,padding:o}).fn(r):{}}}},iA=(e,t)=>{const r=KO(e);return{name:r.name,fn:r.fn,options:[e,t]}},sA=(e,t)=>{const r=YO(e);return{name:r.name,fn:r.fn,options:[e,t]}},oA=(e,t)=>({fn:WO(e).fn,options:[e,t]}),lA=(e,t)=>{const r=QO(e);return{name:r.name,fn:r.fn,options:[e,t]}},cA=(e,t)=>{const r=XO(e);return{name:r.name,fn:r.fn,options:[e,t]}},uA=(e,t)=>{const r=JO(e);return{name:r.name,fn:r.fn,options:[e,t]}},dA=(e,t)=>{const r=aA(e);return{name:r.name,fn:r.fn,options:[e,t]}};var fA="Arrow",vS=S.forwardRef((e,t)=>{const{children:r,width:i=10,height:o=5,...l}=e;return f.jsx(Pe.svg,{...l,ref:t,width:i,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:f.jsx("polygon",{points:"0,0 30,0 15,10"})})});vS.displayName=fA;var hA=vS,jp="Popper",[yS,Qs]=Ka(jp),[mA,bS]=yS(jp),xS=e=>{const{__scopePopper:t,children:r}=e,[i,o]=S.useState(null),[l,u]=S.useState(void 0);return f.jsx(mA,{scope:t,anchor:i,onAnchorChange:o,placementState:l,setPlacementState:u,children:r})};xS.displayName=jp;var wS="PopperAnchor",SS=S.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:i,...o}=e,l=bS(wS,r),u=S.useRef(null),d=l.onAnchorChange,m=S.useCallback(w=>{u.current=w,w&&d(w)},[d]),p=at(t,m),y=S.useRef(null);S.useEffect(()=>{if(!i)return;const w=y.current;y.current=i.current,w!==y.current&&d(y.current)});const v=l.placementState&&Op(l.placementState),b=v?.[0],x=v?.[1];return i?null:f.jsx(Pe.div,{"data-radix-popper-side":b,"data-radix-popper-align":x,...o,ref:p})});SS.displayName=wS;var Tp="PopperContent",[pA,gA]=yS(Tp),_S=S.forwardRef((e,t)=>{const{__scopePopper:r,side:i="bottom",sideOffset:o=0,align:l="center",alignOffset:u=0,arrowPadding:d=0,avoidCollisions:m=!0,collisionBoundary:p=[],collisionPadding:y=0,sticky:v="partial",hideWhenDetached:b=!1,updatePositionStrategy:x="optimized",onPlaced:w,..._}=e,E=bS(Tp,r),[R,T]=S.useState(null),O=at(t,T),[N,z]=S.useState(null),B=sO(N),H=B?.width??0,I=B?.height??0,ne=i+(l!=="center"?"-"+l:""),ge=typeof y=="number"?y:{top:0,right:0,bottom:0,left:0,...y},pe=Array.isArray(p)?p:[p],he=pe.length>0,de={padding:ge,boundary:pe.filter(yA),altBoundary:he},{refs:ee,floatingStyles:ye,placement:L,isPositioned:Z,middlewareData:re}=rA({strategy:"fixed",placement:ne,whileElementsMounted:(...xe)=>ZO(...xe,{animationFrame:x==="always"}),elements:{reference:E.anchor},middleware:[iA({mainAxis:o+I,alignmentAxis:u}),m&&sA({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?oA():void 0,...de}),m&&lA({...de}),cA({...de,apply:({elements:xe,rects:we,availableWidth:Me,availableHeight:Fe})=>{const{width:He,height:ct}=we.reference,Je=xe.floating.style;Je.setProperty("--radix-popper-available-width",`${Me}px`),Je.setProperty("--radix-popper-available-height",`${Fe}px`),Je.setProperty("--radix-popper-anchor-width",`${He}px`),Je.setProperty("--radix-popper-anchor-height",`${ct}px`)}}),N&&dA({element:N,padding:d}),bA({arrowWidth:H,arrowHeight:I}),b&&uA({strategy:"referenceHidden",...de,boundary:he?de.boundary:void 0})]}),X=E.setPlacementState;Qt(()=>(X(L),()=>{X(void 0)}),[L,X]);const[te,D]=Op(L),M=tr(w);Qt(()=>{Z&&M?.()},[Z,M]);const U=re.arrow?.x,Q=re.arrow?.y,K=re.arrow?.centerOffset!==0,[fe,ae]=S.useState();return Qt(()=>{R&&ae(window.getComputedStyle(R).zIndex)},[R]),f.jsx("div",{ref:ee.setFloating,"data-radix-popper-content-wrapper":"",style:{...ye,transform:Z?ye.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:fe,"--radix-popper-transform-origin":[re.transformOrigin?.x,re.transformOrigin?.y].join(" "),...re.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:f.jsx(pA,{scope:r,placedSide:te,placedAlign:D,onArrowChange:z,arrowX:U,arrowY:Q,shouldHideArrow:K,children:f.jsx(Pe.div,{"data-side":te,"data-align":D,..._,ref:O,style:{..._.style,animation:Z?void 0:"none"}})})})});_S.displayName=Tp;var CS="PopperArrow",vA={top:"bottom",right:"left",bottom:"top",left:"right"},ES=S.forwardRef(function(t,r){const{__scopePopper:i,...o}=t,l=gA(CS,i),u=vA[l.placedSide];return f.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[u]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:f.jsx(hA,{...o,ref:r,style:{...o.style,display:"block"}})})});ES.displayName=CS;function yA(e){return e!==null}var bA=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:i,middlewareData:o}=t,u=o.arrow?.centerOffset!==0,d=u?0:e.arrowWidth,m=u?0:e.arrowHeight,[p,y]=Op(r),v={start:"0%",center:"50%",end:"100%"}[y],b=(o.arrow?.x??0)+d/2,x=(o.arrow?.y??0)+m/2;let w="",_="";return p==="bottom"?(w=u?v:`${b}px`,_=`${-m}px`):p==="top"?(w=u?v:`${b}px`,_=`${i.floating.height+m}px`):p==="right"?(w=`${-m}px`,_=u?v:`${x}px`):p==="left"&&(w=`${i.floating.width+m}px`,_=u?v:`${x}px`),{data:{x:w,y:_}}}});function Op(e){const[t,r="center"]=e.split("-");return[t,r]}var Ap=xS,Mp=SS,Np=_S,Dp=ES,Uh=!1;function xA(){const[e,t]=S.useState(Uh);return S.useEffect(()=>{Uh||(Uh=!0,t(!0))},[]),e}var RS=Mu[" useSyncExternalStore ".trim().toString()];function wA(){return()=>{}}function SA(){return RS(wA,()=>!0,()=>!1)}var _A=typeof RS=="function"?SA:xA,Hh="rovingFocusGroup.onEntryFocus",CA={bubbles:!1,cancelable:!0},xl="RovingFocusGroup",[Cm,jS,EA]=up(xl),[RA,TS]=Ka(xl,[EA]),[jA,TA]=RA(xl),OS=S.forwardRef((e,t)=>f.jsx(Cm.Provider,{scope:e.__scopeRovingFocusGroup,children:f.jsx(Cm.Slot,{scope:e.__scopeRovingFocusGroup,children:f.jsx(OA,{...e,ref:t})})}));OS.displayName=xl;var OA=S.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:o=!1,dir:l,currentTabStopId:u,defaultCurrentTabStopId:d,onCurrentTabStopIdChange:m,onEntryFocus:p,preventScrollOnEntryFocus:y=!1,...v}=e,b=S.useRef(null),x=at(t,b),w=dp(l),[_,E]=Hs({prop:u,defaultProp:d??null,onChange:m,caller:xl}),[R,T]=S.useState(!1),O=tr(p),N=jS(r),z=S.useRef(!1),[B,H]=S.useState(0);return S.useEffect(()=>{const I=b.current;if(I)return I.addEventListener(Hh,O),()=>I.removeEventListener(Hh,O)},[O]),f.jsx(jA,{scope:r,orientation:i,dir:w,loop:o,currentTabStopId:_,onItemFocus:S.useCallback(I=>E(I),[E]),onItemShiftTab:S.useCallback(()=>T(!0),[]),onFocusableItemAdd:S.useCallback(()=>H(I=>I+1),[]),onFocusableItemRemove:S.useCallback(()=>H(I=>I-1),[]),children:f.jsx(Pe.div,{tabIndex:R||B===0?-1:0,"data-orientation":i,...v,ref:x,style:{outline:"none",...e.style},onMouseDown:Te(e.onMouseDown,()=>{z.current=!0}),onFocus:Te(e.onFocus,I=>{const ne=!z.current;if(I.target===I.currentTarget&&ne&&!R){const ge=new CustomEvent(Hh,CA);if(I.currentTarget.dispatchEvent(ge),!ge.defaultPrevented){const pe=N().filter(L=>L.focusable),he=pe.find(L=>L.active),de=pe.find(L=>L.id===_),ye=[he,de,...pe].filter(Boolean).map(L=>L.ref.current);NS(ye,y)}}z.current=!1}),onBlur:Te(e.onBlur,()=>T(!1))})})}),AS="RovingFocusGroupItem",MS=S.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:o=!1,tabStopId:l,children:u,...d}=e,m=fn(),p=l||m,y=TA(AS,r),v=y.currentTabStopId===p,b=jS(r),{onFocusableItemAdd:x,onFocusableItemRemove:w,currentTabStopId:_}=y,E=_A();return Qt(()=>{if(!(!E||!i))return x(),()=>w()},[E,i,x,w]),S.useEffect(()=>{if(!(E||!i))return x(),()=>w()},[E,i,x,w]),f.jsx(Cm.ItemSlot,{scope:r,id:p,focusable:i,active:o,children:f.jsx(Pe.span,{tabIndex:v?0:-1,"data-orientation":y.orientation,...d,ref:t,onMouseDown:Te(e.onMouseDown,R=>{i?y.onItemFocus(p):R.preventDefault()}),onFocus:Te(e.onFocus,()=>y.onItemFocus(p)),onKeyDown:Te(e.onKeyDown,R=>{if(R.key==="Tab"&&R.shiftKey){y.onItemShiftTab();return}if(R.target!==R.currentTarget)return;const T=NA(R,y.orientation,y.dir);if(T!==void 0){if(R.metaKey||R.ctrlKey||R.altKey||R.shiftKey)return;R.preventDefault();let N=b().filter(z=>z.focusable).map(z=>z.ref.current);if(T==="last")N.reverse();else if(T==="prev"||T==="next"){T==="prev"&&N.reverse();const z=N.indexOf(R.currentTarget);N=y.loop?DA(N,z+1):N.slice(z+1)}setTimeout(()=>NS(N))}}),children:typeof u=="function"?u({isCurrentTabStop:v,hasTabStop:_!=null}):u})})});MS.displayName=AS;var AA={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function MA(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function NA(e,t,r){const i=MA(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return AA[i]}function NS(e,t=!1){const r=document.activeElement;for(const i of e)if(i===r||(i.focus({preventScroll:t}),document.activeElement!==r))return}function DA(e,t){return e.map((r,i)=>e[(t+i)%e.length])}var kA=OS,zA=MS,Em=["Enter"," "],LA=["ArrowDown","PageUp","Home"],DS=["ArrowUp","PageDown","End"],$A=[...LA,...DS],IA={ltr:[...Em,"ArrowRight"],rtl:[...Em,"ArrowLeft"]},PA={ltr:["ArrowLeft"],rtl:["ArrowRight"]},wl="Menu",[cl,FA,VA]=up(wl),[zi,kS]=Ka(wl,[VA,Qs,TS]),Uu=Qs(),zS=TS(),[UA,Li]=zi(wl),[HA,Sl]=zi(wl),LS=e=>{const{__scopeMenu:t,open:r=!1,children:i,dir:o,onOpenChange:l,modal:u=!0}=e,d=Uu(t),[m,p]=S.useState(null),y=S.useRef(!1),v=tr(l),b=dp(o);return S.useEffect(()=>{const x=()=>{y.current=!0,document.addEventListener("pointerdown",w,{capture:!0,once:!0}),document.addEventListener("pointermove",w,{capture:!0,once:!0})},w=()=>y.current=!1;return document.addEventListener("keydown",x,{capture:!0}),()=>{document.removeEventListener("keydown",x,{capture:!0}),document.removeEventListener("pointerdown",w,{capture:!0}),document.removeEventListener("pointermove",w,{capture:!0})}},[]),S.useEffect(()=>{if(!r)return;const x=()=>v(!1);return window.addEventListener("blur",x),()=>window.removeEventListener("blur",x)},[r,v]),f.jsx(Ap,{...d,children:f.jsx(UA,{scope:t,open:r,onOpenChange:v,content:m,onContentChange:p,children:f.jsx(HA,{scope:t,onClose:S.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:y,dir:b,modal:u,children:i})})})};LS.displayName=wl;var BA="MenuAnchor",kp=S.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,o=Uu(r);return f.jsx(Mp,{...o,...i,ref:t})});kp.displayName=BA;var zp="MenuPortal",[qA,$S]=zi(zp,{forceMount:void 0}),IS=e=>{const{__scopeMenu:t,forceMount:r,children:i,container:o}=e,l=Li(zp,t);return f.jsx(qA,{scope:t,forceMount:r,children:f.jsx(gr,{present:r||l.open,children:f.jsx(bl,{asChild:!0,container:o,children:i})})})};IS.displayName=zp;var er="MenuContent",[GA,Lp]=zi(er),PS=S.forwardRef((e,t)=>{const r=$S(er,e.__scopeMenu),{forceMount:i=r.forceMount,...o}=e,l=Li(er,e.__scopeMenu),u=Sl(er,e.__scopeMenu);return f.jsx(cl.Provider,{scope:e.__scopeMenu,children:f.jsx(gr,{present:i||l.open,children:f.jsx(cl.Slot,{scope:e.__scopeMenu,children:u.modal?f.jsx(ZA,{...o,ref:t}):f.jsx(KA,{...o,ref:t})})})})}),ZA=S.forwardRef((e,t)=>{const r=Li(er,e.__scopeMenu),i=S.useRef(null),o=at(t,i);return S.useEffect(()=>{const l=i.current;if(l)return mp(l)},[]),f.jsx($p,{...e,ref:o,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Te(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),KA=S.forwardRef((e,t)=>{const r=Li(er,e.__scopeMenu);return f.jsx($p,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),YA=Ei("MenuContent.ScrollLock"),$p=S.forwardRef((e,t)=>{const{__scopeMenu:r,loop:i=!1,trapFocus:o,onOpenAutoFocus:l,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEntryFocus:m,onEscapeKeyDown:p,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:x,disableOutsideScroll:w,..._}=e,E=Li(er,r),R=Sl(er,r),T=Uu(r),O=zS(r),N=FA(r),[z,B]=S.useState(null),H=S.useRef(null),I=at(t,H,E.onContentChange),ne=S.useRef(0),ge=S.useRef(""),pe=S.useRef(0),he=S.useRef(null),de=S.useRef("right"),ee=S.useRef(0),ye=w?zu:S.Fragment,L=w?{as:YA,allowPinchZoom:!0}:void 0,Z=X=>{const te=ge.current+X,D=N().filter(ae=>!ae.disabled),M=document.activeElement,U=D.find(ae=>ae.ref.current===M)?.textValue,Q=D.map(ae=>ae.textValue),K=oM(Q,te,U),fe=D.find(ae=>ae.textValue===K)?.ref.current;(function ae(xe){ge.current=xe,window.clearTimeout(ne.current),xe!==""&&(ne.current=window.setTimeout(()=>ae(""),1e3))})(te),fe&&setTimeout(()=>fe.focus())};S.useEffect(()=>()=>window.clearTimeout(ne.current),[]),hp();const re=S.useCallback(X=>de.current===he.current?.side&&cM(X,he.current?.area),[]);return f.jsx(GA,{scope:r,searchRef:ge,onItemEnter:S.useCallback(X=>{re(X)&&X.preventDefault()},[re]),onItemLeave:S.useCallback(X=>{re(X)||(H.current?.focus(),B(null))},[re]),onTriggerLeave:S.useCallback(X=>{re(X)&&X.preventDefault()},[re]),pointerGraceTimerRef:pe,onPointerGraceIntentChange:S.useCallback(X=>{he.current=X},[]),children:f.jsx(ye,{...L,children:f.jsx(Du,{asChild:!0,trapped:o,onMountAutoFocus:Te(l,X=>{X.preventDefault(),H.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:f.jsx(yl,{asChild:!0,disableOutsidePointerEvents:d,onEscapeKeyDown:p,onPointerDownOutside:y,onFocusOutside:v,onInteractOutside:b,onDismiss:x,children:f.jsx(kA,{asChild:!0,...O,dir:R.dir,orientation:"vertical",loop:i,currentTabStopId:z,onCurrentTabStopIdChange:B,onEntryFocus:Te(m,X=>{R.isUsingKeyboardRef.current||X.preventDefault()}),preventScrollOnEntryFocus:!0,children:f.jsx(Np,{role:"menu","aria-orientation":"vertical","data-state":t1(E.open),"data-radix-menu-content":"",dir:R.dir,...T,..._,ref:I,style:{outline:"none",..._.style},onKeyDown:Te(_.onKeyDown,X=>{const D=X.target.closest("[data-radix-menu-content]")===X.currentTarget,M=X.ctrlKey||X.altKey||X.metaKey,U=X.key.length===1;D&&(X.key==="Tab"&&X.preventDefault(),!M&&U&&Z(X.key));const Q=H.current;if(X.target!==Q||!$A.includes(X.key))return;X.preventDefault();const fe=N().filter(ae=>!ae.disabled).map(ae=>ae.ref.current);DS.includes(X.key)&&fe.reverse(),iM(fe)}),onBlur:Te(e.onBlur,X=>{X.currentTarget.contains(X.target)||(window.clearTimeout(ne.current),ge.current="")}),onPointerMove:Te(e.onPointerMove,ul(X=>{const te=X.target,D=ee.current!==X.clientX;if(X.currentTarget.contains(te)&&D){const M=X.clientX>ee.current?"right":"left";de.current=M,ee.current=X.clientX}}))})})})})})})});PS.displayName=er;var QA="MenuGroup",Ip=S.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return f.jsx(Pe.div,{role:"group",...i,ref:t})});Ip.displayName=QA;var XA="MenuLabel",FS=S.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return f.jsx(Pe.div,{...i,ref:t})});FS.displayName=XA;var bu="MenuItem",tx="menu.itemSelect",Hu=S.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:i,...o}=e,l=S.useRef(null),u=Sl(bu,e.__scopeMenu),d=Lp(bu,e.__scopeMenu),m=at(t,l),p=S.useRef(!1),y=()=>{const v=l.current;if(!r&&v){const b=new CustomEvent(tx,{bubbles:!0,cancelable:!0});v.addEventListener(tx,x=>i?.(x),{once:!0}),Iw(v,b),b.defaultPrevented?p.current=!1:u.onClose()}};return f.jsx(VS,{...o,ref:m,disabled:r,onClick:Te(e.onClick,y),onPointerDown:v=>{e.onPointerDown?.(v),p.current=!0},onPointerUp:Te(e.onPointerUp,v=>{p.current||v.currentTarget?.click()}),onKeyDown:Te(e.onKeyDown,v=>{r||v.target!==v.currentTarget||d.searchRef.current!==""&&v.key===" "||Em.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});Hu.displayName=bu;var VS=S.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:i=!1,textValue:o,...l}=e,u=Lp(bu,r),d=zS(r),m=S.useRef(null),p=at(t,m),[y,v]=S.useState(!1),[b,x]=S.useState("");return S.useEffect(()=>{const w=m.current;w&&x((w.textContent??"").trim())},[l.children]),f.jsx(cl.ItemSlot,{scope:r,disabled:i,textValue:o??b,children:f.jsx(zA,{asChild:!0,...d,focusable:!i,children:f.jsx(Pe.div,{role:"menuitem","data-highlighted":y?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...l,ref:p,onPointerMove:Te(e.onPointerMove,ul(w=>{i?u.onItemLeave(w):(u.onItemEnter(w),w.defaultPrevented||w.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Te(e.onPointerLeave,ul(w=>u.onItemLeave(w))),onFocus:Te(e.onFocus,()=>v(!0)),onBlur:Te(e.onBlur,()=>v(!1))})})})}),JA="MenuCheckboxItem",US=S.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:i,...o}=e;return f.jsx(ZS,{scope:e.__scopeMenu,checked:r,children:f.jsx(Hu,{role:"menuitemcheckbox","aria-checked":xu(r)?"mixed":r,...o,ref:t,"data-state":Fp(r),onSelect:Te(o.onSelect,()=>i?.(xu(r)?!0:!r),{checkForDefaultPrevented:!1})})})});US.displayName=JA;var HS="MenuRadioGroup",[WA,eM]=zi(HS,{value:void 0,onValueChange:()=>{}}),BS=S.forwardRef((e,t)=>{const{value:r,onValueChange:i,...o}=e,l=tr(i);return f.jsx(WA,{scope:e.__scopeMenu,value:r,onValueChange:l,children:f.jsx(Ip,{...o,ref:t})})});BS.displayName=HS;var qS="MenuRadioItem",GS=S.forwardRef((e,t)=>{const{value:r,...i}=e,o=eM(qS,e.__scopeMenu),l=r===o.value;return f.jsx(ZS,{scope:e.__scopeMenu,checked:l,children:f.jsx(Hu,{role:"menuitemradio","aria-checked":l,...i,ref:t,"data-state":Fp(l),onSelect:Te(i.onSelect,()=>o.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});GS.displayName=qS;var Pp="MenuItemIndicator",[ZS,tM]=zi(Pp,{checked:!1}),KS=S.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:i,...o}=e,l=tM(Pp,r);return f.jsx(gr,{present:i||xu(l.checked)||l.checked===!0,children:f.jsx(Pe.span,{...o,ref:t,"data-state":Fp(l.checked)})})});KS.displayName=Pp;var nM="MenuSeparator",YS=S.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return f.jsx(Pe.div,{role:"separator","aria-orientation":"horizontal",...i,ref:t})});YS.displayName=nM;var rM="MenuArrow",QS=S.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,o=Uu(r);return f.jsx(Dp,{...o,...i,ref:t})});QS.displayName=rM;var aM="MenuSub",[wF,XS]=zi(aM),Qo="MenuSubTrigger",JS=S.forwardRef((e,t)=>{const r=Li(Qo,e.__scopeMenu),i=Sl(Qo,e.__scopeMenu),o=XS(Qo,e.__scopeMenu),l=Lp(Qo,e.__scopeMenu),u=S.useRef(null),{pointerGraceTimerRef:d,onPointerGraceIntentChange:m}=l,p={__scopeMenu:e.__scopeMenu},y=S.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);S.useEffect(()=>y,[y]),S.useEffect(()=>{const b=d.current;return()=>{window.clearTimeout(b),m(null)}},[d,m]);const v=at(t,o.onTriggerChange);return f.jsx(kp,{asChild:!0,...p,children:f.jsx(VS,{id:o.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?o.contentId:void 0,"data-state":t1(r.open),...e,ref:v,onClick:b=>{e.onClick?.(b),!(e.disabled||b.defaultPrevented)&&(b.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Te(e.onPointerMove,ul(b=>{l.onItemEnter(b),!b.defaultPrevented&&!e.disabled&&!r.open&&!u.current&&(l.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{r.onOpenChange(!0),y()},100))})),onPointerLeave:Te(e.onPointerLeave,ul(b=>{y();const x=r.content?.getBoundingClientRect();if(x){const w=r.content?.dataset.side,_=w==="right",E=_?-5:5,R=x[_?"left":"right"],T=x[_?"right":"left"];l.onPointerGraceIntentChange({area:[{x:b.clientX+E,y:b.clientY},{x:R,y:x.top},{x:T,y:x.top},{x:T,y:x.bottom},{x:R,y:x.bottom}],side:w}),window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.onPointerGraceIntentChange(null),300)}else{if(l.onTriggerLeave(b),b.defaultPrevented)return;l.onPointerGraceIntentChange(null)}})),onKeyDown:Te(e.onKeyDown,b=>{e.disabled||b.target!==b.currentTarget||l.searchRef.current!==""&&b.key===" "||IA[i.dir].includes(b.key)&&(r.onOpenChange(!0),r.content?.focus(),b.preventDefault())})})})});JS.displayName=Qo;var WS="MenuSubContent",e1=S.forwardRef((e,t)=>{const r=$S(er,e.__scopeMenu),{forceMount:i=r.forceMount,align:o="start",...l}=e,u=Li(er,e.__scopeMenu),d=Sl(er,e.__scopeMenu),m=XS(WS,e.__scopeMenu),p=S.useRef(null),y=at(t,p);return f.jsx(cl.Provider,{scope:e.__scopeMenu,children:f.jsx(gr,{present:i||u.open,children:f.jsx(cl.Slot,{scope:e.__scopeMenu,children:f.jsx($p,{id:m.contentId,"aria-labelledby":m.triggerId,...l,ref:y,align:o,side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:v=>{d.isUsingKeyboardRef.current&&p.current?.focus(),v.preventDefault()},onCloseAutoFocus:v=>v.preventDefault(),onFocusOutside:Te(e.onFocusOutside,v=>{v.target!==m.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:Te(e.onEscapeKeyDown,v=>{d.onClose(),v.preventDefault()}),onKeyDown:Te(e.onKeyDown,v=>{const b=v.currentTarget.contains(v.target),x=PA[d.dir].includes(v.key);b&&x&&(u.onOpenChange(!1),m.trigger?.focus(),v.preventDefault())})})})})})});e1.displayName=WS;function t1(e){return e?"open":"closed"}function xu(e){return e==="indeterminate"}function Fp(e){return xu(e)?"indeterminate":e?"checked":"unchecked"}function iM(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function sM(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function oM(e,t,r){const o=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=sM(e,Math.max(l,0));o.length===1&&(u=u.filter(p=>p!==r));const m=u.find(p=>p.toLowerCase().startsWith(o.toLowerCase()));return m!==r?m:void 0}function lM(e,t){const{x:r,y:i}=e;let o=!1;for(let l=0,u=t.length-1;li!=b>i&&r<(v-p)*(i-y)/(b-y)+p&&(o=!o)}return o}function cM(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return lM(r,t)}function ul(e){return t=>t.pointerType==="mouse"?e(t):void 0}var uM=LS,dM=kp,fM=IS,hM=PS,mM=Ip,pM=FS,gM=Hu,vM=US,yM=BS,bM=GS,xM=KS,wM=YS,SM=QS,_M=JS,CM=e1,Bu="DropdownMenu",[EM]=Ka(Bu,[kS]),vn=kS(),[RM,n1]=EM(Bu),r1=e=>{const{__scopeDropdownMenu:t,children:r,dir:i,open:o,defaultOpen:l,onOpenChange:u,modal:d=!0}=e,m=vn(t),p=S.useRef(null),[y,v]=Hs({prop:o,defaultProp:l??!1,onChange:u,caller:Bu});return f.jsx(RM,{scope:t,triggerId:fn(),triggerRef:p,contentId:fn(),open:y,onOpenChange:v,onOpenToggle:S.useCallback(()=>v(b=>!b),[v]),modal:d,children:f.jsx(uM,{...m,open:y,onOpenChange:v,dir:i,modal:d,children:r})})};r1.displayName=Bu;var a1="DropdownMenuTrigger",i1=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:i=!1,...o}=e,l=n1(a1,r),u=vn(r),d=at(t,l.triggerRef);return f.jsx(dM,{asChild:!0,...u,children:f.jsx(Pe.button,{type:"button",id:l.triggerId,"aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.contentId:void 0,"data-state":l.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...o,ref:d,onPointerDown:Te(e.onPointerDown,m=>{!i&&m.button===0&&m.ctrlKey===!1&&(l.onOpenToggle(),l.open||m.preventDefault())}),onKeyDown:Te(e.onKeyDown,m=>{i||(["Enter"," "].includes(m.key)&&l.onOpenToggle(),m.key==="ArrowDown"&&l.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(m.key)&&m.preventDefault())})})})});i1.displayName=a1;var jM="DropdownMenuPortal",s1=e=>{const{__scopeDropdownMenu:t,...r}=e,i=vn(t);return f.jsx(fM,{...i,...r})};s1.displayName=jM;var o1="DropdownMenuContent",l1=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=n1(o1,r),l=vn(r),u=S.useRef(!1);return f.jsx(hM,{id:o.contentId,"aria-labelledby":o.triggerId,...l,...i,ref:t,onCloseAutoFocus:Te(e.onCloseAutoFocus,d=>{u.current||o.triggerRef.current?.focus(),u.current=!1,d.preventDefault()}),onInteractOutside:Te(e.onInteractOutside,d=>{const m=d.detail.originalEvent,p=m.button===0&&m.ctrlKey===!0,y=m.button===2||p;(!o.modal||y)&&(u.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)"}})});l1.displayName=o1;var TM="DropdownMenuGroup",OM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(mM,{...o,...i,ref:t})});OM.displayName=TM;var AM="DropdownMenuLabel",c1=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(pM,{...o,...i,ref:t})});c1.displayName=AM;var MM="DropdownMenuItem",u1=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(gM,{...o,...i,ref:t})});u1.displayName=MM;var NM="DropdownMenuCheckboxItem",DM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(vM,{...o,...i,ref:t})});DM.displayName=NM;var kM="DropdownMenuRadioGroup",zM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(yM,{...o,...i,ref:t})});zM.displayName=kM;var LM="DropdownMenuRadioItem",$M=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(bM,{...o,...i,ref:t})});$M.displayName=LM;var IM="DropdownMenuItemIndicator",PM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(xM,{...o,...i,ref:t})});PM.displayName=IM;var FM="DropdownMenuSeparator",VM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(wM,{...o,...i,ref:t})});VM.displayName=FM;var UM="DropdownMenuArrow",HM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(SM,{...o,...i,ref:t})});HM.displayName=UM;var BM="DropdownMenuSubTrigger",qM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(_M,{...o,...i,ref:t})});qM.displayName=BM;var GM="DropdownMenuSubContent",ZM=S.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,o=vn(r);return f.jsx(CM,{...o,...i,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)"}})});ZM.displayName=GM;var KM=r1,YM=i1,QM=s1,XM=l1,JM=c1,WM=u1,eN="Label",d1=S.forwardRef((e,t)=>f.jsx(Pe.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));d1.displayName=eN;var tN=d1;function nx(e,[t,r]){return Math.min(r,Math.max(t,e))}var nN=[" ","Enter","ArrowUp","ArrowDown"],rN=[" ","Enter"],Ti="Select",[qu,Gu,aN]=up(Ti),[$i]=Ka(Ti,[aN,Qs]),Zu=Qs(),[iN,Qa]=$i(Ti),[sN,oN]=$i(Ti),lN="SelectProvider";function f1(e){const{__scopeSelect:t,children:r,open:i,defaultOpen:o,onOpenChange:l,value:u,defaultValue:d,onValueChange:m,dir:p,name:y,autoComplete:v,disabled:b,required:x,form:w,internal_do_not_use_render:_}=e,E=Zu(t),[R,T]=S.useState(null),[O,N]=S.useState(null),[z,B]=S.useState(!1),H=dp(p),[I,ne]=Hs({prop:i,defaultProp:o??!1,onChange:l,caller:Ti}),[ge,pe]=Hs({prop:u,defaultProp:d,onChange:m,caller:Ti}),he=S.useRef(null),de=S.useRef(ge);S.useEffect(()=>{const M=w?R?.ownerDocument.getElementById(w):R?.form;if(M instanceof HTMLFormElement){const U=()=>pe(de.current);return M.addEventListener("reset",U),()=>M.removeEventListener("reset",U)}},[w,R,pe]);const ee=R?!!w||!!R.closest("form"):!0,[ye,L]=S.useState(new Set),Z=fn(),re=Array.from(ye).map(M=>M.props.value).join(";"),X=S.useCallback(M=>{L(U=>new Set(U).add(M))},[]),te=S.useCallback(M=>{L(U=>{const Q=new Set(U);return Q.delete(M),Q})},[]),D={required:x,trigger:R,onTriggerChange:T,valueNode:O,onValueNodeChange:N,valueNodeHasChildren:z,onValueNodeHasChildrenChange:B,contentId:Z,value:ge,onValueChange:pe,open:I,onOpenChange:ne,dir:H,triggerPointerDownPosRef:he,disabled:b,name:y,autoComplete:v,form:w,nativeOptions:ye,nativeSelectKey:re,isFormControl:ee};return f.jsx(Ap,{...E,children:f.jsx(iN,{scope:t,...D,children:f.jsx(qu.Provider,{scope:t,children:f.jsx(sN,{scope:t,onNativeOptionAdd:X,onNativeOptionRemove:te,children:EN(_)?_(D):r})})})})}f1.displayName=lN;var h1=e=>{const{__scopeSelect:t,children:r,...i}=e;return f.jsx(f1,{__scopeSelect:t,...i,internal_do_not_use_render:({isFormControl:o})=>f.jsxs(f.Fragment,{children:[r,o?f.jsx(P1,{__scopeSelect:t}):null]})})};h1.displayName=Ti;var m1="SelectTrigger",p1=S.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:i=!1,...o}=e,l=Zu(r),u=Qa(m1,r),d=u.disabled||i,m=at(t,u.onTriggerChange),p=Gu(r),y=S.useRef("touch"),[v,b,x]=F1(_=>{const E=p().filter(O=>!O.disabled),R=E.find(O=>O.value===u.value),T=V1(E,_,R);T!==void 0&&u.onValueChange(T.value)}),w=_=>{d||(u.onOpenChange(!0),x()),_&&(u.triggerPointerDownPosRef.current={x:Math.round(_.pageX),y:Math.round(_.pageY)})};return f.jsx(Mp,{asChild:!0,...l,children:f.jsx(Pe.button,{type:"button",role:"combobox","aria-controls":u.open?u.contentId:void 0,"aria-expanded":u.open,"aria-required":u.required,"aria-autocomplete":"none",dir:u.dir,"data-state":u.open?"open":"closed",disabled:d,"data-disabled":d?"":void 0,"data-placeholder":Ku(u.value)?"":void 0,...o,ref:m,onClick:Te(o.onClick,_=>{_.currentTarget.focus(),y.current!=="mouse"&&w(_)}),onPointerDown:Te(o.onPointerDown,_=>{y.current=_.pointerType;const E=_.target;E.hasPointerCapture(_.pointerId)&&E.releasePointerCapture(_.pointerId),_.button===0&&_.ctrlKey===!1&&_.pointerType==="mouse"&&(w(_),_.preventDefault())}),onKeyDown:Te(o.onKeyDown,_=>{const E=v.current!=="";!(_.ctrlKey||_.altKey||_.metaKey)&&_.key.length===1&&b(_.key),!(E&&_.key===" ")&&nN.includes(_.key)&&(w(),_.preventDefault())})})})});p1.displayName=m1;var g1="SelectValue",v1=S.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:o,children:l,placeholder:u="",...d}=e,m=Qa(g1,r),{onValueNodeHasChildrenChange:p}=m,y=l!==void 0,v=at(t,m.onValueNodeChange);Qt(()=>{p(y)},[p,y]);const b=Ku(m.value);return f.jsx(Pe.span,{...d,asChild:b?!1:d.asChild,ref:v,style:{pointerEvents:"none"},children:f.jsx(S.Fragment,{children:b?u:l},b?"placeholder":"value")})});v1.displayName=g1;var cN="SelectIcon",y1=S.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,...o}=e;return f.jsx(Pe.span,{"aria-hidden":!0,...o,ref:t,children:i||"▼"})});y1.displayName=cN;var b1="SelectPortal",[uN,dN]=$i(b1,{forceMount:void 0}),x1=e=>{const{__scopeSelect:t,forceMount:r,...i}=e;return f.jsx(uN,{scope:e.__scopeSelect,forceMount:r,children:f.jsx(bl,{asChild:!0,...i})})};x1.displayName=b1;var qa="SelectContent",w1=S.forwardRef((e,t)=>{const r=dN(qa,e.__scopeSelect),{forceMount:i=r.forceMount,...o}=e,l=Qa(qa,e.__scopeSelect),[u,d]=S.useState();return Qt(()=>{d(new DocumentFragment)},[]),f.jsx(gr,{present:i||l.open,children:({present:m})=>m?f.jsx(C1,{...o,ref:t}):f.jsx(S1,{...o,fragment:u})})});w1.displayName=qa;var S1=S.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,fragment:o}=e;return o?ki.createPortal(f.jsx(_1,{scope:r,children:f.jsx(qu.Slot,{scope:r,children:f.jsx("div",{ref:t,children:i})})}),o):null});S1.displayName="SelectContentFragment";var dr=10,[_1,Xa]=$i(qa),fN="SelectContentImpl",hN=Ei("SelectContent.RemoveScroll"),C1=S.forwardRef((e,t)=>{const{__scopeSelect:r}=e,{position:i="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:l,onPointerDownOutside:u,side:d,sideOffset:m,align:p,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:x,sticky:w,hideWhenDetached:_,avoidCollisions:E,...R}=e,T=Qa(qa,r),[O,N]=S.useState(null),[z,B]=S.useState(null),H=at(t,N),[I,ne]=S.useState(null),[ge,pe]=S.useState(null),he=Gu(r),[de,ee]=S.useState(!1),ye=S.useRef(!1);S.useEffect(()=>{if(O)return mp(O)},[O]),hp();const L=S.useCallback(ae=>{const[xe,...we]=he().map(He=>He.ref.current),[Me]=we.slice(-1),Fe=document.activeElement;for(const He of ae)if(He===Fe||(He?.scrollIntoView({block:"nearest"}),He===xe&&z&&(z.scrollTop=0),He===Me&&z&&(z.scrollTop=z.scrollHeight),He?.focus(),document.activeElement!==Fe))return},[he,z]),Z=S.useCallback(()=>L([I,O]),[L,I,O]);S.useEffect(()=>{de&&Z()},[de,Z]);const{onOpenChange:re,triggerPointerDownPosRef:X}=T;S.useEffect(()=>{if(O){let ae={x:0,y:0};const xe=Me=>{ae={x:Math.abs(Math.round(Me.pageX)-(X.current?.x??0)),y:Math.abs(Math.round(Me.pageY)-(X.current?.y??0))}},we=Me=>{ae.x<=10&&ae.y<=10?Me.preventDefault():Me.composedPath().includes(O)||re(!1),document.removeEventListener("pointermove",xe),X.current=null};return X.current!==null&&(document.addEventListener("pointermove",xe),document.addEventListener("pointerup",we,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",we,{capture:!0})}}},[O,re,X]),S.useEffect(()=>{const ae=()=>re(!1);return window.addEventListener("blur",ae),window.addEventListener("resize",ae),()=>{window.removeEventListener("blur",ae),window.removeEventListener("resize",ae)}},[re]);const[te,D]=F1(ae=>{const xe=he().filter(Fe=>!Fe.disabled),we=xe.find(Fe=>Fe.ref.current===document.activeElement),Me=V1(xe,ae,we);Me&&setTimeout(()=>Me.ref.current?.focus())}),M=S.useCallback((ae,xe,we)=>{const Me=!ye.current&&!we;(T.value!==void 0&&T.value===xe||Me)&&(ne(ae),Me&&(ye.current=!0))},[T.value]),U=S.useCallback(()=>O?.focus(),[O]),Q=S.useCallback((ae,xe,we)=>{const Me=!ye.current&&!we;(T.value!==void 0&&T.value===xe||Me)&&pe(ae)},[T.value]),K=i==="popper"?Rm:E1,fe=K===Rm?{side:d,sideOffset:m,align:p,alignOffset:y,arrowPadding:v,collisionBoundary:b,collisionPadding:x,sticky:w,hideWhenDetached:_,avoidCollisions:E}:{};return f.jsx(_1,{scope:r,content:O,viewport:z,onViewportChange:B,itemRefCallback:M,selectedItem:I,onItemLeave:U,itemTextRefCallback:Q,focusSelectedItem:Z,selectedItemText:ge,position:i,isPositioned:de,searchRef:te,children:f.jsx(zu,{as:hN,allowPinchZoom:!0,children:f.jsx(Du,{asChild:!0,trapped:T.open,onMountAutoFocus:ae=>{ae.preventDefault()},onUnmountAutoFocus:Te(o,ae=>{T.trigger?.focus({preventScroll:!0}),ae.preventDefault()}),children:f.jsx(yl,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:ae=>ae.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:f.jsx(K,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:ae=>ae.preventDefault(),...R,...fe,onPlaced:()=>ee(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...R.style},onKeyDown:Te(R.onKeyDown,ae=>{const xe=ae.ctrlKey||ae.altKey||ae.metaKey;if(ae.key==="Tab"&&ae.preventDefault(),!xe&&ae.key.length===1&&D(ae.key),["ArrowUp","ArrowDown","Home","End"].includes(ae.key)){let Me=he().filter(Fe=>!Fe.disabled).map(Fe=>Fe.ref.current);if(["ArrowUp","End"].includes(ae.key)&&(Me=Me.slice().reverse()),["ArrowUp","ArrowDown"].includes(ae.key)){const Fe=ae.target,He=Me.indexOf(Fe);Me=Me.slice(He+1)}setTimeout(()=>L(Me)),ae.preventDefault()}})})})})})})});C1.displayName=fN;var mN="SelectItemAlignedPosition",E1=S.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:i,...o}=e,l=Qa(qa,r),u=Xa(qa,r),[d,m]=S.useState(null),[p,y]=S.useState(null),v=at(t,y),b=Gu(r),x=S.useRef(!1),w=S.useRef(!0),{viewport:_,selectedItem:E,selectedItemText:R,focusSelectedItem:T}=u,O=S.useCallback(()=>{if(l.trigger&&l.valueNode&&d&&p&&_&&E&&R){const H=l.trigger.getBoundingClientRect(),I=p.getBoundingClientRect(),ne=l.valueNode.getBoundingClientRect(),ge=R.getBoundingClientRect();if(l.dir!=="rtl"){const Fe=ge.left-I.left,He=ne.left-Fe,ct=H.left-He,Je=H.width+ct,hn=Math.max(Je,I.width),mn=window.innerWidth-dr,Xt=nx(He,[dr,Math.max(dr,mn-hn)]);d.style.minWidth=Je+"px",d.style.left=Xt+"px"}else{const Fe=I.right-ge.right,He=window.innerWidth-ne.right-Fe,ct=window.innerWidth-H.right-He,Je=H.width+ct,hn=Math.max(Je,I.width),mn=window.innerWidth-dr,Xt=nx(He,[dr,Math.max(dr,mn-hn)]);d.style.minWidth=Je+"px",d.style.right=Xt+"px"}const pe=b(),he=window.innerHeight-dr*2,de=_.scrollHeight,ee=window.getComputedStyle(p),ye=parseInt(ee.borderTopWidth,10),L=parseInt(ee.paddingTop,10),Z=parseInt(ee.borderBottomWidth,10),re=parseInt(ee.paddingBottom,10),X=ye+L+de+re+Z,te=Math.min(E.offsetHeight*5,X),D=window.getComputedStyle(_),M=parseInt(D.paddingTop,10),U=parseInt(D.paddingBottom,10),Q=H.top+H.height/2-dr,K=he-Q,fe=E.offsetHeight/2,ae=E.offsetTop+fe,xe=ye+L+ae,we=X-xe;if(xe<=Q){const Fe=pe.length>0&&E===pe[pe.length-1].ref.current;d.style.bottom="0px";const He=p.clientHeight-_.offsetTop-_.offsetHeight,ct=Math.max(K,fe+(Fe?U:0)+He+Z),Je=xe+ct;d.style.height=Je+"px"}else{const Fe=pe.length>0&&E===pe[0].ref.current;d.style.top="0px";const ct=Math.max(Q,ye+_.offsetTop+(Fe?M:0)+fe)+we;d.style.height=ct+"px",_.scrollTop=xe-Q+_.offsetTop}d.style.margin=`${dr}px 0`,d.style.minHeight=te+"px",d.style.maxHeight=he+"px",i?.(),requestAnimationFrame(()=>x.current=!0)}},[b,l.trigger,l.valueNode,d,p,_,E,R,l.dir,i]);Qt(()=>O(),[O]);const[N,z]=S.useState();Qt(()=>{p&&z(window.getComputedStyle(p).zIndex)},[p]);const B=S.useCallback(H=>{H&&w.current===!0&&(O(),T?.(),w.current=!1)},[O,T]);return f.jsx(gN,{scope:r,contentWrapper:d,shouldExpandOnScrollRef:x,onScrollButtonChange:B,children:f.jsx("div",{ref:m,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:f.jsx(Pe.div,{...o,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});E1.displayName=mN;var pN="SelectPopperPosition",Rm=S.forwardRef((e,t)=>{const{__scopeSelect:r,align:i="start",collisionPadding:o=dr,...l}=e,u=Zu(r);return f.jsx(Np,{...u,...l,ref:t,align:i,collisionPadding:o,style:{boxSizing:"border-box",...l.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Rm.displayName=pN;var[gN,Vp]=$i(qa,{}),jm="SelectViewport",R1=S.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:i,...o}=e,l=Xa(jm,r),u=Vp(jm,r),d=at(t,l.onViewportChange),m=S.useRef(0);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:i}),f.jsx(qu.Slot,{scope:r,children:f.jsx(Pe.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:d,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Te(o.onScroll,p=>{const y=p.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:b}=u;if(b?.current&&v){const x=Math.abs(m.current-y.scrollTop);if(x>0){const w=window.innerHeight-dr*2,_=parseFloat(v.style.minHeight),E=parseFloat(v.style.height),R=Math.max(_,E);if(R0?N:0,v.style.justifyContent="flex-end")}}}m.current=y.scrollTop})})})]})});R1.displayName=jm;var j1="SelectGroup",[vN,yN]=$i(j1),bN=S.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,o=fn();return f.jsx(vN,{scope:r,id:o,children:f.jsx(Pe.div,{role:"group","aria-labelledby":o,...i,ref:t})})});bN.displayName=j1;var T1="SelectLabel",xN=S.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,o=yN(T1,r);return f.jsx(Pe.div,{id:o.id,...i,ref:t})});xN.displayName=T1;var wu="SelectItem",[wN,O1]=$i(wu),A1=S.forwardRef((e,t)=>{const{__scopeSelect:r,value:i,disabled:o=!1,textValue:l,...u}=e,d=Qa(wu,r),m=Xa(wu,r),p=d.value===i,[y,v]=S.useState(l??""),[b,x]=S.useState(!1),w=tr(O=>m.itemRefCallback?.(O,i,o)),_=at(t,w),E=fn(),R=S.useRef("touch"),T=()=>{o||(d.onValueChange(i),d.onOpenChange(!1))};return f.jsx(wN,{scope:r,value:i,disabled:o,textId:E,isSelected:p,onItemTextChange:S.useCallback(O=>{v(N=>N||(O?.textContent??"").trim())},[]),children:f.jsx(qu.ItemSlot,{scope:r,value:i,disabled:o,textValue:y,children:f.jsx(Pe.div,{role:"option","aria-labelledby":E,"data-highlighted":b?"":void 0,"aria-selected":p&&b,"data-state":p?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...u,ref:_,onFocus:Te(u.onFocus,()=>x(!0)),onBlur:Te(u.onBlur,()=>x(!1)),onClick:Te(u.onClick,()=>{R.current!=="mouse"&&T()}),onPointerUp:Te(u.onPointerUp,()=>{R.current==="mouse"&&T()}),onPointerDown:Te(u.onPointerDown,O=>{R.current=O.pointerType}),onPointerMove:Te(u.onPointerMove,O=>{R.current=O.pointerType,o?m.onItemLeave?.():R.current==="mouse"&&O.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Te(u.onPointerLeave,O=>{O.currentTarget===document.activeElement&&m.onItemLeave?.()}),onKeyDown:Te(u.onKeyDown,O=>{o||O.target!==O.currentTarget||m.searchRef?.current!==""&&O.key===" "||(rN.includes(O.key)&&T(),O.key===" "&&O.preventDefault())})})})})});A1.displayName=wu;var Xo="SelectItemText",M1=S.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:o,...l}=e,u=Qa(Xo,r),d=Xa(Xo,r),m=O1(Xo,r),p=oN(Xo,r),[y,v]=S.useState(null),b=tr(T=>d.itemTextRefCallback?.(T,m.value,m.disabled)),x=at(t,v,m.onItemTextChange,b),w=y?.textContent,_=S.useMemo(()=>f.jsx("option",{value:m.value,disabled:m.disabled,children:w},m.value),[m.disabled,m.value,w]),{onNativeOptionAdd:E,onNativeOptionRemove:R}=p;return Qt(()=>(E(_),()=>R(_)),[E,R,_]),f.jsxs(f.Fragment,{children:[f.jsx(Pe.span,{id:m.textId,...l,ref:x}),m.isSelected&&u.valueNode&&!u.valueNodeHasChildren&&!Ku(u.value)?ki.createPortal(l.children,u.valueNode):null]})});M1.displayName=Xo;var N1="SelectItemIndicator",D1=S.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return O1(N1,r).isSelected?f.jsx(Pe.span,{"aria-hidden":!0,...i,ref:t}):null});D1.displayName=N1;var Tm="SelectScrollUpButton",k1=S.forwardRef((e,t)=>{const r=Xa(Tm,e.__scopeSelect),i=Vp(Tm,e.__scopeSelect),[o,l]=S.useState(!1),u=at(t,i.onScrollButtonChange);return Qt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const p=m.scrollTop>0;l(p)};const m=r.viewport;return d(),m.addEventListener("scroll",d),()=>m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),o?f.jsx(L1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop-m.offsetHeight)}}):null});k1.displayName=Tm;var Om="SelectScrollDownButton",z1=S.forwardRef((e,t)=>{const r=Xa(Om,e.__scopeSelect),i=Vp(Om,e.__scopeSelect),[o,l]=S.useState(!1),u=at(t,i.onScrollButtonChange);return Qt(()=>{if(r.viewport&&r.isPositioned){let d=function(){const p=m.scrollHeight-m.clientHeight,y=Math.ceil(m.scrollTop)m.removeEventListener("scroll",d)}},[r.viewport,r.isPositioned]),o?f.jsx(L1,{...e,ref:u,onAutoScroll:()=>{const{viewport:d,selectedItem:m}=r;d&&m&&(d.scrollTop=d.scrollTop+m.offsetHeight)}}):null});z1.displayName=Om;var L1=S.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:i,...o}=e,l=Xa("SelectScrollButton",r),u=S.useRef(null),d=Gu(r),m=S.useCallback(()=>{u.current!==null&&(window.clearInterval(u.current),u.current=null)},[]);return S.useEffect(()=>()=>m(),[m]),Qt(()=>{d().find(y=>y.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[d]),f.jsx(Pe.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:Te(o.onPointerDown,()=>{u.current===null&&(u.current=window.setInterval(i,50))}),onPointerMove:Te(o.onPointerMove,()=>{l.onItemLeave?.(),u.current===null&&(u.current=window.setInterval(i,50))}),onPointerLeave:Te(o.onPointerLeave,()=>{m()})})}),SN="SelectSeparator",_N=S.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return f.jsx(Pe.div,{"aria-hidden":!0,...i,ref:t})});_N.displayName=SN;var $1="SelectArrow",CN=S.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,o=Zu(r);return Xa($1,r).position==="popper"?f.jsx(Dp,{...o,...i,ref:t}):null});CN.displayName=$1;var I1="SelectBubbleInput",P1=S.forwardRef(({__scopeSelect:e,...t},r)=>{const i=Qa(I1,e),{value:o,onValueChange:l,required:u,disabled:d,name:m,autoComplete:p,form:y}=i,{nativeOptions:v,nativeSelectKey:b}=i,x=S.useRef(null),w=at(r,x),_=o??"",E=iO(_),R=Array.from(v).some(T=>(T.props.value??"")==="");return S.useEffect(()=>{const T=x.current;if(!T)return;const O=window.HTMLSelectElement.prototype,z=Object.getOwnPropertyDescriptor(O,"value").set;if(E!==_&&z){const B=new Event("change",{bubbles:!0});z.call(T,_),T.dispatchEvent(B)}},[E,_]),f.jsxs(Pe.select,{"aria-hidden":!0,required:u,tabIndex:-1,name:m,autoComplete:p,disabled:d,form:y,onChange:T=>l(T.target.value),...t,style:{...Pw,...t.style},ref:w,defaultValue:_,children:[Ku(o)&&!R?f.jsx("option",{value:""}):null,Array.from(v)]},b)});P1.displayName=I1;function EN(e){return typeof e=="function"}function Ku(e){return e===""||e===void 0}function F1(e){const t=tr(e),r=S.useRef(""),i=S.useRef(0),o=S.useCallback(u=>{const d=r.current+u;t(d),(function m(p){r.current=p,window.clearTimeout(i.current),p!==""&&(i.current=window.setTimeout(()=>m(""),1e3))})(d)},[t]),l=S.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return S.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,o,l]}function V1(e,t,r){const o=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,l=r?e.indexOf(r):-1;let u=RN(e,Math.max(l,0));o.length===1&&(u=u.filter(p=>p!==r));const m=u.find(p=>p.textValue.toLowerCase().startsWith(o.toLowerCase()));return m!==r?m:void 0}function RN(e,t){return e.map((r,i)=>e[(t+i)%e.length])}var jN="Separator",rx="horizontal",TN=["horizontal","vertical"],U1=S.forwardRef((e,t)=>{const{decorative:r,orientation:i=rx,...o}=e,l=ON(i)?i:rx,d=r?{role:"none"}:{"aria-orientation":l==="vertical"?l:void 0,role:"separator"};return f.jsx(Pe.div,{"data-orientation":l,...d,...o,ref:t})});U1.displayName=jN;function ON(e){return TN.includes(e)}var AN=U1,[Yu]=Ka("Tooltip",[Qs]),Qu=Qs(),H1="TooltipProvider",MN=700,Am="tooltip.open",[NN,Up]=Yu(H1),B1=e=>{const{__scopeTooltip:t,delayDuration:r=MN,skipDelayDuration:i=300,disableHoverableContent:o=!1,children:l}=e,u=S.useRef(!0),d=S.useRef(!1),m=S.useRef(0);return S.useEffect(()=>{const p=m.current;return()=>window.clearTimeout(p)},[]),f.jsx(NN,{scope:t,isOpenDelayedRef:u,delayDuration:r,onOpen:S.useCallback(()=>{i<=0||(window.clearTimeout(m.current),u.current=!1)},[i]),onClose:S.useCallback(()=>{i<=0||(window.clearTimeout(m.current),m.current=window.setTimeout(()=>u.current=!0,i))},[i]),isPointerInTransitRef:d,onPointerInTransitChange:S.useCallback(p=>{d.current=p},[]),disableHoverableContent:o,children:l})};B1.displayName=H1;var dl="Tooltip",[DN,_l]=Yu(dl),q1=e=>{const{__scopeTooltip:t,children:r,open:i,defaultOpen:o,onOpenChange:l,disableHoverableContent:u,delayDuration:d}=e,m=Up(dl,e.__scopeTooltip),p=Qu(t),[y,v]=S.useState(null),b=fn(),x=S.useRef(0),w=u??m.disableHoverableContent,_=d??m.delayDuration,E=S.useRef(!1),[R,T]=Hs({prop:i,defaultProp:o??!1,onChange:H=>{H?(m.onOpen(),document.dispatchEvent(new CustomEvent(Am))):m.onClose(),l?.(H)},caller:dl}),O=S.useMemo(()=>R?E.current?"delayed-open":"instant-open":"closed",[R]),N=S.useCallback(()=>{window.clearTimeout(x.current),x.current=0,E.current=!1,T(!0)},[T]),z=S.useCallback(()=>{window.clearTimeout(x.current),x.current=0,T(!1)},[T]),B=S.useCallback(()=>{window.clearTimeout(x.current),x.current=window.setTimeout(()=>{E.current=!0,T(!0),x.current=0},_)},[_,T]);return S.useEffect(()=>()=>{x.current&&(window.clearTimeout(x.current),x.current=0)},[]),f.jsx(Ap,{...p,children:f.jsx(DN,{scope:t,contentId:b,open:R,stateAttribute:O,trigger:y,onTriggerChange:v,onTriggerEnter:S.useCallback(()=>{m.isOpenDelayedRef.current?B():N()},[m.isOpenDelayedRef,B,N]),onTriggerLeave:S.useCallback(()=>{w?z():(window.clearTimeout(x.current),x.current=0)},[z,w]),onOpen:N,onClose:z,disableHoverableContent:w,children:r})})};q1.displayName=dl;var Mm="TooltipTrigger",G1=S.forwardRef((e,t)=>{const{__scopeTooltip:r,...i}=e,o=_l(Mm,r),l=Up(Mm,r),u=Qu(r),d=S.useRef(null),m=at(t,d,o.onTriggerChange),p=S.useRef(!1),y=S.useRef(!1),v=S.useCallback(()=>p.current=!1,[]);return S.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),f.jsx(Mp,{asChild:!0,...u,children:f.jsx(Pe.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...i,ref:m,onPointerMove:Te(e.onPointerMove,b=>{b.pointerType!=="touch"&&!y.current&&!l.isPointerInTransitRef.current&&(o.onTriggerEnter(),y.current=!0)}),onPointerLeave:Te(e.onPointerLeave,()=>{o.onTriggerLeave(),y.current=!1}),onPointerDown:Te(e.onPointerDown,()=>{o.open&&o.onClose(),p.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:Te(e.onFocus,()=>{p.current||o.onOpen()}),onBlur:Te(e.onBlur,o.onClose),onClick:Te(e.onClick,o.onClose)})})});G1.displayName=Mm;var Hp="TooltipPortal",[kN,zN]=Yu(Hp,{forceMount:void 0}),Z1=e=>{const{__scopeTooltip:t,forceMount:r,children:i,container:o}=e,l=_l(Hp,t);return f.jsx(kN,{scope:t,forceMount:r,children:f.jsx(gr,{present:r||l.open,children:f.jsx(bl,{asChild:!0,container:o,children:i})})})};Z1.displayName=Hp;var qs="TooltipContent",K1=S.forwardRef((e,t)=>{const r=zN(qs,e.__scopeTooltip),{forceMount:i=r.forceMount,side:o="top",...l}=e,u=_l(qs,e.__scopeTooltip);return f.jsx(gr,{present:i||u.open,children:u.disableHoverableContent?f.jsx(Y1,{side:o,...l,ref:t}):f.jsx(LN,{side:o,...l,ref:t})})}),LN=S.forwardRef((e,t)=>{const r=_l(qs,e.__scopeTooltip),i=Up(qs,e.__scopeTooltip),o=S.useRef(null),l=at(t,o),[u,d]=S.useState(null),{trigger:m,onClose:p}=r,y=o.current,{onPointerInTransitChange:v}=i,b=S.useCallback(()=>{d(null),v(!1)},[v]),x=S.useCallback((w,_)=>{const E=w.currentTarget,R={x:w.clientX,y:w.clientY},T=FN(R,E.getBoundingClientRect()),O=VN(R,T),N=UN(_.getBoundingClientRect()),z=BN([...O,...N]);d(z),v(!0)},[v]);return S.useEffect(()=>()=>b(),[b]),S.useEffect(()=>{if(m&&y){const w=E=>x(E,y),_=E=>x(E,m);return m.addEventListener("pointerleave",w),y.addEventListener("pointerleave",_),()=>{m.removeEventListener("pointerleave",w),y.removeEventListener("pointerleave",_)}}},[m,y,x,b]),S.useEffect(()=>{if(u){const w=_=>{const E=_.target,R={x:_.clientX,y:_.clientY},T=m?.contains(E)||y?.contains(E),O=!HN(R,u);T?b():O&&(b(),p())};return document.addEventListener("pointermove",w),()=>document.removeEventListener("pointermove",w)}},[m,y,u,p,b]),f.jsx(Y1,{...e,ref:l})}),[$N,IN]=Yu(dl,{isInside:!1}),PN=Rj("TooltipContent"),Y1=S.forwardRef((e,t)=>{const{__scopeTooltip:r,children:i,"aria-label":o,onEscapeKeyDown:l,onPointerDownOutside:u,...d}=e,m=_l(qs,r),p=Qu(r),{onClose:y}=m;return S.useEffect(()=>(document.addEventListener(Am,y),()=>document.removeEventListener(Am,y)),[y]),S.useEffect(()=>{if(m.trigger){const v=b=>{b.target instanceof Node&&b.target.contains(m.trigger)&&y()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[m.trigger,y]),f.jsx(yl,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:v=>v.preventDefault(),onDismiss:y,children:f.jsxs(Np,{"data-state":m.stateAttribute,...p,...d,ref:t,style:{...d.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:[f.jsx(PN,{children:i}),f.jsx($N,{scope:r,isInside:!0,children:f.jsx($j,{id:m.contentId,role:"tooltip",children:o||i})})]})})});K1.displayName=qs;var Q1="TooltipArrow",X1=S.forwardRef((e,t)=>{const{__scopeTooltip:r,...i}=e,o=Qu(r);return IN(Q1,r).isInside?null:f.jsx(Dp,{...o,...i,ref:t})});X1.displayName=Q1;function FN(e,t){const r=Math.abs(t.top-e.y),i=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),l=Math.abs(t.left-e.x);switch(Math.min(r,i,o,l)){case l:return"left";case o:return"right";case r:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function VN(e,t,r=5){const i=[];switch(t){case"top":i.push({x:e.x-r,y:e.y+r},{x:e.x+r,y:e.y+r});break;case"bottom":i.push({x:e.x-r,y:e.y-r},{x:e.x+r,y:e.y-r});break;case"left":i.push({x:e.x+r,y:e.y-r},{x:e.x+r,y:e.y+r});break;case"right":i.push({x:e.x-r,y:e.y-r},{x:e.x-r,y:e.y+r});break}return i}function UN(e){const{top:t,right:r,bottom:i,left:o}=e;return[{x:o,y:t},{x:r,y:t},{x:r,y:i},{x:o,y:i}]}function HN(e,t){const{x:r,y:i}=e;let o=!1;for(let l=0,u=t.length-1;li!=b>i&&r<(v-p)*(i-y)/(b-y)+p&&(o=!o)}return o}function BN(e){const t=e.slice();return t.sort((r,i)=>r.xi.x?1:r.yi.y?1:0),qN(t)}function qN(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i=2;){const l=t[t.length-1],u=t[t.length-2];if((l.x-u.x)*(o.y-u.y)>=(l.y-u.y)*(o.x-u.x))t.pop();else break}t.push(o)}t.pop();const r=[];for(let i=e.length-1;i>=0;i--){const o=e[i];for(;r.length>=2;){const l=r[r.length-1],u=r[r.length-2];if((l.x-u.x)*(o.y-u.y)>=(l.y-u.y)*(o.x-u.x))r.pop();else break}r.push(o)}return r.pop(),t.length===1&&r.length===1&&t[0].x===r[0].x&&t[0].y===r[0].y?t:t.concat(r)}var GN=B1,ZN=q1,KN=G1,YN=Z1,QN=K1,XN=X1;function J1(e){var t,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t{const r=new Array(e.length+t.length);for(let i=0;i({classGroupId:e,validator:t}),e_=(e=new Map,t=null,r)=>({nextPart:e,validators:t,classGroupId:r}),Su="-",ax=[],eD="arbitrary..",tD=e=>{const t=rD(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:u=>{if(u.startsWith("[")&&u.endsWith("]"))return nD(u);const d=u.split(Su),m=d[0]===""&&d.length>1?1:0;return t_(d,m,t)},getConflictingClassGroupIds:(u,d)=>{if(d){const m=i[u],p=r[u];return m?p?JN(p,m):m:p||ax}return r[u]||ax}}},t_=(e,t,r)=>{if(e.length-t===0)return r.classGroupId;const o=e[t],l=r.nextPart.get(o);if(l){const p=t_(e,t+1,l);if(p)return p}const u=r.validators;if(u===null)return;const d=t===0?e.join(Su):e.slice(t).join(Su),m=u.length;for(let p=0;pe.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const t=e.slice(1,-1),r=t.indexOf(":"),i=t.slice(0,r);return i?eD+i:void 0})(),rD=e=>{const{theme:t,classGroups:r}=e;return aD(r,t)},aD=(e,t)=>{const r=e_();for(const i in e){const o=e[i];Bp(o,r,i,t)}return r},Bp=(e,t,r,i)=>{const o=e.length;for(let l=0;l{if(typeof e=="string"){sD(e,t,r);return}if(typeof e=="function"){oD(e,t,r,i);return}lD(e,t,r,i)},sD=(e,t,r)=>{const i=e===""?t:n_(t,e);i.classGroupId=r},oD=(e,t,r,i)=>{if(cD(e)){Bp(e(i),t,r,i);return}t.validators===null&&(t.validators=[]),t.validators.push(WN(r,e))},lD=(e,t,r,i)=>{const o=Object.entries(e),l=o.length;for(let u=0;u{let r=e;const i=t.split(Su),o=i.length;for(let l=0;l"isThemeGetter"in e&&e.isThemeGetter===!0,uD=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=Object.create(null),i=Object.create(null);const o=(l,u)=>{r[l]=u,t++,t>e&&(t=0,i=r,r=Object.create(null))};return{get(l){let u=r[l];if(u!==void 0)return u;if((u=i[l])!==void 0)return o(l,u),u},set(l,u){l in r?r[l]=u:o(l,u)}}},Nm="!",ix=":",dD=[],sx=(e,t,r,i,o)=>({modifiers:e,hasImportantModifier:t,baseClassName:r,maybePostfixModifierPosition:i,isExternal:o}),fD=e=>{const{prefix:t,experimentalParseClassName:r}=e;let i=o=>{const l=[];let u=0,d=0,m=0,p;const y=o.length;for(let _=0;_m?p-m:void 0;return sx(l,x,b,w)};if(t){const o=t+ix,l=i;i=u=>u.startsWith(o)?l(u.slice(o.length)):sx(dD,!1,u,void 0,!0)}if(r){const o=i;i=l=>r({className:l,parseClassName:o})}return i},hD=e=>{const t=new Map;return e.orderSensitiveModifiers.forEach((r,i)=>{t.set(r,1e6+i)}),r=>{const i=[];let o=[];for(let l=0;l0&&(o.sort(),i.push(...o),o=[]),i.push(u)):o.push(u)}return o.length>0&&(o.sort(),i.push(...o)),i}},mD=e=>({cache:uD(e.cacheSize),parseClassName:fD(e),sortModifiers:hD(e),postfixLookupClassGroupIds:pD(e),...tD(e)}),pD=e=>{const t=Object.create(null),r=e.postfixLookupClassGroups;if(r)for(let i=0;i{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:o,sortModifiers:l,postfixLookupClassGroupIds:u}=t,d=[],m=e.trim().split(gD);let p="";for(let y=m.length-1;y>=0;y-=1){const v=m[y],{isExternal:b,modifiers:x,hasImportantModifier:w,baseClassName:_,maybePostfixModifierPosition:E}=r(v);if(b){p=v+(p.length>0?" "+p:p);continue}let R=!!E,T;if(R){const H=_.substring(0,E);T=i(H);const I=T&&u[T]?i(_):void 0;I&&I!==T&&(T=I,R=!1)}else T=i(_);if(!T){if(!R){p=v+(p.length>0?" "+p:p);continue}if(T=i(_),!T){p=v+(p.length>0?" "+p:p);continue}R=!1}const O=x.length===0?"":x.length===1?x[0]:l(x).join(":"),N=w?O+Nm:O,z=N+T;if(d.indexOf(z)>-1)continue;d.push(z);const B=o(T,R);for(let H=0;H0?" "+p:p)}return p},yD=(...e)=>{let t=0,r,i,o="";for(;t{if(typeof e=="string")return e;let t,r="";for(let i=0;i{let r,i,o,l;const u=m=>{const p=t.reduce((y,v)=>v(y),e());return r=mD(p),i=r.cache.get,o=r.cache.set,l=d,d(m)},d=m=>{const p=i(m);if(p)return p;const y=vD(m,r);return o(m,y),y};return l=u,(...m)=>l(yD(...m))},xD=[],Bt=e=>{const t=r=>r[e]||xD;return t.isThemeGetter=!0,t},a_=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,i_=/^\((?:(\w[\w-]*):)?(.+)\)$/i,wD=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,SD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,_D=/\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$/,CD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,ED=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Da=e=>wD.test(e),Ge=e=>!!e&&!Number.isNaN(Number(e)),Cr=e=>!!e&&Number.isInteger(Number(e)),Bh=e=>e.endsWith("%")&&Ge(e.slice(0,-1)),Jr=e=>SD.test(e),s_=()=>!0,jD=e=>_D.test(e)&&!CD.test(e),qp=()=>!1,TD=e=>ED.test(e),OD=e=>RD.test(e),AD=e=>!Ce(e)&&!Ee(e),MD=e=>e.startsWith("@container")&&(e[10]==="/"&&e[11]!==void 0||e[11]==="s"&&e[16]!==void 0&&e.startsWith("-size/",10)||e[11]==="n"&&e[18]!==void 0&&e.startsWith("-normal/",10)),ND=e=>Ja(e,c_,qp),Ce=e=>a_.test(e),xi=e=>Ja(e,u_,jD),ox=e=>Ja(e,FD,Ge),DD=e=>Ja(e,f_,s_),kD=e=>Ja(e,d_,qp),lx=e=>Ja(e,o_,qp),zD=e=>Ja(e,l_,OD),Yc=e=>Ja(e,h_,TD),Ee=e=>i_.test(e),qo=e=>Ii(e,u_),LD=e=>Ii(e,d_),cx=e=>Ii(e,o_),$D=e=>Ii(e,c_),ID=e=>Ii(e,l_),Qc=e=>Ii(e,h_,!0),PD=e=>Ii(e,f_,!0),Ja=(e,t,r)=>{const i=a_.exec(e);return i?i[1]?t(i[1]):r(i[2]):!1},Ii=(e,t,r=!1)=>{const i=i_.exec(e);return i?i[1]?t(i[1]):r:!1},o_=e=>e==="position"||e==="percentage",l_=e=>e==="image"||e==="url",c_=e=>e==="length"||e==="size"||e==="bg-size",u_=e=>e==="length",FD=e=>e==="number",d_=e=>e==="family-name",f_=e=>e==="number"||e==="weight",h_=e=>e==="shadow",VD=()=>{const e=Bt("color"),t=Bt("font"),r=Bt("text"),i=Bt("font-weight"),o=Bt("tracking"),l=Bt("leading"),u=Bt("breakpoint"),d=Bt("container"),m=Bt("spacing"),p=Bt("radius"),y=Bt("shadow"),v=Bt("inset-shadow"),b=Bt("text-shadow"),x=Bt("drop-shadow"),w=Bt("blur"),_=Bt("perspective"),E=Bt("aspect"),R=Bt("ease"),T=Bt("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],N=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],z=()=>[...N(),Ee,Ce],B=()=>["auto","hidden","clip","visible","scroll"],H=()=>["auto","contain","none"],I=()=>[Ee,Ce,m],ne=()=>[Da,"full","auto",...I()],ge=()=>[Cr,"none","subgrid",Ee,Ce],pe=()=>["auto",{span:["full",Cr,Ee,Ce]},Cr,Ee,Ce],he=()=>[Cr,"auto",Ee,Ce],de=()=>["auto","min","max","fr",Ee,Ce],ee=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ye=()=>["start","end","center","stretch","center-safe","end-safe"],L=()=>["auto",...I()],Z=()=>[Da,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...I()],re=()=>[Da,"screen","full","dvw","lvw","svw","min","max","fit",...I()],X=()=>[Da,"screen","full","lh","dvh","lvh","svh","min","max","fit",...I()],te=()=>[e,Ee,Ce],D=()=>[...N(),cx,lx,{position:[Ee,Ce]}],M=()=>["no-repeat",{repeat:["","x","y","space","round"]}],U=()=>["auto","cover","contain",$D,ND,{size:[Ee,Ce]}],Q=()=>[Bh,qo,xi],K=()=>["","none","full",p,Ee,Ce],fe=()=>["",Ge,qo,xi],ae=()=>["solid","dashed","dotted","double"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],we=()=>[Ge,Bh,cx,lx],Me=()=>["","none",w,Ee,Ce],Fe=()=>["none",Ge,Ee,Ce],He=()=>["none",Ge,Ee,Ce],ct=()=>[Ge,Ee,Ce],Je=()=>[Da,"full",...I()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Jr],breakpoint:[Jr],color:[s_],container:[Jr],"drop-shadow":[Jr],ease:["in","out","in-out"],font:[AD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Jr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Jr],shadow:[Jr],spacing:["px",Ge],text:[Jr],"text-shadow":[Jr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Da,Ce,Ee,E]}],container:["container"],"container-type":[{"@container":["","normal","size",Ee,Ce]}],"container-named":[MD],columns:[{columns:[Ge,Ce,Ee,d]}],"break-after":[{"break-after":O()}],"break-before":[{"break-before":O()}],"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"],sr:["sr-only","not-sr-only"],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:z()}],overflow:[{overflow:B()}],"overflow-x":[{"overflow-x":B()}],"overflow-y":[{"overflow-y":B()}],overscroll:[{overscroll:H()}],"overscroll-x":[{"overscroll-x":H()}],"overscroll-y":[{"overscroll-y":H()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:ne()}],"inset-x":[{"inset-x":ne()}],"inset-y":[{"inset-y":ne()}],start:[{"inset-s":ne(),start:ne()}],end:[{"inset-e":ne(),end:ne()}],"inset-bs":[{"inset-bs":ne()}],"inset-be":[{"inset-be":ne()}],top:[{top:ne()}],right:[{right:ne()}],bottom:[{bottom:ne()}],left:[{left:ne()}],visibility:["visible","invisible","collapse"],z:[{z:[Cr,"auto",Ee,Ce]}],basis:[{basis:[Da,"full","auto",d,...I()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Ge,Da,"auto","initial","none",Ce]}],grow:[{grow:["",Ge,Ee,Ce]}],shrink:[{shrink:["",Ge,Ee,Ce]}],order:[{order:[Cr,"first","last","none",Ee,Ce]}],"grid-cols":[{"grid-cols":ge()}],"col-start-end":[{col:pe()}],"col-start":[{"col-start":he()}],"col-end":[{"col-end":he()}],"grid-rows":[{"grid-rows":ge()}],"row-start-end":[{row:pe()}],"row-start":[{"row-start":he()}],"row-end":[{"row-end":he()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":de()}],"auto-rows":[{"auto-rows":de()}],gap:[{gap:I()}],"gap-x":[{"gap-x":I()}],"gap-y":[{"gap-y":I()}],"justify-content":[{justify:[...ee(),"normal"]}],"justify-items":[{"justify-items":[...ye(),"normal"]}],"justify-self":[{"justify-self":["auto",...ye()]}],"align-content":[{content:["normal",...ee()]}],"align-items":[{items:[...ye(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ye(),{baseline:["","last"]}]}],"place-content":[{"place-content":ee()}],"place-items":[{"place-items":[...ye(),"baseline"]}],"place-self":[{"place-self":["auto",...ye()]}],p:[{p:I()}],px:[{px:I()}],py:[{py:I()}],ps:[{ps:I()}],pe:[{pe:I()}],pbs:[{pbs:I()}],pbe:[{pbe:I()}],pt:[{pt:I()}],pr:[{pr:I()}],pb:[{pb:I()}],pl:[{pl:I()}],m:[{m:L()}],mx:[{mx:L()}],my:[{my:L()}],ms:[{ms:L()}],me:[{me:L()}],mbs:[{mbs:L()}],mbe:[{mbe:L()}],mt:[{mt:L()}],mr:[{mr:L()}],mb:[{mb:L()}],ml:[{ml:L()}],"space-x":[{"space-x":I()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":I()}],"space-y-reverse":["space-y-reverse"],size:[{size:Z()}],"inline-size":[{inline:["auto",...re()]}],"min-inline-size":[{"min-inline":["auto",...re()]}],"max-inline-size":[{"max-inline":["none",...re()]}],"block-size":[{block:["auto",...X()]}],"min-block-size":[{"min-block":["auto",...X()]}],"max-block-size":[{"max-block":["none",...X()]}],w:[{w:[d,"screen",...Z()]}],"min-w":[{"min-w":[d,"screen","none",...Z()]}],"max-w":[{"max-w":[d,"screen","none","prose",{screen:[u]},...Z()]}],h:[{h:["screen","lh",...Z()]}],"min-h":[{"min-h":["screen","lh","none",...Z()]}],"max-h":[{"max-h":["screen","lh",...Z()]}],"font-size":[{text:["base",r,qo,xi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,PD,DD]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Bh,Ce]}],"font-family":[{font:[LD,kD,t]}],"font-features":[{"font-features":[Ce]}],"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-fractions"],tracking:[{tracking:[o,Ee,Ce]}],"line-clamp":[{"line-clamp":[Ge,"none",Ee,ox]}],leading:[{leading:[l,...I()]}],"list-image":[{"list-image":["none",Ee,Ce]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ee,Ce]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:te()}],"text-color":[{text:te()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:[Ge,"from-font","auto",Ee,xi]}],"text-decoration-color":[{decoration:te()}],"underline-offset":[{"underline-offset":[Ge,"auto",Ee,Ce]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:I()}],"tab-size":[{tab:[Cr,Ee,Ce]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ee,Ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ee,Ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:D()}],"bg-repeat":[{bg:M()}],"bg-size":[{bg:U()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Cr,Ee,Ce],radial:["",Ee,Ce],conic:[Cr,Ee,Ce]},ID,zD]}],"bg-color":[{bg:te()}],"gradient-from-pos":[{from:Q()}],"gradient-via-pos":[{via:Q()}],"gradient-to-pos":[{to:Q()}],"gradient-from":[{from:te()}],"gradient-via":[{via:te()}],"gradient-to":[{to:te()}],rounded:[{rounded:K()}],"rounded-s":[{"rounded-s":K()}],"rounded-e":[{"rounded-e":K()}],"rounded-t":[{"rounded-t":K()}],"rounded-r":[{"rounded-r":K()}],"rounded-b":[{"rounded-b":K()}],"rounded-l":[{"rounded-l":K()}],"rounded-ss":[{"rounded-ss":K()}],"rounded-se":[{"rounded-se":K()}],"rounded-ee":[{"rounded-ee":K()}],"rounded-es":[{"rounded-es":K()}],"rounded-tl":[{"rounded-tl":K()}],"rounded-tr":[{"rounded-tr":K()}],"rounded-br":[{"rounded-br":K()}],"rounded-bl":[{"rounded-bl":K()}],"border-w":[{border:fe()}],"border-w-x":[{"border-x":fe()}],"border-w-y":[{"border-y":fe()}],"border-w-s":[{"border-s":fe()}],"border-w-e":[{"border-e":fe()}],"border-w-bs":[{"border-bs":fe()}],"border-w-be":[{"border-be":fe()}],"border-w-t":[{"border-t":fe()}],"border-w-r":[{"border-r":fe()}],"border-w-b":[{"border-b":fe()}],"border-w-l":[{"border-l":fe()}],"divide-x":[{"divide-x":fe()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":fe()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ae(),"hidden","none"]}],"divide-style":[{divide:[...ae(),"hidden","none"]}],"border-color":[{border:te()}],"border-color-x":[{"border-x":te()}],"border-color-y":[{"border-y":te()}],"border-color-s":[{"border-s":te()}],"border-color-e":[{"border-e":te()}],"border-color-bs":[{"border-bs":te()}],"border-color-be":[{"border-be":te()}],"border-color-t":[{"border-t":te()}],"border-color-r":[{"border-r":te()}],"border-color-b":[{"border-b":te()}],"border-color-l":[{"border-l":te()}],"divide-color":[{divide:te()}],"outline-style":[{outline:[...ae(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Ge,Ee,Ce]}],"outline-w":[{outline:["",Ge,qo,xi]}],"outline-color":[{outline:te()}],shadow:[{shadow:["","none",y,Qc,Yc]}],"shadow-color":[{shadow:te()}],"inset-shadow":[{"inset-shadow":["none",v,Qc,Yc]}],"inset-shadow-color":[{"inset-shadow":te()}],"ring-w":[{ring:fe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:te()}],"ring-offset-w":[{"ring-offset":[Ge,xi]}],"ring-offset-color":[{"ring-offset":te()}],"inset-ring-w":[{"inset-ring":fe()}],"inset-ring-color":[{"inset-ring":te()}],"text-shadow":[{"text-shadow":["none",b,Qc,Yc]}],"text-shadow-color":[{"text-shadow":te()}],opacity:[{opacity:[Ge,Ee,Ce]}],"mix-blend":[{"mix-blend":[...xe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":xe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Ge]}],"mask-image-linear-from-pos":[{"mask-linear-from":we()}],"mask-image-linear-to-pos":[{"mask-linear-to":we()}],"mask-image-linear-from-color":[{"mask-linear-from":te()}],"mask-image-linear-to-color":[{"mask-linear-to":te()}],"mask-image-t-from-pos":[{"mask-t-from":we()}],"mask-image-t-to-pos":[{"mask-t-to":we()}],"mask-image-t-from-color":[{"mask-t-from":te()}],"mask-image-t-to-color":[{"mask-t-to":te()}],"mask-image-r-from-pos":[{"mask-r-from":we()}],"mask-image-r-to-pos":[{"mask-r-to":we()}],"mask-image-r-from-color":[{"mask-r-from":te()}],"mask-image-r-to-color":[{"mask-r-to":te()}],"mask-image-b-from-pos":[{"mask-b-from":we()}],"mask-image-b-to-pos":[{"mask-b-to":we()}],"mask-image-b-from-color":[{"mask-b-from":te()}],"mask-image-b-to-color":[{"mask-b-to":te()}],"mask-image-l-from-pos":[{"mask-l-from":we()}],"mask-image-l-to-pos":[{"mask-l-to":we()}],"mask-image-l-from-color":[{"mask-l-from":te()}],"mask-image-l-to-color":[{"mask-l-to":te()}],"mask-image-x-from-pos":[{"mask-x-from":we()}],"mask-image-x-to-pos":[{"mask-x-to":we()}],"mask-image-x-from-color":[{"mask-x-from":te()}],"mask-image-x-to-color":[{"mask-x-to":te()}],"mask-image-y-from-pos":[{"mask-y-from":we()}],"mask-image-y-to-pos":[{"mask-y-to":we()}],"mask-image-y-from-color":[{"mask-y-from":te()}],"mask-image-y-to-color":[{"mask-y-to":te()}],"mask-image-radial":[{"mask-radial":[Ee,Ce]}],"mask-image-radial-from-pos":[{"mask-radial-from":we()}],"mask-image-radial-to-pos":[{"mask-radial-to":we()}],"mask-image-radial-from-color":[{"mask-radial-from":te()}],"mask-image-radial-to-color":[{"mask-radial-to":te()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":N()}],"mask-image-conic-pos":[{"mask-conic":[Ge]}],"mask-image-conic-from-pos":[{"mask-conic-from":we()}],"mask-image-conic-to-pos":[{"mask-conic-to":we()}],"mask-image-conic-from-color":[{"mask-conic-from":te()}],"mask-image-conic-to-color":[{"mask-conic-to":te()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:D()}],"mask-repeat":[{mask:M()}],"mask-size":[{mask:U()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ee,Ce]}],filter:[{filter:["","none",Ee,Ce]}],blur:[{blur:Me()}],brightness:[{brightness:[Ge,Ee,Ce]}],contrast:[{contrast:[Ge,Ee,Ce]}],"drop-shadow":[{"drop-shadow":["","none",x,Qc,Yc]}],"drop-shadow-color":[{"drop-shadow":te()}],grayscale:[{grayscale:["",Ge,Ee,Ce]}],"hue-rotate":[{"hue-rotate":[Ge,Ee,Ce]}],invert:[{invert:["",Ge,Ee,Ce]}],saturate:[{saturate:[Ge,Ee,Ce]}],sepia:[{sepia:["",Ge,Ee,Ce]}],"backdrop-filter":[{"backdrop-filter":["","none",Ee,Ce]}],"backdrop-blur":[{"backdrop-blur":Me()}],"backdrop-brightness":[{"backdrop-brightness":[Ge,Ee,Ce]}],"backdrop-contrast":[{"backdrop-contrast":[Ge,Ee,Ce]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Ge,Ee,Ce]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Ge,Ee,Ce]}],"backdrop-invert":[{"backdrop-invert":["",Ge,Ee,Ce]}],"backdrop-opacity":[{"backdrop-opacity":[Ge,Ee,Ce]}],"backdrop-saturate":[{"backdrop-saturate":[Ge,Ee,Ce]}],"backdrop-sepia":[{"backdrop-sepia":["",Ge,Ee,Ce]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":I()}],"border-spacing-x":[{"border-spacing-x":I()}],"border-spacing-y":[{"border-spacing-y":I()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ee,Ce]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Ge,"initial",Ee,Ce]}],ease:[{ease:["linear","initial",R,Ee,Ce]}],delay:[{delay:[Ge,Ee,Ce]}],animate:[{animate:["none",T,Ee,Ce]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[_,Ee,Ce]}],"perspective-origin":[{"perspective-origin":z()}],rotate:[{rotate:Fe()}],"rotate-x":[{"rotate-x":Fe()}],"rotate-y":[{"rotate-y":Fe()}],"rotate-z":[{"rotate-z":Fe()}],scale:[{scale:He()}],"scale-x":[{"scale-x":He()}],"scale-y":[{"scale-y":He()}],"scale-z":[{"scale-z":He()}],"scale-3d":["scale-3d"],skew:[{skew:ct()}],"skew-x":[{"skew-x":ct()}],"skew-y":[{"skew-y":ct()}],transform:[{transform:[Ee,Ce,"","none","gpu","cpu"]}],"transform-origin":[{origin:z()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Je()}],"translate-x":[{"translate-x":Je()}],"translate-y":[{"translate-y":Je()}],"translate-z":[{"translate-z":Je()}],"translate-none":["translate-none"],zoom:[{zoom:[Cr,Ee,Ce]}],accent:[{accent:te()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:te()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",Ee,Ce]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":te()}],"scrollbar-track-color":[{"scrollbar-track":te()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":I()}],"scroll-mx":[{"scroll-mx":I()}],"scroll-my":[{"scroll-my":I()}],"scroll-ms":[{"scroll-ms":I()}],"scroll-me":[{"scroll-me":I()}],"scroll-mbs":[{"scroll-mbs":I()}],"scroll-mbe":[{"scroll-mbe":I()}],"scroll-mt":[{"scroll-mt":I()}],"scroll-mr":[{"scroll-mr":I()}],"scroll-mb":[{"scroll-mb":I()}],"scroll-ml":[{"scroll-ml":I()}],"scroll-p":[{"scroll-p":I()}],"scroll-px":[{"scroll-px":I()}],"scroll-py":[{"scroll-py":I()}],"scroll-ps":[{"scroll-ps":I()}],"scroll-pe":[{"scroll-pe":I()}],"scroll-pbs":[{"scroll-pbs":I()}],"scroll-pbe":[{"scroll-pbe":I()}],"scroll-pt":[{"scroll-pt":I()}],"scroll-pr":[{"scroll-pr":I()}],"scroll-pb":[{"scroll-pb":I()}],"scroll-pl":[{"scroll-pl":I()}],"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",Ee,Ce]}],fill:[{fill:["none",...te()]}],"stroke-w":[{stroke:[Ge,qo,xi,ox]}],stroke:[{stroke:["none",...te()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","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","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","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-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","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-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","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-pbs","scroll-pbe","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"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},UD=bD(VD);function We(...e){return UD(W1(e))}function HD({delayDuration:e=0,...t}){return f.jsx(GN,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function BD({...e}){return f.jsx(ZN,{"data-slot":"tooltip",...e})}function qD({...e}){return f.jsx(KN,{"data-slot":"tooltip-trigger",...e})}function GD({className:e,sideOffset:t=0,children:r,...i}){return f.jsx(YN,{children:f.jsxs(QN,{"data-slot":"tooltip-content",sideOffset:t,className:We("z-50 w-fit origin-(--radix-tooltip-content-transform-origin) animate-in rounded-md bg-foreground px-3 py-1.5 text-xs text-balance text-background fade-in-0 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 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95",e),...i,children:[r,f.jsx(XN,{className:"z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground"})]})})}const Dm=new Set;function ZD(e){return Dm.add(e),()=>Dm.delete(e)}function KD(){for(const e of Dm)e()}const m_=(...e)=>e.filter((t,r,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===r).join(" ").trim();const YD=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();const QD=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,i)=>i?i.toUpperCase():r.toLowerCase());const ux=e=>{const t=QD(e);return t.charAt(0).toUpperCase()+t.slice(1)};var qh={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"};const XD=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1},JD=S.createContext({}),WD=()=>S.useContext(JD),ek=S.forwardRef(({color:e,size:t,strokeWidth:r,absoluteStrokeWidth:i,className:o="",children:l,iconNode:u,...d},m)=>{const{size:p=24,strokeWidth:y=2,absoluteStrokeWidth:v=!1,color:b="currentColor",className:x=""}=WD()??{},w=i??v?Number(r??y)*24/Number(t??p):r??y;return S.createElement("svg",{ref:m,...qh,width:t??p??qh.width,height:t??p??qh.height,stroke:e??b,strokeWidth:w,className:m_("lucide",x,o),...!l&&!XD(d)&&{"aria-hidden":"true"},...d},[...u.map(([_,E])=>S.createElement(_,E)),...Array.isArray(l)?l:[l]])});const De=(e,t)=>{const r=S.forwardRef(({className:i,...o},l)=>S.createElement(ek,{ref:l,iconNode:t,className:m_(`lucide-${YD(ux(e))}`,`lucide-${e}`,i),...o}));return r.displayName=ux(e),r};const tk=[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]],nk=De("beaker",tk);const rk=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],ak=De("book-open",rk);const ik=[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]],sk=De("briefcase",ik);const ok=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],lk=De("bug",ok);const ck=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],uk=De("calendar",ck);const dk=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],p_=De("check",dk);const fk=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Gp=De("chevron-down",fk);const hk=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],mk=De("chevron-right",hk);const pk=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],gk=De("chevron-up",pk);const vk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],yk=De("circle-check",vk);const bk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]],g_=De("clock",bk);const xk=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],wk=De("code",xk);const Sk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}]],_k=De("compass",Sk);const Ck=[["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"}]],Ek=De("copy",Ck);const Rk=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],jk=De("credit-card",Rk);const Tk=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],Ok=De("database",Tk);const Ak=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],Mk=De("download",Ak);const Nk=[["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"}]],Dk=De("ellipsis",Nk);const kk=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],v_=De("file-text",kk);const zk=[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]],Lk=De("flag",zk);const $k=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Zp=De("folder",$k);const Ik=[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]],Pk=De("gauge",Ik);const Fk=[["path",{d:"m14 13-8.381 8.38a1 1 0 0 1-3.001-3l8.384-8.381",key:"pgg06f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m21.5 10.5-8-8",key:"a17d9x"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m8.5 7.5 8 8",key:"1oyaui"}]],Vk=De("gavel",Fk);const Uk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],y_=De("globe",Uk);const Hk=[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]],Bk=De("graduation-cap",Hk);const qk=[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]],Gk=De("heart",qk);const Zk=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],Kk=De("history",Zk);const Yk=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Qk=De("image",Yk);const Xk=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Jk=De("info",Xk);const Wk=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],ez=De("layout-dashboard",Wk);const tz=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],nz=De("lightbulb",tz);const rz=[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]],az=De("link",rz);const iz=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],sz=De("loader-circle",iz);const oz=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],b_=De("lock",oz);const lz=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],cz=De("log-out",lz);const uz=[["path",{d:"M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z",key:"q8bfy3"}],["path",{d:"M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14",key:"1853fq"}],["path",{d:"M8 6v8",key:"15ugcq"}]],dz=De("megaphone",uz);const fz=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],hz=De("menu",fz);const mz=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],pz=De("music",mz);const gz=[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],vz=De("octagon-x",gz);const yz=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],bz=De("package",yz);const xz=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],wz=De("pen-line",xz);const Sz=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],_z=De("plus",Sz);const Cz=[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]],Ez=De("rocket",Cz);const Rz=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],x_=De("search",Rz);const jz=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Tz=De("settings",jz);const Oz=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],Az=De("share-2",Oz);const Mz=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],w_=De("shield",Mz);const Nz=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],S_=De("square-terminal",Nz);const Dz=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],kz=De("star",Dz);const zz=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Lz=De("trash-2",zz);const $z=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],__=De("triangle-alert",$z);const Iz=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],Pz=De("upload",Iz);const Fz=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],C_=De("users",Fz);const Vz=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],Uz=De("wrench",Vz);const Hz=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],E_=De("x",Hz);function Bz(){const e=!document.body.classList.contains("sb-open");document.body.classList.toggle("sb-open"),Xu(),e?document.getElementById("sidebar")?.querySelector(qz)?.focus():document.getElementById("menu-btn")?.focus()}const qz='a[href], button:not(:disabled), select, input, [tabindex]:not([tabindex="-1"])';function hr(){const e=document.body.classList.contains("sb-open");document.body.classList.remove("sb-open"),Xu(),e&&window.innerWidth<=lu&&document.getElementById("menu-btn")?.focus()}const lu=900;function Xu(){const e=document.getElementById("sidebar");if(!e)return;const t=document.body.classList.contains("sb-open");window.innerWidth<=lu&&!t?e.setAttribute("inert",""):e.removeAttribute("inert");const i=document.getElementById("main");i&&(t&&window.innerWidth<=lu?i.setAttribute("inert",""):i.removeAttribute("inert")),e.setAttribute("aria-modal",String(t&&window.innerWidth<=lu)),document.getElementById("menu-btn")?.setAttribute("aria-expanded",String(t))}typeof window<"u"&&(window.addEventListener("resize",Xu),window.addEventListener("keydown",e=>{e.key==="Escape"&&document.body.classList.contains("sb-open")&&hr()}));const Gz={alert:__,card:jk,check:p_,chev:mk,chevd:Gp,clock:g_,copy:Ek,doc:v_,dots:Dk,download:Mk,folder:Zp,dashboard:ez,gear:Tz,globe:y_,hist:Kk,link:az,lock:b_,menu:hz,plus:_z,power:cz,search:x_,share:Az,shield:w_,terminal:S_,trash:Lz,upload:Pz,users:C_,x:E_};function rt({name:e}){const t=Gz[e];return t?f.jsx(t,{className:"ico","aria-hidden":"true"}):null}const km={folder:Zp,"book-open":ak,"file-text":v_,"pen-line":wz,users:C_,briefcase:sk,megaphone:dz,rocket:Ez,lightbulb:nz,flag:Lk,star:kz,heart:Gk,code:wk,"square-terminal":S_,bug:lk,wrench:Uz,database:Ok,package:bz,beaker:nk,gauge:Pk,shield:w_,lock:b_,gavel:Vk,globe:y_,compass:_k,calendar:uk,clock:g_,"graduation-cap":Bk,image:Qk,music:pz};function Ps({name:e,className:t}){const r=e??"",i=Object.hasOwn(km,r)?km[r]:Zp;return f.jsx(i,{className:t,"aria-hidden":"true"})}function Zz({size:e=22}){return f.jsxs("svg",{width:e,height:e,viewBox:"0 0 32 32",fill:"currentColor",role:"img","aria-label":"BearDrive",children:[f.jsx("rect",{x:"4",y:"4",width:"5.6",height:"24"}),f.jsx("rect",{x:"11.2",y:"4",width:"14.4",height:"11.2"}),f.jsx("rect",{x:"11.2",y:"16.8",width:"16.8",height:"11.2"})]})}function _u(e){const t=["page",e.width??"app",e.className].filter(Boolean).join(" ");return f.jsx("div",{className:t,children:e.children})}function Kz(e){e&&Xu()}function fl(e){return f.jsxs(f.Fragment,{children:[f.jsx("div",{id:"sb-backdrop",onClick:hr}),f.jsxs("aside",{id:"sidebar",ref:Kz,children:[e.vault,e.projectsNav,e.tree??f.jsx("nav",{id:"tree","aria-label":"Files"}),e.orgBar]}),f.jsxs("main",{id:"main",children:[e.topbar,f.jsx("article",{id:"content",ref:e.contentRef,onScroll:e.onContentScroll,children:e.children})]})]})}function Ju(e){const{name:t,onHome:r,showSignout:i,search:o,beta:l}=e;return f.jsxs("header",{id:"vault",children:[f.jsx("span",{id:"vault-badge",children:f.jsx(Zz,{size:22})}),f.jsx("span",{id:"vault-name",className:r?"vault-link":void 0,onClick:r,role:r?"button":void 0,tabIndex:r?0:void 0,onKeyDown:u=>{r&&(u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r())},children:t}),l&&f.jsx("span",{id:"vault-beta",children:"Beta"}),f.jsxs("div",{className:"vault-actions",children:[o&&f.jsxs(BD,{delayDuration:150,children:[f.jsx(qD,{asChild:!0,children:f.jsx("button",{id:"search-btn",className:"icon-btn2","aria-label":"Search",onClick:()=>{KD(),hr()},children:f.jsx(rt,{name:"search"})})}),f.jsxs(GD,{className:"tipcard",sideOffset:6,children:["Search ",f.jsx("kbd",{children:"⌘K"})]})]}),i&&f.jsx("a",{id:"signout",href:"/auth/logout",title:"Sign out","aria-label":"Sign out",children:f.jsx(rt,{name:"power"})})]})]})}function hl(e){return f.jsxs("header",{id:"topbar",children:[f.jsx("button",{id:"menu-btn",className:"icon-btn",title:"Menu","aria-label":"Menu","aria-controls":"sidebar","aria-expanded":"false",onClick:Bz,children:f.jsx(rt,{name:"menu"})}),f.jsx("span",{id:"crumb",children:e.crumb}),f.jsx("span",{id:"meta",children:e.meta}),e.actions]})}function Yz(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const Qz=e=>{switch(e){case"success":return Wz;case"info":return t3;case"warning":return e3;case"error":return n3;default:return null}},Xz=Array(12).fill(0),Jz=({visible:e,className:t})=>ve.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},ve.createElement("div",{className:"sonner-spinner"},Xz.map((r,i)=>ve.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),Wz=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ve.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),e3=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},ve.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),t3=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ve.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),n3=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},ve.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),r3=ve.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},ve.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),ve.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),a3=()=>{const[e,t]=ve.useState(document.hidden);return ve.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let zm=1;class i3{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{const r=this.subscribers.indexOf(t);this.subscribers.splice(r,1)}),this.publish=t=>{this.subscribers.forEach(r=>r(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var r;const{message:i,...o}=t,l=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:zm++,u=this.toasts.find(m=>m.id===l),d=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),u?this.toasts=this.toasts.map(m=>m.id===l?(this.publish({...m,...t,id:l,title:i}),{...m,...t,id:l,dismissible:d,title:i}):m):this.addToast({title:i,...o,dismissible:d,id:l}),l},this.dismiss=t=>(t?(this.dismissedToasts.add(t),requestAnimationFrame(()=>this.subscribers.forEach(r=>r({id:t,dismiss:!0})))):this.toasts.forEach(r=>{this.subscribers.forEach(i=>i({id:r.id,dismiss:!0}))}),t),this.message=(t,r)=>this.create({...r,message:t}),this.error=(t,r)=>this.create({...r,message:t,type:"error"}),this.success=(t,r)=>this.create({...r,type:"success",message:t}),this.info=(t,r)=>this.create({...r,type:"info",message:t}),this.warning=(t,r)=>this.create({...r,type:"warning",message:t}),this.loading=(t,r)=>this.create({...r,type:"loading",message:t}),this.promise=(t,r)=>{if(!r)return;let i;r.loading!==void 0&&(i=this.create({...r,promise:t,type:"loading",message:r.loading,description:typeof r.description!="function"?r.description:void 0}));const o=Promise.resolve(t instanceof Function?t():t);let l=i!==void 0,u;const d=o.then(async p=>{if(u=["resolve",p],ve.isValidElement(p))l=!1,this.create({id:i,type:"default",message:p});else if(o3(p)&&!p.ok){l=!1;const v=typeof r.error=="function"?await r.error(`HTTP error! status: ${p.status}`):r.error,b=typeof r.description=="function"?await r.description(`HTTP error! status: ${p.status}`):r.description,w=typeof v=="object"&&!ve.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:b,...w})}else if(p instanceof Error){l=!1;const v=typeof r.error=="function"?await r.error(p):r.error,b=typeof r.description=="function"?await r.description(p):r.description,w=typeof v=="object"&&!ve.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:b,...w})}else if(r.success!==void 0){l=!1;const v=typeof r.success=="function"?await r.success(p):r.success,b=typeof r.description=="function"?await r.description(p):r.description,w=typeof v=="object"&&!ve.isValidElement(v)?v:{message:v};this.create({id:i,type:"success",description:b,...w})}}).catch(async p=>{if(u=["reject",p],r.error!==void 0){l=!1;const y=typeof r.error=="function"?await r.error(p):r.error,v=typeof r.description=="function"?await r.description(p):r.description,x=typeof y=="object"&&!ve.isValidElement(y)?y:{message:y};this.create({id:i,type:"error",description:v,...x})}}).finally(()=>{l&&(this.dismiss(i),i=void 0),r.finally==null||r.finally.call(r)}),m=()=>new Promise((p,y)=>d.then(()=>u[0]==="reject"?y(u[1]):p(u[1])).catch(y));return typeof i!="string"&&typeof i!="number"?{unwrap:m}:Object.assign(i,{unwrap:m})},this.custom=(t,r)=>{const i=r?.id||zm++;return this.create({jsx:t(i),id:i,...r}),i},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const Tn=new i3,s3=(e,t)=>{const r=t?.id||zm++;return Tn.addToast({title:e,...t,id:r}),r},o3=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",l3=s3,c3=()=>Tn.toasts,u3=()=>Tn.getActiveToasts(),dx=Object.assign(l3,{success:Tn.success,info:Tn.info,warning:Tn.warning,error:Tn.error,custom:Tn.custom,message:Tn.message,promise:Tn.promise,dismiss:Tn.dismiss,loading:Tn.loading},{getHistory:c3,getToasts:u3});Yz("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Xc(e){return e.label!==void 0}const d3=3,f3="24px",h3="16px",fx=4e3,m3=356,p3=14,g3=45,v3=200;function Er(...e){return e.filter(Boolean).join(" ")}function y3(e){const[t,r]=e.split("-"),i=[];return t&&i.push(t),r&&i.push(r),i}const b3=e=>{var t,r,i,o,l,u,d,m,p;const{invert:y,toast:v,unstyled:b,interacting:x,setHeights:w,visibleToasts:_,heights:E,index:R,toasts:T,expanded:O,removeToast:N,defaultRichColors:z,closeButton:B,style:H,cancelButtonStyle:I,actionButtonStyle:ne,className:ge="",descriptionClassName:pe="",duration:he,position:de,gap:ee,expandByDefault:ye,classNames:L,icons:Z,closeButtonAriaLabel:re="Close toast"}=e,[X,te]=ve.useState(null),[D,M]=ve.useState(null),[U,Q]=ve.useState(!1),[K,fe]=ve.useState(!1),[ae,xe]=ve.useState(!1),[we,Me]=ve.useState(!1),[Fe,He]=ve.useState(!1),[ct,Je]=ve.useState(0),[hn,mn]=ve.useState(0),Xt=ve.useRef(v.duration||he||fx),yr=ve.useRef(null),At=ve.useRef(null),rr=R===0,br=R+1<=_,Rt=v.type,Vn=v.dismissible!==!1,zt=v.className||"",Dr=v.descriptionClassName||"",ar=ve.useMemo(()=>E.findIndex(Ae=>Ae.toastId===v.id)||0,[E,v.id]),oa=ve.useMemo(()=>{var Ae;return(Ae=v.closeButton)!=null?Ae:B},[v.closeButton,B]),ir=ve.useMemo(()=>v.duration||he||fx,[v.duration,he]),la=ve.useRef(0),Jt=ve.useRef(0),A=ve.useRef(0),P=ve.useRef(null),[F,ue]=de.split("-"),oe=ve.useMemo(()=>E.reduce((Ae,ut,st)=>st>=ar?Ae:Ae+ut.height,0),[E,ar]),be=a3(),Se=v.invert||y,W=Rt==="loading";Jt.current=ve.useMemo(()=>ar*ee+oe,[ar,oe]),ve.useEffect(()=>{Xt.current=ir},[ir]),ve.useEffect(()=>{Q(!0)},[]),ve.useEffect(()=>{const Ae=At.current;if(Ae){const ut=Ae.getBoundingClientRect().height;return mn(ut),w(st=>[{toastId:v.id,height:ut,position:v.position},...st]),()=>w(st=>st.filter(Gt=>Gt.toastId!==v.id))}},[w,v.id]),ve.useLayoutEffect(()=>{if(!U)return;const Ae=At.current,ut=Ae.style.height;Ae.style.height="auto";const st=Ae.getBoundingClientRect().height;Ae.style.height=ut,mn(st),w(Gt=>Gt.find(Ct=>Ct.toastId===v.id)?Gt.map(Ct=>Ct.toastId===v.id?{...Ct,height:st}:Ct):[{toastId:v.id,height:st,position:v.position},...Gt])},[U,v.title,v.description,w,v.id,v.jsx,v.action,v.cancel]);const le=ve.useCallback(()=>{fe(!0),Je(Jt.current),w(Ae=>Ae.filter(ut=>ut.toastId!==v.id)),setTimeout(()=>{N(v)},v3)},[v,N,w,Jt]);ve.useEffect(()=>{if(v.promise&&Rt==="loading"||v.duration===1/0||v.type==="loading")return;let Ae;return O||x||be?(()=>{if(A.current{v.onAutoClose==null||v.onAutoClose.call(v,v),le()},Xt.current)),()=>clearTimeout(Ae)},[O,x,v,Rt,be,le]),ve.useEffect(()=>{v.delete&&(le(),v.onDismiss==null||v.onDismiss.call(v,v))},[le,v.delete]);function Re(){var Ae;if(Z?.loading){var ut;return ve.createElement("div",{className:Er(L?.loader,v==null||(ut=v.classNames)==null?void 0:ut.loader,"sonner-loader"),"data-visible":Rt==="loading"},Z.loading)}return ve.createElement(Jz,{className:Er(L?.loader,v==null||(Ae=v.classNames)==null?void 0:Ae.loader),visible:Rt==="loading"})}const ze=v.icon||Z?.[Rt]||Qz(Rt);var it,_t;return ve.createElement("li",{tabIndex:0,ref:At,className:Er(ge,zt,L?.toast,v==null||(t=v.classNames)==null?void 0:t.toast,L?.default,L?.[Rt],v==null||(r=v.classNames)==null?void 0:r[Rt]),"data-sonner-toast":"","data-rich-colors":(it=v.richColors)!=null?it:z,"data-styled":!(v.jsx||v.unstyled||b),"data-mounted":U,"data-promise":!!v.promise,"data-swiped":Fe,"data-removed":K,"data-visible":br,"data-y-position":F,"data-x-position":ue,"data-index":R,"data-front":rr,"data-swiping":ae,"data-dismissible":Vn,"data-type":Rt,"data-invert":Se,"data-swipe-out":we,"data-swipe-direction":D,"data-expanded":!!(O||ye&&U),"data-testid":v.testId,style:{"--index":R,"--toasts-before":R,"--z-index":T.length-R,"--offset":`${K?ct:Jt.current}px`,"--initial-height":ye?"auto":`${hn}px`,...H,...v.style},onDragEnd:()=>{xe(!1),te(null),P.current=null},onPointerDown:Ae=>{Ae.button!==2&&(W||!Vn||(yr.current=new Date,Je(Jt.current),Ae.target.setPointerCapture(Ae.pointerId),Ae.target.tagName!=="BUTTON"&&(xe(!0),P.current={x:Ae.clientX,y:Ae.clientY})))},onPointerUp:()=>{var Ae,ut,st;if(we||!Vn)return;P.current=null;const Gt=Number(((Ae=At.current)==null?void 0:Ae.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),sr=Number(((ut=At.current)==null?void 0:ut.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ct=new Date().getTime()-((st=yr.current)==null?void 0:st.getTime()),yn=X==="x"?Gt:sr,ti=Math.abs(yn)/Ct;if(Math.abs(yn)>=g3||ti>.11){Je(Jt.current),v.onDismiss==null||v.onDismiss.call(v,v),M(X==="x"?Gt>0?"right":"left":sr>0?"down":"up"),le(),Me(!0);return}else{var bn,xn;(bn=At.current)==null||bn.style.setProperty("--swipe-amount-x","0px"),(xn=At.current)==null||xn.style.setProperty("--swipe-amount-y","0px")}He(!1),xe(!1),te(null)},onPointerMove:Ae=>{var ut,st,Gt;if(!P.current||!Vn||((ut=window.getSelection())==null?void 0:ut.toString().length)>0)return;const Ct=Ae.clientY-P.current.y,yn=Ae.clientX-P.current.x;var ti;const bn=(ti=e.swipeDirections)!=null?ti:y3(de);!X&&(Math.abs(yn)>1||Math.abs(Ct)>1)&&te(Math.abs(yn)>Math.abs(Ct)?"x":"y");let xn={x:0,y:0};const Fi=or=>1/(1.5+Math.abs(or)/20);if(X==="y"){if(bn.includes("top")||bn.includes("bottom"))if(bn.includes("top")&&Ct<0||bn.includes("bottom")&&Ct>0)xn.y=Ct;else{const or=Ct*Fi(Ct);xn.y=Math.abs(or)0)xn.x=yn;else{const or=yn*Fi(yn);xn.x=Math.abs(or)0||Math.abs(xn.y)>0)&&He(!0),(st=At.current)==null||st.style.setProperty("--swipe-amount-x",`${xn.x}px`),(Gt=At.current)==null||Gt.style.setProperty("--swipe-amount-y",`${xn.y}px`)}},oa&&!v.jsx&&Rt!=="loading"?ve.createElement("button",{"aria-label":re,"data-disabled":W,"data-close-button":!0,onClick:W||!Vn?()=>{}:()=>{le(),v.onDismiss==null||v.onDismiss.call(v,v)},className:Er(L?.closeButton,v==null||(i=v.classNames)==null?void 0:i.closeButton)},(_t=Z?.close)!=null?_t:r3):null,(Rt||v.icon||v.promise)&&v.icon!==null&&(Z?.[Rt]!==null||v.icon)?ve.createElement("div",{"data-icon":"",className:Er(L?.icon,v==null||(o=v.classNames)==null?void 0:o.icon)},v.promise||v.type==="loading"&&!v.icon?v.icon||Re():null,v.type!=="loading"?ze:null):null,ve.createElement("div",{"data-content":"",className:Er(L?.content,v==null||(l=v.classNames)==null?void 0:l.content)},ve.createElement("div",{"data-title":"",className:Er(L?.title,v==null||(u=v.classNames)==null?void 0:u.title)},v.jsx?v.jsx:typeof v.title=="function"?v.title():v.title),v.description?ve.createElement("div",{"data-description":"",className:Er(pe,Dr,L?.description,v==null||(d=v.classNames)==null?void 0:d.description)},typeof v.description=="function"?v.description():v.description):null),ve.isValidElement(v.cancel)?v.cancel:v.cancel&&Xc(v.cancel)?ve.createElement("button",{"data-button":!0,"data-cancel":!0,style:v.cancelButtonStyle||I,onClick:Ae=>{Xc(v.cancel)&&Vn&&(v.cancel.onClick==null||v.cancel.onClick.call(v.cancel,Ae),le())},className:Er(L?.cancelButton,v==null||(m=v.classNames)==null?void 0:m.cancelButton)},v.cancel.label):null,ve.isValidElement(v.action)?v.action:v.action&&Xc(v.action)?ve.createElement("button",{"data-button":!0,"data-action":!0,style:v.actionButtonStyle||ne,onClick:Ae=>{Xc(v.action)&&(v.action.onClick==null||v.action.onClick.call(v.action,Ae),!Ae.defaultPrevented&&le())},className:Er(L?.actionButton,v==null||(p=v.classNames)==null?void 0:p.actionButton)},v.action.label):null)};function hx(){if(typeof window>"u"||typeof document>"u")return"ltr";const e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function x3(e,t){const r={};return[e,t].forEach((i,o)=>{const l=o===1,u=l?"--mobile-offset":"--offset",d=l?h3:f3;function m(p){["top","right","bottom","left"].forEach(y=>{r[`${u}-${y}`]=typeof p=="number"?`${p}px`:p})}typeof i=="number"||typeof i=="string"?m(i):typeof i=="object"?["top","right","bottom","left"].forEach(p=>{i[p]===void 0?r[`${u}-${p}`]=d:r[`${u}-${p}`]=typeof i[p]=="number"?`${i[p]}px`:i[p]}):m(d)}),r}const w3=ve.forwardRef(function(t,r){const{id:i,invert:o,position:l="bottom-right",hotkey:u=["altKey","KeyT"],expand:d,closeButton:m,className:p,offset:y,mobileOffset:v,theme:b="light",richColors:x,duration:w,style:_,visibleToasts:E=d3,toastOptions:R,dir:T=hx(),gap:O=p3,icons:N,containerAriaLabel:z="Notifications"}=t,[B,H]=ve.useState([]),I=ve.useMemo(()=>i?B.filter(U=>U.toasterId===i):B.filter(U=>!U.toasterId),[B,i]),ne=ve.useMemo(()=>Array.from(new Set([l].concat(I.filter(U=>U.position).map(U=>U.position)))),[I,l]),[ge,pe]=ve.useState([]),[he,de]=ve.useState(!1),[ee,ye]=ve.useState(!1),[L,Z]=ve.useState(b!=="system"?b:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),re=ve.useRef(null),X=u.join("+").replace(/Key/g,"").replace(/Digit/g,""),te=ve.useRef(null),D=ve.useRef(!1),M=ve.useCallback(U=>{H(Q=>{var K;return(K=Q.find(fe=>fe.id===U.id))!=null&&K.delete||Tn.dismiss(U.id),Q.filter(({id:fe})=>fe!==U.id)})},[]);return ve.useEffect(()=>Tn.subscribe(U=>{if(U.dismiss){requestAnimationFrame(()=>{H(Q=>Q.map(K=>K.id===U.id?{...K,delete:!0}:K))});return}setTimeout(()=>{Cj.flushSync(()=>{H(Q=>{const K=Q.findIndex(fe=>fe.id===U.id);return K!==-1?[...Q.slice(0,K),{...Q[K],...U},...Q.slice(K+1)]:[U,...Q]})})})}),[B]),ve.useEffect(()=>{if(b!=="system"){Z(b);return}if(b==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Z("dark"):Z("light")),typeof window>"u")return;const U=window.matchMedia("(prefers-color-scheme: dark)");try{U.addEventListener("change",({matches:Q})=>{Z(Q?"dark":"light")})}catch{U.addListener(({matches:K})=>{try{Z(K?"dark":"light")}catch(fe){console.error(fe)}})}},[b]),ve.useEffect(()=>{B.length<=1&&de(!1)},[B]),ve.useEffect(()=>{const U=Q=>{var K;if(u.every(xe=>Q[xe]||Q.code===xe)){var ae;de(!0),(ae=re.current)==null||ae.focus()}Q.code==="Escape"&&(document.activeElement===re.current||(K=re.current)!=null&&K.contains(document.activeElement))&&de(!1)};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[u]),ve.useEffect(()=>{if(re.current)return()=>{te.current&&(te.current.focus({preventScroll:!0}),te.current=null,D.current=!1)}},[re.current]),ve.createElement("section",{ref:r,"aria-label":`${z} ${X}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},ne.map((U,Q)=>{var K;const[fe,ae]=U.split("-");return I.length?ve.createElement("ol",{key:U,dir:T==="auto"?hx():T,tabIndex:-1,ref:re,className:p,"data-sonner-toaster":!0,"data-sonner-theme":L,"data-y-position":fe,"data-x-position":ae,style:{"--front-toast-height":`${((K=ge[0])==null?void 0:K.height)||0}px`,"--width":`${m3}px`,"--gap":`${O}px`,..._,...x3(y,v)},onBlur:xe=>{D.current&&!xe.currentTarget.contains(xe.relatedTarget)&&(D.current=!1,te.current&&(te.current.focus({preventScroll:!0}),te.current=null))},onFocus:xe=>{xe.target instanceof HTMLElement&&xe.target.dataset.dismissible==="false"||D.current||(D.current=!0,te.current=xe.relatedTarget)},onMouseEnter:()=>de(!0),onMouseMove:()=>de(!0),onMouseLeave:()=>{ee||de(!1)},onDragEnd:()=>de(!1),onPointerDown:xe=>{xe.target instanceof HTMLElement&&xe.target.dataset.dismissible==="false"||ye(!0)},onPointerUp:()=>ye(!1)},I.filter(xe=>!xe.position&&Q===0||xe.position===U).map((xe,we)=>{var Me,Fe;return ve.createElement(b3,{key:xe.id,icons:N,index:we,toast:xe,defaultRichColors:x,duration:(Me=R?.duration)!=null?Me:w,className:R?.className,descriptionClassName:R?.descriptionClassName,invert:o,visibleToasts:E,closeButton:(Fe=R?.closeButton)!=null?Fe:m,interacting:ee,position:U,style:R?.style,unstyled:R?.unstyled,classNames:R?.classNames,cancelButtonStyle:R?.cancelButtonStyle,actionButtonStyle:R?.actionButtonStyle,closeButtonAriaLabel:R?.closeButtonAriaLabel,removeToast:M,toasts:I.filter(He=>He.position==xe.position),heights:ge.filter(He=>He.position==xe.position),setHeights:pe,expandByDefault:d,gap:O,expanded:he,swipeDirections:t.swipeDirections})})):null}))}),S3=({...e})=>f.jsx(w3,{theme:"dark",className:"toaster group",icons:{success:f.jsx(yk,{className:"size-4"}),info:f.jsx(Jk,{className:"size-4"}),warning:f.jsx(__,{className:"size-4"}),error:f.jsx(vz,{className:"size-4"}),loading:f.jsx(sz,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius-ctl)"},...e});function qe(e,t=!1){t?dx.error(e,{duration:1/0,closeButton:!0}):dx(e)}function _3(){return f.jsx(S3,{position:"bottom-center"})}const mx=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,px=W1,C3=(e,t)=>r=>{var i;if(t?.variants==null)return px(e,r?.class,r?.className);const{variants:o,defaultVariants:l}=t,u=Object.keys(o).map(p=>{const y=r?.[p],v=l?.[p];if(y===null)return null;const b=mx(y)||mx(v);return o[p][b]}),d=r&&Object.entries(r).reduce((p,y)=>{let[v,b]=y;return b===void 0||(p[v]=b),p},{}),m=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((p,y)=>{let{class:v,className:b,...x}=y;return Object.entries(x).every(w=>{let[_,E]=w;return Array.isArray(E)?E.includes({...l,...d}[_]):{...l,...d}[_]===E})?[...p,v,b]:p},[]);return px(e,u,m,r?.class,r?.className)},E3=C3("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[background-color,border-color,color] disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",primary:"pbtn",danger:"danger-btn",subtle:"ai-btn",toolbar:"btn",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function xt({className:e,variant:t="default",size:r="default",asChild:i=!1,...o}){const l=i?Ej:"button";return f.jsx(l,{"data-slot":"button","data-variant":t,"data-size":r,className:We(E3({variant:t,size:r,className:e})),...o})}function Wu({...e}){return f.jsx(pp,{"data-slot":"dialog",...e})}function R3({...e}){return f.jsx(vp,{"data-slot":"dialog-portal",...e})}function j3({className:e,...t}){return f.jsx(yp,{"data-slot":"dialog-overlay",className:We("fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0",e),...t})}function ed({className:e,children:t,showCloseButton:r=!0,...i}){return f.jsxs(R3,{"data-slot":"dialog-portal",children:[f.jsx(j3,{}),f.jsxs(bp,{"data-slot":"dialog-content",className:We("fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 shadow-lg duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg",e),...i,children:[t,r&&f.jsxs(iS,{"data-slot":"dialog-close",className:"absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[f.jsx(E_,{}),f.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Cl({className:e,...t}){return f.jsx(nS,{"data-slot":"dialog-title",className:We("text-lg leading-none font-semibold",e),...t})}let R_=null,cu=[];function El(e){R_=e,cu.forEach(t=>t())}function j_(e,t,r="",i="OK",o={}){return new Promise(l=>El({kind:"prompt",title:e,label:t,value:r,okLabel:i,...o,resolve:l}))}function za(e,t,r="Confirm",i=!1){return new Promise(o=>El({kind:"confirm",title:e,message:t,confirmLabel:r,danger:i,resolve:o}))}function T3(){const e=S.useSyncExternalStore(r=>(cu.push(r),()=>{cu=cu.filter(i=>i!==r)}),()=>R_);if(!e)return null;const t=()=>{El(null),e.kind==="prompt"?e.resolve(null):e.resolve(!1)};return f.jsx(Wu,{open:!0,onOpenChange:r=>!r&&t(),children:f.jsx(ed,{className:"modal",showCloseButton:!1,children:e.kind==="prompt"?f.jsx(O3,{m:e}):f.jsx(A3,{m:e})})})}function O3({m:e}){const t=S.useRef(null),r=p=>{El(null),e.resolve(p)},[i,o]=S.useState(""),[l,u]=S.useState(e.value),d=e.match===void 0||l.trim()===e.match,m=()=>{const p=l;if(d){if(!p.trim()){o("Give it a name."),t.current.focus();return}r(p)}};return f.jsxs(f.Fragment,{children:[f.jsx(Cl,{asChild:!0,children:f.jsx("h3",{children:e.title})}),f.jsx("label",{className:"modal-label",htmlFor:"modal-input",children:e.label}),f.jsx("input",{className:"modal-input",type:"text",autoComplete:"off",value:l,ref:t,id:"modal-input",autoFocus:!0,onFocus:p=>p.currentTarget.select(),"aria-invalid":!!i,"aria-describedby":i?"modal-input-err":void 0,onChange:p=>{u(p.currentTarget.value),i&&o("")},onKeyDown:p=>p.key==="Enter"&&m()}),i&&f.jsx("span",{id:"modal-input-err",role:"alert",className:"field-err",children:i}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(xt,{variant:"subtle",onClick:()=>r(null),children:"Cancel"}),f.jsx(xt,{variant:e.danger?"danger":"primary",onClick:m,disabled:!d,children:e.okLabel})]})]})}function A3({m:e}){const t=r=>{El(null),e.resolve(r)};return f.jsxs(f.Fragment,{children:[f.jsx(Cl,{asChild:!0,children:f.jsx("h3",{children:e.title})}),f.jsx("div",{className:"modal-msg",children:e.message}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(xt,{variant:"subtle",onClick:()=>t(!1),autoFocus:e.danger,children:"Cancel"}),f.jsx(xt,{variant:e.danger?"danger":"primary",onClick:()=>t(!0),autoFocus:!e.danger,children:e.confirmLabel})]})]})}function M3(e){return Ft({queryKey:["projects"],queryFn:()=>qt("/api/projects"),enabled:e,refetchInterval:3e4,select:t=>t.projects||[]})}function N3(e){return Ft({queryKey:["orgs"],queryFn:()=>qt("/api/orgs"),enabled:e,select:t=>t.orgs||[]})}function D3(e){return Ft({queryKey:["permissions",e],queryFn:()=>qt(`/api/p/${e}/permissions`),enabled:!!e})}function T_(e,t=!0){return Ft({queryKey:["shares",e],queryFn:()=>qt(`/api/p/${e}/shares`),enabled:!!e&&t,select:r=>r.shares||[]})}function O_(e){return Ft({queryKey:["admin","pending"],queryFn:()=>qt("/api/admin/pending"),enabled:e,select:t=>t.pending||[]})}function A_(){const e=Di();return()=>Promise.all([e.invalidateQueries({queryKey:["projects"]}),e.invalidateQueries({queryKey:["orgs"]})]).then(()=>{})}function M_(e){return e.split("/").map(encodeURIComponent).join("/")}function k3(e){try{return decodeURIComponent(e)}catch{return e}}function N_(e){return e.split("/").map(k3).join("/")}const z3=new Set(["dashboard","history","install","settings"]),gx={insights:"dashboard"};function L3(e){return Object.hasOwn(gx,e)?gx[e]:void 0}const Kp=["q","user","since","until"];function Yp(e){return!!e&&Kp.some(t=>!!e[t])}function D_(e){const t=new URLSearchParams;for(const i of Kp)e?.[i]&&t.set(i,e[i]);const r=t.toString();return r?"?"+r:""}function k_(e,t){const r=e.indexOf("?"),i=r===-1?null:new URLSearchParams(e.slice(r)),o=i?.get("v")||"",l=i?.get("connect")||"",u=$3(r===-1?e:e.slice(0,r),t);o&&(u.version=o),l&&(u.connect=l);const d={};for(const m of Kp){const p=i?.get(m);p&&(d[m]=p)}if(Yp(d)&&(u.filters=d),u.view==="history"&&!u.viewTarget){const m=(i?.get("path")||i?.get("prefix")||"").replace(/^\/+|\/+$/g,"");m&&(u.viewTarget=N_(m),u.queryTarget=!0)}return u}function vx(e,t){const r=t.replace(/\/+$/,"");return r!==t&&(e.trailingSlash=!0),e.path=r?N_(r):"",e}function $3(e,t){const r=e.replace(/^\/+/,"");if(t!=="hub")return vx({path:""},r);if(r==="orgs"||r.startsWith("orgs/"))return{org:r.slice(5).replace(/\/+$/,""),path:""};if(r==="billing"||r.startsWith("billing/"))return{billing:!0,path:""};const i=r.indexOf("/");if(i===-1)return{project:r,path:""};const o=vx({project:r.slice(0,i),path:""},r.slice(i+1)),l=o.path.indexOf("/"),u=l===-1?o.path:o.path.slice(0,l),d=L3(u);return(z3.has(u)||d)&&(o.view=d||u,d&&(o.legacyView=!0),o.viewTarget=l===-1?"":o.path.slice(l+1).replace(/\/+$/,""),o.path=""),o}function Gs(e,t,r){const i=M_(e),o=r?"?v="+r:"";return t?"/"+t+(i?"/"+i:"")+o:"/"+i+o}function Pn(e,t,r,i){let o=(t?"/"+t:"")+"/"+e;return r&&(o+="/"+M_(r.replace(/\/+$/,""))),o+(e==="history"?D_(i):"")}let Qp="POP";const Lm=new Set;function z_(){for(const e of Lm)e()}window.addEventListener("popstate",()=>{Qp="POP",z_()});function Yt(e,t){const r=location.pathname+location.search;!t?.replace&&r===e||(history[t?.replace?"replaceState":"pushState"](null,"",e),Qp=t?.replace?"REPLACE":"PUSH",z_())}function Xp(){return S.useSyncExternalStore(e=>(Lm.add(e),()=>{Lm.delete(e)}),()=>location.pathname+location.search)}function I3(){return Qp}function Zs(e){return e.startsWith("/")&&!e.startsWith("//")?{href:e,onClick:r=>{r.defaultPrevented||r.metaKey||r.ctrlKey||r.shiftKey||r.altKey||r.button!==0||(r.preventDefault(),Yt(e),document.body.classList.remove("sb-open"))}}:{href:e,target:"_blank",rel:"noopener noreferrer"}}function Jo({to:e}){return S.useEffect(()=>{Yt(e,{replace:!0})},[e]),null}function L_(){return{accessor:(e,t)=>typeof e=="function"?{...t,accessorFn:e}:{...t,accessorKey:e},display:e=>e,group:e=>e}}function La(e,t){return typeof e=="function"?e(t):e}function Fn(e,t){return r=>{t.setState(i=>({...i,[e]:La(r,i[e])}))}}function td(e){return e instanceof Function}function P3(e){return Array.isArray(e)&&e.every(t=>typeof t=="number")}function F3(e,t){const r=[],i=o=>{o.forEach(l=>{r.push(l);const u=t(l);u!=null&&u.length&&i(u)})};return i(e),r}function Le(e,t,r){let i=[],o;return l=>{let u;r.key&&r.debug&&(u=Date.now());const d=e(l);if(!(d.length!==i.length||d.some((y,v)=>i[v]!==y)))return o;i=d;let p;if(r.key&&r.debug&&(p=Date.now()),o=t(...d),r==null||r.onChange==null||r.onChange(o),r.key&&r.debug&&r!=null&&r.debug()){const y=Math.round((Date.now()-u)*100)/100,v=Math.round((Date.now()-p)*100)/100,b=v/16,x=(w,_)=>{for(w=String(w);w.length<_;)w=" "+w;return w};console.info(`%c⏱ ${x(v,5)} /${x(y,5)} ms`,` font-size: .6rem; font-weight: bold; - color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,r?.key)}return o}}function $e(e,t,r,i){return{debug:()=>{var o;return(o=e?.debugAll)!=null?o:e[t]},key:!1,onChange:i}}function V3(e,t,r,i){const o=()=>{var u;return(u=l.getValue())!=null?u:e.options.renderFallbackValue},l={id:`${t.id}_${r.id}`,row:t,column:r,getValue:()=>t.getValue(i),renderValue:o,getContext:Le(()=>[e,r,t,l],(u,d,m,p)=>({table:u,column:d,row:m,cell:p,getValue:p.getValue,renderValue:p.renderValue}),$e(e.options,"debugCells"))};return e._features.forEach(u=>{u.createCell==null||u.createCell(l,r,t,e)},{}),l}function U3(e,t,r,i){var o,l;const d={...e._getDefaultColumnDef(),...t},m=d.accessorKey;let p=(o=(l=d.id)!=null?l:m?typeof String.prototype.replaceAll=="function"?m.replaceAll(".","_"):m.replace(/\./g,"_"):void 0)!=null?o:typeof d.header=="string"?d.header:void 0,y;if(d.accessorFn?y=d.accessorFn:m&&(m.includes(".")?y=b=>{let x=b;for(const _ of m.split(".")){var w;x=(w=x)==null?void 0:w[_]}return x}:y=b=>b[d.accessorKey]),!p)throw new Error;let v={id:`${String(p)}`,accessorFn:y,parent:i,depth:r,columnDef:d,columns:[],getFlatColumns:Le(()=>[!0],()=>{var b;return[v,...(b=v.columns)==null?void 0:b.flatMap(x=>x.getFlatColumns())]},$e(e.options,"debugColumns")),getLeafColumns:Le(()=>[e._getOrderColumnsFn()],b=>{var x;if((x=v.columns)!=null&&x.length){let w=v.columns.flatMap(_=>_.getLeafColumns());return b(w)}return[v]},$e(e.options,"debugColumns"))};for(const b of e._features)b.createColumn==null||b.createColumn(v,e);return v}const dn="debugHeaders";function yx(e,t,r){var i;let l={id:(i=r.id)!=null?i:t.id,column:t,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const u=[],d=m=>{m.subHeaders&&m.subHeaders.length&&m.subHeaders.map(d),u.push(m)};return d(l),u},getContext:()=>({table:e,header:l,column:t})};return e._features.forEach(u=>{u.createHeader==null||u.createHeader(l,e)}),l}const H3={createTable:e=>{e.getHeaderGroups=Le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,i,o)=>{var l,u;const d=(l=i?.map(v=>r.find(b=>b.id===v)).filter(Boolean))!=null?l:[],m=(u=o?.map(v=>r.find(b=>b.id===v)).filter(Boolean))!=null?u:[],p=r.filter(v=>!(i!=null&&i.includes(v.id))&&!(o!=null&&o.includes(v.id)));return Jc(t,[...d,...p,...m],e)},$e(e.options,dn)),e.getCenterHeaderGroups=Le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,i,o)=>(r=r.filter(l=>!(i!=null&&i.includes(l.id))&&!(o!=null&&o.includes(l.id))),Jc(t,r,e,"center")),$e(e.options,dn)),e.getLeftHeaderGroups=Le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,r,i)=>{var o;const l=(o=i?.map(u=>r.find(d=>d.id===u)).filter(Boolean))!=null?o:[];return Jc(t,l,e,"left")},$e(e.options,dn)),e.getRightHeaderGroups=Le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,r,i)=>{var o;const l=(o=i?.map(u=>r.find(d=>d.id===u)).filter(Boolean))!=null?o:[];return Jc(t,l,e,"right")},$e(e.options,dn)),e.getFooterGroups=Le(()=>[e.getHeaderGroups()],t=>[...t].reverse(),$e(e.options,dn)),e.getLeftFooterGroups=Le(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),$e(e.options,dn)),e.getCenterFooterGroups=Le(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),$e(e.options,dn)),e.getRightFooterGroups=Le(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),$e(e.options,dn)),e.getFlatHeaders=Le(()=>[e.getHeaderGroups()],t=>t.map(r=>r.headers).flat(),$e(e.options,dn)),e.getLeftFlatHeaders=Le(()=>[e.getLeftHeaderGroups()],t=>t.map(r=>r.headers).flat(),$e(e.options,dn)),e.getCenterFlatHeaders=Le(()=>[e.getCenterHeaderGroups()],t=>t.map(r=>r.headers).flat(),$e(e.options,dn)),e.getRightFlatHeaders=Le(()=>[e.getRightHeaderGroups()],t=>t.map(r=>r.headers).flat(),$e(e.options,dn)),e.getCenterLeafHeaders=Le(()=>[e.getCenterFlatHeaders()],t=>t.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),$e(e.options,dn)),e.getLeftLeafHeaders=Le(()=>[e.getLeftFlatHeaders()],t=>t.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),$e(e.options,dn)),e.getRightLeafHeaders=Le(()=>[e.getRightFlatHeaders()],t=>t.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),$e(e.options,dn)),e.getLeafHeaders=Le(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,r,i)=>{var o,l,u,d,m,p;return[...(o=(l=t[0])==null?void 0:l.headers)!=null?o:[],...(u=(d=r[0])==null?void 0:d.headers)!=null?u:[],...(m=(p=i[0])==null?void 0:p.headers)!=null?m:[]].map(y=>y.getLeafHeaders()).flat()},$e(e.options,dn))}};function Jc(e,t,r,i){var o,l;let u=0;const d=function(b,x){x===void 0&&(x=1),u=Math.max(u,x),b.filter(w=>w.getIsVisible()).forEach(w=>{var _;(_=w.columns)!=null&&_.length&&d(w.columns,x+1)},0)};d(e);let m=[];const p=(b,x)=>{const w={depth:x,id:[i,`${x}`].filter(Boolean).join("_"),headers:[]},_=[];b.forEach(E=>{const R=[..._].reverse()[0],T=E.column.depth===w.depth;let O,N=!1;if(T&&E.column.parent?O=E.column.parent:(O=E.column,N=!0),R&&R?.column===O)R.subHeaders.push(E);else{const k=yx(r,O,{id:[i,x,O.id,E?.id].filter(Boolean).join("_"),isPlaceholder:N,placeholderId:N?`${_.filter(B=>B.column===O).length}`:void 0,depth:x,index:_.length});k.subHeaders.push(E),_.push(k)}w.headers.push(E),E.headerGroup=w}),m.push(w),x>0&&p(_,x-1)},y=t.map((b,x)=>yx(r,b,{depth:u,index:x}));p(y,u-1),m.reverse();const v=b=>b.filter(w=>w.column.getIsVisible()).map(w=>{let _=0,E=0,R=[0];w.subHeaders&&w.subHeaders.length?(R=[],v(w.subHeaders).forEach(O=>{let{colSpan:N,rowSpan:k}=O;_+=N,R.push(k)})):_=1;const T=Math.min(...R);return E=E+T,w.colSpan=_,w.rowSpan=E,{colSpan:_,rowSpan:E}});return v((o=(l=m[0])==null?void 0:l.headers)!=null?o:[]),m}const B3=(e,t,r,i,o,l,u)=>{let d={id:t,index:i,original:r,depth:o,parentId:u,_valuesCache:{},_uniqueValuesCache:{},getValue:m=>{if(d._valuesCache.hasOwnProperty(m))return d._valuesCache[m];const p=e.getColumn(m);if(p!=null&&p.accessorFn)return d._valuesCache[m]=p.accessorFn(d.original,i),d._valuesCache[m]},getUniqueValues:m=>{if(d._uniqueValuesCache.hasOwnProperty(m))return d._uniqueValuesCache[m];const p=e.getColumn(m);if(p!=null&&p.accessorFn)return p.columnDef.getUniqueValues?(d._uniqueValuesCache[m]=p.columnDef.getUniqueValues(d.original,i),d._uniqueValuesCache[m]):(d._uniqueValuesCache[m]=[d.getValue(m)],d._uniqueValuesCache[m])},renderValue:m=>{var p;return(p=d.getValue(m))!=null?p:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>F3(d.subRows,m=>m.subRows),getParentRow:()=>d.parentId?e.getRow(d.parentId,!0):void 0,getParentRows:()=>{let m=[],p=d;for(;;){const y=p.getParentRow();if(!y)break;m.push(y),p=y}return m.reverse()},getAllCells:Le(()=>[e.getAllLeafColumns()],m=>m.map(p=>V3(e,d,p,p.id)),$e(e.options,"debugRows")),_getAllCellsByColumnId:Le(()=>[d.getAllCells()],m=>m.reduce((p,y)=>(p[y.column.id]=y,p),{}),$e(e.options,"debugRows"))};for(let m=0;m{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()}}},$_=(e,t,r)=>{var i,o;const l=r==null||(i=r.toString())==null?void 0:i.toLowerCase();return!!(!((o=e.getValue(t))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(l))};$_.autoRemove=e=>pr(e);const I_=(e,t,r)=>{var i;return!!(!((i=e.getValue(t))==null||(i=i.toString())==null)&&i.includes(r))};I_.autoRemove=e=>pr(e);const P_=(e,t,r)=>{var i;return((i=e.getValue(t))==null||(i=i.toString())==null?void 0:i.toLowerCase())===r?.toLowerCase()};P_.autoRemove=e=>pr(e);const F_=(e,t,r)=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(r)};F_.autoRemove=e=>pr(e);const V_=(e,t,r)=>!r.some(i=>{var o;return!((o=e.getValue(t))!=null&&o.includes(i))});V_.autoRemove=e=>pr(e)||!(e!=null&&e.length);const U_=(e,t,r)=>r.some(i=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(i)});U_.autoRemove=e=>pr(e)||!(e!=null&&e.length);const H_=(e,t,r)=>e.getValue(t)===r;H_.autoRemove=e=>pr(e);const B_=(e,t,r)=>e.getValue(t)==r;B_.autoRemove=e=>pr(e);const Jp=(e,t,r)=>{let[i,o]=r;const l=e.getValue(t);return l>=i&&l<=o};Jp.resolveFilterValue=e=>{let[t,r]=e,i=typeof t!="number"?parseFloat(t):t,o=typeof r!="number"?parseFloat(r):r,l=t===null||Number.isNaN(i)?-1/0:i,u=r===null||Number.isNaN(o)?1/0:o;if(l>u){const d=l;l=u,u=d}return[l,u]};Jp.autoRemove=e=>pr(e)||pr(e[0])&&pr(e[1]);const Wr={includesString:$_,includesStringSensitive:I_,equalsString:P_,arrIncludes:F_,arrIncludesAll:V_,arrIncludesSome:U_,equals:H_,weakEquals:B_,inNumberRange:Jp};function pr(e){return e==null||e===""}const G3={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Fn("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const r=t.getCoreRowModel().flatRows[0],i=r?.getValue(e.id);return typeof i=="string"?Wr.includesString:typeof i=="number"?Wr.inNumberRange:typeof i=="boolean"||i!==null&&typeof i=="object"?Wr.equals:Array.isArray(i)?Wr.arrIncludes:Wr.weakEquals},e.getFilterFn=()=>{var r,i;return td(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(r=(i=t.options.filterFns)==null?void 0:i[e.columnDef.filterFn])!=null?r:Wr[e.columnDef.filterFn]},e.getCanFilter=()=>{var r,i,o;return((r=e.columnDef.enableColumnFilter)!=null?r:!0)&&((i=t.options.enableColumnFilters)!=null?i:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var r;return(r=t.getState().columnFilters)==null||(r=r.find(i=>i.id===e.id))==null?void 0:r.value},e.getFilterIndex=()=>{var r,i;return(r=(i=t.getState().columnFilters)==null?void 0:i.findIndex(o=>o.id===e.id))!=null?r:-1},e.setFilterValue=r=>{t.setColumnFilters(i=>{const o=e.getFilterFn(),l=i?.find(y=>y.id===e.id),u=La(r,l?l.value:void 0);if(bx(o,u,e)){var d;return(d=i?.filter(y=>y.id!==e.id))!=null?d:[]}const m={id:e.id,value:u};if(l){var p;return(p=i?.map(y=>y.id===e.id?m:y))!=null?p:[]}return i!=null&&i.length?[...i,m]:[m]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const r=e.getAllLeafColumns(),i=o=>{var l;return(l=La(t,o))==null?void 0:l.filter(u=>{const d=r.find(m=>m.id===u.id);if(d){const m=d.getFilterFn();if(bx(m,u.value,d))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(i)},e.resetColumnFilters=t=>{var r,i;e.setColumnFilters(t?[]:(r=(i=e.initialState)==null?void 0:i.columnFilters)!=null?r:[])},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 bx(e,t,r){return(e&&e.autoRemove?e.autoRemove(t,r):!1)||typeof t>"u"||typeof t=="string"&&!t}const Z3=(e,t,r)=>r.reduce((i,o)=>{const l=o.getValue(e);return i+(typeof l=="number"?l:0)},0),K3=(e,t,r)=>{let i;return r.forEach(o=>{const l=o.getValue(e);l!=null&&(i>l||i===void 0&&l>=l)&&(i=l)}),i},Y3=(e,t,r)=>{let i;return r.forEach(o=>{const l=o.getValue(e);l!=null&&(i=l)&&(i=l)}),i},Q3=(e,t,r)=>{let i,o;return r.forEach(l=>{const u=l.getValue(e);u!=null&&(i===void 0?u>=u&&(i=o=u):(i>u&&(i=u),o{let r=0,i=0;if(t.forEach(o=>{let l=o.getValue(e);l!=null&&(l=+l)>=l&&(++r,i+=l)}),r)return i/r},J3=(e,t)=>{if(!t.length)return;const r=t.map(l=>l.getValue(e));if(!P3(r))return;if(r.length===1)return r[0];const i=Math.floor(r.length/2),o=r.sort((l,u)=>l-u);return r.length%2!==0?o[i]:(o[i-1]+o[i])/2},W3=(e,t)=>Array.from(new Set(t.map(r=>r.getValue(e))).values()),e4=(e,t)=>new Set(t.map(r=>r.getValue(e))).size,t4=(e,t)=>t.length,Gh={sum:Z3,min:K3,max:Y3,extent:Q3,mean:X3,median:J3,unique:W3,uniqueCount:e4,count:t4},n4={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,r;return(t=(r=e.getValue())==null||r.toString==null?void 0:r.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Fn("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(r=>r!=null&&r.includes(e.id)?r.filter(i=>i!==e.id):[...r??[],e.id])},e.getCanGroup=()=>{var r,i;return((r=e.columnDef.enableGrouping)!=null?r:!0)&&((i=t.options.enableGrouping)!=null?i:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var r;return(r=t.getState().grouping)==null?void 0:r.includes(e.id)},e.getGroupedIndex=()=>{var r;return(r=t.getState().grouping)==null?void 0:r.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const r=e.getCanGroup();return()=>{r&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const r=t.getCoreRowModel().flatRows[0],i=r?.getValue(e.id);if(typeof i=="number")return Gh.sum;if(Object.prototype.toString.call(i)==="[object Date]")return Gh.extent},e.getAggregationFn=()=>{var r,i;if(!e)throw new Error;return td(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(r=(i=t.options.aggregationFns)==null?void 0:i[e.columnDef.aggregationFn])!=null?r:Gh[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var r,i;e.setGrouping(t?[]:(r=(i=e.initialState)==null?void 0:i.grouping)!=null?r:[])},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=r=>{if(e._groupingValuesCache.hasOwnProperty(r))return e._groupingValuesCache[r];const i=t.getColumn(r);return i!=null&&i.columnDef.getGroupingValue?(e._groupingValuesCache[r]=i.columnDef.getGroupingValue(e.original),e._groupingValuesCache[r]):e.getValue(r)},e._groupingValuesCache={}},createCell:(e,t,r,i)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===r.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=r.subRows)!=null&&o.length)}}};function r4(e,t,r){if(!(t!=null&&t.length)||!r)return e;const i=e.filter(l=>!t.includes(l.id));return r==="remove"?i:[...t.map(l=>e.find(u=>u.id===l)).filter(Boolean),...i]}const a4={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Fn("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Le(r=>[nl(t,r)],r=>r.findIndex(i=>i.id===e.id),$e(t.options,"debugColumns")),e.getIsFirstColumn=r=>{var i;return((i=nl(t,r)[0])==null?void 0:i.id)===e.id},e.getIsLastColumn=r=>{var i;const o=nl(t,r);return((i=o[o.length-1])==null?void 0:i.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var r;e.setColumnOrder(t?[]:(r=e.initialState.columnOrder)!=null?r:[])},e._getOrderColumnsFn=Le(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,r,i)=>o=>{let l=[];if(!(t!=null&&t.length))l=o;else{const u=[...t],d=[...o];for(;d.length&&u.length;){const m=u.shift(),p=d.findIndex(y=>y.id===m);p>-1&&l.push(d.splice(p,1)[0])}l=[...l,...d]}return r4(l,r,i)},$e(e.options,"debugTable"))}},Zh=()=>({left:[],right:[]}),i4={getInitialState:e=>({columnPinning:Zh(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Fn("columnPinning",e)}),createColumn:(e,t)=>{e.pin=r=>{const i=e.getLeafColumns().map(o=>o.id).filter(Boolean);t.setColumnPinning(o=>{var l,u;if(r==="right"){var d,m;return{left:((d=o?.left)!=null?d:[]).filter(v=>!(i!=null&&i.includes(v))),right:[...((m=o?.right)!=null?m:[]).filter(v=>!(i!=null&&i.includes(v))),...i]}}if(r==="left"){var p,y;return{left:[...((p=o?.left)!=null?p:[]).filter(v=>!(i!=null&&i.includes(v))),...i],right:((y=o?.right)!=null?y:[]).filter(v=>!(i!=null&&i.includes(v)))}}return{left:((l=o?.left)!=null?l:[]).filter(v=>!(i!=null&&i.includes(v))),right:((u=o?.right)!=null?u:[]).filter(v=>!(i!=null&&i.includes(v)))}})},e.getCanPin=()=>e.getLeafColumns().some(i=>{var o,l,u;return((o=i.columnDef.enablePinning)!=null?o:!0)&&((l=(u=t.options.enableColumnPinning)!=null?u:t.options.enablePinning)!=null?l:!0)}),e.getIsPinned=()=>{const r=e.getLeafColumns().map(d=>d.id),{left:i,right:o}=t.getState().columnPinning,l=r.some(d=>i?.includes(d)),u=r.some(d=>o?.includes(d));return l?"left":u?"right":!1},e.getPinnedIndex=()=>{var r,i;const o=e.getIsPinned();return o?(r=(i=t.getState().columnPinning)==null||(i=i[o])==null?void 0:i.indexOf(e.id))!=null?r:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(r,i,o)=>{const l=[...i??[],...o??[]];return r.filter(u=>!l.includes(u.column.id))},$e(t.options,"debugRows")),e.getLeftVisibleCells=Le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(r,i)=>(i??[]).map(l=>r.find(u=>u.column.id===l)).filter(Boolean).map(l=>({...l,position:"left"})),$e(t.options,"debugRows")),e.getRightVisibleCells=Le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(r,i)=>(i??[]).map(l=>r.find(u=>u.column.id===l)).filter(Boolean).map(l=>({...l,position:"right"})),$e(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var r,i;return e.setColumnPinning(t?Zh():(r=(i=e.initialState)==null?void 0:i.columnPinning)!=null?r:Zh())},e.getIsSomeColumnsPinned=t=>{var r;const i=e.getState().columnPinning;if(!t){var o,l;return!!((o=i.left)!=null&&o.length||(l=i.right)!=null&&l.length)}return!!((r=i[t])!=null&&r.length)},e.getLeftLeafColumns=Le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,r)=>(r??[]).map(i=>t.find(o=>o.id===i)).filter(Boolean),$e(e.options,"debugColumns")),e.getRightLeafColumns=Le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,r)=>(r??[]).map(i=>t.find(o=>o.id===i)).filter(Boolean),$e(e.options,"debugColumns")),e.getCenterLeafColumns=Le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,i)=>{const o=[...r??[],...i??[]];return t.filter(l=>!o.includes(l.id))},$e(e.options,"debugColumns"))}};function s4(e){return e||(typeof document<"u"?document:null)}const Wc={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Kh=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),o4={getDefaultColumnDef:()=>Wc,getInitialState:e=>({columnSizing:{},columnSizingInfo:Kh(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Fn("columnSizing",e),onColumnSizingInfoChange:Fn("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var r,i,o;const l=t.getState().columnSizing[e.id];return Math.min(Math.max((r=e.columnDef.minSize)!=null?r:Wc.minSize,(i=l??e.columnDef.size)!=null?i:Wc.size),(o=e.columnDef.maxSize)!=null?o:Wc.maxSize)},e.getStart=Le(r=>[r,nl(t,r),t.getState().columnSizing],(r,i)=>i.slice(0,e.getIndex(r)).reduce((o,l)=>o+l.getSize(),0),$e(t.options,"debugColumns")),e.getAfter=Le(r=>[r,nl(t,r),t.getState().columnSizing],(r,i)=>i.slice(e.getIndex(r)+1).reduce((o,l)=>o+l.getSize(),0),$e(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(r=>{let{[e.id]:i,...o}=r;return o})},e.getCanResize=()=>{var r,i;return((r=e.columnDef.enableResizing)!=null?r:!0)&&((i=t.options.enableColumnResizing)!=null?i:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let r=0;const i=o=>{if(o.subHeaders.length)o.subHeaders.forEach(i);else{var l;r+=(l=o.column.getSize())!=null?l:0}};return i(e),r},e.getStart=()=>{if(e.index>0){const r=e.headerGroup.headers[e.index-1];return r.getStart()+r.getSize()}return 0},e.getResizeHandler=r=>{const i=t.getColumn(e.column.id),o=i?.getCanResize();return l=>{if(!i||!o||(l.persist==null||l.persist(),Yh(l)&&l.touches&&l.touches.length>1))return;const u=e.getSize(),d=e?e.getLeafHeaders().map(R=>[R.column.id,R.column.getSize()]):[[i.id,i.getSize()]],m=Yh(l)?Math.round(l.touches[0].clientX):l.clientX,p={},y=(R,T)=>{typeof T=="number"&&(t.setColumnSizingInfo(O=>{var N,k;const B=t.options.columnResizeDirection==="rtl"?-1:1,H=(T-((N=O?.startOffset)!=null?N:0))*B,$=Math.max(H/((k=O?.startSize)!=null?k:0),-.999999);return O.columnSizingStart.forEach(he=>{let[be,pe]=he;p[be]=Math.round(Math.max(pe+pe*$,0)*100)/100}),{...O,deltaOffset:H,deltaPercentage:$}}),(t.options.columnResizeMode==="onChange"||R==="end")&&t.setColumnSizing(O=>({...O,...p})))},v=R=>y("move",R),b=R=>{y("end",R),t.setColumnSizingInfo(T=>({...T,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},x=s4(r),w={moveHandler:R=>v(R.clientX),upHandler:R=>{x?.removeEventListener("mousemove",w.moveHandler),x?.removeEventListener("mouseup",w.upHandler),b(R.clientX)}},_={moveHandler:R=>(R.cancelable&&(R.preventDefault(),R.stopPropagation()),v(R.touches[0].clientX),!1),upHandler:R=>{var T;x?.removeEventListener("touchmove",_.moveHandler),x?.removeEventListener("touchend",_.upHandler),R.cancelable&&(R.preventDefault(),R.stopPropagation()),b((T=R.touches[0])==null?void 0:T.clientX)}},E=l4()?{passive:!1}:!1;Yh(l)?(x?.addEventListener("touchmove",_.moveHandler,E),x?.addEventListener("touchend",_.upHandler,E)):(x?.addEventListener("mousemove",w.moveHandler,E),x?.addEventListener("mouseup",w.upHandler,E)),t.setColumnSizingInfo(R=>({...R,startOffset:m,startSize:u,deltaOffset:0,deltaPercentage:0,columnSizingStart:d,isResizingColumn:i.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 r;e.setColumnSizing(t?{}:(r=e.initialState.columnSizing)!=null?r:{})},e.resetHeaderSizeInfo=t=>{var r;e.setColumnSizingInfo(t?Kh():(r=e.initialState.columnSizingInfo)!=null?r:Kh())},e.getTotalSize=()=>{var t,r;return(t=(r=e.getHeaderGroups()[0])==null?void 0:r.headers.reduce((i,o)=>i+o.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,r;return(t=(r=e.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((i,o)=>i+o.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,r;return(t=(r=e.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((i,o)=>i+o.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,r;return(t=(r=e.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((i,o)=>i+o.getSize(),0))!=null?t:0}}};let eu=null;function l4(){if(typeof eu=="boolean")return eu;let e=!1;try{const t={get passive(){return e=!0,!1}},r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch{e=!1}return eu=e,eu}function Yh(e){return e.type==="touchstart"}const c4={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Fn("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=r=>{e.getCanHide()&&t.setColumnVisibility(i=>({...i,[e.id]:r??!e.getIsVisible()}))},e.getIsVisible=()=>{var r,i;const o=e.columns;return(r=o.length?o.some(l=>l.getIsVisible()):(i=t.getState().columnVisibility)==null?void 0:i[e.id])!=null?r:!0},e.getCanHide=()=>{var r,i;return((r=e.columnDef.enableHiding)!=null?r:!0)&&((i=t.options.enableHiding)!=null?i:!0)},e.getToggleVisibilityHandler=()=>r=>{e.toggleVisibility==null||e.toggleVisibility(r.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Le(()=>[e.getAllCells(),t.getState().columnVisibility],r=>r.filter(i=>i.column.getIsVisible()),$e(t.options,"debugRows")),e.getVisibleCells=Le(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,i,o)=>[...r,...i,...o],$e(t.options,"debugRows"))},createTable:e=>{const t=(r,i)=>Le(()=>[i(),i().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(l=>l.getIsVisible==null?void 0:l.getIsVisible()),$e(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=r=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(r),e.resetColumnVisibility=r=>{var i;e.setColumnVisibility(r?{}:(i=e.initialState.columnVisibility)!=null?i:{})},e.toggleAllColumnsVisible=r=>{var i;r=(i=r)!=null?i:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,l)=>({...o,[l.id]:r||!(l.getCanHide!=null&&l.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>r=>{var i;e.toggleAllColumnsVisible((i=r.target)==null?void 0:i.checked)}}};function nl(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const u4={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()}}},d4={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Fn("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var r;const i=(r=e.getCoreRowModel().flatRows[0])==null||(r=r._getAllCellsByColumnId()[t.id])==null?void 0:r.getValue();return typeof i=="string"||typeof i=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var r,i,o,l;return((r=e.columnDef.enableGlobalFilter)!=null?r:!0)&&((i=t.options.enableGlobalFilter)!=null?i:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&((l=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?l:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Wr.includesString,e.getGlobalFilterFn=()=>{var t,r;const{globalFilterFn:i}=e.options;return td(i)?i:i==="auto"?e.getGlobalAutoFilterFn():(t=(r=e.options.filterFns)==null?void 0:r[i])!=null?t:Wr[i]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},f4={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Fn("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,r=!1;e._autoResetExpanded=()=>{var i,o;if(!t){e._queue(()=>{t=!0});return}if((i=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?i:!e.options.manualExpanding){if(r)return;r=!0,e._queue(()=>{e.resetExpanded(),r=!1})}},e.setExpanded=i=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(i),e.toggleAllRowsExpanded=i=>{i??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=i=>{var o,l;e.setExpanded(i?{}:(o=(l=e.initialState)==null?void 0:l.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(i=>i.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>i=>{i.persist==null||i.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const i=e.getState().expanded;return i===!0||Object.values(i).some(Boolean)},e.getIsAllRowsExpanded=()=>{const i=e.getState().expanded;return typeof i=="boolean"?i===!0:!(!Object.keys(i).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let i=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(l=>{const u=l.split(".");i=Math.max(i,u.length)}),i},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=r=>{t.setExpanded(i=>{var o;const l=i===!0?!0:!!(i!=null&&i[e.id]);let u={};if(i===!0?Object.keys(t.getRowModel().rowsById).forEach(d=>{u[d]=!0}):u=i,r=(o=r)!=null?o:!l,!l&&r)return{...u,[e.id]:!0};if(l&&!r){const{[e.id]:d,...m}=u;return m}return i})},e.getIsExpanded=()=>{var r;const i=t.getState().expanded;return!!((r=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?r:i===!0||i?.[e.id])},e.getCanExpand=()=>{var r,i,o;return(r=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?r:((i=t.options.enableExpanding)!=null?i:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let r=!0,i=e;for(;r&&i.parentId;)i=t.getRow(i.parentId,!0),r=i.getIsExpanded();return r},e.getToggleExpandedHandler=()=>{const r=e.getCanExpand();return()=>{r&&e.toggleExpanded()}}}},$m=0,Im=10,Qh=()=>({pageIndex:$m,pageSize:Im}),h4={getInitialState:e=>({...e,pagination:{...Qh(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Fn("pagination",e)}),createTable:e=>{let t=!1,r=!1;e._autoResetPageIndex=()=>{var i,o;if(!t){e._queue(()=>{t=!0});return}if((i=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?i:!e.options.manualPagination){if(r)return;r=!0,e._queue(()=>{e.resetPageIndex(),r=!1})}},e.setPagination=i=>{const o=l=>La(i,l);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=i=>{var o;e.setPagination(i?Qh():(o=e.initialState.pagination)!=null?o:Qh())},e.setPageIndex=i=>{e.setPagination(o=>{let l=La(i,o.pageIndex);const u=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return l=Math.max(0,Math.min(l,u)),{...o,pageIndex:l}})},e.resetPageIndex=i=>{var o,l;e.setPageIndex(i?$m:(o=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageIndex)!=null?o:$m)},e.resetPageSize=i=>{var o,l;e.setPageSize(i?Im:(o=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageSize)!=null?o:Im)},e.setPageSize=i=>{e.setPagination(o=>{const l=Math.max(1,La(i,o.pageSize)),u=o.pageSize*o.pageIndex,d=Math.floor(u/l);return{...o,pageIndex:d,pageSize:l}})},e.setPageCount=i=>e.setPagination(o=>{var l;let u=La(i,(l=e.options.pageCount)!=null?l:-1);return typeof u=="number"&&(u=Math.max(-1,u)),{...o,pageCount:u}}),e.getPageOptions=Le(()=>[e.getPageCount()],i=>{let o=[];return i&&i>0&&(o=[...new Array(i)].fill(null).map((l,u)=>u)),o},$e(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:i}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:ie.setPageIndex(i=>i-1),e.nextPage=()=>e.setPageIndex(i=>i+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 i;return(i=e.options.pageCount)!=null?i:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var i;return(i=e.options.rowCount)!=null?i:e.getPrePaginationRowModel().rows.length}}},Xh=()=>({top:[],bottom:[]}),m4={getInitialState:e=>({rowPinning:Xh(),...e}),getDefaultOptions:e=>({onRowPinningChange:Fn("rowPinning",e)}),createRow:(e,t)=>{e.pin=(r,i,o)=>{const l=i?e.getLeafRows().map(m=>{let{id:p}=m;return p}):[],u=o?e.getParentRows().map(m=>{let{id:p}=m;return p}):[],d=new Set([...u,e.id,...l]);t.setRowPinning(m=>{var p,y;if(r==="bottom"){var v,b;return{top:((v=m?.top)!=null?v:[]).filter(_=>!(d!=null&&d.has(_))),bottom:[...((b=m?.bottom)!=null?b:[]).filter(_=>!(d!=null&&d.has(_))),...Array.from(d)]}}if(r==="top"){var x,w;return{top:[...((x=m?.top)!=null?x:[]).filter(_=>!(d!=null&&d.has(_))),...Array.from(d)],bottom:((w=m?.bottom)!=null?w:[]).filter(_=>!(d!=null&&d.has(_)))}}return{top:((p=m?.top)!=null?p:[]).filter(_=>!(d!=null&&d.has(_))),bottom:((y=m?.bottom)!=null?y:[]).filter(_=>!(d!=null&&d.has(_)))}})},e.getCanPin=()=>{var r;const{enableRowPinning:i,enablePinning:o}=t.options;return typeof i=="function"?i(e):(r=i??o)!=null?r:!0},e.getIsPinned=()=>{const r=[e.id],{top:i,bottom:o}=t.getState().rowPinning,l=r.some(d=>i?.includes(d)),u=r.some(d=>o?.includes(d));return l?"top":u?"bottom":!1},e.getPinnedIndex=()=>{var r,i;const o=e.getIsPinned();if(!o)return-1;const l=(r=o==="top"?t.getTopRows():t.getBottomRows())==null?void 0:r.map(u=>{let{id:d}=u;return d});return(i=l?.indexOf(e.id))!=null?i:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var r,i;return e.setRowPinning(t?Xh():(r=(i=e.initialState)==null?void 0:i.rowPinning)!=null?r:Xh())},e.getIsSomeRowsPinned=t=>{var r;const i=e.getState().rowPinning;if(!t){var o,l;return!!((o=i.top)!=null&&o.length||(l=i.bottom)!=null&&l.length)}return!!((r=i[t])!=null&&r.length)},e._getPinnedRows=(t,r,i)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(r??[]).map(u=>{const d=e.getRow(u,!0);return d.getIsAllParentsExpanded()?d:null}):(r??[]).map(u=>t.find(d=>d.id===u))).filter(Boolean).map(u=>({...u,position:i}))},e.getTopRows=Le(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,r)=>e._getPinnedRows(t,r,"top"),$e(e.options,"debugRows")),e.getBottomRows=Le(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,r)=>e._getPinnedRows(t,r,"bottom"),$e(e.options,"debugRows")),e.getCenterRows=Le(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,r,i)=>{const o=new Set([...r??[],...i??[]]);return t.filter(l=>!o.has(l.id))},$e(e.options,"debugRows"))}},p4={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Fn("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 r;return e.setRowSelection(t?{}:(r=e.initialState.rowSelection)!=null?r:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(r=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const i={...r},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(l=>{l.getCanSelect()&&(i[l.id]=!0)}):o.forEach(l=>{delete i[l.id]}),i})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(r=>{const i=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),o={...r};return e.getRowModel().rows.forEach(l=>{Pm(o,l.id,i,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Le(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,r)=>Object.keys(t).length?Jh(e,r):{rows:[],flatRows:[],rowsById:{}},$e(e.options,"debugTable")),e.getFilteredSelectedRowModel=Le(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,r)=>Object.keys(t).length?Jh(e,r):{rows:[],flatRows:[],rowsById:{}},$e(e.options,"debugTable")),e.getGroupedSelectedRowModel=Le(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,r)=>Object.keys(t).length?Jh(e,r):{rows:[],flatRows:[],rowsById:{}},$e(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:r}=e.getState();let i=!!(t.length&&Object.keys(r).length);return i&&t.some(o=>o.getCanSelect()&&!r[o.id])&&(i=!1),i},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:r}=e.getState();let i=!!t.length;return i&&t.some(o=>!r[o.id])&&(i=!1),i},e.getIsSomeRowsSelected=()=>{var t;const r=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return r>0&&r{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(r=>r.getCanSelect()).some(r=>r.getIsSelected()||r.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(r,i)=>{const o=e.getIsSelected();t.setRowSelection(l=>{var u;if(r=typeof r<"u"?r:!o,e.getCanSelect()&&o===r)return l;const d={...l};return Pm(d,e.id,r,(u=i?.selectChildren)!=null?u:!0,t),d})},e.getIsSelected=()=>{const{rowSelection:r}=t.getState();return Wp(e,r)},e.getIsSomeSelected=()=>{const{rowSelection:r}=t.getState();return Fm(e,r)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=t.getState();return Fm(e,r)==="all"},e.getCanSelect=()=>{var r;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(r=t.options.enableRowSelection)!=null?r:!0},e.getCanSelectSubRows=()=>{var r;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(r=t.options.enableSubRowSelection)!=null?r:!0},e.getCanMultiSelect=()=>{var r;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(r=t.options.enableMultiRowSelection)!=null?r:!0},e.getToggleSelectedHandler=()=>{const r=e.getCanSelect();return i=>{var o;r&&e.toggleSelected((o=i.target)==null?void 0:o.checked)}}}},Pm=(e,t,r,i,o)=>{var l;const u=o.getRow(t,!0);r?(u.getCanMultiSelect()||Object.keys(e).forEach(d=>delete e[d]),u.getCanSelect()&&(e[t]=!0)):delete e[t],i&&(l=u.subRows)!=null&&l.length&&u.getCanSelectSubRows()&&u.subRows.forEach(d=>Pm(e,d.id,r,i,o))};function Jh(e,t){const r=e.getState().rowSelection,i=[],o={},l=function(u,d){return u.map(m=>{var p;const y=Wp(m,r);if(y&&(i.push(m),o[m.id]=m),(p=m.subRows)!=null&&p.length&&(m={...m,subRows:l(m.subRows)}),y)return m}).filter(Boolean)};return{rows:l(t.rows),flatRows:i,rowsById:o}}function Wp(e,t){var r;return(r=t[e.id])!=null?r:!1}function Fm(e,t,r){var i;if(!((i=e.subRows)!=null&&i.length))return!1;let o=!0,l=!1;return e.subRows.forEach(u=>{if(!(l&&!o)&&(u.getCanSelect()&&(Wp(u,t)?l=!0:o=!1),u.subRows&&u.subRows.length)){const d=Fm(u,t);d==="all"?l=!0:(d==="some"&&(l=!0),o=!1)}}),o?"all":l?"some":!1}const Vm=/([0-9]+)/gm,g4=(e,t,r)=>q_(Ga(e.getValue(r)).toLowerCase(),Ga(t.getValue(r)).toLowerCase()),v4=(e,t,r)=>q_(Ga(e.getValue(r)),Ga(t.getValue(r))),y4=(e,t,r)=>eg(Ga(e.getValue(r)).toLowerCase(),Ga(t.getValue(r)).toLowerCase()),b4=(e,t,r)=>eg(Ga(e.getValue(r)),Ga(t.getValue(r))),x4=(e,t,r)=>{const i=e.getValue(r),o=t.getValue(r);return i>o?1:ieg(e.getValue(r),t.getValue(r));function eg(e,t){return e===t?0:e>t?1:-1}function Ga(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function q_(e,t){const r=e.split(Vm).filter(Boolean),i=t.split(Vm).filter(Boolean);for(;r.length&&i.length;){const o=r.shift(),l=i.shift(),u=parseInt(o,10),d=parseInt(l,10),m=[u,d].sort();if(isNaN(m[0])){if(o>l)return 1;if(l>o)return-1;continue}if(isNaN(m[1]))return isNaN(u)?-1:1;if(u>d)return 1;if(d>u)return-1}return r.length-i.length}const Go={alphanumeric:g4,alphanumericCaseSensitive:v4,text:y4,textCaseSensitive:b4,datetime:x4,basic:w4},S4={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Fn("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const r=t.getFilteredRowModel().flatRows.slice(10);let i=!1;for(const o of r){const l=o?.getValue(e.id);if(Object.prototype.toString.call(l)==="[object Date]")return Go.datetime;if(typeof l=="string"&&(i=!0,l.split(Vm).length>1))return Go.alphanumeric}return i?Go.text:Go.basic},e.getAutoSortDir=()=>{const r=t.getFilteredRowModel().flatRows[0];return typeof r?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var r,i;if(!e)throw new Error;return td(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(r=(i=t.options.sortingFns)==null?void 0:i[e.columnDef.sortingFn])!=null?r:Go[e.columnDef.sortingFn]},e.toggleSorting=(r,i)=>{const o=e.getNextSortingOrder(),l=typeof r<"u"&&r!==null;t.setSorting(u=>{const d=u?.find(x=>x.id===e.id),m=u?.findIndex(x=>x.id===e.id);let p=[],y,v=l?r:o==="desc";if(u!=null&&u.length&&e.getCanMultiSort()&&i?d?y="toggle":y="add":u!=null&&u.length&&m!==u.length-1?y="replace":d?y="toggle":y="replace",y==="toggle"&&(l||o||(y="remove")),y==="add"){var b;p=[...u,{id:e.id,desc:v}],p.splice(0,p.length-((b=t.options.maxMultiSortColCount)!=null?b:Number.MAX_SAFE_INTEGER))}else y==="toggle"?p=u.map(x=>x.id===e.id?{...x,desc:v}:x):y==="remove"?p=u.filter(x=>x.id!==e.id):p=[{id:e.id,desc:v}];return p})},e.getFirstSortDir=()=>{var r,i;return((r=(i=e.columnDef.sortDescFirst)!=null?i:t.options.sortDescFirst)!=null?r:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=r=>{var i,o;const l=e.getFirstSortDir(),u=e.getIsSorted();return u?u!==l&&((i=t.options.enableSortingRemoval)==null||i)&&(!(r&&(o=t.options.enableMultiRemove)!=null)||o)?!1:u==="desc"?"asc":"desc":l},e.getCanSort=()=>{var r,i;return((r=e.columnDef.enableSorting)!=null?r:!0)&&((i=t.options.enableSorting)!=null?i:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var r,i;return(r=(i=e.columnDef.enableMultiSort)!=null?i:t.options.enableMultiSort)!=null?r:!!e.accessorFn},e.getIsSorted=()=>{var r;const i=(r=t.getState().sorting)==null?void 0:r.find(o=>o.id===e.id);return i?i.desc?"desc":"asc":!1},e.getSortIndex=()=>{var r,i;return(r=(i=t.getState().sorting)==null?void 0:i.findIndex(o=>o.id===e.id))!=null?r:-1},e.clearSorting=()=>{t.setSorting(r=>r!=null&&r.length?r.filter(i=>i.id!==e.id):[])},e.getToggleSortingHandler=()=>{const r=e.getCanSort();return i=>{r&&(i.persist==null||i.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(i):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var r,i;e.setSorting(t?[]:(r=(i=e.initialState)==null?void 0:i.sorting)!=null?r:[])},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())}},_4=[H3,c4,a4,i4,q3,G3,u4,d4,S4,n4,f4,h4,m4,p4,o4];function C4(e){var t,r;const i=[..._4,...(t=e._features)!=null?t:[]];let o={_features:i};const l=o._features.reduce((b,x)=>Object.assign(b,x.getDefaultOptions==null?void 0:x.getDefaultOptions(o)),{}),u=b=>o.options.mergeOptions?o.options.mergeOptions(l,b):{...l,...b};let m={...{},...(r=e.initialState)!=null?r:{}};o._features.forEach(b=>{var x;m=(x=b.getInitialState==null?void 0:b.getInitialState(m))!=null?x:m});const p=[];let y=!1;const v={_features:i,options:{...l,...e},initialState:m,_queue:b=>{p.push(b),y||(y=!0,Promise.resolve().then(()=>{for(;p.length;)p.shift()();y=!1}).catch(x=>setTimeout(()=>{throw x})))},reset:()=>{o.setState(o.initialState)},setOptions:b=>{const x=La(b,o.options);o.options=u(x)},getState:()=>o.options.state,setState:b=>{o.options.onStateChange==null||o.options.onStateChange(b)},_getRowId:(b,x,w)=>{var _;return(_=o.options.getRowId==null?void 0:o.options.getRowId(b,x,w))!=null?_:`${w?[w.id,x].join("."):x}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(b,x)=>{let w=(x?o.getPrePaginationRowModel():o.getRowModel()).rowsById[b];if(!w&&(w=o.getCoreRowModel().rowsById[b],!w))throw new Error;return w},_getDefaultColumnDef:Le(()=>[o.options.defaultColumn],b=>{var x;return b=(x=b)!=null?x:{},{header:w=>{const _=w.header.column.columnDef;return _.accessorKey?_.accessorKey:_.accessorFn?_.id:null},cell:w=>{var _,E;return(_=(E=w.renderValue())==null||E.toString==null?void 0:E.toString())!=null?_:null},...o._features.reduce((w,_)=>Object.assign(w,_.getDefaultColumnDef==null?void 0:_.getDefaultColumnDef()),{}),...b}},$e(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:Le(()=>[o._getColumnDefs()],b=>{const x=function(w,_,E){return E===void 0&&(E=0),w.map(R=>{const T=U3(o,R,E,_),O=R;return T.columns=O.columns?x(O.columns,T,E+1):[],T})};return x(b)},$e(e,"debugColumns")),getAllFlatColumns:Le(()=>[o.getAllColumns()],b=>b.flatMap(x=>x.getFlatColumns()),$e(e,"debugColumns")),_getAllFlatColumnsById:Le(()=>[o.getAllFlatColumns()],b=>b.reduce((x,w)=>(x[w.id]=w,x),{}),$e(e,"debugColumns")),getAllLeafColumns:Le(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(b,x)=>{let w=b.flatMap(_=>_.getLeafColumns());return x(w)},$e(e,"debugColumns")),getColumn:b=>o._getAllFlatColumnsById()[b]};Object.assign(o,v);for(let b=0;bLe(()=>[e.options.data],t=>{const r={rows:[],flatRows:[],rowsById:{}},i=function(o,l,u){l===void 0&&(l=0);const d=[];for(let p=0;pe._autoResetPageIndex()))}function Z_(){return e=>Le(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,r)=>{if(!r.rows.length||!(t!=null&&t.length))return r;const i=e.getState().sorting,o=[],l=i.filter(m=>{var p;return(p=e.getColumn(m.id))==null?void 0:p.getCanSort()}),u={};l.forEach(m=>{const p=e.getColumn(m.id);p&&(u[m.id]={sortUndefined:p.columnDef.sortUndefined,invertSorting:p.columnDef.invertSorting,sortingFn:p.getSortingFn()})});const d=m=>{const p=m.map(y=>({...y}));return p.sort((y,v)=>{for(let x=0;x{var v;o.push(y),(v=y.subRows)!=null&&v.length&&(y.subRows=d(y.subRows))}),p};return{rows:d(r.rows),flatRows:o,rowsById:r.rowsById}},$e(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function Um(e,t){return e?E4(e)?S.createElement(e,t):e:null}function E4(e){return R4(e)||typeof e=="function"||j4(e)}function R4(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function j4(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function K_(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=S.useState(()=>({current:C4(t)})),[i,o]=S.useState(()=>r.current.initialState);return r.current.setOptions(l=>({...l,...e,state:{...i,...e.state},onStateChange:u=>{o(u),e.onStateChange==null||e.onStateChange(u)}})),r.current}var Rl=e=>e.type==="checkbox",$a=e=>e instanceof Date,sn=e=>e==null;const tg=e=>typeof e=="object";var Ot=e=>!sn(e)&&!Array.isArray(e)&&tg(e)&&!$a(e),T4=e=>Ot(e)&&e.target?Rl(e.target)?e.target.checked:e.target.value:e,O4=(e,t)=>t.split(".").some((r,i,o)=>!isNaN(Number(r))&&e.has(o.slice(0,i).join("."))),Y_=e=>{const t=e.constructor&&e.constructor.prototype;return Ot(t)&&t.hasOwnProperty("isPrototypeOf")},nd=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Dt(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(nd&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Ot(e)&&Y_(e)))return e;const i=r?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=Dt(e[o]));return i}const Os={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},mr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},fr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Q_="root",ng=["__proto__","constructor","prototype"],A4=/^\w*$/;var jl=e=>A4.test(e),bt=e=>e===void 0;const M4=/[.[\]'"]/;var rd=e=>e.split(M4).filter(Boolean),_e=(e,t,r)=>{if(!t||!Ot(e))return r;const i=jl(t)?[t]:rd(t);if(i.some(l=>ng.includes(l)))return r;const o=i.reduce((l,u)=>sn(l)?void 0:l[u],e);return bt(o)||o===e?bt(e[t])?r:e[t]:o},Rr=e=>typeof e=="boolean",Jn=e=>typeof e=="function",mt=(e,t,r)=>{let i=-1;const o=jl(t)?[t]:rd(t),l=o.length,u=l-1;for(;++i{const o={};for(const l in e)Object.defineProperty(o,l,{get:()=>{const u=l;return t._proxyFormState[u]!==mr.all&&(t._proxyFormState[u]=!i||mr.all),e[u]}});return o};const k4=nd?ge.useLayoutEffect:ge.useEffect;var ln=e=>typeof e=="string",z4=(e,t,r,i,o)=>ln(e)?(i&&t.watch.add(e),_e(r,e,o)):Array.isArray(e)?e.map(l=>(i&&t.watch.add(l),_e(r,l))):(i&&(t.watchAll=!0),r),Hm=e=>sn(e)||!tg(e);const xx=(e,t)=>t.length===0&&!Array.isArray(e)&&!Y_(e);function jr(e,t,r=new WeakMap){if(e===t)return!0;if(Hm(e)||Hm(t))return Object.is(e,t);if($a(e)&&$a(t))return Object.is(e.getTime(),t.getTime());const i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;if(xx(e,i)||xx(t,o))return Object.is(e,t);if(!i.length&&Array.isArray(e)!==Array.isArray(t))return!1;const l=r.get(e);if(l&&l.has(t))return!0;if(l)l.add(t);else{const u=new WeakSet;u.add(t),r.set(e,u)}for(const u of i){const d=e[u];if(!(u in t))return!1;if(u!=="ref"){const m=t[u];if($a(d)&&$a(m)||(Ot(d)||Array.isArray(d))&&(Ot(m)||Array.isArray(m))?!jr(d,m,r):!Object.is(d,m))return!1}}return!0}var tu=e=>({isOnSubmit:!e||e===mr.onSubmit,isOnBlur:e===mr.onBlur,isOnChange:e===mr.onChange,isOnAll:e===mr.all,isOnTouch:e===mr.onTouched}),Wh=(e,t,r)=>{if(r)return!1;if(t.watchAll||t.watch.has(e))return!0;for(const i of t.watch)if(e.startsWith(i)&&e.charAt(i.length)===".")return!0;return!1};const rl=(e,t,r,i)=>{for(const o of r||Object.keys(e)){const l=_e(e,o);if(l){const{_f:u,...d}=l;if(u){if(u.refs&&u.refs[0]&&t(u.refs[0],o)&&!i)return!0;if(u.ref&&t(u.ref,u.name)&&!i)return!0;if(rl(d,t))break}else if(Ot(d)&&rl(d,t))break}}};var wx=(e,t,r)=>{const i=_e(e,r),o=Array.isArray(i)?i:[];return mt(o,Q_,t[r]),mt(e,r,o),e},an=e=>Ot(e)&&!Object.keys(e).length,rg=e=>e.type==="file",Cu=e=>{if(!nd)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ag=e=>e.type==="radio",Eu=e=>e instanceof RegExp,ig=(e,t,r,i,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[i]:o||!0}}:{};const Sx={value:!1,isValid:!1},_x={value:!0,isValid:!0};var X_=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!bt(e[0].attributes.value)?bt(e[0].value)||e[0].value===""?_x:{value:e[0].value,isValid:!0}:_x:Sx}return Sx};const Cx={isValid:!1,value:null};var J_=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Cx):Cx;function Ex(e,t,r="validate"){if(ln(e)||Array.isArray(e)&&e.every(ln)||Rr(e)&&!e)return{type:r,message:ln(e)?e:"",ref:t}}var As=e=>Ot(e)&&!Eu(e)?e:{value:e,message:""},Rx=async(e,t,r,i,o,l)=>{const{ref:u,refs:d,required:m,maxLength:p,minLength:y,min:v,max:b,pattern:x,validate:w,name:_,valueAsNumber:E,mount:R}=e._f,T=_e(r,_);if(!R||t.has(_))return{};const O=d?d[0]:u,N=fe=>{if(o&&O.reportValidity){const ue=Rr(fe)?"":fe||"";d?d.forEach(ee=>ee.setCustomValidity(ue)):O.setCustomValidity(ue),O.reportValidity()}},k={},B=ag(u),H=Rl(u),$=B||H,he=(E||rg(u))&&bt(u.value)&&bt(T)||Cu(u)&&u.value===""||T===""||Array.isArray(T)&&!T.length,be=ig.bind(null,_,i,k),pe=(fe,ue,ee,ve=fr.maxLength,L=fr.minLength)=>{const Z=fe?ue:ee;k[_]={type:fe?ve:L,message:Z,ref:u,...be(fe?ve:L,Z)}};if(l?!Array.isArray(T)||!T.length:m&&(!$&&(he||sn(T))||Rr(T)&&!T||H&&!X_(d).isValid||B&&!J_(d).isValid)){const{value:fe,message:ue}=ln(m)?{value:!!m,message:m}:As(m);if(fe&&(k[_]={type:fr.required,message:ue,ref:O,...be(fr.required,ue)},!i))return N(ue),k}if(!he&&(!sn(v)||!sn(b))){let fe,ue;const ee=As(b),ve=As(v);if(!sn(T)&&!isNaN(T)){const L=u.valueAsNumber||T&&+T;sn(ee.value)||(fe=L>ee.value),sn(ve.value)||(ue=Lnew Date(new Date().toDateString()+" "+te),ne=u.type=="time",X=u.type=="week";ln(ee.value)&&T&&(fe=ne?Z(T)>Z(ee.value):X?T>ee.value:L>new Date(ee.value)),ln(ve.value)&&T&&(ue=ne?Z(T)+fe.value,ve=!sn(ue.value)&&T.length<+ue.value;if((ee||ve)&&(pe(ee,fe.message,ue.message),!i))return N(k[_].message),k}if(x&&!he&&ln(T)){const{value:fe,message:ue}=As(x);if(Eu(fe)&&!T.match(fe)&&(k[_]={type:fr.pattern,message:ue,ref:u,...be(fr.pattern,ue)},!i))return N(ue),k}if(w){if(Jn(w)){const fe=await w(T,r),ue=Ex(fe,O);if(ue&&(k[_]={...ue,...be(fr.validate,ue.message)},!i))return N(ue.message),k}else if(Ot(w)){let fe={};for(const ue in w){if(!an(fe)&&!i)break;const ee=Ex(await w[ue](T,r),O,ue);ee&&(fe={...ee,...be(ue,ee.message)},N(ee.message),i&&(k[_]=fe))}if(!an(fe)&&(k[_]={ref:O,...fe},!i))return k}}return N(!0),k},uu=e=>Array.isArray(e)?e:[e],W_=e=>Array.isArray(e)?e.filter(Boolean):[];function L4(e,t){const r=t.slice(0,-1).length;let i=0;for(;ing.includes(String(u))))return e;const i=r.length===1?e:L4(e,r),o=r.length-1,l=r[o];return i&&delete i[l],o!==0&&(Ot(i)&&an(i)||Array.isArray(i)&&$4(i))&&kt(e,r.slice(0,-1)),e}const eC=e=>{const t={};for(const r of Object.keys(e))if(tg(e[r])&&e[r]!==null&&!$a(e[r])){const i=eC(e[r]);for(const o of Object.keys(i))t[`${r}.${o}`]=i[o]}else t[r]=e[r];return t},I4=ge.createContext(null);I4.displayName="HookFormContext";var jx=()=>{let e=[];return{get observers(){return e},next:o=>{for(const l of e)l.next&&l.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(l=>l!==o)}}),unsubscribe:()=>{e=[]}}};function tC(e,t){const r={};for(const i in e)if(e.hasOwnProperty(i)){const o=e[i],l=t[i];if(o&&Ot(o)&&l){const u=tC(o,l);Ot(u)&&(r[i]=u)}else e[i]&&(r[i]=l)}return r}var nC=e=>e.type==="select-multiple",P4=e=>ag(e)||Rl(e),em=e=>Cu(e)&&e.isConnected,F4=e=>{for(const t in e)if(Jn(e[t]))return!0;return!1};function rC(e){return Array.isArray(e)||Ot(e)&&!F4(e)}function aC(e){return!!(e&&"_f"in e)}function iC(e){return Array.isArray(e)?!e.some(t=>!bt(t)):!Object.keys(e).length}function Bm(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function qm(e,t={},r){for(const i in e){const o=e[i],l=r&&r[i];rC(o)&&(!Array.isArray(o)||!aC(l))?(t[i]=Array.isArray(o)?[]:{},qm(o,t[i],l),iC(t[i])&&Bm(t,i)):bt(o)||(t[i]=!0)}return t}function wi(e,t,r,i){r||(r=qm(t,{},i));for(const o in e){const l=e[o],u=i&&i[o];rC(l)&&(!Array.isArray(l)||!aC(u))?(bt(t)||Hm(r[o])?r[o]=qm(l,Array.isArray(l)?[]:{},u):wi(l,sn(t)?{}:t[o],r[o],u),iC(r[o])&&Bm(r,o)):jr(l,t[o])?Bm(r,o):r[o]=!0}return r}var sC=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:i})=>bt(e)?e:t?e===""?NaN:e&&+e:r&&ln(e)?new Date(e):i?i(e):e;function Tx(e){const t=e.ref;return rg(t)?t.files:ag(t)?J_(e.refs).value:nC(t)?[...t.selectedOptions].map(({value:r})=>r):Rl(t)?X_(e.refs).value:sC(bt(t.value)?e.ref.value:t.value,e)}var V4=(e,t,r,i)=>{const o={};for(const l of e){const u=_e(t,l);u&&mt(o,l,u._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:i}},Zo=e=>bt(e)?e:Eu(e)?e.source:Ot(e)?Eu(e.value)?e.value.source:e.value:e;const Ox="AsyncFunction";var U4=e=>{if(!e||!e.validate)return!1;if(Jn(e.validate))return e.validate.constructor.name===Ox;if(Ot(e.validate)){for(const t in e.validate)if(e.validate[t].constructor.name===Ox)return!0}return!1},H4=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Ax(e,t,r){const i=_e(e,r);if(i||jl(r))return{error:i,name:r};const o=r.split(".");for(;o.length;){const l=o.join("."),u=_e(t,l),d=_e(e,l);if(u&&!Array.isArray(u)&&r!==l)return{name:r};if(d&&d.type)return{name:l,error:d};if(d&&d.root&&d.root.type)return{name:`${l}.root`,error:d.root};o.pop()}return{name:r}}var B4=(e,t,r,i)=>{r(e);const{name:o,...l}=e,u=Object.keys(l);return!u.length||i&&u.length>=Object.keys(t).length||u.find(d=>t[d]===(!i||mr.all))},q4=(e,t,r)=>!e||!t||e===t||uu(e).some(i=>i&&(r?i===t||i.startsWith(t+"."):i.startsWith(t)||t.startsWith(i))),G4=(e,t,r,i,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?i.isOnBlur:o.isOnBlur)?!e:(r?i.isOnChange:o.isOnChange)?e:!0,Z4=(e,t)=>!W_(_e(e,t)).length&&kt(e,t);const K4={mode:mr.onSubmit,reValidateMode:mr.onChange,shouldFocusError:!0},tm="form",oC={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function Y4(e={}){let t={...K4,...e},r={...Dt(oC),isLoading:Jn(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},i={},o=Ot(t.defaultValues)||Ot(t.values)?Dt(t.defaultValues||t.values)||{}:{},l=t.shouldUnregister?{}:Dt(o),u={action:!1,mount:!1,watch:!1,keepIsValid:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const m={},p={};let y=0,v=tu(t.mode),b=tu(t.reValidateMode);const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},w={...x};let _={...w};const E={array:jx(),state:jx()};let R=0;const T=t.criteriaMode===mr.all,O=(A,P)=>F=>{clearTimeout(p[A]),p[A]=setTimeout(P,F)},N=async A=>{if(!u.keepIsValid&&!t.disabled&&(w.isValid||_.isValid||A)){const P=++R;let F;t.resolver?(F=an((await ee()).errors),P===R&&k()):F=await Z({fields:i,onlyCheckValid:!0,eventType:Os.VALID}),P===R&&F!==r.isValid&&E.state.next({isValid:F})}},k=(A,P)=>{!t.disabled&&(w.isValidating||w.validatingFields||_.isValidating||_.validatingFields)&&((A||Array.from(d.mount)).forEach(F=>{F&&(P?mt(r.validatingFields,F,P):kt(r.validatingFields,F))}),E.state.next({validatingFields:r.validatingFields,isValidating:!an(r.validatingFields)}))},B=()=>{r.dirtyFields=wi(o,l,void 0,i)},H=(A,P=[],F,ce,se=!0,ye=!0)=>{if(ce&&F&&!t.disabled){if(u.action=!0,ye&&Array.isArray(_e(i,A))){const Se=F(_e(i,A),ce.argA,ce.argB);se&&mt(i,A,Se)}if(ye&&Array.isArray(_e(r.errors,A))){const Se=F(_e(r.errors,A),ce.argA,ce.argB);se&&mt(r.errors,A,Se),Z4(r.errors,A)}if((w.touchedFields||_.touchedFields)&&ye&&Array.isArray(_e(r.touchedFields,A))){const Se=F(_e(r.touchedFields,A),ce.argA,ce.argB);se&&mt(r.touchedFields,A,Se)}(w.dirtyFields||_.dirtyFields)&&B(),E.state.next({name:A,isDirty:X(A,P),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else mt(l,A,P)},$=(A,P)=>{mt(r.errors,A,P),r.errors={...r.errors},E.state.next({errors:r.errors})},he=A=>{r.errors=A,E.state.next({errors:r.errors,isValid:!1})},be=A=>{const P=jl(A)?[A]:rd(A);let F=l,ce=o;for(let se=0;se{const se=_e(i,A);if(se){if(be(A))return;const ye=bt(_e(l,A)),Se=_e(l,A,bt(F)?_e(o,A):F);bt(Se)||ce&&ce.defaultChecked||P?mt(l,A,P?Se:Tx(se._f)):M(A,Se),u.mount&&!u.action&&(N(),ye&&r.isDirty&&(w.isDirty||_.isDirty)&&(X()||(r.isDirty=!1,E.state.next({...r}))),e.shouldUnregister&&ye&&!bt(_e(l,A))&&Wh(A,d)&&(u.watch=!0))}},fe=(A,P,F,ce,se)=>{let ye=!1,Se=!1;const W={name:A};if(!t.disabled||ce===!0){if(!F||ce){const oe=jr(_e(o,A),P);(w.isDirty||_.isDirty)&&(Se=r.isDirty,r.isDirty=W.isDirty=!oe||X(),ye=Se!==W.isDirty),Se=!!_e(r.dirtyFields,A),oe!==r.isDirty?r.dirtyFields=wi(o,l,void 0,i):oe?kt(r.dirtyFields,A):mt(r.dirtyFields,A,!0),W.dirtyFields=r.dirtyFields,ye=ye||(w.dirtyFields||_.dirtyFields)&&Se!==!oe}if(F){const oe=_e(r.touchedFields,A);oe||(mt(r.touchedFields,A,F),W.touchedFields=r.touchedFields,ye=ye||(w.touchedFields||_.touchedFields)&&oe!==F)}ye&&se&&E.state.next(W)}return ye?W:{}},ue=(A,P,F,ce)=>{const se=_e(r.errors,A),ye=(w.isValid||_.isValid)&&Rr(P)&&r.isValid!==P;if(t.delayError&&F?(m[A]=O(A,()=>$(A,F)),m[A](t.delayError)):(clearTimeout(p[A]),delete m[A],F?mt(r.errors,A,F):kt(r.errors,A),r.errors={...r.errors}),(F?!jr(se,F):se)||!an(ce)||ye){const Se={...ce,...ye&&Rr(P)?{isValid:P}:{},errors:r.errors,name:A};r={...r,...Se},E.state.next(Se)}},ee=async A=>(k(A,!0),await t.resolver(l,t.context,V4(A||d.mount,i,t.criteriaMode,t.shouldUseNativeValidation))),ve=async A=>{const{errors:P}=await ee(A);if(k(A),A){for(const F of A){const ce=_e(P,F);ce?d.array.has(F)&&Ot(ce)&&!Object.keys(ce).some(se=>!Number.isNaN(Number(se)))?wx(r.errors,{[F]:ce},F):mt(r.errors,F,ce):kt(r.errors,F)}r.errors={...r.errors}}else r.errors=P;return P},L=async({name:A,eventType:P})=>{if(e.validate){const F=await e.validate({formValues:l,formState:r,name:A,eventType:P});if(Ot(F))for(const ce in F){const se=F[ce];se&&ct(`${tm}.${ce}`,{message:ln(se.message)?se.message:"",type:se.type||fr.validate})}else ln(F)||!F?ct(tm,{message:F||"",type:fr.validate}):He(tm);return F}return!0},Z=async({fields:A,onlyCheckValid:P,name:F,eventType:ce,context:se={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(se.runRootValidation=!0,!await L({name:F,eventType:ce})&&(se.valid=!1,P)))return se.valid;for(const ye in A){const Se=A[ye];if(Se){const{_f:W,...oe}=Se;if(W){const Re=d.array.has(W.name),ze=Se._f&&U4(Se._f),it=w.validatingFields||w.isValidating||_.validatingFields||_.isValidating;ze&&it&&k([W.name],!0);const _t=await Rx(Se,d.disabled,l,T,t.shouldUseNativeValidation&&!P,Re);if(ze&&it&&k([W.name]),_t[W.name]&&(se.valid=!1,P)||(!P&&(_e(_t,W.name)?Re?wx(r.errors,_t,W.name):mt(r.errors,W.name,_t[W.name]):kt(r.errors,W.name)),e.shouldUseNativeValidation&&_t[W.name]))break}!an(oe)&&await Z({context:se,onlyCheckValid:P,fields:oe,name:ye,eventType:ce})}}return se.valid},ne=()=>{for(const A of d.unMount){const P=_e(i,A);P&&(P._f.refs?P._f.refs.every(F=>!em(F)):!em(P._f.ref))&&Xt(A)}d.unMount=new Set},X=(A,P)=>(A&&P&&mt(l,A,P),!jr(u.mount?l:o,o)),te=(A,P,F)=>z4(A,d,{...u.mount?l:bt(P)?o:ln(A)?{[A]:P}:P},F,P),D=A=>W_(_e(u.mount?l:o,A,t.shouldUnregister?_e(o,A,[]):[])),M=(A,P,F={},ce=!1,se=!1)=>{const ye=_e(i,A);let Se=P;if(ye){const W=ye._f;W&&(!W.disabled&&mt(l,A,sC(P,W)),Se=Cu(W.ref)&&sn(P)?"":P,nC(W.ref)?[...W.ref.options].forEach(oe=>oe.selected=Se.includes(oe.value)):W.refs?Rl(W.ref)?W.refs.forEach(oe=>{(!oe.defaultChecked||!oe.disabled)&&(Array.isArray(Se)?oe.checked=!!Se.find(Re=>Re===oe.value):oe.checked=Se===oe.value||!!Se)}):W.refs.forEach(oe=>oe.checked=oe.value===Se):rg(W.ref)?W.ref.value="":(W.ref.value=Se,!W.ref.type&&!se&&E.state.next({name:A,values:ce?l:Dt(l)})))}(F.shouldDirty||F.shouldTouch)&&fe(A,Se,F.shouldTouch,F.shouldDirty,!se),F.shouldValidate&&we(A,{delayError:F.delayError})},U=(A,P,F,ce=!1,se=!1)=>{for(const ye in P){if(!P.hasOwnProperty(ye))return;const Se=P[ye],W=A+"."+ye,oe=_e(i,W);(d.array.has(A)||Ot(Se)||oe&&!oe._f)&&!$a(Se)?U(W,Se,F,ce,se):M(W,Se,F,ce,se)}},Q=(A,P,F,ce,se=!1)=>{const ye=_e(i,A),Se=d.array.has(A),W=ce?P:Dt(P),oe=_e(l,A),Re=jr(oe,W);if(Re||mt(l,A,W),Se)E.array.next({name:A,values:ce?l:Dt(l)}),(w.isDirty||w.dirtyFields||_.isDirty||_.dirtyFields)&&F.shouldDirty&&(B(),se||E.state.next({name:A,dirtyFields:r.dirtyFields,isDirty:X(A,W)}));else{const ze=Array.isArray(W)&&!W.length||an(W);!ye||ye._f||sn(W)||ze?M(A,W,F,ce,se):U(A,W,F,ce,se)}if(!Re&&!se){const ze=Wh(A,d),it=ce?l:Dt(l);E.state.next({...ze&&r,name:u.mount||ze?A:void 0,values:it})}},K=(A,P,F={})=>Q(A,P,F,!1),de=(A,P={})=>{const F=Jn(A)?A(l):A;if(!jr(l,F)){l={...l,...F};const ce=eC(F);for(const se of d.mount)se in ce&&Q(se,ce[se],P,!0,!0);E.state.next({...r,name:void 0,type:void 0,...y?{values:l}:{}}),P.shouldValidate&&N()}},re=async A=>{u.mount=!0;const P=A.target;let F=P.name,ce=!0;const se=_e(i,F),ye=Se=>{ce=Number.isNaN(Se)||$a(Se)&&isNaN(Se.getTime())||jr(Se,_e(l,F,Se))};if(se){let Se,W;const oe=P.type?Tx(se._f):T4(A),Re=A.type===Os.BLUR||A.type===Os.FOCUS_OUT,ze=!H4(se._f)&&!e.validate&&!t.resolver&&!_e(r.errors,F)&&!se._f.deps,it=ze||G4(Re,_e(r.touchedFields,F),r.isSubmitted,b,v),_t=Wh(F,d,Re);if(mt(l,F,oe),Re){if(!P||!P.readOnly){se._f.onBlur&&se._f.onBlur(A);const st=m[F];st&&st(0)}}else se._f.onChange&&se._f.onChange(A);const Ae=fe(F,oe,Re),ut=!an(Ae)||_t;if(!Re&&E.state.next({name:F,type:A.type,...y?{values:Dt(l)}:{}}),it)return(!ze||!r.isValid)&&(w.isValid||_.isValid)&&(t.mode==="onBlur"?Re&&N():Re||N()),ut&&E.state.next({name:F,..._t?{}:Ae});if(!t.resolver&&e.validate&&await L({name:F,eventType:A.type}),!Re&&_t&&E.state.next({...r}),t.resolver){const{errors:st}=await ee([F]);if(k([F]),ye(oe),!ce){!an(Ae)&&E.state.next(Ae);return}const Gt=Ax(r.errors,i,F),sr=Ax(st,i,Gt.name||F);Se=sr.error,F=sr.name,W=an(st)}else k([F],!0),Se=(await Rx(se,d.disabled,l,T,t.shouldUseNativeValidation))[F],k([F]),ye(oe),ce&&(Se?W=!1:(w.isValid||_.isValid)&&(W=await Z({fields:i,onlyCheckValid:!0,name:F,eventType:A.type})));ce&&(se._f.deps&&(!Array.isArray(se._f.deps)||se._f.deps.length>0)&&we(se._f.deps),ue(F,W,Se,Ae))}},xe=(A,P)=>{if(_e(r.errors,P)&&A.focus)return A.focus(),1},we=async(A,P={})=>{let F,ce;const se=uu(A);if(t.resolver){const ye=await ve(bt(A)?A:se);F=an(ye),ce=A?!se.some(Se=>_e(ye,Se)):F}else A?(ce=(await Promise.all(se.map(async ye=>{const Se=_e(i,ye);return await Z({fields:Se&&Se._f?{[ye]:Se}:Se,eventType:Os.TRIGGER})}))).every(Boolean),!(!ce&&!r.isValid)&&N()):ce=F=await Z({fields:i,name:A,eventType:Os.TRIGGER});if(P.delayError&&t.delayError&&ln(A)){const ye=_e(r.errors,A);ye?(kt(r.errors,A),m[A]=O(A,()=>$(A,ye)),m[A](t.delayError)):(clearTimeout(p[A]),delete m[A])}return E.state.next({...!ln(A)||(w.isValid||_.isValid)&&F!==r.isValid?{}:{name:A},...t.resolver||!A?{isValid:F}:{},errors:r.errors}),P.shouldFocus&&!ce&&rl(i,xe,A?se:d.mount),ce},Me=(A,P)=>{let F={...u.mount?l:o};return P&&(F=tC(P.dirtyFields?r.dirtyFields:r.touchedFields,F)),bt(A)?F:ln(A)?_e(F,A):A.map(ce=>_e(F,ce))},Fe=(A,P)=>({invalid:!!_e((P||r).errors,A),isDirty:!!_e((P||r).dirtyFields,A),error:_e((P||r).errors,A),isValidating:!!_e(r.validatingFields,A),isTouched:!!_e((P||r).touchedFields,A)}),He=A=>{const P=A?uu(A):void 0;P?.forEach(F=>kt(r.errors,F)),P?P.forEach(F=>{E.state.next({name:F,errors:r.errors})}):E.state.next({errors:{}})},ct=(A,P,F)=>{const ce=(_e(i,A,{_f:{}})._f||{}).ref,se=_e(r.errors,A)||{},{ref:ye,message:Se,type:W,...oe}=se;mt(r.errors,A,{...oe,...P,ref:ce}),E.state.next({name:A,errors:r.errors,isValid:!1}),F&&F.shouldFocus&&ce&&ce.focus&&ce.focus()},Je=(A,P)=>{if(Jn(A)){y++;const{unsubscribe:F}=E.state.subscribe({next:se=>"values"in se&&A(se.values||te(void 0,P),se)});let ce=!1;return{unsubscribe:()=>{ce||(ce=!0,y--,F())}}}return te(A,P,!0)},hn=A=>{var P;const F=!!(!((P=A.formState)===null||P===void 0)&&P.values);F&&y++;const{unsubscribe:ce}=E.state.subscribe({next:ye=>{if(q4(A.name,ye.name,A.exact)&&B4(ye,A.formState||w,oa,A.reRenderRoot)){const Se={...l};A.callback({values:Se,...r,...ye,defaultValues:o})}}});if(!F)return ce;let se=!1;return()=>{se||(se=!0,y--,ce())}},mn=A=>(u.mount=!0,_={..._,...A.formState},hn({...A,formState:{...x,...A.formState}})),Xt=(A,P={})=>{for(const F of A?uu(A):d.mount)d.mount.delete(F),d.array.delete(F),P.keepValue||(kt(i,F),kt(l,F)),!P.keepError&&kt(r.errors,F),!P.keepDirty&&kt(r.dirtyFields,F),!P.keepTouched&&kt(r.touchedFields,F),!P.keepIsValidating&&kt(r.validatingFields,F),!t.shouldUnregister&&!P.keepDefaultValue&&kt(o,F);E.state.next({values:Dt(l)}),E.state.next({...r,...P.keepDirty?{isDirty:X()}:{}}),!P.keepIsValid&&N()},yr=({disabled:A,name:P})=>{if(Rr(A)&&u.mount||A||d.disabled.has(P)){const se=d.disabled.has(P)!==!!A;A?d.disabled.add(P):d.disabled.delete(P),se&&u.mount&&!u.action&&N()}},At=(A,P={})=>{let F=_e(i,A);const ce=Rr(P.disabled)||Rr(t.disabled),se=!d.registerName.has(A)&&F&&F._f&&!F._f.mount;return mt(i,A,{...F||{},_f:{...F&&F._f?F._f:{ref:{name:A}},name:A,mount:!0,...P}}),d.mount.add(A),F&&!se?yr({disabled:Rr(P.disabled)?P.disabled:t.disabled,name:A}):pe(A,!0,P.value),{...ce?{disabled:P.disabled||t.disabled}:{},...t.progressive?{required:!!P.required,min:Zo(P.min),max:Zo(P.max),minLength:Zo(P.minLength),maxLength:Zo(P.maxLength),pattern:Zo(P.pattern)}:{},name:A,onChange:re,onBlur:re,ref:ye=>{if(ye){d.registerName.add(A),At(A,P),d.registerName.delete(A),F=_e(i,A);const Se=bt(ye.value)&&ye.querySelectorAll&&ye.querySelectorAll("input,select,textarea")[0]||ye,W=P4(Se),oe=F._f.refs||[];if(W?oe.find(Re=>Re===Se):Se===F._f.ref)return;mt(i,A,{_f:{...F._f,...W?{refs:[...oe.filter(em),Se,...Array.isArray(_e(o,A))?[{}]:[]],ref:{type:Se.type,name:A}}:{ref:Se}}}),pe(A,!1,void 0,Se)}else F=_e(i,A,{}),F._f&&(F._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(O4(d.array,A)&&u.action)&&d.unMount.add(A)}}},rr=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&rl(i,xe,d.mount),br=A=>{Rr(A)&&(E.state.next({disabled:A}),rl(i,(P,F)=>{const ce=_e(i,F);ce&&(P.disabled=ce._f.disabled||A,Array.isArray(ce._f.refs)&&ce._f.refs.forEach(se=>{se.disabled=ce._f.disabled||A}))},0,!1))},Rt=(A,P)=>async F=>{let ce;F&&(F.preventDefault&&F.preventDefault(),F.persist&&F.persist());let se=Dt(l);if(E.state.next({isSubmitting:!0}),t.resolver){const{errors:ye,values:Se}=await ee();k(),r.errors=ye,se=Dt(Se)}else await Z({fields:i,eventType:Os.SUBMIT});if(d.disabled.size)for(const ye of d.disabled)kt(se,ye);if(kt(r.errors,Q_),an(r.errors)){E.state.next({errors:{}});try{await A(se,F)}catch(ye){ce=ye}}else P&&await P({...r.errors},F),rr(),setTimeout(rr);if(E.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:an(r.errors)&&!ce,submitCount:r.submitCount+1,errors:r.errors}),ce)throw ce},Vn=(A,P={})=>{_e(i,A)&&(bt(P.defaultValue)?K(A,Dt(_e(o,A))):(K(A,P.defaultValue),mt(o,A,Dt(P.defaultValue))),P.keepTouched||kt(r.touchedFields,A),P.keepDirty||(kt(r.dirtyFields,A),r.isDirty=P.defaultValue?X(A,Dt(_e(o,A))):X()),P.keepError||(kt(r.errors,A),w.isValid&&N()),E.state.next({...r}))},zt=(A,P={})=>{const F=A?Dt(A):o,ce=Dt(F),se=an(A),ye=ce,Se=i;if(P.keepDefaultValues||(o=F),!P.keepValues){if(P.keepDirtyValues){const W=new Set([...d.mount,...Object.keys(wi(o,l,void 0,Se))]);for(const oe of Array.from(W)){const Re=_e(r.dirtyFields,oe),ze=_e(l,oe),it=_e(ye,oe);Re&&!bt(ze)?mt(ye,oe,ze):!Re&&!bt(it)&&K(oe,it)}}else{if(nd&&bt(A))for(const W of d.mount){const oe=_e(i,W);if(oe&&oe._f){const Re=Array.isArray(oe._f.refs)?oe._f.refs[0]:oe._f.ref;if(Cu(Re)){const ze=Re.closest("form");if(ze){ze.reset();break}}}}if(P.keepFieldsRef)for(const W of d.mount)K(W,_e(ye,W));else i={}}if(t.shouldUnregister){if(l=P.keepDefaultValues?Dt(o):{},P.keepFieldsRef)for(const W of d.mount)mt(l,W,_e(ye,W))}else l=Dt(ye);E.array.next({values:{...ye}}),E.state.next({name:void 0,type:void 0,values:{...ye}})}d={mount:P.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},u.mount=!w.isValid||!!P.keepIsValid||!!P.keepDirtyValues||!t.shouldUnregister&&!an(ye),u.watch=!!t.shouldUnregister,u.keepIsValid=!!P.keepIsValid,u.action=!1,P.keepErrors||(r.errors={}),E.state.next({submitCount:P.keepSubmitCount?r.submitCount:0,isDirty:se?!1:P.keepDirty?r.isDirty:P.keepValues?X():!!(P.keepDefaultValues&&!jr(A,o)),isSubmitted:P.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:se?{}:P.keepDirtyValues?P.keepDefaultValues&&l?wi(o,l,void 0,Se):r.dirtyFields:P.keepDefaultValues&&A?wi(o,A,void 0,Se):P.keepDirty?r.dirtyFields:{},touchedFields:P.keepTouched?r.touchedFields:{},errors:P.keepErrors?r.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Dr=(A,P)=>zt(Jn(A)?A(l):A,{...t.resetOptions,...P}),ar=(A,P={})=>{const F=_e(i,A),ce=F&&F._f;if(ce){const se=ce.refs?ce.refs[0]:ce.ref;se.focus&&setTimeout(()=>{se.focus(),P.shouldSelect&&Jn(se.select)&&se.select()})}},oa=A=>{const{name:P,type:F,values:ce,...se}=A;r={...r,...se}},Jt={control:{register:At,unregister:Xt,getFieldState:Fe,handleSubmit:Rt,setError:ct,_subscribe:hn,_runSchema:ee,_updateIsValidating:k,_focusError:rr,_getWatch:te,_getDirty:X,_setValid:N,_setFieldArray:H,_setDisabledField:yr,_setErrors:he,_getFieldArray:D,_reset:zt,_resetDefaultValues:()=>Jn(t.defaultValues)&&t.defaultValues().then(A=>{Dr(A,t.resetOptions),E.state.next({isLoading:!1})}),_removeUnmounted:ne,_disableForm:br,_subjects:E,_proxyFormState:w,get _fields(){return i},get _formValues(){return l},get _state(){return u},set _state(A){u=A},get _defaultValues(){return o},get _names(){return d},set _names(A){d=A},get _formState(){return r},get _options(){return t},set _options(A){t={...t,...A},v=tu(t.mode),b=tu(t.reValidateMode)}},subscribe:mn,trigger:we,register:At,handleSubmit:Rt,watch:Je,setValue:K,setValues:de,getValues:Me,reset:Dr,resetField:Vn,resetDefaultValues:(A,P={})=>{if(o=Dt(A),!P.keepDirty){const F=wi(o,l,void 0,i);r.dirtyFields=F,r.isDirty=!an(F)}P.keepIsValid||N(),E.state.next({...r,defaultValues:o})},clearErrors:He,unregister:Xt,setError:ct,setFocus:ar,getFieldState:Fe};return{...Jt,formControl:Jt}}function sg(e={}){const t=ge.useRef(void 0),r=ge.useRef(void 0),i=ge.useRef(e.formControl),[o,l]=ge.useState(()=>({...Dt(oC),isLoading:Jn(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Jn(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&i.current!==e.formControl)if(i.current=e.formControl,e.formControl)t.current={...e.formControl,formState:o},e.defaultValues&&!Jn(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:d,...m}=Y4(e);t.current={...m,formState:o}}const u=t.current.control;return u._options=e,k4(()=>{const d=u._subscribe({formState:u._proxyFormState,callback:()=>l({...u._formState,defaultValues:u._defaultValues}),reRenderRoot:!0});return l(m=>({...m,isReady:!0})),u._formState.isReady=!0,d},[u]),ge.useEffect(()=>u._disableForm(e.disabled),[u,e.disabled]),ge.useEffect(()=>{e.mode&&(u._options.mode=e.mode),e.reValidateMode&&(u._options.reValidateMode=e.reValidateMode)},[u,e.mode,e.reValidateMode]),ge.useEffect(()=>{e.errors&&(u._setErrors(e.errors),u._focusError())},[u,e.errors]),ge.useEffect(()=>{e.shouldUnregister&&u._subjects.state.next({values:u._getWatch()})},[u,e.shouldUnregister]),ge.useEffect(()=>{if(u._proxyFormState.isDirty){const d=u._getDirty();d!==o.isDirty&&u._subjects.state.next({isDirty:d})}},[u,o.isDirty]),ge.useEffect(()=>{var d;e.values&&!jr(e.values,r.current)?(u._reset(e.values,{keepFieldsRef:!0,...u._options.resetOptions}),!((d=u._options.resetOptions)===null||d===void 0)&&d.keepIsValid||u._setValid(),r.current=e.values,l(m=>({...m}))):u._resetDefaultValues()},[u,e.values]),ge.useEffect(()=>{u._state.mount||(u._setValid(),u._state.mount=!0),u._state.watch&&(u._state.watch=!1,u._subjects.state.next({...u._formState})),u._removeUnmounted()}),t.current.formState=ge.useMemo(()=>D4(o,u),[u,o]),t.current}const Mx=(e,t,r)=>{if(e&&"reportValidity"in e){const i=_e(r,t);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},Gm=(e,t)=>{for(const r in t.fields){const i=t.fields[r];i&&i.ref&&"reportValidity"in i.ref?Mx(i.ref,r,e):i&&i.refs&&i.refs.forEach(o=>Mx(o,r,e))}},Nx=(e,t)=>{t.shouldUseNativeValidation&&Gm(e,t);const r={};for(const i in e){const o=_e(t.fields,i),l=Object.assign(e[i]||{},{ref:o&&o.ref});if(Q4(t.names||Object.keys(e),i)){const u=Object.assign({},_e(r,i));mt(u,"root",l),mt(r,i,u)}else mt(r,i,l)}return r},Q4=(e,t)=>{const r=Dx(t).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(i=>Dx(i).match(`^${r}\\.\\d+`))};function Dx(e){return e.replace(/[\[\]]/g,"")}var kx;function me(e,t,r){function i(d,m){if(d._zod||Object.defineProperty(d,"_zod",{value:{def:m,constr:u,traits:new Set},enumerable:!1}),d._zod.traits.has(e))return;d._zod.traits.add(e),t(d,m);const p=u.prototype,y=Object.keys(p);for(let v=0;vr?.Parent&&d instanceof r.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class Fs extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class lC extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(kx=globalThis).__zod_globalConfig??(kx.__zod_globalConfig={});const og=globalThis.__zod_globalConfig;function Oi(e){return og}function cC(e){const t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,o])=>t.indexOf(+i)===-1).map(([i,o])=>o)}function Zm(e,t){return typeof t=="bigint"?t.toString():t}function lg(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function cg(e){return e==null}function ug(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const zx=Symbol("evaluating");function pt(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==zx)return i===void 0&&(i=zx,i=r()),i},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Pi(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Wa(...e){const t={};for(const r of e){const i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function Lx(e){return JSON.stringify(e)}function X4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const uC="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ru(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const J4=lg(()=>{if(og.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ml(e){if(Ru(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Ru(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function dC(e){return ml(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const W4=new Set(["string","number","symbol"]);function ad(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ei(e,t,r){const i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function Ie(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function e5(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function t5(e,t){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=Wa(e._zod.def,{get shape(){const u={};for(const d in t){if(!(d in r.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(u[d]=r.shape[d])}return Pi(this,"shape",u),u},checks:[]});return ei(e,l)}function n5(e,t){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=Wa(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const d in t){if(!(d in r.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete u[d]}return Pi(this,"shape",u),u},checks:[]});return ei(e,l)}function r5(e,t){if(!ml(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const l=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(l,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Wa(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return Pi(this,"shape",l),l}});return ei(e,o)}function a5(e,t){if(!ml(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Wa(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Pi(this,"shape",i),i}});return ei(e,r)}function i5(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r=Wa(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t._zod.def.shape};return Pi(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ei(e,r)}function s5(e,t,r){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=Wa(t._zod.def,{get shape(){const d=t._zod.def.shape,m={...d};if(r)for(const p in r){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);r[p]&&(m[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)m[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return Pi(this,"shape",m),m},checks:[]});return ei(t,u)}function o5(e,t,r){const i=Wa(t._zod.def,{get shape(){const o=t._zod.def.shape,l={...o};if(r)for(const u in r){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(l[u]=new e({type:"nonoptional",innerType:o[u]}))}else for(const u in o)l[u]=new e({type:"nonoptional",innerType:o[u]});return Pi(this,"shape",l),l}});return ei(t,i)}function zs(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function nu(e){return typeof e=="string"?e:e?.message}function Ai(e,t,r){const i=e.message?e.message:nu(e.inst?._zod.def?.error?.(e))??nu(t?.error?.(e))??nu(r.customError?.(e))??nu(r.localeError?.(e))??"Invalid input",{inst:o,continue:l,input:u,...d}=e;return d.path??(d.path=[]),d.message=i,t?.reportInput&&(d.input=u),d}function dg(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function pl(...e){const[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}const hC=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Zm,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},fg=me("$ZodError",hC),id=me("$ZodError",hC,{Parent:Error});function c5(e,t=r=>r.message){const r={},i=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):i.push(t(o));return{formErrors:i,fieldErrors:r}}function u5(e,t=r=>r.message){const r={_errors:[]},i=(o,l=[])=>{for(const u of o.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>i({issues:d},[...l,...u.path]));else if(u.code==="invalid_key")i({issues:u.issues},[...l,...u.path]);else if(u.code==="invalid_element")i({issues:u.issues},[...l,...u.path]);else{const d=[...l,...u.path];if(d.length===0)r._errors.push(t(u));else{let m=r,p=0;for(;p(t,r,i,o)=>{const l=i?{...i,async:!1}:{async:!1},u=t._zod.run({value:r,issues:[]},l);if(u instanceof Promise)throw new Fs;if(u.issues.length){const d=new(o?.Err??e)(u.issues.map(m=>Ai(m,l,Oi())));throw uC(d,o?.callee),d}return u.value},d5=sd(id),od=e=>async(t,r,i,o)=>{const l=i?{...i,async:!0}:{async:!0};let u=t._zod.run({value:r,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const d=new(o?.Err??e)(u.issues.map(m=>Ai(m,l,Oi())));throw uC(d,o?.callee),d}return u.value},f5=od(id),ld=e=>(t,r,i)=>{const o=i?{...i,async:!1}:{async:!1},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise)throw new Fs;return l.issues.length?{success:!1,error:new(e??fg)(l.issues.map(u=>Ai(u,o,Oi())))}:{success:!0,data:l.value}},h5=ld(id),cd=e=>async(t,r,i)=>{const o=i?{...i,async:!0}:{async:!0};let l=t._zod.run({value:r,issues:[]},o);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>Ai(u,o,Oi())))}:{success:!0,data:l.value}},m5=cd(id),p5=e=>(t,r,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return sd(e)(t,r,o)},g5=e=>(t,r,i)=>sd(e)(t,r,i),v5=e=>async(t,r,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return od(e)(t,r,o)},y5=e=>async(t,r,i)=>od(e)(t,r,i),b5=e=>(t,r,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return ld(e)(t,r,o)},x5=e=>(t,r,i)=>ld(e)(t,r,i),w5=e=>async(t,r,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return cd(e)(t,r,o)},S5=e=>async(t,r,i)=>cd(e)(t,r,i),_5=/^[cC][0-9a-z]{6,}$/,C5=/^[0-9a-z]+$/,E5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,R5=/^[0-9a-vA-V]{20}$/,j5=/^[A-Za-z0-9]{27}$/,T5=/^[a-zA-Z0-9_-]{21}$/,O5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,A5=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$x=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,M5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,N5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function D5(){return new RegExp(N5,"u")}const k5=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,z5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,L5=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,$5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,I5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,mC=/^[A-Za-z0-9_-]*$/,P5=/^https?$/,F5=/^\+[1-9]\d{6,14}$/,pC="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",V5=new RegExp(`^${pC}$`);function gC(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function U5(e){return new RegExp(`^${gC(e)}$`)}function H5(e){const t=gC({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${r.join("|")})`;return new RegExp(`^${pC}T(?:${i})$`)}const B5=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},q5=/^(?:true|false)$/i,G5=/^[^A-Z]*$/,Z5=/^[^a-z]*$/,Nr=me("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),K5=me("$ZodCheckMaxLength",(e,t)=>{var r;Nr.init(e,t),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!cg(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const o=i.value;if(o.length<=t.maximum)return;const u=dg(o);i.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Y5=me("$ZodCheckMinLength",(e,t)=>{var r;Nr.init(e,t),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!cg(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{const o=i.value;if(o.length>=t.minimum)return;const u=dg(o);i.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Q5=me("$ZodCheckLengthEquals",(e,t)=>{var r;Nr.init(e,t),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!cg(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=i=>{const o=i.value,l=o.length;if(l===t.length)return;const u=dg(o),d=l>t.length;i.issues.push({origin:u,...d?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),ud=me("$ZodCheckStringFormat",(e,t)=>{var r,i;Nr.init(e,t),e._zod.onattach.push(o=>{const l=o._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),X5=me("$ZodCheckRegex",(e,t)=>{ud.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),J5=me("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=G5),ud.init(e,t)}),W5=me("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Z5),ud.init(e,t)}),e6=me("$ZodCheckIncludes",(e,t)=>{Nr.init(e,t);const r=ad(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=i,e._zod.onattach.push(o=>{const l=o._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(i)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),t6=me("$ZodCheckStartsWith",(e,t)=>{Nr.init(e,t);const r=new RegExp(`^${ad(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),n6=me("$ZodCheckEndsWith",(e,t)=>{Nr.init(e,t);const r=new RegExp(`.*${ad(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}}),r6=me("$ZodCheckOverwrite",(e,t)=>{Nr.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class a6{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const i=t.split(` + color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,r?.key)}return o}}function $e(e,t,r,i){return{debug:()=>{var o;return(o=e?.debugAll)!=null?o:e[t]},key:!1,onChange:i}}function V3(e,t,r,i){const o=()=>{var u;return(u=l.getValue())!=null?u:e.options.renderFallbackValue},l={id:`${t.id}_${r.id}`,row:t,column:r,getValue:()=>t.getValue(i),renderValue:o,getContext:Le(()=>[e,r,t,l],(u,d,m,p)=>({table:u,column:d,row:m,cell:p,getValue:p.getValue,renderValue:p.renderValue}),$e(e.options,"debugCells"))};return e._features.forEach(u=>{u.createCell==null||u.createCell(l,r,t,e)},{}),l}function U3(e,t,r,i){var o,l;const d={...e._getDefaultColumnDef(),...t},m=d.accessorKey;let p=(o=(l=d.id)!=null?l:m?typeof String.prototype.replaceAll=="function"?m.replaceAll(".","_"):m.replace(/\./g,"_"):void 0)!=null?o:typeof d.header=="string"?d.header:void 0,y;if(d.accessorFn?y=d.accessorFn:m&&(m.includes(".")?y=b=>{let x=b;for(const _ of m.split(".")){var w;x=(w=x)==null?void 0:w[_]}return x}:y=b=>b[d.accessorKey]),!p)throw new Error;let v={id:`${String(p)}`,accessorFn:y,parent:i,depth:r,columnDef:d,columns:[],getFlatColumns:Le(()=>[!0],()=>{var b;return[v,...(b=v.columns)==null?void 0:b.flatMap(x=>x.getFlatColumns())]},$e(e.options,"debugColumns")),getLeafColumns:Le(()=>[e._getOrderColumnsFn()],b=>{var x;if((x=v.columns)!=null&&x.length){let w=v.columns.flatMap(_=>_.getLeafColumns());return b(w)}return[v]},$e(e.options,"debugColumns"))};for(const b of e._features)b.createColumn==null||b.createColumn(v,e);return v}const dn="debugHeaders";function yx(e,t,r){var i;let l={id:(i=r.id)!=null?i:t.id,column:t,index:r.index,isPlaceholder:!!r.isPlaceholder,placeholderId:r.placeholderId,depth:r.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const u=[],d=m=>{m.subHeaders&&m.subHeaders.length&&m.subHeaders.map(d),u.push(m)};return d(l),u},getContext:()=>({table:e,header:l,column:t})};return e._features.forEach(u=>{u.createHeader==null||u.createHeader(l,e)}),l}const H3={createTable:e=>{e.getHeaderGroups=Le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,i,o)=>{var l,u;const d=(l=i?.map(v=>r.find(b=>b.id===v)).filter(Boolean))!=null?l:[],m=(u=o?.map(v=>r.find(b=>b.id===v)).filter(Boolean))!=null?u:[],p=r.filter(v=>!(i!=null&&i.includes(v.id))&&!(o!=null&&o.includes(v.id)));return Jc(t,[...d,...p,...m],e)},$e(e.options,dn)),e.getCenterHeaderGroups=Le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,i,o)=>(r=r.filter(l=>!(i!=null&&i.includes(l.id))&&!(o!=null&&o.includes(l.id))),Jc(t,r,e,"center")),$e(e.options,dn)),e.getLeftHeaderGroups=Le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(t,r,i)=>{var o;const l=(o=i?.map(u=>r.find(d=>d.id===u)).filter(Boolean))!=null?o:[];return Jc(t,l,e,"left")},$e(e.options,dn)),e.getRightHeaderGroups=Le(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(t,r,i)=>{var o;const l=(o=i?.map(u=>r.find(d=>d.id===u)).filter(Boolean))!=null?o:[];return Jc(t,l,e,"right")},$e(e.options,dn)),e.getFooterGroups=Le(()=>[e.getHeaderGroups()],t=>[...t].reverse(),$e(e.options,dn)),e.getLeftFooterGroups=Le(()=>[e.getLeftHeaderGroups()],t=>[...t].reverse(),$e(e.options,dn)),e.getCenterFooterGroups=Le(()=>[e.getCenterHeaderGroups()],t=>[...t].reverse(),$e(e.options,dn)),e.getRightFooterGroups=Le(()=>[e.getRightHeaderGroups()],t=>[...t].reverse(),$e(e.options,dn)),e.getFlatHeaders=Le(()=>[e.getHeaderGroups()],t=>t.map(r=>r.headers).flat(),$e(e.options,dn)),e.getLeftFlatHeaders=Le(()=>[e.getLeftHeaderGroups()],t=>t.map(r=>r.headers).flat(),$e(e.options,dn)),e.getCenterFlatHeaders=Le(()=>[e.getCenterHeaderGroups()],t=>t.map(r=>r.headers).flat(),$e(e.options,dn)),e.getRightFlatHeaders=Le(()=>[e.getRightHeaderGroups()],t=>t.map(r=>r.headers).flat(),$e(e.options,dn)),e.getCenterLeafHeaders=Le(()=>[e.getCenterFlatHeaders()],t=>t.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),$e(e.options,dn)),e.getLeftLeafHeaders=Le(()=>[e.getLeftFlatHeaders()],t=>t.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),$e(e.options,dn)),e.getRightLeafHeaders=Le(()=>[e.getRightFlatHeaders()],t=>t.filter(r=>{var i;return!((i=r.subHeaders)!=null&&i.length)}),$e(e.options,dn)),e.getLeafHeaders=Le(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(t,r,i)=>{var o,l,u,d,m,p;return[...(o=(l=t[0])==null?void 0:l.headers)!=null?o:[],...(u=(d=r[0])==null?void 0:d.headers)!=null?u:[],...(m=(p=i[0])==null?void 0:p.headers)!=null?m:[]].map(y=>y.getLeafHeaders()).flat()},$e(e.options,dn))}};function Jc(e,t,r,i){var o,l;let u=0;const d=function(b,x){x===void 0&&(x=1),u=Math.max(u,x),b.filter(w=>w.getIsVisible()).forEach(w=>{var _;(_=w.columns)!=null&&_.length&&d(w.columns,x+1)},0)};d(e);let m=[];const p=(b,x)=>{const w={depth:x,id:[i,`${x}`].filter(Boolean).join("_"),headers:[]},_=[];b.forEach(E=>{const R=[..._].reverse()[0],T=E.column.depth===w.depth;let O,N=!1;if(T&&E.column.parent?O=E.column.parent:(O=E.column,N=!0),R&&R?.column===O)R.subHeaders.push(E);else{const z=yx(r,O,{id:[i,x,O.id,E?.id].filter(Boolean).join("_"),isPlaceholder:N,placeholderId:N?`${_.filter(B=>B.column===O).length}`:void 0,depth:x,index:_.length});z.subHeaders.push(E),_.push(z)}w.headers.push(E),E.headerGroup=w}),m.push(w),x>0&&p(_,x-1)},y=t.map((b,x)=>yx(r,b,{depth:u,index:x}));p(y,u-1),m.reverse();const v=b=>b.filter(w=>w.column.getIsVisible()).map(w=>{let _=0,E=0,R=[0];w.subHeaders&&w.subHeaders.length?(R=[],v(w.subHeaders).forEach(O=>{let{colSpan:N,rowSpan:z}=O;_+=N,R.push(z)})):_=1;const T=Math.min(...R);return E=E+T,w.colSpan=_,w.rowSpan=E,{colSpan:_,rowSpan:E}});return v((o=(l=m[0])==null?void 0:l.headers)!=null?o:[]),m}const B3=(e,t,r,i,o,l,u)=>{let d={id:t,index:i,original:r,depth:o,parentId:u,_valuesCache:{},_uniqueValuesCache:{},getValue:m=>{if(d._valuesCache.hasOwnProperty(m))return d._valuesCache[m];const p=e.getColumn(m);if(p!=null&&p.accessorFn)return d._valuesCache[m]=p.accessorFn(d.original,i),d._valuesCache[m]},getUniqueValues:m=>{if(d._uniqueValuesCache.hasOwnProperty(m))return d._uniqueValuesCache[m];const p=e.getColumn(m);if(p!=null&&p.accessorFn)return p.columnDef.getUniqueValues?(d._uniqueValuesCache[m]=p.columnDef.getUniqueValues(d.original,i),d._uniqueValuesCache[m]):(d._uniqueValuesCache[m]=[d.getValue(m)],d._uniqueValuesCache[m])},renderValue:m=>{var p;return(p=d.getValue(m))!=null?p:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>F3(d.subRows,m=>m.subRows),getParentRow:()=>d.parentId?e.getRow(d.parentId,!0):void 0,getParentRows:()=>{let m=[],p=d;for(;;){const y=p.getParentRow();if(!y)break;m.push(y),p=y}return m.reverse()},getAllCells:Le(()=>[e.getAllLeafColumns()],m=>m.map(p=>V3(e,d,p,p.id)),$e(e.options,"debugRows")),_getAllCellsByColumnId:Le(()=>[d.getAllCells()],m=>m.reduce((p,y)=>(p[y.column.id]=y,p),{}),$e(e.options,"debugRows"))};for(let m=0;m{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()}}},$_=(e,t,r)=>{var i,o;const l=r==null||(i=r.toString())==null?void 0:i.toLowerCase();return!!(!((o=e.getValue(t))==null||(o=o.toString())==null||(o=o.toLowerCase())==null)&&o.includes(l))};$_.autoRemove=e=>pr(e);const I_=(e,t,r)=>{var i;return!!(!((i=e.getValue(t))==null||(i=i.toString())==null)&&i.includes(r))};I_.autoRemove=e=>pr(e);const P_=(e,t,r)=>{var i;return((i=e.getValue(t))==null||(i=i.toString())==null?void 0:i.toLowerCase())===r?.toLowerCase()};P_.autoRemove=e=>pr(e);const F_=(e,t,r)=>{var i;return(i=e.getValue(t))==null?void 0:i.includes(r)};F_.autoRemove=e=>pr(e);const V_=(e,t,r)=>!r.some(i=>{var o;return!((o=e.getValue(t))!=null&&o.includes(i))});V_.autoRemove=e=>pr(e)||!(e!=null&&e.length);const U_=(e,t,r)=>r.some(i=>{var o;return(o=e.getValue(t))==null?void 0:o.includes(i)});U_.autoRemove=e=>pr(e)||!(e!=null&&e.length);const H_=(e,t,r)=>e.getValue(t)===r;H_.autoRemove=e=>pr(e);const B_=(e,t,r)=>e.getValue(t)==r;B_.autoRemove=e=>pr(e);const Jp=(e,t,r)=>{let[i,o]=r;const l=e.getValue(t);return l>=i&&l<=o};Jp.resolveFilterValue=e=>{let[t,r]=e,i=typeof t!="number"?parseFloat(t):t,o=typeof r!="number"?parseFloat(r):r,l=t===null||Number.isNaN(i)?-1/0:i,u=r===null||Number.isNaN(o)?1/0:o;if(l>u){const d=l;l=u,u=d}return[l,u]};Jp.autoRemove=e=>pr(e)||pr(e[0])&&pr(e[1]);const Wr={includesString:$_,includesStringSensitive:I_,equalsString:P_,arrIncludes:F_,arrIncludesAll:V_,arrIncludesSome:U_,equals:H_,weakEquals:B_,inNumberRange:Jp};function pr(e){return e==null||e===""}const G3={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:Fn("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,t)=>{e.getAutoFilterFn=()=>{const r=t.getCoreRowModel().flatRows[0],i=r?.getValue(e.id);return typeof i=="string"?Wr.includesString:typeof i=="number"?Wr.inNumberRange:typeof i=="boolean"||i!==null&&typeof i=="object"?Wr.equals:Array.isArray(i)?Wr.arrIncludes:Wr.weakEquals},e.getFilterFn=()=>{var r,i;return td(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(r=(i=t.options.filterFns)==null?void 0:i[e.columnDef.filterFn])!=null?r:Wr[e.columnDef.filterFn]},e.getCanFilter=()=>{var r,i,o;return((r=e.columnDef.enableColumnFilter)!=null?r:!0)&&((i=t.options.enableColumnFilters)!=null?i:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var r;return(r=t.getState().columnFilters)==null||(r=r.find(i=>i.id===e.id))==null?void 0:r.value},e.getFilterIndex=()=>{var r,i;return(r=(i=t.getState().columnFilters)==null?void 0:i.findIndex(o=>o.id===e.id))!=null?r:-1},e.setFilterValue=r=>{t.setColumnFilters(i=>{const o=e.getFilterFn(),l=i?.find(y=>y.id===e.id),u=La(r,l?l.value:void 0);if(bx(o,u,e)){var d;return(d=i?.filter(y=>y.id!==e.id))!=null?d:[]}const m={id:e.id,value:u};if(l){var p;return(p=i?.map(y=>y.id===e.id?m:y))!=null?p:[]}return i!=null&&i.length?[...i,m]:[m]})}},createRow:(e,t)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=t=>{const r=e.getAllLeafColumns(),i=o=>{var l;return(l=La(t,o))==null?void 0:l.filter(u=>{const d=r.find(m=>m.id===u.id);if(d){const m=d.getFilterFn();if(bx(m,u.value,d))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(i)},e.resetColumnFilters=t=>{var r,i;e.setColumnFilters(t?[]:(r=(i=e.initialState)==null?void 0:i.columnFilters)!=null?r:[])},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 bx(e,t,r){return(e&&e.autoRemove?e.autoRemove(t,r):!1)||typeof t>"u"||typeof t=="string"&&!t}const Z3=(e,t,r)=>r.reduce((i,o)=>{const l=o.getValue(e);return i+(typeof l=="number"?l:0)},0),K3=(e,t,r)=>{let i;return r.forEach(o=>{const l=o.getValue(e);l!=null&&(i>l||i===void 0&&l>=l)&&(i=l)}),i},Y3=(e,t,r)=>{let i;return r.forEach(o=>{const l=o.getValue(e);l!=null&&(i=l)&&(i=l)}),i},Q3=(e,t,r)=>{let i,o;return r.forEach(l=>{const u=l.getValue(e);u!=null&&(i===void 0?u>=u&&(i=o=u):(i>u&&(i=u),o{let r=0,i=0;if(t.forEach(o=>{let l=o.getValue(e);l!=null&&(l=+l)>=l&&(++r,i+=l)}),r)return i/r},J3=(e,t)=>{if(!t.length)return;const r=t.map(l=>l.getValue(e));if(!P3(r))return;if(r.length===1)return r[0];const i=Math.floor(r.length/2),o=r.sort((l,u)=>l-u);return r.length%2!==0?o[i]:(o[i-1]+o[i])/2},W3=(e,t)=>Array.from(new Set(t.map(r=>r.getValue(e))).values()),e4=(e,t)=>new Set(t.map(r=>r.getValue(e))).size,t4=(e,t)=>t.length,Gh={sum:Z3,min:K3,max:Y3,extent:Q3,mean:X3,median:J3,unique:W3,uniqueCount:e4,count:t4},n4={getDefaultColumnDef:()=>({aggregatedCell:e=>{var t,r;return(t=(r=e.getValue())==null||r.toString==null?void 0:r.toString())!=null?t:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:Fn("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,t)=>{e.toggleGrouping=()=>{t.setGrouping(r=>r!=null&&r.includes(e.id)?r.filter(i=>i!==e.id):[...r??[],e.id])},e.getCanGroup=()=>{var r,i;return((r=e.columnDef.enableGrouping)!=null?r:!0)&&((i=t.options.enableGrouping)!=null?i:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var r;return(r=t.getState().grouping)==null?void 0:r.includes(e.id)},e.getGroupedIndex=()=>{var r;return(r=t.getState().grouping)==null?void 0:r.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const r=e.getCanGroup();return()=>{r&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const r=t.getCoreRowModel().flatRows[0],i=r?.getValue(e.id);if(typeof i=="number")return Gh.sum;if(Object.prototype.toString.call(i)==="[object Date]")return Gh.extent},e.getAggregationFn=()=>{var r,i;if(!e)throw new Error;return td(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(r=(i=t.options.aggregationFns)==null?void 0:i[e.columnDef.aggregationFn])!=null?r:Gh[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=t=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(t),e.resetGrouping=t=>{var r,i;e.setGrouping(t?[]:(r=(i=e.initialState)==null?void 0:i.grouping)!=null?r:[])},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=r=>{if(e._groupingValuesCache.hasOwnProperty(r))return e._groupingValuesCache[r];const i=t.getColumn(r);return i!=null&&i.columnDef.getGroupingValue?(e._groupingValuesCache[r]=i.columnDef.getGroupingValue(e.original),e._groupingValuesCache[r]):e.getValue(r)},e._groupingValuesCache={}},createCell:(e,t,r,i)=>{e.getIsGrouped=()=>t.getIsGrouped()&&t.id===r.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&t.getIsGrouped(),e.getIsAggregated=()=>{var o;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((o=r.subRows)!=null&&o.length)}}};function r4(e,t,r){if(!(t!=null&&t.length)||!r)return e;const i=e.filter(l=>!t.includes(l.id));return r==="remove"?i:[...t.map(l=>e.find(u=>u.id===l)).filter(Boolean),...i]}const a4={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:Fn("columnOrder",e)}),createColumn:(e,t)=>{e.getIndex=Le(r=>[nl(t,r)],r=>r.findIndex(i=>i.id===e.id),$e(t.options,"debugColumns")),e.getIsFirstColumn=r=>{var i;return((i=nl(t,r)[0])==null?void 0:i.id)===e.id},e.getIsLastColumn=r=>{var i;const o=nl(t,r);return((i=o[o.length-1])==null?void 0:i.id)===e.id}},createTable:e=>{e.setColumnOrder=t=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(t),e.resetColumnOrder=t=>{var r;e.setColumnOrder(t?[]:(r=e.initialState.columnOrder)!=null?r:[])},e._getOrderColumnsFn=Le(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(t,r,i)=>o=>{let l=[];if(!(t!=null&&t.length))l=o;else{const u=[...t],d=[...o];for(;d.length&&u.length;){const m=u.shift(),p=d.findIndex(y=>y.id===m);p>-1&&l.push(d.splice(p,1)[0])}l=[...l,...d]}return r4(l,r,i)},$e(e.options,"debugTable"))}},Zh=()=>({left:[],right:[]}),i4={getInitialState:e=>({columnPinning:Zh(),...e}),getDefaultOptions:e=>({onColumnPinningChange:Fn("columnPinning",e)}),createColumn:(e,t)=>{e.pin=r=>{const i=e.getLeafColumns().map(o=>o.id).filter(Boolean);t.setColumnPinning(o=>{var l,u;if(r==="right"){var d,m;return{left:((d=o?.left)!=null?d:[]).filter(v=>!(i!=null&&i.includes(v))),right:[...((m=o?.right)!=null?m:[]).filter(v=>!(i!=null&&i.includes(v))),...i]}}if(r==="left"){var p,y;return{left:[...((p=o?.left)!=null?p:[]).filter(v=>!(i!=null&&i.includes(v))),...i],right:((y=o?.right)!=null?y:[]).filter(v=>!(i!=null&&i.includes(v)))}}return{left:((l=o?.left)!=null?l:[]).filter(v=>!(i!=null&&i.includes(v))),right:((u=o?.right)!=null?u:[]).filter(v=>!(i!=null&&i.includes(v)))}})},e.getCanPin=()=>e.getLeafColumns().some(i=>{var o,l,u;return((o=i.columnDef.enablePinning)!=null?o:!0)&&((l=(u=t.options.enableColumnPinning)!=null?u:t.options.enablePinning)!=null?l:!0)}),e.getIsPinned=()=>{const r=e.getLeafColumns().map(d=>d.id),{left:i,right:o}=t.getState().columnPinning,l=r.some(d=>i?.includes(d)),u=r.some(d=>o?.includes(d));return l?"left":u?"right":!1},e.getPinnedIndex=()=>{var r,i;const o=e.getIsPinned();return o?(r=(i=t.getState().columnPinning)==null||(i=i[o])==null?void 0:i.indexOf(e.id))!=null?r:-1:0}},createRow:(e,t)=>{e.getCenterVisibleCells=Le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left,t.getState().columnPinning.right],(r,i,o)=>{const l=[...i??[],...o??[]];return r.filter(u=>!l.includes(u.column.id))},$e(t.options,"debugRows")),e.getLeftVisibleCells=Le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.left],(r,i)=>(i??[]).map(l=>r.find(u=>u.column.id===l)).filter(Boolean).map(l=>({...l,position:"left"})),$e(t.options,"debugRows")),e.getRightVisibleCells=Le(()=>[e._getAllVisibleCells(),t.getState().columnPinning.right],(r,i)=>(i??[]).map(l=>r.find(u=>u.column.id===l)).filter(Boolean).map(l=>({...l,position:"right"})),$e(t.options,"debugRows"))},createTable:e=>{e.setColumnPinning=t=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(t),e.resetColumnPinning=t=>{var r,i;return e.setColumnPinning(t?Zh():(r=(i=e.initialState)==null?void 0:i.columnPinning)!=null?r:Zh())},e.getIsSomeColumnsPinned=t=>{var r;const i=e.getState().columnPinning;if(!t){var o,l;return!!((o=i.left)!=null&&o.length||(l=i.right)!=null&&l.length)}return!!((r=i[t])!=null&&r.length)},e.getLeftLeafColumns=Le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(t,r)=>(r??[]).map(i=>t.find(o=>o.id===i)).filter(Boolean),$e(e.options,"debugColumns")),e.getRightLeafColumns=Le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(t,r)=>(r??[]).map(i=>t.find(o=>o.id===i)).filter(Boolean),$e(e.options,"debugColumns")),e.getCenterLeafColumns=Le(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(t,r,i)=>{const o=[...r??[],...i??[]];return t.filter(l=>!o.includes(l.id))},$e(e.options,"debugColumns"))}};function s4(e){return e||(typeof document<"u"?document:null)}const Wc={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},Kh=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),o4={getDefaultColumnDef:()=>Wc,getInitialState:e=>({columnSizing:{},columnSizingInfo:Kh(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:Fn("columnSizing",e),onColumnSizingInfoChange:Fn("columnSizingInfo",e)}),createColumn:(e,t)=>{e.getSize=()=>{var r,i,o;const l=t.getState().columnSizing[e.id];return Math.min(Math.max((r=e.columnDef.minSize)!=null?r:Wc.minSize,(i=l??e.columnDef.size)!=null?i:Wc.size),(o=e.columnDef.maxSize)!=null?o:Wc.maxSize)},e.getStart=Le(r=>[r,nl(t,r),t.getState().columnSizing],(r,i)=>i.slice(0,e.getIndex(r)).reduce((o,l)=>o+l.getSize(),0),$e(t.options,"debugColumns")),e.getAfter=Le(r=>[r,nl(t,r),t.getState().columnSizing],(r,i)=>i.slice(e.getIndex(r)+1).reduce((o,l)=>o+l.getSize(),0),$e(t.options,"debugColumns")),e.resetSize=()=>{t.setColumnSizing(r=>{let{[e.id]:i,...o}=r;return o})},e.getCanResize=()=>{var r,i;return((r=e.columnDef.enableResizing)!=null?r:!0)&&((i=t.options.enableColumnResizing)!=null?i:!0)},e.getIsResizing=()=>t.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,t)=>{e.getSize=()=>{let r=0;const i=o=>{if(o.subHeaders.length)o.subHeaders.forEach(i);else{var l;r+=(l=o.column.getSize())!=null?l:0}};return i(e),r},e.getStart=()=>{if(e.index>0){const r=e.headerGroup.headers[e.index-1];return r.getStart()+r.getSize()}return 0},e.getResizeHandler=r=>{const i=t.getColumn(e.column.id),o=i?.getCanResize();return l=>{if(!i||!o||(l.persist==null||l.persist(),Yh(l)&&l.touches&&l.touches.length>1))return;const u=e.getSize(),d=e?e.getLeafHeaders().map(R=>[R.column.id,R.column.getSize()]):[[i.id,i.getSize()]],m=Yh(l)?Math.round(l.touches[0].clientX):l.clientX,p={},y=(R,T)=>{typeof T=="number"&&(t.setColumnSizingInfo(O=>{var N,z;const B=t.options.columnResizeDirection==="rtl"?-1:1,H=(T-((N=O?.startOffset)!=null?N:0))*B,I=Math.max(H/((z=O?.startSize)!=null?z:0),-.999999);return O.columnSizingStart.forEach(ne=>{let[ge,pe]=ne;p[ge]=Math.round(Math.max(pe+pe*I,0)*100)/100}),{...O,deltaOffset:H,deltaPercentage:I}}),(t.options.columnResizeMode==="onChange"||R==="end")&&t.setColumnSizing(O=>({...O,...p})))},v=R=>y("move",R),b=R=>{y("end",R),t.setColumnSizingInfo(T=>({...T,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},x=s4(r),w={moveHandler:R=>v(R.clientX),upHandler:R=>{x?.removeEventListener("mousemove",w.moveHandler),x?.removeEventListener("mouseup",w.upHandler),b(R.clientX)}},_={moveHandler:R=>(R.cancelable&&(R.preventDefault(),R.stopPropagation()),v(R.touches[0].clientX),!1),upHandler:R=>{var T;x?.removeEventListener("touchmove",_.moveHandler),x?.removeEventListener("touchend",_.upHandler),R.cancelable&&(R.preventDefault(),R.stopPropagation()),b((T=R.touches[0])==null?void 0:T.clientX)}},E=l4()?{passive:!1}:!1;Yh(l)?(x?.addEventListener("touchmove",_.moveHandler,E),x?.addEventListener("touchend",_.upHandler,E)):(x?.addEventListener("mousemove",w.moveHandler,E),x?.addEventListener("mouseup",w.upHandler,E)),t.setColumnSizingInfo(R=>({...R,startOffset:m,startSize:u,deltaOffset:0,deltaPercentage:0,columnSizingStart:d,isResizingColumn:i.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 r;e.setColumnSizing(t?{}:(r=e.initialState.columnSizing)!=null?r:{})},e.resetHeaderSizeInfo=t=>{var r;e.setColumnSizingInfo(t?Kh():(r=e.initialState.columnSizingInfo)!=null?r:Kh())},e.getTotalSize=()=>{var t,r;return(t=(r=e.getHeaderGroups()[0])==null?void 0:r.headers.reduce((i,o)=>i+o.getSize(),0))!=null?t:0},e.getLeftTotalSize=()=>{var t,r;return(t=(r=e.getLeftHeaderGroups()[0])==null?void 0:r.headers.reduce((i,o)=>i+o.getSize(),0))!=null?t:0},e.getCenterTotalSize=()=>{var t,r;return(t=(r=e.getCenterHeaderGroups()[0])==null?void 0:r.headers.reduce((i,o)=>i+o.getSize(),0))!=null?t:0},e.getRightTotalSize=()=>{var t,r;return(t=(r=e.getRightHeaderGroups()[0])==null?void 0:r.headers.reduce((i,o)=>i+o.getSize(),0))!=null?t:0}}};let eu=null;function l4(){if(typeof eu=="boolean")return eu;let e=!1;try{const t={get passive(){return e=!0,!1}},r=()=>{};window.addEventListener("test",r,t),window.removeEventListener("test",r)}catch{e=!1}return eu=e,eu}function Yh(e){return e.type==="touchstart"}const c4={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:Fn("columnVisibility",e)}),createColumn:(e,t)=>{e.toggleVisibility=r=>{e.getCanHide()&&t.setColumnVisibility(i=>({...i,[e.id]:r??!e.getIsVisible()}))},e.getIsVisible=()=>{var r,i;const o=e.columns;return(r=o.length?o.some(l=>l.getIsVisible()):(i=t.getState().columnVisibility)==null?void 0:i[e.id])!=null?r:!0},e.getCanHide=()=>{var r,i;return((r=e.columnDef.enableHiding)!=null?r:!0)&&((i=t.options.enableHiding)!=null?i:!0)},e.getToggleVisibilityHandler=()=>r=>{e.toggleVisibility==null||e.toggleVisibility(r.target.checked)}},createRow:(e,t)=>{e._getAllVisibleCells=Le(()=>[e.getAllCells(),t.getState().columnVisibility],r=>r.filter(i=>i.column.getIsVisible()),$e(t.options,"debugRows")),e.getVisibleCells=Le(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(r,i,o)=>[...r,...i,...o],$e(t.options,"debugRows"))},createTable:e=>{const t=(r,i)=>Le(()=>[i(),i().filter(o=>o.getIsVisible()).map(o=>o.id).join("_")],o=>o.filter(l=>l.getIsVisible==null?void 0:l.getIsVisible()),$e(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=r=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(r),e.resetColumnVisibility=r=>{var i;e.setColumnVisibility(r?{}:(i=e.initialState.columnVisibility)!=null?i:{})},e.toggleAllColumnsVisible=r=>{var i;r=(i=r)!=null?i:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((o,l)=>({...o,[l.id]:r||!(l.getCanHide!=null&&l.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(r=>!(r.getIsVisible!=null&&r.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(r=>r.getIsVisible==null?void 0:r.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>r=>{var i;e.toggleAllColumnsVisible((i=r.target)==null?void 0:i.checked)}}};function nl(e,t){return t?t==="center"?e.getCenterVisibleLeafColumns():t==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const u4={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()}}},d4={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:Fn("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:t=>{var r;const i=(r=e.getCoreRowModel().flatRows[0])==null||(r=r._getAllCellsByColumnId()[t.id])==null?void 0:r.getValue();return typeof i=="string"||typeof i=="number"}}),createColumn:(e,t)=>{e.getCanGlobalFilter=()=>{var r,i,o,l;return((r=e.columnDef.enableGlobalFilter)!=null?r:!0)&&((i=t.options.enableGlobalFilter)!=null?i:!0)&&((o=t.options.enableFilters)!=null?o:!0)&&((l=t.options.getColumnCanGlobalFilter==null?void 0:t.options.getColumnCanGlobalFilter(e))!=null?l:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>Wr.includesString,e.getGlobalFilterFn=()=>{var t,r;const{globalFilterFn:i}=e.options;return td(i)?i:i==="auto"?e.getGlobalAutoFilterFn():(t=(r=e.options.filterFns)==null?void 0:r[i])!=null?t:Wr[i]},e.setGlobalFilter=t=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(t)},e.resetGlobalFilter=t=>{e.setGlobalFilter(t?void 0:e.initialState.globalFilter)}}},f4={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:Fn("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let t=!1,r=!1;e._autoResetExpanded=()=>{var i,o;if(!t){e._queue(()=>{t=!0});return}if((i=(o=e.options.autoResetAll)!=null?o:e.options.autoResetExpanded)!=null?i:!e.options.manualExpanding){if(r)return;r=!0,e._queue(()=>{e.resetExpanded(),r=!1})}},e.setExpanded=i=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(i),e.toggleAllRowsExpanded=i=>{i??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=i=>{var o,l;e.setExpanded(i?{}:(o=(l=e.initialState)==null?void 0:l.expanded)!=null?o:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(i=>i.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>i=>{i.persist==null||i.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const i=e.getState().expanded;return i===!0||Object.values(i).some(Boolean)},e.getIsAllRowsExpanded=()=>{const i=e.getState().expanded;return typeof i=="boolean"?i===!0:!(!Object.keys(i).length||e.getRowModel().flatRows.some(o=>!o.getIsExpanded()))},e.getExpandedDepth=()=>{let i=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(l=>{const u=l.split(".");i=Math.max(i,u.length)}),i},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=r=>{t.setExpanded(i=>{var o;const l=i===!0?!0:!!(i!=null&&i[e.id]);let u={};if(i===!0?Object.keys(t.getRowModel().rowsById).forEach(d=>{u[d]=!0}):u=i,r=(o=r)!=null?o:!l,!l&&r)return{...u,[e.id]:!0};if(l&&!r){const{[e.id]:d,...m}=u;return m}return i})},e.getIsExpanded=()=>{var r;const i=t.getState().expanded;return!!((r=t.options.getIsRowExpanded==null?void 0:t.options.getIsRowExpanded(e))!=null?r:i===!0||i?.[e.id])},e.getCanExpand=()=>{var r,i,o;return(r=t.options.getRowCanExpand==null?void 0:t.options.getRowCanExpand(e))!=null?r:((i=t.options.enableExpanding)!=null?i:!0)&&!!((o=e.subRows)!=null&&o.length)},e.getIsAllParentsExpanded=()=>{let r=!0,i=e;for(;r&&i.parentId;)i=t.getRow(i.parentId,!0),r=i.getIsExpanded();return r},e.getToggleExpandedHandler=()=>{const r=e.getCanExpand();return()=>{r&&e.toggleExpanded()}}}},$m=0,Im=10,Qh=()=>({pageIndex:$m,pageSize:Im}),h4={getInitialState:e=>({...e,pagination:{...Qh(),...e?.pagination}}),getDefaultOptions:e=>({onPaginationChange:Fn("pagination",e)}),createTable:e=>{let t=!1,r=!1;e._autoResetPageIndex=()=>{var i,o;if(!t){e._queue(()=>{t=!0});return}if((i=(o=e.options.autoResetAll)!=null?o:e.options.autoResetPageIndex)!=null?i:!e.options.manualPagination){if(r)return;r=!0,e._queue(()=>{e.resetPageIndex(),r=!1})}},e.setPagination=i=>{const o=l=>La(i,l);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(o)},e.resetPagination=i=>{var o;e.setPagination(i?Qh():(o=e.initialState.pagination)!=null?o:Qh())},e.setPageIndex=i=>{e.setPagination(o=>{let l=La(i,o.pageIndex);const u=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return l=Math.max(0,Math.min(l,u)),{...o,pageIndex:l}})},e.resetPageIndex=i=>{var o,l;e.setPageIndex(i?$m:(o=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageIndex)!=null?o:$m)},e.resetPageSize=i=>{var o,l;e.setPageSize(i?Im:(o=(l=e.initialState)==null||(l=l.pagination)==null?void 0:l.pageSize)!=null?o:Im)},e.setPageSize=i=>{e.setPagination(o=>{const l=Math.max(1,La(i,o.pageSize)),u=o.pageSize*o.pageIndex,d=Math.floor(u/l);return{...o,pageIndex:d,pageSize:l}})},e.setPageCount=i=>e.setPagination(o=>{var l;let u=La(i,(l=e.options.pageCount)!=null?l:-1);return typeof u=="number"&&(u=Math.max(-1,u)),{...o,pageCount:u}}),e.getPageOptions=Le(()=>[e.getPageCount()],i=>{let o=[];return i&&i>0&&(o=[...new Array(i)].fill(null).map((l,u)=>u)),o},$e(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:i}=e.getState().pagination,o=e.getPageCount();return o===-1?!0:o===0?!1:ie.setPageIndex(i=>i-1),e.nextPage=()=>e.setPageIndex(i=>i+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 i;return(i=e.options.pageCount)!=null?i:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var i;return(i=e.options.rowCount)!=null?i:e.getPrePaginationRowModel().rows.length}}},Xh=()=>({top:[],bottom:[]}),m4={getInitialState:e=>({rowPinning:Xh(),...e}),getDefaultOptions:e=>({onRowPinningChange:Fn("rowPinning",e)}),createRow:(e,t)=>{e.pin=(r,i,o)=>{const l=i?e.getLeafRows().map(m=>{let{id:p}=m;return p}):[],u=o?e.getParentRows().map(m=>{let{id:p}=m;return p}):[],d=new Set([...u,e.id,...l]);t.setRowPinning(m=>{var p,y;if(r==="bottom"){var v,b;return{top:((v=m?.top)!=null?v:[]).filter(_=>!(d!=null&&d.has(_))),bottom:[...((b=m?.bottom)!=null?b:[]).filter(_=>!(d!=null&&d.has(_))),...Array.from(d)]}}if(r==="top"){var x,w;return{top:[...((x=m?.top)!=null?x:[]).filter(_=>!(d!=null&&d.has(_))),...Array.from(d)],bottom:((w=m?.bottom)!=null?w:[]).filter(_=>!(d!=null&&d.has(_)))}}return{top:((p=m?.top)!=null?p:[]).filter(_=>!(d!=null&&d.has(_))),bottom:((y=m?.bottom)!=null?y:[]).filter(_=>!(d!=null&&d.has(_)))}})},e.getCanPin=()=>{var r;const{enableRowPinning:i,enablePinning:o}=t.options;return typeof i=="function"?i(e):(r=i??o)!=null?r:!0},e.getIsPinned=()=>{const r=[e.id],{top:i,bottom:o}=t.getState().rowPinning,l=r.some(d=>i?.includes(d)),u=r.some(d=>o?.includes(d));return l?"top":u?"bottom":!1},e.getPinnedIndex=()=>{var r,i;const o=e.getIsPinned();if(!o)return-1;const l=(r=o==="top"?t.getTopRows():t.getBottomRows())==null?void 0:r.map(u=>{let{id:d}=u;return d});return(i=l?.indexOf(e.id))!=null?i:-1}},createTable:e=>{e.setRowPinning=t=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(t),e.resetRowPinning=t=>{var r,i;return e.setRowPinning(t?Xh():(r=(i=e.initialState)==null?void 0:i.rowPinning)!=null?r:Xh())},e.getIsSomeRowsPinned=t=>{var r;const i=e.getState().rowPinning;if(!t){var o,l;return!!((o=i.top)!=null&&o.length||(l=i.bottom)!=null&&l.length)}return!!((r=i[t])!=null&&r.length)},e._getPinnedRows=(t,r,i)=>{var o;return((o=e.options.keepPinnedRows)==null||o?(r??[]).map(u=>{const d=e.getRow(u,!0);return d.getIsAllParentsExpanded()?d:null}):(r??[]).map(u=>t.find(d=>d.id===u))).filter(Boolean).map(u=>({...u,position:i}))},e.getTopRows=Le(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(t,r)=>e._getPinnedRows(t,r,"top"),$e(e.options,"debugRows")),e.getBottomRows=Le(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(t,r)=>e._getPinnedRows(t,r,"bottom"),$e(e.options,"debugRows")),e.getCenterRows=Le(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(t,r,i)=>{const o=new Set([...r??[],...i??[]]);return t.filter(l=>!o.has(l.id))},$e(e.options,"debugRows"))}},p4={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:Fn("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 r;return e.setRowSelection(t?{}:(r=e.initialState.rowSelection)!=null?r:{})},e.toggleAllRowsSelected=t=>{e.setRowSelection(r=>{t=typeof t<"u"?t:!e.getIsAllRowsSelected();const i={...r},o=e.getPreGroupedRowModel().flatRows;return t?o.forEach(l=>{l.getCanSelect()&&(i[l.id]=!0)}):o.forEach(l=>{delete i[l.id]}),i})},e.toggleAllPageRowsSelected=t=>e.setRowSelection(r=>{const i=typeof t<"u"?t:!e.getIsAllPageRowsSelected(),o={...r};return e.getRowModel().rows.forEach(l=>{Pm(o,l.id,i,!0,e)}),o}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=Le(()=>[e.getState().rowSelection,e.getCoreRowModel()],(t,r)=>Object.keys(t).length?Jh(e,r):{rows:[],flatRows:[],rowsById:{}},$e(e.options,"debugTable")),e.getFilteredSelectedRowModel=Le(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(t,r)=>Object.keys(t).length?Jh(e,r):{rows:[],flatRows:[],rowsById:{}},$e(e.options,"debugTable")),e.getGroupedSelectedRowModel=Le(()=>[e.getState().rowSelection,e.getSortedRowModel()],(t,r)=>Object.keys(t).length?Jh(e,r):{rows:[],flatRows:[],rowsById:{}},$e(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const t=e.getFilteredRowModel().flatRows,{rowSelection:r}=e.getState();let i=!!(t.length&&Object.keys(r).length);return i&&t.some(o=>o.getCanSelect()&&!r[o.id])&&(i=!1),i},e.getIsAllPageRowsSelected=()=>{const t=e.getPaginationRowModel().flatRows.filter(o=>o.getCanSelect()),{rowSelection:r}=e.getState();let i=!!t.length;return i&&t.some(o=>!r[o.id])&&(i=!1),i},e.getIsSomeRowsSelected=()=>{var t;const r=Object.keys((t=e.getState().rowSelection)!=null?t:{}).length;return r>0&&r{const t=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:t.filter(r=>r.getCanSelect()).some(r=>r.getIsSelected()||r.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>t=>{e.toggleAllRowsSelected(t.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>t=>{e.toggleAllPageRowsSelected(t.target.checked)}},createRow:(e,t)=>{e.toggleSelected=(r,i)=>{const o=e.getIsSelected();t.setRowSelection(l=>{var u;if(r=typeof r<"u"?r:!o,e.getCanSelect()&&o===r)return l;const d={...l};return Pm(d,e.id,r,(u=i?.selectChildren)!=null?u:!0,t),d})},e.getIsSelected=()=>{const{rowSelection:r}=t.getState();return Wp(e,r)},e.getIsSomeSelected=()=>{const{rowSelection:r}=t.getState();return Fm(e,r)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:r}=t.getState();return Fm(e,r)==="all"},e.getCanSelect=()=>{var r;return typeof t.options.enableRowSelection=="function"?t.options.enableRowSelection(e):(r=t.options.enableRowSelection)!=null?r:!0},e.getCanSelectSubRows=()=>{var r;return typeof t.options.enableSubRowSelection=="function"?t.options.enableSubRowSelection(e):(r=t.options.enableSubRowSelection)!=null?r:!0},e.getCanMultiSelect=()=>{var r;return typeof t.options.enableMultiRowSelection=="function"?t.options.enableMultiRowSelection(e):(r=t.options.enableMultiRowSelection)!=null?r:!0},e.getToggleSelectedHandler=()=>{const r=e.getCanSelect();return i=>{var o;r&&e.toggleSelected((o=i.target)==null?void 0:o.checked)}}}},Pm=(e,t,r,i,o)=>{var l;const u=o.getRow(t,!0);r?(u.getCanMultiSelect()||Object.keys(e).forEach(d=>delete e[d]),u.getCanSelect()&&(e[t]=!0)):delete e[t],i&&(l=u.subRows)!=null&&l.length&&u.getCanSelectSubRows()&&u.subRows.forEach(d=>Pm(e,d.id,r,i,o))};function Jh(e,t){const r=e.getState().rowSelection,i=[],o={},l=function(u,d){return u.map(m=>{var p;const y=Wp(m,r);if(y&&(i.push(m),o[m.id]=m),(p=m.subRows)!=null&&p.length&&(m={...m,subRows:l(m.subRows)}),y)return m}).filter(Boolean)};return{rows:l(t.rows),flatRows:i,rowsById:o}}function Wp(e,t){var r;return(r=t[e.id])!=null?r:!1}function Fm(e,t,r){var i;if(!((i=e.subRows)!=null&&i.length))return!1;let o=!0,l=!1;return e.subRows.forEach(u=>{if(!(l&&!o)&&(u.getCanSelect()&&(Wp(u,t)?l=!0:o=!1),u.subRows&&u.subRows.length)){const d=Fm(u,t);d==="all"?l=!0:(d==="some"&&(l=!0),o=!1)}}),o?"all":l?"some":!1}const Vm=/([0-9]+)/gm,g4=(e,t,r)=>q_(Ga(e.getValue(r)).toLowerCase(),Ga(t.getValue(r)).toLowerCase()),v4=(e,t,r)=>q_(Ga(e.getValue(r)),Ga(t.getValue(r))),y4=(e,t,r)=>eg(Ga(e.getValue(r)).toLowerCase(),Ga(t.getValue(r)).toLowerCase()),b4=(e,t,r)=>eg(Ga(e.getValue(r)),Ga(t.getValue(r))),x4=(e,t,r)=>{const i=e.getValue(r),o=t.getValue(r);return i>o?1:ieg(e.getValue(r),t.getValue(r));function eg(e,t){return e===t?0:e>t?1:-1}function Ga(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function q_(e,t){const r=e.split(Vm).filter(Boolean),i=t.split(Vm).filter(Boolean);for(;r.length&&i.length;){const o=r.shift(),l=i.shift(),u=parseInt(o,10),d=parseInt(l,10),m=[u,d].sort();if(isNaN(m[0])){if(o>l)return 1;if(l>o)return-1;continue}if(isNaN(m[1]))return isNaN(u)?-1:1;if(u>d)return 1;if(d>u)return-1}return r.length-i.length}const Go={alphanumeric:g4,alphanumericCaseSensitive:v4,text:y4,textCaseSensitive:b4,datetime:x4,basic:w4},S4={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:Fn("sorting",e),isMultiSortEvent:t=>t.shiftKey}),createColumn:(e,t)=>{e.getAutoSortingFn=()=>{const r=t.getFilteredRowModel().flatRows.slice(10);let i=!1;for(const o of r){const l=o?.getValue(e.id);if(Object.prototype.toString.call(l)==="[object Date]")return Go.datetime;if(typeof l=="string"&&(i=!0,l.split(Vm).length>1))return Go.alphanumeric}return i?Go.text:Go.basic},e.getAutoSortDir=()=>{const r=t.getFilteredRowModel().flatRows[0];return typeof r?.getValue(e.id)=="string"?"asc":"desc"},e.getSortingFn=()=>{var r,i;if(!e)throw new Error;return td(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(r=(i=t.options.sortingFns)==null?void 0:i[e.columnDef.sortingFn])!=null?r:Go[e.columnDef.sortingFn]},e.toggleSorting=(r,i)=>{const o=e.getNextSortingOrder(),l=typeof r<"u"&&r!==null;t.setSorting(u=>{const d=u?.find(x=>x.id===e.id),m=u?.findIndex(x=>x.id===e.id);let p=[],y,v=l?r:o==="desc";if(u!=null&&u.length&&e.getCanMultiSort()&&i?d?y="toggle":y="add":u!=null&&u.length&&m!==u.length-1?y="replace":d?y="toggle":y="replace",y==="toggle"&&(l||o||(y="remove")),y==="add"){var b;p=[...u,{id:e.id,desc:v}],p.splice(0,p.length-((b=t.options.maxMultiSortColCount)!=null?b:Number.MAX_SAFE_INTEGER))}else y==="toggle"?p=u.map(x=>x.id===e.id?{...x,desc:v}:x):y==="remove"?p=u.filter(x=>x.id!==e.id):p=[{id:e.id,desc:v}];return p})},e.getFirstSortDir=()=>{var r,i;return((r=(i=e.columnDef.sortDescFirst)!=null?i:t.options.sortDescFirst)!=null?r:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=r=>{var i,o;const l=e.getFirstSortDir(),u=e.getIsSorted();return u?u!==l&&((i=t.options.enableSortingRemoval)==null||i)&&(!(r&&(o=t.options.enableMultiRemove)!=null)||o)?!1:u==="desc"?"asc":"desc":l},e.getCanSort=()=>{var r,i;return((r=e.columnDef.enableSorting)!=null?r:!0)&&((i=t.options.enableSorting)!=null?i:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var r,i;return(r=(i=e.columnDef.enableMultiSort)!=null?i:t.options.enableMultiSort)!=null?r:!!e.accessorFn},e.getIsSorted=()=>{var r;const i=(r=t.getState().sorting)==null?void 0:r.find(o=>o.id===e.id);return i?i.desc?"desc":"asc":!1},e.getSortIndex=()=>{var r,i;return(r=(i=t.getState().sorting)==null?void 0:i.findIndex(o=>o.id===e.id))!=null?r:-1},e.clearSorting=()=>{t.setSorting(r=>r!=null&&r.length?r.filter(i=>i.id!==e.id):[])},e.getToggleSortingHandler=()=>{const r=e.getCanSort();return i=>{r&&(i.persist==null||i.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?t.options.isMultiSortEvent==null?void 0:t.options.isMultiSortEvent(i):!1))}}},createTable:e=>{e.setSorting=t=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(t),e.resetSorting=t=>{var r,i;e.setSorting(t?[]:(r=(i=e.initialState)==null?void 0:i.sorting)!=null?r:[])},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())}},_4=[H3,c4,a4,i4,q3,G3,u4,d4,S4,n4,f4,h4,m4,p4,o4];function C4(e){var t,r;const i=[..._4,...(t=e._features)!=null?t:[]];let o={_features:i};const l=o._features.reduce((b,x)=>Object.assign(b,x.getDefaultOptions==null?void 0:x.getDefaultOptions(o)),{}),u=b=>o.options.mergeOptions?o.options.mergeOptions(l,b):{...l,...b};let m={...{},...(r=e.initialState)!=null?r:{}};o._features.forEach(b=>{var x;m=(x=b.getInitialState==null?void 0:b.getInitialState(m))!=null?x:m});const p=[];let y=!1;const v={_features:i,options:{...l,...e},initialState:m,_queue:b=>{p.push(b),y||(y=!0,Promise.resolve().then(()=>{for(;p.length;)p.shift()();y=!1}).catch(x=>setTimeout(()=>{throw x})))},reset:()=>{o.setState(o.initialState)},setOptions:b=>{const x=La(b,o.options);o.options=u(x)},getState:()=>o.options.state,setState:b=>{o.options.onStateChange==null||o.options.onStateChange(b)},_getRowId:(b,x,w)=>{var _;return(_=o.options.getRowId==null?void 0:o.options.getRowId(b,x,w))!=null?_:`${w?[w.id,x].join("."):x}`},getCoreRowModel:()=>(o._getCoreRowModel||(o._getCoreRowModel=o.options.getCoreRowModel(o)),o._getCoreRowModel()),getRowModel:()=>o.getPaginationRowModel(),getRow:(b,x)=>{let w=(x?o.getPrePaginationRowModel():o.getRowModel()).rowsById[b];if(!w&&(w=o.getCoreRowModel().rowsById[b],!w))throw new Error;return w},_getDefaultColumnDef:Le(()=>[o.options.defaultColumn],b=>{var x;return b=(x=b)!=null?x:{},{header:w=>{const _=w.header.column.columnDef;return _.accessorKey?_.accessorKey:_.accessorFn?_.id:null},cell:w=>{var _,E;return(_=(E=w.renderValue())==null||E.toString==null?void 0:E.toString())!=null?_:null},...o._features.reduce((w,_)=>Object.assign(w,_.getDefaultColumnDef==null?void 0:_.getDefaultColumnDef()),{}),...b}},$e(e,"debugColumns")),_getColumnDefs:()=>o.options.columns,getAllColumns:Le(()=>[o._getColumnDefs()],b=>{const x=function(w,_,E){return E===void 0&&(E=0),w.map(R=>{const T=U3(o,R,E,_),O=R;return T.columns=O.columns?x(O.columns,T,E+1):[],T})};return x(b)},$e(e,"debugColumns")),getAllFlatColumns:Le(()=>[o.getAllColumns()],b=>b.flatMap(x=>x.getFlatColumns()),$e(e,"debugColumns")),_getAllFlatColumnsById:Le(()=>[o.getAllFlatColumns()],b=>b.reduce((x,w)=>(x[w.id]=w,x),{}),$e(e,"debugColumns")),getAllLeafColumns:Le(()=>[o.getAllColumns(),o._getOrderColumnsFn()],(b,x)=>{let w=b.flatMap(_=>_.getLeafColumns());return x(w)},$e(e,"debugColumns")),getColumn:b=>o._getAllFlatColumnsById()[b]};Object.assign(o,v);for(let b=0;bLe(()=>[e.options.data],t=>{const r={rows:[],flatRows:[],rowsById:{}},i=function(o,l,u){l===void 0&&(l=0);const d=[];for(let p=0;pe._autoResetPageIndex()))}function Z_(){return e=>Le(()=>[e.getState().sorting,e.getPreSortedRowModel()],(t,r)=>{if(!r.rows.length||!(t!=null&&t.length))return r;const i=e.getState().sorting,o=[],l=i.filter(m=>{var p;return(p=e.getColumn(m.id))==null?void 0:p.getCanSort()}),u={};l.forEach(m=>{const p=e.getColumn(m.id);p&&(u[m.id]={sortUndefined:p.columnDef.sortUndefined,invertSorting:p.columnDef.invertSorting,sortingFn:p.getSortingFn()})});const d=m=>{const p=m.map(y=>({...y}));return p.sort((y,v)=>{for(let x=0;x{var v;o.push(y),(v=y.subRows)!=null&&v.length&&(y.subRows=d(y.subRows))}),p};return{rows:d(r.rows),flatRows:o,rowsById:r.rowsById}},$e(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}function Um(e,t){return e?E4(e)?S.createElement(e,t):e:null}function E4(e){return R4(e)||typeof e=="function"||j4(e)}function R4(e){return typeof e=="function"&&(()=>{const t=Object.getPrototypeOf(e);return t.prototype&&t.prototype.isReactComponent})()}function j4(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function K_(e){const t={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[r]=S.useState(()=>({current:C4(t)})),[i,o]=S.useState(()=>r.current.initialState);return r.current.setOptions(l=>({...l,...e,state:{...i,...e.state},onStateChange:u=>{o(u),e.onStateChange==null||e.onStateChange(u)}})),r.current}var Rl=e=>e.type==="checkbox",$a=e=>e instanceof Date,sn=e=>e==null;const tg=e=>typeof e=="object";var Ot=e=>!sn(e)&&!Array.isArray(e)&&tg(e)&&!$a(e),T4=e=>Ot(e)&&e.target?Rl(e.target)?e.target.checked:e.target.value:e,O4=(e,t)=>t.split(".").some((r,i,o)=>!isNaN(Number(r))&&e.has(o.slice(0,i).join("."))),Y_=e=>{const t=e.constructor&&e.constructor.prototype;return Ot(t)&&t.hasOwnProperty("isPrototypeOf")},nd=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Dt(e){if(e instanceof Date)return new Date(e);const t=typeof FileList<"u"&&e instanceof FileList;if(nd&&(e instanceof Blob||t))return e;const r=Array.isArray(e);if(!r&&!(Ot(e)&&Y_(e)))return e;const i=r?[]:Object.create(Object.getPrototypeOf(e));for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&(i[o]=Dt(e[o]));return i}const Os={BLUR:"blur",FOCUS_OUT:"focusout",SUBMIT:"submit",TRIGGER:"trigger",VALID:"valid"},mr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},fr={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Q_="root",ng=["__proto__","constructor","prototype"],A4=/^\w*$/;var jl=e=>A4.test(e),bt=e=>e===void 0;const M4=/[.[\]'"]/;var rd=e=>e.split(M4).filter(Boolean),_e=(e,t,r)=>{if(!t||!Ot(e))return r;const i=jl(t)?[t]:rd(t);if(i.some(l=>ng.includes(l)))return r;const o=i.reduce((l,u)=>sn(l)?void 0:l[u],e);return bt(o)||o===e?bt(e[t])?r:e[t]:o},Rr=e=>typeof e=="boolean",Jn=e=>typeof e=="function",mt=(e,t,r)=>{let i=-1;const o=jl(t)?[t]:rd(t),l=o.length,u=l-1;for(;++i{const o={};for(const l in e)Object.defineProperty(o,l,{get:()=>{const u=l;return t._proxyFormState[u]!==mr.all&&(t._proxyFormState[u]=!i||mr.all),e[u]}});return o};const k4=nd?ve.useLayoutEffect:ve.useEffect;var ln=e=>typeof e=="string",z4=(e,t,r,i,o)=>ln(e)?(i&&t.watch.add(e),_e(r,e,o)):Array.isArray(e)?e.map(l=>(i&&t.watch.add(l),_e(r,l))):(i&&(t.watchAll=!0),r),Hm=e=>sn(e)||!tg(e);const xx=(e,t)=>t.length===0&&!Array.isArray(e)&&!Y_(e);function jr(e,t,r=new WeakMap){if(e===t)return!0;if(Hm(e)||Hm(t))return Object.is(e,t);if($a(e)&&$a(t))return Object.is(e.getTime(),t.getTime());const i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;if(xx(e,i)||xx(t,o))return Object.is(e,t);if(!i.length&&Array.isArray(e)!==Array.isArray(t))return!1;const l=r.get(e);if(l&&l.has(t))return!0;if(l)l.add(t);else{const u=new WeakSet;u.add(t),r.set(e,u)}for(const u of i){const d=e[u];if(!(u in t))return!1;if(u!=="ref"){const m=t[u];if($a(d)&&$a(m)||(Ot(d)||Array.isArray(d))&&(Ot(m)||Array.isArray(m))?!jr(d,m,r):!Object.is(d,m))return!1}}return!0}var tu=e=>({isOnSubmit:!e||e===mr.onSubmit,isOnBlur:e===mr.onBlur,isOnChange:e===mr.onChange,isOnAll:e===mr.all,isOnTouch:e===mr.onTouched}),Wh=(e,t,r)=>{if(r)return!1;if(t.watchAll||t.watch.has(e))return!0;for(const i of t.watch)if(e.startsWith(i)&&e.charAt(i.length)===".")return!0;return!1};const rl=(e,t,r,i)=>{for(const o of r||Object.keys(e)){const l=_e(e,o);if(l){const{_f:u,...d}=l;if(u){if(u.refs&&u.refs[0]&&t(u.refs[0],o)&&!i)return!0;if(u.ref&&t(u.ref,u.name)&&!i)return!0;if(rl(d,t))break}else if(Ot(d)&&rl(d,t))break}}};var wx=(e,t,r)=>{const i=_e(e,r),o=Array.isArray(i)?i:[];return mt(o,Q_,t[r]),mt(e,r,o),e},an=e=>Ot(e)&&!Object.keys(e).length,rg=e=>e.type==="file",Cu=e=>{if(!nd)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ag=e=>e.type==="radio",Eu=e=>e instanceof RegExp,ig=(e,t,r,i,o)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[i]:o||!0}}:{};const Sx={value:!1,isValid:!1},_x={value:!0,isValid:!0};var X_=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(r=>r&&r.checked&&!r.disabled).map(r=>r.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!bt(e[0].attributes.value)?bt(e[0].value)||e[0].value===""?_x:{value:e[0].value,isValid:!0}:_x:Sx}return Sx};const Cx={isValid:!1,value:null};var J_=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Cx):Cx;function Ex(e,t,r="validate"){if(ln(e)||Array.isArray(e)&&e.every(ln)||Rr(e)&&!e)return{type:r,message:ln(e)?e:"",ref:t}}var As=e=>Ot(e)&&!Eu(e)?e:{value:e,message:""},Rx=async(e,t,r,i,o,l)=>{const{ref:u,refs:d,required:m,maxLength:p,minLength:y,min:v,max:b,pattern:x,validate:w,name:_,valueAsNumber:E,mount:R}=e._f,T=_e(r,_);if(!R||t.has(_))return{};const O=d?d[0]:u,N=he=>{if(o&&O.reportValidity){const de=Rr(he)?"":he||"";d?d.forEach(ee=>ee.setCustomValidity(de)):O.setCustomValidity(de),O.reportValidity()}},z={},B=ag(u),H=Rl(u),I=B||H,ne=(E||rg(u))&&bt(u.value)&&bt(T)||Cu(u)&&u.value===""||T===""||Array.isArray(T)&&!T.length,ge=ig.bind(null,_,i,z),pe=(he,de,ee,ye=fr.maxLength,L=fr.minLength)=>{const Z=he?de:ee;z[_]={type:he?ye:L,message:Z,ref:u,...ge(he?ye:L,Z)}};if(l?!Array.isArray(T)||!T.length:m&&(!I&&(ne||sn(T))||Rr(T)&&!T||H&&!X_(d).isValid||B&&!J_(d).isValid)){const{value:he,message:de}=ln(m)?{value:!!m,message:m}:As(m);if(he&&(z[_]={type:fr.required,message:de,ref:O,...ge(fr.required,de)},!i))return N(de),z}if(!ne&&(!sn(v)||!sn(b))){let he,de;const ee=As(b),ye=As(v);if(!sn(T)&&!isNaN(T)){const L=u.valueAsNumber||T&&+T;sn(ee.value)||(he=L>ee.value),sn(ye.value)||(de=Lnew Date(new Date().toDateString()+" "+te),re=u.type=="time",X=u.type=="week";ln(ee.value)&&T&&(he=re?Z(T)>Z(ee.value):X?T>ee.value:L>new Date(ee.value)),ln(ye.value)&&T&&(de=re?Z(T)+he.value,ye=!sn(de.value)&&T.length<+de.value;if((ee||ye)&&(pe(ee,he.message,de.message),!i))return N(z[_].message),z}if(x&&!ne&&ln(T)){const{value:he,message:de}=As(x);if(Eu(he)&&!T.match(he)&&(z[_]={type:fr.pattern,message:de,ref:u,...ge(fr.pattern,de)},!i))return N(de),z}if(w){if(Jn(w)){const he=await w(T,r),de=Ex(he,O);if(de&&(z[_]={...de,...ge(fr.validate,de.message)},!i))return N(de.message),z}else if(Ot(w)){let he={};for(const de in w){if(!an(he)&&!i)break;const ee=Ex(await w[de](T,r),O,de);ee&&(he={...ee,...ge(de,ee.message)},N(ee.message),i&&(z[_]=he))}if(!an(he)&&(z[_]={ref:O,...he},!i))return z}}return N(!0),z},uu=e=>Array.isArray(e)?e:[e],W_=e=>Array.isArray(e)?e.filter(Boolean):[];function L4(e,t){const r=t.slice(0,-1).length;let i=0;for(;ing.includes(String(u))))return e;const i=r.length===1?e:L4(e,r),o=r.length-1,l=r[o];return i&&delete i[l],o!==0&&(Ot(i)&&an(i)||Array.isArray(i)&&$4(i))&&kt(e,r.slice(0,-1)),e}const eC=e=>{const t={};for(const r of Object.keys(e))if(tg(e[r])&&e[r]!==null&&!$a(e[r])){const i=eC(e[r]);for(const o of Object.keys(i))t[`${r}.${o}`]=i[o]}else t[r]=e[r];return t},I4=ve.createContext(null);I4.displayName="HookFormContext";var jx=()=>{let e=[];return{get observers(){return e},next:o=>{for(const l of e)l.next&&l.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(l=>l!==o)}}),unsubscribe:()=>{e=[]}}};function tC(e,t){const r={};for(const i in e)if(e.hasOwnProperty(i)){const o=e[i],l=t[i];if(o&&Ot(o)&&l){const u=tC(o,l);Ot(u)&&(r[i]=u)}else e[i]&&(r[i]=l)}return r}var nC=e=>e.type==="select-multiple",P4=e=>ag(e)||Rl(e),em=e=>Cu(e)&&e.isConnected,F4=e=>{for(const t in e)if(Jn(e[t]))return!0;return!1};function rC(e){return Array.isArray(e)||Ot(e)&&!F4(e)}function aC(e){return!!(e&&"_f"in e)}function iC(e){return Array.isArray(e)?!e.some(t=>!bt(t)):!Object.keys(e).length}function Bm(e,t){Array.isArray(e)?e[t]=void 0:delete e[t]}function qm(e,t={},r){for(const i in e){const o=e[i],l=r&&r[i];rC(o)&&(!Array.isArray(o)||!aC(l))?(t[i]=Array.isArray(o)?[]:{},qm(o,t[i],l),iC(t[i])&&Bm(t,i)):bt(o)||(t[i]=!0)}return t}function wi(e,t,r,i){r||(r=qm(t,{},i));for(const o in e){const l=e[o],u=i&&i[o];rC(l)&&(!Array.isArray(l)||!aC(u))?(bt(t)||Hm(r[o])?r[o]=qm(l,Array.isArray(l)?[]:{},u):wi(l,sn(t)?{}:t[o],r[o],u),iC(r[o])&&Bm(r,o)):jr(l,t[o])?Bm(r,o):r[o]=!0}return r}var sC=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:i})=>bt(e)?e:t?e===""?NaN:e&&+e:r&&ln(e)?new Date(e):i?i(e):e;function Tx(e){const t=e.ref;return rg(t)?t.files:ag(t)?J_(e.refs).value:nC(t)?[...t.selectedOptions].map(({value:r})=>r):Rl(t)?X_(e.refs).value:sC(bt(t.value)?e.ref.value:t.value,e)}var V4=(e,t,r,i)=>{const o={};for(const l of e){const u=_e(t,l);u&&mt(o,l,u._f)}return{criteriaMode:r,names:[...e],fields:o,shouldUseNativeValidation:i}},Zo=e=>bt(e)?e:Eu(e)?e.source:Ot(e)?Eu(e.value)?e.value.source:e.value:e;const Ox="AsyncFunction";var U4=e=>{if(!e||!e.validate)return!1;if(Jn(e.validate))return e.validate.constructor.name===Ox;if(Ot(e.validate)){for(const t in e.validate)if(e.validate[t].constructor.name===Ox)return!0}return!1},H4=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Ax(e,t,r){const i=_e(e,r);if(i||jl(r))return{error:i,name:r};const o=r.split(".");for(;o.length;){const l=o.join("."),u=_e(t,l),d=_e(e,l);if(u&&!Array.isArray(u)&&r!==l)return{name:r};if(d&&d.type)return{name:l,error:d};if(d&&d.root&&d.root.type)return{name:`${l}.root`,error:d.root};o.pop()}return{name:r}}var B4=(e,t,r,i)=>{r(e);const{name:o,...l}=e,u=Object.keys(l);return!u.length||i&&u.length>=Object.keys(t).length||u.find(d=>t[d]===(!i||mr.all))},q4=(e,t,r)=>!e||!t||e===t||uu(e).some(i=>i&&(r?i===t||i.startsWith(t+"."):i.startsWith(t)||t.startsWith(i))),G4=(e,t,r,i,o)=>o.isOnAll?!1:!r&&o.isOnTouch?!(t||e):(r?i.isOnBlur:o.isOnBlur)?!e:(r?i.isOnChange:o.isOnChange)?e:!0,Z4=(e,t)=>!W_(_e(e,t)).length&&kt(e,t);const K4={mode:mr.onSubmit,reValidateMode:mr.onChange,shouldFocusError:!0},tm="form",oC={submitCount:0,isDirty:!1,isReady:!1,isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{}};function Y4(e={}){let t={...K4,...e},r={...Dt(oC),isLoading:Jn(t.defaultValues),errors:t.errors||{},disabled:t.disabled||!1},i={},o=Ot(t.defaultValues)||Ot(t.values)?Dt(t.defaultValues||t.values)||{}:{},l=t.shouldUnregister?{}:Dt(o),u={action:!1,mount:!1,watch:!1,keepIsValid:!1},d={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set,registerName:new Set};const m={},p={};let y=0,v=tu(t.mode),b=tu(t.reValidateMode);const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},w={...x};let _={...w};const E={array:jx(),state:jx()};let R=0;const T=t.criteriaMode===mr.all,O=(A,P)=>F=>{clearTimeout(p[A]),p[A]=setTimeout(P,F)},N=async A=>{if(!u.keepIsValid&&!t.disabled&&(w.isValid||_.isValid||A)){const P=++R;let F;t.resolver?(F=an((await ee()).errors),P===R&&z()):F=await Z({fields:i,onlyCheckValid:!0,eventType:Os.VALID}),P===R&&F!==r.isValid&&E.state.next({isValid:F})}},z=(A,P)=>{!t.disabled&&(w.isValidating||w.validatingFields||_.isValidating||_.validatingFields)&&((A||Array.from(d.mount)).forEach(F=>{F&&(P?mt(r.validatingFields,F,P):kt(r.validatingFields,F))}),E.state.next({validatingFields:r.validatingFields,isValidating:!an(r.validatingFields)}))},B=()=>{r.dirtyFields=wi(o,l,void 0,i)},H=(A,P=[],F,ue,oe=!0,be=!0)=>{if(ue&&F&&!t.disabled){if(u.action=!0,be&&Array.isArray(_e(i,A))){const Se=F(_e(i,A),ue.argA,ue.argB);oe&&mt(i,A,Se)}if(be&&Array.isArray(_e(r.errors,A))){const Se=F(_e(r.errors,A),ue.argA,ue.argB);oe&&mt(r.errors,A,Se),Z4(r.errors,A)}if((w.touchedFields||_.touchedFields)&&be&&Array.isArray(_e(r.touchedFields,A))){const Se=F(_e(r.touchedFields,A),ue.argA,ue.argB);oe&&mt(r.touchedFields,A,Se)}(w.dirtyFields||_.dirtyFields)&&B(),E.state.next({name:A,isDirty:X(A,P),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else mt(l,A,P)},I=(A,P)=>{mt(r.errors,A,P),r.errors={...r.errors},E.state.next({errors:r.errors})},ne=A=>{r.errors=A,E.state.next({errors:r.errors,isValid:!1})},ge=A=>{const P=jl(A)?[A]:rd(A);let F=l,ue=o;for(let oe=0;oe{const oe=_e(i,A);if(oe){if(ge(A))return;const be=bt(_e(l,A)),Se=_e(l,A,bt(F)?_e(o,A):F);bt(Se)||ue&&ue.defaultChecked||P?mt(l,A,P?Se:Tx(oe._f)):M(A,Se),u.mount&&!u.action&&(N(),be&&r.isDirty&&(w.isDirty||_.isDirty)&&(X()||(r.isDirty=!1,E.state.next({...r}))),e.shouldUnregister&&be&&!bt(_e(l,A))&&Wh(A,d)&&(u.watch=!0))}},he=(A,P,F,ue,oe)=>{let be=!1,Se=!1;const W={name:A};if(!t.disabled||ue===!0){if(!F||ue){const le=jr(_e(o,A),P);(w.isDirty||_.isDirty)&&(Se=r.isDirty,r.isDirty=W.isDirty=!le||X(),be=Se!==W.isDirty),Se=!!_e(r.dirtyFields,A),le!==r.isDirty?r.dirtyFields=wi(o,l,void 0,i):le?kt(r.dirtyFields,A):mt(r.dirtyFields,A,!0),W.dirtyFields=r.dirtyFields,be=be||(w.dirtyFields||_.dirtyFields)&&Se!==!le}if(F){const le=_e(r.touchedFields,A);le||(mt(r.touchedFields,A,F),W.touchedFields=r.touchedFields,be=be||(w.touchedFields||_.touchedFields)&&le!==F)}be&&oe&&E.state.next(W)}return be?W:{}},de=(A,P,F,ue)=>{const oe=_e(r.errors,A),be=(w.isValid||_.isValid)&&Rr(P)&&r.isValid!==P;if(t.delayError&&F?(m[A]=O(A,()=>I(A,F)),m[A](t.delayError)):(clearTimeout(p[A]),delete m[A],F?mt(r.errors,A,F):kt(r.errors,A),r.errors={...r.errors}),(F?!jr(oe,F):oe)||!an(ue)||be){const Se={...ue,...be&&Rr(P)?{isValid:P}:{},errors:r.errors,name:A};r={...r,...Se},E.state.next(Se)}},ee=async A=>(z(A,!0),await t.resolver(l,t.context,V4(A||d.mount,i,t.criteriaMode,t.shouldUseNativeValidation))),ye=async A=>{const{errors:P}=await ee(A);if(z(A),A){for(const F of A){const ue=_e(P,F);ue?d.array.has(F)&&Ot(ue)&&!Object.keys(ue).some(oe=>!Number.isNaN(Number(oe)))?wx(r.errors,{[F]:ue},F):mt(r.errors,F,ue):kt(r.errors,F)}r.errors={...r.errors}}else r.errors=P;return P},L=async({name:A,eventType:P})=>{if(e.validate){const F=await e.validate({formValues:l,formState:r,name:A,eventType:P});if(Ot(F))for(const ue in F){const oe=F[ue];oe&&ct(`${tm}.${ue}`,{message:ln(oe.message)?oe.message:"",type:oe.type||fr.validate})}else ln(F)||!F?ct(tm,{message:F||"",type:fr.validate}):He(tm);return F}return!0},Z=async({fields:A,onlyCheckValid:P,name:F,eventType:ue,context:oe={valid:!0,runRootValidation:!1}})=>{if(e.validate&&(oe.runRootValidation=!0,!await L({name:F,eventType:ue})&&(oe.valid=!1,P)))return oe.valid;for(const be in A){const Se=A[be];if(Se){const{_f:W,...le}=Se;if(W){const Re=d.array.has(W.name),ze=Se._f&&U4(Se._f),it=w.validatingFields||w.isValidating||_.validatingFields||_.isValidating;ze&&it&&z([W.name],!0);const _t=await Rx(Se,d.disabled,l,T,t.shouldUseNativeValidation&&!P,Re);if(ze&&it&&z([W.name]),_t[W.name]&&(oe.valid=!1,P)||(!P&&(_e(_t,W.name)?Re?wx(r.errors,_t,W.name):mt(r.errors,W.name,_t[W.name]):kt(r.errors,W.name)),e.shouldUseNativeValidation&&_t[W.name]))break}!an(le)&&await Z({context:oe,onlyCheckValid:P,fields:le,name:be,eventType:ue})}}return oe.valid},re=()=>{for(const A of d.unMount){const P=_e(i,A);P&&(P._f.refs?P._f.refs.every(F=>!em(F)):!em(P._f.ref))&&Xt(A)}d.unMount=new Set},X=(A,P)=>(A&&P&&mt(l,A,P),!jr(u.mount?l:o,o)),te=(A,P,F)=>z4(A,d,{...u.mount?l:bt(P)?o:ln(A)?{[A]:P}:P},F,P),D=A=>W_(_e(u.mount?l:o,A,t.shouldUnregister?_e(o,A,[]):[])),M=(A,P,F={},ue=!1,oe=!1)=>{const be=_e(i,A);let Se=P;if(be){const W=be._f;W&&(!W.disabled&&mt(l,A,sC(P,W)),Se=Cu(W.ref)&&sn(P)?"":P,nC(W.ref)?[...W.ref.options].forEach(le=>le.selected=Se.includes(le.value)):W.refs?Rl(W.ref)?W.refs.forEach(le=>{(!le.defaultChecked||!le.disabled)&&(Array.isArray(Se)?le.checked=!!Se.find(Re=>Re===le.value):le.checked=Se===le.value||!!Se)}):W.refs.forEach(le=>le.checked=le.value===Se):rg(W.ref)?W.ref.value="":(W.ref.value=Se,!W.ref.type&&!oe&&E.state.next({name:A,values:ue?l:Dt(l)})))}(F.shouldDirty||F.shouldTouch)&&he(A,Se,F.shouldTouch,F.shouldDirty,!oe),F.shouldValidate&&we(A,{delayError:F.delayError})},U=(A,P,F,ue=!1,oe=!1)=>{for(const be in P){if(!P.hasOwnProperty(be))return;const Se=P[be],W=A+"."+be,le=_e(i,W);(d.array.has(A)||Ot(Se)||le&&!le._f)&&!$a(Se)?U(W,Se,F,ue,oe):M(W,Se,F,ue,oe)}},Q=(A,P,F,ue,oe=!1)=>{const be=_e(i,A),Se=d.array.has(A),W=ue?P:Dt(P),le=_e(l,A),Re=jr(le,W);if(Re||mt(l,A,W),Se)E.array.next({name:A,values:ue?l:Dt(l)}),(w.isDirty||w.dirtyFields||_.isDirty||_.dirtyFields)&&F.shouldDirty&&(B(),oe||E.state.next({name:A,dirtyFields:r.dirtyFields,isDirty:X(A,W)}));else{const ze=Array.isArray(W)&&!W.length||an(W);!be||be._f||sn(W)||ze?M(A,W,F,ue,oe):U(A,W,F,ue,oe)}if(!Re&&!oe){const ze=Wh(A,d),it=ue?l:Dt(l);E.state.next({...ze&&r,name:u.mount||ze?A:void 0,values:it})}},K=(A,P,F={})=>Q(A,P,F,!1),fe=(A,P={})=>{const F=Jn(A)?A(l):A;if(!jr(l,F)){l={...l,...F};const ue=eC(F);for(const oe of d.mount)oe in ue&&Q(oe,ue[oe],P,!0,!0);E.state.next({...r,name:void 0,type:void 0,...y?{values:l}:{}}),P.shouldValidate&&N()}},ae=async A=>{u.mount=!0;const P=A.target;let F=P.name,ue=!0;const oe=_e(i,F),be=Se=>{ue=Number.isNaN(Se)||$a(Se)&&isNaN(Se.getTime())||jr(Se,_e(l,F,Se))};if(oe){let Se,W;const le=P.type?Tx(oe._f):T4(A),Re=A.type===Os.BLUR||A.type===Os.FOCUS_OUT,ze=!H4(oe._f)&&!e.validate&&!t.resolver&&!_e(r.errors,F)&&!oe._f.deps,it=ze||G4(Re,_e(r.touchedFields,F),r.isSubmitted,b,v),_t=Wh(F,d,Re);if(mt(l,F,le),Re){if(!P||!P.readOnly){oe._f.onBlur&&oe._f.onBlur(A);const st=m[F];st&&st(0)}}else oe._f.onChange&&oe._f.onChange(A);const Ae=he(F,le,Re),ut=!an(Ae)||_t;if(!Re&&E.state.next({name:F,type:A.type,...y?{values:Dt(l)}:{}}),it)return(!ze||!r.isValid)&&(w.isValid||_.isValid)&&(t.mode==="onBlur"?Re&&N():Re||N()),ut&&E.state.next({name:F,..._t?{}:Ae});if(!t.resolver&&e.validate&&await L({name:F,eventType:A.type}),!Re&&_t&&E.state.next({...r}),t.resolver){const{errors:st}=await ee([F]);if(z([F]),be(le),!ue){!an(Ae)&&E.state.next(Ae);return}const Gt=Ax(r.errors,i,F),sr=Ax(st,i,Gt.name||F);Se=sr.error,F=sr.name,W=an(st)}else z([F],!0),Se=(await Rx(oe,d.disabled,l,T,t.shouldUseNativeValidation))[F],z([F]),be(le),ue&&(Se?W=!1:(w.isValid||_.isValid)&&(W=await Z({fields:i,onlyCheckValid:!0,name:F,eventType:A.type})));ue&&(oe._f.deps&&(!Array.isArray(oe._f.deps)||oe._f.deps.length>0)&&we(oe._f.deps),de(F,W,Se,Ae))}},xe=(A,P)=>{if(_e(r.errors,P)&&A.focus)return A.focus(),1},we=async(A,P={})=>{let F,ue;const oe=uu(A);if(t.resolver){const be=await ye(bt(A)?A:oe);F=an(be),ue=A?!oe.some(Se=>_e(be,Se)):F}else A?(ue=(await Promise.all(oe.map(async be=>{const Se=_e(i,be);return await Z({fields:Se&&Se._f?{[be]:Se}:Se,eventType:Os.TRIGGER})}))).every(Boolean),!(!ue&&!r.isValid)&&N()):ue=F=await Z({fields:i,name:A,eventType:Os.TRIGGER});if(P.delayError&&t.delayError&&ln(A)){const be=_e(r.errors,A);be?(kt(r.errors,A),m[A]=O(A,()=>I(A,be)),m[A](t.delayError)):(clearTimeout(p[A]),delete m[A])}return E.state.next({...!ln(A)||(w.isValid||_.isValid)&&F!==r.isValid?{}:{name:A},...t.resolver||!A?{isValid:F}:{},errors:r.errors}),P.shouldFocus&&!ue&&rl(i,xe,A?oe:d.mount),ue},Me=(A,P)=>{let F={...u.mount?l:o};return P&&(F=tC(P.dirtyFields?r.dirtyFields:r.touchedFields,F)),bt(A)?F:ln(A)?_e(F,A):A.map(ue=>_e(F,ue))},Fe=(A,P)=>({invalid:!!_e((P||r).errors,A),isDirty:!!_e((P||r).dirtyFields,A),error:_e((P||r).errors,A),isValidating:!!_e(r.validatingFields,A),isTouched:!!_e((P||r).touchedFields,A)}),He=A=>{const P=A?uu(A):void 0;P?.forEach(F=>kt(r.errors,F)),P?P.forEach(F=>{E.state.next({name:F,errors:r.errors})}):E.state.next({errors:{}})},ct=(A,P,F)=>{const ue=(_e(i,A,{_f:{}})._f||{}).ref,oe=_e(r.errors,A)||{},{ref:be,message:Se,type:W,...le}=oe;mt(r.errors,A,{...le,...P,ref:ue}),E.state.next({name:A,errors:r.errors,isValid:!1}),F&&F.shouldFocus&&ue&&ue.focus&&ue.focus()},Je=(A,P)=>{if(Jn(A)){y++;const{unsubscribe:F}=E.state.subscribe({next:oe=>"values"in oe&&A(oe.values||te(void 0,P),oe)});let ue=!1;return{unsubscribe:()=>{ue||(ue=!0,y--,F())}}}return te(A,P,!0)},hn=A=>{var P;const F=!!(!((P=A.formState)===null||P===void 0)&&P.values);F&&y++;const{unsubscribe:ue}=E.state.subscribe({next:be=>{if(q4(A.name,be.name,A.exact)&&B4(be,A.formState||w,oa,A.reRenderRoot)){const Se={...l};A.callback({values:Se,...r,...be,defaultValues:o})}}});if(!F)return ue;let oe=!1;return()=>{oe||(oe=!0,y--,ue())}},mn=A=>(u.mount=!0,_={..._,...A.formState},hn({...A,formState:{...x,...A.formState}})),Xt=(A,P={})=>{for(const F of A?uu(A):d.mount)d.mount.delete(F),d.array.delete(F),P.keepValue||(kt(i,F),kt(l,F)),!P.keepError&&kt(r.errors,F),!P.keepDirty&&kt(r.dirtyFields,F),!P.keepTouched&&kt(r.touchedFields,F),!P.keepIsValidating&&kt(r.validatingFields,F),!t.shouldUnregister&&!P.keepDefaultValue&&kt(o,F);E.state.next({values:Dt(l)}),E.state.next({...r,...P.keepDirty?{isDirty:X()}:{}}),!P.keepIsValid&&N()},yr=({disabled:A,name:P})=>{if(Rr(A)&&u.mount||A||d.disabled.has(P)){const oe=d.disabled.has(P)!==!!A;A?d.disabled.add(P):d.disabled.delete(P),oe&&u.mount&&!u.action&&N()}},At=(A,P={})=>{let F=_e(i,A);const ue=Rr(P.disabled)||Rr(t.disabled),oe=!d.registerName.has(A)&&F&&F._f&&!F._f.mount;return mt(i,A,{...F||{},_f:{...F&&F._f?F._f:{ref:{name:A}},name:A,mount:!0,...P}}),d.mount.add(A),F&&!oe?yr({disabled:Rr(P.disabled)?P.disabled:t.disabled,name:A}):pe(A,!0,P.value),{...ue?{disabled:P.disabled||t.disabled}:{},...t.progressive?{required:!!P.required,min:Zo(P.min),max:Zo(P.max),minLength:Zo(P.minLength),maxLength:Zo(P.maxLength),pattern:Zo(P.pattern)}:{},name:A,onChange:ae,onBlur:ae,ref:be=>{if(be){d.registerName.add(A),At(A,P),d.registerName.delete(A),F=_e(i,A);const Se=bt(be.value)&&be.querySelectorAll&&be.querySelectorAll("input,select,textarea")[0]||be,W=P4(Se),le=F._f.refs||[];if(W?le.find(Re=>Re===Se):Se===F._f.ref)return;mt(i,A,{_f:{...F._f,...W?{refs:[...le.filter(em),Se,...Array.isArray(_e(o,A))?[{}]:[]],ref:{type:Se.type,name:A}}:{ref:Se}}}),pe(A,!1,void 0,Se)}else F=_e(i,A,{}),F._f&&(F._f.mount=!1),(t.shouldUnregister||P.shouldUnregister)&&!(O4(d.array,A)&&u.action)&&d.unMount.add(A)}}},rr=()=>t.shouldFocusError&&!t.shouldUseNativeValidation&&rl(i,xe,d.mount),br=A=>{Rr(A)&&(E.state.next({disabled:A}),rl(i,(P,F)=>{const ue=_e(i,F);ue&&(P.disabled=ue._f.disabled||A,Array.isArray(ue._f.refs)&&ue._f.refs.forEach(oe=>{oe.disabled=ue._f.disabled||A}))},0,!1))},Rt=(A,P)=>async F=>{let ue;F&&(F.preventDefault&&F.preventDefault(),F.persist&&F.persist());let oe=Dt(l);if(E.state.next({isSubmitting:!0}),t.resolver){const{errors:be,values:Se}=await ee();z(),r.errors=be,oe=Dt(Se)}else await Z({fields:i,eventType:Os.SUBMIT});if(d.disabled.size)for(const be of d.disabled)kt(oe,be);if(kt(r.errors,Q_),an(r.errors)){E.state.next({errors:{}});try{await A(oe,F)}catch(be){ue=be}}else P&&await P({...r.errors},F),rr(),setTimeout(rr);if(E.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:an(r.errors)&&!ue,submitCount:r.submitCount+1,errors:r.errors}),ue)throw ue},Vn=(A,P={})=>{_e(i,A)&&(bt(P.defaultValue)?K(A,Dt(_e(o,A))):(K(A,P.defaultValue),mt(o,A,Dt(P.defaultValue))),P.keepTouched||kt(r.touchedFields,A),P.keepDirty||(kt(r.dirtyFields,A),r.isDirty=P.defaultValue?X(A,Dt(_e(o,A))):X()),P.keepError||(kt(r.errors,A),w.isValid&&N()),E.state.next({...r}))},zt=(A,P={})=>{const F=A?Dt(A):o,ue=Dt(F),oe=an(A),be=ue,Se=i;if(P.keepDefaultValues||(o=F),!P.keepValues){if(P.keepDirtyValues){const W=new Set([...d.mount,...Object.keys(wi(o,l,void 0,Se))]);for(const le of Array.from(W)){const Re=_e(r.dirtyFields,le),ze=_e(l,le),it=_e(be,le);Re&&!bt(ze)?mt(be,le,ze):!Re&&!bt(it)&&K(le,it)}}else{if(nd&&bt(A))for(const W of d.mount){const le=_e(i,W);if(le&&le._f){const Re=Array.isArray(le._f.refs)?le._f.refs[0]:le._f.ref;if(Cu(Re)){const ze=Re.closest("form");if(ze){ze.reset();break}}}}if(P.keepFieldsRef)for(const W of d.mount)K(W,_e(be,W));else i={}}if(t.shouldUnregister){if(l=P.keepDefaultValues?Dt(o):{},P.keepFieldsRef)for(const W of d.mount)mt(l,W,_e(be,W))}else l=Dt(be);E.array.next({values:{...be}}),E.state.next({name:void 0,type:void 0,values:{...be}})}d={mount:P.keepDirtyValues?d.mount:new Set,unMount:new Set,array:new Set,registerName:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},u.mount=!w.isValid||!!P.keepIsValid||!!P.keepDirtyValues||!t.shouldUnregister&&!an(be),u.watch=!!t.shouldUnregister,u.keepIsValid=!!P.keepIsValid,u.action=!1,P.keepErrors||(r.errors={}),E.state.next({submitCount:P.keepSubmitCount?r.submitCount:0,isDirty:oe?!1:P.keepDirty?r.isDirty:P.keepValues?X():!!(P.keepDefaultValues&&!jr(A,o)),isSubmitted:P.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:oe?{}:P.keepDirtyValues?P.keepDefaultValues&&l?wi(o,l,void 0,Se):r.dirtyFields:P.keepDefaultValues&&A?wi(o,A,void 0,Se):P.keepDirty?r.dirtyFields:{},touchedFields:P.keepTouched?r.touchedFields:{},errors:P.keepErrors?r.errors:{},isSubmitSuccessful:P.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:o})},Dr=(A,P)=>zt(Jn(A)?A(l):A,{...t.resetOptions,...P}),ar=(A,P={})=>{const F=_e(i,A),ue=F&&F._f;if(ue){const oe=ue.refs?ue.refs[0]:ue.ref;oe.focus&&setTimeout(()=>{oe.focus(),P.shouldSelect&&Jn(oe.select)&&oe.select()})}},oa=A=>{const{name:P,type:F,values:ue,...oe}=A;r={...r,...oe}},Jt={control:{register:At,unregister:Xt,getFieldState:Fe,handleSubmit:Rt,setError:ct,_subscribe:hn,_runSchema:ee,_updateIsValidating:z,_focusError:rr,_getWatch:te,_getDirty:X,_setValid:N,_setFieldArray:H,_setDisabledField:yr,_setErrors:ne,_getFieldArray:D,_reset:zt,_resetDefaultValues:()=>Jn(t.defaultValues)&&t.defaultValues().then(A=>{Dr(A,t.resetOptions),E.state.next({isLoading:!1})}),_removeUnmounted:re,_disableForm:br,_subjects:E,_proxyFormState:w,get _fields(){return i},get _formValues(){return l},get _state(){return u},set _state(A){u=A},get _defaultValues(){return o},get _names(){return d},set _names(A){d=A},get _formState(){return r},get _options(){return t},set _options(A){t={...t,...A},v=tu(t.mode),b=tu(t.reValidateMode)}},subscribe:mn,trigger:we,register:At,handleSubmit:Rt,watch:Je,setValue:K,setValues:fe,getValues:Me,reset:Dr,resetField:Vn,resetDefaultValues:(A,P={})=>{if(o=Dt(A),!P.keepDirty){const F=wi(o,l,void 0,i);r.dirtyFields=F,r.isDirty=!an(F)}P.keepIsValid||N(),E.state.next({...r,defaultValues:o})},clearErrors:He,unregister:Xt,setError:ct,setFocus:ar,getFieldState:Fe};return{...Jt,formControl:Jt}}function sg(e={}){const t=ve.useRef(void 0),r=ve.useRef(void 0),i=ve.useRef(e.formControl),[o,l]=ve.useState(()=>({...Dt(oC),isLoading:Jn(e.defaultValues),errors:e.errors||{},disabled:e.disabled||!1,defaultValues:Jn(e.defaultValues)?void 0:e.defaultValues}));if(!t.current||e.formControl&&i.current!==e.formControl)if(i.current=e.formControl,e.formControl)t.current={...e.formControl,formState:o},e.defaultValues&&!Jn(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:d,...m}=Y4(e);t.current={...m,formState:o}}const u=t.current.control;return u._options=e,k4(()=>{const d=u._subscribe({formState:u._proxyFormState,callback:()=>l({...u._formState,defaultValues:u._defaultValues}),reRenderRoot:!0});return l(m=>({...m,isReady:!0})),u._formState.isReady=!0,d},[u]),ve.useEffect(()=>u._disableForm(e.disabled),[u,e.disabled]),ve.useEffect(()=>{e.mode&&(u._options.mode=e.mode),e.reValidateMode&&(u._options.reValidateMode=e.reValidateMode)},[u,e.mode,e.reValidateMode]),ve.useEffect(()=>{e.errors&&(u._setErrors(e.errors),u._focusError())},[u,e.errors]),ve.useEffect(()=>{e.shouldUnregister&&u._subjects.state.next({values:u._getWatch()})},[u,e.shouldUnregister]),ve.useEffect(()=>{if(u._proxyFormState.isDirty){const d=u._getDirty();d!==o.isDirty&&u._subjects.state.next({isDirty:d})}},[u,o.isDirty]),ve.useEffect(()=>{var d;e.values&&!jr(e.values,r.current)?(u._reset(e.values,{keepFieldsRef:!0,...u._options.resetOptions}),!((d=u._options.resetOptions)===null||d===void 0)&&d.keepIsValid||u._setValid(),r.current=e.values,l(m=>({...m}))):u._resetDefaultValues()},[u,e.values]),ve.useEffect(()=>{u._state.mount||(u._setValid(),u._state.mount=!0),u._state.watch&&(u._state.watch=!1,u._subjects.state.next({...u._formState})),u._removeUnmounted()}),t.current.formState=ve.useMemo(()=>D4(o,u),[u,o]),t.current}const Mx=(e,t,r)=>{if(e&&"reportValidity"in e){const i=_e(r,t);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},Gm=(e,t)=>{for(const r in t.fields){const i=t.fields[r];i&&i.ref&&"reportValidity"in i.ref?Mx(i.ref,r,e):i&&i.refs&&i.refs.forEach(o=>Mx(o,r,e))}},Nx=(e,t)=>{t.shouldUseNativeValidation&&Gm(e,t);const r={};for(const i in e){const o=_e(t.fields,i),l=Object.assign(e[i]||{},{ref:o&&o.ref});if(Q4(t.names||Object.keys(e),i)){const u=Object.assign({},_e(r,i));mt(u,"root",l),mt(r,i,u)}else mt(r,i,l)}return r},Q4=(e,t)=>{const r=Dx(t).replace(/[.*+?^${}()|\\]/g,"\\$&");return e.some(i=>Dx(i).match(`^${r}\\.\\d+`))};function Dx(e){return e.replace(/[\[\]]/g,"")}var kx;function me(e,t,r){function i(d,m){if(d._zod||Object.defineProperty(d,"_zod",{value:{def:m,constr:u,traits:new Set},enumerable:!1}),d._zod.traits.has(e))return;d._zod.traits.add(e),t(d,m);const p=u.prototype,y=Object.keys(p);for(let v=0;vr?.Parent&&d instanceof r.Parent?!0:d?._zod?.traits?.has(e)}),Object.defineProperty(u,"name",{value:e}),u}class Fs extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class lC extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(kx=globalThis).__zod_globalConfig??(kx.__zod_globalConfig={});const og=globalThis.__zod_globalConfig;function Oi(e){return og}function cC(e){const t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,o])=>t.indexOf(+i)===-1).map(([i,o])=>o)}function Zm(e,t){return typeof t=="bigint"?t.toString():t}function lg(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function cg(e){return e==null}function ug(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}const zx=Symbol("evaluating");function pt(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==zx)return i===void 0&&(i=zx,i=r()),i},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function Pi(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Wa(...e){const t={};for(const r of e){const i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function Lx(e){return JSON.stringify(e)}function X4(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const uC="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ru(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const J4=lg(()=>{if(og.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function ml(e){if(Ru(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Ru(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function dC(e){return ml(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const W4=new Set(["string","number","symbol"]);function ad(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ei(e,t,r){const i=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(i._zod.parent=e),i}function Ie(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function e5(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function t5(e,t){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const l=Wa(e._zod.def,{get shape(){const u={};for(const d in t){if(!(d in r.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&(u[d]=r.shape[d])}return Pi(this,"shape",u),u},checks:[]});return ei(e,l)}function n5(e,t){const r=e._zod.def,i=r.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const l=Wa(e._zod.def,{get shape(){const u={...e._zod.def.shape};for(const d in t){if(!(d in r.shape))throw new Error(`Unrecognized key: "${d}"`);t[d]&&delete u[d]}return Pi(this,"shape",u),u},checks:[]});return ei(e,l)}function r5(e,t){if(!ml(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const l=e._zod.def.shape;for(const u in t)if(Object.getOwnPropertyDescriptor(l,u)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=Wa(e._zod.def,{get shape(){const l={...e._zod.def.shape,...t};return Pi(this,"shape",l),l}});return ei(e,o)}function a5(e,t){if(!ml(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r=Wa(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return Pi(this,"shape",i),i}});return ei(e,r)}function i5(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r=Wa(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t._zod.def.shape};return Pi(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return ei(e,r)}function s5(e,t,r){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const u=Wa(t._zod.def,{get shape(){const d=t._zod.def.shape,m={...d};if(r)for(const p in r){if(!(p in d))throw new Error(`Unrecognized key: "${p}"`);r[p]&&(m[p]=e?new e({type:"optional",innerType:d[p]}):d[p])}else for(const p in d)m[p]=e?new e({type:"optional",innerType:d[p]}):d[p];return Pi(this,"shape",m),m},checks:[]});return ei(t,u)}function o5(e,t,r){const i=Wa(t._zod.def,{get shape(){const o=t._zod.def.shape,l={...o};if(r)for(const u in r){if(!(u in l))throw new Error(`Unrecognized key: "${u}"`);r[u]&&(l[u]=new e({type:"nonoptional",innerType:o[u]}))}else for(const u in o)l[u]=new e({type:"nonoptional",innerType:o[u]});return Pi(this,"shape",l),l}});return ei(t,i)}function zs(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r{var i;return(i=r).path??(i.path=[]),r.path.unshift(e),r})}function nu(e){return typeof e=="string"?e:e?.message}function Ai(e,t,r){const i=e.message?e.message:nu(e.inst?._zod.def?.error?.(e))??nu(t?.error?.(e))??nu(r.customError?.(e))??nu(r.localeError?.(e))??"Invalid input",{inst:o,continue:l,input:u,...d}=e;return d.path??(d.path=[]),d.message=i,t?.reportInput&&(d.input=u),d}function dg(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function pl(...e){const[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}const hC=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Zm,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},fg=me("$ZodError",hC),id=me("$ZodError",hC,{Parent:Error});function c5(e,t=r=>r.message){const r={},i=[];for(const o of e.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):i.push(t(o));return{formErrors:i,fieldErrors:r}}function u5(e,t=r=>r.message){const r={_errors:[]},i=(o,l=[])=>{for(const u of o.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>i({issues:d},[...l,...u.path]));else if(u.code==="invalid_key")i({issues:u.issues},[...l,...u.path]);else if(u.code==="invalid_element")i({issues:u.issues},[...l,...u.path]);else{const d=[...l,...u.path];if(d.length===0)r._errors.push(t(u));else{let m=r,p=0;for(;p(t,r,i,o)=>{const l=i?{...i,async:!1}:{async:!1},u=t._zod.run({value:r,issues:[]},l);if(u instanceof Promise)throw new Fs;if(u.issues.length){const d=new(o?.Err??e)(u.issues.map(m=>Ai(m,l,Oi())));throw uC(d,o?.callee),d}return u.value},d5=sd(id),od=e=>async(t,r,i,o)=>{const l=i?{...i,async:!0}:{async:!0};let u=t._zod.run({value:r,issues:[]},l);if(u instanceof Promise&&(u=await u),u.issues.length){const d=new(o?.Err??e)(u.issues.map(m=>Ai(m,l,Oi())));throw uC(d,o?.callee),d}return u.value},f5=od(id),ld=e=>(t,r,i)=>{const o=i?{...i,async:!1}:{async:!1},l=t._zod.run({value:r,issues:[]},o);if(l instanceof Promise)throw new Fs;return l.issues.length?{success:!1,error:new(e??fg)(l.issues.map(u=>Ai(u,o,Oi())))}:{success:!0,data:l.value}},h5=ld(id),cd=e=>async(t,r,i)=>{const o=i?{...i,async:!0}:{async:!0};let l=t._zod.run({value:r,issues:[]},o);return l instanceof Promise&&(l=await l),l.issues.length?{success:!1,error:new e(l.issues.map(u=>Ai(u,o,Oi())))}:{success:!0,data:l.value}},m5=cd(id),p5=e=>(t,r,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return sd(e)(t,r,o)},g5=e=>(t,r,i)=>sd(e)(t,r,i),v5=e=>async(t,r,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return od(e)(t,r,o)},y5=e=>async(t,r,i)=>od(e)(t,r,i),b5=e=>(t,r,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return ld(e)(t,r,o)},x5=e=>(t,r,i)=>ld(e)(t,r,i),w5=e=>async(t,r,i)=>{const o=i?{...i,direction:"backward"}:{direction:"backward"};return cd(e)(t,r,o)},S5=e=>async(t,r,i)=>cd(e)(t,r,i),_5=/^[cC][0-9a-z]{6,}$/,C5=/^[0-9a-z]+$/,E5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,R5=/^[0-9a-vA-V]{20}$/,j5=/^[A-Za-z0-9]{27}$/,T5=/^[a-zA-Z0-9_-]{21}$/,O5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,A5=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,$x=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,M5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,N5="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function D5(){return new RegExp(N5,"u")}const k5=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,z5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,L5=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,$5=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,I5=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,mC=/^[A-Za-z0-9_-]*$/,P5=/^https?$/,F5=/^\+[1-9]\d{6,14}$/,pC="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",V5=new RegExp(`^${pC}$`);function gC(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function U5(e){return new RegExp(`^${gC(e)}$`)}function H5(e){const t=gC({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${r.join("|")})`;return new RegExp(`^${pC}T(?:${i})$`)}const B5=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},q5=/^(?:true|false)$/i,G5=/^[^A-Z]*$/,Z5=/^[^a-z]*$/,Nr=me("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),K5=me("$ZodCheckMaxLength",(e,t)=>{var r;Nr.init(e,t),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!cg(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const o=i.value;if(o.length<=t.maximum)return;const u=dg(o);i.issues.push({origin:u,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Y5=me("$ZodCheckMinLength",(e,t)=>{var r;Nr.init(e,t),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!cg(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{const o=i.value;if(o.length>=t.minimum)return;const u=dg(o);i.issues.push({origin:u,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Q5=me("$ZodCheckLengthEquals",(e,t)=>{var r;Nr.init(e,t),(r=e._zod.def).when??(r.when=i=>{const o=i.value;return!cg(o)&&o.length!==void 0}),e._zod.onattach.push(i=>{const o=i._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=i=>{const o=i.value,l=o.length;if(l===t.length)return;const u=dg(o),d=l>t.length;i.issues.push({origin:u,...d?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),ud=me("$ZodCheckStringFormat",(e,t)=>{var r,i;Nr.init(e,t),e._zod.onattach.push(o=>{const l=o._zod.bag;l.format=t.format,t.pattern&&(l.patterns??(l.patterns=new Set),l.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),X5=me("$ZodCheckRegex",(e,t)=>{ud.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),J5=me("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=G5),ud.init(e,t)}),W5=me("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Z5),ud.init(e,t)}),e6=me("$ZodCheckIncludes",(e,t)=>{Nr.init(e,t);const r=ad(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=i,e._zod.onattach.push(o=>{const l=o._zod.bag;l.patterns??(l.patterns=new Set),l.patterns.add(i)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),t6=me("$ZodCheckStartsWith",(e,t)=>{Nr.init(e,t);const r=new RegExp(`^${ad(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=i=>{i.value.startsWith(t.prefix)||i.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:i.value,inst:e,continue:!t.abort})}}),n6=me("$ZodCheckEndsWith",(e,t)=>{Nr.init(e,t);const r=new RegExp(`.*${ad(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(r)}),e._zod.check=i=>{i.value.endsWith(t.suffix)||i.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:i.value,inst:e,continue:!t.abort})}}),r6=me("$ZodCheckOverwrite",(e,t)=>{Nr.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class a6{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const i=t.split(` `).filter(u=>u),o=Math.min(...i.map(u=>u.length-u.trimStart().length)),l=i.map(u=>u.slice(o)).map(u=>" ".repeat(this.indent*2)+u);for(const u of l)this.content.push(u)}compile(){const t=Function,r=this?.args,o=[...(this?.content??[""]).map(l=>` ${l}`)];return new t(...r,o.join(` -`))}}const i6={major:4,minor:4,patch:3},Vt=me("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=i6;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const o of i)for(const l of o._zod.onattach)l(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(u,d,m)=>{let p=zs(u),y;for(const v of d){if(v._zod.def.when){if(l5(u)||!v._zod.def.when(u))continue}else if(p)continue;const b=u.issues.length,x=v._zod.check(u);if(x instanceof Promise&&m?.async===!1)throw new Fs;if(y||x instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await x,u.issues.length!==b&&(p||(p=zs(u,b)))});else{if(u.issues.length===b)continue;p||(p=zs(u,b))}}return y?y.then(()=>u):u},l=(u,d,m)=>{if(zs(u))return u.aborted=!0,u;const p=o(d,i,m);if(p instanceof Promise){if(m.async===!1)throw new Fs;return p.then(y=>e._zod.parse(y,m))}return e._zod.parse(p,m)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const p=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return p instanceof Promise?p.then(y=>l(y,u,d)):l(p,u,d)}const m=e._zod.parse(u,d);if(m instanceof Promise){if(d.async===!1)throw new Fs;return m.then(p=>o(p,i,d))}return o(m,i,d)}}pt(e,"~standard",()=>({validate:o=>{try{const l=h5(e,o);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return m5(e,o).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),hg=me("$ZodString",(e,t)=>{Vt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??B5(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),St=me("$ZodStringFormat",(e,t)=>{ud.init(e,t),hg.init(e,t)}),s6=me("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=A5),St.init(e,t)}),o6=me("$ZodUUID",(e,t)=>{if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=$x(i))}else t.pattern??(t.pattern=$x());St.init(e,t)}),l6=me("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=M5),St.init(e,t)}),c6=me("$ZodURL",(e,t)=>{St.init(e,t),e._zod.check=r=>{try{const i=r.value.trim();if(!t.normalize&&t.protocol?.source===P5.source&&!/^https?:\/\//i.test(i)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}const o=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),u6=me("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=D5()),St.init(e,t)}),d6=me("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=T5),St.init(e,t)}),f6=me("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=_5),St.init(e,t)}),h6=me("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=C5),St.init(e,t)}),m6=me("$ZodULID",(e,t)=>{t.pattern??(t.pattern=E5),St.init(e,t)}),p6=me("$ZodXID",(e,t)=>{t.pattern??(t.pattern=R5),St.init(e,t)}),g6=me("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=j5),St.init(e,t)}),v6=me("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=H5(t)),St.init(e,t)}),y6=me("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=V5),St.init(e,t)}),b6=me("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=U5(t)),St.init(e,t)}),x6=me("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=O5),St.init(e,t)}),w6=me("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=k5),St.init(e,t),e._zod.bag.format="ipv4"}),S6=me("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=z5),St.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),_6=me("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=L5),St.init(e,t)}),C6=me("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=$5),St.init(e,t),e._zod.check=r=>{const i=r.value.split("/");try{if(i.length!==2)throw new Error;const[o,l]=i;if(!l)throw new Error;const u=Number(l);if(`${u}`!==l)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function vC(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const E6=me("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=I5),St.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{vC(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function R6(e){if(!mC.test(e))return!1;const t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return vC(r)}const j6=me("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=mC),St.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{R6(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),T6=me("$ZodE164",(e,t)=>{t.pattern??(t.pattern=F5),St.init(e,t)});function O6(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[i]=r;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const A6=me("$ZodJWT",(e,t)=>{St.init(e,t),e._zod.check=r=>{O6(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),M6=me("$ZodBoolean",(e,t)=>{Vt.init(e,t),e._zod.pattern=q5,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),N6=me("$ZodUnknown",(e,t)=>{Vt.init(e,t),e._zod.parse=r=>r}),D6=me("$ZodNever",(e,t)=>{Vt.init(e,t),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Ix(e,t,r){e.issues.length&&t.issues.push(...fC(r,e.issues)),t.value[r]=e.value}const k6=me("$ZodArray",(e,t)=>{Vt.init(e,t),e._zod.parse=(r,i)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const l=[];for(let u=0;uIx(p,r,u))):Ix(m,r,u)}return l.length?Promise.all(l).then(()=>r):r}});function ju(e,t,r,i,o,l){const u=r in i;if(e.issues.length){if(o&&l&&!u)return;t.issues.push(...fC(r,e.issues))}if(!u&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?u&&(t.value[r]=void 0):t.value[r]=e.value}function yC(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const r=e5(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function bC(e,t,r,i,o,l){const u=[],d=o.keySet,m=o.catchall._zod,p=m.def.type,y=m.optin==="optional",v=m.optout==="optional";for(const b in t){if(b==="__proto__"||d.has(b))continue;if(p==="never"){u.push(b);continue}const x=m.run({value:t[b],issues:[]},i);x instanceof Promise?e.push(x.then(w=>ju(w,r,b,t,y,v))):ju(x,r,b,t,y,v)}return u.length&&r.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:l}),e.length?Promise.all(e).then(()=>r):r}const z6=me("$ZodObject",(e,t)=>{if(Vt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...d};return Object.defineProperty(t,"shape",{value:m}),m}})}const i=lg(()=>yC(t));pt(e._zod,"propValues",()=>{const d=t.shape,m={};for(const p in d){const y=d[p]._zod;if(y.values){m[p]??(m[p]=new Set);for(const v of y.values)m[p].add(v)}}return m});const o=Ru,l=t.catchall;let u;e._zod.parse=(d,m)=>{u??(u=i.value);const p=d.value;if(!o(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d;d.value={};const y=[],v=u.shape;for(const b of u.keys){const x=v[b],w=x._zod.optin==="optional",_=x._zod.optout==="optional",E=x._zod.run({value:p[b],issues:[]},m);E instanceof Promise?y.push(E.then(R=>ju(R,d,b,p,w,_))):ju(E,d,b,p,w,_)}return l?bC(y,p,d,m,i.value,e):y.length?Promise.all(y).then(()=>d):d}}),L6=me("$ZodObjectJIT",(e,t)=>{z6.init(e,t);const r=e._zod.parse,i=lg(()=>yC(t)),o=b=>{const x=new a6(["shape","payload","ctx"]),w=i.value,_=O=>{const N=Lx(O);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};x.write("const input = payload.value;");const E=Object.create(null);let R=0;for(const O of w.keys)E[O]=`key_${R++}`;x.write("const newResult = {};");for(const O of w.keys){const N=E[O],k=Lx(O),B=b[O],H=B?._zod?.optin==="optional",$=B?._zod?.optout==="optional";x.write(`const ${N} = ${_(O)};`),H&&$?x.write(` +`))}}const i6={major:4,minor:4,patch:3},Vt=me("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=i6;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const o of i)for(const l of o._zod.onattach)l(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=(u,d,m)=>{let p=zs(u),y;for(const v of d){if(v._zod.def.when){if(l5(u)||!v._zod.def.when(u))continue}else if(p)continue;const b=u.issues.length,x=v._zod.check(u);if(x instanceof Promise&&m?.async===!1)throw new Fs;if(y||x instanceof Promise)y=(y??Promise.resolve()).then(async()=>{await x,u.issues.length!==b&&(p||(p=zs(u,b)))});else{if(u.issues.length===b)continue;p||(p=zs(u,b))}}return y?y.then(()=>u):u},l=(u,d,m)=>{if(zs(u))return u.aborted=!0,u;const p=o(d,i,m);if(p instanceof Promise){if(m.async===!1)throw new Fs;return p.then(y=>e._zod.parse(y,m))}return e._zod.parse(p,m)};e._zod.run=(u,d)=>{if(d.skipChecks)return e._zod.parse(u,d);if(d.direction==="backward"){const p=e._zod.parse({value:u.value,issues:[]},{...d,skipChecks:!0});return p instanceof Promise?p.then(y=>l(y,u,d)):l(p,u,d)}const m=e._zod.parse(u,d);if(m instanceof Promise){if(d.async===!1)throw new Fs;return m.then(p=>o(p,i,d))}return o(m,i,d)}}pt(e,"~standard",()=>({validate:o=>{try{const l=h5(e,o);return l.success?{value:l.data}:{issues:l.error?.issues}}catch{return m5(e,o).then(u=>u.success?{value:u.data}:{issues:u.error?.issues})}},vendor:"zod",version:1}))}),hg=me("$ZodString",(e,t)=>{Vt.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??B5(e._zod.bag),e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),St=me("$ZodStringFormat",(e,t)=>{ud.init(e,t),hg.init(e,t)}),s6=me("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=A5),St.init(e,t)}),o6=me("$ZodUUID",(e,t)=>{if(t.version){const i={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(i===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=$x(i))}else t.pattern??(t.pattern=$x());St.init(e,t)}),l6=me("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=M5),St.init(e,t)}),c6=me("$ZodURL",(e,t)=>{St.init(e,t),e._zod.check=r=>{try{const i=r.value.trim();if(!t.normalize&&t.protocol?.source===P5.source&&!/^https?:\/\//i.test(i)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}const o=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=o.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),u6=me("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=D5()),St.init(e,t)}),d6=me("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=T5),St.init(e,t)}),f6=me("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=_5),St.init(e,t)}),h6=me("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=C5),St.init(e,t)}),m6=me("$ZodULID",(e,t)=>{t.pattern??(t.pattern=E5),St.init(e,t)}),p6=me("$ZodXID",(e,t)=>{t.pattern??(t.pattern=R5),St.init(e,t)}),g6=me("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=j5),St.init(e,t)}),v6=me("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=H5(t)),St.init(e,t)}),y6=me("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=V5),St.init(e,t)}),b6=me("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=U5(t)),St.init(e,t)}),x6=me("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=O5),St.init(e,t)}),w6=me("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=k5),St.init(e,t),e._zod.bag.format="ipv4"}),S6=me("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=z5),St.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),_6=me("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=L5),St.init(e,t)}),C6=me("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=$5),St.init(e,t),e._zod.check=r=>{const i=r.value.split("/");try{if(i.length!==2)throw new Error;const[o,l]=i;if(!l)throw new Error;const u=Number(l);if(`${u}`!==l)throw new Error;if(u<0||u>128)throw new Error;new URL(`http://[${o}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function vC(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const E6=me("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=I5),St.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{vC(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function R6(e){if(!mC.test(e))return!1;const t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return vC(r)}const j6=me("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=mC),St.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{R6(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),T6=me("$ZodE164",(e,t)=>{t.pattern??(t.pattern=F5),St.init(e,t)});function O6(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[i]=r;if(!i)return!1;const o=JSON.parse(atob(i));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const A6=me("$ZodJWT",(e,t)=>{St.init(e,t),e._zod.check=r=>{O6(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),M6=me("$ZodBoolean",(e,t)=>{Vt.init(e,t),e._zod.pattern=q5,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=!!r.value}catch{}const o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}}),N6=me("$ZodUnknown",(e,t)=>{Vt.init(e,t),e._zod.parse=r=>r}),D6=me("$ZodNever",(e,t)=>{Vt.init(e,t),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function Ix(e,t,r){e.issues.length&&t.issues.push(...fC(r,e.issues)),t.value[r]=e.value}const k6=me("$ZodArray",(e,t)=>{Vt.init(e,t),e._zod.parse=(r,i)=>{const o=r.value;if(!Array.isArray(o))return r.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),r;r.value=Array(o.length);const l=[];for(let u=0;uIx(p,r,u))):Ix(m,r,u)}return l.length?Promise.all(l).then(()=>r):r}});function ju(e,t,r,i,o,l){const u=r in i;if(e.issues.length){if(o&&l&&!u)return;t.issues.push(...fC(r,e.issues))}if(!u&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?u&&(t.value[r]=void 0):t.value[r]=e.value}function yC(e){const t=Object.keys(e.shape);for(const i of t)if(!e.shape?.[i]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${i}": expected a Zod schema`);const r=e5(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function bC(e,t,r,i,o,l){const u=[],d=o.keySet,m=o.catchall._zod,p=m.def.type,y=m.optin==="optional",v=m.optout==="optional";for(const b in t){if(b==="__proto__"||d.has(b))continue;if(p==="never"){u.push(b);continue}const x=m.run({value:t[b],issues:[]},i);x instanceof Promise?e.push(x.then(w=>ju(w,r,b,t,y,v))):ju(x,r,b,t,y,v)}return u.length&&r.issues.push({code:"unrecognized_keys",keys:u,input:t,inst:l}),e.length?Promise.all(e).then(()=>r):r}const z6=me("$ZodObject",(e,t)=>{if(Vt.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const d=t.shape;Object.defineProperty(t,"shape",{get:()=>{const m={...d};return Object.defineProperty(t,"shape",{value:m}),m}})}const i=lg(()=>yC(t));pt(e._zod,"propValues",()=>{const d=t.shape,m={};for(const p in d){const y=d[p]._zod;if(y.values){m[p]??(m[p]=new Set);for(const v of y.values)m[p].add(v)}}return m});const o=Ru,l=t.catchall;let u;e._zod.parse=(d,m)=>{u??(u=i.value);const p=d.value;if(!o(p))return d.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),d;d.value={};const y=[],v=u.shape;for(const b of u.keys){const x=v[b],w=x._zod.optin==="optional",_=x._zod.optout==="optional",E=x._zod.run({value:p[b],issues:[]},m);E instanceof Promise?y.push(E.then(R=>ju(R,d,b,p,w,_))):ju(E,d,b,p,w,_)}return l?bC(y,p,d,m,i.value,e):y.length?Promise.all(y).then(()=>d):d}}),L6=me("$ZodObjectJIT",(e,t)=>{z6.init(e,t);const r=e._zod.parse,i=lg(()=>yC(t)),o=b=>{const x=new a6(["shape","payload","ctx"]),w=i.value,_=O=>{const N=Lx(O);return`shape[${N}]._zod.run({ value: input[${N}], issues: [] }, ctx)`};x.write("const input = payload.value;");const E=Object.create(null);let R=0;for(const O of w.keys)E[O]=`key_${R++}`;x.write("const newResult = {};");for(const O of w.keys){const N=E[O],z=Lx(O),B=b[O],H=B?._zod?.optin==="optional",I=B?._zod?.optout==="optional";x.write(`const ${N} = ${_(O)};`),H&&I?x.write(` if (${N}.issues.length) { - if (${k} in input) { + if (${z} in input) { payload.issues = payload.issues.concat(${N}.issues.map(iss => ({ ...iss, - path: iss.path ? [${k}, ...iss.path] : [${k}] + path: iss.path ? [${z}, ...iss.path] : [${z}] }))); } } if (${N}.value === undefined) { - if (${k} in input) { - newResult[${k}] = undefined; + if (${z} in input) { + newResult[${z}] = undefined; } } else { - newResult[${k}] = ${N}.value; + newResult[${z}] = ${N}.value; } `):H?x.write(` if (${N}.issues.length) { payload.issues = payload.issues.concat(${N}.issues.map(iss => ({ ...iss, - path: iss.path ? [${k}, ...iss.path] : [${k}] + path: iss.path ? [${z}, ...iss.path] : [${z}] }))); } if (${N}.value === undefined) { - if (${k} in input) { - newResult[${k}] = undefined; + if (${z} in input) { + newResult[${z}] = undefined; } } else { - newResult[${k}] = ${N}.value; + newResult[${z}] = ${N}.value; } `):x.write(` - const ${N}_present = ${k} in input; + const ${N}_present = ${z} in input; if (${N}.issues.length) { payload.issues = payload.issues.concat(${N}.issues.map(iss => ({ ...iss, - path: iss.path ? [${k}, ...iss.path] : [${k}] + path: iss.path ? [${z}, ...iss.path] : [${z}] }))); } if (!${N}_present && !${N}.issues.length) { @@ -98,15 +98,15 @@ Error generating stack: `+c.message+` code: "invalid_type", expected: "nonoptional", input: undefined, - path: [${k}] + path: [${z}] }); } if (${N}_present) { if (${N}.value === undefined) { - newResult[${k}] = undefined; + newResult[${z}] = undefined; } else { - newResult[${k}] = ${N}.value; + newResult[${z}] = ${N}.value; } } @@ -116,7 +116,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs. to set up BearDrive project `+e.id+" on "+r+i+e.name+'").',l=`brew install runbear-io/tap/beardrive bdrive login `+r+` bdrive init --project `+e.id;return f.jsxs("div",{className:"guide",children:[f.jsxs("h1",{className:"in-title gd-head",children:[f.jsx("span",{className:"proj-mark","aria-hidden":"true",style:{background:gl(e.name)},children:f.jsx(Ps,{name:e.icon})}),e.name]}),e.description&&f.jsx("p",{className:"in-desc",children:e.description}),f.jsxs("div",{className:"gd-body",children:[f.jsx("p",{className:"gd-desc",children:t?"Paste into your coding agent — Claude Code, Cowork, Codex, Gemini CLI, Hermes — in the folder you already have:":"Paste into your coding agent — Claude Code, Cowork, Codex, Gemini CLI, Hermes — in the folder where you want the files:"}),t&&f.jsx("p",{className:"gd-note",children:"Your files stay exactly where they are. Connecting a folder never moves, renames or overwrites anything in it — it uploads what is there and keeps it in sync."}),f.jsx(Wm,{code:o}),f.jsx("p",{className:"gd-desc",children:"The agent installs the CLI, signs this machine in, and registers the sync hooks — asking before anything it changes."}),f.jsx("p",{className:"gd-desc",children:"Runs on macOS and Linux. Windows is not supported yet."}),f.jsxs("details",{className:"gd-manual",children:[f.jsx("summary",{children:"What exactly happens"}),f.jsxs("ul",{className:"gd-desc gd-list",children:[f.jsx("li",{children:"Sign-in uses a device code you approve in this browser — the folder itself never holds credentials."}),f.jsx("li",{children:"Sync hooks pull the latest before every agent turn, push edits seconds after they happen, and stamp each change with the session that made it; agent reads feed Insights. They register once per machine in your agent's own config, so every session is covered and nothing is written into the synced folder."}),f.jsx("li",{children:"Codex hooks are off by default: set [features] codex_hooks = true in ~/.codex/config.toml."})]})]}),f.jsxs("details",{className:"gd-manual",children:[f.jsx("summary",{children:"Or run it yourself"}),f.jsx("p",{className:"gd-desc",children:"Same result, in the folder you want the files. One command: init signs this device in, registers the sync hooks and starts syncing."}),f.jsx(Wm,{code:l}),f.jsx("p",{className:"gd-desc",children:f.jsx("a",{href:"https://docs.beardrive.ai/manual/install/",target:"_blank",rel:"noreferrer",children:"Full manual setup guide →"})})]})]})]})}function Wm({code:e}){const[t,r]=S.useState("Copy");return f.jsxs("pre",{className:"gd-code",children:[f.jsx("code",{children:e}),f.jsx("button",{className:"gd-copy",onClick:async()=>{r(await Mi(e)?"Copied":"Copy failed"),setTimeout(()=>r("Copy"),1400)},children:t})]})}function sI({onNew:e,canCreate:t}){return f.jsxs("div",{className:"onboard",children:[f.jsx("h1",{children:"Welcome to BearDrive"}),f.jsx("p",{children:"You're signed in, but you're not part of any project yet."}),t&&f.jsxs("div",{className:"ob-card ob-start",children:[f.jsx("h3",{children:"Start a project"}),f.jsx("p",{children:"Name it and pick what it starts from — a structure, or nothing at all. Then connect a folder on any machine and it stays in sync."}),f.jsx(xt,{variant:"primary",id:"ob-new",onClick:e,children:"New project"})]}),f.jsxs("div",{className:"ob-card ob-agent",children:[f.jsx("h3",{children:t?"Or let your agent do it":"Connect a new drive to your project"}),f.jsx("p",{children:"Paste into your coding agent — Claude Code, Cowork, Codex, Gemini CLI, Hermes — in the folder where you want the files. It creates the project and starts syncing:"}),f.jsx(Wm,{code:"Follow "+HC+` -to set up a new BearDrive project on `+window.location.origin+". Ask me which folder to sync."}),f.jsx("p",{className:"ob-alt",children:f.jsx("a",{href:"https://docs.beardrive.ai/manual/setup-by-hand/",target:"_blank",rel:"noreferrer",children:"Or start a project manually →"})})]})]})}const qC="__existing__";function oI({templates:e,onCreate:t,onClose:r}){const i=[...e.map(x=>({value:x.name,title:x.title,blurb:x.blurb,rule:!1})),{value:qC,title:"I already have a folder",blurb:"nothing is seeded — connect it and your files stay as they are",rule:!0},{value:"",title:"Empty project",blurb:"just the folder",rule:!1}],[o,l]=S.useState(""),[u,d]=S.useState(i[0].value),[m,p]=S.useState(""),[y,v]=S.useState(!1),b=async()=>{if(!y){if(!o.trim()){p("Give it a name.");return}v(!0);try{await t(o.trim(),u)}finally{v(!1)}}};return f.jsx(Wu,{open:!0,onOpenChange:x=>!x&&r(),children:f.jsxs(ed,{className:"modal",showCloseButton:!1,children:[f.jsx(Cl,{asChild:!0,children:f.jsx("h3",{children:"New project"})}),f.jsx("label",{className:"modal-label",htmlFor:"modal-input",children:"Name"}),f.jsx("input",{className:"modal-input",type:"text",autoComplete:"off",id:"modal-input",autoFocus:!0,value:o,"aria-invalid":!!m,"aria-describedby":m?"modal-input-err":void 0,onChange:x=>{l(x.currentTarget.value),m&&p("")},onKeyDown:x=>x.key==="Enter"&&b()}),m&&f.jsx("span",{id:"modal-input-err",role:"alert",className:"field-err",children:m}),i.length>1&&f.jsxs("fieldset",{className:"start-points",children:[f.jsx("legend",{className:"modal-label",children:"Starting point"}),i.map((x,w)=>f.jsxs("label",{className:"start-point"+(u===x.value?" on":"")+(x.rule?" sp-rule":""),children:[f.jsx("input",{type:"radio",name:"template",value:x.value,checked:u===x.value,onChange:()=>d(x.value)}),f.jsxs("span",{className:"sp-text",children:[f.jsxs("span",{className:"sp-title",children:[x.title,w===0&&f.jsx("span",{className:"sp-rec",children:"Recommended"})]}),f.jsx("span",{className:"sp-blurb",children:x.blurb})]})]},x.value))]}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(xt,{variant:"subtle",onClick:r,children:"Cancel"}),f.jsx(xt,{variant:"primary",onClick:b,disabled:y,children:"Create"})]})]})})}function am(e,t,r){if(!e)return null;if(!r)return e[t]||null;const i={human:0,agent:0,share:0};for(const[o,l]of Object.entries(e))o.startsWith(t+"/")&&(i.human+=l.human||0,i.agent+=l.agent||0,i.share+=l.share||0);return i.human||i.agent||i.share?i:null}function na(e){return(e.human||0)+(e.agent||0)+(e.share||0)}function el(e){const t=na(e);if(!t)return"";const r=t+(t===1?" read":" reads");if(!e.agent&&!e.share)return r;const i=[];return e.human&&i.push(e.human+" human"),e.agent&&i.push(e.agent+" agent"),e.share&&i.push(e.share+" shared"),r+" ("+i.join(", ")+")"}const Ci="Includes your own views. Repeat opens by the same reader inside 10 minutes count once.";function lI(e){const t=na(e);return t?t<3?1:t<10?2:t<30?3:4:0}function cI(e){const t=na(e);return t?{agent:(e.agent||0)/t,human:(e.human||0)/t,share:(e.share||0)/t}:{agent:0,human:0,share:0}}function uI(e,t){return e?Object.keys(e).filter(r=>!t.has(r)).sort():[]}const dI=7;function fI(e){if(!e.length)return null;let t=e[0],r=e[0];for(const i of e)ir&&(r=i);return{min:t,max:r}}const hI=(e,t)=>t-el.reads-o.reads).slice(0,pI)){const o=i.path.split("/").pop();let l=i.cx+i.r+4,u="start";l+o.length*gI>t.right&&(l=i.cx-i.r-4,u="end");const d=p=>r.every(y=>Math.abs(y.y-p)>=im);let m=i.cy;for(;m<=t.bottom&&!d(m);)m+=im;if(m>t.bottom)for(m=i.cy;m>=t.top&&!d(m);)m-=im;r.push({path:i.path,name:o,x:l,y:Math.min(t.bottom,Math.max(t.top,m)),anchor:u})}return r}const tl=3,Ns=30,GC=(e,t)=>e>=tl&&t>=Ns;function yI(e,t=Date.now()){if(!e)return null;const r=new Date(e).getTime();return Number.isFinite(r)?Math.max(0,(t-r)/864e5):null}function bI(e){const t=new Intl.RelativeTimeFormat("en",{numeric:"always"});return e<30?t.format(-Math.round(e),"day"):e<365?t.format(-Math.round(e/30),"month"):t.format(-Math.round(e/365),"year")}function ZC(e,t){const r=yI(t);return!e||r===null||!GC(na(e),r)?"":`stale · last changed ${bI(r)}`}function xI(e,t=!0){const r=Ft({queryKey:["tree",e],queryFn:()=>qt(e+"tree"),enabled:t,refetchInterval:15e3}),i=S.useMemo(()=>{const o=[],l=new Map,u=d=>{for(const m of d.children||[])m.dir?(l.set(m.path,m),u(m)):o.push(m)};return r.data&&u(r.data),{flatFiles:o,dirIndex:l}},[r.data]);return{tree:r.data,...i,loaded:!!r.data}}function wI(e,t){return Ft({queryKey:["heat",e],queryFn:()=>qt(e+"heat?days=30"),enabled:t,staleTime:6e4,refetchInterval:6e4}).data?.entries??null}function SI(e,t,r){return Ft({queryKey:["history",e,"prefix",t,20],queryFn:()=>qt(e+"history?prefix="+encodeURIComponent(t)+"&n=20"),enabled:r,staleTime:15e3}).data?.entries??null}function _I(e,t,r){const i=new Array(e);return new Proxy(i,{get(o,l,u){if(typeof l=="string"){const d=l.charCodeAt(0);if(d>=48&&d<=57){const m=+l;if(Number.isInteger(m)&&m>=0&&mi[y]!==p))&&(i=d,o=t(...d),r?.onChange&&!(l&&r.skipInitialOnChange)&&r.onChange(o),l=!1),o}return u.updateDeps=d=>{i=d},u}function lw(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const CI=(e,t)=>Math.abs(e-t)<1.01,EI=(e,t,r)=>{let i;return function(...o){e.clearTimeout(i),i=e.setTimeout(()=>t.apply(this,o),r)}};let Ko;const sm=()=>{if(Ko!==void 0)return Ko;if(typeof navigator>"u")return Ko=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ko=!0;const e=navigator.maxTouchPoints;return Ko=navigator.platform==="MacIntel"&&e!==void 0&&e>0},cw=e=>{const{offsetWidth:t,offsetHeight:r}=e;return{width:t,height:r}},RI=e=>e,jI=e=>{const t=Math.max(e.startIndex-e.overscan,0),i=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(i);for(let l=0;l{const r=e.scrollElement;if(!r)return;const i=e.targetWindow;if(!i)return;const o=u=>{const{width:d,height:m}=u;t({width:Math.round(d),height:Math.round(m)})};if(o(cw(r)),!i.ResizeObserver)return()=>{};const l=new i.ResizeObserver(u=>{const d=()=>{const m=u[0];if(m?.borderBoxSize){const p=m.borderBoxSize[0];if(p){o({width:p.inlineSize,height:p.blockSize});return}}o(cw(r))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return l.observe(r,{box:"border-box"}),()=>{l.unobserve(r)}},Au={passive:!0},OI=typeof window>"u"?!0:"onscrollend"in window,AI=(e,t,r)=>{const i=e.scrollElement;if(!i)return;const o=e.targetWindow;if(!o)return;const l=e.options.useScrollendEvent&&OI;let u=0;const d=l?null:EI(o,()=>t(u,!1),e.options.isScrollingResetDelay),m=v=>()=>{u=r(i),d?.(),t(u,v)},p=m(!0),y=m(!1);return i.addEventListener("scroll",p,Au),l&&i.addEventListener("scrollend",y,Au),()=>{i.removeEventListener("scroll",p),l&&i.removeEventListener("scrollend",y)}},MI=(e,t)=>AI(e,t,r=>{const{horizontal:i,isRtl:o}=e.options;return i?r.scrollLeft*(o&&-1||1):r.scrollTop}),NI=(e,t,r)=>{if(r.options.useCachedMeasurements){const i=r.indexFromElement(e),o=r.options.getItemKey(i);return r.itemSizeCache.get(o)??r.options.estimateSize(i)}if(t?.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}if(!t){const i=r.indexFromElement(e),o=r.options.getItemKey(i),l=r.itemSizeCache.get(o);if(l!==void 0)return l}return e[r.options.horizontal?"offsetWidth":"offsetHeight"]},DI=(e,{adjustments:t=0,behavior:r},i)=>{var o,l;(l=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||l.call(o,{[i.options.horizontal?"left":"top"]:e+t,behavior:r})},kI=DI;class zI{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,i,o;return((o=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(l=>{const u=()=>{const d=l.target,m=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[p,y]of this.elementsCache)if(y===d){this.elementsCache.delete(p);break}return}this.shouldMeasureDuringScroll(m)&&this.resizeItem(m,this.options.measureElement(d,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(u):u()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var l;return(l=i())==null?void 0:l.observe(o,{box:"border-box"})},unobserve:o=>{var l;return(l=i())==null?void 0:l.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{var i,o;const l={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:RI,rangeExtractor:jI,onChange:()=>{},measureElement:NI,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const b in r){const x=r[b];x!==void 0&&(l[b]=x)}const u=this.options;let d=null,m=null,p=!1;if(u!==void 0&&u.enabled&&l.enabled&&l.anchorTo==="end"&&this.scrollElement!==null){const b=u.count,x=l.count,w=this.getMeasurements(),_=b>0?((i=w[0])==null?void 0:i.key)??u.getItemKey(0):null,E=b>0?((o=w[b-1])==null?void 0:o.key)??u.getItemKey(b-1):null;if(x!==b||b>0&&x>0&&(l.getItemKey(0)!==_||l.getItemKey(x-1)!==E)){p=!0;const O=b>0?this.getVirtualItemForOffset(this.getScrollOffset())??w[0]:null;O&&(d=[O.key,this.getScrollOffset()-O.start]);const N=l.followOnAppend===!0?"auto":l.followOnAppend||null;N&&x>b&&this.isAtEnd(u.scrollEndThreshold)&&(b===0||l.getItemKey(x-1)!==E)&&(m=N)}}this.options=l,p&&(this.pendingMin=0,this.itemSizeCacheVersion++);let y=!1,v=0;if(d&&this.scrollOffset!==null){const[b,x]=d,w=this.getMeasurements(),{count:_,getItemKey:E}=this.options;let R=0;for(;R<_&&E(R)!==b;)R++;if(R<_){const T=w[R];if(T){const O=T.start+x;O!==this.scrollOffset&&(v=O-this.scrollOffset,this.scrollOffset=O,y=!0)}}}(y||m)&&(this.pendingScrollAnchor=[y?d[0]:null,y?d[1]:0,m,v])},this.notify=r=>{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=Ms(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,u)=>{if(u&&this._intendedScrollOffset===null&&l===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(l-this._intendedScrollOffset)<1.5&&(l=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const d=this.getScrollOffset();this.scrollDirection=u?d===l?this.scrollDirection:d{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!sm()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};l.addEventListener("touchstart",u,Au),l.addEventListener("touchend",d,Au),this.unsubs.push(()=>{l.removeEventListener("touchstart",u),l.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[l,u,d,m]=o;l!==null&&!d&&(sm()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?m!==0&&(this._iosDeferredAdjustment+=m):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),i=this.getMaxScrollOffset();if(r<0||r>i)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Ms(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(r,i,o,l,u,d,m,p)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:r,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:u,lanes:d,laneAssignmentMode:m,gap:p}),{key:!1}),this.getMeasurements=Ms(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:u,lanes:d,laneAssignmentMode:m,gap:p},y)=>{const v=this.itemSizeCache;if(!u)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const R of this.laneAssignments.keys())R>=r&&this.laneAssignments.delete(R);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(R=>{this.itemSizeCache.set(R.key,R.size)}));const b=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),d===1){const R=r*2;let T=this._flatMeasurements;if(!T||T.length0&&k.set(T.subarray(0,b*2)),T=k,this._flatMeasurements=T}let O;if(b===0)O=i+o;else{const k=b-1;O=T[k*2]+T[k*2+1]+p}for(let k=b;k1){N=O;const be=w[N],pe=be!==void 0?x[be]:void 0;k=pe?pe.end+p:i+o}else if(E===d){let be=0,pe=_[0],fe=w[0];for(let ue=1;uethis.options.debug}),this.calculateRange=Ms(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,l)=>r.length===0||i===0?(this.range=null,null):(this.range=$I(r,i,o,l,l===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ms(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,l,u)=>l===null||u===null?[]:r({startIndex:l,endIndex:u,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),u=Math.max(0,o-l),d=Math.min(this.options.count-1,o+l);return r>=u&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((u,d)=>{u.isConnected||(this.observer.unobserve(u),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),o=this.options.getItemKey(i),l=this.elementsCache.get(o);l!==r&&(l&&this.observer.unobserve(l),this.observer.observe(r),this.elementsCache.set(o,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var o,l;if(r<0||r>=this.options.count)return;let u,d,m;const p=this._flatMeasurements;if(this.options.lanes===1&&p!==null)m=this.options.getItemKey(r),d=p[r*2],u=p[r*2+1];else{const b=this.measurementsCache[r];if(!b)return;m=b.key,d=b.start,u=b.size}const y=this.itemSizeCache.get(m)??u,v=i-y;if(v!==0){const b=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,x=b?this.getTotalSize():0,w=((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:m,start:d,size:u,end:d+u,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let l=0,u=r.length;lthis.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length===0)return;const o=this._flatMeasurements,l=this.options.lanes===1&&o!=null,u=KC(0,i.length-1,l?d=>o[d*2]:d=>lw(i[d]).start,r);return lw(i[u])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,i,o=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),u=this.getScrollOffset();i==="auto"&&(i=r>=u+l?"end":"start"),i==="center"?r+=(o-l)/2:i==="end"&&(r-=l);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.getSize(),l=this.getScrollOffset(),u=this.measurementsCache[r];if(!u)return;if(i==="auto")if(u.end>=l+o-this.options.scrollPaddingEnd)i="end";else if(u.start<=l+this.options.scrollPaddingStart)i="start";else return[l,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?u.end+this.options.scrollPaddingEnd:u.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,u.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:o="auto"}={})=>{const l=this.getOffsetForAlignment(r,i),u=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:u,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:o="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const l=this.getOffsetForIndex(r,i);if(!l)return;const[u,d]=l,m=this.now();this.scrollState={index:r,align:d,behavior:o,startedAt:m,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+r,l=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const l=i.length-1,u=this._flatMeasurements;u!=null?o=u[l*2]+u[l*2+1]:o=((r=i[l])==null?void 0:r.end)??0}else{const l=Array(this.options.lanes).fill(null);let u=i.length-1;for(;u>=0&&l.some(d=>d===null);){const d=i[u];l[d.lane]===null&&(l[d.lane]=d.end),u--}o=Math.max(...l.filter(d=>d!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const i=this.getMeasurements();for(const o of i)o&&this.itemSizeCache.has(o.key)&&r.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return r},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this._intendedScrollOffset=r+(i??0),this.options.scrollToFn(r,{behavior:o,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,r){t!==0&&(sm()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:r}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,l=1,u=o!==this.scrollState.lastTargetOffset;if(!u&&CI(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,u){const d=this.getSize()||600,m=Math.abs(o-this.getScrollOffset()),p=this.scrollState.behavior==="smooth"&&m>d;this.scrollState.lastTargetOffset=o,p||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:p?"smooth":"auto"})}this.scheduleScrollReconcile()}}const KC=(e,t,r,i)=>{for(;e<=t;){const o=(e+t)/2|0,l=r(o);if(li)t=o-1;else return o}return e>0?e-1:0};function LI(e,t,r){let i=0;for(;i<=t;){const o=(i+t)/2|0,l=e[o*2];if(lr)t=o-1;else return o}return i>0?i-1:0}function $I(e,t,r,i,o){const l=e.length-1;if(e.length<=i)return{startIndex:0,endIndex:l};if(i===1&&o!==null){const p=LI(o,l,r);let y=p;const v=r+t;for(;ye[p].start,r),m=d;if(i===1)for(;m1){const p=Array(i).fill(0);for(;mv=0&&y.some(v=>v>=r);){const v=e[d];y[v.lane]=v.start,d--}d=Math.max(0,d-d%i),m=Math.min(l,m+(i-1-m%i))}return{startIndex:d,endIndex:m}}const om=typeof document<"u"?S.useLayoutEffect:S.useEffect;function II({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:r="transform",...i}){const o=S.useReducer(p=>p+1,0)[1],l=S.useRef({enabled:t,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});l.current.enabled=t,l.current.mode=r;const u=p=>{const y=l.current;if(!y.enabled||!y.container)return;const v=p.getTotalSize();if(v!==y.lastSize){y.lastSize=v;const R=p.options.horizontal?"width":"height";y.container.style[R]=`${v}px`}const b=!!p.options.horizontal,x=y.mode==="transform",w=b?"left":"top",_=p.options.scrollMargin,E=p.getVirtualItems();for(const R of E){const T=R.start-_,O=p.elementsCache.get(R.key);O&&y.lastPositions.get(O)!==T&&(y.lastPositions.set(O,T),x?O.style.transform=b?`translate3d(${T}px, 0, 0)`:`translate3d(0, ${T}px, 0)`:O.style[w]=`${T}px`)}},d={...i,onChange:(p,y)=>{var v;const b=l.current;let x=!0;if(b.enabled){u(p);const w=p.range,_=b.prevRange;x=!_||_.isScrolling!==p.isScrolling||_.startIndex!==w?.startIndex||_.endIndex!==w?.endIndex,x&&(b.prevRange=w?{startIndex:w.startIndex,endIndex:w.endIndex,isScrolling:p.isScrolling}:null)}x&&(e&&y?ki.flushSync(o):o()),(v=i.onChange)==null||v.call(i,p,y)}},[m]=S.useState(()=>{const p=new zI(d);return Object.assign(p,{containerRef:y=>{const v=l.current;if(v.container=y,v.lastSize=null,y&&v.enabled){const b=p.getTotalSize();v.lastSize=b;const x=p.options.horizontal?"width":"height";y.style[x]=`${b}px`}}})});return m.setOptions(d),om(()=>m._didMount(),[]),om(()=>m._willUpdate()),om(()=>{u(m)}),m}function PI(e){return II({observeElementRect:TI,observeElementOffset:MI,scrollToFn:kI,...e})}function FI(e,t){const r=[],i=(o,l)=>{for(const u of o)r.push({node:u,depth:l}),u.dir&&t.has(u.path)&&i(u.children||[],l+1)};return i(e?.children||[],0),r}function VI(e){const{root:t,expanded:r,onToggle:i,currentPath:o,listingShowing:l,onOpen:u}=e,d=S.useRef(null),m=S.useMemo(()=>FI(t,r),[t,r]),p=PI({count:m.length,getScrollElement:()=>d.current,estimateSize:()=>window.matchMedia("(max-width: 768px)").matches?44:28,overscan:12,getItemKey:y=>m[y].node.path});return S.useEffect(()=>{if(!o)return;const y=m.findIndex(v=>v.node.path===o);y>=0&&p.scrollToIndex(y,{align:"auto"})},[o,m]),f.jsx("nav",{id:"tree","aria-label":"Files",ref:d,children:f.jsx("div",{style:{height:p.getTotalSize(),position:"relative"},children:p.getVirtualItems().map(y=>{const{node:v,depth:b}=m[y.index],x=v.dir?r.has(v.path):!1,w=()=>{if(v.dir&&o===v.path&&l){i(v.path);return}u(v.path),v.dir||hr()};return f.jsxs("div",{className:"row "+(v.dir?"dir":"file")+(o===v.path?" active":"")+(v.dir&&!x?" collapsed":""),"data-path":v.path,tabIndex:0,role:"button",title:v.name,"aria-expanded":v.dir?x:void 0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${y.start}px)`,paddingLeft:8+b*13},onClick:w,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),w())},children:[Array.from({length:b},(_,E)=>f.jsx("span",{className:"tguide",style:{left:8+E*13+5},"aria-hidden":"true"},E)),f.jsx("span",{className:"chev",onClick:_=>{v.dir&&(_.stopPropagation(),i(v.path))},children:f.jsx(rt,{name:"chevd"})}),f.jsx("span",{className:"ticon",children:f.jsx(rt,{name:v.dir?"folder":"doc"})}),f.jsx("span",{className:"label",children:v.name})]},y.key)})})})}function UI(e){const t=e.split("/"),r=[];let i="";for(let o=0;o{i=i?i+"/"+o:o;const u=i,d=l===r.length-1;return f.jsxs("span",{children:[l>0&&f.jsx("span",{className:"crumb-sep",children:"/"}),d?f.jsx("span",{children:o}):f.jsx("span",{className:"crumb-seg",title:u,onClick:()=>t(u),children:o})]},u)})})}const BI=/\.bdrive-conflict-([A-Za-z0-9_-]{0,32})-(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/;function YC(e){const t=BI.exec(e);if(!t)return null;const[,r,i,o,l,u,d,m]=t,p=new Date(Date.UTC(+i,+o-1,+l,+u,+d,+m));return p.getUTCFullYear()!==+i||p.getUTCMonth()!==+o-1||p.getUTCDate()!==+l||p.getUTCHours()!==+u||p.getUTCMinutes()!==+d||p.getUTCSeconds()!==+m?null:{original:e.slice(0,t.index),device:r,when:p}}function uw(e){if(e==="")return[];const t=e.split(` -`);return t[t.length-1]===""&&t.pop(),t}const qI=4e6;function GI(e,t){let r=0;for(;ro.push({op:"-",line:l[v],an:r+v+1}),y=v=>o.push({op:"+",line:u[v],bn:r+v+1});if(d*m>qI){for(let v=0;v=0;w--)for(let _=m-1;_>=0;_--)v[w][_]=l[w]===u[_]?v[w+1][_+1]+1:Math.max(v[w+1][_],v[w][_+1]);let b=0,x=0;for(;b=v[b][x+1]?p(b++):y(x++);for(;bi.op==="+").length,del:r.filter(i=>i.op==="-").length}}const QC=1<<20,KI=8192;function YI(e){if(e.byteLength>QC)return{kind:"too-large",size:e.byteLength};if(e.subarray(0,KI).includes(0))return{kind:"binary"};try{return{kind:"text",text:new TextDecoder("utf-8",{fatal:!0}).decode(e)}}catch{return{kind:"binary"}}}function ep(e,t,r,i){let o=e+"blob?sha="+encodeURIComponent(t);return r&&(o+="&name="+encodeURIComponent(r)),i&&(o+="&download=1"),o}async function QI(e){const t=await Sj(e),r=Number(t.headers.get("Content-Length"));return r>QC?{kind:"too-large",size:r}:YI(new Uint8Array(await t.arrayBuffer()))}function XC(e,t,r,i){return Ft({queryKey:t,queryFn:()=>QI(e),enabled:r,...i?{staleTime:1/0,gcTime:1/0}:{},retry:!1})}function dw(e,t,r){return XC(t?ep(e,t):"",["blob",e,t],!!t,!0)}function XI(e){return e.slice(e.lastIndexOf("/")+1)}function JI({apiBase:e,path:t,prev:r,cur:i}){const o=XI(t);return f.jsxs("span",{className:"dv-dl",children:[f.jsx("a",{href:ep(e,r,o,!0),children:"download previous"}),f.jsx("a",{href:ep(e,i,o,!0),children:"download this version"})]})}function WI({apiBase:e,path:t,prev:r,cur:i}){const o=dw(e,r),l=dw(e,i),u=o.data?.kind==="text"&&l.data?.kind==="text",d=S.useMemo(()=>o.data?.kind==="text"&&l.data?.kind==="text"?ZI(o.data.text,l.data.text):null,[o.data,l.data]);if(o.error||l.error)return f.jsx("div",{className:"dv dv-msg",children:"Could not load one of the versions."});if(!o.data||!l.data)return f.jsx("div",{className:"dv dv-msg",children:"Loading changes…"});if(!u){const v=o.data.kind==="too-large"||l.data.kind==="too-large";return f.jsxs("div",{className:"dv dv-msg",children:[v?"Too large to diff — download to compare.":"Binary file — no diff available.",f.jsx(JI,{apiBase:e,path:t,prev:r,cur:i})]})}const{lines:m,add:p,del:y}=d;return f.jsxs("div",{className:"dv",children:[f.jsxs("div",{className:"dv-head",children:[f.jsxs("span",{className:"dv-stat",children:[f.jsxs("span",{className:"dv-add",children:["+",p]})," ",f.jsxs("span",{className:"dv-del",children:["−",y]})]}),p===0&&y===0&&f.jsx("span",{className:"dv-same",children:"No line changes"})]}),f.jsx("div",{className:"dv-body",children:m.map((v,b)=>f.jsxs("div",{className:"dv-line dv-"+(v.op==="="?"ctx":v.op==="+"?"ins":"rm"),children:[f.jsx("span",{className:"dv-n",children:v.an??""}),f.jsx("span",{className:"dv-n",children:v.bn??""}),f.jsx("span",{className:"dv-mark",children:v.op==="="?" ":v.op}),f.jsx("span",{className:"dv-text",children:v.line||" "})]},b))})]})}const eP={add:"added",edit:"edited",delete:"deleted"};function JC({text:e}){return f.jsx(f.Fragment,{children:e.split(/(https?:\/\/\S+)/).map((t,r)=>/^https?:\/\//.test(t)?f.jsx("a",{href:t,target:"_blank",rel:"noopener",children:t},r):t)})}function vg({entry:e,apiBase:t,onOpen:r,diff:i,restore:o,remove:l,restoreSha:u,recreates:d,inRun:m,read:p}){const[y,v]=S.useState(!1),[b,x]=S.useState(!1),w=e.kind==="put"?"edit":e.kind,_=fd(e),E=[e.device.name||e.device.id,e.device.os].filter(Boolean).join(" · "),R=w!=="delete",T=!!i&&w!=="delete"&&!!e.blob,O=!!m&&w==="add",N=!!o&&!!u&&!O,k=!!l&&O,B=!!o?.busy&&o.busy===e.path+u,H=!!l?.busy&&l.busy===e.path,$=R&&!!e.blob,he=e.path.split("/").pop()||e.path,be=new Date(e.time).toLocaleString(),pe=t+"blob?sha="+e.blob+"&name="+encodeURIComponent(he)+"&download=1",fe=()=>x(!b),ue=ee=>{ee.target.tagName!=="A"&&R&&r(e.path,e.blob)};return f.jsxs("div",{className:"hentry "+w+(R?" clickable":""),tabIndex:R?0:void 0,role:R?"button":void 0,onClick:ue,onKeyDown:ee=>{R&&(ee.key==="Enter"||ee.key===" ")&&(ee.preventDefault(),r(e.path,e.blob))},children:[f.jsxs("div",{className:"hline",children:[f.jsx("span",{className:"hkind",children:eP[w]||w}),p&&f.jsx("span",{className:"hread",title:"This run read this file before changing it",children:"read"}),f.jsx("span",{className:"hpath",children:e.path}),f.jsx("span",{className:"htime",children:be})]}),f.jsxs("div",{className:"hmeta",children:[f.jsx("span",{className:"hwho",children:_}),f.jsx("span",{className:"hdev",children:E}),f.jsx("span",{className:"hsize",children:e.size?gg(e.size):""}),N&&f.jsxs("button",{type:"button",className:"hrestore-btn",disabled:B,title:"Put this version of "+e.path+" back as a new change",onClick:ee=>{ee.stopPropagation(),o.onRestore(e.path,u,!!d)},onKeyDown:ee=>ee.stopPropagation(),children:[f.jsx(rt,{name:"hist"}),B?"restoring…":"restore"]}),k&&f.jsxs("button",{type:"button",className:"hremove-btn",disabled:H,title:"Remove "+e.path+" — this run created it",onClick:ee=>{ee.stopPropagation(),l.onRemove(e.path)},onKeyDown:ee=>ee.stopPropagation(),children:[f.jsx(rt,{name:"trash"}),H?"removing…":"undo — remove file"]})]}),e.note&&!m&&f.jsx("div",{className:"hnote"+(y?" open":""),tabIndex:0,role:"button",title:y?"Collapse note":"Show full note","aria-expanded":y,onClick:ee=>{ee.stopPropagation(),ee.target.tagName!=="A"&&v(!y)},onKeyDown:ee=>{(ee.key==="Enter"||ee.key===" ")&&(ee.preventDefault(),ee.stopPropagation(),v(!y))},children:f.jsx(JC,{text:e.note})}),(T||$)&&f.jsxs("div",{className:"hactions",children:[T&&(i.prev?f.jsxs("button",{type:"button",className:"hdiff-btn"+(b?" open":""),"aria-expanded":b,onClick:ee=>{ee.stopPropagation(),fe()},onKeyDown:ee=>ee.stopPropagation(),children:[f.jsx(rt,{name:b?"chevd":"chev"}),b?"hide changes":"show changes"]}):f.jsx("div",{className:"hdiff-none",children:"First version — nothing to compare against"})),$&&f.jsxs(f.Fragment,{children:[f.jsxs("button",{type:"button",className:"hver-btn","aria-label":`Open ${he} as of ${be}`,onClick:ee=>{ee.stopPropagation(),r(e.path,e.blob)},onKeyDown:ee=>ee.stopPropagation(),children:[f.jsx(rt,{name:"clock"}),"Open this version"]}),f.jsxs("a",{className:"hver-btn",download:!0,href:pe,"aria-label":`Download ${he} as of ${be}`,onClick:ee=>ee.stopPropagation(),onKeyDown:ee=>{ee.stopPropagation(),ee.key===" "&&(ee.preventDefault(),ee.currentTarget.click())},children:[f.jsx(rt,{name:"download"}),"Download"]})]})]}),T&&i.prev&&b&&f.jsx("div",{onClick:ee=>ee.stopPropagation(),children:f.jsx(WI,{apiBase:i.apiBase,path:e.path,prev:i.prev,cur:e.blob})})]})}function tP(e){const{node:t,heatMap:r,onOpen:i}=e,o=(t.children||[]).slice().sort((y,v)=>Number(v.dir||!1)-Number(y.dir||!1)||y.name.localeCompare(v.name)),l=o.filter(y=>y.dir).length,u=o.length-l,d=[];l&&d.push(l+(l===1?" folder":" folders")),u&&d.push(u+(u===1?" file":" files"));const m=am(r,t.path,!0);m&&d.push(el(m)+" in 30 days");const p=!!m||o.some(y=>am(r,y.path,!!y.dir));return f.jsxs("div",{className:"dirlist",children:[f.jsxs("h1",{className:"dl-title",children:[f.jsx("span",{className:"dl-title-icon",children:f.jsx(rt,{name:"folder"})}),f.jsx("span",{children:t.name})]}),f.jsx("p",{className:"dl-sub",children:d.join(" · ")||"Empty folder"}),p&&f.jsx("p",{className:"dl-heatnote",children:Ci}),o.length===0?f.jsx("div",{className:"dl-empty",children:"Nothing in this folder yet."}):f.jsx("div",{className:"dl-items",children:o.map(y=>{let v="";if(y.dir){const _=(y.children||[]).length;v=_+(_===1?" item":" items")}else v=[y.size?gg(y.size):"",y.time?new Date(y.time).toLocaleDateString():""].filter(Boolean).join(" · ");const b=am(r,y.path,!!y.dir);b&&(v=el(b)+(v?" · "+v:""));const x=y.dir?null:YC(y.path),w=y.dir?"":ZC(b,y.time);return f.jsxs("div",{className:"dl-row",tabIndex:0,role:"button",title:y.path,onClick:()=>i(y.path),onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),i(y.path))},children:[f.jsx("span",{className:"ticon",children:f.jsx(rt,{name:y.dir?"folder":"doc"})}),f.jsx("span",{className:"dl-name",children:y.name}),x&&f.jsx("span",{className:"dl-conflict","aria-label":"Conflict copy: a concurrent edit from "+(x.device||"another device")+" that beardrive preserved instead of dropping.",title:"A concurrent edit from "+(x.device||"another device")+" that beardrive preserved instead of dropping.",children:"conflict copy"}),w&&f.jsx("span",{className:"stalemark",role:"img","aria-label":"Warning: "+w,title:"Read often, but "+w,children:"⚠"}),b&&f.jsx("span",{className:"heatdot lvl"+lI(b),role:"img","aria-label":el(b)+" in 30 days. "+Ci,title:el(b)+" in 30 days. "+Ci}),f.jsx("span",{className:"dl-meta",children:v})]},y.path)})}),e.hub&&f.jsx(nP,{apiBase:e.apiBase,prefix:t.path+"/",onOpen:i,onFullHistory:()=>e.onFullHistory(t.path+"/"),onRendered:e.onRendered})]})}function nP(e){const t=SI(e.apiBase,e.prefix,!0),{onRendered:r}=e;return S.useEffect(()=>{t&&t.length&&r&&r()},[t,r]),!t||t.length===0?null:f.jsxs("div",{className:"dl-history",children:[f.jsx("h3",{className:"dl-h3",children:"Recent changes"}),f.jsx("div",{className:"history dl-hlist",children:t.map((i,o)=>f.jsx(vg,{entry:i,apiBase:e.apiBase,onOpen:e.onOpen},o))}),f.jsx("button",{className:"ai-btn dl-more",onClick:e.onFullHistory,children:"Full history"})]})}const WC=5e3;function rP(e,t,r=WC){const i=[];let o=[],l="",u=!1,d=0;const m=()=>{o.push(l),l="",i.length({value:x.name,title:x.title,blurb:x.blurb,rule:!1})),{value:qC,title:"I already have a folder",blurb:"nothing is seeded — connect it and your files stay as they are",rule:!0},{value:"",title:"Empty project",blurb:"just the folder",rule:!1}],[o,l]=S.useState(""),[u,d]=S.useState(i[0].value),[m,p]=S.useState(""),[y,v]=S.useState(!1),b=async()=>{if(!y){if(!o.trim()){p("Give it a name.");return}v(!0);try{await t(o.trim(),u)}finally{v(!1)}}};return f.jsx(Wu,{open:!0,onOpenChange:x=>!x&&r(),children:f.jsxs(ed,{className:"modal",showCloseButton:!1,children:[f.jsx(Cl,{asChild:!0,children:f.jsx("h3",{children:"New project"})}),f.jsx("label",{className:"modal-label",htmlFor:"modal-input",children:"Name"}),f.jsx("input",{className:"modal-input",type:"text",autoComplete:"off",id:"modal-input",autoFocus:!0,value:o,"aria-invalid":!!m,"aria-describedby":m?"modal-input-err":void 0,onChange:x=>{l(x.currentTarget.value),m&&p("")},onKeyDown:x=>x.key==="Enter"&&b()}),m&&f.jsx("span",{id:"modal-input-err",role:"alert",className:"field-err",children:m}),i.length>1&&f.jsxs("fieldset",{className:"start-points",children:[f.jsx("legend",{className:"modal-label",children:"Starting point"}),i.map((x,w)=>f.jsxs("label",{className:"start-point"+(u===x.value?" on":"")+(x.rule?" sp-rule":""),children:[f.jsx("input",{type:"radio",name:"template",value:x.value,checked:u===x.value,onChange:()=>d(x.value)}),f.jsxs("span",{className:"sp-text",children:[f.jsxs("span",{className:"sp-title",children:[x.title,w===0&&f.jsx("span",{className:"sp-rec",children:"Recommended"})]}),f.jsx("span",{className:"sp-blurb",children:x.blurb})]})]},x.value))]}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(xt,{variant:"subtle",onClick:r,children:"Cancel"}),f.jsx(xt,{variant:"primary",onClick:b,disabled:y,children:"Create"})]})]})})}function am(e,t,r){if(!e)return null;if(!r)return e[t]||null;const i={human:0,agent:0,share:0};for(const[o,l]of Object.entries(e))o.startsWith(t+"/")&&(i.human+=l.human||0,i.agent+=l.agent||0,i.share+=l.share||0);return i.human||i.agent||i.share?i:null}function na(e){return(e.human||0)+(e.agent||0)+(e.share||0)}function el(e){const t=na(e);if(!t)return"";const r=t+(t===1?" read":" reads");if(!e.agent&&!e.share)return r;const i=[];return e.human&&i.push(e.human+" human"),e.agent&&i.push(e.agent+" agent"),e.share&&i.push(e.share+" shared"),r+" ("+i.join(", ")+")"}const Ci="Includes your own views. Repeat opens by the same reader inside 10 minutes count once.";function lI(e){const t=na(e);return t?t<3?1:t<10?2:t<30?3:4:0}function cI(e){const t=na(e);return t?{agent:(e.agent||0)/t,human:(e.human||0)/t,share:(e.share||0)/t}:{agent:0,human:0,share:0}}function uI(e,t){return e?Object.keys(e).filter(r=>!t.has(r)).sort():[]}const dI=7;function fI(e){if(!e.length)return null;let t=e[0],r=e[0];for(const i of e)ir&&(r=i);return{min:t,max:r}}const hI=(e,t)=>t-el.reads-o.reads).slice(0,pI)){const o=i.path.split("/").pop();let l=i.cx+i.r+4,u="start";l+o.length*gI>t.right&&(l=i.cx-i.r-4,u="end");const d=p=>r.every(y=>Math.abs(y.y-p)>=im);let m=i.cy;for(;m<=t.bottom&&!d(m);)m+=im;if(m>t.bottom)for(m=i.cy;m>=t.top&&!d(m);)m-=im;r.push({path:i.path,name:o,x:l,y:Math.min(t.bottom,Math.max(t.top,m)),anchor:u})}return r}const tl=3,Ns=30,GC=(e,t)=>e>=tl&&t>=Ns;function yI(e,t=Date.now()){if(!e)return null;const r=new Date(e).getTime();return Number.isFinite(r)?Math.max(0,(t-r)/864e5):null}function bI(e){const t=new Intl.RelativeTimeFormat("en",{numeric:"always"});return e<30?t.format(-Math.round(e),"day"):e<365?t.format(-Math.round(e/30),"month"):t.format(-Math.round(e/365),"year")}function ZC(e,t){const r=yI(t);return!e||r===null||!GC(na(e),r)?"":`stale · last changed ${bI(r)}`}function xI(e,t=!0){const r=Ft({queryKey:["tree",e],queryFn:()=>qt(e+"tree"),enabled:t,refetchInterval:15e3}),i=S.useMemo(()=>{const o=[],l=new Map,u=d=>{for(const m of d.children||[])m.dir?(l.set(m.path,m),u(m)):o.push(m)};return r.data&&u(r.data),{flatFiles:o,dirIndex:l}},[r.data]);return{tree:r.data,...i,loaded:!!r.data}}function wI(e,t){return Ft({queryKey:["heat",e],queryFn:()=>qt(e+"heat?days=30"),enabled:t,staleTime:6e4,refetchInterval:6e4}).data?.entries??null}function SI(e,t,r){return Ft({queryKey:["history",e,"prefix",t,20],queryFn:()=>qt(e+"history?prefix="+encodeURIComponent(t)+"&n=20"),enabled:r,staleTime:15e3}).data?.entries??null}function _I(e,t,r){const i=new Array(e);return new Proxy(i,{get(o,l,u){if(typeof l=="string"){const d=l.charCodeAt(0);if(d>=48&&d<=57){const m=+l;if(Number.isInteger(m)&&m>=0&&mi[y]!==p))&&(i=d,o=t(...d),r?.onChange&&!(l&&r.skipInitialOnChange)&&r.onChange(o),l=!1),o}return u.updateDeps=d=>{i=d},u}function lw(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const CI=(e,t)=>Math.abs(e-t)<1.01,EI=(e,t,r)=>{let i;return function(...o){e.clearTimeout(i),i=e.setTimeout(()=>t.apply(this,o),r)}};let Ko;const sm=()=>{if(Ko!==void 0)return Ko;if(typeof navigator>"u")return Ko=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Ko=!0;const e=navigator.maxTouchPoints;return Ko=navigator.platform==="MacIntel"&&e!==void 0&&e>0},cw=e=>{const{offsetWidth:t,offsetHeight:r}=e;return{width:t,height:r}},RI=e=>e,jI=e=>{const t=Math.max(e.startIndex-e.overscan,0),i=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,o=new Array(i);for(let l=0;l{const r=e.scrollElement;if(!r)return;const i=e.targetWindow;if(!i)return;const o=u=>{const{width:d,height:m}=u;t({width:Math.round(d),height:Math.round(m)})};if(o(cw(r)),!i.ResizeObserver)return()=>{};const l=new i.ResizeObserver(u=>{const d=()=>{const m=u[0];if(m?.borderBoxSize){const p=m.borderBoxSize[0];if(p){o({width:p.inlineSize,height:p.blockSize});return}}o(cw(r))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(d):d()});return l.observe(r,{box:"border-box"}),()=>{l.unobserve(r)}},Au={passive:!0},OI=typeof window>"u"?!0:"onscrollend"in window,AI=(e,t,r)=>{const i=e.scrollElement;if(!i)return;const o=e.targetWindow;if(!o)return;const l=e.options.useScrollendEvent&&OI;let u=0;const d=l?null:EI(o,()=>t(u,!1),e.options.isScrollingResetDelay),m=v=>()=>{u=r(i),d?.(),t(u,v)},p=m(!0),y=m(!1);return i.addEventListener("scroll",p,Au),l&&i.addEventListener("scrollend",y,Au),()=>{i.removeEventListener("scroll",p),l&&i.removeEventListener("scrollend",y)}},MI=(e,t)=>AI(e,t,r=>{const{horizontal:i,isRtl:o}=e.options;return i?r.scrollLeft*(o&&-1||1):r.scrollTop}),NI=(e,t,r)=>{if(r.options.useCachedMeasurements){const i=r.indexFromElement(e),o=r.options.getItemKey(i);return r.itemSizeCache.get(o)??r.options.estimateSize(i)}if(t?.borderBoxSize){const i=t.borderBoxSize[0];if(i)return Math.round(i[r.options.horizontal?"inlineSize":"blockSize"])}if(!t){const i=r.indexFromElement(e),o=r.options.getItemKey(i),l=r.itemSizeCache.get(o);if(l!==void 0)return l}return e[r.options.horizontal?"offsetWidth":"offsetHeight"]},DI=(e,{adjustments:t=0,behavior:r},i)=>{var o,l;(l=(o=i.scrollElement)==null?void 0:o.scrollTo)==null||l.call(o,{[i.options.horizontal?"left":"top"]:e+t,behavior:r})},kI=DI;class zI{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var r,i,o;return((o=(i=(r=this.targetWindow)==null?void 0:r.performance)==null?void 0:i.now)==null?void 0:o.call(i))??Date.now()},this.observer=(()=>{let r=null;const i=()=>r||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:r=new this.targetWindow.ResizeObserver(o=>{o.forEach(l=>{const u=()=>{const d=l.target,m=this.indexFromElement(d);if(!d.isConnected){this.observer.unobserve(d);for(const[p,y]of this.elementsCache)if(y===d){this.elementsCache.delete(p);break}return}this.shouldMeasureDuringScroll(m)&&this.resizeItem(m,this.options.measureElement(d,l,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(u):u()})}));return{disconnect:()=>{var o;(o=i())==null||o.disconnect(),r=null},observe:o=>{var l;return(l=i())==null?void 0:l.observe(o,{box:"border-box"})},unobserve:o=>{var l;return(l=i())==null?void 0:l.unobserve(o)}}})(),this.range=null,this.setOptions=r=>{var i,o;const l={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:RI,rangeExtractor:jI,onChange:()=>{},measureElement:NI,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(const b in r){const x=r[b];x!==void 0&&(l[b]=x)}const u=this.options;let d=null,m=null,p=!1;if(u!==void 0&&u.enabled&&l.enabled&&l.anchorTo==="end"&&this.scrollElement!==null){const b=u.count,x=l.count,w=this.getMeasurements(),_=b>0?((i=w[0])==null?void 0:i.key)??u.getItemKey(0):null,E=b>0?((o=w[b-1])==null?void 0:o.key)??u.getItemKey(b-1):null;if(x!==b||b>0&&x>0&&(l.getItemKey(0)!==_||l.getItemKey(x-1)!==E)){p=!0;const O=b>0?this.getVirtualItemForOffset(this.getScrollOffset())??w[0]:null;O&&(d=[O.key,this.getScrollOffset()-O.start]);const N=l.followOnAppend===!0?"auto":l.followOnAppend||null;N&&x>b&&this.isAtEnd(u.scrollEndThreshold)&&(b===0||l.getItemKey(x-1)!==E)&&(m=N)}}this.options=l,p&&(this.pendingMin=0,this.itemSizeCacheVersion++);let y=!1,v=0;if(d&&this.scrollOffset!==null){const[b,x]=d,w=this.getMeasurements(),{count:_,getItemKey:E}=this.options;let R=0;for(;R<_&&E(R)!==b;)R++;if(R<_){const T=w[R];if(T){const O=T.start+x;O!==this.scrollOffset&&(v=O-this.scrollOffset,this.scrollOffset=O,y=!0)}}}(y||m)&&(this.pendingScrollAnchor=[y?d[0]:null,y?d[1]:0,m,v])},this.notify=r=>{var i,o;(o=(i=this.options).onChange)==null||o.call(i,this,r)},this.maybeNotify=Ms(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),r=>{this.notify(r)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(r=>r()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var r;const i=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==i){if(this.cleanup(),!i){this.maybeNotify();return}if(this.scrollElement=i,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((r=this.scrollElement)==null?void 0:r.window)??null,this.elementsCache.forEach(l=>{this.observer.observe(l)}),this.unsubs.push(this.options.observeElementRect(this,l=>{this.scrollRect=l,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(l,u)=>{if(u&&this._intendedScrollOffset===null&&l===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(l-this._intendedScrollOffset)<1.5&&(l=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;const d=this.getScrollOffset();this.scrollDirection=u?d===l?this.scrollDirection:d{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},d=()=>{this._iosTouching=!1,!(!sm()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};l.addEventListener("touchstart",u,Au),l.addEventListener("touchend",d,Au),this.unsubs.push(()=>{l.removeEventListener("touchstart",u),l.removeEventListener("touchend",d),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}const o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){const[l,u,d,m]=o;l!==null&&!d&&(sm()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?m!==0&&(this._iosDeferredAdjustment+=m):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),d&&this.scrollToEnd({behavior:d})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;const r=this.getScrollOffset(),i=this.getMaxScrollOffset();if(r<0||r>i)return;const o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(r,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getMeasurementOptions=Ms(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(r,i,o,l,u,d,m,p)=>(this.prevLanes!==void 0&&this.prevLanes!==d&&(this.lanesChangedFlag=!0),this.prevLanes=d,this.pendingMin=null,{count:r,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:u,lanes:d,laneAssignmentMode:m,gap:p}),{key:!1}),this.getMeasurements=Ms(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:r,paddingStart:i,scrollMargin:o,getItemKey:l,enabled:u,lanes:d,laneAssignmentMode:m,gap:p},y)=>{const v=this.itemSizeCache;if(!u)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>r)for(const R of this.laneAssignments.keys())R>=r&&this.laneAssignments.delete(R);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(R=>{this.itemSizeCache.set(R.key,R.size)}));const b=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===r&&(this.lanesSettling=!1),d===1){const R=r*2;let T=this._flatMeasurements;if(!T||T.length0&&z.set(T.subarray(0,b*2)),T=z,this._flatMeasurements=T}let O;if(b===0)O=i+o;else{const z=b-1;O=T[z*2]+T[z*2+1]+p}for(let z=b;z1){N=O;const ge=w[N],pe=ge!==void 0?x[ge]:void 0;z=pe?pe.end+p:i+o}else if(E===d){let ge=0,pe=_[0],he=w[0];for(let de=1;dethis.options.debug}),this.calculateRange=Ms(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(r,i,o,l)=>r.length===0||i===0?(this.range=null,null):(this.range=$I(r,i,o,l,l===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ms(()=>{let r=null,i=null;const o=this.calculateRange();return o&&(r=o.startIndex,i=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,r,i]),[this.options.rangeExtractor,this.options.overscan,this.options.count,r,i]},(r,i,o,l,u)=>l===null||u===null?[]:r({startIndex:l,endIndex:u,overscan:i,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=r=>{const i=this.options.indexAttribute,o=r.getAttribute(i);return o?parseInt(o,10):(console.warn(`Missing attribute name '${i}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=r=>{var i;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;const o=this.scrollState.index??((i=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:i.index);if(o!==void 0&&this.range){const l=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),u=Math.max(0,o-l),d=Math.min(this.options.count-1,o+l);return r>=u&&r<=d}return!0},this.measureElement=r=>{if(!r){this.elementsCache.forEach((u,d)=>{u.isConnected||(this.observer.unobserve(u),this.elementsCache.delete(d))});return}const i=this.indexFromElement(r),o=this.options.getItemKey(i),l=this.elementsCache.get(o);l!==r&&(l&&this.observer.unobserve(l),this.observer.observe(r),this.elementsCache.set(o,r)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(i)&&this.resizeItem(i,this.options.measureElement(r,void 0,this))},this.resizeItem=(r,i)=>{var o,l;if(r<0||r>=this.options.count)return;let u,d,m;const p=this._flatMeasurements;if(this.options.lanes===1&&p!==null)m=this.options.getItemKey(r),d=p[r*2],u=p[r*2+1];else{const b=this.measurementsCache[r];if(!b)return;m=b.key,d=b.start,u=b.size}const y=this.itemSizeCache.get(m)??u,v=i-y;if(v!==0){const b=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,x=b?this.getTotalSize():0,w=((l=this.scrollState)==null?void 0:l.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[r]??{index:r,key:m,start:d,size:u,end:d+u,lane:0},v,this):d[this.getVirtualIndexes(),this.getMeasurements()],(r,i)=>{const o=[];for(let l=0,u=r.length;lthis.options.debug}),this.getVirtualItemForOffset=r=>{const i=this.getMeasurements();if(i.length===0)return;const o=this._flatMeasurements,l=this.options.lanes===1&&o!=null,u=KC(0,i.length-1,l?d=>o[d*2]:d=>lw(i[d]).start,r);return lw(i[u])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{const r=this.scrollElement.document.documentElement;return this.options.horizontal?r.scrollWidth-this.scrollElement.innerWidth:r.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(r=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=r,this.getOffsetForAlignment=(r,i,o=0)=>{if(!this.scrollElement)return 0;const l=this.getSize(),u=this.getScrollOffset();i==="auto"&&(i=r>=u+l?"end":"start"),i==="center"?r+=(o-l)/2:i==="end"&&(r-=l);const d=this.getMaxScrollOffset();return Math.max(Math.min(d,r),0)},this.getOffsetForIndex=(r,i="auto")=>{r=Math.max(0,Math.min(r,this.options.count-1));const o=this.getSize(),l=this.getScrollOffset(),u=this.measurementsCache[r];if(!u)return;if(i==="auto")if(u.end>=l+o-this.options.scrollPaddingEnd)i="end";else if(u.start<=l+this.options.scrollPaddingStart)i="start";else return[l,i];if(i==="end"&&r===this.options.count-1)return[this.getMaxScrollOffset(),i];const d=i==="end"?u.end+this.options.scrollPaddingEnd:u.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(d,i,u.size),i]},this.scrollToOffset=(r,{align:i="start",behavior:o="auto"}={})=>{const l=this.getOffsetForAlignment(r,i),u=this.now();this.scrollState={index:null,align:i,behavior:o,startedAt:u,lastTargetOffset:l,stableFrames:0},this._scrollToOffset(l,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(r,{align:i="auto",behavior:o="auto"}={})=>{r=Math.max(0,Math.min(r,this.options.count-1));const l=this.getOffsetForIndex(r,i);if(!l)return;const[u,d]=l,m=this.now();this.scrollState={index:r,align:d,behavior:o,startedAt:m,lastTargetOffset:u,stableFrames:0},this._scrollToOffset(u,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(r,{behavior:i="auto"}={})=>{const o=this.getScrollOffset()+r,l=this.now();this.scrollState={index:null,align:"start",behavior:i,startedAt:l,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:i}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:r="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:r});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:r})},this.getTotalSize=()=>{var r;const i=this.getMeasurements();let o;if(i.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){const l=i.length-1,u=this._flatMeasurements;u!=null?o=u[l*2]+u[l*2+1]:o=((r=i[l])==null?void 0:r.end)??0}else{const l=Array(this.options.lanes).fill(null);let u=i.length-1;for(;u>=0&&l.some(d=>d===null);){const d=i[u];l[d.lane]===null&&(l[d.lane]=d.end),u--}o=Math.max(...l.filter(d=>d!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{const r=[];if(this.itemSizeCache.size===0)return r;const i=this.getMeasurements();for(const o of i)o&&this.itemSizeCache.has(o.key)&&r.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return r},this._scrollToOffset=(r,{adjustments:i,behavior:o})=>{this._intendedScrollOffset=r+(i??0),this.options.scrollToFn(r,{behavior:o,adjustments:i},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(t)}applyScrollAdjustment(t,r){t!==0&&(sm()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=t:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=t,behavior:r}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}const i=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=i?i[0]:this.scrollState.lastTargetOffset,l=1,u=o!==this.scrollState.lastTargetOffset;if(!u&&CI(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=l){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,u){const d=this.getSize()||600,m=Math.abs(o-this.getScrollOffset()),p=this.scrollState.behavior==="smooth"&&m>d;this.scrollState.lastTargetOffset=o,p||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:p?"smooth":"auto"})}this.scheduleScrollReconcile()}}const KC=(e,t,r,i)=>{for(;e<=t;){const o=(e+t)/2|0,l=r(o);if(li)t=o-1;else return o}return e>0?e-1:0};function LI(e,t,r){let i=0;for(;i<=t;){const o=(i+t)/2|0,l=e[o*2];if(lr)t=o-1;else return o}return i>0?i-1:0}function $I(e,t,r,i,o){const l=e.length-1;if(e.length<=i)return{startIndex:0,endIndex:l};if(i===1&&o!==null){const p=LI(o,l,r);let y=p;const v=r+t;for(;ye[p].start,r),m=d;if(i===1)for(;m1){const p=Array(i).fill(0);for(;mv=0&&y.some(v=>v>=r);){const v=e[d];y[v.lane]=v.start,d--}d=Math.max(0,d-d%i),m=Math.min(l,m+(i-1-m%i))}return{startIndex:d,endIndex:m}}const om=typeof document<"u"?S.useLayoutEffect:S.useEffect;function II({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:r="transform",...i}){const o=S.useReducer(p=>p+1,0)[1],l=S.useRef({enabled:t,mode:r,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});l.current.enabled=t,l.current.mode=r;const u=p=>{const y=l.current;if(!y.enabled||!y.container)return;const v=p.getTotalSize();if(v!==y.lastSize){y.lastSize=v;const R=p.options.horizontal?"width":"height";y.container.style[R]=`${v}px`}const b=!!p.options.horizontal,x=y.mode==="transform",w=b?"left":"top",_=p.options.scrollMargin,E=p.getVirtualItems();for(const R of E){const T=R.start-_,O=p.elementsCache.get(R.key);O&&y.lastPositions.get(O)!==T&&(y.lastPositions.set(O,T),x?O.style.transform=b?`translate3d(${T}px, 0, 0)`:`translate3d(0, ${T}px, 0)`:O.style[w]=`${T}px`)}},d={...i,onChange:(p,y)=>{var v;const b=l.current;let x=!0;if(b.enabled){u(p);const w=p.range,_=b.prevRange;x=!_||_.isScrolling!==p.isScrolling||_.startIndex!==w?.startIndex||_.endIndex!==w?.endIndex,x&&(b.prevRange=w?{startIndex:w.startIndex,endIndex:w.endIndex,isScrolling:p.isScrolling}:null)}x&&(e&&y?ki.flushSync(o):o()),(v=i.onChange)==null||v.call(i,p,y)}},[m]=S.useState(()=>{const p=new zI(d);return Object.assign(p,{containerRef:y=>{const v=l.current;if(v.container=y,v.lastSize=null,y&&v.enabled){const b=p.getTotalSize();v.lastSize=b;const x=p.options.horizontal?"width":"height";y.style[x]=`${b}px`}}})});return m.setOptions(d),om(()=>m._didMount(),[]),om(()=>m._willUpdate()),om(()=>{u(m)}),m}function PI(e){return II({observeElementRect:TI,observeElementOffset:MI,scrollToFn:kI,...e})}function FI(e,t){const r=[],i=(o,l)=>{for(const u of o)r.push({node:u,depth:l}),u.dir&&t.has(u.path)&&i(u.children||[],l+1)};return i(e?.children||[],0),r}function VI(e){const{root:t,expanded:r,onToggle:i,currentPath:o,listingShowing:l,onOpen:u}=e,d=S.useRef(null),m=S.useMemo(()=>FI(t,r),[t,r]),p=PI({count:m.length,getScrollElement:()=>d.current,estimateSize:()=>window.matchMedia("(max-width: 768px)").matches?44:28,overscan:12,getItemKey:y=>m[y].node.path});return S.useEffect(()=>{if(!o)return;const y=m.findIndex(v=>v.node.path===o);y>=0&&p.scrollToIndex(y,{align:"auto"})},[o,m]),f.jsx("nav",{id:"tree","aria-label":"Files",ref:d,children:f.jsx("div",{style:{height:p.getTotalSize(),position:"relative"},children:p.getVirtualItems().map(y=>{const{node:v,depth:b}=m[y.index],x=v.dir?r.has(v.path):!1,w=()=>{if(v.dir&&o===v.path&&l){i(v.path);return}u(v.path),v.dir||hr()};return f.jsxs("div",{className:"row "+(v.dir?"dir":"file")+(o===v.path?" active":"")+(v.dir&&!x?" collapsed":""),"data-path":v.path,tabIndex:0,role:"button",title:v.name,"aria-expanded":v.dir?x:void 0,style:{position:"absolute",top:0,left:0,right:0,transform:`translateY(${y.start}px)`,paddingLeft:8+b*13},onClick:w,onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),w())},children:[Array.from({length:b},(_,E)=>f.jsx("span",{className:"tguide",style:{left:8+E*13+5},"aria-hidden":"true"},E)),f.jsx("span",{className:"chev",onClick:_=>{v.dir&&(_.stopPropagation(),i(v.path))},children:f.jsx(rt,{name:"chevd"})}),f.jsx("span",{className:"ticon",children:f.jsx(rt,{name:v.dir?"folder":"doc"})}),f.jsx("span",{className:"label",children:v.name})]},y.key)})})})}function UI(e){const t=e.split("/"),r=[];let i="";for(let o=0;o{i=i?i+"/"+o:o;const u=i,d=l===r.length-1;return f.jsxs("span",{children:[l>0&&f.jsx("span",{className:"crumb-sep",children:"/"}),d?f.jsx("span",{children:o}):f.jsx("span",{className:"crumb-seg",title:u,onClick:()=>t(u),children:o})]},u)})})}const BI=/\.bdrive-conflict-([A-Za-z0-9_-]{0,32})-(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z$/;function YC(e){const t=BI.exec(e);if(!t)return null;const[,r,i,o,l,u,d,m]=t,p=new Date(Date.UTC(+i,+o-1,+l,+u,+d,+m));return p.getUTCFullYear()!==+i||p.getUTCMonth()!==+o-1||p.getUTCDate()!==+l||p.getUTCHours()!==+u||p.getUTCMinutes()!==+d||p.getUTCSeconds()!==+m?null:{original:e.slice(0,t.index),device:r,when:p}}function uw(e){if(e==="")return[];const t=e.split(` +`);return t[t.length-1]===""&&t.pop(),t}const qI=4e6;function GI(e,t){let r=0;for(;ro.push({op:"-",line:l[v],an:r+v+1}),y=v=>o.push({op:"+",line:u[v],bn:r+v+1});if(d*m>qI){for(let v=0;v=0;w--)for(let _=m-1;_>=0;_--)v[w][_]=l[w]===u[_]?v[w+1][_+1]+1:Math.max(v[w+1][_],v[w][_+1]);let b=0,x=0;for(;b=v[b][x+1]?p(b++):y(x++);for(;bi.op==="+").length,del:r.filter(i=>i.op==="-").length}}const QC=1<<20,KI=8192;function YI(e){if(e.byteLength>QC)return{kind:"too-large",size:e.byteLength};if(e.subarray(0,KI).includes(0))return{kind:"binary"};try{return{kind:"text",text:new TextDecoder("utf-8",{fatal:!0}).decode(e)}}catch{return{kind:"binary"}}}function ep(e,t,r,i){let o=e+"blob?sha="+encodeURIComponent(t);return r&&(o+="&name="+encodeURIComponent(r)),i&&(o+="&download=1"),o}async function QI(e){const t=await Sj(e),r=Number(t.headers.get("Content-Length"));return r>QC?{kind:"too-large",size:r}:YI(new Uint8Array(await t.arrayBuffer()))}function XC(e,t,r,i){return Ft({queryKey:t,queryFn:()=>QI(e),enabled:r,...i?{staleTime:1/0,gcTime:1/0}:{},retry:!1})}function dw(e,t,r){return XC(t?ep(e,t):"",["blob",e,t],!!t,!0)}function XI(e){return e.slice(e.lastIndexOf("/")+1)}function JI({apiBase:e,path:t,prev:r,cur:i}){const o=XI(t);return f.jsxs("span",{className:"dv-dl",children:[f.jsx("a",{href:ep(e,r,o,!0),children:"download previous"}),f.jsx("a",{href:ep(e,i,o,!0),children:"download this version"})]})}function WI({apiBase:e,path:t,prev:r,cur:i}){const o=dw(e,r),l=dw(e,i),u=o.data?.kind==="text"&&l.data?.kind==="text",d=S.useMemo(()=>o.data?.kind==="text"&&l.data?.kind==="text"?ZI(o.data.text,l.data.text):null,[o.data,l.data]);if(o.error||l.error)return f.jsx("div",{className:"dv dv-msg",children:"Could not load one of the versions."});if(!o.data||!l.data)return f.jsx("div",{className:"dv dv-msg",children:"Loading changes…"});if(!u){const v=o.data.kind==="too-large"||l.data.kind==="too-large";return f.jsxs("div",{className:"dv dv-msg",children:[v?"Too large to diff — download to compare.":"Binary file — no diff available.",f.jsx(JI,{apiBase:e,path:t,prev:r,cur:i})]})}const{lines:m,add:p,del:y}=d;return f.jsxs("div",{className:"dv",children:[f.jsxs("div",{className:"dv-head",children:[f.jsxs("span",{className:"dv-stat",children:[f.jsxs("span",{className:"dv-add",children:["+",p]})," ",f.jsxs("span",{className:"dv-del",children:["−",y]})]}),p===0&&y===0&&f.jsx("span",{className:"dv-same",children:"No line changes"})]}),f.jsx("div",{className:"dv-body",children:m.map((v,b)=>f.jsxs("div",{className:"dv-line dv-"+(v.op==="="?"ctx":v.op==="+"?"ins":"rm"),children:[f.jsx("span",{className:"dv-n",children:v.an??""}),f.jsx("span",{className:"dv-n",children:v.bn??""}),f.jsx("span",{className:"dv-mark",children:v.op==="="?" ":v.op}),f.jsx("span",{className:"dv-text",children:v.line||" "})]},b))})]})}const eP={add:"added",edit:"edited",delete:"deleted"};function JC({text:e}){return f.jsx(f.Fragment,{children:e.split(/(https?:\/\/\S+)/).map((t,r)=>/^https?:\/\//.test(t)?f.jsx("a",{href:t,target:"_blank",rel:"noopener",children:t},r):t)})}function vg({entry:e,apiBase:t,onOpen:r,diff:i,restore:o,remove:l,restoreSha:u,recreates:d,inRun:m,read:p}){const[y,v]=S.useState(!1),[b,x]=S.useState(!1),w=e.kind==="put"?"edit":e.kind,_=fd(e),E=[e.device.name||e.device.id,e.device.os].filter(Boolean).join(" · "),R=w!=="delete",T=!!i&&w!=="delete"&&!!e.blob,O=!!m&&w==="add",N=!!o&&!!u&&!O,z=!!l&&O,B=!!o?.busy&&o.busy===e.path+u,H=!!l?.busy&&l.busy===e.path,I=R&&!!e.blob,ne=e.path.split("/").pop()||e.path,ge=new Date(e.time).toLocaleString(),pe=t+"blob?sha="+e.blob+"&name="+encodeURIComponent(ne)+"&download=1",he=()=>x(!b),de=ee=>{ee.target.tagName!=="A"&&R&&r(e.path,e.blob)};return f.jsxs("div",{className:"hentry "+w+(R?" clickable":""),tabIndex:R?0:void 0,role:R?"button":void 0,onClick:de,onKeyDown:ee=>{R&&(ee.key==="Enter"||ee.key===" ")&&(ee.preventDefault(),r(e.path,e.blob))},children:[f.jsxs("div",{className:"hline",children:[f.jsx("span",{className:"hkind",children:eP[w]||w}),p&&f.jsx("span",{className:"hread",title:"This run read this file before changing it",children:"read"}),f.jsx("span",{className:"hpath",children:e.path}),f.jsx("span",{className:"htime",children:ge})]}),f.jsxs("div",{className:"hmeta",children:[f.jsx("span",{className:"hwho",children:_}),f.jsx("span",{className:"hdev",children:E}),f.jsx("span",{className:"hsize",children:e.size?gg(e.size):""}),N&&f.jsxs("button",{type:"button",className:"hrestore-btn",disabled:B,title:"Put this version of "+e.path+" back as a new change",onClick:ee=>{ee.stopPropagation(),o.onRestore(e.path,u,!!d)},onKeyDown:ee=>ee.stopPropagation(),children:[f.jsx(rt,{name:"hist"}),B?"restoring…":"restore"]}),z&&f.jsxs("button",{type:"button",className:"hremove-btn",disabled:H,title:"Remove "+e.path+" — this run created it",onClick:ee=>{ee.stopPropagation(),l.onRemove(e.path)},onKeyDown:ee=>ee.stopPropagation(),children:[f.jsx(rt,{name:"trash"}),H?"removing…":"undo — remove file"]})]}),e.note&&!m&&f.jsx("div",{className:"hnote"+(y?" open":""),tabIndex:0,role:"button",title:y?"Collapse note":"Show full note","aria-expanded":y,onClick:ee=>{ee.stopPropagation(),ee.target.tagName!=="A"&&v(!y)},onKeyDown:ee=>{(ee.key==="Enter"||ee.key===" ")&&(ee.preventDefault(),ee.stopPropagation(),v(!y))},children:f.jsx(JC,{text:e.note})}),(T||I)&&f.jsxs("div",{className:"hactions",children:[T&&(i.prev?f.jsxs("button",{type:"button",className:"hdiff-btn"+(b?" open":""),"aria-expanded":b,onClick:ee=>{ee.stopPropagation(),he()},onKeyDown:ee=>ee.stopPropagation(),children:[f.jsx(rt,{name:b?"chevd":"chev"}),b?"hide changes":"show changes"]}):f.jsx("div",{className:"hdiff-none",children:"First version — nothing to compare against"})),I&&f.jsxs(f.Fragment,{children:[f.jsxs("button",{type:"button",className:"hver-btn","aria-label":`Open ${ne} as of ${ge}`,onClick:ee=>{ee.stopPropagation(),r(e.path,e.blob)},onKeyDown:ee=>ee.stopPropagation(),children:[f.jsx(rt,{name:"clock"}),"Open this version"]}),f.jsxs("a",{className:"hver-btn",download:!0,href:pe,"aria-label":`Download ${ne} as of ${ge}`,onClick:ee=>ee.stopPropagation(),onKeyDown:ee=>{ee.stopPropagation(),ee.key===" "&&(ee.preventDefault(),ee.currentTarget.click())},children:[f.jsx(rt,{name:"download"}),"Download"]})]})]}),T&&i.prev&&b&&f.jsx("div",{onClick:ee=>ee.stopPropagation(),children:f.jsx(WI,{apiBase:i.apiBase,path:e.path,prev:i.prev,cur:e.blob})})]})}function tP(e){const{node:t,heatMap:r,onOpen:i}=e,o=(t.children||[]).slice().sort((y,v)=>Number(v.dir||!1)-Number(y.dir||!1)||y.name.localeCompare(v.name)),l=o.filter(y=>y.dir).length,u=o.length-l,d=[];l&&d.push(l+(l===1?" folder":" folders")),u&&d.push(u+(u===1?" file":" files"));const m=am(r,t.path,!0);m&&d.push(el(m)+" in 30 days");const p=!!m||o.some(y=>am(r,y.path,!!y.dir));return f.jsxs("div",{className:"dirlist",children:[f.jsxs("h1",{className:"dl-title",children:[f.jsx("span",{className:"dl-title-icon",children:f.jsx(rt,{name:"folder"})}),f.jsx("span",{children:t.name})]}),f.jsx("p",{className:"dl-sub",children:d.join(" · ")||"Empty folder"}),p&&f.jsx("p",{className:"dl-heatnote",children:Ci}),o.length===0?f.jsx("div",{className:"dl-empty",children:"Nothing in this folder yet."}):f.jsx("div",{className:"dl-items",children:o.map(y=>{let v="";if(y.dir){const _=(y.children||[]).length;v=_+(_===1?" item":" items")}else v=[y.size?gg(y.size):"",y.time?new Date(y.time).toLocaleDateString():""].filter(Boolean).join(" · ");const b=am(r,y.path,!!y.dir);b&&(v=el(b)+(v?" · "+v:""));const x=y.dir?null:YC(y.path),w=y.dir?"":ZC(b,y.time);return f.jsxs("div",{className:"dl-row",tabIndex:0,role:"button",title:y.path,onClick:()=>i(y.path),onKeyDown:_=>{(_.key==="Enter"||_.key===" ")&&(_.preventDefault(),i(y.path))},children:[f.jsx("span",{className:"ticon",children:f.jsx(rt,{name:y.dir?"folder":"doc"})}),f.jsx("span",{className:"dl-name",children:y.name}),x&&f.jsx("span",{className:"dl-conflict","aria-label":"Conflict copy: a concurrent edit from "+(x.device||"another device")+" that beardrive preserved instead of dropping.",title:"A concurrent edit from "+(x.device||"another device")+" that beardrive preserved instead of dropping.",children:"conflict copy"}),w&&f.jsx("span",{className:"stalemark",role:"img","aria-label":"Warning: "+w,title:"Read often, but "+w,children:"⚠"}),b&&f.jsx("span",{className:"heatdot lvl"+lI(b),role:"img","aria-label":el(b)+" in 30 days. "+Ci,title:el(b)+" in 30 days. "+Ci}),f.jsx("span",{className:"dl-meta",children:v})]},y.path)})}),e.hub&&f.jsx(nP,{apiBase:e.apiBase,prefix:t.path+"/",onOpen:i,onFullHistory:()=>e.onFullHistory(t.path+"/"),onRendered:e.onRendered})]})}function nP(e){const t=SI(e.apiBase,e.prefix,!0),{onRendered:r}=e;return S.useEffect(()=>{t&&t.length&&r&&r()},[t,r]),!t||t.length===0?null:f.jsxs("div",{className:"dl-history",children:[f.jsx("h3",{className:"dl-h3",children:"Recent changes"}),f.jsx("div",{className:"history dl-hlist",children:t.map((i,o)=>f.jsx(vg,{entry:i,apiBase:e.apiBase,onOpen:e.onOpen},o))}),f.jsx("button",{className:"ai-btn dl-more",onClick:e.onFullHistory,children:"Full history"})]})}const WC=5e3;function rP(e,t,r=WC){const i=[];let o=[],l="",u=!1,d=0;const m=()=>{o.push(l),l="",i.length()=>o(""),[r,o]),E$.test(r)?f.jsx(oP,{...e}):AC.test(r)?f.jsx("iframe",{className:"htmlview",sandbox:"allow-scripts",src:l,title:r,onLoad:e.onRendered}):MC.test(r)?f.jsx("iframe",{className:"pdfview",src:l,title:r,onLoad:e.onRendered}):R$.test(r)?f.jsx(uP,{src:l,alt:r,version:i,onRendered:e.onRendered}):j$.test(r)?f.jsx(fw,{...e,fileURL:l,delim:/\.tsv$/i.test(r)?" ":","}):T$.test(r)?f.jsx(fw,{...e,fileURL:l}):f.jsx(iP,{...e,fileURL:l})}function iP(e){const{apiBase:t,path:r,version:i,fileURL:o,onRendered:l}=e,{data:u,error:d}=XC(o,["text",o],!0,!!i);return S.useEffect(()=>{u&&l?.()},[u,l]),d?f.jsx(hd,{version:i,err:d}):u?u.kind==="text"?f.jsx("pre",{className:"plain",children:u.text},r):f.jsx(sP,{apiBase:t,path:r,version:i,fileURL:o,children:u.kind==="too-large"?`Too large to preview (${gg(u.size)}).`:"No preview for this file type."}):null}function sP(e){const{apiBase:t,path:r,version:i,fileURL:o}=e;return f.jsxs("div",{className:"filecard",children:[f.jsx("div",{className:"name",children:r.split("/").pop()}),f.jsx("p",{children:e.children}),f.jsx("a",{className:"btn",download:!0,href:i?o+"&download=1":t+"download?path="+encodeURIComponent(r),children:"Download"})]})}function oP(e){const{apiBase:t,path:r,version:i,heatMap:o,flatFiles:l,projectId:u,onOpenFile:d,onMeta:m,onRendered:p}=e,{data:y,error:v}=Ft({queryKey:["render",t,r,i||""],queryFn:()=>qt(t+"render?path="+encodeURIComponent(r)+(i?"&sha="+i:"")),retry:i?!1:void 0}),b=S.useMemo(()=>y?cP(y.html,r,t,l,u):"",[y,r,t,l,u]),[x,w]=S.useState(null);return S.useEffect(()=>{if(w(null),!S2(b))return;let _=!1;return _2(b).then(E=>{_||w(E)}),()=>{_=!0}},[b]),S.useEffect(()=>{if(!y)return;const _=[],E=i?null:o&&o[y.path],R=ZC(E||null,y.time);(y.user_name||y.user||y.author)&&_.push(fd(y)+(y.device?" on "+y.device:"")),y.time&&_.push(new Date(y.time).toLocaleString());const T=E&&na(E)?el(E)+" / 30d":"",O=R?f.jsxs("span",{className:"meta-stale",title:R,children:[f.jsx("span",{"aria-hidden":"true",children:"⚠ "}),R]}):null;m(T?f.jsxs(f.Fragment,{children:[O,O?" · ":"",_.length?_.join(" · ")+" · ":"",f.jsxs("span",{title:Ci,children:[T,f.jsxs("span",{className:"sr-only",children:[" — ",Ci]})]})]}):O?f.jsxs(f.Fragment,{children:[O,_.length?" · "+_.join(" · "):""]}):_.join(" · ")),p?.()},[y,i,o,m,p]),v?f.jsx(hd,{version:i,err:v}):y?f.jsx("div",{dangerouslySetInnerHTML:{__html:x??b},onClick:_=>lP(_,r,d)}):null}function lP(e,t,r){const i=e.target.closest("a");if(!i||!e.currentTarget.contains(i)||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0)return;const o=i.getAttribute("href")||"",l=t.includes("/")?t.slice(0,t.lastIndexOf("/")):"",u=i.getAttribute("data-wiki");u!==null?(e.preventDefault(),r(u)):/^([a-z]+:|\/|#)/i.test(o)||(e.preventDefault(),r(NC(l,decodeURIComponent(o))))}function cP(e,t,r,i,o){const l=t.includes("/")?t.slice(0,t.lastIndexOf("/")):"",u=m=>r+"file?path="+encodeURIComponent(m),d=new DOMParser().parseFromString(e,"text/html");for(const m of d.querySelectorAll("img")){const p=m.getAttribute("src")||"";/^\s*data:image\/svg/i.test(p)?m.removeAttribute("src"):/^([a-z]+:|\/)/i.test(p)||m.setAttribute("src",u(NC(l,p)))}for(const m of d.querySelectorAll("a")){const p=m.getAttribute("href")||"";if(p.startsWith("wiki:")){const y=O$(decodeURIComponent(p.slice(5)),i);y?(m.setAttribute("href",Gs(y.path,o)),m.setAttribute("data-wiki",y.path)):(m.removeAttribute("href"),m.classList.add("wiki-missing"),m.setAttribute("title","No file matches this wikilink"));continue}/^\s*data:/i.test(p)?m.removeAttribute("href"):/^https?:/i.test(p)&&(m.setAttribute("target","_blank"),m.setAttribute("rel","noopener"))}return d.body.innerHTML}function uP(e){const[t,r]=S.useState(!1);return t?f.jsx(hd,{version:e.version,err:new Error("could not be loaded")}):f.jsx("img",{src:e.src,alt:e.alt,onLoad:e.onRendered,onError:()=>r(!0)})}function hd({version:e,err:t}){return f.jsx("div",{className:"empty",children:e?"That version isn't available.":"Could not load file: "+t.message})}function fw(e){const{path:t,version:r,fileURL:i,delim:o,onRendered:l}=e,{data:u,error:d}=Ft({queryKey:["text",i],queryFn:async()=>{const p=await fetch(i);if(!p.ok)throw new Error(await p.text());return p.text()},retry:r?!1:void 0});S.useEffect(()=>{u!=null&&l?.()},[u,l]);const m=S.useMemo(()=>o&&u!=null?rP(u,o,WC):null,[u,o]);return d?f.jsx(hd,{version:r,err:d}):u==null?null:m?f.jsx(dP,{csv:m},t):f.jsx("pre",{className:"plain",children:u},t)}function dP({csv:e}){const[t,...r]=e.rows,i=e.rows.reduce((l,u)=>Math.max(l,u.length),0),o=Array.from({length:i},(l,u)=>u);return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"csvbox",children:f.jsxs("table",{className:"csvview",children:[f.jsx("thead",{children:f.jsx("tr",{children:o.map(l=>f.jsx("th",{children:t[l]??""},l))})}),f.jsx("tbody",{children:r.map((l,u)=>f.jsx("tr",{children:o.map(d=>f.jsx("td",{children:l[d]??""},d))},u))})]})}),e.truncated>0&&f.jsxs("p",{className:"csvnote",children:["showing ",e.rows.length.toLocaleString()," of"," ",(e.rows.length+e.truncated).toLocaleString()," rows — Download for the rest"]})]})}const fP=[{value:"",label:"Never"},{value:"24h",label:"In 24 hours"},{value:"168h",label:"In 7 days"},{value:"720h",label:"In 30 days"}];function hP({url:e,copied:t,onClose:r}){const i=e.split("/s/")[1],[o,l]=S.useState(""),[u,d]=S.useState(),[m,p]=S.useState(!1),y=S.useRef(null);async function v(b){const x=o;l(b),p(!0);try{const w=await Wn("PATCH","/api/shares/"+i,{expires_in:b});d(w.expires)}catch(w){qe(w.message,!0),l(x)}finally{p(!1)}}return f.jsx(Wu,{open:!0,onOpenChange:b=>!b&&r(),children:f.jsxs(ed,{className:"modal",showCloseButton:!1,onOpenAutoFocus:b=>{b.preventDefault(),y.current?.focus()},children:[f.jsx(Cl,{asChild:!0,children:f.jsx("h3",{children:"Public link"})}),f.jsxs("p",{children:[f.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until it expires or you revoke it."]}),f.jsx("div",{className:"modal-url",children:e}),f.jsxs("div",{className:"modal-expiry",children:[f.jsx("label",{htmlFor:"share-expiry",children:"Expires"}),f.jsx("select",{id:"share-expiry",value:o,disabled:m,onChange:b=>v(b.target.value),children:fP.map(b=>f.jsx("option",{value:b.value,children:b.label},b.value))}),f.jsx("span",{className:"modal-expiry-note",children:zC(u)})]}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(xt,{ref:y,variant:"primary",onClick:()=>Mi(e).then(b=>qe(b?"Copied.":"Select and copy the link above.")),children:t?"Copied ✓":"Copy link"}),f.jsx(xt,{variant:"subtle",onClick:()=>window.open(e,"_blank"),children:"Open"}),f.jsx(xt,{variant:"subtle",onClick:r,children:"Done"})]})]})})}function mP({shares:e,canRevoke:t,onChanged:r}){return e.length===0?null:f.jsxs("div",{className:"share-banner",role:"status",children:[f.jsxs("div",{className:"sb-head",children:[f.jsx(rt,{name:"share"}),f.jsx("b",{children:"Publicly shared"}),f.jsxs("span",{className:"sb-count",children:[e.length," active link",e.length>1?"s":""]})]}),f.jsxs("p",{className:"sb-note",children:[f.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until you revoke it.",e.some(i=>i.opens!==void 0)&&f.jsxs(f.Fragment,{children:[" ",$C]})]}),e.map(i=>f.jsxs("div",{className:"sb-link",children:[f.jsx("span",{className:"sb-url mono",title:i.url,children:i.url}),f.jsx("span",{className:"sb-meta",children:LC(i,!1)}),f.jsxs("span",{className:"sb-actions",children:[f.jsx(xt,{variant:"subtle",onClick:()=>Mi(i.url).then(o=>qe(o?"Copied.":"Select and copy the link.")),children:"Copy link"}),f.jsx(xt,{variant:"subtle",onClick:()=>window.open(i.url,"_blank"),children:"Open"}),t&&f.jsx("button",{className:"ai-del","aria-label":`Revoke the share of ${i.path}`,onClick:()=>PC(i,r),children:"Revoke"})]})]},i.token))]})}var hw=1,pP=.9,gP=.8,vP=.17,lm=.1,cm=.999,yP=.9999,bP=.99,xP=/[\\\/_+.#"@\[\(\{&]/,wP=/[\\\/_+.#"@\[\(\{&]/g,SP=/[\s-]/,eE=/[\s-]/g;function tp(e,t,r,i,o,l,u){if(l===t.length)return o===e.length?hw:bP;var d=`${o},${l}`;if(u[d]!==void 0)return u[d];for(var m=i.charAt(l),p=r.indexOf(m,o),y=0,v,b,x,w;p>=0;)v=tp(e,t,r,i,p+1,l+1,u),v>y&&(p===o?v*=hw:xP.test(e.charAt(p-1))?(v*=gP,x=e.slice(o,p-1).match(wP),x&&o>0&&(v*=Math.pow(cm,x.length))):SP.test(e.charAt(p-1))?(v*=pP,w=e.slice(o,p-1).match(eE),w&&o>0&&(v*=Math.pow(cm,w.length))):(v*=vP,o>0&&(v*=Math.pow(cm,p-o))),e.charAt(p)!==t.charAt(l)&&(v*=yP)),(vv&&(v=b*lm)),v>y&&(y=v),p=r.indexOf(m,p+1);return u[d]=y,y}function mw(e){return e.toLowerCase().replace(eE," ")}function _P(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,tp(e,t,mw(e),mw(t),0,0,{})}var Yo='[cmdk-group=""]',um='[cmdk-group-items=""]',CP='[cmdk-group-heading=""]',tE='[cmdk-item=""]',pw=`${tE}:not([aria-disabled="true"])`,np="cmdk-item-select",Ds="data-value",EP=(e,t,r)=>_P(e,t,r),nE=S.createContext(void 0),Tl=()=>S.useContext(nE),rE=S.createContext(void 0),yg=()=>S.useContext(rE),aE=S.createContext(void 0),iE=S.forwardRef((e,t)=>{let r=ks(()=>{var M,U;return{search:"",value:(U=(M=e.value)!=null?M:e.defaultValue)!=null?U:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),i=ks(()=>new Set),o=ks(()=>new Map),l=ks(()=>new Map),u=ks(()=>new Set),d=sE(e),{label:m,children:p,value:y,onValueChange:v,filter:b,shouldFilter:x,loop:w,disablePointerSelection:_=!1,vimBindings:E=!0,...R}=e,T=fn(),O=fn(),N=fn(),k=S.useRef(null),B=LP();Ni(()=>{if(y!==void 0){let M=y.trim();r.current.value=M,H.emit()}},[y]),Ni(()=>{B(6,ue)},[]);let H=S.useMemo(()=>({subscribe:M=>(u.current.add(M),()=>u.current.delete(M)),snapshot:()=>r.current,setState:(M,U,Q)=>{var K,de,re,xe;if(!Object.is(r.current[M],U)){if(r.current[M]=U,M==="search")fe(),be(),B(1,pe);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let we=document.getElementById(N);we?we.focus():(K=document.getElementById(T))==null||K.focus()}if(B(7,()=>{var we;r.current.selectedItemId=(we=ee())==null?void 0:we.id,H.emit()}),Q||B(5,ue),((de=d.current)==null?void 0:de.value)!==void 0){let we=U??"";(xe=(re=d.current).onValueChange)==null||xe.call(re,we);return}}H.emit()}},emit:()=>{u.current.forEach(M=>M())}}),[]),$=S.useMemo(()=>({value:(M,U,Q)=>{var K;U!==((K=l.current.get(M))==null?void 0:K.value)&&(l.current.set(M,{value:U,keywords:Q}),r.current.filtered.items.set(M,he(U,Q)),B(2,()=>{be(),H.emit()}))},item:(M,U)=>(i.current.add(M),U&&(o.current.has(U)?o.current.get(U).add(M):o.current.set(U,new Set([M]))),B(3,()=>{fe(),be(),r.current.value||pe(),H.emit()}),()=>{l.current.delete(M),i.current.delete(M),r.current.filtered.items.delete(M);let Q=ee();B(4,()=>{fe(),Q?.getAttribute("id")===M&&pe(),H.emit()})}),group:M=>(o.current.has(M)||o.current.set(M,new Set),()=>{l.current.delete(M),o.current.delete(M)}),filter:()=>d.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:T,inputId:N,labelId:O,listInnerRef:k}),[]);function he(M,U){var Q,K;let de=(K=(Q=d.current)==null?void 0:Q.filter)!=null?K:EP;return M?de(M,r.current.search,U):0}function be(){if(!r.current.search||d.current.shouldFilter===!1)return;let M=r.current.filtered.items,U=[];r.current.filtered.groups.forEach(K=>{let de=o.current.get(K),re=0;de.forEach(xe=>{let we=M.get(xe);re=Math.max(we,re)}),U.push([K,re])});let Q=k.current;ve().sort((K,de)=>{var re,xe;let we=K.getAttribute("id"),Me=de.getAttribute("id");return((re=M.get(Me))!=null?re:0)-((xe=M.get(we))!=null?xe:0)}).forEach(K=>{let de=K.closest(um);de?de.appendChild(K.parentElement===de?K:K.closest(`${um} > *`)):Q.appendChild(K.parentElement===Q?K:K.closest(`${um} > *`))}),U.sort((K,de)=>de[1]-K[1]).forEach(K=>{var de;let re=(de=k.current)==null?void 0:de.querySelector(`${Yo}[${Ds}="${encodeURIComponent(K[0])}"]`);re?.parentElement.appendChild(re)})}function pe(){let M=ve().find(Q=>Q.getAttribute("aria-disabled")!=="true"),U=M?.getAttribute(Ds);H.setState("value",U||void 0)}function fe(){var M,U,Q,K;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=i.current.size;return}r.current.filtered.groups=new Set;let de=0;for(let re of i.current){let xe=(U=(M=l.current.get(re))==null?void 0:M.value)!=null?U:"",we=(K=(Q=l.current.get(re))==null?void 0:Q.keywords)!=null?K:[],Me=he(xe,we);r.current.filtered.items.set(re,Me),Me>0&&de++}for(let[re,xe]of o.current)for(let we of xe)if(r.current.filtered.items.get(we)>0){r.current.filtered.groups.add(re);break}r.current.filtered.count=de}function ue(){var M,U,Q;let K=ee();K&&(((M=K.parentElement)==null?void 0:M.firstChild)===K&&((Q=(U=K.closest(Yo))==null?void 0:U.querySelector(CP))==null||Q.scrollIntoView({block:"nearest"})),K.scrollIntoView({block:"nearest"}))}function ee(){var M;return(M=k.current)==null?void 0:M.querySelector(`${tE}[aria-selected="true"]`)}function ve(){var M;return Array.from(((M=k.current)==null?void 0:M.querySelectorAll(pw))||[])}function L(M){let U=ve()[M];U&&H.setState("value",U.getAttribute(Ds))}function Z(M){var U;let Q=ee(),K=ve(),de=K.findIndex(xe=>xe===Q),re=K[de+M];(U=d.current)!=null&&U.loop&&(re=de+M<0?K[K.length-1]:de+M===K.length?K[0]:K[de+M]),re&&H.setState("value",re.getAttribute(Ds))}function ne(M){let U=ee(),Q=U?.closest(Yo),K;for(;Q&&!K;)Q=M>0?kP(Q,Yo):zP(Q,Yo),K=Q?.querySelector(pw);K?H.setState("value",K.getAttribute(Ds)):Z(M)}let X=()=>L(ve().length-1),te=M=>{M.preventDefault(),M.metaKey?X():M.altKey?ne(1):Z(1)},D=M=>{M.preventDefault(),M.metaKey?L(0):M.altKey?ne(-1):Z(-1)};return S.createElement(Pe.div,{ref:t,tabIndex:-1,...R,"cmdk-root":"",onKeyDown:M=>{var U;(U=R.onKeyDown)==null||U.call(R,M);let Q=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||Q))switch(M.key){case"n":case"j":{E&&M.ctrlKey&&te(M);break}case"ArrowDown":{te(M);break}case"p":case"k":{E&&M.ctrlKey&&D(M);break}case"ArrowUp":{D(M);break}case"Home":{M.preventDefault(),L(0);break}case"End":{M.preventDefault(),X();break}case"Enter":{M.preventDefault();let K=ee();if(K){let de=new Event(np);K.dispatchEvent(de)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:$.inputId,id:$.labelId,style:IP},m),pd(e,M=>S.createElement(rE.Provider,{value:H},S.createElement(nE.Provider,{value:$},M))))}),RP=S.forwardRef((e,t)=>{var r,i;let o=fn(),l=S.useRef(null),u=S.useContext(aE),d=Tl(),m=sE(e),p=(i=(r=m.current)==null?void 0:r.forceMount)!=null?i:u?.forceMount;Ni(()=>{if(!p)return d.item(o,u?.id)},[p]);let y=oE(o,l,[e.value,e.children,l],e.keywords),v=yg(),b=Za(B=>B.value&&B.value===y.current),x=Za(B=>p||d.filter()===!1?!0:B.search?B.filtered.items.get(o)>0:!0);S.useEffect(()=>{let B=l.current;if(!(!B||e.disabled))return B.addEventListener(np,w),()=>B.removeEventListener(np,w)},[x,e.onSelect,e.disabled]);function w(){var B,H;_(),(H=(B=m.current).onSelect)==null||H.call(B,y.current)}function _(){v.setState("value",y.current,!0)}if(!x)return null;let{disabled:E,value:R,onSelect:T,forceMount:O,keywords:N,...k}=e;return S.createElement(Pe.div,{ref:Us(l,t),...k,id:o,"cmdk-item":"",role:"option","aria-disabled":!!E,"aria-selected":!!b,"data-disabled":!!E,"data-selected":!!b,onPointerMove:E||d.getDisablePointerSelection()?void 0:_,onClick:E?void 0:w},e.children)}),jP=S.forwardRef((e,t)=>{let{heading:r,children:i,forceMount:o,...l}=e,u=fn(),d=S.useRef(null),m=S.useRef(null),p=fn(),y=Tl(),v=Za(x=>o||y.filter()===!1?!0:x.search?x.filtered.groups.has(u):!0);Ni(()=>y.group(u),[]),oE(u,d,[e.value,e.heading,m]);let b=S.useMemo(()=>({id:u,forceMount:o}),[o]);return S.createElement(Pe.div,{ref:Us(d,t),...l,"cmdk-group":"",role:"presentation",hidden:v?void 0:!0},r&&S.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:p},r),pd(e,x=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?p:void 0},S.createElement(aE.Provider,{value:b},x))))}),TP=S.forwardRef((e,t)=>{let{alwaysRender:r,...i}=e,o=S.useRef(null),l=Za(u=>!u.search);return!r&&!l?null:S.createElement(Pe.div,{ref:Us(o,t),...i,"cmdk-separator":"",role:"separator"})}),OP=S.forwardRef((e,t)=>{let{onValueChange:r,...i}=e,o=e.value!=null,l=yg(),u=Za(p=>p.search),d=Za(p=>p.selectedItemId),m=Tl();return S.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),S.createElement(Pe.input,{ref:t,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":d,id:m.inputId,type:"text",value:o?e.value:u,onChange:p=>{o||l.setState("search",p.target.value),r?.(p.target.value)}})}),AP=S.forwardRef((e,t)=>{let{children:r,label:i="Suggestions",...o}=e,l=S.useRef(null),u=S.useRef(null),d=Za(p=>p.selectedItemId),m=Tl();return S.useEffect(()=>{if(u.current&&l.current){let p=u.current,y=l.current,v,b=new ResizeObserver(()=>{v=requestAnimationFrame(()=>{let x=p.offsetHeight;y.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return b.observe(p),()=>{cancelAnimationFrame(v),b.unobserve(p)}}},[]),S.createElement(Pe.div,{ref:Us(l,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":i,id:m.listId},pd(e,p=>S.createElement("div",{ref:Us(u,m.listInnerRef),"cmdk-list-sizer":""},p)))}),MP=S.forwardRef((e,t)=>{let{open:r,onOpenChange:i,overlayClassName:o,contentClassName:l,container:u,...d}=e;return S.createElement(pp,{open:r,onOpenChange:i},S.createElement(vp,{container:u},S.createElement(yp,{"cmdk-overlay":"",className:o}),S.createElement(bp,{"aria-label":e.label,"cmdk-dialog":"",className:l},S.createElement(iE,{ref:t,...d}))))}),NP=S.forwardRef((e,t)=>Za(r=>r.filtered.count===0)?S.createElement(Pe.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),DP=S.forwardRef((e,t)=>{let{progress:r,children:i,label:o="Loading...",...l}=e;return S.createElement(Pe.div,{ref:t,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},pd(e,u=>S.createElement("div",{"aria-hidden":!0},u)))}),md=Object.assign(iE,{List:AP,Item:RP,Input:OP,Group:jP,Separator:TP,Dialog:MP,Empty:NP,Loading:DP});function kP(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function zP(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function sE(e){let t=S.useRef(e);return Ni(()=>{t.current=e}),t}var Ni=typeof window>"u"?S.useEffect:S.useLayoutEffect;function ks(e){let t=S.useRef();return t.current===void 0&&(t.current=e()),t}function Za(e){let t=yg(),r=()=>e(t.snapshot());return S.useSyncExternalStore(t.subscribe,r,r)}function oE(e,t,r,i=[]){let o=S.useRef(),l=Tl();return Ni(()=>{var u;let d=(()=>{var p;for(let y of r){if(typeof y=="string")return y.trim();if(typeof y=="object"&&"current"in y)return y.current?(p=y.current.textContent)==null?void 0:p.trim():o.current}})(),m=i.map(p=>p.trim());l.value(e,d,m),(u=t.current)==null||u.setAttribute(Ds,d),o.current=d}),o}var LP=()=>{let[e,t]=S.useState(),r=ks(()=>new Map);return Ni(()=>{r.current.forEach(i=>i()),r.current=new Map},[e]),(i,o)=>{r.current.set(i,o),t({})}};function $P(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function pd({asChild:e,children:t},r){return e&&S.isValidElement(t)?S.cloneElement($P(t),{ref:t.ref},r(t.props.children)):r(t)}var IP={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function PP({className:e,...t}){return f.jsx(md,{"data-slot":"command",className:We("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t})}function FP({className:e,...t}){return f.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[f.jsx(x_,{className:"size-4 shrink-0 opacity-50"}),f.jsx(md.Input,{"data-slot":"command-input",className:We("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function VP({className:e,...t}){return f.jsx(md.List,{"data-slot":"command-list",className:We("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function UP({className:e,...t}){return f.jsx(md.Item,{"data-slot":"command-item",className:We("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",e),...t})}function gw(e,t){if(!e)return{score:0,hits:[]};const r=e.toLowerCase(),i=t.toLowerCase();let o=0,l=0,u=0;const d=[];for(let m=0;m3&&i.endsWith("ies")?o=i.slice(0,-3)+"y":i.length>3&&i.endsWith("es")?o=i.slice(0,-2):i.length>2&&i.endsWith("s")&&(o=i.slice(0,-1)),o?gw(o,t):null}function BP({text:e,hits:t}){const r=[];let i=0;return t.forEach((o,l)=>{o>i&&r.push(e.slice(i,o)),r.push(f.jsx("b",{children:e[o]},l)),i=o+1}),r.push(e.slice(i)),f.jsx("span",{className:"plabel",children:r})}function qP({open:e,onClose:t,candidates:r}){const[i,o]=S.useState(""),l=S.useMemo(()=>{if(!e)return[];const d=[];for(const m of r()){const p=HP(i,m.label);p&&d.push({...m,score:p.score,hits:p.hits})}return d.sort((m,p)=>p.score-m.score),d.slice(0,40)},[e,i,r]);S.useEffect(()=>{e&&o("")},[e]);const u=d=>{t(),d.run()};return f.jsx(Wu,{open:e,onOpenChange:d=>!d&&t(),children:f.jsxs(ed,{id:"palette",className:"palette",showCloseButton:!1,"aria-describedby":void 0,children:[f.jsx(Cl,{className:"sr-only",children:"Search and quick actions"}),f.jsxs(PP,{shouldFilter:!1,loop:!0,children:[f.jsxs("div",{id:"palette-inputwrap",children:[f.jsx(rt,{name:"search"}),f.jsx(FP,{placeholder:"Search file names, projects, actions…",autoComplete:"off",spellCheck:!1,value:i,onValueChange:o})]}),f.jsx(VP,{children:l.length===0?f.jsx("div",{className:"pempty",children:"No matches — search covers file names, projects, and actions"}):l.map(d=>f.jsxs(UP,{value:d.kind+":"+d.label,onSelect:()=>u(d),children:[f.jsx("span",{className:"picon",children:f.jsx(rt,{name:d.icon})}),f.jsx(BP,{text:d.label,hits:d.hits}),f.jsx("span",{className:"pkind",children:d.kind})]},d.kind+":"+d.label))}),f.jsx("footer",{id:"palette-hint",children:"↑↓ navigate · ⏎ select · esc close"})]})]})})}function GP(e,t){return Ft({queryKey:["heatDevices",e],queryFn:()=>qt(e+"heat?by=device&days=30"),enabled:t,retry:!1,staleTime:6e4}).data?.devices??null}const ZP=["all","human","agent","share"],KP={all:"All reads",human:"Human reads",agent:"Agent reads",share:"Shared reads"},YP={agent:{agent:1,human:0,share:0},human:{agent:0,human:1,share:0},share:{agent:0,human:0,share:1}};function vw(e){const[t,r]=S.useState("all"),{flatFiles:i,heatMap:o,devices:l,scope:u}=e,d=w=>!u||w===u||w.startsWith(u+"/"),m=u?i.filter(w=>d(w.path)):i;if(!e.loading&&!m.length)return f.jsxs("div",{className:"insights",children:[f.jsxs("h1",{className:"in-title",children:["Knowledge insights",u?f.jsxs("span",{className:"in-scope",children:[" · ",u]}):null]}),f.jsxs("div",{className:"dl-empty in-blank",children:[f.jsx("p",{children:u?`Nothing in ${u} to chart yet.`:"Nothing to chart yet."}),f.jsx("p",{children:u?`No files under ${u} are syncing here yet.`:"This project has no files. Once a device syncs files here, the map, the reads × freshness plot and the hot path fill in on their own."}),e.installHref&&f.jsx("a",{className:"pbtn",...Zs(e.installHref),children:"Set up a device →"})]})]});const p=l&&u?l.map(w=>{const _=Object.create(null);for(const[E,R]of Object.entries(w.folders||{}))d(E)&&(_[E]=R);return{...w,folders:_}}).filter(w=>Object.keys(w.folders).length>0):l,y=Date.now(),v=m.map(w=>{const _=o&&o[w.path]||{},E=w.time?Math.max(0,(y-new Date(w.time).getTime())/864e5):0,R=t==="all"?na(_):_[t]||0;return{path:w.path,reads:R,agent:_.agent||0,human:_.human||0,share:_.share||0,total:na(_),days:E,danger:GC(R,E)}}),b=uI(o,new Set(i.map(w=>w.path))).filter(d).map(w=>{const _=o[w];return{path:w,reads:t==="all"?na(_):_[t]||0,agent:_.agent||0,human:_.human||0,share:_.share||0,total:na(_),days:0,danger:!1,orphan:!0}}).filter(w=>w.reads>0),x=b.length>0?f.jsxs("p",{className:"in-legend in-orphan-note",children:[rp(b.length,"file")," with reads ",b.length===1?"is":"are"," no longer in the project — see Hot path."]}):null;return f.jsxs("div",{className:"insights",children:[f.jsxs("h1",{className:"in-title",children:["Knowledge insights",u?f.jsxs("span",{className:"in-scope",children:[" · ",u]}):null]}),f.jsx("p",{className:"dl-sub",children:u?`Reads over the last 30 days × freshness, for ${u} and everything in it. ${Ci}`:"Reads over the last 30 days × how long since each file changed. Hot but stale knowledge — read a lot, maintained by nobody — is the danger zone. "+Ci}),f.jsx("div",{className:"in-lens",children:ZP.map(w=>f.jsx("button",{className:"in-lens-btn"+(w===t?" active":""),onClick:()=>r(w),children:KP[w]},w))}),f.jsx("h3",{className:"dl-h3",children:"Map — cell size = reads, color = freshness (scale below)"}),f.jsx(XP,{pts:v,onOpenFile:e.onOpenFile,onOpenFolder:e.onOpenFolder,isFolder:e.isFolder}),x,f.jsxs("h3",{className:"dl-h3 in-h3-row",children:["Reads × freshness",f.jsx("span",{className:"in-cap",children:"dot size = agent share of reads"})]}),f.jsx(WP,{pts:v,onOpenFile:e.onOpenFile}),x,f.jsx("h3",{className:"dl-h3",children:"Hot path — top files by reads"}),f.jsx(eF,{pts:[...v,...b],lens:t,onOpenFile:e.onOpenFile,onOpenHistory:e.onOpenHistory}),p&&p.length>0&&f.jsxs(f.Fragment,{children:[f.jsx("h3",{className:"dl-h3",children:"Agent coverage — which agents read which areas"}),f.jsx(tF,{devices:p})]})]})}const QP="rgb(150,156,164)";function lE(e){const t=[[76,195,138],[232,196,84],[224,93,93]],r=Math.min(1,Math.max(0,e/300))*(t.length-1),i=Math.min(t.length-2,Math.floor(r)),o=r-i,l=t[i].map((u,d)=>Math.round(u+(t[i+1][d]-u)*o));return`rgb(${l[0]},${l[1]},${l[2]})`}function yw(e,t,r,i,o){const l=e.reduce((p,y)=>p+y.value,0);if(!l||i<=0||o<=0)return[];const u=e.slice().sort((p,y)=>y.value-p.value).map(p=>({it:p,a:p.value/l*i*o})),d=(p,y)=>{const b=p.reduce((w,_)=>w+_.a,0)/y;let x=0;for(const w of p){const _=w.a/b;x=Math.max(x,_/b,b/_)}return x},m=[];for(;u.length;){const p=i>=o,y=p?o:i,v=[u.shift()];for(;u.length&&d(v.concat(u[0]),y)<=d(v,y);)v.push(u.shift());const b=v.reduce((w,_)=>w+_.a,0)/y;let x=0;for(const w of v){const _=w.a/b;p?m.push({item:w.it,x:t,y:r+x,w:b,h:_}):m.push({item:w.it,x:t+x,y:r,w:_,h:b}),x+=_}p?(t+=b,i-=b):(r+=b,o-=b)}return m}const dm=15;function bw(e,t,r){const i=Math.floor((r-8)/6),o=`${e} · ${t}`;return o.length<=i?{label:o,fit:i}:{label:e.length>i?e.slice(0,Math.max(1,i-1))+"…":e,fit:i}}const rp=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function XP({pts:e,onOpenFile:t,onOpenFolder:r,isFolder:i}){const u=fI(e.map(y=>y.days)),d=!!u&&hI(u.min,u.max),m=new Map;for(const y of e){const v=y.path.includes("/")?y.path.split("/")[0]:"/";let b=m.get(v);b||m.set(v,b={name:v,files:[],value:0,reads:0}),b.files.push(y),b.value+=y.reads+1,b.reads+=y.reads}const p=[];for(const y of yw([...m.values()],0,0,720,480)){const v=y.item,b=v.name==="/"?"":v.name,x=v.name==="/"?"(root)":v.name;if(p.push(f.jsx("rect",{x:y.x+1,y:y.y+1,width:Math.max(0,y.w-2),height:Math.max(0,y.h-2),rx:3,className:"in-tm-group","data-dir":b,children:f.jsx("title",{children:`${v.name==="/"?"(root)":v.name+"/"} — ${rp(v.reads,"read")}/30d · ${rp(v.files.length,"file")}`})},"g"+v.name)),y.w>46&&y.h>dm+10){const{label:_}=bw(x,v.reads,y.w);p.push(f.jsx("text",{x:y.x+5,y:y.y+12,className:"in-tm-glabel","data-dir":b,children:_},"gl"+v.name))}const w=yw(v.files.map(_=>({..._,name:_.path.split("/").pop(),value:_.reads+1})),y.x+2,y.y+dm,Math.max(0,y.w-4),Math.max(0,y.h-dm-2));for(const _ of w)if(p.push(f.jsx("rect",{x:_.x+.6,y:_.y+.6,width:Math.max(.4,_.w-1.2),height:Math.max(.4,_.h-1.2),rx:1.5,fill:d?QP:lE(_.item.days),className:"in-tm-cell","data-path":_.item.path,children:f.jsx("title",{children:`${_.item.path} — ${_.item.reads} read${_.item.reads===1?"":"s"}/30d · changed ${Math.round(_.item.days)}d ago`})},_.item.path)),_.w>54&&_.h>16){const{label:E,fit:R}=bw((_.item.danger?"⚠ ":"")+_.item.name,_.item.reads,_.w);R>=5&&p.push(f.jsx("text",{x:_.x+4.5,y:_.y+12.5,className:"in-tm-label","data-path":_.item.path,children:E},"l"+_.item.path))}}return f.jsxs(f.Fragment,{children:[f.jsx("svg",{viewBox:"0 0 720 480",className:"in-chart in-treemap",onClick:y=>{const v=y.target.closest("[data-path], [data-dir]");if(!v)return;const b=v.getAttribute("data-path");if(b)return t(b);const x=v.getAttribute("data-dir");x&&i(x)&&r(x)},children:p}),f.jsx(JP,{range:u,flat:d})]})}function JP({range:e,flat:t}){if(!e)return null;const r=mI(e.min,e.max);return f.jsxs("p",{className:"in-legend in-tm-legend",children:["freshness 0d",f.jsx("span",{className:"in-sw in-sw-age"+(t?" in-sw-flat":""),style:{background:`linear-gradient(to right, ${[0,60,150,300].map(lE).join(", ")})`}}),"300d+",f.jsx("span",{className:"in-tm-range",children:t?`all files here: ${r} old — colour off, not enough range to rank`:`observed: ${r} old`})]})}function WP({pts:e,onOpenFile:t}){const o={l:44,r:16,t:20,b:34},l=Math.max(Ns*2,...e.map(w=>w.days)),u=Math.max(tl*2,...e.map(w=>w.reads)),d=w=>Math.log10(w+1)/Math.log10(l+1),m=w=>Math.log10(w+1)/Math.log10(u+1),p=w=>3+4*w,y=p(1),v=w=>o.l+y+d(w)*(720-o.l-o.r-2*y),b=w=>360-o.b-y-m(w)*(360-o.t-o.b-2*y),x=vI(e.filter(w=>w.danger).map(w=>({path:w.path,reads:w.reads,cx:v(w.days),cy:b(w.reads),r:p(w.total?(w.agent||0)/w.total:0)})),{right:720-o.r,top:o.t+8,bottom:360-o.b-4});return f.jsxs("svg",{viewBox:"0 0 720 360",className:"in-chart",children:[f.jsx("rect",{x:v(Ns),y:o.t,width:720-o.r-v(Ns),height:b(tl)-o.t,className:"in-danger-zone"}),f.jsx("line",{x1:v(Ns),y1:o.t,x2:v(Ns),y2:360-o.b,className:"in-threshold"}),f.jsx("line",{x1:o.l,y1:b(tl),x2:720-o.r,y2:b(tl),className:"in-threshold"}),f.jsx("line",{x1:o.l,y1:360-o.b,x2:720-o.r,y2:360-o.b,className:"in-axis"}),f.jsx("line",{x1:o.l,y1:o.t,x2:o.l,y2:360-o.b,className:"in-axis"}),f.jsx("text",{x:(o.l+720-o.r)/2,y:352,className:"in-label",children:"days since last change →"}),f.jsx("text",{x:12,y:(o.t+360-o.b)/2,className:"in-label",transform:`rotate(-90 12 ${(o.t+360-o.b)/2})`,children:"reads / 30d →"}),f.jsx("text",{x:720-o.r-6,y:o.t+14,className:"in-quad in-quad-danger",textAnchor:"end",children:"hot + stale"}),f.jsx("text",{x:o.l+6,y:o.t+14,className:"in-quad",children:"hot + fresh"}),f.jsx("text",{x:720-o.r-6,y:360-o.b-8,className:"in-quad",textAnchor:"end",children:"cold + stale"}),f.jsx("text",{x:o.l+6,y:360-o.b-8,className:"in-quad",children:"cold + fresh"}),e.map(w=>{const _=w.total?(w.agent||0)/w.total:0;return f.jsx("circle",{cx:Number(v(w.days).toFixed(1)),cy:Number(b(w.reads).toFixed(1)),r:Number(p(_).toFixed(1)),className:"in-pt"+(w.danger?" danger":w.reads?"":" cold"),onClick:()=>t(w.path),children:f.jsx("title",{children:`${w.path} — ${w.reads} read${w.reads===1?"":"s"} / 30d · changed ${Math.round(w.days)}d ago`})},w.path)}),x.map(w=>f.jsx("text",{x:Number(w.x.toFixed(1)),y:Number(w.y.toFixed(1)),textAnchor:w.anchor,className:"in-pt-label",children:w.name},w.path))]})}function eF({pts:e,lens:t,onOpenFile:r,onOpenHistory:i}){const o=e.filter(d=>d.reads>0).sort((d,m)=>m.reads-d.reads||m.days-d.days).slice(0,20);if(!o.length)return f.jsx("div",{className:"dl-empty",children:"No reads in the window yet."});const l=o[0].reads,u=o.some(d=>d.share>0);return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"in-hotpath",children:o.map(d=>{const m=YP[t]??cI(d),p=d.reads/l*100,y=()=>d.orphan?i(d.path):r(d.path);return f.jsxs("div",{className:"in-hp-row",tabIndex:0,role:"button",title:d.orphan?`${d.reads} read${d.reads===1?"":"s"}/30d · no longer in the project — open its history`:d.danger?`${d.reads} read${d.reads===1?"":"s"}/30d · unchanged ${Math.round(d.days)}d — review this file`:d.path,onClick:y,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),y())},children:[f.jsx("span",{className:"in-hp-name"+(d.danger?" danger":""),children:d.path+(d.danger?" ⚠":"")}),d.orphan&&f.jsx("span",{className:"in-hp-gone",children:"· no longer in the project"}),f.jsxs("span",{className:"in-hp-bar",children:[f.jsx("span",{className:"in-hp-agent",style:{width:(p*m.agent).toFixed(1)+"%"}}),f.jsx("span",{className:"in-hp-human",style:{width:(p*m.human).toFixed(1)+"%"}}),f.jsx("span",{className:"in-hp-share",style:{width:(p*m.share).toFixed(1)+"%"}})]}),f.jsx("span",{className:"in-hp-count",children:d.reads})]},d.path)})}),f.jsxs("p",{className:"in-legend",children:[f.jsx("span",{className:"in-sw agent"})," agent reads ",f.jsx("span",{className:"in-sw human"})," human reads",u&&f.jsxs(f.Fragment,{children:[" ",f.jsx("span",{className:"in-sw share"})," shared reads"]})]})]})}function tF({devices:e}){const t=new Map;for(const b of e)for(const[x,w]of Object.entries(b.folders||{}))t.set(x,(t.get(x)||0)+w);const r=[...t.entries()].sort((b,x)=>x[1]-b[1]).slice(0,12).map(b=>b[0]),i=e.slice(0,12),o=140,l=6,u=Math.min(76,Math.max(34,(720-o-8)/r.length)),d=26,m=720,p=l+i.length*d+58,y=Math.max(1,...i.flatMap(b=>r.map(x=>(b.folders||{})[x]||0))),v=b=>{const x=[23,25,31],w=[245,166,35],_=x.map((E,R)=>Math.round(E+(w[R]-E)*b));return`rgb(${_[0]},${_[1]},${_[2]})`};return f.jsxs("svg",{viewBox:`0 0 ${m} ${p}`,className:"in-chart in-matrix",children:[i.map((b,x)=>{let w=b.name||b.id||"";return w.length>20&&(w=w.slice(0,19)+"…"),f.jsxs("g",{children:[f.jsx("text",{x:o-8,y:l+x*d+17,textAnchor:"end",className:"in-label",children:w}),r.map((_,E)=>{const R=(b.folders||{})[_]||0;return f.jsx("rect",{x:o+E*u,y:l+x*d,width:u-4,height:d-4,rx:3,fill:v(Math.sqrt(R/y)),children:f.jsx("title",{children:`${b.name||b.id} × ${_||"(root)"}: ${R} read${R===1?"":"s"}/30d`})},_)})]},b.id||x)}),r.map((b,x)=>{const w=o+x*u+(u-4)/2,_=l+i.length*d+14;return f.jsx("text",{x:w,y:_,className:"in-label",textAnchor:"end",transform:`rotate(-28 ${w} ${_})`,children:b||"(root)"},b)})]})}function cE(e){return new Set(e.entries.map(t=>t.path)).size}function nF(e){const t=l=>(l.session?"s\0"+l.session:"n\0"+l.note)+"\0"+(l.device?.id??""),r=new Map;e.forEach((l,u)=>{if(!l.note&&!l.session)return;const d=r.get(t(l));if(d){d.entries.push(l),d.idx.push(u);return}r.set(t(l),{note:l.note??"",session:l.session,entries:[l],idx:[u]})});const i=[],o=new Set;return e.forEach((l,u)=>{const d=l.note||l.session?r.get(t(l)):void 0;if(!d||cE(d)<2){i.push({i:u});return}o.has(d)||(o.add(d),i.push({run:d,i:u}))}),i}function rF(e){const{filters:t,authors:r,onChange:i}=e,o=(y,v)=>i({...t,[y]:v||void 0}),[l,u]=S.useState(t?.q??""),d=S.useRef(!1);S.useEffect(()=>{d.current||u(t?.q??"")},[t?.q]),S.useEffect(()=>{if(!d.current)return;const y=setTimeout(()=>{d.current=!1,l!==(t?.q??"")&&o("q",l)},250);return()=>clearTimeout(y)},[l]);const m=t?.user&&!r.includes(t.user)?[t.user,...r]:r,p=Yp(t);return f.jsxs("div",{className:"hfilters",children:[f.jsxs("label",{className:"hf-search",children:[f.jsx(rt,{name:"search"}),f.jsx(fu,{type:"search",value:l,placeholder:"path contains…","aria-label":"Filter by path",onChange:y=>{d.current=!0,u(y.target.value)}})]}),f.jsxs("select",{className:"hf-user",value:t?.user??"","aria-label":"Filter by author",onChange:y=>o("user",y.target.value),children:[f.jsx("option",{value:"",children:"Anyone"}),m.map(y=>f.jsx("option",{value:y,children:y},y))]}),f.jsxs("span",{className:"hf-dates",children:[f.jsx("span",{className:"hf-lbl",children:"UTC"}),f.jsx(fu,{type:"date",className:"hf-date",value:t?.since??"","aria-label":"From date (UTC)",onChange:y=>o("since",y.target.value)}),f.jsx("span",{className:"hf-dash",children:"–"}),f.jsx(fu,{type:"date",className:"hf-date",value:t?.until??"","aria-label":"To date (UTC)",onChange:y=>o("until",y.target.value)})]}),p&&f.jsx("button",{type:"button",className:"hf-clear",onClick:()=>i({}),children:"Clear"})]})}function aF(e){const t=new Set;for(const r of e)r.user&&t.add(r.user);return[...t].sort()}function iF(e){const{apiBase:t,target:r,isFolder:i,onMeta:o,onRendered:l,restore:u,remove:d,undoRun:m,filters:p}=e,y=r?i(r)?{prefix:r+"/"}:{path:r}:{prefix:""},v=("path"in y&&y.path!==void 0?"path="+encodeURIComponent(y.path):"prefix="+encodeURIComponent(y.prefix??""))+D_(p).replace("?","&"),{data:b,error:x,fetchNextPage:w,hasNextPage:_,isFetchingNextPage:E}=yj({queryKey:["history",t,v],queryFn:({pageParam:$})=>qt(t+"history?"+v+"&n=100"+($?"&cursor="+encodeURIComponent($):"")),initialPageParam:"",getNextPageParam:$=>$.next_cursor,staleTime:15e3}),R=S.useRef(new Set);S.useEffect(()=>{x&&o("History unavailable: "+x.message)},[x,o]),S.useEffect(()=>{b&&l?.()},[b,l]);const T=b?b.pages.flatMap($=>$.entries||[]):[];for(const $ of aF(T))R.current.add($);const O=e.onFilters&&f.jsx(rF,{filters:p,authors:[...R.current].sort(),onChange:e.onFilters});if(!b)return O?f.jsx("div",{className:"history",children:O}):null;const N=$=>{for(let he=$+1;he{const he=T[$].kind==="delete"?N($):T[$].blob;return he&&he===k.get(T[$].path)?void 0:he},H=$=>k.get(T[$].path)==="";return f.jsxs("div",{className:"history",children:[O,T.length===0&&(Yp(p)?f.jsxs("div",{className:"empty",children:["No changes match these filters.",f.jsx("br",{}),f.jsx("button",{type:"button",className:"btn hf-clear-empty",onClick:()=>e.onFilters?.({}),children:"Clear filters"})]}):f.jsx("div",{className:"empty",children:"No history yet."})),nF(T).map(($,he)=>$.run?f.jsx(sF,{run:$.run,onOpen:e.onOpen,apiBase:t,prevBlob:N,restoreSha:B,recreates:H,restore:u,remove:d,undoRun:m},"g"+he):f.jsx(vg,{entry:T[$.i],apiBase:t,onOpen:e.onOpen,diff:{apiBase:t,prev:N($.i)},restore:u,restoreSha:B($.i),recreates:H($.i)},"r"+$.i)),_&&f.jsx("button",{type:"button",className:"btn hmore",onClick:()=>w(),disabled:E,children:E?"Loading…":"Load more"})]})}function sF({run:e,onOpen:t,apiBase:r,prevBlob:i,restoreSha:o,recreates:l,restore:u,remove:d,undoRun:m}){const[p,y]=S.useState(!0),v=e.entries[0],b=fd(v),x=[v.device.name||v.device.id,v.device.os].filter(Boolean).join(" · "),w=v.session,_=v.device?.id,{data:E}=Ft({queryKey:["session-reads",r,w,_],queryFn:()=>qt(r+"heat?session="+encodeURIComponent(w)+"&device="+encodeURIComponent(_)),enabled:!!w&&!!_,staleTime:3e4}),R=new Set(E?.paths??[]),T=new Set(e.entries.map($=>$.path)),O=[...R].filter($=>!T.has($)).sort(),N=e.entries.map($=>new Date($.time).getTime()),k=oF(Math.min(...N),Math.max(...N)),B=cE(e),H=!!m?.busy&&m.busy===(e.session||e.note);return f.jsxs("div",{className:"hrun"+(p?" open":""),children:[f.jsxs("div",{className:"hrun-head",children:[f.jsx("button",{type:"button",className:"hrun-toggle","aria-expanded":p,title:p?"Collapse this run":"Expand this run",onClick:()=>y(!p),children:f.jsx(rt,{name:p?"chevd":"chev"})}),f.jsx("span",{className:"hrun-note",children:f.jsx(JC,{text:e.note})}),f.jsxs("span",{className:"hrun-meta",children:[R.size>0?`read ${R.size} · changed ${B}`:`${B} file${B===1?"":"s"}`," ·"," ",b,x?" · "+x:""]}),f.jsx("span",{className:"hrun-time",children:k}),m&&f.jsxs("button",{type:"button",className:"hrun-undo",disabled:H,title:"Put every file this run touched back the way it was",onClick:()=>m.onUndoRun(e),children:[f.jsx(rt,{name:"hist"}),H?"undoing…":"undo this run"]})]}),p&&f.jsxs("div",{className:"hrun-body",children:[e.entries.map(($,he)=>f.jsx(vg,{entry:$,apiBase:r,onOpen:t,diff:{apiBase:r,prev:i(e.idx[he])},restore:u,remove:d,restoreSha:o(e.idx[he]),recreates:l(e.idx[he]),inRun:!0,read:R.has($.path)},he)),O.length>0&&f.jsxs("div",{className:"hrun-reads",children:[f.jsx("div",{className:"hrun-reads-head",children:"Read, not changed"}),O.map($=>f.jsxs("button",{type:"button",className:"hrun-read",onClick:()=>t($),children:[f.jsx("span",{className:"hkind",children:"read"}),f.jsx("span",{className:"hpath",children:$})]},$))]}),w&&f.jsx("div",{className:"hrun-foot",children:"Reads shown only for files the project still has."})]})]})}function oF(e,t){const r=new Date(e),i=new Date(t),o=u=>u.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});if(r.toDateString()!==i.toDateString())return r.toLocaleString()+" – "+i.toLocaleString();const l=i.toLocaleDateString();return e===t?l+" "+o(i):l+" "+o(r)+" – "+o(i)}function lF(e,t){return e?t(e)?e+"/ (folder)":e:"all changes"}function cF(e){const{apiBase:t,path:r,version:i}=e,o="path="+encodeURIComponent(r),{data:l}=Ft({queryKey:["history",t,o,200],queryFn:()=>qt(t+"history?"+o+"&n=200"),staleTime:15e3}),u=l?.entries?.find(y=>y.blob===i),d=u?fd(u):"",m=u?.time?new Date(u.time).toLocaleString():"",p=t+"blob?sha="+i+"&name="+encodeURIComponent(r.split("/").pop()||r)+"&download=1";return f.jsxs("div",{className:"vbanner",role:"status",children:[f.jsx("span",{className:"vb-icon",children:f.jsx(rt,{name:"clock"})}),f.jsxs("div",{className:"vb-text",children:[f.jsx("b",{children:[m&&"Version from "+m,d&&"by "+d].filter(Boolean).join(" ")||"Earlier version"}),f.jsx("span",{children:"This is not the current file."})]}),f.jsxs("div",{className:"vb-actions",children:[f.jsx("button",{className:"ai-btn",onClick:e.onViewCurrent,children:"View current"}),f.jsx("a",{className:"ai-btn",download:!0,href:p,children:"Download this version"})]})]})}function uF(e){const{conflict:t,originalHref:r}=e,i=t.device||"another device";return f.jsxs("div",{className:"vbanner",role:"status",children:[f.jsx("span",{className:"vb-icon",children:f.jsx(rt,{name:"alert"})}),f.jsxs("div",{className:"vb-text",children:[f.jsx("b",{children:"Conflict copy — a concurrent edit, preserved"}),f.jsxs("span",{children:[i," edited this file at the same time as someone else on"," ",t.when.toLocaleString(),". Rather than drop either version, beardrive kept that one here."," ",r?f.jsxs(f.Fragment,{children:["The other version lives at ",f.jsx("code",{children:t.original})]}):f.jsx(f.Fragment,{children:"The other version kept the original name."})]})]}),r&&f.jsx("div",{className:"vb-actions",children:f.jsx("button",{className:"ai-btn",onClick:r,children:"Open the other version"})})]})}const dF={aws_access_key_id:"an AWS access key",openai_api_key:"an OpenAI API key",github_pat:"a GitHub token",slack_token:"a Slack token",private_key:"a private key",gitlab_pat:"a GitLab token"};function fF(e=[]){const t=e.map(i=>`${dF[i.rule]??i.rule} (line ${i.line})`);return`BearDrive found ${t.length>1?t.slice(0,-1).join(", ")+" and "+t[t.length-1]:t[0]||"something credential-shaped"} in this file. The check covers the file at the moment you share it — a link always serves the file's latest content, so later changes are never checked. Share anyway?`}function uE(e){const{config:t,apiBase:r,route:i,hub:o,project:l}=e,u=Xp(),d=Di(),{tree:m,flatFiles:p,dirIndex:y,loaded:v}=xI(r,!o||!!l),b=wI(r,o&&!!l&&!!t.reads?.enabled),x=o&&!!l&&!i.path&&!i.view,w=i.view==="dashboard"||x,_=GP(r,w);S.useEffect(()=>{w&&d.invalidateQueries({queryKey:["heat",r]})},[w,r,d]);const E=i.path,R=i.view?void 0:i.version,T=E||(i.view==="dashboard"||i.view==="history")&&i.viewTarget||"",O=!!E&&y.has(E),N=!!E&&v&&!O&&p.some(W=>W.path===E),k=!!E&&v&&!O&&!N,B=O&&!i.view,{data:H}=Ft({queryKey:["resolve",r,E],queryFn:()=>qt(r+"resolve?path="+encodeURIComponent(E)),enabled:k,retry:!1,staleTime:6e4}),[$,he]=S.useState(null);S.useEffect(()=>{!k||!H?.to||(he({from:E,to:H.to}),Yt(Gs(H.to,l?.id),{replace:!0}))},[k,H,E,l?.id]);const[be,pe]=S.useState(()=>new Set),fe=S.useRef(!0);S.useEffect(()=>{if(!m||!fe.current)return;fe.current=!1;const W=(m.children||[]).filter(oe=>oe.dir);W.length===1&&pe(oe=>new Set(oe).add(W[0].path))},[m]),S.useEffect(()=>{!T||!v||pe(W=>{const oe=new Set(W);for(const Re of UI(T))oe.add(Re);return y.has(T)&&oe.add(T),oe})},[T,v,y]);const ue=S.useCallback(W=>{pe(oe=>{const Re=new Set(oe);return Re.has(W)?Re.delete(W):Re.add(W),Re})},[]),ee=S.useRef(null),ve=S.useRef(new Map),L=S.useRef({key:"",want:0,attempts:0});S.useEffect(()=>{L.current={key:u,want:I3()==="POP"?ve.current.get(u)??0:0,attempts:0}},[u]);const Z=S.useCallback(()=>{const W=ee.current,oe=L.current;!W||oe.key!==u||oe.attempts>=3||(oe.attempts++,W.scrollTo({top:oe.want,behavior:"instant"}))},[u]),ne=S.useCallback(()=>{ee.current&&ve.current.set(u,ee.current.scrollTop)},[u]),X=S.useCallback((W,oe)=>{Yt(Gs(W,l?.id,oe)),hr()},[l?.id]),te=S.useCallback(W=>Yt(Pn("history",l?.id,W)),[l?.id]),[D,M]=S.useState(""),[U,Q]=S.useState(null),[K,de]=S.useState(!1),[re,xe]=S.useState(!1);S.useEffect(()=>ZD(()=>xe(!0)),[]);const we=S.useRef(null),Me=e.panel??null,Fe=!Me&&o&&!!l&&N&&_i(l.perm,"write"),{data:He}=T_(l?.id,o&&!!l),ct=S.useCallback(()=>{d.invalidateQueries({queryKey:["shares",l?.id]})},[d,l?.id]),Je=N?(He||[]).filter(W=>W.path===E):[],hn=!Me&&o&&!!l,mn=!Me&&N,Xt=!Me&&(N||o&&!!l&&O),yr=R?r+"blob?sha="+R+"&name="+encodeURIComponent(E)+"&download=1":r+"download?path="+encodeURIComponent(E),At=S.useCallback(async()=>{const W=oe=>fetch(r+"shares",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(oe?{path:E,confirm:!0}:{path:E})});try{let oe=await W(!1);if(oe.status===409){const{findings:it}=await oe.json();if(!await za("This file may contain credentials",fF(it),"Share anyway",!0))return;oe=await W(!0)}if(!oe.ok)throw new Error(await oe.text());const Re=await oe.json();zw("share_created");const ze=await Mi(Re.url);Q({url:Re.url,copied:ze}),ct()}catch(oe){qe("Share failed: "+oe.message,!0)}},[r,E,ct]),[rr,br]=S.useState(""),Rt=o&&!!l&&_i(l?.perm,"write"),Vn=S.useCallback(async(W,oe,Re)=>{if(await za("Restore this version of "+W+"?","It syncs to every device as a new change. "+(Re?"The file comes back on every device. Removing it again isn't available from History yet.":"You can restore any other version afterwards."),"Restore")){br(W+oe);try{await ea(r+"restore",{path:W,sha:oe}),d.invalidateQueries({queryKey:["history",r]}),d.invalidateQueries({queryKey:["tree",r]}),d.invalidateQueries({queryKey:["render",r,W]}),d.invalidateQueries({queryKey:["text"]}),qe("Restored "+W+" — it syncs to every device like any other change.")}catch(ze){qe("Restore failed: "+ze.message,!0)}finally{br("")}}},[r,d]),[zt,Dr]=S.useState(""),ar=S.useCallback(async W=>{if(await za("Remove "+W+"?","It disappears from every synced device. History keeps it — you can restore it from the DELETED row afterwards.","Remove file",!0)){Dr(W);try{await ea(r+"remove",{path:W}),d.invalidateQueries({queryKey:["history",r]}),d.invalidateQueries({queryKey:["tree",r]}),d.invalidateQueries({queryKey:["render",r,W]}),d.invalidateQueries({queryKey:["text"]}),qe("Removed "+W+" — it syncs to every device like any other change.")}catch(oe){qe("Remove failed: "+oe.message,!0)}finally{Dr("")}}},[r,d]),[oa,ir]=S.useState(""),la=S.useCallback(async W=>{const oe=W.session||W.note,Re=W.session?{session:W.session,device:W.entries[0]?.device?.id}:{note:W.note,device:W.entries[0]?.device?.id};ir(oe);try{const ze=await ea(r+"undo-run",{...Re,preview:!0}),it=new Set(ze.changed_after);if(!ze.undone.length){qe("Nothing to undo — every file this run touched already holds its pre-run content.");return}if(!await za("Undo this run?",f.jsxs(f.Fragment,{children:[f.jsxs("div",{children:[W.note||oe," — ",ze.undone.length," file",ze.undone.length===1?"":"s"]}),f.jsx("div",{className:"undo-list",children:ze.undone.map(st=>f.jsxs("div",{className:"undo-row",children:[f.jsx("span",{className:"undo-path",children:st.path}),it.has(st.path)&&f.jsx("span",{className:"undo-after",children:"changed after this run"}),f.jsx("span",{className:"undo-what",children:st.action==="remove"?"remove (the run created it)":"restore to pre-run version"})]},st.path))}),it.size>0&&f.jsxs("div",{className:"undo-warn",children:[it.size," file",it.size===1?" was":"s were"," changed by someone else after this run. Undoing overwrites ",it.size===1?"that change":"those changes"," too."]}),ze.skipped.length>0&&f.jsxs("div",{children:[ze.skipped.length," already hold",ze.skipped.length===1?"s":""," its pre-run content and will be left alone."]}),ze.refused.length>0&&f.jsxs("div",{children:[ze.refused.length," path",ze.refused.length===1?"":"s"," can't be written by the hub and will be left alone: ",ze.refused.join(", "),"."]})]}),"Undo run",!0))return;const Ae=await ea(r+"undo-run",Re);d.invalidateQueries({queryKey:["history",r]}),d.invalidateQueries({queryKey:["tree",r]}),d.invalidateQueries({queryKey:["render",r]}),d.invalidateQueries({queryKey:["text"]});const ut=Ae.skipped.length?`, skipped ${Ae.skipped.length} (already current)`:"";qe(`Undid ${Ae.undone.length} file${Ae.undone.length===1?"":"s"}${ut}.`)}catch(ze){qe("Undo failed: "+ze.message,!0)}finally{ir("")}},[r,d]),Jt=S.useCallback(()=>{if(!E)return te("");te(O?E+"/":E)},[E,O,te]);S.useEffect(()=>{const W=oe=>{(oe.metaKey||oe.ctrlKey)&&oe.key.toLowerCase()==="k"&&(oe.preventDefault(),xe(Re=>!Re))};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[]);const A=S.useCallback(()=>{const W=[],oe=(Re,ze,it,_t)=>W.push({icon:Re,label:ze,kind:it,run:_t});if(o&&l){const Re=l.id,ze=it=>()=>{e.onClosePanel?.(),Yt(it)};oe("folder",l.name+" — project root","project",ze("/"+Re)),oe("dashboard","Dashboard","action",ze(Pn("dashboard",Re))),oe("terminal","Installation","action",ze(Pn("install",Re))),oe("gear","Settings","action",ze(Pn("settings",Re)))}if(o&&l&&E&&(N&&oe("share","Share: "+E,"action",At),oe("hist","History: "+E,"action",Jt),N&&oe("download","Download: "+E,"action",()=>we.current?.click())),o&&l&&oe("hist","History: whole project","action",()=>te("")),o)for(const Re of e.projects||[])(!l||Re.id!==l.id)&&oe("folder","Switch to project: "+Re.name,"project",()=>Yt("/"+Re.id));t.auth?.enabled&&oe("power","Sign out","action",()=>window.location.href="/auth/logout");for(const Re of y.keys())oe("folder",Re,"folder",()=>X(Re));for(const Re of p)oe("doc",Re.path,"file",()=>X(Re.path));return W},[o,l,E,N,t.auth?.enabled,y,p,e.projects,e.onClosePanel,At,Jt,te,X]);S.useEffect(()=>{if(!K)return;const W=()=>de(!1);return document.addEventListener("click",W),()=>document.removeEventListener("click",W)},[K]);const P=S.useCallback(W=>y.has(W),[y]);let F="app",ce,se;if(Me)se=Me.body;else if(i.view==="dashboard")se=f.jsx(vw,{flatFiles:p,heatMap:b,devices:_,scope:i.viewTarget||"",loading:!v,installHref:l?Pn("install",l.id):void 0,onOpenFile:X,onOpenFolder:X,onOpenHistory:te,isFolder:P});else if(i.view==="history")se=f.jsx(iF,{apiBase:r,target:i.viewTarget||"",isFolder:P,onOpen:X,onMeta:M,onRendered:Z,restore:Rt?{onRestore:Vn,busy:rr}:void 0,remove:Rt?{onRemove:ar,busy:zt}:void 0,undoRun:Rt?{onUndoRun:la,busy:oa}:void 0,filters:i.filters,onFilters:W=>Yt(Pn("history",l?.id,i.viewTarget||"",W))});else if(E)if(!v)se=f.jsx("div",{className:"empty",children:"Loading…"});else if(k)se=f.jsxs("div",{className:"notfound",children:[f.jsx("h1",{children:"Couldn't find that"}),f.jsxs("p",{children:[f.jsx("code",{children:E})," isn't in this project right now."]}),f.jsx("p",{className:"nf-sub",children:"If it was just created, it may still be uploading or syncing from a teammate's device — this page checks again automatically every few seconds, so refresh or come back in a moment."}),f.jsx("button",{className:"pbtn",onClick:()=>d.invalidateQueries({queryKey:["tree",r]}),children:"Check again"})]});else if(O)se=f.jsx(tP,{node:y.get(E),heatMap:b,hub:o&&!!l,apiBase:r,onOpen:X,onFullHistory:te,onRendered:Z});else{F=AC.test(E)||MC.test(E)?"wide":"read",ce="markdown";const W=YC(E);se=f.jsxs(f.Fragment,{children:[R&&f.jsx(cF,{apiBase:r,path:E,version:R,onViewCurrent:()=>X(E)}),W&&f.jsx(uF,{conflict:W,originalHref:p.some(oe=>oe.path===W.original)?()=>X(W.original):void 0}),f.jsx(aP,{apiBase:r,path:E,version:R,heatMap:b,flatFiles:p,projectId:l?.id,onOpenFile:X,onMeta:M,onRendered:Z})]})}else x?se=f.jsxs(f.Fragment,{children:[f.jsx(BC,{project:l,existing:i.connect==="existing"}),f.jsx("div",{className:"home-insights",children:f.jsx(vw,{flatFiles:p,heatMap:b,devices:_,loading:!v,onOpenFile:X,onOpenFolder:X,onOpenHistory:te,isFolder:P})})]}):se=f.jsx("div",{className:"empty",children:"Select a file to read it."});$&&$.to===E&&(se=f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"vbanner",role:"status",children:[f.jsx("span",{className:"vb-icon",children:f.jsx(rt,{name:"link"})}),f.jsxs("div",{className:"vb-text",children:[f.jsxs("b",{children:["Moved from ",$.from]}),f.jsx("span",{children:"The URL has been updated."})]})]}),se]}));const ye=Me?Me.crumb:E?f.jsx(HI,{path:E,onOpenFolder:X}):i.view==="dashboard"?"Dashboard — "+(i.viewTarget||l?.name||""):i.view==="history"?"History — "+lF(i.viewTarget||"",P):x?l.name:null,Se=f.jsx(hl,{crumb:ye,meta:D,actions:f.jsxs(f.Fragment,{children:[Fe&&f.jsx(xt,{id:"share-btn",variant:"toolbar",className:"icon-only",title:"Share","aria-label":"Share",onClick:At,children:f.jsx(rt,{name:"share"})}),hn&&!E&&!i.view&&f.jsxs(xt,{id:"history-btn",variant:"toolbar",onClick:Jt,children:[f.jsx(rt,{name:"hist"})," ",f.jsx("span",{className:"lbl",children:"History"})]}),mn&&f.jsx("a",{id:"download",hidden:!0,download:!0,href:yr,ref:we,children:"Download"}),Xt&&f.jsx(xt,{id:"more-btn",variant:"toolbar",className:"icon-only",title:"More actions","aria-label":"More actions",onClick:W=>{W.stopPropagation(),de(!K)},children:f.jsx(rt,{name:"dots"})}),K&&f.jsxs("div",{id:"more-menu",role:"menu",children:[hn&&f.jsx("button",{className:"more-item",onClick:Jt,children:"History"}),mn&&f.jsx("button",{className:"more-item",onClick:()=>we.current?.click(),children:"Download"}),o&&!!l&&f.jsx("button",{className:"more-item",onClick:()=>{e.onClosePanel?.(),Yt(Pn("dashboard",l?.id,E))},children:"Dashboard"})]})]})});return f.jsxs(f.Fragment,{children:[f.jsx(fl,{vault:e.sidebar.vault,projectsNav:e.sidebar.projectsNav,orgBar:e.sidebar.orgBar,tree:f.jsx(VI,{root:m,expanded:be,onToggle:ue,currentPath:T,listingShowing:B,onOpen:X}),topbar:Se,contentRef:ee,onContentScroll:ne,children:f.jsxs(_u,{width:F,className:ce,children:[!Me&&N&&f.jsx(mP,{shares:Je,canRevoke:!!l&&_i(l.perm,"write"),onChanged:ct}),se]})}),U&&f.jsx(hP,{url:U.url,copied:U.copied,onClose:()=>{Q(null),ct()}}),f.jsx(qP,{open:re,onClose:()=>xe(!1),candidates:A})]})}function hF({config:e}){const t=Xp(),r=A_(),[i,o]=S.useState(null),[l,u]=S.useState(null);S.useEffect(()=>u(null),[t]);const d=S.useMemo(()=>{const ve=t.split("?")[0].match(/^\/join\/([0-9a-f]+)\/?$/);return ve?ve[1]:null},[t]),{data:m}=M3(!d),{data:p}=N3(!d),y=!!e.auth.admin,{data:v}=O_(y),b=S.useMemo(()=>k_(t,"hub"),[t]),[x,w]=S.useState(!1),_=e.upload.enabled,E=async(ve,L)=>{const Z=L===qC;try{const ne=await ea("/api/projects",{name:ve,template:Z?"":L});w(!1),await r(),Yt("/"+ne.project.id+(Z?"?connect=existing":"")),qe(`Created “${ne.project.name}”.`)}catch(ne){qe("Could not create the project: "+ne.message,!0)}},R=x?f.jsx(oI,{templates:e.templates??[],onCreate:E,onClose:()=>w(!1)}):null,T=S.useMemo(()=>m&&(m.find(ve=>ve.id===b.project)||i&&m.find(ve=>ve.org===i)||m.find(ve=>ve.id===A$())||m[0])||null,[m,b.project,i]);if(S.useEffect(()=>{document.title=T?T.name+" — BearDrive":e.brand||"BearDrive",T&&M$(T.id)},[T,e]),d)return f.jsx(mF,{token:d,onDone:async ve=>{o(ve),await r(),Yt("/",{replace:!0})}});const O=e.brand||"BearDrive",N=T&&p?.find(ve=>ve.id===T.org)||null,k=f.jsx(Ju,{name:O,onHome:()=>Yt("/"),search:!!T,beta:O==="BearDrive"}),B=e.me?f.jsx(J$,{me:e.me,org:N,orgActive:!!b.org,billing:e.billing,admin:y?{pending:v?.length||0,onClick:()=>{u({kind:"hub"}),hr()}}:void 0}):void 0;if(!m||!p)return f.jsx(fl,{vault:k,topbar:f.jsx(hl,{}),children:f.jsx(_u,{children:f.jsx("div",{className:"empty",children:"Loading…"})})});if(!T)return f.jsxs(fl,{vault:k,projectsNav:f.jsx(sw,{projects:m,onNew:()=>w(!0)}),orgBar:B,topbar:f.jsx(hl,{}),children:[f.jsx(_u,{children:f.jsx(sI,{onNew:()=>w(!0),canCreate:_})}),R]});const H=l?.kind==="hub"?{crumb:"Signup & access",body:f.jsx(U$,{})}:null,$=b.org?p.find(ve=>ve.id===b.org):null,be=b.org&&!$?{crumb:"Organization",body:f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"Organization not found"}),f.jsx("p",{children:"This organization doesn't exist, or you're no longer a member."}),f.jsx("p",{children:f.jsxs("a",{...Zs("/"+T.id),children:["Back to ",T.name]})})]})}:$?{crumb:"Organization",body:f.jsx(P$,{org:$,projects:m,myEmail:e.me?.email||""})}:null,pe=!!b.project&&!m.some(ve=>ve.id===b.project),fe=pe?{crumb:"Project",body:f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"Project not found"}),f.jsx("p",{children:"This project doesn't exist, or you're no longer a member."}),f.jsx("p",{children:f.jsxs("a",{...Zs("/"+T.id),children:["Back to ",T.name]})})]})}:null,ue=b.billing?{crumb:"Billing",body:e.billing?f.jsx(W$,{url:e.billing.url}):f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"No billing on this hub"}),f.jsx("p",{children:"This BearDrive hub doesn't have a billing surface."})]})}:null,ee=b.view==="settings"?{crumb:"Project settings",body:f.jsx(nI,{project:T,org:N,onDeleted:async()=>{await r(),Yt("/")}})}:b.view==="install"?{crumb:"Installation",body:f.jsx(BC,{project:T,existing:b.connect==="existing"})}:null;if(!pe){if(!b.org&&!b.billing&&b.project!==T.id)return f.jsx(Jo,{to:"/"+T.id});if(b.legacyView&&b.view)return f.jsx(Jo,{to:Pn(b.view,T.id,b.viewTarget,b.filters)});if(b.queryTarget&&b.view)return f.jsx(Jo,{to:Pn(b.view,T.id,b.viewTarget,b.filters)});if(b.trailingSlash&&b.path)return f.jsx(Jo,{to:Gs(b.path,T.id,b.version)})}return f.jsxs(f.Fragment,{children:[f.jsx(uE,{config:e,apiBase:"/api/p/"+T.id+"/",route:b,hub:!0,project:T,projects:m,sidebar:{vault:k,projectsNav:f.jsx(sw,{projects:m,currentId:T.id,onNew:()=>w(!0),menu:{active:l?null:b.view==="dashboard"&&!b.viewTarget?"dashboard":b.view==="install"?"install":b.view==="history"&&!b.viewTarget?"history":b.view==="settings"?"settings":null,onDashboard:()=>{u(null),Yt(Pn("dashboard",T.id)),hr()},onInstall:()=>{u(null),Yt(Pn("install",T.id)),hr()},onHistory:()=>{u(null),Yt(Pn("history",T.id)),hr()},onSettings:()=>{u(null),Yt(Pn("settings",T.id)),hr()}}}),orgBar:B},panel:H||be||fe||ue||ee,onClosePanel:()=>u(null)},T.id),R]})}function mF({token:e,onDone:t}){return S.useEffect(()=>{let r=!1;return ea("/api/invites/"+e).then(i=>{r||(qe(`Welcome — you joined the “${i.org.name}” team. Opening its projects…`),t(i.org.id))}).catch(i=>{r||String(i.message).includes("signing in")||(qe("Could not accept the invite: "+i.message,!0),t(null))}),()=>{r=!0}},[e]),f.jsx(fl,{vault:f.jsx(Ju,{name:"BearDrive",beta:!0}),topbar:f.jsx(hl,{}),children:f.jsx(_u,{children:f.jsx("div",{className:"empty",children:"Joining…"})})})}function pF({config:e}){const t=Xp(),r=e.volume||"BearDrive";S.useEffect(()=>{document.title=e.brand||r},[e,r]);const i=S.useMemo(()=>k_(t,"volume"),[t]);return i.trailingSlash&&i.path?f.jsx(Jo,{to:Gs(i.path)}):f.jsx(uE,{config:e,apiBase:"/api/",route:i,hub:!1,sidebar:{vault:f.jsx(Ju,{name:r,showSignout:e.auth.enabled,search:!0})}})}function gF(){const{data:e}=_j();return f.jsxs(HD,{delayDuration:150,children:[e?e.mode==="hub"?f.jsx(hF,{config:e}):f.jsx(pF,{config:e}):f.jsx(fl,{vault:f.jsx(Ju,{name:"…",showSignout:!1}),topbar:f.jsx(hl,{}),children:f.jsx("div",{className:"empty",children:"Loading…"})}),f.jsx(_3,{}),f.jsx(T3,{})]})}class vF extends S.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,r){console.error("BearDrive: unhandled render error",t,r.componentStack)}render(){return this.state.error?f.jsxs("div",{className:"mx-auto max-w-lg p-8 text-sm",children:[f.jsx("h1",{className:"mb-2 text-lg font-semibold",children:"This page didn’t load"}),f.jsx("p",{className:"mb-4 opacity-80",children:"Something went wrong rendering this view. The rest of BearDrive is fine."}),f.jsx("p",{className:"mb-4",children:f.jsx("a",{className:"underline",href:"/",children:"Go to the project list"})}),f.jsx("pre",{className:"overflow-x-auto rounded bg-black/5 p-3 text-xs dark:bg-white/10",children:String(this.state.error)})]}):this.props.children}}const yF=new sj({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});D2.createRoot(document.getElementById("root")).render(f.jsx(S.StrictMode,{children:f.jsx(vF,{children:f.jsx(oj,{client:yF,children:f.jsx(gF,{})})})})); +`)continue;l+=y}}return u||((l!==""||o.length)&&m(),!i.length)||i[0].length<2?null:{rows:i,truncated:d}}function aP(e){const{apiBase:t,path:r,version:i,onMeta:o}=e,l=i?t+"blob?sha="+i+"&name="+encodeURIComponent(r):t+"file?path="+encodeURIComponent(r);return S.useEffect(()=>()=>o(""),[r,o]),E$.test(r)?f.jsx(oP,{...e}):AC.test(r)?f.jsx("iframe",{className:"htmlview",sandbox:"allow-scripts",src:l,title:r,onLoad:e.onRendered}):MC.test(r)?f.jsx("iframe",{className:"pdfview",src:l,title:r,onLoad:e.onRendered}):R$.test(r)?f.jsx(uP,{src:l,alt:r,version:i,onRendered:e.onRendered}):j$.test(r)?f.jsx(fw,{...e,fileURL:l,delim:/\.tsv$/i.test(r)?" ":","}):T$.test(r)?f.jsx(fw,{...e,fileURL:l}):f.jsx(iP,{...e,fileURL:l})}function iP(e){const{apiBase:t,path:r,version:i,fileURL:o,onRendered:l}=e,{data:u,error:d}=XC(o,["text",o],!0,!!i);return S.useEffect(()=>{u&&l?.()},[u,l]),d?f.jsx(hd,{version:i,err:d}):u?u.kind==="text"?f.jsx("pre",{className:"plain",children:u.text},r):f.jsx(sP,{apiBase:t,path:r,version:i,fileURL:o,children:u.kind==="too-large"?`Too large to preview (${gg(u.size)}).`:"No preview for this file type."}):null}function sP(e){const{apiBase:t,path:r,version:i,fileURL:o}=e;return f.jsxs("div",{className:"filecard",children:[f.jsx("div",{className:"name",children:r.split("/").pop()}),f.jsx("p",{children:e.children}),f.jsx("a",{className:"btn",download:!0,href:i?o+"&download=1":t+"download?path="+encodeURIComponent(r),children:"Download"})]})}function oP(e){const{apiBase:t,path:r,version:i,heatMap:o,flatFiles:l,projectId:u,onOpenFile:d,onMeta:m,onRendered:p}=e,{data:y,error:v}=Ft({queryKey:["render",t,r,i||""],queryFn:()=>qt(t+"render?path="+encodeURIComponent(r)+(i?"&sha="+i:"")),retry:i?!1:void 0}),b=S.useMemo(()=>y?cP(y.html,r,t,l,u):"",[y,r,t,l,u]),[x,w]=S.useState(null);return S.useEffect(()=>{if(w(null),!S2(b))return;let _=!1;return _2(b).then(E=>{_||w(E)}),()=>{_=!0}},[b]),S.useEffect(()=>{if(!y)return;const _=[],E=i?null:o&&o[y.path],R=ZC(E||null,y.time);(y.user_name||y.user||y.author)&&_.push(fd(y)+(y.device?" on "+y.device:"")),y.time&&_.push(new Date(y.time).toLocaleString());const T=E&&na(E)?el(E)+" / 30d":"",O=R?f.jsxs("span",{className:"meta-stale",title:R,children:[f.jsx("span",{"aria-hidden":"true",children:"⚠ "}),R]}):null;m(T?f.jsxs(f.Fragment,{children:[O,O?" · ":"",_.length?_.join(" · ")+" · ":"",f.jsxs("span",{title:Ci,children:[T,f.jsxs("span",{className:"sr-only",children:[" — ",Ci]})]})]}):O?f.jsxs(f.Fragment,{children:[O,_.length?" · "+_.join(" · "):""]}):_.join(" · ")),p?.()},[y,i,o,m,p]),v?f.jsx(hd,{version:i,err:v}):y?f.jsx("div",{dangerouslySetInnerHTML:{__html:x??b},onClick:_=>lP(_,r,d)}):null}function lP(e,t,r){const i=e.target.closest("a");if(!i||!e.currentTarget.contains(i)||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0)return;const o=i.getAttribute("href")||"",l=t.includes("/")?t.slice(0,t.lastIndexOf("/")):"",u=i.getAttribute("data-wiki");u!==null?(e.preventDefault(),r(u)):/^([a-z]+:|\/|#)/i.test(o)||(e.preventDefault(),r(NC(l,decodeURIComponent(o))))}function cP(e,t,r,i,o){const l=t.includes("/")?t.slice(0,t.lastIndexOf("/")):"",u=m=>r+"file?path="+encodeURIComponent(m),d=new DOMParser().parseFromString(e,"text/html");for(const m of d.querySelectorAll("img")){const p=m.getAttribute("src")||"";/^\s*data:image\/svg/i.test(p)?m.removeAttribute("src"):/^([a-z]+:|\/)/i.test(p)||m.setAttribute("src",u(NC(l,p)))}for(const m of d.querySelectorAll("a")){const p=m.getAttribute("href")||"";if(p.startsWith("wiki:")){const y=O$(decodeURIComponent(p.slice(5)),i);y?(m.setAttribute("href",Gs(y.path,o)),m.setAttribute("data-wiki",y.path)):(m.removeAttribute("href"),m.classList.add("wiki-missing"),m.setAttribute("title","No file matches this wikilink"));continue}/^\s*data:/i.test(p)?m.removeAttribute("href"):/^https?:/i.test(p)&&(m.setAttribute("target","_blank"),m.setAttribute("rel","noopener"))}return d.body.innerHTML}function uP(e){const[t,r]=S.useState(!1);return t?f.jsx(hd,{version:e.version,err:new Error("could not be loaded")}):f.jsx("img",{src:e.src,alt:e.alt,onLoad:e.onRendered,onError:()=>r(!0)})}function hd({version:e,err:t}){return f.jsx("div",{className:"empty",children:e?"That version isn't available.":"Could not load file: "+t.message})}function fw(e){const{path:t,version:r,fileURL:i,delim:o,onRendered:l}=e,{data:u,error:d}=Ft({queryKey:["text",i],queryFn:async()=>{const p=await fetch(i);if(!p.ok)throw new Error(await p.text());return p.text()},retry:r?!1:void 0});S.useEffect(()=>{u!=null&&l?.()},[u,l]);const m=S.useMemo(()=>o&&u!=null?rP(u,o,WC):null,[u,o]);return d?f.jsx(hd,{version:r,err:d}):u==null?null:m?f.jsx(dP,{csv:m},t):f.jsx("pre",{className:"plain",children:u},t)}function dP({csv:e}){const[t,...r]=e.rows,i=e.rows.reduce((l,u)=>Math.max(l,u.length),0),o=Array.from({length:i},(l,u)=>u);return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"csvbox",children:f.jsxs("table",{className:"csvview",children:[f.jsx("thead",{children:f.jsx("tr",{children:o.map(l=>f.jsx("th",{children:t[l]??""},l))})}),f.jsx("tbody",{children:r.map((l,u)=>f.jsx("tr",{children:o.map(d=>f.jsx("td",{children:l[d]??""},d))},u))})]})}),e.truncated>0&&f.jsxs("p",{className:"csvnote",children:["showing ",e.rows.length.toLocaleString()," of"," ",(e.rows.length+e.truncated).toLocaleString()," rows — Download for the rest"]})]})}const fP=[{value:"",label:"Never"},{value:"24h",label:"In 24 hours"},{value:"168h",label:"In 7 days"},{value:"720h",label:"In 30 days"}];function hP({url:e,copied:t,onClose:r}){const i=e.split("/s/")[1],[o,l]=S.useState(""),[u,d]=S.useState(),[m,p]=S.useState(!1),y=S.useRef(null);async function v(b){const x=o;l(b),p(!0);try{const w=await Wn("PATCH","/api/shares/"+i,{expires_in:b});d(w.expires)}catch(w){qe(w.message,!0),l(x)}finally{p(!1)}}return f.jsx(Wu,{open:!0,onOpenChange:b=>!b&&r(),children:f.jsxs(ed,{className:"modal",showCloseButton:!1,onOpenAutoFocus:b=>{b.preventDefault(),y.current?.focus()},children:[f.jsx(Cl,{asChild:!0,children:f.jsx("h3",{children:"Public link"})}),f.jsxs("p",{children:[f.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until it expires or you revoke it."]}),f.jsx("div",{className:"modal-url",children:e}),f.jsxs("div",{className:"modal-expiry",children:[f.jsx("label",{htmlFor:"share-expiry",children:"Expires"}),f.jsx("select",{id:"share-expiry",value:o,disabled:m,onChange:b=>v(b.target.value),children:fP.map(b=>f.jsx("option",{value:b.value,children:b.label},b.value))}),f.jsx("span",{className:"modal-expiry-note",children:zC(u)})]}),f.jsxs("div",{className:"modal-actions",children:[f.jsx(xt,{ref:y,variant:"primary",onClick:()=>Mi(e).then(b=>qe(b?"Copied.":"Select and copy the link above.")),children:t?"Copied ✓":"Copy link"}),f.jsx(xt,{variant:"subtle",onClick:()=>window.open(e,"_blank"),children:"Open"}),f.jsx(xt,{variant:"subtle",onClick:r,children:"Done"})]})]})})}function mP({shares:e,canRevoke:t,onChanged:r}){return e.length===0?null:f.jsxs("div",{className:"share-banner",role:"status",children:[f.jsxs("div",{className:"sb-head",children:[f.jsx(rt,{name:"share"}),f.jsx("b",{children:"Publicly shared"}),f.jsxs("span",{className:"sb-count",children:[e.length," active link",e.length>1?"s":""]})]}),f.jsxs("p",{className:"sb-note",children:[f.jsx("b",{children:"Anyone with this link can view this file"})," — no account needed. It always shows the latest version until you revoke it.",e.some(i=>i.opens!==void 0)&&f.jsxs(f.Fragment,{children:[" ",$C]})]}),e.map(i=>f.jsxs("div",{className:"sb-link",children:[f.jsx("span",{className:"sb-url mono",title:i.url,children:i.url}),f.jsx("span",{className:"sb-meta",children:LC(i,!1)}),f.jsxs("span",{className:"sb-actions",children:[f.jsx(xt,{variant:"subtle",onClick:()=>Mi(i.url).then(o=>qe(o?"Copied.":"Select and copy the link.")),children:"Copy link"}),f.jsx(xt,{variant:"subtle",onClick:()=>window.open(i.url,"_blank"),children:"Open"}),t&&f.jsx("button",{className:"ai-del","aria-label":`Revoke the share of ${i.path}`,onClick:()=>PC(i,r),children:"Revoke"})]})]},i.token))]})}var hw=1,pP=.9,gP=.8,vP=.17,lm=.1,cm=.999,yP=.9999,bP=.99,xP=/[\\\/_+.#"@\[\(\{&]/,wP=/[\\\/_+.#"@\[\(\{&]/g,SP=/[\s-]/,eE=/[\s-]/g;function tp(e,t,r,i,o,l,u){if(l===t.length)return o===e.length?hw:bP;var d=`${o},${l}`;if(u[d]!==void 0)return u[d];for(var m=i.charAt(l),p=r.indexOf(m,o),y=0,v,b,x,w;p>=0;)v=tp(e,t,r,i,p+1,l+1,u),v>y&&(p===o?v*=hw:xP.test(e.charAt(p-1))?(v*=gP,x=e.slice(o,p-1).match(wP),x&&o>0&&(v*=Math.pow(cm,x.length))):SP.test(e.charAt(p-1))?(v*=pP,w=e.slice(o,p-1).match(eE),w&&o>0&&(v*=Math.pow(cm,w.length))):(v*=vP,o>0&&(v*=Math.pow(cm,p-o))),e.charAt(p)!==t.charAt(l)&&(v*=yP)),(vv&&(v=b*lm)),v>y&&(y=v),p=r.indexOf(m,p+1);return u[d]=y,y}function mw(e){return e.toLowerCase().replace(eE," ")}function _P(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,tp(e,t,mw(e),mw(t),0,0,{})}var Yo='[cmdk-group=""]',um='[cmdk-group-items=""]',CP='[cmdk-group-heading=""]',tE='[cmdk-item=""]',pw=`${tE}:not([aria-disabled="true"])`,np="cmdk-item-select",Ds="data-value",EP=(e,t,r)=>_P(e,t,r),nE=S.createContext(void 0),Tl=()=>S.useContext(nE),rE=S.createContext(void 0),yg=()=>S.useContext(rE),aE=S.createContext(void 0),iE=S.forwardRef((e,t)=>{let r=ks(()=>{var M,U;return{search:"",value:(U=(M=e.value)!=null?M:e.defaultValue)!=null?U:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),i=ks(()=>new Set),o=ks(()=>new Map),l=ks(()=>new Map),u=ks(()=>new Set),d=sE(e),{label:m,children:p,value:y,onValueChange:v,filter:b,shouldFilter:x,loop:w,disablePointerSelection:_=!1,vimBindings:E=!0,...R}=e,T=fn(),O=fn(),N=fn(),z=S.useRef(null),B=LP();Ni(()=>{if(y!==void 0){let M=y.trim();r.current.value=M,H.emit()}},[y]),Ni(()=>{B(6,de)},[]);let H=S.useMemo(()=>({subscribe:M=>(u.current.add(M),()=>u.current.delete(M)),snapshot:()=>r.current,setState:(M,U,Q)=>{var K,fe,ae,xe;if(!Object.is(r.current[M],U)){if(r.current[M]=U,M==="search")he(),ge(),B(1,pe);else if(M==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let we=document.getElementById(N);we?we.focus():(K=document.getElementById(T))==null||K.focus()}if(B(7,()=>{var we;r.current.selectedItemId=(we=ee())==null?void 0:we.id,H.emit()}),Q||B(5,de),((fe=d.current)==null?void 0:fe.value)!==void 0){let we=U??"";(xe=(ae=d.current).onValueChange)==null||xe.call(ae,we);return}}H.emit()}},emit:()=>{u.current.forEach(M=>M())}}),[]),I=S.useMemo(()=>({value:(M,U,Q)=>{var K;U!==((K=l.current.get(M))==null?void 0:K.value)&&(l.current.set(M,{value:U,keywords:Q}),r.current.filtered.items.set(M,ne(U,Q)),B(2,()=>{ge(),H.emit()}))},item:(M,U)=>(i.current.add(M),U&&(o.current.has(U)?o.current.get(U).add(M):o.current.set(U,new Set([M]))),B(3,()=>{he(),ge(),r.current.value||pe(),H.emit()}),()=>{l.current.delete(M),i.current.delete(M),r.current.filtered.items.delete(M);let Q=ee();B(4,()=>{he(),Q?.getAttribute("id")===M&&pe(),H.emit()})}),group:M=>(o.current.has(M)||o.current.set(M,new Set),()=>{l.current.delete(M),o.current.delete(M)}),filter:()=>d.current.shouldFilter,label:m||e["aria-label"],getDisablePointerSelection:()=>d.current.disablePointerSelection,listId:T,inputId:N,labelId:O,listInnerRef:z}),[]);function ne(M,U){var Q,K;let fe=(K=(Q=d.current)==null?void 0:Q.filter)!=null?K:EP;return M?fe(M,r.current.search,U):0}function ge(){if(!r.current.search||d.current.shouldFilter===!1)return;let M=r.current.filtered.items,U=[];r.current.filtered.groups.forEach(K=>{let fe=o.current.get(K),ae=0;fe.forEach(xe=>{let we=M.get(xe);ae=Math.max(we,ae)}),U.push([K,ae])});let Q=z.current;ye().sort((K,fe)=>{var ae,xe;let we=K.getAttribute("id"),Me=fe.getAttribute("id");return((ae=M.get(Me))!=null?ae:0)-((xe=M.get(we))!=null?xe:0)}).forEach(K=>{let fe=K.closest(um);fe?fe.appendChild(K.parentElement===fe?K:K.closest(`${um} > *`)):Q.appendChild(K.parentElement===Q?K:K.closest(`${um} > *`))}),U.sort((K,fe)=>fe[1]-K[1]).forEach(K=>{var fe;let ae=(fe=z.current)==null?void 0:fe.querySelector(`${Yo}[${Ds}="${encodeURIComponent(K[0])}"]`);ae?.parentElement.appendChild(ae)})}function pe(){let M=ye().find(Q=>Q.getAttribute("aria-disabled")!=="true"),U=M?.getAttribute(Ds);H.setState("value",U||void 0)}function he(){var M,U,Q,K;if(!r.current.search||d.current.shouldFilter===!1){r.current.filtered.count=i.current.size;return}r.current.filtered.groups=new Set;let fe=0;for(let ae of i.current){let xe=(U=(M=l.current.get(ae))==null?void 0:M.value)!=null?U:"",we=(K=(Q=l.current.get(ae))==null?void 0:Q.keywords)!=null?K:[],Me=ne(xe,we);r.current.filtered.items.set(ae,Me),Me>0&&fe++}for(let[ae,xe]of o.current)for(let we of xe)if(r.current.filtered.items.get(we)>0){r.current.filtered.groups.add(ae);break}r.current.filtered.count=fe}function de(){var M,U,Q;let K=ee();K&&(((M=K.parentElement)==null?void 0:M.firstChild)===K&&((Q=(U=K.closest(Yo))==null?void 0:U.querySelector(CP))==null||Q.scrollIntoView({block:"nearest"})),K.scrollIntoView({block:"nearest"}))}function ee(){var M;return(M=z.current)==null?void 0:M.querySelector(`${tE}[aria-selected="true"]`)}function ye(){var M;return Array.from(((M=z.current)==null?void 0:M.querySelectorAll(pw))||[])}function L(M){let U=ye()[M];U&&H.setState("value",U.getAttribute(Ds))}function Z(M){var U;let Q=ee(),K=ye(),fe=K.findIndex(xe=>xe===Q),ae=K[fe+M];(U=d.current)!=null&&U.loop&&(ae=fe+M<0?K[K.length-1]:fe+M===K.length?K[0]:K[fe+M]),ae&&H.setState("value",ae.getAttribute(Ds))}function re(M){let U=ee(),Q=U?.closest(Yo),K;for(;Q&&!K;)Q=M>0?kP(Q,Yo):zP(Q,Yo),K=Q?.querySelector(pw);K?H.setState("value",K.getAttribute(Ds)):Z(M)}let X=()=>L(ye().length-1),te=M=>{M.preventDefault(),M.metaKey?X():M.altKey?re(1):Z(1)},D=M=>{M.preventDefault(),M.metaKey?L(0):M.altKey?re(-1):Z(-1)};return S.createElement(Pe.div,{ref:t,tabIndex:-1,...R,"cmdk-root":"",onKeyDown:M=>{var U;(U=R.onKeyDown)==null||U.call(R,M);let Q=M.nativeEvent.isComposing||M.keyCode===229;if(!(M.defaultPrevented||Q))switch(M.key){case"n":case"j":{E&&M.ctrlKey&&te(M);break}case"ArrowDown":{te(M);break}case"p":case"k":{E&&M.ctrlKey&&D(M);break}case"ArrowUp":{D(M);break}case"Home":{M.preventDefault(),L(0);break}case"End":{M.preventDefault(),X();break}case"Enter":{M.preventDefault();let K=ee();if(K){let fe=new Event(np);K.dispatchEvent(fe)}}}}},S.createElement("label",{"cmdk-label":"",htmlFor:I.inputId,id:I.labelId,style:IP},m),pd(e,M=>S.createElement(rE.Provider,{value:H},S.createElement(nE.Provider,{value:I},M))))}),RP=S.forwardRef((e,t)=>{var r,i;let o=fn(),l=S.useRef(null),u=S.useContext(aE),d=Tl(),m=sE(e),p=(i=(r=m.current)==null?void 0:r.forceMount)!=null?i:u?.forceMount;Ni(()=>{if(!p)return d.item(o,u?.id)},[p]);let y=oE(o,l,[e.value,e.children,l],e.keywords),v=yg(),b=Za(B=>B.value&&B.value===y.current),x=Za(B=>p||d.filter()===!1?!0:B.search?B.filtered.items.get(o)>0:!0);S.useEffect(()=>{let B=l.current;if(!(!B||e.disabled))return B.addEventListener(np,w),()=>B.removeEventListener(np,w)},[x,e.onSelect,e.disabled]);function w(){var B,H;_(),(H=(B=m.current).onSelect)==null||H.call(B,y.current)}function _(){v.setState("value",y.current,!0)}if(!x)return null;let{disabled:E,value:R,onSelect:T,forceMount:O,keywords:N,...z}=e;return S.createElement(Pe.div,{ref:Us(l,t),...z,id:o,"cmdk-item":"",role:"option","aria-disabled":!!E,"aria-selected":!!b,"data-disabled":!!E,"data-selected":!!b,onPointerMove:E||d.getDisablePointerSelection()?void 0:_,onClick:E?void 0:w},e.children)}),jP=S.forwardRef((e,t)=>{let{heading:r,children:i,forceMount:o,...l}=e,u=fn(),d=S.useRef(null),m=S.useRef(null),p=fn(),y=Tl(),v=Za(x=>o||y.filter()===!1?!0:x.search?x.filtered.groups.has(u):!0);Ni(()=>y.group(u),[]),oE(u,d,[e.value,e.heading,m]);let b=S.useMemo(()=>({id:u,forceMount:o}),[o]);return S.createElement(Pe.div,{ref:Us(d,t),...l,"cmdk-group":"",role:"presentation",hidden:v?void 0:!0},r&&S.createElement("div",{ref:m,"cmdk-group-heading":"","aria-hidden":!0,id:p},r),pd(e,x=>S.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?p:void 0},S.createElement(aE.Provider,{value:b},x))))}),TP=S.forwardRef((e,t)=>{let{alwaysRender:r,...i}=e,o=S.useRef(null),l=Za(u=>!u.search);return!r&&!l?null:S.createElement(Pe.div,{ref:Us(o,t),...i,"cmdk-separator":"",role:"separator"})}),OP=S.forwardRef((e,t)=>{let{onValueChange:r,...i}=e,o=e.value!=null,l=yg(),u=Za(p=>p.search),d=Za(p=>p.selectedItemId),m=Tl();return S.useEffect(()=>{e.value!=null&&l.setState("search",e.value)},[e.value]),S.createElement(Pe.input,{ref:t,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":m.listId,"aria-labelledby":m.labelId,"aria-activedescendant":d,id:m.inputId,type:"text",value:o?e.value:u,onChange:p=>{o||l.setState("search",p.target.value),r?.(p.target.value)}})}),AP=S.forwardRef((e,t)=>{let{children:r,label:i="Suggestions",...o}=e,l=S.useRef(null),u=S.useRef(null),d=Za(p=>p.selectedItemId),m=Tl();return S.useEffect(()=>{if(u.current&&l.current){let p=u.current,y=l.current,v,b=new ResizeObserver(()=>{v=requestAnimationFrame(()=>{let x=p.offsetHeight;y.style.setProperty("--cmdk-list-height",x.toFixed(1)+"px")})});return b.observe(p),()=>{cancelAnimationFrame(v),b.unobserve(p)}}},[]),S.createElement(Pe.div,{ref:Us(l,t),...o,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":d,"aria-label":i,id:m.listId},pd(e,p=>S.createElement("div",{ref:Us(u,m.listInnerRef),"cmdk-list-sizer":""},p)))}),MP=S.forwardRef((e,t)=>{let{open:r,onOpenChange:i,overlayClassName:o,contentClassName:l,container:u,...d}=e;return S.createElement(pp,{open:r,onOpenChange:i},S.createElement(vp,{container:u},S.createElement(yp,{"cmdk-overlay":"",className:o}),S.createElement(bp,{"aria-label":e.label,"cmdk-dialog":"",className:l},S.createElement(iE,{ref:t,...d}))))}),NP=S.forwardRef((e,t)=>Za(r=>r.filtered.count===0)?S.createElement(Pe.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),DP=S.forwardRef((e,t)=>{let{progress:r,children:i,label:o="Loading...",...l}=e;return S.createElement(Pe.div,{ref:t,...l,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":o},pd(e,u=>S.createElement("div",{"aria-hidden":!0},u)))}),md=Object.assign(iE,{List:AP,Item:RP,Input:OP,Group:jP,Separator:TP,Dialog:MP,Empty:NP,Loading:DP});function kP(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function zP(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function sE(e){let t=S.useRef(e);return Ni(()=>{t.current=e}),t}var Ni=typeof window>"u"?S.useEffect:S.useLayoutEffect;function ks(e){let t=S.useRef();return t.current===void 0&&(t.current=e()),t}function Za(e){let t=yg(),r=()=>e(t.snapshot());return S.useSyncExternalStore(t.subscribe,r,r)}function oE(e,t,r,i=[]){let o=S.useRef(),l=Tl();return Ni(()=>{var u;let d=(()=>{var p;for(let y of r){if(typeof y=="string")return y.trim();if(typeof y=="object"&&"current"in y)return y.current?(p=y.current.textContent)==null?void 0:p.trim():o.current}})(),m=i.map(p=>p.trim());l.value(e,d,m),(u=t.current)==null||u.setAttribute(Ds,d),o.current=d}),o}var LP=()=>{let[e,t]=S.useState(),r=ks(()=>new Map);return Ni(()=>{r.current.forEach(i=>i()),r.current=new Map},[e]),(i,o)=>{r.current.set(i,o),t({})}};function $P(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function pd({asChild:e,children:t},r){return e&&S.isValidElement(t)?S.cloneElement($P(t),{ref:t.ref},r(t.props.children)):r(t)}var IP={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function PP({className:e,...t}){return f.jsx(md,{"data-slot":"command",className:We("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t})}function FP({className:e,...t}){return f.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[f.jsx(x_,{className:"size-4 shrink-0 opacity-50"}),f.jsx(md.Input,{"data-slot":"command-input",className:We("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function VP({className:e,...t}){return f.jsx(md.List,{"data-slot":"command-list",className:We("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function UP({className:e,...t}){return f.jsx(md.Item,{"data-slot":"command-item",className:We("relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground",e),...t})}function gw(e,t){if(!e)return{score:0,hits:[]};const r=e.toLowerCase(),i=t.toLowerCase();let o=0,l=0,u=0;const d=[];for(let m=0;m3&&i.endsWith("ies")?o=i.slice(0,-3)+"y":i.length>3&&i.endsWith("es")?o=i.slice(0,-2):i.length>2&&i.endsWith("s")&&(o=i.slice(0,-1)),o?gw(o,t):null}function BP({text:e,hits:t}){const r=[];let i=0;return t.forEach((o,l)=>{o>i&&r.push(e.slice(i,o)),r.push(f.jsx("b",{children:e[o]},l)),i=o+1}),r.push(e.slice(i)),f.jsx("span",{className:"plabel",children:r})}function qP({open:e,onClose:t,candidates:r}){const[i,o]=S.useState(""),l=S.useMemo(()=>{if(!e)return[];const d=[];for(const m of r()){const p=HP(i,m.label);p&&d.push({...m,score:p.score,hits:p.hits})}return d.sort((m,p)=>p.score-m.score),d.slice(0,40)},[e,i,r]);S.useEffect(()=>{e&&o("")},[e]);const u=d=>{t(),d.run()};return f.jsx(Wu,{open:e,onOpenChange:d=>!d&&t(),children:f.jsxs(ed,{id:"palette",className:"palette",showCloseButton:!1,"aria-describedby":void 0,children:[f.jsx(Cl,{className:"sr-only",children:"Search and quick actions"}),f.jsxs(PP,{shouldFilter:!1,loop:!0,children:[f.jsxs("div",{id:"palette-inputwrap",children:[f.jsx(rt,{name:"search"}),f.jsx(FP,{placeholder:"Search file names, projects, actions…",autoComplete:"off",spellCheck:!1,value:i,onValueChange:o})]}),f.jsx(VP,{children:l.length===0?f.jsx("div",{className:"pempty",children:"No matches — search covers file names, projects, and actions"}):l.map(d=>f.jsxs(UP,{value:d.kind+":"+d.label,onSelect:()=>u(d),children:[f.jsx("span",{className:"picon",children:f.jsx(rt,{name:d.icon})}),f.jsx(BP,{text:d.label,hits:d.hits}),f.jsx("span",{className:"pkind",children:d.kind})]},d.kind+":"+d.label))}),f.jsx("footer",{id:"palette-hint",children:"↑↓ navigate · ⏎ select · esc close"})]})]})})}function GP(e,t){return Ft({queryKey:["heatDevices",e],queryFn:()=>qt(e+"heat?by=device&days=30"),enabled:t,retry:!1,staleTime:6e4}).data?.devices??null}const ZP=["all","human","agent","share"],KP={all:"All reads",human:"Human reads",agent:"Agent reads",share:"Shared reads"},YP={agent:{agent:1,human:0,share:0},human:{agent:0,human:1,share:0},share:{agent:0,human:0,share:1}};function vw(e){const[t,r]=S.useState("all"),{flatFiles:i,heatMap:o,devices:l,scope:u}=e,d=w=>!u||w===u||w.startsWith(u+"/"),m=u?i.filter(w=>d(w.path)):i;if(!e.loading&&!m.length)return f.jsxs("div",{className:"insights",children:[f.jsxs("h1",{className:"in-title",children:["Knowledge insights",u?f.jsxs("span",{className:"in-scope",children:[" · ",u]}):null]}),f.jsxs("div",{className:"dl-empty in-blank",children:[f.jsx("p",{children:u?`Nothing in ${u} to chart yet.`:"Nothing to chart yet."}),f.jsx("p",{children:u?`No files under ${u} are syncing here yet.`:"This project has no files. Once a device syncs files here, the map, the reads × freshness plot and the hot path fill in on their own."}),e.installHref&&f.jsx("a",{className:"pbtn",...Zs(e.installHref),children:"Set up a device →"})]})]});const p=l&&u?l.map(w=>{const _=Object.create(null);for(const[E,R]of Object.entries(w.folders||{}))d(E)&&(_[E]=R);return{...w,folders:_}}).filter(w=>Object.keys(w.folders).length>0):l,y=Date.now(),v=m.map(w=>{const _=o&&o[w.path]||{},E=w.time?Math.max(0,(y-new Date(w.time).getTime())/864e5):0,R=t==="all"?na(_):_[t]||0;return{path:w.path,reads:R,agent:_.agent||0,human:_.human||0,share:_.share||0,total:na(_),days:E,danger:GC(R,E)}}),b=uI(o,new Set(i.map(w=>w.path))).filter(d).map(w=>{const _=o[w];return{path:w,reads:t==="all"?na(_):_[t]||0,agent:_.agent||0,human:_.human||0,share:_.share||0,total:na(_),days:0,danger:!1,orphan:!0}}).filter(w=>w.reads>0),x=b.length>0?f.jsxs("p",{className:"in-legend in-orphan-note",children:[rp(b.length,"file")," with reads ",b.length===1?"is":"are"," no longer in the project — see Hot path."]}):null;return f.jsxs("div",{className:"insights",children:[f.jsxs("h1",{className:"in-title",children:["Knowledge insights",u?f.jsxs("span",{className:"in-scope",children:[" · ",u]}):null]}),f.jsx("p",{className:"dl-sub",children:u?`Reads over the last 30 days × freshness, for ${u} and everything in it. ${Ci}`:"Reads over the last 30 days × how long since each file changed. Hot but stale knowledge — read a lot, maintained by nobody — is the danger zone. "+Ci}),f.jsx("div",{className:"in-lens",children:ZP.map(w=>f.jsx("button",{className:"in-lens-btn"+(w===t?" active":""),onClick:()=>r(w),children:KP[w]},w))}),f.jsx("h3",{className:"dl-h3",children:"Map — cell size = reads, color = freshness (scale below)"}),f.jsx(XP,{pts:v,onOpenFile:e.onOpenFile,onOpenFolder:e.onOpenFolder,isFolder:e.isFolder}),x,f.jsxs("h3",{className:"dl-h3 in-h3-row",children:["Reads × freshness",f.jsx("span",{className:"in-cap",children:"dot size = agent share of reads"})]}),f.jsx(WP,{pts:v,onOpenFile:e.onOpenFile}),x,f.jsx("h3",{className:"dl-h3",children:"Hot path — top files by reads"}),f.jsx(eF,{pts:[...v,...b],lens:t,onOpenFile:e.onOpenFile,onOpenHistory:e.onOpenHistory}),p&&p.length>0&&f.jsxs(f.Fragment,{children:[f.jsx("h3",{className:"dl-h3",children:"Agent coverage — which agents read which areas"}),f.jsx(tF,{devices:p})]})]})}const QP="rgb(150,156,164)";function lE(e){const t=[[76,195,138],[232,196,84],[224,93,93]],r=Math.min(1,Math.max(0,e/300))*(t.length-1),i=Math.min(t.length-2,Math.floor(r)),o=r-i,l=t[i].map((u,d)=>Math.round(u+(t[i+1][d]-u)*o));return`rgb(${l[0]},${l[1]},${l[2]})`}function yw(e,t,r,i,o){const l=e.reduce((p,y)=>p+y.value,0);if(!l||i<=0||o<=0)return[];const u=e.slice().sort((p,y)=>y.value-p.value).map(p=>({it:p,a:p.value/l*i*o})),d=(p,y)=>{const b=p.reduce((w,_)=>w+_.a,0)/y;let x=0;for(const w of p){const _=w.a/b;x=Math.max(x,_/b,b/_)}return x},m=[];for(;u.length;){const p=i>=o,y=p?o:i,v=[u.shift()];for(;u.length&&d(v.concat(u[0]),y)<=d(v,y);)v.push(u.shift());const b=v.reduce((w,_)=>w+_.a,0)/y;let x=0;for(const w of v){const _=w.a/b;p?m.push({item:w.it,x:t,y:r+x,w:b,h:_}):m.push({item:w.it,x:t+x,y:r,w:_,h:b}),x+=_}p?(t+=b,i-=b):(r+=b,o-=b)}return m}const dm=15;function bw(e,t,r){const i=Math.floor((r-8)/6),o=`${e} · ${t}`;return o.length<=i?{label:o,fit:i}:{label:e.length>i?e.slice(0,Math.max(1,i-1))+"…":e,fit:i}}const rp=(e,t)=>`${e} ${t}${e===1?"":"s"}`;function XP({pts:e,onOpenFile:t,onOpenFolder:r,isFolder:i}){const u=fI(e.map(y=>y.days)),d=!!u&&hI(u.min,u.max),m=new Map;for(const y of e){const v=y.path.includes("/")?y.path.split("/")[0]:"/";let b=m.get(v);b||m.set(v,b={name:v,files:[],value:0,reads:0}),b.files.push(y),b.value+=y.reads+1,b.reads+=y.reads}const p=[];for(const y of yw([...m.values()],0,0,720,480)){const v=y.item,b=v.name==="/"?"":v.name,x=v.name==="/"?"(root)":v.name;if(p.push(f.jsx("rect",{x:y.x+1,y:y.y+1,width:Math.max(0,y.w-2),height:Math.max(0,y.h-2),rx:3,className:"in-tm-group","data-dir":b,children:f.jsx("title",{children:`${v.name==="/"?"(root)":v.name+"/"} — ${rp(v.reads,"read")}/30d · ${rp(v.files.length,"file")}`})},"g"+v.name)),y.w>46&&y.h>dm+10){const{label:_}=bw(x,v.reads,y.w);p.push(f.jsx("text",{x:y.x+5,y:y.y+12,className:"in-tm-glabel","data-dir":b,children:_},"gl"+v.name))}const w=yw(v.files.map(_=>({..._,name:_.path.split("/").pop(),value:_.reads+1})),y.x+2,y.y+dm,Math.max(0,y.w-4),Math.max(0,y.h-dm-2));for(const _ of w)if(p.push(f.jsx("rect",{x:_.x+.6,y:_.y+.6,width:Math.max(.4,_.w-1.2),height:Math.max(.4,_.h-1.2),rx:1.5,fill:d?QP:lE(_.item.days),className:"in-tm-cell","data-path":_.item.path,children:f.jsx("title",{children:`${_.item.path} — ${_.item.reads} read${_.item.reads===1?"":"s"}/30d · changed ${Math.round(_.item.days)}d ago`})},_.item.path)),_.w>54&&_.h>16){const{label:E,fit:R}=bw((_.item.danger?"⚠ ":"")+_.item.name,_.item.reads,_.w);R>=5&&p.push(f.jsx("text",{x:_.x+4.5,y:_.y+12.5,className:"in-tm-label","data-path":_.item.path,children:E},"l"+_.item.path))}}return f.jsxs(f.Fragment,{children:[f.jsx("svg",{viewBox:"0 0 720 480",className:"in-chart in-treemap",onClick:y=>{const v=y.target.closest("[data-path], [data-dir]");if(!v)return;const b=v.getAttribute("data-path");if(b)return t(b);const x=v.getAttribute("data-dir");x&&i(x)&&r(x)},children:p}),f.jsx(JP,{range:u,flat:d})]})}function JP({range:e,flat:t}){if(!e)return null;const r=mI(e.min,e.max);return f.jsxs("p",{className:"in-legend in-tm-legend",children:["freshness 0d",f.jsx("span",{className:"in-sw in-sw-age"+(t?" in-sw-flat":""),style:{background:`linear-gradient(to right, ${[0,60,150,300].map(lE).join(", ")})`}}),"300d+",f.jsx("span",{className:"in-tm-range",children:t?`all files here: ${r} old — colour off, not enough range to rank`:`observed: ${r} old`})]})}function WP({pts:e,onOpenFile:t}){const o={l:44,r:16,t:20,b:34},l=Math.max(Ns*2,...e.map(w=>w.days)),u=Math.max(tl*2,...e.map(w=>w.reads)),d=w=>Math.log10(w+1)/Math.log10(l+1),m=w=>Math.log10(w+1)/Math.log10(u+1),p=w=>3+4*w,y=p(1),v=w=>o.l+y+d(w)*(720-o.l-o.r-2*y),b=w=>360-o.b-y-m(w)*(360-o.t-o.b-2*y),x=vI(e.filter(w=>w.danger).map(w=>({path:w.path,reads:w.reads,cx:v(w.days),cy:b(w.reads),r:p(w.total?(w.agent||0)/w.total:0)})),{right:720-o.r,top:o.t+8,bottom:360-o.b-4});return f.jsxs("svg",{viewBox:"0 0 720 360",className:"in-chart",children:[f.jsx("rect",{x:v(Ns),y:o.t,width:720-o.r-v(Ns),height:b(tl)-o.t,className:"in-danger-zone"}),f.jsx("line",{x1:v(Ns),y1:o.t,x2:v(Ns),y2:360-o.b,className:"in-threshold"}),f.jsx("line",{x1:o.l,y1:b(tl),x2:720-o.r,y2:b(tl),className:"in-threshold"}),f.jsx("line",{x1:o.l,y1:360-o.b,x2:720-o.r,y2:360-o.b,className:"in-axis"}),f.jsx("line",{x1:o.l,y1:o.t,x2:o.l,y2:360-o.b,className:"in-axis"}),f.jsx("text",{x:(o.l+720-o.r)/2,y:352,className:"in-label",children:"days since last change →"}),f.jsx("text",{x:12,y:(o.t+360-o.b)/2,className:"in-label",transform:`rotate(-90 12 ${(o.t+360-o.b)/2})`,children:"reads / 30d →"}),f.jsx("text",{x:720-o.r-6,y:o.t+14,className:"in-quad in-quad-danger",textAnchor:"end",children:"hot + stale"}),f.jsx("text",{x:o.l+6,y:o.t+14,className:"in-quad",children:"hot + fresh"}),f.jsx("text",{x:720-o.r-6,y:360-o.b-8,className:"in-quad",textAnchor:"end",children:"cold + stale"}),f.jsx("text",{x:o.l+6,y:360-o.b-8,className:"in-quad",children:"cold + fresh"}),e.map(w=>{const _=w.total?(w.agent||0)/w.total:0;return f.jsx("circle",{cx:Number(v(w.days).toFixed(1)),cy:Number(b(w.reads).toFixed(1)),r:Number(p(_).toFixed(1)),className:"in-pt"+(w.danger?" danger":w.reads?"":" cold"),onClick:()=>t(w.path),children:f.jsx("title",{children:`${w.path} — ${w.reads} read${w.reads===1?"":"s"} / 30d · changed ${Math.round(w.days)}d ago`})},w.path)}),x.map(w=>f.jsx("text",{x:Number(w.x.toFixed(1)),y:Number(w.y.toFixed(1)),textAnchor:w.anchor,className:"in-pt-label",children:w.name},w.path))]})}function eF({pts:e,lens:t,onOpenFile:r,onOpenHistory:i}){const o=e.filter(d=>d.reads>0).sort((d,m)=>m.reads-d.reads||m.days-d.days).slice(0,20);if(!o.length)return f.jsx("div",{className:"dl-empty",children:"No reads in the window yet."});const l=o[0].reads,u=o.some(d=>d.share>0);return f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"in-hotpath",children:o.map(d=>{const m=YP[t]??cI(d),p=d.reads/l*100,y=()=>d.orphan?i(d.path):r(d.path);return f.jsxs("div",{className:"in-hp-row",tabIndex:0,role:"button",title:d.orphan?`${d.reads} read${d.reads===1?"":"s"}/30d · no longer in the project — open its history`:d.danger?`${d.reads} read${d.reads===1?"":"s"}/30d · unchanged ${Math.round(d.days)}d — review this file`:d.path,onClick:y,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),y())},children:[f.jsx("span",{className:"in-hp-name"+(d.danger?" danger":""),children:d.path+(d.danger?" ⚠":"")}),d.orphan&&f.jsx("span",{className:"in-hp-gone",children:"· no longer in the project"}),f.jsxs("span",{className:"in-hp-bar",children:[f.jsx("span",{className:"in-hp-agent",style:{width:(p*m.agent).toFixed(1)+"%"}}),f.jsx("span",{className:"in-hp-human",style:{width:(p*m.human).toFixed(1)+"%"}}),f.jsx("span",{className:"in-hp-share",style:{width:(p*m.share).toFixed(1)+"%"}})]}),f.jsx("span",{className:"in-hp-count",children:d.reads})]},d.path)})}),f.jsxs("p",{className:"in-legend",children:[f.jsx("span",{className:"in-sw agent"})," agent reads ",f.jsx("span",{className:"in-sw human"})," human reads",u&&f.jsxs(f.Fragment,{children:[" ",f.jsx("span",{className:"in-sw share"})," shared reads"]})]})]})}function tF({devices:e}){const t=new Map;for(const b of e)for(const[x,w]of Object.entries(b.folders||{}))t.set(x,(t.get(x)||0)+w);const r=[...t.entries()].sort((b,x)=>x[1]-b[1]).slice(0,12).map(b=>b[0]),i=e.slice(0,12),o=140,l=6,u=Math.min(76,Math.max(34,(720-o-8)/r.length)),d=26,m=720,p=l+i.length*d+58,y=Math.max(1,...i.flatMap(b=>r.map(x=>(b.folders||{})[x]||0))),v=b=>{const x=[23,25,31],w=[245,166,35],_=x.map((E,R)=>Math.round(E+(w[R]-E)*b));return`rgb(${_[0]},${_[1]},${_[2]})`};return f.jsxs("svg",{viewBox:`0 0 ${m} ${p}`,className:"in-chart in-matrix",children:[i.map((b,x)=>{let w=b.name||b.id||"";return w.length>20&&(w=w.slice(0,19)+"…"),f.jsxs("g",{children:[f.jsx("text",{x:o-8,y:l+x*d+17,textAnchor:"end",className:"in-label",children:w}),r.map((_,E)=>{const R=(b.folders||{})[_]||0;return f.jsx("rect",{x:o+E*u,y:l+x*d,width:u-4,height:d-4,rx:3,fill:v(Math.sqrt(R/y)),children:f.jsx("title",{children:`${b.name||b.id} × ${_||"(root)"}: ${R} read${R===1?"":"s"}/30d`})},_)})]},b.id||x)}),r.map((b,x)=>{const w=o+x*u+(u-4)/2,_=l+i.length*d+14;return f.jsx("text",{x:w,y:_,className:"in-label",textAnchor:"end",transform:`rotate(-28 ${w} ${_})`,children:b||"(root)"},b)})]})}function cE(e){return new Set(e.entries.map(t=>t.path)).size}function nF(e){const t=l=>(l.session?"s\0"+l.session:"n\0"+l.note)+"\0"+(l.device?.id??""),r=new Map;e.forEach((l,u)=>{if(!l.note&&!l.session)return;const d=r.get(t(l));if(d){d.entries.push(l),d.idx.push(u);return}r.set(t(l),{note:l.note??"",session:l.session,entries:[l],idx:[u]})});const i=[],o=new Set;return e.forEach((l,u)=>{const d=l.note||l.session?r.get(t(l)):void 0;if(!d||cE(d)<2){i.push({i:u});return}o.has(d)||(o.add(d),i.push({run:d,i:u}))}),i}function rF(e){const{filters:t,authors:r,onChange:i}=e,o=(y,v)=>i({...t,[y]:v||void 0}),[l,u]=S.useState(t?.q??""),d=S.useRef(!1);S.useEffect(()=>{d.current||u(t?.q??"")},[t?.q]),S.useEffect(()=>{if(!d.current)return;const y=setTimeout(()=>{d.current=!1,l!==(t?.q??"")&&o("q",l)},250);return()=>clearTimeout(y)},[l]);const m=t?.user&&!r.includes(t.user)?[t.user,...r]:r,p=Yp(t);return f.jsxs("div",{className:"hfilters",children:[f.jsxs("label",{className:"hf-search",children:[f.jsx(rt,{name:"search"}),f.jsx(fu,{type:"search",value:l,placeholder:"path contains…","aria-label":"Filter by path",onChange:y=>{d.current=!0,u(y.target.value)}})]}),f.jsxs("select",{className:"hf-user",value:t?.user??"","aria-label":"Filter by author",onChange:y=>o("user",y.target.value),children:[f.jsx("option",{value:"",children:"Anyone"}),m.map(y=>f.jsx("option",{value:y,children:y},y))]}),f.jsxs("span",{className:"hf-dates",children:[f.jsx("span",{className:"hf-lbl",children:"UTC"}),f.jsx(fu,{type:"date",className:"hf-date",value:t?.since??"","aria-label":"From date (UTC)",onChange:y=>o("since",y.target.value)}),f.jsx("span",{className:"hf-dash",children:"–"}),f.jsx(fu,{type:"date",className:"hf-date",value:t?.until??"","aria-label":"To date (UTC)",onChange:y=>o("until",y.target.value)})]}),p&&f.jsx("button",{type:"button",className:"hf-clear",onClick:()=>i({}),children:"Clear"})]})}function aF(e){const t=new Set;for(const r of e)r.user&&t.add(r.user);return[...t].sort()}function iF(e){const{apiBase:t,target:r,isFolder:i,onMeta:o,onRendered:l,restore:u,remove:d,undoRun:m,filters:p}=e,y=r?i(r)?{prefix:r+"/"}:{path:r}:{prefix:""},v=("path"in y&&y.path!==void 0?"path="+encodeURIComponent(y.path):"prefix="+encodeURIComponent(y.prefix??""))+D_(p).replace("?","&"),{data:b,error:x,isPending:w,fetchNextPage:_,hasNextPage:E,isFetchingNextPage:R}=yj({queryKey:["history",t,v],queryFn:({pageParam:ne})=>qt(t+"history?"+v+"&n=100"+(ne?"&cursor="+encodeURIComponent(ne):"")),initialPageParam:"",getNextPageParam:ne=>ne.next_cursor,staleTime:15e3}),T=S.useRef(new Set);S.useEffect(()=>{x&&o("History unavailable: "+x.message)},[x,o]),S.useEffect(()=>{b&&l?.()},[b,l]);const O=b?b.pages.flatMap(ne=>ne.entries||[]):[];for(const ne of aF(O))T.current.add(ne);const N=e.onFilters&&f.jsx(rF,{filters:p,authors:[...T.current].sort(),onChange:e.onFilters});if(!b)return f.jsxs("div",{className:"history",children:[N,w&&!x&&f.jsx("div",{className:"empty",children:"Loading…"})]});const z=ne=>{for(let ge=ne+1;ge{const ge=O[ne].kind==="delete"?z(ne):O[ne].blob;return ge&&ge===B.get(O[ne].path)?void 0:ge},I=ne=>B.get(O[ne].path)==="";return f.jsxs("div",{className:"history",children:[N,O.length===0&&(Yp(p)?f.jsxs("div",{className:"empty",children:["No changes match these filters.",f.jsx("br",{}),f.jsx("button",{type:"button",className:"btn hf-clear-empty",onClick:()=>e.onFilters?.({}),children:"Clear filters"})]}):f.jsx("div",{className:"empty",children:"No history yet."})),nF(O).map((ne,ge)=>ne.run?f.jsx(sF,{run:ne.run,onOpen:e.onOpen,apiBase:t,prevBlob:z,restoreSha:H,recreates:I,restore:u,remove:d,undoRun:m},"g"+ge):f.jsx(vg,{entry:O[ne.i],apiBase:t,onOpen:e.onOpen,diff:{apiBase:t,prev:z(ne.i)},restore:u,restoreSha:H(ne.i),recreates:I(ne.i)},"r"+ne.i)),E&&f.jsx("button",{type:"button",className:"btn hmore",onClick:()=>_(),disabled:R,children:R?"Loading…":"Load more"})]})}function sF({run:e,onOpen:t,apiBase:r,prevBlob:i,restoreSha:o,recreates:l,restore:u,remove:d,undoRun:m}){const[p,y]=S.useState(!0),v=e.entries[0],b=fd(v),x=[v.device.name||v.device.id,v.device.os].filter(Boolean).join(" · "),w=v.session,_=v.device?.id,{data:E}=Ft({queryKey:["session-reads",r,w,_],queryFn:()=>qt(r+"heat?session="+encodeURIComponent(w)+"&device="+encodeURIComponent(_)),enabled:!!w&&!!_,staleTime:3e4}),R=new Set(E?.paths??[]),T=new Set(e.entries.map(I=>I.path)),O=[...R].filter(I=>!T.has(I)).sort(),N=e.entries.map(I=>new Date(I.time).getTime()),z=oF(Math.min(...N),Math.max(...N)),B=cE(e),H=!!m?.busy&&m.busy===(e.session||e.note);return f.jsxs("div",{className:"hrun"+(p?" open":""),children:[f.jsxs("div",{className:"hrun-head",children:[f.jsx("button",{type:"button",className:"hrun-toggle","aria-expanded":p,title:p?"Collapse this run":"Expand this run",onClick:()=>y(!p),children:f.jsx(rt,{name:p?"chevd":"chev"})}),f.jsx("span",{className:"hrun-note",children:f.jsx(JC,{text:e.note})}),f.jsxs("span",{className:"hrun-meta",children:[R.size>0?`read ${R.size} · changed ${B}`:`${B} file${B===1?"":"s"}`," ·"," ",b,x?" · "+x:""]}),f.jsx("span",{className:"hrun-time",children:z}),m&&f.jsxs("button",{type:"button",className:"hrun-undo",disabled:H,title:"Put every file this run touched back the way it was",onClick:()=>m.onUndoRun(e),children:[f.jsx(rt,{name:"hist"}),H?"undoing…":"undo this run"]})]}),p&&f.jsxs("div",{className:"hrun-body",children:[e.entries.map((I,ne)=>f.jsx(vg,{entry:I,apiBase:r,onOpen:t,diff:{apiBase:r,prev:i(e.idx[ne])},restore:u,remove:d,restoreSha:o(e.idx[ne]),recreates:l(e.idx[ne]),inRun:!0,read:R.has(I.path)},ne)),O.length>0&&f.jsxs("div",{className:"hrun-reads",children:[f.jsx("div",{className:"hrun-reads-head",children:"Read, not changed"}),O.map(I=>f.jsxs("button",{type:"button",className:"hrun-read",onClick:()=>t(I),children:[f.jsx("span",{className:"hkind",children:"read"}),f.jsx("span",{className:"hpath",children:I})]},I))]}),w&&f.jsx("div",{className:"hrun-foot",children:"Reads shown only for files the project still has."})]})]})}function oF(e,t){const r=new Date(e),i=new Date(t),o=u=>u.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});if(r.toDateString()!==i.toDateString())return r.toLocaleString()+" – "+i.toLocaleString();const l=i.toLocaleDateString();return e===t?l+" "+o(i):l+" "+o(r)+" – "+o(i)}function lF(e,t){return e?t(e)?e+"/ (folder)":e:"all changes"}function cF(e){const{apiBase:t,path:r,version:i}=e,o="path="+encodeURIComponent(r),{data:l}=Ft({queryKey:["history",t,o,200],queryFn:()=>qt(t+"history?"+o+"&n=200"),staleTime:15e3}),u=l?.entries?.find(y=>y.blob===i),d=u?fd(u):"",m=u?.time?new Date(u.time).toLocaleString():"",p=t+"blob?sha="+i+"&name="+encodeURIComponent(r.split("/").pop()||r)+"&download=1";return f.jsxs("div",{className:"vbanner",role:"status",children:[f.jsx("span",{className:"vb-icon",children:f.jsx(rt,{name:"clock"})}),f.jsxs("div",{className:"vb-text",children:[f.jsx("b",{children:[m&&"Version from "+m,d&&"by "+d].filter(Boolean).join(" ")||"Earlier version"}),f.jsx("span",{children:"This is not the current file."})]}),f.jsxs("div",{className:"vb-actions",children:[f.jsx("button",{className:"ai-btn",onClick:e.onViewCurrent,children:"View current"}),f.jsx("a",{className:"ai-btn",download:!0,href:p,children:"Download this version"})]})]})}function uF(e){const{conflict:t,originalHref:r}=e,i=t.device||"another device";return f.jsxs("div",{className:"vbanner",role:"status",children:[f.jsx("span",{className:"vb-icon",children:f.jsx(rt,{name:"alert"})}),f.jsxs("div",{className:"vb-text",children:[f.jsx("b",{children:"Conflict copy — a concurrent edit, preserved"}),f.jsxs("span",{children:[i," edited this file at the same time as someone else on"," ",t.when.toLocaleString(),". Rather than drop either version, beardrive kept that one here."," ",r?f.jsxs(f.Fragment,{children:["The other version lives at ",f.jsx("code",{children:t.original})]}):f.jsx(f.Fragment,{children:"The other version kept the original name."})]})]}),r&&f.jsx("div",{className:"vb-actions",children:f.jsx("button",{className:"ai-btn",onClick:r,children:"Open the other version"})})]})}const dF={aws_access_key_id:"an AWS access key",openai_api_key:"an OpenAI API key",github_pat:"a GitHub token",slack_token:"a Slack token",private_key:"a private key",gitlab_pat:"a GitLab token"};function fF(e=[]){const t=e.map(i=>`${dF[i.rule]??i.rule} (line ${i.line})`);return`BearDrive found ${t.length>1?t.slice(0,-1).join(", ")+" and "+t[t.length-1]:t[0]||"something credential-shaped"} in this file. The check covers the file at the moment you share it — a link always serves the file's latest content, so later changes are never checked. Share anyway?`}function uE(e){const{config:t,apiBase:r,route:i,hub:o,project:l}=e,u=Xp(),d=Di(),{tree:m,flatFiles:p,dirIndex:y,loaded:v}=xI(r,!o||!!l),b=wI(r,o&&!!l&&!!t.reads?.enabled),x=o&&!!l&&!i.path&&!i.view,w=i.view==="dashboard"||x,_=GP(r,w);S.useEffect(()=>{w&&d.invalidateQueries({queryKey:["heat",r]})},[w,r,d]);const E=i.path,R=i.view?void 0:i.version,T=E||(i.view==="dashboard"||i.view==="history")&&i.viewTarget||"",O=!!E&&y.has(E),N=!!E&&v&&!O&&p.some(W=>W.path===E),z=!!E&&v&&!O&&!N,B=O&&!i.view,{data:H}=Ft({queryKey:["resolve",r,E],queryFn:()=>qt(r+"resolve?path="+encodeURIComponent(E)),enabled:z,retry:!1,staleTime:6e4}),[I,ne]=S.useState(null);S.useEffect(()=>{!z||!H?.to||(ne({from:E,to:H.to}),Yt(Gs(H.to,l?.id),{replace:!0}))},[z,H,E,l?.id]);const[ge,pe]=S.useState(()=>new Set),he=S.useRef(!0);S.useEffect(()=>{if(!m||!he.current)return;he.current=!1;const W=(m.children||[]).filter(le=>le.dir);W.length===1&&pe(le=>new Set(le).add(W[0].path))},[m]),S.useEffect(()=>{!T||!v||pe(W=>{const le=new Set(W);for(const Re of UI(T))le.add(Re);return y.has(T)&&le.add(T),le})},[T,v,y]);const de=S.useCallback(W=>{pe(le=>{const Re=new Set(le);return Re.has(W)?Re.delete(W):Re.add(W),Re})},[]),ee=S.useRef(null),ye=S.useRef(new Map),L=S.useRef({key:"",want:0,attempts:0});S.useEffect(()=>{L.current={key:u,want:I3()==="POP"?ye.current.get(u)??0:0,attempts:0}},[u]);const Z=S.useCallback(()=>{const W=ee.current,le=L.current;!W||le.key!==u||le.attempts>=3||(le.attempts++,W.scrollTo({top:le.want,behavior:"instant"}))},[u]),re=S.useCallback(()=>{ee.current&&ye.current.set(u,ee.current.scrollTop)},[u]),X=S.useCallback((W,le)=>{Yt(Gs(W,l?.id,le)),hr()},[l?.id]),te=S.useCallback(W=>Yt(Pn("history",l?.id,W)),[l?.id]),[D,M]=S.useState(""),[U,Q]=S.useState(null),[K,fe]=S.useState(!1),[ae,xe]=S.useState(!1);S.useEffect(()=>ZD(()=>xe(!0)),[]);const we=S.useRef(null),Me=e.panel??null,Fe=!Me&&o&&!!l&&N&&_i(l.perm,"write"),{data:He}=T_(l?.id,o&&!!l),ct=S.useCallback(()=>{d.invalidateQueries({queryKey:["shares",l?.id]})},[d,l?.id]),Je=N?(He||[]).filter(W=>W.path===E):[],hn=!Me&&o&&!!l,mn=!Me&&N,Xt=!Me&&(N||o&&!!l&&O),yr=R?r+"blob?sha="+R+"&name="+encodeURIComponent(E)+"&download=1":r+"download?path="+encodeURIComponent(E),At=S.useCallback(async()=>{const W=le=>fetch(r+"shares",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(le?{path:E,confirm:!0}:{path:E})});try{let le=await W(!1);if(le.status===409){const{findings:it}=await le.json();if(!await za("This file may contain credentials",fF(it),"Share anyway",!0))return;le=await W(!0)}if(!le.ok)throw new Error(await le.text());const Re=await le.json();zw("share_created");const ze=await Mi(Re.url);Q({url:Re.url,copied:ze}),ct()}catch(le){qe("Share failed: "+le.message,!0)}},[r,E,ct]),[rr,br]=S.useState(""),Rt=o&&!!l&&_i(l?.perm,"write"),Vn=S.useCallback(async(W,le,Re)=>{if(await za("Restore this version of "+W+"?","It syncs to every device as a new change. "+(Re?"The file comes back on every device. Removing it again isn't available from History yet.":"You can restore any other version afterwards."),"Restore")){br(W+le);try{await ea(r+"restore",{path:W,sha:le}),d.invalidateQueries({queryKey:["history",r]}),d.invalidateQueries({queryKey:["tree",r]}),d.invalidateQueries({queryKey:["render",r,W]}),d.invalidateQueries({queryKey:["text"]}),qe("Restored "+W+" — it syncs to every device like any other change.")}catch(ze){qe("Restore failed: "+ze.message,!0)}finally{br("")}}},[r,d]),[zt,Dr]=S.useState(""),ar=S.useCallback(async W=>{if(await za("Remove "+W+"?","It disappears from every synced device. History keeps it — you can restore it from the DELETED row afterwards.","Remove file",!0)){Dr(W);try{await ea(r+"remove",{path:W}),d.invalidateQueries({queryKey:["history",r]}),d.invalidateQueries({queryKey:["tree",r]}),d.invalidateQueries({queryKey:["render",r,W]}),d.invalidateQueries({queryKey:["text"]}),qe("Removed "+W+" — it syncs to every device like any other change.")}catch(le){qe("Remove failed: "+le.message,!0)}finally{Dr("")}}},[r,d]),[oa,ir]=S.useState(""),la=S.useCallback(async W=>{const le=W.session||W.note,Re=W.session?{session:W.session,device:W.entries[0]?.device?.id}:{note:W.note,device:W.entries[0]?.device?.id};ir(le);try{const ze=await ea(r+"undo-run",{...Re,preview:!0}),it=new Set(ze.changed_after);if(!ze.undone.length){qe("Nothing to undo — every file this run touched already holds its pre-run content.");return}if(!await za("Undo this run?",f.jsxs(f.Fragment,{children:[f.jsxs("div",{children:[W.note||le," — ",ze.undone.length," file",ze.undone.length===1?"":"s"]}),f.jsx("div",{className:"undo-list",children:ze.undone.map(st=>f.jsxs("div",{className:"undo-row",children:[f.jsx("span",{className:"undo-path",children:st.path}),it.has(st.path)&&f.jsx("span",{className:"undo-after",children:"changed after this run"}),f.jsx("span",{className:"undo-what",children:st.action==="remove"?"remove (the run created it)":"restore to pre-run version"})]},st.path))}),it.size>0&&f.jsxs("div",{className:"undo-warn",children:[it.size," file",it.size===1?" was":"s were"," changed by someone else after this run. Undoing overwrites ",it.size===1?"that change":"those changes"," too."]}),ze.skipped.length>0&&f.jsxs("div",{children:[ze.skipped.length," already hold",ze.skipped.length===1?"s":""," its pre-run content and will be left alone."]}),ze.refused.length>0&&f.jsxs("div",{children:[ze.refused.length," path",ze.refused.length===1?"":"s"," can't be written by the hub and will be left alone: ",ze.refused.join(", "),"."]})]}),"Undo run",!0))return;const Ae=await ea(r+"undo-run",Re);d.invalidateQueries({queryKey:["history",r]}),d.invalidateQueries({queryKey:["tree",r]}),d.invalidateQueries({queryKey:["render",r]}),d.invalidateQueries({queryKey:["text"]});const ut=Ae.skipped.length?`, skipped ${Ae.skipped.length} (already current)`:"";qe(`Undid ${Ae.undone.length} file${Ae.undone.length===1?"":"s"}${ut}.`)}catch(ze){qe("Undo failed: "+ze.message,!0)}finally{ir("")}},[r,d]),Jt=S.useCallback(()=>{if(!E)return te("");te(O?E+"/":E)},[E,O,te]);S.useEffect(()=>{const W=le=>{(le.metaKey||le.ctrlKey)&&le.key.toLowerCase()==="k"&&(le.preventDefault(),xe(Re=>!Re))};return window.addEventListener("keydown",W),()=>window.removeEventListener("keydown",W)},[]);const A=S.useCallback(()=>{const W=[],le=(Re,ze,it,_t)=>W.push({icon:Re,label:ze,kind:it,run:_t});if(o&&l){const Re=l.id,ze=it=>()=>{e.onClosePanel?.(),Yt(it)};le("folder",l.name+" — project root","project",ze("/"+Re)),le("dashboard","Dashboard","action",ze(Pn("dashboard",Re))),le("terminal","Installation","action",ze(Pn("install",Re))),le("gear","Settings","action",ze(Pn("settings",Re)))}if(o&&l&&E&&(N&&le("share","Share: "+E,"action",At),le("hist","History: "+E,"action",Jt),N&&le("download","Download: "+E,"action",()=>we.current?.click())),o&&l&&le("hist","History: whole project","action",()=>te("")),o)for(const Re of e.projects||[])(!l||Re.id!==l.id)&&le("folder","Switch to project: "+Re.name,"project",()=>Yt("/"+Re.id));t.auth?.enabled&&le("power","Sign out","action",()=>window.location.href="/auth/logout");for(const Re of y.keys())le("folder",Re,"folder",()=>X(Re));for(const Re of p)le("doc",Re.path,"file",()=>X(Re.path));return W},[o,l,E,N,t.auth?.enabled,y,p,e.projects,e.onClosePanel,At,Jt,te,X]);S.useEffect(()=>{if(!K)return;const W=()=>fe(!1);return document.addEventListener("click",W),()=>document.removeEventListener("click",W)},[K]);const P=S.useCallback(W=>y.has(W),[y]);let F="app",ue,oe;if(Me)oe=Me.body;else if(i.view==="dashboard")oe=f.jsx(vw,{flatFiles:p,heatMap:b,devices:_,scope:i.viewTarget||"",loading:!v,installHref:l?Pn("install",l.id):void 0,onOpenFile:X,onOpenFolder:X,onOpenHistory:te,isFolder:P});else if(i.view==="history")oe=f.jsx(iF,{apiBase:r,target:i.viewTarget||"",isFolder:P,onOpen:X,onMeta:M,onRendered:Z,restore:Rt?{onRestore:Vn,busy:rr}:void 0,remove:Rt?{onRemove:ar,busy:zt}:void 0,undoRun:Rt?{onUndoRun:la,busy:oa}:void 0,filters:i.filters,onFilters:W=>Yt(Pn("history",l?.id,i.viewTarget||"",W))});else if(E)if(!v)oe=f.jsx("div",{className:"empty",children:"Loading…"});else if(z)oe=f.jsxs("div",{className:"notfound",children:[f.jsx("h1",{children:"Couldn't find that"}),f.jsxs("p",{children:[f.jsx("code",{children:E})," isn't in this project right now."]}),f.jsx("p",{className:"nf-sub",children:"If it was just created, it may still be uploading or syncing from a teammate's device — this page checks again automatically every few seconds, so refresh or come back in a moment."}),f.jsx("button",{className:"pbtn",onClick:()=>d.invalidateQueries({queryKey:["tree",r]}),children:"Check again"})]});else if(O)oe=f.jsx(tP,{node:y.get(E),heatMap:b,hub:o&&!!l,apiBase:r,onOpen:X,onFullHistory:te,onRendered:Z});else{F=AC.test(E)||MC.test(E)?"wide":"read",ue="markdown";const W=YC(E);oe=f.jsxs(f.Fragment,{children:[R&&f.jsx(cF,{apiBase:r,path:E,version:R,onViewCurrent:()=>X(E)}),W&&f.jsx(uF,{conflict:W,originalHref:p.some(le=>le.path===W.original)?()=>X(W.original):void 0}),f.jsx(aP,{apiBase:r,path:E,version:R,heatMap:b,flatFiles:p,projectId:l?.id,onOpenFile:X,onMeta:M,onRendered:Z})]})}else x?oe=f.jsxs(f.Fragment,{children:[f.jsx(BC,{project:l,existing:i.connect==="existing"}),f.jsx("div",{className:"home-insights",children:f.jsx(vw,{flatFiles:p,heatMap:b,devices:_,loading:!v,onOpenFile:X,onOpenFolder:X,onOpenHistory:te,isFolder:P})})]}):oe=f.jsx("div",{className:"empty",children:"Select a file to read it."});I&&I.to===E&&(oe=f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"vbanner",role:"status",children:[f.jsx("span",{className:"vb-icon",children:f.jsx(rt,{name:"link"})}),f.jsxs("div",{className:"vb-text",children:[f.jsxs("b",{children:["Moved from ",I.from]}),f.jsx("span",{children:"The URL has been updated."})]})]}),oe]}));const be=Me?Me.crumb:E?f.jsx(HI,{path:E,onOpenFolder:X}):i.view==="dashboard"?"Dashboard — "+(i.viewTarget||l?.name||""):i.view==="history"?"History — "+lF(i.viewTarget||"",P):x?l.name:null,Se=f.jsx(hl,{crumb:be,meta:D,actions:f.jsxs(f.Fragment,{children:[Fe&&f.jsx(xt,{id:"share-btn",variant:"toolbar",className:"icon-only",title:"Share","aria-label":"Share",onClick:At,children:f.jsx(rt,{name:"share"})}),hn&&!E&&!i.view&&f.jsxs(xt,{id:"history-btn",variant:"toolbar",onClick:Jt,children:[f.jsx(rt,{name:"hist"})," ",f.jsx("span",{className:"lbl",children:"History"})]}),mn&&f.jsx("a",{id:"download",hidden:!0,download:!0,href:yr,ref:we,children:"Download"}),Xt&&f.jsx(xt,{id:"more-btn",variant:"toolbar",className:"icon-only",title:"More actions","aria-label":"More actions",onClick:W=>{W.stopPropagation(),fe(!K)},children:f.jsx(rt,{name:"dots"})}),K&&f.jsxs("div",{id:"more-menu",role:"menu",children:[hn&&f.jsx("button",{className:"more-item",onClick:Jt,children:"History"}),mn&&f.jsx("button",{className:"more-item",onClick:()=>we.current?.click(),children:"Download"}),o&&!!l&&f.jsx("button",{className:"more-item",onClick:()=>{e.onClosePanel?.(),Yt(Pn("dashboard",l?.id,E))},children:"Dashboard"})]})]})});return f.jsxs(f.Fragment,{children:[f.jsx(fl,{vault:e.sidebar.vault,projectsNav:e.sidebar.projectsNav,orgBar:e.sidebar.orgBar,tree:f.jsx(VI,{root:m,expanded:ge,onToggle:de,currentPath:T,listingShowing:B,onOpen:X}),topbar:Se,contentRef:ee,onContentScroll:re,children:f.jsxs(_u,{width:F,className:ue,children:[!Me&&N&&f.jsx(mP,{shares:Je,canRevoke:!!l&&_i(l.perm,"write"),onChanged:ct}),oe]})}),U&&f.jsx(hP,{url:U.url,copied:U.copied,onClose:()=>{Q(null),ct()}}),f.jsx(qP,{open:ae,onClose:()=>xe(!1),candidates:A})]})}function hF({config:e}){const t=Xp(),r=A_(),[i,o]=S.useState(null),[l,u]=S.useState(null);S.useEffect(()=>u(null),[t]);const d=S.useMemo(()=>{const ye=t.split("?")[0].match(/^\/join\/([0-9a-f]+)\/?$/);return ye?ye[1]:null},[t]),{data:m}=M3(!d),{data:p}=N3(!d),y=!!e.auth.admin,{data:v}=O_(y),b=S.useMemo(()=>k_(t,"hub"),[t]),[x,w]=S.useState(!1),_=e.upload.enabled,E=async(ye,L)=>{const Z=L===qC;try{const re=await ea("/api/projects",{name:ye,template:Z?"":L});w(!1),await r(),Yt("/"+re.project.id+(Z?"?connect=existing":"")),qe(`Created “${re.project.name}”.`)}catch(re){qe("Could not create the project: "+re.message,!0)}},R=x?f.jsx(oI,{templates:e.templates??[],onCreate:E,onClose:()=>w(!1)}):null,T=S.useMemo(()=>m&&(m.find(ye=>ye.id===b.project)||i&&m.find(ye=>ye.org===i)||m.find(ye=>ye.id===A$())||m[0])||null,[m,b.project,i]);if(S.useEffect(()=>{document.title=T?T.name+" — BearDrive":e.brand||"BearDrive",T&&M$(T.id)},[T,e]),d)return f.jsx(mF,{token:d,onDone:async ye=>{o(ye),await r(),Yt("/",{replace:!0})}});const O=e.brand||"BearDrive",N=T&&p?.find(ye=>ye.id===T.org)||null,z=f.jsx(Ju,{name:O,onHome:()=>Yt("/"),search:!!T,beta:O==="BearDrive"}),B=e.me?f.jsx(J$,{me:e.me,org:N,orgActive:!!b.org,billing:e.billing,admin:y?{pending:v?.length||0,onClick:()=>{u({kind:"hub"}),hr()}}:void 0}):void 0;if(!m||!p)return f.jsx(fl,{vault:z,topbar:f.jsx(hl,{}),children:f.jsx(_u,{children:f.jsx("div",{className:"empty",children:"Loading…"})})});if(!T)return f.jsxs(fl,{vault:z,projectsNav:f.jsx(sw,{projects:m,onNew:()=>w(!0)}),orgBar:B,topbar:f.jsx(hl,{}),children:[f.jsx(_u,{children:f.jsx(sI,{onNew:()=>w(!0),canCreate:_})}),R]});const H=l?.kind==="hub"?{crumb:"Signup & access",body:f.jsx(U$,{})}:null,I=b.org?p.find(ye=>ye.id===b.org):null,ge=b.org&&!I?{crumb:"Organization",body:f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"Organization not found"}),f.jsx("p",{children:"This organization doesn't exist, or you're no longer a member."}),f.jsx("p",{children:f.jsxs("a",{...Zs("/"+T.id),children:["Back to ",T.name]})})]})}:I?{crumb:"Organization",body:f.jsx(P$,{org:I,projects:m,myEmail:e.me?.email||""})}:null,pe=!!b.project&&!m.some(ye=>ye.id===b.project),he=pe?{crumb:"Project",body:f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"Project not found"}),f.jsx("p",{children:"This project doesn't exist, or you're no longer a member."}),f.jsx("p",{children:f.jsxs("a",{...Zs("/"+T.id),children:["Back to ",T.name]})})]})}:null,de=b.billing?{crumb:"Billing",body:e.billing?f.jsx(W$,{url:e.billing.url}):f.jsxs("div",{className:"empty",children:[f.jsx("h3",{children:"No billing on this hub"}),f.jsx("p",{children:"This BearDrive hub doesn't have a billing surface."})]})}:null,ee=b.view==="settings"?{crumb:"Project settings",body:f.jsx(nI,{project:T,org:N,onDeleted:async()=>{await r(),Yt("/")}})}:b.view==="install"?{crumb:"Installation",body:f.jsx(BC,{project:T,existing:b.connect==="existing"})}:null;if(!pe){if(!b.org&&!b.billing&&b.project!==T.id)return f.jsx(Jo,{to:"/"+T.id});if(b.legacyView&&b.view)return f.jsx(Jo,{to:Pn(b.view,T.id,b.viewTarget,b.filters)});if(b.queryTarget&&b.view)return f.jsx(Jo,{to:Pn(b.view,T.id,b.viewTarget,b.filters)});if(b.trailingSlash&&b.path)return f.jsx(Jo,{to:Gs(b.path,T.id,b.version)})}return f.jsxs(f.Fragment,{children:[f.jsx(uE,{config:e,apiBase:"/api/p/"+T.id+"/",route:b,hub:!0,project:T,projects:m,sidebar:{vault:z,projectsNav:f.jsx(sw,{projects:m,currentId:T.id,onNew:()=>w(!0),menu:{active:l?null:b.view==="dashboard"&&!b.viewTarget?"dashboard":b.view==="install"?"install":b.view==="history"&&!b.viewTarget?"history":b.view==="settings"?"settings":null,onDashboard:()=>{u(null),Yt(Pn("dashboard",T.id)),hr()},onInstall:()=>{u(null),Yt(Pn("install",T.id)),hr()},onHistory:()=>{u(null),Yt(Pn("history",T.id)),hr()},onSettings:()=>{u(null),Yt(Pn("settings",T.id)),hr()}}}),orgBar:B},panel:H||ge||he||de||ee,onClosePanel:()=>u(null)},T.id),R]})}function mF({token:e,onDone:t}){return S.useEffect(()=>{let r=!1;return ea("/api/invites/"+e).then(i=>{r||(qe(`Welcome — you joined the “${i.org.name}” team. Opening its projects…`),t(i.org.id))}).catch(i=>{r||String(i.message).includes("signing in")||(qe("Could not accept the invite: "+i.message,!0),t(null))}),()=>{r=!0}},[e]),f.jsx(fl,{vault:f.jsx(Ju,{name:"BearDrive",beta:!0}),topbar:f.jsx(hl,{}),children:f.jsx(_u,{children:f.jsx("div",{className:"empty",children:"Joining…"})})})}function pF({config:e}){const t=Xp(),r=e.volume||"BearDrive";S.useEffect(()=>{document.title=e.brand||r},[e,r]);const i=S.useMemo(()=>k_(t,"volume"),[t]);return i.trailingSlash&&i.path?f.jsx(Jo,{to:Gs(i.path)}):f.jsx(uE,{config:e,apiBase:"/api/",route:i,hub:!1,sidebar:{vault:f.jsx(Ju,{name:r,showSignout:e.auth.enabled,search:!0})}})}function gF(){const{data:e}=_j();return f.jsxs(HD,{delayDuration:150,children:[e?e.mode==="hub"?f.jsx(hF,{config:e}):f.jsx(pF,{config:e}):f.jsx(fl,{vault:f.jsx(Ju,{name:"…",showSignout:!1}),topbar:f.jsx(hl,{}),children:f.jsx("div",{className:"empty",children:"Loading…"})}),f.jsx(_3,{}),f.jsx(T3,{})]})}class vF extends S.Component{state={error:null};static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,r){console.error("BearDrive: unhandled render error",t,r.componentStack)}render(){return this.state.error?f.jsxs("div",{className:"mx-auto max-w-lg p-8 text-sm",children:[f.jsx("h1",{className:"mb-2 text-lg font-semibold",children:"This page didn’t load"}),f.jsx("p",{className:"mb-4 opacity-80",children:"Something went wrong rendering this view. The rest of BearDrive is fine."}),f.jsx("p",{className:"mb-4",children:f.jsx("a",{className:"underline",href:"/",children:"Go to the project list"})}),f.jsx("pre",{className:"overflow-x-auto rounded bg-black/5 p-3 text-xs dark:bg-white/10",children:String(this.state.error)})]}):this.props.children}}const yF=new sj({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}});D2.createRoot(document.getElementById("root")).render(f.jsx(S.StrictMode,{children:f.jsx(vF,{children:f.jsx(oj,{client:yF,children:f.jsx(gF,{})})})})); diff --git a/internal/webapp/static/index.html b/internal/webapp/static/index.html index a7a39fa..474a426 100644 --- a/internal/webapp/static/index.html +++ b/internal/webapp/static/index.html @@ -5,7 +5,7 @@ BearDrive - +