intlayer-editor 6.1.2 → 6.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -264,7 +264,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${t.do
|
|
|
264
264
|
*
|
|
265
265
|
* This source code is licensed under the MIT license found in the
|
|
266
266
|
* LICENSE file in the root directory of this source tree.
|
|
267
|
-
*/var ET;function C8(){if(ET)return Zg;ET=1;var e=Wc(),t=T8();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,s=e.useRef,l=e.useEffect,u=e.useMemo,d=e.useDebugValue;return Zg.useSyncExternalStoreWithSelector=function(f,p,g,y,_){var S=s(null);if(S.current===null){var A={hasValue:!1,value:null};S.current=A}else A=S.current;S=u(function(){function w(I){if(!x){if(x=!0,T=I,I=y(I),_!==void 0&&A.hasValue){var D=A.value;if(_(D,I))return N=D}return N=I}if(D=N,r(T,I))return D;var L=y(I);return _!==void 0&&_(D,L)?(T=I,D):(T=I,N=L)}var x=!1,T,N,R=g===void 0?null:g;return[function(){return w(p())},R===null?void 0:function(){return w(R())}]},[p,g,y,_]);var C=a(f,S[0],S[1]);return l(function(){A.hasValue=!0,A.value=C},[C]),d(C),C},Zg}var ST;function R8(){return ST||(ST=1,Wg.exports=C8()),Wg.exports}var k8=R8();const N8=ib(k8),xO={},{useDebugValue:O8}=Oe,{useSyncExternalStoreWithSelector:I8}=N8;let xT=!1;const D8=e=>e;function j8(e,t=D8,n){(xO?"production":void 0)!=="production"&&n&&!xT&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),xT=!0);const r=I8(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return O8(r),r}const AT=e=>{(xO?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?A8(e):e,n=(r,a)=>j8(t,r,a);return Object.assign(n,t),n},AO=e=>e?AT(e):AT,L8=AO((e,t)=>({scrollBlockers:[],addBlockage:(n,r)=>e(a=>{const s=a.scrollBlockers,l=s.find(u=>u.element===r);if(l){const d=l.blockers.includes(n)?l.blockers:[...l.blockers,n];return{scrollBlockers:s.map(f=>f.element===r?{...f,blockers:d}:f)}}return r.style.overflowY="hidden",r.style.overflowX="hidden",{scrollBlockers:[...s,{element:r,blockers:[n]}]}}),removeBlockage:(n,r)=>e(a=>{const s=a.scrollBlockers,l=s.find(u=>u.element===r);return l?l.blockers.length>1?{scrollBlockers:s.map(u=>u.element===r?{...u,blockers:u.blockers.filter(d=>d!==n)}:u)}:(r.style.overflowY="auto",{scrollBlockers:s.filter(u=>u.element!==r)}):{scrollBlockers:s}}),isElementScrollBlocked:n=>t().scrollBlockers.some(r=>r.element===n)}));function P8(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const{useRef:M8}=Oe;function wO(e){const t=M8();return n=>{const r=e(n);return P8(t.current,r)?t.current:t.current=r}}const TO=e=>{const{disableScroll:t=!1,element:n,key:r="unnamed_blocker"}=e??{},{isElementScrollBlocked:a,addBlockage:s,removeBlockage:l}=L8(wO(f=>({isElementScrollBlocked:f.isElementScrollBlocked,addBlockage:f.addBlockage,removeBlockage:f.removeBlockage}))),u=SO(n);return E.useEffect(()=>{const f=n??window.document.body;t?s(r,f):l(r,f)},[s,t,n,r,l]),{isScrollBlocked:u?a(u):!1}},u0="relative scroll-mb-8 scroll-mt-[30vh] scroll-p-8",z8="after:content-['#'] after:scale-75 after:px-6 after:text-neutral after:absolute after:top-0 after:h-full after:-left-12 after:hover:cursor-pointer after:absolute after:to-neutral after:md:opacity-0 after:transition-opacity hover:after:opacity-80 after:duration-200 after:delay-100",B8=({className:e,...t})=>v.jsx("h1",{className:_e("mt-5 text-2xl font-bold",e),...t}),V8=({className:e,...t})=>v.jsx("h2",{className:_e("mt-16 mb-2 text-2xl font-bold",u0,e),...t}),U8=({className:e,...t})=>v.jsx("h3",{className:_e("mt-5 mb-2 text-xl font-bold",u0,e),...t}),F8=({className:e,...t})=>v.jsx("h4",{className:_e("mt-3 text-lg font-bold",u0,e),...t}),$8=e=>String(e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"-").toLowerCase(),H8=e=>{const r=(document.getElementById(e)?.getBoundingClientRect()?.top??0)+window.scrollY-150;window.scrollTo({top:r,behavior:"smooth"})},G8=(e,t)=>{const n=e.getBoundingClientRect().left,r=e.getBoundingClientRect().top,a=window.getComputedStyle(e,":after"),s=n+parseInt(a.getPropertyValue("left"),10),l=s+parseInt(a.width,10),u=r+parseInt(a.getPropertyValue("top"),10),d=u+parseInt(a.height,10),f=t.clientX,p=t.clientY;return f>=s&&f<=l&&p>=u&&p<=d},d0=({H:e,children:t,className:n,isClickable:r,...a})=>{const s=typeof t=="string"?$8(t):void 0,l=u=>{const{id:d}=u.currentTarget;if(G8(u.currentTarget,u)&&typeof d=="string"){const g=`${window.location.href.split("#")[0]}#${d}`;navigator.clipboard.writeText(g),H8(d)}};return v.jsx(e,{id:s,onClick:r?l:void 0,"aria-label":r?`Click to scroll to section ${s} and copy the link to the clipboard`:void 0,className:_e(r&&z8,n),...a,children:t})},K8=({isClickable:e,...t})=>v.jsx(B8,{...t}),q8=({isClickable:e=!1,...t})=>v.jsx(d0,{H:V8,isClickable:e,...t}),f0=({isClickable:e=!1,...t})=>v.jsx(d0,{H:U8,isClickable:e,...t}),W8=({isClickable:e=!1,...t})=>v.jsx(d0,{H:F8,isClickable:e,...t});var h0=(e=>(e.SM="sm",e.MD="md",e.LG="lg",e.XL="xl",e.UNSET="unset",e))(h0||{});const Z8=fr("cursor-default overflow-auto py-3 shadow-sm justify-center",{variants:{size:{sm:"h-auto max-h-[30vh] w-[95vw] max-w-xl",md:"h-auto max-h-[50vh] w-[95vw] max-w-xl",lg:"h-auto max-h-[70vh] w-[95vw] max-w-2xl",xl:"h-auto max-h-[95vh] w-[95vw] max-w-6xl",unset:"h-auto max-h-[95vh] w-[95vw]"}},defaultVariants:{size:"unset"}}),Y8=cO.create(Tr),p0=({children:e,isOpen:t,container:n,disableScroll:r=!0,onClose:a,hasCloseButton:s=!1,title:l,size:u="md",className:d,...f})=>{const p=SO(n);if(TO({key:"modal",disableScroll:t&&r}),!p)return v.jsx(v.Fragment,{});const g=typeof l=="string";return ho.createPortal(v.jsx(cO.div,{className:"bg-background/40 /40 invisible fixed left-0 top-0 z-50 flex size-full cursor-pointer items-center justify-center overflow-auto backdrop-blur",animate:t?"visible":"invisible",variants:{visible:{opacity:1,visibility:"visible",transition:{duration:.1,when:"beforeChildren"}},invisible:{opacity:0,visibility:"hidden",transition:{duration:.1,when:"afterChildren"}}},onClick:y=>{y.stopPropagation(),a?.()},"aria-hidden":!t,children:v.jsx("div",{className:"flex justify-center p-4",children:v.jsxs(Y8,{onClick:y=>y.stopPropagation(),initial:{scale:t?.5:1},animate:{scale:t?1:.5},transition:{duration:.3},className:Z8({size:u,className:d}),role:"dialog","aria-modal":!0,roundedSize:"2xl",...f,children:[v.jsxs("div",{className:_e("cursor-default px-4",s&&g?"flex items-center justify-center":s?"flex items-center justify-end":g?"items-center":"hidden"),children:[g&&v.jsx(f0,{className:"ml-4 flex items-center justify-center text-lg font-bold",children:l}),s&&v.jsx(ot,{variant:at.HOVERABLE,color:it.TEXT,label:"Close modal",className:"ml-auto",onClick:y=>{y.stopPropagation(),a?.()},Icon:po,size:qn.ICON_MD})]}),v.jsx("div",{className:"flex flex-1 flex-col items-center overflow-auto",children:e})]})})}),p)},X8=e=>{const t=Gr(),n=e??t??rt,r=UR(n),{data:a}=wh({queryKey:["oAuth2AccessToken"],queryFn:r.getOAuth2AccessToken,enabled:!!(n.editor.clientId&&n.editor.clientSecret),staleTime:0,gcTime:0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,refetchInterval:!1,refetchIntervalInBackground:!1});return{oAuth2AccessToken:a?.data}};var Q8=Object.defineProperty,J8=Object.defineProperties,eK=Object.getOwnPropertyDescriptors,wT=Object.getOwnPropertySymbols,tK=Object.prototype.hasOwnProperty,nK=Object.prototype.propertyIsEnumerable,TT=(e,t,n)=>t in e?Q8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,br=(e,t)=>{for(var n in t||(t={}))tK.call(t,n)&&TT(e,n,t[n]);if(wT)for(var n of wT(t))nK.call(t,n)&&TT(e,n,t[n]);return e},Pr=(e,t)=>J8(e,eK(t)),rK=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n}},iK=async(e,t)=>{var n,r,a,s,l,u;let d=t||{};const f={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:d,hooks:f};for(const p of t?.plugins||[]){if(p.init){const g=await((n=p.init)==null?void 0:n.call(p,e.toString(),t));d=g.options||d,e=g.url}f.onRequest.push((r=p.hooks)==null?void 0:r.onRequest),f.onResponse.push((a=p.hooks)==null?void 0:a.onResponse),f.onSuccess.push((s=p.hooks)==null?void 0:s.onSuccess),f.onError.push((l=p.hooks)==null?void 0:l.onError),f.onRetry.push((u=p.hooks)==null?void 0:u.onRetry)}return{url:e,options:d,hooks:f}},CT=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},aK=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function oK(e){if(typeof e=="number")return new CT({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new CT(e);case"exponential":return new aK(e);default:throw new Error("Invalid retry strategy")}}var sK=async e=>{const t={},n=async r=>typeof r=="function"?await r():r;if(e?.auth){if(e.auth.type==="Bearer"){const r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type==="Basic"){const r=n(e.auth.username),a=n(e.auth.password);if(!r||!a)return t;t.authorization=`Basic ${btoa(`${r}:${a}`)}`}else if(e.auth.type==="Custom"){const r=n(e.auth.value);if(!r)return t;t.authorization=`${n(e.auth.prefix)} ${r}`}}return t},lK=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function cK(e){const t=e.headers.get("content-type"),n=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";const r=t.split(";").shift()||"";return lK.test(r)?"json":n.has(r)||r.startsWith("text/")?"text":"blob"}function uK(e){try{return JSON.parse(e),!0}catch{return!1}}function CO(e){if(e===void 0)return!1;const t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function RT(e){try{return JSON.parse(e)}catch{return e}}function kT(e){return typeof e=="function"}function dK(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&kT(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&kT(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function fK(e){const t=new Headers(e?.headers),n=await sK(e);for(const[r,a]of Object.entries(n||{}))t.set(r,a);if(!t.has("content-type")){const r=hK(e?.body);r&&t.set("content-type",r)}return t}function hK(e){return CO(e)?"application/json":null}function pK(e){if(!e?.body)return null;const t=new Headers(e?.headers);if(CO(e.body)&&!t.has("content-type")){for(const[n,r]of Object.entries(e?.body))r instanceof Date&&(e.body[n]=r.toISOString());return JSON.stringify(e.body)}return e.body}function mK(e,t){var n;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){const r=(n=e.split("@")[1])==null?void 0:n.split("/")[0];return kO.includes(r)?r.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function gK(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var yK=class RO extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,RO.prototype)}};async function bf(e,t){let n=await e["~standard"].validate(t);if(n.issues)throw new yK(n.issues);return n.value}var kO=["get","post","put","patch","delete"],vK=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,n){var r,a,s,l;const u=((a=(r=e.plugins)==null?void 0:r.find(d=>{var f;return(f=d.schema)!=null&&f.config?t.startsWith(d.schema.config.baseURL||"")||t.startsWith(d.schema.config.prefix||""):!1}))==null?void 0:a.schema)||e.schema;if(u){let d=t;(s=u.config)!=null&&s.prefix&&d.startsWith(u.config.prefix)&&(d=d.replace(u.config.prefix,""),u.config.baseURL&&(t=t.replace(u.config.prefix,u.config.baseURL))),(l=u.config)!=null&&l.baseURL&&d.startsWith(u.config.baseURL)&&(d=d.replace(u.config.baseURL,""));const f=u.schema[d];if(f){let p=Pr(br({},n),{method:f.method,output:f.output});return n?.disableValidation||(p=Pr(br({},p),{body:f.input?await bf(f.input,n?.body):n?.body,params:f.params?await bf(f.params,n?.params):n?.params,query:f.query?await bf(f.query,n?.query):n?.query})),{url:t,options:p}}}return{url:t,options:n}}}),bK=e=>{async function t(n,r){const a=Pr(br(br({},e),r),{plugins:[...e?.plugins||[],vK(e||{})]});if(e?.catchAllError)try{return await pv(n,a)}catch(s){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:s}}}return await pv(n,a)}return t};function _K(e,t){let{baseURL:n,params:r,query:a}=t||{query:{},params:{},baseURL:""},s=e.startsWith("http")?e.split("/").slice(0,3).join("/"):n||"";if(e.startsWith("@")){const g=e.toString().split("@")[1].split("/")[0];kO.includes(g)&&(e=e.replace(`@${g}/`,"/"))}s.endsWith("/")||(s+="/");let[l,u]=e.replace(s,"").split("?");const d=new URLSearchParams(u);for(const[g,y]of Object.entries(a||{}))y!=null&&d.set(g,String(y));if(r)if(Array.isArray(r)){const g=l.split("/").filter(y=>y.startsWith(":"));for(const[y,_]of g.entries()){const S=r[y];l=l.replace(_,S)}}else for(const[g,y]of Object.entries(r))l=l.replace(`:${g}`,String(y));l=l.split("/").map(encodeURIComponent).join("/"),l.startsWith("/")&&(l=l.slice(1));let f=d.toString();return f=f.length>0?`?${f}`.replace(/\+/g,"%20"):"",s.startsWith("http")?new URL(`${l}${f}`,s):`${s}${l}${f}`}var pv=async(e,t)=>{var n,r,a,s,l,u,d,f;const{hooks:p,url:g,options:y}=await iK(e,t),_=dK(y),S=new AbortController,A=(n=y.signal)!=null?n:S.signal,C=_K(g,y),w=pK(y),x=await fK(y),T=mK(g,y);let N=Pr(br({},y),{url:C,headers:x,body:w,method:T,signal:A});for(const ce of p.onRequest)if(ce){const W=await ce(N);W instanceof Object&&(N=W)}("pipeTo"in N&&typeof N.pipeTo=="function"||typeof((r=t?.body)==null?void 0:r.pipe)=="function")&&("duplex"in N||(N.duplex="half"));const{clearTimeout:R}=gK(y,S);let I=await _(N.url,N);R();const D={response:I,request:N};for(const ce of p.onResponse)if(ce){const W=await ce(Pr(br({},D),{response:(a=t?.hookOptions)!=null&&a.cloneResponse?I.clone():I}));W instanceof Response?I=W:W instanceof Object&&(I=W.response)}if(I.ok){if(!(N.method!=="HEAD"))return{data:"",error:null};const W=cK(I),ae={data:"",response:I,request:N};if(W==="json"||W==="text"){const M=await I.text(),G=await((s=N.jsonParser)!=null?s:RT)(M);ae.data=G}else ae.data=await I[W]();N?.output&&N.output&&!N.disableValidation&&(ae.data=await bf(N.output,ae.data));for(const M of p.onSuccess)M&&await M(Pr(br({},ae),{response:(l=t?.hookOptions)!=null&&l.cloneResponse?I.clone():I}));return t?.throw?ae.data:{data:ae.data,error:null}}const L=(u=t?.jsonParser)!=null?u:RT,H=await I.text(),Z=uK(H),q=Z?await L(H):null,te={response:I,responseText:H,request:N,error:Pr(br({},q),{status:I.status,statusText:I.statusText})};for(const ce of p.onError)ce&&await ce(Pr(br({},te),{response:(d=t?.hookOptions)!=null&&d.cloneResponse?I.clone():I}));if(t?.retry){const ce=oK(t.retry),W=(f=t.retryAttempt)!=null?f:0;if(await ce.shouldAttemptRetry(W,I)){for(const M of p.onRetry)M&&await M(D);const ae=ce.getDelay(W);return await new Promise(M=>setTimeout(M,ae)),await pv(e,Pr(br({},t),{retryAttempt:W+1}))}}if(t?.throw)throw new rK(I.status,I.statusText,Z?q:H);return{data:null,error:Pr(br({},q),{status:I.status,statusText:I.statusText})}};class EK extends Error{constructor(t,n){super(t),this.name="BetterAuthError",this.message=t,this.cause=n,this.stack=""}}function SK(e){try{return new URL(e).pathname!=="/"}catch{throw new EK(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Qg(e,t="/api/auth"){return SK(e)?e:(t=t.startsWith("/")?t:`/${t}`,`${e.replace(/\/+$/,"")}${t}`)}function xK(e,t,n){if(e)return Qg(e,t);const r=Ha.BETTER_AUTH_URL||Ha.NEXT_PUBLIC_BETTER_AUTH_URL||Ha.PUBLIC_BETTER_AUTH_URL||Ha.NUXT_PUBLIC_BETTER_AUTH_URL||Ha.NUXT_PUBLIC_AUTH_URL||(Ha.BASE_URL!=="/"?Ha.BASE_URL:void 0);if(r)return Qg(r,t);if(typeof window<"u"&&window.location)return Qg(window.location.origin,t)}var Jg={},ey={},ty={},gr={},NT;function m0(){if(NT)return gr;NT=1,Object.defineProperty(gr,"__esModule",{value:!0}),gr.cleanTasks=gr.allTasks=gr.task=gr.startTask=void 0;let e=0,t=[];function n(){return e+=1,()=>{if(e-=1,e===0){let l=t;t=[];for(let u of l)u()}}}gr.startTask=n;function r(l){let u=n();return l().finally(u)}gr.task=r;function a(){return e===0?Promise.resolve():new Promise(l=>{t.push(l)})}gr.allTasks=a;function s(){e=0}return gr.cleanTasks=s,gr}var OT;function Th(){return OT||(OT=1,(function(e){var t={};Object.defineProperty(e,"__esModule",{value:!0}),e.cleanStores=e.clean=void 0;const n=m0();e.clean=Symbol("clean");let r=(...a)=>{if(t.NODE_ENV==="production")throw new Error("cleanStores() can be used only during development or tests");(0,n.cleanTasks)();for(let s of a)s&&(s.mocked&&delete s.mocked,s[e.clean]&&s[e.clean]())};e.cleanStores=r})(ty)),ty}var IT;function g0(){return IT||(IT=1,(function(e){var t={};Object.defineProperty(e,"__esModule",{value:!0}),e.onMount=e.STORE_UNMOUNT_DELAY=e.onBuild=e.onNotify=e.onSet=e.onStop=e.onStart=void 0;const n=Th(),r=0,a=1,s=2,l=3,u=4,d=5,f=6,p=10;let g=(x,T,N,R)=>(x.events=x.events||{},x.events[N+p]||(x.events[N+p]=R(I=>{x.events[N].reduceRight((D,L)=>(L(D),D),{shared:{},...I})})),x.events[N]=x.events[N]||[],x.events[N].push(T),()=>{let I=x.events[N],D=I.indexOf(T);I.splice(D,1),I.length||(delete x.events[N],x.events[N+p](),delete x.events[N+p])}),y=(x,T)=>g(x,T,r,N=>{let R=x.listen;return x.listen=I=>(!x.lc&&!x.starting&&(x.starting=!0,N(),delete x.starting),R(I)),()=>{x.listen=R}});e.onStart=y;let _=(x,T)=>g(x,T,a,N=>{let R=x.off;return x.off=()=>{N(),R()},()=>{x.off=R}});e.onStop=_;let S=(x,T)=>g(x,T,s,N=>{let R=x.set,I=x.setKey;return x.setKey&&(x.setKey=(D,L)=>{let H;if(N({abort:()=>{H=!0},changed:D,newValue:{...x.value,[D]:L}}),!H)return I(D,L)}),x.set=D=>{let L;if(N({abort:()=>{L=!0},newValue:D}),!L)return R(D)},()=>{x.set=R,x.setKey=I}});e.onSet=S;let A=(x,T)=>g(x,T,l,N=>{let R=x.notify;return x.notify=I=>{let D;if(N({abort:()=>{D=!0},changed:I}),!D)return R(I)},()=>{x.notify=R}});e.onNotify=A;let C=(x,T)=>g(x,T,u,N=>{let R=x.build;return x.build=(...I)=>{let D=R(...I);return N({store:D}),D},()=>{x.build=R}});e.onBuild=C,e.STORE_UNMOUNT_DELAY=1e3;let w=(x,T)=>g(x,R=>{let I=T(R);I&&x.events[f].push(I)},d,R=>{let I=x.listen;x.listen=L=>(!x.lc&&!x.active&&(x.active=!0,R()),I(L));let D=x.off;if(x.events[f]=[],x.off=()=>{setTimeout(()=>{if(x.active&&!x.lc){x.active=!1;for(let L of x.events[f])L();x.events[f]=[],D()}},e.STORE_UNMOUNT_DELAY)},t.NODE_ENV!=="production"){let L=x[n.clean];x[n.clean]=()=>{for(let H of x.events[f])H();x.events[f]=[],x.active=!1,L()}}return()=>{x.listen=I,x.off=D}});e.onMount=w})(ey)),ey}var ny={},DT;function AK(){return DT||(DT=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.actionFor=e.action=e.lastAction=void 0;const t=m0();e.lastAction=Symbol();let n=(s,l,u,d)=>{let f={...s};f.set=(...g)=>{s[e.lastAction]=l,s.set(...g),delete s[e.lastAction]},s.setKey&&(f.setKey=(...g)=>{s[e.lastAction]=l,s.setKey(...g),delete s[e.lastAction]});let p=u(f,...d);if(p instanceof Promise){let g=(0,t.startTask)();return p.finally(g)}return p},r=(s,l,u)=>(...d)=>n(s,l,u,d);e.action=r;let a=(s,l,u)=>(d,...f)=>n(d,l,u,f);e.actionFor=a})(ny)),ny}var nc={},rc={},ry={},jT;function y0(){return jT||(jT=1,(function(e){var t={};Object.defineProperty(e,"__esModule",{value:!0}),e.atom=e.notifyId=void 0;const n=Th();let r=[];e.notifyId=0;let a=s=>{let l,u=[],d={lc:0,value:s,set(f){d.value=f,d.notify()},get(){return d.lc||d.listen(()=>{})(),d.value},notify(f){l=u;let p=!r.length;for(let g=0;g<l.length;g++)r.push(l[g],d.value,f);if(p){e.notifyId++;for(let g=0;g<r.length;g+=3)r[g](r[g+1],r[g+2]);r.length=0}},listen(f){return u===l&&(u=u.slice()),d.lc=u.push(f),()=>{u===l&&(u=u.slice());let p=u.indexOf(f);~p&&(u.splice(p,1),d.lc--,d.lc||d.off())}},subscribe(f){let p=d.listen(f);return f(d.value),p},off(){}};return t.NODE_ENV!=="production"&&(d[n.clean]=()=>{u=[],d.lc=0,d.off()}),d};e.atom=a})(ry)),ry}var LT;function NO(){if(LT)return rc;LT=1,Object.defineProperty(rc,"__esModule",{value:!0}),rc.map=void 0;const e=y0();let t=(n={})=>{let r=(0,e.atom)(n);return r.setKey=function(a,s){typeof s>"u"?a in r.value&&(r.value={...r.value},delete r.value[a],r.notify(a)):r.value[a]!==s&&(r.value={...r.value,[a]:s},r.notify(a))},r};return rc.map=t,rc}var PT;function wK(){if(PT)return nc;PT=1;var e={};Object.defineProperty(nc,"__esModule",{value:!0}),nc.mapTemplate=void 0;const t=g0(),n=Th(),r=NO();function a(s){let l=(u,...d)=>(l.cache[u]||(l.cache[u]=l.build(u,...d)),l.cache[u]);return l.build=(u,...d)=>{let f=(0,r.map)({id:u});return(0,t.onMount)(f,()=>{let p;return s&&(p=s(f,u,...d)),()=>{delete l.cache[u],p&&p()}}),f},l.cache={},e.NODE_ENV!=="production"&&(l[n.clean]=()=>{for(let u in l.cache)l.cache[u][n.clean]();l.cache={}}),l}return nc.mapTemplate=a,nc}var ic={},MT;function TK(){if(MT)return ic;MT=1,Object.defineProperty(ic,"__esModule",{value:!0}),ic.listenKeys=void 0;function e(t,n,r){let a=new Set([...n,void 0]);return t.listen((s,l)=>{a.has(l)&&r(s,l)})}return ic.listenKeys=e,ic}var ac={},zT;function CK(){if(zT)return ac;zT=1,Object.defineProperty(ac,"__esModule",{value:!0}),ac.keepMount=void 0;let e=t=>{t.listen(()=>{})};return ac.keepMount=e,ac}var oc={},BT;function RK(){if(BT)return oc;BT=1,Object.defineProperty(oc,"__esModule",{value:!0}),oc.computed=void 0;const e=g0(),t=y0();let n=(r,a)=>{Array.isArray(r)||(r=[r]);let s,l=[],u=()=>{let f=r.map(p=>p.get());(s!==t.notifyId||f.some((p,g)=>p!==l[g]))&&(s=t.notifyId,l=f,d.set(a(...f)))},d=(0,t.atom)();return(0,e.onMount)(d,()=>{let f=r.map(p=>p.listen(u,a));return u(),()=>{for(let p of f)p()}}),d};return oc.computed=n,oc}var VT;function kK(){return VT||(VT=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.map=e.atom=e.computed=e.keepMount=e.listenKeys=e.mapTemplate=e.cleanStores=e.clean=e.lastAction=e.actionFor=e.action=e.task=e.allTasks=e.startTask=e.cleanTasks=e.onSet=e.onStop=e.onBuild=e.onMount=e.onStart=e.onNotify=e.STORE_UNMOUNT_DELAY=void 0;var t=g0();Object.defineProperty(e,"STORE_UNMOUNT_DELAY",{enumerable:!0,get:function(){return t.STORE_UNMOUNT_DELAY}}),Object.defineProperty(e,"onNotify",{enumerable:!0,get:function(){return t.onNotify}}),Object.defineProperty(e,"onStart",{enumerable:!0,get:function(){return t.onStart}}),Object.defineProperty(e,"onMount",{enumerable:!0,get:function(){return t.onMount}}),Object.defineProperty(e,"onBuild",{enumerable:!0,get:function(){return t.onBuild}}),Object.defineProperty(e,"onStop",{enumerable:!0,get:function(){return t.onStop}}),Object.defineProperty(e,"onSet",{enumerable:!0,get:function(){return t.onSet}});var n=m0();Object.defineProperty(e,"cleanTasks",{enumerable:!0,get:function(){return n.cleanTasks}}),Object.defineProperty(e,"startTask",{enumerable:!0,get:function(){return n.startTask}}),Object.defineProperty(e,"allTasks",{enumerable:!0,get:function(){return n.allTasks}}),Object.defineProperty(e,"task",{enumerable:!0,get:function(){return n.task}});var r=AK();Object.defineProperty(e,"action",{enumerable:!0,get:function(){return r.action}}),Object.defineProperty(e,"actionFor",{enumerable:!0,get:function(){return r.actionFor}}),Object.defineProperty(e,"lastAction",{enumerable:!0,get:function(){return r.lastAction}});var a=Th();Object.defineProperty(e,"clean",{enumerable:!0,get:function(){return a.clean}}),Object.defineProperty(e,"cleanStores",{enumerable:!0,get:function(){return a.cleanStores}});var s=wK();Object.defineProperty(e,"mapTemplate",{enumerable:!0,get:function(){return s.mapTemplate}});var l=TK();Object.defineProperty(e,"listenKeys",{enumerable:!0,get:function(){return l.listenKeys}});var u=CK();Object.defineProperty(e,"keepMount",{enumerable:!0,get:function(){return u.keepMount}});var d=RK();Object.defineProperty(e,"computed",{enumerable:!0,get:function(){return d.computed}});var f=y0();Object.defineProperty(e,"atom",{enumerable:!0,get:function(){return f.atom}});var p=NO();Object.defineProperty(e,"map",{enumerable:!0,get:function(){return p.map}})})(Jg)),Jg}var mv=kK();const NK=typeof window>"u",OK=(e,t,n,r)=>{const a=mv.atom({data:null,error:null,isPending:!0,isRefetching:!1,refetch:u=>s(u)}),s=u=>{const d=typeof r=="function"?r({data:a.get().data,error:a.get().error,isPending:a.get().isPending}):r;n(t,{...d,query:{...d?.query,...u?.query},async onSuccess(f){a.set({data:f.data,error:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch}),await d?.onSuccess?.(f)},async onError(f){const{request:p}=f,g=typeof p.retry=="number"?p.retry:p.retry?.attempts,y=p.retryAttempt||0;g&&y<g||(a.set({error:f.error,data:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch}),await d?.onError?.(f))},async onRequest(f){const p=a.get();a.set({isPending:p.data===null,data:p.data,error:null,isRefetching:!0,refetch:a.value.refetch}),await d?.onRequest?.(f)}}).catch(f=>{a.set({error:f,data:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch})})};e=Array.isArray(e)?e:[e];let l=!1;for(const u of e)u.subscribe(()=>{NK||(l?s():mv.onMount(a,()=>{const d=setTimeout(()=>{l||(s(),l=!0)},0);return()=>{a.off(),u.off(),clearTimeout(d)}}))});return a},IK={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},DK=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,UT={true:!0,false:!1,null:null,undefined:void 0,nan:Number.NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},jK=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function LK(e){return e instanceof Date&&!isNaN(e.getTime())}function PK(e){const t=jK.exec(e);if(!t)return null;const[,n,r,a,s,l,u,d,f,p,g]=t;let y=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(a,10),parseInt(s,10),parseInt(l,10),parseInt(u,10),d?parseInt(d.padEnd(3,"0"),10):0));if(f){const _=(parseInt(p,10)*60+parseInt(g,10))*(f==="+"?-1:1);y.setUTCMinutes(y.getUTCMinutes()+_)}return LK(y)?y:null}function MK(e,t={}){const{strict:n=!1,warnings:r=!1,reviver:a,parseDates:s=!0}=t;if(typeof e!="string")return e;const l=e.trim();if(l.length>0&&l[0]==='"'&&l.endsWith('"')&&!l.slice(1,-1).includes('"'))return l.slice(1,-1);const u=l.toLowerCase();if(u.length<=9&&u in UT)return UT[u];if(!DK.test(l)){if(n)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(IK).some(([f,p])=>{const g=p.test(l);return g&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${f} pattern`),g})&&n)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(l,(p,g)=>{if(p==="__proto__"||p==="constructor"&&g&&typeof g=="object"&&"prototype"in g){r&&console.warn(`[better-json] Dropping "${p}" key to prevent prototype pollution`);return}if(s&&typeof g=="string"){const y=PK(g);if(y)return y}return a?a(p,g):g})}catch(f){if(n)throw f;return e}}function zK(e,t={strict:!0}){return MK(e,t)}const BK={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};function VK(e){const t=mv.atom(!1);return{session:OK(t,"/get-session",e,{method:"GET"}),$sessionSignal:t}}const UK=e=>{const t="credentials"in Request.prototype,n=xK(e?.baseURL,e?.basePath)??"/api/auth",r=e?.plugins?.flatMap(T=>T.fetchPlugins).filter(T=>T!==void 0)||[],a={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:s,onError:l,onRequest:u,onResponse:d,...f}=e?.fetchOptions||{},p=bK({baseURL:n,...t?{credentials:"include"}:{},method:"GET",jsonParser(T){return T?zK(T,{strict:!1}):null},customFetchImpl:fetch,...f,plugins:[a,...f.plugins||[],...e?.disableDefaultFetchPlugins?[]:[BK],...r]}),{$sessionSignal:g,session:y}=VK(p),_=e?.plugins||[];let S={},A={$sessionSignal:g,session:y},C={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"};const w=[{signal:"$sessionSignal",matcher(T){return T==="/sign-out"||T==="/update-user"||T.startsWith("/sign-in")||T.startsWith("/sign-up")||T==="/delete-user"||T==="/verify-email"}}];for(const T of _)T.getAtoms&&Object.assign(A,T.getAtoms?.(p)),T.pathMethods&&Object.assign(C,T.pathMethods),T.atomListeners&&w.push(...T.atomListeners);const x={notify:T=>{A[T].set(!A[T].get())},listen:(T,N)=>{A[T].subscribe(N)},atoms:A};for(const T of _)T.getActions&&Object.assign(S,T.getActions?.(p,x,e));return{get baseURL(){return n},pluginsActions:S,pluginsAtoms:A,pluginPathMethods:C,atomListeners:w,$fetch:p,$store:x}};function FK(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function $K(e,t,n){const r=t[e],{fetchOptions:a,query:s,...l}=n||{};return r||(a?.method?a.method:l&&Object.keys(l).length>0?"POST":"GET")}function HK(e,t,n,r,a){function s(l=[]){return new Proxy(function(){},{get(u,d){if(d==="then"||d==="catch"||d==="finally")return;const f=[...l,d];let p=e;for(const g of f)if(p&&typeof p=="object"&&g in p)p=p[g];else{p=void 0;break}return typeof p=="function"||FK(p)?p:s(f)},apply:async(u,d,f)=>{const p="/"+l.map(x=>x.replace(/[A-Z]/g,T=>`-${T.toLowerCase()}`)).join("/"),g=f[0]||{},y=f[1]||{},{query:_,fetchOptions:S,...A}=g,C={...y,...S},w=$K(p,n,g);return await t(p,{...C,body:w==="GET"?void 0:{...A,...C?.body||{}},query:_||C?.query,method:w,async onSuccess(x){await C?.onSuccess?.(x);const T=a?.find(I=>I.matcher(p));if(!T)return;const N=r[T.signal];if(!N)return;const R=N.get();setTimeout(()=>{N.set(!R)},10)}})}})}return s()}function GK(e){return e.charAt(0).toUpperCase()+e.slice(1)}function KK(e){const{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:a,atomListeners:s,$store:l}=UK(e);let u={};for(const[p,g]of Object.entries(r))u[`use${GK(p)}`]=g;const d={...n,...u,$fetch:a,$store:l};return HK(d,a,t,r,s)}const OO=e=>{const t=e?.editor?.backendURL??rt.editor?.backendURL;if(!t)throw new Error("Backend URL is not defined in the Intlayer configuration.");const n=()=>KK({baseURL:t,withCredentials:!0});return{signInEmail:async(...q)=>n().signIn.email(...q),signUpEmail:async(...q)=>n().signUp.email(...q),signOut:async(...q)=>n().signOut(...q),signInSocial:async(...q)=>n().signIn.social(...q),linkSocial:async(...q)=>n().linkSocial(...q),changePasswordSession:async(...q)=>n().changePassword(...q),requestPasswordResetSession:async(...q)=>n().requestPasswordReset(...q),resetPassword:async(...q)=>n().resetPassword(...q),verifyEmailSession:async(...q)=>n().verifyEmail(...q),getSession:async(...q)=>n().getSession(...q),forgetPassword:async(...q)=>n().forgetPassword(...q),sendVerificationEmail:async(...q)=>n().sendVerificationEmail(...q),changeEmail:async(...q)=>n().changeEmail(...q),deleteUser:async(...q)=>n().deleteUser(...q),revokeSession:async(...q)=>n().revokeSession(...q),revokeSessions:async(...q)=>n().revokeSessions(...q),revokeOtherSessions:async(...q)=>n().revokeOtherSessions(...q),listAccounts:async(...q)=>n().listAccounts(...q),unlinkAccount:async(...q)=>n().unlinkAccount(...q),refreshToken:async(...q)=>n().refreshToken(...q),getAccessToken:async(...q)=>n().getAccessToken(...q),accountInfo:async(...q)=>n().accountInfo(...q),updateUser:async(...q)=>n().updateUser(...q),listSessions:async(...q)=>n().listSessions(...q)}},qK=(e,t)=>{const n=Gr(),r=t??n??rt,a=c0(),{data:s,isFetched:l,refetch:u}=wh({queryKey:["session"],queryFn:async()=>(await OO(r).getSession()).data,staleTime:0,gcTime:0,enabled:!e,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,refetchInterval:!1,refetchIntervalInBackground:!1}),d=s??(l?null:void 0),f=y=>a.setQueryData(["session"],y),p=async()=>(await u()).data;return{session:d,fetchSession:p,revalidateSession:p,setSession:f}},cu=({session:e,intlayerConfiguration:t}={})=>{const{session:n,fetchSession:r,revalidateSession:a,setSession:s}=qK(e,t),{oAuth2AccessToken:l}=X8(t);return{session:n,fetchSession:r,setSession:s,revalidateSession:a,oAuth2AccessToken:l,isAuthenticated:!!(n?.user||l)}},xi=e=>{const t=Gr(),{oAuth2AccessToken:n}=cu();return NB({...n&&{headers:{Authorization:`Bearer ${n.accessToken}`}}},t)},WK=e=>{const t=Gr();return OO(t)},ZK=({requireUser:e,requireProject:t,requireOrganization:n})=>{const r=Gr(),{oAuth2AccessToken:a,session:s}=cu({intlayerConfiguration:r}),l=s?s.user:a?.user,u=s?s.organization:a?.organization,d=s?s.project:a?.project;return{enable:(e?!!l:!0)&&(t?!!d:!0)&&(n?!!u:!0)}},IO=e=>{const{requireUser:t,requireProject:n,requireOrganization:r,...a}=e,{enable:s}=ZK({requireUser:t,requireProject:n,requireOrganization:r});return wh({...a,enabled:a.enabled===!1?!1:s})},YK=()=>{const e=WK();return mo({mutationKey:["logout"],mutationFn:(...t)=>e.signOut(...t),meta:{invalidateQueries:[["session"],["users"],["organizations"],["projects"],["dictionaries"],["tags"]]}})},XK=e=>{const t=xi();return IO({queryKey:["projects",e],queryFn:({signal:n})=>t.project.getProjects(e,{signal:n}),requireUser:!0,requireOrganization:!0})},QK=()=>{const e=xi();return mo({mutationKey:["dictionaries"],mutationFn:e.dictionary.pushDictionaries,meta:{invalidateQueries:[["dictionaries"],["dictionariesKeys"]]}})},JK=()=>{const e=xi();return mo({mutationKey:["dictionaries"],mutationFn:e.dictionary.deleteDictionary,meta:{invalidateQueries:[["dictionaries"],["dictionariesKeys"]]}})},eq=e=>{const t=xi();return IO({queryKey:["tags",e],queryFn:({signal:n})=>t.tag.getTags(e,{signal:n}),requireUser:!0,requireOrganization:!0,requireProject:!0})},tq=()=>{const e=xi();return mo({mutationKey:["ai-auditContentDeclarationMetadata"],mutationFn:e.ai.auditContentDeclarationMetadata})},nq=()=>{const e=xi();return mo({mutationKey:["ai-auditContentDeclarationField"],mutationFn:e.ai.auditContentDeclarationField})},rq=()=>{const e=xi();return mo({mutationKey:["ai-autocomplete"],mutationFn:e.ai.autocomplete})},DO=()=>{const e=xi();return wh({queryKey:["editor","dictionaries"],queryFn:e.editor.getDictionaries})},iq=()=>{const e=xi();return mo({mutationKey:["editor","dictionaries"],mutationFn:e.editor.writeDictionary})};var uu=e=>e.type==="checkbox",Qa=e=>e instanceof Date,_n=e=>e==null;const jO=e=>typeof e=="object";var Vt=e=>!_n(e)&&!Array.isArray(e)&&jO(e)&&!Qa(e),LO=e=>Vt(e)&&e.target?uu(e.target)?e.target.checked:e.target.value:e,aq=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,PO=(e,t)=>e.has(aq(t)),oq=e=>{const t=e.constructor&&e.constructor.prototype;return Vt(t)&&t.hasOwnProperty("isPrototypeOf")},v0=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Gt(e){let t;const n=Array.isArray(e),r=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(v0&&(e instanceof Blob||r))&&(n||Vt(e)))if(t=n?[]:Object.create(Object.getPrototypeOf(e)),!n&&!oq(e))t=e;else for(const a in e)e.hasOwnProperty(a)&&(t[a]=Gt(e[a]));else return e;return t}var Ch=e=>/^\w*$/.test(e),Dt=e=>e===void 0,b0=e=>Array.isArray(e)?e.filter(Boolean):[],_0=e=>b0(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ee=(e,t,n)=>{if(!t||!Vt(e))return n;const r=(Ch(t)?[t]:_0(t)).reduce((a,s)=>_n(a)?a:a[s],e);return Dt(r)||r===e?Dt(e[t])?n:e[t]:r},Un=e=>typeof e=="boolean",ct=(e,t,n)=>{let r=-1;const a=Ch(t)?[t]:_0(t),s=a.length,l=s-1;for(;++r<s;){const u=a[r];let d=n;if(r!==l){const f=e[u];d=Vt(f)||Array.isArray(f)?f:isNaN(+a[r+1])?{}:[]}if(u==="__proto__"||u==="constructor"||u==="prototype")return;e[u]=d,e=e[u]}};const Ff={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},_r={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},fi={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},E0=Oe.createContext(null);E0.displayName="HookFormContext";const pa=()=>Oe.useContext(E0),sq=e=>{const{children:t,...n}=e;return Oe.createElement(E0.Provider,{value:n},t)};var MO=(e,t,n,r=!0)=>{const a={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(a,s,{get:()=>{const l=s;return t._proxyFormState[l]!==_r.all&&(t._proxyFormState[l]=!r||_r.all),n&&(n[l]=!0),e[l]}});return a};const S0=typeof window<"u"?Oe.useLayoutEffect:Oe.useEffect;function lq(e){const t=pa(),{control:n=t.control,disabled:r,name:a,exact:s}=e||{},[l,u]=Oe.useState(n._formState),d=Oe.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return S0(()=>n._subscribe({name:a,formState:d.current,exact:s,callback:f=>{!r&&u({...n._formState,...f})}}),[a,r,s]),Oe.useEffect(()=>{d.current.isValid&&n._setValid(!0)},[n]),Oe.useMemo(()=>MO(l,n,d.current,!1),[l,n])}var Gn=e=>typeof e=="string",zO=(e,t,n,r,a)=>Gn(e)?(r&&t.watch.add(e),Ee(n,e,a)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),Ee(n,s))):(r&&(t.watchAll=!0),n),gv=e=>_n(e)||!jO(e);function pi(e,t,n=new WeakSet){if(gv(e)||gv(t))return e===t;if(Qa(e)&&Qa(t))return e.getTime()===t.getTime();const r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const s of r){const l=e[s];if(!a.includes(s))return!1;if(s!=="ref"){const u=t[s];if(Qa(l)&&Qa(u)||Vt(l)&&Vt(u)||Array.isArray(l)&&Array.isArray(u)?!pi(l,u,n):l!==u)return!1}}return!0}function cq(e){const t=pa(),{control:n=t.control,name:r,defaultValue:a,disabled:s,exact:l,compute:u}=e||{},d=Oe.useRef(a),f=Oe.useRef(u),p=Oe.useRef(void 0);f.current=u;const g=Oe.useMemo(()=>n._getWatch(r,d.current),[n,r]),[y,_]=Oe.useState(f.current?f.current(g):g);return S0(()=>n._subscribe({name:r,formState:{values:!0},exact:l,callback:S=>{if(!s){const A=zO(r,n._names,S.values||n._formValues,!1,d.current);if(f.current){const C=f.current(A);pi(C,p.current)||(_(C),p.current=C)}else _(A)}}}),[n,s,r,l]),Oe.useEffect(()=>n._removeUnmounted()),y}function uq(e){const t=pa(),{name:n,disabled:r,control:a=t.control,shouldUnregister:s,defaultValue:l}=e,u=PO(a._names.array,n),d=Oe.useMemo(()=>Ee(a._formValues,n,Ee(a._defaultValues,n,l)),[a,n,l]),f=cq({control:a,name:n,defaultValue:d,exact:!0}),p=lq({control:a,name:n,exact:!0}),g=Oe.useRef(e),y=Oe.useRef(void 0),_=Oe.useRef(a.register(n,{...e.rules,value:f,...Un(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const S=Oe.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ee(p.errors,n)},isDirty:{enumerable:!0,get:()=>!!Ee(p.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Ee(p.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Ee(p.validatingFields,n)},error:{enumerable:!0,get:()=>Ee(p.errors,n)}}),[p,n]),A=Oe.useCallback(T=>_.current.onChange({target:{value:LO(T),name:n},type:Ff.CHANGE}),[n]),C=Oe.useCallback(()=>_.current.onBlur({target:{value:Ee(a._formValues,n),name:n},type:Ff.BLUR}),[n,a._formValues]),w=Oe.useCallback(T=>{const N=Ee(a._fields,n);N&&T&&(N._f.ref={focus:()=>T.focus&&T.focus(),select:()=>T.select&&T.select(),setCustomValidity:R=>T.setCustomValidity(R),reportValidity:()=>T.reportValidity()})},[a._fields,n]),x=Oe.useMemo(()=>({name:n,value:f,...Un(r)||p.disabled?{disabled:p.disabled||r}:{},onChange:A,onBlur:C,ref:w}),[n,r,p.disabled,A,C,w,f]);return Oe.useEffect(()=>{const T=a._options.shouldUnregister||s,N=y.current;N&&N!==n&&!u&&a.unregister(N),a.register(n,{...g.current.rules,...Un(g.current.disabled)?{disabled:g.current.disabled}:{}});const R=(I,D)=>{const L=Ee(a._fields,I);L&&L._f&&(L._f.mount=D)};if(R(n,!0),T){const I=Gt(Ee(a._options.defaultValues,n));ct(a._defaultValues,n,I),Dt(Ee(a._formValues,n))&&ct(a._formValues,n,I)}return!u&&a.register(n),y.current=n,()=>{(u?T&&!a._state.action:T)?a.unregister(n):R(n,!1)}},[n,a,u,s]),Oe.useEffect(()=>{a._setDisabledField({disabled:r,name:n})},[r,n,a]),Oe.useMemo(()=>({field:x,formState:p,fieldState:S}),[x,p,S])}const dq=e=>e.render(uq(e));var x0=(e,t,n,r,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:a||!0}}:{},Ec=e=>Array.isArray(e)?e:[e],FT=()=>{let e=[];return{get observers(){return e},next:a=>{for(const s of e)s.next&&s.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(s=>s!==a)}}),unsubscribe:()=>{e=[]}}};function BO(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const a=e[r],s=t[r];if(a&&Vt(a)&&s){const l=BO(a,s);Vt(l)&&(n[r]=l)}else e[r]&&(n[r]=s)}return n}var Nn=e=>Vt(e)&&!Object.keys(e).length,A0=e=>e.type==="file",Er=e=>typeof e=="function",$f=e=>{if(!v0)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},VO=e=>e.type==="select-multiple",w0=e=>e.type==="radio",fq=e=>w0(e)||uu(e),iy=e=>$f(e)&&e.isConnected;function hq(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=Dt(e)?r++:e[t[r++]];return e}function pq(e){for(const t in e)if(e.hasOwnProperty(t)&&!Dt(e[t]))return!1;return!0}function Pt(e,t){const n=Array.isArray(t)?t:Ch(t)?[t]:_0(t),r=n.length===1?e:hq(e,n),a=n.length-1,s=n[a];return r&&delete r[s],a!==0&&(Vt(r)&&Nn(r)||Array.isArray(r)&&pq(r))&&Pt(e,n.slice(0,-1)),e}var mq=e=>{for(const t in e)if(Er(e[t]))return!0;return!1};function UO(e){return Array.isArray(e)||Vt(e)&&!mq(e)}function yv(e,t={}){for(const n in e)UO(e[n])?(t[n]=Array.isArray(e[n])?[]:{},yv(e[n],t[n])):_n(e[n])||(t[n]=!0);return t}function ds(e,t,n){n||(n=yv(t));for(const r in e)UO(e[r])?Dt(t)||gv(n[r])?n[r]=yv(e[r],Array.isArray(e[r])?[]:{}):ds(e[r],_n(t)?{}:t[r],n[r]):n[r]=!pi(e[r],t[r]);return n}const $T={value:!1,isValid:!1},HT={value:!0,isValid:!0};var FO=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Dt(e[0].attributes.value)?Dt(e[0].value)||e[0].value===""?HT:{value:e[0].value,isValid:!0}:HT:$T}return $T},$O=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Dt(e)?e:t?e===""?NaN:e&&+e:n&&Gn(e)?new Date(e):r?r(e):e;const GT={isValid:!1,value:null};var HO=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,GT):GT;function KT(e){const t=e.ref;return A0(t)?t.files:w0(t)?HO(e.refs).value:VO(t)?[...t.selectedOptions].map(({value:n})=>n):uu(t)?FO(e.refs).value:$O(Dt(t.value)?e.ref.value:t.value,e)}var gq=(e,t,n,r)=>{const a={};for(const s of e){const l=Ee(t,s);l&&ct(a,s,l._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:r}},Hf=e=>e instanceof RegExp,sc=e=>Dt(e)?e:Hf(e)?e.source:Vt(e)?Hf(e.value)?e.value.source:e.value:e,qT=e=>({isOnSubmit:!e||e===_r.onSubmit,isOnBlur:e===_r.onBlur,isOnChange:e===_r.onChange,isOnAll:e===_r.all,isOnTouch:e===_r.onTouched});const WT="AsyncFunction";var yq=e=>!!e&&!!e.validate&&!!(Er(e.validate)&&e.validate.constructor.name===WT||Vt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===WT)),vq=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),ZT=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Sc=(e,t,n,r)=>{for(const a of n||Object.keys(e)){const s=Ee(e,a);if(s){const{_f:l,...u}=s;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],a)&&!r)return!0;if(l.ref&&t(l.ref,l.name)&&!r)return!0;if(Sc(u,t))break}else if(Vt(u)&&Sc(u,t))break}}};function YT(e,t,n){const r=Ee(e,n);if(r||Ch(n))return{error:r,name:n};const a=n.split(".");for(;a.length;){const s=a.join("."),l=Ee(t,s),u=Ee(e,s);if(l&&!Array.isArray(l)&&n!==s)return{name:n};if(u&&u.type)return{name:s,error:u};if(u&&u.root&&u.root.type)return{name:`${s}.root`,error:u.root};a.pop()}return{name:n}}var bq=(e,t,n,r)=>{n(e);const{name:a,...s}=e;return Nn(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(l=>t[l]===(!r||_r.all))},_q=(e,t,n)=>!e||!t||e===t||Ec(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),Eq=(e,t,n,r,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(t||e):(n?r.isOnBlur:a.isOnBlur)?!e:(n?r.isOnChange:a.isOnChange)?e:!0,Sq=(e,t)=>!b0(Ee(e,t)).length&&Pt(e,t),xq=(e,t,n)=>{const r=Ec(Ee(e,n));return ct(r,"root",t[n]),ct(e,n,r),e};function XT(e,t,n="validate"){if(Gn(e)||Array.isArray(e)&&e.every(Gn)||Un(e)&&!e)return{type:n,message:Gn(e)?e:"",ref:t}}var ls=e=>Vt(e)&&!Hf(e)?e:{value:e,message:""},QT=async(e,t,n,r,a,s)=>{const{ref:l,refs:u,required:d,maxLength:f,minLength:p,min:g,max:y,pattern:_,validate:S,name:A,valueAsNumber:C,mount:w}=e._f,x=Ee(n,A);if(!w||t.has(A))return{};const T=u?u[0]:l,N=te=>{a&&T.reportValidity&&(T.setCustomValidity(Un(te)?"":te||""),T.reportValidity())},R={},I=w0(l),D=uu(l),L=I||D,H=(C||A0(l))&&Dt(l.value)&&Dt(x)||$f(l)&&l.value===""||x===""||Array.isArray(x)&&!x.length,Z=x0.bind(null,A,r,R),q=(te,ce,W,ae=fi.maxLength,M=fi.minLength)=>{const X=te?ce:W;R[A]={type:te?ae:M,message:X,ref:l,...Z(te?ae:M,X)}};if(s?!Array.isArray(x)||!x.length:d&&(!L&&(H||_n(x))||Un(x)&&!x||D&&!FO(u).isValid||I&&!HO(u).isValid)){const{value:te,message:ce}=Gn(d)?{value:!!d,message:d}:ls(d);if(te&&(R[A]={type:fi.required,message:ce,ref:T,...Z(fi.required,ce)},!r))return N(ce),R}if(!H&&(!_n(g)||!_n(y))){let te,ce;const W=ls(y),ae=ls(g);if(!_n(x)&&!isNaN(x)){const M=l.valueAsNumber||x&&+x;_n(W.value)||(te=M>W.value),_n(ae.value)||(ce=M<ae.value)}else{const M=l.valueAsDate||new Date(x),X=P=>new Date(new Date().toDateString()+" "+P),G=l.type=="time",ge=l.type=="week";Gn(W.value)&&x&&(te=G?X(x)>X(W.value):ge?x>W.value:M>new Date(W.value)),Gn(ae.value)&&x&&(ce=G?X(x)<X(ae.value):ge?x<ae.value:M<new Date(ae.value))}if((te||ce)&&(q(!!te,W.message,ae.message,fi.max,fi.min),!r))return N(R[A].message),R}if((f||p)&&!H&&(Gn(x)||s&&Array.isArray(x))){const te=ls(f),ce=ls(p),W=!_n(te.value)&&x.length>+te.value,ae=!_n(ce.value)&&x.length<+ce.value;if((W||ae)&&(q(W,te.message,ce.message),!r))return N(R[A].message),R}if(_&&!H&&Gn(x)){const{value:te,message:ce}=ls(_);if(Hf(te)&&!x.match(te)&&(R[A]={type:fi.pattern,message:ce,ref:l,...Z(fi.pattern,ce)},!r))return N(ce),R}if(S){if(Er(S)){const te=await S(x,n),ce=XT(te,T);if(ce&&(R[A]={...ce,...Z(fi.validate,ce.message)},!r))return N(ce.message),R}else if(Vt(S)){let te={};for(const ce in S){if(!Nn(te)&&!r)break;const W=XT(await S[ce](x,n),T,ce);W&&(te={...W,...Z(ce,W.message)},N(W.message),r&&(R[A]=te))}if(!Nn(te)&&(R[A]={ref:T,...te},!r))return R}}return N(!0),R};const Aq={mode:_r.onSubmit,reValidateMode:_r.onChange,shouldFocusError:!0};function wq(e={}){let t={...Aq,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Er(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},a=Vt(t.defaultValues)||Vt(t.values)?Gt(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Gt(a),l={action:!1,mount:!1,watch:!1},u={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,f=0;const p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let g={...p};const y={array:FT(),state:FT()},_=t.criteriaMode===_r.all,S=V=>ee=>{clearTimeout(f),f=setTimeout(V,ee)},A=async V=>{if(!t.disabled&&(p.isValid||g.isValid||V)){const ee=t.resolver?Nn((await D()).errors):await H(r,!0);ee!==n.isValid&&y.state.next({isValid:ee})}},C=(V,ee)=>{!t.disabled&&(p.isValidating||p.validatingFields||g.isValidating||g.validatingFields)&&((V||Array.from(u.mount)).forEach(oe=>{oe&&(ee?ct(n.validatingFields,oe,ee):Pt(n.validatingFields,oe))}),y.state.next({validatingFields:n.validatingFields,isValidating:!Nn(n.validatingFields)}))},w=(V,ee=[],oe,Se,be=!0,ve=!0)=>{if(Se&&oe&&!t.disabled){if(l.action=!0,ve&&Array.isArray(Ee(r,V))){const Ce=oe(Ee(r,V),Se.argA,Se.argB);be&&ct(r,V,Ce)}if(ve&&Array.isArray(Ee(n.errors,V))){const Ce=oe(Ee(n.errors,V),Se.argA,Se.argB);be&&ct(n.errors,V,Ce),Sq(n.errors,V)}if((p.touchedFields||g.touchedFields)&&ve&&Array.isArray(Ee(n.touchedFields,V))){const Ce=oe(Ee(n.touchedFields,V),Se.argA,Se.argB);be&&ct(n.touchedFields,V,Ce)}(p.dirtyFields||g.dirtyFields)&&(n.dirtyFields=ds(a,s)),y.state.next({name:V,isDirty:q(V,ee),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ct(s,V,ee)},x=(V,ee)=>{ct(n.errors,V,ee),y.state.next({errors:n.errors})},T=V=>{n.errors=V,y.state.next({errors:n.errors,isValid:!1})},N=(V,ee,oe,Se)=>{const be=Ee(r,V);if(be){const ve=Ee(s,V,Dt(oe)?Ee(a,V):oe);Dt(ve)||Se&&Se.defaultChecked||ee?ct(s,V,ee?ve:KT(be._f)):W(V,ve),l.mount&&A()}},R=(V,ee,oe,Se,be)=>{let ve=!1,Ce=!1;const Ve={name:V};if(!t.disabled){if(!oe||Se){(p.isDirty||g.isDirty)&&(Ce=n.isDirty,n.isDirty=Ve.isDirty=q(),ve=Ce!==Ve.isDirty);const Xe=pi(Ee(a,V),ee);Ce=!!Ee(n.dirtyFields,V),Xe?Pt(n.dirtyFields,V):ct(n.dirtyFields,V,!0),Ve.dirtyFields=n.dirtyFields,ve=ve||(p.dirtyFields||g.dirtyFields)&&Ce!==!Xe}if(oe){const Xe=Ee(n.touchedFields,V);Xe||(ct(n.touchedFields,V,oe),Ve.touchedFields=n.touchedFields,ve=ve||(p.touchedFields||g.touchedFields)&&Xe!==oe)}ve&&be&&y.state.next(Ve)}return ve?Ve:{}},I=(V,ee,oe,Se)=>{const be=Ee(n.errors,V),ve=(p.isValid||g.isValid)&&Un(ee)&&n.isValid!==ee;if(t.delayError&&oe?(d=S(()=>x(V,oe)),d(t.delayError)):(clearTimeout(f),d=null,oe?ct(n.errors,V,oe):Pt(n.errors,V)),(oe?!pi(be,oe):be)||!Nn(Se)||ve){const Ce={...Se,...ve&&Un(ee)?{isValid:ee}:{},errors:n.errors,name:V};n={...n,...Ce},y.state.next(Ce)}},D=async V=>{C(V,!0);const ee=await t.resolver(s,t.context,gq(V||u.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return C(V),ee},L=async V=>{const{errors:ee}=await D(V);if(V)for(const oe of V){const Se=Ee(ee,oe);Se?ct(n.errors,oe,Se):Pt(n.errors,oe)}else n.errors=ee;return ee},H=async(V,ee,oe={valid:!0})=>{for(const Se in V){const be=V[Se];if(be){const{_f:ve,...Ce}=be;if(ve){const Ve=u.array.has(ve.name),Xe=be._f&&yq(be._f);Xe&&p.validatingFields&&C([ve.name],!0);const pt=await QT(be,u.disabled,s,_,t.shouldUseNativeValidation&&!ee,Ve);if(Xe&&p.validatingFields&&C([ve.name]),pt[ve.name]&&(oe.valid=!1,ee))break;!ee&&(Ee(pt,ve.name)?Ve?xq(n.errors,pt,ve.name):ct(n.errors,ve.name,pt[ve.name]):Pt(n.errors,ve.name))}!Nn(Ce)&&await H(Ce,ee,oe)}}return oe.valid},Z=()=>{for(const V of u.unMount){const ee=Ee(r,V);ee&&(ee._f.refs?ee._f.refs.every(oe=>!iy(oe)):!iy(ee._f.ref))&&fe(V)}u.unMount=new Set},q=(V,ee)=>!t.disabled&&(V&&ee&&ct(s,V,ee),!pi(P(),a)),te=(V,ee,oe)=>zO(V,u,{...l.mount?s:Dt(ee)?a:Gn(V)?{[V]:ee}:ee},oe,ee),ce=V=>b0(Ee(l.mount?s:a,V,t.shouldUnregister?Ee(a,V,[]):[])),W=(V,ee,oe={})=>{const Se=Ee(r,V);let be=ee;if(Se){const ve=Se._f;ve&&(!ve.disabled&&ct(s,V,$O(ee,ve)),be=$f(ve.ref)&&_n(ee)?"":ee,VO(ve.ref)?[...ve.ref.options].forEach(Ce=>Ce.selected=be.includes(Ce.value)):ve.refs?uu(ve.ref)?ve.refs.forEach(Ce=>{(!Ce.defaultChecked||!Ce.disabled)&&(Array.isArray(be)?Ce.checked=!!be.find(Ve=>Ve===Ce.value):Ce.checked=be===Ce.value||!!be)}):ve.refs.forEach(Ce=>Ce.checked=Ce.value===be):A0(ve.ref)?ve.ref.value="":(ve.ref.value=be,ve.ref.type||y.state.next({name:V,values:Gt(s)})))}(oe.shouldDirty||oe.shouldTouch)&&R(V,be,oe.shouldTouch,oe.shouldDirty,!0),oe.shouldValidate&&ge(V)},ae=(V,ee,oe)=>{for(const Se in ee){if(!ee.hasOwnProperty(Se))return;const be=ee[Se],ve=V+"."+Se,Ce=Ee(r,ve);(u.array.has(V)||Vt(be)||Ce&&!Ce._f)&&!Qa(be)?ae(ve,be,oe):W(ve,be,oe)}},M=(V,ee,oe={})=>{const Se=Ee(r,V),be=u.array.has(V),ve=Gt(ee);ct(s,V,ve),be?(y.array.next({name:V,values:Gt(s)}),(p.isDirty||p.dirtyFields||g.isDirty||g.dirtyFields)&&oe.shouldDirty&&y.state.next({name:V,dirtyFields:ds(a,s),isDirty:q(V,ve)})):Se&&!Se._f&&!_n(ve)?ae(V,ve,oe):W(V,ve,oe),ZT(V,u)&&y.state.next({...n,name:V}),y.state.next({name:l.mount?V:void 0,values:Gt(s)})},X=async V=>{l.mount=!0;const ee=V.target;let oe=ee.name,Se=!0;const be=Ee(r,oe),ve=Xe=>{Se=Number.isNaN(Xe)||Qa(Xe)&&isNaN(Xe.getTime())||pi(Xe,Ee(s,oe,Xe))},Ce=qT(t.mode),Ve=qT(t.reValidateMode);if(be){let Xe,pt;const vo=ee.type?KT(be._f):LO(V),Cr=V.type===Ff.BLUR||V.type===Ff.FOCUS_OUT,Xh=!vq(be._f)&&!t.resolver&&!Ee(n.errors,oe)&&!be._f.deps||Eq(Cr,Ee(n.touchedFields,oe),n.isSubmitted,Ve,Ce),wi=ZT(oe,u,Cr);ct(s,oe,vo),Cr?(!ee||!ee.readOnly)&&(be._f.onBlur&&be._f.onBlur(V),d&&d(0)):be._f.onChange&&be._f.onChange(V);const Ti=R(oe,vo,Cr),Zr=!Nn(Ti)||wi;if(!Cr&&y.state.next({name:oe,type:V.type,values:Gt(s)}),Xh)return(p.isValid||g.isValid)&&(t.mode==="onBlur"?Cr&&A():Cr||A()),Zr&&y.state.next({name:oe,...wi?{}:Ti});if(!Cr&&wi&&y.state.next({...n}),t.resolver){const{errors:xa}=await D([oe]);if(ve(vo),Se){const Aa=YT(n.errors,r,oe),_u=YT(xa,r,Aa.name||oe);Xe=_u.error,oe=_u.name,pt=Nn(xa)}}else C([oe],!0),Xe=(await QT(be,u.disabled,s,_,t.shouldUseNativeValidation))[oe],C([oe]),ve(vo),Se&&(Xe?pt=!1:(p.isValid||g.isValid)&&(pt=await H(r,!0)));Se&&(be._f.deps&&(!Array.isArray(be._f.deps)||be._f.deps.length>0)&&ge(be._f.deps),I(oe,pt,Xe,Ti))}},G=(V,ee)=>{if(Ee(n.errors,ee)&&V.focus)return V.focus(),1},ge=async(V,ee={})=>{let oe,Se;const be=Ec(V);if(t.resolver){const ve=await L(Dt(V)?V:be);oe=Nn(ve),Se=V?!be.some(Ce=>Ee(ve,Ce)):oe}else V?(Se=(await Promise.all(be.map(async ve=>{const Ce=Ee(r,ve);return await H(Ce&&Ce._f?{[ve]:Ce}:Ce)}))).every(Boolean),!(!Se&&!n.isValid)&&A()):Se=oe=await H(r);return y.state.next({...!Gn(V)||(p.isValid||g.isValid)&&oe!==n.isValid?{}:{name:V},...t.resolver||!V?{isValid:oe}:{},errors:n.errors}),ee.shouldFocus&&!Se&&Sc(r,G,V?be:u.mount),Se},P=(V,ee)=>{let oe={...l.mount?s:a};return ee&&(oe=BO(ee.dirtyFields?n.dirtyFields:n.touchedFields,oe)),Dt(V)?oe:Gn(V)?Ee(oe,V):V.map(Se=>Ee(oe,Se))},ie=(V,ee)=>({invalid:!!Ee((ee||n).errors,V),isDirty:!!Ee((ee||n).dirtyFields,V),error:Ee((ee||n).errors,V),isValidating:!!Ee(n.validatingFields,V),isTouched:!!Ee((ee||n).touchedFields,V)}),F=V=>{V&&Ec(V).forEach(ee=>Pt(n.errors,ee)),y.state.next({errors:V?n.errors:{}})},J=(V,ee,oe)=>{const Se=(Ee(r,V,{_f:{}})._f||{}).ref,be=Ee(n.errors,V)||{},{ref:ve,message:Ce,type:Ve,...Xe}=be;ct(n.errors,V,{...Xe,...ee,ref:Se}),y.state.next({name:V,errors:n.errors,isValid:!1}),oe&&oe.shouldFocus&&Se&&Se.focus&&Se.focus()},se=(V,ee)=>Er(V)?y.state.subscribe({next:oe=>"values"in oe&&V(te(void 0,ee),oe)}):te(V,ee,!0),he=V=>y.state.subscribe({next:ee=>{_q(V.name,ee.name,V.exact)&&bq(ee,V.formState||p,un,V.reRenderRoot)&&V.callback({values:{...s},...n,...ee,defaultValues:a})}}).unsubscribe,ye=V=>(l.mount=!0,g={...g,...V.formState},he({...V,formState:g})),fe=(V,ee={})=>{for(const oe of V?Ec(V):u.mount)u.mount.delete(oe),u.array.delete(oe),ee.keepValue||(Pt(r,oe),Pt(s,oe)),!ee.keepError&&Pt(n.errors,oe),!ee.keepDirty&&Pt(n.dirtyFields,oe),!ee.keepTouched&&Pt(n.touchedFields,oe),!ee.keepIsValidating&&Pt(n.validatingFields,oe),!t.shouldUnregister&&!ee.keepDefaultValue&&Pt(a,oe);y.state.next({values:Gt(s)}),y.state.next({...n,...ee.keepDirty?{isDirty:q()}:{}}),!ee.keepIsValid&&A()},xe=({disabled:V,name:ee})=>{(Un(V)&&l.mount||V||u.disabled.has(ee))&&(V?u.disabled.add(ee):u.disabled.delete(ee))},je=(V,ee={})=>{let oe=Ee(r,V);const Se=Un(ee.disabled)||Un(t.disabled);return ct(r,V,{...oe||{},_f:{...oe&&oe._f?oe._f:{ref:{name:V}},name:V,mount:!0,...ee}}),u.mount.add(V),oe?xe({disabled:Un(ee.disabled)?ee.disabled:t.disabled,name:V}):N(V,!0,ee.value),{...Se?{disabled:ee.disabled||t.disabled}:{},...t.progressive?{required:!!ee.required,min:sc(ee.min),max:sc(ee.max),minLength:sc(ee.minLength),maxLength:sc(ee.maxLength),pattern:sc(ee.pattern)}:{},name:V,onChange:X,onBlur:X,ref:be=>{if(be){je(V,ee),oe=Ee(r,V);const ve=Dt(be.value)&&be.querySelectorAll&&be.querySelectorAll("input,select,textarea")[0]||be,Ce=fq(ve),Ve=oe._f.refs||[];if(Ce?Ve.find(Xe=>Xe===ve):ve===oe._f.ref)return;ct(r,V,{_f:{...oe._f,...Ce?{refs:[...Ve.filter(iy),ve,...Array.isArray(Ee(a,V))?[{}]:[]],ref:{type:ve.type,name:V}}:{ref:ve}}}),N(V,!1,void 0,ve)}else oe=Ee(r,V,{}),oe._f&&(oe._f.mount=!1),(t.shouldUnregister||ee.shouldUnregister)&&!(PO(u.array,V)&&l.action)&&u.unMount.add(V)}}},Be=()=>t.shouldFocusError&&Sc(r,G,u.mount),Ye=V=>{Un(V)&&(y.state.next({disabled:V}),Sc(r,(ee,oe)=>{const Se=Ee(r,oe);Se&&(ee.disabled=Se._f.disabled||V,Array.isArray(Se._f.refs)&&Se._f.refs.forEach(be=>{be.disabled=Se._f.disabled||V}))},0,!1))},et=(V,ee)=>async oe=>{let Se;oe&&(oe.preventDefault&&oe.preventDefault(),oe.persist&&oe.persist());let be=Gt(s);if(y.state.next({isSubmitting:!0}),t.resolver){const{errors:ve,values:Ce}=await D();n.errors=ve,be=Gt(Ce)}else await H(r);if(u.disabled.size)for(const ve of u.disabled)Pt(be,ve);if(Pt(n.errors,"root"),Nn(n.errors)){y.state.next({errors:{}});try{await V(be,oe)}catch(ve){Se=ve}}else ee&&await ee({...n.errors},oe),Be(),setTimeout(Be);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Nn(n.errors)&&!Se,submitCount:n.submitCount+1,errors:n.errors}),Se)throw Se},Zt=(V,ee={})=>{Ee(r,V)&&(Dt(ee.defaultValue)?M(V,Gt(Ee(a,V))):(M(V,ee.defaultValue),ct(a,V,Gt(ee.defaultValue))),ee.keepTouched||Pt(n.touchedFields,V),ee.keepDirty||(Pt(n.dirtyFields,V),n.isDirty=ee.defaultValue?q(V,Gt(Ee(a,V))):q()),ee.keepError||(Pt(n.errors,V),p.isValid&&A()),y.state.next({...n}))},An=(V,ee={})=>{const oe=V?Gt(V):a,Se=Gt(oe),be=Nn(V),ve=be?a:Se;if(ee.keepDefaultValues||(a=oe),!ee.keepValues){if(ee.keepDirtyValues){const Ce=new Set([...u.mount,...Object.keys(ds(a,s))]);for(const Ve of Array.from(Ce))Ee(n.dirtyFields,Ve)?ct(ve,Ve,Ee(s,Ve)):M(Ve,Ee(ve,Ve))}else{if(v0&&Dt(V))for(const Ce of u.mount){const Ve=Ee(r,Ce);if(Ve&&Ve._f){const Xe=Array.isArray(Ve._f.refs)?Ve._f.refs[0]:Ve._f.ref;if($f(Xe)){const pt=Xe.closest("form");if(pt){pt.reset();break}}}}if(ee.keepFieldsRef)for(const Ce of u.mount)M(Ce,Ee(ve,Ce));else r={}}s=t.shouldUnregister?ee.keepDefaultValues?Gt(a):{}:Gt(ve),y.array.next({values:{...ve}}),y.state.next({values:{...ve}})}u={mount:ee.keepDirtyValues?u.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!p.isValid||!!ee.keepIsValid||!!ee.keepDirtyValues,l.watch=!!t.shouldUnregister,y.state.next({submitCount:ee.keepSubmitCount?n.submitCount:0,isDirty:be?!1:ee.keepDirty?n.isDirty:!!(ee.keepDefaultValues&&!pi(V,a)),isSubmitted:ee.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:be?{}:ee.keepDirtyValues?ee.keepDefaultValues&&s?ds(a,s):n.dirtyFields:ee.keepDefaultValues&&V?ds(a,V):ee.keepDirty?n.dirtyFields:{},touchedFields:ee.keepTouched?n.touchedFields:{},errors:ee.keepErrors?n.errors:{},isSubmitSuccessful:ee.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},Ai=(V,ee)=>An(Er(V)?V(s):V,ee),Sa=(V,ee={})=>{const oe=Ee(r,V),Se=oe&&oe._f;if(Se){const be=Se.refs?Se.refs[0]:Se.ref;be.focus&&(be.focus(),ee.shouldSelect&&Er(be.select)&&be.select())}},un=V=>{n={...n,...V}},Qs={control:{register:je,unregister:fe,getFieldState:ie,handleSubmit:et,setError:J,_subscribe:he,_runSchema:D,_focusError:Be,_getWatch:te,_getDirty:q,_setValid:A,_setFieldArray:w,_setDisabledField:xe,_setErrors:T,_getFieldArray:ce,_reset:An,_resetDefaultValues:()=>Er(t.defaultValues)&&t.defaultValues().then(V=>{Ai(V,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:Z,_disableForm:Ye,_subjects:y,_proxyFormState:p,get _fields(){return r},get _formValues(){return s},get _state(){return l},set _state(V){l=V},get _defaultValues(){return a},get _names(){return u},set _names(V){u=V},get _formState(){return n},get _options(){return t},set _options(V){t={...t,...V}}},subscribe:ye,trigger:ge,register:je,handleSubmit:et,watch:se,setValue:M,getValues:P,reset:Ai,resetField:Zt,clearErrors:F,unregister:fe,setError:J,setFocus:Sa,getFieldState:ie};return{...Qs,formControl:Qs}}function Tq(e={}){const t=Oe.useRef(void 0),n=Oe.useRef(void 0),[r,a]=Oe.useState({isDirty:!1,isValidating:!1,isLoading:Er(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:Er(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!Er(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...u}=wq(e);t.current={...u,formState:r}}const s=t.current.control;return s._options=e,S0(()=>{const l=s._subscribe({formState:s._proxyFormState,callback:()=>a({...s._formState}),reRenderRoot:!0});return a(u=>({...u,isReady:!0})),s._formState.isReady=!0,l},[s]),Oe.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),Oe.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),Oe.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),Oe.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),Oe.useEffect(()=>{if(s._proxyFormState.isDirty){const l=s._getDirty();l!==r.isDirty&&s._subjects.state.next({isDirty:l})}},[s,r.isDirty]),Oe.useEffect(()=>{e.values&&!pi(e.values,n.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),n.current=e.values,a(l=>({...l}))):s._resetDefaultValues()},[s,e.values]),Oe.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=MO(r,s),t.current}const JT=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Ee(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},vv=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?JT(r.ref,n,e):r&&r.refs&&r.refs.forEach(a=>JT(a,n,e))}},eC=(e,t)=>{t.shouldUseNativeValidation&&vv(e,t);const n={};for(const r in e){const a=Ee(t.fields,r),s=Object.assign(e[r]||{},{ref:a&&a.ref});if(Cq(t.names||Object.keys(e),r)){const l=Object.assign({},Ee(n,r));ct(l,"root",s),ct(n,r,l)}else ct(n,r,s)}return n},Cq=(e,t)=>{const n=tC(t);return e.some(r=>tC(r).match(`^${n}\\.\\d+`))};function tC(e){return e.replace(/\]|\[/g,"")}const Rq=e=>{const t=E.useId(),n=E.useMemo(()=>({id:t}),[t]);return v.jsx(GO,{value:n,children:v.jsx("div",{className:"flex flex-col gap-2 p-2",...e})})},GO=E.createContext({}),KO=E.createContext({}),kq=({...e})=>{const t=E.useMemo(()=>({name:e.name}),[e.name]);return v.jsx(KO,{value:t,children:v.jsx(dq,{...e})})},ma=()=>{const e=E.useContext(KO),t=E.useContext(GO),{getFieldState:n,formState:r}=pa(),a=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...a}},qO=fr("",{variants:{variant:{default:["w-full select-text resize-none rounded-xl border-2 bg-input-background text-base md:text-sm text-input-text shadow-none outline-0 transition-all","border-input-border hover:border-input-border-hover focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]","aria-[invalid=true]:border-error","disabled:opacity-50"],invisible:["w-full border-none bg-inherit text-inherit outline-hidden ring-0"]},size:{md:"px-2 md:py-1 py-3",lg:"p-4 md:py-2"},validationStyleEnabled:{disabled:"",enabled:"valid:border-success invalid:border-error"}},defaultVariants:{variant:"default",size:"md",validationStyleEnabled:"disabled"}});var la=(e=>(e.DEFAULT="default",e.INVISIBLE="invisible",e))(la||{});const Gs=({validationStyleEnabled:e=!1,variant:t,size:n,className:r,...a})=>v.jsx("input",{className:qO({variant:t,size:n,validationStyleEnabled:e?"enabled":"disabled",className:r}),...a}),Nq=fr("",{variants:{variant:{default:["pointer rounded border-2 bg-input-background text-input-text shadow-none outline-0 transition-all","border-input-border hover:border-input-border-hover focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]","checked:bg-checkbox-checked checked:border-checkbox-checked-border","disabled:opacity-50"]},size:{sm:"size-4",md:"size-5",lg:"size-6"},color:{primary:"accent-primary",secondary:"accent-secondary",destructive:"accent-destructive",neutral:"accent-neutral",light:"accent-light",text:"accent-text",dark:"accent-dark",error:"accent-error",success:"accent-success",custom:"accent-custom"},validationStyleEnabled:{disabled:"",enabled:"valid:border-success invalid:border-error"}},defaultVariants:{variant:"default",color:"primary",validationStyleEnabled:"disabled",size:"md"}}),nC=({validationStyleEnabled:e=!1,label:t,size:n,color:r,name:a,variant:s,className:l,...u})=>v.jsx("input",{type:"checkbox",className:Nq({variant:s,size:n,color:r,validationStyleEnabled:e?"enabled":"disabled",className:l}),...u}),Oq=e=>{const{label:t,name:n,id:r}=e;return t?v.jsxs("label",{htmlFor:r??n,className:"flex items-center gap-x-4 font-medium text-sm cursor-pointer",children:[v.jsx(nC,{id:r??n,...e}),t]}):v.jsx(nC,{id:r??n,...e})},Iq=e=>{const[t,n]=E.useState(!1),r=s=>{s.preventDefault(),s.stopPropagation(),n(l=>!l)},a=t?Z2:q2;return v.jsxs("div",{className:"relative",children:[v.jsx(Gs,{...e,"aria-label":"password",type:t?"text":"password"}),v.jsx("button",{"data-testid":"eye-icon",className:"absolute right-2 h-full flex-row items-center",onClick:r,"aria-label":t?"Hide password":"Show password",children:v.jsx(a,{className:"text-neutral mr-2 inline-block",size:20})})]})},WO=({className:e,variant:t,validationStyleEnabled:n=!1,...r})=>v.jsx("textarea",{className:_e("resize-none",qO({variant:t,validationStyleEnabled:n?"enabled":"disabled",className:e})),...r}),ZO=({value:e="",onCancel:t,onSave:n,onClick:r,children:a,isDisabled:s,...l})=>{const[u,d]=E.useState(!1),f=E.useRef(null),p=S=>{S.stopPropagation(),d(!1),n()},g=S=>{S.stopPropagation(),d(!1),t()},y=!e||e===""?"-":e,_=E.useCallback(S=>{const A=window.getSelection();A&&A.toString().trim()!==""||f.current&&!f.current.contains(S.target)&&(d(!1),n())},[n]);return E.useEffect(()=>(u?document.addEventListener("click",_):document.removeEventListener("click",_),()=>document.removeEventListener("click",_)),[_,u]),v.jsxs("span",{className:"group/editable-field flex gap-2",role:"button",tabIndex:0,onClick:S=>{d(!0),r?.(S)},ref:f,...l,children:[v.jsxs("div",{className:_e("flex flex-1 gap-2",u?"display":"hidden"),children:[a,v.jsx(ot,{label:"Save",variant:at.HOVERABLE,size:qn.ICON_SM,color:it.TEXT,Icon:zs,onClick:p,disabled:s,className:"!text-current"}),v.jsx(ot,{label:"Cancel",color:it.TEXT,variant:at.HOVERABLE,className:"!text-current",size:qn.ICON_SM,Icon:po,onClick:g,disabled:s})]},String(u)),v.jsxs("div",{className:_e("flex flex-1 gap-2",u?"hidden":"display"),children:[v.jsx("span",{className:"ml-2 flex w-full whitespace-pre-wrap p-1 text-sm leading-6",children:y}),v.jsx(ot,{label:"Edit",Icon:N1,color:it.TEXT,variant:at.HOVERABLE,size:qn.ICON_SM,className:"invisible !text-current group-hover/editable-field:visible",disabled:s,onClick:S=>{S.stopPropagation(),d(!0)}})]})]})},YO=({onSave:e,onCancel:t,ref:n,...r})=>{const a=E.useRef(null),s=()=>{e?.(a.current?.value??"")},l=()=>{a.current&&(a.current.value=a.current.defaultValue??""),t?.()};E.useImperativeHandle(n,()=>a.current);const u=E.useMemo(()=>r.value??a.current?.value??r.defaultValue,[r.value,r.defaultValue,a.current?.value]);return v.jsx(ZO,{value:u,onCancel:l,onSave:s,children:v.jsx(Gs,{ref:a,...r})})},rC=24,iC=12,T0=({className:e,autoSize:t=!0,onChange:n,maxRows:r=999,ref:a,...s})=>{const l=E.useRef(null);E.useImperativeHandle(a,()=>l.current);const u=()=>{const p=l.current;if(!p||!t)return;const g=p.style;g.height="auto";const y=p.scrollHeight,_=rC*r+iC,S=rC+iC;g.height=Math.max(Math.min(y,_),S)+"px"};E.useEffect(()=>{u()},[s.value,s.defaultValue,u]);const d=p=>{n?.(p),u()},f=p=>{l.current=p,p&&u()};return v.jsx(WO,{ref:f,onChange:d,className:_e("overflow-y-auto",t?"resize-none":"",e),...s})},XO=({onSave:e,onCancel:t,ref:n,...r})=>{const a=E.useRef(null);E.useImperativeHandle(n,()=>a.current);const s=()=>{e?.(a.current?.value??"")},l=()=>{a.current&&(a.current.value=a.current.defaultValue??""),t?.()},u=r.value??a.current?.value??r.defaultValue??"";return v.jsx(ZO,{value:u,onCancel:l,onSave:s,onClick:d=>{d.preventDefault(),d.stopPropagation()},children:v.jsx(T0,{className:"leading-6",ref:a,onClick:d=>{d.preventDefault(),d.stopPropagation()},...r})})},QO=E.createContext(null),Rh=()=>{const e=E.useContext(QO);if(!e)throw new Error("useMultiSelect must be used within MultiSelectProvider");return e},Dq=({values:e,defaultValues:t,onValueChange:n,loop:r=!1,className:a,children:s,dir:l,...u})=>{const[d,f]=E.useState(t??[]),[p,g]=E.useState(""),[y,_]=E.useState(!1),[S,A]=E.useState(-1),C=E.useRef(null),[w,x]=E.useState(!1),[T,N]=E.useState("");E.useEffect(()=>{e&&f(e)},[e]);const R=E.useCallback(H=>{if(d.includes(H)){const Z=d.filter(q=>q!==H);f(Z),n?.(Z)}else{const Z=[...d,H];f(Z),n?.(Z)}},[d]),I=E.useCallback(H=>{H.preventDefault();const Z=H.currentTarget,q=Z.value.substring(Z.selectionStart??0,Z.selectionEnd??0);N(q),x(q===p)},[p]),D=E.useCallback(H=>{H.stopPropagation();const Z=C.current;if(!Z)return;const q=()=>{const W=S+1;A(W>d.length-1?r?0:-1:W)},te=()=>{const W=S-1;A(W<0?d.length-1:W)},ce=()=>{const W=S-1<=0?d.length-1===0?-1:0:S-1;A(W)};switch(H.key){case"ArrowLeft":l==="rtl"?d.length>0&&(S!==-1||r)&&q():d.length>0&&Z.selectionStart===0&&te();break;case"ArrowRight":l==="rtl"?d.length>0&&Z.selectionStart===0&&te():d.length>0&&(S!==-1||r)&&q();break;case"Backspace":case"Delete":d.length>0&&(S!==-1&&S<d.length?(R(d[S]),ce()):(Z.selectionStart===0&&T===p||w)&&R(d[d.length-1]));break;case"Enter":_(!0);break;case"Escape":S!==-1?A(-1):y&&_(!1);break}},[d,p,S,r]),L=E.useMemo(()=>({value:d,onValueChange:R,open:y,setOpen:_,inputValue:p,setInputValue:g,activeIndex:S,setActiveIndex:A,ref:C,handleSelect:I}),[d,R,y,_,p,g,S,A,C,I]);return v.jsx(QO,{value:L,children:v.jsx(Rk,{onKeyDown:D,className:_e("flex w-full flex-col gap-2 overflow-visible bg-transparent",a),dir:l,...u,children:s})})},jq=({className:e,getBadgeValue:t=s=>s,validationStyleEnabled:n=!1,children:r,...a})=>{const{value:s,onValueChange:l,activeIndex:u}=Rh(),d=E.useCallback(f=>{f.preventDefault(),f.stopPropagation()},[]);return v.jsxs("div",{className:_e("flex w-full flex-col gap-3 rounded-lg p-1 py-2","border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring focus:outline-hidden flex w-full items-center justify-between whitespace-nowrap border px-3 py-2 text-sm focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1","bg-input-background text-input-text w-full select-text resize-none rounded-xl border-2 px-2 py-1 text-sm shadow-none outline-0 transition-all","border-input-border hover:border-input-border-hover focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]","aria-[invalid=true]:border-error",n&&"valid:border-success invalid:border-error",e),...a,children:[s.length>0&&v.jsx("div",{className:"flex w-full flex-wrap gap-1",children:s.map((f,p)=>v.jsxs(WF,{className:_e("flex items-center gap-1 rounded-xl px-1",u===p&&"ring-muted-foreground ring-2"),color:G1.TEXT,children:[v.jsx("span",{className:"text-xs",children:t(f)}),v.jsxs("button",{"aria-label":`Remove ${f} option`,"aria-roledescription":"button to remove option",onMouseDown:d,onClick:()=>l(f),children:[v.jsxs("span",{className:"sr-only",children:["Remove ",f," option"]}),v.jsx(po,{className:"size-4 cursor-pointer"})]})]},f))}),r]})},Lq=({className:e,...t})=>{const{setOpen:n,inputValue:r,setInputValue:a,activeIndex:s,setActiveIndex:l,handleSelect:u,ref:d}=Rh();return v.jsx(jf.Input,{...t,tabIndex:0,ref:d,value:r,onValueChange:s===-1?a:void 0,onSelect:u,onBlur:()=>n(!1),onFocus:()=>n(!0),onClick:()=>l(-1),className:_e("outline-hidden ml-2 flex-1 cursor-pointer",e,s!==-1&&"caret-transparent")})},Pq=({children:e})=>{const{open:t}=Rh();return v.jsx("div",{className:"relative",children:t&&e})},Mq=({className:e,children:t})=>v.jsxs(jf.List,{className:_e("border-muted bg-input-background absolute top-0 z-10 flex w-full flex-col gap-2 rounded-lg border p-2 shadow-md transition-colors",e),children:[t,v.jsx(jf.Empty,{children:v.jsx("span",{className:"text-muted-foreground",children:"No results found"})})]}),zq=({className:e,value:t,children:n,...r})=>{const{value:a,onValueChange:s,setInputValue:l}=Rh(),u=E.useCallback(f=>{f.preventDefault(),f.stopPropagation()},[]),d=a.includes(t);return v.jsxs(jf.Item,{...r,onSelect:()=>{s(t),l("")},className:_e("flex cursor-pointer justify-between rounded-lg px-2 py-1 transition-colors","hover:bg-neutral/10",e,d&&"opacity-50",r.disabled&&"cursor-not-allowed opacity-50"),onMouseDown:u,children:[n,d&&v.jsx(zs,{className:"size-4"})]})},mn=Dq;mn.Trigger=jq;mn.Input=Lq;mn.Content=Pq;mn.List=Mq;mn.Item=zq;const Bq=({className:e,children:t,...n})=>v.jsxs("i",{className:_e("text-xs text-neutral-400",e),...n,children:["ⓘ ",t]}),bv=({htmlFor:e,...t})=>v.jsx("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",htmlFor:e,...t}),Vq=({className:e,...t})=>{const{error:n,formItemId:r}=ma();return v.jsx(bv,{className:_e("mb-2",n&&"text-error",e),htmlFor:r,...t})},Uq=({isRequired:e})=>e?v.jsx("span",{"aria-label":"Asterisk meaning the field is required",children:"*"}):v.jsx(v.Fragment,{}),JO=({children:e,isRequired:t,info:n,htmlFor:r,className:a})=>v.jsxs("div",{className:"ml-1 flex gap-1 align-middle text-base leading-none",children:[e&&v.jsxs(Vq,{htmlFor:r,id:`${r}-label`,className:gh("font-bold",a),children:[e,v.jsx(Uq,{isRequired:t})]}),n&&v.jsx(Bq,{content:n})]});function aC(e,[t,n]){return Math.min(n,Math.max(t,e))}function eI(e){const t=e+"CollectionProvider",[n,r]=tu(t),[a,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=A=>{const{scope:C,children:w}=A,x=Oe.useRef(null),T=Oe.useRef(new Map).current;return v.jsx(a,{scope:C,itemMap:T,collectionRef:x,children:w})};l.displayName=t;const u=e+"CollectionSlot",d=Rs(u),f=Oe.forwardRef((A,C)=>{const{scope:w,children:x}=A,T=s(u,w),N=wt(C,T.collectionRef);return v.jsx(d,{ref:N,children:x})});f.displayName=u;const p=e+"CollectionItemSlot",g="data-radix-collection-item",y=Rs(p),_=Oe.forwardRef((A,C)=>{const{scope:w,children:x,...T}=A,N=Oe.useRef(null),R=wt(C,N),I=s(p,w);return Oe.useEffect(()=>(I.itemMap.set(N,{ref:N,...T}),()=>void I.itemMap.delete(N))),v.jsx(y,{[g]:"",ref:R,children:x})});_.displayName=p;function S(A){const C=s(e+"CollectionConsumer",A);return Oe.useCallback(()=>{const x=C.collectionRef.current;if(!x)return[];const T=Array.from(x.querySelectorAll(`[${g}]`));return Array.from(C.itemMap.values()).sort((I,D)=>T.indexOf(I.ref.current)-T.indexOf(D.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:l,Slot:f,ItemSlot:_},S,r]}var Fq=E.createContext(void 0);function $q(e){const t=E.useContext(Fq);return e||t||"ltr"}const Hq=["top","right","bottom","left"],ca=Math.min,$n=Math.max,Gf=Math.round,Gd=Math.floor,Fr=e=>({x:e,y:e}),Gq={left:"right",right:"left",bottom:"top",top:"bottom"},Kq={start:"end",end:"start"};function _v(e,t,n){return $n(e,ca(t,n))}function bi(e,t){return typeof e=="function"?e(t):e}function _i(e){return e.split("-")[0]}function Ks(e){return e.split("-")[1]}function C0(e){return e==="x"?"y":"x"}function R0(e){return e==="y"?"height":"width"}const qq=new Set(["top","bottom"]);function zr(e){return qq.has(_i(e))?"y":"x"}function k0(e){return C0(zr(e))}function Wq(e,t,n){n===void 0&&(n=!1);const r=Ks(e),a=k0(e),s=R0(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=Kf(l)),[l,Kf(l)]}function Zq(e){const t=Kf(e);return[Ev(e),t,Ev(t)]}function Ev(e){return e.replace(/start|end/g,t=>Kq[t])}const oC=["left","right"],sC=["right","left"],Yq=["top","bottom"],Xq=["bottom","top"];function Qq(e,t,n){switch(e){case"top":case"bottom":return n?t?sC:oC:t?oC:sC;case"left":case"right":return t?Yq:Xq;default:return[]}}function Jq(e,t,n,r){const a=Ks(e);let s=Qq(_i(e),n==="start",r);return a&&(s=s.map(l=>l+"-"+a),t&&(s=s.concat(s.map(Ev)))),s}function Kf(e){return e.replace(/left|right|bottom|top/g,t=>Gq[t])}function e9(e){return{top:0,right:0,bottom:0,left:0,...e}}function tI(e){return typeof e!="number"?e9(e):{top:e,right:e,bottom:e,left:e}}function qf(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function lC(e,t,n){let{reference:r,floating:a}=e;const s=zr(t),l=k0(t),u=R0(l),d=_i(t),f=s==="y",p=r.x+r.width/2-a.width/2,g=r.y+r.height/2-a.height/2,y=r[u]/2-a[u]/2;let _;switch(d){case"top":_={x:p,y:r.y-a.height};break;case"bottom":_={x:p,y:r.y+r.height};break;case"right":_={x:r.x+r.width,y:g};break;case"left":_={x:r.x-a.width,y:g};break;default:_={x:r.x,y:r.y}}switch(Ks(t)){case"start":_[l]-=y*(n&&f?-1:1);break;case"end":_[l]+=y*(n&&f?-1:1);break}return _}const t9=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:s=[],platform:l}=n,u=s.filter(Boolean),d=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:a}),{x:p,y:g}=lC(f,r,d),y=r,_={},S=0;for(let A=0;A<u.length;A++){const{name:C,fn:w}=u[A],{x,y:T,data:N,reset:R}=await w({x:p,y:g,initialPlacement:r,placement:y,strategy:a,middlewareData:_,rects:f,platform:l,elements:{reference:e,floating:t}});p=x??p,g=T??g,_={..._,[C]:{..._[C],...N}},R&&S<=50&&(S++,typeof R=="object"&&(R.placement&&(y=R.placement),R.rects&&(f=R.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:a}):R.rects),{x:p,y:g}=lC(f,y,d)),A=-1)}return{x:p,y:g,placement:y,strategy:a,middlewareData:_}};async function zc(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:s,rects:l,elements:u,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:g="floating",altBoundary:y=!1,padding:_=0}=bi(t,e),S=tI(_),C=u[y?g==="floating"?"reference":"floating":g],w=qf(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(C)))==null||n?C:C.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(u.floating)),boundary:f,rootBoundary:p,strategy:d})),x=g==="floating"?{x:r,y:a,width:l.floating.width,height:l.floating.height}:l.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u.floating)),N=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},R=qf(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:x,offsetParent:T,strategy:d}):x);return{top:(w.top-R.top+S.top)/N.y,bottom:(R.bottom-w.bottom+S.bottom)/N.y,left:(w.left-R.left+S.left)/N.x,right:(R.right-w.right+S.right)/N.x}}const n9=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:s,platform:l,elements:u,middlewareData:d}=t,{element:f,padding:p=0}=bi(e,t)||{};if(f==null)return{};const g=tI(p),y={x:n,y:r},_=k0(a),S=R0(_),A=await l.getDimensions(f),C=_==="y",w=C?"top":"left",x=C?"bottom":"right",T=C?"clientHeight":"clientWidth",N=s.reference[S]+s.reference[_]-y[_]-s.floating[S],R=y[_]-s.reference[_],I=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let D=I?I[T]:0;(!D||!await(l.isElement==null?void 0:l.isElement(I)))&&(D=u.floating[T]||s.floating[S]);const L=N/2-R/2,H=D/2-A[S]/2-1,Z=ca(g[w],H),q=ca(g[x],H),te=Z,ce=D-A[S]-q,W=D/2-A[S]/2+L,ae=_v(te,W,ce),M=!d.arrow&&Ks(a)!=null&&W!==ae&&s.reference[S]/2-(W<te?Z:q)-A[S]/2<0,X=M?W<te?W-te:W-ce:0;return{[_]:y[_]+X,data:{[_]:ae,centerOffset:W-ae-X,...M&&{alignmentOffset:X}},reset:M}}}),r9=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:s,rects:l,initialPlacement:u,platform:d,elements:f}=t,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:_="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:A=!0,...C}=bi(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=_i(a),x=zr(u),T=_i(u)===u,N=await(d.isRTL==null?void 0:d.isRTL(f.floating)),R=y||(T||!A?[Kf(u)]:Zq(u)),I=S!=="none";!y&&I&&R.push(...Jq(u,A,S,N));const D=[u,...R],L=await zc(t,C),H=[];let Z=((r=s.flip)==null?void 0:r.overflows)||[];if(p&&H.push(L[w]),g){const W=Wq(a,l,N);H.push(L[W[0]],L[W[1]])}if(Z=[...Z,{placement:a,overflows:H}],!H.every(W=>W<=0)){var q,te;const W=(((q=s.flip)==null?void 0:q.index)||0)+1,ae=D[W];if(ae&&(!(g==="alignment"?x!==zr(ae):!1)||Z.every(G=>zr(G.placement)===x?G.overflows[0]>0:!0)))return{data:{index:W,overflows:Z},reset:{placement:ae}};let M=(te=Z.filter(X=>X.overflows[0]<=0).sort((X,G)=>X.overflows[1]-G.overflows[1])[0])==null?void 0:te.placement;if(!M)switch(_){case"bestFit":{var ce;const X=(ce=Z.filter(G=>{if(I){const ge=zr(G.placement);return ge===x||ge==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(ge=>ge>0).reduce((ge,P)=>ge+P,0)]).sort((G,ge)=>G[1]-ge[1])[0])==null?void 0:ce[0];X&&(M=X);break}case"initialPlacement":M=u;break}if(a!==M)return{reset:{placement:M}}}return{}}}};function cC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uC(e){return Hq.some(t=>e[t]>=0)}const i9=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=bi(e,t);switch(r){case"referenceHidden":{const s=await zc(t,{...a,elementContext:"reference"}),l=cC(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:uC(l)}}}case"escaped":{const s=await zc(t,{...a,altBoundary:!0}),l=cC(s,n.floating);return{data:{escapedOffsets:l,escaped:uC(l)}}}default:return{}}}}},nI=new Set(["left","top"]);async function a9(e,t){const{placement:n,platform:r,elements:a}=e,s=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=_i(n),u=Ks(n),d=zr(n)==="y",f=nI.has(l)?-1:1,p=s&&d?-1:1,g=bi(t,e);let{mainAxis:y,crossAxis:_,alignmentAxis:S}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof S=="number"&&(_=u==="end"?S*-1:S),d?{x:_*p,y:y*f}:{x:y*f,y:_*p}}const o9=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:s,placement:l,middlewareData:u}=t,d=await a9(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:a+d.x,y:s+d.y,data:{...d,placement:l}}}}},s9=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:u={fn:C=>{let{x:w,y:x}=C;return{x:w,y:x}}},...d}=bi(e,t),f={x:n,y:r},p=await zc(t,d),g=zr(_i(a)),y=C0(g);let _=f[y],S=f[g];if(s){const C=y==="y"?"top":"left",w=y==="y"?"bottom":"right",x=_+p[C],T=_-p[w];_=_v(x,_,T)}if(l){const C=g==="y"?"top":"left",w=g==="y"?"bottom":"right",x=S+p[C],T=S-p[w];S=_v(x,S,T)}const A=u.fn({...t,[y]:_,[g]:S});return{...A,data:{x:A.x-n,y:A.y-r,enabled:{[y]:s,[g]:l}}}}}},l9=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:s,middlewareData:l}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=bi(e,t),p={x:n,y:r},g=zr(a),y=C0(g);let _=p[y],S=p[g];const A=bi(u,t),C=typeof A=="number"?{mainAxis:A,crossAxis:0}:{mainAxis:0,crossAxis:0,...A};if(d){const T=y==="y"?"height":"width",N=s.reference[y]-s.floating[T]+C.mainAxis,R=s.reference[y]+s.reference[T]-C.mainAxis;_<N?_=N:_>R&&(_=R)}if(f){var w,x;const T=y==="y"?"width":"height",N=nI.has(_i(a)),R=s.reference[g]-s.floating[T]+(N&&((w=l.offset)==null?void 0:w[g])||0)+(N?0:C.crossAxis),I=s.reference[g]+s.reference[T]+(N?0:((x=l.offset)==null?void 0:x[g])||0)-(N?C.crossAxis:0);S<R?S=R:S>I&&(S=I)}return{[y]:_,[g]:S}}}},c9=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:s,platform:l,elements:u}=t,{apply:d=()=>{},...f}=bi(e,t),p=await zc(t,f),g=_i(a),y=Ks(a),_=zr(a)==="y",{width:S,height:A}=s.floating;let C,w;g==="top"||g==="bottom"?(C=g,w=y===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(w=g,C=y==="end"?"top":"bottom");const x=A-p.top-p.bottom,T=S-p.left-p.right,N=ca(A-p[C],x),R=ca(S-p[w],T),I=!t.middlewareData.shift;let D=N,L=R;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=x),I&&!y){const Z=$n(p.left,0),q=$n(p.right,0),te=$n(p.top,0),ce=$n(p.bottom,0);_?L=S-2*(Z!==0||q!==0?Z+q:$n(p.left,p.right)):D=A-2*(te!==0||ce!==0?te+ce:$n(p.top,p.bottom))}await d({...t,availableWidth:L,availableHeight:D});const H=await l.getDimensions(u.floating);return S!==H.width||A!==H.height?{reset:{rects:!0}}:{}}}};function kh(){return typeof window<"u"}function qs(e){return rI(e)?(e.nodeName||"").toLowerCase():"#document"}function Wn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function qr(e){var t;return(t=(rI(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function rI(e){return kh()?e instanceof Node||e instanceof Wn(e).Node:!1}function xr(e){return kh()?e instanceof Element||e instanceof Wn(e).Element:!1}function Hr(e){return kh()?e instanceof HTMLElement||e instanceof Wn(e).HTMLElement:!1}function dC(e){return!kh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Wn(e).ShadowRoot}const u9=new Set(["inline","contents"]);function du(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Ar(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!u9.has(a)}const d9=new Set(["table","td","th"]);function f9(e){return d9.has(qs(e))}const h9=[":popover-open",":modal"];function Nh(e){return h9.some(t=>{try{return e.matches(t)}catch{return!1}})}const p9=["transform","translate","scale","rotate","perspective"],m9=["transform","translate","scale","rotate","perspective","filter"],g9=["paint","layout","strict","content"];function N0(e){const t=O0(),n=xr(e)?Ar(e):e;return p9.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||m9.some(r=>(n.willChange||"").includes(r))||g9.some(r=>(n.contain||"").includes(r))}function y9(e){let t=ua(e);for(;Hr(t)&&!Os(t);){if(N0(t))return t;if(Nh(t))return null;t=ua(t)}return null}function O0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const v9=new Set(["html","body","#document"]);function Os(e){return v9.has(qs(e))}function Ar(e){return Wn(e).getComputedStyle(e)}function Oh(e){return xr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ua(e){if(qs(e)==="html")return e;const t=e.assignedSlot||e.parentNode||dC(e)&&e.host||qr(e);return dC(t)?t.host:t}function iI(e){const t=ua(e);return Os(t)?e.ownerDocument?e.ownerDocument.body:e.body:Hr(t)&&du(t)?t:iI(t)}function Bc(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=iI(e),s=a===((r=e.ownerDocument)==null?void 0:r.body),l=Wn(a);if(s){const u=Sv(l);return t.concat(l,l.visualViewport||[],du(a)?a:[],u&&n?Bc(u):[])}return t.concat(a,Bc(a,[],n))}function Sv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function aI(e){const t=Ar(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Hr(e),s=a?e.offsetWidth:n,l=a?e.offsetHeight:r,u=Gf(n)!==s||Gf(r)!==l;return u&&(n=s,r=l),{width:n,height:r,$:u}}function I0(e){return xr(e)?e:e.contextElement}function Ss(e){const t=I0(e);if(!Hr(t))return Fr(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:s}=aI(t);let l=(s?Gf(n.width):n.width)/r,u=(s?Gf(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const b9=Fr(0);function oI(e){const t=Wn(e);return!O0()||!t.visualViewport?b9:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _9(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Wn(e)?!1:t}function so(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),s=I0(e);let l=Fr(1);t&&(r?xr(r)&&(l=Ss(r)):l=Ss(e));const u=_9(s,n,r)?oI(s):Fr(0);let d=(a.left+u.x)/l.x,f=(a.top+u.y)/l.y,p=a.width/l.x,g=a.height/l.y;if(s){const y=Wn(s),_=r&&xr(r)?Wn(r):r;let S=y,A=Sv(S);for(;A&&r&&_!==S;){const C=Ss(A),w=A.getBoundingClientRect(),x=Ar(A),T=w.left+(A.clientLeft+parseFloat(x.paddingLeft))*C.x,N=w.top+(A.clientTop+parseFloat(x.paddingTop))*C.y;d*=C.x,f*=C.y,p*=C.x,g*=C.y,d+=T,f+=N,S=Wn(A),A=Sv(S)}}return qf({width:p,height:g,x:d,y:f})}function Ih(e,t){const n=Oh(e).scrollLeft;return t?t.left+n:so(qr(e)).left+n}function sI(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ih(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function E9(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const s=a==="fixed",l=qr(r),u=t?Nh(t.floating):!1;if(r===l||u&&s)return n;let d={scrollLeft:0,scrollTop:0},f=Fr(1);const p=Fr(0),g=Hr(r);if((g||!g&&!s)&&((qs(r)!=="body"||du(l))&&(d=Oh(r)),Hr(r))){const _=so(r);f=Ss(r),p.x=_.x+r.clientLeft,p.y=_.y+r.clientTop}const y=l&&!g&&!s?sI(l,d):Fr(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+p.x+y.x,y:n.y*f.y-d.scrollTop*f.y+p.y+y.y}}function S9(e){return Array.from(e.getClientRects())}function x9(e){const t=qr(e),n=Oh(e),r=e.ownerDocument.body,a=$n(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=$n(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Ih(e);const u=-n.scrollTop;return Ar(r).direction==="rtl"&&(l+=$n(t.clientWidth,r.clientWidth)-a),{width:a,height:s,x:l,y:u}}const fC=25;function A9(e,t){const n=Wn(e),r=qr(e),a=n.visualViewport;let s=r.clientWidth,l=r.clientHeight,u=0,d=0;if(a){s=a.width,l=a.height;const p=O0();(!p||p&&t==="fixed")&&(u=a.offsetLeft,d=a.offsetTop)}const f=Ih(r);if(f<=0){const p=r.ownerDocument,g=p.body,y=getComputedStyle(g),_=p.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,S=Math.abs(r.clientWidth-g.clientWidth-_);S<=fC&&(s-=S)}else f<=fC&&(s+=f);return{width:s,height:l,x:u,y:d}}const w9=new Set(["absolute","fixed"]);function T9(e,t){const n=so(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,s=Hr(e)?Ss(e):Fr(1),l=e.clientWidth*s.x,u=e.clientHeight*s.y,d=a*s.x,f=r*s.y;return{width:l,height:u,x:d,y:f}}function hC(e,t,n){let r;if(t==="viewport")r=A9(e,n);else if(t==="document")r=x9(qr(e));else if(xr(t))r=T9(t,n);else{const a=oI(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return qf(r)}function lI(e,t){const n=ua(e);return n===t||!xr(n)||Os(n)?!1:Ar(n).position==="fixed"||lI(n,t)}function C9(e,t){const n=t.get(e);if(n)return n;let r=Bc(e,[],!1).filter(u=>xr(u)&&qs(u)!=="body"),a=null;const s=Ar(e).position==="fixed";let l=s?ua(e):e;for(;xr(l)&&!Os(l);){const u=Ar(l),d=N0(l);!d&&u.position==="fixed"&&(a=null),(s?!d&&!a:!d&&u.position==="static"&&!!a&&w9.has(a.position)||du(l)&&!d&&lI(e,l))?r=r.filter(p=>p!==l):a=u,l=ua(l)}return t.set(e,r),r}function R9(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?Nh(t)?[]:C9(t,this._c):[].concat(n),r],u=l[0],d=l.reduce((f,p)=>{const g=hC(t,p,a);return f.top=$n(g.top,f.top),f.right=ca(g.right,f.right),f.bottom=ca(g.bottom,f.bottom),f.left=$n(g.left,f.left),f},hC(t,u,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function k9(e){const{width:t,height:n}=aI(e);return{width:t,height:n}}function N9(e,t,n){const r=Hr(t),a=qr(t),s=n==="fixed",l=so(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const d=Fr(0);function f(){d.x=Ih(a)}if(r||!r&&!s)if((qs(t)!=="body"||du(a))&&(u=Oh(t)),r){const _=so(t,!0,s,t);d.x=_.x+t.clientLeft,d.y=_.y+t.clientTop}else a&&f();s&&!r&&a&&f();const p=a&&!r&&!s?sI(a,u):Fr(0),g=l.left+u.scrollLeft-d.x-p.x,y=l.top+u.scrollTop-d.y-p.y;return{x:g,y,width:l.width,height:l.height}}function ay(e){return Ar(e).position==="static"}function pC(e,t){if(!Hr(e)||Ar(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return qr(e)===n&&(n=n.ownerDocument.body),n}function cI(e,t){const n=Wn(e);if(Nh(e))return n;if(!Hr(e)){let a=ua(e);for(;a&&!Os(a);){if(xr(a)&&!ay(a))return a;a=ua(a)}return n}let r=pC(e,t);for(;r&&f9(r)&&ay(r);)r=pC(r,t);return r&&Os(r)&&ay(r)&&!N0(r)?n:r||y9(e)||n}const O9=async function(e){const t=this.getOffsetParent||cI,n=this.getDimensions,r=await n(e.floating);return{reference:N9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function I9(e){return Ar(e).direction==="rtl"}const D9={convertOffsetParentRelativeRectToViewportRelativeRect:E9,getDocumentElement:qr,getClippingRect:R9,getOffsetParent:cI,getElementRects:O9,getClientRects:S9,getDimensions:k9,getScale:Ss,isElement:xr,isRTL:I9};function uI(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function j9(e,t){let n=null,r;const a=qr(e);function s(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),s();const f=e.getBoundingClientRect(),{left:p,top:g,width:y,height:_}=f;if(u||t(),!y||!_)return;const S=Gd(g),A=Gd(a.clientWidth-(p+y)),C=Gd(a.clientHeight-(g+_)),w=Gd(p),T={rootMargin:-S+"px "+-A+"px "+-C+"px "+-w+"px",threshold:$n(0,ca(1,d))||1};let N=!0;function R(I){const D=I[0].intersectionRatio;if(D!==d){if(!N)return l();D?l(!1,D):r=setTimeout(()=>{l(!1,1e-7)},1e3)}D===1&&!uI(f,e.getBoundingClientRect())&&l(),N=!1}try{n=new IntersectionObserver(R,{...T,root:a.ownerDocument})}catch{n=new IntersectionObserver(R,T)}n.observe(e)}return l(!0),s}function L9(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,f=I0(e),p=a||s?[...f?Bc(f):[],...Bc(t)]:[];p.forEach(w=>{a&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const g=f&&u?j9(f,n):null;let y=-1,_=null;l&&(_=new ResizeObserver(w=>{let[x]=w;x&&x.target===f&&_&&(_.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var T;(T=_)==null||T.observe(t)})),n()}),f&&!d&&_.observe(f),_.observe(t));let S,A=d?so(e):null;d&&C();function C(){const w=so(e);A&&!uI(A,w)&&n(),A=w,S=requestAnimationFrame(C)}return n(),()=>{var w;p.forEach(x=>{a&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),g?.(),(w=_)==null||w.disconnect(),_=null,d&&cancelAnimationFrame(S)}}const P9=o9,M9=s9,z9=r9,B9=c9,V9=i9,mC=n9,U9=l9,F9=(e,t,n)=>{const r=new Map,a={platform:D9,...n},s={...a.platform,_c:r};return t9(e,t,{...a,platform:s})};var $9=typeof document<"u",H9=function(){},_f=$9?E.useLayoutEffect:H9;function Wf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Wf(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const s=a[r];if(!(s==="_owner"&&e.$$typeof)&&!Wf(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function dI(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gC(e,t){const n=dI(e);return Math.round(t*n)/n}function oy(e){const t=E.useRef(e);return _f(()=>{t.current=e}),t}function G9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:s,floating:l}={},transform:u=!0,whileElementsMounted:d,open:f}=e,[p,g]=E.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,_]=E.useState(r);Wf(y,r)||_(r);const[S,A]=E.useState(null),[C,w]=E.useState(null),x=E.useCallback(G=>{G!==I.current&&(I.current=G,A(G))},[]),T=E.useCallback(G=>{G!==D.current&&(D.current=G,w(G))},[]),N=s||S,R=l||C,I=E.useRef(null),D=E.useRef(null),L=E.useRef(p),H=d!=null,Z=oy(d),q=oy(a),te=oy(f),ce=E.useCallback(()=>{if(!I.current||!D.current)return;const G={placement:t,strategy:n,middleware:y};q.current&&(G.platform=q.current),F9(I.current,D.current,G).then(ge=>{const P={...ge,isPositioned:te.current!==!1};W.current&&!Wf(L.current,P)&&(L.current=P,ho.flushSync(()=>{g(P)}))})},[y,t,n,q,te]);_f(()=>{f===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,g(G=>({...G,isPositioned:!1})))},[f]);const W=E.useRef(!1);_f(()=>(W.current=!0,()=>{W.current=!1}),[]),_f(()=>{if(N&&(I.current=N),R&&(D.current=R),N&&R){if(Z.current)return Z.current(N,R,ce);ce()}},[N,R,ce,Z,H]);const ae=E.useMemo(()=>({reference:I,floating:D,setReference:x,setFloating:T}),[x,T]),M=E.useMemo(()=>({reference:N,floating:R}),[N,R]),X=E.useMemo(()=>{const G={position:n,left:0,top:0};if(!M.floating)return G;const ge=gC(M.floating,p.x),P=gC(M.floating,p.y);return u?{...G,transform:"translate("+ge+"px, "+P+"px)",...dI(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ge,top:P}},[n,u,M.floating,p.x,p.y]);return E.useMemo(()=>({...p,update:ce,refs:ae,elements:M,floatingStyles:X}),[p,ce,ae,M,X])}const K9=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?mC({element:r.current,padding:a}).fn(n):{}:r?mC({element:r,padding:a}).fn(n):{}}}},q9=(e,t)=>({...P9(e),options:[e,t]}),W9=(e,t)=>({...M9(e),options:[e,t]}),Z9=(e,t)=>({...U9(e),options:[e,t]}),Y9=(e,t)=>({...z9(e),options:[e,t]}),X9=(e,t)=>({...B9(e),options:[e,t]}),Q9=(e,t)=>({...V9(e),options:[e,t]}),J9=(e,t)=>({...K9(e),options:[e,t]});var e7="Arrow",fI=E.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...s}=e;return v.jsx(He.svg,{...s,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:v.jsx("polygon",{points:"0,0 30,0 15,10"})})});fI.displayName=e7;var t7=fI;function n7(e){const[t,n]=E.useState(void 0);return ln(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const s=a[0];let l,u;if("borderBoxSize"in s){const d=s.borderBoxSize,f=Array.isArray(d)?d[0]:d;l=f.inlineSize,u=f.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var D0="Popper",[hI,pI]=tu(D0),[r7,mI]=hI(D0),gI=e=>{const{__scopePopper:t,children:n}=e,[r,a]=E.useState(null);return v.jsx(r7,{scope:t,anchor:r,onAnchorChange:a,children:n})};gI.displayName=D0;var yI="PopperAnchor",vI=E.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,s=mI(yI,n),l=E.useRef(null),u=wt(t,l),d=E.useRef(null);return E.useEffect(()=>{const f=d.current;d.current=r?.current||l.current,f!==d.current&&s.onAnchorChange(d.current)}),r?null:v.jsx(He.div,{...a,ref:u})});vI.displayName=yI;var j0="PopperContent",[i7,a7]=hI(j0),bI=E.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:s="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:_="optimized",onPlaced:S,...A}=e,C=mI(j0,n),[w,x]=E.useState(null),T=wt(t,fe=>x(fe)),[N,R]=E.useState(null),I=n7(N),D=I?.width??0,L=I?.height??0,H=r+(s!=="center"?"-"+s:""),Z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},q=Array.isArray(f)?f:[f],te=q.length>0,ce={padding:Z,boundary:q.filter(s7),altBoundary:te},{refs:W,floatingStyles:ae,placement:M,isPositioned:X,middlewareData:G}=G9({strategy:"fixed",placement:H,whileElementsMounted:(...fe)=>L9(...fe,{animationFrame:_==="always"}),elements:{reference:C.anchor},middleware:[q9({mainAxis:a+L,alignmentAxis:l}),d&&W9({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?Z9():void 0,...ce}),d&&Y9({...ce}),X9({...ce,apply:({elements:fe,rects:xe,availableWidth:je,availableHeight:Be})=>{const{width:Ye,height:et}=xe.reference,Zt=fe.floating.style;Zt.setProperty("--radix-popper-available-width",`${je}px`),Zt.setProperty("--radix-popper-available-height",`${Be}px`),Zt.setProperty("--radix-popper-anchor-width",`${Ye}px`),Zt.setProperty("--radix-popper-anchor-height",`${et}px`)}}),N&&J9({element:N,padding:u}),l7({arrowWidth:D,arrowHeight:L}),y&&Q9({strategy:"referenceHidden",...ce})]}),[ge,P]=SI(M),ie=Sr(S);ln(()=>{X&&ie?.()},[X,ie]);const F=G.arrow?.x,J=G.arrow?.y,se=G.arrow?.centerOffset!==0,[he,ye]=E.useState();return ln(()=>{w&&ye(window.getComputedStyle(w).zIndex)},[w]),v.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...ae,transform:X?ae.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[G.transformOrigin?.x,G.transformOrigin?.y].join(" "),...G.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:v.jsx(i7,{scope:n,placedSide:ge,onArrowChange:R,arrowX:F,arrowY:J,shouldHideArrow:se,children:v.jsx(He.div,{"data-side":ge,"data-align":P,...A,ref:T,style:{...A.style,animation:X?void 0:"none"}})})})});bI.displayName=j0;var _I="PopperArrow",o7={top:"bottom",right:"left",bottom:"top",left:"right"},EI=E.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,s=a7(_I,r),l=o7[s.placedSide];return v.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:v.jsx(t7,{...a,ref:n,style:{...a.style,display:"block"}})})});EI.displayName=_I;function s7(e){return e!==null}var l7=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:a}=t,l=a.arrow?.centerOffset!==0,u=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[f,p]=SI(n),g={start:"0%",center:"50%",end:"100%"}[p],y=(a.arrow?.x??0)+u/2,_=(a.arrow?.y??0)+d/2;let S="",A="";return f==="bottom"?(S=l?g:`${y}px`,A=`${-d}px`):f==="top"?(S=l?g:`${y}px`,A=`${r.floating.height+d}px`):f==="right"?(S=`${-d}px`,A=l?g:`${_}px`):f==="left"&&(S=`${r.floating.width+d}px`,A=l?g:`${_}px`),{data:{x:S,y:A}}}});function SI(e){const[t,n="center"]=e.split("-");return[t,n]}var c7=gI,u7=vI,d7=bI,f7=EI;function h7(e){const t=E.useRef({value:e,previous:e});return E.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var xI=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"}),p7="VisuallyHidden",L0=E.forwardRef((e,t)=>v.jsx(He.span,{...e,ref:t,style:{...xI,...e.style}}));L0.displayName=p7;var m7=[" ","Enter","ArrowUp","ArrowDown"],g7=[" ","Enter"],lo="Select",[Dh,jh,y7]=eI(lo),[Ws]=tu(lo,[y7,pI]),Lh=pI(),[v7,ga]=Ws(lo),[b7,_7]=Ws(lo),AI=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:s,value:l,defaultValue:u,onValueChange:d,dir:f,name:p,autoComplete:g,disabled:y,required:_,form:S}=e,A=Lh(t),[C,w]=E.useState(null),[x,T]=E.useState(null),[N,R]=E.useState(!1),I=$q(f),[D,L]=If({prop:r,defaultProp:a??!1,onChange:s,caller:lo}),[H,Z]=If({prop:l,defaultProp:u,onChange:d,caller:lo}),q=E.useRef(null),te=C?S||!!C.closest("form"):!0,[ce,W]=E.useState(new Set),ae=Array.from(ce).map(M=>M.props.value).join(";");return v.jsx(c7,{...A,children:v.jsxs(v7,{required:_,scope:t,trigger:C,onTriggerChange:w,valueNode:x,onValueNodeChange:T,valueNodeHasChildren:N,onValueNodeHasChildrenChange:R,contentId:ur(),value:H,onValueChange:Z,open:D,onOpenChange:L,dir:I,triggerPointerDownPosRef:q,disabled:y,children:[v.jsx(Dh.Provider,{scope:t,children:v.jsx(b7,{scope:e.__scopeSelect,onNativeOptionAdd:E.useCallback(M=>{W(X=>new Set(X).add(M))},[]),onNativeOptionRemove:E.useCallback(M=>{W(X=>{const G=new Set(X);return G.delete(M),G})},[]),children:n})}),te?v.jsxs(ZI,{"aria-hidden":!0,required:_,tabIndex:-1,name:p,autoComplete:g,value:H,onChange:M=>Z(M.target.value),disabled:y,form:S,children:[H===void 0?v.jsx("option",{value:""}):null,Array.from(ce)]},ae):null]})})};AI.displayName=lo;var wI="SelectTrigger",TI=E.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,s=Lh(n),l=ga(wI,n),u=l.disabled||r,d=wt(t,l.onTriggerChange),f=jh(n),p=E.useRef("touch"),[g,y,_]=XI(A=>{const C=f().filter(T=>!T.disabled),w=C.find(T=>T.value===l.value),x=QI(C,A,w);x!==void 0&&l.onValueChange(x.value)}),S=A=>{u||(l.onOpenChange(!0),_()),A&&(l.triggerPointerDownPosRef.current={x:Math.round(A.pageX),y:Math.round(A.pageY)})};return v.jsx(u7,{asChild:!0,...s,children:v.jsx(He.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":YI(l.value)?"":void 0,...a,ref:d,onClick:Qe(a.onClick,A=>{A.currentTarget.focus(),p.current!=="mouse"&&S(A)}),onPointerDown:Qe(a.onPointerDown,A=>{p.current=A.pointerType;const C=A.target;C.hasPointerCapture(A.pointerId)&&C.releasePointerCapture(A.pointerId),A.button===0&&A.ctrlKey===!1&&A.pointerType==="mouse"&&(S(A),A.preventDefault())}),onKeyDown:Qe(a.onKeyDown,A=>{const C=g.current!=="";!(A.ctrlKey||A.altKey||A.metaKey)&&A.key.length===1&&y(A.key),!(C&&A.key===" ")&&m7.includes(A.key)&&(S(),A.preventDefault())})})})});TI.displayName=wI;var CI="SelectValue",RI=E.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:s,placeholder:l="",...u}=e,d=ga(CI,n),{onValueNodeHasChildrenChange:f}=d,p=s!==void 0,g=wt(t,d.onValueNodeChange);return ln(()=>{f(p)},[f,p]),v.jsx(He.span,{...u,ref:g,style:{pointerEvents:"none"},children:YI(d.value)?v.jsx(v.Fragment,{children:l}):s})});RI.displayName=CI;var E7="SelectIcon",kI=E.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return v.jsx(He.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});kI.displayName=E7;var S7="SelectPortal",NI=e=>v.jsx(vh,{asChild:!0,...e});NI.displayName=S7;var co="SelectContent",OI=E.forwardRef((e,t)=>{const n=ga(co,e.__scopeSelect),[r,a]=E.useState();if(ln(()=>{a(new DocumentFragment)},[]),!n.open){const s=r;return s?ho.createPortal(v.jsx(II,{scope:e.__scopeSelect,children:v.jsx(Dh.Slot,{scope:e.__scopeSelect,children:v.jsx("div",{children:e.children})})}),s):null}return v.jsx(DI,{...e,ref:t})});OI.displayName=co;var vr=10,[II,ya]=Ws(co),x7="SelectContentImpl",A7=Rs("SelectContent.RemoveScroll"),DI=E.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:l,side:u,sideOffset:d,align:f,alignOffset:p,arrowPadding:g,collisionBoundary:y,collisionPadding:_,sticky:S,hideWhenDetached:A,avoidCollisions:C,...w}=e,x=ga(co,n),[T,N]=E.useState(null),[R,I]=E.useState(null),D=wt(t,fe=>N(fe)),[L,H]=E.useState(null),[Z,q]=E.useState(null),te=jh(n),[ce,W]=E.useState(!1),ae=E.useRef(!1);E.useEffect(()=>{if(T)return sk(T)},[T]),Q1();const M=E.useCallback(fe=>{const[xe,...je]=te().map(et=>et.ref.current),[Be]=je.slice(-1),Ye=document.activeElement;for(const et of fe)if(et===Ye||(et?.scrollIntoView({block:"nearest"}),et===xe&&R&&(R.scrollTop=0),et===Be&&R&&(R.scrollTop=R.scrollHeight),et?.focus(),document.activeElement!==Ye))return},[te,R]),X=E.useCallback(()=>M([L,T]),[M,L,T]);E.useEffect(()=>{ce&&X()},[ce,X]);const{onOpenChange:G,triggerPointerDownPosRef:ge}=x;E.useEffect(()=>{if(T){let fe={x:0,y:0};const xe=Be=>{fe={x:Math.abs(Math.round(Be.pageX)-(ge.current?.x??0)),y:Math.abs(Math.round(Be.pageY)-(ge.current?.y??0))}},je=Be=>{fe.x<=10&&fe.y<=10?Be.preventDefault():T.contains(Be.target)||G(!1),document.removeEventListener("pointermove",xe),ge.current=null};return ge.current!==null&&(document.addEventListener("pointermove",xe),document.addEventListener("pointerup",je,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",je,{capture:!0})}}},[T,G,ge]),E.useEffect(()=>{const fe=()=>G(!1);return window.addEventListener("blur",fe),window.addEventListener("resize",fe),()=>{window.removeEventListener("blur",fe),window.removeEventListener("resize",fe)}},[G]);const[P,ie]=XI(fe=>{const xe=te().filter(Ye=>!Ye.disabled),je=xe.find(Ye=>Ye.ref.current===document.activeElement),Be=QI(xe,fe,je);Be&&setTimeout(()=>Be.ref.current.focus())}),F=E.useCallback((fe,xe,je)=>{const Be=!ae.current&&!je;(x.value!==void 0&&x.value===xe||Be)&&(H(fe),Be&&(ae.current=!0))},[x.value]),J=E.useCallback(()=>T?.focus(),[T]),se=E.useCallback((fe,xe,je)=>{const Be=!ae.current&&!je;(x.value!==void 0&&x.value===xe||Be)&&q(fe)},[x.value]),he=r==="popper"?xv:jI,ye=he===xv?{side:u,sideOffset:d,align:f,alignOffset:p,arrowPadding:g,collisionBoundary:y,collisionPadding:_,sticky:S,hideWhenDetached:A,avoidCollisions:C}:{};return v.jsx(II,{scope:n,content:T,viewport:R,onViewportChange:I,itemRefCallback:F,selectedItem:L,onItemLeave:J,itemTextRefCallback:se,focusSelectedItem:X,selectedItemText:Z,position:r,isPositioned:ce,searchRef:P,children:v.jsx(Eb,{as:A7,allowPinchZoom:!0,children:v.jsx(_b,{asChild:!0,trapped:x.open,onMountAutoFocus:fe=>{fe.preventDefault()},onUnmountAutoFocus:Qe(a,fe=>{x.trigger?.focus({preventScroll:!0}),fe.preventDefault()}),children:v.jsx(yh,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:fe=>fe.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:v.jsx(he,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:fe=>fe.preventDefault(),...w,...ye,onPlaced:()=>W(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:Qe(w.onKeyDown,fe=>{const xe=fe.ctrlKey||fe.altKey||fe.metaKey;if(fe.key==="Tab"&&fe.preventDefault(),!xe&&fe.key.length===1&&ie(fe.key),["ArrowUp","ArrowDown","Home","End"].includes(fe.key)){let Be=te().filter(Ye=>!Ye.disabled).map(Ye=>Ye.ref.current);if(["ArrowUp","End"].includes(fe.key)&&(Be=Be.slice().reverse()),["ArrowUp","ArrowDown"].includes(fe.key)){const Ye=fe.target,et=Be.indexOf(Ye);Be=Be.slice(et+1)}setTimeout(()=>M(Be)),fe.preventDefault()}})})})})})})});DI.displayName=x7;var w7="SelectItemAlignedPosition",jI=E.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,s=ga(co,n),l=ya(co,n),[u,d]=E.useState(null),[f,p]=E.useState(null),g=wt(t,D=>p(D)),y=jh(n),_=E.useRef(!1),S=E.useRef(!0),{viewport:A,selectedItem:C,selectedItemText:w,focusSelectedItem:x}=l,T=E.useCallback(()=>{if(s.trigger&&s.valueNode&&u&&f&&A&&C&&w){const D=s.trigger.getBoundingClientRect(),L=f.getBoundingClientRect(),H=s.valueNode.getBoundingClientRect(),Z=w.getBoundingClientRect();if(s.dir!=="rtl"){const Ye=Z.left-L.left,et=H.left-Ye,Zt=D.left-et,An=D.width+Zt,Ai=Math.max(An,L.width),Sa=window.innerWidth-vr,un=aC(et,[vr,Math.max(vr,Sa-Ai)]);u.style.minWidth=An+"px",u.style.left=un+"px"}else{const Ye=L.right-Z.right,et=window.innerWidth-H.right-Ye,Zt=window.innerWidth-D.right-et,An=D.width+Zt,Ai=Math.max(An,L.width),Sa=window.innerWidth-vr,un=aC(et,[vr,Math.max(vr,Sa-Ai)]);u.style.minWidth=An+"px",u.style.right=un+"px"}const q=y(),te=window.innerHeight-vr*2,ce=A.scrollHeight,W=window.getComputedStyle(f),ae=parseInt(W.borderTopWidth,10),M=parseInt(W.paddingTop,10),X=parseInt(W.borderBottomWidth,10),G=parseInt(W.paddingBottom,10),ge=ae+M+ce+G+X,P=Math.min(C.offsetHeight*5,ge),ie=window.getComputedStyle(A),F=parseInt(ie.paddingTop,10),J=parseInt(ie.paddingBottom,10),se=D.top+D.height/2-vr,he=te-se,ye=C.offsetHeight/2,fe=C.offsetTop+ye,xe=ae+M+fe,je=ge-xe;if(xe<=se){const Ye=q.length>0&&C===q[q.length-1].ref.current;u.style.bottom="0px";const et=f.clientHeight-A.offsetTop-A.offsetHeight,Zt=Math.max(he,ye+(Ye?J:0)+et+X),An=xe+Zt;u.style.height=An+"px"}else{const Ye=q.length>0&&C===q[0].ref.current;u.style.top="0px";const Zt=Math.max(se,ae+A.offsetTop+(Ye?F:0)+ye)+je;u.style.height=Zt+"px",A.scrollTop=xe-se+A.offsetTop}u.style.margin=`${vr}px 0`,u.style.minHeight=P+"px",u.style.maxHeight=te+"px",r?.(),requestAnimationFrame(()=>_.current=!0)}},[y,s.trigger,s.valueNode,u,f,A,C,w,s.dir,r]);ln(()=>T(),[T]);const[N,R]=E.useState();ln(()=>{f&&R(window.getComputedStyle(f).zIndex)},[f]);const I=E.useCallback(D=>{D&&S.current===!0&&(T(),x?.(),S.current=!1)},[T,x]);return v.jsx(C7,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:_,onScrollButtonChange:I,children:v.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:v.jsx(He.div,{...a,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});jI.displayName=w7;var T7="SelectPopperPosition",xv=E.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=vr,...s}=e,l=Lh(n);return v.jsx(d7,{...l,...s,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...s.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)"}})});xv.displayName=T7;var[C7,P0]=Ws(co,{}),Av="SelectViewport",LI=E.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...a}=e,s=ya(Av,n),l=P0(Av,n),u=wt(t,s.onViewportChange),d=E.useRef(0);return v.jsxs(v.Fragment,{children:[v.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:r}),v.jsx(Dh.Slot,{scope:n,children:v.jsx(He.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Qe(a.onScroll,f=>{const p=f.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:y}=l;if(y?.current&&g){const _=Math.abs(d.current-p.scrollTop);if(_>0){const S=window.innerHeight-vr*2,A=parseFloat(g.style.minHeight),C=parseFloat(g.style.height),w=Math.max(A,C);if(w<S){const x=w+_,T=Math.min(S,x),N=x-T;g.style.height=T+"px",g.style.bottom==="0px"&&(p.scrollTop=N>0?N:0,g.style.justifyContent="flex-end")}}}d.current=p.scrollTop})})})]})});LI.displayName=Av;var PI="SelectGroup",[R7,k7]=Ws(PI),MI=E.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=ur();return v.jsx(R7,{scope:n,id:a,children:v.jsx(He.div,{role:"group","aria-labelledby":a,...r,ref:t})})});MI.displayName=PI;var zI="SelectLabel",BI=E.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=k7(zI,n);return v.jsx(He.div,{id:a.id,...r,ref:t})});BI.displayName=zI;var Zf="SelectItem",[N7,VI]=Ws(Zf),UI=E.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:s,...l}=e,u=ga(Zf,n),d=ya(Zf,n),f=u.value===r,[p,g]=E.useState(s??""),[y,_]=E.useState(!1),S=wt(t,x=>d.itemRefCallback?.(x,r,a)),A=ur(),C=E.useRef("touch"),w=()=>{a||(u.onValueChange(r),u.onOpenChange(!1))};if(r==="")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 v.jsx(N7,{scope:n,value:r,disabled:a,textId:A,isSelected:f,onItemTextChange:E.useCallback(x=>{g(T=>T||(x?.textContent??"").trim())},[]),children:v.jsx(Dh.ItemSlot,{scope:n,value:r,disabled:a,textValue:p,children:v.jsx(He.div,{role:"option","aria-labelledby":A,"data-highlighted":y?"":void 0,"aria-selected":f&&y,"data-state":f?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:S,onFocus:Qe(l.onFocus,()=>_(!0)),onBlur:Qe(l.onBlur,()=>_(!1)),onClick:Qe(l.onClick,()=>{C.current!=="mouse"&&w()}),onPointerUp:Qe(l.onPointerUp,()=>{C.current==="mouse"&&w()}),onPointerDown:Qe(l.onPointerDown,x=>{C.current=x.pointerType}),onPointerMove:Qe(l.onPointerMove,x=>{C.current=x.pointerType,a?d.onItemLeave?.():C.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Qe(l.onPointerLeave,x=>{x.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Qe(l.onKeyDown,x=>{d.searchRef?.current!==""&&x.key===" "||(g7.includes(x.key)&&w(),x.key===" "&&x.preventDefault())})})})})});UI.displayName=Zf;var hc="SelectItemText",FI=E.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...s}=e,l=ga(hc,n),u=ya(hc,n),d=VI(hc,n),f=_7(hc,n),[p,g]=E.useState(null),y=wt(t,w=>g(w),d.onItemTextChange,w=>u.itemTextRefCallback?.(w,d.value,d.disabled)),_=p?.textContent,S=E.useMemo(()=>v.jsx("option",{value:d.value,disabled:d.disabled,children:_},d.value),[d.disabled,d.value,_]),{onNativeOptionAdd:A,onNativeOptionRemove:C}=f;return ln(()=>(A(S),()=>C(S)),[A,C,S]),v.jsxs(v.Fragment,{children:[v.jsx(He.span,{id:d.textId,...s,ref:y}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?ho.createPortal(s.children,l.valueNode):null]})});FI.displayName=hc;var $I="SelectItemIndicator",HI=E.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return VI($I,n).isSelected?v.jsx(He.span,{"aria-hidden":!0,...r,ref:t}):null});HI.displayName=$I;var wv="SelectScrollUpButton",GI=E.forwardRef((e,t)=>{const n=ya(wv,e.__scopeSelect),r=P0(wv,e.__scopeSelect),[a,s]=E.useState(!1),l=wt(t,r.onScrollButtonChange);return ln(()=>{if(n.viewport&&n.isPositioned){let u=function(){const f=d.scrollTop>0;s(f)};const d=n.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),a?v.jsx(qI,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=n;u&&d&&(u.scrollTop=u.scrollTop-d.offsetHeight)}}):null});GI.displayName=wv;var Tv="SelectScrollDownButton",KI=E.forwardRef((e,t)=>{const n=ya(Tv,e.__scopeSelect),r=P0(Tv,e.__scopeSelect),[a,s]=E.useState(!1),l=wt(t,r.onScrollButtonChange);return ln(()=>{if(n.viewport&&n.isPositioned){let u=function(){const f=d.scrollHeight-d.clientHeight,p=Math.ceil(d.scrollTop)<f;s(p)};const d=n.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),a?v.jsx(qI,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=n;u&&d&&(u.scrollTop=u.scrollTop+d.offsetHeight)}}):null});KI.displayName=Tv;var qI=E.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=e,s=ya("SelectScrollButton",n),l=E.useRef(null),u=jh(n),d=E.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return E.useEffect(()=>()=>d(),[d]),ln(()=>{u().find(p=>p.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[u]),v.jsx(He.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Qe(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Qe(a.onPointerMove,()=>{s.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Qe(a.onPointerLeave,()=>{d()})})}),O7="SelectSeparator",WI=E.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return v.jsx(He.div,{"aria-hidden":!0,...r,ref:t})});WI.displayName=O7;var Cv="SelectArrow",I7=E.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Lh(n),s=ga(Cv,n),l=ya(Cv,n);return s.open&&l.position==="popper"?v.jsx(f7,{...a,...r,ref:t}):null});I7.displayName=Cv;var D7="SelectBubbleInput",ZI=E.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const a=E.useRef(null),s=wt(r,a),l=h7(t);return E.useEffect(()=>{const u=a.current;if(!u)return;const d=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==t&&p){const g=new Event("change",{bubbles:!0});p.call(u,t),u.dispatchEvent(g)}},[l,t]),v.jsx(He.select,{...n,style:{...xI,...n.style},ref:s,defaultValue:t})});ZI.displayName=D7;function YI(e){return e===""||e===void 0}function XI(e){const t=Sr(e),n=E.useRef(""),r=E.useRef(0),a=E.useCallback(l=>{const u=n.current+l;t(u),(function d(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>d(""),1e3))})(u)},[t]),s=E.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,s]}function QI(e,t,n){const a=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let l=j7(e,Math.max(s,0));a.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.textValue.toLowerCase().startsWith(a.toLowerCase()));return d!==n?d:void 0}function j7(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var L7=AI,P7=TI,M7=RI,z7=kI,B7=NI,V7=OI,U7=LI,F7=MI,$7=BI,H7=UI,G7=FI,K7=HI,q7=GI,W7=KI,Z7=WI;const Y7=L7,X7=F7,Q7=M7,J7=({validationStyleEnabled:e=!1,className:t,children:n,...r})=>v.jsxs(P7,{className:_e("border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring focus:outline-hidden flex w-full items-center justify-between whitespace-nowrap rounded-md border px-3 py-2 text-sm focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1","bg-input-background text-input-text w-full select-text resize-none rounded-xl border-2 px-2 py-1 text-sm shadow-none outline-0 transition-all","border-input-border hover:border-input-border-hover focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]","aria-[invalid=true]:border-error",e&&"valid:border-success invalid:border-error",t),...r,children:[n,v.jsx(z7,{asChild:!0,children:v.jsx(M2,{className:"size-4 opacity-50"})})]}),JI=({className:e,...t})=>v.jsx(q7,{className:_e("flex cursor-default items-center justify-center py-1",e),...t,children:v.jsx(L2,{})}),eD=({className:e,...t})=>v.jsx(W7,{className:_e("flex cursor-default items-center justify-center py-1",e),...t,children:v.jsx(k1,{})}),eW=({className:e,children:t,position:n="popper",...r})=>v.jsx(B7,{children:v.jsxs(V7,{className:_e("bg-input-background text-input-text w-full select-text resize-none rounded-xl border-2 p-1 text-sm shadow-none outline-0 transition-all","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-96 min-w-[8rem] overflow-hidden border shadow-md",n==="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:n,...r,children:[v.jsx(JI,{}),v.jsx(U7,{className:_e("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),v.jsx(eD,{})]})}),tW=({className:e,...t})=>v.jsx($7,{className:_e("px-1 py-0.5 text-sm font-semibold",e),...t}),nW=({className:e,children:t,...n})=>v.jsxs(H7,{className:_e("focus:bg-neutral/10 outline-hidden relative flex w-full cursor-pointer select-none items-center rounded-lg py-1.5 pl-2 pr-8 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[v.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:v.jsx(K7,{children:v.jsx(zs,{className:"size-4"})})}),v.jsx(G7,{children:t})]}),rW=({className:e,...t})=>v.jsx(Z7,{className:_e("-mx-1 my-1 h-px bg-red-300",e),...t}),Re=Y7;Re.Group=X7;Re.Value=Q7;Re.Trigger=J7;Re.ScrollUpButton=JI;Re.ScrollDownButton=eD;Re.Content=eW;Re.Label=tW;Re.Item=nW;Re.Separator=rW;const iW=e=>e?.getAttribute("aria-selected")==="true",aW=(e,t=iW,n=!1)=>{const[r,a]=E.useState(null),[s,l]=E.useState(null),u=e.current.length;return E.useEffect(()=>{const d=()=>{let A=null;if(s?A=s:A=e.current.find(t)??null,!A){a(x=>({left:0,width:0,...x,opacity:0}));return}const C=A.offsetLeft,w=A.offsetWidth;a({left:C,width:w,opacity:1})};d(),window.addEventListener("resize",d),window.addEventListener("DOMContentLoaded",d);const f=[];e.current.forEach(A=>{if(A){const C=new MutationObserver(w=>{for(const x of w)if(x.type==="attributes"&&x.attributeName==="aria-selected"){d();break}});C.observe(A,{attributes:!0,attributeFilter:["aria-selected"]}),f.push(C)}});const p=[],g=A=>{if(!A)return;const C=new ResizeObserver(()=>{d()});C.observe(A),p.push(C)},y=e.current.find(t)??null;y&&g(y),s&&g(s);const _=A=>{l(A.currentTarget)},S=()=>{l(null)};return n&&e.current.forEach(A=>{A?.addEventListener("mouseenter",_,{passive:!0}),A?.addEventListener("mouseleave",S,{passive:!0})}),()=>{window.removeEventListener("resize",d),window.removeEventListener("DOMContentLoaded",d),f.forEach(A=>A.disconnect()),p.forEach(A=>A.disconnect()),e.current.forEach(A=>{A?.removeEventListener("mouseenter",_),A?.removeEventListener("mouseleave",S)})}},[e,t,s,u]),{choiceIndicatorPosition:r}},oW=[{content:"Off",value:!1},{content:"On",value:!0}];var fu=(e=>(e.PRIMARY="primary",e.SECONDARY="secondary",e.DESTRUCTIVE="destructive",e.NEUTRAL="neutral",e.LIGHT="light",e.DARK="dark",e.TEXT="text",e))(fu||{});const sW=fr("flex flex-row gap-2 rounded-full w-fit border-[1.5px] p-[1.5px]",{variants:{color:{primary:"border-primary text-primary",secondary:"border-secondary text-secondary",destructive:"border-destructive bg-destructive text-destructive",neutral:"border-neutral text-neutral ",light:"border-white text-white",dark:"border-neutral-800 text-neutral-800",text:"border-text text-text"}},defaultVariants:{color:"primary"}});var hu=(e=>(e.SM="sm",e.MD="md",e.LG="lg",e))(hu||{});const lW=fr("z-1 w-full flex-1 text-sm font-medium transition-all duration-300 ease-in-out cursor-pointer aria-selected:cursor-default aria-selected:text-text-opposite motion-reduce:transition-none",{variants:{size:{sm:"py-1 px-2 text-xs",md:"p-2 text-sm",lg:"p-4 text-base"}},defaultVariants:{size:"md"}}),cW=fr("absolute top-0 z-[-1] h-full w-auto rounded-full transition-[left,width] duration-300 ease-in-out motion-reduce:transition-none",{variants:{color:{primary:"bg-primary aria-selected:text-text",secondary:"bg-secondary aria-selected:text-text",destructive:"bg-destructive aria-selected:text-text",neutral:"bg-neutral aria-selected:text-white ",light:"bg-white aria-selected:text-black",dark:"bg-neutral-800 aria-selected:text-white",text:"bg-text aria-selected:text-text-opposite"}}}),pu=({choices:e=oW,value:t,defaultValue:n,onChange:r,color:a="primary",size:s="md",className:l})=>{const[u,d]=E.useState(t??n??e[0].value),f=E.useRef([]),p=E.useRef(null),{choiceIndicatorPosition:g}=aW(f),y=_=>{d(_),r?.(_)};return E.useEffect(()=>{t!==void 0&&d(t)},[t]),v.jsx("div",{className:sW({color:a,className:l}),role:"tablist",children:v.jsxs("div",{className:"relative flex size-full flex-row items-center justify-center",children:[e.map((_,S)=>{const{content:A,value:C,...w}=_,x=typeof C=="string"||typeof C=="number",T=C===u;return E.createElement("button",{...w,className:_e(lW({size:s})),key:x?C:S,role:"tab",onClick:()=>y(C),"aria-selected":T,disabled:T,ref:N=>{f.current[S]=N}},A)}),g&&v.jsx("div",{className:_e(cW({color:a})),style:g,ref:p})]})})};function tD(e,t,n){function r(u,d){var f;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(f=u._zod).traits??(f.traits=new Set),u._zod.traits.add(e),t(u,d);for(const p in l.prototype)p in u||Object.defineProperty(u,p,{value:l.prototype[p].bind(u)});u._zod.constr=l,u._zod.def=d}const a=n?.Parent??Object;class s extends a{}Object.defineProperty(s,"name",{value:e});function l(u){var d;const f=n?.Parent?new s:this;r(f,u),(d=f._zod).deferred??(d.deferred=[]);for(const p of f._zod.deferred)p();return f}return Object.defineProperty(l,"init",{value:r}),Object.defineProperty(l,Symbol.hasInstance,{value:u=>n?.Parent&&u instanceof n.Parent?!0:u?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}let uW=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};const dW={};function nD(e){return dW}function fW(e,t){return typeof t=="bigint"?t.toString():t}const rD="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Kd(e){return typeof e=="string"?e:e?.message}function iD(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const a=Kd(e.inst?._zod.def?.error?.(e))??Kd(t?.error?.(e))??Kd(n.customError?.(e))??Kd(n.localeError?.(e))??"Invalid input";r.message=a}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}const aD=(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,fW,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},hW=tD("$ZodError",aD),oD=tD("$ZodError",aD,{Parent:Error}),pW=e=>(t,n,r,a)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise)throw new uW;if(l.issues.length){const u=new(a?.Err??e)(l.issues.map(d=>iD(d,s,nD())));throw rD(u,a?.callee),u}return l.value},mW=pW(oD),gW=e=>async(t,n,r,a)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){const u=new(a?.Err??e)(l.issues.map(d=>iD(d,s,nD())));throw rD(u,a?.callee),u}return l.value},yW=gW(oD);function yC(e,t){try{var n=e()}catch(r){return t(r)}return n&&n.then?n.then(void 0,t):n}function vW(e,t){for(var n={};e.length;){var r=e[0],a=r.code,s=r.message,l=r.path.join(".");if(!n[l])if("unionErrors"in r){var u=r.unionErrors[0].errors[0];n[l]={message:u.message,type:u.code}}else n[l]={message:s,type:a};if("unionErrors"in r&&r.unionErrors.forEach(function(p){return p.errors.forEach(function(g){return e.push(g)})}),t){var d=n[l].types,f=d&&d[r.code];n[l]=x0(l,t,n,a,f?[].concat(f,r.message):r.message)}e.shift()}return n}function bW(e,t){for(var n={};e.length;){var r=e[0],a=r.code,s=r.message,l=r.path.join(".");if(!n[l])if(r.code==="invalid_union"&&r.errors.length>0){var u=r.errors[0][0];n[l]={message:u.message,type:u.code}}else n[l]={message:s,type:a};if(r.code==="invalid_union"&&r.errors.forEach(function(p){return p.forEach(function(g){return e.push(g)})}),t){var d=n[l].types,f=d&&d[r.code];n[l]=x0(l,t,n,a,f?[].concat(f,r.message):r.message)}e.shift()}return n}function _W(e,t,n){if(n===void 0&&(n={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(e))return function(r,a,s){try{return Promise.resolve(yC(function(){return Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(l){return s.shouldUseNativeValidation&&vv({},s),{errors:{},values:n.raw?Object.assign({},r):l}})},function(l){if((function(u){return Array.isArray(u?.issues)})(l))return{values:{},errors:eC(vW(l.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw l}))}catch(l){return Promise.reject(l)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(e))return function(r,a,s){try{return Promise.resolve(yC(function(){return Promise.resolve((n.mode==="sync"?mW:yW)(e,r,t)).then(function(l){return s.shouldUseNativeValidation&&vv({},s),{errors:{},values:n.raw?Object.assign({},r):l}})},function(l){if((function(u){return u instanceof hW})(l))return{values:{},errors:eC(bW(l.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw l}))}catch(l){return Promise.reject(l)}};throw new Error("Invalid input: not a Zod schema")}const sy=async e=>e&&typeof e.then=="function"?await e:e,EW=({schema:e,onSubmit:t,onSubmitSuccess:n,onSubmitError:r,className:a,children:s,autoComplete:l,...u})=>{const d=async f=>{const p=e?.safeParse(f)??{success:!0,data:void 0};await sy(t?.(f)),p.success?await sy(n?.(p.data)):await sy(r?.(new Error(p.error.issues.map(g=>g.message).join(", "))))};return v.jsx(sq,{...u,children:v.jsx("form",{className:_e("flex size-full flex-col gap-y-6",a),onSubmit:u.handleSubmit(d),autoComplete:l?"on":"off",noValidate:!0,children:s})})},SW=(e,t)=>{const n=Tq({resolver:_W(e),...t}),r=n.formState.isSubmitting,a=n.formState.isSubmitted,s=n.formState.isLoading,l=n.formState.isValid;return{form:n,isSubmitting:r,isSubmitted:a,isLoading:s,isValid:l}},xW=e=>{const{error:t,formItemId:n,formDescriptionId:r,formMessageId:a}=ma();return v.jsx(l$,{id:n,"aria-describedby":t?`${r} ${a}`:`${r}`,"aria-invalid":!!t,...e})},AW=e=>{const{formDescriptionId:t}=ma();return v.jsx("p",{className:"text-neutral text-sm",id:t,...e})},wW=({children:e,...t})=>{const{error:n,formMessageId:r}=ma(),a=n?String(n?.message??""):e;return a?v.jsx("p",{className:"text-error text-xs font-medium",role:"alert",id:r,...t,children:a}):null},Ph=({label:e,description:t,isRequired:n,info:r,children:a,showErrorMessage:s=!0,htmlFor:l})=>v.jsxs($e.Item,{className:"flex w-full flex-col gap-2 p-2",children:[(t||e)&&v.jsxs("div",{className:"flex flex-col gap-1 p-1 leading-none",children:[e&&v.jsx(JO,{isRequired:n,info:r,htmlFor:l,children:e}),t&&v.jsx($e.Description,{children:t})]}),v.jsx($e.Control,{children:a}),s&&v.jsx($e.Message,{"data-testid":"error-message"})]}),TW=({field:e,name:t,label:n,Element:r,isRequired:a=!1,info:s,description:l,showErrorMessage:u=!0,...d})=>{const{error:f}=ma();return v.jsx(Ph,{htmlFor:t,label:n,description:l,isRequired:a,info:s,showErrorMessage:u,"aria-invalid":!!f,children:v.jsx(r,{"data-testid":"element",id:t,...e,...d,children:d.children})})},va=e=>{const{control:t}=pa();return v.jsx($e.Field,{control:t,name:e.name,render:({field:n})=>v.jsx(TW,{...e,field:n})})},CW=e=>v.jsx(va,{id:e.name,"data-testid":e.name,Element:Gs,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,...e}),RW=({autoComplete:e,...t})=>v.jsx(va,{Element:Iq,id:t.name,"data-testid":t.name,"aria-labelledby":t.label?`${t.name}-label`:void 0,"aria-label":t.label?void 0:t.name,autoComplete:e,minLength:6,maxLength:255,...t}),kW=e=>v.jsx(va,{Element:WO,id:e.name,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,"data-testid":e.name,...e}),NW=e=>v.jsx(va,{id:e.name,"data-testid":e.name,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,Element:YO,...e}),OW=e=>v.jsx(va,{id:e.name,"data-testid":e.name,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,Element:XO,...e}),IW=e=>v.jsx(va,{Element:T0,id:e.name,"data-testid":e.name,...e}),DW=({inputLabel:e,...t})=>v.jsx(Oq,{...t,label:e}),jW=({autoComplete:e,...t})=>v.jsx(va,{Element:DW,id:t.name,"data-testid":t.name,autoComplete:e,minLength:6,maxLength:255,...t}),LW=({name:e,description:t,label:n,isRequired:r,info:a,showErrorMessage:s,children:l,...u})=>{const{control:d}=pa();return v.jsx($e.Field,{control:d,name:e,render:({field:f})=>{const{error:p}=ma();return v.jsx(Ph,{htmlFor:e,label:n,description:t,isRequired:r,info:a,showErrorMessage:s,"aria-invalid":!!p,children:v.jsx(mn,{onValueChange:f.onChange,values:f.value,...u,children:l})})}})},PW=({name:e,description:t,label:n,isRequired:r,info:a,showErrorMessage:s,children:l,...u})=>{const{control:d}=pa();return v.jsx($e.Field,{control:d,name:e,render:({field:f})=>{const{error:p}=ma();return v.jsx(Ph,{htmlFor:e,label:n,description:t,isRequired:r,info:a,showErrorMessage:s,"aria-invalid":!!p,children:v.jsx(Re,{onValueChange:f.onChange,defaultValue:f.value,...u,children:l})})}})},MW=({name:e,description:t,label:n,isRequired:r,info:a,showErrorMessage:s,children:l,...u})=>{const{control:d}=pa();return v.jsx($e.Field,{control:d,name:e,render:({field:f})=>{const{error:p}=ma();return v.jsx(Ph,{htmlFor:e,label:n,description:t,isRequired:r,info:a,showErrorMessage:s,"aria-invalid":!!p,children:v.jsx(pu,{...f,...u,children:l})})}})},$e=EW;$e.Description=AW;$e.Control=xW;$e.Field=kq;$e.Item=Rq;$e.Label=JO;$e.Message=wW;$e.Element=va;$e.Input=CW;$e.InputPassword=RW;$e.Checkbox=jW;$e.TextArea=kW;$e.AutoSizedTextArea=IW;$e.Button=ot;$e.Select=PW;$e.MultiSelect=LW;$e.EditableFieldInput=NW;$e.EditableFieldTextArea=OW;$e.SwitchSelector=MW;const sD=({dictionary:e,mode:t,className:n,onDelete:r,...a})=>{const[s,l]=E.useState(!1),{setLocaleDictionary:u}=dh(),{mutate:d,isPending:f}=JK(),{mutate:p,isPending:g}=iq(),{mutate:y,isPending:_}=QK(),S=g||_,{editedContent:A,restoreEditedContent:C}=xn(),{deleteButton:w,resetButton:x,saveButton:T,publishButton:N,downloadButton:R,confirmation:I}=cn("save-dictionary-details"),{isAuthenticated:D}=cu(),L=A?.[e.localId],H=L&&JSON.stringify(L)!==JSON.stringify(e),Z=typeof e?.id<"u",q=async()=>{if(!A?.[e.localId])return;const W={...e,...A?.[e.localId]};p({dictionary:W},{onSuccess:()=>{u(A?.[e.localId]),C(e.localId)}})},te=()=>{if(!A?.[e.localId])return;const W={...e,...A?.[e.localId]};y([W],{onSuccess:ae=>{ae&&(u(A?.[e.localId]),C(e.localId))}})},ce=()=>{e.id&&d(e.id.toString(),{onSuccess:W=>{W&&r?.()}})};return v.jsxs(v.Fragment,{children:[v.jsx(p0,{isOpen:s,title:I.title.value,size:h0.MD,children:v.jsxs("form",{className:"size-full px-3",children:[v.jsx("p",{className:"text-neutral py-4 text-sm",children:I.message}),v.jsxs("div",{className:"mt-12 flex justify-end gap-2 max-md:flex-col",children:[v.jsx($e.Button,{label:I.cancelButton.label.value,disabled:!H||S,color:it.TEXT,className:"max-md:w-full",variant:at.OUTLINE,onClick:()=>l(!1),children:I.cancelButton.text}),v.jsx($e.Button,{label:I.confirmButton.label.value,disabled:!H||S,Icon:RA,color:it.TEXT,className:"max-md:w-full",isLoading:_,onClick:q,children:I.confirmButton.text})]})]})}),v.jsxs("form",{className:_e("flex justify-end gap-2 max-md:flex-col",n),...a,children:[t.includes("remote")&&Z&&r&&D&&v.jsx($e.Button,{label:w.label.value,Icon:mh,color:it.ERROR,variant:at.OUTLINE,className:"max-md:w-full",isLoading:f,onClick:ce,children:w.text}),H&&v.jsx($e.Button,{label:x.label.value,disabled:!H,Icon:aF,variant:at.OUTLINE,color:it.TEXT,className:"max-md:w-full",onClick:()=>C(e.localId),children:x.text}),t.includes("local")&&v.jsx($e.Button,{label:R.label.value,disabled:!H||S,Icon:$2,color:it.TEXT,variant:D?at.OUTLINE:at.DEFAULT,className:"max-md:w-full",isLoading:g,onClick:()=>l(!0),children:R.text}),t.includes("remote")&&D&&!Z&&v.jsx($e.Button,{label:N.label.value,disabled:S,Icon:R2,color:it.TEXT,className:"max-md:w-full",isLoading:_,onClick:te,children:N.text}),t.includes("remote")&&D&&Z&&H&&v.jsx($e.Button,{label:T.label.value,disabled:!H||S,Icon:RA,color:"text",className:"max-md:w-full",isLoading:_,onClick:te,children:T.text})]})]})},lD=({level:e,title:t,description:n,children:r,rightParam:a,isSelected:s,...l})=>v.jsx("div",{className:_e("rounded-md p-2 transition","hover:bg-card/30 [&:has(.section:hover)]:bg-transparent",e===2&&"hover:bg-card/30",e>=3&&"",s===!0&&"bg-card/40"),...l,children:v.jsx(H1,{isOpen:s,label:t,header:v.jsxs("div",{className:"flex w-full",children:[v.jsxs("div",{className:"flex w-full items-center justify-between",children:[v.jsx("span",{className:_e(e===0&&"text-2xl",e===1&&"text-xl",e===2&&"text-lg",e>=3&&"text-base"),children:t}),a&&v.jsx("div",{className:"flex w-auto items-center justify-between p-3",children:a})]}),n&&v.jsx("p",{className:"text-card pl-3 text-sm",children:n})]}),children:r})}),cD=({keyPath:e,section:t,editedContent:n,editedContentValue:r,onContentChange:a,onFocusKeyPath:s,renderSection:l})=>{const u=r??lr(n,e);if(u&&typeof u!="string")return v.jsx(v.Fragment,{children:"Error loading section - Edited content Incoherence with the original content format"});const d=e.length,f=String(u??t);return v.jsx("span",{role:"button",tabIndex:0,className:_e("w-full rounded-md p-2 text-left transition","hover:bg-card/30 [&:has(.section:hover)]:bg-transparent",d===2&&"hover:bg-card/30",d>=3&&""),onClick:p=>{p.stopPropagation(),s(e)},children:typeof l=="function"?l(f):v.jsx(XO,{"aria-label":"Editable field",defaultValue:f,onSave:p=>a({keyPath:e,newValue:p}),onCancel:()=>null})})},zW=e=>{const{keyPath:t,section:n}=e,{addEditedContent:r}=xn(),a=lr(e.editedContent,t),s=n[$.File],{content:l}=n,u=[...t,{type:$.File}];return v.jsxs("div",{className:"ml-2 grid grid-cols-[auto,1fr] gap-2",children:[v.jsxs("span",{className:"text-neutral text-sm",children:[s," "]}),v.jsx(cD,{...e,keyPath:u,section:l,editedContentValue:a?.content,onContentChange:d=>{r(e.dictionary.key,{...n,content:d.newValue},t)}})]})},BW=e=>{const{keyPath:t,section:n,onFocusKeyPath:r,focusedKeyPath:a=[]}=e;return n.map((s,l)=>{const u={key:l,type:$.Array},d=[...t,u];return v.jsx(lD,{level:t.length,title:`${l}`,description:"",isSelected:Zc(d,a),onClick:f=>{f.stopPropagation(),r(d)},children:v.jsx(ba,{...e,keyPath:d,section:s})},JSON.stringify(s))})},VW=e=>{const{keyPath:t,section:n}=e;return v.jsx("div",{className:"ml-2 grid grid-cols-[auto,1fr] gap-2",children:Object.keys(n).filter(r=>!M0.includes(r)).map(r=>{const a={type:$.Condition,key:r},s=[...t,a],l=n[$.Condition][r];return v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"flex items-center font-bold",children:r}),E.createElement(ba,{...e,key:r,keyPath:s,section:l})]})})})},UW=e=>{const{keyPath:t,section:n}=e;return v.jsx("div",{className:"ml-2 grid grid-cols-[auto,1fr] gap-2",children:Object.keys(n).filter(r=>!M0.includes(r)).map(r=>{const a={type:$.Enumeration,key:r},s=[...t,a],l=n[$.Enumeration][r];return v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"flex items-center font-bold",children:r}),E.createElement(ba,{...e,key:r,keyPath:s,section:l})]})})})},FW=e=>{const{keyPath:t,section:n}=e,r=[...t,{type:$.Insertion}],a=n[$.Insertion];return v.jsx("div",{className:"ml-2 grid grid-cols-[auto,1fr] gap-2",children:v.jsx(ba,{...e,keyPath:r,section:a})})},$W=e=>{const{keyPath:t,section:n}=e,r=[...t,{type:$.Markdown}],a=n[$.Markdown];return v.jsx("div",{className:"ml-2 grid grid-cols-[auto,1fr] gap-2",children:v.jsx(ba,{...e,keyPath:r,section:a})})},HW=e=>{const{keyPath:t,section:n,focusedKeyPath:r=[],onFocusKeyPath:a}=e;return Object.keys(n).filter(s=>!M0.includes(s)).map(s=>{const l={key:s,type:$.Object},u=[...t,l];return v.jsx(lD,{level:t.length,title:s,description:"",isSelected:Zc(u,r),onClick:d=>{d.stopPropagation(),a(u)},children:v.jsx(ba,{...e,keyPath:u,section:n[s]})},s)})},GW=e=>{const{keyPath:t,section:n,locale:r}=e,a={type:$.Translation,key:r},s=[...t,a],l=n.translation[r];return v.jsx(ba,{...e,keyPath:s,section:l})},M0=["filePath","id","nodeType"],ba=e=>{const n=lr(e.editedContent,e.keyPath)??e.section,r=js(n);if(typeof n=="object")return r===$.ReactNode?v.jsx("span",{className:"text-neutral text-xs",children:"React node not editable"}):r===$.Nested?v.jsx("div",{className:"ml-2 grid grid-cols-[auto,1fr] gap-2",children:"[Nested] Dictionary"}):r===$.Markdown?v.jsx($W,{...e,section:n}):r===$.Translation?v.jsx(GW,{...e,section:n}):r===$.Enumeration?v.jsx(UW,{...e,section:n}):r===$.Condition?v.jsx(VW,{...e,section:n}):r===$.Insertion?v.jsx(FW,{...e,section:n}):r===$.Array?v.jsx(BW,{...e,section:n}):r===$.File?v.jsx(zW,{...e,section:n}):v.jsx(HW,{...e,section:n});if(typeof n=="string")return v.jsx(cD,{...e,section:n})},KW=({dictionary:e,mode:t,onDelete:n,...r})=>{const{editedContent:a,addEditedContent:s}=xn(),{focusedContent:l,setFocusedContentKeyPath:u,setFocusedContent:d}=da(),f=l?.keyPath;return v.jsxs("div",{className:"flex flex-1 flex-col justify-between gap-2",children:[v.jsx("div",{children:E.createElement(ba,{...r,keyPath:[],dictionary:e,key:JSON.stringify((a?.[e.localId]??e).content),editedContent:a?.[e.localId]?.content,focusedKeyPath:f,section:e.content,onContentChange:p=>{s(e.localId,p.newValue,p.keyPath)},onFocusKeyPath:u})}),v.jsx(sD,{dictionary:e,mode:t,className:"mb-4 flex-col",onDelete:()=>{d(null),n?.()}})]})};function pe(e,t,n){function r(u,d){var f;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(f=u._zod).traits??(f.traits=new Set),u._zod.traits.add(e),t(u,d);for(const p in l.prototype)p in u||Object.defineProperty(u,p,{value:l.prototype[p].bind(u)});u._zod.constr=l,u._zod.def=d}const a=n?.Parent??Object;class s extends a{}Object.defineProperty(s,"name",{value:e});function l(u){var d;const f=n?.Parent?new s:this;r(f,u),(d=f._zod).deferred??(d.deferred=[]);for(const p of f._zod.deferred)p();return f}return Object.defineProperty(l,"init",{value:r}),Object.defineProperty(l,Symbol.hasInstance,{value:u=>n?.Parent&&u instanceof n.Parent?!0:u?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}class Vc extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const uD={};function uo(e){return uD}function qW(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,a])=>t.indexOf(+r)===-1).map(([r,a])=>a)}function WW(e,t){return typeof t=="bigint"?t.toString():t}function dD(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function z0(e){return e==null}function B0(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function _t(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function V0(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function lc(e){return JSON.stringify(e)}const fD=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Rv(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const ZW=dD(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function kv(e){if(Rv(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Rv(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const YW=new Set(["string","number","symbol"]);function Mh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function go(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ze(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function XW(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function QW(e,t){const n={},r=e._zod.def;for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(n[a]=r.shape[a])}return go(e,{...e._zod.def,shape:n,checks:[]})}function JW(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete n[a]}return go(e,{...e._zod.def,shape:n,checks:[]})}function eZ(e,t){if(!kv(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return V0(this,"shape",r),r},checks:[]};return go(e,n)}function tZ(e,t){return go(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return V0(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function nZ(e,t,n){const r=t._zod.def.shape,a={...r};if(n)for(const s in n){if(!(s in r))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(a[s]=e?new e({type:"optional",innerType:r[s]}):r[s])}else for(const s in r)a[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return go(t,{...t._zod.def,shape:a,checks:[]})}function rZ(e,t,n){const r=t._zod.def.shape,a={...r};if(n)for(const s in n){if(!(s in a))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(a[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(const s in r)a[s]=new e({type:"nonoptional",innerType:r[s]});return go(t,{...t._zod.def,shape:a,checks:[]})}function xc(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function U0(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function qd(e){return typeof e=="string"?e:e?.message}function fo(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const a=qd(e.inst?._zod.def?.error?.(e))??qd(t?.error?.(e))??qd(n.customError?.(e))??qd(n.localeError?.(e))??"Invalid input";r.message=a}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function F0(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Uc(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const hD=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,WW,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pD=pe("$ZodError",hD),mD=pe("$ZodError",hD,{Parent:Error});function iZ(e,t=n=>n.message){const n={},r=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}function aZ(e,t){const n=t||function(s){return s.message},r={_errors:[]},a=s=>{for(const l of s.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>a({issues:u}));else if(l.code==="invalid_key")a({issues:l.issues});else if(l.code==="invalid_element")a({issues:l.issues});else if(l.path.length===0)r._errors.push(n(l));else{let u=r,d=0;for(;d<l.path.length;){const f=l.path[d];d===l.path.length-1?(u[f]=u[f]||{_errors:[]},u[f]._errors.push(n(l))):u[f]=u[f]||{_errors:[]},u=u[f],d++}}};return a(e),r}const oZ=e=>(t,n,r,a)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise)throw new Vc;if(l.issues.length){const u=new(a?.Err??e)(l.issues.map(d=>fo(d,s,uo())));throw fD(u,a?.callee),u}return l.value},sZ=e=>async(t,n,r,a)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){const u=new(a?.Err??e)(l.issues.map(d=>fo(d,s,uo())));throw fD(u,a?.callee),u}return l.value},gD=e=>(t,n,r)=>{const a=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new Vc;return s.issues.length?{success:!1,error:new(e??pD)(s.issues.map(l=>fo(l,a,uo())))}:{success:!0,data:s.value}},lZ=gD(mD),yD=e=>async(t,n,r)=>{const a=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(l=>fo(l,a,uo())))}:{success:!0,data:s.value}},cZ=yD(mD),uZ=/^[cC][^\s-]{8,}$/,dZ=/^[0-9a-z]+$/,fZ=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,hZ=/^[0-9a-vA-V]{20}$/,pZ=/^[A-Za-z0-9]{27}$/,mZ=/^[a-zA-Z0-9_-]{21}$/,gZ=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,yZ=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,vC=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,vZ=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,bZ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function _Z(){return new RegExp(bZ,"u")}const EZ=/^(?:(?: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])$/,SZ=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,xZ=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,AZ=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wZ=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vD=/^[A-Za-z0-9_-]*$/,TZ=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,CZ=/^\+(?:[0-9]){6,14}[0-9]$/,bD="(?:(?:\\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])))",RZ=new RegExp(`^${bD}$`);function _D(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function kZ(e){return new RegExp(`^${_D(e)}$`)}function NZ(e){const t=_D({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${bD}T(?:${r})$`)}const OZ=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},IZ=/^[^A-Z]*$/,DZ=/^[^a-z]*$/,Wr=pe("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),jZ=pe("$ZodCheckMaxLength",(e,t)=>{var n;Wr.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!z0(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const a=r.value;if(a.length<=t.maximum)return;const l=F0(a);r.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),LZ=pe("$ZodCheckMinLength",(e,t)=>{var n;Wr.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!z0(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const a=r.value;if(a.length>=t.minimum)return;const l=F0(a);r.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),PZ=pe("$ZodCheckLengthEquals",(e,t)=>{var n;Wr.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!z0(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=r=>{const a=r.value,s=a.length;if(s===t.length)return;const l=F0(a),u=s>t.length;r.issues.push({origin:l,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),zh=pe("$ZodCheckStringFormat",(e,t)=>{var n,r;Wr.init(e,t),e._zod.onattach.push(a=>{const s=a._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),MZ=pe("$ZodCheckRegex",(e,t)=>{zh.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),zZ=pe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=IZ),zh.init(e,t)}),BZ=pe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=DZ),zh.init(e,t)}),VZ=pe("$ZodCheckIncludes",(e,t)=>{Wr.init(e,t);const n=Mh(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),UZ=pe("$ZodCheckStartsWith",(e,t)=>{Wr.init(e,t);const n=new RegExp(`^${Mh(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),FZ=pe("$ZodCheckEndsWith",(e,t)=>{Wr.init(e,t);const n=new RegExp(`.*${Mh(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),$Z=pe("$ZodCheckOverwrite",(e,t)=>{Wr.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class HZ{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
267
|
+
*/var ET;function C8(){if(ET)return Zg;ET=1;var e=Wc(),t=T8();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,a=t.useSyncExternalStore,s=e.useRef,l=e.useEffect,u=e.useMemo,d=e.useDebugValue;return Zg.useSyncExternalStoreWithSelector=function(f,p,g,y,_){var S=s(null);if(S.current===null){var A={hasValue:!1,value:null};S.current=A}else A=S.current;S=u(function(){function w(I){if(!x){if(x=!0,T=I,I=y(I),_!==void 0&&A.hasValue){var D=A.value;if(_(D,I))return N=D}return N=I}if(D=N,r(T,I))return D;var L=y(I);return _!==void 0&&_(D,L)?(T=I,D):(T=I,N=L)}var x=!1,T,N,R=g===void 0?null:g;return[function(){return w(p())},R===null?void 0:function(){return w(R())}]},[p,g,y,_]);var C=a(f,S[0],S[1]);return l(function(){A.hasValue=!0,A.value=C},[C]),d(C),C},Zg}var ST;function R8(){return ST||(ST=1,Wg.exports=C8()),Wg.exports}var k8=R8();const N8=ib(k8),xO={},{useDebugValue:O8}=Oe,{useSyncExternalStoreWithSelector:I8}=N8;let xT=!1;const D8=e=>e;function j8(e,t=D8,n){(xO?"production":void 0)!=="production"&&n&&!xT&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),xT=!0);const r=I8(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return O8(r),r}const AT=e=>{(xO?"production":void 0)!=="production"&&typeof e!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const t=typeof e=="function"?A8(e):e,n=(r,a)=>j8(t,r,a);return Object.assign(n,t),n},AO=e=>e?AT(e):AT,L8=AO((e,t)=>({scrollBlockers:[],addBlockage:(n,r)=>e(a=>{const s=a.scrollBlockers,l=s.find(u=>u.element===r);if(l){const d=l.blockers.includes(n)?l.blockers:[...l.blockers,n];return{scrollBlockers:s.map(f=>f.element===r?{...f,blockers:d}:f)}}return r.style.overflowY="hidden",r.style.overflowX="hidden",{scrollBlockers:[...s,{element:r,blockers:[n]}]}}),removeBlockage:(n,r)=>e(a=>{const s=a.scrollBlockers,l=s.find(u=>u.element===r);return l?l.blockers.length>1?{scrollBlockers:s.map(u=>u.element===r?{...u,blockers:u.blockers.filter(d=>d!==n)}:u)}:(r.style.overflowY="auto",{scrollBlockers:s.filter(u=>u.element!==r)}):{scrollBlockers:s}}),isElementScrollBlocked:n=>t().scrollBlockers.some(r=>r.element===n)}));function P8(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,a]of e)if(!Object.is(a,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const{useRef:M8}=Oe;function wO(e){const t=M8();return n=>{const r=e(n);return P8(t.current,r)?t.current:t.current=r}}const TO=e=>{const{disableScroll:t=!1,element:n,key:r="unnamed_blocker"}=e??{},{isElementScrollBlocked:a,addBlockage:s,removeBlockage:l}=L8(wO(f=>({isElementScrollBlocked:f.isElementScrollBlocked,addBlockage:f.addBlockage,removeBlockage:f.removeBlockage}))),u=SO(n);return E.useEffect(()=>{const f=n??window.document.body;t?s(r,f):l(r,f)},[s,t,n,r,l]),{isScrollBlocked:u?a(u):!1}},u0="relative scroll-mb-8 scroll-mt-[30vh] scroll-p-8",z8="after:content-['#'] after:scale-75 after:px-6 after:text-neutral after:absolute after:top-0 after:h-full after:-left-12 after:hover:cursor-pointer after:absolute after:to-neutral after:md:opacity-0 after:transition-opacity hover:after:opacity-80 after:duration-200 after:delay-100",B8=({className:e,...t})=>v.jsx("h1",{className:_e("mt-5 text-2xl font-bold",e),...t}),V8=({className:e,...t})=>v.jsx("h2",{className:_e("mt-16 mb-2 text-2xl font-bold",u0,e),...t}),U8=({className:e,...t})=>v.jsx("h3",{className:_e("mt-5 mb-2 text-xl font-bold",u0,e),...t}),F8=({className:e,...t})=>v.jsx("h4",{className:_e("mt-3 text-lg font-bold",u0,e),...t}),$8=e=>String(e).normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/\s+/g,"-").toLowerCase(),H8=e=>{const r=(document.getElementById(e)?.getBoundingClientRect()?.top??0)+window.scrollY-150;window.scrollTo({top:r,behavior:"smooth"})},G8=(e,t)=>{const n=e.getBoundingClientRect().left,r=e.getBoundingClientRect().top,a=window.getComputedStyle(e,":after"),s=n+parseInt(a.getPropertyValue("left"),10),l=s+parseInt(a.width,10),u=r+parseInt(a.getPropertyValue("top"),10),d=u+parseInt(a.height,10),f=t.clientX,p=t.clientY;return f>=s&&f<=l&&p>=u&&p<=d},d0=({H:e,children:t,className:n,isClickable:r,...a})=>{const s=typeof t=="string"?$8(t):void 0,l=u=>{const{id:d}=u.currentTarget;if(G8(u.currentTarget,u)&&typeof d=="string"){const g=`${window.location.href.split("#")[0]}#${d}`;navigator.clipboard.writeText(g),H8(d)}};return v.jsx(e,{id:s,onClick:r?l:void 0,"aria-label":r?`Click to scroll to section ${s} and copy the link to the clipboard`:void 0,className:_e(r&&z8,n),...a,children:t})},K8=({isClickable:e,...t})=>v.jsx(B8,{...t}),q8=({isClickable:e=!1,...t})=>v.jsx(d0,{H:V8,isClickable:e,...t}),f0=({isClickable:e=!1,...t})=>v.jsx(d0,{H:U8,isClickable:e,...t}),W8=({isClickable:e=!1,...t})=>v.jsx(d0,{H:F8,isClickable:e,...t});var h0=(e=>(e.SM="sm",e.MD="md",e.LG="lg",e.XL="xl",e.UNSET="unset",e))(h0||{});const Z8=fr("cursor-default overflow-auto py-3 shadow-sm justify-center",{variants:{size:{sm:"h-auto max-h-[30vh] w-[95vw] max-w-xl",md:"h-auto max-h-[50vh] w-[95vw] max-w-xl",lg:"h-auto max-h-[70vh] w-[95vw] max-w-2xl",xl:"h-auto max-h-[95vh] w-[95vw] max-w-6xl",unset:"h-auto max-h-[95vh] w-[95vw]"}},defaultVariants:{size:"unset"}}),Y8=cO.create(Tr),p0=({children:e,isOpen:t,container:n,disableScroll:r=!0,onClose:a,hasCloseButton:s=!1,title:l,size:u="md",className:d,...f})=>{const p=SO(n);if(TO({key:"modal",disableScroll:t&&r}),!p)return v.jsx(v.Fragment,{});const g=typeof l=="string";return ho.createPortal(v.jsx(cO.div,{className:"bg-background/40 /40 invisible fixed left-0 top-0 z-50 flex size-full cursor-pointer items-center justify-center overflow-auto backdrop-blur",animate:t?"visible":"invisible",variants:{visible:{opacity:1,visibility:"visible",transition:{duration:.1,when:"beforeChildren"}},invisible:{opacity:0,visibility:"hidden",transition:{duration:.1,when:"afterChildren"}}},onClick:y=>{y.stopPropagation(),a?.()},"aria-hidden":!t,children:v.jsx("div",{className:"flex justify-center p-4",children:v.jsxs(Y8,{onClick:y=>y.stopPropagation(),initial:{scale:t?.5:1},animate:{scale:t?1:.5},transition:{duration:.3},className:Z8({size:u,className:d}),role:"dialog","aria-modal":!0,roundedSize:"2xl",...f,children:[v.jsxs("div",{className:_e("cursor-default px-4",s&&g?"flex items-center justify-center":s?"flex items-center justify-end":g?"items-center":"hidden"),children:[g&&v.jsx(f0,{className:"ml-4 flex items-center justify-center text-lg font-bold",children:l}),s&&v.jsx(ot,{variant:at.HOVERABLE,color:it.TEXT,label:"Close modal",className:"ml-auto",onClick:y=>{y.stopPropagation(),a?.()},Icon:po,size:qn.ICON_MD})]}),v.jsx("div",{className:"flex flex-1 flex-col items-center overflow-auto",children:e})]})})}),p)},X8=e=>{const t=Gr(),n=e??t??rt,r=UR(n),{data:a}=wh({queryKey:["oAuth2AccessToken"],queryFn:r.getOAuth2AccessToken,enabled:!!(n.editor.clientId&&n.editor.clientSecret),staleTime:0,gcTime:0,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,refetchInterval:!1,refetchIntervalInBackground:!1});return{oAuth2AccessToken:a?.data}};var Q8=Object.defineProperty,J8=Object.defineProperties,eK=Object.getOwnPropertyDescriptors,wT=Object.getOwnPropertySymbols,tK=Object.prototype.hasOwnProperty,nK=Object.prototype.propertyIsEnumerable,TT=(e,t,n)=>t in e?Q8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,br=(e,t)=>{for(var n in t||(t={}))tK.call(t,n)&&TT(e,n,t[n]);if(wT)for(var n of wT(t))nK.call(t,n)&&TT(e,n,t[n]);return e},Pr=(e,t)=>J8(e,eK(t)),rK=class extends Error{constructor(e,t,n){super(t||e.toString(),{cause:n}),this.status=e,this.statusText=t,this.error=n}},iK=async(e,t)=>{var n,r,a,s,l,u;let d=t||{};const f={onRequest:[t?.onRequest],onResponse:[t?.onResponse],onSuccess:[t?.onSuccess],onError:[t?.onError],onRetry:[t?.onRetry]};if(!t||!t?.plugins)return{url:e,options:d,hooks:f};for(const p of t?.plugins||[]){if(p.init){const g=await((n=p.init)==null?void 0:n.call(p,e.toString(),t));d=g.options||d,e=g.url}f.onRequest.push((r=p.hooks)==null?void 0:r.onRequest),f.onResponse.push((a=p.hooks)==null?void 0:a.onResponse),f.onSuccess.push((s=p.hooks)==null?void 0:s.onSuccess),f.onError.push((l=p.hooks)==null?void 0:l.onError),f.onRetry.push((u=p.hooks)==null?void 0:u.onRetry)}return{url:e,options:d,hooks:f}},CT=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(){return this.options.delay}},aK=class{constructor(e){this.options=e}shouldAttemptRetry(e,t){return this.options.shouldRetry?Promise.resolve(e<this.options.attempts&&this.options.shouldRetry(t)):Promise.resolve(e<this.options.attempts)}getDelay(e){return Math.min(this.options.maxDelay,this.options.baseDelay*2**e)}};function oK(e){if(typeof e=="number")return new CT({type:"linear",attempts:e,delay:1e3});switch(e.type){case"linear":return new CT(e);case"exponential":return new aK(e);default:throw new Error("Invalid retry strategy")}}var sK=async e=>{const t={},n=async r=>typeof r=="function"?await r():r;if(e?.auth){if(e.auth.type==="Bearer"){const r=await n(e.auth.token);if(!r)return t;t.authorization=`Bearer ${r}`}else if(e.auth.type==="Basic"){const r=n(e.auth.username),a=n(e.auth.password);if(!r||!a)return t;t.authorization=`Basic ${btoa(`${r}:${a}`)}`}else if(e.auth.type==="Custom"){const r=n(e.auth.value);if(!r)return t;t.authorization=`${n(e.auth.prefix)} ${r}`}}return t},lK=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function cK(e){const t=e.headers.get("content-type"),n=new Set(["image/svg","application/xml","application/xhtml","application/html"]);if(!t)return"json";const r=t.split(";").shift()||"";return lK.test(r)?"json":n.has(r)||r.startsWith("text/")?"text":"blob"}function uK(e){try{return JSON.parse(e),!0}catch{return!1}}function CO(e){if(e===void 0)return!1;const t=typeof e;return t==="string"||t==="number"||t==="boolean"||t===null?!0:t!=="object"?!1:Array.isArray(e)?!0:e.buffer?!1:e.constructor&&e.constructor.name==="Object"||typeof e.toJSON=="function"}function RT(e){try{return JSON.parse(e)}catch{return e}}function kT(e){return typeof e=="function"}function dK(e){if(e?.customFetchImpl)return e.customFetchImpl;if(typeof globalThis<"u"&&kT(globalThis.fetch))return globalThis.fetch;if(typeof window<"u"&&kT(window.fetch))return window.fetch;throw new Error("No fetch implementation found")}async function fK(e){const t=new Headers(e?.headers),n=await sK(e);for(const[r,a]of Object.entries(n||{}))t.set(r,a);if(!t.has("content-type")){const r=hK(e?.body);r&&t.set("content-type",r)}return t}function hK(e){return CO(e)?"application/json":null}function pK(e){if(!e?.body)return null;const t=new Headers(e?.headers);if(CO(e.body)&&!t.has("content-type")){for(const[n,r]of Object.entries(e?.body))r instanceof Date&&(e.body[n]=r.toISOString());return JSON.stringify(e.body)}return e.body}function mK(e,t){var n;if(t?.method)return t.method.toUpperCase();if(e.startsWith("@")){const r=(n=e.split("@")[1])==null?void 0:n.split("/")[0];return kO.includes(r)?r.toUpperCase():t?.body?"POST":"GET"}return t?.body?"POST":"GET"}function gK(e,t){let n;return!e?.signal&&e?.timeout&&(n=setTimeout(()=>t?.abort(),e?.timeout)),{abortTimeout:n,clearTimeout:()=>{n&&clearTimeout(n)}}}var yK=class RO extends Error{constructor(t,n){super(n||JSON.stringify(t,null,2)),this.issues=t,Object.setPrototypeOf(this,RO.prototype)}};async function bf(e,t){let n=await e["~standard"].validate(t);if(n.issues)throw new yK(n.issues);return n.value}var kO=["get","post","put","patch","delete"],vK=e=>({id:"apply-schema",name:"Apply Schema",version:"1.0.0",async init(t,n){var r,a,s,l;const u=((a=(r=e.plugins)==null?void 0:r.find(d=>{var f;return(f=d.schema)!=null&&f.config?t.startsWith(d.schema.config.baseURL||"")||t.startsWith(d.schema.config.prefix||""):!1}))==null?void 0:a.schema)||e.schema;if(u){let d=t;(s=u.config)!=null&&s.prefix&&d.startsWith(u.config.prefix)&&(d=d.replace(u.config.prefix,""),u.config.baseURL&&(t=t.replace(u.config.prefix,u.config.baseURL))),(l=u.config)!=null&&l.baseURL&&d.startsWith(u.config.baseURL)&&(d=d.replace(u.config.baseURL,""));const f=u.schema[d];if(f){let p=Pr(br({},n),{method:f.method,output:f.output});return n?.disableValidation||(p=Pr(br({},p),{body:f.input?await bf(f.input,n?.body):n?.body,params:f.params?await bf(f.params,n?.params):n?.params,query:f.query?await bf(f.query,n?.query):n?.query})),{url:t,options:p}}}return{url:t,options:n}}}),bK=e=>{async function t(n,r){const a=Pr(br(br({},e),r),{plugins:[...e?.plugins||[],vK(e||{})]});if(e?.catchAllError)try{return await pv(n,a)}catch(s){return{data:null,error:{status:500,statusText:"Fetch Error",message:"Fetch related error. Captured by catchAllError option. See error property for more details.",error:s}}}return await pv(n,a)}return t};function _K(e,t){let{baseURL:n,params:r,query:a}=t||{query:{},params:{},baseURL:""},s=e.startsWith("http")?e.split("/").slice(0,3).join("/"):n||"";if(e.startsWith("@")){const g=e.toString().split("@")[1].split("/")[0];kO.includes(g)&&(e=e.replace(`@${g}/`,"/"))}s.endsWith("/")||(s+="/");let[l,u]=e.replace(s,"").split("?");const d=new URLSearchParams(u);for(const[g,y]of Object.entries(a||{}))y!=null&&d.set(g,String(y));if(r)if(Array.isArray(r)){const g=l.split("/").filter(y=>y.startsWith(":"));for(const[y,_]of g.entries()){const S=r[y];l=l.replace(_,S)}}else for(const[g,y]of Object.entries(r))l=l.replace(`:${g}`,String(y));l=l.split("/").map(encodeURIComponent).join("/"),l.startsWith("/")&&(l=l.slice(1));let f=d.toString();return f=f.length>0?`?${f}`.replace(/\+/g,"%20"):"",s.startsWith("http")?new URL(`${l}${f}`,s):`${s}${l}${f}`}var pv=async(e,t)=>{var n,r,a,s,l,u,d,f;const{hooks:p,url:g,options:y}=await iK(e,t),_=dK(y),S=new AbortController,A=(n=y.signal)!=null?n:S.signal,C=_K(g,y),w=pK(y),x=await fK(y),T=mK(g,y);let N=Pr(br({},y),{url:C,headers:x,body:w,method:T,signal:A});for(const ce of p.onRequest)if(ce){const W=await ce(N);W instanceof Object&&(N=W)}("pipeTo"in N&&typeof N.pipeTo=="function"||typeof((r=t?.body)==null?void 0:r.pipe)=="function")&&("duplex"in N||(N.duplex="half"));const{clearTimeout:R}=gK(y,S);let I=await _(N.url,N);R();const D={response:I,request:N};for(const ce of p.onResponse)if(ce){const W=await ce(Pr(br({},D),{response:(a=t?.hookOptions)!=null&&a.cloneResponse?I.clone():I}));W instanceof Response?I=W:W instanceof Object&&(I=W.response)}if(I.ok){if(!(N.method!=="HEAD"))return{data:"",error:null};const W=cK(I),ae={data:"",response:I,request:N};if(W==="json"||W==="text"){const M=await I.text(),G=await((s=N.jsonParser)!=null?s:RT)(M);ae.data=G}else ae.data=await I[W]();N?.output&&N.output&&!N.disableValidation&&(ae.data=await bf(N.output,ae.data));for(const M of p.onSuccess)M&&await M(Pr(br({},ae),{response:(l=t?.hookOptions)!=null&&l.cloneResponse?I.clone():I}));return t?.throw?ae.data:{data:ae.data,error:null}}const L=(u=t?.jsonParser)!=null?u:RT,H=await I.text(),Z=uK(H),q=Z?await L(H):null,te={response:I,responseText:H,request:N,error:Pr(br({},q),{status:I.status,statusText:I.statusText})};for(const ce of p.onError)ce&&await ce(Pr(br({},te),{response:(d=t?.hookOptions)!=null&&d.cloneResponse?I.clone():I}));if(t?.retry){const ce=oK(t.retry),W=(f=t.retryAttempt)!=null?f:0;if(await ce.shouldAttemptRetry(W,I)){for(const M of p.onRetry)M&&await M(D);const ae=ce.getDelay(W);return await new Promise(M=>setTimeout(M,ae)),await pv(e,Pr(br({},t),{retryAttempt:W+1}))}}if(t?.throw)throw new rK(I.status,I.statusText,Z?q:H);return{data:null,error:Pr(br({},q),{status:I.status,statusText:I.statusText})}};class EK extends Error{constructor(t,n){super(t),this.name="BetterAuthError",this.message=t,this.cause=n,this.stack=""}}function SK(e){try{return new URL(e).pathname!=="/"}catch{throw new EK(`Invalid base URL: ${e}. Please provide a valid base URL.`)}}function Qg(e,t="/api/auth"){return SK(e)?e:(t=t.startsWith("/")?t:`/${t}`,`${e.replace(/\/+$/,"")}${t}`)}function xK(e,t,n,r){if(e)return Qg(e,t);{const a=Ha.BETTER_AUTH_URL||Ha.NEXT_PUBLIC_BETTER_AUTH_URL||Ha.PUBLIC_BETTER_AUTH_URL||Ha.NUXT_PUBLIC_BETTER_AUTH_URL||Ha.NUXT_PUBLIC_AUTH_URL||(Ha.BASE_URL!=="/"?Ha.BASE_URL:void 0);if(a)return Qg(a,t)}if(typeof window<"u"&&window.location)return Qg(window.location.origin,t)}var Jg={},ey={},ty={},gr={},NT;function m0(){if(NT)return gr;NT=1,Object.defineProperty(gr,"__esModule",{value:!0}),gr.cleanTasks=gr.allTasks=gr.task=gr.startTask=void 0;let e=0,t=[];function n(){return e+=1,()=>{if(e-=1,e===0){let l=t;t=[];for(let u of l)u()}}}gr.startTask=n;function r(l){let u=n();return l().finally(u)}gr.task=r;function a(){return e===0?Promise.resolve():new Promise(l=>{t.push(l)})}gr.allTasks=a;function s(){e=0}return gr.cleanTasks=s,gr}var OT;function Th(){return OT||(OT=1,(function(e){var t={};Object.defineProperty(e,"__esModule",{value:!0}),e.cleanStores=e.clean=void 0;const n=m0();e.clean=Symbol("clean");let r=(...a)=>{if(t.NODE_ENV==="production")throw new Error("cleanStores() can be used only during development or tests");(0,n.cleanTasks)();for(let s of a)s&&(s.mocked&&delete s.mocked,s[e.clean]&&s[e.clean]())};e.cleanStores=r})(ty)),ty}var IT;function g0(){return IT||(IT=1,(function(e){var t={};Object.defineProperty(e,"__esModule",{value:!0}),e.onMount=e.STORE_UNMOUNT_DELAY=e.onBuild=e.onNotify=e.onSet=e.onStop=e.onStart=void 0;const n=Th(),r=0,a=1,s=2,l=3,u=4,d=5,f=6,p=10;let g=(x,T,N,R)=>(x.events=x.events||{},x.events[N+p]||(x.events[N+p]=R(I=>{x.events[N].reduceRight((D,L)=>(L(D),D),{shared:{},...I})})),x.events[N]=x.events[N]||[],x.events[N].push(T),()=>{let I=x.events[N],D=I.indexOf(T);I.splice(D,1),I.length||(delete x.events[N],x.events[N+p](),delete x.events[N+p])}),y=(x,T)=>g(x,T,r,N=>{let R=x.listen;return x.listen=I=>(!x.lc&&!x.starting&&(x.starting=!0,N(),delete x.starting),R(I)),()=>{x.listen=R}});e.onStart=y;let _=(x,T)=>g(x,T,a,N=>{let R=x.off;return x.off=()=>{N(),R()},()=>{x.off=R}});e.onStop=_;let S=(x,T)=>g(x,T,s,N=>{let R=x.set,I=x.setKey;return x.setKey&&(x.setKey=(D,L)=>{let H;if(N({abort:()=>{H=!0},changed:D,newValue:{...x.value,[D]:L}}),!H)return I(D,L)}),x.set=D=>{let L;if(N({abort:()=>{L=!0},newValue:D}),!L)return R(D)},()=>{x.set=R,x.setKey=I}});e.onSet=S;let A=(x,T)=>g(x,T,l,N=>{let R=x.notify;return x.notify=I=>{let D;if(N({abort:()=>{D=!0},changed:I}),!D)return R(I)},()=>{x.notify=R}});e.onNotify=A;let C=(x,T)=>g(x,T,u,N=>{let R=x.build;return x.build=(...I)=>{let D=R(...I);return N({store:D}),D},()=>{x.build=R}});e.onBuild=C,e.STORE_UNMOUNT_DELAY=1e3;let w=(x,T)=>g(x,R=>{let I=T(R);I&&x.events[f].push(I)},d,R=>{let I=x.listen;x.listen=L=>(!x.lc&&!x.active&&(x.active=!0,R()),I(L));let D=x.off;if(x.events[f]=[],x.off=()=>{setTimeout(()=>{if(x.active&&!x.lc){x.active=!1;for(let L of x.events[f])L();x.events[f]=[],D()}},e.STORE_UNMOUNT_DELAY)},t.NODE_ENV!=="production"){let L=x[n.clean];x[n.clean]=()=>{for(let H of x.events[f])H();x.events[f]=[],x.active=!1,L()}}return()=>{x.listen=I,x.off=D}});e.onMount=w})(ey)),ey}var ny={},DT;function AK(){return DT||(DT=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.actionFor=e.action=e.lastAction=void 0;const t=m0();e.lastAction=Symbol();let n=(s,l,u,d)=>{let f={...s};f.set=(...g)=>{s[e.lastAction]=l,s.set(...g),delete s[e.lastAction]},s.setKey&&(f.setKey=(...g)=>{s[e.lastAction]=l,s.setKey(...g),delete s[e.lastAction]});let p=u(f,...d);if(p instanceof Promise){let g=(0,t.startTask)();return p.finally(g)}return p},r=(s,l,u)=>(...d)=>n(s,l,u,d);e.action=r;let a=(s,l,u)=>(d,...f)=>n(d,l,u,f);e.actionFor=a})(ny)),ny}var nc={},rc={},ry={},jT;function y0(){return jT||(jT=1,(function(e){var t={};Object.defineProperty(e,"__esModule",{value:!0}),e.atom=e.notifyId=void 0;const n=Th();let r=[];e.notifyId=0;let a=s=>{let l,u=[],d={lc:0,value:s,set(f){d.value=f,d.notify()},get(){return d.lc||d.listen(()=>{})(),d.value},notify(f){l=u;let p=!r.length;for(let g=0;g<l.length;g++)r.push(l[g],d.value,f);if(p){e.notifyId++;for(let g=0;g<r.length;g+=3)r[g](r[g+1],r[g+2]);r.length=0}},listen(f){return u===l&&(u=u.slice()),d.lc=u.push(f),()=>{u===l&&(u=u.slice());let p=u.indexOf(f);~p&&(u.splice(p,1),d.lc--,d.lc||d.off())}},subscribe(f){let p=d.listen(f);return f(d.value),p},off(){}};return t.NODE_ENV!=="production"&&(d[n.clean]=()=>{u=[],d.lc=0,d.off()}),d};e.atom=a})(ry)),ry}var LT;function NO(){if(LT)return rc;LT=1,Object.defineProperty(rc,"__esModule",{value:!0}),rc.map=void 0;const e=y0();let t=(n={})=>{let r=(0,e.atom)(n);return r.setKey=function(a,s){typeof s>"u"?a in r.value&&(r.value={...r.value},delete r.value[a],r.notify(a)):r.value[a]!==s&&(r.value={...r.value,[a]:s},r.notify(a))},r};return rc.map=t,rc}var PT;function wK(){if(PT)return nc;PT=1;var e={};Object.defineProperty(nc,"__esModule",{value:!0}),nc.mapTemplate=void 0;const t=g0(),n=Th(),r=NO();function a(s){let l=(u,...d)=>(l.cache[u]||(l.cache[u]=l.build(u,...d)),l.cache[u]);return l.build=(u,...d)=>{let f=(0,r.map)({id:u});return(0,t.onMount)(f,()=>{let p;return s&&(p=s(f,u,...d)),()=>{delete l.cache[u],p&&p()}}),f},l.cache={},e.NODE_ENV!=="production"&&(l[n.clean]=()=>{for(let u in l.cache)l.cache[u][n.clean]();l.cache={}}),l}return nc.mapTemplate=a,nc}var ic={},MT;function TK(){if(MT)return ic;MT=1,Object.defineProperty(ic,"__esModule",{value:!0}),ic.listenKeys=void 0;function e(t,n,r){let a=new Set([...n,void 0]);return t.listen((s,l)=>{a.has(l)&&r(s,l)})}return ic.listenKeys=e,ic}var ac={},zT;function CK(){if(zT)return ac;zT=1,Object.defineProperty(ac,"__esModule",{value:!0}),ac.keepMount=void 0;let e=t=>{t.listen(()=>{})};return ac.keepMount=e,ac}var oc={},BT;function RK(){if(BT)return oc;BT=1,Object.defineProperty(oc,"__esModule",{value:!0}),oc.computed=void 0;const e=g0(),t=y0();let n=(r,a)=>{Array.isArray(r)||(r=[r]);let s,l=[],u=()=>{let f=r.map(p=>p.get());(s!==t.notifyId||f.some((p,g)=>p!==l[g]))&&(s=t.notifyId,l=f,d.set(a(...f)))},d=(0,t.atom)();return(0,e.onMount)(d,()=>{let f=r.map(p=>p.listen(u,a));return u(),()=>{for(let p of f)p()}}),d};return oc.computed=n,oc}var VT;function kK(){return VT||(VT=1,(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.map=e.atom=e.computed=e.keepMount=e.listenKeys=e.mapTemplate=e.cleanStores=e.clean=e.lastAction=e.actionFor=e.action=e.task=e.allTasks=e.startTask=e.cleanTasks=e.onSet=e.onStop=e.onBuild=e.onMount=e.onStart=e.onNotify=e.STORE_UNMOUNT_DELAY=void 0;var t=g0();Object.defineProperty(e,"STORE_UNMOUNT_DELAY",{enumerable:!0,get:function(){return t.STORE_UNMOUNT_DELAY}}),Object.defineProperty(e,"onNotify",{enumerable:!0,get:function(){return t.onNotify}}),Object.defineProperty(e,"onStart",{enumerable:!0,get:function(){return t.onStart}}),Object.defineProperty(e,"onMount",{enumerable:!0,get:function(){return t.onMount}}),Object.defineProperty(e,"onBuild",{enumerable:!0,get:function(){return t.onBuild}}),Object.defineProperty(e,"onStop",{enumerable:!0,get:function(){return t.onStop}}),Object.defineProperty(e,"onSet",{enumerable:!0,get:function(){return t.onSet}});var n=m0();Object.defineProperty(e,"cleanTasks",{enumerable:!0,get:function(){return n.cleanTasks}}),Object.defineProperty(e,"startTask",{enumerable:!0,get:function(){return n.startTask}}),Object.defineProperty(e,"allTasks",{enumerable:!0,get:function(){return n.allTasks}}),Object.defineProperty(e,"task",{enumerable:!0,get:function(){return n.task}});var r=AK();Object.defineProperty(e,"action",{enumerable:!0,get:function(){return r.action}}),Object.defineProperty(e,"actionFor",{enumerable:!0,get:function(){return r.actionFor}}),Object.defineProperty(e,"lastAction",{enumerable:!0,get:function(){return r.lastAction}});var a=Th();Object.defineProperty(e,"clean",{enumerable:!0,get:function(){return a.clean}}),Object.defineProperty(e,"cleanStores",{enumerable:!0,get:function(){return a.cleanStores}});var s=wK();Object.defineProperty(e,"mapTemplate",{enumerable:!0,get:function(){return s.mapTemplate}});var l=TK();Object.defineProperty(e,"listenKeys",{enumerable:!0,get:function(){return l.listenKeys}});var u=CK();Object.defineProperty(e,"keepMount",{enumerable:!0,get:function(){return u.keepMount}});var d=RK();Object.defineProperty(e,"computed",{enumerable:!0,get:function(){return d.computed}});var f=y0();Object.defineProperty(e,"atom",{enumerable:!0,get:function(){return f.atom}});var p=NO();Object.defineProperty(e,"map",{enumerable:!0,get:function(){return p.map}})})(Jg)),Jg}var mv=kK();const NK=typeof window>"u",OK=(e,t,n,r)=>{const a=mv.atom({data:null,error:null,isPending:!0,isRefetching:!1,refetch:u=>s(u)}),s=u=>{const d=typeof r=="function"?r({data:a.get().data,error:a.get().error,isPending:a.get().isPending}):r;n(t,{...d,query:{...d?.query,...u?.query},async onSuccess(f){a.set({data:f.data,error:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch}),await d?.onSuccess?.(f)},async onError(f){const{request:p}=f,g=typeof p.retry=="number"?p.retry:p.retry?.attempts,y=p.retryAttempt||0;g&&y<g||(a.set({error:f.error,data:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch}),await d?.onError?.(f))},async onRequest(f){const p=a.get();a.set({isPending:p.data===null,data:p.data,error:null,isRefetching:!0,refetch:a.value.refetch}),await d?.onRequest?.(f)}}).catch(f=>{a.set({error:f,data:null,isPending:!1,isRefetching:!1,refetch:a.value.refetch})})};e=Array.isArray(e)?e:[e];let l=!1;for(const u of e)u.subscribe(()=>{NK||(l?s():mv.onMount(a,()=>{const d=setTimeout(()=>{l||(s(),l=!0)},0);return()=>{a.off(),u.off(),clearTimeout(d)}}))});return a},IK={proto:/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,constructor:/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,protoShort:/"__proto__"\s*:/,constructorShort:/"constructor"\s*:/},DK=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/,UT={true:!0,false:!1,null:null,undefined:void 0,nan:Number.NaN,infinity:Number.POSITIVE_INFINITY,"-infinity":Number.NEGATIVE_INFINITY},jK=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,7}))?(?:Z|([+-])(\d{2}):(\d{2}))$/;function LK(e){return e instanceof Date&&!isNaN(e.getTime())}function PK(e){const t=jK.exec(e);if(!t)return null;const[,n,r,a,s,l,u,d,f,p,g]=t;let y=new Date(Date.UTC(parseInt(n,10),parseInt(r,10)-1,parseInt(a,10),parseInt(s,10),parseInt(l,10),parseInt(u,10),d?parseInt(d.padEnd(3,"0"),10):0));if(f){const _=(parseInt(p,10)*60+parseInt(g,10))*(f==="+"?-1:1);y.setUTCMinutes(y.getUTCMinutes()+_)}return LK(y)?y:null}function MK(e,t={}){const{strict:n=!1,warnings:r=!1,reviver:a,parseDates:s=!0}=t;if(typeof e!="string")return e;const l=e.trim();if(l.length>0&&l[0]==='"'&&l.endsWith('"')&&!l.slice(1,-1).includes('"'))return l.slice(1,-1);const u=l.toLowerCase();if(u.length<=9&&u in UT)return UT[u];if(!DK.test(l)){if(n)throw new SyntaxError("[better-json] Invalid JSON");return e}if(Object.entries(IK).some(([f,p])=>{const g=p.test(l);return g&&r&&console.warn(`[better-json] Detected potential prototype pollution attempt using ${f} pattern`),g})&&n)throw new Error("[better-json] Potential prototype pollution attempt detected");try{return JSON.parse(l,(p,g)=>{if(p==="__proto__"||p==="constructor"&&g&&typeof g=="object"&&"prototype"in g){r&&console.warn(`[better-json] Dropping "${p}" key to prevent prototype pollution`);return}if(s&&typeof g=="string"){const y=PK(g);if(y)return y}return a?a(p,g):g})}catch(f){if(n)throw f;return e}}function zK(e,t={strict:!0}){return MK(e,t)}const BK={id:"redirect",name:"Redirect",hooks:{onSuccess(e){if(e.data?.url&&e.data?.redirect&&typeof window<"u"&&window.location&&window.location)try{window.location.href=e.data.url}catch{}}}};function VK(e){const t=mv.atom(!1);return{session:OK(t,"/get-session",e,{method:"GET"}),$sessionSignal:t}}const UK=(e,t)=>{const n="credentials"in Request.prototype,r=xK(e?.baseURL,e?.basePath)??"/api/auth",a=e?.plugins?.flatMap(N=>N.fetchPlugins).filter(N=>N!==void 0)||[],s={id:"lifecycle-hooks",name:"lifecycle-hooks",hooks:{onSuccess:e?.fetchOptions?.onSuccess,onError:e?.fetchOptions?.onError,onRequest:e?.fetchOptions?.onRequest,onResponse:e?.fetchOptions?.onResponse}},{onSuccess:l,onError:u,onRequest:d,onResponse:f,...p}=e?.fetchOptions||{},g=bK({baseURL:r,...n?{credentials:"include"}:{},method:"GET",jsonParser(N){return N?zK(N,{strict:!1}):null},customFetchImpl:fetch,...p,plugins:[s,...p.plugins||[],...e?.disableDefaultFetchPlugins?[]:[BK],...a]}),{$sessionSignal:y,session:_}=VK(g),S=e?.plugins||[];let A={},C={$sessionSignal:y,session:_},w={"/sign-out":"POST","/revoke-sessions":"POST","/revoke-other-sessions":"POST","/delete-user":"POST"};const x=[{signal:"$sessionSignal",matcher(N){return N==="/sign-out"||N==="/update-user"||N.startsWith("/sign-in")||N.startsWith("/sign-up")||N==="/delete-user"||N==="/verify-email"}}];for(const N of S)N.getAtoms&&Object.assign(C,N.getAtoms?.(g)),N.pathMethods&&Object.assign(w,N.pathMethods),N.atomListeners&&x.push(...N.atomListeners);const T={notify:N=>{C[N].set(!C[N].get())},listen:(N,R)=>{C[N].subscribe(R)},atoms:C};for(const N of S)N.getActions&&Object.assign(A,N.getActions?.(g,T,e));return{get baseURL(){return r},pluginsActions:A,pluginsAtoms:C,pluginPathMethods:w,atomListeners:x,$fetch:g,$store:T}};function FK(e){return typeof e=="object"&&e!==null&&"get"in e&&typeof e.get=="function"&&"lc"in e&&typeof e.lc=="number"}function $K(e,t,n){const r=t[e],{fetchOptions:a,query:s,...l}=n||{};return r||(a?.method?a.method:l&&Object.keys(l).length>0?"POST":"GET")}function HK(e,t,n,r,a){function s(l=[]){return new Proxy(function(){},{get(u,d){if(d==="then"||d==="catch"||d==="finally")return;const f=[...l,d];let p=e;for(const g of f)if(p&&typeof p=="object"&&g in p)p=p[g];else{p=void 0;break}return typeof p=="function"||FK(p)?p:s(f)},apply:async(u,d,f)=>{const p="/"+l.map(x=>x.replace(/[A-Z]/g,T=>`-${T.toLowerCase()}`)).join("/"),g=f[0]||{},y=f[1]||{},{query:_,fetchOptions:S,...A}=g,C={...y,...S},w=$K(p,n,g);return await t(p,{...C,body:w==="GET"?void 0:{...A,...C?.body||{}},query:_||C?.query,method:w,async onSuccess(x){await C?.onSuccess?.(x);const T=a?.find(I=>I.matcher(p));if(!T)return;const N=r[T.signal];if(!N)return;const R=N.get();setTimeout(()=>{N.set(!R)},10)}})}})}return s()}function GK(e){return e.charAt(0).toUpperCase()+e.slice(1)}function KK(e){const{pluginPathMethods:t,pluginsActions:n,pluginsAtoms:r,$fetch:a,atomListeners:s,$store:l}=UK(e);let u={};for(const[p,g]of Object.entries(r))u[`use${GK(p)}`]=g;const d={...n,...u,$fetch:a,$store:l};return HK(d,a,t,r,s)}const OO=e=>{const t=e?.editor?.backendURL??rt.editor?.backendURL;if(!t)throw new Error("Backend URL is not defined in the Intlayer configuration.");const n=()=>KK({baseURL:t,withCredentials:!0});return{signInEmail:async(...q)=>n().signIn.email(...q),signUpEmail:async(...q)=>n().signUp.email(...q),signOut:async(...q)=>n().signOut(...q),signInSocial:async(...q)=>n().signIn.social(...q),linkSocial:async(...q)=>n().linkSocial(...q),changePasswordSession:async(...q)=>n().changePassword(...q),requestPasswordResetSession:async(...q)=>n().requestPasswordReset(...q),resetPassword:async(...q)=>n().resetPassword(...q),verifyEmailSession:async(...q)=>n().verifyEmail(...q),getSession:async(...q)=>n().getSession(...q),forgetPassword:async(...q)=>n().forgetPassword(...q),sendVerificationEmail:async(...q)=>n().sendVerificationEmail(...q),changeEmail:async(...q)=>n().changeEmail(...q),deleteUser:async(...q)=>n().deleteUser(...q),revokeSession:async(...q)=>n().revokeSession(...q),revokeSessions:async(...q)=>n().revokeSessions(...q),revokeOtherSessions:async(...q)=>n().revokeOtherSessions(...q),listAccounts:async(...q)=>n().listAccounts(...q),unlinkAccount:async(...q)=>n().unlinkAccount(...q),refreshToken:async(...q)=>n().refreshToken(...q),getAccessToken:async(...q)=>n().getAccessToken(...q),accountInfo:async(...q)=>n().accountInfo(...q),updateUser:async(...q)=>n().updateUser(...q),listSessions:async(...q)=>n().listSessions(...q)}},qK=(e,t)=>{const n=Gr(),r=t??n??rt,a=c0(),{data:s,isFetched:l,refetch:u}=wh({queryKey:["session"],queryFn:async()=>(await OO(r).getSession()).data,staleTime:0,gcTime:0,enabled:!e,refetchOnWindowFocus:!1,refetchOnMount:!1,refetchOnReconnect:!1,refetchInterval:!1,refetchIntervalInBackground:!1}),d=s??(l?null:void 0),f=y=>a.setQueryData(["session"],y),p=async()=>(await u()).data;return{session:d,fetchSession:p,revalidateSession:p,setSession:f}},cu=({session:e,intlayerConfiguration:t}={})=>{const{session:n,fetchSession:r,revalidateSession:a,setSession:s}=qK(e,t),{oAuth2AccessToken:l}=X8(t);return{session:n,fetchSession:r,setSession:s,revalidateSession:a,oAuth2AccessToken:l,isAuthenticated:!!(n?.user||l)}},xi=e=>{const t=Gr(),{oAuth2AccessToken:n}=cu();return NB({...n&&{headers:{Authorization:`Bearer ${n.accessToken}`}}},t)},WK=e=>{const t=Gr();return OO(t)},ZK=({requireUser:e,requireProject:t,requireOrganization:n})=>{const r=Gr(),{oAuth2AccessToken:a,session:s}=cu({intlayerConfiguration:r}),l=s?s.user:a?.user,u=s?s.organization:a?.organization,d=s?s.project:a?.project;return{enable:(e?!!l:!0)&&(t?!!d:!0)&&(n?!!u:!0)}},IO=e=>{const{requireUser:t,requireProject:n,requireOrganization:r,...a}=e,{enable:s}=ZK({requireUser:t,requireProject:n,requireOrganization:r});return wh({...a,enabled:a.enabled===!1?!1:s})},YK=()=>{const e=WK();return mo({mutationKey:["logout"],mutationFn:(...t)=>e.signOut(...t),meta:{invalidateQueries:[["session"],["users"],["organizations"],["projects"],["dictionaries"],["tags"]]}})},XK=e=>{const t=xi();return IO({queryKey:["projects",e],queryFn:({signal:n})=>t.project.getProjects(e,{signal:n}),requireUser:!0,requireOrganization:!0})},QK=()=>{const e=xi();return mo({mutationKey:["dictionaries"],mutationFn:e.dictionary.pushDictionaries,meta:{invalidateQueries:[["dictionaries"],["dictionariesKeys"]]}})},JK=()=>{const e=xi();return mo({mutationKey:["dictionaries"],mutationFn:e.dictionary.deleteDictionary,meta:{invalidateQueries:[["dictionaries"],["dictionariesKeys"]]}})},eq=e=>{const t=xi();return IO({queryKey:["tags",e],queryFn:({signal:n})=>t.tag.getTags(e,{signal:n}),requireUser:!0,requireOrganization:!0,requireProject:!0})},tq=()=>{const e=xi();return mo({mutationKey:["ai-auditContentDeclarationMetadata"],mutationFn:e.ai.auditContentDeclarationMetadata})},nq=()=>{const e=xi();return mo({mutationKey:["ai-auditContentDeclarationField"],mutationFn:e.ai.auditContentDeclarationField})},rq=()=>{const e=xi();return mo({mutationKey:["ai-autocomplete"],mutationFn:e.ai.autocomplete})},DO=()=>{const e=xi();return wh({queryKey:["editor","dictionaries"],queryFn:e.editor.getDictionaries})},iq=()=>{const e=xi();return mo({mutationKey:["editor","dictionaries"],mutationFn:e.editor.writeDictionary})};var uu=e=>e.type==="checkbox",Qa=e=>e instanceof Date,_n=e=>e==null;const jO=e=>typeof e=="object";var Vt=e=>!_n(e)&&!Array.isArray(e)&&jO(e)&&!Qa(e),LO=e=>Vt(e)&&e.target?uu(e.target)?e.target.checked:e.target.value:e,aq=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,PO=(e,t)=>e.has(aq(t)),oq=e=>{const t=e.constructor&&e.constructor.prototype;return Vt(t)&&t.hasOwnProperty("isPrototypeOf")},v0=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Gt(e){let t;const n=Array.isArray(e),r=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(v0&&(e instanceof Blob||r))&&(n||Vt(e)))if(t=n?[]:Object.create(Object.getPrototypeOf(e)),!n&&!oq(e))t=e;else for(const a in e)e.hasOwnProperty(a)&&(t[a]=Gt(e[a]));else return e;return t}var Ch=e=>/^\w*$/.test(e),Dt=e=>e===void 0,b0=e=>Array.isArray(e)?e.filter(Boolean):[],_0=e=>b0(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Ee=(e,t,n)=>{if(!t||!Vt(e))return n;const r=(Ch(t)?[t]:_0(t)).reduce((a,s)=>_n(a)?a:a[s],e);return Dt(r)||r===e?Dt(e[t])?n:e[t]:r},Un=e=>typeof e=="boolean",ct=(e,t,n)=>{let r=-1;const a=Ch(t)?[t]:_0(t),s=a.length,l=s-1;for(;++r<s;){const u=a[r];let d=n;if(r!==l){const f=e[u];d=Vt(f)||Array.isArray(f)?f:isNaN(+a[r+1])?{}:[]}if(u==="__proto__"||u==="constructor"||u==="prototype")return;e[u]=d,e=e[u]}};const Ff={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},_r={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},fi={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},E0=Oe.createContext(null);E0.displayName="HookFormContext";const pa=()=>Oe.useContext(E0),sq=e=>{const{children:t,...n}=e;return Oe.createElement(E0.Provider,{value:n},t)};var MO=(e,t,n,r=!0)=>{const a={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(a,s,{get:()=>{const l=s;return t._proxyFormState[l]!==_r.all&&(t._proxyFormState[l]=!r||_r.all),n&&(n[l]=!0),e[l]}});return a};const S0=typeof window<"u"?Oe.useLayoutEffect:Oe.useEffect;function lq(e){const t=pa(),{control:n=t.control,disabled:r,name:a,exact:s}=e||{},[l,u]=Oe.useState(n._formState),d=Oe.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return S0(()=>n._subscribe({name:a,formState:d.current,exact:s,callback:f=>{!r&&u({...n._formState,...f})}}),[a,r,s]),Oe.useEffect(()=>{d.current.isValid&&n._setValid(!0)},[n]),Oe.useMemo(()=>MO(l,n,d.current,!1),[l,n])}var Gn=e=>typeof e=="string",zO=(e,t,n,r,a)=>Gn(e)?(r&&t.watch.add(e),Ee(n,e,a)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),Ee(n,s))):(r&&(t.watchAll=!0),n),gv=e=>_n(e)||!jO(e);function pi(e,t,n=new WeakSet){if(gv(e)||gv(t))return e===t;if(Qa(e)&&Qa(t))return e.getTime()===t.getTime();const r=Object.keys(e),a=Object.keys(t);if(r.length!==a.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const s of r){const l=e[s];if(!a.includes(s))return!1;if(s!=="ref"){const u=t[s];if(Qa(l)&&Qa(u)||Vt(l)&&Vt(u)||Array.isArray(l)&&Array.isArray(u)?!pi(l,u,n):l!==u)return!1}}return!0}function cq(e){const t=pa(),{control:n=t.control,name:r,defaultValue:a,disabled:s,exact:l,compute:u}=e||{},d=Oe.useRef(a),f=Oe.useRef(u),p=Oe.useRef(void 0);f.current=u;const g=Oe.useMemo(()=>n._getWatch(r,d.current),[n,r]),[y,_]=Oe.useState(f.current?f.current(g):g);return S0(()=>n._subscribe({name:r,formState:{values:!0},exact:l,callback:S=>{if(!s){const A=zO(r,n._names,S.values||n._formValues,!1,d.current);if(f.current){const C=f.current(A);pi(C,p.current)||(_(C),p.current=C)}else _(A)}}}),[n,s,r,l]),Oe.useEffect(()=>n._removeUnmounted()),y}function uq(e){const t=pa(),{name:n,disabled:r,control:a=t.control,shouldUnregister:s,defaultValue:l}=e,u=PO(a._names.array,n),d=Oe.useMemo(()=>Ee(a._formValues,n,Ee(a._defaultValues,n,l)),[a,n,l]),f=cq({control:a,name:n,defaultValue:d,exact:!0}),p=lq({control:a,name:n,exact:!0}),g=Oe.useRef(e),y=Oe.useRef(void 0),_=Oe.useRef(a.register(n,{...e.rules,value:f,...Un(e.disabled)?{disabled:e.disabled}:{}}));g.current=e;const S=Oe.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Ee(p.errors,n)},isDirty:{enumerable:!0,get:()=>!!Ee(p.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Ee(p.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Ee(p.validatingFields,n)},error:{enumerable:!0,get:()=>Ee(p.errors,n)}}),[p,n]),A=Oe.useCallback(T=>_.current.onChange({target:{value:LO(T),name:n},type:Ff.CHANGE}),[n]),C=Oe.useCallback(()=>_.current.onBlur({target:{value:Ee(a._formValues,n),name:n},type:Ff.BLUR}),[n,a._formValues]),w=Oe.useCallback(T=>{const N=Ee(a._fields,n);N&&T&&(N._f.ref={focus:()=>T.focus&&T.focus(),select:()=>T.select&&T.select(),setCustomValidity:R=>T.setCustomValidity(R),reportValidity:()=>T.reportValidity()})},[a._fields,n]),x=Oe.useMemo(()=>({name:n,value:f,...Un(r)||p.disabled?{disabled:p.disabled||r}:{},onChange:A,onBlur:C,ref:w}),[n,r,p.disabled,A,C,w,f]);return Oe.useEffect(()=>{const T=a._options.shouldUnregister||s,N=y.current;N&&N!==n&&!u&&a.unregister(N),a.register(n,{...g.current.rules,...Un(g.current.disabled)?{disabled:g.current.disabled}:{}});const R=(I,D)=>{const L=Ee(a._fields,I);L&&L._f&&(L._f.mount=D)};if(R(n,!0),T){const I=Gt(Ee(a._options.defaultValues,n));ct(a._defaultValues,n,I),Dt(Ee(a._formValues,n))&&ct(a._formValues,n,I)}return!u&&a.register(n),y.current=n,()=>{(u?T&&!a._state.action:T)?a.unregister(n):R(n,!1)}},[n,a,u,s]),Oe.useEffect(()=>{a._setDisabledField({disabled:r,name:n})},[r,n,a]),Oe.useMemo(()=>({field:x,formState:p,fieldState:S}),[x,p,S])}const dq=e=>e.render(uq(e));var x0=(e,t,n,r,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:a||!0}}:{},Ec=e=>Array.isArray(e)?e:[e],FT=()=>{let e=[];return{get observers(){return e},next:a=>{for(const s of e)s.next&&s.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(s=>s!==a)}}),unsubscribe:()=>{e=[]}}};function BO(e,t){const n={};for(const r in e)if(e.hasOwnProperty(r)){const a=e[r],s=t[r];if(a&&Vt(a)&&s){const l=BO(a,s);Vt(l)&&(n[r]=l)}else e[r]&&(n[r]=s)}return n}var Nn=e=>Vt(e)&&!Object.keys(e).length,A0=e=>e.type==="file",Er=e=>typeof e=="function",$f=e=>{if(!v0)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},VO=e=>e.type==="select-multiple",w0=e=>e.type==="radio",fq=e=>w0(e)||uu(e),iy=e=>$f(e)&&e.isConnected;function hq(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=Dt(e)?r++:e[t[r++]];return e}function pq(e){for(const t in e)if(e.hasOwnProperty(t)&&!Dt(e[t]))return!1;return!0}function Pt(e,t){const n=Array.isArray(t)?t:Ch(t)?[t]:_0(t),r=n.length===1?e:hq(e,n),a=n.length-1,s=n[a];return r&&delete r[s],a!==0&&(Vt(r)&&Nn(r)||Array.isArray(r)&&pq(r))&&Pt(e,n.slice(0,-1)),e}var mq=e=>{for(const t in e)if(Er(e[t]))return!0;return!1};function UO(e){return Array.isArray(e)||Vt(e)&&!mq(e)}function yv(e,t={}){for(const n in e)UO(e[n])?(t[n]=Array.isArray(e[n])?[]:{},yv(e[n],t[n])):_n(e[n])||(t[n]=!0);return t}function ds(e,t,n){n||(n=yv(t));for(const r in e)UO(e[r])?Dt(t)||gv(n[r])?n[r]=yv(e[r],Array.isArray(e[r])?[]:{}):ds(e[r],_n(t)?{}:t[r],n[r]):n[r]=!pi(e[r],t[r]);return n}const $T={value:!1,isValid:!1},HT={value:!0,isValid:!0};var FO=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Dt(e[0].attributes.value)?Dt(e[0].value)||e[0].value===""?HT:{value:e[0].value,isValid:!0}:HT:$T}return $T},$O=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>Dt(e)?e:t?e===""?NaN:e&&+e:n&&Gn(e)?new Date(e):r?r(e):e;const GT={isValid:!1,value:null};var HO=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,GT):GT;function KT(e){const t=e.ref;return A0(t)?t.files:w0(t)?HO(e.refs).value:VO(t)?[...t.selectedOptions].map(({value:n})=>n):uu(t)?FO(e.refs).value:$O(Dt(t.value)?e.ref.value:t.value,e)}var gq=(e,t,n,r)=>{const a={};for(const s of e){const l=Ee(t,s);l&&ct(a,s,l._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:r}},Hf=e=>e instanceof RegExp,sc=e=>Dt(e)?e:Hf(e)?e.source:Vt(e)?Hf(e.value)?e.value.source:e.value:e,qT=e=>({isOnSubmit:!e||e===_r.onSubmit,isOnBlur:e===_r.onBlur,isOnChange:e===_r.onChange,isOnAll:e===_r.all,isOnTouch:e===_r.onTouched});const WT="AsyncFunction";var yq=e=>!!e&&!!e.validate&&!!(Er(e.validate)&&e.validate.constructor.name===WT||Vt(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===WT)),vq=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),ZT=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Sc=(e,t,n,r)=>{for(const a of n||Object.keys(e)){const s=Ee(e,a);if(s){const{_f:l,...u}=s;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],a)&&!r)return!0;if(l.ref&&t(l.ref,l.name)&&!r)return!0;if(Sc(u,t))break}else if(Vt(u)&&Sc(u,t))break}}};function YT(e,t,n){const r=Ee(e,n);if(r||Ch(n))return{error:r,name:n};const a=n.split(".");for(;a.length;){const s=a.join("."),l=Ee(t,s),u=Ee(e,s);if(l&&!Array.isArray(l)&&n!==s)return{name:n};if(u&&u.type)return{name:s,error:u};if(u&&u.root&&u.root.type)return{name:`${s}.root`,error:u.root};a.pop()}return{name:n}}var bq=(e,t,n,r)=>{n(e);const{name:a,...s}=e;return Nn(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(l=>t[l]===(!r||_r.all))},_q=(e,t,n)=>!e||!t||e===t||Ec(e).some(r=>r&&(n?r===t:r.startsWith(t)||t.startsWith(r))),Eq=(e,t,n,r,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(t||e):(n?r.isOnBlur:a.isOnBlur)?!e:(n?r.isOnChange:a.isOnChange)?e:!0,Sq=(e,t)=>!b0(Ee(e,t)).length&&Pt(e,t),xq=(e,t,n)=>{const r=Ec(Ee(e,n));return ct(r,"root",t[n]),ct(e,n,r),e};function XT(e,t,n="validate"){if(Gn(e)||Array.isArray(e)&&e.every(Gn)||Un(e)&&!e)return{type:n,message:Gn(e)?e:"",ref:t}}var ls=e=>Vt(e)&&!Hf(e)?e:{value:e,message:""},QT=async(e,t,n,r,a,s)=>{const{ref:l,refs:u,required:d,maxLength:f,minLength:p,min:g,max:y,pattern:_,validate:S,name:A,valueAsNumber:C,mount:w}=e._f,x=Ee(n,A);if(!w||t.has(A))return{};const T=u?u[0]:l,N=te=>{a&&T.reportValidity&&(T.setCustomValidity(Un(te)?"":te||""),T.reportValidity())},R={},I=w0(l),D=uu(l),L=I||D,H=(C||A0(l))&&Dt(l.value)&&Dt(x)||$f(l)&&l.value===""||x===""||Array.isArray(x)&&!x.length,Z=x0.bind(null,A,r,R),q=(te,ce,W,ae=fi.maxLength,M=fi.minLength)=>{const X=te?ce:W;R[A]={type:te?ae:M,message:X,ref:l,...Z(te?ae:M,X)}};if(s?!Array.isArray(x)||!x.length:d&&(!L&&(H||_n(x))||Un(x)&&!x||D&&!FO(u).isValid||I&&!HO(u).isValid)){const{value:te,message:ce}=Gn(d)?{value:!!d,message:d}:ls(d);if(te&&(R[A]={type:fi.required,message:ce,ref:T,...Z(fi.required,ce)},!r))return N(ce),R}if(!H&&(!_n(g)||!_n(y))){let te,ce;const W=ls(y),ae=ls(g);if(!_n(x)&&!isNaN(x)){const M=l.valueAsNumber||x&&+x;_n(W.value)||(te=M>W.value),_n(ae.value)||(ce=M<ae.value)}else{const M=l.valueAsDate||new Date(x),X=P=>new Date(new Date().toDateString()+" "+P),G=l.type=="time",ge=l.type=="week";Gn(W.value)&&x&&(te=G?X(x)>X(W.value):ge?x>W.value:M>new Date(W.value)),Gn(ae.value)&&x&&(ce=G?X(x)<X(ae.value):ge?x<ae.value:M<new Date(ae.value))}if((te||ce)&&(q(!!te,W.message,ae.message,fi.max,fi.min),!r))return N(R[A].message),R}if((f||p)&&!H&&(Gn(x)||s&&Array.isArray(x))){const te=ls(f),ce=ls(p),W=!_n(te.value)&&x.length>+te.value,ae=!_n(ce.value)&&x.length<+ce.value;if((W||ae)&&(q(W,te.message,ce.message),!r))return N(R[A].message),R}if(_&&!H&&Gn(x)){const{value:te,message:ce}=ls(_);if(Hf(te)&&!x.match(te)&&(R[A]={type:fi.pattern,message:ce,ref:l,...Z(fi.pattern,ce)},!r))return N(ce),R}if(S){if(Er(S)){const te=await S(x,n),ce=XT(te,T);if(ce&&(R[A]={...ce,...Z(fi.validate,ce.message)},!r))return N(ce.message),R}else if(Vt(S)){let te={};for(const ce in S){if(!Nn(te)&&!r)break;const W=XT(await S[ce](x,n),T,ce);W&&(te={...W,...Z(ce,W.message)},N(W.message),r&&(R[A]=te))}if(!Nn(te)&&(R[A]={ref:T,...te},!r))return R}}return N(!0),R};const Aq={mode:_r.onSubmit,reValidateMode:_r.onChange,shouldFocusError:!0};function wq(e={}){let t={...Aq,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Er(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},a=Vt(t.defaultValues)||Vt(t.values)?Gt(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:Gt(a),l={action:!1,mount:!1,watch:!1},u={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},d,f=0;const p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let g={...p};const y={array:FT(),state:FT()},_=t.criteriaMode===_r.all,S=V=>ee=>{clearTimeout(f),f=setTimeout(V,ee)},A=async V=>{if(!t.disabled&&(p.isValid||g.isValid||V)){const ee=t.resolver?Nn((await D()).errors):await H(r,!0);ee!==n.isValid&&y.state.next({isValid:ee})}},C=(V,ee)=>{!t.disabled&&(p.isValidating||p.validatingFields||g.isValidating||g.validatingFields)&&((V||Array.from(u.mount)).forEach(oe=>{oe&&(ee?ct(n.validatingFields,oe,ee):Pt(n.validatingFields,oe))}),y.state.next({validatingFields:n.validatingFields,isValidating:!Nn(n.validatingFields)}))},w=(V,ee=[],oe,Se,be=!0,ve=!0)=>{if(Se&&oe&&!t.disabled){if(l.action=!0,ve&&Array.isArray(Ee(r,V))){const Ce=oe(Ee(r,V),Se.argA,Se.argB);be&&ct(r,V,Ce)}if(ve&&Array.isArray(Ee(n.errors,V))){const Ce=oe(Ee(n.errors,V),Se.argA,Se.argB);be&&ct(n.errors,V,Ce),Sq(n.errors,V)}if((p.touchedFields||g.touchedFields)&&ve&&Array.isArray(Ee(n.touchedFields,V))){const Ce=oe(Ee(n.touchedFields,V),Se.argA,Se.argB);be&&ct(n.touchedFields,V,Ce)}(p.dirtyFields||g.dirtyFields)&&(n.dirtyFields=ds(a,s)),y.state.next({name:V,isDirty:q(V,ee),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else ct(s,V,ee)},x=(V,ee)=>{ct(n.errors,V,ee),y.state.next({errors:n.errors})},T=V=>{n.errors=V,y.state.next({errors:n.errors,isValid:!1})},N=(V,ee,oe,Se)=>{const be=Ee(r,V);if(be){const ve=Ee(s,V,Dt(oe)?Ee(a,V):oe);Dt(ve)||Se&&Se.defaultChecked||ee?ct(s,V,ee?ve:KT(be._f)):W(V,ve),l.mount&&A()}},R=(V,ee,oe,Se,be)=>{let ve=!1,Ce=!1;const Ve={name:V};if(!t.disabled){if(!oe||Se){(p.isDirty||g.isDirty)&&(Ce=n.isDirty,n.isDirty=Ve.isDirty=q(),ve=Ce!==Ve.isDirty);const Xe=pi(Ee(a,V),ee);Ce=!!Ee(n.dirtyFields,V),Xe?Pt(n.dirtyFields,V):ct(n.dirtyFields,V,!0),Ve.dirtyFields=n.dirtyFields,ve=ve||(p.dirtyFields||g.dirtyFields)&&Ce!==!Xe}if(oe){const Xe=Ee(n.touchedFields,V);Xe||(ct(n.touchedFields,V,oe),Ve.touchedFields=n.touchedFields,ve=ve||(p.touchedFields||g.touchedFields)&&Xe!==oe)}ve&&be&&y.state.next(Ve)}return ve?Ve:{}},I=(V,ee,oe,Se)=>{const be=Ee(n.errors,V),ve=(p.isValid||g.isValid)&&Un(ee)&&n.isValid!==ee;if(t.delayError&&oe?(d=S(()=>x(V,oe)),d(t.delayError)):(clearTimeout(f),d=null,oe?ct(n.errors,V,oe):Pt(n.errors,V)),(oe?!pi(be,oe):be)||!Nn(Se)||ve){const Ce={...Se,...ve&&Un(ee)?{isValid:ee}:{},errors:n.errors,name:V};n={...n,...Ce},y.state.next(Ce)}},D=async V=>{C(V,!0);const ee=await t.resolver(s,t.context,gq(V||u.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return C(V),ee},L=async V=>{const{errors:ee}=await D(V);if(V)for(const oe of V){const Se=Ee(ee,oe);Se?ct(n.errors,oe,Se):Pt(n.errors,oe)}else n.errors=ee;return ee},H=async(V,ee,oe={valid:!0})=>{for(const Se in V){const be=V[Se];if(be){const{_f:ve,...Ce}=be;if(ve){const Ve=u.array.has(ve.name),Xe=be._f&&yq(be._f);Xe&&p.validatingFields&&C([ve.name],!0);const pt=await QT(be,u.disabled,s,_,t.shouldUseNativeValidation&&!ee,Ve);if(Xe&&p.validatingFields&&C([ve.name]),pt[ve.name]&&(oe.valid=!1,ee))break;!ee&&(Ee(pt,ve.name)?Ve?xq(n.errors,pt,ve.name):ct(n.errors,ve.name,pt[ve.name]):Pt(n.errors,ve.name))}!Nn(Ce)&&await H(Ce,ee,oe)}}return oe.valid},Z=()=>{for(const V of u.unMount){const ee=Ee(r,V);ee&&(ee._f.refs?ee._f.refs.every(oe=>!iy(oe)):!iy(ee._f.ref))&&fe(V)}u.unMount=new Set},q=(V,ee)=>!t.disabled&&(V&&ee&&ct(s,V,ee),!pi(P(),a)),te=(V,ee,oe)=>zO(V,u,{...l.mount?s:Dt(ee)?a:Gn(V)?{[V]:ee}:ee},oe,ee),ce=V=>b0(Ee(l.mount?s:a,V,t.shouldUnregister?Ee(a,V,[]):[])),W=(V,ee,oe={})=>{const Se=Ee(r,V);let be=ee;if(Se){const ve=Se._f;ve&&(!ve.disabled&&ct(s,V,$O(ee,ve)),be=$f(ve.ref)&&_n(ee)?"":ee,VO(ve.ref)?[...ve.ref.options].forEach(Ce=>Ce.selected=be.includes(Ce.value)):ve.refs?uu(ve.ref)?ve.refs.forEach(Ce=>{(!Ce.defaultChecked||!Ce.disabled)&&(Array.isArray(be)?Ce.checked=!!be.find(Ve=>Ve===Ce.value):Ce.checked=be===Ce.value||!!be)}):ve.refs.forEach(Ce=>Ce.checked=Ce.value===be):A0(ve.ref)?ve.ref.value="":(ve.ref.value=be,ve.ref.type||y.state.next({name:V,values:Gt(s)})))}(oe.shouldDirty||oe.shouldTouch)&&R(V,be,oe.shouldTouch,oe.shouldDirty,!0),oe.shouldValidate&&ge(V)},ae=(V,ee,oe)=>{for(const Se in ee){if(!ee.hasOwnProperty(Se))return;const be=ee[Se],ve=V+"."+Se,Ce=Ee(r,ve);(u.array.has(V)||Vt(be)||Ce&&!Ce._f)&&!Qa(be)?ae(ve,be,oe):W(ve,be,oe)}},M=(V,ee,oe={})=>{const Se=Ee(r,V),be=u.array.has(V),ve=Gt(ee);ct(s,V,ve),be?(y.array.next({name:V,values:Gt(s)}),(p.isDirty||p.dirtyFields||g.isDirty||g.dirtyFields)&&oe.shouldDirty&&y.state.next({name:V,dirtyFields:ds(a,s),isDirty:q(V,ve)})):Se&&!Se._f&&!_n(ve)?ae(V,ve,oe):W(V,ve,oe),ZT(V,u)&&y.state.next({...n,name:V}),y.state.next({name:l.mount?V:void 0,values:Gt(s)})},X=async V=>{l.mount=!0;const ee=V.target;let oe=ee.name,Se=!0;const be=Ee(r,oe),ve=Xe=>{Se=Number.isNaN(Xe)||Qa(Xe)&&isNaN(Xe.getTime())||pi(Xe,Ee(s,oe,Xe))},Ce=qT(t.mode),Ve=qT(t.reValidateMode);if(be){let Xe,pt;const vo=ee.type?KT(be._f):LO(V),Cr=V.type===Ff.BLUR||V.type===Ff.FOCUS_OUT,Xh=!vq(be._f)&&!t.resolver&&!Ee(n.errors,oe)&&!be._f.deps||Eq(Cr,Ee(n.touchedFields,oe),n.isSubmitted,Ve,Ce),wi=ZT(oe,u,Cr);ct(s,oe,vo),Cr?(!ee||!ee.readOnly)&&(be._f.onBlur&&be._f.onBlur(V),d&&d(0)):be._f.onChange&&be._f.onChange(V);const Ti=R(oe,vo,Cr),Zr=!Nn(Ti)||wi;if(!Cr&&y.state.next({name:oe,type:V.type,values:Gt(s)}),Xh)return(p.isValid||g.isValid)&&(t.mode==="onBlur"?Cr&&A():Cr||A()),Zr&&y.state.next({name:oe,...wi?{}:Ti});if(!Cr&&wi&&y.state.next({...n}),t.resolver){const{errors:xa}=await D([oe]);if(ve(vo),Se){const Aa=YT(n.errors,r,oe),_u=YT(xa,r,Aa.name||oe);Xe=_u.error,oe=_u.name,pt=Nn(xa)}}else C([oe],!0),Xe=(await QT(be,u.disabled,s,_,t.shouldUseNativeValidation))[oe],C([oe]),ve(vo),Se&&(Xe?pt=!1:(p.isValid||g.isValid)&&(pt=await H(r,!0)));Se&&(be._f.deps&&(!Array.isArray(be._f.deps)||be._f.deps.length>0)&&ge(be._f.deps),I(oe,pt,Xe,Ti))}},G=(V,ee)=>{if(Ee(n.errors,ee)&&V.focus)return V.focus(),1},ge=async(V,ee={})=>{let oe,Se;const be=Ec(V);if(t.resolver){const ve=await L(Dt(V)?V:be);oe=Nn(ve),Se=V?!be.some(Ce=>Ee(ve,Ce)):oe}else V?(Se=(await Promise.all(be.map(async ve=>{const Ce=Ee(r,ve);return await H(Ce&&Ce._f?{[ve]:Ce}:Ce)}))).every(Boolean),!(!Se&&!n.isValid)&&A()):Se=oe=await H(r);return y.state.next({...!Gn(V)||(p.isValid||g.isValid)&&oe!==n.isValid?{}:{name:V},...t.resolver||!V?{isValid:oe}:{},errors:n.errors}),ee.shouldFocus&&!Se&&Sc(r,G,V?be:u.mount),Se},P=(V,ee)=>{let oe={...l.mount?s:a};return ee&&(oe=BO(ee.dirtyFields?n.dirtyFields:n.touchedFields,oe)),Dt(V)?oe:Gn(V)?Ee(oe,V):V.map(Se=>Ee(oe,Se))},ie=(V,ee)=>({invalid:!!Ee((ee||n).errors,V),isDirty:!!Ee((ee||n).dirtyFields,V),error:Ee((ee||n).errors,V),isValidating:!!Ee(n.validatingFields,V),isTouched:!!Ee((ee||n).touchedFields,V)}),F=V=>{V&&Ec(V).forEach(ee=>Pt(n.errors,ee)),y.state.next({errors:V?n.errors:{}})},J=(V,ee,oe)=>{const Se=(Ee(r,V,{_f:{}})._f||{}).ref,be=Ee(n.errors,V)||{},{ref:ve,message:Ce,type:Ve,...Xe}=be;ct(n.errors,V,{...Xe,...ee,ref:Se}),y.state.next({name:V,errors:n.errors,isValid:!1}),oe&&oe.shouldFocus&&Se&&Se.focus&&Se.focus()},se=(V,ee)=>Er(V)?y.state.subscribe({next:oe=>"values"in oe&&V(te(void 0,ee),oe)}):te(V,ee,!0),he=V=>y.state.subscribe({next:ee=>{_q(V.name,ee.name,V.exact)&&bq(ee,V.formState||p,un,V.reRenderRoot)&&V.callback({values:{...s},...n,...ee,defaultValues:a})}}).unsubscribe,ye=V=>(l.mount=!0,g={...g,...V.formState},he({...V,formState:g})),fe=(V,ee={})=>{for(const oe of V?Ec(V):u.mount)u.mount.delete(oe),u.array.delete(oe),ee.keepValue||(Pt(r,oe),Pt(s,oe)),!ee.keepError&&Pt(n.errors,oe),!ee.keepDirty&&Pt(n.dirtyFields,oe),!ee.keepTouched&&Pt(n.touchedFields,oe),!ee.keepIsValidating&&Pt(n.validatingFields,oe),!t.shouldUnregister&&!ee.keepDefaultValue&&Pt(a,oe);y.state.next({values:Gt(s)}),y.state.next({...n,...ee.keepDirty?{isDirty:q()}:{}}),!ee.keepIsValid&&A()},xe=({disabled:V,name:ee})=>{(Un(V)&&l.mount||V||u.disabled.has(ee))&&(V?u.disabled.add(ee):u.disabled.delete(ee))},je=(V,ee={})=>{let oe=Ee(r,V);const Se=Un(ee.disabled)||Un(t.disabled);return ct(r,V,{...oe||{},_f:{...oe&&oe._f?oe._f:{ref:{name:V}},name:V,mount:!0,...ee}}),u.mount.add(V),oe?xe({disabled:Un(ee.disabled)?ee.disabled:t.disabled,name:V}):N(V,!0,ee.value),{...Se?{disabled:ee.disabled||t.disabled}:{},...t.progressive?{required:!!ee.required,min:sc(ee.min),max:sc(ee.max),minLength:sc(ee.minLength),maxLength:sc(ee.maxLength),pattern:sc(ee.pattern)}:{},name:V,onChange:X,onBlur:X,ref:be=>{if(be){je(V,ee),oe=Ee(r,V);const ve=Dt(be.value)&&be.querySelectorAll&&be.querySelectorAll("input,select,textarea")[0]||be,Ce=fq(ve),Ve=oe._f.refs||[];if(Ce?Ve.find(Xe=>Xe===ve):ve===oe._f.ref)return;ct(r,V,{_f:{...oe._f,...Ce?{refs:[...Ve.filter(iy),ve,...Array.isArray(Ee(a,V))?[{}]:[]],ref:{type:ve.type,name:V}}:{ref:ve}}}),N(V,!1,void 0,ve)}else oe=Ee(r,V,{}),oe._f&&(oe._f.mount=!1),(t.shouldUnregister||ee.shouldUnregister)&&!(PO(u.array,V)&&l.action)&&u.unMount.add(V)}}},Be=()=>t.shouldFocusError&&Sc(r,G,u.mount),Ye=V=>{Un(V)&&(y.state.next({disabled:V}),Sc(r,(ee,oe)=>{const Se=Ee(r,oe);Se&&(ee.disabled=Se._f.disabled||V,Array.isArray(Se._f.refs)&&Se._f.refs.forEach(be=>{be.disabled=Se._f.disabled||V}))},0,!1))},et=(V,ee)=>async oe=>{let Se;oe&&(oe.preventDefault&&oe.preventDefault(),oe.persist&&oe.persist());let be=Gt(s);if(y.state.next({isSubmitting:!0}),t.resolver){const{errors:ve,values:Ce}=await D();n.errors=ve,be=Gt(Ce)}else await H(r);if(u.disabled.size)for(const ve of u.disabled)Pt(be,ve);if(Pt(n.errors,"root"),Nn(n.errors)){y.state.next({errors:{}});try{await V(be,oe)}catch(ve){Se=ve}}else ee&&await ee({...n.errors},oe),Be(),setTimeout(Be);if(y.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Nn(n.errors)&&!Se,submitCount:n.submitCount+1,errors:n.errors}),Se)throw Se},Zt=(V,ee={})=>{Ee(r,V)&&(Dt(ee.defaultValue)?M(V,Gt(Ee(a,V))):(M(V,ee.defaultValue),ct(a,V,Gt(ee.defaultValue))),ee.keepTouched||Pt(n.touchedFields,V),ee.keepDirty||(Pt(n.dirtyFields,V),n.isDirty=ee.defaultValue?q(V,Gt(Ee(a,V))):q()),ee.keepError||(Pt(n.errors,V),p.isValid&&A()),y.state.next({...n}))},An=(V,ee={})=>{const oe=V?Gt(V):a,Se=Gt(oe),be=Nn(V),ve=be?a:Se;if(ee.keepDefaultValues||(a=oe),!ee.keepValues){if(ee.keepDirtyValues){const Ce=new Set([...u.mount,...Object.keys(ds(a,s))]);for(const Ve of Array.from(Ce))Ee(n.dirtyFields,Ve)?ct(ve,Ve,Ee(s,Ve)):M(Ve,Ee(ve,Ve))}else{if(v0&&Dt(V))for(const Ce of u.mount){const Ve=Ee(r,Ce);if(Ve&&Ve._f){const Xe=Array.isArray(Ve._f.refs)?Ve._f.refs[0]:Ve._f.ref;if($f(Xe)){const pt=Xe.closest("form");if(pt){pt.reset();break}}}}if(ee.keepFieldsRef)for(const Ce of u.mount)M(Ce,Ee(ve,Ce));else r={}}s=t.shouldUnregister?ee.keepDefaultValues?Gt(a):{}:Gt(ve),y.array.next({values:{...ve}}),y.state.next({values:{...ve}})}u={mount:ee.keepDirtyValues?u.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!p.isValid||!!ee.keepIsValid||!!ee.keepDirtyValues,l.watch=!!t.shouldUnregister,y.state.next({submitCount:ee.keepSubmitCount?n.submitCount:0,isDirty:be?!1:ee.keepDirty?n.isDirty:!!(ee.keepDefaultValues&&!pi(V,a)),isSubmitted:ee.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:be?{}:ee.keepDirtyValues?ee.keepDefaultValues&&s?ds(a,s):n.dirtyFields:ee.keepDefaultValues&&V?ds(a,V):ee.keepDirty?n.dirtyFields:{},touchedFields:ee.keepTouched?n.touchedFields:{},errors:ee.keepErrors?n.errors:{},isSubmitSuccessful:ee.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:a})},Ai=(V,ee)=>An(Er(V)?V(s):V,ee),Sa=(V,ee={})=>{const oe=Ee(r,V),Se=oe&&oe._f;if(Se){const be=Se.refs?Se.refs[0]:Se.ref;be.focus&&(be.focus(),ee.shouldSelect&&Er(be.select)&&be.select())}},un=V=>{n={...n,...V}},Qs={control:{register:je,unregister:fe,getFieldState:ie,handleSubmit:et,setError:J,_subscribe:he,_runSchema:D,_focusError:Be,_getWatch:te,_getDirty:q,_setValid:A,_setFieldArray:w,_setDisabledField:xe,_setErrors:T,_getFieldArray:ce,_reset:An,_resetDefaultValues:()=>Er(t.defaultValues)&&t.defaultValues().then(V=>{Ai(V,t.resetOptions),y.state.next({isLoading:!1})}),_removeUnmounted:Z,_disableForm:Ye,_subjects:y,_proxyFormState:p,get _fields(){return r},get _formValues(){return s},get _state(){return l},set _state(V){l=V},get _defaultValues(){return a},get _names(){return u},set _names(V){u=V},get _formState(){return n},get _options(){return t},set _options(V){t={...t,...V}}},subscribe:ye,trigger:ge,register:je,handleSubmit:et,watch:se,setValue:M,getValues:P,reset:Ai,resetField:Zt,clearErrors:F,unregister:fe,setError:J,setFocus:Sa,getFieldState:ie};return{...Qs,formControl:Qs}}function Tq(e={}){const t=Oe.useRef(void 0),n=Oe.useRef(void 0),[r,a]=Oe.useState({isDirty:!1,isValidating:!1,isLoading:Er(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:Er(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:r},e.defaultValues&&!Er(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...u}=wq(e);t.current={...u,formState:r}}const s=t.current.control;return s._options=e,S0(()=>{const l=s._subscribe({formState:s._proxyFormState,callback:()=>a({...s._formState}),reRenderRoot:!0});return a(u=>({...u,isReady:!0})),s._formState.isReady=!0,l},[s]),Oe.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),Oe.useEffect(()=>{e.mode&&(s._options.mode=e.mode),e.reValidateMode&&(s._options.reValidateMode=e.reValidateMode)},[s,e.mode,e.reValidateMode]),Oe.useEffect(()=>{e.errors&&(s._setErrors(e.errors),s._focusError())},[s,e.errors]),Oe.useEffect(()=>{e.shouldUnregister&&s._subjects.state.next({values:s._getWatch()})},[s,e.shouldUnregister]),Oe.useEffect(()=>{if(s._proxyFormState.isDirty){const l=s._getDirty();l!==r.isDirty&&s._subjects.state.next({isDirty:l})}},[s,r.isDirty]),Oe.useEffect(()=>{e.values&&!pi(e.values,n.current)?(s._reset(e.values,{keepFieldsRef:!0,...s._options.resetOptions}),n.current=e.values,a(l=>({...l}))):s._resetDefaultValues()},[s,e.values]),Oe.useEffect(()=>{s._state.mount||(s._setValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),t.current.formState=MO(r,s),t.current}const JT=(e,t,n)=>{if(e&&"reportValidity"in e){const r=Ee(n,t);e.setCustomValidity(r&&r.message||""),e.reportValidity()}},vv=(e,t)=>{for(const n in t.fields){const r=t.fields[n];r&&r.ref&&"reportValidity"in r.ref?JT(r.ref,n,e):r&&r.refs&&r.refs.forEach(a=>JT(a,n,e))}},eC=(e,t)=>{t.shouldUseNativeValidation&&vv(e,t);const n={};for(const r in e){const a=Ee(t.fields,r),s=Object.assign(e[r]||{},{ref:a&&a.ref});if(Cq(t.names||Object.keys(e),r)){const l=Object.assign({},Ee(n,r));ct(l,"root",s),ct(n,r,l)}else ct(n,r,s)}return n},Cq=(e,t)=>{const n=tC(t);return e.some(r=>tC(r).match(`^${n}\\.\\d+`))};function tC(e){return e.replace(/\]|\[/g,"")}const Rq=e=>{const t=E.useId(),n=E.useMemo(()=>({id:t}),[t]);return v.jsx(GO,{value:n,children:v.jsx("div",{className:"flex flex-col gap-2 p-2",...e})})},GO=E.createContext({}),KO=E.createContext({}),kq=({...e})=>{const t=E.useMemo(()=>({name:e.name}),[e.name]);return v.jsx(KO,{value:t,children:v.jsx(dq,{...e})})},ma=()=>{const e=E.useContext(KO),t=E.useContext(GO),{getFieldState:n,formState:r}=pa(),a=n(e.name,r);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:s}=t;return{id:s,name:e.name,formItemId:`${s}-form-item`,formDescriptionId:`${s}-form-item-description`,formMessageId:`${s}-form-item-message`,...a}},qO=fr("",{variants:{variant:{default:["w-full select-text resize-none rounded-xl border-2 bg-input-background text-base md:text-sm text-input-text shadow-none outline-0 transition-all","border-input-border hover:border-input-border-hover focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]","aria-[invalid=true]:border-error","disabled:opacity-50"],invisible:["w-full border-none bg-inherit text-inherit outline-hidden ring-0"]},size:{md:"px-2 md:py-1 py-3",lg:"p-4 md:py-2"},validationStyleEnabled:{disabled:"",enabled:"valid:border-success invalid:border-error"}},defaultVariants:{variant:"default",size:"md",validationStyleEnabled:"disabled"}});var la=(e=>(e.DEFAULT="default",e.INVISIBLE="invisible",e))(la||{});const Gs=({validationStyleEnabled:e=!1,variant:t,size:n,className:r,...a})=>v.jsx("input",{className:qO({variant:t,size:n,validationStyleEnabled:e?"enabled":"disabled",className:r}),...a}),Nq=fr("",{variants:{variant:{default:["pointer rounded border-2 bg-input-background text-input-text shadow-none outline-0 transition-all","border-input-border hover:border-input-border-hover focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]","checked:bg-checkbox-checked checked:border-checkbox-checked-border","disabled:opacity-50"]},size:{sm:"size-4",md:"size-5",lg:"size-6"},color:{primary:"accent-primary",secondary:"accent-secondary",destructive:"accent-destructive",neutral:"accent-neutral",light:"accent-light",text:"accent-text",dark:"accent-dark",error:"accent-error",success:"accent-success",custom:"accent-custom"},validationStyleEnabled:{disabled:"",enabled:"valid:border-success invalid:border-error"}},defaultVariants:{variant:"default",color:"primary",validationStyleEnabled:"disabled",size:"md"}}),nC=({validationStyleEnabled:e=!1,label:t,size:n,color:r,name:a,variant:s,className:l,...u})=>v.jsx("input",{type:"checkbox",className:Nq({variant:s,size:n,color:r,validationStyleEnabled:e?"enabled":"disabled",className:l}),...u}),Oq=e=>{const{label:t,name:n,id:r}=e;return t?v.jsxs("label",{htmlFor:r??n,className:"flex items-center gap-x-4 font-medium text-sm cursor-pointer",children:[v.jsx(nC,{id:r??n,...e}),t]}):v.jsx(nC,{id:r??n,...e})},Iq=e=>{const[t,n]=E.useState(!1),r=s=>{s.preventDefault(),s.stopPropagation(),n(l=>!l)},a=t?Z2:q2;return v.jsxs("div",{className:"relative",children:[v.jsx(Gs,{...e,"aria-label":"password",type:t?"text":"password"}),v.jsx("button",{"data-testid":"eye-icon",className:"absolute right-2 h-full flex-row items-center",onClick:r,"aria-label":t?"Hide password":"Show password",children:v.jsx(a,{className:"text-neutral mr-2 inline-block",size:20})})]})},WO=({className:e,variant:t,validationStyleEnabled:n=!1,...r})=>v.jsx("textarea",{className:_e("resize-none",qO({variant:t,validationStyleEnabled:n?"enabled":"disabled",className:e})),...r}),ZO=({value:e="",onCancel:t,onSave:n,onClick:r,children:a,isDisabled:s,...l})=>{const[u,d]=E.useState(!1),f=E.useRef(null),p=S=>{S.stopPropagation(),d(!1),n()},g=S=>{S.stopPropagation(),d(!1),t()},y=!e||e===""?"-":e,_=E.useCallback(S=>{const A=window.getSelection();A&&A.toString().trim()!==""||f.current&&!f.current.contains(S.target)&&(d(!1),n())},[n]);return E.useEffect(()=>(u?document.addEventListener("click",_):document.removeEventListener("click",_),()=>document.removeEventListener("click",_)),[_,u]),v.jsxs("span",{className:"group/editable-field flex gap-2",role:"button",tabIndex:0,onClick:S=>{d(!0),r?.(S)},ref:f,...l,children:[v.jsxs("div",{className:_e("flex flex-1 gap-2",u?"display":"hidden"),children:[a,v.jsx(ot,{label:"Save",variant:at.HOVERABLE,size:qn.ICON_SM,color:it.TEXT,Icon:zs,onClick:p,disabled:s,className:"!text-current"}),v.jsx(ot,{label:"Cancel",color:it.TEXT,variant:at.HOVERABLE,className:"!text-current",size:qn.ICON_SM,Icon:po,onClick:g,disabled:s})]},String(u)),v.jsxs("div",{className:_e("flex flex-1 gap-2",u?"hidden":"display"),children:[v.jsx("span",{className:"ml-2 flex w-full whitespace-pre-wrap p-1 text-sm leading-6",children:y}),v.jsx(ot,{label:"Edit",Icon:N1,color:it.TEXT,variant:at.HOVERABLE,size:qn.ICON_SM,className:"invisible !text-current group-hover/editable-field:visible",disabled:s,onClick:S=>{S.stopPropagation(),d(!0)}})]})]})},YO=({onSave:e,onCancel:t,ref:n,...r})=>{const a=E.useRef(null),s=()=>{e?.(a.current?.value??"")},l=()=>{a.current&&(a.current.value=a.current.defaultValue??""),t?.()};E.useImperativeHandle(n,()=>a.current);const u=E.useMemo(()=>r.value??a.current?.value??r.defaultValue,[r.value,r.defaultValue,a.current?.value]);return v.jsx(ZO,{value:u,onCancel:l,onSave:s,children:v.jsx(Gs,{ref:a,...r})})},rC=24,iC=12,T0=({className:e,autoSize:t=!0,onChange:n,maxRows:r=999,ref:a,...s})=>{const l=E.useRef(null);E.useImperativeHandle(a,()=>l.current);const u=()=>{const p=l.current;if(!p||!t)return;const g=p.style;g.height="auto";const y=p.scrollHeight,_=rC*r+iC,S=rC+iC;g.height=Math.max(Math.min(y,_),S)+"px"};E.useEffect(()=>{u()},[s.value,s.defaultValue,u]);const d=p=>{n?.(p),u()},f=p=>{l.current=p,p&&u()};return v.jsx(WO,{ref:f,onChange:d,className:_e("overflow-y-auto",t?"resize-none":"",e),...s})},XO=({onSave:e,onCancel:t,ref:n,...r})=>{const a=E.useRef(null);E.useImperativeHandle(n,()=>a.current);const s=()=>{e?.(a.current?.value??"")},l=()=>{a.current&&(a.current.value=a.current.defaultValue??""),t?.()},u=r.value??a.current?.value??r.defaultValue??"";return v.jsx(ZO,{value:u,onCancel:l,onSave:s,onClick:d=>{d.preventDefault(),d.stopPropagation()},children:v.jsx(T0,{className:"leading-6",ref:a,onClick:d=>{d.preventDefault(),d.stopPropagation()},...r})})},QO=E.createContext(null),Rh=()=>{const e=E.useContext(QO);if(!e)throw new Error("useMultiSelect must be used within MultiSelectProvider");return e},Dq=({values:e,defaultValues:t,onValueChange:n,loop:r=!1,className:a,children:s,dir:l,...u})=>{const[d,f]=E.useState(t??[]),[p,g]=E.useState(""),[y,_]=E.useState(!1),[S,A]=E.useState(-1),C=E.useRef(null),[w,x]=E.useState(!1),[T,N]=E.useState("");E.useEffect(()=>{e&&f(e)},[e]);const R=E.useCallback(H=>{if(d.includes(H)){const Z=d.filter(q=>q!==H);f(Z),n?.(Z)}else{const Z=[...d,H];f(Z),n?.(Z)}},[d]),I=E.useCallback(H=>{H.preventDefault();const Z=H.currentTarget,q=Z.value.substring(Z.selectionStart??0,Z.selectionEnd??0);N(q),x(q===p)},[p]),D=E.useCallback(H=>{H.stopPropagation();const Z=C.current;if(!Z)return;const q=()=>{const W=S+1;A(W>d.length-1?r?0:-1:W)},te=()=>{const W=S-1;A(W<0?d.length-1:W)},ce=()=>{const W=S-1<=0?d.length-1===0?-1:0:S-1;A(W)};switch(H.key){case"ArrowLeft":l==="rtl"?d.length>0&&(S!==-1||r)&&q():d.length>0&&Z.selectionStart===0&&te();break;case"ArrowRight":l==="rtl"?d.length>0&&Z.selectionStart===0&&te():d.length>0&&(S!==-1||r)&&q();break;case"Backspace":case"Delete":d.length>0&&(S!==-1&&S<d.length?(R(d[S]),ce()):(Z.selectionStart===0&&T===p||w)&&R(d[d.length-1]));break;case"Enter":_(!0);break;case"Escape":S!==-1?A(-1):y&&_(!1);break}},[d,p,S,r]),L=E.useMemo(()=>({value:d,onValueChange:R,open:y,setOpen:_,inputValue:p,setInputValue:g,activeIndex:S,setActiveIndex:A,ref:C,handleSelect:I}),[d,R,y,_,p,g,S,A,C,I]);return v.jsx(QO,{value:L,children:v.jsx(Rk,{onKeyDown:D,className:_e("flex w-full flex-col gap-2 overflow-visible bg-transparent",a),dir:l,...u,children:s})})},jq=({className:e,getBadgeValue:t=s=>s,validationStyleEnabled:n=!1,children:r,...a})=>{const{value:s,onValueChange:l,activeIndex:u}=Rh(),d=E.useCallback(f=>{f.preventDefault(),f.stopPropagation()},[]);return v.jsxs("div",{className:_e("flex w-full flex-col gap-3 rounded-lg p-1 py-2","border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring focus:outline-hidden flex w-full items-center justify-between whitespace-nowrap border px-3 py-2 text-sm focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1","bg-input-background text-input-text w-full select-text resize-none rounded-xl border-2 px-2 py-1 text-sm shadow-none outline-0 transition-all","border-input-border hover:border-input-border-hover focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]","aria-[invalid=true]:border-error",n&&"valid:border-success invalid:border-error",e),...a,children:[s.length>0&&v.jsx("div",{className:"flex w-full flex-wrap gap-1",children:s.map((f,p)=>v.jsxs(WF,{className:_e("flex items-center gap-1 rounded-xl px-1",u===p&&"ring-muted-foreground ring-2"),color:G1.TEXT,children:[v.jsx("span",{className:"text-xs",children:t(f)}),v.jsxs("button",{"aria-label":`Remove ${f} option`,"aria-roledescription":"button to remove option",onMouseDown:d,onClick:()=>l(f),children:[v.jsxs("span",{className:"sr-only",children:["Remove ",f," option"]}),v.jsx(po,{className:"size-4 cursor-pointer"})]})]},f))}),r]})},Lq=({className:e,...t})=>{const{setOpen:n,inputValue:r,setInputValue:a,activeIndex:s,setActiveIndex:l,handleSelect:u,ref:d}=Rh();return v.jsx(jf.Input,{...t,tabIndex:0,ref:d,value:r,onValueChange:s===-1?a:void 0,onSelect:u,onBlur:()=>n(!1),onFocus:()=>n(!0),onClick:()=>l(-1),className:_e("outline-hidden ml-2 flex-1 cursor-pointer",e,s!==-1&&"caret-transparent")})},Pq=({children:e})=>{const{open:t}=Rh();return v.jsx("div",{className:"relative",children:t&&e})},Mq=({className:e,children:t})=>v.jsxs(jf.List,{className:_e("border-muted bg-input-background absolute top-0 z-10 flex w-full flex-col gap-2 rounded-lg border p-2 shadow-md transition-colors",e),children:[t,v.jsx(jf.Empty,{children:v.jsx("span",{className:"text-muted-foreground",children:"No results found"})})]}),zq=({className:e,value:t,children:n,...r})=>{const{value:a,onValueChange:s,setInputValue:l}=Rh(),u=E.useCallback(f=>{f.preventDefault(),f.stopPropagation()},[]),d=a.includes(t);return v.jsxs(jf.Item,{...r,onSelect:()=>{s(t),l("")},className:_e("flex cursor-pointer justify-between rounded-lg px-2 py-1 transition-colors","hover:bg-neutral/10",e,d&&"opacity-50",r.disabled&&"cursor-not-allowed opacity-50"),onMouseDown:u,children:[n,d&&v.jsx(zs,{className:"size-4"})]})},mn=Dq;mn.Trigger=jq;mn.Input=Lq;mn.Content=Pq;mn.List=Mq;mn.Item=zq;const Bq=({className:e,children:t,...n})=>v.jsxs("i",{className:_e("text-xs text-neutral-400",e),...n,children:["ⓘ ",t]}),bv=({htmlFor:e,...t})=>v.jsx("label",{className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",htmlFor:e,...t}),Vq=({className:e,...t})=>{const{error:n,formItemId:r}=ma();return v.jsx(bv,{className:_e("mb-2",n&&"text-error",e),htmlFor:r,...t})},Uq=({isRequired:e})=>e?v.jsx("span",{"aria-label":"Asterisk meaning the field is required",children:"*"}):v.jsx(v.Fragment,{}),JO=({children:e,isRequired:t,info:n,htmlFor:r,className:a})=>v.jsxs("div",{className:"ml-1 flex gap-1 align-middle text-base leading-none",children:[e&&v.jsxs(Vq,{htmlFor:r,id:`${r}-label`,className:gh("font-bold",a),children:[e,v.jsx(Uq,{isRequired:t})]}),n&&v.jsx(Bq,{content:n})]});function aC(e,[t,n]){return Math.min(n,Math.max(t,e))}function eI(e){const t=e+"CollectionProvider",[n,r]=tu(t),[a,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=A=>{const{scope:C,children:w}=A,x=Oe.useRef(null),T=Oe.useRef(new Map).current;return v.jsx(a,{scope:C,itemMap:T,collectionRef:x,children:w})};l.displayName=t;const u=e+"CollectionSlot",d=Rs(u),f=Oe.forwardRef((A,C)=>{const{scope:w,children:x}=A,T=s(u,w),N=wt(C,T.collectionRef);return v.jsx(d,{ref:N,children:x})});f.displayName=u;const p=e+"CollectionItemSlot",g="data-radix-collection-item",y=Rs(p),_=Oe.forwardRef((A,C)=>{const{scope:w,children:x,...T}=A,N=Oe.useRef(null),R=wt(C,N),I=s(p,w);return Oe.useEffect(()=>(I.itemMap.set(N,{ref:N,...T}),()=>void I.itemMap.delete(N))),v.jsx(y,{[g]:"",ref:R,children:x})});_.displayName=p;function S(A){const C=s(e+"CollectionConsumer",A);return Oe.useCallback(()=>{const x=C.collectionRef.current;if(!x)return[];const T=Array.from(x.querySelectorAll(`[${g}]`));return Array.from(C.itemMap.values()).sort((I,D)=>T.indexOf(I.ref.current)-T.indexOf(D.ref.current))},[C.collectionRef,C.itemMap])}return[{Provider:l,Slot:f,ItemSlot:_},S,r]}var Fq=E.createContext(void 0);function $q(e){const t=E.useContext(Fq);return e||t||"ltr"}const Hq=["top","right","bottom","left"],ca=Math.min,$n=Math.max,Gf=Math.round,Gd=Math.floor,Fr=e=>({x:e,y:e}),Gq={left:"right",right:"left",bottom:"top",top:"bottom"},Kq={start:"end",end:"start"};function _v(e,t,n){return $n(e,ca(t,n))}function bi(e,t){return typeof e=="function"?e(t):e}function _i(e){return e.split("-")[0]}function Ks(e){return e.split("-")[1]}function C0(e){return e==="x"?"y":"x"}function R0(e){return e==="y"?"height":"width"}const qq=new Set(["top","bottom"]);function zr(e){return qq.has(_i(e))?"y":"x"}function k0(e){return C0(zr(e))}function Wq(e,t,n){n===void 0&&(n=!1);const r=Ks(e),a=k0(e),s=R0(a);let l=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=Kf(l)),[l,Kf(l)]}function Zq(e){const t=Kf(e);return[Ev(e),t,Ev(t)]}function Ev(e){return e.replace(/start|end/g,t=>Kq[t])}const oC=["left","right"],sC=["right","left"],Yq=["top","bottom"],Xq=["bottom","top"];function Qq(e,t,n){switch(e){case"top":case"bottom":return n?t?sC:oC:t?oC:sC;case"left":case"right":return t?Yq:Xq;default:return[]}}function Jq(e,t,n,r){const a=Ks(e);let s=Qq(_i(e),n==="start",r);return a&&(s=s.map(l=>l+"-"+a),t&&(s=s.concat(s.map(Ev)))),s}function Kf(e){return e.replace(/left|right|bottom|top/g,t=>Gq[t])}function e9(e){return{top:0,right:0,bottom:0,left:0,...e}}function tI(e){return typeof e!="number"?e9(e):{top:e,right:e,bottom:e,left:e}}function qf(e){const{x:t,y:n,width:r,height:a}=e;return{width:r,height:a,top:n,left:t,right:t+r,bottom:n+a,x:t,y:n}}function lC(e,t,n){let{reference:r,floating:a}=e;const s=zr(t),l=k0(t),u=R0(l),d=_i(t),f=s==="y",p=r.x+r.width/2-a.width/2,g=r.y+r.height/2-a.height/2,y=r[u]/2-a[u]/2;let _;switch(d){case"top":_={x:p,y:r.y-a.height};break;case"bottom":_={x:p,y:r.y+r.height};break;case"right":_={x:r.x+r.width,y:g};break;case"left":_={x:r.x-a.width,y:g};break;default:_={x:r.x,y:r.y}}switch(Ks(t)){case"start":_[l]-=y*(n&&f?-1:1);break;case"end":_[l]+=y*(n&&f?-1:1);break}return _}const t9=async(e,t,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:s=[],platform:l}=n,u=s.filter(Boolean),d=await(l.isRTL==null?void 0:l.isRTL(t));let f=await l.getElementRects({reference:e,floating:t,strategy:a}),{x:p,y:g}=lC(f,r,d),y=r,_={},S=0;for(let A=0;A<u.length;A++){const{name:C,fn:w}=u[A],{x,y:T,data:N,reset:R}=await w({x:p,y:g,initialPlacement:r,placement:y,strategy:a,middlewareData:_,rects:f,platform:l,elements:{reference:e,floating:t}});p=x??p,g=T??g,_={..._,[C]:{..._[C],...N}},R&&S<=50&&(S++,typeof R=="object"&&(R.placement&&(y=R.placement),R.rects&&(f=R.rects===!0?await l.getElementRects({reference:e,floating:t,strategy:a}):R.rects),{x:p,y:g}=lC(f,y,d)),A=-1)}return{x:p,y:g,placement:y,strategy:a,middlewareData:_}};async function zc(e,t){var n;t===void 0&&(t={});const{x:r,y:a,platform:s,rects:l,elements:u,strategy:d}=e,{boundary:f="clippingAncestors",rootBoundary:p="viewport",elementContext:g="floating",altBoundary:y=!1,padding:_=0}=bi(t,e),S=tI(_),C=u[y?g==="floating"?"reference":"floating":g],w=qf(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(C)))==null||n?C:C.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(u.floating)),boundary:f,rootBoundary:p,strategy:d})),x=g==="floating"?{x:r,y:a,width:l.floating.width,height:l.floating.height}:l.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u.floating)),N=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},R=qf(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:x,offsetParent:T,strategy:d}):x);return{top:(w.top-R.top+S.top)/N.y,bottom:(R.bottom-w.bottom+S.bottom)/N.y,left:(w.left-R.left+S.left)/N.x,right:(R.right-w.right+S.right)/N.x}}const n9=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:a,rects:s,platform:l,elements:u,middlewareData:d}=t,{element:f,padding:p=0}=bi(e,t)||{};if(f==null)return{};const g=tI(p),y={x:n,y:r},_=k0(a),S=R0(_),A=await l.getDimensions(f),C=_==="y",w=C?"top":"left",x=C?"bottom":"right",T=C?"clientHeight":"clientWidth",N=s.reference[S]+s.reference[_]-y[_]-s.floating[S],R=y[_]-s.reference[_],I=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f));let D=I?I[T]:0;(!D||!await(l.isElement==null?void 0:l.isElement(I)))&&(D=u.floating[T]||s.floating[S]);const L=N/2-R/2,H=D/2-A[S]/2-1,Z=ca(g[w],H),q=ca(g[x],H),te=Z,ce=D-A[S]-q,W=D/2-A[S]/2+L,ae=_v(te,W,ce),M=!d.arrow&&Ks(a)!=null&&W!==ae&&s.reference[S]/2-(W<te?Z:q)-A[S]/2<0,X=M?W<te?W-te:W-ce:0;return{[_]:y[_]+X,data:{[_]:ae,centerOffset:W-ae-X,...M&&{alignmentOffset:X}},reset:M}}}),r9=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:a,middlewareData:s,rects:l,initialPlacement:u,platform:d,elements:f}=t,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:y,fallbackStrategy:_="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:A=!0,...C}=bi(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=_i(a),x=zr(u),T=_i(u)===u,N=await(d.isRTL==null?void 0:d.isRTL(f.floating)),R=y||(T||!A?[Kf(u)]:Zq(u)),I=S!=="none";!y&&I&&R.push(...Jq(u,A,S,N));const D=[u,...R],L=await zc(t,C),H=[];let Z=((r=s.flip)==null?void 0:r.overflows)||[];if(p&&H.push(L[w]),g){const W=Wq(a,l,N);H.push(L[W[0]],L[W[1]])}if(Z=[...Z,{placement:a,overflows:H}],!H.every(W=>W<=0)){var q,te;const W=(((q=s.flip)==null?void 0:q.index)||0)+1,ae=D[W];if(ae&&(!(g==="alignment"?x!==zr(ae):!1)||Z.every(G=>zr(G.placement)===x?G.overflows[0]>0:!0)))return{data:{index:W,overflows:Z},reset:{placement:ae}};let M=(te=Z.filter(X=>X.overflows[0]<=0).sort((X,G)=>X.overflows[1]-G.overflows[1])[0])==null?void 0:te.placement;if(!M)switch(_){case"bestFit":{var ce;const X=(ce=Z.filter(G=>{if(I){const ge=zr(G.placement);return ge===x||ge==="y"}return!0}).map(G=>[G.placement,G.overflows.filter(ge=>ge>0).reduce((ge,P)=>ge+P,0)]).sort((G,ge)=>G[1]-ge[1])[0])==null?void 0:ce[0];X&&(M=X);break}case"initialPlacement":M=u;break}if(a!==M)return{reset:{placement:M}}}return{}}}};function cC(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uC(e){return Hq.some(t=>e[t]>=0)}const i9=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...a}=bi(e,t);switch(r){case"referenceHidden":{const s=await zc(t,{...a,elementContext:"reference"}),l=cC(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:uC(l)}}}case"escaped":{const s=await zc(t,{...a,altBoundary:!0}),l=cC(s,n.floating);return{data:{escapedOffsets:l,escaped:uC(l)}}}default:return{}}}}},nI=new Set(["left","top"]);async function a9(e,t){const{placement:n,platform:r,elements:a}=e,s=await(r.isRTL==null?void 0:r.isRTL(a.floating)),l=_i(n),u=Ks(n),d=zr(n)==="y",f=nI.has(l)?-1:1,p=s&&d?-1:1,g=bi(t,e);let{mainAxis:y,crossAxis:_,alignmentAxis:S}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof S=="number"&&(_=u==="end"?S*-1:S),d?{x:_*p,y:y*f}:{x:y*f,y:_*p}}const o9=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:a,y:s,placement:l,middlewareData:u}=t,d=await a9(t,e);return l===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:a+d.x,y:s+d.y,data:{...d,placement:l}}}}},s9=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:a}=t,{mainAxis:s=!0,crossAxis:l=!1,limiter:u={fn:C=>{let{x:w,y:x}=C;return{x:w,y:x}}},...d}=bi(e,t),f={x:n,y:r},p=await zc(t,d),g=zr(_i(a)),y=C0(g);let _=f[y],S=f[g];if(s){const C=y==="y"?"top":"left",w=y==="y"?"bottom":"right",x=_+p[C],T=_-p[w];_=_v(x,_,T)}if(l){const C=g==="y"?"top":"left",w=g==="y"?"bottom":"right",x=S+p[C],T=S-p[w];S=_v(x,S,T)}const A=u.fn({...t,[y]:_,[g]:S});return{...A,data:{x:A.x-n,y:A.y-r,enabled:{[y]:s,[g]:l}}}}}},l9=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:a,rects:s,middlewareData:l}=t,{offset:u=0,mainAxis:d=!0,crossAxis:f=!0}=bi(e,t),p={x:n,y:r},g=zr(a),y=C0(g);let _=p[y],S=p[g];const A=bi(u,t),C=typeof A=="number"?{mainAxis:A,crossAxis:0}:{mainAxis:0,crossAxis:0,...A};if(d){const T=y==="y"?"height":"width",N=s.reference[y]-s.floating[T]+C.mainAxis,R=s.reference[y]+s.reference[T]-C.mainAxis;_<N?_=N:_>R&&(_=R)}if(f){var w,x;const T=y==="y"?"width":"height",N=nI.has(_i(a)),R=s.reference[g]-s.floating[T]+(N&&((w=l.offset)==null?void 0:w[g])||0)+(N?0:C.crossAxis),I=s.reference[g]+s.reference[T]+(N?0:((x=l.offset)==null?void 0:x[g])||0)-(N?C.crossAxis:0);S<R?S=R:S>I&&(S=I)}return{[y]:_,[g]:S}}}},c9=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:a,rects:s,platform:l,elements:u}=t,{apply:d=()=>{},...f}=bi(e,t),p=await zc(t,f),g=_i(a),y=Ks(a),_=zr(a)==="y",{width:S,height:A}=s.floating;let C,w;g==="top"||g==="bottom"?(C=g,w=y===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(w=g,C=y==="end"?"top":"bottom");const x=A-p.top-p.bottom,T=S-p.left-p.right,N=ca(A-p[C],x),R=ca(S-p[w],T),I=!t.middlewareData.shift;let D=N,L=R;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(L=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(D=x),I&&!y){const Z=$n(p.left,0),q=$n(p.right,0),te=$n(p.top,0),ce=$n(p.bottom,0);_?L=S-2*(Z!==0||q!==0?Z+q:$n(p.left,p.right)):D=A-2*(te!==0||ce!==0?te+ce:$n(p.top,p.bottom))}await d({...t,availableWidth:L,availableHeight:D});const H=await l.getDimensions(u.floating);return S!==H.width||A!==H.height?{reset:{rects:!0}}:{}}}};function kh(){return typeof window<"u"}function qs(e){return rI(e)?(e.nodeName||"").toLowerCase():"#document"}function Wn(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function qr(e){var t;return(t=(rI(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function rI(e){return kh()?e instanceof Node||e instanceof Wn(e).Node:!1}function xr(e){return kh()?e instanceof Element||e instanceof Wn(e).Element:!1}function Hr(e){return kh()?e instanceof HTMLElement||e instanceof Wn(e).HTMLElement:!1}function dC(e){return!kh()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Wn(e).ShadowRoot}const u9=new Set(["inline","contents"]);function du(e){const{overflow:t,overflowX:n,overflowY:r,display:a}=Ar(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!u9.has(a)}const d9=new Set(["table","td","th"]);function f9(e){return d9.has(qs(e))}const h9=[":popover-open",":modal"];function Nh(e){return h9.some(t=>{try{return e.matches(t)}catch{return!1}})}const p9=["transform","translate","scale","rotate","perspective"],m9=["transform","translate","scale","rotate","perspective","filter"],g9=["paint","layout","strict","content"];function N0(e){const t=O0(),n=xr(e)?Ar(e):e;return p9.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||m9.some(r=>(n.willChange||"").includes(r))||g9.some(r=>(n.contain||"").includes(r))}function y9(e){let t=ua(e);for(;Hr(t)&&!Os(t);){if(N0(t))return t;if(Nh(t))return null;t=ua(t)}return null}function O0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const v9=new Set(["html","body","#document"]);function Os(e){return v9.has(qs(e))}function Ar(e){return Wn(e).getComputedStyle(e)}function Oh(e){return xr(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function ua(e){if(qs(e)==="html")return e;const t=e.assignedSlot||e.parentNode||dC(e)&&e.host||qr(e);return dC(t)?t.host:t}function iI(e){const t=ua(e);return Os(t)?e.ownerDocument?e.ownerDocument.body:e.body:Hr(t)&&du(t)?t:iI(t)}function Bc(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=iI(e),s=a===((r=e.ownerDocument)==null?void 0:r.body),l=Wn(a);if(s){const u=Sv(l);return t.concat(l,l.visualViewport||[],du(a)?a:[],u&&n?Bc(u):[])}return t.concat(a,Bc(a,[],n))}function Sv(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function aI(e){const t=Ar(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const a=Hr(e),s=a?e.offsetWidth:n,l=a?e.offsetHeight:r,u=Gf(n)!==s||Gf(r)!==l;return u&&(n=s,r=l),{width:n,height:r,$:u}}function I0(e){return xr(e)?e:e.contextElement}function Ss(e){const t=I0(e);if(!Hr(t))return Fr(1);const n=t.getBoundingClientRect(),{width:r,height:a,$:s}=aI(t);let l=(s?Gf(n.width):n.width)/r,u=(s?Gf(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const b9=Fr(0);function oI(e){const t=Wn(e);return!O0()||!t.visualViewport?b9:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _9(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Wn(e)?!1:t}function so(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),s=I0(e);let l=Fr(1);t&&(r?xr(r)&&(l=Ss(r)):l=Ss(e));const u=_9(s,n,r)?oI(s):Fr(0);let d=(a.left+u.x)/l.x,f=(a.top+u.y)/l.y,p=a.width/l.x,g=a.height/l.y;if(s){const y=Wn(s),_=r&&xr(r)?Wn(r):r;let S=y,A=Sv(S);for(;A&&r&&_!==S;){const C=Ss(A),w=A.getBoundingClientRect(),x=Ar(A),T=w.left+(A.clientLeft+parseFloat(x.paddingLeft))*C.x,N=w.top+(A.clientTop+parseFloat(x.paddingTop))*C.y;d*=C.x,f*=C.y,p*=C.x,g*=C.y,d+=T,f+=N,S=Wn(A),A=Sv(S)}}return qf({width:p,height:g,x:d,y:f})}function Ih(e,t){const n=Oh(e).scrollLeft;return t?t.left+n:so(qr(e)).left+n}function sI(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Ih(e,n),a=n.top+t.scrollTop;return{x:r,y:a}}function E9(e){let{elements:t,rect:n,offsetParent:r,strategy:a}=e;const s=a==="fixed",l=qr(r),u=t?Nh(t.floating):!1;if(r===l||u&&s)return n;let d={scrollLeft:0,scrollTop:0},f=Fr(1);const p=Fr(0),g=Hr(r);if((g||!g&&!s)&&((qs(r)!=="body"||du(l))&&(d=Oh(r)),Hr(r))){const _=so(r);f=Ss(r),p.x=_.x+r.clientLeft,p.y=_.y+r.clientTop}const y=l&&!g&&!s?sI(l,d):Fr(0);return{width:n.width*f.x,height:n.height*f.y,x:n.x*f.x-d.scrollLeft*f.x+p.x+y.x,y:n.y*f.y-d.scrollTop*f.y+p.y+y.y}}function S9(e){return Array.from(e.getClientRects())}function x9(e){const t=qr(e),n=Oh(e),r=e.ownerDocument.body,a=$n(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=$n(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let l=-n.scrollLeft+Ih(e);const u=-n.scrollTop;return Ar(r).direction==="rtl"&&(l+=$n(t.clientWidth,r.clientWidth)-a),{width:a,height:s,x:l,y:u}}const fC=25;function A9(e,t){const n=Wn(e),r=qr(e),a=n.visualViewport;let s=r.clientWidth,l=r.clientHeight,u=0,d=0;if(a){s=a.width,l=a.height;const p=O0();(!p||p&&t==="fixed")&&(u=a.offsetLeft,d=a.offsetTop)}const f=Ih(r);if(f<=0){const p=r.ownerDocument,g=p.body,y=getComputedStyle(g),_=p.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,S=Math.abs(r.clientWidth-g.clientWidth-_);S<=fC&&(s-=S)}else f<=fC&&(s+=f);return{width:s,height:l,x:u,y:d}}const w9=new Set(["absolute","fixed"]);function T9(e,t){const n=so(e,!0,t==="fixed"),r=n.top+e.clientTop,a=n.left+e.clientLeft,s=Hr(e)?Ss(e):Fr(1),l=e.clientWidth*s.x,u=e.clientHeight*s.y,d=a*s.x,f=r*s.y;return{width:l,height:u,x:d,y:f}}function hC(e,t,n){let r;if(t==="viewport")r=A9(e,n);else if(t==="document")r=x9(qr(e));else if(xr(t))r=T9(t,n);else{const a=oI(e);r={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return qf(r)}function lI(e,t){const n=ua(e);return n===t||!xr(n)||Os(n)?!1:Ar(n).position==="fixed"||lI(n,t)}function C9(e,t){const n=t.get(e);if(n)return n;let r=Bc(e,[],!1).filter(u=>xr(u)&&qs(u)!=="body"),a=null;const s=Ar(e).position==="fixed";let l=s?ua(e):e;for(;xr(l)&&!Os(l);){const u=Ar(l),d=N0(l);!d&&u.position==="fixed"&&(a=null),(s?!d&&!a:!d&&u.position==="static"&&!!a&&w9.has(a.position)||du(l)&&!d&&lI(e,l))?r=r.filter(p=>p!==l):a=u,l=ua(l)}return t.set(e,r),r}function R9(e){let{element:t,boundary:n,rootBoundary:r,strategy:a}=e;const l=[...n==="clippingAncestors"?Nh(t)?[]:C9(t,this._c):[].concat(n),r],u=l[0],d=l.reduce((f,p)=>{const g=hC(t,p,a);return f.top=$n(g.top,f.top),f.right=ca(g.right,f.right),f.bottom=ca(g.bottom,f.bottom),f.left=$n(g.left,f.left),f},hC(t,u,a));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function k9(e){const{width:t,height:n}=aI(e);return{width:t,height:n}}function N9(e,t,n){const r=Hr(t),a=qr(t),s=n==="fixed",l=so(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const d=Fr(0);function f(){d.x=Ih(a)}if(r||!r&&!s)if((qs(t)!=="body"||du(a))&&(u=Oh(t)),r){const _=so(t,!0,s,t);d.x=_.x+t.clientLeft,d.y=_.y+t.clientTop}else a&&f();s&&!r&&a&&f();const p=a&&!r&&!s?sI(a,u):Fr(0),g=l.left+u.scrollLeft-d.x-p.x,y=l.top+u.scrollTop-d.y-p.y;return{x:g,y,width:l.width,height:l.height}}function ay(e){return Ar(e).position==="static"}function pC(e,t){if(!Hr(e)||Ar(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return qr(e)===n&&(n=n.ownerDocument.body),n}function cI(e,t){const n=Wn(e);if(Nh(e))return n;if(!Hr(e)){let a=ua(e);for(;a&&!Os(a);){if(xr(a)&&!ay(a))return a;a=ua(a)}return n}let r=pC(e,t);for(;r&&f9(r)&&ay(r);)r=pC(r,t);return r&&Os(r)&&ay(r)&&!N0(r)?n:r||y9(e)||n}const O9=async function(e){const t=this.getOffsetParent||cI,n=this.getDimensions,r=await n(e.floating);return{reference:N9(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function I9(e){return Ar(e).direction==="rtl"}const D9={convertOffsetParentRelativeRectToViewportRelativeRect:E9,getDocumentElement:qr,getClippingRect:R9,getOffsetParent:cI,getElementRects:O9,getClientRects:S9,getDimensions:k9,getScale:Ss,isElement:xr,isRTL:I9};function uI(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function j9(e,t){let n=null,r;const a=qr(e);function s(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function l(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),s();const f=e.getBoundingClientRect(),{left:p,top:g,width:y,height:_}=f;if(u||t(),!y||!_)return;const S=Gd(g),A=Gd(a.clientWidth-(p+y)),C=Gd(a.clientHeight-(g+_)),w=Gd(p),T={rootMargin:-S+"px "+-A+"px "+-C+"px "+-w+"px",threshold:$n(0,ca(1,d))||1};let N=!0;function R(I){const D=I[0].intersectionRatio;if(D!==d){if(!N)return l();D?l(!1,D):r=setTimeout(()=>{l(!1,1e-7)},1e3)}D===1&&!uI(f,e.getBoundingClientRect())&&l(),N=!1}try{n=new IntersectionObserver(R,{...T,root:a.ownerDocument})}catch{n=new IntersectionObserver(R,T)}n.observe(e)}return l(!0),s}function L9(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:s=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=r,f=I0(e),p=a||s?[...f?Bc(f):[],...Bc(t)]:[];p.forEach(w=>{a&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const g=f&&u?j9(f,n):null;let y=-1,_=null;l&&(_=new ResizeObserver(w=>{let[x]=w;x&&x.target===f&&_&&(_.unobserve(t),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var T;(T=_)==null||T.observe(t)})),n()}),f&&!d&&_.observe(f),_.observe(t));let S,A=d?so(e):null;d&&C();function C(){const w=so(e);A&&!uI(A,w)&&n(),A=w,S=requestAnimationFrame(C)}return n(),()=>{var w;p.forEach(x=>{a&&x.removeEventListener("scroll",n),s&&x.removeEventListener("resize",n)}),g?.(),(w=_)==null||w.disconnect(),_=null,d&&cancelAnimationFrame(S)}}const P9=o9,M9=s9,z9=r9,B9=c9,V9=i9,mC=n9,U9=l9,F9=(e,t,n)=>{const r=new Map,a={platform:D9,...n},s={...a.platform,_c:r};return t9(e,t,{...a,platform:s})};var $9=typeof document<"u",H9=function(){},_f=$9?E.useLayoutEffect:H9;function Wf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Wf(e[r],t[r]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,a[r]))return!1;for(r=n;r--!==0;){const s=a[r];if(!(s==="_owner"&&e.$$typeof)&&!Wf(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function dI(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function gC(e,t){const n=dI(e);return Math.round(t*n)/n}function oy(e){const t=E.useRef(e);return _f(()=>{t.current=e}),t}function G9(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:s,floating:l}={},transform:u=!0,whileElementsMounted:d,open:f}=e,[p,g]=E.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[y,_]=E.useState(r);Wf(y,r)||_(r);const[S,A]=E.useState(null),[C,w]=E.useState(null),x=E.useCallback(G=>{G!==I.current&&(I.current=G,A(G))},[]),T=E.useCallback(G=>{G!==D.current&&(D.current=G,w(G))},[]),N=s||S,R=l||C,I=E.useRef(null),D=E.useRef(null),L=E.useRef(p),H=d!=null,Z=oy(d),q=oy(a),te=oy(f),ce=E.useCallback(()=>{if(!I.current||!D.current)return;const G={placement:t,strategy:n,middleware:y};q.current&&(G.platform=q.current),F9(I.current,D.current,G).then(ge=>{const P={...ge,isPositioned:te.current!==!1};W.current&&!Wf(L.current,P)&&(L.current=P,ho.flushSync(()=>{g(P)}))})},[y,t,n,q,te]);_f(()=>{f===!1&&L.current.isPositioned&&(L.current.isPositioned=!1,g(G=>({...G,isPositioned:!1})))},[f]);const W=E.useRef(!1);_f(()=>(W.current=!0,()=>{W.current=!1}),[]),_f(()=>{if(N&&(I.current=N),R&&(D.current=R),N&&R){if(Z.current)return Z.current(N,R,ce);ce()}},[N,R,ce,Z,H]);const ae=E.useMemo(()=>({reference:I,floating:D,setReference:x,setFloating:T}),[x,T]),M=E.useMemo(()=>({reference:N,floating:R}),[N,R]),X=E.useMemo(()=>{const G={position:n,left:0,top:0};if(!M.floating)return G;const ge=gC(M.floating,p.x),P=gC(M.floating,p.y);return u?{...G,transform:"translate("+ge+"px, "+P+"px)",...dI(M.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ge,top:P}},[n,u,M.floating,p.x,p.y]);return E.useMemo(()=>({...p,update:ce,refs:ae,elements:M,floatingStyles:X}),[p,ce,ae,M,X])}const K9=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:a}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?mC({element:r.current,padding:a}).fn(n):{}:r?mC({element:r,padding:a}).fn(n):{}}}},q9=(e,t)=>({...P9(e),options:[e,t]}),W9=(e,t)=>({...M9(e),options:[e,t]}),Z9=(e,t)=>({...U9(e),options:[e,t]}),Y9=(e,t)=>({...z9(e),options:[e,t]}),X9=(e,t)=>({...B9(e),options:[e,t]}),Q9=(e,t)=>({...V9(e),options:[e,t]}),J9=(e,t)=>({...K9(e),options:[e,t]});var e7="Arrow",fI=E.forwardRef((e,t)=>{const{children:n,width:r=10,height:a=5,...s}=e;return v.jsx(He.svg,{...s,ref:t,width:r,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:v.jsx("polygon",{points:"0,0 30,0 15,10"})})});fI.displayName=e7;var t7=fI;function n7(e){const[t,n]=E.useState(void 0);return ln(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const s=a[0];let l,u;if("borderBoxSize"in s){const d=s.borderBoxSize,f=Array.isArray(d)?d[0]:d;l=f.inlineSize,u=f.blockSize}else l=e.offsetWidth,u=e.offsetHeight;n({width:l,height:u})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var D0="Popper",[hI,pI]=tu(D0),[r7,mI]=hI(D0),gI=e=>{const{__scopePopper:t,children:n}=e,[r,a]=E.useState(null);return v.jsx(r7,{scope:t,anchor:r,onAnchorChange:a,children:n})};gI.displayName=D0;var yI="PopperAnchor",vI=E.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...a}=e,s=mI(yI,n),l=E.useRef(null),u=wt(t,l),d=E.useRef(null);return E.useEffect(()=>{const f=d.current;d.current=r?.current||l.current,f!==d.current&&s.onAnchorChange(d.current)}),r?null:v.jsx(He.div,{...a,ref:u})});vI.displayName=yI;var j0="PopperContent",[i7,a7]=hI(j0),bI=E.forwardRef((e,t)=>{const{__scopePopper:n,side:r="bottom",sideOffset:a=0,align:s="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:f=[],collisionPadding:p=0,sticky:g="partial",hideWhenDetached:y=!1,updatePositionStrategy:_="optimized",onPlaced:S,...A}=e,C=mI(j0,n),[w,x]=E.useState(null),T=wt(t,fe=>x(fe)),[N,R]=E.useState(null),I=n7(N),D=I?.width??0,L=I?.height??0,H=r+(s!=="center"?"-"+s:""),Z=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},q=Array.isArray(f)?f:[f],te=q.length>0,ce={padding:Z,boundary:q.filter(s7),altBoundary:te},{refs:W,floatingStyles:ae,placement:M,isPositioned:X,middlewareData:G}=G9({strategy:"fixed",placement:H,whileElementsMounted:(...fe)=>L9(...fe,{animationFrame:_==="always"}),elements:{reference:C.anchor},middleware:[q9({mainAxis:a+L,alignmentAxis:l}),d&&W9({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?Z9():void 0,...ce}),d&&Y9({...ce}),X9({...ce,apply:({elements:fe,rects:xe,availableWidth:je,availableHeight:Be})=>{const{width:Ye,height:et}=xe.reference,Zt=fe.floating.style;Zt.setProperty("--radix-popper-available-width",`${je}px`),Zt.setProperty("--radix-popper-available-height",`${Be}px`),Zt.setProperty("--radix-popper-anchor-width",`${Ye}px`),Zt.setProperty("--radix-popper-anchor-height",`${et}px`)}}),N&&J9({element:N,padding:u}),l7({arrowWidth:D,arrowHeight:L}),y&&Q9({strategy:"referenceHidden",...ce})]}),[ge,P]=SI(M),ie=Sr(S);ln(()=>{X&&ie?.()},[X,ie]);const F=G.arrow?.x,J=G.arrow?.y,se=G.arrow?.centerOffset!==0,[he,ye]=E.useState();return ln(()=>{w&&ye(window.getComputedStyle(w).zIndex)},[w]),v.jsx("div",{ref:W.setFloating,"data-radix-popper-content-wrapper":"",style:{...ae,transform:X?ae.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:he,"--radix-popper-transform-origin":[G.transformOrigin?.x,G.transformOrigin?.y].join(" "),...G.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:v.jsx(i7,{scope:n,placedSide:ge,onArrowChange:R,arrowX:F,arrowY:J,shouldHideArrow:se,children:v.jsx(He.div,{"data-side":ge,"data-align":P,...A,ref:T,style:{...A.style,animation:X?void 0:"none"}})})})});bI.displayName=j0;var _I="PopperArrow",o7={top:"bottom",right:"left",bottom:"top",left:"right"},EI=E.forwardRef(function(t,n){const{__scopePopper:r,...a}=t,s=a7(_I,r),l=o7[s.placedSide];return v.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:v.jsx(t7,{...a,ref:n,style:{...a.style,display:"block"}})})});EI.displayName=_I;function s7(e){return e!==null}var l7=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:r,middlewareData:a}=t,l=a.arrow?.centerOffset!==0,u=l?0:e.arrowWidth,d=l?0:e.arrowHeight,[f,p]=SI(n),g={start:"0%",center:"50%",end:"100%"}[p],y=(a.arrow?.x??0)+u/2,_=(a.arrow?.y??0)+d/2;let S="",A="";return f==="bottom"?(S=l?g:`${y}px`,A=`${-d}px`):f==="top"?(S=l?g:`${y}px`,A=`${r.floating.height+d}px`):f==="right"?(S=`${-d}px`,A=l?g:`${_}px`):f==="left"&&(S=`${r.floating.width+d}px`,A=l?g:`${_}px`),{data:{x:S,y:A}}}});function SI(e){const[t,n="center"]=e.split("-");return[t,n]}var c7=gI,u7=vI,d7=bI,f7=EI;function h7(e){const t=E.useRef({value:e,previous:e});return E.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var xI=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"}),p7="VisuallyHidden",L0=E.forwardRef((e,t)=>v.jsx(He.span,{...e,ref:t,style:{...xI,...e.style}}));L0.displayName=p7;var m7=[" ","Enter","ArrowUp","ArrowDown"],g7=[" ","Enter"],lo="Select",[Dh,jh,y7]=eI(lo),[Ws]=tu(lo,[y7,pI]),Lh=pI(),[v7,ga]=Ws(lo),[b7,_7]=Ws(lo),AI=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:a,onOpenChange:s,value:l,defaultValue:u,onValueChange:d,dir:f,name:p,autoComplete:g,disabled:y,required:_,form:S}=e,A=Lh(t),[C,w]=E.useState(null),[x,T]=E.useState(null),[N,R]=E.useState(!1),I=$q(f),[D,L]=If({prop:r,defaultProp:a??!1,onChange:s,caller:lo}),[H,Z]=If({prop:l,defaultProp:u,onChange:d,caller:lo}),q=E.useRef(null),te=C?S||!!C.closest("form"):!0,[ce,W]=E.useState(new Set),ae=Array.from(ce).map(M=>M.props.value).join(";");return v.jsx(c7,{...A,children:v.jsxs(v7,{required:_,scope:t,trigger:C,onTriggerChange:w,valueNode:x,onValueNodeChange:T,valueNodeHasChildren:N,onValueNodeHasChildrenChange:R,contentId:ur(),value:H,onValueChange:Z,open:D,onOpenChange:L,dir:I,triggerPointerDownPosRef:q,disabled:y,children:[v.jsx(Dh.Provider,{scope:t,children:v.jsx(b7,{scope:e.__scopeSelect,onNativeOptionAdd:E.useCallback(M=>{W(X=>new Set(X).add(M))},[]),onNativeOptionRemove:E.useCallback(M=>{W(X=>{const G=new Set(X);return G.delete(M),G})},[]),children:n})}),te?v.jsxs(ZI,{"aria-hidden":!0,required:_,tabIndex:-1,name:p,autoComplete:g,value:H,onChange:M=>Z(M.target.value),disabled:y,form:S,children:[H===void 0?v.jsx("option",{value:""}):null,Array.from(ce)]},ae):null]})})};AI.displayName=lo;var wI="SelectTrigger",TI=E.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...a}=e,s=Lh(n),l=ga(wI,n),u=l.disabled||r,d=wt(t,l.onTriggerChange),f=jh(n),p=E.useRef("touch"),[g,y,_]=XI(A=>{const C=f().filter(T=>!T.disabled),w=C.find(T=>T.value===l.value),x=QI(C,A,w);x!==void 0&&l.onValueChange(x.value)}),S=A=>{u||(l.onOpenChange(!0),_()),A&&(l.triggerPointerDownPosRef.current={x:Math.round(A.pageX),y:Math.round(A.pageY)})};return v.jsx(u7,{asChild:!0,...s,children:v.jsx(He.button,{type:"button",role:"combobox","aria-controls":l.contentId,"aria-expanded":l.open,"aria-required":l.required,"aria-autocomplete":"none",dir:l.dir,"data-state":l.open?"open":"closed",disabled:u,"data-disabled":u?"":void 0,"data-placeholder":YI(l.value)?"":void 0,...a,ref:d,onClick:Qe(a.onClick,A=>{A.currentTarget.focus(),p.current!=="mouse"&&S(A)}),onPointerDown:Qe(a.onPointerDown,A=>{p.current=A.pointerType;const C=A.target;C.hasPointerCapture(A.pointerId)&&C.releasePointerCapture(A.pointerId),A.button===0&&A.ctrlKey===!1&&A.pointerType==="mouse"&&(S(A),A.preventDefault())}),onKeyDown:Qe(a.onKeyDown,A=>{const C=g.current!=="";!(A.ctrlKey||A.altKey||A.metaKey)&&A.key.length===1&&y(A.key),!(C&&A.key===" ")&&m7.includes(A.key)&&(S(),A.preventDefault())})})})});TI.displayName=wI;var CI="SelectValue",RI=E.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,children:s,placeholder:l="",...u}=e,d=ga(CI,n),{onValueNodeHasChildrenChange:f}=d,p=s!==void 0,g=wt(t,d.onValueNodeChange);return ln(()=>{f(p)},[f,p]),v.jsx(He.span,{...u,ref:g,style:{pointerEvents:"none"},children:YI(d.value)?v.jsx(v.Fragment,{children:l}):s})});RI.displayName=CI;var E7="SelectIcon",kI=E.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...a}=e;return v.jsx(He.span,{"aria-hidden":!0,...a,ref:t,children:r||"▼"})});kI.displayName=E7;var S7="SelectPortal",NI=e=>v.jsx(vh,{asChild:!0,...e});NI.displayName=S7;var co="SelectContent",OI=E.forwardRef((e,t)=>{const n=ga(co,e.__scopeSelect),[r,a]=E.useState();if(ln(()=>{a(new DocumentFragment)},[]),!n.open){const s=r;return s?ho.createPortal(v.jsx(II,{scope:e.__scopeSelect,children:v.jsx(Dh.Slot,{scope:e.__scopeSelect,children:v.jsx("div",{children:e.children})})}),s):null}return v.jsx(DI,{...e,ref:t})});OI.displayName=co;var vr=10,[II,ya]=Ws(co),x7="SelectContentImpl",A7=Rs("SelectContent.RemoveScroll"),DI=E.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:s,onPointerDownOutside:l,side:u,sideOffset:d,align:f,alignOffset:p,arrowPadding:g,collisionBoundary:y,collisionPadding:_,sticky:S,hideWhenDetached:A,avoidCollisions:C,...w}=e,x=ga(co,n),[T,N]=E.useState(null),[R,I]=E.useState(null),D=wt(t,fe=>N(fe)),[L,H]=E.useState(null),[Z,q]=E.useState(null),te=jh(n),[ce,W]=E.useState(!1),ae=E.useRef(!1);E.useEffect(()=>{if(T)return sk(T)},[T]),Q1();const M=E.useCallback(fe=>{const[xe,...je]=te().map(et=>et.ref.current),[Be]=je.slice(-1),Ye=document.activeElement;for(const et of fe)if(et===Ye||(et?.scrollIntoView({block:"nearest"}),et===xe&&R&&(R.scrollTop=0),et===Be&&R&&(R.scrollTop=R.scrollHeight),et?.focus(),document.activeElement!==Ye))return},[te,R]),X=E.useCallback(()=>M([L,T]),[M,L,T]);E.useEffect(()=>{ce&&X()},[ce,X]);const{onOpenChange:G,triggerPointerDownPosRef:ge}=x;E.useEffect(()=>{if(T){let fe={x:0,y:0};const xe=Be=>{fe={x:Math.abs(Math.round(Be.pageX)-(ge.current?.x??0)),y:Math.abs(Math.round(Be.pageY)-(ge.current?.y??0))}},je=Be=>{fe.x<=10&&fe.y<=10?Be.preventDefault():T.contains(Be.target)||G(!1),document.removeEventListener("pointermove",xe),ge.current=null};return ge.current!==null&&(document.addEventListener("pointermove",xe),document.addEventListener("pointerup",je,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",xe),document.removeEventListener("pointerup",je,{capture:!0})}}},[T,G,ge]),E.useEffect(()=>{const fe=()=>G(!1);return window.addEventListener("blur",fe),window.addEventListener("resize",fe),()=>{window.removeEventListener("blur",fe),window.removeEventListener("resize",fe)}},[G]);const[P,ie]=XI(fe=>{const xe=te().filter(Ye=>!Ye.disabled),je=xe.find(Ye=>Ye.ref.current===document.activeElement),Be=QI(xe,fe,je);Be&&setTimeout(()=>Be.ref.current.focus())}),F=E.useCallback((fe,xe,je)=>{const Be=!ae.current&&!je;(x.value!==void 0&&x.value===xe||Be)&&(H(fe),Be&&(ae.current=!0))},[x.value]),J=E.useCallback(()=>T?.focus(),[T]),se=E.useCallback((fe,xe,je)=>{const Be=!ae.current&&!je;(x.value!==void 0&&x.value===xe||Be)&&q(fe)},[x.value]),he=r==="popper"?xv:jI,ye=he===xv?{side:u,sideOffset:d,align:f,alignOffset:p,arrowPadding:g,collisionBoundary:y,collisionPadding:_,sticky:S,hideWhenDetached:A,avoidCollisions:C}:{};return v.jsx(II,{scope:n,content:T,viewport:R,onViewportChange:I,itemRefCallback:F,selectedItem:L,onItemLeave:J,itemTextRefCallback:se,focusSelectedItem:X,selectedItemText:Z,position:r,isPositioned:ce,searchRef:P,children:v.jsx(Eb,{as:A7,allowPinchZoom:!0,children:v.jsx(_b,{asChild:!0,trapped:x.open,onMountAutoFocus:fe=>{fe.preventDefault()},onUnmountAutoFocus:Qe(a,fe=>{x.trigger?.focus({preventScroll:!0}),fe.preventDefault()}),children:v.jsx(yh,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:fe=>fe.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:v.jsx(he,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:fe=>fe.preventDefault(),...w,...ye,onPlaced:()=>W(!0),ref:D,style:{display:"flex",flexDirection:"column",outline:"none",...w.style},onKeyDown:Qe(w.onKeyDown,fe=>{const xe=fe.ctrlKey||fe.altKey||fe.metaKey;if(fe.key==="Tab"&&fe.preventDefault(),!xe&&fe.key.length===1&&ie(fe.key),["ArrowUp","ArrowDown","Home","End"].includes(fe.key)){let Be=te().filter(Ye=>!Ye.disabled).map(Ye=>Ye.ref.current);if(["ArrowUp","End"].includes(fe.key)&&(Be=Be.slice().reverse()),["ArrowUp","ArrowDown"].includes(fe.key)){const Ye=fe.target,et=Be.indexOf(Ye);Be=Be.slice(et+1)}setTimeout(()=>M(Be)),fe.preventDefault()}})})})})})})});DI.displayName=x7;var w7="SelectItemAlignedPosition",jI=E.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...a}=e,s=ga(co,n),l=ya(co,n),[u,d]=E.useState(null),[f,p]=E.useState(null),g=wt(t,D=>p(D)),y=jh(n),_=E.useRef(!1),S=E.useRef(!0),{viewport:A,selectedItem:C,selectedItemText:w,focusSelectedItem:x}=l,T=E.useCallback(()=>{if(s.trigger&&s.valueNode&&u&&f&&A&&C&&w){const D=s.trigger.getBoundingClientRect(),L=f.getBoundingClientRect(),H=s.valueNode.getBoundingClientRect(),Z=w.getBoundingClientRect();if(s.dir!=="rtl"){const Ye=Z.left-L.left,et=H.left-Ye,Zt=D.left-et,An=D.width+Zt,Ai=Math.max(An,L.width),Sa=window.innerWidth-vr,un=aC(et,[vr,Math.max(vr,Sa-Ai)]);u.style.minWidth=An+"px",u.style.left=un+"px"}else{const Ye=L.right-Z.right,et=window.innerWidth-H.right-Ye,Zt=window.innerWidth-D.right-et,An=D.width+Zt,Ai=Math.max(An,L.width),Sa=window.innerWidth-vr,un=aC(et,[vr,Math.max(vr,Sa-Ai)]);u.style.minWidth=An+"px",u.style.right=un+"px"}const q=y(),te=window.innerHeight-vr*2,ce=A.scrollHeight,W=window.getComputedStyle(f),ae=parseInt(W.borderTopWidth,10),M=parseInt(W.paddingTop,10),X=parseInt(W.borderBottomWidth,10),G=parseInt(W.paddingBottom,10),ge=ae+M+ce+G+X,P=Math.min(C.offsetHeight*5,ge),ie=window.getComputedStyle(A),F=parseInt(ie.paddingTop,10),J=parseInt(ie.paddingBottom,10),se=D.top+D.height/2-vr,he=te-se,ye=C.offsetHeight/2,fe=C.offsetTop+ye,xe=ae+M+fe,je=ge-xe;if(xe<=se){const Ye=q.length>0&&C===q[q.length-1].ref.current;u.style.bottom="0px";const et=f.clientHeight-A.offsetTop-A.offsetHeight,Zt=Math.max(he,ye+(Ye?J:0)+et+X),An=xe+Zt;u.style.height=An+"px"}else{const Ye=q.length>0&&C===q[0].ref.current;u.style.top="0px";const Zt=Math.max(se,ae+A.offsetTop+(Ye?F:0)+ye)+je;u.style.height=Zt+"px",A.scrollTop=xe-se+A.offsetTop}u.style.margin=`${vr}px 0`,u.style.minHeight=P+"px",u.style.maxHeight=te+"px",r?.(),requestAnimationFrame(()=>_.current=!0)}},[y,s.trigger,s.valueNode,u,f,A,C,w,s.dir,r]);ln(()=>T(),[T]);const[N,R]=E.useState();ln(()=>{f&&R(window.getComputedStyle(f).zIndex)},[f]);const I=E.useCallback(D=>{D&&S.current===!0&&(T(),x?.(),S.current=!1)},[T,x]);return v.jsx(C7,{scope:n,contentWrapper:u,shouldExpandOnScrollRef:_,onScrollButtonChange:I,children:v.jsx("div",{ref:d,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:N},children:v.jsx(He.div,{...a,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});jI.displayName=w7;var T7="SelectPopperPosition",xv=E.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:a=vr,...s}=e,l=Lh(n);return v.jsx(d7,{...l,...s,ref:t,align:r,collisionPadding:a,style:{boxSizing:"border-box",...s.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)"}})});xv.displayName=T7;var[C7,P0]=Ws(co,{}),Av="SelectViewport",LI=E.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...a}=e,s=ya(Av,n),l=P0(Av,n),u=wt(t,s.onViewportChange),d=E.useRef(0);return v.jsxs(v.Fragment,{children:[v.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:r}),v.jsx(Dh.Slot,{scope:n,children:v.jsx(He.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:u,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:Qe(a.onScroll,f=>{const p=f.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:y}=l;if(y?.current&&g){const _=Math.abs(d.current-p.scrollTop);if(_>0){const S=window.innerHeight-vr*2,A=parseFloat(g.style.minHeight),C=parseFloat(g.style.height),w=Math.max(A,C);if(w<S){const x=w+_,T=Math.min(S,x),N=x-T;g.style.height=T+"px",g.style.bottom==="0px"&&(p.scrollTop=N>0?N:0,g.style.justifyContent="flex-end")}}}d.current=p.scrollTop})})})]})});LI.displayName=Av;var PI="SelectGroup",[R7,k7]=Ws(PI),MI=E.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=ur();return v.jsx(R7,{scope:n,id:a,children:v.jsx(He.div,{role:"group","aria-labelledby":a,...r,ref:t})})});MI.displayName=PI;var zI="SelectLabel",BI=E.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=k7(zI,n);return v.jsx(He.div,{id:a.id,...r,ref:t})});BI.displayName=zI;var Zf="SelectItem",[N7,VI]=Ws(Zf),UI=E.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:a=!1,textValue:s,...l}=e,u=ga(Zf,n),d=ya(Zf,n),f=u.value===r,[p,g]=E.useState(s??""),[y,_]=E.useState(!1),S=wt(t,x=>d.itemRefCallback?.(x,r,a)),A=ur(),C=E.useRef("touch"),w=()=>{a||(u.onValueChange(r),u.onOpenChange(!1))};if(r==="")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 v.jsx(N7,{scope:n,value:r,disabled:a,textId:A,isSelected:f,onItemTextChange:E.useCallback(x=>{g(T=>T||(x?.textContent??"").trim())},[]),children:v.jsx(Dh.ItemSlot,{scope:n,value:r,disabled:a,textValue:p,children:v.jsx(He.div,{role:"option","aria-labelledby":A,"data-highlighted":y?"":void 0,"aria-selected":f&&y,"data-state":f?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:S,onFocus:Qe(l.onFocus,()=>_(!0)),onBlur:Qe(l.onBlur,()=>_(!1)),onClick:Qe(l.onClick,()=>{C.current!=="mouse"&&w()}),onPointerUp:Qe(l.onPointerUp,()=>{C.current==="mouse"&&w()}),onPointerDown:Qe(l.onPointerDown,x=>{C.current=x.pointerType}),onPointerMove:Qe(l.onPointerMove,x=>{C.current=x.pointerType,a?d.onItemLeave?.():C.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Qe(l.onPointerLeave,x=>{x.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:Qe(l.onKeyDown,x=>{d.searchRef?.current!==""&&x.key===" "||(g7.includes(x.key)&&w(),x.key===" "&&x.preventDefault())})})})})});UI.displayName=Zf;var hc="SelectItemText",FI=E.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:a,...s}=e,l=ga(hc,n),u=ya(hc,n),d=VI(hc,n),f=_7(hc,n),[p,g]=E.useState(null),y=wt(t,w=>g(w),d.onItemTextChange,w=>u.itemTextRefCallback?.(w,d.value,d.disabled)),_=p?.textContent,S=E.useMemo(()=>v.jsx("option",{value:d.value,disabled:d.disabled,children:_},d.value),[d.disabled,d.value,_]),{onNativeOptionAdd:A,onNativeOptionRemove:C}=f;return ln(()=>(A(S),()=>C(S)),[A,C,S]),v.jsxs(v.Fragment,{children:[v.jsx(He.span,{id:d.textId,...s,ref:y}),d.isSelected&&l.valueNode&&!l.valueNodeHasChildren?ho.createPortal(s.children,l.valueNode):null]})});FI.displayName=hc;var $I="SelectItemIndicator",HI=E.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return VI($I,n).isSelected?v.jsx(He.span,{"aria-hidden":!0,...r,ref:t}):null});HI.displayName=$I;var wv="SelectScrollUpButton",GI=E.forwardRef((e,t)=>{const n=ya(wv,e.__scopeSelect),r=P0(wv,e.__scopeSelect),[a,s]=E.useState(!1),l=wt(t,r.onScrollButtonChange);return ln(()=>{if(n.viewport&&n.isPositioned){let u=function(){const f=d.scrollTop>0;s(f)};const d=n.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),a?v.jsx(qI,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=n;u&&d&&(u.scrollTop=u.scrollTop-d.offsetHeight)}}):null});GI.displayName=wv;var Tv="SelectScrollDownButton",KI=E.forwardRef((e,t)=>{const n=ya(Tv,e.__scopeSelect),r=P0(Tv,e.__scopeSelect),[a,s]=E.useState(!1),l=wt(t,r.onScrollButtonChange);return ln(()=>{if(n.viewport&&n.isPositioned){let u=function(){const f=d.scrollHeight-d.clientHeight,p=Math.ceil(d.scrollTop)<f;s(p)};const d=n.viewport;return u(),d.addEventListener("scroll",u),()=>d.removeEventListener("scroll",u)}},[n.viewport,n.isPositioned]),a?v.jsx(qI,{...e,ref:l,onAutoScroll:()=>{const{viewport:u,selectedItem:d}=n;u&&d&&(u.scrollTop=u.scrollTop+d.offsetHeight)}}):null});KI.displayName=Tv;var qI=E.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...a}=e,s=ya("SelectScrollButton",n),l=E.useRef(null),u=jh(n),d=E.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return E.useEffect(()=>()=>d(),[d]),ln(()=>{u().find(p=>p.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[u]),v.jsx(He.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:Qe(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(r,50))}),onPointerMove:Qe(a.onPointerMove,()=>{s.onItemLeave?.(),l.current===null&&(l.current=window.setInterval(r,50))}),onPointerLeave:Qe(a.onPointerLeave,()=>{d()})})}),O7="SelectSeparator",WI=E.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return v.jsx(He.div,{"aria-hidden":!0,...r,ref:t})});WI.displayName=O7;var Cv="SelectArrow",I7=E.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,a=Lh(n),s=ga(Cv,n),l=ya(Cv,n);return s.open&&l.position==="popper"?v.jsx(f7,{...a,...r,ref:t}):null});I7.displayName=Cv;var D7="SelectBubbleInput",ZI=E.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const a=E.useRef(null),s=wt(r,a),l=h7(t);return E.useEffect(()=>{const u=a.current;if(!u)return;const d=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(d,"value").set;if(l!==t&&p){const g=new Event("change",{bubbles:!0});p.call(u,t),u.dispatchEvent(g)}},[l,t]),v.jsx(He.select,{...n,style:{...xI,...n.style},ref:s,defaultValue:t})});ZI.displayName=D7;function YI(e){return e===""||e===void 0}function XI(e){const t=Sr(e),n=E.useRef(""),r=E.useRef(0),a=E.useCallback(l=>{const u=n.current+l;t(u),(function d(f){n.current=f,window.clearTimeout(r.current),f!==""&&(r.current=window.setTimeout(()=>d(""),1e3))})(u)},[t]),s=E.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,a,s]}function QI(e,t,n){const a=t.length>1&&Array.from(t).every(f=>f===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let l=j7(e,Math.max(s,0));a.length===1&&(l=l.filter(f=>f!==n));const d=l.find(f=>f.textValue.toLowerCase().startsWith(a.toLowerCase()));return d!==n?d:void 0}function j7(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var L7=AI,P7=TI,M7=RI,z7=kI,B7=NI,V7=OI,U7=LI,F7=MI,$7=BI,H7=UI,G7=FI,K7=HI,q7=GI,W7=KI,Z7=WI;const Y7=L7,X7=F7,Q7=M7,J7=({validationStyleEnabled:e=!1,className:t,children:n,...r})=>v.jsxs(P7,{className:_e("border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring focus:outline-hidden flex w-full items-center justify-between whitespace-nowrap rounded-md border px-3 py-2 text-sm focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1","bg-input-background text-input-text w-full select-text resize-none rounded-xl border-2 px-2 py-1 text-sm shadow-none outline-0 transition-all","border-input-border hover:border-input-border-hover focus:border-input-border-focus focus:outline-0 focus:[box-shadow:none]","aria-[invalid=true]:border-error",e&&"valid:border-success invalid:border-error",t),...r,children:[n,v.jsx(z7,{asChild:!0,children:v.jsx(M2,{className:"size-4 opacity-50"})})]}),JI=({className:e,...t})=>v.jsx(q7,{className:_e("flex cursor-default items-center justify-center py-1",e),...t,children:v.jsx(L2,{})}),eD=({className:e,...t})=>v.jsx(W7,{className:_e("flex cursor-default items-center justify-center py-1",e),...t,children:v.jsx(k1,{})}),eW=({className:e,children:t,position:n="popper",...r})=>v.jsx(B7,{children:v.jsxs(V7,{className:_e("bg-input-background text-input-text w-full select-text resize-none rounded-xl border-2 p-1 text-sm shadow-none outline-0 transition-all","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-96 min-w-[8rem] overflow-hidden border shadow-md",n==="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:n,...r,children:[v.jsx(JI,{}),v.jsx(U7,{className:_e("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),v.jsx(eD,{})]})}),tW=({className:e,...t})=>v.jsx($7,{className:_e("px-1 py-0.5 text-sm font-semibold",e),...t}),nW=({className:e,children:t,...n})=>v.jsxs(H7,{className:_e("focus:bg-neutral/10 outline-hidden relative flex w-full cursor-pointer select-none items-center rounded-lg py-1.5 pl-2 pr-8 text-sm data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[v.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:v.jsx(K7,{children:v.jsx(zs,{className:"size-4"})})}),v.jsx(G7,{children:t})]}),rW=({className:e,...t})=>v.jsx(Z7,{className:_e("-mx-1 my-1 h-px bg-red-300",e),...t}),Re=Y7;Re.Group=X7;Re.Value=Q7;Re.Trigger=J7;Re.ScrollUpButton=JI;Re.ScrollDownButton=eD;Re.Content=eW;Re.Label=tW;Re.Item=nW;Re.Separator=rW;const iW=e=>e?.getAttribute("aria-selected")==="true",aW=(e,t=iW,n=!1)=>{const[r,a]=E.useState(null),[s,l]=E.useState(null),u=e.current.length;return E.useEffect(()=>{const d=()=>{let A=null;if(s?A=s:A=e.current.find(t)??null,!A){a(x=>({left:0,width:0,...x,opacity:0}));return}const C=A.offsetLeft,w=A.offsetWidth;a({left:C,width:w,opacity:1})};d(),window.addEventListener("resize",d),window.addEventListener("DOMContentLoaded",d);const f=[];e.current.forEach(A=>{if(A){const C=new MutationObserver(w=>{for(const x of w)if(x.type==="attributes"&&x.attributeName==="aria-selected"){d();break}});C.observe(A,{attributes:!0,attributeFilter:["aria-selected"]}),f.push(C)}});const p=[],g=A=>{if(!A)return;const C=new ResizeObserver(()=>{d()});C.observe(A),p.push(C)},y=e.current.find(t)??null;y&&g(y),s&&g(s);const _=A=>{l(A.currentTarget)},S=()=>{l(null)};return n&&e.current.forEach(A=>{A?.addEventListener("mouseenter",_,{passive:!0}),A?.addEventListener("mouseleave",S,{passive:!0})}),()=>{window.removeEventListener("resize",d),window.removeEventListener("DOMContentLoaded",d),f.forEach(A=>A.disconnect()),p.forEach(A=>A.disconnect()),e.current.forEach(A=>{A?.removeEventListener("mouseenter",_),A?.removeEventListener("mouseleave",S)})}},[e,t,s,u]),{choiceIndicatorPosition:r}},oW=[{content:"Off",value:!1},{content:"On",value:!0}];var fu=(e=>(e.PRIMARY="primary",e.SECONDARY="secondary",e.DESTRUCTIVE="destructive",e.NEUTRAL="neutral",e.LIGHT="light",e.DARK="dark",e.TEXT="text",e))(fu||{});const sW=fr("flex flex-row gap-2 rounded-full w-fit border-[1.5px] p-[1.5px]",{variants:{color:{primary:"border-primary text-primary",secondary:"border-secondary text-secondary",destructive:"border-destructive bg-destructive text-destructive",neutral:"border-neutral text-neutral ",light:"border-white text-white",dark:"border-neutral-800 text-neutral-800",text:"border-text text-text"}},defaultVariants:{color:"primary"}});var hu=(e=>(e.SM="sm",e.MD="md",e.LG="lg",e))(hu||{});const lW=fr("z-1 w-full flex-1 text-sm font-medium transition-all duration-300 ease-in-out cursor-pointer aria-selected:cursor-default aria-selected:text-text-opposite motion-reduce:transition-none",{variants:{size:{sm:"py-1 px-2 text-xs",md:"p-2 text-sm",lg:"p-4 text-base"}},defaultVariants:{size:"md"}}),cW=fr("absolute top-0 z-[-1] h-full w-auto rounded-full transition-[left,width] duration-300 ease-in-out motion-reduce:transition-none",{variants:{color:{primary:"bg-primary aria-selected:text-text",secondary:"bg-secondary aria-selected:text-text",destructive:"bg-destructive aria-selected:text-text",neutral:"bg-neutral aria-selected:text-white ",light:"bg-white aria-selected:text-black",dark:"bg-neutral-800 aria-selected:text-white",text:"bg-text aria-selected:text-text-opposite"}}}),pu=({choices:e=oW,value:t,defaultValue:n,onChange:r,color:a="primary",size:s="md",className:l})=>{const[u,d]=E.useState(t??n??e[0].value),f=E.useRef([]),p=E.useRef(null),{choiceIndicatorPosition:g}=aW(f),y=_=>{d(_),r?.(_)};return E.useEffect(()=>{t!==void 0&&d(t)},[t]),v.jsx("div",{className:sW({color:a,className:l}),role:"tablist",children:v.jsxs("div",{className:"relative flex size-full flex-row items-center justify-center",children:[e.map((_,S)=>{const{content:A,value:C,...w}=_,x=typeof C=="string"||typeof C=="number",T=C===u;return E.createElement("button",{...w,className:_e(lW({size:s})),key:x?C:S,role:"tab",onClick:()=>y(C),"aria-selected":T,disabled:T,ref:N=>{f.current[S]=N}},A)}),g&&v.jsx("div",{className:_e(cW({color:a})),style:g,ref:p})]})})};function tD(e,t,n){function r(u,d){var f;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(f=u._zod).traits??(f.traits=new Set),u._zod.traits.add(e),t(u,d);for(const p in l.prototype)p in u||Object.defineProperty(u,p,{value:l.prototype[p].bind(u)});u._zod.constr=l,u._zod.def=d}const a=n?.Parent??Object;class s extends a{}Object.defineProperty(s,"name",{value:e});function l(u){var d;const f=n?.Parent?new s:this;r(f,u),(d=f._zod).deferred??(d.deferred=[]);for(const p of f._zod.deferred)p();return f}return Object.defineProperty(l,"init",{value:r}),Object.defineProperty(l,Symbol.hasInstance,{value:u=>n?.Parent&&u instanceof n.Parent?!0:u?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}let uW=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};const dW={};function nD(e){return dW}function fW(e,t){return typeof t=="bigint"?t.toString():t}const rD="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Kd(e){return typeof e=="string"?e:e?.message}function iD(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const a=Kd(e.inst?._zod.def?.error?.(e))??Kd(t?.error?.(e))??Kd(n.customError?.(e))??Kd(n.localeError?.(e))??"Invalid input";r.message=a}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}const aD=(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,fW,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},hW=tD("$ZodError",aD),oD=tD("$ZodError",aD,{Parent:Error}),pW=e=>(t,n,r,a)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise)throw new uW;if(l.issues.length){const u=new(a?.Err??e)(l.issues.map(d=>iD(d,s,nD())));throw rD(u,a?.callee),u}return l.value},mW=pW(oD),gW=e=>async(t,n,r,a)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){const u=new(a?.Err??e)(l.issues.map(d=>iD(d,s,nD())));throw rD(u,a?.callee),u}return l.value},yW=gW(oD);function yC(e,t){try{var n=e()}catch(r){return t(r)}return n&&n.then?n.then(void 0,t):n}function vW(e,t){for(var n={};e.length;){var r=e[0],a=r.code,s=r.message,l=r.path.join(".");if(!n[l])if("unionErrors"in r){var u=r.unionErrors[0].errors[0];n[l]={message:u.message,type:u.code}}else n[l]={message:s,type:a};if("unionErrors"in r&&r.unionErrors.forEach(function(p){return p.errors.forEach(function(g){return e.push(g)})}),t){var d=n[l].types,f=d&&d[r.code];n[l]=x0(l,t,n,a,f?[].concat(f,r.message):r.message)}e.shift()}return n}function bW(e,t){for(var n={};e.length;){var r=e[0],a=r.code,s=r.message,l=r.path.join(".");if(!n[l])if(r.code==="invalid_union"&&r.errors.length>0){var u=r.errors[0][0];n[l]={message:u.message,type:u.code}}else n[l]={message:s,type:a};if(r.code==="invalid_union"&&r.errors.forEach(function(p){return p.forEach(function(g){return e.push(g)})}),t){var d=n[l].types,f=d&&d[r.code];n[l]=x0(l,t,n,a,f?[].concat(f,r.message):r.message)}e.shift()}return n}function _W(e,t,n){if(n===void 0&&(n={}),(function(r){return"_def"in r&&typeof r._def=="object"&&"typeName"in r._def})(e))return function(r,a,s){try{return Promise.resolve(yC(function(){return Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](r,t)).then(function(l){return s.shouldUseNativeValidation&&vv({},s),{errors:{},values:n.raw?Object.assign({},r):l}})},function(l){if((function(u){return Array.isArray(u?.issues)})(l))return{values:{},errors:eC(vW(l.errors,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw l}))}catch(l){return Promise.reject(l)}};if((function(r){return"_zod"in r&&typeof r._zod=="object"})(e))return function(r,a,s){try{return Promise.resolve(yC(function(){return Promise.resolve((n.mode==="sync"?mW:yW)(e,r,t)).then(function(l){return s.shouldUseNativeValidation&&vv({},s),{errors:{},values:n.raw?Object.assign({},r):l}})},function(l){if((function(u){return u instanceof hW})(l))return{values:{},errors:eC(bW(l.issues,!s.shouldUseNativeValidation&&s.criteriaMode==="all"),s)};throw l}))}catch(l){return Promise.reject(l)}};throw new Error("Invalid input: not a Zod schema")}const sy=async e=>e&&typeof e.then=="function"?await e:e,EW=({schema:e,onSubmit:t,onSubmitSuccess:n,onSubmitError:r,className:a,children:s,autoComplete:l,...u})=>{const d=async f=>{const p=e?.safeParse(f)??{success:!0,data:void 0};await sy(t?.(f)),p.success?await sy(n?.(p.data)):await sy(r?.(new Error(p.error.issues.map(g=>g.message).join(", "))))};return v.jsx(sq,{...u,children:v.jsx("form",{className:_e("flex size-full flex-col gap-y-6",a),onSubmit:u.handleSubmit(d),autoComplete:l?"on":"off",noValidate:!0,children:s})})},SW=(e,t)=>{const n=Tq({resolver:_W(e),...t}),r=n.formState.isSubmitting,a=n.formState.isSubmitted,s=n.formState.isLoading,l=n.formState.isValid;return{form:n,isSubmitting:r,isSubmitted:a,isLoading:s,isValid:l}},xW=e=>{const{error:t,formItemId:n,formDescriptionId:r,formMessageId:a}=ma();return v.jsx(l$,{id:n,"aria-describedby":t?`${r} ${a}`:`${r}`,"aria-invalid":!!t,...e})},AW=e=>{const{formDescriptionId:t}=ma();return v.jsx("p",{className:"text-neutral text-sm",id:t,...e})},wW=({children:e,...t})=>{const{error:n,formMessageId:r}=ma(),a=n?String(n?.message??""):e;return a?v.jsx("p",{className:"text-error text-xs font-medium",role:"alert",id:r,...t,children:a}):null},Ph=({label:e,description:t,isRequired:n,info:r,children:a,showErrorMessage:s=!0,htmlFor:l})=>v.jsxs($e.Item,{className:"flex w-full flex-col gap-2 p-2",children:[(t||e)&&v.jsxs("div",{className:"flex flex-col gap-1 p-1 leading-none",children:[e&&v.jsx(JO,{isRequired:n,info:r,htmlFor:l,children:e}),t&&v.jsx($e.Description,{children:t})]}),v.jsx($e.Control,{children:a}),s&&v.jsx($e.Message,{"data-testid":"error-message"})]}),TW=({field:e,name:t,label:n,Element:r,isRequired:a=!1,info:s,description:l,showErrorMessage:u=!0,...d})=>{const{error:f}=ma();return v.jsx(Ph,{htmlFor:t,label:n,description:l,isRequired:a,info:s,showErrorMessage:u,"aria-invalid":!!f,children:v.jsx(r,{"data-testid":"element",id:t,...e,...d,children:d.children})})},va=e=>{const{control:t}=pa();return v.jsx($e.Field,{control:t,name:e.name,render:({field:n})=>v.jsx(TW,{...e,field:n})})},CW=e=>v.jsx(va,{id:e.name,"data-testid":e.name,Element:Gs,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,...e}),RW=({autoComplete:e,...t})=>v.jsx(va,{Element:Iq,id:t.name,"data-testid":t.name,"aria-labelledby":t.label?`${t.name}-label`:void 0,"aria-label":t.label?void 0:t.name,autoComplete:e,minLength:6,maxLength:255,...t}),kW=e=>v.jsx(va,{Element:WO,id:e.name,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,"data-testid":e.name,...e}),NW=e=>v.jsx(va,{id:e.name,"data-testid":e.name,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,Element:YO,...e}),OW=e=>v.jsx(va,{id:e.name,"data-testid":e.name,"aria-labelledby":e.label?`${e.name}-label`:void 0,"aria-label":e.label?void 0:e.name,Element:XO,...e}),IW=e=>v.jsx(va,{Element:T0,id:e.name,"data-testid":e.name,...e}),DW=({inputLabel:e,...t})=>v.jsx(Oq,{...t,label:e}),jW=({autoComplete:e,...t})=>v.jsx(va,{Element:DW,id:t.name,"data-testid":t.name,autoComplete:e,minLength:6,maxLength:255,...t}),LW=({name:e,description:t,label:n,isRequired:r,info:a,showErrorMessage:s,children:l,...u})=>{const{control:d}=pa();return v.jsx($e.Field,{control:d,name:e,render:({field:f})=>{const{error:p}=ma();return v.jsx(Ph,{htmlFor:e,label:n,description:t,isRequired:r,info:a,showErrorMessage:s,"aria-invalid":!!p,children:v.jsx(mn,{onValueChange:f.onChange,values:f.value,...u,children:l})})}})},PW=({name:e,description:t,label:n,isRequired:r,info:a,showErrorMessage:s,children:l,...u})=>{const{control:d}=pa();return v.jsx($e.Field,{control:d,name:e,render:({field:f})=>{const{error:p}=ma();return v.jsx(Ph,{htmlFor:e,label:n,description:t,isRequired:r,info:a,showErrorMessage:s,"aria-invalid":!!p,children:v.jsx(Re,{onValueChange:f.onChange,defaultValue:f.value,...u,children:l})})}})},MW=({name:e,description:t,label:n,isRequired:r,info:a,showErrorMessage:s,children:l,...u})=>{const{control:d}=pa();return v.jsx($e.Field,{control:d,name:e,render:({field:f})=>{const{error:p}=ma();return v.jsx(Ph,{htmlFor:e,label:n,description:t,isRequired:r,info:a,showErrorMessage:s,"aria-invalid":!!p,children:v.jsx(pu,{...f,...u,children:l})})}})},$e=EW;$e.Description=AW;$e.Control=xW;$e.Field=kq;$e.Item=Rq;$e.Label=JO;$e.Message=wW;$e.Element=va;$e.Input=CW;$e.InputPassword=RW;$e.Checkbox=jW;$e.TextArea=kW;$e.AutoSizedTextArea=IW;$e.Button=ot;$e.Select=PW;$e.MultiSelect=LW;$e.EditableFieldInput=NW;$e.EditableFieldTextArea=OW;$e.SwitchSelector=MW;const sD=({dictionary:e,mode:t,className:n,onDelete:r,...a})=>{const[s,l]=E.useState(!1),{setLocaleDictionary:u}=dh(),{mutate:d,isPending:f}=JK(),{mutate:p,isPending:g}=iq(),{mutate:y,isPending:_}=QK(),S=g||_,{editedContent:A,restoreEditedContent:C}=xn(),{deleteButton:w,resetButton:x,saveButton:T,publishButton:N,downloadButton:R,confirmation:I}=cn("save-dictionary-details"),{isAuthenticated:D}=cu(),L=A?.[e.localId],H=L&&JSON.stringify(L)!==JSON.stringify(e),Z=typeof e?.id<"u",q=async()=>{if(!A?.[e.localId])return;const W={...e,...A?.[e.localId]};p({dictionary:W},{onSuccess:()=>{u(A?.[e.localId]),C(e.localId)}})},te=()=>{if(!A?.[e.localId])return;const W={...e,...A?.[e.localId]};y([W],{onSuccess:ae=>{ae&&(u(A?.[e.localId]),C(e.localId))}})},ce=()=>{e.id&&d(e.id.toString(),{onSuccess:W=>{W&&r?.()}})};return v.jsxs(v.Fragment,{children:[v.jsx(p0,{isOpen:s,title:I.title.value,size:h0.MD,children:v.jsxs("form",{className:"size-full px-3",children:[v.jsx("p",{className:"text-neutral py-4 text-sm",children:I.message}),v.jsxs("div",{className:"mt-12 flex justify-end gap-2 max-md:flex-col",children:[v.jsx($e.Button,{label:I.cancelButton.label.value,disabled:!H||S,color:it.TEXT,className:"max-md:w-full",variant:at.OUTLINE,onClick:()=>l(!1),children:I.cancelButton.text}),v.jsx($e.Button,{label:I.confirmButton.label.value,disabled:!H||S,Icon:RA,color:it.TEXT,className:"max-md:w-full",isLoading:_,onClick:q,children:I.confirmButton.text})]})]})}),v.jsxs("form",{className:_e("flex justify-end gap-2 max-md:flex-col",n),...a,children:[t.includes("remote")&&Z&&r&&D&&v.jsx($e.Button,{label:w.label.value,Icon:mh,color:it.ERROR,variant:at.OUTLINE,className:"max-md:w-full",isLoading:f,onClick:ce,children:w.text}),H&&v.jsx($e.Button,{label:x.label.value,disabled:!H,Icon:aF,variant:at.OUTLINE,color:it.TEXT,className:"max-md:w-full",onClick:()=>C(e.localId),children:x.text}),t.includes("local")&&v.jsx($e.Button,{label:R.label.value,disabled:!H||S,Icon:$2,color:it.TEXT,variant:D?at.OUTLINE:at.DEFAULT,className:"max-md:w-full",isLoading:g,onClick:()=>l(!0),children:R.text}),t.includes("remote")&&D&&!Z&&v.jsx($e.Button,{label:N.label.value,disabled:S,Icon:R2,color:it.TEXT,className:"max-md:w-full",isLoading:_,onClick:te,children:N.text}),t.includes("remote")&&D&&Z&&H&&v.jsx($e.Button,{label:T.label.value,disabled:!H||S,Icon:RA,color:"text",className:"max-md:w-full",isLoading:_,onClick:te,children:T.text})]})]})},lD=({level:e,title:t,description:n,children:r,rightParam:a,isSelected:s,...l})=>v.jsx("div",{className:_e("rounded-md p-2 transition","hover:bg-card/30 [&:has(.section:hover)]:bg-transparent",e===2&&"hover:bg-card/30",e>=3&&"",s===!0&&"bg-card/40"),...l,children:v.jsx(H1,{isOpen:s,label:t,header:v.jsxs("div",{className:"flex w-full",children:[v.jsxs("div",{className:"flex w-full items-center justify-between",children:[v.jsx("span",{className:_e(e===0&&"text-2xl",e===1&&"text-xl",e===2&&"text-lg",e>=3&&"text-base"),children:t}),a&&v.jsx("div",{className:"flex w-auto items-center justify-between p-3",children:a})]}),n&&v.jsx("p",{className:"text-card pl-3 text-sm",children:n})]}),children:r})}),cD=({keyPath:e,section:t,editedContent:n,editedContentValue:r,onContentChange:a,onFocusKeyPath:s,renderSection:l})=>{const u=r??lr(n,e);if(u&&typeof u!="string")return v.jsx(v.Fragment,{children:"Error loading section - Edited content Incoherence with the original content format"});const d=e.length,f=String(u??t);return v.jsx("span",{role:"button",tabIndex:0,className:_e("w-full rounded-md p-2 text-left transition","hover:bg-card/30 [&:has(.section:hover)]:bg-transparent",d===2&&"hover:bg-card/30",d>=3&&""),onClick:p=>{p.stopPropagation(),s(e)},children:typeof l=="function"?l(f):v.jsx(XO,{"aria-label":"Editable field",defaultValue:f,onSave:p=>a({keyPath:e,newValue:p}),onCancel:()=>null})})},zW=e=>{const{keyPath:t,section:n}=e,{addEditedContent:r}=xn(),a=lr(e.editedContent,t),s=n[$.File],{content:l}=n,u=[...t,{type:$.File}];return v.jsxs("div",{className:"ml-2 grid grid-cols-[auto,1fr] gap-2",children:[v.jsxs("span",{className:"text-neutral text-sm",children:[s," "]}),v.jsx(cD,{...e,keyPath:u,section:l,editedContentValue:a?.content,onContentChange:d=>{r(e.dictionary.key,{...n,content:d.newValue},t)}})]})},BW=e=>{const{keyPath:t,section:n,onFocusKeyPath:r,focusedKeyPath:a=[]}=e;return n.map((s,l)=>{const u={key:l,type:$.Array},d=[...t,u];return v.jsx(lD,{level:t.length,title:`${l}`,description:"",isSelected:Zc(d,a),onClick:f=>{f.stopPropagation(),r(d)},children:v.jsx(ba,{...e,keyPath:d,section:s})},JSON.stringify(s))})},VW=e=>{const{keyPath:t,section:n}=e;return v.jsx("div",{className:"ml-2 grid grid-cols-[auto,1fr] gap-2",children:Object.keys(n).filter(r=>!M0.includes(r)).map(r=>{const a={type:$.Condition,key:r},s=[...t,a],l=n[$.Condition][r];return v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"flex items-center font-bold",children:r}),E.createElement(ba,{...e,key:r,keyPath:s,section:l})]})})})},UW=e=>{const{keyPath:t,section:n}=e;return v.jsx("div",{className:"ml-2 grid grid-cols-[auto,1fr] gap-2",children:Object.keys(n).filter(r=>!M0.includes(r)).map(r=>{const a={type:$.Enumeration,key:r},s=[...t,a],l=n[$.Enumeration][r];return v.jsxs(v.Fragment,{children:[v.jsx("span",{className:"flex items-center font-bold",children:r}),E.createElement(ba,{...e,key:r,keyPath:s,section:l})]})})})},FW=e=>{const{keyPath:t,section:n}=e,r=[...t,{type:$.Insertion}],a=n[$.Insertion];return v.jsx("div",{className:"ml-2 grid grid-cols-[auto,1fr] gap-2",children:v.jsx(ba,{...e,keyPath:r,section:a})})},$W=e=>{const{keyPath:t,section:n}=e,r=[...t,{type:$.Markdown}],a=n[$.Markdown];return v.jsx("div",{className:"ml-2 grid grid-cols-[auto,1fr] gap-2",children:v.jsx(ba,{...e,keyPath:r,section:a})})},HW=e=>{const{keyPath:t,section:n,focusedKeyPath:r=[],onFocusKeyPath:a}=e;return Object.keys(n).filter(s=>!M0.includes(s)).map(s=>{const l={key:s,type:$.Object},u=[...t,l];return v.jsx(lD,{level:t.length,title:s,description:"",isSelected:Zc(u,r),onClick:d=>{d.stopPropagation(),a(u)},children:v.jsx(ba,{...e,keyPath:u,section:n[s]})},s)})},GW=e=>{const{keyPath:t,section:n,locale:r}=e,a={type:$.Translation,key:r},s=[...t,a],l=n.translation[r];return v.jsx(ba,{...e,keyPath:s,section:l})},M0=["filePath","id","nodeType"],ba=e=>{const n=lr(e.editedContent,e.keyPath)??e.section,r=js(n);if(typeof n=="object")return r===$.ReactNode?v.jsx("span",{className:"text-neutral text-xs",children:"React node not editable"}):r===$.Nested?v.jsx("div",{className:"ml-2 grid grid-cols-[auto,1fr] gap-2",children:"[Nested] Dictionary"}):r===$.Markdown?v.jsx($W,{...e,section:n}):r===$.Translation?v.jsx(GW,{...e,section:n}):r===$.Enumeration?v.jsx(UW,{...e,section:n}):r===$.Condition?v.jsx(VW,{...e,section:n}):r===$.Insertion?v.jsx(FW,{...e,section:n}):r===$.Array?v.jsx(BW,{...e,section:n}):r===$.File?v.jsx(zW,{...e,section:n}):v.jsx(HW,{...e,section:n});if(typeof n=="string")return v.jsx(cD,{...e,section:n})},KW=({dictionary:e,mode:t,onDelete:n,...r})=>{const{editedContent:a,addEditedContent:s}=xn(),{focusedContent:l,setFocusedContentKeyPath:u,setFocusedContent:d}=da(),f=l?.keyPath;return v.jsxs("div",{className:"flex flex-1 flex-col justify-between gap-2",children:[v.jsx("div",{children:E.createElement(ba,{...r,keyPath:[],dictionary:e,key:JSON.stringify((a?.[e.localId]??e).content),editedContent:a?.[e.localId]?.content,focusedKeyPath:f,section:e.content,onContentChange:p=>{s(e.localId,p.newValue,p.keyPath)},onFocusKeyPath:u})}),v.jsx(sD,{dictionary:e,mode:t,className:"mb-4 flex-col",onDelete:()=>{d(null),n?.()}})]})};function pe(e,t,n){function r(u,d){var f;Object.defineProperty(u,"_zod",{value:u._zod??{},enumerable:!1}),(f=u._zod).traits??(f.traits=new Set),u._zod.traits.add(e),t(u,d);for(const p in l.prototype)p in u||Object.defineProperty(u,p,{value:l.prototype[p].bind(u)});u._zod.constr=l,u._zod.def=d}const a=n?.Parent??Object;class s extends a{}Object.defineProperty(s,"name",{value:e});function l(u){var d;const f=n?.Parent?new s:this;r(f,u),(d=f._zod).deferred??(d.deferred=[]);for(const p of f._zod.deferred)p();return f}return Object.defineProperty(l,"init",{value:r}),Object.defineProperty(l,Symbol.hasInstance,{value:u=>n?.Parent&&u instanceof n.Parent?!0:u?._zod?.traits?.has(e)}),Object.defineProperty(l,"name",{value:e}),l}class Vc extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const uD={};function uo(e){return uD}function qW(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,a])=>t.indexOf(+r)===-1).map(([r,a])=>a)}function WW(e,t){return typeof t=="bigint"?t.toString():t}function dD(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function z0(e){return e==null}function B0(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function _t(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function V0(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function lc(e){return JSON.stringify(e)}const fD=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Rv(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const ZW=dD(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function kv(e){if(Rv(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(Rv(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const YW=new Set(["string","number","symbol"]);function Mh(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function go(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function ze(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function XW(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function QW(e,t){const n={},r=e._zod.def;for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(n[a]=r.shape[a])}return go(e,{...e._zod.def,shape:n,checks:[]})}function JW(e,t){const n={...e._zod.def.shape},r=e._zod.def;for(const a in t){if(!(a in r.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete n[a]}return go(e,{...e._zod.def,shape:n,checks:[]})}function eZ(e,t){if(!kv(t))throw new Error("Invalid input to extend: expected a plain object");const n={...e._zod.def,get shape(){const r={...e._zod.def.shape,...t};return V0(this,"shape",r),r},checks:[]};return go(e,n)}function tZ(e,t){return go(e,{...e._zod.def,get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return V0(this,"shape",n),n},catchall:t._zod.def.catchall,checks:[]})}function nZ(e,t,n){const r=t._zod.def.shape,a={...r};if(n)for(const s in n){if(!(s in r))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(a[s]=e?new e({type:"optional",innerType:r[s]}):r[s])}else for(const s in r)a[s]=e?new e({type:"optional",innerType:r[s]}):r[s];return go(t,{...t._zod.def,shape:a,checks:[]})}function rZ(e,t,n){const r=t._zod.def.shape,a={...r};if(n)for(const s in n){if(!(s in a))throw new Error(`Unrecognized key: "${s}"`);n[s]&&(a[s]=new e({type:"nonoptional",innerType:r[s]}))}else for(const s in r)a[s]=new e({type:"nonoptional",innerType:r[s]});return go(t,{...t._zod.def,shape:a,checks:[]})}function xc(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function U0(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function qd(e){return typeof e=="string"?e:e?.message}function fo(e,t,n){const r={...e,path:e.path??[]};if(!e.message){const a=qd(e.inst?._zod.def?.error?.(e))??qd(t?.error?.(e))??qd(n.customError?.(e))??qd(n.localeError?.(e))??"Invalid input";r.message=a}return delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function F0(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Uc(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const hD=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,WW,2)},enumerable:!0}),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pD=pe("$ZodError",hD),mD=pe("$ZodError",hD,{Parent:Error});function iZ(e,t=n=>n.message){const n={},r=[];for(const a of e.issues)a.path.length>0?(n[a.path[0]]=n[a.path[0]]||[],n[a.path[0]].push(t(a))):r.push(t(a));return{formErrors:r,fieldErrors:n}}function aZ(e,t){const n=t||function(s){return s.message},r={_errors:[]},a=s=>{for(const l of s.issues)if(l.code==="invalid_union"&&l.errors.length)l.errors.map(u=>a({issues:u}));else if(l.code==="invalid_key")a({issues:l.issues});else if(l.code==="invalid_element")a({issues:l.issues});else if(l.path.length===0)r._errors.push(n(l));else{let u=r,d=0;for(;d<l.path.length;){const f=l.path[d];d===l.path.length-1?(u[f]=u[f]||{_errors:[]},u[f]._errors.push(n(l))):u[f]=u[f]||{_errors:[]},u=u[f],d++}}};return a(e),r}const oZ=e=>(t,n,r,a)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise)throw new Vc;if(l.issues.length){const u=new(a?.Err??e)(l.issues.map(d=>fo(d,s,uo())));throw fD(u,a?.callee),u}return l.value},sZ=e=>async(t,n,r,a)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let l=t._zod.run({value:n,issues:[]},s);if(l instanceof Promise&&(l=await l),l.issues.length){const u=new(a?.Err??e)(l.issues.map(d=>fo(d,s,uo())));throw fD(u,a?.callee),u}return l.value},gD=e=>(t,n,r)=>{const a=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},a);if(s instanceof Promise)throw new Vc;return s.issues.length?{success:!1,error:new(e??pD)(s.issues.map(l=>fo(l,a,uo())))}:{success:!0,data:s.value}},lZ=gD(mD),yD=e=>async(t,n,r)=>{const a=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},a);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(l=>fo(l,a,uo())))}:{success:!0,data:s.value}},cZ=yD(mD),uZ=/^[cC][^\s-]{8,}$/,dZ=/^[0-9a-z]+$/,fZ=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,hZ=/^[0-9a-vA-V]{20}$/,pZ=/^[A-Za-z0-9]{27}$/,mZ=/^[a-zA-Z0-9_-]{21}$/,gZ=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,yZ=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,vC=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,vZ=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,bZ="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function _Z(){return new RegExp(bZ,"u")}const EZ=/^(?:(?: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])$/,SZ=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,xZ=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,AZ=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wZ=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,vD=/^[A-Za-z0-9_-]*$/,TZ=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,CZ=/^\+(?:[0-9]){6,14}[0-9]$/,bD="(?:(?:\\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])))",RZ=new RegExp(`^${bD}$`);function _D(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function kZ(e){return new RegExp(`^${_D(e)}$`)}function NZ(e){const t=_D({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-]\\d{2}:\\d{2})");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${bD}T(?:${r})$`)}const OZ=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},IZ=/^[^A-Z]*$/,DZ=/^[^a-z]*$/,Wr=pe("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),jZ=pe("$ZodCheckMaxLength",(e,t)=>{var n;Wr.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!z0(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<a&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const a=r.value;if(a.length<=t.maximum)return;const l=F0(a);r.issues.push({origin:l,code:"too_big",maximum:t.maximum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),LZ=pe("$ZodCheckMinLength",(e,t)=>{var n;Wr.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!z0(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>a&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const a=r.value;if(a.length>=t.minimum)return;const l=F0(a);r.issues.push({origin:l,code:"too_small",minimum:t.minimum,inclusive:!0,input:a,inst:e,continue:!t.abort})}}),PZ=pe("$ZodCheckLengthEquals",(e,t)=>{var n;Wr.init(e,t),(n=e._zod.def).when??(n.when=r=>{const a=r.value;return!z0(a)&&a.length!==void 0}),e._zod.onattach.push(r=>{const a=r._zod.bag;a.minimum=t.length,a.maximum=t.length,a.length=t.length}),e._zod.check=r=>{const a=r.value,s=a.length;if(s===t.length)return;const l=F0(a),u=s>t.length;r.issues.push({origin:l,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),zh=pe("$ZodCheckStringFormat",(e,t)=>{var n,r;Wr.init(e,t),e._zod.onattach.push(a=>{const s=a._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=a=>{t.pattern.lastIndex=0,!t.pattern.test(a.value)&&a.issues.push({origin:"string",code:"invalid_format",format:t.format,input:a.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),MZ=pe("$ZodCheckRegex",(e,t)=>{zh.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),zZ=pe("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=IZ),zh.init(e,t)}),BZ=pe("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=DZ),zh.init(e,t)}),VZ=pe("$ZodCheckIncludes",(e,t)=>{Wr.init(e,t);const n=Mh(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(a=>{const s=a._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=a=>{a.value.includes(t.includes,t.position)||a.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:a.value,inst:e,continue:!t.abort})}}),UZ=pe("$ZodCheckStartsWith",(e,t)=>{Wr.init(e,t);const n=new RegExp(`^${Mh(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),FZ=pe("$ZodCheckEndsWith",(e,t)=>{Wr.init(e,t);const n=new RegExp(`.*${Mh(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const a=r._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),$Z=pe("$ZodCheckOverwrite",(e,t)=>{Wr.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class HZ{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
268
268
|
`).filter(l=>l),a=Math.min(...r.map(l=>l.length-l.trimStart().length)),s=r.map(l=>l.slice(a)).map(l=>" ".repeat(this.indent*2)+l);for(const l of s)this.content.push(l)}compile(){const t=Function,n=this?.args,a=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,a.join(`
|
|
269
269
|
`))}}const GZ={major:4,minor:0,patch:0},Ut=pe("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=GZ;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const a of r)for(const s of a._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const a=(s,l,u)=>{let d=xc(s),f;for(const p of l){if(p._zod.def.when){if(!p._zod.def.when(s))continue}else if(d)continue;const g=s.issues.length,y=p._zod.check(s);if(y instanceof Promise&&u?.async===!1)throw new Vc;if(f||y instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await y,s.issues.length!==g&&(d||(d=xc(s,g)))});else{if(s.issues.length===g)continue;d||(d=xc(s,g))}}return f?f.then(()=>s):s};e._zod.run=(s,l)=>{const u=e._zod.parse(s,l);if(u instanceof Promise){if(l.async===!1)throw new Vc;return u.then(d=>a(d,r,l))}return a(u,r,l)}}e["~standard"]={validate:a=>{try{const s=lZ(e,a);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return cZ(e,a).then(l=>l.success?{value:l.data}:{issues:l.error?.issues})}},vendor:"zod",version:1}}),$0=pe("$ZodString",(e,t)=>{Ut.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??OZ(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),Et=pe("$ZodStringFormat",(e,t)=>{zh.init(e,t),$0.init(e,t)}),KZ=pe("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=yZ),Et.init(e,t)}),qZ=pe("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=vC(r))}else t.pattern??(t.pattern=vC());Et.init(e,t)}),WZ=pe("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=vZ),Et.init(e,t)}),ZZ=pe("$ZodURL",(e,t)=>{Et.init(e,t),e._zod.check=n=>{try{const r=n.value,a=new URL(r),s=a.href;t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(a.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:TZ.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(a.protocol.endsWith(":")?a.protocol.slice(0,-1):a.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),!r.endsWith("/")&&s.endsWith("/")?n.value=s.slice(0,-1):n.value=s;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),YZ=pe("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=_Z()),Et.init(e,t)}),XZ=pe("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=mZ),Et.init(e,t)}),QZ=pe("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=uZ),Et.init(e,t)}),JZ=pe("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=dZ),Et.init(e,t)}),eY=pe("$ZodULID",(e,t)=>{t.pattern??(t.pattern=fZ),Et.init(e,t)}),tY=pe("$ZodXID",(e,t)=>{t.pattern??(t.pattern=hZ),Et.init(e,t)}),nY=pe("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=pZ),Et.init(e,t)}),rY=pe("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=NZ(t)),Et.init(e,t)}),iY=pe("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=RZ),Et.init(e,t)}),aY=pe("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=kZ(t)),Et.init(e,t)}),oY=pe("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=gZ),Et.init(e,t)}),sY=pe("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=EZ),Et.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv4"})}),lY=pe("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=SZ),Et.init(e,t),e._zod.onattach.push(n=>{const r=n._zod.bag;r.format="ipv6"}),e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),cY=pe("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=xZ),Et.init(e,t)}),uY=pe("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=AZ),Et.init(e,t),e._zod.check=n=>{const[r,a]=n.value.split("/");try{if(!a)throw new Error;const s=Number(a);if(`${s}`!==a)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${r}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function ED(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const dY=pe("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=wZ),Et.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64"}),e._zod.check=n=>{ED(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function fY(e){if(!vD.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return ED(n)}const hY=pe("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=vD),Et.init(e,t),e._zod.onattach.push(n=>{n._zod.bag.contentEncoding="base64url"}),e._zod.check=n=>{fY(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),pY=pe("$ZodE164",(e,t)=>{t.pattern??(t.pattern=CZ),Et.init(e,t)});function mY(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const a=JSON.parse(atob(r));return!("typ"in a&&a?.typ!=="JWT"||!a.alg||t&&(!("alg"in a)||a.alg!==t))}catch{return!1}}const gY=pe("$ZodJWT",(e,t)=>{Et.init(e,t),e._zod.check=n=>{mY(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),yY=pe("$ZodUnknown",(e,t)=>{Ut.init(e,t),e._zod.parse=n=>n}),vY=pe("$ZodNever",(e,t)=>{Ut.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function bC(e,t,n){e.issues.length&&t.issues.push(...U0(n,e.issues)),t.value[n]=e.value}const bY=pe("$ZodArray",(e,t)=>{Ut.init(e,t),e._zod.parse=(n,r)=>{const a=n.value;if(!Array.isArray(a))return n.issues.push({expected:"array",code:"invalid_type",input:a,inst:e}),n;n.value=Array(a.length);const s=[];for(let l=0;l<a.length;l++){const u=a[l],d=t.element._zod.run({value:u,issues:[]},r);d instanceof Promise?s.push(d.then(f=>bC(f,n,l))):bC(d,n,l)}return s.length?Promise.all(s).then(()=>n):n}});function Wd(e,t,n){e.issues.length&&t.issues.push(...U0(n,e.issues)),t.value[n]=e.value}function _C(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...U0(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const _Y=pe("$ZodObject",(e,t)=>{Ut.init(e,t);const n=dD(()=>{const g=Object.keys(t.shape);for(const _ of g)if(!(t.shape[_]instanceof Ut))throw new Error(`Invalid element at key "${_}": expected a Zod schema`);const y=XW(t.shape);return{shape:t.shape,keys:g,keySet:new Set(g),numKeys:g.length,optionalKeys:new Set(y)}});_t(e._zod,"propValues",()=>{const g=t.shape,y={};for(const _ in g){const S=g[_]._zod;if(S.values){y[_]??(y[_]=new Set);for(const A of S.values)y[_].add(A)}}return y});const r=g=>{const y=new HZ(["shape","payload","ctx"]),_=n.value,S=x=>{const T=lc(x);return`shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`};y.write("const input = payload.value;");const A=Object.create(null);let C=0;for(const x of _.keys)A[x]=`key_${C++}`;y.write("const newResult = {}");for(const x of _.keys)if(_.optionalKeys.has(x)){const T=A[x];y.write(`const ${T} = ${S(x)};`);const N=lc(x);y.write(`
|
|
270
270
|
if (${T}.issues.length) {
|
package/client/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Intlayer Editor</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-Ckb6BNTB.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-BMlcL898.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intlayer-editor",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Integrate the Intlayer visual editor into your Intlayer projects, enabling CMS-like content management with multilingual support.",
|
|
6
6
|
"keywords": [
|
|
@@ -77,15 +77,15 @@
|
|
|
77
77
|
"react-dom": "^19.1.1",
|
|
78
78
|
"react-router-dom": "^7.4.0",
|
|
79
79
|
"rimraf": "^6.0.1",
|
|
80
|
-
"@intlayer/
|
|
81
|
-
"@intlayer/
|
|
82
|
-
"@intlayer/
|
|
83
|
-
"@intlayer/
|
|
84
|
-
"@intlayer/
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"vite-intlayer": "6.1.
|
|
80
|
+
"@intlayer/core": "6.1.3",
|
|
81
|
+
"@intlayer/config": "6.1.3",
|
|
82
|
+
"@intlayer/api": "6.1.3",
|
|
83
|
+
"@intlayer/design-system": "6.1.3",
|
|
84
|
+
"@intlayer/unmerged-dictionaries-entry": "6.1.3",
|
|
85
|
+
"@intlayer/editor-react": "6.1.3",
|
|
86
|
+
"react-intlayer": "6.1.3",
|
|
87
|
+
"express-intlayer": "6.1.3",
|
|
88
|
+
"vite-intlayer": "6.1.3"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@tailwindcss/vite": "^4.1.13",
|
|
@@ -117,16 +117,16 @@
|
|
|
117
117
|
"react-dom": ">=16.0.0",
|
|
118
118
|
"react-router-dom": ">=6.0.0",
|
|
119
119
|
"tailwind-merge": "^3.3.1",
|
|
120
|
-
"@intlayer/
|
|
121
|
-
"@intlayer/
|
|
122
|
-
"@intlayer/
|
|
123
|
-
"@intlayer/
|
|
124
|
-
"@intlayer/editor-react": "6.1.
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"intlayer": "6.1.
|
|
129
|
-
"@intlayer/dictionaries-entry": "6.1.
|
|
120
|
+
"@intlayer/chokidar": "6.1.3",
|
|
121
|
+
"@intlayer/config": "6.1.3",
|
|
122
|
+
"@intlayer/core": "6.1.3",
|
|
123
|
+
"@intlayer/design-system": "6.1.3",
|
|
124
|
+
"@intlayer/editor-react": "6.1.3",
|
|
125
|
+
"@intlayer/unmerged-dictionaries-entry": "6.1.3",
|
|
126
|
+
"react-intlayer": "6.1.3",
|
|
127
|
+
"vite-intlayer": "6.1.3",
|
|
128
|
+
"intlayer": "6.1.3",
|
|
129
|
+
"@intlayer/dictionaries-entry": "6.1.3"
|
|
130
130
|
},
|
|
131
131
|
"engines": {
|
|
132
132
|
"node": ">=14.18"
|