126 lines
304 KiB
JavaScript
126 lines
304 KiB
JavaScript
import{r as f,j as d,a as vd,c as dr,u as ue,b as Oi,d as he,B as bt,e as R,f as Ni,S as Mi,p as qe,m as ro,g as ji}from"./button-kubEw0fx.js";import{g as yd,a as xd,r as bd}from"./app-DW8k92tM.js";import{u as wd}from"./base64-Bxt0tHTb.js";var $r=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(){}},fr=typeof window>"u"||"Deno"in globalThis;function Le(){}function _d(e,t){return typeof e=="function"?e(t):e}function no(e){return typeof e=="number"&&e>=0&&e!==1/0}function Ii(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Qt(e,t){return typeof e=="function"?e(t):e}function et(e,t){return typeof e=="function"?e(t):e}function Sa(e,t){const{type:r="all",exact:n,fetchStatus:s,predicate:o,queryKey:a,stale:i}=e;if(a){if(n){if(t.queryHash!==ko(a,t.options))return!1}else if(!en(t.queryKey,a))return!1}if(r!=="all"){const c=t.isActive();if(r==="active"&&!c||r==="inactive"&&c)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||s&&s!==t.state.fetchStatus||o&&!o(t))}function Ca(e,t){const{exact:r,status:n,predicate:s,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(r){if(hr(t.options.mutationKey)!==hr(o))return!1}else if(!en(t.options.mutationKey,o))return!1}return!(n&&t.state.status!==n||s&&!s(t))}function ko(e,t){return(t?.queryKeyHashFn||hr)(e)}function hr(e){return JSON.stringify(e,(t,r)=>so(r)?Object.keys(r).sort().reduce((n,s)=>(n[s]=r[s],n),{}):r)}function en(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(r=>en(e[r],t[r])):!1}function Di(e,t){if(e===t)return e;const r=Ea(e)&&Ea(t);if(r||so(e)&&so(t)){const n=r?e:Object.keys(e),s=n.length,o=r?t:Object.keys(t),a=o.length,i=r?[]:{},c=new Set(n);let l=0;for(let h=0;h<a;h++){const u=r?h:o[h];(!r&&c.has(u)||r)&&e[u]===void 0&&t[u]===void 0?(i[u]=void 0,l++):(i[u]=Di(e[u],t[u]),i[u]===e[u]&&e[u]!==void 0&&l++)}return s===a&&l===s?e:i}return t}function Qn(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(e[r]!==t[r])return!1;return!0}function Ea(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function so(e){if(!Ra(e))return!1;const t=e.constructor;if(t===void 0)return!0;const r=t.prototype;return!(!Ra(r)||!r.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function Ra(e){return Object.prototype.toString.call(e)==="[object Object]"}function Sd(e){return new Promise(t=>{setTimeout(t,e)})}function oo(e,t,r){return typeof r.structuralSharing=="function"?r.structuralSharing(e,t):r.structuralSharing!==!1?Di(e,t):t}function Cd(e,t,r=0){const n=[...e,t];return r&&n.length>r?n.slice(1):n}function Ed(e,t,r=0){const n=[t,...e];return r&&n.length>r?n.slice(0,-1):n}var Oo=Symbol();function Fi(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Oo?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Li(e,t){return typeof e=="function"?e(...t):!!e}var Rd=class extends $r{#t;#e;#r;constructor(){super(),this.#r=e=>{if(!fr&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#r=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},No=new Rd,Td=class extends $r{#t=!0;#e;#r;constructor(){super(),this.#r=e=>{if(!fr&&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.#e||this.setEventListener(this.#r)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#r=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(r=>{r(e)}))}isOnline(){return this.#t}},Yn=new Td;function ao(){let e,t;const r=new Promise((s,o)=>{e=s,t=o});r.status="pending",r.catch(()=>{});function n(s){Object.assign(r,s),delete r.resolve,delete r.reject}return r.resolve=s=>{n({status:"fulfilled",value:s}),e(s)},r.reject=s=>{n({status:"rejected",reason:s}),t(s)},r}function Pd(e){return Math.min(1e3*2**e,3e4)}function Vi(e){return(e??"online")==="online"?Yn.isOnline():!0}var $i=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function Bi(e){let t=!1,r=0,n;const s=ao(),o=()=>s.status!=="pending",a=m=>{o()||(p(new $i(m)),e.abort?.())},i=()=>{t=!0},c=()=>{t=!1},l=()=>No.isFocused()&&(e.networkMode==="always"||Yn.isOnline())&&e.canRun(),h=()=>Vi(e.networkMode)&&e.canRun(),u=m=>{o()||(n?.(),s.resolve(m))},p=m=>{o()||(n?.(),s.reject(m))},g=()=>new Promise(m=>{n=y=>{(o()||l())&&m(y)},e.onPause?.()}).then(()=>{n=void 0,o()||e.onContinue?.()}),x=()=>{if(o())return;let m;const y=r===0?e.initialPromise:void 0;try{m=y??e.fn()}catch(w){m=Promise.reject(w)}Promise.resolve(m).then(u).catch(w=>{if(o())return;const b=e.retry??(fr?0:3),C=e.retryDelay??Pd,S=typeof C=="function"?C(r,w):C,_=b===!0||typeof b=="number"&&r<b||typeof b=="function"&&b(r,w);if(t||!_){p(w);return}r++,e.onFail?.(r,w),Sd(S).then(()=>l()?void 0:g()).then(()=>{t?p(w):x()})})};return{promise:s,status:()=>s.status,cancel:a,continue:()=>(n?.(),s),cancelRetry:i,continueRetry:c,canStart:h,start:()=>(h()?x():g().then(x),s)}}var Ad=e=>setTimeout(e,0);function kd(){let e=[],t=0,r=i=>{i()},n=i=>{i()},s=Ad;const o=i=>{t?e.push(i):s(()=>{r(i)})},a=()=>{const i=e;e=[],i.length&&s(()=>{n(()=>{i.forEach(c=>{r(c)})})})};return{batch:i=>{let c;t++;try{c=i()}finally{t--,t||a()}return c},batchCalls:i=>(...c)=>{o(()=>{i(...c)})},schedule:o,setNotifyFunction:i=>{r=i},setBatchNotifyFunction:i=>{n=i},setScheduler:i=>{s=i}}}var Te=kd(),Ui=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),no(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(fr?1/0:300*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},Od=class extends Ui{#t;#e;#r;#n;#s;#a;#i;constructor(e){super(),this.#i=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#n=e.client,this.#r=this.#n.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=Nd(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#s?.promise}setOptions(e){this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#r.remove(this)}setData(e,t){const r=oo(this.state.data,e,this.options);return this.#o({data:r,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),r}setState(e,t){this.#o({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#s?.promise;return this.#s?.cancel(e),t?t.then(Le).catch(Le):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>et(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Oo||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Qt(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:!Ii(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#s?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#s?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#s&&(this.#i?this.#s.cancel({revert:!0}):this.#s.cancelRetry()),this.scheduleGc()),this.#r.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#o({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#s?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#s)return this.#s.continueRetry(),this.#s.promise}if(e&&this.setOptions(e),!this.options.queryFn){const i=this.observers.find(c=>c.options.queryFn);i&&this.setOptions(i.options)}const r=new AbortController,n=i=>{Object.defineProperty(i,"signal",{enumerable:!0,get:()=>(this.#i=!0,r.signal)})},s=()=>{const i=Fi(this.options,t),l=(()=>{const h={client:this.#n,queryKey:this.queryKey,meta:this.meta};return n(h),h})();return this.#i=!1,this.options.persister?this.options.persister(i,l,this):i(l)},a=(()=>{const i={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#n,state:this.state,fetchFn:s};return n(i),i})();this.options.behavior?.onFetch(a,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#o({type:"fetch",meta:a.fetchOptions?.meta}),this.#s=Bi({initialPromise:t?.initialPromise,fn:a.fetchFn,abort:r.abort.bind(r),onFail:(i,c)=>{this.#o({type:"failed",failureCount:i,error:c})},onPause:()=>{this.#o({type:"pause"})},onContinue:()=>{this.#o({type:"continue"})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{const i=await this.#s.start();if(i===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(i),this.#r.config.onSuccess?.(i,this),this.#r.config.onSettled?.(i,this.state.error,this),i}catch(i){if(i instanceof $i){if(i.silent)return this.#s.promise;if(i.revert){if(this.setState({...this.#e,fetchStatus:"idle"}),this.state.data===void 0)throw i;return this.state.data}}throw this.#o({type:"error",error:i}),this.#r.config.onError?.(i,this),this.#r.config.onSettled?.(this.state.data,i,this),i}finally{this.scheduleGc()}}#o(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,...zi(r.data,this.options),fetchMeta:e.meta??null};case"success":const n={...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=e.manual?n:void 0,n;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),Te.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),this.#r.notify({query:this,type:"updated",action:e})})}};function zi(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Vi(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function Nd(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,r=t!==void 0,n=r?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:r?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:r?"success":"pending",fetchStatus:"idle"}}var Md=class extends $r{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,r){const n=t.queryKey,s=t.queryHash??ko(n,t);let o=this.get(s);return o||(o=new Od({client:e,queryKey:n,queryHash:s,options:e.defaultQueryOptions(t),state:r,defaultOptions:e.getQueryDefaults(n)}),this.add(o)),o}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Te.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(r=>Sa(t,r))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(r=>Sa(e,r)):t}notify(e){Te.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Te.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Te.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},jd=class extends Ui{#t;#e;#r;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||Hi(),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.#e.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#e.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#n({type:"continue"})};this.#r=Bi({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(s,o)=>{this.#n({type:"failed",failureCount:s,error:o})},onPause:()=>{this.#n({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const r=this.state.status==="pending",n=!this.#r.canStart();try{if(r)t();else{this.#n({type:"pending",variables:e,isPaused:n}),await this.#e.config.onMutate?.(e,this);const o=await this.options.onMutate?.(e);o!==this.state.context&&this.#n({type:"pending",context:o,variables:e,isPaused:n})}const s=await this.#r.start();return await this.#e.config.onSuccess?.(s,e,this.state.context,this),await this.options.onSuccess?.(s,e,this.state.context),await this.#e.config.onSettled?.(s,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(s,null,e,this.state.context),this.#n({type:"success",data:s}),s}catch(s){try{throw await this.#e.config.onError?.(s,e,this.state.context,this),await this.options.onError?.(s,e,this.state.context),await this.#e.config.onSettled?.(void 0,s,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,s,e,this.state.context),s}finally{this.#n({type:"error",error:s})}}finally{this.#e.runNext(this)}}#n(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),Te.batch(()=>{this.#t.forEach(r=>{r.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function Hi(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Id=class extends $r{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#r=0}#t;#e;#r;build(e,t,r){const n=new jd({mutationCache:this,mutationId:++this.#r,options:e.defaultMutationOptions(t),state:r});return this.add(n),n}add(e){this.#t.add(e);const t=In(e);if(typeof t=="string"){const r=this.#e.get(t);r?r.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=In(e);if(typeof t=="string"){const r=this.#e.get(t);if(r)if(r.length>1){const n=r.indexOf(e);n!==-1&&r.splice(n,1)}else r[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=In(e);if(typeof t=="string"){const n=this.#e.get(t)?.find(s=>s.state.status==="pending");return!n||n===e}else return!0}runNext(e){const t=In(e);return typeof t=="string"?this.#e.get(t)?.find(n=>n!==e&&n.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Te.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(r=>Ca(t,r))}findAll(e={}){return this.getAll().filter(t=>Ca(e,t))}notify(e){Te.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Te.batch(()=>Promise.all(e.map(t=>t.continue().catch(Le))))}};function In(e){return e.options.scope?.id}function Ta(e){return{onFetch:(t,r)=>{const n=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let i={pages:[],pageParams:[]},c=0;const l=async()=>{let h=!1;const u=x=>{Object.defineProperty(x,"signal",{enumerable:!0,get:()=>(t.signal.aborted?h=!0:t.signal.addEventListener("abort",()=>{h=!0}),t.signal)})},p=Fi(t.options,t.fetchOptions),g=async(x,m,y)=>{if(h)return Promise.reject();if(m==null&&x.pages.length)return Promise.resolve(x);const b=(()=>{const A={client:t.client,queryKey:t.queryKey,pageParam:m,direction:y?"backward":"forward",meta:t.options.meta};return u(A),A})(),C=await p(b),{maxPages:S}=t.options,_=y?Ed:Cd;return{pages:_(x.pages,C,S),pageParams:_(x.pageParams,m,S)}};if(s&&o.length){const x=s==="backward",m=x?Dd:Pa,y={pages:o,pageParams:a},w=m(n,y);i=await g(y,w,x)}else{const x=e??o.length;do{const m=c===0?a[0]??n.initialPageParam:Pa(n,i);if(c>0&&m==null)break;i=await g(i,m),c++}while(c<x)}return i};t.options.persister?t.fetchFn=()=>t.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=l}}}function Pa(e,{pages:t,pageParams:r}){const n=t.length-1;return t.length>0?e.getNextPageParam(t[n],t,r[n],r):void 0}function Dd(e,{pages:t,pageParams:r}){return t.length>0?e.getPreviousPageParam?.(t[0],t,r[0],r):void 0}var Fd=class{#t;#e;#r;#n;#s;#a;#i;#o;constructor(e={}){this.#t=e.queryCache||new Md,this.#e=e.mutationCache||new Id,this.#r=e.defaultOptions||{},this.#n=new Map,this.#s=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#i=No.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#o=Yn.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#i?.(),this.#i=void 0,this.#o?.(),this.#o=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),r=this.#t.build(this,t),n=r.state.data;return n===void 0?this.fetchQuery(e):(e.revalidateIfStale&&r.isStaleByTime(Qt(t.staleTime,r))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:r})=>{const n=r.data;return[t,n]})}setQueryData(e,t,r){const n=this.defaultQueryOptions({queryKey:e}),o=this.#t.get(n.queryHash)?.state.data,a=_d(t,o);if(a!==void 0)return this.#t.build(this,n).setData(a,{...r,manual:!0})}setQueriesData(e,t,r){return Te.batch(()=>this.#t.findAll(e).map(({queryKey:n})=>[n,this.setQueryData(n,t,r)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;Te.batch(()=>{t.findAll(e).forEach(r=>{t.remove(r)})})}resetQueries(e,t){const r=this.#t;return Te.batch(()=>(r.findAll(e).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const r={revert:!0,...t},n=Te.batch(()=>this.#t.findAll(e).map(s=>s.cancel(r)));return Promise.all(n).then(Le).catch(Le)}invalidateQueries(e,t={}){return Te.batch(()=>(this.#t.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},n=Te.batch(()=>this.#t.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let o=s.fetch(void 0,r);return r.throwOnError||(o=o.catch(Le)),s.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(n).then(Le)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const r=this.#t.build(this,t);return r.isStaleByTime(Qt(t.staleTime,r))?r.fetch(t):Promise.resolve(r.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Le).catch(Le)}fetchInfiniteQuery(e){return e.behavior=Ta(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Le).catch(Le)}ensureInfiniteQueryData(e){return e.behavior=Ta(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Yn.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#r}setDefaultOptions(e){this.#r=e}setQueryDefaults(e,t){this.#n.set(hr(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#n.values()],r={};return t.forEach(n=>{en(e,n.queryKey)&&Object.assign(r,n.defaultOptions)}),r}setMutationDefaults(e,t){this.#s.set(hr(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#s.values()],r={};return t.forEach(n=>{en(e,n.mutationKey)&&Object.assign(r,n.defaultOptions)}),r}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#r.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=ko(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===Oo&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#r.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},Ld=class extends $r{constructor(e,t){super(),this.options=t,this.#t=e,this.#o=null,this.#i=ao(),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#r=void 0;#n=void 0;#s;#a;#i;#o;#m;#f;#h;#l;#u;#c;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Aa(this.#e,this.options)?this.#d():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return io(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return io(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#w(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,r=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof et(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#_(),this.#e.setOptions(this.options),t._defaulted&&!Qn(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const n=this.hasListeners();n&&ka(this.#e,r,this.options,t)&&this.#d(),this.updateResult(),n&&(this.#e!==r||et(this.options.enabled,this.#e)!==et(t.enabled,this.#e)||Qt(this.options.staleTime,this.#e)!==Qt(t.staleTime,this.#e))&&this.#g();const s=this.#v();n&&(this.#e!==r||et(this.options.enabled,this.#e)!==et(t.enabled,this.#e)||s!==this.#c)&&this.#y(s)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),r=this.createResult(t,e);return $d(this,r)&&(this.#n=r,this.#a=this.options,this.#s=this.#e.state),r}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(r,n)=>(this.trackProp(n),t?.(n),n==="promise"&&!this.options.experimental_prefetchInRender&&this.#i.status==="pending"&&this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(r,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),r=this.#t.getQueryCache().build(this.#t,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#d(e){this.#_();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(Le)),t}#g(){this.#b();const e=Qt(this.options.staleTime,this.#e);if(fr||this.#n.isStale||!no(e))return;const r=Ii(this.#n.dataUpdatedAt,e)+1;this.#l=setTimeout(()=>{this.#n.isStale||this.updateResult()},r)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#c=e,!(fr||et(this.options.enabled,this.#e)===!1||!no(this.#c)||this.#c===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||No.isFocused())&&this.#d()},this.#c))}#x(){this.#g(),this.#y(this.#v())}#b(){this.#l&&(clearTimeout(this.#l),this.#l=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const r=this.#e,n=this.options,s=this.#n,o=this.#s,a=this.#a,c=e!==r?e.state:this.#r,{state:l}=e;let h={...l},u=!1,p;if(t._optimisticResults){const O=this.hasListeners(),I=!O&&Aa(e,t),F=O&&ka(e,r,t,n);(I||F)&&(h={...h,...zi(l.data,e.options)}),t._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:g,errorUpdatedAt:x,status:m}=h;p=h.data;let y=!1;if(t.placeholderData!==void 0&&p===void 0&&m==="pending"){let O;s?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(O=s.data,y=!0):O=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,O!==void 0&&(m="success",p=oo(s?.data,O,t),u=!0)}if(t.select&&p!==void 0&&!y)if(s&&p===o?.data&&t.select===this.#m)p=this.#f;else try{this.#m=t.select,p=t.select(p),p=oo(s?.data,p,t),this.#f=p,this.#o=null}catch(O){this.#o=O}this.#o&&(g=this.#o,p=this.#f,x=Date.now(),m="error");const w=h.fetchStatus==="fetching",b=m==="pending",C=m==="error",S=b&&w,_=p!==void 0,P={status:m,fetchStatus:h.fetchStatus,isPending:b,isSuccess:m==="success",isError:C,isInitialLoading:S,isLoading:S,data:p,dataUpdatedAt:h.dataUpdatedAt,error:g,errorUpdatedAt:x,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:w,isRefetching:w&&!b,isLoadingError:C&&!_,isPaused:h.fetchStatus==="paused",isPlaceholderData:u,isRefetchError:C&&_,isStale:Mo(e,t),refetch:this.refetch,promise:this.#i,isEnabled:et(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const O=G=>{P.status==="error"?G.reject(P.error):P.data!==void 0&&G.resolve(P.data)},I=()=>{const G=this.#i=P.promise=ao();O(G)},F=this.#i;switch(F.status){case"pending":e.queryHash===r.queryHash&&O(F);break;case"fulfilled":(P.status==="error"||P.data!==F.value)&&I();break;case"rejected":(P.status!=="error"||P.error!==F.reason)&&I();break}}return P}updateResult(){const e=this.#n,t=this.createResult(this.#e,this.options);if(this.#s=this.#e.state,this.#a=this.options,this.#s.data!==void 0&&(this.#h=this.#e),Qn(t,e))return;this.#n=t;const r=()=>{if(!e)return!0;const{notifyOnChangeProps:n}=this.options,s=typeof n=="function"?n():n;if(s==="all"||!s&&!this.#p.size)return!0;const o=new Set(s??this.#p);return this.options.throwOnError&&o.add("error"),Object.keys(this.#n).some(a=>{const i=a;return this.#n[i]!==e[i]&&o.has(i)})};this.#S({listeners:r()})}#_(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#r=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#S(e){Te.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#n)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function Vd(e,t){return et(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Aa(e,t){return Vd(e,t)||e.state.data!==void 0&&io(e,t,t.refetchOnMount)}function io(e,t,r){if(et(t.enabled,e)!==!1&&Qt(t.staleTime,e)!=="static"){const n=typeof r=="function"?r(e):r;return n==="always"||n!==!1&&Mo(e,t)}return!1}function ka(e,t,r,n){return(e!==t||et(n.enabled,e)===!1)&&(!r.suspense||e.state.status!=="error")&&Mo(e,r)}function Mo(e,t){return et(t.enabled,e)!==!1&&e.isStaleByTime(Qt(t.staleTime,e))}function $d(e,t){return!Qn(e.getCurrentResult(),t)}var Bd=class extends $r{#t;#e=void 0;#r;#n;constructor(t,r){super(),this.#t=t,this.setOptions(r),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const r=this.options;this.options=this.#t.defaultMutationOptions(t),Qn(this.options,r)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),r?.mutationKey&&this.options.mutationKey&&hr(r.mutationKey)!==hr(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(t){this.#s(),this.#a(t)}getCurrentResult(){return this.#e}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#s(),this.#a()}mutate(t,r){return this.#n=r,this.#r?.removeObserver(this),this.#r=this.#t.getMutationCache().build(this.#t,this.options),this.#r.addObserver(this),this.#r.execute(t)}#s(){const t=this.#r?.state??Hi();this.#e={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#a(t){Te.batch(()=>{if(this.#n&&this.hasListeners()){const r=this.#e.variables,n=this.#e.context;t?.type==="success"?(this.#n.onSuccess?.(t.data,r,n),this.#n.onSettled?.(t.data,null,r,n)):t?.type==="error"&&(this.#n.onError?.(t.error,r,n),this.#n.onSettled?.(void 0,t.error,r,n))}this.listeners.forEach(r=>{r(this.#e)})})}},Wi=f.createContext(void 0),Zi=e=>{const t=f.useContext(Wi);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},fw=({client:e,children:t})=>(f.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),d.jsx(Wi.Provider,{value:e,children:t})),qi=f.createContext(!1),Ud=()=>f.useContext(qi);qi.Provider;function zd(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Hd=f.createContext(zd()),Wd=()=>f.useContext(Hd),Zd=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},qd=e=>{f.useEffect(()=>{e.clearReset()},[e])},Gd=({result:e,errorResetBoundary:t,throwOnError:r,query:n,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&n&&(s&&e.data===void 0||Li(r,[e.error,n])),Kd=e=>{if(e.suspense){const t=n=>n==="static"?n:Math.max(n??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...n)=>t(r(...n)):t(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Qd=(e,t)=>e.isLoading&&e.isFetching&&!t,Yd=(e,t)=>e?.suspense&&t.isPending,Oa=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function Xd(e,t,r){const n=Ud(),s=Wd(),o=Zi(),a=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=n?"isRestoring":"optimistic",Kd(a),Zd(a,s),qd(s);const i=!o.getQueryCache().get(a.queryHash),[c]=f.useState(()=>new t(o,a)),l=c.getOptimisticResult(a),h=!n&&e.subscribed!==!1;if(f.useSyncExternalStore(f.useCallback(u=>{const p=h?c.subscribe(Te.batchCalls(u)):Le;return c.updateResult(),p},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),f.useEffect(()=>{c.setOptions(a)},[a,c]),Yd(a,l))throw Oa(a,c,s);if(Gd({result:l,errorResetBoundary:s,throwOnError:a.throwOnError,query:o.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw l.error;return o.getDefaultOptions().queries?._experimental_afterQuery?.(a,l),a.experimental_prefetchInRender&&!fr&&Qd(l,n)&&(i?Oa(a,c,s):o.getQueryCache().get(a.queryHash)?.promise)?.catch(Le).finally(()=>{c.updateResult()}),a.notifyOnChangeProps?l:c.trackResult(l)}function co(e,t){return Xd(e,Ld)}function Gi(e,t){const r=Zi(),[n]=f.useState(()=>new Bd(r,e));f.useEffect(()=>{n.setOptions(e)},[n,e]);const s=f.useSyncExternalStore(f.useCallback(a=>n.subscribe(Te.batchCalls(a)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),o=f.useCallback((a,i)=>{n.mutate(a,i).catch(Le)},[n]);if(s.error&&Li(n.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:o,mutateAsync:s.mutate}}const hw=new Fd({defaultOptions:{queries:{staleTime:1e3*60,refetchOnWindowFocus:!1}}});/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Jd=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ef=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,r,n)=>n?n.toUpperCase():r.toLowerCase()),Na=e=>{const t=ef(e);return t.charAt(0).toUpperCase()+t.slice(1)},Ki=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim(),tf=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/var rf={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const nf=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:s="",children:o,iconNode:a,...i},c)=>f.createElement("svg",{ref:c,...rf,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Ki("lucide",s),...!o&&!tf(i)&&{"aria-hidden":"true"},...i},[...a.map(([l,h])=>f.createElement(l,h)),...Array.isArray(o)?o:[o]]));/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const rt=(e,t)=>{const r=f.forwardRef(({className:n,...s},o)=>f.createElement(nf,{ref:o,iconNode:t,className:Ki(`lucide-${Jd(Na(e))}`,`lucide-${e}`,n),...s}));return r.displayName=Na(e),r};/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const sf=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],of=rt("check",sf);/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const af=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Qi=rt("chevron-down",af);/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const cf=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],lf=rt("chevron-left",cf);/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const uf=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],df=rt("chevron-right",uf);/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const ff=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],hf=rt("chevron-up",ff);/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const pf=[["path",{d:"M11 20H2",key:"nlcfvz"}],["path",{d:"M11 4.562v16.157a1 1 0 0 0 1.242.97L19 20V5.562a2 2 0 0 0-1.515-1.94l-4-1A2 2 0 0 0 11 4.561z",key:"au4z13"}],["path",{d:"M11 4H8a2 2 0 0 0-2 2v14",key:"74r1mk"}],["path",{d:"M14 12h.01",key:"1jfl7z"}],["path",{d:"M22 20h-3",key:"vhrsz"}]],mf=rt("door-open",pf);/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const gf=[["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"}]],vf=rt("ellipsis",gf);/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const yf=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Yi=rt("eye-off",yf);/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const xf=[["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"}]],Xi=rt("eye",xf);/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const bf=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],wf=rt("search",bf);/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const _f=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],Sf=rt("square-pen",_f);/**
|
|
* @license lucide-react v0.540.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/const Cf=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],jo=rt("x",Cf);function Z(e,t,{checkForDefaultPrevented:r=!0}={}){return function(s){if(e?.(s),r===!1||!s.defaultPrevented)return t?.(s)}}function Ef(e,t){const r=f.createContext(t),n=o=>{const{children:a,...i}=o,c=f.useMemo(()=>i,Object.values(i));return d.jsx(r.Provider,{value:c,children:a})};n.displayName=e+"Provider";function s(o){const a=f.useContext(r);if(a)return a;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[n,s]}function kt(e,t=[]){let r=[];function n(o,a){const i=f.createContext(a),c=r.length;r=[...r,a];const l=u=>{const{scope:p,children:g,...x}=u,m=p?.[e]?.[c]||i,y=f.useMemo(()=>x,Object.values(x));return d.jsx(m.Provider,{value:y,children:g})};l.displayName=o+"Provider";function h(u,p){const g=p?.[e]?.[c]||i,x=f.useContext(g);if(x)return x;if(a!==void 0)return a;throw new Error(`\`${u}\` must be used within \`${o}\``)}return[l,h]}const s=()=>{const o=r.map(a=>f.createContext(a));return function(i){const c=i?.[e]||o;return f.useMemo(()=>({[`__scope${e}`]:{...i,[e]:c}}),[i,c])}};return s.scopeName=e,[n,Rf(s,...t)]}function Rf(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(o){const a=n.reduce((i,{useScope:c,scopeName:l})=>{const u=c(o)[`__scope${l}`];return{...i,...u}},{});return f.useMemo(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return r.scopeName=t.scopeName,r}var xn=vd();const Ji=yd(xn);var Tf=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],ne=Tf.reduce((e,t)=>{const r=dr(`Primitive.${t}`),n=f.forwardRef((s,o)=>{const{asChild:a,...i}=s,c=a?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(c,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function ec(e,t){e&&xn.flushSync(()=>e.dispatchEvent(t))}function Oe(e){const t=f.useRef(e);return f.useEffect(()=>{t.current=e}),f.useMemo(()=>(...r)=>t.current?.(...r),[])}function Pf(e,t=globalThis?.document){const r=Oe(e);f.useEffect(()=>{const n=s=>{s.key==="Escape"&&r(s)};return t.addEventListener("keydown",n,{capture:!0}),()=>t.removeEventListener("keydown",n,{capture:!0})},[r,t])}var Af="DismissableLayer",lo="dismissableLayer.update",kf="dismissableLayer.pointerDownOutside",Of="dismissableLayer.focusOutside",Ma,tc=f.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),bn=f.forwardRef((e,t)=>{const{disableOutsidePointerEvents:r=!1,onEscapeKeyDown:n,onPointerDownOutside:s,onFocusOutside:o,onInteractOutside:a,onDismiss:i,...c}=e,l=f.useContext(tc),[h,u]=f.useState(null),p=h?.ownerDocument??globalThis?.document,[,g]=f.useState({}),x=ue(t,P=>u(P)),m=Array.from(l.layers),[y]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),w=m.indexOf(y),b=h?m.indexOf(h):-1,C=l.layersWithOutsidePointerEventsDisabled.size>0,S=b>=w,_=jf(P=>{const O=P.target,I=[...l.branches].some(F=>F.contains(O));!S||I||(s?.(P),a?.(P),P.defaultPrevented||i?.())},p),A=If(P=>{const O=P.target;[...l.branches].some(F=>F.contains(O))||(o?.(P),a?.(P),P.defaultPrevented||i?.())},p);return Pf(P=>{b===l.layers.size-1&&(n?.(P),!P.defaultPrevented&&i&&(P.preventDefault(),i()))},p),f.useEffect(()=>{if(h)return r&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Ma=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(h)),l.layers.add(h),ja(),()=>{r&&l.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=Ma)}},[h,p,r,l]),f.useEffect(()=>()=>{h&&(l.layers.delete(h),l.layersWithOutsidePointerEventsDisabled.delete(h),ja())},[h,l]),f.useEffect(()=>{const P=()=>g({});return document.addEventListener(lo,P),()=>document.removeEventListener(lo,P)},[]),d.jsx(ne.div,{...c,ref:x,style:{pointerEvents:C?S?"auto":"none":void 0,...e.style},onFocusCapture:Z(e.onFocusCapture,A.onFocusCapture),onBlurCapture:Z(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Z(e.onPointerDownCapture,_.onPointerDownCapture)})});bn.displayName=Af;var Nf="DismissableLayerBranch",Mf=f.forwardRef((e,t)=>{const r=f.useContext(tc),n=f.useRef(null),s=ue(t,n);return f.useEffect(()=>{const o=n.current;if(o)return r.branches.add(o),()=>{r.branches.delete(o)}},[r.branches]),d.jsx(ne.div,{...e,ref:s})});Mf.displayName=Nf;function jf(e,t=globalThis?.document){const r=Oe(e),n=f.useRef(!1),s=f.useRef(()=>{});return f.useEffect(()=>{const o=i=>{if(i.target&&!n.current){let c=function(){rc(kf,r,l,{discrete:!0})};const l={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",s.current),s.current=c,t.addEventListener("click",s.current,{once:!0})):c()}else t.removeEventListener("click",s.current);n.current=!1},a=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(a),t.removeEventListener("pointerdown",o),t.removeEventListener("click",s.current)}},[t,r]),{onPointerDownCapture:()=>n.current=!0}}function If(e,t=globalThis?.document){const r=Oe(e),n=f.useRef(!1);return f.useEffect(()=>{const s=o=>{o.target&&!n.current&&rc(Of,r,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",s),()=>t.removeEventListener("focusin",s)},[t,r]),{onFocusCapture:()=>n.current=!0,onBlurCapture:()=>n.current=!1}}function ja(){const e=new CustomEvent(lo);document.dispatchEvent(e)}function rc(e,t,r,{discrete:n}){const s=r.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:r});t&&s.addEventListener(e,t,{once:!0}),n?ec(s,o):s.dispatchEvent(o)}var Us=0;function xs(){f.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ia()),document.body.insertAdjacentElement("beforeend",e[1]??Ia()),Us++,()=>{Us===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Us--}},[])}function Ia(){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 zs="focusScope.autoFocusOnMount",Hs="focusScope.autoFocusOnUnmount",Da={bubbles:!1,cancelable:!0},Df="FocusScope",wn=f.forwardRef((e,t)=>{const{loop:r=!1,trapped:n=!1,onMountAutoFocus:s,onUnmountAutoFocus:o,...a}=e,[i,c]=f.useState(null),l=Oe(s),h=Oe(o),u=f.useRef(null),p=ue(t,m=>c(m)),g=f.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;f.useEffect(()=>{if(n){let m=function(C){if(g.paused||!i)return;const S=C.target;i.contains(S)?u.current=S:Kt(u.current,{select:!0})},y=function(C){if(g.paused||!i)return;const S=C.relatedTarget;S!==null&&(i.contains(S)||Kt(u.current,{select:!0}))},w=function(C){if(document.activeElement===document.body)for(const _ of C)_.removedNodes.length>0&&Kt(i)};document.addEventListener("focusin",m),document.addEventListener("focusout",y);const b=new MutationObserver(w);return i&&b.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",y),b.disconnect()}}},[n,i,g.paused]),f.useEffect(()=>{if(i){La.add(g);const m=document.activeElement;if(!i.contains(m)){const w=new CustomEvent(zs,Da);i.addEventListener(zs,l),i.dispatchEvent(w),w.defaultPrevented||(Ff(Uf(nc(i)),{select:!0}),document.activeElement===m&&Kt(i))}return()=>{i.removeEventListener(zs,l),setTimeout(()=>{const w=new CustomEvent(Hs,Da);i.addEventListener(Hs,h),i.dispatchEvent(w),w.defaultPrevented||Kt(m??document.body,{select:!0}),i.removeEventListener(Hs,h),La.remove(g)},0)}}},[i,l,h,g]);const x=f.useCallback(m=>{if(!r&&!n||g.paused)return;const y=m.key==="Tab"&&!m.altKey&&!m.ctrlKey&&!m.metaKey,w=document.activeElement;if(y&&w){const b=m.currentTarget,[C,S]=Lf(b);C&&S?!m.shiftKey&&w===S?(m.preventDefault(),r&&Kt(C,{select:!0})):m.shiftKey&&w===C&&(m.preventDefault(),r&&Kt(S,{select:!0})):w===b&&m.preventDefault()}},[r,n,g.paused]);return d.jsx(ne.div,{tabIndex:-1,...a,ref:p,onKeyDown:x})});wn.displayName=Df;function Ff(e,{select:t=!1}={}){const r=document.activeElement;for(const n of e)if(Kt(n,{select:t}),document.activeElement!==r)return}function Lf(e){const t=nc(e),r=Fa(t,e),n=Fa(t.reverse(),e);return[r,n]}function nc(e){const t=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:n=>{const s=n.tagName==="INPUT"&&n.type==="hidden";return n.disabled||n.hidden||s?NodeFilter.FILTER_SKIP:n.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)t.push(r.currentNode);return t}function Fa(e,t){for(const r of e)if(!Vf(r,{upTo:t}))return r}function Vf(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 $f(e){return e instanceof HTMLInputElement&&"select"in e}function Kt(e,{select:t=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&$f(e)&&t&&e.select()}}var La=Bf();function Bf(){let e=[];return{add(t){const r=e[0];t!==r&&r?.pause(),e=Va(e,t),e.unshift(t)},remove(t){e=Va(e,t),e[0]?.resume()}}}function Va(e,t){const r=[...e],n=r.indexOf(t);return n!==-1&&r.splice(n,1),r}function Uf(e){return e.filter(t=>t.tagName!=="A")}var Ne=globalThis?.document?f.useLayoutEffect:()=>{},zf=Oi[" useId ".trim().toString()]||(()=>{}),Hf=0;function Ct(e){const[t,r]=f.useState(zf());return Ne(()=>{r(n=>n??String(Hf++))},[e]),e||(t?`radix-${t}`:"")}const Wf=["top","right","bottom","left"],Yt=Math.min,Ke=Math.max,Xn=Math.round,Dn=Math.floor,Et=e=>({x:e,y:e}),Zf={left:"right",right:"left",bottom:"top",top:"bottom"},qf={start:"end",end:"start"};function uo(e,t,r){return Ke(e,Yt(t,r))}function $t(e,t){return typeof e=="function"?e(t):e}function Bt(e){return e.split("-")[0]}function Br(e){return e.split("-")[1]}function Io(e){return e==="x"?"y":"x"}function Do(e){return e==="y"?"height":"width"}const Gf=new Set(["top","bottom"]);function _t(e){return Gf.has(Bt(e))?"y":"x"}function Fo(e){return Io(_t(e))}function Kf(e,t,r){r===void 0&&(r=!1);const n=Br(e),s=Fo(e),o=Do(s);let a=s==="x"?n===(r?"end":"start")?"right":"left":n==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(a=Jn(a)),[a,Jn(a)]}function Qf(e){const t=Jn(e);return[fo(e),t,fo(t)]}function fo(e){return e.replace(/start|end/g,t=>qf[t])}const $a=["left","right"],Ba=["right","left"],Yf=["top","bottom"],Xf=["bottom","top"];function Jf(e,t,r){switch(e){case"top":case"bottom":return r?t?Ba:$a:t?$a:Ba;case"left":case"right":return t?Yf:Xf;default:return[]}}function eh(e,t,r,n){const s=Br(e);let o=Jf(Bt(e),r==="start",n);return s&&(o=o.map(a=>a+"-"+s),t&&(o=o.concat(o.map(fo)))),o}function Jn(e){return e.replace(/left|right|bottom|top/g,t=>Zf[t])}function th(e){return{top:0,right:0,bottom:0,left:0,...e}}function sc(e){return typeof e!="number"?th(e):{top:e,right:e,bottom:e,left:e}}function es(e){const{x:t,y:r,width:n,height:s}=e;return{width:n,height:s,top:r,left:t,right:t+n,bottom:r+s,x:t,y:r}}function Ua(e,t,r){let{reference:n,floating:s}=e;const o=_t(t),a=Fo(t),i=Do(a),c=Bt(t),l=o==="y",h=n.x+n.width/2-s.width/2,u=n.y+n.height/2-s.height/2,p=n[i]/2-s[i]/2;let g;switch(c){case"top":g={x:h,y:n.y-s.height};break;case"bottom":g={x:h,y:n.y+n.height};break;case"right":g={x:n.x+n.width,y:u};break;case"left":g={x:n.x-s.width,y:u};break;default:g={x:n.x,y:n.y}}switch(Br(t)){case"start":g[a]-=p*(r&&l?-1:1);break;case"end":g[a]+=p*(r&&l?-1:1);break}return g}const rh=async(e,t,r)=>{const{placement:n="bottom",strategy:s="absolute",middleware:o=[],platform:a}=r,i=o.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(t));let l=await a.getElementRects({reference:e,floating:t,strategy:s}),{x:h,y:u}=Ua(l,n,c),p=n,g={},x=0;for(let m=0;m<i.length;m++){const{name:y,fn:w}=i[m],{x:b,y:C,data:S,reset:_}=await w({x:h,y:u,initialPlacement:n,placement:p,strategy:s,middlewareData:g,rects:l,platform:a,elements:{reference:e,floating:t}});h=b??h,u=C??u,g={...g,[y]:{...g[y],...S}},_&&x<=50&&(x++,typeof _=="object"&&(_.placement&&(p=_.placement),_.rects&&(l=_.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:s}):_.rects),{x:h,y:u}=Ua(l,p,c)),m=-1)}return{x:h,y:u,placement:p,strategy:s,middlewareData:g}};async function tn(e,t){var r;t===void 0&&(t={});const{x:n,y:s,platform:o,rects:a,elements:i,strategy:c}=e,{boundary:l="clippingAncestors",rootBoundary:h="viewport",elementContext:u="floating",altBoundary:p=!1,padding:g=0}=$t(t,e),x=sc(g),y=i[p?u==="floating"?"reference":"floating":u],w=es(await o.getClippingRect({element:(r=await(o.isElement==null?void 0:o.isElement(y)))==null||r?y:y.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(i.floating)),boundary:l,rootBoundary:h,strategy:c})),b=u==="floating"?{x:n,y:s,width:a.floating.width,height:a.floating.height}:a.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(i.floating)),S=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},_=es(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:i,rect:b,offsetParent:C,strategy:c}):b);return{top:(w.top-_.top+x.top)/S.y,bottom:(_.bottom-w.bottom+x.bottom)/S.y,left:(w.left-_.left+x.left)/S.x,right:(_.right-w.right+x.right)/S.x}}const nh=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:n,placement:s,rects:o,platform:a,elements:i,middlewareData:c}=t,{element:l,padding:h=0}=$t(e,t)||{};if(l==null)return{};const u=sc(h),p={x:r,y:n},g=Fo(s),x=Do(g),m=await a.getDimensions(l),y=g==="y",w=y?"top":"left",b=y?"bottom":"right",C=y?"clientHeight":"clientWidth",S=o.reference[x]+o.reference[g]-p[g]-o.floating[x],_=p[g]-o.reference[g],A=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l));let P=A?A[C]:0;(!P||!await(a.isElement==null?void 0:a.isElement(A)))&&(P=i.floating[C]||o.floating[x]);const O=S/2-_/2,I=P/2-m[x]/2-1,F=Yt(u[w],I),G=Yt(u[b],I),L=F,N=P-m[x]-G,$=P/2-m[x]/2+O,X=uo(L,$,N),M=!c.arrow&&Br(s)!=null&&$!==X&&o.reference[x]/2-($<L?F:G)-m[x]/2<0,K=M?$<L?$-L:$-N:0;return{[g]:p[g]+K,data:{[g]:X,centerOffset:$-X-K,...M&&{alignmentOffset:K}},reset:M}}}),sh=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,n;const{placement:s,middlewareData:o,rects:a,initialPlacement:i,platform:c,elements:l}=t,{mainAxis:h=!0,crossAxis:u=!0,fallbackPlacements:p,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:m=!0,...y}=$t(e,t);if((r=o.arrow)!=null&&r.alignmentOffset)return{};const w=Bt(s),b=_t(i),C=Bt(i)===i,S=await(c.isRTL==null?void 0:c.isRTL(l.floating)),_=p||(C||!m?[Jn(i)]:Qf(i)),A=x!=="none";!p&&A&&_.push(...eh(i,m,x,S));const P=[i,..._],O=await tn(t,y),I=[];let F=((n=o.flip)==null?void 0:n.overflows)||[];if(h&&I.push(O[w]),u){const $=Kf(s,a,S);I.push(O[$[0]],O[$[1]])}if(F=[...F,{placement:s,overflows:I}],!I.every($=>$<=0)){var G,L;const $=(((G=o.flip)==null?void 0:G.index)||0)+1,X=P[$];if(X&&(!(u==="alignment"?b!==_t(X):!1)||F.every(q=>_t(q.placement)===b?q.overflows[0]>0:!0)))return{data:{index:$,overflows:F},reset:{placement:X}};let M=(L=F.filter(K=>K.overflows[0]<=0).sort((K,q)=>K.overflows[1]-q.overflows[1])[0])==null?void 0:L.placement;if(!M)switch(g){case"bestFit":{var N;const K=(N=F.filter(q=>{if(A){const D=_t(q.placement);return D===b||D==="y"}return!0}).map(q=>[q.placement,q.overflows.filter(D=>D>0).reduce((D,ie)=>D+ie,0)]).sort((q,D)=>q[1]-D[1])[0])==null?void 0:N[0];K&&(M=K);break}case"initialPlacement":M=i;break}if(s!==M)return{reset:{placement:M}}}return{}}}};function za(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ha(e){return Wf.some(t=>e[t]>=0)}const oh=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r}=t,{strategy:n="referenceHidden",...s}=$t(e,t);switch(n){case"referenceHidden":{const o=await tn(t,{...s,elementContext:"reference"}),a=za(o,r.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:Ha(a)}}}case"escaped":{const o=await tn(t,{...s,altBoundary:!0}),a=za(o,r.floating);return{data:{escapedOffsets:a,escaped:Ha(a)}}}default:return{}}}}},oc=new Set(["left","top"]);async function ah(e,t){const{placement:r,platform:n,elements:s}=e,o=await(n.isRTL==null?void 0:n.isRTL(s.floating)),a=Bt(r),i=Br(r),c=_t(r)==="y",l=oc.has(a)?-1:1,h=o&&c?-1:1,u=$t(t,e);let{mainAxis:p,crossAxis:g,alignmentAxis:x}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return i&&typeof x=="number"&&(g=i==="end"?x*-1:x),c?{x:g*h,y:p*l}:{x:p*l,y:g*h}}const ih=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,n;const{x:s,y:o,placement:a,middlewareData:i}=t,c=await ah(t,e);return a===((r=i.offset)==null?void 0:r.placement)&&(n=i.arrow)!=null&&n.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:a}}}}},ch=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:n,placement:s}=t,{mainAxis:o=!0,crossAxis:a=!1,limiter:i={fn:y=>{let{x:w,y:b}=y;return{x:w,y:b}}},...c}=$t(e,t),l={x:r,y:n},h=await tn(t,c),u=_t(Bt(s)),p=Io(u);let g=l[p],x=l[u];if(o){const y=p==="y"?"top":"left",w=p==="y"?"bottom":"right",b=g+h[y],C=g-h[w];g=uo(b,g,C)}if(a){const y=u==="y"?"top":"left",w=u==="y"?"bottom":"right",b=x+h[y],C=x-h[w];x=uo(b,x,C)}const m=i.fn({...t,[p]:g,[u]:x});return{...m,data:{x:m.x-r,y:m.y-n,enabled:{[p]:o,[u]:a}}}}}},lh=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:n,placement:s,rects:o,middlewareData:a}=t,{offset:i=0,mainAxis:c=!0,crossAxis:l=!0}=$t(e,t),h={x:r,y:n},u=_t(s),p=Io(u);let g=h[p],x=h[u];const m=$t(i,t),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(c){const C=p==="y"?"height":"width",S=o.reference[p]-o.floating[C]+y.mainAxis,_=o.reference[p]+o.reference[C]-y.mainAxis;g<S?g=S:g>_&&(g=_)}if(l){var w,b;const C=p==="y"?"width":"height",S=oc.has(Bt(s)),_=o.reference[u]-o.floating[C]+(S&&((w=a.offset)==null?void 0:w[u])||0)+(S?0:y.crossAxis),A=o.reference[u]+o.reference[C]+(S?0:((b=a.offset)==null?void 0:b[u])||0)-(S?y.crossAxis:0);x<_?x=_:x>A&&(x=A)}return{[p]:g,[u]:x}}}},uh=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,n;const{placement:s,rects:o,platform:a,elements:i}=t,{apply:c=()=>{},...l}=$t(e,t),h=await tn(t,l),u=Bt(s),p=Br(s),g=_t(s)==="y",{width:x,height:m}=o.floating;let y,w;u==="top"||u==="bottom"?(y=u,w=p===(await(a.isRTL==null?void 0:a.isRTL(i.floating))?"start":"end")?"left":"right"):(w=u,y=p==="end"?"top":"bottom");const b=m-h.top-h.bottom,C=x-h.left-h.right,S=Yt(m-h[y],b),_=Yt(x-h[w],C),A=!t.middlewareData.shift;let P=S,O=_;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(O=C),(n=t.middlewareData.shift)!=null&&n.enabled.y&&(P=b),A&&!p){const F=Ke(h.left,0),G=Ke(h.right,0),L=Ke(h.top,0),N=Ke(h.bottom,0);g?O=x-2*(F!==0||G!==0?F+G:Ke(h.left,h.right)):P=m-2*(L!==0||N!==0?L+N:Ke(h.top,h.bottom))}await c({...t,availableWidth:O,availableHeight:P});const I=await a.getDimensions(i.floating);return x!==I.width||m!==I.height?{reset:{rects:!0}}:{}}}};function bs(){return typeof window<"u"}function Ur(e){return ac(e)?(e.nodeName||"").toLowerCase():"#document"}function Qe(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ot(e){var t;return(t=(ac(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function ac(e){return bs()?e instanceof Node||e instanceof Qe(e).Node:!1}function pt(e){return bs()?e instanceof Element||e instanceof Qe(e).Element:!1}function Tt(e){return bs()?e instanceof HTMLElement||e instanceof Qe(e).HTMLElement:!1}function Wa(e){return!bs()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Qe(e).ShadowRoot}const dh=new Set(["inline","contents"]);function _n(e){const{overflow:t,overflowX:r,overflowY:n,display:s}=mt(e);return/auto|scroll|overlay|hidden|clip/.test(t+n+r)&&!dh.has(s)}const fh=new Set(["table","td","th"]);function hh(e){return fh.has(Ur(e))}const ph=[":popover-open",":modal"];function ws(e){return ph.some(t=>{try{return e.matches(t)}catch{return!1}})}const mh=["transform","translate","scale","rotate","perspective"],gh=["transform","translate","scale","rotate","perspective","filter"],vh=["paint","layout","strict","content"];function Lo(e){const t=Vo(),r=pt(e)?mt(e):e;return mh.some(n=>r[n]?r[n]!=="none":!1)||(r.containerType?r.containerType!=="normal":!1)||!t&&(r.backdropFilter?r.backdropFilter!=="none":!1)||!t&&(r.filter?r.filter!=="none":!1)||gh.some(n=>(r.willChange||"").includes(n))||vh.some(n=>(r.contain||"").includes(n))}function yh(e){let t=Xt(e);for(;Tt(t)&&!jr(t);){if(Lo(t))return t;if(ws(t))return null;t=Xt(t)}return null}function Vo(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const xh=new Set(["html","body","#document"]);function jr(e){return xh.has(Ur(e))}function mt(e){return Qe(e).getComputedStyle(e)}function _s(e){return pt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xt(e){if(Ur(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Wa(e)&&e.host||Ot(e);return Wa(t)?t.host:t}function ic(e){const t=Xt(e);return jr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Tt(t)&&_n(t)?t:ic(t)}function rn(e,t,r){var n;t===void 0&&(t=[]),r===void 0&&(r=!0);const s=ic(e),o=s===((n=e.ownerDocument)==null?void 0:n.body),a=Qe(s);if(o){const i=ho(a);return t.concat(a,a.visualViewport||[],_n(s)?s:[],i&&r?rn(i):[])}return t.concat(s,rn(s,[],r))}function ho(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function cc(e){const t=mt(e);let r=parseFloat(t.width)||0,n=parseFloat(t.height)||0;const s=Tt(e),o=s?e.offsetWidth:r,a=s?e.offsetHeight:n,i=Xn(r)!==o||Xn(n)!==a;return i&&(r=o,n=a),{width:r,height:n,$:i}}function $o(e){return pt(e)?e:e.contextElement}function Or(e){const t=$o(e);if(!Tt(t))return Et(1);const r=t.getBoundingClientRect(),{width:n,height:s,$:o}=cc(t);let a=(o?Xn(r.width):r.width)/n,i=(o?Xn(r.height):r.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!i||!Number.isFinite(i))&&(i=1),{x:a,y:i}}const bh=Et(0);function lc(e){const t=Qe(e);return!Vo()||!t.visualViewport?bh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function wh(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Qe(e)?!1:t}function pr(e,t,r,n){t===void 0&&(t=!1),r===void 0&&(r=!1);const s=e.getBoundingClientRect(),o=$o(e);let a=Et(1);t&&(n?pt(n)&&(a=Or(n)):a=Or(e));const i=wh(o,r,n)?lc(o):Et(0);let c=(s.left+i.x)/a.x,l=(s.top+i.y)/a.y,h=s.width/a.x,u=s.height/a.y;if(o){const p=Qe(o),g=n&&pt(n)?Qe(n):n;let x=p,m=ho(x);for(;m&&n&&g!==x;){const y=Or(m),w=m.getBoundingClientRect(),b=mt(m),C=w.left+(m.clientLeft+parseFloat(b.paddingLeft))*y.x,S=w.top+(m.clientTop+parseFloat(b.paddingTop))*y.y;c*=y.x,l*=y.y,h*=y.x,u*=y.y,c+=C,l+=S,x=Qe(m),m=ho(x)}}return es({width:h,height:u,x:c,y:l})}function Bo(e,t){const r=_s(e).scrollLeft;return t?t.left+r:pr(Ot(e)).left+r}function uc(e,t,r){r===void 0&&(r=!1);const n=e.getBoundingClientRect(),s=n.left+t.scrollLeft-(r?0:Bo(e,n)),o=n.top+t.scrollTop;return{x:s,y:o}}function _h(e){let{elements:t,rect:r,offsetParent:n,strategy:s}=e;const o=s==="fixed",a=Ot(n),i=t?ws(t.floating):!1;if(n===a||i&&o)return r;let c={scrollLeft:0,scrollTop:0},l=Et(1);const h=Et(0),u=Tt(n);if((u||!u&&!o)&&((Ur(n)!=="body"||_n(a))&&(c=_s(n)),Tt(n))){const g=pr(n);l=Or(n),h.x=g.x+n.clientLeft,h.y=g.y+n.clientTop}const p=a&&!u&&!o?uc(a,c,!0):Et(0);return{width:r.width*l.x,height:r.height*l.y,x:r.x*l.x-c.scrollLeft*l.x+h.x+p.x,y:r.y*l.y-c.scrollTop*l.y+h.y+p.y}}function Sh(e){return Array.from(e.getClientRects())}function Ch(e){const t=Ot(e),r=_s(e),n=e.ownerDocument.body,s=Ke(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=Ke(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight);let a=-r.scrollLeft+Bo(e);const i=-r.scrollTop;return mt(n).direction==="rtl"&&(a+=Ke(t.clientWidth,n.clientWidth)-s),{width:s,height:o,x:a,y:i}}function Eh(e,t){const r=Qe(e),n=Ot(e),s=r.visualViewport;let o=n.clientWidth,a=n.clientHeight,i=0,c=0;if(s){o=s.width,a=s.height;const l=Vo();(!l||l&&t==="fixed")&&(i=s.offsetLeft,c=s.offsetTop)}return{width:o,height:a,x:i,y:c}}const Rh=new Set(["absolute","fixed"]);function Th(e,t){const r=pr(e,!0,t==="fixed"),n=r.top+e.clientTop,s=r.left+e.clientLeft,o=Tt(e)?Or(e):Et(1),a=e.clientWidth*o.x,i=e.clientHeight*o.y,c=s*o.x,l=n*o.y;return{width:a,height:i,x:c,y:l}}function Za(e,t,r){let n;if(t==="viewport")n=Eh(e,r);else if(t==="document")n=Ch(Ot(e));else if(pt(t))n=Th(t,r);else{const s=lc(e);n={x:t.x-s.x,y:t.y-s.y,width:t.width,height:t.height}}return es(n)}function dc(e,t){const r=Xt(e);return r===t||!pt(r)||jr(r)?!1:mt(r).position==="fixed"||dc(r,t)}function Ph(e,t){const r=t.get(e);if(r)return r;let n=rn(e,[],!1).filter(i=>pt(i)&&Ur(i)!=="body"),s=null;const o=mt(e).position==="fixed";let a=o?Xt(e):e;for(;pt(a)&&!jr(a);){const i=mt(a),c=Lo(a);!c&&i.position==="fixed"&&(s=null),(o?!c&&!s:!c&&i.position==="static"&&!!s&&Rh.has(s.position)||_n(a)&&!c&&dc(e,a))?n=n.filter(h=>h!==a):s=i,a=Xt(a)}return t.set(e,n),n}function Ah(e){let{element:t,boundary:r,rootBoundary:n,strategy:s}=e;const a=[...r==="clippingAncestors"?ws(t)?[]:Ph(t,this._c):[].concat(r),n],i=a[0],c=a.reduce((l,h)=>{const u=Za(t,h,s);return l.top=Ke(u.top,l.top),l.right=Yt(u.right,l.right),l.bottom=Yt(u.bottom,l.bottom),l.left=Ke(u.left,l.left),l},Za(t,i,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function kh(e){const{width:t,height:r}=cc(e);return{width:t,height:r}}function Oh(e,t,r){const n=Tt(t),s=Ot(t),o=r==="fixed",a=pr(e,!0,o,t);let i={scrollLeft:0,scrollTop:0};const c=Et(0);function l(){c.x=Bo(s)}if(n||!n&&!o)if((Ur(t)!=="body"||_n(s))&&(i=_s(t)),n){const g=pr(t,!0,o,t);c.x=g.x+t.clientLeft,c.y=g.y+t.clientTop}else s&&l();o&&!n&&s&&l();const h=s&&!n&&!o?uc(s,i):Et(0),u=a.left+i.scrollLeft-c.x-h.x,p=a.top+i.scrollTop-c.y-h.y;return{x:u,y:p,width:a.width,height:a.height}}function Ws(e){return mt(e).position==="static"}function qa(e,t){if(!Tt(e)||mt(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Ot(e)===r&&(r=r.ownerDocument.body),r}function fc(e,t){const r=Qe(e);if(ws(e))return r;if(!Tt(e)){let s=Xt(e);for(;s&&!jr(s);){if(pt(s)&&!Ws(s))return s;s=Xt(s)}return r}let n=qa(e,t);for(;n&&hh(n)&&Ws(n);)n=qa(n,t);return n&&jr(n)&&Ws(n)&&!Lo(n)?r:n||yh(e)||r}const Nh=async function(e){const t=this.getOffsetParent||fc,r=this.getDimensions,n=await r(e.floating);return{reference:Oh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Mh(e){return mt(e).direction==="rtl"}const jh={convertOffsetParentRelativeRectToViewportRelativeRect:_h,getDocumentElement:Ot,getClippingRect:Ah,getOffsetParent:fc,getElementRects:Nh,getClientRects:Sh,getDimensions:kh,getScale:Or,isElement:pt,isRTL:Mh};function hc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Ih(e,t){let r=null,n;const s=Ot(e);function o(){var i;clearTimeout(n),(i=r)==null||i.disconnect(),r=null}function a(i,c){i===void 0&&(i=!1),c===void 0&&(c=1),o();const l=e.getBoundingClientRect(),{left:h,top:u,width:p,height:g}=l;if(i||t(),!p||!g)return;const x=Dn(u),m=Dn(s.clientWidth-(h+p)),y=Dn(s.clientHeight-(u+g)),w=Dn(h),C={rootMargin:-x+"px "+-m+"px "+-y+"px "+-w+"px",threshold:Ke(0,Yt(1,c))||1};let S=!0;function _(A){const P=A[0].intersectionRatio;if(P!==c){if(!S)return a();P?a(!1,P):n=setTimeout(()=>{a(!1,1e-7)},1e3)}P===1&&!hc(l,e.getBoundingClientRect())&&a(),S=!1}try{r=new IntersectionObserver(_,{...C,root:s.ownerDocument})}catch{r=new IntersectionObserver(_,C)}r.observe(e)}return a(!0),o}function Dh(e,t,r,n){n===void 0&&(n={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:c=!1}=n,l=$o(e),h=s||o?[...l?rn(l):[],...rn(t)]:[];h.forEach(w=>{s&&w.addEventListener("scroll",r,{passive:!0}),o&&w.addEventListener("resize",r)});const u=l&&i?Ih(l,r):null;let p=-1,g=null;a&&(g=new ResizeObserver(w=>{let[b]=w;b&&b.target===l&&g&&(g.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var C;(C=g)==null||C.observe(t)})),r()}),l&&!c&&g.observe(l),g.observe(t));let x,m=c?pr(e):null;c&&y();function y(){const w=pr(e);m&&!hc(m,w)&&r(),m=w,x=requestAnimationFrame(y)}return r(),()=>{var w;h.forEach(b=>{s&&b.removeEventListener("scroll",r),o&&b.removeEventListener("resize",r)}),u?.(),(w=g)==null||w.disconnect(),g=null,c&&cancelAnimationFrame(x)}}const Fh=ih,Lh=ch,Vh=sh,$h=uh,Bh=oh,Ga=nh,Uh=lh,zh=(e,t,r)=>{const n=new Map,s={platform:jh,...r},o={...s.platform,_c:n};return rh(e,t,{...s,platform:o})};var Hh=typeof document<"u",Wh=function(){},Zn=Hh?f.useLayoutEffect:Wh;function ts(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,n,s;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(n=r;n--!==0;)if(!ts(e[n],t[n]))return!1;return!0}if(s=Object.keys(e),r=s.length,r!==Object.keys(t).length)return!1;for(n=r;n--!==0;)if(!{}.hasOwnProperty.call(t,s[n]))return!1;for(n=r;n--!==0;){const o=s[n];if(!(o==="_owner"&&e.$$typeof)&&!ts(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function pc(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ka(e,t){const r=pc(e);return Math.round(t*r)/r}function Zs(e){const t=f.useRef(e);return Zn(()=>{t.current=e}),t}function Zh(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:n=[],platform:s,elements:{reference:o,floating:a}={},transform:i=!0,whileElementsMounted:c,open:l}=e,[h,u]=f.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[p,g]=f.useState(n);ts(p,n)||g(n);const[x,m]=f.useState(null),[y,w]=f.useState(null),b=f.useCallback(q=>{q!==A.current&&(A.current=q,m(q))},[]),C=f.useCallback(q=>{q!==P.current&&(P.current=q,w(q))},[]),S=o||x,_=a||y,A=f.useRef(null),P=f.useRef(null),O=f.useRef(h),I=c!=null,F=Zs(c),G=Zs(s),L=Zs(l),N=f.useCallback(()=>{if(!A.current||!P.current)return;const q={placement:t,strategy:r,middleware:p};G.current&&(q.platform=G.current),zh(A.current,P.current,q).then(D=>{const ie={...D,isPositioned:L.current!==!1};$.current&&!ts(O.current,ie)&&(O.current=ie,xn.flushSync(()=>{u(ie)}))})},[p,t,r,G,L]);Zn(()=>{l===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,u(q=>({...q,isPositioned:!1})))},[l]);const $=f.useRef(!1);Zn(()=>($.current=!0,()=>{$.current=!1}),[]),Zn(()=>{if(S&&(A.current=S),_&&(P.current=_),S&&_){if(F.current)return F.current(S,_,N);N()}},[S,_,N,F,I]);const X=f.useMemo(()=>({reference:A,floating:P,setReference:b,setFloating:C}),[b,C]),M=f.useMemo(()=>({reference:S,floating:_}),[S,_]),K=f.useMemo(()=>{const q={position:r,left:0,top:0};if(!M.floating)return q;const D=Ka(M.floating,h.x),ie=Ka(M.floating,h.y);return i?{...q,transform:"translate("+D+"px, "+ie+"px)",...pc(M.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:D,top:ie}},[r,i,M.floating,h.x,h.y]);return f.useMemo(()=>({...h,update:N,refs:X,elements:M,floatingStyles:K}),[h,N,X,M,K])}const qh=e=>{function t(r){return{}.hasOwnProperty.call(r,"current")}return{name:"arrow",options:e,fn(r){const{element:n,padding:s}=typeof e=="function"?e(r):e;return n&&t(n)?n.current!=null?Ga({element:n.current,padding:s}).fn(r):{}:n?Ga({element:n,padding:s}).fn(r):{}}}},Gh=(e,t)=>({...Fh(e),options:[e,t]}),Kh=(e,t)=>({...Lh(e),options:[e,t]}),Qh=(e,t)=>({...Uh(e),options:[e,t]}),Yh=(e,t)=>({...Vh(e),options:[e,t]}),Xh=(e,t)=>({...$h(e),options:[e,t]}),Jh=(e,t)=>({...Bh(e),options:[e,t]}),ep=(e,t)=>({...qh(e),options:[e,t]});var tp="Arrow",mc=f.forwardRef((e,t)=>{const{children:r,width:n=10,height:s=5,...o}=e;return d.jsx(ne.svg,{...o,ref:t,width:n,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?r:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});mc.displayName=tp;var rp=mc;function np(e){const[t,r]=f.useState(void 0);return Ne(()=>{if(e){r({width:e.offsetWidth,height:e.offsetHeight});const n=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const o=s[0];let a,i;if("borderBoxSize"in o){const c=o.borderBoxSize,l=Array.isArray(c)?c[0]:c;a=l.inlineSize,i=l.blockSize}else a=e.offsetWidth,i=e.offsetHeight;r({width:a,height:i})});return n.observe(e,{box:"border-box"}),()=>n.unobserve(e)}else r(void 0)},[e]),t}var Uo="Popper",[gc,zr]=kt(Uo),[sp,vc]=gc(Uo),yc=e=>{const{__scopePopper:t,children:r}=e,[n,s]=f.useState(null);return d.jsx(sp,{scope:t,anchor:n,onAnchorChange:s,children:r})};yc.displayName=Uo;var xc="PopperAnchor",bc=f.forwardRef((e,t)=>{const{__scopePopper:r,virtualRef:n,...s}=e,o=vc(xc,r),a=f.useRef(null),i=ue(t,a),c=f.useRef(null);return f.useEffect(()=>{const l=c.current;c.current=n?.current||a.current,l!==c.current&&o.onAnchorChange(c.current)}),n?null:d.jsx(ne.div,{...s,ref:i})});bc.displayName=xc;var zo="PopperContent",[op,ap]=gc(zo),wc=f.forwardRef((e,t)=>{const{__scopePopper:r,side:n="bottom",sideOffset:s=0,align:o="center",alignOffset:a=0,arrowPadding:i=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:h=0,sticky:u="partial",hideWhenDetached:p=!1,updatePositionStrategy:g="optimized",onPlaced:x,...m}=e,y=vc(zo,r),[w,b]=f.useState(null),C=ue(t,H=>b(H)),[S,_]=f.useState(null),A=np(S),P=A?.width??0,O=A?.height??0,I=n+(o!=="center"?"-"+o:""),F=typeof h=="number"?h:{top:0,right:0,bottom:0,left:0,...h},G=Array.isArray(l)?l:[l],L=G.length>0,N={padding:F,boundary:G.filter(cp),altBoundary:L},{refs:$,floatingStyles:X,placement:M,isPositioned:K,middlewareData:q}=Zh({strategy:"fixed",placement:I,whileElementsMounted:(...H)=>Dh(...H,{animationFrame:g==="always"}),elements:{reference:y.anchor},middleware:[Gh({mainAxis:s+O,alignmentAxis:a}),c&&Kh({mainAxis:!0,crossAxis:!1,limiter:u==="partial"?Qh():void 0,...N}),c&&Yh({...N}),Xh({...N,apply:({elements:H,rects:J,availableWidth:we,availableHeight:de})=>{const{width:pe,height:ge}=J.reference,Me=H.floating.style;Me.setProperty("--radix-popper-available-width",`${we}px`),Me.setProperty("--radix-popper-available-height",`${de}px`),Me.setProperty("--radix-popper-anchor-width",`${pe}px`),Me.setProperty("--radix-popper-anchor-height",`${ge}px`)}}),S&&ep({element:S,padding:i}),lp({arrowWidth:P,arrowHeight:O}),p&&Jh({strategy:"referenceHidden",...N})]}),[D,ie]=Cc(M),be=Oe(x);Ne(()=>{K&&be?.()},[K,be]);const Pe=q.arrow?.x,re=q.arrow?.y,ce=q.arrow?.centerOffset!==0,[le,xe]=f.useState();return Ne(()=>{w&&xe(window.getComputedStyle(w).zIndex)},[w]),d.jsx("div",{ref:$.setFloating,"data-radix-popper-content-wrapper":"",style:{...X,transform:K?X.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:le,"--radix-popper-transform-origin":[q.transformOrigin?.x,q.transformOrigin?.y].join(" "),...q.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(op,{scope:r,placedSide:D,onArrowChange:_,arrowX:Pe,arrowY:re,shouldHideArrow:ce,children:d.jsx(ne.div,{"data-side":D,"data-align":ie,...m,ref:C,style:{...m.style,animation:K?void 0:"none"}})})})});wc.displayName=zo;var _c="PopperArrow",ip={top:"bottom",right:"left",bottom:"top",left:"right"},Sc=f.forwardRef(function(t,r){const{__scopePopper:n,...s}=t,o=ap(_c,n),a=ip[o.placedSide];return d.jsx("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:d.jsx(rp,{...s,ref:r,style:{...s.style,display:"block"}})})});Sc.displayName=_c;function cp(e){return e!==null}var lp=e=>({name:"transformOrigin",options:e,fn(t){const{placement:r,rects:n,middlewareData:s}=t,a=s.arrow?.centerOffset!==0,i=a?0:e.arrowWidth,c=a?0:e.arrowHeight,[l,h]=Cc(r),u={start:"0%",center:"50%",end:"100%"}[h],p=(s.arrow?.x??0)+i/2,g=(s.arrow?.y??0)+c/2;let x="",m="";return l==="bottom"?(x=a?u:`${p}px`,m=`${-c}px`):l==="top"?(x=a?u:`${p}px`,m=`${n.floating.height+c}px`):l==="right"?(x=`${-c}px`,m=a?u:`${g}px`):l==="left"&&(x=`${n.floating.width+c}px`,m=a?u:`${g}px`),{data:{x,y:m}}}});function Cc(e){const[t,r="center"]=e.split("-");return[t,r]}var Ho=yc,Ss=bc,Wo=wc,Zo=Sc,up="Portal",Sn=f.forwardRef((e,t)=>{const{container:r,...n}=e,[s,o]=f.useState(!1);Ne(()=>o(!0),[]);const a=r||s&&globalThis?.document?.body;return a?Ji.createPortal(d.jsx(ne.div,{...n,ref:t}),a):null});Sn.displayName=up;function dp(e,t){return f.useReducer((r,n)=>t[r][n]??r,e)}var We=e=>{const{present:t,children:r}=e,n=fp(t),s=typeof r=="function"?r({present:n.isPresent}):f.Children.only(r),o=ue(n.ref,hp(s));return typeof r=="function"||n.isPresent?f.cloneElement(s,{ref:o}):null};We.displayName="Presence";function fp(e){const[t,r]=f.useState(),n=f.useRef(null),s=f.useRef(e),o=f.useRef("none"),a=e?"mounted":"unmounted",[i,c]=dp(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return f.useEffect(()=>{const l=Fn(n.current);o.current=i==="mounted"?l:"none"},[i]),Ne(()=>{const l=n.current,h=s.current;if(h!==e){const p=o.current,g=Fn(l);e?c("MOUNT"):g==="none"||l?.display==="none"?c("UNMOUNT"):c(h&&p!==g?"ANIMATION_OUT":"UNMOUNT"),s.current=e}},[e,c]),Ne(()=>{if(t){let l;const h=t.ownerDocument.defaultView??window,u=g=>{const m=Fn(n.current).includes(CSS.escape(g.animationName));if(g.target===t&&m&&(c("ANIMATION_END"),!s.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",l=h.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},p=g=>{g.target===t&&(o.current=Fn(n.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",u),t.addEventListener("animationend",u),()=>{h.clearTimeout(l),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",u),t.removeEventListener("animationend",u)}}else c("ANIMATION_END")},[t,c]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:f.useCallback(l=>{n.current=l?getComputedStyle(l):null,r(l)},[])}}function Fn(e){return e?.animationName||"none"}function hp(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 pp=Oi[" useInsertionEffect ".trim().toString()]||Ne;function Ut({prop:e,defaultProp:t,onChange:r=()=>{},caller:n}){const[s,o,a]=mp({defaultProp:t,onChange:r}),i=e!==void 0,c=i?e:s;{const h=f.useRef(e!==void 0);f.useEffect(()=>{const u=h.current;u!==i&&console.warn(`${n} is changing from ${u?"controlled":"uncontrolled"} to ${i?"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.`),h.current=i},[i,n])}const l=f.useCallback(h=>{if(i){const u=gp(h)?h(e):h;u!==e&&a.current?.(u)}else o(h)},[i,e,o,a]);return[c,l]}function mp({defaultProp:e,onChange:t}){const[r,n]=f.useState(e),s=f.useRef(r),o=f.useRef(t);return pp(()=>{o.current=t},[t]),f.useEffect(()=>{s.current!==r&&(o.current?.(r),s.current=r)},[r,s]),[r,n,o]}function gp(e){return typeof e=="function"}var vp=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Cr=new WeakMap,Ln=new WeakMap,Vn={},qs=0,Ec=function(e){return e&&(e.host||Ec(e.parentNode))},yp=function(e,t){return t.map(function(r){if(e.contains(r))return r;var n=Ec(r);return n&&e.contains(n)?n:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},xp=function(e,t,r,n){var s=yp(t,Array.isArray(e)?e:[e]);Vn[r]||(Vn[r]=new WeakMap);var o=Vn[r],a=[],i=new Set,c=new Set(s),l=function(u){!u||i.has(u)||(i.add(u),l(u.parentNode))};s.forEach(l);var h=function(u){!u||c.has(u)||Array.prototype.forEach.call(u.children,function(p){if(i.has(p))h(p);else try{var g=p.getAttribute(n),x=g!==null&&g!=="false",m=(Cr.get(p)||0)+1,y=(o.get(p)||0)+1;Cr.set(p,m),o.set(p,y),a.push(p),m===1&&x&&Ln.set(p,!0),y===1&&p.setAttribute(r,"true"),x||p.setAttribute(n,"true")}catch(w){console.error("aria-hidden: cannot operate on ",p,w)}})};return h(t),i.clear(),qs++,function(){a.forEach(function(u){var p=Cr.get(u)-1,g=o.get(u)-1;Cr.set(u,p),o.set(u,g),p||(Ln.has(u)||u.removeAttribute(n),Ln.delete(u)),g||u.removeAttribute(r)}),qs--,qs||(Cr=new WeakMap,Cr=new WeakMap,Ln=new WeakMap,Vn={})}},Cs=function(e,t,r){r===void 0&&(r="data-aria-hidden");var n=Array.from(Array.isArray(e)?e:[e]),s=vp(e);return s?(n.push.apply(n,Array.from(s.querySelectorAll("[aria-live], script"))),xp(n,s,r,"aria-hidden")):function(){return null}},wt=function(){return wt=Object.assign||function(t){for(var r,n=1,s=arguments.length;n<s;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},wt.apply(this,arguments)};function Rc(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,n=Object.getOwnPropertySymbols(e);s<n.length;s++)t.indexOf(n[s])<0&&Object.prototype.propertyIsEnumerable.call(e,n[s])&&(r[n[s]]=e[n[s]]);return r}function bp(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,o;n<s;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}var qn="right-scroll-bar-position",Gn="width-before-scroll-bar",wp="with-scroll-bars-hidden",_p="--removed-body-scroll-bar-size";function Gs(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Sp(e,t){var r=f.useState(function(){return{value:e,callback:t,facade:{get current(){return r.value},set current(n){var s=r.value;s!==n&&(r.value=n,r.callback(n,s))}}}})[0];return r.callback=t,r.facade}var Cp=typeof window<"u"?f.useLayoutEffect:f.useEffect,Qa=new WeakMap;function Ep(e,t){var r=Sp(null,function(n){return e.forEach(function(s){return Gs(s,n)})});return Cp(function(){var n=Qa.get(r);if(n){var s=new Set(n),o=new Set(e),a=r.current;s.forEach(function(i){o.has(i)||Gs(i,null)}),o.forEach(function(i){s.has(i)||Gs(i,a)})}Qa.set(r,e)},[e]),r}function Rp(e){return e}function Tp(e,t){t===void 0&&(t=Rp);var r=[],n=!1,s={read:function(){if(n)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(o){var a=t(o,n);return r.push(a),function(){r=r.filter(function(i){return i!==a})}},assignSyncMedium:function(o){for(n=!0;r.length;){var a=r;r=[],a.forEach(o)}r={push:function(i){return o(i)},filter:function(){return r}}},assignMedium:function(o){n=!0;var a=[];if(r.length){var i=r;r=[],i.forEach(o),a=r}var c=function(){var h=a;a=[],h.forEach(o)},l=function(){return Promise.resolve().then(c)};l(),r={push:function(h){a.push(h),l()},filter:function(h){return a=a.filter(h),r}}}};return s}function Pp(e){e===void 0&&(e={});var t=Tp(null);return t.options=wt({async:!0,ssr:!1},e),t}var Tc=function(e){var t=e.sideCar,r=Rc(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var n=t.read();if(!n)throw new Error("Sidecar medium not found");return f.createElement(n,wt({},r))};Tc.isSideCarExport=!0;function Ap(e,t){return e.useMedium(t),Tc}var Pc=Pp(),Ks=function(){},Es=f.forwardRef(function(e,t){var r=f.useRef(null),n=f.useState({onScrollCapture:Ks,onWheelCapture:Ks,onTouchMoveCapture:Ks}),s=n[0],o=n[1],a=e.forwardProps,i=e.children,c=e.className,l=e.removeScrollBar,h=e.enabled,u=e.shards,p=e.sideCar,g=e.noRelative,x=e.noIsolation,m=e.inert,y=e.allowPinchZoom,w=e.as,b=w===void 0?"div":w,C=e.gapMode,S=Rc(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),_=p,A=Ep([r,t]),P=wt(wt({},S),s);return f.createElement(f.Fragment,null,h&&f.createElement(_,{sideCar:Pc,removeScrollBar:l,shards:u,noRelative:g,noIsolation:x,inert:m,setCallbacks:o,allowPinchZoom:!!y,lockRef:r,gapMode:C}),a?f.cloneElement(f.Children.only(i),wt(wt({},P),{ref:A})):f.createElement(b,wt({},P,{className:c,ref:A}),i))});Es.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Es.classNames={fullWidth:Gn,zeroRight:qn};var kp=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Op(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=kp();return t&&e.setAttribute("nonce",t),e}function Np(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Mp(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var jp=function(){var e=0,t=null;return{add:function(r){e==0&&(t=Op())&&(Np(t,r),Mp(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Ip=function(){var e=jp();return function(t,r){f.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&r])}},Ac=function(){var e=Ip(),t=function(r){var n=r.styles,s=r.dynamic;return e(n,s),null};return t},Dp={left:0,top:0,right:0,gap:0},Qs=function(e){return parseInt(e||"",10)||0},Fp=function(e){var t=window.getComputedStyle(document.body),r=t[e==="padding"?"paddingLeft":"marginLeft"],n=t[e==="padding"?"paddingTop":"marginTop"],s=t[e==="padding"?"paddingRight":"marginRight"];return[Qs(r),Qs(n),Qs(s)]},Lp=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Dp;var t=Fp(e),r=document.documentElement.clientWidth,n=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,n-r+t[2]-t[0])}},Vp=Ac(),Nr="data-scroll-locked",$p=function(e,t,r,n){var s=e.left,o=e.top,a=e.right,i=e.gap;return r===void 0&&(r="margin"),`
|
|
.`.concat(wp,` {
|
|
overflow: hidden `).concat(n,`;
|
|
padding-right: `).concat(i,"px ").concat(n,`;
|
|
}
|
|
body[`).concat(Nr,`] {
|
|
overflow: hidden `).concat(n,`;
|
|
overscroll-behavior: contain;
|
|
`).concat([t&&"position: relative ".concat(n,";"),r==="margin"&&`
|
|
padding-left: `.concat(s,`px;
|
|
padding-top: `).concat(o,`px;
|
|
padding-right: `).concat(a,`px;
|
|
margin-left:0;
|
|
margin-top:0;
|
|
margin-right: `).concat(i,"px ").concat(n,`;
|
|
`),r==="padding"&&"padding-right: ".concat(i,"px ").concat(n,";")].filter(Boolean).join(""),`
|
|
}
|
|
|
|
.`).concat(qn,` {
|
|
right: `).concat(i,"px ").concat(n,`;
|
|
}
|
|
|
|
.`).concat(Gn,` {
|
|
margin-right: `).concat(i,"px ").concat(n,`;
|
|
}
|
|
|
|
.`).concat(qn," .").concat(qn,` {
|
|
right: 0 `).concat(n,`;
|
|
}
|
|
|
|
.`).concat(Gn," .").concat(Gn,` {
|
|
margin-right: 0 `).concat(n,`;
|
|
}
|
|
|
|
body[`).concat(Nr,`] {
|
|
`).concat(_p,": ").concat(i,`px;
|
|
}
|
|
`)},Ya=function(){var e=parseInt(document.body.getAttribute(Nr)||"0",10);return isFinite(e)?e:0},Bp=function(){f.useEffect(function(){return document.body.setAttribute(Nr,(Ya()+1).toString()),function(){var e=Ya()-1;e<=0?document.body.removeAttribute(Nr):document.body.setAttribute(Nr,e.toString())}},[])},Up=function(e){var t=e.noRelative,r=e.noImportant,n=e.gapMode,s=n===void 0?"margin":n;Bp();var o=f.useMemo(function(){return Lp(s)},[s]);return f.createElement(Vp,{styles:$p(o,!t,s,r?"":"!important")})},po=!1;if(typeof window<"u")try{var $n=Object.defineProperty({},"passive",{get:function(){return po=!0,!0}});window.addEventListener("test",$n,$n),window.removeEventListener("test",$n,$n)}catch{po=!1}var Er=po?{passive:!1}:!1,zp=function(e){return e.tagName==="TEXTAREA"},kc=function(e,t){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[t]!=="hidden"&&!(r.overflowY===r.overflowX&&!zp(e)&&r[t]==="visible")},Hp=function(e){return kc(e,"overflowY")},Wp=function(e){return kc(e,"overflowX")},Xa=function(e,t){var r=t.ownerDocument,n=t;do{typeof ShadowRoot<"u"&&n instanceof ShadowRoot&&(n=n.host);var s=Oc(e,n);if(s){var o=Nc(e,n),a=o[1],i=o[2];if(a>i)return!0}n=n.parentNode}while(n&&n!==r.body);return!1},Zp=function(e){var t=e.scrollTop,r=e.scrollHeight,n=e.clientHeight;return[t,r,n]},qp=function(e){var t=e.scrollLeft,r=e.scrollWidth,n=e.clientWidth;return[t,r,n]},Oc=function(e,t){return e==="v"?Hp(t):Wp(t)},Nc=function(e,t){return e==="v"?Zp(t):qp(t)},Gp=function(e,t){return e==="h"&&t==="rtl"?-1:1},Kp=function(e,t,r,n,s){var o=Gp(e,window.getComputedStyle(t).direction),a=o*n,i=r.target,c=t.contains(i),l=!1,h=a>0,u=0,p=0;do{if(!i)break;var g=Nc(e,i),x=g[0],m=g[1],y=g[2],w=m-y-o*x;(x||w)&&Oc(e,i)&&(u+=w,p+=x);var b=i.parentNode;i=b&&b.nodeType===Node.DOCUMENT_FRAGMENT_NODE?b.host:b}while(!c&&i!==document.body||c&&(t.contains(i)||t===i));return(h&&Math.abs(u)<1||!h&&Math.abs(p)<1)&&(l=!0),l},Bn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Ja=function(e){return[e.deltaX,e.deltaY]},ei=function(e){return e&&"current"in e?e.current:e},Qp=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Yp=function(e){return`
|
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
`)},Xp=0,Rr=[];function Jp(e){var t=f.useRef([]),r=f.useRef([0,0]),n=f.useRef(),s=f.useState(Xp++)[0],o=f.useState(Ac)[0],a=f.useRef(e);f.useEffect(function(){a.current=e},[e]),f.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(s));var m=bp([e.lockRef.current],(e.shards||[]).map(ei),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[e.inert,e.lockRef.current,e.shards]);var i=f.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!a.current.allowPinchZoom;var w=Bn(m),b=r.current,C="deltaX"in m?m.deltaX:b[0]-w[0],S="deltaY"in m?m.deltaY:b[1]-w[1],_,A=m.target,P=Math.abs(C)>Math.abs(S)?"h":"v";if("touches"in m&&P==="h"&&A.type==="range")return!1;var O=Xa(P,A);if(!O)return!0;if(O?_=P:(_=P==="v"?"h":"v",O=Xa(P,A)),!O)return!1;if(!n.current&&"changedTouches"in m&&(C||S)&&(n.current=_),!_)return!0;var I=n.current||_;return Kp(I,y,m,I==="h"?C:S)},[]),c=f.useCallback(function(m){var y=m;if(!(!Rr.length||Rr[Rr.length-1]!==o)){var w="deltaY"in y?Ja(y):Bn(y),b=t.current.filter(function(_){return _.name===y.type&&(_.target===y.target||y.target===_.shadowParent)&&Qp(_.delta,w)})[0];if(b&&b.should){y.cancelable&&y.preventDefault();return}if(!b){var C=(a.current.shards||[]).map(ei).filter(Boolean).filter(function(_){return _.contains(y.target)}),S=C.length>0?i(y,C[0]):!a.current.noIsolation;S&&y.cancelable&&y.preventDefault()}}},[]),l=f.useCallback(function(m,y,w,b){var C={name:m,delta:y,target:w,should:b,shadowParent:em(w)};t.current.push(C),setTimeout(function(){t.current=t.current.filter(function(S){return S!==C})},1)},[]),h=f.useCallback(function(m){r.current=Bn(m),n.current=void 0},[]),u=f.useCallback(function(m){l(m.type,Ja(m),m.target,i(m,e.lockRef.current))},[]),p=f.useCallback(function(m){l(m.type,Bn(m),m.target,i(m,e.lockRef.current))},[]);f.useEffect(function(){return Rr.push(o),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:p}),document.addEventListener("wheel",c,Er),document.addEventListener("touchmove",c,Er),document.addEventListener("touchstart",h,Er),function(){Rr=Rr.filter(function(m){return m!==o}),document.removeEventListener("wheel",c,Er),document.removeEventListener("touchmove",c,Er),document.removeEventListener("touchstart",h,Er)}},[]);var g=e.removeScrollBar,x=e.inert;return f.createElement(f.Fragment,null,x?f.createElement(o,{styles:Yp(s)}):null,g?f.createElement(Up,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function em(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const tm=Ap(Pc,Jp);var Cn=f.forwardRef(function(e,t){return f.createElement(Es,wt({},e,{ref:t,sideCar:tm}))});Cn.classNames=Es.classNames;var Rs="Popover",[Mc,pw]=kt(Rs,[zr]),En=zr(),[rm,nr]=Mc(Rs),jc=e=>{const{__scopePopover:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:a=!1}=e,i=En(t),c=f.useRef(null),[l,h]=f.useState(!1),[u,p]=Ut({prop:n,defaultProp:s??!1,onChange:o,caller:Rs});return d.jsx(Ho,{...i,children:d.jsx(rm,{scope:t,contentId:Ct(),triggerRef:c,open:u,onOpenChange:p,onOpenToggle:f.useCallback(()=>p(g=>!g),[p]),hasCustomAnchor:l,onCustomAnchorAdd:f.useCallback(()=>h(!0),[]),onCustomAnchorRemove:f.useCallback(()=>h(!1),[]),modal:a,children:r})})};jc.displayName=Rs;var Ic="PopoverAnchor",nm=f.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=nr(Ic,r),o=En(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:i}=s;return f.useEffect(()=>(a(),()=>i()),[a,i]),d.jsx(Ss,{...o,...n,ref:t})});nm.displayName=Ic;var Dc="PopoverTrigger",Fc=f.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=nr(Dc,r),o=En(r),a=ue(t,s.triggerRef),i=d.jsx(ne.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Uc(s.open),...n,ref:a,onClick:Z(e.onClick,s.onOpenToggle)});return s.hasCustomAnchor?i:d.jsx(Ss,{asChild:!0,...o,children:i})});Fc.displayName=Dc;var qo="PopoverPortal",[sm,om]=Mc(qo,{forceMount:void 0}),Lc=e=>{const{__scopePopover:t,forceMount:r,children:n,container:s}=e,o=nr(qo,t);return d.jsx(sm,{scope:t,forceMount:r,children:d.jsx(We,{present:r||o.open,children:d.jsx(Sn,{asChild:!0,container:s,children:n})})})};Lc.displayName=qo;var Ir="PopoverContent",Vc=f.forwardRef((e,t)=>{const r=om(Ir,e.__scopePopover),{forceMount:n=r.forceMount,...s}=e,o=nr(Ir,e.__scopePopover);return d.jsx(We,{present:n||o.open,children:o.modal?d.jsx(im,{...s,ref:t}):d.jsx(cm,{...s,ref:t})})});Vc.displayName=Ir;var am=dr("PopoverContent.RemoveScroll"),im=f.forwardRef((e,t)=>{const r=nr(Ir,e.__scopePopover),n=f.useRef(null),s=ue(t,n),o=f.useRef(!1);return f.useEffect(()=>{const a=n.current;if(a)return Cs(a)},[]),d.jsx(Cn,{as:am,allowPinchZoom:!0,children:d.jsx($c,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Z(e.onCloseAutoFocus,a=>{a.preventDefault(),o.current||r.triggerRef.current?.focus()}),onPointerDownOutside:Z(e.onPointerDownOutside,a=>{const i=a.detail.originalEvent,c=i.button===0&&i.ctrlKey===!0,l=i.button===2||c;o.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:Z(e.onFocusOutside,a=>a.preventDefault(),{checkForDefaultPrevented:!1})})})}),cm=f.forwardRef((e,t)=>{const r=nr(Ir,e.__scopePopover),n=f.useRef(!1),s=f.useRef(!1);return d.jsx($c,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(n.current||r.triggerRef.current?.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;r.triggerRef.current?.contains(a)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),$c=f.forwardRef((e,t)=>{const{__scopePopover:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,disableOutsidePointerEvents:a,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:h,...u}=e,p=nr(Ir,r),g=En(r);return xs(),d.jsx(wn,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:d.jsx(bn,{asChild:!0,disableOutsidePointerEvents:a,onInteractOutside:h,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>p.onOpenChange(!1),children:d.jsx(Wo,{"data-state":Uc(p.open),role:"dialog",id:p.contentId,...g,...u,ref:t,style:{...u.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)"}})})})}),Bc="PopoverClose",lm=f.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=nr(Bc,r);return d.jsx(ne.button,{type:"button",...n,ref:t,onClick:Z(e.onClick,()=>s.onOpenChange(!1))})});lm.displayName=Bc;var um="PopoverArrow",dm=f.forwardRef((e,t)=>{const{__scopePopover:r,...n}=e,s=En(r);return d.jsx(Zo,{...s,...n,ref:t})});dm.displayName=um;function Uc(e){return e?"open":"closed"}var fm=jc,hm=Fc,pm=Lc,mm=Vc;function gm({...e}){return d.jsx(fm,{"data-slot":"popover",...e})}function vm({...e}){return d.jsx(hm,{"data-slot":"popover-trigger",...e})}function ym({className:e,align:t="center",sideOffset:r=4,...n}){return d.jsx(pm,{children:d.jsx(mm,{"data-slot":"popover-content",align:t,sideOffset:r,className:he("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),...n})})}function xm(){return d.jsx(vm,{asChild:!0,children:d.jsx(bt,{size:"icon",children:d.jsx(mf,{})})})}function Go(e){const t=e+"CollectionProvider",[r,n]=kt(t),[s,o]=r(t,{collectionRef:{current:null},itemMap:new Map}),a=m=>{const{scope:y,children:w}=m,b=R.useRef(null),C=R.useRef(new Map).current;return d.jsx(s,{scope:y,itemMap:C,collectionRef:b,children:w})};a.displayName=t;const i=e+"CollectionSlot",c=dr(i),l=R.forwardRef((m,y)=>{const{scope:w,children:b}=m,C=o(i,w),S=ue(y,C.collectionRef);return d.jsx(c,{ref:S,children:b})});l.displayName=i;const h=e+"CollectionItemSlot",u="data-radix-collection-item",p=dr(h),g=R.forwardRef((m,y)=>{const{scope:w,children:b,...C}=m,S=R.useRef(null),_=ue(y,S),A=o(h,w);return R.useEffect(()=>(A.itemMap.set(S,{ref:S,...C}),()=>void A.itemMap.delete(S))),d.jsx(p,{[u]:"",ref:_,children:b})});g.displayName=h;function x(m){const y=o(e+"CollectionConsumer",m);return R.useCallback(()=>{const b=y.collectionRef.current;if(!b)return[];const C=Array.from(b.querySelectorAll(`[${u}]`));return Array.from(y.itemMap.values()).sort((A,P)=>C.indexOf(A.ref.current)-C.indexOf(P.ref.current))},[y.collectionRef,y.itemMap])}return[{Provider:a,Slot:l,ItemSlot:g},x,n]}var bm=f.createContext(void 0);function Rn(e){const t=f.useContext(bm);return e||t||"ltr"}var Ys="rovingFocusGroup.onEntryFocus",wm={bubbles:!1,cancelable:!0},Tn="RovingFocusGroup",[mo,zc,_m]=Go(Tn),[Sm,Ts]=kt(Tn,[_m]),[Cm,Em]=Sm(Tn),Hc=f.forwardRef((e,t)=>d.jsx(mo.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(mo.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(Rm,{...e,ref:t})})}));Hc.displayName=Tn;var Rm=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,orientation:n,loop:s=!1,dir:o,currentTabStopId:a,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:h=!1,...u}=e,p=f.useRef(null),g=ue(t,p),x=Rn(o),[m,y]=Ut({prop:a,defaultProp:i??null,onChange:c,caller:Tn}),[w,b]=f.useState(!1),C=Oe(l),S=zc(r),_=f.useRef(!1),[A,P]=f.useState(0);return f.useEffect(()=>{const O=p.current;if(O)return O.addEventListener(Ys,C),()=>O.removeEventListener(Ys,C)},[C]),d.jsx(Cm,{scope:r,orientation:n,dir:x,loop:s,currentTabStopId:m,onItemFocus:f.useCallback(O=>y(O),[y]),onItemShiftTab:f.useCallback(()=>b(!0),[]),onFocusableItemAdd:f.useCallback(()=>P(O=>O+1),[]),onFocusableItemRemove:f.useCallback(()=>P(O=>O-1),[]),children:d.jsx(ne.div,{tabIndex:w||A===0?-1:0,"data-orientation":n,...u,ref:g,style:{outline:"none",...e.style},onMouseDown:Z(e.onMouseDown,()=>{_.current=!0}),onFocus:Z(e.onFocus,O=>{const I=!_.current;if(O.target===O.currentTarget&&I&&!w){const F=new CustomEvent(Ys,wm);if(O.currentTarget.dispatchEvent(F),!F.defaultPrevented){const G=S().filter(M=>M.focusable),L=G.find(M=>M.active),N=G.find(M=>M.id===m),X=[L,N,...G].filter(Boolean).map(M=>M.ref.current);qc(X,h)}}_.current=!1}),onBlur:Z(e.onBlur,()=>b(!1))})})}),Wc="RovingFocusGroupItem",Zc=f.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:r,focusable:n=!0,active:s=!1,tabStopId:o,children:a,...i}=e,c=Ct(),l=o||c,h=Em(Wc,r),u=h.currentTabStopId===l,p=zc(r),{onFocusableItemAdd:g,onFocusableItemRemove:x,currentTabStopId:m}=h;return f.useEffect(()=>{if(n)return g(),()=>x()},[n,g,x]),d.jsx(mo.ItemSlot,{scope:r,id:l,focusable:n,active:s,children:d.jsx(ne.span,{tabIndex:u?0:-1,"data-orientation":h.orientation,...i,ref:t,onMouseDown:Z(e.onMouseDown,y=>{n?h.onItemFocus(l):y.preventDefault()}),onFocus:Z(e.onFocus,()=>h.onItemFocus(l)),onKeyDown:Z(e.onKeyDown,y=>{if(y.key==="Tab"&&y.shiftKey){h.onItemShiftTab();return}if(y.target!==y.currentTarget)return;const w=Am(y,h.orientation,h.dir);if(w!==void 0){if(y.metaKey||y.ctrlKey||y.altKey||y.shiftKey)return;y.preventDefault();let C=p().filter(S=>S.focusable).map(S=>S.ref.current);if(w==="last")C.reverse();else if(w==="prev"||w==="next"){w==="prev"&&C.reverse();const S=C.indexOf(y.currentTarget);C=h.loop?km(C,S+1):C.slice(S+1)}setTimeout(()=>qc(C))}}),children:typeof a=="function"?a({isCurrentTabStop:u,hasTabStop:m!=null}):a})})});Zc.displayName=Wc;var Tm={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Pm(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Am(e,t,r){const n=Pm(e.key,r);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return Tm[n]}function qc(e,t=!1){const r=document.activeElement;for(const n of e)if(n===r||(n.focus({preventScroll:t}),document.activeElement!==r))return}function km(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var Gc=Hc,Kc=Zc,Qc="Toggle",Yc=f.forwardRef((e,t)=>{const{pressed:r,defaultPressed:n,onPressedChange:s,...o}=e,[a,i]=Ut({prop:r,onChange:s,defaultProp:n??!1,caller:Qc});return d.jsx(ne.button,{type:"button","aria-pressed":a,"data-state":a?"on":"off","data-disabled":e.disabled?"":void 0,...o,ref:t,onClick:Z(e.onClick,()=>{e.disabled||i(!a)})})});Yc.displayName=Qc;var sr="ToggleGroup",[Xc,mw]=kt(sr,[Ts]),Jc=Ts(),Ko=R.forwardRef((e,t)=>{const{type:r,...n}=e;if(r==="single"){const s=n;return d.jsx(Om,{...s,ref:t})}if(r==="multiple"){const s=n;return d.jsx(Nm,{...s,ref:t})}throw new Error(`Missing prop \`type\` expected on \`${sr}\``)});Ko.displayName=sr;var[el,tl]=Xc(sr),Om=R.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=e,[a,i]=Ut({prop:r,defaultProp:n??"",onChange:s,caller:sr});return d.jsx(el,{scope:e.__scopeToggleGroup,type:"single",value:R.useMemo(()=>a?[a]:[],[a]),onItemActivate:i,onItemDeactivate:R.useCallback(()=>i(""),[i]),children:d.jsx(rl,{...o,ref:t})})}),Nm=R.forwardRef((e,t)=>{const{value:r,defaultValue:n,onValueChange:s=()=>{},...o}=e,[a,i]=Ut({prop:r,defaultProp:n??[],onChange:s,caller:sr}),c=R.useCallback(h=>i((u=[])=>[...u,h]),[i]),l=R.useCallback(h=>i((u=[])=>u.filter(p=>p!==h)),[i]);return d.jsx(el,{scope:e.__scopeToggleGroup,type:"multiple",value:a,onItemActivate:c,onItemDeactivate:l,children:d.jsx(rl,{...o,ref:t})})});Ko.displayName=sr;var[Mm,jm]=Xc(sr),rl=R.forwardRef((e,t)=>{const{__scopeToggleGroup:r,disabled:n=!1,rovingFocus:s=!0,orientation:o,dir:a,loop:i=!0,...c}=e,l=Jc(r),h=Rn(a),u={role:"group",dir:h,...c};return d.jsx(Mm,{scope:r,rovingFocus:s,disabled:n,children:s?d.jsx(Gc,{asChild:!0,...l,orientation:o,dir:h,loop:i,children:d.jsx(ne.div,{...u,ref:t})}):d.jsx(ne.div,{...u,ref:t})})}),rs="ToggleGroupItem",nl=R.forwardRef((e,t)=>{const r=tl(rs,e.__scopeToggleGroup),n=jm(rs,e.__scopeToggleGroup),s=Jc(e.__scopeToggleGroup),o=r.value.includes(e.value),a=n.disabled||e.disabled,i={...e,pressed:o,disabled:a},c=R.useRef(null);return n.rovingFocus?d.jsx(Kc,{asChild:!0,...s,focusable:!a,active:o,ref:c,children:d.jsx(ti,{...i,ref:t})}):d.jsx(ti,{...i,ref:t})});nl.displayName=rs;var ti=R.forwardRef((e,t)=>{const{__scopeToggleGroup:r,value:n,...s}=e,o=tl(rs,r),a={role:"radio","aria-checked":e.pressed,"aria-pressed":void 0},i=o.type==="single"?a:void 0;return d.jsx(Yc,{...i,...s,ref:t,onPressedChange:c=>{c?o.onItemActivate(n):o.onItemDeactivate(n)}})}),Im=Ko,Dm=nl;const Fm=Ni("inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive whitespace-nowrap",{variants:{variant:{default:"bg-transparent",outline:"border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground"},size:{default:"h-9 px-2 min-w-9",sm:"h-8 px-1.5 min-w-8",lg:"h-10 px-2.5 min-w-10"}},defaultVariants:{variant:"default",size:"default"}}),sl=f.createContext({size:"default",variant:"default"});function Lm({className:e,variant:t,size:r,children:n,...s}){return d.jsx(Im,{"data-slot":"toggle-group","data-variant":t,"data-size":r,className:he("group/toggle-group flex w-fit items-center rounded-md data-[variant=outline]:shadow-xs",e),...s,children:d.jsx(sl.Provider,{value:{variant:t,size:r},children:n})})}function ri({className:e,children:t,variant:r,size:n,...s}){const o=f.useContext(sl);return d.jsx(Dm,{"data-slot":"toggle-group-item","data-variant":o.variant||r,"data-size":o.size||n,className:he(Fm({variant:o.variant||r,size:o.size||n}),"min-w-0 flex-1 shrink-0 rounded-none shadow-none first:rounded-l-md last:rounded-r-md focus:z-10 focus-visible:z-10 data-[variant=outline]:border-l-0 data-[variant=outline]:first:border-l",e),...s,children:t})}function Vm({filter:e,setFilter:t,activeFiltersCount:r,clearFilters:n}){return d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsxs(Lm,{size:"sm",type:"single",value:e.statusFilter||"",onValueChange:s=>t({statusFilter:s||""}),className:"flex items-center gap-1 p-1 bg-muted rounded-lg",children:[d.jsxs(ri,{size:"sm",value:"listed","aria-label":"Hiển thị công khai",className:"flex items-center gap-2 px-3 py-2 rounded-md data-[state=on]:bg-green-100 data-[state=on]:text-green-700 data-[state=on]:border-green-200 hover:bg-green-50 transition-colors",children:[d.jsx(Xi,{className:"h-2 w-2"}),d.jsx("span",{className:"text-sm font-medium",children:"Listed"})]}),d.jsxs(ri,{size:"sm",value:"unlisted","aria-label":"Ẩn khỏi danh sách",className:"flex items-center gap-2 px-3 py-2 rounded-md data-[state=on]:bg-orange-100 data-[state=on]:text-orange-700 data-[state=on]:border-orange-200 hover:bg-orange-50 transition-colors",children:[d.jsx(Yi,{className:"h-2 w-2"}),d.jsx("span",{className:"text-sm font-medium",children:"Unlisted"})]})]}),r>0&&d.jsxs(bt,{variant:"outline",size:"sm",onClick:n,className:"flex items-center gap-2 text-muted-foreground hover:text-foreground bg-transparent","aria-label":"clear",children:[d.jsx(jo,{className:"h-2 w-2"}),d.jsx("span",{className:"text-sm",children:"Clear"})]})]})}function ol({color:e="black",...t}){return d.jsxs("div",{...t,className:he("flex items-center justify-center flex-col gap-4",t.className),children:[d.jsx("div",{className:he("!animate-spin rounded-full size-4 border-b-2",t.size,{"border-primary":e==="black","border-white":e==="white"})}),t.showLabel&&d.jsx("span",{children:"Đang tải..."})]})}var Pn=e=>e.type==="checkbox",lr=e=>e instanceof Date,Ve=e=>e==null;const al=e=>typeof e=="object";var Ce=e=>!Ve(e)&&!Array.isArray(e)&&al(e)&&!lr(e),il=e=>Ce(e)&&e.target?Pn(e.target)?e.target.checked:e.target.value:e,$m=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,cl=(e,t)=>e.has($m(t)),Bm=e=>{const t=e.constructor&&e.constructor.prototype;return Ce(t)&&t.hasOwnProperty("isPrototypeOf")},Qo=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Re(e){let t;const r=Array.isArray(e),n=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(Qo&&(e instanceof Blob||n))&&(r||Ce(e)))if(t=r?[]:Object.create(Object.getPrototypeOf(e)),!r&&!Bm(e))t=e;else for(const s in e)e.hasOwnProperty(s)&&(t[s]=Re(e[s]));else return e;return t}var Ps=e=>/^\w*$/.test(e),Se=e=>e===void 0,Yo=e=>Array.isArray(e)?e.filter(Boolean):[],Xo=e=>Yo(e.replace(/["|']|\]/g,"").split(/\.|\[/)),U=(e,t,r)=>{if(!t||!Ce(e))return r;const n=(Ps(t)?[t]:Xo(t)).reduce((s,o)=>Ve(s)?s:s[o],e);return Se(n)||n===e?Se(e[t])?r:e[t]:n},Ge=e=>typeof e=="boolean",ye=(e,t,r)=>{let n=-1;const s=Ps(t)?[t]:Xo(t),o=s.length,a=o-1;for(;++n<o;){const i=s[n];let c=r;if(n!==a){const l=e[i];c=Ce(l)||Array.isArray(l)?l:isNaN(+s[n+1])?{}:[]}if(i==="__proto__"||i==="constructor"||i==="prototype")return;e[i]=c,e=e[i]}};const ns={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},ut={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Mt={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Jo=R.createContext(null);Jo.displayName="HookFormContext";const As=()=>R.useContext(Jo),Um=e=>{const{children:t,...r}=e;return R.createElement(Jo.Provider,{value:r},t)};var ll=(e,t,r,n=!0)=>{const s={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(s,o,{get:()=>{const a=o;return t._proxyFormState[a]!==ut.all&&(t._proxyFormState[a]=!n||ut.all),r&&(r[a]=!0),e[a]}});return s};const ea=typeof window<"u"?R.useLayoutEffect:R.useEffect;function ul(e){const t=As(),{control:r=t.control,disabled:n,name:s,exact:o}=e||{},[a,i]=R.useState(r._formState),c=R.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return ea(()=>r._subscribe({name:s,formState:c.current,exact:o,callback:l=>{!n&&i({...r._formState,...l})}}),[s,n,o]),R.useEffect(()=>{c.current.isValid&&r._setValid(!0)},[r]),R.useMemo(()=>ll(a,r,c.current,!1),[a,r])}var St=e=>typeof e=="string",dl=(e,t,r,n,s)=>St(e)?(n&&t.watch.add(e),U(r,e,s)):Array.isArray(e)?e.map(o=>(n&&t.watch.add(o),U(r,o))):(n&&(t.watchAll=!0),r),go=e=>Ve(e)||!al(e);function Vt(e,t,r=new WeakSet){if(go(e)||go(t))return e===t;if(lr(e)&&lr(t))return e.getTime()===t.getTime();const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;if(r.has(e)||r.has(t))return!0;r.add(e),r.add(t);for(const o of n){const a=e[o];if(!s.includes(o))return!1;if(o!=="ref"){const i=t[o];if(lr(a)&&lr(i)||Ce(a)&&Ce(i)||Array.isArray(a)&&Array.isArray(i)?!Vt(a,i,r):a!==i)return!1}}return!0}function zm(e){const t=As(),{control:r=t.control,name:n,defaultValue:s,disabled:o,exact:a,compute:i}=e||{},c=R.useRef(s),l=R.useRef(i),h=R.useRef(void 0);l.current=i;const u=R.useMemo(()=>r._getWatch(n,c.current),[r,n]),[p,g]=R.useState(l.current?l.current(u):u);return ea(()=>r._subscribe({name:n,formState:{values:!0},exact:a,callback:x=>{if(!o){const m=dl(n,r._names,x.values||r._formValues,!1,c.current);if(l.current){const y=l.current(m);Vt(y,h.current)||(g(y),h.current=y)}else g(m)}}}),[r,o,n,a]),R.useEffect(()=>r._removeUnmounted()),p}function Hm(e){const t=As(),{name:r,disabled:n,control:s=t.control,shouldUnregister:o,defaultValue:a}=e,i=cl(s._names.array,r),c=R.useMemo(()=>U(s._formValues,r,U(s._defaultValues,r,a)),[s,r,a]),l=zm({control:s,name:r,defaultValue:c,exact:!0}),h=ul({control:s,name:r,exact:!0}),u=R.useRef(e),p=R.useRef(s.register(r,{...e.rules,value:l,...Ge(e.disabled)?{disabled:e.disabled}:{}}));u.current=e;const g=R.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!U(h.errors,r)},isDirty:{enumerable:!0,get:()=>!!U(h.dirtyFields,r)},isTouched:{enumerable:!0,get:()=>!!U(h.touchedFields,r)},isValidating:{enumerable:!0,get:()=>!!U(h.validatingFields,r)},error:{enumerable:!0,get:()=>U(h.errors,r)}}),[h,r]),x=R.useCallback(b=>p.current.onChange({target:{value:il(b),name:r},type:ns.CHANGE}),[r]),m=R.useCallback(()=>p.current.onBlur({target:{value:U(s._formValues,r),name:r},type:ns.BLUR}),[r,s._formValues]),y=R.useCallback(b=>{const C=U(s._fields,r);C&&b&&(C._f.ref={focus:()=>b.focus&&b.focus(),select:()=>b.select&&b.select(),setCustomValidity:S=>b.setCustomValidity(S),reportValidity:()=>b.reportValidity()})},[s._fields,r]),w=R.useMemo(()=>({name:r,value:l,...Ge(n)||h.disabled?{disabled:h.disabled||n}:{},onChange:x,onBlur:m,ref:y}),[r,n,h.disabled,x,m,y,l]);return R.useEffect(()=>{const b=s._options.shouldUnregister||o;s.register(r,{...u.current.rules,...Ge(u.current.disabled)?{disabled:u.current.disabled}:{}});const C=(S,_)=>{const A=U(s._fields,S);A&&A._f&&(A._f.mount=_)};if(C(r,!0),b){const S=Re(U(s._options.defaultValues,r));ye(s._defaultValues,r,S),Se(U(s._formValues,r))&&ye(s._formValues,r,S)}return!i&&s.register(r),()=>{(i?b&&!s._state.action:b)?s.unregister(r):C(r,!1)}},[r,s,i,o]),R.useEffect(()=>{s._setDisabledField({disabled:n,name:r})},[n,r,s]),R.useMemo(()=>({field:w,formState:h,fieldState:g}),[w,h,g])}const Wm=e=>e.render(Hm(e));var ta=(e,t,r,n,s)=>t?{...r[e],types:{...r[e]&&r[e].types?r[e].types:{},[n]:s||!0}}:{},Xr=e=>Array.isArray(e)?e:[e],ni=()=>{let e=[];return{get observers(){return e},next:s=>{for(const o of e)o.next&&o.next(s)},subscribe:s=>(e.push(s),{unsubscribe:()=>{e=e.filter(o=>o!==s)}}),unsubscribe:()=>{e=[]}}},ze=e=>Ce(e)&&!Object.keys(e).length,ra=e=>e.type==="file",dt=e=>typeof e=="function",ss=e=>{if(!Qo)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},fl=e=>e.type==="select-multiple",na=e=>e.type==="radio",Zm=e=>na(e)||Pn(e),Xs=e=>ss(e)&&e.isConnected;function qm(e,t){const r=t.slice(0,-1).length;let n=0;for(;n<r;)e=Se(e)?n++:e[t[n++]];return e}function Gm(e){for(const t in e)if(e.hasOwnProperty(t)&&!Se(e[t]))return!1;return!0}function Ee(e,t){const r=Array.isArray(t)?t:Ps(t)?[t]:Xo(t),n=r.length===1?e:qm(e,r),s=r.length-1,o=r[s];return n&&delete n[o],s!==0&&(Ce(n)&&ze(n)||Array.isArray(n)&&Gm(n))&&Ee(e,r.slice(0,-1)),e}var hl=e=>{for(const t in e)if(dt(e[t]))return!0;return!1};function os(e,t={}){const r=Array.isArray(e);if(Ce(e)||r)for(const n in e)Array.isArray(e[n])||Ce(e[n])&&!hl(e[n])?(t[n]=Array.isArray(e[n])?[]:{},os(e[n],t[n])):Ve(e[n])||(t[n]=!0);return t}function pl(e,t,r){const n=Array.isArray(e);if(Ce(e)||n)for(const s in e)Array.isArray(e[s])||Ce(e[s])&&!hl(e[s])?Se(t)||go(r[s])?r[s]=Array.isArray(e[s])?os(e[s],[]):{...os(e[s])}:pl(e[s],Ve(t)?{}:t[s],r[s]):r[s]=!Vt(e[s],t[s]);return r}var Gr=(e,t)=>pl(e,t,os(t));const si={value:!1,isValid:!1},oi={value:!0,isValid:!0};var ml=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&&!Se(e[0].attributes.value)?Se(e[0].value)||e[0].value===""?oi:{value:e[0].value,isValid:!0}:oi:si}return si},gl=(e,{valueAsNumber:t,valueAsDate:r,setValueAs:n})=>Se(e)?e:t?e===""?NaN:e&&+e:r&&St(e)?new Date(e):n?n(e):e;const ai={isValid:!1,value:null};var vl=e=>Array.isArray(e)?e.reduce((t,r)=>r&&r.checked&&!r.disabled?{isValid:!0,value:r.value}:t,ai):ai;function ii(e){const t=e.ref;return ra(t)?t.files:na(t)?vl(e.refs).value:fl(t)?[...t.selectedOptions].map(({value:r})=>r):Pn(t)?ml(e.refs).value:gl(Se(t.value)?e.ref.value:t.value,e)}var Km=(e,t,r,n)=>{const s={};for(const o of e){const a=U(t,o);a&&ye(s,o,a._f)}return{criteriaMode:r,names:[...e],fields:s,shouldUseNativeValidation:n}},as=e=>e instanceof RegExp,Kr=e=>Se(e)?e:as(e)?e.source:Ce(e)?as(e.value)?e.value.source:e.value:e,ci=e=>({isOnSubmit:!e||e===ut.onSubmit,isOnBlur:e===ut.onBlur,isOnChange:e===ut.onChange,isOnAll:e===ut.all,isOnTouch:e===ut.onTouched});const li="AsyncFunction";var Qm=e=>!!e&&!!e.validate&&!!(dt(e.validate)&&e.validate.constructor.name===li||Ce(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===li)),Ym=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),ui=(e,t,r)=>!r&&(t.watchAll||t.watch.has(e)||[...t.watch].some(n=>e.startsWith(n)&&/^\.\w+/.test(e.slice(n.length))));const Jr=(e,t,r,n)=>{for(const s of r||Object.keys(e)){const o=U(e,s);if(o){const{_f:a,...i}=o;if(a){if(a.refs&&a.refs[0]&&t(a.refs[0],s)&&!n)return!0;if(a.ref&&t(a.ref,a.name)&&!n)return!0;if(Jr(i,t))break}else if(Ce(i)&&Jr(i,t))break}}};function di(e,t,r){const n=U(e,r);if(n||Ps(r))return{error:n,name:r};const s=r.split(".");for(;s.length;){const o=s.join("."),a=U(t,o),i=U(e,o);if(a&&!Array.isArray(a)&&r!==o)return{name:r};if(i&&i.type)return{name:o,error:i};if(i&&i.root&&i.root.type)return{name:`${o}.root`,error:i.root};s.pop()}return{name:r}}var Xm=(e,t,r,n)=>{r(e);const{name:s,...o}=e;return ze(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(a=>t[a]===(!n||ut.all))},Jm=(e,t,r)=>!e||!t||e===t||Xr(e).some(n=>n&&(r?n===t:n.startsWith(t)||t.startsWith(n))),eg=(e,t,r,n,s)=>s.isOnAll?!1:!r&&s.isOnTouch?!(t||e):(r?n.isOnBlur:s.isOnBlur)?!e:(r?n.isOnChange:s.isOnChange)?e:!0,tg=(e,t)=>!Yo(U(e,t)).length&&Ee(e,t),rg=(e,t,r)=>{const n=Xr(U(e,r));return ye(n,"root",t[r]),ye(e,r,n),e},Kn=e=>St(e);function fi(e,t,r="validate"){if(Kn(e)||Array.isArray(e)&&e.every(Kn)||Ge(e)&&!e)return{type:r,message:Kn(e)?e:"",ref:t}}var Tr=e=>Ce(e)&&!as(e)?e:{value:e,message:""},hi=async(e,t,r,n,s,o)=>{const{ref:a,refs:i,required:c,maxLength:l,minLength:h,min:u,max:p,pattern:g,validate:x,name:m,valueAsNumber:y,mount:w}=e._f,b=U(r,m);if(!w||t.has(m))return{};const C=i?i[0]:a,S=L=>{s&&C.reportValidity&&(C.setCustomValidity(Ge(L)?"":L||""),C.reportValidity())},_={},A=na(a),P=Pn(a),O=A||P,I=(y||ra(a))&&Se(a.value)&&Se(b)||ss(a)&&a.value===""||b===""||Array.isArray(b)&&!b.length,F=ta.bind(null,m,n,_),G=(L,N,$,X=Mt.maxLength,M=Mt.minLength)=>{const K=L?N:$;_[m]={type:L?X:M,message:K,ref:a,...F(L?X:M,K)}};if(o?!Array.isArray(b)||!b.length:c&&(!O&&(I||Ve(b))||Ge(b)&&!b||P&&!ml(i).isValid||A&&!vl(i).isValid)){const{value:L,message:N}=Kn(c)?{value:!!c,message:c}:Tr(c);if(L&&(_[m]={type:Mt.required,message:N,ref:C,...F(Mt.required,N)},!n))return S(N),_}if(!I&&(!Ve(u)||!Ve(p))){let L,N;const $=Tr(p),X=Tr(u);if(!Ve(b)&&!isNaN(b)){const M=a.valueAsNumber||b&&+b;Ve($.value)||(L=M>$.value),Ve(X.value)||(N=M<X.value)}else{const M=a.valueAsDate||new Date(b),K=ie=>new Date(new Date().toDateString()+" "+ie),q=a.type=="time",D=a.type=="week";St($.value)&&b&&(L=q?K(b)>K($.value):D?b>$.value:M>new Date($.value)),St(X.value)&&b&&(N=q?K(b)<K(X.value):D?b<X.value:M<new Date(X.value))}if((L||N)&&(G(!!L,$.message,X.message,Mt.max,Mt.min),!n))return S(_[m].message),_}if((l||h)&&!I&&(St(b)||o&&Array.isArray(b))){const L=Tr(l),N=Tr(h),$=!Ve(L.value)&&b.length>+L.value,X=!Ve(N.value)&&b.length<+N.value;if(($||X)&&(G($,L.message,N.message),!n))return S(_[m].message),_}if(g&&!I&&St(b)){const{value:L,message:N}=Tr(g);if(as(L)&&!b.match(L)&&(_[m]={type:Mt.pattern,message:N,ref:a,...F(Mt.pattern,N)},!n))return S(N),_}if(x){if(dt(x)){const L=await x(b,r),N=fi(L,C);if(N&&(_[m]={...N,...F(Mt.validate,N.message)},!n))return S(N.message),_}else if(Ce(x)){let L={};for(const N in x){if(!ze(L)&&!n)break;const $=fi(await x[N](b,r),C,N);$&&(L={...$,...F(N,$.message)},S($.message),n&&(_[m]=L))}if(!ze(L)&&(_[m]={ref:C,...L},!n))return _}}return S(!0),_};const ng={mode:ut.onSubmit,reValidateMode:ut.onChange,shouldFocusError:!0};function sg(e={}){let t={...ng,...e},r={submitCount:0,isDirty:!1,isReady:!1,isLoading:dt(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},n={},s=Ce(t.defaultValues)||Ce(t.values)?Re(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:Re(s),a={action:!1,mount:!1,watch:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,l=0;const h={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let u={...h};const p={array:ni(),state:ni()},g=t.criteriaMode===ut.all,x=v=>E=>{clearTimeout(l),l=setTimeout(v,E)},m=async v=>{if(!t.disabled&&(h.isValid||u.isValid||v)){const E=t.resolver?ze((await P()).errors):await I(n,!0);E!==r.isValid&&p.state.next({isValid:E})}},y=(v,E)=>{!t.disabled&&(h.isValidating||h.validatingFields||u.isValidating||u.validatingFields)&&((v||Array.from(i.mount)).forEach(T=>{T&&(E?ye(r.validatingFields,T,E):Ee(r.validatingFields,T))}),p.state.next({validatingFields:r.validatingFields,isValidating:!ze(r.validatingFields)}))},w=(v,E=[],T,B,V=!0,j=!0)=>{if(B&&T&&!t.disabled){if(a.action=!0,j&&Array.isArray(U(n,v))){const Y=T(U(n,v),B.argA,B.argB);V&&ye(n,v,Y)}if(j&&Array.isArray(U(r.errors,v))){const Y=T(U(r.errors,v),B.argA,B.argB);V&&ye(r.errors,v,Y),tg(r.errors,v)}if((h.touchedFields||u.touchedFields)&&j&&Array.isArray(U(r.touchedFields,v))){const Y=T(U(r.touchedFields,v),B.argA,B.argB);V&&ye(r.touchedFields,v,Y)}(h.dirtyFields||u.dirtyFields)&&(r.dirtyFields=Gr(s,o)),p.state.next({name:v,isDirty:G(v,E),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else ye(o,v,E)},b=(v,E)=>{ye(r.errors,v,E),p.state.next({errors:r.errors})},C=v=>{r.errors=v,p.state.next({errors:r.errors,isValid:!1})},S=(v,E,T,B)=>{const V=U(n,v);if(V){const j=U(o,v,Se(T)?U(s,v):T);Se(j)||B&&B.defaultChecked||E?ye(o,v,E?j:ii(V._f)):$(v,j),a.mount&&m()}},_=(v,E,T,B,V)=>{let j=!1,Y=!1;const me={name:v};if(!t.disabled){if(!T||B){(h.isDirty||u.isDirty)&&(Y=r.isDirty,r.isDirty=me.isDirty=G(),j=Y!==me.isDirty);const ve=Vt(U(s,v),E);Y=!!U(r.dirtyFields,v),ve?Ee(r.dirtyFields,v):ye(r.dirtyFields,v,!0),me.dirtyFields=r.dirtyFields,j=j||(h.dirtyFields||u.dirtyFields)&&Y!==!ve}if(T){const ve=U(r.touchedFields,v);ve||(ye(r.touchedFields,v,T),me.touchedFields=r.touchedFields,j=j||(h.touchedFields||u.touchedFields)&&ve!==T)}j&&V&&p.state.next(me)}return j?me:{}},A=(v,E,T,B)=>{const V=U(r.errors,v),j=(h.isValid||u.isValid)&&Ge(E)&&r.isValid!==E;if(t.delayError&&T?(c=x(()=>b(v,T)),c(t.delayError)):(clearTimeout(l),c=null,T?ye(r.errors,v,T):Ee(r.errors,v)),(T?!Vt(V,T):V)||!ze(B)||j){const Y={...B,...j&&Ge(E)?{isValid:E}:{},errors:r.errors,name:v};r={...r,...Y},p.state.next(Y)}},P=async v=>{y(v,!0);const E=await t.resolver(o,t.context,Km(v||i.mount,n,t.criteriaMode,t.shouldUseNativeValidation));return y(v),E},O=async v=>{const{errors:E}=await P(v);if(v)for(const T of v){const B=U(E,T);B?ye(r.errors,T,B):Ee(r.errors,T)}else r.errors=E;return E},I=async(v,E,T={valid:!0})=>{for(const B in v){const V=v[B];if(V){const{_f:j,...Y}=V;if(j){const me=i.array.has(j.name),ve=V._f&&Qm(V._f);ve&&h.validatingFields&&y([B],!0);const je=await hi(V,i.disabled,o,g,t.shouldUseNativeValidation&&!E,me);if(ve&&h.validatingFields&&y([B]),je[j.name]&&(T.valid=!1,E))break;!E&&(U(je,j.name)?me?rg(r.errors,je,j.name):ye(r.errors,j.name,je[j.name]):Ee(r.errors,j.name))}!ze(Y)&&await I(Y,E,T)}}return T.valid},F=()=>{for(const v of i.unMount){const E=U(n,v);E&&(E._f.refs?E._f.refs.every(T=>!Xs(T)):!Xs(E._f.ref))&&H(v)}i.unMount=new Set},G=(v,E)=>!t.disabled&&(v&&E&&ye(o,v,E),!Vt(ie(),s)),L=(v,E,T)=>dl(v,i,{...a.mount?o:Se(E)?s:St(v)?{[v]:E}:E},T,E),N=v=>Yo(U(a.mount?o:s,v,t.shouldUnregister?U(s,v,[]):[])),$=(v,E,T={})=>{const B=U(n,v);let V=E;if(B){const j=B._f;j&&(!j.disabled&&ye(o,v,gl(E,j)),V=ss(j.ref)&&Ve(E)?"":E,fl(j.ref)?[...j.ref.options].forEach(Y=>Y.selected=V.includes(Y.value)):j.refs?Pn(j.ref)?j.refs.forEach(Y=>{(!Y.defaultChecked||!Y.disabled)&&(Array.isArray(V)?Y.checked=!!V.find(me=>me===Y.value):Y.checked=V===Y.value||!!V)}):j.refs.forEach(Y=>Y.checked=Y.value===V):ra(j.ref)?j.ref.value="":(j.ref.value=V,j.ref.type||p.state.next({name:v,values:Re(o)})))}(T.shouldDirty||T.shouldTouch)&&_(v,V,T.shouldTouch,T.shouldDirty,!0),T.shouldValidate&&D(v)},X=(v,E,T)=>{for(const B in E){if(!E.hasOwnProperty(B))return;const V=E[B],j=v+"."+B,Y=U(n,j);(i.array.has(v)||Ce(V)||Y&&!Y._f)&&!lr(V)?X(j,V,T):$(j,V,T)}},M=(v,E,T={})=>{const B=U(n,v),V=i.array.has(v),j=Re(E);ye(o,v,j),V?(p.array.next({name:v,values:Re(o)}),(h.isDirty||h.dirtyFields||u.isDirty||u.dirtyFields)&&T.shouldDirty&&p.state.next({name:v,dirtyFields:Gr(s,o),isDirty:G(v,j)})):B&&!B._f&&!Ve(j)?X(v,j,T):$(v,j,T),ui(v,i)&&p.state.next({...r,name:v}),p.state.next({name:a.mount?v:void 0,values:Re(o)})},K=async v=>{a.mount=!0;const E=v.target;let T=E.name,B=!0;const V=U(n,T),j=ve=>{B=Number.isNaN(ve)||lr(ve)&&isNaN(ve.getTime())||Vt(ve,U(o,T,ve))},Y=ci(t.mode),me=ci(t.reValidateMode);if(V){let ve,je;const ot=E.type?ii(V._f):il(v),at=v.type===ns.BLUR||v.type===ns.FOCUS_OUT,Zt=!Ym(V._f)&&!t.resolver&&!U(r.errors,T)&&!V._f.deps||eg(at,U(r.touchedFields,T),r.isSubmitted,me,Y),Wr=ui(T,i,at);ye(o,T,ot),at?(!E||!E.readOnly)&&(V._f.onBlur&&V._f.onBlur(v),c&&c(0)):V._f.onChange&&V._f.onChange(v);const Zr=_(T,ot,at),Nn=!ze(Zr)||Wr;if(!at&&p.state.next({name:T,type:v.type,values:Re(o)}),Zt)return(h.isValid||u.isValid)&&(t.mode==="onBlur"?at&&m():at||m()),Nn&&p.state.next({name:T,...Wr?{}:Zr});if(!at&&Wr&&p.state.next({...r}),t.resolver){const{errors:qr}=await P([T]);if(j(ot),B){const Bs=di(r.errors,n,T),Sr=di(qr,n,Bs.name||T);ve=Sr.error,T=Sr.name,je=ze(qr)}}else y([T],!0),ve=(await hi(V,i.disabled,o,g,t.shouldUseNativeValidation))[T],y([T]),j(ot),B&&(ve?je=!1:(h.isValid||u.isValid)&&(je=await I(n,!0)));B&&(V._f.deps&&D(V._f.deps),A(T,je,ve,Zr))}},q=(v,E)=>{if(U(r.errors,E)&&v.focus)return v.focus(),1},D=async(v,E={})=>{let T,B;const V=Xr(v);if(t.resolver){const j=await O(Se(v)?v:V);T=ze(j),B=v?!V.some(Y=>U(j,Y)):T}else v?(B=(await Promise.all(V.map(async j=>{const Y=U(n,j);return await I(Y&&Y._f?{[j]:Y}:Y)}))).every(Boolean),!(!B&&!r.isValid)&&m()):B=T=await I(n);return p.state.next({...!St(v)||(h.isValid||u.isValid)&&T!==r.isValid?{}:{name:v},...t.resolver||!v?{isValid:T}:{},errors:r.errors}),E.shouldFocus&&!B&&Jr(n,q,v?V:i.mount),B},ie=v=>{const E={...a.mount?o:s};return Se(v)?E:St(v)?U(E,v):v.map(T=>U(E,T))},be=(v,E)=>({invalid:!!U((E||r).errors,v),isDirty:!!U((E||r).dirtyFields,v),error:U((E||r).errors,v),isValidating:!!U(r.validatingFields,v),isTouched:!!U((E||r).touchedFields,v)}),Pe=v=>{v&&Xr(v).forEach(E=>Ee(r.errors,E)),p.state.next({errors:v?r.errors:{}})},re=(v,E,T)=>{const B=(U(n,v,{_f:{}})._f||{}).ref,V=U(r.errors,v)||{},{ref:j,message:Y,type:me,...ve}=V;ye(r.errors,v,{...ve,...E,ref:B}),p.state.next({name:v,errors:r.errors,isValid:!1}),T&&T.shouldFocus&&B&&B.focus&&B.focus()},ce=(v,E)=>dt(v)?p.state.subscribe({next:T=>"values"in T&&v(L(void 0,E),T)}):L(v,E,!0),le=v=>p.state.subscribe({next:E=>{Jm(v.name,E.name,v.exact)&&Xm(E,v.formState||h,st,v.reRenderRoot)&&v.callback({values:{...o},...r,...E,defaultValues:s})}}).unsubscribe,xe=v=>(a.mount=!0,u={...u,...v.formState},le({...v,formState:u})),H=(v,E={})=>{for(const T of v?Xr(v):i.mount)i.mount.delete(T),i.array.delete(T),E.keepValue||(Ee(n,T),Ee(o,T)),!E.keepError&&Ee(r.errors,T),!E.keepDirty&&Ee(r.dirtyFields,T),!E.keepTouched&&Ee(r.touchedFields,T),!E.keepIsValidating&&Ee(r.validatingFields,T),!t.shouldUnregister&&!E.keepDefaultValue&&Ee(s,T);p.state.next({values:Re(o)}),p.state.next({...r,...E.keepDirty?{isDirty:G()}:{}}),!E.keepIsValid&&m()},J=({disabled:v,name:E})=>{(Ge(v)&&a.mount||v||i.disabled.has(E))&&(v?i.disabled.add(E):i.disabled.delete(E))},we=(v,E={})=>{let T=U(n,v);const B=Ge(E.disabled)||Ge(t.disabled);return ye(n,v,{...T||{},_f:{...T&&T._f?T._f:{ref:{name:v}},name:v,mount:!0,...E}}),i.mount.add(v),T?J({disabled:Ge(E.disabled)?E.disabled:t.disabled,name:v}):S(v,!0,E.value),{...B?{disabled:E.disabled||t.disabled}:{},...t.progressive?{required:!!E.required,min:Kr(E.min),max:Kr(E.max),minLength:Kr(E.minLength),maxLength:Kr(E.maxLength),pattern:Kr(E.pattern)}:{},name:v,onChange:K,onBlur:K,ref:V=>{if(V){we(v,E),T=U(n,v);const j=Se(V.value)&&V.querySelectorAll&&V.querySelectorAll("input,select,textarea")[0]||V,Y=Zm(j),me=T._f.refs||[];if(Y?me.find(ve=>ve===j):j===T._f.ref)return;ye(n,v,{_f:{...T._f,...Y?{refs:[...me.filter(Xs),j,...Array.isArray(U(s,v))?[{}]:[]],ref:{type:j.type,name:v}}:{ref:j}}}),S(v,!1,void 0,j)}else T=U(n,v,{}),T._f&&(T._f.mount=!1),(t.shouldUnregister||E.shouldUnregister)&&!(cl(i.array,v)&&a.action)&&i.unMount.add(v)}}},de=()=>t.shouldFocusError&&Jr(n,q,i.mount),pe=v=>{Ge(v)&&(p.state.next({disabled:v}),Jr(n,(E,T)=>{const B=U(n,T);B&&(E.disabled=B._f.disabled||v,Array.isArray(B._f.refs)&&B._f.refs.forEach(V=>{V.disabled=B._f.disabled||v}))},0,!1))},ge=(v,E)=>async T=>{let B;T&&(T.preventDefault&&T.preventDefault(),T.persist&&T.persist());let V=Re(o);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:j,values:Y}=await P();r.errors=j,V=Re(Y)}else await I(n);if(i.disabled.size)for(const j of i.disabled)Ee(V,j);if(Ee(r.errors,"root"),ze(r.errors)){p.state.next({errors:{}});try{await v(V,T)}catch(j){B=j}}else E&&await E({...r.errors},T),de(),setTimeout(de);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:ze(r.errors)&&!B,submitCount:r.submitCount+1,errors:r.errors}),B)throw B},Me=(v,E={})=>{U(n,v)&&(Se(E.defaultValue)?M(v,Re(U(s,v))):(M(v,E.defaultValue),ye(s,v,Re(E.defaultValue))),E.keepTouched||Ee(r.touchedFields,v),E.keepDirty||(Ee(r.dirtyFields,v),r.isDirty=E.defaultValue?G(v,Re(U(s,v))):G()),E.keepError||(Ee(r.errors,v),h.isValid&&m()),p.state.next({...r}))},Ue=(v,E={})=>{const T=v?Re(v):s,B=Re(T),V=ze(v),j=V?s:B;if(E.keepDefaultValues||(s=T),!E.keepValues){if(E.keepDirtyValues){const Y=new Set([...i.mount,...Object.keys(Gr(s,o))]);for(const me of Array.from(Y))U(r.dirtyFields,me)?ye(j,me,U(o,me)):M(me,U(j,me))}else{if(Qo&&Se(v))for(const Y of i.mount){const me=U(n,Y);if(me&&me._f){const ve=Array.isArray(me._f.refs)?me._f.refs[0]:me._f.ref;if(ss(ve)){const je=ve.closest("form");if(je){je.reset();break}}}}if(E.keepFieldsRef)for(const Y of i.mount)M(Y,U(j,Y));else n={}}o=t.shouldUnregister?E.keepDefaultValues?Re(s):{}:Re(j),p.array.next({values:{...j}}),p.state.next({values:{...j}})}i={mount:E.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},a.mount=!h.isValid||!!E.keepIsValid||!!E.keepDirtyValues,a.watch=!!t.shouldUnregister,p.state.next({submitCount:E.keepSubmitCount?r.submitCount:0,isDirty:V?!1:E.keepDirty?r.isDirty:!!(E.keepDefaultValues&&!Vt(v,s)),isSubmitted:E.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:V?{}:E.keepDirtyValues?E.keepDefaultValues&&o?Gr(s,o):r.dirtyFields:E.keepDefaultValues&&v?Gr(s,v):E.keepDirty?r.dirtyFields:{},touchedFields:E.keepTouched?r.touchedFields:{},errors:E.keepErrors?r.errors:{},isSubmitSuccessful:E.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:s})},Ht=(v,E)=>Ue(dt(v)?v(o):v,E),Wt=(v,E={})=>{const T=U(n,v),B=T&&T._f;if(B){const V=B.refs?B.refs[0]:B.ref;V.focus&&(V.focus(),E.shouldSelect&&dt(V.select)&&V.select())}},st=v=>{r={...r,...v}},Xe={control:{register:we,unregister:H,getFieldState:be,handleSubmit:ge,setError:re,_subscribe:le,_runSchema:P,_focusError:de,_getWatch:L,_getDirty:G,_setValid:m,_setFieldArray:w,_setDisabledField:J,_setErrors:C,_getFieldArray:N,_reset:Ue,_resetDefaultValues:()=>dt(t.defaultValues)&&t.defaultValues().then(v=>{Ht(v,t.resetOptions),p.state.next({isLoading:!1})}),_removeUnmounted:F,_disableForm:pe,_subjects:p,_proxyFormState:h,get _fields(){return n},get _formValues(){return o},get _state(){return a},set _state(v){a=v},get _defaultValues(){return s},get _names(){return i},set _names(v){i=v},get _formState(){return r},get _options(){return t},set _options(v){t={...t,...v}}},subscribe:xe,trigger:D,register:we,handleSubmit:ge,watch:ce,setValue:M,getValues:ie,reset:Ht,resetField:Me,clearErrors:Pe,unregister:H,setError:re,setFocus:Wt,getFieldState:be};return{...Xe,formControl:Xe}}function og(e={}){const t=R.useRef(void 0),r=R.useRef(void 0),[n,s]=R.useState({isDirty:!1,isValidating:!1,isLoading:dt(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:dt(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:n},e.defaultValues&&!dt(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:a,...i}=sg(e);t.current={...i,formState:n}}const o=t.current.control;return o._options=e,ea(()=>{const a=o._subscribe({formState:o._proxyFormState,callback:()=>s({...o._formState}),reRenderRoot:!0});return s(i=>({...i,isReady:!0})),o._formState.isReady=!0,a},[o]),R.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),R.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),R.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),R.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),R.useEffect(()=>{if(o._proxyFormState.isDirty){const a=o._getDirty();a!==n.isDirty&&o._subjects.state.next({isDirty:a})}},[o,n.isDirty]),R.useEffect(()=>{e.values&&!Vt(e.values,r.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),r.current=e.values,s(a=>({...a}))):o._resetDefaultValues()},[o,e.values]),R.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=ll(n,o),t.current}const pi=(e,t,r)=>{if(e&&"reportValidity"in e){const n=U(r,t);e.setCustomValidity(n&&n.message||""),e.reportValidity()}},vo=(e,t)=>{for(const r in t.fields){const n=t.fields[r];n&&n.ref&&"reportValidity"in n.ref?pi(n.ref,r,e):n&&n.refs&&n.refs.forEach(s=>pi(s,r,e))}},mi=(e,t)=>{t.shouldUseNativeValidation&&vo(e,t);const r={};for(const n in e){const s=U(t.fields,n),o=Object.assign(e[n]||{},{ref:s&&s.ref});if(ag(t.names||Object.keys(e),n)){const a=Object.assign({},U(r,n));ye(a,"root",o),ye(r,n,a)}else ye(r,n,o)}return r},ag=(e,t)=>{const r=gi(t);return e.some(n=>gi(n).match(`^${r}\\.\\d+`))};function gi(e){return e.replace(/\]|\[/g,"")}function yl(e,t,r){function n(i,c){var l;Object.defineProperty(i,"_zod",{value:i._zod??{},enumerable:!1}),(l=i._zod).traits??(l.traits=new Set),i._zod.traits.add(e),t(i,c);for(const h in a.prototype)h in i||Object.defineProperty(i,h,{value:a.prototype[h].bind(i)});i._zod.constr=a,i._zod.def=c}const s=r?.Parent??Object;class o extends s{}Object.defineProperty(o,"name",{value:e});function a(i){var c;const l=r?.Parent?new o:this;n(l,i),(c=l._zod).deferred??(c.deferred=[]);for(const h of l._zod.deferred)h();return l}return Object.defineProperty(a,"init",{value:n}),Object.defineProperty(a,Symbol.hasInstance,{value:i=>r?.Parent&&i instanceof r.Parent?!0:i?._zod?.traits?.has(e)}),Object.defineProperty(a,"name",{value:e}),a}class ig extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const cg={};function xl(e){return cg}function lg(e,t){return typeof t=="bigint"?t.toString():t}const bl="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Un(e){return typeof e=="string"?e:e?.message}function wl(e,t,r){const n={...e,path:e.path??[]};if(!e.message){const s=Un(e.inst?._zod.def?.error?.(e))??Un(t?.error?.(e))??Un(r.customError?.(e))??Un(r.localeError?.(e))??"Invalid input";n.message=s}return delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}const _l=(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,lg,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ug=yl("$ZodError",_l),Sl=yl("$ZodError",_l,{Parent:Error}),dg=e=>(t,r,n,s)=>{const o=n?Object.assign(n,{async:!1}):{async:!1},a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise)throw new ig;if(a.issues.length){const i=new(s?.Err??e)(a.issues.map(c=>wl(c,o,xl())));throw bl(i,s?.callee),i}return a.value},fg=dg(Sl),hg=e=>async(t,r,n,s)=>{const o=n?Object.assign(n,{async:!0}):{async:!0};let a=t._zod.run({value:r,issues:[]},o);if(a instanceof Promise&&(a=await a),a.issues.length){const i=new(s?.Err??e)(a.issues.map(c=>wl(c,o,xl())));throw bl(i,s?.callee),i}return a.value},pg=hg(Sl);function vi(e,t){try{var r=e()}catch(n){return t(n)}return r&&r.then?r.then(void 0,t):r}function mg(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,a=n.path.join(".");if(!r[a])if("unionErrors"in n){var i=n.unionErrors[0].errors[0];r[a]={message:i.message,type:i.code}}else r[a]={message:o,type:s};if("unionErrors"in n&&n.unionErrors.forEach(function(h){return h.errors.forEach(function(u){return e.push(u)})}),t){var c=r[a].types,l=c&&c[n.code];r[a]=ta(a,t,r,s,l?[].concat(l,n.message):n.message)}e.shift()}return r}function gg(e,t){for(var r={};e.length;){var n=e[0],s=n.code,o=n.message,a=n.path.join(".");if(!r[a])if(n.code==="invalid_union"&&n.errors.length>0){var i=n.errors[0][0];r[a]={message:i.message,type:i.code}}else r[a]={message:o,type:s};if(n.code==="invalid_union"&&n.errors.forEach(function(h){return h.forEach(function(u){return e.push(u)})}),t){var c=r[a].types,l=c&&c[n.code];r[a]=ta(a,t,r,s,l?[].concat(l,n.message):n.message)}e.shift()}return r}function vg(e,t,r){if(r===void 0&&(r={}),(function(n){return"_def"in n&&typeof n._def=="object"&&"typeName"in n._def})(e))return function(n,s,o){try{return Promise.resolve(vi(function(){return Promise.resolve(e[r.mode==="sync"?"parse":"parseAsync"](n,t)).then(function(a){return o.shouldUseNativeValidation&&vo({},o),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return Array.isArray(i?.issues)})(a))return{values:{},errors:mi(mg(a.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw a}))}catch(a){return Promise.reject(a)}};if((function(n){return"_zod"in n&&typeof n._zod=="object"})(e))return function(n,s,o){try{return Promise.resolve(vi(function(){return Promise.resolve((r.mode==="sync"?fg:pg)(e,n,t)).then(function(a){return o.shouldUseNativeValidation&&vo({},o),{errors:{},values:r.raw?Object.assign({},n):a}})},function(a){if((function(i){return i instanceof ug})(a))return{values:{},errors:mi(gg(a.issues,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw a}))}catch(a){return Promise.reject(a)}};throw new Error("Invalid input: not a Zod schema")}const yg=Ni("inline-flex items-center justify-center rounded-md 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 Cl({className:e,variant:t,asChild:r=!1,...n}){const s=r?Mi:"span";return d.jsx(s,{"data-slot":"badge",className:he(yg({variant:t}),e),...n})}function Js({className:e,...t}){return d.jsx("div",{"data-slot":"card",className:he("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e),...t})}function eo({className:e,...t}){return d.jsx("div",{"data-slot":"card-content",className:he("px-6",e),...t})}var ks="Dialog",[El,gw]=kt(ks),[xg,vt]=El(ks),Rl=e=>{const{__scopeDialog:t,children:r,open:n,defaultOpen:s,onOpenChange:o,modal:a=!0}=e,i=f.useRef(null),c=f.useRef(null),[l,h]=Ut({prop:n,defaultProp:s??!1,onChange:o,caller:ks});return d.jsx(xg,{scope:t,triggerRef:i,contentRef:c,contentId:Ct(),titleId:Ct(),descriptionId:Ct(),open:l,onOpenChange:h,onOpenToggle:f.useCallback(()=>h(u=>!u),[h]),modal:a,children:r})};Rl.displayName=ks;var Tl="DialogTrigger",Pl=f.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=vt(Tl,r),o=ue(t,s.triggerRef);return d.jsx(ne.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":aa(s.open),...n,ref:o,onClick:Z(e.onClick,s.onOpenToggle)})});Pl.displayName=Tl;var sa="DialogPortal",[bg,Al]=El(sa,{forceMount:void 0}),kl=e=>{const{__scopeDialog:t,forceMount:r,children:n,container:s}=e,o=vt(sa,t);return d.jsx(bg,{scope:t,forceMount:r,children:f.Children.map(n,a=>d.jsx(We,{present:r||o.open,children:d.jsx(Sn,{asChild:!0,container:s,children:a})}))})};kl.displayName=sa;var is="DialogOverlay",Ol=f.forwardRef((e,t)=>{const r=Al(is,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=vt(is,e.__scopeDialog);return o.modal?d.jsx(We,{present:n||o.open,children:d.jsx(_g,{...s,ref:t})}):null});Ol.displayName=is;var wg=dr("DialogOverlay.RemoveScroll"),_g=f.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=vt(is,r);return d.jsx(Cn,{as:wg,allowPinchZoom:!0,shards:[s.contentRef],children:d.jsx(ne.div,{"data-state":aa(s.open),...n,ref:t,style:{pointerEvents:"auto",...n.style}})})}),mr="DialogContent",Nl=f.forwardRef((e,t)=>{const r=Al(mr,e.__scopeDialog),{forceMount:n=r.forceMount,...s}=e,o=vt(mr,e.__scopeDialog);return d.jsx(We,{present:n||o.open,children:o.modal?d.jsx(Sg,{...s,ref:t}):d.jsx(Cg,{...s,ref:t})})});Nl.displayName=mr;var Sg=f.forwardRef((e,t)=>{const r=vt(mr,e.__scopeDialog),n=f.useRef(null),s=ue(t,r.contentRef,n);return f.useEffect(()=>{const o=n.current;if(o)return Cs(o)},[]),d.jsx(Ml,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Z(e.onCloseAutoFocus,o=>{o.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:Z(e.onPointerDownOutside,o=>{const a=o.detail.originalEvent,i=a.button===0&&a.ctrlKey===!0;(a.button===2||i)&&o.preventDefault()}),onFocusOutside:Z(e.onFocusOutside,o=>o.preventDefault())})}),Cg=f.forwardRef((e,t)=>{const r=vt(mr,e.__scopeDialog),n=f.useRef(!1),s=f.useRef(!1);return d.jsx(Ml,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{e.onCloseAutoFocus?.(o),o.defaultPrevented||(n.current||r.triggerRef.current?.focus(),o.preventDefault()),n.current=!1,s.current=!1},onInteractOutside:o=>{e.onInteractOutside?.(o),o.defaultPrevented||(n.current=!0,o.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const a=o.target;r.triggerRef.current?.contains(a)&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&s.current&&o.preventDefault()}})}),Ml=f.forwardRef((e,t)=>{const{__scopeDialog:r,trapFocus:n,onOpenAutoFocus:s,onCloseAutoFocus:o,...a}=e,i=vt(mr,r),c=f.useRef(null),l=ue(t,c);return xs(),d.jsxs(d.Fragment,{children:[d.jsx(wn,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:s,onUnmountAutoFocus:o,children:d.jsx(bn,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":aa(i.open),...a,ref:l,onDismiss:()=>i.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(Rg,{titleId:i.titleId}),d.jsx(Pg,{contentRef:c,descriptionId:i.descriptionId})]})]})}),oa="DialogTitle",jl=f.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=vt(oa,r);return d.jsx(ne.h2,{id:s.titleId,...n,ref:t})});jl.displayName=oa;var Il="DialogDescription",Eg=f.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=vt(Il,r);return d.jsx(ne.p,{id:s.descriptionId,...n,ref:t})});Eg.displayName=Il;var Dl="DialogClose",Fl=f.forwardRef((e,t)=>{const{__scopeDialog:r,...n}=e,s=vt(Dl,r);return d.jsx(ne.button,{type:"button",...n,ref:t,onClick:Z(e.onClick,()=>s.onOpenChange(!1))})});Fl.displayName=Dl;function aa(e){return e?"open":"closed"}var Ll="DialogTitleWarning",[vw,Vl]=Ef(Ll,{contentName:mr,titleName:oa,docsSlug:"dialog"}),Rg=({titleId:e})=>{const t=Vl(Ll),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 f.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Tg="DialogDescriptionWarning",Pg=({contentRef:e,descriptionId:t})=>{const n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Vl(Tg).contentName}}.`;return f.useEffect(()=>{const s=e.current?.getAttribute("aria-describedby");t&&s&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},Ag=Rl,kg=Pl,Og=kl,Ng=Ol,Mg=Nl,jg=jl,Ig=Fl;function Dg({...e}){return d.jsx(Ag,{"data-slot":"dialog",...e})}function Fg({...e}){return d.jsx(kg,{"data-slot":"dialog-trigger",...e})}function Lg({...e}){return d.jsx(Og,{"data-slot":"dialog-portal",...e})}function Vg({className:e,...t}){return d.jsx(Ng,{"data-slot":"dialog-overlay",className:he("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 $g({className:e,children:t,showCloseButton:r=!0,...n}){return d.jsxs(Lg,{"data-slot":"dialog-portal",children:[d.jsx(Vg,{}),d.jsxs(Mg,{"data-slot":"dialog-content",className:he("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),...n,children:[t,r&&d.jsxs(Ig,{"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:[d.jsx(jo,{}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]})}function Bg({className:e,...t}){return d.jsx("div",{"data-slot":"dialog-header",className:he("flex flex-col gap-2 text-center sm:text-left",e),...t})}function Ug({className:e,...t}){return d.jsx(jg,{"data-slot":"dialog-title",className:he("text-lg leading-none font-semibold",e),...t})}function cr({className:e,type:t,...r}){return d.jsx("input",{type:t,"data-slot":"input",className:he("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex 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})}function yo(e,[t,r]){return Math.min(r,Math.max(t,e))}function zg(e){const t=f.useRef({value:e,previous:e});return f.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var $l=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"}),Hg="VisuallyHidden",Wg=f.forwardRef((e,t)=>d.jsx(ne.span,{...e,ref:t,style:{...$l,...e.style}}));Wg.displayName=Hg;var Zg=[" ","Enter","ArrowUp","ArrowDown"],qg=[" ","Enter"],gr="Select",[Os,Ns,Gg]=Go(gr),[Hr,yw]=kt(gr,[Gg,zr]),Ms=zr(),[Kg,or]=Hr(gr),[Qg,Yg]=Hr(gr),Bl=e=>{const{__scopeSelect:t,children:r,open:n,defaultOpen:s,onOpenChange:o,value:a,defaultValue:i,onValueChange:c,dir:l,name:h,autoComplete:u,disabled:p,required:g,form:x}=e,m=Ms(t),[y,w]=f.useState(null),[b,C]=f.useState(null),[S,_]=f.useState(!1),A=Rn(l),[P,O]=Ut({prop:n,defaultProp:s??!1,onChange:o,caller:gr}),[I,F]=Ut({prop:a,defaultProp:i,onChange:c,caller:gr}),G=f.useRef(null),L=y?x||!!y.closest("form"):!0,[N,$]=f.useState(new Set),X=Array.from(N).map(M=>M.props.value).join(";");return d.jsx(Ho,{...m,children:d.jsxs(Kg,{required:g,scope:t,trigger:y,onTriggerChange:w,valueNode:b,onValueNodeChange:C,valueNodeHasChildren:S,onValueNodeHasChildrenChange:_,contentId:Ct(),value:I,onValueChange:F,open:P,onOpenChange:O,dir:A,triggerPointerDownPosRef:G,disabled:p,children:[d.jsx(Os.Provider,{scope:t,children:d.jsx(Qg,{scope:e.__scopeSelect,onNativeOptionAdd:f.useCallback(M=>{$(K=>new Set(K).add(M))},[]),onNativeOptionRemove:f.useCallback(M=>{$(K=>{const q=new Set(K);return q.delete(M),q})},[]),children:r})}),L?d.jsxs(lu,{"aria-hidden":!0,required:g,tabIndex:-1,name:h,autoComplete:u,value:I,onChange:M=>F(M.target.value),disabled:p,form:x,children:[I===void 0?d.jsx("option",{value:""}):null,Array.from(N)]},X):null]})})};Bl.displayName=gr;var Ul="SelectTrigger",zl=f.forwardRef((e,t)=>{const{__scopeSelect:r,disabled:n=!1,...s}=e,o=Ms(r),a=or(Ul,r),i=a.disabled||n,c=ue(t,a.onTriggerChange),l=Ns(r),h=f.useRef("touch"),[u,p,g]=du(m=>{const y=l().filter(C=>!C.disabled),w=y.find(C=>C.value===a.value),b=fu(y,m,w);b!==void 0&&a.onValueChange(b.value)}),x=m=>{i||(a.onOpenChange(!0),g()),m&&(a.triggerPointerDownPosRef.current={x:Math.round(m.pageX),y:Math.round(m.pageY)})};return d.jsx(Ss,{asChild:!0,...o,children:d.jsx(ne.button,{type:"button",role:"combobox","aria-controls":a.contentId,"aria-expanded":a.open,"aria-required":a.required,"aria-autocomplete":"none",dir:a.dir,"data-state":a.open?"open":"closed",disabled:i,"data-disabled":i?"":void 0,"data-placeholder":uu(a.value)?"":void 0,...s,ref:c,onClick:Z(s.onClick,m=>{m.currentTarget.focus(),h.current!=="mouse"&&x(m)}),onPointerDown:Z(s.onPointerDown,m=>{h.current=m.pointerType;const y=m.target;y.hasPointerCapture(m.pointerId)&&y.releasePointerCapture(m.pointerId),m.button===0&&m.ctrlKey===!1&&m.pointerType==="mouse"&&(x(m),m.preventDefault())}),onKeyDown:Z(s.onKeyDown,m=>{const y=u.current!=="";!(m.ctrlKey||m.altKey||m.metaKey)&&m.key.length===1&&p(m.key),!(y&&m.key===" ")&&Zg.includes(m.key)&&(x(),m.preventDefault())})})})});zl.displayName=Ul;var Hl="SelectValue",Wl=f.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,children:o,placeholder:a="",...i}=e,c=or(Hl,r),{onValueNodeHasChildrenChange:l}=c,h=o!==void 0,u=ue(t,c.onValueNodeChange);return Ne(()=>{l(h)},[l,h]),d.jsx(ne.span,{...i,ref:u,style:{pointerEvents:"none"},children:uu(c.value)?d.jsx(d.Fragment,{children:a}):o})});Wl.displayName=Hl;var Xg="SelectIcon",Zl=f.forwardRef((e,t)=>{const{__scopeSelect:r,children:n,...s}=e;return d.jsx(ne.span,{"aria-hidden":!0,...s,ref:t,children:n||"▼"})});Zl.displayName=Xg;var Jg="SelectPortal",ql=e=>d.jsx(Sn,{asChild:!0,...e});ql.displayName=Jg;var vr="SelectContent",Gl=f.forwardRef((e,t)=>{const r=or(vr,e.__scopeSelect),[n,s]=f.useState();if(Ne(()=>{s(new DocumentFragment)},[]),!r.open){const o=n;return o?xn.createPortal(d.jsx(Kl,{scope:e.__scopeSelect,children:d.jsx(Os.Slot,{scope:e.__scopeSelect,children:d.jsx("div",{children:e.children})})}),o):null}return d.jsx(Ql,{...e,ref:t})});Gl.displayName=vr;var lt=10,[Kl,ar]=Hr(vr),ev="SelectContentImpl",tv=dr("SelectContent.RemoveScroll"),Ql=f.forwardRef((e,t)=>{const{__scopeSelect:r,position:n="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:o,onPointerDownOutside:a,side:i,sideOffset:c,align:l,alignOffset:h,arrowPadding:u,collisionBoundary:p,collisionPadding:g,sticky:x,hideWhenDetached:m,avoidCollisions:y,...w}=e,b=or(vr,r),[C,S]=f.useState(null),[_,A]=f.useState(null),P=ue(t,H=>S(H)),[O,I]=f.useState(null),[F,G]=f.useState(null),L=Ns(r),[N,$]=f.useState(!1),X=f.useRef(!1);f.useEffect(()=>{if(C)return Cs(C)},[C]),xs();const M=f.useCallback(H=>{const[J,...we]=L().map(ge=>ge.ref.current),[de]=we.slice(-1),pe=document.activeElement;for(const ge of H)if(ge===pe||(ge?.scrollIntoView({block:"nearest"}),ge===J&&_&&(_.scrollTop=0),ge===de&&_&&(_.scrollTop=_.scrollHeight),ge?.focus(),document.activeElement!==pe))return},[L,_]),K=f.useCallback(()=>M([O,C]),[M,O,C]);f.useEffect(()=>{N&&K()},[N,K]);const{onOpenChange:q,triggerPointerDownPosRef:D}=b;f.useEffect(()=>{if(C){let H={x:0,y:0};const J=de=>{H={x:Math.abs(Math.round(de.pageX)-(D.current?.x??0)),y:Math.abs(Math.round(de.pageY)-(D.current?.y??0))}},we=de=>{H.x<=10&&H.y<=10?de.preventDefault():C.contains(de.target)||q(!1),document.removeEventListener("pointermove",J),D.current=null};return D.current!==null&&(document.addEventListener("pointermove",J),document.addEventListener("pointerup",we,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",J),document.removeEventListener("pointerup",we,{capture:!0})}}},[C,q,D]),f.useEffect(()=>{const H=()=>q(!1);return window.addEventListener("blur",H),window.addEventListener("resize",H),()=>{window.removeEventListener("blur",H),window.removeEventListener("resize",H)}},[q]);const[ie,be]=du(H=>{const J=L().filter(pe=>!pe.disabled),we=J.find(pe=>pe.ref.current===document.activeElement),de=fu(J,H,we);de&&setTimeout(()=>de.ref.current.focus())}),Pe=f.useCallback((H,J,we)=>{const de=!X.current&&!we;(b.value!==void 0&&b.value===J||de)&&(I(H),de&&(X.current=!0))},[b.value]),re=f.useCallback(()=>C?.focus(),[C]),ce=f.useCallback((H,J,we)=>{const de=!X.current&&!we;(b.value!==void 0&&b.value===J||de)&&G(H)},[b.value]),le=n==="popper"?xo:Yl,xe=le===xo?{side:i,sideOffset:c,align:l,alignOffset:h,arrowPadding:u,collisionBoundary:p,collisionPadding:g,sticky:x,hideWhenDetached:m,avoidCollisions:y}:{};return d.jsx(Kl,{scope:r,content:C,viewport:_,onViewportChange:A,itemRefCallback:Pe,selectedItem:O,onItemLeave:re,itemTextRefCallback:ce,focusSelectedItem:K,selectedItemText:F,position:n,isPositioned:N,searchRef:ie,children:d.jsx(Cn,{as:tv,allowPinchZoom:!0,children:d.jsx(wn,{asChild:!0,trapped:b.open,onMountAutoFocus:H=>{H.preventDefault()},onUnmountAutoFocus:Z(s,H=>{b.trigger?.focus({preventScroll:!0}),H.preventDefault()}),children:d.jsx(bn,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:a,onFocusOutside:H=>H.preventDefault(),onDismiss:()=>b.onOpenChange(!1),children:d.jsx(le,{role:"listbox",id:b.contentId,"data-state":b.open?"open":"closed",dir:b.dir,onContextMenu:H=>H.preventDefault(),...w,...xe,onPlaced:()=>$(!0),ref:P,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:Z(w.onKeyDown,H=>{const J=H.ctrlKey||H.altKey||H.metaKey;if(H.key==="Tab"&&H.preventDefault(),!J&&H.key.length===1&&be(H.key),["ArrowUp","ArrowDown","Home","End"].includes(H.key)){let de=L().filter(pe=>!pe.disabled).map(pe=>pe.ref.current);if(["ArrowUp","End"].includes(H.key)&&(de=de.slice().reverse()),["ArrowUp","ArrowDown"].includes(H.key)){const pe=H.target,ge=de.indexOf(pe);de=de.slice(ge+1)}setTimeout(()=>M(de)),H.preventDefault()}})})})})})})});Ql.displayName=ev;var rv="SelectItemAlignedPosition",Yl=f.forwardRef((e,t)=>{const{__scopeSelect:r,onPlaced:n,...s}=e,o=or(vr,r),a=ar(vr,r),[i,c]=f.useState(null),[l,h]=f.useState(null),u=ue(t,P=>h(P)),p=Ns(r),g=f.useRef(!1),x=f.useRef(!0),{viewport:m,selectedItem:y,selectedItemText:w,focusSelectedItem:b}=a,C=f.useCallback(()=>{if(o.trigger&&o.valueNode&&i&&l&&m&&y&&w){const P=o.trigger.getBoundingClientRect(),O=l.getBoundingClientRect(),I=o.valueNode.getBoundingClientRect(),F=w.getBoundingClientRect();if(o.dir!=="rtl"){const pe=F.left-O.left,ge=I.left-pe,Me=P.left-ge,Ue=P.width+Me,Ht=Math.max(Ue,O.width),Wt=window.innerWidth-lt,st=yo(ge,[lt,Math.max(lt,Wt-Ht)]);i.style.minWidth=Ue+"px",i.style.left=st+"px"}else{const pe=O.right-F.right,ge=window.innerWidth-I.right-pe,Me=window.innerWidth-P.right-ge,Ue=P.width+Me,Ht=Math.max(Ue,O.width),Wt=window.innerWidth-lt,st=yo(ge,[lt,Math.max(lt,Wt-Ht)]);i.style.minWidth=Ue+"px",i.style.right=st+"px"}const G=p(),L=window.innerHeight-lt*2,N=m.scrollHeight,$=window.getComputedStyle(l),X=parseInt($.borderTopWidth,10),M=parseInt($.paddingTop,10),K=parseInt($.borderBottomWidth,10),q=parseInt($.paddingBottom,10),D=X+M+N+q+K,ie=Math.min(y.offsetHeight*5,D),be=window.getComputedStyle(m),Pe=parseInt(be.paddingTop,10),re=parseInt(be.paddingBottom,10),ce=P.top+P.height/2-lt,le=L-ce,xe=y.offsetHeight/2,H=y.offsetTop+xe,J=X+M+H,we=D-J;if(J<=ce){const pe=G.length>0&&y===G[G.length-1].ref.current;i.style.bottom="0px";const ge=l.clientHeight-m.offsetTop-m.offsetHeight,Me=Math.max(le,xe+(pe?re:0)+ge+K),Ue=J+Me;i.style.height=Ue+"px"}else{const pe=G.length>0&&y===G[0].ref.current;i.style.top="0px";const Me=Math.max(ce,X+m.offsetTop+(pe?Pe:0)+xe)+we;i.style.height=Me+"px",m.scrollTop=J-ce+m.offsetTop}i.style.margin=`${lt}px 0`,i.style.minHeight=ie+"px",i.style.maxHeight=L+"px",n?.(),requestAnimationFrame(()=>g.current=!0)}},[p,o.trigger,o.valueNode,i,l,m,y,w,o.dir,n]);Ne(()=>C(),[C]);const[S,_]=f.useState();Ne(()=>{l&&_(window.getComputedStyle(l).zIndex)},[l]);const A=f.useCallback(P=>{P&&x.current===!0&&(C(),b?.(),x.current=!1)},[C,b]);return d.jsx(sv,{scope:r,contentWrapper:i,shouldExpandOnScrollRef:g,onScrollButtonChange:A,children:d.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:S},children:d.jsx(ne.div,{...s,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});Yl.displayName=rv;var nv="SelectPopperPosition",xo=f.forwardRef((e,t)=>{const{__scopeSelect:r,align:n="start",collisionPadding:s=lt,...o}=e,a=Ms(r);return d.jsx(Wo,{...a,...o,ref:t,align:n,collisionPadding:s,style:{boxSizing:"border-box",...o.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)"}})});xo.displayName=nv;var[sv,ia]=Hr(vr,{}),bo="SelectViewport",Xl=f.forwardRef((e,t)=>{const{__scopeSelect:r,nonce:n,...s}=e,o=ar(bo,r),a=ia(bo,r),i=ue(t,o.onViewportChange),c=f.useRef(0);return d.jsxs(d.Fragment,{children:[d.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:n}),d.jsx(Os.Slot,{scope:r,children:d.jsx(ne.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Z(s.onScroll,l=>{const h=l.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:p}=a;if(p?.current&&u){const g=Math.abs(c.current-h.scrollTop);if(g>0){const x=window.innerHeight-lt*2,m=parseFloat(u.style.minHeight),y=parseFloat(u.style.height),w=Math.max(m,y);if(w<x){const b=w+g,C=Math.min(x,b),S=b-C;u.style.height=C+"px",u.style.bottom==="0px"&&(h.scrollTop=S>0?S:0,u.style.justifyContent="flex-end")}}}c.current=h.scrollTop})})})]})});Xl.displayName=bo;var Jl="SelectGroup",[ov,av]=Hr(Jl),iv=f.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Ct();return d.jsx(ov,{scope:r,id:s,children:d.jsx(ne.div,{role:"group","aria-labelledby":s,...n,ref:t})})});iv.displayName=Jl;var eu="SelectLabel",cv=f.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=av(eu,r);return d.jsx(ne.div,{id:s.id,...n,ref:t})});cv.displayName=eu;var cs="SelectItem",[lv,tu]=Hr(cs),ru=f.forwardRef((e,t)=>{const{__scopeSelect:r,value:n,disabled:s=!1,textValue:o,...a}=e,i=or(cs,r),c=ar(cs,r),l=i.value===n,[h,u]=f.useState(o??""),[p,g]=f.useState(!1),x=ue(t,b=>c.itemRefCallback?.(b,n,s)),m=Ct(),y=f.useRef("touch"),w=()=>{s||(i.onValueChange(n),i.onOpenChange(!1))};if(n==="")throw new Error("A <Select.Item /> 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 d.jsx(lv,{scope:r,value:n,disabled:s,textId:m,isSelected:l,onItemTextChange:f.useCallback(b=>{u(C=>C||(b?.textContent??"").trim())},[]),children:d.jsx(Os.ItemSlot,{scope:r,value:n,disabled:s,textValue:h,children:d.jsx(ne.div,{role:"option","aria-labelledby":m,"data-highlighted":p?"":void 0,"aria-selected":l&&p,"data-state":l?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...a,ref:x,onFocus:Z(a.onFocus,()=>g(!0)),onBlur:Z(a.onBlur,()=>g(!1)),onClick:Z(a.onClick,()=>{y.current!=="mouse"&&w()}),onPointerUp:Z(a.onPointerUp,()=>{y.current==="mouse"&&w()}),onPointerDown:Z(a.onPointerDown,b=>{y.current=b.pointerType}),onPointerMove:Z(a.onPointerMove,b=>{y.current=b.pointerType,s?c.onItemLeave?.():y.current==="mouse"&&b.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Z(a.onPointerLeave,b=>{b.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:Z(a.onKeyDown,b=>{c.searchRef?.current!==""&&b.key===" "||(qg.includes(b.key)&&w(),b.key===" "&&b.preventDefault())})})})})});ru.displayName=cs;var Qr="SelectItemText",nu=f.forwardRef((e,t)=>{const{__scopeSelect:r,className:n,style:s,...o}=e,a=or(Qr,r),i=ar(Qr,r),c=tu(Qr,r),l=Yg(Qr,r),[h,u]=f.useState(null),p=ue(t,w=>u(w),c.onItemTextChange,w=>i.itemTextRefCallback?.(w,c.value,c.disabled)),g=h?.textContent,x=f.useMemo(()=>d.jsx("option",{value:c.value,disabled:c.disabled,children:g},c.value),[c.disabled,c.value,g]),{onNativeOptionAdd:m,onNativeOptionRemove:y}=l;return Ne(()=>(m(x),()=>y(x)),[m,y,x]),d.jsxs(d.Fragment,{children:[d.jsx(ne.span,{id:c.textId,...o,ref:p}),c.isSelected&&a.valueNode&&!a.valueNodeHasChildren?xn.createPortal(o.children,a.valueNode):null]})});nu.displayName=Qr;var su="SelectItemIndicator",ou=f.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return tu(su,r).isSelected?d.jsx(ne.span,{"aria-hidden":!0,...n,ref:t}):null});ou.displayName=su;var wo="SelectScrollUpButton",au=f.forwardRef((e,t)=>{const r=ar(wo,e.__scopeSelect),n=ia(wo,e.__scopeSelect),[s,o]=f.useState(!1),a=ue(t,n.onScrollButtonChange);return Ne(()=>{if(r.viewport&&r.isPositioned){let i=function(){const l=c.scrollTop>0;o(l)};const c=r.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),s?d.jsx(cu,{...e,ref:a,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop-c.offsetHeight)}}):null});au.displayName=wo;var _o="SelectScrollDownButton",iu=f.forwardRef((e,t)=>{const r=ar(_o,e.__scopeSelect),n=ia(_o,e.__scopeSelect),[s,o]=f.useState(!1),a=ue(t,n.onScrollButtonChange);return Ne(()=>{if(r.viewport&&r.isPositioned){let i=function(){const l=c.scrollHeight-c.clientHeight,h=Math.ceil(c.scrollTop)<l;o(h)};const c=r.viewport;return i(),c.addEventListener("scroll",i),()=>c.removeEventListener("scroll",i)}},[r.viewport,r.isPositioned]),s?d.jsx(cu,{...e,ref:a,onAutoScroll:()=>{const{viewport:i,selectedItem:c}=r;i&&c&&(i.scrollTop=i.scrollTop+c.offsetHeight)}}):null});iu.displayName=_o;var cu=f.forwardRef((e,t)=>{const{__scopeSelect:r,onAutoScroll:n,...s}=e,o=ar("SelectScrollButton",r),a=f.useRef(null),i=Ns(r),c=f.useCallback(()=>{a.current!==null&&(window.clearInterval(a.current),a.current=null)},[]);return f.useEffect(()=>()=>c(),[c]),Ne(()=>{i().find(h=>h.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[i]),d.jsx(ne.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Z(s.onPointerDown,()=>{a.current===null&&(a.current=window.setInterval(n,50))}),onPointerMove:Z(s.onPointerMove,()=>{o.onItemLeave?.(),a.current===null&&(a.current=window.setInterval(n,50))}),onPointerLeave:Z(s.onPointerLeave,()=>{c()})})}),uv="SelectSeparator",dv=f.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e;return d.jsx(ne.div,{"aria-hidden":!0,...n,ref:t})});dv.displayName=uv;var So="SelectArrow",fv=f.forwardRef((e,t)=>{const{__scopeSelect:r,...n}=e,s=Ms(r),o=or(So,r),a=ar(So,r);return o.open&&a.position==="popper"?d.jsx(Zo,{...s,...n,ref:t}):null});fv.displayName=So;var hv="SelectBubbleInput",lu=f.forwardRef(({__scopeSelect:e,value:t,...r},n)=>{const s=f.useRef(null),o=ue(n,s),a=zg(t);return f.useEffect(()=>{const i=s.current;if(!i)return;const c=window.HTMLSelectElement.prototype,h=Object.getOwnPropertyDescriptor(c,"value").set;if(a!==t&&h){const u=new Event("change",{bubbles:!0});h.call(i,t),i.dispatchEvent(u)}},[a,t]),d.jsx(ne.select,{...r,style:{...$l,...r.style},ref:o,defaultValue:t})});lu.displayName=hv;function uu(e){return e===""||e===void 0}function du(e){const t=Oe(e),r=f.useRef(""),n=f.useRef(0),s=f.useCallback(a=>{const i=r.current+a;t(i),(function c(l){r.current=l,window.clearTimeout(n.current),l!==""&&(n.current=window.setTimeout(()=>c(""),1e3))})(i)},[t]),o=f.useCallback(()=>{r.current="",window.clearTimeout(n.current)},[]);return f.useEffect(()=>()=>window.clearTimeout(n.current),[]),[r,s,o]}function fu(e,t,r){const s=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let a=pv(e,Math.max(o,0));s.length===1&&(a=a.filter(l=>l!==r));const c=a.find(l=>l.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function pv(e,t){return e.map((r,n)=>e[(t+n)%e.length])}var mv=Bl,gv=zl,vv=Wl,yv=Zl,xv=ql,bv=Gl,wv=Xl,_v=ru,Sv=nu,Cv=ou,Ev=au,Rv=iu;function yi({...e}){return d.jsx(mv,{"data-slot":"select",...e})}function xi({...e}){return d.jsx(vv,{"data-slot":"select-value",...e})}function bi({className:e,size:t="default",children:r,...n}){return d.jsxs(gv,{"data-slot":"select-trigger","data-size":t,className:he("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),...n,children:[r,d.jsx(yv,{asChild:!0,children:d.jsx(Qi,{className:"size-4 opacity-50"})})]})}function wi({className:e,children:t,position:r="popper",...n}){return d.jsx(xv,{children:d.jsxs(bv,{"data-slot":"select-content",className:he("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,...n,children:[d.jsx(Tv,{}),d.jsx(wv,{className:he("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1"),children:t}),d.jsx(Pv,{})]})})}function _i({className:e,children:t,...r}){return d.jsxs(_v,{"data-slot":"select-item",className:he("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:[d.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:d.jsx(Cv,{children:d.jsx(of,{className:"size-4"})})}),d.jsx(Sv,{children:t})]})}function Tv({className:e,...t}){return d.jsx(Ev,{"data-slot":"select-scroll-up-button",className:he("flex cursor-default items-center justify-center py-1",e),...t,children:d.jsx(hf,{className:"size-4"})})}function Pv({className:e,...t}){return d.jsx(Rv,{"data-slot":"select-scroll-down-button",className:he("flex cursor-default items-center justify-center py-1",e),...t,children:d.jsx(Qi,{className:"size-4"})})}function Av({className:e,...t}){return d.jsx("textarea",{"data-slot":"textarea",className:he("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})}var kv="Label",hu=f.forwardRef((e,t)=>d.jsx(ne.label,{...e,ref:t,onMouseDown:r=>{r.target.closest("button, input, select, textarea")||(e.onMouseDown?.(r),!r.defaultPrevented&&r.detail>1&&r.preventDefault())}}));hu.displayName=kv;var Ov=hu;function Nv({className:e,...t}){return d.jsx(Ov,{"data-slot":"label",className:he("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 Mv=Um,pu=f.createContext({}),jt=({...e})=>d.jsx(pu.Provider,{value:{name:e.name},children:d.jsx(Wm,{...e})}),ca=()=>{const e=f.useContext(pu),t=f.useContext(mu),{getFieldState:r}=As(),n=ul({name:e.name}),s=r(e.name,n);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...s}},mu=f.createContext({});function It({className:e,...t}){const r=f.useId();return d.jsx(mu.Provider,{value:{id:r},children:d.jsx("div",{"data-slot":"form-item",className:he("grid gap-2",e),...t})})}function yt({className:e,...t}){const{error:r,formItemId:n}=ca();return d.jsx(Nv,{"data-slot":"form-label","data-error":!!r,className:he("data-[error=true]:text-destructive",e),htmlFor:n,...t})}function Gt({...e}){const{error:t,formItemId:r,formDescriptionId:n,formMessageId:s}=ca();return d.jsx(Mi,{"data-slot":"form-control",id:r,"aria-describedby":t?`${n} ${s}`:`${n}`,"aria-invalid":!!t,...e})}function Dt({className:e,...t}){const{error:r,formMessageId:n}=ca(),s=r?String(r?.message??""):t.children;return s?d.jsx("p",{"data-slot":"form-message",id:n,className:he("text-destructive text-sm",e),...t,children:s}):null}const jv=e=>{const{isLoading:t,refetch:r,...n}=co({queryKey:["product",e?.id],queryFn:async()=>e?(await xd(300),await qe.apiRequest("get",e)):null});return{isLoading:t,refetch:r,...n}};var fe;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function r(s){throw new Error}e.assertNever=r,e.arrayToEnum=s=>{const o={};for(const a of s)o[a]=a;return o},e.getValidEnumValues=s=>{const o=e.objectKeys(s).filter(i=>typeof s[s[i]]!="number"),a={};for(const i of o)a[i]=s[i];return e.objectValues(a)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const o=[];for(const a in s)Object.prototype.hasOwnProperty.call(s,a)&&o.push(a);return o},e.find=(s,o)=>{for(const a of s)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(fe||(fe={}));var Co;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Co||(Co={}));const W=fe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Lt=e=>{switch(typeof e){case"undefined":return W.undefined;case"string":return W.string;case"number":return Number.isNaN(e)?W.nan:W.number;case"boolean":return W.boolean;case"function":return W.function;case"bigint":return W.bigint;case"symbol":return W.symbol;case"object":return Array.isArray(e)?W.array:e===null?W.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?W.promise:typeof Map<"u"&&e instanceof Map?W.map:typeof Set<"u"&&e instanceof Set?W.set:typeof Date<"u"&&e instanceof Date?W.date:W.object;default:return W.unknown}},k=fe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Iv=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Ye extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}format(t){const r=t||function(o){return o.message},n={_errors:[]},s=o=>{for(const a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(s);else if(a.code==="invalid_return_type")s(a.returnTypeError);else if(a.code==="invalid_arguments")s(a.argumentsError);else if(a.path.length===0)n._errors.push(r(a));else{let i=n,c=0;for(;c<a.path.length;){const l=a.path[c];c===a.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(r(a))):i[l]=i[l]||{_errors:[]},i=i[l],c++}}};return s(this),n}static assert(t){if(!(t instanceof Ye))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,fe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){const r={},n=[];for(const s of this.issues)if(s.path.length>0){const o=s.path[0];r[o]=r[o]||[],r[o].push(t(s))}else n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}}Ye.create=e=>new Ye(e);const Dr=(e,t)=>{let r;switch(e.code){case k.invalid_type:e.received===W.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case k.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,fe.jsonStringifyReplacer)}`;break;case k.unrecognized_keys:r=`Unrecognized key(s) in object: ${fe.joinValues(e.keys,", ")}`;break;case k.invalid_union:r="Invalid input";break;case k.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${fe.joinValues(e.options)}`;break;case k.invalid_enum_value:r=`Invalid enum value. Expected ${fe.joinValues(e.options)}, received '${e.received}'`;break;case k.invalid_arguments:r="Invalid function arguments";break;case k.invalid_return_type:r="Invalid function return type";break;case k.invalid_date:r="Invalid date";break;case k.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:fe.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case k.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:r="Invalid input";break;case k.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:r="Invalid input";break;case k.custom:r="Invalid input";break;case k.invalid_intersection_types:r="Intersection results could not be merged";break;case k.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case k.not_finite:r="Number must be finite";break;default:r=t.defaultError,fe.assertNever(e)}return{message:r}};let gu=Dr;function Dv(e){gu=e}function ls(){return gu}const us=e=>{const{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],a={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let i="";const c=n.filter(l=>!!l).slice().reverse();for(const l of c)i=l(a,{data:t,defaultError:i}).message;return{...s,path:o,message:i}},Fv=[];function z(e,t){const r=ls(),n=us({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===Dr?void 0:Dr].filter(s=>!!s)});e.common.issues.push(n)}class De{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){const n=[];for(const s of r){if(s.status==="aborted")return ee;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){const n=[];for(const s of r){const o=await s.key,a=await s.value;n.push({key:o,value:a})}return De.mergeObjectSync(t,n)}static mergeObjectSync(t,r){const n={};for(const s of r){const{key:o,value:a}=s;if(o.status==="aborted"||a.status==="aborted")return ee;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||s.alwaysSet)&&(n[o.value]=a.value)}return{status:t.value,value:n}}}const ee=Object.freeze({status:"aborted"}),kr=e=>({status:"dirty",value:e}),$e=e=>({status:"valid",value:e}),Eo=e=>e.status==="aborted",Ro=e=>e.status==="dirty",yr=e=>e.status==="valid",nn=e=>typeof Promise<"u"&&e instanceof Promise;var Q;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Q||(Q={}));class Pt{constructor(t,r,n,s){this._cachedPath=[],this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Si=(e,t)=>{if(yr(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new Ye(e.common.issues);return this._error=r,this._error}}};function se(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(a,i)=>{const{message:c}=e;return a.code==="invalid_enum_value"?{message:c??i.defaultError}:typeof i.data>"u"?{message:c??n??i.defaultError}:a.code!=="invalid_type"?{message:i.defaultError}:{message:c??r??i.defaultError}},description:s}}class ae{get description(){return this._def.description}_getType(t){return Lt(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Lt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new De,ctx:{common:t.parent.common,data:t.data,parsedType:Lt(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const r=this._parse(t);if(nn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){const r=this._parse(t);return Promise.resolve(r)}parse(t,r){const n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){const n={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Lt(t)},s=this._parseSync({data:t,path:n.path,parent:n});return Si(n,s)}"~validate"(t){const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Lt(t)};if(!this["~standard"].async)try{const n=this._parseSync({data:t,path:[],parent:r});return yr(n)?{value:n.value}:{issues:r.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:r}).then(n=>yr(n)?{value:n.value}:{issues:r.common.issues})}async parseAsync(t,r){const n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){const n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Lt(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(nn(s)?s:Promise.resolve(s));return Si(n,o)}refine(t,r){const n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,o)=>{const a=t(s),i=()=>o.addIssue({code:k.custom,...n(s)});return typeof Promise<"u"&&a instanceof Promise?a.then(c=>c?!0:(i(),!1)):a?!0:(i(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new gt({schema:this,typeName:te.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return Rt.create(this,this._def)}nullable(){return rr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ht.create(this)}promise(){return Lr.create(this,this._def)}or(t){return cn.create([this,t],this._def)}and(t){return ln.create(this,t,this._def)}transform(t){return new gt({...se(this._def),schema:this,typeName:te.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const r=typeof t=="function"?t:()=>t;return new pn({...se(this._def),innerType:this,defaultValue:r,typeName:te.ZodDefault})}brand(){return new la({typeName:te.ZodBranded,type:this,...se(this._def)})}catch(t){const r=typeof t=="function"?t:()=>t;return new mn({...se(this._def),innerType:this,catchValue:r,typeName:te.ZodCatch})}describe(t){const r=this.constructor;return new r({...this._def,description:t})}pipe(t){return An.create(this,t)}readonly(){return gn.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Lv=/^c[^\s-]{8,}$/i,Vv=/^[0-9a-z]+$/,$v=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Bv=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Uv=/^[a-z0-9_-]{21}$/i,zv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Hv=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Wv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Zv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let to;const qv=/^(?:(?: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])$/,Gv=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Kv=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Qv=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Yv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vu="((\\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])))",Jv=new RegExp(`^${vu}$`);function yu(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function ey(e){return new RegExp(`^${yu(e)}$`)}function xu(e){let t=`${vu}T${yu(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ty(e,t){return!!((t==="v4"||!t)&&qv.test(e)||(t==="v6"||!t)&&Kv.test(e))}function ry(e,t){if(!zv.test(e))return!1;try{const[r]=e.split(".");if(!r)return!1;const n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function ny(e,t){return!!((t==="v4"||!t)&&Gv.test(e)||(t==="v6"||!t)&&Qv.test(e))}class ft extends ae{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==W.string){const o=this._getOrReturnCtx(t);return z(o,{code:k.invalid_type,expected:W.string,received:o.parsedType}),ee}const n=new De;let s;for(const o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(s=this._getOrReturnCtx(t,s),z(s,{code:k.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(s=this._getOrReturnCtx(t,s),z(s,{code:k.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,i=t.data.length<o.value;(a||i)&&(s=this._getOrReturnCtx(t,s),a?z(s,{code:k.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):i&&z(s,{code:k.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")Wv.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"email",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="emoji")to||(to=new RegExp(Zv,"u")),to.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"emoji",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")Bv.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"uuid",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="nanoid")Uv.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"nanoid",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")Lv.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"cuid",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid2")Vv.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"cuid2",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="ulid")$v.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"ulid",code:k.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),z(s,{validation:"url",code:k.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"regex",code:k.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="includes"?t.data.includes(o.value,o.position)||(s=this._getOrReturnCtx(t,s),z(s,{code:k.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),n.dirty()):o.kind==="toLowerCase"?t.data=t.data.toLowerCase():o.kind==="toUpperCase"?t.data=t.data.toUpperCase():o.kind==="startsWith"?t.data.startsWith(o.value)||(s=this._getOrReturnCtx(t,s),z(s,{code:k.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(s=this._getOrReturnCtx(t,s),z(s,{code:k.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?xu(o).test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{code:k.invalid_string,validation:"datetime",message:o.message}),n.dirty()):o.kind==="date"?Jv.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{code:k.invalid_string,validation:"date",message:o.message}),n.dirty()):o.kind==="time"?ey(o).test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{code:k.invalid_string,validation:"time",message:o.message}),n.dirty()):o.kind==="duration"?Hv.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"duration",code:k.invalid_string,message:o.message}),n.dirty()):o.kind==="ip"?ty(t.data,o.version)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"ip",code:k.invalid_string,message:o.message}),n.dirty()):o.kind==="jwt"?ry(t.data,o.alg)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"jwt",code:k.invalid_string,message:o.message}),n.dirty()):o.kind==="cidr"?ny(t.data,o.version)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"cidr",code:k.invalid_string,message:o.message}),n.dirty()):o.kind==="base64"?Yv.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"base64",code:k.invalid_string,message:o.message}),n.dirty()):o.kind==="base64url"?Xv.test(t.data)||(s=this._getOrReturnCtx(t,s),z(s,{validation:"base64url",code:k.invalid_string,message:o.message}),n.dirty()):fe.assertNever(o);return{status:n.value,value:t.data}}_regex(t,r,n){return this.refinement(s=>t.test(s),{validation:r,code:k.invalid_string,...Q.errToObj(n)})}_addCheck(t){return new ft({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Q.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Q.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Q.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Q.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Q.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Q.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Q.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Q.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Q.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Q.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Q.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Q.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Q.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...Q.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...Q.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...Q.errToObj(t)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Q.errToObj(r)})}includes(t,r){return this._addCheck({kind:"includes",value:t,position:r?.position,...Q.errToObj(r?.message)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Q.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Q.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Q.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Q.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Q.errToObj(r)})}nonempty(t){return this.min(1,Q.errToObj(t))}trim(){return new ft({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ft({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ft({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}ft.create=e=>new ft({checks:[],typeName:te.ZodString,coerce:e?.coerce??!1,...se(e)});function sy(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(e.toFixed(s).replace(".","")),a=Number.parseInt(t.toFixed(s).replace(".",""));return o%a/10**s}class Jt extends ae{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==W.number){const o=this._getOrReturnCtx(t);return z(o,{code:k.invalid_type,expected:W.number,received:o.parsedType}),ee}let n;const s=new De;for(const o of this._def.checks)o.kind==="int"?fe.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),z(n,{code:k.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),z(n,{code:k.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),z(n,{code:k.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?sy(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),z(n,{code:k.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),z(n,{code:k.not_finite,message:o.message}),s.dirty()):fe.assertNever(o);return{status:s.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Q.toString(r))}setLimit(t,r,n,s){return new Jt({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Q.toString(s)}]})}_addCheck(t){return new Jt({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Q.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Q.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Q.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Q.toString(t)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&fe.isInteger(t.value))}get isFinite(){let t=null,r=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(t===null||n.value<t)&&(t=n.value)}return Number.isFinite(r)&&Number.isFinite(t)}}Jt.create=e=>new Jt({checks:[],typeName:te.ZodNumber,coerce:e?.coerce||!1,...se(e)});class er extends ae{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==W.bigint)return this._getInvalidInput(t);let n;const s=new De;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),z(n,{code:k.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),z(n,{code:k.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),s.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),z(n,{code:k.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):fe.assertNever(o);return{status:s.value,value:t.data}}_getInvalidInput(t){const r=this._getOrReturnCtx(t);return z(r,{code:k.invalid_type,expected:W.bigint,received:r.parsedType}),ee}gte(t,r){return this.setLimit("min",t,!0,Q.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Q.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Q.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Q.toString(r))}setLimit(t,r,n,s){return new er({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Q.toString(s)}]})}_addCheck(t){return new er({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Q.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Q.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Q.toString(r)})}get minValue(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}}er.create=e=>new er({checks:[],typeName:te.ZodBigInt,coerce:e?.coerce??!1,...se(e)});class sn extends ae{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==W.boolean){const n=this._getOrReturnCtx(t);return z(n,{code:k.invalid_type,expected:W.boolean,received:n.parsedType}),ee}return $e(t.data)}}sn.create=e=>new sn({typeName:te.ZodBoolean,coerce:e?.coerce||!1,...se(e)});class xr extends ae{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==W.date){const o=this._getOrReturnCtx(t);return z(o,{code:k.invalid_type,expected:W.date,received:o.parsedType}),ee}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return z(o,{code:k.invalid_date}),ee}const n=new De;let s;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(s=this._getOrReturnCtx(t,s),z(s,{code:k.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(s=this._getOrReturnCtx(t,s),z(s,{code:k.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):fe.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new xr({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Q.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Q.toString(r)})}get minDate(){let t=null;for(const r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}}xr.create=e=>new xr({checks:[],coerce:e?.coerce||!1,typeName:te.ZodDate,...se(e)});class ds extends ae{_parse(t){if(this._getType(t)!==W.symbol){const n=this._getOrReturnCtx(t);return z(n,{code:k.invalid_type,expected:W.symbol,received:n.parsedType}),ee}return $e(t.data)}}ds.create=e=>new ds({typeName:te.ZodSymbol,...se(e)});class on extends ae{_parse(t){if(this._getType(t)!==W.undefined){const n=this._getOrReturnCtx(t);return z(n,{code:k.invalid_type,expected:W.undefined,received:n.parsedType}),ee}return $e(t.data)}}on.create=e=>new on({typeName:te.ZodUndefined,...se(e)});class an extends ae{_parse(t){if(this._getType(t)!==W.null){const n=this._getOrReturnCtx(t);return z(n,{code:k.invalid_type,expected:W.null,received:n.parsedType}),ee}return $e(t.data)}}an.create=e=>new an({typeName:te.ZodNull,...se(e)});class Fr extends ae{constructor(){super(...arguments),this._any=!0}_parse(t){return $e(t.data)}}Fr.create=e=>new Fr({typeName:te.ZodAny,...se(e)});class ur extends ae{constructor(){super(...arguments),this._unknown=!0}_parse(t){return $e(t.data)}}ur.create=e=>new ur({typeName:te.ZodUnknown,...se(e)});class zt extends ae{_parse(t){const r=this._getOrReturnCtx(t);return z(r,{code:k.invalid_type,expected:W.never,received:r.parsedType}),ee}}zt.create=e=>new zt({typeName:te.ZodNever,...se(e)});class fs extends ae{_parse(t){if(this._getType(t)!==W.undefined){const n=this._getOrReturnCtx(t);return z(n,{code:k.invalid_type,expected:W.void,received:n.parsedType}),ee}return $e(t.data)}}fs.create=e=>new fs({typeName:te.ZodVoid,...se(e)});class ht extends ae{_parse(t){const{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==W.array)return z(r,{code:k.invalid_type,expected:W.array,received:r.parsedType}),ee;if(s.exactLength!==null){const a=r.data.length>s.exactLength.value,i=r.data.length<s.exactLength.value;(a||i)&&(z(r,{code:a?k.too_big:k.too_small,minimum:i?s.exactLength.value:void 0,maximum:a?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(z(r,{code:k.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(z(r,{code:k.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((a,i)=>s.type._parseAsync(new Pt(r,a,r.path,i)))).then(a=>De.mergeArray(n,a));const o=[...r.data].map((a,i)=>s.type._parseSync(new Pt(r,a,r.path,i)));return De.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new ht({...this._def,minLength:{value:t,message:Q.toString(r)}})}max(t,r){return new ht({...this._def,maxLength:{value:t,message:Q.toString(r)}})}length(t,r){return new ht({...this._def,exactLength:{value:t,message:Q.toString(r)}})}nonempty(t){return this.min(1,t)}}ht.create=(e,t)=>new ht({type:e,minLength:null,maxLength:null,exactLength:null,typeName:te.ZodArray,...se(t)});function Ar(e){if(e instanceof _e){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=Rt.create(Ar(n))}return new _e({...e._def,shape:()=>t})}else return e instanceof ht?new ht({...e._def,type:Ar(e.element)}):e instanceof Rt?Rt.create(Ar(e.unwrap())):e instanceof rr?rr.create(Ar(e.unwrap())):e instanceof At?At.create(e.items.map(t=>Ar(t))):e}class _e extends ae{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),r=fe.objectKeys(t);return this._cached={shape:t,keys:r},this._cached}_parse(t){if(this._getType(t)!==W.object){const l=this._getOrReturnCtx(t);return z(l,{code:k.invalid_type,expected:W.object,received:l.parsedType}),ee}const{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof zt&&this._def.unknownKeys==="strip"))for(const l in s.data)a.includes(l)||i.push(l);const c=[];for(const l of a){const h=o[l],u=s.data[l];c.push({key:{status:"valid",value:l},value:h._parse(new Pt(s,u,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof zt){const l=this._def.unknownKeys;if(l==="passthrough")for(const h of i)c.push({key:{status:"valid",value:h},value:{status:"valid",value:s.data[h]}});else if(l==="strict")i.length>0&&(z(s,{code:k.unrecognized_keys,keys:i}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const h of i){const u=s.data[h];c.push({key:{status:"valid",value:h},value:l._parse(new Pt(s,u,s.path,h)),alwaysSet:h in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const l=[];for(const h of c){const u=await h.key,p=await h.value;l.push({key:u,value:p,alwaysSet:h.alwaysSet})}return l}).then(l=>De.mergeObjectSync(n,l)):De.mergeObjectSync(n,c)}get shape(){return this._def.shape()}strict(t){return Q.errToObj,new _e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{const s=this._def.errorMap?.(r,n).message??n.defaultError;return r.code==="unrecognized_keys"?{message:Q.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new _e({...this._def,unknownKeys:"strip"})}passthrough(){return new _e({...this._def,unknownKeys:"passthrough"})}extend(t){return new _e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new _e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:te.ZodObject})}setKey(t,r){return this.augment({[t]:r})}catchall(t){return new _e({...this._def,catchall:t})}pick(t){const r={};for(const n of fe.objectKeys(t))t[n]&&this.shape[n]&&(r[n]=this.shape[n]);return new _e({...this._def,shape:()=>r})}omit(t){const r={};for(const n of fe.objectKeys(this.shape))t[n]||(r[n]=this.shape[n]);return new _e({...this._def,shape:()=>r})}deepPartial(){return Ar(this)}partial(t){const r={};for(const n of fe.objectKeys(this.shape)){const s=this.shape[n];t&&!t[n]?r[n]=s:r[n]=s.optional()}return new _e({...this._def,shape:()=>r})}required(t){const r={};for(const n of fe.objectKeys(this.shape))if(t&&!t[n])r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof Rt;)o=o._def.innerType;r[n]=o}return new _e({...this._def,shape:()=>r})}keyof(){return bu(fe.objectKeys(this.shape))}}_e.create=(e,t)=>new _e({shape:()=>e,unknownKeys:"strip",catchall:zt.create(),typeName:te.ZodObject,...se(t)});_e.strictCreate=(e,t)=>new _e({shape:()=>e,unknownKeys:"strict",catchall:zt.create(),typeName:te.ZodObject,...se(t)});_e.lazycreate=(e,t)=>new _e({shape:e,unknownKeys:"strip",catchall:zt.create(),typeName:te.ZodObject,...se(t)});class cn extends ae{_parse(t){const{ctx:r}=this._processInputParams(t),n=this._def.options;function s(o){for(const i of o)if(i.result.status==="valid")return i.result;for(const i of o)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(i=>new Ye(i.ctx.common.issues));return z(r,{code:k.invalid_union,unionErrors:a}),ee}if(r.common.async)return Promise.all(n.map(async o=>{const a={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:a}),ctx:a}})).then(s);{let o;const a=[];for(const c of n){const l={...r,common:{...r.common,issues:[]},parent:null},h=c._parseSync({data:r.data,path:r.path,parent:l});if(h.status==="valid")return h;h.status==="dirty"&&!o&&(o={result:h,ctx:l}),l.common.issues.length&&a.push(l.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(c=>new Ye(c));return z(r,{code:k.invalid_union,unionErrors:i}),ee}}get options(){return this._def.options}}cn.create=(e,t)=>new cn({options:e,typeName:te.ZodUnion,...se(t)});const Ft=e=>e instanceof dn?Ft(e.schema):e instanceof gt?Ft(e.innerType()):e instanceof fn?[e.value]:e instanceof tr?e.options:e instanceof hn?fe.objectValues(e.enum):e instanceof pn?Ft(e._def.innerType):e instanceof on?[void 0]:e instanceof an?[null]:e instanceof Rt?[void 0,...Ft(e.unwrap())]:e instanceof rr?[null,...Ft(e.unwrap())]:e instanceof la||e instanceof gn?Ft(e.unwrap()):e instanceof mn?Ft(e._def.innerType):[];class js extends ae{_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==W.object)return z(r,{code:k.invalid_type,expected:W.object,received:r.parsedType}),ee;const n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(z(r,{code:k.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),ee)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){const s=new Map;for(const o of r){const a=Ft(o.shape[t]);if(!a.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const i of a){if(s.has(i))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(i)}`);s.set(i,o)}}return new js({typeName:te.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...se(n)})}}function To(e,t){const r=Lt(e),n=Lt(t);if(e===t)return{valid:!0,data:e};if(r===W.object&&n===W.object){const s=fe.objectKeys(t),o=fe.objectKeys(e).filter(i=>s.indexOf(i)!==-1),a={...e,...t};for(const i of o){const c=To(e[i],t[i]);if(!c.valid)return{valid:!1};a[i]=c.data}return{valid:!0,data:a}}else if(r===W.array&&n===W.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let o=0;o<e.length;o++){const a=e[o],i=t[o],c=To(a,i);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return r===W.date&&n===W.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class ln extends ae{_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=(o,a)=>{if(Eo(o)||Eo(a))return ee;const i=To(o.value,a.value);return i.valid?((Ro(o)||Ro(a))&&r.dirty(),{status:r.value,value:i.data}):(z(n,{code:k.invalid_intersection_types}),ee)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([o,a])=>s(o,a)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ln.create=(e,t,r)=>new ln({left:e,right:t,typeName:te.ZodIntersection,...se(r)});class At extends ae{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==W.array)return z(n,{code:k.invalid_type,expected:W.array,received:n.parsedType}),ee;if(n.data.length<this._def.items.length)return z(n,{code:k.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ee;!this._def.rest&&n.data.length>this._def.items.length&&(z(n,{code:k.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const o=[...n.data].map((a,i)=>{const c=this._def.items[i]||this._def.rest;return c?c._parse(new Pt(n,a,n.path,i)):null}).filter(a=>!!a);return n.common.async?Promise.all(o).then(a=>De.mergeArray(r,a)):De.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new At({...this._def,rest:t})}}At.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new At({items:e,typeName:te.ZodTuple,rest:null,...se(t)})};class un extends ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==W.object)return z(n,{code:k.invalid_type,expected:W.object,received:n.parsedType}),ee;const s=[],o=this._def.keyType,a=this._def.valueType;for(const i in n.data)s.push({key:o._parse(new Pt(n,i,n.path,i)),value:a._parse(new Pt(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?De.mergeObjectAsync(r,s):De.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof ae?new un({keyType:t,valueType:r,typeName:te.ZodRecord,...se(n)}):new un({keyType:ft.create(),valueType:t,typeName:te.ZodRecord,...se(r)})}}class hs extends ae{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==W.map)return z(n,{code:k.invalid_type,expected:W.map,received:n.parsedType}),ee;const s=this._def.keyType,o=this._def.valueType,a=[...n.data.entries()].map(([i,c],l)=>({key:s._parse(new Pt(n,i,n.path,[l,"key"])),value:o._parse(new Pt(n,c,n.path,[l,"value"]))}));if(n.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const c of a){const l=await c.key,h=await c.value;if(l.status==="aborted"||h.status==="aborted")return ee;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),i.set(l.value,h.value)}return{status:r.value,value:i}})}else{const i=new Map;for(const c of a){const l=c.key,h=c.value;if(l.status==="aborted"||h.status==="aborted")return ee;(l.status==="dirty"||h.status==="dirty")&&r.dirty(),i.set(l.value,h.value)}return{status:r.value,value:i}}}}hs.create=(e,t,r)=>new hs({valueType:t,keyType:e,typeName:te.ZodMap,...se(r)});class br extends ae{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==W.set)return z(n,{code:k.invalid_type,expected:W.set,received:n.parsedType}),ee;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(z(n,{code:k.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(z(n,{code:k.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());const o=this._def.valueType;function a(c){const l=new Set;for(const h of c){if(h.status==="aborted")return ee;h.status==="dirty"&&r.dirty(),l.add(h.value)}return{status:r.value,value:l}}const i=[...n.data.values()].map((c,l)=>o._parse(new Pt(n,c,n.path,l)));return n.common.async?Promise.all(i).then(c=>a(c)):a(i)}min(t,r){return new br({...this._def,minSize:{value:t,message:Q.toString(r)}})}max(t,r){return new br({...this._def,maxSize:{value:t,message:Q.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}}br.create=(e,t)=>new br({valueType:e,minSize:null,maxSize:null,typeName:te.ZodSet,...se(t)});class Mr extends ae{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==W.function)return z(r,{code:k.invalid_type,expected:W.function,received:r.parsedType}),ee;function n(i,c){return us({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ls(),Dr].filter(l=>!!l),issueData:{code:k.invalid_arguments,argumentsError:c}})}function s(i,c){return us({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ls(),Dr].filter(l=>!!l),issueData:{code:k.invalid_return_type,returnTypeError:c}})}const o={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof Lr){const i=this;return $e(async function(...c){const l=new Ye([]),h=await i._def.args.parseAsync(c,o).catch(g=>{throw l.addIssue(n(c,g)),l}),u=await Reflect.apply(a,this,h);return await i._def.returns._def.type.parseAsync(u,o).catch(g=>{throw l.addIssue(s(u,g)),l})})}else{const i=this;return $e(function(...c){const l=i._def.args.safeParse(c,o);if(!l.success)throw new Ye([n(c,l.error)]);const h=Reflect.apply(a,this,l.data),u=i._def.returns.safeParse(h,o);if(!u.success)throw new Ye([s(h,u.error)]);return u.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Mr({...this._def,args:At.create(t).rest(ur.create())})}returns(t){return new Mr({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new Mr({args:t||At.create([]).rest(ur.create()),returns:r||ur.create(),typeName:te.ZodFunction,...se(n)})}}class dn extends ae{get schema(){return this._def.getter()}_parse(t){const{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}dn.create=(e,t)=>new dn({getter:e,typeName:te.ZodLazy,...se(t)});class fn extends ae{_parse(t){if(t.data!==this._def.value){const r=this._getOrReturnCtx(t);return z(r,{received:r.data,code:k.invalid_literal,expected:this._def.value}),ee}return{status:"valid",value:t.data}}get value(){return this._def.value}}fn.create=(e,t)=>new fn({value:e,typeName:te.ZodLiteral,...se(t)});function bu(e,t){return new tr({values:e,typeName:te.ZodEnum,...se(t)})}class tr extends ae{_parse(t){if(typeof t.data!="string"){const r=this._getOrReturnCtx(t),n=this._def.values;return z(r,{expected:fe.joinValues(n),received:r.parsedType,code:k.invalid_type}),ee}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const r=this._getOrReturnCtx(t),n=this._def.values;return z(r,{received:r.data,code:k.invalid_enum_value,options:n}),ee}return $e(t.data)}get options(){return this._def.values}get enum(){const t={};for(const r of this._def.values)t[r]=r;return t}get Values(){const t={};for(const r of this._def.values)t[r]=r;return t}get Enum(){const t={};for(const r of this._def.values)t[r]=r;return t}extract(t,r=this._def){return tr.create(t,{...this._def,...r})}exclude(t,r=this._def){return tr.create(this.options.filter(n=>!t.includes(n)),{...this._def,...r})}}tr.create=bu;class hn extends ae{_parse(t){const r=fe.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==W.string&&n.parsedType!==W.number){const s=fe.objectValues(r);return z(n,{expected:fe.joinValues(s),received:n.parsedType,code:k.invalid_type}),ee}if(this._cache||(this._cache=new Set(fe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=fe.objectValues(r);return z(n,{received:n.data,code:k.invalid_enum_value,options:s}),ee}return $e(t.data)}get enum(){return this._def.values}}hn.create=(e,t)=>new hn({values:e,typeName:te.ZodNativeEnum,...se(t)});class Lr extends ae{unwrap(){return this._def.type}_parse(t){const{ctx:r}=this._processInputParams(t);if(r.parsedType!==W.promise&&r.common.async===!1)return z(r,{code:k.invalid_type,expected:W.promise,received:r.parsedType}),ee;const n=r.parsedType===W.promise?r.data:Promise.resolve(r.data);return $e(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}}Lr.create=(e,t)=>new Lr({type:e,typeName:te.ZodPromise,...se(t)});class gt extends ae{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===te.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:r,ctx:n}=this._processInputParams(t),s=this._def.effect||null,o={addIssue:a=>{z(n,a),a.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="preprocess"){const a=s.transform(n.data,o);if(n.common.async)return Promise.resolve(a).then(async i=>{if(r.value==="aborted")return ee;const c=await this._def.schema._parseAsync({data:i,path:n.path,parent:n});return c.status==="aborted"?ee:c.status==="dirty"||r.value==="dirty"?kr(c.value):c});{if(r.value==="aborted")return ee;const i=this._def.schema._parseSync({data:a,path:n.path,parent:n});return i.status==="aborted"?ee:i.status==="dirty"||r.value==="dirty"?kr(i.value):i}}if(s.type==="refinement"){const a=i=>{const c=s.refinement(i,o);if(n.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?ee:(i.status==="dirty"&&r.dirty(),a(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?ee:(i.status==="dirty"&&r.dirty(),a(i.value).then(()=>({status:r.value,value:i.value}))))}if(s.type==="transform")if(n.common.async===!1){const a=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!yr(a))return ee;const i=s.transform(a.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(a=>yr(a)?Promise.resolve(s.transform(a.value,o)).then(i=>({status:r.value,value:i})):ee);fe.assertNever(s)}}gt.create=(e,t,r)=>new gt({schema:e,typeName:te.ZodEffects,effect:t,...se(r)});gt.createWithPreprocess=(e,t,r)=>new gt({schema:t,effect:{type:"preprocess",transform:e},typeName:te.ZodEffects,...se(r)});class Rt extends ae{_parse(t){return this._getType(t)===W.undefined?$e(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Rt.create=(e,t)=>new Rt({innerType:e,typeName:te.ZodOptional,...se(t)});class rr extends ae{_parse(t){return this._getType(t)===W.null?$e(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}rr.create=(e,t)=>new rr({innerType:e,typeName:te.ZodNullable,...se(t)});class pn extends ae{_parse(t){const{ctx:r}=this._processInputParams(t);let n=r.data;return r.parsedType===W.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}pn.create=(e,t)=>new pn({innerType:e,typeName:te.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...se(t)});class mn extends ae{_parse(t){const{ctx:r}=this._processInputParams(t),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return nn(s)?s.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ye(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Ye(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}mn.create=(e,t)=>new mn({innerType:e,typeName:te.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...se(t)});class ps extends ae{_parse(t){if(this._getType(t)!==W.nan){const n=this._getOrReturnCtx(t);return z(n,{code:k.invalid_type,expected:W.nan,received:n.parsedType}),ee}return{status:"valid",value:t.data}}}ps.create=e=>new ps({typeName:te.ZodNaN,...se(e)});const oy=Symbol("zod_brand");class la extends ae{_parse(t){const{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}}class An extends ae{_parse(t){const{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?ee:o.status==="dirty"?(r.dirty(),kr(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?ee:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new An({in:t,out:r,typeName:te.ZodPipeline})}}class gn extends ae{_parse(t){const r=this._def.innerType._parse(t),n=s=>(yr(s)&&(s.value=Object.freeze(s.value)),s);return nn(r)?r.then(s=>n(s)):n(r)}unwrap(){return this._def.innerType}}gn.create=(e,t)=>new gn({innerType:e,typeName:te.ZodReadonly,...se(t)});function Ci(e,t){const r=typeof e=="function"?e(t):typeof e=="string"?{message:e}:e;return typeof r=="string"?{message:r}:r}function wu(e,t={},r){return e?Fr.create().superRefine((n,s)=>{const o=e(n);if(o instanceof Promise)return o.then(a=>{if(!a){const i=Ci(t,n),c=i.fatal??r??!0;s.addIssue({code:"custom",...i,fatal:c})}});if(!o){const a=Ci(t,n),i=a.fatal??r??!0;s.addIssue({code:"custom",...a,fatal:i})}}):Fr.create()}const ay={object:_e.lazycreate};var te;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(te||(te={}));const iy=(e,t={message:`Input not instance of ${e.name}`})=>wu(r=>r instanceof e,t),_u=ft.create,Su=Jt.create,cy=ps.create,ly=er.create,Cu=sn.create,uy=xr.create,dy=ds.create,fy=on.create,hy=an.create,py=Fr.create,my=ur.create,gy=zt.create,vy=fs.create,yy=ht.create,xy=_e.create,by=_e.strictCreate,wy=cn.create,_y=js.create,Sy=ln.create,Cy=At.create,Ey=un.create,Ry=hs.create,Ty=br.create,Py=Mr.create,Ay=dn.create,ky=fn.create,Oy=tr.create,Ny=hn.create,My=Lr.create,Ei=gt.create,jy=Rt.create,Iy=rr.create,Dy=gt.createWithPreprocess,Fy=An.create,Ly=()=>_u().optional(),Vy=()=>Su().optional(),$y=()=>Cu().optional(),By={string:(e=>ft.create({...e,coerce:!0})),number:(e=>Jt.create({...e,coerce:!0})),boolean:(e=>sn.create({...e,coerce:!0})),bigint:(e=>er.create({...e,coerce:!0})),date:(e=>xr.create({...e,coerce:!0}))},Uy=ee,Fe=Object.freeze(Object.defineProperty({__proto__:null,BRAND:oy,DIRTY:kr,EMPTY_PATH:Fv,INVALID:ee,NEVER:Uy,OK:$e,ParseStatus:De,Schema:ae,ZodAny:Fr,ZodArray:ht,ZodBigInt:er,ZodBoolean:sn,ZodBranded:la,ZodCatch:mn,ZodDate:xr,ZodDefault:pn,ZodDiscriminatedUnion:js,ZodEffects:gt,ZodEnum:tr,ZodError:Ye,get ZodFirstPartyTypeKind(){return te},ZodFunction:Mr,ZodIntersection:ln,ZodIssueCode:k,ZodLazy:dn,ZodLiteral:fn,ZodMap:hs,ZodNaN:ps,ZodNativeEnum:hn,ZodNever:zt,ZodNull:an,ZodNullable:rr,ZodNumber:Jt,ZodObject:_e,ZodOptional:Rt,ZodParsedType:W,ZodPipeline:An,ZodPromise:Lr,ZodReadonly:gn,ZodRecord:un,ZodSchema:ae,ZodSet:br,ZodString:ft,ZodSymbol:ds,ZodTransformer:gt,ZodTuple:At,ZodType:ae,ZodUndefined:on,ZodUnion:cn,ZodUnknown:ur,ZodVoid:fs,addIssueToContext:z,any:py,array:yy,bigint:ly,boolean:Cu,coerce:By,custom:wu,date:uy,datetimeRegex:xu,defaultErrorMap:Dr,discriminatedUnion:_y,effect:Ei,enum:Oy,function:Py,getErrorMap:ls,getParsedType:Lt,instanceof:iy,intersection:Sy,isAborted:Eo,isAsync:nn,isDirty:Ro,isValid:yr,late:ay,lazy:Ay,literal:ky,makeIssue:us,map:Ry,nan:cy,nativeEnum:Ny,never:gy,null:hy,nullable:Iy,number:Su,object:xy,get objectUtil(){return Co},oboolean:$y,onumber:Vy,optional:jy,ostring:Ly,pipeline:Fy,preprocess:Dy,promise:My,quotelessJson:Iv,record:Ey,set:Ty,setErrorMap:Dv,strictObject:by,string:_u,symbol:dy,transformer:Ei,tuple:Cy,undefined:fy,union:wy,unknown:my,get util(){return fe},void:vy},Symbol.toStringTag,{value:"Module"})),zy=Fe.object({images:Fe.array(Fe.string()).min(1,"At least 1 image is required"),title:Fe.string().min(1,"Product title is required").min(5,"Product title must be at least 5 characters"),price:Fe.preprocess(e=>typeof e=="string"?Number(e):e,Fe.number({invalid_type_error:"Price must be a number",required_error:"Price is required"}).min(1,"Price must be greater than 0")),category:Fe.string().min(1,"Category is required"),condition:Fe.string().min(1,"Condition is required"),brand:Fe.string().optional(),description:Fe.string().min(1,"Description is required").min(20,"Description must be at least 20 characters"),tags:Fe.array(Fe.string()).optional(),sku:Fe.string().min(1,"Sku must be required"),location:Fe.string().optional(),publist:Fe.boolean().optional()});function Hy({children:e,data:t,...r}){const[n,s]=f.useState(!1),[o,a]=f.useState(""),[i,c]=f.useState(""),l=og({resolver:vg(zy),defaultValues:{images:[],title:"",price:0,category:"",condition:"",brand:"",description:"",tags:[],sku:"",location:"",publist:!1}}),h=l.watch("images"),u=l.watch("tags"),p=["New","Used - like new","Used - good","Used - fair"],g=["Tools","Electronics & computers"],{refetch:x,...m}=jv(t),y=()=>{if(o.trim()&&!u?.includes(o.trim())){const _=l.getValues("tags")||[];l.setValue("tags",[..._,o.trim()]),a("")}},w=_=>{const A=l.getValues("tags")||[];l.setValue("tags",A.filter(P=>P!==_))},b=async({images:_,...A})=>{try{let P=[];if(t){const F=t.images||[];P=(_||[]).filter(L=>!F.includes(L))}else P=_||[];const O=await Promise.all(P.map(async F=>F.startsWith("blob:")?await wd(F):F)),I={...A,images:O};console.log("Product data to submit:",I),console.log("Hình mới cần xử lý:",O)}catch(P){console.error("Error submitting form:",P)}},C=()=>{s(!1),l.reset(),c(""),a("")},S=Gi({mutationKey:["createBlobUrl",t?.sku],mutationFn:_=>qe.apiRequest("createBlobUrl",_)});return f.useEffect(()=>{(async()=>{if(!m.data?.data||!t)return;const _=ro({...m.data?.data}).images,A=await S.mutateAsync(_),P={...t,images:A};l.reset(P)})()},[m.data,t]),d.jsxs(Dg,{open:n,onOpenChange:s,children:[d.jsx(Fg,{asChild:!0,children:e}),d.jsxs($g,{"aria-describedby":void 0,className:"md:max-w-4xl h-[95vh] flex flex-col p-0",children:[d.jsx(Bg,{className:"p-6 border-b",children:d.jsx(Ug,{className:"text-2xl font-bold",children:t?"Edit product":"Create new product"})}),!m.isLoading&&!S.isPending&&d.jsx("div",{className:"flex-1 overflow-y-auto p-6",children:d.jsx(Mv,{...l,children:d.jsxs("form",{onSubmit:l.handleSubmit(b),className:"space-y-8",children:[d.jsx(Js,{children:d.jsx(eo,{className:"p-6",children:d.jsx(jt,{control:l.control,name:"images",render:()=>d.jsxs(It,{children:[d.jsx(yt,{className:"text-lg font-semibold",children:"Images *"}),d.jsx(Dt,{}),h.length>0&&d.jsx("div",{className:"mt-6 overflow-x-auto",children:d.jsx("div",{className:"flex gap-3",children:h.map((_,A)=>d.jsx("div",{className:"relative flex-shrink-0 w-32 h-32 group rounded-lg border overflow-hidden",children:d.jsx("img",{src:_||"/placeholder.svg",alt:`Preview ${A+1}`,className:"w-full h-full object-cover"})},A))})})]})})})}),d.jsx(Js,{children:d.jsxs(eo,{className:"p-6 space-y-6",children:[d.jsx("h3",{className:"text-lg font-semibold border-b pb-2",children:"Product information"}),d.jsx(jt,{control:l.control,name:"title",render:({field:_})=>d.jsxs(It,{children:[d.jsx(yt,{children:"Title *"}),d.jsx(Gt,{children:d.jsx(cr,{placeholder:"VD: MacBook Pro 14-inch 2023",..._})}),d.jsx(Dt,{})]})}),d.jsx(jt,{control:l.control,name:"price",render:({field:_})=>d.jsxs(It,{children:[d.jsx(yt,{children:"Price ($) *"}),d.jsx(Gt,{children:d.jsx(cr,{type:"number",placeholder:"10",..._})}),d.jsx(Dt,{})]})}),d.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[d.jsx(jt,{control:l.control,name:"category",render:({field:_})=>d.jsxs(It,{children:[d.jsx(yt,{children:"Category *"}),d.jsx(Gt,{children:d.jsxs(yi,{onValueChange:_.onChange,value:_.value,children:[d.jsx(bi,{className:"w-full",children:d.jsx(xi,{placeholder:"Select category"})}),d.jsx(wi,{children:g.map(A=>d.jsx(_i,{value:A.toLowerCase(),children:A},A))})]})}),d.jsx(Dt,{})]})}),d.jsx(jt,{control:l.control,name:"condition",render:({field:_})=>d.jsxs(It,{children:[d.jsx(yt,{children:"Condition *"}),d.jsx(Gt,{children:d.jsxs(yi,{onValueChange:_.onChange,value:_.value,children:[d.jsx(bi,{className:"w-full",children:d.jsx(xi,{placeholder:"Select condition"})}),d.jsx(wi,{children:p.map(A=>d.jsx(_i,{value:A.toLowerCase(),children:A},A))})]})}),d.jsx(Dt,{})]})}),d.jsx(jt,{control:l.control,name:"brand",render:({field:_})=>d.jsxs(It,{children:[d.jsx(yt,{children:"Brand"}),d.jsx(Gt,{children:d.jsx(cr,{readOnly:!!t,placeholder:"VD: Cisco",..._})}),d.jsx(Dt,{})]})})]}),d.jsx(jt,{control:l.control,name:"description",render:({field:_})=>d.jsxs(It,{children:[d.jsx(yt,{children:"Description *"}),d.jsx(Gt,{children:d.jsx(Av,{rows:4,..._})}),d.jsx(Dt,{})]})})]})}),d.jsx(Js,{children:d.jsxs(eo,{className:"p-6 space-y-6",children:[d.jsx("h3",{className:"text-lg font-semibold border-b pb-2",children:"Additional information"}),d.jsxs("div",{className:"space-y-3",children:[d.jsx(yt,{children:"Tags"}),d.jsx("div",{className:"flex gap-2",children:d.jsx(cr,{value:o,onChange:_=>a(_.target.value),placeholder:"Tag and press Enter",onKeyDown:_=>{_.key==="Enter"&&(_.preventDefault(),y())}})}),u&&u?.length>0&&d.jsx("div",{className:"flex flex-wrap gap-2",children:u.map(_=>d.jsxs(Cl,{onClick:()=>w(_),variant:"secondary",className:"flex items-center gap-1 px-3 py-1",children:[_,d.jsx(jo,{className:"w-3 h-3 cursor-pointer hover:text-red-500"})]},_))})]}),d.jsx(jt,{control:l.control,name:"sku",render:({field:_})=>d.jsxs(It,{children:[d.jsx(yt,{children:"Sku *"}),d.jsx(Gt,{children:d.jsx(cr,{readOnly:!!t,placeholder:"VD: MBP14-2023-512GB",..._})}),d.jsx(Dt,{})]})}),d.jsx(jt,{control:l.control,name:"location",render:({field:_})=>d.jsxs(It,{children:[d.jsx(yt,{children:"Location"}),d.jsx(Gt,{children:d.jsx(cr,{placeholder:"VD: Hà Nội, Việt Nam",..._})}),d.jsx(Dt,{})]})})]})})]})})}),(m.isLoading||S.isPending)&&d.jsx("div",{className:"flex items-center justify-center w-full h-full",children:d.jsx(ol,{})}),d.jsx("div",{className:"p-6 border-t bg-white flex justify-end gap-3",children:d.jsx(bt,{type:"button",variant:"outline",onClick:C,children:"Close"})})]})]})}var Po=["Enter"," "],Wy=["ArrowDown","PageUp","Home"],Eu=["ArrowUp","PageDown","End"],Zy=[...Wy,...Eu],qy={ltr:[...Po,"ArrowRight"],rtl:[...Po,"ArrowLeft"]},Gy={ltr:["ArrowLeft"],rtl:["ArrowRight"]},kn="Menu",[vn,Ky,Qy]=Go(kn),[wr,Ru]=kt(kn,[Qy,zr,Ts]),Is=zr(),Tu=Ts(),[Yy,_r]=wr(kn),[Xy,On]=wr(kn),Pu=e=>{const{__scopeMenu:t,open:r=!1,children:n,dir:s,onOpenChange:o,modal:a=!0}=e,i=Is(t),[c,l]=f.useState(null),h=f.useRef(!1),u=Oe(o),p=Rn(s);return f.useEffect(()=>{const g=()=>{h.current=!0,document.addEventListener("pointerdown",x,{capture:!0,once:!0}),document.addEventListener("pointermove",x,{capture:!0,once:!0})},x=()=>h.current=!1;return document.addEventListener("keydown",g,{capture:!0}),()=>{document.removeEventListener("keydown",g,{capture:!0}),document.removeEventListener("pointerdown",x,{capture:!0}),document.removeEventListener("pointermove",x,{capture:!0})}},[]),d.jsx(Ho,{...i,children:d.jsx(Yy,{scope:t,open:r,onOpenChange:u,content:c,onContentChange:l,children:d.jsx(Xy,{scope:t,onClose:f.useCallback(()=>u(!1),[u]),isUsingKeyboardRef:h,dir:p,modal:a,children:n})})})};Pu.displayName=kn;var Jy="MenuAnchor",ua=f.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Is(r);return d.jsx(Ss,{...s,...n,ref:t})});ua.displayName=Jy;var da="MenuPortal",[ex,Au]=wr(da,{forceMount:void 0}),ku=e=>{const{__scopeMenu:t,forceMount:r,children:n,container:s}=e,o=_r(da,t);return d.jsx(ex,{scope:t,forceMount:r,children:d.jsx(We,{present:r||o.open,children:d.jsx(Sn,{asChild:!0,container:s,children:n})})})};ku.displayName=da;var tt="MenuContent",[tx,fa]=wr(tt),Ou=f.forwardRef((e,t)=>{const r=Au(tt,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=_r(tt,e.__scopeMenu),a=On(tt,e.__scopeMenu);return d.jsx(vn.Provider,{scope:e.__scopeMenu,children:d.jsx(We,{present:n||o.open,children:d.jsx(vn.Slot,{scope:e.__scopeMenu,children:a.modal?d.jsx(rx,{...s,ref:t}):d.jsx(nx,{...s,ref:t})})})})}),rx=f.forwardRef((e,t)=>{const r=_r(tt,e.__scopeMenu),n=f.useRef(null),s=ue(t,n);return f.useEffect(()=>{const o=n.current;if(o)return Cs(o)},[]),d.jsx(ha,{...e,ref:s,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:Z(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})}),nx=f.forwardRef((e,t)=>{const r=_r(tt,e.__scopeMenu);return d.jsx(ha,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})}),sx=dr("MenuContent.ScrollLock"),ha=f.forwardRef((e,t)=>{const{__scopeMenu:r,loop:n=!1,trapFocus:s,onOpenAutoFocus:o,onCloseAutoFocus:a,disableOutsidePointerEvents:i,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:h,onFocusOutside:u,onInteractOutside:p,onDismiss:g,disableOutsideScroll:x,...m}=e,y=_r(tt,r),w=On(tt,r),b=Is(r),C=Tu(r),S=Ky(r),[_,A]=f.useState(null),P=f.useRef(null),O=ue(t,P,y.onContentChange),I=f.useRef(0),F=f.useRef(""),G=f.useRef(0),L=f.useRef(null),N=f.useRef("right"),$=f.useRef(0),X=x?Cn:f.Fragment,M=x?{as:sx,allowPinchZoom:!0}:void 0,K=D=>{const ie=F.current+D,be=S().filter(H=>!H.disabled),Pe=document.activeElement,re=be.find(H=>H.ref.current===Pe)?.textValue,ce=be.map(H=>H.textValue),le=gx(ce,ie,re),xe=be.find(H=>H.textValue===le)?.ref.current;(function H(J){F.current=J,window.clearTimeout(I.current),J!==""&&(I.current=window.setTimeout(()=>H(""),1e3))})(ie),xe&&setTimeout(()=>xe.focus())};f.useEffect(()=>()=>window.clearTimeout(I.current),[]),xs();const q=f.useCallback(D=>N.current===L.current?.side&&yx(D,L.current?.area),[]);return d.jsx(tx,{scope:r,searchRef:F,onItemEnter:f.useCallback(D=>{q(D)&&D.preventDefault()},[q]),onItemLeave:f.useCallback(D=>{q(D)||(P.current?.focus(),A(null))},[q]),onTriggerLeave:f.useCallback(D=>{q(D)&&D.preventDefault()},[q]),pointerGraceTimerRef:G,onPointerGraceIntentChange:f.useCallback(D=>{L.current=D},[]),children:d.jsx(X,{...M,children:d.jsx(wn,{asChild:!0,trapped:s,onMountAutoFocus:Z(o,D=>{D.preventDefault(),P.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:a,children:d.jsx(bn,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:l,onPointerDownOutside:h,onFocusOutside:u,onInteractOutside:p,onDismiss:g,children:d.jsx(Gc,{asChild:!0,...C,dir:w.dir,orientation:"vertical",loop:n,currentTabStopId:_,onCurrentTabStopIdChange:A,onEntryFocus:Z(c,D=>{w.isUsingKeyboardRef.current||D.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(Wo,{role:"menu","aria-orientation":"vertical","data-state":qu(y.open),"data-radix-menu-content":"",dir:w.dir,...b,...m,ref:O,style:{outline:"none",...m.style},onKeyDown:Z(m.onKeyDown,D=>{const be=D.target.closest("[data-radix-menu-content]")===D.currentTarget,Pe=D.ctrlKey||D.altKey||D.metaKey,re=D.key.length===1;be&&(D.key==="Tab"&&D.preventDefault(),!Pe&&re&&K(D.key));const ce=P.current;if(D.target!==ce||!Zy.includes(D.key))return;D.preventDefault();const xe=S().filter(H=>!H.disabled).map(H=>H.ref.current);Eu.includes(D.key)&&xe.reverse(),px(xe)}),onBlur:Z(e.onBlur,D=>{D.currentTarget.contains(D.target)||(window.clearTimeout(I.current),F.current="")}),onPointerMove:Z(e.onPointerMove,yn(D=>{const ie=D.target,be=$.current!==D.clientX;if(D.currentTarget.contains(ie)&&be){const Pe=D.clientX>$.current?"right":"left";N.current=Pe,$.current=D.clientX}}))})})})})})})});Ou.displayName=tt;var ox="MenuGroup",pa=f.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return d.jsx(ne.div,{role:"group",...n,ref:t})});pa.displayName=ox;var ax="MenuLabel",Nu=f.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return d.jsx(ne.div,{...n,ref:t})});Nu.displayName=ax;var ms="MenuItem",Ri="menu.itemSelect",Ds=f.forwardRef((e,t)=>{const{disabled:r=!1,onSelect:n,...s}=e,o=f.useRef(null),a=On(ms,e.__scopeMenu),i=fa(ms,e.__scopeMenu),c=ue(t,o),l=f.useRef(!1),h=()=>{const u=o.current;if(!r&&u){const p=new CustomEvent(Ri,{bubbles:!0,cancelable:!0});u.addEventListener(Ri,g=>n?.(g),{once:!0}),ec(u,p),p.defaultPrevented?l.current=!1:a.onClose()}};return d.jsx(Mu,{...s,ref:c,disabled:r,onClick:Z(e.onClick,h),onPointerDown:u=>{e.onPointerDown?.(u),l.current=!0},onPointerUp:Z(e.onPointerUp,u=>{l.current||u.currentTarget?.click()}),onKeyDown:Z(e.onKeyDown,u=>{const p=i.searchRef.current!=="";r||p&&u.key===" "||Po.includes(u.key)&&(u.currentTarget.click(),u.preventDefault())})})});Ds.displayName=ms;var Mu=f.forwardRef((e,t)=>{const{__scopeMenu:r,disabled:n=!1,textValue:s,...o}=e,a=fa(ms,r),i=Tu(r),c=f.useRef(null),l=ue(t,c),[h,u]=f.useState(!1),[p,g]=f.useState("");return f.useEffect(()=>{const x=c.current;x&&g((x.textContent??"").trim())},[o.children]),d.jsx(vn.ItemSlot,{scope:r,disabled:n,textValue:s??p,children:d.jsx(Kc,{asChild:!0,...i,focusable:!n,children:d.jsx(ne.div,{role:"menuitem","data-highlighted":h?"":void 0,"aria-disabled":n||void 0,"data-disabled":n?"":void 0,...o,ref:l,onPointerMove:Z(e.onPointerMove,yn(x=>{n?a.onItemLeave(x):(a.onItemEnter(x),x.defaultPrevented||x.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Z(e.onPointerLeave,yn(x=>a.onItemLeave(x))),onFocus:Z(e.onFocus,()=>u(!0)),onBlur:Z(e.onBlur,()=>u(!1))})})})}),ix="MenuCheckboxItem",ju=f.forwardRef((e,t)=>{const{checked:r=!1,onCheckedChange:n,...s}=e;return d.jsx(Vu,{scope:e.__scopeMenu,checked:r,children:d.jsx(Ds,{role:"menuitemcheckbox","aria-checked":gs(r)?"mixed":r,...s,ref:t,"data-state":ga(r),onSelect:Z(s.onSelect,()=>n?.(gs(r)?!0:!r),{checkForDefaultPrevented:!1})})})});ju.displayName=ix;var Iu="MenuRadioGroup",[cx,lx]=wr(Iu,{value:void 0,onValueChange:()=>{}}),Du=f.forwardRef((e,t)=>{const{value:r,onValueChange:n,...s}=e,o=Oe(n);return d.jsx(cx,{scope:e.__scopeMenu,value:r,onValueChange:o,children:d.jsx(pa,{...s,ref:t})})});Du.displayName=Iu;var Fu="MenuRadioItem",Lu=f.forwardRef((e,t)=>{const{value:r,...n}=e,s=lx(Fu,e.__scopeMenu),o=r===s.value;return d.jsx(Vu,{scope:e.__scopeMenu,checked:o,children:d.jsx(Ds,{role:"menuitemradio","aria-checked":o,...n,ref:t,"data-state":ga(o),onSelect:Z(n.onSelect,()=>s.onValueChange?.(r),{checkForDefaultPrevented:!1})})})});Lu.displayName=Fu;var ma="MenuItemIndicator",[Vu,ux]=wr(ma,{checked:!1}),$u=f.forwardRef((e,t)=>{const{__scopeMenu:r,forceMount:n,...s}=e,o=ux(ma,r);return d.jsx(We,{present:n||gs(o.checked)||o.checked===!0,children:d.jsx(ne.span,{...s,ref:t,"data-state":ga(o.checked)})})});$u.displayName=ma;var dx="MenuSeparator",Bu=f.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e;return d.jsx(ne.div,{role:"separator","aria-orientation":"horizontal",...n,ref:t})});Bu.displayName=dx;var fx="MenuArrow",Uu=f.forwardRef((e,t)=>{const{__scopeMenu:r,...n}=e,s=Is(r);return d.jsx(Zo,{...s,...n,ref:t})});Uu.displayName=fx;var hx="MenuSub",[xw,zu]=wr(hx),Yr="MenuSubTrigger",Hu=f.forwardRef((e,t)=>{const r=_r(Yr,e.__scopeMenu),n=On(Yr,e.__scopeMenu),s=zu(Yr,e.__scopeMenu),o=fa(Yr,e.__scopeMenu),a=f.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:c}=o,l={__scopeMenu:e.__scopeMenu},h=f.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=null},[]);return f.useEffect(()=>h,[h]),f.useEffect(()=>{const u=i.current;return()=>{window.clearTimeout(u),c(null)}},[i,c]),d.jsx(ua,{asChild:!0,...l,children:d.jsx(Mu,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":s.contentId,"data-state":qu(r.open),...e,ref:ji(t,s.onTriggerChange),onClick:u=>{e.onClick?.(u),!(e.disabled||u.defaultPrevented)&&(u.currentTarget.focus(),r.open||r.onOpenChange(!0))},onPointerMove:Z(e.onPointerMove,yn(u=>{o.onItemEnter(u),!u.defaultPrevented&&!e.disabled&&!r.open&&!a.current&&(o.onPointerGraceIntentChange(null),a.current=window.setTimeout(()=>{r.onOpenChange(!0),h()},100))})),onPointerLeave:Z(e.onPointerLeave,yn(u=>{h();const p=r.content?.getBoundingClientRect();if(p){const g=r.content?.dataset.side,x=g==="right",m=x?-5:5,y=p[x?"left":"right"],w=p[x?"right":"left"];o.onPointerGraceIntentChange({area:[{x:u.clientX+m,y:u.clientY},{x:y,y:p.top},{x:w,y:p.top},{x:w,y:p.bottom},{x:y,y:p.bottom}],side:g}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(u),u.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:Z(e.onKeyDown,u=>{const p=o.searchRef.current!=="";e.disabled||p&&u.key===" "||qy[n.dir].includes(u.key)&&(r.onOpenChange(!0),r.content?.focus(),u.preventDefault())})})})});Hu.displayName=Yr;var Wu="MenuSubContent",Zu=f.forwardRef((e,t)=>{const r=Au(tt,e.__scopeMenu),{forceMount:n=r.forceMount,...s}=e,o=_r(tt,e.__scopeMenu),a=On(tt,e.__scopeMenu),i=zu(Wu,e.__scopeMenu),c=f.useRef(null),l=ue(t,c);return d.jsx(vn.Provider,{scope:e.__scopeMenu,children:d.jsx(We,{present:n||o.open,children:d.jsx(vn.Slot,{scope:e.__scopeMenu,children:d.jsx(ha,{id:i.contentId,"aria-labelledby":i.triggerId,...s,ref:l,align:"start",side:a.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:h=>{a.isUsingKeyboardRef.current&&c.current?.focus(),h.preventDefault()},onCloseAutoFocus:h=>h.preventDefault(),onFocusOutside:Z(e.onFocusOutside,h=>{h.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:Z(e.onEscapeKeyDown,h=>{a.onClose(),h.preventDefault()}),onKeyDown:Z(e.onKeyDown,h=>{const u=h.currentTarget.contains(h.target),p=Gy[a.dir].includes(h.key);u&&p&&(o.onOpenChange(!1),i.trigger?.focus(),h.preventDefault())})})})})})});Zu.displayName=Wu;function qu(e){return e?"open":"closed"}function gs(e){return e==="indeterminate"}function ga(e){return gs(e)?"indeterminate":e?"checked":"unchecked"}function px(e){const t=document.activeElement;for(const r of e)if(r===t||(r.focus(),document.activeElement!==t))return}function mx(e,t){return e.map((r,n)=>e[(t+n)%e.length])}function gx(e,t,r){const s=t.length>1&&Array.from(t).every(l=>l===t[0])?t[0]:t,o=r?e.indexOf(r):-1;let a=mx(e,Math.max(o,0));s.length===1&&(a=a.filter(l=>l!==r));const c=a.find(l=>l.toLowerCase().startsWith(s.toLowerCase()));return c!==r?c:void 0}function vx(e,t){const{x:r,y:n}=e;let s=!1;for(let o=0,a=t.length-1;o<t.length;a=o++){const i=t[o],c=t[a],l=i.x,h=i.y,u=c.x,p=c.y;h>n!=p>n&&r<(u-l)*(n-h)/(p-h)+l&&(s=!s)}return s}function yx(e,t){if(!t)return!1;const r={x:e.clientX,y:e.clientY};return vx(r,t)}function yn(e){return t=>t.pointerType==="mouse"?e(t):void 0}var xx=Pu,bx=ua,wx=ku,_x=Ou,Sx=pa,Cx=Nu,Ex=Ds,Rx=ju,Tx=Du,Px=Lu,Ax=$u,kx=Bu,Ox=Uu,Nx=Hu,Mx=Zu,Fs="DropdownMenu",[jx,bw]=kt(Fs,[Ru]),Be=Ru(),[Ix,Gu]=jx(Fs),Ku=e=>{const{__scopeDropdownMenu:t,children:r,dir:n,open:s,defaultOpen:o,onOpenChange:a,modal:i=!0}=e,c=Be(t),l=f.useRef(null),[h,u]=Ut({prop:s,defaultProp:o??!1,onChange:a,caller:Fs});return d.jsx(Ix,{scope:t,triggerId:Ct(),triggerRef:l,contentId:Ct(),open:h,onOpenChange:u,onOpenToggle:f.useCallback(()=>u(p=>!p),[u]),modal:i,children:d.jsx(xx,{...c,open:h,onOpenChange:u,dir:n,modal:i,children:r})})};Ku.displayName=Fs;var Qu="DropdownMenuTrigger",Yu=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,disabled:n=!1,...s}=e,o=Gu(Qu,r),a=Be(r);return d.jsx(bx,{asChild:!0,...a,children:d.jsx(ne.button,{type:"button",id:o.triggerId,"aria-haspopup":"menu","aria-expanded":o.open,"aria-controls":o.open?o.contentId:void 0,"data-state":o.open?"open":"closed","data-disabled":n?"":void 0,disabled:n,...s,ref:ji(t,o.triggerRef),onPointerDown:Z(e.onPointerDown,i=>{!n&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:Z(e.onKeyDown,i=>{n||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});Yu.displayName=Qu;var Dx="DropdownMenuPortal",Xu=e=>{const{__scopeDropdownMenu:t,...r}=e,n=Be(t);return d.jsx(wx,{...n,...r})};Xu.displayName=Dx;var Ju="DropdownMenuContent",ed=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Gu(Ju,r),o=Be(r),a=f.useRef(!1);return d.jsx(_x,{id:s.contentId,"aria-labelledby":s.triggerId,...o,...n,ref:t,onCloseAutoFocus:Z(e.onCloseAutoFocus,i=>{a.current||s.triggerRef.current?.focus(),a.current=!1,i.preventDefault()}),onInteractOutside:Z(e.onInteractOutside,i=>{const c=i.detail.originalEvent,l=c.button===0&&c.ctrlKey===!0,h=c.button===2||l;(!s.modal||h)&&(a.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)"}})});ed.displayName=Ju;var Fx="DropdownMenuGroup",Lx=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Be(r);return d.jsx(Sx,{...s,...n,ref:t})});Lx.displayName=Fx;var Vx="DropdownMenuLabel",$x=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Be(r);return d.jsx(Cx,{...s,...n,ref:t})});$x.displayName=Vx;var Bx="DropdownMenuItem",td=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Be(r);return d.jsx(Ex,{...s,...n,ref:t})});td.displayName=Bx;var Ux="DropdownMenuCheckboxItem",zx=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Be(r);return d.jsx(Rx,{...s,...n,ref:t})});zx.displayName=Ux;var Hx="DropdownMenuRadioGroup",Wx=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Be(r);return d.jsx(Tx,{...s,...n,ref:t})});Wx.displayName=Hx;var Zx="DropdownMenuRadioItem",qx=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Be(r);return d.jsx(Px,{...s,...n,ref:t})});qx.displayName=Zx;var Gx="DropdownMenuItemIndicator",Kx=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Be(r);return d.jsx(Ax,{...s,...n,ref:t})});Kx.displayName=Gx;var Qx="DropdownMenuSeparator",Yx=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Be(r);return d.jsx(kx,{...s,...n,ref:t})});Yx.displayName=Qx;var Xx="DropdownMenuArrow",Jx=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Be(r);return d.jsx(Ox,{...s,...n,ref:t})});Jx.displayName=Xx;var eb="DropdownMenuSubTrigger",tb=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Be(r);return d.jsx(Nx,{...s,...n,ref:t})});tb.displayName=eb;var rb="DropdownMenuSubContent",nb=f.forwardRef((e,t)=>{const{__scopeDropdownMenu:r,...n}=e,s=Be(r);return d.jsx(Mx,{...s,...n,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)"}})});nb.displayName=rb;var sb=Ku,ob=Yu,ab=Xu,ib=ed,cb=td;function lb({...e}){return d.jsx(sb,{"data-slot":"dropdown-menu",...e})}function ub({...e}){return d.jsx(ob,{"data-slot":"dropdown-menu-trigger",...e})}function db({className:e,sideOffset:t=4,...r}){return d.jsx(ab,{children:d.jsx(ib,{"data-slot":"dropdown-menu-content",sideOffset:t,className:he("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 Ti({className:e,inset:t,variant:r="default",...n}){return d.jsx(cb,{"data-slot":"dropdown-menu-item","data-inset":t,"data-variant":r,className:he("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),...n})}function fb(e,t){return f.useReducer((r,n)=>t[r][n]??r,e)}var va="ScrollArea",[rd,ww]=kt(va),[hb,nt]=rd(va),nd=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,type:n="hover",dir:s,scrollHideDelay:o=600,...a}=e,[i,c]=f.useState(null),[l,h]=f.useState(null),[u,p]=f.useState(null),[g,x]=f.useState(null),[m,y]=f.useState(null),[w,b]=f.useState(0),[C,S]=f.useState(0),[_,A]=f.useState(!1),[P,O]=f.useState(!1),I=ue(t,G=>c(G)),F=Rn(s);return d.jsx(hb,{scope:r,type:n,dir:F,scrollHideDelay:o,scrollArea:i,viewport:l,onViewportChange:h,content:u,onContentChange:p,scrollbarX:g,onScrollbarXChange:x,scrollbarXEnabled:_,onScrollbarXEnabledChange:A,scrollbarY:m,onScrollbarYChange:y,scrollbarYEnabled:P,onScrollbarYEnabledChange:O,onCornerWidthChange:b,onCornerHeightChange:S,children:d.jsx(ne.div,{dir:F,...a,ref:I,style:{position:"relative","--radix-scroll-area-corner-width":w+"px","--radix-scroll-area-corner-height":C+"px",...e.style}})})});nd.displayName=va;var sd="ScrollAreaViewport",od=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,children:n,nonce:s,...o}=e,a=nt(sd,r),i=f.useRef(null),c=ue(t,i,a.onViewportChange);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),d.jsx(ne.div,{"data-radix-scroll-area-viewport":"",...o,ref:c,style:{overflowX:a.scrollbarXEnabled?"scroll":"hidden",overflowY:a.scrollbarYEnabled?"scroll":"hidden",...e.style},children:d.jsx("div",{ref:a.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});od.displayName=sd;var Nt="ScrollAreaScrollbar",ad=f.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=nt(Nt,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:a}=s,i=e.orientation==="horizontal";return f.useEffect(()=>(i?o(!0):a(!0),()=>{i?o(!1):a(!1)}),[i,o,a]),s.type==="hover"?d.jsx(pb,{...n,ref:t,forceMount:r}):s.type==="scroll"?d.jsx(mb,{...n,ref:t,forceMount:r}):s.type==="auto"?d.jsx(id,{...n,ref:t,forceMount:r}):s.type==="always"?d.jsx(ya,{...n,ref:t}):null});ad.displayName=Nt;var pb=f.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=nt(Nt,e.__scopeScrollArea),[o,a]=f.useState(!1);return f.useEffect(()=>{const i=s.scrollArea;let c=0;if(i){const l=()=>{window.clearTimeout(c),a(!0)},h=()=>{c=window.setTimeout(()=>a(!1),s.scrollHideDelay)};return i.addEventListener("pointerenter",l),i.addEventListener("pointerleave",h),()=>{window.clearTimeout(c),i.removeEventListener("pointerenter",l),i.removeEventListener("pointerleave",h)}}},[s.scrollArea,s.scrollHideDelay]),d.jsx(We,{present:r||o,children:d.jsx(id,{"data-state":o?"visible":"hidden",...n,ref:t})})}),mb=f.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=nt(Nt,e.__scopeScrollArea),o=e.orientation==="horizontal",a=Vs(()=>c("SCROLL_END"),100),[i,c]=fb("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return f.useEffect(()=>{if(i==="idle"){const l=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(l)}},[i,s.scrollHideDelay,c]),f.useEffect(()=>{const l=s.viewport,h=o?"scrollLeft":"scrollTop";if(l){let u=l[h];const p=()=>{const g=l[h];u!==g&&(c("SCROLL"),a()),u=g};return l.addEventListener("scroll",p),()=>l.removeEventListener("scroll",p)}},[s.viewport,o,c,a]),d.jsx(We,{present:r||i!=="hidden",children:d.jsx(ya,{"data-state":i==="hidden"?"hidden":"visible",...n,ref:t,onPointerEnter:Z(e.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Z(e.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),id=f.forwardRef((e,t)=>{const r=nt(Nt,e.__scopeScrollArea),{forceMount:n,...s}=e,[o,a]=f.useState(!1),i=e.orientation==="horizontal",c=Vs(()=>{if(r.viewport){const l=r.viewport.offsetWidth<r.viewport.scrollWidth,h=r.viewport.offsetHeight<r.viewport.scrollHeight;a(i?l:h)}},10);return Vr(r.viewport,c),Vr(r.content,c),d.jsx(We,{present:n||o,children:d.jsx(ya,{"data-state":o?"visible":"hidden",...s,ref:t})})}),ya=f.forwardRef((e,t)=>{const{orientation:r="vertical",...n}=e,s=nt(Nt,e.__scopeScrollArea),o=f.useRef(null),a=f.useRef(0),[i,c]=f.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=fd(i.viewport,i.content),h={...n,sizes:i,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:p=>o.current=p,onThumbPointerUp:()=>a.current=0,onThumbPointerDown:p=>a.current=p};function u(p,g){return wb(p,a.current,i,g)}return r==="horizontal"?d.jsx(gb,{...h,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const p=s.viewport.scrollLeft,g=Pi(p,i,s.dir);o.current.style.transform=`translate3d(${g}px, 0, 0)`}},onWheelScroll:p=>{s.viewport&&(s.viewport.scrollLeft=p)},onDragScroll:p=>{s.viewport&&(s.viewport.scrollLeft=u(p,s.dir))}}):r==="vertical"?d.jsx(vb,{...h,ref:t,onThumbPositionChange:()=>{if(s.viewport&&o.current){const p=s.viewport.scrollTop,g=Pi(p,i);o.current.style.transform=`translate3d(0, ${g}px, 0)`}},onWheelScroll:p=>{s.viewport&&(s.viewport.scrollTop=p)},onDragScroll:p=>{s.viewport&&(s.viewport.scrollTop=u(p))}}):null}),gb=f.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=nt(Nt,e.__scopeScrollArea),[a,i]=f.useState(),c=f.useRef(null),l=ue(t,c,o.onScrollbarXChange);return f.useEffect(()=>{c.current&&i(getComputedStyle(c.current))},[c]),d.jsx(ld,{"data-orientation":"horizontal",...s,ref:l,sizes:r,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Ls(r)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.x),onDragScroll:h=>e.onDragScroll(h.x),onWheelScroll:(h,u)=>{if(o.viewport){const p=o.viewport.scrollLeft+h.deltaX;e.onWheelScroll(p),pd(p,u)&&h.preventDefault()}},onResize:()=>{c.current&&o.viewport&&a&&n({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:ys(a.paddingLeft),paddingEnd:ys(a.paddingRight)}})}})}),vb=f.forwardRef((e,t)=>{const{sizes:r,onSizesChange:n,...s}=e,o=nt(Nt,e.__scopeScrollArea),[a,i]=f.useState(),c=f.useRef(null),l=ue(t,c,o.onScrollbarYChange);return f.useEffect(()=>{c.current&&i(getComputedStyle(c.current))},[c]),d.jsx(ld,{"data-orientation":"vertical",...s,ref:l,sizes:r,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Ls(r)+"px",...e.style},onThumbPointerDown:h=>e.onThumbPointerDown(h.y),onDragScroll:h=>e.onDragScroll(h.y),onWheelScroll:(h,u)=>{if(o.viewport){const p=o.viewport.scrollTop+h.deltaY;e.onWheelScroll(p),pd(p,u)&&h.preventDefault()}},onResize:()=>{c.current&&o.viewport&&a&&n({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:ys(a.paddingTop),paddingEnd:ys(a.paddingBottom)}})}})}),[yb,cd]=rd(Nt),ld=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,sizes:n,hasThumb:s,onThumbChange:o,onThumbPointerUp:a,onThumbPointerDown:i,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:h,onResize:u,...p}=e,g=nt(Nt,r),[x,m]=f.useState(null),y=ue(t,I=>m(I)),w=f.useRef(null),b=f.useRef(""),C=g.viewport,S=n.content-n.viewport,_=Oe(h),A=Oe(c),P=Vs(u,10);function O(I){if(w.current){const F=I.clientX-w.current.left,G=I.clientY-w.current.top;l({x:F,y:G})}}return f.useEffect(()=>{const I=F=>{const G=F.target;x?.contains(G)&&_(F,S)};return document.addEventListener("wheel",I,{passive:!1}),()=>document.removeEventListener("wheel",I,{passive:!1})},[C,x,S,_]),f.useEffect(A,[n,A]),Vr(x,P),Vr(g.content,P),d.jsx(yb,{scope:r,scrollbar:x,hasThumb:s,onThumbChange:Oe(o),onThumbPointerUp:Oe(a),onThumbPositionChange:A,onThumbPointerDown:Oe(i),children:d.jsx(ne.div,{...p,ref:y,style:{position:"absolute",...p.style},onPointerDown:Z(e.onPointerDown,I=>{I.button===0&&(I.target.setPointerCapture(I.pointerId),w.current=x.getBoundingClientRect(),b.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",g.viewport&&(g.viewport.style.scrollBehavior="auto"),O(I))}),onPointerMove:Z(e.onPointerMove,O),onPointerUp:Z(e.onPointerUp,I=>{const F=I.target;F.hasPointerCapture(I.pointerId)&&F.releasePointerCapture(I.pointerId),document.body.style.webkitUserSelect=b.current,g.viewport&&(g.viewport.style.scrollBehavior=""),w.current=null})})})}),vs="ScrollAreaThumb",ud=f.forwardRef((e,t)=>{const{forceMount:r,...n}=e,s=cd(vs,e.__scopeScrollArea);return d.jsx(We,{present:r||s.hasThumb,children:d.jsx(xb,{ref:t,...n})})}),xb=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,style:n,...s}=e,o=nt(vs,r),a=cd(vs,r),{onThumbPositionChange:i}=a,c=ue(t,u=>a.onThumbChange(u)),l=f.useRef(void 0),h=Vs(()=>{l.current&&(l.current(),l.current=void 0)},100);return f.useEffect(()=>{const u=o.viewport;if(u){const p=()=>{if(h(),!l.current){const g=_b(u,i);l.current=g,i()}};return i(),u.addEventListener("scroll",p),()=>u.removeEventListener("scroll",p)}},[o.viewport,h,i]),d.jsx(ne.div,{"data-state":a.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:Z(e.onPointerDownCapture,u=>{const g=u.target.getBoundingClientRect(),x=u.clientX-g.left,m=u.clientY-g.top;a.onThumbPointerDown({x,y:m})}),onPointerUp:Z(e.onPointerUp,a.onThumbPointerUp)})});ud.displayName=vs;var xa="ScrollAreaCorner",dd=f.forwardRef((e,t)=>{const r=nt(xa,e.__scopeScrollArea),n=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&n?d.jsx(bb,{...e,ref:t}):null});dd.displayName=xa;var bb=f.forwardRef((e,t)=>{const{__scopeScrollArea:r,...n}=e,s=nt(xa,r),[o,a]=f.useState(0),[i,c]=f.useState(0),l=!!(o&&i);return Vr(s.scrollbarX,()=>{const h=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(h),c(h)}),Vr(s.scrollbarY,()=>{const h=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(h),a(h)}),l?d.jsx(ne.div,{...n,ref:t,style:{width:o,height:i,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function ys(e){return e?parseInt(e,10):0}function fd(e,t){const r=e/t;return isNaN(r)?0:r}function Ls(e){const t=fd(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,n=(e.scrollbar.size-r)*t;return Math.max(n,18)}function wb(e,t,r,n="ltr"){const s=Ls(r),o=s/2,a=t||o,i=s-a,c=r.scrollbar.paddingStart+a,l=r.scrollbar.size-r.scrollbar.paddingEnd-i,h=r.content-r.viewport,u=n==="ltr"?[0,h]:[h*-1,0];return hd([c,l],u)(e)}function Pi(e,t,r="ltr"){const n=Ls(t),s=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-s,a=t.content-t.viewport,i=o-n,c=r==="ltr"?[0,a]:[a*-1,0],l=yo(e,c);return hd([0,a],[0,i])(l)}function hd(e,t){return r=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(e[1]-e[0]);return t[0]+n*(r-e[0])}}function pd(e,t){return e>0&&e<t}var _b=(e,t=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},n=0;return(function s(){const o={left:e.scrollLeft,top:e.scrollTop},a=r.left!==o.left,i=r.top!==o.top;(a||i)&&t(),r=o,n=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(n)};function Vs(e,t){const r=Oe(e),n=f.useRef(0);return f.useEffect(()=>()=>window.clearTimeout(n.current),[]),f.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(r,t)},[r,t])}function Vr(e,t){const r=Oe(t);Ne(()=>{let n=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(n),s.unobserve(e)}}},[e,r])}var Sb=nd,Cb=od,Eb=dd;function Rb({className:e,children:t,...r}){return d.jsxs(Sb,{"data-slot":"scroll-area",className:he("relative",e),...r,children:[d.jsx(Cb,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:t}),d.jsx(Tb,{}),d.jsx(Eb,{})]})}function Tb({className:e,orientation:t="vertical",...r}){return d.jsx(ad,{"data-slot":"scroll-area-scrollbar",orientation:t,className:he("flex touch-none p-px transition-colors select-none",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:d.jsx(ud,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function Pb({className:e,...t}){return d.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-x-auto",children:d.jsx("table",{"data-slot":"table",className:he("w-full caption-bottom text-sm",e),...t})})}function Ab({className:e,...t}){return d.jsx("thead",{"data-slot":"table-header",className:he("[&_tr]:border-b",e),...t})}function kb({className:e,...t}){return d.jsx("tbody",{"data-slot":"table-body",className:he("[&_tr:last-child]:border-0",e),...t})}function zn({className:e,...t}){return d.jsx("tr",{"data-slot":"table-row",className:he("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...t})}function Hn({className:e,...t}){return d.jsx("th",{"data-slot":"table-head",className:he("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 Pr({className:e,...t}){return d.jsx("td",{"data-slot":"table-cell",className:he("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function Ob(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 Nb=e=>{switch(e){case"success":return Ib;case"info":return Fb;case"warning":return Db;case"error":return Lb;default:return null}},Mb=Array(12).fill(0),jb=({visible:e,className:t})=>R.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},R.createElement("div",{className:"sonner-spinner"},Mb.map((r,n)=>R.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),Ib=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.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"})),Db=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},R.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"})),Fb=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.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"})),Lb=R.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},R.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"})),Vb=R.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"},R.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),R.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),$b=()=>{const[e,t]=R.useState(document.hidden);return R.useEffect(()=>{const r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e};let Ao=1;class Bb{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:n,...s}=t,o=typeof t?.id=="number"||((r=t.id)==null?void 0:r.length)>0?t.id:Ao++,a=this.toasts.find(c=>c.id===o),i=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(o)&&this.dismissedToasts.delete(o),a?this.toasts=this.toasts.map(c=>c.id===o?(this.publish({...c,...t,id:o,title:n}),{...c,...t,id:o,dismissible:i,title:n}):c):this.addToast({title:n,...s,dismissible:i,id:o}),o},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(n=>n({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 n;r.loading!==void 0&&(n=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 o=n!==void 0,a;const i=s.then(async l=>{if(a=["resolve",l],R.isValidElement(l))o=!1,this.create({id:n,type:"default",message:l});else if(zb(l)&&!l.ok){o=!1;const u=typeof r.error=="function"?await r.error(`HTTP error! status: ${l.status}`):r.error,p=typeof r.description=="function"?await r.description(`HTTP error! status: ${l.status}`):r.description,x=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:n,type:"error",description:p,...x})}else if(l instanceof Error){o=!1;const u=typeof r.error=="function"?await r.error(l):r.error,p=typeof r.description=="function"?await r.description(l):r.description,x=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:n,type:"error",description:p,...x})}else if(r.success!==void 0){o=!1;const u=typeof r.success=="function"?await r.success(l):r.success,p=typeof r.description=="function"?await r.description(l):r.description,x=typeof u=="object"&&!R.isValidElement(u)?u:{message:u};this.create({id:n,type:"success",description:p,...x})}}).catch(async l=>{if(a=["reject",l],r.error!==void 0){o=!1;const h=typeof r.error=="function"?await r.error(l):r.error,u=typeof r.description=="function"?await r.description(l):r.description,g=typeof h=="object"&&!R.isValidElement(h)?h:{message:h};this.create({id:n,type:"error",description:u,...g})}}).finally(()=>{o&&(this.dismiss(n),n=void 0),r.finally==null||r.finally.call(r)}),c=()=>new Promise((l,h)=>i.then(()=>a[0]==="reject"?h(a[1]):l(a[1])).catch(h));return typeof n!="string"&&typeof n!="number"?{unwrap:c}:Object.assign(n,{unwrap:c})},this.custom=(t,r)=>{const n=r?.id||Ao++;return this.create({jsx:t(n),id:n,...r}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const He=new Bb,Ub=(e,t)=>{const r=t?.id||Ao++;return He.addToast({title:e,...t,id:r}),r},zb=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",Hb=Ub,Wb=()=>He.toasts,Zb=()=>He.getActiveToasts(),qb=Object.assign(Hb,{success:He.success,info:He.info,warning:He.warning,error:He.error,custom:He.custom,message:He.message,promise:He.promise,dismiss:He.dismiss,loading:He.loading},{getHistory:Wb,getToasts:Zb});Ob("[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 Wn(e){return e.label!==void 0}const Gb=3,Kb="24px",Qb="16px",Ai=4e3,Yb=356,Xb=14,Jb=45,ew=200;function xt(...e){return e.filter(Boolean).join(" ")}function tw(e){const[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}const rw=e=>{var t,r,n,s,o,a,i,c,l;const{invert:h,toast:u,unstyled:p,interacting:g,setHeights:x,visibleToasts:m,heights:y,index:w,toasts:b,expanded:C,removeToast:S,defaultRichColors:_,closeButton:A,style:P,cancelButtonStyle:O,actionButtonStyle:I,className:F="",descriptionClassName:G="",duration:L,position:N,gap:$,expandByDefault:X,classNames:M,icons:K,closeButtonAriaLabel:q="Close toast"}=e,[D,ie]=R.useState(null),[be,Pe]=R.useState(null),[re,ce]=R.useState(!1),[le,xe]=R.useState(!1),[H,J]=R.useState(!1),[we,de]=R.useState(!1),[pe,ge]=R.useState(!1),[Me,Ue]=R.useState(0),[Ht,Wt]=R.useState(0),st=R.useRef(u.duration||L||Ai),$s=R.useRef(null),Xe=R.useRef(null),v=w===0,E=w+1<=m,T=u.type,B=u.dismissible!==!1,V=u.className||"",j=u.descriptionClassName||"",Y=R.useMemo(()=>y.findIndex(oe=>oe.toastId===u.id)||0,[y,u.id]),me=R.useMemo(()=>{var oe;return(oe=u.closeButton)!=null?oe:A},[u.closeButton,A]),ve=R.useMemo(()=>u.duration||L||Ai,[u.duration,L]),je=R.useRef(0),ot=R.useRef(0),at=R.useRef(0),Zt=R.useRef(null),[Wr,Zr]=N.split("-"),Nn=R.useMemo(()=>y.reduce((oe,Ae,Ie)=>Ie>=Y?oe:oe+Ae.height,0),[y,Y]),qr=$b(),Bs=u.invert||h,Sr=T==="loading";ot.current=R.useMemo(()=>Y*$+Nn,[Y,Nn]),R.useEffect(()=>{st.current=ve},[ve]),R.useEffect(()=>{ce(!0)},[]),R.useEffect(()=>{const oe=Xe.current;if(oe){const Ae=oe.getBoundingClientRect().height;return Wt(Ae),x(Ie=>[{toastId:u.id,height:Ae,position:u.position},...Ie]),()=>x(Ie=>Ie.filter(Ze=>Ze.toastId!==u.id))}},[x,u.id]),R.useLayoutEffect(()=>{if(!re)return;const oe=Xe.current,Ae=oe.style.height;oe.style.height="auto";const Ie=oe.getBoundingClientRect().height;oe.style.height=Ae,Wt(Ie),x(Ze=>Ze.find(ke=>ke.toastId===u.id)?Ze.map(ke=>ke.toastId===u.id?{...ke,height:Ie}:ke):[{toastId:u.id,height:Ie,position:u.position},...Ze])},[re,u.title,u.description,x,u.id,u.jsx,u.action,u.cancel]);const qt=R.useCallback(()=>{xe(!0),Ue(ot.current),x(oe=>oe.filter(Ae=>Ae.toastId!==u.id)),setTimeout(()=>{S(u)},ew)},[u,S,x,ot]);R.useEffect(()=>{if(u.promise&&T==="loading"||u.duration===1/0||u.type==="loading")return;let oe;return C||g||qr?(()=>{if(at.current<je.current){const Ze=new Date().getTime()-je.current;st.current=st.current-Ze}at.current=new Date().getTime()})():(()=>{st.current!==1/0&&(je.current=new Date().getTime(),oe=setTimeout(()=>{u.onAutoClose==null||u.onAutoClose.call(u,u),qt()},st.current))})(),()=>clearTimeout(oe)},[C,g,u,T,qr,qt]),R.useEffect(()=>{u.delete&&(qt(),u.onDismiss==null||u.onDismiss.call(u,u))},[qt,u.delete]);function md(){var oe;if(K?.loading){var Ae;return R.createElement("div",{className:xt(M?.loader,u==null||(Ae=u.classNames)==null?void 0:Ae.loader,"sonner-loader"),"data-visible":T==="loading"},K.loading)}return R.createElement(jb,{className:xt(M?.loader,u==null||(oe=u.classNames)==null?void 0:oe.loader),visible:T==="loading"})}const gd=u.icon||K?.[T]||Nb(T);var ba,wa;return R.createElement("li",{tabIndex:0,ref:Xe,className:xt(F,V,M?.toast,u==null||(t=u.classNames)==null?void 0:t.toast,M?.default,M?.[T],u==null||(r=u.classNames)==null?void 0:r[T]),"data-sonner-toast":"","data-rich-colors":(ba=u.richColors)!=null?ba:_,"data-styled":!(u.jsx||u.unstyled||p),"data-mounted":re,"data-promise":!!u.promise,"data-swiped":pe,"data-removed":le,"data-visible":E,"data-y-position":Wr,"data-x-position":Zr,"data-index":w,"data-front":v,"data-swiping":H,"data-dismissible":B,"data-type":T,"data-invert":Bs,"data-swipe-out":we,"data-swipe-direction":be,"data-expanded":!!(C||X&&re),"data-testid":u.testId,style:{"--index":w,"--toasts-before":w,"--z-index":b.length-w,"--offset":`${le?Me:ot.current}px`,"--initial-height":X?"auto":`${Ht}px`,...P,...u.style},onDragEnd:()=>{J(!1),ie(null),Zt.current=null},onPointerDown:oe=>{oe.button!==2&&(Sr||!B||($s.current=new Date,Ue(ot.current),oe.target.setPointerCapture(oe.pointerId),oe.target.tagName!=="BUTTON"&&(J(!0),Zt.current={x:oe.clientX,y:oe.clientY})))},onPointerUp:()=>{var oe,Ae,Ie;if(we||!B)return;Zt.current=null;const Ze=Number(((oe=Xe.current)==null?void 0:oe.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Mn=Number(((Ae=Xe.current)==null?void 0:Ae.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),ke=new Date().getTime()-((Ie=$s.current)==null?void 0:Ie.getTime()),Je=D==="x"?Ze:Mn,jn=Math.abs(Je)/ke;if(Math.abs(Je)>=Jb||jn>.11){Ue(ot.current),u.onDismiss==null||u.onDismiss.call(u,u),Pe(D==="x"?Ze>0?"right":"left":Mn>0?"down":"up"),qt(),de(!0);return}else{var it,ct;(it=Xe.current)==null||it.style.setProperty("--swipe-amount-x","0px"),(ct=Xe.current)==null||ct.style.setProperty("--swipe-amount-y","0px")}ge(!1),J(!1),ie(null)},onPointerMove:oe=>{var Ae,Ie,Ze;if(!Zt.current||!B||((Ae=window.getSelection())==null?void 0:Ae.toString().length)>0)return;const ke=oe.clientY-Zt.current.y,Je=oe.clientX-Zt.current.x;var jn;const it=(jn=e.swipeDirections)!=null?jn:tw(N);!D&&(Math.abs(Je)>1||Math.abs(ke)>1)&&ie(Math.abs(Je)>Math.abs(ke)?"x":"y");let ct={x:0,y:0};const _a=ir=>1/(1.5+Math.abs(ir)/20);if(D==="y"){if(it.includes("top")||it.includes("bottom"))if(it.includes("top")&&ke<0||it.includes("bottom")&&ke>0)ct.y=ke;else{const ir=ke*_a(ke);ct.y=Math.abs(ir)<Math.abs(ke)?ir:ke}}else if(D==="x"&&(it.includes("left")||it.includes("right")))if(it.includes("left")&&Je<0||it.includes("right")&&Je>0)ct.x=Je;else{const ir=Je*_a(Je);ct.x=Math.abs(ir)<Math.abs(Je)?ir:Je}(Math.abs(ct.x)>0||Math.abs(ct.y)>0)&&ge(!0),(Ie=Xe.current)==null||Ie.style.setProperty("--swipe-amount-x",`${ct.x}px`),(Ze=Xe.current)==null||Ze.style.setProperty("--swipe-amount-y",`${ct.y}px`)}},me&&!u.jsx&&T!=="loading"?R.createElement("button",{"aria-label":q,"data-disabled":Sr,"data-close-button":!0,onClick:Sr||!B?()=>{}:()=>{qt(),u.onDismiss==null||u.onDismiss.call(u,u)},className:xt(M?.closeButton,u==null||(n=u.classNames)==null?void 0:n.closeButton)},(wa=K?.close)!=null?wa:Vb):null,(T||u.icon||u.promise)&&u.icon!==null&&(K?.[T]!==null||u.icon)?R.createElement("div",{"data-icon":"",className:xt(M?.icon,u==null||(s=u.classNames)==null?void 0:s.icon)},u.promise||u.type==="loading"&&!u.icon?u.icon||md():null,u.type!=="loading"?gd:null):null,R.createElement("div",{"data-content":"",className:xt(M?.content,u==null||(o=u.classNames)==null?void 0:o.content)},R.createElement("div",{"data-title":"",className:xt(M?.title,u==null||(a=u.classNames)==null?void 0:a.title)},u.jsx?u.jsx:typeof u.title=="function"?u.title():u.title),u.description?R.createElement("div",{"data-description":"",className:xt(G,j,M?.description,u==null||(i=u.classNames)==null?void 0:i.description)},typeof u.description=="function"?u.description():u.description):null),R.isValidElement(u.cancel)?u.cancel:u.cancel&&Wn(u.cancel)?R.createElement("button",{"data-button":!0,"data-cancel":!0,style:u.cancelButtonStyle||O,onClick:oe=>{Wn(u.cancel)&&B&&(u.cancel.onClick==null||u.cancel.onClick.call(u.cancel,oe),qt())},className:xt(M?.cancelButton,u==null||(c=u.classNames)==null?void 0:c.cancelButton)},u.cancel.label):null,R.isValidElement(u.action)?u.action:u.action&&Wn(u.action)?R.createElement("button",{"data-button":!0,"data-action":!0,style:u.actionButtonStyle||I,onClick:oe=>{Wn(u.action)&&(u.action.onClick==null||u.action.onClick.call(u.action,oe),!oe.defaultPrevented&&qt())},className:xt(M?.actionButton,u==null||(l=u.classNames)==null?void 0:l.actionButton)},u.action.label):null)};function ki(){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 nw(e,t){const r={};return[e,t].forEach((n,s)=>{const o=s===1,a=o?"--mobile-offset":"--offset",i=o?Qb:Kb;function c(l){["top","right","bottom","left"].forEach(h=>{r[`${a}-${h}`]=typeof l=="number"?`${l}px`:l})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(l=>{n[l]===void 0?r[`${a}-${l}`]=i:r[`${a}-${l}`]=typeof n[l]=="number"?`${n[l]}px`:n[l]}):c(i)}),r}const _w=R.forwardRef(function(t,r){const{id:n,invert:s,position:o="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:c,className:l,offset:h,mobileOffset:u,theme:p="light",richColors:g,duration:x,style:m,visibleToasts:y=Gb,toastOptions:w,dir:b=ki(),gap:C=Xb,icons:S,containerAriaLabel:_="Notifications"}=t,[A,P]=R.useState([]),O=R.useMemo(()=>n?A.filter(re=>re.toasterId===n):A.filter(re=>!re.toasterId),[A,n]),I=R.useMemo(()=>Array.from(new Set([o].concat(O.filter(re=>re.position).map(re=>re.position)))),[O,o]),[F,G]=R.useState([]),[L,N]=R.useState(!1),[$,X]=R.useState(!1),[M,K]=R.useState(p!=="system"?p:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),q=R.useRef(null),D=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),ie=R.useRef(null),be=R.useRef(!1),Pe=R.useCallback(re=>{P(ce=>{var le;return(le=ce.find(xe=>xe.id===re.id))!=null&&le.delete||He.dismiss(re.id),ce.filter(({id:xe})=>xe!==re.id)})},[]);return R.useEffect(()=>He.subscribe(re=>{if(re.dismiss){requestAnimationFrame(()=>{P(ce=>ce.map(le=>le.id===re.id?{...le,delete:!0}:le))});return}setTimeout(()=>{Ji.flushSync(()=>{P(ce=>{const le=ce.findIndex(xe=>xe.id===re.id);return le!==-1?[...ce.slice(0,le),{...ce[le],...re},...ce.slice(le+1)]:[re,...ce]})})})}),[A]),R.useEffect(()=>{if(p!=="system"){K(p);return}if(p==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?K("dark"):K("light")),typeof window>"u")return;const re=window.matchMedia("(prefers-color-scheme: dark)");try{re.addEventListener("change",({matches:ce})=>{K(ce?"dark":"light")})}catch{re.addListener(({matches:le})=>{try{K(le?"dark":"light")}catch(xe){console.error(xe)}})}},[p]),R.useEffect(()=>{A.length<=1&&N(!1)},[A]),R.useEffect(()=>{const re=ce=>{var le;if(a.every(J=>ce[J]||ce.code===J)){var H;N(!0),(H=q.current)==null||H.focus()}ce.code==="Escape"&&(document.activeElement===q.current||(le=q.current)!=null&&le.contains(document.activeElement))&&N(!1)};return document.addEventListener("keydown",re),()=>document.removeEventListener("keydown",re)},[a]),R.useEffect(()=>{if(q.current)return()=>{ie.current&&(ie.current.focus({preventScroll:!0}),ie.current=null,be.current=!1)}},[q.current]),R.createElement("section",{ref:r,"aria-label":`${_} ${D}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},I.map((re,ce)=>{var le;const[xe,H]=re.split("-");return O.length?R.createElement("ol",{key:re,dir:b==="auto"?ki():b,tabIndex:-1,ref:q,className:l,"data-sonner-toaster":!0,"data-sonner-theme":M,"data-y-position":xe,"data-x-position":H,style:{"--front-toast-height":`${((le=F[0])==null?void 0:le.height)||0}px`,"--width":`${Yb}px`,"--gap":`${C}px`,...m,...nw(h,u)},onBlur:J=>{be.current&&!J.currentTarget.contains(J.relatedTarget)&&(be.current=!1,ie.current&&(ie.current.focus({preventScroll:!0}),ie.current=null))},onFocus:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||be.current||(be.current=!0,ie.current=J.relatedTarget)},onMouseEnter:()=>N(!0),onMouseMove:()=>N(!0),onMouseLeave:()=>{$||N(!1)},onDragEnd:()=>N(!1),onPointerDown:J=>{J.target instanceof HTMLElement&&J.target.dataset.dismissible==="false"||X(!0)},onPointerUp:()=>X(!1)},O.filter(J=>!J.position&&ce===0||J.position===re).map((J,we)=>{var de,pe;return R.createElement(rw,{key:J.id,icons:S,index:we,toast:J,defaultRichColors:g,duration:(de=w?.duration)!=null?de:x,className:w?.className,descriptionClassName:w?.descriptionClassName,invert:s,visibleToasts:y,closeButton:(pe=w?.closeButton)!=null?pe:c,interacting:$,position:re,style:w?.style,unstyled:w?.unstyled,classNames:w?.classNames,cancelButtonStyle:w?.cancelButtonStyle,actionButtonStyle:w?.actionButtonStyle,closeButtonAriaLabel:w?.closeButtonAriaLabel,removeToast:Pe,toasts:O.filter(ge=>ge.position==J.position),heights:F.filter(ge=>ge.position==J.position),setHeights:G,expandByDefault:i,gap:C,expanded:L,swipeDirections:t.swipeDirections})})):null}))});function sw(e,t,r,n){var s=this,o=f.useRef(null),a=f.useRef(0),i=f.useRef(0),c=f.useRef(null),l=f.useRef([]),h=f.useRef(),u=f.useRef(),p=f.useRef(e),g=f.useRef(!0);p.current=e;var x=typeof window<"u",m=!t&&t!==0&&x;if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var y=!!(r=r||{}).leading,w=!("trailing"in r)||!!r.trailing,b="maxWait"in r,C="debounceOnServer"in r&&!!r.debounceOnServer,S=b?Math.max(+r.maxWait||0,t):null;f.useEffect(function(){return g.current=!0,function(){g.current=!1}},[]);var _=f.useMemo(function(){var A=function(N){var $=l.current,X=h.current;return l.current=h.current=null,a.current=N,i.current=i.current||N,u.current=p.current.apply(X,$)},P=function(N,$){m&&cancelAnimationFrame(c.current),c.current=m?requestAnimationFrame(N):setTimeout(N,$)},O=function(N){if(!g.current)return!1;var $=N-o.current;return!o.current||$>=t||$<0||b&&N-a.current>=S},I=function(N){return c.current=null,w&&l.current?A(N):(l.current=h.current=null,u.current)},F=function N(){var $=Date.now();if(y&&i.current===a.current&&G(),O($))return I($);if(g.current){var X=t-($-o.current),M=b?Math.min(X,S-($-a.current)):X;P(N,M)}},G=function(){n&&n({})},L=function(){if(x||C){var N=Date.now(),$=O(N);if(l.current=[].slice.call(arguments),h.current=s,o.current=N,$){if(!c.current&&g.current)return a.current=o.current,P(F,t),y?A(o.current):u.current;if(b)return P(F,t),A(o.current)}return c.current||P(F,t),u.current}};return L.cancel=function(){c.current&&(m?cancelAnimationFrame(c.current):clearTimeout(c.current)),a.current=0,l.current=o.current=h.current=c.current=null},L.isPending=function(){return!!c.current},L.flush=function(){return c.current?I(Date.now()):u.current},L},[y,b,t,S,w,m,x,C,n]);return _}function ow(e,t){return e===t}function aw(e,t,r){var n=ow,s=f.useRef(e),o=f.useState({})[1],a=sw(f.useCallback(function(c){s.current=c,o({})},[o]),t,r,o),i=f.useRef(e);return n(i.current,e)||(a(e),i.current=e),[s.current,a]}function Sw(){const[e,t]=f.useState(""),[r,n]=f.useState({}),[s,o]=f.useState(1),[a]=aw(e,400),i=f.useMemo(()=>["products",{currentPage:s,search:a,filter:r}],[s,a,r]),{data:c,isFetching:l}=co({queryKey:i,queryFn:async()=>await qe.apiRequest("index",bd({skip:(s-1)*qe.item_per_page,where:{productModelCode:e,status_listing:r?.statusFilter==="all"?void 0:r.statusFilter}}))}),{data:h}=co({queryKey:["publised-products"],queryFn:async()=>await qe.apiRequest("getPublistedProducts",{})??[],staleTime:0,refetchOnMount:"always"}),u=Gi({mutationKey:["action-mutaions"],mutationFn:async S=>{if(S.status)return qe.apiRequest("unlist",S);const _=await qe.apiRequest("get",S);if(!(!_||!_?.data))return qe.apiRequest("publist",{...S,images:ro({..._?.data}).images})}}),p=f.useMemo(()=>!c||!c?.data?[]:c?.data.map(S=>ro(S)),[c]),g=S=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"}).format(S),x=()=>{t(""),n({statusFilter:""}),o(1)},m=[r.statusFilter,e!==""].filter(Boolean).length,y=f.useMemo(()=>c?.total?Math.ceil(c.total/qe.item_per_page):0,[c?.total,qe.item_per_page]),w=f.useMemo(()=>(s-1)*qe.item_per_page+1,[s]),b=f.useMemo(()=>Math.min(s*qe.item_per_page,c?.total??0),[s,c]),C=async S=>{console.log({post:S}),u.mutate(S)};return f.useEffect(()=>{const S=setInterval(async()=>{try{if(!document.hidden){const _=await qe.apiRequest("dequeue",{});_&&qb[_.type](_.title,{description:_.message})}}catch(_){console.error("Error in interval:",_)}},1e3);return()=>clearInterval(S)},[]),d.jsxs(gm,{children:[d.jsx(xm,{}),d.jsx(ym,{side:"left",align:"end",className:"w-auto",children:d.jsxs("div",{className:"space-y-4 h-[78vh] min-w-[638px]",children:[d.jsxs("div",{className:"flex items-center justify-between gap-4",children:[d.jsxs("div",{className:"relative flex-1",children:[d.jsx(wf,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),d.jsx(cr,{placeholder:"Search...",value:e,onChange:S=>t(S.target.value),className:"pl-10"})]}),d.jsx(Vm,{filter:r,setFilter:n,activeFiltersCount:m,clearFilters:x})]}),d.jsxs("div",{className:"flex items-center justify-between w-full gap-8",children:[d.jsxs("span",{children:["Showing ",w,"-",b," of ",c?.total??0," products"]}),y>1&&d.jsxs("div",{className:"flex items-center justify-end gap-2",children:[d.jsxs(bt,{variant:"outline",size:"xs",onClick:()=>o(S=>Math.max(1,S-1)),disabled:s===1,children:[d.jsx(lf,{}),"Previous"]}),d.jsx("div",{className:"flex items-center gap-1",children:y<=7?Array.from({length:y},(S,_)=>d.jsx(bt,{variant:s===_+1?"default":"outline",size:"xs",onClick:()=>o(_+1),children:_+1},_+1)):d.jsxs(d.Fragment,{children:[d.jsx(bt,{variant:s===1?"default":"outline",size:"xs",onClick:()=>o(1),children:"1"}),s>4&&d.jsx("span",{className:"px-2 text-muted-foreground",children:"..."}),Array.from({length:3},(S,_)=>{let A;return s<=4?A=_+2:s>=y-3?A=y-4+_:A=s-1+_,A>1&&A<y?d.jsx(bt,{variant:s===A?"default":"outline",size:"xs",onClick:()=>o(A),children:A},A):null}).filter(Boolean),s<y-3&&d.jsx("span",{className:"px-2 text-muted-foreground",children:"..."}),d.jsx(bt,{variant:s===y?"default":"outline",size:"xs",onClick:()=>o(y),children:y})]})}),d.jsxs(bt,{variant:"outline",size:"xs",onClick:()=>o(S=>Math.min(y,S+1)),disabled:s===y,children:["Next",d.jsx(df,{})]})]})]}),d.jsx("div",{className:"rounded-md border overflow-x-auto relative",children:d.jsx(Rb,{className:"h-[66vh] w-full",children:d.jsxs(Pb,{className:"h-fit",children:[d.jsx(Ab,{children:d.jsxs(zn,{children:[d.jsx(Hn,{className:"min-w-[200px]",children:"Name"}),d.jsx(Hn,{className:"w-[80px]",children:"Price"}),d.jsx(Hn,{className:"w-[80px]",children:"Status"}),d.jsx(Hn,{className:"w-[80px] text-center sticky right-0 bg-background border-l shadow-[-4px_0_8px_rgba(0,0,0,0.1)]",children:"Actions"})]})}),d.jsxs(kb,{className:"relative",children:[l&&d.jsx(zn,{children:d.jsx(Pr,{colSpan:10,className:"text-center py-8 text-muted-foreground ",children:d.jsx("div",{className:"h-full flex items-center justify-center w-full",children:d.jsx(ol,{})})})}),p.length===0&&!l?d.jsx(zn,{children:d.jsx(Pr,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:d.jsx("div",{className:"h-full flex items-center justify-center w-full",children:d.jsx("span",{children:" No products found"})})})}):p.map(S=>{const _=h?.some(A=>A.title.includes(S.sku));return S.status=_,d.jsxs(zn,{children:[d.jsxs(Pr,{className:"font-medium",children:[d.jsx("div",{className:"truncate max-w-[340px] w-fit",title:S.title,children:S.title}),d.jsx("div",{className:"text-sm text-muted-foreground truncate max-w-[340px]",title:S.description,children:S.description})]}),d.jsx(Pr,{className:"font-semibold",children:g(S.price)}),d.jsx(Pr,{children:d.jsx(Cl,{variant:"secondary",children:S?.status?"Listed":"Unlisted"})}),d.jsx(Pr,{className:"text-center sticky right-0 bg-background border-l shadow-[-4px_0_8px_rgba(0,0,0,0.1)]",children:d.jsxs(lb,{children:[d.jsx(ub,{asChild:!0,children:d.jsx("div",{className:"w-full flex items-center justify-center",children:d.jsx(bt,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 mx-auto",children:d.jsx(vf,{className:"h-4 w-4"})})})}),d.jsxs(db,{align:"end",children:[d.jsx(Hy,{data:S,children:d.jsxs(Ti,{onSelect:A=>{A.preventDefault(),A.stopPropagation()},children:[d.jsx(Sf,{className:"h-4 w-4 mr-2"})," Review"]})}),d.jsxs(Ti,{onClick:()=>C(S),children:[S.status?d.jsx(Yi,{className:"h-4 w-4 mr-2"}):d.jsx(Xi,{className:"h-4 w-4 mr-2"}),S.status?"Unlist":"List"]})]})]})})]},S.id)})]})]})})})]})})]})}export{Sw as P,fw as Q,_w as T,hw as q};
|