import{r as p,R as Q,a as U0,b as q0,c as PR,d as kp,e as Ed,u as Pp,L as xm,N as Cu,O as F0,f as KR,g as IR,h as LR,i as Nn,B as UR}from"./react-B75e6Si-.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))i(s);new MutationObserver(s=>{for(const u of s)if(u.type==="childList")for(const d of u.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&i(d)}).observe(document,{childList:!0,subtree:!0});function r(s){const u={};return s.integrity&&(u.integrity=s.integrity),s.referrerPolicy&&(u.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?u.credentials="include":s.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function i(s){if(s.ep)return;s.ep=!0;const u=r(s);fetch(s.href,u)}})();var bm={exports:{}},bl={};var Db;function qR(){if(Db)return bl;Db=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(i,s,u){var d=null;if(u!==void 0&&(d=""+u),s.key!==void 0&&(d=""+s.key),"key"in s){u={};for(var h in s)h!=="key"&&(u[h]=s[h])}else u=s;return s=u.ref,{$$typeof:e,type:i,key:d,ref:s!==void 0?s:null,props:u}}return bl.Fragment=t,bl.jsx=r,bl.jsxs=r,bl}var Mb;function FR(){return Mb||(Mb=1,bm.exports=qR()),bm.exports}var l=FR(),$R=(e,t,r,i,s,u,d,h)=>{let g=document.documentElement,y=["light","dark"];function x(E){(Array.isArray(e)?e:[e]).forEach(j=>{let S=j==="class",N=S&&u?s.map(D=>u[D]||D):s;S?(g.classList.remove(...N),g.classList.add(u&&u[E]?u[E]:E)):g.setAttribute(j,E)}),v(E)}function v(E){h&&y.includes(E)&&(g.style.colorScheme=E)}function w(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(i)x(i);else try{let E=localStorage.getItem(t)||r,j=d&&E==="system"?w():E;x(j)}catch{}},zb=["light","dark"],$0="(prefers-color-scheme: dark)",VR=typeof window>"u",Kp=p.createContext(void 0),HR={setTheme:e=>{},themes:[]},BR=()=>{var e;return(e=p.useContext(Kp))!=null?e:HR},GR=e=>p.useContext(Kp)?p.createElement(p.Fragment,null,e.children):p.createElement(ZR,{...e}),XR=["light","dark"],ZR=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:i=!0,storageKey:s="theme",themes:u=XR,defaultTheme:d=r?"system":"light",attribute:h="data-theme",value:g,children:y,nonce:x,scriptProps:v})=>{let[w,E]=p.useState(()=>QR(s,d)),[j,S]=p.useState(()=>w==="system"?wm():w),N=g?Object.values(g):u,D=p.useCallback(T=>{let U=T;if(!U)return;T==="system"&&r&&(U=wm());let L=g?g[U]:U,V=t?JR(x):null,fe=document.documentElement,ge=pe=>{pe==="class"?(fe.classList.remove(...N),L&&fe.classList.add(L)):pe.startsWith("data-")&&(L?fe.setAttribute(pe,L):fe.removeAttribute(pe))};if(Array.isArray(h)?h.forEach(ge):ge(h),i){let pe=zb.includes(d)?d:null,ae=zb.includes(U)?U:pe;fe.style.colorScheme=ae}V?.()},[x]),A=p.useCallback(T=>{let U=typeof T=="function"?T(w):T;E(U);try{localStorage.setItem(s,U)}catch{}},[w]),O=p.useCallback(T=>{let U=wm(T);S(U),w==="system"&&r&&!e&&D("system")},[w,e]);p.useEffect(()=>{let T=window.matchMedia($0);return T.addListener(O),O(T),()=>T.removeListener(O)},[O]),p.useEffect(()=>{let T=U=>{U.key===s&&(U.newValue?E(U.newValue):A(d))};return window.addEventListener("storage",T),()=>window.removeEventListener("storage",T)},[A]),p.useEffect(()=>{D(e??w)},[e,w]);let C=p.useMemo(()=>({theme:w,setTheme:A,forcedTheme:e,resolvedTheme:w==="system"?j:w,themes:r?[...u,"system"]:u,systemTheme:r?j:void 0}),[w,A,e,j,r,u]);return p.createElement(Kp.Provider,{value:C},p.createElement(YR,{forcedTheme:e,storageKey:s,attribute:h,enableSystem:r,enableColorScheme:i,defaultTheme:d,value:g,themes:u,nonce:x,scriptProps:v}),y)},YR=p.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:i,enableColorScheme:s,defaultTheme:u,value:d,themes:h,nonce:g,scriptProps:y})=>{let x=JSON.stringify([r,t,u,e,h,d,i,s]).slice(1,-1);return p.createElement("script",{...y,suppressHydrationWarning:!0,nonce:typeof window>"u"?g:"",dangerouslySetInnerHTML:{__html:`(${$R.toString()})(${x})`}})}),QR=(e,t)=>{if(VR)return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||t},JR=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},wm=e=>(e||(e=window.matchMedia($0)),e.matches?"dark":"light");function WR({children:e,defaultTheme:t="system",storageKey:r="vite-ui-theme"}){return l.jsx(GR,{attribute:"class",defaultTheme:t,enableSystem:!0,storageKey:r,disableTransitionOnChange:!0,children:e})}var bs=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(){}},eO={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},tO=class{#e=eO;#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)}},Hi=new tO;function nO(e){setTimeout(e,0)}var Xi=typeof window>"u"||"Deno"in globalThis;function Dn(){}function aO(e,t){return typeof e=="function"?e(t):e}function Qm(e){return typeof e=="number"&&e>=0&&e!==1/0}function V0(e,t){return Math.max(e+(t||0)-Date.now(),0)}function fi(e,t){return typeof e=="function"?e(t):e}function Ea(e,t){return typeof e=="function"?e(t):e}function kb(e,t){const{type:r="all",exact:i,fetchStatus:s,predicate:u,queryKey:d,stale:h}=e;if(d){if(i){if(t.queryHash!==Ip(d,t.options))return!1}else if(!Hl(t.queryKey,d))return!1}if(r!=="all"){const g=t.isActive();if(r==="active"&&!g||r==="inactive"&&g)return!1}return!(typeof h=="boolean"&&t.isStale()!==h||s&&s!==t.state.fetchStatus||u&&!u(t))}function Pb(e,t){const{exact:r,status:i,predicate:s,mutationKey:u}=e;if(u){if(!t.options.mutationKey)return!1;if(r){if(Zi(t.options.mutationKey)!==Zi(u))return!1}else if(!Hl(t.options.mutationKey,u))return!1}return!(i&&t.state.status!==i||s&&!s(t))}function Ip(e,t){return(t?.queryKeyHashFn||Zi)(e)}function Zi(e){return JSON.stringify(e,(t,r)=>Jm(r)?Object.keys(r).sort().reduce((i,s)=>(i[s]=r[s],i),{}):r)}function Hl(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>Hl(e[r],t[r])):!1}var rO=Object.prototype.hasOwnProperty;function H0(e,t){if(e===t)return e;const r=Kb(e)&&Kb(t);if(!r&&!(Jm(e)&&Jm(t)))return t;const s=(r?e:Object.keys(e)).length,u=r?t:Object.keys(t),d=u.length,h=r?new Array(d):{};let g=0;for(let y=0;y{Hi.setTimeout(t,e)})}function Wm(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?H0(e,t):t}function oO(e,t,r=0){const i=[...e,t];return r&&i.length>r?i.slice(1):i}function sO(e,t,r=0){const i=[t,...e];return r&&i.length>r?i.slice(0,-1):i}var Lp=Symbol();function B0(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Lp?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function G0(e,t){return typeof e=="function"?e(...t):!!e}var lO=class extends bs{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!Xi&&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"}},Up=new lO;function ep(){let e,t;const r=new Promise((s,u)=>{e=s,t=u});r.status="pending",r.catch(()=>{});function i(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{i({status:"fulfilled",value:s}),e(s)},r.reject=s=>{i({status:"rejected",reason:s}),t(s)},r}var cO=nO;function uO(){let e=[],t=0,r=h=>{h()},i=h=>{h()},s=cO;const u=h=>{t?e.push(h):s(()=>{r(h)})},d=()=>{const h=e;e=[],h.length&&s(()=>{i(()=>{h.forEach(g=>{r(g)})})})};return{batch:h=>{let g;t++;try{g=h()}finally{t--,t||d()}return g},batchCalls:h=>(...g)=>{u(()=>{h(...g)})},schedule:u,setNotifyFunction:h=>{r=h},setBatchNotifyFunction:h=>{i=h},setScheduler:h=>{s=h}}}var an=uO(),dO=class extends bs{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!Xi&&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}},rd=new dO;function fO(e){return Math.min(1e3*2**e,3e4)}function X0(e){return(e??"online")==="online"?rd.isOnline():!0}var tp=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Z0(e){let t=!1,r=0,i;const s=ep(),u=()=>s.status!=="pending",d=S=>{if(!u()){const N=new tp(S);w(N),e.onCancel?.(N)}},h=()=>{t=!0},g=()=>{t=!1},y=()=>Up.isFocused()&&(e.networkMode==="always"||rd.isOnline())&&e.canRun(),x=()=>X0(e.networkMode)&&e.canRun(),v=S=>{u()||(i?.(),s.resolve(S))},w=S=>{u()||(i?.(),s.reject(S))},E=()=>new Promise(S=>{i=N=>{(u()||y())&&S(N)},e.onPause?.()}).then(()=>{i=void 0,u()||e.onContinue?.()}),j=()=>{if(u())return;let S;const N=r===0?e.initialPromise:void 0;try{S=N??e.fn()}catch(D){S=Promise.reject(D)}Promise.resolve(S).then(v).catch(D=>{if(u())return;const A=e.retry??(Xi?0:3),O=e.retryDelay??fO,C=typeof O=="function"?O(r,D):O,T=A===!0||typeof A=="number"&&ry()?void 0:E()).then(()=>{t?w(D):j()})})};return{promise:s,status:()=>s.status,cancel:d,continue:()=>(i?.(),s),cancelRetry:h,continueRetry:g,canStart:x,start:()=>(x()?j():E().then(j),s)}}var Y0=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Qm(this.gcTime)&&(this.#e=Hi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Xi?1/0:300*1e3))}clearGcTimeout(){this.#e&&(Hi.clearTimeout(this.#e),this.#e=void 0)}},hO=class extends Y0{#e;#t;#n;#r;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=Ub(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Ub(this.options);t.data!==void 0&&(this.setState(Lb(t.data,t.dataUpdatedAt)),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const r=Wm(this.state.data,e,this.options);return this.#i({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#i({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(Dn).catch(Dn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Ea(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Lp||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>fi(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:!V0(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.#n.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.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({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 h=this.observers.find(g=>g.options.queryFn);h&&this.setOptions(h.options)}const r=new AbortController,i=h=>{Object.defineProperty(h,"signal",{enumerable:!0,get:()=>(this.#s=!0,r.signal)})},s=()=>{const h=B0(this.options,t),y=(()=>{const x={client:this.#r,queryKey:this.queryKey,meta:this.meta};return i(x),x})();return this.#s=!1,this.options.persister?this.options.persister(h,y,this):h(y)},d=(()=>{const h={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:s};return i(h),h})();this.options.behavior?.onFetch(d,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==d.fetchOptions?.meta)&&this.#i({type:"fetch",meta:d.fetchOptions?.meta}),this.#a=Z0({initialPromise:t?.initialPromise,fn:d.fetchFn,onCancel:h=>{h instanceof tp&&h.revert&&this.setState({...this.#t,fetchStatus:"idle"}),r.abort()},onFail:(h,g)=>{this.#i({type:"failed",failureCount:h,error:g})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:d.options.retry,retryDelay:d.options.retryDelay,networkMode:d.options.networkMode,canRun:()=>!0});try{const h=await this.#a.start();if(h===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(h),this.#n.config.onSuccess?.(h,this),this.#n.config.onSettled?.(h,this.state.error,this),h}catch(h){if(h instanceof tp){if(h.silent)return this.#a.promise;if(h.revert){if(this.state.data===void 0)throw h;return this.state.data}}throw this.#i({type:"error",error:h}),this.#n.config.onError?.(h,this),this.#n.config.onSettled?.(this.state.data,h,this),h}finally{this.scheduleGc()}}#i(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,...Q0(r.data,this.options),fetchMeta:e.meta??null};case"success":const i={...r,...Lb(e.data,e.dataUpdatedAt),dataUpdateCount:r.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#t=e.manual?i:void 0,i;case"error":const s=e.error;return{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=t(this.state),an.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Q0(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:X0(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Lb(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ub(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 mO=class extends bs{constructor(e,t){super(),this.options=t,this.#e=e,this.#i=null,this.#s=ep(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#r=void 0;#a;#o;#s;#i;#p;#f;#h;#c;#u;#l;#m=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),qb(this.#t,this.options)?this.#d():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return np(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return np(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),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 Ea(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&&!ad(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const i=this.hasListeners();i&&Fb(this.#t,r,this.options,t)&&this.#d(),this.updateResult(),i&&(this.#t!==r||Ea(this.options.enabled,this.#t)!==Ea(t.enabled,this.#t)||fi(this.options.staleTime,this.#t)!==fi(t.staleTime,this.#t))&&this.#g();const s=this.#y();i&&(this.#t!==r||Ea(this.options.enabled,this.#t)!==Ea(t.enabled,this.#t)||s!==this.#l)&&this.#v(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),r=this.createResult(t,e);return gO(this,r)&&(this.#r=r,this.#o=this.options,this.#a=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.#s.status==="pending"&&this.#s.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(r,i))})}trackProp(e){this.#m.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.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#d(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Dn)),t}#g(){this.#b();const e=fi(this.options.staleTime,this.#t);if(Xi||this.#r.isStale||!Qm(e))return;const r=V0(this.#r.dataUpdatedAt,e)+1;this.#c=Hi.setTimeout(()=>{this.#r.isStale||this.updateResult()},r)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#v(e){this.#w(),this.#l=e,!(Xi||Ea(this.options.enabled,this.#t)===!1||!Qm(this.#l)||this.#l===0)&&(this.#u=Hi.setInterval(()=>{(this.options.refetchIntervalInBackground||Up.isFocused())&&this.#d()},this.#l))}#x(){this.#g(),this.#v(this.#y())}#b(){this.#c&&(Hi.clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(Hi.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#t,i=this.options,s=this.#r,u=this.#a,d=this.#o,g=e!==r?e.state:this.#n,{state:y}=e;let x={...y},v=!1,w;if(t._optimisticResults){const V=this.hasListeners(),fe=!V&&qb(e,t),ge=V&&Fb(e,r,t,i);(fe||ge)&&(x={...x,...Q0(y.data,e.options)}),t._optimisticResults==="isRestoring"&&(x.fetchStatus="idle")}let{error:E,errorUpdatedAt:j,status:S}=x;w=x.data;let N=!1;if(t.placeholderData!==void 0&&w===void 0&&S==="pending"){let V;s?.isPlaceholderData&&t.placeholderData===d?.placeholderData?(V=s.data,N=!0):V=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,V!==void 0&&(S="success",w=Wm(s?.data,V,t),v=!0)}if(t.select&&w!==void 0&&!N)if(s&&w===u?.data&&t.select===this.#p)w=this.#f;else try{this.#p=t.select,w=t.select(w),w=Wm(s?.data,w,t),this.#f=w,this.#i=null}catch(V){this.#i=V}this.#i&&(E=this.#i,w=this.#f,j=Date.now(),S="error");const D=x.fetchStatus==="fetching",A=S==="pending",O=S==="error",C=A&&D,T=w!==void 0,L={status:S,fetchStatus:x.fetchStatus,isPending:A,isSuccess:S==="success",isError:O,isInitialLoading:C,isLoading:C,data:w,dataUpdatedAt:x.dataUpdatedAt,error:E,errorUpdatedAt:j,failureCount:x.fetchFailureCount,failureReason:x.fetchFailureReason,errorUpdateCount:x.errorUpdateCount,isFetched:x.dataUpdateCount>0||x.errorUpdateCount>0,isFetchedAfterMount:x.dataUpdateCount>g.dataUpdateCount||x.errorUpdateCount>g.errorUpdateCount,isFetching:D,isRefetching:D&&!A,isLoadingError:O&&!T,isPaused:x.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:O&&T,isStale:qp(e,t),refetch:this.refetch,promise:this.#s,isEnabled:Ea(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const V=pe=>{L.status==="error"?pe.reject(L.error):L.data!==void 0&&pe.resolve(L.data)},fe=()=>{const pe=this.#s=L.promise=ep();V(pe)},ge=this.#s;switch(ge.status){case"pending":e.queryHash===r.queryHash&&V(ge);break;case"fulfilled":(L.status==="error"||L.data!==ge.value)&&fe();break;case"rejected":(L.status!=="error"||L.error!==ge.reason)&&fe();break}}return L}updateResult(){const e=this.#r,t=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#o=this.options,this.#a.data!==void 0&&(this.#h=this.#t),ad(t,e))return;this.#r=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:i}=this.options,s=typeof i=="function"?i():i;if(s==="all"||!s&&!this.#m.size)return!0;const u=new Set(s??this.#m);return this.options.throwOnError&&u.add("error"),Object.keys(this.#r).some(d=>{const h=d;return this.#r[h]!==e[h]&&u.has(h)})};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.#x()}#_(e){an.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function pO(e,t){return Ea(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function qb(e,t){return pO(e,t)||e.state.data!==void 0&&np(e,t,t.refetchOnMount)}function np(e,t,r){if(Ea(t.enabled,e)!==!1&&fi(t.staleTime,e)!=="static"){const i=typeof r=="function"?r(e):r;return i==="always"||i!==!1&&qp(e,t)}return!1}function Fb(e,t,r,i){return(e!==t||Ea(i.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&qp(e,r)}function qp(e,t){return Ea(t.enabled,e)!==!1&&e.isStaleByTime(fi(t.staleTime,e))}function gO(e,t){return!ad(e.getCurrentResult(),t)}function $b(e){return{onFetch:(t,r)=>{const i=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,u=t.state.data?.pages||[],d=t.state.data?.pageParams||[];let h={pages:[],pageParams:[]},g=0;const y=async()=>{let x=!1;const v=j=>{Object.defineProperty(j,"signal",{enumerable:!0,get:()=>(t.signal.aborted?x=!0:t.signal.addEventListener("abort",()=>{x=!0}),t.signal)})},w=B0(t.options,t.fetchOptions),E=async(j,S,N)=>{if(x)return Promise.reject();if(S==null&&j.pages.length)return Promise.resolve(j);const A=(()=>{const U={client:t.client,queryKey:t.queryKey,pageParam:S,direction:N?"backward":"forward",meta:t.options.meta};return v(U),U})(),O=await w(A),{maxPages:C}=t.options,T=N?sO:oO;return{pages:T(j.pages,O,C),pageParams:T(j.pageParams,S,C)}};if(s&&u.length){const j=s==="backward",S=j?yO:Vb,N={pages:u,pageParams:d},D=S(i,N);h=await E(N,D,j)}else{const j=e??u.length;do{const S=g===0?d[0]??i.initialPageParam:Vb(i,h);if(g>0&&S==null)break;h=await E(h,S),g++}while(gt.options.persister?.(y,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=y}}}function Vb(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 yO(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var vO=class extends Y0{#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||J0(),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.#a({type:"continue"})},r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=Z0({fn:()=>this.options.mutationFn?this.options.mutationFn(e,r):Promise.reject(new Error("No mutationFn found")),onFail:(u,d)=>{this.#a({type:"failed",failureCount:u,error:d})},onPause:()=>{this.#a({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",s=!this.#r.canStart();try{if(i)t();else{this.#a({type:"pending",variables:e,isPaused:s}),await this.#n.config.onMutate?.(e,this,r);const d=await this.options.onMutate?.(e,r);d!==this.state.context&&this.#a({type:"pending",context:d,variables:e,isPaused:s})}const u=await this.#r.start();return await this.#n.config.onSuccess?.(u,e,this.state.context,this,r),await this.options.onSuccess?.(u,e,this.state.context,r),await this.#n.config.onSettled?.(u,null,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(u,null,e,this.state.context,r),this.#a({type:"success",data:u}),u}catch(u){try{throw await this.#n.config.onError?.(u,e,this.state.context,this,r),await this.options.onError?.(u,e,this.state.context,r),await this.#n.config.onSettled?.(void 0,u,this.state.variables,this.state.context,this,r),await this.options.onSettled?.(void 0,u,e,this.state.context,r),u}finally{this.#a({type:"error",error:u})}}finally{this.#n.runNext(this)}}#a(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),an.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function J0(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var xO=class extends bs{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 vO({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=ju(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=ju(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=ju(e);if(typeof t=="string"){const i=this.#t.get(t)?.find(s=>s.state.status==="pending");return!i||i===e}else return!0}runNext(e){const t=ju(e);return typeof t=="string"?this.#t.get(t)?.find(i=>i!==e&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){an.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=>Pb(t,r))}findAll(e={}){return this.getAll().filter(t=>Pb(e,t))}notify(e){an.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return an.batch(()=>Promise.all(e.map(t=>t.continue().catch(Dn))))}};function ju(e){return e.options.scope?.id}var bO=class extends bs{#e;#t=void 0;#n;#r;constructor(t,r){super(),this.#e=t,this.setOptions(r),this.bindMethods(),this.#a()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const r=this.options;this.options=this.#e.defaultMutationOptions(t),ad(this.options,r)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),r?.mutationKey&&this.options.mutationKey&&Zi(r.mutationKey)!==Zi(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#a(),this.#o(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#a(),this.#o()}mutate(t,r){return this.#r=r,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#a(){const t=this.#n?.state??J0();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){an.batch(()=>{if(this.#r&&this.hasListeners()){const r=this.#t.variables,i=this.#t.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};t?.type==="success"?(this.#r.onSuccess?.(t.data,r,i,s),this.#r.onSettled?.(t.data,null,r,i,s)):t?.type==="error"&&(this.#r.onError?.(t.error,r,i,s),this.#r.onSettled?.(void 0,t.error,r,i,s))}this.listeners.forEach(r=>{r(this.#t)})})}},wO=class extends bs{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,r){const i=t.queryKey,s=t.queryHash??Ip(i,t);let u=this.get(s);return u||(u=new hO({client:e,queryKey:i,queryHash:s,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(i)}),this.add(u)),u}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(){an.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=>kb(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>kb(e,r)):t}notify(e){an.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){an.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){an.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},SO=class{#e;#t;#n;#r;#a;#o;#s;#i;constructor(e={}){this.#e=e.queryCache||new wO,this.#t=e.mutationCache||new xO,this.#n=e.defaultOptions||{},this.#r=new Map,this.#a=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#s=Up.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=rd.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#s?.(),this.#s=void 0,this.#i?.(),this.#i=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(fi(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}),u=this.#e.get(i.queryHash)?.state.data,d=aO(t,u);if(d!==void 0)return this.#e.build(this,i).setData(d,{...r,manual:!0})}setQueriesData(e,t,r){return an.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;an.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#e;return an.batch(()=>(r.findAll(e).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},i=an.batch(()=>this.#e.findAll(e).map(s=>s.cancel(r)));return Promise.all(i).then(Dn).catch(Dn)}invalidateQueries(e,t={}){return an.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=an.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let u=s.fetch(void 0,r);return r.throwOnError||(u=u.catch(Dn)),s.state.fetchStatus==="paused"?Promise.resolve():u}));return Promise.all(i).then(Dn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#e.build(this,t);return r.isStaleByTime(fi(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Dn).catch(Dn)}fetchInfiniteQuery(e){return e.behavior=$b(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Dn).catch(Dn)}ensureInfiniteQueryData(e){return e.behavior=$b(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return rd.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(Zi(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],r={};return t.forEach(i=>{Hl(e,i.queryKey)&&Object.assign(r,i.defaultOptions)}),r}setMutationDefaults(e,t){this.#a.set(Zi(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#a.values()],r={};return t.forEach(i=>{Hl(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=Ip(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===Lp&&(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()}},W0=p.createContext(void 0),da=e=>{const t=p.useContext(W0);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},_O=({client:e,children:t})=>(p.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),l.jsx(W0.Provider,{value:e,children:t})),eS=p.createContext(!1),EO=()=>p.useContext(eS);eS.Provider;function CO(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var jO=p.createContext(CO()),RO=()=>p.useContext(jO),OO=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},NO=e=>{p.useEffect(()=>{e.clearReset()},[e])},AO=({result:e,errorResetBoundary:t,throwOnError:r,query:i,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&i&&(s&&e.data===void 0||G0(r,[e.error,i])),TO=e=>{if(e.suspense){const r=s=>s==="static"?s:Math.max(s??1e3,1e3),i=e.staleTime;e.staleTime=typeof i=="function"?(...s)=>r(i(...s)):r(i),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},DO=(e,t)=>e.isLoading&&e.isFetching&&!t,MO=(e,t)=>e?.suspense&&t.isPending,Hb=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function zO(e,t,r){const i=EO(),s=RO(),u=da(),d=u.defaultQueryOptions(e);u.getDefaultOptions().queries?._experimental_beforeQuery?.(d),d._optimisticResults=i?"isRestoring":"optimistic",TO(d),OO(d,s),NO(s);const h=!u.getQueryCache().get(d.queryHash),[g]=p.useState(()=>new t(u,d)),y=g.getOptimisticResult(d),x=!i&&e.subscribed!==!1;if(p.useSyncExternalStore(p.useCallback(v=>{const w=x?g.subscribe(an.batchCalls(v)):Dn;return g.updateResult(),w},[g,x]),()=>g.getCurrentResult(),()=>g.getCurrentResult()),p.useEffect(()=>{g.setOptions(d)},[d,g]),MO(d,y))throw Hb(d,g,s);if(AO({result:y,errorResetBoundary:s,throwOnError:d.throwOnError,query:u.getQueryCache().get(d.queryHash),suspense:d.suspense}))throw y.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(d,y),d.experimental_prefetchInRender&&!Xi&&DO(y,i)&&(h?Hb(d,g,s):u.getQueryCache().get(d.queryHash)?.promise)?.catch(Dn).finally(()=>{g.updateResult()}),d.notifyOnChangeProps?y:g.trackResult(y)}function rn(e,t){return zO(e,mO)}function mt(e,t){const r=da(),[i]=p.useState(()=>new bO(r,e));p.useEffect(()=>{i.setOptions(e)},[i,e]);const s=p.useSyncExternalStore(p.useCallback(d=>i.subscribe(an.batchCalls(d)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),u=p.useCallback((d,h)=>{i.mutate(d,h).catch(Dn)},[i]);if(s.error&&G0(i.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:u,mutateAsync:s.mutate}}const kO=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),PO=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,i)=>i?i.toUpperCase():r.toLowerCase()),Bb=e=>{const t=PO(e);return t.charAt(0).toUpperCase()+t.slice(1)},tS=(...e)=>e.filter((t,r,i)=>!!t&&t.trim()!==""&&i.indexOf(t)===r).join(" ").trim(),KO=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};var IO={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 LO=p.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:i,className:s="",children:u,iconNode:d,...h},g)=>p.createElement("svg",{ref:g,...IO,width:t,height:t,stroke:e,strokeWidth:i?Number(r)*24/Number(t):r,className:tS("lucide",s),...!u&&!KO(h)&&{"aria-hidden":"true"},...h},[...d.map(([y,x])=>p.createElement(y,x)),...Array.isArray(u)?u:[u]]));const pt=(e,t)=>{const r=p.forwardRef(({className:i,...s},u)=>p.createElement(LO,{ref:u,iconNode:t,className:tS(`lucide-${kO(Bb(e))}`,`lucide-${e}`,i),...s}));return r.displayName=Bb(e),r};const UO=[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]],qO=pt("boxes",UO);const FO=[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]],nS=pt("building-2",FO);const $O=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],aS=pt("check",$O);const VO=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],rS=pt("chevron-down",VO);const HO=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],BO=pt("chevron-right",HO);const GO=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],XO=pt("chevron-up",GO);const ZO=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],YO=pt("chevrons-up-down",ZO);const QO=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],JO=pt("circle-check",QO);const WO=[["path",{d:"M22 2 2 22",key:"y4kqgn"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],Fp=pt("circle-slash-2",WO);const e2=[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]],t2=pt("component",e2);const n2=[["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"}]],a2=pt("download",n2);const r2=[["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"}]],i2=pt("ellipsis",r2);const o2=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],s2=pt("eye",o2);const l2=[["path",{d:"M10.65 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v10.1",key:"1a2hbp"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m10 15 1 1",key:"1h4vmv"}],["path",{d:"m11 14-4.586 4.586",key:"maylof"}],["circle",{cx:"5",cy:"20",r:"2",key:"860zyv"}]],c2=pt("file-key",l2);const u2=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],d2=pt("info",u2);const f2=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],h2=pt("key-round",f2);const m2=[["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"}]],Ru=pt("link",m2);const p2=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ps=pt("loader-circle",p2);const g2=[["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"}]],y2=pt("octagon-x",g2);const v2=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]],x2=pt("panel-left",v2);const b2=[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],Cd=pt("pencil",b2);const w2=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],ro=pt("plus",w2);const S2=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],_2=pt("refresh-cw",S2);const E2=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],zr=pt("search",E2);const C2=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],iS=pt("server",C2);const j2=[["path",{d:"M3 3h.01",key:"159qn6"}],["path",{d:"M7 5h.01",key:"1hq22a"}],["path",{d:"M11 7h.01",key:"1osv80"}],["path",{d:"M3 7h.01",key:"1xzrh3"}],["path",{d:"M7 9h.01",key:"19b3jx"}],["path",{d:"M3 11h.01",key:"1eifu7"}],["rect",{width:"4",height:"4",x:"15",y:"5",key:"mri9e4"}],["path",{d:"m19 9 2 2v10c0 .6-.4 1-1 1h-6c-.6 0-1-.4-1-1V11l2-2",key:"aib6hk"}],["path",{d:"m13 14 8-2",key:"1d7bmk"}],["path",{d:"m13 19 8-2",key:"1y2vml"}]],R2=pt("spray-can",j2);const O2=[["path",{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z",key:"16rjxf"}],["path",{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193",key:"178nd4"}],["circle",{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor",key:"12ikhr"}]],jd=pt("tags",O2);const N2=[["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"}]],oS=pt("trash-2",N2);const A2=[["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"}]],T2=pt("triangle-alert",A2);const D2=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],M2=pt("user-round",D2);const z2=[["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"}]],sS=pt("users",z2);const k2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],$p=pt("x",k2);function P2(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 K2=e=>{switch(e){case"success":return U2;case"info":return F2;case"warning":return q2;case"error":return $2;default:return null}},I2=Array(12).fill(0),L2=({visible:e,className:t})=>Q.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},Q.createElement("div",{className:"sonner-spinner"},I2.map((r,i)=>Q.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${i}`})))),U2=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Q.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"})),q2=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},Q.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"})),F2=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Q.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"})),$2=Q.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},Q.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"})),V2=Q.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"},Q.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),Q.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),H2=()=>{const[e,t]=Q.useState(document.hidden);return Q.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let ap=1;class B2{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,...s}=t,u=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:ap++,d=this.toasts.find(g=>g.id===u),h=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(u)&&this.dismissedToasts.delete(u),d?this.toasts=this.toasts.map(g=>g.id===u?(this.publish({...g,...t,id:u,title:i}),{...g,...t,id:u,dismissible:h,title:i}):g):this.addToast({title:i,...s,dismissible:h,id:u}),u},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 s=Promise.resolve(t instanceof Function?t():t);let u=i!==void 0,d;const h=s.then(async y=>{if(d=["resolve",y],Q.isValidElement(y))u=!1,this.create({id:i,type:"default",message:y});else if(X2(y)&&!y.ok){u=!1;const v=typeof r.error=="function"?await r.error(`HTTP error! status: ${y.status}`):r.error,w=typeof r.description=="function"?await r.description(`HTTP error! status: ${y.status}`):r.description,j=typeof v=="object"&&!Q.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:w,...j})}else if(y instanceof Error){u=!1;const v=typeof r.error=="function"?await r.error(y):r.error,w=typeof r.description=="function"?await r.description(y):r.description,j=typeof v=="object"&&!Q.isValidElement(v)?v:{message:v};this.create({id:i,type:"error",description:w,...j})}else if(r.success!==void 0){u=!1;const v=typeof r.success=="function"?await r.success(y):r.success,w=typeof r.description=="function"?await r.description(y):r.description,j=typeof v=="object"&&!Q.isValidElement(v)?v:{message:v};this.create({id:i,type:"success",description:w,...j})}}).catch(async y=>{if(d=["reject",y],r.error!==void 0){u=!1;const x=typeof r.error=="function"?await r.error(y):r.error,v=typeof r.description=="function"?await r.description(y):r.description,E=typeof x=="object"&&!Q.isValidElement(x)?x:{message:x};this.create({id:i,type:"error",description:v,...E})}}).finally(()=>{u&&(this.dismiss(i),i=void 0),r.finally==null||r.finally.call(r)}),g=()=>new Promise((y,x)=>h.then(()=>d[0]==="reject"?x(d[1]):y(d[1])).catch(x));return typeof i!="string"&&typeof i!="number"?{unwrap:g}:Object.assign(i,{unwrap:g})},this.custom=(t,r)=>{const i=r?.id||ap++;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 Bn=new B2,G2=(e,t)=>{const r=t?.id||ap++;return Bn.addToast({title:e,...t,id:r}),r},X2=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Z2=G2,Y2=()=>Bn.toasts,Q2=()=>Bn.getActiveToasts(),Ee=Object.assign(Z2,{success:Bn.success,info:Bn.info,warning:Bn.warning,error:Bn.error,custom:Bn.custom,message:Bn.message,promise:Bn.promise,dismiss:Bn.dismiss,loading:Bn.loading},{getHistory:Y2,getToasts:Q2});P2("[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 Ou(e){return e.label!==void 0}const J2=3,W2="24px",eN="16px",Gb=4e3,tN=356,nN=14,aN=45,rN=200;function tr(...e){return e.filter(Boolean).join(" ")}function iN(e){const[t,r]=e.split("-"),i=[];return t&&i.push(t),r&&i.push(r),i}const oN=e=>{var t,r,i,s,u,d,h,g,y;const{invert:x,toast:v,unstyled:w,interacting:E,setHeights:j,visibleToasts:S,heights:N,index:D,toasts:A,expanded:O,removeToast:C,defaultRichColors:T,closeButton:U,style:L,cancelButtonStyle:V,actionButtonStyle:fe,className:ge="",descriptionClassName:pe="",duration:ae,position:le,gap:he,expandByDefault:be,classNames:R,icons:P,closeButtonAriaLabel:I="Close toast"}=e,[ee,me]=Q.useState(null),[Re,G]=Q.useState(null),[Y,ie]=Q.useState(!1),[oe,ve]=Q.useState(!1),[W,xe]=Q.useState(!1),[Oe,Ue]=Q.useState(!1),[Ye,Ze]=Q.useState(!1),[Kt,B]=Q.useState(0),[qe,ke]=Q.useState(0),Qe=Q.useRef(v.duration||ae||Gb),Ga=Q.useRef(null),jn=Q.useRef(null),z=D===0,$=D+1<=S,Z=v.type,ye=v.dismissible!==!1,ce=v.className||"",ue=v.descriptionClassName||"",De=Q.useMemo(()=>N.findIndex(Ge=>Ge.toastId===v.id)||0,[N,v.id]),lt=Q.useMemo(()=>{var Ge;return(Ge=v.closeButton)!=null?Ge:U},[v.closeButton,U]),ct=Q.useMemo(()=>v.duration||ae||Gb,[v.duration,ae]),sn=Q.useRef(0),kn=Q.useRef(0),Zn=Q.useRef(0),Xa=Q.useRef(null),[Na,Jt]=le.split("-"),Yn=Q.useMemo(()=>N.reduce((Ge,Tt,ln)=>ln>=De?Ge:Ge+Tt.height,0),[N,De]),Wt=H2(),As=v.invert||x,Ir=Z==="loading";kn.current=Q.useMemo(()=>De*he+Yn,[De,Yn]),Q.useEffect(()=>{Qe.current=ct},[ct]),Q.useEffect(()=>{ie(!0)},[]),Q.useEffect(()=>{const Ge=jn.current;if(Ge){const Tt=Ge.getBoundingClientRect().height;return ke(Tt),j(ln=>[{toastId:v.id,height:Tt,position:v.position},...ln]),()=>j(ln=>ln.filter(Rn=>Rn.toastId!==v.id))}},[j,v.id]),Q.useLayoutEffect(()=>{if(!Y)return;const Ge=jn.current,Tt=Ge.style.height;Ge.style.height="auto";const ln=Ge.getBoundingClientRect().height;Ge.style.height=Tt,ke(ln),j(Rn=>Rn.find(kt=>kt.toastId===v.id)?Rn.map(kt=>kt.toastId===v.id?{...kt,height:ln}:kt):[{toastId:v.id,height:ln,position:v.position},...Rn])},[Y,v.title,v.description,j,v.id,v.jsx,v.action,v.cancel]);const Za=Q.useCallback(()=>{ve(!0),B(kn.current),j(Ge=>Ge.filter(Tt=>Tt.toastId!==v.id)),setTimeout(()=>{C(v)},rN)},[v,C,j,kn]);Q.useEffect(()=>{if(v.promise&&Z==="loading"||v.duration===1/0||v.type==="loading")return;let Ge;return O||E||Wt?(()=>{if(Zn.current{Qe.current!==1/0&&(sn.current=new Date().getTime(),Ge=setTimeout(()=>{v.onAutoClose==null||v.onAutoClose.call(v,v),Za()},Qe.current))})(),()=>clearTimeout(Ge)},[O,E,v,Z,Wt,Za]),Q.useEffect(()=>{v.delete&&(Za(),v.onDismiss==null||v.onDismiss.call(v,v))},[Za,v.delete]);function co(){var Ge;if(P?.loading){var Tt;return Q.createElement("div",{className:tr(R?.loader,v==null||(Tt=v.classNames)==null?void 0:Tt.loader,"sonner-loader"),"data-visible":Z==="loading"},P.loading)}return Q.createElement(L2,{className:tr(R?.loader,v==null||(Ge=v.classNames)==null?void 0:Ge.loader),visible:Z==="loading"})}const uo=v.icon||P?.[Z]||K2(Z);var Ei,Ya;return Q.createElement("li",{tabIndex:0,ref:jn,className:tr(ge,ce,R?.toast,v==null||(t=v.classNames)==null?void 0:t.toast,R?.default,R?.[Z],v==null||(r=v.classNames)==null?void 0:r[Z]),"data-sonner-toast":"","data-rich-colors":(Ei=v.richColors)!=null?Ei:T,"data-styled":!(v.jsx||v.unstyled||w),"data-mounted":Y,"data-promise":!!v.promise,"data-swiped":Ye,"data-removed":oe,"data-visible":$,"data-y-position":Na,"data-x-position":Jt,"data-index":D,"data-front":z,"data-swiping":W,"data-dismissible":ye,"data-type":Z,"data-invert":As,"data-swipe-out":Oe,"data-swipe-direction":Re,"data-expanded":!!(O||be&&Y),"data-testid":v.testId,style:{"--index":D,"--toasts-before":D,"--z-index":A.length-D,"--offset":`${oe?Kt:kn.current}px`,"--initial-height":be?"auto":`${qe}px`,...L,...v.style},onDragEnd:()=>{xe(!1),me(null),Xa.current=null},onPointerDown:Ge=>{Ge.button!==2&&(Ir||!ye||(Ga.current=new Date,B(kn.current),Ge.target.setPointerCapture(Ge.pointerId),Ge.target.tagName!=="BUTTON"&&(xe(!0),Xa.current={x:Ge.clientX,y:Ge.clientY})))},onPointerUp:()=>{var Ge,Tt,ln;if(Oe||!ye)return;Xa.current=null;const Rn=Number(((Ge=jn.current)==null?void 0:Ge.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Lr=Number(((Tt=jn.current)==null?void 0:Tt.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),kt=new Date().getTime()-((ln=Ga.current)==null?void 0:ln.getTime()),Pn=ee==="x"?Rn:Lr,Ci=Math.abs(Pn)/kt;if(Math.abs(Pn)>=aN||Ci>.11){B(kn.current),v.onDismiss==null||v.onDismiss.call(v,v),G(ee==="x"?Rn>0?"right":"left":Lr>0?"down":"up"),Za(),Ue(!0);return}else{var Kn,In;(Kn=jn.current)==null||Kn.style.setProperty("--swipe-amount-x","0px"),(In=jn.current)==null||In.style.setProperty("--swipe-amount-y","0px")}Ze(!1),xe(!1),me(null)},onPointerMove:Ge=>{var Tt,ln,Rn;if(!Xa.current||!ye||((Tt=window.getSelection())==null?void 0:Tt.toString().length)>0)return;const kt=Ge.clientY-Xa.current.y,Pn=Ge.clientX-Xa.current.x;var Ci;const Kn=(Ci=e.swipeDirections)!=null?Ci:iN(le);!ee&&(Math.abs(Pn)>1||Math.abs(kt)>1)&&me(Math.abs(Pn)>Math.abs(kt)?"x":"y");let In={x:0,y:0};const fo=Aa=>1/(1.5+Math.abs(Aa)/20);if(ee==="y"){if(Kn.includes("top")||Kn.includes("bottom"))if(Kn.includes("top")&&kt<0||Kn.includes("bottom")&&kt>0)In.y=kt;else{const Aa=kt*fo(kt);In.y=Math.abs(Aa)0)In.x=Pn;else{const Aa=Pn*fo(Pn);In.x=Math.abs(Aa)0||Math.abs(In.y)>0)&&Ze(!0),(ln=jn.current)==null||ln.style.setProperty("--swipe-amount-x",`${In.x}px`),(Rn=jn.current)==null||Rn.style.setProperty("--swipe-amount-y",`${In.y}px`)}},lt&&!v.jsx&&Z!=="loading"?Q.createElement("button",{"aria-label":I,"data-disabled":Ir,"data-close-button":!0,onClick:Ir||!ye?()=>{}:()=>{Za(),v.onDismiss==null||v.onDismiss.call(v,v)},className:tr(R?.closeButton,v==null||(i=v.classNames)==null?void 0:i.closeButton)},(Ya=P?.close)!=null?Ya:V2):null,(Z||v.icon||v.promise)&&v.icon!==null&&(P?.[Z]!==null||v.icon)?Q.createElement("div",{"data-icon":"",className:tr(R?.icon,v==null||(s=v.classNames)==null?void 0:s.icon)},v.promise||v.type==="loading"&&!v.icon?v.icon||co():null,v.type!=="loading"?uo:null):null,Q.createElement("div",{"data-content":"",className:tr(R?.content,v==null||(u=v.classNames)==null?void 0:u.content)},Q.createElement("div",{"data-title":"",className:tr(R?.title,v==null||(d=v.classNames)==null?void 0:d.title)},v.jsx?v.jsx:typeof v.title=="function"?v.title():v.title),v.description?Q.createElement("div",{"data-description":"",className:tr(pe,ue,R?.description,v==null||(h=v.classNames)==null?void 0:h.description)},typeof v.description=="function"?v.description():v.description):null),Q.isValidElement(v.cancel)?v.cancel:v.cancel&&Ou(v.cancel)?Q.createElement("button",{"data-button":!0,"data-cancel":!0,style:v.cancelButtonStyle||V,onClick:Ge=>{Ou(v.cancel)&&ye&&(v.cancel.onClick==null||v.cancel.onClick.call(v.cancel,Ge),Za())},className:tr(R?.cancelButton,v==null||(g=v.classNames)==null?void 0:g.cancelButton)},v.cancel.label):null,Q.isValidElement(v.action)?v.action:v.action&&Ou(v.action)?Q.createElement("button",{"data-button":!0,"data-action":!0,style:v.actionButtonStyle||fe,onClick:Ge=>{Ou(v.action)&&(v.action.onClick==null||v.action.onClick.call(v.action,Ge),!Ge.defaultPrevented&&Za())},className:tr(R?.actionButton,v==null||(y=v.classNames)==null?void 0:y.actionButton)},v.action.label):null)};function Xb(){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 sN(e,t){const r={};return[e,t].forEach((i,s)=>{const u=s===1,d=u?"--mobile-offset":"--offset",h=u?eN:W2;function g(y){["top","right","bottom","left"].forEach(x=>{r[`${d}-${x}`]=typeof y=="number"?`${y}px`:y})}typeof i=="number"||typeof i=="string"?g(i):typeof i=="object"?["top","right","bottom","left"].forEach(y=>{i[y]===void 0?r[`${d}-${y}`]=h:r[`${d}-${y}`]=typeof i[y]=="number"?`${i[y]}px`:i[y]}):g(h)}),r}const lN=Q.forwardRef(function(t,r){const{id:i,invert:s,position:u="bottom-right",hotkey:d=["altKey","KeyT"],expand:h,closeButton:g,className:y,offset:x,mobileOffset:v,theme:w="light",richColors:E,duration:j,style:S,visibleToasts:N=J2,toastOptions:D,dir:A=Xb(),gap:O=nN,icons:C,containerAriaLabel:T="Notifications"}=t,[U,L]=Q.useState([]),V=Q.useMemo(()=>i?U.filter(Y=>Y.toasterId===i):U.filter(Y=>!Y.toasterId),[U,i]),fe=Q.useMemo(()=>Array.from(new Set([u].concat(V.filter(Y=>Y.position).map(Y=>Y.position)))),[V,u]),[ge,pe]=Q.useState([]),[ae,le]=Q.useState(!1),[he,be]=Q.useState(!1),[R,P]=Q.useState(w!=="system"?w:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),I=Q.useRef(null),ee=d.join("+").replace(/Key/g,"").replace(/Digit/g,""),me=Q.useRef(null),Re=Q.useRef(!1),G=Q.useCallback(Y=>{L(ie=>{var oe;return(oe=ie.find(ve=>ve.id===Y.id))!=null&&oe.delete||Bn.dismiss(Y.id),ie.filter(({id:ve})=>ve!==Y.id)})},[]);return Q.useEffect(()=>Bn.subscribe(Y=>{if(Y.dismiss){requestAnimationFrame(()=>{L(ie=>ie.map(oe=>oe.id===Y.id?{...oe,delete:!0}:oe))});return}setTimeout(()=>{U0.flushSync(()=>{L(ie=>{const oe=ie.findIndex(ve=>ve.id===Y.id);return oe!==-1?[...ie.slice(0,oe),{...ie[oe],...Y},...ie.slice(oe+1)]:[Y,...ie]})})})}),[U]),Q.useEffect(()=>{if(w!=="system"){P(w);return}if(w==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?P("dark"):P("light")),typeof window>"u")return;const Y=window.matchMedia("(prefers-color-scheme: dark)");try{Y.addEventListener("change",({matches:ie})=>{P(ie?"dark":"light")})}catch{Y.addListener(({matches:oe})=>{try{P(oe?"dark":"light")}catch(ve){console.error(ve)}})}},[w]),Q.useEffect(()=>{U.length<=1&&le(!1)},[U]),Q.useEffect(()=>{const Y=ie=>{var oe;if(d.every(xe=>ie[xe]||ie.code===xe)){var W;le(!0),(W=I.current)==null||W.focus()}ie.code==="Escape"&&(document.activeElement===I.current||(oe=I.current)!=null&&oe.contains(document.activeElement))&&le(!1)};return document.addEventListener("keydown",Y),()=>document.removeEventListener("keydown",Y)},[d]),Q.useEffect(()=>{if(I.current)return()=>{me.current&&(me.current.focus({preventScroll:!0}),me.current=null,Re.current=!1)}},[I.current]),Q.createElement("section",{ref:r,"aria-label":`${T} ${ee}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},fe.map((Y,ie)=>{var oe;const[ve,W]=Y.split("-");return V.length?Q.createElement("ol",{key:Y,dir:A==="auto"?Xb():A,tabIndex:-1,ref:I,className:y,"data-sonner-toaster":!0,"data-sonner-theme":R,"data-y-position":ve,"data-x-position":W,style:{"--front-toast-height":`${((oe=ge[0])==null?void 0:oe.height)||0}px`,"--width":`${tN}px`,"--gap":`${O}px`,...S,...sN(x,v)},onBlur:xe=>{Re.current&&!xe.currentTarget.contains(xe.relatedTarget)&&(Re.current=!1,me.current&&(me.current.focus({preventScroll:!0}),me.current=null))},onFocus:xe=>{xe.target instanceof HTMLElement&&xe.target.dataset.dismissible==="false"||Re.current||(Re.current=!0,me.current=xe.relatedTarget)},onMouseEnter:()=>le(!0),onMouseMove:()=>le(!0),onMouseLeave:()=>{he||le(!1)},onDragEnd:()=>le(!1),onPointerDown:xe=>{xe.target instanceof HTMLElement&&xe.target.dataset.dismissible==="false"||be(!0)},onPointerUp:()=>be(!1)},V.filter(xe=>!xe.position&&ie===0||xe.position===Y).map((xe,Oe)=>{var Ue,Ye;return Q.createElement(oN,{key:xe.id,icons:C,index:Oe,toast:xe,defaultRichColors:E,duration:(Ue=D?.duration)!=null?Ue:j,className:D?.className,descriptionClassName:D?.descriptionClassName,invert:s,visibleToasts:N,closeButton:(Ye=D?.closeButton)!=null?Ye:g,interacting:he,position:Y,style:D?.style,unstyled:D?.unstyled,classNames:D?.classNames,cancelButtonStyle:D?.cancelButtonStyle,actionButtonStyle:D?.actionButtonStyle,closeButtonAriaLabel:D?.closeButtonAriaLabel,removeToast:G,toasts:V.filter(Ze=>Ze.position==xe.position),heights:ge.filter(Ze=>Ze.position==xe.position),setHeights:pe,expandByDefault:h,gap:O,expanded:ae,swipeDirections:t.swipeDirections})})):null}))}),cN=({...e})=>{const{theme:t="system"}=BR();return l.jsx(lN,{theme:t,className:"toaster group",icons:{success:l.jsx(JO,{className:"size-4"}),info:l.jsx(d2,{className:"size-4"}),warning:l.jsx(T2,{className:"size-4"}),error:l.jsx(y2,{className:"size-4"}),loading:l.jsx(ps,{className:"size-4 animate-spin"})},style:{"--normal-bg":"var(--popover)","--normal-text":"var(--popover-foreground)","--normal-border":"var(--border)","--border-radius":"var(--radius)"},...e})},uN=new SO,dN=({children:e})=>l.jsx(_O,{client:uN,children:l.jsxs(WR,{defaultTheme:"system",storageKey:"dragon-theme",children:[e,l.jsx(cN,{richColors:!0,expand:!0,position:"top-center"})]})});var Sm={exports:{}},wl={},_m={exports:{}},Em={};var Zb;function fN(){return Zb||(Zb=1,(function(e){function t(R,P){var I=R.length;R.push(P);e:for(;0>>1,me=R[ee];if(0>>1;ees(Y,I))ies(oe,Y)?(R[ee]=oe,R[ie]=I,ee=ie):(R[ee]=Y,R[G]=I,ee=G);else if(ies(oe,I))R[ee]=oe,R[ie]=I,ee=ie;else break e}}return P}function s(R,P){var I=R.sortIndex-P.sortIndex;return I!==0?I:R.id-P.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;e.unstable_now=function(){return u.now()}}else{var d=Date,h=d.now();e.unstable_now=function(){return d.now()-h}}var g=[],y=[],x=1,v=null,w=3,E=!1,j=!1,S=!1,N=!1,D=typeof setTimeout=="function"?setTimeout:null,A=typeof clearTimeout=="function"?clearTimeout:null,O=typeof setImmediate<"u"?setImmediate:null;function C(R){for(var P=r(y);P!==null;){if(P.callback===null)i(y);else if(P.startTime<=R)i(y),P.sortIndex=P.expirationTime,t(g,P);else break;P=r(y)}}function T(R){if(S=!1,C(R),!j)if(r(g)!==null)j=!0,U||(U=!0,ae());else{var P=r(y);P!==null&&be(T,P.startTime-R)}}var U=!1,L=-1,V=5,fe=-1;function ge(){return N?!0:!(e.unstable_now()-feR&&ge());){var ee=v.callback;if(typeof ee=="function"){v.callback=null,w=v.priorityLevel;var me=ee(v.expirationTime<=R);if(R=e.unstable_now(),typeof me=="function"){v.callback=me,C(R),P=!0;break t}v===r(g)&&i(g),C(R)}else i(g);v=r(g)}if(v!==null)P=!0;else{var Re=r(y);Re!==null&&be(T,Re.startTime-R),P=!1}}break e}finally{v=null,w=I,E=!1}P=void 0}}finally{P?ae():U=!1}}}var ae;if(typeof O=="function")ae=function(){O(pe)};else if(typeof MessageChannel<"u"){var le=new MessageChannel,he=le.port2;le.port1.onmessage=pe,ae=function(){he.postMessage(null)}}else ae=function(){D(pe,0)};function be(R,P){L=D(function(){R(e.unstable_now())},P)}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(R){R.callback=null},e.unstable_forceFrameRate=function(R){0>R||125ee?(R.sortIndex=I,t(y,R),r(g)===null&&R===r(y)&&(S?(A(L),L=-1):S=!0,be(T,I-ee))):(R.sortIndex=me,t(g,R),j||E||(j=!0,U||(U=!0,ae()))),R},e.unstable_shouldYield=ge,e.unstable_wrapCallback=function(R){var P=w;return function(){var I=w;w=P;try{return R.apply(this,arguments)}finally{w=I}}}})(Em)),Em}var Yb;function hN(){return Yb||(Yb=1,_m.exports=fN()),_m.exports}var Qb;function mN(){if(Qb)return wl;Qb=1;var e=hN(),t=q0(),r=PR();function i(n){var a="https://react.dev/errors/"+n;if(1me||(n.current=ee[me],ee[me]=null,me--)}function Y(n,a){me++,ee[me]=n.current,n.current=a}var ie=Re(null),oe=Re(null),ve=Re(null),W=Re(null);function xe(n,a){switch(Y(ve,a),Y(oe,n),Y(ie,null),a.nodeType){case 9:case 11:n=(n=a.documentElement)&&(n=n.namespaceURI)?tb(n):0;break;default:if(n=a.tagName,a=a.namespaceURI)a=tb(a),n=nb(a,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}G(ie),Y(ie,n)}function Oe(){G(ie),G(oe),G(ve)}function Ue(n){n.memoizedState!==null&&Y(W,n);var a=ie.current,o=nb(a,n.type);a!==o&&(Y(oe,n),Y(ie,o))}function Ye(n){oe.current===n&&(G(ie),G(oe)),W.current===n&&(G(W),gl._currentValue=I)}var Ze,Kt;function B(n){if(Ze===void 0)try{throw Error()}catch(o){var a=o.stack.trim().match(/\n( *(at )?)/);Ze=a&&a[1]||"",Kt=-1)":-1f||M[c]!==F[f]){var J=` `+M[c].replace(" at new "," at ");return n.displayName&&J.includes("")&&(J=J.replace("",n.displayName)),J}while(1<=c&&0<=f);break}}}finally{qe=!1,Error.prepareStackTrace=o}return(o=n?n.displayName||n.name:"")?B(o):""}function Qe(n,a){switch(n.tag){case 26:case 27:case 5:return B(n.type);case 16:return B("Lazy");case 13:return n.child!==a&&a!==null?B("Suspense Fallback"):B("Suspense");case 19:return B("SuspenseList");case 0:case 15:return ke(n.type,!1);case 11:return ke(n.type.render,!1);case 1:return ke(n.type,!0);case 31:return B("Activity");default:return""}}function Ga(n){try{var a="",o=null;do a+=Qe(n,o),o=n,n=n.return;while(n);return a}catch(c){return` Error generating stack: `+c.message+` `+c.stack}}var jn=Object.prototype.hasOwnProperty,z=e.unstable_scheduleCallback,$=e.unstable_cancelCallback,Z=e.unstable_shouldYield,ye=e.unstable_requestPaint,ce=e.unstable_now,ue=e.unstable_getCurrentPriorityLevel,De=e.unstable_ImmediatePriority,lt=e.unstable_UserBlockingPriority,ct=e.unstable_NormalPriority,sn=e.unstable_LowPriority,kn=e.unstable_IdlePriority,Zn=e.log,Xa=e.unstable_setDisableYieldValue,Na=null,Jt=null;function Yn(n){if(typeof Zn=="function"&&Xa(n),Jt&&typeof Jt.setStrictMode=="function")try{Jt.setStrictMode(Na,n)}catch{}}var Wt=Math.clz32?Math.clz32:Za,As=Math.log,Ir=Math.LN2;function Za(n){return n>>>=0,n===0?32:31-(As(n)/Ir|0)|0}var co=256,uo=262144,Ei=4194304;function Ya(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 Ge(n,a,o){var c=n.pendingLanes;if(c===0)return 0;var f=0,m=n.suspendedLanes,b=n.pingedLanes;n=n.warmLanes;var _=c&134217727;return _!==0?(c=_&~m,c!==0?f=Ya(c):(b&=_,b!==0?f=Ya(b):o||(o=_&~n,o!==0&&(f=Ya(o))))):(_=c&~m,_!==0?f=Ya(_):b!==0?f=Ya(b):o||(o=c&~n,o!==0&&(f=Ya(o)))),f===0?0:a!==0&&a!==f&&(a&m)===0&&(m=f&-f,o=a&-a,m>=o||m===32&&(o&4194048)!==0)?a:f}function Tt(n,a){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&a)===0}function ln(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 Rn(){var n=Ei;return Ei<<=1,(Ei&62914560)===0&&(Ei=4194304),n}function Lr(n){for(var a=[],o=0;31>o;o++)a.push(n);return a}function kt(n,a){n.pendingLanes|=a,a!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function Pn(n,a,o,c,f,m){var b=n.pendingLanes;n.pendingLanes=o,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=o,n.entangledLanes&=o,n.errorRecoveryDisabledLanes&=o,n.shellSuspendCounter=0;var _=n.entanglements,M=n.expirationTimes,F=n.hiddenUpdates;for(o=b&~o;0"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var AC=/[\n"\\]/g;function ma(n){return n.replace(AC,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function hf(n,a,o,c,f,m,b,_){n.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?n.type=b:n.removeAttribute("type"),a!=null?b==="number"?(a===0&&n.value===""||n.value!=a)&&(n.value=""+ha(a)):n.value!==""+ha(a)&&(n.value=""+ha(a)):b!=="submit"&&b!=="reset"||n.removeAttribute("value"),a!=null?mf(n,b,ha(a)):o!=null?mf(n,b,ha(o)):c!=null&&n.removeAttribute("value"),f==null&&m!=null&&(n.defaultChecked=!!m),f!=null&&(n.checked=f&&typeof f!="function"&&typeof f!="symbol"),_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?n.name=""+ha(_):n.removeAttribute("name")}function Zg(n,a,o,c,f,m,b,_){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(n.type=m),a!=null||o!=null){if(!(m!=="submit"&&m!=="reset"||a!=null)){ff(n);return}o=o!=null?""+ha(o):"",a=a!=null?""+ha(a):o,_||a===n.value||(n.value=a),n.defaultValue=a}c=c??f,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=_?n.checked:!!c,n.defaultChecked=!!c,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(n.name=b),ff(n)}function mf(n,a,o){a==="number"&&pc(n.ownerDocument)===n||n.defaultValue===""+o||(n.defaultValue=""+o)}function vo(n,a,o,c){if(n=n.options,a){a={};for(var f=0;f"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xf=!1;if(mr)try{var zs={};Object.defineProperty(zs,"passive",{get:function(){xf=!0}}),window.addEventListener("test",zs,zs),window.removeEventListener("test",zs,zs)}catch{xf=!1}var qr=null,bf=null,yc=null;function ny(){if(yc)return yc;var n,a=bf,o=a.length,c,f="value"in qr?qr.value:qr.textContent,m=f.length;for(n=0;n=Ks),ly=" ",cy=!1;function uy(n,a){switch(n){case"keyup":return rj.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function dy(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var So=!1;function oj(n,a){switch(n){case"compositionend":return dy(a);case"keypress":return a.which!==32?null:(cy=!0,ly);case"textInput":return n=a.data,n===ly&&cy?null:n;default:return null}}function sj(n,a){if(So)return n==="compositionend"||!Cf&&uy(n,a)?(n=ny(),yc=bf=qr=null,So=!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:o,offset:a-n};n=c}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=xy(o)}}function wy(n,a){return n&&a?n===a?!0:n&&n.nodeType===3?!1:a&&a.nodeType===3?wy(n,a.parentNode):"contains"in n?n.contains(a):n.compareDocumentPosition?!!(n.compareDocumentPosition(a)&16):!1:!1}function Sy(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var a=pc(n.document);a instanceof n.HTMLIFrameElement;){try{var o=typeof a.contentWindow.location.href=="string"}catch{o=!1}if(o)n=a.contentWindow;else break;a=pc(n.document)}return a}function Of(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 pj=mr&&"documentMode"in document&&11>=document.documentMode,_o=null,Nf=null,qs=null,Af=!1;function _y(n,a,o){var c=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Af||_o==null||_o!==pc(c)||(c=_o,"selectionStart"in c&&Of(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}),qs&&Us(qs,c)||(qs=c,c=uu(Nf,"onSelect"),0>=b,f-=b,Qa=1<<32-Wt(a)+f|o<We?(ot=Me,Me=null):ot=Me.sibling;var ht=H(K,Me,q[We],te);if(ht===null){Me===null&&(Me=ot);break}n&&Me&&ht.alternate===null&&a(K,Me),k=m(ht,k,We),ft===null?Ke=ht:ft.sibling=ht,ft=ht,Me=ot}if(We===q.length)return o(K,Me),st&&gr(K,We),Ke;if(Me===null){for(;WeWe?(ot=Me,Me=null):ot=Me.sibling;var ci=H(K,Me,ht.value,te);if(ci===null){Me===null&&(Me=ot);break}n&&Me&&ci.alternate===null&&a(K,Me),k=m(ci,k,We),ft===null?Ke=ci:ft.sibling=ci,ft=ci,Me=ot}if(ht.done)return o(K,Me),st&&gr(K,We),Ke;if(Me===null){for(;!ht.done;We++,ht=q.next())ht=ne(K,ht.value,te),ht!==null&&(k=m(ht,k,We),ft===null?Ke=ht:ft.sibling=ht,ft=ht);return st&&gr(K,We),Ke}for(Me=c(Me);!ht.done;We++,ht=q.next())ht=X(Me,K,We,ht.value,te),ht!==null&&(n&&ht.alternate!==null&&Me.delete(ht.key===null?We:ht.key),k=m(ht,k,We),ft===null?Ke=ht:ft.sibling=ht,ft=ht);return n&&Me.forEach(function(kR){return a(K,kR)}),st&&gr(K,We),Ke}function St(K,k,q,te){if(typeof q=="object"&&q!==null&&q.type===S&&q.key===null&&(q=q.props.children),typeof q=="object"&&q!==null){switch(q.$$typeof){case E:e:{for(var Ke=q.key;k!==null;){if(k.key===Ke){if(Ke=q.type,Ke===S){if(k.tag===7){o(K,k.sibling),te=f(k,q.props.children),te.return=K,K=te;break e}}else if(k.elementType===Ke||typeof Ke=="object"&&Ke!==null&&Ke.$$typeof===V&&Pi(Ke)===k.type){o(K,k.sibling),te=f(k,q.props),Gs(te,q),te.return=K,K=te;break e}o(K,k);break}else a(K,k);k=k.sibling}q.type===S?(te=Ti(q.props.children,K.mode,te,q.key),te.return=K,K=te):(te=Rc(q.type,q.key,q.props,null,K.mode,te),Gs(te,q),te.return=K,K=te)}return b(K);case j:e:{for(Ke=q.key;k!==null;){if(k.key===Ke)if(k.tag===4&&k.stateNode.containerInfo===q.containerInfo&&k.stateNode.implementation===q.implementation){o(K,k.sibling),te=f(k,q.children||[]),te.return=K,K=te;break e}else{o(K,k);break}else a(K,k);k=k.sibling}te=Kf(q,K.mode,te),te.return=K,K=te}return b(K);case V:return q=Pi(q),St(K,k,q,te)}if(be(q))return je(K,k,q,te);if(ae(q)){if(Ke=ae(q),typeof Ke!="function")throw Error(i(150));return q=Ke.call(q),Le(K,k,q,te)}if(typeof q.then=="function")return St(K,k,zc(q),te);if(q.$$typeof===O)return St(K,k,Ac(K,q),te);kc(K,q)}return typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint"?(q=""+q,k!==null&&k.tag===6?(o(K,k.sibling),te=f(k,q),te.return=K,K=te):(o(K,k),te=Pf(q,K.mode,te),te.return=K,K=te),b(K)):o(K,k)}return function(K,k,q,te){try{Bs=0;var Ke=St(K,k,q,te);return zo=null,Ke}catch(Me){if(Me===Mo||Me===Dc)throw Me;var ft=Jn(29,Me,null,K.mode);return ft.lanes=te,ft.return=K,ft}finally{}}}var Ii=By(!0),Gy=By(!1),Br=!1;function Zf(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Yf(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 Gr(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function Xr(n,a,o){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(gt&2)!==0){var f=c.pending;return f===null?a.next=a:(a.next=f.next,f.next=a),c.pending=a,a=jc(n),Ay(n,null,o),a}return Cc(n,c,a,o),jc(n)}function Xs(n,a,o){if(a=a.updateQueue,a!==null&&(a=a.shared,(o&4194048)!==0)){var c=a.lanes;c&=n.pendingLanes,o|=c,a.lanes=o,Kn(n,o)}}function Qf(n,a){var o=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,o===c)){var f=null,m=null;if(o=o.firstBaseUpdate,o!==null){do{var b={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};m===null?f=m=b:m=m.next=b,o=o.next}while(o!==null);m===null?f=m=a:m=m.next=a}else f=m=a;o={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:c.shared,callbacks:c.callbacks},n.updateQueue=o;return}n=o.lastBaseUpdate,n===null?o.firstBaseUpdate=a:n.next=a,o.lastBaseUpdate=a}var Jf=!1;function Zs(){if(Jf){var n=Do;if(n!==null)throw n}}function Ys(n,a,o,c){Jf=!1;var f=n.updateQueue;Br=!1;var m=f.firstBaseUpdate,b=f.lastBaseUpdate,_=f.shared.pending;if(_!==null){f.shared.pending=null;var M=_,F=M.next;M.next=null,b===null?m=F:b.next=F,b=M;var J=n.alternate;J!==null&&(J=J.updateQueue,_=J.lastBaseUpdate,_!==b&&(_===null?J.firstBaseUpdate=F:_.next=F,J.lastBaseUpdate=M))}if(m!==null){var ne=f.baseState;b=0,J=F=M=null,_=m;do{var H=_.lane&-536870913,X=H!==_.lane;if(X?(it&H)===H:(c&H)===H){H!==0&&H===To&&(Jf=!0),J!==null&&(J=J.next={lane:0,tag:_.tag,payload:_.payload,callback:null,next:null});e:{var je=n,Le=_;H=a;var St=o;switch(Le.tag){case 1:if(je=Le.payload,typeof je=="function"){ne=je.call(St,ne,H);break e}ne=je;break e;case 3:je.flags=je.flags&-65537|128;case 0:if(je=Le.payload,H=typeof je=="function"?je.call(St,ne,H):je,H==null)break e;ne=v({},ne,H);break e;case 2:Br=!0}}H=_.callback,H!==null&&(n.flags|=64,X&&(n.flags|=8192),X=f.callbacks,X===null?f.callbacks=[H]:X.push(H))}else X={lane:H,tag:_.tag,payload:_.payload,callback:_.callback,next:null},J===null?(F=J=X,M=ne):J=J.next=X,b|=H;if(_=_.next,_===null){if(_=f.shared.pending,_===null)break;X=_,_=X.next,X.next=null,f.lastBaseUpdate=X,f.shared.pending=null}}while(!0);J===null&&(M=ne),f.baseState=M,f.firstBaseUpdate=F,f.lastBaseUpdate=J,m===null&&(f.shared.lanes=0),Wr|=b,n.lanes=b,n.memoizedState=ne}}function Xy(n,a){if(typeof n!="function")throw Error(i(191,n));n.call(a)}function Zy(n,a){var o=n.callbacks;if(o!==null)for(n.callbacks=null,n=0;nm?m:8;var b=R.T,_={};R.T=_,yh(n,!1,a,o);try{var M=f(),F=R.S;if(F!==null&&F(_,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var J=Ej(M,c);Ws(n,a,J,aa(n))}else Ws(n,a,c,aa(n))}catch(ne){Ws(n,a,{then:function(){},status:"rejected",reason:ne},aa())}finally{P.p=m,b!==null&&_.types!==null&&(b.types=_.types),R.T=b}}function Aj(){}function ph(n,a,o,c){if(n.tag!==5)throw Error(i(476));var f=Rv(n).queue;jv(n,f,a,I,o===null?Aj:function(){return Ov(n),o(c)})}function Rv(n){var a=n.memoizedState;if(a!==null)return a;a={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:I},next:null};var o={};return a.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:br,lastRenderedState:o},next:null},n.memoizedState=a,n=n.alternate,n!==null&&(n.memoizedState=a),a}function Ov(n){var a=Rv(n);a.next===null&&(a=n.alternate.memoizedState),Ws(n,a.next.queue,{},aa())}function gh(){return yn(gl)}function Nv(){return Ft().memoizedState}function Av(){return Ft().memoizedState}function Tj(n){for(var a=n.return;a!==null;){switch(a.tag){case 24:case 3:var o=aa();n=Gr(o);var c=Xr(a,n,o);c!==null&&(Hn(c,a,o),Xs(c,a,o)),a={cache:Hf()},n.payload=a;return}a=a.return}}function Dj(n,a,o){var c=aa();o={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Hc(n)?Dv(a,o):(o=zf(n,a,o,c),o!==null&&(Hn(o,n,c),Mv(o,a,c)))}function Tv(n,a,o){var c=aa();Ws(n,a,o,c)}function Ws(n,a,o,c){var f={lane:c,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Hc(n))Dv(a,f);else{var m=n.alternate;if(n.lanes===0&&(m===null||m.lanes===0)&&(m=a.lastRenderedReducer,m!==null))try{var b=a.lastRenderedState,_=m(b,o);if(f.hasEagerState=!0,f.eagerState=_,Qn(_,b))return Cc(n,a,f,0),_t===null&&Ec(),!1}catch{}finally{}if(o=zf(n,a,f,c),o!==null)return Hn(o,n,c),Mv(o,a,c),!0}return!1}function yh(n,a,o,c){if(c={lane:2,revertLane:Zh(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Hc(n)){if(a)throw Error(i(479))}else a=zf(n,o,c,2),a!==null&&Hn(a,n,2)}function Hc(n){var a=n.alternate;return n===Je||a!==null&&a===Je}function Dv(n,a){Po=Ic=!0;var o=n.pending;o===null?a.next=a:(a.next=o.next,o.next=a),n.pending=a}function Mv(n,a,o){if((o&4194048)!==0){var c=a.lanes;c&=n.pendingLanes,o|=c,a.lanes=o,Kn(n,o)}}var el={readContext:yn,use:qc,useCallback:It,useContext:It,useEffect:It,useImperativeHandle:It,useLayoutEffect:It,useInsertionEffect:It,useMemo:It,useReducer:It,useRef:It,useState:It,useDebugValue:It,useDeferredValue:It,useTransition:It,useSyncExternalStore:It,useId:It,useHostTransitionStatus:It,useFormState:It,useActionState:It,useOptimistic:It,useMemoCache:It,useCacheRefresh:It};el.useEffectEvent=It;var zv={readContext:yn,use:qc,useCallback:function(n,a){return On().memoizedState=[n,a===void 0?null:a],n},useContext:yn,useEffect:yv,useImperativeHandle:function(n,a,o){o=o!=null?o.concat([n]):null,$c(4194308,4,wv.bind(null,a,n),o)},useLayoutEffect:function(n,a){return $c(4194308,4,n,a)},useInsertionEffect:function(n,a){$c(4,2,n,a)},useMemo:function(n,a){var o=On();a=a===void 0?null:a;var c=n();if(Li){Yn(!0);try{n()}finally{Yn(!1)}}return o.memoizedState=[c,a],c},useReducer:function(n,a,o){var c=On();if(o!==void 0){var f=o(a);if(Li){Yn(!0);try{o(a)}finally{Yn(!1)}}}else f=a;return c.memoizedState=c.baseState=f,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:f},c.queue=n,n=n.dispatch=Dj.bind(null,Je,n),[c.memoizedState,n]},useRef:function(n){var a=On();return n={current:n},a.memoizedState=n},useState:function(n){n=uh(n);var a=n.queue,o=Tv.bind(null,Je,a);return a.dispatch=o,[n.memoizedState,o]},useDebugValue:hh,useDeferredValue:function(n,a){var o=On();return mh(o,n,a)},useTransition:function(){var n=uh(!1);return n=jv.bind(null,Je,n.queue,!0,!1),On().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,a,o){var c=Je,f=On();if(st){if(o===void 0)throw Error(i(407));o=o()}else{if(o=a(),_t===null)throw Error(i(349));(it&127)!==0||tv(c,a,o)}f.memoizedState=o;var m={value:o,getSnapshot:a};return f.queue=m,yv(av.bind(null,c,m,n),[n]),c.flags|=2048,Io(9,{destroy:void 0},nv.bind(null,c,m,o,a),null),o},useId:function(){var n=On(),a=_t.identifierPrefix;if(st){var o=Ja,c=Qa;o=(c&~(1<<32-Wt(c)-1)).toString(32)+o,a="_"+a+"R_"+o,o=Lc++,0<\/script>",m=m.removeChild(m.firstChild);break;case"select":m=typeof c.is=="string"?b.createElement("select",{is:c.is}):b.createElement("select"),c.multiple?m.multiple=!0:c.size&&(m.size=c.size);break;default:m=typeof c.is=="string"?b.createElement(f,{is:c.is}):b.createElement(f)}}m[pn]=a,m[Ln]=c;e:for(b=a.child;b!==null;){if(b.tag===5||b.tag===6)m.appendChild(b.stateNode);else if(b.tag!==4&&b.tag!==27&&b.child!==null){b.child.return=b,b=b.child;continue}if(b===a)break e;for(;b.sibling===null;){if(b.return===null||b.return===a)break e;b=b.return}b.sibling.return=b.return,b=b.sibling}a.stateNode=m;e:switch(xn(m,f,c),f){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Sr(a)}}return At(a),Th(a,a.type,n===null?null:n.memoizedProps,a.pendingProps,o),null;case 6:if(n&&a.stateNode!=null)n.memoizedProps!==c&&Sr(a);else{if(typeof c!="string"&&a.stateNode===null)throw Error(i(166));if(n=ve.current,No(a)){if(n=a.stateNode,o=a.memoizedProps,c=null,f=gn,f!==null)switch(f.tag){case 27:case 5:c=f.memoizedProps}n[pn]=a,n=!!(n.nodeValue===o||c!==null&&c.suppressHydrationWarning===!0||Wx(n.nodeValue,o)),n||Vr(a,!0)}else n=du(n).createTextNode(c),n[pn]=a,a.stateNode=n}return At(a),null;case 31:if(o=a.memoizedState,n===null||n.memoizedState!==null){if(c=No(a),o!==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[pn]=a}else Di(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;At(a),n=!1}else o=qf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=o),n=!0;if(!n)return a.flags&256?(ea(a),a):(ea(a),null);if((a.flags&128)!==0)throw Error(i(558))}return At(a),null;case 13:if(c=a.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(f=No(a),c!==null&&c.dehydrated!==null){if(n===null){if(!f)throw Error(i(318));if(f=a.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(i(317));f[pn]=a}else Di(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;At(a),f=!1}else f=qf(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=f),f=!0;if(!f)return a.flags&256?(ea(a),a):(ea(a),null)}return ea(a),(a.flags&128)!==0?(a.lanes=o,a):(o=c!==null,n=n!==null&&n.memoizedState!==null,o&&(c=a.child,f=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(f=c.alternate.memoizedState.cachePool.pool),m=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(m=c.memoizedState.cachePool.pool),m!==f&&(c.flags|=2048)),o!==n&&o&&(a.child.flags|=8192),Yc(a,a.updateQueue),At(a),null);case 4:return Oe(),n===null&&Wh(a.stateNode.containerInfo),At(a),null;case 10:return vr(a.type),At(a),null;case 19:if(G(qt),c=a.memoizedState,c===null)return At(a),null;if(f=(a.flags&128)!==0,m=c.rendering,m===null)if(f)nl(c,!1);else{if(Lt!==0||n!==null&&(n.flags&128)!==0)for(n=a.child;n!==null;){if(m=Kc(n),m!==null){for(a.flags|=128,nl(c,!1),n=m.updateQueue,a.updateQueue=n,Yc(a,n),a.subtreeFlags=0,n=o,o=a.child;o!==null;)Ty(o,n),o=o.sibling;return Y(qt,qt.current&1|2),st&&gr(a,c.treeForkCount),a.child}n=n.sibling}c.tail!==null&&ce()>tu&&(a.flags|=128,f=!0,nl(c,!1),a.lanes=4194304)}else{if(!f)if(n=Kc(m),n!==null){if(a.flags|=128,f=!0,n=n.updateQueue,a.updateQueue=n,Yc(a,n),nl(c,!0),c.tail===null&&c.tailMode==="hidden"&&!m.alternate&&!st)return At(a),null}else 2*ce()-c.renderingStartTime>tu&&o!==536870912&&(a.flags|=128,f=!0,nl(c,!1),a.lanes=4194304);c.isBackwards?(m.sibling=a.child,a.child=m):(n=c.last,n!==null?n.sibling=m:a.child=m,c.last=m)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=ce(),n.sibling=null,o=qt.current,Y(qt,f?o&1|2:o&1),st&&gr(a,c.treeForkCount),n):(At(a),null);case 22:case 23:return ea(a),eh(),c=a.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(a.flags|=8192):c&&(a.flags|=8192),c?(o&536870912)!==0&&(a.flags&128)===0&&(At(a),a.subtreeFlags&6&&(a.flags|=8192)):At(a),o=a.updateQueue,o!==null&&Yc(a,o.retryQueue),o=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(o=n.memoizedState.cachePool.pool),c=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(c=a.memoizedState.cachePool.pool),c!==o&&(a.flags|=2048),n!==null&&G(ki),null;case 24:return o=null,n!==null&&(o=n.memoizedState.cache),a.memoizedState.cache!==o&&(a.flags|=2048),vr(Vt),At(a),null;case 25:return null;case 30:return null}throw Error(i(156,a.tag))}function Kj(n,a){switch(Lf(a),a.tag){case 1:return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 3:return vr(Vt),Oe(),n=a.flags,(n&65536)!==0&&(n&128)===0?(a.flags=n&-65537|128,a):null;case 26:case 27:case 5:return Ye(a),null;case 31:if(a.memoizedState!==null){if(ea(a),a.alternate===null)throw Error(i(340));Di()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 13:if(ea(a),n=a.memoizedState,n!==null&&n.dehydrated!==null){if(a.alternate===null)throw Error(i(340));Di()}return n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 19:return G(qt),null;case 4:return Oe(),null;case 10:return vr(a.type),null;case 22:case 23:return ea(a),eh(),n!==null&&G(ki),n=a.flags,n&65536?(a.flags=n&-65537|128,a):null;case 24:return vr(Vt),null;case 25:return null;default:return null}}function rx(n,a){switch(Lf(a),a.tag){case 3:vr(Vt),Oe();break;case 26:case 27:case 5:Ye(a);break;case 4:Oe();break;case 31:a.memoizedState!==null&&ea(a);break;case 13:ea(a);break;case 19:G(qt);break;case 10:vr(a.type);break;case 22:case 23:ea(a),eh(),n!==null&&G(ki);break;case 24:vr(Vt)}}function al(n,a){try{var o=a.updateQueue,c=o!==null?o.lastEffect:null;if(c!==null){var f=c.next;o=f;do{if((o.tag&n)===n){c=void 0;var m=o.create,b=o.inst;c=m(),b.destroy=c}o=o.next}while(o!==f)}}catch(_){vt(a,a.return,_)}}function Qr(n,a,o){try{var c=a.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var m=f.next;c=m;do{if((c.tag&n)===n){var b=c.inst,_=b.destroy;if(_!==void 0){b.destroy=void 0,f=a;var M=o,F=_;try{F()}catch(J){vt(f,M,J)}}}c=c.next}while(c!==m)}}catch(J){vt(a,a.return,J)}}function ix(n){var a=n.updateQueue;if(a!==null){var o=n.stateNode;try{Zy(a,o)}catch(c){vt(n,n.return,c)}}}function ox(n,a,o){o.props=Ui(n.type,n.memoizedProps),o.state=n.memoizedState;try{o.componentWillUnmount()}catch(c){vt(n,a,c)}}function rl(n,a){try{var o=n.ref;if(o!==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 o=="function"?n.refCleanup=o(c):o.current=c}}catch(f){vt(n,a,f)}}function Wa(n,a){var o=n.ref,c=n.refCleanup;if(o!==null)if(typeof c=="function")try{c()}catch(f){vt(n,a,f)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(f){vt(n,a,f)}else o.current=null}function sx(n){var a=n.type,o=n.memoizedProps,c=n.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":o.autoFocus&&c.focus();break e;case"img":o.src?c.src=o.src:o.srcSet&&(c.srcset=o.srcSet)}}catch(f){vt(n,n.return,f)}}function Dh(n,a,o){try{var c=n.stateNode;iR(c,n.type,o,a),c[Ln]=a}catch(f){vt(n,n.return,f)}}function lx(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&ri(n.type)||n.tag===4}function Mh(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||lx(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&&ri(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 zh(n,a,o){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(n,a):(a=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,a.appendChild(n),o=o._reactRootContainer,o!=null||a.onclick!==null||(a.onclick=hr));else if(c!==4&&(c===27&&ri(n.type)&&(o=n.stateNode,a=null),n=n.child,n!==null))for(zh(n,a,o),n=n.sibling;n!==null;)zh(n,a,o),n=n.sibling}function Qc(n,a,o){var c=n.tag;if(c===5||c===6)n=n.stateNode,a?o.insertBefore(n,a):o.appendChild(n);else if(c!==4&&(c===27&&ri(n.type)&&(o=n.stateNode),n=n.child,n!==null))for(Qc(n,a,o),n=n.sibling;n!==null;)Qc(n,a,o),n=n.sibling}function cx(n){var a=n.stateNode,o=n.memoizedProps;try{for(var c=n.type,f=a.attributes;f.length;)a.removeAttributeNode(f[0]);xn(a,c,o),a[pn]=n,a[Ln]=o}catch(m){vt(n,n.return,m)}}var _r=!1,Gt=!1,kh=!1,ux=typeof WeakSet=="function"?WeakSet:Set,un=null;function Ij(n,a){if(n=n.containerInfo,nm=vu,n=Sy(n),Of(n)){if("selectionStart"in n)var o={start:n.selectionStart,end:n.selectionEnd};else e:{o=(o=n.ownerDocument)&&o.defaultView||window;var c=o.getSelection&&o.getSelection();if(c&&c.rangeCount!==0){o=c.anchorNode;var f=c.anchorOffset,m=c.focusNode;c=c.focusOffset;try{o.nodeType,m.nodeType}catch{o=null;break e}var b=0,_=-1,M=-1,F=0,J=0,ne=n,H=null;t:for(;;){for(var X;ne!==o||f!==0&&ne.nodeType!==3||(_=b+f),ne!==m||c!==0&&ne.nodeType!==3||(M=b+c),ne.nodeType===3&&(b+=ne.nodeValue.length),(X=ne.firstChild)!==null;)H=ne,ne=X;for(;;){if(ne===n)break t;if(H===o&&++F===f&&(_=b),H===m&&++J===c&&(M=b),(X=ne.nextSibling)!==null)break;ne=H,H=ne.parentNode}ne=X}o=_===-1||M===-1?null:{start:_,end:M}}else o=null}o=o||{start:0,end:0}}else o=null;for(am={focusedElem:n,selectionRange:o},vu=!1,un=a;un!==null;)if(a=un,n=a.child,(a.subtreeFlags&1028)!==0&&n!==null)n.return=a,un=n;else for(;un!==null;){switch(a=un,m=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(o=0;o title"))),xn(m,c,o),m[pn]=n,cn(m),c=m;break e;case"link":var b=gb("link","href",f).get(c+(o.href||""));if(b){for(var _=0;_St&&(b=St,St=Le,Le=b);var K=by(_,Le),k=by(_,St);if(K&&k&&(X.rangeCount!==1||X.anchorNode!==K.node||X.anchorOffset!==K.offset||X.focusNode!==k.node||X.focusOffset!==k.offset)){var q=ne.createRange();q.setStart(K.node,K.offset),X.removeAllRanges(),Le>St?(X.addRange(q),X.extend(k.node,k.offset)):(q.setEnd(k.node,k.offset),X.addRange(q))}}}}for(ne=[],X=_;X=X.parentNode;)X.nodeType===1&&ne.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof _.focus=="function"&&_.focus(),_=0;_o?32:o,R.T=null,o=Fh,Fh=null;var m=ti,b=Or;if(en=0,$o=ti=null,Or=0,(gt&6)!==0)throw Error(i(331));var _=gt;if(gt|=4,wx(m.current),vx(m,m.current,b,o),gt=_,ul(0,!1),Jt&&typeof Jt.onPostCommitFiberRoot=="function")try{Jt.onPostCommitFiberRoot(Na,m)}catch{}return!0}finally{P.p=f,R.T=c,Lx(n,a)}}function qx(n,a,o){a=ga(o,a),a=wh(n.stateNode,a,2),n=Xr(n,a,2),n!==null&&(kt(n,2),er(n))}function vt(n,a,o){if(n.tag===3)qx(n,n,o);else for(;a!==null;){if(a.tag===3){qx(a,n,o);break}else if(a.tag===1){var c=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(ei===null||!ei.has(c))){n=ga(o,n),o=Fv(2),c=Xr(a,o,2),c!==null&&($v(o,c,a,n),kt(c,2),er(c));break}}a=a.return}}function Bh(n,a,o){var c=n.pingCache;if(c===null){c=n.pingCache=new qj;var f=new Set;c.set(a,f)}else f=c.get(a),f===void 0&&(f=new Set,c.set(a,f));f.has(o)||(Ih=!0,f.add(o),n=Bj.bind(null,n,a,o),a.then(n,n))}function Bj(n,a,o){var c=n.pingCache;c!==null&&c.delete(a),n.pingedLanes|=n.suspendedLanes&o,n.warmLanes&=~o,_t===n&&(it&o)===o&&(Lt===4||Lt===3&&(it&62914560)===it&&300>ce()-eu?(gt&2)===0&&Vo(n,0):Lh|=o,Fo===it&&(Fo=0)),er(n)}function Fx(n,a){a===0&&(a=Rn()),n=Ai(n,a),n!==null&&(kt(n,a),er(n))}function Gj(n){var a=n.memoizedState,o=0;a!==null&&(o=a.retryLane),Fx(n,o)}function Xj(n,a){var o=0;switch(n.tag){case 31:case 13:var c=n.stateNode,f=n.memoizedState;f!==null&&(o=f.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),Fx(n,o)}function Zj(n,a){return z(n,a)}var su=null,Bo=null,Gh=!1,lu=!1,Xh=!1,ai=0;function er(n){n!==Bo&&n.next===null&&(Bo===null?su=Bo=n:Bo=Bo.next=n),lu=!0,Gh||(Gh=!0,Qj())}function ul(n,a){if(!Xh&&lu){Xh=!0;do for(var o=!1,c=su;c!==null;){if(n!==0){var f=c.pendingLanes;if(f===0)var m=0;else{var b=c.suspendedLanes,_=c.pingedLanes;m=(1<<31-Wt(42|n)+1)-1,m&=f&~(b&~_),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(o=!0,Bx(c,m))}else m=it,m=Ge(c,c===_t?m:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(m&3)===0||Tt(c,m)||(o=!0,Bx(c,m));c=c.next}while(o);Xh=!1}}function Yj(){$x()}function $x(){lu=Gh=!1;var n=0;ai!==0&&sR()&&(n=ai);for(var a=ce(),o=null,c=su;c!==null;){var f=c.next,m=Vx(c,a);m===0?(c.next=null,o===null?su=f:o.next=f,f===null&&(Bo=o)):(o=c,(n!==0||(m&3)!==0)&&(lu=!0)),c=f}en!==0&&en!==5||ul(n),ai!==0&&(ai=0)}function Vx(n,a){for(var o=n.suspendedLanes,c=n.pingedLanes,f=n.expirationTimes,m=n.pendingLanes&-62914561;0_)break;var J=M.transferSize,ne=M.initiatorType;J&&eb(ne)&&(M=M.responseEnd,b+=J*(M<_?1:(_-F)/(M-F)))}if(--c,a+=8*(m+b)/(f.duration/1e3),n++,10"u"?null:document;function fb(n,a,o){var c=Go;if(c&&typeof a=="string"&&a){var f=ma(a);f='link[rel="'+n+'"][href="'+f+'"]',typeof o=="string"&&(f+='[crossorigin="'+o+'"]'),db.has(f)||(db.add(f),n={rel:n,crossOrigin:o,href:a},c.querySelector(f)===null&&(a=c.createElement("link"),xn(a,"link",n),cn(a),c.head.appendChild(a)))}}function gR(n){Nr.D(n),fb("dns-prefetch",n,null)}function yR(n,a){Nr.C(n,a),fb("preconnect",n,a)}function vR(n,a,o){Nr.L(n,a,o);var c=Go;if(c&&n&&a){var f='link[rel="preload"][as="'+ma(a)+'"]';a==="image"&&o&&o.imageSrcSet?(f+='[imagesrcset="'+ma(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(f+='[imagesizes="'+ma(o.imageSizes)+'"]')):f+='[href="'+ma(n)+'"]';var m=f;switch(a){case"style":m=Xo(n);break;case"script":m=Zo(n)}Sa.has(m)||(n=v({rel:"preload",href:a==="image"&&o&&o.imageSrcSet?void 0:n,as:a},o),Sa.set(m,n),c.querySelector(f)!==null||a==="style"&&c.querySelector(ml(m))||a==="script"&&c.querySelector(pl(m))||(a=c.createElement("link"),xn(a,"link",n),cn(a),c.head.appendChild(a)))}}function xR(n,a){Nr.m(n,a);var o=Go;if(o&&n){var c=a&&typeof a.as=="string"?a.as:"script",f='link[rel="modulepreload"][as="'+ma(c)+'"][href="'+ma(n)+'"]',m=f;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=Zo(n)}if(!Sa.has(m)&&(n=v({rel:"modulepreload",href:n},a),Sa.set(m,n),o.querySelector(f)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(pl(m)))return}c=o.createElement("link"),xn(c,"link",n),cn(c),o.head.appendChild(c)}}}function bR(n,a,o){Nr.S(n,a,o);var c=Go;if(c&&n){var f=go(c).hoistableStyles,m=Xo(n);a=a||"default";var b=f.get(m);if(!b){var _={loading:0,preload:null};if(b=c.querySelector(ml(m)))_.loading=5;else{n=v({rel:"stylesheet",href:n,"data-precedence":a},o),(o=Sa.get(m))&&um(n,o);var M=b=c.createElement("link");cn(M),xn(M,"link",n),M._p=new Promise(function(F,J){M.onload=F,M.onerror=J}),M.addEventListener("load",function(){_.loading|=1}),M.addEventListener("error",function(){_.loading|=2}),_.loading|=4,hu(b,a,c)}b={type:"stylesheet",instance:b,count:1,state:_},f.set(m,b)}}}function wR(n,a){Nr.X(n,a);var o=Go;if(o&&n){var c=go(o).hoistableScripts,f=Zo(n),m=c.get(f);m||(m=o.querySelector(pl(f)),m||(n=v({src:n,async:!0},a),(a=Sa.get(f))&&dm(n,a),m=o.createElement("script"),cn(m),xn(m,"link",n),o.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},c.set(f,m))}}function SR(n,a){Nr.M(n,a);var o=Go;if(o&&n){var c=go(o).hoistableScripts,f=Zo(n),m=c.get(f);m||(m=o.querySelector(pl(f)),m||(n=v({src:n,async:!0,type:"module"},a),(a=Sa.get(f))&&dm(n,a),m=o.createElement("script"),cn(m),xn(m,"link",n),o.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},c.set(f,m))}}function hb(n,a,o,c){var f=(f=ve.current)?fu(f):null;if(!f)throw Error(i(446));switch(n){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(a=Xo(o.href),o=go(f).hoistableStyles,c=o.get(a),c||(c={type:"style",instance:null,count:0,state:null},o.set(a,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){n=Xo(o.href);var m=go(f).hoistableStyles,b=m.get(n);if(b||(f=f.ownerDocument||f,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(n,b),(m=f.querySelector(ml(n)))&&!m._p&&(b.instance=m,b.state.loading=5),Sa.has(n)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},Sa.set(n,o),m||_R(f,n,o,b.state))),a&&c===null)throw Error(i(528,""));return b}if(a&&c!==null)throw Error(i(529,""));return null;case"script":return a=o.async,o=o.src,typeof o=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=Zo(o),o=go(f).hoistableScripts,c=o.get(a),c||(c={type:"script",instance:null,count:0,state:null},o.set(a,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,n))}}function Xo(n){return'href="'+ma(n)+'"'}function ml(n){return'link[rel="stylesheet"]['+n+"]"}function mb(n){return v({},n,{"data-precedence":n.precedence,precedence:null})}function _R(n,a,o,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}),xn(a,"link",o),cn(a),n.head.appendChild(a))}function Zo(n){return'[src="'+ma(n)+'"]'}function pl(n){return"script[async]"+n}function pb(n,a,o){if(a.count++,a.instance===null)switch(a.type){case"style":var c=n.querySelector('style[data-href~="'+ma(o.href)+'"]');if(c)return a.instance=c,cn(c),c;var f=v({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),cn(c),xn(c,"style",f),hu(c,o.precedence,n),a.instance=c;case"stylesheet":f=Xo(o.href);var m=n.querySelector(ml(f));if(m)return a.state.loading|=4,a.instance=m,cn(m),m;c=mb(o),(f=Sa.get(f))&&um(c,f),m=(n.ownerDocument||n).createElement("link"),cn(m);var b=m;return b._p=new Promise(function(_,M){b.onload=_,b.onerror=M}),xn(m,"link",c),a.state.loading|=4,hu(m,o.precedence,n),a.instance=m;case"script":return m=Zo(o.src),(f=n.querySelector(pl(m)))?(a.instance=f,cn(f),f):(c=o,(f=Sa.get(m))&&(c=v({},o),dm(c,f)),n=n.ownerDocument||n,f=n.createElement("script"),cn(f),xn(f,"link",c),n.head.appendChild(f),a.instance=f);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,hu(c,o.precedence,n));return a.instance}function hu(n,a,o){for(var c=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=c.length?c[c.length-1]:null,m=f,b=0;b title"):null)}function ER(n,a,o){if(o===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;switch(a.rel){case"stylesheet":return n=a.disabled,typeof a.precedence=="string"&&n==null;default:return!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 vb(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function CR(n,a,o,c){if(o.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var f=Xo(c.href),m=a.querySelector(ml(f));if(m){a=m._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(n.count++,n=pu.bind(n),a.then(n,n)),o.state.loading|=4,o.instance=m,cn(m);return}m=a.ownerDocument||a,c=mb(c),(f=Sa.get(f))&&um(c,f),m=m.createElement("link"),cn(m);var b=m;b._p=new Promise(function(_,M){b.onload=_,b.onerror=M}),xn(m,"link",c),o.instance=m}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(o,a),(a=o.state.preload)&&(o.state.loading&3)===0&&(n.count++,o=pu.bind(n),a.addEventListener("load",o),a.addEventListener("error",o))}}var fm=0;function jR(n,a){return n.stylesheets&&n.count===0&&yu(n,n.stylesheets),0fm?50:800)+a);return n.unsuspend=o,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(f)}}:null}function pu(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)yu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var gu=null;function yu(n,a){n.stylesheets=null,n.unsuspend!==null&&(n.count++,gu=new Map,a.forEach(RR,n),gu=null,pu.call(n))}function RR(n,a){if(!(a.state.loading&4)){var o=gu.get(n);if(o)var c=o.get(null);else{o=new Map,gu.set(n,o);for(var f=n.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Sm.exports=mN(),Sm.exports}var gN=pN();const id="autoglue.tokens",rp="autoglue.auth-change";let nr=ip();function ip(){try{const e=localStorage.getItem(id);return e?JSON.parse(e):null}catch{return null}}function yN(e){e?localStorage.setItem(id,JSON.stringify(e)):localStorage.removeItem(id)}function vN(e){window.dispatchEvent(new CustomEvent(rp,{detail:e}))}const wn={get(){return nr},set(e){nr=e,yN(e),vN(e)},reload(){return nr=ip(),nr},isAuthed(){return!!nr?.access_token},getAccessToken(){return nr?.access_token??null},isExpired(e=Math.floor(Date.now()/1e3)){const t=Wb(nr?.access_token);return t!==null?e>=t:!0},willExpireSoon(e=60,t=Math.floor(Date.now()/1e3)){const r=Wb(nr?.access_token);return r!==null?r-t<=e:!0},logout(){wn.set(null)},subscribe(e){const t=i=>e(i.detail??null),r=i=>{i.key===id&&(nr=ip(),e(nr))};return window.addEventListener(rp,t),window.addEventListener("storage",r),()=>{window.removeEventListener(rp,t),window.removeEventListener("storage",r)}}};function Wb(e){if(!e)return null;const t=e.split(".");if(t.length<2)return null;try{const r=JSON.parse(atob(xN(t[1])));return(typeof r?.exp=="number"?r.exp:null)??null}catch{return null}}function xN(e){return e.replace(/-/g,"+").replace(/_/g,"/")+"==".slice((2-e.length*3%4)%4)}const op="autoglue.org";let Nu=localStorage.getItem(op);const La={get(){return Nu},set(e){Nu=e,localStorage.setItem(op,e),window.dispatchEvent(new CustomEvent("autoglue:org-change",{detail:e}))},subscribe(e){const t=i=>e(i.detail??null),r=i=>{i.key===op&&(Nu=i.newValue,e(Nu))};return window.addEventListener("autoglue:org-change",t),window.addEventListener("storage",r),()=>{window.removeEventListener("autoglue:org-change",t),window.removeEventListener("storage",r)}}},bN="/api/v1".replace(/\/+$/,"");class lS{constructor(t={}){this.configuration=t}set config(t){this.configuration=t}get basePath(){return this.configuration.basePath!=null?this.configuration.basePath:bN}get fetchApi(){return this.configuration.fetchApi}get middleware(){return this.configuration.middleware||[]}get queryParamsStringify(){return this.configuration.queryParamsStringify||cS}get username(){return this.configuration.username}get password(){return this.configuration.password}get apiKey(){const t=this.configuration.apiKey;if(t)return typeof t=="function"?t:()=>t}get accessToken(){const t=this.configuration.accessToken;if(t)return typeof t=="function"?t:async()=>t}get headers(){return this.configuration.headers}get credentials(){return this.configuration.credentials}}const wN=new lS;class fa{constructor(t=wN){this.configuration=t,this.middleware=t.middleware}static jsonRegex=new RegExp("^(:?application/json|[^;/ ]+/[^;/ ]+[+]json)[ ]*(:?;.*)?$","i");middleware;withMiddleware(...t){const r=this.clone();return r.middleware=r.middleware.concat(...t),r}withPreMiddleware(...t){const r=t.map(i=>({pre:i}));return this.withMiddleware(...r)}withPostMiddleware(...t){const r=t.map(i=>({post:i}));return this.withMiddleware(...r)}isJsonMime(t){return t?fa.jsonRegex.test(t):!1}async request(t,r){const{url:i,init:s}=await this.createFetchParams(t,r),u=await this.fetchApi(i,s);if(u&&u.status>=200&&u.status<300)return u;throw new EN(u,"Response returned an error code")}async createFetchParams(t,r){let i=this.configuration.basePath+t.path;t.query!==void 0&&Object.keys(t.query).length!==0&&(i+="?"+this.configuration.queryParamsStringify(t.query));const s=Object.assign({},this.configuration.headers,t.headers);Object.keys(s).forEach(x=>s[x]===void 0?delete s[x]:{});const u=typeof r=="function"?r:async()=>r,d={method:t.method,headers:s,body:t.body,credentials:this.configuration.credentials},h={...d,...await u({init:d,context:t})};let g;_N(h.body)||h.body instanceof URLSearchParams||SN(h.body)?g=h.body:this.isJsonMime(s["Content-Type"])?g=JSON.stringify(h.body):g=h.body;const y={...h,body:g};return{url:i,init:y}}fetchApi=async(t,r)=>{let i={url:t,init:r};for(const u of this.middleware)u.pre&&(i=await u.pre({fetch:this.fetchApi,...i})||i);let s;try{s=await(this.configuration.fetchApi||fetch)(i.url,i.init)}catch(u){for(const d of this.middleware)d.onError&&(s=await d.onError({fetch:this.fetchApi,url:i.url,init:i.init,error:u,response:s?s.clone():void 0})||s);if(s===void 0)throw u instanceof Error?new CN(u,"The request failed and the interceptors did not return an alternative response"):u}for(const u of this.middleware)u.post&&(s=await u.post({fetch:this.fetchApi,url:i.url,init:i.init,response:s.clone()})||s);return s};clone(){const t=this.constructor,r=new t(this.configuration);return r.middleware=this.middleware.slice(),r}}function SN(e){return typeof Blob<"u"&&e instanceof Blob}function _N(e){return typeof FormData<"u"&&e instanceof FormData}class EN extends Error{constructor(t,r){super(r),this.response=t}name="ResponseError"}class CN extends Error{constructor(t,r){super(r),this.cause=t}name="FetchError"}class Se extends Error{constructor(t,r){super(r),this.field=t}name="RequiredError"}function cS(e,t=""){return Object.keys(e).map(r=>uS(r,e[r],t)).filter(r=>r.length>0).join("&")}function uS(e,t,r=""){const i=r+(r.length?`[${e}]`:e);if(t instanceof Array){const s=t.map(u=>encodeURIComponent(String(u))).join(`&${encodeURIComponent(i)}=`);return`${encodeURIComponent(i)}=${s}`}if(t instanceof Set){const s=Array.from(t);return uS(e,s,r)}return t instanceof Date?`${encodeURIComponent(i)}=${encodeURIComponent(t.toISOString())}`:t instanceof Object?cS(t,i):`${encodeURIComponent(i)}=${encodeURIComponent(String(t))}`}class Te{constructor(t,r=i=>i){this.raw=t,this.transformer=r}async value(){return this.transformer(await this.raw.json())}}class Fl{constructor(t){this.raw=t}async value(){}}class Tn{constructor(t){this.raw=t}async value(){return await this.raw.text()}}function os(e){return jN(e)}function jN(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,id:e.id==null?void 0:e.id,key:e.key==null?void 0:e.key,organization_id:e.organization_id==null?void 0:e.organization_id,updated_at:e.updated_at==null?void 0:e.updated_at,value:e.value==null?void 0:e.value}}function RN(e){return ON(e,!1)}function ON(e,t=!1){return e==null?e:{annotation_ids:e.annotation_ids}}function NN(e){return AN(e,!1)}function AN(e,t=!1){return e==null?e:{label_ids:e.label_ids}}function TN(e){return DN(e,!1)}function DN(e,t=!1){return e==null?e:{server_ids:e.server_ids}}function MN(e){return zN(e,!1)}function zN(e,t=!1){return e==null?e:{taint_ids:e.taint_ids}}function kN(e){return PN(e)}function PN(e,t){return e==null?e:{auth_url:e.auth_url==null?void 0:e.auth_url}}function KN(e){return IN(e,!1)}function IN(e,t=!1){return e==null?e:{key:e.key,value:e.value}}function LN(e){return UN(e,!1)}function UN(e,t=!1){return e==null?e:{key:e.key,value:e.value}}function qN(e){return FN(e,!1)}function FN(e,t=!1){return e==null?e:{name:e.name,role:e.role}}function $N(e){return VN(e,!1)}function VN(e,t=!1){return e==null?e:{bits:e.bits,comment:e.comment,name:e.name,type:e.type}}function HN(e){return BN(e,!1)}function BN(e,t=!1){return e==null?e:{hostname:e.hostname,private_ip_address:e.private_ip_address,public_ip_address:e.public_ip_address,role:e.role,ssh_key_id:e.ssh_key_id,ssh_user:e.ssh_user,status:e.status}}function GN(e){return XN(e,!1)}function XN(e,t=!1){return e==null?e:{effect:e.effect,key:e.key,value:e.value}}function ZN(e){return YN(e)}function YN(e,t){return e==null?e:{alg:e.alg==null?void 0:e.alg,e:e.e==null?void 0:e.e,kid:e.kid==null?void 0:e.kid,kty:e.kty==null?void 0:e.kty,n:e.n==null?void 0:e.n,use:e.use==null?void 0:e.use,x:e.x==null?void 0:e.x}}function QN(e){return JN(e)}function JN(e,t){return e==null?e:{keys:e.keys==null?void 0:e.keys.map(ZN)}}function WN(e){return eA(e)}function eA(e,t){return e}function Qu(e){return tA(e)}function tA(e,t){return e==null?e:{attempts:e.attempts==null?void 0:e.attempts,created_at:e.created_at==null?void 0:e.created_at,id:e.id==null?void 0:e.id,last_error:e.last_error==null?void 0:e.last_error,max_attempts:e.max_attempts==null?void 0:e.max_attempts,payload:e.payload==null?void 0:e.payload,queue:e.queue==null?void 0:e.queue,run_at:e.run_at==null?void 0:e.run_at,status:e.status==null?void 0:WN(e.status),type:e.type==null?void 0:e.type,updated_at:e.updated_at==null?void 0:e.updated_at}}function ss(e){return nA(e)}function nA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,id:e.id==null?void 0:e.id,key:e.key==null?void 0:e.key,organization_id:e.organization_id==null?void 0:e.organization_id,updated_at:e.updated_at==null?void 0:e.updated_at,value:e.value==null?void 0:e.value}}function aA(e){return rA(e,!1)}function rA(e,t=!1){return e==null?e:{refresh_token:e.refresh_token}}function ls(e){return iA(e)}function iA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,effect:e.effect==null?void 0:e.effect,id:e.id==null?void 0:e.id,key:e.key==null?void 0:e.key,organization_id:e.organization_id==null?void 0:e.organization_id,updated_at:e.updated_at==null?void 0:e.updated_at,value:e.value==null?void 0:e.value}}function cs(e){return oA(e)}function oA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,hostname:e.hostname==null?void 0:e.hostname,id:e.id==null?void 0:e.id,organization_id:e.organization_id==null?void 0:e.organization_id,private_ip_address:e.private_ip_address==null?void 0:e.private_ip_address,public_ip_address:e.public_ip_address==null?void 0:e.public_ip_address,role:e.role==null?void 0:e.role,ssh_key_id:e.ssh_key_id==null?void 0:e.ssh_key_id,ssh_user:e.ssh_user==null?void 0:e.ssh_user,status:e.status==null?void 0:e.status,updated_at:e.updated_at==null?void 0:e.updated_at}}function Au(e){return sA(e)}function sA(e,t){return e==null?e:{annotations:e.annotations==null?void 0:e.annotations.map(os),created_at:e.created_at==null?void 0:e.created_at,id:e.id==null?void 0:e.id,labels:e.labels==null?void 0:e.labels.map(ss),name:e.name==null?void 0:e.name,organization_id:e.organization_id==null?void 0:e.organization_id,role:e.role==null?void 0:e.role,servers:e.servers==null?void 0:e.servers.map(cs),taints:e.taints==null?void 0:e.taints.map(ls),updated_at:e.updated_at==null?void 0:e.updated_at}}function lA(e){return cA(e)}function cA(e,t){return e==null?e:{items:e.items==null?void 0:e.items.map(Qu),page:e.page==null?void 0:e.page,page_size:e.page_size==null?void 0:e.page_size,total:e.total==null?void 0:e.total}}function uA(e){return dA(e)}function dA(e,t){return e==null?e:{failed:e.failed==null?void 0:e.failed,name:e.name==null?void 0:e.name,pending:e.pending==null?void 0:e.pending,running:e.running==null?void 0:e.running,scheduled:e.scheduled==null?void 0:e.scheduled}}function fA(e){return hA(e,!1)}function hA(e,t=!1){return e==null?e:{refresh_token:e.refresh_token}}function ew(e){return mA(e)}function mA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,fingerprint:e.fingerprint==null?void 0:e.fingerprint,id:e.id==null?void 0:e.id,name:e.name==null?void 0:e.name,organization_id:e.organization_id==null?void 0:e.organization_id,public_key:e.public_key==null?void 0:e.public_key,updated_at:e.updated_at==null?void 0:e.updated_at}}function pA(e){return gA(e)}function gA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,fingerprint:e.fingerprint==null?void 0:e.fingerprint,id:e.id==null?void 0:e.id,name:e.name==null?void 0:e.name,organization_id:e.organization_id==null?void 0:e.organization_id,private_key:e.private_key==null?void 0:e.private_key,public_key:e.public_key==null?void 0:e.public_key,updated_at:e.updated_at==null?void 0:e.updated_at}}function tw(e){return yA(e)}function yA(e,t){return e==null?e:{access_token:e.access_token==null?void 0:e.access_token,expires_in:e.expires_in==null?void 0:e.expires_in,refresh_token:e.refresh_token==null?void 0:e.refresh_token,token_type:e.token_type==null?void 0:e.token_type}}function vA(e){return xA(e,!1)}function xA(e,t=!1){return e==null?e:{key:e.key,value:e.value}}function bA(e){return wA(e,!1)}function wA(e,t=!1){return e==null?e:{key:e.key,value:e.value}}function SA(e){return _A(e,!1)}function _A(e,t=!1){return e==null?e:{name:e.name,role:e.role}}function EA(e){return CA(e,!1)}function CA(e,t=!1){return e==null?e:{hostname:e.hostname,private_ip_address:e.private_ip_address,public_ip_address:e.public_ip_address,role:e.role,ssh_key_id:e.ssh_key_id,ssh_user:e.ssh_user,status:e.status}}function jA(e){return RA(e,!1)}function RA(e,t=!1){return e==null?e:{effect:e.effect,key:e.key,value:e.value}}function OA(e){return NA(e,!1)}function NA(e,t=!1){return e==null?e:{expires_in_hours:e.expires_in_hours,name:e.name}}function dS(e){return AA(e)}function AA(e,t){return e==null?e:{avatar_url:e.avatar_url==null?void 0:e.avatar_url,created_at:e.created_at==null?void 0:new Date(e.created_at),display_name:e.display_name==null?void 0:e.display_name,id:e.id==null?void 0:e.id,is_admin:e.is_admin==null?void 0:e.is_admin,is_disabled:e.is_disabled==null?void 0:e.is_disabled,primary_email:e.primary_email==null?void 0:e.primary_email,updated_at:e.updated_at==null?void 0:new Date(e.updated_at)}}function TA(e){return DA(e)}function DA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:new Date(e.created_at),email:e.email==null?void 0:e.email,id:e.id==null?void 0:e.id,is_primary:e.is_primary==null?void 0:e.is_primary,is_verified:e.is_verified==null?void 0:e.is_verified,updated_at:e.updated_at==null?void 0:new Date(e.updated_at),user:e.user==null?void 0:dS(e.user),user_id:e.user_id==null?void 0:e.user_id}}function zl(e){return MA(e)}function MA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:new Date(e.created_at),domain:e.domain==null?void 0:e.domain,id:e.id==null?void 0:e.id,name:e.name==null?void 0:e.name,updated_at:e.updated_at==null?void 0:new Date(e.updated_at)}}function zA(e){return kA(e)}function kA(e,t){return e==null?e:{avatar_url:e.avatar_url==null?void 0:e.avatar_url,created_at:e.created_at==null?void 0:new Date(e.created_at),display_name:e.display_name==null?void 0:e.display_name,emails:e.emails==null?void 0:e.emails.map(TA),id:e.id==null?void 0:e.id,is_admin:e.is_admin==null?void 0:e.is_admin,is_disabled:e.is_disabled==null?void 0:e.is_disabled,organizations:e.organizations==null?void 0:e.organizations.map(zl),primary_email:e.primary_email==null?void 0:e.primary_email,updated_at:e.updated_at==null?void 0:new Date(e.updated_at)}}function nw(e){return PA(e)}function PA(e,t){return e==null?e:{email:e.email==null?void 0:e.email,role:e.role==null?void 0:e.role,user_id:e.user_id==null?void 0:e.user_id}}function KA(e){return IA(e,!1)}function IA(e,t=!1){return e==null?e:{role:e.role,user_id:e.user_id}}function LA(e){return UA(e,!1)}function UA(e,t=!1){return e==null?e:{domain:e.domain,name:e.name}}function qA(e){return FA(e,!1)}function FA(e,t=!1){return e==null?e:{expires_in_hours:e.expires_in_hours,name:e.name}}function $A(e){return VA(e)}function VA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,expires_at:e.expires_at==null?void 0:e.expires_at,id:e.id==null?void 0:e.id,name:e.name==null?void 0:e.name,org_key:e.org_key==null?void 0:e.org_key,org_secret:e.org_secret==null?void 0:e.org_secret,scope:e.scope==null?void 0:e.scope}}function HA(e){return BA(e,!1)}function BA(e,t=!1){return e==null?e:{domain:e.domain,name:e.name}}function GA(e){return XA(e,!1)}function XA(e,t=!1){return e==null?e:{display_name:e.display_name}}function aw(e){return ZA(e)}function ZA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:e.created_at,expires_at:e.expires_at==null?void 0:e.expires_at,id:e.id==null?void 0:e.id,last_used_at:e.last_used_at==null?void 0:e.last_used_at,name:e.name==null?void 0:e.name,plain:e.plain==null?void 0:e.plain,scope:e.scope==null?void 0:e.scope}}function YA(e){return QA(e)}function QA(e,t){return e==null?e:{created_at:e.created_at==null?void 0:new Date(e.created_at),expires_at:e.expires_at==null?void 0:new Date(e.expires_at),id:e.id==null?void 0:e.id,last_used_at:e.last_used_at==null?void 0:new Date(e.last_used_at),name:e.name==null?void 0:e.name,org_id:e.org_id==null?void 0:e.org_id,prefix:e.prefix==null?void 0:e.prefix,revoked:e.revoked==null?void 0:e.revoked,scope:e.scope==null?void 0:e.scope,updated_at:e.updated_at==null?void 0:new Date(e.updated_at),user_id:e.user_id==null?void 0:e.user_id}}class JA extends fa{async createAnnotationRaw(t,r){if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling createAnnotation().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/annotations",method:"POST",headers:s,query:i,body:KN(t.body)},r);return new Te(d,h=>os(h))}async createAnnotation(t,r){return await(await this.createAnnotationRaw(t,r)).value()}async deleteAnnotationRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling deleteAnnotation().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/annotations/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async deleteAnnotation(t,r){return await(await this.deleteAnnotationRaw(t,r)).value()}async getAnnotationRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling getAnnotation().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/annotations/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>os(h))}async getAnnotation(t,r){return await(await this.getAnnotationRaw(t,r)).value()}async listAnnotationsRaw(t,r){const i={};t.key!=null&&(i.key=t.key),t.value!=null&&(i.value=t.value),t.q!=null&&(i.q=t.q);const s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/annotations",method:"GET",headers:s,query:i},r);return new Te(d,h=>h.map(os))}async listAnnotations(t={},r){return await(await this.listAnnotationsRaw(t,r)).value()}async updateAnnotationRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling updateAnnotation().');if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling updateAnnotation().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/annotations/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:s,query:i,body:vA(t.body)},r);return new Te(d,h=>os(h))}async updateAnnotation(t,r){return await(await this.updateAnnotationRaw(t,r)).value()}}class WA extends fa{async adminCancelArcherJobRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling adminCancelArcherJob().');const i={},s={};this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/admin/archer/jobs/{id}/cancel";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:s,query:i},r);return new Te(d,h=>Qu(h))}async adminCancelArcherJob(t,r){return await(await this.adminCancelArcherJobRaw(t,r)).value()}async adminEnqueueArcherJobRaw(t,r){if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling adminEnqueueArcherJob().');const i={},s={};s["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/admin/archer/jobs",method:"POST",headers:s,query:i,body:t.body},r);return new Te(d,h=>Qu(h))}async adminEnqueueArcherJob(t,r){return await(await this.adminEnqueueArcherJobRaw(t,r)).value()}async adminListArcherJobsRaw(t,r){const i={};t.status!=null&&(i.status=t.status),t.queue!=null&&(i.queue=t.queue),t.q!=null&&(i.q=t.q),t.page!=null&&(i.page=t.page),t.pageSize!=null&&(i.page_size=t.pageSize);const s={};this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/admin/archer/jobs",method:"GET",headers:s,query:i},r);return new Te(d,h=>lA(h))}async adminListArcherJobs(t={},r){return await(await this.adminListArcherJobsRaw(t,r)).value()}async adminListArcherQueuesRaw(t){const r={},i={};this.configuration&&this.configuration.apiKey&&(i.Authorization=await this.configuration.apiKey("Authorization"));const u=await this.request({path:"/admin/archer/queues",method:"GET",headers:i,query:r},t);return new Te(u,d=>d.map(uA))}async adminListArcherQueues(t){return await(await this.adminListArcherQueuesRaw(t)).value()}async adminRetryArcherJobRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling adminRetryArcherJob().');const i={},s={};this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/admin/archer/jobs/{id}/retry";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:s,query:i},r);return new Te(d,h=>Qu(h))}async adminRetryArcherJob(t,r){return await(await this.adminRetryArcherJobRaw(t,r)).value()}}class eT extends fa{async authCallbackRaw(t,r){if(t.provider==null)throw new Se("provider",'Required parameter "provider" was null or undefined when calling authCallback().');const i={},s={};let u="/auth/{provider}/callback";u=u.replace("{provider}",encodeURIComponent(String(t.provider)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>tw(h))}async authCallback(t,r){return await(await this.authCallbackRaw(t,r)).value()}async authStartRaw(t,r){if(t.provider==null)throw new Se("provider",'Required parameter "provider" was null or undefined when calling authStart().');const i={},s={};let u="/auth/{provider}/start";u=u.replace("{provider}",encodeURIComponent(String(t.provider)));const d=await this.request({path:u,method:"POST",headers:s,query:i},r);return new Te(d,h=>kN(h))}async authStart(t,r){return await(await this.authStartRaw(t,r)).value()}async getJWKSRaw(t){const r={},i={},u=await this.request({path:"/.well-known/jwks.json",method:"GET",headers:i,query:r},t);return new Te(u,d=>QN(d))}async getJWKS(t){return await(await this.getJWKSRaw(t)).value()}async logoutRaw(t,r){if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling logout().');const i={},s={};s["Content-Type"]="application/json";const d=await this.request({path:"/auth/logout",method:"POST",headers:s,query:i,body:aA(t.body)},r);return new Fl(d)}async logout(t,r){await this.logoutRaw(t,r)}async refreshRaw(t,r){if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling refresh().');const i={},s={};s["Content-Type"]="application/json";const d=await this.request({path:"/auth/refresh",method:"POST",headers:s,query:i,body:fA(t.body)},r);return new Te(d,h=>tw(h))}async refresh(t,r){return await(await this.refreshRaw(t,r)).value()}}class tT extends fa{async createLabelRaw(t,r){if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling createLabel().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/labels",method:"POST",headers:s,query:i,body:LN(t.body)},r);return new Te(d,h=>ss(h))}async createLabel(t,r){return await(await this.createLabelRaw(t,r)).value()}async deleteLabelRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling deleteLabel().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/labels/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async deleteLabel(t,r){return await(await this.deleteLabelRaw(t,r)).value()}async getLabelRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling getLabel().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/labels/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>ss(h))}async getLabel(t,r){return await(await this.getLabelRaw(t,r)).value()}async listLabelsRaw(t,r){const i={};t.key!=null&&(i.key=t.key),t.value!=null&&(i.value=t.value),t.q!=null&&(i.q=t.q);const s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/labels",method:"GET",headers:s,query:i},r);return new Te(d,h=>h.map(ss))}async listLabels(t={},r){return await(await this.listLabelsRaw(t,r)).value()}async updateLabelRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling updateLabel().');if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling updateLabel().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/labels/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:s,query:i,body:bA(t.body)},r);return new Te(d,h=>ss(h))}async updateLabel(t,r){return await(await this.updateLabelRaw(t,r)).value()}}class nT extends fa{async getMeRaw(t){const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-API-KEY"]=await this.configuration.apiKey("X-API-KEY")),this.configuration&&this.configuration.apiKey&&(i.Authorization=await this.configuration.apiKey("Authorization"));const u=await this.request({path:"/me",method:"GET",headers:i,query:r},t);return new Te(u,d=>zA(d))}async getMe(t){return await(await this.getMeRaw(t)).value()}async updateMeRaw(t,r){if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling updateMe().');const i={},s={};s["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(s["X-API-KEY"]=await this.configuration.apiKey("X-API-KEY")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/me",method:"PATCH",headers:s,query:i,body:GA(t.body)},r);return new Te(d,h=>dS(h))}async updateMe(t,r){return await(await this.updateMeRaw(t,r)).value()}}class aT extends fa{async createUserAPIKeyRaw(t,r){if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling createUserAPIKey().');const i={},s={};s["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(s["X-API-KEY"]=await this.configuration.apiKey("X-API-KEY")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/me/api-keys",method:"POST",headers:s,query:i,body:OA(t.body)},r);return new Te(d,h=>aw(h))}async createUserAPIKey(t,r){return await(await this.createUserAPIKeyRaw(t,r)).value()}async deleteUserAPIKeyRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling deleteUserAPIKey().');const i={},s={};this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/me/api-keys/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return new Fl(d)}async deleteUserAPIKey(t,r){await this.deleteUserAPIKeyRaw(t,r)}async listUserAPIKeysRaw(t){const r={},i={};this.configuration&&this.configuration.apiKey&&(i["X-API-KEY"]=await this.configuration.apiKey("X-API-KEY")),this.configuration&&this.configuration.apiKey&&(i.Authorization=await this.configuration.apiKey("Authorization"));const u=await this.request({path:"/me/api-keys",method:"GET",headers:i,query:r},t);return new Te(u,d=>d.map(aw))}async listUserAPIKeys(t){return await(await this.listUserAPIKeysRaw(t)).value()}}class rT extends fa{async attachNodePoolAnnotationsRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling attachNodePoolAnnotations().');if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling attachNodePoolAnnotations().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/annotations";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:s,query:i,body:RN(t.body)},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async attachNodePoolAnnotations(t,r){return await(await this.attachNodePoolAnnotationsRaw(t,r)).value()}async attachNodePoolLabelsRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling attachNodePoolLabels().');if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling attachNodePoolLabels().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/labels";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:s,query:i,body:NN(t.body)},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async attachNodePoolLabels(t,r){return await(await this.attachNodePoolLabelsRaw(t,r)).value()}async attachNodePoolServersRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling attachNodePoolServers().');if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling attachNodePoolServers().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/servers";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:s,query:i,body:TN(t.body)},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async attachNodePoolServers(t,r){return await(await this.attachNodePoolServersRaw(t,r)).value()}async attachNodePoolTaintsRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling attachNodePoolTaints().');if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling attachNodePoolTaints().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/taints";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:s,query:i,body:MN(t.body)},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async attachNodePoolTaints(t,r){return await(await this.attachNodePoolTaintsRaw(t,r)).value()}async createNodePoolRaw(t,r){if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling createNodePool().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/node-pools",method:"POST",headers:s,query:i,body:qN(t.body)},r);return new Te(d,h=>Au(h))}async createNodePool(t,r){return await(await this.createNodePoolRaw(t,r)).value()}async deleteNodePoolRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling deleteNodePool().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async deleteNodePool(t,r){return await(await this.deleteNodePoolRaw(t,r)).value()}async detachNodePoolAnnotationRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling detachNodePoolAnnotation().');if(t.annotationId==null)throw new Se("annotationId",'Required parameter "annotationId" was null or undefined when calling detachNodePoolAnnotation().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/annotations/{annotationId}";u=u.replace("{id}",encodeURIComponent(String(t.id))),u=u.replace("{annotationId}",encodeURIComponent(String(t.annotationId)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async detachNodePoolAnnotation(t,r){return await(await this.detachNodePoolAnnotationRaw(t,r)).value()}async detachNodePoolLabelRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling detachNodePoolLabel().');if(t.labelId==null)throw new Se("labelId",'Required parameter "labelId" was null or undefined when calling detachNodePoolLabel().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/labels/{labelId}";u=u.replace("{id}",encodeURIComponent(String(t.id))),u=u.replace("{labelId}",encodeURIComponent(String(t.labelId)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async detachNodePoolLabel(t,r){return await(await this.detachNodePoolLabelRaw(t,r)).value()}async detachNodePoolServerRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling detachNodePoolServer().');if(t.serverId==null)throw new Se("serverId",'Required parameter "serverId" was null or undefined when calling detachNodePoolServer().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/servers/{serverId}";u=u.replace("{id}",encodeURIComponent(String(t.id))),u=u.replace("{serverId}",encodeURIComponent(String(t.serverId)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async detachNodePoolServer(t,r){return await(await this.detachNodePoolServerRaw(t,r)).value()}async detachNodePoolTaintRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling detachNodePoolTaint().');if(t.taintId==null)throw new Se("taintId",'Required parameter "taintId" was null or undefined when calling detachNodePoolTaint().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/taints/{taintId}";u=u.replace("{id}",encodeURIComponent(String(t.id))),u=u.replace("{taintId}",encodeURIComponent(String(t.taintId)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async detachNodePoolTaint(t,r){return await(await this.detachNodePoolTaintRaw(t,r)).value()}async getNodePoolRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling getNodePool().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>Au(h))}async getNodePool(t,r){return await(await this.getNodePoolRaw(t,r)).value()}async listNodePoolAnnotationsRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling listNodePoolAnnotations().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/annotations";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>h.map(os))}async listNodePoolAnnotations(t,r){return await(await this.listNodePoolAnnotationsRaw(t,r)).value()}async listNodePoolLabelsRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling listNodePoolLabels().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/labels";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>h.map(ss))}async listNodePoolLabels(t,r){return await(await this.listNodePoolLabelsRaw(t,r)).value()}async listNodePoolServersRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling listNodePoolServers().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/servers";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>h.map(cs))}async listNodePoolServers(t,r){return await(await this.listNodePoolServersRaw(t,r)).value()}async listNodePoolTaintsRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling listNodePoolTaints().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}/taints";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>h.map(ls))}async listNodePoolTaints(t,r){return await(await this.listNodePoolTaintsRaw(t,r)).value()}async listNodePoolsRaw(t,r){const i={};t.q!=null&&(i.q=t.q);const s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/node-pools",method:"GET",headers:s,query:i},r);return new Te(d,h=>h.map(Au))}async listNodePools(t={},r){return await(await this.listNodePoolsRaw(t,r)).value()}async updateNodePoolRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling updateNodePool().');if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling updateNodePool().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/node-pools/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:s,query:i,body:SA(t.body)},r);return new Te(d,h=>Au(h))}async updateNodePool(t,r){return await(await this.updateNodePoolRaw(t,r)).value()}}class iT extends fa{async addOrUpdateMemberRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling addOrUpdateMember().');if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling addOrUpdateMember().');const i={},s={};s["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}/members";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:s,query:i,body:KA(t.body)},r);return new Te(d,h=>nw(h))}async addOrUpdateMember(t,r){return await(await this.addOrUpdateMemberRaw(t,r)).value()}async createOrgRaw(t,r){if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling createOrg().');const i={},s={};s["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/orgs",method:"POST",headers:s,query:i,body:LA(t.body)},r);return new Te(d,h=>zl(h))}async createOrg(t,r){return await(await this.createOrgRaw(t,r)).value()}async createOrgKeyRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling createOrgKey().');if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling createOrgKey().');const i={},s={};s["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}/api-keys";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"POST",headers:s,query:i,body:qA(t.body)},r);return new Te(d,h=>$A(h))}async createOrgKey(t,r){return await(await this.createOrgKeyRaw(t,r)).value()}async deleteOrgRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling deleteOrg().');const i={},s={};this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return new Fl(d)}async deleteOrg(t,r){await this.deleteOrgRaw(t,r)}async deleteOrgKeyRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling deleteOrgKey().');if(t.keyId==null)throw new Se("keyId",'Required parameter "keyId" was null or undefined when calling deleteOrgKey().');const i={},s={};this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}/api-keys/{key_id}";u=u.replace("{id}",encodeURIComponent(String(t.id))),u=u.replace("{key_id}",encodeURIComponent(String(t.keyId)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return new Fl(d)}async deleteOrgKey(t,r){await this.deleteOrgKeyRaw(t,r)}async getOrgRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling getOrg().');const i={},s={};this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>zl(h))}async getOrg(t,r){return await(await this.getOrgRaw(t,r)).value()}async listMembersRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling listMembers().');const i={},s={};this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}/members";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>h.map(nw))}async listMembers(t,r){return await(await this.listMembersRaw(t,r)).value()}async listMyOrgsRaw(t){const r={},i={};this.configuration&&this.configuration.apiKey&&(i.Authorization=await this.configuration.apiKey("Authorization"));const u=await this.request({path:"/orgs",method:"GET",headers:i,query:r},t);return new Te(u,d=>d.map(zl))}async listMyOrgs(t){return await(await this.listMyOrgsRaw(t)).value()}async listOrgKeysRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling listOrgKeys().');const i={},s={};this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}/api-keys";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>h.map(YA))}async listOrgKeys(t,r){return await(await this.listOrgKeysRaw(t,r)).value()}async removeMemberRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling removeMember().');if(t.userId==null)throw new Se("userId",'Required parameter "userId" was null or undefined when calling removeMember().');const i={},s={};this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}/members/{user_id}";u=u.replace("{id}",encodeURIComponent(String(t.id))),u=u.replace("{user_id}",encodeURIComponent(String(t.userId)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return new Fl(d)}async removeMember(t,r){await this.removeMemberRaw(t,r)}async updateOrgRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling updateOrg().');if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling updateOrg().');const i={},s={};s["Content-Type"]="application/json",this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/orgs/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:s,query:i,body:HA(t.body)},r);return new Te(d,h=>zl(h))}async updateOrg(t,r){return await(await this.updateOrgRaw(t,r)).value()}}class oT extends fa{async createServerRaw(t,r){if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling createServer().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/servers",method:"POST",headers:s,query:i,body:HN(t.body)},r);return new Te(d,h=>cs(h))}async createServer(t,r){return await(await this.createServerRaw(t,r)).value()}async deleteServerRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling deleteServer().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/servers/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async deleteServer(t,r){return await(await this.deleteServerRaw(t,r)).value()}async getServerRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling getServer().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/servers/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>cs(h))}async getServer(t,r){return await(await this.getServerRaw(t,r)).value()}async listServersRaw(t,r){const i={};t.status!=null&&(i.status=t.status),t.role!=null&&(i.role=t.role);const s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/servers",method:"GET",headers:s,query:i},r);return new Te(d,h=>h.map(cs))}async listServers(t={},r){return await(await this.listServersRaw(t,r)).value()}async updateServerRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling updateServer().');if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling updateServer().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/servers/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:s,query:i,body:EA(t.body)},r);return new Te(d,h=>cs(h))}async updateServer(t,r){return await(await this.updateServerRaw(t,r)).value()}}class sT extends fa{async createSSHKeyRaw(t,r){if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling createSSHKey().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/ssh",method:"POST",headers:s,query:i,body:$N(t.body)},r);return new Te(d,h=>ew(h))}async createSSHKey(t,r){return await(await this.createSSHKeyRaw(t,r)).value()}async deleteSSHKeyRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling deleteSSHKey().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/ssh/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async deleteSSHKey(t,r){return await(await this.deleteSSHKeyRaw(t,r)).value()}async downloadSSHKeyRaw(t,r){if(t.xOrgID==null)throw new Se("xOrgID",'Required parameter "xOrgID" was null or undefined when calling downloadSSHKey().');if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling downloadSSHKey().');if(t.part==null)throw new Se("part",'Required parameter "part" was null or undefined when calling downloadSSHKey().');const i={};t.part!=null&&(i.part=t.part);const s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/ssh/{id}/download";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async downloadSSHKey(t,r){return await(await this.downloadSSHKeyRaw(t,r)).value()}async getSSHKeyRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling getSSHKey().');const i={};t.reveal!=null&&(i.reveal=t.reveal);const s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/ssh/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>pA(h))}async getSSHKey(t,r){return await(await this.getSSHKeyRaw(t,r)).value()}async listPublicSshKeysRaw(t,r){const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/ssh",method:"GET",headers:s,query:i},r);return new Te(d,h=>h.map(ew))}async listPublicSshKeys(t={},r){return await(await this.listPublicSshKeysRaw(t,r)).value()}}class lT extends fa{async createTaintRaw(t,r){if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling createTaint().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/taints",method:"POST",headers:s,query:i,body:GN(t.body)},r);return new Te(d,h=>ls(h))}async createTaint(t,r){return await(await this.createTaintRaw(t,r)).value()}async deleteTaintRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling deleteTaint().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/taints/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"DELETE",headers:s,query:i},r);return this.isJsonMime(d.headers.get("content-type"))?new Te(d):new Tn(d)}async deleteTaint(t,r){return await(await this.deleteTaintRaw(t,r)).value()}async getTaintRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling getTaint().');const i={},s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/taints/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"GET",headers:s,query:i},r);return new Te(d,h=>ls(h))}async getTaint(t,r){return await(await this.getTaintRaw(t,r)).value()}async listTaintsRaw(t,r){const i={};t.key!=null&&(i.key=t.key),t.value!=null&&(i.value=t.value),t.q!=null&&(i.q=t.q);const s={};t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));const d=await this.request({path:"/taints",method:"GET",headers:s,query:i},r);return new Te(d,h=>h.map(ls))}async listTaints(t={},r){return await(await this.listTaintsRaw(t,r)).value()}async updateTaintRaw(t,r){if(t.id==null)throw new Se("id",'Required parameter "id" was null or undefined when calling updateTaint().');if(t.body==null)throw new Se("body",'Required parameter "body" was null or undefined when calling updateTaint().');const i={},s={};s["Content-Type"]="application/json",t.xOrgID!=null&&(s["X-Org-ID"]=String(t.xOrgID)),this.configuration&&this.configuration.apiKey&&(s["X-ORG-KEY"]=await this.configuration.apiKey("X-ORG-KEY")),this.configuration&&this.configuration.apiKey&&(s["X-ORG-SECRET"]=await this.configuration.apiKey("X-ORG-SECRET")),this.configuration&&this.configuration.apiKey&&(s.Authorization=await this.configuration.apiKey("Authorization"));let u="/taints/{id}";u=u.replace("{id}",encodeURIComponent(String(t.id)));const d=await this.request({path:u,method:"PATCH",headers:s,query:i,body:jA(t.body)},r);return new Te(d,h=>ls(h))}async updateTaint(t,r){return await(await this.updateTaintRaw(t,r)).value()}}const Vp="/api/v1";function cT(){return new lS({basePath:Vp,accessToken:async()=>wn.getAccessToken()??"",middleware:[{async pre(e){const t=new Headers(e.init?.headers??{});e.init?.body!=null&&!(e.init.body instanceof FormData)&&!(e.init.body instanceof Blob)&&!t.has("Content-Type")&&t.set("Content-Type","application/json");const i=wn.getAccessToken();i&&t.set("Authorization",`Bearer ${i}`);const s=La.get();return s&&t.set("X-Org-ID",s),{...e,init:{...e.init,headers:t}}},async post(e){return e.response}}]})}function Ha(e){return new e(cT())}function uT(){return Ha(eT)}function dT(){return Ha(nT)}function fT(){return Ha(aT)}function Rd(){return Ha(iT)}function hT(){return Ha(sT)}function mT(){return Ha(oT)}function pT(){return Ha(lT)}function gT(){return Ha(tT)}function yT(){return Ha(JA)}function vT(){return Ha(WA)}function xT(){return Ha(rT)}let Tu=null;async function bT(){const e=wn.get();if(!e?.refresh_token)return!1;try{const t=await fetch(`${Vp}/auth/refresh`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({refresh_token:e.refresh_token})});if(!t.ok)return!1;const r=await t.json();return wn.set(r),!0}catch{return!1}}async function rw(){return Tu||(Tu=bT().finally(()=>{Tu=null})),Tu}function wT(e){return e?.status===401||e?.cause?.status===401||e?.response?.status===401||e instanceof Response&&e.status===401}async function Pe(e){wn.willExpireSoon?.(30)&&await rw();try{return await e()}catch(t){if(!wT(t)||!await rw())throw t;return await e()}}const iw=dT(),Cm=fT(),Vi={getMe:()=>Pe(async()=>await iw.getMe()),updateMe:e=>Pe(async()=>await iw.updateMe({body:e})),listKeys:()=>Pe(async()=>await Cm.listUserAPIKeys()),createKey:e=>Pe(async()=>await Cm.createUserAPIKey({body:e})),deleteKey:e=>Pe(async()=>(await Cm.deleteUserAPIKey({id:e}),!0))};var fS={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ow=Q.createContext&&Q.createContext(fS),ST=["attr","size","title"];function _T(e,t){if(e==null)return{};var r=ET(e,t),i,s;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(s=0;s=0)&&Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function ET(e,t){if(e==null)return{};var r={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){if(t.indexOf(i)>=0)continue;r[i]=e[i]}return r}function od(){return od=Object.assign?Object.assign.bind():function(e){for(var t=1;tQ.createElement(t.tag,sd({key:r},t.attr),hS(t.child)))}function mS(e){return t=>Q.createElement(OT,od({attr:sd({},e.attr)},t),hS(e.child))}function OT(e){var t=r=>{var{attr:i,size:s,title:u}=e,d=_T(e,ST),h=s||r.size||"1em",g;return r.className&&(g=r.className),e.className&&(g=(g?g+" ":"")+e.className),Q.createElement("svg",od({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,i,d,{className:g,style:sd(sd({color:e.color||r.color},r.style),e.style),height:h,width:h,xmlns:"http://www.w3.org/2000/svg"}),u&&Q.createElement("title",null,u),e.children)};return ow!==void 0?Q.createElement(ow.Consumer,null,r=>t(r)):t(fS)}function NT(e){return mS({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M888 680h-54V540H546v-92h238c8.8 0 16-7.2 16-16V168c0-8.8-7.2-16-16-16H240c-8.8 0-16 7.2-16 16v264c0 8.8 7.2 16 16 16h238v92H190v140h-54c-4.4 0-8 3.6-8 8v176c0 4.4 3.6 8 8 8h176c4.4 0 8-3.6 8-8V688c0-4.4-3.6-8-8-8h-54v-72h220v72h-54c-4.4 0-8 3.6-8 8v176c0 4.4 3.6 8 8 8h176c4.4 0 8-3.6 8-8V688c0-4.4-3.6-8-8-8h-54v-72h220v72h-54c-4.4 0-8 3.6-8 8v176c0 4.4 3.6 8 8 8h176c4.4 0 8-3.6 8-8V688c0-4.4-3.6-8-8-8zM256 805.3c0 1.5-1.2 2.7-2.7 2.7h-58.7c-1.5 0-2.7-1.2-2.7-2.7v-58.7c0-1.5 1.2-2.7 2.7-2.7h58.7c1.5 0 2.7 1.2 2.7 2.7v58.7zm288 0c0 1.5-1.2 2.7-2.7 2.7h-58.7c-1.5 0-2.7-1.2-2.7-2.7v-58.7c0-1.5 1.2-2.7 2.7-2.7h58.7c1.5 0 2.7 1.2 2.7 2.7v58.7zM288 384V216h448v168H288zm544 421.3c0 1.5-1.2 2.7-2.7 2.7h-58.7c-1.5 0-2.7-1.2-2.7-2.7v-58.7c0-1.5 1.2-2.7 2.7-2.7h58.7c1.5 0 2.7 1.2 2.7 2.7v58.7zM360 300a40 40 0 1 0 80 0 40 40 0 1 0-80 0z"},child:[]}]})(e)}function AT(e){return mS({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",strokeWidth:"2",d:"M3,6 L21,6 L3,6 Z M10,2 L10,4 M14,2 L14,4 M16,12 C18.3736719,13.1826446 20,15.6506255 20,19 L20,23 L4,23 L4,19 C4,15.6457258 5.6310898,13.1754259 8,12 M12,16.5 L12,23 M12,13 C15.3137085,13 18,10.3137085 18,7 C18,3.6862915 15.3137085,1 12,1 C8.6862915,1 6,3.6862915 6,7 C6,10.3137085 8.6862915,13 12,13 Z M8,12 C8,14.209139 9.790861,16 12,16 L12,16 C14.209139,16 16,14.209139 16,12"},child:[]}]})(e)}const TT=[{to:"/clusters",label:"Clusters",icon:NT},{to:"/node-pools",label:"Node Pools",icon:qO},{to:"/annotations",label:"Annotations",icon:t2},{to:"/labels",label:"Labels",icon:jd},{to:"/taints",label:"Taints",icon:R2},{to:"/servers",label:"Servers",icon:iS},{to:"/ssh",label:"SSH Keys",icon:c2}],DT=[{to:"/org/members",label:"Members",icon:sS},{to:"/org/api-keys",label:"Org API Keys",icon:h2},{to:"/org/settings",label:"Org Settings",icon:nS}],MT=[{to:"/me",label:"Profile",icon:M2}],zT=[{to:"/admin/users",label:"Users Admin",icon:sS},{to:"/admin/jobs",label:"Jobs Admin",icon:AT}];function pS(e){var t,r,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t{const t=KT(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:d=>{const h=d.split(Hp);return h[0]===""&&h.length!==1&&h.shift(),yS(h,t)||PT(d)},getConflictingClassGroupIds:(d,h)=>{const g=r[d]||[];return h&&i[d]?[...g,...i[d]]:g}}},yS=(e,t)=>{if(e.length===0)return t.classGroupId;const r=e[0],i=t.nextPart.get(r),s=i?yS(e.slice(1),i):void 0;if(s)return s;if(t.validators.length===0)return;const u=e.join(Hp);return t.validators.find(({validator:d})=>d(u))?.classGroupId},lw=/^\[(.+)\]$/,PT=e=>{if(lw.test(e)){const t=lw.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},KT=e=>{const{theme:t,classGroups:r}=e,i={nextPart:new Map,validators:[]};for(const s in r)sp(r[s],i,s,t);return i},sp=(e,t,r,i)=>{e.forEach(s=>{if(typeof s=="string"){const u=s===""?t:cw(t,s);u.classGroupId=r;return}if(typeof s=="function"){if(IT(s)){sp(s(i),t,r,i);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([u,d])=>{sp(d,cw(t,u),r,i)})})},cw=(e,t)=>{let r=e;return t.split(Hp).forEach(i=>{r.nextPart.has(i)||r.nextPart.set(i,{nextPart:new Map,validators:[]}),r=r.nextPart.get(i)}),r},IT=e=>e.isThemeGetter,LT=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,i=new Map;const s=(u,d)=>{r.set(u,d),t++,t>e&&(t=0,i=r,r=new Map)};return{get(u){let d=r.get(u);if(d!==void 0)return d;if((d=i.get(u))!==void 0)return s(u,d),d},set(u,d){r.has(u)?r.set(u,d):s(u,d)}}},lp="!",cp=":",UT=cp.length,qT=e=>{const{prefix:t,experimentalParseClassName:r}=e;let i=s=>{const u=[];let d=0,h=0,g=0,y;for(let j=0;jg?y-g:void 0;return{modifiers:u,hasImportantModifier:w,baseClassName:v,maybePostfixModifierPosition:E}};if(t){const s=t+cp,u=i;i=d=>d.startsWith(s)?u(d.substring(s.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:d,maybePostfixModifierPosition:void 0}}if(r){const s=i;i=u=>r({className:u,parseClassName:s})}return i},FT=e=>e.endsWith(lp)?e.substring(0,e.length-1):e.startsWith(lp)?e.substring(1):e,$T=e=>{const t=Object.fromEntries(e.orderSensitiveModifiers.map(i=>[i,!0]));return i=>{if(i.length<=1)return i;const s=[];let u=[];return i.forEach(d=>{d[0]==="["||t[d]?(s.push(...u.sort(),d),u=[]):u.push(d)}),s.push(...u.sort()),s}},VT=e=>({cache:LT(e.cacheSize),parseClassName:qT(e),sortModifiers:$T(e),...kT(e)}),HT=/\s+/,BT=(e,t)=>{const{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:s,sortModifiers:u}=t,d=[],h=e.trim().split(HT);let g="";for(let y=h.length-1;y>=0;y-=1){const x=h[y],{isExternal:v,modifiers:w,hasImportantModifier:E,baseClassName:j,maybePostfixModifierPosition:S}=r(x);if(v){g=x+(g.length>0?" "+g:g);continue}let N=!!S,D=i(N?j.substring(0,S):j);if(!D){if(!N){g=x+(g.length>0?" "+g:g);continue}if(D=i(j),!D){g=x+(g.length>0?" "+g:g);continue}N=!1}const A=u(w).join(":"),O=E?A+lp:A,C=O+D;if(d.includes(C))continue;d.push(C);const T=s(D,N);for(let U=0;U0?" "+g:g)}return g};function GT(){let e=0,t,r,i="";for(;e{if(typeof e=="string")return e;let t,r="";for(let i=0;iv(x),e());return r=VT(y),i=r.cache.get,s=r.cache.set,u=h,h(g)}function h(g){const y=i(g);if(y)return y;const x=BT(g,r);return s(g,x),x}return function(){return u(GT.apply(null,arguments))}}const tn=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},xS=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,bS=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ZT=/^\d+\/\d+$/,YT=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,QT=/\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$/,JT=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,WT=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,eD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Qo=e=>ZT.test(e),tt=e=>!!e&&!Number.isNaN(Number(e)),ui=e=>!!e&&Number.isInteger(Number(e)),jm=e=>e.endsWith("%")&&tt(e.slice(0,-1)),Ar=e=>YT.test(e),tD=()=>!0,nD=e=>QT.test(e)&&!JT.test(e),wS=()=>!1,aD=e=>WT.test(e),rD=e=>eD.test(e),iD=e=>!Ne(e)&&!Ae(e),oD=e=>ws(e,ES,wS),Ne=e=>xS.test(e),$i=e=>ws(e,CS,nD),Rm=e=>ws(e,dD,tt),uw=e=>ws(e,SS,wS),sD=e=>ws(e,_S,rD),Du=e=>ws(e,jS,aD),Ae=e=>bS.test(e),Sl=e=>Ss(e,CS),lD=e=>Ss(e,fD),dw=e=>Ss(e,SS),cD=e=>Ss(e,ES),uD=e=>Ss(e,_S),Mu=e=>Ss(e,jS,!0),ws=(e,t,r)=>{const i=xS.exec(e);return i?i[1]?t(i[1]):r(i[2]):!1},Ss=(e,t,r=!1)=>{const i=bS.exec(e);return i?i[1]?t(i[1]):r:!1},SS=e=>e==="position"||e==="percentage",_S=e=>e==="image"||e==="url",ES=e=>e==="length"||e==="size"||e==="bg-size",CS=e=>e==="length",dD=e=>e==="number",fD=e=>e==="family-name",jS=e=>e==="shadow",hD=()=>{const e=tn("color"),t=tn("font"),r=tn("text"),i=tn("font-weight"),s=tn("tracking"),u=tn("leading"),d=tn("breakpoint"),h=tn("container"),g=tn("spacing"),y=tn("radius"),x=tn("shadow"),v=tn("inset-shadow"),w=tn("text-shadow"),E=tn("drop-shadow"),j=tn("blur"),S=tn("perspective"),N=tn("aspect"),D=tn("ease"),A=tn("animate"),O=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],T=()=>[...C(),Ae,Ne],U=()=>["auto","hidden","clip","visible","scroll"],L=()=>["auto","contain","none"],V=()=>[Ae,Ne,g],fe=()=>[Qo,"full","auto",...V()],ge=()=>[ui,"none","subgrid",Ae,Ne],pe=()=>["auto",{span:["full",ui,Ae,Ne]},ui,Ae,Ne],ae=()=>[ui,"auto",Ae,Ne],le=()=>["auto","min","max","fr",Ae,Ne],he=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],be=()=>["start","end","center","stretch","center-safe","end-safe"],R=()=>["auto",...V()],P=()=>[Qo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...V()],I=()=>[e,Ae,Ne],ee=()=>[...C(),dw,uw,{position:[Ae,Ne]}],me=()=>["no-repeat",{repeat:["","x","y","space","round"]}],Re=()=>["auto","cover","contain",cD,oD,{size:[Ae,Ne]}],G=()=>[jm,Sl,$i],Y=()=>["","none","full",y,Ae,Ne],ie=()=>["",tt,Sl,$i],oe=()=>["solid","dashed","dotted","double"],ve=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],W=()=>[tt,jm,dw,uw],xe=()=>["","none",j,Ae,Ne],Oe=()=>["none",tt,Ae,Ne],Ue=()=>["none",tt,Ae,Ne],Ye=()=>[tt,Ae,Ne],Ze=()=>[Qo,"full",...V()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Ar],breakpoint:[Ar],color:[tD],container:[Ar],"drop-shadow":[Ar],ease:["in","out","in-out"],font:[iD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Ar],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Ar],shadow:[Ar],spacing:["px",tt],text:[Ar],"text-shadow":[Ar],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Qo,Ne,Ae,N]}],container:["container"],columns:[{columns:[tt,Ne,Ae,h]}],"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:T()}],overflow:[{overflow:U()}],"overflow-x":[{"overflow-x":U()}],"overflow-y":[{"overflow-y":U()}],overscroll:[{overscroll:L()}],"overscroll-x":[{"overscroll-x":L()}],"overscroll-y":[{"overscroll-y":L()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:fe()}],"inset-x":[{"inset-x":fe()}],"inset-y":[{"inset-y":fe()}],start:[{start:fe()}],end:[{end:fe()}],top:[{top:fe()}],right:[{right:fe()}],bottom:[{bottom:fe()}],left:[{left:fe()}],visibility:["visible","invisible","collapse"],z:[{z:[ui,"auto",Ae,Ne]}],basis:[{basis:[Qo,"full","auto",h,...V()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[tt,Qo,"auto","initial","none",Ne]}],grow:[{grow:["",tt,Ae,Ne]}],shrink:[{shrink:["",tt,Ae,Ne]}],order:[{order:[ui,"first","last","none",Ae,Ne]}],"grid-cols":[{"grid-cols":ge()}],"col-start-end":[{col:pe()}],"col-start":[{"col-start":ae()}],"col-end":[{"col-end":ae()}],"grid-rows":[{"grid-rows":ge()}],"row-start-end":[{row:pe()}],"row-start":[{"row-start":ae()}],"row-end":[{"row-end":ae()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":le()}],"auto-rows":[{"auto-rows":le()}],gap:[{gap:V()}],"gap-x":[{"gap-x":V()}],"gap-y":[{"gap-y":V()}],"justify-content":[{justify:[...he(),"normal"]}],"justify-items":[{"justify-items":[...be(),"normal"]}],"justify-self":[{"justify-self":["auto",...be()]}],"align-content":[{content:["normal",...he()]}],"align-items":[{items:[...be(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...be(),{baseline:["","last"]}]}],"place-content":[{"place-content":he()}],"place-items":[{"place-items":[...be(),"baseline"]}],"place-self":[{"place-self":["auto",...be()]}],p:[{p:V()}],px:[{px:V()}],py:[{py:V()}],ps:[{ps:V()}],pe:[{pe:V()}],pt:[{pt:V()}],pr:[{pr:V()}],pb:[{pb:V()}],pl:[{pl:V()}],m:[{m:R()}],mx:[{mx:R()}],my:[{my:R()}],ms:[{ms:R()}],me:[{me:R()}],mt:[{mt:R()}],mr:[{mr:R()}],mb:[{mb:R()}],ml:[{ml:R()}],"space-x":[{"space-x":V()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":V()}],"space-y-reverse":["space-y-reverse"],size:[{size:P()}],w:[{w:[h,"screen",...P()]}],"min-w":[{"min-w":[h,"screen","none",...P()]}],"max-w":[{"max-w":[h,"screen","none","prose",{screen:[d]},...P()]}],h:[{h:["screen","lh",...P()]}],"min-h":[{"min-h":["screen","lh","none",...P()]}],"max-h":[{"max-h":["screen","lh",...P()]}],"font-size":[{text:["base",r,Sl,$i]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,Ae,Rm]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",jm,Ne]}],"font-family":[{font:[lD,Ne,t]}],"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:[s,Ae,Ne]}],"line-clamp":[{"line-clamp":[tt,"none",Ae,Rm]}],leading:[{leading:[u,...V()]}],"list-image":[{"list-image":["none",Ae,Ne]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ae,Ne]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...oe(),"wavy"]}],"text-decoration-thickness":[{decoration:[tt,"from-font","auto",Ae,$i]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[tt,"auto",Ae,Ne]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:V()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ae,Ne]}],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",Ae,Ne]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ee()}],"bg-repeat":[{bg:me()}],"bg-size":[{bg:Re()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},ui,Ae,Ne],radial:["",Ae,Ne],conic:[ui,Ae,Ne]},uD,sD]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:G()}],"gradient-via-pos":[{via:G()}],"gradient-to-pos":[{to:G()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:Y()}],"rounded-s":[{"rounded-s":Y()}],"rounded-e":[{"rounded-e":Y()}],"rounded-t":[{"rounded-t":Y()}],"rounded-r":[{"rounded-r":Y()}],"rounded-b":[{"rounded-b":Y()}],"rounded-l":[{"rounded-l":Y()}],"rounded-ss":[{"rounded-ss":Y()}],"rounded-se":[{"rounded-se":Y()}],"rounded-ee":[{"rounded-ee":Y()}],"rounded-es":[{"rounded-es":Y()}],"rounded-tl":[{"rounded-tl":Y()}],"rounded-tr":[{"rounded-tr":Y()}],"rounded-br":[{"rounded-br":Y()}],"rounded-bl":[{"rounded-bl":Y()}],"border-w":[{border:ie()}],"border-w-x":[{"border-x":ie()}],"border-w-y":[{"border-y":ie()}],"border-w-s":[{"border-s":ie()}],"border-w-e":[{"border-e":ie()}],"border-w-t":[{"border-t":ie()}],"border-w-r":[{"border-r":ie()}],"border-w-b":[{"border-b":ie()}],"border-w-l":[{"border-l":ie()}],"divide-x":[{"divide-x":ie()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ie()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...oe(),"hidden","none"]}],"divide-style":[{divide:[...oe(),"hidden","none"]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...oe(),"none","hidden"]}],"outline-offset":[{"outline-offset":[tt,Ae,Ne]}],"outline-w":[{outline:["",tt,Sl,$i]}],"outline-color":[{outline:I()}],shadow:[{shadow:["","none",x,Mu,Du]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":["none",v,Mu,Du]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:ie()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[tt,$i]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":ie()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":["none",w,Mu,Du]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[tt,Ae,Ne]}],"mix-blend":[{"mix-blend":[...ve(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ve()}],"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":[tt]}],"mask-image-linear-from-pos":[{"mask-linear-from":W()}],"mask-image-linear-to-pos":[{"mask-linear-to":W()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":W()}],"mask-image-t-to-pos":[{"mask-t-to":W()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":W()}],"mask-image-r-to-pos":[{"mask-r-to":W()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":W()}],"mask-image-b-to-pos":[{"mask-b-to":W()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":W()}],"mask-image-l-to-pos":[{"mask-l-to":W()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":W()}],"mask-image-x-to-pos":[{"mask-x-to":W()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":W()}],"mask-image-y-to-pos":[{"mask-y-to":W()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[Ae,Ne]}],"mask-image-radial-from-pos":[{"mask-radial-from":W()}],"mask-image-radial-to-pos":[{"mask-radial-to":W()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"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":C()}],"mask-image-conic-pos":[{"mask-conic":[tt]}],"mask-image-conic-from-pos":[{"mask-conic-from":W()}],"mask-image-conic-to-pos":[{"mask-conic-to":W()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ee()}],"mask-repeat":[{mask:me()}],"mask-size":[{mask:Re()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ae,Ne]}],filter:[{filter:["","none",Ae,Ne]}],blur:[{blur:xe()}],brightness:[{brightness:[tt,Ae,Ne]}],contrast:[{contrast:[tt,Ae,Ne]}],"drop-shadow":[{"drop-shadow":["","none",E,Mu,Du]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:["",tt,Ae,Ne]}],"hue-rotate":[{"hue-rotate":[tt,Ae,Ne]}],invert:[{invert:["",tt,Ae,Ne]}],saturate:[{saturate:[tt,Ae,Ne]}],sepia:[{sepia:["",tt,Ae,Ne]}],"backdrop-filter":[{"backdrop-filter":["","none",Ae,Ne]}],"backdrop-blur":[{"backdrop-blur":xe()}],"backdrop-brightness":[{"backdrop-brightness":[tt,Ae,Ne]}],"backdrop-contrast":[{"backdrop-contrast":[tt,Ae,Ne]}],"backdrop-grayscale":[{"backdrop-grayscale":["",tt,Ae,Ne]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[tt,Ae,Ne]}],"backdrop-invert":[{"backdrop-invert":["",tt,Ae,Ne]}],"backdrop-opacity":[{"backdrop-opacity":[tt,Ae,Ne]}],"backdrop-saturate":[{"backdrop-saturate":[tt,Ae,Ne]}],"backdrop-sepia":[{"backdrop-sepia":["",tt,Ae,Ne]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":V()}],"border-spacing-x":[{"border-spacing-x":V()}],"border-spacing-y":[{"border-spacing-y":V()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ae,Ne]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[tt,"initial",Ae,Ne]}],ease:[{ease:["linear","initial",D,Ae,Ne]}],delay:[{delay:[tt,Ae,Ne]}],animate:[{animate:["none",A,Ae,Ne]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[S,Ae,Ne]}],"perspective-origin":[{"perspective-origin":T()}],rotate:[{rotate:Oe()}],"rotate-x":[{"rotate-x":Oe()}],"rotate-y":[{"rotate-y":Oe()}],"rotate-z":[{"rotate-z":Oe()}],scale:[{scale:Ue()}],"scale-x":[{"scale-x":Ue()}],"scale-y":[{"scale-y":Ue()}],"scale-z":[{"scale-z":Ue()}],"scale-3d":["scale-3d"],skew:[{skew:Ye()}],"skew-x":[{"skew-x":Ye()}],"skew-y":[{"skew-y":Ye()}],transform:[{transform:[Ae,Ne,"","none","gpu","cpu"]}],"transform-origin":[{origin:T()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ze()}],"translate-x":[{"translate-x":Ze()}],"translate-y":[{"translate-y":Ze()}],"translate-z":[{"translate-z":Ze()}],"translate-none":["translate-none"],accent:[{accent:I()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:I()}],"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",Ae,Ne]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":V()}],"scroll-mx":[{"scroll-mx":V()}],"scroll-my":[{"scroll-my":V()}],"scroll-ms":[{"scroll-ms":V()}],"scroll-me":[{"scroll-me":V()}],"scroll-mt":[{"scroll-mt":V()}],"scroll-mr":[{"scroll-mr":V()}],"scroll-mb":[{"scroll-mb":V()}],"scroll-ml":[{"scroll-ml":V()}],"scroll-p":[{"scroll-p":V()}],"scroll-px":[{"scroll-px":V()}],"scroll-py":[{"scroll-py":V()}],"scroll-ps":[{"scroll-ps":V()}],"scroll-pe":[{"scroll-pe":V()}],"scroll-pt":[{"scroll-pt":V()}],"scroll-pr":[{"scroll-pr":V()}],"scroll-pb":[{"scroll-pb":V()}],"scroll-pl":[{"scroll-pl":V()}],"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",Ae,Ne]}],fill:[{fill:["none",...I()]}],"stroke-w":[{stroke:[tt,Sl,$i,Rm]}],stroke:[{stroke:["none",...I()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],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-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},mD=XT(hD);function de(...e){return mD(gS(e))}function Gi(e,t=24){return!e||e.length<=t*2+3?e:`${e.slice(0,t)}…${e.slice(-t)}`}function fw(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Mn(...e){return t=>{let r=!1;const i=e.map(s=>{const u=fw(s,t);return!r&&typeof u=="function"&&(r=!0),u});if(r)return()=>{for(let s=0;s{let{children:u,...d}=i;RS(u)&&typeof ld=="function"&&(u=ld(u._payload));const h=p.Children.toArray(u),g=h.find(xD);if(g){const y=g.props.children,x=h.map(v=>v===g?p.Children.count(y)>1?p.Children.only(null):p.isValidElement(y)?y.props.children:null:v);return l.jsx(t,{...d,ref:s,children:p.isValidElement(y)?p.cloneElement(y,void 0,x):null})}return l.jsx(t,{...d,ref:s,children:u})});return r.displayName=`${e}.Slot`,r}var _s=Wl("Slot");function yD(e){const t=p.forwardRef((r,i)=>{let{children:s,...u}=r;if(RS(s)&&typeof ld=="function"&&(s=ld(s._payload)),p.isValidElement(s)){const d=wD(s),h=bD(u,s.props);return s.type!==p.Fragment&&(h.ref=i?Mn(i,d):d),p.cloneElement(s,h)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vD=Symbol("radix.slottable");function xD(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vD}function bD(e,t){const r={...t};for(const i in t){const s=e[i],u=t[i];/^on[A-Z]/.test(i)?s&&u?r[i]=(...h)=>{const g=u(...h);return s(...h),g}:s&&(r[i]=s):i==="style"?r[i]={...s,...u}:i==="className"&&(r[i]=[s,u].filter(Boolean).join(" "))}return{...e,...r}}function wD(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)}const hw=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,mw=gS,Bp=(e,t)=>r=>{var i;if(t?.variants==null)return mw(e,r?.class,r?.className);const{variants:s,defaultVariants:u}=t,d=Object.keys(s).map(y=>{const x=r?.[y],v=u?.[y];if(x===null)return null;const w=hw(x)||hw(v);return s[y][w]}),h=r&&Object.entries(r).reduce((y,x)=>{let[v,w]=x;return w===void 0||(y[v]=w),y},{}),g=t==null||(i=t.compoundVariants)===null||i===void 0?void 0:i.reduce((y,x)=>{let{class:v,className:w,...E}=x;return Object.entries(E).every(j=>{let[S,N]=j;return Array.isArray(N)?N.includes({...u,...h}[S]):{...u,...h}[S]===N})?[...y,v,w]:y},[]);return mw(e,d,g,r?.class,r?.className)},Gp=Bp("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-white hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input 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",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function se({className:e,variant:t,size:r,asChild:i=!1,...s}){const u=i?_s:"button";return l.jsx(u,{"data-slot":"button",className:de(Gp({variant:t,size:r,className:e})),...s})}var pw=1,SD=.9,_D=.8,ED=.17,Om=.1,Nm=.999,CD=.9999,jD=.99,RD=/[\\\/_+.#"@\[\(\{&]/,OD=/[\\\/_+.#"@\[\(\{&]/g,ND=/[\s-]/,OS=/[\s-]/g;function up(e,t,r,i,s,u,d){if(u===t.length)return s===e.length?pw:jD;var h=`${s},${u}`;if(d[h]!==void 0)return d[h];for(var g=i.charAt(u),y=r.indexOf(g,s),x=0,v,w,E,j;y>=0;)v=up(e,t,r,i,y+1,u+1,d),v>x&&(y===s?v*=pw:RD.test(e.charAt(y-1))?(v*=_D,E=e.slice(s,y-1).match(OD),E&&s>0&&(v*=Math.pow(Nm,E.length))):ND.test(e.charAt(y-1))?(v*=SD,j=e.slice(s,y-1).match(OS),j&&s>0&&(v*=Math.pow(Nm,j.length))):(v*=ED,s>0&&(v*=Math.pow(Nm,y-s))),e.charAt(y)!==t.charAt(u)&&(v*=CD)),(vv&&(v=w*Om)),v>x&&(x=v),y=r.indexOf(g,y+1);return d[h]=x,x}function gw(e){return e.toLowerCase().replace(OS," ")}function AD(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,up(e,t,gw(e),gw(t),0,0,{})}function Ce(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e?.(s),r===!1||!s.defaultPrevented)return t?.(s)}}function TD(e,t){const r=p.createContext(t),i=u=>{const{children:d,...h}=u,g=p.useMemo(()=>h,Object.values(h));return l.jsx(r.Provider,{value:g,children:d})};i.displayName=e+"Provider";function s(u){const d=p.useContext(r);if(d)return d;if(t!==void 0)return t;throw new Error(`\`${u}\` must be used within \`${e}\``)}return[i,s]}function ur(e,t=[]){let r=[];function i(u,d){const h=p.createContext(d),g=r.length;r=[...r,d];const y=v=>{const{scope:w,children:E,...j}=v,S=w?.[e]?.[g]||h,N=p.useMemo(()=>j,Object.values(j));return l.jsx(S.Provider,{value:N,children:E})};y.displayName=u+"Provider";function x(v,w){const E=w?.[e]?.[g]||h,j=p.useContext(E);if(j)return j;if(d!==void 0)return d;throw new Error(`\`${v}\` must be used within \`${u}\``)}return[y,x]}const s=()=>{const u=r.map(d=>p.createContext(d));return function(h){const g=h?.[e]||u;return p.useMemo(()=>({[`__scope${e}`]:{...h,[e]:g}}),[h,g])}};return s.scopeName=e,[i,DD(s,...t)]}function DD(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(u){const d=i.reduce((h,{useScope:g,scopeName:y})=>{const v=g(u)[`__scope${y}`];return{...h,...v}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:d}),[d])}};return r.scopeName=t.scopeName,r}var on=globalThis?.document?p.useLayoutEffect:()=>{},MD=kp[" useId ".trim().toString()]||(()=>{}),zD=0;function Sn(e){const[t,r]=p.useState(MD());return on(()=>{r(i=>i??String(zD++))},[e]),e||(t?`radix-${t}`:"")}var kD=kp[" useInsertionEffect ".trim().toString()]||on;function Yi({prop:e,defaultProp:t,onChange:r=()=>{},caller:i}){const[s,u,d]=PD({defaultProp:t,onChange:r}),h=e!==void 0,g=h?e:s;{const x=p.useRef(e!==void 0);p.useEffect(()=>{const v=x.current;v!==h&&console.warn(`${i} is changing from ${v?"controlled":"uncontrolled"} to ${h?"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.`),x.current=h},[h,i])}const y=p.useCallback(x=>{if(h){const v=KD(x)?x(e):x;v!==e&&d.current?.(v)}else u(x)},[h,e,u,d]);return[g,y]}function PD({defaultProp:e,onChange:t}){const[r,i]=p.useState(e),s=p.useRef(r),u=p.useRef(t);return kD(()=>{u.current=t},[t]),p.useEffect(()=>{s.current!==r&&(u.current?.(r),s.current=r)},[r,s]),[r,i,u]}function KD(e){return typeof e=="function"}function ID(e){const t=LD(e),r=p.forwardRef((i,s)=>{const{children:u,...d}=i,h=p.Children.toArray(u),g=h.find(qD);if(g){const y=g.props.children,x=h.map(v=>v===g?p.Children.count(y)>1?p.Children.only(null):p.isValidElement(y)?y.props.children:null:v);return l.jsx(t,{...d,ref:s,children:p.isValidElement(y)?p.cloneElement(y,void 0,x):null})}return l.jsx(t,{...d,ref:s,children:u})});return r.displayName=`${e}.Slot`,r}function LD(e){const t=p.forwardRef((r,i)=>{const{children:s,...u}=r;if(p.isValidElement(s)){const d=$D(s),h=FD(u,s.props);return s.type!==p.Fragment&&(h.ref=i?Mn(i,d):d),p.cloneElement(s,h)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var UD=Symbol("radix.slottable");function qD(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===UD}function FD(e,t){const r={...t};for(const i in t){const s=e[i],u=t[i];/^on[A-Z]/.test(i)?s&&u?r[i]=(...h)=>{const g=u(...h);return s(...h),g}:s&&(r[i]=s):i==="style"?r[i]={...s,...u}:i==="className"&&(r[i]=[s,u].filter(Boolean).join(" "))}return{...e,...r}}function $D(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)}var VD=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rt=VD.reduce((e,t)=>{const r=ID(`Primitive.${t}`),i=p.forwardRef((s,u)=>{const{asChild:d,...h}=s,g=d?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(g,{...h,ref:u})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{});function NS(e,t){e&&Ed.flushSync(()=>e.dispatchEvent(t))}function Fa(e){const t=p.useRef(e);return p.useEffect(()=>{t.current=e}),p.useMemo(()=>(...r)=>t.current?.(...r),[])}function HD(e,t=globalThis?.document){const r=Fa(e);p.useEffect(()=>{const i=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",i,{capture:!0}),()=>t.removeEventListener("keydown",i,{capture:!0})},[r,t])}var BD="DismissableLayer",dp="dismissableLayer.update",GD="dismissableLayer.pointerDownOutside",XD="dismissableLayer.focusOutside",yw,AS=p.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Es=p.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:u,onInteractOutside:d,onDismiss:h,...g}=e,y=p.useContext(AS),[x,v]=p.useState(null),w=x?.ownerDocument??globalThis?.document,[,E]=p.useState({}),j=dt(t,L=>v(L)),S=Array.from(y.layers),[N]=[...y.layersWithOutsidePointerEventsDisabled].slice(-1),D=S.indexOf(N),A=x?S.indexOf(x):-1,O=y.layersWithOutsidePointerEventsDisabled.size>0,C=A>=D,T=QD(L=>{const V=L.target,fe=[...y.branches].some(ge=>ge.contains(V));!C||fe||(s?.(L),d?.(L),L.defaultPrevented||h?.())},w),U=JD(L=>{const V=L.target;[...y.branches].some(ge=>ge.contains(V))||(u?.(L),d?.(L),L.defaultPrevented||h?.())},w);return HD(L=>{A===y.layers.size-1&&(i?.(L),!L.defaultPrevented&&h&&(L.preventDefault(),h()))},w),p.useEffect(()=>{if(x)return r&&(y.layersWithOutsidePointerEventsDisabled.size===0&&(yw=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),y.layersWithOutsidePointerEventsDisabled.add(x)),y.layers.add(x),vw(),()=>{r&&y.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=yw)}},[x,w,r,y]),p.useEffect(()=>()=>{x&&(y.layers.delete(x),y.layersWithOutsidePointerEventsDisabled.delete(x),vw())},[x,y]),p.useEffect(()=>{const L=()=>E({});return document.addEventListener(dp,L),()=>document.removeEventListener(dp,L)},[]),l.jsx(rt.div,{...g,ref:j,style:{pointerEvents:O?C?"auto":"none":void 0,...e.style},onFocusCapture:Ce(e.onFocusCapture,U.onFocusCapture),onBlurCapture:Ce(e.onBlurCapture,U.onBlurCapture),onPointerDownCapture:Ce(e.onPointerDownCapture,T.onPointerDownCapture)})});Es.displayName=BD;var ZD="DismissableLayerBranch",YD=p.forwardRef((e,t)=>{const r=p.useContext(AS),i=p.useRef(null),s=dt(t,i);return p.useEffect(()=>{const u=i.current;if(u)return r.branches.add(u),()=>{r.branches.delete(u)}},[r.branches]),l.jsx(rt.div,{...e,ref:s})});YD.displayName=ZD;function QD(e,t=globalThis?.document){const r=Fa(e),i=p.useRef(!1),s=p.useRef(()=>{});return p.useEffect(()=>{const u=h=>{if(h.target&&!i.current){let g=function(){TS(GD,r,y,{discrete:!0})};const y={originalEvent:h};h.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=g,t.addEventListener("click",s.current,{once:!0})):g()}else t.removeEventListener("click",s.current);i.current=!1},d=window.setTimeout(()=>{t.addEventListener("pointerdown",u)},0);return()=>{window.clearTimeout(d),t.removeEventListener("pointerdown",u),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>i.current=!0}}function JD(e,t=globalThis?.document){const r=Fa(e),i=p.useRef(!1);return p.useEffect(()=>{const s=u=>{u.target&&!i.current&&TS(XD,r,{originalEvent:u},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function vw(){const e=new CustomEvent(dp);document.dispatchEvent(e)}function TS(e,t,r,{discrete:i}){const s=r.originalEvent.target,u=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),i?NS(s,u):s.dispatchEvent(u)}var Am="focusScope.autoFocusOnMount",Tm="focusScope.autoFocusOnUnmount",xw={bubbles:!1,cancelable:!0},WD="FocusScope",ec=p.forwardRef((e,t)=>{const{loop:r=!1,trapped:i=!1,onMountAutoFocus:s,onUnmountAutoFocus:u,...d}=e,[h,g]=p.useState(null),y=Fa(s),x=Fa(u),v=p.useRef(null),w=dt(t,S=>g(S)),E=p.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;p.useEffect(()=>{if(i){let S=function(O){if(E.paused||!h)return;const C=O.target;h.contains(C)?v.current=C:di(v.current,{select:!0})},N=function(O){if(E.paused||!h)return;const C=O.relatedTarget;C!==null&&(h.contains(C)||di(v.current,{select:!0}))},D=function(O){if(document.activeElement===document.body)for(const T of O)T.removedNodes.length>0&&di(h)};document.addEventListener("focusin",S),document.addEventListener("focusout",N);const A=new MutationObserver(D);return h&&A.observe(h,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",S),document.removeEventListener("focusout",N),A.disconnect()}}},[i,h,E.paused]),p.useEffect(()=>{if(h){ww.add(E);const S=document.activeElement;if(!h.contains(S)){const D=new CustomEvent(Am,xw);h.addEventListener(Am,y),h.dispatchEvent(D),D.defaultPrevented||(eM(iM(DS(h)),{select:!0}),document.activeElement===S&&di(h))}return()=>{h.removeEventListener(Am,y),setTimeout(()=>{const D=new CustomEvent(Tm,xw);h.addEventListener(Tm,x),h.dispatchEvent(D),D.defaultPrevented||di(S??document.body,{select:!0}),h.removeEventListener(Tm,x),ww.remove(E)},0)}}},[h,y,x,E]);const j=p.useCallback(S=>{if(!r&&!i||E.paused)return;const N=S.key==="Tab"&&!S.altKey&&!S.ctrlKey&&!S.metaKey,D=document.activeElement;if(N&&D){const A=S.currentTarget,[O,C]=tM(A);O&&C?!S.shiftKey&&D===C?(S.preventDefault(),r&&di(O,{select:!0})):S.shiftKey&&D===O&&(S.preventDefault(),r&&di(C,{select:!0})):D===A&&S.preventDefault()}},[r,i,E.paused]);return l.jsx(rt.div,{tabIndex:-1,...d,ref:w,onKeyDown:j})});ec.displayName=WD;function eM(e,{select:t=!1}={}){const r=document.activeElement;for(const i of e)if(di(i,{select:t}),document.activeElement!==r)return}function tM(e){const t=DS(e),r=bw(t,e),i=bw(t.reverse(),e);return[r,i]}function DS(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:i=>{const s=i.tagName==="INPUT"&&i.type==="hidden";return i.disabled||i.hidden||s?NodeFilter.FILTER_SKIP:i.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function bw(e,t){for(const r of e)if(!nM(r,{upTo:t}))return r}function nM(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 aM(e){return e instanceof HTMLInputElement&&"select"in e}function di(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&aM(e)&&t&&e.select()}}var ww=rM();function rM(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Sw(e,t),e.unshift(t)},remove(t){e=Sw(e,t),e[0]?.resume()}}}function Sw(e,t){const r=[...e],i=r.indexOf(t);return i!==-1&&r.splice(i,1),r}function iM(e){return e.filter(t=>t.tagName!=="A")}var oM="Portal",Cs=p.forwardRef((e,t)=>{const{container:r,...i}=e,[s,u]=p.useState(!1);on(()=>u(!0),[]);const d=r||s&&globalThis?.document?.body;return d?U0.createPortal(l.jsx(rt.div,{...i,ref:t}),d):null});Cs.displayName=oM;function sM(e,t){return p.useReducer((r,i)=>t[r][i]??r,e)}var ja=e=>{const{present:t,children:r}=e,i=lM(t),s=typeof r=="function"?r({present:i.isPresent}):p.Children.only(r),u=dt(i.ref,cM(s));return typeof r=="function"||i.isPresent?p.cloneElement(s,{ref:u}):null};ja.displayName="Presence";function lM(e){const[t,r]=p.useState(),i=p.useRef(null),s=p.useRef(e),u=p.useRef("none"),d=e?"mounted":"unmounted",[h,g]=sM(d,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return p.useEffect(()=>{const y=zu(i.current);u.current=h==="mounted"?y:"none"},[h]),on(()=>{const y=i.current,x=s.current;if(x!==e){const w=u.current,E=zu(y);e?g("MOUNT"):E==="none"||y?.display==="none"?g("UNMOUNT"):g(x&&w!==E?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,g]),on(()=>{if(t){let y;const x=t.ownerDocument.defaultView??window,v=E=>{const S=zu(i.current).includes(CSS.escape(E.animationName));if(E.target===t&&S&&(g("ANIMATION_END"),!s.current)){const N=t.style.animationFillMode;t.style.animationFillMode="forwards",y=x.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=N)})}},w=E=>{E.target===t&&(u.current=zu(i.current))};return t.addEventListener("animationstart",w),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{x.clearTimeout(y),t.removeEventListener("animationstart",w),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else g("ANIMATION_END")},[t,g]),{isPresent:["mounted","unmountSuspended"].includes(h),ref:p.useCallback(y=>{i.current=y?getComputedStyle(y):null,r(y)},[])}}function zu(e){return e?.animationName||"none"}function cM(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)}var Dm=0;function Od(){p.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??_w()),document.body.insertAdjacentElement("beforeend",e[1]??_w()),Dm++,()=>{Dm===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Dm--}},[])}function _w(){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 ar=function(){return ar=Object.assign||function(t){for(var r,i=1,s=arguments.length;i"u")return jM;var t=RM(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])}},NM=PS(),ds="data-scroll-locked",AM=function(e,t,r,i){var s=e.left,u=e.top,d=e.right,h=e.gap;return r===void 0&&(r="margin"),` .`.concat(dM,` { overflow: hidden `).concat(i,`; padding-right: `).concat(h,"px ").concat(i,`; } body[`).concat(ds,`] { overflow: hidden `).concat(i,`; overscroll-behavior: contain; `).concat([t&&"position: relative ".concat(i,";"),r==="margin"&&` padding-left: `.concat(s,`px; padding-top: `).concat(u,`px; padding-right: `).concat(d,`px; margin-left:0; margin-top:0; margin-right: `).concat(h,"px ").concat(i,`; `),r==="padding"&&"padding-right: ".concat(h,"px ").concat(i,";")].filter(Boolean).join(""),` } .`).concat(Ju,` { right: `).concat(h,"px ").concat(i,`; } .`).concat(Wu,` { margin-right: `).concat(h,"px ").concat(i,`; } .`).concat(Ju," .").concat(Ju,` { right: 0 `).concat(i,`; } .`).concat(Wu," .").concat(Wu,` { margin-right: 0 `).concat(i,`; } body[`).concat(ds,`] { `).concat(fM,": ").concat(h,`px; } `)},Cw=function(){var e=parseInt(document.body.getAttribute(ds)||"0",10);return isFinite(e)?e:0},TM=function(){p.useEffect(function(){return document.body.setAttribute(ds,(Cw()+1).toString()),function(){var e=Cw()-1;e<=0?document.body.removeAttribute(ds):document.body.setAttribute(ds,e.toString())}},[])},DM=function(e){var t=e.noRelative,r=e.noImportant,i=e.gapMode,s=i===void 0?"margin":i;TM();var u=p.useMemo(function(){return OM(s)},[s]);return p.createElement(NM,{styles:AM(u,!t,s,r?"":"!important")})},fp=!1;if(typeof window<"u")try{var ku=Object.defineProperty({},"passive",{get:function(){return fp=!0,!0}});window.addEventListener("test",ku,ku),window.removeEventListener("test",ku,ku)}catch{fp=!1}var Jo=fp?{passive:!1}:!1,MM=function(e){return e.tagName==="TEXTAREA"},KS=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!MM(e)&&r[t]==="visible")},zM=function(e){return KS(e,"overflowY")},kM=function(e){return KS(e,"overflowX")},jw=function(e,t){var r=t.ownerDocument,i=t;do{typeof ShadowRoot<"u"&&i instanceof ShadowRoot&&(i=i.host);var s=IS(e,i);if(s){var u=LS(e,i),d=u[1],h=u[2];if(d>h)return!0}i=i.parentNode}while(i&&i!==r.body);return!1},PM=function(e){var t=e.scrollTop,r=e.scrollHeight,i=e.clientHeight;return[t,r,i]},KM=function(e){var t=e.scrollLeft,r=e.scrollWidth,i=e.clientWidth;return[t,r,i]},IS=function(e,t){return e==="v"?zM(t):kM(t)},LS=function(e,t){return e==="v"?PM(t):KM(t)},IM=function(e,t){return e==="h"&&t==="rtl"?-1:1},LM=function(e,t,r,i,s){var u=IM(e,window.getComputedStyle(t).direction),d=u*i,h=r.target,g=t.contains(h),y=!1,x=d>0,v=0,w=0;do{if(!h)break;var E=LS(e,h),j=E[0],S=E[1],N=E[2],D=S-N-u*j;(j||D)&&IS(e,h)&&(v+=D,w+=j);var A=h.parentNode;h=A&&A.nodeType===Node.DOCUMENT_FRAGMENT_NODE?A.host:A}while(!g&&h!==document.body||g&&(t.contains(h)||t===h));return(x&&Math.abs(v)<1||!x&&Math.abs(w)<1)&&(y=!0),y},Pu=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Rw=function(e){return[e.deltaX,e.deltaY]},Ow=function(e){return e&&"current"in e?e.current:e},UM=function(e,t){return e[0]===t[0]&&e[1]===t[1]},qM=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},FM=0,Wo=[];function $M(e){var t=p.useRef([]),r=p.useRef([0,0]),i=p.useRef(),s=p.useState(FM++)[0],u=p.useState(PS)[0],d=p.useRef(e);p.useEffect(function(){d.current=e},[e]),p.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var S=uM([e.lockRef.current],(e.shards||[]).map(Ow),!0).filter(Boolean);return S.forEach(function(N){return N.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),S.forEach(function(N){return N.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var h=p.useCallback(function(S,N){if("touches"in S&&S.touches.length===2||S.type==="wheel"&&S.ctrlKey)return!d.current.allowPinchZoom;var D=Pu(S),A=r.current,O="deltaX"in S?S.deltaX:A[0]-D[0],C="deltaY"in S?S.deltaY:A[1]-D[1],T,U=S.target,L=Math.abs(O)>Math.abs(C)?"h":"v";if("touches"in S&&L==="h"&&U.type==="range")return!1;var V=jw(L,U);if(!V)return!0;if(V?T=L:(T=L==="v"?"h":"v",V=jw(L,U)),!V)return!1;if(!i.current&&"changedTouches"in S&&(O||C)&&(i.current=T),!T)return!0;var fe=i.current||T;return LM(fe,N,S,fe==="h"?O:C)},[]),g=p.useCallback(function(S){var N=S;if(!(!Wo.length||Wo[Wo.length-1]!==u)){var D="deltaY"in N?Rw(N):Pu(N),A=t.current.filter(function(T){return T.name===N.type&&(T.target===N.target||N.target===T.shadowParent)&&UM(T.delta,D)})[0];if(A&&A.should){N.cancelable&&N.preventDefault();return}if(!A){var O=(d.current.shards||[]).map(Ow).filter(Boolean).filter(function(T){return T.contains(N.target)}),C=O.length>0?h(N,O[0]):!d.current.noIsolation;C&&N.cancelable&&N.preventDefault()}}},[]),y=p.useCallback(function(S,N,D,A){var O={name:S,delta:N,target:D,should:A,shadowParent:VM(D)};t.current.push(O),setTimeout(function(){t.current=t.current.filter(function(C){return C!==O})},1)},[]),x=p.useCallback(function(S){r.current=Pu(S),i.current=void 0},[]),v=p.useCallback(function(S){y(S.type,Rw(S),S.target,h(S,e.lockRef.current))},[]),w=p.useCallback(function(S){y(S.type,Pu(S),S.target,h(S,e.lockRef.current))},[]);p.useEffect(function(){return Wo.push(u),e.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:w}),document.addEventListener("wheel",g,Jo),document.addEventListener("touchmove",g,Jo),document.addEventListener("touchstart",x,Jo),function(){Wo=Wo.filter(function(S){return S!==u}),document.removeEventListener("wheel",g,Jo),document.removeEventListener("touchmove",g,Jo),document.removeEventListener("touchstart",x,Jo)}},[]);var E=e.removeScrollBar,j=e.inert;return p.createElement(p.Fragment,null,j?p.createElement(u,{styles:qM(s)}):null,E?p.createElement(DM,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function VM(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const HM=xM(kS,$M);var tc=p.forwardRef(function(e,t){return p.createElement(Nd,ar({},e,{ref:t,sideCar:HM}))});tc.classNames=Nd.classNames;var BM=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},es=new WeakMap,Ku=new WeakMap,Iu={},Pm=0,US=function(e){return e&&(e.host||US(e.parentNode))},GM=function(e,t){return t.map(function(r){if(e.contains(r))return r;var i=US(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})},XM=function(e,t,r,i){var s=GM(t,Array.isArray(e)?e:[e]);Iu[r]||(Iu[r]=new WeakMap);var u=Iu[r],d=[],h=new Set,g=new Set(s),y=function(v){!v||h.has(v)||(h.add(v),y(v.parentNode))};s.forEach(y);var x=function(v){!v||g.has(v)||Array.prototype.forEach.call(v.children,function(w){if(h.has(w))x(w);else try{var E=w.getAttribute(i),j=E!==null&&E!=="false",S=(es.get(w)||0)+1,N=(u.get(w)||0)+1;es.set(w,S),u.set(w,N),d.push(w),S===1&&j&&Ku.set(w,!0),N===1&&w.setAttribute(r,"true"),j||w.setAttribute(i,"true")}catch(D){console.error("aria-hidden: cannot operate on ",w,D)}})};return x(t),h.clear(),Pm++,function(){d.forEach(function(v){var w=es.get(v)-1,E=u.get(v)-1;es.set(v,w),u.set(v,E),w||(Ku.has(v)||v.removeAttribute(i),Ku.delete(v)),E||v.removeAttribute(r)}),Pm--,Pm||(es=new WeakMap,es=new WeakMap,Ku=new WeakMap,Iu={})}},Ad=function(e,t,r){r===void 0&&(r="data-aria-hidden");var i=Array.from(Array.isArray(e)?e:[e]),s=BM(e);return s?(i.push.apply(i,Array.from(s.querySelectorAll("[aria-live], script"))),XM(i,s,r,"aria-hidden")):function(){return null}};function ZM(e){const t=YM(e),r=p.forwardRef((i,s)=>{const{children:u,...d}=i,h=p.Children.toArray(u),g=h.find(JM);if(g){const y=g.props.children,x=h.map(v=>v===g?p.Children.count(y)>1?p.Children.only(null):p.isValidElement(y)?y.props.children:null:v);return l.jsx(t,{...d,ref:s,children:p.isValidElement(y)?p.cloneElement(y,void 0,x):null})}return l.jsx(t,{...d,ref:s,children:u})});return r.displayName=`${e}.Slot`,r}function YM(e){const t=p.forwardRef((r,i)=>{const{children:s,...u}=r;if(p.isValidElement(s)){const d=ez(s),h=WM(u,s.props);return s.type!==p.Fragment&&(h.ref=i?Mn(i,d):d),p.cloneElement(s,h)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var QM=Symbol("radix.slottable");function JM(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===QM}function WM(e,t){const r={...t};for(const i in t){const s=e[i],u=t[i];/^on[A-Z]/.test(i)?s&&u?r[i]=(...h)=>{const g=u(...h);return s(...h),g}:s&&(r[i]=s):i==="style"?r[i]={...s,...u}:i==="className"&&(r[i]=[s,u].filter(Boolean).join(" "))}return{...e,...r}}function ez(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)}var Td="Dialog",[qS,FS]=ur(Td),[tz,Ba]=qS(Td),$S=e=>{const{__scopeDialog:t,children:r,open:i,defaultOpen:s,onOpenChange:u,modal:d=!0}=e,h=p.useRef(null),g=p.useRef(null),[y,x]=Yi({prop:i,defaultProp:s??!1,onChange:u,caller:Td});return l.jsx(tz,{scope:t,triggerRef:h,contentRef:g,contentId:Sn(),titleId:Sn(),descriptionId:Sn(),open:y,onOpenChange:x,onOpenToggle:p.useCallback(()=>x(v=>!v),[x]),modal:d,children:r})};$S.displayName=Td;var VS="DialogTrigger",HS=p.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=Ba(VS,r),u=dt(t,s.triggerRef);return l.jsx(rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Yp(s.open),...i,ref:u,onClick:Ce(e.onClick,s.onOpenToggle)})});HS.displayName=VS;var Xp="DialogPortal",[nz,BS]=qS(Xp,{forceMount:void 0}),GS=e=>{const{__scopeDialog:t,forceMount:r,children:i,container:s}=e,u=Ba(Xp,t);return l.jsx(nz,{scope:t,forceMount:r,children:p.Children.map(i,d=>l.jsx(ja,{present:r||u.open,children:l.jsx(Cs,{asChild:!0,container:s,children:d})}))})};GS.displayName=Xp;var cd="DialogOverlay",XS=p.forwardRef((e,t)=>{const r=BS(cd,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,u=Ba(cd,e.__scopeDialog);return u.modal?l.jsx(ja,{present:i||u.open,children:l.jsx(rz,{...s,ref:t})}):null});XS.displayName=cd;var az=ZM("DialogOverlay.RemoveScroll"),rz=p.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=Ba(cd,r);return l.jsx(tc,{as:az,allowPinchZoom:!0,shards:[s.contentRef],children:l.jsx(rt.div,{"data-state":Yp(s.open),...i,ref:t,style:{pointerEvents:"auto",...i.style}})})}),Qi="DialogContent",ZS=p.forwardRef((e,t)=>{const r=BS(Qi,e.__scopeDialog),{forceMount:i=r.forceMount,...s}=e,u=Ba(Qi,e.__scopeDialog);return l.jsx(ja,{present:i||u.open,children:u.modal?l.jsx(iz,{...s,ref:t}):l.jsx(oz,{...s,ref:t})})});ZS.displayName=Qi;var iz=p.forwardRef((e,t)=>{const r=Ba(Qi,e.__scopeDialog),i=p.useRef(null),s=dt(t,r.contentRef,i);return p.useEffect(()=>{const u=i.current;if(u)return Ad(u)},[]),l.jsx(YS,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ce(e.onCloseAutoFocus,u=>{u.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Ce(e.onPointerDownOutside,u=>{const d=u.detail.originalEvent,h=d.button===0&&d.ctrlKey===!0;(d.button===2||h)&&u.preventDefault()}),onFocusOutside:Ce(e.onFocusOutside,u=>u.preventDefault())})}),oz=p.forwardRef((e,t)=>{const r=Ba(Qi,e.__scopeDialog),i=p.useRef(!1),s=p.useRef(!1);return l.jsx(YS,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{e.onCloseAutoFocus?.(u),u.defaultPrevented||(i.current||r.triggerRef.current?.focus(),u.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:u=>{e.onInteractOutside?.(u),u.defaultPrevented||(i.current=!0,u.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const d=u.target;r.triggerRef.current?.contains(d)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&s.current&&u.preventDefault()}})}),YS=p.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:u,...d}=e,h=Ba(Qi,r),g=p.useRef(null),y=dt(t,g);return Od(),l.jsxs(l.Fragment,{children:[l.jsx(ec,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:u,children:l.jsx(Es,{role:"dialog",id:h.contentId,"aria-describedby":h.descriptionId,"aria-labelledby":h.titleId,"data-state":Yp(h.open),...d,ref:y,onDismiss:()=>h.onOpenChange(!1)})}),l.jsxs(l.Fragment,{children:[l.jsx(lz,{titleId:h.titleId}),l.jsx(uz,{contentRef:g,descriptionId:h.descriptionId})]})]})}),Zp="DialogTitle",QS=p.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=Ba(Zp,r);return l.jsx(rt.h2,{id:s.titleId,...i,ref:t})});QS.displayName=Zp;var JS="DialogDescription",WS=p.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=Ba(JS,r);return l.jsx(rt.p,{id:s.descriptionId,...i,ref:t})});WS.displayName=JS;var e1="DialogClose",t1=p.forwardRef((e,t)=>{const{__scopeDialog:r,...i}=e,s=Ba(e1,r);return l.jsx(rt.button,{type:"button",...i,ref:t,onClick:Ce(e.onClick,()=>s.onOpenChange(!1))})});t1.displayName=e1;function Yp(e){return e?"open":"closed"}var n1="DialogTitleWarning",[sz,a1]=TD(n1,{contentName:Qi,titleName:Zp,docsSlug:"dialog"}),lz=({titleId:e})=>{const t=a1(n1),r=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return p.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},cz="DialogDescriptionWarning",uz=({contentRef:e,descriptionId:t})=>{const i=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${a1(cz).contentName}}.`;return p.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(i))},[i,e,t]),null},Dd=$S,r1=HS,Md=GS,zd=XS,kd=ZS,Qp=QS,Jp=WS,nc=t1,dz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],vi=dz.reduce((e,t)=>{const r=Wl(`Primitive.${t}`),i=p.forwardRef((s,u)=>{const{asChild:d,...h}=s,g=d?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(g,{...h,ref:u})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{}),_l='[cmdk-group=""]',Km='[cmdk-group-items=""]',fz='[cmdk-group-heading=""]',i1='[cmdk-item=""]',Nw=`${i1}:not([aria-disabled="true"])`,hp="cmdk-item-select",ns="data-value",hz=(e,t,r)=>AD(e,t,r),o1=p.createContext(void 0),ac=()=>p.useContext(o1),s1=p.createContext(void 0),Wp=()=>p.useContext(s1),l1=p.createContext(void 0),c1=p.forwardRef((e,t)=>{let r=as(()=>{var G,Y;return{search:"",value:(Y=(G=e.value)!=null?G:e.defaultValue)!=null?Y:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),i=as(()=>new Set),s=as(()=>new Map),u=as(()=>new Map),d=as(()=>new Set),h=u1(e),{label:g,children:y,value:x,onValueChange:v,filter:w,shouldFilter:E,loop:j,disablePointerSelection:S=!1,vimBindings:N=!0,...D}=e,A=Sn(),O=Sn(),C=Sn(),T=p.useRef(null),U=Ez();Ji(()=>{if(x!==void 0){let G=x.trim();r.current.value=G,L.emit()}},[x]),Ji(()=>{U(6,le)},[]);let L=p.useMemo(()=>({subscribe:G=>(d.current.add(G),()=>d.current.delete(G)),snapshot:()=>r.current,setState:(G,Y,ie)=>{var oe,ve,W,xe;if(!Object.is(r.current[G],Y)){if(r.current[G]=Y,G==="search")ae(),ge(),U(1,pe);else if(G==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Oe=document.getElementById(C);Oe?Oe.focus():(oe=document.getElementById(A))==null||oe.focus()}if(U(7,()=>{var Oe;r.current.selectedItemId=(Oe=he())==null?void 0:Oe.id,L.emit()}),ie||U(5,le),((ve=h.current)==null?void 0:ve.value)!==void 0){let Oe=Y??"";(xe=(W=h.current).onValueChange)==null||xe.call(W,Oe);return}}L.emit()}},emit:()=>{d.current.forEach(G=>G())}}),[]),V=p.useMemo(()=>({value:(G,Y,ie)=>{var oe;Y!==((oe=u.current.get(G))==null?void 0:oe.value)&&(u.current.set(G,{value:Y,keywords:ie}),r.current.filtered.items.set(G,fe(Y,ie)),U(2,()=>{ge(),L.emit()}))},item:(G,Y)=>(i.current.add(G),Y&&(s.current.has(Y)?s.current.get(Y).add(G):s.current.set(Y,new Set([G]))),U(3,()=>{ae(),ge(),r.current.value||pe(),L.emit()}),()=>{u.current.delete(G),i.current.delete(G),r.current.filtered.items.delete(G);let ie=he();U(4,()=>{ae(),ie?.getAttribute("id")===G&&pe(),L.emit()})}),group:G=>(s.current.has(G)||s.current.set(G,new Set),()=>{u.current.delete(G),s.current.delete(G)}),filter:()=>h.current.shouldFilter,label:g||e["aria-label"],getDisablePointerSelection:()=>h.current.disablePointerSelection,listId:A,inputId:C,labelId:O,listInnerRef:T}),[]);function fe(G,Y){var ie,oe;let ve=(oe=(ie=h.current)==null?void 0:ie.filter)!=null?oe:hz;return G?ve(G,r.current.search,Y):0}function ge(){if(!r.current.search||h.current.shouldFilter===!1)return;let G=r.current.filtered.items,Y=[];r.current.filtered.groups.forEach(oe=>{let ve=s.current.get(oe),W=0;ve.forEach(xe=>{let Oe=G.get(xe);W=Math.max(Oe,W)}),Y.push([oe,W])});let ie=T.current;be().sort((oe,ve)=>{var W,xe;let Oe=oe.getAttribute("id"),Ue=ve.getAttribute("id");return((W=G.get(Ue))!=null?W:0)-((xe=G.get(Oe))!=null?xe:0)}).forEach(oe=>{let ve=oe.closest(Km);ve?ve.appendChild(oe.parentElement===ve?oe:oe.closest(`${Km} > *`)):ie.appendChild(oe.parentElement===ie?oe:oe.closest(`${Km} > *`))}),Y.sort((oe,ve)=>ve[1]-oe[1]).forEach(oe=>{var ve;let W=(ve=T.current)==null?void 0:ve.querySelector(`${_l}[${ns}="${encodeURIComponent(oe[0])}"]`);W?.parentElement.appendChild(W)})}function pe(){let G=be().find(ie=>ie.getAttribute("aria-disabled")!=="true"),Y=G?.getAttribute(ns);L.setState("value",Y||void 0)}function ae(){var G,Y,ie,oe;if(!r.current.search||h.current.shouldFilter===!1){r.current.filtered.count=i.current.size;return}r.current.filtered.groups=new Set;let ve=0;for(let W of i.current){let xe=(Y=(G=u.current.get(W))==null?void 0:G.value)!=null?Y:"",Oe=(oe=(ie=u.current.get(W))==null?void 0:ie.keywords)!=null?oe:[],Ue=fe(xe,Oe);r.current.filtered.items.set(W,Ue),Ue>0&&ve++}for(let[W,xe]of s.current)for(let Oe of xe)if(r.current.filtered.items.get(Oe)>0){r.current.filtered.groups.add(W);break}r.current.filtered.count=ve}function le(){var G,Y,ie;let oe=he();oe&&(((G=oe.parentElement)==null?void 0:G.firstChild)===oe&&((ie=(Y=oe.closest(_l))==null?void 0:Y.querySelector(fz))==null||ie.scrollIntoView({block:"nearest"})),oe.scrollIntoView({block:"nearest"}))}function he(){var G;return(G=T.current)==null?void 0:G.querySelector(`${i1}[aria-selected="true"]`)}function be(){var G;return Array.from(((G=T.current)==null?void 0:G.querySelectorAll(Nw))||[])}function R(G){let Y=be()[G];Y&&L.setState("value",Y.getAttribute(ns))}function P(G){var Y;let ie=he(),oe=be(),ve=oe.findIndex(xe=>xe===ie),W=oe[ve+G];(Y=h.current)!=null&&Y.loop&&(W=ve+G<0?oe[oe.length-1]:ve+G===oe.length?oe[0]:oe[ve+G]),W&&L.setState("value",W.getAttribute(ns))}function I(G){let Y=he(),ie=Y?.closest(_l),oe;for(;ie&&!oe;)ie=G>0?Sz(ie,_l):_z(ie,_l),oe=ie?.querySelector(Nw);oe?L.setState("value",oe.getAttribute(ns)):P(G)}let ee=()=>R(be().length-1),me=G=>{G.preventDefault(),G.metaKey?ee():G.altKey?I(1):P(1)},Re=G=>{G.preventDefault(),G.metaKey?R(0):G.altKey?I(-1):P(-1)};return p.createElement(vi.div,{ref:t,tabIndex:-1,...D,"cmdk-root":"",onKeyDown:G=>{var Y;(Y=D.onKeyDown)==null||Y.call(D,G);let ie=G.nativeEvent.isComposing||G.keyCode===229;if(!(G.defaultPrevented||ie))switch(G.key){case"n":case"j":{N&&G.ctrlKey&&me(G);break}case"ArrowDown":{me(G);break}case"p":case"k":{N&&G.ctrlKey&&Re(G);break}case"ArrowUp":{Re(G);break}case"Home":{G.preventDefault(),R(0);break}case"End":{G.preventDefault(),ee();break}case"Enter":{G.preventDefault();let oe=he();if(oe){let ve=new Event(hp);oe.dispatchEvent(ve)}}}}},p.createElement("label",{"cmdk-label":"",htmlFor:V.inputId,id:V.labelId,style:jz},g),Pd(e,G=>p.createElement(s1.Provider,{value:L},p.createElement(o1.Provider,{value:V},G))))}),mz=p.forwardRef((e,t)=>{var r,i;let s=Sn(),u=p.useRef(null),d=p.useContext(l1),h=ac(),g=u1(e),y=(i=(r=g.current)==null?void 0:r.forceMount)!=null?i:d?.forceMount;Ji(()=>{if(!y)return h.item(s,d?.id)},[y]);let x=d1(s,u,[e.value,e.children,u],e.keywords),v=Wp(),w=hi(U=>U.value&&U.value===x.current),E=hi(U=>y||h.filter()===!1?!0:U.search?U.filtered.items.get(s)>0:!0);p.useEffect(()=>{let U=u.current;if(!(!U||e.disabled))return U.addEventListener(hp,j),()=>U.removeEventListener(hp,j)},[E,e.onSelect,e.disabled]);function j(){var U,L;S(),(L=(U=g.current).onSelect)==null||L.call(U,x.current)}function S(){v.setState("value",x.current,!0)}if(!E)return null;let{disabled:N,value:D,onSelect:A,forceMount:O,keywords:C,...T}=e;return p.createElement(vi.div,{ref:Mn(u,t),...T,id:s,"cmdk-item":"",role:"option","aria-disabled":!!N,"aria-selected":!!w,"data-disabled":!!N,"data-selected":!!w,onPointerMove:N||h.getDisablePointerSelection()?void 0:S,onClick:N?void 0:j},e.children)}),pz=p.forwardRef((e,t)=>{let{heading:r,children:i,forceMount:s,...u}=e,d=Sn(),h=p.useRef(null),g=p.useRef(null),y=Sn(),x=ac(),v=hi(E=>s||x.filter()===!1?!0:E.search?E.filtered.groups.has(d):!0);Ji(()=>x.group(d),[]),d1(d,h,[e.value,e.heading,g]);let w=p.useMemo(()=>({id:d,forceMount:s}),[s]);return p.createElement(vi.div,{ref:Mn(h,t),...u,"cmdk-group":"",role:"presentation",hidden:v?void 0:!0},r&&p.createElement("div",{ref:g,"cmdk-group-heading":"","aria-hidden":!0,id:y},r),Pd(e,E=>p.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?y:void 0},p.createElement(l1.Provider,{value:w},E))))}),gz=p.forwardRef((e,t)=>{let{alwaysRender:r,...i}=e,s=p.useRef(null),u=hi(d=>!d.search);return!r&&!u?null:p.createElement(vi.div,{ref:Mn(s,t),...i,"cmdk-separator":"",role:"separator"})}),yz=p.forwardRef((e,t)=>{let{onValueChange:r,...i}=e,s=e.value!=null,u=Wp(),d=hi(y=>y.search),h=hi(y=>y.selectedItemId),g=ac();return p.useEffect(()=>{e.value!=null&&u.setState("search",e.value)},[e.value]),p.createElement(vi.input,{ref:t,...i,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":g.listId,"aria-labelledby":g.labelId,"aria-activedescendant":h,id:g.inputId,type:"text",value:s?e.value:d,onChange:y=>{s||u.setState("search",y.target.value),r?.(y.target.value)}})}),vz=p.forwardRef((e,t)=>{let{children:r,label:i="Suggestions",...s}=e,u=p.useRef(null),d=p.useRef(null),h=hi(y=>y.selectedItemId),g=ac();return p.useEffect(()=>{if(d.current&&u.current){let y=d.current,x=u.current,v,w=new ResizeObserver(()=>{v=requestAnimationFrame(()=>{let E=y.offsetHeight;x.style.setProperty("--cmdk-list-height",E.toFixed(1)+"px")})});return w.observe(y),()=>{cancelAnimationFrame(v),w.unobserve(y)}}},[]),p.createElement(vi.div,{ref:Mn(u,t),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":h,"aria-label":i,id:g.listId},Pd(e,y=>p.createElement("div",{ref:Mn(d,g.listInnerRef),"cmdk-list-sizer":""},y)))}),xz=p.forwardRef((e,t)=>{let{open:r,onOpenChange:i,overlayClassName:s,contentClassName:u,container:d,...h}=e;return p.createElement(Dd,{open:r,onOpenChange:i},p.createElement(Md,{container:d},p.createElement(zd,{"cmdk-overlay":"",className:s}),p.createElement(kd,{"aria-label":e.label,"cmdk-dialog":"",className:u},p.createElement(c1,{ref:t,...h}))))}),bz=p.forwardRef((e,t)=>hi(r=>r.filtered.count===0)?p.createElement(vi.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),wz=p.forwardRef((e,t)=>{let{progress:r,children:i,label:s="Loading...",...u}=e;return p.createElement(vi.div,{ref:t,...u,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Pd(e,d=>p.createElement("div",{"aria-hidden":!0},d)))}),js=Object.assign(c1,{List:vz,Item:mz,Input:yz,Group:pz,Separator:gz,Dialog:xz,Empty:bz,Loading:wz});function Sz(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function _z(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function u1(e){let t=p.useRef(e);return Ji(()=>{t.current=e}),t}var Ji=typeof window>"u"?p.useEffect:p.useLayoutEffect;function as(e){let t=p.useRef();return t.current===void 0&&(t.current=e()),t}function hi(e){let t=Wp(),r=()=>e(t.snapshot());return p.useSyncExternalStore(t.subscribe,r,r)}function d1(e,t,r,i=[]){let s=p.useRef(),u=ac();return Ji(()=>{var d;let h=(()=>{var y;for(let x of r){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(y=x.current.textContent)==null?void 0:y.trim():s.current}})(),g=i.map(y=>y.trim());u.value(e,h,g),(d=t.current)==null||d.setAttribute(ns,h),s.current=h}),s}var Ez=()=>{let[e,t]=p.useState(),r=as(()=>new Map);return Ji(()=>{r.current.forEach(i=>i()),r.current=new Map},[e]),(i,s)=>{r.current.set(i,s),t({})}};function Cz(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&&p.isValidElement(t)?p.cloneElement(Cz(t),{ref:t.ref},r(t.props.children)):r(t)}var jz={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};function Et({...e}){return l.jsx(Dd,{"data-slot":"dialog",...e})}function or({...e}){return l.jsx(r1,{"data-slot":"dialog-trigger",...e})}function Rz({...e}){return l.jsx(Md,{"data-slot":"dialog-portal",...e})}function ud({...e}){return l.jsx(nc,{"data-slot":"dialog-close",...e})}function Oz({className:e,...t}){return l.jsx(zd,{"data-slot":"dialog-overlay",className:de("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function Ct({className:e,children:t,showCloseButton:r=!0,...i}){return l.jsxs(Rz,{"data-slot":"dialog-portal",children:[l.jsx(Oz,{}),l.jsxs(kd,{"data-slot":"dialog-content",className:de("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 p-6 shadow-lg duration-200 sm:max-w-lg",e),...i,children:[t,r&&l.jsxs(nc,{"data-slot":"dialog-close",className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",children:[l.jsx($p,{}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function jt({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-header",className:de("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Mt({className:e,...t}){return l.jsx("div",{"data-slot":"dialog-footer",className:de("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function Rt({className:e,...t}){return l.jsx(Qp,{"data-slot":"dialog-title",className:de("text-lg leading-none font-semibold",e),...t})}function Im({className:e,...t}){return l.jsx(Jp,{"data-slot":"dialog-description",className:de("text-muted-foreground text-sm",e),...t})}function Nz({className:e,...t}){return l.jsx(js,{"data-slot":"command",className:de("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...t})}function Az({className:e,...t}){return l.jsxs("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[l.jsx(zr,{className:"size-4 shrink-0 opacity-50"}),l.jsx(js.Input,{"data-slot":"command-input",className:de("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...t})]})}function Tz({className:e,...t}){return l.jsx(js.List,{"data-slot":"command-list",className:de("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...t})}function Dz({...e}){return l.jsx(js.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function Mz({className:e,...t}){return l.jsx(js.Group,{"data-slot":"command-group",className:de("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...t})}function zz({className:e,...t}){return l.jsx(js.Item,{"data-slot":"command-item",className:de("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground 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 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...t})}const kz=["top","right","bottom","left"],mi=Math.min,ia=Math.max,dd=Math.round,Lu=Math.floor,ir=e=>({x:e,y:e}),Pz={left:"right",right:"left",bottom:"top",top:"bottom"},Kz={start:"end",end:"start"};function mp(e,t,r){return ia(e,mi(t,r))}function kr(e,t){return typeof e=="function"?e(t):e}function Pr(e){return e.split("-")[0]}function Rs(e){return e.split("-")[1]}function eg(e){return e==="x"?"y":"x"}function tg(e){return e==="y"?"height":"width"}const Iz=new Set(["top","bottom"]);function rr(e){return Iz.has(Pr(e))?"y":"x"}function ng(e){return eg(rr(e))}function Lz(e,t,r){r===void 0&&(r=!1);const i=Rs(e),s=ng(e),u=tg(s);let d=s==="x"?i===(r?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[u]>t.floating[u]&&(d=fd(d)),[d,fd(d)]}function Uz(e){const t=fd(e);return[pp(e),t,pp(t)]}function pp(e){return e.replace(/start|end/g,t=>Kz[t])}const Aw=["left","right"],Tw=["right","left"],qz=["top","bottom"],Fz=["bottom","top"];function $z(e,t,r){switch(e){case"top":case"bottom":return r?t?Tw:Aw:t?Aw:Tw;case"left":case"right":return t?qz:Fz;default:return[]}}function Vz(e,t,r,i){const s=Rs(e);let u=$z(Pr(e),r==="start",i);return s&&(u=u.map(d=>d+"-"+s),t&&(u=u.concat(u.map(pp)))),u}function fd(e){return e.replace(/left|right|bottom|top/g,t=>Pz[t])}function Hz(e){return{top:0,right:0,bottom:0,left:0,...e}}function f1(e){return typeof e!="number"?Hz(e):{top:e,right:e,bottom:e,left:e}}function hd(e){const{x:t,y:r,width:i,height:s}=e;return{width:i,height:s,top:r,left:t,right:t+i,bottom:r+s,x:t,y:r}}function Dw(e,t,r){let{reference:i,floating:s}=e;const u=rr(t),d=ng(t),h=tg(d),g=Pr(t),y=u==="y",x=i.x+i.width/2-s.width/2,v=i.y+i.height/2-s.height/2,w=i[h]/2-s[h]/2;let E;switch(g){case"top":E={x,y:i.y-s.height};break;case"bottom":E={x,y:i.y+i.height};break;case"right":E={x:i.x+i.width,y:v};break;case"left":E={x:i.x-s.width,y:v};break;default:E={x:i.x,y:i.y}}switch(Rs(t)){case"start":E[d]-=w*(r&&y?-1:1);break;case"end":E[d]+=w*(r&&y?-1:1);break}return E}const Bz=async(e,t,r)=>{const{placement:i="bottom",strategy:s="absolute",middleware:u=[],platform:d}=r,h=u.filter(Boolean),g=await(d.isRTL==null?void 0:d.isRTL(t));let y=await d.getElementRects({reference:e,floating:t,strategy:s}),{x,y:v}=Dw(y,i,g),w=i,E={},j=0;for(let S=0;S({name:"arrow",options:e,async fn(t){const{x:r,y:i,placement:s,rects:u,platform:d,elements:h,middlewareData:g}=t,{element:y,padding:x=0}=kr(e,t)||{};if(y==null)return{};const v=f1(x),w={x:r,y:i},E=ng(s),j=tg(E),S=await d.getDimensions(y),N=E==="y",D=N?"top":"left",A=N?"bottom":"right",O=N?"clientHeight":"clientWidth",C=u.reference[j]+u.reference[E]-w[E]-u.floating[j],T=w[E]-u.reference[E],U=await(d.getOffsetParent==null?void 0:d.getOffsetParent(y));let L=U?U[O]:0;(!L||!await(d.isElement==null?void 0:d.isElement(U)))&&(L=h.floating[O]||u.floating[j]);const V=C/2-T/2,fe=L/2-S[j]/2-1,ge=mi(v[D],fe),pe=mi(v[A],fe),ae=ge,le=L-S[j]-pe,he=L/2-S[j]/2+V,be=mp(ae,he,le),R=!g.arrow&&Rs(s)!=null&&he!==be&&u.reference[j]/2-(hehe<=0)){var pe,ae;const he=(((pe=u.flip)==null?void 0:pe.index)||0)+1,be=L[he];if(be&&(!(v==="alignment"?A!==rr(be):!1)||ge.every(I=>rr(I.placement)===A?I.overflows[0]>0:!0)))return{data:{index:he,overflows:ge},reset:{placement:be}};let R=(ae=ge.filter(P=>P.overflows[0]<=0).sort((P,I)=>P.overflows[1]-I.overflows[1])[0])==null?void 0:ae.placement;if(!R)switch(E){case"bestFit":{var le;const P=(le=ge.filter(I=>{if(U){const ee=rr(I.placement);return ee===A||ee==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(ee=>ee>0).reduce((ee,me)=>ee+me,0)]).sort((I,ee)=>I[1]-ee[1])[0])==null?void 0:le[0];P&&(R=P);break}case"initialPlacement":R=h;break}if(s!==R)return{reset:{placement:R}}}return{}}}};function Mw(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function zw(e){return kz.some(t=>e[t]>=0)}const Zz=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:i="referenceHidden",...s}=kr(e,t);switch(i){case"referenceHidden":{const u=await Bl(t,{...s,elementContext:"reference"}),d=Mw(u,r.reference);return{data:{referenceHiddenOffsets:d,referenceHidden:zw(d)}}}case"escaped":{const u=await Bl(t,{...s,altBoundary:!0}),d=Mw(u,r.floating);return{data:{escapedOffsets:d,escaped:zw(d)}}}default:return{}}}}},h1=new Set(["left","top"]);async function Yz(e,t){const{placement:r,platform:i,elements:s}=e,u=await(i.isRTL==null?void 0:i.isRTL(s.floating)),d=Pr(r),h=Rs(r),g=rr(r)==="y",y=h1.has(d)?-1:1,x=u&&g?-1:1,v=kr(t,e);let{mainAxis:w,crossAxis:E,alignmentAxis:j}=typeof v=="number"?{mainAxis:v,crossAxis:0,alignmentAxis:null}:{mainAxis:v.mainAxis||0,crossAxis:v.crossAxis||0,alignmentAxis:v.alignmentAxis};return h&&typeof j=="number"&&(E=h==="end"?j*-1:j),g?{x:E*x,y:w*y}:{x:w*y,y:E*x}}const Qz=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,i;const{x:s,y:u,placement:d,middlewareData:h}=t,g=await Yz(t,e);return d===((r=h.offset)==null?void 0:r.placement)&&(i=h.arrow)!=null&&i.alignmentOffset?{}:{x:s+g.x,y:u+g.y,data:{...g,placement:d}}}}},Jz=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:i,placement:s}=t,{mainAxis:u=!0,crossAxis:d=!1,limiter:h={fn:N=>{let{x:D,y:A}=N;return{x:D,y:A}}},...g}=kr(e,t),y={x:r,y:i},x=await Bl(t,g),v=rr(Pr(s)),w=eg(v);let E=y[w],j=y[v];if(u){const N=w==="y"?"top":"left",D=w==="y"?"bottom":"right",A=E+x[N],O=E-x[D];E=mp(A,E,O)}if(d){const N=v==="y"?"top":"left",D=v==="y"?"bottom":"right",A=j+x[N],O=j-x[D];j=mp(A,j,O)}const S=h.fn({...t,[w]:E,[v]:j});return{...S,data:{x:S.x-r,y:S.y-i,enabled:{[w]:u,[v]:d}}}}}},Wz=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:i,placement:s,rects:u,middlewareData:d}=t,{offset:h=0,mainAxis:g=!0,crossAxis:y=!0}=kr(e,t),x={x:r,y:i},v=rr(s),w=eg(v);let E=x[w],j=x[v];const S=kr(h,t),N=typeof S=="number"?{mainAxis:S,crossAxis:0}:{mainAxis:0,crossAxis:0,...S};if(g){const O=w==="y"?"height":"width",C=u.reference[w]-u.floating[O]+N.mainAxis,T=u.reference[w]+u.reference[O]-N.mainAxis;ET&&(E=T)}if(y){var D,A;const O=w==="y"?"width":"height",C=h1.has(Pr(s)),T=u.reference[v]-u.floating[O]+(C&&((D=d.offset)==null?void 0:D[v])||0)+(C?0:N.crossAxis),U=u.reference[v]+u.reference[O]+(C?0:((A=d.offset)==null?void 0:A[v])||0)-(C?N.crossAxis:0);jU&&(j=U)}return{[w]:E,[v]:j}}}},e4=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,i;const{placement:s,rects:u,platform:d,elements:h}=t,{apply:g=()=>{},...y}=kr(e,t),x=await Bl(t,y),v=Pr(s),w=Rs(s),E=rr(s)==="y",{width:j,height:S}=u.floating;let N,D;v==="top"||v==="bottom"?(N=v,D=w===(await(d.isRTL==null?void 0:d.isRTL(h.floating))?"start":"end")?"left":"right"):(D=v,N=w==="end"?"top":"bottom");const A=S-x.top-x.bottom,O=j-x.left-x.right,C=mi(S-x[N],A),T=mi(j-x[D],O),U=!t.middlewareData.shift;let L=C,V=T;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(V=O),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(L=A),U&&!w){const ge=ia(x.left,0),pe=ia(x.right,0),ae=ia(x.top,0),le=ia(x.bottom,0);E?V=j-2*(ge!==0||pe!==0?ge+pe:ia(x.left,x.right)):L=S-2*(ae!==0||le!==0?ae+le:ia(x.top,x.bottom))}await g({...t,availableWidth:V,availableHeight:L});const fe=await d.getDimensions(h.floating);return j!==fe.width||S!==fe.height?{reset:{rects:!0}}:{}}}};function Kd(){return typeof window<"u"}function Os(e){return m1(e)?(e.nodeName||"").toLowerCase():"#document"}function sa(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dr(e){var t;return(t=(m1(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function m1(e){return Kd()?e instanceof Node||e instanceof sa(e).Node:!1}function $a(e){return Kd()?e instanceof Element||e instanceof sa(e).Element:!1}function sr(e){return Kd()?e instanceof HTMLElement||e instanceof sa(e).HTMLElement:!1}function kw(e){return!Kd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof sa(e).ShadowRoot}const t4=new Set(["inline","contents"]);function rc(e){const{overflow:t,overflowX:r,overflowY:i,display:s}=Va(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+r)&&!t4.has(s)}const n4=new Set(["table","td","th"]);function a4(e){return n4.has(Os(e))}const r4=[":popover-open",":modal"];function Id(e){return r4.some(t=>{try{return e.matches(t)}catch{return!1}})}const i4=["transform","translate","scale","rotate","perspective"],o4=["transform","translate","scale","rotate","perspective","filter"],s4=["paint","layout","strict","content"];function ag(e){const t=rg(),r=$a(e)?Va(e):e;return i4.some(i=>r[i]?r[i]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||o4.some(i=>(r.willChange||"").includes(i))||s4.some(i=>(r.contain||"").includes(i))}function l4(e){let t=pi(e);for(;sr(t)&&!gs(t);){if(ag(t))return t;if(Id(t))return null;t=pi(t)}return null}function rg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const c4=new Set(["html","body","#document"]);function gs(e){return c4.has(Os(e))}function Va(e){return sa(e).getComputedStyle(e)}function Ld(e){return $a(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function pi(e){if(Os(e)==="html")return e;const t=e.assignedSlot||e.parentNode||kw(e)&&e.host||dr(e);return kw(t)?t.host:t}function p1(e){const t=pi(e);return gs(t)?e.ownerDocument?e.ownerDocument.body:e.body:sr(t)&&rc(t)?t:p1(t)}function Gl(e,t,r){var i;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=p1(e),u=s===((i=e.ownerDocument)==null?void 0:i.body),d=sa(s);if(u){const h=gp(d);return t.concat(d,d.visualViewport||[],rc(s)?s:[],h&&r?Gl(h):[])}return t.concat(s,Gl(s,[],r))}function gp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function g1(e){const t=Va(e);let r=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const s=sr(e),u=s?e.offsetWidth:r,d=s?e.offsetHeight:i,h=dd(r)!==u||dd(i)!==d;return h&&(r=u,i=d),{width:r,height:i,$:h}}function ig(e){return $a(e)?e:e.contextElement}function fs(e){const t=ig(e);if(!sr(t))return ir(1);const r=t.getBoundingClientRect(),{width:i,height:s,$:u}=g1(t);let d=(u?dd(r.width):r.width)/i,h=(u?dd(r.height):r.height)/s;return(!d||!Number.isFinite(d))&&(d=1),(!h||!Number.isFinite(h))&&(h=1),{x:d,y:h}}const u4=ir(0);function y1(e){const t=sa(e);return!rg()||!t.visualViewport?u4:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function d4(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==sa(e)?!1:t}function Wi(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),u=ig(e);let d=ir(1);t&&(i?$a(i)&&(d=fs(i)):d=fs(e));const h=d4(u,r,i)?y1(u):ir(0);let g=(s.left+h.x)/d.x,y=(s.top+h.y)/d.y,x=s.width/d.x,v=s.height/d.y;if(u){const w=sa(u),E=i&&$a(i)?sa(i):i;let j=w,S=gp(j);for(;S&&i&&E!==j;){const N=fs(S),D=S.getBoundingClientRect(),A=Va(S),O=D.left+(S.clientLeft+parseFloat(A.paddingLeft))*N.x,C=D.top+(S.clientTop+parseFloat(A.paddingTop))*N.y;g*=N.x,y*=N.y,x*=N.x,v*=N.y,g+=O,y+=C,j=sa(S),S=gp(j)}}return hd({width:x,height:v,x:g,y})}function Ud(e,t){const r=Ld(e).scrollLeft;return t?t.left+r:Wi(dr(e)).left+r}function v1(e,t){const r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-Ud(e,r),s=r.top+t.scrollTop;return{x:i,y:s}}function f4(e){let{elements:t,rect:r,offsetParent:i,strategy:s}=e;const u=s==="fixed",d=dr(i),h=t?Id(t.floating):!1;if(i===d||h&&u)return r;let g={scrollLeft:0,scrollTop:0},y=ir(1);const x=ir(0),v=sr(i);if((v||!v&&!u)&&((Os(i)!=="body"||rc(d))&&(g=Ld(i)),sr(i))){const E=Wi(i);y=fs(i),x.x=E.x+i.clientLeft,x.y=E.y+i.clientTop}const w=d&&!v&&!u?v1(d,g):ir(0);return{width:r.width*y.x,height:r.height*y.y,x:r.x*y.x-g.scrollLeft*y.x+x.x+w.x,y:r.y*y.y-g.scrollTop*y.y+x.y+w.y}}function h4(e){return Array.from(e.getClientRects())}function m4(e){const t=dr(e),r=Ld(e),i=e.ownerDocument.body,s=ia(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),u=ia(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let d=-r.scrollLeft+Ud(e);const h=-r.scrollTop;return Va(i).direction==="rtl"&&(d+=ia(t.clientWidth,i.clientWidth)-s),{width:s,height:u,x:d,y:h}}const Pw=25;function p4(e,t){const r=sa(e),i=dr(e),s=r.visualViewport;let u=i.clientWidth,d=i.clientHeight,h=0,g=0;if(s){u=s.width,d=s.height;const x=rg();(!x||x&&t==="fixed")&&(h=s.offsetLeft,g=s.offsetTop)}const y=Ud(i);if(y<=0){const x=i.ownerDocument,v=x.body,w=getComputedStyle(v),E=x.compatMode==="CSS1Compat"&&parseFloat(w.marginLeft)+parseFloat(w.marginRight)||0,j=Math.abs(i.clientWidth-v.clientWidth-E);j<=Pw&&(u-=j)}else y<=Pw&&(u+=y);return{width:u,height:d,x:h,y:g}}const g4=new Set(["absolute","fixed"]);function y4(e,t){const r=Wi(e,!0,t==="fixed"),i=r.top+e.clientTop,s=r.left+e.clientLeft,u=sr(e)?fs(e):ir(1),d=e.clientWidth*u.x,h=e.clientHeight*u.y,g=s*u.x,y=i*u.y;return{width:d,height:h,x:g,y}}function Kw(e,t,r){let i;if(t==="viewport")i=p4(e,r);else if(t==="document")i=m4(dr(e));else if($a(t))i=y4(t,r);else{const s=y1(e);i={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return hd(i)}function x1(e,t){const r=pi(e);return r===t||!$a(r)||gs(r)?!1:Va(r).position==="fixed"||x1(r,t)}function v4(e,t){const r=t.get(e);if(r)return r;let i=Gl(e,[],!1).filter(h=>$a(h)&&Os(h)!=="body"),s=null;const u=Va(e).position==="fixed";let d=u?pi(e):e;for(;$a(d)&&!gs(d);){const h=Va(d),g=ag(d);!g&&h.position==="fixed"&&(s=null),(u?!g&&!s:!g&&h.position==="static"&&!!s&&g4.has(s.position)||rc(d)&&!g&&x1(e,d))?i=i.filter(x=>x!==d):s=h,d=pi(d)}return t.set(e,i),i}function x4(e){let{element:t,boundary:r,rootBoundary:i,strategy:s}=e;const d=[...r==="clippingAncestors"?Id(t)?[]:v4(t,this._c):[].concat(r),i],h=d[0],g=d.reduce((y,x)=>{const v=Kw(t,x,s);return y.top=ia(v.top,y.top),y.right=mi(v.right,y.right),y.bottom=mi(v.bottom,y.bottom),y.left=ia(v.left,y.left),y},Kw(t,h,s));return{width:g.right-g.left,height:g.bottom-g.top,x:g.left,y:g.top}}function b4(e){const{width:t,height:r}=g1(e);return{width:t,height:r}}function w4(e,t,r){const i=sr(t),s=dr(t),u=r==="fixed",d=Wi(e,!0,u,t);let h={scrollLeft:0,scrollTop:0};const g=ir(0);function y(){g.x=Ud(s)}if(i||!i&&!u)if((Os(t)!=="body"||rc(s))&&(h=Ld(t)),i){const E=Wi(t,!0,u,t);g.x=E.x+t.clientLeft,g.y=E.y+t.clientTop}else s&&y();u&&!i&&s&&y();const x=s&&!i&&!u?v1(s,h):ir(0),v=d.left+h.scrollLeft-g.x-x.x,w=d.top+h.scrollTop-g.y-x.y;return{x:v,y:w,width:d.width,height:d.height}}function Lm(e){return Va(e).position==="static"}function Iw(e,t){if(!sr(e)||Va(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return dr(e)===r&&(r=r.ownerDocument.body),r}function b1(e,t){const r=sa(e);if(Id(e))return r;if(!sr(e)){let s=pi(e);for(;s&&!gs(s);){if($a(s)&&!Lm(s))return s;s=pi(s)}return r}let i=Iw(e,t);for(;i&&a4(i)&&Lm(i);)i=Iw(i,t);return i&&gs(i)&&Lm(i)&&!ag(i)?r:i||l4(e)||r}const S4=async function(e){const t=this.getOffsetParent||b1,r=this.getDimensions,i=await r(e.floating);return{reference:w4(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function _4(e){return Va(e).direction==="rtl"}const E4={convertOffsetParentRelativeRectToViewportRelativeRect:f4,getDocumentElement:dr,getClippingRect:x4,getOffsetParent:b1,getElementRects:S4,getClientRects:h4,getDimensions:b4,getScale:fs,isElement:$a,isRTL:_4};function w1(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function C4(e,t){let r=null,i;const s=dr(e);function u(){var h;clearTimeout(i),(h=r)==null||h.disconnect(),r=null}function d(h,g){h===void 0&&(h=!1),g===void 0&&(g=1),u();const y=e.getBoundingClientRect(),{left:x,top:v,width:w,height:E}=y;if(h||t(),!w||!E)return;const j=Lu(v),S=Lu(s.clientWidth-(x+w)),N=Lu(s.clientHeight-(v+E)),D=Lu(x),O={rootMargin:-j+"px "+-S+"px "+-N+"px "+-D+"px",threshold:ia(0,mi(1,g))||1};let C=!0;function T(U){const L=U[0].intersectionRatio;if(L!==g){if(!C)return d();L?d(!1,L):i=setTimeout(()=>{d(!1,1e-7)},1e3)}L===1&&!w1(y,e.getBoundingClientRect())&&d(),C=!1}try{r=new IntersectionObserver(T,{...O,root:s.ownerDocument})}catch{r=new IntersectionObserver(T,O)}r.observe(e)}return d(!0),u}function j4(e,t,r,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:u=!0,elementResize:d=typeof ResizeObserver=="function",layoutShift:h=typeof IntersectionObserver=="function",animationFrame:g=!1}=i,y=ig(e),x=s||u?[...y?Gl(y):[],...Gl(t)]:[];x.forEach(D=>{s&&D.addEventListener("scroll",r,{passive:!0}),u&&D.addEventListener("resize",r)});const v=y&&h?C4(y,r):null;let w=-1,E=null;d&&(E=new ResizeObserver(D=>{let[A]=D;A&&A.target===y&&E&&(E.unobserve(t),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var O;(O=E)==null||O.observe(t)})),r()}),y&&!g&&E.observe(y),E.observe(t));let j,S=g?Wi(e):null;g&&N();function N(){const D=Wi(e);S&&!w1(S,D)&&r(),S=D,j=requestAnimationFrame(N)}return r(),()=>{var D;x.forEach(A=>{s&&A.removeEventListener("scroll",r),u&&A.removeEventListener("resize",r)}),v?.(),(D=E)==null||D.disconnect(),E=null,g&&cancelAnimationFrame(j)}}const R4=Qz,O4=Jz,N4=Xz,A4=e4,T4=Zz,Lw=Gz,D4=Wz,M4=(e,t,r)=>{const i=new Map,s={platform:E4,...r},u={...s.platform,_c:i};return Bz(e,t,{...s,platform:u})};var z4=typeof document<"u",k4=function(){},ed=z4?p.useLayoutEffect:k4;function md(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,s;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(!md(e[i],t[i]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!{}.hasOwnProperty.call(t,s[i]))return!1;for(i=r;i--!==0;){const u=s[i];if(!(u==="_owner"&&e.$$typeof)&&!md(e[u],t[u]))return!1}return!0}return e!==e&&t!==t}function S1(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Uw(e,t){const r=S1(e);return Math.round(t*r)/r}function Um(e){const t=p.useRef(e);return ed(()=>{t.current=e}),t}function P4(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:i=[],platform:s,elements:{reference:u,floating:d}={},transform:h=!0,whileElementsMounted:g,open:y}=e,[x,v]=p.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[w,E]=p.useState(i);md(w,i)||E(i);const[j,S]=p.useState(null),[N,D]=p.useState(null),A=p.useCallback(I=>{I!==U.current&&(U.current=I,S(I))},[]),O=p.useCallback(I=>{I!==L.current&&(L.current=I,D(I))},[]),C=u||j,T=d||N,U=p.useRef(null),L=p.useRef(null),V=p.useRef(x),fe=g!=null,ge=Um(g),pe=Um(s),ae=Um(y),le=p.useCallback(()=>{if(!U.current||!L.current)return;const I={placement:t,strategy:r,middleware:w};pe.current&&(I.platform=pe.current),M4(U.current,L.current,I).then(ee=>{const me={...ee,isPositioned:ae.current!==!1};he.current&&!md(V.current,me)&&(V.current=me,Ed.flushSync(()=>{v(me)}))})},[w,t,r,pe,ae]);ed(()=>{y===!1&&V.current.isPositioned&&(V.current.isPositioned=!1,v(I=>({...I,isPositioned:!1})))},[y]);const he=p.useRef(!1);ed(()=>(he.current=!0,()=>{he.current=!1}),[]),ed(()=>{if(C&&(U.current=C),T&&(L.current=T),C&&T){if(ge.current)return ge.current(C,T,le);le()}},[C,T,le,ge,fe]);const be=p.useMemo(()=>({reference:U,floating:L,setReference:A,setFloating:O}),[A,O]),R=p.useMemo(()=>({reference:C,floating:T}),[C,T]),P=p.useMemo(()=>{const I={position:r,left:0,top:0};if(!R.floating)return I;const ee=Uw(R.floating,x.x),me=Uw(R.floating,x.y);return h?{...I,transform:"translate("+ee+"px, "+me+"px)",...S1(R.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:ee,top:me}},[r,h,R.floating,x.x,x.y]);return p.useMemo(()=>({...x,update:le,refs:be,elements:R,floatingStyles:P}),[x,le,be,R,P])}const K4=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:i,padding:s}=typeof e=="function"?e(r):e;return i&&t(i)?i.current!=null?Lw({element:i.current,padding:s}).fn(r):{}:i?Lw({element:i,padding:s}).fn(r):{}}}},I4=(e,t)=>({...R4(e),options:[e,t]}),L4=(e,t)=>({...O4(e),options:[e,t]}),U4=(e,t)=>({...D4(e),options:[e,t]}),q4=(e,t)=>({...N4(e),options:[e,t]}),F4=(e,t)=>({...A4(e),options:[e,t]}),$4=(e,t)=>({...T4(e),options:[e,t]}),V4=(e,t)=>({...K4(e),options:[e,t]});var H4="Arrow",_1=p.forwardRef((e,t)=>{const{children:r,width:i=10,height:s=5,...u}=e;return l.jsx(rt.svg,{...u,ref:t,width:i,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});_1.displayName=H4;var B4=_1;function G4(e){const[t,r]=p.useState(void 0);return on(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const u=s[0];let d,h;if("borderBoxSize"in u){const g=u.borderBoxSize,y=Array.isArray(g)?g[0]:g;d=y.inlineSize,h=y.blockSize}else d=e.offsetWidth,h=e.offsetHeight;r({width:d,height:h})});return i.observe(e,{box:"border-box"}),()=>i.unobserve(e)}else r(void 0)},[e]),t}var og="Popper",[E1,xi]=ur(og),[X4,C1]=E1(og),j1=e=>{const{__scopePopper:t,children:r}=e,[i,s]=p.useState(null);return l.jsx(X4,{scope:t,anchor:i,onAnchorChange:s,children:r})};j1.displayName=og;var R1="PopperAnchor",O1=p.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:i,...s}=e,u=C1(R1,r),d=p.useRef(null),h=dt(t,d),g=p.useRef(null);return p.useEffect(()=>{const y=g.current;g.current=i?.current||d.current,y!==g.current&&u.onAnchorChange(g.current)}),i?null:l.jsx(rt.div,{...s,ref:h})});O1.displayName=R1;var sg="PopperContent",[Z4,Y4]=E1(sg),N1=p.forwardRef((e,t)=>{const{__scopePopper:r,side:i="bottom",sideOffset:s=0,align:u="center",alignOffset:d=0,arrowPadding:h=0,avoidCollisions:g=!0,collisionBoundary:y=[],collisionPadding:x=0,sticky:v="partial",hideWhenDetached:w=!1,updatePositionStrategy:E="optimized",onPlaced:j,...S}=e,N=C1(sg,r),[D,A]=p.useState(null),O=dt(t,W=>A(W)),[C,T]=p.useState(null),U=G4(C),L=U?.width??0,V=U?.height??0,fe=i+(u!=="center"?"-"+u:""),ge=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},pe=Array.isArray(y)?y:[y],ae=pe.length>0,le={padding:ge,boundary:pe.filter(J4),altBoundary:ae},{refs:he,floatingStyles:be,placement:R,isPositioned:P,middlewareData:I}=P4({strategy:"fixed",placement:fe,whileElementsMounted:(...W)=>j4(...W,{animationFrame:E==="always"}),elements:{reference:N.anchor},middleware:[I4({mainAxis:s+V,alignmentAxis:d}),g&&L4({mainAxis:!0,crossAxis:!1,limiter:v==="partial"?U4():void 0,...le}),g&&q4({...le}),F4({...le,apply:({elements:W,rects:xe,availableWidth:Oe,availableHeight:Ue})=>{const{width:Ye,height:Ze}=xe.reference,Kt=W.floating.style;Kt.setProperty("--radix-popper-available-width",`${Oe}px`),Kt.setProperty("--radix-popper-available-height",`${Ue}px`),Kt.setProperty("--radix-popper-anchor-width",`${Ye}px`),Kt.setProperty("--radix-popper-anchor-height",`${Ze}px`)}}),C&&V4({element:C,padding:h}),W4({arrowWidth:L,arrowHeight:V}),w&&$4({strategy:"referenceHidden",...le})]}),[ee,me]=D1(R),Re=Fa(j);on(()=>{P&&Re?.()},[P,Re]);const G=I.arrow?.x,Y=I.arrow?.y,ie=I.arrow?.centerOffset!==0,[oe,ve]=p.useState();return on(()=>{D&&ve(window.getComputedStyle(D).zIndex)},[D]),l.jsx("div",{ref:he.setFloating,"data-radix-popper-content-wrapper":"",style:{...be,transform:P?be.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:oe,"--radix-popper-transform-origin":[I.transformOrigin?.x,I.transformOrigin?.y].join(" "),...I.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(Z4,{scope:r,placedSide:ee,onArrowChange:T,arrowX:G,arrowY:Y,shouldHideArrow:ie,children:l.jsx(rt.div,{"data-side":ee,"data-align":me,...S,ref:O,style:{...S.style,animation:P?void 0:"none"}})})})});N1.displayName=sg;var A1="PopperArrow",Q4={top:"bottom",right:"left",bottom:"top",left:"right"},T1=p.forwardRef(function(t,r){const{__scopePopper:i,...s}=t,u=Y4(A1,i),d=Q4[u.placedSide];return l.jsx("span",{ref:u.onArrowChange,style:{position:"absolute",left:u.arrowX,top:u.arrowY,[d]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[u.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[u.placedSide],visibility:u.shouldHideArrow?"hidden":void 0},children:l.jsx(B4,{...s,ref:r,style:{...s.style,display:"block"}})})});T1.displayName=A1;function J4(e){return e!==null}var W4=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:i,middlewareData:s}=t,d=s.arrow?.centerOffset!==0,h=d?0:e.arrowWidth,g=d?0:e.arrowHeight,[y,x]=D1(r),v={start:"0%",center:"50%",end:"100%"}[x],w=(s.arrow?.x??0)+h/2,E=(s.arrow?.y??0)+g/2;let j="",S="";return y==="bottom"?(j=d?v:`${w}px`,S=`${-g}px`):y==="top"?(j=d?v:`${w}px`,S=`${i.floating.height+g}px`):y==="right"?(j=`${-g}px`,S=d?v:`${E}px`):y==="left"&&(j=`${i.floating.width+g}px`,S=d?v:`${E}px`),{data:{x:j,y:S}}}});function D1(e){const[t,r="center"]=e.split("-");return[t,r]}var qd=j1,ic=O1,Fd=N1,$d=T1;function ek(e){const t=tk(e),r=p.forwardRef((i,s)=>{const{children:u,...d}=i,h=p.Children.toArray(u),g=h.find(ak);if(g){const y=g.props.children,x=h.map(v=>v===g?p.Children.count(y)>1?p.Children.only(null):p.isValidElement(y)?y.props.children:null:v);return l.jsx(t,{...d,ref:s,children:p.isValidElement(y)?p.cloneElement(y,void 0,x):null})}return l.jsx(t,{...d,ref:s,children:u})});return r.displayName=`${e}.Slot`,r}function tk(e){const t=p.forwardRef((r,i)=>{const{children:s,...u}=r;if(p.isValidElement(s)){const d=ik(s),h=rk(u,s.props);return s.type!==p.Fragment&&(h.ref=i?Mn(i,d):d),p.cloneElement(s,h)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var nk=Symbol("radix.slottable");function ak(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===nk}function rk(e,t){const r={...t};for(const i in t){const s=e[i],u=t[i];/^on[A-Z]/.test(i)?s&&u?r[i]=(...h)=>{const g=u(...h);return s(...h),g}:s&&(r[i]=s):i==="style"?r[i]={...s,...u}:i==="className"&&(r[i]=[s,u].filter(Boolean).join(" "))}return{...e,...r}}function ik(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)}var Vd="Popover",[M1]=ur(Vd,[xi]),oc=xi(),[ok,bi]=M1(Vd),z1=e=>{const{__scopePopover:t,children:r,open:i,defaultOpen:s,onOpenChange:u,modal:d=!1}=e,h=oc(t),g=p.useRef(null),[y,x]=p.useState(!1),[v,w]=Yi({prop:i,defaultProp:s??!1,onChange:u,caller:Vd});return l.jsx(qd,{...h,children:l.jsx(ok,{scope:t,contentId:Sn(),triggerRef:g,open:v,onOpenChange:w,onOpenToggle:p.useCallback(()=>w(E=>!E),[w]),hasCustomAnchor:y,onCustomAnchorAdd:p.useCallback(()=>x(!0),[]),onCustomAnchorRemove:p.useCallback(()=>x(!1),[]),modal:d,children:r})})};z1.displayName=Vd;var k1="PopoverAnchor",sk=p.forwardRef((e,t)=>{const{__scopePopover:r,...i}=e,s=bi(k1,r),u=oc(r),{onCustomAnchorAdd:d,onCustomAnchorRemove:h}=s;return p.useEffect(()=>(d(),()=>h()),[d,h]),l.jsx(ic,{...u,...i,ref:t})});sk.displayName=k1;var P1="PopoverTrigger",K1=p.forwardRef((e,t)=>{const{__scopePopover:r,...i}=e,s=bi(P1,r),u=oc(r),d=dt(t,s.triggerRef),h=l.jsx(rt.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":F1(s.open),...i,ref:d,onClick:Ce(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?h:l.jsx(ic,{asChild:!0,...u,children:h})});K1.displayName=P1;var lg="PopoverPortal",[lk,ck]=M1(lg,{forceMount:void 0}),I1=e=>{const{__scopePopover:t,forceMount:r,children:i,container:s}=e,u=bi(lg,t);return l.jsx(lk,{scope:t,forceMount:r,children:l.jsx(ja,{present:r||u.open,children:l.jsx(Cs,{asChild:!0,container:s,children:i})})})};I1.displayName=lg;var ys="PopoverContent",L1=p.forwardRef((e,t)=>{const r=ck(ys,e.__scopePopover),{forceMount:i=r.forceMount,...s}=e,u=bi(ys,e.__scopePopover);return l.jsx(ja,{present:i||u.open,children:u.modal?l.jsx(dk,{...s,ref:t}):l.jsx(fk,{...s,ref:t})})});L1.displayName=ys;var uk=ek("PopoverContent.RemoveScroll"),dk=p.forwardRef((e,t)=>{const r=bi(ys,e.__scopePopover),i=p.useRef(null),s=dt(t,i),u=p.useRef(!1);return p.useEffect(()=>{const d=i.current;if(d)return Ad(d)},[]),l.jsx(tc,{as:uk,allowPinchZoom:!0,children:l.jsx(U1,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ce(e.onCloseAutoFocus,d=>{d.preventDefault(),u.current||r.triggerRef.current?.focus()}),onPointerDownOutside:Ce(e.onPointerDownOutside,d=>{const h=d.detail.originalEvent,g=h.button===0&&h.ctrlKey===!0,y=h.button===2||g;u.current=y},{checkForDefaultPrevented:!1}),onFocusOutside:Ce(e.onFocusOutside,d=>d.preventDefault(),{checkForDefaultPrevented:!1})})})}),fk=p.forwardRef((e,t)=>{const r=bi(ys,e.__scopePopover),i=p.useRef(!1),s=p.useRef(!1);return l.jsx(U1,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:u=>{e.onCloseAutoFocus?.(u),u.defaultPrevented||(i.current||r.triggerRef.current?.focus(),u.preventDefault()),i.current=!1,s.current=!1},onInteractOutside:u=>{e.onInteractOutside?.(u),u.defaultPrevented||(i.current=!0,u.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const d=u.target;r.triggerRef.current?.contains(d)&&u.preventDefault(),u.detail.originalEvent.type==="focusin"&&s.current&&u.preventDefault()}})}),U1=p.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:u,disableOutsidePointerEvents:d,onEscapeKeyDown:h,onPointerDownOutside:g,onFocusOutside:y,onInteractOutside:x,...v}=e,w=bi(ys,r),E=oc(r);return Od(),l.jsx(ec,{asChild:!0,loop:!0,trapped:i,onMountAutoFocus:s,onUnmountAutoFocus:u,children:l.jsx(Es,{asChild:!0,disableOutsidePointerEvents:d,onInteractOutside:x,onEscapeKeyDown:h,onPointerDownOutside:g,onFocusOutside:y,onDismiss:()=>w.onOpenChange(!1),children:l.jsx(Fd,{"data-state":F1(w.open),role:"dialog",id:w.contentId,...E,...v,ref:t,style:{...v.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),q1="PopoverClose",hk=p.forwardRef((e,t)=>{const{__scopePopover:r,...i}=e,s=bi(q1,r);return l.jsx(rt.button,{type:"button",...i,ref:t,onClick:Ce(e.onClick,()=>s.onOpenChange(!1))})});hk.displayName=q1;var mk="PopoverArrow",pk=p.forwardRef((e,t)=>{const{__scopePopover:r,...i}=e,s=oc(r);return l.jsx($d,{...s,...i,ref:t})});pk.displayName=mk;function F1(e){return e?"open":"closed"}var gk=z1,yk=K1,vk=I1,xk=L1;function bk({...e}){return l.jsx(gk,{"data-slot":"popover",...e})}function wk({...e}){return l.jsx(yk,{"data-slot":"popover-trigger",...e})}function Sk({className:e,align:t="center",sideOffset:r=4,...i}){return l.jsx(vk,{children:l.jsx(xk,{"data-slot":"popover-content",align:t,sideOffset:r,className:de("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...i})})}const _k=({orgs:e})=>{const[t,r]=p.useState(!1),[i,s]=p.useState(La.get()??"");p.useEffect(()=>La.subscribe(d=>s(d??"")),[]);const u=e.find(d=>d.id===i);return l.jsxs(bk,{open:t,onOpenChange:r,children:[l.jsx(wk,{asChild:!0,children:l.jsxs(se,{variant:"ghost",className:"h-9 w-full justify-between px-2","aria-label":"Switch organization",children:[l.jsxs("span",{className:"flex items-center gap-2 truncate",children:[l.jsx(nS,{className:"h-4 w-4"}),l.jsx("span",{className:"truncate",children:u?.name??"Select org"})]}),l.jsx(YO,{className:"ml-2 h-4 w-4 opacity-50"})]})}),l.jsx(Sk,{className:"w-[280px] p-0",align:"start",children:l.jsxs(Nz,{children:[l.jsx(Az,{placeholder:"Search orgs..."}),l.jsxs(Tz,{children:[l.jsx(Dz,{children:"No orgs found."}),l.jsx(Mz,{heading:"Organizations",children:e.map(d=>l.jsxs(zz,{value:d.id,onSelect:h=>{La.set(h),r(!1)},children:[l.jsx(aS,{className:de("mr-2 h-4 w-4",i===d.id?"opacity-100":"opacity-0")}),l.jsx("span",{className:"truncate",children:d.name})]},d.id))})]})]})})]})};function Ek(){return rn({queryKey:["me"],queryFn:()=>Vi.getMe(),staleTime:300*1e3})}function Ck(e,t=[]){let r=[];function i(u,d){const h=p.createContext(d);h.displayName=u+"Context";const g=r.length;r=[...r,d];const y=v=>{const{scope:w,children:E,...j}=v,S=w?.[e]?.[g]||h,N=p.useMemo(()=>j,Object.values(j));return l.jsx(S.Provider,{value:N,children:E})};y.displayName=u+"Provider";function x(v,w){const E=w?.[e]?.[g]||h,j=p.useContext(E);if(j)return j;if(d!==void 0)return d;throw new Error(`\`${v}\` must be used within \`${u}\``)}return[y,x]}const s=()=>{const u=r.map(d=>p.createContext(d));return function(h){const g=h?.[e]||u;return p.useMemo(()=>({[`__scope${e}`]:{...h,[e]:g}}),[h,g])}};return s.scopeName=e,[i,jk(s,...t)]}function jk(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const i=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(u){const d=i.reduce((h,{useScope:g,scopeName:y})=>{const v=g(u)[`__scope${y}`];return{...h,...v}},{});return p.useMemo(()=>({[`__scope${t.scopeName}`]:d}),[d])}};return r.scopeName=t.scopeName,r}var Rk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],cg=Rk.reduce((e,t)=>{const r=Wl(`Primitive.${t}`),i=p.forwardRef((s,u)=>{const{asChild:d,...h}=s,g=d?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(g,{...h,ref:u})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{}),qm={exports:{}},Fm={};var qw;function Ok(){if(qw)return Fm;qw=1;var e=q0();function t(v,w){return v===w&&(v!==0||1/v===1/w)||v!==v&&w!==w}var r=typeof Object.is=="function"?Object.is:t,i=e.useState,s=e.useEffect,u=e.useLayoutEffect,d=e.useDebugValue;function h(v,w){var E=w(),j=i({inst:{value:E,getSnapshot:w}}),S=j[0].inst,N=j[1];return u(function(){S.value=E,S.getSnapshot=w,g(S)&&N({inst:S})},[v,E,w]),s(function(){return g(S)&&N({inst:S}),v(function(){g(S)&&N({inst:S})})},[v]),d(E),E}function g(v){var w=v.getSnapshot;v=v.value;try{var E=w();return!r(v,E)}catch{return!0}}function y(v,w){return w()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?y:h;return Fm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,Fm}var Fw;function Nk(){return Fw||(Fw=1,qm.exports=Ok()),qm.exports}var Ak=Nk();function Tk(){return Ak.useSyncExternalStore(Dk,()=>!0,()=>!1)}function Dk(){return()=>{}}var ug="Avatar",[Mk]=Ck(ug),[zk,$1]=Mk(ug),V1=p.forwardRef((e,t)=>{const{__scopeAvatar:r,...i}=e,[s,u]=p.useState("idle");return l.jsx(zk,{scope:r,imageLoadingStatus:s,onImageLoadingStatusChange:u,children:l.jsx(cg.span,{...i,ref:t})})});V1.displayName=ug;var H1="AvatarImage",kk=p.forwardRef((e,t)=>{const{__scopeAvatar:r,src:i,onLoadingStatusChange:s=()=>{},...u}=e,d=$1(H1,r),h=Pk(i,u),g=Fa(y=>{s(y),d.onImageLoadingStatusChange(y)});return on(()=>{h!=="idle"&&g(h)},[h,g]),h==="loaded"?l.jsx(cg.img,{...u,ref:t,src:i}):null});kk.displayName=H1;var B1="AvatarFallback",G1=p.forwardRef((e,t)=>{const{__scopeAvatar:r,delayMs:i,...s}=e,u=$1(B1,r),[d,h]=p.useState(i===void 0);return p.useEffect(()=>{if(i!==void 0){const g=window.setTimeout(()=>h(!0),i);return()=>window.clearTimeout(g)}},[i]),d&&u.imageLoadingStatus!=="loaded"?l.jsx(cg.span,{...s,ref:t}):null});G1.displayName=B1;function $w(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function Pk(e,{referrerPolicy:t,crossOrigin:r}){const i=Tk(),s=p.useRef(null),u=i?(s.current||(s.current=new window.Image),s.current):null,[d,h]=p.useState(()=>$w(u,e));return on(()=>{h($w(u,e))},[u,e]),on(()=>{const g=v=>()=>{h(v)};if(!u)return;const y=g("loaded"),x=g("error");return u.addEventListener("load",y),u.addEventListener("error",x),t&&(u.referrerPolicy=t),typeof r=="string"&&(u.crossOrigin=r),()=>{u.removeEventListener("load",y),u.removeEventListener("error",x)}},[u,r,t]),d}var Kk=V1,Ik=G1;function Lk({className:e,...t}){return l.jsx(Kk,{"data-slot":"avatar",className:de("relative flex size-8 shrink-0 overflow-hidden rounded-full",e),...t})}function Uk({className:e,...t}){return l.jsx(Ik,{"data-slot":"avatar-fallback",className:de("bg-muted flex size-full items-center justify-center rounded-full",e),...t})}function qk({...e}){return l.jsx("nav",{"aria-label":"breadcrumb","data-slot":"breadcrumb",...e})}function Fk({className:e,...t}){return l.jsx("ol",{"data-slot":"breadcrumb-list",className:de("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),...t})}function Vw({className:e,...t}){return l.jsx("li",{"data-slot":"breadcrumb-item",className:de("inline-flex items-center gap-1.5",e),...t})}function Hw({asChild:e,className:t,...r}){const i=e?_s:"a";return l.jsx(i,{"data-slot":"breadcrumb-link",className:de("hover:text-foreground transition-colors",t),...r})}function $k({className:e,...t}){return l.jsx("span",{"data-slot":"breadcrumb-page",role:"link","aria-disabled":"true","aria-current":"page",className:de("text-foreground font-normal",e),...t})}function Vk({children:e,className:t,...r}){return l.jsx("li",{"data-slot":"breadcrumb-separator",role:"presentation","aria-hidden":"true",className:de("[&>svg]:size-3.5",t),...r,children:e??l.jsx(BO,{})})}const $m=768;function Hk(){const[e,t]=p.useState(void 0);return p.useEffect(()=>{const r=window.matchMedia(`(max-width: ${$m-1}px)`),i=()=>{t(window.innerWidth<$m)};return r.addEventListener("change",i),t(window.innerWidth<$m),()=>r.removeEventListener("change",i)},[]),!!e}function Fe({className:e,type:t,...r}){return l.jsx("input",{type:t,"data-slot":"input",className:de("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",e),...r})}var Bk=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Gk=Bk.reduce((e,t)=>{const r=Wl(`Primitive.${t}`),i=p.forwardRef((s,u)=>{const{asChild:d,...h}=s,g=d?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(g,{...h,ref:u})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{}),Xk="Separator",Bw="horizontal",Zk=["horizontal","vertical"],X1=p.forwardRef((e,t)=>{const{decorative:r,orientation:i=Bw,...s}=e,u=Yk(i)?i:Bw,h=r?{role:"none"}:{"aria-orientation":u==="vertical"?u:void 0,role:"separator"};return l.jsx(Gk.div,{"data-orientation":u,...h,...s,ref:t})});X1.displayName=Xk;function Yk(e){return Zk.includes(e)}var Qk=X1;function Jk({className:e,orientation:t="horizontal",decorative:r=!0,...i}){return l.jsx(Qk,{"data-slot":"separator",decorative:r,orientation:t,className:de("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...i})}function Wk({...e}){return l.jsx(Dd,{"data-slot":"sheet",...e})}function e3({...e}){return l.jsx(Md,{"data-slot":"sheet-portal",...e})}function t3({className:e,...t}){return l.jsx(zd,{"data-slot":"sheet-overlay",className:de("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function n3({className:e,children:t,side:r="right",...i}){return l.jsxs(e3,{children:[l.jsx(t3,{}),l.jsxs(kd,{"data-slot":"sheet-content",className:de("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out fixed z-50 flex flex-col gap-4 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500",r==="right"&&"data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right inset-y-0 right-0 h-full w-3/4 border-l sm:max-w-sm",r==="left"&&"data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left inset-y-0 left-0 h-full w-3/4 border-r sm:max-w-sm",r==="top"&&"data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top inset-x-0 top-0 h-auto border-b",r==="bottom"&&"data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom inset-x-0 bottom-0 h-auto border-t",e),...i,children:[t,l.jsxs(nc,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none",children:[l.jsx($p,{className:"size-4"}),l.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function a3({className:e,...t}){return l.jsx("div",{"data-slot":"sheet-header",className:de("flex flex-col gap-1.5 p-4",e),...t})}function r3({className:e,...t}){return l.jsx(Qp,{"data-slot":"sheet-title",className:de("text-foreground font-semibold",e),...t})}function i3({className:e,...t}){return l.jsx(Jp,{"data-slot":"sheet-description",className:de("text-muted-foreground text-sm",e),...t})}var o3=Symbol("radix.slottable");function s3(e){const t=({children:r})=>l.jsx(l.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=o3,t}var Z1=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"}),l3="VisuallyHidden",Y1=p.forwardRef((e,t)=>l.jsx(rt.span,{...e,ref:t,style:{...Z1,...e.style}}));Y1.displayName=l3;var c3=Y1,[Hd]=ur("Tooltip",[xi]),Bd=xi(),Q1="TooltipProvider",u3=700,yp="tooltip.open",[d3,dg]=Hd(Q1),J1=e=>{const{__scopeTooltip:t,delayDuration:r=u3,skipDelayDuration:i=300,disableHoverableContent:s=!1,children:u}=e,d=p.useRef(!0),h=p.useRef(!1),g=p.useRef(0);return p.useEffect(()=>{const y=g.current;return()=>window.clearTimeout(y)},[]),l.jsx(d3,{scope:t,isOpenDelayedRef:d,delayDuration:r,onOpen:p.useCallback(()=>{window.clearTimeout(g.current),d.current=!1},[]),onClose:p.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>d.current=!0,i)},[i]),isPointerInTransitRef:h,onPointerInTransitChange:p.useCallback(y=>{h.current=y},[]),disableHoverableContent:s,children:u})};J1.displayName=Q1;var Xl="Tooltip",[f3,sc]=Hd(Xl),W1=e=>{const{__scopeTooltip:t,children:r,open:i,defaultOpen:s,onOpenChange:u,disableHoverableContent:d,delayDuration:h}=e,g=dg(Xl,e.__scopeTooltip),y=Bd(t),[x,v]=p.useState(null),w=Sn(),E=p.useRef(0),j=d??g.disableHoverableContent,S=h??g.delayDuration,N=p.useRef(!1),[D,A]=Yi({prop:i,defaultProp:s??!1,onChange:L=>{L?(g.onOpen(),document.dispatchEvent(new CustomEvent(yp))):g.onClose(),u?.(L)},caller:Xl}),O=p.useMemo(()=>D?N.current?"delayed-open":"instant-open":"closed",[D]),C=p.useCallback(()=>{window.clearTimeout(E.current),E.current=0,N.current=!1,A(!0)},[A]),T=p.useCallback(()=>{window.clearTimeout(E.current),E.current=0,A(!1)},[A]),U=p.useCallback(()=>{window.clearTimeout(E.current),E.current=window.setTimeout(()=>{N.current=!0,A(!0),E.current=0},S)},[S,A]);return p.useEffect(()=>()=>{E.current&&(window.clearTimeout(E.current),E.current=0)},[]),l.jsx(qd,{...y,children:l.jsx(f3,{scope:t,contentId:w,open:D,stateAttribute:O,trigger:x,onTriggerChange:v,onTriggerEnter:p.useCallback(()=>{g.isOpenDelayedRef.current?U():C()},[g.isOpenDelayedRef,U,C]),onTriggerLeave:p.useCallback(()=>{j?T():(window.clearTimeout(E.current),E.current=0)},[T,j]),onOpen:C,onClose:T,disableHoverableContent:j,children:r})})};W1.displayName=Xl;var vp="TooltipTrigger",e_=p.forwardRef((e,t)=>{const{__scopeTooltip:r,...i}=e,s=sc(vp,r),u=dg(vp,r),d=Bd(r),h=p.useRef(null),g=dt(t,h,s.onTriggerChange),y=p.useRef(!1),x=p.useRef(!1),v=p.useCallback(()=>y.current=!1,[]);return p.useEffect(()=>()=>document.removeEventListener("pointerup",v),[v]),l.jsx(ic,{asChild:!0,...d,children:l.jsx(rt.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:g,onPointerMove:Ce(e.onPointerMove,w=>{w.pointerType!=="touch"&&!x.current&&!u.isPointerInTransitRef.current&&(s.onTriggerEnter(),x.current=!0)}),onPointerLeave:Ce(e.onPointerLeave,()=>{s.onTriggerLeave(),x.current=!1}),onPointerDown:Ce(e.onPointerDown,()=>{s.open&&s.onClose(),y.current=!0,document.addEventListener("pointerup",v,{once:!0})}),onFocus:Ce(e.onFocus,()=>{y.current||s.onOpen()}),onBlur:Ce(e.onBlur,s.onClose),onClick:Ce(e.onClick,s.onClose)})})});e_.displayName=vp;var fg="TooltipPortal",[h3,m3]=Hd(fg,{forceMount:void 0}),t_=e=>{const{__scopeTooltip:t,forceMount:r,children:i,container:s}=e,u=sc(fg,t);return l.jsx(h3,{scope:t,forceMount:r,children:l.jsx(ja,{present:r||u.open,children:l.jsx(Cs,{asChild:!0,container:s,children:i})})})};t_.displayName=fg;var vs="TooltipContent",n_=p.forwardRef((e,t)=>{const r=m3(vs,e.__scopeTooltip),{forceMount:i=r.forceMount,side:s="top",...u}=e,d=sc(vs,e.__scopeTooltip);return l.jsx(ja,{present:i||d.open,children:d.disableHoverableContent?l.jsx(a_,{side:s,...u,ref:t}):l.jsx(p3,{side:s,...u,ref:t})})}),p3=p.forwardRef((e,t)=>{const r=sc(vs,e.__scopeTooltip),i=dg(vs,e.__scopeTooltip),s=p.useRef(null),u=dt(t,s),[d,h]=p.useState(null),{trigger:g,onClose:y}=r,x=s.current,{onPointerInTransitChange:v}=i,w=p.useCallback(()=>{h(null),v(!1)},[v]),E=p.useCallback((j,S)=>{const N=j.currentTarget,D={x:j.clientX,y:j.clientY},A=x3(D,N.getBoundingClientRect()),O=b3(D,A),C=w3(S.getBoundingClientRect()),T=_3([...O,...C]);h(T),v(!0)},[v]);return p.useEffect(()=>()=>w(),[w]),p.useEffect(()=>{if(g&&x){const j=N=>E(N,x),S=N=>E(N,g);return g.addEventListener("pointerleave",j),x.addEventListener("pointerleave",S),()=>{g.removeEventListener("pointerleave",j),x.removeEventListener("pointerleave",S)}}},[g,x,E,w]),p.useEffect(()=>{if(d){const j=S=>{const N=S.target,D={x:S.clientX,y:S.clientY},A=g?.contains(N)||x?.contains(N),O=!S3(D,d);A?w():O&&(w(),y())};return document.addEventListener("pointermove",j),()=>document.removeEventListener("pointermove",j)}},[g,x,d,y,w]),l.jsx(a_,{...e,ref:u})}),[g3,y3]=Hd(Xl,{isInside:!1}),v3=s3("TooltipContent"),a_=p.forwardRef((e,t)=>{const{__scopeTooltip:r,children:i,"aria-label":s,onEscapeKeyDown:u,onPointerDownOutside:d,...h}=e,g=sc(vs,r),y=Bd(r),{onClose:x}=g;return p.useEffect(()=>(document.addEventListener(yp,x),()=>document.removeEventListener(yp,x)),[x]),p.useEffect(()=>{if(g.trigger){const v=w=>{w.target?.contains(g.trigger)&&x()};return window.addEventListener("scroll",v,{capture:!0}),()=>window.removeEventListener("scroll",v,{capture:!0})}},[g.trigger,x]),l.jsx(Es,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:v=>v.preventDefault(),onDismiss:x,children:l.jsxs(Fd,{"data-state":g.stateAttribute,...y,...h,ref:t,style:{...h.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:[l.jsx(v3,{children:i}),l.jsx(g3,{scope:r,isInside:!0,children:l.jsx(c3,{id:g.contentId,role:"tooltip",children:s||i})})]})})});n_.displayName=vs;var r_="TooltipArrow",i_=p.forwardRef((e,t)=>{const{__scopeTooltip:r,...i}=e,s=Bd(r);return y3(r_,r).isInside?null:l.jsx($d,{...s,...i,ref:t})});i_.displayName=r_;function x3(e,t){const r=Math.abs(t.top-e.y),i=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),u=Math.abs(t.left-e.x);switch(Math.min(r,i,s,u)){case u:return"left";case s:return"right";case r:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function b3(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 w3(e){const{top:t,right:r,bottom:i,left:s}=e;return[{x:s,y:t},{x:r,y:t},{x:r,y:i},{x:s,y:i}]}function S3(e,t){const{x:r,y:i}=e;let s=!1;for(let u=0,d=t.length-1;ui!=w>i&&r<(v-y)*(i-x)/(w-x)+y&&(s=!s)}return s}function _3(e){const t=e.slice();return t.sort((r,i)=>r.xi.x?1:r.yi.y?1:0),E3(t)}function E3(e){if(e.length<=1)return e.slice();const t=[];for(let i=0;i=2;){const u=t[t.length-1],d=t[t.length-2];if((u.x-d.x)*(s.y-d.y)>=(u.y-d.y)*(s.x-d.x))t.pop();else break}t.push(s)}t.pop();const r=[];for(let i=e.length-1;i>=0;i--){const s=e[i];for(;r.length>=2;){const u=r[r.length-1],d=r[r.length-2];if((u.x-d.x)*(s.y-d.y)>=(u.y-d.y)*(s.x-d.x))r.pop();else break}r.push(s)}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 C3=J1,j3=W1,R3=e_,O3=t_,N3=n_,A3=i_;function Gd({delayDuration:e=0,...t}){return l.jsx(C3,{"data-slot":"tooltip-provider",delayDuration:e,...t})}function o_({...e}){return l.jsx(Gd,{children:l.jsx(j3,{"data-slot":"tooltip",...e})})}function s_({...e}){return l.jsx(R3,{"data-slot":"tooltip-trigger",...e})}function l_({className:e,sideOffset:t=0,children:r,...i}){return l.jsx(O3,{children:l.jsxs(N3,{"data-slot":"tooltip-content",sideOffset:t,className:de("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",e),...i,children:[r,l.jsx(A3,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}const T3="sidebar_state",D3=3600*24*7,M3="16rem",z3="18rem",k3="3rem",P3="b",c_=p.createContext(null);function hg(){const e=p.useContext(c_);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function K3({defaultOpen:e=!0,open:t,onOpenChange:r,className:i,style:s,children:u,...d}){const h=Hk(),[g,y]=p.useState(!1),[x,v]=p.useState(e),w=t??x,E=p.useCallback(D=>{const A=typeof D=="function"?D(w):D;r?r(A):v(A),document.cookie=`${T3}=${A}; path=/; max-age=${D3}`},[r,w]),j=p.useCallback(()=>h?y(D=>!D):E(D=>!D),[h,E,y]);p.useEffect(()=>{const D=A=>{A.key===P3&&(A.metaKey||A.ctrlKey)&&(A.preventDefault(),j())};return window.addEventListener("keydown",D),()=>window.removeEventListener("keydown",D)},[j]);const S=w?"expanded":"collapsed",N=p.useMemo(()=>({state:S,open:w,setOpen:E,isMobile:h,openMobile:g,setOpenMobile:y,toggleSidebar:j}),[S,w,E,h,g,y,j]);return l.jsx(c_.Provider,{value:N,children:l.jsx(Gd,{delayDuration:0,children:l.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":M3,"--sidebar-width-icon":k3,...s},className:de("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",i),...d,children:u})})})}function I3({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:i,children:s,...u}){const{isMobile:d,state:h,openMobile:g,setOpenMobile:y}=hg();return r==="none"?l.jsx("div",{"data-slot":"sidebar",className:de("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",i),...u,children:s}):d?l.jsx(Wk,{open:g,onOpenChange:y,...u,children:l.jsxs(n3,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":z3},side:e,children:[l.jsxs(a3,{className:"sr-only",children:[l.jsx(r3,{children:"Sidebar"}),l.jsx(i3,{children:"Displays the mobile sidebar."})]}),l.jsx("div",{className:"flex h-full w-full flex-col",children:s})]})}):l.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":h,"data-collapsible":h==="collapsed"?r:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[l.jsx("div",{"data-slot":"sidebar-gap",className:de("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),l.jsx("div",{"data-slot":"sidebar-container",className:de("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",t==="floating"||t==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",i),...u,children:l.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:s})})]})}function L3({className:e,onClick:t,...r}){const{toggleSidebar:i}=hg();return l.jsxs(se,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:de("size-7",e),onClick:s=>{t?.(s),i()},...r,children:[l.jsx(x2,{}),l.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function U3({className:e,...t}){return l.jsx("main",{"data-slot":"sidebar-inset",className:de("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",e),...t})}function q3({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:de("flex flex-col gap-2 p-2",e),...t})}function F3({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:de("flex flex-col gap-2 p-2",e),...t})}function $3({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:de("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Uu({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:de("relative flex w-full min-w-0 flex-col p-2",e),...t})}function qu({className:e,asChild:t=!1,...r}){const i=t?_s:"div";return l.jsx(i,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:de("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...r})}function Fu({className:e,...t}){return l.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:de("w-full text-sm",e),...t})}function $u({className:e,...t}){return l.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:de("flex w-full min-w-0 flex-col gap-1",e),...t})}function Vu({className:e,...t}){return l.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:de("group/menu-item relative",e),...t})}const V3=Bp("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function Hu({asChild:e=!1,isActive:t=!1,variant:r="default",size:i="default",tooltip:s,className:u,...d}){const h=e?_s:"button",{isMobile:g,state:y}=hg(),x=l.jsx(h,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":i,"data-active":t,className:de(V3({variant:r,size:i}),u),...d});return s?(typeof s=="string"&&(s={children:s}),l.jsxs(o_,{children:[l.jsx(s_,{asChild:!0,children:x}),l.jsx(l_,{side:"right",align:"center",hidden:y!=="collapsed"||g,...s})]})):x}const H3=()=>{const e=Pp(),{data:t,isLoading:r}=Ek(),i=p.useMemo(()=>{const u=e.pathname.split("/").filter(Boolean),d=[];let h="";for(const g of u)h+=`/${g}`,d.push({to:h,label:g});return d},[e.pathname]),s=p.useMemo(()=>{if(!t)return"U";const d=(t.display_name||t.primary_email||"").trim().split(/\s+/);return d.length>=2?(d[0][0]+d[1][0]).toUpperCase():d.length===1&&d[0]?d[0][0].toUpperCase():"U"},[t]);return l.jsxs("div",{className:"flex h-12 items-center gap-2 border-b px-3",children:[l.jsx(L3,{}),l.jsx("div",{className:"flex-1",children:l.jsx(qk,{children:l.jsxs(Fk,{children:[l.jsx(Vw,{children:l.jsx(Hw,{asChild:!0,children:l.jsx(xm,{to:"/",children:"Home"})})}),i.map((u,d)=>l.jsxs("span",{className:"flex items-center",children:[l.jsx(Vk,{}),l.jsx(Vw,{children:d===i.length-1?l.jsx($k,{className:"capitalize",children:u.label}):l.jsx(Hw,{asChild:!0,children:l.jsx(xm,{to:u.to,className:"capitalize",children:u.label})})})]},u.to))]})})}),l.jsx(se,{variant:"ghost",size:"sm",asChild:!0,children:l.jsx(xm,{to:"/me",children:r?"…":t?.display_name||"Profile"})}),l.jsx(Lk,{className:"h-7 w-7",children:l.jsx(Uk,{children:s})})]})};async function B3(){const e=wn.get();if(!e?.refresh_token){wn.logout();return}try{const t={refresh_token:e.refresh_token};await uT().logout({body:t})}catch(t){console.warn("Logout API failed; clearing local state anyway",t)}finally{wn.logout()}}function G3(){return{logout:p.useCallback(()=>B3(),[])}}const X3=()=>{const[e,t]=p.useState([]),{logout:r}=G3();return p.useEffect(()=>{let i=!0;return(async()=>{try{const u=((await Vi.getMe()).organizations??[]).map(d=>({id:d.id,name:d.name??d.id}));if(!i)return;t(u),!La.get()&&u.length>0&&La.set(u[0].id)}catch{}})(),()=>{i=!1}},[]),l.jsxs(K3,{defaultOpen:!0,children:[l.jsxs(I3,{collapsible:"icon",variant:"floating",children:[l.jsx(q3,{children:l.jsx("div",{className:"px-2 py-2",children:l.jsx(_k,{orgs:e})})}),l.jsxs($3,{children:[l.jsxs(Uu,{children:[l.jsx(qu,{children:"Navigation"}),l.jsx(Fu,{children:l.jsx($u,{children:TT.map(i=>l.jsx(Vu,{children:l.jsx(Hu,{asChild:!0,tooltip:i.label,children:l.jsxs(Cu,{to:i.to,className:({isActive:s})=>de("flex items-center gap-2",s&&"text-primary"),children:[l.jsx(i.icon,{className:"h-4 w-4"}),l.jsx("span",{children:i.label})]})})},i.to))})})]}),l.jsxs(Uu,{children:[l.jsx(qu,{children:"Organization"}),l.jsx(Fu,{children:l.jsx($u,{children:DT.map(i=>l.jsx(Vu,{children:l.jsx(Hu,{asChild:!0,tooltip:i.label,children:l.jsxs(Cu,{to:i.to,className:({isActive:s})=>de("flex items-center gap-2",s&&"text-primary"),children:[l.jsx(i.icon,{className:"h-4 w-4"}),l.jsx("span",{children:i.label})]})})},i.to))})})]}),l.jsxs(Uu,{children:[l.jsx(qu,{children:"User"}),l.jsx(Fu,{children:l.jsx($u,{children:MT.map(i=>l.jsx(Vu,{children:l.jsx(Hu,{asChild:!0,tooltip:i.label,children:l.jsxs(Cu,{to:i.to,className:({isActive:s})=>de("flex items-center gap-2",s&&"text-primary"),children:[l.jsx(i.icon,{className:"h-4 w-4"}),l.jsx("span",{children:i.label})]})})},i.to))})})]}),l.jsxs(Uu,{children:[l.jsx(qu,{children:"Admin"}),l.jsx(Fu,{children:l.jsx($u,{children:zT.map(i=>l.jsx(Vu,{children:l.jsx(Hu,{asChild:!0,tooltip:i.label,children:l.jsxs(Cu,{to:i.to,className:({isActive:s})=>de("flex items-center gap-2",s&&"text-primary"),children:[l.jsx(i.icon,{className:"h-4 w-4"}),l.jsx("span",{children:i.label})]})})},i.to))})})]})]}),l.jsx(F3,{children:l.jsx("div",{className:"px-2 py-2",children:l.jsx(se,{variant:"ghost",size:"sm",className:"w-full",onClick:()=>void r(),children:"Sign out"})})})]}),l.jsxs(U3,{className:"min-h-screen",children:[l.jsx(H3,{}),l.jsx("main",{className:"p-4",children:l.jsx(F0,{})})]})]})},Z3=()=>{const e=p.useSyncExternalStore(t=>wn.subscribe(t),()=>wn.get(),()=>wn.get());return{tokens:e,authed:!!e?.access_token,isExpired:wn.isExpired(),willExpireSoon:wn.willExpireSoon()}},Y3=()=>{const{authed:e}=Z3(),t=Pp();return e?l.jsx(F0,{}):l.jsx(KR,{to:`/login?to=${encodeURIComponent(t.pathname+t.search)}`,replace:!0})},El=yT(),kl={listAnnotations:()=>Pe(async()=>await El.listAnnotations()),createAnnotation:e=>Pe(async()=>await El.createAnnotation({body:e})),getAnnotation:e=>Pe(async()=>await El.getAnnotation({id:e})),deleteAnnotation:e=>Pe(async()=>{await El.deleteAnnotation({id:e})}),updateAnnotation:(e,t)=>Pe(async()=>await El.updateAnnotation({id:e,body:t}))},Cl=gT(),Pl={listLabels:()=>Pe(async()=>await Cl.listLabels()),createLabel:e=>Pe(async()=>await Cl.createLabel({body:e})),getLabel:e=>Pe(async()=>await Cl.getLabel({id:e})),deleteLabel:e=>Pe(async()=>{await Cl.deleteLabel({id:e})}),updateLabel:(e,t)=>Pe(async()=>await Cl.updateLabel({id:e,body:t}))};var lc=e=>e.type==="checkbox",Bi=e=>e instanceof Date,Gn=e=>e==null;const u_=e=>typeof e=="object";var Yt=e=>!Gn(e)&&!Array.isArray(e)&&u_(e)&&!Bi(e),d_=e=>Yt(e)&&e.target?lc(e.target)?e.target.checked:e.target.value:e,Q3=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,f_=(e,t)=>e.has(Q3(t)),J3=e=>{const t=e.constructor&&e.constructor.prototype;return Yt(t)&&t.hasOwnProperty("isPrototypeOf")},mg=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function nn(e){let t;const r=Array.isArray(e),i=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(mg&&(e instanceof Blob||i))&&(r||Yt(e)))if(t=r?[]:Object.create(Object.getPrototypeOf(e)),!r&&!J3(e))t=e;else for(const s in e)e.hasOwnProperty(s)&&(t[s]=nn(e[s]));else return e;return t}var Xd=e=>/^\w*$/.test(e),Ut=e=>e===void 0,pg=e=>Array.isArray(e)?e.filter(Boolean):[],gg=e=>pg(e.replace(/["|']|\]/g,"").split(/\.|\[/)),we=(e,t,r)=>{if(!t||!Yt(e))return r;const i=(Xd(t)?[t]:gg(t)).reduce((s,u)=>Gn(s)?s:s[u],e);return Ut(i)||i===e?Ut(e[t])?r:e[t]:i},ra=e=>typeof e=="boolean",xt=(e,t,r)=>{let i=-1;const s=Xd(t)?[t]:gg(t),u=s.length,d=u-1;for(;++iQ.useContext(yg),W3=e=>{const{children:t,...r}=e;return Q.createElement(yg.Provider,{value:r},t)};var h_=(e,t,r,i=!0)=>{const s={defaultValues:t._defaultValues};for(const u in e)Object.defineProperty(s,u,{get:()=>{const d=u;return t._proxyFormState[d]!==ka.all&&(t._proxyFormState[d]=!i||ka.all),r&&(r[d]=!0),e[d]}});return s};const vg=typeof window<"u"?Q.useLayoutEffect:Q.useEffect;function m_(e){const t=Zd(),{control:r=t.control,disabled:i,name:s,exact:u}=e||{},[d,h]=Q.useState(r._formState),g=Q.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return vg(()=>r._subscribe({name:s,formState:g.current,exact:u,callback:y=>{!i&&h({...r._formState,...y})}}),[s,i,u]),Q.useEffect(()=>{g.current.isValid&&r._setValid(!0)},[r]),Q.useMemo(()=>h_(d,r,g.current,!1),[d,r])}var oa=e=>typeof e=="string",xp=(e,t,r,i,s)=>oa(e)?(i&&t.watch.add(e),we(r,e,s)):Array.isArray(e)?e.map(u=>(i&&t.watch.add(u),we(r,u))):(i&&(t.watchAll=!0),r),bp=e=>Gn(e)||!u_(e);function Pa(e,t,r=new WeakSet){if(bp(e)||bp(t))return e===t;if(Bi(e)&&Bi(t))return e.getTime()===t.getTime();const i=Object.keys(e),s=Object.keys(t);if(i.length!==s.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const u of i){const d=e[u];if(!s.includes(u))return!1;if(u!=="ref"){const h=t[u];if(Bi(d)&&Bi(h)||Yt(d)&&Yt(h)||Array.isArray(d)&&Array.isArray(h)?!Pa(d,h,r):d!==h)return!1}}return!0}function e5(e){const t=Zd(),{control:r=t.control,name:i,defaultValue:s,disabled:u,exact:d,compute:h}=e||{},g=Q.useRef(s),y=Q.useRef(h),x=Q.useRef(void 0),v=Q.useRef(r),w=Q.useRef(i);y.current=h;const[E,j]=Q.useState(()=>{const C=r._getWatch(i,g.current);return y.current?y.current(C):C}),S=Q.useCallback(C=>{const T=xp(i,r._names,C||r._formValues,!1,g.current);return y.current?y.current(T):T},[r._formValues,r._names,i]),N=Q.useCallback(C=>{if(!u){const T=xp(i,r._names,C||r._formValues,!1,g.current);if(y.current){const U=y.current(T);Pa(U,x.current)||(j(U),x.current=U)}else j(T)}},[r._formValues,r._names,u,i]);vg(()=>((v.current!==r||!Pa(w.current,i))&&(v.current=r,w.current=i,N()),r._subscribe({name:i,formState:{values:!0},exact:d,callback:C=>{N(C.values)}})),[r,d,i,N]),Q.useEffect(()=>r._removeUnmounted());const D=v.current!==r,A=w.current,O=Q.useMemo(()=>{if(u)return null;const C=!D&&!Pa(A,i);return D||C?S():null},[u,D,i,A,S]);return O!==null?O:E}function t5(e){const t=Zd(),{name:r,disabled:i,control:s=t.control,shouldUnregister:u,defaultValue:d}=e,h=f_(s._names.array,r),g=Q.useMemo(()=>we(s._formValues,r,we(s._defaultValues,r,d)),[s,r,d]),y=e5({control:s,name:r,defaultValue:g,exact:!0}),x=m_({control:s,name:r,exact:!0}),v=Q.useRef(e),w=Q.useRef(void 0),E=Q.useRef(s.register(r,{...e.rules,value:y,...ra(e.disabled)?{disabled:e.disabled}:{}}));v.current=e;const j=Q.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!we(x.errors,r)},isDirty:{enumerable:!0,get:()=>!!we(x.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!we(x.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!we(x.validatingFields,r)},error:{enumerable:!0,get:()=>we(x.errors,r)}}),[x,r]),S=Q.useCallback(O=>E.current.onChange({target:{value:d_(O),name:r},type:pd.CHANGE}),[r]),N=Q.useCallback(()=>E.current.onBlur({target:{value:we(s._formValues,r),name:r},type:pd.BLUR}),[r,s._formValues]),D=Q.useCallback(O=>{const C=we(s._fields,r);C&&O&&(C._f.ref={focus:()=>O.focus&&O.focus(),select:()=>O.select&&O.select(),setCustomValidity:T=>O.setCustomValidity(T),reportValidity:()=>O.reportValidity()})},[s._fields,r]),A=Q.useMemo(()=>({name:r,value:y,...ra(i)||x.disabled?{disabled:x.disabled||i}:{},onChange:S,onBlur:N,ref:D}),[r,i,x.disabled,S,N,D,y]);return Q.useEffect(()=>{const O=s._options.shouldUnregister||u,C=w.current;C&&C!==r&&!h&&s.unregister(C),s.register(r,{...v.current.rules,...ra(v.current.disabled)?{disabled:v.current.disabled}:{}});const T=(U,L)=>{const V=we(s._fields,U);V&&V._f&&(V._f.mount=L)};if(T(r,!0),O){const U=nn(we(s._options.defaultValues,r,v.current.defaultValue));xt(s._defaultValues,r,U),Ut(we(s._formValues,r))&&xt(s._formValues,r,U)}return!h&&s.register(r),w.current=r,()=>{(h?O&&!s._state.action:O)?s.unregister(r):T(r,!1)}},[r,s,h,u]),Q.useEffect(()=>{s._setDisabledField({disabled:i,name:r})},[i,r,s]),Q.useMemo(()=>({field:A,formState:x,fieldState:j}),[A,x,j])}const n5=e=>e.render(t5(e));var xg=(e,t,r,i,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[i]:s||!0}}:{},$l=e=>Array.isArray(e)?e:[e],Gw=()=>{let e=[];return{get observers(){return e},next:s=>{for(const u of e)u.next&&u.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(u=>u!==s)}}),unsubscribe:()=>{e=[]}}};function p_(e,t){const r={};for(const i in e)if(e.hasOwnProperty(i)){const s=e[i],u=t[i];if(s&&Yt(s)&&u){const d=p_(s,u);Yt(d)&&(r[i]=d)}else e[i]&&(r[i]=u)}return r}var An=e=>Yt(e)&&!Object.keys(e).length,bg=e=>e.type==="file",Ka=e=>typeof e=="function",gd=e=>{if(!mg)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},g_=e=>e.type==="select-multiple",wg=e=>e.type==="radio",a5=e=>wg(e)||lc(e),Vm=e=>gd(e)&&e.isConnected;function r5(e,t){const r=t.slice(0,-1).length;let i=0;for(;i{for(const t in e)if(Ka(e[t]))return!0;return!1};function y_(e){return Array.isArray(e)||Yt(e)&&!o5(e)}function wp(e,t={}){for(const r in e)y_(e[r])?(t[r]=Array.isArray(e[r])?[]:{},wp(e[r],t[r])):Ut(e[r])||(t[r]=!0);return t}function rs(e,t,r){r||(r=wp(t));for(const i in e)y_(e[i])?Ut(t)||bp(r[i])?r[i]=wp(e[i],Array.isArray(e[i])?[]:{}):rs(e[i],Gn(t)?{}:t[i],r[i]):r[i]=!Pa(e[i],t[i]);return r}const Xw={value:!1,isValid:!1},Zw={value:!0,isValid:!0};var v_=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&&!Ut(e[0].attributes.value)?Ut(e[0].value)||e[0].value===""?Zw:{value:e[0].value,isValid:!0}:Zw:Xw}return Xw},x_=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:i})=>Ut(e)?e:t?e===""?NaN:e&&+e:r&&oa(e)?new Date(e):i?i(e):e;const Yw={isValid:!1,value:null};var b_=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,Yw):Yw;function Qw(e){const t=e.ref;return bg(t)?t.files:wg(t)?b_(e.refs).value:g_(t)?[...t.selectedOptions].map(({value:r})=>r):lc(t)?v_(e.refs).value:x_(Ut(t.value)?e.ref.value:t.value,e)}var s5=(e,t,r,i)=>{const s={};for(const u of e){const d=we(t,u);d&&xt(s,u,d._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:i}},yd=e=>e instanceof RegExp,jl=e=>Ut(e)?e:yd(e)?e.source:Yt(e)?yd(e.value)?e.value.source:e.value:e,Jw=e=>({isOnSubmit:!e||e===ka.onSubmit,isOnBlur:e===ka.onBlur,isOnChange:e===ka.onChange,isOnAll:e===ka.all,isOnTouch:e===ka.onTouched});const Ww="AsyncFunction";var l5=e=>!!e&&!!e.validate&&!!(Ka(e.validate)&&e.validate.constructor.name===Ww||Yt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===Ww)),c5=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),e0=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(i=>e.startsWith(i)&&/^\.\w+/.test(e.slice(i.length))));const Vl=(e,t,r,i)=>{for(const s of r||Object.keys(e)){const u=we(e,s);if(u){const{_f:d,...h}=u;if(d){if(d.refs&&d.refs[0]&&t(d.refs[0],s)&&!i)return!0;if(d.ref&&t(d.ref,d.name)&&!i)return!0;if(Vl(h,t))break}else if(Yt(h)&&Vl(h,t))break}}};function t0(e,t,r){const i=we(e,r);if(i||Xd(r))return{error:i,name:r};const s=r.split(".");for(;s.length;){const u=s.join("."),d=we(t,u),h=we(e,u);if(d&&!Array.isArray(d)&&r!==u)return{name:r};if(h&&h.type)return{name:u,error:h};if(h&&h.root&&h.root.type)return{name:`${u}.root`,error:h.root};s.pop()}return{name:r}}var u5=(e,t,r,i)=>{r(e);const{name:s,...u}=e;return An(u)||Object.keys(u).length>=Object.keys(t).length||Object.keys(u).find(d=>t[d]===(!i||ka.all))},d5=(e,t,r)=>!e||!t||e===t||$l(e).some(i=>i&&(r?i===t:i.startsWith(t)||t.startsWith(i))),f5=(e,t,r,i,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?i.isOnBlur:s.isOnBlur)?!e:(r?i.isOnChange:s.isOnChange)?e:!0,h5=(e,t)=>!pg(we(e,t)).length&&Xt(e,t),m5=(e,t,r)=>{const i=$l(we(e,r));return xt(i,"root",t[r]),xt(e,r,i),e};function n0(e,t,r="validate"){if(oa(e)||Array.isArray(e)&&e.every(oa)||ra(e)&&!e)return{type:r,message:oa(e)?e:"",ref:t}}var ts=e=>Yt(e)&&!yd(e)?e:{value:e,message:""},a0=async(e,t,r,i,s,u)=>{const{ref:d,refs:h,required:g,maxLength:y,minLength:x,min:v,max:w,pattern:E,validate:j,name:S,valueAsNumber:N,mount:D}=e._f,A=we(r,S);if(!D||t.has(S))return{};const O=h?h[0]:d,C=ae=>{s&&O.reportValidity&&(O.setCustomValidity(ra(ae)?"":ae||""),O.reportValidity())},T={},U=wg(d),L=lc(d),V=U||L,fe=(N||bg(d))&&Ut(d.value)&&Ut(A)||gd(d)&&d.value===""||A===""||Array.isArray(A)&&!A.length,ge=xg.bind(null,S,i,T),pe=(ae,le,he,be=Tr.maxLength,R=Tr.minLength)=>{const P=ae?le:he;T[S]={type:ae?be:R,message:P,ref:d,...ge(ae?be:R,P)}};if(u?!Array.isArray(A)||!A.length:g&&(!V&&(fe||Gn(A))||ra(A)&&!A||L&&!v_(h).isValid||U&&!b_(h).isValid)){const{value:ae,message:le}=oa(g)?{value:!!g,message:g}:ts(g);if(ae&&(T[S]={type:Tr.required,message:le,ref:O,...ge(Tr.required,le)},!i))return C(le),T}if(!fe&&(!Gn(v)||!Gn(w))){let ae,le;const he=ts(w),be=ts(v);if(!Gn(A)&&!isNaN(A)){const R=d.valueAsNumber||A&&+A;Gn(he.value)||(ae=R>he.value),Gn(be.value)||(le=Rnew Date(new Date().toDateString()+" "+me),I=d.type=="time",ee=d.type=="week";oa(he.value)&&A&&(ae=I?P(A)>P(he.value):ee?A>he.value:R>new Date(he.value)),oa(be.value)&&A&&(le=I?P(A)+ae.value,be=!Gn(le.value)&&A.length<+le.value;if((he||be)&&(pe(he,ae.message,le.message),!i))return C(T[S].message),T}if(E&&!fe&&oa(A)){const{value:ae,message:le}=ts(E);if(yd(ae)&&!A.match(ae)&&(T[S]={type:Tr.pattern,message:le,ref:d,...ge(Tr.pattern,le)},!i))return C(le),T}if(j){if(Ka(j)){const ae=await j(A,r),le=n0(ae,O);if(le&&(T[S]={...le,...ge(Tr.validate,le.message)},!i))return C(le.message),T}else if(Yt(j)){let ae={};for(const le in j){if(!An(ae)&&!i)break;const he=n0(await j[le](A,r),O,le);he&&(ae={...he,...ge(le,he.message)},C(he.message),i&&(T[S]=ae))}if(!An(ae)&&(T[S]={ref:O,...ae},!i))return T}}return C(!0),T};const p5={mode:ka.onSubmit,reValidateMode:ka.onChange,shouldFocusError:!0};function g5(e={}){let t={...p5,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:Ka(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},i={},s=Yt(t.defaultValues)||Yt(t.values)?nn(t.defaultValues||t.values)||{}:{},u=t.shouldUnregister?{}:nn(s),d={action:!1,mount:!1,watch:!1},h={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},g,y=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let v={...x};const w={array:Gw(),state:Gw()},E=t.criteriaMode===ka.all,j=z=>$=>{clearTimeout(y),y=setTimeout(z,$)},S=async z=>{if(!t.disabled&&(x.isValid||v.isValid||z)){const $=t.resolver?An((await L()).errors):await fe(i,!0);$!==r.isValid&&w.state.next({isValid:$})}},N=(z,$)=>{!t.disabled&&(x.isValidating||x.validatingFields||v.isValidating||v.validatingFields)&&((z||Array.from(h.mount)).forEach(Z=>{Z&&($?xt(r.validatingFields,Z,$):Xt(r.validatingFields,Z))}),w.state.next({validatingFields:r.validatingFields,isValidating:!An(r.validatingFields)}))},D=(z,$=[],Z,ye,ce=!0,ue=!0)=>{if(ye&&Z&&!t.disabled){if(d.action=!0,ue&&Array.isArray(we(i,z))){const De=Z(we(i,z),ye.argA,ye.argB);ce&&xt(i,z,De)}if(ue&&Array.isArray(we(r.errors,z))){const De=Z(we(r.errors,z),ye.argA,ye.argB);ce&&xt(r.errors,z,De),h5(r.errors,z)}if((x.touchedFields||v.touchedFields)&&ue&&Array.isArray(we(r.touchedFields,z))){const De=Z(we(r.touchedFields,z),ye.argA,ye.argB);ce&&xt(r.touchedFields,z,De)}(x.dirtyFields||v.dirtyFields)&&(r.dirtyFields=rs(s,u)),w.state.next({name:z,isDirty:pe(z,$),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else xt(u,z,$)},A=(z,$)=>{xt(r.errors,z,$),w.state.next({errors:r.errors})},O=z=>{r.errors=z,w.state.next({errors:r.errors,isValid:!1})},C=(z,$,Z,ye)=>{const ce=we(i,z);if(ce){const ue=we(u,z,Ut(Z)?we(s,z):Z);Ut(ue)||ye&&ye.defaultChecked||$?xt(u,z,$?ue:Qw(ce._f)):he(z,ue),d.mount&&S()}},T=(z,$,Z,ye,ce)=>{let ue=!1,De=!1;const lt={name:z};if(!t.disabled){if(!Z||ye){(x.isDirty||v.isDirty)&&(De=r.isDirty,r.isDirty=lt.isDirty=pe(),ue=De!==lt.isDirty);const ct=Pa(we(s,z),$);De=!!we(r.dirtyFields,z),ct?Xt(r.dirtyFields,z):xt(r.dirtyFields,z,!0),lt.dirtyFields=r.dirtyFields,ue=ue||(x.dirtyFields||v.dirtyFields)&&De!==!ct}if(Z){const ct=we(r.touchedFields,z);ct||(xt(r.touchedFields,z,Z),lt.touchedFields=r.touchedFields,ue=ue||(x.touchedFields||v.touchedFields)&&ct!==Z)}ue&&ce&&w.state.next(lt)}return ue?lt:{}},U=(z,$,Z,ye)=>{const ce=we(r.errors,z),ue=(x.isValid||v.isValid)&&ra($)&&r.isValid!==$;if(t.delayError&&Z?(g=j(()=>A(z,Z)),g(t.delayError)):(clearTimeout(y),g=null,Z?xt(r.errors,z,Z):Xt(r.errors,z)),(Z?!Pa(ce,Z):ce)||!An(ye)||ue){const De={...ye,...ue&&ra($)?{isValid:$}:{},errors:r.errors,name:z};r={...r,...De},w.state.next(De)}},L=async z=>{N(z,!0);const $=await t.resolver(u,t.context,s5(z||h.mount,i,t.criteriaMode,t.shouldUseNativeValidation));return N(z),$},V=async z=>{const{errors:$}=await L(z);if(z)for(const Z of z){const ye=we($,Z);ye?xt(r.errors,Z,ye):Xt(r.errors,Z)}else r.errors=$;return $},fe=async(z,$,Z={valid:!0})=>{for(const ye in z){const ce=z[ye];if(ce){const{_f:ue,...De}=ce;if(ue){const lt=h.array.has(ue.name),ct=ce._f&&l5(ce._f);ct&&x.validatingFields&&N([ue.name],!0);const sn=await a0(ce,h.disabled,u,E,t.shouldUseNativeValidation&&!$,lt);if(ct&&x.validatingFields&&N([ue.name]),sn[ue.name]&&(Z.valid=!1,$))break;!$&&(we(sn,ue.name)?lt?m5(r.errors,sn,ue.name):xt(r.errors,ue.name,sn[ue.name]):Xt(r.errors,ue.name))}!An(De)&&await fe(De,$,Z)}}return Z.valid},ge=()=>{for(const z of h.unMount){const $=we(i,z);$&&($._f.refs?$._f.refs.every(Z=>!Vm(Z)):!Vm($._f.ref))&&W(z)}h.unMount=new Set},pe=(z,$)=>!t.disabled&&(z&&$&&xt(u,z,$),!Pa(me(),s)),ae=(z,$,Z)=>xp(z,h,{...d.mount?u:Ut($)?s:oa(z)?{[z]:$}:$},Z,$),le=z=>pg(we(d.mount?u:s,z,t.shouldUnregister?we(s,z,[]):[])),he=(z,$,Z={})=>{const ye=we(i,z);let ce=$;if(ye){const ue=ye._f;ue&&(!ue.disabled&&xt(u,z,x_($,ue)),ce=gd(ue.ref)&&Gn($)?"":$,g_(ue.ref)?[...ue.ref.options].forEach(De=>De.selected=ce.includes(De.value)):ue.refs?lc(ue.ref)?ue.refs.forEach(De=>{(!De.defaultChecked||!De.disabled)&&(Array.isArray(ce)?De.checked=!!ce.find(lt=>lt===De.value):De.checked=ce===De.value||!!ce)}):ue.refs.forEach(De=>De.checked=De.value===ce):bg(ue.ref)?ue.ref.value="":(ue.ref.value=ce,ue.ref.type||w.state.next({name:z,values:nn(u)})))}(Z.shouldDirty||Z.shouldTouch)&&T(z,ce,Z.shouldTouch,Z.shouldDirty,!0),Z.shouldValidate&&ee(z)},be=(z,$,Z)=>{for(const ye in $){if(!$.hasOwnProperty(ye))return;const ce=$[ye],ue=z+"."+ye,De=we(i,ue);(h.array.has(z)||Yt(ce)||De&&!De._f)&&!Bi(ce)?be(ue,ce,Z):he(ue,ce,Z)}},R=(z,$,Z={})=>{const ye=we(i,z),ce=h.array.has(z),ue=nn($);xt(u,z,ue),ce?(w.array.next({name:z,values:nn(u)}),(x.isDirty||x.dirtyFields||v.isDirty||v.dirtyFields)&&Z.shouldDirty&&w.state.next({name:z,dirtyFields:rs(s,u),isDirty:pe(z,ue)})):ye&&!ye._f&&!Gn(ue)?be(z,ue,Z):he(z,ue,Z),e0(z,h)&&w.state.next({...r,name:z}),w.state.next({name:d.mount?z:void 0,values:nn(u)})},P=async z=>{d.mount=!0;const $=z.target;let Z=$.name,ye=!0;const ce=we(i,Z),ue=ct=>{ye=Number.isNaN(ct)||Bi(ct)&&isNaN(ct.getTime())||Pa(ct,we(u,Z,ct))},De=Jw(t.mode),lt=Jw(t.reValidateMode);if(ce){let ct,sn;const kn=$.type?Qw(ce._f):d_(z),Zn=z.type===pd.BLUR||z.type===pd.FOCUS_OUT,Xa=!c5(ce._f)&&!t.resolver&&!we(r.errors,Z)&&!ce._f.deps||f5(Zn,we(r.touchedFields,Z),r.isSubmitted,lt,De),Na=e0(Z,h,Zn);xt(u,Z,kn),Zn?(!$||!$.readOnly)&&(ce._f.onBlur&&ce._f.onBlur(z),g&&g(0)):ce._f.onChange&&ce._f.onChange(z);const Jt=T(Z,kn,Zn),Yn=!An(Jt)||Na;if(!Zn&&w.state.next({name:Z,type:z.type,values:nn(u)}),Xa)return(x.isValid||v.isValid)&&(t.mode==="onBlur"?Zn&&S():Zn||S()),Yn&&w.state.next({name:Z,...Na?{}:Jt});if(!Zn&&Na&&w.state.next({...r}),t.resolver){const{errors:Wt}=await L([Z]);if(ue(kn),ye){const As=t0(r.errors,i,Z),Ir=t0(Wt,i,As.name||Z);ct=Ir.error,Z=Ir.name,sn=An(Wt)}}else N([Z],!0),ct=(await a0(ce,h.disabled,u,E,t.shouldUseNativeValidation))[Z],N([Z]),ue(kn),ye&&(ct?sn=!1:(x.isValid||v.isValid)&&(sn=await fe(i,!0)));ye&&(ce._f.deps&&(!Array.isArray(ce._f.deps)||ce._f.deps.length>0)&&ee(ce._f.deps),U(Z,sn,ct,Jt))}},I=(z,$)=>{if(we(r.errors,$)&&z.focus)return z.focus(),1},ee=async(z,$={})=>{let Z,ye;const ce=$l(z);if(t.resolver){const ue=await V(Ut(z)?z:ce);Z=An(ue),ye=z?!ce.some(De=>we(ue,De)):Z}else z?(ye=(await Promise.all(ce.map(async ue=>{const De=we(i,ue);return await fe(De&&De._f?{[ue]:De}:De)}))).every(Boolean),!(!ye&&!r.isValid)&&S()):ye=Z=await fe(i);return w.state.next({...!oa(z)||(x.isValid||v.isValid)&&Z!==r.isValid?{}:{name:z},...t.resolver||!z?{isValid:Z}:{},errors:r.errors}),$.shouldFocus&&!ye&&Vl(i,I,z?ce:h.mount),ye},me=(z,$)=>{let Z={...d.mount?u:s};return $&&(Z=p_($.dirtyFields?r.dirtyFields:r.touchedFields,Z)),Ut(z)?Z:oa(z)?we(Z,z):z.map(ye=>we(Z,ye))},Re=(z,$)=>({invalid:!!we(($||r).errors,z),isDirty:!!we(($||r).dirtyFields,z),error:we(($||r).errors,z),isValidating:!!we(r.validatingFields,z),isTouched:!!we(($||r).touchedFields,z)}),G=z=>{z&&$l(z).forEach($=>Xt(r.errors,$)),w.state.next({errors:z?r.errors:{}})},Y=(z,$,Z)=>{const ye=(we(i,z,{_f:{}})._f||{}).ref,ce=we(r.errors,z)||{},{ref:ue,message:De,type:lt,...ct}=ce;xt(r.errors,z,{...ct,...$,ref:ye}),w.state.next({name:z,errors:r.errors,isValid:!1}),Z&&Z.shouldFocus&&ye&&ye.focus&&ye.focus()},ie=(z,$)=>Ka(z)?w.state.subscribe({next:Z=>"values"in Z&&z(ae(void 0,$),Z)}):ae(z,$,!0),oe=z=>w.state.subscribe({next:$=>{d5(z.name,$.name,z.exact)&&u5($,z.formState||x,Qe,z.reRenderRoot)&&z.callback({values:{...u},...r,...$,defaultValues:s})}}).unsubscribe,ve=z=>(d.mount=!0,v={...v,...z.formState},oe({...z,formState:v})),W=(z,$={})=>{for(const Z of z?$l(z):h.mount)h.mount.delete(Z),h.array.delete(Z),$.keepValue||(Xt(i,Z),Xt(u,Z)),!$.keepError&&Xt(r.errors,Z),!$.keepDirty&&Xt(r.dirtyFields,Z),!$.keepTouched&&Xt(r.touchedFields,Z),!$.keepIsValidating&&Xt(r.validatingFields,Z),!t.shouldUnregister&&!$.keepDefaultValue&&Xt(s,Z);w.state.next({values:nn(u)}),w.state.next({...r,...$.keepDirty?{isDirty:pe()}:{}}),!$.keepIsValid&&S()},xe=({disabled:z,name:$})=>{(ra(z)&&d.mount||z||h.disabled.has($))&&(z?h.disabled.add($):h.disabled.delete($))},Oe=(z,$={})=>{let Z=we(i,z);const ye=ra($.disabled)||ra(t.disabled);return xt(i,z,{...Z||{},_f:{...Z&&Z._f?Z._f:{ref:{name:z}},name:z,mount:!0,...$}}),h.mount.add(z),Z?xe({disabled:ra($.disabled)?$.disabled:t.disabled,name:z}):C(z,!0,$.value),{...ye?{disabled:$.disabled||t.disabled}:{},...t.progressive?{required:!!$.required,min:jl($.min),max:jl($.max),minLength:jl($.minLength),maxLength:jl($.maxLength),pattern:jl($.pattern)}:{},name:z,onChange:P,onBlur:P,ref:ce=>{if(ce){Oe(z,$),Z=we(i,z);const ue=Ut(ce.value)&&ce.querySelectorAll&&ce.querySelectorAll("input,select,textarea")[0]||ce,De=a5(ue),lt=Z._f.refs||[];if(De?lt.find(ct=>ct===ue):ue===Z._f.ref)return;xt(i,z,{_f:{...Z._f,...De?{refs:[...lt.filter(Vm),ue,...Array.isArray(we(s,z))?[{}]:[]],ref:{type:ue.type,name:z}}:{ref:ue}}}),C(z,!1,void 0,ue)}else Z=we(i,z,{}),Z._f&&(Z._f.mount=!1),(t.shouldUnregister||$.shouldUnregister)&&!(f_(h.array,z)&&d.action)&&h.unMount.add(z)}}},Ue=()=>t.shouldFocusError&&Vl(i,I,h.mount),Ye=z=>{ra(z)&&(w.state.next({disabled:z}),Vl(i,($,Z)=>{const ye=we(i,Z);ye&&($.disabled=ye._f.disabled||z,Array.isArray(ye._f.refs)&&ye._f.refs.forEach(ce=>{ce.disabled=ye._f.disabled||z}))},0,!1))},Ze=(z,$)=>async Z=>{let ye;Z&&(Z.preventDefault&&Z.preventDefault(),Z.persist&&Z.persist());let ce=nn(u);if(w.state.next({isSubmitting:!0}),t.resolver){const{errors:ue,values:De}=await L();r.errors=ue,ce=nn(De)}else await fe(i);if(h.disabled.size)for(const ue of h.disabled)Xt(ce,ue);if(Xt(r.errors,"root"),An(r.errors)){w.state.next({errors:{}});try{await z(ce,Z)}catch(ue){ye=ue}}else $&&await $({...r.errors},Z),Ue(),setTimeout(Ue);if(w.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:An(r.errors)&&!ye,submitCount:r.submitCount+1,errors:r.errors}),ye)throw ye},Kt=(z,$={})=>{we(i,z)&&(Ut($.defaultValue)?R(z,nn(we(s,z))):(R(z,$.defaultValue),xt(s,z,nn($.defaultValue))),$.keepTouched||Xt(r.touchedFields,z),$.keepDirty||(Xt(r.dirtyFields,z),r.isDirty=$.defaultValue?pe(z,nn(we(s,z))):pe()),$.keepError||(Xt(r.errors,z),x.isValid&&S()),w.state.next({...r}))},B=(z,$={})=>{const Z=z?nn(z):s,ye=nn(Z),ce=An(z),ue=ce?s:ye;if($.keepDefaultValues||(s=Z),!$.keepValues){if($.keepDirtyValues){const De=new Set([...h.mount,...Object.keys(rs(s,u))]);for(const lt of Array.from(De))we(r.dirtyFields,lt)?xt(ue,lt,we(u,lt)):R(lt,we(ue,lt))}else{if(mg&&Ut(z))for(const De of h.mount){const lt=we(i,De);if(lt&<._f){const ct=Array.isArray(lt._f.refs)?lt._f.refs[0]:lt._f.ref;if(gd(ct)){const sn=ct.closest("form");if(sn){sn.reset();break}}}}if($.keepFieldsRef)for(const De of h.mount)R(De,we(ue,De));else i={}}u=t.shouldUnregister?$.keepDefaultValues?nn(s):{}:nn(ue),w.array.next({values:{...ue}}),w.state.next({values:{...ue}})}h={mount:$.keepDirtyValues?h.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},d.mount=!x.isValid||!!$.keepIsValid||!!$.keepDirtyValues||!t.shouldUnregister&&!An(ue),d.watch=!!t.shouldUnregister,w.state.next({submitCount:$.keepSubmitCount?r.submitCount:0,isDirty:ce?!1:$.keepDirty?r.isDirty:!!($.keepDefaultValues&&!Pa(z,s)),isSubmitted:$.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:ce?{}:$.keepDirtyValues?$.keepDefaultValues&&u?rs(s,u):r.dirtyFields:$.keepDefaultValues&&z?rs(s,z):$.keepDirty?r.dirtyFields:{},touchedFields:$.keepTouched?r.touchedFields:{},errors:$.keepErrors?r.errors:{},isSubmitSuccessful:$.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},qe=(z,$)=>B(Ka(z)?z(u):z,$),ke=(z,$={})=>{const Z=we(i,z),ye=Z&&Z._f;if(ye){const ce=ye.refs?ye.refs[0]:ye.ref;ce.focus&&(ce.focus(),$.shouldSelect&&Ka(ce.select)&&ce.select())}},Qe=z=>{r={...r,...z}},jn={control:{register:Oe,unregister:W,getFieldState:Re,handleSubmit:Ze,setError:Y,_subscribe:oe,_runSchema:L,_focusError:Ue,_getWatch:ae,_getDirty:pe,_setValid:S,_setFieldArray:D,_setDisabledField:xe,_setErrors:O,_getFieldArray:le,_reset:B,_resetDefaultValues:()=>Ka(t.defaultValues)&&t.defaultValues().then(z=>{qe(z,t.resetOptions),w.state.next({isLoading:!1})}),_removeUnmounted:ge,_disableForm:Ye,_subjects:w,_proxyFormState:x,get _fields(){return i},get _formValues(){return u},get _state(){return d},set _state(z){d=z},get _defaultValues(){return s},get _names(){return h},set _names(z){h=z},get _formState(){return r},get _options(){return t},set _options(z){t={...t,...z}}},subscribe:ve,trigger:ee,register:Oe,handleSubmit:Ze,watch:ie,setValue:R,getValues:me,reset:qe,resetField:Kt,clearErrors:G,unregister:W,setError:Y,setFocus:ke,getFieldState:Re};return{...jn,formControl:jn}}function _n(e={}){const t=Q.useRef(void 0),r=Q.useRef(void 0),[i,s]=Q.useState({isDirty:!1,isValidating:!1,isLoading:Ka(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:Ka(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:i},e.defaultValues&&!Ka(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:d,...h}=g5(e);t.current={...h,formState:i}}const u=t.current.control;return u._options=e,vg(()=>{const d=u._subscribe({formState:u._proxyFormState,callback:()=>s({...u._formState}),reRenderRoot:!0});return s(h=>({...h,isReady:!0})),u._formState.isReady=!0,d},[u]),Q.useEffect(()=>u._disableForm(e.disabled),[u,e.disabled]),Q.useEffect(()=>{e.mode&&(u._options.mode=e.mode),e.reValidateMode&&(u._options.reValidateMode=e.reValidateMode)},[u,e.mode,e.reValidateMode]),Q.useEffect(()=>{e.errors&&(u._setErrors(e.errors),u._focusError())},[u,e.errors]),Q.useEffect(()=>{e.shouldUnregister&&u._subjects.state.next({values:u._getWatch()})},[u,e.shouldUnregister]),Q.useEffect(()=>{if(u._proxyFormState.isDirty){const d=u._getDirty();d!==i.isDirty&&u._subjects.state.next({isDirty:d})}},[u,i.isDirty]),Q.useEffect(()=>{e.values&&!Pa(e.values,r.current)?(u._reset(e.values,{keepFieldsRef:!0,...u._options.resetOptions}),r.current=e.values,s(d=>({...d}))):u._resetDefaultValues()},[u,e.values]),Q.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=h_(i,u),t.current}const r0=(e,t,r)=>{if(e&&"reportValidity"in e){const i=we(r,t);e.setCustomValidity(i&&i.message||""),e.reportValidity()}},Sp=(e,t)=>{for(const r in t.fields){const i=t.fields[r];i&&i.ref&&"reportValidity"in i.ref?r0(i.ref,r,e):i&&i.refs&&i.refs.forEach(s=>r0(s,r,e))}},i0=(e,t)=>{t.shouldUseNativeValidation&&Sp(e,t);const r={};for(const i in e){const s=we(t.fields,i),u=Object.assign(e[i]||{},{ref:s&&s.ref});if(y5(t.names||Object.keys(e),i)){const d=Object.assign({},we(r,i));xt(d,"root",u),xt(r,i,d)}else xt(r,i,u)}return r},y5=(e,t)=>{const r=o0(t);return e.some(i=>o0(i).match(`^${r}\\.\\d+`))};function o0(e){return e.replace(/\]|\[/g,"")}function re(e,t,r){function i(h,g){var y;Object.defineProperty(h,"_zod",{value:h._zod??{},enumerable:!1}),(y=h._zod).traits??(y.traits=new Set),h._zod.traits.add(e),t(h,g);for(const x in d.prototype)x in h||Object.defineProperty(h,x,{value:d.prototype[x].bind(h)});h._zod.constr=d,h._zod.def=g}const s=r?.Parent??Object;class u extends s{}Object.defineProperty(u,"name",{value:e});function d(h){var g;const y=r?.Parent?new u:this;i(y,h),(g=y._zod).deferred??(g.deferred=[]);for(const x of y._zod.deferred)x();return y}return Object.defineProperty(d,"init",{value:i}),Object.defineProperty(d,Symbol.hasInstance,{value:h=>r?.Parent&&h instanceof r.Parent?!0:h?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}class hs extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class w_ extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}const S_={};function eo(e){return S_}function v5(e){const t=Object.values(e).filter(i=>typeof i=="number");return Object.entries(e).filter(([i,s])=>t.indexOf(+i)===-1).map(([i,s])=>s)}function _p(e,t){return typeof t=="bigint"?t.toString():t}function Sg(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function _g(e){return e==null}function Eg(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function x5(e,t){const r=(e.toString().split(".")[1]||"").length,i=t.toString();let s=(i.split(".")[1]||"").length;if(s===0&&/\d?e-\d?/.test(i)){const g=i.match(/\d?e-(\d?)/);g?.[1]&&(s=Number.parseInt(g[1]))}const u=r>s?r:s,d=Number.parseInt(e.toFixed(u).replace(".","")),h=Number.parseInt(t.toFixed(u).replace(".",""));return d%h/10**u}const s0=Symbol("evaluating");function Ot(e,t,r){let i;Object.defineProperty(e,t,{get(){if(i!==s0)return i===void 0&&(i=s0,i=r()),i},set(s){Object.defineProperty(e,t,{value:s})},configurable:!0})}function io(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function oo(...e){const t={};for(const r of e){const i=Object.getOwnPropertyDescriptors(r);Object.assign(t,i)}return Object.defineProperties({},t)}function l0(e){return JSON.stringify(e)}const __="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function vd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const b5=Sg(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Zl(e){if(vd(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(vd(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function E_(e){return Zl(e)?{...e}:Array.isArray(e)?[...e]:e}const w5=new Set(["string","number","symbol"]);function xs(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function wi(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 S5(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}const _5={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function E5(e,t){const r=e._zod.def,i=oo(e._zod.def,{get shape(){const s={};for(const u in t){if(!(u in r.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&(s[u]=r.shape[u])}return io(this,"shape",s),s},checks:[]});return wi(e,i)}function C5(e,t){const r=e._zod.def,i=oo(e._zod.def,{get shape(){const s={...e._zod.def.shape};for(const u in t){if(!(u in r.shape))throw new Error(`Unrecognized key: "${u}"`);t[u]&&delete s[u]}return io(this,"shape",s),s},checks:[]});return wi(e,i)}function j5(e,t){if(!Zl(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0)throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");const s=oo(e._zod.def,{get shape(){const u={...e._zod.def.shape,...t};return io(this,"shape",u),u},checks:[]});return wi(e,s)}function R5(e,t){if(!Zl(t))throw new Error("Invalid input to safeExtend: expected a plain object");const r={...e._zod.def,get shape(){const i={...e._zod.def.shape,...t};return io(this,"shape",i),i},checks:e._zod.def.checks};return wi(e,r)}function O5(e,t){const r=oo(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t._zod.def.shape};return io(this,"shape",i),i},get catchall(){return t._zod.def.catchall},checks:[]});return wi(e,r)}function N5(e,t,r){const i=oo(t._zod.def,{get shape(){const s=t._zod.def.shape,u={...s};if(r)for(const d in r){if(!(d in s))throw new Error(`Unrecognized key: "${d}"`);r[d]&&(u[d]=e?new e({type:"optional",innerType:s[d]}):s[d])}else for(const d in s)u[d]=e?new e({type:"optional",innerType:s[d]}):s[d];return io(this,"shape",u),u},checks:[]});return wi(t,i)}function A5(e,t,r){const i=oo(t._zod.def,{get shape(){const s=t._zod.def.shape,u={...s};if(r)for(const d in r){if(!(d in u))throw new Error(`Unrecognized key: "${d}"`);r[d]&&(u[d]=new e({type:"nonoptional",innerType:s[d]}))}else for(const d in s)u[d]=new e({type:"nonoptional",innerType:s[d]});return io(this,"shape",u),u},checks:[]});return wi(t,i)}function us(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 Bu(e){return typeof e=="string"?e:e?.message}function to(e,t,r){const i={...e,path:e.path??[]};if(!e.message){const s=Bu(e.inst?._zod.def?.error?.(e))??Bu(t?.error?.(e))??Bu(r.customError?.(e))??Bu(r.localeError?.(e))??"Invalid input";i.message=s}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function Cg(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Yl(...e){const[t,r,i]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:i}:{...t}}const j_=(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,_p,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},jg=re("$ZodError",j_),Yd=re("$ZodError",j_,{Parent:Error});function T5(e,t=r=>r.message){const r={},i=[];for(const s of e.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):i.push(t(s));return{formErrors:i,fieldErrors:r}}function D5(e,t=r=>r.message){const r={_errors:[]},i=s=>{for(const u of s.issues)if(u.code==="invalid_union"&&u.errors.length)u.errors.map(d=>i({issues:d}));else if(u.code==="invalid_key")i({issues:u.issues});else if(u.code==="invalid_element")i({issues:u.issues});else if(u.path.length===0)r._errors.push(t(u));else{let d=r,h=0;for(;h(t,r,i,s)=>{const u=i?Object.assign(i,{async:!1}):{async:!1},d=t._zod.run({value:r,issues:[]},u);if(d instanceof Promise)throw new hs;if(d.issues.length){const h=new(s?.Err??e)(d.issues.map(g=>to(g,u,eo())));throw __(h,s?.callee),h}return d.value},M5=Qd(Yd),Jd=e=>async(t,r,i,s)=>{const u=i?Object.assign(i,{async:!0}):{async:!0};let d=t._zod.run({value:r,issues:[]},u);if(d instanceof Promise&&(d=await d),d.issues.length){const h=new(s?.Err??e)(d.issues.map(g=>to(g,u,eo())));throw __(h,s?.callee),h}return d.value},z5=Jd(Yd),Wd=e=>(t,r,i)=>{const s=i?{...i,async:!1}:{async:!1},u=t._zod.run({value:r,issues:[]},s);if(u instanceof Promise)throw new hs;return u.issues.length?{success:!1,error:new(e??jg)(u.issues.map(d=>to(d,s,eo())))}:{success:!0,data:u.value}},k5=Wd(Yd),ef=e=>async(t,r,i)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let u=t._zod.run({value:r,issues:[]},s);return u instanceof Promise&&(u=await u),u.issues.length?{success:!1,error:new e(u.issues.map(d=>to(d,s,eo())))}:{success:!0,data:u.value}},P5=ef(Yd),K5=e=>(t,r,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Qd(e)(t,r,s)},I5=e=>(t,r,i)=>Qd(e)(t,r,i),L5=e=>async(t,r,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Jd(e)(t,r,s)},U5=e=>async(t,r,i)=>Jd(e)(t,r,i),q5=e=>(t,r,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Wd(e)(t,r,s)},F5=e=>(t,r,i)=>Wd(e)(t,r,i),$5=e=>async(t,r,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return ef(e)(t,r,s)},V5=e=>async(t,r,i)=>ef(e)(t,r,i),H5=/^[cC][^\s-]{8,}$/,B5=/^[0-9a-z]+$/,G5=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,X5=/^[0-9a-vA-V]{20}$/,Z5=/^[A-Za-z0-9]{27}$/,Y5=/^[a-zA-Z0-9_-]{21}$/,Q5=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,J5=/^([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})$/,c0=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)$/,W5=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,e6="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function t6(){return new RegExp(e6,"u")}const n6=/^(?:(?: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])$/,a6=/^(([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}|:))$/,r6=/^((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])$/,i6=/^(([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])$/,o6=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,R_=/^[A-Za-z0-9_-]*$/,s6=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,l6=/^\+(?:[0-9]){6,14}[0-9]$/,O_="(?:(?:\\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])))",c6=new RegExp(`^${O_}$`);function N_(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 u6(e){return new RegExp(`^${N_(e)}$`)}function d6(e){const t=N_({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(`^${O_}T(?:${i})$`)}const f6=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},h6=/^-?\d+$/,m6=/^-?\d+(?:\.\d+)?/,p6=/^[^A-Z]*$/,g6=/^[^a-z]*$/,Xn=re("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),A_={number:"number",bigint:"bigint",object:"date"},T_=re("$ZodCheckLessThan",(e,t)=>{Xn.init(e,t);const r=A_[typeof t.value];e._zod.onattach.push(i=>{const s=i._zod.bag,u=(t.inclusive?s.maximum:s.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value{(t.inclusive?i.value<=t.value:i.value{Xn.init(e,t);const r=A_[typeof t.value];e._zod.onattach.push(i=>{const s=i._zod.bag,u=(t.inclusive?s.minimum:s.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>u&&(t.inclusive?s.minimum=t.value:s.exclusiveMinimum=t.value)}),e._zod.check=i=>{(t.inclusive?i.value>=t.value:i.value>t.value)||i.issues.push({origin:r,code:"too_small",minimum:t.value,input:i.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),y6=re("$ZodCheckMultipleOf",(e,t)=>{Xn.init(e,t),e._zod.onattach.push(r=>{var i;(i=r._zod.bag).multipleOf??(i.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):x5(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),v6=re("$ZodCheckNumberFormat",(e,t)=>{Xn.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),i=r?"int":"number",[s,u]=_5[t.format];e._zod.onattach.push(d=>{const h=d._zod.bag;h.format=t.format,h.minimum=s,h.maximum=u,r&&(h.pattern=h6)}),e._zod.check=d=>{const h=d.value;if(r){if(!Number.isInteger(h)){d.issues.push({expected:i,format:t.format,code:"invalid_type",continue:!1,input:h,inst:e});return}if(!Number.isSafeInteger(h)){h>0?d.issues.push({input:h,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort}):d.issues.push({input:h,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:i,continue:!t.abort});return}}hu&&d.issues.push({origin:"number",input:h,code:"too_big",maximum:u,inst:e})}}),x6=re("$ZodCheckMaxLength",(e,t)=>{var r;Xn.init(e,t),(r=e._zod.def).when??(r.when=i=>{const s=i.value;return!_g(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{const s=i._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum{const s=i.value;if(s.length<=t.maximum)return;const d=Cg(s);i.issues.push({origin:d,code:"too_big",maximum:t.maximum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),b6=re("$ZodCheckMinLength",(e,t)=>{var r;Xn.init(e,t),(r=e._zod.def).when??(r.when=i=>{const s=i.value;return!_g(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{const s=i._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>s&&(i._zod.bag.minimum=t.minimum)}),e._zod.check=i=>{const s=i.value;if(s.length>=t.minimum)return;const d=Cg(s);i.issues.push({origin:d,code:"too_small",minimum:t.minimum,inclusive:!0,input:s,inst:e,continue:!t.abort})}}),w6=re("$ZodCheckLengthEquals",(e,t)=>{var r;Xn.init(e,t),(r=e._zod.def).when??(r.when=i=>{const s=i.value;return!_g(s)&&s.length!==void 0}),e._zod.onattach.push(i=>{const s=i._zod.bag;s.minimum=t.length,s.maximum=t.length,s.length=t.length}),e._zod.check=i=>{const s=i.value,u=s.length;if(u===t.length)return;const d=Cg(s),h=u>t.length;i.issues.push({origin:d,...h?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:i.value,inst:e,continue:!t.abort})}}),tf=re("$ZodCheckStringFormat",(e,t)=>{var r,i;Xn.init(e,t),e._zod.onattach.push(s=>{const u=s._zod.bag;u.format=t.format,t.pattern&&(u.patterns??(u.patterns=new Set),u.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=s=>{t.pattern.lastIndex=0,!t.pattern.test(s.value)&&s.issues.push({origin:"string",code:"invalid_format",format:t.format,input:s.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),S6=re("$ZodCheckRegex",(e,t)=>{tf.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})}}),_6=re("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=p6),tf.init(e,t)}),E6=re("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=g6),tf.init(e,t)}),C6=re("$ZodCheckIncludes",(e,t)=>{Xn.init(e,t);const r=xs(t.includes),i=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=i,e._zod.onattach.push(s=>{const u=s._zod.bag;u.patterns??(u.patterns=new Set),u.patterns.add(i)}),e._zod.check=s=>{s.value.includes(t.includes,t.position)||s.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:s.value,inst:e,continue:!t.abort})}}),j6=re("$ZodCheckStartsWith",(e,t)=>{Xn.init(e,t);const r=new RegExp(`^${xs(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.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})}}),R6=re("$ZodCheckEndsWith",(e,t)=>{Xn.init(e,t);const r=new RegExp(`.*${xs(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.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})}}),O6=re("$ZodCheckOverwrite",(e,t)=>{Xn.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}});class N6{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(d=>d),s=Math.min(...i.map(d=>d.length-d.trimStart().length)),u=i.map(d=>d.slice(s)).map(d=>" ".repeat(this.indent*2)+d);for(const d of u)this.content.push(d)}compile(){const t=Function,r=this?.args,s=[...(this?.content??[""]).map(u=>` ${u}`)];return new t(...r,s.join(` `))}}const A6={major:4,minor:1,patch:12},$t=re("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=A6;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const s of i)for(const u of s._zod.onattach)u(e);if(i.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const s=(d,h,g)=>{let y=us(d),x;for(const v of h){if(v._zod.def.when){if(!v._zod.def.when(d))continue}else if(y)continue;const w=d.issues.length,E=v._zod.check(d);if(E instanceof Promise&&g?.async===!1)throw new hs;if(x||E instanceof Promise)x=(x??Promise.resolve()).then(async()=>{await E,d.issues.length!==w&&(y||(y=us(d,w)))});else{if(d.issues.length===w)continue;y||(y=us(d,w))}}return x?x.then(()=>d):d},u=(d,h,g)=>{if(us(d))return d.aborted=!0,d;const y=s(h,i,g);if(y instanceof Promise){if(g.async===!1)throw new hs;return y.then(x=>e._zod.parse(x,g))}return e._zod.parse(y,g)};e._zod.run=(d,h)=>{if(h.skipChecks)return e._zod.parse(d,h);if(h.direction==="backward"){const y=e._zod.parse({value:d.value,issues:[]},{...h,skipChecks:!0});return y instanceof Promise?y.then(x=>u(x,d,h)):u(y,d,h)}const g=e._zod.parse(d,h);if(g instanceof Promise){if(h.async===!1)throw new hs;return g.then(y=>s(y,i,h))}return s(g,i,h)}}e["~standard"]={validate:s=>{try{const u=k5(e,s);return u.success?{value:u.data}:{issues:u.error?.issues}}catch{return P5(e,s).then(d=>d.success?{value:d.data}:{issues:d.error?.issues})}},vendor:"zod",version:1}}),Rg=re("$ZodString",(e,t)=>{$t.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??f6(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}}),zt=re("$ZodStringFormat",(e,t)=>{tf.init(e,t),Rg.init(e,t)}),T6=re("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=J5),zt.init(e,t)}),D6=re("$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=c0(i))}else t.pattern??(t.pattern=c0());zt.init(e,t)}),M6=re("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=W5),zt.init(e,t)}),z6=re("$ZodURL",(e,t)=>{zt.init(e,t),e._zod.check=r=>{try{const i=r.value.trim(),s=new URL(i);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:s6.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.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=s.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),k6=re("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=t6()),zt.init(e,t)}),P6=re("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Y5),zt.init(e,t)}),K6=re("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=H5),zt.init(e,t)}),I6=re("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=B5),zt.init(e,t)}),L6=re("$ZodULID",(e,t)=>{t.pattern??(t.pattern=G5),zt.init(e,t)}),U6=re("$ZodXID",(e,t)=>{t.pattern??(t.pattern=X5),zt.init(e,t)}),q6=re("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Z5),zt.init(e,t)}),F6=re("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=d6(t)),zt.init(e,t)}),$6=re("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=c6),zt.init(e,t)}),V6=re("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=u6(t)),zt.init(e,t)}),H6=re("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Q5),zt.init(e,t)}),B6=re("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=n6),zt.init(e,t),e._zod.onattach.push(r=>{const i=r._zod.bag;i.format="ipv4"})}),G6=re("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=a6),zt.init(e,t),e._zod.onattach.push(r=>{const i=r._zod.bag;i.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})}}}),X6=re("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=r6),zt.init(e,t)}),Z6=re("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=i6),zt.init(e,t),e._zod.check=r=>{const i=r.value.split("/");try{if(i.length!==2)throw new Error;const[s,u]=i;if(!u)throw new Error;const d=Number(u);if(`${d}`!==u)throw new Error;if(d<0||d>128)throw new Error;new URL(`http://[${s}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function M_(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Y6=re("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=o6),zt.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64"}),e._zod.check=r=>{M_(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function Q6(e){if(!R_.test(e))return!1;const t=e.replace(/[-_]/g,i=>i==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return M_(r)}const J6=re("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=R_),zt.init(e,t),e._zod.onattach.push(r=>{r._zod.bag.contentEncoding="base64url"}),e._zod.check=r=>{Q6(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),W6=re("$ZodE164",(e,t)=>{t.pattern??(t.pattern=l6),zt.init(e,t)});function eP(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[i]=r;if(!i)return!1;const s=JSON.parse(atob(i));return!("typ"in s&&s?.typ!=="JWT"||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}}const tP=re("$ZodJWT",(e,t)=>{zt.init(e,t),e._zod.check=r=>{eP(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),z_=re("$ZodNumber",(e,t)=>{$t.init(e,t),e._zod.pattern=e._zod.bag.pattern??m6,e._zod.parse=(r,i)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const s=r.value;if(typeof s=="number"&&!Number.isNaN(s)&&Number.isFinite(s))return r;const u=typeof s=="number"?Number.isNaN(s)?"NaN":Number.isFinite(s)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:s,inst:e,...u?{received:u}:{}}),r}}),nP=re("$ZodNumber",(e,t)=>{v6.init(e,t),z_.init(e,t)}),aP=re("$ZodUnknown",(e,t)=>{$t.init(e,t),e._zod.parse=r=>r}),rP=re("$ZodNever",(e,t)=>{$t.init(e,t),e._zod.parse=(r,i)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function u0(e,t,r){e.issues.length&&t.issues.push(...C_(r,e.issues)),t.value[r]=e.value}const iP=re("$ZodArray",(e,t)=>{$t.init(e,t),e._zod.parse=(r,i)=>{const s=r.value;if(!Array.isArray(s))return r.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),r;r.value=Array(s.length);const u=[];for(let d=0;du0(y,r,d))):u0(g,r,d)}return u.length?Promise.all(u).then(()=>r):r}});function xd(e,t,r,i){e.issues.length&&t.issues.push(...C_(r,e.issues)),e.value===void 0?r in i&&(t.value[r]=void 0):t.value[r]=e.value}function k_(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=S5(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function P_(e,t,r,i,s,u){const d=[],h=s.keySet,g=s.catchall._zod,y=g.def.type;for(const x of Object.keys(t)){if(h.has(x))continue;if(y==="never"){d.push(x);continue}const v=g.run({value:t[x],issues:[]},i);v instanceof Promise?e.push(v.then(w=>xd(w,r,x,t))):xd(v,r,x,t)}return d.length&&r.issues.push({code:"unrecognized_keys",keys:d,input:t,inst:u}),e.length?Promise.all(e).then(()=>r):r}const oP=re("$ZodObject",(e,t)=>{if($t.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const h=t.shape;Object.defineProperty(t,"shape",{get:()=>{const g={...h};return Object.defineProperty(t,"shape",{value:g}),g}})}const i=Sg(()=>k_(t));Ot(e._zod,"propValues",()=>{const h=t.shape,g={};for(const y in h){const x=h[y]._zod;if(x.values){g[y]??(g[y]=new Set);for(const v of x.values)g[y].add(v)}}return g});const s=vd,u=t.catchall;let d;e._zod.parse=(h,g)=>{d??(d=i.value);const y=h.value;if(!s(y))return h.issues.push({expected:"object",code:"invalid_type",input:y,inst:e}),h;h.value={};const x=[],v=d.shape;for(const w of d.keys){const j=v[w]._zod.run({value:y[w],issues:[]},g);j instanceof Promise?x.push(j.then(S=>xd(S,h,w,y))):xd(j,h,w,y)}return u?P_(x,y,h,g,i.value,e):x.length?Promise.all(x).then(()=>h):h}}),sP=re("$ZodObjectJIT",(e,t)=>{oP.init(e,t);const r=e._zod.parse,i=Sg(()=>k_(t)),s=w=>{const E=new N6(["shape","payload","ctx"]),j=i.value,S=O=>{const C=l0(O);return`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`};E.write("const input = payload.value;");const N=Object.create(null);let D=0;for(const O of j.keys)N[O]=`key_${D++}`;E.write("const newResult = {};");for(const O of j.keys){const C=N[O],T=l0(O);E.write(`const ${C} = ${S(O)};`),E.write(` if (${C}.issues.length) { payload.issues = payload.issues.concat(${C}.issues.map(iss => ({ ...iss, path: iss.path ? [${T}, ...iss.path] : [${T}] }))); } if (${C}.value === undefined) { if (${T} in input) { newResult[${T}] = undefined; } } else { newResult[${T}] = ${C}.value; } `)}E.write("payload.value = newResult;"),E.write("return payload;");const A=E.compile();return(O,C)=>A(w,O,C)};let u;const d=vd,h=!S_.jitless,y=h&&b5.value,x=t.catchall;let v;e._zod.parse=(w,E)=>{v??(v=i.value);const j=w.value;return d(j)?h&&y&&E?.async===!1&&E.jitless!==!0?(u||(u=s(t.shape)),w=u(w,E),x?P_([],j,w,E,v,e):w):r(w,E):(w.issues.push({expected:"object",code:"invalid_type",input:j,inst:e}),w)}});function d0(e,t,r,i){for(const u of e)if(u.issues.length===0)return t.value=u.value,t;const s=e.filter(u=>!us(u));return s.length===1?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map(u=>u.issues.map(d=>to(d,i,eo())))}),t)}const lP=re("$ZodUnion",(e,t)=>{$t.init(e,t),Ot(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Ot(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Ot(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),Ot(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(u=>u._zod.pattern);return new RegExp(`^(${s.map(u=>Eg(u.source)).join("|")})$`)}});const r=t.options.length===1,i=t.options[0]._zod.run;e._zod.parse=(s,u)=>{if(r)return i(s,u);let d=!1;const h=[];for(const g of t.options){const y=g._zod.run({value:s.value,issues:[]},u);if(y instanceof Promise)h.push(y),d=!0;else{if(y.issues.length===0)return y;h.push(y)}}return d?Promise.all(h).then(g=>d0(g,s,e,u)):d0(h,s,e,u)}}),cP=re("$ZodIntersection",(e,t)=>{$t.init(e,t),e._zod.parse=(r,i)=>{const s=r.value,u=t.left._zod.run({value:s,issues:[]},i),d=t.right._zod.run({value:s,issues:[]},i);return u instanceof Promise||d instanceof Promise?Promise.all([u,d]).then(([g,y])=>f0(r,g,y)):f0(r,u,d)}});function Ep(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Zl(e)&&Zl(t)){const r=Object.keys(t),i=Object.keys(e).filter(u=>r.indexOf(u)!==-1),s={...e,...t};for(const u of i){const d=Ep(e[u],t[u]);if(!d.valid)return{valid:!1,mergeErrorPath:[u,...d.mergeErrorPath]};s[u]=d.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let i=0;i{$t.init(e,t);const r=v5(t.entries),i=new Set(r);e._zod.values=i,e._zod.pattern=new RegExp(`^(${r.filter(s=>w5.has(typeof s)).map(s=>typeof s=="string"?xs(s):s.toString()).join("|")})$`),e._zod.parse=(s,u)=>{const d=s.value;return i.has(d)||s.issues.push({code:"invalid_value",values:r,input:d,inst:e}),s}}),dP=re("$ZodLiteral",(e,t)=>{if($t.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?xs(r):r?xs(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,i)=>{const s=r.value;return e._zod.values.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}}),fP=re("$ZodTransform",(e,t)=>{$t.init(e,t),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new w_(e.constructor.name);const s=t.transform(r.value,r);if(i.async)return(s instanceof Promise?s:Promise.resolve(s)).then(d=>(r.value=d,r));if(s instanceof Promise)throw new hs;return r.value=s,r}});function h0(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}const hP=re("$ZodOptional",(e,t)=>{$t.init(e,t),e._zod.optin="optional",e._zod.optout="optional",Ot(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Ot(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Eg(r.source)})?$`):void 0}),e._zod.parse=(r,i)=>{if(t.innerType._zod.optin==="optional"){const s=t.innerType._zod.run(r,i);return s instanceof Promise?s.then(u=>h0(u,r.value)):h0(s,r.value)}return r.value===void 0?r:t.innerType._zod.run(r,i)}}),mP=re("$ZodNullable",(e,t)=>{$t.init(e,t),Ot(e._zod,"optin",()=>t.innerType._zod.optin),Ot(e._zod,"optout",()=>t.innerType._zod.optout),Ot(e._zod,"pattern",()=>{const r=t.innerType._zod.pattern;return r?new RegExp(`^(${Eg(r.source)}|null)$`):void 0}),Ot(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(r,i)=>r.value===null?r:t.innerType._zod.run(r,i)}),pP=re("$ZodDefault",(e,t)=>{$t.init(e,t),e._zod.optin="optional",Ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);if(r.value===void 0)return r.value=t.defaultValue,r;const s=t.innerType._zod.run(r,i);return s instanceof Promise?s.then(u=>m0(u,t)):m0(s,t)}});function m0(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const gP=re("$ZodPrefault",(e,t)=>{$t.init(e,t),e._zod.optin="optional",Ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,i)=>(i.direction==="backward"||r.value===void 0&&(r.value=t.defaultValue),t.innerType._zod.run(r,i))}),yP=re("$ZodNonOptional",(e,t)=>{$t.init(e,t),Ot(e._zod,"values",()=>{const r=t.innerType._zod.values;return r?new Set([...r].filter(i=>i!==void 0)):void 0}),e._zod.parse=(r,i)=>{const s=t.innerType._zod.run(r,i);return s instanceof Promise?s.then(u=>p0(u,e)):p0(s,e)}});function p0(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const vP=re("$ZodCatch",(e,t)=>{$t.init(e,t),Ot(e._zod,"optin",()=>t.innerType._zod.optin),Ot(e._zod,"optout",()=>t.innerType._zod.optout),Ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);const s=t.innerType._zod.run(r,i);return s instanceof Promise?s.then(u=>(r.value=u.value,u.issues.length&&(r.value=t.catchValue({...r,error:{issues:u.issues.map(d=>to(d,i,eo()))},input:r.value}),r.issues=[]),r)):(r.value=s.value,s.issues.length&&(r.value=t.catchValue({...r,error:{issues:s.issues.map(u=>to(u,i,eo()))},input:r.value}),r.issues=[]),r)}}),xP=re("$ZodPipe",(e,t)=>{$t.init(e,t),Ot(e._zod,"values",()=>t.in._zod.values),Ot(e._zod,"optin",()=>t.in._zod.optin),Ot(e._zod,"optout",()=>t.out._zod.optout),Ot(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(r,i)=>{if(i.direction==="backward"){const u=t.out._zod.run(r,i);return u instanceof Promise?u.then(d=>Gu(d,t.in,i)):Gu(u,t.in,i)}const s=t.in._zod.run(r,i);return s instanceof Promise?s.then(u=>Gu(u,t.out,i)):Gu(s,t.out,i)}});function Gu(e,t,r){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},r)}const bP=re("$ZodReadonly",(e,t)=>{$t.init(e,t),Ot(e._zod,"propValues",()=>t.innerType._zod.propValues),Ot(e._zod,"values",()=>t.innerType._zod.values),Ot(e._zod,"optin",()=>t.innerType._zod.optin),Ot(e._zod,"optout",()=>t.innerType._zod.optout),e._zod.parse=(r,i)=>{if(i.direction==="backward")return t.innerType._zod.run(r,i);const s=t.innerType._zod.run(r,i);return s instanceof Promise?s.then(g0):g0(s)}});function g0(e){return e.value=Object.freeze(e.value),e}const wP=re("$ZodCustom",(e,t)=>{Xn.init(e,t),$t.init(e,t),e._zod.parse=(r,i)=>r,e._zod.check=r=>{const i=r.value,s=t.fn(i);if(s instanceof Promise)return s.then(u=>y0(u,r,i,e));y0(s,r,i,e)}});function y0(e,t,r,i){if(!e){const s={code:"custom",input:r,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(s.params=i._zod.def.params),t.issues.push(Yl(s))}}class SP{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...r){const i=r[0];if(this._map.set(t,i),i&&typeof i=="object"&&"id"in i){if(this._idmap.has(i.id))throw new Error(`ID ${i.id} already exists in the registry`);this._idmap.set(i.id,t)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const r=this._map.get(t);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(t),this}get(t){const r=t._zod.parent;if(r){const i={...this.get(r)??{}};delete i.id;const s={...i,...this._map.get(t)};return Object.keys(s).length?s:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function _P(){return new SP}const Xu=_P();function EP(e,t){return new e({type:"string",...Ie(t)})}function CP(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Ie(t)})}function v0(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Ie(t)})}function K_(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Ie(t)})}function jP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Ie(t)})}function RP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Ie(t)})}function OP(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Ie(t)})}function NP(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Ie(t)})}function AP(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Ie(t)})}function TP(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Ie(t)})}function DP(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Ie(t)})}function MP(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Ie(t)})}function zP(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Ie(t)})}function kP(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Ie(t)})}function PP(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Ie(t)})}function KP(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Ie(t)})}function IP(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Ie(t)})}function LP(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Ie(t)})}function UP(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Ie(t)})}function qP(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Ie(t)})}function FP(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Ie(t)})}function $P(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Ie(t)})}function VP(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Ie(t)})}function HP(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Ie(t)})}function BP(e,t){return new e({type:"string",format:"date",check:"string_format",...Ie(t)})}function GP(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Ie(t)})}function XP(e,t){return new e({type:"string",format:"duration",check:"string_format",...Ie(t)})}function ZP(e,t){return new e({type:"number",checks:[],...Ie(t)})}function YP(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...Ie(t)})}function QP(e){return new e({type:"unknown"})}function JP(e,t){return new e({type:"never",...Ie(t)})}function x0(e,t){return new T_({check:"less_than",...Ie(t),value:e,inclusive:!1})}function Hm(e,t){return new T_({check:"less_than",...Ie(t),value:e,inclusive:!0})}function b0(e,t){return new D_({check:"greater_than",...Ie(t),value:e,inclusive:!1})}function Bm(e,t){return new D_({check:"greater_than",...Ie(t),value:e,inclusive:!0})}function w0(e,t){return new y6({check:"multiple_of",...Ie(t),value:e})}function I_(e,t){return new x6({check:"max_length",...Ie(t),maximum:e})}function bd(e,t){return new b6({check:"min_length",...Ie(t),minimum:e})}function L_(e,t){return new w6({check:"length_equals",...Ie(t),length:e})}function WP(e,t){return new S6({check:"string_format",format:"regex",...Ie(t),pattern:e})}function e8(e){return new _6({check:"string_format",format:"lowercase",...Ie(e)})}function t8(e){return new E6({check:"string_format",format:"uppercase",...Ie(e)})}function n8(e,t){return new C6({check:"string_format",format:"includes",...Ie(t),includes:e})}function a8(e,t){return new j6({check:"string_format",format:"starts_with",...Ie(t),prefix:e})}function r8(e,t){return new R6({check:"string_format",format:"ends_with",...Ie(t),suffix:e})}function cc(e){return new O6({check:"overwrite",tx:e})}function i8(e){return cc(t=>t.normalize(e))}function o8(){return cc(e=>e.trim())}function s8(){return cc(e=>e.toLowerCase())}function l8(){return cc(e=>e.toUpperCase())}function c8(e,t,r){return new e({type:"array",element:t,...Ie(r)})}function u8(e,t,r){return new e({type:"custom",check:"custom",fn:t,...Ie(r)})}function d8(e){const t=f8(r=>(r.addIssue=i=>{if(typeof i=="string")r.issues.push(Yl(i,r.value,t._zod.def));else{const s=i;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),s.continue??(s.continue=!t._zod.def.abort),r.issues.push(Yl(s))}},e(r.value,r)));return t}function f8(e,t){const r=new Xn({check:"custom",...Ie(t)});return r._zod.check=e,r}function S0(e,t){try{var r=e()}catch(i){return t(i)}return r&&r.then?r.then(void 0,t):r}function h8(e,t){for(var r={};e.length;){var i=e[0],s=i.code,u=i.message,d=i.path.join(".");if(!r[d])if("unionErrors"in i){var h=i.unionErrors[0].errors[0];r[d]={message:h.message,type:h.code}}else r[d]={message:u,type:s};if("unionErrors"in i&&i.unionErrors.forEach(function(x){return x.errors.forEach(function(v){return e.push(v)})}),t){var g=r[d].types,y=g&&g[i.code];r[d]=xg(d,t,r,s,y?[].concat(y,i.message):i.message)}e.shift()}return r}function m8(e,t){for(var r={};e.length;){var i=e[0],s=i.code,u=i.message,d=i.path.join(".");if(!r[d])if(i.code==="invalid_union"&&i.errors.length>0){var h=i.errors[0][0];r[d]={message:h.message,type:h.code}}else r[d]={message:u,type:s};if(i.code==="invalid_union"&&i.errors.forEach(function(x){return x.forEach(function(v){return e.push(v)})}),t){var g=r[d].types,y=g&&g[i.code];r[d]=xg(d,t,r,s,y?[].concat(y,i.message):i.message)}e.shift()}return r}function En(e,t,r){if(r===void 0&&(r={}),(function(i){return"_def"in i&&typeof i._def=="object"&&"typeName"in i._def})(e))return function(i,s,u){try{return Promise.resolve(S0(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](i,t)).then(function(d){return u.shouldUseNativeValidation&&Sp({},u),{errors:{},values:r.raw?Object.assign({},i):d}})},function(d){if((function(h){return Array.isArray(h?.issues)})(d))return{values:{},errors:i0(h8(d.errors,!u.shouldUseNativeValidation&&u.criteriaMode==="all"),u)};throw d}))}catch(d){return Promise.reject(d)}};if((function(i){return"_zod"in i&&typeof i._zod=="object"})(e))return function(i,s,u){try{return Promise.resolve(S0(function(){return Promise.resolve((r.mode==="sync"?M5:z5)(e,i,t)).then(function(d){return u.shouldUseNativeValidation&&Sp({},u),{errors:{},values:r.raw?Object.assign({},i):d}})},function(d){if((function(h){return h instanceof jg})(d))return{values:{},errors:i0(m8(d.issues,!u.shouldUseNativeValidation&&u.criteriaMode==="all"),u)};throw d}))}catch(d){return Promise.reject(d)}};throw new Error("Invalid input: not a Zod schema")}const p8=re("ZodISODateTime",(e,t)=>{F6.init(e,t),Pt.init(e,t)});function g8(e){return HP(p8,e)}const y8=re("ZodISODate",(e,t)=>{$6.init(e,t),Pt.init(e,t)});function v8(e){return BP(y8,e)}const x8=re("ZodISOTime",(e,t)=>{V6.init(e,t),Pt.init(e,t)});function b8(e){return GP(x8,e)}const w8=re("ZodISODuration",(e,t)=>{H6.init(e,t),Pt.init(e,t)});function S8(e){return XP(w8,e)}const _8=(e,t)=>{jg.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r=>D5(e,r)},flatten:{value:r=>T5(e,r)},addIssue:{value:r=>{e.issues.push(r),e.message=JSON.stringify(e.issues,_p,2)}},addIssues:{value:r=>{e.issues.push(...r),e.message=JSON.stringify(e.issues,_p,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ra=re("ZodError",_8,{Parent:Error}),E8=Qd(Ra),C8=Jd(Ra),j8=Wd(Ra),R8=ef(Ra),O8=K5(Ra),N8=I5(Ra),A8=L5(Ra),T8=U5(Ra),D8=q5(Ra),M8=F5(Ra),z8=$5(Ra),k8=V5(Ra),Qt=re("ZodType",(e,t)=>($t.init(e,t),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...r)=>e.clone(oo(t,{checks:[...t.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]})),e.clone=(r,i)=>wi(e,r,i),e.brand=()=>e,e.register=((r,i)=>(r.add(e,i),e)),e.parse=(r,i)=>E8(e,r,i,{callee:e.parse}),e.safeParse=(r,i)=>j8(e,r,i),e.parseAsync=async(r,i)=>C8(e,r,i,{callee:e.parseAsync}),e.safeParseAsync=async(r,i)=>R8(e,r,i),e.spa=e.safeParseAsync,e.encode=(r,i)=>O8(e,r,i),e.decode=(r,i)=>N8(e,r,i),e.encodeAsync=async(r,i)=>A8(e,r,i),e.decodeAsync=async(r,i)=>T8(e,r,i),e.safeEncode=(r,i)=>D8(e,r,i),e.safeDecode=(r,i)=>M8(e,r,i),e.safeEncodeAsync=async(r,i)=>z8(e,r,i),e.safeDecodeAsync=async(r,i)=>k8(e,r,i),e.refine=(r,i)=>e.check(jK(r,i)),e.superRefine=r=>e.check(RK(r)),e.overwrite=r=>e.check(cc(r)),e.optional=()=>j0(e),e.nullable=()=>R0(e),e.nullish=()=>j0(R0(e)),e.nonoptional=r=>xK(e,r),e.array=()=>iK(e),e.or=r=>lK([e,r]),e.and=r=>uK(e,r),e.transform=r=>O0(e,hK(r)),e.default=r=>gK(e,r),e.prefault=r=>vK(e,r),e.catch=r=>wK(e,r),e.pipe=r=>O0(e,r),e.readonly=()=>EK(e),e.describe=r=>{const i=e.clone();return Xu.add(i,{description:r}),i},Object.defineProperty(e,"description",{get(){return Xu.get(e)?.description},configurable:!0}),e.meta=(...r)=>{if(r.length===0)return Xu.get(e);const i=e.clone();return Xu.add(i,r[0]),i},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e)),U_=re("_ZodString",(e,t)=>{Rg.init(e,t),Qt.init(e,t);const r=e._zod.bag;e.format=r.format??null,e.minLength=r.minimum??null,e.maxLength=r.maximum??null,e.regex=(...i)=>e.check(WP(...i)),e.includes=(...i)=>e.check(n8(...i)),e.startsWith=(...i)=>e.check(a8(...i)),e.endsWith=(...i)=>e.check(r8(...i)),e.min=(...i)=>e.check(bd(...i)),e.max=(...i)=>e.check(I_(...i)),e.length=(...i)=>e.check(L_(...i)),e.nonempty=(...i)=>e.check(bd(1,...i)),e.lowercase=i=>e.check(e8(i)),e.uppercase=i=>e.check(t8(i)),e.trim=()=>e.check(o8()),e.normalize=(...i)=>e.check(i8(...i)),e.toLowerCase=()=>e.check(s8()),e.toUpperCase=()=>e.check(l8())}),P8=re("ZodString",(e,t)=>{Rg.init(e,t),U_.init(e,t),e.email=r=>e.check(CP(K8,r)),e.url=r=>e.check(NP(I8,r)),e.jwt=r=>e.check(VP(W8,r)),e.emoji=r=>e.check(AP(L8,r)),e.guid=r=>e.check(v0(_0,r)),e.uuid=r=>e.check(K_(Kl,r)),e.uuidv4=r=>e.check(jP(Kl,r)),e.uuidv6=r=>e.check(RP(Kl,r)),e.uuidv7=r=>e.check(OP(Kl,r)),e.nanoid=r=>e.check(TP(U8,r)),e.guid=r=>e.check(v0(_0,r)),e.cuid=r=>e.check(DP(q8,r)),e.cuid2=r=>e.check(MP(F8,r)),e.ulid=r=>e.check(zP($8,r)),e.base64=r=>e.check(qP(Y8,r)),e.base64url=r=>e.check(FP(Q8,r)),e.xid=r=>e.check(kP(V8,r)),e.ksuid=r=>e.check(PP(H8,r)),e.ipv4=r=>e.check(KP(B8,r)),e.ipv6=r=>e.check(IP(G8,r)),e.cidrv4=r=>e.check(LP(X8,r)),e.cidrv6=r=>e.check(UP(Z8,r)),e.e164=r=>e.check($P(J8,r)),e.datetime=r=>e.check(g8(r)),e.date=r=>e.check(v8(r)),e.time=r=>e.check(b8(r)),e.duration=r=>e.check(S8(r))});function Zt(e){return EP(P8,e)}const Pt=re("ZodStringFormat",(e,t)=>{zt.init(e,t),U_.init(e,t)}),K8=re("ZodEmail",(e,t)=>{M6.init(e,t),Pt.init(e,t)}),_0=re("ZodGUID",(e,t)=>{T6.init(e,t),Pt.init(e,t)}),Kl=re("ZodUUID",(e,t)=>{D6.init(e,t),Pt.init(e,t)});function q_(e){return K_(Kl,e)}const I8=re("ZodURL",(e,t)=>{z6.init(e,t),Pt.init(e,t)}),L8=re("ZodEmoji",(e,t)=>{k6.init(e,t),Pt.init(e,t)}),U8=re("ZodNanoID",(e,t)=>{P6.init(e,t),Pt.init(e,t)}),q8=re("ZodCUID",(e,t)=>{K6.init(e,t),Pt.init(e,t)}),F8=re("ZodCUID2",(e,t)=>{I6.init(e,t),Pt.init(e,t)}),$8=re("ZodULID",(e,t)=>{L6.init(e,t),Pt.init(e,t)}),V8=re("ZodXID",(e,t)=>{U6.init(e,t),Pt.init(e,t)}),H8=re("ZodKSUID",(e,t)=>{q6.init(e,t),Pt.init(e,t)}),B8=re("ZodIPv4",(e,t)=>{B6.init(e,t),Pt.init(e,t)}),G8=re("ZodIPv6",(e,t)=>{G6.init(e,t),Pt.init(e,t)}),X8=re("ZodCIDRv4",(e,t)=>{X6.init(e,t),Pt.init(e,t)}),Z8=re("ZodCIDRv6",(e,t)=>{Z6.init(e,t),Pt.init(e,t)}),Y8=re("ZodBase64",(e,t)=>{Y6.init(e,t),Pt.init(e,t)}),Q8=re("ZodBase64URL",(e,t)=>{J6.init(e,t),Pt.init(e,t)}),J8=re("ZodE164",(e,t)=>{W6.init(e,t),Pt.init(e,t)}),W8=re("ZodJWT",(e,t)=>{tP.init(e,t),Pt.init(e,t)}),F_=re("ZodNumber",(e,t)=>{z_.init(e,t),Qt.init(e,t),e.gt=(i,s)=>e.check(b0(i,s)),e.gte=(i,s)=>e.check(Bm(i,s)),e.min=(i,s)=>e.check(Bm(i,s)),e.lt=(i,s)=>e.check(x0(i,s)),e.lte=(i,s)=>e.check(Hm(i,s)),e.max=(i,s)=>e.check(Hm(i,s)),e.int=i=>e.check(E0(i)),e.safe=i=>e.check(E0(i)),e.positive=i=>e.check(b0(0,i)),e.nonnegative=i=>e.check(Bm(0,i)),e.negative=i=>e.check(x0(0,i)),e.nonpositive=i=>e.check(Hm(0,i)),e.multipleOf=(i,s)=>e.check(w0(i,s)),e.step=(i,s)=>e.check(w0(i,s)),e.finite=()=>e;const r=e._zod.bag;e.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),e.isFinite=!0,e.format=r.format??null});function $_(e){return ZP(F_,e)}const eK=re("ZodNumberFormat",(e,t)=>{nP.init(e,t),F_.init(e,t)});function E0(e){return YP(eK,e)}const tK=re("ZodUnknown",(e,t)=>{aP.init(e,t),Qt.init(e,t)});function C0(){return QP(tK)}const nK=re("ZodNever",(e,t)=>{rP.init(e,t),Qt.init(e,t)});function aK(e){return JP(nK,e)}const rK=re("ZodArray",(e,t)=>{iP.init(e,t),Qt.init(e,t),e.element=t.element,e.min=(r,i)=>e.check(bd(r,i)),e.nonempty=r=>e.check(bd(1,r)),e.max=(r,i)=>e.check(I_(r,i)),e.length=(r,i)=>e.check(L_(r,i)),e.unwrap=()=>e.element});function iK(e,t){return c8(rK,e,t)}const oK=re("ZodObject",(e,t)=>{sP.init(e,t),Qt.init(e,t),Ot(e,"shape",()=>t.shape),e.keyof=()=>gi(Object.keys(e._zod.def.shape)),e.catchall=r=>e.clone({...e._zod.def,catchall:r}),e.passthrough=()=>e.clone({...e._zod.def,catchall:C0()}),e.loose=()=>e.clone({...e._zod.def,catchall:C0()}),e.strict=()=>e.clone({...e._zod.def,catchall:aK()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=r=>j5(e,r),e.safeExtend=r=>R5(e,r),e.merge=r=>O5(e,r),e.pick=r=>E5(e,r),e.omit=r=>C5(e,r),e.partial=(...r)=>N5(H_,e,r[0]),e.required=(...r)=>A5(B_,e,r[0])});function Oa(e,t){const r={type:"object",shape:e??{},...Ie(t)};return new oK(r)}const sK=re("ZodUnion",(e,t)=>{lP.init(e,t),Qt.init(e,t),e.options=t.options});function lK(e,t){return new sK({type:"union",options:e,...Ie(t)})}const cK=re("ZodIntersection",(e,t)=>{cP.init(e,t),Qt.init(e,t)});function uK(e,t){return new cK({type:"intersection",left:e,right:t})}const Cp=re("ZodEnum",(e,t)=>{uP.init(e,t),Qt.init(e,t),e.enum=t.entries,e.options=Object.values(t.entries);const r=new Set(Object.keys(t.entries));e.extract=(i,s)=>{const u={};for(const d of i)if(r.has(d))u[d]=t.entries[d];else throw new Error(`Key ${d} not found in enum`);return new Cp({...t,checks:[],...Ie(s),entries:u})},e.exclude=(i,s)=>{const u={...t.entries};for(const d of i)if(r.has(d))delete u[d];else throw new Error(`Key ${d} not found in enum`);return new Cp({...t,checks:[],...Ie(s),entries:u})}});function gi(e,t){const r=Array.isArray(e)?Object.fromEntries(e.map(i=>[i,i])):e;return new Cp({type:"enum",entries:r,...Ie(t)})}const dK=re("ZodLiteral",(e,t)=>{dP.init(e,t),Qt.init(e,t),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function V_(e,t){return new dK({type:"literal",values:Array.isArray(e)?e:[e],...Ie(t)})}const fK=re("ZodTransform",(e,t)=>{fP.init(e,t),Qt.init(e,t),e._zod.parse=(r,i)=>{if(i.direction==="backward")throw new w_(e.constructor.name);r.addIssue=u=>{if(typeof u=="string")r.issues.push(Yl(u,r.value,t));else{const d=u;d.fatal&&(d.continue=!1),d.code??(d.code="custom"),d.input??(d.input=r.value),d.inst??(d.inst=e),r.issues.push(Yl(d))}};const s=t.transform(r.value,r);return s instanceof Promise?s.then(u=>(r.value=u,r)):(r.value=s,r)}});function hK(e){return new fK({type:"transform",transform:e})}const H_=re("ZodOptional",(e,t)=>{hP.init(e,t),Qt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function j0(e){return new H_({type:"optional",innerType:e})}const mK=re("ZodNullable",(e,t)=>{mP.init(e,t),Qt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function R0(e){return new mK({type:"nullable",innerType:e})}const pK=re("ZodDefault",(e,t)=>{pP.init(e,t),Qt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function gK(e,t){return new pK({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():E_(t)}})}const yK=re("ZodPrefault",(e,t)=>{gP.init(e,t),Qt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function vK(e,t){return new yK({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():E_(t)}})}const B_=re("ZodNonOptional",(e,t)=>{yP.init(e,t),Qt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function xK(e,t){return new B_({type:"nonoptional",innerType:e,...Ie(t)})}const bK=re("ZodCatch",(e,t)=>{vP.init(e,t),Qt.init(e,t),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function wK(e,t){return new bK({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const SK=re("ZodPipe",(e,t)=>{xP.init(e,t),Qt.init(e,t),e.in=t.in,e.out=t.out});function O0(e,t){return new SK({type:"pipe",in:e,out:t})}const _K=re("ZodReadonly",(e,t)=>{bP.init(e,t),Qt.init(e,t),e.unwrap=()=>e._zod.def.innerType});function EK(e){return new _K({type:"readonly",innerType:e})}const CK=re("ZodCustom",(e,t)=>{wP.init(e,t),Qt.init(e,t)});function jK(e,t={}){return u8(CK,e,t)}function RK(e){return d8(e)}const OK=Bp("inline-flex items-center justify-center rounded-full border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Ia({className:e,variant:t,asChild:r=!1,...i}){const s=r?_s:"span";return l.jsx(s,{"data-slot":"badge",className:de(OK({variant:t}),e),...i})}var NK=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],AK=NK.reduce((e,t)=>{const r=Wl(`Primitive.${t}`),i=p.forwardRef((s,u)=>{const{asChild:d,...h}=s,g=d?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(g,{...h,ref:u})});return i.displayName=`Primitive.${t}`,{...e,[t]:i}},{}),TK="Label",G_=p.forwardRef((e,t)=>l.jsx(AK.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));G_.displayName=TK;var DK=G_;function Mr({className:e,...t}){return l.jsx(DK,{"data-slot":"label",className:de("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...t})}const Cn=W3,X_=p.createContext({}),$e=({...e})=>l.jsx(X_.Provider,{value:{name:e.name},children:l.jsx(n5,{...e})}),Og=()=>{const e=p.useContext(X_),t=p.useContext(Z_),{getFieldState:r}=Zd(),i=m_({name:e.name}),s=r(e.name,i);if(!e)throw new Error("useFormField should be used within ");const{id:u}=t;return{id:u,name:e.name,formItemId:`${u}-form-item`,formDescriptionId:`${u}-form-item-description`,formMessageId:`${u}-form-item-message`,...s}},Z_=p.createContext({});function Ve({className:e,...t}){const r=p.useId();return l.jsx(Z_.Provider,{value:{id:r},children:l.jsx("div",{"data-slot":"form-item",className:de("grid gap-2",e),...t})})}function He({className:e,...t}){const{error:r,formItemId:i}=Og();return l.jsx(Mr,{"data-slot":"form-label","data-error":!!r,className:de("data-[error=true]:text-destructive",e),htmlFor:i,...t})}function Xe({...e}){const{error:t,formItemId:r,formDescriptionId:i,formMessageId:s}=Og();return l.jsx(_s,{"data-slot":"form-control",id:r,"aria-describedby":t?`${i} ${s}`:`${i}`,"aria-invalid":!!t,...e})}function Be({className:e,...t}){const{error:r,formMessageId:i}=Og(),s=r?String(r?.message??""):t.children;return s?l.jsx("p",{"data-slot":"form-message",id:i,className:de("text-destructive text-sm",e),...t,children:s}):null}function la({className:e,...t}){return l.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:l.jsx("table",{"data-slot":"table",className:de("w-full caption-bottom text-sm",e),...t})})}function ca({className:e,...t}){return l.jsx("thead",{"data-slot":"table-header",className:de("[&_tr]:border-b",e),...t})}function ua({className:e,...t}){return l.jsx("tbody",{"data-slot":"table-body",className:de("[&_tr:last-child]:border-0",e),...t})}function et({className:e,...t}){return l.jsx("tr",{"data-slot":"table-row",className:de("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function ze({className:e,...t}){return l.jsx("th",{"data-slot":"table-head",className:de("text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function _e({className:e,...t}){return l.jsx("td",{"data-slot":"table-cell",className:de("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function MK({className:e,...t}){return l.jsx("caption",{"data-slot":"table-caption",className:de("text-muted-foreground mt-4 text-sm",e),...t})}const Y_=Oa({key:Zt().trim().min(1,"Key is required").max(120,"Max 120 chars"),value:Zt().trim().optional()}),zK=Y_.partial();function kK({t:e}){const t=`${e.key}${e.value?`=${e.value}`:""}`;return l.jsxs(Ia,{variant:"secondary",className:"font-mono text-xs",children:[l.jsx(jd,{className:"mr-1 h-3 w-3"}),t]})}const PK=()=>{const[e,t]=p.useState(""),[r,i]=p.useState(!1),[s,u]=p.useState(!1),[d,h]=p.useState(null),[g,y]=p.useState(null),x=da(),v=rn({queryKey:["annotations"],queryFn:()=>kl.listAnnotations()}),w=_n({resolver:En(Y_),defaultValues:{key:"",value:""}}),E=mt({mutationFn:C=>kl.createAnnotation(C),onSuccess:async()=>{await x.invalidateQueries({queryKey:["annotations"]}),w.reset(),i(!1),Ee.success("Annotation Created Successfully.")},onError:C=>{Ee.error(C.message??"There was an error while creating Annotation")}}),j=C=>{E.mutate(C)},S=_n({resolver:En(zK),defaultValues:{}}),N=mt({mutationFn:({id:C,values:T})=>kl.updateAnnotation(C,T),onSuccess:async()=>{await x.invalidateQueries({queryKey:["annotations"]}),S.reset(),u(!1),Ee.success("Annotation Updated Successfully.")},onError:C=>{Ee.error(C.message??"There was an error while updating Annotation")}}),D=C=>{y(C.id),S.reset({key:C.key,value:C.value}),u(!0)},A=mt({mutationFn:C=>kl.deleteAnnotation(C),onSuccess:async()=>{await x.invalidateQueries({queryKey:["annotations"]}),h(null),Ee.success("Annotation Deleted Successfully.")},onError:C=>{Ee.error(C.message??"There was an error while deleting Annotation")}}),O=p.useMemo(()=>{const C=v.data??[],T=e.trim().toLowerCase();return T?C.filter(U=>U.key?.toLowerCase().includes(T)||U.value?.toLowerCase().includes(T)):C},[e,v.data]);return v.isLoading?l.jsx("div",{className:"p-6",children:"Loading annotations…"}):v.error?l.jsxs("div",{className:"p-6 text-red-500",children:["Error loading annotations.",l.jsx("pre",{children:JSON.stringify(v,null,2)})]}):l.jsxs("div",{className:"space-y-4 p-6",children:[l.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[l.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Annotations"}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx(zr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),l.jsx(Fe,{value:e,onChange:C=>t(C.target.value),placeholder:"Search annotations",className:"w-64 pl-8"})]}),l.jsxs(Et,{open:r,onOpenChange:i,children:[l.jsx(or,{asChild:!0,children:l.jsxs(se,{onClick:()=>i(!0),children:[l.jsx(ro,{className:"mr-2 h-4 w-4"}),"Create Annotation"]})}),l.jsxs(Ct,{className:"sm:max-w-lg",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Create Label"})}),l.jsx(Cn,{...w,children:l.jsxs("form",{className:"space-y-4",onSubmit:w.handleSubmit(j),children:[l.jsx($e,{control:w.control,name:"key",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Key"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"environment",...C})}),l.jsx(Be,{})]})}),l.jsx($e,{control:w.control,name:"value",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Value"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"dev",...C})}),l.jsx(Be,{})]})}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),l.jsx(se,{type:"submit",disabled:w.formState.isSubmitting,children:w.formState.isSubmitting?"Creating…":"Create"})]})]})})]})]})]})]}),l.jsx("div",{className:"bg-background overflow-hidden rounded-2xl border shadow-sm",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(la,{children:[l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{children:"Key"}),l.jsx(ze,{children:"Value"}),l.jsx(ze,{children:"Annotation"}),l.jsx(ze,{className:"w-[180px] text-right",children:"Actions"})]})}),l.jsxs(ua,{children:[O.map(C=>l.jsxs(et,{children:[l.jsx(_e,{children:C.key}),l.jsx(_e,{children:C.value}),l.jsx(_e,{children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(kK,{t:C}),l.jsx("code",{className:"text-muted-foreground text-xs",children:Gi(C.id,6)})]})}),l.jsx(_e,{children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(se,{variant:"outline",size:"sm",onClick:()=>D(C),children:[l.jsx(Cd,{className:"mr-2 h-4 w-4"})," Edit"]}),l.jsx(se,{variant:"destructive",size:"sm",onClick:()=>h(C.id),disabled:A.isPending&&d===C.id,children:A.isPending&&d===C.id?"Deleting…":"Delete"})]})})]},C.id)),O.length===0&&l.jsx(et,{children:l.jsxs(_e,{colSpan:4,className:"text-muted-foreground py-10 text-center",children:[l.jsx(Fp,{className:"mx-auto mb-2 h-6 w-6 opacity-60"}),"No labels match your search."]})})]})]})})}),l.jsx(Et,{open:s,onOpenChange:u,children:l.jsxs(Ct,{className:"sm:max-w-lg",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Edit Annotation"})}),l.jsx(Cn,{...S,children:l.jsxs("form",{className:"space-y-4",onSubmit:S.handleSubmit(C=>{g&&N.mutate({id:g,values:C})}),children:[l.jsx($e,{control:S.control,name:"key",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Key"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"dedicated",...C})}),l.jsx(Be,{})]})}),l.jsx($e,{control:S.control,name:"value",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Value (optional)"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"gpu",...C})}),l.jsx(Be,{})]})}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),l.jsx(se,{type:"submit",disabled:N.isPending,children:N.isPending?"Saving…":"Save changes"})]})]})})]})}),l.jsx(Et,{open:!!d,onOpenChange:C=>!C&&h(null),children:l.jsxs(Ct,{className:"sm:max-w-md",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Delete annotation"})}),l.jsx("p",{className:"text-muted-foreground text-sm",children:"This action cannot be undone. Are you sure you want to delete this annotation?"}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),l.jsx(se,{variant:"destructive",onClick:()=>d&&A.mutate(d),disabled:A.isPending,children:A.isPending?"Deleting…":"Delete"})]})]})})]})};function Ua({className:e,...t}){return l.jsx("div",{"data-slot":"card",className:de("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function lr({className:e,...t}){return l.jsx("div",{"data-slot":"card-header",className:de("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e),...t})}function cr({className:e,...t}){return l.jsx("div",{"data-slot":"card-title",className:de("leading-none font-semibold",e),...t})}function jp({className:e,...t}){return l.jsx("div",{"data-slot":"card-description",className:de("text-muted-foreground text-sm",e),...t})}function qa({className:e,...t}){return l.jsx("div",{"data-slot":"card-content",className:de("px-6",e),...t})}function KK(e,t="gsot-auth",r=520,i=640){const s=window.top.outerHeight/2+window.top.screenY-i/2,u=window.top.outerWidth/2+window.top.screenX-r/2;return window.open(e,t,`toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=${r},height=${i},top=${s},left=${u}`)}async function IK(e){const t=new URLSearchParams({mode:"spa",origin:window.location.origin}),r=await fetch(`${Vp}/auth/${e}/start?`+t,{method:"POST"});if(!r.ok)throw new Error("Failed to start auth");return(await r.json()).auth_url}const N0=()=>{const e=IR(),t=Pp(),r=p.useMemo(()=>{const s=new URLSearchParams(t.search).get("to")||"/me";try{const u=new URL(s,window.location.origin);return u.origin===window.location.origin?u.pathname+u.search:"/me"}catch{return"/me"}},[t.search]);p.useEffect(()=>{wn.get()?.access_token&&e(r,{replace:!0})},[e,r]),p.useEffect(()=>{const s=u=>{if(!(typeof u.data=="object"&&u.data?.type==="autoglue:auth"))return;const h=u.data.payload;wn.set(h),e(r,{replace:!0})};return window.addEventListener("message",s),()=>window.removeEventListener("message",s)},[e,r]);const i=async s=>{const u=await IK(s);KK(u)||alert("Please allow popups to sign in.")};return l.jsx("div",{className:"mx-auto flex items-center justify-center p-4",children:l.jsxs(Ua,{className:"w-full max-w-md",children:[l.jsxs(lr,{children:[l.jsx(cr,{className:"text-lg md:text-xl",children:"Sign In"}),l.jsx(jp,{className:"text-xs md:text-sm",children:"Continue with a provider below to access your account."})]}),l.jsx(qa,{children:l.jsx("div",{className:"grid gap-4",children:l.jsx("div",{className:de("flex w-full items-center gap-2","flex-col justify-between"),children:l.jsxs(se,{variant:"outline",className:"w-full gap-2",onClick:()=>i("google"),children:[l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"0.98em",height:"1em",viewBox:"0 0 256 262","aria-hidden":"true",focusable:"false",children:[l.jsx("path",{fill:"#4285F4",d:"M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622l38.755 30.023l2.685.268c24.659-22.774 38.875-56.282 38.875-96.027"}),l.jsx("path",{fill:"#34A853",d:"M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055c-34.523 0-63.824-22.773-74.269-54.25l-1.531.13l-40.298 31.187l-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1"}),l.jsx("path",{fill:"#FBBC05",d:"M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82c0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602z"}),l.jsx("path",{fill:"#EB4335",d:"M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0C79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"})]}),"Sign in with Google"]})})})})]})})},Rl=vT(),Ol={listJobs:(e={})=>Pe(async()=>await Rl.adminListArcherJobs(e)),enqueue:e=>Pe(async()=>await Rl.adminEnqueueArcherJob({body:e})),retryJob:e=>Pe(async()=>await Rl.adminRetryArcherJob({id:e})),cancelJob:e=>Pe(async()=>await Rl.adminCancelArcherJob({id:e})),listQueues:()=>Pe(async()=>await Rl.adminListArcherQueues())};function A0(e,[t,r]){return Math.min(r,Math.max(t,e))}function T0(e){const t=LK(e),r=p.forwardRef((i,s)=>{const{children:u,...d}=i,h=p.Children.toArray(u),g=h.find(qK);if(g){const y=g.props.children,x=h.map(v=>v===g?p.Children.count(y)>1?p.Children.only(null):p.isValidElement(y)?y.props.children:null:v);return l.jsx(t,{...d,ref:s,children:p.isValidElement(y)?p.cloneElement(y,void 0,x):null})}return l.jsx(t,{...d,ref:s,children:u})});return r.displayName=`${e}.Slot`,r}function LK(e){const t=p.forwardRef((r,i)=>{const{children:s,...u}=r;if(p.isValidElement(s)){const d=$K(s),h=FK(u,s.props);return s.type!==p.Fragment&&(h.ref=i?Mn(i,d):d),p.cloneElement(s,h)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var UK=Symbol("radix.slottable");function qK(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===UK}function FK(e,t){const r={...t};for(const i in t){const s=e[i],u=t[i];/^on[A-Z]/.test(i)?s&&u?r[i]=(...h)=>{const g=u(...h);return s(...h),g}:s&&(r[i]=s):i==="style"?r[i]={...s,...u}:i==="className"&&(r[i]=[s,u].filter(Boolean).join(" "))}return{...e,...r}}function $K(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 Ng(e){const t=e+"CollectionProvider",[r,i]=ur(t),[s,u]=r(t,{collectionRef:{current:null},itemMap:new Map}),d=S=>{const{scope:N,children:D}=S,A=Q.useRef(null),O=Q.useRef(new Map).current;return l.jsx(s,{scope:N,itemMap:O,collectionRef:A,children:D})};d.displayName=t;const h=e+"CollectionSlot",g=T0(h),y=Q.forwardRef((S,N)=>{const{scope:D,children:A}=S,O=u(h,D),C=dt(N,O.collectionRef);return l.jsx(g,{ref:C,children:A})});y.displayName=h;const x=e+"CollectionItemSlot",v="data-radix-collection-item",w=T0(x),E=Q.forwardRef((S,N)=>{const{scope:D,children:A,...O}=S,C=Q.useRef(null),T=dt(N,C),U=u(x,D);return Q.useEffect(()=>(U.itemMap.set(C,{ref:C,...O}),()=>void U.itemMap.delete(C))),l.jsx(w,{[v]:"",ref:T,children:A})});E.displayName=x;function j(S){const N=u(e+"CollectionConsumer",S);return Q.useCallback(()=>{const A=N.collectionRef.current;if(!A)return[];const O=Array.from(A.querySelectorAll(`[${v}]`));return Array.from(N.itemMap.values()).sort((U,L)=>O.indexOf(U.ref.current)-O.indexOf(L.ref.current))},[N.collectionRef,N.itemMap])}return[{Provider:d,Slot:y,ItemSlot:E},j,i]}var VK=p.createContext(void 0);function Ag(e){const t=p.useContext(VK);return e||t||"ltr"}function HK(e){const t=BK(e),r=p.forwardRef((i,s)=>{const{children:u,...d}=i,h=p.Children.toArray(u),g=h.find(XK);if(g){const y=g.props.children,x=h.map(v=>v===g?p.Children.count(y)>1?p.Children.only(null):p.isValidElement(y)?y.props.children:null:v);return l.jsx(t,{...d,ref:s,children:p.isValidElement(y)?p.cloneElement(y,void 0,x):null})}return l.jsx(t,{...d,ref:s,children:u})});return r.displayName=`${e}.Slot`,r}function BK(e){const t=p.forwardRef((r,i)=>{const{children:s,...u}=r;if(p.isValidElement(s)){const d=YK(s),h=ZK(u,s.props);return s.type!==p.Fragment&&(h.ref=i?Mn(i,d):d),p.cloneElement(s,h)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var GK=Symbol("radix.slottable");function XK(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===GK}function ZK(e,t){const r={...t};for(const i in t){const s=e[i],u=t[i];/^on[A-Z]/.test(i)?s&&u?r[i]=(...h)=>{const g=u(...h);return s(...h),g}:s&&(r[i]=s):i==="style"?r[i]={...s,...u}:i==="className"&&(r[i]=[s,u].filter(Boolean).join(" "))}return{...e,...r}}function YK(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 QK(e){const t=p.useRef({value:e,previous:e});return p.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var JK=[" ","Enter","ArrowUp","ArrowDown"],WK=[" ","Enter"],no="Select",[nf,af,eI]=Ng(no),[Ns]=ur(no,[eI,xi]),rf=xi(),[tI,Si]=Ns(no),[nI,aI]=Ns(no),Q_=e=>{const{__scopeSelect:t,children:r,open:i,defaultOpen:s,onOpenChange:u,value:d,defaultValue:h,onValueChange:g,dir:y,name:x,autoComplete:v,disabled:w,required:E,form:j}=e,S=rf(t),[N,D]=p.useState(null),[A,O]=p.useState(null),[C,T]=p.useState(!1),U=Ag(y),[L,V]=Yi({prop:i,defaultProp:s??!1,onChange:u,caller:no}),[fe,ge]=Yi({prop:d,defaultProp:h,onChange:g,caller:no}),pe=p.useRef(null),ae=N?j||!!N.closest("form"):!0,[le,he]=p.useState(new Set),be=Array.from(le).map(R=>R.props.value).join(";");return l.jsx(qd,{...S,children:l.jsxs(tI,{required:E,scope:t,trigger:N,onTriggerChange:D,valueNode:A,onValueNodeChange:O,valueNodeHasChildren:C,onValueNodeHasChildrenChange:T,contentId:Sn(),value:fe,onValueChange:ge,open:L,onOpenChange:V,dir:U,triggerPointerDownPosRef:pe,disabled:w,children:[l.jsx(nf.Provider,{scope:t,children:l.jsx(nI,{scope:e.__scopeSelect,onNativeOptionAdd:p.useCallback(R=>{he(P=>new Set(P).add(R))},[]),onNativeOptionRemove:p.useCallback(R=>{he(P=>{const I=new Set(P);return I.delete(R),I})},[]),children:r})}),ae?l.jsxs(xE,{"aria-hidden":!0,required:E,tabIndex:-1,name:x,autoComplete:v,value:fe,onChange:R=>ge(R.target.value),disabled:w,form:j,children:[fe===void 0?l.jsx("option",{value:""}):null,Array.from(le)]},be):null]})})};Q_.displayName=no;var J_="SelectTrigger",W_=p.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:i=!1,...s}=e,u=rf(r),d=Si(J_,r),h=d.disabled||i,g=dt(t,d.onTriggerChange),y=af(r),x=p.useRef("touch"),[v,w,E]=wE(S=>{const N=y().filter(O=>!O.disabled),D=N.find(O=>O.value===d.value),A=SE(N,S,D);A!==void 0&&d.onValueChange(A.value)}),j=S=>{h||(d.onOpenChange(!0),E()),S&&(d.triggerPointerDownPosRef.current={x:Math.round(S.pageX),y:Math.round(S.pageY)})};return l.jsx(ic,{asChild:!0,...u,children:l.jsx(rt.button,{type:"button",role:"combobox","aria-controls":d.contentId,"aria-expanded":d.open,"aria-required":d.required,"aria-autocomplete":"none",dir:d.dir,"data-state":d.open?"open":"closed",disabled:h,"data-disabled":h?"":void 0,"data-placeholder":bE(d.value)?"":void 0,...s,ref:g,onClick:Ce(s.onClick,S=>{S.currentTarget.focus(),x.current!=="mouse"&&j(S)}),onPointerDown:Ce(s.onPointerDown,S=>{x.current=S.pointerType;const N=S.target;N.hasPointerCapture(S.pointerId)&&N.releasePointerCapture(S.pointerId),S.button===0&&S.ctrlKey===!1&&S.pointerType==="mouse"&&(j(S),S.preventDefault())}),onKeyDown:Ce(s.onKeyDown,S=>{const N=v.current!=="";!(S.ctrlKey||S.altKey||S.metaKey)&&S.key.length===1&&w(S.key),!(N&&S.key===" ")&&JK.includes(S.key)&&(j(),S.preventDefault())})})})});W_.displayName=J_;var eE="SelectValue",tE=p.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:s,children:u,placeholder:d="",...h}=e,g=Si(eE,r),{onValueNodeHasChildrenChange:y}=g,x=u!==void 0,v=dt(t,g.onValueNodeChange);return on(()=>{y(x)},[y,x]),l.jsx(rt.span,{...h,ref:v,style:{pointerEvents:"none"},children:bE(g.value)?l.jsx(l.Fragment,{children:d}):u})});tE.displayName=eE;var rI="SelectIcon",nE=p.forwardRef((e,t)=>{const{__scopeSelect:r,children:i,...s}=e;return l.jsx(rt.span,{"aria-hidden":!0,...s,ref:t,children:i||"▼"})});nE.displayName=rI;var iI="SelectPortal",aE=e=>l.jsx(Cs,{asChild:!0,...e});aE.displayName=iI;var ao="SelectContent",rE=p.forwardRef((e,t)=>{const r=Si(ao,e.__scopeSelect),[i,s]=p.useState();if(on(()=>{s(new DocumentFragment)},[]),!r.open){const u=i;return u?Ed.createPortal(l.jsx(iE,{scope:e.__scopeSelect,children:l.jsx(nf.Slot,{scope:e.__scopeSelect,children:l.jsx("div",{children:e.children})})}),u):null}return l.jsx(oE,{...e,ref:t})});rE.displayName=ao;var za=10,[iE,_i]=Ns(ao),oI="SelectContentImpl",sI=HK("SelectContent.RemoveScroll"),oE=p.forwardRef((e,t)=>{const{__scopeSelect:r,position:i="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:u,onPointerDownOutside:d,side:h,sideOffset:g,align:y,alignOffset:x,arrowPadding:v,collisionBoundary:w,collisionPadding:E,sticky:j,hideWhenDetached:S,avoidCollisions:N,...D}=e,A=Si(ao,r),[O,C]=p.useState(null),[T,U]=p.useState(null),L=dt(t,W=>C(W)),[V,fe]=p.useState(null),[ge,pe]=p.useState(null),ae=af(r),[le,he]=p.useState(!1),be=p.useRef(!1);p.useEffect(()=>{if(O)return Ad(O)},[O]),Od();const R=p.useCallback(W=>{const[xe,...Oe]=ae().map(Ze=>Ze.ref.current),[Ue]=Oe.slice(-1),Ye=document.activeElement;for(const Ze of W)if(Ze===Ye||(Ze?.scrollIntoView({block:"nearest"}),Ze===xe&&T&&(T.scrollTop=0),Ze===Ue&&T&&(T.scrollTop=T.scrollHeight),Ze?.focus(),document.activeElement!==Ye))return},[ae,T]),P=p.useCallback(()=>R([V,O]),[R,V,O]);p.useEffect(()=>{le&&P()},[le,P]);const{onOpenChange:I,triggerPointerDownPosRef:ee}=A;p.useEffect(()=>{if(O){let W={x:0,y:0};const xe=Ue=>{W={x:Math.abs(Math.round(Ue.pageX)-(ee.current?.x??0)),y:Math.abs(Math.round(Ue.pageY)-(ee.current?.y??0))}},Oe=Ue=>{W.x<=10&&W.y<=10?Ue.preventDefault():O.contains(Ue.target)||I(!1),document.removeEventListener("pointermove",xe),ee.current=null};return ee.current!==null&&(document.addEventListener("pointermove",xe),document.addEventListener("pointerup",Oe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",Oe,{capture:!0})}}},[O,I,ee]),p.useEffect(()=>{const W=()=>I(!1);return window.addEventListener("blur",W),window.addEventListener("resize",W),()=>{window.removeEventListener("blur",W),window.removeEventListener("resize",W)}},[I]);const[me,Re]=wE(W=>{const xe=ae().filter(Ye=>!Ye.disabled),Oe=xe.find(Ye=>Ye.ref.current===document.activeElement),Ue=SE(xe,W,Oe);Ue&&setTimeout(()=>Ue.ref.current.focus())}),G=p.useCallback((W,xe,Oe)=>{const Ue=!be.current&&!Oe;(A.value!==void 0&&A.value===xe||Ue)&&(fe(W),Ue&&(be.current=!0))},[A.value]),Y=p.useCallback(()=>O?.focus(),[O]),ie=p.useCallback((W,xe,Oe)=>{const Ue=!be.current&&!Oe;(A.value!==void 0&&A.value===xe||Ue)&&pe(W)},[A.value]),oe=i==="popper"?Rp:sE,ve=oe===Rp?{side:h,sideOffset:g,align:y,alignOffset:x,arrowPadding:v,collisionBoundary:w,collisionPadding:E,sticky:j,hideWhenDetached:S,avoidCollisions:N}:{};return l.jsx(iE,{scope:r,content:O,viewport:T,onViewportChange:U,itemRefCallback:G,selectedItem:V,onItemLeave:Y,itemTextRefCallback:ie,focusSelectedItem:P,selectedItemText:ge,position:i,isPositioned:le,searchRef:me,children:l.jsx(tc,{as:sI,allowPinchZoom:!0,children:l.jsx(ec,{asChild:!0,trapped:A.open,onMountAutoFocus:W=>{W.preventDefault()},onUnmountAutoFocus:Ce(s,W=>{A.trigger?.focus({preventScroll:!0}),W.preventDefault()}),children:l.jsx(Es,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:W=>W.preventDefault(),onDismiss:()=>A.onOpenChange(!1),children:l.jsx(oe,{role:"listbox",id:A.contentId,"data-state":A.open?"open":"closed",dir:A.dir,onContextMenu:W=>W.preventDefault(),...D,...ve,onPlaced:()=>he(!0),ref:L,style:{display:"flex",flexDirection:"column",outline:"none",...D.style},onKeyDown:Ce(D.onKeyDown,W=>{const xe=W.ctrlKey||W.altKey||W.metaKey;if(W.key==="Tab"&&W.preventDefault(),!xe&&W.key.length===1&&Re(W.key),["ArrowUp","ArrowDown","Home","End"].includes(W.key)){let Ue=ae().filter(Ye=>!Ye.disabled).map(Ye=>Ye.ref.current);if(["ArrowUp","End"].includes(W.key)&&(Ue=Ue.slice().reverse()),["ArrowUp","ArrowDown"].includes(W.key)){const Ye=W.target,Ze=Ue.indexOf(Ye);Ue=Ue.slice(Ze+1)}setTimeout(()=>R(Ue)),W.preventDefault()}})})})})})})});oE.displayName=oI;var lI="SelectItemAlignedPosition",sE=p.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:i,...s}=e,u=Si(ao,r),d=_i(ao,r),[h,g]=p.useState(null),[y,x]=p.useState(null),v=dt(t,L=>x(L)),w=af(r),E=p.useRef(!1),j=p.useRef(!0),{viewport:S,selectedItem:N,selectedItemText:D,focusSelectedItem:A}=d,O=p.useCallback(()=>{if(u.trigger&&u.valueNode&&h&&y&&S&&N&&D){const L=u.trigger.getBoundingClientRect(),V=y.getBoundingClientRect(),fe=u.valueNode.getBoundingClientRect(),ge=D.getBoundingClientRect();if(u.dir!=="rtl"){const Ye=ge.left-V.left,Ze=fe.left-Ye,Kt=L.left-Ze,B=L.width+Kt,qe=Math.max(B,V.width),ke=window.innerWidth-za,Qe=A0(Ze,[za,Math.max(za,ke-qe)]);h.style.minWidth=B+"px",h.style.left=Qe+"px"}else{const Ye=V.right-ge.right,Ze=window.innerWidth-fe.right-Ye,Kt=window.innerWidth-L.right-Ze,B=L.width+Kt,qe=Math.max(B,V.width),ke=window.innerWidth-za,Qe=A0(Ze,[za,Math.max(za,ke-qe)]);h.style.minWidth=B+"px",h.style.right=Qe+"px"}const pe=w(),ae=window.innerHeight-za*2,le=S.scrollHeight,he=window.getComputedStyle(y),be=parseInt(he.borderTopWidth,10),R=parseInt(he.paddingTop,10),P=parseInt(he.borderBottomWidth,10),I=parseInt(he.paddingBottom,10),ee=be+R+le+I+P,me=Math.min(N.offsetHeight*5,ee),Re=window.getComputedStyle(S),G=parseInt(Re.paddingTop,10),Y=parseInt(Re.paddingBottom,10),ie=L.top+L.height/2-za,oe=ae-ie,ve=N.offsetHeight/2,W=N.offsetTop+ve,xe=be+R+W,Oe=ee-xe;if(xe<=ie){const Ye=pe.length>0&&N===pe[pe.length-1].ref.current;h.style.bottom="0px";const Ze=y.clientHeight-S.offsetTop-S.offsetHeight,Kt=Math.max(oe,ve+(Ye?Y:0)+Ze+P),B=xe+Kt;h.style.height=B+"px"}else{const Ye=pe.length>0&&N===pe[0].ref.current;h.style.top="0px";const Kt=Math.max(ie,be+S.offsetTop+(Ye?G:0)+ve)+Oe;h.style.height=Kt+"px",S.scrollTop=xe-ie+S.offsetTop}h.style.margin=`${za}px 0`,h.style.minHeight=me+"px",h.style.maxHeight=ae+"px",i?.(),requestAnimationFrame(()=>E.current=!0)}},[w,u.trigger,u.valueNode,h,y,S,N,D,u.dir,i]);on(()=>O(),[O]);const[C,T]=p.useState();on(()=>{y&&T(window.getComputedStyle(y).zIndex)},[y]);const U=p.useCallback(L=>{L&&j.current===!0&&(O(),A?.(),j.current=!1)},[O,A]);return l.jsx(uI,{scope:r,contentWrapper:h,shouldExpandOnScrollRef:E,onScrollButtonChange:U,children:l.jsx("div",{ref:g,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:l.jsx(rt.div,{...s,ref:v,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});sE.displayName=lI;var cI="SelectPopperPosition",Rp=p.forwardRef((e,t)=>{const{__scopeSelect:r,align:i="start",collisionPadding:s=za,...u}=e,d=rf(r);return l.jsx(Fd,{...d,...u,ref:t,align:i,collisionPadding:s,style:{boxSizing:"border-box",...u.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)"}})});Rp.displayName=cI;var[uI,Tg]=Ns(ao,{}),Op="SelectViewport",lE=p.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:i,...s}=e,u=_i(Op,r),d=Tg(Op,r),h=dt(t,u.onViewportChange),g=p.useRef(0);return l.jsxs(l.Fragment,{children:[l.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}),l.jsx(nf.Slot,{scope:r,children:l.jsx(rt.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:h,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Ce(s.onScroll,y=>{const x=y.currentTarget,{contentWrapper:v,shouldExpandOnScrollRef:w}=d;if(w?.current&&v){const E=Math.abs(g.current-x.scrollTop);if(E>0){const j=window.innerHeight-za*2,S=parseFloat(v.style.minHeight),N=parseFloat(v.style.height),D=Math.max(S,N);if(D0?C:0,v.style.justifyContent="flex-end")}}}g.current=x.scrollTop})})})]})});lE.displayName=Op;var cE="SelectGroup",[dI,fI]=Ns(cE),hI=p.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=Sn();return l.jsx(dI,{scope:r,id:s,children:l.jsx(rt.div,{role:"group","aria-labelledby":s,...i,ref:t})})});hI.displayName=cE;var uE="SelectLabel",mI=p.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=fI(uE,r);return l.jsx(rt.div,{id:s.id,...i,ref:t})});mI.displayName=uE;var wd="SelectItem",[pI,dE]=Ns(wd),fE=p.forwardRef((e,t)=>{const{__scopeSelect:r,value:i,disabled:s=!1,textValue:u,...d}=e,h=Si(wd,r),g=_i(wd,r),y=h.value===i,[x,v]=p.useState(u??""),[w,E]=p.useState(!1),j=dt(t,A=>g.itemRefCallback?.(A,i,s)),S=Sn(),N=p.useRef("touch"),D=()=>{s||(h.onValueChange(i),h.onOpenChange(!1))};if(i==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return l.jsx(pI,{scope:r,value:i,disabled:s,textId:S,isSelected:y,onItemTextChange:p.useCallback(A=>{v(O=>O||(A?.textContent??"").trim())},[]),children:l.jsx(nf.ItemSlot,{scope:r,value:i,disabled:s,textValue:x,children:l.jsx(rt.div,{role:"option","aria-labelledby":S,"data-highlighted":w?"":void 0,"aria-selected":y&&w,"data-state":y?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...d,ref:j,onFocus:Ce(d.onFocus,()=>E(!0)),onBlur:Ce(d.onBlur,()=>E(!1)),onClick:Ce(d.onClick,()=>{N.current!=="mouse"&&D()}),onPointerUp:Ce(d.onPointerUp,()=>{N.current==="mouse"&&D()}),onPointerDown:Ce(d.onPointerDown,A=>{N.current=A.pointerType}),onPointerMove:Ce(d.onPointerMove,A=>{N.current=A.pointerType,s?g.onItemLeave?.():N.current==="mouse"&&A.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ce(d.onPointerLeave,A=>{A.currentTarget===document.activeElement&&g.onItemLeave?.()}),onKeyDown:Ce(d.onKeyDown,A=>{g.searchRef?.current!==""&&A.key===" "||(WK.includes(A.key)&&D(),A.key===" "&&A.preventDefault())})})})})});fE.displayName=wd;var Il="SelectItemText",hE=p.forwardRef((e,t)=>{const{__scopeSelect:r,className:i,style:s,...u}=e,d=Si(Il,r),h=_i(Il,r),g=dE(Il,r),y=aI(Il,r),[x,v]=p.useState(null),w=dt(t,D=>v(D),g.onItemTextChange,D=>h.itemTextRefCallback?.(D,g.value,g.disabled)),E=x?.textContent,j=p.useMemo(()=>l.jsx("option",{value:g.value,disabled:g.disabled,children:E},g.value),[g.disabled,g.value,E]),{onNativeOptionAdd:S,onNativeOptionRemove:N}=y;return on(()=>(S(j),()=>N(j)),[S,N,j]),l.jsxs(l.Fragment,{children:[l.jsx(rt.span,{id:g.textId,...u,ref:w}),g.isSelected&&d.valueNode&&!d.valueNodeHasChildren?Ed.createPortal(u.children,d.valueNode):null]})});hE.displayName=Il;var mE="SelectItemIndicator",pE=p.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return dE(mE,r).isSelected?l.jsx(rt.span,{"aria-hidden":!0,...i,ref:t}):null});pE.displayName=mE;var Np="SelectScrollUpButton",gE=p.forwardRef((e,t)=>{const r=_i(Np,e.__scopeSelect),i=Tg(Np,e.__scopeSelect),[s,u]=p.useState(!1),d=dt(t,i.onScrollButtonChange);return on(()=>{if(r.viewport&&r.isPositioned){let h=function(){const y=g.scrollTop>0;u(y)};const g=r.viewport;return h(),g.addEventListener("scroll",h),()=>g.removeEventListener("scroll",h)}},[r.viewport,r.isPositioned]),s?l.jsx(vE,{...e,ref:d,onAutoScroll:()=>{const{viewport:h,selectedItem:g}=r;h&&g&&(h.scrollTop=h.scrollTop-g.offsetHeight)}}):null});gE.displayName=Np;var Ap="SelectScrollDownButton",yE=p.forwardRef((e,t)=>{const r=_i(Ap,e.__scopeSelect),i=Tg(Ap,e.__scopeSelect),[s,u]=p.useState(!1),d=dt(t,i.onScrollButtonChange);return on(()=>{if(r.viewport&&r.isPositioned){let h=function(){const y=g.scrollHeight-g.clientHeight,x=Math.ceil(g.scrollTop)g.removeEventListener("scroll",h)}},[r.viewport,r.isPositioned]),s?l.jsx(vE,{...e,ref:d,onAutoScroll:()=>{const{viewport:h,selectedItem:g}=r;h&&g&&(h.scrollTop=h.scrollTop+g.offsetHeight)}}):null});yE.displayName=Ap;var vE=p.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:i,...s}=e,u=_i("SelectScrollButton",r),d=p.useRef(null),h=af(r),g=p.useCallback(()=>{d.current!==null&&(window.clearInterval(d.current),d.current=null)},[]);return p.useEffect(()=>()=>g(),[g]),on(()=>{h().find(x=>x.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[h]),l.jsx(rt.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Ce(s.onPointerDown,()=>{d.current===null&&(d.current=window.setInterval(i,50))}),onPointerMove:Ce(s.onPointerMove,()=>{u.onItemLeave?.(),d.current===null&&(d.current=window.setInterval(i,50))}),onPointerLeave:Ce(s.onPointerLeave,()=>{g()})})}),gI="SelectSeparator",yI=p.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e;return l.jsx(rt.div,{"aria-hidden":!0,...i,ref:t})});yI.displayName=gI;var Tp="SelectArrow",vI=p.forwardRef((e,t)=>{const{__scopeSelect:r,...i}=e,s=rf(r),u=Si(Tp,r),d=_i(Tp,r);return u.open&&d.position==="popper"?l.jsx($d,{...s,...i,ref:t}):null});vI.displayName=Tp;var xI="SelectBubbleInput",xE=p.forwardRef(({__scopeSelect:e,value:t,...r},i)=>{const s=p.useRef(null),u=dt(i,s),d=QK(t);return p.useEffect(()=>{const h=s.current;if(!h)return;const g=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(g,"value").set;if(d!==t&&x){const v=new Event("change",{bubbles:!0});x.call(h,t),h.dispatchEvent(v)}},[d,t]),l.jsx(rt.select,{...r,style:{...Z1,...r.style},ref:u,defaultValue:t})});xE.displayName=xI;function bE(e){return e===""||e===void 0}function wE(e){const t=Fa(e),r=p.useRef(""),i=p.useRef(0),s=p.useCallback(d=>{const h=r.current+d;t(h),(function g(y){r.current=y,window.clearTimeout(i.current),y!==""&&(i.current=window.setTimeout(()=>g(""),1e3))})(h)},[t]),u=p.useCallback(()=>{r.current="",window.clearTimeout(i.current)},[]);return p.useEffect(()=>()=>window.clearTimeout(i.current),[]),[r,s,u]}function SE(e,t,r){const s=t.length>1&&Array.from(t).every(y=>y===t[0])?t[0]:t,u=r?e.indexOf(r):-1;let d=bI(e,Math.max(u,0));s.length===1&&(d=d.filter(y=>y!==r));const g=d.find(y=>y.textValue.toLowerCase().startsWith(s.toLowerCase()));return g!==r?g:void 0}function bI(e,t){return e.map((r,i)=>e[(t+i)%e.length])}var wI=Q_,SI=W_,_I=tE,EI=nE,CI=aE,jI=rE,RI=lE,OI=fE,NI=hE,AI=pE,TI=gE,DI=yE;function dn({...e}){return l.jsx(wI,{"data-slot":"select",...e})}function fn({...e}){return l.jsx(_I,{"data-slot":"select-value",...e})}function hn({className:e,size:t="default",children:r,...i}){return l.jsxs(SI,{"data-slot":"select-trigger","data-size":t,className:de("border-input data-[placeholder]:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i,children:[r,l.jsx(EI,{asChild:!0,children:l.jsx(rS,{className:"size-4 opacity-50"})})]})}function mn({className:e,children:t,position:r="popper",align:i="center",...s}){return l.jsx(CI,{children:l.jsxs(jI,{"data-slot":"select-content",className:de("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",r==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:r,align:i,...s,children:[l.jsx(MI,{}),l.jsx(RI,{className:de("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),l.jsx(zI,{})]})})}function ut({className:e,children:t,...r}){return l.jsxs(OI,{"data-slot":"select-item",className:de("focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2",e),...r,children:[l.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:l.jsx(AI,{children:l.jsx(aS,{className:"size-4"})})}),l.jsx(NI,{children:t})]})}function MI({className:e,...t}){return l.jsx(TI,{"data-slot":"select-scroll-up-button",className:de("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(XO,{className:"size-4"})})}function zI({className:e,...t}){return l.jsx(DI,{"data-slot":"select-scroll-down-button",className:de("flex cursor-default items-center justify-center py-1",e),...t,children:l.jsx(rS,{className:"size-4"})})}function _E({className:e,...t}){return l.jsx("textarea",{"data-slot":"textarea",className:de("border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",e),...t})}const kI=["queued","running","succeeded","failed","canceled","retrying","scheduled"],PI={queued:"bg-amber-100 text-amber-800",running:"bg-sky-100 text-sky-800",succeeded:"bg-emerald-100 text-emerald-800",failed:"bg-red-100 text-red-800",canceled:"bg-zinc-200 text-zinc-700",retrying:"bg-orange-100 text-orange-800",scheduled:"bg-violet-100 text-violet-800"};function D0(e){if(!e)return"—";const t=new Date(e);return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(t)}function KI(e,t=300){const[r,i]=p.useState(e);return p.useEffect(()=>{const s=setTimeout(()=>i(e),t);return()=>clearTimeout(s)},[e,t]),r}const II=()=>{const e=da(),[t,r]=p.useState(""),[i,s]=p.useState(""),[u,d]=p.useState(""),h=KI(u,300),[g,y]=p.useState(1),[x,v]=p.useState(25),E=rn({queryKey:["archer","jobs",{status:t,queue:i,q:h,page:g,pageSize:x}],queryFn:()=>Ol.listJobs({status:t,queue:i||void 0,q:h||void 0,page:g,pageSize:x}),placeholderData:T=>T,staleTime:1e4}),j=rn({queryKey:["archer","queues"],queryFn:()=>Ol.listQueues(),staleTime:3e4}),S=mt({mutationFn:T=>Ol.enqueue(T),onSuccess:()=>e.invalidateQueries({queryKey:["archer","jobs"]})}),N=mt({mutationFn:T=>Ol.retryJob(T),onSuccess:()=>e.invalidateQueries({queryKey:["archer","jobs"]})}),D=mt({mutationFn:T=>Ol.cancelJob(T),onSuccess:()=>e.invalidateQueries({queryKey:["archer","jobs"]})}),A=E.isFetching,O=E.data,C=O?Math.max(1,Math.ceil(O.total/O.pageSize)):1;return l.jsxs("div",{className:"container mx-auto space-y-6 p-6",children:[l.jsxs("div",{className:"flex items-start justify-between gap-4",children:[l.jsxs("div",{children:[l.jsx("h1",{className:"text-2xl font-semibold",children:"Archer Jobs"}),l.jsx("p",{className:"text-muted-foreground text-sm",children:"Inspect, enqueue, retry and cancel background jobs."})]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(UI,{onSubmit:T=>S.mutateAsync(T),submitting:S.isPending}),l.jsxs(se,{variant:"secondary",onClick:()=>e.invalidateQueries({queryKey:["archer","jobs"]}),disabled:A,children:[A?l.jsx(ps,{className:"mr-2 h-4 w-4 animate-spin"}):l.jsx(_2,{className:"mr-2 h-4 w-4"}),"Refresh"]})]})]}),l.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:j.data?.map(T=>l.jsxs(Ua,{children:[l.jsx(lr,{children:l.jsx(cr,{className:"text-base",children:T.name})}),l.jsxs(qa,{className:"grid grid-cols-2 gap-2 text-sm",children:[l.jsx(Zu,{label:"Pending",value:T.pending}),l.jsx(Zu,{label:"Running",value:T.running}),l.jsx(Zu,{label:"Failed",value:T.failed}),l.jsx(Zu,{label:"Scheduled",value:T.scheduled})]})]},T.name))}),l.jsxs(Ua,{children:[l.jsx(lr,{children:l.jsx(cr,{children:"Filters"})}),l.jsxs(qa,{className:"grid gap-3 md:grid-cols-4",children:[l.jsxs("div",{className:"col-span-2 flex items-center gap-2",children:[l.jsx(Fe,{placeholder:"Search id, queue, error, payload…",value:u,onChange:T=>{d(T.target.value),y(1)},onKeyDown:T=>T.key==="Enter"&&e.invalidateQueries({queryKey:["archer","jobs"]})}),u&&l.jsx(se,{variant:"ghost",size:"icon",onClick:()=>d(""),children:l.jsx($p,{className:"h-4 w-4"})}),l.jsxs(se,{onClick:()=>e.invalidateQueries({queryKey:["archer","jobs"]}),children:[l.jsx(zr,{className:"mr-2 h-4 w-4"})," Search"]})]}),l.jsxs(dn,{value:t||"all",onValueChange:T=>{r(T==="all"?"":T),y(1)},children:[l.jsx(hn,{children:l.jsx(fn,{placeholder:"All statuses"})}),l.jsxs(mn,{children:[l.jsx(ut,{value:"all",children:"All statuses"}),kI.map(T=>l.jsx(ut,{value:T,children:T},T))]})]}),l.jsx(Fe,{placeholder:"Queue (optional)",value:i,onChange:T=>{s(T.target.value),y(1)}}),l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(Mr,{className:"whitespace-nowrap",children:"Page size"}),l.jsxs(dn,{value:String(x),onValueChange:T=>{v(Number(T)),y(1)},children:[l.jsx(hn,{className:"w-[120px]",children:l.jsx(fn,{})}),l.jsx(mn,{children:[10,25,50,100].map(T=>l.jsx(ut,{value:String(T),children:T},T))})]})]})]})]}),l.jsx(Ua,{children:l.jsxs(qa,{className:"p-0",children:[l.jsxs(la,{children:[l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{children:"ID"}),l.jsx(ze,{children:"Queue"}),l.jsx(ze,{children:"Status"}),l.jsx(ze,{children:"Attempts"}),l.jsx(ze,{children:"Run At"}),l.jsx(ze,{children:"Updated"}),l.jsx(ze,{className:"pr-4 text-right",children:"Actions"})]})}),l.jsxs(ua,{children:[E.isLoading&&l.jsx(et,{children:l.jsx(_e,{colSpan:7,className:"text-muted-foreground py-8 text-center",children:"Loading…"})}),E.isError&&l.jsx(et,{children:l.jsx(_e,{colSpan:7,className:"py-8 text-center text-red-600",children:"Failed to load jobs"})}),!E.isLoading&&O&&O.items.length===0&&l.jsx(et,{children:l.jsx(_e,{colSpan:7,className:"text-muted-foreground py-8 text-center",children:"No jobs match your filters."})}),O?.items.map(T=>l.jsxs(et,{children:[l.jsx(_e,{children:l.jsx("code",{className:"text-xs",children:T.id})}),l.jsx(_e,{children:l.jsx(Ia,{variant:"secondary",children:T.queue})}),l.jsx(_e,{children:l.jsx("span",{className:de("rounded-md px-2 py-0.5 text-xs",PI[T.status]),children:T.status})}),l.jsx(_e,{children:T.maxAttempts?`${T.attempts}/${T.maxAttempts}`:T.attempts}),l.jsx(_e,{children:D0(T.runAt)}),l.jsx(_e,{children:D0(T.updatedAt??T.createdAt)}),l.jsx(_e,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[(T.status==="failed"||T.status==="canceled")&&l.jsx(se,{size:"sm",variant:"outline",disabled:N.isPending,onClick:()=>N.mutate(T.id),children:"Retry"}),(T.status==="queued"||T.status==="running"||T.status==="scheduled")&&l.jsx(se,{size:"sm",variant:"outline",disabled:D.isPending,onClick:()=>D.mutate(T.id),children:"Cancel"}),l.jsx(LI,{job:T})]})})]},T.id))]})]}),l.jsxs("div",{className:"flex items-center justify-between border-t p-3 text-sm",children:[l.jsxs("div",{children:["Page ",g," of ",C," • ",O?.total??0," total"]}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(se,{variant:"outline",disabled:g<=1||E.isFetching,onClick:()=>y(T=>Math.max(1,T-1)),children:"Prev"}),l.jsx(se,{variant:"outline",disabled:g>=C||E.isFetching,onClick:()=>y(T=>T+1),children:"Next"})]})]})]})})]})};function Zu({label:e,value:t}){return l.jsxs("div",{className:"bg-muted/30 rounded-lg border p-3",children:[l.jsx("div",{className:"text-muted-foreground text-xs",children:e}),l.jsx("div",{className:"text-lg font-semibold",children:t})]})}function LI({job:e}){return l.jsxs(Et,{children:[l.jsx(or,{asChild:!0,children:l.jsx(se,{size:"sm",variant:"ghost",children:"Details"})}),l.jsxs(Ct,{className:"max-w-2xl",children:[l.jsx(jt,{children:l.jsxs(Rt,{children:["Job ",e.id]})}),l.jsxs("div",{className:"grid gap-3",children:[e.lastError&&l.jsxs(Ua,{children:[l.jsx(lr,{children:l.jsx(cr,{className:"text-sm",children:"Last error"})}),l.jsx(qa,{children:l.jsx("pre",{className:"overflow-auto text-xs whitespace-pre-wrap",children:e.lastError})})]}),l.jsxs(Ua,{children:[l.jsx(lr,{children:l.jsx(cr,{className:"text-sm",children:"Payload"})}),l.jsx(qa,{children:l.jsx("pre",{className:"overflow-auto text-xs whitespace-pre-wrap",children:JSON.stringify(e.payload,null,2)})})]})]}),l.jsx(Mt,{children:l.jsx(ud,{asChild:!0,children:l.jsx(se,{variant:"secondary",children:"Close"})})})]})]})}function UI({onSubmit:e,submitting:t}){const[r,i]=p.useState(!1),[s,u]=p.useState(""),[d,h]=p.useState(""),[g,y]=p.useState("{}"),[x,v]=p.useState(""),w=s&&d&&!t;async function E(){const j=g?JSON.parse(g):void 0;await e({queue:s,type:d,payload:j,run_at:x||void 0}),i(!1),u(""),h(""),y("{}"),v("")}return l.jsxs(Et,{open:r,onOpenChange:i,children:[l.jsx(or,{asChild:!0,children:l.jsxs(se,{children:[l.jsx(ro,{className:"mr-2 h-4 w-4"})," Enqueue"]})}),l.jsxs(Ct,{children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Enqueue Job"})}),l.jsxs("div",{className:"grid gap-3",children:[l.jsxs("div",{className:"grid gap-2",children:[l.jsx(Mr,{children:"Queue"}),l.jsx(Fe,{value:s,onChange:j=>u(j.target.value),placeholder:"e.g. bootstrap_bastion"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(Mr,{children:"Type"}),l.jsx(Fe,{value:d,onChange:j=>h(j.target.value),placeholder:"e.g. bootstrap_bastion"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(Mr,{children:"Payload (JSON)"}),l.jsx(_E,{value:g,onChange:j=>y(j.target.value),className:"min-h-[120px] font-mono text-xs"})]}),l.jsxs("div",{className:"grid gap-2",children:[l.jsx(Mr,{children:"Run at (optional)"}),l.jsx(Fe,{type:"datetime-local",value:x,onChange:j=>v(j.target.value)})]})]}),l.jsxs(Mt,{children:[l.jsx(ud,{asChild:!0,children:l.jsx(se,{variant:"secondary",children:"Cancel"})}),l.jsxs(se,{onClick:E,disabled:!w,children:[t?l.jsx(ps,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Enqueue"]})]})]})]})}const EE=Oa({key:Zt().trim().min(1,"Key is required").max(120,"Max 120 chars"),value:Zt().trim().optional()}),qI=EE.partial();function FI({t:e}){const t=`${e.key}${e.value?`=${e.value}`:""}`;return l.jsxs(Ia,{variant:"secondary",className:"font-mono text-xs",children:[l.jsx(jd,{className:"mr-1 h-3 w-3"}),t]})}const $I=()=>{const[e,t]=p.useState(""),[r,i]=p.useState(!1),[s,u]=p.useState(!1),[d,h]=p.useState(null),[g,y]=p.useState(null),x=da(),v=rn({queryKey:["labels"],queryFn:()=>Pl.listLabels()}),w=_n({resolver:En(EE),defaultValues:{key:"",value:""}}),E=mt({mutationFn:C=>Pl.createLabel(C),onSuccess:async()=>{await x.invalidateQueries({queryKey:["labels"]}),w.reset(),i(!1),Ee.success("Label Created Successfully.")},onError:C=>{Ee.error(C.message??"There was an error while creating Label")}}),j=C=>{E.mutate(C)},S=_n({resolver:En(qI),defaultValues:{}}),N=mt({mutationFn:({id:C,values:T})=>Pl.updateLabel(C,T),onSuccess:async()=>{await x.invalidateQueries({queryKey:["labels"]}),S.reset(),u(!1),Ee.success("Label Updated Successfully.")},onError:C=>{Ee.error(C.message??"There was an error while updating Label")}}),D=C=>{y(C.id),S.reset({key:C.key,value:C.value}),u(!0)},A=mt({mutationFn:C=>Pl.deleteLabel(C),onSuccess:async()=>{await x.invalidateQueries({queryKey:["labels"]}),h(null),Ee.success("Label Deleted Successfully.")},onError:C=>{Ee.error(C.message??"There was an error while deleting Label")}}),O=p.useMemo(()=>{const C=v.data??[],T=e.trim().toLowerCase();return T?C.filter(U=>U.key?.toLowerCase().includes(T)||U.value?.toLowerCase().includes(T)):C},[e,v.data]);return v.isLoading?l.jsx("div",{className:"p-6",children:"Loading labels…"}):v.error?l.jsx("div",{className:"p-6 text-red-500",children:"Error loading labels."}):l.jsxs("div",{className:"space-y-4 p-6",children:[l.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[l.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Labels"}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx(zr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),l.jsx(Fe,{value:e,onChange:C=>t(C.target.value),placeholder:"Search labels",className:"w-64 pl-8"})]}),l.jsxs(Et,{open:r,onOpenChange:i,children:[l.jsx(or,{asChild:!0,children:l.jsxs(se,{onClick:()=>i(!0),children:[l.jsx(ro,{className:"mr-2 h-4 w-4"}),"Create Label"]})}),l.jsxs(Ct,{className:"sm:max-w-lg",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Create Label"})}),l.jsx(Cn,{...w,children:l.jsxs("form",{className:"space-y-4",onSubmit:w.handleSubmit(j),children:[l.jsx($e,{control:w.control,name:"key",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Key"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"environment",...C})}),l.jsx(Be,{})]})}),l.jsx($e,{control:w.control,name:"value",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Value"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"dev",...C})}),l.jsx(Be,{})]})}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),l.jsx(se,{type:"submit",disabled:w.formState.isSubmitting,children:w.formState.isSubmitting?"Creating…":"Create"})]})]})})]})]})]})]}),l.jsx("div",{className:"bg-background overflow-hidden rounded-2xl border shadow-sm",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(la,{children:[l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{children:"Key"}),l.jsx(ze,{children:"Value"}),l.jsx(ze,{children:"Label"}),l.jsx(ze,{className:"w-[180px] text-right",children:"Actions"})]})}),l.jsxs(ua,{children:[O.map(C=>l.jsxs(et,{children:[l.jsx(_e,{children:C.key}),l.jsx(_e,{children:C.value}),l.jsx(_e,{children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(FI,{t:C}),l.jsx("code",{className:"text-muted-foreground text-xs",children:Gi(C.id,6)})]})}),l.jsx(_e,{children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(se,{variant:"outline",size:"sm",onClick:()=>D(C),children:[l.jsx(Cd,{className:"mr-2 h-4 w-4"})," Edit"]}),l.jsx(se,{variant:"destructive",size:"sm",onClick:()=>h(C.id),disabled:A.isPending&&d===C.id,children:A.isPending&&d===C.id?"Deleting…":"Delete"})]})})]},C.id)),O.length===0&&l.jsx(et,{children:l.jsxs(_e,{colSpan:4,className:"text-muted-foreground py-10 text-center",children:[l.jsx(Fp,{className:"mx-auto mb-2 h-6 w-6 opacity-60"}),"No labels match your search."]})})]})]})})}),l.jsx(Et,{open:s,onOpenChange:u,children:l.jsxs(Ct,{className:"sm:max-w-lg",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Edit Label"})}),l.jsx(Cn,{...S,children:l.jsxs("form",{className:"space-y-4",onSubmit:S.handleSubmit(C=>{g&&N.mutate({id:g,values:C})}),children:[l.jsx($e,{control:S.control,name:"key",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Key"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"dedicated",...C})}),l.jsx(Be,{})]})}),l.jsx($e,{control:S.control,name:"value",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Value (optional)"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"gpu",...C})}),l.jsx(Be,{})]})}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),l.jsx(se,{type:"submit",disabled:N.isPending,children:N.isPending?"Saving…":"Save changes"})]})]})})]})}),l.jsx(Et,{open:!!d,onOpenChange:C=>!C&&h(null),children:l.jsxs(Ct,{className:"sm:max-w-md",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Delete label"})}),l.jsx("p",{className:"text-muted-foreground text-sm",children:"This action cannot be undone. Are you sure you want to delete this label?"}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),l.jsx(se,{variant:"destructive",onClick:()=>d&&A.mutate(d),disabled:A.isPending,children:A.isPending?"Deleting…":"Delete"})]})]})})]})};var VI=Symbol("radix.slottable");function HI(e){const t=({children:r})=>l.jsx(l.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=VI,t}var CE="AlertDialog",[BI]=ur(CE,[FS]),Kr=FS(),jE=e=>{const{__scopeAlertDialog:t,...r}=e,i=Kr(t);return l.jsx(Dd,{...i,...r,modal:!0})};jE.displayName=CE;var GI="AlertDialogTrigger",RE=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Kr(r);return l.jsx(r1,{...s,...i,ref:t})});RE.displayName=GI;var XI="AlertDialogPortal",OE=e=>{const{__scopeAlertDialog:t,...r}=e,i=Kr(t);return l.jsx(Md,{...i,...r})};OE.displayName=XI;var ZI="AlertDialogOverlay",NE=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Kr(r);return l.jsx(zd,{...s,...i,ref:t})});NE.displayName=ZI;var ms="AlertDialogContent",[YI,QI]=BI(ms),JI=HI("AlertDialogContent"),AE=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:i,...s}=e,u=Kr(r),d=p.useRef(null),h=dt(t,d),g=p.useRef(null);return l.jsx(sz,{contentName:ms,titleName:TE,docsSlug:"alert-dialog",children:l.jsx(YI,{scope:r,cancelRef:g,children:l.jsxs(kd,{role:"alertdialog",...u,...s,ref:h,onOpenAutoFocus:Ce(s.onOpenAutoFocus,y=>{y.preventDefault(),g.current?.focus({preventScroll:!0})}),onPointerDownOutside:y=>y.preventDefault(),onInteractOutside:y=>y.preventDefault(),children:[l.jsx(JI,{children:i}),l.jsx(eL,{contentRef:d})]})})})});AE.displayName=ms;var TE="AlertDialogTitle",DE=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Kr(r);return l.jsx(Qp,{...s,...i,ref:t})});DE.displayName=TE;var ME="AlertDialogDescription",zE=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Kr(r);return l.jsx(Jp,{...s,...i,ref:t})});zE.displayName=ME;var WI="AlertDialogAction",kE=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,s=Kr(r);return l.jsx(nc,{...s,...i,ref:t})});kE.displayName=WI;var PE="AlertDialogCancel",KE=p.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...i}=e,{cancelRef:s}=QI(PE,r),u=Kr(r),d=dt(t,s);return l.jsx(nc,{...u,...i,ref:d})});KE.displayName=PE;var eL=({contentRef:e})=>{const t=`\`${ms}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${ms}\` by passing a \`${ME}\` component as a child, which also benefits sighted users by adding visible context to the dialog. Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${ms}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return p.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},tL=jE,nL=RE,aL=OE,rL=NE,iL=AE,oL=kE,sL=KE,lL=DE,cL=zE;function uL({...e}){return l.jsx(tL,{"data-slot":"alert-dialog",...e})}function dL({...e}){return l.jsx(nL,{"data-slot":"alert-dialog-trigger",...e})}function fL({...e}){return l.jsx(aL,{"data-slot":"alert-dialog-portal",...e})}function hL({className:e,...t}){return l.jsx(rL,{"data-slot":"alert-dialog-overlay",className:de("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",e),...t})}function mL({className:e,...t}){return l.jsxs(fL,{children:[l.jsx(hL,{}),l.jsx(iL,{"data-slot":"alert-dialog-content",className:de("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 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 p-6 shadow-lg duration-200 sm:max-w-lg",e),...t})]})}function pL({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-header",className:de("flex flex-col gap-2 text-center sm:text-left",e),...t})}function gL({className:e,...t}){return l.jsx("div",{"data-slot":"alert-dialog-footer",className:de("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function yL({className:e,...t}){return l.jsx(lL,{"data-slot":"alert-dialog-title",className:de("text-lg font-semibold",e),...t})}function vL({className:e,...t}){return l.jsx(cL,{"data-slot":"alert-dialog-description",className:de("text-muted-foreground text-sm",e),...t})}function xL({className:e,...t}){return l.jsx(oL,{className:de(Gp(),e),...t})}function bL({className:e,...t}){return l.jsx(sL,{className:de(Gp({variant:"outline"}),e),...t})}const wL=Rd(),SL={create:e=>Pe(async()=>wL.createOrg({body:e}))},_L=Oa({display_name:Zt().min(2,"Too short").max(100,"Too long")}),EL=Oa({name:Zt().min(2,"Too short").max(100,"Too long"),expires_in_hours:$_().min(1).max(43800)}),CL=Oa({name:Zt().min(2,"Too short").max(100,"Too long"),domain:Zt().trim().toLowerCase().optional().or(V_("")).refine(e=>!e||/^[a-z0-9.-]+\.[a-z]{2,}$/i.test(e),"Invalid domain (e.g. example.com)")}),jL=()=>{const e=da(),t=rn({queryKey:["me"],queryFn:()=>Vi.getMe()}),r=_n({resolver:En(_L),defaultValues:{display_name:""},values:t.data?{display_name:t.data.display_name??""}:void 0}),i=mt({mutationFn:O=>Vi.updateMe(O),onSuccess:()=>{e.invalidateQueries({queryKey:["me"]}),Ee.success("Profile updated")},onError:O=>Ee.error(O?.message??"Update failed")}),s=rn({queryKey:["me","api-keys"],queryFn:()=>Vi.listKeys()}),[u,d]=p.useState(!1),[h,g]=p.useState(null),y=_n({resolver:En(EL),defaultValues:{name:"",expires_in_hours:720}}),x=mt({mutationFn:O=>Vi.createKey({name:O.name,expires_in_hours:O.expires_in_hours}),onSuccess:O=>{g(O),d(!1),e.invalidateQueries({queryKey:["me","api-keys"]}),Ee.success("API key created")},onError:O=>Ee.error(O?.message??"Failed to create key")}),[v,w]=p.useState(null),E=mt({mutationFn:O=>Vi.deleteKey(O),onSuccess:()=>{e.invalidateQueries({queryKey:["me","api-keys"]}),w(null),Ee.success("Key deleted")},onError:O=>Ee.error(O?.message??"Failed to delete key")}),j=p.useMemo(()=>t.data?.emails?.find(O=>O.is_primary)?.email??t.data?.primary_email??"",[t.data]),[S,N]=p.useState(!1),D=_n({resolver:En(CL),defaultValues:{name:"",domain:""}}),A=mt({mutationFn:O=>SL.create({name:O.name.trim(),domain:O.domain?.trim()?O.domain.trim().toLowerCase():void 0}),onSuccess:()=>{N(!1),D.reset(),e.invalidateQueries({queryKey:["me"]}),Ee.success("Organization created")},onError:O=>Ee.error(O?.message??"Failed to create organization")});return t.isLoading?l.jsx("div",{className:"p-6",children:"Loading…"}):t.error?l.jsx("div",{className:"text-destructive p-6",children:"Failed to load profile"}):l.jsxs("div",{className:"space-y-6 p-6",children:[l.jsxs(Ua,{children:[l.jsxs(lr,{children:[l.jsx(cr,{children:"Profile"}),l.jsx(jp,{children:"Manage your personal information."})]}),l.jsx(qa,{children:l.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{children:[l.jsx(Mr,{children:"Email"}),l.jsx("div",{className:"text-muted-foreground mt-1 text-sm",children:j||"—"})]}),l.jsxs("div",{children:[l.jsx(Mr,{children:"ID"}),l.jsx("div",{className:"text-muted-foreground mt-1 text-sm",children:t.data?.id||"—"}),l.jsx("div",{className:"text-muted-foreground mt-1 text-sm",children:"Share this ID with the organization owner of the Organization to join"})]}),l.jsx(Cn,{...r,children:l.jsxs("form",{className:"space-y-4",onSubmit:r.handleSubmit(O=>i.mutate(O)),children:[l.jsx($e,{control:r.control,name:"display_name",render:({field:O})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Display name"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"Your name",...O})}),l.jsx(Be,{})]})}),l.jsx(se,{type:"submit",disabled:i.isPending,children:"Save"})]})})]}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"flex items-center justify-between",children:[l.jsx(Mr,{children:"Organizations"}),l.jsxs(Et,{open:S,onOpenChange:N,children:[l.jsx(or,{asChild:!0,children:l.jsx(se,{size:"sm",children:"New Organization"})}),l.jsxs(Ct,{children:[l.jsxs(jt,{children:[l.jsx(Rt,{children:"Create organization"}),l.jsx(Im,{children:"Give it a name, and optionally assign your company domain."})]}),l.jsx(Cn,{...D,children:l.jsxs("form",{className:"space-y-4",onSubmit:D.handleSubmit(O=>A.mutate(O)),children:[l.jsx($e,{control:D.control,name:"name",render:({field:O})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Name"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"Acme Inc.",...O})}),l.jsx(Be,{})]})}),l.jsx($e,{control:D.control,name:"domain",render:({field:O})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Domain (optional)"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"acme.com",...O})}),l.jsx(Be,{})]})}),l.jsxs(Mt,{children:[l.jsx(ud,{asChild:!0,children:l.jsx(se,{type:"button",variant:"outline",children:"Cancel"})}),l.jsx(se,{type:"submit",disabled:A.isPending,children:"Create"})]})]})})]})]})]}),l.jsx("div",{className:"rounded-md border",children:l.jsxs(la,{children:[l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{children:"Name"}),l.jsx(ze,{children:"Domain"})]})}),l.jsxs(ua,{children:[t.data?.organizations?.map(O=>l.jsxs(et,{children:[l.jsx(_e,{children:O.name}),l.jsx(_e,{children:O.domain??"—"})]},O.id)),(!t.data?.organizations||t.data.organizations.length===0)&&l.jsx(et,{children:l.jsx(_e,{colSpan:2,className:"text-muted-foreground",children:"No organizations"})})]})]})})]})]})})]}),l.jsx(Jk,{}),l.jsxs(Ua,{children:[l.jsxs(lr,{className:"flex flex-row items-center justify-between space-y-0",children:[l.jsxs("div",{children:[l.jsx(cr,{children:"User API Keys"}),l.jsx(jp,{children:"Personal keys for API access."})]}),l.jsxs(Et,{open:u,onOpenChange:d,children:[l.jsx(or,{asChild:!0,children:l.jsx(se,{children:"New Key"})}),l.jsxs(Ct,{children:[l.jsxs(jt,{children:[l.jsx(Rt,{children:"Create API Key"}),l.jsx(Im,{children:"Give it a label and expiry."})]}),l.jsx(Cn,{...y,children:l.jsxs("form",{className:"space-y-4",onSubmit:y.handleSubmit(O=>x.mutate(O)),children:[l.jsx($e,{control:y.control,name:"name",render:({field:O})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Label"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"CI script, local dev, ...",...O})}),l.jsx(Be,{})]})}),l.jsx($e,{control:y.control,name:"expires_in_hours",render:({field:O})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Expires in hours"}),l.jsx(Xe,{children:l.jsx(Fe,{type:"number",inputMode:"numeric",step:1,min:1,placeholder:"e.g. 720",...O,onChange:C=>O.onChange(C.target.value===""?"":Number(C.target.value))})}),l.jsx(Be,{})]})}),l.jsxs(Mt,{children:[l.jsx(ud,{asChild:!0,children:l.jsx(se,{type:"button",variant:"outline",children:"Cancel"})}),l.jsx(se,{type:"submit",disabled:x.isPending,children:"Create"})]})]})})]})]})]}),l.jsx(qa,{children:l.jsx("div",{className:"overflow-x-auto rounded-md border",children:l.jsxs(la,{className:"text-sm",children:[l.jsx(MK,{children:"Your user-scoped API keys."}),l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{children:"Label"}),l.jsx(ze,{children:"Created"}),l.jsx(ze,{children:"Expires"}),l.jsx(ze,{children:"Last used"}),l.jsx(ze,{className:"w-24"})]})}),l.jsxs(ua,{children:[s.data?.map(O=>l.jsxs(et,{children:[l.jsx(_e,{children:O.name??"—"}),l.jsx(_e,{children:new Date(O.created_at).toLocaleString()}),l.jsx(_e,{children:O.expires_at?new Date(O.expires_at).toLocaleString():"—"}),l.jsx(_e,{children:O.last_used_at?new Date(O.last_used_at).toLocaleString():"—"}),l.jsx(_e,{className:"text-right",children:l.jsxs(uL,{open:v===O.id,onOpenChange:C=>!C&&w(null),children:[l.jsx(dL,{asChild:!0,children:l.jsx(se,{variant:"destructive",size:"sm",onClick:()=>w(O.id),children:"Delete"})}),l.jsxs(mL,{children:[l.jsxs(pL,{children:[l.jsx(yL,{children:"Delete this key?"}),l.jsx(vL,{children:"This action cannot be undone. Requests using this key will stop working."})]}),l.jsxs(gL,{children:[l.jsx(bL,{children:"Cancel"}),l.jsx(xL,{onClick:()=>E.mutate(O.id),children:"Delete"})]})]})]})})]},O.id)),(!s.data||s.data.length===0)&&l.jsx(et,{children:l.jsx(_e,{colSpan:5,className:"text-muted-foreground",children:"No API keys yet."})})]})]})})})]}),l.jsx(Et,{open:!!h,onOpenChange:O=>!O&&g(null),children:l.jsxs(Ct,{children:[l.jsxs(jt,{children:[l.jsx(Rt,{children:"Copy your new API key"}),l.jsx(Im,{children:"This is only shown once. Store it securely."})]}),l.jsx("div",{className:"rounded-md border p-3 font-mono text-sm break-all",children:h?.plain??"—"}),l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(se,{variant:"outline",onClick:()=>{const O=h?.plain;O&&(navigator.clipboard.writeText(O),Ee.success("Copied"))},children:"Copy"}),l.jsx(se,{onClick:()=>g(null),children:"Done"})]})]})})]})},bn=xT(),RL=(e,t)=>e?e===t:!0,_a={listNodePools:()=>Pe(async()=>await bn.listNodePools({})),createNodePool:e=>Pe(async()=>await bn.createNodePool({body:e})),getNodePool:e=>Pe(async()=>await bn.getNodePool({id:e})),deleteNodePool:e=>Pe(async()=>{await bn.deleteNodePool({id:e})}),updateNodePool:(e,t)=>Pe(async()=>await bn.updateNodePool({id:e,body:t})),listNodePoolServers:e=>Pe(async()=>await bn.listNodePoolServers({id:e})),attachNodePoolServer:(e,t)=>Pe(async()=>await bn.attachNodePoolServers({id:e,body:t})),detachNodePoolServers:(e,t)=>Pe(async()=>await bn.detachNodePoolServer({id:e,serverId:t})),listNodePoolTaints:e=>Pe(async()=>await bn.listNodePoolTaints({id:e})),attachNodePoolTaints:(e,t)=>Pe(async()=>await bn.attachNodePoolTaints({id:e,body:t})),detachNodePoolTaints:(e,t)=>Pe(async()=>await bn.detachNodePoolTaint({id:e,taintId:t})),listNodePoolLabels:e=>Pe(async()=>await bn.listNodePoolLabels({id:e})),attachNodePoolLabels:(e,t)=>Pe(async()=>await bn.attachNodePoolLabels({id:e,body:t})),detachNodePoolLabels:(e,t)=>Pe(async()=>await bn.detachNodePoolLabel({id:e,labelId:t})),listNodePoolAnnotations:e=>Pe(async()=>await bn.listNodePoolAnnotations({id:e})),attachNodePoolAnnotations:(e,t)=>Pe(async()=>await bn.attachNodePoolAnnotations({id:e,body:t})),detachNodePoolAnnotations:(e,t)=>Pe(async()=>await bn.detachNodePoolAnnotation({id:e,annotationId:t}))},Nl=mT(),Ll={listServers:()=>Pe(async()=>await Nl.listServers()),createServer:e=>Pe(async()=>await Nl.createServer({body:e})),getServer:e=>Pe(async()=>await Nl.getServer({id:e})),updateServer:(e,t)=>Pe(async()=>await Nl.updateServer({id:e,body:t})),deleteServer:e=>Pe(async()=>{await Nl.deleteServer({id:e})})},Al=pT(),Ul={listTaints:()=>Pe(async()=>await Al.listTaints()),createTaint:e=>Pe(async()=>await Al.createTaint({body:e})),getTaint:e=>Pe(async()=>await Al.getTaint({id:e})),deleteTaint:e=>Pe(async()=>{await Al.deleteTaint({id:e})}),updateTaint:(e,t)=>Pe(async()=>await Al.updateTaint({id:e,body:t}))};var Gm="rovingFocusGroup.onEntryFocus",OL={bubbles:!1,cancelable:!0},uc="RovingFocusGroup",[Dp,IE,NL]=Ng(uc),[AL,LE]=ur(uc,[NL]),[TL,DL]=AL(uc),UE=p.forwardRef((e,t)=>l.jsx(Dp.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Dp.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(ML,{...e,ref:t})})}));UE.displayName=uc;var ML=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:i,loop:s=!1,dir:u,currentTabStopId:d,defaultCurrentTabStopId:h,onCurrentTabStopIdChange:g,onEntryFocus:y,preventScrollOnEntryFocus:x=!1,...v}=e,w=p.useRef(null),E=dt(t,w),j=Ag(u),[S,N]=Yi({prop:d,defaultProp:h??null,onChange:g,caller:uc}),[D,A]=p.useState(!1),O=Fa(y),C=IE(r),T=p.useRef(!1),[U,L]=p.useState(0);return p.useEffect(()=>{const V=w.current;if(V)return V.addEventListener(Gm,O),()=>V.removeEventListener(Gm,O)},[O]),l.jsx(TL,{scope:r,orientation:i,dir:j,loop:s,currentTabStopId:S,onItemFocus:p.useCallback(V=>N(V),[N]),onItemShiftTab:p.useCallback(()=>A(!0),[]),onFocusableItemAdd:p.useCallback(()=>L(V=>V+1),[]),onFocusableItemRemove:p.useCallback(()=>L(V=>V-1),[]),children:l.jsx(rt.div,{tabIndex:D||U===0?-1:0,"data-orientation":i,...v,ref:E,style:{outline:"none",...e.style},onMouseDown:Ce(e.onMouseDown,()=>{T.current=!0}),onFocus:Ce(e.onFocus,V=>{const fe=!T.current;if(V.target===V.currentTarget&&fe&&!D){const ge=new CustomEvent(Gm,OL);if(V.currentTarget.dispatchEvent(ge),!ge.defaultPrevented){const pe=C().filter(R=>R.focusable),ae=pe.find(R=>R.active),le=pe.find(R=>R.id===S),be=[ae,le,...pe].filter(Boolean).map(R=>R.ref.current);$E(be,x)}}T.current=!1}),onBlur:Ce(e.onBlur,()=>A(!1))})})}),qE="RovingFocusGroupItem",FE=p.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:i=!0,active:s=!1,tabStopId:u,children:d,...h}=e,g=Sn(),y=u||g,x=DL(qE,r),v=x.currentTabStopId===y,w=IE(r),{onFocusableItemAdd:E,onFocusableItemRemove:j,currentTabStopId:S}=x;return p.useEffect(()=>{if(i)return E(),()=>j()},[i,E,j]),l.jsx(Dp.ItemSlot,{scope:r,id:y,focusable:i,active:s,children:l.jsx(rt.span,{tabIndex:v?0:-1,"data-orientation":x.orientation,...h,ref:t,onMouseDown:Ce(e.onMouseDown,N=>{i?x.onItemFocus(y):N.preventDefault()}),onFocus:Ce(e.onFocus,()=>x.onItemFocus(y)),onKeyDown:Ce(e.onKeyDown,N=>{if(N.key==="Tab"&&N.shiftKey){x.onItemShiftTab();return}if(N.target!==N.currentTarget)return;const D=PL(N,x.orientation,x.dir);if(D!==void 0){if(N.metaKey||N.ctrlKey||N.altKey||N.shiftKey)return;N.preventDefault();let O=w().filter(C=>C.focusable).map(C=>C.ref.current);if(D==="last")O.reverse();else if(D==="prev"||D==="next"){D==="prev"&&O.reverse();const C=O.indexOf(N.currentTarget);O=x.loop?KL(O,C+1):O.slice(C+1)}setTimeout(()=>$E(O))}}),children:typeof d=="function"?d({isCurrentTabStop:v,hasTabStop:S!=null}):d})})});FE.displayName=qE;var zL={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function kL(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function PL(e,t,r){const i=kL(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return zL[i]}function $E(e,t=!1){const r=document.activeElement;for(const i of e)if(i===r||(i.focus({preventScroll:t}),document.activeElement!==r))return}function KL(e,t){return e.map((r,i)=>e[(t+i)%e.length])}var IL=UE,LL=FE;function UL(e){const t=qL(e),r=p.forwardRef((i,s)=>{const{children:u,...d}=i,h=p.Children.toArray(u),g=h.find($L);if(g){const y=g.props.children,x=h.map(v=>v===g?p.Children.count(y)>1?p.Children.only(null):p.isValidElement(y)?y.props.children:null:v);return l.jsx(t,{...d,ref:s,children:p.isValidElement(y)?p.cloneElement(y,void 0,x):null})}return l.jsx(t,{...d,ref:s,children:u})});return r.displayName=`${e}.Slot`,r}function qL(e){const t=p.forwardRef((r,i)=>{const{children:s,...u}=r;if(p.isValidElement(s)){const d=HL(s),h=VL(u,s.props);return s.type!==p.Fragment&&(h.ref=i?Mn(i,d):d),p.cloneElement(s,h)}return p.Children.count(s)>1?p.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var FL=Symbol("radix.slottable");function $L(e){return p.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===FL}function VL(e,t){const r={...t};for(const i in t){const s=e[i],u=t[i];/^on[A-Z]/.test(i)?s&&u?r[i]=(...h)=>{const g=u(...h);return s(...h),g}:s&&(r[i]=s):i==="style"?r[i]={...s,...u}:i==="className"&&(r[i]=[s,u].filter(Boolean).join(" "))}return{...e,...r}}function HL(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)}var Mp=["Enter"," "],BL=["ArrowDown","PageUp","Home"],VE=["ArrowUp","PageDown","End"],GL=[...BL,...VE],XL={ltr:[...Mp,"ArrowRight"],rtl:[...Mp,"ArrowLeft"]},ZL={ltr:["ArrowLeft"],rtl:["ArrowRight"]},dc="Menu",[Ql,YL,QL]=Ng(dc),[so,HE]=ur(dc,[QL,xi,LE]),of=xi(),BE=LE(),[JL,lo]=so(dc),[WL,fc]=so(dc),GE=e=>{const{__scopeMenu:t,open:r=!1,children:i,dir:s,onOpenChange:u,modal:d=!0}=e,h=of(t),[g,y]=p.useState(null),x=p.useRef(!1),v=Fa(u),w=Ag(s);return p.useEffect(()=>{const E=()=>{x.current=!0,document.addEventListener("pointerdown",j,{capture:!0,once:!0}),document.addEventListener("pointermove",j,{capture:!0,once:!0})},j=()=>x.current=!1;return document.addEventListener("keydown",E,{capture:!0}),()=>{document.removeEventListener("keydown",E,{capture:!0}),document.removeEventListener("pointerdown",j,{capture:!0}),document.removeEventListener("pointermove",j,{capture:!0})}},[]),l.jsx(qd,{...h,children:l.jsx(JL,{scope:t,open:r,onOpenChange:v,content:g,onContentChange:y,children:l.jsx(WL,{scope:t,onClose:p.useCallback(()=>v(!1),[v]),isUsingKeyboardRef:x,dir:w,modal:d,children:i})})})};GE.displayName=dc;var eU="MenuAnchor",Dg=p.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,s=of(r);return l.jsx(ic,{...s,...i,ref:t})});Dg.displayName=eU;var Mg="MenuPortal",[tU,XE]=so(Mg,{forceMount:void 0}),ZE=e=>{const{__scopeMenu:t,forceMount:r,children:i,container:s}=e,u=lo(Mg,t);return l.jsx(tU,{scope:t,forceMount:r,children:l.jsx(ja,{present:r||u.open,children:l.jsx(Cs,{asChild:!0,container:s,children:i})})})};ZE.displayName=Mg;var Ca="MenuContent",[nU,zg]=so(Ca),YE=p.forwardRef((e,t)=>{const r=XE(Ca,e.__scopeMenu),{forceMount:i=r.forceMount,...s}=e,u=lo(Ca,e.__scopeMenu),d=fc(Ca,e.__scopeMenu);return l.jsx(Ql.Provider,{scope:e.__scopeMenu,children:l.jsx(ja,{present:i||u.open,children:l.jsx(Ql.Slot,{scope:e.__scopeMenu,children:d.modal?l.jsx(aU,{...s,ref:t}):l.jsx(rU,{...s,ref:t})})})})}),aU=p.forwardRef((e,t)=>{const r=lo(Ca,e.__scopeMenu),i=p.useRef(null),s=dt(t,i);return p.useEffect(()=>{const u=i.current;if(u)return Ad(u)},[]),l.jsx(kg,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Ce(e.onFocusOutside,u=>u.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),rU=p.forwardRef((e,t)=>{const r=lo(Ca,e.__scopeMenu);return l.jsx(kg,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),iU=UL("MenuContent.ScrollLock"),kg=p.forwardRef((e,t)=>{const{__scopeMenu:r,loop:i=!1,trapFocus:s,onOpenAutoFocus:u,onCloseAutoFocus:d,disableOutsidePointerEvents:h,onEntryFocus:g,onEscapeKeyDown:y,onPointerDownOutside:x,onFocusOutside:v,onInteractOutside:w,onDismiss:E,disableOutsideScroll:j,...S}=e,N=lo(Ca,r),D=fc(Ca,r),A=of(r),O=BE(r),C=YL(r),[T,U]=p.useState(null),L=p.useRef(null),V=dt(t,L,N.onContentChange),fe=p.useRef(0),ge=p.useRef(""),pe=p.useRef(0),ae=p.useRef(null),le=p.useRef("right"),he=p.useRef(0),be=j?tc:p.Fragment,R=j?{as:iU,allowPinchZoom:!0}:void 0,P=ee=>{const me=ge.current+ee,Re=C().filter(W=>!W.disabled),G=document.activeElement,Y=Re.find(W=>W.ref.current===G)?.textValue,ie=Re.map(W=>W.textValue),oe=yU(ie,me,Y),ve=Re.find(W=>W.textValue===oe)?.ref.current;(function W(xe){ge.current=xe,window.clearTimeout(fe.current),xe!==""&&(fe.current=window.setTimeout(()=>W(""),1e3))})(me),ve&&setTimeout(()=>ve.focus())};p.useEffect(()=>()=>window.clearTimeout(fe.current),[]),Od();const I=p.useCallback(ee=>le.current===ae.current?.side&&xU(ee,ae.current?.area),[]);return l.jsx(nU,{scope:r,searchRef:ge,onItemEnter:p.useCallback(ee=>{I(ee)&&ee.preventDefault()},[I]),onItemLeave:p.useCallback(ee=>{I(ee)||(L.current?.focus(),U(null))},[I]),onTriggerLeave:p.useCallback(ee=>{I(ee)&&ee.preventDefault()},[I]),pointerGraceTimerRef:pe,onPointerGraceIntentChange:p.useCallback(ee=>{ae.current=ee},[]),children:l.jsx(be,{...R,children:l.jsx(ec,{asChild:!0,trapped:s,onMountAutoFocus:Ce(u,ee=>{ee.preventDefault(),L.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:d,children:l.jsx(Es,{asChild:!0,disableOutsidePointerEvents:h,onEscapeKeyDown:y,onPointerDownOutside:x,onFocusOutside:v,onInteractOutside:w,onDismiss:E,children:l.jsx(IL,{asChild:!0,...O,dir:D.dir,orientation:"vertical",loop:i,currentTabStopId:T,onCurrentTabStopIdChange:U,onEntryFocus:Ce(g,ee=>{D.isUsingKeyboardRef.current||ee.preventDefault()}),preventScrollOnEntryFocus:!0,children:l.jsx(Fd,{role:"menu","aria-orientation":"vertical","data-state":fC(N.open),"data-radix-menu-content":"",dir:D.dir,...A,...S,ref:V,style:{outline:"none",...S.style},onKeyDown:Ce(S.onKeyDown,ee=>{const Re=ee.target.closest("[data-radix-menu-content]")===ee.currentTarget,G=ee.ctrlKey||ee.altKey||ee.metaKey,Y=ee.key.length===1;Re&&(ee.key==="Tab"&&ee.preventDefault(),!G&&Y&&P(ee.key));const ie=L.current;if(ee.target!==ie||!GL.includes(ee.key))return;ee.preventDefault();const ve=C().filter(W=>!W.disabled).map(W=>W.ref.current);VE.includes(ee.key)&&ve.reverse(),pU(ve)}),onBlur:Ce(e.onBlur,ee=>{ee.currentTarget.contains(ee.target)||(window.clearTimeout(fe.current),ge.current="")}),onPointerMove:Ce(e.onPointerMove,Jl(ee=>{const me=ee.target,Re=he.current!==ee.clientX;if(ee.currentTarget.contains(me)&&Re){const G=ee.clientX>he.current?"right":"left";le.current=G,he.current=ee.clientX}}))})})})})})})});YE.displayName=Ca;var oU="MenuGroup",Pg=p.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(rt.div,{role:"group",...i,ref:t})});Pg.displayName=oU;var sU="MenuLabel",QE=p.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(rt.div,{...i,ref:t})});QE.displayName=sU;var Sd="MenuItem",M0="menu.itemSelect",sf=p.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:i,...s}=e,u=p.useRef(null),d=fc(Sd,e.__scopeMenu),h=zg(Sd,e.__scopeMenu),g=dt(t,u),y=p.useRef(!1),x=()=>{const v=u.current;if(!r&&v){const w=new CustomEvent(M0,{bubbles:!0,cancelable:!0});v.addEventListener(M0,E=>i?.(E),{once:!0}),NS(v,w),w.defaultPrevented?y.current=!1:d.onClose()}};return l.jsx(JE,{...s,ref:g,disabled:r,onClick:Ce(e.onClick,x),onPointerDown:v=>{e.onPointerDown?.(v),y.current=!0},onPointerUp:Ce(e.onPointerUp,v=>{y.current||v.currentTarget?.click()}),onKeyDown:Ce(e.onKeyDown,v=>{const w=h.searchRef.current!=="";r||w&&v.key===" "||Mp.includes(v.key)&&(v.currentTarget.click(),v.preventDefault())})})});sf.displayName=Sd;var JE=p.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:i=!1,textValue:s,...u}=e,d=zg(Sd,r),h=BE(r),g=p.useRef(null),y=dt(t,g),[x,v]=p.useState(!1),[w,E]=p.useState("");return p.useEffect(()=>{const j=g.current;j&&E((j.textContent??"").trim())},[u.children]),l.jsx(Ql.ItemSlot,{scope:r,disabled:i,textValue:s??w,children:l.jsx(LL,{asChild:!0,...h,focusable:!i,children:l.jsx(rt.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":i||void 0,"data-disabled":i?"":void 0,...u,ref:y,onPointerMove:Ce(e.onPointerMove,Jl(j=>{i?d.onItemLeave(j):(d.onItemEnter(j),j.defaultPrevented||j.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Ce(e.onPointerLeave,Jl(j=>d.onItemLeave(j))),onFocus:Ce(e.onFocus,()=>v(!0)),onBlur:Ce(e.onBlur,()=>v(!1))})})})}),lU="MenuCheckboxItem",WE=p.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:i,...s}=e;return l.jsx(rC,{scope:e.__scopeMenu,checked:r,children:l.jsx(sf,{role:"menuitemcheckbox","aria-checked":_d(r)?"mixed":r,...s,ref:t,"data-state":Ig(r),onSelect:Ce(s.onSelect,()=>i?.(_d(r)?!0:!r),{checkForDefaultPrevented:!1})})})});WE.displayName=lU;var eC="MenuRadioGroup",[cU,uU]=so(eC,{value:void 0,onValueChange:()=>{}}),tC=p.forwardRef((e,t)=>{const{value:r,onValueChange:i,...s}=e,u=Fa(i);return l.jsx(cU,{scope:e.__scopeMenu,value:r,onValueChange:u,children:l.jsx(Pg,{...s,ref:t})})});tC.displayName=eC;var nC="MenuRadioItem",aC=p.forwardRef((e,t)=>{const{value:r,...i}=e,s=uU(nC,e.__scopeMenu),u=r===s.value;return l.jsx(rC,{scope:e.__scopeMenu,checked:u,children:l.jsx(sf,{role:"menuitemradio","aria-checked":u,...i,ref:t,"data-state":Ig(u),onSelect:Ce(i.onSelect,()=>s.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});aC.displayName=nC;var Kg="MenuItemIndicator",[rC,dU]=so(Kg,{checked:!1}),iC=p.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:i,...s}=e,u=dU(Kg,r);return l.jsx(ja,{present:i||_d(u.checked)||u.checked===!0,children:l.jsx(rt.span,{...s,ref:t,"data-state":Ig(u.checked)})})});iC.displayName=Kg;var fU="MenuSeparator",oC=p.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e;return l.jsx(rt.div,{role:"separator","aria-orientation":"horizontal",...i,ref:t})});oC.displayName=fU;var hU="MenuArrow",sC=p.forwardRef((e,t)=>{const{__scopeMenu:r,...i}=e,s=of(r);return l.jsx($d,{...s,...i,ref:t})});sC.displayName=hU;var mU="MenuSub",[O9,lC]=so(mU),ql="MenuSubTrigger",cC=p.forwardRef((e,t)=>{const r=lo(ql,e.__scopeMenu),i=fc(ql,e.__scopeMenu),s=lC(ql,e.__scopeMenu),u=zg(ql,e.__scopeMenu),d=p.useRef(null),{pointerGraceTimerRef:h,onPointerGraceIntentChange:g}=u,y={__scopeMenu:e.__scopeMenu},x=p.useCallback(()=>{d.current&&window.clearTimeout(d.current),d.current=null},[]);return p.useEffect(()=>x,[x]),p.useEffect(()=>{const v=h.current;return()=>{window.clearTimeout(v),g(null)}},[h,g]),l.jsx(Dg,{asChild:!0,...y,children:l.jsx(JE,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":fC(r.open),...e,ref:Mn(t,s.onTriggerChange),onClick:v=>{e.onClick?.(v),!(e.disabled||v.defaultPrevented)&&(v.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Ce(e.onPointerMove,Jl(v=>{u.onItemEnter(v),!v.defaultPrevented&&!e.disabled&&!r.open&&!d.current&&(u.onPointerGraceIntentChange(null),d.current=window.setTimeout(()=>{r.onOpenChange(!0),x()},100))})),onPointerLeave:Ce(e.onPointerLeave,Jl(v=>{x();const w=r.content?.getBoundingClientRect();if(w){const E=r.content?.dataset.side,j=E==="right",S=j?-5:5,N=w[j?"left":"right"],D=w[j?"right":"left"];u.onPointerGraceIntentChange({area:[{x:v.clientX+S,y:v.clientY},{x:N,y:w.top},{x:D,y:w.top},{x:D,y:w.bottom},{x:N,y:w.bottom}],side:E}),window.clearTimeout(h.current),h.current=window.setTimeout(()=>u.onPointerGraceIntentChange(null),300)}else{if(u.onTriggerLeave(v),v.defaultPrevented)return;u.onPointerGraceIntentChange(null)}})),onKeyDown:Ce(e.onKeyDown,v=>{const w=u.searchRef.current!=="";e.disabled||w&&v.key===" "||XL[i.dir].includes(v.key)&&(r.onOpenChange(!0),r.content?.focus(),v.preventDefault())})})})});cC.displayName=ql;var uC="MenuSubContent",dC=p.forwardRef((e,t)=>{const r=XE(Ca,e.__scopeMenu),{forceMount:i=r.forceMount,...s}=e,u=lo(Ca,e.__scopeMenu),d=fc(Ca,e.__scopeMenu),h=lC(uC,e.__scopeMenu),g=p.useRef(null),y=dt(t,g);return l.jsx(Ql.Provider,{scope:e.__scopeMenu,children:l.jsx(ja,{present:i||u.open,children:l.jsx(Ql.Slot,{scope:e.__scopeMenu,children:l.jsx(kg,{id:h.contentId,"aria-labelledby":h.triggerId,...s,ref:y,align:"start",side:d.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:x=>{d.isUsingKeyboardRef.current&&g.current?.focus(),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:Ce(e.onFocusOutside,x=>{x.target!==h.trigger&&u.onOpenChange(!1)}),onEscapeKeyDown:Ce(e.onEscapeKeyDown,x=>{d.onClose(),x.preventDefault()}),onKeyDown:Ce(e.onKeyDown,x=>{const v=x.currentTarget.contains(x.target),w=ZL[d.dir].includes(x.key);v&&w&&(u.onOpenChange(!1),h.trigger?.focus(),x.preventDefault())})})})})})});dC.displayName=uC;function fC(e){return e?"open":"closed"}function _d(e){return e==="indeterminate"}function Ig(e){return _d(e)?"indeterminate":e?"checked":"unchecked"}function pU(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function gU(e,t){return e.map((r,i)=>e[(t+i)%e.length])}function yU(e,t,r){const s=t.length>1&&Array.from(t).every(y=>y===t[0])?t[0]:t,u=r?e.indexOf(r):-1;let d=gU(e,Math.max(u,0));s.length===1&&(d=d.filter(y=>y!==r));const g=d.find(y=>y.toLowerCase().startsWith(s.toLowerCase()));return g!==r?g:void 0}function vU(e,t){const{x:r,y:i}=e;let s=!1;for(let u=0,d=t.length-1;ui!=w>i&&r<(v-y)*(i-x)/(w-x)+y&&(s=!s)}return s}function xU(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return vU(r,t)}function Jl(e){return t=>t.pointerType==="mouse"?e(t):void 0}var bU=GE,wU=Dg,SU=ZE,_U=YE,EU=Pg,CU=QE,jU=sf,RU=WE,OU=tC,NU=aC,AU=iC,TU=oC,DU=sC,MU=cC,zU=dC,lf="DropdownMenu",[kU]=ur(lf,[HE]),zn=HE(),[PU,hC]=kU(lf),mC=e=>{const{__scopeDropdownMenu:t,children:r,dir:i,open:s,defaultOpen:u,onOpenChange:d,modal:h=!0}=e,g=zn(t),y=p.useRef(null),[x,v]=Yi({prop:s,defaultProp:u??!1,onChange:d,caller:lf});return l.jsx(PU,{scope:t,triggerId:Sn(),triggerRef:y,contentId:Sn(),open:x,onOpenChange:v,onOpenToggle:p.useCallback(()=>v(w=>!w),[v]),modal:h,children:l.jsx(bU,{...g,open:x,onOpenChange:v,dir:i,modal:h,children:r})})};mC.displayName=lf;var pC="DropdownMenuTrigger",gC=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:i=!1,...s}=e,u=hC(pC,r),d=zn(r);return l.jsx(wU,{asChild:!0,...d,children:l.jsx(rt.button,{type:"button",id:u.triggerId,"aria-haspopup":"menu","aria-expanded":u.open,"aria-controls":u.open?u.contentId:void 0,"data-state":u.open?"open":"closed","data-disabled":i?"":void 0,disabled:i,...s,ref:Mn(t,u.triggerRef),onPointerDown:Ce(e.onPointerDown,h=>{!i&&h.button===0&&h.ctrlKey===!1&&(u.onOpenToggle(),u.open||h.preventDefault())}),onKeyDown:Ce(e.onKeyDown,h=>{i||(["Enter"," "].includes(h.key)&&u.onOpenToggle(),h.key==="ArrowDown"&&u.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(h.key)&&h.preventDefault())})})})});gC.displayName=pC;var KU="DropdownMenuPortal",yC=e=>{const{__scopeDropdownMenu:t,...r}=e,i=zn(t);return l.jsx(SU,{...i,...r})};yC.displayName=KU;var vC="DropdownMenuContent",xC=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=hC(vC,r),u=zn(r),d=p.useRef(!1);return l.jsx(_U,{id:s.contentId,"aria-labelledby":s.triggerId,...u,...i,ref:t,onCloseAutoFocus:Ce(e.onCloseAutoFocus,h=>{d.current||s.triggerRef.current?.focus(),d.current=!1,h.preventDefault()}),onInteractOutside:Ce(e.onInteractOutside,h=>{const g=h.detail.originalEvent,y=g.button===0&&g.ctrlKey===!0,x=g.button===2||y;(!s.modal||x)&&(d.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)"}})});xC.displayName=vC;var IU="DropdownMenuGroup",LU=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=zn(r);return l.jsx(EU,{...s,...i,ref:t})});LU.displayName=IU;var UU="DropdownMenuLabel",qU=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=zn(r);return l.jsx(CU,{...s,...i,ref:t})});qU.displayName=UU;var FU="DropdownMenuItem",bC=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=zn(r);return l.jsx(jU,{...s,...i,ref:t})});bC.displayName=FU;var $U="DropdownMenuCheckboxItem",VU=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=zn(r);return l.jsx(RU,{...s,...i,ref:t})});VU.displayName=$U;var HU="DropdownMenuRadioGroup",BU=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=zn(r);return l.jsx(OU,{...s,...i,ref:t})});BU.displayName=HU;var GU="DropdownMenuRadioItem",XU=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=zn(r);return l.jsx(NU,{...s,...i,ref:t})});XU.displayName=GU;var ZU="DropdownMenuItemIndicator",YU=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=zn(r);return l.jsx(AU,{...s,...i,ref:t})});YU.displayName=ZU;var QU="DropdownMenuSeparator",JU=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=zn(r);return l.jsx(TU,{...s,...i,ref:t})});JU.displayName=QU;var WU="DropdownMenuArrow",e7=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=zn(r);return l.jsx(DU,{...s,...i,ref:t})});e7.displayName=WU;var t7="DropdownMenuSubTrigger",n7=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=zn(r);return l.jsx(MU,{...s,...i,ref:t})});n7.displayName=t7;var a7="DropdownMenuSubContent",r7=p.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...i}=e,s=zn(r);return l.jsx(zU,{...s,...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)"}})});r7.displayName=a7;var i7=mC,o7=gC,s7=yC,l7=xC,c7=bC;function u7({...e}){return l.jsx(i7,{"data-slot":"dropdown-menu",...e})}function d7({...e}){return l.jsx(o7,{"data-slot":"dropdown-menu-trigger",...e})}function f7({className:e,sideOffset:t=4,...r}){return l.jsx(s7,{children:l.jsx(l7,{"data-slot":"dropdown-menu-content",sideOffset:t,className:de("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",e),...r})})}function z0({className:e,inset:t,variant:r="default",...i}){return l.jsx(c7,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:de("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...i})}const h7=["master","worker"];function k0({status:e}){const t=e==="ready"?"default":e==="provisioning"?"secondary":e==="failed"?"destructive":"outline";return l.jsx(Ia,{variant:t,className:"capitalize",children:e||"unknown"})}function Dr(e,t){return(e??"").toLowerCase().includes(t)}function Xm(e){const{open:t,title:r,onOpenChange:i,items:s,initialSelectedIds:u,onSave:d,columns:h,allowItem:g}=e,[y,x]=p.useState(""),[v,w]=p.useState(new Set(u)),[E,j]=p.useState(!1);p.useEffect(()=>{w(new Set(u)),x("")},[u,t]);const S=p.useMemo(()=>{const A=y.trim().toLowerCase();return s.filter(O=>g&&!g(O)?!1:A?Dr(O.name,A)||Dr(O.key,A)||Dr(O.value,A)||Dr(O.effect,A)||Dr(O.hostname,A)||Dr(O.private_ip_address,A)||Dr(O.public_ip_address,A)||Dr(O.role,A)||Dr(O.status,A):!0)},[s,y,g]),N=u,D=Array.from(v).some(A=>!N.has(A))||Array.from(N).some(A=>!v.has(A));return l.jsx(Et,{open:t,onOpenChange:i,children:l.jsxs(Ct,{className:"sm:max-w-3xl",children:[l.jsx(jt,{children:l.jsx(Rt,{children:r})}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"relative",children:[l.jsx(zr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),l.jsx(Fe,{value:y,onChange:A=>x(A.target.value),placeholder:"Search…",className:"pl-8"})]}),l.jsx("div",{className:"max-h-[50vh] overflow-auto rounded border",children:l.jsxs(la,{children:[l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{className:"w-[48px]"}),h.map((A,O)=>l.jsx(ze,{children:A.header},O))]})}),l.jsxs(ua,{children:[S.map(A=>{const O=A.id,C=v.has(O);return l.jsxs(et,{children:[l.jsx(_e,{className:"text-center align-middle",children:l.jsx("input",{type:"checkbox",className:"h-4 w-4",checked:C,onChange:T=>{const U=new Set(v);T.target.checked?U.add(O):U.delete(O),w(U)}})}),h.map((T,U)=>l.jsx(_e,{children:T.render(A)},U))]},O)}),S.length===0&&l.jsx(et,{children:l.jsx(_e,{colSpan:1+h.length,className:"text-muted-foreground py-8 text-center",children:"No items found."})})]})]})}),l.jsxs("div",{className:"text-muted-foreground text-sm",children:["Selected: ",l.jsx("span",{className:"text-foreground font-medium",children:v.size})]})]}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>i(!1),disabled:E,children:"Close"}),l.jsx(se,{onClick:async()=>{const A=[],O=[];for(const C of v)N.has(C)||A.push(C);for(const C of N)v.has(C)||O.push(C);try{j(!0),await d({toAttach:A,toDetach:O}),i(!1)}finally{j(!1)}},disabled:E||!D,children:E?"Saving…":"Save changes"})]})]})})}const wC=Oa({name:Zt().trim().min(1,"Name is required").max(120,"Max 120 chars"),role:gi(h7)}),m7=wC.partial();function p7(){const[e,t]=p.useState(""),[r,i]=p.useState(!1),[s,u]=p.useState(!1),[d,h]=p.useState(!1),[g,y]=p.useState(null),[x,v]=p.useState(null),[w,E]=p.useState(!1),[j,S]=p.useState(null),[N,D]=p.useState(new Set),[A,O]=p.useState(new Set),[C,T]=p.useState(""),[U,L]=p.useState(!1),[V,fe]=p.useState(!1),[ge,pe]=p.useState(!1),[ae,le]=p.useState(null),[he,be]=p.useState(new Set),[R,P]=p.useState(new Set),[I,ee]=p.useState(new Set),me=da(),Re=rn({queryKey:["node-pools"],queryFn:()=>_a.listNodePools()}),G=rn({queryKey:["servers"],queryFn:()=>Ll.listServers()}),Y=rn({queryKey:["annotations"],queryFn:()=>kl.listAnnotations()}),ie=rn({queryKey:["labels"],queryFn:()=>Pl.listLabels()}),oe=rn({queryKey:["taints"],queryFn:()=>Ul.listTaints()}),ve=_n({resolver:En(wC),defaultValues:{name:"",role:"worker"}}),W=mt({mutationFn:B=>_a.createNodePool(B),onSuccess:async()=>{await me.invalidateQueries({queryKey:["node-pools"]}),ve.reset({name:"",role:"worker"}),i(!1),Ee.success("Node pool created.")},onError:B=>Ee.error(B?.message??"Unable to create node pool.")}),xe=B=>W.mutate(B),Oe=_n({resolver:En(m7),defaultValues:{name:void 0,role:void 0}});p.useEffect(()=>{g?Oe.reset({name:g.name,role:g.role}):Oe.reset({name:void 0,role:void 0})},[g]);const Ue=mt({mutationFn:async B=>{if(!g)return;const qe={};return B.name!==g.name&&(qe.name=B.name),B.role!==g.role&&(qe.role=B.role),await _a.updateNodePool(g.id,qe)},onSuccess:async()=>{await me.invalidateQueries({queryKey:["node-pools"]}),u(!1),y(null),Ee.success("Node pool updated.")},onError:B=>Ee.error(B?.message??"Unable to update node pool.")}),Ye=B=>Ue.mutate(B),Ze=mt({mutationFn:async()=>{x&&await _a.deleteNodePool(x.id)},onSuccess:async()=>{await me.invalidateQueries({queryKey:["node-pools"]}),h(!1),v(null),Ee.success("Node pool deleted.")},onError:B=>Ee.error(B?.message??"Unable to delete node pool.")}),Kt=p.useMemo(()=>{const B=Re.data??[],qe=e.trim().toLowerCase();return qe?B.filter(ke=>ke.name?.toLowerCase().includes(qe)||ke.role?.toLowerCase().includes(qe)):B},[e,Re.data]);return Re.isLoading?l.jsx("div",{className:"p-6",children:"Loading node pools…"}):Re.error?l.jsxs("div",{className:"p-6 text-red-500",children:["Error loading node pools.",l.jsx("pre",{className:"bg-muted mt-3 rounded p-3 text-xs",children:JSON.stringify(Re.error,null,2)})]}):l.jsxs("div",{className:"space-y-4 p-6",children:[l.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[l.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Node Pools"}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx(zr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),l.jsx(Fe,{value:e,onChange:B=>t(B.target.value),placeholder:"Search node pools",className:"w-64 pl-8"})]}),l.jsxs(Et,{open:r,onOpenChange:i,children:[l.jsx(or,{asChild:!0,children:l.jsxs(se,{onClick:()=>i(!0),children:[l.jsx(ro,{className:"mr-2 h-4 w-4"}),"Create Node Pool"]})}),l.jsxs(Ct,{className:"sm:max-w-lg",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Create Node Pool"})}),l.jsx(Cn,{...ve,children:l.jsxs("form",{className:"space-y-4",onSubmit:ve.handleSubmit(xe),children:[l.jsx($e,{control:ve.control,name:"name",render:({field:B})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Name"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"master-pool",...B})}),l.jsx(Be,{})]})}),l.jsx($e,{control:ve.control,name:"role",render:({field:B})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Role"}),l.jsxs(dn,{onValueChange:qe=>ve.setValue("role",qe,{shouldDirty:!0,shouldValidate:!0}),value:B.value,children:[l.jsx(Xe,{children:l.jsx(hn,{children:l.jsx(fn,{placeholder:"Select role"})})}),l.jsxs(mn,{children:[l.jsx(ut,{value:"master",children:"master"}),l.jsx(ut,{value:"worker",children:"worker"})]})]}),l.jsx(Be,{})]})}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),l.jsx(se,{type:"submit",disabled:ve.formState.isSubmitting,children:ve.formState.isSubmitting?"Creating…":"Create"})]})]})})]})]})]})]}),l.jsx("div",{className:"bg-background overflow-hidden rounded-2xl border shadow-sm",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(la,{children:[l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{children:"Name"}),l.jsx(ze,{children:"Role"}),l.jsx(ze,{children:"Servers"}),l.jsx(ze,{children:"Annotations"}),l.jsx(ze,{children:"Labels"}),l.jsx(ze,{children:"Taints"}),l.jsx(ze,{className:"w-[180px] text-right",children:"Actions"})]})}),l.jsxs(ua,{children:[Kt.map(B=>{const qe=Array.isArray(B.servers)?B.servers.length:0;return l.jsxs(et,{children:[l.jsx(_e,{className:"font-medium",children:B.name}),l.jsx(_e,{className:"font-medium",children:B.role}),l.jsx(_e,{children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[(B.servers||[]).slice(0,6).map(ke=>l.jsxs(Ia,{variant:"secondary",className:"gap-1",children:[l.jsx(iS,{className:"h-3 w-3"}),ke.hostname||ke.private_ip_address,l.jsx("span",{className:"ml-1",children:ke.role}),ke.status&&l.jsx("span",{className:"ml-1",children:l.jsx(k0,{status:ke.status})})]},ke.id)),qe===0&&l.jsx("span",{className:"text-muted-foreground",children:"No servers"}),qe>6&&l.jsxs("span",{className:"text-muted-foreground",children:["+",qe-6," more"]}),l.jsxs(se,{variant:"outline",size:"sm",onClick:()=>{S(B);const ke=new Set((B.servers||[]).map(Qe=>Qe.id));D(new Set(ke)),O(new Set(ke)),T(""),E(!0)},children:[l.jsx(Ru,{className:"mr-2 h-4 w-4"}),"Manage Servers"]})]})}),l.jsx(_e,{children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[(B.annotations||[]).slice(0,6).map(ke=>l.jsxs(Ia,{variant:"outline",className:"gap-1",children:[ke.key,":",ke.value]},ke.id)),(B.annotations||[]).length===0&&l.jsx("span",{className:"text-muted-foreground",children:"No annotations"}),(B.annotations||[]).length>6&&l.jsxs("span",{className:"text-muted-foreground",children:["+",(B.annotations||[]).length-6," more"]}),l.jsxs(se,{variant:"outline",size:"sm",onClick:()=>{le(B),P(new Set((B.annotations||[]).map(ke=>ke.id))),fe(!0)},children:[l.jsx(Ru,{className:"mr-2 h-4 w-4"}),"Manage"]})]})}),l.jsx(_e,{children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[(B.labels||[]).slice(0,6).map(ke=>l.jsxs(Ia,{variant:"secondary",className:"gap-1",children:[ke.key,":",ke.value]},ke.id)),(B.labels||[]).length===0&&l.jsx("span",{className:"text-muted-foreground",children:"No labels"}),(B.labels||[]).length>6&&l.jsxs("span",{className:"text-muted-foreground",children:["+",(B.labels||[]).length-6," more"]}),l.jsxs(se,{variant:"outline",size:"sm",onClick:()=>{le(B),be(new Set((B.labels||[]).map(ke=>ke.id))),L(!0)},children:[l.jsx(Ru,{className:"mr-2 h-4 w-4"}),"Manage"]})]})}),l.jsx(_e,{children:l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[(B.taints||[]).slice(0,6).map(ke=>l.jsxs(Ia,{variant:"outline",className:"gap-1",children:[ke.key,":",ke.value,ke.effect?l.jsxs("span",{className:"ml-1",children:["(",ke.effect,")"]}):null]},ke.id)),(B.taints||[]).length===0&&l.jsx("span",{className:"text-muted-foreground",children:"No taints"}),(B.taints||[]).length>6&&l.jsxs("span",{className:"text-muted-foreground",children:["+",(B.taints||[]).length-6," more"]}),l.jsxs(se,{variant:"outline",size:"sm",onClick:()=>{le(B),ee(new Set((B.taints||[]).map(ke=>ke.id))),pe(!0)},children:[l.jsx(Ru,{className:"mr-2 h-4 w-4"}),"Manage"]})]})}),l.jsx(_e,{className:"text-right",children:l.jsxs(u7,{children:[l.jsx(d7,{asChild:!0,children:l.jsx(se,{size:"icon",variant:"ghost",className:"h-8 w-8",children:l.jsx(i2,{className:"h-4 w-4"})})}),l.jsxs(f7,{align:"end",children:[l.jsxs(z0,{onClick:()=>{y(B),u(!0)},children:[l.jsx(Cd,{className:"mr-2 h-4 w-4"})," Edit"]}),l.jsxs(z0,{className:"text-red-600 focus:text-red-600",onClick:()=>{v(B),h(!0)},children:[l.jsx(oS,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})})]},B.id)}),Kt.length===0&&l.jsx(et,{children:l.jsx(_e,{colSpan:7,className:"text-muted-foreground py-10 text-center",children:"No node pools found."})})]})]})})}),l.jsx(Et,{open:s,onOpenChange:u,children:l.jsxs(Ct,{className:"sm:max-w-lg",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Edit Node Pool"})}),l.jsx(Cn,{...Oe,children:l.jsxs("form",{className:"space-y-4",onSubmit:Oe.handleSubmit(Ye),children:[l.jsx($e,{control:Oe.control,name:"name",render:({field:B})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Name"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"pool-name",...B})}),l.jsx(Be,{})]})}),l.jsx($e,{control:Oe.control,name:"role",render:({field:B})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Role"}),l.jsxs(dn,{onValueChange:qe=>Oe.setValue("role",qe,{shouldDirty:!0,shouldValidate:!0}),value:B.value,children:[l.jsx(Xe,{children:l.jsx(hn,{children:l.jsx(fn,{placeholder:"Select role"})})}),l.jsxs(mn,{children:[l.jsx(ut,{value:"master",children:"master"}),l.jsx(ut,{value:"worker",children:"worker"})]})]}),l.jsx(Be,{})]})}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>{u(!1),y(null)},children:"Cancel"}),l.jsx(se,{type:"submit",disabled:Oe.formState.isSubmitting,children:Oe.formState.isSubmitting?"Saving…":"Save changes"})]})]})})]})}),l.jsx(Et,{open:d,onOpenChange:h,children:l.jsxs(Ct,{className:"sm:max-w-md",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Delete node pool"})}),l.jsxs("p",{className:"text-muted-foreground text-sm",children:["This will permanently delete"," ",l.jsx("span",{className:"text-foreground font-medium",children:x?.name}),"."]}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>{h(!1),v(null)},children:"Cancel"}),l.jsx(se,{variant:"destructive",onClick:()=>Ze.mutate(),disabled:Ze.isPending,children:Ze.isPending?"Deleting…":"Delete"})]})]})}),l.jsx(Et,{open:w,onOpenChange:E,children:l.jsxs(Ct,{className:"sm:max-w-3xl",children:[l.jsx(jt,{children:l.jsxs(Rt,{children:["Manage Servers",j?` — ${j.name}`:""]})}),l.jsxs("div",{className:"space-y-3",children:[l.jsxs("div",{className:"relative",children:[l.jsx(zr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),l.jsx(Fe,{value:C,onChange:B=>T(B.target.value),placeholder:"Search by hostname, IP or role…",className:"pl-8"})]}),l.jsx("div",{className:"max-h-[50vh] overflow-auto rounded border",children:l.jsxs(la,{children:[l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{className:"w-[48px]"}),l.jsx(ze,{children:"Hostname"}),l.jsx(ze,{children:"Private IP"}),l.jsx(ze,{children:"Public IP"}),l.jsx(ze,{children:"Role"}),l.jsx(ze,{children:"Status"})]})}),l.jsxs(ua,{children:[(G.data??[]).filter(B=>{if(j?.role&&!RL(j.role,B.role))return!1;const qe=C.trim().toLowerCase();return qe?(B.hostname??"").toLowerCase().includes(qe)||(B.private_ip_address??"").toLowerCase().includes(qe)||(B.public_ip_address??"").toLowerCase().includes(qe)||(B.role??"").toLowerCase().includes(qe):!0}).map(B=>{const qe=B.id,ke=N.has(qe);return l.jsxs(et,{children:[l.jsx(_e,{className:"text-center align-middle",children:l.jsx("input",{type:"checkbox",className:"h-4 w-4",checked:ke,onChange:Qe=>{const Ga=new Set(N);Qe.target.checked?Ga.add(qe):Ga.delete(qe),D(Ga)}})}),l.jsx(_e,{className:"font-medium",children:B.hostname||"—"}),l.jsx(_e,{children:B.private_ip_address||"—"}),l.jsx(_e,{children:B.public_ip_address||"—"}),l.jsx(_e,{className:"capitalize",children:B.role||"—"}),l.jsx(_e,{children:l.jsx(k0,{status:B.status})})]},qe)}),(G.data??[]).length===0&&l.jsx(et,{children:l.jsx(_e,{colSpan:6,className:"text-muted-foreground py-8 text-center",children:G.isLoading?"Loading servers…":"No servers found."})})]})]})}),l.jsxs("div",{className:"text-muted-foreground text-sm",children:["Selected: ",l.jsx("span",{className:"text-foreground font-medium",children:N.size})]})]}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>{E(!1),S(null),D(new Set),O(new Set),T("")},children:"Close"}),l.jsx(se,{onClick:async()=>{if(!j)return;const B=j.id,qe=[],ke=[];for(const Qe of N)A.has(Qe)||qe.push(Qe);for(const Qe of A)N.has(Qe)||ke.push(Qe);try{qe.length>0&&await _a.attachNodePoolServer(B,{server_ids:qe});for(const Qe of ke)await _a.detachNodePoolServers(B,Qe);await me.invalidateQueries({queryKey:["node-pools"]}),await me.invalidateQueries({queryKey:["servers"]}),Ee.success("Servers updated for node pool."),E(!1),S(null),D(new Set),O(new Set),T("")}catch(Qe){Ee.error(Qe?.message??"Failed to update servers.")}},disabled:G.isLoading,children:"Save changes"})]})]})}),l.jsx(Xm,{open:U,onOpenChange:B=>{L(B),B||le(null)},title:`Manage Labels${ae?` — ${ae.name}`:""}`,items:(ie.data??[]).map(B=>({id:B.id,key:B.key,value:B.value,name:`${B.key}:${B.value}`})),initialSelectedIds:he,columns:[{header:"Key",render:B=>l.jsx("span",{className:"font-medium",children:B.key})},{header:"Value",render:B=>B.value??"—"}],onSave:async({toAttach:B,toDetach:qe})=>{if(!ae)return;const ke=ae.id;try{B.length>0&&await _a.attachNodePoolLabels(ke,{label_ids:B});for(const Qe of qe)await _a.detachNodePoolLabels(ke,Qe);await me.invalidateQueries({queryKey:["node-pools"]}),Ee.success("Labels updated for node pool.")}catch(Qe){throw Ee.error(Qe?.message??"Failed to update labels."),Qe}}}),l.jsx(Xm,{open:V,onOpenChange:B=>{fe(B),B||le(null)},title:`Manage Annotations${ae?` — ${ae.name}`:""}`,items:(Y.data??[]).map(B=>({id:B.id,key:B.key,value:B.value,name:`${B.key}:${B.value}`})),initialSelectedIds:R,columns:[{header:"Key",render:B=>l.jsx("span",{className:"font-medium",children:B.key})},{header:"Value",render:B=>B.value??"—"}],onSave:async({toAttach:B,toDetach:qe})=>{if(!ae)return;const ke=ae.id;try{B.length>0&&await _a.attachNodePoolAnnotations(ke,{annotation_ids:B});for(const Qe of qe)await _a.detachNodePoolAnnotations(ke,Qe);await me.invalidateQueries({queryKey:["node-pools"]}),Ee.success("Annotations updated for node pool.")}catch(Qe){throw Ee.error(Qe?.message??"Failed to update annotations."),Qe}}}),l.jsx(Xm,{open:ge,onOpenChange:B=>{pe(B),B||le(null)},title:`Manage Taints${ae?` — ${ae.name}`:""}`,items:(oe.data??[]).map(B=>({id:B.id,key:B.key,value:B.value,effect:B.effect,name:`${B.key}:${B.value}`})),initialSelectedIds:I,columns:[{header:"Key",render:B=>l.jsx("span",{className:"font-medium",children:B.key})},{header:"Value",render:B=>B.value??"—"},{header:"Effect",render:B=>B.effect??"—"}],onSave:async({toAttach:B,toDetach:qe})=>{if(!ae)return;const ke=ae.id;try{B.length>0&&await _a.attachNodePoolTaints(ke,{taint_ids:B});for(const Qe of qe)await _a.detachNodePoolTaints(ke,Qe);await me.invalidateQueries({queryKey:["node-pools"]}),Ee.success("Taints updated for node pool.")}catch(Qe){throw Ee.error(Qe?.message??"Failed to update taints."),Qe}}})]})}const g7=Oa({name:Zt(),expires_in_hours:$_().min(1).max(43800)}),y7=()=>{const e=Rd(),t=da(),r=La.get(),i=rn({enabled:!!r,queryKey:["org:keys",r],queryFn:()=>Pe(()=>e.listOrgKeys({id:r}))}),s=_n({resolver:En(g7),defaultValues:{name:"",expires_in_hours:720}}),[u,d]=p.useState(null),h=mt({mutationFn:y=>e.createOrgKey({id:r,body:y}),onSuccess:y=>{t.invalidateQueries({queryKey:["org:keys",r]}),d({key:y.org_key,secret:y.org_secret}),Ee.success("Key created"),s.reset({name:"",expires_in_hours:void 0})},onError:y=>Ee.error(y?.message??"Failed to create key")}),g=mt({mutationFn:y=>e.deleteOrgKey({id:r,keyId:y}),onSuccess:()=>{t.invalidateQueries({queryKey:["org:keys",r]}),Ee.success("Key deleted")},onError:y=>Ee.error(y?.message??"Failed to delete key")});return r?i.isLoading?l.jsx("p",{children:"Loading..."}):i.error?l.jsx("p",{className:"text-destructive",children:"Failed to load keys."}):l.jsxs(Ua,{children:[l.jsx(lr,{children:l.jsx(cr,{children:"Org API Keys"})}),l.jsxs(qa,{className:"space-y-6",children:[l.jsx(Cn,{...s,children:l.jsxs("form",{onSubmit:s.handleSubmit(y=>h.mutate(y)),className:"grid grid-cols-1 items-end gap-3 md:grid-cols-12",children:[l.jsx("div",{className:"md:col-span-6",children:l.jsx($e,{control:s.control,name:"name",render:({field:y})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Name"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"automation-bot",...y})}),l.jsx(Be,{})]})})}),l.jsx("div",{className:"md:col-span-4",children:l.jsx($e,{control:s.control,name:"expires_in_hours",render:({field:y})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Expires In (hours)"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"e.g. 720",...y})}),l.jsx(Be,{})]})})}),l.jsx("div",{className:"md:col-span-2",children:l.jsx(se,{type:"submit",className:"w-full",disabled:h.isPending,children:"Create"})})]})}),l.jsx("div",{className:"overflow-x-auto rounded-md border",children:l.jsxs(la,{children:[l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{children:"Name"}),l.jsx(ze,{children:"Scope"}),l.jsx(ze,{children:"Created"}),l.jsx(ze,{children:"Expires"}),l.jsx(ze,{className:"w-28"})]})}),l.jsxs(ua,{children:[i.data?.map(y=>l.jsxs(et,{children:[l.jsx(_e,{children:y.name??"-"}),l.jsx(_e,{children:y.scope}),l.jsx(_e,{children:new Date(y.created_at).toLocaleString()}),l.jsx(_e,{children:y.expires_at?new Date(y.expires_at).toLocaleString():"-"}),l.jsx(_e,{className:"text-right",children:l.jsx(se,{variant:"destructive",size:"sm",onClick:()=>g.mutate(y.id),children:"Delete"})})]},y.id)),i.data?.length===0&&l.jsx(et,{children:l.jsx(_e,{colSpan:5,className:"text-muted-foreground p-4",children:"No keys."})})]})]})}),l.jsx(Et,{open:!!u,onOpenChange:y=>!y&&d(null),children:l.jsxs(Ct,{children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Copy your credentials"})}),l.jsxs("div",{className:"space-y-2",children:[l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground mb-1 text-xs",children:"Org Key"}),l.jsx(Fe,{readOnly:!0,value:u?.key??"",onFocus:y=>y.currentTarget.select()})]}),l.jsxs("div",{children:[l.jsx("div",{className:"text-muted-foreground mb-1 text-xs",children:"Org Secret"}),l.jsx(Fe,{readOnly:!0,value:u?.secret??"",onFocus:y=>y.currentTarget.select()})]}),l.jsx("p",{className:"text-muted-foreground text-xs",children:"This secret is shown once. Store it securely."})]}),l.jsx(Mt,{children:l.jsx(se,{onClick:()=>d(null),children:"Done"})})]})})]})]}):l.jsx("p",{className:"text-muted-foreground",children:"Pick an organization."})},v7=Oa({user_id:q_("Invalid UUID"),role:gi(["owner","admin","member"])}),x7=()=>{const e=Rd(),t=da(),r=La.get(),[i,s]=p.useState(null),u=rn({enabled:!!r,queryKey:["org:members",r],queryFn:()=>Pe(()=>e.listMembers({id:r}))}),d=p.useMemo(()=>(u.data??[]).filter(w=>w.role==="owner").length,[u.data]),h=_n({resolver:En(v7),defaultValues:{user_id:"",role:"member"}}),g=mt({mutationFn:w=>e.addOrUpdateMember({id:r,body:w}),onSuccess:()=>{Ee.success("Member added/updated"),t.invalidateQueries({queryKey:["org:members",r]}),h.reset({user_id:"",role:"member"})},onError:w=>Ee.error(w?.message??"Failed")}),y=mt({mutationFn:w=>e.removeMember({id:r,userId:w}),onSuccess:()=>{Ee.success("Member removed"),t.invalidateQueries({queryKey:["org:members",r]})},onError:w=>Ee.error(w?.message??"Failed")}),x=mt({mutationFn:({userId:w,role:E})=>e.addOrUpdateMember({id:r,body:{user_id:w,role:E}}),onMutate:async({userId:w,role:E})=>{s(w),await t.cancelQueries({queryKey:["org:members",r]});const j=t.getQueryData(["org:members",r]);return t.setQueryData(["org:members",r],(S=[])=>S.map(N=>N.user_id===w?{...N,role:E}:N)),{prev:j}},onError:(w,E,j)=>{j?.prev&&t.setQueryData(["org:members",r],j.prev),Ee.error(w?.message??"Failed to update role")},onSuccess:()=>{Ee.success("Role updated")},onSettled:()=>{s(null),t.invalidateQueries({queryKey:["org:members",r]})}}),v=w=>!(w.role==="owner"&&d<=1);return r?u.isLoading?l.jsx("p",{children:"Loading..."}):u.error?l.jsx("p",{className:"text-destructive",children:"Failed to load members."}):l.jsxs(Ua,{children:[l.jsx(lr,{children:l.jsx(cr,{children:"Members"})}),l.jsxs(qa,{className:"space-y-6",children:[l.jsx(Cn,{...h,children:l.jsxs("form",{className:"grid grid-cols-1 items-end gap-3 md:grid-cols-12",onSubmit:h.handleSubmit(w=>g.mutate(w)),children:[l.jsx("div",{className:"md:col-span-6",children:l.jsx($e,{control:h.control,name:"user_id",render:({field:w})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"User ID"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"UUID",...w})}),l.jsx(Be,{})]})})}),l.jsx("div",{className:"md:col-span-4",children:l.jsx($e,{control:h.control,name:"role",render:({field:w})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Role"}),l.jsxs(dn,{onValueChange:w.onChange,value:w.value,children:[l.jsx(hn,{children:l.jsx(fn,{placeholder:"Select role"})}),l.jsxs(mn,{children:[l.jsx(ut,{value:"member",children:"member"}),l.jsx(ut,{value:"admin",children:"admin"}),l.jsx(ut,{value:"owner",children:"owner"})]})]}),l.jsx(Be,{})]})})}),l.jsx("div",{className:"md:col-span-2",children:l.jsx(se,{type:"submit",className:"w-full",disabled:g.isPending,children:"Save"})})]})}),l.jsx("div",{className:"overflow-x-auto rounded-md border",children:l.jsxs(la,{children:[l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{children:"Id"}),l.jsx(ze,{children:"User"}),l.jsx(ze,{children:"Role"}),l.jsx(ze,{className:"w-28"})]})}),l.jsxs(ua,{children:[u.data?.map(w=>{const E=i===w.user_id;return l.jsxs(et,{className:"align-middle",children:[l.jsx(_e,{className:"font-mono text-xs",children:w.user_id}),l.jsx(_e,{children:w.email}),l.jsx(_e,{className:"capitalize",children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(dn,{value:w.role,onValueChange:j=>{if(w.role!==j){if(w.role==="owner"&&j!=="owner"&&!v(w)){Ee.error("You cannot demote the last owner.");return}x.mutate({userId:w.user_id,role:j})}},disabled:E,children:[l.jsx(hn,{className:"h-8 w-[140px]",children:l.jsx(fn,{})}),l.jsxs(mn,{children:[l.jsx(ut,{value:"member",children:"member"}),l.jsx(ut,{value:"admin",children:"admin"}),l.jsx(ut,{value:"owner",children:"owner"})]})]}),E&&l.jsx(ps,{className:"h-4 w-4 animate-spin"})]})}),l.jsx(_e,{className:"text-right",children:l.jsx(se,{variant:"destructive",size:"sm",onClick:()=>y.mutate(w.user_id),disabled:w.role==="owner"&&d<=1,title:w.role==="owner"&&d<=1?"Cannot remove the last owner":"",children:"Remove"})})]},w.user_id)}),u.data?.length===0&&l.jsx(et,{children:l.jsx(_e,{colSpan:3,className:"text-muted-foreground p-4",children:"No members."})})]})]})})]})]}):l.jsx("p",{className:"text-muted-foreground",children:"Pick an organization."})},b7=Oa({name:Zt().min(1,"Required"),domain:Zt().optional()}),w7=()=>{const e=Rd(),t=da(),r=La.get(),i=rn({enabled:!!r,queryKey:["org",r],queryFn:()=>Pe(()=>e.getOrg({id:r}))}),s=_n({resolver:En(b7),defaultValues:{name:"",domain:""}});p.useEffect(()=>{i.data&&s.reset({name:i.data.name??"",domain:i.data.domain??""})},[i.data]);const u=mt({mutationFn:g=>e.updateOrg({id:r,body:g}),onSuccess:()=>{t.invalidateQueries({queryKey:["org",r]}),Ee.success("Organization updated")},onError:g=>Ee.error(g?.message??"Update failed")}),d=mt({mutationFn:()=>e.deleteOrg({id:r}),onSuccess:()=>{Ee.success("Organization deleted"),La.set(""),t.invalidateQueries({queryKey:["orgs:mine"]})},onError:g=>Ee.error(g?.message??"Delete failed")});if(!r)return l.jsx("p",{className:"text-muted-foreground",children:"Pick an organization."});if(i.isLoading)return l.jsx("p",{children:"Loading..."});if(i.error)return l.jsx("p",{className:"text-destructive",children:"Failed to load."});const h=g=>{const y={};g.name!==i.data?.name&&(y.name=g.name);const x=g.domain?.trim()||void 0;(x??null)!==(i.data?.domain??null)&&(y.domain=x),Object.keys(y).length!==0&&u.mutate(y)};return l.jsxs(Ua,{children:[l.jsx(lr,{children:l.jsx(cr,{children:"Organization Settings"})}),l.jsx(qa,{className:"space-y-6",children:l.jsx(Cn,{...s,children:l.jsxs("form",{className:"space-y-4",onSubmit:s.handleSubmit(h),children:[l.jsx($e,{control:s.control,name:"name",render:({field:g})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Name"}),l.jsx(Xe,{children:l.jsx(Fe,{...g})}),l.jsx(Be,{})]})}),l.jsx($e,{control:s.control,name:"domain",render:({field:g})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Domain (optional)"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"acme.com",...g})}),l.jsx(Be,{})]})}),l.jsxs("div",{className:"flex gap-2",children:[l.jsx(se,{type:"submit",disabled:u.isPending,children:"Save"}),l.jsx(se,{type:"button",variant:"destructive",onClick:()=>d.mutate(),disabled:d.isPending,children:"Delete Org"})]})]})})})]})},Tl=hT();function S7(){const e=wn.getAccessToken(),t=La.get();return{...e?{Authorization:`Bearer ${e}`}:{},...t?{"X-Org-ID":t}:{}}}async function P0(e,t={}){return fetch(e,{...t,headers:{...t.headers,...S7()},credentials:"include"})}const is={listSshKeys:()=>Pe(async()=>await Tl.listPublicSshKeys()),createSshKey:e=>Pe(async()=>await Tl.createSSHKey({body:e})),getSshKeyById:e=>Pe(async()=>await Tl.getSSHKey({id:e})),revealSshKeyById:e=>Pe(async()=>await Tl.getSSHKey({id:e,reveal:!0})),deleteSshKey:e=>Pe(async()=>{await Tl.deleteSSHKey({id:e})}),downloadJson:(e,t)=>Pe(async()=>{const r=new URL(`/api/v1/ssh/${e}/download`,window.location.origin);r.searchParams.set("part",t),r.searchParams.set("mode","json");const i=await P0(r.toString());if(!i.ok)throw new Error(`Download failed: ${i.statusText}`);return await i.json()}),downloadBlob:(e,t)=>Pe(async()=>{const r=new URL(`/api/v1/ssh/${e}/download`,window.location.origin);r.searchParams.set("part",t);const i=await P0(r.toString());if(!i.ok)throw new Error(`Download failed: ${i.statusText}`);const s=i.headers.get("Content-Disposition")||"",d=/filename="([^"]+)"/i.exec(s)?.[1]??"ssh-key-download",h=await i.blob();return{filename:d,blob:h}})},Yu=43200,K0=1440,I0=Symbol.for("constructDateFrom");function Lg(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&I0 in e?e[I0](t):e instanceof Date?new e.constructor(t):new Date(t)}function yi(e,t){return Lg(e,e)}let _7={};function E7(){return _7}function L0(e){const t=yi(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function Ug(e,...t){const r=Lg.bind(null,e||t.find(i=>typeof i=="object"));return t.map(r)}function td(e,t){const r=+yi(e)-+yi(t);return r<0?-1:r>0?1:r}function C7(e){return Lg(e,Date.now())}function j7(e,t,r){const[i,s]=Ug(r?.in,e,t),u=i.getFullYear()-s.getFullYear(),d=i.getMonth()-s.getMonth();return u*12+d}function R7(e){return t=>{const i=(e?Math[e]:Math.trunc)(t);return i===0?0:i}}function O7(e,t){return+yi(e)-+yi(t)}function N7(e,t){const r=yi(e);return r.setHours(23,59,59,999),r}function A7(e,t){const r=yi(e),i=r.getMonth();return r.setFullYear(r.getFullYear(),i+1,0),r.setHours(23,59,59,999),r}function T7(e,t){const r=yi(e);return+N7(r)==+A7(r)}function D7(e,t,r){const[i,s,u]=Ug(r?.in,e,e,t),d=td(s,u),h=Math.abs(j7(s,u));if(h<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-d*h);let g=td(s,u)===-d;T7(i)&&h===1&&td(i,u)===1&&(g=!1);const y=d*(h-+g);return y===0?0:y}function M7(e,t,r){const i=O7(e,t)/1e3;return R7(r?.roundingMethod)(i)}const z7={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},k7=(e,t,r)=>{let i;const s=z7[e];return typeof s=="string"?i=s:t===1?i=s.one:i=s.other.replace("{{count}}",t.toString()),r?.addSuffix?r.comparison&&r.comparison>0?"in "+i:i+" ago":i};function Zm(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const P7={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},K7={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},I7={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},L7={date:Zm({formats:P7,defaultWidth:"full"}),time:Zm({formats:K7,defaultWidth:"full"}),dateTime:Zm({formats:I7,defaultWidth:"full"})},U7={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},q7=(e,t,r,i)=>U7[e];function Dl(e){return(t,r)=>{const i=r?.context?String(r.context):"standalone";let s;if(i==="formatting"&&e.formattingValues){const d=e.defaultFormattingWidth||e.defaultWidth,h=r?.width?String(r.width):d;s=e.formattingValues[h]||e.formattingValues[d]}else{const d=e.defaultWidth,h=r?.width?String(r.width):e.defaultWidth;s=e.values[h]||e.values[d]}const u=e.argumentCallback?e.argumentCallback(t):t;return s[u]}}const F7={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},$7={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},V7={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},H7={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},B7={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},G7={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},X7=(e,t)=>{const r=Number(e),i=r%100;if(i>20||i<10)switch(i%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},Z7={ordinalNumber:X7,era:Dl({values:F7,defaultWidth:"wide"}),quarter:Dl({values:$7,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Dl({values:V7,defaultWidth:"wide"}),day:Dl({values:H7,defaultWidth:"wide"}),dayPeriod:Dl({values:B7,defaultWidth:"wide",formattingValues:G7,defaultFormattingWidth:"wide"})};function Ml(e){return(t,r={})=>{const i=r.width,s=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],u=t.match(s);if(!u)return null;const d=u[0],h=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth],g=Array.isArray(h)?Q7(h,v=>v.test(d)):Y7(h,v=>v.test(d));let y;y=e.valueCallback?e.valueCallback(g):g,y=r.valueCallback?r.valueCallback(y):y;const x=t.slice(d.length);return{value:y,rest:x}}}function Y7(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function Q7(e,t){for(let r=0;r{const i=t.match(e.matchPattern);if(!i)return null;const s=i[0],u=t.match(e.parsePattern);if(!u)return null;let d=e.valueCallback?e.valueCallback(u[0]):u[0];d=r.valueCallback?r.valueCallback(d):d;const h=t.slice(s.length);return{value:d,rest:h}}}const W7=/^(\d+)(th|st|nd|rd)?/i,e9=/\d+/i,t9={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},n9={any:[/^b/i,/^(a|c)/i]},a9={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},r9={any:[/1/i,/2/i,/3/i,/4/i]},i9={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},o9={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},s9={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},l9={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},c9={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},u9={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},d9={ordinalNumber:J7({matchPattern:W7,parsePattern:e9,valueCallback:e=>parseInt(e,10)}),era:Ml({matchPatterns:t9,defaultMatchWidth:"wide",parsePatterns:n9,defaultParseWidth:"any"}),quarter:Ml({matchPatterns:a9,defaultMatchWidth:"wide",parsePatterns:r9,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ml({matchPatterns:i9,defaultMatchWidth:"wide",parsePatterns:o9,defaultParseWidth:"any"}),day:Ml({matchPatterns:s9,defaultMatchWidth:"wide",parsePatterns:l9,defaultParseWidth:"any"}),dayPeriod:Ml({matchPatterns:c9,defaultMatchWidth:"any",parsePatterns:u9,defaultParseWidth:"any"})},f9={code:"en-US",formatDistance:k7,formatLong:L7,formatRelative:q7,localize:Z7,match:d9,options:{weekStartsOn:0,firstWeekContainsDate:1}};function h9(e,t,r){const i=E7(),s=r?.locale??i.locale??f9,u=2520,d=td(e,t);if(isNaN(d))throw new RangeError("Invalid time value");const h=Object.assign({},r,{addSuffix:r?.addSuffix,comparison:d}),[g,y]=Ug(r?.in,...d>0?[t,e]:[e,t]),x=M7(y,g),v=(L0(y)-L0(g))/1e3,w=Math.round((x-v)/60);let E;if(w<2)return r?.includeSeconds?x<5?s.formatDistance("lessThanXSeconds",5,h):x<10?s.formatDistance("lessThanXSeconds",10,h):x<20?s.formatDistance("lessThanXSeconds",20,h):x<40?s.formatDistance("halfAMinute",0,h):x<60?s.formatDistance("lessThanXMinutes",1,h):s.formatDistance("xMinutes",1,h):w===0?s.formatDistance("lessThanXMinutes",1,h):s.formatDistance("xMinutes",w,h);if(w<45)return s.formatDistance("xMinutes",w,h);if(w<90)return s.formatDistance("aboutXHours",1,h);if(we.role!=="bastion"||e.public_ip_address&&e.public_ip_address.trim()!=="",{message:"Public IP required for bastion",path:["public_ip_address"]}),p9=_C.partial();function g9({status:e}){const t=e==="ready"?"default":e==="provisioning"?"secondary":e==="failed"?"destructive":"outline";return l.jsx(Ia,{variant:t,className:"capitalize",children:e})}const y9=()=>{const[e,t]=p.useState(""),[r,i]=p.useState(!1),[s,u]=p.useState(!1),[d,h]=p.useState(null),[g,y]=p.useState(""),[x,v]=p.useState(""),[w,E]=p.useState(null),j=da(),S=rn({queryKey:["servers"],queryFn:()=>Ll.listServers()}),N=rn({queryKey:["ssh_keys"],queryFn:()=>is.listSshKeys()}),D=p.useMemo(()=>{const R=new Map;for(const P of N.data??[]){const I=P.name?P.name:"Unnamed key",ee=P.fingerprint?Gi(P.fingerprint,8):"";R.set(P.id,ee?`${I} — ${ee}`:I)}return R},[N.data]),A=_n({resolver:En(_C),defaultValues:{hostname:"",private_ip_address:"",public_ip_address:"",role:"worker",ssh_key_id:"",ssh_user:"",status:"pending"},mode:"onChange"}),O=A.watch("role")==="bastion",C=A.watch("public_ip_address")?.trim()??"",T=O&&C==="",U=mt({mutationFn:R=>Ll.createServer(R),onSuccess:async()=>{await j.invalidateQueries({queryKey:["servers"]}),A.reset(),i(!1),Ee.success("Server created successfully")},onError:R=>{Ee.error(R?.message??"Failed to create server")}}),L=_n({resolver:En(p9),defaultValues:{},mode:"onChange"}),V=L.watch("role")==="bastion",fe=L.watch("public_ip_address")?.trim()??"",ge=V&&fe==="",pe=mt({mutationFn:({id:R,values:P})=>Ll.updateServer(R,P),onSuccess:async()=>{await j.invalidateQueries({queryKey:["servers"]}),u(!1),E(null),Ee.success("Server updated successfully")},onError:R=>{Ee.error(R?.message??"Failed to update server")}}),ae=mt({mutationFn:R=>Ll.deleteServer(R),onSuccess:async()=>{await j.invalidateQueries({queryKey:["servers"]}),h(null),Ee.success("Server deleted successfully")},onError:R=>{Ee.error(R?.message??"Failed to delete server")}}),le=p.useMemo(()=>{const R=S.data??[],P=e.trim().toLowerCase(),I=P?R.filter(Re=>Re.hostname?.toLowerCase().includes(P)||Re.public_ip_address?.toLowerCase().includes(P)||Re.private_ip_address?.toLowerCase().includes(P)||Re.role?.toLowerCase().includes(P)||Re.ssh_user?.toLowerCase().includes(P)):R,ee=x?I.filter(Re=>Re.role===x):I;return g?ee.filter(Re=>Re.status===g):ee},[e,x,g,S.data]),he=R=>{U.mutate(R)},be=R=>{E(R.id),L.reset({hostname:R.hostname??"",public_ip_address:R.public_ip_address??"",private_ip_address:R.private_ip_address??"",role:R.role??"worker",ssh_key_id:R.ssh_key_id??"",ssh_user:R.ssh_user??"",status:R.status??"pending"}),u(!0)};return N.data?.length===0?l.jsx("div",{className:"p-6",children:"Please create an SSH key for your organization first."}):S.isLoading?l.jsx("div",{className:"p-6",children:"Loading servers…"}):S.error?l.jsx("div",{className:"p-6 text-red-500",children:"Error loading servers."}):l.jsxs(Gd,{children:[l.jsxs("div",{className:"space-y-4 p-6",children:[l.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[l.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Servers"}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx(zr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),l.jsx(Fe,{value:e,onChange:R=>t(R.target.value),placeholder:"Search hostname, Public IP, Private IP, role, user…",className:"w-64 pl-8"})]}),l.jsxs(dn,{value:x||"all",onValueChange:R=>v(R==="all"?"":R),children:[l.jsx(hn,{className:"w-36",children:l.jsx(fn,{placeholder:"Role (all)"})}),l.jsxs(mn,{children:[l.jsx(ut,{value:"all",children:"All roles"}),SC.map(R=>l.jsx(ut,{value:R,children:R},R))]})]}),l.jsxs(dn,{value:g||"all",onValueChange:R=>y(R==="all"?"":R),children:[l.jsx(hn,{className:"w-40",children:l.jsx(fn,{placeholder:"Status (all)"})}),l.jsxs(mn,{children:[l.jsx(ut,{value:"all",children:"All statuses"})," ",nd.map(R=>l.jsx(ut,{value:R,children:R},R))]})]}),l.jsxs(Et,{open:r,onOpenChange:i,children:[l.jsx(or,{asChild:!0,children:l.jsxs(se,{onClick:()=>i(!0),children:[l.jsx(ro,{className:"mr-2 h-4 w-4"}),"Create Server"]})}),l.jsxs(Ct,{className:"sm:max-w-lg",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Create server"})}),l.jsx(Cn,{...A,children:l.jsxs("form",{className:"space-y-4",onSubmit:A.handleSubmit(he),children:[l.jsx($e,{control:A.control,name:"hostname",render:({field:R})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Hostname"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"worker-01",...R})}),l.jsx(Be,{})]})}),l.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[l.jsx($e,{control:A.control,name:"public_ip_address",render:({field:R})=>l.jsxs(Ve,{children:[l.jsxs(He,{className:"flex items-center justify-between",children:[l.jsx("span",{children:"Public IP Address"}),l.jsx("span",{className:de("rounded-full px-2 py-0.5 text-xs",O?"bg-amber-100 text-amber-900":"bg-muted text-muted-foreground"),children:O?"Required for bastion":"Optional"})]}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:O?"Required for bastion (e.g. 34.12.56.78)":"34.12.56.78","aria-required":O,"aria-invalid":T||!!A.formState.errors.public_ip_address,required:O,...R,className:de(T&&"border-destructive focus-visible:ring-destructive")})}),O&&l.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 p-2 text-xs text-amber-900",children:["Bastion nodes must have a"," ",l.jsx("span",{className:"font-medium",children:"Public IP"}),"."]}),l.jsx(Be,{})]})}),l.jsx($e,{control:A.control,name:"private_ip_address",render:({field:R})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Private IP Address"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"192.168.10.1",...R})}),l.jsx(Be,{})]})})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[l.jsx($e,{control:A.control,name:"role",render:({field:R})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Role"}),l.jsxs(dn,{onValueChange:P=>A.setValue("role",P,{shouldDirty:!0,shouldValidate:!0}),value:R.value,children:[l.jsx(Xe,{children:l.jsx(hn,{children:l.jsx(fn,{placeholder:"Select role"})})}),l.jsxs(mn,{children:[l.jsx(ut,{value:"master",children:"master"}),l.jsx(ut,{value:"worker",children:"worker"}),l.jsx(ut,{value:"bastion",children:"bastion — requires Public IP"})]})]}),l.jsx(Be,{})]})}),l.jsx($e,{control:A.control,name:"ssh_user",render:({field:R})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"SSH user"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"ubuntu",...R})}),l.jsx(Be,{})]})})]}),l.jsx($e,{control:A.control,name:"ssh_key_id",render:({field:R})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"SSH key"}),l.jsxs(dn,{onValueChange:R.onChange,value:R.value,children:[l.jsx(Xe,{children:l.jsx(hn,{children:l.jsx(fn,{placeholder:N.data?.length?"Select SSH key":"No SSH keys found"})})}),l.jsx(mn,{children:N.data.map(P=>l.jsxs(ut,{value:P.id,children:[P.name?P.name:"Unnamed key"," —"," ",Gi(P.fingerprint,8)]},P.id))})]}),l.jsx(Be,{})]})}),l.jsx($e,{control:A.control,name:"status",render:({field:R})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Initial status"}),l.jsxs(dn,{onValueChange:R.onChange,value:R.value,children:[l.jsx(Xe,{children:l.jsx(hn,{children:l.jsx(fn,{placeholder:"pending"})})}),l.jsx(mn,{children:nd.map(P=>l.jsx(ut,{value:P,children:P},P))})]}),l.jsx(Be,{})]})}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),l.jsx(se,{type:"submit",disabled:U.isPending||A.formState.isSubmitting||!A.formState.isValid,children:U.isPending?"Creating…":"Create"})]})]})})]})]})]})]}),l.jsx("div",{className:"bg-background overflow-hidden rounded-2xl border shadow-sm",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(la,{children:[l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{children:"Hostname"}),l.jsx(ze,{children:"IP address"}),l.jsx(ze,{children:"Role"}),l.jsx(ze,{children:"SSH user"}),l.jsx(ze,{children:"SSH key"}),l.jsx(ze,{children:"Status"}),l.jsx(ze,{children:"Created"}),l.jsx(ze,{className:"w-[220px] text-right",children:"Actions"})]})}),l.jsx(ua,{children:le.length===0?l.jsx(et,{children:l.jsx(_e,{colSpan:8,className:"text-muted-foreground py-10 text-center text-sm",children:"No servers found."})}):le.map(R=>l.jsxs(et,{children:[l.jsx(_e,{className:"font-medium",children:R.hostname}),l.jsx(_e,{children:l.jsxs("div",{className:"flex flex-col",children:[l.jsx("span",{className:de("tabular-nums",!R.public_ip_address&&"text-muted-foreground"),children:R.public_ip_address||"—"}),l.jsx("span",{className:"text-muted-foreground tabular-nums",children:R.private_ip_address})]})}),l.jsx(_e,{className:"capitalize",children:l.jsx("span",{className:de(R.role==="bastion"&&"rounded bg-amber-50 px-2 py-0.5 dark:bg-amber-900"),children:R.role})}),l.jsx(_e,{className:"tabular-nums",children:R.ssh_user}),l.jsx(_e,{className:"truncate",children:D.get(R.ssh_key_id)??"—"}),l.jsx(_e,{children:l.jsx(g9,{status:R.status??"pending"})}),l.jsx(_e,{title:R.created_at,children:R.created_at?`${m9(new Date(R.created_at),{addSuffix:!0})}`:"—"}),l.jsx(_e,{className:"text-right",children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsx(se,{variant:"outline",size:"sm",onClick:()=>be(R),children:"Edit"}),l.jsx(se,{variant:"destructive",size:"sm",onClick:()=>h(R.id),disabled:ae.isPending&&d===R.id,children:ae.isPending&&d===R.id?"Deleting…":"Delete"})]})})]},R.id))})]})})})]}),l.jsx(Et,{open:s,onOpenChange:u,children:l.jsxs(Ct,{className:"sm:max-w-lg",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Edit server"})}),l.jsx(Cn,{...L,children:l.jsxs("form",{className:"space-y-4",onSubmit:L.handleSubmit(R=>{w&&pe.mutate({id:w,values:R})}),children:[l.jsx($e,{control:L.control,name:"hostname",render:({field:R})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Hostname"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"worker-01",...R})}),l.jsx(Be,{})]})}),l.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[l.jsx($e,{control:L.control,name:"public_ip_address",render:({field:R})=>l.jsxs(Ve,{children:[l.jsxs(He,{className:"flex items-center justify-between",children:[l.jsx("span",{children:"Public IP Address"}),l.jsx("span",{className:de("rounded-full px-2 py-0.5 text-xs",V?"bg-amber-100 text-amber-900":"bg-muted text-muted-foreground"),children:V?"Required for bastion":"Optional"})]}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:V?"Required for bastion (e.g. 34.12.56.78)":"34.12.56.78","aria-required":V,"aria-invalid":ge||!!L.formState.errors.public_ip_address,required:V,...R,className:de(ge&&"border-destructive focus-visible:ring-destructive")})}),V&&l.jsxs("div",{className:"rounded-md border border-amber-200 bg-amber-50 p-2 text-xs text-amber-900",children:["Bastion nodes must have a ",l.jsx("span",{className:"font-medium",children:"Public IP"}),"."]}),l.jsx(Be,{})]})}),l.jsx($e,{control:L.control,name:"private_ip_address",render:({field:R})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Private IP Address"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"192.168.10.1",...R})}),l.jsx(Be,{})]})})]}),l.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[l.jsx($e,{control:L.control,name:"role",render:({field:R})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Role"}),l.jsxs(dn,{onValueChange:P=>L.setValue("role",P,{shouldDirty:!0,shouldValidate:!0}),value:R.value,children:[l.jsx(Xe,{children:l.jsx(hn,{children:l.jsx(fn,{placeholder:"Select role"})})}),l.jsxs(mn,{children:[l.jsx(ut,{value:"master",children:"master"}),l.jsx(ut,{value:"worker",children:"worker"}),l.jsx(ut,{value:"bastion",children:"bastion — requires Public IP"})]})]}),l.jsx(Be,{})]})}),l.jsx($e,{control:L.control,name:"ssh_user",render:({field:R})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"SSH user"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"ubuntu",...R})}),l.jsx(Be,{})]})})]}),l.jsx($e,{control:L.control,name:"ssh_key_id",render:({field:R})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"SSH key"}),l.jsxs(dn,{onValueChange:R.onChange,value:R.value,children:[l.jsx(Xe,{children:l.jsx(hn,{children:l.jsx(fn,{placeholder:"Select SSH key"})})}),l.jsx(mn,{children:N.data.map(P=>l.jsxs(ut,{value:P.id,children:[P.name?P.name:"Unnamed key"," — ",Gi(P.fingerprint,8)]},P.id))})]}),l.jsx(Be,{})]})}),l.jsx($e,{control:L.control,name:"status",render:({field:R})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Status"}),l.jsxs(dn,{onValueChange:R.onChange,value:R.value,children:[l.jsx(Xe,{children:l.jsx(hn,{children:l.jsx(fn,{placeholder:"pending"})})}),l.jsx(mn,{children:nd.map(P=>l.jsx(ut,{value:P,children:P},P))})]}),l.jsx(Be,{})]})}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),l.jsx(se,{type:"submit",disabled:pe.isPending,children:pe.isPending?"Saving…":"Save changes"})]})]})})]})}),l.jsx(Et,{open:!!d,onOpenChange:R=>!R&&h(null),children:l.jsxs(Ct,{className:"sm:max-w-md",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Delete server"})}),l.jsx("p",{className:"text-muted-foreground text-sm",children:"This action cannot be undone. Are you sure you want to delete this server?"}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),l.jsx(se,{variant:"destructive",onClick:()=>d&&ae.mutate(d),disabled:ae.isPending,children:ae.isPending?"Deleting…":"Delete"})]})]})})]})},v9=Oa({name:Zt().trim().min(1,"Name is required").max(100,"Max 100 characters"),comment:Zt().trim().min(1,"Comment is required").max(100,"Max 100 characters"),bits:gi(["2048","3072","4096"]).optional(),type:gi(["rsa","ed25519"]).optional()});function x9(e,t){const r=URL.createObjectURL(e),i=document.createElement("a");i.href=r,i.download=t,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r)}function Ym(e,t="Copied"){navigator.clipboard.writeText(e).then(()=>Ee.success(t)).catch(()=>Ee.error("Copy failed"))}function b9(e){return e?.split(/\s+/)?.[0]??"ssh-key"}const w9=()=>{const[e,t]=p.useState(""),[r,i]=p.useState(!1),[s,u]=p.useState(null),[d,h]=p.useState(null),g=da(),y=rn({queryKey:["ssh"],queryFn:()=>is.listSshKeys()}),x=_n({resolver:En(v9),defaultValues:{name:"",comment:"",type:"rsa",bits:"4096"}}),v=mt({mutationFn:async S=>{const N={name:S.name,comment:S.comment,bits:S.type==="rsa"&&S.bits?Number(S.bits):void 0,type:S.type};return await is.createSshKey(N)},onSuccess:()=>{g.invalidateQueries({queryKey:["ssh"]}),i(!1),x.reset({name:"",comment:"",type:"rsa",bits:"4096"}),Ee.success("SSH Key created")},onError:S=>Ee.error(S?.message??"SSH Key creation failed")}),w=mt({mutationFn:S=>is.revealSshKeyById(S),onSuccess:S=>u(S),onError:S=>Ee.error(S?.message??"Failed to reveal key")}),E=mt({mutationFn:S=>is.deleteSshKey(S),onSuccess:async()=>{await g.invalidateQueries({queryKey:["ssh"]}),h(null),Ee.success("SSH Key deleted")},onError:S=>Ee.error(S?.message??"Delete failed")}),j=p.useMemo(()=>{const S=e.trim().toLowerCase();return S?(y.data??[]).filter(N=>N.name?.toLowerCase().includes(S)||N.fingerprint?.toLowerCase().includes(S)||N.public_key?.toLowerCase().includes(S)):y.data??[]},[e,y.data]);return y.isLoading?l.jsx("div",{className:"p-6",children:"Loading SSH Keys…"}):y.error?l.jsx("div",{className:"p-6 text-red-500",children:"Error Loading SSH Keys"}):l.jsx(Gd,{children:l.jsxs("div",{className:"space-y-4",children:[l.jsxs("div",{className:"flex items-center justify-between gap-3",children:[l.jsx("h1",{className:"text-2xl font-bold",children:"SSH Keys"}),l.jsx("div",{className:"w-full max-w-sm",children:l.jsx(Fe,{value:e,onChange:S=>t(S.target.value),placeholder:"Search by name, fingerprint or key"})}),l.jsxs(Et,{open:r,onOpenChange:i,children:[l.jsx(or,{asChild:!0,children:l.jsxs(se,{onClick:()=>i(!0),children:[l.jsx(ro,{className:"mr-2 h-4 w-4"}),"Create New Keypair"]})}),l.jsxs(Ct,{className:"sm:max-w-lg",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Create SSH Keypair"})}),l.jsx(Cn,{...x,children:l.jsxs("form",{onSubmit:x.handleSubmit(S=>v.mutate(S)),className:"space-y-4",children:[l.jsx($e,{control:x.control,name:"name",render:({field:S})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Name"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"e.g., CI deploy key",...S})}),l.jsx(Be,{})]})}),l.jsx($e,{control:x.control,name:"comment",render:({field:S})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Comment"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"e.g., deploy@autoglue",...S})}),l.jsx(Be,{})]})}),l.jsx($e,{control:x.control,name:"type",render:({field:S})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Type"}),l.jsx(Xe,{children:l.jsxs(dn,{value:S.value,onValueChange:N=>{S.onChange(N),N==="ed25519"?x.setValue("bits",void 0):x.setValue("bits","4096")},children:[l.jsx(hn,{className:"w-[180px]",children:l.jsx(fn,{placeholder:"Select a ssh key type"})}),l.jsxs(mn,{children:[l.jsx(ut,{value:"rsa",children:"RSA"}),l.jsx(ut,{value:"ed25519",children:"ED25519"})]})]})}),l.jsx(Be,{})]})}),l.jsx($e,{control:x.control,name:"bits",render:({field:S})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Key size"}),l.jsx(Xe,{children:l.jsxs(dn,{value:S.value,disabled:x.watch("type")==="ed25519",onValueChange:S.onChange,children:[l.jsx(hn,{className:"w-[180px]",children:l.jsx(fn,{placeholder:"RSA only"})}),l.jsxs(mn,{children:[l.jsx(ut,{value:"2048",children:"2048"}),l.jsx(ut,{value:"3072",children:"3072"}),l.jsx(ut,{value:"4096",children:"4096"})]})]})}),l.jsx(Be,{})]})}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>i(!1),disabled:v.isPending,children:"Cancel"}),l.jsx(se,{type:"submit",disabled:v.isPending,children:v.isPending?l.jsxs(l.Fragment,{children:[l.jsx(ps,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating…"]}):"Create"})]})]})})]})]})]}),l.jsx("div",{className:"bg-background overflow-hidden rounded-2xl border shadow-sm",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(la,{children:[l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{children:"Name"}),l.jsx(ze,{children:"Public Key"}),l.jsx(ze,{children:"Fingerprint"}),l.jsx(ze,{children:"Created"}),l.jsx(ze,{className:"w-[160px] text-right",children:"Actions"})]})}),l.jsxs(ua,{children:[j.map(S=>{const N=b9(S.public_key);return Gi(S.public_key,18),l.jsxs(et,{children:[l.jsx(_e,{className:"font-medium",children:S.name||"—"}),l.jsx(_e,{children:l.jsxs(o_,{children:[l.jsx(s_,{asChild:!0,children:l.jsx(Ia,{variant:"secondary",className:"whitespace-nowrap",children:N})}),l.jsx(l_,{className:"max-w-[70vw]",children:l.jsx("div",{className:"max-w-full",children:l.jsx("p",{className:"font-mono text-xs break-all",children:S.public_key})})})]})}),l.jsx(_e,{className:"font-mono text-xs",children:S.fingerprint}),l.jsx(_e,{children:S.created_at?new Date(S.created_at).toLocaleString(void 0,{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"}):"—"}),l.jsxs(_e,{className:"space-x-2 text-right",children:[l.jsx(se,{size:"sm",variant:"outline",onClick:()=>Ym(S.public_key??"","Public key copied"),children:"Copy Pub"}),l.jsx(se,{size:"sm",variant:"outline",onClick:()=>Ym(S.fingerprint??"","Fingerprint copied"),children:"Copy FP"}),l.jsxs(se,{size:"sm",variant:"outline",onClick:()=>w.mutate(S.id),children:[l.jsx(s2,{className:"mr-1 h-4 w-4"}),"Reveal"]}),l.jsxs(se,{size:"sm",variant:"outline",onClick:async()=>{try{const{filename:D,blob:A}=await is.downloadBlob(S.id,"both");x9(A,D)}catch(D){Ee.error(D?.message??"Download failed")}},children:[l.jsx(a2,{className:"mr-1 h-4 w-4"}),"Download"]}),l.jsxs(se,{size:"sm",variant:"destructive",onClick:()=>h(S.id),children:[l.jsx(oS,{className:"mr-1 h-4 w-4"}),"Delete"]})]})]},S.id)}),j.length===0&&l.jsx(et,{children:l.jsx(_e,{colSpan:5,className:"text-muted-foreground py-10 text-center",children:"No SSH Keys"})})]})]})})}),l.jsx(Et,{open:!!s,onOpenChange:S=>!S&&u(null),children:l.jsxs(Ct,{className:"sm:max-w-2xl",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Private Key (read-only)"})}),l.jsx("div",{className:"space-y-3",children:l.jsxs("div",{className:"text-sm",children:[l.jsx("div",{className:"font-medium",children:s?.name??"SSH key"}),l.jsx("div",{className:"text-muted-foreground font-mono text-xs",children:s?.fingerprint}),l.jsx(_E,{readOnly:!0,className:"h-64 w-full rounded-md border p-3 font-mono text-xs",value:s?.private_key??""}),l.jsx("div",{className:"flex justify-end",children:l.jsx(se,{onClick:()=>s?.private_key&&Ym(s.private_key,"Private key copied"),children:"Copy"})})]})})]})}),l.jsx(Et,{open:!!d,onOpenChange:S=>!S&&h(null),children:l.jsxs(Ct,{className:"sm:max-w-md",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Delete SSH Key"})}),l.jsx("p",{className:"text-muted-foreground text-sm",children:"This will permanently delete the keypair. This action cannot be undone."}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),l.jsx(se,{variant:"destructive",onClick:()=>d&&E.mutate(d),disabled:E.isPending,children:E.isPending?l.jsxs(l.Fragment,{children:[l.jsx(ps,{className:"mr-2 h-4 w-4 animate-spin"}),"Deleting…"]}):"Delete"})]})]})})]})})},zp=["NoSchedule","PreferNoSchedule","NoExecute"],EC=Oa({key:Zt().trim().min(1,"Key is required").max(120,"Max 120 chars"),value:Zt().trim().optional(),effect:gi(zp)}),S9=EC.partial();function _9({t:e}){const t=`${e.key}${e.value?`=${e.value}`:""}${e.effect?`:${e.effect}`:""}`;return l.jsxs(Ia,{variant:"secondary",className:"font-mono text-xs",children:[l.jsx(jd,{className:"mr-1 h-3 w-3"}),t]})}const E9=()=>{const[e,t]=p.useState(""),[r,i]=p.useState(!1),[s,u]=p.useState(!1),[d,h]=p.useState(null),[g,y]=p.useState(null),x=da(),v=rn({queryKey:["taints"],queryFn:()=>Ul.listTaints()}),w=_n({resolver:En(EC),defaultValues:{key:"",value:"",effect:void 0}}),E=mt({mutationFn:C=>Ul.createTaint(C),onSuccess:async()=>{await x.invalidateQueries({queryKey:["taints"]}),w.reset(),i(!1),Ee.success("Taint Created Successfully.")},onError:C=>{Ee.error(C.message??"There was an error while creating Taint")}}),j=C=>{E.mutate(C)},S=_n({resolver:En(S9),defaultValues:{}}),N=mt({mutationFn:({id:C,values:T})=>Ul.updateTaint(C,T),onSuccess:async()=>{await x.invalidateQueries({queryKey:["taints"]}),S.reset(),u(!1),Ee.success("Taint Updated Successfully.")},onError:C=>{Ee.error(C.message??"There was an error while updating Taint")}}),D=C=>{y(C.id),S.reset({key:C.key,value:C.value,effect:C.effect}),u(!0)},A=mt({mutationFn:C=>Ul.deleteTaint(C),onSuccess:async()=>{await x.invalidateQueries({queryKey:["taints"]}),h(null),Ee.success("Taint Deleted Successfully.")},onError:C=>{Ee.error(C.message??"There was an error while deleting Taint")}}),O=p.useMemo(()=>{const C=v.data??[],T=e.trim().toLowerCase();return T?C.filter(U=>U.key?.toLowerCase().includes(T)||U.value?.toLowerCase().includes(T)||U.effect?.toLowerCase().includes(T)):C},[e,v.data]);return v.isLoading?l.jsx("div",{className:"p-6",children:"Loading taints…"}):v.error?l.jsx("div",{className:"p-6 text-red-500",children:"Error loading taints."}):l.jsxs("div",{className:"space-y-4 p-6",children:[l.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[l.jsx("h1",{className:"mb-4 text-2xl font-bold",children:"Taints"}),l.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[l.jsxs("div",{className:"relative",children:[l.jsx(zr,{className:"absolute top-2.5 left-2 h-4 w-4 opacity-60"}),l.jsx(Fe,{value:e,onChange:C=>t(C.target.value),placeholder:"Search taints",className:"w-64 pl-8"})]}),l.jsxs(Et,{open:r,onOpenChange:i,children:[l.jsx(or,{asChild:!0,children:l.jsxs(se,{onClick:()=>i(!0),children:[l.jsx(ro,{className:"mr-2 h-4 w-4"})," Create Taint"]})}),l.jsxs(Ct,{className:"sm:max-w-lg",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Create taint"})}),l.jsx(Cn,{...w,children:l.jsxs("form",{className:"space-y-4",onSubmit:w.handleSubmit(j),children:[l.jsx($e,{control:w.control,name:"key",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Key"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"dedicated",...C})}),l.jsx(Be,{})]})}),l.jsx($e,{control:w.control,name:"value",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Value (optional)"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"gpu",...C})}),l.jsx(Be,{})]})}),l.jsx($e,{control:w.control,name:"effect",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Effect"}),l.jsxs(dn,{onValueChange:C.onChange,value:C.value,children:[l.jsx(Xe,{children:l.jsx(hn,{children:l.jsx(fn,{placeholder:"Select effect"})})}),l.jsx(mn,{children:zp.map(T=>l.jsx(ut,{value:T,children:T},T))})]}),l.jsx(Be,{})]})}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),l.jsx(se,{type:"submit",disabled:w.formState.isSubmitting,children:w.formState.isSubmitting?"Creating…":"Create"})]})]})})]})]})]})]}),l.jsx("div",{className:"bg-background overflow-hidden rounded-2xl border shadow-sm",children:l.jsx("div",{className:"overflow-x-auto",children:l.jsxs(la,{children:[l.jsx(ca,{children:l.jsxs(et,{children:[l.jsx(ze,{children:"Taint"}),l.jsx(ze,{className:"w-[180px] text-right",children:"Actions"})]})}),l.jsxs(ua,{children:[O.map(C=>l.jsxs(et,{children:[l.jsx(_e,{children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(_9,{t:C}),l.jsx("code",{className:"text-muted-foreground text-xs",children:Gi(C.id,6)})]})}),l.jsx(_e,{children:l.jsxs("div",{className:"flex justify-end gap-2",children:[l.jsxs(se,{variant:"outline",size:"sm",onClick:()=>D(C),children:[l.jsx(Cd,{className:"mr-2 h-4 w-4"})," Edit"]}),l.jsx(se,{variant:"destructive",size:"sm",onClick:()=>h(C.id),disabled:A.isPending&&d===C.id,children:A.isPending&&d===C.id?"Deleting…":"Delete"})]})})]},C.id)),O.length===0&&l.jsx(et,{children:l.jsxs(_e,{colSpan:3,className:"text-muted-foreground py-10 text-center",children:[l.jsx(Fp,{className:"mx-auto mb-2 h-6 w-6 opacity-60"}),"No taints match your search."]})})]})]})})}),l.jsx(Et,{open:s,onOpenChange:u,children:l.jsxs(Ct,{className:"sm:max-w-lg",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Edit taint"})}),l.jsx(Cn,{...S,children:l.jsxs("form",{className:"space-y-4",onSubmit:S.handleSubmit(C=>{g&&N.mutate({id:g,values:C})}),children:[l.jsx($e,{control:S.control,name:"key",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Key"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"dedicated",...C})}),l.jsx(Be,{})]})}),l.jsx($e,{control:S.control,name:"value",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Value (optional)"}),l.jsx(Xe,{children:l.jsx(Fe,{placeholder:"gpu",...C})}),l.jsx(Be,{})]})}),l.jsx($e,{control:S.control,name:"effect",render:({field:C})=>l.jsxs(Ve,{children:[l.jsx(He,{children:"Effect"}),l.jsxs(dn,{onValueChange:C.onChange,value:C.value,children:[l.jsx(Xe,{children:l.jsx(hn,{children:l.jsx(fn,{placeholder:"Select effect"})})}),l.jsx(mn,{children:zp.map(T=>l.jsx(ut,{value:T,children:T},T))})]}),l.jsx(Be,{})]})}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{type:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),l.jsx(se,{type:"submit",disabled:N.isPending,children:N.isPending?"Saving…":"Save changes"})]})]})})]})}),l.jsx(Et,{open:!!d,onOpenChange:C=>!C&&h(null),children:l.jsxs(Ct,{className:"sm:max-w-md",children:[l.jsx(jt,{children:l.jsx(Rt,{children:"Delete taint"})}),l.jsx("p",{className:"text-muted-foreground text-sm",children:"This action cannot be undone. Are you sure you want to delete this taint?"}),l.jsxs(Mt,{className:"gap-2",children:[l.jsx(se,{variant:"outline",onClick:()=>h(null),children:"Cancel"}),l.jsx(se,{variant:"destructive",onClick:()=>d&&A.mutate(d),disabled:A.isPending,children:A.isPending?"Deleting…":"Delete"})]})]})})]})};function C9(){return l.jsxs(LR,{children:[l.jsx(Nn,{path:"/login",element:l.jsx(N0,{})}),l.jsx(Nn,{element:l.jsx(Y3,{}),children:l.jsxs(Nn,{element:l.jsx(X3,{}),children:[l.jsx(Nn,{path:"/me",element:l.jsx(jL,{})}),l.jsx(Nn,{path:"/org/settings",element:l.jsx(w7,{})}),l.jsx(Nn,{path:"/org/members",element:l.jsx(x7,{})}),l.jsx(Nn,{path:"/org/api-keys",element:l.jsx(y7,{})}),l.jsx(Nn,{path:"/ssh",element:l.jsx(w9,{})}),l.jsx(Nn,{path:"/servers",element:l.jsx(y9,{})}),l.jsx(Nn,{path:"/taints",element:l.jsx(E9,{})}),l.jsx(Nn,{path:"/labels",element:l.jsx($I,{})}),l.jsx(Nn,{path:"/annotations",element:l.jsx(PK,{})}),l.jsx(Nn,{path:"/node-pools",element:l.jsx(p7,{})}),l.jsx(Nn,{path:"/admin/jobs",element:l.jsx(II,{})})]})}),l.jsx(Nn,{path:"*",element:l.jsx(N0,{})})]})}gN.createRoot(document.getElementById("root")).render(l.jsx(p.StrictMode,{children:l.jsx(UR,{children:l.jsx(dN,{children:l.jsx(C9,{})})})})); //# sourceMappingURL=index-DCrfJ1uu.js.map