momentic-mobile 0.16.1 → 0.16.2
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.
|
@@ -47,7 +47,7 @@ Error generating stack: `+r.message+`
|
|
|
47
47
|
* LICENSE.md file in the root directory of this source tree.
|
|
48
48
|
*
|
|
49
49
|
* @license MIT
|
|
50
|
-
*/function za(){return za=Object.assign?Object.assign.bind():function(e){for(var u=1;u<arguments.length;u++){var a=arguments[u];for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t])}return e},za.apply(this,arguments)}var La;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(La||(La={}));const vM="popstate";function Tcu(e){e===void 0&&(e={});function u(t,n){let{pathname:r,search:i,hash:o}=t.location;return VD("",{pathname:r,search:i,hash:o},n.state&&n.state.usr||null,n.state&&n.state.key||"default")}function a(t,n){return typeof n=="string"?n:W4(n)}return jcu(u,a,null,e)}function l0(e,u){if(e===!1||e===null||typeof e>"u")throw new Error(u)}function J4(e,u){if(!e){typeof console<"u"&&console.warn(u);try{throw new Error(u)}catch{}}}function Pcu(){return Math.random().toString(36).substr(2,8)}function AM(e,u){return{usr:e.state,key:e.key,idx:u}}function VD(e,u,a,t){return a===void 0&&(a=null),za({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof u=="string"?rl(u):u,{state:a,key:u&&u.key||t||Pcu()})}function W4(e){let{pathname:u="/",search:a="",hash:t=""}=e;return a&&a!=="?"&&(u+=a.charAt(0)==="?"?a:"?"+a),t&&t!=="#"&&(u+=t.charAt(0)==="#"?t:"#"+t),u}function rl(e){let u={};if(e){let a=e.indexOf("#");a>=0&&(u.hash=e.substr(a),e=e.substr(0,a));let t=e.indexOf("?");t>=0&&(u.search=e.substr(t),e=e.substr(0,t)),e&&(u.pathname=e)}return u}function jcu(e,u,a,t){t===void 0&&(t={});let{window:n=document.defaultView,v5Compat:r=!1}=t,i=n.history,o=La.Pop,s=null,l=E();l==null&&(l=0,i.replaceState(za({},i.state,{idx:l}),""));function E(){return(i.state||{idx:null}).idx}function c(){o=La.Pop;let p=E(),f=p==null?null:p-l;l=p,s&&s({action:o,location:x.location,delta:f})}function D(p,f){o=La.Push;let g=VD(x.location,p,f);a&&a(g,p),l=E()+1;let F=AM(g,l),b=x.createHref(g);try{i.pushState(F,"",b)}catch(y){if(y instanceof DOMException&&y.name==="DataCloneError")throw y;n.location.assign(b)}r&&s&&s({action:o,location:x.location,delta:1})}function h(p,f){o=La.Replace;let g=VD(x.location,p,f);a&&a(g,p),l=E();let F=AM(g,l),b=x.createHref(g);i.replaceState(F,"",b),r&&s&&s({action:o,location:x.location,delta:0})}function m(p){let f=n.location.origin!=="null"?n.location.origin:n.location.href,g=typeof p=="string"?p:W4(p);return l0(f,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,f)}let x={get action(){return o},get location(){return e(n,i)},listen(p){if(s)throw new Error("A history only accepts one active listener");return n.addEventListener(vM,c),s=p,()=>{n.removeEventListener(vM,c),s=null}},createHref(p){return u(n,p)},createURL:m,encodeLocation(p){let f=m(p);return{pathname:f.pathname,search:f.search,hash:f.hash}},push:D,replace:h,go(p){return i.go(p)}};return x}var ya;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(ya||(ya={}));const Ncu=new Set(["lazy","caseSensitive","path","id","index","children"]);function Rcu(e){return e.index===!0}function v7(e,u,a,t){return a===void 0&&(a=[]),t===void 0&&(t={}),e.map((n,r)=>{let i=[...a,r],o=typeof n.id=="string"?n.id:i.join("-");if(l0(n.index!==!0||!n.children,"Cannot specify children on an index route"),l0(!t[o],'Found a route id collision on id "'+o+`". Route id's must be globally unique within Data Router usages`),Rcu(n)){let s=za({},n,u(n),{id:o});return t[o]=s,s}else{let s=za({},n,u(n),{id:o,children:void 0});return t[o]=s,n.children&&(s.children=v7(n.children,u,i,t)),s}})}function Fc(e,u,a){a===void 0&&(a="/");let t=typeof u=="string"?rl(u):u,n=rd(t.pathname||"/",a);if(n==null)return null;let r=Y$(e);_cu(r);let i=null;for(let o=0;i==null&&o<r.length;++o)i=Ucu(r[o],qcu(n));return i}function Lcu(e,u){let{route:a,pathname:t,params:n}=e;return{id:a.id,pathname:t,params:n,data:u[a.id],handle:a.handle}}function Y$(e,u,a,t){u===void 0&&(u=[]),a===void 0&&(a=[]),t===void 0&&(t="");let n=(r,i,o)=>{let s={relativePath:o===void 0?r.path||"":o,caseSensitive:r.caseSensitive===!0,childrenIndex:i,route:r};s.relativePath.startsWith("/")&&(l0(s.relativePath.startsWith(t),'Absolute route path "'+s.relativePath+'" nested under path '+('"'+t+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),s.relativePath=s.relativePath.slice(t.length));let l=ws([t,s.relativePath]),E=a.concat(s);r.children&&r.children.length>0&&(l0(r.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+l+'".')),Y$(r.children,u,E,l)),!(r.path==null&&!r.index)&&u.push({path:l,score:Jcu(l,r.index),routesMeta:E})};return e.forEach((r,i)=>{var o;if(r.path===""||!((o=r.path)!=null&&o.includes("?")))n(r,i);else for(let s of X$(r.path))n(r,i,s)}),u}function X$(e){let u=e.split("/");if(u.length===0)return[];let[a,...t]=u,n=a.endsWith("?"),r=a.replace(/\?$/,"");if(t.length===0)return n?[r,""]:[r];let i=X$(t.join("/")),o=[];return o.push(...i.map(s=>s===""?r:[r,s].join("/"))),n&&o.push(...i),o.map(s=>e.startsWith("/")&&s===""?"/":s)}function _cu(e){e.sort((u,a)=>u.score!==a.score?a.score-u.score:Wcu(u.routesMeta.map(t=>t.childrenIndex),a.routesMeta.map(t=>t.childrenIndex)))}const Icu=/^:[\w-]+$/,Kcu=3,$cu=2,Vcu=1,Hcu=10,Gcu=-2,bM=e=>e==="*";function Jcu(e,u){let a=e.split("/"),t=a.length;return a.some(bM)&&(t+=Gcu),u&&(t+=$cu),a.filter(n=>!bM(n)).reduce((n,r)=>n+(Icu.test(r)?Kcu:r===""?Vcu:Hcu),t)}function Wcu(e,u){return e.length===u.length&&e.slice(0,-1).every((t,n)=>t===u[n])?e[e.length-1]-u[u.length-1]:0}function Ucu(e,u){let{routesMeta:a}=e,t={},n="/",r=[];for(let i=0;i<a.length;++i){let o=a[i],s=i===a.length-1,l=n==="/"?u:u.slice(n.length)||"/",E=Zcu({path:o.relativePath,caseSensitive:o.caseSensitive,end:s},l);if(!E)return null;Object.assign(t,E.params);let c=o.route;r.push({params:t,pathname:ws([n,E.pathname]),pathnameBase:e3u(ws([n,E.pathnameBase])),route:c}),E.pathnameBase!=="/"&&(n=ws([n,E.pathnameBase]))}return r}function Zcu(e,u){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[a,t]=Qcu(e.path,e.caseSensitive,e.end),n=u.match(a);if(!n)return null;let r=n[0],i=r.replace(/(.)\/+$/,"$1"),o=n.slice(1);return{params:t.reduce((l,E,c)=>{let{paramName:D,isOptional:h}=E;if(D==="*"){let x=o[c]||"";i=r.slice(0,r.length-x.length).replace(/(.)\/+$/,"$1")}const m=o[c];return h&&!m?l[D]=void 0:l[D]=Ycu(m||"",D),l},{}),pathname:r,pathnameBase:i,pattern:e}}function Qcu(e,u,a){u===void 0&&(u=!1),a===void 0&&(a=!0),J4(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let t=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,o,s)=>(t.push({paramName:o,isOptional:s!=null}),s?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(t.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,u?void 0:"i"),t]}function qcu(e){try{return decodeURI(e)}catch(u){return J4(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+u+").")),e}}function Ycu(e,u){try{return decodeURIComponent(e)}catch(a){return J4(!1,'The value for the URL param "'+u+'" will not be decoded because'+(' the string "'+e+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+a+").")),e}}function rd(e,u){if(u==="/")return e;if(!e.toLowerCase().startsWith(u.toLowerCase()))return null;let a=u.endsWith("/")?u.length-1:u.length,t=e.charAt(a);return t&&t!=="/"?null:e.slice(a)||"/"}function Xcu(e,u){u===void 0&&(u="/");let{pathname:a,search:t="",hash:n=""}=typeof e=="string"?rl(e):e;return{pathname:a?a.startsWith("/")?a:u3u(a,u):u,search:a3u(t),hash:t3u(n)}}function u3u(e,u){let a=u.replace(/\/+$/,"").split("/");return e.split("/").forEach(n=>{n===".."?a.length>1&&a.pop():n!=="."&&a.push(n)}),a.length>1?a.join("/"):"/"}function ck(e,u,a,t){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+u+"` field ["+JSON.stringify(t)+"]. Please separate it out to the ")+("`to."+a+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function uV(e){return e.filter((u,a)=>a===0||u.route.path&&u.route.path.length>0)}function Zg(e,u){let a=uV(e);return u?a.map((t,n)=>n===e.length-1?t.pathname:t.pathnameBase):a.map(t=>t.pathnameBase)}function Qg(e,u,a,t){t===void 0&&(t=!1);let n;typeof e=="string"?n=rl(e):(n=za({},e),l0(!n.pathname||!n.pathname.includes("?"),ck("?","pathname","search",n)),l0(!n.pathname||!n.pathname.includes("#"),ck("#","pathname","hash",n)),l0(!n.search||!n.search.includes("#"),ck("#","search","hash",n)));let r=e===""||n.pathname==="",i=r?"/":n.pathname,o;if(i==null)o=a;else{let c=u.length-1;if(!t&&i.startsWith("..")){let D=i.split("/");for(;D[0]==="..";)D.shift(),c-=1;n.pathname=D.join("/")}o=c>=0?u[c]:"/"}let s=Xcu(n,o),l=i&&i!=="/"&&i.endsWith("/"),E=(r||i===".")&&a.endsWith("/");return!s.pathname.endsWith("/")&&(l||E)&&(s.pathname+="/"),s}const ws=e=>e.join("/").replace(/\/\/+/g,"/"),e3u=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),a3u=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,t3u=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class qB{constructor(u,a,t,n){n===void 0&&(n=!1),this.status=u,this.statusText=a||"",this.internal=n,t instanceof Error?(this.data=t.toString(),this.error=t):this.data=t}}function eV(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const aV=["post","put","patch","delete"],n3u=new Set(aV),r3u=["get",...aV],i3u=new Set(r3u),o3u=new Set([301,302,303,307,308]),s3u=new Set([307,308]),dk={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},l3u={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Zd={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},tV=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,E3u=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),nV="remix-router-transitions";function c3u(e){const u=e.window?e.window:typeof window<"u"?window:void 0,a=typeof u<"u"&&typeof u.document<"u"&&typeof u.document.createElement<"u",t=!a;l0(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let n;if(e.mapRouteProperties)n=e.mapRouteProperties;else if(e.detectErrorBoundary){let H=e.detectErrorBoundary;n=X=>({hasErrorBoundary:H(X)})}else n=E3u;let r={},i=v7(e.routes,n,void 0,r),o,s=e.basename||"/",l=za({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},e.future),E=null,c=new Set,D=null,h=null,m=null,x=e.hydrationData!=null,p=Fc(i,e.history.location,s),f=null;if(p==null){let H=Zr(404,{pathname:e.history.location.pathname}),{matches:X,route:Eu}=TM(i);p=X,f={[Eu.id]:H}}let g,F=p.some(H=>H.route.lazy),b=p.some(H=>H.route.loader);if(F)g=!1;else if(!b)g=!0;else if(l.v7_partialHydration){let H=e.hydrationData?e.hydrationData.loaderData:null,X=e.hydrationData?e.hydrationData.errors:null;g=p.every(Eu=>Eu.route.loader&&Eu.route.loader.hydrate!==!0&&(H&&H[Eu.route.id]!==void 0||X&&X[Eu.route.id]!==void 0))}else g=e.hydrationData!=null;let y,v={historyAction:e.history.action,location:e.history.location,matches:p,initialized:g,navigation:dk,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||f,fetchers:new Map,blockers:new Map},A=La.Pop,B=!1,j,R=!1,w=new Map,O=null,T=!1,z=!1,N=[],M=[],I=new Map,P=0,L=-1,K=new Map,W=new Set,_=new Map,Q=new Map,eu=new Set,U=new Map,iu=new Map,tu=!1;function Y(){if(E=e.history.listen(H=>{let{action:X,location:Eu,delta:Fu}=H;if(tu){tu=!1;return}J4(iu.size===0||Fu!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let Pu=PE({currentLocation:v.location,nextLocation:Eu,historyAction:X});if(Pu&&Fu!=null){tu=!0,e.history.go(Fu*-1),$r(Pu,{state:"blocked",location:Eu,proceed(){$r(Pu,{state:"proceeding",proceed:void 0,reset:void 0,location:Eu}),e.history.go(Fu)},reset(){let me=new Map(v.blockers);me.set(Pu,Zd),Au({blockers:me})}});return}return Yu(X,Eu)}),a){k3u(u,w);let H=()=>v3u(u,w);u.addEventListener("pagehide",H),O=()=>u.removeEventListener("pagehide",H)}return v.initialized||Yu(La.Pop,v.location,{initialHydration:!0}),y}function ou(){E&&E(),O&&O(),c.clear(),j&&j.abort(),v.fetchers.forEach((H,X)=>Lu(X)),v.blockers.forEach((H,X)=>Xt(X))}function Cu(H){return c.add(H),()=>c.delete(H)}function Au(H,X){X===void 0&&(X={}),v=za({},v,H);let Eu=[],Fu=[];l.v7_fetcherPersist&&v.fetchers.forEach((Pu,me)=>{Pu.state==="idle"&&(eu.has(me)?Fu.push(me):Eu.push(me))}),[...c].forEach(Pu=>Pu(v,{deletedFetchers:Fu,unstable_viewTransitionOpts:X.viewTransitionOpts,unstable_flushSync:X.flushSync===!0})),l.v7_fetcherPersist&&(Eu.forEach(Pu=>v.fetchers.delete(Pu)),Fu.forEach(Pu=>Lu(Pu)))}function mu(H,X,Eu){var Fu,Pu;let{flushSync:me}=Eu===void 0?{}:Eu,pe=v.actionData!=null&&v.navigation.formMethod!=null&&ji(v.navigation.formMethod)&&v.navigation.state==="loading"&&((Fu=H.state)==null?void 0:Fu._isRedirect)!==!0,ge;X.actionData?Object.keys(X.actionData).length>0?ge=X.actionData:ge=null:pe?ge=v.actionData:ge=null;let ke=X.loaderData?MM(v.loaderData,X.loaderData,X.matches||[],X.errors):v.loaderData,i0=v.blockers;i0.size>0&&(i0=new Map(i0),i0.forEach((Q0,jt)=>i0.set(jt,Zd)));let Xa=B===!0||v.navigation.formMethod!=null&&ji(v.navigation.formMethod)&&((Pu=H.state)==null?void 0:Pu._isRedirect)!==!0;o&&(i=o,o=void 0),T||A===La.Pop||(A===La.Push?e.history.push(H,H.state):A===La.Replace&&e.history.replace(H,H.state));let u0;if(A===La.Pop){let Q0=w.get(v.location.pathname);Q0&&Q0.has(H.pathname)?u0={currentLocation:v.location,nextLocation:H}:w.has(H.pathname)&&(u0={currentLocation:H,nextLocation:v.location})}else if(R){let Q0=w.get(v.location.pathname);Q0?Q0.add(H.pathname):(Q0=new Set([H.pathname]),w.set(v.location.pathname,Q0)),u0={currentLocation:v.location,nextLocation:H}}Au(za({},X,{actionData:ge,loaderData:ke,historyAction:A,location:H,initialized:!0,navigation:dk,revalidation:"idle",restoreScrollPosition:Xu(H,X.matches||v.matches),preventScrollReset:Xa,blockers:i0}),{viewTransitionOpts:u0,flushSync:me===!0}),A=La.Pop,B=!1,R=!1,T=!1,z=!1,N=[],M=[]}async function Nu(H,X){if(typeof H=="number"){e.history.go(H);return}let Eu=A7(v.location,v.matches,s,l.v7_prependBasename,H,l.v7_relativeSplatPath,X==null?void 0:X.fromRouteId,X==null?void 0:X.relative),{path:Fu,submission:Pu,error:me}=yM(l.v7_normalizeFormMethod,!1,Eu,X),pe=v.location,ge=VD(v.location,Fu,X&&X.state);ge=za({},ge,e.history.encodeLocation(ge));let ke=X&&X.replace!=null?X.replace:void 0,i0=La.Push;ke===!0?i0=La.Replace:ke===!1||Pu!=null&&ji(Pu.formMethod)&&Pu.formAction===v.location.pathname+v.location.search&&(i0=La.Replace);let Xa=X&&"preventScrollReset"in X?X.preventScrollReset===!0:void 0,u0=(X&&X.unstable_flushSync)===!0,Q0=PE({currentLocation:pe,nextLocation:ge,historyAction:i0});if(Q0){$r(Q0,{state:"blocked",location:ge,proceed(){$r(Q0,{state:"proceeding",proceed:void 0,reset:void 0,location:ge}),Nu(H,X)},reset(){let jt=new Map(v.blockers);jt.set(Q0,Zd),Au({blockers:jt})}});return}return await Yu(i0,ge,{submission:Pu,pendingError:me,preventScrollReset:Xa,replace:X&&X.replace,enableViewTransition:X&&X.unstable_viewTransition,flushSync:u0})}function le(){if(du(),Au({revalidation:"loading"}),v.navigation.state!=="submitting"){if(v.navigation.state==="idle"){Yu(v.historyAction,v.location,{startUninterruptedRevalidation:!0});return}Yu(A||v.historyAction,v.navigation.location,{overrideNavigation:v.navigation})}}async function Yu(H,X,Eu){j&&j.abort(),j=null,A=H,T=(Eu&&Eu.startUninterruptedRevalidation)===!0,_u(v.location,v.matches),B=(Eu&&Eu.preventScrollReset)===!0,R=(Eu&&Eu.enableViewTransition)===!0;let Fu=o||i,Pu=Eu&&Eu.overrideNavigation,me=Fc(Fu,X,s),pe=(Eu&&Eu.flushSync)===!0;if(!me){let jt=Zr(404,{pathname:X.pathname}),{matches:Vr,route:yt}=TM(Fu);Dl(),mu(X,{matches:Vr,loaderData:{},errors:{[yt.id]:jt}},{flushSync:pe});return}if(v.initialized&&!z&&x3u(v.location,X)&&!(Eu&&Eu.submission&&ji(Eu.submission.formMethod))){mu(X,{matches:me},{flushSync:pe});return}j=new AbortController;let ge=qd(e.history,X,j.signal,Eu&&Eu.submission),ke,i0;if(Eu&&Eu.pendingError)i0={[oD(me).route.id]:Eu.pendingError};else if(Eu&&Eu.submission&&ji(Eu.submission.formMethod)){let jt=await ve(ge,X,Eu.submission,me,{replace:Eu.replace,flushSync:pe});if(jt.shortCircuited)return;ke=jt.pendingActionData,i0=jt.pendingActionError,Pu=Dk(X,Eu.submission),pe=!1,ge=new Request(ge.url,{signal:ge.signal})}let{shortCircuited:Xa,loaderData:u0,errors:Q0}=await Ie(ge,X,me,Pu,Eu&&Eu.submission,Eu&&Eu.fetcherSubmission,Eu&&Eu.replace,Eu&&Eu.initialHydration===!0,pe,ke,i0);Xa||(j=null,mu(X,za({matches:me},ke?{actionData:ke}:{},{loaderData:u0,errors:Q0})))}async function ve(H,X,Eu,Fu,Pu){Pu===void 0&&(Pu={}),du();let me=C3u(X,Eu);Au({navigation:me},{flushSync:Pu.flushSync===!0});let pe,ge=y7(Fu,X);if(!ge.route.action&&!ge.route.lazy)pe={type:ya.error,error:Zr(405,{method:H.method,pathname:X.pathname,routeId:ge.route.id})};else if(pe=await Qd("action",H,ge,Fu,r,n,s,l.v7_relativeSplatPath),H.signal.aborted)return{shortCircuited:!0};if(g4(pe)){let ke;return Pu&&Pu.replace!=null?ke=Pu.replace:ke=pe.location===v.location.pathname+v.location.search,await V(v,pe,{submission:Eu,replace:ke}),{shortCircuited:!0}}if(kc(pe)){let ke=oD(Fu,ge.route.id);return(Pu&&Pu.replace)!==!0&&(A=La.Push),{pendingActionData:{},pendingActionError:{[ke.route.id]:pe.error}}}if(p4(pe))throw Zr(400,{type:"defer-action"});return{pendingActionData:{[ge.route.id]:pe.data}}}async function Ie(H,X,Eu,Fu,Pu,me,pe,ge,ke,i0,Xa){let u0=Fu||Dk(X,Pu),Q0=Pu||me||NM(u0),jt=o||i,[Vr,yt]=BM(e.history,v,Eu,Q0,X,l.v7_partialHydration&&ge===!0,z,N,M,eu,_,W,jt,s,i0,Xa);if(Dl(J0=>!(Eu&&Eu.some(la=>la.route.id===J0))||Vr&&Vr.some(la=>la.route.id===J0)),L=++P,Vr.length===0&&yt.length===0){let J0=t0();return mu(X,za({matches:Eu,loaderData:{},errors:Xa||null},i0?{actionData:i0}:{},J0?{fetchers:new Map(v.fetchers)}:{}),{flushSync:ke}),{shortCircuited:!0}}if(!T&&(!l.v7_partialHydration||!ge)){yt.forEach(la=>{let mo=v.fetchers.get(la.key),Qm=Yd(void 0,mo?mo.data:void 0);v.fetchers.set(la.key,Qm)});let J0=i0||v.actionData;Au(za({navigation:u0},J0?Object.keys(J0).length===0?{actionData:null}:{actionData:J0}:{},yt.length>0?{fetchers:new Map(v.fetchers)}:{}),{flushSync:ke})}yt.forEach(J0=>{I.has(J0.key)&&yu(J0.key),J0.controller&&I.set(J0.key,J0.controller)});let jE=()=>yt.forEach(J0=>yu(J0.key));j&&j.signal.addEventListener("abort",jE);let{results:jF,loaderResults:NE,fetcherResults:hl}=await au(v.matches,Eu,Vr,yt,H);if(H.signal.aborted)return{shortCircuited:!0};j&&j.signal.removeEventListener("abort",jE),yt.forEach(J0=>I.delete(J0.key));let Y1=PM(jF);if(Y1){if(Y1.idx>=Vr.length){let J0=yt[Y1.idx-Vr.length].key;W.add(J0)}return await V(v,Y1.result,{replace:pe}),{shortCircuited:!0}}let{loaderData:NF,errors:RF}=wM(v,Eu,Vr,NE,Xa,yt,hl,U);U.forEach((J0,la)=>{J0.subscribe(mo=>{(mo||J0.done)&&U.delete(la)})});let LF=t0(),RE=N0(L),Zm=LF||RE||yt.length>0;return za({loaderData:NF,errors:RF},Zm?{fetchers:new Map(v.fetchers)}:{})}function Zu(H,X,Eu,Fu){if(t)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");I.has(H)&&yu(H);let Pu=(Fu&&Fu.unstable_flushSync)===!0,me=o||i,pe=A7(v.location,v.matches,s,l.v7_prependBasename,Eu,l.v7_relativeSplatPath,X,Fu==null?void 0:Fu.relative),ge=Fc(me,pe,s);if(!ge){pu(H,X,Zr(404,{pathname:pe}),{flushSync:Pu});return}let{path:ke,submission:i0,error:Xa}=yM(l.v7_normalizeFormMethod,!0,pe,Fu);if(Xa){pu(H,X,Xa,{flushSync:Pu});return}let u0=y7(ge,ke);if(B=(Fu&&Fu.preventScrollReset)===!0,i0&&ji(i0.formMethod)){Gu(H,X,ke,u0,ge,Pu,i0);return}_.set(H,{routeId:X,path:ke}),fe(H,X,ke,u0,ge,Pu,i0)}async function Gu(H,X,Eu,Fu,Pu,me,pe){if(du(),_.delete(H),!Fu.route.action&&!Fu.route.lazy){let la=Zr(405,{method:pe.formMethod,pathname:Eu,routeId:X});pu(H,X,la,{flushSync:me});return}let ge=v.fetchers.get(H);bu(H,F3u(pe,ge),{flushSync:me});let ke=new AbortController,i0=qd(e.history,Eu,ke.signal,pe);I.set(H,ke);let Xa=P,u0=await Qd("action",i0,Fu,Pu,r,n,s,l.v7_relativeSplatPath);if(i0.signal.aborted){I.get(H)===ke&&I.delete(H);return}if(l.v7_fetcherPersist&&eu.has(H)){if(g4(u0)||kc(u0)){bu(H,kl(void 0));return}}else{if(g4(u0))if(I.delete(H),L>Xa){bu(H,kl(void 0));return}else return W.add(H),bu(H,Yd(pe)),V(v,u0,{fetcherSubmission:pe});if(kc(u0)){pu(H,X,u0.error);return}}if(p4(u0))throw Zr(400,{type:"defer-action"});let Q0=v.navigation.location||v.location,jt=qd(e.history,Q0,ke.signal),Vr=o||i,yt=v.navigation.state!=="idle"?Fc(Vr,v.navigation.location,s):v.matches;l0(yt,"Didn't find any matches after fetcher action");let jE=++P;K.set(H,jE);let jF=Yd(pe,u0.data);v.fetchers.set(H,jF);let[NE,hl]=BM(e.history,v,yt,pe,Q0,!1,z,N,M,eu,_,W,Vr,s,{[Fu.route.id]:u0.data},void 0);hl.filter(la=>la.key!==H).forEach(la=>{let mo=la.key,Qm=v.fetchers.get(mo),W1u=Yd(void 0,Qm?Qm.data:void 0);v.fetchers.set(mo,W1u),I.has(mo)&&yu(mo),la.controller&&I.set(mo,la.controller)}),Au({fetchers:new Map(v.fetchers)});let Y1=()=>hl.forEach(la=>yu(la.key));ke.signal.addEventListener("abort",Y1);let{results:NF,loaderResults:RF,fetcherResults:LF}=await au(v.matches,yt,NE,hl,jt);if(ke.signal.aborted)return;ke.signal.removeEventListener("abort",Y1),K.delete(H),I.delete(H),hl.forEach(la=>I.delete(la.key));let RE=PM(NF);if(RE){if(RE.idx>=NE.length){let la=hl[RE.idx-NE.length].key;W.add(la)}return V(v,RE.result)}let{loaderData:Zm,errors:J0}=wM(v,v.matches,NE,RF,void 0,hl,LF,U);if(v.fetchers.has(H)){let la=kl(u0.data);v.fetchers.set(H,la)}N0(jE),v.navigation.state==="loading"&&jE>L?(l0(A,"Expected pending action"),j&&j.abort(),mu(v.navigation.location,{matches:yt,loaderData:Zm,errors:J0,fetchers:new Map(v.fetchers)})):(Au({errors:J0,loaderData:MM(v.loaderData,Zm,yt,J0),fetchers:new Map(v.fetchers)}),z=!1)}async function fe(H,X,Eu,Fu,Pu,me,pe){let ge=v.fetchers.get(H);bu(H,Yd(pe,ge?ge.data:void 0),{flushSync:me});let ke=new AbortController,i0=qd(e.history,Eu,ke.signal);I.set(H,ke);let Xa=P,u0=await Qd("loader",i0,Fu,Pu,r,n,s,l.v7_relativeSplatPath);if(p4(u0)&&(u0=await oV(u0,i0.signal,!0)||u0),I.get(H)===ke&&I.delete(H),!i0.signal.aborted){if(eu.has(H)){bu(H,kl(void 0));return}if(g4(u0))if(L>Xa){bu(H,kl(void 0));return}else{W.add(H),await V(v,u0);return}if(kc(u0)){pu(H,X,u0.error);return}l0(!p4(u0),"Unhandled fetcher deferred data"),bu(H,kl(u0.data))}}async function V(H,X,Eu){let{submission:Fu,fetcherSubmission:Pu,replace:me}=Eu===void 0?{}:Eu;X.revalidate&&(z=!0);let pe=VD(H.location,X.location,{_isRedirect:!0});if(l0(pe,"Expected a location on the redirect navigation"),a){let Q0=!1;if(X.reloadDocument)Q0=!0;else if(tV.test(X.location)){const jt=e.history.createURL(X.location);Q0=jt.origin!==u.location.origin||rd(jt.pathname,s)==null}if(Q0){me?u.location.replace(X.location):u.location.assign(X.location);return}}j=null;let ge=me===!0?La.Replace:La.Push,{formMethod:ke,formAction:i0,formEncType:Xa}=H.navigation;!Fu&&!Pu&&ke&&i0&&Xa&&(Fu=NM(H.navigation));let u0=Fu||Pu;if(s3u.has(X.status)&&u0&&ji(u0.formMethod))await Yu(ge,pe,{submission:za({},u0,{formAction:X.location}),preventScrollReset:B});else{let Q0=Dk(pe,Fu);await Yu(ge,pe,{overrideNavigation:Q0,fetcherSubmission:Pu,preventScrollReset:B})}}async function au(H,X,Eu,Fu,Pu){let me=await Promise.all([...Eu.map(ke=>Qd("loader",Pu,ke,X,r,n,s,l.v7_relativeSplatPath)),...Fu.map(ke=>ke.matches&&ke.match&&ke.controller?Qd("loader",qd(e.history,ke.path,ke.controller.signal),ke.match,ke.matches,r,n,s,l.v7_relativeSplatPath):{type:ya.error,error:Zr(404,{pathname:ke.path})})]),pe=me.slice(0,Eu.length),ge=me.slice(Eu.length);return await Promise.all([jM(H,Eu,pe,pe.map(()=>Pu.signal),!1,v.loaderData),jM(H,Fu.map(ke=>ke.match),ge,Fu.map(ke=>ke.controller?ke.controller.signal:null),!0)]),{results:me,loaderResults:pe,fetcherResults:ge}}function du(){z=!0,N.push(...Dl()),_.forEach((H,X)=>{I.has(X)&&(M.push(X),yu(X))})}function bu(H,X,Eu){Eu===void 0&&(Eu={}),v.fetchers.set(H,X),Au({fetchers:new Map(v.fetchers)},{flushSync:(Eu&&Eu.flushSync)===!0})}function pu(H,X,Eu,Fu){Fu===void 0&&(Fu={});let Pu=oD(v.matches,X);Lu(H),Au({errors:{[Pu.route.id]:Eu},fetchers:new Map(v.fetchers)},{flushSync:(Fu&&Fu.flushSync)===!0})}function xu(H){return l.v7_fetcherPersist&&(Q.set(H,(Q.get(H)||0)+1),eu.has(H)&&eu.delete(H)),v.fetchers.get(H)||l3u}function Lu(H){let X=v.fetchers.get(H);I.has(H)&&!(X&&X.state==="loading"&&K.has(H))&&yu(H),_.delete(H),K.delete(H),W.delete(H),eu.delete(H),v.fetchers.delete(H)}function He(H){if(l.v7_fetcherPersist){let X=(Q.get(H)||0)-1;X<=0?(Q.delete(H),eu.add(H)):Q.set(H,X)}else Lu(H);Au({fetchers:new Map(v.fetchers)})}function yu(H){let X=I.get(H);l0(X,"Expected fetch controller: "+H),X.abort(),I.delete(H)}function Ke(H){for(let X of H){let Eu=xu(X),Fu=kl(Eu.data);v.fetchers.set(X,Fu)}}function t0(){let H=[],X=!1;for(let Eu of W){let Fu=v.fetchers.get(Eu);l0(Fu,"Expected fetcher: "+Eu),Fu.state==="loading"&&(W.delete(Eu),H.push(Eu),X=!0)}return Ke(H),X}function N0(H){let X=[];for(let[Eu,Fu]of K)if(Fu<H){let Pu=v.fetchers.get(Eu);l0(Pu,"Expected fetcher: "+Eu),Pu.state==="loading"&&(yu(Eu),K.delete(Eu),X.push(Eu))}return Ke(X),X.length>0}function ja(H,X){let Eu=v.blockers.get(H)||Zd;return iu.get(H)!==X&&iu.set(H,X),Eu}function Xt(H){v.blockers.delete(H),iu.delete(H)}function $r(H,X){let Eu=v.blockers.get(H)||Zd;l0(Eu.state==="unblocked"&&X.state==="blocked"||Eu.state==="blocked"&&X.state==="blocked"||Eu.state==="blocked"&&X.state==="proceeding"||Eu.state==="blocked"&&X.state==="unblocked"||Eu.state==="proceeding"&&X.state==="unblocked","Invalid blocker state transition: "+Eu.state+" -> "+X.state);let Fu=new Map(v.blockers);Fu.set(H,X),Au({blockers:Fu})}function PE(H){let{currentLocation:X,nextLocation:Eu,historyAction:Fu}=H;if(iu.size===0)return;iu.size>1&&J4(!1,"A router only supports one blocker at a time");let Pu=Array.from(iu.entries()),[me,pe]=Pu[Pu.length-1],ge=v.blockers.get(me);if(!(ge&&ge.state==="proceeding")&&pe({currentLocation:X,nextLocation:Eu,historyAction:Fu}))return me}function Dl(H){let X=[];return U.forEach((Eu,Fu)=>{(!H||H(Fu))&&(Eu.cancel(),X.push(Fu),U.delete(Fu))}),X}function fu(H,X,Eu){if(D=H,m=X,h=Eu||null,!x&&v.navigation===dk){x=!0;let Fu=Xu(v.location,v.matches);Fu!=null&&Au({restoreScrollPosition:Fu})}return()=>{D=null,m=null,h=null}}function Bu(H,X){return h&&h(H,X.map(Fu=>Lcu(Fu,v.loaderData)))||H.key}function _u(H,X){if(D&&m){let Eu=Bu(H,X);D[Eu]=m()}}function Xu(H,X){if(D){let Eu=Bu(H,X),Fu=D[Eu];if(typeof Fu=="number")return Fu}return null}function Ru(H){r={},o=v7(H,n,void 0,r)}return y={get basename(){return s},get future(){return l},get state(){return v},get routes(){return i},get window(){return u},initialize:Y,subscribe:Cu,enableScrollRestoration:fu,navigate:Nu,fetch:Zu,revalidate:le,createHref:H=>e.history.createHref(H),encodeLocation:H=>e.history.encodeLocation(H),getFetcher:xu,deleteFetcher:He,dispose:ou,getBlocker:ja,deleteBlocker:Xt,_internalFetchControllers:I,_internalActiveDeferreds:U,_internalSetRoutes:Ru},y}function d3u(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function A7(e,u,a,t,n,r,i,o){let s,l;if(i){s=[];for(let c of u)if(s.push(c),c.route.id===i){l=c;break}}else s=u,l=u[u.length-1];let E=Qg(n||".",Zg(s,r),rd(e.pathname,a)||e.pathname,o==="path");return n==null&&(E.search=e.search,E.hash=e.hash),(n==null||n===""||n===".")&&l&&l.route.index&&!YB(E.search)&&(E.search=E.search?E.search.replace(/^\?/,"?index&"):"?index"),t&&a!=="/"&&(E.pathname=E.pathname==="/"?a:ws([a,E.pathname])),W4(E)}function yM(e,u,a,t){if(!t||!d3u(t))return{path:a};if(t.formMethod&&!g3u(t.formMethod))return{path:a,error:Zr(405,{method:t.formMethod})};let n=()=>({path:a,error:Zr(400,{type:"invalid-body"})}),r=t.formMethod||"get",i=e?r.toUpperCase():r.toLowerCase(),o=iV(a);if(t.body!==void 0){if(t.formEncType==="text/plain"){if(!ji(i))return n();let D=typeof t.body=="string"?t.body:t.body instanceof FormData||t.body instanceof URLSearchParams?Array.from(t.body.entries()).reduce((h,m)=>{let[x,p]=m;return""+h+x+"="+p+`
|
|
50
|
+
*/function za(){return za=Object.assign?Object.assign.bind():function(e){for(var u=1;u<arguments.length;u++){var a=arguments[u];for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t])}return e},za.apply(this,arguments)}var La;(function(e){e.Pop="POP",e.Push="PUSH",e.Replace="REPLACE"})(La||(La={}));const vM="popstate";function Tcu(e){e===void 0&&(e={});function u(t,n){let{pathname:r,search:i,hash:o}=t.location;return VD("",{pathname:r,search:i,hash:o},n.state&&n.state.usr||null,n.state&&n.state.key||"default")}function a(t,n){return typeof n=="string"?n:W4(n)}return jcu(u,a,null,e)}function l0(e,u){if(e===!1||e===null||typeof e>"u")throw new Error(u)}function J4(e,u){if(!e){typeof console<"u"&&console.warn(u);try{throw new Error(u)}catch{}}}function Pcu(){return Math.random().toString(36).substr(2,8)}function AM(e,u){return{usr:e.state,key:e.key,idx:u}}function VD(e,u,a,t){return a===void 0&&(a=null),za({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof u=="string"?rl(u):u,{state:a,key:u&&u.key||t||Pcu()})}function W4(e){let{pathname:u="/",search:a="",hash:t=""}=e;return a&&a!=="?"&&(u+=a.charAt(0)==="?"?a:"?"+a),t&&t!=="#"&&(u+=t.charAt(0)==="#"?t:"#"+t),u}function rl(e){let u={};if(e){let a=e.indexOf("#");a>=0&&(u.hash=e.substr(a),e=e.substr(0,a));let t=e.indexOf("?");t>=0&&(u.search=e.substr(t),e=e.substr(0,t)),e&&(u.pathname=e)}return u}function jcu(e,u,a,t){t===void 0&&(t={});let{window:n=document.defaultView,v5Compat:r=!1}=t,i=n.history,o=La.Pop,s=null,l=E();l==null&&(l=0,i.replaceState(za({},i.state,{idx:l}),""));function E(){return(i.state||{idx:null}).idx}function c(){o=La.Pop;let p=E(),f=p==null?null:p-l;l=p,s&&s({action:o,location:x.location,delta:f})}function D(p,f){o=La.Push;let g=VD(x.location,p,f);a&&a(g,p),l=E()+1;let F=AM(g,l),b=x.createHref(g);try{i.pushState(F,"",b)}catch(y){if(y instanceof DOMException&&y.name==="DataCloneError")throw y;n.location.assign(b)}r&&s&&s({action:o,location:x.location,delta:1})}function h(p,f){o=La.Replace;let g=VD(x.location,p,f);a&&a(g,p),l=E();let F=AM(g,l),b=x.createHref(g);i.replaceState(F,"",b),r&&s&&s({action:o,location:x.location,delta:0})}function m(p){let f=n.location.origin!=="null"?n.location.origin:n.location.href,g=typeof p=="string"?p:W4(p);return l0(f,"No window.location.(origin|href) available to create URL for href: "+g),new URL(g,f)}let x={get action(){return o},get location(){return e(n,i)},listen(p){if(s)throw new Error("A history only accepts one active listener");return n.addEventListener(vM,c),s=p,()=>{n.removeEventListener(vM,c),s=null}},createHref(p){return u(n,p)},createURL:m,encodeLocation(p){let f=m(p);return{pathname:f.pathname,search:f.search,hash:f.hash}},push:D,replace:h,go(p){return i.go(p)}};return x}var ya;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(ya||(ya={}));const Ncu=new Set(["lazy","caseSensitive","path","id","index","children"]);function Rcu(e){return e.index===!0}function v7(e,u,a,t){return a===void 0&&(a=[]),t===void 0&&(t={}),e.map((n,r)=>{let i=[...a,r],o=typeof n.id=="string"?n.id:i.join("-");if(l0(n.index!==!0||!n.children,"Cannot specify children on an index route"),l0(!t[o],'Found a route id collision on id "'+o+`". Route id's must be globally unique within Data Router usages`),Rcu(n)){let s=za({},n,u(n),{id:o});return t[o]=s,s}else{let s=za({},n,u(n),{id:o,children:void 0});return t[o]=s,n.children&&(s.children=v7(n.children,u,i,t)),s}})}function Fc(e,u,a){a===void 0&&(a="/");let t=typeof u=="string"?rl(u):u,n=rd(t.pathname||"/",a);if(n==null)return null;let r=Y$(e);_cu(r);let i=null;for(let o=0;i==null&&o<r.length;++o)i=Ucu(r[o],qcu(n));return i}function Lcu(e,u){let{route:a,pathname:t,params:n}=e;return{id:a.id,pathname:t,params:n,data:u[a.id],handle:a.handle}}function Y$(e,u,a,t){u===void 0&&(u=[]),a===void 0&&(a=[]),t===void 0&&(t="");let n=(r,i,o)=>{let s={relativePath:o===void 0?r.path||"":o,caseSensitive:r.caseSensitive===!0,childrenIndex:i,route:r};s.relativePath.startsWith("/")&&(l0(s.relativePath.startsWith(t),'Absolute route path "'+s.relativePath+'" nested under path '+('"'+t+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),s.relativePath=s.relativePath.slice(t.length));let l=ws([t,s.relativePath]),E=a.concat(s);r.children&&r.children.length>0&&(l0(r.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+l+'".')),Y$(r.children,u,E,l)),!(r.path==null&&!r.index)&&u.push({path:l,score:Jcu(l,r.index),routesMeta:E})};return e.forEach((r,i)=>{var o;if(r.path===""||!((o=r.path)!=null&&o.includes("?")))n(r,i);else for(let s of X$(r.path))n(r,i,s)}),u}function X$(e){let u=e.split("/");if(u.length===0)return[];let[a,...t]=u,n=a.endsWith("?"),r=a.replace(/\?$/,"");if(t.length===0)return n?[r,""]:[r];let i=X$(t.join("/")),o=[];return o.push(...i.map(s=>s===""?r:[r,s].join("/"))),n&&o.push(...i),o.map(s=>e.startsWith("/")&&s===""?"/":s)}function _cu(e){e.sort((u,a)=>u.score!==a.score?a.score-u.score:Wcu(u.routesMeta.map(t=>t.childrenIndex),a.routesMeta.map(t=>t.childrenIndex)))}const Icu=/^:[\w-]+$/,Kcu=3,$cu=2,Vcu=1,Hcu=10,Gcu=-2,bM=e=>e==="*";function Jcu(e,u){let a=e.split("/"),t=a.length;return a.some(bM)&&(t+=Gcu),u&&(t+=$cu),a.filter(n=>!bM(n)).reduce((n,r)=>n+(Icu.test(r)?Kcu:r===""?Vcu:Hcu),t)}function Wcu(e,u){return e.length===u.length&&e.slice(0,-1).every((t,n)=>t===u[n])?e[e.length-1]-u[u.length-1]:0}function Ucu(e,u){let{routesMeta:a}=e,t={},n="/",r=[];for(let i=0;i<a.length;++i){let o=a[i],s=i===a.length-1,l=n==="/"?u:u.slice(n.length)||"/",E=Zcu({path:o.relativePath,caseSensitive:o.caseSensitive,end:s},l);if(!E)return null;Object.assign(t,E.params);let c=o.route;r.push({params:t,pathname:ws([n,E.pathname]),pathnameBase:e3u(ws([n,E.pathnameBase])),route:c}),E.pathnameBase!=="/"&&(n=ws([n,E.pathnameBase]))}return r}function Zcu(e,u){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[a,t]=Qcu(e.path,e.caseSensitive,e.end),n=u.match(a);if(!n)return null;let r=n[0],i=r.replace(/(.)\/+$/,"$1"),o=n.slice(1);return{params:t.reduce((l,E,c)=>{let{paramName:D,isOptional:h}=E;if(D==="*"){let x=o[c]||"";i=r.slice(0,r.length-x.length).replace(/(.)\/+$/,"$1")}const m=o[c];return h&&!m?l[D]=void 0:l[D]=Ycu(m||"",D),l},{}),pathname:r,pathnameBase:i,pattern:e}}function Qcu(e,u,a){u===void 0&&(u=!1),a===void 0&&(a=!0),J4(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let t=[],n="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,o,s)=>(t.push({paramName:o,isOptional:s!=null}),s?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(t.push({paramName:"*"}),n+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):a?n+="\\/*$":e!==""&&e!=="/"&&(n+="(?:(?=\\/|$))"),[new RegExp(n,u?void 0:"i"),t]}function qcu(e){try{return decodeURI(e)}catch(u){return J4(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+u+").")),e}}function Ycu(e,u){try{return decodeURIComponent(e)}catch(a){return J4(!1,'The value for the URL param "'+u+'" will not be decoded because'+(' the string "'+e+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+a+").")),e}}function rd(e,u){if(u==="/")return e;if(!e.toLowerCase().startsWith(u.toLowerCase()))return null;let a=u.endsWith("/")?u.length-1:u.length,t=e.charAt(a);return t&&t!=="/"?null:e.slice(a)||"/"}function Xcu(e,u){u===void 0&&(u="/");let{pathname:a,search:t="",hash:n=""}=typeof e=="string"?rl(e):e;return{pathname:a?a.startsWith("/")?a:u3u(a,u):u,search:a3u(t),hash:t3u(n)}}function u3u(e,u){let a=u.replace(/\/+$/,"").split("/");return e.split("/").forEach(n=>{n===".."?a.length>1&&a.pop():n!=="."&&a.push(n)}),a.length>1?a.join("/"):"/"}function ck(e,u,a,t){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+u+"` field ["+JSON.stringify(t)+"]. Please separate it out to the ")+("`to."+a+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function uV(e){return e.filter((u,a)=>a===0||u.route.path&&u.route.path.length>0)}function Zg(e,u){let a=uV(e);return u?a.map((t,n)=>n===e.length-1?t.pathname:t.pathnameBase):a.map(t=>t.pathnameBase)}function Qg(e,u,a,t){t===void 0&&(t=!1);let n;typeof e=="string"?n=rl(e):(n=za({},e),l0(!n.pathname||!n.pathname.includes("?"),ck("?","pathname","search",n)),l0(!n.pathname||!n.pathname.includes("#"),ck("#","pathname","hash",n)),l0(!n.search||!n.search.includes("#"),ck("#","search","hash",n)));let r=e===""||n.pathname==="",i=r?"/":n.pathname,o;if(i==null)o=a;else{let c=u.length-1;if(!t&&i.startsWith("..")){let D=i.split("/");for(;D[0]==="..";)D.shift(),c-=1;n.pathname=D.join("/")}o=c>=0?u[c]:"/"}let s=Xcu(n,o),l=i&&i!=="/"&&i.endsWith("/"),E=(r||i===".")&&a.endsWith("/");return!s.pathname.endsWith("/")&&(l||E)&&(s.pathname+="/"),s}const ws=e=>e.join("/").replace(/\/\/+/g,"/"),e3u=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),a3u=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,t3u=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class qB{constructor(u,a,t,n){n===void 0&&(n=!1),this.status=u,this.statusText=a||"",this.internal=n,t instanceof Error?(this.data=t.toString(),this.error=t):this.data=t}}function eV(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const aV=["post","put","patch","delete"],n3u=new Set(aV),r3u=["get",...aV],i3u=new Set(r3u),o3u=new Set([301,302,303,307,308]),s3u=new Set([307,308]),dk={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},l3u={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},Zd={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},tV=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,E3u=e=>({hasErrorBoundary:!!e.hasErrorBoundary}),nV="remix-router-transitions";function c3u(e){const u=e.window?e.window:typeof window<"u"?window:void 0,a=typeof u<"u"&&typeof u.document<"u"&&typeof u.document.createElement<"u",t=!a;l0(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let n;if(e.mapRouteProperties)n=e.mapRouteProperties;else if(e.detectErrorBoundary){let H=e.detectErrorBoundary;n=X=>({hasErrorBoundary:H(X)})}else n=E3u;let r={},i=v7(e.routes,n,void 0,r),o,s=e.basename||"/",l=za({v7_fetcherPersist:!1,v7_normalizeFormMethod:!1,v7_partialHydration:!1,v7_prependBasename:!1,v7_relativeSplatPath:!1},e.future),E=null,c=new Set,D=null,h=null,m=null,x=e.hydrationData!=null,p=Fc(i,e.history.location,s),f=null;if(p==null){let H=Zr(404,{pathname:e.history.location.pathname}),{matches:X,route:Eu}=TM(i);p=X,f={[Eu.id]:H}}let g,F=p.some(H=>H.route.lazy),b=p.some(H=>H.route.loader);if(F)g=!1;else if(!b)g=!0;else if(l.v7_partialHydration){let H=e.hydrationData?e.hydrationData.loaderData:null,X=e.hydrationData?e.hydrationData.errors:null;g=p.every(Eu=>Eu.route.loader&&Eu.route.loader.hydrate!==!0&&(H&&H[Eu.route.id]!==void 0||X&&X[Eu.route.id]!==void 0))}else g=e.hydrationData!=null;let y,v={historyAction:e.history.action,location:e.history.location,matches:p,initialized:g,navigation:dk,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||f,fetchers:new Map,blockers:new Map},A=La.Pop,B=!1,j,R=!1,w=new Map,O=null,T=!1,z=!1,N=[],M=[],I=new Map,P=0,L=-1,K=new Map,W=new Set,_=new Map,Q=new Map,eu=new Set,U=new Map,iu=new Map,tu=!1;function Y(){if(E=e.history.listen(H=>{let{action:X,location:Eu,delta:Fu}=H;if(tu){tu=!1;return}J4(iu.size===0||Fu!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let Pu=PE({currentLocation:v.location,nextLocation:Eu,historyAction:X});if(Pu&&Fu!=null){tu=!0,e.history.go(Fu*-1),$r(Pu,{state:"blocked",location:Eu,proceed(){$r(Pu,{state:"proceeding",proceed:void 0,reset:void 0,location:Eu}),e.history.go(Fu)},reset(){let me=new Map(v.blockers);me.set(Pu,Zd),Au({blockers:me})}});return}return Yu(X,Eu)}),a){k3u(u,w);let H=()=>v3u(u,w);u.addEventListener("pagehide",H),O=()=>u.removeEventListener("pagehide",H)}return v.initialized||Yu(La.Pop,v.location,{initialHydration:!0}),y}function ou(){E&&E(),O&&O(),c.clear(),j&&j.abort(),v.fetchers.forEach((H,X)=>Ru(X)),v.blockers.forEach((H,X)=>Xt(X))}function Cu(H){return c.add(H),()=>c.delete(H)}function Au(H,X){X===void 0&&(X={}),v=za({},v,H);let Eu=[],Fu=[];l.v7_fetcherPersist&&v.fetchers.forEach((Pu,me)=>{Pu.state==="idle"&&(eu.has(me)?Fu.push(me):Eu.push(me))}),[...c].forEach(Pu=>Pu(v,{deletedFetchers:Fu,unstable_viewTransitionOpts:X.viewTransitionOpts,unstable_flushSync:X.flushSync===!0})),l.v7_fetcherPersist&&(Eu.forEach(Pu=>v.fetchers.delete(Pu)),Fu.forEach(Pu=>Ru(Pu)))}function mu(H,X,Eu){var Fu,Pu;let{flushSync:me}=Eu===void 0?{}:Eu,pe=v.actionData!=null&&v.navigation.formMethod!=null&&ji(v.navigation.formMethod)&&v.navigation.state==="loading"&&((Fu=H.state)==null?void 0:Fu._isRedirect)!==!0,ge;X.actionData?Object.keys(X.actionData).length>0?ge=X.actionData:ge=null:pe?ge=v.actionData:ge=null;let ke=X.loaderData?MM(v.loaderData,X.loaderData,X.matches||[],X.errors):v.loaderData,i0=v.blockers;i0.size>0&&(i0=new Map(i0),i0.forEach((Q0,jt)=>i0.set(jt,Zd)));let Xa=B===!0||v.navigation.formMethod!=null&&ji(v.navigation.formMethod)&&((Pu=H.state)==null?void 0:Pu._isRedirect)!==!0;o&&(i=o,o=void 0),T||A===La.Pop||(A===La.Push?e.history.push(H,H.state):A===La.Replace&&e.history.replace(H,H.state));let u0;if(A===La.Pop){let Q0=w.get(v.location.pathname);Q0&&Q0.has(H.pathname)?u0={currentLocation:v.location,nextLocation:H}:w.has(H.pathname)&&(u0={currentLocation:H,nextLocation:v.location})}else if(R){let Q0=w.get(v.location.pathname);Q0?Q0.add(H.pathname):(Q0=new Set([H.pathname]),w.set(v.location.pathname,Q0)),u0={currentLocation:v.location,nextLocation:H}}Au(za({},X,{actionData:ge,loaderData:ke,historyAction:A,location:H,initialized:!0,navigation:dk,revalidation:"idle",restoreScrollPosition:Xu(H,X.matches||v.matches),preventScrollReset:Xa,blockers:i0}),{viewTransitionOpts:u0,flushSync:me===!0}),A=La.Pop,B=!1,R=!1,T=!1,z=!1,N=[],M=[]}async function Nu(H,X){if(typeof H=="number"){e.history.go(H);return}let Eu=A7(v.location,v.matches,s,l.v7_prependBasename,H,l.v7_relativeSplatPath,X==null?void 0:X.fromRouteId,X==null?void 0:X.relative),{path:Fu,submission:Pu,error:me}=yM(l.v7_normalizeFormMethod,!1,Eu,X),pe=v.location,ge=VD(v.location,Fu,X&&X.state);ge=za({},ge,e.history.encodeLocation(ge));let ke=X&&X.replace!=null?X.replace:void 0,i0=La.Push;ke===!0?i0=La.Replace:ke===!1||Pu!=null&&ji(Pu.formMethod)&&Pu.formAction===v.location.pathname+v.location.search&&(i0=La.Replace);let Xa=X&&"preventScrollReset"in X?X.preventScrollReset===!0:void 0,u0=(X&&X.unstable_flushSync)===!0,Q0=PE({currentLocation:pe,nextLocation:ge,historyAction:i0});if(Q0){$r(Q0,{state:"blocked",location:ge,proceed(){$r(Q0,{state:"proceeding",proceed:void 0,reset:void 0,location:ge}),Nu(H,X)},reset(){let jt=new Map(v.blockers);jt.set(Q0,Zd),Au({blockers:jt})}});return}return await Yu(i0,ge,{submission:Pu,pendingError:me,preventScrollReset:Xa,replace:X&&X.replace,enableViewTransition:X&&X.unstable_viewTransition,flushSync:u0})}function le(){if(du(),Au({revalidation:"loading"}),v.navigation.state!=="submitting"){if(v.navigation.state==="idle"){Yu(v.historyAction,v.location,{startUninterruptedRevalidation:!0});return}Yu(A||v.historyAction,v.navigation.location,{overrideNavigation:v.navigation})}}async function Yu(H,X,Eu){j&&j.abort(),j=null,A=H,T=(Eu&&Eu.startUninterruptedRevalidation)===!0,_u(v.location,v.matches),B=(Eu&&Eu.preventScrollReset)===!0,R=(Eu&&Eu.enableViewTransition)===!0;let Fu=o||i,Pu=Eu&&Eu.overrideNavigation,me=Fc(Fu,X,s),pe=(Eu&&Eu.flushSync)===!0;if(!me){let jt=Zr(404,{pathname:X.pathname}),{matches:Vr,route:yt}=TM(Fu);Dl(),mu(X,{matches:Vr,loaderData:{},errors:{[yt.id]:jt}},{flushSync:pe});return}if(v.initialized&&!z&&x3u(v.location,X)&&!(Eu&&Eu.submission&&ji(Eu.submission.formMethod))){mu(X,{matches:me},{flushSync:pe});return}j=new AbortController;let ge=qd(e.history,X,j.signal,Eu&&Eu.submission),ke,i0;if(Eu&&Eu.pendingError)i0={[oD(me).route.id]:Eu.pendingError};else if(Eu&&Eu.submission&&ji(Eu.submission.formMethod)){let jt=await ve(ge,X,Eu.submission,me,{replace:Eu.replace,flushSync:pe});if(jt.shortCircuited)return;ke=jt.pendingActionData,i0=jt.pendingActionError,Pu=Dk(X,Eu.submission),pe=!1,ge=new Request(ge.url,{signal:ge.signal})}let{shortCircuited:Xa,loaderData:u0,errors:Q0}=await Ie(ge,X,me,Pu,Eu&&Eu.submission,Eu&&Eu.fetcherSubmission,Eu&&Eu.replace,Eu&&Eu.initialHydration===!0,pe,ke,i0);Xa||(j=null,mu(X,za({matches:me},ke?{actionData:ke}:{},{loaderData:u0,errors:Q0})))}async function ve(H,X,Eu,Fu,Pu){Pu===void 0&&(Pu={}),du();let me=C3u(X,Eu);Au({navigation:me},{flushSync:Pu.flushSync===!0});let pe,ge=y7(Fu,X);if(!ge.route.action&&!ge.route.lazy)pe={type:ya.error,error:Zr(405,{method:H.method,pathname:X.pathname,routeId:ge.route.id})};else if(pe=await Qd("action",H,ge,Fu,r,n,s,l.v7_relativeSplatPath),H.signal.aborted)return{shortCircuited:!0};if(g4(pe)){let ke;return Pu&&Pu.replace!=null?ke=Pu.replace:ke=pe.location===v.location.pathname+v.location.search,await V(v,pe,{submission:Eu,replace:ke}),{shortCircuited:!0}}if(kc(pe)){let ke=oD(Fu,ge.route.id);return(Pu&&Pu.replace)!==!0&&(A=La.Push),{pendingActionData:{},pendingActionError:{[ke.route.id]:pe.error}}}if(p4(pe))throw Zr(400,{type:"defer-action"});return{pendingActionData:{[ge.route.id]:pe.data}}}async function Ie(H,X,Eu,Fu,Pu,me,pe,ge,ke,i0,Xa){let u0=Fu||Dk(X,Pu),Q0=Pu||me||NM(u0),jt=o||i,[Vr,yt]=BM(e.history,v,Eu,Q0,X,l.v7_partialHydration&&ge===!0,z,N,M,eu,_,W,jt,s,i0,Xa);if(Dl(J0=>!(Eu&&Eu.some(la=>la.route.id===J0))||Vr&&Vr.some(la=>la.route.id===J0)),L=++P,Vr.length===0&&yt.length===0){let J0=t0();return mu(X,za({matches:Eu,loaderData:{},errors:Xa||null},i0?{actionData:i0}:{},J0?{fetchers:new Map(v.fetchers)}:{}),{flushSync:ke}),{shortCircuited:!0}}if(!T&&(!l.v7_partialHydration||!ge)){yt.forEach(la=>{let mo=v.fetchers.get(la.key),Qm=Yd(void 0,mo?mo.data:void 0);v.fetchers.set(la.key,Qm)});let J0=i0||v.actionData;Au(za({navigation:u0},J0?Object.keys(J0).length===0?{actionData:null}:{actionData:J0}:{},yt.length>0?{fetchers:new Map(v.fetchers)}:{}),{flushSync:ke})}yt.forEach(J0=>{I.has(J0.key)&&yu(J0.key),J0.controller&&I.set(J0.key,J0.controller)});let jE=()=>yt.forEach(J0=>yu(J0.key));j&&j.signal.addEventListener("abort",jE);let{results:jF,loaderResults:NE,fetcherResults:hl}=await au(v.matches,Eu,Vr,yt,H);if(H.signal.aborted)return{shortCircuited:!0};j&&j.signal.removeEventListener("abort",jE),yt.forEach(J0=>I.delete(J0.key));let Y1=PM(jF);if(Y1){if(Y1.idx>=Vr.length){let J0=yt[Y1.idx-Vr.length].key;W.add(J0)}return await V(v,Y1.result,{replace:pe}),{shortCircuited:!0}}let{loaderData:NF,errors:RF}=wM(v,Eu,Vr,NE,Xa,yt,hl,U);U.forEach((J0,la)=>{J0.subscribe(mo=>{(mo||J0.done)&&U.delete(la)})});let LF=t0(),RE=N0(L),Zm=LF||RE||yt.length>0;return za({loaderData:NF,errors:RF},Zm?{fetchers:new Map(v.fetchers)}:{})}function Zu(H,X,Eu,Fu){if(t)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");I.has(H)&&yu(H);let Pu=(Fu&&Fu.unstable_flushSync)===!0,me=o||i,pe=A7(v.location,v.matches,s,l.v7_prependBasename,Eu,l.v7_relativeSplatPath,X,Fu==null?void 0:Fu.relative),ge=Fc(me,pe,s);if(!ge){pu(H,X,Zr(404,{pathname:pe}),{flushSync:Pu});return}let{path:ke,submission:i0,error:Xa}=yM(l.v7_normalizeFormMethod,!0,pe,Fu);if(Xa){pu(H,X,Xa,{flushSync:Pu});return}let u0=y7(ge,ke);if(B=(Fu&&Fu.preventScrollReset)===!0,i0&&ji(i0.formMethod)){Gu(H,X,ke,u0,ge,Pu,i0);return}_.set(H,{routeId:X,path:ke}),fe(H,X,ke,u0,ge,Pu,i0)}async function Gu(H,X,Eu,Fu,Pu,me,pe){if(du(),_.delete(H),!Fu.route.action&&!Fu.route.lazy){let la=Zr(405,{method:pe.formMethod,pathname:Eu,routeId:X});pu(H,X,la,{flushSync:me});return}let ge=v.fetchers.get(H);bu(H,F3u(pe,ge),{flushSync:me});let ke=new AbortController,i0=qd(e.history,Eu,ke.signal,pe);I.set(H,ke);let Xa=P,u0=await Qd("action",i0,Fu,Pu,r,n,s,l.v7_relativeSplatPath);if(i0.signal.aborted){I.get(H)===ke&&I.delete(H);return}if(l.v7_fetcherPersist&&eu.has(H)){if(g4(u0)||kc(u0)){bu(H,kl(void 0));return}}else{if(g4(u0))if(I.delete(H),L>Xa){bu(H,kl(void 0));return}else return W.add(H),bu(H,Yd(pe)),V(v,u0,{fetcherSubmission:pe});if(kc(u0)){pu(H,X,u0.error);return}}if(p4(u0))throw Zr(400,{type:"defer-action"});let Q0=v.navigation.location||v.location,jt=qd(e.history,Q0,ke.signal),Vr=o||i,yt=v.navigation.state!=="idle"?Fc(Vr,v.navigation.location,s):v.matches;l0(yt,"Didn't find any matches after fetcher action");let jE=++P;K.set(H,jE);let jF=Yd(pe,u0.data);v.fetchers.set(H,jF);let[NE,hl]=BM(e.history,v,yt,pe,Q0,!1,z,N,M,eu,_,W,Vr,s,{[Fu.route.id]:u0.data},void 0);hl.filter(la=>la.key!==H).forEach(la=>{let mo=la.key,Qm=v.fetchers.get(mo),W1u=Yd(void 0,Qm?Qm.data:void 0);v.fetchers.set(mo,W1u),I.has(mo)&&yu(mo),la.controller&&I.set(mo,la.controller)}),Au({fetchers:new Map(v.fetchers)});let Y1=()=>hl.forEach(la=>yu(la.key));ke.signal.addEventListener("abort",Y1);let{results:NF,loaderResults:RF,fetcherResults:LF}=await au(v.matches,yt,NE,hl,jt);if(ke.signal.aborted)return;ke.signal.removeEventListener("abort",Y1),K.delete(H),I.delete(H),hl.forEach(la=>I.delete(la.key));let RE=PM(NF);if(RE){if(RE.idx>=NE.length){let la=hl[RE.idx-NE.length].key;W.add(la)}return V(v,RE.result)}let{loaderData:Zm,errors:J0}=wM(v,v.matches,NE,RF,void 0,hl,LF,U);if(v.fetchers.has(H)){let la=kl(u0.data);v.fetchers.set(H,la)}N0(jE),v.navigation.state==="loading"&&jE>L?(l0(A,"Expected pending action"),j&&j.abort(),mu(v.navigation.location,{matches:yt,loaderData:Zm,errors:J0,fetchers:new Map(v.fetchers)})):(Au({errors:J0,loaderData:MM(v.loaderData,Zm,yt,J0),fetchers:new Map(v.fetchers)}),z=!1)}async function fe(H,X,Eu,Fu,Pu,me,pe){let ge=v.fetchers.get(H);bu(H,Yd(pe,ge?ge.data:void 0),{flushSync:me});let ke=new AbortController,i0=qd(e.history,Eu,ke.signal);I.set(H,ke);let Xa=P,u0=await Qd("loader",i0,Fu,Pu,r,n,s,l.v7_relativeSplatPath);if(p4(u0)&&(u0=await oV(u0,i0.signal,!0)||u0),I.get(H)===ke&&I.delete(H),!i0.signal.aborted){if(eu.has(H)){bu(H,kl(void 0));return}if(g4(u0))if(L>Xa){bu(H,kl(void 0));return}else{W.add(H),await V(v,u0);return}if(kc(u0)){pu(H,X,u0.error);return}l0(!p4(u0),"Unhandled fetcher deferred data"),bu(H,kl(u0.data))}}async function V(H,X,Eu){let{submission:Fu,fetcherSubmission:Pu,replace:me}=Eu===void 0?{}:Eu;X.revalidate&&(z=!0);let pe=VD(H.location,X.location,{_isRedirect:!0});if(l0(pe,"Expected a location on the redirect navigation"),a){let Q0=!1;if(X.reloadDocument)Q0=!0;else if(tV.test(X.location)){const jt=e.history.createURL(X.location);Q0=jt.origin!==u.location.origin||rd(jt.pathname,s)==null}if(Q0){me?u.location.replace(X.location):u.location.assign(X.location);return}}j=null;let ge=me===!0?La.Replace:La.Push,{formMethod:ke,formAction:i0,formEncType:Xa}=H.navigation;!Fu&&!Pu&&ke&&i0&&Xa&&(Fu=NM(H.navigation));let u0=Fu||Pu;if(s3u.has(X.status)&&u0&&ji(u0.formMethod))await Yu(ge,pe,{submission:za({},u0,{formAction:X.location}),preventScrollReset:B});else{let Q0=Dk(pe,Fu);await Yu(ge,pe,{overrideNavigation:Q0,fetcherSubmission:Pu,preventScrollReset:B})}}async function au(H,X,Eu,Fu,Pu){let me=await Promise.all([...Eu.map(ke=>Qd("loader",Pu,ke,X,r,n,s,l.v7_relativeSplatPath)),...Fu.map(ke=>ke.matches&&ke.match&&ke.controller?Qd("loader",qd(e.history,ke.path,ke.controller.signal),ke.match,ke.matches,r,n,s,l.v7_relativeSplatPath):{type:ya.error,error:Zr(404,{pathname:ke.path})})]),pe=me.slice(0,Eu.length),ge=me.slice(Eu.length);return await Promise.all([jM(H,Eu,pe,pe.map(()=>Pu.signal),!1,v.loaderData),jM(H,Fu.map(ke=>ke.match),ge,Fu.map(ke=>ke.controller?ke.controller.signal:null),!0)]),{results:me,loaderResults:pe,fetcherResults:ge}}function du(){z=!0,N.push(...Dl()),_.forEach((H,X)=>{I.has(X)&&(M.push(X),yu(X))})}function bu(H,X,Eu){Eu===void 0&&(Eu={}),v.fetchers.set(H,X),Au({fetchers:new Map(v.fetchers)},{flushSync:(Eu&&Eu.flushSync)===!0})}function pu(H,X,Eu,Fu){Fu===void 0&&(Fu={});let Pu=oD(v.matches,X);Ru(H),Au({errors:{[Pu.route.id]:Eu},fetchers:new Map(v.fetchers)},{flushSync:(Fu&&Fu.flushSync)===!0})}function xu(H){return l.v7_fetcherPersist&&(Q.set(H,(Q.get(H)||0)+1),eu.has(H)&&eu.delete(H)),v.fetchers.get(H)||l3u}function Ru(H){let X=v.fetchers.get(H);I.has(H)&&!(X&&X.state==="loading"&&K.has(H))&&yu(H),_.delete(H),K.delete(H),W.delete(H),eu.delete(H),v.fetchers.delete(H)}function He(H){if(l.v7_fetcherPersist){let X=(Q.get(H)||0)-1;X<=0?(Q.delete(H),eu.add(H)):Q.set(H,X)}else Ru(H);Au({fetchers:new Map(v.fetchers)})}function yu(H){let X=I.get(H);l0(X,"Expected fetch controller: "+H),X.abort(),I.delete(H)}function Ke(H){for(let X of H){let Eu=xu(X),Fu=kl(Eu.data);v.fetchers.set(X,Fu)}}function t0(){let H=[],X=!1;for(let Eu of W){let Fu=v.fetchers.get(Eu);l0(Fu,"Expected fetcher: "+Eu),Fu.state==="loading"&&(W.delete(Eu),H.push(Eu),X=!0)}return Ke(H),X}function N0(H){let X=[];for(let[Eu,Fu]of K)if(Fu<H){let Pu=v.fetchers.get(Eu);l0(Pu,"Expected fetcher: "+Eu),Pu.state==="loading"&&(yu(Eu),K.delete(Eu),X.push(Eu))}return Ke(X),X.length>0}function ja(H,X){let Eu=v.blockers.get(H)||Zd;return iu.get(H)!==X&&iu.set(H,X),Eu}function Xt(H){v.blockers.delete(H),iu.delete(H)}function $r(H,X){let Eu=v.blockers.get(H)||Zd;l0(Eu.state==="unblocked"&&X.state==="blocked"||Eu.state==="blocked"&&X.state==="blocked"||Eu.state==="blocked"&&X.state==="proceeding"||Eu.state==="blocked"&&X.state==="unblocked"||Eu.state==="proceeding"&&X.state==="unblocked","Invalid blocker state transition: "+Eu.state+" -> "+X.state);let Fu=new Map(v.blockers);Fu.set(H,X),Au({blockers:Fu})}function PE(H){let{currentLocation:X,nextLocation:Eu,historyAction:Fu}=H;if(iu.size===0)return;iu.size>1&&J4(!1,"A router only supports one blocker at a time");let Pu=Array.from(iu.entries()),[me,pe]=Pu[Pu.length-1],ge=v.blockers.get(me);if(!(ge&&ge.state==="proceeding")&&pe({currentLocation:X,nextLocation:Eu,historyAction:Fu}))return me}function Dl(H){let X=[];return U.forEach((Eu,Fu)=>{(!H||H(Fu))&&(Eu.cancel(),X.push(Fu),U.delete(Fu))}),X}function fu(H,X,Eu){if(D=H,m=X,h=Eu||null,!x&&v.navigation===dk){x=!0;let Fu=Xu(v.location,v.matches);Fu!=null&&Au({restoreScrollPosition:Fu})}return()=>{D=null,m=null,h=null}}function Bu(H,X){return h&&h(H,X.map(Fu=>Lcu(Fu,v.loaderData)))||H.key}function _u(H,X){if(D&&m){let Eu=Bu(H,X);D[Eu]=m()}}function Xu(H,X){if(D){let Eu=Bu(H,X),Fu=D[Eu];if(typeof Fu=="number")return Fu}return null}function Lu(H){r={},o=v7(H,n,void 0,r)}return y={get basename(){return s},get future(){return l},get state(){return v},get routes(){return i},get window(){return u},initialize:Y,subscribe:Cu,enableScrollRestoration:fu,navigate:Nu,fetch:Zu,revalidate:le,createHref:H=>e.history.createHref(H),encodeLocation:H=>e.history.encodeLocation(H),getFetcher:xu,deleteFetcher:He,dispose:ou,getBlocker:ja,deleteBlocker:Xt,_internalFetchControllers:I,_internalActiveDeferreds:U,_internalSetRoutes:Lu},y}function d3u(e){return e!=null&&("formData"in e&&e.formData!=null||"body"in e&&e.body!==void 0)}function A7(e,u,a,t,n,r,i,o){let s,l;if(i){s=[];for(let c of u)if(s.push(c),c.route.id===i){l=c;break}}else s=u,l=u[u.length-1];let E=Qg(n||".",Zg(s,r),rd(e.pathname,a)||e.pathname,o==="path");return n==null&&(E.search=e.search,E.hash=e.hash),(n==null||n===""||n===".")&&l&&l.route.index&&!YB(E.search)&&(E.search=E.search?E.search.replace(/^\?/,"?index&"):"?index"),t&&a!=="/"&&(E.pathname=E.pathname==="/"?a:ws([a,E.pathname])),W4(E)}function yM(e,u,a,t){if(!t||!d3u(t))return{path:a};if(t.formMethod&&!g3u(t.formMethod))return{path:a,error:Zr(405,{method:t.formMethod})};let n=()=>({path:a,error:Zr(400,{type:"invalid-body"})}),r=t.formMethod||"get",i=e?r.toUpperCase():r.toLowerCase(),o=iV(a);if(t.body!==void 0){if(t.formEncType==="text/plain"){if(!ji(i))return n();let D=typeof t.body=="string"?t.body:t.body instanceof FormData||t.body instanceof URLSearchParams?Array.from(t.body.entries()).reduce((h,m)=>{let[x,p]=m;return""+h+x+"="+p+`
|
|
51
51
|
`},""):String(t.body);return{path:a,submission:{formMethod:i,formAction:o,formEncType:t.formEncType,formData:void 0,json:void 0,text:D}}}else if(t.formEncType==="application/json"){if(!ji(i))return n();try{let D=typeof t.body=="string"?JSON.parse(t.body):t.body;return{path:a,submission:{formMethod:i,formAction:o,formEncType:t.formEncType,formData:void 0,json:D,text:void 0}}}catch{return n()}}}l0(typeof FormData=="function","FormData is not available in this environment");let s,l;if(t.formData)s=b7(t.formData),l=t.formData;else if(t.body instanceof FormData)s=b7(t.body),l=t.body;else if(t.body instanceof URLSearchParams)s=t.body,l=OM(s);else if(t.body==null)s=new URLSearchParams,l=new FormData;else try{s=new URLSearchParams(t.body),l=OM(s)}catch{return n()}let E={formMethod:i,formAction:o,formEncType:t&&t.formEncType||"application/x-www-form-urlencoded",formData:l,json:void 0,text:void 0};if(ji(E.formMethod))return{path:a,submission:E};let c=rl(a);return u&&c.search&&YB(c.search)&&s.append("index",""),c.search="?"+s,{path:W4(c),submission:E}}function D3u(e,u){let a=e;if(u){let t=e.findIndex(n=>n.route.id===u);t>=0&&(a=e.slice(0,t))}return a}function BM(e,u,a,t,n,r,i,o,s,l,E,c,D,h,m,x){let p=x?Object.values(x)[0]:m?Object.values(m)[0]:void 0,f=e.createURL(u.location),g=e.createURL(n),F=x?Object.keys(x)[0]:void 0,y=D3u(a,F).filter((A,B)=>{let{route:j}=A;if(j.lazy)return!0;if(j.loader==null)return!1;if(r)return j.loader.hydrate?!0:u.loaderData[j.id]===void 0&&(!u.errors||u.errors[j.id]===void 0);if(h3u(u.loaderData,u.matches[B],A)||o.some(O=>O===A.route.id))return!0;let R=u.matches[B],w=A;return SM(A,za({currentUrl:f,currentParams:R.params,nextUrl:g,nextParams:w.params},t,{actionResult:p,defaultShouldRevalidate:i||f.pathname+f.search===g.pathname+g.search||f.search!==g.search||rV(R,w)}))}),v=[];return E.forEach((A,B)=>{if(r||!a.some(T=>T.route.id===A.routeId)||l.has(B))return;let j=Fc(D,A.path,h);if(!j){v.push({key:B,routeId:A.routeId,path:A.path,matches:null,match:null,controller:null});return}let R=u.fetchers.get(B),w=y7(j,A.path),O=!1;c.has(B)?O=!1:s.includes(B)?O=!0:R&&R.state!=="idle"&&R.data===void 0?O=i:O=SM(w,za({currentUrl:f,currentParams:u.matches[u.matches.length-1].params,nextUrl:g,nextParams:a[a.length-1].params},t,{actionResult:p,defaultShouldRevalidate:i})),O&&v.push({key:B,routeId:A.routeId,path:A.path,matches:j,match:w,controller:new AbortController})}),[y,v]}function h3u(e,u,a){let t=!u||a.route.id!==u.route.id,n=e[a.route.id]===void 0;return t||n}function rV(e,u){let a=e.route.path;return e.pathname!==u.pathname||a!=null&&a.endsWith("*")&&e.params["*"]!==u.params["*"]}function SM(e,u){if(e.route.shouldRevalidate){let a=e.route.shouldRevalidate(u);if(typeof a=="boolean")return a}return u.defaultShouldRevalidate}async function zM(e,u,a){if(!e.lazy)return;let t=await e.lazy();if(!e.lazy)return;let n=a[e.id];l0(n,"No route found in manifest");let r={};for(let i in t){let s=n[i]!==void 0&&i!=="hasErrorBoundary";J4(!s,'Route "'+n.id+'" has a static property "'+i+'" defined but its lazy function is also returning a value for this property. '+('The lazy route property "'+i+'" will be ignored.')),!s&&!Ncu.has(i)&&(r[i]=t[i])}Object.assign(n,r),Object.assign(n,za({},u(n),{lazy:void 0}))}async function Qd(e,u,a,t,n,r,i,o,s){s===void 0&&(s={});let l,E,c,D=x=>{let p,f=new Promise((g,F)=>p=F);return c=()=>p(),u.signal.addEventListener("abort",c),Promise.race([x({request:u,params:a.params,context:s.requestContext}),f])};try{let x=a.route[e];if(a.route.lazy)if(x){let p,f=await Promise.all([D(x).catch(g=>{p=g}),zM(a.route,r,n)]);if(p)throw p;E=f[0]}else if(await zM(a.route,r,n),x=a.route[e],x)E=await D(x);else if(e==="action"){let p=new URL(u.url),f=p.pathname+p.search;throw Zr(405,{method:u.method,pathname:f,routeId:a.route.id})}else return{type:ya.data,data:void 0};else if(x)E=await D(x);else{let p=new URL(u.url),f=p.pathname+p.search;throw Zr(404,{pathname:f})}l0(E!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+a.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(x){l=ya.error,E=x}finally{c&&u.signal.removeEventListener("abort",c)}if(p3u(E)){let x=E.status;if(o3u.has(x)){let f=E.headers.get("Location");if(l0(f,"Redirects returned/thrown from loaders/actions must have a Location header"),!tV.test(f))f=A7(new URL(u.url),t.slice(0,t.indexOf(a)+1),i,!0,f,o);else if(!s.isStaticRequest){let g=new URL(u.url),F=f.startsWith("//")?new URL(g.protocol+f):new URL(f),b=rd(F.pathname,i)!=null;F.origin===g.origin&&b&&(f=F.pathname+F.search+F.hash)}if(s.isStaticRequest)throw E.headers.set("Location",f),E;return{type:ya.redirect,status:x,location:f,revalidate:E.headers.get("X-Remix-Revalidate")!==null,reloadDocument:E.headers.get("X-Remix-Reload-Document")!==null}}if(s.isRouteRequest)throw{type:l===ya.error?ya.error:ya.data,response:E};let p;try{let f=E.headers.get("Content-Type");f&&/\bapplication\/json\b/.test(f)?E.body==null?p=null:p=await E.json():p=await E.text()}catch(f){return{type:ya.error,error:f}}return l===ya.error?{type:l,error:new qB(x,E.statusText,p),headers:E.headers}:{type:ya.data,data:p,statusCode:E.status,headers:E.headers}}if(l===ya.error)return{type:l,error:E};if(f3u(E)){var h,m;return{type:ya.deferred,deferredData:E,statusCode:(h=E.init)==null?void 0:h.status,headers:((m=E.init)==null?void 0:m.headers)&&new Headers(E.init.headers)}}return{type:ya.data,data:E}}function qd(e,u,a,t){let n=e.createURL(iV(u)).toString(),r={signal:a};if(t&&ji(t.formMethod)){let{formMethod:i,formEncType:o}=t;r.method=i.toUpperCase(),o==="application/json"?(r.headers=new Headers({"Content-Type":o}),r.body=JSON.stringify(t.json)):o==="text/plain"?r.body=t.text:o==="application/x-www-form-urlencoded"&&t.formData?r.body=b7(t.formData):r.body=t.formData}return new Request(n,r)}function b7(e){let u=new URLSearchParams;for(let[a,t]of e.entries())u.append(a,typeof t=="string"?t:t.name);return u}function OM(e){let u=new FormData;for(let[a,t]of e.entries())u.append(a,t);return u}function m3u(e,u,a,t,n){let r={},i=null,o,s=!1,l={};return a.forEach((E,c)=>{let D=u[c].route.id;if(l0(!g4(E),"Cannot handle redirect results in processLoaderData"),kc(E)){let h=oD(e,D),m=E.error;t&&(m=Object.values(t)[0],t=void 0),i=i||{},i[h.route.id]==null&&(i[h.route.id]=m),r[D]=void 0,s||(s=!0,o=eV(E.error)?E.error.status:500),E.headers&&(l[D]=E.headers)}else p4(E)?(n.set(D,E.deferredData),r[D]=E.deferredData.data):r[D]=E.data,E.statusCode!=null&&E.statusCode!==200&&!s&&(o=E.statusCode),E.headers&&(l[D]=E.headers)}),t&&(i=t,r[Object.keys(t)[0]]=void 0),{loaderData:r,errors:i,statusCode:o||200,loaderHeaders:l}}function wM(e,u,a,t,n,r,i,o){let{loaderData:s,errors:l}=m3u(u,a,t,n,o);for(let E=0;E<r.length;E++){let{key:c,match:D,controller:h}=r[E];l0(i!==void 0&&i[E]!==void 0,"Did not find corresponding fetcher result");let m=i[E];if(!(h&&h.signal.aborted))if(kc(m)){let x=oD(e.matches,D==null?void 0:D.route.id);l&&l[x.route.id]||(l=za({},l,{[x.route.id]:m.error})),e.fetchers.delete(c)}else if(g4(m))l0(!1,"Unhandled fetcher revalidation redirect");else if(p4(m))l0(!1,"Unhandled fetcher deferred data");else{let x=kl(m.data);e.fetchers.set(c,x)}}return{loaderData:s,errors:l}}function MM(e,u,a,t){let n=za({},u);for(let r of a){let i=r.route.id;if(u.hasOwnProperty(i)?u[i]!==void 0&&(n[i]=u[i]):e[i]!==void 0&&r.route.loader&&(n[i]=e[i]),t&&t.hasOwnProperty(i))break}return n}function oD(e,u){return(u?e.slice(0,e.findIndex(t=>t.route.id===u)+1):[...e]).reverse().find(t=>t.route.hasErrorBoundary===!0)||e[0]}function TM(e){let u=e.length===1?e[0]:e.find(a=>a.index||!a.path||a.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:u}],route:u}}function Zr(e,u){let{pathname:a,routeId:t,method:n,type:r}=u===void 0?{}:u,i="Unknown Server Error",o="Unknown @remix-run/router error";return e===400?(i="Bad Request",n&&a&&t?o="You made a "+n+' request to "'+a+'" but '+('did not provide a `loader` for route "'+t+'", ')+"so there is no way to handle the request.":r==="defer-action"?o="defer() is not supported in actions":r==="invalid-body"&&(o="Unable to encode submission body")):e===403?(i="Forbidden",o='Route "'+t+'" does not match URL "'+a+'"'):e===404?(i="Not Found",o='No route matches URL "'+a+'"'):e===405&&(i="Method Not Allowed",n&&a&&t?o="You made a "+n.toUpperCase()+' request to "'+a+'" but '+('did not provide an `action` for route "'+t+'", ')+"so there is no way to handle the request.":n&&(o='Invalid request method "'+n.toUpperCase()+'"')),new qB(e||500,i,new Error(o),!0)}function PM(e){for(let u=e.length-1;u>=0;u--){let a=e[u];if(g4(a))return{result:a,idx:u}}}function iV(e){let u=typeof e=="string"?rl(e):e;return W4(za({},u,{hash:""}))}function x3u(e,u){return e.pathname!==u.pathname||e.search!==u.search?!1:e.hash===""?u.hash!=="":e.hash===u.hash?!0:u.hash!==""}function p4(e){return e.type===ya.deferred}function kc(e){return e.type===ya.error}function g4(e){return(e&&e.type)===ya.redirect}function f3u(e){let u=e;return u&&typeof u=="object"&&typeof u.data=="object"&&typeof u.subscribe=="function"&&typeof u.cancel=="function"&&typeof u.resolveData=="function"}function p3u(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function g3u(e){return i3u.has(e.toLowerCase())}function ji(e){return n3u.has(e.toLowerCase())}async function jM(e,u,a,t,n,r){for(let i=0;i<a.length;i++){let o=a[i],s=u[i];if(!s)continue;let l=e.find(c=>c.route.id===s.route.id),E=l!=null&&!rV(l,s)&&(r&&r[s.route.id])!==void 0;if(p4(o)&&(n||E)){let c=t[i];l0(c,"Expected an AbortSignal for revalidating fetcher deferred result"),await oV(o,c,n).then(D=>{D&&(a[i]=D||a[i])})}}}async function oV(e,u,a){if(a===void 0&&(a=!1),!await e.deferredData.resolveData(u)){if(a)try{return{type:ya.data,data:e.deferredData.unwrappedData}}catch(n){return{type:ya.error,error:n}}return{type:ya.data,data:e.deferredData.data}}}function YB(e){return new URLSearchParams(e).getAll("index").some(u=>u==="")}function y7(e,u){let a=typeof u=="string"?rl(u).search:u.search;if(e[e.length-1].route.index&&YB(a||""))return e[e.length-1];let t=uV(e);return t[t.length-1]}function NM(e){let{formMethod:u,formAction:a,formEncType:t,text:n,formData:r,json:i}=e;if(!(!u||!a||!t)){if(n!=null)return{formMethod:u,formAction:a,formEncType:t,formData:void 0,json:void 0,text:n};if(r!=null)return{formMethod:u,formAction:a,formEncType:t,formData:r,json:void 0,text:void 0};if(i!==void 0)return{formMethod:u,formAction:a,formEncType:t,formData:void 0,json:i,text:void 0}}}function Dk(e,u){return u?{state:"loading",location:e,formMethod:u.formMethod,formAction:u.formAction,formEncType:u.formEncType,formData:u.formData,json:u.json,text:u.text}:{state:"loading",location:e,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function C3u(e,u){return{state:"submitting",location:e,formMethod:u.formMethod,formAction:u.formAction,formEncType:u.formEncType,formData:u.formData,json:u.json,text:u.text}}function Yd(e,u){return e?{state:"loading",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:u}:{state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:u}}function F3u(e,u){return{state:"submitting",formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:u?u.data:void 0}}function kl(e){return{state:"idle",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function k3u(e,u){try{let a=e.sessionStorage.getItem(nV);if(a){let t=JSON.parse(a);for(let[n,r]of Object.entries(t||{}))r&&Array.isArray(r)&&u.set(n,new Set(r||[]))}}catch{}}function v3u(e,u){if(u.size>0){let a={};for(let[t,n]of u)a[t]=[...n];try{e.sessionStorage.setItem(nV,JSON.stringify(a))}catch(t){J4(!1,"Failed to save applied view transitions in sessionStorage ("+t+").")}}}/**
|
|
52
52
|
* React Router v6.22.0
|
|
53
53
|
*
|
|
@@ -74,7 +74,7 @@ Error generating stack: `+r.message+`
|
|
|
74
74
|
*
|
|
75
75
|
* This source code is licensed under the MIT license found in the
|
|
76
76
|
* LICENSE file in the root directory of this source tree.
|
|
77
|
-
*/var E3=C;function Edu(e,u){return e===u&&(e!==0||1/e===1/u)||e!==e&&u!==u}var cdu=typeof Object.is=="function"?Object.is:Edu,ddu=E3.useState,Ddu=E3.useEffect,hdu=E3.useLayoutEffect,mdu=E3.useDebugValue;function xdu(e,u){var a=u(),t=ddu({inst:{value:a,getSnapshot:u}}),n=t[0].inst,r=t[1];return hdu(function(){n.value=a,n.getSnapshot=u,hk(n)&&r({inst:n})},[e,a,u]),Ddu(function(){return hk(n)&&r({inst:n}),e(function(){hk(n)&&r({inst:n})})},[e]),mdu(a),a}function hk(e){var u=e.getSnapshot;e=e.value;try{var a=u();return!cdu(e,a)}catch{return!0}}function fdu(e,u){return u()}var pdu=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?fdu:xdu;pV.useSyncExternalStore=E3.useSyncExternalStore!==void 0?E3.useSyncExternalStore:pdu;fV.exports=pV;var gdu=fV.exports;const gV=0,CV=1,FV=2,VM=3;var HM=Object.prototype.hasOwnProperty;function z7(e,u){var a,t;if(e===u)return!0;if(e&&u&&(a=e.constructor)===u.constructor){if(a===Date)return e.getTime()===u.getTime();if(a===RegExp)return e.toString()===u.toString();if(a===Array){if((t=e.length)===u.length)for(;t--&&z7(e[t],u[t]););return t===-1}if(!a||typeof e=="object"){t=0;for(a in e)if(HM.call(e,a)&&++t&&!HM.call(u,a)||!(a in u)||!z7(e[a],u[a]))return!1;return Object.keys(u).length===t}}return e!==e&&u!==u}const ys=new WeakMap,Rl=()=>{},on=Rl(),Hf=Object,F0=e=>e===on,Ki=e=>typeof e=="function",Vs=(e,u)=>({...e,...u}),kV=e=>Ki(e.then),mk={},hx={},XB="undefined",nm=typeof window!=XB,O7=typeof document!=XB,Cdu=nm&&"Deno"in window,Fdu=()=>nm&&typeof window.requestAnimationFrame!=XB,vV=(e,u)=>{const a=ys.get(e);return[()=>!F0(u)&&e.get(u)||mk,t=>{if(!F0(u)){const n=e.get(u);u in hx||(hx[u]=n),a[5](u,Vs(n,t),n||mk)}},a[6],()=>!F0(u)&&u in hx?hx[u]:!F0(u)&&e.get(u)||mk]};let w7=!0;const kdu=()=>w7,[M7,T7]=nm&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Rl,Rl],vdu=()=>{const e=O7&&document.visibilityState;return F0(e)||e!=="hidden"},Adu=e=>(O7&&document.addEventListener("visibilitychange",e),M7("focus",e),()=>{O7&&document.removeEventListener("visibilitychange",e),T7("focus",e)}),bdu=e=>{const u=()=>{w7=!0,e()},a=()=>{w7=!1};return M7("online",u),M7("offline",a),()=>{T7("online",u),T7("offline",a)}},ydu={isOnline:kdu,isVisible:vdu},Bdu={initFocus:Adu,initReconnect:bdu},GM=!nu.useId,JD=!nm||Cdu,Sdu=e=>Fdu()?window.requestAnimationFrame(e):setTimeout(e,1),L6=JD?C.useEffect:C.useLayoutEffect,xk=typeof navigator<"u"&&navigator.connection,JM=!JD&&xk&&(["slow-2g","2g"].includes(xk.effectiveType)||xk.saveData),mx=new WeakMap,zdu=e=>Hf.prototype.toString.call(e),fk=(e,u)=>e===`[object ${u}]`;let Odu=0;const P7=e=>{const u=typeof e,a=zdu(e),t=fk(a,"Date"),n=fk(a,"RegExp"),r=fk(a,"Object");let i,o;if(Hf(e)===e&&!t&&!n){if(i=mx.get(e),i)return i;if(i=++Odu+"~",mx.set(e,i),Array.isArray(e)){for(i="@",o=0;o<e.length;o++)i+=P7(e[o])+",";mx.set(e,i)}if(r){i="#";const s=Hf.keys(e).sort();for(;!F0(o=s.pop());)F0(e[o])||(i+=o+":"+P7(e[o])+",");mx.set(e,i)}}else i=t?e.toJSON():u=="symbol"?e.toString():u=="string"?JSON.stringify(e):""+e;return i},u8=e=>{if(Ki(e))try{e=e()}catch{e=""}const u=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?P7(e):"",[e,u]};let wdu=0;const j7=()=>++wdu;async function AV(...e){const[u,a,t,n]=e,r=Vs({populateCache:!0,throwOnError:!0},typeof n=="boolean"?{revalidate:n}:n||{});let i=r.populateCache;const o=r.rollbackOnError;let s=r.optimisticData;const l=D=>typeof o=="function"?o(D):o!==!1,E=r.throwOnError;if(Ki(a)){const D=a,h=[],m=u.keys();for(const x of m)!/^\$(inf|sub)\$/.test(x)&&D(u.get(x)._k)&&h.push(x);return Promise.all(h.map(c))}return c(a);async function c(D){const[h]=u8(D);if(!h)return;const[m,x]=vV(u,h),[p,f,g,F]=ys.get(u),b=()=>{const z=p[h];return(Ki(r.revalidate)?r.revalidate(m().data,D):r.revalidate!==!1)&&(delete g[h],delete F[h],z&&z[0])?z[0](FV).then(()=>m().data):m().data};if(e.length<3)return b();let y=t,v,A=!1;const B=j7();f[h]=[B,0];const j=!F0(s),R=m(),w=R.data,O=R._c,T=F0(O)?w:O;if(j&&(s=Ki(s)?s(T,w):s,x({data:s,_c:T})),Ki(y))try{y=y(T)}catch(z){v=z,A=!0}if(y&&kV(y))if(y=await y.catch(z=>{v=z,A=!0}),B!==f[h][0]){if(A)throw v;return y}else A&&j&&l(v)&&(i=!0,x({data:T,_c:on}));if(i&&!A)if(Ki(i)){const z=i(y,T);x({data:z,error:on,_c:on})}else x({data:y,error:on,_c:on});if(f[h][1]=j7(),Promise.resolve(b()).then(()=>{x({_c:on})}),A){if(E)throw v;return}return y}}const WM=(e,u)=>{for(const a in e)e[a][0]&&e[a][0](u)},bV=(e,u)=>{if(!ys.has(e)){const a=Vs(Bdu,u),t=Object.create(null),n=AV.bind(on,e);let r=Rl;const i=Object.create(null),o=(E,c)=>{const D=i[E]||[];return i[E]=D,D.push(c),()=>D.splice(D.indexOf(c),1)},s=(E,c,D)=>{e.set(E,c);const h=i[E];if(h)for(const m of h)m(c,D)},l=()=>{if(!ys.has(e)&&(ys.set(e,[t,Object.create(null),Object.create(null),Object.create(null),n,s,o]),!JD)){const E=a.initFocus(setTimeout.bind(on,WM.bind(on,t,gV))),c=a.initReconnect(setTimeout.bind(on,WM.bind(on,t,CV)));r=()=>{E&&E(),c&&c(),ys.delete(e)}}};return l(),[e,n,l,r]}return[e,ys.get(e)[4]]},Mdu=(e,u,a,t,n)=>{const r=a.errorRetryCount,i=n.retryCount,o=~~((Math.random()+.5)*(1<<(i<8?i:8)))*a.errorRetryInterval;!F0(r)&&i>r||setTimeout(t,o,n)},Tdu=z7,[e8,a8]=bV(new Map),yV=Vs({onLoadingSlow:Rl,onSuccess:Rl,onError:Rl,onErrorRetry:Mdu,onDiscarded:Rl,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:JM?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:JM?5e3:3e3,compare:Tdu,isPaused:()=>!1,cache:e8,mutate:a8,fallback:{}},ydu),BV=(e,u)=>{const a=Vs(e,u);if(u){const{use:t,fallback:n}=e,{use:r,fallback:i}=u;t&&r&&(a.use=t.concat(r)),n&&i&&(a.fallback=Vs(n,i))}return a},N7=C.createContext({}),Pdu=e=>{const{value:u}=e,a=C.useContext(N7),t=Ki(u),n=C.useMemo(()=>t?u(a):u,[t,a,u]),r=C.useMemo(()=>t?n:BV(a,n),[t,a,n]),i=n&&n.provider,o=C.useRef(on);i&&!o.current&&(o.current=bV(i(r.cache||e8),n));const s=o.current;return s&&(r.cache=s[0],r.mutate=s[1]),L6(()=>{if(s)return s[2]&&s[2](),s[3]},[]),C.createElement(N7.Provider,Vs(e,{value:r}))},jdu="$inf$",SV=nm&&window.__SWR_DEVTOOLS_USE__,Ndu=SV?window.__SWR_DEVTOOLS_USE__:[],Rdu=()=>{SV&&(window.__SWR_DEVTOOLS_REACT__=nu)},Ldu=e=>Ki(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],zV=()=>Vs(yV,C.useContext(N7)),_du=e=>(u,a,t)=>e(u,a&&((...r)=>{const[i]=u8(u),[,,,o]=ys.get(e8);if(i.startsWith(jdu))return a(...r);const s=o[i];return F0(s)?a(...r):(delete o[i],s)}),t),Idu=Ndu.concat(_du),Kdu=e=>function(...a){const t=zV(),[n,r,i]=Ldu(a),o=BV(t,i);let s=e;const{use:l}=o,E=(l||[]).concat(Idu);for(let c=E.length;c--;)s=E[c](s);return s(n,r||o.fetcher||null,o)},$du=(e,u,a)=>{const t=u[e]||(u[e]=[]);return t.push(a),()=>{const n=t.indexOf(a);n>=0&&(t[n]=t[t.length-1],t.pop())}};Rdu();const pk=nu.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(u=>{e.status="fulfilled",e.value=u},u=>{e.status="rejected",e.reason=u}),e}}),gk={dedupe:!0},Vdu=(e,u,a)=>{const{cache:t,compare:n,suspense:r,fallbackData:i,revalidateOnMount:o,revalidateIfStale:s,refreshInterval:l,refreshWhenHidden:E,refreshWhenOffline:c,keepPreviousData:D}=a,[h,m,x,p]=ys.get(t),[f,g]=u8(e),F=C.useRef(!1),b=C.useRef(!1),y=C.useRef(f),v=C.useRef(u),A=C.useRef(a),B=()=>A.current,j=()=>B().isVisible()&&B().isOnline(),[R,w,O,T]=vV(t,f),z=C.useRef({}).current,N=F0(i)?F0(a.fallback)?on:a.fallback[f]:i,M=(Nu,le)=>{for(const Yu in z){const ve=Yu;if(ve==="data"){if(!n(Nu[ve],le[ve])&&(!F0(Nu[ve])||!n(U,le[ve])))return!1}else if(le[ve]!==Nu[ve])return!1}return!0},I=C.useMemo(()=>{const Nu=!f||!u?!1:F0(o)?B().isPaused()||r?!1:s!==!1:o,le=fe=>{const V=Vs(fe);return delete V._k,Nu?{isValidating:!0,isLoading:!0,...V}:V},Yu=R(),ve=T(),Ie=le(Yu),Zu=Yu===ve?Ie:le(ve);let Gu=Ie;return[()=>{const fe=le(R());return M(fe,Gu)?(Gu.data=fe.data,Gu.isLoading=fe.isLoading,Gu.isValidating=fe.isValidating,Gu.error=fe.error,Gu):(Gu=fe,fe)},()=>Zu]},[t,f]),P=gdu.useSyncExternalStore(C.useCallback(Nu=>O(f,(le,Yu)=>{M(Yu,le)||Nu()}),[t,f]),I[0],I[1]),L=!F.current,K=h[f]&&h[f].length>0,W=P.data,_=F0(W)?N&&kV(N)?pk(N):N:W,Q=P.error,eu=C.useRef(_),U=D?F0(W)?F0(eu.current)?_:eu.current:W:_,iu=K&&!F0(Q)?!1:L&&!F0(o)?o:B().isPaused()?!1:r?F0(_)?!1:s:F0(_)||s,tu=!!(f&&u&&L&&iu),Y=F0(P.isValidating)?tu:P.isValidating,ou=F0(P.isLoading)?tu:P.isLoading,Cu=C.useCallback(async Nu=>{const le=v.current;if(!f||!le||b.current||B().isPaused())return!1;let Yu,ve,Ie=!0;const Zu=Nu||{},Gu=!x[f]||!Zu.dedupe,fe=()=>GM?!b.current&&f===y.current&&F.current:f===y.current,V={isValidating:!1,isLoading:!1},au=()=>{w(V)},du=()=>{const pu=x[f];pu&&pu[1]===ve&&delete x[f]},bu={isValidating:!0};F0(R().data)&&(bu.isLoading=!0);try{if(Gu&&(w(bu),a.loadingTimeout&&F0(R().data)&&setTimeout(()=>{Ie&&fe()&&B().onLoadingSlow(f,a)},a.loadingTimeout),x[f]=[le(g),j7()]),[Yu,ve]=x[f],Yu=await Yu,Gu&&setTimeout(du,a.dedupingInterval),!x[f]||x[f][1]!==ve)return Gu&&fe()&&B().onDiscarded(f),!1;V.error=on;const pu=m[f];if(!F0(pu)&&(ve<=pu[0]||ve<=pu[1]||pu[1]===0))return au(),Gu&&fe()&&B().onDiscarded(f),!1;const xu=R().data;V.data=n(xu,Yu)?xu:Yu,Gu&&fe()&&B().onSuccess(Yu,f,a)}catch(pu){du();const xu=B(),{shouldRetryOnError:Lu}=xu;xu.isPaused()||(V.error=pu,Gu&&fe()&&(xu.onError(pu,f,xu),(Lu===!0||Ki(Lu)&&Lu(pu))&&(!B().revalidateOnFocus||!B().revalidateOnReconnect||j())&&xu.onErrorRetry(pu,f,xu,He=>{const yu=h[f];yu&&yu[0]&&yu[0](VM,He)},{retryCount:(Zu.retryCount||0)+1,dedupe:!0})))}return Ie=!1,au(),!0},[f,t]),Au=C.useCallback((...Nu)=>AV(t,y.current,...Nu),[]);if(L6(()=>{v.current=u,A.current=a,F0(W)||(eu.current=W)}),L6(()=>{if(!f)return;const Nu=Cu.bind(on,gk);let le=0;B().revalidateOnFocus&&(le=Date.now()+B().focusThrottleInterval);const ve=$du(f,h,(Ie,Zu={})=>{if(Ie==gV){const Gu=Date.now();B().revalidateOnFocus&&Gu>le&&j()&&(le=Gu+B().focusThrottleInterval,Nu())}else if(Ie==CV)B().revalidateOnReconnect&&j()&&Nu();else{if(Ie==FV)return Cu();if(Ie==VM)return Cu(Zu)}});return b.current=!1,y.current=f,F.current=!0,w({_k:g}),iu&&(x[f]||(F0(_)||JD?Nu():Sdu(Nu))),()=>{b.current=!0,ve()}},[f]),L6(()=>{let Nu;function le(){const ve=Ki(l)?l(R().data):l;ve&&Nu!==-1&&(Nu=setTimeout(Yu,ve))}function Yu(){!R().error&&(E||B().isVisible())&&(c||B().isOnline())?Cu(gk).then(le):le()}return le(),()=>{Nu&&(clearTimeout(Nu),Nu=-1)}},[l,E,c,f]),C.useDebugValue(U),r&&F0(_)&&f){if(!GM&&JD)throw new Error("Fallback data is required when using Suspense in SSR.");v.current=u,A.current=a,b.current=!1;const Nu=p[f];if(!F0(Nu)){const le=Au(Nu);pk(le)}if(F0(Q)){const le=Cu(gk);F0(U)||(le.status="fulfilled",le.value=!0),pk(le)}else throw Q}return{mutate:Au,get data(){return z.data=!0,U},get error(){return z.error=!0,Q},get isValidating(){return z.isValidating=!0,Y},get isLoading(){return z.isLoading=!0,ou}}},Hdu=Hf.defineProperty(Pdu,"defaultValue",{value:yV}),ns=Kdu(Vdu);function UM(e,u){if(typeof e=="function")return e(u);e!=null&&(e.current=u)}function Hs(...e){return u=>{let a=!1;const t=e.map(n=>{const r=UM(n,u);return!a&&typeof r=="function"&&(a=!0),r});if(a)return()=>{for(let n=0;n<t.length;n++){const r=t[n];typeof r=="function"?r():UM(e[n],null)}}}}function Xe(...e){return C.useCallback(Hs(...e),e)}function c1(e){const u=Gdu(e),a=C.forwardRef((t,n)=>{const{children:r,...i}=t,o=C.Children.toArray(r),s=o.find(Jdu);if(s){const l=s.props.children,E=o.map(c=>c===s?C.Children.count(l)>1?C.Children.only(null):C.isValidElement(l)?l.props.children:null:c);return d.jsx(u,{...i,ref:n,children:C.isValidElement(l)?C.cloneElement(l,void 0,E):null})}return d.jsx(u,{...i,ref:n,children:r})});return a.displayName=`${e}.Slot`,a}var ol=c1("Slot");function Gdu(e){const u=C.forwardRef((a,t)=>{const{children:n,...r}=a;if(C.isValidElement(n)){const i=Udu(n),o=Wdu(r,n.props);return n.type!==C.Fragment&&(o.ref=t?Hs(t,i):i),C.cloneElement(n,o)}return C.Children.count(n)>1?C.Children.only(null):null});return u.displayName=`${e}.SlotClone`,u}var OV=Symbol("radix.slottable");function wV(e){const u=({children:a})=>d.jsx(d.Fragment,{children:a});return u.displayName=`${e}.Slottable`,u.__radixId=OV,u}function Jdu(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===OV}function Wdu(e,u){const a={...u};for(const t in u){const n=e[t],r=u[t];/^on[A-Z]/.test(t)?n&&r?a[t]=(...o)=>{const s=r(...o);return n(...o),s}:n&&(a[t]=n):t==="style"?a[t]={...n,...r}:t==="className"&&(a[t]=[n,r].filter(Boolean).join(" "))}return{...e,...a}}function Udu(e){var t,n;let u=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=u&&"isReactWarning"in u&&u.isReactWarning;return a?e.ref:(u=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,a=u&&"isReactWarning"in u&&u.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}function MV(e){var u,a,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e))for(u=0;u<e.length;u++)e[u]&&(a=MV(e[u]))&&(t&&(t+=" "),t+=a);else for(u in e)e[u]&&(t&&(t+=" "),t+=u);return t}function TV(){for(var e,u,a=0,t="";a<arguments.length;)(e=arguments[a++])&&(u=MV(e))&&(t&&(t+=" "),t+=u);return t}const ZM=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,QM=TV,P1=(e,u)=>a=>{var t;if((u==null?void 0:u.variants)==null)return QM(e,a==null?void 0:a.class,a==null?void 0:a.className);const{variants:n,defaultVariants:r}=u,i=Object.keys(n).map(l=>{const E=a==null?void 0:a[l],c=r==null?void 0:r[l];if(E===null)return null;const D=ZM(E)||ZM(c);return n[l][D]}),o=a&&Object.entries(a).reduce((l,E)=>{let[c,D]=E;return D===void 0||(l[c]=D),l},{}),s=u==null||(t=u.compoundVariants)===null||t===void 0?void 0:t.reduce((l,E)=>{let{class:c,className:D,...h}=E;return Object.entries(h).every(m=>{let[x,p]=m;return Array.isArray(p)?p.includes({...r,...o}[x]):{...r,...o}[x]===p})?[...l,c,D]:l},[]);return QM(e,i,s,a==null?void 0:a.class,a==null?void 0:a.className)};/**
|
|
77
|
+
*/var E3=C;function Edu(e,u){return e===u&&(e!==0||1/e===1/u)||e!==e&&u!==u}var cdu=typeof Object.is=="function"?Object.is:Edu,ddu=E3.useState,Ddu=E3.useEffect,hdu=E3.useLayoutEffect,mdu=E3.useDebugValue;function xdu(e,u){var a=u(),t=ddu({inst:{value:a,getSnapshot:u}}),n=t[0].inst,r=t[1];return hdu(function(){n.value=a,n.getSnapshot=u,hk(n)&&r({inst:n})},[e,a,u]),Ddu(function(){return hk(n)&&r({inst:n}),e(function(){hk(n)&&r({inst:n})})},[e]),mdu(a),a}function hk(e){var u=e.getSnapshot;e=e.value;try{var a=u();return!cdu(e,a)}catch{return!0}}function fdu(e,u){return u()}var pdu=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?fdu:xdu;pV.useSyncExternalStore=E3.useSyncExternalStore!==void 0?E3.useSyncExternalStore:pdu;fV.exports=pV;var gdu=fV.exports;const gV=0,CV=1,FV=2,VM=3;var HM=Object.prototype.hasOwnProperty;function z7(e,u){var a,t;if(e===u)return!0;if(e&&u&&(a=e.constructor)===u.constructor){if(a===Date)return e.getTime()===u.getTime();if(a===RegExp)return e.toString()===u.toString();if(a===Array){if((t=e.length)===u.length)for(;t--&&z7(e[t],u[t]););return t===-1}if(!a||typeof e=="object"){t=0;for(a in e)if(HM.call(e,a)&&++t&&!HM.call(u,a)||!(a in u)||!z7(e[a],u[a]))return!1;return Object.keys(u).length===t}}return e!==e&&u!==u}const ys=new WeakMap,Rl=()=>{},on=Rl(),Hf=Object,F0=e=>e===on,Ki=e=>typeof e=="function",Vs=(e,u)=>({...e,...u}),kV=e=>Ki(e.then),mk={},hx={},XB="undefined",nm=typeof window!=XB,O7=typeof document!=XB,Cdu=nm&&"Deno"in window,Fdu=()=>nm&&typeof window.requestAnimationFrame!=XB,vV=(e,u)=>{const a=ys.get(e);return[()=>!F0(u)&&e.get(u)||mk,t=>{if(!F0(u)){const n=e.get(u);u in hx||(hx[u]=n),a[5](u,Vs(n,t),n||mk)}},a[6],()=>!F0(u)&&u in hx?hx[u]:!F0(u)&&e.get(u)||mk]};let w7=!0;const kdu=()=>w7,[M7,T7]=nm&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Rl,Rl],vdu=()=>{const e=O7&&document.visibilityState;return F0(e)||e!=="hidden"},Adu=e=>(O7&&document.addEventListener("visibilitychange",e),M7("focus",e),()=>{O7&&document.removeEventListener("visibilitychange",e),T7("focus",e)}),bdu=e=>{const u=()=>{w7=!0,e()},a=()=>{w7=!1};return M7("online",u),M7("offline",a),()=>{T7("online",u),T7("offline",a)}},ydu={isOnline:kdu,isVisible:vdu},Bdu={initFocus:Adu,initReconnect:bdu},GM=!nu.useId,JD=!nm||Cdu,Sdu=e=>Fdu()?window.requestAnimationFrame(e):setTimeout(e,1),L6=JD?C.useEffect:C.useLayoutEffect,xk=typeof navigator<"u"&&navigator.connection,JM=!JD&&xk&&(["slow-2g","2g"].includes(xk.effectiveType)||xk.saveData),mx=new WeakMap,zdu=e=>Hf.prototype.toString.call(e),fk=(e,u)=>e===`[object ${u}]`;let Odu=0;const P7=e=>{const u=typeof e,a=zdu(e),t=fk(a,"Date"),n=fk(a,"RegExp"),r=fk(a,"Object");let i,o;if(Hf(e)===e&&!t&&!n){if(i=mx.get(e),i)return i;if(i=++Odu+"~",mx.set(e,i),Array.isArray(e)){for(i="@",o=0;o<e.length;o++)i+=P7(e[o])+",";mx.set(e,i)}if(r){i="#";const s=Hf.keys(e).sort();for(;!F0(o=s.pop());)F0(e[o])||(i+=o+":"+P7(e[o])+",");mx.set(e,i)}}else i=t?e.toJSON():u=="symbol"?e.toString():u=="string"?JSON.stringify(e):""+e;return i},u8=e=>{if(Ki(e))try{e=e()}catch{e=""}const u=e;return e=typeof e=="string"?e:(Array.isArray(e)?e.length:e)?P7(e):"",[e,u]};let wdu=0;const j7=()=>++wdu;async function AV(...e){const[u,a,t,n]=e,r=Vs({populateCache:!0,throwOnError:!0},typeof n=="boolean"?{revalidate:n}:n||{});let i=r.populateCache;const o=r.rollbackOnError;let s=r.optimisticData;const l=D=>typeof o=="function"?o(D):o!==!1,E=r.throwOnError;if(Ki(a)){const D=a,h=[],m=u.keys();for(const x of m)!/^\$(inf|sub)\$/.test(x)&&D(u.get(x)._k)&&h.push(x);return Promise.all(h.map(c))}return c(a);async function c(D){const[h]=u8(D);if(!h)return;const[m,x]=vV(u,h),[p,f,g,F]=ys.get(u),b=()=>{const z=p[h];return(Ki(r.revalidate)?r.revalidate(m().data,D):r.revalidate!==!1)&&(delete g[h],delete F[h],z&&z[0])?z[0](FV).then(()=>m().data):m().data};if(e.length<3)return b();let y=t,v,A=!1;const B=j7();f[h]=[B,0];const j=!F0(s),R=m(),w=R.data,O=R._c,T=F0(O)?w:O;if(j&&(s=Ki(s)?s(T,w):s,x({data:s,_c:T})),Ki(y))try{y=y(T)}catch(z){v=z,A=!0}if(y&&kV(y))if(y=await y.catch(z=>{v=z,A=!0}),B!==f[h][0]){if(A)throw v;return y}else A&&j&&l(v)&&(i=!0,x({data:T,_c:on}));if(i&&!A)if(Ki(i)){const z=i(y,T);x({data:z,error:on,_c:on})}else x({data:y,error:on,_c:on});if(f[h][1]=j7(),Promise.resolve(b()).then(()=>{x({_c:on})}),A){if(E)throw v;return}return y}}const WM=(e,u)=>{for(const a in e)e[a][0]&&e[a][0](u)},bV=(e,u)=>{if(!ys.has(e)){const a=Vs(Bdu,u),t=Object.create(null),n=AV.bind(on,e);let r=Rl;const i=Object.create(null),o=(E,c)=>{const D=i[E]||[];return i[E]=D,D.push(c),()=>D.splice(D.indexOf(c),1)},s=(E,c,D)=>{e.set(E,c);const h=i[E];if(h)for(const m of h)m(c,D)},l=()=>{if(!ys.has(e)&&(ys.set(e,[t,Object.create(null),Object.create(null),Object.create(null),n,s,o]),!JD)){const E=a.initFocus(setTimeout.bind(on,WM.bind(on,t,gV))),c=a.initReconnect(setTimeout.bind(on,WM.bind(on,t,CV)));r=()=>{E&&E(),c&&c(),ys.delete(e)}}};return l(),[e,n,l,r]}return[e,ys.get(e)[4]]},Mdu=(e,u,a,t,n)=>{const r=a.errorRetryCount,i=n.retryCount,o=~~((Math.random()+.5)*(1<<(i<8?i:8)))*a.errorRetryInterval;!F0(r)&&i>r||setTimeout(t,o,n)},Tdu=z7,[e8,a8]=bV(new Map),yV=Vs({onLoadingSlow:Rl,onSuccess:Rl,onError:Rl,onErrorRetry:Mdu,onDiscarded:Rl,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:JM?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:JM?5e3:3e3,compare:Tdu,isPaused:()=>!1,cache:e8,mutate:a8,fallback:{}},ydu),BV=(e,u)=>{const a=Vs(e,u);if(u){const{use:t,fallback:n}=e,{use:r,fallback:i}=u;t&&r&&(a.use=t.concat(r)),n&&i&&(a.fallback=Vs(n,i))}return a},N7=C.createContext({}),Pdu=e=>{const{value:u}=e,a=C.useContext(N7),t=Ki(u),n=C.useMemo(()=>t?u(a):u,[t,a,u]),r=C.useMemo(()=>t?n:BV(a,n),[t,a,n]),i=n&&n.provider,o=C.useRef(on);i&&!o.current&&(o.current=bV(i(r.cache||e8),n));const s=o.current;return s&&(r.cache=s[0],r.mutate=s[1]),L6(()=>{if(s)return s[2]&&s[2](),s[3]},[]),C.createElement(N7.Provider,Vs(e,{value:r}))},jdu="$inf$",SV=nm&&window.__SWR_DEVTOOLS_USE__,Ndu=SV?window.__SWR_DEVTOOLS_USE__:[],Rdu=()=>{SV&&(window.__SWR_DEVTOOLS_REACT__=nu)},Ldu=e=>Ki(e[1])?[e[0],e[1],e[2]||{}]:[e[0],null,(e[1]===null?e[2]:e[1])||{}],zV=()=>Vs(yV,C.useContext(N7)),_du=e=>(u,a,t)=>e(u,a&&((...r)=>{const[i]=u8(u),[,,,o]=ys.get(e8);if(i.startsWith(jdu))return a(...r);const s=o[i];return F0(s)?a(...r):(delete o[i],s)}),t),Idu=Ndu.concat(_du),Kdu=e=>function(...a){const t=zV(),[n,r,i]=Ldu(a),o=BV(t,i);let s=e;const{use:l}=o,E=(l||[]).concat(Idu);for(let c=E.length;c--;)s=E[c](s);return s(n,r||o.fetcher||null,o)},$du=(e,u,a)=>{const t=u[e]||(u[e]=[]);return t.push(a),()=>{const n=t.indexOf(a);n>=0&&(t[n]=t[t.length-1],t.pop())}};Rdu();const pk=nu.use||(e=>{switch(e.status){case"pending":throw e;case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e.status="pending",e.then(u=>{e.status="fulfilled",e.value=u},u=>{e.status="rejected",e.reason=u}),e}}),gk={dedupe:!0},Vdu=(e,u,a)=>{const{cache:t,compare:n,suspense:r,fallbackData:i,revalidateOnMount:o,revalidateIfStale:s,refreshInterval:l,refreshWhenHidden:E,refreshWhenOffline:c,keepPreviousData:D}=a,[h,m,x,p]=ys.get(t),[f,g]=u8(e),F=C.useRef(!1),b=C.useRef(!1),y=C.useRef(f),v=C.useRef(u),A=C.useRef(a),B=()=>A.current,j=()=>B().isVisible()&&B().isOnline(),[R,w,O,T]=vV(t,f),z=C.useRef({}).current,N=F0(i)?F0(a.fallback)?on:a.fallback[f]:i,M=(Nu,le)=>{for(const Yu in z){const ve=Yu;if(ve==="data"){if(!n(Nu[ve],le[ve])&&(!F0(Nu[ve])||!n(U,le[ve])))return!1}else if(le[ve]!==Nu[ve])return!1}return!0},I=C.useMemo(()=>{const Nu=!f||!u?!1:F0(o)?B().isPaused()||r?!1:s!==!1:o,le=fe=>{const V=Vs(fe);return delete V._k,Nu?{isValidating:!0,isLoading:!0,...V}:V},Yu=R(),ve=T(),Ie=le(Yu),Zu=Yu===ve?Ie:le(ve);let Gu=Ie;return[()=>{const fe=le(R());return M(fe,Gu)?(Gu.data=fe.data,Gu.isLoading=fe.isLoading,Gu.isValidating=fe.isValidating,Gu.error=fe.error,Gu):(Gu=fe,fe)},()=>Zu]},[t,f]),P=gdu.useSyncExternalStore(C.useCallback(Nu=>O(f,(le,Yu)=>{M(Yu,le)||Nu()}),[t,f]),I[0],I[1]),L=!F.current,K=h[f]&&h[f].length>0,W=P.data,_=F0(W)?N&&kV(N)?pk(N):N:W,Q=P.error,eu=C.useRef(_),U=D?F0(W)?F0(eu.current)?_:eu.current:W:_,iu=K&&!F0(Q)?!1:L&&!F0(o)?o:B().isPaused()?!1:r?F0(_)?!1:s:F0(_)||s,tu=!!(f&&u&&L&&iu),Y=F0(P.isValidating)?tu:P.isValidating,ou=F0(P.isLoading)?tu:P.isLoading,Cu=C.useCallback(async Nu=>{const le=v.current;if(!f||!le||b.current||B().isPaused())return!1;let Yu,ve,Ie=!0;const Zu=Nu||{},Gu=!x[f]||!Zu.dedupe,fe=()=>GM?!b.current&&f===y.current&&F.current:f===y.current,V={isValidating:!1,isLoading:!1},au=()=>{w(V)},du=()=>{const pu=x[f];pu&&pu[1]===ve&&delete x[f]},bu={isValidating:!0};F0(R().data)&&(bu.isLoading=!0);try{if(Gu&&(w(bu),a.loadingTimeout&&F0(R().data)&&setTimeout(()=>{Ie&&fe()&&B().onLoadingSlow(f,a)},a.loadingTimeout),x[f]=[le(g),j7()]),[Yu,ve]=x[f],Yu=await Yu,Gu&&setTimeout(du,a.dedupingInterval),!x[f]||x[f][1]!==ve)return Gu&&fe()&&B().onDiscarded(f),!1;V.error=on;const pu=m[f];if(!F0(pu)&&(ve<=pu[0]||ve<=pu[1]||pu[1]===0))return au(),Gu&&fe()&&B().onDiscarded(f),!1;const xu=R().data;V.data=n(xu,Yu)?xu:Yu,Gu&&fe()&&B().onSuccess(Yu,f,a)}catch(pu){du();const xu=B(),{shouldRetryOnError:Ru}=xu;xu.isPaused()||(V.error=pu,Gu&&fe()&&(xu.onError(pu,f,xu),(Ru===!0||Ki(Ru)&&Ru(pu))&&(!B().revalidateOnFocus||!B().revalidateOnReconnect||j())&&xu.onErrorRetry(pu,f,xu,He=>{const yu=h[f];yu&&yu[0]&&yu[0](VM,He)},{retryCount:(Zu.retryCount||0)+1,dedupe:!0})))}return Ie=!1,au(),!0},[f,t]),Au=C.useCallback((...Nu)=>AV(t,y.current,...Nu),[]);if(L6(()=>{v.current=u,A.current=a,F0(W)||(eu.current=W)}),L6(()=>{if(!f)return;const Nu=Cu.bind(on,gk);let le=0;B().revalidateOnFocus&&(le=Date.now()+B().focusThrottleInterval);const ve=$du(f,h,(Ie,Zu={})=>{if(Ie==gV){const Gu=Date.now();B().revalidateOnFocus&&Gu>le&&j()&&(le=Gu+B().focusThrottleInterval,Nu())}else if(Ie==CV)B().revalidateOnReconnect&&j()&&Nu();else{if(Ie==FV)return Cu();if(Ie==VM)return Cu(Zu)}});return b.current=!1,y.current=f,F.current=!0,w({_k:g}),iu&&(x[f]||(F0(_)||JD?Nu():Sdu(Nu))),()=>{b.current=!0,ve()}},[f]),L6(()=>{let Nu;function le(){const ve=Ki(l)?l(R().data):l;ve&&Nu!==-1&&(Nu=setTimeout(Yu,ve))}function Yu(){!R().error&&(E||B().isVisible())&&(c||B().isOnline())?Cu(gk).then(le):le()}return le(),()=>{Nu&&(clearTimeout(Nu),Nu=-1)}},[l,E,c,f]),C.useDebugValue(U),r&&F0(_)&&f){if(!GM&&JD)throw new Error("Fallback data is required when using Suspense in SSR.");v.current=u,A.current=a,b.current=!1;const Nu=p[f];if(!F0(Nu)){const le=Au(Nu);pk(le)}if(F0(Q)){const le=Cu(gk);F0(U)||(le.status="fulfilled",le.value=!0),pk(le)}else throw Q}return{mutate:Au,get data(){return z.data=!0,U},get error(){return z.error=!0,Q},get isValidating(){return z.isValidating=!0,Y},get isLoading(){return z.isLoading=!0,ou}}},Hdu=Hf.defineProperty(Pdu,"defaultValue",{value:yV}),ns=Kdu(Vdu);function UM(e,u){if(typeof e=="function")return e(u);e!=null&&(e.current=u)}function Hs(...e){return u=>{let a=!1;const t=e.map(n=>{const r=UM(n,u);return!a&&typeof r=="function"&&(a=!0),r});if(a)return()=>{for(let n=0;n<t.length;n++){const r=t[n];typeof r=="function"?r():UM(e[n],null)}}}}function Xe(...e){return C.useCallback(Hs(...e),e)}function c1(e){const u=Gdu(e),a=C.forwardRef((t,n)=>{const{children:r,...i}=t,o=C.Children.toArray(r),s=o.find(Jdu);if(s){const l=s.props.children,E=o.map(c=>c===s?C.Children.count(l)>1?C.Children.only(null):C.isValidElement(l)?l.props.children:null:c);return d.jsx(u,{...i,ref:n,children:C.isValidElement(l)?C.cloneElement(l,void 0,E):null})}return d.jsx(u,{...i,ref:n,children:r})});return a.displayName=`${e}.Slot`,a}var ol=c1("Slot");function Gdu(e){const u=C.forwardRef((a,t)=>{const{children:n,...r}=a;if(C.isValidElement(n)){const i=Udu(n),o=Wdu(r,n.props);return n.type!==C.Fragment&&(o.ref=t?Hs(t,i):i),C.cloneElement(n,o)}return C.Children.count(n)>1?C.Children.only(null):null});return u.displayName=`${e}.SlotClone`,u}var OV=Symbol("radix.slottable");function wV(e){const u=({children:a})=>d.jsx(d.Fragment,{children:a});return u.displayName=`${e}.Slottable`,u.__radixId=OV,u}function Jdu(e){return C.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===OV}function Wdu(e,u){const a={...u};for(const t in u){const n=e[t],r=u[t];/^on[A-Z]/.test(t)?n&&r?a[t]=(...o)=>{const s=r(...o);return n(...o),s}:n&&(a[t]=n):t==="style"?a[t]={...n,...r}:t==="className"&&(a[t]=[n,r].filter(Boolean).join(" "))}return{...e,...a}}function Udu(e){var t,n;let u=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,a=u&&"isReactWarning"in u&&u.isReactWarning;return a?e.ref:(u=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,a=u&&"isReactWarning"in u&&u.isReactWarning,a?e.props.ref:e.props.ref||e.ref)}function MV(e){var u,a,t="";if(typeof e=="string"||typeof e=="number")t+=e;else if(typeof e=="object")if(Array.isArray(e))for(u=0;u<e.length;u++)e[u]&&(a=MV(e[u]))&&(t&&(t+=" "),t+=a);else for(u in e)e[u]&&(t&&(t+=" "),t+=u);return t}function TV(){for(var e,u,a=0,t="";a<arguments.length;)(e=arguments[a++])&&(u=MV(e))&&(t&&(t+=" "),t+=u);return t}const ZM=e=>typeof e=="boolean"?"".concat(e):e===0?"0":e,QM=TV,P1=(e,u)=>a=>{var t;if((u==null?void 0:u.variants)==null)return QM(e,a==null?void 0:a.class,a==null?void 0:a.className);const{variants:n,defaultVariants:r}=u,i=Object.keys(n).map(l=>{const E=a==null?void 0:a[l],c=r==null?void 0:r[l];if(E===null)return null;const D=ZM(E)||ZM(c);return n[l][D]}),o=a&&Object.entries(a).reduce((l,E)=>{let[c,D]=E;return D===void 0||(l[c]=D),l},{}),s=u==null||(t=u.compoundVariants)===null||t===void 0?void 0:t.reduce((l,E)=>{let{class:c,className:D,...h}=E;return Object.entries(h).every(m=>{let[x,p]=m;return Array.isArray(p)?p.includes({...r,...o}[x]):{...r,...o}[x]===p})?[...l,c,D]:l},[]);return QM(e,i,s,a==null?void 0:a.class,a==null?void 0:a.className)};/**
|
|
78
78
|
* @license lucide-react v0.535.0 - ISC
|
|
79
79
|
*
|
|
80
80
|
* This source code is licensed under the ISC license.
|
|
@@ -469,7 +469,7 @@ Error generating stack: `+r.message+`
|
|
|
469
469
|
If you want to hide the \`${u.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
470
470
|
|
|
471
471
|
For more information, see https://radix-ui.com/primitives/docs/components/${u.docsSlug}`;return C.useEffect(()=>{e&&(document.getElementById(e)||console.error(a))},[a,e]),null},Efu="DialogDescriptionWarning",cfu=({contentRef:e,descriptionId:u})=>{const t=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${_H(Efu).contentName}}.`;return C.useEffect(()=>{var r;const n=(r=e.current)==null?void 0:r.getAttribute("aria-describedby");u&&n&&(document.getElementById(u)||console.warn(t))},[t,e,u]),null},r2=bH,IH=BH,i2=zH,dd=OH,Dd=wH,lm=TH,Em=jH,o2=RH;const dfu=r2,Dfu=i2,KH=C.forwardRef(({className:e,...u},a)=>d.jsx(dd,{className:lu("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",e),...u,ref:a}));KH.displayName=dd.displayName;const hfu=P1("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),$H=C.forwardRef(({side:e="right",className:u,children:a,...t},n)=>d.jsxs(Dfu,{children:[d.jsx(KH,{}),d.jsxs(Dd,{ref:n,className:lu(hfu({side:e}),u),...t,children:[d.jsxs(o2,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none",children:[d.jsx(FE,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Close"})]}),a]})]}));$H.displayName=Dd.displayName;const mfu=C.forwardRef(({className:e,...u},a)=>d.jsx(lm,{ref:a,className:lu("text-foreground text-lg font-semibold",e),...u}));mfu.displayName=lm.displayName;const xfu=C.forwardRef(({className:e,...u},a)=>d.jsx(Em,{ref:a,className:lu("text-muted-foreground text-sm",e),...u}));xfu.displayName=Em.displayName;function kT({className:e,...u}){return d.jsx("div",{className:lu("bg-primary/10 animate-pulse rounded-md",e),...u})}const ffu=["top","right","bottom","left"],h1=Math.min,mr=Math.max,Uf=Math.round,kx=Math.floor,Jo=e=>({x:e,y:e}),pfu={left:"right",right:"left",bottom:"top",top:"bottom"},gfu={start:"end",end:"start"};function J7(e,u,a){return mr(e,h1(u,a))}function Gs(e,u){return typeof e=="function"?e(u):e}function Js(e){return e.split("-")[0]}function hd(e){return e.split("-")[1]}function m8(e){return e==="x"?"y":"x"}function x8(e){return e==="y"?"height":"width"}const Cfu=new Set(["top","bottom"]);function No(e){return Cfu.has(Js(e))?"y":"x"}function f8(e){return m8(No(e))}function Ffu(e,u,a){a===void 0&&(a=!1);const t=hd(e),n=f8(e),r=x8(n);let i=n==="x"?t===(a?"end":"start")?"right":"left":t==="start"?"bottom":"top";return u.reference[r]>u.floating[r]&&(i=Zf(i)),[i,Zf(i)]}function kfu(e){const u=Zf(e);return[W7(e),u,W7(u)]}function W7(e){return e.replace(/start|end/g,u=>gfu[u])}const vT=["left","right"],AT=["right","left"],vfu=["top","bottom"],Afu=["bottom","top"];function bfu(e,u,a){switch(e){case"top":case"bottom":return a?u?AT:vT:u?vT:AT;case"left":case"right":return u?vfu:Afu;default:return[]}}function yfu(e,u,a,t){const n=hd(e);let r=bfu(Js(e),a==="start",t);return n&&(r=r.map(i=>i+"-"+n),u&&(r=r.concat(r.map(W7)))),r}function Zf(e){return e.replace(/left|right|bottom|top/g,u=>pfu[u])}function Bfu(e){return{top:0,right:0,bottom:0,left:0,...e}}function VH(e){return typeof e!="number"?Bfu(e):{top:e,right:e,bottom:e,left:e}}function Qf(e){const{x:u,y:a,width:t,height:n}=e;return{width:t,height:n,top:a,left:u,right:u+t,bottom:a+n,x:u,y:a}}function bT(e,u,a){let{reference:t,floating:n}=e;const r=No(u),i=f8(u),o=x8(i),s=Js(u),l=r==="y",E=t.x+t.width/2-n.width/2,c=t.y+t.height/2-n.height/2,D=t[o]/2-n[o]/2;let h;switch(s){case"top":h={x:E,y:t.y-n.height};break;case"bottom":h={x:E,y:t.y+t.height};break;case"right":h={x:t.x+t.width,y:c};break;case"left":h={x:t.x-n.width,y:c};break;default:h={x:t.x,y:t.y}}switch(hd(u)){case"start":h[i]-=D*(a&&l?-1:1);break;case"end":h[i]+=D*(a&&l?-1:1);break}return h}const Sfu=async(e,u,a)=>{const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:i}=a,o=r.filter(Boolean),s=await(i.isRTL==null?void 0:i.isRTL(u));let l=await i.getElementRects({reference:e,floating:u,strategy:n}),{x:E,y:c}=bT(l,t,s),D=t,h={},m=0;for(let x=0;x<o.length;x++){const{name:p,fn:f}=o[x],{x:g,y:F,data:b,reset:y}=await f({x:E,y:c,initialPlacement:t,placement:D,strategy:n,middlewareData:h,rects:l,platform:i,elements:{reference:e,floating:u}});E=g??E,c=F??c,h={...h,[p]:{...h[p],...b}},y&&m<=50&&(m++,typeof y=="object"&&(y.placement&&(D=y.placement),y.rects&&(l=y.rects===!0?await i.getElementRects({reference:e,floating:u,strategy:n}):y.rects),{x:E,y:c}=bT(l,D,s)),x=-1)}return{x:E,y:c,placement:D,strategy:n,middlewareData:h}};async function WD(e,u){var a;u===void 0&&(u={});const{x:t,y:n,platform:r,rects:i,elements:o,strategy:s}=e,{boundary:l="clippingAncestors",rootBoundary:E="viewport",elementContext:c="floating",altBoundary:D=!1,padding:h=0}=Gs(u,e),m=VH(h),p=o[D?c==="floating"?"reference":"floating":c],f=Qf(await r.getClippingRect({element:(a=await(r.isElement==null?void 0:r.isElement(p)))==null||a?p:p.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(o.floating)),boundary:l,rootBoundary:E,strategy:s})),g=c==="floating"?{x:t,y:n,width:i.floating.width,height:i.floating.height}:i.reference,F=await(r.getOffsetParent==null?void 0:r.getOffsetParent(o.floating)),b=await(r.isElement==null?void 0:r.isElement(F))?await(r.getScale==null?void 0:r.getScale(F))||{x:1,y:1}:{x:1,y:1},y=Qf(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:F,strategy:s}):g);return{top:(f.top-y.top+m.top)/b.y,bottom:(y.bottom-f.bottom+m.bottom)/b.y,left:(f.left-y.left+m.left)/b.x,right:(y.right-f.right+m.right)/b.x}}const zfu=e=>({name:"arrow",options:e,async fn(u){const{x:a,y:t,placement:n,rects:r,platform:i,elements:o,middlewareData:s}=u,{element:l,padding:E=0}=Gs(e,u)||{};if(l==null)return{};const c=VH(E),D={x:a,y:t},h=f8(n),m=x8(h),x=await i.getDimensions(l),p=h==="y",f=p?"top":"left",g=p?"bottom":"right",F=p?"clientHeight":"clientWidth",b=r.reference[m]+r.reference[h]-D[h]-r.floating[m],y=D[h]-r.reference[h],v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l));let A=v?v[F]:0;(!A||!await(i.isElement==null?void 0:i.isElement(v)))&&(A=o.floating[F]||r.floating[m]);const B=b/2-y/2,j=A/2-x[m]/2-1,R=h1(c[f],j),w=h1(c[g],j),O=R,T=A-x[m]-w,z=A/2-x[m]/2+B,N=J7(O,z,T),M=!s.arrow&&hd(n)!=null&&z!==N&&r.reference[m]/2-(z<O?R:w)-x[m]/2<0,I=M?z<O?z-O:z-T:0;return{[h]:D[h]+I,data:{[h]:N,centerOffset:z-N-I,...M&&{alignmentOffset:I}},reset:M}}}),Ofu=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(u){var a,t;const{placement:n,middlewareData:r,rects:i,initialPlacement:o,platform:s,elements:l}=u,{mainAxis:E=!0,crossAxis:c=!0,fallbackPlacements:D,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:x=!0,...p}=Gs(e,u);if((a=r.arrow)!=null&&a.alignmentOffset)return{};const f=Js(n),g=No(o),F=Js(o)===o,b=await(s.isRTL==null?void 0:s.isRTL(l.floating)),y=D||(F||!x?[Zf(o)]:kfu(o)),v=m!=="none";!D&&v&&y.push(...yfu(o,x,m,b));const A=[o,...y],B=await WD(u,p),j=[];let R=((t=r.flip)==null?void 0:t.overflows)||[];if(E&&j.push(B[f]),c){const z=Ffu(n,i,b);j.push(B[z[0]],B[z[1]])}if(R=[...R,{placement:n,overflows:j}],!j.every(z=>z<=0)){var w,O;const z=(((w=r.flip)==null?void 0:w.index)||0)+1,N=A[z];if(N&&(!(c==="alignment"?g!==No(N):!1)||R.every(P=>No(P.placement)===g?P.overflows[0]>0:!0)))return{data:{index:z,overflows:R},reset:{placement:N}};let M=(O=R.filter(I=>I.overflows[0]<=0).sort((I,P)=>I.overflows[1]-P.overflows[1])[0])==null?void 0:O.placement;if(!M)switch(h){case"bestFit":{var T;const I=(T=R.filter(P=>{if(v){const L=No(P.placement);return L===g||L==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(L=>L>0).reduce((L,K)=>L+K,0)]).sort((P,L)=>P[1]-L[1])[0])==null?void 0:T[0];I&&(M=I);break}case"initialPlacement":M=o;break}if(n!==M)return{reset:{placement:M}}}return{}}}};function yT(e,u){return{top:e.top-u.height,right:e.right-u.width,bottom:e.bottom-u.height,left:e.left-u.width}}function BT(e){return ffu.some(u=>e[u]>=0)}const wfu=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(u){const{rects:a}=u,{strategy:t="referenceHidden",...n}=Gs(e,u);switch(t){case"referenceHidden":{const r=await WD(u,{...n,elementContext:"reference"}),i=yT(r,a.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:BT(i)}}}case"escaped":{const r=await WD(u,{...n,altBoundary:!0}),i=yT(r,a.floating);return{data:{escapedOffsets:i,escaped:BT(i)}}}default:return{}}}}},HH=new Set(["left","top"]);async function Mfu(e,u){const{placement:a,platform:t,elements:n}=e,r=await(t.isRTL==null?void 0:t.isRTL(n.floating)),i=Js(a),o=hd(a),s=No(a)==="y",l=HH.has(i)?-1:1,E=r&&s?-1:1,c=Gs(u,e);let{mainAxis:D,crossAxis:h,alignmentAxis:m}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return o&&typeof m=="number"&&(h=o==="end"?m*-1:m),s?{x:h*E,y:D*l}:{x:D*l,y:h*E}}const Tfu=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(u){var a,t;const{x:n,y:r,placement:i,middlewareData:o}=u,s=await Mfu(u,e);return i===((a=o.offset)==null?void 0:a.placement)&&(t=o.arrow)!=null&&t.alignmentOffset?{}:{x:n+s.x,y:r+s.y,data:{...s,placement:i}}}}},Pfu=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(u){const{x:a,y:t,placement:n}=u,{mainAxis:r=!0,crossAxis:i=!1,limiter:o={fn:p=>{let{x:f,y:g}=p;return{x:f,y:g}}},...s}=Gs(e,u),l={x:a,y:t},E=await WD(u,s),c=No(Js(n)),D=m8(c);let h=l[D],m=l[c];if(r){const p=D==="y"?"top":"left",f=D==="y"?"bottom":"right",g=h+E[p],F=h-E[f];h=J7(g,h,F)}if(i){const p=c==="y"?"top":"left",f=c==="y"?"bottom":"right",g=m+E[p],F=m-E[f];m=J7(g,m,F)}const x=o.fn({...u,[D]:h,[c]:m});return{...x,data:{x:x.x-a,y:x.y-t,enabled:{[D]:r,[c]:i}}}}}},jfu=function(e){return e===void 0&&(e={}),{options:e,fn(u){const{x:a,y:t,placement:n,rects:r,middlewareData:i}=u,{offset:o=0,mainAxis:s=!0,crossAxis:l=!0}=Gs(e,u),E={x:a,y:t},c=No(n),D=m8(c);let h=E[D],m=E[c];const x=Gs(o,u),p=typeof x=="number"?{mainAxis:x,crossAxis:0}:{mainAxis:0,crossAxis:0,...x};if(s){const F=D==="y"?"height":"width",b=r.reference[D]-r.floating[F]+p.mainAxis,y=r.reference[D]+r.reference[F]-p.mainAxis;h<b?h=b:h>y&&(h=y)}if(l){var f,g;const F=D==="y"?"width":"height",b=HH.has(Js(n)),y=r.reference[c]-r.floating[F]+(b&&((f=i.offset)==null?void 0:f[c])||0)+(b?0:p.crossAxis),v=r.reference[c]+r.reference[F]+(b?0:((g=i.offset)==null?void 0:g[c])||0)-(b?p.crossAxis:0);m<y?m=y:m>v&&(m=v)}return{[D]:h,[c]:m}}}},Nfu=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(u){var a,t;const{placement:n,rects:r,platform:i,elements:o}=u,{apply:s=()=>{},...l}=Gs(e,u),E=await WD(u,l),c=Js(n),D=hd(n),h=No(n)==="y",{width:m,height:x}=r.floating;let p,f;c==="top"||c==="bottom"?(p=c,f=D===(await(i.isRTL==null?void 0:i.isRTL(o.floating))?"start":"end")?"left":"right"):(f=c,p=D==="end"?"top":"bottom");const g=x-E.top-E.bottom,F=m-E.left-E.right,b=h1(x-E[p],g),y=h1(m-E[f],F),v=!u.middlewareData.shift;let A=b,B=y;if((a=u.middlewareData.shift)!=null&&a.enabled.x&&(B=F),(t=u.middlewareData.shift)!=null&&t.enabled.y&&(A=g),v&&!D){const R=mr(E.left,0),w=mr(E.right,0),O=mr(E.top,0),T=mr(E.bottom,0);h?B=m-2*(R!==0||w!==0?R+w:mr(E.left,E.right)):A=x-2*(O!==0||T!==0?O+T:mr(E.top,E.bottom))}await s({...u,availableWidth:B,availableHeight:A});const j=await i.getDimensions(o.floating);return m!==j.width||x!==j.height?{reset:{rects:!0}}:{}}}};function s2(){return typeof window<"u"}function md(e){return GH(e)?(e.nodeName||"").toLowerCase():"#document"}function Sr(e){var u;return(e==null||(u=e.ownerDocument)==null?void 0:u.defaultView)||window}function rs(e){var u;return(u=(GH(e)?e.ownerDocument:e.document)||window.document)==null?void 0:u.documentElement}function GH(e){return s2()?e instanceof Node||e instanceof Sr(e).Node:!1}function ao(e){return s2()?e instanceof Element||e instanceof Sr(e).Element:!1}function qo(e){return s2()?e instanceof HTMLElement||e instanceof Sr(e).HTMLElement:!1}function ST(e){return!s2()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Sr(e).ShadowRoot}const Rfu=new Set(["inline","contents"]);function cm(e){const{overflow:u,overflowX:a,overflowY:t,display:n}=to(e);return/auto|scroll|overlay|hidden|clip/.test(u+t+a)&&!Rfu.has(n)}const Lfu=new Set(["table","td","th"]);function _fu(e){return Lfu.has(md(e))}const Ifu=[":popover-open",":modal"];function l2(e){return Ifu.some(u=>{try{return e.matches(u)}catch{return!1}})}const Kfu=["transform","translate","scale","rotate","perspective"],$fu=["transform","translate","scale","rotate","perspective","filter"],Vfu=["paint","layout","strict","content"];function p8(e){const u=g8(),a=ao(e)?to(e):e;return Kfu.some(t=>a[t]?a[t]!=="none":!1)||(a.containerType?a.containerType!=="normal":!1)||!u&&(a.backdropFilter?a.backdropFilter!=="none":!1)||!u&&(a.filter?a.filter!=="none":!1)||$fu.some(t=>(a.willChange||"").includes(t))||Vfu.some(t=>(a.contain||"").includes(t))}function Hfu(e){let u=m1(e);for(;qo(u)&&!D3(u);){if(p8(u))return u;if(l2(u))return null;u=m1(u)}return null}function g8(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Gfu=new Set(["html","body","#document"]);function D3(e){return Gfu.has(md(e))}function to(e){return Sr(e).getComputedStyle(e)}function E2(e){return ao(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function m1(e){if(md(e)==="html")return e;const u=e.assignedSlot||e.parentNode||ST(e)&&e.host||rs(e);return ST(u)?u.host:u}function JH(e){const u=m1(e);return D3(u)?e.ownerDocument?e.ownerDocument.body:e.body:qo(u)&&cm(u)?u:JH(u)}function UD(e,u,a){var t;u===void 0&&(u=[]),a===void 0&&(a=!0);const n=JH(e),r=n===((t=e.ownerDocument)==null?void 0:t.body),i=Sr(n);if(r){const o=U7(i);return u.concat(i,i.visualViewport||[],cm(n)?n:[],o&&a?UD(o):[])}return u.concat(n,UD(n,[],a))}function U7(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function WH(e){const u=to(e);let a=parseFloat(u.width)||0,t=parseFloat(u.height)||0;const n=qo(e),r=n?e.offsetWidth:a,i=n?e.offsetHeight:t,o=Uf(a)!==r||Uf(t)!==i;return o&&(a=r,t=i),{width:a,height:t,$:o}}function C8(e){return ao(e)?e:e.contextElement}function Kc(e){const u=C8(e);if(!qo(u))return Jo(1);const a=u.getBoundingClientRect(),{width:t,height:n,$:r}=WH(u);let i=(r?Uf(a.width):a.width)/t,o=(r?Uf(a.height):a.height)/n;return(!i||!Number.isFinite(i))&&(i=1),(!o||!Number.isFinite(o))&&(o=1),{x:i,y:o}}const Jfu=Jo(0);function UH(e){const u=Sr(e);return!g8()||!u.visualViewport?Jfu:{x:u.visualViewport.offsetLeft,y:u.visualViewport.offsetTop}}function Wfu(e,u,a){return u===void 0&&(u=!1),!a||u&&a!==Sr(e)?!1:u}function Z4(e,u,a,t){u===void 0&&(u=!1),a===void 0&&(a=!1);const n=e.getBoundingClientRect(),r=C8(e);let i=Jo(1);u&&(t?ao(t)&&(i=Kc(t)):i=Kc(e));const o=Wfu(r,a,t)?UH(r):Jo(0);let s=(n.left+o.x)/i.x,l=(n.top+o.y)/i.y,E=n.width/i.x,c=n.height/i.y;if(r){const D=Sr(r),h=t&&ao(t)?Sr(t):t;let m=D,x=U7(m);for(;x&&t&&h!==m;){const p=Kc(x),f=x.getBoundingClientRect(),g=to(x),F=f.left+(x.clientLeft+parseFloat(g.paddingLeft))*p.x,b=f.top+(x.clientTop+parseFloat(g.paddingTop))*p.y;s*=p.x,l*=p.y,E*=p.x,c*=p.y,s+=F,l+=b,m=Sr(x),x=U7(m)}}return Qf({width:E,height:c,x:s,y:l})}function c2(e,u){const a=E2(e).scrollLeft;return u?u.left+a:Z4(rs(e)).left+a}function ZH(e,u){const a=e.getBoundingClientRect(),t=a.left+u.scrollLeft-c2(e,a),n=a.top+u.scrollTop;return{x:t,y:n}}function Ufu(e){let{elements:u,rect:a,offsetParent:t,strategy:n}=e;const r=n==="fixed",i=rs(t),o=u?l2(u.floating):!1;if(t===i||o&&r)return a;let s={scrollLeft:0,scrollTop:0},l=Jo(1);const E=Jo(0),c=qo(t);if((c||!c&&!r)&&((md(t)!=="body"||cm(i))&&(s=E2(t)),qo(t))){const h=Z4(t);l=Kc(t),E.x=h.x+t.clientLeft,E.y=h.y+t.clientTop}const D=i&&!c&&!r?ZH(i,s):Jo(0);return{width:a.width*l.x,height:a.height*l.y,x:a.x*l.x-s.scrollLeft*l.x+E.x+D.x,y:a.y*l.y-s.scrollTop*l.y+E.y+D.y}}function Zfu(e){return Array.from(e.getClientRects())}function Qfu(e){const u=rs(e),a=E2(e),t=e.ownerDocument.body,n=mr(u.scrollWidth,u.clientWidth,t.scrollWidth,t.clientWidth),r=mr(u.scrollHeight,u.clientHeight,t.scrollHeight,t.clientHeight);let i=-a.scrollLeft+c2(e);const o=-a.scrollTop;return to(t).direction==="rtl"&&(i+=mr(u.clientWidth,t.clientWidth)-n),{width:n,height:r,x:i,y:o}}const zT=25;function qfu(e,u){const a=Sr(e),t=rs(e),n=a.visualViewport;let r=t.clientWidth,i=t.clientHeight,o=0,s=0;if(n){r=n.width,i=n.height;const E=g8();(!E||E&&u==="fixed")&&(o=n.offsetLeft,s=n.offsetTop)}const l=c2(t);if(l<=0){const E=t.ownerDocument,c=E.body,D=getComputedStyle(c),h=E.compatMode==="CSS1Compat"&&parseFloat(D.marginLeft)+parseFloat(D.marginRight)||0,m=Math.abs(t.clientWidth-c.clientWidth-h);m<=zT&&(r-=m)}else l<=zT&&(r+=l);return{width:r,height:i,x:o,y:s}}const Yfu=new Set(["absolute","fixed"]);function Xfu(e,u){const a=Z4(e,!0,u==="fixed"),t=a.top+e.clientTop,n=a.left+e.clientLeft,r=qo(e)?Kc(e):Jo(1),i=e.clientWidth*r.x,o=e.clientHeight*r.y,s=n*r.x,l=t*r.y;return{width:i,height:o,x:s,y:l}}function OT(e,u,a){let t;if(u==="viewport")t=qfu(e,a);else if(u==="document")t=Qfu(rs(e));else if(ao(u))t=Xfu(u,a);else{const n=UH(e);t={x:u.x-n.x,y:u.y-n.y,width:u.width,height:u.height}}return Qf(t)}function QH(e,u){const a=m1(e);return a===u||!ao(a)||D3(a)?!1:to(a).position==="fixed"||QH(a,u)}function upu(e,u){const a=u.get(e);if(a)return a;let t=UD(e,[],!1).filter(o=>ao(o)&&md(o)!=="body"),n=null;const r=to(e).position==="fixed";let i=r?m1(e):e;for(;ao(i)&&!D3(i);){const o=to(i),s=p8(i);!s&&o.position==="fixed"&&(n=null),(r?!s&&!n:!s&&o.position==="static"&&!!n&&Yfu.has(n.position)||cm(i)&&!s&&QH(e,i))?t=t.filter(E=>E!==i):n=o,i=m1(i)}return u.set(e,t),t}function epu(e){let{element:u,boundary:a,rootBoundary:t,strategy:n}=e;const i=[...a==="clippingAncestors"?l2(u)?[]:upu(u,this._c):[].concat(a),t],o=i[0],s=i.reduce((l,E)=>{const c=OT(u,E,n);return l.top=mr(c.top,l.top),l.right=h1(c.right,l.right),l.bottom=h1(c.bottom,l.bottom),l.left=mr(c.left,l.left),l},OT(u,o,n));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function apu(e){const{width:u,height:a}=WH(e);return{width:u,height:a}}function tpu(e,u,a){const t=qo(u),n=rs(u),r=a==="fixed",i=Z4(e,!0,r,u);let o={scrollLeft:0,scrollTop:0};const s=Jo(0);function l(){s.x=c2(n)}if(t||!t&&!r)if((md(u)!=="body"||cm(n))&&(o=E2(u)),t){const h=Z4(u,!0,r,u);s.x=h.x+u.clientLeft,s.y=h.y+u.clientTop}else n&&l();r&&!t&&n&&l();const E=n&&!t&&!r?ZH(n,o):Jo(0),c=i.left+o.scrollLeft-s.x-E.x,D=i.top+o.scrollTop-s.y-E.y;return{x:c,y:D,width:i.width,height:i.height}}function zk(e){return to(e).position==="static"}function wT(e,u){if(!qo(e)||to(e).position==="fixed")return null;if(u)return u(e);let a=e.offsetParent;return rs(e)===a&&(a=a.ownerDocument.body),a}function qH(e,u){const a=Sr(e);if(l2(e))return a;if(!qo(e)){let n=m1(e);for(;n&&!D3(n);){if(ao(n)&&!zk(n))return n;n=m1(n)}return a}let t=wT(e,u);for(;t&&_fu(t)&&zk(t);)t=wT(t,u);return t&&D3(t)&&zk(t)&&!p8(t)?a:t||Hfu(e)||a}const npu=async function(e){const u=this.getOffsetParent||qH,a=this.getDimensions,t=await a(e.floating);return{reference:tpu(e.reference,await u(e.floating),e.strategy),floating:{x:0,y:0,width:t.width,height:t.height}}};function rpu(e){return to(e).direction==="rtl"}const ipu={convertOffsetParentRelativeRectToViewportRelativeRect:Ufu,getDocumentElement:rs,getClippingRect:epu,getOffsetParent:qH,getElementRects:npu,getClientRects:Zfu,getDimensions:apu,getScale:Kc,isElement:ao,isRTL:rpu};function YH(e,u){return e.x===u.x&&e.y===u.y&&e.width===u.width&&e.height===u.height}function opu(e,u){let a=null,t;const n=rs(e);function r(){var o;clearTimeout(t),(o=a)==null||o.disconnect(),a=null}function i(o,s){o===void 0&&(o=!1),s===void 0&&(s=1),r();const l=e.getBoundingClientRect(),{left:E,top:c,width:D,height:h}=l;if(o||u(),!D||!h)return;const m=kx(c),x=kx(n.clientWidth-(E+D)),p=kx(n.clientHeight-(c+h)),f=kx(E),F={rootMargin:-m+"px "+-x+"px "+-p+"px "+-f+"px",threshold:mr(0,h1(1,s))||1};let b=!0;function y(v){const A=v[0].intersectionRatio;if(A!==s){if(!b)return i();A?i(!1,A):t=setTimeout(()=>{i(!1,1e-7)},1e3)}A===1&&!YH(l,e.getBoundingClientRect())&&i(),b=!1}try{a=new IntersectionObserver(y,{...F,root:n.ownerDocument})}catch{a=new IntersectionObserver(y,F)}a.observe(e)}return i(!0),r}function spu(e,u,a,t){t===void 0&&(t={});const{ancestorScroll:n=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:s=!1}=t,l=C8(e),E=n||r?[...l?UD(l):[],...UD(u)]:[];E.forEach(f=>{n&&f.addEventListener("scroll",a,{passive:!0}),r&&f.addEventListener("resize",a)});const c=l&&o?opu(l,a):null;let D=-1,h=null;i&&(h=new ResizeObserver(f=>{let[g]=f;g&&g.target===l&&h&&(h.unobserve(u),cancelAnimationFrame(D),D=requestAnimationFrame(()=>{var F;(F=h)==null||F.observe(u)})),a()}),l&&!s&&h.observe(l),h.observe(u));let m,x=s?Z4(e):null;s&&p();function p(){const f=Z4(e);x&&!YH(x,f)&&a(),x=f,m=requestAnimationFrame(p)}return a(),()=>{var f;E.forEach(g=>{n&&g.removeEventListener("scroll",a),r&&g.removeEventListener("resize",a)}),c==null||c(),(f=h)==null||f.disconnect(),h=null,s&&cancelAnimationFrame(m)}}const lpu=Tfu,Epu=Pfu,cpu=Ofu,dpu=Nfu,Dpu=wfu,MT=zfu,hpu=jfu,mpu=(e,u,a)=>{const t=new Map,n={platform:ipu,...a},r={...n.platform,_c:t};return Sfu(e,u,{...n,platform:r})};var xpu=typeof document<"u",fpu=function(){},$6=xpu?C.useLayoutEffect:fpu;function qf(e,u){if(e===u)return!0;if(typeof e!=typeof u)return!1;if(typeof e=="function"&&e.toString()===u.toString())return!0;let a,t,n;if(e&&u&&typeof e=="object"){if(Array.isArray(e)){if(a=e.length,a!==u.length)return!1;for(t=a;t--!==0;)if(!qf(e[t],u[t]))return!1;return!0}if(n=Object.keys(e),a=n.length,a!==Object.keys(u).length)return!1;for(t=a;t--!==0;)if(!{}.hasOwnProperty.call(u,n[t]))return!1;for(t=a;t--!==0;){const r=n[t];if(!(r==="_owner"&&e.$$typeof)&&!qf(e[r],u[r]))return!1}return!0}return e!==e&&u!==u}function XH(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function TT(e,u){const a=XH(e);return Math.round(u*a)/a}function Ok(e){const u=C.useRef(e);return $6(()=>{u.current=e}),u}function ppu(e){e===void 0&&(e={});const{placement:u="bottom",strategy:a="absolute",middleware:t=[],platform:n,elements:{reference:r,floating:i}={},transform:o=!0,whileElementsMounted:s,open:l}=e,[E,c]=C.useState({x:0,y:0,strategy:a,placement:u,middlewareData:{},isPositioned:!1}),[D,h]=C.useState(t);qf(D,t)||h(t);const[m,x]=C.useState(null),[p,f]=C.useState(null),g=C.useCallback(P=>{P!==v.current&&(v.current=P,x(P))},[]),F=C.useCallback(P=>{P!==A.current&&(A.current=P,f(P))},[]),b=r||m,y=i||p,v=C.useRef(null),A=C.useRef(null),B=C.useRef(E),j=s!=null,R=Ok(s),w=Ok(n),O=Ok(l),T=C.useCallback(()=>{if(!v.current||!A.current)return;const P={placement:u,strategy:a,middleware:D};w.current&&(P.platform=w.current),mpu(v.current,A.current,P).then(L=>{const K={...L,isPositioned:O.current!==!1};z.current&&!qf(B.current,K)&&(B.current=K,nl.flushSync(()=>{c(K)}))})},[D,u,a,w,O]);$6(()=>{l===!1&&B.current.isPositioned&&(B.current.isPositioned=!1,c(P=>({...P,isPositioned:!1})))},[l]);const z=C.useRef(!1);$6(()=>(z.current=!0,()=>{z.current=!1}),[]),$6(()=>{if(b&&(v.current=b),y&&(A.current=y),b&&y){if(R.current)return R.current(b,y,T);T()}},[b,y,T,R,j]);const N=C.useMemo(()=>({reference:v,floating:A,setReference:g,setFloating:F}),[g,F]),M=C.useMemo(()=>({reference:b,floating:y}),[b,y]),I=C.useMemo(()=>{const P={position:a,left:0,top:0};if(!M.floating)return P;const L=TT(M.floating,E.x),K=TT(M.floating,E.y);return o?{...P,transform:"translate("+L+"px, "+K+"px)",...XH(M.floating)>=1.5&&{willChange:"transform"}}:{position:a,left:L,top:K}},[a,o,M.floating,E.x,E.y]);return C.useMemo(()=>({...E,update:T,refs:N,elements:M,floatingStyles:I}),[E,T,N,M,I])}const gpu=e=>{function u(a){return{}.hasOwnProperty.call(a,"current")}return{name:"arrow",options:e,fn(a){const{element:t,padding:n}=typeof e=="function"?e(a):e;return t&&u(t)?t.current!=null?MT({element:t.current,padding:n}).fn(a):{}:t?MT({element:t,padding:n}).fn(a):{}}}},Cpu=(e,u)=>({...lpu(e),options:[e,u]}),Fpu=(e,u)=>({...Epu(e),options:[e,u]}),kpu=(e,u)=>({...hpu(e),options:[e,u]}),vpu=(e,u)=>({...cpu(e),options:[e,u]}),Apu=(e,u)=>({...dpu(e),options:[e,u]}),bpu=(e,u)=>({...Dpu(e),options:[e,u]}),ypu=(e,u)=>({...gpu(e),options:[e,u]});var Bpu="Arrow",uG=C.forwardRef((e,u)=>{const{children:a,width:t=10,height:n=5,...r}=e;return d.jsx(se.svg,{...r,ref:u,width:t,height:n,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?a:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});uG.displayName=Bpu;var Spu=uG;function d2(e){const[u,a]=C.useState(void 0);return Zt(()=>{if(e){a({width:e.offsetWidth,height:e.offsetHeight});const t=new ResizeObserver(n=>{if(!Array.isArray(n)||!n.length)return;const r=n[0];let i,o;if("borderBoxSize"in r){const s=r.borderBoxSize,l=Array.isArray(s)?s[0]:s;i=l.inlineSize,o=l.blockSize}else i=e.offsetWidth,o=e.offsetHeight;a({width:i,height:o})});return t.observe(e,{box:"border-box"}),()=>t.unobserve(e)}else a(void 0)},[e]),u}var F8="Popper",[eG,j1]=Tt(F8),[zpu,aG]=eG(F8),tG=e=>{const{__scopePopper:u,children:a}=e,[t,n]=C.useState(null);return d.jsx(zpu,{scope:u,anchor:t,onAnchorChange:n,children:a})};tG.displayName=F8;var nG="PopperAnchor",rG=C.forwardRef((e,u)=>{const{__scopePopper:a,virtualRef:t,...n}=e,r=aG(nG,a),i=C.useRef(null),o=Xe(u,i),s=C.useRef(null);return C.useEffect(()=>{const l=s.current;s.current=(t==null?void 0:t.current)||i.current,l!==s.current&&r.onAnchorChange(s.current)}),t?null:d.jsx(se.div,{...n,ref:o})});rG.displayName=nG;var k8="PopperContent",[Opu,wpu]=eG(k8),iG=C.forwardRef((e,u)=>{var tu,Y,ou,Cu,Au,mu;const{__scopePopper:a,side:t="bottom",sideOffset:n=0,align:r="center",alignOffset:i=0,arrowPadding:o=0,avoidCollisions:s=!0,collisionBoundary:l=[],collisionPadding:E=0,sticky:c="partial",hideWhenDetached:D=!1,updatePositionStrategy:h="optimized",onPlaced:m,...x}=e,p=aG(k8,a),[f,g]=C.useState(null),F=Xe(u,Nu=>g(Nu)),[b,y]=C.useState(null),v=d2(b),A=(v==null?void 0:v.width)??0,B=(v==null?void 0:v.height)??0,j=t+(r!=="center"?"-"+r:""),R=typeof E=="number"?E:{top:0,right:0,bottom:0,left:0,...E},w=Array.isArray(l)?l:[l],O=w.length>0,T={padding:R,boundary:w.filter(Tpu),altBoundary:O},{refs:z,floatingStyles:N,placement:M,isPositioned:I,middlewareData:P}=ppu({strategy:"fixed",placement:j,whileElementsMounted:(...Nu)=>spu(...Nu,{animationFrame:h==="always"}),elements:{reference:p.anchor},middleware:[Cpu({mainAxis:n+B,alignmentAxis:i}),s&&Fpu({mainAxis:!0,crossAxis:!1,limiter:c==="partial"?kpu():void 0,...T}),s&&vpu({...T}),Apu({...T,apply:({elements:Nu,rects:le,availableWidth:Yu,availableHeight:ve})=>{const{width:Ie,height:Zu}=le.reference,Gu=Nu.floating.style;Gu.setProperty("--radix-popper-available-width",`${Yu}px`),Gu.setProperty("--radix-popper-available-height",`${ve}px`),Gu.setProperty("--radix-popper-anchor-width",`${Ie}px`),Gu.setProperty("--radix-popper-anchor-height",`${Zu}px`)}}),b&&ypu({element:b,padding:o}),Ppu({arrowWidth:A,arrowHeight:B}),D&&bpu({strategy:"referenceHidden",...T})]}),[L,K]=lG(M),W=eo(m);Zt(()=>{I&&(W==null||W())},[I,W]);const _=(tu=P.arrow)==null?void 0:tu.x,Q=(Y=P.arrow)==null?void 0:Y.y,eu=((ou=P.arrow)==null?void 0:ou.centerOffset)!==0,[U,iu]=C.useState();return Zt(()=>{f&&iu(window.getComputedStyle(f).zIndex)},[f]),d.jsx("div",{ref:z.setFloating,"data-radix-popper-content-wrapper":"",style:{...N,transform:I?N.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:U,"--radix-popper-transform-origin":[(Cu=P.transformOrigin)==null?void 0:Cu.x,(Au=P.transformOrigin)==null?void 0:Au.y].join(" "),...((mu=P.hide)==null?void 0:mu.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(Opu,{scope:a,placedSide:L,onArrowChange:y,arrowX:_,arrowY:Q,shouldHideArrow:eu,children:d.jsx(se.div,{"data-side":L,"data-align":K,...x,ref:F,style:{...x.style,animation:I?void 0:"none"}})})})});iG.displayName=k8;var oG="PopperArrow",Mpu={top:"bottom",right:"left",bottom:"top",left:"right"},sG=C.forwardRef(function(u,a){const{__scopePopper:t,...n}=u,r=wpu(oG,t),i=Mpu[r.placedSide];return d.jsx("span",{ref:r.onArrowChange,style:{position:"absolute",left:r.arrowX,top:r.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[r.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[r.placedSide],visibility:r.shouldHideArrow?"hidden":void 0},children:d.jsx(Spu,{...n,ref:a,style:{...n.style,display:"block"}})})});sG.displayName=oG;function Tpu(e){return e!==null}var Ppu=e=>({name:"transformOrigin",options:e,fn(u){var p,f,g;const{placement:a,rects:t,middlewareData:n}=u,i=((p=n.arrow)==null?void 0:p.centerOffset)!==0,o=i?0:e.arrowWidth,s=i?0:e.arrowHeight,[l,E]=lG(a),c={start:"0%",center:"50%",end:"100%"}[E],D=(((f=n.arrow)==null?void 0:f.x)??0)+o/2,h=(((g=n.arrow)==null?void 0:g.y)??0)+s/2;let m="",x="";return l==="bottom"?(m=i?c:`${D}px`,x=`${-s}px`):l==="top"?(m=i?c:`${D}px`,x=`${t.floating.height+s}px`):l==="right"?(m=`${-s}px`,x=i?c:`${h}px`):l==="left"&&(m=`${t.floating.width+s}px`,x=i?c:`${h}px`),{data:{x:m,y:x}}}});function lG(e){const[u,a="center"]=e.split("-");return[u,a]}var D2=tG,dm=rG,h2=iG,m2=sG,EG=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"}),jpu="VisuallyHidden",v8=C.forwardRef((e,u)=>d.jsx(se.span,{...e,ref:u,style:{...EG,...e.style}}));v8.displayName=jpu;var Npu=v8,[x2,W00]=Tt("Tooltip",[j1]),f2=j1(),cG="TooltipProvider",Rpu=700,Z7="tooltip.open",[Lpu,A8]=x2(cG),dG=e=>{const{__scopeTooltip:u,delayDuration:a=Rpu,skipDelayDuration:t=300,disableHoverableContent:n=!1,children:r}=e,i=C.useRef(!0),o=C.useRef(!1),s=C.useRef(0);return C.useEffect(()=>{const l=s.current;return()=>window.clearTimeout(l)},[]),d.jsx(Lpu,{scope:u,isOpenDelayedRef:i,delayDuration:a,onOpen:C.useCallback(()=>{window.clearTimeout(s.current),i.current=!1},[]),onClose:C.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(()=>i.current=!0,t)},[t]),isPointerInTransitRef:o,onPointerInTransitChange:C.useCallback(l=>{o.current=l},[]),disableHoverableContent:n,children:r})};dG.displayName=cG;var ZD="Tooltip",[_pu,Dm]=x2(ZD),DG=e=>{const{__scopeTooltip:u,children:a,open:t,defaultOpen:n,onOpenChange:r,disableHoverableContent:i,delayDuration:o}=e,s=A8(ZD,e.__scopeTooltip),l=f2(u),[E,c]=C.useState(null),D=kt(),h=C.useRef(0),m=i??s.disableHoverableContent,x=o??s.delayDuration,p=C.useRef(!1),[f,g]=hn({prop:t,defaultProp:n??!1,onChange:A=>{A?(s.onOpen(),document.dispatchEvent(new CustomEvent(Z7))):s.onClose(),r==null||r(A)},caller:ZD}),F=C.useMemo(()=>f?p.current?"delayed-open":"instant-open":"closed",[f]),b=C.useCallback(()=>{window.clearTimeout(h.current),h.current=0,p.current=!1,g(!0)},[g]),y=C.useCallback(()=>{window.clearTimeout(h.current),h.current=0,g(!1)},[g]),v=C.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{p.current=!0,g(!0),h.current=0},x)},[x,g]);return C.useEffect(()=>()=>{h.current&&(window.clearTimeout(h.current),h.current=0)},[]),d.jsx(D2,{...l,children:d.jsx(_pu,{scope:u,contentId:D,open:f,stateAttribute:F,trigger:E,onTriggerChange:c,onTriggerEnter:C.useCallback(()=>{s.isOpenDelayedRef.current?v():b()},[s.isOpenDelayedRef,v,b]),onTriggerLeave:C.useCallback(()=>{m?y():(window.clearTimeout(h.current),h.current=0)},[y,m]),onOpen:b,onClose:y,disableHoverableContent:m,children:a})})};DG.displayName=ZD;var Q7="TooltipTrigger",hG=C.forwardRef((e,u)=>{const{__scopeTooltip:a,...t}=e,n=Dm(Q7,a),r=A8(Q7,a),i=f2(a),o=C.useRef(null),s=Xe(u,o,n.onTriggerChange),l=C.useRef(!1),E=C.useRef(!1),c=C.useCallback(()=>l.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",c),[c]),d.jsx(dm,{asChild:!0,...i,children:d.jsx(se.button,{"aria-describedby":n.open?n.contentId:void 0,"data-state":n.stateAttribute,...t,ref:s,onPointerMove:ju(e.onPointerMove,D=>{D.pointerType!=="touch"&&!E.current&&!r.isPointerInTransitRef.current&&(n.onTriggerEnter(),E.current=!0)}),onPointerLeave:ju(e.onPointerLeave,()=>{n.onTriggerLeave(),E.current=!1}),onPointerDown:ju(e.onPointerDown,()=>{n.open&&n.onClose(),l.current=!0,document.addEventListener("pointerup",c,{once:!0})}),onFocus:ju(e.onFocus,()=>{l.current||n.onOpen()}),onBlur:ju(e.onBlur,n.onClose),onClick:ju(e.onClick,n.onClose)})})});hG.displayName=Q7;var b8="TooltipPortal",[Ipu,Kpu]=x2(b8,{forceMount:void 0}),mG=e=>{const{__scopeTooltip:u,forceMount:a,children:t,container:n}=e,r=Dm(b8,u);return d.jsx(Ipu,{scope:u,forceMount:a,children:d.jsx(fn,{present:a||r.open,children:d.jsx(cd,{asChild:!0,container:n,children:t})})})};mG.displayName=b8;var h3="TooltipContent",xG=C.forwardRef((e,u)=>{const a=Kpu(h3,e.__scopeTooltip),{forceMount:t=a.forceMount,side:n="top",...r}=e,i=Dm(h3,e.__scopeTooltip);return d.jsx(fn,{present:t||i.open,children:i.disableHoverableContent?d.jsx(fG,{side:n,...r,ref:u}):d.jsx($pu,{side:n,...r,ref:u})})}),$pu=C.forwardRef((e,u)=>{const a=Dm(h3,e.__scopeTooltip),t=A8(h3,e.__scopeTooltip),n=C.useRef(null),r=Xe(u,n),[i,o]=C.useState(null),{trigger:s,onClose:l}=a,E=n.current,{onPointerInTransitChange:c}=t,D=C.useCallback(()=>{o(null),c(!1)},[c]),h=C.useCallback((m,x)=>{const p=m.currentTarget,f={x:m.clientX,y:m.clientY},g=Wpu(f,p.getBoundingClientRect()),F=Upu(f,g),b=Zpu(x.getBoundingClientRect()),y=qpu([...F,...b]);o(y),c(!0)},[c]);return C.useEffect(()=>()=>D(),[D]),C.useEffect(()=>{if(s&&E){const m=p=>h(p,E),x=p=>h(p,s);return s.addEventListener("pointerleave",m),E.addEventListener("pointerleave",x),()=>{s.removeEventListener("pointerleave",m),E.removeEventListener("pointerleave",x)}}},[s,E,h,D]),C.useEffect(()=>{if(i){const m=x=>{const p=x.target,f={x:x.clientX,y:x.clientY},g=(s==null?void 0:s.contains(p))||(E==null?void 0:E.contains(p)),F=!Qpu(f,i);g?D():F&&(D(),l())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[s,E,i,l,D]),d.jsx(fG,{...e,ref:r})}),[Vpu,Hpu]=x2(ZD,{isInside:!1}),Gpu=wV("TooltipContent"),fG=C.forwardRef((e,u)=>{const{__scopeTooltip:a,children:t,"aria-label":n,onEscapeKeyDown:r,onPointerDownOutside:i,...o}=e,s=Dm(h3,a),l=f2(a),{onClose:E}=s;return C.useEffect(()=>(document.addEventListener(Z7,E),()=>document.removeEventListener(Z7,E)),[E]),C.useEffect(()=>{if(s.trigger){const c=D=>{const h=D.target;h!=null&&h.contains(s.trigger)&&E()};return window.addEventListener("scroll",c,{capture:!0}),()=>window.removeEventListener("scroll",c,{capture:!0})}},[s.trigger,E]),d.jsx(Ed,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:c=>c.preventDefault(),onDismiss:E,children:d.jsxs(h2,{"data-state":s.stateAttribute,...l,...o,ref:u,style:{...o.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(Gpu,{children:t}),d.jsx(Vpu,{scope:a,isInside:!0,children:d.jsx(Npu,{id:s.contentId,role:"tooltip",children:n||t})})]})})});xG.displayName=h3;var pG="TooltipArrow",Jpu=C.forwardRef((e,u)=>{const{__scopeTooltip:a,...t}=e,n=f2(a);return Hpu(pG,a).isInside?null:d.jsx(m2,{...n,...t,ref:u})});Jpu.displayName=pG;function Wpu(e,u){const a=Math.abs(u.top-e.y),t=Math.abs(u.bottom-e.y),n=Math.abs(u.right-e.x),r=Math.abs(u.left-e.x);switch(Math.min(a,t,n,r)){case r:return"left";case n:return"right";case a:return"top";case t:return"bottom";default:throw new Error("unreachable")}}function Upu(e,u,a=5){const t=[];switch(u){case"top":t.push({x:e.x-a,y:e.y+a},{x:e.x+a,y:e.y+a});break;case"bottom":t.push({x:e.x-a,y:e.y-a},{x:e.x+a,y:e.y-a});break;case"left":t.push({x:e.x+a,y:e.y-a},{x:e.x+a,y:e.y+a});break;case"right":t.push({x:e.x-a,y:e.y-a},{x:e.x-a,y:e.y+a});break}return t}function Zpu(e){const{top:u,right:a,bottom:t,left:n}=e;return[{x:n,y:u},{x:a,y:u},{x:a,y:t},{x:n,y:t}]}function Qpu(e,u){const{x:a,y:t}=e;let n=!1;for(let r=0,i=u.length-1;r<u.length;i=r++){const o=u[r],s=u[i],l=o.x,E=o.y,c=s.x,D=s.y;E>t!=D>t&&a<(c-l)*(t-E)/(D-E)+l&&(n=!n)}return n}function qpu(e){const u=e.slice();return u.sort((a,t)=>a.x<t.x?-1:a.x>t.x?1:a.y<t.y?-1:a.y>t.y?1:0),Ypu(u)}function Ypu(e){if(e.length<=1)return e.slice();const u=[];for(let t=0;t<e.length;t++){const n=e[t];for(;u.length>=2;){const r=u[u.length-1],i=u[u.length-2];if((r.x-i.x)*(n.y-i.y)>=(r.y-i.y)*(n.x-i.x))u.pop();else break}u.push(n)}u.pop();const a=[];for(let t=e.length-1;t>=0;t--){const n=e[t];for(;a.length>=2;){const r=a[a.length-1],i=a[a.length-2];if((r.x-i.x)*(n.y-i.y)>=(r.y-i.y)*(n.x-i.x))a.pop();else break}a.push(n)}return a.pop(),u.length===1&&a.length===1&&u[0].x===a[0].x&&u[0].y===a[0].y?u:u.concat(a)}var Xpu=dG,ugu=DG,egu=hG,agu=mG,gG=xG;const CG=Xpu,o0=ugu,s0=egu,Yl=agu,n0=C.forwardRef(({className:e,sideOffset:u=4,...a},t)=>d.jsx(gG,{ref:t,sideOffset:u,className:lu("bg-primary text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 overflow-hidden rounded-md px-3 py-1.5 text-xs",e),...a}));n0.displayName=gG.displayName;const wk=768;function tgu(){const[e,u]=C.useState(void 0);return C.useEffect(()=>{const a=window.matchMedia(`(max-width: ${wk-1}px)`),t=()=>{u(window.innerWidth<wk)};return a.addEventListener("change",t),u(window.innerWidth<wk),()=>a.removeEventListener("change",t)},[]),!!e}const ngu="sidebar:state",rgu=60*60*24*7,igu="16rem",ogu="18rem",sgu="3rem",lgu="b",FG=C.createContext(null);function p2(){const e=C.useContext(FG);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const kG=C.forwardRef(({defaultOpen:e=!0,open:u,onOpenChange:a,sidebarWidth:t,className:n,style:r,children:i,...o},s)=>{const l=tgu(),[E,c]=C.useState(!1),[D,h]=C.useState(e),m=u??D,x=C.useCallback(F=>{const b=typeof F=="function"?F(m):F;a?a(b):h(b),document.cookie=`${ngu}=${b}; path=/; max-age=${rgu}`},[a,m]),p=C.useCallback(()=>l?c(F=>!F):x(F=>!F),[l,x,c]);C.useEffect(()=>{const F=b=>{b.key===lgu&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),p())};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[p]);const f=m?"expanded":"collapsed",g=C.useMemo(()=>({state:f,open:m,setOpen:x,isMobile:l,openMobile:E,setOpenMobile:c,toggleSidebar:p}),[f,m,x,l,E,c,p]);return d.jsx(FG.Provider,{value:g,children:d.jsx(CG,{delayDuration:0,children:d.jsx("div",{style:{"--sidebar-width":t||igu,"--sidebar-width-icon":sgu,...r},className:lu("group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex min-h-svh w-full",n),ref:s,...o,children:i})})})});kG.displayName="SidebarProvider";const vG=C.forwardRef(({side:e="left",variant:u="sidebar",collapsible:a="offcanvas",className:t,children:n,...r},i)=>{const{isMobile:o,state:s,openMobile:l,setOpenMobile:E}=p2();return a==="none"?d.jsx("div",{className:lu("bg-sidebar text-sidebar-foreground flex h-full w-[--sidebar-width] flex-col",t),ref:i,...r,children:n}):o?d.jsx(dfu,{open:l,onOpenChange:E,...r,children:d.jsx($H,{"data-sidebar":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-[--sidebar-width] p-0 [&>button]:hidden",style:{"--sidebar-width":ogu},side:e,children:d.jsx("div",{className:"flex h-full w-full flex-col",children:n})})}):d.jsxs("div",{ref:i,className:"text-sidebar-foreground group peer hidden md:block","data-state":s,"data-collapsible":s==="collapsed"?a:"","data-variant":u,"data-side":e,children:[d.jsx("div",{className:lu("relative h-svh w-[--sidebar-width] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",u==="floating"||u==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4))]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon]")}),d.jsx("div",{className:lu("fixed inset-y-0 z-10 hidden h-svh w-[--sidebar-width] transition-[left,right,width] duration-200 ease-linear md:flex",e==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",u==="floating"||u==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)_+_theme(spacing.4)_+2px)]":"group-data-[collapsible=icon]:w-[--sidebar-width-icon] group-data-[side=left]:border-r group-data-[side=right]:border-l",t),...r,children:d.jsx("div",{"data-sidebar":"sidebar",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow",children:n})})]})});vG.displayName="Sidebar";const Egu=C.forwardRef(({className:e,onClick:u,...a},t)=>{const{toggleSidebar:n}=p2();return d.jsxs(Ve,{ref:t,"data-sidebar":"trigger",variant:"ghost",size:"icon",className:lu("h-7 w-7",e),onClick:r=>{u==null||u(r),n()},...a,children:[d.jsx(gDu,{}),d.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});Egu.displayName="SidebarTrigger";const cgu=C.forwardRef(({className:e,...u},a)=>{const{toggleSidebar:t}=p2();return d.jsx("button",{ref:a,"data-sidebar":"rail","aria-label":"Toggle Sidebar",tabIndex:-1,onClick:t,title:"Toggle Sidebar",className:lu("hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] group-data-[side=left]:-right-4 group-data-[side=right]:left-0 sm:flex","[[data-side=left]_&]:cursor-w-resize [[data-side=right]_&]:cursor-e-resize","[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize","group-data-[collapsible=offcanvas]:hover:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full","[[data-side=left][data-collapsible=offcanvas]_&]:-right-2","[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",e),...u})});cgu.displayName="SidebarRail";const dgu=C.forwardRef(({className:e,...u},a)=>d.jsx("main",{ref:a,className:lu("bg-background relative flex min-h-svh flex-1 flex-col","peer-data-[variant=inset]:min-h-[calc(100svh-theme(spacing.4))] md:peer-data-[variant=inset]:m-2 md:peer-data-[state=collapsed]:peer-data-[variant=inset]:ml-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow",e),...u}));dgu.displayName="SidebarInset";const Dgu=C.forwardRef(({className:e,...u},a)=>d.jsx(gt,{ref:a,"data-sidebar":"input",className:lu("bg-background focus-visible:ring-sidebar-ring h-8 w-full shadow-none focus-visible:ring-2",e),...u}));Dgu.displayName="SidebarInput";const AG=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,"data-sidebar":"header",className:lu("flex flex-col gap-2 p-2",e),...u}));AG.displayName="SidebarHeader";const hgu=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,"data-sidebar":"footer",className:lu("flex flex-col gap-2 p-2",e),...u}));hgu.displayName="SidebarFooter";const mgu=C.forwardRef(({className:e,...u},a)=>d.jsx(om,{ref:a,"data-sidebar":"separator",className:lu("bg-sidebar-border mx-2 w-auto",e),...u}));mgu.displayName="SidebarSeparator";const bG=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,"data-sidebar":"content",className:lu("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...u}));bG.displayName="SidebarContent";const yG=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,"data-sidebar":"group",className:lu("relative flex w-full min-w-0 flex-col p-2",e),...u}));yG.displayName="SidebarGroup";const BG=C.forwardRef(({className:e,asChild:u=!1,...a},t)=>{const n=u?ol:"div";return d.jsx(n,{ref:t,"data-sidebar":"group-label",className:lu("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-none transition-[margin,opa] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",e),...a})});BG.displayName="SidebarGroupLabel";const xgu=C.forwardRef(({className:e,asChild:u=!1,...a},t)=>{const n=u?ol:"button";return d.jsx(n,{ref:t,"data-sidebar":"group-action",className:lu("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute right-3 top-3.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-none transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),...a})});xgu.displayName="SidebarGroupAction";const fgu=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,"data-sidebar":"group-content",className:lu("w-full text-sm",e),...u}));fgu.displayName="SidebarGroupContent";const y8=C.forwardRef(({className:e,...u},a)=>d.jsx("ul",{ref:a,"data-sidebar":"menu",className:lu("flex w-full min-w-0 flex-col gap-1",e),...u}));y8.displayName="SidebarMenu";const SG=C.forwardRef(({className:e,...u},a)=>d.jsx("li",{ref:a,"data-sidebar":"menu-item",className:lu("group/menu-item relative",e),...u}));SG.displayName="SidebarMenuItem";const pgu=P1("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"default",size:"default"}}),Yf=C.forwardRef(({asChild:e=!1,isActive:u=!1,variant:a="default",size:t="default",tooltip:n,className:r,...i},o)=>{const s=e?ol:"button",{isMobile:l,state:E}=p2(),c=d.jsx(s,{ref:o,"data-sidebar":"menu-button","data-size":t,"data-active":u,className:lu(pgu({variant:a,size:t}),r),...i});return n?(typeof n=="string"&&(n={children:n}),d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:c}),d.jsx(n0,{side:"right",align:"center",hidden:E!=="collapsed"||l,...n})]})):c});Yf.displayName="SidebarMenuButton";const zG=C.forwardRef(({className:e,asChild:u=!1,showOnHover:a=!1,...t},n)=>{const r=u?ol:"button";return d.jsx(r,{ref:n,"data-sidebar":"menu-action",className:lu("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute right-1 top-1.5 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-none transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",a&&"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",e),...t})});zG.displayName="SidebarMenuAction";const ggu=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,"data-sidebar":"menu-badge",className:lu("text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 select-none items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","group-data-[collapsible=icon]:hidden",e),...u}));ggu.displayName="SidebarMenuBadge";const Cgu=C.forwardRef(({className:e,showIcon:u=!1,...a},t)=>{const n=C.useMemo(()=>`${Math.floor(Math.random()*40)+50}%`,[]);return d.jsxs("div",{ref:t,"data-sidebar":"menu-skeleton",className:lu("flex h-8 items-center gap-2 rounded-md px-2",e),...a,children:[u&&d.jsx(kT,{className:"size-4 rounded-md","data-sidebar":"menu-skeleton-icon"}),d.jsx(kT,{className:"h-4 max-w-[--skeleton-width] flex-1","data-sidebar":"menu-skeleton-text",style:{"--skeleton-width":n}})]})});Cgu.displayName="SidebarMenuSkeleton";const OG=C.forwardRef(({className:e,...u},a)=>d.jsx("ul",{ref:a,"data-sidebar":"menu-sub",className:lu("border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5","group-data-[collapsible=icon]:hidden",e),...u}));OG.displayName="SidebarMenuSub";const Fgu=C.forwardRef(({...e},u)=>d.jsx("li",{ref:u,...e}));Fgu.displayName="SidebarMenuSubItem";const kgu=C.forwardRef(({asChild:e=!1,size:u="md",isActive:a,className:t,...n},r)=>{const i=e?ol:"a";return d.jsx(i,{ref:r,"data-sidebar":"menu-sub-button","data-size":u,"data-active":a,className:lu("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",u==="sm"&&"text-xs",u==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",t),...n})});kgu.displayName="SidebarMenuSubButton";var PT=["light","dark"],vgu="(prefers-color-scheme: dark)",Agu=C.createContext(void 0),bgu={setTheme:e=>{},themes:[]},ygu=()=>{var e;return(e=C.useContext(Agu))!=null?e:bgu};C.memo(({forcedTheme:e,storageKey:u,attribute:a,enableSystem:t,enableColorScheme:n,defaultTheme:r,value:i,attrs:o,nonce:s})=>{let l=r==="system",E=a==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${o.map(m=>`'${m}'`).join(",")})`};`:`var d=document.documentElement,n='${a}',s='setAttribute';`,c=n?PT.includes(r)&&r?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${r}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",D=(m,x=!1,p=!0)=>{let f=i?i[m]:m,g=x?m+"|| ''":`'${f}'`,F="";return n&&p&&!x&&PT.includes(m)&&(F+=`d.style.colorScheme = '${m}';`),a==="class"?x||f?F+=`c.add(${g})`:F+="null":f&&(F+=`d[s](n,${g})`),F},h=e?`!function(){${E}${D(e)}}()`:t?`!function(){try{${E}var e=localStorage.getItem('${u}');if('system'===e||(!e&&${l})){var t='${vgu}',m=window.matchMedia(t);if(m.media!==t||m.matches){${D("dark")}}else{${D("light")}}}else if(e){${i?`var x=${JSON.stringify(i)};`:""}${D(i?"x[e]":"e",!0)}}${l?"":"else{"+D(r,!1,!1)+"}"}${c}}catch(e){}}()`:`!function(){try{${E}var e=localStorage.getItem('${u}');if(e){${i?`var x=${JSON.stringify(i)};`:""}${D(i?"x[e]":"e",!0)}}else{${D(r,!1,!1)};}${c}}catch(t){}}();`;return C.createElement("script",{nonce:s,dangerouslySetInnerHTML:{__html:h}})});function Bgu(e,{insertAt:u}={}){if(!e||typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],t=document.createElement("style");t.type="text/css",u==="top"&&a.firstChild?a.insertBefore(t,a.firstChild):a.appendChild(t),t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}Bgu(`html[dir=ltr],[data-sonner-toaster][dir=ltr]{--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}html[dir=rtl],[data-sonner-toaster][dir=rtl]{--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999}[data-sonner-toaster][data-x-position=right]{right:max(var(--offset),env(safe-area-inset-right))}[data-sonner-toaster][data-x-position=left]{left:max(var(--offset),env(safe-area-inset-left))}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translate(-50%)}[data-sonner-toaster][data-y-position=top]{top:max(var(--offset),env(safe-area-inset-top))}[data-sonner-toaster][data-y-position=bottom]{bottom:max(var(--offset),env(safe-area-inset-bottom))}[data-sonner-toast]{--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;will-change:transform,opacity,height;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}[data-sonner-toast][data-y-position=top]{top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}[data-sonner-toast] [data-description]{font-weight:400;line-height:1.4;color:inherit}[data-sonner-toast] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast] [data-icon]>*{flex-shrink:0}[data-sonner-toast] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast] [data-button]:focus-visible{box-shadow:0 0 0 2px #0006}[data-sonner-toast] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toast][data-theme=dark] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;background:var(--gray1);color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;opacity:0;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]:focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}[data-sonner-toast] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast]:hover [data-close-button]{opacity:1}[data-sonner-toast]:focus [data-close-button]{opacity:1}[data-sonner-toast]:focus-within [data-close-button]{opacity:1}[data-sonner-toast]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]:before{content:"";position:absolute;left:0;right:0;height:100%}[data-sonner-toast][data-y-position=top][data-swiping=true]:before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]:before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]:before{content:"";position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast]:after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y: translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y: translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]:before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount, 0px));transition:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation:swipe-out .2s ease-out forwards}@keyframes swipe-out{0%{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount)));opacity:1}to{transform:translateY(calc(var(--lift) * var(--offset) + var(--swipe-amount) + var(--lift) * -100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;--mobile-offset: 16px;right:var(--mobile-offset);left:var(--mobile-offset);width:100%}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - 32px)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset)}[data-sonner-toaster][data-y-position=bottom]{bottom:20px}[data-sonner-toaster][data-y-position=top]{top:20px}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset);right:var(--mobile-offset);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-rich-colors=true] [data-sonner-toast][data-type=success],[data-rich-colors=true] [data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true] [data-sonner-toast][data-type=info],[data-rich-colors=true] [data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true] [data-sonner-toast][data-type=warning],[data-rich-colors=true] [data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true] [data-sonner-toast][data-type=error],[data-rich-colors=true] [data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
472
|
-
`);var Sgu=e=>{switch(e){case"success":return wgu;case"info":return Tgu;case"warning":return Mgu;case"error":return Pgu;default:return null}},zgu=Array(12).fill(0),Ogu=({visible:e})=>nu.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},nu.createElement("div",{className:"sonner-spinner"},zgu.map((u,a)=>nu.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),wgu=nu.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},nu.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Mgu=nu.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},nu.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Tgu=nu.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},nu.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Pgu=nu.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},nu.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),q7=1,jgu=class{constructor(){this.subscribe=u=>(this.subscribers.push(u),()=>{let a=this.subscribers.indexOf(u);this.subscribers.splice(a,1)}),this.publish=u=>{this.subscribers.forEach(a=>a(u))},this.addToast=u=>{this.publish(u),this.toasts=[...this.toasts,u]},this.create=u=>{var a;let{message:t,...n}=u,r=typeof(u==null?void 0:u.id)=="number"||((a=u.id)==null?void 0:a.length)>0?u.id:q7++,i=this.toasts.find(s=>s.id===r),o=u.dismissible===void 0?!0:u.dismissible;return i?this.toasts=this.toasts.map(s=>s.id===r?(this.publish({...s,...u,id:r,title:t}),{...s,...u,id:r,dismissible:o,title:t}):s):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=u=>(u||this.toasts.forEach(a=>{this.subscribers.forEach(t=>t({id:a.id,dismiss:!0}))}),this.subscribers.forEach(a=>a({id:u,dismiss:!0})),u),this.message=(u,a)=>this.create({...a,message:u}),this.error=(u,a)=>this.create({...a,message:u,type:"error"}),this.success=(u,a)=>this.create({...a,type:"success",message:u}),this.info=(u,a)=>this.create({...a,type:"info",message:u}),this.warning=(u,a)=>this.create({...a,type:"warning",message:u}),this.loading=(u,a)=>this.create({...a,type:"loading",message:u}),this.promise=(u,a)=>{if(!a)return;let t;a.loading!==void 0&&(t=this.create({...a,promise:u,type:"loading",message:a.loading}));let n=u instanceof Promise?u:u(),r=t!==void 0;return n.then(i=>{if(i&&typeof i.ok=="boolean"&&!i.ok){r=!1;let o=typeof a.error=="function"?a.error(`HTTP error! status: ${i.status}`):a.error;this.create({id:t,type:"error",message:o})}else if(a.success!==void 0){r=!1;let o=typeof a.success=="function"?a.success(i):a.success;this.create({id:t,type:"success",message:o})}}).catch(i=>{if(a.error!==void 0){r=!1;let o=typeof a.error=="function"?a.error(i):a.error;this.create({id:t,type:"error",message:o})}}).finally(()=>{var i;r&&(this.dismiss(t),t=void 0),(i=a.finally)==null||i.call(a)}),t},this.custom=(u,a)=>{let t=(a==null?void 0:a.id)||q7++;return this.create({jsx:u(t),id:t,...a}),t},this.subscribers=[],this.toasts=[]}},wi=new jgu,Ngu=(e,u)=>{let a=(u==null?void 0:u.id)||q7++;return wi.addToast({title:e,...u,id:a}),a},Rgu=Ngu,Ca=Object.assign(Rgu,{success:wi.success,info:wi.info,warning:wi.warning,error:wi.error,custom:wi.custom,message:wi.message,promise:wi.promise,dismiss:wi.dismiss,loading:wi.loading}),Lgu=3,_gu="32px",Igu=4e3,Kgu=356,wG=14,$gu=20,Vgu=200;function X1(...e){return e.filter(Boolean).join(" ")}var Hgu=e=>{var u,a,t,n,r,i,o;let{invert:s,toast:l,unstyled:E,interacting:c,setHeights:D,visibleToasts:h,heights:m,index:x,toasts:p,expanded:f,removeToast:g,closeButton:F,style:b,cancelButtonStyle:y,actionButtonStyle:v,className:A="",descriptionClassName:B="",duration:j,position:R,gap:w=wG,loadingIcon:O,expandByDefault:T,classNames:z,closeButtonAriaLabel:N="Close toast"}=e,[M,I]=nu.useState(!1),[P,L]=nu.useState(!1),[K,W]=nu.useState(!1),[_,Q]=nu.useState(!1),[eu,U]=nu.useState(0),[iu,tu]=nu.useState(0),Y=nu.useRef(null),ou=nu.useRef(null),Cu=x===0,Au=x+1<=h,mu=l.type,Nu=l.dismissible!==!1,le=l.className||"",Yu=l.descriptionClassName||"",ve=nu.useMemo(()=>m.findIndex(yu=>yu.toastId===l.id)||0,[m,l.id]),Ie=nu.useMemo(()=>l.duration||j||Igu,[l.duration,j]),Zu=nu.useRef(0),Gu=nu.useRef(0);nu.useRef(Ie);let fe=nu.useRef(0),V=nu.useRef(null),[au,du]=R.split("-"),bu=nu.useMemo(()=>m.reduce((yu,Ke,t0)=>t0>=ve?yu:yu+Ke.height,0),[m,ve]),pu=l.invert||s,xu=mu==="loading";Gu.current=nu.useMemo(()=>ve*w+bu,[ve,bu]),nu.useEffect(()=>{I(!0)},[]),nu.useLayoutEffect(()=>{if(!M)return;let yu=ou.current,Ke=yu.style.height;yu.style.height="auto";let t0=yu.getBoundingClientRect().height;yu.style.height=Ke,tu(t0),D(N0=>N0.find(ja=>ja.toastId===l.id)?N0.map(ja=>ja.toastId===l.id?{...ja,height:t0}:ja):[{toastId:l.id,height:t0},...N0])},[M,l.title,l.description,D,l.id]);let Lu=nu.useCallback(()=>{L(!0),U(Gu.current),D(yu=>yu.filter(Ke=>Ke.toastId!==l.id)),setTimeout(()=>{g(l)},Vgu)},[l,g,D,Gu]);nu.useEffect(()=>{if(l.promise&&mu==="loading"||l.duration===1/0)return;let yu,Ke=Ie;return f||c?(()=>{if(fe.current<Zu.current){let t0=new Date().getTime()-Zu.current;Ke=Ke-t0}fe.current=new Date().getTime()})():(Zu.current=new Date().getTime(),yu=setTimeout(()=>{var t0;(t0=l.onAutoClose)==null||t0.call(l,l),Lu()},Ke)),()=>clearTimeout(yu)},[f,c,T,l,Ie,Lu,l.promise,mu]),nu.useEffect(()=>{let yu=ou.current;if(yu){let Ke=yu.getBoundingClientRect().height;return tu(Ke),D(t0=>[{toastId:l.id,height:Ke},...t0]),()=>D(t0=>t0.filter(N0=>N0.toastId!==l.id))}},[D,l.id]),nu.useEffect(()=>{l.delete&&Lu()},[Lu,l.delete]);function He(){var yu;return O?nu.createElement("div",{className:X1("loader",z==null?void 0:z.toast,(yu=l==null?void 0:l.classNames)==null?void 0:yu.toast),"data-visible":mu==="loading"},O):nu.createElement(Ogu,{visible:mu==="loading"})}return nu.createElement("li",{"aria-live":l.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:ou,className:X1(A,le,z==null?void 0:z.toast,(u=l==null?void 0:l.classNames)==null?void 0:u.toast,z==null?void 0:z[mu],(a=l==null?void 0:l.classNames)==null?void 0:a[mu]),"data-sonner-toast":"","data-styled":!(l.jsx||l.unstyled||E),"data-mounted":M,"data-promise":!!l.promise,"data-removed":P,"data-visible":Au,"data-y-position":au,"data-x-position":du,"data-index":x,"data-front":Cu,"data-swiping":K,"data-dismissible":Nu,"data-type":mu,"data-invert":pu,"data-swipe-out":_,"data-expanded":!!(f||T&&M),style:{"--index":x,"--toasts-before":x,"--z-index":p.length-x,"--offset":`${P?eu:Gu.current}px`,"--initial-height":T?"auto":`${iu}px`,...b,...l.style},onPointerDown:yu=>{xu||!Nu||(Y.current=new Date,U(Gu.current),yu.target.setPointerCapture(yu.pointerId),yu.target.tagName!=="BUTTON"&&(W(!0),V.current={x:yu.clientX,y:yu.clientY}))},onPointerUp:()=>{var yu,Ke,t0,N0;if(_||!Nu)return;V.current=null;let ja=Number(((yu=ou.current)==null?void 0:yu.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Xt=new Date().getTime()-((Ke=Y.current)==null?void 0:Ke.getTime()),$r=Math.abs(ja)/Xt;if(Math.abs(ja)>=$gu||$r>.11){U(Gu.current),(t0=l.onDismiss)==null||t0.call(l,l),Lu(),Q(!0);return}(N0=ou.current)==null||N0.style.setProperty("--swipe-amount","0px"),W(!1)},onPointerMove:yu=>{var Ke;if(!V.current||!Nu)return;let t0=yu.clientY-V.current.y,N0=yu.clientX-V.current.x,ja=(au==="top"?Math.min:Math.max)(0,t0),Xt=yu.pointerType==="touch"?10:2;Math.abs(ja)>Xt?(Ke=ou.current)==null||Ke.style.setProperty("--swipe-amount",`${t0}px`):Math.abs(N0)>Xt&&(V.current=null)}},F&&!l.jsx?nu.createElement("button",{"aria-label":N,"data-disabled":xu,"data-close-button":!0,onClick:xu||!Nu?()=>{}:()=>{var yu;Lu(),(yu=l.onDismiss)==null||yu.call(l,l)},className:X1(z==null?void 0:z.closeButton,(t=l==null?void 0:l.classNames)==null?void 0:t.closeButton)},nu.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},nu.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),nu.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,l.jsx||nu.isValidElement(l.title)?l.jsx||l.title:nu.createElement(nu.Fragment,null,mu||l.icon||l.promise?nu.createElement("div",{"data-icon":""},(l.promise||l.type==="loading")&&!l.icon?He():null,l.icon||Sgu(mu)):null,nu.createElement("div",{"data-content":""},nu.createElement("div",{"data-title":"",className:X1(z==null?void 0:z.title,(n=l==null?void 0:l.classNames)==null?void 0:n.title)},l.title),l.description?nu.createElement("div",{"data-description":"",className:X1(B,Yu,z==null?void 0:z.description,(r=l==null?void 0:l.classNames)==null?void 0:r.description)},l.description):null),l.cancel?nu.createElement("button",{"data-button":!0,"data-cancel":!0,style:l.cancelButtonStyle||y,onClick:()=>{var yu;Nu&&(Lu(),(yu=l.cancel)!=null&&yu.onClick&&l.cancel.onClick())},className:X1(z==null?void 0:z.cancelButton,(i=l==null?void 0:l.classNames)==null?void 0:i.cancelButton)},l.cancel.label):null,l.action?nu.createElement("button",{"data-button":"",style:l.actionButtonStyle||v,onClick:yu=>{var Ke;(Ke=l.action)==null||Ke.onClick(yu),!yu.defaultPrevented&&Lu()},className:X1(z==null?void 0:z.actionButton,(o=l==null?void 0:l.classNames)==null?void 0:o.actionButton)},l.action.label):null))};function jT(){if(typeof window>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var Ggu=e=>{let{invert:u,position:a="bottom-right",hotkey:t=["altKey","KeyT"],expand:n,closeButton:r,className:i,offset:o,theme:s="light",richColors:l,duration:E,style:c,visibleToasts:D=Lgu,toastOptions:h,dir:m=jT(),gap:x,loadingIcon:p,containerAriaLabel:f="Notifications"}=e,[g,F]=nu.useState([]),b=nu.useMemo(()=>Array.from(new Set([a].concat(g.filter(P=>P.position).map(P=>P.position)))),[g,a]),[y,v]=nu.useState([]),[A,B]=nu.useState(!1),[j,R]=nu.useState(!1),[w,O]=nu.useState(s!=="system"?s:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),T=nu.useRef(null),z=t.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=nu.useRef(null),M=nu.useRef(!1),I=nu.useCallback(P=>F(L=>L.filter(({id:K})=>K!==P.id)),[]);return nu.useEffect(()=>wi.subscribe(P=>{if(P.dismiss){F(L=>L.map(K=>K.id===P.id?{...K,delete:!0}:K));return}setTimeout(()=>{QB.flushSync(()=>{F(L=>{let K=L.findIndex(W=>W.id===P.id);return K!==-1?[...L.slice(0,K),{...L[K],...P},...L.slice(K+1)]:[P,...L]})})})}),[]),nu.useEffect(()=>{if(s!=="system"){O(s);return}s==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?O("dark"):O("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:P})=>{O(P?"dark":"light")})},[s]),nu.useEffect(()=>{g.length<=1&&B(!1)},[g]),nu.useEffect(()=>{let P=L=>{var K,W;t.every(_=>L[_]||L.code===_)&&(B(!0),(K=T.current)==null||K.focus()),L.code==="Escape"&&(document.activeElement===T.current||(W=T.current)!=null&&W.contains(document.activeElement))&&B(!1)};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[t]),nu.useEffect(()=>{if(T.current)return()=>{N.current&&(N.current.focus({preventScroll:!0}),N.current=null,M.current=!1)}},[T.current]),g.length?nu.createElement("section",{"aria-label":`${f} ${z}`,tabIndex:-1},b.map((P,L)=>{var K;let[W,_]=P.split("-");return nu.createElement("ol",{key:P,dir:m==="auto"?jT():m,tabIndex:-1,ref:T,className:i,"data-sonner-toaster":!0,"data-theme":w,"data-rich-colors":l,"data-y-position":W,"data-x-position":_,style:{"--front-toast-height":`${(K=y[0])==null?void 0:K.height}px`,"--offset":typeof o=="number"?`${o}px`:o||_gu,"--width":`${Kgu}px`,"--gap":`${wG}px`,...c},onBlur:Q=>{M.current&&!Q.currentTarget.contains(Q.relatedTarget)&&(M.current=!1,N.current&&(N.current.focus({preventScroll:!0}),N.current=null))},onFocus:Q=>{Q.target instanceof HTMLElement&&Q.target.dataset.dismissible==="false"||M.current||(M.current=!0,N.current=Q.relatedTarget)},onMouseEnter:()=>B(!0),onMouseMove:()=>B(!0),onMouseLeave:()=>{j||B(!1)},onPointerDown:Q=>{Q.target instanceof HTMLElement&&Q.target.dataset.dismissible==="false"||R(!0)},onPointerUp:()=>R(!1)},g.filter(Q=>!Q.position&&L===0||Q.position===P).map((Q,eu)=>{var U;return nu.createElement(Hgu,{key:Q.id,index:eu,toast:Q,duration:(U=h==null?void 0:h.duration)!=null?U:E,className:h==null?void 0:h.className,descriptionClassName:h==null?void 0:h.descriptionClassName,invert:u,visibleToasts:D,closeButton:r,interacting:j,position:P,style:h==null?void 0:h.style,unstyled:h==null?void 0:h.unstyled,classNames:h==null?void 0:h.classNames,cancelButtonStyle:h==null?void 0:h.cancelButtonStyle,actionButtonStyle:h==null?void 0:h.actionButtonStyle,removeToast:I,toasts:g,heights:y,setHeights:v,expandByDefault:n,gap:x,loadingIcon:p,expanded:A})}))})):null};const Jgu=({...e})=>{const{theme:u}=ygu();return d.jsx(Ggu,{theme:u,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})},Wgu=e=>d.jsxs("div",{className:"flex h-screen w-full flex-col items-center justify-center gap-2 text-center",children:[d.jsx("h2",{className:"text-xl font-semibold",children:"An unexpected error happened!"}),d.jsxs("div",{className:"text-destructive max-w-lg",children:["Error: ",e.error.message]}),d.jsxs("div",{className:"text-muted-foreground max-w-lg",children:["We apologize for the inconvenience. We have been notified of this problem. If the issue persists please contact"," ",d.jsx("a",{href:"mailto:support@momentic.ai",className:"text-primary underline",children:"support@momentic.ai"}),"."]}),d.jsx(Ve,{variant:"outline",onClick:e.onTryAgain,children:"Try again"})]}),NT=e=>d.jsxs("div",{className:"flex h-[250px] flex-col items-center justify-center gap-2 text-center",children:[d.jsx("h2",{className:"text-xl font-semibold",children:"Something went wrong!"}),d.jsxs("div",{className:"text-destructive max-w-lg",children:["Error: ",e.error.message]}),d.jsxs("div",{className:"text-muted-foreground max-w-lg",children:["We apologize for the inconvenience. We have been notified of this problem. If the issue persists please contact"," ",d.jsx("a",{href:"mailto:support@momentic.ai",className:"text-primary underline",children:"support@momentic.ai"}),"."]})]}),Ugu=()=>{const e=mV(),u=CE();return d.jsx(Wgu,{error:e,onTryAgain:()=>{u(0)}})};/**
|
|
472
|
+
`);var Sgu=e=>{switch(e){case"success":return wgu;case"info":return Tgu;case"warning":return Mgu;case"error":return Pgu;default:return null}},zgu=Array(12).fill(0),Ogu=({visible:e})=>nu.createElement("div",{className:"sonner-loading-wrapper","data-visible":e},nu.createElement("div",{className:"sonner-spinner"},zgu.map((u,a)=>nu.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${a}`})))),wgu=nu.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},nu.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Mgu=nu.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},nu.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Tgu=nu.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},nu.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Pgu=nu.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},nu.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),q7=1,jgu=class{constructor(){this.subscribe=u=>(this.subscribers.push(u),()=>{let a=this.subscribers.indexOf(u);this.subscribers.splice(a,1)}),this.publish=u=>{this.subscribers.forEach(a=>a(u))},this.addToast=u=>{this.publish(u),this.toasts=[...this.toasts,u]},this.create=u=>{var a;let{message:t,...n}=u,r=typeof(u==null?void 0:u.id)=="number"||((a=u.id)==null?void 0:a.length)>0?u.id:q7++,i=this.toasts.find(s=>s.id===r),o=u.dismissible===void 0?!0:u.dismissible;return i?this.toasts=this.toasts.map(s=>s.id===r?(this.publish({...s,...u,id:r,title:t}),{...s,...u,id:r,dismissible:o,title:t}):s):this.addToast({title:t,...n,dismissible:o,id:r}),r},this.dismiss=u=>(u||this.toasts.forEach(a=>{this.subscribers.forEach(t=>t({id:a.id,dismiss:!0}))}),this.subscribers.forEach(a=>a({id:u,dismiss:!0})),u),this.message=(u,a)=>this.create({...a,message:u}),this.error=(u,a)=>this.create({...a,message:u,type:"error"}),this.success=(u,a)=>this.create({...a,type:"success",message:u}),this.info=(u,a)=>this.create({...a,type:"info",message:u}),this.warning=(u,a)=>this.create({...a,type:"warning",message:u}),this.loading=(u,a)=>this.create({...a,type:"loading",message:u}),this.promise=(u,a)=>{if(!a)return;let t;a.loading!==void 0&&(t=this.create({...a,promise:u,type:"loading",message:a.loading}));let n=u instanceof Promise?u:u(),r=t!==void 0;return n.then(i=>{if(i&&typeof i.ok=="boolean"&&!i.ok){r=!1;let o=typeof a.error=="function"?a.error(`HTTP error! status: ${i.status}`):a.error;this.create({id:t,type:"error",message:o})}else if(a.success!==void 0){r=!1;let o=typeof a.success=="function"?a.success(i):a.success;this.create({id:t,type:"success",message:o})}}).catch(i=>{if(a.error!==void 0){r=!1;let o=typeof a.error=="function"?a.error(i):a.error;this.create({id:t,type:"error",message:o})}}).finally(()=>{var i;r&&(this.dismiss(t),t=void 0),(i=a.finally)==null||i.call(a)}),t},this.custom=(u,a)=>{let t=(a==null?void 0:a.id)||q7++;return this.create({jsx:u(t),id:t,...a}),t},this.subscribers=[],this.toasts=[]}},wi=new jgu,Ngu=(e,u)=>{let a=(u==null?void 0:u.id)||q7++;return wi.addToast({title:e,...u,id:a}),a},Rgu=Ngu,Ca=Object.assign(Rgu,{success:wi.success,info:wi.info,warning:wi.warning,error:wi.error,custom:wi.custom,message:wi.message,promise:wi.promise,dismiss:wi.dismiss,loading:wi.loading}),Lgu=3,_gu="32px",Igu=4e3,Kgu=356,wG=14,$gu=20,Vgu=200;function X1(...e){return e.filter(Boolean).join(" ")}var Hgu=e=>{var u,a,t,n,r,i,o;let{invert:s,toast:l,unstyled:E,interacting:c,setHeights:D,visibleToasts:h,heights:m,index:x,toasts:p,expanded:f,removeToast:g,closeButton:F,style:b,cancelButtonStyle:y,actionButtonStyle:v,className:A="",descriptionClassName:B="",duration:j,position:R,gap:w=wG,loadingIcon:O,expandByDefault:T,classNames:z,closeButtonAriaLabel:N="Close toast"}=e,[M,I]=nu.useState(!1),[P,L]=nu.useState(!1),[K,W]=nu.useState(!1),[_,Q]=nu.useState(!1),[eu,U]=nu.useState(0),[iu,tu]=nu.useState(0),Y=nu.useRef(null),ou=nu.useRef(null),Cu=x===0,Au=x+1<=h,mu=l.type,Nu=l.dismissible!==!1,le=l.className||"",Yu=l.descriptionClassName||"",ve=nu.useMemo(()=>m.findIndex(yu=>yu.toastId===l.id)||0,[m,l.id]),Ie=nu.useMemo(()=>l.duration||j||Igu,[l.duration,j]),Zu=nu.useRef(0),Gu=nu.useRef(0);nu.useRef(Ie);let fe=nu.useRef(0),V=nu.useRef(null),[au,du]=R.split("-"),bu=nu.useMemo(()=>m.reduce((yu,Ke,t0)=>t0>=ve?yu:yu+Ke.height,0),[m,ve]),pu=l.invert||s,xu=mu==="loading";Gu.current=nu.useMemo(()=>ve*w+bu,[ve,bu]),nu.useEffect(()=>{I(!0)},[]),nu.useLayoutEffect(()=>{if(!M)return;let yu=ou.current,Ke=yu.style.height;yu.style.height="auto";let t0=yu.getBoundingClientRect().height;yu.style.height=Ke,tu(t0),D(N0=>N0.find(ja=>ja.toastId===l.id)?N0.map(ja=>ja.toastId===l.id?{...ja,height:t0}:ja):[{toastId:l.id,height:t0},...N0])},[M,l.title,l.description,D,l.id]);let Ru=nu.useCallback(()=>{L(!0),U(Gu.current),D(yu=>yu.filter(Ke=>Ke.toastId!==l.id)),setTimeout(()=>{g(l)},Vgu)},[l,g,D,Gu]);nu.useEffect(()=>{if(l.promise&&mu==="loading"||l.duration===1/0)return;let yu,Ke=Ie;return f||c?(()=>{if(fe.current<Zu.current){let t0=new Date().getTime()-Zu.current;Ke=Ke-t0}fe.current=new Date().getTime()})():(Zu.current=new Date().getTime(),yu=setTimeout(()=>{var t0;(t0=l.onAutoClose)==null||t0.call(l,l),Ru()},Ke)),()=>clearTimeout(yu)},[f,c,T,l,Ie,Ru,l.promise,mu]),nu.useEffect(()=>{let yu=ou.current;if(yu){let Ke=yu.getBoundingClientRect().height;return tu(Ke),D(t0=>[{toastId:l.id,height:Ke},...t0]),()=>D(t0=>t0.filter(N0=>N0.toastId!==l.id))}},[D,l.id]),nu.useEffect(()=>{l.delete&&Ru()},[Ru,l.delete]);function He(){var yu;return O?nu.createElement("div",{className:X1("loader",z==null?void 0:z.toast,(yu=l==null?void 0:l.classNames)==null?void 0:yu.toast),"data-visible":mu==="loading"},O):nu.createElement(Ogu,{visible:mu==="loading"})}return nu.createElement("li",{"aria-live":l.important?"assertive":"polite","aria-atomic":"true",role:"status",tabIndex:0,ref:ou,className:X1(A,le,z==null?void 0:z.toast,(u=l==null?void 0:l.classNames)==null?void 0:u.toast,z==null?void 0:z[mu],(a=l==null?void 0:l.classNames)==null?void 0:a[mu]),"data-sonner-toast":"","data-styled":!(l.jsx||l.unstyled||E),"data-mounted":M,"data-promise":!!l.promise,"data-removed":P,"data-visible":Au,"data-y-position":au,"data-x-position":du,"data-index":x,"data-front":Cu,"data-swiping":K,"data-dismissible":Nu,"data-type":mu,"data-invert":pu,"data-swipe-out":_,"data-expanded":!!(f||T&&M),style:{"--index":x,"--toasts-before":x,"--z-index":p.length-x,"--offset":`${P?eu:Gu.current}px`,"--initial-height":T?"auto":`${iu}px`,...b,...l.style},onPointerDown:yu=>{xu||!Nu||(Y.current=new Date,U(Gu.current),yu.target.setPointerCapture(yu.pointerId),yu.target.tagName!=="BUTTON"&&(W(!0),V.current={x:yu.clientX,y:yu.clientY}))},onPointerUp:()=>{var yu,Ke,t0,N0;if(_||!Nu)return;V.current=null;let ja=Number(((yu=ou.current)==null?void 0:yu.style.getPropertyValue("--swipe-amount").replace("px",""))||0),Xt=new Date().getTime()-((Ke=Y.current)==null?void 0:Ke.getTime()),$r=Math.abs(ja)/Xt;if(Math.abs(ja)>=$gu||$r>.11){U(Gu.current),(t0=l.onDismiss)==null||t0.call(l,l),Ru(),Q(!0);return}(N0=ou.current)==null||N0.style.setProperty("--swipe-amount","0px"),W(!1)},onPointerMove:yu=>{var Ke;if(!V.current||!Nu)return;let t0=yu.clientY-V.current.y,N0=yu.clientX-V.current.x,ja=(au==="top"?Math.min:Math.max)(0,t0),Xt=yu.pointerType==="touch"?10:2;Math.abs(ja)>Xt?(Ke=ou.current)==null||Ke.style.setProperty("--swipe-amount",`${t0}px`):Math.abs(N0)>Xt&&(V.current=null)}},F&&!l.jsx?nu.createElement("button",{"aria-label":N,"data-disabled":xu,"data-close-button":!0,onClick:xu||!Nu?()=>{}:()=>{var yu;Ru(),(yu=l.onDismiss)==null||yu.call(l,l)},className:X1(z==null?void 0:z.closeButton,(t=l==null?void 0:l.classNames)==null?void 0:t.closeButton)},nu.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},nu.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),nu.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))):null,l.jsx||nu.isValidElement(l.title)?l.jsx||l.title:nu.createElement(nu.Fragment,null,mu||l.icon||l.promise?nu.createElement("div",{"data-icon":""},(l.promise||l.type==="loading")&&!l.icon?He():null,l.icon||Sgu(mu)):null,nu.createElement("div",{"data-content":""},nu.createElement("div",{"data-title":"",className:X1(z==null?void 0:z.title,(n=l==null?void 0:l.classNames)==null?void 0:n.title)},l.title),l.description?nu.createElement("div",{"data-description":"",className:X1(B,Yu,z==null?void 0:z.description,(r=l==null?void 0:l.classNames)==null?void 0:r.description)},l.description):null),l.cancel?nu.createElement("button",{"data-button":!0,"data-cancel":!0,style:l.cancelButtonStyle||y,onClick:()=>{var yu;Nu&&(Ru(),(yu=l.cancel)!=null&&yu.onClick&&l.cancel.onClick())},className:X1(z==null?void 0:z.cancelButton,(i=l==null?void 0:l.classNames)==null?void 0:i.cancelButton)},l.cancel.label):null,l.action?nu.createElement("button",{"data-button":"",style:l.actionButtonStyle||v,onClick:yu=>{var Ke;(Ke=l.action)==null||Ke.onClick(yu),!yu.defaultPrevented&&Ru()},className:X1(z==null?void 0:z.actionButton,(o=l==null?void 0:l.classNames)==null?void 0:o.actionButton)},l.action.label):null))};function jT(){if(typeof window>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}var Ggu=e=>{let{invert:u,position:a="bottom-right",hotkey:t=["altKey","KeyT"],expand:n,closeButton:r,className:i,offset:o,theme:s="light",richColors:l,duration:E,style:c,visibleToasts:D=Lgu,toastOptions:h,dir:m=jT(),gap:x,loadingIcon:p,containerAriaLabel:f="Notifications"}=e,[g,F]=nu.useState([]),b=nu.useMemo(()=>Array.from(new Set([a].concat(g.filter(P=>P.position).map(P=>P.position)))),[g,a]),[y,v]=nu.useState([]),[A,B]=nu.useState(!1),[j,R]=nu.useState(!1),[w,O]=nu.useState(s!=="system"?s:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),T=nu.useRef(null),z=t.join("+").replace(/Key/g,"").replace(/Digit/g,""),N=nu.useRef(null),M=nu.useRef(!1),I=nu.useCallback(P=>F(L=>L.filter(({id:K})=>K!==P.id)),[]);return nu.useEffect(()=>wi.subscribe(P=>{if(P.dismiss){F(L=>L.map(K=>K.id===P.id?{...K,delete:!0}:K));return}setTimeout(()=>{QB.flushSync(()=>{F(L=>{let K=L.findIndex(W=>W.id===P.id);return K!==-1?[...L.slice(0,K),{...L[K],...P},...L.slice(K+1)]:[P,...L]})})})}),[]),nu.useEffect(()=>{if(s!=="system"){O(s);return}s==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?O("dark"):O("light")),typeof window<"u"&&window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",({matches:P})=>{O(P?"dark":"light")})},[s]),nu.useEffect(()=>{g.length<=1&&B(!1)},[g]),nu.useEffect(()=>{let P=L=>{var K,W;t.every(_=>L[_]||L.code===_)&&(B(!0),(K=T.current)==null||K.focus()),L.code==="Escape"&&(document.activeElement===T.current||(W=T.current)!=null&&W.contains(document.activeElement))&&B(!1)};return document.addEventListener("keydown",P),()=>document.removeEventListener("keydown",P)},[t]),nu.useEffect(()=>{if(T.current)return()=>{N.current&&(N.current.focus({preventScroll:!0}),N.current=null,M.current=!1)}},[T.current]),g.length?nu.createElement("section",{"aria-label":`${f} ${z}`,tabIndex:-1},b.map((P,L)=>{var K;let[W,_]=P.split("-");return nu.createElement("ol",{key:P,dir:m==="auto"?jT():m,tabIndex:-1,ref:T,className:i,"data-sonner-toaster":!0,"data-theme":w,"data-rich-colors":l,"data-y-position":W,"data-x-position":_,style:{"--front-toast-height":`${(K=y[0])==null?void 0:K.height}px`,"--offset":typeof o=="number"?`${o}px`:o||_gu,"--width":`${Kgu}px`,"--gap":`${wG}px`,...c},onBlur:Q=>{M.current&&!Q.currentTarget.contains(Q.relatedTarget)&&(M.current=!1,N.current&&(N.current.focus({preventScroll:!0}),N.current=null))},onFocus:Q=>{Q.target instanceof HTMLElement&&Q.target.dataset.dismissible==="false"||M.current||(M.current=!0,N.current=Q.relatedTarget)},onMouseEnter:()=>B(!0),onMouseMove:()=>B(!0),onMouseLeave:()=>{j||B(!1)},onPointerDown:Q=>{Q.target instanceof HTMLElement&&Q.target.dataset.dismissible==="false"||R(!0)},onPointerUp:()=>R(!1)},g.filter(Q=>!Q.position&&L===0||Q.position===P).map((Q,eu)=>{var U;return nu.createElement(Hgu,{key:Q.id,index:eu,toast:Q,duration:(U=h==null?void 0:h.duration)!=null?U:E,className:h==null?void 0:h.className,descriptionClassName:h==null?void 0:h.descriptionClassName,invert:u,visibleToasts:D,closeButton:r,interacting:j,position:P,style:h==null?void 0:h.style,unstyled:h==null?void 0:h.unstyled,classNames:h==null?void 0:h.classNames,cancelButtonStyle:h==null?void 0:h.cancelButtonStyle,actionButtonStyle:h==null?void 0:h.actionButtonStyle,removeToast:I,toasts:g,heights:y,setHeights:v,expandByDefault:n,gap:x,loadingIcon:p,expanded:A})}))})):null};const Jgu=({...e})=>{const{theme:u}=ygu();return d.jsx(Ggu,{theme:u,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...e})},Wgu=e=>d.jsxs("div",{className:"flex h-screen w-full flex-col items-center justify-center gap-2 text-center",children:[d.jsx("h2",{className:"text-xl font-semibold",children:"An unexpected error happened!"}),d.jsxs("div",{className:"text-destructive max-w-lg",children:["Error: ",e.error.message]}),d.jsxs("div",{className:"text-muted-foreground max-w-lg",children:["We apologize for the inconvenience. We have been notified of this problem. If the issue persists please contact"," ",d.jsx("a",{href:"mailto:support@momentic.ai",className:"text-primary underline",children:"support@momentic.ai"}),"."]}),d.jsx(Ve,{variant:"outline",onClick:e.onTryAgain,children:"Try again"})]}),NT=e=>d.jsxs("div",{className:"flex h-[250px] flex-col items-center justify-center gap-2 text-center",children:[d.jsx("h2",{className:"text-xl font-semibold",children:"Something went wrong!"}),d.jsxs("div",{className:"text-destructive max-w-lg",children:["Error: ",e.error.message]}),d.jsxs("div",{className:"text-muted-foreground max-w-lg",children:["We apologize for the inconvenience. We have been notified of this problem. If the issue persists please contact"," ",d.jsx("a",{href:"mailto:support@momentic.ai",className:"text-primary underline",children:"support@momentic.ai"}),"."]})]}),Ugu=()=>{const e=mV(),u=CE();return d.jsx(Wgu,{error:e,onTryAgain:()=>{u(0)}})};/**
|
|
473
473
|
* table-core
|
|
474
474
|
*
|
|
475
475
|
* Copyright (c) TanStack
|
|
@@ -490,7 +490,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${u.do
|
|
|
490
490
|
* LICENSE.md file in the root directory of this source tree.
|
|
491
491
|
*
|
|
492
492
|
* @license MIT
|
|
493
|
-
*/function Xf(e,u){return e?N2u(e)?C.createElement(e,u):e:null}function N2u(e){return R2u(e)||typeof e=="function"||L2u(e)}function R2u(e){return typeof e=="function"&&(()=>{const u=Object.getPrototypeOf(e);return u.prototype&&u.prototype.isReactComponent})()}function L2u(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function T8(e){const u={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[a]=C.useState(()=>({current:T2u(u)})),[t,n]=C.useState(()=>a.current.initialState);return a.current.setOptions(r=>({...r,...e,state:{...t,...e.state},onStateChange:i=>{n(i),e.onStateChange==null||e.onStateChange(i)}})),a.current}const hm=C.forwardRef(({...e},u)=>d.jsx("nav",{ref:u,"aria-label":"breadcrumb",...e}));hm.displayName="Breadcrumb";const mm=C.forwardRef(({className:e,...u},a)=>d.jsx("ol",{ref:a,className:lu("text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5",e),...u}));mm.displayName="BreadcrumbList";const Ro=C.forwardRef(({className:e,...u},a)=>d.jsx("li",{ref:a,className:lu("inline-flex items-center gap-1.5",e),...u}));Ro.displayName="BreadcrumbItem";const QD=C.forwardRef(({asChild:e,className:u,...a},t)=>{const n=e?ol:"a";return d.jsx(n,{ref:t,className:lu("hover:text-foreground transition-colors",u),...a})});QD.displayName="BreadcrumbLink";const m3=C.forwardRef(({className:e,...u},a)=>d.jsx("span",{ref:a,role:"link","aria-disabled":"true","aria-current":"page",className:lu("text-foreground font-normal",e),...u}));m3.displayName="BreadcrumbPage";const qD=({children:e,className:u,...a})=>d.jsx("li",{role:"presentation","aria-hidden":"true",className:lu("[&>svg]:size-3.5",u),...a,children:e??d.jsx(rm,{})});qD.displayName="BreadcrumbSeparator";function _2u(e){return Emu(e,{addSuffix:!0})}const up=e=>{const{formatFn:u=_2u,disableTooltip:a=!1}=e,[t,n]=C.useState(null);return C.useEffect(()=>{n(e.date)},[e.date]),t?a?d.jsx("span",{className:lu("decoration-primary/20 whitespace-nowrap",e.className),children:u(t)}):d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx("span",{className:lu("decoration-primary/20 whitespace-nowrap underline decoration-dashed underline-offset-4",e.className),children:u(t)})}),d.jsx(n0,{children:Ixu(t)})]}):d.jsx("span",{children:V7})},GG=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{className:"relative w-full overflow-auto",children:d.jsx("div",{ref:a,className:lu("table w-full caption-bottom border-collapse text-sm",e),...u})}));GG.displayName="Table";const P8=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("table-header-group [&>div]:border-b",e),...u}));P8.displayName="TableHeader";const j8=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("table-row-group [&>:last-child]:border-0",e),...u}));j8.displayName="TableBody";const I2u=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("bg-muted/50 table-footer-group border-t font-medium [&>div]:last:border-b-0",e),...u}));I2u.displayName="TableFooter";const Xl=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("hover:bg-muted/50 data-[state=selected]:bg-muted table-row border-b transition-colors",e),...u}));Xl.displayName="TableRow";const tb=C.forwardRef(({className:e,asChild:u,...a},t)=>{const n=u?ol:"a";return d.jsx(n,{ref:t,className:lu("hover:bg-muted/50 data-[state=selected]:bg-muted table-row border-b transition-colors",e),...a})});tb.displayName="TableRowLink";const N8=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("text-muted-foreground table-cell h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...u}));N8.displayName="TableHead";const YD=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("table-cell p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...u}));YD.displayName="TableCell";const K2u=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("text-muted-foreground mt-4 table-caption text-sm",e),...u}));K2u.displayName="TableCaption";function _T(e,[u,a]){return Math.min(a,Math.max(u,e))}function R8(e){const u=e+"CollectionProvider",[a,t]=Tt(u),[n,r]=a(u,{collectionRef:{current:null},itemMap:new Map}),i=x=>{const{scope:p,children:f}=x,g=nu.useRef(null),F=nu.useRef(new Map).current;return d.jsx(n,{scope:p,itemMap:F,collectionRef:g,children:f})};i.displayName=u;const o=e+"CollectionSlot",s=c1(o),l=nu.forwardRef((x,p)=>{const{scope:f,children:g}=x,F=r(o,f),b=Xe(p,F.collectionRef);return d.jsx(s,{ref:b,children:g})});l.displayName=o;const E=e+"CollectionItemSlot",c="data-radix-collection-item",D=c1(E),h=nu.forwardRef((x,p)=>{const{scope:f,children:g,...F}=x,b=nu.useRef(null),y=Xe(p,b),v=r(E,f);return nu.useEffect(()=>(v.itemMap.set(b,{ref:b,...F}),()=>void v.itemMap.delete(b))),d.jsx(D,{[c]:"",ref:y,children:g})});h.displayName=E;function m(x){const p=r(e+"CollectionConsumer",x);return nu.useCallback(()=>{const g=p.collectionRef.current;if(!g)return[];const F=Array.from(g.querySelectorAll(`[${c}]`));return Array.from(p.itemMap.values()).sort((v,A)=>F.indexOf(v.ref.current)-F.indexOf(A.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:i,Slot:l,ItemSlot:h},m,t]}var $2u=C.createContext(void 0);function xd(e){const u=C.useContext($2u);return e||u||"ltr"}function C2(e){const u=C.useRef({value:e,previous:e});return C.useMemo(()=>(u.current.value!==e&&(u.current.previous=u.current.value,u.current.value=e),u.current.previous),[e])}var V2u=[" ","Enter","ArrowUp","ArrowDown"],H2u=[" ","Enter"],Q4="Select",[F2,k2,G2u]=R8(Q4),[fd,Z00]=Tt(Q4,[G2u,j1]),v2=j1(),[J2u,N1]=fd(Q4),[W2u,U2u]=fd(Q4),JG=e=>{const{__scopeSelect:u,children:a,open:t,defaultOpen:n,onOpenChange:r,value:i,defaultValue:o,onValueChange:s,dir:l,name:E,autoComplete:c,disabled:D,required:h,form:m}=e,x=v2(u),[p,f]=C.useState(null),[g,F]=C.useState(null),[b,y]=C.useState(!1),v=xd(l),[A,B]=hn({prop:t,defaultProp:n??!1,onChange:r,caller:Q4}),[j,R]=hn({prop:i,defaultProp:o,onChange:s,caller:Q4}),w=C.useRef(null),O=p?m||!!p.closest("form"):!0,[T,z]=C.useState(new Set),N=Array.from(T).map(M=>M.props.value).join(";");return d.jsx(D2,{...x,children:d.jsxs(J2u,{required:h,scope:u,trigger:p,onTriggerChange:f,valueNode:g,onValueNodeChange:F,valueNodeHasChildren:b,onValueNodeHasChildrenChange:y,contentId:kt(),value:j,onValueChange:R,open:A,onOpenChange:B,dir:v,triggerPointerDownPosRef:w,disabled:D,children:[d.jsx(F2.Provider,{scope:u,children:d.jsx(W2u,{scope:e.__scopeSelect,onNativeOptionAdd:C.useCallback(M=>{z(I=>new Set(I).add(M))},[]),onNativeOptionRemove:C.useCallback(M=>{z(I=>{const P=new Set(I);return P.delete(M),P})},[]),children:a})}),O?d.jsxs(xJ,{"aria-hidden":!0,required:h,tabIndex:-1,name:E,autoComplete:c,value:j,onChange:M=>R(M.target.value),disabled:D,form:m,children:[j===void 0?d.jsx("option",{value:""}):null,Array.from(T)]},N):null]})})};JG.displayName=Q4;var WG="SelectTrigger",UG=C.forwardRef((e,u)=>{const{__scopeSelect:a,disabled:t=!1,...n}=e,r=v2(a),i=N1(WG,a),o=i.disabled||t,s=Xe(u,i.onTriggerChange),l=k2(a),E=C.useRef("touch"),[c,D,h]=pJ(x=>{const p=l().filter(F=>!F.disabled),f=p.find(F=>F.value===i.value),g=gJ(p,x,f);g!==void 0&&i.onValueChange(g.value)}),m=x=>{o||(i.onOpenChange(!0),h()),x&&(i.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return d.jsx(dm,{asChild:!0,...r,children:d.jsx(se.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":fJ(i.value)?"":void 0,...n,ref:s,onClick:ju(n.onClick,x=>{x.currentTarget.focus(),E.current!=="mouse"&&m(x)}),onPointerDown:ju(n.onPointerDown,x=>{E.current=x.pointerType;const p=x.target;p.hasPointerCapture(x.pointerId)&&p.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(m(x),x.preventDefault())}),onKeyDown:ju(n.onKeyDown,x=>{const p=c.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&D(x.key),!(p&&x.key===" ")&&V2u.includes(x.key)&&(m(),x.preventDefault())})})})});UG.displayName=WG;var ZG="SelectValue",QG=C.forwardRef((e,u)=>{const{__scopeSelect:a,className:t,style:n,children:r,placeholder:i="",...o}=e,s=N1(ZG,a),{onValueNodeHasChildrenChange:l}=s,E=r!==void 0,c=Xe(u,s.onValueNodeChange);return Zt(()=>{l(E)},[l,E]),d.jsx(se.span,{...o,ref:c,style:{pointerEvents:"none"},children:fJ(s.value)?d.jsx(d.Fragment,{children:i}):r})});QG.displayName=ZG;var Z2u="SelectIcon",qG=C.forwardRef((e,u)=>{const{__scopeSelect:a,children:t,...n}=e;return d.jsx(se.span,{"aria-hidden":!0,...n,ref:u,children:t||"▼"})});qG.displayName=Z2u;var Q2u="SelectPortal",YG=e=>d.jsx(cd,{asChild:!0,...e});YG.displayName=Q2u;var q4="SelectContent",XG=C.forwardRef((e,u)=>{const a=N1(q4,e.__scopeSelect),[t,n]=C.useState();if(Zt(()=>{n(new DocumentFragment)},[]),!a.open){const r=t;return r?nl.createPortal(d.jsx(uJ,{scope:e.__scopeSelect,children:d.jsx(F2.Slot,{scope:e.__scopeSelect,children:d.jsx("div",{children:e.children})})}),r):null}return d.jsx(eJ,{...e,ref:u})});XG.displayName=q4;var Mi=10,[uJ,R1]=fd(q4),q2u="SelectContentImpl",Y2u=c1("SelectContent.RemoveScroll"),eJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,position:t="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:r,onPointerDownOutside:i,side:o,sideOffset:s,align:l,alignOffset:E,arrowPadding:c,collisionBoundary:D,collisionPadding:h,sticky:m,hideWhenDetached:x,avoidCollisions:p,...f}=e,g=N1(q4,a),[F,b]=C.useState(null),[y,v]=C.useState(null),A=Xe(u,tu=>b(tu)),[B,j]=C.useState(null),[R,w]=C.useState(null),O=k2(a),[T,z]=C.useState(!1),N=C.useRef(!1);C.useEffect(()=>{if(F)return t2(F)},[F]),u2();const M=C.useCallback(tu=>{const[Y,...ou]=O().map(mu=>mu.ref.current),[Cu]=ou.slice(-1),Au=document.activeElement;for(const mu of tu)if(mu===Au||(mu==null||mu.scrollIntoView({block:"nearest"}),mu===Y&&y&&(y.scrollTop=0),mu===Cu&&y&&(y.scrollTop=y.scrollHeight),mu==null||mu.focus(),document.activeElement!==Au))return},[O,y]),I=C.useCallback(()=>M([B,F]),[M,B,F]);C.useEffect(()=>{T&&I()},[T,I]);const{onOpenChange:P,triggerPointerDownPosRef:L}=g;C.useEffect(()=>{if(F){let tu={x:0,y:0};const Y=Cu=>{var Au,mu;tu={x:Math.abs(Math.round(Cu.pageX)-(((Au=L.current)==null?void 0:Au.x)??0)),y:Math.abs(Math.round(Cu.pageY)-(((mu=L.current)==null?void 0:mu.y)??0))}},ou=Cu=>{tu.x<=10&&tu.y<=10?Cu.preventDefault():F.contains(Cu.target)||P(!1),document.removeEventListener("pointermove",Y),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",Y),document.addEventListener("pointerup",ou,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Y),document.removeEventListener("pointerup",ou,{capture:!0})}}},[F,P,L]),C.useEffect(()=>{const tu=()=>P(!1);return window.addEventListener("blur",tu),window.addEventListener("resize",tu),()=>{window.removeEventListener("blur",tu),window.removeEventListener("resize",tu)}},[P]);const[K,W]=pJ(tu=>{const Y=O().filter(Au=>!Au.disabled),ou=Y.find(Au=>Au.ref.current===document.activeElement),Cu=gJ(Y,tu,ou);Cu&&setTimeout(()=>Cu.ref.current.focus())}),_=C.useCallback((tu,Y,ou)=>{const Cu=!N.current&&!ou;(g.value!==void 0&&g.value===Y||Cu)&&(j(tu),Cu&&(N.current=!0))},[g.value]),Q=C.useCallback(()=>F==null?void 0:F.focus(),[F]),eu=C.useCallback((tu,Y,ou)=>{const Cu=!N.current&&!ou;(g.value!==void 0&&g.value===Y||Cu)&&w(tu)},[g.value]),U=t==="popper"?nb:aJ,iu=U===nb?{side:o,sideOffset:s,align:l,alignOffset:E,arrowPadding:c,collisionBoundary:D,collisionPadding:h,sticky:m,hideWhenDetached:x,avoidCollisions:p}:{};return d.jsx(uJ,{scope:a,content:F,viewport:y,onViewportChange:v,itemRefCallback:_,selectedItem:B,onItemLeave:Q,itemTextRefCallback:eu,focusSelectedItem:I,selectedItemText:R,position:t,isPositioned:T,searchRef:K,children:d.jsx(a2,{as:Y2u,allowPinchZoom:!0,children:d.jsx(sm,{asChild:!0,trapped:g.open,onMountAutoFocus:tu=>{tu.preventDefault()},onUnmountAutoFocus:ju(n,tu=>{var Y;(Y=g.trigger)==null||Y.focus({preventScroll:!0}),tu.preventDefault()}),children:d.jsx(Ed,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:tu=>tu.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:d.jsx(U,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:tu=>tu.preventDefault(),...f,...iu,onPlaced:()=>z(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...f.style},onKeyDown:ju(f.onKeyDown,tu=>{const Y=tu.ctrlKey||tu.altKey||tu.metaKey;if(tu.key==="Tab"&&tu.preventDefault(),!Y&&tu.key.length===1&&W(tu.key),["ArrowUp","ArrowDown","Home","End"].includes(tu.key)){let Cu=O().filter(Au=>!Au.disabled).map(Au=>Au.ref.current);if(["ArrowUp","End"].includes(tu.key)&&(Cu=Cu.slice().reverse()),["ArrowUp","ArrowDown"].includes(tu.key)){const Au=tu.target,mu=Cu.indexOf(Au);Cu=Cu.slice(mu+1)}setTimeout(()=>M(Cu)),tu.preventDefault()}})})})})})})});eJ.displayName=q2u;var X2u="SelectItemAlignedPosition",aJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,onPlaced:t,...n}=e,r=N1(q4,a),i=R1(q4,a),[o,s]=C.useState(null),[l,E]=C.useState(null),c=Xe(u,A=>E(A)),D=k2(a),h=C.useRef(!1),m=C.useRef(!0),{viewport:x,selectedItem:p,selectedItemText:f,focusSelectedItem:g}=i,F=C.useCallback(()=>{if(r.trigger&&r.valueNode&&o&&l&&x&&p&&f){const A=r.trigger.getBoundingClientRect(),B=l.getBoundingClientRect(),j=r.valueNode.getBoundingClientRect(),R=f.getBoundingClientRect();if(r.dir!=="rtl"){const Au=R.left-B.left,mu=j.left-Au,Nu=A.left-mu,le=A.width+Nu,Yu=Math.max(le,B.width),ve=window.innerWidth-Mi,Ie=_T(mu,[Mi,Math.max(Mi,ve-Yu)]);o.style.minWidth=le+"px",o.style.left=Ie+"px"}else{const Au=B.right-R.right,mu=window.innerWidth-j.right-Au,Nu=window.innerWidth-A.right-mu,le=A.width+Nu,Yu=Math.max(le,B.width),ve=window.innerWidth-Mi,Ie=_T(mu,[Mi,Math.max(Mi,ve-Yu)]);o.style.minWidth=le+"px",o.style.right=Ie+"px"}const w=D(),O=window.innerHeight-Mi*2,T=x.scrollHeight,z=window.getComputedStyle(l),N=parseInt(z.borderTopWidth,10),M=parseInt(z.paddingTop,10),I=parseInt(z.borderBottomWidth,10),P=parseInt(z.paddingBottom,10),L=N+M+T+P+I,K=Math.min(p.offsetHeight*5,L),W=window.getComputedStyle(x),_=parseInt(W.paddingTop,10),Q=parseInt(W.paddingBottom,10),eu=A.top+A.height/2-Mi,U=O-eu,iu=p.offsetHeight/2,tu=p.offsetTop+iu,Y=N+M+tu,ou=L-Y;if(Y<=eu){const Au=w.length>0&&p===w[w.length-1].ref.current;o.style.bottom="0px";const mu=l.clientHeight-x.offsetTop-x.offsetHeight,Nu=Math.max(U,iu+(Au?Q:0)+mu+I),le=Y+Nu;o.style.height=le+"px"}else{const Au=w.length>0&&p===w[0].ref.current;o.style.top="0px";const Nu=Math.max(eu,N+x.offsetTop+(Au?_:0)+iu)+ou;o.style.height=Nu+"px",x.scrollTop=Y-eu+x.offsetTop}o.style.margin=`${Mi}px 0`,o.style.minHeight=K+"px",o.style.maxHeight=O+"px",t==null||t(),requestAnimationFrame(()=>h.current=!0)}},[D,r.trigger,r.valueNode,o,l,x,p,f,r.dir,t]);Zt(()=>F(),[F]);const[b,y]=C.useState();Zt(()=>{l&&y(window.getComputedStyle(l).zIndex)},[l]);const v=C.useCallback(A=>{A&&m.current===!0&&(F(),g==null||g(),m.current=!1)},[F,g]);return d.jsx(eCu,{scope:a,contentWrapper:o,shouldExpandOnScrollRef:h,onScrollButtonChange:v,children:d.jsx("div",{ref:s,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:d.jsx(se.div,{...n,ref:c,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});aJ.displayName=X2u;var uCu="SelectPopperPosition",nb=C.forwardRef((e,u)=>{const{__scopeSelect:a,align:t="start",collisionPadding:n=Mi,...r}=e,i=v2(a);return d.jsx(h2,{...i,...r,ref:u,align:t,collisionPadding:n,style:{boxSizing:"border-box",...r.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)"}})});nb.displayName=uCu;var[eCu,L8]=fd(q4,{}),rb="SelectViewport",tJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,nonce:t,...n}=e,r=R1(rb,a),i=L8(rb,a),o=Xe(u,r.onViewportChange),s=C.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),d.jsx(F2.Slot,{scope:a,children:d.jsx(se.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:ju(n.onScroll,l=>{const E=l.currentTarget,{contentWrapper:c,shouldExpandOnScrollRef:D}=i;if(D!=null&&D.current&&c){const h=Math.abs(s.current-E.scrollTop);if(h>0){const m=window.innerHeight-Mi*2,x=parseFloat(c.style.minHeight),p=parseFloat(c.style.height),f=Math.max(x,p);if(f<m){const g=f+h,F=Math.min(m,g),b=g-F;c.style.height=F+"px",c.style.bottom==="0px"&&(E.scrollTop=b>0?b:0,c.style.justifyContent="flex-end")}}}s.current=E.scrollTop})})})]})});tJ.displayName=rb;var nJ="SelectGroup",[aCu,tCu]=fd(nJ),nCu=C.forwardRef((e,u)=>{const{__scopeSelect:a,...t}=e,n=kt();return d.jsx(aCu,{scope:a,id:n,children:d.jsx(se.div,{role:"group","aria-labelledby":n,...t,ref:u})})});nCu.displayName=nJ;var rJ="SelectLabel",iJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,...t}=e,n=tCu(rJ,a);return d.jsx(se.div,{id:n.id,...t,ref:u})});iJ.displayName=rJ;var ep="SelectItem",[rCu,oJ]=fd(ep),sJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,value:t,disabled:n=!1,textValue:r,...i}=e,o=N1(ep,a),s=R1(ep,a),l=o.value===t,[E,c]=C.useState(r??""),[D,h]=C.useState(!1),m=Xe(u,g=>{var F;return(F=s.itemRefCallback)==null?void 0:F.call(s,g,t,n)}),x=kt(),p=C.useRef("touch"),f=()=>{n||(o.onValueChange(t),o.onOpenChange(!1))};if(t==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(rCu,{scope:a,value:t,disabled:n,textId:x,isSelected:l,onItemTextChange:C.useCallback(g=>{c(F=>F||((g==null?void 0:g.textContent)??"").trim())},[]),children:d.jsx(F2.ItemSlot,{scope:a,value:t,disabled:n,textValue:E,children:d.jsx(se.div,{role:"option","aria-labelledby":x,"data-highlighted":D?"":void 0,"aria-selected":l&&D,"data-state":l?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...i,ref:m,onFocus:ju(i.onFocus,()=>h(!0)),onBlur:ju(i.onBlur,()=>h(!1)),onClick:ju(i.onClick,()=>{p.current!=="mouse"&&f()}),onPointerUp:ju(i.onPointerUp,()=>{p.current==="mouse"&&f()}),onPointerDown:ju(i.onPointerDown,g=>{p.current=g.pointerType}),onPointerMove:ju(i.onPointerMove,g=>{var F;p.current=g.pointerType,n?(F=s.onItemLeave)==null||F.call(s):p.current==="mouse"&&g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ju(i.onPointerLeave,g=>{var F;g.currentTarget===document.activeElement&&((F=s.onItemLeave)==null||F.call(s))}),onKeyDown:ju(i.onKeyDown,g=>{var b;((b=s.searchRef)==null?void 0:b.current)!==""&&g.key===" "||(H2u.includes(g.key)&&f(),g.key===" "&&g.preventDefault())})})})})});sJ.displayName=ep;var M5="SelectItemText",lJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,className:t,style:n,...r}=e,i=N1(M5,a),o=R1(M5,a),s=oJ(M5,a),l=U2u(M5,a),[E,c]=C.useState(null),D=Xe(u,f=>c(f),s.onItemTextChange,f=>{var g;return(g=o.itemTextRefCallback)==null?void 0:g.call(o,f,s.value,s.disabled)}),h=E==null?void 0:E.textContent,m=C.useMemo(()=>d.jsx("option",{value:s.value,disabled:s.disabled,children:h},s.value),[s.disabled,s.value,h]),{onNativeOptionAdd:x,onNativeOptionRemove:p}=l;return Zt(()=>(x(m),()=>p(m)),[x,p,m]),d.jsxs(d.Fragment,{children:[d.jsx(se.span,{id:s.textId,...r,ref:D}),s.isSelected&&i.valueNode&&!i.valueNodeHasChildren?nl.createPortal(r.children,i.valueNode):null]})});lJ.displayName=M5;var EJ="SelectItemIndicator",cJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,...t}=e;return oJ(EJ,a).isSelected?d.jsx(se.span,{"aria-hidden":!0,...t,ref:u}):null});cJ.displayName=EJ;var ib="SelectScrollUpButton",dJ=C.forwardRef((e,u)=>{const a=R1(ib,e.__scopeSelect),t=L8(ib,e.__scopeSelect),[n,r]=C.useState(!1),i=Xe(u,t.onScrollButtonChange);return Zt(()=>{if(a.viewport&&a.isPositioned){let o=function(){const l=s.scrollTop>0;r(l)};const s=a.viewport;return o(),s.addEventListener("scroll",o),()=>s.removeEventListener("scroll",o)}},[a.viewport,a.isPositioned]),n?d.jsx(hJ,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:s}=a;o&&s&&(o.scrollTop=o.scrollTop-s.offsetHeight)}}):null});dJ.displayName=ib;var ob="SelectScrollDownButton",DJ=C.forwardRef((e,u)=>{const a=R1(ob,e.__scopeSelect),t=L8(ob,e.__scopeSelect),[n,r]=C.useState(!1),i=Xe(u,t.onScrollButtonChange);return Zt(()=>{if(a.viewport&&a.isPositioned){let o=function(){const l=s.scrollHeight-s.clientHeight,E=Math.ceil(s.scrollTop)<l;r(E)};const s=a.viewport;return o(),s.addEventListener("scroll",o),()=>s.removeEventListener("scroll",o)}},[a.viewport,a.isPositioned]),n?d.jsx(hJ,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:s}=a;o&&s&&(o.scrollTop=o.scrollTop+s.offsetHeight)}}):null});DJ.displayName=ob;var hJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,onAutoScroll:t,...n}=e,r=R1("SelectScrollButton",a),i=C.useRef(null),o=k2(a),s=C.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return C.useEffect(()=>()=>s(),[s]),Zt(()=>{var E;const l=o().find(c=>c.ref.current===document.activeElement);(E=l==null?void 0:l.ref.current)==null||E.scrollIntoView({block:"nearest"})},[o]),d.jsx(se.div,{"aria-hidden":!0,...n,ref:u,style:{flexShrink:0,...n.style},onPointerDown:ju(n.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(t,50))}),onPointerMove:ju(n.onPointerMove,()=>{var l;(l=r.onItemLeave)==null||l.call(r),i.current===null&&(i.current=window.setInterval(t,50))}),onPointerLeave:ju(n.onPointerLeave,()=>{s()})})}),iCu="SelectSeparator",mJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,...t}=e;return d.jsx(se.div,{"aria-hidden":!0,...t,ref:u})});mJ.displayName=iCu;var sb="SelectArrow",oCu=C.forwardRef((e,u)=>{const{__scopeSelect:a,...t}=e,n=v2(a),r=N1(sb,a),i=R1(sb,a);return r.open&&i.position==="popper"?d.jsx(m2,{...n,...t,ref:u}):null});oCu.displayName=sb;var sCu="SelectBubbleInput",xJ=C.forwardRef(({__scopeSelect:e,value:u,...a},t)=>{const n=C.useRef(null),r=Xe(t,n),i=C2(u);return C.useEffect(()=>{const o=n.current;if(!o)return;const s=window.HTMLSelectElement.prototype,E=Object.getOwnPropertyDescriptor(s,"value").set;if(i!==u&&E){const c=new Event("change",{bubbles:!0});E.call(o,u),o.dispatchEvent(c)}},[i,u]),d.jsx(se.select,{...a,style:{...EG,...a.style},ref:r,defaultValue:u})});xJ.displayName=sCu;function fJ(e){return e===""||e===void 0}function pJ(e){const u=eo(e),a=C.useRef(""),t=C.useRef(0),n=C.useCallback(i=>{const o=a.current+i;u(o),function s(l){a.current=l,window.clearTimeout(t.current),l!==""&&(t.current=window.setTimeout(()=>s(""),1e3))}(o)},[u]),r=C.useCallback(()=>{a.current="",window.clearTimeout(t.current)},[]);return C.useEffect(()=>()=>window.clearTimeout(t.current),[]),[a,n,r]}function gJ(e,u,a){const n=u.length>1&&Array.from(u).every(l=>l===u[0])?u[0]:u,r=a?e.indexOf(a):-1;let i=lCu(e,Math.max(r,0));n.length===1&&(i=i.filter(l=>l!==a));const s=i.find(l=>l.textValue.toLowerCase().startsWith(n.toLowerCase()));return s!==a?s:void 0}function lCu(e,u){return e.map((a,t)=>e[(u+t)%e.length])}var ECu=JG,CJ=UG,cCu=QG,dCu=qG,DCu=YG,FJ=XG,hCu=tJ,kJ=iJ,vJ=sJ,mCu=lJ,xCu=cJ,AJ=dJ,bJ=DJ,yJ=mJ;const Ka=ECu,$a=cCu,Oa=C.forwardRef(({className:e,children:u,...a},t)=>d.jsxs(CJ,{ref:t,className:lu("border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm focus:outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...a,children:[u,d.jsx(dCu,{asChild:!0,children:d.jsx(od,{className:"h-4 w-4 opacity-50"})})]}));Oa.displayName=CJ.displayName;const BJ=C.forwardRef(({className:e,...u},a)=>d.jsx(AJ,{ref:a,className:lu("flex cursor-default items-center justify-center py-1",e),...u,children:d.jsx(NV,{className:"h-4 w-4"})}));BJ.displayName=AJ.displayName;const SJ=C.forwardRef(({className:e,...u},a)=>d.jsx(bJ,{ref:a,className:lu("flex cursor-default items-center justify-center py-1",e),...u,children:d.jsx(od,{className:"h-4 w-4"})}));SJ.displayName=bJ.displayName;const wa=C.forwardRef((e,u)=>d.jsx(DCu,{children:d.jsx(zJ,{ref:u,...e})}));wa.displayName=FJ.displayName;const zJ=C.forwardRef(({className:e,children:u,position:a="popper",...t},n)=>d.jsxs(FJ,{ref:n,className:lu("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md",a==="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:a,...t,children:[d.jsx(BJ,{}),d.jsx(hCu,{className:lu("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:u}),d.jsx(SJ,{})]}));zJ.displayName="SelectContentNoPortal";const fCu=C.forwardRef(({className:e,...u},a)=>d.jsx(kJ,{ref:a,className:lu("px-2 py-1.5 text-sm font-semibold",e),...u}));fCu.displayName=kJ.displayName;const Re=C.forwardRef(({className:e,children:u,...a},t)=>d.jsxs(vJ,{ref:t,className:lu("focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[d.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(xCu,{children:d.jsx(d1,{className:"h-4 w-4"})})}),d.jsx(mCu,{children:u})]}));Re.displayName=vJ.displayName;const pCu=C.forwardRef(({className:e,children:u,tooltip:a,...t},n)=>d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Re,{ref:n,className:e,...t,children:u})}),d.jsx(Yl,{children:d.jsx(n0,{className:"max-w-md break-words",side:"right",sideOffset:8,children:a})})]}));pCu.displayName="PeekableSelectItem";const gCu=C.forwardRef(({className:e,...u},a)=>d.jsx(yJ,{ref:a,className:lu("bg-muted -mx-1 my-1 h-px",e),...u}));gCu.displayName=yJ.displayName;function CCu({table:e}){return d.jsx("div",{className:"flex items-center justify-end px-2",children:d.jsxs("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),d.jsxs(Ka,{value:`${e.getState().pagination.pageSize}`,onValueChange:u=>{e.setPageSize(Number(u))},children:[d.jsx(Oa,{className:"h-8 w-fit space-x-2",children:d.jsx($a,{placeholder:e.getState().pagination.pageSize})}),d.jsx(wa,{side:"top",children:[10,20,30,40,50].map(u=>d.jsx(Re,{value:`${u}`,children:u},u))})]})]}),d.jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",e.getState().pagination.pageIndex+1," of"," ",e.getPageCount()]}),d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsxs(Ve,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:[d.jsx("span",{className:"sr-only",children:"Go to first page"}),d.jsx(C5u,{})]}),d.jsxs(Ve,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:[d.jsx("span",{className:"sr-only",children:"Go to previous page"}),d.jsx(x5u,{})]}),d.jsxs(Ve,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:[d.jsx("span",{className:"sr-only",children:"Go to next page"}),d.jsx(rm,{})]}),d.jsxs(Ve,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:[d.jsx("span",{className:"sr-only",children:"Go to last page"}),d.jsx(k5u,{})]})]})]})})}function OJ({table:e,children:u,className:a,activeNameFilter:t,isLoading:n,hidePagination:r,RowComponent:i=Xl,hasBackendPagination:o}){const{getState:s,getSortedRowModel:l}=e,{pagination:E}=s(),c=E.pageIndex??0,D=E.pageSize??10,h=c*D,m=h+D,x=oH(e,r||o?l().rows:l().rows.slice(h,m)),p=x.length;return d.jsxs("div",{className:"space-y-4",children:[u,d.jsx("div",{className:lu("w-full overflow-auto rounded-md border",a),children:d.jsxs(GG,{children:[d.jsx(P8,{children:e.getHeaderGroups().map(f=>d.jsx(Xl,{children:f.headers.map(g=>{var F;return d.jsx(N8,{className:(F=g.column.columnDef.meta)==null?void 0:F.className,children:g.isPlaceholder?null:Xf(g.column.columnDef.header,g.getContext())},g.id)})},f.id))}),d.jsxs(j8,{children:[x.map(f=>d.jsx(i,{row:f,"data-state":f.getIsSelected()&&"selected",className:"group h-[50px]",children:f.getVisibleCells().map(g=>{var F;return d.jsx(YD,{className:lu("relative",(F=g.column.columnDef.meta)==null?void 0:F.className),children:Xf(g.column.columnDef.cell,g.getContext())},g.id)})},f.id)),p===0?d.jsxs(Xl,{className:"relative h-24",children:[e.getAllColumns().map(f=>d.jsx(YD,{},f.id)),d.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:t&&t.length>0&&t.length<3?"Continue typing for results...":n?"Loading...":"No results."})]}):null]})]})}),!r&&d.jsx(CCu,{table:e})]})}var _k="rovingFocusGroup.onEntryFocus",FCu={bubbles:!1,cancelable:!0},xm="RovingFocusGroup",[lb,wJ,kCu]=R8(xm),[vCu,L1]=Tt(xm,[kCu]),[ACu,bCu]=vCu(xm),MJ=C.forwardRef((e,u)=>d.jsx(lb.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(lb.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(yCu,{...e,ref:u})})}));MJ.displayName=xm;var yCu=C.forwardRef((e,u)=>{const{__scopeRovingFocusGroup:a,orientation:t,loop:n=!1,dir:r,currentTabStopId:i,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:s,onEntryFocus:l,preventScrollOnEntryFocus:E=!1,...c}=e,D=C.useRef(null),h=Xe(u,D),m=xd(r),[x,p]=hn({prop:i,defaultProp:o??null,onChange:s,caller:xm}),[f,g]=C.useState(!1),F=eo(l),b=wJ(a),y=C.useRef(!1),[v,A]=C.useState(0);return C.useEffect(()=>{const B=D.current;if(B)return B.addEventListener(_k,F),()=>B.removeEventListener(_k,F)},[F]),d.jsx(ACu,{scope:a,orientation:t,dir:m,loop:n,currentTabStopId:x,onItemFocus:C.useCallback(B=>p(B),[p]),onItemShiftTab:C.useCallback(()=>g(!0),[]),onFocusableItemAdd:C.useCallback(()=>A(B=>B+1),[]),onFocusableItemRemove:C.useCallback(()=>A(B=>B-1),[]),children:d.jsx(se.div,{tabIndex:f||v===0?-1:0,"data-orientation":t,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:ju(e.onMouseDown,()=>{y.current=!0}),onFocus:ju(e.onFocus,B=>{const j=!y.current;if(B.target===B.currentTarget&&j&&!f){const R=new CustomEvent(_k,FCu);if(B.currentTarget.dispatchEvent(R),!R.defaultPrevented){const w=b().filter(M=>M.focusable),O=w.find(M=>M.active),T=w.find(M=>M.id===x),N=[O,T,...w].filter(Boolean).map(M=>M.ref.current);jJ(N,E)}}y.current=!1}),onBlur:ju(e.onBlur,()=>g(!1))})})}),TJ="RovingFocusGroupItem",PJ=C.forwardRef((e,u)=>{const{__scopeRovingFocusGroup:a,focusable:t=!0,active:n=!1,tabStopId:r,children:i,...o}=e,s=kt(),l=r||s,E=bCu(TJ,a),c=E.currentTabStopId===l,D=wJ(a),{onFocusableItemAdd:h,onFocusableItemRemove:m,currentTabStopId:x}=E;return C.useEffect(()=>{if(t)return h(),()=>m()},[t,h,m]),d.jsx(lb.ItemSlot,{scope:a,id:l,focusable:t,active:n,children:d.jsx(se.span,{tabIndex:c?0:-1,"data-orientation":E.orientation,...o,ref:u,onMouseDown:ju(e.onMouseDown,p=>{t?E.onItemFocus(l):p.preventDefault()}),onFocus:ju(e.onFocus,()=>E.onItemFocus(l)),onKeyDown:ju(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){E.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const f=zCu(p,E.orientation,E.dir);if(f!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let F=D().filter(b=>b.focusable).map(b=>b.ref.current);if(f==="last")F.reverse();else if(f==="prev"||f==="next"){f==="prev"&&F.reverse();const b=F.indexOf(p.currentTarget);F=E.loop?OCu(F,b+1):F.slice(b+1)}setTimeout(()=>jJ(F))}}),children:typeof i=="function"?i({isCurrentTabStop:c,hasTabStop:x!=null}):i})})});PJ.displayName=TJ;var BCu={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function SCu(e,u){return u!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function zCu(e,u,a){const t=SCu(e.key,a);if(!(u==="vertical"&&["ArrowLeft","ArrowRight"].includes(t))&&!(u==="horizontal"&&["ArrowUp","ArrowDown"].includes(t)))return BCu[t]}function jJ(e,u=!1){const a=document.activeElement;for(const t of e)if(t===a||(t.focus({preventScroll:u}),document.activeElement!==a))return}function OCu(e,u){return e.map((a,t)=>e[(u+t)%e.length])}var A2=MJ,b2=PJ,Eb=["Enter"," "],wCu=["ArrowDown","PageUp","Home"],NJ=["ArrowUp","PageDown","End"],MCu=[...wCu,...NJ],TCu={ltr:[...Eb,"ArrowRight"],rtl:[...Eb,"ArrowLeft"]},PCu={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fm="Menu",[XD,jCu,NCu]=R8(fm),[vE,y2]=Tt(fm,[NCu,j1,L1]),B2=j1(),RJ=L1(),[RCu,AE]=vE(fm),[LCu,pm]=vE(fm),LJ=e=>{const{__scopeMenu:u,open:a=!1,children:t,dir:n,onOpenChange:r,modal:i=!0}=e,o=B2(u),[s,l]=C.useState(null),E=C.useRef(!1),c=eo(r),D=xd(n);return C.useEffect(()=>{const h=()=>{E.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>E.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),d.jsx(D2,{...o,children:d.jsx(RCu,{scope:u,open:a,onOpenChange:c,content:s,onContentChange:l,children:d.jsx(LCu,{scope:u,onClose:C.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:E,dir:D,modal:i,children:t})})})};LJ.displayName=fm;var _Cu="MenuAnchor",_8=C.forwardRef((e,u)=>{const{__scopeMenu:a,...t}=e,n=B2(a);return d.jsx(dm,{...n,...t,ref:u})});_8.displayName=_Cu;var I8="MenuPortal",[ICu,_J]=vE(I8,{forceMount:void 0}),IJ=e=>{const{__scopeMenu:u,forceMount:a,children:t,container:n}=e,r=AE(I8,u);return d.jsx(ICu,{scope:u,forceMount:a,children:d.jsx(fn,{present:a||r.open,children:d.jsx(cd,{asChild:!0,container:n,children:t})})})};IJ.displayName=I8;var ci="MenuContent",[KCu,K8]=vE(ci),KJ=C.forwardRef((e,u)=>{const a=_J(ci,e.__scopeMenu),{forceMount:t=a.forceMount,...n}=e,r=AE(ci,e.__scopeMenu),i=pm(ci,e.__scopeMenu);return d.jsx(XD.Provider,{scope:e.__scopeMenu,children:d.jsx(fn,{present:t||r.open,children:d.jsx(XD.Slot,{scope:e.__scopeMenu,children:i.modal?d.jsx($Cu,{...n,ref:u}):d.jsx(VCu,{...n,ref:u})})})})}),$Cu=C.forwardRef((e,u)=>{const a=AE(ci,e.__scopeMenu),t=C.useRef(null),n=Xe(u,t);return C.useEffect(()=>{const r=t.current;if(r)return t2(r)},[]),d.jsx($8,{...e,ref:n,trapFocus:a.open,disableOutsidePointerEvents:a.open,disableOutsideScroll:!0,onFocusOutside:ju(e.onFocusOutside,r=>r.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>a.onOpenChange(!1)})}),VCu=C.forwardRef((e,u)=>{const a=AE(ci,e.__scopeMenu);return d.jsx($8,{...e,ref:u,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>a.onOpenChange(!1)})}),HCu=c1("MenuContent.ScrollLock"),$8=C.forwardRef((e,u)=>{const{__scopeMenu:a,loop:t=!1,trapFocus:n,onOpenAutoFocus:r,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEntryFocus:s,onEscapeKeyDown:l,onPointerDownOutside:E,onFocusOutside:c,onInteractOutside:D,onDismiss:h,disableOutsideScroll:m,...x}=e,p=AE(ci,a),f=pm(ci,a),g=B2(a),F=RJ(a),b=jCu(a),[y,v]=C.useState(null),A=C.useRef(null),B=Xe(u,A,p.onContentChange),j=C.useRef(0),R=C.useRef(""),w=C.useRef(0),O=C.useRef(null),T=C.useRef("right"),z=C.useRef(0),N=m?a2:C.Fragment,M=m?{as:HCu,allowPinchZoom:!0}:void 0,I=L=>{var tu,Y;const K=R.current+L,W=b().filter(ou=>!ou.disabled),_=document.activeElement,Q=(tu=W.find(ou=>ou.ref.current===_))==null?void 0:tu.textValue,eu=W.map(ou=>ou.textValue),U=aFu(eu,K,Q),iu=(Y=W.find(ou=>ou.textValue===U))==null?void 0:Y.ref.current;(function ou(Cu){R.current=Cu,window.clearTimeout(j.current),Cu!==""&&(j.current=window.setTimeout(()=>ou(""),1e3))})(K),iu&&setTimeout(()=>iu.focus())};C.useEffect(()=>()=>window.clearTimeout(j.current),[]),u2();const P=C.useCallback(L=>{var W,_;return T.current===((W=O.current)==null?void 0:W.side)&&nFu(L,(_=O.current)==null?void 0:_.area)},[]);return d.jsx(KCu,{scope:a,searchRef:R,onItemEnter:C.useCallback(L=>{P(L)&&L.preventDefault()},[P]),onItemLeave:C.useCallback(L=>{var K;P(L)||((K=A.current)==null||K.focus(),v(null))},[P]),onTriggerLeave:C.useCallback(L=>{P(L)&&L.preventDefault()},[P]),pointerGraceTimerRef:w,onPointerGraceIntentChange:C.useCallback(L=>{O.current=L},[]),children:d.jsx(N,{...M,children:d.jsx(sm,{asChild:!0,trapped:n,onMountAutoFocus:ju(r,L=>{var K;L.preventDefault(),(K=A.current)==null||K.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:d.jsx(Ed,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:E,onFocusOutside:c,onInteractOutside:D,onDismiss:h,children:d.jsx(A2,{asChild:!0,...F,dir:f.dir,orientation:"vertical",loop:t,currentTabStopId:y,onCurrentTabStopIdChange:v,onEntryFocus:ju(s,L=>{f.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(h2,{role:"menu","aria-orientation":"vertical","data-state":tW(p.open),"data-radix-menu-content":"",dir:f.dir,...g,...x,ref:B,style:{outline:"none",...x.style},onKeyDown:ju(x.onKeyDown,L=>{const W=L.target.closest("[data-radix-menu-content]")===L.currentTarget,_=L.ctrlKey||L.altKey||L.metaKey,Q=L.key.length===1;W&&(L.key==="Tab"&&L.preventDefault(),!_&&Q&&I(L.key));const eu=A.current;if(L.target!==eu||!MCu.includes(L.key))return;L.preventDefault();const iu=b().filter(tu=>!tu.disabled).map(tu=>tu.ref.current);NJ.includes(L.key)&&iu.reverse(),uFu(iu)}),onBlur:ju(e.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(j.current),R.current="")}),onPointerMove:ju(e.onPointerMove,uh(L=>{const K=L.target,W=z.current!==L.clientX;if(L.currentTarget.contains(K)&&W){const _=L.clientX>z.current?"right":"left";T.current=_,z.current=L.clientX}}))})})})})})})});KJ.displayName=ci;var GCu="MenuGroup",V8=C.forwardRef((e,u)=>{const{__scopeMenu:a,...t}=e;return d.jsx(se.div,{role:"group",...t,ref:u})});V8.displayName=GCu;var JCu="MenuLabel",$J=C.forwardRef((e,u)=>{const{__scopeMenu:a,...t}=e;return d.jsx(se.div,{...t,ref:u})});$J.displayName=JCu;var ap="MenuItem",IT="menu.itemSelect",S2=C.forwardRef((e,u)=>{const{disabled:a=!1,onSelect:t,...n}=e,r=C.useRef(null),i=pm(ap,e.__scopeMenu),o=K8(ap,e.__scopeMenu),s=Xe(u,r),l=C.useRef(!1),E=()=>{const c=r.current;if(!a&&c){const D=new CustomEvent(IT,{bubbles:!0,cancelable:!0});c.addEventListener(IT,h=>t==null?void 0:t(h),{once:!0}),sH(c,D),D.defaultPrevented?l.current=!1:i.onClose()}};return d.jsx(VJ,{...n,ref:s,disabled:a,onClick:ju(e.onClick,E),onPointerDown:c=>{var D;(D=e.onPointerDown)==null||D.call(e,c),l.current=!0},onPointerUp:ju(e.onPointerUp,c=>{var D;l.current||(D=c.currentTarget)==null||D.click()}),onKeyDown:ju(e.onKeyDown,c=>{const D=o.searchRef.current!=="";a||D&&c.key===" "||Eb.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});S2.displayName=ap;var VJ=C.forwardRef((e,u)=>{const{__scopeMenu:a,disabled:t=!1,textValue:n,...r}=e,i=K8(ap,a),o=RJ(a),s=C.useRef(null),l=Xe(u,s),[E,c]=C.useState(!1),[D,h]=C.useState("");return C.useEffect(()=>{const m=s.current;m&&h((m.textContent??"").trim())},[r.children]),d.jsx(XD.ItemSlot,{scope:a,disabled:t,textValue:n??D,children:d.jsx(b2,{asChild:!0,...o,focusable:!t,children:d.jsx(se.div,{role:"menuitem","data-highlighted":E?"":void 0,"aria-disabled":t||void 0,"data-disabled":t?"":void 0,...r,ref:l,onPointerMove:ju(e.onPointerMove,uh(m=>{t?i.onItemLeave(m):(i.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ju(e.onPointerLeave,uh(m=>i.onItemLeave(m))),onFocus:ju(e.onFocus,()=>c(!0)),onBlur:ju(e.onBlur,()=>c(!1))})})})}),WCu="MenuCheckboxItem",HJ=C.forwardRef((e,u)=>{const{checked:a=!1,onCheckedChange:t,...n}=e;return d.jsx(ZJ,{scope:e.__scopeMenu,checked:a,children:d.jsx(S2,{role:"menuitemcheckbox","aria-checked":tp(a)?"mixed":a,...n,ref:u,"data-state":G8(a),onSelect:ju(n.onSelect,()=>t==null?void 0:t(tp(a)?!0:!a),{checkForDefaultPrevented:!1})})})});HJ.displayName=WCu;var GJ="MenuRadioGroup",[UCu,ZCu]=vE(GJ,{value:void 0,onValueChange:()=>{}}),JJ=C.forwardRef((e,u)=>{const{value:a,onValueChange:t,...n}=e,r=eo(t);return d.jsx(UCu,{scope:e.__scopeMenu,value:a,onValueChange:r,children:d.jsx(V8,{...n,ref:u})})});JJ.displayName=GJ;var WJ="MenuRadioItem",UJ=C.forwardRef((e,u)=>{const{value:a,...t}=e,n=ZCu(WJ,e.__scopeMenu),r=a===n.value;return d.jsx(ZJ,{scope:e.__scopeMenu,checked:r,children:d.jsx(S2,{role:"menuitemradio","aria-checked":r,...t,ref:u,"data-state":G8(r),onSelect:ju(t.onSelect,()=>{var i;return(i=n.onValueChange)==null?void 0:i.call(n,a)},{checkForDefaultPrevented:!1})})})});UJ.displayName=WJ;var H8="MenuItemIndicator",[ZJ,QCu]=vE(H8,{checked:!1}),QJ=C.forwardRef((e,u)=>{const{__scopeMenu:a,forceMount:t,...n}=e,r=QCu(H8,a);return d.jsx(fn,{present:t||tp(r.checked)||r.checked===!0,children:d.jsx(se.span,{...n,ref:u,"data-state":G8(r.checked)})})});QJ.displayName=H8;var qCu="MenuSeparator",qJ=C.forwardRef((e,u)=>{const{__scopeMenu:a,...t}=e;return d.jsx(se.div,{role:"separator","aria-orientation":"horizontal",...t,ref:u})});qJ.displayName=qCu;var YCu="MenuArrow",YJ=C.forwardRef((e,u)=>{const{__scopeMenu:a,...t}=e,n=B2(a);return d.jsx(m2,{...n,...t,ref:u})});YJ.displayName=YCu;var XCu="MenuSub",[Q00,XJ]=vE(XCu),T5="MenuSubTrigger",uW=C.forwardRef((e,u)=>{const a=AE(T5,e.__scopeMenu),t=pm(T5,e.__scopeMenu),n=XJ(T5,e.__scopeMenu),r=K8(T5,e.__scopeMenu),i=C.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:s}=r,l={__scopeMenu:e.__scopeMenu},E=C.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return C.useEffect(()=>E,[E]),C.useEffect(()=>{const c=o.current;return()=>{window.clearTimeout(c),s(null)}},[o,s]),d.jsx(_8,{asChild:!0,...l,children:d.jsx(VJ,{id:n.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":n.contentId,"data-state":tW(a.open),...e,ref:Hs(u,n.onTriggerChange),onClick:c=>{var D;(D=e.onClick)==null||D.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),a.open||a.onOpenChange(!0))},onPointerMove:ju(e.onPointerMove,uh(c=>{r.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!a.open&&!i.current&&(r.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{a.onOpenChange(!0),E()},100))})),onPointerLeave:ju(e.onPointerLeave,uh(c=>{var h,m;E();const D=(h=a.content)==null?void 0:h.getBoundingClientRect();if(D){const x=(m=a.content)==null?void 0:m.dataset.side,p=x==="right",f=p?-5:5,g=D[p?"left":"right"],F=D[p?"right":"left"];r.onPointerGraceIntentChange({area:[{x:c.clientX+f,y:c.clientY},{x:g,y:D.top},{x:F,y:D.top},{x:F,y:D.bottom},{x:g,y:D.bottom}],side:x}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>r.onPointerGraceIntentChange(null),300)}else{if(r.onTriggerLeave(c),c.defaultPrevented)return;r.onPointerGraceIntentChange(null)}})),onKeyDown:ju(e.onKeyDown,c=>{var h;const D=r.searchRef.current!=="";e.disabled||D&&c.key===" "||TCu[t.dir].includes(c.key)&&(a.onOpenChange(!0),(h=a.content)==null||h.focus(),c.preventDefault())})})})});uW.displayName=T5;var eW="MenuSubContent",aW=C.forwardRef((e,u)=>{const a=_J(ci,e.__scopeMenu),{forceMount:t=a.forceMount,...n}=e,r=AE(ci,e.__scopeMenu),i=pm(ci,e.__scopeMenu),o=XJ(eW,e.__scopeMenu),s=C.useRef(null),l=Xe(u,s);return d.jsx(XD.Provider,{scope:e.__scopeMenu,children:d.jsx(fn,{present:t||r.open,children:d.jsx(XD.Slot,{scope:e.__scopeMenu,children:d.jsx($8,{id:o.contentId,"aria-labelledby":o.triggerId,...n,ref:l,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:E=>{var c;i.isUsingKeyboardRef.current&&((c=s.current)==null||c.focus()),E.preventDefault()},onCloseAutoFocus:E=>E.preventDefault(),onFocusOutside:ju(e.onFocusOutside,E=>{E.target!==o.trigger&&r.onOpenChange(!1)}),onEscapeKeyDown:ju(e.onEscapeKeyDown,E=>{i.onClose(),E.preventDefault()}),onKeyDown:ju(e.onKeyDown,E=>{var h;const c=E.currentTarget.contains(E.target),D=PCu[i.dir].includes(E.key);c&&D&&(r.onOpenChange(!1),(h=o.trigger)==null||h.focus(),E.preventDefault())})})})})})});aW.displayName=eW;function tW(e){return e?"open":"closed"}function tp(e){return e==="indeterminate"}function G8(e){return tp(e)?"indeterminate":e?"checked":"unchecked"}function uFu(e){const u=document.activeElement;for(const a of e)if(a===u||(a.focus(),document.activeElement!==u))return}function eFu(e,u){return e.map((a,t)=>e[(u+t)%e.length])}function aFu(e,u,a){const n=u.length>1&&Array.from(u).every(l=>l===u[0])?u[0]:u,r=a?e.indexOf(a):-1;let i=eFu(e,Math.max(r,0));n.length===1&&(i=i.filter(l=>l!==a));const s=i.find(l=>l.toLowerCase().startsWith(n.toLowerCase()));return s!==a?s:void 0}function tFu(e,u){const{x:a,y:t}=e;let n=!1;for(let r=0,i=u.length-1;r<u.length;i=r++){const o=u[r],s=u[i],l=o.x,E=o.y,c=s.x,D=s.y;E>t!=D>t&&a<(c-l)*(t-E)/(D-E)+l&&(n=!n)}return n}function nFu(e,u){if(!u)return!1;const a={x:e.clientX,y:e.clientY};return tFu(a,u)}function uh(e){return u=>u.pointerType==="mouse"?e(u):void 0}var nW=LJ,rW=_8,iW=IJ,oW=KJ,sW=V8,lW=$J,EW=S2,cW=HJ,dW=JJ,DW=UJ,hW=QJ,mW=qJ,xW=YJ,fW=uW,pW=aW,z2="DropdownMenu",[rFu,q00]=Tt(z2,[y2]),In=y2(),[iFu,gW]=rFu(z2),CW=e=>{const{__scopeDropdownMenu:u,children:a,dir:t,open:n,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,s=In(u),l=C.useRef(null),[E,c]=hn({prop:n,defaultProp:r??!1,onChange:i,caller:z2});return d.jsx(iFu,{scope:u,triggerId:kt(),triggerRef:l,contentId:kt(),open:E,onOpenChange:c,onOpenToggle:C.useCallback(()=>c(D=>!D),[c]),modal:o,children:d.jsx(nW,{...s,open:E,onOpenChange:c,dir:t,modal:o,children:a})})};CW.displayName=z2;var FW="DropdownMenuTrigger",kW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,disabled:t=!1,...n}=e,r=gW(FW,a),i=In(a);return d.jsx(rW,{asChild:!0,...i,children:d.jsx(se.button,{type:"button",id:r.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":r.open?"open":"closed","data-disabled":t?"":void 0,disabled:t,...n,ref:Hs(u,r.triggerRef),onPointerDown:ju(e.onPointerDown,o=>{!t&&o.button===0&&o.ctrlKey===!1&&(r.onOpenToggle(),r.open||o.preventDefault())}),onKeyDown:ju(e.onKeyDown,o=>{t||(["Enter"," "].includes(o.key)&&r.onOpenToggle(),o.key==="ArrowDown"&&r.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});kW.displayName=FW;var oFu="DropdownMenuPortal",vW=e=>{const{__scopeDropdownMenu:u,...a}=e,t=In(u);return d.jsx(iW,{...t,...a})};vW.displayName=oFu;var AW="DropdownMenuContent",bW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=gW(AW,a),r=In(a),i=C.useRef(!1);return d.jsx(oW,{id:n.contentId,"aria-labelledby":n.triggerId,...r,...t,ref:u,onCloseAutoFocus:ju(e.onCloseAutoFocus,o=>{var s;i.current||(s=n.triggerRef.current)==null||s.focus(),i.current=!1,o.preventDefault()}),onInteractOutside:ju(e.onInteractOutside,o=>{const s=o.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0,E=s.button===2||l;(!n.modal||E)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});bW.displayName=AW;var sFu="DropdownMenuGroup",lFu=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(sW,{...n,...t,ref:u})});lFu.displayName=sFu;var EFu="DropdownMenuLabel",yW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(lW,{...n,...t,ref:u})});yW.displayName=EFu;var cFu="DropdownMenuItem",BW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(EW,{...n,...t,ref:u})});BW.displayName=cFu;var dFu="DropdownMenuCheckboxItem",SW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(cW,{...n,...t,ref:u})});SW.displayName=dFu;var DFu="DropdownMenuRadioGroup",hFu=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(dW,{...n,...t,ref:u})});hFu.displayName=DFu;var mFu="DropdownMenuRadioItem",zW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(DW,{...n,...t,ref:u})});zW.displayName=mFu;var xFu="DropdownMenuItemIndicator",OW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(hW,{...n,...t,ref:u})});OW.displayName=xFu;var fFu="DropdownMenuSeparator",wW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(mW,{...n,...t,ref:u})});wW.displayName=fFu;var pFu="DropdownMenuArrow",gFu=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(xW,{...n,...t,ref:u})});gFu.displayName=pFu;var CFu="DropdownMenuSubTrigger",MW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(fW,{...n,...t,ref:u})});MW.displayName=CFu;var FFu="DropdownMenuSubContent",TW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(pW,{...n,...t,ref:u,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});TW.displayName=FFu;var kFu=CW,vFu=kW,AFu=vW,PW=bW,jW=yW,NW=BW,RW=SW,LW=zW,_W=OW,IW=wW,KW=MW,$W=TW;const VW=kFu,HW=vFu,bFu=C.forwardRef(({className:e,inset:u,children:a,...t},n)=>d.jsxs(KW,{ref:n,className:lu("focus:bg-accent data-[state=open]:bg-accent flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",u&&"pl-8",e),...t,children:[a,d.jsx(rm,{className:"ml-auto"})]}));bFu.displayName=KW.displayName;const yFu=C.forwardRef(({className:e,...u},a)=>d.jsx($W,{ref:a,className:lu("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg",e),...u}));yFu.displayName=$W.displayName;const J8=C.forwardRef(({className:e,sideOffset:u=4,...a},t)=>d.jsx(AFu,{children:d.jsx(PW,{ref:t,sideOffset:u,className:lu("bg-popover text-popover-foreground z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));J8.displayName=PW.displayName;const M4=C.forwardRef(({className:e,inset:u,...a},t)=>d.jsx(NW,{ref:t,className:lu("focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",u&&"pl-8",e),...a}));M4.displayName=NW.displayName;const BFu=C.forwardRef(({tooltip:e,...u},a)=>d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(M4,{ref:a,...u})}),d.jsx(Yl,{children:d.jsx(n0,{className:"max-w-md break-words",side:"right",sideOffset:8,children:e})})]}));BFu.displayName="PeekableDropdownMenuItem";const SFu=C.forwardRef(({className:e,children:u,checked:a,...t},n)=>d.jsxs(RW,{ref:n,className:lu("focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:a,...t,children:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(_W,{children:d.jsx(d1,{className:"h-4 w-4"})})}),u]}));SFu.displayName=RW.displayName;const zFu=C.forwardRef(({className:e,children:u,...a},t)=>d.jsxs(LW,{ref:t,className:lu("focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(_W,{children:d.jsx(_V,{className:"h-2 w-2 fill-current"})})}),u]}));zFu.displayName=LW.displayName;const OFu=C.forwardRef(({className:e,inset:u,...a},t)=>d.jsx(jW,{ref:t,className:lu("px-2 py-1.5 text-sm font-semibold",u&&"pl-8",e),...a}));OFu.displayName=jW.displayName;const GW=C.forwardRef(({className:e,...u},a)=>d.jsx(IW,{ref:a,className:lu("bg-muted -mx-1 my-1 h-px",e),...u}));GW.displayName=IW.displayName;function Jn({column:e,title:u,className:a,position:t="left"}){return e.getCanSort()?d.jsx("div",{className:lu("flex items-center space-x-2",{"flex justify-end":t==="right"},a),children:d.jsxs(VW,{children:[d.jsx(HW,{asChild:!0,children:d.jsxs(Ve,{variant:"ghost",size:"sm",className:lu("data-[state=open]:bg-accent -ml-3 h-8",{"-mr-3":t==="right"}),children:[t==="left"?d.jsx("span",{children:u}):null,e.getIsSorted()==="desc"?d.jsx(R7,{}):e.getIsSorted()==="asc"?d.jsx(YM,{}):d.jsx(RV,{}),t==="right"?d.jsx("span",{children:u}):null]})}),d.jsxs(J8,{align:"start",children:[d.jsxs(M4,{onClick:()=>e.toggleSorting(!1),children:[d.jsx(YM,{className:"text-muted-foreground/70 h-3.5 w-3.5"}),"Asc"]}),d.jsxs(M4,{onClick:()=>e.toggleSorting(!0),children:[d.jsx(R7,{className:"text-muted-foreground/70 h-3.5 w-3.5"}),"Desc"]}),d.jsx(GW,{}),d.jsxs(M4,{onClick:()=>e.clearSorting(),children:[d.jsx(FE,{className:"text-muted-foreground/70 h-3.5 w-3.5"}),"Clear"]})]})]})}):d.jsx("div",{className:lu("text-xs","mr-2","whitespace-nowrap","flex","items-center",a),children:u})}var gm=e=>e.type==="checkbox",C4=e=>e instanceof Date,Vn=e=>e==null;const JW=e=>typeof e=="object";var Et=e=>!Vn(e)&&!Array.isArray(e)&&JW(e)&&!C4(e),WW=e=>Et(e)&&e.target?gm(e.target)?e.target.checked:e.target.value:e,wFu=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,UW=(e,u)=>e.has(wFu(u)),MFu=e=>{const u=e.constructor&&e.constructor.prototype;return Et(u)&&u.hasOwnProperty("isPrototypeOf")},W8=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ut(e){if(e instanceof Date)return new Date(e);const u=typeof FileList<"u"&&e instanceof FileList;if(W8&&(e instanceof Blob||u))return e;const a=Array.isArray(e);if(!a&&!(Et(e)&&MFu(e)))return e;const t=a?[]:Object.create(Object.getPrototypeOf(e));for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=ut(e[n]));return t}var O2=e=>/^\w*$/.test(e),Ea=e=>e===void 0,U8=e=>Array.isArray(e)?e.filter(Boolean):[],Z8=e=>U8(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Vu=(e,u,a)=>{if(!u||!Et(e))return a;const t=(O2(u)?[u]:Z8(u)).reduce((n,r)=>Vn(n)?n:n[r],e);return Ea(t)||t===e?Ea(e[u])?a:e[u]:t},Dr=e=>typeof e=="boolean",An=e=>typeof e=="function",R0=(e,u,a)=>{let t=-1;const n=O2(u)?[u]:Z8(u),r=n.length,i=r-1;for(;++t<r;){const o=n[t];let s=a;if(t!==i){const l=e[o];s=Et(l)||Array.isArray(l)?l:isNaN(+n[t+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=s,e=e[o]}};const np={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},$i={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},hs={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Q8=nu.createContext(null);Q8.displayName="HookFormContext";const w2=()=>nu.useContext(Q8),TFu=e=>{const{children:u,...a}=e;return nu.createElement(Q8.Provider,{value:a},u)};var ZW=(e,u,a,t=!0)=>{const n={defaultValues:u._defaultValues};for(const r in e)Object.defineProperty(n,r,{get:()=>{const i=r;return u._proxyFormState[i]!==$i.all&&(u._proxyFormState[i]=!t||$i.all),a&&(a[i]=!0),e[i]}});return n};const q8=typeof window<"u"?nu.useLayoutEffect:nu.useEffect;function PFu(e){const u=w2(),{control:a=u.control,disabled:t,name:n,exact:r}=e||{},[i,o]=nu.useState(a._formState),s=nu.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return q8(()=>a._subscribe({name:n,formState:s.current,exact:r,callback:l=>{!t&&o({...a._formState,...l})}}),[n,t,r]),nu.useEffect(()=>{s.current.isValid&&a._setValid(!0)},[a]),nu.useMemo(()=>ZW(i,a,s.current,!1),[i,a])}var pr=e=>typeof e=="string",cb=(e,u,a,t,n)=>pr(e)?(t&&u.watch.add(e),Vu(a,e,n)):Array.isArray(e)?e.map(r=>(t&&u.watch.add(r),Vu(a,r))):(t&&(u.watchAll=!0),a),db=e=>Vn(e)||!JW(e);function Vi(e,u,a=new WeakSet){if(db(e)||db(u))return Object.is(e,u);if(C4(e)&&C4(u))return Object.is(e.getTime(),u.getTime());const t=Object.keys(e),n=Object.keys(u);if(t.length!==n.length)return!1;if(a.has(e)||a.has(u))return!0;a.add(e),a.add(u);for(const r of t){const i=e[r];if(!n.includes(r))return!1;if(r!=="ref"){const o=u[r];if(C4(i)&&C4(o)||Et(i)&&Et(o)||Array.isArray(i)&&Array.isArray(o)?!Vi(i,o,a):!Object.is(i,o))return!1}}return!0}function jFu(e){const u=w2(),{control:a=u.control,name:t,defaultValue:n,disabled:r,exact:i,compute:o}=e||{},s=nu.useRef(n),l=nu.useRef(o),E=nu.useRef(void 0),c=nu.useRef(a),D=nu.useRef(t);l.current=o;const[h,m]=nu.useState(()=>{const b=a._getWatch(t,s.current);return l.current?l.current(b):b}),x=nu.useCallback(b=>{const y=cb(t,a._names,b||a._formValues,!1,s.current);return l.current?l.current(y):y},[a._formValues,a._names,t]),p=nu.useCallback(b=>{if(!r){const y=cb(t,a._names,b||a._formValues,!1,s.current);if(l.current){const v=l.current(y);Vi(v,E.current)||(m(v),E.current=v)}else m(y)}},[a._formValues,a._names,r,t]);q8(()=>((c.current!==a||!Vi(D.current,t))&&(c.current=a,D.current=t,p()),a._subscribe({name:t,formState:{values:!0},exact:i,callback:b=>{p(b.values)}})),[a,i,t,p]),nu.useEffect(()=>a._removeUnmounted());const f=c.current!==a,g=D.current,F=nu.useMemo(()=>{if(r)return null;const b=!f&&!Vi(g,t);return f||b?x():null},[r,f,t,g,x]);return F!==null?F:h}function NFu(e){const u=w2(),{name:a,disabled:t,control:n=u.control,shouldUnregister:r,defaultValue:i,exact:o=!0}=e,s=UW(n._names.array,a),l=nu.useMemo(()=>Vu(n._formValues,a,Vu(n._defaultValues,a,i)),[n,a,i]),E=jFu({control:n,name:a,defaultValue:l,exact:o}),c=PFu({control:n,name:a,exact:o}),D=nu.useRef(e),h=nu.useRef(void 0),m=nu.useRef(n.register(a,{...e.rules,value:E,...Dr(e.disabled)?{disabled:e.disabled}:{}}));D.current=e;const x=nu.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Vu(c.errors,a)},isDirty:{enumerable:!0,get:()=>!!Vu(c.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!Vu(c.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!Vu(c.validatingFields,a)},error:{enumerable:!0,get:()=>Vu(c.errors,a)}}),[c,a]),p=nu.useCallback(b=>m.current.onChange({target:{value:WW(b),name:a},type:np.CHANGE}),[a]),f=nu.useCallback(()=>m.current.onBlur({target:{value:Vu(n._formValues,a),name:a},type:np.BLUR}),[a,n._formValues]),g=nu.useCallback(b=>{const y=Vu(n._fields,a);y&&y._f&&b&&(y._f.ref={focus:()=>An(b.focus)&&b.focus(),select:()=>An(b.select)&&b.select(),setCustomValidity:v=>An(b.setCustomValidity)&&b.setCustomValidity(v),reportValidity:()=>An(b.reportValidity)&&b.reportValidity()})},[n._fields,a]),F=nu.useMemo(()=>({name:a,value:E,...Dr(t)||c.disabled?{disabled:c.disabled||t}:{},onChange:p,onBlur:f,ref:g}),[a,t,c.disabled,p,f,g,E]);return nu.useEffect(()=>{const b=n._options.shouldUnregister||r,y=h.current;y&&y!==a&&!s&&n.unregister(y),n.register(a,{...D.current.rules,...Dr(D.current.disabled)?{disabled:D.current.disabled}:{}});const v=(A,B)=>{const j=Vu(n._fields,A);j&&j._f&&(j._f.mount=B)};if(v(a,!0),b){const A=ut(Vu(n._options.defaultValues,a,D.current.defaultValue));R0(n._defaultValues,a,A),Ea(Vu(n._formValues,a))&&R0(n._formValues,a,A)}return!s&&n.register(a),h.current=a,()=>{(s?b&&!n._state.action:b)?n.unregister(a):v(a,!1)}},[a,n,s,r]),nu.useEffect(()=>{n._setDisabledField({disabled:t,name:a})},[t,a,n]),nu.useMemo(()=>({field:F,formState:c,fieldState:x}),[F,c,x])}const RFu=e=>e.render(NFu(e));var QW=(e,u,a,t,n)=>u?{...a[e],types:{...a[e]&&a[e].types?a[e].types:{},[t]:n||!0}}:{},lD=e=>Array.isArray(e)?e:[e],KT=()=>{let e=[];return{get observers(){return e},next:n=>{for(const r of e)r.next&&r.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(r=>r!==n)}}),unsubscribe:()=>{e=[]}}};function qW(e,u){const a={};for(const t in e)if(e.hasOwnProperty(t)){const n=e[t],r=u[t];if(n&&Et(n)&&r){const i=qW(n,r);Et(i)&&(a[t]=i)}else e[t]&&(a[t]=r)}return a}var kn=e=>Et(e)&&!Object.keys(e).length,Y8=e=>e.type==="file",rp=e=>{if(!W8)return!1;const u=e?e.ownerDocument:0;return e instanceof(u&&u.defaultView?u.defaultView.HTMLElement:HTMLElement)},YW=e=>e.type==="select-multiple",X8=e=>e.type==="radio",LFu=e=>X8(e)||gm(e),Ik=e=>rp(e)&&e.isConnected;function _Fu(e,u){const a=u.slice(0,-1).length;let t=0;for(;t<a;)e=Ea(e)?t++:e[u[t++]];return e}function IFu(e){for(const u in e)if(e.hasOwnProperty(u)&&!Ea(e[u]))return!1;return!0}function et(e,u){const a=Array.isArray(u)?u:O2(u)?[u]:Z8(u),t=a.length===1?e:_Fu(e,a),n=a.length-1,r=a[n];return t&&delete t[r],n!==0&&(Et(t)&&kn(t)||Array.isArray(t)&&IFu(t))&&et(e,a.slice(0,-1)),e}var KFu=e=>{for(const u in e)if(An(e[u]))return!0;return!1};function XW(e){return Array.isArray(e)||Et(e)&&!KFu(e)}function Db(e,u={}){for(const a in e){const t=e[a];XW(t)?(u[a]=Array.isArray(t)?[]:{},Db(t,u[a])):Ea(t)||(u[a]=!0)}return u}function uc(e,u,a){a||(a=Db(u));for(const t in e){const n=e[t];if(XW(n))Ea(u)||db(a[t])?a[t]=Db(n,Array.isArray(n)?[]:{}):uc(n,Vn(u)?{}:u[t],a[t]);else{const r=u[t];a[t]=!Vi(n,r)}}return a}const $T={value:!1,isValid:!1},VT={value:!0,isValid:!0};var uU=e=>{if(Array.isArray(e)){if(e.length>1){const u=e.filter(a=>a&&a.checked&&!a.disabled).map(a=>a.value);return{value:u,isValid:!!u.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ea(e[0].attributes.value)?Ea(e[0].value)||e[0].value===""?VT:{value:e[0].value,isValid:!0}:VT:$T}return $T},eU=(e,{valueAsNumber:u,valueAsDate:a,setValueAs:t})=>Ea(e)?e:u?e===""?NaN:e&&+e:a&&pr(e)?new Date(e):t?t(e):e;const HT={isValid:!1,value:null};var aU=e=>Array.isArray(e)?e.reduce((u,a)=>a&&a.checked&&!a.disabled?{isValid:!0,value:a.value}:u,HT):HT;function GT(e){const u=e.ref;return Y8(u)?u.files:X8(u)?aU(e.refs).value:YW(u)?[...u.selectedOptions].map(({value:a})=>a):gm(u)?uU(e.refs).value:eU(Ea(u.value)?e.ref.value:u.value,e)}var $Fu=(e,u,a,t)=>{const n={};for(const r of e){const i=Vu(u,r);i&&R0(n,r,i._f)}return{criteriaMode:a,names:[...e],fields:n,shouldUseNativeValidation:t}},ip=e=>e instanceof RegExp,r5=e=>Ea(e)?e:ip(e)?e.source:Et(e)?ip(e.value)?e.value.source:e.value:e,JT=e=>({isOnSubmit:!e||e===$i.onSubmit,isOnBlur:e===$i.onBlur,isOnChange:e===$i.onChange,isOnAll:e===$i.all,isOnTouch:e===$i.onTouched});const WT="AsyncFunction";var VFu=e=>!!e&&!!e.validate&&!!(An(e.validate)&&e.validate.constructor.name===WT||Et(e.validate)&&Object.values(e.validate).find(u=>u.constructor.name===WT)),HFu=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),UT=(e,u,a)=>!a&&(u.watchAll||u.watch.has(e)||[...u.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const ED=(e,u,a,t)=>{for(const n of a||Object.keys(e)){const r=Vu(e,n);if(r){const{_f:i,...o}=r;if(i){if(i.refs&&i.refs[0]&&u(i.refs[0],n)&&!t)return!0;if(i.ref&&u(i.ref,i.name)&&!t)return!0;if(ED(o,u))break}else if(Et(o)&&ED(o,u))break}}};function ZT(e,u,a){const t=Vu(e,a);if(t||O2(a))return{error:t,name:a};const n=a.split(".");for(;n.length;){const r=n.join("."),i=Vu(u,r),o=Vu(e,r);if(i&&!Array.isArray(i)&&a!==r)return{name:a};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};n.pop()}return{name:a}}var GFu=(e,u,a,t)=>{a(e);const{name:n,...r}=e;return kn(r)||Object.keys(r).length>=Object.keys(u).length||Object.keys(r).find(i=>u[i]===(!t||$i.all))},JFu=(e,u,a)=>!e||!u||e===u||lD(e).some(t=>t&&(a?t===u:t.startsWith(u)||u.startsWith(t))),WFu=(e,u,a,t,n)=>n.isOnAll?!1:!a&&n.isOnTouch?!(u||e):(a?t.isOnBlur:n.isOnBlur)?!e:(a?t.isOnChange:n.isOnChange)?e:!0,UFu=(e,u)=>!U8(Vu(e,u)).length&&et(e,u),ZFu=(e,u,a)=>{const t=lD(Vu(e,a));return R0(t,"root",u[a]),R0(e,a,t),e};function QT(e,u,a="validate"){if(pr(e)||Array.isArray(e)&&e.every(pr)||Dr(e)&&!e)return{type:a,message:pr(e)?e:"",ref:u}}var VE=e=>Et(e)&&!ip(e)?e:{value:e,message:""},qT=async(e,u,a,t,n,r)=>{const{ref:i,refs:o,required:s,maxLength:l,minLength:E,min:c,max:D,pattern:h,validate:m,name:x,valueAsNumber:p,mount:f}=e._f,g=Vu(a,x);if(!f||u.has(x))return{};const F=o?o[0]:i,b=O=>{n&&F.reportValidity&&(F.setCustomValidity(Dr(O)?"":O||""),F.reportValidity())},y={},v=X8(i),A=gm(i),B=v||A,j=(p||Y8(i))&&Ea(i.value)&&Ea(g)||rp(i)&&i.value===""||g===""||Array.isArray(g)&&!g.length,R=QW.bind(null,x,t,y),w=(O,T,z,N=hs.maxLength,M=hs.minLength)=>{const I=O?T:z;y[x]={type:O?N:M,message:I,ref:i,...R(O?N:M,I)}};if(r?!Array.isArray(g)||!g.length:s&&(!B&&(j||Vn(g))||Dr(g)&&!g||A&&!uU(o).isValid||v&&!aU(o).isValid)){const{value:O,message:T}=pr(s)?{value:!!s,message:s}:VE(s);if(O&&(y[x]={type:hs.required,message:T,ref:F,...R(hs.required,T)},!t))return b(T),y}if(!j&&(!Vn(c)||!Vn(D))){let O,T;const z=VE(D),N=VE(c);if(!Vn(g)&&!isNaN(g)){const M=i.valueAsNumber||g&&+g;Vn(z.value)||(O=M>z.value),Vn(N.value)||(T=M<N.value)}else{const M=i.valueAsDate||new Date(g),I=K=>new Date(new Date().toDateString()+" "+K),P=i.type=="time",L=i.type=="week";pr(z.value)&&g&&(O=P?I(g)>I(z.value):L?g>z.value:M>new Date(z.value)),pr(N.value)&&g&&(T=P?I(g)<I(N.value):L?g<N.value:M<new Date(N.value))}if((O||T)&&(w(!!O,z.message,N.message,hs.max,hs.min),!t))return b(y[x].message),y}if((l||E)&&!j&&(pr(g)||r&&Array.isArray(g))){const O=VE(l),T=VE(E),z=!Vn(O.value)&&g.length>+O.value,N=!Vn(T.value)&&g.length<+T.value;if((z||N)&&(w(z,O.message,T.message),!t))return b(y[x].message),y}if(h&&!j&&pr(g)){const{value:O,message:T}=VE(h);if(ip(O)&&!g.match(O)&&(y[x]={type:hs.pattern,message:T,ref:i,...R(hs.pattern,T)},!t))return b(T),y}if(m){if(An(m)){const O=await m(g,a),T=QT(O,F);if(T&&(y[x]={...T,...R(hs.validate,T.message)},!t))return b(T.message),y}else if(Et(m)){let O={};for(const T in m){if(!kn(O)&&!t)break;const z=QT(await m[T](g,a),F,T);z&&(O={...z,...R(T,z.message)},b(z.message),t&&(y[x]=O))}if(!kn(O)&&(y[x]={ref:F,...O},!t))return y}}return b(!0),y};const QFu={mode:$i.onSubmit,reValidateMode:$i.onChange,shouldFocusError:!0};function qFu(e={}){let u={...QFu,...e},a={submitCount:0,isDirty:!1,isReady:!1,isLoading:An(u.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:u.errors||{},disabled:u.disabled||!1},t={},n=Et(u.defaultValues)||Et(u.values)?ut(u.defaultValues||u.values)||{}:{},r=u.shouldUnregister?{}:ut(n),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},s,l=0;const E={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},c={...E};let D={...c};const h={array:KT(),state:KT()},m=u.criteriaMode===$i.all,x=V=>au=>{clearTimeout(l),l=setTimeout(V,au)},p=async V=>{if(!i.keepIsValid&&!u.disabled&&(c.isValid||D.isValid||V)){let au;u.resolver?(au=kn((await B()).errors),f()):au=await R(t,!0),au!==a.isValid&&h.state.next({isValid:au})}},f=(V,au)=>{!u.disabled&&(c.isValidating||c.validatingFields||D.isValidating||D.validatingFields)&&((V||Array.from(o.mount)).forEach(du=>{du&&(au?R0(a.validatingFields,du,au):et(a.validatingFields,du))}),h.state.next({validatingFields:a.validatingFields,isValidating:!kn(a.validatingFields)}))},g=(V,au=[],du,bu,pu=!0,xu=!0)=>{if(bu&&du&&!u.disabled){if(i.action=!0,xu&&Array.isArray(Vu(t,V))){const Lu=du(Vu(t,V),bu.argA,bu.argB);pu&&R0(t,V,Lu)}if(xu&&Array.isArray(Vu(a.errors,V))){const Lu=du(Vu(a.errors,V),bu.argA,bu.argB);pu&&R0(a.errors,V,Lu),UFu(a.errors,V)}if((c.touchedFields||D.touchedFields)&&xu&&Array.isArray(Vu(a.touchedFields,V))){const Lu=du(Vu(a.touchedFields,V),bu.argA,bu.argB);pu&&R0(a.touchedFields,V,Lu)}(c.dirtyFields||D.dirtyFields)&&(a.dirtyFields=uc(n,r)),h.state.next({name:V,isDirty:O(V,au),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})}else R0(r,V,au)},F=(V,au)=>{R0(a.errors,V,au),h.state.next({errors:a.errors})},b=V=>{a.errors=V,h.state.next({errors:a.errors,isValid:!1})},y=(V,au,du,bu)=>{const pu=Vu(t,V);if(pu){const xu=Vu(r,V,Ea(du)?Vu(n,V):du);Ea(xu)||bu&&bu.defaultChecked||au?R0(r,V,au?xu:GT(pu._f)):N(V,xu),i.mount&&!i.action&&p()}},v=(V,au,du,bu,pu)=>{let xu=!1,Lu=!1;const He={name:V};if(!u.disabled){if(!du||bu){(c.isDirty||D.isDirty)&&(Lu=a.isDirty,a.isDirty=He.isDirty=O(),xu=Lu!==He.isDirty);const yu=Vi(Vu(n,V),au);Lu=!!Vu(a.dirtyFields,V),yu?et(a.dirtyFields,V):R0(a.dirtyFields,V,!0),He.dirtyFields=a.dirtyFields,xu=xu||(c.dirtyFields||D.dirtyFields)&&Lu!==!yu}if(du){const yu=Vu(a.touchedFields,V);yu||(R0(a.touchedFields,V,du),He.touchedFields=a.touchedFields,xu=xu||(c.touchedFields||D.touchedFields)&&yu!==du)}xu&&pu&&h.state.next(He)}return xu?He:{}},A=(V,au,du,bu)=>{const pu=Vu(a.errors,V),xu=(c.isValid||D.isValid)&&Dr(au)&&a.isValid!==au;if(u.delayError&&du?(s=x(()=>F(V,du)),s(u.delayError)):(clearTimeout(l),s=null,du?R0(a.errors,V,du):et(a.errors,V)),(du?!Vi(pu,du):pu)||!kn(bu)||xu){const Lu={...bu,...xu&&Dr(au)?{isValid:au}:{},errors:a.errors,name:V};a={...a,...Lu},h.state.next(Lu)}},B=async V=>(f(V,!0),await u.resolver(r,u.context,$Fu(V||o.mount,t,u.criteriaMode,u.shouldUseNativeValidation))),j=async V=>{const{errors:au}=await B(V);if(f(V),V)for(const du of V){const bu=Vu(au,du);bu?R0(a.errors,du,bu):et(a.errors,du)}else a.errors=au;return au},R=async(V,au,du={valid:!0})=>{for(const bu in V){const pu=V[bu];if(pu){const{_f:xu,...Lu}=pu;if(xu){const He=o.array.has(xu.name),yu=pu._f&&VFu(pu._f);yu&&c.validatingFields&&f([xu.name],!0);const Ke=await qT(pu,o.disabled,r,m,u.shouldUseNativeValidation&&!au,He);if(yu&&c.validatingFields&&f([xu.name]),Ke[xu.name]&&(du.valid=!1,au||e.shouldUseNativeValidation))break;!au&&(Vu(Ke,xu.name)?He?ZFu(a.errors,Ke,xu.name):R0(a.errors,xu.name,Ke[xu.name]):et(a.errors,xu.name))}!kn(Lu)&&await R(Lu,au,du)}}return du.valid},w=()=>{for(const V of o.unMount){const au=Vu(t,V);au&&(au._f.refs?au._f.refs.every(du=>!Ik(du)):!Ik(au._f.ref))&&Y(V)}o.unMount=new Set},O=(V,au)=>!u.disabled&&(V&&au&&R0(r,V,au),!Vi(W(),n)),T=(V,au,du)=>cb(V,o,{...i.mount?r:Ea(au)?n:pr(V)?{[V]:au}:au},du,au),z=V=>U8(Vu(i.mount?r:n,V,u.shouldUnregister?Vu(n,V,[]):[])),N=(V,au,du={})=>{const bu=Vu(t,V);let pu=au;if(bu){const xu=bu._f;xu&&(!xu.disabled&&R0(r,V,eU(au,xu)),pu=rp(xu.ref)&&Vn(au)?"":au,YW(xu.ref)?[...xu.ref.options].forEach(Lu=>Lu.selected=pu.includes(Lu.value)):xu.refs?gm(xu.ref)?xu.refs.forEach(Lu=>{(!Lu.defaultChecked||!Lu.disabled)&&(Array.isArray(pu)?Lu.checked=!!pu.find(He=>He===Lu.value):Lu.checked=pu===Lu.value||!!pu)}):xu.refs.forEach(Lu=>Lu.checked=Lu.value===pu):Y8(xu.ref)?xu.ref.value="":(xu.ref.value=pu,xu.ref.type||h.state.next({name:V,values:ut(r)})))}(du.shouldDirty||du.shouldTouch)&&v(V,pu,du.shouldTouch,du.shouldDirty,!0),du.shouldValidate&&K(V)},M=(V,au,du)=>{for(const bu in au){if(!au.hasOwnProperty(bu))return;const pu=au[bu],xu=V+"."+bu,Lu=Vu(t,xu);(o.array.has(V)||Et(pu)||Lu&&!Lu._f)&&!C4(pu)?M(xu,pu,du):N(xu,pu,du)}},I=(V,au,du={})=>{const bu=Vu(t,V),pu=o.array.has(V),xu=ut(au);R0(r,V,xu),pu?(h.array.next({name:V,values:ut(r)}),(c.isDirty||c.dirtyFields||D.isDirty||D.dirtyFields)&&du.shouldDirty&&h.state.next({name:V,dirtyFields:uc(n,r),isDirty:O(V,xu)})):bu&&!bu._f&&!Vn(xu)?M(V,xu,du):N(V,xu,du),UT(V,o)?h.state.next({...a,name:V,values:ut(r)}):h.state.next({name:i.mount?V:void 0,values:ut(r)})},P=async V=>{i.mount=!0;const au=V.target;let du=au.name,bu=!0;const pu=Vu(t,du),xu=yu=>{bu=Number.isNaN(yu)||C4(yu)&&isNaN(yu.getTime())||Vi(yu,Vu(r,du,yu))},Lu=JT(u.mode),He=JT(u.reValidateMode);if(pu){let yu,Ke;const t0=au.type?GT(pu._f):WW(V),N0=V.type===np.BLUR||V.type===np.FOCUS_OUT,ja=!HFu(pu._f)&&!u.resolver&&!Vu(a.errors,du)&&!pu._f.deps||WFu(N0,Vu(a.touchedFields,du),a.isSubmitted,He,Lu),Xt=UT(du,o,N0);R0(r,du,t0),N0?(!au||!au.readOnly)&&(pu._f.onBlur&&pu._f.onBlur(V),s&&s(0)):pu._f.onChange&&pu._f.onChange(V);const $r=v(du,t0,N0),PE=!kn($r)||Xt;if(!N0&&h.state.next({name:du,type:V.type,values:ut(r)}),ja)return(c.isValid||D.isValid)&&(u.mode==="onBlur"?N0&&p():N0||p()),PE&&h.state.next({name:du,...Xt?{}:$r});if(!N0&&Xt&&h.state.next({...a}),u.resolver){const{errors:Dl}=await B([du]);if(f([du]),xu(t0),bu){const fu=ZT(a.errors,t,du),Bu=ZT(Dl,t,fu.name||du);yu=Bu.error,du=Bu.name,Ke=kn(Dl)}}else f([du],!0),yu=(await qT(pu,o.disabled,r,m,u.shouldUseNativeValidation))[du],f([du]),xu(t0),bu&&(yu?Ke=!1:(c.isValid||D.isValid)&&(Ke=await R(t,!0)));bu&&(pu._f.deps&&(!Array.isArray(pu._f.deps)||pu._f.deps.length>0)&&K(pu._f.deps),A(du,Ke,yu,$r))}},L=(V,au)=>{if(Vu(a.errors,au)&&V.focus)return V.focus(),1},K=async(V,au={})=>{let du,bu;const pu=lD(V);if(u.resolver){const xu=await j(Ea(V)?V:pu);du=kn(xu),bu=V?!pu.some(Lu=>Vu(xu,Lu)):du}else V?(bu=(await Promise.all(pu.map(async xu=>{const Lu=Vu(t,xu);return await R(Lu&&Lu._f?{[xu]:Lu}:Lu)}))).every(Boolean),!(!bu&&!a.isValid)&&p()):bu=du=await R(t);return h.state.next({...!pr(V)||(c.isValid||D.isValid)&&du!==a.isValid?{}:{name:V},...u.resolver||!V?{isValid:du}:{},errors:a.errors}),au.shouldFocus&&!bu&&ED(t,L,V?pu:o.mount),bu},W=(V,au)=>{let du={...i.mount?r:n};return au&&(du=qW(au.dirtyFields?a.dirtyFields:a.touchedFields,du)),Ea(V)?du:pr(V)?Vu(du,V):V.map(bu=>Vu(du,bu))},_=(V,au)=>({invalid:!!Vu((au||a).errors,V),isDirty:!!Vu((au||a).dirtyFields,V),error:Vu((au||a).errors,V),isValidating:!!Vu(a.validatingFields,V),isTouched:!!Vu((au||a).touchedFields,V)}),Q=V=>{V&&lD(V).forEach(au=>et(a.errors,au)),h.state.next({errors:V?a.errors:{}})},eu=(V,au,du)=>{const bu=(Vu(t,V,{_f:{}})._f||{}).ref,pu=Vu(a.errors,V)||{},{ref:xu,message:Lu,type:He,...yu}=pu;R0(a.errors,V,{...yu,...au,ref:bu}),h.state.next({name:V,errors:a.errors,isValid:!1}),du&&du.shouldFocus&&bu&&bu.focus&&bu.focus()},U=(V,au)=>An(V)?h.state.subscribe({next:du=>"values"in du&&V(T(void 0,au),du)}):T(V,au,!0),iu=V=>h.state.subscribe({next:au=>{JFu(V.name,au.name,V.exact)&&GFu(au,V.formState||c,Zu,V.reRenderRoot)&&V.callback({values:{...r},...a,...au,defaultValues:n})}}).unsubscribe,tu=V=>(i.mount=!0,D={...D,...V.formState},iu({...V,formState:{...E,...V.formState}})),Y=(V,au={})=>{for(const du of V?lD(V):o.mount)o.mount.delete(du),o.array.delete(du),au.keepValue||(et(t,du),et(r,du)),!au.keepError&&et(a.errors,du),!au.keepDirty&&et(a.dirtyFields,du),!au.keepTouched&&et(a.touchedFields,du),!au.keepIsValidating&&et(a.validatingFields,du),!u.shouldUnregister&&!au.keepDefaultValue&&et(n,du);h.state.next({values:ut(r)}),h.state.next({...a,...au.keepDirty?{isDirty:O()}:{}}),!au.keepIsValid&&p()},ou=({disabled:V,name:au})=>{(Dr(V)&&i.mount||V||o.disabled.has(au))&&(V?o.disabled.add(au):o.disabled.delete(au))},Cu=(V,au={})=>{let du=Vu(t,V);const bu=Dr(au.disabled)||Dr(u.disabled);return R0(t,V,{...du||{},_f:{...du&&du._f?du._f:{ref:{name:V}},name:V,mount:!0,...au}}),o.mount.add(V),du?ou({disabled:Dr(au.disabled)?au.disabled:u.disabled,name:V}):y(V,!0,au.value),{...bu?{disabled:au.disabled||u.disabled}:{},...u.progressive?{required:!!au.required,min:r5(au.min),max:r5(au.max),minLength:r5(au.minLength),maxLength:r5(au.maxLength),pattern:r5(au.pattern)}:{},name:V,onChange:P,onBlur:P,ref:pu=>{if(pu){Cu(V,au),du=Vu(t,V);const xu=Ea(pu.value)&&pu.querySelectorAll&&pu.querySelectorAll("input,select,textarea")[0]||pu,Lu=LFu(xu),He=du._f.refs||[];if(Lu?He.find(yu=>yu===xu):xu===du._f.ref)return;R0(t,V,{_f:{...du._f,...Lu?{refs:[...He.filter(Ik),xu,...Array.isArray(Vu(n,V))?[{}]:[]],ref:{type:xu.type,name:V}}:{ref:xu}}}),y(V,!1,void 0,xu)}else du=Vu(t,V,{}),du._f&&(du._f.mount=!1),(u.shouldUnregister||au.shouldUnregister)&&!(UW(o.array,V)&&i.action)&&o.unMount.add(V)}}},Au=()=>u.shouldFocusError&&ED(t,L,o.mount),mu=V=>{Dr(V)&&(h.state.next({disabled:V}),ED(t,(au,du)=>{const bu=Vu(t,du);bu&&(au.disabled=bu._f.disabled||V,Array.isArray(bu._f.refs)&&bu._f.refs.forEach(pu=>{pu.disabled=bu._f.disabled||V}))},0,!1))},Nu=(V,au)=>async du=>{let bu;du&&(du.preventDefault&&du.preventDefault(),du.persist&&du.persist());let pu=ut(r);if(h.state.next({isSubmitting:!0}),u.resolver){const{errors:xu,values:Lu}=await B();f(),a.errors=xu,pu=ut(Lu)}else await R(t);if(o.disabled.size)for(const xu of o.disabled)et(pu,xu);if(et(a.errors,"root"),kn(a.errors)){h.state.next({errors:{}});try{await V(pu,du)}catch(xu){bu=xu}}else au&&await au({...a.errors},du),Au(),setTimeout(Au);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:kn(a.errors)&&!bu,submitCount:a.submitCount+1,errors:a.errors}),bu)throw bu},le=(V,au={})=>{Vu(t,V)&&(Ea(au.defaultValue)?I(V,ut(Vu(n,V))):(I(V,au.defaultValue),R0(n,V,ut(au.defaultValue))),au.keepTouched||et(a.touchedFields,V),au.keepDirty||(et(a.dirtyFields,V),a.isDirty=au.defaultValue?O(V,ut(Vu(n,V))):O()),au.keepError||(et(a.errors,V),c.isValid&&p()),h.state.next({...a}))},Yu=(V,au={})=>{const du=V?ut(V):n,bu=ut(du),pu=kn(V),xu=pu?n:bu;if(au.keepDefaultValues||(n=du),!au.keepValues){if(au.keepDirtyValues){const Lu=new Set([...o.mount,...Object.keys(uc(n,r))]);for(const He of Array.from(Lu)){const yu=Vu(a.dirtyFields,He),Ke=Vu(r,He),t0=Vu(xu,He);yu&&!Ea(Ke)?R0(xu,He,Ke):!yu&&!Ea(t0)&&I(He,t0)}}else{if(W8&&Ea(V))for(const Lu of o.mount){const He=Vu(t,Lu);if(He&&He._f){const yu=Array.isArray(He._f.refs)?He._f.refs[0]:He._f.ref;if(rp(yu)){const Ke=yu.closest("form");if(Ke){Ke.reset();break}}}}if(au.keepFieldsRef)for(const Lu of o.mount)I(Lu,Vu(xu,Lu));else t={}}r=u.shouldUnregister?au.keepDefaultValues?ut(n):{}:ut(xu),h.array.next({values:{...xu}}),h.state.next({values:{...xu}})}o={mount:au.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!c.isValid||!!au.keepIsValid||!!au.keepDirtyValues||!u.shouldUnregister&&!kn(xu),i.watch=!!u.shouldUnregister,i.keepIsValid=!!au.keepIsValid,i.action=!1,au.keepErrors||(a.errors={}),h.state.next({submitCount:au.keepSubmitCount?a.submitCount:0,isDirty:pu?!1:au.keepDirty?a.isDirty:!!(au.keepDefaultValues&&!Vi(V,n)),isSubmitted:au.keepIsSubmitted?a.isSubmitted:!1,dirtyFields:pu?{}:au.keepDirtyValues?au.keepDefaultValues&&r?uc(n,r):a.dirtyFields:au.keepDefaultValues&&V?uc(n,V):au.keepDirty?a.dirtyFields:{},touchedFields:au.keepTouched?a.touchedFields:{},errors:au.keepErrors?a.errors:{},isSubmitSuccessful:au.keepIsSubmitSuccessful?a.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:n})},ve=(V,au)=>Yu(An(V)?V(r):V,{...u.resetOptions,...au}),Ie=(V,au={})=>{const du=Vu(t,V),bu=du&&du._f;if(bu){const pu=bu.refs?bu.refs[0]:bu.ref;pu.focus&&setTimeout(()=>{pu.focus(),au.shouldSelect&&An(pu.select)&&pu.select()})}},Zu=V=>{a={...a,...V}},fe={control:{register:Cu,unregister:Y,getFieldState:_,handleSubmit:Nu,setError:eu,_subscribe:iu,_runSchema:B,_updateIsValidating:f,_focusError:Au,_getWatch:T,_getDirty:O,_setValid:p,_setFieldArray:g,_setDisabledField:ou,_setErrors:b,_getFieldArray:z,_reset:Yu,_resetDefaultValues:()=>An(u.defaultValues)&&u.defaultValues().then(V=>{ve(V,u.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:w,_disableForm:mu,_subjects:h,_proxyFormState:c,get _fields(){return t},get _formValues(){return r},get _state(){return i},set _state(V){i=V},get _defaultValues(){return n},get _names(){return o},set _names(V){o=V},get _formState(){return a},get _options(){return u},set _options(V){u={...u,...V}}},subscribe:tu,trigger:K,register:Cu,handleSubmit:Nu,watch:U,setValue:I,getValues:W,reset:ve,resetField:le,clearErrors:Q,unregister:Y,setError:eu,setFocus:Ie,getFieldState:_};return{...fe,formControl:fe}}function pd(e={}){const u=nu.useRef(void 0),a=nu.useRef(void 0),[t,n]=nu.useState({isDirty:!1,isValidating:!1,isLoading:An(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:An(e.defaultValues)?void 0:e.defaultValues});if(!u.current)if(e.formControl)u.current={...e.formControl,formState:t},e.defaultValues&&!An(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...o}=qFu(e);u.current={...o,formState:t}}const r=u.current.control;return r._options=e,q8(()=>{const i=r._subscribe({formState:r._proxyFormState,callback:()=>n({...r._formState}),reRenderRoot:!0});return n(o=>({...o,isReady:!0})),r._formState.isReady=!0,i},[r]),nu.useEffect(()=>r._disableForm(e.disabled),[r,e.disabled]),nu.useEffect(()=>{e.mode&&(r._options.mode=e.mode),e.reValidateMode&&(r._options.reValidateMode=e.reValidateMode)},[r,e.mode,e.reValidateMode]),nu.useEffect(()=>{e.errors&&(r._setErrors(e.errors),r._focusError())},[r,e.errors]),nu.useEffect(()=>{e.shouldUnregister&&r._subjects.state.next({values:r._getWatch()})},[r,e.shouldUnregister]),nu.useEffect(()=>{if(r._proxyFormState.isDirty){const i=r._getDirty();i!==t.isDirty&&r._subjects.state.next({isDirty:i})}},[r,t.isDirty]),nu.useEffect(()=>{var i;e.values&&!Vi(e.values,a.current)?(r._reset(e.values,{keepFieldsRef:!0,...r._options.resetOptions}),!((i=r._options.resetOptions)===null||i===void 0)&&i.keepIsValid||r._setValid(),a.current=e.values,n(o=>({...o}))):r._resetDefaultValues()},[r,e.values]),nu.useEffect(()=>{r._state.mount||(r._setValid(),r._state.mount=!0),r._state.watch&&(r._state.watch=!1,r._subjects.state.next({...r._formState})),r._removeUnmounted()}),u.current.formState=ZW(t,r),u.current}var YT=function(e,u,a){if(e&&"reportValidity"in e){var t=Vu(a,u);e.setCustomValidity(t&&t.message||""),e.reportValidity()}},tU=function(e,u){var a=function(n){var r=u.fields[n];r&&r.ref&&"reportValidity"in r.ref?YT(r.ref,n,e):r.refs&&r.refs.forEach(function(i){return YT(i,n,e)})};for(var t in u.fields)a(t)},YFu=function(e,u){u.shouldUseNativeValidation&&tU(e,u);var a={};for(var t in e){var n=Vu(u.fields,t),r=Object.assign(e[t]||{},{ref:n&&n.ref});if(uku(u.names||Object.keys(e),t)){var i=Object.assign({},XFu(Vu(a,t)));R0(i,"root",r),R0(a,t,i)}else R0(a,t,r)}return a},XFu=function(e){return Array.isArray(e)?e.filter(Boolean):[]},uku=function(e,u){return e.some(function(a){return a.startsWith(u+".")})},eku=function(e,u){for(var a={};e.length;){var t=e[0],n=t.code,r=t.message,i=t.path.join(".");if(!a[i])if("unionErrors"in t){var o=t.unionErrors[0].errors[0];a[i]={message:o.message,type:o.code}}else a[i]={message:r,type:n};if("unionErrors"in t&&t.unionErrors.forEach(function(E){return E.errors.forEach(function(c){return e.push(c)})}),u){var s=a[i].types,l=s&&s[t.code];a[i]=QW(i,u,a,n,l?[].concat(l,t.message):t.message)}e.shift()}return a},gd=function(e,u,a){return a===void 0&&(a={}),function(t,n,r){try{return Promise.resolve(function(i,o){try{var s=Promise.resolve(e[a.mode==="sync"?"parse":"parseAsync"](t,u)).then(function(l){return r.shouldUseNativeValidation&&tU({},r),{errors:{},values:a.raw?t:l}})}catch(l){return o(l)}return s&&s.then?s.then(void 0,o):s}(0,function(i){if(function(o){return o.errors!=null}(i))return{values:{},errors:YFu(eku(i.errors,!r.shouldUseNativeValidation&&r.criteriaMode==="all"),r)};throw i}))}catch(i){return Promise.reject(i)}}};function aku(e){return async function(a,t){const n=`${e}${a}`,r=await fetch(n,t);if(!r.ok){const i=await r.text(),o=new Error(i);throw o.status=r.status,o}return r.status===204?{}:r.json()}}function Ci(){const{fetcher:e}=zV();return e}function tku(){var e=C.useRef(!0);return e.current?(e.current=!1,!0):e.current}var nku=function(e,u){var a=tku();C.useEffect(function(){if(!a)return e()},u)};const rku=nku;function iku(){var e=C.useRef(!1),u=C.useCallback(function(){return e.current},[]);return C.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),u}function Ws(e,u,a){u===void 0&&(u=[]),a===void 0&&(a={loading:!1});var t=C.useRef(0),n=iku(),r=C.useState(a),i=r[0],o=r[1],s=C.useCallback(function(){for(var l=[],E=0;E<arguments.length;E++)l[E]=arguments[E];var c=++t.current;return i.loading||o(function(D){return ti(ti({},D),{loading:!0})}),e.apply(void 0,l).then(function(D){return n()&&c===t.current&&o({value:D,loading:!1}),D},function(D){return n()&&c===t.current&&o({error:D,loading:!1}),D})},u);return[i,s]}var oku=function(){};function sku(e){for(var u=[],a=1;a<arguments.length;a++)u[a-1]=arguments[a];e&&e.addEventListener&&e.addEventListener.apply(e,u)}function lku(e){for(var u=[],a=1;a<arguments.length;a++)u[a-1]=arguments[a];e&&e.removeEventListener&&e.removeEventListener.apply(e,u)}var Eku=typeof window<"u",cku=Eku?window:null,XT=function(e){return!!e.addEventListener},uP=function(e){return!!e.on},dku=function(e,u,a,t){a===void 0&&(a=cku),C.useEffect(function(){if(u&&a)return XT(a)?sku(a,e,u,t):uP(a)&&a.on(e,u,t),function(){XT(a)?lku(a,e,u,t):uP(a)&&a.off(e,u,t)}},[e,u,a,JSON.stringify(t)])};const Dku=dku;var hku=function(e){return typeof e=="function"?e:typeof e=="string"?function(u){return u.key===e}:e?function(){return!0}:function(){return!1}},mku=function(e,u,a,t){u===void 0&&(u=oku),a===void 0&&(a={}),t===void 0&&(t=[e]);var n=a.event,r=n===void 0?"keydown":n,i=a.target,o=a.options,s=C.useMemo(function(){var l=hku(e),E=function(c){if(l(c))return u(c)};return E},t);Dku(r,s,i,o)};const eP=mku;var xku=function(e){var u=C.useState([!1,null]),a=u[0],t=u[1];return eP(e,function(n){return t([!0,n])},{event:"keydown"},[a]),eP(e,function(n){return t([!1,n])},{event:"keyup"},[a]),a};const fku=xku;var pku=function(e,u,a,t){t===void 0&&(t=fku);var n=t(e),r=n[0],i=n[1];rku(function(){!r&&a?a(i):r&&u&&u(i)},[r])};const gku=pku,bE=r2,yE=IH,Cku=i2,nU=C.forwardRef(({className:e,...u},a)=>d.jsx(dd,{ref:a,className:lu("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",e),...u}));nU.displayName=dd.displayName;const _1=C.forwardRef(({className:e,children:u,...a},t)=>d.jsxs(Cku,{children:[d.jsx(nU,{}),d.jsxs(Dd,{ref:t,className:lu("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",e),...a,children:[u,d.jsxs(o2,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none",children:[d.jsx(FE,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_1.displayName=Dd.displayName;const I1=({className:e,...u})=>d.jsx("div",{className:lu("flex flex-col space-y-1.5 text-center sm:text-left",e),...u});I1.displayName="DialogHeader";const BE=({className:e,...u})=>d.jsx("div",{className:lu("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...u});BE.displayName="DialogFooter";const K1=C.forwardRef(({className:e,...u},a)=>d.jsx(lm,{ref:a,className:lu("text-lg font-semibold leading-none tracking-tight",e),...u}));K1.displayName=lm.displayName;const $1=C.forwardRef(({className:e,...u},a)=>d.jsx(Em,{ref:a,className:lu("text-muted-foreground text-sm",e),...u}));$1.displayName=Em.displayName;var Fku="Label",rU=C.forwardRef((e,u)=>d.jsx(se.label,{...e,ref:u,onMouseDown:a=>{var n;a.target.closest("button, input, select, textarea")||((n=e.onMouseDown)==null||n.call(e,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));rU.displayName=Fku;var iU=rU;const kku=P1("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xt=C.forwardRef(({className:e,...u},a)=>d.jsx(iU,{ref:a,className:lu(kku(),e),...u}));xt.displayName=iU.displayName;const Cd=TFu,oU=C.createContext({}),_0=({...e})=>d.jsx(oU.Provider,{value:{name:e.name},children:d.jsx(RFu,{...e})}),Cm=()=>{const e=C.useContext(oU),u=C.useContext(sU),{getFieldState:a,formState:t}=w2(),n=a(e.name,t);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:r}=u;return{id:r,name:e.name,formItemId:`${r}-form-item`,formDescriptionId:`${r}-form-item-description`,formMessageId:`${r}-form-item-message`,...n}},sU=C.createContext({}),M0=C.forwardRef(({className:e,...u},a)=>{const t=C.useId();return d.jsx(sU.Provider,{value:{id:t},children:d.jsx("div",{ref:a,className:lu("space-y-2",e),...u})})});M0.displayName="FormItem";const Va=C.forwardRef(({className:e,...u},a)=>{const{error:t,formItemId:n}=Cm();return d.jsx(xt,{ref:a,className:lu(t&&"text-destructive",e),htmlFor:n,...u})});Va.displayName="FormLabel";const bo=C.forwardRef(({className:e,tooltip:u,...a},t)=>{const{error:n,formItemId:r}=Cm();return d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(xt,{ref:t,className:lu("decoration-primary/20 underline decoration-dashed underline-offset-4",n&&"text-destructive",e),htmlFor:r,...a})}),d.jsx(Yl,{children:d.jsx(n0,{align:"center",sideOffset:12,className:"max-w-xs",children:u})})]})});bo.displayName="FormLabelWithTooltip";const T0=C.forwardRef(({...e},u)=>{const{error:a,formItemId:t,formDescriptionId:n,formMessageId:r}=Cm();return d.jsx(ol,{ref:u,id:t,"aria-describedby":a?`${n} ${r}`:`${n}`,"aria-invalid":!!a,...e})});T0.displayName="FormControl";const op=C.forwardRef(({className:e,...u},a)=>{const{formDescriptionId:t}=Cm();return d.jsx("p",{ref:a,id:t,className:lu("text-muted-foreground text-[0.8rem]",e),...u})});op.displayName="FormDescription";const P0=C.forwardRef(({className:e,children:u,...a},t)=>{const{error:n,formMessageId:r}=Cm(),i=n?String(n==null?void 0:n.message):u;return i?d.jsx("p",{ref:t,id:r,className:lu("text-destructive text-[0.8rem] font-medium",e),...a,children:i}):null});P0.displayName="FormMessage";function u1(e){return typeof e=="string"||e instanceof String}function aP(e){var u;return typeof e=="object"&&e!=null&&(e==null||(u=e.constructor)==null?void 0:u.name)==="Object"}function lU(e,u){return Array.isArray(u)?lU(e,(a,t)=>u.includes(t)):Object.entries(e).reduce((a,t)=>{let[n,r]=t;return u(r,n)&&(a[n]=r),a},{})}const Ae={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function vku(e){switch(e){case Ae.LEFT:return Ae.FORCE_LEFT;case Ae.RIGHT:return Ae.FORCE_RIGHT;default:return e}}function Kk(e){return e.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function sp(e,u){if(u===e)return!0;const a=Array.isArray(u),t=Array.isArray(e);let n;if(a&&t){if(u.length!=e.length)return!1;for(n=0;n<u.length;n++)if(!sp(u[n],e[n]))return!1;return!0}if(a!=t)return!1;if(u&&e&&typeof u=="object"&&typeof e=="object"){const r=u instanceof Date,i=e instanceof Date;if(r&&i)return u.getTime()==e.getTime();if(r!=i)return!1;const o=u instanceof RegExp,s=e instanceof RegExp;if(o&&s)return u.toString()==e.toString();if(o!=s)return!1;const l=Object.keys(u);for(n=0;n<l.length;n++)if(!Object.prototype.hasOwnProperty.call(e,l[n]))return!1;for(n=0;n<l.length;n++)if(!sp(e[l[n]],u[l[n]]))return!1;return!0}else if(u&&e&&typeof u=="function"&&typeof e=="function")return u.toString()===e.toString();return!1}class Aku{constructor(u){for(Object.assign(this,u);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?Ae.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?Ae.RIGHT:Ae.LEFT}}function $e(e,u){return new $e.InputMask(e,u)}function EU(e){if(e==null)throw new Error("mask property should be defined");return e instanceof RegExp?$e.MaskedRegExp:u1(e)?$e.MaskedPattern:e===Date?$e.MaskedDate:e===Number?$e.MaskedNumber:Array.isArray(e)||e===Array?$e.MaskedDynamic:$e.Masked&&e.prototype instanceof $e.Masked?e:$e.Masked&&e instanceof $e.Masked?e.constructor:e instanceof Function?$e.MaskedFunction:(console.warn("Mask not found for mask",e),$e.Masked)}function eh(e){if(!e)throw new Error("Options in not defined");if($e.Masked){if(e.prototype instanceof $e.Masked)return{mask:e};const{mask:u=void 0,...a}=e instanceof $e.Masked?{mask:e}:aP(e)&&e.mask instanceof $e.Masked?e:{};if(u){const t=u.mask;return{...lU(u,(n,r)=>!r.startsWith("_")),mask:u.constructor,_mask:t,...a}}}return aP(e)?{...e}:{mask:e}}function Us(e){if($e.Masked&&e instanceof $e.Masked)return e;const u=eh(e),a=EU(u.mask);if(!a)throw new Error("Masked class is not found for provided mask "+u.mask+", appropriate module needs to be imported manually before creating mask.");return u.mask===a&&delete u.mask,u._mask&&(u.mask=u._mask,delete u._mask),new a(u)}$e.createMask=Us;class uS{get selectionStart(){let u;try{u=this._unsafeSelectionStart}catch{}return u??this.value.length}get selectionEnd(){let u;try{u=this._unsafeSelectionEnd}catch{}return u??this.value.length}select(u,a){if(!(u==null||a==null||u===this.selectionStart&&a===this.selectionEnd))try{this._unsafeSelect(u,a)}catch{}}get isActive(){return!1}}$e.MaskElement=uS;const tP=90,bku=89;class M2 extends uS{constructor(u){super(),this.input=u,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var u,a,t;return(u=(a=(t=this.input).getRootNode)==null?void 0:a.call(t))!=null?u:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(u){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",u.drop),this.input.addEventListener("click",u.click),this.input.addEventListener("focus",u.focus),this.input.addEventListener("blur",u.commit),this._handlers=u}_onKeydown(u){if(this._handlers.redo&&(u.keyCode===tP&&u.shiftKey&&(u.metaKey||u.ctrlKey)||u.keyCode===bku&&u.ctrlKey))return u.preventDefault(),this._handlers.redo(u);if(this._handlers.undo&&u.keyCode===tP&&(u.metaKey||u.ctrlKey))return u.preventDefault(),this._handlers.undo(u);u.isComposing||this._handlers.selectionChange(u)}_onBeforeinput(u){if(u.inputType==="historyUndo"&&this._handlers.undo)return u.preventDefault(),this._handlers.undo(u);if(u.inputType==="historyRedo"&&this._handlers.redo)return u.preventDefault(),this._handlers.redo(u)}_onCompositionEnd(u){this._handlers.input(u)}_onInput(u){u.isComposing||this._handlers.input(u)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}$e.HTMLMaskElement=M2;class yku extends M2{constructor(u){super(u),this.input=u}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(u,a){this.input.setSelectionRange(u,a)}get value(){return this.input.value}set value(u){this.input.value=u}}$e.HTMLMaskElement=M2;class cU extends M2{get _unsafeSelectionStart(){const u=this.rootElement,a=u.getSelection&&u.getSelection(),t=a&&a.anchorOffset,n=a&&a.focusOffset;return n==null||t==null||t<n?t:n}get _unsafeSelectionEnd(){const u=this.rootElement,a=u.getSelection&&u.getSelection(),t=a&&a.anchorOffset,n=a&&a.focusOffset;return n==null||t==null||t>n?t:n}_unsafeSelect(u,a){if(!this.rootElement.createRange)return;const t=this.rootElement.createRange();t.setStart(this.input.firstChild||this.input,u),t.setEnd(this.input.lastChild||this.input,a);const n=this.rootElement,r=n.getSelection&&n.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}get value(){return this.input.textContent||""}set value(u){this.input.textContent=u}}$e.HTMLContenteditableMaskElement=cU;class T2{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(u){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(u),this.states.length>T2.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(u){return this.currentIndex=Math.min(Math.max(this.currentIndex+u,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}T2.MAX_LENGTH=100;class Bku{constructor(u,a){this.el=u instanceof uS?u:u.isContentEditable&&u.tagName!=="INPUT"&&u.tagName!=="TEXTAREA"?new cU(u):new yku(u),this.masked=Us(a),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new T2,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(u){var a;return u==null||((a=this.masked)==null?void 0:a.maskEquals(u))}get mask(){return this.masked.mask}set mask(u){if(this.maskEquals(u))return;if(!(u instanceof $e.Masked)&&this.masked.constructor===EU(u)){this.masked.updateOptions({mask:u});return}const a=u instanceof $e.Masked?u:Us({mask:u});a.unmaskedValue=this.masked.unmaskedValue,this.masked=a}get value(){return this._value}set value(u){this.value!==u&&(this.masked.value=u,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(u){this.unmaskedValue!==u&&(this.masked.unmaskedValue=u,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(u){this.rawInputValue!==u&&(this.masked.rawInputValue=u,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(u){this.masked.typedValueEquals(u)||(this.masked.typedValue=u,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(u,a){const t=this._listeners[u];t&&t.forEach(n=>n(a))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(u){!this.el||!this.el.isActive||(this.el.select(u,u),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(u){const a=this.masked.unmaskedValue,t=this.masked.value,n=this.masked.rawInputValue,r=this.displayValue,i=this.unmaskedValue!==a||this.value!==t||this._rawInputValue!==n;this._unmaskedValue=a,this._value=t,this._rawInputValue=n,this.el.value!==r&&(this.el.value=r),u==="auto"?this.alignCursor():u!=null&&(this.cursorPos=u),i&&this._fireChangeEvents(),!this._historyChanging&&(i||this.history.isEmpty)&&this.history.push({unmaskedValue:a,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(u){const{mask:a,...t}=u,n=!this.maskEquals(a),r=this.masked.optionsIsChanged(t);n&&(this.mask=a),r&&this.masked.updateOptions(t),(n||r)&&this.updateControl()}updateCursor(u){u!=null&&(this.cursorPos=u,this._delayUpdateCursor(u))}_delayUpdateCursor(u){this._abortUpdateCursor(),this._changingCursorPos=u,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,Ae.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(u,a){return this._listeners[u]||(this._listeners[u]=[]),this._listeners[u].push(a),this}off(u,a){if(!this._listeners[u])return this;if(!a)return delete this._listeners[u],this;const t=this._listeners[u].indexOf(a);return t>=0&&this._listeners[u].splice(t,1),this}_onInput(u){this._inputEvent=u,this._abortUpdateCursor();const a=new Aku({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),t=this.masked.rawInputValue,n=this.masked.splice(a.startChangePos,a.removed.length,a.inserted,a.removeDirection,{input:!0,raw:!0}).offset,r=t===this.masked.rawInputValue?a.removeDirection:Ae.NONE;let i=this.masked.nearestInputPos(a.startChangePos+n,r);r!==Ae.NONE&&(i=this.masked.nearestInputPos(i,Ae.NONE)),this.updateControl(i),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(u){u.preventDefault(),u.stopPropagation()}_onFocus(u){this.alignCursorFriendly()}_onClick(u){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(u){u&&(this._historyChanging=!0,this.unmaskedValue=u.unmaskedValue,this.el.select(u.selection.start,u.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}$e.InputMask=Bku;class e0{static normalize(u){return Array.isArray(u)?u:[u,new e0]}constructor(u){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},u)}aggregate(u){return this.inserted+=u.inserted,this.rawInserted+=u.rawInserted,this.tailShift+=u.tailShift,this.skip=this.skip||u.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(u){return this.inserted===u.inserted&&this.tailShift===u.tailShift&&this.rawInserted===u.rawInserted&&this.skip===u.skip}}$e.ChangeDetails=e0;class Lo{constructor(u,a,t){u===void 0&&(u=""),a===void 0&&(a=0),this.value=u,this.from=a,this.stop=t}toString(){return this.value}extend(u){this.value+=String(u)}appendTo(u){return u.append(this.toString(),{tail:!0}).aggregate(u._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(u){Object.assign(this,u)}unshift(u){if(!this.value.length||u!=null&&this.from>=u)return"";const a=this.value[0];return this.value=this.value.slice(1),a}shift(){if(!this.value.length)return"";const u=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),u}}class cn{constructor(u){this._value="",this._update({...cn.DEFAULTS,...u}),this._initialized=!0}updateOptions(u){this.optionsIsChanged(u)&&this.withValueRefresh(this._update.bind(this,u))}_update(u){Object.assign(this,u)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(u){this._value=u._value}reset(){this._value=""}get value(){return this._value}set value(u){this.resolve(u,{input:!0})}resolve(u,a){a===void 0&&(a={input:!0}),this.reset(),this.append(u,a,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(u){this.resolve(u,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(u){this.format?this.value=this.format(u,this):this.unmaskedValue=String(u)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(u){this.resolve(u,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(u,a){return u}totalInputPositions(u,a){return u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),Math.min(this.displayValue.length,a-u)}extractInput(u,a,t){return u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),this.displayValue.slice(u,a)}extractTail(u,a){return u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),new Lo(this.extractInput(u,a),u)}appendTail(u){return u1(u)&&(u=new Lo(String(u))),u.appendTo(this)}_appendCharRaw(u,a){return u?(this._value+=u,new e0({inserted:u,rawInserted:u})):new e0}_appendChar(u,a,t){a===void 0&&(a={});const n=this.state;let r;if([u,r]=this.doPrepareChar(u,a),u&&(r=r.aggregate(this._appendCharRaw(u,a)),!r.rawInserted&&this.autofix==="pad")){const i=this.state;this.state=n;let o=this.pad(a);const s=this._appendCharRaw(u,a);o=o.aggregate(s),s.rawInserted||o.equals(r)?r=o:this.state=i}if(r.inserted){let i,o=this.doValidate(a)!==!1;if(o&&t!=null){const s=this.state;if(this.overwrite===!0){i=t.state;for(let E=0;E<r.rawInserted.length;++E)t.unshift(this.displayValue.length-r.tailShift)}let l=this.appendTail(t);if(o=l.rawInserted.length===t.toString().length,!(o&&l.inserted)&&this.overwrite==="shift"){this.state=s,i=t.state;for(let E=0;E<r.rawInserted.length;++E)t.shift();l=this.appendTail(t),o=l.rawInserted.length===t.toString().length}o&&l.inserted&&(this.state=s)}o||(r=new e0,this.state=n,t&&i&&(t.state=i))}return r}_appendPlaceholder(){return new e0}_appendEager(){return new e0}append(u,a,t){if(!u1(u))throw new Error("value should be string");const n=u1(t)?new Lo(String(t)):t;a!=null&&a.tail&&(a._beforeTailState=this.state);let r;[u,r]=this.doPrepare(u,a);for(let i=0;i<u.length;++i){const o=this._appendChar(u[i],a,n);if(!o.rawInserted&&!this.doSkipInvalid(u[i],a,n))break;r.aggregate(o)}return(this.eager===!0||this.eager==="append")&&a!=null&&a.input&&u&&r.aggregate(this._appendEager()),n!=null&&(r.tailShift+=this.appendTail(n).tailShift),r}remove(u,a){return u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),this._value=this.displayValue.slice(0,u)+this.displayValue.slice(a),new e0}withValueRefresh(u){if(this._refreshing||!this._initialized)return u();this._refreshing=!0;const a=this.rawInputValue,t=this.value,n=u();return this.rawInputValue=a,this.value&&this.value!==t&&t.indexOf(this.value)===0&&(this.append(t.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,n}runIsolated(u){if(this._isolated||!this._initialized)return u(this);this._isolated=!0;const a=this.state,t=u(this);return this.state=a,delete this._isolated,t}doSkipInvalid(u,a,t){return!!this.skipInvalid}doPrepare(u,a){return a===void 0&&(a={}),e0.normalize(this.prepare?this.prepare(u,this,a):u)}doPrepareChar(u,a){return a===void 0&&(a={}),e0.normalize(this.prepareChar?this.prepareChar(u,this,a):u)}doValidate(u){return(!this.validate||this.validate(this.value,this,u))&&(!this.parent||this.parent.doValidate(u))}doCommit(){this.commit&&this.commit(this.value,this)}splice(u,a,t,n,r){t===void 0&&(t=""),n===void 0&&(n=Ae.NONE),r===void 0&&(r={input:!0});const i=u+a,o=this.extractTail(i),s=this.eager===!0||this.eager==="remove";let l;s&&(n=vku(n),l=this.extractInput(0,i,{raw:!0}));let E=u;const c=new e0;if(n!==Ae.NONE&&(E=this.nearestInputPos(u,a>1&&u!==0&&!s?Ae.NONE:n),c.tailShift=E-u),c.aggregate(this.remove(E)),s&&n!==Ae.NONE&&l===this.rawInputValue)if(n===Ae.FORCE_LEFT){let D;for(;l===this.rawInputValue&&(D=this.displayValue.length);)c.aggregate(new e0({tailShift:-1})).aggregate(this.remove(D-1))}else n===Ae.FORCE_RIGHT&&o.unshift();return c.aggregate(this.append(t,r,o))}maskEquals(u){return this.mask===u}optionsIsChanged(u){return!sp(this,u)}typedValueEquals(u){const a=this.typedValue;return u===a||cn.EMPTY_VALUES.includes(u)&&cn.EMPTY_VALUES.includes(a)||(this.format?this.format(u,this)===this.format(this.typedValue,this):!1)}pad(u){return new e0}}cn.DEFAULTS={skipInvalid:!0};cn.EMPTY_VALUES=[void 0,null,""];$e.Masked=cn;class F4{constructor(u,a){u===void 0&&(u=[]),a===void 0&&(a=0),this.chunks=u,this.from=a}toString(){return this.chunks.map(String).join("")}extend(u){if(!String(u))return;u=u1(u)?new Lo(String(u)):u;const a=this.chunks[this.chunks.length-1],t=a&&(a.stop===u.stop||u.stop==null)&&u.from===a.from+a.toString().length;if(u instanceof Lo)t?a.extend(u.toString()):this.chunks.push(u);else if(u instanceof F4){if(u.stop==null){let n;for(;u.chunks.length&&u.chunks[0].stop==null;)n=u.chunks.shift(),n.from+=u.from,this.extend(n)}u.toString()&&(u.stop=u.blockIndex,this.chunks.push(u))}}appendTo(u){if(!(u instanceof $e.MaskedPattern))return new Lo(this.toString()).appendTo(u);const a=new e0;for(let t=0;t<this.chunks.length;++t){const n=this.chunks[t],r=u._mapPosToBlock(u.displayValue.length),i=n.stop;let o;if(i!=null&&(!r||r.index<=i)&&((n instanceof F4||u._stops.indexOf(i)>=0)&&a.aggregate(u._appendPlaceholder(i)),o=n instanceof F4&&u._blocks[i]),o){const s=o.appendTail(n);a.aggregate(s);const l=n.toString().slice(s.rawInserted.length);l&&a.aggregate(u.append(l,{tail:!0}))}else a.aggregate(u.append(n.toString(),{tail:!0}))}return a}get state(){return{chunks:this.chunks.map(u=>u.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(u){const{chunks:a,...t}=u;Object.assign(this,t),this.chunks=a.map(n=>{const r="chunks"in n?new F4:new Lo;return r.state=n,r})}unshift(u){if(!this.chunks.length||u!=null&&this.from>=u)return"";const a=u!=null?u-this.from:u;let t=0;for(;t<this.chunks.length;){const n=this.chunks[t],r=n.unshift(a);if(n.toString()){if(!r)break;++t}else this.chunks.splice(t,1);if(r)return r}return""}shift(){if(!this.chunks.length)return"";let u=this.chunks.length-1;for(;0<=u;){const a=this.chunks[u],t=a.shift();if(a.toString()){if(!t)break;--u}else this.chunks.splice(u,1);if(t)return t}return""}}class Sku{constructor(u,a){this.masked=u,this._log=[];const{offset:t,index:n}=u._mapPosToBlock(a)||(a<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=t,this.index=n,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(u){Object.assign(this,u)}pushState(){this._log.push(this.state)}popState(){const u=this._log.pop();return u&&(this.state=u),u}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(u){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((a=this.block)==null?void 0:a.displayValue.length)||0){var a;if(u())return this.ok=!0}return this.ok=!1}_pushRight(u){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(u())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Ae.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Ae.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Ae.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Ae.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Ae.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Ae.NONE),!0})}}class dU{constructor(u){Object.assign(this,u),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(u,a){return u===void 0&&(u=0),a===void 0&&(a=this._value.length),this._value=this._value.slice(0,u)+this._value.slice(a),this._value||(this._isRawInput=!1),new e0}nearestInputPos(u,a){a===void 0&&(a=Ae.NONE);const t=0,n=this._value.length;switch(a){case Ae.LEFT:case Ae.FORCE_LEFT:return t;case Ae.NONE:case Ae.RIGHT:case Ae.FORCE_RIGHT:default:return n}}totalInputPositions(u,a){return u===void 0&&(u=0),a===void 0&&(a=this._value.length),this._isRawInput?a-u:0}extractInput(u,a,t){return u===void 0&&(u=0),a===void 0&&(a=this._value.length),t===void 0&&(t={}),t.raw&&this._isRawInput&&this._value.slice(u,a)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(u,a){if(a===void 0&&(a={}),this.isFilled)return new e0;const t=this.eager===!0||this.eager==="append",r=this.char===u&&(this.isUnmasking||a.input||a.raw)&&(!a.raw||!t)&&!a.tail,i=new e0({inserted:this.char,rawInserted:r?this.char:""});return this._value=this.char,this._isRawInput=r&&(a.raw||a.input),i}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const u=new e0;return this.isFilled||(this._value=u.inserted=this.char),u}extractTail(){return new Lo("")}appendTail(u){return u1(u)&&(u=new Lo(String(u))),u.appendTo(this)}append(u,a,t){const n=this._appendChar(u[0],a);return t!=null&&(n.tailShift+=this.appendTail(t).tailShift),n}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(u){this._value=u._value,this._isRawInput=!!u._rawInputValue}pad(u){return this._appendPlaceholder()}}class lp{constructor(u){const{parent:a,isOptional:t,placeholderChar:n,displayChar:r,lazy:i,eager:o,...s}=u;this.masked=Us(s),Object.assign(this,{parent:a,isOptional:t,placeholderChar:n,displayChar:r,lazy:i,eager:o})}reset(){this.isFilled=!1,this.masked.reset()}remove(u,a){return u===void 0&&(u=0),a===void 0&&(a=this.value.length),u===0&&a>=1?(this.isFilled=!1,this.masked.remove(u,a)):new e0}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(u,a){if(a===void 0&&(a={}),this.isFilled)return new e0;const t=this.masked.state;let n=this.masked._appendChar(u,this.currentMaskFlags(a));return n.inserted&&this.doValidate(a)===!1&&(n=new e0,this.masked.state=t),!n.inserted&&!this.isOptional&&!this.lazy&&!a.input&&(n.inserted=this.placeholderChar),n.skip=!n.inserted&&!this.isOptional,this.isFilled=!!n.inserted,n}append(u,a,t){return this.masked.append(u,this.currentMaskFlags(a),t)}_appendPlaceholder(){return this.isFilled||this.isOptional?new e0:(this.isFilled=!0,new e0({inserted:this.placeholderChar}))}_appendEager(){return new e0}extractTail(u,a){return this.masked.extractTail(u,a)}appendTail(u){return this.masked.appendTail(u)}extractInput(u,a,t){return u===void 0&&(u=0),a===void 0&&(a=this.value.length),this.masked.extractInput(u,a,t)}nearestInputPos(u,a){a===void 0&&(a=Ae.NONE);const t=0,n=this.value.length,r=Math.min(Math.max(u,t),n);switch(a){case Ae.LEFT:case Ae.FORCE_LEFT:return this.isComplete?r:t;case Ae.RIGHT:case Ae.FORCE_RIGHT:return this.isComplete?r:n;case Ae.NONE:default:return r}}totalInputPositions(u,a){return u===void 0&&(u=0),a===void 0&&(a=this.value.length),this.value.slice(u,a).length}doValidate(u){return this.masked.doValidate(this.currentMaskFlags(u))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(u)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(u){this.masked.state=u.masked,this.isFilled=u.isFilled}currentMaskFlags(u){var a;return{...u,_beforeTailState:(u==null||(a=u._beforeTailState)==null?void 0:a.masked)||(u==null?void 0:u._beforeTailState)}}pad(u){return new e0}}lp.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class zku extends cn{updateOptions(u){super.updateOptions(u)}_update(u){const a=u.mask;a&&(u.validate=t=>t.search(a)>=0),super._update(u)}}$e.MaskedRegExp=zku;class dn extends cn{constructor(u){super({...dn.DEFAULTS,...u,definitions:Object.assign({},lp.DEFAULT_DEFINITIONS,u==null?void 0:u.definitions)})}updateOptions(u){super.updateOptions(u)}_update(u){u.definitions=Object.assign({},this.definitions,u.definitions),super._update(u),this._rebuildMask()}_rebuildMask(){const u=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const a=this.mask;if(!a||!u)return;let t=!1,n=!1;for(let r=0;r<a.length;++r){if(this.blocks){const l=a.slice(r),E=Object.keys(this.blocks).filter(D=>l.indexOf(D)===0);E.sort((D,h)=>h.length-D.length);const c=E[0];if(c){const{expose:D,repeat:h,...m}=eh(this.blocks[c]),x={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...m,repeat:h,parent:this},p=h!=null?new $e.RepeatBlock(x):Us(x);p&&(this._blocks.push(p),D&&(this.exposeBlock=p),this._maskedBlocks[c]||(this._maskedBlocks[c]=[]),this._maskedBlocks[c].push(this._blocks.length-1)),r+=c.length-1;continue}}let i=a[r],o=i in u;if(i===dn.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(i==="{"||i==="}"){t=!t;continue}if(i==="["||i==="]"){n=!n;continue}if(i===dn.ESCAPE_CHAR){if(++r,i=a[r],!i)break;o=!1}const s=o?new lp({isOptional:n,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...eh(u[i]),parent:this}):new dU({char:i,eager:this.eager,isUnmasking:t});this._blocks.push(s)}}get state(){return{...super.state,_blocks:this._blocks.map(u=>u.state)}}set state(u){if(!u){this.reset();return}const{_blocks:a,...t}=u;this._blocks.forEach((n,r)=>n.state=a[r]),super.state=t}reset(){super.reset(),this._blocks.forEach(u=>u.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(u=>u.isComplete)}get isFilled(){return this._blocks.every(u=>u.isFilled)}get isFixed(){return this._blocks.every(u=>u.isFixed)}get isOptional(){return this._blocks.every(u=>u.isOptional)}doCommit(){this._blocks.forEach(u=>u.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((u,a)=>u+=a.unmaskedValue,"")}set unmaskedValue(u){if(this.exposeBlock){const a=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=u,this.appendTail(a),this.doCommit()}else super.unmaskedValue=u}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((u,a)=>u+=a.value,"")}set value(u){if(this.exposeBlock){const a=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=u,this.appendTail(a),this.doCommit()}else super.value=u}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(u){if(this.exposeBlock){const a=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=u,this.appendTail(a),this.doCommit()}else super.typedValue=u}get displayValue(){return this._blocks.reduce((u,a)=>u+=a.displayValue,"")}appendTail(u){return super.appendTail(u).aggregate(this._appendPlaceholder())}_appendEager(){var u;const a=new e0;let t=(u=this._mapPosToBlock(this.displayValue.length))==null?void 0:u.index;if(t==null)return a;this._blocks[t].isFilled&&++t;for(let n=t;n<this._blocks.length;++n){const r=this._blocks[n]._appendEager();if(!r.inserted)break;a.aggregate(r)}return a}_appendCharRaw(u,a){a===void 0&&(a={});const t=this._mapPosToBlock(this.displayValue.length),n=new e0;if(!t)return n;for(let i=t.index,o;o=this._blocks[i];++i){var r;const s=o._appendChar(u,{...a,_beforeTailState:(r=a._beforeTailState)==null||(r=r._blocks)==null?void 0:r[i]});if(n.aggregate(s),s.consumed)break}return n}extractTail(u,a){u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length);const t=new F4;return u===a||this._forEachBlocksInRange(u,a,(n,r,i,o)=>{const s=n.extractTail(i,o);s.stop=this._findStopBefore(r),s.from=this._blockStartPos(r),s instanceof F4&&(s.blockIndex=r),t.extend(s)}),t}extractInput(u,a,t){if(u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),t===void 0&&(t={}),u===a)return"";let n="";return this._forEachBlocksInRange(u,a,(r,i,o,s)=>{n+=r.extractInput(o,s,t)}),n}_findStopBefore(u){let a;for(let t=0;t<this._stops.length;++t){const n=this._stops[t];if(n<=u)a=n;else break}return a}_appendPlaceholder(u){const a=new e0;if(this.lazy&&u==null)return a;const t=this._mapPosToBlock(this.displayValue.length);if(!t)return a;const n=t.index,r=u??this._blocks.length;return this._blocks.slice(n,r).forEach(i=>{if(!i.lazy||u!=null){var o;a.aggregate(i._appendPlaceholder((o=i._blocks)==null?void 0:o.length))}}),a}_mapPosToBlock(u){let a="";for(let t=0;t<this._blocks.length;++t){const n=this._blocks[t],r=a.length;if(a+=n.displayValue,u<=a.length)return{index:t,offset:u-r}}}_blockStartPos(u){return this._blocks.slice(0,u).reduce((a,t)=>a+=t.displayValue.length,0)}_forEachBlocksInRange(u,a,t){a===void 0&&(a=this.displayValue.length);const n=this._mapPosToBlock(u);if(n){const r=this._mapPosToBlock(a),i=r&&n.index===r.index,o=n.offset,s=r&&i?r.offset:this._blocks[n.index].displayValue.length;if(t(this._blocks[n.index],n.index,o,s),r&&!i){for(let l=n.index+1;l<r.index;++l)t(this._blocks[l],l,0,this._blocks[l].displayValue.length);t(this._blocks[r.index],r.index,0,r.offset)}}}remove(u,a){u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length);const t=super.remove(u,a);return this._forEachBlocksInRange(u,a,(n,r,i,o)=>{t.aggregate(n.remove(i,o))}),t}nearestInputPos(u,a){if(a===void 0&&(a=Ae.NONE),!this._blocks.length)return 0;const t=new Sku(this,u);if(a===Ae.NONE)return t.pushRightBeforeInput()||(t.popState(),t.pushLeftBeforeInput())?t.pos:this.displayValue.length;if(a===Ae.LEFT||a===Ae.FORCE_LEFT){if(a===Ae.LEFT){if(t.pushRightBeforeFilled(),t.ok&&t.pos===u)return u;t.popState()}if(t.pushLeftBeforeInput(),t.pushLeftBeforeRequired(),t.pushLeftBeforeFilled(),a===Ae.LEFT){if(t.pushRightBeforeInput(),t.pushRightBeforeRequired(),t.ok&&t.pos<=u||(t.popState(),t.ok&&t.pos<=u))return t.pos;t.popState()}return t.ok?t.pos:a===Ae.FORCE_LEFT?0:(t.popState(),t.ok||(t.popState(),t.ok)?t.pos:0)}return a===Ae.RIGHT||a===Ae.FORCE_RIGHT?(t.pushRightBeforeInput(),t.pushRightBeforeRequired(),t.pushRightBeforeFilled()?t.pos:a===Ae.FORCE_RIGHT?this.displayValue.length:(t.popState(),t.ok||(t.popState(),t.ok)?t.pos:this.nearestInputPos(u,Ae.LEFT))):u}totalInputPositions(u,a){u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length);let t=0;return this._forEachBlocksInRange(u,a,(n,r,i,o)=>{t+=n.totalInputPositions(i,o)}),t}maskedBlock(u){return this.maskedBlocks(u)[0]}maskedBlocks(u){const a=this._maskedBlocks[u];return a?a.map(t=>this._blocks[t]):[]}pad(u){const a=new e0;return this._forEachBlocksInRange(0,this.displayValue.length,t=>a.aggregate(t.pad(u))),a}}dn.DEFAULTS={...cn.DEFAULTS,lazy:!0,placeholderChar:"_"};dn.STOP_CHAR="`";dn.ESCAPE_CHAR="\\";dn.InputDefinition=lp;dn.FixedDefinition=dU;$e.MaskedPattern=dn;class V6 extends dn{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(u){super(u)}updateOptions(u){super.updateOptions(u)}_update(u){const{to:a=this.to||0,from:t=this.from||0,maxLength:n=this.maxLength||0,autofix:r=this.autofix,...i}=u;this.to=a,this.from=t,this.maxLength=Math.max(String(a).length,n),this.autofix=r;const o=String(this.from).padStart(this.maxLength,"0"),s=String(this.to).padStart(this.maxLength,"0");let l=0;for(;l<s.length&&s[l]===o[l];)++l;i.mask=s.slice(0,l).replace(/0/g,"\\0")+"0".repeat(this.maxLength-l),super._update(i)}get isComplete(){return super.isComplete&&!!this.value}boundaries(u){let a="",t="";const[,n,r]=u.match(/^(\D*)(\d*)(\D*)/)||[];return r&&(a="0".repeat(n.length)+r,t="9".repeat(n.length)+r),a=a.padEnd(this.maxLength,"0"),t=t.padEnd(this.maxLength,"9"),[a,t]}doPrepareChar(u,a){a===void 0&&(a={});let t;return[u,t]=super.doPrepareChar(u.replace(/\D/g,""),a),u||(t.skip=!this.isComplete),[u,t]}_appendCharRaw(u,a){if(a===void 0&&(a={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(u,a);const t=String(this.from).padStart(this.maxLength,"0"),n=String(this.to).padStart(this.maxLength,"0"),[r,i]=this.boundaries(this.value+u);return Number(i)<this.from?super._appendCharRaw(t[this.value.length],a):Number(r)>this.to?!a.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(t[this.value.length],a).aggregate(this._appendCharRaw(u,a)):super._appendCharRaw(n[this.value.length],a):super._appendCharRaw(u,a)}doValidate(u){const a=this.value;if(a.search(/[^0]/)===-1&&a.length<=this._matchFrom)return!0;const[n,r]=this.boundaries(a);return this.from<=Number(r)&&Number(n)<=this.to&&super.doValidate(u)}pad(u){const a=new e0;if(this.value.length===this.maxLength)return a;const t=this.value,n=this.maxLength-this.value.length;if(n){this.reset();for(let r=0;r<n;++r)a.aggregate(super._appendCharRaw("0",u));t.split("").forEach(r=>this._appendCharRaw(r))}return a}}$e.MaskedRange=V6;const Oku="d{.}`m{.}`Y";class Bs extends dn{static extractPatternOptions(u){const{mask:a,pattern:t,...n}=u;return{...n,mask:u1(a)?a:t}}constructor(u){super(Bs.extractPatternOptions({...Bs.DEFAULTS,...u}))}updateOptions(u){super.updateOptions(u)}_update(u){const{mask:a,pattern:t,blocks:n,...r}={...Bs.DEFAULTS,...u},i=Object.assign({},Bs.GET_DEFAULT_BLOCKS());u.min&&(i.Y.from=u.min.getFullYear()),u.max&&(i.Y.to=u.max.getFullYear()),u.min&&u.max&&i.Y.from===i.Y.to&&(i.m.from=u.min.getMonth()+1,i.m.to=u.max.getMonth()+1,i.m.from===i.m.to&&(i.d.from=u.min.getDate(),i.d.to=u.max.getDate())),Object.assign(i,this.blocks,n),super._update({...r,mask:u1(a)?a:t,blocks:i})}doValidate(u){const a=this.date;return super.doValidate(u)&&(!this.isComplete||this.isDateExist(this.value)&&a!=null&&(this.min==null||this.min<=a)&&(this.max==null||a<=this.max))}isDateExist(u){return this.format(this.parse(u,this),this).indexOf(u)>=0}get date(){return this.typedValue}set date(u){this.typedValue=u}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(u){super.typedValue=u}maskEquals(u){return u===Date||super.maskEquals(u)}optionsIsChanged(u){return super.optionsIsChanged(Bs.extractPatternOptions(u))}}Bs.GET_DEFAULT_BLOCKS=()=>({d:{mask:V6,from:1,to:31,maxLength:2},m:{mask:V6,from:1,to:12,maxLength:2},Y:{mask:V6,from:1900,to:9999}});Bs.DEFAULTS={...dn.DEFAULTS,mask:Date,pattern:Oku,format:(e,u)=>{if(!e)return"";const a=String(e.getDate()).padStart(2,"0"),t=String(e.getMonth()+1).padStart(2,"0"),n=e.getFullYear();return[a,t,n].join(".")},parse:(e,u)=>{const[a,t,n]=e.split(".").map(Number);return new Date(n,t-1,a)}};$e.MaskedDate=Bs;class P2 extends cn{constructor(u){super({...P2.DEFAULTS,...u}),this.currentMask=void 0}updateOptions(u){super.updateOptions(u)}_update(u){super._update(u),"mask"in u&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(u.mask)?u.mask.map(a=>{const{expose:t,...n}=eh(a),r=Us({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...n});return t&&(this.exposeMask=r),r}):[])}_appendCharRaw(u,a){a===void 0&&(a={});const t=this._applyDispatch(u,a);return this.currentMask&&t.aggregate(this.currentMask._appendChar(u,this.currentMaskFlags(a))),t}_applyDispatch(u,a,t){u===void 0&&(u=""),a===void 0&&(a={}),t===void 0&&(t="");const n=a.tail&&a._beforeTailState!=null?a._beforeTailState._value:this.value,r=this.rawInputValue,i=a.tail&&a._beforeTailState!=null?a._beforeTailState._rawInputValue:r,o=r.slice(i.length),s=this.currentMask,l=new e0,E=s==null?void 0:s.state;return this.currentMask=this.doDispatch(u,{...a},t),this.currentMask&&(this.currentMask!==s?(this.currentMask.reset(),i&&(this.currentMask.append(i,{raw:!0}),l.tailShift=this.currentMask.value.length-n.length),o&&(l.tailShift+=this.currentMask.append(o,{raw:!0,tail:!0}).tailShift)):E&&(this.currentMask.state=E)),l}_appendPlaceholder(){const u=this._applyDispatch();return this.currentMask&&u.aggregate(this.currentMask._appendPlaceholder()),u}_appendEager(){const u=this._applyDispatch();return this.currentMask&&u.aggregate(this.currentMask._appendEager()),u}appendTail(u){const a=new e0;return u&&a.aggregate(this._applyDispatch("",{},u)),a.aggregate(this.currentMask?this.currentMask.appendTail(u):super.appendTail(u))}currentMaskFlags(u){var a,t;return{...u,_beforeTailState:((a=u._beforeTailState)==null?void 0:a.currentMaskRef)===this.currentMask&&((t=u._beforeTailState)==null?void 0:t.currentMask)||u._beforeTailState}}doDispatch(u,a,t){return a===void 0&&(a={}),t===void 0&&(t=""),this.dispatch(u,this,a,t)}doValidate(u){return super.doValidate(u)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(u)))}doPrepare(u,a){a===void 0&&(a={});let[t,n]=super.doPrepare(u,a);if(this.currentMask){let r;[t,r]=super.doPrepare(t,this.currentMaskFlags(a)),n=n.aggregate(r)}return[t,n]}doPrepareChar(u,a){a===void 0&&(a={});let[t,n]=super.doPrepareChar(u,a);if(this.currentMask){let r;[t,r]=super.doPrepareChar(t,this.currentMaskFlags(a)),n=n.aggregate(r)}return[t,n]}reset(){var u;(u=this.currentMask)==null||u.reset(),this.compiledMasks.forEach(a=>a.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(u){this.exposeMask?(this.exposeMask.value=u,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=u}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(u){this.exposeMask?(this.exposeMask.unmaskedValue=u,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=u}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(u){if(this.exposeMask){this.exposeMask.typedValue=u,this.currentMask=this.exposeMask,this._applyDispatch();return}let a=String(u);this.currentMask&&(this.currentMask.typedValue=u,a=this.currentMask.unmaskedValue),this.unmaskedValue=a}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var u;return!!((u=this.currentMask)!=null&&u.isComplete)}get isFilled(){var u;return!!((u=this.currentMask)!=null&&u.isFilled)}remove(u,a){const t=new e0;return this.currentMask&&t.aggregate(this.currentMask.remove(u,a)).aggregate(this._applyDispatch()),t}get state(){var u;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(a=>a.state),currentMaskRef:this.currentMask,currentMask:(u=this.currentMask)==null?void 0:u.state}}set state(u){const{compiledMasks:a,currentMaskRef:t,currentMask:n,...r}=u;a&&this.compiledMasks.forEach((i,o)=>i.state=a[o]),t!=null&&(this.currentMask=t,this.currentMask.state=n),super.state=r}extractInput(u,a,t){return this.currentMask?this.currentMask.extractInput(u,a,t):""}extractTail(u,a){return this.currentMask?this.currentMask.extractTail(u,a):super.extractTail(u,a)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(u,a){return this.currentMask?this.currentMask.nearestInputPos(u,a):super.nearestInputPos(u,a)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(u){this._overwrite=u}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(u){this._eager=u}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(u){this._skipInvalid=u}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(u){this._autofix=u}maskEquals(u){return Array.isArray(u)?this.compiledMasks.every((a,t)=>{if(!u[t])return;const{mask:n,...r}=u[t];return sp(a,r)&&a.maskEquals(n)}):super.maskEquals(u)}typedValueEquals(u){var a;return!!((a=this.currentMask)!=null&&a.typedValueEquals(u))}}P2.DEFAULTS={...cn.DEFAULTS,dispatch:(e,u,a,t)=>{if(!u.compiledMasks.length)return;const n=u.rawInputValue,r=u.compiledMasks.map((i,o)=>{const s=u.currentMask===i,l=s?i.displayValue.length:i.nearestInputPos(i.displayValue.length,Ae.FORCE_LEFT);return i.rawInputValue!==n?(i.reset(),i.append(n,{raw:!0})):s||i.remove(l),i.append(e,u.currentMaskFlags(a)),i.appendTail(t),{index:o,weight:i.rawInputValue.length,totalInputPositions:i.totalInputPositions(0,Math.max(l,i.nearestInputPos(i.displayValue.length,Ae.FORCE_LEFT)))}});return r.sort((i,o)=>o.weight-i.weight||o.totalInputPositions-i.totalInputPositions),u.compiledMasks[r[0].index]}};$e.MaskedDynamic=P2;class j2 extends dn{constructor(u){super({...j2.DEFAULTS,...u})}updateOptions(u){super.updateOptions(u)}_update(u){const{enum:a,...t}=u;if(a){const n=a.map(o=>o.length),r=Math.min(...n),i=Math.max(...n)-r;t.mask="*".repeat(r),i&&(t.mask+="["+"*".repeat(i)+"]"),this.enum=a}super._update(t)}_appendCharRaw(u,a){a===void 0&&(a={});const t=Math.min(this.nearestInputPos(0,Ae.FORCE_RIGHT),this.value.length),n=this.enum.filter(r=>this.matchValue(r,this.unmaskedValue+u,t));if(n.length){n.length===1&&this._forEachBlocksInRange(0,this.value.length,(i,o)=>{const s=n[0][o];o>=this.value.length||s===i.value||(i.reset(),i._appendChar(s,a))});const r=super._appendCharRaw(n[0][this.value.length],a);return n.length===1&&n[0].slice(this.unmaskedValue.length).split("").forEach(i=>r.aggregate(super._appendCharRaw(i))),r}return new e0({skip:!this.isComplete})}extractTail(u,a){return u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),new Lo("",u)}remove(u,a){if(u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),u===a)return new e0;const t=Math.min(super.nearestInputPos(0,Ae.FORCE_RIGHT),this.value.length);let n;for(n=u;n>=0&&!(this.enum.filter(o=>this.matchValue(o,this.value.slice(t,n),t)).length>1);--n);const r=super.remove(n,a);return r.tailShift+=n-u,r}get isComplete(){return this.enum.indexOf(this.value)>=0}}j2.DEFAULTS={...dn.DEFAULTS,matchValue:(e,u,a)=>e.indexOf(u,a)===a};$e.MaskedEnum=j2;class wku extends cn{updateOptions(u){super.updateOptions(u)}_update(u){super._update({...u,validate:u.mask})}}$e.MaskedFunction=wku;var DU;class hr extends cn{constructor(u){super({...hr.DEFAULTS,...u})}updateOptions(u){super.updateOptions(u)}_update(u){super._update(u),this._updateRegExps()}_updateRegExps(){const u="^"+(this.allowNegative?"[+|\\-]?":""),a="\\d*",t=(this.scale?"("+Kk(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(u+a+t),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Kk).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Kk(this.thousandsSeparator),"g")}_removeThousandsSeparators(u){return u.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(u){const a=u.split(this.radix);return a[0]=a[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),a.join(this.radix)}doPrepareChar(u,a){a===void 0&&(a={});const[t,n]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(a.input&&a.raw||!a.input&&!a.raw)?u.replace(this._mapToRadixRegExp,this.radix):u),a);return u&&!t&&(n.skip=!0),t&&!this.allowPositive&&!this.value&&t!=="-"&&n.aggregate(this._appendChar("-")),[t,n]}_separatorsCount(u,a){a===void 0&&(a=!1);let t=0;for(let n=0;n<u;++n)this._value.indexOf(this.thousandsSeparator,n)===n&&(++t,a&&(u+=this.thousandsSeparator.length));return t}_separatorsCountFromSlice(u){return u===void 0&&(u=this._value),this._separatorsCount(this._removeThousandsSeparators(u).length,!0)}extractInput(u,a,t){return u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),[u,a]=this._adjustRangeWithSeparators(u,a),this._removeThousandsSeparators(super.extractInput(u,a,t))}_appendCharRaw(u,a){a===void 0&&(a={});const t=a.tail&&a._beforeTailState?a._beforeTailState._value:this._value,n=this._separatorsCountFromSlice(t);this._value=this._removeThousandsSeparators(this.value);const r=this._value;this._value+=u;const i=this.number;let o=!isNaN(i),s=!1;if(o){let D;this.min!=null&&this.min<0&&this.number<this.min&&(D=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(D=this.max),D!=null&&(this.autofix?(this._value=this.format(D,this).replace(hr.UNMASKED_RADIX,this.radix),s||(s=r===this._value&&!a.tail)):o=!1),o&&(o=!!this._value.match(this._numberRegExp))}let l;o?l=new e0({inserted:this._value.slice(r.length),rawInserted:s?"":u,skip:s}):(this._value=r,l=new e0),this._value=this._insertThousandsSeparators(this._value);const E=a.tail&&a._beforeTailState?a._beforeTailState._value:this._value,c=this._separatorsCountFromSlice(E);return l.tailShift+=(c-n)*this.thousandsSeparator.length,l}_findSeparatorAround(u){if(this.thousandsSeparator){const a=u-this.thousandsSeparator.length+1,t=this.value.indexOf(this.thousandsSeparator,a);if(t<=u)return t}return-1}_adjustRangeWithSeparators(u,a){const t=this._findSeparatorAround(u);t>=0&&(u=t);const n=this._findSeparatorAround(a);return n>=0&&(a=n+this.thousandsSeparator.length),[u,a]}remove(u,a){u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),[u,a]=this._adjustRangeWithSeparators(u,a);const t=this.value.slice(0,u),n=this.value.slice(a),r=this._separatorsCount(t.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(t+n));const i=this._separatorsCountFromSlice(t);return new e0({tailShift:(i-r)*this.thousandsSeparator.length})}nearestInputPos(u,a){if(!this.thousandsSeparator)return u;switch(a){case Ae.NONE:case Ae.LEFT:case Ae.FORCE_LEFT:{const t=this._findSeparatorAround(u-1);if(t>=0){const n=t+this.thousandsSeparator.length;if(u<n||this.value.length<=n||a===Ae.FORCE_LEFT)return t}break}case Ae.RIGHT:case Ae.FORCE_RIGHT:{const t=this._findSeparatorAround(u);if(t>=0)return t+this.thousandsSeparator.length}}return u}doCommit(){if(this.value){const u=this.number;let a=u;this.min!=null&&(a=Math.max(a,this.min)),this.max!=null&&(a=Math.min(a,this.max)),a!==u&&(this.unmaskedValue=this.format(a,this));let t=this.value;this.normalizeZeros&&(t=this._normalizeZeros(t)),this.padFractionalZeros&&this.scale>0&&(t=this._padFractionalZeros(t)),this._value=t}super.doCommit()}_normalizeZeros(u){const a=this._removeThousandsSeparators(u).split(this.radix);return a[0]=a[0].replace(/^(\D*)(0*)(\d*)/,(t,n,r,i)=>n+i),u.length&&!/\d$/.test(a[0])&&(a[0]=a[0]+"0"),a.length>1&&(a[1]=a[1].replace(/0*$/,""),a[1].length||(a.length=1)),this._insertThousandsSeparators(a.join(this.radix))}_padFractionalZeros(u){if(!u)return u;const a=u.split(this.radix);return a.length<2&&a.push(""),a[1]=a[1].padEnd(this.scale,"0"),a.join(this.radix)}doSkipInvalid(u,a,t){a===void 0&&(a={});const n=this.scale===0&&u!==this.thousandsSeparator&&(u===this.radix||u===hr.UNMASKED_RADIX||this.mapToRadix.includes(u));return super.doSkipInvalid(u,a,t)&&!n}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,hr.UNMASKED_RADIX)}set unmaskedValue(u){super.unmaskedValue=u}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(u){this.rawInputValue=this.format(u,this).replace(hr.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(u){this.typedValue=u}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(u){return(super.typedValueEquals(u)||hr.EMPTY_VALUES.includes(u)&&hr.EMPTY_VALUES.includes(this.typedValue))&&!(u===0&&this.value==="")}}DU=hr;hr.UNMASKED_RADIX=".";hr.EMPTY_VALUES=[...cn.EMPTY_VALUES,0];hr.DEFAULTS={...cn.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[DU.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:e=>e.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})};$e.MaskedNumber=hr;const hb={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function hU(e,u,a){u===void 0&&(u=hb.MASKED),a===void 0&&(a=hb.MASKED);const t=Us(e);return n=>t.runIsolated(r=>(r[u]=n,r[a]))}function Mku(e,u,a,t){return hU(u,a,t)(e)}$e.PIPE_TYPE=hb;$e.createPipe=hU;$e.pipe=Mku;class Tku extends dn{get repeatFrom(){var u;return(u=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?u:0}get repeatTo(){var u;return(u=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?u:1/0}constructor(u){super(u)}updateOptions(u){super.updateOptions(u)}_update(u){var a,t,n;const{repeat:r,...i}=eh(u);this._blockOpts=Object.assign({},this._blockOpts,i);const o=Us(this._blockOpts);this.repeat=(a=(t=r??o.repeat)!=null?t:this.repeat)!=null?a:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((n=this._blocks)==null?void 0:n.length)||0,this.repeatFrom)),blocks:{m:o},eager:o.eager,overwrite:o.overwrite,skipInvalid:o.skipInvalid,lazy:o.lazy,placeholderChar:o.placeholderChar,displayChar:o.displayChar})}_allocateBlock(u){if(u<this._blocks.length)return this._blocks[u];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(Us(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(u,a){a===void 0&&(a={});const t=new e0;for(let s=(n=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?n:Math.max(this._blocks.length-1,0),l,E;l=(i=this._blocks[s])!=null?i:E=!E&&this._allocateBlock(s);++s){var n,r,i,o;const c=l._appendChar(u,{...a,_beforeTailState:(o=a._beforeTailState)==null||(o=o._blocks)==null?void 0:o[s]});if(c.skip&&E){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(t.aggregate(c),c.consumed)break}return t}_trimEmptyTail(u,a){var t,n;u===void 0&&(u=0);const r=Math.max(((t=this._mapPosToBlock(u))==null?void 0:t.index)||0,this.repeatFrom,0);let i;a!=null&&(i=(n=this._mapPosToBlock(a))==null?void 0:n.index),i==null&&(i=this._blocks.length-1);let o=0;for(let s=i;r<=s&&!this._blocks[s].unmaskedValue;--s,++o);o&&(this._blocks.splice(i-o+1,o),this.mask=this.mask.slice(o))}reset(){super.reset(),this._trimEmptyTail()}remove(u,a){u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length);const t=super.remove(u,a);return this._trimEmptyTail(u,a),t}totalInputPositions(u,a){return u===void 0&&(u=0),a==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(u,a)}get state(){return super.state}set state(u){this._blocks.length=u._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=u}}$e.RepeatBlock=Tku;try{globalThis.IMask=$e}catch{}var mU={exports:{}},Pku="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",jku=Pku,Nku=jku;function xU(){}function fU(){}fU.resetWarningCache=xU;var Rku=function(){function e(t,n,r,i,o,s){if(s!==Nku){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}e.isRequired=e;function u(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:u,element:e,elementType:e,instanceOf:u,node:e,objectOf:u,oneOf:u,oneOfType:u,shape:u,exact:u,checkPropTypes:fU,resetWarningCache:xU};return a.PropTypes=a,a};mU.exports=Rku();var pU=mU.exports;const Fe=al(pU),gU={mask:Fe.oneOfType([Fe.array,Fe.func,Fe.string,Fe.instanceOf(RegExp),Fe.oneOf([Date,Number,$e.Masked]),Fe.instanceOf($e.Masked)]),value:Fe.any,unmask:Fe.oneOfType([Fe.bool,Fe.oneOf(["typed"])]),prepare:Fe.func,prepareChar:Fe.func,validate:Fe.func,commit:Fe.func,overwrite:Fe.oneOfType([Fe.bool,Fe.oneOf(["shift"])]),eager:Fe.oneOfType([Fe.bool,Fe.oneOf(["append","remove"])]),skipInvalid:Fe.bool,onAccept:Fe.func,onComplete:Fe.func,placeholderChar:Fe.string,displayChar:Fe.string,lazy:Fe.bool,definitions:Fe.object,blocks:Fe.object,enum:Fe.arrayOf(Fe.string),maxLength:Fe.number,from:Fe.number,to:Fe.number,pattern:Fe.string,format:Fe.func,parse:Fe.func,autofix:Fe.oneOfType([Fe.bool,Fe.oneOf(["pad"])]),radix:Fe.string,thousandsSeparator:Fe.string,mapToRadix:Fe.arrayOf(Fe.string),scale:Fe.number,normalizeZeros:Fe.bool,padFractionalZeros:Fe.bool,min:Fe.oneOfType([Fe.number,Fe.instanceOf(Date)]),max:Fe.oneOfType([Fe.number,Fe.instanceOf(Date)]),dispatch:Fe.func,inputRef:Fe.oneOfType([Fe.func,Fe.shape({current:Fe.object})])},CU=Object.keys(gU).filter(e=>e!=="value"),Lku=["value","unmask","onAccept","onComplete","inputRef"],_ku=CU.filter(e=>Lku.indexOf(e)<0);function Iku(e){var u;const a=(u=class extends nu.Component{constructor(r){super(r),this._inputRef=this._inputRef.bind(this)}componentDidMount(){this.props.mask&&this.initMask()}componentDidUpdate(){const r=this.props,i=this._extractMaskOptionsFromProps(r);if(i.mask)this.maskRef?(this.maskRef.updateOptions(i),"value"in r&&r.value!==void 0&&(this.maskValue=r.value)):this.initMask(i);else if(this.destroyMask(),"value"in r&&r.value!==void 0){var o;(o=this.element)!=null&&o.isContentEditable&&this.element.tagName!=="INPUT"&&this.element.tagName!=="TEXTAREA"?this.element.textContent=r.value:this.element.value=r.value}}componentWillUnmount(){this.destroyMask()}_inputRef(r){this.element=r,this.props.inputRef&&(Object.prototype.hasOwnProperty.call(this.props.inputRef,"current")?this.props.inputRef.current=r:this.props.inputRef(r))}initMask(r){r===void 0&&(r=this._extractMaskOptionsFromProps(this.props)),this.maskRef=$e(this.element,r).on("accept",this._onAccept.bind(this)).on("complete",this._onComplete.bind(this)),"value"in this.props&&this.props.value!==void 0&&(this.maskValue=this.props.value)}destroyMask(){this.maskRef&&(this.maskRef.destroy(),delete this.maskRef)}_extractMaskOptionsFromProps(r){const{...i}=r;return Object.keys(i).filter(o=>_ku.indexOf(o)<0).forEach(o=>{delete i[o]}),i}_extractNonMaskProps(r){const{...i}=r;return CU.forEach(o=>{o!=="maxLength"&&delete i[o]}),"defaultValue"in i||(i.defaultValue=r.mask?"":i.value),delete i.value,i}get maskValue(){return this.maskRef?this.props.unmask==="typed"?this.maskRef.typedValue:this.props.unmask?this.maskRef.unmaskedValue:this.maskRef.value:""}set maskValue(r){this.maskRef&&(r=r==null&&this.props.unmask!=="typed"?"":r,this.props.unmask==="typed"?this.maskRef.typedValue=r:this.props.unmask?this.maskRef.unmaskedValue=r:this.maskRef.value=r)}_onAccept(r){this.props.onAccept&&this.maskRef&&this.props.onAccept(this.maskValue,this.maskRef,r)}_onComplete(r){this.props.onComplete&&this.maskRef&&this.props.onComplete(this.maskValue,this.maskRef,r)}render(){return nu.createElement(e,{...this._extractNonMaskProps(this.props),inputRef:this._inputRef})}},u.displayName=void 0,u.propTypes=void 0,u),t=e.displayName||e.name||"Component";return a.displayName="IMask("+t+")",a.propTypes=gU,nu.forwardRef((n,r)=>nu.createElement(a,{...n,ref:r}))}const Kku=Iku(e=>{let{inputRef:u,...a}=e;return nu.createElement("input",{...a,ref:u})}),$ku=(e,u)=>nu.createElement(Kku,{...e,ref:u});nu.forwardRef($ku);function Vku(e,u){let{onAccept:a,onComplete:t,ref:n=C.useRef(null),defaultValue:r,defaultUnmaskedValue:i,defaultTypedValue:o}=u===void 0?{}:u;const s=C.useRef(null),[l,E]=C.useState({}),[c,D]=C.useState(""),[h,m]=C.useState(""),[x,p]=C.useState(),f=C.useCallback(()=>{var y;(y=s.current)==null||y.destroy(),s.current=null},[]),g=C.useCallback(()=>{const y=s.current;y&&(E({value:y.value,unmaskedValue:y.unmaskedValue,typedValue:y.typedValue}),p(y.typedValue),m(y.unmaskedValue),D(y.value))},[]),F=C.useCallback(y=>{const v=s.current;v&&(g(),a==null||a(v.value,v,y))},[a]),b=C.useCallback(y=>s.current&&(t==null?void 0:t(s.current.value,s.current,y)),[t]);return C.useEffect(()=>{const{value:y,...v}=l,A=s.current;!A||c===void 0||(y!==c&&(A.value=c,A.value!==c&&F()),E(v))},[c]),C.useEffect(()=>{const{unmaskedValue:y,...v}=l,A=s.current;!A||h===void 0||(y!==h&&(A.unmaskedValue=h,A.unmaskedValue!==h&&F()),E(v))},[h]),C.useEffect(()=>{const{typedValue:y,...v}=l,A=s.current;!A||x===void 0||(y!==x&&(A.typedValue=x,A.masked.typedValueEquals(x)||F()),E(v))},[x]),C.useEffect(()=>{const y=n.current;if(!y||!(e!=null&&e.mask))return f();const v=s.current;v?v==null||v.updateOptions(e):y&&e!=null&&e.mask&&(s.current=$e(y,e),g(),r!==void 0&&D(r),i!==void 0&&m(i),o!==void 0&&p(o))},[e,f,F]),C.useEffect(()=>{if(!s.current)return;const y=s.current;return y.on("accept",F),y.on("complete",b),()=>{y.off("accept",F),y.off("complete",b)}},[F,b]),C.useEffect(()=>f,[f]),{ref:n,maskRef:s,value:c,setValue:D,unmaskedValue:h,setUnmaskedValue:m,typedValue:x,setTypedValue:p}}function Hku(e){return u=>{for(const a of e)mb(a,u)}}function Gku(e){return u=>{const a=[];for(const t of e){const n=mb(t,u),r=typeof n=="function";a.push(r?n:()=>mb(t,null))}return()=>{for(const t of a)t()}}}function mb(e,u){if(typeof e=="function")return e(u);e&&(e.current=u)}var Jku=parseInt(C.version.split(".")[0],10)>=19?Gku:Hku;const SE=C.forwardRef(({value:e,onChange:u,...a},t)=>{const{ref:n,value:r,setValue:i}=Vku({mask:/^[a-zA-Z0-9_-]*$/,prepare:(o,s)=>{const l=o.toLowerCase().replace(/ /g,"-").replace(/-+/g,"-");return l!=="-"||s._value.length===0||s._value[s._value.length-1]!=="-"?l:""},commit:(o,s)=>{const l=o.replace(/-+/g,"-");s._value=l},overwrite:!1,skipInvalid:!0},{defaultValue:e,onAccept:u});return d.jsx(gt,{ref:Jku([t,n]),value:r,onChange:o=>i(o.target.value),...a})});SE.displayName="PathInput";var x0;(function(e){e.assertEqual=n=>{};function u(n){}e.assertIs=u;function a(n){throw new Error}e.assertNever=a,e.arrayToEnum=n=>{const r={};for(const i of n)r[i]=i;return r},e.getValidEnumValues=n=>{const r=e.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of r)i[o]=n[o];return e.objectValues(i)},e.objectValues=n=>e.objectKeys(n).map(function(r){return n[r]}),e.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const r=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&r.push(i);return r},e.find=(n,r)=>{for(const i of n)if(r(i))return i},e.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function t(n,r=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(r)}e.joinValues=t,e.jsonStringifyReplacer=(n,r)=>typeof r=="bigint"?r.toString():r})(x0||(x0={}));var Ep;(function(e){e.mergeShapes=(u,a)=>({...u,...a})})(Ep||(Ep={}));const Qu=x0.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),yo=e=>{switch(typeof e){case"undefined":return Qu.undefined;case"string":return Qu.string;case"number":return Number.isNaN(e)?Qu.nan:Qu.number;case"boolean":return Qu.boolean;case"function":return Qu.function;case"bigint":return Qu.bigint;case"symbol":return Qu.symbol;case"object":return Array.isArray(e)?Qu.array:e===null?Qu.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Qu.promise:typeof Map<"u"&&e instanceof Map?Qu.map:typeof Set<"u"&&e instanceof Set?Qu.set:typeof Date<"u"&&e instanceof Date?Qu.date:Qu.object;default:return Qu.unknown}},gu=x0.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),FU=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ur extends Error{get errors(){return this.issues}constructor(u){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=u}format(u){const a=u||function(r){return r.message},t={_errors:[]},n=r=>{for(const i of r.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)t._errors.push(a(i));else{let o=t,s=0;for(;s<i.path.length;){const l=i.path[s];s===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(a(i))):o[l]=o[l]||{_errors:[]},o=o[l],s++}}};return n(this),t}static assert(u){if(!(u instanceof ur))throw new Error(`Not a ZodError: ${u}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x0.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(u=a=>a.message){const a={},t=[];for(const n of this.issues)if(n.path.length>0){const r=n.path[0];a[r]=a[r]||[],a[r].push(u(n))}else t.push(u(n));return{formErrors:t,fieldErrors:a}}get formErrors(){return this.flatten()}}ur.create=e=>new ur(e);const Wku=(e,u)=>{let a;switch(e.code){case gu.invalid_type:e.received===Qu.undefined?a="Required":a=`Expected ${e.expected}, received ${e.received}`;break;case gu.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,x0.jsonStringifyReplacer)}`;break;case gu.unrecognized_keys:a=`Unrecognized key(s) in object: ${x0.joinValues(e.keys,", ")}`;break;case gu.invalid_union:a="Invalid input";break;case gu.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${x0.joinValues(e.options)}`;break;case gu.invalid_enum_value:a=`Invalid enum value. Expected ${x0.joinValues(e.options)}, received '${e.received}'`;break;case gu.invalid_arguments:a="Invalid function arguments";break;case gu.invalid_return_type:a="Invalid function return type";break;case gu.invalid_date:a="Invalid date";break;case gu.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:x0.assertNever(e.validation):e.validation!=="regex"?a=`Invalid ${e.validation}`:a="Invalid";break;case gu.too_small:e.type==="array"?a=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?a=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?a=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?a=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?a=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:a="Invalid input";break;case gu.too_big:e.type==="array"?a=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?a=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?a=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?a=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?a=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:a="Invalid input";break;case gu.custom:a="Invalid input";break;case gu.invalid_intersection_types:a="Intersection results could not be merged";break;case gu.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case gu.not_finite:a="Number must be finite";break;default:a=u.defaultError,x0.assertNever(e)}return{message:a}},Y4=Wku;let kU=Y4;function vU(e){kU=e}function ah(){return kU}const th=e=>{const{data:u,path:a,errorMaps:t,issueData:n}=e,r=[...a,...n.path||[]],i={...n,path:r};if(n.message!==void 0)return{...n,path:r,message:n.message};let o="";const s=t.filter(l=>!!l).slice().reverse();for(const l of s)o=l(i,{data:u,defaultError:o}).message;return{...n,path:r,message:o}},AU=[];function Hu(e,u){const a=ah(),t=th({issueData:u,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===Y4?void 0:Y4].filter(n=>!!n)});e.common.issues.push(t)}class Qt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(u,a){const t=[];for(const n of a){if(n.status==="aborted")return je;n.status==="dirty"&&u.dirty(),t.push(n.value)}return{status:u.value,value:t}}static async mergeObjectAsync(u,a){const t=[];for(const n of a){const r=await n.key,i=await n.value;t.push({key:r,value:i})}return Qt.mergeObjectSync(u,t)}static mergeObjectSync(u,a){const t={};for(const n of a){const{key:r,value:i}=n;if(r.status==="aborted"||i.status==="aborted")return je;r.status==="dirty"&&u.dirty(),i.status==="dirty"&&u.dirty(),r.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(t[r.value]=i.value)}return{status:u.value,value:t}}}const je=Object.freeze({status:"aborted"}),k4=e=>({status:"dirty",value:e}),mn=e=>({status:"valid",value:e}),cp=e=>e.status==="aborted",dp=e=>e.status==="dirty",f1=e=>e.status==="valid",x3=e=>typeof Promise<"u"&&e instanceof Promise;var Ce;(function(e){e.errToObj=u=>typeof u=="string"?{message:u}:u||{},e.toString=u=>typeof u=="string"?u:u==null?void 0:u.message})(Ce||(Ce={}));class Yo{constructor(u,a,t,n){this._cachedPath=[],this.parent=u,this.data=a,this._path=t,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const nP=(e,u)=>{if(f1(u))return{success:!0,data:u.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new ur(e.common.issues);return this._error=a,this._error}}};function qe(e){if(!e)return{};const{errorMap:u,invalid_type_error:a,required_error:t,description:n}=e;if(u&&(a||t))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return u?{errorMap:u,description:n}:{errorMap:(i,o)=>{const{message:s}=e;return i.code==="invalid_enum_value"?{message:s??o.defaultError}:typeof o.data>"u"?{message:s??t??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:s??a??o.defaultError}},description:n}}class Ue{get description(){return this._def.description}_getType(u){return yo(u.data)}_getOrReturnCtx(u,a){return a||{common:u.parent.common,data:u.data,parsedType:yo(u.data),schemaErrorMap:this._def.errorMap,path:u.path,parent:u.parent}}_processInputParams(u){return{status:new Qt,ctx:{common:u.parent.common,data:u.data,parsedType:yo(u.data),schemaErrorMap:this._def.errorMap,path:u.path,parent:u.parent}}}_parseSync(u){const a=this._parse(u);if(x3(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(u){const a=this._parse(u);return Promise.resolve(a)}parse(u,a){const t=this.safeParse(u,a);if(t.success)return t.data;throw t.error}safeParse(u,a){const t={common:{issues:[],async:(a==null?void 0:a.async)??!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:yo(u)},n=this._parseSync({data:u,path:t.path,parent:t});return nP(t,n)}"~validate"(u){var t,n;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:yo(u)};if(!this["~standard"].async)try{const r=this._parseSync({data:u,path:[],parent:a});return f1(r)?{value:r.value}:{issues:a.common.issues}}catch(r){(n=(t=r==null?void 0:r.message)==null?void 0:t.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:u,path:[],parent:a}).then(r=>f1(r)?{value:r.value}:{issues:a.common.issues})}async parseAsync(u,a){const t=await this.safeParseAsync(u,a);if(t.success)return t.data;throw t.error}async safeParseAsync(u,a){const t={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:yo(u)},n=this._parse({data:u,path:t.path,parent:t}),r=await(x3(n)?n:Promise.resolve(n));return nP(t,r)}refine(u,a){const t=n=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(n):a;return this._refinement((n,r)=>{const i=u(n),o=()=>r.addIssue({code:gu.custom,...t(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(s=>s?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(u,a){return this._refinement((t,n)=>u(t)?!0:(n.addIssue(typeof a=="function"?a(t,n):a),!1))}_refinement(u){return new Pr({schema:this,typeName:zu.ZodEffects,effect:{type:"refinement",refinement:u}})}superRefine(u){return this._refinement(u)}constructor(u){this.spa=this.safeParseAsync,this._def=u,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return Qi.create(this,this._def)}nullable(){return Ys.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return di.create(this)}promise(){return uE.create(this,this._def)}or(u){return C3.create([this,u],this._def)}and(u){return F3.create(this,u,this._def)}transform(u){return new Pr({...qe(this._def),schema:this,typeName:zu.ZodEffects,effect:{type:"transform",transform:u}})}default(u){const a=typeof u=="function"?u:()=>u;return new y3({...qe(this._def),innerType:this,defaultValue:a,typeName:zu.ZodDefault})}brand(){return new N2({typeName:zu.ZodBranded,type:this,...qe(this._def)})}catch(u){const a=typeof u=="function"?u:()=>u;return new B3({...qe(this._def),innerType:this,catchValue:a,typeName:zu.ZodCatch})}describe(u){const a=this.constructor;return new a({...this._def,description:u})}pipe(u){return Fd.create(this,u)}readonly(){return S3.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Uku=/^c[^\s-]{8,}$/i,Zku=/^[0-9a-z]+$/,Qku=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qku=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Yku=/^[a-z0-9_-]{21}$/i,Xku=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,uvu=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,evu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,avu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let $k;const tvu=/^(?:(?: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])$/,nvu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,rvu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ivu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ovu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,svu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bU="((\\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])))",lvu=new RegExp(`^${bU}$`);function yU(e){let u="[0-5]\\d";e.precision?u=`${u}\\.\\d{${e.precision}}`:e.precision==null&&(u=`${u}(\\.\\d+)?`);const a=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${u})${a}`}function Evu(e){return new RegExp(`^${yU(e)}$`)}function eS(e){let u=`${bU}T${yU(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),u=`${u}(${a.join("|")})`,new RegExp(`^${u}$`)}function cvu(e,u){return!!((u==="v4"||!u)&&tvu.test(e)||(u==="v6"||!u)&&rvu.test(e))}function dvu(e,u){if(!Xku.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const t=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),n=JSON.parse(atob(t));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||u&&n.alg!==u)}catch{return!1}}function Dvu(e,u){return!!((u==="v4"||!u)&&nvu.test(e)||(u==="v6"||!u)&&ivu.test(e))}class oi extends Ue{_parse(u){if(this._def.coerce&&(u.data=String(u.data)),this._getType(u)!==Qu.string){const r=this._getOrReturnCtx(u);return Hu(r,{code:gu.invalid_type,expected:Qu.string,received:r.parsedType}),je}const t=new Qt;let n;for(const r of this._def.checks)if(r.kind==="min")u.data.length<r.value&&(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind==="max")u.data.length>r.value&&(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind==="length"){const i=u.data.length>r.value,o=u.data.length<r.value;(i||o)&&(n=this._getOrReturnCtx(u,n),i?Hu(n,{code:gu.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&Hu(n,{code:gu.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind==="email")evu.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"email",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="emoji")$k||($k=new RegExp(avu,"u")),$k.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"emoji",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="uuid")qku.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"uuid",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="nanoid")Yku.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"nanoid",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="cuid")Uku.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"cuid",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="cuid2")Zku.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"cuid2",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="ulid")Qku.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"ulid",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="url")try{new URL(u.data)}catch{n=this._getOrReturnCtx(u,n),Hu(n,{validation:"url",code:gu.invalid_string,message:r.message}),t.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"regex",code:gu.invalid_string,message:r.message}),t.dirty())):r.kind==="trim"?u.data=u.data.trim():r.kind==="includes"?u.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind==="toLowerCase"?u.data=u.data.toLowerCase():r.kind==="toUpperCase"?u.data=u.data.toUpperCase():r.kind==="startsWith"?u.data.startsWith(r.value)||(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind==="endsWith"?u.data.endsWith(r.value)||(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind==="datetime"?eS(r).test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.invalid_string,validation:"datetime",message:r.message}),t.dirty()):r.kind==="date"?lvu.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.invalid_string,validation:"date",message:r.message}),t.dirty()):r.kind==="time"?Evu(r).test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.invalid_string,validation:"time",message:r.message}),t.dirty()):r.kind==="duration"?uvu.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"duration",code:gu.invalid_string,message:r.message}),t.dirty()):r.kind==="ip"?cvu(u.data,r.version)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"ip",code:gu.invalid_string,message:r.message}),t.dirty()):r.kind==="jwt"?dvu(u.data,r.alg)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"jwt",code:gu.invalid_string,message:r.message}),t.dirty()):r.kind==="cidr"?Dvu(u.data,r.version)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"cidr",code:gu.invalid_string,message:r.message}),t.dirty()):r.kind==="base64"?ovu.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"base64",code:gu.invalid_string,message:r.message}),t.dirty()):r.kind==="base64url"?svu.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"base64url",code:gu.invalid_string,message:r.message}),t.dirty()):x0.assertNever(r);return{status:t.value,value:u.data}}_regex(u,a,t){return this.refinement(n=>u.test(n),{validation:a,code:gu.invalid_string,...Ce.errToObj(t)})}_addCheck(u){return new oi({...this._def,checks:[...this._def.checks,u]})}email(u){return this._addCheck({kind:"email",...Ce.errToObj(u)})}url(u){return this._addCheck({kind:"url",...Ce.errToObj(u)})}emoji(u){return this._addCheck({kind:"emoji",...Ce.errToObj(u)})}uuid(u){return this._addCheck({kind:"uuid",...Ce.errToObj(u)})}nanoid(u){return this._addCheck({kind:"nanoid",...Ce.errToObj(u)})}cuid(u){return this._addCheck({kind:"cuid",...Ce.errToObj(u)})}cuid2(u){return this._addCheck({kind:"cuid2",...Ce.errToObj(u)})}ulid(u){return this._addCheck({kind:"ulid",...Ce.errToObj(u)})}base64(u){return this._addCheck({kind:"base64",...Ce.errToObj(u)})}base64url(u){return this._addCheck({kind:"base64url",...Ce.errToObj(u)})}jwt(u){return this._addCheck({kind:"jwt",...Ce.errToObj(u)})}ip(u){return this._addCheck({kind:"ip",...Ce.errToObj(u)})}cidr(u){return this._addCheck({kind:"cidr",...Ce.errToObj(u)})}datetime(u){return typeof u=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:u}):this._addCheck({kind:"datetime",precision:typeof(u==null?void 0:u.precision)>"u"?null:u==null?void 0:u.precision,offset:(u==null?void 0:u.offset)??!1,local:(u==null?void 0:u.local)??!1,...Ce.errToObj(u==null?void 0:u.message)})}date(u){return this._addCheck({kind:"date",message:u})}time(u){return typeof u=="string"?this._addCheck({kind:"time",precision:null,message:u}):this._addCheck({kind:"time",precision:typeof(u==null?void 0:u.precision)>"u"?null:u==null?void 0:u.precision,...Ce.errToObj(u==null?void 0:u.message)})}duration(u){return this._addCheck({kind:"duration",...Ce.errToObj(u)})}regex(u,a){return this._addCheck({kind:"regex",regex:u,...Ce.errToObj(a)})}includes(u,a){return this._addCheck({kind:"includes",value:u,position:a==null?void 0:a.position,...Ce.errToObj(a==null?void 0:a.message)})}startsWith(u,a){return this._addCheck({kind:"startsWith",value:u,...Ce.errToObj(a)})}endsWith(u,a){return this._addCheck({kind:"endsWith",value:u,...Ce.errToObj(a)})}min(u,a){return this._addCheck({kind:"min",value:u,...Ce.errToObj(a)})}max(u,a){return this._addCheck({kind:"max",value:u,...Ce.errToObj(a)})}length(u,a){return this._addCheck({kind:"length",value:u,...Ce.errToObj(a)})}nonempty(u){return this.min(1,Ce.errToObj(u))}trim(){return new oi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new oi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new oi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(u=>u.kind==="datetime")}get isDate(){return!!this._def.checks.find(u=>u.kind==="date")}get isTime(){return!!this._def.checks.find(u=>u.kind==="time")}get isDuration(){return!!this._def.checks.find(u=>u.kind==="duration")}get isEmail(){return!!this._def.checks.find(u=>u.kind==="email")}get isURL(){return!!this._def.checks.find(u=>u.kind==="url")}get isEmoji(){return!!this._def.checks.find(u=>u.kind==="emoji")}get isUUID(){return!!this._def.checks.find(u=>u.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(u=>u.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(u=>u.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(u=>u.kind==="cuid2")}get isULID(){return!!this._def.checks.find(u=>u.kind==="ulid")}get isIP(){return!!this._def.checks.find(u=>u.kind==="ip")}get isCIDR(){return!!this._def.checks.find(u=>u.kind==="cidr")}get isBase64(){return!!this._def.checks.find(u=>u.kind==="base64")}get isBase64url(){return!!this._def.checks.find(u=>u.kind==="base64url")}get minLength(){let u=null;for(const a of this._def.checks)a.kind==="min"&&(u===null||a.value>u)&&(u=a.value);return u}get maxLength(){let u=null;for(const a of this._def.checks)a.kind==="max"&&(u===null||a.value<u)&&(u=a.value);return u}}oi.create=e=>new oi({checks:[],typeName:zu.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...qe(e)});function hvu(e,u){const a=(e.toString().split(".")[1]||"").length,t=(u.toString().split(".")[1]||"").length,n=a>t?a:t,r=Number.parseInt(e.toFixed(n).replace(".","")),i=Number.parseInt(u.toFixed(n).replace(".",""));return r%i/10**n}class Zs extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(u){if(this._def.coerce&&(u.data=Number(u.data)),this._getType(u)!==Qu.number){const r=this._getOrReturnCtx(u);return Hu(r,{code:gu.invalid_type,expected:Qu.number,received:r.parsedType}),je}let t;const n=new Qt;for(const r of this._def.checks)r.kind==="int"?x0.isInteger(u.data)||(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):r.kind==="min"?(r.inclusive?u.data<r.value:u.data<=r.value)&&(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind==="max"?(r.inclusive?u.data>r.value:u.data>=r.value)&&(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind==="multipleOf"?hvu(u.data,r.value)!==0&&(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind==="finite"?Number.isFinite(u.data)||(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.not_finite,message:r.message}),n.dirty()):x0.assertNever(r);return{status:n.value,value:u.data}}gte(u,a){return this.setLimit("min",u,!0,Ce.toString(a))}gt(u,a){return this.setLimit("min",u,!1,Ce.toString(a))}lte(u,a){return this.setLimit("max",u,!0,Ce.toString(a))}lt(u,a){return this.setLimit("max",u,!1,Ce.toString(a))}setLimit(u,a,t,n){return new Zs({...this._def,checks:[...this._def.checks,{kind:u,value:a,inclusive:t,message:Ce.toString(n)}]})}_addCheck(u){return new Zs({...this._def,checks:[...this._def.checks,u]})}int(u){return this._addCheck({kind:"int",message:Ce.toString(u)})}positive(u){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ce.toString(u)})}negative(u){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ce.toString(u)})}nonpositive(u){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ce.toString(u)})}nonnegative(u){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ce.toString(u)})}multipleOf(u,a){return this._addCheck({kind:"multipleOf",value:u,message:Ce.toString(a)})}finite(u){return this._addCheck({kind:"finite",message:Ce.toString(u)})}safe(u){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ce.toString(u)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ce.toString(u)})}get minValue(){let u=null;for(const a of this._def.checks)a.kind==="min"&&(u===null||a.value>u)&&(u=a.value);return u}get maxValue(){let u=null;for(const a of this._def.checks)a.kind==="max"&&(u===null||a.value<u)&&(u=a.value);return u}get isInt(){return!!this._def.checks.find(u=>u.kind==="int"||u.kind==="multipleOf"&&x0.isInteger(u.value))}get isFinite(){let u=null,a=null;for(const t of this._def.checks){if(t.kind==="finite"||t.kind==="int"||t.kind==="multipleOf")return!0;t.kind==="min"?(a===null||t.value>a)&&(a=t.value):t.kind==="max"&&(u===null||t.value<u)&&(u=t.value)}return Number.isFinite(a)&&Number.isFinite(u)}}Zs.create=e=>new Zs({checks:[],typeName:zu.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...qe(e)});class Qs extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(u){if(this._def.coerce)try{u.data=BigInt(u.data)}catch{return this._getInvalidInput(u)}if(this._getType(u)!==Qu.bigint)return this._getInvalidInput(u);let t;const n=new Qt;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?u.data<r.value:u.data<=r.value)&&(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind==="max"?(r.inclusive?u.data>r.value:u.data>=r.value)&&(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind==="multipleOf"?u.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):x0.assertNever(r);return{status:n.value,value:u.data}}_getInvalidInput(u){const a=this._getOrReturnCtx(u);return Hu(a,{code:gu.invalid_type,expected:Qu.bigint,received:a.parsedType}),je}gte(u,a){return this.setLimit("min",u,!0,Ce.toString(a))}gt(u,a){return this.setLimit("min",u,!1,Ce.toString(a))}lte(u,a){return this.setLimit("max",u,!0,Ce.toString(a))}lt(u,a){return this.setLimit("max",u,!1,Ce.toString(a))}setLimit(u,a,t,n){return new Qs({...this._def,checks:[...this._def.checks,{kind:u,value:a,inclusive:t,message:Ce.toString(n)}]})}_addCheck(u){return new Qs({...this._def,checks:[...this._def.checks,u]})}positive(u){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ce.toString(u)})}negative(u){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ce.toString(u)})}nonpositive(u){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ce.toString(u)})}nonnegative(u){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ce.toString(u)})}multipleOf(u,a){return this._addCheck({kind:"multipleOf",value:u,message:Ce.toString(a)})}get minValue(){let u=null;for(const a of this._def.checks)a.kind==="min"&&(u===null||a.value>u)&&(u=a.value);return u}get maxValue(){let u=null;for(const a of this._def.checks)a.kind==="max"&&(u===null||a.value<u)&&(u=a.value);return u}}Qs.create=e=>new Qs({checks:[],typeName:zu.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...qe(e)});class f3 extends Ue{_parse(u){if(this._def.coerce&&(u.data=!!u.data),this._getType(u)!==Qu.boolean){const t=this._getOrReturnCtx(u);return Hu(t,{code:gu.invalid_type,expected:Qu.boolean,received:t.parsedType}),je}return mn(u.data)}}f3.create=e=>new f3({typeName:zu.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...qe(e)});class p1 extends Ue{_parse(u){if(this._def.coerce&&(u.data=new Date(u.data)),this._getType(u)!==Qu.date){const r=this._getOrReturnCtx(u);return Hu(r,{code:gu.invalid_type,expected:Qu.date,received:r.parsedType}),je}if(Number.isNaN(u.data.getTime())){const r=this._getOrReturnCtx(u);return Hu(r,{code:gu.invalid_date}),je}const t=new Qt;let n;for(const r of this._def.checks)r.kind==="min"?u.data.getTime()<r.value&&(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):r.kind==="max"?u.data.getTime()>r.value&&(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):x0.assertNever(r);return{status:t.value,value:new Date(u.data.getTime())}}_addCheck(u){return new p1({...this._def,checks:[...this._def.checks,u]})}min(u,a){return this._addCheck({kind:"min",value:u.getTime(),message:Ce.toString(a)})}max(u,a){return this._addCheck({kind:"max",value:u.getTime(),message:Ce.toString(a)})}get minDate(){let u=null;for(const a of this._def.checks)a.kind==="min"&&(u===null||a.value>u)&&(u=a.value);return u!=null?new Date(u):null}get maxDate(){let u=null;for(const a of this._def.checks)a.kind==="max"&&(u===null||a.value<u)&&(u=a.value);return u!=null?new Date(u):null}}p1.create=e=>new p1({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:zu.ZodDate,...qe(e)});class nh extends Ue{_parse(u){if(this._getType(u)!==Qu.symbol){const t=this._getOrReturnCtx(u);return Hu(t,{code:gu.invalid_type,expected:Qu.symbol,received:t.parsedType}),je}return mn(u.data)}}nh.create=e=>new nh({typeName:zu.ZodSymbol,...qe(e)});class p3 extends Ue{_parse(u){if(this._getType(u)!==Qu.undefined){const t=this._getOrReturnCtx(u);return Hu(t,{code:gu.invalid_type,expected:Qu.undefined,received:t.parsedType}),je}return mn(u.data)}}p3.create=e=>new p3({typeName:zu.ZodUndefined,...qe(e)});class g3 extends Ue{_parse(u){if(this._getType(u)!==Qu.null){const t=this._getOrReturnCtx(u);return Hu(t,{code:gu.invalid_type,expected:Qu.null,received:t.parsedType}),je}return mn(u.data)}}g3.create=e=>new g3({typeName:zu.ZodNull,...qe(e)});class X4 extends Ue{constructor(){super(...arguments),this._any=!0}_parse(u){return mn(u.data)}}X4.create=e=>new X4({typeName:zu.ZodAny,...qe(e)});class e1 extends Ue{constructor(){super(...arguments),this._unknown=!0}_parse(u){return mn(u.data)}}e1.create=e=>new e1({typeName:zu.ZodUnknown,...qe(e)});class Xo extends Ue{_parse(u){const a=this._getOrReturnCtx(u);return Hu(a,{code:gu.invalid_type,expected:Qu.never,received:a.parsedType}),je}}Xo.create=e=>new Xo({typeName:zu.ZodNever,...qe(e)});class rh extends Ue{_parse(u){if(this._getType(u)!==Qu.undefined){const t=this._getOrReturnCtx(u);return Hu(t,{code:gu.invalid_type,expected:Qu.void,received:t.parsedType}),je}return mn(u.data)}}rh.create=e=>new rh({typeName:zu.ZodVoid,...qe(e)});class di extends Ue{_parse(u){const{ctx:a,status:t}=this._processInputParams(u),n=this._def;if(a.parsedType!==Qu.array)return Hu(a,{code:gu.invalid_type,expected:Qu.array,received:a.parsedType}),je;if(n.exactLength!==null){const i=a.data.length>n.exactLength.value,o=a.data.length<n.exactLength.value;(i||o)&&(Hu(a,{code:i?gu.too_big:gu.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),t.dirty())}if(n.minLength!==null&&a.data.length<n.minLength.value&&(Hu(a,{code:gu.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),t.dirty()),n.maxLength!==null&&a.data.length>n.maxLength.value&&(Hu(a,{code:gu.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),t.dirty()),a.common.async)return Promise.all([...a.data].map((i,o)=>n.type._parseAsync(new Yo(a,i,a.path,o)))).then(i=>Qt.mergeArray(t,i));const r=[...a.data].map((i,o)=>n.type._parseSync(new Yo(a,i,a.path,o)));return Qt.mergeArray(t,r)}get element(){return this._def.type}min(u,a){return new di({...this._def,minLength:{value:u,message:Ce.toString(a)}})}max(u,a){return new di({...this._def,maxLength:{value:u,message:Ce.toString(a)}})}length(u,a){return new di({...this._def,exactLength:{value:u,message:Ce.toString(a)}})}nonempty(u){return this.min(1,u)}}di.create=(e,u)=>new di({type:e,minLength:null,maxLength:null,exactLength:null,typeName:zu.ZodArray,...qe(u)});function ec(e){if(e instanceof ca){const u={};for(const a in e.shape){const t=e.shape[a];u[a]=Qi.create(ec(t))}return new ca({...e._def,shape:()=>u})}else return e instanceof di?new di({...e._def,type:ec(e.element)}):e instanceof Qi?Qi.create(ec(e.unwrap())):e instanceof Ys?Ys.create(ec(e.unwrap())):e instanceof no?no.create(e.items.map(u=>ec(u))):e}class ca extends Ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const u=this._def.shape(),a=x0.objectKeys(u);return this._cached={shape:u,keys:a},this._cached}_parse(u){if(this._getType(u)!==Qu.object){const l=this._getOrReturnCtx(u);return Hu(l,{code:gu.invalid_type,expected:Qu.object,received:l.parsedType}),je}const{status:t,ctx:n}=this._processInputParams(u),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Xo&&this._def.unknownKeys==="strip"))for(const l in n.data)i.includes(l)||o.push(l);const s=[];for(const l of i){const E=r[l],c=n.data[l];s.push({key:{status:"valid",value:l},value:E._parse(new Yo(n,c,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof Xo){const l=this._def.unknownKeys;if(l==="passthrough")for(const E of o)s.push({key:{status:"valid",value:E},value:{status:"valid",value:n.data[E]}});else if(l==="strict")o.length>0&&(Hu(n,{code:gu.unrecognized_keys,keys:o}),t.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const E of o){const c=n.data[E];s.push({key:{status:"valid",value:E},value:l._parse(new Yo(n,c,n.path,E)),alwaysSet:E in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const E of s){const c=await E.key,D=await E.value;l.push({key:c,value:D,alwaysSet:E.alwaysSet})}return l}).then(l=>Qt.mergeObjectSync(t,l)):Qt.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(u){return Ce.errToObj,new ca({...this._def,unknownKeys:"strict",...u!==void 0?{errorMap:(a,t)=>{var r,i;const n=((i=(r=this._def).errorMap)==null?void 0:i.call(r,a,t).message)??t.defaultError;return a.code==="unrecognized_keys"?{message:Ce.errToObj(u).message??n}:{message:n}}}:{}})}strip(){return new ca({...this._def,unknownKeys:"strip"})}passthrough(){return new ca({...this._def,unknownKeys:"passthrough"})}extend(u){return new ca({...this._def,shape:()=>({...this._def.shape(),...u})})}merge(u){return new ca({unknownKeys:u._def.unknownKeys,catchall:u._def.catchall,shape:()=>({...this._def.shape(),...u._def.shape()}),typeName:zu.ZodObject})}setKey(u,a){return this.augment({[u]:a})}catchall(u){return new ca({...this._def,catchall:u})}pick(u){const a={};for(const t of x0.objectKeys(u))u[t]&&this.shape[t]&&(a[t]=this.shape[t]);return new ca({...this._def,shape:()=>a})}omit(u){const a={};for(const t of x0.objectKeys(this.shape))u[t]||(a[t]=this.shape[t]);return new ca({...this._def,shape:()=>a})}deepPartial(){return ec(this)}partial(u){const a={};for(const t of x0.objectKeys(this.shape)){const n=this.shape[t];u&&!u[t]?a[t]=n:a[t]=n.optional()}return new ca({...this._def,shape:()=>a})}required(u){const a={};for(const t of x0.objectKeys(this.shape))if(u&&!u[t])a[t]=this.shape[t];else{let r=this.shape[t];for(;r instanceof Qi;)r=r._def.innerType;a[t]=r}return new ca({...this._def,shape:()=>a})}keyof(){return BU(x0.objectKeys(this.shape))}}ca.create=(e,u)=>new ca({shape:()=>e,unknownKeys:"strip",catchall:Xo.create(),typeName:zu.ZodObject,...qe(u)});ca.strictCreate=(e,u)=>new ca({shape:()=>e,unknownKeys:"strict",catchall:Xo.create(),typeName:zu.ZodObject,...qe(u)});ca.lazycreate=(e,u)=>new ca({shape:e,unknownKeys:"strip",catchall:Xo.create(),typeName:zu.ZodObject,...qe(u)});class C3 extends Ue{_parse(u){const{ctx:a}=this._processInputParams(u),t=this._def.options;function n(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return a.common.issues.push(...o.ctx.common.issues),o.result;const i=r.map(o=>new ur(o.ctx.common.issues));return Hu(a,{code:gu.invalid_union,unionErrors:i}),je}if(a.common.async)return Promise.all(t.map(async r=>{const i={...a,common:{...a.common,issues:[]},parent:null};return{result:await r._parseAsync({data:a.data,path:a.path,parent:i}),ctx:i}})).then(n);{let r;const i=[];for(const s of t){const l={...a,common:{...a.common,issues:[]},parent:null},E=s._parseSync({data:a.data,path:a.path,parent:l});if(E.status==="valid")return E;E.status==="dirty"&&!r&&(r={result:E,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(r)return a.common.issues.push(...r.ctx.common.issues),r.result;const o=i.map(s=>new ur(s));return Hu(a,{code:gu.invalid_union,unionErrors:o}),je}}get options(){return this._def.options}}C3.create=(e,u)=>new C3({options:e,typeName:zu.ZodUnion,...qe(u)});const gs=e=>e instanceof v3?gs(e.schema):e instanceof Pr?gs(e.innerType()):e instanceof A3?[e.value]:e instanceof qs?e.options:e instanceof b3?x0.objectValues(e.enum):e instanceof y3?gs(e._def.innerType):e instanceof p3?[void 0]:e instanceof g3?[null]:e instanceof Qi?[void 0,...gs(e.unwrap())]:e instanceof Ys?[null,...gs(e.unwrap())]:e instanceof N2||e instanceof S3?gs(e.unwrap()):e instanceof B3?gs(e._def.innerType):[];class Fm extends Ue{_parse(u){const{ctx:a}=this._processInputParams(u);if(a.parsedType!==Qu.object)return Hu(a,{code:gu.invalid_type,expected:Qu.object,received:a.parsedType}),je;const t=this.discriminator,n=a.data[t],r=this.optionsMap.get(n);return r?a.common.async?r._parseAsync({data:a.data,path:a.path,parent:a}):r._parseSync({data:a.data,path:a.path,parent:a}):(Hu(a,{code:gu.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[t]}),je)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(u,a,t){const n=new Map;for(const r of a){const i=gs(r.shape[u]);if(!i.length)throw new Error(`A discriminator value for key \`${u}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(u)} has duplicate value ${String(o)}`);n.set(o,r)}}return new Fm({typeName:zu.ZodDiscriminatedUnion,discriminator:u,options:a,optionsMap:n,...qe(t)})}}function xb(e,u){const a=yo(e),t=yo(u);if(e===u)return{valid:!0,data:e};if(a===Qu.object&&t===Qu.object){const n=x0.objectKeys(u),r=x0.objectKeys(e).filter(o=>n.indexOf(o)!==-1),i={...e,...u};for(const o of r){const s=xb(e[o],u[o]);if(!s.valid)return{valid:!1};i[o]=s.data}return{valid:!0,data:i}}else if(a===Qu.array&&t===Qu.array){if(e.length!==u.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const i=e[r],o=u[r],s=xb(i,o);if(!s.valid)return{valid:!1};n.push(s.data)}return{valid:!0,data:n}}else return a===Qu.date&&t===Qu.date&&+e==+u?{valid:!0,data:e}:{valid:!1}}class F3 extends Ue{_parse(u){const{status:a,ctx:t}=this._processInputParams(u),n=(r,i)=>{if(cp(r)||cp(i))return je;const o=xb(r.value,i.value);return o.valid?((dp(r)||dp(i))&&a.dirty(),{status:a.value,value:o.data}):(Hu(t,{code:gu.invalid_intersection_types}),je)};return t.common.async?Promise.all([this._def.left._parseAsync({data:t.data,path:t.path,parent:t}),this._def.right._parseAsync({data:t.data,path:t.path,parent:t})]).then(([r,i])=>n(r,i)):n(this._def.left._parseSync({data:t.data,path:t.path,parent:t}),this._def.right._parseSync({data:t.data,path:t.path,parent:t}))}}F3.create=(e,u,a)=>new F3({left:e,right:u,typeName:zu.ZodIntersection,...qe(a)});class no extends Ue{_parse(u){const{status:a,ctx:t}=this._processInputParams(u);if(t.parsedType!==Qu.array)return Hu(t,{code:gu.invalid_type,expected:Qu.array,received:t.parsedType}),je;if(t.data.length<this._def.items.length)return Hu(t,{code:gu.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),je;!this._def.rest&&t.data.length>this._def.items.length&&(Hu(t,{code:gu.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const r=[...t.data].map((i,o)=>{const s=this._def.items[o]||this._def.rest;return s?s._parse(new Yo(t,i,t.path,o)):null}).filter(i=>!!i);return t.common.async?Promise.all(r).then(i=>Qt.mergeArray(a,i)):Qt.mergeArray(a,r)}get items(){return this._def.items}rest(u){return new no({...this._def,rest:u})}}no.create=(e,u)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new no({items:e,typeName:zu.ZodTuple,rest:null,...qe(u)})};class k3 extends Ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(u){const{status:a,ctx:t}=this._processInputParams(u);if(t.parsedType!==Qu.object)return Hu(t,{code:gu.invalid_type,expected:Qu.object,received:t.parsedType}),je;const n=[],r=this._def.keyType,i=this._def.valueType;for(const o in t.data)n.push({key:r._parse(new Yo(t,o,t.path,o)),value:i._parse(new Yo(t,t.data[o],t.path,o)),alwaysSet:o in t.data});return t.common.async?Qt.mergeObjectAsync(a,n):Qt.mergeObjectSync(a,n)}get element(){return this._def.valueType}static create(u,a,t){return a instanceof Ue?new k3({keyType:u,valueType:a,typeName:zu.ZodRecord,...qe(t)}):new k3({keyType:oi.create(),valueType:u,typeName:zu.ZodRecord,...qe(a)})}}class ih extends Ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(u){const{status:a,ctx:t}=this._processInputParams(u);if(t.parsedType!==Qu.map)return Hu(t,{code:gu.invalid_type,expected:Qu.map,received:t.parsedType}),je;const n=this._def.keyType,r=this._def.valueType,i=[...t.data.entries()].map(([o,s],l)=>({key:n._parse(new Yo(t,o,t.path,[l,"key"])),value:r._parse(new Yo(t,s,t.path,[l,"value"]))}));if(t.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const s of i){const l=await s.key,E=await s.value;if(l.status==="aborted"||E.status==="aborted")return je;(l.status==="dirty"||E.status==="dirty")&&a.dirty(),o.set(l.value,E.value)}return{status:a.value,value:o}})}else{const o=new Map;for(const s of i){const l=s.key,E=s.value;if(l.status==="aborted"||E.status==="aborted")return je;(l.status==="dirty"||E.status==="dirty")&&a.dirty(),o.set(l.value,E.value)}return{status:a.value,value:o}}}}ih.create=(e,u,a)=>new ih({valueType:u,keyType:e,typeName:zu.ZodMap,...qe(a)});class g1 extends Ue{_parse(u){const{status:a,ctx:t}=this._processInputParams(u);if(t.parsedType!==Qu.set)return Hu(t,{code:gu.invalid_type,expected:Qu.set,received:t.parsedType}),je;const n=this._def;n.minSize!==null&&t.data.size<n.minSize.value&&(Hu(t,{code:gu.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),a.dirty()),n.maxSize!==null&&t.data.size>n.maxSize.value&&(Hu(t,{code:gu.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),a.dirty());const r=this._def.valueType;function i(s){const l=new Set;for(const E of s){if(E.status==="aborted")return je;E.status==="dirty"&&a.dirty(),l.add(E.value)}return{status:a.value,value:l}}const o=[...t.data.values()].map((s,l)=>r._parse(new Yo(t,s,t.path,l)));return t.common.async?Promise.all(o).then(s=>i(s)):i(o)}min(u,a){return new g1({...this._def,minSize:{value:u,message:Ce.toString(a)}})}max(u,a){return new g1({...this._def,maxSize:{value:u,message:Ce.toString(a)}})}size(u,a){return this.min(u,a).max(u,a)}nonempty(u){return this.min(1,u)}}g1.create=(e,u)=>new g1({valueType:e,minSize:null,maxSize:null,typeName:zu.ZodSet,...qe(u)});class T4 extends Ue{constructor(){super(...arguments),this.validate=this.implement}_parse(u){const{ctx:a}=this._processInputParams(u);if(a.parsedType!==Qu.function)return Hu(a,{code:gu.invalid_type,expected:Qu.function,received:a.parsedType}),je;function t(o,s){return th({data:o,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,ah(),Y4].filter(l=>!!l),issueData:{code:gu.invalid_arguments,argumentsError:s}})}function n(o,s){return th({data:o,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,ah(),Y4].filter(l=>!!l),issueData:{code:gu.invalid_return_type,returnTypeError:s}})}const r={errorMap:a.common.contextualErrorMap},i=a.data;if(this._def.returns instanceof uE){const o=this;return mn(async function(...s){const l=new ur([]),E=await o._def.args.parseAsync(s,r).catch(h=>{throw l.addIssue(t(s,h)),l}),c=await Reflect.apply(i,this,E);return await o._def.returns._def.type.parseAsync(c,r).catch(h=>{throw l.addIssue(n(c,h)),l})})}else{const o=this;return mn(function(...s){const l=o._def.args.safeParse(s,r);if(!l.success)throw new ur([t(s,l.error)]);const E=Reflect.apply(i,this,l.data),c=o._def.returns.safeParse(E,r);if(!c.success)throw new ur([n(E,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...u){return new T4({...this._def,args:no.create(u).rest(e1.create())})}returns(u){return new T4({...this._def,returns:u})}implement(u){return this.parse(u)}strictImplement(u){return this.parse(u)}static create(u,a,t){return new T4({args:u||no.create([]).rest(e1.create()),returns:a||e1.create(),typeName:zu.ZodFunction,...qe(t)})}}class v3 extends Ue{get schema(){return this._def.getter()}_parse(u){const{ctx:a}=this._processInputParams(u);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}v3.create=(e,u)=>new v3({getter:e,typeName:zu.ZodLazy,...qe(u)});class A3 extends Ue{_parse(u){if(u.data!==this._def.value){const a=this._getOrReturnCtx(u);return Hu(a,{received:a.data,code:gu.invalid_literal,expected:this._def.value}),je}return{status:"valid",value:u.data}}get value(){return this._def.value}}A3.create=(e,u)=>new A3({value:e,typeName:zu.ZodLiteral,...qe(u)});function BU(e,u){return new qs({values:e,typeName:zu.ZodEnum,...qe(u)})}class qs extends Ue{_parse(u){if(typeof u.data!="string"){const a=this._getOrReturnCtx(u),t=this._def.values;return Hu(a,{expected:x0.joinValues(t),received:a.parsedType,code:gu.invalid_type}),je}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(u.data)){const a=this._getOrReturnCtx(u),t=this._def.values;return Hu(a,{received:a.data,code:gu.invalid_enum_value,options:t}),je}return mn(u.data)}get options(){return this._def.values}get enum(){const u={};for(const a of this._def.values)u[a]=a;return u}get Values(){const u={};for(const a of this._def.values)u[a]=a;return u}get Enum(){const u={};for(const a of this._def.values)u[a]=a;return u}extract(u,a=this._def){return qs.create(u,{...this._def,...a})}exclude(u,a=this._def){return qs.create(this.options.filter(t=>!u.includes(t)),{...this._def,...a})}}qs.create=BU;class b3 extends Ue{_parse(u){const a=x0.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(u);if(t.parsedType!==Qu.string&&t.parsedType!==Qu.number){const n=x0.objectValues(a);return Hu(t,{expected:x0.joinValues(n),received:t.parsedType,code:gu.invalid_type}),je}if(this._cache||(this._cache=new Set(x0.getValidEnumValues(this._def.values))),!this._cache.has(u.data)){const n=x0.objectValues(a);return Hu(t,{received:t.data,code:gu.invalid_enum_value,options:n}),je}return mn(u.data)}get enum(){return this._def.values}}b3.create=(e,u)=>new b3({values:e,typeName:zu.ZodNativeEnum,...qe(u)});class uE extends Ue{unwrap(){return this._def.type}_parse(u){const{ctx:a}=this._processInputParams(u);if(a.parsedType!==Qu.promise&&a.common.async===!1)return Hu(a,{code:gu.invalid_type,expected:Qu.promise,received:a.parsedType}),je;const t=a.parsedType===Qu.promise?a.data:Promise.resolve(a.data);return mn(t.then(n=>this._def.type.parseAsync(n,{path:a.path,errorMap:a.common.contextualErrorMap})))}}uE.create=(e,u)=>new uE({type:e,typeName:zu.ZodPromise,...qe(u)});class Pr extends Ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===zu.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(u){const{status:a,ctx:t}=this._processInputParams(u),n=this._def.effect||null,r={addIssue:i=>{Hu(t,i),i.fatal?a.abort():a.dirty()},get path(){return t.path}};if(r.addIssue=r.addIssue.bind(r),n.type==="preprocess"){const i=n.transform(t.data,r);if(t.common.async)return Promise.resolve(i).then(async o=>{if(a.value==="aborted")return je;const s=await this._def.schema._parseAsync({data:o,path:t.path,parent:t});return s.status==="aborted"?je:s.status==="dirty"||a.value==="dirty"?k4(s.value):s});{if(a.value==="aborted")return je;const o=this._def.schema._parseSync({data:i,path:t.path,parent:t});return o.status==="aborted"?je:o.status==="dirty"||a.value==="dirty"?k4(o.value):o}}if(n.type==="refinement"){const i=o=>{const s=n.refinement(o,r);if(t.common.async)return Promise.resolve(s);if(s instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(t.common.async===!1){const o=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});return o.status==="aborted"?je:(o.status==="dirty"&&a.dirty(),i(o.value),{status:a.value,value:o.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(o=>o.status==="aborted"?je:(o.status==="dirty"&&a.dirty(),i(o.value).then(()=>({status:a.value,value:o.value}))))}if(n.type==="transform")if(t.common.async===!1){const i=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});if(!f1(i))return je;const o=n.transform(i.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:o}}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(i=>f1(i)?Promise.resolve(n.transform(i.value,r)).then(o=>({status:a.value,value:o})):je);x0.assertNever(n)}}Pr.create=(e,u,a)=>new Pr({schema:e,typeName:zu.ZodEffects,effect:u,...qe(a)});Pr.createWithPreprocess=(e,u,a)=>new Pr({schema:u,effect:{type:"preprocess",transform:e},typeName:zu.ZodEffects,...qe(a)});class Qi extends Ue{_parse(u){return this._getType(u)===Qu.undefined?mn(void 0):this._def.innerType._parse(u)}unwrap(){return this._def.innerType}}Qi.create=(e,u)=>new Qi({innerType:e,typeName:zu.ZodOptional,...qe(u)});class Ys extends Ue{_parse(u){return this._getType(u)===Qu.null?mn(null):this._def.innerType._parse(u)}unwrap(){return this._def.innerType}}Ys.create=(e,u)=>new Ys({innerType:e,typeName:zu.ZodNullable,...qe(u)});class y3 extends Ue{_parse(u){const{ctx:a}=this._processInputParams(u);let t=a.data;return a.parsedType===Qu.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}y3.create=(e,u)=>new y3({innerType:e,typeName:zu.ZodDefault,defaultValue:typeof u.default=="function"?u.default:()=>u.default,...qe(u)});class B3 extends Ue{_parse(u){const{ctx:a}=this._processInputParams(u),t={...a,common:{...a.common,issues:[]}},n=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return x3(n)?n.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ur(t.common.issues)},input:t.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ur(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}}B3.create=(e,u)=>new B3({innerType:e,typeName:zu.ZodCatch,catchValue:typeof u.catch=="function"?u.catch:()=>u.catch,...qe(u)});class oh extends Ue{_parse(u){if(this._getType(u)!==Qu.nan){const t=this._getOrReturnCtx(u);return Hu(t,{code:gu.invalid_type,expected:Qu.nan,received:t.parsedType}),je}return{status:"valid",value:u.data}}}oh.create=e=>new oh({typeName:zu.ZodNaN,...qe(e)});const SU=Symbol("zod_brand");class N2 extends Ue{_parse(u){const{ctx:a}=this._processInputParams(u),t=a.data;return this._def.type._parse({data:t,path:a.path,parent:a})}unwrap(){return this._def.type}}class Fd extends Ue{_parse(u){const{status:a,ctx:t}=this._processInputParams(u);if(t.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:t.data,path:t.path,parent:t});return r.status==="aborted"?je:r.status==="dirty"?(a.dirty(),k4(r.value)):this._def.out._parseAsync({data:r.value,path:t.path,parent:t})})();{const n=this._def.in._parseSync({data:t.data,path:t.path,parent:t});return n.status==="aborted"?je:n.status==="dirty"?(a.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:t.path,parent:t})}}static create(u,a){return new Fd({in:u,out:a,typeName:zu.ZodPipeline})}}class S3 extends Ue{_parse(u){const a=this._def.innerType._parse(u),t=n=>(f1(n)&&(n.value=Object.freeze(n.value)),n);return x3(a)?a.then(n=>t(n)):t(a)}unwrap(){return this._def.innerType}}S3.create=(e,u)=>new S3({innerType:e,typeName:zu.ZodReadonly,...qe(u)});function rP(e,u){const a=typeof e=="function"?e(u):typeof e=="string"?{message:e}:e;return typeof a=="string"?{message:a}:a}function R2(e,u={},a){return e?X4.create().superRefine((t,n)=>{const r=e(t);if(r instanceof Promise)return r.then(i=>{if(!i){const o=rP(u,t),s=o.fatal??a??!0;n.addIssue({code:"custom",...o,fatal:s})}});if(!r){const i=rP(u,t),o=i.fatal??a??!0;n.addIssue({code:"custom",...i,fatal:o})}}):X4.create()}const zU={object:ca.lazycreate};var zu;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(zu||(zu={}));const OU=(e,u={message:`Input not instance of ${e.name}`})=>R2(a=>a instanceof e,u),k=oi.create,uu=Zs.create,wU=oh.create,MU=Qs.create,cu=f3.create,us=p1.create,TU=nh.create,PU=p3.create,Qe=g3.create,jU=X4.create,Le=e1.create,NU=Xo.create,RU=rh.create,De=di.create,S=ca.create,LU=ca.strictCreate,ma=C3.create,Oe=Fm.create,aS=F3.create,C1=no.create,$u=k3.create,_U=ih.create,IU=g1.create,KU=T4.create,j0=v3.create,J=A3.create,tr=qs.create,Ku=b3.create,$U=uE.create,Dp=Pr.create,VU=Qi.create,HU=Ys.create,z3=Pr.createWithPreprocess,GU=Fd.create,JU=()=>k().optional(),WU=()=>uu().optional(),UU=()=>cu().optional(),ce={string:e=>oi.create({...e,coerce:!0}),number:e=>Zs.create({...e,coerce:!0}),boolean:e=>f3.create({...e,coerce:!0}),bigint:e=>Qs.create({...e,coerce:!0}),date:e=>p1.create({...e,coerce:!0})},tS=je,q=Object.freeze(Object.defineProperty({__proto__:null,BRAND:SU,DIRTY:k4,EMPTY_PATH:AU,INVALID:je,NEVER:tS,OK:mn,ParseStatus:Qt,Schema:Ue,ZodAny:X4,ZodArray:di,ZodBigInt:Qs,ZodBoolean:f3,ZodBranded:N2,ZodCatch:B3,ZodDate:p1,ZodDefault:y3,ZodDiscriminatedUnion:Fm,ZodEffects:Pr,ZodEnum:qs,ZodError:ur,get ZodFirstPartyTypeKind(){return zu},ZodFunction:T4,ZodIntersection:F3,ZodIssueCode:gu,ZodLazy:v3,ZodLiteral:A3,ZodMap:ih,ZodNaN:oh,ZodNativeEnum:b3,ZodNever:Xo,ZodNull:g3,ZodNullable:Ys,ZodNumber:Zs,ZodObject:ca,ZodOptional:Qi,ZodParsedType:Qu,ZodPipeline:Fd,ZodPromise:uE,ZodReadonly:S3,ZodRecord:k3,ZodSchema:Ue,ZodSet:g1,ZodString:oi,ZodSymbol:nh,ZodTransformer:Pr,ZodTuple:no,ZodType:Ue,ZodUndefined:p3,ZodUnion:C3,ZodUnknown:e1,ZodVoid:rh,addIssueToContext:Hu,any:jU,array:De,bigint:MU,boolean:cu,coerce:ce,custom:R2,date:us,datetimeRegex:eS,defaultErrorMap:Y4,discriminatedUnion:Oe,effect:Dp,enum:tr,function:KU,getErrorMap:ah,getParsedType:yo,instanceof:OU,intersection:aS,isAborted:cp,isAsync:x3,isDirty:dp,isValid:f1,late:zU,lazy:j0,literal:J,makeIssue:th,map:_U,nan:wU,nativeEnum:Ku,never:NU,null:Qe,nullable:HU,number:uu,object:S,get objectUtil(){return Ep},oboolean:UU,onumber:WU,optional:VU,ostring:JU,pipeline:GU,preprocess:z3,promise:$U,quotelessJson:FU,record:$u,set:IU,setErrorMap:vU,strictObject:LU,string:k,symbol:TU,transformer:Dp,tuple:C1,undefined:PU,union:ma,unknown:Le,get util(){return x0},void:RU},Symbol.toStringTag,{value:"Module"})),kd=Object.freeze(Object.defineProperty({__proto__:null,BRAND:SU,DIRTY:k4,EMPTY_PATH:AU,INVALID:je,NEVER:tS,OK:mn,ParseStatus:Qt,Schema:Ue,ZodAny:X4,ZodArray:di,ZodBigInt:Qs,ZodBoolean:f3,ZodBranded:N2,ZodCatch:B3,ZodDate:p1,ZodDefault:y3,ZodDiscriminatedUnion:Fm,ZodEffects:Pr,ZodEnum:qs,ZodError:ur,get ZodFirstPartyTypeKind(){return zu},ZodFunction:T4,ZodIntersection:F3,ZodIssueCode:gu,ZodLazy:v3,ZodLiteral:A3,ZodMap:ih,ZodNaN:oh,ZodNativeEnum:b3,ZodNever:Xo,ZodNull:g3,ZodNullable:Ys,ZodNumber:Zs,ZodObject:ca,ZodOptional:Qi,ZodParsedType:Qu,ZodPipeline:Fd,ZodPromise:uE,ZodReadonly:S3,ZodRecord:k3,ZodSchema:Ue,ZodSet:g1,ZodString:oi,ZodSymbol:nh,ZodTransformer:Pr,ZodTuple:no,ZodType:Ue,ZodUndefined:p3,ZodUnion:C3,ZodUnknown:e1,ZodVoid:rh,addIssueToContext:Hu,any:jU,array:De,bigint:MU,boolean:cu,coerce:ce,custom:R2,date:us,datetimeRegex:eS,default:q,defaultErrorMap:Y4,discriminatedUnion:Oe,effect:Dp,enum:tr,function:KU,getErrorMap:ah,getParsedType:yo,instanceof:OU,intersection:aS,isAborted:cp,isAsync:x3,isDirty:dp,isValid:f1,late:zU,lazy:j0,literal:J,makeIssue:th,map:_U,nan:wU,nativeEnum:Ku,never:NU,null:Qe,nullable:HU,number:uu,object:S,get objectUtil(){return Ep},oboolean:UU,onumber:WU,optional:VU,ostring:JU,pipeline:GU,preprocess:z3,promise:$U,quotelessJson:FU,record:$u,set:IU,setErrorMap:vU,strictObject:LU,string:k,symbol:TU,transformer:Dp,tuple:C1,undefined:PU,union:ma,unknown:Le,get util(){return x0},void:RU,z:q},Symbol.toStringTag,{value:"Module"})),mvu=S({channel:k().min(1,"Channel is required"),tag:k().min(1,"Tag is required"),filePath:k().min(1,"File path is required")});function xvu({onUploaded:e}){const u=Ci(),[a,t]=C.useState(!1),n=pd({mode:"onChange",resolver:gd(mvu),defaultValues:{channel:"",tag:"",filePath:""}}),[r,i]=Ws(async l=>{try{await u("/api/assets/upload-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channel:l.channel.trim(),tag:l.tag.trim(),filePath:l.filePath.trim()})}),Ca.success("Asset uploaded"),t(!1),n.reset(),e==null||e()}catch(E){Ca.error("Upload failed",{description:String(E)})}},[n]),{isDirty:o,isValid:s}=n.formState;return d.jsxs(bE,{open:a,onOpenChange:t,children:[d.jsx(yE,{asChild:!0,children:d.jsx(Ve,{children:"Upload asset"})}),d.jsxs(_1,{children:[d.jsxs(I1,{children:[d.jsx(K1,{children:"Upload APK"}),d.jsx($1,{children:"Provide channel, tag, and local file path to upload."})]}),d.jsx(Cd,{...n,children:d.jsxs("form",{onSubmit:n.handleSubmit(i),className:"space-y-4",children:[d.jsx(_0,{control:n.control,name:"channel",render:({field:l})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Channel"}),d.jsx(T0,{children:d.jsx(SE,{placeholder:"stable, beta, dev...",value:l.value,onChange:l.onChange})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:n.control,name:"tag",render:({field:l})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Tag"}),d.jsx(T0,{children:d.jsx(gt,{placeholder:"v1.2.3",value:l.value,onChange:E=>l.onChange(E.target.value.toLowerCase())})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:n.control,name:"filePath",render:({field:l})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Local file path"}),d.jsx(T0,{children:d.jsx(gt,{placeholder:"/Users/you/Downloads/app.apk",...l})}),d.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Path must be readable by the local server process."}),d.jsx(P0,{})]})}),d.jsx(BE,{children:d.jsx(Ve,{type:"submit",disabled:r.loading||!o||!s,children:r.loading?d.jsxs(d.Fragment,{children:[d.jsx(n8,{className:"h-4 w-4 animate-spin"})," Uploading..."]}):"Upload"})})]})})]})]})}const fvu=[{accessorKey:"channel",header:({column:e})=>d.jsx(Jn,{column:e,title:"Channel"}),meta:{className:"w-full"}},{accessorKey:"tag",header:({column:e})=>d.jsx(Jn,{column:e,title:"Tag"}),meta:{className:"min-w-[150px]"}},{accessorKey:"md5",header:({column:e})=>d.jsx(Jn,{column:e,title:"MD5 hash"}),meta:{className:"truncate"},cell:({row:e})=>d.jsx("div",{className:"text-muted-foreground truncate",children:e.original.md5})},{accessorKey:"createdAt",header:({column:e})=>d.jsx(Jn,{column:e,title:"Updated at"}),cell:({row:e})=>d.jsx("div",{className:"text-muted-foreground",children:d.jsx(up,{date:e.original.createdAt})})}];function pvu(){const{data:e={assets:[]},mutate:u}=ns("/api/assets"),[a,t]=C.useState("all"),[n,r]=C.useState([{id:"createdAt",desc:!0}]),i=C.useMemo(()=>e.assets.map(E=>({channel:E.channel,tag:E.tag,createdAt:new Date(E.createdAt),md5:E.md5})),[e]),o=C.useMemo(()=>{const E=new Set;for(const c of i)E.add(c.channel);return Array.from(E).sort()},[i]),s=C.useMemo(()=>a==="all"?i:i.filter(E=>E.channel===a),[i,a]),l=T8({data:s,columns:fvu,getCoreRowModel:w8(),getSortedRowModel:M8(),onSortingChange:r,initialState:{pagination:{pageIndex:0,pageSize:50}},state:{sorting:n}});return d.jsxs("div",{className:"flex h-full flex-1 flex-col overflow-auto",children:[d.jsxs("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[d.jsx(hm,{children:d.jsx(mm,{children:d.jsx(Ro,{children:d.jsx(m3,{children:"Assets"})})})}),d.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[d.jsxs(Ka,{value:a,onValueChange:E=>t(E),children:[d.jsxs(Oa,{className:"w-fit space-x-2",children:[d.jsx("span",{className:"text-muted-foreground",children:"Channel:"}),d.jsx($a,{placeholder:"Select channel"})]}),d.jsxs(wa,{children:[d.jsx(Re,{value:"all",children:"All"}),o.map(E=>d.jsx(Re,{value:E,children:E},E))]})]}),d.jsx(xvu,{onUploaded:()=>u()})]})]}),d.jsx("div",{className:"flex flex-1 flex-col gap-4 p-4",children:d.jsx(OJ,{table:l,hidePagination:!0})})]})}const nS=(e,u)=>{const a=Ci();return ns(["/api/folders",...e],([t,...n])=>a(t,{method:"POST",body:JSON.stringify({pathSegments:n}),headers:{"Content-Type":"application/json"}}),u)},km=async e=>{const u=e.length?e:["."];await a8(["/api/folders",...u])},gvu=S({name:k().min(1)}),Cvu=e=>{const u=Ci(),[a,t]=C.useState(!1),n=pd({mode:"onChange",resolver:gd(gvu),defaultValues:{name:""}}),[r,i]=Ws(async l=>{const E={pathSegments:[...e.pathSegments,l.name]};try{await u("/api/folders",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}),t(!1)}catch(c){Ca.error("Failed to create folder.",{description:`${c}`})}km(e.pathSegments)},[e.pathSegments]),{isDirty:o,isValid:s}=n.formState;return C.useEffect(()=>{n.reset()},[n,a]),d.jsxs(bE,{open:a,onOpenChange:t,children:[d.jsx(yE,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",children:[d.jsx(im,{className:"h-4 w-4"}),"Create folder"]})}),d.jsxs(_1,{children:[d.jsxs(I1,{children:[d.jsx(K1,{children:"Create folder"}),d.jsx($1,{children:"Create a new folder"})]}),d.jsx(Cd,{...n,children:d.jsxs("form",{onSubmit:n.handleSubmit(i),className:"space-y-4",children:[d.jsx(_0,{control:n.control,name:"name",render:({field:l})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Name"}),d.jsx(T0,{children:d.jsx(gt,{placeholder:"Folder name",...l})}),d.jsx(P0,{})]})}),d.jsx(BE,{children:d.jsx(Ve,{type:"submit",disabled:r.loading||!o||!s,children:"Create folder"})})]})})]})]})},Fvu=e=>ns("/api/settings",e);function kvu(e){const u=e.trim();if(!u)return[];let a=u;return a.startsWith("./")&&(a=a.slice(2)),a.split("/").filter(Boolean)}const ZU=()=>{const{data:e}=Fvu();return C.useMemo(()=>{const u=kvu((e==null?void 0:e.displayRoot)??""),a=u.length>0&&u[0]!==".";return{rootPathSegments:u,hasCustomRoot:a}},[e==null?void 0:e.displayRoot])};S({input:k(),agentConfigVersion:k().optional()});S({srcs:De(k()),urls:De(k()),desiredSrc:k().optional(),desiredUrl:k().optional()});S({srcRegex:k().optional(),urlRegex:k().optional()});S({x:uu(),y:uu(),correlation:uu()});S({searchImageBase64String:k(),pageImageBase64String:k(),id:k().uuid(),timeoutMs:uu().max(1e4).min(0).optional()});function Fi(e){if(typeof e.ZodType.prototype.openapi<"u")return;e.ZodType.prototype.openapi=function(n){return new this.constructor({...this._def,openapi:n})};const u=e.ZodObject.prototype.extend;e.ZodObject.prototype.extend=function(...n){const r=u.apply(this,n);return r._def.extendMetadata={extends:this},delete r._def.openapi,r};const a=e.ZodObject.prototype.omit;e.ZodObject.prototype.omit=function(...n){const r=a.apply(this,n);return delete r._def.extendMetadata,delete r._def.openapi,r};const t=e.ZodObject.prototype.pick;e.ZodObject.prototype.pick=function(...n){const r=t.apply(this,n);return delete r._def.extendMetadata,delete r._def.openapi,r}}Fi(kd);var rS=(e=>(e.AI="AI",e.AI_HEALED="AI_HEALED",e.CLICK_TO_FIND="CLICK_TO_FIND",e.XY_PERCENT="XY_PERCENT",e.RECORDING="RECORDING",e.USER_CSS_SELECTOR="USER_CSS_SELECTOR",e.HEURISTIC_HEALED="HEURISTIC_HEALED",e))(rS||{});const vvu=S({mPathSelectorTokens:k().array(),frameSrcRegex:k().optional(),frameUrlRegex:k().optional(),indices:uu().array()}),iS=S({result:uu(),traceId:k()}).array(),vm=S({type:J("GCS_TRACES"),traces:iS});var ro=(e=>(e.PRECISE="precise",e.NARROW="narrow",e.BROAD="broad",e.IRRELEVANT="irrelevant",e))(ro||{});const QU=S({attributes:$u(k(),k()).optional(),text:k().optional(),position:S({x1:uu(),y1:uu(),x2:uu(),y2:uu(),tolerance:Ku(ro)}).optional(),shape:S({width:uu(),height:uu(),tolerance:Ku(ro)}).optional(),boundingBox:S({x:uu(),y:uu(),width:uu(),height:uu()}).optional()}),Avu=S({selectors:k().array(),requirements:QU.optional()}),sh=S({id:uu().int(),dataMomenticId:uu().int().optional(),selector:k().optional(),hybridSelector:S({textContent:k().nullish(),attributes:$u(k(),k().optional()),tagName:k(),expandShadowRoot:cu().optional(),classNames:k().array(),nthChild:uu()}).array().optional(),generatedSelectors:k().array().optional(),requirements:QU.optional(),additionalElements:Avu.array().optional(),role:k().optional(),name:k().optional(),numChildren:uu().optional(),content:k().optional(),pathFromRoot:k().optional(),serializedHtml:k().optional().describe("pruned html including 1 neighbor and 1 layer of children. value for text inputs pruned."),nodeOnlySerializedHtml:k().optional().describe("outerHtml of the element without any children. value for text inputs pruned."),screenshotUrl:k().url().optional(),boundingBox:S({x:uu().optional(),y:uu().optional(),width:uu(),height:uu()}).describe("css pixel bounding box").optional(),frameCache:vvu.optional(),inputDescription:k().optional().describe("the description that generated this cache"),targetSource:Ku(rS).optional(),targetUpdateTime:k().optional(),targetUpdateLoggerTags:$u(k(),k()).optional(),cacheResolutionUpdateSource:k().optional(),cacheResolutionUpdateTime:k().optional(),cacheResolutionUpdateLoggerTags:$u(k(),k()).optional(),memory:vm.optional()}).openapi({ref:"ElementTargetCache"}),bvu=S({type:J("description"),elementDescriptor:k().describe("Description of the element.")}).openapi({ref:"DescriptionTarget"}),yvu=S({x:uu(),y:uu()}),Bvu=S({type:J("coordinates"),pixels:yvu}).openapi({ref:"CoordinatesTarget"}),jn=Oe("type",[bvu,Bvu]).openapi({ref:"ElementTarget"});let yx;const Svu=new Uint8Array(16);function zvu(){if(!yx&&(yx=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!yx))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yx(Svu)}const Rt=[];for(let e=0;e<256;++e)Rt.push((e+256).toString(16).slice(1));function Ovu(e,u=0){return Rt[e[u+0]]+Rt[e[u+1]]+Rt[e[u+2]]+Rt[e[u+3]]+"-"+Rt[e[u+4]]+Rt[e[u+5]]+"-"+Rt[e[u+6]]+Rt[e[u+7]]+"-"+Rt[e[u+8]]+Rt[e[u+9]]+"-"+Rt[e[u+10]]+Rt[e[u+11]]+Rt[e[u+12]]+Rt[e[u+13]]+Rt[e[u+14]]+Rt[e[u+15]]}const wvu=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),iP={randomUUID:wvu};function _a(e,u,a){if(iP.randomUUID&&!u&&!e)return iP.randomUUID();e=e||{};const t=e.random||(e.rng||zvu)();if(t[6]=t[6]&15|64,t[8]=t[8]&63|128,u){a=a||0;for(let n=0;n<16;++n)u[a+n]=t[n];return u}return Ovu(t)}const oS=q.object({updatedAt:q.coerce.date().optional()}),sS=S({result:cu(),traceId:k()}).array(),lS=S({type:J("GCS_TRACES"),traces:sS}),ES=oS.extend({memory:lS.optional()});Fi(q);S({thoughts:k(),result:cu(),relevantElements:De(uu()).optional(),updatedMemory:sS.optional()});var ia=(e=>(e.CONTAINS="CONTAINS",e.STARTS_WITH="STARTS_WITH",e.EQUALS="EQUALS",e.EXISTS="EXISTS",e))(ia||{});const fb=["EQUALS","CONTAINS","STARTS_WITH","EXISTS"],Mvu=e=>fb.some(u=>u===e);var H0=(e=>(e.ELEMENT_CONTENT="ELEMENT_CONTENT",e.ELEMENT_NAME="ELEMENT_NAME",e.ELEMENT_STYLE="ELEMENT_STYLE",e.ELEMENT_ATTRIBUTE="ELEMENT_ATTRIBUTE",e.ELEMENT_EXISTENCE="ELEMENT_EXISTENCE",e))(H0||{});const Tvu=e=>qU.some(u=>u===e),Pvu={ELEMENT_CONTENT:"Content",ELEMENT_ATTRIBUTE:"Attribute",ELEMENT_EXISTENCE:"Element",ELEMENT_NAME:"Tag name",ELEMENT_STYLE:"Computed style"},qU=["ELEMENT_CONTENT","ELEMENT_ATTRIBUTE","ELEMENT_EXISTENCE","ELEMENT_NAME","ELEMENT_STYLE"],jvu=S({type:J("ELEMENT_NAME"),negated:cu().optional(),operation:Ku(ia),value:k()}).openapi({ref:"ElementNameAssertion"}),Nvu=S({type:J("ELEMENT_STYLE"),negated:cu().optional(),operation:Ku(ia),property:k(),value:k()}).openapi({ref:"ElementStyleAssertion"}),Rvu=S({type:J("ELEMENT_CONTENT"),negated:cu().optional(),operation:Ku(ia),value:k()}).openapi({ref:"ElementContentAssertion"}),Lvu=S({type:J("ELEMENT_ATTRIBUTE"),negated:cu().optional(),operation:Ku(ia),attr:k(),value:k()}).openapi({ref:"ElementAttributeValueAssertion"});var sn=(e=>(e.EXISTS="EXISTS",e.VISIBLE="VISIBLE",e.ENABLED="ENABLED",e.EDITABLE="EDITABLE",e.FOCUSED="FOCUSED",e))(sn||{});const _vu=e=>YU.some(u=>u===e),YU=["EXISTS","VISIBLE","ENABLED","EDITABLE","FOCUSED"],Ivu=S({type:J("ELEMENT_EXISTENCE"),negated:cu().optional(),condition:Ku(sn).describe("Treated as the element exists AND is also ...")}).openapi({ref:"ElementExistenceAssertion"}),XU=Oe("type",[Rvu,Lvu,Ivu,jvu,Nvu]).openapi({ref:"ManualElementAssertion"});var uZ=(e=>(e.CONTENT="CONTENT",e))(uZ||{});const Kvu=S({type:J("CONTENT"),negated:cu().optional(),value:k()}).openapi({ref:"PageContentAssertion"}),$vu=Oe("type",[Kvu]).openapi({ref:"ManualPageAssertion"}),eZ=q.discriminatedUnion("type",[q.object({type:q.literal("SUBSTRING"),url:q.string()}),q.object({type:q.literal("GLOB"),glob:q.string()}),q.object({type:q.literal("REGEX"),regex:q.string()}),q.object({type:q.literal("DOMAIN"),domain:q.string()})]),L2=q.object({urlMatcher:eZ,method:q.string().optional()});var lr=(e=>(e.JSON="json",e.FORM_URLENCODED="form-urlencoded",e))(lr||{});const Vvu=S({type:J("json"),content:k().describe("The JSON content to send in the request body")}),Hvu=S({type:J("form-urlencoded"),content:$u(k(),k()).describe("The form fields to send in the request body")}),Gvu=Oe("type",[Vvu,Hvu]),cS=S({url:k(),method:ma([J("GET"),J("POST"),J("PUT"),J("DELETE"),J("PATCH")]),headers:$u(k(),k()).optional(),params:$u(k(),k()).optional(),body:Gvu.optional(),timeout:uu().int().optional().describe("Max seconds to wait for the request to complete")}),Jvu=S({url:k(),headers:$u(k(),k()).optional(),query:k(),variables:k().optional(),timeout:uu().int().optional().describe("Max seconds to wait for the request to complete")}),aZ=S({code:k(),fragment:cu().optional().describe("Agents should not touch this unless explicitly told to"),environment:ma([J("NODE"),J("BROWSER")]).optional().describe("default NODE, Agents default to using node unless it is necessary to use browser"),timeout:uu().int().max(60).optional().describe("Max seconds for the code to complete")});var Z=(e=>(e.AI_EXTRACT="AI_EXTRACT",e.AI_ASSERTION="AI_ASSERTION",e.AUTH_LOAD="AUTH_LOAD",e.AUTH_SAVE="AUTH_SAVE",e.BLUR="BLUR",e.CAPTCHA="CAPTCHA",e.CLICK="CLICK",e.COOKIE="COOKIE",e.COPY="COPY",e.DIALOG="DIALOG",e.DRAG="DRAG",e.ELEMENT_CHECK="ELEMENT_CHECK",e.FILE_UPLOAD="FILE_UPLOAD",e.FOCUS="FOCUS",e.GO_BACK="GO_BACK",e.GO_FORWARD="GO_FORWARD",e.HOVER="HOVER",e.JAVASCRIPT="JAVASCRIPT",e.LOCAL_STORAGE="LOCAL_STORAGE",e.MOUSE_DRAG="MOUSE_DRAG",e.NAVIGATE="NAVIGATE",e.NEW_TAB="NEW_TAB",e.PAGE_CHECK="PAGE_CHECK",e.PASTE="PASTE",e.PRESS="PRESS",e.KEY_DOWN="KEY_DOWN",e.KEY_UP="KEY_UP",e.REFRESH="REFRESH",e.REQUEST="REQUEST",e.GRAPHQL_REQUEST="GRAPHQL_REQUEST",e.SCROLL_DOWN="SCROLL_DOWN",e.SCROLL_UP="SCROLL_UP",e.SCROLL_LEFT="SCROLL_LEFT",e.SCROLL_RIGHT="SCROLL_RIGHT",e.SELECT_OPTION="SELECT_OPTION",e.SWITCH_TAB="TAB",e.TYPE="TYPE",e.VISUAL_DIFF="VISUAL_DIFF",e.WAIT="WAIT",e.WAIT_FOR_URL="WAIT_FOR_URL",e.REGISTER_REQUEST_LISTENER="REGISTER_REQUEST_LISTENER",e.AWAIT_LISTENER="AWAIT_LISTENER",e.RECORD_REQUESTS="RECORD_REQUESTS",e.GET_RECORDED_REQUESTS="GET_RECORDED_REQUESTS",e.SET_HEADER="SET_HEADER",e.MOCK_ROUTE="MOCK_ROUTE",e.REMOVE_ROUTE_MOCK="REMOVE_ROUTE_MOCK",e.OFFLINE_MODE="OFFLINE_MODE",e.SUCCESS="SUCCESS",e))(Z||{});Fi(kd);const Ne=S({thoughts:k().optional(),id:k().uuid().describe("unique identifier to this step, used for step cache")}),ki=S({useSelector:cu().optional(),force:cu().optional(),disableCache:cu().optional().describe("disable element caching for this step"),iframeUrl:k().optional().describe("url or url regex for the iframe")}).openapi({ref:"CommonTargetingOptions"}),is=oS.extend({target:sh}).optional().openapi({ref:"SingleTargetCache"}),_2=S({loadTimeout:uu().int().max(60).optional().describe("Max seconds for the page to load")}),tZ=Ne.merge(_2).merge(S({type:J("NAVIGATE"),url:k()})).openapi({ref:"NavigateCommand"}),I2=ki.merge(S({cache:is})),Am=Ne.merge(I2.merge(S({target:jn.optional(),type:J("SCROLL_UP"),deltaY:uu().optional()}))).openapi({ref:"ScrollUpCommand"}),bm=Ne.merge(I2.merge(S({target:jn.optional(),type:J("SCROLL_DOWN"),deltaY:uu().optional()}))).openapi({ref:"ScrollDownCommand"}),K2=Ne.merge(I2.merge(S({target:jn.optional(),type:J("SCROLL_LEFT"),deltaX:uu().optional()}))).openapi({ref:"ScrollLeftCommand"}),$2=Ne.merge(I2.merge(S({target:jn.optional(),type:J("SCROLL_RIGHT"),deltaX:uu().optional()}))).openapi({ref:"ScrollRightCommand"});Oe("type",[Am,bm,K2,$2]).openapi({ref:"AllScrollCommands"});const Wvu=Ne.merge(S({type:J("DIALOG"),action:ma([J("ACCEPT"),J("DISMISS")])})).openapi({ref:"DialogCommand"}),nZ=Ne.merge(S({type:J("WAIT"),delay:uu()})).openapi({ref:"WaitCommand"}),Uvu=S({caseInsensitive:cu().optional().describe("Whether to ignore case when matching the URL"),negated:cu().optional().describe("Wait for the URL to NOT match the provided matcher instead."),timeout:uu().int().optional().describe("Max seconds to wait for the URL to match")}),rZ=Ne.extend({type:J("WAIT_FOR_URL"),matcher:eZ}).merge(Uvu).openapi({ref:"WaitUrlCommand"}),iZ=Ne.merge(_2).merge(S({type:J("REFRESH")})).openapi({ref:"RefreshCommand"}),oZ=Ne.merge(S({type:J("GO_BACK")})).openapi({ref:"GoBackCommand"}),sZ=Ne.merge(S({type:J("GO_FORWARD")})).openapi({ref:"GoForwardCommand"}),Zvu=Ne.extend({type:J("AUTH_SAVE")}).openapi({ref:"AuthSaveCommand"}),Qvu=Ne.extend({type:J("AUTH_LOAD"),storageState:k().describe("JSON string auth state. Leave blank or set to the empty string to clear all existing authentication.")}).openapi({ref:"AuthLoadCommand"}),lZ=Ne.merge(ki).extend({type:J("CAPTCHA")}).openapi({ref:"CaptchaCommand"}),EZ=Ne.extend({type:J("COPY"),value:k()}).openapi({ref:"CopyCommand"}),cZ=Ne.extend({type:J("PASTE")}).openapi({ref:"PasteCommand"}),dZ=Ne.merge(aZ).extend({type:J("JAVASCRIPT")}).openapi({ref:"JavaScriptCommand"}),V2=Ne.merge(ki).extend({type:J("CLICK"),target:jn,doubleClick:cu().optional(),rightClick:cu().optional(),waitForDownload:cu().optional().describe("Wait for the click to trigger a file download and for the file download to complete."),delayMs:uu().optional(),downloadTimeoutMs:uu().optional(),cache:is,relativePosition:S({x:uu(),y:uu()}).optional()}).openapi({ref:"ClickCommand"}),qvu=oS.extend({fromTarget:sh.optional(),toTarget:sh.optional()}),H2=Ne.merge(ki).merge(S({type:J("DRAG"),fromTarget:jn,toTarget:jn,steps:uu().optional(),hoverSeconds:uu().optional().describe("Seconds to hover the object before dropping"),cache:qvu.optional()})).openapi({ref:"DragCommand"}),G2=Ne.merge(ki).merge(S({type:J("MOUSE_DRAG"),target:jn.optional(),deltaX:k().describe("pixels to move horizontally, can be template"),deltaY:k().describe("pixels to move vertically, can be template"),steps:uu().optional(),cache:is})).openapi({ref:"MouseDragCommand"}),J2=Ne.merge(ki).merge(S({type:J("HOVER"),target:jn,cache:is})).openapi({ref:"HoverCommand"}),dS=Ne.merge(ki).merge(S({type:J("FOCUS"),target:jn,cache:is})).openapi({ref:"FocusCommand"}),DS=Ne.merge(ki).extend({type:J("BLUR"),target:jn.optional(),cache:is}).openapi({ref:"BlurCommand"}),Yvu=S({type:J("URL"),url:k()}).describe("Accessible link to the file, either public http or local file://").openapi({ref:"UrlSource"}),Xvu=S({type:J("USER_FILE"),name:k()}).describe("Accessible link to the file, references the google cloud file").openapi({ref:"UploadedFileSource"}),uAu=Ne.extend({type:J("FILE_UPLOAD"),fileSource:Oe("type",[Yvu,Xvu]),filename:k().optional()}).openapi({ref:"FileUploadCommand"}),eAu=Oe("type",[S({type:J("VALUE"),value:k()}),S({type:J("LABEL"),label:k()}),S({type:J("INDEX"),index:ce.string()})]),W2=Ne.merge(ki).extend({type:J("SELECT_OPTION"),target:jn,cache:is,choice:eAu.describe("new field for selecting options, optional for backcompat")}).openapi({ref:"SelectOptionCommand"}),DZ=ma([J("MULTIMODAL"),J("VISION_ONLY")]),U2=Ne.merge(S({type:J("AI_ASSERTION"),assertion:k(),disableCache:cu().optional(),iframeUrl:k().optional(),contextChoice:DZ.optional(),timeout:uu().int().optional().describe("Max seconds to wait for assertion to be true"),cache:ES.optional()})).openapi({ref:"AIAssertionCommand"}),Z2=600,Q2=Ne.merge(ki).extend({type:J("ELEMENT_CHECK"),target:jn,assertion:XU,cache:is.or(ES).optional(),timeout:uu().int().min(0).max(Z2).optional().describe("max seconds to wait for the assertion to be true")}).openapi({ref:"ElementAssertionCommand"}),hZ=Ne.extend({type:J("PAGE_CHECK"),assertion:$vu,iframeUrl:k().optional().describe("url or url regex for the iframe"),timeout:uu().int().min(0).max(Z2).optional().describe("max seconds to wait for the assertion to be true")}).openapi({ref:"PageAssertionCommand"}),mZ=Ne.merge(S({type:J("AI_EXTRACT"),goal:k(),schema:k().optional(),envKey:k().optional(),disableCache:cu().optional(),iframeUrl:k().optional()})).openapi({ref:"AIExtractCommand"}),aAu=S({clearContent:cu().optional(),forceClearContent:cu().optional(),delay:uu().min(0).max(1e3).optional().describe("Delay between each press in milliseconds."),force:cu().optional(),pressEnter:cu().optional(),relativePosition:S({x:uu(),y:uu()}).optional()}),q2=Ne.merge(ki).merge(aAu).extend({type:J("TYPE"),target:jn.optional(),value:k(),cache:is}).openapi({ref:"TypeCommand"}),xZ=Ne.merge(S({type:J("PRESS"),value:k(),repeat:uu().optional(),convertMeta:cu().optional(),delayMs:uu().optional()})).openapi({ref:"PressCommand"}),fZ=Ne.merge(S({type:J("KEY_DOWN"),value:k(),convertMeta:cu().optional()})).openapi({ref:"KeyDownCommand"}),pZ=Ne.merge(S({type:J("KEY_UP"),value:k(),convertMeta:cu().optional()})).openapi({ref:"KeyUpCommand"}),tAu=S({type:J("SUBSTRING"),substring:k()}),nAu=S({type:J("REGEX"),pattern:k()}),rAu=S({type:J("INDEX"),index:ce.string()}),iAu=Oe("type",[tAu,nAu,rAu]),oAu=Ne.merge(_2).merge(S({type:J("TAB"),action:iAu})).openapi({ref:"TabCommand"}),gZ=Ne.merge(_2).merge(S({type:J("NEW_TAB"),url:k()})).openapi({ref:"NewTabCommand"}),sAu=Ne.merge(S({type:J("COOKIE"),value:k()})).openapi({ref:"CookieCommand"}),CZ=Ne.merge(S({type:J("LOCAL_STORAGE"),key:k(),value:k()})).openapi({ref:"LocalStorageCommand"}),FZ=Ne.extend({type:J("REQUEST")}).merge(cS).openapi({ref:"RequestCommand"});S({status:uu().optional(),headers:$u(k(),k()),json:Le().optional(),text:k().optional(),cookies:$u(k(),Le()).array().optional(),request:S({url:k(),method:k(),headers:$u(k(),k()),json:Le().optional()})});const kZ=Ne.extend({type:J("GRAPHQL_REQUEST")}).merge(Jvu).openapi({ref:"GraphQLRequestCommand"}),vZ=Ne.merge(S({type:J("SUCCESS"),condition:U2.optional()})).openapi({ref:"SuccessCommand"}),AZ=Ne.merge(S({type:J("FAILURE")})).openapi({ref:"FailureCommand"}),lAu=S({data:k().describe("location at which to find a jpg"),width:uu(),height:uu()}),hS=Ne.merge(ki).merge(S({type:J("VISUAL_DIFF"),threshold:uu().optional().describe("default 0.1"),target:jn.optional(),screenshot:lAu.optional(),cache:is})).openapi({ref:"VisualDiffCommand"}),EAu=Ne.merge(S({type:J("REGISTER_REQUEST_LISTENER"),requestMatcher:L2,key:k()})).openapi({ref:"RegisterRequestListenerCommand"}),cAu=Ne.merge(S({type:J("AWAIT_LISTENER"),key:k(),timeout:uu().optional().describe("timeout")})).openapi({ref:"WaitForListenerCommand"}),dAu=Ne.merge(S({type:J("RECORD_REQUESTS"),requestMatcher:L2,key:k()})).openapi({ref:"RecordRequestsCommand"}),DAu=Ne.merge(S({type:J("GET_RECORDED_REQUESTS"),key:k()})).openapi({ref:"GetRecordedRequestsCommand"}),hAu=Ne.merge(S({type:J("SET_HEADER"),name:k(),value:k(),requestMatcher:L2.optional()})).openapi({ref:"SetHeaderCommand"}),mAu=Ne.merge(S({type:J("MOCK_ROUTE"),requestMatcher:L2,responseGenerator:k().describe("JavaScript code to generate a response"),fetchOriginalResponse:cu().optional().describe("Whether to fetch the real response and pass it to the response generator. If enabled, the original response will be available as `response` in the code."),key:k().optional().describe("Key to reference this mock. This only needs to be set if you plan to remove the mock later in the test.")}).openapi({ref:"MockRouteCommandOptions"})),xAu=Ne.merge(S({type:J("REMOVE_ROUTE_MOCK"),key:k().optional().describe("Key of the mock to remove. If not set, all route mocks will be removed.")}).openapi({ref:"RemoveRouteMockCommandOptions"})),fAu=Ne.merge(S({type:J("OFFLINE_MODE"),enable:cu()})).openapi({ref:"OfflineModeCommand"}),pAu=Oe("type",[V2,q2,xZ,fZ,pZ,W2,tZ,bm,Am,U2,oZ,J2,nZ]),gAu=Oe("type",[...pAu.options,H2]),CAu=Oe("type",[...gAu.options]),bZ=Oe("type",[...CAu.options,vZ]),yZ=Oe("type",[vZ,V2,q2,xZ,fZ,pZ,W2,tZ,bm,Am,U2,oZ,J2,nZ,dZ,Q2,hZ,gZ,rZ,mZ,EZ,sZ,CZ,H2,G2,cZ,iZ,FZ,kZ]),FAu=Oe("type",[mZ,Qvu,Zvu,lZ,sAu,EZ,Wvu,Q2,uAu,sZ,dZ,CZ,G2,gZ,hZ,cZ,iZ,FZ,kZ,K2,$2,oAu,hS,dS,DS,rZ,EAu,cAu,dAu,DAu,hAu,mAu,xAu,fAu]),mS=Oe("type",[...bZ.options,...FAu.options]).openapi({ref:"Command"}),kAu=Oe("type",[...bZ.options,AZ]);Oe("type",[...yZ.options,AZ]);Oe("type",[DS,lZ,V2,H2,dS,J2,G2,Am,bm,K2,$2,W2,q2,hS,Q2]);function xS(e){return S({key:k(),testId:k().optional(),moduleId:k().optional(),organizationId:k(),value:e})}function fS(e){return xS(e).extend({uniqueKey:k()})}function BZ(e){return $u(k(),fS(e))}const gn={type:!0,cache:!0},Y2=Oe("type",[U2.pick(gn),DS.pick(gn),V2.pick(gn),H2.pick(gn),Q2.pick(gn),dS.pick(gn),J2.pick(gn),G2.pick(gn),Am.pick(gn),bm.pick(gn),K2.pick(gn),$2.pick(gn),W2.pick(gn),q2.pick(gn),hS.pick(gn)]),vAu=Object.values(Z).filter(e=>Y2.options.some(u=>u.shape.type.safeParse(e).success));mS.options.forEach(e=>{if("target"in e.shape&&!vAu.includes(e.shape.type.value))throw new Error(`Command ${e.shape.type.value} has a target but no cache`)});const AAu=xS(Y2),bAu=fS(Y2);BZ(Y2);const yAu=Symbol("Let zodToJsonSchema decide on which parser to use"),oP={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},BAu=e=>typeof e=="string"?{...oP,name:e}:{...oP,...e},SAu=e=>{const u=BAu(e),a=u.name!==void 0?[...u.basePath,u.definitionPath,u.name]:u.basePath;return{...u,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(u.definitions).map(([t,n])=>[n._def,{def:n._def,path:[...u.basePath,u.definitionPath,t],jsonSchema:void 0}]))}};function SZ(e,u,a,t){t!=null&&t.errorMessages&&a&&(e.errorMessage={...e.errorMessage,[u]:a})}function K0(e,u,a,t,n){e[u]=a,SZ(e,u,t,n)}const zZ=(e,u)=>{let a=0;for(;a<e.length&&a<u.length&&e[a]===u[a];a++);return[(e.length-a).toString(),...u.slice(a)].join("/")};function nr(e){if(e.target!=="openAi")return{};const u=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?zZ(u,e.currentPath):u.join("/")}}function zAu(e,u){var t,n,r;const a={type:"array"};return(t=e.type)!=null&&t._def&&((r=(n=e.type)==null?void 0:n._def)==null?void 0:r.typeName)!==zu.ZodAny&&(a.items=z0(e.type._def,{...u,currentPath:[...u.currentPath,"items"]})),e.minLength&&K0(a,"minItems",e.minLength.value,e.minLength.message,u),e.maxLength&&K0(a,"maxItems",e.maxLength.value,e.maxLength.message,u),e.exactLength&&(K0(a,"minItems",e.exactLength.value,e.exactLength.message,u),K0(a,"maxItems",e.exactLength.value,e.exactLength.message,u)),a}function OAu(e,u){const a={type:"integer",format:"int64"};if(!e.checks)return a;for(const t of e.checks)switch(t.kind){case"min":u.target==="jsonSchema7"?t.inclusive?K0(a,"minimum",t.value,t.message,u):K0(a,"exclusiveMinimum",t.value,t.message,u):(t.inclusive||(a.exclusiveMinimum=!0),K0(a,"minimum",t.value,t.message,u));break;case"max":u.target==="jsonSchema7"?t.inclusive?K0(a,"maximum",t.value,t.message,u):K0(a,"exclusiveMaximum",t.value,t.message,u):(t.inclusive||(a.exclusiveMaximum=!0),K0(a,"maximum",t.value,t.message,u));break;case"multipleOf":K0(a,"multipleOf",t.value,t.message,u);break}return a}function wAu(){return{type:"boolean"}}function OZ(e,u){return z0(e.type._def,u)}const MAu=(e,u)=>z0(e.innerType._def,u);function wZ(e,u,a){const t=a??u.dateStrategy;if(Array.isArray(t))return{anyOf:t.map((n,r)=>wZ(e,u,n))};switch(t){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return TAu(e,u)}}const TAu=(e,u)=>{const a={type:"integer",format:"unix-time"};if(u.target==="openApi3")return a;for(const t of e.checks)switch(t.kind){case"min":K0(a,"minimum",t.value,t.message,u);break;case"max":K0(a,"maximum",t.value,t.message,u);break}return a};function PAu(e,u){return{...z0(e.innerType._def,u),default:e.defaultValue()}}function jAu(e,u){return u.effectStrategy==="input"?z0(e.schema._def,u):nr(u)}function NAu(e){return{type:"string",enum:Array.from(e.values)}}const RAu=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function LAu(e,u){const a=[z0(e.left._def,{...u,currentPath:[...u.currentPath,"allOf","0"]}),z0(e.right._def,{...u,currentPath:[...u.currentPath,"allOf","1"]})].filter(r=>!!r);let t=u.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const n=[];return a.forEach(r=>{if(RAu(r))n.push(...r.allOf),r.unevaluatedProperties===void 0&&(t=void 0);else{let i=r;if("additionalProperties"in r&&r.additionalProperties===!1){const{additionalProperties:o,...s}=r;i=s}else t=void 0;n.push(i)}}),n.length?{allOf:n,...t}:void 0}function _Au(e,u){const a=typeof e.value;return a!=="bigint"&&a!=="number"&&a!=="boolean"&&a!=="string"?{type:Array.isArray(e.value)?"array":"object"}:u.target==="openApi3"?{type:a==="bigint"?"integer":a,enum:[e.value]}:{type:a==="bigint"?"integer":a,const:e.value}}let Vk;const yi={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Vk===void 0&&(Vk=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Vk),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function MZ(e,u){const a={type:"string"};if(e.checks)for(const t of e.checks)switch(t.kind){case"min":K0(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,t.value):t.value,t.message,u);break;case"max":K0(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,t.value):t.value,t.message,u);break;case"email":switch(u.emailStrategy){case"format:email":Bi(a,"email",t.message,u);break;case"format:idn-email":Bi(a,"idn-email",t.message,u);break;case"pattern:zod":Cn(a,yi.email,t.message,u);break}break;case"url":Bi(a,"uri",t.message,u);break;case"uuid":Bi(a,"uuid",t.message,u);break;case"regex":Cn(a,t.regex,t.message,u);break;case"cuid":Cn(a,yi.cuid,t.message,u);break;case"cuid2":Cn(a,yi.cuid2,t.message,u);break;case"startsWith":Cn(a,RegExp(`^${Hk(t.value,u)}`),t.message,u);break;case"endsWith":Cn(a,RegExp(`${Hk(t.value,u)}$`),t.message,u);break;case"datetime":Bi(a,"date-time",t.message,u);break;case"date":Bi(a,"date",t.message,u);break;case"time":Bi(a,"time",t.message,u);break;case"duration":Bi(a,"duration",t.message,u);break;case"length":K0(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,t.value):t.value,t.message,u),K0(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,t.value):t.value,t.message,u);break;case"includes":{Cn(a,RegExp(Hk(t.value,u)),t.message,u);break}case"ip":{t.version!=="v6"&&Bi(a,"ipv4",t.message,u),t.version!=="v4"&&Bi(a,"ipv6",t.message,u);break}case"base64url":Cn(a,yi.base64url,t.message,u);break;case"jwt":Cn(a,yi.jwt,t.message,u);break;case"cidr":{t.version!=="v6"&&Cn(a,yi.ipv4Cidr,t.message,u),t.version!=="v4"&&Cn(a,yi.ipv6Cidr,t.message,u);break}case"emoji":Cn(a,yi.emoji(),t.message,u);break;case"ulid":{Cn(a,yi.ulid,t.message,u);break}case"base64":{switch(u.base64Strategy){case"format:binary":{Bi(a,"binary",t.message,u);break}case"contentEncoding:base64":{K0(a,"contentEncoding","base64",t.message,u);break}case"pattern:zod":{Cn(a,yi.base64,t.message,u);break}}break}case"nanoid":Cn(a,yi.nanoid,t.message,u)}return a}function Hk(e,u){return u.patternStrategy==="escape"?KAu(e):e}const IAu=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function KAu(e){let u="";for(let a=0;a<e.length;a++)IAu.has(e[a])||(u+="\\"),u+=e[a];return u}function Bi(e,u,a,t){var n;e.format||(n=e.anyOf)!=null&&n.some(r=>r.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&t.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:u,...a&&t.errorMessages&&{errorMessage:{format:a}}})):K0(e,"format",u,a,t)}function Cn(e,u,a,t){var n;e.pattern||(n=e.allOf)!=null&&n.some(r=>r.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&t.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:sP(u,t),...a&&t.errorMessages&&{errorMessage:{pattern:a}}})):K0(e,"pattern",sP(u,t),a,t)}function sP(e,u){var s;if(!u.applyRegexFlags||!e.flags)return e.source;const a={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},t=a.i?e.source.toLowerCase():e.source;let n="",r=!1,i=!1,o=!1;for(let l=0;l<t.length;l++){if(r){n+=t[l],r=!1;continue}if(a.i){if(i){if(t[l].match(/[a-z]/)){o?(n+=t[l],n+=`${t[l-2]}-${t[l]}`.toUpperCase(),o=!1):t[l+1]==="-"&&((s=t[l+2])!=null&&s.match(/[a-z]/))?(n+=t[l],o=!0):n+=`${t[l]}${t[l].toUpperCase()}`;continue}}else if(t[l].match(/[a-z]/)){n+=`[${t[l]}${t[l].toUpperCase()}]`;continue}}if(a.m){if(t[l]==="^"){n+=`(^|(?<=[\r
|
|
493
|
+
*/function Xf(e,u){return e?N2u(e)?C.createElement(e,u):e:null}function N2u(e){return R2u(e)||typeof e=="function"||L2u(e)}function R2u(e){return typeof e=="function"&&(()=>{const u=Object.getPrototypeOf(e);return u.prototype&&u.prototype.isReactComponent})()}function L2u(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function T8(e){const u={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[a]=C.useState(()=>({current:T2u(u)})),[t,n]=C.useState(()=>a.current.initialState);return a.current.setOptions(r=>({...r,...e,state:{...t,...e.state},onStateChange:i=>{n(i),e.onStateChange==null||e.onStateChange(i)}})),a.current}const hm=C.forwardRef(({...e},u)=>d.jsx("nav",{ref:u,"aria-label":"breadcrumb",...e}));hm.displayName="Breadcrumb";const mm=C.forwardRef(({className:e,...u},a)=>d.jsx("ol",{ref:a,className:lu("text-muted-foreground flex flex-wrap items-center gap-1.5 break-words text-sm sm:gap-2.5",e),...u}));mm.displayName="BreadcrumbList";const Ro=C.forwardRef(({className:e,...u},a)=>d.jsx("li",{ref:a,className:lu("inline-flex items-center gap-1.5",e),...u}));Ro.displayName="BreadcrumbItem";const QD=C.forwardRef(({asChild:e,className:u,...a},t)=>{const n=e?ol:"a";return d.jsx(n,{ref:t,className:lu("hover:text-foreground transition-colors",u),...a})});QD.displayName="BreadcrumbLink";const m3=C.forwardRef(({className:e,...u},a)=>d.jsx("span",{ref:a,role:"link","aria-disabled":"true","aria-current":"page",className:lu("text-foreground font-normal",e),...u}));m3.displayName="BreadcrumbPage";const qD=({children:e,className:u,...a})=>d.jsx("li",{role:"presentation","aria-hidden":"true",className:lu("[&>svg]:size-3.5",u),...a,children:e??d.jsx(rm,{})});qD.displayName="BreadcrumbSeparator";function _2u(e){return Emu(e,{addSuffix:!0})}const up=e=>{const{formatFn:u=_2u,disableTooltip:a=!1}=e,[t,n]=C.useState(null);return C.useEffect(()=>{n(e.date)},[e.date]),t?a?d.jsx("span",{className:lu("decoration-primary/20 whitespace-nowrap",e.className),children:u(t)}):d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx("span",{className:lu("decoration-primary/20 whitespace-nowrap underline decoration-dashed underline-offset-4",e.className),children:u(t)})}),d.jsx(n0,{children:Ixu(t)})]}):d.jsx("span",{children:V7})},GG=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{className:"relative w-full overflow-auto",children:d.jsx("div",{ref:a,className:lu("table w-full caption-bottom border-collapse text-sm",e),...u})}));GG.displayName="Table";const P8=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("table-header-group [&>div]:border-b",e),...u}));P8.displayName="TableHeader";const j8=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("table-row-group [&>:last-child]:border-0",e),...u}));j8.displayName="TableBody";const I2u=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("bg-muted/50 table-footer-group border-t font-medium [&>div]:last:border-b-0",e),...u}));I2u.displayName="TableFooter";const Xl=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("hover:bg-muted/50 data-[state=selected]:bg-muted table-row border-b transition-colors",e),...u}));Xl.displayName="TableRow";const tb=C.forwardRef(({className:e,asChild:u,...a},t)=>{const n=u?ol:"a";return d.jsx(n,{ref:t,className:lu("hover:bg-muted/50 data-[state=selected]:bg-muted table-row border-b transition-colors",e),...a})});tb.displayName="TableRowLink";const N8=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("text-muted-foreground table-cell h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...u}));N8.displayName="TableHead";const YD=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("table-cell p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...u}));YD.displayName="TableCell";const K2u=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{ref:a,className:lu("text-muted-foreground mt-4 table-caption text-sm",e),...u}));K2u.displayName="TableCaption";function _T(e,[u,a]){return Math.min(a,Math.max(u,e))}function R8(e){const u=e+"CollectionProvider",[a,t]=Tt(u),[n,r]=a(u,{collectionRef:{current:null},itemMap:new Map}),i=x=>{const{scope:p,children:f}=x,g=nu.useRef(null),F=nu.useRef(new Map).current;return d.jsx(n,{scope:p,itemMap:F,collectionRef:g,children:f})};i.displayName=u;const o=e+"CollectionSlot",s=c1(o),l=nu.forwardRef((x,p)=>{const{scope:f,children:g}=x,F=r(o,f),b=Xe(p,F.collectionRef);return d.jsx(s,{ref:b,children:g})});l.displayName=o;const E=e+"CollectionItemSlot",c="data-radix-collection-item",D=c1(E),h=nu.forwardRef((x,p)=>{const{scope:f,children:g,...F}=x,b=nu.useRef(null),y=Xe(p,b),v=r(E,f);return nu.useEffect(()=>(v.itemMap.set(b,{ref:b,...F}),()=>void v.itemMap.delete(b))),d.jsx(D,{[c]:"",ref:y,children:g})});h.displayName=E;function m(x){const p=r(e+"CollectionConsumer",x);return nu.useCallback(()=>{const g=p.collectionRef.current;if(!g)return[];const F=Array.from(g.querySelectorAll(`[${c}]`));return Array.from(p.itemMap.values()).sort((v,A)=>F.indexOf(v.ref.current)-F.indexOf(A.ref.current))},[p.collectionRef,p.itemMap])}return[{Provider:i,Slot:l,ItemSlot:h},m,t]}var $2u=C.createContext(void 0);function xd(e){const u=C.useContext($2u);return e||u||"ltr"}function C2(e){const u=C.useRef({value:e,previous:e});return C.useMemo(()=>(u.current.value!==e&&(u.current.previous=u.current.value,u.current.value=e),u.current.previous),[e])}var V2u=[" ","Enter","ArrowUp","ArrowDown"],H2u=[" ","Enter"],Q4="Select",[F2,k2,G2u]=R8(Q4),[fd,Z00]=Tt(Q4,[G2u,j1]),v2=j1(),[J2u,N1]=fd(Q4),[W2u,U2u]=fd(Q4),JG=e=>{const{__scopeSelect:u,children:a,open:t,defaultOpen:n,onOpenChange:r,value:i,defaultValue:o,onValueChange:s,dir:l,name:E,autoComplete:c,disabled:D,required:h,form:m}=e,x=v2(u),[p,f]=C.useState(null),[g,F]=C.useState(null),[b,y]=C.useState(!1),v=xd(l),[A,B]=hn({prop:t,defaultProp:n??!1,onChange:r,caller:Q4}),[j,R]=hn({prop:i,defaultProp:o,onChange:s,caller:Q4}),w=C.useRef(null),O=p?m||!!p.closest("form"):!0,[T,z]=C.useState(new Set),N=Array.from(T).map(M=>M.props.value).join(";");return d.jsx(D2,{...x,children:d.jsxs(J2u,{required:h,scope:u,trigger:p,onTriggerChange:f,valueNode:g,onValueNodeChange:F,valueNodeHasChildren:b,onValueNodeHasChildrenChange:y,contentId:kt(),value:j,onValueChange:R,open:A,onOpenChange:B,dir:v,triggerPointerDownPosRef:w,disabled:D,children:[d.jsx(F2.Provider,{scope:u,children:d.jsx(W2u,{scope:e.__scopeSelect,onNativeOptionAdd:C.useCallback(M=>{z(I=>new Set(I).add(M))},[]),onNativeOptionRemove:C.useCallback(M=>{z(I=>{const P=new Set(I);return P.delete(M),P})},[]),children:a})}),O?d.jsxs(xJ,{"aria-hidden":!0,required:h,tabIndex:-1,name:E,autoComplete:c,value:j,onChange:M=>R(M.target.value),disabled:D,form:m,children:[j===void 0?d.jsx("option",{value:""}):null,Array.from(T)]},N):null]})})};JG.displayName=Q4;var WG="SelectTrigger",UG=C.forwardRef((e,u)=>{const{__scopeSelect:a,disabled:t=!1,...n}=e,r=v2(a),i=N1(WG,a),o=i.disabled||t,s=Xe(u,i.onTriggerChange),l=k2(a),E=C.useRef("touch"),[c,D,h]=pJ(x=>{const p=l().filter(F=>!F.disabled),f=p.find(F=>F.value===i.value),g=gJ(p,x,f);g!==void 0&&i.onValueChange(g.value)}),m=x=>{o||(i.onOpenChange(!0),h()),x&&(i.triggerPointerDownPosRef.current={x:Math.round(x.pageX),y:Math.round(x.pageY)})};return d.jsx(dm,{asChild:!0,...r,children:d.jsx(se.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:o,"data-disabled":o?"":void 0,"data-placeholder":fJ(i.value)?"":void 0,...n,ref:s,onClick:ju(n.onClick,x=>{x.currentTarget.focus(),E.current!=="mouse"&&m(x)}),onPointerDown:ju(n.onPointerDown,x=>{E.current=x.pointerType;const p=x.target;p.hasPointerCapture(x.pointerId)&&p.releasePointerCapture(x.pointerId),x.button===0&&x.ctrlKey===!1&&x.pointerType==="mouse"&&(m(x),x.preventDefault())}),onKeyDown:ju(n.onKeyDown,x=>{const p=c.current!=="";!(x.ctrlKey||x.altKey||x.metaKey)&&x.key.length===1&&D(x.key),!(p&&x.key===" ")&&V2u.includes(x.key)&&(m(),x.preventDefault())})})})});UG.displayName=WG;var ZG="SelectValue",QG=C.forwardRef((e,u)=>{const{__scopeSelect:a,className:t,style:n,children:r,placeholder:i="",...o}=e,s=N1(ZG,a),{onValueNodeHasChildrenChange:l}=s,E=r!==void 0,c=Xe(u,s.onValueNodeChange);return Zt(()=>{l(E)},[l,E]),d.jsx(se.span,{...o,ref:c,style:{pointerEvents:"none"},children:fJ(s.value)?d.jsx(d.Fragment,{children:i}):r})});QG.displayName=ZG;var Z2u="SelectIcon",qG=C.forwardRef((e,u)=>{const{__scopeSelect:a,children:t,...n}=e;return d.jsx(se.span,{"aria-hidden":!0,...n,ref:u,children:t||"▼"})});qG.displayName=Z2u;var Q2u="SelectPortal",YG=e=>d.jsx(cd,{asChild:!0,...e});YG.displayName=Q2u;var q4="SelectContent",XG=C.forwardRef((e,u)=>{const a=N1(q4,e.__scopeSelect),[t,n]=C.useState();if(Zt(()=>{n(new DocumentFragment)},[]),!a.open){const r=t;return r?nl.createPortal(d.jsx(uJ,{scope:e.__scopeSelect,children:d.jsx(F2.Slot,{scope:e.__scopeSelect,children:d.jsx("div",{children:e.children})})}),r):null}return d.jsx(eJ,{...e,ref:u})});XG.displayName=q4;var Mi=10,[uJ,R1]=fd(q4),q2u="SelectContentImpl",Y2u=c1("SelectContent.RemoveScroll"),eJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,position:t="item-aligned",onCloseAutoFocus:n,onEscapeKeyDown:r,onPointerDownOutside:i,side:o,sideOffset:s,align:l,alignOffset:E,arrowPadding:c,collisionBoundary:D,collisionPadding:h,sticky:m,hideWhenDetached:x,avoidCollisions:p,...f}=e,g=N1(q4,a),[F,b]=C.useState(null),[y,v]=C.useState(null),A=Xe(u,tu=>b(tu)),[B,j]=C.useState(null),[R,w]=C.useState(null),O=k2(a),[T,z]=C.useState(!1),N=C.useRef(!1);C.useEffect(()=>{if(F)return t2(F)},[F]),u2();const M=C.useCallback(tu=>{const[Y,...ou]=O().map(mu=>mu.ref.current),[Cu]=ou.slice(-1),Au=document.activeElement;for(const mu of tu)if(mu===Au||(mu==null||mu.scrollIntoView({block:"nearest"}),mu===Y&&y&&(y.scrollTop=0),mu===Cu&&y&&(y.scrollTop=y.scrollHeight),mu==null||mu.focus(),document.activeElement!==Au))return},[O,y]),I=C.useCallback(()=>M([B,F]),[M,B,F]);C.useEffect(()=>{T&&I()},[T,I]);const{onOpenChange:P,triggerPointerDownPosRef:L}=g;C.useEffect(()=>{if(F){let tu={x:0,y:0};const Y=Cu=>{var Au,mu;tu={x:Math.abs(Math.round(Cu.pageX)-(((Au=L.current)==null?void 0:Au.x)??0)),y:Math.abs(Math.round(Cu.pageY)-(((mu=L.current)==null?void 0:mu.y)??0))}},ou=Cu=>{tu.x<=10&&tu.y<=10?Cu.preventDefault():F.contains(Cu.target)||P(!1),document.removeEventListener("pointermove",Y),L.current=null};return L.current!==null&&(document.addEventListener("pointermove",Y),document.addEventListener("pointerup",ou,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Y),document.removeEventListener("pointerup",ou,{capture:!0})}}},[F,P,L]),C.useEffect(()=>{const tu=()=>P(!1);return window.addEventListener("blur",tu),window.addEventListener("resize",tu),()=>{window.removeEventListener("blur",tu),window.removeEventListener("resize",tu)}},[P]);const[K,W]=pJ(tu=>{const Y=O().filter(Au=>!Au.disabled),ou=Y.find(Au=>Au.ref.current===document.activeElement),Cu=gJ(Y,tu,ou);Cu&&setTimeout(()=>Cu.ref.current.focus())}),_=C.useCallback((tu,Y,ou)=>{const Cu=!N.current&&!ou;(g.value!==void 0&&g.value===Y||Cu)&&(j(tu),Cu&&(N.current=!0))},[g.value]),Q=C.useCallback(()=>F==null?void 0:F.focus(),[F]),eu=C.useCallback((tu,Y,ou)=>{const Cu=!N.current&&!ou;(g.value!==void 0&&g.value===Y||Cu)&&w(tu)},[g.value]),U=t==="popper"?nb:aJ,iu=U===nb?{side:o,sideOffset:s,align:l,alignOffset:E,arrowPadding:c,collisionBoundary:D,collisionPadding:h,sticky:m,hideWhenDetached:x,avoidCollisions:p}:{};return d.jsx(uJ,{scope:a,content:F,viewport:y,onViewportChange:v,itemRefCallback:_,selectedItem:B,onItemLeave:Q,itemTextRefCallback:eu,focusSelectedItem:I,selectedItemText:R,position:t,isPositioned:T,searchRef:K,children:d.jsx(a2,{as:Y2u,allowPinchZoom:!0,children:d.jsx(sm,{asChild:!0,trapped:g.open,onMountAutoFocus:tu=>{tu.preventDefault()},onUnmountAutoFocus:ju(n,tu=>{var Y;(Y=g.trigger)==null||Y.focus({preventScroll:!0}),tu.preventDefault()}),children:d.jsx(Ed,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:tu=>tu.preventDefault(),onDismiss:()=>g.onOpenChange(!1),children:d.jsx(U,{role:"listbox",id:g.contentId,"data-state":g.open?"open":"closed",dir:g.dir,onContextMenu:tu=>tu.preventDefault(),...f,...iu,onPlaced:()=>z(!0),ref:A,style:{display:"flex",flexDirection:"column",outline:"none",...f.style},onKeyDown:ju(f.onKeyDown,tu=>{const Y=tu.ctrlKey||tu.altKey||tu.metaKey;if(tu.key==="Tab"&&tu.preventDefault(),!Y&&tu.key.length===1&&W(tu.key),["ArrowUp","ArrowDown","Home","End"].includes(tu.key)){let Cu=O().filter(Au=>!Au.disabled).map(Au=>Au.ref.current);if(["ArrowUp","End"].includes(tu.key)&&(Cu=Cu.slice().reverse()),["ArrowUp","ArrowDown"].includes(tu.key)){const Au=tu.target,mu=Cu.indexOf(Au);Cu=Cu.slice(mu+1)}setTimeout(()=>M(Cu)),tu.preventDefault()}})})})})})})});eJ.displayName=q2u;var X2u="SelectItemAlignedPosition",aJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,onPlaced:t,...n}=e,r=N1(q4,a),i=R1(q4,a),[o,s]=C.useState(null),[l,E]=C.useState(null),c=Xe(u,A=>E(A)),D=k2(a),h=C.useRef(!1),m=C.useRef(!0),{viewport:x,selectedItem:p,selectedItemText:f,focusSelectedItem:g}=i,F=C.useCallback(()=>{if(r.trigger&&r.valueNode&&o&&l&&x&&p&&f){const A=r.trigger.getBoundingClientRect(),B=l.getBoundingClientRect(),j=r.valueNode.getBoundingClientRect(),R=f.getBoundingClientRect();if(r.dir!=="rtl"){const Au=R.left-B.left,mu=j.left-Au,Nu=A.left-mu,le=A.width+Nu,Yu=Math.max(le,B.width),ve=window.innerWidth-Mi,Ie=_T(mu,[Mi,Math.max(Mi,ve-Yu)]);o.style.minWidth=le+"px",o.style.left=Ie+"px"}else{const Au=B.right-R.right,mu=window.innerWidth-j.right-Au,Nu=window.innerWidth-A.right-mu,le=A.width+Nu,Yu=Math.max(le,B.width),ve=window.innerWidth-Mi,Ie=_T(mu,[Mi,Math.max(Mi,ve-Yu)]);o.style.minWidth=le+"px",o.style.right=Ie+"px"}const w=D(),O=window.innerHeight-Mi*2,T=x.scrollHeight,z=window.getComputedStyle(l),N=parseInt(z.borderTopWidth,10),M=parseInt(z.paddingTop,10),I=parseInt(z.borderBottomWidth,10),P=parseInt(z.paddingBottom,10),L=N+M+T+P+I,K=Math.min(p.offsetHeight*5,L),W=window.getComputedStyle(x),_=parseInt(W.paddingTop,10),Q=parseInt(W.paddingBottom,10),eu=A.top+A.height/2-Mi,U=O-eu,iu=p.offsetHeight/2,tu=p.offsetTop+iu,Y=N+M+tu,ou=L-Y;if(Y<=eu){const Au=w.length>0&&p===w[w.length-1].ref.current;o.style.bottom="0px";const mu=l.clientHeight-x.offsetTop-x.offsetHeight,Nu=Math.max(U,iu+(Au?Q:0)+mu+I),le=Y+Nu;o.style.height=le+"px"}else{const Au=w.length>0&&p===w[0].ref.current;o.style.top="0px";const Nu=Math.max(eu,N+x.offsetTop+(Au?_:0)+iu)+ou;o.style.height=Nu+"px",x.scrollTop=Y-eu+x.offsetTop}o.style.margin=`${Mi}px 0`,o.style.minHeight=K+"px",o.style.maxHeight=O+"px",t==null||t(),requestAnimationFrame(()=>h.current=!0)}},[D,r.trigger,r.valueNode,o,l,x,p,f,r.dir,t]);Zt(()=>F(),[F]);const[b,y]=C.useState();Zt(()=>{l&&y(window.getComputedStyle(l).zIndex)},[l]);const v=C.useCallback(A=>{A&&m.current===!0&&(F(),g==null||g(),m.current=!1)},[F,g]);return d.jsx(eCu,{scope:a,contentWrapper:o,shouldExpandOnScrollRef:h,onScrollButtonChange:v,children:d.jsx("div",{ref:s,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:d.jsx(se.div,{...n,ref:c,style:{boxSizing:"border-box",maxHeight:"100%",...n.style}})})})});aJ.displayName=X2u;var uCu="SelectPopperPosition",nb=C.forwardRef((e,u)=>{const{__scopeSelect:a,align:t="start",collisionPadding:n=Mi,...r}=e,i=v2(a);return d.jsx(h2,{...i,...r,ref:u,align:t,collisionPadding:n,style:{boxSizing:"border-box",...r.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)"}})});nb.displayName=uCu;var[eCu,L8]=fd(q4,{}),rb="SelectViewport",tJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,nonce:t,...n}=e,r=R1(rb,a),i=L8(rb,a),o=Xe(u,r.onViewportChange),s=C.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),d.jsx(F2.Slot,{scope:a,children:d.jsx(se.div,{"data-radix-select-viewport":"",role:"presentation",...n,ref:o,style:{position:"relative",flex:1,overflow:"hidden auto",...n.style},onScroll:ju(n.onScroll,l=>{const E=l.currentTarget,{contentWrapper:c,shouldExpandOnScrollRef:D}=i;if(D!=null&&D.current&&c){const h=Math.abs(s.current-E.scrollTop);if(h>0){const m=window.innerHeight-Mi*2,x=parseFloat(c.style.minHeight),p=parseFloat(c.style.height),f=Math.max(x,p);if(f<m){const g=f+h,F=Math.min(m,g),b=g-F;c.style.height=F+"px",c.style.bottom==="0px"&&(E.scrollTop=b>0?b:0,c.style.justifyContent="flex-end")}}}s.current=E.scrollTop})})})]})});tJ.displayName=rb;var nJ="SelectGroup",[aCu,tCu]=fd(nJ),nCu=C.forwardRef((e,u)=>{const{__scopeSelect:a,...t}=e,n=kt();return d.jsx(aCu,{scope:a,id:n,children:d.jsx(se.div,{role:"group","aria-labelledby":n,...t,ref:u})})});nCu.displayName=nJ;var rJ="SelectLabel",iJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,...t}=e,n=tCu(rJ,a);return d.jsx(se.div,{id:n.id,...t,ref:u})});iJ.displayName=rJ;var ep="SelectItem",[rCu,oJ]=fd(ep),sJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,value:t,disabled:n=!1,textValue:r,...i}=e,o=N1(ep,a),s=R1(ep,a),l=o.value===t,[E,c]=C.useState(r??""),[D,h]=C.useState(!1),m=Xe(u,g=>{var F;return(F=s.itemRefCallback)==null?void 0:F.call(s,g,t,n)}),x=kt(),p=C.useRef("touch"),f=()=>{n||(o.onValueChange(t),o.onOpenChange(!1))};if(t==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(rCu,{scope:a,value:t,disabled:n,textId:x,isSelected:l,onItemTextChange:C.useCallback(g=>{c(F=>F||((g==null?void 0:g.textContent)??"").trim())},[]),children:d.jsx(F2.ItemSlot,{scope:a,value:t,disabled:n,textValue:E,children:d.jsx(se.div,{role:"option","aria-labelledby":x,"data-highlighted":D?"":void 0,"aria-selected":l&&D,"data-state":l?"checked":"unchecked","aria-disabled":n||void 0,"data-disabled":n?"":void 0,tabIndex:n?void 0:-1,...i,ref:m,onFocus:ju(i.onFocus,()=>h(!0)),onBlur:ju(i.onBlur,()=>h(!1)),onClick:ju(i.onClick,()=>{p.current!=="mouse"&&f()}),onPointerUp:ju(i.onPointerUp,()=>{p.current==="mouse"&&f()}),onPointerDown:ju(i.onPointerDown,g=>{p.current=g.pointerType}),onPointerMove:ju(i.onPointerMove,g=>{var F;p.current=g.pointerType,n?(F=s.onItemLeave)==null||F.call(s):p.current==="mouse"&&g.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ju(i.onPointerLeave,g=>{var F;g.currentTarget===document.activeElement&&((F=s.onItemLeave)==null||F.call(s))}),onKeyDown:ju(i.onKeyDown,g=>{var b;((b=s.searchRef)==null?void 0:b.current)!==""&&g.key===" "||(H2u.includes(g.key)&&f(),g.key===" "&&g.preventDefault())})})})})});sJ.displayName=ep;var M5="SelectItemText",lJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,className:t,style:n,...r}=e,i=N1(M5,a),o=R1(M5,a),s=oJ(M5,a),l=U2u(M5,a),[E,c]=C.useState(null),D=Xe(u,f=>c(f),s.onItemTextChange,f=>{var g;return(g=o.itemTextRefCallback)==null?void 0:g.call(o,f,s.value,s.disabled)}),h=E==null?void 0:E.textContent,m=C.useMemo(()=>d.jsx("option",{value:s.value,disabled:s.disabled,children:h},s.value),[s.disabled,s.value,h]),{onNativeOptionAdd:x,onNativeOptionRemove:p}=l;return Zt(()=>(x(m),()=>p(m)),[x,p,m]),d.jsxs(d.Fragment,{children:[d.jsx(se.span,{id:s.textId,...r,ref:D}),s.isSelected&&i.valueNode&&!i.valueNodeHasChildren?nl.createPortal(r.children,i.valueNode):null]})});lJ.displayName=M5;var EJ="SelectItemIndicator",cJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,...t}=e;return oJ(EJ,a).isSelected?d.jsx(se.span,{"aria-hidden":!0,...t,ref:u}):null});cJ.displayName=EJ;var ib="SelectScrollUpButton",dJ=C.forwardRef((e,u)=>{const a=R1(ib,e.__scopeSelect),t=L8(ib,e.__scopeSelect),[n,r]=C.useState(!1),i=Xe(u,t.onScrollButtonChange);return Zt(()=>{if(a.viewport&&a.isPositioned){let o=function(){const l=s.scrollTop>0;r(l)};const s=a.viewport;return o(),s.addEventListener("scroll",o),()=>s.removeEventListener("scroll",o)}},[a.viewport,a.isPositioned]),n?d.jsx(hJ,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:s}=a;o&&s&&(o.scrollTop=o.scrollTop-s.offsetHeight)}}):null});dJ.displayName=ib;var ob="SelectScrollDownButton",DJ=C.forwardRef((e,u)=>{const a=R1(ob,e.__scopeSelect),t=L8(ob,e.__scopeSelect),[n,r]=C.useState(!1),i=Xe(u,t.onScrollButtonChange);return Zt(()=>{if(a.viewport&&a.isPositioned){let o=function(){const l=s.scrollHeight-s.clientHeight,E=Math.ceil(s.scrollTop)<l;r(E)};const s=a.viewport;return o(),s.addEventListener("scroll",o),()=>s.removeEventListener("scroll",o)}},[a.viewport,a.isPositioned]),n?d.jsx(hJ,{...e,ref:i,onAutoScroll:()=>{const{viewport:o,selectedItem:s}=a;o&&s&&(o.scrollTop=o.scrollTop+s.offsetHeight)}}):null});DJ.displayName=ob;var hJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,onAutoScroll:t,...n}=e,r=R1("SelectScrollButton",a),i=C.useRef(null),o=k2(a),s=C.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return C.useEffect(()=>()=>s(),[s]),Zt(()=>{var E;const l=o().find(c=>c.ref.current===document.activeElement);(E=l==null?void 0:l.ref.current)==null||E.scrollIntoView({block:"nearest"})},[o]),d.jsx(se.div,{"aria-hidden":!0,...n,ref:u,style:{flexShrink:0,...n.style},onPointerDown:ju(n.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(t,50))}),onPointerMove:ju(n.onPointerMove,()=>{var l;(l=r.onItemLeave)==null||l.call(r),i.current===null&&(i.current=window.setInterval(t,50))}),onPointerLeave:ju(n.onPointerLeave,()=>{s()})})}),iCu="SelectSeparator",mJ=C.forwardRef((e,u)=>{const{__scopeSelect:a,...t}=e;return d.jsx(se.div,{"aria-hidden":!0,...t,ref:u})});mJ.displayName=iCu;var sb="SelectArrow",oCu=C.forwardRef((e,u)=>{const{__scopeSelect:a,...t}=e,n=v2(a),r=N1(sb,a),i=R1(sb,a);return r.open&&i.position==="popper"?d.jsx(m2,{...n,...t,ref:u}):null});oCu.displayName=sb;var sCu="SelectBubbleInput",xJ=C.forwardRef(({__scopeSelect:e,value:u,...a},t)=>{const n=C.useRef(null),r=Xe(t,n),i=C2(u);return C.useEffect(()=>{const o=n.current;if(!o)return;const s=window.HTMLSelectElement.prototype,E=Object.getOwnPropertyDescriptor(s,"value").set;if(i!==u&&E){const c=new Event("change",{bubbles:!0});E.call(o,u),o.dispatchEvent(c)}},[i,u]),d.jsx(se.select,{...a,style:{...EG,...a.style},ref:r,defaultValue:u})});xJ.displayName=sCu;function fJ(e){return e===""||e===void 0}function pJ(e){const u=eo(e),a=C.useRef(""),t=C.useRef(0),n=C.useCallback(i=>{const o=a.current+i;u(o),function s(l){a.current=l,window.clearTimeout(t.current),l!==""&&(t.current=window.setTimeout(()=>s(""),1e3))}(o)},[u]),r=C.useCallback(()=>{a.current="",window.clearTimeout(t.current)},[]);return C.useEffect(()=>()=>window.clearTimeout(t.current),[]),[a,n,r]}function gJ(e,u,a){const n=u.length>1&&Array.from(u).every(l=>l===u[0])?u[0]:u,r=a?e.indexOf(a):-1;let i=lCu(e,Math.max(r,0));n.length===1&&(i=i.filter(l=>l!==a));const s=i.find(l=>l.textValue.toLowerCase().startsWith(n.toLowerCase()));return s!==a?s:void 0}function lCu(e,u){return e.map((a,t)=>e[(u+t)%e.length])}var ECu=JG,CJ=UG,cCu=QG,dCu=qG,DCu=YG,FJ=XG,hCu=tJ,kJ=iJ,vJ=sJ,mCu=lJ,xCu=cJ,AJ=dJ,bJ=DJ,yJ=mJ;const Ka=ECu,$a=cCu,Oa=C.forwardRef(({className:e,children:u,...a},t)=>d.jsxs(CJ,{ref:t,className:lu("border-input ring-offset-background placeholder:text-muted-foreground focus:ring-ring flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm focus:outline-none focus:ring-1 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...a,children:[u,d.jsx(dCu,{asChild:!0,children:d.jsx(od,{className:"h-4 w-4 opacity-50"})})]}));Oa.displayName=CJ.displayName;const BJ=C.forwardRef(({className:e,...u},a)=>d.jsx(AJ,{ref:a,className:lu("flex cursor-default items-center justify-center py-1",e),...u,children:d.jsx(NV,{className:"h-4 w-4"})}));BJ.displayName=AJ.displayName;const SJ=C.forwardRef(({className:e,...u},a)=>d.jsx(bJ,{ref:a,className:lu("flex cursor-default items-center justify-center py-1",e),...u,children:d.jsx(od,{className:"h-4 w-4"})}));SJ.displayName=bJ.displayName;const wa=C.forwardRef((e,u)=>d.jsx(DCu,{children:d.jsx(zJ,{ref:u,...e})}));wa.displayName=FJ.displayName;const zJ=C.forwardRef(({className:e,children:u,position:a="popper",...t},n)=>d.jsxs(FJ,{ref:n,className:lu("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border shadow-md",a==="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:a,...t,children:[d.jsx(BJ,{}),d.jsx(hCu,{className:lu("p-1",a==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:u}),d.jsx(SJ,{})]}));zJ.displayName="SelectContentNoPortal";const fCu=C.forwardRef(({className:e,...u},a)=>d.jsx(kJ,{ref:a,className:lu("px-2 py-1.5 text-sm font-semibold",e),...u}));fCu.displayName=kJ.displayName;const Re=C.forwardRef(({className:e,children:u,...a},t)=>d.jsxs(vJ,{ref:t,className:lu("focus:bg-accent focus:text-accent-foreground relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[d.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(xCu,{children:d.jsx(d1,{className:"h-4 w-4"})})}),d.jsx(mCu,{children:u})]}));Re.displayName=vJ.displayName;const pCu=C.forwardRef(({className:e,children:u,tooltip:a,...t},n)=>d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Re,{ref:n,className:e,...t,children:u})}),d.jsx(Yl,{children:d.jsx(n0,{className:"max-w-md break-words",side:"right",sideOffset:8,children:a})})]}));pCu.displayName="PeekableSelectItem";const gCu=C.forwardRef(({className:e,...u},a)=>d.jsx(yJ,{ref:a,className:lu("bg-muted -mx-1 my-1 h-px",e),...u}));gCu.displayName=yJ.displayName;function CCu({table:e}){return d.jsx("div",{className:"flex items-center justify-end px-2",children:d.jsxs("div",{className:"flex items-center space-x-6 lg:space-x-8",children:[d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsx("p",{className:"text-sm font-medium",children:"Rows per page"}),d.jsxs(Ka,{value:`${e.getState().pagination.pageSize}`,onValueChange:u=>{e.setPageSize(Number(u))},children:[d.jsx(Oa,{className:"h-8 w-fit space-x-2",children:d.jsx($a,{placeholder:e.getState().pagination.pageSize})}),d.jsx(wa,{side:"top",children:[10,20,30,40,50].map(u=>d.jsx(Re,{value:`${u}`,children:u},u))})]})]}),d.jsxs("div",{className:"flex w-[100px] items-center justify-center text-sm font-medium",children:["Page ",e.getState().pagination.pageIndex+1," of"," ",e.getPageCount()]}),d.jsxs("div",{className:"flex items-center space-x-2",children:[d.jsxs(Ve,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:[d.jsx("span",{className:"sr-only",children:"Go to first page"}),d.jsx(C5u,{})]}),d.jsxs(Ve,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:[d.jsx("span",{className:"sr-only",children:"Go to previous page"}),d.jsx(x5u,{})]}),d.jsxs(Ve,{variant:"outline",className:"h-8 w-8 p-0",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:[d.jsx("span",{className:"sr-only",children:"Go to next page"}),d.jsx(rm,{})]}),d.jsxs(Ve,{variant:"outline",className:"hidden h-8 w-8 p-0 lg:flex",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:[d.jsx("span",{className:"sr-only",children:"Go to last page"}),d.jsx(k5u,{})]})]})]})})}function OJ({table:e,children:u,className:a,activeNameFilter:t,isLoading:n,hidePagination:r,RowComponent:i=Xl,hasBackendPagination:o}){const{getState:s,getSortedRowModel:l}=e,{pagination:E}=s(),c=E.pageIndex??0,D=E.pageSize??10,h=c*D,m=h+D,x=oH(e,r||o?l().rows:l().rows.slice(h,m)),p=x.length;return d.jsxs("div",{className:"space-y-4",children:[u,d.jsx("div",{className:lu("w-full overflow-auto rounded-md border",a),children:d.jsxs(GG,{children:[d.jsx(P8,{children:e.getHeaderGroups().map(f=>d.jsx(Xl,{children:f.headers.map(g=>{var F;return d.jsx(N8,{className:(F=g.column.columnDef.meta)==null?void 0:F.className,children:g.isPlaceholder?null:Xf(g.column.columnDef.header,g.getContext())},g.id)})},f.id))}),d.jsxs(j8,{children:[x.map(f=>d.jsx(i,{row:f,"data-state":f.getIsSelected()&&"selected",className:"group h-[50px]",children:f.getVisibleCells().map(g=>{var F;return d.jsx(YD,{className:lu("relative",(F=g.column.columnDef.meta)==null?void 0:F.className),children:Xf(g.column.columnDef.cell,g.getContext())},g.id)})},f.id)),p===0?d.jsxs(Xl,{className:"relative h-24",children:[e.getAllColumns().map(f=>d.jsx(YD,{},f.id)),d.jsx("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:t&&t.length>0&&t.length<3?"Continue typing for results...":n?"Loading...":"No results."})]}):null]})]})}),!r&&d.jsx(CCu,{table:e})]})}var _k="rovingFocusGroup.onEntryFocus",FCu={bubbles:!1,cancelable:!0},xm="RovingFocusGroup",[lb,wJ,kCu]=R8(xm),[vCu,L1]=Tt(xm,[kCu]),[ACu,bCu]=vCu(xm),MJ=C.forwardRef((e,u)=>d.jsx(lb.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(lb.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(yCu,{...e,ref:u})})}));MJ.displayName=xm;var yCu=C.forwardRef((e,u)=>{const{__scopeRovingFocusGroup:a,orientation:t,loop:n=!1,dir:r,currentTabStopId:i,defaultCurrentTabStopId:o,onCurrentTabStopIdChange:s,onEntryFocus:l,preventScrollOnEntryFocus:E=!1,...c}=e,D=C.useRef(null),h=Xe(u,D),m=xd(r),[x,p]=hn({prop:i,defaultProp:o??null,onChange:s,caller:xm}),[f,g]=C.useState(!1),F=eo(l),b=wJ(a),y=C.useRef(!1),[v,A]=C.useState(0);return C.useEffect(()=>{const B=D.current;if(B)return B.addEventListener(_k,F),()=>B.removeEventListener(_k,F)},[F]),d.jsx(ACu,{scope:a,orientation:t,dir:m,loop:n,currentTabStopId:x,onItemFocus:C.useCallback(B=>p(B),[p]),onItemShiftTab:C.useCallback(()=>g(!0),[]),onFocusableItemAdd:C.useCallback(()=>A(B=>B+1),[]),onFocusableItemRemove:C.useCallback(()=>A(B=>B-1),[]),children:d.jsx(se.div,{tabIndex:f||v===0?-1:0,"data-orientation":t,...c,ref:h,style:{outline:"none",...e.style},onMouseDown:ju(e.onMouseDown,()=>{y.current=!0}),onFocus:ju(e.onFocus,B=>{const j=!y.current;if(B.target===B.currentTarget&&j&&!f){const R=new CustomEvent(_k,FCu);if(B.currentTarget.dispatchEvent(R),!R.defaultPrevented){const w=b().filter(M=>M.focusable),O=w.find(M=>M.active),T=w.find(M=>M.id===x),N=[O,T,...w].filter(Boolean).map(M=>M.ref.current);jJ(N,E)}}y.current=!1}),onBlur:ju(e.onBlur,()=>g(!1))})})}),TJ="RovingFocusGroupItem",PJ=C.forwardRef((e,u)=>{const{__scopeRovingFocusGroup:a,focusable:t=!0,active:n=!1,tabStopId:r,children:i,...o}=e,s=kt(),l=r||s,E=bCu(TJ,a),c=E.currentTabStopId===l,D=wJ(a),{onFocusableItemAdd:h,onFocusableItemRemove:m,currentTabStopId:x}=E;return C.useEffect(()=>{if(t)return h(),()=>m()},[t,h,m]),d.jsx(lb.ItemSlot,{scope:a,id:l,focusable:t,active:n,children:d.jsx(se.span,{tabIndex:c?0:-1,"data-orientation":E.orientation,...o,ref:u,onMouseDown:ju(e.onMouseDown,p=>{t?E.onItemFocus(l):p.preventDefault()}),onFocus:ju(e.onFocus,()=>E.onItemFocus(l)),onKeyDown:ju(e.onKeyDown,p=>{if(p.key==="Tab"&&p.shiftKey){E.onItemShiftTab();return}if(p.target!==p.currentTarget)return;const f=zCu(p,E.orientation,E.dir);if(f!==void 0){if(p.metaKey||p.ctrlKey||p.altKey||p.shiftKey)return;p.preventDefault();let F=D().filter(b=>b.focusable).map(b=>b.ref.current);if(f==="last")F.reverse();else if(f==="prev"||f==="next"){f==="prev"&&F.reverse();const b=F.indexOf(p.currentTarget);F=E.loop?OCu(F,b+1):F.slice(b+1)}setTimeout(()=>jJ(F))}}),children:typeof i=="function"?i({isCurrentTabStop:c,hasTabStop:x!=null}):i})})});PJ.displayName=TJ;var BCu={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function SCu(e,u){return u!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function zCu(e,u,a){const t=SCu(e.key,a);if(!(u==="vertical"&&["ArrowLeft","ArrowRight"].includes(t))&&!(u==="horizontal"&&["ArrowUp","ArrowDown"].includes(t)))return BCu[t]}function jJ(e,u=!1){const a=document.activeElement;for(const t of e)if(t===a||(t.focus({preventScroll:u}),document.activeElement!==a))return}function OCu(e,u){return e.map((a,t)=>e[(u+t)%e.length])}var A2=MJ,b2=PJ,Eb=["Enter"," "],wCu=["ArrowDown","PageUp","Home"],NJ=["ArrowUp","PageDown","End"],MCu=[...wCu,...NJ],TCu={ltr:[...Eb,"ArrowRight"],rtl:[...Eb,"ArrowLeft"]},PCu={ltr:["ArrowLeft"],rtl:["ArrowRight"]},fm="Menu",[XD,jCu,NCu]=R8(fm),[vE,y2]=Tt(fm,[NCu,j1,L1]),B2=j1(),RJ=L1(),[RCu,AE]=vE(fm),[LCu,pm]=vE(fm),LJ=e=>{const{__scopeMenu:u,open:a=!1,children:t,dir:n,onOpenChange:r,modal:i=!0}=e,o=B2(u),[s,l]=C.useState(null),E=C.useRef(!1),c=eo(r),D=xd(n);return C.useEffect(()=>{const h=()=>{E.current=!0,document.addEventListener("pointerdown",m,{capture:!0,once:!0}),document.addEventListener("pointermove",m,{capture:!0,once:!0})},m=()=>E.current=!1;return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",m,{capture:!0}),document.removeEventListener("pointermove",m,{capture:!0})}},[]),d.jsx(D2,{...o,children:d.jsx(RCu,{scope:u,open:a,onOpenChange:c,content:s,onContentChange:l,children:d.jsx(LCu,{scope:u,onClose:C.useCallback(()=>c(!1),[c]),isUsingKeyboardRef:E,dir:D,modal:i,children:t})})})};LJ.displayName=fm;var _Cu="MenuAnchor",_8=C.forwardRef((e,u)=>{const{__scopeMenu:a,...t}=e,n=B2(a);return d.jsx(dm,{...n,...t,ref:u})});_8.displayName=_Cu;var I8="MenuPortal",[ICu,_J]=vE(I8,{forceMount:void 0}),IJ=e=>{const{__scopeMenu:u,forceMount:a,children:t,container:n}=e,r=AE(I8,u);return d.jsx(ICu,{scope:u,forceMount:a,children:d.jsx(fn,{present:a||r.open,children:d.jsx(cd,{asChild:!0,container:n,children:t})})})};IJ.displayName=I8;var ci="MenuContent",[KCu,K8]=vE(ci),KJ=C.forwardRef((e,u)=>{const a=_J(ci,e.__scopeMenu),{forceMount:t=a.forceMount,...n}=e,r=AE(ci,e.__scopeMenu),i=pm(ci,e.__scopeMenu);return d.jsx(XD.Provider,{scope:e.__scopeMenu,children:d.jsx(fn,{present:t||r.open,children:d.jsx(XD.Slot,{scope:e.__scopeMenu,children:i.modal?d.jsx($Cu,{...n,ref:u}):d.jsx(VCu,{...n,ref:u})})})})}),$Cu=C.forwardRef((e,u)=>{const a=AE(ci,e.__scopeMenu),t=C.useRef(null),n=Xe(u,t);return C.useEffect(()=>{const r=t.current;if(r)return t2(r)},[]),d.jsx($8,{...e,ref:n,trapFocus:a.open,disableOutsidePointerEvents:a.open,disableOutsideScroll:!0,onFocusOutside:ju(e.onFocusOutside,r=>r.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>a.onOpenChange(!1)})}),VCu=C.forwardRef((e,u)=>{const a=AE(ci,e.__scopeMenu);return d.jsx($8,{...e,ref:u,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>a.onOpenChange(!1)})}),HCu=c1("MenuContent.ScrollLock"),$8=C.forwardRef((e,u)=>{const{__scopeMenu:a,loop:t=!1,trapFocus:n,onOpenAutoFocus:r,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEntryFocus:s,onEscapeKeyDown:l,onPointerDownOutside:E,onFocusOutside:c,onInteractOutside:D,onDismiss:h,disableOutsideScroll:m,...x}=e,p=AE(ci,a),f=pm(ci,a),g=B2(a),F=RJ(a),b=jCu(a),[y,v]=C.useState(null),A=C.useRef(null),B=Xe(u,A,p.onContentChange),j=C.useRef(0),R=C.useRef(""),w=C.useRef(0),O=C.useRef(null),T=C.useRef("right"),z=C.useRef(0),N=m?a2:C.Fragment,M=m?{as:HCu,allowPinchZoom:!0}:void 0,I=L=>{var tu,Y;const K=R.current+L,W=b().filter(ou=>!ou.disabled),_=document.activeElement,Q=(tu=W.find(ou=>ou.ref.current===_))==null?void 0:tu.textValue,eu=W.map(ou=>ou.textValue),U=aFu(eu,K,Q),iu=(Y=W.find(ou=>ou.textValue===U))==null?void 0:Y.ref.current;(function ou(Cu){R.current=Cu,window.clearTimeout(j.current),Cu!==""&&(j.current=window.setTimeout(()=>ou(""),1e3))})(K),iu&&setTimeout(()=>iu.focus())};C.useEffect(()=>()=>window.clearTimeout(j.current),[]),u2();const P=C.useCallback(L=>{var W,_;return T.current===((W=O.current)==null?void 0:W.side)&&nFu(L,(_=O.current)==null?void 0:_.area)},[]);return d.jsx(KCu,{scope:a,searchRef:R,onItemEnter:C.useCallback(L=>{P(L)&&L.preventDefault()},[P]),onItemLeave:C.useCallback(L=>{var K;P(L)||((K=A.current)==null||K.focus(),v(null))},[P]),onTriggerLeave:C.useCallback(L=>{P(L)&&L.preventDefault()},[P]),pointerGraceTimerRef:w,onPointerGraceIntentChange:C.useCallback(L=>{O.current=L},[]),children:d.jsx(N,{...M,children:d.jsx(sm,{asChild:!0,trapped:n,onMountAutoFocus:ju(r,L=>{var K;L.preventDefault(),(K=A.current)==null||K.focus({preventScroll:!0})}),onUnmountAutoFocus:i,children:d.jsx(Ed,{asChild:!0,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:E,onFocusOutside:c,onInteractOutside:D,onDismiss:h,children:d.jsx(A2,{asChild:!0,...F,dir:f.dir,orientation:"vertical",loop:t,currentTabStopId:y,onCurrentTabStopIdChange:v,onEntryFocus:ju(s,L=>{f.isUsingKeyboardRef.current||L.preventDefault()}),preventScrollOnEntryFocus:!0,children:d.jsx(h2,{role:"menu","aria-orientation":"vertical","data-state":tW(p.open),"data-radix-menu-content":"",dir:f.dir,...g,...x,ref:B,style:{outline:"none",...x.style},onKeyDown:ju(x.onKeyDown,L=>{const W=L.target.closest("[data-radix-menu-content]")===L.currentTarget,_=L.ctrlKey||L.altKey||L.metaKey,Q=L.key.length===1;W&&(L.key==="Tab"&&L.preventDefault(),!_&&Q&&I(L.key));const eu=A.current;if(L.target!==eu||!MCu.includes(L.key))return;L.preventDefault();const iu=b().filter(tu=>!tu.disabled).map(tu=>tu.ref.current);NJ.includes(L.key)&&iu.reverse(),uFu(iu)}),onBlur:ju(e.onBlur,L=>{L.currentTarget.contains(L.target)||(window.clearTimeout(j.current),R.current="")}),onPointerMove:ju(e.onPointerMove,uh(L=>{const K=L.target,W=z.current!==L.clientX;if(L.currentTarget.contains(K)&&W){const _=L.clientX>z.current?"right":"left";T.current=_,z.current=L.clientX}}))})})})})})})});KJ.displayName=ci;var GCu="MenuGroup",V8=C.forwardRef((e,u)=>{const{__scopeMenu:a,...t}=e;return d.jsx(se.div,{role:"group",...t,ref:u})});V8.displayName=GCu;var JCu="MenuLabel",$J=C.forwardRef((e,u)=>{const{__scopeMenu:a,...t}=e;return d.jsx(se.div,{...t,ref:u})});$J.displayName=JCu;var ap="MenuItem",IT="menu.itemSelect",S2=C.forwardRef((e,u)=>{const{disabled:a=!1,onSelect:t,...n}=e,r=C.useRef(null),i=pm(ap,e.__scopeMenu),o=K8(ap,e.__scopeMenu),s=Xe(u,r),l=C.useRef(!1),E=()=>{const c=r.current;if(!a&&c){const D=new CustomEvent(IT,{bubbles:!0,cancelable:!0});c.addEventListener(IT,h=>t==null?void 0:t(h),{once:!0}),sH(c,D),D.defaultPrevented?l.current=!1:i.onClose()}};return d.jsx(VJ,{...n,ref:s,disabled:a,onClick:ju(e.onClick,E),onPointerDown:c=>{var D;(D=e.onPointerDown)==null||D.call(e,c),l.current=!0},onPointerUp:ju(e.onPointerUp,c=>{var D;l.current||(D=c.currentTarget)==null||D.click()}),onKeyDown:ju(e.onKeyDown,c=>{const D=o.searchRef.current!=="";a||D&&c.key===" "||Eb.includes(c.key)&&(c.currentTarget.click(),c.preventDefault())})})});S2.displayName=ap;var VJ=C.forwardRef((e,u)=>{const{__scopeMenu:a,disabled:t=!1,textValue:n,...r}=e,i=K8(ap,a),o=RJ(a),s=C.useRef(null),l=Xe(u,s),[E,c]=C.useState(!1),[D,h]=C.useState("");return C.useEffect(()=>{const m=s.current;m&&h((m.textContent??"").trim())},[r.children]),d.jsx(XD.ItemSlot,{scope:a,disabled:t,textValue:n??D,children:d.jsx(b2,{asChild:!0,...o,focusable:!t,children:d.jsx(se.div,{role:"menuitem","data-highlighted":E?"":void 0,"aria-disabled":t||void 0,"data-disabled":t?"":void 0,...r,ref:l,onPointerMove:ju(e.onPointerMove,uh(m=>{t?i.onItemLeave(m):(i.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ju(e.onPointerLeave,uh(m=>i.onItemLeave(m))),onFocus:ju(e.onFocus,()=>c(!0)),onBlur:ju(e.onBlur,()=>c(!1))})})})}),WCu="MenuCheckboxItem",HJ=C.forwardRef((e,u)=>{const{checked:a=!1,onCheckedChange:t,...n}=e;return d.jsx(ZJ,{scope:e.__scopeMenu,checked:a,children:d.jsx(S2,{role:"menuitemcheckbox","aria-checked":tp(a)?"mixed":a,...n,ref:u,"data-state":G8(a),onSelect:ju(n.onSelect,()=>t==null?void 0:t(tp(a)?!0:!a),{checkForDefaultPrevented:!1})})})});HJ.displayName=WCu;var GJ="MenuRadioGroup",[UCu,ZCu]=vE(GJ,{value:void 0,onValueChange:()=>{}}),JJ=C.forwardRef((e,u)=>{const{value:a,onValueChange:t,...n}=e,r=eo(t);return d.jsx(UCu,{scope:e.__scopeMenu,value:a,onValueChange:r,children:d.jsx(V8,{...n,ref:u})})});JJ.displayName=GJ;var WJ="MenuRadioItem",UJ=C.forwardRef((e,u)=>{const{value:a,...t}=e,n=ZCu(WJ,e.__scopeMenu),r=a===n.value;return d.jsx(ZJ,{scope:e.__scopeMenu,checked:r,children:d.jsx(S2,{role:"menuitemradio","aria-checked":r,...t,ref:u,"data-state":G8(r),onSelect:ju(t.onSelect,()=>{var i;return(i=n.onValueChange)==null?void 0:i.call(n,a)},{checkForDefaultPrevented:!1})})})});UJ.displayName=WJ;var H8="MenuItemIndicator",[ZJ,QCu]=vE(H8,{checked:!1}),QJ=C.forwardRef((e,u)=>{const{__scopeMenu:a,forceMount:t,...n}=e,r=QCu(H8,a);return d.jsx(fn,{present:t||tp(r.checked)||r.checked===!0,children:d.jsx(se.span,{...n,ref:u,"data-state":G8(r.checked)})})});QJ.displayName=H8;var qCu="MenuSeparator",qJ=C.forwardRef((e,u)=>{const{__scopeMenu:a,...t}=e;return d.jsx(se.div,{role:"separator","aria-orientation":"horizontal",...t,ref:u})});qJ.displayName=qCu;var YCu="MenuArrow",YJ=C.forwardRef((e,u)=>{const{__scopeMenu:a,...t}=e,n=B2(a);return d.jsx(m2,{...n,...t,ref:u})});YJ.displayName=YCu;var XCu="MenuSub",[Q00,XJ]=vE(XCu),T5="MenuSubTrigger",uW=C.forwardRef((e,u)=>{const a=AE(T5,e.__scopeMenu),t=pm(T5,e.__scopeMenu),n=XJ(T5,e.__scopeMenu),r=K8(T5,e.__scopeMenu),i=C.useRef(null),{pointerGraceTimerRef:o,onPointerGraceIntentChange:s}=r,l={__scopeMenu:e.__scopeMenu},E=C.useCallback(()=>{i.current&&window.clearTimeout(i.current),i.current=null},[]);return C.useEffect(()=>E,[E]),C.useEffect(()=>{const c=o.current;return()=>{window.clearTimeout(c),s(null)}},[o,s]),d.jsx(_8,{asChild:!0,...l,children:d.jsx(VJ,{id:n.triggerId,"aria-haspopup":"menu","aria-expanded":a.open,"aria-controls":n.contentId,"data-state":tW(a.open),...e,ref:Hs(u,n.onTriggerChange),onClick:c=>{var D;(D=e.onClick)==null||D.call(e,c),!(e.disabled||c.defaultPrevented)&&(c.currentTarget.focus(),a.open||a.onOpenChange(!0))},onPointerMove:ju(e.onPointerMove,uh(c=>{r.onItemEnter(c),!c.defaultPrevented&&!e.disabled&&!a.open&&!i.current&&(r.onPointerGraceIntentChange(null),i.current=window.setTimeout(()=>{a.onOpenChange(!0),E()},100))})),onPointerLeave:ju(e.onPointerLeave,uh(c=>{var h,m;E();const D=(h=a.content)==null?void 0:h.getBoundingClientRect();if(D){const x=(m=a.content)==null?void 0:m.dataset.side,p=x==="right",f=p?-5:5,g=D[p?"left":"right"],F=D[p?"right":"left"];r.onPointerGraceIntentChange({area:[{x:c.clientX+f,y:c.clientY},{x:g,y:D.top},{x:F,y:D.top},{x:F,y:D.bottom},{x:g,y:D.bottom}],side:x}),window.clearTimeout(o.current),o.current=window.setTimeout(()=>r.onPointerGraceIntentChange(null),300)}else{if(r.onTriggerLeave(c),c.defaultPrevented)return;r.onPointerGraceIntentChange(null)}})),onKeyDown:ju(e.onKeyDown,c=>{var h;const D=r.searchRef.current!=="";e.disabled||D&&c.key===" "||TCu[t.dir].includes(c.key)&&(a.onOpenChange(!0),(h=a.content)==null||h.focus(),c.preventDefault())})})})});uW.displayName=T5;var eW="MenuSubContent",aW=C.forwardRef((e,u)=>{const a=_J(ci,e.__scopeMenu),{forceMount:t=a.forceMount,...n}=e,r=AE(ci,e.__scopeMenu),i=pm(ci,e.__scopeMenu),o=XJ(eW,e.__scopeMenu),s=C.useRef(null),l=Xe(u,s);return d.jsx(XD.Provider,{scope:e.__scopeMenu,children:d.jsx(fn,{present:t||r.open,children:d.jsx(XD.Slot,{scope:e.__scopeMenu,children:d.jsx($8,{id:o.contentId,"aria-labelledby":o.triggerId,...n,ref:l,align:"start",side:i.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:E=>{var c;i.isUsingKeyboardRef.current&&((c=s.current)==null||c.focus()),E.preventDefault()},onCloseAutoFocus:E=>E.preventDefault(),onFocusOutside:ju(e.onFocusOutside,E=>{E.target!==o.trigger&&r.onOpenChange(!1)}),onEscapeKeyDown:ju(e.onEscapeKeyDown,E=>{i.onClose(),E.preventDefault()}),onKeyDown:ju(e.onKeyDown,E=>{var h;const c=E.currentTarget.contains(E.target),D=PCu[i.dir].includes(E.key);c&&D&&(r.onOpenChange(!1),(h=o.trigger)==null||h.focus(),E.preventDefault())})})})})})});aW.displayName=eW;function tW(e){return e?"open":"closed"}function tp(e){return e==="indeterminate"}function G8(e){return tp(e)?"indeterminate":e?"checked":"unchecked"}function uFu(e){const u=document.activeElement;for(const a of e)if(a===u||(a.focus(),document.activeElement!==u))return}function eFu(e,u){return e.map((a,t)=>e[(u+t)%e.length])}function aFu(e,u,a){const n=u.length>1&&Array.from(u).every(l=>l===u[0])?u[0]:u,r=a?e.indexOf(a):-1;let i=eFu(e,Math.max(r,0));n.length===1&&(i=i.filter(l=>l!==a));const s=i.find(l=>l.toLowerCase().startsWith(n.toLowerCase()));return s!==a?s:void 0}function tFu(e,u){const{x:a,y:t}=e;let n=!1;for(let r=0,i=u.length-1;r<u.length;i=r++){const o=u[r],s=u[i],l=o.x,E=o.y,c=s.x,D=s.y;E>t!=D>t&&a<(c-l)*(t-E)/(D-E)+l&&(n=!n)}return n}function nFu(e,u){if(!u)return!1;const a={x:e.clientX,y:e.clientY};return tFu(a,u)}function uh(e){return u=>u.pointerType==="mouse"?e(u):void 0}var nW=LJ,rW=_8,iW=IJ,oW=KJ,sW=V8,lW=$J,EW=S2,cW=HJ,dW=JJ,DW=UJ,hW=QJ,mW=qJ,xW=YJ,fW=uW,pW=aW,z2="DropdownMenu",[rFu,q00]=Tt(z2,[y2]),In=y2(),[iFu,gW]=rFu(z2),CW=e=>{const{__scopeDropdownMenu:u,children:a,dir:t,open:n,defaultOpen:r,onOpenChange:i,modal:o=!0}=e,s=In(u),l=C.useRef(null),[E,c]=hn({prop:n,defaultProp:r??!1,onChange:i,caller:z2});return d.jsx(iFu,{scope:u,triggerId:kt(),triggerRef:l,contentId:kt(),open:E,onOpenChange:c,onOpenToggle:C.useCallback(()=>c(D=>!D),[c]),modal:o,children:d.jsx(nW,{...s,open:E,onOpenChange:c,dir:t,modal:o,children:a})})};CW.displayName=z2;var FW="DropdownMenuTrigger",kW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,disabled:t=!1,...n}=e,r=gW(FW,a),i=In(a);return d.jsx(rW,{asChild:!0,...i,children:d.jsx(se.button,{type:"button",id:r.triggerId,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?r.contentId:void 0,"data-state":r.open?"open":"closed","data-disabled":t?"":void 0,disabled:t,...n,ref:Hs(u,r.triggerRef),onPointerDown:ju(e.onPointerDown,o=>{!t&&o.button===0&&o.ctrlKey===!1&&(r.onOpenToggle(),r.open||o.preventDefault())}),onKeyDown:ju(e.onKeyDown,o=>{t||(["Enter"," "].includes(o.key)&&r.onOpenToggle(),o.key==="ArrowDown"&&r.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(o.key)&&o.preventDefault())})})})});kW.displayName=FW;var oFu="DropdownMenuPortal",vW=e=>{const{__scopeDropdownMenu:u,...a}=e,t=In(u);return d.jsx(iW,{...t,...a})};vW.displayName=oFu;var AW="DropdownMenuContent",bW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=gW(AW,a),r=In(a),i=C.useRef(!1);return d.jsx(oW,{id:n.contentId,"aria-labelledby":n.triggerId,...r,...t,ref:u,onCloseAutoFocus:ju(e.onCloseAutoFocus,o=>{var s;i.current||(s=n.triggerRef.current)==null||s.focus(),i.current=!1,o.preventDefault()}),onInteractOutside:ju(e.onInteractOutside,o=>{const s=o.detail.originalEvent,l=s.button===0&&s.ctrlKey===!0,E=s.button===2||l;(!n.modal||E)&&(i.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});bW.displayName=AW;var sFu="DropdownMenuGroup",lFu=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(sW,{...n,...t,ref:u})});lFu.displayName=sFu;var EFu="DropdownMenuLabel",yW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(lW,{...n,...t,ref:u})});yW.displayName=EFu;var cFu="DropdownMenuItem",BW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(EW,{...n,...t,ref:u})});BW.displayName=cFu;var dFu="DropdownMenuCheckboxItem",SW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(cW,{...n,...t,ref:u})});SW.displayName=dFu;var DFu="DropdownMenuRadioGroup",hFu=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(dW,{...n,...t,ref:u})});hFu.displayName=DFu;var mFu="DropdownMenuRadioItem",zW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(DW,{...n,...t,ref:u})});zW.displayName=mFu;var xFu="DropdownMenuItemIndicator",OW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(hW,{...n,...t,ref:u})});OW.displayName=xFu;var fFu="DropdownMenuSeparator",wW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(mW,{...n,...t,ref:u})});wW.displayName=fFu;var pFu="DropdownMenuArrow",gFu=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(xW,{...n,...t,ref:u})});gFu.displayName=pFu;var CFu="DropdownMenuSubTrigger",MW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(fW,{...n,...t,ref:u})});MW.displayName=CFu;var FFu="DropdownMenuSubContent",TW=C.forwardRef((e,u)=>{const{__scopeDropdownMenu:a,...t}=e,n=In(a);return d.jsx(pW,{...n,...t,ref:u,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});TW.displayName=FFu;var kFu=CW,vFu=kW,AFu=vW,PW=bW,jW=yW,NW=BW,RW=SW,LW=zW,_W=OW,IW=wW,KW=MW,$W=TW;const VW=kFu,HW=vFu,bFu=C.forwardRef(({className:e,inset:u,children:a,...t},n)=>d.jsxs(KW,{ref:n,className:lu("focus:bg-accent data-[state=open]:bg-accent flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",u&&"pl-8",e),...t,children:[a,d.jsx(rm,{className:"ml-auto"})]}));bFu.displayName=KW.displayName;const yFu=C.forwardRef(({className:e,...u},a)=>d.jsx($W,{ref:a,className:lu("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-lg",e),...u}));yFu.displayName=$W.displayName;const J8=C.forwardRef(({className:e,sideOffset:u=4,...a},t)=>d.jsx(AFu,{children:d.jsx(PW,{ref:t,sideOffset:u,className:lu("bg-popover text-popover-foreground z-50 min-w-[8rem] overflow-hidden rounded-md border p-1 shadow-md","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...a})}));J8.displayName=PW.displayName;const M4=C.forwardRef(({className:e,inset:u,...a},t)=>d.jsx(NW,{ref:t,className:lu("focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0",u&&"pl-8",e),...a}));M4.displayName=NW.displayName;const BFu=C.forwardRef(({tooltip:e,...u},a)=>d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(M4,{ref:a,...u})}),d.jsx(Yl,{children:d.jsx(n0,{className:"max-w-md break-words",side:"right",sideOffset:8,children:e})})]}));BFu.displayName="PeekableDropdownMenuItem";const SFu=C.forwardRef(({className:e,children:u,checked:a,...t},n)=>d.jsxs(RW,{ref:n,className:lu("focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:a,...t,children:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(_W,{children:d.jsx(d1,{className:"h-4 w-4"})})}),u]}));SFu.displayName=RW.displayName;const zFu=C.forwardRef(({className:e,children:u,...a},t)=>d.jsxs(LW,{ref:t,className:lu("focus:bg-accent focus:text-accent-foreground relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...a,children:[d.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(_W,{children:d.jsx(_V,{className:"h-2 w-2 fill-current"})})}),u]}));zFu.displayName=LW.displayName;const OFu=C.forwardRef(({className:e,inset:u,...a},t)=>d.jsx(jW,{ref:t,className:lu("px-2 py-1.5 text-sm font-semibold",u&&"pl-8",e),...a}));OFu.displayName=jW.displayName;const GW=C.forwardRef(({className:e,...u},a)=>d.jsx(IW,{ref:a,className:lu("bg-muted -mx-1 my-1 h-px",e),...u}));GW.displayName=IW.displayName;function Jn({column:e,title:u,className:a,position:t="left"}){return e.getCanSort()?d.jsx("div",{className:lu("flex items-center space-x-2",{"flex justify-end":t==="right"},a),children:d.jsxs(VW,{children:[d.jsx(HW,{asChild:!0,children:d.jsxs(Ve,{variant:"ghost",size:"sm",className:lu("data-[state=open]:bg-accent -ml-3 h-8",{"-mr-3":t==="right"}),children:[t==="left"?d.jsx("span",{children:u}):null,e.getIsSorted()==="desc"?d.jsx(R7,{}):e.getIsSorted()==="asc"?d.jsx(YM,{}):d.jsx(RV,{}),t==="right"?d.jsx("span",{children:u}):null]})}),d.jsxs(J8,{align:"start",children:[d.jsxs(M4,{onClick:()=>e.toggleSorting(!1),children:[d.jsx(YM,{className:"text-muted-foreground/70 h-3.5 w-3.5"}),"Asc"]}),d.jsxs(M4,{onClick:()=>e.toggleSorting(!0),children:[d.jsx(R7,{className:"text-muted-foreground/70 h-3.5 w-3.5"}),"Desc"]}),d.jsx(GW,{}),d.jsxs(M4,{onClick:()=>e.clearSorting(),children:[d.jsx(FE,{className:"text-muted-foreground/70 h-3.5 w-3.5"}),"Clear"]})]})]})}):d.jsx("div",{className:lu("text-xs","mr-2","whitespace-nowrap","flex","items-center",a),children:u})}var gm=e=>e.type==="checkbox",C4=e=>e instanceof Date,Vn=e=>e==null;const JW=e=>typeof e=="object";var Et=e=>!Vn(e)&&!Array.isArray(e)&&JW(e)&&!C4(e),WW=e=>Et(e)&&e.target?gm(e.target)?e.target.checked:e.target.value:e,wFu=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,UW=(e,u)=>e.has(wFu(u)),MFu=e=>{const u=e.constructor&&e.constructor.prototype;return Et(u)&&u.hasOwnProperty("isPrototypeOf")},W8=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function ut(e){if(e instanceof Date)return new Date(e);const u=typeof FileList<"u"&&e instanceof FileList;if(W8&&(e instanceof Blob||u))return e;const a=Array.isArray(e);if(!a&&!(Et(e)&&MFu(e)))return e;const t=a?[]:Object.create(Object.getPrototypeOf(e));for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=ut(e[n]));return t}var O2=e=>/^\w*$/.test(e),Ea=e=>e===void 0,U8=e=>Array.isArray(e)?e.filter(Boolean):[],Z8=e=>U8(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Vu=(e,u,a)=>{if(!u||!Et(e))return a;const t=(O2(u)?[u]:Z8(u)).reduce((n,r)=>Vn(n)?n:n[r],e);return Ea(t)||t===e?Ea(e[u])?a:e[u]:t},Dr=e=>typeof e=="boolean",An=e=>typeof e=="function",R0=(e,u,a)=>{let t=-1;const n=O2(u)?[u]:Z8(u),r=n.length,i=r-1;for(;++t<r;){const o=n[t];let s=a;if(t!==i){const l=e[o];s=Et(l)||Array.isArray(l)?l:isNaN(+n[t+1])?{}:[]}if(o==="__proto__"||o==="constructor"||o==="prototype")return;e[o]=s,e=e[o]}};const np={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},$i={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},hs={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Q8=nu.createContext(null);Q8.displayName="HookFormContext";const w2=()=>nu.useContext(Q8),TFu=e=>{const{children:u,...a}=e;return nu.createElement(Q8.Provider,{value:a},u)};var ZW=(e,u,a,t=!0)=>{const n={defaultValues:u._defaultValues};for(const r in e)Object.defineProperty(n,r,{get:()=>{const i=r;return u._proxyFormState[i]!==$i.all&&(u._proxyFormState[i]=!t||$i.all),a&&(a[i]=!0),e[i]}});return n};const q8=typeof window<"u"?nu.useLayoutEffect:nu.useEffect;function PFu(e){const u=w2(),{control:a=u.control,disabled:t,name:n,exact:r}=e||{},[i,o]=nu.useState(a._formState),s=nu.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return q8(()=>a._subscribe({name:n,formState:s.current,exact:r,callback:l=>{!t&&o({...a._formState,...l})}}),[n,t,r]),nu.useEffect(()=>{s.current.isValid&&a._setValid(!0)},[a]),nu.useMemo(()=>ZW(i,a,s.current,!1),[i,a])}var pr=e=>typeof e=="string",cb=(e,u,a,t,n)=>pr(e)?(t&&u.watch.add(e),Vu(a,e,n)):Array.isArray(e)?e.map(r=>(t&&u.watch.add(r),Vu(a,r))):(t&&(u.watchAll=!0),a),db=e=>Vn(e)||!JW(e);function Vi(e,u,a=new WeakSet){if(db(e)||db(u))return Object.is(e,u);if(C4(e)&&C4(u))return Object.is(e.getTime(),u.getTime());const t=Object.keys(e),n=Object.keys(u);if(t.length!==n.length)return!1;if(a.has(e)||a.has(u))return!0;a.add(e),a.add(u);for(const r of t){const i=e[r];if(!n.includes(r))return!1;if(r!=="ref"){const o=u[r];if(C4(i)&&C4(o)||Et(i)&&Et(o)||Array.isArray(i)&&Array.isArray(o)?!Vi(i,o,a):!Object.is(i,o))return!1}}return!0}function jFu(e){const u=w2(),{control:a=u.control,name:t,defaultValue:n,disabled:r,exact:i,compute:o}=e||{},s=nu.useRef(n),l=nu.useRef(o),E=nu.useRef(void 0),c=nu.useRef(a),D=nu.useRef(t);l.current=o;const[h,m]=nu.useState(()=>{const b=a._getWatch(t,s.current);return l.current?l.current(b):b}),x=nu.useCallback(b=>{const y=cb(t,a._names,b||a._formValues,!1,s.current);return l.current?l.current(y):y},[a._formValues,a._names,t]),p=nu.useCallback(b=>{if(!r){const y=cb(t,a._names,b||a._formValues,!1,s.current);if(l.current){const v=l.current(y);Vi(v,E.current)||(m(v),E.current=v)}else m(y)}},[a._formValues,a._names,r,t]);q8(()=>((c.current!==a||!Vi(D.current,t))&&(c.current=a,D.current=t,p()),a._subscribe({name:t,formState:{values:!0},exact:i,callback:b=>{p(b.values)}})),[a,i,t,p]),nu.useEffect(()=>a._removeUnmounted());const f=c.current!==a,g=D.current,F=nu.useMemo(()=>{if(r)return null;const b=!f&&!Vi(g,t);return f||b?x():null},[r,f,t,g,x]);return F!==null?F:h}function NFu(e){const u=w2(),{name:a,disabled:t,control:n=u.control,shouldUnregister:r,defaultValue:i,exact:o=!0}=e,s=UW(n._names.array,a),l=nu.useMemo(()=>Vu(n._formValues,a,Vu(n._defaultValues,a,i)),[n,a,i]),E=jFu({control:n,name:a,defaultValue:l,exact:o}),c=PFu({control:n,name:a,exact:o}),D=nu.useRef(e),h=nu.useRef(void 0),m=nu.useRef(n.register(a,{...e.rules,value:E,...Dr(e.disabled)?{disabled:e.disabled}:{}}));D.current=e;const x=nu.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Vu(c.errors,a)},isDirty:{enumerable:!0,get:()=>!!Vu(c.dirtyFields,a)},isTouched:{enumerable:!0,get:()=>!!Vu(c.touchedFields,a)},isValidating:{enumerable:!0,get:()=>!!Vu(c.validatingFields,a)},error:{enumerable:!0,get:()=>Vu(c.errors,a)}}),[c,a]),p=nu.useCallback(b=>m.current.onChange({target:{value:WW(b),name:a},type:np.CHANGE}),[a]),f=nu.useCallback(()=>m.current.onBlur({target:{value:Vu(n._formValues,a),name:a},type:np.BLUR}),[a,n._formValues]),g=nu.useCallback(b=>{const y=Vu(n._fields,a);y&&y._f&&b&&(y._f.ref={focus:()=>An(b.focus)&&b.focus(),select:()=>An(b.select)&&b.select(),setCustomValidity:v=>An(b.setCustomValidity)&&b.setCustomValidity(v),reportValidity:()=>An(b.reportValidity)&&b.reportValidity()})},[n._fields,a]),F=nu.useMemo(()=>({name:a,value:E,...Dr(t)||c.disabled?{disabled:c.disabled||t}:{},onChange:p,onBlur:f,ref:g}),[a,t,c.disabled,p,f,g,E]);return nu.useEffect(()=>{const b=n._options.shouldUnregister||r,y=h.current;y&&y!==a&&!s&&n.unregister(y),n.register(a,{...D.current.rules,...Dr(D.current.disabled)?{disabled:D.current.disabled}:{}});const v=(A,B)=>{const j=Vu(n._fields,A);j&&j._f&&(j._f.mount=B)};if(v(a,!0),b){const A=ut(Vu(n._options.defaultValues,a,D.current.defaultValue));R0(n._defaultValues,a,A),Ea(Vu(n._formValues,a))&&R0(n._formValues,a,A)}return!s&&n.register(a),h.current=a,()=>{(s?b&&!n._state.action:b)?n.unregister(a):v(a,!1)}},[a,n,s,r]),nu.useEffect(()=>{n._setDisabledField({disabled:t,name:a})},[t,a,n]),nu.useMemo(()=>({field:F,formState:c,fieldState:x}),[F,c,x])}const RFu=e=>e.render(NFu(e));var QW=(e,u,a,t,n)=>u?{...a[e],types:{...a[e]&&a[e].types?a[e].types:{},[t]:n||!0}}:{},lD=e=>Array.isArray(e)?e:[e],KT=()=>{let e=[];return{get observers(){return e},next:n=>{for(const r of e)r.next&&r.next(n)},subscribe:n=>(e.push(n),{unsubscribe:()=>{e=e.filter(r=>r!==n)}}),unsubscribe:()=>{e=[]}}};function qW(e,u){const a={};for(const t in e)if(e.hasOwnProperty(t)){const n=e[t],r=u[t];if(n&&Et(n)&&r){const i=qW(n,r);Et(i)&&(a[t]=i)}else e[t]&&(a[t]=r)}return a}var kn=e=>Et(e)&&!Object.keys(e).length,Y8=e=>e.type==="file",rp=e=>{if(!W8)return!1;const u=e?e.ownerDocument:0;return e instanceof(u&&u.defaultView?u.defaultView.HTMLElement:HTMLElement)},YW=e=>e.type==="select-multiple",X8=e=>e.type==="radio",LFu=e=>X8(e)||gm(e),Ik=e=>rp(e)&&e.isConnected;function _Fu(e,u){const a=u.slice(0,-1).length;let t=0;for(;t<a;)e=Ea(e)?t++:e[u[t++]];return e}function IFu(e){for(const u in e)if(e.hasOwnProperty(u)&&!Ea(e[u]))return!1;return!0}function et(e,u){const a=Array.isArray(u)?u:O2(u)?[u]:Z8(u),t=a.length===1?e:_Fu(e,a),n=a.length-1,r=a[n];return t&&delete t[r],n!==0&&(Et(t)&&kn(t)||Array.isArray(t)&&IFu(t))&&et(e,a.slice(0,-1)),e}var KFu=e=>{for(const u in e)if(An(e[u]))return!0;return!1};function XW(e){return Array.isArray(e)||Et(e)&&!KFu(e)}function Db(e,u={}){for(const a in e){const t=e[a];XW(t)?(u[a]=Array.isArray(t)?[]:{},Db(t,u[a])):Ea(t)||(u[a]=!0)}return u}function uc(e,u,a){a||(a=Db(u));for(const t in e){const n=e[t];if(XW(n))Ea(u)||db(a[t])?a[t]=Db(n,Array.isArray(n)?[]:{}):uc(n,Vn(u)?{}:u[t],a[t]);else{const r=u[t];a[t]=!Vi(n,r)}}return a}const $T={value:!1,isValid:!1},VT={value:!0,isValid:!0};var uU=e=>{if(Array.isArray(e)){if(e.length>1){const u=e.filter(a=>a&&a.checked&&!a.disabled).map(a=>a.value);return{value:u,isValid:!!u.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!Ea(e[0].attributes.value)?Ea(e[0].value)||e[0].value===""?VT:{value:e[0].value,isValid:!0}:VT:$T}return $T},eU=(e,{valueAsNumber:u,valueAsDate:a,setValueAs:t})=>Ea(e)?e:u?e===""?NaN:e&&+e:a&&pr(e)?new Date(e):t?t(e):e;const HT={isValid:!1,value:null};var aU=e=>Array.isArray(e)?e.reduce((u,a)=>a&&a.checked&&!a.disabled?{isValid:!0,value:a.value}:u,HT):HT;function GT(e){const u=e.ref;return Y8(u)?u.files:X8(u)?aU(e.refs).value:YW(u)?[...u.selectedOptions].map(({value:a})=>a):gm(u)?uU(e.refs).value:eU(Ea(u.value)?e.ref.value:u.value,e)}var $Fu=(e,u,a,t)=>{const n={};for(const r of e){const i=Vu(u,r);i&&R0(n,r,i._f)}return{criteriaMode:a,names:[...e],fields:n,shouldUseNativeValidation:t}},ip=e=>e instanceof RegExp,r5=e=>Ea(e)?e:ip(e)?e.source:Et(e)?ip(e.value)?e.value.source:e.value:e,JT=e=>({isOnSubmit:!e||e===$i.onSubmit,isOnBlur:e===$i.onBlur,isOnChange:e===$i.onChange,isOnAll:e===$i.all,isOnTouch:e===$i.onTouched});const WT="AsyncFunction";var VFu=e=>!!e&&!!e.validate&&!!(An(e.validate)&&e.validate.constructor.name===WT||Et(e.validate)&&Object.values(e.validate).find(u=>u.constructor.name===WT)),HFu=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),UT=(e,u,a)=>!a&&(u.watchAll||u.watch.has(e)||[...u.watch].some(t=>e.startsWith(t)&&/^\.\w+/.test(e.slice(t.length))));const ED=(e,u,a,t)=>{for(const n of a||Object.keys(e)){const r=Vu(e,n);if(r){const{_f:i,...o}=r;if(i){if(i.refs&&i.refs[0]&&u(i.refs[0],n)&&!t)return!0;if(i.ref&&u(i.ref,i.name)&&!t)return!0;if(ED(o,u))break}else if(Et(o)&&ED(o,u))break}}};function ZT(e,u,a){const t=Vu(e,a);if(t||O2(a))return{error:t,name:a};const n=a.split(".");for(;n.length;){const r=n.join("."),i=Vu(u,r),o=Vu(e,r);if(i&&!Array.isArray(i)&&a!==r)return{name:a};if(o&&o.type)return{name:r,error:o};if(o&&o.root&&o.root.type)return{name:`${r}.root`,error:o.root};n.pop()}return{name:a}}var GFu=(e,u,a,t)=>{a(e);const{name:n,...r}=e;return kn(r)||Object.keys(r).length>=Object.keys(u).length||Object.keys(r).find(i=>u[i]===(!t||$i.all))},JFu=(e,u,a)=>!e||!u||e===u||lD(e).some(t=>t&&(a?t===u:t.startsWith(u)||u.startsWith(t))),WFu=(e,u,a,t,n)=>n.isOnAll?!1:!a&&n.isOnTouch?!(u||e):(a?t.isOnBlur:n.isOnBlur)?!e:(a?t.isOnChange:n.isOnChange)?e:!0,UFu=(e,u)=>!U8(Vu(e,u)).length&&et(e,u),ZFu=(e,u,a)=>{const t=lD(Vu(e,a));return R0(t,"root",u[a]),R0(e,a,t),e};function QT(e,u,a="validate"){if(pr(e)||Array.isArray(e)&&e.every(pr)||Dr(e)&&!e)return{type:a,message:pr(e)?e:"",ref:u}}var VE=e=>Et(e)&&!ip(e)?e:{value:e,message:""},qT=async(e,u,a,t,n,r)=>{const{ref:i,refs:o,required:s,maxLength:l,minLength:E,min:c,max:D,pattern:h,validate:m,name:x,valueAsNumber:p,mount:f}=e._f,g=Vu(a,x);if(!f||u.has(x))return{};const F=o?o[0]:i,b=O=>{n&&F.reportValidity&&(F.setCustomValidity(Dr(O)?"":O||""),F.reportValidity())},y={},v=X8(i),A=gm(i),B=v||A,j=(p||Y8(i))&&Ea(i.value)&&Ea(g)||rp(i)&&i.value===""||g===""||Array.isArray(g)&&!g.length,R=QW.bind(null,x,t,y),w=(O,T,z,N=hs.maxLength,M=hs.minLength)=>{const I=O?T:z;y[x]={type:O?N:M,message:I,ref:i,...R(O?N:M,I)}};if(r?!Array.isArray(g)||!g.length:s&&(!B&&(j||Vn(g))||Dr(g)&&!g||A&&!uU(o).isValid||v&&!aU(o).isValid)){const{value:O,message:T}=pr(s)?{value:!!s,message:s}:VE(s);if(O&&(y[x]={type:hs.required,message:T,ref:F,...R(hs.required,T)},!t))return b(T),y}if(!j&&(!Vn(c)||!Vn(D))){let O,T;const z=VE(D),N=VE(c);if(!Vn(g)&&!isNaN(g)){const M=i.valueAsNumber||g&&+g;Vn(z.value)||(O=M>z.value),Vn(N.value)||(T=M<N.value)}else{const M=i.valueAsDate||new Date(g),I=K=>new Date(new Date().toDateString()+" "+K),P=i.type=="time",L=i.type=="week";pr(z.value)&&g&&(O=P?I(g)>I(z.value):L?g>z.value:M>new Date(z.value)),pr(N.value)&&g&&(T=P?I(g)<I(N.value):L?g<N.value:M<new Date(N.value))}if((O||T)&&(w(!!O,z.message,N.message,hs.max,hs.min),!t))return b(y[x].message),y}if((l||E)&&!j&&(pr(g)||r&&Array.isArray(g))){const O=VE(l),T=VE(E),z=!Vn(O.value)&&g.length>+O.value,N=!Vn(T.value)&&g.length<+T.value;if((z||N)&&(w(z,O.message,T.message),!t))return b(y[x].message),y}if(h&&!j&&pr(g)){const{value:O,message:T}=VE(h);if(ip(O)&&!g.match(O)&&(y[x]={type:hs.pattern,message:T,ref:i,...R(hs.pattern,T)},!t))return b(T),y}if(m){if(An(m)){const O=await m(g,a),T=QT(O,F);if(T&&(y[x]={...T,...R(hs.validate,T.message)},!t))return b(T.message),y}else if(Et(m)){let O={};for(const T in m){if(!kn(O)&&!t)break;const z=QT(await m[T](g,a),F,T);z&&(O={...z,...R(T,z.message)},b(z.message),t&&(y[x]=O))}if(!kn(O)&&(y[x]={ref:F,...O},!t))return y}}return b(!0),y};const QFu={mode:$i.onSubmit,reValidateMode:$i.onChange,shouldFocusError:!0};function qFu(e={}){let u={...QFu,...e},a={submitCount:0,isDirty:!1,isReady:!1,isLoading:An(u.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:u.errors||{},disabled:u.disabled||!1},t={},n=Et(u.defaultValues)||Et(u.values)?ut(u.defaultValues||u.values)||{}:{},r=u.shouldUnregister?{}:ut(n),i={action:!1,mount:!1,watch:!1,keepIsValid:!1},o={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},s,l=0;const E={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},c={...E};let D={...c};const h={array:KT(),state:KT()},m=u.criteriaMode===$i.all,x=V=>au=>{clearTimeout(l),l=setTimeout(V,au)},p=async V=>{if(!i.keepIsValid&&!u.disabled&&(c.isValid||D.isValid||V)){let au;u.resolver?(au=kn((await B()).errors),f()):au=await R(t,!0),au!==a.isValid&&h.state.next({isValid:au})}},f=(V,au)=>{!u.disabled&&(c.isValidating||c.validatingFields||D.isValidating||D.validatingFields)&&((V||Array.from(o.mount)).forEach(du=>{du&&(au?R0(a.validatingFields,du,au):et(a.validatingFields,du))}),h.state.next({validatingFields:a.validatingFields,isValidating:!kn(a.validatingFields)}))},g=(V,au=[],du,bu,pu=!0,xu=!0)=>{if(bu&&du&&!u.disabled){if(i.action=!0,xu&&Array.isArray(Vu(t,V))){const Ru=du(Vu(t,V),bu.argA,bu.argB);pu&&R0(t,V,Ru)}if(xu&&Array.isArray(Vu(a.errors,V))){const Ru=du(Vu(a.errors,V),bu.argA,bu.argB);pu&&R0(a.errors,V,Ru),UFu(a.errors,V)}if((c.touchedFields||D.touchedFields)&&xu&&Array.isArray(Vu(a.touchedFields,V))){const Ru=du(Vu(a.touchedFields,V),bu.argA,bu.argB);pu&&R0(a.touchedFields,V,Ru)}(c.dirtyFields||D.dirtyFields)&&(a.dirtyFields=uc(n,r)),h.state.next({name:V,isDirty:O(V,au),dirtyFields:a.dirtyFields,errors:a.errors,isValid:a.isValid})}else R0(r,V,au)},F=(V,au)=>{R0(a.errors,V,au),h.state.next({errors:a.errors})},b=V=>{a.errors=V,h.state.next({errors:a.errors,isValid:!1})},y=(V,au,du,bu)=>{const pu=Vu(t,V);if(pu){const xu=Vu(r,V,Ea(du)?Vu(n,V):du);Ea(xu)||bu&&bu.defaultChecked||au?R0(r,V,au?xu:GT(pu._f)):N(V,xu),i.mount&&!i.action&&p()}},v=(V,au,du,bu,pu)=>{let xu=!1,Ru=!1;const He={name:V};if(!u.disabled){if(!du||bu){(c.isDirty||D.isDirty)&&(Ru=a.isDirty,a.isDirty=He.isDirty=O(),xu=Ru!==He.isDirty);const yu=Vi(Vu(n,V),au);Ru=!!Vu(a.dirtyFields,V),yu?et(a.dirtyFields,V):R0(a.dirtyFields,V,!0),He.dirtyFields=a.dirtyFields,xu=xu||(c.dirtyFields||D.dirtyFields)&&Ru!==!yu}if(du){const yu=Vu(a.touchedFields,V);yu||(R0(a.touchedFields,V,du),He.touchedFields=a.touchedFields,xu=xu||(c.touchedFields||D.touchedFields)&&yu!==du)}xu&&pu&&h.state.next(He)}return xu?He:{}},A=(V,au,du,bu)=>{const pu=Vu(a.errors,V),xu=(c.isValid||D.isValid)&&Dr(au)&&a.isValid!==au;if(u.delayError&&du?(s=x(()=>F(V,du)),s(u.delayError)):(clearTimeout(l),s=null,du?R0(a.errors,V,du):et(a.errors,V)),(du?!Vi(pu,du):pu)||!kn(bu)||xu){const Ru={...bu,...xu&&Dr(au)?{isValid:au}:{},errors:a.errors,name:V};a={...a,...Ru},h.state.next(Ru)}},B=async V=>(f(V,!0),await u.resolver(r,u.context,$Fu(V||o.mount,t,u.criteriaMode,u.shouldUseNativeValidation))),j=async V=>{const{errors:au}=await B(V);if(f(V),V)for(const du of V){const bu=Vu(au,du);bu?R0(a.errors,du,bu):et(a.errors,du)}else a.errors=au;return au},R=async(V,au,du={valid:!0})=>{for(const bu in V){const pu=V[bu];if(pu){const{_f:xu,...Ru}=pu;if(xu){const He=o.array.has(xu.name),yu=pu._f&&VFu(pu._f);yu&&c.validatingFields&&f([xu.name],!0);const Ke=await qT(pu,o.disabled,r,m,u.shouldUseNativeValidation&&!au,He);if(yu&&c.validatingFields&&f([xu.name]),Ke[xu.name]&&(du.valid=!1,au||e.shouldUseNativeValidation))break;!au&&(Vu(Ke,xu.name)?He?ZFu(a.errors,Ke,xu.name):R0(a.errors,xu.name,Ke[xu.name]):et(a.errors,xu.name))}!kn(Ru)&&await R(Ru,au,du)}}return du.valid},w=()=>{for(const V of o.unMount){const au=Vu(t,V);au&&(au._f.refs?au._f.refs.every(du=>!Ik(du)):!Ik(au._f.ref))&&Y(V)}o.unMount=new Set},O=(V,au)=>!u.disabled&&(V&&au&&R0(r,V,au),!Vi(W(),n)),T=(V,au,du)=>cb(V,o,{...i.mount?r:Ea(au)?n:pr(V)?{[V]:au}:au},du,au),z=V=>U8(Vu(i.mount?r:n,V,u.shouldUnregister?Vu(n,V,[]):[])),N=(V,au,du={})=>{const bu=Vu(t,V);let pu=au;if(bu){const xu=bu._f;xu&&(!xu.disabled&&R0(r,V,eU(au,xu)),pu=rp(xu.ref)&&Vn(au)?"":au,YW(xu.ref)?[...xu.ref.options].forEach(Ru=>Ru.selected=pu.includes(Ru.value)):xu.refs?gm(xu.ref)?xu.refs.forEach(Ru=>{(!Ru.defaultChecked||!Ru.disabled)&&(Array.isArray(pu)?Ru.checked=!!pu.find(He=>He===Ru.value):Ru.checked=pu===Ru.value||!!pu)}):xu.refs.forEach(Ru=>Ru.checked=Ru.value===pu):Y8(xu.ref)?xu.ref.value="":(xu.ref.value=pu,xu.ref.type||h.state.next({name:V,values:ut(r)})))}(du.shouldDirty||du.shouldTouch)&&v(V,pu,du.shouldTouch,du.shouldDirty,!0),du.shouldValidate&&K(V)},M=(V,au,du)=>{for(const bu in au){if(!au.hasOwnProperty(bu))return;const pu=au[bu],xu=V+"."+bu,Ru=Vu(t,xu);(o.array.has(V)||Et(pu)||Ru&&!Ru._f)&&!C4(pu)?M(xu,pu,du):N(xu,pu,du)}},I=(V,au,du={})=>{const bu=Vu(t,V),pu=o.array.has(V),xu=ut(au);R0(r,V,xu),pu?(h.array.next({name:V,values:ut(r)}),(c.isDirty||c.dirtyFields||D.isDirty||D.dirtyFields)&&du.shouldDirty&&h.state.next({name:V,dirtyFields:uc(n,r),isDirty:O(V,xu)})):bu&&!bu._f&&!Vn(xu)?M(V,xu,du):N(V,xu,du),UT(V,o)?h.state.next({...a,name:V,values:ut(r)}):h.state.next({name:i.mount?V:void 0,values:ut(r)})},P=async V=>{i.mount=!0;const au=V.target;let du=au.name,bu=!0;const pu=Vu(t,du),xu=yu=>{bu=Number.isNaN(yu)||C4(yu)&&isNaN(yu.getTime())||Vi(yu,Vu(r,du,yu))},Ru=JT(u.mode),He=JT(u.reValidateMode);if(pu){let yu,Ke;const t0=au.type?GT(pu._f):WW(V),N0=V.type===np.BLUR||V.type===np.FOCUS_OUT,ja=!HFu(pu._f)&&!u.resolver&&!Vu(a.errors,du)&&!pu._f.deps||WFu(N0,Vu(a.touchedFields,du),a.isSubmitted,He,Ru),Xt=UT(du,o,N0);R0(r,du,t0),N0?(!au||!au.readOnly)&&(pu._f.onBlur&&pu._f.onBlur(V),s&&s(0)):pu._f.onChange&&pu._f.onChange(V);const $r=v(du,t0,N0),PE=!kn($r)||Xt;if(!N0&&h.state.next({name:du,type:V.type,values:ut(r)}),ja)return(c.isValid||D.isValid)&&(u.mode==="onBlur"?N0&&p():N0||p()),PE&&h.state.next({name:du,...Xt?{}:$r});if(!N0&&Xt&&h.state.next({...a}),u.resolver){const{errors:Dl}=await B([du]);if(f([du]),xu(t0),bu){const fu=ZT(a.errors,t,du),Bu=ZT(Dl,t,fu.name||du);yu=Bu.error,du=Bu.name,Ke=kn(Dl)}}else f([du],!0),yu=(await qT(pu,o.disabled,r,m,u.shouldUseNativeValidation))[du],f([du]),xu(t0),bu&&(yu?Ke=!1:(c.isValid||D.isValid)&&(Ke=await R(t,!0)));bu&&(pu._f.deps&&(!Array.isArray(pu._f.deps)||pu._f.deps.length>0)&&K(pu._f.deps),A(du,Ke,yu,$r))}},L=(V,au)=>{if(Vu(a.errors,au)&&V.focus)return V.focus(),1},K=async(V,au={})=>{let du,bu;const pu=lD(V);if(u.resolver){const xu=await j(Ea(V)?V:pu);du=kn(xu),bu=V?!pu.some(Ru=>Vu(xu,Ru)):du}else V?(bu=(await Promise.all(pu.map(async xu=>{const Ru=Vu(t,xu);return await R(Ru&&Ru._f?{[xu]:Ru}:Ru)}))).every(Boolean),!(!bu&&!a.isValid)&&p()):bu=du=await R(t);return h.state.next({...!pr(V)||(c.isValid||D.isValid)&&du!==a.isValid?{}:{name:V},...u.resolver||!V?{isValid:du}:{},errors:a.errors}),au.shouldFocus&&!bu&&ED(t,L,V?pu:o.mount),bu},W=(V,au)=>{let du={...i.mount?r:n};return au&&(du=qW(au.dirtyFields?a.dirtyFields:a.touchedFields,du)),Ea(V)?du:pr(V)?Vu(du,V):V.map(bu=>Vu(du,bu))},_=(V,au)=>({invalid:!!Vu((au||a).errors,V),isDirty:!!Vu((au||a).dirtyFields,V),error:Vu((au||a).errors,V),isValidating:!!Vu(a.validatingFields,V),isTouched:!!Vu((au||a).touchedFields,V)}),Q=V=>{V&&lD(V).forEach(au=>et(a.errors,au)),h.state.next({errors:V?a.errors:{}})},eu=(V,au,du)=>{const bu=(Vu(t,V,{_f:{}})._f||{}).ref,pu=Vu(a.errors,V)||{},{ref:xu,message:Ru,type:He,...yu}=pu;R0(a.errors,V,{...yu,...au,ref:bu}),h.state.next({name:V,errors:a.errors,isValid:!1}),du&&du.shouldFocus&&bu&&bu.focus&&bu.focus()},U=(V,au)=>An(V)?h.state.subscribe({next:du=>"values"in du&&V(T(void 0,au),du)}):T(V,au,!0),iu=V=>h.state.subscribe({next:au=>{JFu(V.name,au.name,V.exact)&&GFu(au,V.formState||c,Zu,V.reRenderRoot)&&V.callback({values:{...r},...a,...au,defaultValues:n})}}).unsubscribe,tu=V=>(i.mount=!0,D={...D,...V.formState},iu({...V,formState:{...E,...V.formState}})),Y=(V,au={})=>{for(const du of V?lD(V):o.mount)o.mount.delete(du),o.array.delete(du),au.keepValue||(et(t,du),et(r,du)),!au.keepError&&et(a.errors,du),!au.keepDirty&&et(a.dirtyFields,du),!au.keepTouched&&et(a.touchedFields,du),!au.keepIsValidating&&et(a.validatingFields,du),!u.shouldUnregister&&!au.keepDefaultValue&&et(n,du);h.state.next({values:ut(r)}),h.state.next({...a,...au.keepDirty?{isDirty:O()}:{}}),!au.keepIsValid&&p()},ou=({disabled:V,name:au})=>{(Dr(V)&&i.mount||V||o.disabled.has(au))&&(V?o.disabled.add(au):o.disabled.delete(au))},Cu=(V,au={})=>{let du=Vu(t,V);const bu=Dr(au.disabled)||Dr(u.disabled);return R0(t,V,{...du||{},_f:{...du&&du._f?du._f:{ref:{name:V}},name:V,mount:!0,...au}}),o.mount.add(V),du?ou({disabled:Dr(au.disabled)?au.disabled:u.disabled,name:V}):y(V,!0,au.value),{...bu?{disabled:au.disabled||u.disabled}:{},...u.progressive?{required:!!au.required,min:r5(au.min),max:r5(au.max),minLength:r5(au.minLength),maxLength:r5(au.maxLength),pattern:r5(au.pattern)}:{},name:V,onChange:P,onBlur:P,ref:pu=>{if(pu){Cu(V,au),du=Vu(t,V);const xu=Ea(pu.value)&&pu.querySelectorAll&&pu.querySelectorAll("input,select,textarea")[0]||pu,Ru=LFu(xu),He=du._f.refs||[];if(Ru?He.find(yu=>yu===xu):xu===du._f.ref)return;R0(t,V,{_f:{...du._f,...Ru?{refs:[...He.filter(Ik),xu,...Array.isArray(Vu(n,V))?[{}]:[]],ref:{type:xu.type,name:V}}:{ref:xu}}}),y(V,!1,void 0,xu)}else du=Vu(t,V,{}),du._f&&(du._f.mount=!1),(u.shouldUnregister||au.shouldUnregister)&&!(UW(o.array,V)&&i.action)&&o.unMount.add(V)}}},Au=()=>u.shouldFocusError&&ED(t,L,o.mount),mu=V=>{Dr(V)&&(h.state.next({disabled:V}),ED(t,(au,du)=>{const bu=Vu(t,du);bu&&(au.disabled=bu._f.disabled||V,Array.isArray(bu._f.refs)&&bu._f.refs.forEach(pu=>{pu.disabled=bu._f.disabled||V}))},0,!1))},Nu=(V,au)=>async du=>{let bu;du&&(du.preventDefault&&du.preventDefault(),du.persist&&du.persist());let pu=ut(r);if(h.state.next({isSubmitting:!0}),u.resolver){const{errors:xu,values:Ru}=await B();f(),a.errors=xu,pu=ut(Ru)}else await R(t);if(o.disabled.size)for(const xu of o.disabled)et(pu,xu);if(et(a.errors,"root"),kn(a.errors)){h.state.next({errors:{}});try{await V(pu,du)}catch(xu){bu=xu}}else au&&await au({...a.errors},du),Au(),setTimeout(Au);if(h.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:kn(a.errors)&&!bu,submitCount:a.submitCount+1,errors:a.errors}),bu)throw bu},le=(V,au={})=>{Vu(t,V)&&(Ea(au.defaultValue)?I(V,ut(Vu(n,V))):(I(V,au.defaultValue),R0(n,V,ut(au.defaultValue))),au.keepTouched||et(a.touchedFields,V),au.keepDirty||(et(a.dirtyFields,V),a.isDirty=au.defaultValue?O(V,ut(Vu(n,V))):O()),au.keepError||(et(a.errors,V),c.isValid&&p()),h.state.next({...a}))},Yu=(V,au={})=>{const du=V?ut(V):n,bu=ut(du),pu=kn(V),xu=pu?n:bu;if(au.keepDefaultValues||(n=du),!au.keepValues){if(au.keepDirtyValues){const Ru=new Set([...o.mount,...Object.keys(uc(n,r))]);for(const He of Array.from(Ru)){const yu=Vu(a.dirtyFields,He),Ke=Vu(r,He),t0=Vu(xu,He);yu&&!Ea(Ke)?R0(xu,He,Ke):!yu&&!Ea(t0)&&I(He,t0)}}else{if(W8&&Ea(V))for(const Ru of o.mount){const He=Vu(t,Ru);if(He&&He._f){const yu=Array.isArray(He._f.refs)?He._f.refs[0]:He._f.ref;if(rp(yu)){const Ke=yu.closest("form");if(Ke){Ke.reset();break}}}}if(au.keepFieldsRef)for(const Ru of o.mount)I(Ru,Vu(xu,Ru));else t={}}r=u.shouldUnregister?au.keepDefaultValues?ut(n):{}:ut(xu),h.array.next({values:{...xu}}),h.state.next({values:{...xu}})}o={mount:au.keepDirtyValues?o.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!c.isValid||!!au.keepIsValid||!!au.keepDirtyValues||!u.shouldUnregister&&!kn(xu),i.watch=!!u.shouldUnregister,i.keepIsValid=!!au.keepIsValid,i.action=!1,au.keepErrors||(a.errors={}),h.state.next({submitCount:au.keepSubmitCount?a.submitCount:0,isDirty:pu?!1:au.keepDirty?a.isDirty:!!(au.keepDefaultValues&&!Vi(V,n)),isSubmitted:au.keepIsSubmitted?a.isSubmitted:!1,dirtyFields:pu?{}:au.keepDirtyValues?au.keepDefaultValues&&r?uc(n,r):a.dirtyFields:au.keepDefaultValues&&V?uc(n,V):au.keepDirty?a.dirtyFields:{},touchedFields:au.keepTouched?a.touchedFields:{},errors:au.keepErrors?a.errors:{},isSubmitSuccessful:au.keepIsSubmitSuccessful?a.isSubmitSuccessful:!1,isSubmitting:!1,defaultValues:n})},ve=(V,au)=>Yu(An(V)?V(r):V,{...u.resetOptions,...au}),Ie=(V,au={})=>{const du=Vu(t,V),bu=du&&du._f;if(bu){const pu=bu.refs?bu.refs[0]:bu.ref;pu.focus&&setTimeout(()=>{pu.focus(),au.shouldSelect&&An(pu.select)&&pu.select()})}},Zu=V=>{a={...a,...V}},fe={control:{register:Cu,unregister:Y,getFieldState:_,handleSubmit:Nu,setError:eu,_subscribe:iu,_runSchema:B,_updateIsValidating:f,_focusError:Au,_getWatch:T,_getDirty:O,_setValid:p,_setFieldArray:g,_setDisabledField:ou,_setErrors:b,_getFieldArray:z,_reset:Yu,_resetDefaultValues:()=>An(u.defaultValues)&&u.defaultValues().then(V=>{ve(V,u.resetOptions),h.state.next({isLoading:!1})}),_removeUnmounted:w,_disableForm:mu,_subjects:h,_proxyFormState:c,get _fields(){return t},get _formValues(){return r},get _state(){return i},set _state(V){i=V},get _defaultValues(){return n},get _names(){return o},set _names(V){o=V},get _formState(){return a},get _options(){return u},set _options(V){u={...u,...V}}},subscribe:tu,trigger:K,register:Cu,handleSubmit:Nu,watch:U,setValue:I,getValues:W,reset:ve,resetField:le,clearErrors:Q,unregister:Y,setError:eu,setFocus:Ie,getFieldState:_};return{...fe,formControl:fe}}function pd(e={}){const u=nu.useRef(void 0),a=nu.useRef(void 0),[t,n]=nu.useState({isDirty:!1,isValidating:!1,isLoading:An(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:An(e.defaultValues)?void 0:e.defaultValues});if(!u.current)if(e.formControl)u.current={...e.formControl,formState:t},e.defaultValues&&!An(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:i,...o}=qFu(e);u.current={...o,formState:t}}const r=u.current.control;return r._options=e,q8(()=>{const i=r._subscribe({formState:r._proxyFormState,callback:()=>n({...r._formState}),reRenderRoot:!0});return n(o=>({...o,isReady:!0})),r._formState.isReady=!0,i},[r]),nu.useEffect(()=>r._disableForm(e.disabled),[r,e.disabled]),nu.useEffect(()=>{e.mode&&(r._options.mode=e.mode),e.reValidateMode&&(r._options.reValidateMode=e.reValidateMode)},[r,e.mode,e.reValidateMode]),nu.useEffect(()=>{e.errors&&(r._setErrors(e.errors),r._focusError())},[r,e.errors]),nu.useEffect(()=>{e.shouldUnregister&&r._subjects.state.next({values:r._getWatch()})},[r,e.shouldUnregister]),nu.useEffect(()=>{if(r._proxyFormState.isDirty){const i=r._getDirty();i!==t.isDirty&&r._subjects.state.next({isDirty:i})}},[r,t.isDirty]),nu.useEffect(()=>{var i;e.values&&!Vi(e.values,a.current)?(r._reset(e.values,{keepFieldsRef:!0,...r._options.resetOptions}),!((i=r._options.resetOptions)===null||i===void 0)&&i.keepIsValid||r._setValid(),a.current=e.values,n(o=>({...o}))):r._resetDefaultValues()},[r,e.values]),nu.useEffect(()=>{r._state.mount||(r._setValid(),r._state.mount=!0),r._state.watch&&(r._state.watch=!1,r._subjects.state.next({...r._formState})),r._removeUnmounted()}),u.current.formState=ZW(t,r),u.current}var YT=function(e,u,a){if(e&&"reportValidity"in e){var t=Vu(a,u);e.setCustomValidity(t&&t.message||""),e.reportValidity()}},tU=function(e,u){var a=function(n){var r=u.fields[n];r&&r.ref&&"reportValidity"in r.ref?YT(r.ref,n,e):r.refs&&r.refs.forEach(function(i){return YT(i,n,e)})};for(var t in u.fields)a(t)},YFu=function(e,u){u.shouldUseNativeValidation&&tU(e,u);var a={};for(var t in e){var n=Vu(u.fields,t),r=Object.assign(e[t]||{},{ref:n&&n.ref});if(uku(u.names||Object.keys(e),t)){var i=Object.assign({},XFu(Vu(a,t)));R0(i,"root",r),R0(a,t,i)}else R0(a,t,r)}return a},XFu=function(e){return Array.isArray(e)?e.filter(Boolean):[]},uku=function(e,u){return e.some(function(a){return a.startsWith(u+".")})},eku=function(e,u){for(var a={};e.length;){var t=e[0],n=t.code,r=t.message,i=t.path.join(".");if(!a[i])if("unionErrors"in t){var o=t.unionErrors[0].errors[0];a[i]={message:o.message,type:o.code}}else a[i]={message:r,type:n};if("unionErrors"in t&&t.unionErrors.forEach(function(E){return E.errors.forEach(function(c){return e.push(c)})}),u){var s=a[i].types,l=s&&s[t.code];a[i]=QW(i,u,a,n,l?[].concat(l,t.message):t.message)}e.shift()}return a},gd=function(e,u,a){return a===void 0&&(a={}),function(t,n,r){try{return Promise.resolve(function(i,o){try{var s=Promise.resolve(e[a.mode==="sync"?"parse":"parseAsync"](t,u)).then(function(l){return r.shouldUseNativeValidation&&tU({},r),{errors:{},values:a.raw?t:l}})}catch(l){return o(l)}return s&&s.then?s.then(void 0,o):s}(0,function(i){if(function(o){return o.errors!=null}(i))return{values:{},errors:YFu(eku(i.errors,!r.shouldUseNativeValidation&&r.criteriaMode==="all"),r)};throw i}))}catch(i){return Promise.reject(i)}}};function aku(e){return async function(a,t){const n=`${e}${a}`,r=await fetch(n,t);if(!r.ok){const i=await r.text(),o=new Error(i);throw o.status=r.status,o}return r.status===204?{}:r.json()}}function Ci(){const{fetcher:e}=zV();return e}function tku(){var e=C.useRef(!0);return e.current?(e.current=!1,!0):e.current}var nku=function(e,u){var a=tku();C.useEffect(function(){if(!a)return e()},u)};const rku=nku;function iku(){var e=C.useRef(!1),u=C.useCallback(function(){return e.current},[]);return C.useEffect(function(){return e.current=!0,function(){e.current=!1}},[]),u}function Ws(e,u,a){u===void 0&&(u=[]),a===void 0&&(a={loading:!1});var t=C.useRef(0),n=iku(),r=C.useState(a),i=r[0],o=r[1],s=C.useCallback(function(){for(var l=[],E=0;E<arguments.length;E++)l[E]=arguments[E];var c=++t.current;return i.loading||o(function(D){return ti(ti({},D),{loading:!0})}),e.apply(void 0,l).then(function(D){return n()&&c===t.current&&o({value:D,loading:!1}),D},function(D){return n()&&c===t.current&&o({error:D,loading:!1}),D})},u);return[i,s]}var oku=function(){};function sku(e){for(var u=[],a=1;a<arguments.length;a++)u[a-1]=arguments[a];e&&e.addEventListener&&e.addEventListener.apply(e,u)}function lku(e){for(var u=[],a=1;a<arguments.length;a++)u[a-1]=arguments[a];e&&e.removeEventListener&&e.removeEventListener.apply(e,u)}var Eku=typeof window<"u",cku=Eku?window:null,XT=function(e){return!!e.addEventListener},uP=function(e){return!!e.on},dku=function(e,u,a,t){a===void 0&&(a=cku),C.useEffect(function(){if(u&&a)return XT(a)?sku(a,e,u,t):uP(a)&&a.on(e,u,t),function(){XT(a)?lku(a,e,u,t):uP(a)&&a.off(e,u,t)}},[e,u,a,JSON.stringify(t)])};const Dku=dku;var hku=function(e){return typeof e=="function"?e:typeof e=="string"?function(u){return u.key===e}:e?function(){return!0}:function(){return!1}},mku=function(e,u,a,t){u===void 0&&(u=oku),a===void 0&&(a={}),t===void 0&&(t=[e]);var n=a.event,r=n===void 0?"keydown":n,i=a.target,o=a.options,s=C.useMemo(function(){var l=hku(e),E=function(c){if(l(c))return u(c)};return E},t);Dku(r,s,i,o)};const eP=mku;var xku=function(e){var u=C.useState([!1,null]),a=u[0],t=u[1];return eP(e,function(n){return t([!0,n])},{event:"keydown"},[a]),eP(e,function(n){return t([!1,n])},{event:"keyup"},[a]),a};const fku=xku;var pku=function(e,u,a,t){t===void 0&&(t=fku);var n=t(e),r=n[0],i=n[1];rku(function(){!r&&a?a(i):r&&u&&u(i)},[r])};const gku=pku,bE=r2,yE=IH,Cku=i2,nU=C.forwardRef(({className:e,...u},a)=>d.jsx(dd,{ref:a,className:lu("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/80",e),...u}));nU.displayName=dd.displayName;const _1=C.forwardRef(({className:e,children:u,...a},t)=>d.jsxs(Cku,{children:[d.jsx(nU,{}),d.jsxs(Dd,{ref:t,className:lu("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",e),...a,children:[u,d.jsxs(o2,{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none",children:[d.jsx(FE,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_1.displayName=Dd.displayName;const I1=({className:e,...u})=>d.jsx("div",{className:lu("flex flex-col space-y-1.5 text-center sm:text-left",e),...u});I1.displayName="DialogHeader";const BE=({className:e,...u})=>d.jsx("div",{className:lu("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...u});BE.displayName="DialogFooter";const K1=C.forwardRef(({className:e,...u},a)=>d.jsx(lm,{ref:a,className:lu("text-lg font-semibold leading-none tracking-tight",e),...u}));K1.displayName=lm.displayName;const $1=C.forwardRef(({className:e,...u},a)=>d.jsx(Em,{ref:a,className:lu("text-muted-foreground text-sm",e),...u}));$1.displayName=Em.displayName;var Fku="Label",rU=C.forwardRef((e,u)=>d.jsx(se.label,{...e,ref:u,onMouseDown:a=>{var n;a.target.closest("button, input, select, textarea")||((n=e.onMouseDown)==null||n.call(e,a),!a.defaultPrevented&&a.detail>1&&a.preventDefault())}}));rU.displayName=Fku;var iU=rU;const kku=P1("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),xt=C.forwardRef(({className:e,...u},a)=>d.jsx(iU,{ref:a,className:lu(kku(),e),...u}));xt.displayName=iU.displayName;const Cd=TFu,oU=C.createContext({}),_0=({...e})=>d.jsx(oU.Provider,{value:{name:e.name},children:d.jsx(RFu,{...e})}),Cm=()=>{const e=C.useContext(oU),u=C.useContext(sU),{getFieldState:a,formState:t}=w2(),n=a(e.name,t);if(!e)throw new Error("useFormField should be used within <FormField>");const{id:r}=u;return{id:r,name:e.name,formItemId:`${r}-form-item`,formDescriptionId:`${r}-form-item-description`,formMessageId:`${r}-form-item-message`,...n}},sU=C.createContext({}),M0=C.forwardRef(({className:e,...u},a)=>{const t=C.useId();return d.jsx(sU.Provider,{value:{id:t},children:d.jsx("div",{ref:a,className:lu("space-y-2",e),...u})})});M0.displayName="FormItem";const Va=C.forwardRef(({className:e,...u},a)=>{const{error:t,formItemId:n}=Cm();return d.jsx(xt,{ref:a,className:lu(t&&"text-destructive",e),htmlFor:n,...u})});Va.displayName="FormLabel";const bo=C.forwardRef(({className:e,tooltip:u,...a},t)=>{const{error:n,formItemId:r}=Cm();return d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(xt,{ref:t,className:lu("decoration-primary/20 underline decoration-dashed underline-offset-4",n&&"text-destructive",e),htmlFor:r,...a})}),d.jsx(Yl,{children:d.jsx(n0,{align:"center",sideOffset:12,className:"max-w-xs",children:u})})]})});bo.displayName="FormLabelWithTooltip";const T0=C.forwardRef(({...e},u)=>{const{error:a,formItemId:t,formDescriptionId:n,formMessageId:r}=Cm();return d.jsx(ol,{ref:u,id:t,"aria-describedby":a?`${n} ${r}`:`${n}`,"aria-invalid":!!a,...e})});T0.displayName="FormControl";const op=C.forwardRef(({className:e,...u},a)=>{const{formDescriptionId:t}=Cm();return d.jsx("p",{ref:a,id:t,className:lu("text-muted-foreground text-[0.8rem]",e),...u})});op.displayName="FormDescription";const P0=C.forwardRef(({className:e,children:u,...a},t)=>{const{error:n,formMessageId:r}=Cm(),i=n?String(n==null?void 0:n.message):u;return i?d.jsx("p",{ref:t,id:r,className:lu("text-destructive text-[0.8rem] font-medium",e),...a,children:i}):null});P0.displayName="FormMessage";function u1(e){return typeof e=="string"||e instanceof String}function aP(e){var u;return typeof e=="object"&&e!=null&&(e==null||(u=e.constructor)==null?void 0:u.name)==="Object"}function lU(e,u){return Array.isArray(u)?lU(e,(a,t)=>u.includes(t)):Object.entries(e).reduce((a,t)=>{let[n,r]=t;return u(r,n)&&(a[n]=r),a},{})}const Ae={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function vku(e){switch(e){case Ae.LEFT:return Ae.FORCE_LEFT;case Ae.RIGHT:return Ae.FORCE_RIGHT;default:return e}}function Kk(e){return e.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function sp(e,u){if(u===e)return!0;const a=Array.isArray(u),t=Array.isArray(e);let n;if(a&&t){if(u.length!=e.length)return!1;for(n=0;n<u.length;n++)if(!sp(u[n],e[n]))return!1;return!0}if(a!=t)return!1;if(u&&e&&typeof u=="object"&&typeof e=="object"){const r=u instanceof Date,i=e instanceof Date;if(r&&i)return u.getTime()==e.getTime();if(r!=i)return!1;const o=u instanceof RegExp,s=e instanceof RegExp;if(o&&s)return u.toString()==e.toString();if(o!=s)return!1;const l=Object.keys(u);for(n=0;n<l.length;n++)if(!Object.prototype.hasOwnProperty.call(e,l[n]))return!1;for(n=0;n<l.length;n++)if(!sp(e[l[n]],u[l[n]]))return!1;return!0}else if(u&&e&&typeof u=="function"&&typeof e=="function")return u.toString()===e.toString();return!1}class Aku{constructor(u){for(Object.assign(this,u);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?Ae.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?Ae.RIGHT:Ae.LEFT}}function $e(e,u){return new $e.InputMask(e,u)}function EU(e){if(e==null)throw new Error("mask property should be defined");return e instanceof RegExp?$e.MaskedRegExp:u1(e)?$e.MaskedPattern:e===Date?$e.MaskedDate:e===Number?$e.MaskedNumber:Array.isArray(e)||e===Array?$e.MaskedDynamic:$e.Masked&&e.prototype instanceof $e.Masked?e:$e.Masked&&e instanceof $e.Masked?e.constructor:e instanceof Function?$e.MaskedFunction:(console.warn("Mask not found for mask",e),$e.Masked)}function eh(e){if(!e)throw new Error("Options in not defined");if($e.Masked){if(e.prototype instanceof $e.Masked)return{mask:e};const{mask:u=void 0,...a}=e instanceof $e.Masked?{mask:e}:aP(e)&&e.mask instanceof $e.Masked?e:{};if(u){const t=u.mask;return{...lU(u,(n,r)=>!r.startsWith("_")),mask:u.constructor,_mask:t,...a}}}return aP(e)?{...e}:{mask:e}}function Us(e){if($e.Masked&&e instanceof $e.Masked)return e;const u=eh(e),a=EU(u.mask);if(!a)throw new Error("Masked class is not found for provided mask "+u.mask+", appropriate module needs to be imported manually before creating mask.");return u.mask===a&&delete u.mask,u._mask&&(u.mask=u._mask,delete u._mask),new a(u)}$e.createMask=Us;class uS{get selectionStart(){let u;try{u=this._unsafeSelectionStart}catch{}return u??this.value.length}get selectionEnd(){let u;try{u=this._unsafeSelectionEnd}catch{}return u??this.value.length}select(u,a){if(!(u==null||a==null||u===this.selectionStart&&a===this.selectionEnd))try{this._unsafeSelect(u,a)}catch{}}get isActive(){return!1}}$e.MaskElement=uS;const tP=90,bku=89;class M2 extends uS{constructor(u){super(),this.input=u,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var u,a,t;return(u=(a=(t=this.input).getRootNode)==null?void 0:a.call(t))!=null?u:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(u){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",u.drop),this.input.addEventListener("click",u.click),this.input.addEventListener("focus",u.focus),this.input.addEventListener("blur",u.commit),this._handlers=u}_onKeydown(u){if(this._handlers.redo&&(u.keyCode===tP&&u.shiftKey&&(u.metaKey||u.ctrlKey)||u.keyCode===bku&&u.ctrlKey))return u.preventDefault(),this._handlers.redo(u);if(this._handlers.undo&&u.keyCode===tP&&(u.metaKey||u.ctrlKey))return u.preventDefault(),this._handlers.undo(u);u.isComposing||this._handlers.selectionChange(u)}_onBeforeinput(u){if(u.inputType==="historyUndo"&&this._handlers.undo)return u.preventDefault(),this._handlers.undo(u);if(u.inputType==="historyRedo"&&this._handlers.redo)return u.preventDefault(),this._handlers.redo(u)}_onCompositionEnd(u){this._handlers.input(u)}_onInput(u){u.isComposing||this._handlers.input(u)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}$e.HTMLMaskElement=M2;class yku extends M2{constructor(u){super(u),this.input=u}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(u,a){this.input.setSelectionRange(u,a)}get value(){return this.input.value}set value(u){this.input.value=u}}$e.HTMLMaskElement=M2;class cU extends M2{get _unsafeSelectionStart(){const u=this.rootElement,a=u.getSelection&&u.getSelection(),t=a&&a.anchorOffset,n=a&&a.focusOffset;return n==null||t==null||t<n?t:n}get _unsafeSelectionEnd(){const u=this.rootElement,a=u.getSelection&&u.getSelection(),t=a&&a.anchorOffset,n=a&&a.focusOffset;return n==null||t==null||t>n?t:n}_unsafeSelect(u,a){if(!this.rootElement.createRange)return;const t=this.rootElement.createRange();t.setStart(this.input.firstChild||this.input,u),t.setEnd(this.input.lastChild||this.input,a);const n=this.rootElement,r=n.getSelection&&n.getSelection();r&&(r.removeAllRanges(),r.addRange(t))}get value(){return this.input.textContent||""}set value(u){this.input.textContent=u}}$e.HTMLContenteditableMaskElement=cU;class T2{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(u){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(u),this.states.length>T2.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(u){return this.currentIndex=Math.min(Math.max(this.currentIndex+u,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}T2.MAX_LENGTH=100;class Bku{constructor(u,a){this.el=u instanceof uS?u:u.isContentEditable&&u.tagName!=="INPUT"&&u.tagName!=="TEXTAREA"?new cU(u):new yku(u),this.masked=Us(a),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new T2,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(u){var a;return u==null||((a=this.masked)==null?void 0:a.maskEquals(u))}get mask(){return this.masked.mask}set mask(u){if(this.maskEquals(u))return;if(!(u instanceof $e.Masked)&&this.masked.constructor===EU(u)){this.masked.updateOptions({mask:u});return}const a=u instanceof $e.Masked?u:Us({mask:u});a.unmaskedValue=this.masked.unmaskedValue,this.masked=a}get value(){return this._value}set value(u){this.value!==u&&(this.masked.value=u,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(u){this.unmaskedValue!==u&&(this.masked.unmaskedValue=u,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(u){this.rawInputValue!==u&&(this.masked.rawInputValue=u,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(u){this.masked.typedValueEquals(u)||(this.masked.typedValue=u,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(u,a){const t=this._listeners[u];t&&t.forEach(n=>n(a))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(u){!this.el||!this.el.isActive||(this.el.select(u,u),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(u){const a=this.masked.unmaskedValue,t=this.masked.value,n=this.masked.rawInputValue,r=this.displayValue,i=this.unmaskedValue!==a||this.value!==t||this._rawInputValue!==n;this._unmaskedValue=a,this._value=t,this._rawInputValue=n,this.el.value!==r&&(this.el.value=r),u==="auto"?this.alignCursor():u!=null&&(this.cursorPos=u),i&&this._fireChangeEvents(),!this._historyChanging&&(i||this.history.isEmpty)&&this.history.push({unmaskedValue:a,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(u){const{mask:a,...t}=u,n=!this.maskEquals(a),r=this.masked.optionsIsChanged(t);n&&(this.mask=a),r&&this.masked.updateOptions(t),(n||r)&&this.updateControl()}updateCursor(u){u!=null&&(this.cursorPos=u,this._delayUpdateCursor(u))}_delayUpdateCursor(u){this._abortUpdateCursor(),this._changingCursorPos=u,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,Ae.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(u,a){return this._listeners[u]||(this._listeners[u]=[]),this._listeners[u].push(a),this}off(u,a){if(!this._listeners[u])return this;if(!a)return delete this._listeners[u],this;const t=this._listeners[u].indexOf(a);return t>=0&&this._listeners[u].splice(t,1),this}_onInput(u){this._inputEvent=u,this._abortUpdateCursor();const a=new Aku({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),t=this.masked.rawInputValue,n=this.masked.splice(a.startChangePos,a.removed.length,a.inserted,a.removeDirection,{input:!0,raw:!0}).offset,r=t===this.masked.rawInputValue?a.removeDirection:Ae.NONE;let i=this.masked.nearestInputPos(a.startChangePos+n,r);r!==Ae.NONE&&(i=this.masked.nearestInputPos(i,Ae.NONE)),this.updateControl(i),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(u){u.preventDefault(),u.stopPropagation()}_onFocus(u){this.alignCursorFriendly()}_onClick(u){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(u){u&&(this._historyChanging=!0,this.unmaskedValue=u.unmaskedValue,this.el.select(u.selection.start,u.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}$e.InputMask=Bku;class e0{static normalize(u){return Array.isArray(u)?u:[u,new e0]}constructor(u){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},u)}aggregate(u){return this.inserted+=u.inserted,this.rawInserted+=u.rawInserted,this.tailShift+=u.tailShift,this.skip=this.skip||u.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(u){return this.inserted===u.inserted&&this.tailShift===u.tailShift&&this.rawInserted===u.rawInserted&&this.skip===u.skip}}$e.ChangeDetails=e0;class Lo{constructor(u,a,t){u===void 0&&(u=""),a===void 0&&(a=0),this.value=u,this.from=a,this.stop=t}toString(){return this.value}extend(u){this.value+=String(u)}appendTo(u){return u.append(this.toString(),{tail:!0}).aggregate(u._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(u){Object.assign(this,u)}unshift(u){if(!this.value.length||u!=null&&this.from>=u)return"";const a=this.value[0];return this.value=this.value.slice(1),a}shift(){if(!this.value.length)return"";const u=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),u}}class cn{constructor(u){this._value="",this._update({...cn.DEFAULTS,...u}),this._initialized=!0}updateOptions(u){this.optionsIsChanged(u)&&this.withValueRefresh(this._update.bind(this,u))}_update(u){Object.assign(this,u)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(u){this._value=u._value}reset(){this._value=""}get value(){return this._value}set value(u){this.resolve(u,{input:!0})}resolve(u,a){a===void 0&&(a={input:!0}),this.reset(),this.append(u,a,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(u){this.resolve(u,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(u){this.format?this.value=this.format(u,this):this.unmaskedValue=String(u)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(u){this.resolve(u,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(u,a){return u}totalInputPositions(u,a){return u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),Math.min(this.displayValue.length,a-u)}extractInput(u,a,t){return u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),this.displayValue.slice(u,a)}extractTail(u,a){return u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),new Lo(this.extractInput(u,a),u)}appendTail(u){return u1(u)&&(u=new Lo(String(u))),u.appendTo(this)}_appendCharRaw(u,a){return u?(this._value+=u,new e0({inserted:u,rawInserted:u})):new e0}_appendChar(u,a,t){a===void 0&&(a={});const n=this.state;let r;if([u,r]=this.doPrepareChar(u,a),u&&(r=r.aggregate(this._appendCharRaw(u,a)),!r.rawInserted&&this.autofix==="pad")){const i=this.state;this.state=n;let o=this.pad(a);const s=this._appendCharRaw(u,a);o=o.aggregate(s),s.rawInserted||o.equals(r)?r=o:this.state=i}if(r.inserted){let i,o=this.doValidate(a)!==!1;if(o&&t!=null){const s=this.state;if(this.overwrite===!0){i=t.state;for(let E=0;E<r.rawInserted.length;++E)t.unshift(this.displayValue.length-r.tailShift)}let l=this.appendTail(t);if(o=l.rawInserted.length===t.toString().length,!(o&&l.inserted)&&this.overwrite==="shift"){this.state=s,i=t.state;for(let E=0;E<r.rawInserted.length;++E)t.shift();l=this.appendTail(t),o=l.rawInserted.length===t.toString().length}o&&l.inserted&&(this.state=s)}o||(r=new e0,this.state=n,t&&i&&(t.state=i))}return r}_appendPlaceholder(){return new e0}_appendEager(){return new e0}append(u,a,t){if(!u1(u))throw new Error("value should be string");const n=u1(t)?new Lo(String(t)):t;a!=null&&a.tail&&(a._beforeTailState=this.state);let r;[u,r]=this.doPrepare(u,a);for(let i=0;i<u.length;++i){const o=this._appendChar(u[i],a,n);if(!o.rawInserted&&!this.doSkipInvalid(u[i],a,n))break;r.aggregate(o)}return(this.eager===!0||this.eager==="append")&&a!=null&&a.input&&u&&r.aggregate(this._appendEager()),n!=null&&(r.tailShift+=this.appendTail(n).tailShift),r}remove(u,a){return u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),this._value=this.displayValue.slice(0,u)+this.displayValue.slice(a),new e0}withValueRefresh(u){if(this._refreshing||!this._initialized)return u();this._refreshing=!0;const a=this.rawInputValue,t=this.value,n=u();return this.rawInputValue=a,this.value&&this.value!==t&&t.indexOf(this.value)===0&&(this.append(t.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,n}runIsolated(u){if(this._isolated||!this._initialized)return u(this);this._isolated=!0;const a=this.state,t=u(this);return this.state=a,delete this._isolated,t}doSkipInvalid(u,a,t){return!!this.skipInvalid}doPrepare(u,a){return a===void 0&&(a={}),e0.normalize(this.prepare?this.prepare(u,this,a):u)}doPrepareChar(u,a){return a===void 0&&(a={}),e0.normalize(this.prepareChar?this.prepareChar(u,this,a):u)}doValidate(u){return(!this.validate||this.validate(this.value,this,u))&&(!this.parent||this.parent.doValidate(u))}doCommit(){this.commit&&this.commit(this.value,this)}splice(u,a,t,n,r){t===void 0&&(t=""),n===void 0&&(n=Ae.NONE),r===void 0&&(r={input:!0});const i=u+a,o=this.extractTail(i),s=this.eager===!0||this.eager==="remove";let l;s&&(n=vku(n),l=this.extractInput(0,i,{raw:!0}));let E=u;const c=new e0;if(n!==Ae.NONE&&(E=this.nearestInputPos(u,a>1&&u!==0&&!s?Ae.NONE:n),c.tailShift=E-u),c.aggregate(this.remove(E)),s&&n!==Ae.NONE&&l===this.rawInputValue)if(n===Ae.FORCE_LEFT){let D;for(;l===this.rawInputValue&&(D=this.displayValue.length);)c.aggregate(new e0({tailShift:-1})).aggregate(this.remove(D-1))}else n===Ae.FORCE_RIGHT&&o.unshift();return c.aggregate(this.append(t,r,o))}maskEquals(u){return this.mask===u}optionsIsChanged(u){return!sp(this,u)}typedValueEquals(u){const a=this.typedValue;return u===a||cn.EMPTY_VALUES.includes(u)&&cn.EMPTY_VALUES.includes(a)||(this.format?this.format(u,this)===this.format(this.typedValue,this):!1)}pad(u){return new e0}}cn.DEFAULTS={skipInvalid:!0};cn.EMPTY_VALUES=[void 0,null,""];$e.Masked=cn;class F4{constructor(u,a){u===void 0&&(u=[]),a===void 0&&(a=0),this.chunks=u,this.from=a}toString(){return this.chunks.map(String).join("")}extend(u){if(!String(u))return;u=u1(u)?new Lo(String(u)):u;const a=this.chunks[this.chunks.length-1],t=a&&(a.stop===u.stop||u.stop==null)&&u.from===a.from+a.toString().length;if(u instanceof Lo)t?a.extend(u.toString()):this.chunks.push(u);else if(u instanceof F4){if(u.stop==null){let n;for(;u.chunks.length&&u.chunks[0].stop==null;)n=u.chunks.shift(),n.from+=u.from,this.extend(n)}u.toString()&&(u.stop=u.blockIndex,this.chunks.push(u))}}appendTo(u){if(!(u instanceof $e.MaskedPattern))return new Lo(this.toString()).appendTo(u);const a=new e0;for(let t=0;t<this.chunks.length;++t){const n=this.chunks[t],r=u._mapPosToBlock(u.displayValue.length),i=n.stop;let o;if(i!=null&&(!r||r.index<=i)&&((n instanceof F4||u._stops.indexOf(i)>=0)&&a.aggregate(u._appendPlaceholder(i)),o=n instanceof F4&&u._blocks[i]),o){const s=o.appendTail(n);a.aggregate(s);const l=n.toString().slice(s.rawInserted.length);l&&a.aggregate(u.append(l,{tail:!0}))}else a.aggregate(u.append(n.toString(),{tail:!0}))}return a}get state(){return{chunks:this.chunks.map(u=>u.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(u){const{chunks:a,...t}=u;Object.assign(this,t),this.chunks=a.map(n=>{const r="chunks"in n?new F4:new Lo;return r.state=n,r})}unshift(u){if(!this.chunks.length||u!=null&&this.from>=u)return"";const a=u!=null?u-this.from:u;let t=0;for(;t<this.chunks.length;){const n=this.chunks[t],r=n.unshift(a);if(n.toString()){if(!r)break;++t}else this.chunks.splice(t,1);if(r)return r}return""}shift(){if(!this.chunks.length)return"";let u=this.chunks.length-1;for(;0<=u;){const a=this.chunks[u],t=a.shift();if(a.toString()){if(!t)break;--u}else this.chunks.splice(u,1);if(t)return t}return""}}class Sku{constructor(u,a){this.masked=u,this._log=[];const{offset:t,index:n}=u._mapPosToBlock(a)||(a<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=t,this.index=n,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(u){Object.assign(this,u)}pushState(){this._log.push(this.state)}popState(){const u=this._log.pop();return u&&(this.state=u),u}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(u){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((a=this.block)==null?void 0:a.displayValue.length)||0){var a;if(u())return this.ok=!0}return this.ok=!1}_pushRight(u){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(u())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Ae.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Ae.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Ae.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Ae.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Ae.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Ae.NONE),!0})}}class dU{constructor(u){Object.assign(this,u),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(u,a){return u===void 0&&(u=0),a===void 0&&(a=this._value.length),this._value=this._value.slice(0,u)+this._value.slice(a),this._value||(this._isRawInput=!1),new e0}nearestInputPos(u,a){a===void 0&&(a=Ae.NONE);const t=0,n=this._value.length;switch(a){case Ae.LEFT:case Ae.FORCE_LEFT:return t;case Ae.NONE:case Ae.RIGHT:case Ae.FORCE_RIGHT:default:return n}}totalInputPositions(u,a){return u===void 0&&(u=0),a===void 0&&(a=this._value.length),this._isRawInput?a-u:0}extractInput(u,a,t){return u===void 0&&(u=0),a===void 0&&(a=this._value.length),t===void 0&&(t={}),t.raw&&this._isRawInput&&this._value.slice(u,a)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(u,a){if(a===void 0&&(a={}),this.isFilled)return new e0;const t=this.eager===!0||this.eager==="append",r=this.char===u&&(this.isUnmasking||a.input||a.raw)&&(!a.raw||!t)&&!a.tail,i=new e0({inserted:this.char,rawInserted:r?this.char:""});return this._value=this.char,this._isRawInput=r&&(a.raw||a.input),i}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const u=new e0;return this.isFilled||(this._value=u.inserted=this.char),u}extractTail(){return new Lo("")}appendTail(u){return u1(u)&&(u=new Lo(String(u))),u.appendTo(this)}append(u,a,t){const n=this._appendChar(u[0],a);return t!=null&&(n.tailShift+=this.appendTail(t).tailShift),n}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(u){this._value=u._value,this._isRawInput=!!u._rawInputValue}pad(u){return this._appendPlaceholder()}}class lp{constructor(u){const{parent:a,isOptional:t,placeholderChar:n,displayChar:r,lazy:i,eager:o,...s}=u;this.masked=Us(s),Object.assign(this,{parent:a,isOptional:t,placeholderChar:n,displayChar:r,lazy:i,eager:o})}reset(){this.isFilled=!1,this.masked.reset()}remove(u,a){return u===void 0&&(u=0),a===void 0&&(a=this.value.length),u===0&&a>=1?(this.isFilled=!1,this.masked.remove(u,a)):new e0}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(u,a){if(a===void 0&&(a={}),this.isFilled)return new e0;const t=this.masked.state;let n=this.masked._appendChar(u,this.currentMaskFlags(a));return n.inserted&&this.doValidate(a)===!1&&(n=new e0,this.masked.state=t),!n.inserted&&!this.isOptional&&!this.lazy&&!a.input&&(n.inserted=this.placeholderChar),n.skip=!n.inserted&&!this.isOptional,this.isFilled=!!n.inserted,n}append(u,a,t){return this.masked.append(u,this.currentMaskFlags(a),t)}_appendPlaceholder(){return this.isFilled||this.isOptional?new e0:(this.isFilled=!0,new e0({inserted:this.placeholderChar}))}_appendEager(){return new e0}extractTail(u,a){return this.masked.extractTail(u,a)}appendTail(u){return this.masked.appendTail(u)}extractInput(u,a,t){return u===void 0&&(u=0),a===void 0&&(a=this.value.length),this.masked.extractInput(u,a,t)}nearestInputPos(u,a){a===void 0&&(a=Ae.NONE);const t=0,n=this.value.length,r=Math.min(Math.max(u,t),n);switch(a){case Ae.LEFT:case Ae.FORCE_LEFT:return this.isComplete?r:t;case Ae.RIGHT:case Ae.FORCE_RIGHT:return this.isComplete?r:n;case Ae.NONE:default:return r}}totalInputPositions(u,a){return u===void 0&&(u=0),a===void 0&&(a=this.value.length),this.value.slice(u,a).length}doValidate(u){return this.masked.doValidate(this.currentMaskFlags(u))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(u)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(u){this.masked.state=u.masked,this.isFilled=u.isFilled}currentMaskFlags(u){var a;return{...u,_beforeTailState:(u==null||(a=u._beforeTailState)==null?void 0:a.masked)||(u==null?void 0:u._beforeTailState)}}pad(u){return new e0}}lp.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class zku extends cn{updateOptions(u){super.updateOptions(u)}_update(u){const a=u.mask;a&&(u.validate=t=>t.search(a)>=0),super._update(u)}}$e.MaskedRegExp=zku;class dn extends cn{constructor(u){super({...dn.DEFAULTS,...u,definitions:Object.assign({},lp.DEFAULT_DEFINITIONS,u==null?void 0:u.definitions)})}updateOptions(u){super.updateOptions(u)}_update(u){u.definitions=Object.assign({},this.definitions,u.definitions),super._update(u),this._rebuildMask()}_rebuildMask(){const u=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const a=this.mask;if(!a||!u)return;let t=!1,n=!1;for(let r=0;r<a.length;++r){if(this.blocks){const l=a.slice(r),E=Object.keys(this.blocks).filter(D=>l.indexOf(D)===0);E.sort((D,h)=>h.length-D.length);const c=E[0];if(c){const{expose:D,repeat:h,...m}=eh(this.blocks[c]),x={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...m,repeat:h,parent:this},p=h!=null?new $e.RepeatBlock(x):Us(x);p&&(this._blocks.push(p),D&&(this.exposeBlock=p),this._maskedBlocks[c]||(this._maskedBlocks[c]=[]),this._maskedBlocks[c].push(this._blocks.length-1)),r+=c.length-1;continue}}let i=a[r],o=i in u;if(i===dn.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(i==="{"||i==="}"){t=!t;continue}if(i==="["||i==="]"){n=!n;continue}if(i===dn.ESCAPE_CHAR){if(++r,i=a[r],!i)break;o=!1}const s=o?new lp({isOptional:n,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...eh(u[i]),parent:this}):new dU({char:i,eager:this.eager,isUnmasking:t});this._blocks.push(s)}}get state(){return{...super.state,_blocks:this._blocks.map(u=>u.state)}}set state(u){if(!u){this.reset();return}const{_blocks:a,...t}=u;this._blocks.forEach((n,r)=>n.state=a[r]),super.state=t}reset(){super.reset(),this._blocks.forEach(u=>u.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(u=>u.isComplete)}get isFilled(){return this._blocks.every(u=>u.isFilled)}get isFixed(){return this._blocks.every(u=>u.isFixed)}get isOptional(){return this._blocks.every(u=>u.isOptional)}doCommit(){this._blocks.forEach(u=>u.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((u,a)=>u+=a.unmaskedValue,"")}set unmaskedValue(u){if(this.exposeBlock){const a=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=u,this.appendTail(a),this.doCommit()}else super.unmaskedValue=u}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((u,a)=>u+=a.value,"")}set value(u){if(this.exposeBlock){const a=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=u,this.appendTail(a),this.doCommit()}else super.value=u}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(u){if(this.exposeBlock){const a=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=u,this.appendTail(a),this.doCommit()}else super.typedValue=u}get displayValue(){return this._blocks.reduce((u,a)=>u+=a.displayValue,"")}appendTail(u){return super.appendTail(u).aggregate(this._appendPlaceholder())}_appendEager(){var u;const a=new e0;let t=(u=this._mapPosToBlock(this.displayValue.length))==null?void 0:u.index;if(t==null)return a;this._blocks[t].isFilled&&++t;for(let n=t;n<this._blocks.length;++n){const r=this._blocks[n]._appendEager();if(!r.inserted)break;a.aggregate(r)}return a}_appendCharRaw(u,a){a===void 0&&(a={});const t=this._mapPosToBlock(this.displayValue.length),n=new e0;if(!t)return n;for(let i=t.index,o;o=this._blocks[i];++i){var r;const s=o._appendChar(u,{...a,_beforeTailState:(r=a._beforeTailState)==null||(r=r._blocks)==null?void 0:r[i]});if(n.aggregate(s),s.consumed)break}return n}extractTail(u,a){u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length);const t=new F4;return u===a||this._forEachBlocksInRange(u,a,(n,r,i,o)=>{const s=n.extractTail(i,o);s.stop=this._findStopBefore(r),s.from=this._blockStartPos(r),s instanceof F4&&(s.blockIndex=r),t.extend(s)}),t}extractInput(u,a,t){if(u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),t===void 0&&(t={}),u===a)return"";let n="";return this._forEachBlocksInRange(u,a,(r,i,o,s)=>{n+=r.extractInput(o,s,t)}),n}_findStopBefore(u){let a;for(let t=0;t<this._stops.length;++t){const n=this._stops[t];if(n<=u)a=n;else break}return a}_appendPlaceholder(u){const a=new e0;if(this.lazy&&u==null)return a;const t=this._mapPosToBlock(this.displayValue.length);if(!t)return a;const n=t.index,r=u??this._blocks.length;return this._blocks.slice(n,r).forEach(i=>{if(!i.lazy||u!=null){var o;a.aggregate(i._appendPlaceholder((o=i._blocks)==null?void 0:o.length))}}),a}_mapPosToBlock(u){let a="";for(let t=0;t<this._blocks.length;++t){const n=this._blocks[t],r=a.length;if(a+=n.displayValue,u<=a.length)return{index:t,offset:u-r}}}_blockStartPos(u){return this._blocks.slice(0,u).reduce((a,t)=>a+=t.displayValue.length,0)}_forEachBlocksInRange(u,a,t){a===void 0&&(a=this.displayValue.length);const n=this._mapPosToBlock(u);if(n){const r=this._mapPosToBlock(a),i=r&&n.index===r.index,o=n.offset,s=r&&i?r.offset:this._blocks[n.index].displayValue.length;if(t(this._blocks[n.index],n.index,o,s),r&&!i){for(let l=n.index+1;l<r.index;++l)t(this._blocks[l],l,0,this._blocks[l].displayValue.length);t(this._blocks[r.index],r.index,0,r.offset)}}}remove(u,a){u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length);const t=super.remove(u,a);return this._forEachBlocksInRange(u,a,(n,r,i,o)=>{t.aggregate(n.remove(i,o))}),t}nearestInputPos(u,a){if(a===void 0&&(a=Ae.NONE),!this._blocks.length)return 0;const t=new Sku(this,u);if(a===Ae.NONE)return t.pushRightBeforeInput()||(t.popState(),t.pushLeftBeforeInput())?t.pos:this.displayValue.length;if(a===Ae.LEFT||a===Ae.FORCE_LEFT){if(a===Ae.LEFT){if(t.pushRightBeforeFilled(),t.ok&&t.pos===u)return u;t.popState()}if(t.pushLeftBeforeInput(),t.pushLeftBeforeRequired(),t.pushLeftBeforeFilled(),a===Ae.LEFT){if(t.pushRightBeforeInput(),t.pushRightBeforeRequired(),t.ok&&t.pos<=u||(t.popState(),t.ok&&t.pos<=u))return t.pos;t.popState()}return t.ok?t.pos:a===Ae.FORCE_LEFT?0:(t.popState(),t.ok||(t.popState(),t.ok)?t.pos:0)}return a===Ae.RIGHT||a===Ae.FORCE_RIGHT?(t.pushRightBeforeInput(),t.pushRightBeforeRequired(),t.pushRightBeforeFilled()?t.pos:a===Ae.FORCE_RIGHT?this.displayValue.length:(t.popState(),t.ok||(t.popState(),t.ok)?t.pos:this.nearestInputPos(u,Ae.LEFT))):u}totalInputPositions(u,a){u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length);let t=0;return this._forEachBlocksInRange(u,a,(n,r,i,o)=>{t+=n.totalInputPositions(i,o)}),t}maskedBlock(u){return this.maskedBlocks(u)[0]}maskedBlocks(u){const a=this._maskedBlocks[u];return a?a.map(t=>this._blocks[t]):[]}pad(u){const a=new e0;return this._forEachBlocksInRange(0,this.displayValue.length,t=>a.aggregate(t.pad(u))),a}}dn.DEFAULTS={...cn.DEFAULTS,lazy:!0,placeholderChar:"_"};dn.STOP_CHAR="`";dn.ESCAPE_CHAR="\\";dn.InputDefinition=lp;dn.FixedDefinition=dU;$e.MaskedPattern=dn;class V6 extends dn{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(u){super(u)}updateOptions(u){super.updateOptions(u)}_update(u){const{to:a=this.to||0,from:t=this.from||0,maxLength:n=this.maxLength||0,autofix:r=this.autofix,...i}=u;this.to=a,this.from=t,this.maxLength=Math.max(String(a).length,n),this.autofix=r;const o=String(this.from).padStart(this.maxLength,"0"),s=String(this.to).padStart(this.maxLength,"0");let l=0;for(;l<s.length&&s[l]===o[l];)++l;i.mask=s.slice(0,l).replace(/0/g,"\\0")+"0".repeat(this.maxLength-l),super._update(i)}get isComplete(){return super.isComplete&&!!this.value}boundaries(u){let a="",t="";const[,n,r]=u.match(/^(\D*)(\d*)(\D*)/)||[];return r&&(a="0".repeat(n.length)+r,t="9".repeat(n.length)+r),a=a.padEnd(this.maxLength,"0"),t=t.padEnd(this.maxLength,"9"),[a,t]}doPrepareChar(u,a){a===void 0&&(a={});let t;return[u,t]=super.doPrepareChar(u.replace(/\D/g,""),a),u||(t.skip=!this.isComplete),[u,t]}_appendCharRaw(u,a){if(a===void 0&&(a={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(u,a);const t=String(this.from).padStart(this.maxLength,"0"),n=String(this.to).padStart(this.maxLength,"0"),[r,i]=this.boundaries(this.value+u);return Number(i)<this.from?super._appendCharRaw(t[this.value.length],a):Number(r)>this.to?!a.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(t[this.value.length],a).aggregate(this._appendCharRaw(u,a)):super._appendCharRaw(n[this.value.length],a):super._appendCharRaw(u,a)}doValidate(u){const a=this.value;if(a.search(/[^0]/)===-1&&a.length<=this._matchFrom)return!0;const[n,r]=this.boundaries(a);return this.from<=Number(r)&&Number(n)<=this.to&&super.doValidate(u)}pad(u){const a=new e0;if(this.value.length===this.maxLength)return a;const t=this.value,n=this.maxLength-this.value.length;if(n){this.reset();for(let r=0;r<n;++r)a.aggregate(super._appendCharRaw("0",u));t.split("").forEach(r=>this._appendCharRaw(r))}return a}}$e.MaskedRange=V6;const Oku="d{.}`m{.}`Y";class Bs extends dn{static extractPatternOptions(u){const{mask:a,pattern:t,...n}=u;return{...n,mask:u1(a)?a:t}}constructor(u){super(Bs.extractPatternOptions({...Bs.DEFAULTS,...u}))}updateOptions(u){super.updateOptions(u)}_update(u){const{mask:a,pattern:t,blocks:n,...r}={...Bs.DEFAULTS,...u},i=Object.assign({},Bs.GET_DEFAULT_BLOCKS());u.min&&(i.Y.from=u.min.getFullYear()),u.max&&(i.Y.to=u.max.getFullYear()),u.min&&u.max&&i.Y.from===i.Y.to&&(i.m.from=u.min.getMonth()+1,i.m.to=u.max.getMonth()+1,i.m.from===i.m.to&&(i.d.from=u.min.getDate(),i.d.to=u.max.getDate())),Object.assign(i,this.blocks,n),super._update({...r,mask:u1(a)?a:t,blocks:i})}doValidate(u){const a=this.date;return super.doValidate(u)&&(!this.isComplete||this.isDateExist(this.value)&&a!=null&&(this.min==null||this.min<=a)&&(this.max==null||a<=this.max))}isDateExist(u){return this.format(this.parse(u,this),this).indexOf(u)>=0}get date(){return this.typedValue}set date(u){this.typedValue=u}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(u){super.typedValue=u}maskEquals(u){return u===Date||super.maskEquals(u)}optionsIsChanged(u){return super.optionsIsChanged(Bs.extractPatternOptions(u))}}Bs.GET_DEFAULT_BLOCKS=()=>({d:{mask:V6,from:1,to:31,maxLength:2},m:{mask:V6,from:1,to:12,maxLength:2},Y:{mask:V6,from:1900,to:9999}});Bs.DEFAULTS={...dn.DEFAULTS,mask:Date,pattern:Oku,format:(e,u)=>{if(!e)return"";const a=String(e.getDate()).padStart(2,"0"),t=String(e.getMonth()+1).padStart(2,"0"),n=e.getFullYear();return[a,t,n].join(".")},parse:(e,u)=>{const[a,t,n]=e.split(".").map(Number);return new Date(n,t-1,a)}};$e.MaskedDate=Bs;class P2 extends cn{constructor(u){super({...P2.DEFAULTS,...u}),this.currentMask=void 0}updateOptions(u){super.updateOptions(u)}_update(u){super._update(u),"mask"in u&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(u.mask)?u.mask.map(a=>{const{expose:t,...n}=eh(a),r=Us({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...n});return t&&(this.exposeMask=r),r}):[])}_appendCharRaw(u,a){a===void 0&&(a={});const t=this._applyDispatch(u,a);return this.currentMask&&t.aggregate(this.currentMask._appendChar(u,this.currentMaskFlags(a))),t}_applyDispatch(u,a,t){u===void 0&&(u=""),a===void 0&&(a={}),t===void 0&&(t="");const n=a.tail&&a._beforeTailState!=null?a._beforeTailState._value:this.value,r=this.rawInputValue,i=a.tail&&a._beforeTailState!=null?a._beforeTailState._rawInputValue:r,o=r.slice(i.length),s=this.currentMask,l=new e0,E=s==null?void 0:s.state;return this.currentMask=this.doDispatch(u,{...a},t),this.currentMask&&(this.currentMask!==s?(this.currentMask.reset(),i&&(this.currentMask.append(i,{raw:!0}),l.tailShift=this.currentMask.value.length-n.length),o&&(l.tailShift+=this.currentMask.append(o,{raw:!0,tail:!0}).tailShift)):E&&(this.currentMask.state=E)),l}_appendPlaceholder(){const u=this._applyDispatch();return this.currentMask&&u.aggregate(this.currentMask._appendPlaceholder()),u}_appendEager(){const u=this._applyDispatch();return this.currentMask&&u.aggregate(this.currentMask._appendEager()),u}appendTail(u){const a=new e0;return u&&a.aggregate(this._applyDispatch("",{},u)),a.aggregate(this.currentMask?this.currentMask.appendTail(u):super.appendTail(u))}currentMaskFlags(u){var a,t;return{...u,_beforeTailState:((a=u._beforeTailState)==null?void 0:a.currentMaskRef)===this.currentMask&&((t=u._beforeTailState)==null?void 0:t.currentMask)||u._beforeTailState}}doDispatch(u,a,t){return a===void 0&&(a={}),t===void 0&&(t=""),this.dispatch(u,this,a,t)}doValidate(u){return super.doValidate(u)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(u)))}doPrepare(u,a){a===void 0&&(a={});let[t,n]=super.doPrepare(u,a);if(this.currentMask){let r;[t,r]=super.doPrepare(t,this.currentMaskFlags(a)),n=n.aggregate(r)}return[t,n]}doPrepareChar(u,a){a===void 0&&(a={});let[t,n]=super.doPrepareChar(u,a);if(this.currentMask){let r;[t,r]=super.doPrepareChar(t,this.currentMaskFlags(a)),n=n.aggregate(r)}return[t,n]}reset(){var u;(u=this.currentMask)==null||u.reset(),this.compiledMasks.forEach(a=>a.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(u){this.exposeMask?(this.exposeMask.value=u,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=u}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(u){this.exposeMask?(this.exposeMask.unmaskedValue=u,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=u}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(u){if(this.exposeMask){this.exposeMask.typedValue=u,this.currentMask=this.exposeMask,this._applyDispatch();return}let a=String(u);this.currentMask&&(this.currentMask.typedValue=u,a=this.currentMask.unmaskedValue),this.unmaskedValue=a}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var u;return!!((u=this.currentMask)!=null&&u.isComplete)}get isFilled(){var u;return!!((u=this.currentMask)!=null&&u.isFilled)}remove(u,a){const t=new e0;return this.currentMask&&t.aggregate(this.currentMask.remove(u,a)).aggregate(this._applyDispatch()),t}get state(){var u;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(a=>a.state),currentMaskRef:this.currentMask,currentMask:(u=this.currentMask)==null?void 0:u.state}}set state(u){const{compiledMasks:a,currentMaskRef:t,currentMask:n,...r}=u;a&&this.compiledMasks.forEach((i,o)=>i.state=a[o]),t!=null&&(this.currentMask=t,this.currentMask.state=n),super.state=r}extractInput(u,a,t){return this.currentMask?this.currentMask.extractInput(u,a,t):""}extractTail(u,a){return this.currentMask?this.currentMask.extractTail(u,a):super.extractTail(u,a)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(u,a){return this.currentMask?this.currentMask.nearestInputPos(u,a):super.nearestInputPos(u,a)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(u){this._overwrite=u}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(u){this._eager=u}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(u){this._skipInvalid=u}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(u){this._autofix=u}maskEquals(u){return Array.isArray(u)?this.compiledMasks.every((a,t)=>{if(!u[t])return;const{mask:n,...r}=u[t];return sp(a,r)&&a.maskEquals(n)}):super.maskEquals(u)}typedValueEquals(u){var a;return!!((a=this.currentMask)!=null&&a.typedValueEquals(u))}}P2.DEFAULTS={...cn.DEFAULTS,dispatch:(e,u,a,t)=>{if(!u.compiledMasks.length)return;const n=u.rawInputValue,r=u.compiledMasks.map((i,o)=>{const s=u.currentMask===i,l=s?i.displayValue.length:i.nearestInputPos(i.displayValue.length,Ae.FORCE_LEFT);return i.rawInputValue!==n?(i.reset(),i.append(n,{raw:!0})):s||i.remove(l),i.append(e,u.currentMaskFlags(a)),i.appendTail(t),{index:o,weight:i.rawInputValue.length,totalInputPositions:i.totalInputPositions(0,Math.max(l,i.nearestInputPos(i.displayValue.length,Ae.FORCE_LEFT)))}});return r.sort((i,o)=>o.weight-i.weight||o.totalInputPositions-i.totalInputPositions),u.compiledMasks[r[0].index]}};$e.MaskedDynamic=P2;class j2 extends dn{constructor(u){super({...j2.DEFAULTS,...u})}updateOptions(u){super.updateOptions(u)}_update(u){const{enum:a,...t}=u;if(a){const n=a.map(o=>o.length),r=Math.min(...n),i=Math.max(...n)-r;t.mask="*".repeat(r),i&&(t.mask+="["+"*".repeat(i)+"]"),this.enum=a}super._update(t)}_appendCharRaw(u,a){a===void 0&&(a={});const t=Math.min(this.nearestInputPos(0,Ae.FORCE_RIGHT),this.value.length),n=this.enum.filter(r=>this.matchValue(r,this.unmaskedValue+u,t));if(n.length){n.length===1&&this._forEachBlocksInRange(0,this.value.length,(i,o)=>{const s=n[0][o];o>=this.value.length||s===i.value||(i.reset(),i._appendChar(s,a))});const r=super._appendCharRaw(n[0][this.value.length],a);return n.length===1&&n[0].slice(this.unmaskedValue.length).split("").forEach(i=>r.aggregate(super._appendCharRaw(i))),r}return new e0({skip:!this.isComplete})}extractTail(u,a){return u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),new Lo("",u)}remove(u,a){if(u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),u===a)return new e0;const t=Math.min(super.nearestInputPos(0,Ae.FORCE_RIGHT),this.value.length);let n;for(n=u;n>=0&&!(this.enum.filter(o=>this.matchValue(o,this.value.slice(t,n),t)).length>1);--n);const r=super.remove(n,a);return r.tailShift+=n-u,r}get isComplete(){return this.enum.indexOf(this.value)>=0}}j2.DEFAULTS={...dn.DEFAULTS,matchValue:(e,u,a)=>e.indexOf(u,a)===a};$e.MaskedEnum=j2;class wku extends cn{updateOptions(u){super.updateOptions(u)}_update(u){super._update({...u,validate:u.mask})}}$e.MaskedFunction=wku;var DU;class hr extends cn{constructor(u){super({...hr.DEFAULTS,...u})}updateOptions(u){super.updateOptions(u)}_update(u){super._update(u),this._updateRegExps()}_updateRegExps(){const u="^"+(this.allowNegative?"[+|\\-]?":""),a="\\d*",t=(this.scale?"("+Kk(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(u+a+t),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Kk).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Kk(this.thousandsSeparator),"g")}_removeThousandsSeparators(u){return u.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(u){const a=u.split(this.radix);return a[0]=a[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),a.join(this.radix)}doPrepareChar(u,a){a===void 0&&(a={});const[t,n]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(a.input&&a.raw||!a.input&&!a.raw)?u.replace(this._mapToRadixRegExp,this.radix):u),a);return u&&!t&&(n.skip=!0),t&&!this.allowPositive&&!this.value&&t!=="-"&&n.aggregate(this._appendChar("-")),[t,n]}_separatorsCount(u,a){a===void 0&&(a=!1);let t=0;for(let n=0;n<u;++n)this._value.indexOf(this.thousandsSeparator,n)===n&&(++t,a&&(u+=this.thousandsSeparator.length));return t}_separatorsCountFromSlice(u){return u===void 0&&(u=this._value),this._separatorsCount(this._removeThousandsSeparators(u).length,!0)}extractInput(u,a,t){return u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),[u,a]=this._adjustRangeWithSeparators(u,a),this._removeThousandsSeparators(super.extractInput(u,a,t))}_appendCharRaw(u,a){a===void 0&&(a={});const t=a.tail&&a._beforeTailState?a._beforeTailState._value:this._value,n=this._separatorsCountFromSlice(t);this._value=this._removeThousandsSeparators(this.value);const r=this._value;this._value+=u;const i=this.number;let o=!isNaN(i),s=!1;if(o){let D;this.min!=null&&this.min<0&&this.number<this.min&&(D=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(D=this.max),D!=null&&(this.autofix?(this._value=this.format(D,this).replace(hr.UNMASKED_RADIX,this.radix),s||(s=r===this._value&&!a.tail)):o=!1),o&&(o=!!this._value.match(this._numberRegExp))}let l;o?l=new e0({inserted:this._value.slice(r.length),rawInserted:s?"":u,skip:s}):(this._value=r,l=new e0),this._value=this._insertThousandsSeparators(this._value);const E=a.tail&&a._beforeTailState?a._beforeTailState._value:this._value,c=this._separatorsCountFromSlice(E);return l.tailShift+=(c-n)*this.thousandsSeparator.length,l}_findSeparatorAround(u){if(this.thousandsSeparator){const a=u-this.thousandsSeparator.length+1,t=this.value.indexOf(this.thousandsSeparator,a);if(t<=u)return t}return-1}_adjustRangeWithSeparators(u,a){const t=this._findSeparatorAround(u);t>=0&&(u=t);const n=this._findSeparatorAround(a);return n>=0&&(a=n+this.thousandsSeparator.length),[u,a]}remove(u,a){u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length),[u,a]=this._adjustRangeWithSeparators(u,a);const t=this.value.slice(0,u),n=this.value.slice(a),r=this._separatorsCount(t.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(t+n));const i=this._separatorsCountFromSlice(t);return new e0({tailShift:(i-r)*this.thousandsSeparator.length})}nearestInputPos(u,a){if(!this.thousandsSeparator)return u;switch(a){case Ae.NONE:case Ae.LEFT:case Ae.FORCE_LEFT:{const t=this._findSeparatorAround(u-1);if(t>=0){const n=t+this.thousandsSeparator.length;if(u<n||this.value.length<=n||a===Ae.FORCE_LEFT)return t}break}case Ae.RIGHT:case Ae.FORCE_RIGHT:{const t=this._findSeparatorAround(u);if(t>=0)return t+this.thousandsSeparator.length}}return u}doCommit(){if(this.value){const u=this.number;let a=u;this.min!=null&&(a=Math.max(a,this.min)),this.max!=null&&(a=Math.min(a,this.max)),a!==u&&(this.unmaskedValue=this.format(a,this));let t=this.value;this.normalizeZeros&&(t=this._normalizeZeros(t)),this.padFractionalZeros&&this.scale>0&&(t=this._padFractionalZeros(t)),this._value=t}super.doCommit()}_normalizeZeros(u){const a=this._removeThousandsSeparators(u).split(this.radix);return a[0]=a[0].replace(/^(\D*)(0*)(\d*)/,(t,n,r,i)=>n+i),u.length&&!/\d$/.test(a[0])&&(a[0]=a[0]+"0"),a.length>1&&(a[1]=a[1].replace(/0*$/,""),a[1].length||(a.length=1)),this._insertThousandsSeparators(a.join(this.radix))}_padFractionalZeros(u){if(!u)return u;const a=u.split(this.radix);return a.length<2&&a.push(""),a[1]=a[1].padEnd(this.scale,"0"),a.join(this.radix)}doSkipInvalid(u,a,t){a===void 0&&(a={});const n=this.scale===0&&u!==this.thousandsSeparator&&(u===this.radix||u===hr.UNMASKED_RADIX||this.mapToRadix.includes(u));return super.doSkipInvalid(u,a,t)&&!n}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,hr.UNMASKED_RADIX)}set unmaskedValue(u){super.unmaskedValue=u}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(u){this.rawInputValue=this.format(u,this).replace(hr.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(u){this.typedValue=u}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(u){return(super.typedValueEquals(u)||hr.EMPTY_VALUES.includes(u)&&hr.EMPTY_VALUES.includes(this.typedValue))&&!(u===0&&this.value==="")}}DU=hr;hr.UNMASKED_RADIX=".";hr.EMPTY_VALUES=[...cn.EMPTY_VALUES,0];hr.DEFAULTS={...cn.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[DU.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:e=>e.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})};$e.MaskedNumber=hr;const hb={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function hU(e,u,a){u===void 0&&(u=hb.MASKED),a===void 0&&(a=hb.MASKED);const t=Us(e);return n=>t.runIsolated(r=>(r[u]=n,r[a]))}function Mku(e,u,a,t){return hU(u,a,t)(e)}$e.PIPE_TYPE=hb;$e.createPipe=hU;$e.pipe=Mku;class Tku extends dn{get repeatFrom(){var u;return(u=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?u:0}get repeatTo(){var u;return(u=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?u:1/0}constructor(u){super(u)}updateOptions(u){super.updateOptions(u)}_update(u){var a,t,n;const{repeat:r,...i}=eh(u);this._blockOpts=Object.assign({},this._blockOpts,i);const o=Us(this._blockOpts);this.repeat=(a=(t=r??o.repeat)!=null?t:this.repeat)!=null?a:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((n=this._blocks)==null?void 0:n.length)||0,this.repeatFrom)),blocks:{m:o},eager:o.eager,overwrite:o.overwrite,skipInvalid:o.skipInvalid,lazy:o.lazy,placeholderChar:o.placeholderChar,displayChar:o.displayChar})}_allocateBlock(u){if(u<this._blocks.length)return this._blocks[u];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(Us(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(u,a){a===void 0&&(a={});const t=new e0;for(let s=(n=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?n:Math.max(this._blocks.length-1,0),l,E;l=(i=this._blocks[s])!=null?i:E=!E&&this._allocateBlock(s);++s){var n,r,i,o;const c=l._appendChar(u,{...a,_beforeTailState:(o=a._beforeTailState)==null||(o=o._blocks)==null?void 0:o[s]});if(c.skip&&E){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(t.aggregate(c),c.consumed)break}return t}_trimEmptyTail(u,a){var t,n;u===void 0&&(u=0);const r=Math.max(((t=this._mapPosToBlock(u))==null?void 0:t.index)||0,this.repeatFrom,0);let i;a!=null&&(i=(n=this._mapPosToBlock(a))==null?void 0:n.index),i==null&&(i=this._blocks.length-1);let o=0;for(let s=i;r<=s&&!this._blocks[s].unmaskedValue;--s,++o);o&&(this._blocks.splice(i-o+1,o),this.mask=this.mask.slice(o))}reset(){super.reset(),this._trimEmptyTail()}remove(u,a){u===void 0&&(u=0),a===void 0&&(a=this.displayValue.length);const t=super.remove(u,a);return this._trimEmptyTail(u,a),t}totalInputPositions(u,a){return u===void 0&&(u=0),a==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(u,a)}get state(){return super.state}set state(u){this._blocks.length=u._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=u}}$e.RepeatBlock=Tku;try{globalThis.IMask=$e}catch{}var mU={exports:{}},Pku="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",jku=Pku,Nku=jku;function xU(){}function fU(){}fU.resetWarningCache=xU;var Rku=function(){function e(t,n,r,i,o,s){if(s!==Nku){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}e.isRequired=e;function u(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:u,element:e,elementType:e,instanceOf:u,node:e,objectOf:u,oneOf:u,oneOfType:u,shape:u,exact:u,checkPropTypes:fU,resetWarningCache:xU};return a.PropTypes=a,a};mU.exports=Rku();var pU=mU.exports;const Fe=al(pU),gU={mask:Fe.oneOfType([Fe.array,Fe.func,Fe.string,Fe.instanceOf(RegExp),Fe.oneOf([Date,Number,$e.Masked]),Fe.instanceOf($e.Masked)]),value:Fe.any,unmask:Fe.oneOfType([Fe.bool,Fe.oneOf(["typed"])]),prepare:Fe.func,prepareChar:Fe.func,validate:Fe.func,commit:Fe.func,overwrite:Fe.oneOfType([Fe.bool,Fe.oneOf(["shift"])]),eager:Fe.oneOfType([Fe.bool,Fe.oneOf(["append","remove"])]),skipInvalid:Fe.bool,onAccept:Fe.func,onComplete:Fe.func,placeholderChar:Fe.string,displayChar:Fe.string,lazy:Fe.bool,definitions:Fe.object,blocks:Fe.object,enum:Fe.arrayOf(Fe.string),maxLength:Fe.number,from:Fe.number,to:Fe.number,pattern:Fe.string,format:Fe.func,parse:Fe.func,autofix:Fe.oneOfType([Fe.bool,Fe.oneOf(["pad"])]),radix:Fe.string,thousandsSeparator:Fe.string,mapToRadix:Fe.arrayOf(Fe.string),scale:Fe.number,normalizeZeros:Fe.bool,padFractionalZeros:Fe.bool,min:Fe.oneOfType([Fe.number,Fe.instanceOf(Date)]),max:Fe.oneOfType([Fe.number,Fe.instanceOf(Date)]),dispatch:Fe.func,inputRef:Fe.oneOfType([Fe.func,Fe.shape({current:Fe.object})])},CU=Object.keys(gU).filter(e=>e!=="value"),Lku=["value","unmask","onAccept","onComplete","inputRef"],_ku=CU.filter(e=>Lku.indexOf(e)<0);function Iku(e){var u;const a=(u=class extends nu.Component{constructor(r){super(r),this._inputRef=this._inputRef.bind(this)}componentDidMount(){this.props.mask&&this.initMask()}componentDidUpdate(){const r=this.props,i=this._extractMaskOptionsFromProps(r);if(i.mask)this.maskRef?(this.maskRef.updateOptions(i),"value"in r&&r.value!==void 0&&(this.maskValue=r.value)):this.initMask(i);else if(this.destroyMask(),"value"in r&&r.value!==void 0){var o;(o=this.element)!=null&&o.isContentEditable&&this.element.tagName!=="INPUT"&&this.element.tagName!=="TEXTAREA"?this.element.textContent=r.value:this.element.value=r.value}}componentWillUnmount(){this.destroyMask()}_inputRef(r){this.element=r,this.props.inputRef&&(Object.prototype.hasOwnProperty.call(this.props.inputRef,"current")?this.props.inputRef.current=r:this.props.inputRef(r))}initMask(r){r===void 0&&(r=this._extractMaskOptionsFromProps(this.props)),this.maskRef=$e(this.element,r).on("accept",this._onAccept.bind(this)).on("complete",this._onComplete.bind(this)),"value"in this.props&&this.props.value!==void 0&&(this.maskValue=this.props.value)}destroyMask(){this.maskRef&&(this.maskRef.destroy(),delete this.maskRef)}_extractMaskOptionsFromProps(r){const{...i}=r;return Object.keys(i).filter(o=>_ku.indexOf(o)<0).forEach(o=>{delete i[o]}),i}_extractNonMaskProps(r){const{...i}=r;return CU.forEach(o=>{o!=="maxLength"&&delete i[o]}),"defaultValue"in i||(i.defaultValue=r.mask?"":i.value),delete i.value,i}get maskValue(){return this.maskRef?this.props.unmask==="typed"?this.maskRef.typedValue:this.props.unmask?this.maskRef.unmaskedValue:this.maskRef.value:""}set maskValue(r){this.maskRef&&(r=r==null&&this.props.unmask!=="typed"?"":r,this.props.unmask==="typed"?this.maskRef.typedValue=r:this.props.unmask?this.maskRef.unmaskedValue=r:this.maskRef.value=r)}_onAccept(r){this.props.onAccept&&this.maskRef&&this.props.onAccept(this.maskValue,this.maskRef,r)}_onComplete(r){this.props.onComplete&&this.maskRef&&this.props.onComplete(this.maskValue,this.maskRef,r)}render(){return nu.createElement(e,{...this._extractNonMaskProps(this.props),inputRef:this._inputRef})}},u.displayName=void 0,u.propTypes=void 0,u),t=e.displayName||e.name||"Component";return a.displayName="IMask("+t+")",a.propTypes=gU,nu.forwardRef((n,r)=>nu.createElement(a,{...n,ref:r}))}const Kku=Iku(e=>{let{inputRef:u,...a}=e;return nu.createElement("input",{...a,ref:u})}),$ku=(e,u)=>nu.createElement(Kku,{...e,ref:u});nu.forwardRef($ku);function Vku(e,u){let{onAccept:a,onComplete:t,ref:n=C.useRef(null),defaultValue:r,defaultUnmaskedValue:i,defaultTypedValue:o}=u===void 0?{}:u;const s=C.useRef(null),[l,E]=C.useState({}),[c,D]=C.useState(""),[h,m]=C.useState(""),[x,p]=C.useState(),f=C.useCallback(()=>{var y;(y=s.current)==null||y.destroy(),s.current=null},[]),g=C.useCallback(()=>{const y=s.current;y&&(E({value:y.value,unmaskedValue:y.unmaskedValue,typedValue:y.typedValue}),p(y.typedValue),m(y.unmaskedValue),D(y.value))},[]),F=C.useCallback(y=>{const v=s.current;v&&(g(),a==null||a(v.value,v,y))},[a]),b=C.useCallback(y=>s.current&&(t==null?void 0:t(s.current.value,s.current,y)),[t]);return C.useEffect(()=>{const{value:y,...v}=l,A=s.current;!A||c===void 0||(y!==c&&(A.value=c,A.value!==c&&F()),E(v))},[c]),C.useEffect(()=>{const{unmaskedValue:y,...v}=l,A=s.current;!A||h===void 0||(y!==h&&(A.unmaskedValue=h,A.unmaskedValue!==h&&F()),E(v))},[h]),C.useEffect(()=>{const{typedValue:y,...v}=l,A=s.current;!A||x===void 0||(y!==x&&(A.typedValue=x,A.masked.typedValueEquals(x)||F()),E(v))},[x]),C.useEffect(()=>{const y=n.current;if(!y||!(e!=null&&e.mask))return f();const v=s.current;v?v==null||v.updateOptions(e):y&&e!=null&&e.mask&&(s.current=$e(y,e),g(),r!==void 0&&D(r),i!==void 0&&m(i),o!==void 0&&p(o))},[e,f,F]),C.useEffect(()=>{if(!s.current)return;const y=s.current;return y.on("accept",F),y.on("complete",b),()=>{y.off("accept",F),y.off("complete",b)}},[F,b]),C.useEffect(()=>f,[f]),{ref:n,maskRef:s,value:c,setValue:D,unmaskedValue:h,setUnmaskedValue:m,typedValue:x,setTypedValue:p}}function Hku(e){return u=>{for(const a of e)mb(a,u)}}function Gku(e){return u=>{const a=[];for(const t of e){const n=mb(t,u),r=typeof n=="function";a.push(r?n:()=>mb(t,null))}return()=>{for(const t of a)t()}}}function mb(e,u){if(typeof e=="function")return e(u);e&&(e.current=u)}var Jku=parseInt(C.version.split(".")[0],10)>=19?Gku:Hku;const SE=C.forwardRef(({value:e,onChange:u,...a},t)=>{const{ref:n,value:r,setValue:i}=Vku({mask:/^[a-zA-Z0-9_-]*$/,prepare:(o,s)=>{const l=o.toLowerCase().replace(/ /g,"-").replace(/-+/g,"-");return l!=="-"||s._value.length===0||s._value[s._value.length-1]!=="-"?l:""},commit:(o,s)=>{const l=o.replace(/-+/g,"-");s._value=l},overwrite:!1,skipInvalid:!0},{defaultValue:e,onAccept:u});return d.jsx(gt,{ref:Jku([t,n]),value:r,onChange:o=>i(o.target.value),...a})});SE.displayName="PathInput";var x0;(function(e){e.assertEqual=n=>{};function u(n){}e.assertIs=u;function a(n){throw new Error}e.assertNever=a,e.arrayToEnum=n=>{const r={};for(const i of n)r[i]=i;return r},e.getValidEnumValues=n=>{const r=e.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(const o of r)i[o]=n[o];return e.objectValues(i)},e.objectValues=n=>e.objectKeys(n).map(function(r){return n[r]}),e.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{const r=[];for(const i in n)Object.prototype.hasOwnProperty.call(n,i)&&r.push(i);return r},e.find=(n,r)=>{for(const i of n)if(r(i))return i},e.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function t(n,r=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(r)}e.joinValues=t,e.jsonStringifyReplacer=(n,r)=>typeof r=="bigint"?r.toString():r})(x0||(x0={}));var Ep;(function(e){e.mergeShapes=(u,a)=>({...u,...a})})(Ep||(Ep={}));const Qu=x0.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),yo=e=>{switch(typeof e){case"undefined":return Qu.undefined;case"string":return Qu.string;case"number":return Number.isNaN(e)?Qu.nan:Qu.number;case"boolean":return Qu.boolean;case"function":return Qu.function;case"bigint":return Qu.bigint;case"symbol":return Qu.symbol;case"object":return Array.isArray(e)?Qu.array:e===null?Qu.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Qu.promise:typeof Map<"u"&&e instanceof Map?Qu.map:typeof Set<"u"&&e instanceof Set?Qu.set:typeof Date<"u"&&e instanceof Date?Qu.date:Qu.object;default:return Qu.unknown}},gu=x0.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),FU=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class ur extends Error{get errors(){return this.issues}constructor(u){super(),this.issues=[],this.addIssue=t=>{this.issues=[...this.issues,t]},this.addIssues=(t=[])=>{this.issues=[...this.issues,...t]};const a=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,a):this.__proto__=a,this.name="ZodError",this.issues=u}format(u){const a=u||function(r){return r.message},t={_errors:[]},n=r=>{for(const i of r.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)t._errors.push(a(i));else{let o=t,s=0;for(;s<i.path.length;){const l=i.path[s];s===i.path.length-1?(o[l]=o[l]||{_errors:[]},o[l]._errors.push(a(i))):o[l]=o[l]||{_errors:[]},o=o[l],s++}}};return n(this),t}static assert(u){if(!(u instanceof ur))throw new Error(`Not a ZodError: ${u}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x0.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(u=a=>a.message){const a={},t=[];for(const n of this.issues)if(n.path.length>0){const r=n.path[0];a[r]=a[r]||[],a[r].push(u(n))}else t.push(u(n));return{formErrors:t,fieldErrors:a}}get formErrors(){return this.flatten()}}ur.create=e=>new ur(e);const Wku=(e,u)=>{let a;switch(e.code){case gu.invalid_type:e.received===Qu.undefined?a="Required":a=`Expected ${e.expected}, received ${e.received}`;break;case gu.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,x0.jsonStringifyReplacer)}`;break;case gu.unrecognized_keys:a=`Unrecognized key(s) in object: ${x0.joinValues(e.keys,", ")}`;break;case gu.invalid_union:a="Invalid input";break;case gu.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${x0.joinValues(e.options)}`;break;case gu.invalid_enum_value:a=`Invalid enum value. Expected ${x0.joinValues(e.options)}, received '${e.received}'`;break;case gu.invalid_arguments:a="Invalid function arguments";break;case gu.invalid_return_type:a="Invalid function return type";break;case gu.invalid_date:a="Invalid date";break;case gu.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:x0.assertNever(e.validation):e.validation!=="regex"?a=`Invalid ${e.validation}`:a="Invalid";break;case gu.too_small:e.type==="array"?a=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?a=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?a=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?a=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?a=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:a="Invalid input";break;case gu.too_big:e.type==="array"?a=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?a=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?a=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?a=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?a=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:a="Invalid input";break;case gu.custom:a="Invalid input";break;case gu.invalid_intersection_types:a="Intersection results could not be merged";break;case gu.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case gu.not_finite:a="Number must be finite";break;default:a=u.defaultError,x0.assertNever(e)}return{message:a}},Y4=Wku;let kU=Y4;function vU(e){kU=e}function ah(){return kU}const th=e=>{const{data:u,path:a,errorMaps:t,issueData:n}=e,r=[...a,...n.path||[]],i={...n,path:r};if(n.message!==void 0)return{...n,path:r,message:n.message};let o="";const s=t.filter(l=>!!l).slice().reverse();for(const l of s)o=l(i,{data:u,defaultError:o}).message;return{...n,path:r,message:o}},AU=[];function Hu(e,u){const a=ah(),t=th({issueData:u,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===Y4?void 0:Y4].filter(n=>!!n)});e.common.issues.push(t)}class Qt{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(u,a){const t=[];for(const n of a){if(n.status==="aborted")return je;n.status==="dirty"&&u.dirty(),t.push(n.value)}return{status:u.value,value:t}}static async mergeObjectAsync(u,a){const t=[];for(const n of a){const r=await n.key,i=await n.value;t.push({key:r,value:i})}return Qt.mergeObjectSync(u,t)}static mergeObjectSync(u,a){const t={};for(const n of a){const{key:r,value:i}=n;if(r.status==="aborted"||i.status==="aborted")return je;r.status==="dirty"&&u.dirty(),i.status==="dirty"&&u.dirty(),r.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(t[r.value]=i.value)}return{status:u.value,value:t}}}const je=Object.freeze({status:"aborted"}),k4=e=>({status:"dirty",value:e}),mn=e=>({status:"valid",value:e}),cp=e=>e.status==="aborted",dp=e=>e.status==="dirty",f1=e=>e.status==="valid",x3=e=>typeof Promise<"u"&&e instanceof Promise;var Ce;(function(e){e.errToObj=u=>typeof u=="string"?{message:u}:u||{},e.toString=u=>typeof u=="string"?u:u==null?void 0:u.message})(Ce||(Ce={}));class Yo{constructor(u,a,t,n){this._cachedPath=[],this.parent=u,this.data=a,this._path=t,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const nP=(e,u)=>{if(f1(u))return{success:!0,data:u.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const a=new ur(e.common.issues);return this._error=a,this._error}}};function qe(e){if(!e)return{};const{errorMap:u,invalid_type_error:a,required_error:t,description:n}=e;if(u&&(a||t))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return u?{errorMap:u,description:n}:{errorMap:(i,o)=>{const{message:s}=e;return i.code==="invalid_enum_value"?{message:s??o.defaultError}:typeof o.data>"u"?{message:s??t??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:s??a??o.defaultError}},description:n}}class Ue{get description(){return this._def.description}_getType(u){return yo(u.data)}_getOrReturnCtx(u,a){return a||{common:u.parent.common,data:u.data,parsedType:yo(u.data),schemaErrorMap:this._def.errorMap,path:u.path,parent:u.parent}}_processInputParams(u){return{status:new Qt,ctx:{common:u.parent.common,data:u.data,parsedType:yo(u.data),schemaErrorMap:this._def.errorMap,path:u.path,parent:u.parent}}}_parseSync(u){const a=this._parse(u);if(x3(a))throw new Error("Synchronous parse encountered promise.");return a}_parseAsync(u){const a=this._parse(u);return Promise.resolve(a)}parse(u,a){const t=this.safeParse(u,a);if(t.success)return t.data;throw t.error}safeParse(u,a){const t={common:{issues:[],async:(a==null?void 0:a.async)??!1,contextualErrorMap:a==null?void 0:a.errorMap},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:yo(u)},n=this._parseSync({data:u,path:t.path,parent:t});return nP(t,n)}"~validate"(u){var t,n;const a={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:yo(u)};if(!this["~standard"].async)try{const r=this._parseSync({data:u,path:[],parent:a});return f1(r)?{value:r.value}:{issues:a.common.issues}}catch(r){(n=(t=r==null?void 0:r.message)==null?void 0:t.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),a.common={issues:[],async:!0}}return this._parseAsync({data:u,path:[],parent:a}).then(r=>f1(r)?{value:r.value}:{issues:a.common.issues})}async parseAsync(u,a){const t=await this.safeParseAsync(u,a);if(t.success)return t.data;throw t.error}async safeParseAsync(u,a){const t={common:{issues:[],contextualErrorMap:a==null?void 0:a.errorMap,async:!0},path:(a==null?void 0:a.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:u,parsedType:yo(u)},n=this._parse({data:u,path:t.path,parent:t}),r=await(x3(n)?n:Promise.resolve(n));return nP(t,r)}refine(u,a){const t=n=>typeof a=="string"||typeof a>"u"?{message:a}:typeof a=="function"?a(n):a;return this._refinement((n,r)=>{const i=u(n),o=()=>r.addIssue({code:gu.custom,...t(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(s=>s?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(u,a){return this._refinement((t,n)=>u(t)?!0:(n.addIssue(typeof a=="function"?a(t,n):a),!1))}_refinement(u){return new Pr({schema:this,typeName:zu.ZodEffects,effect:{type:"refinement",refinement:u}})}superRefine(u){return this._refinement(u)}constructor(u){this.spa=this.safeParseAsync,this._def=u,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a=>this["~validate"](a)}}optional(){return Qi.create(this,this._def)}nullable(){return Ys.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return di.create(this)}promise(){return uE.create(this,this._def)}or(u){return C3.create([this,u],this._def)}and(u){return F3.create(this,u,this._def)}transform(u){return new Pr({...qe(this._def),schema:this,typeName:zu.ZodEffects,effect:{type:"transform",transform:u}})}default(u){const a=typeof u=="function"?u:()=>u;return new y3({...qe(this._def),innerType:this,defaultValue:a,typeName:zu.ZodDefault})}brand(){return new N2({typeName:zu.ZodBranded,type:this,...qe(this._def)})}catch(u){const a=typeof u=="function"?u:()=>u;return new B3({...qe(this._def),innerType:this,catchValue:a,typeName:zu.ZodCatch})}describe(u){const a=this.constructor;return new a({...this._def,description:u})}pipe(u){return Fd.create(this,u)}readonly(){return S3.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Uku=/^c[^\s-]{8,}$/i,Zku=/^[0-9a-z]+$/,Qku=/^[0-9A-HJKMNP-TV-Z]{26}$/i,qku=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Yku=/^[a-z0-9_-]{21}$/i,Xku=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,uvu=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,evu=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,avu="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let $k;const tvu=/^(?:(?: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])$/,nvu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,rvu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ivu=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ovu=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,svu=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,bU="((\\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])))",lvu=new RegExp(`^${bU}$`);function yU(e){let u="[0-5]\\d";e.precision?u=`${u}\\.\\d{${e.precision}}`:e.precision==null&&(u=`${u}(\\.\\d+)?`);const a=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${u})${a}`}function Evu(e){return new RegExp(`^${yU(e)}$`)}function eS(e){let u=`${bU}T${yU(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),u=`${u}(${a.join("|")})`,new RegExp(`^${u}$`)}function cvu(e,u){return!!((u==="v4"||!u)&&tvu.test(e)||(u==="v6"||!u)&&rvu.test(e))}function dvu(e,u){if(!Xku.test(e))return!1;try{const[a]=e.split(".");if(!a)return!1;const t=a.replace(/-/g,"+").replace(/_/g,"/").padEnd(a.length+(4-a.length%4)%4,"="),n=JSON.parse(atob(t));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||u&&n.alg!==u)}catch{return!1}}function Dvu(e,u){return!!((u==="v4"||!u)&&nvu.test(e)||(u==="v6"||!u)&&ivu.test(e))}class oi extends Ue{_parse(u){if(this._def.coerce&&(u.data=String(u.data)),this._getType(u)!==Qu.string){const r=this._getOrReturnCtx(u);return Hu(r,{code:gu.invalid_type,expected:Qu.string,received:r.parsedType}),je}const t=new Qt;let n;for(const r of this._def.checks)if(r.kind==="min")u.data.length<r.value&&(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind==="max")u.data.length>r.value&&(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),t.dirty());else if(r.kind==="length"){const i=u.data.length>r.value,o=u.data.length<r.value;(i||o)&&(n=this._getOrReturnCtx(u,n),i?Hu(n,{code:gu.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&Hu(n,{code:gu.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),t.dirty())}else if(r.kind==="email")evu.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"email",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="emoji")$k||($k=new RegExp(avu,"u")),$k.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"emoji",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="uuid")qku.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"uuid",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="nanoid")Yku.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"nanoid",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="cuid")Uku.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"cuid",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="cuid2")Zku.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"cuid2",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="ulid")Qku.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"ulid",code:gu.invalid_string,message:r.message}),t.dirty());else if(r.kind==="url")try{new URL(u.data)}catch{n=this._getOrReturnCtx(u,n),Hu(n,{validation:"url",code:gu.invalid_string,message:r.message}),t.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"regex",code:gu.invalid_string,message:r.message}),t.dirty())):r.kind==="trim"?u.data=u.data.trim():r.kind==="includes"?u.data.includes(r.value,r.position)||(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),t.dirty()):r.kind==="toLowerCase"?u.data=u.data.toLowerCase():r.kind==="toUpperCase"?u.data=u.data.toUpperCase():r.kind==="startsWith"?u.data.startsWith(r.value)||(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.invalid_string,validation:{startsWith:r.value},message:r.message}),t.dirty()):r.kind==="endsWith"?u.data.endsWith(r.value)||(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.invalid_string,validation:{endsWith:r.value},message:r.message}),t.dirty()):r.kind==="datetime"?eS(r).test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.invalid_string,validation:"datetime",message:r.message}),t.dirty()):r.kind==="date"?lvu.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.invalid_string,validation:"date",message:r.message}),t.dirty()):r.kind==="time"?Evu(r).test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.invalid_string,validation:"time",message:r.message}),t.dirty()):r.kind==="duration"?uvu.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"duration",code:gu.invalid_string,message:r.message}),t.dirty()):r.kind==="ip"?cvu(u.data,r.version)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"ip",code:gu.invalid_string,message:r.message}),t.dirty()):r.kind==="jwt"?dvu(u.data,r.alg)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"jwt",code:gu.invalid_string,message:r.message}),t.dirty()):r.kind==="cidr"?Dvu(u.data,r.version)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"cidr",code:gu.invalid_string,message:r.message}),t.dirty()):r.kind==="base64"?ovu.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"base64",code:gu.invalid_string,message:r.message}),t.dirty()):r.kind==="base64url"?svu.test(u.data)||(n=this._getOrReturnCtx(u,n),Hu(n,{validation:"base64url",code:gu.invalid_string,message:r.message}),t.dirty()):x0.assertNever(r);return{status:t.value,value:u.data}}_regex(u,a,t){return this.refinement(n=>u.test(n),{validation:a,code:gu.invalid_string,...Ce.errToObj(t)})}_addCheck(u){return new oi({...this._def,checks:[...this._def.checks,u]})}email(u){return this._addCheck({kind:"email",...Ce.errToObj(u)})}url(u){return this._addCheck({kind:"url",...Ce.errToObj(u)})}emoji(u){return this._addCheck({kind:"emoji",...Ce.errToObj(u)})}uuid(u){return this._addCheck({kind:"uuid",...Ce.errToObj(u)})}nanoid(u){return this._addCheck({kind:"nanoid",...Ce.errToObj(u)})}cuid(u){return this._addCheck({kind:"cuid",...Ce.errToObj(u)})}cuid2(u){return this._addCheck({kind:"cuid2",...Ce.errToObj(u)})}ulid(u){return this._addCheck({kind:"ulid",...Ce.errToObj(u)})}base64(u){return this._addCheck({kind:"base64",...Ce.errToObj(u)})}base64url(u){return this._addCheck({kind:"base64url",...Ce.errToObj(u)})}jwt(u){return this._addCheck({kind:"jwt",...Ce.errToObj(u)})}ip(u){return this._addCheck({kind:"ip",...Ce.errToObj(u)})}cidr(u){return this._addCheck({kind:"cidr",...Ce.errToObj(u)})}datetime(u){return typeof u=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:u}):this._addCheck({kind:"datetime",precision:typeof(u==null?void 0:u.precision)>"u"?null:u==null?void 0:u.precision,offset:(u==null?void 0:u.offset)??!1,local:(u==null?void 0:u.local)??!1,...Ce.errToObj(u==null?void 0:u.message)})}date(u){return this._addCheck({kind:"date",message:u})}time(u){return typeof u=="string"?this._addCheck({kind:"time",precision:null,message:u}):this._addCheck({kind:"time",precision:typeof(u==null?void 0:u.precision)>"u"?null:u==null?void 0:u.precision,...Ce.errToObj(u==null?void 0:u.message)})}duration(u){return this._addCheck({kind:"duration",...Ce.errToObj(u)})}regex(u,a){return this._addCheck({kind:"regex",regex:u,...Ce.errToObj(a)})}includes(u,a){return this._addCheck({kind:"includes",value:u,position:a==null?void 0:a.position,...Ce.errToObj(a==null?void 0:a.message)})}startsWith(u,a){return this._addCheck({kind:"startsWith",value:u,...Ce.errToObj(a)})}endsWith(u,a){return this._addCheck({kind:"endsWith",value:u,...Ce.errToObj(a)})}min(u,a){return this._addCheck({kind:"min",value:u,...Ce.errToObj(a)})}max(u,a){return this._addCheck({kind:"max",value:u,...Ce.errToObj(a)})}length(u,a){return this._addCheck({kind:"length",value:u,...Ce.errToObj(a)})}nonempty(u){return this.min(1,Ce.errToObj(u))}trim(){return new oi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new oi({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new oi({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(u=>u.kind==="datetime")}get isDate(){return!!this._def.checks.find(u=>u.kind==="date")}get isTime(){return!!this._def.checks.find(u=>u.kind==="time")}get isDuration(){return!!this._def.checks.find(u=>u.kind==="duration")}get isEmail(){return!!this._def.checks.find(u=>u.kind==="email")}get isURL(){return!!this._def.checks.find(u=>u.kind==="url")}get isEmoji(){return!!this._def.checks.find(u=>u.kind==="emoji")}get isUUID(){return!!this._def.checks.find(u=>u.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(u=>u.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(u=>u.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(u=>u.kind==="cuid2")}get isULID(){return!!this._def.checks.find(u=>u.kind==="ulid")}get isIP(){return!!this._def.checks.find(u=>u.kind==="ip")}get isCIDR(){return!!this._def.checks.find(u=>u.kind==="cidr")}get isBase64(){return!!this._def.checks.find(u=>u.kind==="base64")}get isBase64url(){return!!this._def.checks.find(u=>u.kind==="base64url")}get minLength(){let u=null;for(const a of this._def.checks)a.kind==="min"&&(u===null||a.value>u)&&(u=a.value);return u}get maxLength(){let u=null;for(const a of this._def.checks)a.kind==="max"&&(u===null||a.value<u)&&(u=a.value);return u}}oi.create=e=>new oi({checks:[],typeName:zu.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...qe(e)});function hvu(e,u){const a=(e.toString().split(".")[1]||"").length,t=(u.toString().split(".")[1]||"").length,n=a>t?a:t,r=Number.parseInt(e.toFixed(n).replace(".","")),i=Number.parseInt(u.toFixed(n).replace(".",""));return r%i/10**n}class Zs extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(u){if(this._def.coerce&&(u.data=Number(u.data)),this._getType(u)!==Qu.number){const r=this._getOrReturnCtx(u);return Hu(r,{code:gu.invalid_type,expected:Qu.number,received:r.parsedType}),je}let t;const n=new Qt;for(const r of this._def.checks)r.kind==="int"?x0.isInteger(u.data)||(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.invalid_type,expected:"integer",received:"float",message:r.message}),n.dirty()):r.kind==="min"?(r.inclusive?u.data<r.value:u.data<=r.value)&&(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind==="max"?(r.inclusive?u.data>r.value:u.data>=r.value)&&(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),n.dirty()):r.kind==="multipleOf"?hvu(u.data,r.value)!==0&&(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):r.kind==="finite"?Number.isFinite(u.data)||(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.not_finite,message:r.message}),n.dirty()):x0.assertNever(r);return{status:n.value,value:u.data}}gte(u,a){return this.setLimit("min",u,!0,Ce.toString(a))}gt(u,a){return this.setLimit("min",u,!1,Ce.toString(a))}lte(u,a){return this.setLimit("max",u,!0,Ce.toString(a))}lt(u,a){return this.setLimit("max",u,!1,Ce.toString(a))}setLimit(u,a,t,n){return new Zs({...this._def,checks:[...this._def.checks,{kind:u,value:a,inclusive:t,message:Ce.toString(n)}]})}_addCheck(u){return new Zs({...this._def,checks:[...this._def.checks,u]})}int(u){return this._addCheck({kind:"int",message:Ce.toString(u)})}positive(u){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Ce.toString(u)})}negative(u){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Ce.toString(u)})}nonpositive(u){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Ce.toString(u)})}nonnegative(u){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Ce.toString(u)})}multipleOf(u,a){return this._addCheck({kind:"multipleOf",value:u,message:Ce.toString(a)})}finite(u){return this._addCheck({kind:"finite",message:Ce.toString(u)})}safe(u){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Ce.toString(u)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Ce.toString(u)})}get minValue(){let u=null;for(const a of this._def.checks)a.kind==="min"&&(u===null||a.value>u)&&(u=a.value);return u}get maxValue(){let u=null;for(const a of this._def.checks)a.kind==="max"&&(u===null||a.value<u)&&(u=a.value);return u}get isInt(){return!!this._def.checks.find(u=>u.kind==="int"||u.kind==="multipleOf"&&x0.isInteger(u.value))}get isFinite(){let u=null,a=null;for(const t of this._def.checks){if(t.kind==="finite"||t.kind==="int"||t.kind==="multipleOf")return!0;t.kind==="min"?(a===null||t.value>a)&&(a=t.value):t.kind==="max"&&(u===null||t.value<u)&&(u=t.value)}return Number.isFinite(a)&&Number.isFinite(u)}}Zs.create=e=>new Zs({checks:[],typeName:zu.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...qe(e)});class Qs extends Ue{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(u){if(this._def.coerce)try{u.data=BigInt(u.data)}catch{return this._getInvalidInput(u)}if(this._getType(u)!==Qu.bigint)return this._getInvalidInput(u);let t;const n=new Qt;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?u.data<r.value:u.data<=r.value)&&(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind==="max"?(r.inclusive?u.data>r.value:u.data>=r.value)&&(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),n.dirty()):r.kind==="multipleOf"?u.data%r.value!==BigInt(0)&&(t=this._getOrReturnCtx(u,t),Hu(t,{code:gu.not_multiple_of,multipleOf:r.value,message:r.message}),n.dirty()):x0.assertNever(r);return{status:n.value,value:u.data}}_getInvalidInput(u){const a=this._getOrReturnCtx(u);return Hu(a,{code:gu.invalid_type,expected:Qu.bigint,received:a.parsedType}),je}gte(u,a){return this.setLimit("min",u,!0,Ce.toString(a))}gt(u,a){return this.setLimit("min",u,!1,Ce.toString(a))}lte(u,a){return this.setLimit("max",u,!0,Ce.toString(a))}lt(u,a){return this.setLimit("max",u,!1,Ce.toString(a))}setLimit(u,a,t,n){return new Qs({...this._def,checks:[...this._def.checks,{kind:u,value:a,inclusive:t,message:Ce.toString(n)}]})}_addCheck(u){return new Qs({...this._def,checks:[...this._def.checks,u]})}positive(u){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Ce.toString(u)})}negative(u){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Ce.toString(u)})}nonpositive(u){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Ce.toString(u)})}nonnegative(u){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Ce.toString(u)})}multipleOf(u,a){return this._addCheck({kind:"multipleOf",value:u,message:Ce.toString(a)})}get minValue(){let u=null;for(const a of this._def.checks)a.kind==="min"&&(u===null||a.value>u)&&(u=a.value);return u}get maxValue(){let u=null;for(const a of this._def.checks)a.kind==="max"&&(u===null||a.value<u)&&(u=a.value);return u}}Qs.create=e=>new Qs({checks:[],typeName:zu.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...qe(e)});class f3 extends Ue{_parse(u){if(this._def.coerce&&(u.data=!!u.data),this._getType(u)!==Qu.boolean){const t=this._getOrReturnCtx(u);return Hu(t,{code:gu.invalid_type,expected:Qu.boolean,received:t.parsedType}),je}return mn(u.data)}}f3.create=e=>new f3({typeName:zu.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...qe(e)});class p1 extends Ue{_parse(u){if(this._def.coerce&&(u.data=new Date(u.data)),this._getType(u)!==Qu.date){const r=this._getOrReturnCtx(u);return Hu(r,{code:gu.invalid_type,expected:Qu.date,received:r.parsedType}),je}if(Number.isNaN(u.data.getTime())){const r=this._getOrReturnCtx(u);return Hu(r,{code:gu.invalid_date}),je}const t=new Qt;let n;for(const r of this._def.checks)r.kind==="min"?u.data.getTime()<r.value&&(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),t.dirty()):r.kind==="max"?u.data.getTime()>r.value&&(n=this._getOrReturnCtx(u,n),Hu(n,{code:gu.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),t.dirty()):x0.assertNever(r);return{status:t.value,value:new Date(u.data.getTime())}}_addCheck(u){return new p1({...this._def,checks:[...this._def.checks,u]})}min(u,a){return this._addCheck({kind:"min",value:u.getTime(),message:Ce.toString(a)})}max(u,a){return this._addCheck({kind:"max",value:u.getTime(),message:Ce.toString(a)})}get minDate(){let u=null;for(const a of this._def.checks)a.kind==="min"&&(u===null||a.value>u)&&(u=a.value);return u!=null?new Date(u):null}get maxDate(){let u=null;for(const a of this._def.checks)a.kind==="max"&&(u===null||a.value<u)&&(u=a.value);return u!=null?new Date(u):null}}p1.create=e=>new p1({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:zu.ZodDate,...qe(e)});class nh extends Ue{_parse(u){if(this._getType(u)!==Qu.symbol){const t=this._getOrReturnCtx(u);return Hu(t,{code:gu.invalid_type,expected:Qu.symbol,received:t.parsedType}),je}return mn(u.data)}}nh.create=e=>new nh({typeName:zu.ZodSymbol,...qe(e)});class p3 extends Ue{_parse(u){if(this._getType(u)!==Qu.undefined){const t=this._getOrReturnCtx(u);return Hu(t,{code:gu.invalid_type,expected:Qu.undefined,received:t.parsedType}),je}return mn(u.data)}}p3.create=e=>new p3({typeName:zu.ZodUndefined,...qe(e)});class g3 extends Ue{_parse(u){if(this._getType(u)!==Qu.null){const t=this._getOrReturnCtx(u);return Hu(t,{code:gu.invalid_type,expected:Qu.null,received:t.parsedType}),je}return mn(u.data)}}g3.create=e=>new g3({typeName:zu.ZodNull,...qe(e)});class X4 extends Ue{constructor(){super(...arguments),this._any=!0}_parse(u){return mn(u.data)}}X4.create=e=>new X4({typeName:zu.ZodAny,...qe(e)});class e1 extends Ue{constructor(){super(...arguments),this._unknown=!0}_parse(u){return mn(u.data)}}e1.create=e=>new e1({typeName:zu.ZodUnknown,...qe(e)});class Xo extends Ue{_parse(u){const a=this._getOrReturnCtx(u);return Hu(a,{code:gu.invalid_type,expected:Qu.never,received:a.parsedType}),je}}Xo.create=e=>new Xo({typeName:zu.ZodNever,...qe(e)});class rh extends Ue{_parse(u){if(this._getType(u)!==Qu.undefined){const t=this._getOrReturnCtx(u);return Hu(t,{code:gu.invalid_type,expected:Qu.void,received:t.parsedType}),je}return mn(u.data)}}rh.create=e=>new rh({typeName:zu.ZodVoid,...qe(e)});class di extends Ue{_parse(u){const{ctx:a,status:t}=this._processInputParams(u),n=this._def;if(a.parsedType!==Qu.array)return Hu(a,{code:gu.invalid_type,expected:Qu.array,received:a.parsedType}),je;if(n.exactLength!==null){const i=a.data.length>n.exactLength.value,o=a.data.length<n.exactLength.value;(i||o)&&(Hu(a,{code:i?gu.too_big:gu.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),t.dirty())}if(n.minLength!==null&&a.data.length<n.minLength.value&&(Hu(a,{code:gu.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),t.dirty()),n.maxLength!==null&&a.data.length>n.maxLength.value&&(Hu(a,{code:gu.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),t.dirty()),a.common.async)return Promise.all([...a.data].map((i,o)=>n.type._parseAsync(new Yo(a,i,a.path,o)))).then(i=>Qt.mergeArray(t,i));const r=[...a.data].map((i,o)=>n.type._parseSync(new Yo(a,i,a.path,o)));return Qt.mergeArray(t,r)}get element(){return this._def.type}min(u,a){return new di({...this._def,minLength:{value:u,message:Ce.toString(a)}})}max(u,a){return new di({...this._def,maxLength:{value:u,message:Ce.toString(a)}})}length(u,a){return new di({...this._def,exactLength:{value:u,message:Ce.toString(a)}})}nonempty(u){return this.min(1,u)}}di.create=(e,u)=>new di({type:e,minLength:null,maxLength:null,exactLength:null,typeName:zu.ZodArray,...qe(u)});function ec(e){if(e instanceof ca){const u={};for(const a in e.shape){const t=e.shape[a];u[a]=Qi.create(ec(t))}return new ca({...e._def,shape:()=>u})}else return e instanceof di?new di({...e._def,type:ec(e.element)}):e instanceof Qi?Qi.create(ec(e.unwrap())):e instanceof Ys?Ys.create(ec(e.unwrap())):e instanceof no?no.create(e.items.map(u=>ec(u))):e}class ca extends Ue{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const u=this._def.shape(),a=x0.objectKeys(u);return this._cached={shape:u,keys:a},this._cached}_parse(u){if(this._getType(u)!==Qu.object){const l=this._getOrReturnCtx(u);return Hu(l,{code:gu.invalid_type,expected:Qu.object,received:l.parsedType}),je}const{status:t,ctx:n}=this._processInputParams(u),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof Xo&&this._def.unknownKeys==="strip"))for(const l in n.data)i.includes(l)||o.push(l);const s=[];for(const l of i){const E=r[l],c=n.data[l];s.push({key:{status:"valid",value:l},value:E._parse(new Yo(n,c,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof Xo){const l=this._def.unknownKeys;if(l==="passthrough")for(const E of o)s.push({key:{status:"valid",value:E},value:{status:"valid",value:n.data[E]}});else if(l==="strict")o.length>0&&(Hu(n,{code:gu.unrecognized_keys,keys:o}),t.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const E of o){const c=n.data[E];s.push({key:{status:"valid",value:E},value:l._parse(new Yo(n,c,n.path,E)),alwaysSet:E in n.data})}}return n.common.async?Promise.resolve().then(async()=>{const l=[];for(const E of s){const c=await E.key,D=await E.value;l.push({key:c,value:D,alwaysSet:E.alwaysSet})}return l}).then(l=>Qt.mergeObjectSync(t,l)):Qt.mergeObjectSync(t,s)}get shape(){return this._def.shape()}strict(u){return Ce.errToObj,new ca({...this._def,unknownKeys:"strict",...u!==void 0?{errorMap:(a,t)=>{var r,i;const n=((i=(r=this._def).errorMap)==null?void 0:i.call(r,a,t).message)??t.defaultError;return a.code==="unrecognized_keys"?{message:Ce.errToObj(u).message??n}:{message:n}}}:{}})}strip(){return new ca({...this._def,unknownKeys:"strip"})}passthrough(){return new ca({...this._def,unknownKeys:"passthrough"})}extend(u){return new ca({...this._def,shape:()=>({...this._def.shape(),...u})})}merge(u){return new ca({unknownKeys:u._def.unknownKeys,catchall:u._def.catchall,shape:()=>({...this._def.shape(),...u._def.shape()}),typeName:zu.ZodObject})}setKey(u,a){return this.augment({[u]:a})}catchall(u){return new ca({...this._def,catchall:u})}pick(u){const a={};for(const t of x0.objectKeys(u))u[t]&&this.shape[t]&&(a[t]=this.shape[t]);return new ca({...this._def,shape:()=>a})}omit(u){const a={};for(const t of x0.objectKeys(this.shape))u[t]||(a[t]=this.shape[t]);return new ca({...this._def,shape:()=>a})}deepPartial(){return ec(this)}partial(u){const a={};for(const t of x0.objectKeys(this.shape)){const n=this.shape[t];u&&!u[t]?a[t]=n:a[t]=n.optional()}return new ca({...this._def,shape:()=>a})}required(u){const a={};for(const t of x0.objectKeys(this.shape))if(u&&!u[t])a[t]=this.shape[t];else{let r=this.shape[t];for(;r instanceof Qi;)r=r._def.innerType;a[t]=r}return new ca({...this._def,shape:()=>a})}keyof(){return BU(x0.objectKeys(this.shape))}}ca.create=(e,u)=>new ca({shape:()=>e,unknownKeys:"strip",catchall:Xo.create(),typeName:zu.ZodObject,...qe(u)});ca.strictCreate=(e,u)=>new ca({shape:()=>e,unknownKeys:"strict",catchall:Xo.create(),typeName:zu.ZodObject,...qe(u)});ca.lazycreate=(e,u)=>new ca({shape:e,unknownKeys:"strip",catchall:Xo.create(),typeName:zu.ZodObject,...qe(u)});class C3 extends Ue{_parse(u){const{ctx:a}=this._processInputParams(u),t=this._def.options;function n(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return a.common.issues.push(...o.ctx.common.issues),o.result;const i=r.map(o=>new ur(o.ctx.common.issues));return Hu(a,{code:gu.invalid_union,unionErrors:i}),je}if(a.common.async)return Promise.all(t.map(async r=>{const i={...a,common:{...a.common,issues:[]},parent:null};return{result:await r._parseAsync({data:a.data,path:a.path,parent:i}),ctx:i}})).then(n);{let r;const i=[];for(const s of t){const l={...a,common:{...a.common,issues:[]},parent:null},E=s._parseSync({data:a.data,path:a.path,parent:l});if(E.status==="valid")return E;E.status==="dirty"&&!r&&(r={result:E,ctx:l}),l.common.issues.length&&i.push(l.common.issues)}if(r)return a.common.issues.push(...r.ctx.common.issues),r.result;const o=i.map(s=>new ur(s));return Hu(a,{code:gu.invalid_union,unionErrors:o}),je}}get options(){return this._def.options}}C3.create=(e,u)=>new C3({options:e,typeName:zu.ZodUnion,...qe(u)});const gs=e=>e instanceof v3?gs(e.schema):e instanceof Pr?gs(e.innerType()):e instanceof A3?[e.value]:e instanceof qs?e.options:e instanceof b3?x0.objectValues(e.enum):e instanceof y3?gs(e._def.innerType):e instanceof p3?[void 0]:e instanceof g3?[null]:e instanceof Qi?[void 0,...gs(e.unwrap())]:e instanceof Ys?[null,...gs(e.unwrap())]:e instanceof N2||e instanceof S3?gs(e.unwrap()):e instanceof B3?gs(e._def.innerType):[];class Fm extends Ue{_parse(u){const{ctx:a}=this._processInputParams(u);if(a.parsedType!==Qu.object)return Hu(a,{code:gu.invalid_type,expected:Qu.object,received:a.parsedType}),je;const t=this.discriminator,n=a.data[t],r=this.optionsMap.get(n);return r?a.common.async?r._parseAsync({data:a.data,path:a.path,parent:a}):r._parseSync({data:a.data,path:a.path,parent:a}):(Hu(a,{code:gu.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[t]}),je)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(u,a,t){const n=new Map;for(const r of a){const i=gs(r.shape[u]);if(!i.length)throw new Error(`A discriminator value for key \`${u}\` could not be extracted from all schema options`);for(const o of i){if(n.has(o))throw new Error(`Discriminator property ${String(u)} has duplicate value ${String(o)}`);n.set(o,r)}}return new Fm({typeName:zu.ZodDiscriminatedUnion,discriminator:u,options:a,optionsMap:n,...qe(t)})}}function xb(e,u){const a=yo(e),t=yo(u);if(e===u)return{valid:!0,data:e};if(a===Qu.object&&t===Qu.object){const n=x0.objectKeys(u),r=x0.objectKeys(e).filter(o=>n.indexOf(o)!==-1),i={...e,...u};for(const o of r){const s=xb(e[o],u[o]);if(!s.valid)return{valid:!1};i[o]=s.data}return{valid:!0,data:i}}else if(a===Qu.array&&t===Qu.array){if(e.length!==u.length)return{valid:!1};const n=[];for(let r=0;r<e.length;r++){const i=e[r],o=u[r],s=xb(i,o);if(!s.valid)return{valid:!1};n.push(s.data)}return{valid:!0,data:n}}else return a===Qu.date&&t===Qu.date&&+e==+u?{valid:!0,data:e}:{valid:!1}}class F3 extends Ue{_parse(u){const{status:a,ctx:t}=this._processInputParams(u),n=(r,i)=>{if(cp(r)||cp(i))return je;const o=xb(r.value,i.value);return o.valid?((dp(r)||dp(i))&&a.dirty(),{status:a.value,value:o.data}):(Hu(t,{code:gu.invalid_intersection_types}),je)};return t.common.async?Promise.all([this._def.left._parseAsync({data:t.data,path:t.path,parent:t}),this._def.right._parseAsync({data:t.data,path:t.path,parent:t})]).then(([r,i])=>n(r,i)):n(this._def.left._parseSync({data:t.data,path:t.path,parent:t}),this._def.right._parseSync({data:t.data,path:t.path,parent:t}))}}F3.create=(e,u,a)=>new F3({left:e,right:u,typeName:zu.ZodIntersection,...qe(a)});class no extends Ue{_parse(u){const{status:a,ctx:t}=this._processInputParams(u);if(t.parsedType!==Qu.array)return Hu(t,{code:gu.invalid_type,expected:Qu.array,received:t.parsedType}),je;if(t.data.length<this._def.items.length)return Hu(t,{code:gu.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),je;!this._def.rest&&t.data.length>this._def.items.length&&(Hu(t,{code:gu.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),a.dirty());const r=[...t.data].map((i,o)=>{const s=this._def.items[o]||this._def.rest;return s?s._parse(new Yo(t,i,t.path,o)):null}).filter(i=>!!i);return t.common.async?Promise.all(r).then(i=>Qt.mergeArray(a,i)):Qt.mergeArray(a,r)}get items(){return this._def.items}rest(u){return new no({...this._def,rest:u})}}no.create=(e,u)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new no({items:e,typeName:zu.ZodTuple,rest:null,...qe(u)})};class k3 extends Ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(u){const{status:a,ctx:t}=this._processInputParams(u);if(t.parsedType!==Qu.object)return Hu(t,{code:gu.invalid_type,expected:Qu.object,received:t.parsedType}),je;const n=[],r=this._def.keyType,i=this._def.valueType;for(const o in t.data)n.push({key:r._parse(new Yo(t,o,t.path,o)),value:i._parse(new Yo(t,t.data[o],t.path,o)),alwaysSet:o in t.data});return t.common.async?Qt.mergeObjectAsync(a,n):Qt.mergeObjectSync(a,n)}get element(){return this._def.valueType}static create(u,a,t){return a instanceof Ue?new k3({keyType:u,valueType:a,typeName:zu.ZodRecord,...qe(t)}):new k3({keyType:oi.create(),valueType:u,typeName:zu.ZodRecord,...qe(a)})}}class ih extends Ue{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(u){const{status:a,ctx:t}=this._processInputParams(u);if(t.parsedType!==Qu.map)return Hu(t,{code:gu.invalid_type,expected:Qu.map,received:t.parsedType}),je;const n=this._def.keyType,r=this._def.valueType,i=[...t.data.entries()].map(([o,s],l)=>({key:n._parse(new Yo(t,o,t.path,[l,"key"])),value:r._parse(new Yo(t,s,t.path,[l,"value"]))}));if(t.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const s of i){const l=await s.key,E=await s.value;if(l.status==="aborted"||E.status==="aborted")return je;(l.status==="dirty"||E.status==="dirty")&&a.dirty(),o.set(l.value,E.value)}return{status:a.value,value:o}})}else{const o=new Map;for(const s of i){const l=s.key,E=s.value;if(l.status==="aborted"||E.status==="aborted")return je;(l.status==="dirty"||E.status==="dirty")&&a.dirty(),o.set(l.value,E.value)}return{status:a.value,value:o}}}}ih.create=(e,u,a)=>new ih({valueType:u,keyType:e,typeName:zu.ZodMap,...qe(a)});class g1 extends Ue{_parse(u){const{status:a,ctx:t}=this._processInputParams(u);if(t.parsedType!==Qu.set)return Hu(t,{code:gu.invalid_type,expected:Qu.set,received:t.parsedType}),je;const n=this._def;n.minSize!==null&&t.data.size<n.minSize.value&&(Hu(t,{code:gu.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),a.dirty()),n.maxSize!==null&&t.data.size>n.maxSize.value&&(Hu(t,{code:gu.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),a.dirty());const r=this._def.valueType;function i(s){const l=new Set;for(const E of s){if(E.status==="aborted")return je;E.status==="dirty"&&a.dirty(),l.add(E.value)}return{status:a.value,value:l}}const o=[...t.data.values()].map((s,l)=>r._parse(new Yo(t,s,t.path,l)));return t.common.async?Promise.all(o).then(s=>i(s)):i(o)}min(u,a){return new g1({...this._def,minSize:{value:u,message:Ce.toString(a)}})}max(u,a){return new g1({...this._def,maxSize:{value:u,message:Ce.toString(a)}})}size(u,a){return this.min(u,a).max(u,a)}nonempty(u){return this.min(1,u)}}g1.create=(e,u)=>new g1({valueType:e,minSize:null,maxSize:null,typeName:zu.ZodSet,...qe(u)});class T4 extends Ue{constructor(){super(...arguments),this.validate=this.implement}_parse(u){const{ctx:a}=this._processInputParams(u);if(a.parsedType!==Qu.function)return Hu(a,{code:gu.invalid_type,expected:Qu.function,received:a.parsedType}),je;function t(o,s){return th({data:o,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,ah(),Y4].filter(l=>!!l),issueData:{code:gu.invalid_arguments,argumentsError:s}})}function n(o,s){return th({data:o,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,ah(),Y4].filter(l=>!!l),issueData:{code:gu.invalid_return_type,returnTypeError:s}})}const r={errorMap:a.common.contextualErrorMap},i=a.data;if(this._def.returns instanceof uE){const o=this;return mn(async function(...s){const l=new ur([]),E=await o._def.args.parseAsync(s,r).catch(h=>{throw l.addIssue(t(s,h)),l}),c=await Reflect.apply(i,this,E);return await o._def.returns._def.type.parseAsync(c,r).catch(h=>{throw l.addIssue(n(c,h)),l})})}else{const o=this;return mn(function(...s){const l=o._def.args.safeParse(s,r);if(!l.success)throw new ur([t(s,l.error)]);const E=Reflect.apply(i,this,l.data),c=o._def.returns.safeParse(E,r);if(!c.success)throw new ur([n(E,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...u){return new T4({...this._def,args:no.create(u).rest(e1.create())})}returns(u){return new T4({...this._def,returns:u})}implement(u){return this.parse(u)}strictImplement(u){return this.parse(u)}static create(u,a,t){return new T4({args:u||no.create([]).rest(e1.create()),returns:a||e1.create(),typeName:zu.ZodFunction,...qe(t)})}}class v3 extends Ue{get schema(){return this._def.getter()}_parse(u){const{ctx:a}=this._processInputParams(u);return this._def.getter()._parse({data:a.data,path:a.path,parent:a})}}v3.create=(e,u)=>new v3({getter:e,typeName:zu.ZodLazy,...qe(u)});class A3 extends Ue{_parse(u){if(u.data!==this._def.value){const a=this._getOrReturnCtx(u);return Hu(a,{received:a.data,code:gu.invalid_literal,expected:this._def.value}),je}return{status:"valid",value:u.data}}get value(){return this._def.value}}A3.create=(e,u)=>new A3({value:e,typeName:zu.ZodLiteral,...qe(u)});function BU(e,u){return new qs({values:e,typeName:zu.ZodEnum,...qe(u)})}class qs extends Ue{_parse(u){if(typeof u.data!="string"){const a=this._getOrReturnCtx(u),t=this._def.values;return Hu(a,{expected:x0.joinValues(t),received:a.parsedType,code:gu.invalid_type}),je}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(u.data)){const a=this._getOrReturnCtx(u),t=this._def.values;return Hu(a,{received:a.data,code:gu.invalid_enum_value,options:t}),je}return mn(u.data)}get options(){return this._def.values}get enum(){const u={};for(const a of this._def.values)u[a]=a;return u}get Values(){const u={};for(const a of this._def.values)u[a]=a;return u}get Enum(){const u={};for(const a of this._def.values)u[a]=a;return u}extract(u,a=this._def){return qs.create(u,{...this._def,...a})}exclude(u,a=this._def){return qs.create(this.options.filter(t=>!u.includes(t)),{...this._def,...a})}}qs.create=BU;class b3 extends Ue{_parse(u){const a=x0.getValidEnumValues(this._def.values),t=this._getOrReturnCtx(u);if(t.parsedType!==Qu.string&&t.parsedType!==Qu.number){const n=x0.objectValues(a);return Hu(t,{expected:x0.joinValues(n),received:t.parsedType,code:gu.invalid_type}),je}if(this._cache||(this._cache=new Set(x0.getValidEnumValues(this._def.values))),!this._cache.has(u.data)){const n=x0.objectValues(a);return Hu(t,{received:t.data,code:gu.invalid_enum_value,options:n}),je}return mn(u.data)}get enum(){return this._def.values}}b3.create=(e,u)=>new b3({values:e,typeName:zu.ZodNativeEnum,...qe(u)});class uE extends Ue{unwrap(){return this._def.type}_parse(u){const{ctx:a}=this._processInputParams(u);if(a.parsedType!==Qu.promise&&a.common.async===!1)return Hu(a,{code:gu.invalid_type,expected:Qu.promise,received:a.parsedType}),je;const t=a.parsedType===Qu.promise?a.data:Promise.resolve(a.data);return mn(t.then(n=>this._def.type.parseAsync(n,{path:a.path,errorMap:a.common.contextualErrorMap})))}}uE.create=(e,u)=>new uE({type:e,typeName:zu.ZodPromise,...qe(u)});class Pr extends Ue{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===zu.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(u){const{status:a,ctx:t}=this._processInputParams(u),n=this._def.effect||null,r={addIssue:i=>{Hu(t,i),i.fatal?a.abort():a.dirty()},get path(){return t.path}};if(r.addIssue=r.addIssue.bind(r),n.type==="preprocess"){const i=n.transform(t.data,r);if(t.common.async)return Promise.resolve(i).then(async o=>{if(a.value==="aborted")return je;const s=await this._def.schema._parseAsync({data:o,path:t.path,parent:t});return s.status==="aborted"?je:s.status==="dirty"||a.value==="dirty"?k4(s.value):s});{if(a.value==="aborted")return je;const o=this._def.schema._parseSync({data:i,path:t.path,parent:t});return o.status==="aborted"?je:o.status==="dirty"||a.value==="dirty"?k4(o.value):o}}if(n.type==="refinement"){const i=o=>{const s=n.refinement(o,r);if(t.common.async)return Promise.resolve(s);if(s instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(t.common.async===!1){const o=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});return o.status==="aborted"?je:(o.status==="dirty"&&a.dirty(),i(o.value),{status:a.value,value:o.value})}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(o=>o.status==="aborted"?je:(o.status==="dirty"&&a.dirty(),i(o.value).then(()=>({status:a.value,value:o.value}))))}if(n.type==="transform")if(t.common.async===!1){const i=this._def.schema._parseSync({data:t.data,path:t.path,parent:t});if(!f1(i))return je;const o=n.transform(i.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:a.value,value:o}}else return this._def.schema._parseAsync({data:t.data,path:t.path,parent:t}).then(i=>f1(i)?Promise.resolve(n.transform(i.value,r)).then(o=>({status:a.value,value:o})):je);x0.assertNever(n)}}Pr.create=(e,u,a)=>new Pr({schema:e,typeName:zu.ZodEffects,effect:u,...qe(a)});Pr.createWithPreprocess=(e,u,a)=>new Pr({schema:u,effect:{type:"preprocess",transform:e},typeName:zu.ZodEffects,...qe(a)});class Qi extends Ue{_parse(u){return this._getType(u)===Qu.undefined?mn(void 0):this._def.innerType._parse(u)}unwrap(){return this._def.innerType}}Qi.create=(e,u)=>new Qi({innerType:e,typeName:zu.ZodOptional,...qe(u)});class Ys extends Ue{_parse(u){return this._getType(u)===Qu.null?mn(null):this._def.innerType._parse(u)}unwrap(){return this._def.innerType}}Ys.create=(e,u)=>new Ys({innerType:e,typeName:zu.ZodNullable,...qe(u)});class y3 extends Ue{_parse(u){const{ctx:a}=this._processInputParams(u);let t=a.data;return a.parsedType===Qu.undefined&&(t=this._def.defaultValue()),this._def.innerType._parse({data:t,path:a.path,parent:a})}removeDefault(){return this._def.innerType}}y3.create=(e,u)=>new y3({innerType:e,typeName:zu.ZodDefault,defaultValue:typeof u.default=="function"?u.default:()=>u.default,...qe(u)});class B3 extends Ue{_parse(u){const{ctx:a}=this._processInputParams(u),t={...a,common:{...a.common,issues:[]}},n=this._def.innerType._parse({data:t.data,path:t.path,parent:{...t}});return x3(n)?n.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new ur(t.common.issues)},input:t.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ur(t.common.issues)},input:t.data})}}removeCatch(){return this._def.innerType}}B3.create=(e,u)=>new B3({innerType:e,typeName:zu.ZodCatch,catchValue:typeof u.catch=="function"?u.catch:()=>u.catch,...qe(u)});class oh extends Ue{_parse(u){if(this._getType(u)!==Qu.nan){const t=this._getOrReturnCtx(u);return Hu(t,{code:gu.invalid_type,expected:Qu.nan,received:t.parsedType}),je}return{status:"valid",value:u.data}}}oh.create=e=>new oh({typeName:zu.ZodNaN,...qe(e)});const SU=Symbol("zod_brand");class N2 extends Ue{_parse(u){const{ctx:a}=this._processInputParams(u),t=a.data;return this._def.type._parse({data:t,path:a.path,parent:a})}unwrap(){return this._def.type}}class Fd extends Ue{_parse(u){const{status:a,ctx:t}=this._processInputParams(u);if(t.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:t.data,path:t.path,parent:t});return r.status==="aborted"?je:r.status==="dirty"?(a.dirty(),k4(r.value)):this._def.out._parseAsync({data:r.value,path:t.path,parent:t})})();{const n=this._def.in._parseSync({data:t.data,path:t.path,parent:t});return n.status==="aborted"?je:n.status==="dirty"?(a.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:t.path,parent:t})}}static create(u,a){return new Fd({in:u,out:a,typeName:zu.ZodPipeline})}}class S3 extends Ue{_parse(u){const a=this._def.innerType._parse(u),t=n=>(f1(n)&&(n.value=Object.freeze(n.value)),n);return x3(a)?a.then(n=>t(n)):t(a)}unwrap(){return this._def.innerType}}S3.create=(e,u)=>new S3({innerType:e,typeName:zu.ZodReadonly,...qe(u)});function rP(e,u){const a=typeof e=="function"?e(u):typeof e=="string"?{message:e}:e;return typeof a=="string"?{message:a}:a}function R2(e,u={},a){return e?X4.create().superRefine((t,n)=>{const r=e(t);if(r instanceof Promise)return r.then(i=>{if(!i){const o=rP(u,t),s=o.fatal??a??!0;n.addIssue({code:"custom",...o,fatal:s})}});if(!r){const i=rP(u,t),o=i.fatal??a??!0;n.addIssue({code:"custom",...i,fatal:o})}}):X4.create()}const zU={object:ca.lazycreate};var zu;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(zu||(zu={}));const OU=(e,u={message:`Input not instance of ${e.name}`})=>R2(a=>a instanceof e,u),k=oi.create,uu=Zs.create,wU=oh.create,MU=Qs.create,cu=f3.create,us=p1.create,TU=nh.create,PU=p3.create,Qe=g3.create,jU=X4.create,Le=e1.create,NU=Xo.create,RU=rh.create,De=di.create,S=ca.create,LU=ca.strictCreate,ma=C3.create,Oe=Fm.create,aS=F3.create,C1=no.create,$u=k3.create,_U=ih.create,IU=g1.create,KU=T4.create,j0=v3.create,J=A3.create,tr=qs.create,Ku=b3.create,$U=uE.create,Dp=Pr.create,VU=Qi.create,HU=Ys.create,z3=Pr.createWithPreprocess,GU=Fd.create,JU=()=>k().optional(),WU=()=>uu().optional(),UU=()=>cu().optional(),ce={string:e=>oi.create({...e,coerce:!0}),number:e=>Zs.create({...e,coerce:!0}),boolean:e=>f3.create({...e,coerce:!0}),bigint:e=>Qs.create({...e,coerce:!0}),date:e=>p1.create({...e,coerce:!0})},tS=je,q=Object.freeze(Object.defineProperty({__proto__:null,BRAND:SU,DIRTY:k4,EMPTY_PATH:AU,INVALID:je,NEVER:tS,OK:mn,ParseStatus:Qt,Schema:Ue,ZodAny:X4,ZodArray:di,ZodBigInt:Qs,ZodBoolean:f3,ZodBranded:N2,ZodCatch:B3,ZodDate:p1,ZodDefault:y3,ZodDiscriminatedUnion:Fm,ZodEffects:Pr,ZodEnum:qs,ZodError:ur,get ZodFirstPartyTypeKind(){return zu},ZodFunction:T4,ZodIntersection:F3,ZodIssueCode:gu,ZodLazy:v3,ZodLiteral:A3,ZodMap:ih,ZodNaN:oh,ZodNativeEnum:b3,ZodNever:Xo,ZodNull:g3,ZodNullable:Ys,ZodNumber:Zs,ZodObject:ca,ZodOptional:Qi,ZodParsedType:Qu,ZodPipeline:Fd,ZodPromise:uE,ZodReadonly:S3,ZodRecord:k3,ZodSchema:Ue,ZodSet:g1,ZodString:oi,ZodSymbol:nh,ZodTransformer:Pr,ZodTuple:no,ZodType:Ue,ZodUndefined:p3,ZodUnion:C3,ZodUnknown:e1,ZodVoid:rh,addIssueToContext:Hu,any:jU,array:De,bigint:MU,boolean:cu,coerce:ce,custom:R2,date:us,datetimeRegex:eS,defaultErrorMap:Y4,discriminatedUnion:Oe,effect:Dp,enum:tr,function:KU,getErrorMap:ah,getParsedType:yo,instanceof:OU,intersection:aS,isAborted:cp,isAsync:x3,isDirty:dp,isValid:f1,late:zU,lazy:j0,literal:J,makeIssue:th,map:_U,nan:wU,nativeEnum:Ku,never:NU,null:Qe,nullable:HU,number:uu,object:S,get objectUtil(){return Ep},oboolean:UU,onumber:WU,optional:VU,ostring:JU,pipeline:GU,preprocess:z3,promise:$U,quotelessJson:FU,record:$u,set:IU,setErrorMap:vU,strictObject:LU,string:k,symbol:TU,transformer:Dp,tuple:C1,undefined:PU,union:ma,unknown:Le,get util(){return x0},void:RU},Symbol.toStringTag,{value:"Module"})),kd=Object.freeze(Object.defineProperty({__proto__:null,BRAND:SU,DIRTY:k4,EMPTY_PATH:AU,INVALID:je,NEVER:tS,OK:mn,ParseStatus:Qt,Schema:Ue,ZodAny:X4,ZodArray:di,ZodBigInt:Qs,ZodBoolean:f3,ZodBranded:N2,ZodCatch:B3,ZodDate:p1,ZodDefault:y3,ZodDiscriminatedUnion:Fm,ZodEffects:Pr,ZodEnum:qs,ZodError:ur,get ZodFirstPartyTypeKind(){return zu},ZodFunction:T4,ZodIntersection:F3,ZodIssueCode:gu,ZodLazy:v3,ZodLiteral:A3,ZodMap:ih,ZodNaN:oh,ZodNativeEnum:b3,ZodNever:Xo,ZodNull:g3,ZodNullable:Ys,ZodNumber:Zs,ZodObject:ca,ZodOptional:Qi,ZodParsedType:Qu,ZodPipeline:Fd,ZodPromise:uE,ZodReadonly:S3,ZodRecord:k3,ZodSchema:Ue,ZodSet:g1,ZodString:oi,ZodSymbol:nh,ZodTransformer:Pr,ZodTuple:no,ZodType:Ue,ZodUndefined:p3,ZodUnion:C3,ZodUnknown:e1,ZodVoid:rh,addIssueToContext:Hu,any:jU,array:De,bigint:MU,boolean:cu,coerce:ce,custom:R2,date:us,datetimeRegex:eS,default:q,defaultErrorMap:Y4,discriminatedUnion:Oe,effect:Dp,enum:tr,function:KU,getErrorMap:ah,getParsedType:yo,instanceof:OU,intersection:aS,isAborted:cp,isAsync:x3,isDirty:dp,isValid:f1,late:zU,lazy:j0,literal:J,makeIssue:th,map:_U,nan:wU,nativeEnum:Ku,never:NU,null:Qe,nullable:HU,number:uu,object:S,get objectUtil(){return Ep},oboolean:UU,onumber:WU,optional:VU,ostring:JU,pipeline:GU,preprocess:z3,promise:$U,quotelessJson:FU,record:$u,set:IU,setErrorMap:vU,strictObject:LU,string:k,symbol:TU,transformer:Dp,tuple:C1,undefined:PU,union:ma,unknown:Le,get util(){return x0},void:RU,z:q},Symbol.toStringTag,{value:"Module"})),mvu=S({channel:k().min(1,"Channel is required"),tag:k().min(1,"Tag is required"),filePath:k().min(1,"File path is required")});function xvu({onUploaded:e}){const u=Ci(),[a,t]=C.useState(!1),n=pd({mode:"onChange",resolver:gd(mvu),defaultValues:{channel:"",tag:"",filePath:""}}),[r,i]=Ws(async l=>{try{await u("/api/assets/upload-url",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({channel:l.channel.trim(),tag:l.tag.trim(),filePath:l.filePath.trim()})}),Ca.success("Asset uploaded"),t(!1),n.reset(),e==null||e()}catch(E){Ca.error("Upload failed",{description:String(E)})}},[n]),{isDirty:o,isValid:s}=n.formState;return d.jsxs(bE,{open:a,onOpenChange:t,children:[d.jsx(yE,{asChild:!0,children:d.jsx(Ve,{children:"Upload asset"})}),d.jsxs(_1,{children:[d.jsxs(I1,{children:[d.jsx(K1,{children:"Upload APK"}),d.jsx($1,{children:"Provide channel, tag, and local file path to upload."})]}),d.jsx(Cd,{...n,children:d.jsxs("form",{onSubmit:n.handleSubmit(i),className:"space-y-4",children:[d.jsx(_0,{control:n.control,name:"channel",render:({field:l})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Channel"}),d.jsx(T0,{children:d.jsx(SE,{placeholder:"stable, beta, dev...",value:l.value,onChange:l.onChange})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:n.control,name:"tag",render:({field:l})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Tag"}),d.jsx(T0,{children:d.jsx(gt,{placeholder:"v1.2.3",value:l.value,onChange:E=>l.onChange(E.target.value.toLowerCase())})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:n.control,name:"filePath",render:({field:l})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Local file path"}),d.jsx(T0,{children:d.jsx(gt,{placeholder:"/Users/you/Downloads/app.apk",...l})}),d.jsx("p",{className:"text-muted-foreground mt-1 text-xs",children:"Path must be readable by the local server process."}),d.jsx(P0,{})]})}),d.jsx(BE,{children:d.jsx(Ve,{type:"submit",disabled:r.loading||!o||!s,children:r.loading?d.jsxs(d.Fragment,{children:[d.jsx(n8,{className:"h-4 w-4 animate-spin"})," Uploading..."]}):"Upload"})})]})})]})]})}const fvu=[{accessorKey:"channel",header:({column:e})=>d.jsx(Jn,{column:e,title:"Channel"}),meta:{className:"w-full"}},{accessorKey:"tag",header:({column:e})=>d.jsx(Jn,{column:e,title:"Tag"}),meta:{className:"min-w-[150px]"}},{accessorKey:"md5",header:({column:e})=>d.jsx(Jn,{column:e,title:"MD5 hash"}),meta:{className:"truncate"},cell:({row:e})=>d.jsx("div",{className:"text-muted-foreground truncate",children:e.original.md5})},{accessorKey:"createdAt",header:({column:e})=>d.jsx(Jn,{column:e,title:"Updated at"}),cell:({row:e})=>d.jsx("div",{className:"text-muted-foreground",children:d.jsx(up,{date:e.original.createdAt})})}];function pvu(){const{data:e={assets:[]},mutate:u}=ns("/api/assets"),[a,t]=C.useState("all"),[n,r]=C.useState([{id:"createdAt",desc:!0}]),i=C.useMemo(()=>e.assets.map(E=>({channel:E.channel,tag:E.tag,createdAt:new Date(E.createdAt),md5:E.md5})),[e]),o=C.useMemo(()=>{const E=new Set;for(const c of i)E.add(c.channel);return Array.from(E).sort()},[i]),s=C.useMemo(()=>a==="all"?i:i.filter(E=>E.channel===a),[i,a]),l=T8({data:s,columns:fvu,getCoreRowModel:w8(),getSortedRowModel:M8(),onSortingChange:r,initialState:{pagination:{pageIndex:0,pageSize:50}},state:{sorting:n}});return d.jsxs("div",{className:"flex h-full flex-1 flex-col overflow-auto",children:[d.jsxs("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[d.jsx(hm,{children:d.jsx(mm,{children:d.jsx(Ro,{children:d.jsx(m3,{children:"Assets"})})})}),d.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[d.jsxs(Ka,{value:a,onValueChange:E=>t(E),children:[d.jsxs(Oa,{className:"w-fit space-x-2",children:[d.jsx("span",{className:"text-muted-foreground",children:"Channel:"}),d.jsx($a,{placeholder:"Select channel"})]}),d.jsxs(wa,{children:[d.jsx(Re,{value:"all",children:"All"}),o.map(E=>d.jsx(Re,{value:E,children:E},E))]})]}),d.jsx(xvu,{onUploaded:()=>u()})]})]}),d.jsx("div",{className:"flex flex-1 flex-col gap-4 p-4",children:d.jsx(OJ,{table:l,hidePagination:!0})})]})}const nS=(e,u)=>{const a=Ci();return ns(["/api/folders",...e],([t,...n])=>a(t,{method:"POST",body:JSON.stringify({pathSegments:n}),headers:{"Content-Type":"application/json"}}),u)},km=async e=>{const u=e.length?e:["."];await a8(["/api/folders",...u])},gvu=S({name:k().min(1)}),Cvu=e=>{const u=Ci(),[a,t]=C.useState(!1),n=pd({mode:"onChange",resolver:gd(gvu),defaultValues:{name:""}}),[r,i]=Ws(async l=>{const E={pathSegments:[...e.pathSegments,l.name]};try{await u("/api/folders",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)}),t(!1)}catch(c){Ca.error("Failed to create folder.",{description:`${c}`})}km(e.pathSegments)},[e.pathSegments]),{isDirty:o,isValid:s}=n.formState;return C.useEffect(()=>{n.reset()},[n,a]),d.jsxs(bE,{open:a,onOpenChange:t,children:[d.jsx(yE,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",children:[d.jsx(im,{className:"h-4 w-4"}),"Create folder"]})}),d.jsxs(_1,{children:[d.jsxs(I1,{children:[d.jsx(K1,{children:"Create folder"}),d.jsx($1,{children:"Create a new folder"})]}),d.jsx(Cd,{...n,children:d.jsxs("form",{onSubmit:n.handleSubmit(i),className:"space-y-4",children:[d.jsx(_0,{control:n.control,name:"name",render:({field:l})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Name"}),d.jsx(T0,{children:d.jsx(gt,{placeholder:"Folder name",...l})}),d.jsx(P0,{})]})}),d.jsx(BE,{children:d.jsx(Ve,{type:"submit",disabled:r.loading||!o||!s,children:"Create folder"})})]})})]})]})},Fvu=e=>ns("/api/settings",e);function kvu(e){const u=e.trim();if(!u)return[];let a=u;return a.startsWith("./")&&(a=a.slice(2)),a.split("/").filter(Boolean)}const ZU=()=>{const{data:e}=Fvu();return C.useMemo(()=>{const u=kvu((e==null?void 0:e.displayRoot)??""),a=u.length>0&&u[0]!==".";return{rootPathSegments:u,hasCustomRoot:a}},[e==null?void 0:e.displayRoot])};S({input:k(),agentConfigVersion:k().optional()});S({srcs:De(k()),urls:De(k()),desiredSrc:k().optional(),desiredUrl:k().optional()});S({srcRegex:k().optional(),urlRegex:k().optional()});S({x:uu(),y:uu(),correlation:uu()});S({searchImageBase64String:k(),pageImageBase64String:k(),id:k().uuid(),timeoutMs:uu().max(1e4).min(0).optional()});function Fi(e){if(typeof e.ZodType.prototype.openapi<"u")return;e.ZodType.prototype.openapi=function(n){return new this.constructor({...this._def,openapi:n})};const u=e.ZodObject.prototype.extend;e.ZodObject.prototype.extend=function(...n){const r=u.apply(this,n);return r._def.extendMetadata={extends:this},delete r._def.openapi,r};const a=e.ZodObject.prototype.omit;e.ZodObject.prototype.omit=function(...n){const r=a.apply(this,n);return delete r._def.extendMetadata,delete r._def.openapi,r};const t=e.ZodObject.prototype.pick;e.ZodObject.prototype.pick=function(...n){const r=t.apply(this,n);return delete r._def.extendMetadata,delete r._def.openapi,r}}Fi(kd);var rS=(e=>(e.AI="AI",e.AI_HEALED="AI_HEALED",e.CLICK_TO_FIND="CLICK_TO_FIND",e.XY_PERCENT="XY_PERCENT",e.RECORDING="RECORDING",e.USER_CSS_SELECTOR="USER_CSS_SELECTOR",e.HEURISTIC_HEALED="HEURISTIC_HEALED",e))(rS||{});const vvu=S({mPathSelectorTokens:k().array(),frameSrcRegex:k().optional(),frameUrlRegex:k().optional(),indices:uu().array()}),iS=S({result:uu(),traceId:k()}).array(),vm=S({type:J("GCS_TRACES"),traces:iS});var ro=(e=>(e.PRECISE="precise",e.NARROW="narrow",e.BROAD="broad",e.IRRELEVANT="irrelevant",e))(ro||{});const QU=S({attributes:$u(k(),k()).optional(),text:k().optional(),position:S({x1:uu(),y1:uu(),x2:uu(),y2:uu(),tolerance:Ku(ro)}).optional(),shape:S({width:uu(),height:uu(),tolerance:Ku(ro)}).optional(),boundingBox:S({x:uu(),y:uu(),width:uu(),height:uu()}).optional()}),Avu=S({selectors:k().array(),requirements:QU.optional()}),sh=S({id:uu().int(),dataMomenticId:uu().int().optional(),selector:k().optional(),hybridSelector:S({textContent:k().nullish(),attributes:$u(k(),k().optional()),tagName:k(),expandShadowRoot:cu().optional(),classNames:k().array(),nthChild:uu()}).array().optional(),generatedSelectors:k().array().optional(),requirements:QU.optional(),additionalElements:Avu.array().optional(),role:k().optional(),name:k().optional(),numChildren:uu().optional(),content:k().optional(),pathFromRoot:k().optional(),serializedHtml:k().optional().describe("pruned html including 1 neighbor and 1 layer of children. value for text inputs pruned."),nodeOnlySerializedHtml:k().optional().describe("outerHtml of the element without any children. value for text inputs pruned."),screenshotUrl:k().url().optional(),boundingBox:S({x:uu().optional(),y:uu().optional(),width:uu(),height:uu()}).describe("css pixel bounding box").optional(),frameCache:vvu.optional(),inputDescription:k().optional().describe("the description that generated this cache"),targetSource:Ku(rS).optional(),targetUpdateTime:k().optional(),targetUpdateLoggerTags:$u(k(),k()).optional(),cacheResolutionUpdateSource:k().optional(),cacheResolutionUpdateTime:k().optional(),cacheResolutionUpdateLoggerTags:$u(k(),k()).optional(),memory:vm.optional()}).openapi({ref:"ElementTargetCache"}),bvu=S({type:J("description"),elementDescriptor:k().describe("Description of the element.")}).openapi({ref:"DescriptionTarget"}),yvu=S({x:uu(),y:uu()}),Bvu=S({type:J("coordinates"),pixels:yvu}).openapi({ref:"CoordinatesTarget"}),jn=Oe("type",[bvu,Bvu]).openapi({ref:"ElementTarget"});let yx;const Svu=new Uint8Array(16);function zvu(){if(!yx&&(yx=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!yx))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yx(Svu)}const Rt=[];for(let e=0;e<256;++e)Rt.push((e+256).toString(16).slice(1));function Ovu(e,u=0){return Rt[e[u+0]]+Rt[e[u+1]]+Rt[e[u+2]]+Rt[e[u+3]]+"-"+Rt[e[u+4]]+Rt[e[u+5]]+"-"+Rt[e[u+6]]+Rt[e[u+7]]+"-"+Rt[e[u+8]]+Rt[e[u+9]]+"-"+Rt[e[u+10]]+Rt[e[u+11]]+Rt[e[u+12]]+Rt[e[u+13]]+Rt[e[u+14]]+Rt[e[u+15]]}const wvu=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),iP={randomUUID:wvu};function _a(e,u,a){if(iP.randomUUID&&!u&&!e)return iP.randomUUID();e=e||{};const t=e.random||(e.rng||zvu)();if(t[6]=t[6]&15|64,t[8]=t[8]&63|128,u){a=a||0;for(let n=0;n<16;++n)u[a+n]=t[n];return u}return Ovu(t)}const oS=q.object({updatedAt:q.coerce.date().optional()}),sS=S({result:cu(),traceId:k()}).array(),lS=S({type:J("GCS_TRACES"),traces:sS}),ES=oS.extend({memory:lS.optional()});Fi(q);S({thoughts:k(),result:cu(),relevantElements:De(uu()).optional(),updatedMemory:sS.optional()});var ia=(e=>(e.CONTAINS="CONTAINS",e.STARTS_WITH="STARTS_WITH",e.EQUALS="EQUALS",e.EXISTS="EXISTS",e))(ia||{});const fb=["EQUALS","CONTAINS","STARTS_WITH","EXISTS"],Mvu=e=>fb.some(u=>u===e);var H0=(e=>(e.ELEMENT_CONTENT="ELEMENT_CONTENT",e.ELEMENT_NAME="ELEMENT_NAME",e.ELEMENT_STYLE="ELEMENT_STYLE",e.ELEMENT_ATTRIBUTE="ELEMENT_ATTRIBUTE",e.ELEMENT_EXISTENCE="ELEMENT_EXISTENCE",e))(H0||{});const Tvu=e=>qU.some(u=>u===e),Pvu={ELEMENT_CONTENT:"Content",ELEMENT_ATTRIBUTE:"Attribute",ELEMENT_EXISTENCE:"Element",ELEMENT_NAME:"Tag name",ELEMENT_STYLE:"Computed style"},qU=["ELEMENT_CONTENT","ELEMENT_ATTRIBUTE","ELEMENT_EXISTENCE","ELEMENT_NAME","ELEMENT_STYLE"],jvu=S({type:J("ELEMENT_NAME"),negated:cu().optional(),operation:Ku(ia),value:k()}).openapi({ref:"ElementNameAssertion"}),Nvu=S({type:J("ELEMENT_STYLE"),negated:cu().optional(),operation:Ku(ia),property:k(),value:k()}).openapi({ref:"ElementStyleAssertion"}),Rvu=S({type:J("ELEMENT_CONTENT"),negated:cu().optional(),operation:Ku(ia),value:k()}).openapi({ref:"ElementContentAssertion"}),Lvu=S({type:J("ELEMENT_ATTRIBUTE"),negated:cu().optional(),operation:Ku(ia),attr:k(),value:k()}).openapi({ref:"ElementAttributeValueAssertion"});var sn=(e=>(e.EXISTS="EXISTS",e.VISIBLE="VISIBLE",e.ENABLED="ENABLED",e.EDITABLE="EDITABLE",e.FOCUSED="FOCUSED",e))(sn||{});const _vu=e=>YU.some(u=>u===e),YU=["EXISTS","VISIBLE","ENABLED","EDITABLE","FOCUSED"],Ivu=S({type:J("ELEMENT_EXISTENCE"),negated:cu().optional(),condition:Ku(sn).describe("Treated as the element exists AND is also ...")}).openapi({ref:"ElementExistenceAssertion"}),XU=Oe("type",[Rvu,Lvu,Ivu,jvu,Nvu]).openapi({ref:"ManualElementAssertion"});var uZ=(e=>(e.CONTENT="CONTENT",e))(uZ||{});const Kvu=S({type:J("CONTENT"),negated:cu().optional(),value:k()}).openapi({ref:"PageContentAssertion"}),$vu=Oe("type",[Kvu]).openapi({ref:"ManualPageAssertion"}),eZ=q.discriminatedUnion("type",[q.object({type:q.literal("SUBSTRING"),url:q.string()}),q.object({type:q.literal("GLOB"),glob:q.string()}),q.object({type:q.literal("REGEX"),regex:q.string()}),q.object({type:q.literal("DOMAIN"),domain:q.string()})]),L2=q.object({urlMatcher:eZ,method:q.string().optional()});var lr=(e=>(e.JSON="json",e.FORM_URLENCODED="form-urlencoded",e))(lr||{});const Vvu=S({type:J("json"),content:k().describe("The JSON content to send in the request body")}),Hvu=S({type:J("form-urlencoded"),content:$u(k(),k()).describe("The form fields to send in the request body")}),Gvu=Oe("type",[Vvu,Hvu]),cS=S({url:k(),method:ma([J("GET"),J("POST"),J("PUT"),J("DELETE"),J("PATCH")]),headers:$u(k(),k()).optional(),params:$u(k(),k()).optional(),body:Gvu.optional(),timeout:uu().int().optional().describe("Max seconds to wait for the request to complete")}),Jvu=S({url:k(),headers:$u(k(),k()).optional(),query:k(),variables:k().optional(),timeout:uu().int().optional().describe("Max seconds to wait for the request to complete")}),aZ=S({code:k(),fragment:cu().optional().describe("Agents should not touch this unless explicitly told to"),environment:ma([J("NODE"),J("BROWSER")]).optional().describe("default NODE, Agents default to using node unless it is necessary to use browser"),timeout:uu().int().max(60).optional().describe("Max seconds for the code to complete")});var Z=(e=>(e.AI_EXTRACT="AI_EXTRACT",e.AI_ASSERTION="AI_ASSERTION",e.AUTH_LOAD="AUTH_LOAD",e.AUTH_SAVE="AUTH_SAVE",e.BLUR="BLUR",e.CAPTCHA="CAPTCHA",e.CLICK="CLICK",e.COOKIE="COOKIE",e.COPY="COPY",e.DIALOG="DIALOG",e.DRAG="DRAG",e.ELEMENT_CHECK="ELEMENT_CHECK",e.FILE_UPLOAD="FILE_UPLOAD",e.FOCUS="FOCUS",e.GO_BACK="GO_BACK",e.GO_FORWARD="GO_FORWARD",e.HOVER="HOVER",e.JAVASCRIPT="JAVASCRIPT",e.LOCAL_STORAGE="LOCAL_STORAGE",e.MOUSE_DRAG="MOUSE_DRAG",e.NAVIGATE="NAVIGATE",e.NEW_TAB="NEW_TAB",e.PAGE_CHECK="PAGE_CHECK",e.PASTE="PASTE",e.PRESS="PRESS",e.KEY_DOWN="KEY_DOWN",e.KEY_UP="KEY_UP",e.REFRESH="REFRESH",e.REQUEST="REQUEST",e.GRAPHQL_REQUEST="GRAPHQL_REQUEST",e.SCROLL_DOWN="SCROLL_DOWN",e.SCROLL_UP="SCROLL_UP",e.SCROLL_LEFT="SCROLL_LEFT",e.SCROLL_RIGHT="SCROLL_RIGHT",e.SELECT_OPTION="SELECT_OPTION",e.SWITCH_TAB="TAB",e.TYPE="TYPE",e.VISUAL_DIFF="VISUAL_DIFF",e.WAIT="WAIT",e.WAIT_FOR_URL="WAIT_FOR_URL",e.REGISTER_REQUEST_LISTENER="REGISTER_REQUEST_LISTENER",e.AWAIT_LISTENER="AWAIT_LISTENER",e.RECORD_REQUESTS="RECORD_REQUESTS",e.GET_RECORDED_REQUESTS="GET_RECORDED_REQUESTS",e.SET_HEADER="SET_HEADER",e.MOCK_ROUTE="MOCK_ROUTE",e.REMOVE_ROUTE_MOCK="REMOVE_ROUTE_MOCK",e.OFFLINE_MODE="OFFLINE_MODE",e.SUCCESS="SUCCESS",e))(Z||{});Fi(kd);const Ne=S({thoughts:k().optional(),id:k().uuid().describe("unique identifier to this step, used for step cache")}),ki=S({useSelector:cu().optional(),force:cu().optional(),disableCache:cu().optional().describe("disable element caching for this step"),iframeUrl:k().optional().describe("url or url regex for the iframe")}).openapi({ref:"CommonTargetingOptions"}),is=oS.extend({target:sh}).optional().openapi({ref:"SingleTargetCache"}),_2=S({loadTimeout:uu().int().max(60).optional().describe("Max seconds for the page to load")}),tZ=Ne.merge(_2).merge(S({type:J("NAVIGATE"),url:k()})).openapi({ref:"NavigateCommand"}),I2=ki.merge(S({cache:is})),Am=Ne.merge(I2.merge(S({target:jn.optional(),type:J("SCROLL_UP"),deltaY:uu().optional()}))).openapi({ref:"ScrollUpCommand"}),bm=Ne.merge(I2.merge(S({target:jn.optional(),type:J("SCROLL_DOWN"),deltaY:uu().optional()}))).openapi({ref:"ScrollDownCommand"}),K2=Ne.merge(I2.merge(S({target:jn.optional(),type:J("SCROLL_LEFT"),deltaX:uu().optional()}))).openapi({ref:"ScrollLeftCommand"}),$2=Ne.merge(I2.merge(S({target:jn.optional(),type:J("SCROLL_RIGHT"),deltaX:uu().optional()}))).openapi({ref:"ScrollRightCommand"});Oe("type",[Am,bm,K2,$2]).openapi({ref:"AllScrollCommands"});const Wvu=Ne.merge(S({type:J("DIALOG"),action:ma([J("ACCEPT"),J("DISMISS")])})).openapi({ref:"DialogCommand"}),nZ=Ne.merge(S({type:J("WAIT"),delay:uu()})).openapi({ref:"WaitCommand"}),Uvu=S({caseInsensitive:cu().optional().describe("Whether to ignore case when matching the URL"),negated:cu().optional().describe("Wait for the URL to NOT match the provided matcher instead."),timeout:uu().int().optional().describe("Max seconds to wait for the URL to match")}),rZ=Ne.extend({type:J("WAIT_FOR_URL"),matcher:eZ}).merge(Uvu).openapi({ref:"WaitUrlCommand"}),iZ=Ne.merge(_2).merge(S({type:J("REFRESH")})).openapi({ref:"RefreshCommand"}),oZ=Ne.merge(S({type:J("GO_BACK")})).openapi({ref:"GoBackCommand"}),sZ=Ne.merge(S({type:J("GO_FORWARD")})).openapi({ref:"GoForwardCommand"}),Zvu=Ne.extend({type:J("AUTH_SAVE")}).openapi({ref:"AuthSaveCommand"}),Qvu=Ne.extend({type:J("AUTH_LOAD"),storageState:k().describe("JSON string auth state. Leave blank or set to the empty string to clear all existing authentication.")}).openapi({ref:"AuthLoadCommand"}),lZ=Ne.merge(ki).extend({type:J("CAPTCHA")}).openapi({ref:"CaptchaCommand"}),EZ=Ne.extend({type:J("COPY"),value:k()}).openapi({ref:"CopyCommand"}),cZ=Ne.extend({type:J("PASTE")}).openapi({ref:"PasteCommand"}),dZ=Ne.merge(aZ).extend({type:J("JAVASCRIPT")}).openapi({ref:"JavaScriptCommand"}),V2=Ne.merge(ki).extend({type:J("CLICK"),target:jn,doubleClick:cu().optional(),rightClick:cu().optional(),waitForDownload:cu().optional().describe("Wait for the click to trigger a file download and for the file download to complete."),delayMs:uu().optional(),downloadTimeoutMs:uu().optional(),cache:is,relativePosition:S({x:uu(),y:uu()}).optional()}).openapi({ref:"ClickCommand"}),qvu=oS.extend({fromTarget:sh.optional(),toTarget:sh.optional()}),H2=Ne.merge(ki).merge(S({type:J("DRAG"),fromTarget:jn,toTarget:jn,steps:uu().optional(),hoverSeconds:uu().optional().describe("Seconds to hover the object before dropping"),cache:qvu.optional()})).openapi({ref:"DragCommand"}),G2=Ne.merge(ki).merge(S({type:J("MOUSE_DRAG"),target:jn.optional(),deltaX:k().describe("pixels to move horizontally, can be template"),deltaY:k().describe("pixels to move vertically, can be template"),steps:uu().optional(),cache:is})).openapi({ref:"MouseDragCommand"}),J2=Ne.merge(ki).merge(S({type:J("HOVER"),target:jn,cache:is})).openapi({ref:"HoverCommand"}),dS=Ne.merge(ki).merge(S({type:J("FOCUS"),target:jn,cache:is})).openapi({ref:"FocusCommand"}),DS=Ne.merge(ki).extend({type:J("BLUR"),target:jn.optional(),cache:is}).openapi({ref:"BlurCommand"}),Yvu=S({type:J("URL"),url:k()}).describe("Accessible link to the file, either public http or local file://").openapi({ref:"UrlSource"}),Xvu=S({type:J("USER_FILE"),name:k()}).describe("Accessible link to the file, references the google cloud file").openapi({ref:"UploadedFileSource"}),uAu=Ne.extend({type:J("FILE_UPLOAD"),fileSource:Oe("type",[Yvu,Xvu]),filename:k().optional()}).openapi({ref:"FileUploadCommand"}),eAu=Oe("type",[S({type:J("VALUE"),value:k()}),S({type:J("LABEL"),label:k()}),S({type:J("INDEX"),index:ce.string()})]),W2=Ne.merge(ki).extend({type:J("SELECT_OPTION"),target:jn,cache:is,choice:eAu.describe("new field for selecting options, optional for backcompat")}).openapi({ref:"SelectOptionCommand"}),DZ=ma([J("MULTIMODAL"),J("VISION_ONLY")]),U2=Ne.merge(S({type:J("AI_ASSERTION"),assertion:k(),disableCache:cu().optional(),iframeUrl:k().optional(),contextChoice:DZ.optional(),timeout:uu().int().optional().describe("Max seconds to wait for assertion to be true"),cache:ES.optional()})).openapi({ref:"AIAssertionCommand"}),Z2=600,Q2=Ne.merge(ki).extend({type:J("ELEMENT_CHECK"),target:jn,assertion:XU,cache:is.or(ES).optional(),timeout:uu().int().min(0).max(Z2).optional().describe("max seconds to wait for the assertion to be true")}).openapi({ref:"ElementAssertionCommand"}),hZ=Ne.extend({type:J("PAGE_CHECK"),assertion:$vu,iframeUrl:k().optional().describe("url or url regex for the iframe"),timeout:uu().int().min(0).max(Z2).optional().describe("max seconds to wait for the assertion to be true")}).openapi({ref:"PageAssertionCommand"}),mZ=Ne.merge(S({type:J("AI_EXTRACT"),goal:k(),schema:k().optional(),envKey:k().optional(),disableCache:cu().optional(),iframeUrl:k().optional()})).openapi({ref:"AIExtractCommand"}),aAu=S({clearContent:cu().optional(),forceClearContent:cu().optional(),delay:uu().min(0).max(1e3).optional().describe("Delay between each press in milliseconds."),force:cu().optional(),pressEnter:cu().optional(),relativePosition:S({x:uu(),y:uu()}).optional()}),q2=Ne.merge(ki).merge(aAu).extend({type:J("TYPE"),target:jn.optional(),value:k(),cache:is}).openapi({ref:"TypeCommand"}),xZ=Ne.merge(S({type:J("PRESS"),value:k(),repeat:uu().optional(),convertMeta:cu().optional(),delayMs:uu().optional()})).openapi({ref:"PressCommand"}),fZ=Ne.merge(S({type:J("KEY_DOWN"),value:k(),convertMeta:cu().optional()})).openapi({ref:"KeyDownCommand"}),pZ=Ne.merge(S({type:J("KEY_UP"),value:k(),convertMeta:cu().optional()})).openapi({ref:"KeyUpCommand"}),tAu=S({type:J("SUBSTRING"),substring:k()}),nAu=S({type:J("REGEX"),pattern:k()}),rAu=S({type:J("INDEX"),index:ce.string()}),iAu=Oe("type",[tAu,nAu,rAu]),oAu=Ne.merge(_2).merge(S({type:J("TAB"),action:iAu})).openapi({ref:"TabCommand"}),gZ=Ne.merge(_2).merge(S({type:J("NEW_TAB"),url:k()})).openapi({ref:"NewTabCommand"}),sAu=Ne.merge(S({type:J("COOKIE"),value:k()})).openapi({ref:"CookieCommand"}),CZ=Ne.merge(S({type:J("LOCAL_STORAGE"),key:k(),value:k()})).openapi({ref:"LocalStorageCommand"}),FZ=Ne.extend({type:J("REQUEST")}).merge(cS).openapi({ref:"RequestCommand"});S({status:uu().optional(),headers:$u(k(),k()),json:Le().optional(),text:k().optional(),cookies:$u(k(),Le()).array().optional(),request:S({url:k(),method:k(),headers:$u(k(),k()),json:Le().optional()})});const kZ=Ne.extend({type:J("GRAPHQL_REQUEST")}).merge(Jvu).openapi({ref:"GraphQLRequestCommand"}),vZ=Ne.merge(S({type:J("SUCCESS"),condition:U2.optional()})).openapi({ref:"SuccessCommand"}),AZ=Ne.merge(S({type:J("FAILURE")})).openapi({ref:"FailureCommand"}),lAu=S({data:k().describe("location at which to find a jpg"),width:uu(),height:uu()}),hS=Ne.merge(ki).merge(S({type:J("VISUAL_DIFF"),threshold:uu().optional().describe("default 0.1"),target:jn.optional(),screenshot:lAu.optional(),cache:is})).openapi({ref:"VisualDiffCommand"}),EAu=Ne.merge(S({type:J("REGISTER_REQUEST_LISTENER"),requestMatcher:L2,key:k()})).openapi({ref:"RegisterRequestListenerCommand"}),cAu=Ne.merge(S({type:J("AWAIT_LISTENER"),key:k(),timeout:uu().optional().describe("timeout")})).openapi({ref:"WaitForListenerCommand"}),dAu=Ne.merge(S({type:J("RECORD_REQUESTS"),requestMatcher:L2,key:k()})).openapi({ref:"RecordRequestsCommand"}),DAu=Ne.merge(S({type:J("GET_RECORDED_REQUESTS"),key:k()})).openapi({ref:"GetRecordedRequestsCommand"}),hAu=Ne.merge(S({type:J("SET_HEADER"),name:k(),value:k(),requestMatcher:L2.optional()})).openapi({ref:"SetHeaderCommand"}),mAu=Ne.merge(S({type:J("MOCK_ROUTE"),requestMatcher:L2,responseGenerator:k().describe("JavaScript code to generate a response"),fetchOriginalResponse:cu().optional().describe("Whether to fetch the real response and pass it to the response generator. If enabled, the original response will be available as `response` in the code."),key:k().optional().describe("Key to reference this mock. This only needs to be set if you plan to remove the mock later in the test.")}).openapi({ref:"MockRouteCommandOptions"})),xAu=Ne.merge(S({type:J("REMOVE_ROUTE_MOCK"),key:k().optional().describe("Key of the mock to remove. If not set, all route mocks will be removed.")}).openapi({ref:"RemoveRouteMockCommandOptions"})),fAu=Ne.merge(S({type:J("OFFLINE_MODE"),enable:cu()})).openapi({ref:"OfflineModeCommand"}),pAu=Oe("type",[V2,q2,xZ,fZ,pZ,W2,tZ,bm,Am,U2,oZ,J2,nZ]),gAu=Oe("type",[...pAu.options,H2]),CAu=Oe("type",[...gAu.options]),bZ=Oe("type",[...CAu.options,vZ]),yZ=Oe("type",[vZ,V2,q2,xZ,fZ,pZ,W2,tZ,bm,Am,U2,oZ,J2,nZ,dZ,Q2,hZ,gZ,rZ,mZ,EZ,sZ,CZ,H2,G2,cZ,iZ,FZ,kZ]),FAu=Oe("type",[mZ,Qvu,Zvu,lZ,sAu,EZ,Wvu,Q2,uAu,sZ,dZ,CZ,G2,gZ,hZ,cZ,iZ,FZ,kZ,K2,$2,oAu,hS,dS,DS,rZ,EAu,cAu,dAu,DAu,hAu,mAu,xAu,fAu]),mS=Oe("type",[...bZ.options,...FAu.options]).openapi({ref:"Command"}),kAu=Oe("type",[...bZ.options,AZ]);Oe("type",[...yZ.options,AZ]);Oe("type",[DS,lZ,V2,H2,dS,J2,G2,Am,bm,K2,$2,W2,q2,hS,Q2]);function xS(e){return S({key:k(),testId:k().optional(),moduleId:k().optional(),organizationId:k(),value:e})}function fS(e){return xS(e).extend({uniqueKey:k()})}function BZ(e){return $u(k(),fS(e))}const gn={type:!0,cache:!0},Y2=Oe("type",[U2.pick(gn),DS.pick(gn),V2.pick(gn),H2.pick(gn),Q2.pick(gn),dS.pick(gn),J2.pick(gn),G2.pick(gn),Am.pick(gn),bm.pick(gn),K2.pick(gn),$2.pick(gn),W2.pick(gn),q2.pick(gn),hS.pick(gn)]),vAu=Object.values(Z).filter(e=>Y2.options.some(u=>u.shape.type.safeParse(e).success));mS.options.forEach(e=>{if("target"in e.shape&&!vAu.includes(e.shape.type.value))throw new Error(`Command ${e.shape.type.value} has a target but no cache`)});const AAu=xS(Y2),bAu=fS(Y2);BZ(Y2);const yAu=Symbol("Let zodToJsonSchema decide on which parser to use"),oP={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref",openAiAnyTypeName:"OpenAiAnyType"},BAu=e=>typeof e=="string"?{...oP,name:e}:{...oP,...e},SAu=e=>{const u=BAu(e),a=u.name!==void 0?[...u.basePath,u.definitionPath,u.name]:u.basePath;return{...u,flags:{hasReferencedOpenAiAnyType:!1},currentPath:a,propertyPath:void 0,seen:new Map(Object.entries(u.definitions).map(([t,n])=>[n._def,{def:n._def,path:[...u.basePath,u.definitionPath,t],jsonSchema:void 0}]))}};function SZ(e,u,a,t){t!=null&&t.errorMessages&&a&&(e.errorMessage={...e.errorMessage,[u]:a})}function K0(e,u,a,t,n){e[u]=a,SZ(e,u,t,n)}const zZ=(e,u)=>{let a=0;for(;a<e.length&&a<u.length&&e[a]===u[a];a++);return[(e.length-a).toString(),...u.slice(a)].join("/")};function nr(e){if(e.target!=="openAi")return{};const u=[...e.basePath,e.definitionPath,e.openAiAnyTypeName];return e.flags.hasReferencedOpenAiAnyType=!0,{$ref:e.$refStrategy==="relative"?zZ(u,e.currentPath):u.join("/")}}function zAu(e,u){var t,n,r;const a={type:"array"};return(t=e.type)!=null&&t._def&&((r=(n=e.type)==null?void 0:n._def)==null?void 0:r.typeName)!==zu.ZodAny&&(a.items=z0(e.type._def,{...u,currentPath:[...u.currentPath,"items"]})),e.minLength&&K0(a,"minItems",e.minLength.value,e.minLength.message,u),e.maxLength&&K0(a,"maxItems",e.maxLength.value,e.maxLength.message,u),e.exactLength&&(K0(a,"minItems",e.exactLength.value,e.exactLength.message,u),K0(a,"maxItems",e.exactLength.value,e.exactLength.message,u)),a}function OAu(e,u){const a={type:"integer",format:"int64"};if(!e.checks)return a;for(const t of e.checks)switch(t.kind){case"min":u.target==="jsonSchema7"?t.inclusive?K0(a,"minimum",t.value,t.message,u):K0(a,"exclusiveMinimum",t.value,t.message,u):(t.inclusive||(a.exclusiveMinimum=!0),K0(a,"minimum",t.value,t.message,u));break;case"max":u.target==="jsonSchema7"?t.inclusive?K0(a,"maximum",t.value,t.message,u):K0(a,"exclusiveMaximum",t.value,t.message,u):(t.inclusive||(a.exclusiveMaximum=!0),K0(a,"maximum",t.value,t.message,u));break;case"multipleOf":K0(a,"multipleOf",t.value,t.message,u);break}return a}function wAu(){return{type:"boolean"}}function OZ(e,u){return z0(e.type._def,u)}const MAu=(e,u)=>z0(e.innerType._def,u);function wZ(e,u,a){const t=a??u.dateStrategy;if(Array.isArray(t))return{anyOf:t.map((n,r)=>wZ(e,u,n))};switch(t){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return TAu(e,u)}}const TAu=(e,u)=>{const a={type:"integer",format:"unix-time"};if(u.target==="openApi3")return a;for(const t of e.checks)switch(t.kind){case"min":K0(a,"minimum",t.value,t.message,u);break;case"max":K0(a,"maximum",t.value,t.message,u);break}return a};function PAu(e,u){return{...z0(e.innerType._def,u),default:e.defaultValue()}}function jAu(e,u){return u.effectStrategy==="input"?z0(e.schema._def,u):nr(u)}function NAu(e){return{type:"string",enum:Array.from(e.values)}}const RAu=e=>"type"in e&&e.type==="string"?!1:"allOf"in e;function LAu(e,u){const a=[z0(e.left._def,{...u,currentPath:[...u.currentPath,"allOf","0"]}),z0(e.right._def,{...u,currentPath:[...u.currentPath,"allOf","1"]})].filter(r=>!!r);let t=u.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0;const n=[];return a.forEach(r=>{if(RAu(r))n.push(...r.allOf),r.unevaluatedProperties===void 0&&(t=void 0);else{let i=r;if("additionalProperties"in r&&r.additionalProperties===!1){const{additionalProperties:o,...s}=r;i=s}else t=void 0;n.push(i)}}),n.length?{allOf:n,...t}:void 0}function _Au(e,u){const a=typeof e.value;return a!=="bigint"&&a!=="number"&&a!=="boolean"&&a!=="string"?{type:Array.isArray(e.value)?"array":"object"}:u.target==="openApi3"?{type:a==="bigint"?"integer":a,enum:[e.value]}:{type:a==="bigint"?"integer":a,const:e.value}}let Vk;const yi={cuid:/^[cC][^\s-]{8,}$/,cuid2:/^[0-9a-z]+$/,ulid:/^[0-9A-HJKMNP-TV-Z]{26}$/,email:/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,emoji:()=>(Vk===void 0&&(Vk=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Vk),uuid:/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,ipv4:/^(?:(?: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])$/,ipv4Cidr:/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ipv6:/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ipv6Cidr:/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,base64:/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,base64url:/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,nanoid:/^[a-zA-Z0-9_-]{21}$/,jwt:/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/};function MZ(e,u){const a={type:"string"};if(e.checks)for(const t of e.checks)switch(t.kind){case"min":K0(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,t.value):t.value,t.message,u);break;case"max":K0(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,t.value):t.value,t.message,u);break;case"email":switch(u.emailStrategy){case"format:email":Bi(a,"email",t.message,u);break;case"format:idn-email":Bi(a,"idn-email",t.message,u);break;case"pattern:zod":Cn(a,yi.email,t.message,u);break}break;case"url":Bi(a,"uri",t.message,u);break;case"uuid":Bi(a,"uuid",t.message,u);break;case"regex":Cn(a,t.regex,t.message,u);break;case"cuid":Cn(a,yi.cuid,t.message,u);break;case"cuid2":Cn(a,yi.cuid2,t.message,u);break;case"startsWith":Cn(a,RegExp(`^${Hk(t.value,u)}`),t.message,u);break;case"endsWith":Cn(a,RegExp(`${Hk(t.value,u)}$`),t.message,u);break;case"datetime":Bi(a,"date-time",t.message,u);break;case"date":Bi(a,"date",t.message,u);break;case"time":Bi(a,"time",t.message,u);break;case"duration":Bi(a,"duration",t.message,u);break;case"length":K0(a,"minLength",typeof a.minLength=="number"?Math.max(a.minLength,t.value):t.value,t.message,u),K0(a,"maxLength",typeof a.maxLength=="number"?Math.min(a.maxLength,t.value):t.value,t.message,u);break;case"includes":{Cn(a,RegExp(Hk(t.value,u)),t.message,u);break}case"ip":{t.version!=="v6"&&Bi(a,"ipv4",t.message,u),t.version!=="v4"&&Bi(a,"ipv6",t.message,u);break}case"base64url":Cn(a,yi.base64url,t.message,u);break;case"jwt":Cn(a,yi.jwt,t.message,u);break;case"cidr":{t.version!=="v6"&&Cn(a,yi.ipv4Cidr,t.message,u),t.version!=="v4"&&Cn(a,yi.ipv6Cidr,t.message,u);break}case"emoji":Cn(a,yi.emoji(),t.message,u);break;case"ulid":{Cn(a,yi.ulid,t.message,u);break}case"base64":{switch(u.base64Strategy){case"format:binary":{Bi(a,"binary",t.message,u);break}case"contentEncoding:base64":{K0(a,"contentEncoding","base64",t.message,u);break}case"pattern:zod":{Cn(a,yi.base64,t.message,u);break}}break}case"nanoid":Cn(a,yi.nanoid,t.message,u)}return a}function Hk(e,u){return u.patternStrategy==="escape"?KAu(e):e}const IAu=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function KAu(e){let u="";for(let a=0;a<e.length;a++)IAu.has(e[a])||(u+="\\"),u+=e[a];return u}function Bi(e,u,a,t){var n;e.format||(n=e.anyOf)!=null&&n.some(r=>r.format)?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format,...e.errorMessage&&t.errorMessages&&{errorMessage:{format:e.errorMessage.format}}}),delete e.format,e.errorMessage&&(delete e.errorMessage.format,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.anyOf.push({format:u,...a&&t.errorMessages&&{errorMessage:{format:a}}})):K0(e,"format",u,a,t)}function Cn(e,u,a,t){var n;e.pattern||(n=e.allOf)!=null&&n.some(r=>r.pattern)?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern,...e.errorMessage&&t.errorMessages&&{errorMessage:{pattern:e.errorMessage.pattern}}}),delete e.pattern,e.errorMessage&&(delete e.errorMessage.pattern,Object.keys(e.errorMessage).length===0&&delete e.errorMessage)),e.allOf.push({pattern:sP(u,t),...a&&t.errorMessages&&{errorMessage:{pattern:a}}})):K0(e,"pattern",sP(u,t),a,t)}function sP(e,u){var s;if(!u.applyRegexFlags||!e.flags)return e.source;const a={i:e.flags.includes("i"),m:e.flags.includes("m"),s:e.flags.includes("s")},t=a.i?e.source.toLowerCase():e.source;let n="",r=!1,i=!1,o=!1;for(let l=0;l<t.length;l++){if(r){n+=t[l],r=!1;continue}if(a.i){if(i){if(t[l].match(/[a-z]/)){o?(n+=t[l],n+=`${t[l-2]}-${t[l]}`.toUpperCase(),o=!1):t[l+1]==="-"&&((s=t[l+2])!=null&&s.match(/[a-z]/))?(n+=t[l],o=!0):n+=`${t[l]}${t[l].toUpperCase()}`;continue}}else if(t[l].match(/[a-z]/)){n+=`[${t[l]}${t[l].toUpperCase()}]`;continue}}if(a.m){if(t[l]==="^"){n+=`(^|(?<=[\r
|
|
494
494
|
]))`;continue}else if(t[l]==="$"){n+=`($|(?=[\r
|
|
495
495
|
]))`;continue}}if(a.s&&t[l]==="."){n+=i?`${t[l]}\r
|
|
496
496
|
`:`[${t[l]}\r
|
|
@@ -536,7 +536,7 @@ ${L}`,ou=Math.min(M.length,j);let Cu=0;for(;Cu<ou-1;Cu++){const mu=O(String(Cu),
|
|
|
536
536
|
${K}`,I.pop(),`[${tu}]`}let W=Object.keys(M);const _=W.length;if(_===0)return"{}";if(B<I.length+1)return'"[Object]"';L+=P;const Q=`,
|
|
537
537
|
${L}`;let eu="",U="",iu=Math.min(_,j);s(M)&&(eu+=l(M,Q,j),W=W.slice(M.length),iu-=M.length,U=Q),v&&(W=i(W,A)),I.push(M);for(let tu=0;tu<iu;tu++){const Y=W[tu],ou=O(Y,M[Y],I,P,L);ou!==void 0&&(eu+=`${U}${r(Y)}: ${ou}`,U=Q)}if(_>j){const tu=_-j;eu+=`${U}"...": "${m(tu)} not stringified"`,U=Q}return U!==""&&(eu=`
|
|
538
538
|
${L}${eu}
|
|
539
|
-
${K}`),I.pop(),`{${eu}}`}case"number":return isFinite(M)?String(M):F?F(M):"null";case"boolean":return M===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(M);default:return F?F(M):void 0}}function T(N,M,I){switch(typeof M){case"string":return r(M);case"object":{if(M===null)return"null";if(typeof M.toJSON=="function"){if(M=M.toJSON(N),typeof M!="object")return T(N,M,I);if(M===null)return"null"}if(I.indexOf(M)!==-1)return b;let P="";const L=M.length!==void 0;if(L&&Array.isArray(M)){if(M.length===0)return"[]";if(B<I.length+1)return'"[Array]"';I.push(M);const eu=Math.min(M.length,j);let U=0;for(;U<eu-1;U++){const tu=T(String(U),M[U],I);P+=tu!==void 0?tu:"null",P+=","}const iu=T(String(U),M[U],I);if(P+=iu!==void 0?iu:"null",M.length-1>j){const tu=M.length-j-1;P+=`,"... ${m(tu)} not stringified"`}return I.pop(),`[${P}]`}let K=Object.keys(M);const W=K.length;if(W===0)return"{}";if(B<I.length+1)return'"[Object]"';let _="",Q=Math.min(W,j);L&&s(M)&&(P+=l(M,",",j),K=K.slice(M.length),Q-=M.length,_=","),v&&(K=i(K,A)),I.push(M);for(let eu=0;eu<Q;eu++){const U=K[eu],iu=T(U,M[U],I);iu!==void 0&&(P+=`${_}${r(U)}:${iu}`,_=",")}if(W>j){const eu=W-j;P+=`${_}"...":"${m(eu)} not stringified"`}return I.pop(),`{${P}}`}case"number":return isFinite(M)?String(M):F?F(M):"null";case"boolean":return M===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(M);default:return F?F(M):void 0}}function z(N,M,I){if(arguments.length>1){let P="";if(typeof I=="number"?P=" ".repeat(Math.min(I,10)):typeof I=="string"&&(P=I.slice(0,10)),M!=null){if(typeof M=="function")return R("",{"":N},[],M,P,"");if(Array.isArray(M))return w("",N,[],x(M),P,"")}if(P.length!==0)return O("",N,[],P,"")}return T("",N,[])}return z}})(yb,yb.exports);var wBe=yb.exports;const _eu=al(wBe);_eu.configure;var Tx={};_eu.configure({deterministic:!1});const hj=q.enum(["debug","info","warn","error"]);typeof window>"u"&&typeof process<"u"&&hj.safeParse(Tx==null?void 0:Tx.MOMENTIC_DEV_LOG_LEVEL).success&&hj.parse(Tx.MOMENTIC_DEV_LOG_LEVEL);const MBe=De(mC.extend({id:k(),name:k(),description:k().optional(),labels:k().array().optional()})),TBe=De(mC.extend({id:k(),name:k(),description:k().optional(),content:fq}));S({name:k(),description:k().optional(),settings:Sm.optional(),pathSegments:k().array(),defaultEnv:k().optional()});S({id:k(),fileName:k(),fullPath:k(),relativeFilePath:k().describe("relative to project root")});tSu.extend({name:k()});S({steps:oC.array().optional(),settings:Sm.optional()});S({message:J("ok")});S({name:V1.optional(),description:k().min(1).optional(),settings:Sm.optional(),disabled:cu().optional()});const PBe=S({message:k(),newRelativeTestPath:k().optional()});S({tag:k(),channel:k(),filePath:k()});S({name:V1});S({tests:MBe,modules:TBe,labels:k().array()});S({name:k(),description:k(),enabled:cu()}).partial();S({name:k(),description:k(),enabled:cu(),steps:oC.array(),testFilePath:k().describe("relative to the project root"),folderPath:k().optional().describe("user selected folder path")});S({packages:k().array()});const Ieu=S({id:k(),createdAt:ce.date(),createdBy:k(),organizationId:k(),name:k(),description:k().nullish(),enabled:cu(),schemaVersion:k().describe("Schema version for steps"),parameters:k().array().nullish().describe("Parameter list"),parameterEnums:$u(k(),k().array()).nullish(),defaultParameters:$u(k(),k()).nullish(),defaultCacheKey:k().nullish(),defaultCacheTtl:uu().nullish(),defaultCacheAllInvocations:cu().nullish(),autoAuth:cu().nullish(),advanced:ZZ.nullish()});Ieu.extend({steps:j0(()=>P4.array())});ym.merge(Ieu.omit({id:!0,createdAt:!0,createdBy:!0,organizationId:!0,enabled:!0}));const jBe=jS.extend({aiAction:cu().optional(),stepLintSuggestions:cu().optional(),agentConfig:$u(k(),k()).optional(),aiFailureAnalysis:cu().optional(),aiPageFiltering:cu().optional().describe("rag v2 feature flag")}),NBe=S({cliOnly:cu().optional()}),RBe=S({fakerConstantSeed:cu().optional()});S({ai:jBe.optional(),githubAppInstallationId:uu().nullish(),githubAppSummaryMessageEnabled:cu().nullish(),githubReleaseAppInstallationId:uu().nullish(),gitlabAppAccessToken:k().nullish(),gitlabAppBaseUrl:k().nullish(),qaseAccessToken:k().nullish(),testSuggestionsEnabled:cu().nullish(),browser:jQ.optional(),internal:NBe.optional(),advanced:RBe.optional()});S({globalOverrides:$u(k()).optional(),agentConfig:$u(k(),k()).optional()});$u(k(),k()).nullish();var iz=(e=>(e.TEST_REVIEW="TEST_REVIEW",e))(iz||{});const LBe=S({type:J("DESCRIPTION_UPDATE"),thoughts:k()}),vp=Oe("type",[LBe]),_Be=S({testId:k(),name:k(),orgId:k(),runId:k(),steps:zr.array(),purpose:Ku(iz),details:vp.or(vp.array()).optional()});_Be.pick({name:!0,orgId:!0});const IBe=S({id:k(),name:k().nullish(),createdAt:k().pipe(ce.date()).or(us()),organizationId:k(),schemaVersion:k(),runId:k().nullish(),purpose:Ku(iz),details:vp.or(vp.array()).optional(),applied:cu().nullish(),appliedAt:ce.date().nullish()}),KBe=IBe.extend({steps:zr.array()});S({error:cu(),reason:k(),message:k()});bt.merge(WQ);bt.merge(WQ);bt.merge(UBu).extend({useConsensus:cu().optional(),attemptNumber:uu().optional()});bt.merge(QBu);bt.merge(qBu);bt.merge(YBu);bt.merge(ZBu);bt.merge(HBu);bt.merge(GBu);bt.merge(JBu);bt.merge(a8u);bt.merge(t8u);S({testPaths:k().array().describe("can be either hyphenated, lowercase test names or UUIDs"),env:k().optional(),all:cu().optional(),urlOverride:k().optional(),customHeaders:$u(k(),k()).optional(),testInputMatrix:$u(k(),k()).array().optional()});S({queuedTests:Le().array(),runIds:k().uuid().array(),runGroupId:k().optional()});k().array();ma([S({paths:k().array().describe("run specific test paths (e.g. todo-test)"),all:cu().describe("run all tests").optional()}),S({path:k().describe("deprecated; present for backcompat")})]);S({tests:$u(k().describe("Test name"),k().describe("Test YAML")),modules:$u(k().describe("Module name"),k().describe("Module YAML"))});const $Be=S({test:k().describe("test YAML"),modules:$u(k().describe("moduleId"),k().describe("module YAML"))});$Be.array();S({testId:k(),schemaVersion:k()}).merge(BS);S({entries:De(AAu),testId:k()});S({entries:De(R8u),testId:k()});S({testId:k()});function Keu(e){return $u(Le()).transform(u=>{const a={};for(const[t,n]of Object.entries(u)){const r=e.safeParse(n);r.success&&(a[t]=r.data)}return a})}Keu(bAu);Keu(L8u);const VBe=S({trigger:Ku(yd),status:Ku(Nn),startedAt:ce.date().optional(),gitCommitSha:k().optional(),gitCommitShaShort:k().optional(),gitCommitTimestamp:ce.date().optional(),gitBranchName:k().optional(),gitOriginUrl:k().optional(),gitCommitMessage:k().optional(),gitCommitAuthorName:k().optional(),githubRepository:k().optional(),gitlabProjectPath:k().optional(),pipelineId:k().optional(),cliVersion:k().optional()});S({id:k()});const HBe=S({status:Ku(Nn),updatedAt:ce.date().optional(),finishedAt:ce.date().optional()}),GBe=S({stepsSnapshot:De($u(Le())).optional(),runGroupId:k().optional(),testId:k(),testName:k(),resolvedBaseUrl:k().optional(),environmentName:k().optional(),labels:De(k()).optional(),cliVersion:k().optional(),trigger:Ku(yd),schemaVersion:k().optional(),section:Ku(_S).optional(),resolvedInputs:$u(k(),k()).optional(),quarantined:cu().optional().default(!1),quarantinedReason:k().optional()});S({id:k()});const JBe=HQ.pick({id:!0,status:!0,testName:!0,testId:!0,test:!0,failureReason:!0,failureDetails:!0});JBe.array();const WBe=HQ.pick({startedAt:!0,finishedAt:!0,updatedAt:!0,results:!0,beforeResults:!0,afterResults:!0,status:!0,failureDetails:!0,failureReason:!0,resolvedBaseUrl:!0,environmentName:!0,labels:!0,cliVersion:!0,resolvedInputs:!0,attempts:!0,flake:!0}).partial();S({id:k()});const UBe=S({status:Ku(Nn),finishedAt:ce.date().optional(),schemaVersion:k().optional().default("1.0.19"),results:$u(k(),Le()).array().optional(),beforeResults:$u(k(),Le()).array().optional(),afterResults:$u(k(),Le()).array().optional()});S({screenshot:k()});S({key:k()});S({orgId:k(),userId:k()});De(Xyu);$u(k(),ma([k(),cu()]));S({paths:k().array(),env:k().optional(),urlOverride:k().optional(),customHeaders:$u(k(),k()).optional()});S({suiteRunIds:k().array(),runGroupIds:k().array()});S({suiteRunIds:k().array()});jBu.array();S({runGroupIds:k().array()});const ZBe=S({uploadUrl:k()});bt.merge(XBu);bt.merge(e8u);bt.merge(u8u);const QBe=S({testId:k().optional().default(""),testName:k().optional().default(""),suiteId:k().optional().default(""),suiteName:k().optional().default(""),creditsUsed:uu().optional()}),qBe=S({transactionId:k(),timestamp:k(),event:Ku(bq),properties:QBe});qBe.array();KBe.omit({steps:!0}).extend({steps:De($u(k(),Le())).describe("unparsed ResolvedStep[]")});S({limit:uu().max(10).optional(),afterTime:uu().optional()});SBu.array();S({applied:cu().optional(),appliedAt:ce.date().optional()});ZBe.extend({id:k()});S({runGroupId:k().uuid().optional()});S({runGroupId:k().uuid()});S({quarantined:S({testId:k().uuid(),quarantinedAt:ce.date(),quarantinedBy:k().optional(),quarantinedReason:k()}).array()});S({testId:k().uuid(),testName:k().optional(),reason:k(),gitLocalUsername:k().optional(),gitLocalEmail:k().optional(),gitLocalName:k().optional()});S({testName:k().optional(),reason:k().optional(),gitLocalUsername:k().optional(),gitLocalEmail:k().optional(),gitLocalName:k().optional()});bt.merge(vSu);bt.merge(ASu);bt.merge(bSu);S({apkToInstall:S({channel:k(),tag:k().optional()}).optional(),hostname:k().optional(),region:Ku(a1).optional(),osVersion:Ku(_l).optional(),sessionId:k().optional()});S({name:k(),webRtcUrl:k(),adbUrl:k(),token:k(),apkDownloadUrl:k().optional(),playwrightServerUrl:k().optional(),region:k().optional()});S({hostname:k().optional(),region:Ku(a1).optional(),osVersion:Ku(cq).optional(),sessionId:k().optional()});S({id:k(),apiUrl:k(),webRtcUrl:k(),wdaUrl:k(),token:k(),region:k().optional()});S({channel:k(),tag:k(),md5:k()});S({id:k(),uploadUrl:k().optional(),downloadUrl:k(),md5:k().optional()});S({assets:De(S({channel:k(),tag:k(),md5:k(),createdAt:uu().describe("Unix timestamp in milliseconds")}))});const $eu=7,YBe=3;S({localTestId:k(),quarantinedAt:us(),quarantinedBy:k().optional(),quarantinedReason:k(),quarantinedByGitEmail:k().optional(),quarantinedByGitName:k().optional(),quarantinedByGitUsername:k().optional()}).or(S({cloudTestId:k(),quarantinedAt:us(),quarantinedBy:k().optional(),quarantinedReason:k(),quarantinedByGitEmail:k().optional(),quarantinedByGitName:k().optional(),quarantinedByGitUsername:k().optional()}));var Veu=(e=>(e.QUARANTINE="QUARANTINE",e.UNQUARANTINE="UNQUARANTINE",e))(Veu||{});const oz=S({name:k(),description:k().nullish(),effect:Ku(Veu),labels:De(k()).nullish(),githubRepository:k().nullish(),gitlabProjectPath:k().nullish(),gitBranchName:k().nullish(),slackNotificationChannel:k().nullish()}),XBe=S({type:J("LAST_N_RUNS"),lastN:uu().min(YBe)}),u8e=S({type:J("LAST_N_HOURS"),lastN:uu().min(1).max($eu*24)}),e8e=S({type:J("LAST_N_DAYS"),lastN:uu().min(1).max($eu)}),sz=Oe("type",[XBe,u8e,e8e]),a8e=S({flakeRateThreshold:uu().min(1).max(100),evaluationWindow:sz}),t8e=oz.extend({type:J("FLAKE_RATE"),config:a8e}),n8e=S({passRateThreshold:uu().min(1).max(100),evaluationWindow:sz}),r8e=oz.extend({type:J("PASS_RATE"),config:n8e}),i8e=S({failureCountThreshold:uu().min(0),evaluationWindow:sz}),o8e=oz.extend({type:J("FAILURE_COUNT"),config:i8e});Oe("type",[t8e,r8e,o8e]);S({repositoriesIndexed:cu(),indexingInProgress:cu(),indexesOutdated:cu()});var Heu=(e=>(e.Queued="queued",e.InProgress="in_progress",e.Completed="completed",e.Waiting="waiting",e.Requested="requested",e.Pending="pending",e))(Heu||{}),Geu=(e=>(e.Success="success",e.Failure="failure",e.Neutral="neutral",e.Cancelled="cancelled",e.Skipped="skipped",e.TimedOut="timed_out",e.ActionRequired="action_required",e))(Geu||{});S({name:k(),status:Ku(Heu),conclusion:Ku(Geu).nullable()});S({sha:k(),message:k(),author:S({name:k().optional(),email:k().optional(),date:ce.date().optional()}),committer:S({name:k().optional(),email:k().optional(),date:ce.date().optional()})});S({mergedBranch:k().optional()});const Jeu=S({orgId:k(),cacheKeys:k().array()});S({keyParams:Jeu,clientMetadata:k(),lockAcquisitionTimeoutMs:uu().optional()});S({acquired:cu(),acquiredByMetadata:k(),keyPrefix:k()});S({keyPrefix:k(),result:k(),ttlMs:uu()});ma([S({keyPrefix:k()}),Jeu]);const s8e=S({remainingTtlMs:uu(),value:k().nullish()});S({results:$u(k(),s8e),activeLocks:k().array()});S({quarantineNotifications:k().nullish()});const l8e=S({version:k(),json:$u(Le()),hash:k()}),Weu=$u(Le());S({newSvgs:De(l8e),metadata:Weu.optional()});const E8e=S({version:k(),json:$u(Le()).nullish(),hash:k(),description:k().nullish(),metadata:Weu.nullish()});$u(k().describe("icon hash"),E8e);const Bb=S({assertion:k().describe("A human readable assertion that evaluates to either true or false depending on the state of the system.")}),c8e=S({instruction:k().describe("Human readable instruction to execute the step. Instructions should only describe concrete actions that need to be taken. Any checks or assertions should be described in the preConditions, postConditions, or expectedResults."),expectedResults:Bb.array().optional().describe("Human readable description of the expected results after the step is executed. Each expected result should contain a single assertion that evaluates to true or false.")}),Ueu=c8e.extend({subSteps:j0(()=>Ueu.array().optional()).describe("More granular steps to be take to achieve the current step's higher level objective.")}),Zeu=S({name:k().describe("Short name describing the test plan"),description:k().nullish().transform(e=>e??void 0).describe("Longer form description of the high level goal of the test plan")}),Qeu=Zeu.extend({id:k(),createdAt:ce.date(),updatedAt:ce.date(),updatedBy:k(),createdBy:k(),test:S({id:k(),name:k()}).nullish().transform(e=>e??void 0)});Qeu.extend({testGenRuns:C1([]).or(C1([S({id:k(),startedAt:ce.date(),status:Ku(Nn)})]))});const qeu=S({preConditions:Bb.array().nullish().transform(e=>e??[]),postConditions:Bb.array().nullish().transform(e=>e??[]),steps:Ueu.array().nullish().transform(e=>e??[])});Qeu.extend({plan:qeu.nullish().transform(e=>e??{preConditions:[],postConditions:[],steps:[]})});const d8e=Zeu.extend({plan:qeu.nullish().transform(e=>e??{preConditions:[],postConditions:[],steps:[]})});d8e.array().nullish().transform(e=>e??[]);class hh extends String{}const D8e=new Set(["<",">","<=",">="]),h8e=e=>`\\u${e.toString(16).padStart(4,"0")}`,m8e=e=>{if([1/0,-1/0,NaN,void 0,null].includes(e))return`${e}`;if(!["string","boolean","number"].includes(typeof e)){if(typeof e!="object")throw new Error("Unexpected value type");const a=Object.getPrototypeOf(e);if(!(a===Array.prototype&&Array.isArray(e)||a===Object.prototype))throw new Error("Unexpected object given as value")}return JSON.stringify(e).replace(/([{,])"__proto__":/g,'$1["__proto__"]:').replace(/[^\\]"__proto__":/g,()=>{throw new Error("Unreachable")}).replace(/[\u2028\u2029]/g,a=>h8e(a.charCodeAt(0)))},xC=(e,...u)=>{const a=e.replace(/%[%drscjw]/g,t=>{if(t==="%%")return"%";if(u.length===0)throw new Error("Unexpected arguments count");const n=u.shift();switch(t){case"%d":if(typeof n=="number")return n;throw new Error("Expected a number");case"%r":if(n instanceof RegExp)return xC("new RegExp(%j, %j)",n.source,n.flags);throw new Error("Expected a RegExp instance");case"%s":if(n instanceof hh)return n;throw new Error("Expected a safe string");case"%c":if(D8e.has(n))return n;throw new Error("Expected a compare op");case"%j":return m8e(n);case"%w":if(Number.isInteger(n)&&n>=0)return" ".repeat(n);throw new Error("Expected a non-negative integer for indentation")}throw new Error("Unreachable")});if(u.length!==0)throw new Error("Unexpected arguments count");return new hh(a)},Sb=e=>{if(!/^[a-z][a-z0-9_]*$/i.test(e))throw new Error("Does not look like a safe id");return new hh(e)},Yeu=e=>(...u)=>{if(!u.every(a=>a instanceof hh))throw new Error("Unsafe arguments");return new hh(e(...u))},x8e=e=>/^[a-z][a-z0-9_().]*$/i.test(e)||/^\([^()]+\)$/i.test(e)?e:xC("(%s)",e),f8e=Yeu((...e)=>e.some(u=>`${u}`=="true")?"true":e.join(" || ")||"false"),p8e=Yeu((...e)=>e.some(u=>`${u}`=="false")?"false":e.join(" && ")||"true"),Xeu=e=>`${e}`=="true"?Sb("false"):`${e}`=="false"?Sb("true"):xC("!%s",x8e(e)),g8e=(...e)=>Xeu(f8e(...e));var C8e={format:xC,safe:Sb,safeand:p8e,safenot:Xeu,safenotor:g8e};const F8e=e=>/[\uD800-\uDFFF]/.test(e)?[...e].length:e.length,k8e=(e,u,a,t)=>{if(e%u===0)return!0;let n=e*a;if((n===1/0||n===-1/0)&&(n=e),n%t===0)return!0;const r=Math.floor(n+.5);return r/a===e&&r%t===0},mh=(e,u)=>{if(e===u)return!0;if(!e||!u||typeof e!=typeof u||e!==u&&typeof e!="object")return!1;const a=Object.getPrototypeOf(e);if(a!==Object.getPrototypeOf(u))return!1;if(a===Array.prototype)return!Array.isArray(e)||!Array.isArray(u)||e.length!==u.length?!1:e.every((t,n)=>mh(t,u[n]));if(a===Object.prototype){const[t,n]=[Object.keys(e),Object.keys(u)];return t.length!==n.length?!1:new Set([...t,...n]).size===t.length&&t.every(i=>mh(e[i],u[i]))}return!1},v8e=e=>{if(e.length<2)return!0;if(e.length===2)return!mh(e[0],e[1]);const u=[],a=e.length>20?new Set:null;let t=0,n=0;for(const r of e){if(typeof r=="object")u.push(r);else if(a){if(a.add(r),a.size!==++t)return!1}else if(e.indexOf(r,n+1)!==-1)return!1;n++}for(let r=1;r<u.length;r++)for(let i=0;i<r;i++)if(mh(u[r],u[i]))return!1;return!0},A8e=e=>{if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf-8");const u=atob(e);return new TextDecoder("utf-8").decode(new Uint8Array(u.length).map((a,t)=>u.charCodeAt(t)))},u0u=Function.prototype.call.bind(Object.prototype.hasOwnProperty);u0u[Symbol.for("toJayString")]="Function.prototype.call.bind(Object.prototype.hasOwnProperty)";const e0u=e=>/~\//.test(e)?`${e}`.replace(/~/g,"~0").replace(/\//g,"~1"):e,b8e=e=>e.length===0?"#":`#/${e.map(e0u).join("/")}`,y8e=({keywordLocation:e,instanceLocation:u},a,t)=>({keywordLocation:`${a}${e.slice(1)}`,instanceLocation:`${t}${u.slice(1)}`}),B8e=(e,[u,a])=>u.includes(!0)||u.some(t=>t===e)||a.some(t=>new RegExp(t,"u").test(e)),S8e=(e,u)=>(e.filter(a=>a[u])[0]||{})[u],z8e={toPointer:b8e,pointerPart:e0u,errorMerge:y8e,propertyIn:B8e,dynamicResolve:S8e};var O8e={stringLength:F8e,isMultipleOf:k8e,deepEqual:mh,unique:v8e,deBase64:A8e,hasOwn:u0u,...z8e};const{format:a4,safe:ja0}=C8e;new Map(Object.entries({null:e=>a4("%s === null",e),boolean:e=>a4('typeof %s === "boolean"',e),array:e=>a4("Array.isArray(%s)",e),object:e=>a4('typeof %s === "object" && %s && !Array.isArray(%s)',e,e,e),number:e=>a4('typeof %s === "number"',e),integer:e=>a4("Number.isInteger(%s)",e),string:e=>a4('typeof %s === "string"',e)}));new Set([].concat(...[Object,Array,String,Number,Boolean].map(e=>Object.getOwnPropertyNames(e.prototype))));const mj={email:e=>{if(e.length>318)return!1;if(/^[a-z0-9!#$%&'*+/=?^_`{|}~-]{1,20}(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]{1,21}){0,2}@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,60}[a-z0-9])?){0,3}$/i.test(e))return!0;if(!e.includes("@")||/(^\.|^"|\.@|\.\.)/.test(e))return!1;const[a,t,...n]=e.split("@");return!a||!t||n.length!==0||a.length>64||t.length>253||!/^[a-z0-9.-]+$/i.test(t)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(a)?!1:t.split(".").every(r=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(r))},hostname:e=>e.length>(e.endsWith(".")?254:253)?!1:/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.?$/i.test(e),date:e=>{if(e.length!==10)return!1;if(e[5]==="0"&&e[6]==="2"){if(/^\d\d\d\d-02-(?:[012][1-8]|[12]0|[01]9)$/.test(e))return!0;const u=e.match(/^(\d\d\d\d)-02-29$/);if(!u)return!1;const a=u[1]|0;return a%16===0||a%4===0&&a%25!==0}return e.endsWith("31")?/^\d\d\d\d-(?:0[13578]|1[02])-31$/.test(e):/^\d\d\d\d-(?:0[13-9]|1[012])-(?:[012][1-9]|[123]0)$/.test(e)},time:e=>{if(e.length>27||!/^(?:2[0-3]|[0-1]\d):[0-5]\d:(?:[0-5]\d|60)(?:\.\d+)?(?:z|[+-](?:2[0-3]|[0-1]\d)(?::?[0-5]\d)?)?$/i.test(e))return!1;if(!/:60/.test(e))return!0;const a=e.match(/([0-9.]+|[^0-9.])/g);let t=Number(a[0])*60+Number(a[2]);return a[5]==="+"?t+=24*60-Number(a[6]||0)*60-Number(a[8]||0):a[5]==="-"&&(t+=Number(a[6]||0)*60+Number(a[8]||0)),t%(24*60)===23*60+59},"date-time":e=>{if(e.length>38)return!1;const u=/^\d\d\d\d-(?:0[1-9]|1[0-2])-(?:[0-2]\d|3[01])[t\s](?:2[0-3]|[0-1]\d):[0-5]\d:(?:[0-5]\d|60)(?:\.\d+)?(?:z|[+-](?:2[0-3]|[0-1]\d)(?::?[0-5]\d)?)$/i,a=e[5]==="0"&&e[6]==="2";if(a&&e[8]==="3"||!u.test(e))return!1;if(e[17]==="6"){const t=e.slice(11).match(/([0-9.]+|[^0-9.])/g);let n=Number(t[0])*60+Number(t[2]);if(t[5]==="+"?n+=24*60-Number(t[6]||0)*60-Number(t[8]||0):t[5]==="-"&&(n+=Number(t[6]||0)*60+Number(t[8]||0)),n%(24*60)!==23*60+59)return!1}if(a){if(/^\d\d\d\d-02-(?:[012][1-8]|[12]0|[01]9)/.test(e))return!0;const t=e.match(/^(\d\d\d\d)-02-29/);if(!t)return!1;const n=t[1]|0;return n%16===0||n%4===0&&n%25!==0}return e[8]==="3"&&e[9]==="1"?/^\d\d\d\d-(?:0[13578]|1[02])-31/.test(e):/^\d\d\d\d-(?:0[13-9]|1[012])-(?:[012][1-9]|[123]0)/.test(e)},ipv4:e=>e.length<=15&&/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)$/.test(e),ipv6:e=>{if(e.length>45||e.length<2)return!1;let u=0,a=0,t=0,n=!1,r=!1,i=0,o=!0;for(let l=0;l<e.length;l++){const E=e.charCodeAt(l);if(l===1&&i===58&&E!==58)return!1;if(E>=48&&E<=57){if(++t>4)return!1}else if(E===46){if(u>6||a>=3||t===0||r)return!1;a++,t=0}else if(E===58){if(a>0||u>=7)return!1;if(i===58){if(n)return!1;n=!0}else l===0&&(o=!1);u++,t=0,r=!1}else if(E>=97&&E<=102||E>=65&&E<=70){if(a>0||++t>4)return!1;r=!0}else return!1;i=E}if(u<2||a>0&&(a!==3||t===0))return!1;if(n&&e.length===2)return!0;if(a>0&&!/(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/.test(e))return!1;const s=a>0?6:7;return n?(o||t>0)&&u<s:u===s&&o&&t>0},uri:/^[a-z][a-z0-9+\-.]*:(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|v[0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/?(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|v[0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/?(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)?(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2}|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,"json-pointer":/^(?:|\/(?:[^~]|~0|~1)*)$/,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:|#|\/(?:[^~]|~0|~1)*)$/,uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,duration:e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e))};mj.hostname,mj.ipv4;const{toPointer:Na0,...w8e}=O8e,M8e=new Map(Object.entries({boolean:e=>typeof e=="boolean",array:e=>Array.isArray(e)&&Object.getPrototypeOf(e)===Array.prototype,object:e=>e&&Object.getPrototypeOf(e)===Object.prototype,finite:e=>Number.isFinite(e),natural:e=>Number.isInteger(e)&&e>=0,string:e=>typeof e=="string",jsonval:e=>w8e.deepEqual(e,JSON.parse(JSON.stringify(e)))}));M8e.get("object");S({parentStepIdChain:De(k()),result:Ms});const T8e=S({step:zr,status:Ku(E0),startedAt:ce.date(),finishedAt:ce.date().optional(),healMetadata:S({healType:Ku(rQ).or(J("AI")),healedAt:ce.date()}).optional(),beforeSnapshotId:k().uuid().optional(),afterSnapshotId:k().uuid().optional(),message:k().optional()}),P8e=T8e.extend({finishedAt:ce.date().optional().transform(e=>e??new Date)});P8e.extend({step:Le()});const lz=S({avdId:k().optional(),channel:k().optional(),tag:k().optional()}),Ez=UBe.extend({id:k().uuid().optional(),startedAt:ce.date(),runAttemptSchemaVersion:k().optional(),schemaVersion:k().optional().default("1.0.19"),results:$u(k(),Le()).array().optional(),beforeResults:$u(k(),Le()).array().optional(),afterResults:$u(k(),Le()).array().optional(),assetDetails:lz.optional(),activeVideos:De(S({videoName:k(),timestamp:ce.date()})).optional()}),a0u=Ez.extend({assetDetails:lz.optional(),finishedAt:ce.date().optional().transform(e=>e??new Date)});Ez.merge(TS);a0u.merge(TS);const t0u=S({results:De(Ms),beforeResults:De(Ms).optional(),afterResults:De(Ms).optional()});Ez.merge(t0u);a0u.merge(t0u);const n0u=WBe.merge(GBe).extend({executionType:Ku(ch).optional().default(ch.WEB),testId:k().uuid(),testDescription:k().optional(),runGroupId:k().uuid(),status:Ku(Nn),startedAt:ce.date(),attempts:uu(),failureRecoveryDetails:S({attempts:uu()}).optional()}),j8e=n0u.merge(lz);n0u.extend({finishedAt:ce.date().optional().transform(e=>e??new Date)});j8e.extend({finishedAt:ce.date().optional().transform(e=>e??new Date)});const N8e=VBe.merge(HBe).extend({id:k().uuid().optional(),startedAt:ce.date(),cliVersion:k(),labels:k().array().optional().default([])});N8e.extend({updatedAt:ce.date().optional().transform(e=>e??new Date),finishedAt:ce.date().optional().transform(e=>e??new Date)});const xh=e=>d.jsxs("a",{href:`https://momentic.ai/docs${e.slug}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary inline-flex flex-row items-center gap-1 underline",children:["Docs",d.jsx(KDu,{className:"size-4"})]}),zd=C.forwardRef(({className:e,...u},a)=>d.jsx("textarea",{className:lu("border-input placeholder:text-muted-foreground focus-visible:ring-ring flex min-h-[60px] w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...u}));zd.displayName="Textarea";const Ba="__NONE__",r0u=[...Object.values(a1),...Object.values(Bt)],i0u={[a1.US_WEST_1]:"US West",[a1.EU_NORTH_1]:"EU North",[a1.AS_SOUTH_1]:"Asia South",[Bt.LOCAL]:"Local"};function o0u(e){const u=typeof(e==null?void 0:e.variables[P3])=="string"?e.variables[P3].trim():void 0,a=typeof(e==null?void 0:e.variables[Eh])=="string"?e.variables[Eh].trim():void 0;return{envLocalAvdId:u,envLocalApkPath:a}}const fC=e=>ns("/api/environments",e),R8e=S({name:V1,description:k().min(1)}),L8e=S({region:KS.or(J(Ba)).optional(),channel:k().optional(),tag:k().optional(),env:k().optional(),defaultApkFilePath:Cp,localEmulatorSettings:S({avdId:Cp}).optional()});function _8e(e){return aS(R8e,L8e.superRefine((u,a)=>{var s;if(!(u.region===Bt.LOCAL))return;const n=u.env,r=typeof n=="string"?e==null?void 0:e.find(l=>l.name===n):void 0,{envLocalAvdId:i}=o0u(r),o=((s=u.localEmulatorSettings)==null?void 0:s.avdId)||"";if(o.includes(" ")){a.addIssue({code:gu.custom,message:"The AVD ID should not contain spaces.",path:["localEmulatorSettings","avdId"]});return}!o&&!i&&a.addIssue({code:gu.custom,message:"The AVD ID is required when the environment does not have a LOCAL_AVD_ID configured.",path:["localEmulatorSettings","avdId"]})}))}function I8e(e){const{pathSegments:u}=e,a=Ci(),{data:t}=fC(),n=CE(),r=C.useMemo(()=>_8e(t),[t]),i=pd({mode:"onChange",resolver:gd(r),defaultValues:{name:"",description:"",region:Ba,channel:"",tag:Ba,env:Qk,defaultApkFilePath:"",localEmulatorSettings:{avdId:""}}}),o=i.watch("channel"),s=i.watch("region"),l=i.watch("localEmulatorSettings.avdId"),E=s===Bt.LOCAL,{data:c}=ns("/api/assets",a),D=C.useMemo(()=>{const g=new Set;for(const F of(c==null?void 0:c.assets)||[])g.add(F.channel);return Array.from(g).sort()},[c]),h=C.useMemo(()=>{const g=o&&o!==Ba?o:void 0;if(!g)return[];const F=new Set;for(const b of(c==null?void 0:c.assets)||[])b.channel===g&&F.add(b.tag);return Array.from(F).sort()},[c,o]),[m,x]=Ws(async g=>{var z,N,M;const F=g.region===Ba?void 0:g.region,b=F===Bt.LOCAL,y=g.env===Qk?void 0:g.env;let v,A,B,j,R;b?(v=void 0,A=void 0,B=((N=(z=g.localEmulatorSettings)==null?void 0:z.avdId)==null?void 0:N.trim())||void 0,j=((M=g.defaultApkFilePath)==null?void 0:M.trim())||void 0,R={region:F,localEmulatorSettings:{avdId:B}}):(B=void 0,j=void 0,v=g.channel===Ba?void 0:g.channel||void 0,A=g.tag===Ba?void 0:g.tag||void 0,R=F?{region:F}:void 0);const w={defaultEnv:y||void 0,defaultChannel:v||void 0,defaultTag:A||void 0,defaultApkFilePath:j,emulator:R,retries:1},O=Object.values(w).some(I=>I!==void 0),T={name:g.name,description:g.description,settings:O?w:void 0,pathSegments:u};try{const I=await a("/api/mobile-tests",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)});n(`/tests/${I.relativeFilePath}`)}catch(I){Ca.error("Failed to create test.",{description:`${I}`})}km(u)},[u]),{isDirty:p,isValid:f}=i.formState;return d.jsxs(bE,{children:[d.jsx(yE,{asChild:!0,children:d.jsxs(Ve,{children:[d.jsx(im,{className:"h-4 w-4"}),"Create test"]})}),d.jsxs(_1,{children:[d.jsxs(I1,{children:[d.jsx(K1,{children:"Create mobile test"}),d.jsx($1,{children:"Create a new Momentic mobile test."})]}),d.jsx(Cd,{...i,children:d.jsxs("form",{onSubmit:i.handleSubmit(x),className:"space-y-4",children:[d.jsx(_0,{control:i.control,name:"name",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Name"}),d.jsx(T0,{children:d.jsx(SE,{placeholder:"example-test-name",...g})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:i.control,name:"description",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Description"}),d.jsx(T0,{children:d.jsx(zd,{placeholder:"Example test description",...g})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:i.control,name:"region",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Region"}),d.jsx(T0,{children:d.jsxs(Ka,{value:g.value??Ba,onValueChange:F=>{g.onChange(F),F===Bt.LOCAL?(i.setValue("channel","",{shouldDirty:!0}),i.setValue("tag","",{shouldDirty:!0}),i.setValue("localEmulatorSettings.avdId","",{shouldDirty:!0,shouldValidate:!0})):(i.setValue("localEmulatorSettings.avdId","",{shouldDirty:!0}),i.setValue("defaultApkFilePath","",{shouldDirty:!0}))},children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select region..."})}),d.jsxs(wa,{children:[r0u.map(F=>d.jsx(Re,{value:F,children:i0u[F]??F},F)),d.jsx(Re,{value:Ba,children:"Closest Region"})]})]})}),d.jsxs(op,{children:["Choose whether tests execute using remote or local emulators."," ",d.jsx(xh,{slug:"/mobile-cli/emulators#choosing-a-platform"})]}),d.jsx(P0,{})]})}),d.jsx(_0,{control:i.control,name:"env",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Environment"}),d.jsx(T0,{children:d.jsxs(Ka,{onValueChange:F=>{i.setValue("env",F,{shouldDirty:!0}),i.setValue("localEmulatorSettings.avdId",l,{shouldValidate:!0})},value:g.value,children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select environment..."})}),d.jsxs(wa,{children:[t==null?void 0:t.map(F=>d.jsx(Re,{value:F.name,children:F.name},F.name)),d.jsx(Re,{value:Qk,children:P5})]})]})}),d.jsxs(op,{children:["Choose the default environment for this test."," ",d.jsx(xh,{slug:"/mobile-cli/emulators#environment-based-settings"})]}),d.jsx(P0,{})]})}),E?d.jsxs("div",{children:[d.jsx(_0,{control:i.control,name:"localEmulatorSettings.avdId",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:`The ID of the AVD to use for the local emulator. If unset, Momentic will use ${P3} from the selected environment (if any).`,children:"Local AVD ID"}),d.jsx(T0,{children:d.jsx(gt,{value:g.value,onChange:F=>g.onChange(F.target.value),onBlur:g.onBlur,name:g.name,ref:g.ref,placeholder:"Pixel_9_API_35"})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:i.control,name:"defaultApkFilePath",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:`Local path to the APK that should be installed when using a local emulator. If unset, Momentic will use ${Eh} from the selected environment (if any).`,children:"Local APK file path"}),d.jsx(T0,{children:d.jsx(gt,{value:g.value,onChange:F=>g.onChange(F.target.value),onBlur:g.onBlur,name:g.name,ref:g.ref,placeholder:"/Users/me/app/build/app.apk"})}),d.jsx(P0,{})]})})]},"local-emulator-settings"):d.jsxs("div",{children:[d.jsx(_0,{control:i.control,name:"channel",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Channel"}),d.jsx(T0,{children:d.jsxs(Ka,{onValueChange:F=>{g.onChange(F),i.setValue("tag",Ba,{shouldDirty:!0})},value:g.value,children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select channel..."})}),d.jsxs(wa,{children:[D.map(F=>d.jsx(Re,{value:F,children:F},F)),d.jsx(Re,{value:Ba,children:"None"})]})]})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:i.control,name:"tag",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Tag"}),d.jsx(T0,{children:d.jsxs(Ka,{onValueChange:g.onChange,value:g.value,children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select tag..."})}),d.jsxs(wa,{children:[h.map(F=>d.jsx(Re,{value:F,children:F},F)),d.jsx(Re,{value:Ba,children:"Latest available"})]})]})}),d.jsx(P0,{})]})})]},"remote-emulator-settings"),d.jsx(BE,{children:d.jsx(Ve,{type:"submit",disabled:m.loading||!p||!f,children:"Create test"})})]})})]})]})}function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var u=1;u<arguments.length;u++){var a=arguments[u];for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t])}return e},Me.apply(this,arguments)}function zb(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ap(e,u){return Ap=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Ap(e,u)}function K8e(e,u){e.prototype=Object.create(u.prototype),e.prototype.constructor=e,Ap(e,u)}var xj=Number.isNaN||function(u){return typeof u=="number"&&u!==u};function $8e(e,u){return!!(e===u||xj(e)&&xj(u))}function V8e(e,u){if(e.length!==u.length)return!1;for(var a=0;a<e.length;a++)if(!$8e(e[a],u[a]))return!1;return!0}function iv(e,u){u===void 0&&(u=V8e);var a,t=[],n,r=!1;function i(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return r&&a===this&&u(o,t)||(n=e.apply(this,o),r=!0,a=this,t=o),n}return i}function H8e(e,u){if(e==null)return{};var a={},t=Object.keys(e),n,r;for(r=0;r<t.length;r++)n=t[r],!(u.indexOf(n)>=0)&&(a[n]=e[n]);return a}var G8e=typeof performance=="object"&&typeof performance.now=="function",fj=G8e?function(){return performance.now()}:function(){return Date.now()};function pj(e){cancelAnimationFrame(e.id)}function J8e(e,u){var a=fj();function t(){fj()-a>=u?e.call(null):n.id=requestAnimationFrame(t)}var n={id:requestAnimationFrame(t)};return n}var ov=-1;function gj(e){if(e===void 0&&(e=!1),ov===-1||e){var u=document.createElement("div"),a=u.style;a.width="50px",a.height="50px",a.overflow="scroll",document.body.appendChild(u),ov=u.offsetWidth-u.clientWidth,document.body.removeChild(u)}return ov}var GE=null;function Cj(e){if(e===void 0&&(e=!1),GE===null||e){var u=document.createElement("div"),a=u.style;a.width="50px",a.height="50px",a.overflow="scroll",a.direction="rtl";var t=document.createElement("div"),n=t.style;return n.width="100px",n.height="100px",u.appendChild(t),document.body.appendChild(u),u.scrollLeft>0?GE="positive-descending":(u.scrollLeft=1,u.scrollLeft===0?GE="negative":GE="positive-ascending"),document.body.removeChild(u),GE}return GE}var W8e=150,U8e=function(u,a){return u};function Z8e(e){var u,a=e.getItemOffset,t=e.getEstimatedTotalSize,n=e.getItemSize,r=e.getOffsetForIndexAndAlignment,i=e.getStartIndexForOffset,o=e.getStopIndexForStartIndex,s=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,E=e.validateProps;return u=function(c){K8e(D,c);function D(m){var x;return x=c.call(this,m)||this,x._instanceProps=s(x.props,zb(x)),x._outerRef=void 0,x._resetIsScrollingTimeoutId=null,x.state={instance:zb(x),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof x.props.initialScrollOffset=="number"?x.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},x._callOnItemsRendered=void 0,x._callOnItemsRendered=iv(function(p,f,g,F){return x.props.onItemsRendered({overscanStartIndex:p,overscanStopIndex:f,visibleStartIndex:g,visibleStopIndex:F})}),x._callOnScroll=void 0,x._callOnScroll=iv(function(p,f,g){return x.props.onScroll({scrollDirection:p,scrollOffset:f,scrollUpdateWasRequested:g})}),x._getItemStyle=void 0,x._getItemStyle=function(p){var f=x.props,g=f.direction,F=f.itemSize,b=f.layout,y=x._getItemStyleCache(l&&F,l&&b,l&&g),v;if(y.hasOwnProperty(p))v=y[p];else{var A=a(x.props,p,x._instanceProps),B=n(x.props,p,x._instanceProps),j=g==="horizontal"||b==="horizontal",R=g==="rtl",w=j?A:0;y[p]=v={position:"absolute",left:R?void 0:w,right:R?w:void 0,top:j?0:A,height:j?"100%":B,width:j?B:"100%"}}return v},x._getItemStyleCache=void 0,x._getItemStyleCache=iv(function(p,f,g){return{}}),x._onScrollHorizontal=function(p){var f=p.currentTarget,g=f.clientWidth,F=f.scrollLeft,b=f.scrollWidth;x.setState(function(y){if(y.scrollOffset===F)return null;var v=x.props.direction,A=F;if(v==="rtl")switch(Cj()){case"negative":A=-F;break;case"positive-descending":A=b-g-F;break}return A=Math.max(0,Math.min(A,b-g)),{isScrolling:!0,scrollDirection:y.scrollOffset<A?"forward":"backward",scrollOffset:A,scrollUpdateWasRequested:!1}},x._resetIsScrollingDebounced)},x._onScrollVertical=function(p){var f=p.currentTarget,g=f.clientHeight,F=f.scrollHeight,b=f.scrollTop;x.setState(function(y){if(y.scrollOffset===b)return null;var v=Math.max(0,Math.min(b,F-g));return{isScrolling:!0,scrollDirection:y.scrollOffset<v?"forward":"backward",scrollOffset:v,scrollUpdateWasRequested:!1}},x._resetIsScrollingDebounced)},x._outerRefSetter=function(p){var f=x.props.outerRef;x._outerRef=p,typeof f=="function"?f(p):f!=null&&typeof f=="object"&&f.hasOwnProperty("current")&&(f.current=p)},x._resetIsScrollingDebounced=function(){x._resetIsScrollingTimeoutId!==null&&pj(x._resetIsScrollingTimeoutId),x._resetIsScrollingTimeoutId=J8e(x._resetIsScrolling,W8e)},x._resetIsScrolling=function(){x._resetIsScrollingTimeoutId=null,x.setState({isScrolling:!1},function(){x._getItemStyleCache(-1,null)})},x}D.getDerivedStateFromProps=function(x,p){return Q8e(x,p),E(x),null};var h=D.prototype;return h.scrollTo=function(x){x=Math.max(0,x),this.setState(function(p){return p.scrollOffset===x?null:{scrollDirection:p.scrollOffset<x?"forward":"backward",scrollOffset:x,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},h.scrollToItem=function(x,p){p===void 0&&(p="auto");var f=this.props,g=f.itemCount,F=f.layout,b=this.state.scrollOffset;x=Math.max(0,Math.min(x,g-1));var y=0;if(this._outerRef){var v=this._outerRef;F==="vertical"?y=v.scrollWidth>v.clientWidth?gj():0:y=v.scrollHeight>v.clientHeight?gj():0}this.scrollTo(r(this.props,x,p,b,this._instanceProps,y))},h.componentDidMount=function(){var x=this.props,p=x.direction,f=x.initialScrollOffset,g=x.layout;if(typeof f=="number"&&this._outerRef!=null){var F=this._outerRef;p==="horizontal"||g==="horizontal"?F.scrollLeft=f:F.scrollTop=f}this._callPropsCallbacks()},h.componentDidUpdate=function(){var x=this.props,p=x.direction,f=x.layout,g=this.state,F=g.scrollOffset,b=g.scrollUpdateWasRequested;if(b&&this._outerRef!=null){var y=this._outerRef;if(p==="horizontal"||f==="horizontal")if(p==="rtl")switch(Cj()){case"negative":y.scrollLeft=-F;break;case"positive-ascending":y.scrollLeft=F;break;default:var v=y.clientWidth,A=y.scrollWidth;y.scrollLeft=A-v-F;break}else y.scrollLeft=F;else y.scrollTop=F}this._callPropsCallbacks()},h.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&pj(this._resetIsScrollingTimeoutId)},h.render=function(){var x=this.props,p=x.children,f=x.className,g=x.direction,F=x.height,b=x.innerRef,y=x.innerElementType,v=x.innerTagName,A=x.itemCount,B=x.itemData,j=x.itemKey,R=j===void 0?U8e:j,w=x.layout,O=x.outerElementType,T=x.outerTagName,z=x.style,N=x.useIsScrolling,M=x.width,I=this.state.isScrolling,P=g==="horizontal"||w==="horizontal",L=P?this._onScrollHorizontal:this._onScrollVertical,K=this._getRangeToRender(),W=K[0],_=K[1],Q=[];if(A>0)for(var eu=W;eu<=_;eu++)Q.push(C.createElement(p,{data:B,key:R(eu,B),index:eu,isScrolling:N?I:void 0,style:this._getItemStyle(eu)}));var U=t(this.props,this._instanceProps);return C.createElement(O||T||"div",{className:f,onScroll:L,ref:this._outerRefSetter,style:Me({position:"relative",height:F,width:M,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:g},z)},C.createElement(y||v||"div",{children:Q,ref:b,style:{height:P?"100%":U,pointerEvents:I?"none":void 0,width:P?U:"100%"}}))},h._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var x=this.props.itemCount;if(x>0){var p=this._getRangeToRender(),f=p[0],g=p[1],F=p[2],b=p[3];this._callOnItemsRendered(f,g,F,b)}}if(typeof this.props.onScroll=="function"){var y=this.state,v=y.scrollDirection,A=y.scrollOffset,B=y.scrollUpdateWasRequested;this._callOnScroll(v,A,B)}},h._getRangeToRender=function(){var x=this.props,p=x.itemCount,f=x.overscanCount,g=this.state,F=g.isScrolling,b=g.scrollDirection,y=g.scrollOffset;if(p===0)return[0,0,0,0];var v=i(this.props,y,this._instanceProps),A=o(this.props,v,y,this._instanceProps),B=!F||b==="backward"?Math.max(1,f):1,j=!F||b==="forward"?Math.max(1,f):1;return[Math.max(0,v-B),Math.max(0,Math.min(p-1,A+j)),v,A]},D}(C.PureComponent),u.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},u}var Q8e=function(u,a){u.children,u.direction,u.height,u.layout,u.innerTagName,u.outerTagName,u.width,a.instance},s0u=Z8e({getItemOffset:function(u,a){var t=u.itemSize;return a*t},getItemSize:function(u,a){var t=u.itemSize;return t},getEstimatedTotalSize:function(u){var a=u.itemCount,t=u.itemSize;return t*a},getOffsetForIndexAndAlignment:function(u,a,t,n,r,i){var o=u.direction,s=u.height,l=u.itemCount,E=u.itemSize,c=u.layout,D=u.width,h=o==="horizontal"||c==="horizontal",m=h?D:s,x=Math.max(0,l*E-m),p=Math.min(x,a*E),f=Math.max(0,a*E-m+E+i);switch(t==="smart"&&(n>=f-m&&n<=p+m?t="auto":t="center"),t){case"start":return p;case"end":return f;case"center":{var g=Math.round(f+(p-f)/2);return g<Math.ceil(m/2)?0:g>x+Math.floor(m/2)?x:g}case"auto":default:return n>=f&&n<=p?n:n<f?f:p}},getStartIndexForOffset:function(u,a){var t=u.itemCount,n=u.itemSize;return Math.max(0,Math.min(t-1,Math.floor(a/n)))},getStopIndexForStartIndex:function(u,a,t){var n=u.direction,r=u.height,i=u.itemCount,o=u.itemSize,s=u.layout,l=u.width,E=n==="horizontal"||s==="horizontal",c=a*o,D=E?l:r,h=Math.ceil((D+t-c)/o);return Math.max(0,Math.min(i-1,a+h-1))},initInstanceProps:function(u){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(u){u.itemSize}});const q8e=P1("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",plain:"border-transparent text-primary-foreground"}},defaultVariants:{variant:"default"}});function Ts({className:e,variant:u,...a}){return d.jsx("div",{className:lu(q8e({variant:u}),e),...a})}var Fj=1,Y8e=.9,X8e=.8,uSe=.17,sv=.1,lv=.999,eSe=.9999,aSe=.99,tSe=/[\\\/_+.#"@\[\(\{&]/,nSe=/[\\\/_+.#"@\[\(\{&]/g,rSe=/[\s-]/,l0u=/[\s-]/g;function Ob(e,u,a,t,n,r,i){if(r===u.length)return n===e.length?Fj:aSe;var o=`${n},${r}`;if(i[o]!==void 0)return i[o];for(var s=t.charAt(r),l=a.indexOf(s,n),E=0,c,D,h,m;l>=0;)c=Ob(e,u,a,t,l+1,r+1,i),c>E&&(l===n?c*=Fj:tSe.test(e.charAt(l-1))?(c*=X8e,h=e.slice(n,l-1).match(nSe),h&&n>0&&(c*=Math.pow(lv,h.length))):rSe.test(e.charAt(l-1))?(c*=Y8e,m=e.slice(n,l-1).match(l0u),m&&n>0&&(c*=Math.pow(lv,m.length))):(c*=uSe,n>0&&(c*=Math.pow(lv,l-n))),e.charAt(l)!==u.charAt(r)&&(c*=eSe)),(c<sv&&a.charAt(l-1)===t.charAt(r+1)||t.charAt(r+1)===t.charAt(r)&&a.charAt(l-1)!==t.charAt(r))&&(D=Ob(e,u,a,t,l+1,r+2,i),D*sv>c&&(c=D*sv)),c>E&&(E=c),l=a.indexOf(s,l+1);return i[o]=E,E}function kj(e){return e.toLowerCase().replace(l0u," ")}function iSe(e,u,a){return e=a&&a.length>0?`${e+" "+a.join(" ")}`:e,Ob(e,u,kj(e),kj(u),0,0,{})}var c5='[cmdk-group=""]',Ev='[cmdk-group-items=""]',oSe='[cmdk-group-heading=""]',E0u='[cmdk-item=""]',vj=`${E0u}:not([aria-disabled="true"])`,wb="cmdk-item-select",ac="data-value",sSe=(e,u,a)=>iSe(e,u,a),c0u=C.createContext(void 0),Om=()=>C.useContext(c0u),d0u=C.createContext(void 0),cz=()=>C.useContext(d0u),D0u=C.createContext(void 0),h0u=C.forwardRef((e,u)=>{let a=tc(()=>{var _,Q;return{search:"",value:(Q=(_=e.value)!=null?_:e.defaultValue)!=null?Q:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),t=tc(()=>new Set),n=tc(()=>new Map),r=tc(()=>new Map),i=tc(()=>new Set),o=m0u(e),{label:s,children:l,value:E,onValueChange:c,filter:D,shouldFilter:h,loop:m,disablePointerSelection:x=!1,vimBindings:p=!0,...f}=e,g=kt(),F=kt(),b=kt(),y=C.useRef(null),v=gSe();eE(()=>{if(E!==void 0){let _=E.trim();a.current.value=_,A.emit()}},[E]),eE(()=>{v(6,T)},[]);let A=C.useMemo(()=>({subscribe:_=>(i.current.add(_),()=>i.current.delete(_)),snapshot:()=>a.current,setState:(_,Q,eu)=>{var U,iu,tu,Y;if(!Object.is(a.current[_],Q)){if(a.current[_]=Q,_==="search")O(),R(),v(1,w);else if(_==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ou=document.getElementById(b);ou?ou.focus():(U=document.getElementById(g))==null||U.focus()}if(v(7,()=>{var ou;a.current.selectedItemId=(ou=z())==null?void 0:ou.id,A.emit()}),eu||v(5,T),((iu=o.current)==null?void 0:iu.value)!==void 0){let ou=Q??"";(Y=(tu=o.current).onValueChange)==null||Y.call(tu,ou);return}}A.emit()}},emit:()=>{i.current.forEach(_=>_())}}),[]),B=C.useMemo(()=>({value:(_,Q,eu)=>{var U;Q!==((U=r.current.get(_))==null?void 0:U.value)&&(r.current.set(_,{value:Q,keywords:eu}),a.current.filtered.items.set(_,j(Q,eu)),v(2,()=>{R(),A.emit()}))},item:(_,Q)=>(t.current.add(_),Q&&(n.current.has(Q)?n.current.get(Q).add(_):n.current.set(Q,new Set([_]))),v(3,()=>{O(),R(),a.current.value||w(),A.emit()}),()=>{r.current.delete(_),t.current.delete(_),a.current.filtered.items.delete(_);let eu=z();v(4,()=>{O(),(eu==null?void 0:eu.getAttribute("id"))===_&&w(),A.emit()})}),group:_=>(n.current.has(_)||n.current.set(_,new Set),()=>{r.current.delete(_),n.current.delete(_)}),filter:()=>o.current.shouldFilter,label:s||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:g,inputId:b,labelId:F,listInnerRef:y}),[]);function j(_,Q){var eu,U;let iu=(U=(eu=o.current)==null?void 0:eu.filter)!=null?U:sSe;return _?iu(_,a.current.search,Q):0}function R(){if(!a.current.search||o.current.shouldFilter===!1)return;let _=a.current.filtered.items,Q=[];a.current.filtered.groups.forEach(U=>{let iu=n.current.get(U),tu=0;iu.forEach(Y=>{let ou=_.get(Y);tu=Math.max(ou,tu)}),Q.push([U,tu])});let eu=y.current;N().sort((U,iu)=>{var tu,Y;let ou=U.getAttribute("id"),Cu=iu.getAttribute("id");return((tu=_.get(Cu))!=null?tu:0)-((Y=_.get(ou))!=null?Y:0)}).forEach(U=>{let iu=U.closest(Ev);iu?iu.appendChild(U.parentElement===iu?U:U.closest(`${Ev} > *`)):eu.appendChild(U.parentElement===eu?U:U.closest(`${Ev} > *`))}),Q.sort((U,iu)=>iu[1]-U[1]).forEach(U=>{var iu;let tu=(iu=y.current)==null?void 0:iu.querySelector(`${c5}[${ac}="${encodeURIComponent(U[0])}"]`);tu==null||tu.parentElement.appendChild(tu)})}function w(){let _=N().find(eu=>eu.getAttribute("aria-disabled")!=="true"),Q=_==null?void 0:_.getAttribute(ac);A.setState("value",Q||void 0)}function O(){var _,Q,eu,U;if(!a.current.search||o.current.shouldFilter===!1){a.current.filtered.count=t.current.size;return}a.current.filtered.groups=new Set;let iu=0;for(let tu of t.current){let Y=(Q=(_=r.current.get(tu))==null?void 0:_.value)!=null?Q:"",ou=(U=(eu=r.current.get(tu))==null?void 0:eu.keywords)!=null?U:[],Cu=j(Y,ou);a.current.filtered.items.set(tu,Cu),Cu>0&&iu++}for(let[tu,Y]of n.current)for(let ou of Y)if(a.current.filtered.items.get(ou)>0){a.current.filtered.groups.add(tu);break}a.current.filtered.count=iu}function T(){var _,Q,eu;let U=z();U&&(((_=U.parentElement)==null?void 0:_.firstChild)===U&&((eu=(Q=U.closest(c5))==null?void 0:Q.querySelector(oSe))==null||eu.scrollIntoView({block:"nearest"})),U.scrollIntoView({block:"nearest"}))}function z(){var _;return(_=y.current)==null?void 0:_.querySelector(`${E0u}[aria-selected="true"]`)}function N(){var _;return Array.from(((_=y.current)==null?void 0:_.querySelectorAll(vj))||[])}function M(_){let Q=N()[_];Q&&A.setState("value",Q.getAttribute(ac))}function I(_){var Q;let eu=z(),U=N(),iu=U.findIndex(Y=>Y===eu),tu=U[iu+_];(Q=o.current)!=null&&Q.loop&&(tu=iu+_<0?U[U.length-1]:iu+_===U.length?U[0]:U[iu+_]),tu&&A.setState("value",tu.getAttribute(ac))}function P(_){let Q=z(),eu=Q==null?void 0:Q.closest(c5),U;for(;eu&&!U;)eu=_>0?fSe(eu,c5):pSe(eu,c5),U=eu==null?void 0:eu.querySelector(vj);U?A.setState("value",U.getAttribute(ac)):I(_)}let L=()=>M(N().length-1),K=_=>{_.preventDefault(),_.metaKey?L():_.altKey?P(1):I(1)},W=_=>{_.preventDefault(),_.metaKey?M(0):_.altKey?P(-1):I(-1)};return C.createElement(se.div,{ref:u,tabIndex:-1,...f,"cmdk-root":"",onKeyDown:_=>{var Q;(Q=f.onKeyDown)==null||Q.call(f,_);let eu=_.nativeEvent.isComposing||_.keyCode===229;if(!(_.defaultPrevented||eu))switch(_.key){case"n":case"j":{p&&_.ctrlKey&&K(_);break}case"ArrowDown":{K(_);break}case"p":case"k":{p&&_.ctrlKey&&W(_);break}case"ArrowUp":{W(_);break}case"Home":{_.preventDefault(),M(0);break}case"End":{_.preventDefault(),L();break}case"Enter":{_.preventDefault();let U=z();if(U){let iu=new Event(wb);U.dispatchEvent(iu)}}}}},C.createElement("label",{"cmdk-label":"",htmlFor:B.inputId,id:B.labelId,style:FSe},s),pC(e,_=>C.createElement(d0u.Provider,{value:A},C.createElement(c0u.Provider,{value:B},_))))}),lSe=C.forwardRef((e,u)=>{var a,t;let n=kt(),r=C.useRef(null),i=C.useContext(D0u),o=Om(),s=m0u(e),l=(t=(a=s.current)==null?void 0:a.forceMount)!=null?t:i==null?void 0:i.forceMount;eE(()=>{if(!l)return o.item(n,i==null?void 0:i.id)},[l]);let E=x0u(n,r,[e.value,e.children,r],e.keywords),c=cz(),D=k1(v=>v.value&&v.value===E.current),h=k1(v=>l||o.filter()===!1?!0:v.search?v.filtered.items.get(n)>0:!0);C.useEffect(()=>{let v=r.current;if(!(!v||e.disabled))return v.addEventListener(wb,m),()=>v.removeEventListener(wb,m)},[h,e.onSelect,e.disabled]);function m(){var v,A;x(),(A=(v=s.current).onSelect)==null||A.call(v,E.current)}function x(){c.setState("value",E.current,!0)}if(!h)return null;let{disabled:p,value:f,onSelect:g,forceMount:F,keywords:b,...y}=e;return C.createElement(se.div,{ref:Hs(r,u),...y,id:n,"cmdk-item":"",role:"option","aria-disabled":!!p,"aria-selected":!!D,"data-disabled":!!p,"data-selected":!!D,onPointerMove:p||o.getDisablePointerSelection()?void 0:x,onClick:p?void 0:m},e.children)}),ESe=C.forwardRef((e,u)=>{let{heading:a,children:t,forceMount:n,...r}=e,i=kt(),o=C.useRef(null),s=C.useRef(null),l=kt(),E=Om(),c=k1(h=>n||E.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);eE(()=>E.group(i),[]),x0u(i,o,[e.value,e.heading,s]);let D=C.useMemo(()=>({id:i,forceMount:n}),[n]);return C.createElement(se.div,{ref:Hs(o,u),...r,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},a&&C.createElement("div",{ref:s,"cmdk-group-heading":"","aria-hidden":!0,id:l},a),pC(e,h=>C.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?l:void 0},C.createElement(D0u.Provider,{value:D},h))))}),cSe=C.forwardRef((e,u)=>{let{alwaysRender:a,...t}=e,n=C.useRef(null),r=k1(i=>!i.search);return!a&&!r?null:C.createElement(se.div,{ref:Hs(n,u),...t,"cmdk-separator":"",role:"separator"})}),dSe=C.forwardRef((e,u)=>{let{onValueChange:a,...t}=e,n=e.value!=null,r=cz(),i=k1(l=>l.search),o=k1(l=>l.selectedItemId),s=Om();return C.useEffect(()=>{e.value!=null&&r.setState("search",e.value)},[e.value]),C.createElement(se.input,{ref:u,...t,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":s.listId,"aria-labelledby":s.labelId,"aria-activedescendant":o,id:s.inputId,type:"text",value:n?e.value:i,onChange:l=>{n||r.setState("search",l.target.value),a==null||a(l.target.value)}})}),DSe=C.forwardRef((e,u)=>{let{children:a,label:t="Suggestions",...n}=e,r=C.useRef(null),i=C.useRef(null),o=k1(l=>l.selectedItemId),s=Om();return C.useEffect(()=>{if(i.current&&r.current){let l=i.current,E=r.current,c,D=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let h=l.offsetHeight;E.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return D.observe(l),()=>{cancelAnimationFrame(c),D.unobserve(l)}}},[]),C.createElement(se.div,{ref:Hs(r,u),...n,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":t,id:s.listId},pC(e,l=>C.createElement("div",{ref:Hs(i,s.listInnerRef),"cmdk-list-sizer":""},l)))}),hSe=C.forwardRef((e,u)=>{let{open:a,onOpenChange:t,overlayClassName:n,contentClassName:r,container:i,...o}=e;return C.createElement(r2,{open:a,onOpenChange:t},C.createElement(i2,{container:i},C.createElement(dd,{"cmdk-overlay":"",className:n}),C.createElement(Dd,{"aria-label":e.label,"cmdk-dialog":"",className:r},C.createElement(h0u,{ref:u,...o}))))}),mSe=C.forwardRef((e,u)=>k1(a=>a.filtered.count===0)?C.createElement(se.div,{ref:u,...e,"cmdk-empty":"",role:"presentation"}):null),xSe=C.forwardRef((e,u)=>{let{progress:a,children:t,label:n="Loading...",...r}=e;return C.createElement(se.div,{ref:u,...r,"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":n},pC(e,i=>C.createElement("div",{"aria-hidden":!0},i)))}),ir=Object.assign(h0u,{List:DSe,Item:lSe,Input:dSe,Group:ESe,Separator:cSe,Dialog:hSe,Empty:mSe,Loading:xSe});function fSe(e,u){let a=e.nextElementSibling;for(;a;){if(a.matches(u))return a;a=a.nextElementSibling}}function pSe(e,u){let a=e.previousElementSibling;for(;a;){if(a.matches(u))return a;a=a.previousElementSibling}}function m0u(e){let u=C.useRef(e);return eE(()=>{u.current=e}),u}var eE=typeof window>"u"?C.useEffect:C.useLayoutEffect;function tc(e){let u=C.useRef();return u.current===void 0&&(u.current=e()),u}function k1(e){let u=cz(),a=()=>e(u.snapshot());return C.useSyncExternalStore(u.subscribe,a,a)}function x0u(e,u,a,t=[]){let n=C.useRef(),r=Om();return eE(()=>{var i;let o=(()=>{var l;for(let E of a){if(typeof E=="string")return E.trim();if(typeof E=="object"&&"current"in E)return E.current?(l=E.current.textContent)==null?void 0:l.trim():n.current}})(),s=t.map(l=>l.trim());r.value(e,o,s),(i=u.current)==null||i.setAttribute(ac,o),n.current=o}),n}var gSe=()=>{let[e,u]=C.useState(),a=tc(()=>new Map);return eE(()=>{a.current.forEach(t=>t()),a.current=new Map},[e]),(t,n)=>{a.current.set(t,n),u({})}};function CSe(e){let u=e.type;return typeof u=="function"?u(e.props):"render"in u?u.render(e.props):e}function pC({asChild:e,children:u},a){return e&&C.isValidElement(u)?C.cloneElement(CSe(u),{ref:u.ref},a(u.props.children)):a(u)}var FSe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const wm=C.forwardRef(({className:e,...u},a)=>d.jsx(ir,{ref:a,className:lu("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...u}));wm.displayName=ir.displayName;const kSe=({children:e,trigger:u,commandProps:a,dialogContentProps:t,...n})=>{const{className:r,...i}=t||{};return d.jsxs(bE,{...n,children:[u?d.jsx(yE,{asChild:!0,children:u}):null,d.jsxs(_1,{className:lu("overflow-hidden p-0",r),...i,onCloseAutoFocus:o=>{o.preventDefault()},children:[d.jsx(v8,{children:d.jsxs(I1,{children:[d.jsx(K1,{children:"Command dialog"}),d.jsx($1,{children:"Use the arrow keys to navigate, and press enter to select an item."})]})}),d.jsx(wm,{className:"[&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",...a,children:e})]})]})},gC=C.forwardRef(({className:e,Icon:u,...a},t)=>{const n=u||sd;return d.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[d.jsx(n,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),d.jsx(ir.Input,{ref:t,className:lu("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...a})]})});gC.displayName=ir.Input.displayName;const j4=C.forwardRef(({className:e,...u},a)=>d.jsx(ir.List,{ref:a,className:lu("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...u}));j4.displayName=ir.List.displayName;const t1=C.forwardRef((e,u)=>d.jsx(ir.Empty,{ref:u,className:"py-6 text-center text-sm",...e}));t1.displayName=ir.Empty.displayName;const fh=C.forwardRef(({className:e,...u},a)=>d.jsx(ir.Group,{ref:a,className:lu("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...u}));fh.displayName=ir.Group.displayName;const dz=C.forwardRef(({className:e,...u},a)=>d.jsx(ir.Separator,{ref:a,className:lu("bg-border -mx-1 h-px",e),...u}));dz.displayName=ir.Separator.displayName;const Ps=C.forwardRef(({className:e,...u},a)=>d.jsx(ir.Item,{ref:a,className:lu("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...u}));Ps.displayName=ir.Item.displayName;function Xs(e){return Array.isArray?Array.isArray(e):g0u(e)==="[object Array]"}const vSe=1/0;function ASe(e){if(typeof e=="string")return e;let u=e+"";return u=="0"&&1/e==-vSe?"-0":u}function bSe(e){return e==null?"":ASe(e)}function _o(e){return typeof e=="string"}function f0u(e){return typeof e=="number"}function ySe(e){return e===!0||e===!1||BSe(e)&&g0u(e)=="[object Boolean]"}function p0u(e){return typeof e=="object"}function BSe(e){return p0u(e)&&e!==null}function xr(e){return e!=null}function cv(e){return!e.trim().length}function g0u(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const SSe="Incorrect 'index' type",zSe=e=>`Invalid value for key ${e}`,OSe=e=>`Pattern length exceeds max of ${e}.`,wSe=e=>`Missing ${e} property in key`,MSe=e=>`Property 'weight' in key '${e}' must be a positive integer`,Aj=Object.prototype.hasOwnProperty;class TSe{constructor(u){this._keys=[],this._keyMap={};let a=0;u.forEach(t=>{let n=C0u(t);this._keys.push(n),this._keyMap[n.id]=n,a+=n.weight}),this._keys.forEach(t=>{t.weight/=a})}get(u){return this._keyMap[u]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function C0u(e){let u=null,a=null,t=null,n=1,r=null;if(_o(e)||Xs(e))t=e,u=bj(e),a=Mb(e);else{if(!Aj.call(e,"name"))throw new Error(wSe("name"));const i=e.name;if(t=i,Aj.call(e,"weight")&&(n=e.weight,n<=0))throw new Error(MSe(i));u=bj(i),a=Mb(i),r=e.getFn}return{path:u,id:a,weight:n,src:t,getFn:r}}function bj(e){return Xs(e)?e:e.split(".")}function Mb(e){return Xs(e)?e.join("."):e}function PSe(e,u){let a=[],t=!1;const n=(r,i,o)=>{if(xr(r))if(!i[o])a.push(r);else{let s=i[o];const l=r[s];if(!xr(l))return;if(o===i.length-1&&(_o(l)||f0u(l)||ySe(l)))a.push(bSe(l));else if(Xs(l)){t=!0;for(let E=0,c=l.length;E<c;E+=1)n(l[E],i,o+1)}else i.length&&n(l,i,o+1)}};return n(e,_o(u)?u.split("."):u,0),t?a:a[0]}const jSe={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},NSe={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,u)=>e.score===u.score?e.idx<u.idx?-1:1:e.score<u.score?-1:1},RSe={location:0,threshold:.6,distance:100},LSe={useExtendedSearch:!1,getFn:PSe,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var _e={...NSe,...jSe,...RSe,...LSe};const _Se=/[^ ]+/g;function ISe(e=1,u=3){const a=new Map,t=Math.pow(10,u);return{get(n){const r=n.match(_Se).length;if(a.has(r))return a.get(r);const i=1/Math.pow(r,.5*e),o=parseFloat(Math.round(i*t)/t);return a.set(r,o),o},clear(){a.clear()}}}class Dz{constructor({getFn:u=_e.getFn,fieldNormWeight:a=_e.fieldNormWeight}={}){this.norm=ISe(a,3),this.getFn=u,this.isCreated=!1,this.setIndexRecords()}setSources(u=[]){this.docs=u}setIndexRecords(u=[]){this.records=u}setKeys(u=[]){this.keys=u,this._keysMap={},u.forEach((a,t)=>{this._keysMap[a.id]=t})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,_o(this.docs[0])?this.docs.forEach((u,a)=>{this._addString(u,a)}):this.docs.forEach((u,a)=>{this._addObject(u,a)}),this.norm.clear())}add(u){const a=this.size();_o(u)?this._addString(u,a):this._addObject(u,a)}removeAt(u){this.records.splice(u,1);for(let a=u,t=this.size();a<t;a+=1)this.records[a].i-=1}getValueForItemAtKeyId(u,a){return u[this._keysMap[a]]}size(){return this.records.length}_addString(u,a){if(!xr(u)||cv(u))return;let t={v:u,i:a,n:this.norm.get(u)};this.records.push(t)}_addObject(u,a){let t={i:a,$:{}};this.keys.forEach((n,r)=>{let i=n.getFn?n.getFn(u):this.getFn(u,n.path);if(xr(i)){if(Xs(i)){let o=[];const s=[{nestedArrIndex:-1,value:i}];for(;s.length;){const{nestedArrIndex:l,value:E}=s.pop();if(xr(E))if(_o(E)&&!cv(E)){let c={v:E,i:l,n:this.norm.get(E)};o.push(c)}else Xs(E)&&E.forEach((c,D)=>{s.push({nestedArrIndex:D,value:c})})}t.$[r]=o}else if(_o(i)&&!cv(i)){let o={v:i,n:this.norm.get(i)};t.$[r]=o}}}),this.records.push(t)}toJSON(){return{keys:this.keys,records:this.records}}}function F0u(e,u,{getFn:a=_e.getFn,fieldNormWeight:t=_e.fieldNormWeight}={}){const n=new Dz({getFn:a,fieldNormWeight:t});return n.setKeys(e.map(C0u)),n.setSources(u),n.create(),n}function KSe(e,{getFn:u=_e.getFn,fieldNormWeight:a=_e.fieldNormWeight}={}){const{keys:t,records:n}=e,r=new Dz({getFn:u,fieldNormWeight:a});return r.setKeys(t),r.setIndexRecords(n),r}function Px(e,{errors:u=0,currentLocation:a=0,expectedLocation:t=0,distance:n=_e.distance,ignoreLocation:r=_e.ignoreLocation}={}){const i=u/e.length;if(r)return i;const o=Math.abs(t-a);return n?i+o/n:o?1:i}function $Se(e=[],u=_e.minMatchCharLength){let a=[],t=-1,n=-1,r=0;for(let i=e.length;r<i;r+=1){let o=e[r];o&&t===-1?t=r:!o&&t!==-1&&(n=r-1,n-t+1>=u&&a.push([t,n]),t=-1)}return e[r-1]&&r-t>=u&&a.push([t,r-1]),a}const d4=32;function VSe(e,u,a,{location:t=_e.location,distance:n=_e.distance,threshold:r=_e.threshold,findAllMatches:i=_e.findAllMatches,minMatchCharLength:o=_e.minMatchCharLength,includeMatches:s=_e.includeMatches,ignoreLocation:l=_e.ignoreLocation}={}){if(u.length>d4)throw new Error(OSe(d4));const E=u.length,c=e.length,D=Math.max(0,Math.min(t,c));let h=r,m=D;const x=o>1||s,p=x?Array(c):[];let f;for(;(f=e.indexOf(u,m))>-1;){let A=Px(u,{currentLocation:f,expectedLocation:D,distance:n,ignoreLocation:l});if(h=Math.min(A,h),m=f+E,x){let B=0;for(;B<E;)p[f+B]=1,B+=1}}m=-1;let g=[],F=1,b=E+c;const y=1<<E-1;for(let A=0;A<E;A+=1){let B=0,j=b;for(;B<j;)Px(u,{errors:A,currentLocation:D+j,expectedLocation:D,distance:n,ignoreLocation:l})<=h?B=j:b=j,j=Math.floor((b-B)/2+B);b=j;let R=Math.max(1,D-j+1),w=i?c:Math.min(D+j,c)+E,O=Array(w+2);O[w+1]=(1<<A)-1;for(let z=w;z>=R;z-=1){let N=z-1,M=a[e.charAt(N)];if(x&&(p[N]=+!!M),O[z]=(O[z+1]<<1|1)&M,A&&(O[z]|=(g[z+1]|g[z])<<1|1|g[z+1]),O[z]&y&&(F=Px(u,{errors:A,currentLocation:N,expectedLocation:D,distance:n,ignoreLocation:l}),F<=h)){if(h=F,m=N,m<=D)break;R=Math.max(1,2*D-m)}}if(Px(u,{errors:A+1,currentLocation:D,expectedLocation:D,distance:n,ignoreLocation:l})>h)break;g=O}const v={isMatch:m>=0,score:Math.max(.001,F)};if(x){const A=$Se(p,o);A.length?s&&(v.indices=A):v.isMatch=!1}return v}function HSe(e){let u={};for(let a=0,t=e.length;a<t;a+=1){const n=e.charAt(a);u[n]=(u[n]||0)|1<<t-a-1}return u}const bp=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class k0u{constructor(u,{location:a=_e.location,threshold:t=_e.threshold,distance:n=_e.distance,includeMatches:r=_e.includeMatches,findAllMatches:i=_e.findAllMatches,minMatchCharLength:o=_e.minMatchCharLength,isCaseSensitive:s=_e.isCaseSensitive,ignoreDiacritics:l=_e.ignoreDiacritics,ignoreLocation:E=_e.ignoreLocation}={}){if(this.options={location:a,threshold:t,distance:n,includeMatches:r,findAllMatches:i,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:l,ignoreLocation:E},u=s?u:u.toLowerCase(),u=l?bp(u):u,this.pattern=u,this.chunks=[],!this.pattern.length)return;const c=(h,m)=>{this.chunks.push({pattern:h,alphabet:HSe(h),startIndex:m})},D=this.pattern.length;if(D>d4){let h=0;const m=D%d4,x=D-m;for(;h<x;)c(this.pattern.substr(h,d4),h),h+=d4;if(m){const p=D-d4;c(this.pattern.substr(p),p)}}else c(this.pattern,0)}searchIn(u){const{isCaseSensitive:a,ignoreDiacritics:t,includeMatches:n}=this.options;if(u=a?u:u.toLowerCase(),u=t?bp(u):u,this.pattern===u){let x={isMatch:!0,score:0};return n&&(x.indices=[[0,u.length-1]]),x}const{location:r,distance:i,threshold:o,findAllMatches:s,minMatchCharLength:l,ignoreLocation:E}=this.options;let c=[],D=0,h=!1;this.chunks.forEach(({pattern:x,alphabet:p,startIndex:f})=>{const{isMatch:g,score:F,indices:b}=VSe(u,x,p,{location:r+f,distance:i,threshold:o,findAllMatches:s,minMatchCharLength:l,includeMatches:n,ignoreLocation:E});g&&(h=!0),D+=F,g&&b&&(c=[...c,...b])});let m={isMatch:h,score:h?D/this.chunks.length:1};return h&&n&&(m.indices=c),m}}class G1{constructor(u){this.pattern=u}static isMultiMatch(u){return yj(u,this.multiRegex)}static isSingleMatch(u){return yj(u,this.singleRegex)}search(){}}function yj(e,u){const a=e.match(u);return a?a[1]:null}class GSe extends G1{constructor(u){super(u)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(u){const a=u===this.pattern;return{isMatch:a,score:a?0:1,indices:[0,this.pattern.length-1]}}}class JSe extends G1{constructor(u){super(u)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(u){const t=u.indexOf(this.pattern)===-1;return{isMatch:t,score:t?0:1,indices:[0,u.length-1]}}}class WSe extends G1{constructor(u){super(u)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(u){const a=u.startsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,this.pattern.length-1]}}}class USe extends G1{constructor(u){super(u)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(u){const a=!u.startsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,u.length-1]}}}class ZSe extends G1{constructor(u){super(u)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(u){const a=u.endsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[u.length-this.pattern.length,u.length-1]}}}class QSe extends G1{constructor(u){super(u)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(u){const a=!u.endsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,u.length-1]}}}class v0u extends G1{constructor(u,{location:a=_e.location,threshold:t=_e.threshold,distance:n=_e.distance,includeMatches:r=_e.includeMatches,findAllMatches:i=_e.findAllMatches,minMatchCharLength:o=_e.minMatchCharLength,isCaseSensitive:s=_e.isCaseSensitive,ignoreDiacritics:l=_e.ignoreDiacritics,ignoreLocation:E=_e.ignoreLocation}={}){super(u),this._bitapSearch=new k0u(u,{location:a,threshold:t,distance:n,includeMatches:r,findAllMatches:i,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:l,ignoreLocation:E})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(u){return this._bitapSearch.searchIn(u)}}class A0u extends G1{constructor(u){super(u)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(u){let a=0,t;const n=[],r=this.pattern.length;for(;(t=u.indexOf(this.pattern,a))>-1;)a=t+r,n.push([t,a-1]);const i=!!n.length;return{isMatch:i,score:i?0:1,indices:n}}}const Tb=[GSe,A0u,WSe,USe,QSe,ZSe,JSe,v0u],Bj=Tb.length,qSe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,YSe="|";function XSe(e,u={}){return e.split(YSe).map(a=>{let t=a.trim().split(qSe).filter(r=>r&&!!r.trim()),n=[];for(let r=0,i=t.length;r<i;r+=1){const o=t[r];let s=!1,l=-1;for(;!s&&++l<Bj;){const E=Tb[l];let c=E.isMultiMatch(o);c&&(n.push(new E(c,u)),s=!0)}if(!s)for(l=-1;++l<Bj;){const E=Tb[l];let c=E.isSingleMatch(o);if(c){n.push(new E(c,u));break}}}return n})}const uze=new Set([v0u.type,A0u.type]);class eze{constructor(u,{isCaseSensitive:a=_e.isCaseSensitive,ignoreDiacritics:t=_e.ignoreDiacritics,includeMatches:n=_e.includeMatches,minMatchCharLength:r=_e.minMatchCharLength,ignoreLocation:i=_e.ignoreLocation,findAllMatches:o=_e.findAllMatches,location:s=_e.location,threshold:l=_e.threshold,distance:E=_e.distance}={}){this.query=null,this.options={isCaseSensitive:a,ignoreDiacritics:t,includeMatches:n,minMatchCharLength:r,findAllMatches:o,ignoreLocation:i,location:s,threshold:l,distance:E},u=a?u:u.toLowerCase(),u=t?bp(u):u,this.pattern=u,this.query=XSe(this.pattern,this.options)}static condition(u,a){return a.useExtendedSearch}searchIn(u){const a=this.query;if(!a)return{isMatch:!1,score:1};const{includeMatches:t,isCaseSensitive:n,ignoreDiacritics:r}=this.options;u=n?u:u.toLowerCase(),u=r?bp(u):u;let i=0,o=[],s=0;for(let l=0,E=a.length;l<E;l+=1){const c=a[l];o.length=0,i=0;for(let D=0,h=c.length;D<h;D+=1){const m=c[D],{isMatch:x,indices:p,score:f}=m.search(u);if(x){if(i+=1,s+=f,t){const g=m.constructor.type;uze.has(g)?o=[...o,...p]:o.push(p)}}else{s=0,i=0,o.length=0;break}}if(i){let D={isMatch:!0,score:s/i};return t&&(D.indices=o),D}}return{isMatch:!1,score:1}}}const Pb=[];function aze(...e){Pb.push(...e)}function jb(e,u){for(let a=0,t=Pb.length;a<t;a+=1){let n=Pb[a];if(n.condition(e,u))return new n(e,u)}return new k0u(e,u)}const yp={AND:"$and",OR:"$or"},Nb={PATH:"$path",PATTERN:"$val"},Rb=e=>!!(e[yp.AND]||e[yp.OR]),tze=e=>!!e[Nb.PATH],nze=e=>!Xs(e)&&p0u(e)&&!Rb(e),Sj=e=>({[yp.AND]:Object.keys(e).map(u=>({[u]:e[u]}))});function b0u(e,u,{auto:a=!0}={}){const t=n=>{let r=Object.keys(n);const i=tze(n);if(!i&&r.length>1&&!Rb(n))return t(Sj(n));if(nze(n)){const s=i?n[Nb.PATH]:r[0],l=i?n[Nb.PATTERN]:n[s];if(!_o(l))throw new Error(zSe(s));const E={keyId:Mb(s),pattern:l};return a&&(E.searcher=jb(l,u)),E}let o={children:[],operator:r[0]};return r.forEach(s=>{const l=n[s];Xs(l)&&l.forEach(E=>{o.children.push(t(E))})}),o};return Rb(e)||(e=Sj(e)),t(e)}function rze(e,{ignoreFieldNorm:u=_e.ignoreFieldNorm}){e.forEach(a=>{let t=1;a.matches.forEach(({key:n,norm:r,score:i})=>{const o=n?n.weight:null;t*=Math.pow(i===0&&o?Number.EPSILON:i,(o||1)*(u?1:r))}),a.score=t})}function ize(e,u){const a=e.matches;u.matches=[],xr(a)&&a.forEach(t=>{if(!xr(t.indices)||!t.indices.length)return;const{indices:n,value:r}=t;let i={indices:n,value:r};t.key&&(i.key=t.key.src),t.idx>-1&&(i.refIndex=t.idx),u.matches.push(i)})}function oze(e,u){u.score=e.score}function sze(e,u,{includeMatches:a=_e.includeMatches,includeScore:t=_e.includeScore}={}){const n=[];return a&&n.push(ize),t&&n.push(oze),e.map(r=>{const{idx:i}=r,o={item:u[i],refIndex:i};return n.length&&n.forEach(s=>{s(r,o)}),o})}class J1{constructor(u,a={},t){this.options={..._e,...a},this.options.useExtendedSearch,this._keyStore=new TSe(this.options.keys),this.setCollection(u,t)}setCollection(u,a){if(this._docs=u,a&&!(a instanceof Dz))throw new Error(SSe);this._myIndex=a||F0u(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(u){xr(u)&&(this._docs.push(u),this._myIndex.add(u))}remove(u=()=>!1){const a=[];for(let t=0,n=this._docs.length;t<n;t+=1){const r=this._docs[t];u(r,t)&&(this.removeAt(t),t-=1,n-=1,a.push(r))}return a}removeAt(u){this._docs.splice(u,1),this._myIndex.removeAt(u)}getIndex(){return this._myIndex}search(u,{limit:a=-1}={}){const{includeMatches:t,includeScore:n,shouldSort:r,sortFn:i,ignoreFieldNorm:o}=this.options;let s=_o(u)?_o(this._docs[0])?this._searchStringList(u):this._searchObjectList(u):this._searchLogical(u);return rze(s,{ignoreFieldNorm:o}),r&&s.sort(i),f0u(a)&&a>-1&&(s=s.slice(0,a)),sze(s,this._docs,{includeMatches:t,includeScore:n})}_searchStringList(u){const a=jb(u,this.options),{records:t}=this._myIndex,n=[];return t.forEach(({v:r,i,n:o})=>{if(!xr(r))return;const{isMatch:s,score:l,indices:E}=a.searchIn(r);s&&n.push({item:r,idx:i,matches:[{score:l,value:r,norm:o,indices:E}]})}),n}_searchLogical(u){const a=b0u(u,this.options),t=(o,s,l)=>{if(!o.children){const{keyId:c,searcher:D}=o,h=this._findMatches({key:this._keyStore.get(c),value:this._myIndex.getValueForItemAtKeyId(s,c),searcher:D});return h&&h.length?[{idx:l,item:s,matches:h}]:[]}const E=[];for(let c=0,D=o.children.length;c<D;c+=1){const h=o.children[c],m=t(h,s,l);if(m.length)E.push(...m);else if(o.operator===yp.AND)return[]}return E},n=this._myIndex.records,r={},i=[];return n.forEach(({$:o,i:s})=>{if(xr(o)){let l=t(a,o,s);l.length&&(r[s]||(r[s]={idx:s,item:o,matches:[]},i.push(r[s])),l.forEach(({matches:E})=>{r[s].matches.push(...E)}))}}),i}_searchObjectList(u){const a=jb(u,this.options),{keys:t,records:n}=this._myIndex,r=[];return n.forEach(({$:i,i:o})=>{if(!xr(i))return;let s=[];t.forEach((l,E)=>{s.push(...this._findMatches({key:l,value:i[E],searcher:a}))}),s.length&&r.push({idx:o,item:i,matches:s})}),r}_findMatches({key:u,value:a,searcher:t}){if(!xr(a))return[];let n=[];if(Xs(a))a.forEach(({v:r,i,n:o})=>{if(!xr(r))return;const{isMatch:s,score:l,indices:E}=t.searchIn(r);s&&n.push({score:l,key:u,value:r,idx:i,norm:o,indices:E})});else{const{v:r,n:i}=a,{isMatch:o,score:s,indices:l}=t.searchIn(r);o&&n.push({score:s,key:u,value:r,norm:i,indices:l})}return n}}J1.version="7.1.0";J1.createIndex=F0u;J1.parseIndex=KSe;J1.config=_e;J1.parseQuery=b0u;aze(eze);function y0u(e){const[u,a]=C.useState(""),t=C.useMemo(()=>new J1(e,{keys:[{name:"label",weight:1}],threshold:.4,includeScore:!0,findAllMatches:!0,ignoreLocation:!0,useExtendedSearch:!0,shouldSort:!0,includeMatches:!0,distance:100,ignoreFieldNorm:!1}),[e]),n=C.useMemo(()=>{const r=u.trim().replace(/-/g," ");return r?t.search({label:r}).map(o=>o.item):e},[t,e,u]);return{search:u,setSearch:a,filteredOptions:n}}var CC="Popover",[B0u,Ra0]=Tt(CC,[j1]),Mm=j1(),[lze,W1]=B0u(CC),S0u=e=>{const{__scopePopover:u,children:a,open:t,defaultOpen:n,onOpenChange:r,modal:i=!1}=e,o=Mm(u),s=C.useRef(null),[l,E]=C.useState(!1),[c,D]=hn({prop:t,defaultProp:n??!1,onChange:r,caller:CC});return d.jsx(D2,{...o,children:d.jsx(lze,{scope:u,contentId:kt(),triggerRef:s,open:c,onOpenChange:D,onOpenToggle:C.useCallback(()=>D(h=>!h),[D]),hasCustomAnchor:l,onCustomAnchorAdd:C.useCallback(()=>E(!0),[]),onCustomAnchorRemove:C.useCallback(()=>E(!1),[]),modal:i,children:a})})};S0u.displayName=CC;var z0u="PopoverAnchor",Eze=C.forwardRef((e,u)=>{const{__scopePopover:a,...t}=e,n=W1(z0u,a),r=Mm(a),{onCustomAnchorAdd:i,onCustomAnchorRemove:o}=n;return C.useEffect(()=>(i(),()=>o()),[i,o]),d.jsx(dm,{...r,...t,ref:u})});Eze.displayName=z0u;var O0u="PopoverTrigger",w0u=C.forwardRef((e,u)=>{const{__scopePopover:a,...t}=e,n=W1(O0u,a),r=Mm(a),i=Xe(u,n.triggerRef),o=d.jsx(se.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":N0u(n.open),...t,ref:i,onClick:ju(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?o:d.jsx(dm,{asChild:!0,...r,children:o})});w0u.displayName=O0u;var hz="PopoverPortal",[cze,dze]=B0u(hz,{forceMount:void 0}),M0u=e=>{const{__scopePopover:u,forceMount:a,children:t,container:n}=e,r=W1(hz,u);return d.jsx(cze,{scope:u,forceMount:a,children:d.jsx(fn,{present:a||r.open,children:d.jsx(cd,{asChild:!0,container:n,children:t})})})};M0u.displayName=hz;var N3="PopoverContent",T0u=C.forwardRef((e,u)=>{const a=dze(N3,e.__scopePopover),{forceMount:t=a.forceMount,...n}=e,r=W1(N3,e.__scopePopover);return d.jsx(fn,{present:t||r.open,children:r.modal?d.jsx(hze,{...n,ref:u}):d.jsx(mze,{...n,ref:u})})});T0u.displayName=N3;var Dze=c1("PopoverContent.RemoveScroll"),hze=C.forwardRef((e,u)=>{const a=W1(N3,e.__scopePopover),t=C.useRef(null),n=Xe(u,t),r=C.useRef(!1);return C.useEffect(()=>{const i=t.current;if(i)return t2(i)},[]),d.jsx(a2,{as:Dze,allowPinchZoom:!0,children:d.jsx(P0u,{...e,ref:n,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ju(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),r.current||(o=a.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ju(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,s=o.button===0&&o.ctrlKey===!0,l=o.button===2||s;r.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:ju(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),mze=C.forwardRef((e,u)=>{const a=W1(N3,e.__scopePopover),t=C.useRef(!1),n=C.useRef(!1);return d.jsx(P0u,{...e,ref:u,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var i,o;(i=e.onCloseAutoFocus)==null||i.call(e,r),r.defaultPrevented||(t.current||(o=a.triggerRef.current)==null||o.focus(),r.preventDefault()),t.current=!1,n.current=!1},onInteractOutside:r=>{var s,l;(s=e.onInteractOutside)==null||s.call(e,r),r.defaultPrevented||(t.current=!0,r.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const i=r.target;((l=a.triggerRef.current)==null?void 0:l.contains(i))&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&n.current&&r.preventDefault()}})}),P0u=C.forwardRef((e,u)=>{const{__scopePopover:a,trapFocus:t,onOpenAutoFocus:n,onCloseAutoFocus:r,disableOutsidePointerEvents:i,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:E,...c}=e,D=W1(N3,a),h=Mm(a);return u2(),d.jsx(sm,{asChild:!0,loop:!0,trapped:t,onMountAutoFocus:n,onUnmountAutoFocus:r,children:d.jsx(Ed,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:E,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:l,onDismiss:()=>D.onOpenChange(!1),children:d.jsx(h2,{"data-state":N0u(D.open),role:"dialog",id:D.contentId,...h,...c,ref:u,style:{...c.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),j0u="PopoverClose",xze=C.forwardRef((e,u)=>{const{__scopePopover:a,...t}=e,n=W1(j0u,a);return d.jsx(se.button,{type:"button",...t,ref:u,onClick:ju(e.onClick,()=>n.onOpenChange(!1))})});xze.displayName=j0u;var fze="PopoverArrow",pze=C.forwardRef((e,u)=>{const{__scopePopover:a,...t}=e,n=Mm(a);return d.jsx(m2,{...n,...t,ref:u})});pze.displayName=fze;function N0u(e){return e?"open":"closed"}var gze=S0u,Cze=w0u,Fze=M0u,R0u=T0u;const ph=gze,gh=Cze,R3=C.forwardRef((e,u)=>d.jsx(Fze,{children:d.jsx(L0u,{ref:u,...e})}));R3.displayName=R0u.displayName;const L0u=C.forwardRef(({className:e,align:u="center",sideOffset:a=4,...t},n)=>d.jsx(R0u,{ref:n,align:u,sideOffset:a,className:lu("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...t}));L0u.displayName="PopoverContentNoPortal";function kze({title:e,options:u,values:a,onValuesChange:t,size:n,isClearable:r=!0}){const i=new Set(a),{search:o,setSearch:s,filteredOptions:l}=y0u(u),E=Math.min(u.reduce((m,x)=>Math.max(m,x.label.length),0),70),c=Math.max(200,E*8+32),D=32,h=Math.min(250,l.length*D);return d.jsxs(ph,{onOpenChange:m=>!m&&s(""),children:[d.jsx(gh,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",size:n,className:"border-dashed",children:[d.jsx(LV,{className:"h-4 w-4"}),e,(i==null?void 0:i.size)>0&&d.jsxs(d.Fragment,{children:[d.jsx(om,{orientation:"vertical",className:"mx-2 h-4"}),d.jsx(Ts,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:i.size}),d.jsx("div",{className:"hidden space-x-1 lg:flex",children:i.size>2?d.jsxs(Ts,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[i.size," selected"]}):u.filter(m=>i.has(m.value)).map(m=>d.jsx(Ts,{variant:"secondary",className:"max-w-[200px] rounded-sm px-1 font-normal",children:d.jsx("span",{className:"truncate",children:m.label})},m.value))})]})]})}),d.jsx(R3,{className:"w-[200px] p-0",align:"start",children:d.jsxs(wm,{shouldFilter:!1,children:[d.jsx(gC,{placeholder:e,value:o,onValueChange:s}),d.jsxs(j4,{children:[d.jsx(t1,{children:"No results found."}),d.jsx(fh,{children:d.jsx(s0u,{width:c,height:h,itemCount:l.length,itemSize:D,children:({index:m,style:x})=>{const p=l[m],f=i.has(p.value);return d.jsxs(Ps,{style:x,onSelect:()=>{const g=i;f?g.delete(p.value):g.add(p.value),t(Array.from(g))},children:[d.jsx("div",{className:lu("border-primary flex h-4 w-4 items-center justify-center rounded-sm border",f?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:d.jsx(d1,{className:lu("h-4 w-4")})}),d.jsx("span",{className:"flex-1 truncate",children:p.label})]},p.value)}})}),r&&i.size>0&&d.jsxs(d.Fragment,{children:[d.jsx(dz,{}),d.jsx(fh,{children:d.jsx(Ps,{onSelect:()=>t([]),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function vze({title:e,options:u,value:a,onValueChange:t,size:n,className:r,isClearable:i=!0}){const{search:o,setSearch:s,filteredOptions:l}=y0u(u),E=Math.min(u.reduce((m,x)=>Math.max(m,x.label.length),0),70),c=Math.max(200,E*8+32),D=32,h=Math.min(250,l.length*D);return d.jsxs(ph,{onOpenChange:m=>!m&&s(""),children:[d.jsx(gh,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",size:n,className:lu("border-dashed",r),children:[d.jsx(LV,{className:"h-4 w-4"}),e,a!==void 0&&d.jsxs(d.Fragment,{children:[d.jsx(om,{orientation:"vertical",className:"mx-2 h-4"}),d.jsx("div",{className:"space-x-1 lg:flex",children:u.filter(m=>a===m.value).map(m=>d.jsx(Ts,{variant:"secondary",className:"max-w-[200px] rounded-sm px-1 font-normal",children:d.jsx("span",{className:"truncate",children:m.label})},m.value))})]})]})}),d.jsx(R3,{className:"w-fit p-0",align:"start",children:d.jsxs(wm,{shouldFilter:!1,children:[d.jsx(gC,{placeholder:e,value:o,onValueChange:s}),d.jsxs(j4,{children:[d.jsx(t1,{children:"No results found."}),d.jsx(fh,{children:d.jsx(s0u,{width:c,height:h,itemCount:l.length,itemSize:D,children:({index:m,style:x})=>{const p=l[m],f=a===p.value;return d.jsxs(Ps,{style:x,onSelect:()=>{t(f?void 0:p.value)},children:[d.jsx("div",{className:lu("border-primary over nowrap flex h-4 w-4 items-center justify-center overflow-hidden rounded-sm border",f?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:d.jsx(d1,{className:lu("h-4 w-4")})}),d.jsx("span",{className:"flex-1 truncate",children:p.label})]},p.value)}})}),i&&a!==void 0&&d.jsxs(d.Fragment,{children:[d.jsx(dz,{}),d.jsx(fh,{children:d.jsx(Ps,{onSelect:()=>t(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function nc({column:e,title:u,options:a,isMulti:t,isClearable:n}){const r=(e==null?void 0:e.getFilterValue())??[];return t?d.jsx(kze,{title:u,options:a,isClearable:n,values:r,onValuesChange:i=>e==null?void 0:e.setFilterValue(i),size:"sm"}):d.jsx(vze,{title:u,isClearable:n,options:a,value:r.length>0?r[0]:void 0,onValueChange:i=>e==null?void 0:e.setFilterValue(i?[i]:void 0),size:"sm"})}function Aze({table:e,filterFields:u=[]}){const a=e.getState().columnFilters.length>0,{searchableColumns:t,filterableColumns:n}=C.useMemo(()=>({searchableColumns:u.filter(r=>!r.options),filterableColumns:u.filter(r=>r.options)}),[u]);return d.jsx("div",{className:"flex max-w-full items-center justify-between",children:d.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[t.length>0&&t.map(r=>{var i;return e.getColumn(r.value?String(r.value):"")&&d.jsx(SE,{placeholder:r.placeholder,value:((i=e.getColumn(String(r.value)))==null?void 0:i.getFilterValue())??"",onChange:o=>{var s;(s=e.getColumn(String(r.value)))==null||s.setFilterValue(o)},className:"h-8 w-40 lg:w-64"},String(r.value))}),n.length>0&&n.map(r=>e.getColumn(r.value?String(r.value):"")&&d.jsx(nc,{column:e.getColumn(r.value?String(r.value):""),title:r.label,options:r.options??[],isMulti:r.isMulti},String(r.value))),a&&d.jsxs(Ve,{"aria-label":"Reset filters",variant:"ghost",className:"h-8 px-2 lg:px-3",onClick:()=>e.resetColumnFilters(),children:["Reset",d.jsx(FE,{className:"size-4","aria-hidden":"true"})]})]})})}const mz=e=>ns("/api/entities",e),FC=async()=>{await a8("/api/entities")},bze=({currentName:e,onSave:u,placeholder:a="Test title",key:t})=>{const[n,r]=C.useState(e);C.useEffect(()=>{r(e)},[e]);const i=async()=>{const o=n.trim();if(o!==e){if(!o){Ca.error("Name cannot be empty."),r(e);return}try{YZ(o)}catch(s){Ca.error("Invalid name.",{description:s.message}),r(e);return}try{await u(o)}catch(s){Ca.error("Failed to save name.",{description:`${s}`}),r(e)}}};return d.jsx(SE,{className:"text-foreground hover:bg-muted focus:border-input w-[95%] -translate-x-1 border-none bg-transparent p-0 px-1 text-lg font-semibold shadow-none transition-colors duration-100 focus-visible:bg-transparent",placeholder:a,value:n,onChange:o=>r(o),onBlur:i},t)};var kC="Switch",[yze,La0]=Tt(kC),[Bze,Sze]=yze(kC),_0u=C.forwardRef((e,u)=>{const{__scopeSwitch:a,name:t,checked:n,defaultChecked:r,required:i,disabled:o,value:s="on",onCheckedChange:l,form:E,...c}=e,[D,h]=C.useState(null),m=Xe(u,F=>h(F)),x=C.useRef(!1),p=D?E||!!D.closest("form"):!0,[f,g]=hn({prop:n,defaultProp:r??!1,onChange:l,caller:kC});return d.jsxs(Bze,{scope:a,checked:f,disabled:o,children:[d.jsx(se.button,{type:"button",role:"switch","aria-checked":f,"aria-required":i,"data-state":V0u(f),"data-disabled":o?"":void 0,disabled:o,value:s,...c,ref:m,onClick:ju(e.onClick,F=>{g(b=>!b),p&&(x.current=F.isPropagationStopped(),x.current||F.stopPropagation())})}),p&&d.jsx($0u,{control:D,bubbles:!x.current,name:t,value:s,checked:f,required:i,disabled:o,form:E,style:{transform:"translateX(-100%)"}})]})});_0u.displayName=kC;var I0u="SwitchThumb",K0u=C.forwardRef((e,u)=>{const{__scopeSwitch:a,...t}=e,n=Sze(I0u,a);return d.jsx(se.span,{"data-state":V0u(n.checked),"data-disabled":n.disabled?"":void 0,...t,ref:u})});K0u.displayName=I0u;var zze="SwitchBubbleInput",$0u=C.forwardRef(({__scopeSwitch:e,control:u,checked:a,bubbles:t=!0,...n},r)=>{const i=C.useRef(null),o=Xe(i,r),s=C2(a),l=d2(u);return C.useEffect(()=>{const E=i.current;if(!E)return;const c=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==a&&h){const m=new Event("click",{bubbles:t});h.call(E,a),E.dispatchEvent(m)}},[s,a,t]),d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...n,tabIndex:-1,ref:o,style:{...n.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});$0u.displayName=zze;function V0u(e){return e?"checked":"unchecked"}var H0u=_0u,Oze=K0u;const Ch=C.forwardRef(({className:e,...u},a)=>d.jsx(H0u,{className:lu("focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-primary data-[state=unchecked]:bg-input peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...u,ref:a,children:d.jsx(Oze,{className:lu("bg-background pointer-events-none block h-4 w-4 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ch.displayName=H0u.displayName;var vC="Tabs",[wze,_a0]=Tt(vC,[L1]),G0u=L1(),[Mze,xz]=wze(vC),J0u=C.forwardRef((e,u)=>{const{__scopeTabs:a,value:t,onValueChange:n,defaultValue:r,orientation:i="horizontal",dir:o,activationMode:s="automatic",...l}=e,E=xd(o),[c,D]=hn({prop:t,onChange:n,defaultProp:r??"",caller:vC});return d.jsx(Mze,{scope:a,baseId:kt(),value:c,onValueChange:D,orientation:i,dir:E,activationMode:s,children:d.jsx(se.div,{dir:E,"data-orientation":i,...l,ref:u})})});J0u.displayName=vC;var W0u="TabsList",U0u=C.forwardRef((e,u)=>{const{__scopeTabs:a,loop:t=!0,...n}=e,r=xz(W0u,a),i=G0u(a);return d.jsx(A2,{asChild:!0,...i,orientation:r.orientation,dir:r.dir,loop:t,children:d.jsx(se.div,{role:"tablist","aria-orientation":r.orientation,...n,ref:u})})});U0u.displayName=W0u;var Z0u="TabsTrigger",Q0u=C.forwardRef((e,u)=>{const{__scopeTabs:a,value:t,disabled:n=!1,...r}=e,i=xz(Z0u,a),o=G0u(a),s=X0u(i.baseId,t),l=uau(i.baseId,t),E=t===i.value;return d.jsx(b2,{asChild:!0,...o,focusable:!n,active:E,children:d.jsx(se.button,{type:"button",role:"tab","aria-selected":E,"aria-controls":l,"data-state":E?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:s,...r,ref:u,onMouseDown:ju(e.onMouseDown,c=>{!n&&c.button===0&&c.ctrlKey===!1?i.onValueChange(t):c.preventDefault()}),onKeyDown:ju(e.onKeyDown,c=>{[" ","Enter"].includes(c.key)&&i.onValueChange(t)}),onFocus:ju(e.onFocus,()=>{const c=i.activationMode!=="manual";!E&&!n&&c&&i.onValueChange(t)})})})});Q0u.displayName=Z0u;var q0u="TabsContent",Y0u=C.forwardRef((e,u)=>{const{__scopeTabs:a,value:t,forceMount:n,children:r,...i}=e,o=xz(q0u,a),s=X0u(o.baseId,t),l=uau(o.baseId,t),E=t===o.value,c=C.useRef(E);return C.useEffect(()=>{const D=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(D)},[]),d.jsx(fn,{present:n||E,children:({present:D})=>d.jsx(se.div,{"data-state":E?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":s,hidden:!D,id:l,tabIndex:0,...i,ref:u,style:{...e.style,animationDuration:c.current?"0s":void 0},children:D&&r})})});Y0u.displayName=q0u;function X0u(e,u){return`${e}-trigger-${u}`}function uau(e,u){return`${e}-content-${u}`}var Tze=J0u,eau=U0u,aau=Q0u,tau=Y0u;const Tm=Tze,Od=C.forwardRef(({className:e,...u},a)=>d.jsx(eau,{ref:a,className:lu("bg-muted text-muted-foreground inline-flex h-9 items-center justify-center rounded-lg p-1",e),...u}));Od.displayName=eau.displayName;const On=C.forwardRef(({className:e,...u},a)=>d.jsx(aau,{ref:a,className:lu("ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow",e),...u}));On.displayName=aau.displayName;const wn=C.forwardRef(({className:e,...u},a)=>d.jsx(tau,{ref:a,className:lu("ring-offset-background focus-visible:ring-ring mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",e),...u}));wn.displayName=tau.displayName;const Pm=(e,u)=>ns(`/api/mobile-tests/${encodeURIComponent(e)}`,u),Pze=({test:e,labels:u})=>d.jsxs("div",{children:[d.jsxs("div",{className:"flex flex-col space-y-2 text-center sm:text-left",children:[d.jsx(jze,{metadata:e}),d.jsx("div",{className:"text-muted-foreground text-sm",children:e.relativePathSegments.slice(0,-1).join(e.platformSep)})]}),d.jsx("div",{className:"h-full py-4",children:d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex gap-2",children:d.jsx(Ve,{asChild:!0,children:d.jsxs(uo,{to:`/tests/${e.relativePath}`,children:[d.jsx(IV,{className:"h-4 w-4"}),"Edit"]})})}),d.jsxs(Tm,{defaultValue:"overview",children:[d.jsxs(Od,{children:[d.jsx(On,{value:"overview",children:"Overview"}),d.jsx(On,{value:"description",children:"Description"})]}),d.jsx(wn,{value:"overview",children:d.jsx(Nze,{metadata:e,labels:u})}),d.jsx(wn,{value:"description",children:d.jsx(Rze,{metadata:e})})]})]})})]}),jze=({metadata:e})=>{const u=Ci(),{data:a}=Pm(e.relativePath),t=e.name.replace(/\.test\.yaml$/,""),n=async i=>{const o={name:i.name??e.name,description:(a==null?void 0:a.description)??e.description??""};await u(`/api/mobile-tests/${encodeURIComponent(e.relativePath)}/metadata`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})},r=async i=>{await n({name:i}),await km(e.relativePathSegments.slice(0,-1)),FC().catch(o=>{Ca.error("Failed to revalidate entities.",{description:`${o}`})})};return d.jsx(bze,{currentName:t,onSave:r,placeholder:"Test title"},e.id)},Nze=({metadata:e})=>{var r,i,o,s,l;const u=Ci(),{data:a,mutate:t}=Pm(e.relativePath),n=async E=>{const c={disabled:E.disabled};try{await u(`/api/mobile-tests/${encodeURIComponent(e.relativePath)}/metadata`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}),await FC()}catch(D){Ca.error("Failed to save test.",{description:`${D}`})}};return a?d.jsxs("div",{className:"grid gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Created"}),d.jsx("div",{children:e.createdAt.toLocaleString()})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Last updated"}),d.jsx("div",{children:e.lastModified.toLocaleString()})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Labels"}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[(r=e.labels)==null?void 0:r.map(E=>d.jsx(Ts,{variant:"outline",children:E},E)),!e.labels||e.labels.length===0?d.jsx("div",{className:"text-muted-foreground text-sm",children:"No labels"}):null]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Disabled"}),d.jsx("div",{children:d.jsx(Ch,{checked:(a==null?void 0:a.disabled)??!1,onCheckedChange:async E=>{t({...a,disabled:E});try{await n({disabled:E})}catch{t({...a,disabled:!E})}}})})]}),((i=a.settings)==null?void 0:i.retries)!==void 0&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Retries"}),d.jsx("div",{children:a.settings.retries})]}),((o=a.settings)==null?void 0:o.defaultChannel)&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Default channel"}),d.jsx("div",{children:a.settings.defaultChannel})]}),((s=a.settings)==null?void 0:s.defaultTag)&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Default tag"}),d.jsx("div",{children:a.settings.defaultTag})]}),((l=a.settings)==null?void 0:l.defaultEnv)&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Default environment"}),d.jsx("div",{children:a.settings.defaultEnv})]})]}):null},Rze=({metadata:e})=>{const u=Ci(),{data:a,mutate:t}=Pm(e.relativePath),n=async i=>{const o={description:i.description??(a==null?void 0:a.description)??e.description??""};try{await u(`/api/mobile-tests/${encodeURIComponent(e.relativePath)}/metadata`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),await FC()}catch(s){Ca.error("Failed to save description.",{description:`${s}`})}},r=async i=>{if(!a)return;const o=i.target.value;if(o!==a.description){if(o.trim().length===0){Ca.error("Description cannot be empty.");return}await n({description:o}),await t({...a,description:o})}};return a?d.jsx(zd,{placeholder:"Example test description",defaultValue:a.description??"",rows:10,onBlur:r},e.id):null},As=e=>e.type==="FOLDER",Bp=e=>e.type==="MODULE",Lze=e=>d.jsxs(Ve,{variant:"outline",size:"sm",className:"absolute right-2 top-1/2 translate-y-[-50%] opacity-0 transition-opacity group-hover:opacity-100",...e,children:[d.jsx(FDu,{className:"size-4"}),"View details"]}),_ze=[{id:"type",meta:{className:"hidden"},accessorFn:e=>e.type,header:({column:e})=>d.jsx(Jn,{column:e,title:"Type"}),cell:({row:e})=>e.original.type,filterFn:"arrIncludesSome"},{id:"name",meta:{className:"w-full"},accessorFn:e=>e.name,header:({column:e})=>d.jsx(Jn,{column:e,title:"Name"}),cell:({row:e,table:u})=>{var a;return As(e.original)?d.jsxs("div",{className:"text-primary flex min-w-0 items-center",children:[d.jsx(t8,{className:"mr-2 size-4 shrink-0 text-slate-600"}),d.jsx("span",{className:"whitespace-nowrap font-medium",children:e.original.name})]}):Bp(e.original)?d.jsx(d.Fragment,{children:d.jsxs("div",{className:"text-primary flex min-w-0 flex-col",children:[d.jsxs("div",{className:"flex items-center",children:[d.jsx(r8,{className:"mr-2 size-4 shrink-0 text-amber-600"}),d.jsx("span",{className:"whitespace-nowrap font-medium",children:e.original.fileName})]}),e.original.description&&d.jsx("div",{className:"text-muted-foreground pl-6",children:e.original.description})]})}):d.jsx(d.Fragment,{children:d.jsxs("div",{className:"text-primary relative flex flex-col",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Z5u,{className:"size-4 shrink-0 text-blue-600"}),d.jsx("span",{className:"max-w-[500px] truncate whitespace-nowrap font-medium",children:e.original.fileName}),(a=e.original.labels)==null?void 0:a.map(t=>d.jsx(Ts,{variant:"outline",className:"whitespace-nowrap",children:t},t))]}),e.original.description&&d.jsx("div",{className:"text-muted-foreground pl-6",children:e.original.description}),d.jsx(Lze,{onClick:t=>{var n,r;t.stopPropagation(),t.preventDefault(),(r=(n=u.options.meta)==null?void 0:n.openDetails)==null||r.call(n,e.original)}})]})})}},{id:"createdAt",accessorFn:e=>{if(!As(e))return e.createdAt},header:({column:e})=>d.jsx(Jn,{column:e,title:"Created at"}),cell:({row:e})=>As(e.original)||!e.original.createdAt?d.jsx("div",{className:"text-muted-foreground",children:V7}):d.jsx("div",{className:"text-muted-foreground",children:d.jsx(up,{date:e.original.createdAt})})},{id:"updateAt",accessorFn:e=>{if(!As(e))return e.updatedAt},header:({column:e})=>d.jsx(Jn,{column:e,title:"Last updated at"}),cell:({row:e})=>As(e.original)||!e.original.updatedAt?d.jsx("div",{className:"text-muted-foreground",children:V7}):d.jsx("div",{className:"text-muted-foreground",children:d.jsx(up,{date:e.original.updatedAt})})},{id:"actions",meta:{className:"min-w-[100px]"},header:()=>null,cell:({row:e})=>As(e.original)||Bp(e.original)?null:d.jsx("div",{className:"flex justify-end gap-2",children:d.jsxs("div",{className:"flex gap-2 opacity-0 transition-opacity group-hover:opacity-100",children:[d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Ve,{variant:"ghost",size:"smIcon",className:"text-muted-foreground",children:d.jsx(IV,{className:"h-4 w-4"})})}),d.jsx(n0,{children:"Edit"})]}),d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Ve,{variant:"ghost",size:"smIcon",className:"text-muted-foreground",onClick:u=>{u.stopPropagation(),u.preventDefault(),navigator.clipboard.writeText(I7u(e.original.name)),Ca.success("Copied to clipboard!")},children:d.jsx(X5u,{className:"h-4 w-4"})})}),d.jsx(n0,{children:"Copy path"})]})]})}),enableSorting:!1}];function Ize({data:e,openDetails:u}){const[a,t]=C.useState({}),[n,r]=C.useState({}),[i,o]=C.useState([]),[s,l]=C.useState([{id:"name",desc:!1}]);return{table:T8({data:e,columns:_ze,state:{sorting:s,columnVisibility:n,rowSelection:a,columnFilters:i,rowPinning:{top:e.filter(As).map(c=>c.relativePath),bottom:e.filter(Bp).map(c=>c.relativePath)}},initialState:{pagination:{pageSize:e.length,pageIndex:0}},meta:{openDetails:u},keepPinnedRows:!1,enableRowSelection:!1,enableRowPinning:!0,onRowSelectionChange:t,onSortingChange:l,onColumnFiltersChange:o,onColumnVisibilityChange:r,getCoreRowModel:w8(),getFilteredRowModel:HG(),getSortedRowModel:M8(),getFacetedRowModel:$G(),getFacetedUniqueValues:VG(),getRowId:c=>c.relativePath})}}const Kze=[{label:"Type",value:"type",isMulti:!0,options:[{label:"Test",value:"TEST"},{label:"Module",value:"MODULE"},{label:"Folder",value:"FOLDER"}]}];function nau({testMetadatas:e,moduleMetadatas:u,folderMetadatas:a,pathSegments:t,showAllFlattened:n}){const{data:r}=mz(),i=il(),o=C.useMemo(()=>{const D=OP(e.map(x=>{const p=r==null?void 0:r.tests.find(f=>f.relativePath===x.relativePath);if(p)return{type:"TEST",name:p.name,relativePath:p.relativePath,fileName:p.fileName,pathSegments:x.pathSegments,id:p.id,description:p.description,createdAt:p.createdAt,updatedAt:p.lastModified,labels:p.labels}})),h=OP(u.map(x=>{const p=r==null?void 0:r.modules.find(f=>f.relativePath===x.relativePath);if(p)return{type:"MODULE",name:p.name,id:p.id,relativePath:p.relativePath,fileName:p.fileName,description:p.description,createdAt:p.createdAt,updatedAt:p.lastModified}}));return n?[...D,...h]:[...a.map(x=>({type:"FOLDER",name:x.name,relativePath:x.relativePath,pathSegments:x.pathSegments})),...D,...h]},[r==null?void 0:r.modules,r==null?void 0:r.tests,a,u,n,e]),{table:s}=Ize({data:o,openDetails:D=>{As(D)||E(D)}}),[l,E]=C.useState(null),c=C.useMemo(()=>!l||l.type!=="TEST"?null:r==null?void 0:r.tests.find(D=>D.id===l.id),[l,r==null?void 0:r.tests]);return C.useMemo(()=>!l||l.type!=="MODULE"?null:r==null?void 0:r.modules.find(D=>D.fileName===l.fileName),[l,r==null?void 0:r.modules]),C.useEffect(()=>{E(null)},[i.pathname]),d.jsxs("div",{className:"w-full",children:[d.jsx(OJ,{table:s,hidePagination:!0,RowComponent:({row:D,children:h,...m})=>{const x=D.original;if(As(x)){const g=`/browse/${[...t||[],x.name].join("/")}`;return d.jsx(tb,{...m,asChild:!0,children:d.jsx(uo,{to:g,children:h})})}if(Bp(x))return d.jsx(Xl,{...m,onClick:()=>{E(x)},children:h});const p=`/tests/${x.relativePath}`;return d.jsx(tb,{...m,asChild:!0,className:"group",children:d.jsx(uo,{to:p,children:h})})},children:d.jsx(Aze,{table:s,filterFields:Kze})}),c&&d.jsxs("div",{className:"bg-background fixed bottom-0 right-0 top-0 z-50 w-[600px] overflow-auto border-l p-6",children:[d.jsx("button",{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none",onClick:()=>{E(null)},children:d.jsx(FE,{className:"h-4 w-4"})}),d.jsx(Pze,{test:c,labels:(r==null?void 0:r.labels)||[]})]})]})}function $ze(){const{"*":e=""}=cV(),{hasCustomRoot:u,rootPathSegments:a}=ZU(),t=e.split("/").filter(Boolean),{data:n}=nS(t.length?t:["."]);if(t.length===0&&u)return d.jsx(xV,{to:`/browse/${a.join("/")}`,replace:!0});const r=n==null?void 0:n.contents.filter(c=>c.isDirectory),i=n==null?void 0:n.contents.filter(c=>c.name.endsWith(".test.yaml")),o=n==null?void 0:n.contents.filter(c=>c.name.endsWith(".module.yaml")),s=[],l=u?t.slice(a.length):t;for(let c=0;c<l.length-1;c++){const D=t.slice(0,a.length+c+1);s.push(d.jsx(Ro,{children:d.jsx(QD,{asChild:!0,children:d.jsx(uo,{to:`/browse/${D.join("/")}`,children:l[c]})})},c)),s.push(d.jsx(qD,{},`separator-${c}`))}const E=u?`/browse/${a.join("/")}`:"/browse";return l.length>0?s.unshift(d.jsx(Ro,{children:d.jsx(QD,{asChild:!0,children:d.jsx(uo,{to:E,children:"Repository"})})},"root"),d.jsx(qD,{},"separator-root")):s.unshift(d.jsx(Ro,{children:d.jsx(m3,{children:"Repository"})},"root")),d.jsxs("div",{className:"flex h-full flex-1 flex-col overflow-auto",children:[d.jsxs("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[d.jsx(hm,{children:d.jsxs(mm,{children:[s,l.length>0&&d.jsx(Ro,{children:d.jsx(m3,{children:l[l.length-1]})})]})}),d.jsxs("div",{className:"ml-auto flex gap-2",children:[d.jsx(Cvu,{pathSegments:t}),d.jsx(I8e,{pathSegments:t})]})]}),d.jsx("div",{className:"flex flex-1 flex-col gap-4 p-4",children:d.jsx(nau,{testMetadatas:(i==null?void 0:i.map(c=>({fileName:c.name,relativePath:c.relativePath,pathSegments:c.pathSegments})))||[],moduleMetadatas:(o==null?void 0:o.map(c=>({fileName:c.name,relativePath:c.relativePath,pathSegments:c.pathSegments})))||[],folderMetadatas:(r==null?void 0:r.map(c=>({name:c.name,relativePath:c.relativePath,pathSegments:c.pathSegments})))||[],pathSegments:t,showAllFlattened:!1})})]})}const AC=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{className:"relative w-full overflow-auto",children:d.jsx("table",{ref:a,className:lu("w-full caption-bottom text-sm",e),...u})}));AC.displayName="Table";const bC=C.forwardRef(({className:e,...u},a)=>d.jsx("thead",{ref:a,className:lu("[&_tr]:border-b",e),...u}));bC.displayName="TableHeader";const yC=C.forwardRef(({className:e,...u},a)=>d.jsx("tbody",{ref:a,className:lu("[&>:last-child]:border-0",e),...u}));yC.displayName="TableBody";const rau=C.forwardRef(({className:e,...u},a)=>d.jsx("tfoot",{ref:a,className:lu("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...u}));rau.displayName="TableFooter";const Wo=C.forwardRef(({className:e,...u},a)=>d.jsx("tr",{ref:a,className:lu("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...u}));Wo.displayName="TableRow";const Io=C.forwardRef(({className:e,...u},a)=>d.jsx("th",{ref:a,className:lu("text-muted-foreground h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...u}));Io.displayName="TableHead";const gr=C.forwardRef(({className:e,...u},a)=>d.jsx("td",{ref:a,className:lu("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...u}));gr.displayName="TableCell";const Vze=C.forwardRef(({className:e,...u},a)=>d.jsx("caption",{ref:a,className:lu("text-muted-foreground mt-4 text-sm",e),...u}));Vze.displayName="TableCaption";function zj(e,u){const a=e.variables[u];if(typeof a=="string")return a}function Hze(){const{data:e=[]}=fC(),u=C.useMemo(()=>e.map(a=>({name:a.name,localAvdId:zj(a,P3),localApkPath:zj(a,Eh)})).sort((a,t)=>a.name.localeCompare(t.name)),[e]);return d.jsxs("div",{className:"flex h-full flex-1 flex-col overflow-auto",children:[d.jsx("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:d.jsx(hm,{children:d.jsx(mm,{children:d.jsx(Ro,{children:d.jsx(m3,{children:"Environments"})})})})}),d.jsxs("div",{className:"flex flex-1 flex-col gap-4 p-4",children:[d.jsx("div",{className:"w-full overflow-auto rounded-md border",children:d.jsxs(AC,{className:"table-fixed",children:[d.jsx(bC,{children:d.jsxs(Wo,{children:[d.jsx(Io,{className:"w-1/4 whitespace-nowrap text-xs",children:"Name"}),d.jsx(Io,{className:"w-1/4 whitespace-nowrap text-xs",children:"Local AVD ID"}),d.jsx(Io,{className:"w-2/4 whitespace-nowrap text-xs",children:"Local APK path"})]})}),d.jsx(yC,{children:u.length?u.map(a=>d.jsxs(Wo,{className:"h-[50px]",children:[d.jsx(gr,{className:"relative w-1/4",children:d.jsx("div",{className:"truncate font-medium",children:a.name})}),d.jsx(gr,{className:"relative w-1/4",children:d.jsx("div",{className:"text-muted-foreground truncate",children:a.localAvdId??"—"})}),d.jsx(gr,{className:"relative w-2/4",children:d.jsx("div",{className:"text-muted-foreground truncate",children:a.localApkPath??"—"})})]},a.name)):d.jsx(Wo,{className:"relative h-24",children:d.jsx(gr,{colSpan:3,className:"h-24 text-center",children:"No environments."})})})]})}),d.jsxs("div",{className:"text-xs",children:["Environments allow mobile tests to share variables and emulator settings when running locally. Configure them in your"," ",d.jsx("span",{className:"font-mono",children:"momentic.config.yaml"}),"."," ",d.jsx(xh,{slug:"/mobile-cli/emulators#environment-based-settings"})]})]})]})}function iau(e,u,a){try{return e(u)}catch(t){return C4u("[nuqs] Error while parsing value `%s`: %O"+(a?" (for key `%s`)":""),u,t,a),null}}function Gze(){var u;if(typeof window>"u"||!!!window.GestureEvent)return 50;try{const a=(u=navigator.userAgent)==null?void 0:u.match(/version\/([\d\.]+) safari/i);return parseFloat(a[1])>=17?120:320}catch{return 320}}var BC=Gze(),Fh=new Map,fr={history:"replace",scroll:!1,shallow:!0,throttleMs:BC},fz=new Set,Oj=0,d5=null;function Jze(e){return Fh.get(e)}function Wze(){Fh.clear(),fz.clear(),fr.history="replace",fr.scroll=!1,fr.shallow=!0,fr.throttleMs=BC}function Uze(e,u,a,t){const n=u===null?null:a(u);return Ri("[nuqs queue] Enqueueing %s=%s %O",e,n,t),Fh.set(e,n),t.history==="push"&&(fr.history="push"),t.scroll&&(fr.scroll=!0),t.shallow===!1&&(fr.shallow=!1),t.startTransition&&fz.add(t.startTransition),fr.throttleMs=Math.max(t.throttleMs??BC,Number.isFinite(fr.throttleMs)?fr.throttleMs:0),n}function Zze(){return new URLSearchParams(location.search)}function Qze({getSearchParamsSnapshot:e=Zze,updateUrl:u,rateLimitFactor:a=1}){return d5===null&&(d5=new Promise((t,n)=>{if(!Number.isFinite(fr.throttleMs)){Ri("[nuqs queue] Skipping flush due to throttleMs=Infinity"),t(e()),setTimeout(()=>{d5=null},0);return}function r(){Oj=performance.now();const[o,s]=qze({updateUrl:u,getSearchParamsSnapshot:e});s===null?t(o):n(o),d5=null}function i(){const s=performance.now()-Oj,l=fr.throttleMs,E=a*Math.max(0,Math.min(l,l-s));Ri("[nuqs queue] Scheduling flush in %f ms. Throttled at %f ms",E,l),E===0?r():setTimeout(r,E)}setTimeout(i,0)})),d5}function qze({updateUrl:e,getSearchParamsSnapshot:u}){const a=u();if(Fh.size===0)return[a,null];const t=Array.from(Fh.entries()),n={...fr},r=Array.from(fz);Wze(),Ri("[nuqs queue] Flushing queue %O with options %O",t,n);for(const[i,o]of t)o===null?a.delete(i):a.set(i,o);try{return Yze(r,()=>{e(a,{history:n.history,scroll:n.scroll,shallow:n.shallow})}),[a,null]}catch(i){return console.error(Xh(429),t.map(([o])=>o).join(),i),[a,i]}}function Yze(e,u){const a=t=>{if(t===e.length)return u();const n=e[t];if(!n)throw new Error("Invalid transition function");n(()=>a(t+1))};a(0)}function sl(e){function u(a){if(typeof a>"u")return null;let t="";if(Array.isArray(a)){if(a[0]===void 0)return null;t=a[0]}return typeof a=="string"&&(t=a),iau(e.parse,t)}return{eq:(a,t)=>a===t,...e,parseServerSide:u,withDefault(a){return{...this,defaultValue:a,parseServerSide(t){return u(t)??a}}},withOptions(a){return{...this,...a}}}}var Xze=sl({parse:e=>e,serialize:e=>`${e}`}),wj=sl({parse:e=>{const u=parseInt(e);return Number.isNaN(u)?null:u},serialize:e=>Math.round(e).toFixed()});sl({parse:e=>{const u=wj.parse(e);return u===null?null:u-1},serialize:e=>wj.serialize(e+1)});sl({parse:e=>{const u=parseInt(e,16);return Number.isNaN(u)?null:u},serialize:e=>{const u=Math.round(e).toString(16);return u.padStart(u.length+u.length%2,"0")}});sl({parse:e=>{const u=parseFloat(e);return Number.isNaN(u)?null:u},serialize:e=>e.toString()});sl({parse:e=>e==="true",serialize:e=>e?"true":"false"});function pz(e,u){return e.valueOf()===u.valueOf()}sl({parse:e=>{const u=parseInt(e);return Number.isNaN(u)?null:new Date(u)},serialize:e=>e.valueOf().toString(),eq:pz});sl({parse:e=>{const u=new Date(e);return Number.isNaN(u.valueOf())?null:u},serialize:e=>e.toISOString(),eq:pz});sl({parse:e=>{const u=new Date(e.slice(0,10));return Number.isNaN(u.valueOf())?null:u},serialize:e=>e.toISOString().slice(0,10),eq:pz});var dv=QI(),uOe={};function eOe(e,{history:u="replace",scroll:a=!1,shallow:t=!0,throttleMs:n=BC,clearOnDefault:r=!0,startTransition:i,urlKeys:o=uOe}={}){const s=Object.keys(e).join(","),l=C.useMemo(()=>Object.fromEntries(Object.keys(e).map(F=>[F,o[F]??F])),[s,JSON.stringify(o)]),E=A4u(),c=E.searchParams,D=C.useRef({}),h=C.useMemo(()=>Object.fromEntries(Object.keys(e).map(F=>[F,e[F].defaultValue??null])),[Object.values(e).map(({defaultValue:F})=>F).join(",")]),[m,x]=C.useState(()=>{const F=c??new URLSearchParams;return Dv(e,o,F).state}),p=C.useRef(m);if(Ri("[nuq+ `%s`] render - state: %O, iSP: %s",s,m,c),Object.keys(D.current).join("&")!==Object.values(l).join("&")){const{state:F,hasChanged:b}=Dv(e,o,c,D.current,p.current);b&&(p.current=F,x(F)),D.current=Object.fromEntries(Object.values(l).map(y=>[y,(c==null?void 0:c.get(y))??null]))}C.useEffect(()=>{const{state:F,hasChanged:b}=Dv(e,o,c,D.current,p.current);b&&(p.current=F,x(F))},[Object.values(l).map(F=>`${F}=${c==null?void 0:c.get(F)}`).join("&")]),C.useEffect(()=>{function F(y){Ri("[nuq+ `%s`] updateInternalState %O",s,y),p.current=y,x(y)}const b=Object.keys(e).reduce((y,v)=>(y[v]=({state:A,query:B})=>{const{defaultValue:j}=e[v],R=l[v];p.current={...p.current,[v]:A??j??null},D.current[R]=B,Ri("[nuq+ `%s`] Cross-hook key sync %s: %O (default: %O). Resolved: %O",s,R,A,j,p.current),F(p.current)},y),{});for(const y of Object.keys(e)){const v=l[y];Ri("[nuq+ `%s`] Subscribing to sync for `%s`",s,v),dv.on(v,b[y])}return()=>{for(const y of Object.keys(e)){const v=l[y];Ri("[nuq+ `%s`] Unsubscribing to sync for `%s`",s,v),dv.off(v,b[y])}}},[s,l]);const f=C.useCallback((F,b={})=>{const y=Object.fromEntries(Object.keys(e).map(A=>[A,null])),v=typeof F=="function"?F(Mj(p.current,h))??y:F??y;Ri("[nuq+ `%s`] setState: %O",s,v);for(let[A,B]of Object.entries(v)){const j=e[A],R=l[A];if(!j)continue;(b.clearOnDefault??j.clearOnDefault??r)&&B!==null&&j.defaultValue!==void 0&&(j.eq??((O,T)=>O===T))(B,j.defaultValue)&&(B=null);const w=Uze(R,B,j.serialize??String,{history:b.history??j.history??u,shallow:b.shallow??j.shallow??t,scroll:b.scroll??j.scroll??a,throttleMs:b.throttleMs??j.throttleMs??n,startTransition:b.startTransition??j.startTransition??i});dv.emit(R,{state:B,query:w})}return Qze(E)},[s,u,t,a,n,i,l,E.updateUrl,E.getSearchParamsSnapshot,E.rateLimitFactor,h]);return[C.useMemo(()=>Mj(m,h),[m,h]),f]}function Dv(e,u,a,t,n){let r=!1;const i=Object.keys(e).reduce((o,s)=>{const l=(u==null?void 0:u[s])??s,{parse:E}=e[s],c=Jze(l),D=c===void 0?(a==null?void 0:a.get(l))??null:c;if(t&&n&&(t[l]??null)===D)return o[s]=n[s]??null,o;r=!0;const h=D===null?null:iau(E,D,s);return o[s]=h??null,t&&(t[l]=D),o},{});if(!r){const o=Object.keys(e),s=Object.keys(n??{});r=o.length!==s.length||o.some(l=>!s.includes(l))}return{state:i,hasChanged:r}}function Mj(e,u){return Object.fromEntries(Object.keys(e).map(a=>[a,e[a]??u[a]??null]))}function aOe(e,u,a,t){var n=this,r=C.useRef(null),i=C.useRef(0),o=C.useRef(0),s=C.useRef(null),l=C.useRef([]),E=C.useRef(),c=C.useRef(),D=C.useRef(e),h=C.useRef(!0);D.current=e;var m=typeof window<"u",x=!u&&u!==0&&m;if(typeof e!="function")throw new TypeError("Expected a function");u=+u||0;var p=!!(a=a||{}).leading,f=!("trailing"in a)||!!a.trailing,g="maxWait"in a,F="debounceOnServer"in a&&!!a.debounceOnServer,b=g?Math.max(+a.maxWait||0,u):null;C.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var y=C.useMemo(function(){var v=function(T){var z=l.current,N=E.current;return l.current=E.current=null,i.current=T,o.current=o.current||T,c.current=D.current.apply(N,z)},A=function(T,z){x&&cancelAnimationFrame(s.current),s.current=x?requestAnimationFrame(T):setTimeout(T,z)},B=function(T){if(!h.current)return!1;var z=T-r.current;return!r.current||z>=u||z<0||g&&T-i.current>=b},j=function(T){return s.current=null,f&&l.current?v(T):(l.current=E.current=null,c.current)},R=function T(){var z=Date.now();if(p&&o.current===i.current&&w(),B(z))return j(z);if(h.current){var N=u-(z-r.current),M=g?Math.min(N,b-(z-i.current)):N;A(T,M)}},w=function(){t&&t({})},O=function(){if(m||F){var T=Date.now(),z=B(T);if(l.current=[].slice.call(arguments),E.current=n,r.current=T,z){if(!s.current&&h.current)return i.current=r.current,A(R,u),p?v(r.current):c.current;if(g)return A(R,u),v(r.current)}return s.current||A(R,u),c.current}};return O.cancel=function(){s.current&&(x?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,l.current=r.current=E.current=s.current=null},O.isPending=function(){return!!s.current},O.flush=function(){return s.current?j(Date.now()):c.current},O},[p,g,u,b,f,x,m,F,t]);return y}const tOe=50,nOe=750;function rOe(e){const{initialQuery:u,onQueryChange:a}=e,[t,n]=C.useState(u);C.useEffect(()=>{n(u)},[u]);const r=aOe(o=>{a(o)},nOe),i=o=>{const s=o.target.value;n(s),r(s)};return d.jsxs("div",{className:"relative w-full",children:[d.jsx(sd,{className:"text-muted-foreground absolute left-2 top-2.5 h-4 w-4"}),d.jsx(gt,{autoFocus:!0,placeholder:"Search tests and modules...",className:"w-full border-0 !border-none pl-8 !shadow-none !outline-none focus-visible:ring-0",value:t,onChange:i})]})}const iOe=()=>{const{data:e}=mz(),[u,a]=eOe({query:Xze.withDefault("")}),t=C.useMemo(()=>{const s=(e==null?void 0:e.tests.map(E=>({type:"TEST",fileName:E.fileName,description:E.description,data:E})))||[],l=(e==null?void 0:e.modules.map(E=>({type:"MODULE",fileName:E.fileName,description:E.description,data:E})))||[];return[...s,...l]},[e==null?void 0:e.modules,e==null?void 0:e.tests]),n=C.useMemo(()=>new J1(t,{keys:[{name:"fileName",weight:1},{name:"description",weight:.8}],threshold:.3,includeScore:!0,findAllMatches:!0,ignoreLocation:!0,useExtendedSearch:!0}),[t]),r=C.useMemo(()=>{const s=u.query.trim().replace(/-/g," ");if(!s)return[];const l=s.toLowerCase().split(/\s+/);return n.search({$and:l.map(c=>({$or:[{fileName:c},{description:c}]}))}).map(c=>({...c.item,score:c.score??1})).sort((c,D)=>c.score-D.score).slice(0,tOe)},[n,u.query]),i=C.useMemo(()=>r.filter(s=>s.type==="TEST"),[r]),o=C.useMemo(()=>r.filter(s=>s.type==="MODULE"),[r]);return d.jsxs("div",{className:"flex h-full flex-1 flex-col overflow-auto",children:[d.jsx("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:d.jsx(rOe,{initialQuery:u.query,onQueryChange:s=>{a({query:s})}})}),d.jsx("div",{className:"flex flex-1 flex-col gap-4 p-4",children:d.jsx(nau,{testMetadatas:i.map(s=>({fileName:s.data.fileName,relativePath:s.data.relativePath,pathSegments:s.data.relativePathSegments})),moduleMetadatas:o.map(s=>({fileName:s.data.fileName,relativePath:s.data.relativePath,pathSegments:s.data.relativePathSegments})),folderMetadatas:[],showAllFlattened:!0})})]})},{createElement:L3,createContext:oOe,createRef:Ia0,forwardRef:oau,useCallback:or,useContext:sau,useEffect:N4,useImperativeHandle:lau,useLayoutEffect:sOe,useMemo:lOe,useRef:Hn,useState:dD}=I4,Tj=I4.useId,EOe=sOe,SC=oOe(null);SC.displayName="PanelGroupContext";const R4=EOe,cOe=typeof Tj=="function"?Tj:()=>null;let dOe=0;function gz(e=null){const u=cOe(),a=Hn(e||u||null);return a.current===null&&(a.current=""+dOe++),e??a.current}function Eau({children:e,className:u="",collapsedSize:a,collapsible:t,defaultSize:n,forwardedRef:r,id:i,maxSize:o,minSize:s,onCollapse:l,onExpand:E,onResize:c,order:D,style:h,tagName:m="div",...x}){const p=sau(SC);if(p===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:f,expandPanel:g,getPanelSize:F,getPanelStyle:b,groupId:y,isPanelCollapsed:v,reevaluatePanelConstraints:A,registerPanel:B,resizePanel:j,unregisterPanel:R}=p,w=gz(i),O=Hn({callbacks:{onCollapse:l,onExpand:E,onResize:c},constraints:{collapsedSize:a,collapsible:t,defaultSize:n,maxSize:o,minSize:s},id:w,idIsFromProps:i!==void 0,order:D});Hn({didLogMissingDefaultSizeWarning:!1}),R4(()=>{const{callbacks:z,constraints:N}=O.current,M={...N};O.current.id=w,O.current.idIsFromProps=i!==void 0,O.current.order=D,z.onCollapse=l,z.onExpand=E,z.onResize=c,N.collapsedSize=a,N.collapsible=t,N.defaultSize=n,N.maxSize=o,N.minSize=s,(M.collapsedSize!==N.collapsedSize||M.collapsible!==N.collapsible||M.maxSize!==N.maxSize||M.minSize!==N.minSize)&&A(O.current,M)}),R4(()=>{const z=O.current;return B(z),()=>{R(z)}},[D,w,B,R]),lau(r,()=>({collapse:()=>{f(O.current)},expand:()=>{g(O.current)},getId(){return w},getSize(){return F(O.current)},isCollapsed(){return v(O.current)},isExpanded(){return!v(O.current)},resize:z=>{j(O.current,z)}}),[f,g,F,v,w,j]);const T=b(O.current,n);return L3(m,{...x,children:e,className:u,id:i,style:{...T,...h},"data-panel":"","data-panel-collapsible":t||void 0,"data-panel-group-id":y,"data-panel-id":w,"data-panel-size":parseFloat(""+T.flexGrow).toFixed(1)})}const cau=oau((e,u)=>L3(Eau,{...e,forwardedRef:u}));Eau.displayName="Panel";cau.displayName="forwardRef(Panel)";let Lb=null,v4=null;function DOe(e,u){if(u){const a=(u&xau)!==0,t=(u&fau)!==0,n=(u&pau)!==0,r=(u&gau)!==0;if(a)return n?"se-resize":r?"ne-resize":"e-resize";if(t)return n?"sw-resize":r?"nw-resize":"w-resize";if(n)return"s-resize";if(r)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function hOe(){v4!==null&&(document.head.removeChild(v4),Lb=null,v4=null)}function hv(e,u){const a=DOe(e,u);Lb!==a&&(Lb=a,v4===null&&(v4=document.createElement("style"),document.head.appendChild(v4)),v4.innerHTML=`*{cursor: ${a}!important;}`)}function dau(e){return e.type==="keydown"}function Dau(e){return e.type.startsWith("mouse")}function hau(e){return e.type.startsWith("touch")}function zC(e){if(Dau(e))return{x:e.clientX,y:e.clientY};if(hau(e)){const u=e.touches[0];if(u&&u.clientX&&u.clientY)return{x:u.clientX,y:u.clientY}}return{x:1/0,y:1/0}}function mOe(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function xOe(e,u,a){return a?e.x<u.x+u.width&&e.x+e.width>u.x&&e.y<u.y+u.height&&e.y+e.height>u.y:e.x<=u.x+u.width&&e.x+e.width>=u.x&&e.y<=u.y+u.height&&e.y+e.height>=u.y}function fOe(e,u){if(e===u)throw new Error("Cannot compare node with itself");const a={a:Nj(e),b:Nj(u)};let t;for(;a.a.at(-1)===a.b.at(-1);)e=a.a.pop(),u=a.b.pop(),t=e;d0(t,"Stacking order can only be calculated for elements with a common ancestor");const n={a:jj(Pj(a.a)),b:jj(Pj(a.b))};if(n.a===n.b){const r=t.childNodes,i={a:a.a.at(-1),b:a.b.at(-1)};let o=r.length;for(;o--;){const s=r[o];if(s===i.a)return 1;if(s===i.b)return-1}}return Math.sign(n.a-n.b)}const pOe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function gOe(e){const u=getComputedStyle(mau(e)).display;return u==="flex"||u==="inline-flex"}function COe(e){const u=getComputedStyle(e);return!!(u.position==="fixed"||u.zIndex!=="auto"&&(u.position!=="static"||gOe(e))||+u.opacity<1||"transform"in u&&u.transform!=="none"||"webkitTransform"in u&&u.webkitTransform!=="none"||"mixBlendMode"in u&&u.mixBlendMode!=="normal"||"filter"in u&&u.filter!=="none"||"webkitFilter"in u&&u.webkitFilter!=="none"||"isolation"in u&&u.isolation==="isolate"||pOe.test(u.willChange)||u.webkitOverflowScrolling==="touch")}function Pj(e){let u=e.length;for(;u--;){const a=e[u];if(d0(a,"Missing node"),COe(a))return a}return null}function jj(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Nj(e){const u=[];for(;e;)u.push(e),e=mau(e);return u}function mau(e){var u;return((u=e.parentNode)===null||u===void 0?void 0:u.host)||e.parentNode}const xau=1,fau=2,pau=4,gau=8,FOe=mOe()==="coarse";let v1=[],OC=!1,Ml=new Map,wC=new Map;const kh=new Set;function kOe(e,u,a,t,n){var r;const{ownerDocument:i}=u,o={direction:a,element:u,hitAreaMargins:t,setResizeHandlerState:n},s=(r=Ml.get(i))!==null&&r!==void 0?r:0;return Ml.set(i,s+1),kh.add(o),Sp(),function(){var E;wC.delete(e),kh.delete(o);const c=(E=Ml.get(i))!==null&&E!==void 0?E:1;Ml.set(i,c-1),Sp(),c===1&&Ml.delete(i)}}function jx(e){const{target:u}=e,{x:a,y:t}=zC(e);OC=!0,Cz({target:u,x:a,y:t}),Sp(),v1.length>0&&(Fz("down",e),e.preventDefault())}function Cl(e){const{x:u,y:a}=zC(e);if(!OC){const{target:t}=e;Cz({target:t,x:u,y:a})}Fz("move",e),Cau(),v1.length>0&&e.preventDefault()}function Fl(e){const{target:u}=e,{x:a,y:t}=zC(e);wC.clear(),OC=!1,v1.length>0&&e.preventDefault(),Fz("up",e),Cz({target:u,x:a,y:t}),Cau(),Sp()}function Cz({target:e,x:u,y:a}){v1.splice(0);let t=null;e instanceof HTMLElement&&(t=e),kh.forEach(n=>{const{element:r,hitAreaMargins:i}=n,o=r.getBoundingClientRect(),{bottom:s,left:l,right:E,top:c}=o,D=FOe?i.coarse:i.fine;if(u>=l-D&&u<=E+D&&a>=c-D&&a<=s+D){if(t!==null&&r!==t&&!r.contains(t)&&!t.contains(r)&&fOe(t,r)>0){let m=t,x=!1;for(;m&&!m.contains(r);){if(xOe(m.getBoundingClientRect(),o,!0)){x=!0;break}m=m.parentElement}if(x)return}v1.push(n)}})}function mv(e,u){wC.set(e,u)}function Cau(){let e=!1,u=!1;v1.forEach(t=>{const{direction:n}=t;n==="horizontal"?e=!0:u=!0});let a=0;wC.forEach(t=>{a|=t}),e&&u?hv("intersection",a):e?hv("horizontal",a):u?hv("vertical",a):hOe()}function Sp(){Ml.forEach((e,u)=>{const{body:a}=u;a.removeEventListener("contextmenu",Fl),a.removeEventListener("mousedown",jx),a.removeEventListener("mouseleave",Cl),a.removeEventListener("mousemove",Cl),a.removeEventListener("touchmove",Cl),a.removeEventListener("touchstart",jx)}),window.removeEventListener("mouseup",Fl),window.removeEventListener("touchcancel",Fl),window.removeEventListener("touchend",Fl),kh.size>0&&(OC?(v1.length>0&&Ml.forEach((e,u)=>{const{body:a}=u;e>0&&(a.addEventListener("contextmenu",Fl),a.addEventListener("mouseleave",Cl),a.addEventListener("mousemove",Cl),a.addEventListener("touchmove",Cl,{passive:!1}))}),window.addEventListener("mouseup",Fl),window.addEventListener("touchcancel",Fl),window.addEventListener("touchend",Fl)):Ml.forEach((e,u)=>{const{body:a}=u;e>0&&(a.addEventListener("mousedown",jx),a.addEventListener("mousemove",Cl),a.addEventListener("touchmove",Cl,{passive:!1}),a.addEventListener("touchstart",jx))}))}function Fz(e,u){kh.forEach(a=>{const{setResizeHandlerState:t}=a,n=v1.includes(a);t(e,n,u)})}function d0(e,u){if(!e)throw console.error(u),Error(u)}const Fau=10;function vh(e,u,a=Fau){e=parseFloat(e.toFixed(a)),u=parseFloat(u.toFixed(a));const t=e-u;return t===0?0:t>0?1:-1}function cr(e,u,a){return vh(e,u,a)===0}function vOe(e,u,a){if(e.length!==u.length)return!1;for(let t=0;t<e.length;t++){const n=e[t],r=u[t];if(!cr(n,r,a))return!1}return!0}function vc({panelConstraints:e,panelIndex:u,size:a}){const t=e[u];d0(t!=null,`Panel constraints not found for index ${u}`);let{collapsedSize:n=0,collapsible:r,maxSize:i=100,minSize:o=0}=t;if(vh(a,o)<0)if(r){const s=(n+o)/2;vh(a,s)<0?a=n:a=o}else a=o;return a=Math.min(i,a),a=parseFloat(a.toFixed(Fau)),a}function j5({delta:e,initialLayout:u,panelConstraints:a,pivotIndices:t,prevLayout:n,trigger:r}){if(cr(e,0))return u;const i=[...u],[o,s]=t;d0(o!=null,"Invalid first pivot index"),d0(s!=null,"Invalid second pivot index");let l=0;if(r==="keyboard"){{const c=e<0?s:o,D=a[c];d0(D,`Panel constraints not found for index ${c}`);const{collapsedSize:h=0,collapsible:m,minSize:x=0}=D;if(m){const p=u[c];if(d0(p!=null,`Previous layout not found for panel index ${c}`),cr(p,h)){const f=x-p;vh(f,Math.abs(e))>0&&(e=e<0?0-f:f)}}}{const c=e<0?o:s,D=a[c];d0(D,`No panel constraints found for index ${c}`);const{collapsedSize:h=0,collapsible:m,minSize:x=0}=D;if(m){const p=u[c];if(d0(p!=null,`Previous layout not found for panel index ${c}`),cr(p,x)){const f=p-h;vh(f,Math.abs(e))>0&&(e=e<0?0-f:f)}}}}{const c=e<0?1:-1;let D=e<0?s:o,h=0;for(;;){const x=u[D];d0(x!=null,`Previous layout not found for panel index ${D}`);const f=vc({panelConstraints:a,panelIndex:D,size:100})-x;if(h+=f,D+=c,D<0||D>=a.length)break}const m=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-m:m}{let D=e<0?o:s;for(;D>=0&&D<a.length;){const h=Math.abs(e)-Math.abs(l),m=u[D];d0(m!=null,`Previous layout not found for panel index ${D}`);const x=m-h,p=vc({panelConstraints:a,panelIndex:D,size:x});if(!cr(m,p)&&(l+=m-p,i[D]=p,l.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?D--:D++}}if(vOe(n,i))return n;{const c=e<0?s:o,D=u[c];d0(D!=null,`Previous layout not found for panel index ${c}`);const h=D+l,m=vc({panelConstraints:a,panelIndex:c,size:h});if(i[c]=m,!cr(m,h)){let x=h-m,f=e<0?s:o;for(;f>=0&&f<a.length;){const g=i[f];d0(g!=null,`Previous layout not found for panel index ${f}`);const F=g+x,b=vc({panelConstraints:a,panelIndex:f,size:F});if(cr(g,b)||(x-=b-g,i[f]=b),cr(x,0))break;e>0?f--:f++}}}const E=i.reduce((c,D)=>D+c,0);return cr(E,100)?i:n}function AOe({layout:e,panelsArray:u,pivotIndices:a}){let t=0,n=100,r=0,i=0;const o=a[0];d0(o!=null,"No pivot index found"),u.forEach((c,D)=>{const{constraints:h}=c,{maxSize:m=100,minSize:x=0}=h;D===o?(t=x,n=m):(r+=x,i+=m)});const s=Math.min(n,100-r),l=Math.max(t,100-i),E=e[o];return{valueMax:s,valueMin:l,valueNow:E}}function Ah(e,u=document){return Array.from(u.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function kau(e,u,a=document){const n=Ah(e,a).findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===u);return n??null}function vau(e,u,a){const t=kau(e,u,a);return t!=null?[t,t+1]:[-1,-1]}function Aau(e,u=document){var a;if(u instanceof HTMLElement&&(u==null||(a=u.dataset)===null||a===void 0?void 0:a.panelGroupId)==e)return u;const t=u.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return t||null}function MC(e,u=document){const a=u.querySelector(`[data-panel-resize-handle-id="${e}"]`);return a||null}function bOe(e,u,a,t=document){var n,r,i,o;const s=MC(u,t),l=Ah(e,t),E=s?l.indexOf(s):-1,c=(n=(r=a[E])===null||r===void 0?void 0:r.id)!==null&&n!==void 0?n:null,D=(i=(o=a[E+1])===null||o===void 0?void 0:o.id)!==null&&i!==void 0?i:null;return[c,D]}function yOe({committedValuesRef:e,eagerValuesRef:u,groupId:a,layout:t,panelDataArray:n,panelGroupElement:r,setLayout:i}){Hn({didWarnAboutMissingResizeHandle:!1}),R4(()=>{if(!r)return;const o=Ah(a,r);for(let s=0;s<n.length-1;s++){const{valueMax:l,valueMin:E,valueNow:c}=AOe({layout:t,panelsArray:n,pivotIndices:[s,s+1]}),D=o[s];if(D!=null){const h=n[s];d0(h,`No panel data found for index "${s}"`),D.setAttribute("aria-controls",h.id),D.setAttribute("aria-valuemax",""+Math.round(l)),D.setAttribute("aria-valuemin",""+Math.round(E)),D.setAttribute("aria-valuenow",c!=null?""+Math.round(c):"")}}return()=>{o.forEach((s,l)=>{s.removeAttribute("aria-controls"),s.removeAttribute("aria-valuemax"),s.removeAttribute("aria-valuemin"),s.removeAttribute("aria-valuenow")})}},[a,t,n,r]),N4(()=>{if(!r)return;const o=u.current;d0(o,"Eager values not found");const{panelDataArray:s}=o,l=Aau(a,r);d0(l!=null,`No group found for id "${a}"`);const E=Ah(a,r);d0(E,`No resize handles found for group id "${a}"`);const c=E.map(D=>{const h=D.getAttribute("data-panel-resize-handle-id");d0(h,"Resize handle element has no handle id attribute");const[m,x]=bOe(a,h,s,r);if(m==null||x==null)return()=>{};const p=f=>{if(!f.defaultPrevented)switch(f.key){case"Enter":{f.preventDefault();const g=s.findIndex(F=>F.id===m);if(g>=0){const F=s[g];d0(F,`No panel data found for index ${g}`);const b=t[g],{collapsedSize:y=0,collapsible:v,minSize:A=0}=F.constraints;if(b!=null&&v){const B=j5({delta:cr(b,y)?A-y:y-b,initialLayout:t,panelConstraints:s.map(j=>j.constraints),pivotIndices:vau(a,h,r),prevLayout:t,trigger:"keyboard"});t!==B&&i(B)}}break}}};return D.addEventListener("keydown",p),()=>{D.removeEventListener("keydown",p)}});return()=>{c.forEach(D=>D())}},[r,e,u,a,t,n,i])}function Rj(e,u){if(e.length!==u.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!==u[a])return!1;return!0}function bau(e,u){const a=e==="horizontal",{x:t,y:n}=zC(u);return a?t:n}function BOe(e,u,a,t,n){const r=a==="horizontal",i=MC(u,n);d0(i,`No resize handle element found for id "${u}"`);const o=i.getAttribute("data-panel-group-id");d0(o,"Resize handle element has no group id attribute");let{initialCursorPosition:s}=t;const l=bau(a,e),E=Aau(o,n);d0(E,`No group element found for id "${o}"`);const c=E.getBoundingClientRect(),D=r?c.width:c.height;return(l-s)/D*100}function SOe(e,u,a,t,n,r){if(dau(e)){const i=a==="horizontal";let o=0;e.shiftKey?o=100:n!=null?o=n:o=10;let s=0;switch(e.key){case"ArrowDown":s=i?0:o;break;case"ArrowLeft":s=i?-o:0;break;case"ArrowRight":s=i?o:0;break;case"ArrowUp":s=i?0:-o;break;case"End":s=100;break;case"Home":s=-100;break}return s}else return t==null?0:BOe(e,u,a,t,r)}function zOe({panelDataArray:e}){const u=Array(e.length),a=e.map(r=>r.constraints);let t=0,n=100;for(let r=0;r<e.length;r++){const i=a[r];d0(i,`Panel constraints not found for index ${r}`);const{defaultSize:o}=i;o!=null&&(t++,u[r]=o,n-=o)}for(let r=0;r<e.length;r++){const i=a[r];d0(i,`Panel constraints not found for index ${r}`);const{defaultSize:o}=i;if(o!=null)continue;const s=e.length-t,l=n/s;t++,u[r]=l,n-=l}return u}function JE(e,u,a){u.forEach((t,n)=>{const r=e[n];d0(r,`Panel data not found for index ${n}`);const{callbacks:i,constraints:o,id:s}=r,{collapsedSize:l=0,collapsible:E}=o,c=a[s];if(c==null||t!==c){a[s]=t;const{onCollapse:D,onExpand:h,onResize:m}=i;m&&m(t,c),E&&(D||h)&&(h&&(c==null||c===l)&&t!==l&&h(),D&&(c==null||c!==l)&&t===l&&D())}})}function Nx(e,u){if(e.length!==u.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!=u[a])return!1;return!0}function OOe({defaultSize:e,dragState:u,layout:a,panelData:t,panelIndex:n,precision:r=3}){const i=a[n];let o;return i==null?o=e!=null?e.toPrecision(r):"1":t.length===1?o="1":o=i.toPrecision(r),{flexBasis:0,flexGrow:o,flexShrink:1,overflow:"hidden",pointerEvents:u!==null?"none":void 0}}function wOe(e,u=10){let a=null;return(...n)=>{a!==null&&clearTimeout(a),a=setTimeout(()=>{e(...n)},u)}}function Lj(e){try{if(typeof localStorage<"u")e.getItem=u=>localStorage.getItem(u),e.setItem=(u,a)=>{localStorage.setItem(u,a)};else throw new Error("localStorage not supported in this environment")}catch(u){console.error(u),e.getItem=()=>null,e.setItem=()=>{}}}function yau(e){return`react-resizable-panels:${e}`}function Bau(e){return e.map(u=>{const{constraints:a,id:t,idIsFromProps:n,order:r}=u;return n?t:r?`${r}:${JSON.stringify(a)}`:JSON.stringify(a)}).sort((u,a)=>u.localeCompare(a)).join(",")}function Sau(e,u){try{const a=yau(e),t=u.getItem(a);if(t){const n=JSON.parse(t);if(typeof n=="object"&&n!=null)return n}}catch{}return null}function MOe(e,u,a){var t,n;const r=(t=Sau(e,a))!==null&&t!==void 0?t:{},i=Bau(u);return(n=r[i])!==null&&n!==void 0?n:null}function TOe(e,u,a,t,n){var r;const i=yau(e),o=Bau(u),s=(r=Sau(e,n))!==null&&r!==void 0?r:{};s[o]={expandToSizes:Object.fromEntries(a.entries()),layout:t};try{n.setItem(i,JSON.stringify(s))}catch(l){console.error(l)}}function _j({layout:e,panelConstraints:u}){const a=[...e],t=a.reduce((r,i)=>r+i,0);if(a.length!==u.length)throw Error(`Invalid ${u.length} panel layout: ${a.map(r=>`${r}%`).join(", ")}`);if(!cr(t,100))for(let r=0;r<u.length;r++){const i=a[r];d0(i!=null,`No layout data found for index ${r}`);const o=100/t*i;a[r]=o}let n=0;for(let r=0;r<u.length;r++){const i=a[r];d0(i!=null,`No layout data found for index ${r}`);const o=vc({panelConstraints:u,panelIndex:r,size:i});i!=o&&(n+=i-o,a[r]=o)}if(!cr(n,0))for(let r=0;r<u.length;r++){const i=a[r];d0(i!=null,`No layout data found for index ${r}`);const o=i+n,s=vc({panelConstraints:u,panelIndex:r,size:o});if(i!==s&&(n-=s-i,a[r]=s,cr(n,0)))break}return a}const POe=100,N5={getItem:e=>(Lj(N5),N5.getItem(e)),setItem:(e,u)=>{Lj(N5),N5.setItem(e,u)}},Ij={};function zau({autoSaveId:e=null,children:u,className:a="",direction:t,forwardedRef:n,id:r=null,onLayout:i=null,keyboardResizeBy:o=null,storage:s=N5,style:l,tagName:E="div",...c}){const D=gz(r),h=Hn(null),[m,x]=dD(null),[p,f]=dD([]),g=Hn({}),F=Hn(new Map),b=Hn(0),y=Hn({autoSaveId:e,direction:t,dragState:m,id:D,keyboardResizeBy:o,onLayout:i,storage:s}),v=Hn({layout:p,panelDataArray:[],panelDataArrayChanged:!1});Hn({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),lau(n,()=>({getId:()=>y.current.id,getLayout:()=>{const{layout:_}=v.current;return _},setLayout:_=>{const{onLayout:Q}=y.current,{layout:eu,panelDataArray:U}=v.current,iu=_j({layout:_,panelConstraints:U.map(tu=>tu.constraints)});Rj(eu,iu)||(f(iu),v.current.layout=iu,Q&&Q(iu),JE(U,iu,g.current))}}),[]),R4(()=>{y.current.autoSaveId=e,y.current.direction=t,y.current.dragState=m,y.current.id=D,y.current.onLayout=i,y.current.storage=s}),yOe({committedValuesRef:y,eagerValuesRef:v,groupId:D,layout:p,panelDataArray:v.current.panelDataArray,setLayout:f,panelGroupElement:h.current}),N4(()=>{const{panelDataArray:_}=v.current;if(e){if(p.length===0||p.length!==_.length)return;let Q=Ij[e];Q==null&&(Q=wOe(TOe,POe),Ij[e]=Q);const eu=[..._],U=new Map(F.current);Q(e,eu,U,p,s)}},[e,p,s]),N4(()=>{});const A=or(_=>{const{onLayout:Q}=y.current,{layout:eu,panelDataArray:U}=v.current;if(_.constraints.collapsible){const iu=U.map(Cu=>Cu.constraints),{collapsedSize:tu=0,panelSize:Y,pivotIndices:ou}=t4(U,_,eu);if(d0(Y!=null,`Panel size not found for panel "${_.id}"`),Y!==tu){F.current.set(_.id,Y);const Au=rc(U,_)===U.length-1?Y-tu:tu-Y,mu=j5({delta:Au,initialLayout:eu,panelConstraints:iu,pivotIndices:ou,prevLayout:eu,trigger:"imperative-api"});Nx(eu,mu)||(f(mu),v.current.layout=mu,Q&&Q(mu),JE(U,mu,g.current))}}},[]),B=or(_=>{const{onLayout:Q}=y.current,{layout:eu,panelDataArray:U}=v.current;if(_.constraints.collapsible){const iu=U.map(Au=>Au.constraints),{collapsedSize:tu=0,panelSize:Y,minSize:ou=0,pivotIndices:Cu}=t4(U,_,eu);if(Y===tu){const Au=F.current.get(_.id),mu=Au!=null&&Au>=ou?Au:ou,le=rc(U,_)===U.length-1?Y-mu:mu-Y,Yu=j5({delta:le,initialLayout:eu,panelConstraints:iu,pivotIndices:Cu,prevLayout:eu,trigger:"imperative-api"});Nx(eu,Yu)||(f(Yu),v.current.layout=Yu,Q&&Q(Yu),JE(U,Yu,g.current))}}},[]),j=or(_=>{const{layout:Q,panelDataArray:eu}=v.current,{panelSize:U}=t4(eu,_,Q);return d0(U!=null,`Panel size not found for panel "${_.id}"`),U},[]),R=or((_,Q)=>{const{panelDataArray:eu}=v.current,U=rc(eu,_);return OOe({defaultSize:Q,dragState:m,layout:p,panelData:eu,panelIndex:U})},[m,p]),w=or(_=>{const{layout:Q,panelDataArray:eu}=v.current,{collapsedSize:U=0,collapsible:iu,panelSize:tu}=t4(eu,_,Q);return iu===!0&&tu===U},[]),O=or(_=>{const{layout:Q,panelDataArray:eu}=v.current,{collapsedSize:U=0,collapsible:iu,panelSize:tu}=t4(eu,_,Q);return d0(tu!=null,`Panel size not found for panel "${_.id}"`),!iu||tu>U},[]),T=or(_=>{const{panelDataArray:Q}=v.current;Q.push(_),Q.sort((eu,U)=>{const iu=eu.order,tu=U.order;return iu==null&&tu==null?0:iu==null?-1:tu==null?1:iu-tu}),v.current.panelDataArrayChanged=!0},[]);R4(()=>{if(v.current.panelDataArrayChanged){v.current.panelDataArrayChanged=!1;const{autoSaveId:_,onLayout:Q,storage:eu}=y.current,{layout:U,panelDataArray:iu}=v.current;let tu=null;if(_){const ou=MOe(_,iu,eu);ou&&(F.current=new Map(Object.entries(ou.expandToSizes)),tu=ou.layout)}tu==null&&(tu=zOe({panelDataArray:iu}));const Y=_j({layout:tu,panelConstraints:iu.map(ou=>ou.constraints)});Rj(U,Y)||(f(Y),v.current.layout=Y,Q&&Q(Y),JE(iu,Y,g.current))}}),R4(()=>{const _=v.current;return()=>{_.layout=[]}},[]);const z=or(_=>function(eu){eu.preventDefault();const U=h.current;if(!U)return()=>null;const{direction:iu,dragState:tu,id:Y,keyboardResizeBy:ou,onLayout:Cu}=y.current,{layout:Au,panelDataArray:mu}=v.current,{initialLayout:Nu}=tu??{},le=vau(Y,_,U);let Yu=SOe(eu,_,iu,tu,ou,U);if(Yu===0)return;const ve=iu==="horizontal";document.dir==="rtl"&&ve&&(Yu=-Yu);const Ie=mu.map(fe=>fe.constraints),Zu=j5({delta:Yu,initialLayout:Nu??Au,panelConstraints:Ie,pivotIndices:le,prevLayout:Au,trigger:dau(eu)?"keyboard":"mouse-or-touch"}),Gu=!Nx(Au,Zu);(Dau(eu)||hau(eu))&&b.current!=Yu&&(b.current=Yu,Gu?mv(_,0):ve?mv(_,Yu<0?xau:fau):mv(_,Yu<0?pau:gau)),Gu&&(f(Zu),v.current.layout=Zu,Cu&&Cu(Zu),JE(mu,Zu,g.current))},[]),N=or((_,Q)=>{const{onLayout:eu}=y.current,{layout:U,panelDataArray:iu}=v.current,tu=iu.map(Nu=>Nu.constraints),{panelSize:Y,pivotIndices:ou}=t4(iu,_,U);d0(Y!=null,`Panel size not found for panel "${_.id}"`);const Au=rc(iu,_)===iu.length-1?Y-Q:Q-Y,mu=j5({delta:Au,initialLayout:U,panelConstraints:tu,pivotIndices:ou,prevLayout:U,trigger:"imperative-api"});Nx(U,mu)||(f(mu),v.current.layout=mu,eu&&eu(mu),JE(iu,mu,g.current))},[]),M=or((_,Q)=>{const{layout:eu,panelDataArray:U}=v.current,{collapsedSize:iu=0,collapsible:tu}=Q,{collapsedSize:Y=0,collapsible:ou,maxSize:Cu=100,minSize:Au=0}=_.constraints,{panelSize:mu}=t4(U,_,eu);mu!=null&&(tu&&ou&&mu===iu?iu!==Y&&N(_,Y):mu<Au?N(_,Au):mu>Cu&&N(_,Cu))},[N]),I=or((_,Q)=>{const{direction:eu}=y.current,{layout:U}=v.current;if(!h.current)return;const iu=MC(_,h.current);d0(iu,`Drag handle element not found for id "${_}"`);const tu=bau(eu,Q);x({dragHandleId:_,dragHandleRect:iu.getBoundingClientRect(),initialCursorPosition:tu,initialLayout:U})},[]),P=or(()=>{x(null)},[]),L=or(_=>{const{panelDataArray:Q}=v.current,eu=rc(Q,_);eu>=0&&(Q.splice(eu,1),delete g.current[_.id],v.current.panelDataArrayChanged=!0)},[]),K=lOe(()=>({collapsePanel:A,direction:t,dragState:m,expandPanel:B,getPanelSize:j,getPanelStyle:R,groupId:D,isPanelCollapsed:w,isPanelExpanded:O,reevaluatePanelConstraints:M,registerPanel:T,registerResizeHandle:z,resizePanel:N,startDragging:I,stopDragging:P,unregisterPanel:L,panelGroupElement:h.current}),[A,m,t,B,j,R,D,w,O,M,T,z,N,I,P,L]),W={display:"flex",flexDirection:t==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return L3(SC.Provider,{value:K},L3(E,{...c,children:u,className:a,id:r,ref:h,style:{...W,...l},"data-panel-group":"","data-panel-group-direction":t,"data-panel-group-id":D}))}const Oau=oau((e,u)=>L3(zau,{...e,forwardedRef:u}));zau.displayName="PanelGroup";Oau.displayName="forwardRef(PanelGroup)";function rc(e,u){return e.findIndex(a=>a===u||a.id===u.id)}function t4(e,u,a){const t=rc(e,u),r=t===e.length-1?[t-1,t]:[t,t+1],i=a[t];return{...u.constraints,panelSize:i,pivotIndices:r}}function jOe({disabled:e,handleId:u,resizeHandler:a,panelGroupElement:t}){N4(()=>{if(e||a==null||t==null)return;const n=MC(u,t);if(n==null)return;const r=i=>{if(!i.defaultPrevented)switch(i.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{i.preventDefault(),a(i);break}case"F6":{i.preventDefault();const o=n.getAttribute("data-panel-group-id");d0(o,`No group element found for id "${o}"`);const s=Ah(o,t),l=kau(o,u,t);d0(l!==null,`No resize element found for id "${u}"`);const E=i.shiftKey?l>0?l-1:s.length-1:l+1<s.length?l+1:0;s[E].focus();break}}};return n.addEventListener("keydown",r),()=>{n.removeEventListener("keydown",r)}},[t,e,u,a])}function wau({children:e=null,className:u="",disabled:a=!1,hitAreaMargins:t,id:n,onDragging:r,style:i={},tabIndex:o=0,tagName:s="div",...l}){const E=Hn(null),c=Hn({onDragging:r});N4(()=>{c.current.onDragging=r});const D=sau(SC);if(D===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:h,groupId:m,registerResizeHandle:x,startDragging:p,stopDragging:f,panelGroupElement:g}=D,F=gz(n),[b,y]=dD("inactive"),[v,A]=dD(!1),[B,j]=dD(null),R=Hn({state:b});return R4(()=>{R.current.state=b}),N4(()=>{if(a)j(null);else{const O=x(F);j(()=>O)}},[a,F,x]),N4(()=>{var O,T;if(a||B==null)return;const z=E.current;d0(z,"Element ref not attached");const N=(M,I,P)=>{if(I)switch(M){case"down":{y("drag"),p(F,P);const{onDragging:L}=c.current;L&&L(!0);break}case"move":{const{state:L}=R.current;L!=="drag"&&y("hover"),B(P);break}case"up":{y("hover"),f();const{onDragging:L}=c.current;L&&L(!1);break}}else y("inactive")};return kOe(F,z,h,{coarse:(O=t==null?void 0:t.coarse)!==null&&O!==void 0?O:15,fine:(T=t==null?void 0:t.fine)!==null&&T!==void 0?T:5},N)},[h,a,t,x,F,B,p,f]),jOe({disabled:a,handleId:F,resizeHandler:B,panelGroupElement:g}),L3(s,{...l,children:e,className:u,id:n,onBlur:()=>A(!1),onFocus:()=>A(!0),ref:E,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...i},tabIndex:o,"data-panel-group-direction":h,"data-panel-group-id":m,"data-resize-handle":"","data-resize-handle-active":b==="drag"?"pointer":v?"keyboard":void 0,"data-resize-handle-state":b,"data-panel-resize-handle-enabled":!a,"data-panel-resize-handle-id":F})}wau.displayName="PanelResizeHandle";const Mau=({className:e,...u})=>d.jsx(Oau,{className:lu("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...u}),zp=cau,Tau=({withHandle:e,className:u,...a})=>d.jsx(wau,{className:lu("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",u),...a,children:e&&d.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-sm border",children:d.jsx(aDu,{className:"h-2.5 w-2.5"})})}),_b=e=>{const a=il().pathname===e.url;return d.jsx(Yf,{asChild:!0,isActive:a,children:d.jsxs(uo,{to:e.url,children:[e.icon,d.jsx("span",{children:e.title})]})})},NOe=()=>{const e=[{title:"Search",url:"/search",icon:d.jsx(sd,{})}];return d.jsx(y8,{children:e.map(u=>d.jsx(_b,{...u},u.url))})};var TC="Collapsible",[ROe,Ka0]=Tt(TC),[LOe,kz]=ROe(TC),Pau=C.forwardRef((e,u)=>{const{__scopeCollapsible:a,open:t,defaultOpen:n,disabled:r,onOpenChange:i,...o}=e,[s,l]=hn({prop:t,defaultProp:n??!1,onChange:i,caller:TC});return d.jsx(LOe,{scope:a,disabled:r,contentId:kt(),open:s,onOpenToggle:C.useCallback(()=>l(E=>!E),[l]),children:d.jsx(se.div,{"data-state":Az(s),"data-disabled":r?"":void 0,...o,ref:u})})});Pau.displayName=TC;var jau="CollapsibleTrigger",Nau=C.forwardRef((e,u)=>{const{__scopeCollapsible:a,...t}=e,n=kz(jau,a);return d.jsx(se.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":Az(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...t,ref:u,onClick:ju(e.onClick,n.onOpenToggle)})});Nau.displayName=jau;var vz="CollapsibleContent",Rau=C.forwardRef((e,u)=>{const{forceMount:a,...t}=e,n=kz(vz,e.__scopeCollapsible);return d.jsx(fn,{present:a||n.open,children:({present:r})=>d.jsx(_Oe,{...t,ref:u,present:r})})});Rau.displayName=vz;var _Oe=C.forwardRef((e,u)=>{const{__scopeCollapsible:a,present:t,children:n,...r}=e,i=kz(vz,a),[o,s]=C.useState(t),l=C.useRef(null),E=Xe(u,l),c=C.useRef(0),D=c.current,h=C.useRef(0),m=h.current,x=i.open||o,p=C.useRef(x),f=C.useRef(void 0);return C.useEffect(()=>{const g=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(g)},[]),Zt(()=>{const g=l.current;if(g){f.current=f.current||{transitionDuration:g.style.transitionDuration,animationName:g.style.animationName},g.style.transitionDuration="0s",g.style.animationName="none";const F=g.getBoundingClientRect();c.current=F.height,h.current=F.width,p.current||(g.style.transitionDuration=f.current.transitionDuration,g.style.animationName=f.current.animationName),s(t)}},[i.open,t]),d.jsx(se.div,{"data-state":Az(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!x,...r,ref:E,style:{"--radix-collapsible-content-height":D?`${D}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:x&&n})});function Az(e){return e?"open":"closed"}var IOe=Pau;const bz=IOe,Lau=Nau,_au=Rau;var yz="ContextMenu",[KOe,$a0]=Tt(yz,[y2]),$n=y2(),[$Oe,Iau]=KOe(yz),Kau=e=>{const{__scopeContextMenu:u,children:a,onOpenChange:t,dir:n,modal:r=!0}=e,[i,o]=C.useState(!1),s=$n(u),l=eo(t),E=C.useCallback(c=>{o(c),l(c)},[l]);return d.jsx($Oe,{scope:u,open:i,onOpenChange:E,modal:r,children:d.jsx(nW,{...s,dir:n,open:i,onOpenChange:E,modal:r,children:a})})};Kau.displayName=yz;var $au="ContextMenuTrigger",Vau=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,disabled:t=!1,...n}=e,r=Iau($au,a),i=$n(a),o=C.useRef({x:0,y:0}),s=C.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...o.current})}),l=C.useRef(0),E=C.useCallback(()=>window.clearTimeout(l.current),[]),c=D=>{o.current={x:D.clientX,y:D.clientY},r.onOpenChange(!0)};return C.useEffect(()=>E,[E]),C.useEffect(()=>void(t&&E()),[t,E]),d.jsxs(d.Fragment,{children:[d.jsx(rW,{...i,virtualRef:s}),d.jsx(se.span,{"data-state":r.open?"open":"closed","data-disabled":t?"":void 0,...n,ref:u,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:t?e.onContextMenu:ju(e.onContextMenu,D=>{E(),c(D),D.preventDefault()}),onPointerDown:t?e.onPointerDown:ju(e.onPointerDown,Rx(D=>{E(),l.current=window.setTimeout(()=>c(D),700)})),onPointerMove:t?e.onPointerMove:ju(e.onPointerMove,Rx(E)),onPointerCancel:t?e.onPointerCancel:ju(e.onPointerCancel,Rx(E)),onPointerUp:t?e.onPointerUp:ju(e.onPointerUp,Rx(E))})]})});Vau.displayName=$au;var VOe="ContextMenuPortal",Hau=e=>{const{__scopeContextMenu:u,...a}=e,t=$n(u);return d.jsx(iW,{...t,...a})};Hau.displayName=VOe;var Gau="ContextMenuContent",Jau=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=Iau(Gau,a),r=$n(a),i=C.useRef(!1);return d.jsx(oW,{...r,...t,ref:u,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:o=>{var s;(s=e.onCloseAutoFocus)==null||s.call(e,o),!o.defaultPrevented&&i.current&&o.preventDefault(),i.current=!1},onInteractOutside:o=>{var s;(s=e.onInteractOutside)==null||s.call(e,o),!o.defaultPrevented&&!n.modal&&(i.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Jau.displayName=Gau;var HOe="ContextMenuGroup",GOe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(sW,{...n,...t,ref:u})});GOe.displayName=HOe;var JOe="ContextMenuLabel",WOe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(lW,{...n,...t,ref:u})});WOe.displayName=JOe;var UOe="ContextMenuItem",Wau=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(EW,{...n,...t,ref:u})});Wau.displayName=UOe;var ZOe="ContextMenuCheckboxItem",QOe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(cW,{...n,...t,ref:u})});QOe.displayName=ZOe;var qOe="ContextMenuRadioGroup",YOe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(dW,{...n,...t,ref:u})});YOe.displayName=qOe;var XOe="ContextMenuRadioItem",uwe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(DW,{...n,...t,ref:u})});uwe.displayName=XOe;var ewe="ContextMenuItemIndicator",awe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(hW,{...n,...t,ref:u})});awe.displayName=ewe;var twe="ContextMenuSeparator",Uau=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(mW,{...n,...t,ref:u})});Uau.displayName=twe;var nwe="ContextMenuArrow",rwe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(xW,{...n,...t,ref:u})});rwe.displayName=nwe;var iwe="ContextMenuSubTrigger",owe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(fW,{...n,...t,ref:u})});owe.displayName=iwe;var swe="ContextMenuSubContent",lwe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(pW,{...n,...t,ref:u,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});lwe.displayName=swe;function Rx(e){return u=>u.pointerType!=="mouse"?e(u):void 0}var Ewe=Kau,cwe=Vau,dwe=Hau,Dwe=Jau,Zau=Wau,hwe=Uau;function Op({...e}){return d.jsx(Ewe,{"data-slot":"context-menu",...e})}function wp({...e}){return d.jsx(cwe,{"data-slot":"context-menu-trigger",...e})}function Mp({className:e,...u}){return d.jsx(dwe,{children:d.jsx(Dwe,{"data-slot":"context-menu-content",className:lu("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-context-menu-content-available-height) origin-(--radix-context-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",e),...u})})}const qr=C.forwardRef(({className:e,inset:u,variant:a="default",...t},n)=>d.jsx(Zau,{ref:n,"data-slot":"context-menu-item","data-inset":u,"data-variant":a,className:lu("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...t}));qr.displayName=Zau.displayName;function Lx({className:e,...u}){return d.jsx(hwe,{"data-slot":"context-menu-separator",className:lu("bg-border -mx-1 my-1 h-px",e),...u})}var Qau="AlertDialog",[mwe,Va0]=Tt(Qau,[AH]),ll=AH(),qau=e=>{const{__scopeAlertDialog:u,...a}=e,t=ll(u);return d.jsx(r2,{...t,...a,modal:!0})};qau.displayName=Qau;var xwe="AlertDialogTrigger",Yau=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,...t}=e,n=ll(a);return d.jsx(IH,{...n,...t,ref:u})});Yau.displayName=xwe;var fwe="AlertDialogPortal",Xau=e=>{const{__scopeAlertDialog:u,...a}=e,t=ll(u);return d.jsx(i2,{...t,...a})};Xau.displayName=fwe;var pwe="AlertDialogOverlay",utu=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,...t}=e,n=ll(a);return d.jsx(dd,{...n,...t,ref:u})});utu.displayName=pwe;var Vc="AlertDialogContent",[gwe,Cwe]=mwe(Vc),Fwe=wV("AlertDialogContent"),etu=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,children:t,...n}=e,r=ll(a),i=C.useRef(null),o=Xe(u,i),s=C.useRef(null);return d.jsx(sfu,{contentName:Vc,titleName:atu,docsSlug:"alert-dialog",children:d.jsx(gwe,{scope:a,cancelRef:s,children:d.jsxs(Dd,{role:"alertdialog",...r,...n,ref:o,onOpenAutoFocus:ju(n.onOpenAutoFocus,l=>{var E;l.preventDefault(),(E=s.current)==null||E.focus({preventScroll:!0})}),onPointerDownOutside:l=>l.preventDefault(),onInteractOutside:l=>l.preventDefault(),children:[d.jsx(Fwe,{children:t}),d.jsx(vwe,{contentRef:i})]})})})});etu.displayName=Vc;var atu="AlertDialogTitle",ttu=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,...t}=e,n=ll(a);return d.jsx(lm,{...n,...t,ref:u})});ttu.displayName=atu;var ntu="AlertDialogDescription",rtu=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,...t}=e,n=ll(a);return d.jsx(Em,{...n,...t,ref:u})});rtu.displayName=ntu;var kwe="AlertDialogAction",itu=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,...t}=e,n=ll(a);return d.jsx(o2,{...n,...t,ref:u})});itu.displayName=kwe;var otu="AlertDialogCancel",stu=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,...t}=e,{cancelRef:n}=Cwe(otu,a),r=ll(a),i=Xe(u,n);return d.jsx(o2,{...r,...t,ref:i})});stu.displayName=otu;var vwe=({contentRef:e})=>{const u=`\`${Vc}\` requires a description for the component to be accessible for screen reader users.
|
|
539
|
+
${K}`),I.pop(),`{${eu}}`}case"number":return isFinite(M)?String(M):F?F(M):"null";case"boolean":return M===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(M);default:return F?F(M):void 0}}function T(N,M,I){switch(typeof M){case"string":return r(M);case"object":{if(M===null)return"null";if(typeof M.toJSON=="function"){if(M=M.toJSON(N),typeof M!="object")return T(N,M,I);if(M===null)return"null"}if(I.indexOf(M)!==-1)return b;let P="";const L=M.length!==void 0;if(L&&Array.isArray(M)){if(M.length===0)return"[]";if(B<I.length+1)return'"[Array]"';I.push(M);const eu=Math.min(M.length,j);let U=0;for(;U<eu-1;U++){const tu=T(String(U),M[U],I);P+=tu!==void 0?tu:"null",P+=","}const iu=T(String(U),M[U],I);if(P+=iu!==void 0?iu:"null",M.length-1>j){const tu=M.length-j-1;P+=`,"... ${m(tu)} not stringified"`}return I.pop(),`[${P}]`}let K=Object.keys(M);const W=K.length;if(W===0)return"{}";if(B<I.length+1)return'"[Object]"';let _="",Q=Math.min(W,j);L&&s(M)&&(P+=l(M,",",j),K=K.slice(M.length),Q-=M.length,_=","),v&&(K=i(K,A)),I.push(M);for(let eu=0;eu<Q;eu++){const U=K[eu],iu=T(U,M[U],I);iu!==void 0&&(P+=`${_}${r(U)}:${iu}`,_=",")}if(W>j){const eu=W-j;P+=`${_}"...":"${m(eu)} not stringified"`}return I.pop(),`{${P}}`}case"number":return isFinite(M)?String(M):F?F(M):"null";case"boolean":return M===!0?"true":"false";case"undefined":return;case"bigint":if(y)return String(M);default:return F?F(M):void 0}}function z(N,M,I){if(arguments.length>1){let P="";if(typeof I=="number"?P=" ".repeat(Math.min(I,10)):typeof I=="string"&&(P=I.slice(0,10)),M!=null){if(typeof M=="function")return R("",{"":N},[],M,P,"");if(Array.isArray(M))return w("",N,[],x(M),P,"")}if(P.length!==0)return O("",N,[],P,"")}return T("",N,[])}return z}})(yb,yb.exports);var wBe=yb.exports;const _eu=al(wBe);_eu.configure;var Tx={};_eu.configure({deterministic:!1});const hj=q.enum(["debug","info","warn","error"]);typeof window>"u"&&typeof process<"u"&&hj.safeParse(Tx==null?void 0:Tx.MOMENTIC_DEV_LOG_LEVEL).success&&hj.parse(Tx.MOMENTIC_DEV_LOG_LEVEL);const MBe=De(mC.extend({id:k(),name:k(),description:k().optional(),labels:k().array().optional()})),TBe=De(mC.extend({id:k(),name:k(),description:k().optional(),content:fq}));S({name:k(),description:k().optional(),settings:Sm.optional(),pathSegments:k().array(),defaultEnv:k().optional()});S({id:k(),fileName:k(),fullPath:k(),relativeFilePath:k().describe("relative to project root")});tSu.extend({name:k()});S({steps:oC.array().optional(),settings:Sm.optional()});S({message:J("ok")});S({name:V1.optional(),description:k().min(1).optional(),settings:Sm.optional(),disabled:cu().optional()});const PBe=S({message:k(),newRelativeTestPath:k().optional()});S({tag:k(),channel:k(),filePath:k()});S({name:V1});S({tests:MBe,modules:TBe,labels:k().array()});S({name:k(),description:k(),enabled:cu()}).partial();S({name:k(),description:k(),enabled:cu(),steps:oC.array(),testFilePath:k().describe("relative to the project root"),folderPath:k().optional().describe("user selected folder path")});S({packages:k().array()});const Ieu=S({id:k(),createdAt:ce.date(),createdBy:k(),organizationId:k(),name:k(),description:k().nullish(),enabled:cu(),schemaVersion:k().describe("Schema version for steps"),parameters:k().array().nullish().describe("Parameter list"),parameterEnums:$u(k(),k().array()).nullish(),defaultParameters:$u(k(),k()).nullish(),defaultCacheKey:k().nullish(),defaultCacheTtl:uu().nullish(),defaultCacheAllInvocations:cu().nullish(),autoAuth:cu().nullish(),advanced:ZZ.nullish()});Ieu.extend({steps:j0(()=>P4.array())});ym.merge(Ieu.omit({id:!0,createdAt:!0,createdBy:!0,organizationId:!0,enabled:!0}));const jBe=jS.extend({aiAction:cu().optional(),stepLintSuggestions:cu().optional(),agentConfig:$u(k(),k()).optional(),aiFailureAnalysis:cu().optional(),aiPageFiltering:cu().optional().describe("rag v2 feature flag")}),NBe=S({cliOnly:cu().optional()}),RBe=S({fakerConstantSeed:cu().optional()});S({ai:jBe.optional(),githubAppInstallationId:uu().nullish(),githubAppSummaryMessageEnabled:cu().nullish(),githubReleaseAppInstallationId:uu().nullish(),gitlabAppAccessToken:k().nullish(),gitlabAppBaseUrl:k().nullish(),qaseAccessToken:k().nullish(),testSuggestionsEnabled:cu().nullish(),browser:jQ.optional(),internal:NBe.optional(),advanced:RBe.optional()});S({globalOverrides:$u(k()).optional(),agentConfig:$u(k(),k()).optional()});$u(k(),k()).nullish();var iz=(e=>(e.TEST_REVIEW="TEST_REVIEW",e))(iz||{});const LBe=S({type:J("DESCRIPTION_UPDATE"),thoughts:k()}),vp=Oe("type",[LBe]),_Be=S({testId:k(),name:k(),orgId:k(),runId:k(),steps:zr.array(),purpose:Ku(iz),details:vp.or(vp.array()).optional()});_Be.pick({name:!0,orgId:!0});const IBe=S({id:k(),name:k().nullish(),createdAt:k().pipe(ce.date()).or(us()),organizationId:k(),schemaVersion:k(),runId:k().nullish(),purpose:Ku(iz),details:vp.or(vp.array()).optional(),applied:cu().nullish(),appliedAt:ce.date().nullish()}),KBe=IBe.extend({steps:zr.array()});S({error:cu(),reason:k(),message:k()});bt.merge(WQ);bt.merge(WQ);bt.merge(UBu).extend({useConsensus:cu().optional(),attemptNumber:uu().optional()});bt.merge(QBu);bt.merge(qBu);bt.merge(YBu);bt.merge(ZBu);bt.merge(HBu);bt.merge(GBu);bt.merge(JBu);bt.merge(a8u);bt.merge(t8u);S({testPaths:k().array().describe("can be either hyphenated, lowercase test names or UUIDs"),env:k().optional(),all:cu().optional(),urlOverride:k().optional(),customHeaders:$u(k(),k()).optional(),testInputMatrix:$u(k(),k()).array().optional()});S({queuedTests:Le().array(),runIds:k().uuid().array(),runGroupId:k().optional()});k().array();ma([S({paths:k().array().describe("run specific test paths (e.g. todo-test)"),all:cu().describe("run all tests").optional()}),S({path:k().describe("deprecated; present for backcompat")})]);S({tests:$u(k().describe("Test name"),k().describe("Test YAML")),modules:$u(k().describe("Module name"),k().describe("Module YAML"))});const $Be=S({test:k().describe("test YAML"),modules:$u(k().describe("moduleId"),k().describe("module YAML"))});$Be.array();S({testId:k(),schemaVersion:k()}).merge(BS);S({entries:De(AAu),testId:k()});S({entries:De(R8u),testId:k()});S({testId:k()});function Keu(e){return $u(Le()).transform(u=>{const a={};for(const[t,n]of Object.entries(u)){const r=e.safeParse(n);r.success&&(a[t]=r.data)}return a})}Keu(bAu);Keu(L8u);const VBe=S({trigger:Ku(yd),status:Ku(Nn),startedAt:ce.date().optional(),gitCommitSha:k().optional(),gitCommitShaShort:k().optional(),gitCommitTimestamp:ce.date().optional(),gitBranchName:k().optional(),gitOriginUrl:k().optional(),gitCommitMessage:k().optional(),gitCommitAuthorName:k().optional(),githubRepository:k().optional(),gitlabProjectPath:k().optional(),pipelineId:k().optional(),cliVersion:k().optional()});S({id:k()});const HBe=S({status:Ku(Nn),updatedAt:ce.date().optional(),finishedAt:ce.date().optional()}),GBe=S({stepsSnapshot:De($u(Le())).optional(),runGroupId:k().optional(),testId:k(),testName:k(),resolvedBaseUrl:k().optional(),environmentName:k().optional(),labels:De(k()).optional(),cliVersion:k().optional(),trigger:Ku(yd),schemaVersion:k().optional(),section:Ku(_S).optional(),resolvedInputs:$u(k(),k()).optional(),quarantined:cu().optional().default(!1),quarantinedReason:k().optional()});S({id:k()});const JBe=HQ.pick({id:!0,status:!0,testName:!0,testId:!0,test:!0,failureReason:!0,failureDetails:!0});JBe.array();const WBe=HQ.pick({startedAt:!0,finishedAt:!0,updatedAt:!0,results:!0,beforeResults:!0,afterResults:!0,status:!0,failureDetails:!0,failureReason:!0,resolvedBaseUrl:!0,environmentName:!0,labels:!0,cliVersion:!0,resolvedInputs:!0,attempts:!0,flake:!0}).partial();S({id:k()});const UBe=S({status:Ku(Nn),finishedAt:ce.date().optional(),schemaVersion:k().optional().default("1.0.19"),results:$u(k(),Le()).array().optional(),beforeResults:$u(k(),Le()).array().optional(),afterResults:$u(k(),Le()).array().optional()});S({screenshot:k()});S({key:k()});S({orgId:k(),userId:k()});De(Xyu);$u(k(),ma([k(),cu()]));S({paths:k().array(),env:k().optional(),urlOverride:k().optional(),customHeaders:$u(k(),k()).optional()});S({suiteRunIds:k().array(),runGroupIds:k().array()});S({suiteRunIds:k().array()});jBu.array();S({runGroupIds:k().array()});const ZBe=S({uploadUrl:k()});bt.merge(XBu);bt.merge(e8u);bt.merge(u8u);const QBe=S({testId:k().optional().default(""),testName:k().optional().default(""),suiteId:k().optional().default(""),suiteName:k().optional().default(""),creditsUsed:uu().optional()}),qBe=S({transactionId:k(),timestamp:k(),event:Ku(bq),properties:QBe});qBe.array();KBe.omit({steps:!0}).extend({steps:De($u(k(),Le())).describe("unparsed ResolvedStep[]")});S({limit:uu().max(10).optional(),afterTime:uu().optional()});SBu.array();S({applied:cu().optional(),appliedAt:ce.date().optional()});ZBe.extend({id:k()});S({runGroupId:k().uuid().optional()});S({runGroupId:k().uuid()});S({quarantined:S({testId:k().uuid(),quarantinedAt:ce.date(),quarantinedBy:k().optional(),quarantinedReason:k()}).array()});S({testId:k().uuid(),testName:k().optional(),reason:k(),gitLocalUsername:k().optional(),gitLocalEmail:k().optional(),gitLocalName:k().optional()});S({testName:k().optional(),reason:k().optional(),gitLocalUsername:k().optional(),gitLocalEmail:k().optional(),gitLocalName:k().optional()});bt.merge(vSu);bt.merge(ASu);bt.merge(bSu);S({apkToInstall:S({channel:k(),tag:k().optional()}).optional(),hostname:k().optional(),region:Ku(a1).optional(),osVersion:Ku(_l).optional(),sessionId:k().optional()});S({name:k(),webRtcUrl:k(),adbUrl:k(),token:k(),apkDownloadUrl:k().optional(),playwrightServerUrl:k().optional(),region:k().optional()});S({hostname:k().optional(),region:Ku(a1).optional(),osVersion:Ku(cq).optional(),sessionId:k().optional()});S({id:k(),apiUrl:k(),webRtcUrl:k(),wdaUrl:k(),token:k(),region:k().optional()});S({channel:k(),tag:k(),md5:k()});S({id:k(),uploadUrl:k().optional(),downloadUrl:k(),md5:k().optional()});S({assets:De(S({channel:k(),tag:k(),md5:k(),createdAt:uu().describe("Unix timestamp in milliseconds")}))});const $eu=7,YBe=3;S({localTestId:k(),quarantinedAt:us(),quarantinedBy:k().optional(),quarantinedReason:k(),quarantinedByGitEmail:k().optional(),quarantinedByGitName:k().optional(),quarantinedByGitUsername:k().optional()}).or(S({cloudTestId:k(),quarantinedAt:us(),quarantinedBy:k().optional(),quarantinedReason:k(),quarantinedByGitEmail:k().optional(),quarantinedByGitName:k().optional(),quarantinedByGitUsername:k().optional()}));var Veu=(e=>(e.QUARANTINE="QUARANTINE",e.UNQUARANTINE="UNQUARANTINE",e))(Veu||{});const oz=S({name:k(),description:k().nullish(),effect:Ku(Veu),labels:De(k()).nullish(),githubRepository:k().nullish(),gitlabProjectPath:k().nullish(),gitBranchName:k().nullish(),slackNotificationChannel:k().nullish()}),XBe=S({type:J("LAST_N_RUNS"),lastN:uu().min(YBe)}),u8e=S({type:J("LAST_N_HOURS"),lastN:uu().min(1).max($eu*24)}),e8e=S({type:J("LAST_N_DAYS"),lastN:uu().min(1).max($eu)}),sz=Oe("type",[XBe,u8e,e8e]),a8e=S({flakeRateThreshold:uu().min(1).max(100),evaluationWindow:sz}),t8e=oz.extend({type:J("FLAKE_RATE"),config:a8e}),n8e=S({passRateThreshold:uu().min(1).max(100),evaluationWindow:sz}),r8e=oz.extend({type:J("PASS_RATE"),config:n8e}),i8e=S({failureCountThreshold:uu().min(0),evaluationWindow:sz}),o8e=oz.extend({type:J("FAILURE_COUNT"),config:i8e});Oe("type",[t8e,r8e,o8e]);S({repositoriesIndexed:cu(),indexingInProgress:cu(),indexesOutdated:cu()});var Heu=(e=>(e.Queued="queued",e.InProgress="in_progress",e.Completed="completed",e.Waiting="waiting",e.Requested="requested",e.Pending="pending",e))(Heu||{}),Geu=(e=>(e.Success="success",e.Failure="failure",e.Neutral="neutral",e.Cancelled="cancelled",e.Skipped="skipped",e.TimedOut="timed_out",e.ActionRequired="action_required",e))(Geu||{});S({name:k(),status:Ku(Heu),conclusion:Ku(Geu).nullable()});S({sha:k(),message:k(),author:S({name:k().optional(),email:k().optional(),date:ce.date().optional()}),committer:S({name:k().optional(),email:k().optional(),date:ce.date().optional()})});S({mergedBranch:k().optional()});const Jeu=S({orgId:k(),cacheKeys:k().array()});S({keyParams:Jeu,clientMetadata:k(),lockAcquisitionTimeoutMs:uu().optional()});S({acquired:cu(),acquiredByMetadata:k(),keyPrefix:k()});S({keyPrefix:k(),result:k(),ttlMs:uu()});ma([S({keyPrefix:k()}),Jeu]);const s8e=S({remainingTtlMs:uu(),value:k().nullish()});S({results:$u(k(),s8e),activeLocks:k().array()});S({quarantineNotifications:k().nullish()});const l8e=S({version:k(),json:$u(Le()),hash:k()}),Weu=$u(Le());S({newSvgs:De(l8e),metadata:Weu.optional()});const E8e=S({version:k(),json:$u(Le()).nullish(),hash:k(),description:k().nullish(),metadata:Weu.nullish()});$u(k().describe("icon hash"),E8e);const Bb=S({assertion:k().describe("A human readable assertion that evaluates to either true or false depending on the state of the system.")}),c8e=S({instruction:k().describe("Human readable instruction to execute the step. Instructions should only describe concrete actions that need to be taken. Any checks or assertions should be described in the preConditions, postConditions, or expectedResults."),expectedResults:Bb.array().optional().describe("Human readable description of the expected results after the step is executed. Each expected result should contain a single assertion that evaluates to true or false.")}),Ueu=c8e.extend({subSteps:j0(()=>Ueu.array().optional()).describe("More granular steps to be take to achieve the current step's higher level objective.")}),Zeu=S({name:k().describe("Short name describing the test plan"),description:k().nullish().transform(e=>e??void 0).describe("Longer form description of the high level goal of the test plan")}),Qeu=Zeu.extend({id:k(),createdAt:ce.date(),updatedAt:ce.date(),updatedBy:k(),createdBy:k(),test:S({id:k(),name:k()}).nullish().transform(e=>e??void 0)});Qeu.extend({testGenRuns:C1([]).or(C1([S({id:k(),startedAt:ce.date(),status:Ku(Nn)})]))});const qeu=S({preConditions:Bb.array().nullish().transform(e=>e??[]),postConditions:Bb.array().nullish().transform(e=>e??[]),steps:Ueu.array().nullish().transform(e=>e??[])});Qeu.extend({plan:qeu.nullish().transform(e=>e??{preConditions:[],postConditions:[],steps:[]})});const d8e=Zeu.extend({plan:qeu.nullish().transform(e=>e??{preConditions:[],postConditions:[],steps:[]})});d8e.array().nullish().transform(e=>e??[]);class hh extends String{}const D8e=new Set(["<",">","<=",">="]),h8e=e=>`\\u${e.toString(16).padStart(4,"0")}`,m8e=e=>{if([1/0,-1/0,NaN,void 0,null].includes(e))return`${e}`;if(!["string","boolean","number"].includes(typeof e)){if(typeof e!="object")throw new Error("Unexpected value type");const a=Object.getPrototypeOf(e);if(!(a===Array.prototype&&Array.isArray(e)||a===Object.prototype))throw new Error("Unexpected object given as value")}return JSON.stringify(e).replace(/([{,])"__proto__":/g,'$1["__proto__"]:').replace(/[^\\]"__proto__":/g,()=>{throw new Error("Unreachable")}).replace(/[\u2028\u2029]/g,a=>h8e(a.charCodeAt(0)))},xC=(e,...u)=>{const a=e.replace(/%[%drscjw]/g,t=>{if(t==="%%")return"%";if(u.length===0)throw new Error("Unexpected arguments count");const n=u.shift();switch(t){case"%d":if(typeof n=="number")return n;throw new Error("Expected a number");case"%r":if(n instanceof RegExp)return xC("new RegExp(%j, %j)",n.source,n.flags);throw new Error("Expected a RegExp instance");case"%s":if(n instanceof hh)return n;throw new Error("Expected a safe string");case"%c":if(D8e.has(n))return n;throw new Error("Expected a compare op");case"%j":return m8e(n);case"%w":if(Number.isInteger(n)&&n>=0)return" ".repeat(n);throw new Error("Expected a non-negative integer for indentation")}throw new Error("Unreachable")});if(u.length!==0)throw new Error("Unexpected arguments count");return new hh(a)},Sb=e=>{if(!/^[a-z][a-z0-9_]*$/i.test(e))throw new Error("Does not look like a safe id");return new hh(e)},Yeu=e=>(...u)=>{if(!u.every(a=>a instanceof hh))throw new Error("Unsafe arguments");return new hh(e(...u))},x8e=e=>/^[a-z][a-z0-9_().]*$/i.test(e)||/^\([^()]+\)$/i.test(e)?e:xC("(%s)",e),f8e=Yeu((...e)=>e.some(u=>`${u}`=="true")?"true":e.join(" || ")||"false"),p8e=Yeu((...e)=>e.some(u=>`${u}`=="false")?"false":e.join(" && ")||"true"),Xeu=e=>`${e}`=="true"?Sb("false"):`${e}`=="false"?Sb("true"):xC("!%s",x8e(e)),g8e=(...e)=>Xeu(f8e(...e));var C8e={format:xC,safe:Sb,safeand:p8e,safenot:Xeu,safenotor:g8e};const F8e=e=>/[\uD800-\uDFFF]/.test(e)?[...e].length:e.length,k8e=(e,u,a,t)=>{if(e%u===0)return!0;let n=e*a;if((n===1/0||n===-1/0)&&(n=e),n%t===0)return!0;const r=Math.floor(n+.5);return r/a===e&&r%t===0},mh=(e,u)=>{if(e===u)return!0;if(!e||!u||typeof e!=typeof u||e!==u&&typeof e!="object")return!1;const a=Object.getPrototypeOf(e);if(a!==Object.getPrototypeOf(u))return!1;if(a===Array.prototype)return!Array.isArray(e)||!Array.isArray(u)||e.length!==u.length?!1:e.every((t,n)=>mh(t,u[n]));if(a===Object.prototype){const[t,n]=[Object.keys(e),Object.keys(u)];return t.length!==n.length?!1:new Set([...t,...n]).size===t.length&&t.every(i=>mh(e[i],u[i]))}return!1},v8e=e=>{if(e.length<2)return!0;if(e.length===2)return!mh(e[0],e[1]);const u=[],a=e.length>20?new Set:null;let t=0,n=0;for(const r of e){if(typeof r=="object")u.push(r);else if(a){if(a.add(r),a.size!==++t)return!1}else if(e.indexOf(r,n+1)!==-1)return!1;n++}for(let r=1;r<u.length;r++)for(let i=0;i<r;i++)if(mh(u[r],u[i]))return!1;return!0},A8e=e=>{if(typeof Buffer<"u")return Buffer.from(e,"base64").toString("utf-8");const u=atob(e);return new TextDecoder("utf-8").decode(new Uint8Array(u.length).map((a,t)=>u.charCodeAt(t)))},u0u=Function.prototype.call.bind(Object.prototype.hasOwnProperty);u0u[Symbol.for("toJayString")]="Function.prototype.call.bind(Object.prototype.hasOwnProperty)";const e0u=e=>/~\//.test(e)?`${e}`.replace(/~/g,"~0").replace(/\//g,"~1"):e,b8e=e=>e.length===0?"#":`#/${e.map(e0u).join("/")}`,y8e=({keywordLocation:e,instanceLocation:u},a,t)=>({keywordLocation:`${a}${e.slice(1)}`,instanceLocation:`${t}${u.slice(1)}`}),B8e=(e,[u,a])=>u.includes(!0)||u.some(t=>t===e)||a.some(t=>new RegExp(t,"u").test(e)),S8e=(e,u)=>(e.filter(a=>a[u])[0]||{})[u],z8e={toPointer:b8e,pointerPart:e0u,errorMerge:y8e,propertyIn:B8e,dynamicResolve:S8e};var O8e={stringLength:F8e,isMultipleOf:k8e,deepEqual:mh,unique:v8e,deBase64:A8e,hasOwn:u0u,...z8e};const{format:a4,safe:ja0}=C8e;new Map(Object.entries({null:e=>a4("%s === null",e),boolean:e=>a4('typeof %s === "boolean"',e),array:e=>a4("Array.isArray(%s)",e),object:e=>a4('typeof %s === "object" && %s && !Array.isArray(%s)',e,e,e),number:e=>a4('typeof %s === "number"',e),integer:e=>a4("Number.isInteger(%s)",e),string:e=>a4('typeof %s === "string"',e)}));new Set([].concat(...[Object,Array,String,Number,Boolean].map(e=>Object.getOwnPropertyNames(e.prototype))));const mj={email:e=>{if(e.length>318)return!1;if(/^[a-z0-9!#$%&'*+/=?^_`{|}~-]{1,20}(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]{1,21}){0,2}@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,60}[a-z0-9])?){0,3}$/i.test(e))return!0;if(!e.includes("@")||/(^\.|^"|\.@|\.\.)/.test(e))return!1;const[a,t,...n]=e.split("@");return!a||!t||n.length!==0||a.length>64||t.length>253||!/^[a-z0-9.-]+$/i.test(t)||!/^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+$/i.test(a)?!1:t.split(".").every(r=>/^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/i.test(r))},hostname:e=>e.length>(e.endsWith(".")?254:253)?!1:/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.?$/i.test(e),date:e=>{if(e.length!==10)return!1;if(e[5]==="0"&&e[6]==="2"){if(/^\d\d\d\d-02-(?:[012][1-8]|[12]0|[01]9)$/.test(e))return!0;const u=e.match(/^(\d\d\d\d)-02-29$/);if(!u)return!1;const a=u[1]|0;return a%16===0||a%4===0&&a%25!==0}return e.endsWith("31")?/^\d\d\d\d-(?:0[13578]|1[02])-31$/.test(e):/^\d\d\d\d-(?:0[13-9]|1[012])-(?:[012][1-9]|[123]0)$/.test(e)},time:e=>{if(e.length>27||!/^(?:2[0-3]|[0-1]\d):[0-5]\d:(?:[0-5]\d|60)(?:\.\d+)?(?:z|[+-](?:2[0-3]|[0-1]\d)(?::?[0-5]\d)?)?$/i.test(e))return!1;if(!/:60/.test(e))return!0;const a=e.match(/([0-9.]+|[^0-9.])/g);let t=Number(a[0])*60+Number(a[2]);return a[5]==="+"?t+=24*60-Number(a[6]||0)*60-Number(a[8]||0):a[5]==="-"&&(t+=Number(a[6]||0)*60+Number(a[8]||0)),t%(24*60)===23*60+59},"date-time":e=>{if(e.length>38)return!1;const u=/^\d\d\d\d-(?:0[1-9]|1[0-2])-(?:[0-2]\d|3[01])[t\s](?:2[0-3]|[0-1]\d):[0-5]\d:(?:[0-5]\d|60)(?:\.\d+)?(?:z|[+-](?:2[0-3]|[0-1]\d)(?::?[0-5]\d)?)$/i,a=e[5]==="0"&&e[6]==="2";if(a&&e[8]==="3"||!u.test(e))return!1;if(e[17]==="6"){const t=e.slice(11).match(/([0-9.]+|[^0-9.])/g);let n=Number(t[0])*60+Number(t[2]);if(t[5]==="+"?n+=24*60-Number(t[6]||0)*60-Number(t[8]||0):t[5]==="-"&&(n+=Number(t[6]||0)*60+Number(t[8]||0)),n%(24*60)!==23*60+59)return!1}if(a){if(/^\d\d\d\d-02-(?:[012][1-8]|[12]0|[01]9)/.test(e))return!0;const t=e.match(/^(\d\d\d\d)-02-29/);if(!t)return!1;const n=t[1]|0;return n%16===0||n%4===0&&n%25!==0}return e[8]==="3"&&e[9]==="1"?/^\d\d\d\d-(?:0[13578]|1[02])-31/.test(e):/^\d\d\d\d-(?:0[13-9]|1[012])-(?:[012][1-9]|[123]0)/.test(e)},ipv4:e=>e.length<=15&&/^(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)$/.test(e),ipv6:e=>{if(e.length>45||e.length<2)return!1;let u=0,a=0,t=0,n=!1,r=!1,i=0,o=!0;for(let l=0;l<e.length;l++){const E=e.charCodeAt(l);if(l===1&&i===58&&E!==58)return!1;if(E>=48&&E<=57){if(++t>4)return!1}else if(E===46){if(u>6||a>=3||t===0||r)return!1;a++,t=0}else if(E===58){if(a>0||u>=7)return!1;if(i===58){if(n)return!1;n=!0}else l===0&&(o=!1);u++,t=0,r=!1}else if(E>=97&&E<=102||E>=65&&E<=70){if(a>0||++t>4)return!1;r=!0}else return!1;i=E}if(u<2||a>0&&(a!==3||t===0))return!1;if(n&&e.length===2)return!0;if(a>0&&!/(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/.test(e))return!1;const s=a>0?6:7;return n?(o||t>0)&&u<s:u===s&&o&&t>0},uri:/^[a-z][a-z0-9+\-.]*:(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|v[0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/?(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-reference":/^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|v[0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/?(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?)?(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,"uri-template":/^(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2}|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,"json-pointer":/^(?:|\/(?:[^~]|~0|~1)*)$/,"relative-json-pointer":/^(?:0|[1-9][0-9]*)(?:|#|\/(?:[^~]|~0|~1)*)$/,uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,duration:e=>e.length>1&&e.length<80&&(/^P\d+([.,]\d+)?W$/.test(e)||/^P[\dYMDTHS]*(\d[.,]\d+)?[YMDHS]$/.test(e)&&/^P([.,\d]+Y)?([.,\d]+M)?([.,\d]+D)?(T([.,\d]+H)?([.,\d]+M)?([.,\d]+S)?)?$/.test(e))};mj.hostname,mj.ipv4;const{toPointer:Na0,...w8e}=O8e,M8e=new Map(Object.entries({boolean:e=>typeof e=="boolean",array:e=>Array.isArray(e)&&Object.getPrototypeOf(e)===Array.prototype,object:e=>e&&Object.getPrototypeOf(e)===Object.prototype,finite:e=>Number.isFinite(e),natural:e=>Number.isInteger(e)&&e>=0,string:e=>typeof e=="string",jsonval:e=>w8e.deepEqual(e,JSON.parse(JSON.stringify(e)))}));M8e.get("object");S({parentStepIdChain:De(k()),result:Ms});const T8e=S({step:zr,status:Ku(E0),startedAt:ce.date(),finishedAt:ce.date().optional(),healMetadata:S({healType:Ku(rQ).or(J("AI")),healedAt:ce.date()}).optional(),beforeSnapshotId:k().uuid().optional(),afterSnapshotId:k().uuid().optional(),message:k().optional()}),P8e=T8e.extend({finishedAt:ce.date().optional().transform(e=>e??new Date)});P8e.extend({step:Le()});const lz=S({avdId:k().optional(),channel:k().optional(),tag:k().optional()}),Ez=UBe.extend({id:k().uuid().optional(),startedAt:ce.date(),runAttemptSchemaVersion:k().optional(),schemaVersion:k().optional().default("1.0.19"),results:$u(k(),Le()).array().optional(),beforeResults:$u(k(),Le()).array().optional(),afterResults:$u(k(),Le()).array().optional(),assetDetails:lz.optional(),activeVideos:De(S({videoName:k(),timestamp:ce.date()})).optional()}),a0u=Ez.extend({assetDetails:lz.optional(),finishedAt:ce.date().optional().transform(e=>e??new Date)});Ez.merge(TS);a0u.merge(TS);const t0u=S({results:De(Ms),beforeResults:De(Ms).optional(),afterResults:De(Ms).optional()});Ez.merge(t0u);a0u.merge(t0u);const n0u=WBe.merge(GBe).extend({executionType:Ku(ch).optional().default(ch.WEB),testId:k().uuid(),testDescription:k().optional(),runGroupId:k().uuid(),status:Ku(Nn),startedAt:ce.date(),attempts:uu(),failureRecoveryDetails:S({attempts:uu()}).optional()}),j8e=n0u.merge(lz);n0u.extend({finishedAt:ce.date().optional().transform(e=>e??new Date)});j8e.extend({finishedAt:ce.date().optional().transform(e=>e??new Date)});const N8e=VBe.merge(HBe).extend({id:k().uuid().optional(),startedAt:ce.date(),cliVersion:k(),labels:k().array().optional().default([])});N8e.extend({updatedAt:ce.date().optional().transform(e=>e??new Date),finishedAt:ce.date().optional().transform(e=>e??new Date)});const xh=e=>d.jsxs("a",{href:`https://momentic.ai/docs${e.slug}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary inline-flex flex-row items-center gap-1 underline",children:["Docs",d.jsx(KDu,{className:"size-4"})]}),zd=C.forwardRef(({className:e,...u},a)=>d.jsx("textarea",{className:lu("border-input placeholder:text-muted-foreground focus-visible:ring-ring flex min-h-[60px] w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 disabled:cursor-not-allowed disabled:opacity-50",e),ref:a,...u}));zd.displayName="Textarea";const Ba="__NONE__",r0u=[...Object.values(a1),...Object.values(Bt)],i0u={[a1.US_WEST_1]:"US West",[a1.EU_NORTH_1]:"EU North",[a1.AS_SOUTH_1]:"Asia South",[Bt.LOCAL]:"Local"};function o0u(e){const u=typeof(e==null?void 0:e.variables[P3])=="string"?e.variables[P3].trim():void 0,a=typeof(e==null?void 0:e.variables[Eh])=="string"?e.variables[Eh].trim():void 0;return{envLocalAvdId:u,envLocalApkPath:a}}const fC=e=>ns("/api/environments",e),R8e=S({name:V1,description:k().min(1)}),L8e=S({region:KS.or(J(Ba)).optional(),channel:k().optional(),tag:k().optional(),env:k().optional(),defaultApkFilePath:Cp,localEmulatorSettings:S({avdId:Cp}).optional()});function _8e(e){return aS(R8e,L8e.superRefine((u,a)=>{var s;if(!(u.region===Bt.LOCAL))return;const n=u.env,r=typeof n=="string"?e==null?void 0:e.find(l=>l.name===n):void 0,{envLocalAvdId:i}=o0u(r),o=((s=u.localEmulatorSettings)==null?void 0:s.avdId)||"";if(o.includes(" ")){a.addIssue({code:gu.custom,message:"The AVD ID should not contain spaces.",path:["localEmulatorSettings","avdId"]});return}!o&&!i&&a.addIssue({code:gu.custom,message:"The AVD ID is required when the environment does not have a LOCAL_AVD_ID configured.",path:["localEmulatorSettings","avdId"]})}))}function I8e(e){const{pathSegments:u}=e,a=Ci(),{data:t}=fC(),n=CE(),r=C.useMemo(()=>_8e(t),[t]),i=pd({mode:"onChange",resolver:gd(r),defaultValues:{name:"",description:"",region:Ba,channel:"",tag:Ba,env:Qk,defaultApkFilePath:"",localEmulatorSettings:{avdId:""}}}),o=i.watch("channel"),s=i.watch("region"),l=i.watch("localEmulatorSettings.avdId"),E=s===Bt.LOCAL,{data:c}=ns("/api/assets",a),D=C.useMemo(()=>{const g=new Set;for(const F of(c==null?void 0:c.assets)||[])g.add(F.channel);return Array.from(g).sort()},[c]),h=C.useMemo(()=>{const g=o&&o!==Ba?o:void 0;if(!g)return[];const F=new Set;for(const b of(c==null?void 0:c.assets)||[])b.channel===g&&F.add(b.tag);return Array.from(F).sort()},[c,o]),[m,x]=Ws(async g=>{var z,N,M;const F=g.region===Ba?void 0:g.region,b=F===Bt.LOCAL,y=g.env===Qk?void 0:g.env;let v,A,B,j,R;b?(v=void 0,A=void 0,B=((N=(z=g.localEmulatorSettings)==null?void 0:z.avdId)==null?void 0:N.trim())||void 0,j=((M=g.defaultApkFilePath)==null?void 0:M.trim())||void 0,R={region:F,localEmulatorSettings:{avdId:B}}):(B=void 0,j=void 0,v=g.channel===Ba?void 0:g.channel||void 0,A=g.tag===Ba?void 0:g.tag||void 0,R=F?{region:F}:void 0);const w={defaultEnv:y||void 0,defaultChannel:v||void 0,defaultTag:A||void 0,defaultApkFilePath:j,emulator:R,retries:1},O=Object.values(w).some(I=>I!==void 0),T={name:g.name,description:g.description,settings:O?w:void 0,pathSegments:u};try{const I=await a("/api/mobile-tests",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(T)});n(`/tests/${I.relativeFilePath}`)}catch(I){Ca.error("Failed to create test.",{description:`${I}`})}km(u)},[u]),{isDirty:p,isValid:f}=i.formState;return d.jsxs(bE,{children:[d.jsx(yE,{asChild:!0,children:d.jsxs(Ve,{children:[d.jsx(im,{className:"h-4 w-4"}),"Create test"]})}),d.jsxs(_1,{children:[d.jsxs(I1,{children:[d.jsx(K1,{children:"Create mobile test"}),d.jsx($1,{children:"Create a new Momentic mobile test."})]}),d.jsx(Cd,{...i,children:d.jsxs("form",{onSubmit:i.handleSubmit(x),className:"space-y-4",children:[d.jsx(_0,{control:i.control,name:"name",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Name"}),d.jsx(T0,{children:d.jsx(SE,{placeholder:"example-test-name",...g})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:i.control,name:"description",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Description"}),d.jsx(T0,{children:d.jsx(zd,{placeholder:"Example test description",...g})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:i.control,name:"region",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Region"}),d.jsx(T0,{children:d.jsxs(Ka,{value:g.value??Ba,onValueChange:F=>{g.onChange(F),F===Bt.LOCAL?(i.setValue("channel","",{shouldDirty:!0}),i.setValue("tag","",{shouldDirty:!0}),i.setValue("localEmulatorSettings.avdId","",{shouldDirty:!0,shouldValidate:!0})):(i.setValue("localEmulatorSettings.avdId","",{shouldDirty:!0}),i.setValue("defaultApkFilePath","",{shouldDirty:!0}))},children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select region..."})}),d.jsxs(wa,{children:[r0u.map(F=>d.jsx(Re,{value:F,children:i0u[F]??F},F)),d.jsx(Re,{value:Ba,children:"Closest Region"})]})]})}),d.jsxs(op,{children:["Choose whether tests execute using remote or local emulators."," ",d.jsx(xh,{slug:"/mobile-cli/emulators#choosing-a-platform"})]}),d.jsx(P0,{})]})}),d.jsx(_0,{control:i.control,name:"env",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Environment"}),d.jsx(T0,{children:d.jsxs(Ka,{onValueChange:F=>{i.setValue("env",F,{shouldDirty:!0}),i.setValue("localEmulatorSettings.avdId",l,{shouldValidate:!0})},value:g.value,children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select environment..."})}),d.jsxs(wa,{children:[t==null?void 0:t.map(F=>d.jsx(Re,{value:F.name,children:F.name},F.name)),d.jsx(Re,{value:Qk,children:P5})]})]})}),d.jsxs(op,{children:["Choose the default environment for this test."," ",d.jsx(xh,{slug:"/mobile-cli/emulators#environment-based-settings"})]}),d.jsx(P0,{})]})}),E?d.jsxs(d.Fragment,{children:[d.jsx(_0,{control:i.control,name:"localEmulatorSettings.avdId",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:`The ID of the AVD to use for the local emulator. If unset, Momentic will use ${P3} from the selected environment (if any).`,children:"Local AVD ID"}),d.jsx(T0,{children:d.jsx(gt,{value:g.value,onChange:F=>g.onChange(F.target.value),onBlur:g.onBlur,name:g.name,ref:g.ref,placeholder:"Pixel_9_API_35"})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:i.control,name:"defaultApkFilePath",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:`Local path to the APK that should be installed when using a local emulator. If unset, Momentic will use ${Eh} from the selected environment (if any).`,children:"Local APK file path"}),d.jsx(T0,{children:d.jsx(gt,{value:g.value,onChange:F=>g.onChange(F.target.value),onBlur:g.onBlur,name:g.name,ref:g.ref,placeholder:"/Users/me/app/build/app.apk"})}),d.jsx(P0,{})]})})]}):d.jsxs(d.Fragment,{children:[d.jsx(_0,{control:i.control,name:"channel",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Channel"}),d.jsx(T0,{children:d.jsxs(Ka,{onValueChange:F=>{g.onChange(F),i.setValue("tag",Ba,{shouldDirty:!0})},value:g.value,children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select channel..."})}),d.jsxs(wa,{children:[D.map(F=>d.jsx(Re,{value:F,children:F},F)),d.jsx(Re,{value:Ba,children:"None"})]})]})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:i.control,name:"tag",render:({field:g})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Tag"}),d.jsx(T0,{children:d.jsxs(Ka,{onValueChange:g.onChange,value:g.value,children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select tag..."})}),d.jsxs(wa,{children:[h.map(F=>d.jsx(Re,{value:F,children:F},F)),d.jsx(Re,{value:Ba,children:"Latest available"})]})]})}),d.jsx(P0,{})]})})]}),d.jsx(BE,{children:d.jsx(Ve,{type:"submit",disabled:m.loading||!p||!f,children:"Create test"})})]})})]})]})}function Me(){return Me=Object.assign?Object.assign.bind():function(e){for(var u=1;u<arguments.length;u++){var a=arguments[u];for(var t in a)Object.prototype.hasOwnProperty.call(a,t)&&(e[t]=a[t])}return e},Me.apply(this,arguments)}function zb(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ap(e,u){return Ap=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Ap(e,u)}function K8e(e,u){e.prototype=Object.create(u.prototype),e.prototype.constructor=e,Ap(e,u)}var xj=Number.isNaN||function(u){return typeof u=="number"&&u!==u};function $8e(e,u){return!!(e===u||xj(e)&&xj(u))}function V8e(e,u){if(e.length!==u.length)return!1;for(var a=0;a<e.length;a++)if(!$8e(e[a],u[a]))return!1;return!0}function iv(e,u){u===void 0&&(u=V8e);var a,t=[],n,r=!1;function i(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];return r&&a===this&&u(o,t)||(n=e.apply(this,o),r=!0,a=this,t=o),n}return i}function H8e(e,u){if(e==null)return{};var a={},t=Object.keys(e),n,r;for(r=0;r<t.length;r++)n=t[r],!(u.indexOf(n)>=0)&&(a[n]=e[n]);return a}var G8e=typeof performance=="object"&&typeof performance.now=="function",fj=G8e?function(){return performance.now()}:function(){return Date.now()};function pj(e){cancelAnimationFrame(e.id)}function J8e(e,u){var a=fj();function t(){fj()-a>=u?e.call(null):n.id=requestAnimationFrame(t)}var n={id:requestAnimationFrame(t)};return n}var ov=-1;function gj(e){if(e===void 0&&(e=!1),ov===-1||e){var u=document.createElement("div"),a=u.style;a.width="50px",a.height="50px",a.overflow="scroll",document.body.appendChild(u),ov=u.offsetWidth-u.clientWidth,document.body.removeChild(u)}return ov}var GE=null;function Cj(e){if(e===void 0&&(e=!1),GE===null||e){var u=document.createElement("div"),a=u.style;a.width="50px",a.height="50px",a.overflow="scroll",a.direction="rtl";var t=document.createElement("div"),n=t.style;return n.width="100px",n.height="100px",u.appendChild(t),document.body.appendChild(u),u.scrollLeft>0?GE="positive-descending":(u.scrollLeft=1,u.scrollLeft===0?GE="negative":GE="positive-ascending"),document.body.removeChild(u),GE}return GE}var W8e=150,U8e=function(u,a){return u};function Z8e(e){var u,a=e.getItemOffset,t=e.getEstimatedTotalSize,n=e.getItemSize,r=e.getOffsetForIndexAndAlignment,i=e.getStartIndexForOffset,o=e.getStopIndexForStartIndex,s=e.initInstanceProps,l=e.shouldResetStyleCacheOnItemSizeChange,E=e.validateProps;return u=function(c){K8e(D,c);function D(m){var x;return x=c.call(this,m)||this,x._instanceProps=s(x.props,zb(x)),x._outerRef=void 0,x._resetIsScrollingTimeoutId=null,x.state={instance:zb(x),isScrolling:!1,scrollDirection:"forward",scrollOffset:typeof x.props.initialScrollOffset=="number"?x.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},x._callOnItemsRendered=void 0,x._callOnItemsRendered=iv(function(p,f,g,F){return x.props.onItemsRendered({overscanStartIndex:p,overscanStopIndex:f,visibleStartIndex:g,visibleStopIndex:F})}),x._callOnScroll=void 0,x._callOnScroll=iv(function(p,f,g){return x.props.onScroll({scrollDirection:p,scrollOffset:f,scrollUpdateWasRequested:g})}),x._getItemStyle=void 0,x._getItemStyle=function(p){var f=x.props,g=f.direction,F=f.itemSize,b=f.layout,y=x._getItemStyleCache(l&&F,l&&b,l&&g),v;if(y.hasOwnProperty(p))v=y[p];else{var A=a(x.props,p,x._instanceProps),B=n(x.props,p,x._instanceProps),j=g==="horizontal"||b==="horizontal",R=g==="rtl",w=j?A:0;y[p]=v={position:"absolute",left:R?void 0:w,right:R?w:void 0,top:j?0:A,height:j?"100%":B,width:j?B:"100%"}}return v},x._getItemStyleCache=void 0,x._getItemStyleCache=iv(function(p,f,g){return{}}),x._onScrollHorizontal=function(p){var f=p.currentTarget,g=f.clientWidth,F=f.scrollLeft,b=f.scrollWidth;x.setState(function(y){if(y.scrollOffset===F)return null;var v=x.props.direction,A=F;if(v==="rtl")switch(Cj()){case"negative":A=-F;break;case"positive-descending":A=b-g-F;break}return A=Math.max(0,Math.min(A,b-g)),{isScrolling:!0,scrollDirection:y.scrollOffset<A?"forward":"backward",scrollOffset:A,scrollUpdateWasRequested:!1}},x._resetIsScrollingDebounced)},x._onScrollVertical=function(p){var f=p.currentTarget,g=f.clientHeight,F=f.scrollHeight,b=f.scrollTop;x.setState(function(y){if(y.scrollOffset===b)return null;var v=Math.max(0,Math.min(b,F-g));return{isScrolling:!0,scrollDirection:y.scrollOffset<v?"forward":"backward",scrollOffset:v,scrollUpdateWasRequested:!1}},x._resetIsScrollingDebounced)},x._outerRefSetter=function(p){var f=x.props.outerRef;x._outerRef=p,typeof f=="function"?f(p):f!=null&&typeof f=="object"&&f.hasOwnProperty("current")&&(f.current=p)},x._resetIsScrollingDebounced=function(){x._resetIsScrollingTimeoutId!==null&&pj(x._resetIsScrollingTimeoutId),x._resetIsScrollingTimeoutId=J8e(x._resetIsScrolling,W8e)},x._resetIsScrolling=function(){x._resetIsScrollingTimeoutId=null,x.setState({isScrolling:!1},function(){x._getItemStyleCache(-1,null)})},x}D.getDerivedStateFromProps=function(x,p){return Q8e(x,p),E(x),null};var h=D.prototype;return h.scrollTo=function(x){x=Math.max(0,x),this.setState(function(p){return p.scrollOffset===x?null:{scrollDirection:p.scrollOffset<x?"forward":"backward",scrollOffset:x,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},h.scrollToItem=function(x,p){p===void 0&&(p="auto");var f=this.props,g=f.itemCount,F=f.layout,b=this.state.scrollOffset;x=Math.max(0,Math.min(x,g-1));var y=0;if(this._outerRef){var v=this._outerRef;F==="vertical"?y=v.scrollWidth>v.clientWidth?gj():0:y=v.scrollHeight>v.clientHeight?gj():0}this.scrollTo(r(this.props,x,p,b,this._instanceProps,y))},h.componentDidMount=function(){var x=this.props,p=x.direction,f=x.initialScrollOffset,g=x.layout;if(typeof f=="number"&&this._outerRef!=null){var F=this._outerRef;p==="horizontal"||g==="horizontal"?F.scrollLeft=f:F.scrollTop=f}this._callPropsCallbacks()},h.componentDidUpdate=function(){var x=this.props,p=x.direction,f=x.layout,g=this.state,F=g.scrollOffset,b=g.scrollUpdateWasRequested;if(b&&this._outerRef!=null){var y=this._outerRef;if(p==="horizontal"||f==="horizontal")if(p==="rtl")switch(Cj()){case"negative":y.scrollLeft=-F;break;case"positive-ascending":y.scrollLeft=F;break;default:var v=y.clientWidth,A=y.scrollWidth;y.scrollLeft=A-v-F;break}else y.scrollLeft=F;else y.scrollTop=F}this._callPropsCallbacks()},h.componentWillUnmount=function(){this._resetIsScrollingTimeoutId!==null&&pj(this._resetIsScrollingTimeoutId)},h.render=function(){var x=this.props,p=x.children,f=x.className,g=x.direction,F=x.height,b=x.innerRef,y=x.innerElementType,v=x.innerTagName,A=x.itemCount,B=x.itemData,j=x.itemKey,R=j===void 0?U8e:j,w=x.layout,O=x.outerElementType,T=x.outerTagName,z=x.style,N=x.useIsScrolling,M=x.width,I=this.state.isScrolling,P=g==="horizontal"||w==="horizontal",L=P?this._onScrollHorizontal:this._onScrollVertical,K=this._getRangeToRender(),W=K[0],_=K[1],Q=[];if(A>0)for(var eu=W;eu<=_;eu++)Q.push(C.createElement(p,{data:B,key:R(eu,B),index:eu,isScrolling:N?I:void 0,style:this._getItemStyle(eu)}));var U=t(this.props,this._instanceProps);return C.createElement(O||T||"div",{className:f,onScroll:L,ref:this._outerRefSetter,style:Me({position:"relative",height:F,width:M,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:g},z)},C.createElement(y||v||"div",{children:Q,ref:b,style:{height:P?"100%":U,pointerEvents:I?"none":void 0,width:P?U:"100%"}}))},h._callPropsCallbacks=function(){if(typeof this.props.onItemsRendered=="function"){var x=this.props.itemCount;if(x>0){var p=this._getRangeToRender(),f=p[0],g=p[1],F=p[2],b=p[3];this._callOnItemsRendered(f,g,F,b)}}if(typeof this.props.onScroll=="function"){var y=this.state,v=y.scrollDirection,A=y.scrollOffset,B=y.scrollUpdateWasRequested;this._callOnScroll(v,A,B)}},h._getRangeToRender=function(){var x=this.props,p=x.itemCount,f=x.overscanCount,g=this.state,F=g.isScrolling,b=g.scrollDirection,y=g.scrollOffset;if(p===0)return[0,0,0,0];var v=i(this.props,y,this._instanceProps),A=o(this.props,v,y,this._instanceProps),B=!F||b==="backward"?Math.max(1,f):1,j=!F||b==="forward"?Math.max(1,f):1;return[Math.max(0,v-B),Math.max(0,Math.min(p-1,A+j)),v,A]},D}(C.PureComponent),u.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},u}var Q8e=function(u,a){u.children,u.direction,u.height,u.layout,u.innerTagName,u.outerTagName,u.width,a.instance},s0u=Z8e({getItemOffset:function(u,a){var t=u.itemSize;return a*t},getItemSize:function(u,a){var t=u.itemSize;return t},getEstimatedTotalSize:function(u){var a=u.itemCount,t=u.itemSize;return t*a},getOffsetForIndexAndAlignment:function(u,a,t,n,r,i){var o=u.direction,s=u.height,l=u.itemCount,E=u.itemSize,c=u.layout,D=u.width,h=o==="horizontal"||c==="horizontal",m=h?D:s,x=Math.max(0,l*E-m),p=Math.min(x,a*E),f=Math.max(0,a*E-m+E+i);switch(t==="smart"&&(n>=f-m&&n<=p+m?t="auto":t="center"),t){case"start":return p;case"end":return f;case"center":{var g=Math.round(f+(p-f)/2);return g<Math.ceil(m/2)?0:g>x+Math.floor(m/2)?x:g}case"auto":default:return n>=f&&n<=p?n:n<f?f:p}},getStartIndexForOffset:function(u,a){var t=u.itemCount,n=u.itemSize;return Math.max(0,Math.min(t-1,Math.floor(a/n)))},getStopIndexForStartIndex:function(u,a,t){var n=u.direction,r=u.height,i=u.itemCount,o=u.itemSize,s=u.layout,l=u.width,E=n==="horizontal"||s==="horizontal",c=a*o,D=E?l:r,h=Math.ceil((D+t-c)/o);return Math.max(0,Math.min(i-1,a+h-1))},initInstanceProps:function(u){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(u){u.itemSize}});const q8e=P1("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80",outline:"text-foreground",plain:"border-transparent text-primary-foreground"}},defaultVariants:{variant:"default"}});function Ts({className:e,variant:u,...a}){return d.jsx("div",{className:lu(q8e({variant:u}),e),...a})}var Fj=1,Y8e=.9,X8e=.8,uSe=.17,sv=.1,lv=.999,eSe=.9999,aSe=.99,tSe=/[\\\/_+.#"@\[\(\{&]/,nSe=/[\\\/_+.#"@\[\(\{&]/g,rSe=/[\s-]/,l0u=/[\s-]/g;function Ob(e,u,a,t,n,r,i){if(r===u.length)return n===e.length?Fj:aSe;var o=`${n},${r}`;if(i[o]!==void 0)return i[o];for(var s=t.charAt(r),l=a.indexOf(s,n),E=0,c,D,h,m;l>=0;)c=Ob(e,u,a,t,l+1,r+1,i),c>E&&(l===n?c*=Fj:tSe.test(e.charAt(l-1))?(c*=X8e,h=e.slice(n,l-1).match(nSe),h&&n>0&&(c*=Math.pow(lv,h.length))):rSe.test(e.charAt(l-1))?(c*=Y8e,m=e.slice(n,l-1).match(l0u),m&&n>0&&(c*=Math.pow(lv,m.length))):(c*=uSe,n>0&&(c*=Math.pow(lv,l-n))),e.charAt(l)!==u.charAt(r)&&(c*=eSe)),(c<sv&&a.charAt(l-1)===t.charAt(r+1)||t.charAt(r+1)===t.charAt(r)&&a.charAt(l-1)!==t.charAt(r))&&(D=Ob(e,u,a,t,l+1,r+2,i),D*sv>c&&(c=D*sv)),c>E&&(E=c),l=a.indexOf(s,l+1);return i[o]=E,E}function kj(e){return e.toLowerCase().replace(l0u," ")}function iSe(e,u,a){return e=a&&a.length>0?`${e+" "+a.join(" ")}`:e,Ob(e,u,kj(e),kj(u),0,0,{})}var c5='[cmdk-group=""]',Ev='[cmdk-group-items=""]',oSe='[cmdk-group-heading=""]',E0u='[cmdk-item=""]',vj=`${E0u}:not([aria-disabled="true"])`,wb="cmdk-item-select",ac="data-value",sSe=(e,u,a)=>iSe(e,u,a),c0u=C.createContext(void 0),Om=()=>C.useContext(c0u),d0u=C.createContext(void 0),cz=()=>C.useContext(d0u),D0u=C.createContext(void 0),h0u=C.forwardRef((e,u)=>{let a=tc(()=>{var _,Q;return{search:"",value:(Q=(_=e.value)!=null?_:e.defaultValue)!=null?Q:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),t=tc(()=>new Set),n=tc(()=>new Map),r=tc(()=>new Map),i=tc(()=>new Set),o=m0u(e),{label:s,children:l,value:E,onValueChange:c,filter:D,shouldFilter:h,loop:m,disablePointerSelection:x=!1,vimBindings:p=!0,...f}=e,g=kt(),F=kt(),b=kt(),y=C.useRef(null),v=gSe();eE(()=>{if(E!==void 0){let _=E.trim();a.current.value=_,A.emit()}},[E]),eE(()=>{v(6,T)},[]);let A=C.useMemo(()=>({subscribe:_=>(i.current.add(_),()=>i.current.delete(_)),snapshot:()=>a.current,setState:(_,Q,eu)=>{var U,iu,tu,Y;if(!Object.is(a.current[_],Q)){if(a.current[_]=Q,_==="search")O(),R(),v(1,w);else if(_==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let ou=document.getElementById(b);ou?ou.focus():(U=document.getElementById(g))==null||U.focus()}if(v(7,()=>{var ou;a.current.selectedItemId=(ou=z())==null?void 0:ou.id,A.emit()}),eu||v(5,T),((iu=o.current)==null?void 0:iu.value)!==void 0){let ou=Q??"";(Y=(tu=o.current).onValueChange)==null||Y.call(tu,ou);return}}A.emit()}},emit:()=>{i.current.forEach(_=>_())}}),[]),B=C.useMemo(()=>({value:(_,Q,eu)=>{var U;Q!==((U=r.current.get(_))==null?void 0:U.value)&&(r.current.set(_,{value:Q,keywords:eu}),a.current.filtered.items.set(_,j(Q,eu)),v(2,()=>{R(),A.emit()}))},item:(_,Q)=>(t.current.add(_),Q&&(n.current.has(Q)?n.current.get(Q).add(_):n.current.set(Q,new Set([_]))),v(3,()=>{O(),R(),a.current.value||w(),A.emit()}),()=>{r.current.delete(_),t.current.delete(_),a.current.filtered.items.delete(_);let eu=z();v(4,()=>{O(),(eu==null?void 0:eu.getAttribute("id"))===_&&w(),A.emit()})}),group:_=>(n.current.has(_)||n.current.set(_,new Set),()=>{r.current.delete(_),n.current.delete(_)}),filter:()=>o.current.shouldFilter,label:s||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:g,inputId:b,labelId:F,listInnerRef:y}),[]);function j(_,Q){var eu,U;let iu=(U=(eu=o.current)==null?void 0:eu.filter)!=null?U:sSe;return _?iu(_,a.current.search,Q):0}function R(){if(!a.current.search||o.current.shouldFilter===!1)return;let _=a.current.filtered.items,Q=[];a.current.filtered.groups.forEach(U=>{let iu=n.current.get(U),tu=0;iu.forEach(Y=>{let ou=_.get(Y);tu=Math.max(ou,tu)}),Q.push([U,tu])});let eu=y.current;N().sort((U,iu)=>{var tu,Y;let ou=U.getAttribute("id"),Cu=iu.getAttribute("id");return((tu=_.get(Cu))!=null?tu:0)-((Y=_.get(ou))!=null?Y:0)}).forEach(U=>{let iu=U.closest(Ev);iu?iu.appendChild(U.parentElement===iu?U:U.closest(`${Ev} > *`)):eu.appendChild(U.parentElement===eu?U:U.closest(`${Ev} > *`))}),Q.sort((U,iu)=>iu[1]-U[1]).forEach(U=>{var iu;let tu=(iu=y.current)==null?void 0:iu.querySelector(`${c5}[${ac}="${encodeURIComponent(U[0])}"]`);tu==null||tu.parentElement.appendChild(tu)})}function w(){let _=N().find(eu=>eu.getAttribute("aria-disabled")!=="true"),Q=_==null?void 0:_.getAttribute(ac);A.setState("value",Q||void 0)}function O(){var _,Q,eu,U;if(!a.current.search||o.current.shouldFilter===!1){a.current.filtered.count=t.current.size;return}a.current.filtered.groups=new Set;let iu=0;for(let tu of t.current){let Y=(Q=(_=r.current.get(tu))==null?void 0:_.value)!=null?Q:"",ou=(U=(eu=r.current.get(tu))==null?void 0:eu.keywords)!=null?U:[],Cu=j(Y,ou);a.current.filtered.items.set(tu,Cu),Cu>0&&iu++}for(let[tu,Y]of n.current)for(let ou of Y)if(a.current.filtered.items.get(ou)>0){a.current.filtered.groups.add(tu);break}a.current.filtered.count=iu}function T(){var _,Q,eu;let U=z();U&&(((_=U.parentElement)==null?void 0:_.firstChild)===U&&((eu=(Q=U.closest(c5))==null?void 0:Q.querySelector(oSe))==null||eu.scrollIntoView({block:"nearest"})),U.scrollIntoView({block:"nearest"}))}function z(){var _;return(_=y.current)==null?void 0:_.querySelector(`${E0u}[aria-selected="true"]`)}function N(){var _;return Array.from(((_=y.current)==null?void 0:_.querySelectorAll(vj))||[])}function M(_){let Q=N()[_];Q&&A.setState("value",Q.getAttribute(ac))}function I(_){var Q;let eu=z(),U=N(),iu=U.findIndex(Y=>Y===eu),tu=U[iu+_];(Q=o.current)!=null&&Q.loop&&(tu=iu+_<0?U[U.length-1]:iu+_===U.length?U[0]:U[iu+_]),tu&&A.setState("value",tu.getAttribute(ac))}function P(_){let Q=z(),eu=Q==null?void 0:Q.closest(c5),U;for(;eu&&!U;)eu=_>0?fSe(eu,c5):pSe(eu,c5),U=eu==null?void 0:eu.querySelector(vj);U?A.setState("value",U.getAttribute(ac)):I(_)}let L=()=>M(N().length-1),K=_=>{_.preventDefault(),_.metaKey?L():_.altKey?P(1):I(1)},W=_=>{_.preventDefault(),_.metaKey?M(0):_.altKey?P(-1):I(-1)};return C.createElement(se.div,{ref:u,tabIndex:-1,...f,"cmdk-root":"",onKeyDown:_=>{var Q;(Q=f.onKeyDown)==null||Q.call(f,_);let eu=_.nativeEvent.isComposing||_.keyCode===229;if(!(_.defaultPrevented||eu))switch(_.key){case"n":case"j":{p&&_.ctrlKey&&K(_);break}case"ArrowDown":{K(_);break}case"p":case"k":{p&&_.ctrlKey&&W(_);break}case"ArrowUp":{W(_);break}case"Home":{_.preventDefault(),M(0);break}case"End":{_.preventDefault(),L();break}case"Enter":{_.preventDefault();let U=z();if(U){let iu=new Event(wb);U.dispatchEvent(iu)}}}}},C.createElement("label",{"cmdk-label":"",htmlFor:B.inputId,id:B.labelId,style:FSe},s),pC(e,_=>C.createElement(d0u.Provider,{value:A},C.createElement(c0u.Provider,{value:B},_))))}),lSe=C.forwardRef((e,u)=>{var a,t;let n=kt(),r=C.useRef(null),i=C.useContext(D0u),o=Om(),s=m0u(e),l=(t=(a=s.current)==null?void 0:a.forceMount)!=null?t:i==null?void 0:i.forceMount;eE(()=>{if(!l)return o.item(n,i==null?void 0:i.id)},[l]);let E=x0u(n,r,[e.value,e.children,r],e.keywords),c=cz(),D=k1(v=>v.value&&v.value===E.current),h=k1(v=>l||o.filter()===!1?!0:v.search?v.filtered.items.get(n)>0:!0);C.useEffect(()=>{let v=r.current;if(!(!v||e.disabled))return v.addEventListener(wb,m),()=>v.removeEventListener(wb,m)},[h,e.onSelect,e.disabled]);function m(){var v,A;x(),(A=(v=s.current).onSelect)==null||A.call(v,E.current)}function x(){c.setState("value",E.current,!0)}if(!h)return null;let{disabled:p,value:f,onSelect:g,forceMount:F,keywords:b,...y}=e;return C.createElement(se.div,{ref:Hs(r,u),...y,id:n,"cmdk-item":"",role:"option","aria-disabled":!!p,"aria-selected":!!D,"data-disabled":!!p,"data-selected":!!D,onPointerMove:p||o.getDisablePointerSelection()?void 0:x,onClick:p?void 0:m},e.children)}),ESe=C.forwardRef((e,u)=>{let{heading:a,children:t,forceMount:n,...r}=e,i=kt(),o=C.useRef(null),s=C.useRef(null),l=kt(),E=Om(),c=k1(h=>n||E.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);eE(()=>E.group(i),[]),x0u(i,o,[e.value,e.heading,s]);let D=C.useMemo(()=>({id:i,forceMount:n}),[n]);return C.createElement(se.div,{ref:Hs(o,u),...r,"cmdk-group":"",role:"presentation",hidden:c?void 0:!0},a&&C.createElement("div",{ref:s,"cmdk-group-heading":"","aria-hidden":!0,id:l},a),pC(e,h=>C.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":a?l:void 0},C.createElement(D0u.Provider,{value:D},h))))}),cSe=C.forwardRef((e,u)=>{let{alwaysRender:a,...t}=e,n=C.useRef(null),r=k1(i=>!i.search);return!a&&!r?null:C.createElement(se.div,{ref:Hs(n,u),...t,"cmdk-separator":"",role:"separator"})}),dSe=C.forwardRef((e,u)=>{let{onValueChange:a,...t}=e,n=e.value!=null,r=cz(),i=k1(l=>l.search),o=k1(l=>l.selectedItemId),s=Om();return C.useEffect(()=>{e.value!=null&&r.setState("search",e.value)},[e.value]),C.createElement(se.input,{ref:u,...t,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":s.listId,"aria-labelledby":s.labelId,"aria-activedescendant":o,id:s.inputId,type:"text",value:n?e.value:i,onChange:l=>{n||r.setState("search",l.target.value),a==null||a(l.target.value)}})}),DSe=C.forwardRef((e,u)=>{let{children:a,label:t="Suggestions",...n}=e,r=C.useRef(null),i=C.useRef(null),o=k1(l=>l.selectedItemId),s=Om();return C.useEffect(()=>{if(i.current&&r.current){let l=i.current,E=r.current,c,D=new ResizeObserver(()=>{c=requestAnimationFrame(()=>{let h=l.offsetHeight;E.style.setProperty("--cmdk-list-height",h.toFixed(1)+"px")})});return D.observe(l),()=>{cancelAnimationFrame(c),D.unobserve(l)}}},[]),C.createElement(se.div,{ref:Hs(r,u),...n,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":o,"aria-label":t,id:s.listId},pC(e,l=>C.createElement("div",{ref:Hs(i,s.listInnerRef),"cmdk-list-sizer":""},l)))}),hSe=C.forwardRef((e,u)=>{let{open:a,onOpenChange:t,overlayClassName:n,contentClassName:r,container:i,...o}=e;return C.createElement(r2,{open:a,onOpenChange:t},C.createElement(i2,{container:i},C.createElement(dd,{"cmdk-overlay":"",className:n}),C.createElement(Dd,{"aria-label":e.label,"cmdk-dialog":"",className:r},C.createElement(h0u,{ref:u,...o}))))}),mSe=C.forwardRef((e,u)=>k1(a=>a.filtered.count===0)?C.createElement(se.div,{ref:u,...e,"cmdk-empty":"",role:"presentation"}):null),xSe=C.forwardRef((e,u)=>{let{progress:a,children:t,label:n="Loading...",...r}=e;return C.createElement(se.div,{ref:u,...r,"cmdk-loading":"",role:"progressbar","aria-valuenow":a,"aria-valuemin":0,"aria-valuemax":100,"aria-label":n},pC(e,i=>C.createElement("div",{"aria-hidden":!0},i)))}),ir=Object.assign(h0u,{List:DSe,Item:lSe,Input:dSe,Group:ESe,Separator:cSe,Dialog:hSe,Empty:mSe,Loading:xSe});function fSe(e,u){let a=e.nextElementSibling;for(;a;){if(a.matches(u))return a;a=a.nextElementSibling}}function pSe(e,u){let a=e.previousElementSibling;for(;a;){if(a.matches(u))return a;a=a.previousElementSibling}}function m0u(e){let u=C.useRef(e);return eE(()=>{u.current=e}),u}var eE=typeof window>"u"?C.useEffect:C.useLayoutEffect;function tc(e){let u=C.useRef();return u.current===void 0&&(u.current=e()),u}function k1(e){let u=cz(),a=()=>e(u.snapshot());return C.useSyncExternalStore(u.subscribe,a,a)}function x0u(e,u,a,t=[]){let n=C.useRef(),r=Om();return eE(()=>{var i;let o=(()=>{var l;for(let E of a){if(typeof E=="string")return E.trim();if(typeof E=="object"&&"current"in E)return E.current?(l=E.current.textContent)==null?void 0:l.trim():n.current}})(),s=t.map(l=>l.trim());r.value(e,o,s),(i=u.current)==null||i.setAttribute(ac,o),n.current=o}),n}var gSe=()=>{let[e,u]=C.useState(),a=tc(()=>new Map);return eE(()=>{a.current.forEach(t=>t()),a.current=new Map},[e]),(t,n)=>{a.current.set(t,n),u({})}};function CSe(e){let u=e.type;return typeof u=="function"?u(e.props):"render"in u?u.render(e.props):e}function pC({asChild:e,children:u},a){return e&&C.isValidElement(u)?C.cloneElement(CSe(u),{ref:u.ref},a(u.props.children)):a(u)}var FSe={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const wm=C.forwardRef(({className:e,...u},a)=>d.jsx(ir,{ref:a,className:lu("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...u}));wm.displayName=ir.displayName;const kSe=({children:e,trigger:u,commandProps:a,dialogContentProps:t,...n})=>{const{className:r,...i}=t||{};return d.jsxs(bE,{...n,children:[u?d.jsx(yE,{asChild:!0,children:u}):null,d.jsxs(_1,{className:lu("overflow-hidden p-0",r),...i,onCloseAutoFocus:o=>{o.preventDefault()},children:[d.jsx(v8,{children:d.jsxs(I1,{children:[d.jsx(K1,{children:"Command dialog"}),d.jsx($1,{children:"Use the arrow keys to navigate, and press enter to select an item."})]})}),d.jsx(wm,{className:"[&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",...a,children:e})]})]})},gC=C.forwardRef(({className:e,Icon:u,...a},t)=>{const n=u||sd;return d.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[d.jsx(n,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),d.jsx(ir.Input,{ref:t,className:lu("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",e),...a})]})});gC.displayName=ir.Input.displayName;const j4=C.forwardRef(({className:e,...u},a)=>d.jsx(ir.List,{ref:a,className:lu("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...u}));j4.displayName=ir.List.displayName;const t1=C.forwardRef((e,u)=>d.jsx(ir.Empty,{ref:u,className:"py-6 text-center text-sm",...e}));t1.displayName=ir.Empty.displayName;const fh=C.forwardRef(({className:e,...u},a)=>d.jsx(ir.Group,{ref:a,className:lu("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...u}));fh.displayName=ir.Group.displayName;const dz=C.forwardRef(({className:e,...u},a)=>d.jsx(ir.Separator,{ref:a,className:lu("bg-border -mx-1 h-px",e),...u}));dz.displayName=ir.Separator.displayName;const Ps=C.forwardRef(({className:e,...u},a)=>d.jsx(ir.Item,{ref:a,className:lu("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",e),...u}));Ps.displayName=ir.Item.displayName;function Xs(e){return Array.isArray?Array.isArray(e):g0u(e)==="[object Array]"}const vSe=1/0;function ASe(e){if(typeof e=="string")return e;let u=e+"";return u=="0"&&1/e==-vSe?"-0":u}function bSe(e){return e==null?"":ASe(e)}function _o(e){return typeof e=="string"}function f0u(e){return typeof e=="number"}function ySe(e){return e===!0||e===!1||BSe(e)&&g0u(e)=="[object Boolean]"}function p0u(e){return typeof e=="object"}function BSe(e){return p0u(e)&&e!==null}function xr(e){return e!=null}function cv(e){return!e.trim().length}function g0u(e){return e==null?e===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const SSe="Incorrect 'index' type",zSe=e=>`Invalid value for key ${e}`,OSe=e=>`Pattern length exceeds max of ${e}.`,wSe=e=>`Missing ${e} property in key`,MSe=e=>`Property 'weight' in key '${e}' must be a positive integer`,Aj=Object.prototype.hasOwnProperty;class TSe{constructor(u){this._keys=[],this._keyMap={};let a=0;u.forEach(t=>{let n=C0u(t);this._keys.push(n),this._keyMap[n.id]=n,a+=n.weight}),this._keys.forEach(t=>{t.weight/=a})}get(u){return this._keyMap[u]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function C0u(e){let u=null,a=null,t=null,n=1,r=null;if(_o(e)||Xs(e))t=e,u=bj(e),a=Mb(e);else{if(!Aj.call(e,"name"))throw new Error(wSe("name"));const i=e.name;if(t=i,Aj.call(e,"weight")&&(n=e.weight,n<=0))throw new Error(MSe(i));u=bj(i),a=Mb(i),r=e.getFn}return{path:u,id:a,weight:n,src:t,getFn:r}}function bj(e){return Xs(e)?e:e.split(".")}function Mb(e){return Xs(e)?e.join("."):e}function PSe(e,u){let a=[],t=!1;const n=(r,i,o)=>{if(xr(r))if(!i[o])a.push(r);else{let s=i[o];const l=r[s];if(!xr(l))return;if(o===i.length-1&&(_o(l)||f0u(l)||ySe(l)))a.push(bSe(l));else if(Xs(l)){t=!0;for(let E=0,c=l.length;E<c;E+=1)n(l[E],i,o+1)}else i.length&&n(l,i,o+1)}};return n(e,_o(u)?u.split("."):u,0),t?a:a[0]}const jSe={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},NSe={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,u)=>e.score===u.score?e.idx<u.idx?-1:1:e.score<u.score?-1:1},RSe={location:0,threshold:.6,distance:100},LSe={useExtendedSearch:!1,getFn:PSe,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};var _e={...NSe,...jSe,...RSe,...LSe};const _Se=/[^ ]+/g;function ISe(e=1,u=3){const a=new Map,t=Math.pow(10,u);return{get(n){const r=n.match(_Se).length;if(a.has(r))return a.get(r);const i=1/Math.pow(r,.5*e),o=parseFloat(Math.round(i*t)/t);return a.set(r,o),o},clear(){a.clear()}}}class Dz{constructor({getFn:u=_e.getFn,fieldNormWeight:a=_e.fieldNormWeight}={}){this.norm=ISe(a,3),this.getFn=u,this.isCreated=!1,this.setIndexRecords()}setSources(u=[]){this.docs=u}setIndexRecords(u=[]){this.records=u}setKeys(u=[]){this.keys=u,this._keysMap={},u.forEach((a,t)=>{this._keysMap[a.id]=t})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,_o(this.docs[0])?this.docs.forEach((u,a)=>{this._addString(u,a)}):this.docs.forEach((u,a)=>{this._addObject(u,a)}),this.norm.clear())}add(u){const a=this.size();_o(u)?this._addString(u,a):this._addObject(u,a)}removeAt(u){this.records.splice(u,1);for(let a=u,t=this.size();a<t;a+=1)this.records[a].i-=1}getValueForItemAtKeyId(u,a){return u[this._keysMap[a]]}size(){return this.records.length}_addString(u,a){if(!xr(u)||cv(u))return;let t={v:u,i:a,n:this.norm.get(u)};this.records.push(t)}_addObject(u,a){let t={i:a,$:{}};this.keys.forEach((n,r)=>{let i=n.getFn?n.getFn(u):this.getFn(u,n.path);if(xr(i)){if(Xs(i)){let o=[];const s=[{nestedArrIndex:-1,value:i}];for(;s.length;){const{nestedArrIndex:l,value:E}=s.pop();if(xr(E))if(_o(E)&&!cv(E)){let c={v:E,i:l,n:this.norm.get(E)};o.push(c)}else Xs(E)&&E.forEach((c,D)=>{s.push({nestedArrIndex:D,value:c})})}t.$[r]=o}else if(_o(i)&&!cv(i)){let o={v:i,n:this.norm.get(i)};t.$[r]=o}}}),this.records.push(t)}toJSON(){return{keys:this.keys,records:this.records}}}function F0u(e,u,{getFn:a=_e.getFn,fieldNormWeight:t=_e.fieldNormWeight}={}){const n=new Dz({getFn:a,fieldNormWeight:t});return n.setKeys(e.map(C0u)),n.setSources(u),n.create(),n}function KSe(e,{getFn:u=_e.getFn,fieldNormWeight:a=_e.fieldNormWeight}={}){const{keys:t,records:n}=e,r=new Dz({getFn:u,fieldNormWeight:a});return r.setKeys(t),r.setIndexRecords(n),r}function Px(e,{errors:u=0,currentLocation:a=0,expectedLocation:t=0,distance:n=_e.distance,ignoreLocation:r=_e.ignoreLocation}={}){const i=u/e.length;if(r)return i;const o=Math.abs(t-a);return n?i+o/n:o?1:i}function $Se(e=[],u=_e.minMatchCharLength){let a=[],t=-1,n=-1,r=0;for(let i=e.length;r<i;r+=1){let o=e[r];o&&t===-1?t=r:!o&&t!==-1&&(n=r-1,n-t+1>=u&&a.push([t,n]),t=-1)}return e[r-1]&&r-t>=u&&a.push([t,r-1]),a}const d4=32;function VSe(e,u,a,{location:t=_e.location,distance:n=_e.distance,threshold:r=_e.threshold,findAllMatches:i=_e.findAllMatches,minMatchCharLength:o=_e.minMatchCharLength,includeMatches:s=_e.includeMatches,ignoreLocation:l=_e.ignoreLocation}={}){if(u.length>d4)throw new Error(OSe(d4));const E=u.length,c=e.length,D=Math.max(0,Math.min(t,c));let h=r,m=D;const x=o>1||s,p=x?Array(c):[];let f;for(;(f=e.indexOf(u,m))>-1;){let A=Px(u,{currentLocation:f,expectedLocation:D,distance:n,ignoreLocation:l});if(h=Math.min(A,h),m=f+E,x){let B=0;for(;B<E;)p[f+B]=1,B+=1}}m=-1;let g=[],F=1,b=E+c;const y=1<<E-1;for(let A=0;A<E;A+=1){let B=0,j=b;for(;B<j;)Px(u,{errors:A,currentLocation:D+j,expectedLocation:D,distance:n,ignoreLocation:l})<=h?B=j:b=j,j=Math.floor((b-B)/2+B);b=j;let R=Math.max(1,D-j+1),w=i?c:Math.min(D+j,c)+E,O=Array(w+2);O[w+1]=(1<<A)-1;for(let z=w;z>=R;z-=1){let N=z-1,M=a[e.charAt(N)];if(x&&(p[N]=+!!M),O[z]=(O[z+1]<<1|1)&M,A&&(O[z]|=(g[z+1]|g[z])<<1|1|g[z+1]),O[z]&y&&(F=Px(u,{errors:A,currentLocation:N,expectedLocation:D,distance:n,ignoreLocation:l}),F<=h)){if(h=F,m=N,m<=D)break;R=Math.max(1,2*D-m)}}if(Px(u,{errors:A+1,currentLocation:D,expectedLocation:D,distance:n,ignoreLocation:l})>h)break;g=O}const v={isMatch:m>=0,score:Math.max(.001,F)};if(x){const A=$Se(p,o);A.length?s&&(v.indices=A):v.isMatch=!1}return v}function HSe(e){let u={};for(let a=0,t=e.length;a<t;a+=1){const n=e.charAt(a);u[n]=(u[n]||0)|1<<t-a-1}return u}const bp=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class k0u{constructor(u,{location:a=_e.location,threshold:t=_e.threshold,distance:n=_e.distance,includeMatches:r=_e.includeMatches,findAllMatches:i=_e.findAllMatches,minMatchCharLength:o=_e.minMatchCharLength,isCaseSensitive:s=_e.isCaseSensitive,ignoreDiacritics:l=_e.ignoreDiacritics,ignoreLocation:E=_e.ignoreLocation}={}){if(this.options={location:a,threshold:t,distance:n,includeMatches:r,findAllMatches:i,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:l,ignoreLocation:E},u=s?u:u.toLowerCase(),u=l?bp(u):u,this.pattern=u,this.chunks=[],!this.pattern.length)return;const c=(h,m)=>{this.chunks.push({pattern:h,alphabet:HSe(h),startIndex:m})},D=this.pattern.length;if(D>d4){let h=0;const m=D%d4,x=D-m;for(;h<x;)c(this.pattern.substr(h,d4),h),h+=d4;if(m){const p=D-d4;c(this.pattern.substr(p),p)}}else c(this.pattern,0)}searchIn(u){const{isCaseSensitive:a,ignoreDiacritics:t,includeMatches:n}=this.options;if(u=a?u:u.toLowerCase(),u=t?bp(u):u,this.pattern===u){let x={isMatch:!0,score:0};return n&&(x.indices=[[0,u.length-1]]),x}const{location:r,distance:i,threshold:o,findAllMatches:s,minMatchCharLength:l,ignoreLocation:E}=this.options;let c=[],D=0,h=!1;this.chunks.forEach(({pattern:x,alphabet:p,startIndex:f})=>{const{isMatch:g,score:F,indices:b}=VSe(u,x,p,{location:r+f,distance:i,threshold:o,findAllMatches:s,minMatchCharLength:l,includeMatches:n,ignoreLocation:E});g&&(h=!0),D+=F,g&&b&&(c=[...c,...b])});let m={isMatch:h,score:h?D/this.chunks.length:1};return h&&n&&(m.indices=c),m}}class G1{constructor(u){this.pattern=u}static isMultiMatch(u){return yj(u,this.multiRegex)}static isSingleMatch(u){return yj(u,this.singleRegex)}search(){}}function yj(e,u){const a=e.match(u);return a?a[1]:null}class GSe extends G1{constructor(u){super(u)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(u){const a=u===this.pattern;return{isMatch:a,score:a?0:1,indices:[0,this.pattern.length-1]}}}class JSe extends G1{constructor(u){super(u)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(u){const t=u.indexOf(this.pattern)===-1;return{isMatch:t,score:t?0:1,indices:[0,u.length-1]}}}class WSe extends G1{constructor(u){super(u)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(u){const a=u.startsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,this.pattern.length-1]}}}class USe extends G1{constructor(u){super(u)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(u){const a=!u.startsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,u.length-1]}}}class ZSe extends G1{constructor(u){super(u)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(u){const a=u.endsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[u.length-this.pattern.length,u.length-1]}}}class QSe extends G1{constructor(u){super(u)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(u){const a=!u.endsWith(this.pattern);return{isMatch:a,score:a?0:1,indices:[0,u.length-1]}}}class v0u extends G1{constructor(u,{location:a=_e.location,threshold:t=_e.threshold,distance:n=_e.distance,includeMatches:r=_e.includeMatches,findAllMatches:i=_e.findAllMatches,minMatchCharLength:o=_e.minMatchCharLength,isCaseSensitive:s=_e.isCaseSensitive,ignoreDiacritics:l=_e.ignoreDiacritics,ignoreLocation:E=_e.ignoreLocation}={}){super(u),this._bitapSearch=new k0u(u,{location:a,threshold:t,distance:n,includeMatches:r,findAllMatches:i,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:l,ignoreLocation:E})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(u){return this._bitapSearch.searchIn(u)}}class A0u extends G1{constructor(u){super(u)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(u){let a=0,t;const n=[],r=this.pattern.length;for(;(t=u.indexOf(this.pattern,a))>-1;)a=t+r,n.push([t,a-1]);const i=!!n.length;return{isMatch:i,score:i?0:1,indices:n}}}const Tb=[GSe,A0u,WSe,USe,QSe,ZSe,JSe,v0u],Bj=Tb.length,qSe=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,YSe="|";function XSe(e,u={}){return e.split(YSe).map(a=>{let t=a.trim().split(qSe).filter(r=>r&&!!r.trim()),n=[];for(let r=0,i=t.length;r<i;r+=1){const o=t[r];let s=!1,l=-1;for(;!s&&++l<Bj;){const E=Tb[l];let c=E.isMultiMatch(o);c&&(n.push(new E(c,u)),s=!0)}if(!s)for(l=-1;++l<Bj;){const E=Tb[l];let c=E.isSingleMatch(o);if(c){n.push(new E(c,u));break}}}return n})}const uze=new Set([v0u.type,A0u.type]);class eze{constructor(u,{isCaseSensitive:a=_e.isCaseSensitive,ignoreDiacritics:t=_e.ignoreDiacritics,includeMatches:n=_e.includeMatches,minMatchCharLength:r=_e.minMatchCharLength,ignoreLocation:i=_e.ignoreLocation,findAllMatches:o=_e.findAllMatches,location:s=_e.location,threshold:l=_e.threshold,distance:E=_e.distance}={}){this.query=null,this.options={isCaseSensitive:a,ignoreDiacritics:t,includeMatches:n,minMatchCharLength:r,findAllMatches:o,ignoreLocation:i,location:s,threshold:l,distance:E},u=a?u:u.toLowerCase(),u=t?bp(u):u,this.pattern=u,this.query=XSe(this.pattern,this.options)}static condition(u,a){return a.useExtendedSearch}searchIn(u){const a=this.query;if(!a)return{isMatch:!1,score:1};const{includeMatches:t,isCaseSensitive:n,ignoreDiacritics:r}=this.options;u=n?u:u.toLowerCase(),u=r?bp(u):u;let i=0,o=[],s=0;for(let l=0,E=a.length;l<E;l+=1){const c=a[l];o.length=0,i=0;for(let D=0,h=c.length;D<h;D+=1){const m=c[D],{isMatch:x,indices:p,score:f}=m.search(u);if(x){if(i+=1,s+=f,t){const g=m.constructor.type;uze.has(g)?o=[...o,...p]:o.push(p)}}else{s=0,i=0,o.length=0;break}}if(i){let D={isMatch:!0,score:s/i};return t&&(D.indices=o),D}}return{isMatch:!1,score:1}}}const Pb=[];function aze(...e){Pb.push(...e)}function jb(e,u){for(let a=0,t=Pb.length;a<t;a+=1){let n=Pb[a];if(n.condition(e,u))return new n(e,u)}return new k0u(e,u)}const yp={AND:"$and",OR:"$or"},Nb={PATH:"$path",PATTERN:"$val"},Rb=e=>!!(e[yp.AND]||e[yp.OR]),tze=e=>!!e[Nb.PATH],nze=e=>!Xs(e)&&p0u(e)&&!Rb(e),Sj=e=>({[yp.AND]:Object.keys(e).map(u=>({[u]:e[u]}))});function b0u(e,u,{auto:a=!0}={}){const t=n=>{let r=Object.keys(n);const i=tze(n);if(!i&&r.length>1&&!Rb(n))return t(Sj(n));if(nze(n)){const s=i?n[Nb.PATH]:r[0],l=i?n[Nb.PATTERN]:n[s];if(!_o(l))throw new Error(zSe(s));const E={keyId:Mb(s),pattern:l};return a&&(E.searcher=jb(l,u)),E}let o={children:[],operator:r[0]};return r.forEach(s=>{const l=n[s];Xs(l)&&l.forEach(E=>{o.children.push(t(E))})}),o};return Rb(e)||(e=Sj(e)),t(e)}function rze(e,{ignoreFieldNorm:u=_e.ignoreFieldNorm}){e.forEach(a=>{let t=1;a.matches.forEach(({key:n,norm:r,score:i})=>{const o=n?n.weight:null;t*=Math.pow(i===0&&o?Number.EPSILON:i,(o||1)*(u?1:r))}),a.score=t})}function ize(e,u){const a=e.matches;u.matches=[],xr(a)&&a.forEach(t=>{if(!xr(t.indices)||!t.indices.length)return;const{indices:n,value:r}=t;let i={indices:n,value:r};t.key&&(i.key=t.key.src),t.idx>-1&&(i.refIndex=t.idx),u.matches.push(i)})}function oze(e,u){u.score=e.score}function sze(e,u,{includeMatches:a=_e.includeMatches,includeScore:t=_e.includeScore}={}){const n=[];return a&&n.push(ize),t&&n.push(oze),e.map(r=>{const{idx:i}=r,o={item:u[i],refIndex:i};return n.length&&n.forEach(s=>{s(r,o)}),o})}class J1{constructor(u,a={},t){this.options={..._e,...a},this.options.useExtendedSearch,this._keyStore=new TSe(this.options.keys),this.setCollection(u,t)}setCollection(u,a){if(this._docs=u,a&&!(a instanceof Dz))throw new Error(SSe);this._myIndex=a||F0u(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(u){xr(u)&&(this._docs.push(u),this._myIndex.add(u))}remove(u=()=>!1){const a=[];for(let t=0,n=this._docs.length;t<n;t+=1){const r=this._docs[t];u(r,t)&&(this.removeAt(t),t-=1,n-=1,a.push(r))}return a}removeAt(u){this._docs.splice(u,1),this._myIndex.removeAt(u)}getIndex(){return this._myIndex}search(u,{limit:a=-1}={}){const{includeMatches:t,includeScore:n,shouldSort:r,sortFn:i,ignoreFieldNorm:o}=this.options;let s=_o(u)?_o(this._docs[0])?this._searchStringList(u):this._searchObjectList(u):this._searchLogical(u);return rze(s,{ignoreFieldNorm:o}),r&&s.sort(i),f0u(a)&&a>-1&&(s=s.slice(0,a)),sze(s,this._docs,{includeMatches:t,includeScore:n})}_searchStringList(u){const a=jb(u,this.options),{records:t}=this._myIndex,n=[];return t.forEach(({v:r,i,n:o})=>{if(!xr(r))return;const{isMatch:s,score:l,indices:E}=a.searchIn(r);s&&n.push({item:r,idx:i,matches:[{score:l,value:r,norm:o,indices:E}]})}),n}_searchLogical(u){const a=b0u(u,this.options),t=(o,s,l)=>{if(!o.children){const{keyId:c,searcher:D}=o,h=this._findMatches({key:this._keyStore.get(c),value:this._myIndex.getValueForItemAtKeyId(s,c),searcher:D});return h&&h.length?[{idx:l,item:s,matches:h}]:[]}const E=[];for(let c=0,D=o.children.length;c<D;c+=1){const h=o.children[c],m=t(h,s,l);if(m.length)E.push(...m);else if(o.operator===yp.AND)return[]}return E},n=this._myIndex.records,r={},i=[];return n.forEach(({$:o,i:s})=>{if(xr(o)){let l=t(a,o,s);l.length&&(r[s]||(r[s]={idx:s,item:o,matches:[]},i.push(r[s])),l.forEach(({matches:E})=>{r[s].matches.push(...E)}))}}),i}_searchObjectList(u){const a=jb(u,this.options),{keys:t,records:n}=this._myIndex,r=[];return n.forEach(({$:i,i:o})=>{if(!xr(i))return;let s=[];t.forEach((l,E)=>{s.push(...this._findMatches({key:l,value:i[E],searcher:a}))}),s.length&&r.push({idx:o,item:i,matches:s})}),r}_findMatches({key:u,value:a,searcher:t}){if(!xr(a))return[];let n=[];if(Xs(a))a.forEach(({v:r,i,n:o})=>{if(!xr(r))return;const{isMatch:s,score:l,indices:E}=t.searchIn(r);s&&n.push({score:l,key:u,value:r,idx:i,norm:o,indices:E})});else{const{v:r,n:i}=a,{isMatch:o,score:s,indices:l}=t.searchIn(r);o&&n.push({score:s,key:u,value:r,norm:i,indices:l})}return n}}J1.version="7.1.0";J1.createIndex=F0u;J1.parseIndex=KSe;J1.config=_e;J1.parseQuery=b0u;aze(eze);function y0u(e){const[u,a]=C.useState(""),t=C.useMemo(()=>new J1(e,{keys:[{name:"label",weight:1}],threshold:.4,includeScore:!0,findAllMatches:!0,ignoreLocation:!0,useExtendedSearch:!0,shouldSort:!0,includeMatches:!0,distance:100,ignoreFieldNorm:!1}),[e]),n=C.useMemo(()=>{const r=u.trim().replace(/-/g," ");return r?t.search({label:r}).map(o=>o.item):e},[t,e,u]);return{search:u,setSearch:a,filteredOptions:n}}var CC="Popover",[B0u,Ra0]=Tt(CC,[j1]),Mm=j1(),[lze,W1]=B0u(CC),S0u=e=>{const{__scopePopover:u,children:a,open:t,defaultOpen:n,onOpenChange:r,modal:i=!1}=e,o=Mm(u),s=C.useRef(null),[l,E]=C.useState(!1),[c,D]=hn({prop:t,defaultProp:n??!1,onChange:r,caller:CC});return d.jsx(D2,{...o,children:d.jsx(lze,{scope:u,contentId:kt(),triggerRef:s,open:c,onOpenChange:D,onOpenToggle:C.useCallback(()=>D(h=>!h),[D]),hasCustomAnchor:l,onCustomAnchorAdd:C.useCallback(()=>E(!0),[]),onCustomAnchorRemove:C.useCallback(()=>E(!1),[]),modal:i,children:a})})};S0u.displayName=CC;var z0u="PopoverAnchor",Eze=C.forwardRef((e,u)=>{const{__scopePopover:a,...t}=e,n=W1(z0u,a),r=Mm(a),{onCustomAnchorAdd:i,onCustomAnchorRemove:o}=n;return C.useEffect(()=>(i(),()=>o()),[i,o]),d.jsx(dm,{...r,...t,ref:u})});Eze.displayName=z0u;var O0u="PopoverTrigger",w0u=C.forwardRef((e,u)=>{const{__scopePopover:a,...t}=e,n=W1(O0u,a),r=Mm(a),i=Xe(u,n.triggerRef),o=d.jsx(se.button,{type:"button","aria-haspopup":"dialog","aria-expanded":n.open,"aria-controls":n.contentId,"data-state":N0u(n.open),...t,ref:i,onClick:ju(e.onClick,n.onOpenToggle)});return n.hasCustomAnchor?o:d.jsx(dm,{asChild:!0,...r,children:o})});w0u.displayName=O0u;var hz="PopoverPortal",[cze,dze]=B0u(hz,{forceMount:void 0}),M0u=e=>{const{__scopePopover:u,forceMount:a,children:t,container:n}=e,r=W1(hz,u);return d.jsx(cze,{scope:u,forceMount:a,children:d.jsx(fn,{present:a||r.open,children:d.jsx(cd,{asChild:!0,container:n,children:t})})})};M0u.displayName=hz;var N3="PopoverContent",T0u=C.forwardRef((e,u)=>{const a=dze(N3,e.__scopePopover),{forceMount:t=a.forceMount,...n}=e,r=W1(N3,e.__scopePopover);return d.jsx(fn,{present:t||r.open,children:r.modal?d.jsx(hze,{...n,ref:u}):d.jsx(mze,{...n,ref:u})})});T0u.displayName=N3;var Dze=c1("PopoverContent.RemoveScroll"),hze=C.forwardRef((e,u)=>{const a=W1(N3,e.__scopePopover),t=C.useRef(null),n=Xe(u,t),r=C.useRef(!1);return C.useEffect(()=>{const i=t.current;if(i)return t2(i)},[]),d.jsx(a2,{as:Dze,allowPinchZoom:!0,children:d.jsx(P0u,{...e,ref:n,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ju(e.onCloseAutoFocus,i=>{var o;i.preventDefault(),r.current||(o=a.triggerRef.current)==null||o.focus()}),onPointerDownOutside:ju(e.onPointerDownOutside,i=>{const o=i.detail.originalEvent,s=o.button===0&&o.ctrlKey===!0,l=o.button===2||s;r.current=l},{checkForDefaultPrevented:!1}),onFocusOutside:ju(e.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1})})})}),mze=C.forwardRef((e,u)=>{const a=W1(N3,e.__scopePopover),t=C.useRef(!1),n=C.useRef(!1);return d.jsx(P0u,{...e,ref:u,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var i,o;(i=e.onCloseAutoFocus)==null||i.call(e,r),r.defaultPrevented||(t.current||(o=a.triggerRef.current)==null||o.focus(),r.preventDefault()),t.current=!1,n.current=!1},onInteractOutside:r=>{var s,l;(s=e.onInteractOutside)==null||s.call(e,r),r.defaultPrevented||(t.current=!0,r.detail.originalEvent.type==="pointerdown"&&(n.current=!0));const i=r.target;((l=a.triggerRef.current)==null?void 0:l.contains(i))&&r.preventDefault(),r.detail.originalEvent.type==="focusin"&&n.current&&r.preventDefault()}})}),P0u=C.forwardRef((e,u)=>{const{__scopePopover:a,trapFocus:t,onOpenAutoFocus:n,onCloseAutoFocus:r,disableOutsidePointerEvents:i,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:E,...c}=e,D=W1(N3,a),h=Mm(a);return u2(),d.jsx(sm,{asChild:!0,loop:!0,trapped:t,onMountAutoFocus:n,onUnmountAutoFocus:r,children:d.jsx(Ed,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:E,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:l,onDismiss:()=>D.onOpenChange(!1),children:d.jsx(h2,{"data-state":N0u(D.open),role:"dialog",id:D.contentId,...h,...c,ref:u,style:{...c.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),j0u="PopoverClose",xze=C.forwardRef((e,u)=>{const{__scopePopover:a,...t}=e,n=W1(j0u,a);return d.jsx(se.button,{type:"button",...t,ref:u,onClick:ju(e.onClick,()=>n.onOpenChange(!1))})});xze.displayName=j0u;var fze="PopoverArrow",pze=C.forwardRef((e,u)=>{const{__scopePopover:a,...t}=e,n=Mm(a);return d.jsx(m2,{...n,...t,ref:u})});pze.displayName=fze;function N0u(e){return e?"open":"closed"}var gze=S0u,Cze=w0u,Fze=M0u,R0u=T0u;const ph=gze,gh=Cze,R3=C.forwardRef((e,u)=>d.jsx(Fze,{children:d.jsx(L0u,{ref:u,...e})}));R3.displayName=R0u.displayName;const L0u=C.forwardRef(({className:e,align:u="center",sideOffset:a=4,...t},n)=>d.jsx(R0u,{ref:n,align:u,sideOffset:a,className:lu("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 rounded-md border p-4 shadow-md outline-none",e),...t}));L0u.displayName="PopoverContentNoPortal";function kze({title:e,options:u,values:a,onValuesChange:t,size:n,isClearable:r=!0}){const i=new Set(a),{search:o,setSearch:s,filteredOptions:l}=y0u(u),E=Math.min(u.reduce((m,x)=>Math.max(m,x.label.length),0),70),c=Math.max(200,E*8+32),D=32,h=Math.min(250,l.length*D);return d.jsxs(ph,{onOpenChange:m=>!m&&s(""),children:[d.jsx(gh,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",size:n,className:"border-dashed",children:[d.jsx(LV,{className:"h-4 w-4"}),e,(i==null?void 0:i.size)>0&&d.jsxs(d.Fragment,{children:[d.jsx(om,{orientation:"vertical",className:"mx-2 h-4"}),d.jsx(Ts,{variant:"secondary",className:"rounded-sm px-1 font-normal lg:hidden",children:i.size}),d.jsx("div",{className:"hidden space-x-1 lg:flex",children:i.size>2?d.jsxs(Ts,{variant:"secondary",className:"rounded-sm px-1 font-normal",children:[i.size," selected"]}):u.filter(m=>i.has(m.value)).map(m=>d.jsx(Ts,{variant:"secondary",className:"max-w-[200px] rounded-sm px-1 font-normal",children:d.jsx("span",{className:"truncate",children:m.label})},m.value))})]})]})}),d.jsx(R3,{className:"w-[200px] p-0",align:"start",children:d.jsxs(wm,{shouldFilter:!1,children:[d.jsx(gC,{placeholder:e,value:o,onValueChange:s}),d.jsxs(j4,{children:[d.jsx(t1,{children:"No results found."}),d.jsx(fh,{children:d.jsx(s0u,{width:c,height:h,itemCount:l.length,itemSize:D,children:({index:m,style:x})=>{const p=l[m],f=i.has(p.value);return d.jsxs(Ps,{style:x,onSelect:()=>{const g=i;f?g.delete(p.value):g.add(p.value),t(Array.from(g))},children:[d.jsx("div",{className:lu("border-primary flex h-4 w-4 items-center justify-center rounded-sm border",f?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:d.jsx(d1,{className:lu("h-4 w-4")})}),d.jsx("span",{className:"flex-1 truncate",children:p.label})]},p.value)}})}),r&&i.size>0&&d.jsxs(d.Fragment,{children:[d.jsx(dz,{}),d.jsx(fh,{children:d.jsx(Ps,{onSelect:()=>t([]),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function vze({title:e,options:u,value:a,onValueChange:t,size:n,className:r,isClearable:i=!0}){const{search:o,setSearch:s,filteredOptions:l}=y0u(u),E=Math.min(u.reduce((m,x)=>Math.max(m,x.label.length),0),70),c=Math.max(200,E*8+32),D=32,h=Math.min(250,l.length*D);return d.jsxs(ph,{onOpenChange:m=>!m&&s(""),children:[d.jsx(gh,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",size:n,className:lu("border-dashed",r),children:[d.jsx(LV,{className:"h-4 w-4"}),e,a!==void 0&&d.jsxs(d.Fragment,{children:[d.jsx(om,{orientation:"vertical",className:"mx-2 h-4"}),d.jsx("div",{className:"space-x-1 lg:flex",children:u.filter(m=>a===m.value).map(m=>d.jsx(Ts,{variant:"secondary",className:"max-w-[200px] rounded-sm px-1 font-normal",children:d.jsx("span",{className:"truncate",children:m.label})},m.value))})]})]})}),d.jsx(R3,{className:"w-fit p-0",align:"start",children:d.jsxs(wm,{shouldFilter:!1,children:[d.jsx(gC,{placeholder:e,value:o,onValueChange:s}),d.jsxs(j4,{children:[d.jsx(t1,{children:"No results found."}),d.jsx(fh,{children:d.jsx(s0u,{width:c,height:h,itemCount:l.length,itemSize:D,children:({index:m,style:x})=>{const p=l[m],f=a===p.value;return d.jsxs(Ps,{style:x,onSelect:()=>{t(f?void 0:p.value)},children:[d.jsx("div",{className:lu("border-primary over nowrap flex h-4 w-4 items-center justify-center overflow-hidden rounded-sm border",f?"bg-primary text-primary-foreground":"opacity-50 [&_svg]:invisible"),children:d.jsx(d1,{className:lu("h-4 w-4")})}),d.jsx("span",{className:"flex-1 truncate",children:p.label})]},p.value)}})}),i&&a!==void 0&&d.jsxs(d.Fragment,{children:[d.jsx(dz,{}),d.jsx(fh,{children:d.jsx(Ps,{onSelect:()=>t(void 0),className:"justify-center text-center",children:"Clear filters"})})]})]})]})})]})}function nc({column:e,title:u,options:a,isMulti:t,isClearable:n}){const r=(e==null?void 0:e.getFilterValue())??[];return t?d.jsx(kze,{title:u,options:a,isClearable:n,values:r,onValuesChange:i=>e==null?void 0:e.setFilterValue(i),size:"sm"}):d.jsx(vze,{title:u,isClearable:n,options:a,value:r.length>0?r[0]:void 0,onValueChange:i=>e==null?void 0:e.setFilterValue(i?[i]:void 0),size:"sm"})}function Aze({table:e,filterFields:u=[]}){const a=e.getState().columnFilters.length>0,{searchableColumns:t,filterableColumns:n}=C.useMemo(()=>({searchableColumns:u.filter(r=>!r.options),filterableColumns:u.filter(r=>r.options)}),[u]);return d.jsx("div",{className:"flex max-w-full items-center justify-between",children:d.jsxs("div",{className:"flex flex-1 flex-wrap items-center gap-2",children:[t.length>0&&t.map(r=>{var i;return e.getColumn(r.value?String(r.value):"")&&d.jsx(SE,{placeholder:r.placeholder,value:((i=e.getColumn(String(r.value)))==null?void 0:i.getFilterValue())??"",onChange:o=>{var s;(s=e.getColumn(String(r.value)))==null||s.setFilterValue(o)},className:"h-8 w-40 lg:w-64"},String(r.value))}),n.length>0&&n.map(r=>e.getColumn(r.value?String(r.value):"")&&d.jsx(nc,{column:e.getColumn(r.value?String(r.value):""),title:r.label,options:r.options??[],isMulti:r.isMulti},String(r.value))),a&&d.jsxs(Ve,{"aria-label":"Reset filters",variant:"ghost",className:"h-8 px-2 lg:px-3",onClick:()=>e.resetColumnFilters(),children:["Reset",d.jsx(FE,{className:"size-4","aria-hidden":"true"})]})]})})}const mz=e=>ns("/api/entities",e),FC=async()=>{await a8("/api/entities")},bze=({currentName:e,onSave:u,placeholder:a="Test title",key:t})=>{const[n,r]=C.useState(e);C.useEffect(()=>{r(e)},[e]);const i=async()=>{const o=n.trim();if(o!==e){if(!o){Ca.error("Name cannot be empty."),r(e);return}try{YZ(o)}catch(s){Ca.error("Invalid name.",{description:s.message}),r(e);return}try{await u(o)}catch(s){Ca.error("Failed to save name.",{description:`${s}`}),r(e)}}};return d.jsx(SE,{className:"text-foreground hover:bg-muted focus:border-input w-[95%] -translate-x-1 border-none bg-transparent p-0 px-1 text-lg font-semibold shadow-none transition-colors duration-100 focus-visible:bg-transparent",placeholder:a,value:n,onChange:o=>r(o),onBlur:i},t)};var kC="Switch",[yze,La0]=Tt(kC),[Bze,Sze]=yze(kC),_0u=C.forwardRef((e,u)=>{const{__scopeSwitch:a,name:t,checked:n,defaultChecked:r,required:i,disabled:o,value:s="on",onCheckedChange:l,form:E,...c}=e,[D,h]=C.useState(null),m=Xe(u,F=>h(F)),x=C.useRef(!1),p=D?E||!!D.closest("form"):!0,[f,g]=hn({prop:n,defaultProp:r??!1,onChange:l,caller:kC});return d.jsxs(Bze,{scope:a,checked:f,disabled:o,children:[d.jsx(se.button,{type:"button",role:"switch","aria-checked":f,"aria-required":i,"data-state":V0u(f),"data-disabled":o?"":void 0,disabled:o,value:s,...c,ref:m,onClick:ju(e.onClick,F=>{g(b=>!b),p&&(x.current=F.isPropagationStopped(),x.current||F.stopPropagation())})}),p&&d.jsx($0u,{control:D,bubbles:!x.current,name:t,value:s,checked:f,required:i,disabled:o,form:E,style:{transform:"translateX(-100%)"}})]})});_0u.displayName=kC;var I0u="SwitchThumb",K0u=C.forwardRef((e,u)=>{const{__scopeSwitch:a,...t}=e,n=Sze(I0u,a);return d.jsx(se.span,{"data-state":V0u(n.checked),"data-disabled":n.disabled?"":void 0,...t,ref:u})});K0u.displayName=I0u;var zze="SwitchBubbleInput",$0u=C.forwardRef(({__scopeSwitch:e,control:u,checked:a,bubbles:t=!0,...n},r)=>{const i=C.useRef(null),o=Xe(i,r),s=C2(a),l=d2(u);return C.useEffect(()=>{const E=i.current;if(!E)return;const c=window.HTMLInputElement.prototype,h=Object.getOwnPropertyDescriptor(c,"checked").set;if(s!==a&&h){const m=new Event("click",{bubbles:t});h.call(E,a),E.dispatchEvent(m)}},[s,a,t]),d.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:a,...n,tabIndex:-1,ref:o,style:{...n.style,...l,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});$0u.displayName=zze;function V0u(e){return e?"checked":"unchecked"}var H0u=_0u,Oze=K0u;const Ch=C.forwardRef(({className:e,...u},a)=>d.jsx(H0u,{className:lu("focus-visible:ring-ring focus-visible:ring-offset-background data-[state=checked]:bg-primary data-[state=unchecked]:bg-input peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),...u,ref:a,children:d.jsx(Oze,{className:lu("bg-background pointer-events-none block h-4 w-4 rounded-full shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));Ch.displayName=H0u.displayName;var vC="Tabs",[wze,_a0]=Tt(vC,[L1]),G0u=L1(),[Mze,xz]=wze(vC),J0u=C.forwardRef((e,u)=>{const{__scopeTabs:a,value:t,onValueChange:n,defaultValue:r,orientation:i="horizontal",dir:o,activationMode:s="automatic",...l}=e,E=xd(o),[c,D]=hn({prop:t,onChange:n,defaultProp:r??"",caller:vC});return d.jsx(Mze,{scope:a,baseId:kt(),value:c,onValueChange:D,orientation:i,dir:E,activationMode:s,children:d.jsx(se.div,{dir:E,"data-orientation":i,...l,ref:u})})});J0u.displayName=vC;var W0u="TabsList",U0u=C.forwardRef((e,u)=>{const{__scopeTabs:a,loop:t=!0,...n}=e,r=xz(W0u,a),i=G0u(a);return d.jsx(A2,{asChild:!0,...i,orientation:r.orientation,dir:r.dir,loop:t,children:d.jsx(se.div,{role:"tablist","aria-orientation":r.orientation,...n,ref:u})})});U0u.displayName=W0u;var Z0u="TabsTrigger",Q0u=C.forwardRef((e,u)=>{const{__scopeTabs:a,value:t,disabled:n=!1,...r}=e,i=xz(Z0u,a),o=G0u(a),s=X0u(i.baseId,t),l=uau(i.baseId,t),E=t===i.value;return d.jsx(b2,{asChild:!0,...o,focusable:!n,active:E,children:d.jsx(se.button,{type:"button",role:"tab","aria-selected":E,"aria-controls":l,"data-state":E?"active":"inactive","data-disabled":n?"":void 0,disabled:n,id:s,...r,ref:u,onMouseDown:ju(e.onMouseDown,c=>{!n&&c.button===0&&c.ctrlKey===!1?i.onValueChange(t):c.preventDefault()}),onKeyDown:ju(e.onKeyDown,c=>{[" ","Enter"].includes(c.key)&&i.onValueChange(t)}),onFocus:ju(e.onFocus,()=>{const c=i.activationMode!=="manual";!E&&!n&&c&&i.onValueChange(t)})})})});Q0u.displayName=Z0u;var q0u="TabsContent",Y0u=C.forwardRef((e,u)=>{const{__scopeTabs:a,value:t,forceMount:n,children:r,...i}=e,o=xz(q0u,a),s=X0u(o.baseId,t),l=uau(o.baseId,t),E=t===o.value,c=C.useRef(E);return C.useEffect(()=>{const D=requestAnimationFrame(()=>c.current=!1);return()=>cancelAnimationFrame(D)},[]),d.jsx(fn,{present:n||E,children:({present:D})=>d.jsx(se.div,{"data-state":E?"active":"inactive","data-orientation":o.orientation,role:"tabpanel","aria-labelledby":s,hidden:!D,id:l,tabIndex:0,...i,ref:u,style:{...e.style,animationDuration:c.current?"0s":void 0},children:D&&r})})});Y0u.displayName=q0u;function X0u(e,u){return`${e}-trigger-${u}`}function uau(e,u){return`${e}-content-${u}`}var Tze=J0u,eau=U0u,aau=Q0u,tau=Y0u;const Tm=Tze,Od=C.forwardRef(({className:e,...u},a)=>d.jsx(eau,{ref:a,className:lu("bg-muted text-muted-foreground inline-flex h-9 items-center justify-center rounded-lg p-1",e),...u}));Od.displayName=eau.displayName;const On=C.forwardRef(({className:e,...u},a)=>d.jsx(aau,{ref:a,className:lu("ring-offset-background focus-visible:ring-ring data-[state=active]:bg-background data-[state=active]:text-foreground inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow",e),...u}));On.displayName=aau.displayName;const wn=C.forwardRef(({className:e,...u},a)=>d.jsx(tau,{ref:a,className:lu("ring-offset-background focus-visible:ring-ring mt-2 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2",e),...u}));wn.displayName=tau.displayName;const Pm=(e,u)=>ns(`/api/mobile-tests/${encodeURIComponent(e)}`,u),Pze=({test:e,labels:u})=>d.jsxs("div",{children:[d.jsxs("div",{className:"flex flex-col space-y-2 text-center sm:text-left",children:[d.jsx(jze,{metadata:e}),d.jsx("div",{className:"text-muted-foreground text-sm",children:e.relativePathSegments.slice(0,-1).join(e.platformSep)})]}),d.jsx("div",{className:"h-full py-4",children:d.jsxs("div",{className:"space-y-4",children:[d.jsx("div",{className:"flex gap-2",children:d.jsx(Ve,{asChild:!0,children:d.jsxs(uo,{to:`/tests/${e.relativePath}`,children:[d.jsx(IV,{className:"h-4 w-4"}),"Edit"]})})}),d.jsxs(Tm,{defaultValue:"overview",children:[d.jsxs(Od,{children:[d.jsx(On,{value:"overview",children:"Overview"}),d.jsx(On,{value:"description",children:"Description"})]}),d.jsx(wn,{value:"overview",children:d.jsx(Nze,{metadata:e,labels:u})}),d.jsx(wn,{value:"description",children:d.jsx(Rze,{metadata:e})})]})]})})]}),jze=({metadata:e})=>{const u=Ci(),{data:a}=Pm(e.relativePath),t=e.name.replace(/\.test\.yaml$/,""),n=async i=>{const o={name:i.name??e.name,description:(a==null?void 0:a.description)??e.description??""};await u(`/api/mobile-tests/${encodeURIComponent(e.relativePath)}/metadata`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)})},r=async i=>{await n({name:i}),await km(e.relativePathSegments.slice(0,-1)),FC().catch(o=>{Ca.error("Failed to revalidate entities.",{description:`${o}`})})};return d.jsx(bze,{currentName:t,onSave:r,placeholder:"Test title"},e.id)},Nze=({metadata:e})=>{var r,i,o,s,l;const u=Ci(),{data:a,mutate:t}=Pm(e.relativePath),n=async E=>{const c={disabled:E.disabled};try{await u(`/api/mobile-tests/${encodeURIComponent(e.relativePath)}/metadata`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(c)}),await FC()}catch(D){Ca.error("Failed to save test.",{description:`${D}`})}};return a?d.jsxs("div",{className:"grid gap-4",children:[d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Created"}),d.jsx("div",{children:e.createdAt.toLocaleString()})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Last updated"}),d.jsx("div",{children:e.lastModified.toLocaleString()})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Labels"}),d.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[(r=e.labels)==null?void 0:r.map(E=>d.jsx(Ts,{variant:"outline",children:E},E)),!e.labels||e.labels.length===0?d.jsx("div",{className:"text-muted-foreground text-sm",children:"No labels"}):null]})]}),d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Disabled"}),d.jsx("div",{children:d.jsx(Ch,{checked:(a==null?void 0:a.disabled)??!1,onCheckedChange:async E=>{t({...a,disabled:E});try{await n({disabled:E})}catch{t({...a,disabled:!E})}}})})]}),((i=a.settings)==null?void 0:i.retries)!==void 0&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Retries"}),d.jsx("div",{children:a.settings.retries})]}),((o=a.settings)==null?void 0:o.defaultChannel)&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Default channel"}),d.jsx("div",{children:a.settings.defaultChannel})]}),((s=a.settings)==null?void 0:s.defaultTag)&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Default tag"}),d.jsx("div",{children:a.settings.defaultTag})]}),((l=a.settings)==null?void 0:l.defaultEnv)&&d.jsxs("div",{className:"space-y-2",children:[d.jsx(xt,{children:"Default environment"}),d.jsx("div",{children:a.settings.defaultEnv})]})]}):null},Rze=({metadata:e})=>{const u=Ci(),{data:a,mutate:t}=Pm(e.relativePath),n=async i=>{const o={description:i.description??(a==null?void 0:a.description)??e.description??""};try{await u(`/api/mobile-tests/${encodeURIComponent(e.relativePath)}/metadata`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}),await FC()}catch(s){Ca.error("Failed to save description.",{description:`${s}`})}},r=async i=>{if(!a)return;const o=i.target.value;if(o!==a.description){if(o.trim().length===0){Ca.error("Description cannot be empty.");return}await n({description:o}),await t({...a,description:o})}};return a?d.jsx(zd,{placeholder:"Example test description",defaultValue:a.description??"",rows:10,onBlur:r},e.id):null},As=e=>e.type==="FOLDER",Bp=e=>e.type==="MODULE",Lze=e=>d.jsxs(Ve,{variant:"outline",size:"sm",className:"absolute right-2 top-1/2 translate-y-[-50%] opacity-0 transition-opacity group-hover:opacity-100",...e,children:[d.jsx(FDu,{className:"size-4"}),"View details"]}),_ze=[{id:"type",meta:{className:"hidden"},accessorFn:e=>e.type,header:({column:e})=>d.jsx(Jn,{column:e,title:"Type"}),cell:({row:e})=>e.original.type,filterFn:"arrIncludesSome"},{id:"name",meta:{className:"w-full"},accessorFn:e=>e.name,header:({column:e})=>d.jsx(Jn,{column:e,title:"Name"}),cell:({row:e,table:u})=>{var a;return As(e.original)?d.jsxs("div",{className:"text-primary flex min-w-0 items-center",children:[d.jsx(t8,{className:"mr-2 size-4 shrink-0 text-slate-600"}),d.jsx("span",{className:"whitespace-nowrap font-medium",children:e.original.name})]}):Bp(e.original)?d.jsx(d.Fragment,{children:d.jsxs("div",{className:"text-primary flex min-w-0 flex-col",children:[d.jsxs("div",{className:"flex items-center",children:[d.jsx(r8,{className:"mr-2 size-4 shrink-0 text-amber-600"}),d.jsx("span",{className:"whitespace-nowrap font-medium",children:e.original.fileName})]}),e.original.description&&d.jsx("div",{className:"text-muted-foreground pl-6",children:e.original.description})]})}):d.jsx(d.Fragment,{children:d.jsxs("div",{className:"text-primary relative flex flex-col",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(Z5u,{className:"size-4 shrink-0 text-blue-600"}),d.jsx("span",{className:"max-w-[500px] truncate whitespace-nowrap font-medium",children:e.original.fileName}),(a=e.original.labels)==null?void 0:a.map(t=>d.jsx(Ts,{variant:"outline",className:"whitespace-nowrap",children:t},t))]}),e.original.description&&d.jsx("div",{className:"text-muted-foreground pl-6",children:e.original.description}),d.jsx(Lze,{onClick:t=>{var n,r;t.stopPropagation(),t.preventDefault(),(r=(n=u.options.meta)==null?void 0:n.openDetails)==null||r.call(n,e.original)}})]})})}},{id:"createdAt",accessorFn:e=>{if(!As(e))return e.createdAt},header:({column:e})=>d.jsx(Jn,{column:e,title:"Created at"}),cell:({row:e})=>As(e.original)||!e.original.createdAt?d.jsx("div",{className:"text-muted-foreground",children:V7}):d.jsx("div",{className:"text-muted-foreground",children:d.jsx(up,{date:e.original.createdAt})})},{id:"updateAt",accessorFn:e=>{if(!As(e))return e.updatedAt},header:({column:e})=>d.jsx(Jn,{column:e,title:"Last updated at"}),cell:({row:e})=>As(e.original)||!e.original.updatedAt?d.jsx("div",{className:"text-muted-foreground",children:V7}):d.jsx("div",{className:"text-muted-foreground",children:d.jsx(up,{date:e.original.updatedAt})})},{id:"actions",meta:{className:"min-w-[100px]"},header:()=>null,cell:({row:e})=>As(e.original)||Bp(e.original)?null:d.jsx("div",{className:"flex justify-end gap-2",children:d.jsxs("div",{className:"flex gap-2 opacity-0 transition-opacity group-hover:opacity-100",children:[d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Ve,{variant:"ghost",size:"smIcon",className:"text-muted-foreground",children:d.jsx(IV,{className:"h-4 w-4"})})}),d.jsx(n0,{children:"Edit"})]}),d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Ve,{variant:"ghost",size:"smIcon",className:"text-muted-foreground",onClick:u=>{u.stopPropagation(),u.preventDefault(),navigator.clipboard.writeText(I7u(e.original.name)),Ca.success("Copied to clipboard!")},children:d.jsx(X5u,{className:"h-4 w-4"})})}),d.jsx(n0,{children:"Copy path"})]})]})}),enableSorting:!1}];function Ize({data:e,openDetails:u}){const[a,t]=C.useState({}),[n,r]=C.useState({}),[i,o]=C.useState([]),[s,l]=C.useState([{id:"name",desc:!1}]);return{table:T8({data:e,columns:_ze,state:{sorting:s,columnVisibility:n,rowSelection:a,columnFilters:i,rowPinning:{top:e.filter(As).map(c=>c.relativePath),bottom:e.filter(Bp).map(c=>c.relativePath)}},initialState:{pagination:{pageSize:e.length,pageIndex:0}},meta:{openDetails:u},keepPinnedRows:!1,enableRowSelection:!1,enableRowPinning:!0,onRowSelectionChange:t,onSortingChange:l,onColumnFiltersChange:o,onColumnVisibilityChange:r,getCoreRowModel:w8(),getFilteredRowModel:HG(),getSortedRowModel:M8(),getFacetedRowModel:$G(),getFacetedUniqueValues:VG(),getRowId:c=>c.relativePath})}}const Kze=[{label:"Type",value:"type",isMulti:!0,options:[{label:"Test",value:"TEST"},{label:"Module",value:"MODULE"},{label:"Folder",value:"FOLDER"}]}];function nau({testMetadatas:e,moduleMetadatas:u,folderMetadatas:a,pathSegments:t,showAllFlattened:n}){const{data:r}=mz(),i=il(),o=C.useMemo(()=>{const D=OP(e.map(x=>{const p=r==null?void 0:r.tests.find(f=>f.relativePath===x.relativePath);if(p)return{type:"TEST",name:p.name,relativePath:p.relativePath,fileName:p.fileName,pathSegments:x.pathSegments,id:p.id,description:p.description,createdAt:p.createdAt,updatedAt:p.lastModified,labels:p.labels}})),h=OP(u.map(x=>{const p=r==null?void 0:r.modules.find(f=>f.relativePath===x.relativePath);if(p)return{type:"MODULE",name:p.name,id:p.id,relativePath:p.relativePath,fileName:p.fileName,description:p.description,createdAt:p.createdAt,updatedAt:p.lastModified}}));return n?[...D,...h]:[...a.map(x=>({type:"FOLDER",name:x.name,relativePath:x.relativePath,pathSegments:x.pathSegments})),...D,...h]},[r==null?void 0:r.modules,r==null?void 0:r.tests,a,u,n,e]),{table:s}=Ize({data:o,openDetails:D=>{As(D)||E(D)}}),[l,E]=C.useState(null),c=C.useMemo(()=>!l||l.type!=="TEST"?null:r==null?void 0:r.tests.find(D=>D.id===l.id),[l,r==null?void 0:r.tests]);return C.useMemo(()=>!l||l.type!=="MODULE"?null:r==null?void 0:r.modules.find(D=>D.fileName===l.fileName),[l,r==null?void 0:r.modules]),C.useEffect(()=>{E(null)},[i.pathname]),d.jsxs("div",{className:"w-full",children:[d.jsx(OJ,{table:s,hidePagination:!0,RowComponent:({row:D,children:h,...m})=>{const x=D.original;if(As(x)){const g=`/browse/${[...t||[],x.name].join("/")}`;return d.jsx(tb,{...m,asChild:!0,children:d.jsx(uo,{to:g,children:h})})}if(Bp(x))return d.jsx(Xl,{...m,onClick:()=>{E(x)},children:h});const p=`/tests/${x.relativePath}`;return d.jsx(tb,{...m,asChild:!0,className:"group",children:d.jsx(uo,{to:p,children:h})})},children:d.jsx(Aze,{table:s,filterFields:Kze})}),c&&d.jsxs("div",{className:"bg-background fixed bottom-0 right-0 top-0 z-50 w-[600px] overflow-auto border-l p-6",children:[d.jsx("button",{className:"ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none",onClick:()=>{E(null)},children:d.jsx(FE,{className:"h-4 w-4"})}),d.jsx(Pze,{test:c,labels:(r==null?void 0:r.labels)||[]})]})]})}function $ze(){const{"*":e=""}=cV(),{hasCustomRoot:u,rootPathSegments:a}=ZU(),t=e.split("/").filter(Boolean),{data:n}=nS(t.length?t:["."]);if(t.length===0&&u)return d.jsx(xV,{to:`/browse/${a.join("/")}`,replace:!0});const r=n==null?void 0:n.contents.filter(c=>c.isDirectory),i=n==null?void 0:n.contents.filter(c=>c.name.endsWith(".test.yaml")),o=n==null?void 0:n.contents.filter(c=>c.name.endsWith(".module.yaml")),s=[],l=u?t.slice(a.length):t;for(let c=0;c<l.length-1;c++){const D=t.slice(0,a.length+c+1);s.push(d.jsx(Ro,{children:d.jsx(QD,{asChild:!0,children:d.jsx(uo,{to:`/browse/${D.join("/")}`,children:l[c]})})},c)),s.push(d.jsx(qD,{},`separator-${c}`))}const E=u?`/browse/${a.join("/")}`:"/browse";return l.length>0?s.unshift(d.jsx(Ro,{children:d.jsx(QD,{asChild:!0,children:d.jsx(uo,{to:E,children:"Repository"})})},"root"),d.jsx(qD,{},"separator-root")):s.unshift(d.jsx(Ro,{children:d.jsx(m3,{children:"Repository"})},"root")),d.jsxs("div",{className:"flex h-full flex-1 flex-col overflow-auto",children:[d.jsxs("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[d.jsx(hm,{children:d.jsxs(mm,{children:[s,l.length>0&&d.jsx(Ro,{children:d.jsx(m3,{children:l[l.length-1]})})]})}),d.jsxs("div",{className:"ml-auto flex gap-2",children:[d.jsx(Cvu,{pathSegments:t}),d.jsx(I8e,{pathSegments:t})]})]}),d.jsx("div",{className:"flex flex-1 flex-col gap-4 p-4",children:d.jsx(nau,{testMetadatas:(i==null?void 0:i.map(c=>({fileName:c.name,relativePath:c.relativePath,pathSegments:c.pathSegments})))||[],moduleMetadatas:(o==null?void 0:o.map(c=>({fileName:c.name,relativePath:c.relativePath,pathSegments:c.pathSegments})))||[],folderMetadatas:(r==null?void 0:r.map(c=>({name:c.name,relativePath:c.relativePath,pathSegments:c.pathSegments})))||[],pathSegments:t,showAllFlattened:!1})})]})}const AC=C.forwardRef(({className:e,...u},a)=>d.jsx("div",{className:"relative w-full overflow-auto",children:d.jsx("table",{ref:a,className:lu("w-full caption-bottom text-sm",e),...u})}));AC.displayName="Table";const bC=C.forwardRef(({className:e,...u},a)=>d.jsx("thead",{ref:a,className:lu("[&_tr]:border-b",e),...u}));bC.displayName="TableHeader";const yC=C.forwardRef(({className:e,...u},a)=>d.jsx("tbody",{ref:a,className:lu("[&>:last-child]:border-0",e),...u}));yC.displayName="TableBody";const rau=C.forwardRef(({className:e,...u},a)=>d.jsx("tfoot",{ref:a,className:lu("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...u}));rau.displayName="TableFooter";const Wo=C.forwardRef(({className:e,...u},a)=>d.jsx("tr",{ref:a,className:lu("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",e),...u}));Wo.displayName="TableRow";const Io=C.forwardRef(({className:e,...u},a)=>d.jsx("th",{ref:a,className:lu("text-muted-foreground h-10 px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...u}));Io.displayName="TableHead";const gr=C.forwardRef(({className:e,...u},a)=>d.jsx("td",{ref:a,className:lu("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...u}));gr.displayName="TableCell";const Vze=C.forwardRef(({className:e,...u},a)=>d.jsx("caption",{ref:a,className:lu("text-muted-foreground mt-4 text-sm",e),...u}));Vze.displayName="TableCaption";function zj(e,u){const a=e.variables[u];if(typeof a=="string")return a}function Hze(){const{data:e=[]}=fC(),u=C.useMemo(()=>e.map(a=>({name:a.name,localAvdId:zj(a,P3),localApkPath:zj(a,Eh)})).sort((a,t)=>a.name.localeCompare(t.name)),[e]);return d.jsxs("div",{className:"flex h-full flex-1 flex-col overflow-auto",children:[d.jsx("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:d.jsx(hm,{children:d.jsx(mm,{children:d.jsx(Ro,{children:d.jsx(m3,{children:"Environments"})})})})}),d.jsxs("div",{className:"flex flex-1 flex-col gap-4 p-4",children:[d.jsx("div",{className:"w-full overflow-auto rounded-md border",children:d.jsxs(AC,{className:"table-fixed",children:[d.jsx(bC,{children:d.jsxs(Wo,{children:[d.jsx(Io,{className:"w-1/4 whitespace-nowrap text-xs",children:"Name"}),d.jsx(Io,{className:"w-1/4 whitespace-nowrap text-xs",children:"Local AVD ID"}),d.jsx(Io,{className:"w-2/4 whitespace-nowrap text-xs",children:"Local APK path"})]})}),d.jsx(yC,{children:u.length?u.map(a=>d.jsxs(Wo,{className:"h-[50px]",children:[d.jsx(gr,{className:"relative w-1/4",children:d.jsx("div",{className:"truncate font-medium",children:a.name})}),d.jsx(gr,{className:"relative w-1/4",children:d.jsx("div",{className:"text-muted-foreground truncate",children:a.localAvdId??"—"})}),d.jsx(gr,{className:"relative w-2/4",children:d.jsx("div",{className:"text-muted-foreground truncate",children:a.localApkPath??"—"})})]},a.name)):d.jsx(Wo,{className:"relative h-24",children:d.jsx(gr,{colSpan:3,className:"h-24 text-center",children:"No environments."})})})]})}),d.jsxs("div",{className:"text-xs",children:["Environments allow mobile tests to share variables and emulator settings when running locally. Configure them in your"," ",d.jsx("span",{className:"font-mono",children:"momentic.config.yaml"}),"."," ",d.jsx(xh,{slug:"/mobile-cli/emulators#environment-based-settings"})]})]})]})}function iau(e,u,a){try{return e(u)}catch(t){return C4u("[nuqs] Error while parsing value `%s`: %O"+(a?" (for key `%s`)":""),u,t,a),null}}function Gze(){var u;if(typeof window>"u"||!!!window.GestureEvent)return 50;try{const a=(u=navigator.userAgent)==null?void 0:u.match(/version\/([\d\.]+) safari/i);return parseFloat(a[1])>=17?120:320}catch{return 320}}var BC=Gze(),Fh=new Map,fr={history:"replace",scroll:!1,shallow:!0,throttleMs:BC},fz=new Set,Oj=0,d5=null;function Jze(e){return Fh.get(e)}function Wze(){Fh.clear(),fz.clear(),fr.history="replace",fr.scroll=!1,fr.shallow=!0,fr.throttleMs=BC}function Uze(e,u,a,t){const n=u===null?null:a(u);return Ri("[nuqs queue] Enqueueing %s=%s %O",e,n,t),Fh.set(e,n),t.history==="push"&&(fr.history="push"),t.scroll&&(fr.scroll=!0),t.shallow===!1&&(fr.shallow=!1),t.startTransition&&fz.add(t.startTransition),fr.throttleMs=Math.max(t.throttleMs??BC,Number.isFinite(fr.throttleMs)?fr.throttleMs:0),n}function Zze(){return new URLSearchParams(location.search)}function Qze({getSearchParamsSnapshot:e=Zze,updateUrl:u,rateLimitFactor:a=1}){return d5===null&&(d5=new Promise((t,n)=>{if(!Number.isFinite(fr.throttleMs)){Ri("[nuqs queue] Skipping flush due to throttleMs=Infinity"),t(e()),setTimeout(()=>{d5=null},0);return}function r(){Oj=performance.now();const[o,s]=qze({updateUrl:u,getSearchParamsSnapshot:e});s===null?t(o):n(o),d5=null}function i(){const s=performance.now()-Oj,l=fr.throttleMs,E=a*Math.max(0,Math.min(l,l-s));Ri("[nuqs queue] Scheduling flush in %f ms. Throttled at %f ms",E,l),E===0?r():setTimeout(r,E)}setTimeout(i,0)})),d5}function qze({updateUrl:e,getSearchParamsSnapshot:u}){const a=u();if(Fh.size===0)return[a,null];const t=Array.from(Fh.entries()),n={...fr},r=Array.from(fz);Wze(),Ri("[nuqs queue] Flushing queue %O with options %O",t,n);for(const[i,o]of t)o===null?a.delete(i):a.set(i,o);try{return Yze(r,()=>{e(a,{history:n.history,scroll:n.scroll,shallow:n.shallow})}),[a,null]}catch(i){return console.error(Xh(429),t.map(([o])=>o).join(),i),[a,i]}}function Yze(e,u){const a=t=>{if(t===e.length)return u();const n=e[t];if(!n)throw new Error("Invalid transition function");n(()=>a(t+1))};a(0)}function sl(e){function u(a){if(typeof a>"u")return null;let t="";if(Array.isArray(a)){if(a[0]===void 0)return null;t=a[0]}return typeof a=="string"&&(t=a),iau(e.parse,t)}return{eq:(a,t)=>a===t,...e,parseServerSide:u,withDefault(a){return{...this,defaultValue:a,parseServerSide(t){return u(t)??a}}},withOptions(a){return{...this,...a}}}}var Xze=sl({parse:e=>e,serialize:e=>`${e}`}),wj=sl({parse:e=>{const u=parseInt(e);return Number.isNaN(u)?null:u},serialize:e=>Math.round(e).toFixed()});sl({parse:e=>{const u=wj.parse(e);return u===null?null:u-1},serialize:e=>wj.serialize(e+1)});sl({parse:e=>{const u=parseInt(e,16);return Number.isNaN(u)?null:u},serialize:e=>{const u=Math.round(e).toString(16);return u.padStart(u.length+u.length%2,"0")}});sl({parse:e=>{const u=parseFloat(e);return Number.isNaN(u)?null:u},serialize:e=>e.toString()});sl({parse:e=>e==="true",serialize:e=>e?"true":"false"});function pz(e,u){return e.valueOf()===u.valueOf()}sl({parse:e=>{const u=parseInt(e);return Number.isNaN(u)?null:new Date(u)},serialize:e=>e.valueOf().toString(),eq:pz});sl({parse:e=>{const u=new Date(e);return Number.isNaN(u.valueOf())?null:u},serialize:e=>e.toISOString(),eq:pz});sl({parse:e=>{const u=new Date(e.slice(0,10));return Number.isNaN(u.valueOf())?null:u},serialize:e=>e.toISOString().slice(0,10),eq:pz});var dv=QI(),uOe={};function eOe(e,{history:u="replace",scroll:a=!1,shallow:t=!0,throttleMs:n=BC,clearOnDefault:r=!0,startTransition:i,urlKeys:o=uOe}={}){const s=Object.keys(e).join(","),l=C.useMemo(()=>Object.fromEntries(Object.keys(e).map(F=>[F,o[F]??F])),[s,JSON.stringify(o)]),E=A4u(),c=E.searchParams,D=C.useRef({}),h=C.useMemo(()=>Object.fromEntries(Object.keys(e).map(F=>[F,e[F].defaultValue??null])),[Object.values(e).map(({defaultValue:F})=>F).join(",")]),[m,x]=C.useState(()=>{const F=c??new URLSearchParams;return Dv(e,o,F).state}),p=C.useRef(m);if(Ri("[nuq+ `%s`] render - state: %O, iSP: %s",s,m,c),Object.keys(D.current).join("&")!==Object.values(l).join("&")){const{state:F,hasChanged:b}=Dv(e,o,c,D.current,p.current);b&&(p.current=F,x(F)),D.current=Object.fromEntries(Object.values(l).map(y=>[y,(c==null?void 0:c.get(y))??null]))}C.useEffect(()=>{const{state:F,hasChanged:b}=Dv(e,o,c,D.current,p.current);b&&(p.current=F,x(F))},[Object.values(l).map(F=>`${F}=${c==null?void 0:c.get(F)}`).join("&")]),C.useEffect(()=>{function F(y){Ri("[nuq+ `%s`] updateInternalState %O",s,y),p.current=y,x(y)}const b=Object.keys(e).reduce((y,v)=>(y[v]=({state:A,query:B})=>{const{defaultValue:j}=e[v],R=l[v];p.current={...p.current,[v]:A??j??null},D.current[R]=B,Ri("[nuq+ `%s`] Cross-hook key sync %s: %O (default: %O). Resolved: %O",s,R,A,j,p.current),F(p.current)},y),{});for(const y of Object.keys(e)){const v=l[y];Ri("[nuq+ `%s`] Subscribing to sync for `%s`",s,v),dv.on(v,b[y])}return()=>{for(const y of Object.keys(e)){const v=l[y];Ri("[nuq+ `%s`] Unsubscribing to sync for `%s`",s,v),dv.off(v,b[y])}}},[s,l]);const f=C.useCallback((F,b={})=>{const y=Object.fromEntries(Object.keys(e).map(A=>[A,null])),v=typeof F=="function"?F(Mj(p.current,h))??y:F??y;Ri("[nuq+ `%s`] setState: %O",s,v);for(let[A,B]of Object.entries(v)){const j=e[A],R=l[A];if(!j)continue;(b.clearOnDefault??j.clearOnDefault??r)&&B!==null&&j.defaultValue!==void 0&&(j.eq??((O,T)=>O===T))(B,j.defaultValue)&&(B=null);const w=Uze(R,B,j.serialize??String,{history:b.history??j.history??u,shallow:b.shallow??j.shallow??t,scroll:b.scroll??j.scroll??a,throttleMs:b.throttleMs??j.throttleMs??n,startTransition:b.startTransition??j.startTransition??i});dv.emit(R,{state:B,query:w})}return Qze(E)},[s,u,t,a,n,i,l,E.updateUrl,E.getSearchParamsSnapshot,E.rateLimitFactor,h]);return[C.useMemo(()=>Mj(m,h),[m,h]),f]}function Dv(e,u,a,t,n){let r=!1;const i=Object.keys(e).reduce((o,s)=>{const l=(u==null?void 0:u[s])??s,{parse:E}=e[s],c=Jze(l),D=c===void 0?(a==null?void 0:a.get(l))??null:c;if(t&&n&&(t[l]??null)===D)return o[s]=n[s]??null,o;r=!0;const h=D===null?null:iau(E,D,s);return o[s]=h??null,t&&(t[l]=D),o},{});if(!r){const o=Object.keys(e),s=Object.keys(n??{});r=o.length!==s.length||o.some(l=>!s.includes(l))}return{state:i,hasChanged:r}}function Mj(e,u){return Object.fromEntries(Object.keys(e).map(a=>[a,e[a]??u[a]??null]))}function aOe(e,u,a,t){var n=this,r=C.useRef(null),i=C.useRef(0),o=C.useRef(0),s=C.useRef(null),l=C.useRef([]),E=C.useRef(),c=C.useRef(),D=C.useRef(e),h=C.useRef(!0);D.current=e;var m=typeof window<"u",x=!u&&u!==0&&m;if(typeof e!="function")throw new TypeError("Expected a function");u=+u||0;var p=!!(a=a||{}).leading,f=!("trailing"in a)||!!a.trailing,g="maxWait"in a,F="debounceOnServer"in a&&!!a.debounceOnServer,b=g?Math.max(+a.maxWait||0,u):null;C.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var y=C.useMemo(function(){var v=function(T){var z=l.current,N=E.current;return l.current=E.current=null,i.current=T,o.current=o.current||T,c.current=D.current.apply(N,z)},A=function(T,z){x&&cancelAnimationFrame(s.current),s.current=x?requestAnimationFrame(T):setTimeout(T,z)},B=function(T){if(!h.current)return!1;var z=T-r.current;return!r.current||z>=u||z<0||g&&T-i.current>=b},j=function(T){return s.current=null,f&&l.current?v(T):(l.current=E.current=null,c.current)},R=function T(){var z=Date.now();if(p&&o.current===i.current&&w(),B(z))return j(z);if(h.current){var N=u-(z-r.current),M=g?Math.min(N,b-(z-i.current)):N;A(T,M)}},w=function(){t&&t({})},O=function(){if(m||F){var T=Date.now(),z=B(T);if(l.current=[].slice.call(arguments),E.current=n,r.current=T,z){if(!s.current&&h.current)return i.current=r.current,A(R,u),p?v(r.current):c.current;if(g)return A(R,u),v(r.current)}return s.current||A(R,u),c.current}};return O.cancel=function(){s.current&&(x?cancelAnimationFrame(s.current):clearTimeout(s.current)),i.current=0,l.current=r.current=E.current=s.current=null},O.isPending=function(){return!!s.current},O.flush=function(){return s.current?j(Date.now()):c.current},O},[p,g,u,b,f,x,m,F,t]);return y}const tOe=50,nOe=750;function rOe(e){const{initialQuery:u,onQueryChange:a}=e,[t,n]=C.useState(u);C.useEffect(()=>{n(u)},[u]);const r=aOe(o=>{a(o)},nOe),i=o=>{const s=o.target.value;n(s),r(s)};return d.jsxs("div",{className:"relative w-full",children:[d.jsx(sd,{className:"text-muted-foreground absolute left-2 top-2.5 h-4 w-4"}),d.jsx(gt,{autoFocus:!0,placeholder:"Search tests and modules...",className:"w-full border-0 !border-none pl-8 !shadow-none !outline-none focus-visible:ring-0",value:t,onChange:i})]})}const iOe=()=>{const{data:e}=mz(),[u,a]=eOe({query:Xze.withDefault("")}),t=C.useMemo(()=>{const s=(e==null?void 0:e.tests.map(E=>({type:"TEST",fileName:E.fileName,description:E.description,data:E})))||[],l=(e==null?void 0:e.modules.map(E=>({type:"MODULE",fileName:E.fileName,description:E.description,data:E})))||[];return[...s,...l]},[e==null?void 0:e.modules,e==null?void 0:e.tests]),n=C.useMemo(()=>new J1(t,{keys:[{name:"fileName",weight:1},{name:"description",weight:.8}],threshold:.3,includeScore:!0,findAllMatches:!0,ignoreLocation:!0,useExtendedSearch:!0}),[t]),r=C.useMemo(()=>{const s=u.query.trim().replace(/-/g," ");if(!s)return[];const l=s.toLowerCase().split(/\s+/);return n.search({$and:l.map(c=>({$or:[{fileName:c},{description:c}]}))}).map(c=>({...c.item,score:c.score??1})).sort((c,D)=>c.score-D.score).slice(0,tOe)},[n,u.query]),i=C.useMemo(()=>r.filter(s=>s.type==="TEST"),[r]),o=C.useMemo(()=>r.filter(s=>s.type==="MODULE"),[r]);return d.jsxs("div",{className:"flex h-full flex-1 flex-col overflow-auto",children:[d.jsx("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:d.jsx(rOe,{initialQuery:u.query,onQueryChange:s=>{a({query:s})}})}),d.jsx("div",{className:"flex flex-1 flex-col gap-4 p-4",children:d.jsx(nau,{testMetadatas:i.map(s=>({fileName:s.data.fileName,relativePath:s.data.relativePath,pathSegments:s.data.relativePathSegments})),moduleMetadatas:o.map(s=>({fileName:s.data.fileName,relativePath:s.data.relativePath,pathSegments:s.data.relativePathSegments})),folderMetadatas:[],showAllFlattened:!0})})]})},{createElement:L3,createContext:oOe,createRef:Ia0,forwardRef:oau,useCallback:or,useContext:sau,useEffect:N4,useImperativeHandle:lau,useLayoutEffect:sOe,useMemo:lOe,useRef:Hn,useState:dD}=I4,Tj=I4.useId,EOe=sOe,SC=oOe(null);SC.displayName="PanelGroupContext";const R4=EOe,cOe=typeof Tj=="function"?Tj:()=>null;let dOe=0;function gz(e=null){const u=cOe(),a=Hn(e||u||null);return a.current===null&&(a.current=""+dOe++),e??a.current}function Eau({children:e,className:u="",collapsedSize:a,collapsible:t,defaultSize:n,forwardedRef:r,id:i,maxSize:o,minSize:s,onCollapse:l,onExpand:E,onResize:c,order:D,style:h,tagName:m="div",...x}){const p=sau(SC);if(p===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:f,expandPanel:g,getPanelSize:F,getPanelStyle:b,groupId:y,isPanelCollapsed:v,reevaluatePanelConstraints:A,registerPanel:B,resizePanel:j,unregisterPanel:R}=p,w=gz(i),O=Hn({callbacks:{onCollapse:l,onExpand:E,onResize:c},constraints:{collapsedSize:a,collapsible:t,defaultSize:n,maxSize:o,minSize:s},id:w,idIsFromProps:i!==void 0,order:D});Hn({didLogMissingDefaultSizeWarning:!1}),R4(()=>{const{callbacks:z,constraints:N}=O.current,M={...N};O.current.id=w,O.current.idIsFromProps=i!==void 0,O.current.order=D,z.onCollapse=l,z.onExpand=E,z.onResize=c,N.collapsedSize=a,N.collapsible=t,N.defaultSize=n,N.maxSize=o,N.minSize=s,(M.collapsedSize!==N.collapsedSize||M.collapsible!==N.collapsible||M.maxSize!==N.maxSize||M.minSize!==N.minSize)&&A(O.current,M)}),R4(()=>{const z=O.current;return B(z),()=>{R(z)}},[D,w,B,R]),lau(r,()=>({collapse:()=>{f(O.current)},expand:()=>{g(O.current)},getId(){return w},getSize(){return F(O.current)},isCollapsed(){return v(O.current)},isExpanded(){return!v(O.current)},resize:z=>{j(O.current,z)}}),[f,g,F,v,w,j]);const T=b(O.current,n);return L3(m,{...x,children:e,className:u,id:i,style:{...T,...h},"data-panel":"","data-panel-collapsible":t||void 0,"data-panel-group-id":y,"data-panel-id":w,"data-panel-size":parseFloat(""+T.flexGrow).toFixed(1)})}const cau=oau((e,u)=>L3(Eau,{...e,forwardedRef:u}));Eau.displayName="Panel";cau.displayName="forwardRef(Panel)";let Lb=null,v4=null;function DOe(e,u){if(u){const a=(u&xau)!==0,t=(u&fau)!==0,n=(u&pau)!==0,r=(u&gau)!==0;if(a)return n?"se-resize":r?"ne-resize":"e-resize";if(t)return n?"sw-resize":r?"nw-resize":"w-resize";if(n)return"s-resize";if(r)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function hOe(){v4!==null&&(document.head.removeChild(v4),Lb=null,v4=null)}function hv(e,u){const a=DOe(e,u);Lb!==a&&(Lb=a,v4===null&&(v4=document.createElement("style"),document.head.appendChild(v4)),v4.innerHTML=`*{cursor: ${a}!important;}`)}function dau(e){return e.type==="keydown"}function Dau(e){return e.type.startsWith("mouse")}function hau(e){return e.type.startsWith("touch")}function zC(e){if(Dau(e))return{x:e.clientX,y:e.clientY};if(hau(e)){const u=e.touches[0];if(u&&u.clientX&&u.clientY)return{x:u.clientX,y:u.clientY}}return{x:1/0,y:1/0}}function mOe(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function xOe(e,u,a){return a?e.x<u.x+u.width&&e.x+e.width>u.x&&e.y<u.y+u.height&&e.y+e.height>u.y:e.x<=u.x+u.width&&e.x+e.width>=u.x&&e.y<=u.y+u.height&&e.y+e.height>=u.y}function fOe(e,u){if(e===u)throw new Error("Cannot compare node with itself");const a={a:Nj(e),b:Nj(u)};let t;for(;a.a.at(-1)===a.b.at(-1);)e=a.a.pop(),u=a.b.pop(),t=e;d0(t,"Stacking order can only be calculated for elements with a common ancestor");const n={a:jj(Pj(a.a)),b:jj(Pj(a.b))};if(n.a===n.b){const r=t.childNodes,i={a:a.a.at(-1),b:a.b.at(-1)};let o=r.length;for(;o--;){const s=r[o];if(s===i.a)return 1;if(s===i.b)return-1}}return Math.sign(n.a-n.b)}const pOe=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function gOe(e){const u=getComputedStyle(mau(e)).display;return u==="flex"||u==="inline-flex"}function COe(e){const u=getComputedStyle(e);return!!(u.position==="fixed"||u.zIndex!=="auto"&&(u.position!=="static"||gOe(e))||+u.opacity<1||"transform"in u&&u.transform!=="none"||"webkitTransform"in u&&u.webkitTransform!=="none"||"mixBlendMode"in u&&u.mixBlendMode!=="normal"||"filter"in u&&u.filter!=="none"||"webkitFilter"in u&&u.webkitFilter!=="none"||"isolation"in u&&u.isolation==="isolate"||pOe.test(u.willChange)||u.webkitOverflowScrolling==="touch")}function Pj(e){let u=e.length;for(;u--;){const a=e[u];if(d0(a,"Missing node"),COe(a))return a}return null}function jj(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Nj(e){const u=[];for(;e;)u.push(e),e=mau(e);return u}function mau(e){var u;return((u=e.parentNode)===null||u===void 0?void 0:u.host)||e.parentNode}const xau=1,fau=2,pau=4,gau=8,FOe=mOe()==="coarse";let v1=[],OC=!1,Ml=new Map,wC=new Map;const kh=new Set;function kOe(e,u,a,t,n){var r;const{ownerDocument:i}=u,o={direction:a,element:u,hitAreaMargins:t,setResizeHandlerState:n},s=(r=Ml.get(i))!==null&&r!==void 0?r:0;return Ml.set(i,s+1),kh.add(o),Sp(),function(){var E;wC.delete(e),kh.delete(o);const c=(E=Ml.get(i))!==null&&E!==void 0?E:1;Ml.set(i,c-1),Sp(),c===1&&Ml.delete(i)}}function jx(e){const{target:u}=e,{x:a,y:t}=zC(e);OC=!0,Cz({target:u,x:a,y:t}),Sp(),v1.length>0&&(Fz("down",e),e.preventDefault())}function Cl(e){const{x:u,y:a}=zC(e);if(!OC){const{target:t}=e;Cz({target:t,x:u,y:a})}Fz("move",e),Cau(),v1.length>0&&e.preventDefault()}function Fl(e){const{target:u}=e,{x:a,y:t}=zC(e);wC.clear(),OC=!1,v1.length>0&&e.preventDefault(),Fz("up",e),Cz({target:u,x:a,y:t}),Cau(),Sp()}function Cz({target:e,x:u,y:a}){v1.splice(0);let t=null;e instanceof HTMLElement&&(t=e),kh.forEach(n=>{const{element:r,hitAreaMargins:i}=n,o=r.getBoundingClientRect(),{bottom:s,left:l,right:E,top:c}=o,D=FOe?i.coarse:i.fine;if(u>=l-D&&u<=E+D&&a>=c-D&&a<=s+D){if(t!==null&&r!==t&&!r.contains(t)&&!t.contains(r)&&fOe(t,r)>0){let m=t,x=!1;for(;m&&!m.contains(r);){if(xOe(m.getBoundingClientRect(),o,!0)){x=!0;break}m=m.parentElement}if(x)return}v1.push(n)}})}function mv(e,u){wC.set(e,u)}function Cau(){let e=!1,u=!1;v1.forEach(t=>{const{direction:n}=t;n==="horizontal"?e=!0:u=!0});let a=0;wC.forEach(t=>{a|=t}),e&&u?hv("intersection",a):e?hv("horizontal",a):u?hv("vertical",a):hOe()}function Sp(){Ml.forEach((e,u)=>{const{body:a}=u;a.removeEventListener("contextmenu",Fl),a.removeEventListener("mousedown",jx),a.removeEventListener("mouseleave",Cl),a.removeEventListener("mousemove",Cl),a.removeEventListener("touchmove",Cl),a.removeEventListener("touchstart",jx)}),window.removeEventListener("mouseup",Fl),window.removeEventListener("touchcancel",Fl),window.removeEventListener("touchend",Fl),kh.size>0&&(OC?(v1.length>0&&Ml.forEach((e,u)=>{const{body:a}=u;e>0&&(a.addEventListener("contextmenu",Fl),a.addEventListener("mouseleave",Cl),a.addEventListener("mousemove",Cl),a.addEventListener("touchmove",Cl,{passive:!1}))}),window.addEventListener("mouseup",Fl),window.addEventListener("touchcancel",Fl),window.addEventListener("touchend",Fl)):Ml.forEach((e,u)=>{const{body:a}=u;e>0&&(a.addEventListener("mousedown",jx),a.addEventListener("mousemove",Cl),a.addEventListener("touchmove",Cl,{passive:!1}),a.addEventListener("touchstart",jx))}))}function Fz(e,u){kh.forEach(a=>{const{setResizeHandlerState:t}=a,n=v1.includes(a);t(e,n,u)})}function d0(e,u){if(!e)throw console.error(u),Error(u)}const Fau=10;function vh(e,u,a=Fau){e=parseFloat(e.toFixed(a)),u=parseFloat(u.toFixed(a));const t=e-u;return t===0?0:t>0?1:-1}function cr(e,u,a){return vh(e,u,a)===0}function vOe(e,u,a){if(e.length!==u.length)return!1;for(let t=0;t<e.length;t++){const n=e[t],r=u[t];if(!cr(n,r,a))return!1}return!0}function vc({panelConstraints:e,panelIndex:u,size:a}){const t=e[u];d0(t!=null,`Panel constraints not found for index ${u}`);let{collapsedSize:n=0,collapsible:r,maxSize:i=100,minSize:o=0}=t;if(vh(a,o)<0)if(r){const s=(n+o)/2;vh(a,s)<0?a=n:a=o}else a=o;return a=Math.min(i,a),a=parseFloat(a.toFixed(Fau)),a}function j5({delta:e,initialLayout:u,panelConstraints:a,pivotIndices:t,prevLayout:n,trigger:r}){if(cr(e,0))return u;const i=[...u],[o,s]=t;d0(o!=null,"Invalid first pivot index"),d0(s!=null,"Invalid second pivot index");let l=0;if(r==="keyboard"){{const c=e<0?s:o,D=a[c];d0(D,`Panel constraints not found for index ${c}`);const{collapsedSize:h=0,collapsible:m,minSize:x=0}=D;if(m){const p=u[c];if(d0(p!=null,`Previous layout not found for panel index ${c}`),cr(p,h)){const f=x-p;vh(f,Math.abs(e))>0&&(e=e<0?0-f:f)}}}{const c=e<0?o:s,D=a[c];d0(D,`No panel constraints found for index ${c}`);const{collapsedSize:h=0,collapsible:m,minSize:x=0}=D;if(m){const p=u[c];if(d0(p!=null,`Previous layout not found for panel index ${c}`),cr(p,x)){const f=p-h;vh(f,Math.abs(e))>0&&(e=e<0?0-f:f)}}}}{const c=e<0?1:-1;let D=e<0?s:o,h=0;for(;;){const x=u[D];d0(x!=null,`Previous layout not found for panel index ${D}`);const f=vc({panelConstraints:a,panelIndex:D,size:100})-x;if(h+=f,D+=c,D<0||D>=a.length)break}const m=Math.min(Math.abs(e),Math.abs(h));e=e<0?0-m:m}{let D=e<0?o:s;for(;D>=0&&D<a.length;){const h=Math.abs(e)-Math.abs(l),m=u[D];d0(m!=null,`Previous layout not found for panel index ${D}`);const x=m-h,p=vc({panelConstraints:a,panelIndex:D,size:x});if(!cr(m,p)&&(l+=m-p,i[D]=p,l.toPrecision(3).localeCompare(Math.abs(e).toPrecision(3),void 0,{numeric:!0})>=0))break;e<0?D--:D++}}if(vOe(n,i))return n;{const c=e<0?s:o,D=u[c];d0(D!=null,`Previous layout not found for panel index ${c}`);const h=D+l,m=vc({panelConstraints:a,panelIndex:c,size:h});if(i[c]=m,!cr(m,h)){let x=h-m,f=e<0?s:o;for(;f>=0&&f<a.length;){const g=i[f];d0(g!=null,`Previous layout not found for panel index ${f}`);const F=g+x,b=vc({panelConstraints:a,panelIndex:f,size:F});if(cr(g,b)||(x-=b-g,i[f]=b),cr(x,0))break;e>0?f--:f++}}}const E=i.reduce((c,D)=>D+c,0);return cr(E,100)?i:n}function AOe({layout:e,panelsArray:u,pivotIndices:a}){let t=0,n=100,r=0,i=0;const o=a[0];d0(o!=null,"No pivot index found"),u.forEach((c,D)=>{const{constraints:h}=c,{maxSize:m=100,minSize:x=0}=h;D===o?(t=x,n=m):(r+=x,i+=m)});const s=Math.min(n,100-r),l=Math.max(t,100-i),E=e[o];return{valueMax:s,valueMin:l,valueNow:E}}function Ah(e,u=document){return Array.from(u.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function kau(e,u,a=document){const n=Ah(e,a).findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===u);return n??null}function vau(e,u,a){const t=kau(e,u,a);return t!=null?[t,t+1]:[-1,-1]}function Aau(e,u=document){var a;if(u instanceof HTMLElement&&(u==null||(a=u.dataset)===null||a===void 0?void 0:a.panelGroupId)==e)return u;const t=u.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return t||null}function MC(e,u=document){const a=u.querySelector(`[data-panel-resize-handle-id="${e}"]`);return a||null}function bOe(e,u,a,t=document){var n,r,i,o;const s=MC(u,t),l=Ah(e,t),E=s?l.indexOf(s):-1,c=(n=(r=a[E])===null||r===void 0?void 0:r.id)!==null&&n!==void 0?n:null,D=(i=(o=a[E+1])===null||o===void 0?void 0:o.id)!==null&&i!==void 0?i:null;return[c,D]}function yOe({committedValuesRef:e,eagerValuesRef:u,groupId:a,layout:t,panelDataArray:n,panelGroupElement:r,setLayout:i}){Hn({didWarnAboutMissingResizeHandle:!1}),R4(()=>{if(!r)return;const o=Ah(a,r);for(let s=0;s<n.length-1;s++){const{valueMax:l,valueMin:E,valueNow:c}=AOe({layout:t,panelsArray:n,pivotIndices:[s,s+1]}),D=o[s];if(D!=null){const h=n[s];d0(h,`No panel data found for index "${s}"`),D.setAttribute("aria-controls",h.id),D.setAttribute("aria-valuemax",""+Math.round(l)),D.setAttribute("aria-valuemin",""+Math.round(E)),D.setAttribute("aria-valuenow",c!=null?""+Math.round(c):"")}}return()=>{o.forEach((s,l)=>{s.removeAttribute("aria-controls"),s.removeAttribute("aria-valuemax"),s.removeAttribute("aria-valuemin"),s.removeAttribute("aria-valuenow")})}},[a,t,n,r]),N4(()=>{if(!r)return;const o=u.current;d0(o,"Eager values not found");const{panelDataArray:s}=o,l=Aau(a,r);d0(l!=null,`No group found for id "${a}"`);const E=Ah(a,r);d0(E,`No resize handles found for group id "${a}"`);const c=E.map(D=>{const h=D.getAttribute("data-panel-resize-handle-id");d0(h,"Resize handle element has no handle id attribute");const[m,x]=bOe(a,h,s,r);if(m==null||x==null)return()=>{};const p=f=>{if(!f.defaultPrevented)switch(f.key){case"Enter":{f.preventDefault();const g=s.findIndex(F=>F.id===m);if(g>=0){const F=s[g];d0(F,`No panel data found for index ${g}`);const b=t[g],{collapsedSize:y=0,collapsible:v,minSize:A=0}=F.constraints;if(b!=null&&v){const B=j5({delta:cr(b,y)?A-y:y-b,initialLayout:t,panelConstraints:s.map(j=>j.constraints),pivotIndices:vau(a,h,r),prevLayout:t,trigger:"keyboard"});t!==B&&i(B)}}break}}};return D.addEventListener("keydown",p),()=>{D.removeEventListener("keydown",p)}});return()=>{c.forEach(D=>D())}},[r,e,u,a,t,n,i])}function Rj(e,u){if(e.length!==u.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!==u[a])return!1;return!0}function bau(e,u){const a=e==="horizontal",{x:t,y:n}=zC(u);return a?t:n}function BOe(e,u,a,t,n){const r=a==="horizontal",i=MC(u,n);d0(i,`No resize handle element found for id "${u}"`);const o=i.getAttribute("data-panel-group-id");d0(o,"Resize handle element has no group id attribute");let{initialCursorPosition:s}=t;const l=bau(a,e),E=Aau(o,n);d0(E,`No group element found for id "${o}"`);const c=E.getBoundingClientRect(),D=r?c.width:c.height;return(l-s)/D*100}function SOe(e,u,a,t,n,r){if(dau(e)){const i=a==="horizontal";let o=0;e.shiftKey?o=100:n!=null?o=n:o=10;let s=0;switch(e.key){case"ArrowDown":s=i?0:o;break;case"ArrowLeft":s=i?-o:0;break;case"ArrowRight":s=i?o:0;break;case"ArrowUp":s=i?0:-o;break;case"End":s=100;break;case"Home":s=-100;break}return s}else return t==null?0:BOe(e,u,a,t,r)}function zOe({panelDataArray:e}){const u=Array(e.length),a=e.map(r=>r.constraints);let t=0,n=100;for(let r=0;r<e.length;r++){const i=a[r];d0(i,`Panel constraints not found for index ${r}`);const{defaultSize:o}=i;o!=null&&(t++,u[r]=o,n-=o)}for(let r=0;r<e.length;r++){const i=a[r];d0(i,`Panel constraints not found for index ${r}`);const{defaultSize:o}=i;if(o!=null)continue;const s=e.length-t,l=n/s;t++,u[r]=l,n-=l}return u}function JE(e,u,a){u.forEach((t,n)=>{const r=e[n];d0(r,`Panel data not found for index ${n}`);const{callbacks:i,constraints:o,id:s}=r,{collapsedSize:l=0,collapsible:E}=o,c=a[s];if(c==null||t!==c){a[s]=t;const{onCollapse:D,onExpand:h,onResize:m}=i;m&&m(t,c),E&&(D||h)&&(h&&(c==null||c===l)&&t!==l&&h(),D&&(c==null||c!==l)&&t===l&&D())}})}function Nx(e,u){if(e.length!==u.length)return!1;for(let a=0;a<e.length;a++)if(e[a]!=u[a])return!1;return!0}function OOe({defaultSize:e,dragState:u,layout:a,panelData:t,panelIndex:n,precision:r=3}){const i=a[n];let o;return i==null?o=e!=null?e.toPrecision(r):"1":t.length===1?o="1":o=i.toPrecision(r),{flexBasis:0,flexGrow:o,flexShrink:1,overflow:"hidden",pointerEvents:u!==null?"none":void 0}}function wOe(e,u=10){let a=null;return(...n)=>{a!==null&&clearTimeout(a),a=setTimeout(()=>{e(...n)},u)}}function Lj(e){try{if(typeof localStorage<"u")e.getItem=u=>localStorage.getItem(u),e.setItem=(u,a)=>{localStorage.setItem(u,a)};else throw new Error("localStorage not supported in this environment")}catch(u){console.error(u),e.getItem=()=>null,e.setItem=()=>{}}}function yau(e){return`react-resizable-panels:${e}`}function Bau(e){return e.map(u=>{const{constraints:a,id:t,idIsFromProps:n,order:r}=u;return n?t:r?`${r}:${JSON.stringify(a)}`:JSON.stringify(a)}).sort((u,a)=>u.localeCompare(a)).join(",")}function Sau(e,u){try{const a=yau(e),t=u.getItem(a);if(t){const n=JSON.parse(t);if(typeof n=="object"&&n!=null)return n}}catch{}return null}function MOe(e,u,a){var t,n;const r=(t=Sau(e,a))!==null&&t!==void 0?t:{},i=Bau(u);return(n=r[i])!==null&&n!==void 0?n:null}function TOe(e,u,a,t,n){var r;const i=yau(e),o=Bau(u),s=(r=Sau(e,n))!==null&&r!==void 0?r:{};s[o]={expandToSizes:Object.fromEntries(a.entries()),layout:t};try{n.setItem(i,JSON.stringify(s))}catch(l){console.error(l)}}function _j({layout:e,panelConstraints:u}){const a=[...e],t=a.reduce((r,i)=>r+i,0);if(a.length!==u.length)throw Error(`Invalid ${u.length} panel layout: ${a.map(r=>`${r}%`).join(", ")}`);if(!cr(t,100))for(let r=0;r<u.length;r++){const i=a[r];d0(i!=null,`No layout data found for index ${r}`);const o=100/t*i;a[r]=o}let n=0;for(let r=0;r<u.length;r++){const i=a[r];d0(i!=null,`No layout data found for index ${r}`);const o=vc({panelConstraints:u,panelIndex:r,size:i});i!=o&&(n+=i-o,a[r]=o)}if(!cr(n,0))for(let r=0;r<u.length;r++){const i=a[r];d0(i!=null,`No layout data found for index ${r}`);const o=i+n,s=vc({panelConstraints:u,panelIndex:r,size:o});if(i!==s&&(n-=s-i,a[r]=s,cr(n,0)))break}return a}const POe=100,N5={getItem:e=>(Lj(N5),N5.getItem(e)),setItem:(e,u)=>{Lj(N5),N5.setItem(e,u)}},Ij={};function zau({autoSaveId:e=null,children:u,className:a="",direction:t,forwardedRef:n,id:r=null,onLayout:i=null,keyboardResizeBy:o=null,storage:s=N5,style:l,tagName:E="div",...c}){const D=gz(r),h=Hn(null),[m,x]=dD(null),[p,f]=dD([]),g=Hn({}),F=Hn(new Map),b=Hn(0),y=Hn({autoSaveId:e,direction:t,dragState:m,id:D,keyboardResizeBy:o,onLayout:i,storage:s}),v=Hn({layout:p,panelDataArray:[],panelDataArrayChanged:!1});Hn({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),lau(n,()=>({getId:()=>y.current.id,getLayout:()=>{const{layout:_}=v.current;return _},setLayout:_=>{const{onLayout:Q}=y.current,{layout:eu,panelDataArray:U}=v.current,iu=_j({layout:_,panelConstraints:U.map(tu=>tu.constraints)});Rj(eu,iu)||(f(iu),v.current.layout=iu,Q&&Q(iu),JE(U,iu,g.current))}}),[]),R4(()=>{y.current.autoSaveId=e,y.current.direction=t,y.current.dragState=m,y.current.id=D,y.current.onLayout=i,y.current.storage=s}),yOe({committedValuesRef:y,eagerValuesRef:v,groupId:D,layout:p,panelDataArray:v.current.panelDataArray,setLayout:f,panelGroupElement:h.current}),N4(()=>{const{panelDataArray:_}=v.current;if(e){if(p.length===0||p.length!==_.length)return;let Q=Ij[e];Q==null&&(Q=wOe(TOe,POe),Ij[e]=Q);const eu=[..._],U=new Map(F.current);Q(e,eu,U,p,s)}},[e,p,s]),N4(()=>{});const A=or(_=>{const{onLayout:Q}=y.current,{layout:eu,panelDataArray:U}=v.current;if(_.constraints.collapsible){const iu=U.map(Cu=>Cu.constraints),{collapsedSize:tu=0,panelSize:Y,pivotIndices:ou}=t4(U,_,eu);if(d0(Y!=null,`Panel size not found for panel "${_.id}"`),Y!==tu){F.current.set(_.id,Y);const Au=rc(U,_)===U.length-1?Y-tu:tu-Y,mu=j5({delta:Au,initialLayout:eu,panelConstraints:iu,pivotIndices:ou,prevLayout:eu,trigger:"imperative-api"});Nx(eu,mu)||(f(mu),v.current.layout=mu,Q&&Q(mu),JE(U,mu,g.current))}}},[]),B=or(_=>{const{onLayout:Q}=y.current,{layout:eu,panelDataArray:U}=v.current;if(_.constraints.collapsible){const iu=U.map(Au=>Au.constraints),{collapsedSize:tu=0,panelSize:Y,minSize:ou=0,pivotIndices:Cu}=t4(U,_,eu);if(Y===tu){const Au=F.current.get(_.id),mu=Au!=null&&Au>=ou?Au:ou,le=rc(U,_)===U.length-1?Y-mu:mu-Y,Yu=j5({delta:le,initialLayout:eu,panelConstraints:iu,pivotIndices:Cu,prevLayout:eu,trigger:"imperative-api"});Nx(eu,Yu)||(f(Yu),v.current.layout=Yu,Q&&Q(Yu),JE(U,Yu,g.current))}}},[]),j=or(_=>{const{layout:Q,panelDataArray:eu}=v.current,{panelSize:U}=t4(eu,_,Q);return d0(U!=null,`Panel size not found for panel "${_.id}"`),U},[]),R=or((_,Q)=>{const{panelDataArray:eu}=v.current,U=rc(eu,_);return OOe({defaultSize:Q,dragState:m,layout:p,panelData:eu,panelIndex:U})},[m,p]),w=or(_=>{const{layout:Q,panelDataArray:eu}=v.current,{collapsedSize:U=0,collapsible:iu,panelSize:tu}=t4(eu,_,Q);return iu===!0&&tu===U},[]),O=or(_=>{const{layout:Q,panelDataArray:eu}=v.current,{collapsedSize:U=0,collapsible:iu,panelSize:tu}=t4(eu,_,Q);return d0(tu!=null,`Panel size not found for panel "${_.id}"`),!iu||tu>U},[]),T=or(_=>{const{panelDataArray:Q}=v.current;Q.push(_),Q.sort((eu,U)=>{const iu=eu.order,tu=U.order;return iu==null&&tu==null?0:iu==null?-1:tu==null?1:iu-tu}),v.current.panelDataArrayChanged=!0},[]);R4(()=>{if(v.current.panelDataArrayChanged){v.current.panelDataArrayChanged=!1;const{autoSaveId:_,onLayout:Q,storage:eu}=y.current,{layout:U,panelDataArray:iu}=v.current;let tu=null;if(_){const ou=MOe(_,iu,eu);ou&&(F.current=new Map(Object.entries(ou.expandToSizes)),tu=ou.layout)}tu==null&&(tu=zOe({panelDataArray:iu}));const Y=_j({layout:tu,panelConstraints:iu.map(ou=>ou.constraints)});Rj(U,Y)||(f(Y),v.current.layout=Y,Q&&Q(Y),JE(iu,Y,g.current))}}),R4(()=>{const _=v.current;return()=>{_.layout=[]}},[]);const z=or(_=>function(eu){eu.preventDefault();const U=h.current;if(!U)return()=>null;const{direction:iu,dragState:tu,id:Y,keyboardResizeBy:ou,onLayout:Cu}=y.current,{layout:Au,panelDataArray:mu}=v.current,{initialLayout:Nu}=tu??{},le=vau(Y,_,U);let Yu=SOe(eu,_,iu,tu,ou,U);if(Yu===0)return;const ve=iu==="horizontal";document.dir==="rtl"&&ve&&(Yu=-Yu);const Ie=mu.map(fe=>fe.constraints),Zu=j5({delta:Yu,initialLayout:Nu??Au,panelConstraints:Ie,pivotIndices:le,prevLayout:Au,trigger:dau(eu)?"keyboard":"mouse-or-touch"}),Gu=!Nx(Au,Zu);(Dau(eu)||hau(eu))&&b.current!=Yu&&(b.current=Yu,Gu?mv(_,0):ve?mv(_,Yu<0?xau:fau):mv(_,Yu<0?pau:gau)),Gu&&(f(Zu),v.current.layout=Zu,Cu&&Cu(Zu),JE(mu,Zu,g.current))},[]),N=or((_,Q)=>{const{onLayout:eu}=y.current,{layout:U,panelDataArray:iu}=v.current,tu=iu.map(Nu=>Nu.constraints),{panelSize:Y,pivotIndices:ou}=t4(iu,_,U);d0(Y!=null,`Panel size not found for panel "${_.id}"`);const Au=rc(iu,_)===iu.length-1?Y-Q:Q-Y,mu=j5({delta:Au,initialLayout:U,panelConstraints:tu,pivotIndices:ou,prevLayout:U,trigger:"imperative-api"});Nx(U,mu)||(f(mu),v.current.layout=mu,eu&&eu(mu),JE(iu,mu,g.current))},[]),M=or((_,Q)=>{const{layout:eu,panelDataArray:U}=v.current,{collapsedSize:iu=0,collapsible:tu}=Q,{collapsedSize:Y=0,collapsible:ou,maxSize:Cu=100,minSize:Au=0}=_.constraints,{panelSize:mu}=t4(U,_,eu);mu!=null&&(tu&&ou&&mu===iu?iu!==Y&&N(_,Y):mu<Au?N(_,Au):mu>Cu&&N(_,Cu))},[N]),I=or((_,Q)=>{const{direction:eu}=y.current,{layout:U}=v.current;if(!h.current)return;const iu=MC(_,h.current);d0(iu,`Drag handle element not found for id "${_}"`);const tu=bau(eu,Q);x({dragHandleId:_,dragHandleRect:iu.getBoundingClientRect(),initialCursorPosition:tu,initialLayout:U})},[]),P=or(()=>{x(null)},[]),L=or(_=>{const{panelDataArray:Q}=v.current,eu=rc(Q,_);eu>=0&&(Q.splice(eu,1),delete g.current[_.id],v.current.panelDataArrayChanged=!0)},[]),K=lOe(()=>({collapsePanel:A,direction:t,dragState:m,expandPanel:B,getPanelSize:j,getPanelStyle:R,groupId:D,isPanelCollapsed:w,isPanelExpanded:O,reevaluatePanelConstraints:M,registerPanel:T,registerResizeHandle:z,resizePanel:N,startDragging:I,stopDragging:P,unregisterPanel:L,panelGroupElement:h.current}),[A,m,t,B,j,R,D,w,O,M,T,z,N,I,P,L]),W={display:"flex",flexDirection:t==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return L3(SC.Provider,{value:K},L3(E,{...c,children:u,className:a,id:r,ref:h,style:{...W,...l},"data-panel-group":"","data-panel-group-direction":t,"data-panel-group-id":D}))}const Oau=oau((e,u)=>L3(zau,{...e,forwardedRef:u}));zau.displayName="PanelGroup";Oau.displayName="forwardRef(PanelGroup)";function rc(e,u){return e.findIndex(a=>a===u||a.id===u.id)}function t4(e,u,a){const t=rc(e,u),r=t===e.length-1?[t-1,t]:[t,t+1],i=a[t];return{...u.constraints,panelSize:i,pivotIndices:r}}function jOe({disabled:e,handleId:u,resizeHandler:a,panelGroupElement:t}){N4(()=>{if(e||a==null||t==null)return;const n=MC(u,t);if(n==null)return;const r=i=>{if(!i.defaultPrevented)switch(i.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{i.preventDefault(),a(i);break}case"F6":{i.preventDefault();const o=n.getAttribute("data-panel-group-id");d0(o,`No group element found for id "${o}"`);const s=Ah(o,t),l=kau(o,u,t);d0(l!==null,`No resize element found for id "${u}"`);const E=i.shiftKey?l>0?l-1:s.length-1:l+1<s.length?l+1:0;s[E].focus();break}}};return n.addEventListener("keydown",r),()=>{n.removeEventListener("keydown",r)}},[t,e,u,a])}function wau({children:e=null,className:u="",disabled:a=!1,hitAreaMargins:t,id:n,onDragging:r,style:i={},tabIndex:o=0,tagName:s="div",...l}){const E=Hn(null),c=Hn({onDragging:r});N4(()=>{c.current.onDragging=r});const D=sau(SC);if(D===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:h,groupId:m,registerResizeHandle:x,startDragging:p,stopDragging:f,panelGroupElement:g}=D,F=gz(n),[b,y]=dD("inactive"),[v,A]=dD(!1),[B,j]=dD(null),R=Hn({state:b});return R4(()=>{R.current.state=b}),N4(()=>{if(a)j(null);else{const O=x(F);j(()=>O)}},[a,F,x]),N4(()=>{var O,T;if(a||B==null)return;const z=E.current;d0(z,"Element ref not attached");const N=(M,I,P)=>{if(I)switch(M){case"down":{y("drag"),p(F,P);const{onDragging:L}=c.current;L&&L(!0);break}case"move":{const{state:L}=R.current;L!=="drag"&&y("hover"),B(P);break}case"up":{y("hover"),f();const{onDragging:L}=c.current;L&&L(!1);break}}else y("inactive")};return kOe(F,z,h,{coarse:(O=t==null?void 0:t.coarse)!==null&&O!==void 0?O:15,fine:(T=t==null?void 0:t.fine)!==null&&T!==void 0?T:5},N)},[h,a,t,x,F,B,p,f]),jOe({disabled:a,handleId:F,resizeHandler:B,panelGroupElement:g}),L3(s,{...l,children:e,className:u,id:n,onBlur:()=>A(!1),onFocus:()=>A(!0),ref:E,role:"separator",style:{...{touchAction:"none",userSelect:"none"},...i},tabIndex:o,"data-panel-group-direction":h,"data-panel-group-id":m,"data-resize-handle":"","data-resize-handle-active":b==="drag"?"pointer":v?"keyboard":void 0,"data-resize-handle-state":b,"data-panel-resize-handle-enabled":!a,"data-panel-resize-handle-id":F})}wau.displayName="PanelResizeHandle";const Mau=({className:e,...u})=>d.jsx(Oau,{className:lu("flex h-full w-full data-[panel-group-direction=vertical]:flex-col",e),...u}),zp=cau,Tau=({withHandle:e,className:u,...a})=>d.jsx(wau,{className:lu("bg-border focus-visible:ring-ring relative flex w-px items-center justify-center after:absolute after:inset-y-0 after:left-1/2 after:w-1 after:-translate-x-1/2 focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-offset-1 data-[panel-group-direction=vertical]:h-px data-[panel-group-direction=vertical]:w-full data-[panel-group-direction=vertical]:after:left-0 data-[panel-group-direction=vertical]:after:h-1 data-[panel-group-direction=vertical]:after:w-full data-[panel-group-direction=vertical]:after:-translate-y-1/2 data-[panel-group-direction=vertical]:after:translate-x-0 [&[data-panel-group-direction=vertical]>div]:rotate-90",u),...a,children:e&&d.jsx("div",{className:"bg-border z-10 flex h-4 w-3 items-center justify-center rounded-sm border",children:d.jsx(aDu,{className:"h-2.5 w-2.5"})})}),_b=e=>{const a=il().pathname===e.url;return d.jsx(Yf,{asChild:!0,isActive:a,children:d.jsxs(uo,{to:e.url,children:[e.icon,d.jsx("span",{children:e.title})]})})},NOe=()=>{const e=[{title:"Search",url:"/search",icon:d.jsx(sd,{})}];return d.jsx(y8,{children:e.map(u=>d.jsx(_b,{...u},u.url))})};var TC="Collapsible",[ROe,Ka0]=Tt(TC),[LOe,kz]=ROe(TC),Pau=C.forwardRef((e,u)=>{const{__scopeCollapsible:a,open:t,defaultOpen:n,disabled:r,onOpenChange:i,...o}=e,[s,l]=hn({prop:t,defaultProp:n??!1,onChange:i,caller:TC});return d.jsx(LOe,{scope:a,disabled:r,contentId:kt(),open:s,onOpenToggle:C.useCallback(()=>l(E=>!E),[l]),children:d.jsx(se.div,{"data-state":Az(s),"data-disabled":r?"":void 0,...o,ref:u})})});Pau.displayName=TC;var jau="CollapsibleTrigger",Nau=C.forwardRef((e,u)=>{const{__scopeCollapsible:a,...t}=e,n=kz(jau,a);return d.jsx(se.button,{type:"button","aria-controls":n.contentId,"aria-expanded":n.open||!1,"data-state":Az(n.open),"data-disabled":n.disabled?"":void 0,disabled:n.disabled,...t,ref:u,onClick:ju(e.onClick,n.onOpenToggle)})});Nau.displayName=jau;var vz="CollapsibleContent",Rau=C.forwardRef((e,u)=>{const{forceMount:a,...t}=e,n=kz(vz,e.__scopeCollapsible);return d.jsx(fn,{present:a||n.open,children:({present:r})=>d.jsx(_Oe,{...t,ref:u,present:r})})});Rau.displayName=vz;var _Oe=C.forwardRef((e,u)=>{const{__scopeCollapsible:a,present:t,children:n,...r}=e,i=kz(vz,a),[o,s]=C.useState(t),l=C.useRef(null),E=Xe(u,l),c=C.useRef(0),D=c.current,h=C.useRef(0),m=h.current,x=i.open||o,p=C.useRef(x),f=C.useRef(void 0);return C.useEffect(()=>{const g=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(g)},[]),Zt(()=>{const g=l.current;if(g){f.current=f.current||{transitionDuration:g.style.transitionDuration,animationName:g.style.animationName},g.style.transitionDuration="0s",g.style.animationName="none";const F=g.getBoundingClientRect();c.current=F.height,h.current=F.width,p.current||(g.style.transitionDuration=f.current.transitionDuration,g.style.animationName=f.current.animationName),s(t)}},[i.open,t]),d.jsx(se.div,{"data-state":Az(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!x,...r,ref:E,style:{"--radix-collapsible-content-height":D?`${D}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:x&&n})});function Az(e){return e?"open":"closed"}var IOe=Pau;const bz=IOe,Lau=Nau,_au=Rau;var yz="ContextMenu",[KOe,$a0]=Tt(yz,[y2]),$n=y2(),[$Oe,Iau]=KOe(yz),Kau=e=>{const{__scopeContextMenu:u,children:a,onOpenChange:t,dir:n,modal:r=!0}=e,[i,o]=C.useState(!1),s=$n(u),l=eo(t),E=C.useCallback(c=>{o(c),l(c)},[l]);return d.jsx($Oe,{scope:u,open:i,onOpenChange:E,modal:r,children:d.jsx(nW,{...s,dir:n,open:i,onOpenChange:E,modal:r,children:a})})};Kau.displayName=yz;var $au="ContextMenuTrigger",Vau=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,disabled:t=!1,...n}=e,r=Iau($au,a),i=$n(a),o=C.useRef({x:0,y:0}),s=C.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...o.current})}),l=C.useRef(0),E=C.useCallback(()=>window.clearTimeout(l.current),[]),c=D=>{o.current={x:D.clientX,y:D.clientY},r.onOpenChange(!0)};return C.useEffect(()=>E,[E]),C.useEffect(()=>void(t&&E()),[t,E]),d.jsxs(d.Fragment,{children:[d.jsx(rW,{...i,virtualRef:s}),d.jsx(se.span,{"data-state":r.open?"open":"closed","data-disabled":t?"":void 0,...n,ref:u,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:t?e.onContextMenu:ju(e.onContextMenu,D=>{E(),c(D),D.preventDefault()}),onPointerDown:t?e.onPointerDown:ju(e.onPointerDown,Rx(D=>{E(),l.current=window.setTimeout(()=>c(D),700)})),onPointerMove:t?e.onPointerMove:ju(e.onPointerMove,Rx(E)),onPointerCancel:t?e.onPointerCancel:ju(e.onPointerCancel,Rx(E)),onPointerUp:t?e.onPointerUp:ju(e.onPointerUp,Rx(E))})]})});Vau.displayName=$au;var VOe="ContextMenuPortal",Hau=e=>{const{__scopeContextMenu:u,...a}=e,t=$n(u);return d.jsx(iW,{...t,...a})};Hau.displayName=VOe;var Gau="ContextMenuContent",Jau=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=Iau(Gau,a),r=$n(a),i=C.useRef(!1);return d.jsx(oW,{...r,...t,ref:u,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:o=>{var s;(s=e.onCloseAutoFocus)==null||s.call(e,o),!o.defaultPrevented&&i.current&&o.preventDefault(),i.current=!1},onInteractOutside:o=>{var s;(s=e.onInteractOutside)==null||s.call(e,o),!o.defaultPrevented&&!n.modal&&(i.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Jau.displayName=Gau;var HOe="ContextMenuGroup",GOe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(sW,{...n,...t,ref:u})});GOe.displayName=HOe;var JOe="ContextMenuLabel",WOe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(lW,{...n,...t,ref:u})});WOe.displayName=JOe;var UOe="ContextMenuItem",Wau=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(EW,{...n,...t,ref:u})});Wau.displayName=UOe;var ZOe="ContextMenuCheckboxItem",QOe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(cW,{...n,...t,ref:u})});QOe.displayName=ZOe;var qOe="ContextMenuRadioGroup",YOe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(dW,{...n,...t,ref:u})});YOe.displayName=qOe;var XOe="ContextMenuRadioItem",uwe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(DW,{...n,...t,ref:u})});uwe.displayName=XOe;var ewe="ContextMenuItemIndicator",awe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(hW,{...n,...t,ref:u})});awe.displayName=ewe;var twe="ContextMenuSeparator",Uau=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(mW,{...n,...t,ref:u})});Uau.displayName=twe;var nwe="ContextMenuArrow",rwe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(xW,{...n,...t,ref:u})});rwe.displayName=nwe;var iwe="ContextMenuSubTrigger",owe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(fW,{...n,...t,ref:u})});owe.displayName=iwe;var swe="ContextMenuSubContent",lwe=C.forwardRef((e,u)=>{const{__scopeContextMenu:a,...t}=e,n=$n(a);return d.jsx(pW,{...n,...t,ref:u,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});lwe.displayName=swe;function Rx(e){return u=>u.pointerType!=="mouse"?e(u):void 0}var Ewe=Kau,cwe=Vau,dwe=Hau,Dwe=Jau,Zau=Wau,hwe=Uau;function Op({...e}){return d.jsx(Ewe,{"data-slot":"context-menu",...e})}function wp({...e}){return d.jsx(cwe,{"data-slot":"context-menu-trigger",...e})}function Mp({className:e,...u}){return d.jsx(dwe,{children:d.jsx(Dwe,{"data-slot":"context-menu-content",className:lu("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 max-h-(--radix-context-menu-content-available-height) origin-(--radix-context-menu-content-transform-origin) z-50 min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border p-1 shadow-md",e),...u})})}const qr=C.forwardRef(({className:e,inset:u,variant:a="default",...t},n)=>d.jsx(Zau,{ref:n,"data-slot":"context-menu-item","data-inset":u,"data-variant":a,className:lu("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground outline-hidden relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm data-[disabled]:pointer-events-none data-[inset]:pl-8 data-[disabled]:opacity-50 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),...t}));qr.displayName=Zau.displayName;function Lx({className:e,...u}){return d.jsx(hwe,{"data-slot":"context-menu-separator",className:lu("bg-border -mx-1 my-1 h-px",e),...u})}var Qau="AlertDialog",[mwe,Va0]=Tt(Qau,[AH]),ll=AH(),qau=e=>{const{__scopeAlertDialog:u,...a}=e,t=ll(u);return d.jsx(r2,{...t,...a,modal:!0})};qau.displayName=Qau;var xwe="AlertDialogTrigger",Yau=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,...t}=e,n=ll(a);return d.jsx(IH,{...n,...t,ref:u})});Yau.displayName=xwe;var fwe="AlertDialogPortal",Xau=e=>{const{__scopeAlertDialog:u,...a}=e,t=ll(u);return d.jsx(i2,{...t,...a})};Xau.displayName=fwe;var pwe="AlertDialogOverlay",utu=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,...t}=e,n=ll(a);return d.jsx(dd,{...n,...t,ref:u})});utu.displayName=pwe;var Vc="AlertDialogContent",[gwe,Cwe]=mwe(Vc),Fwe=wV("AlertDialogContent"),etu=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,children:t,...n}=e,r=ll(a),i=C.useRef(null),o=Xe(u,i),s=C.useRef(null);return d.jsx(sfu,{contentName:Vc,titleName:atu,docsSlug:"alert-dialog",children:d.jsx(gwe,{scope:a,cancelRef:s,children:d.jsxs(Dd,{role:"alertdialog",...r,...n,ref:o,onOpenAutoFocus:ju(n.onOpenAutoFocus,l=>{var E;l.preventDefault(),(E=s.current)==null||E.focus({preventScroll:!0})}),onPointerDownOutside:l=>l.preventDefault(),onInteractOutside:l=>l.preventDefault(),children:[d.jsx(Fwe,{children:t}),d.jsx(vwe,{contentRef:i})]})})})});etu.displayName=Vc;var atu="AlertDialogTitle",ttu=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,...t}=e,n=ll(a);return d.jsx(lm,{...n,...t,ref:u})});ttu.displayName=atu;var ntu="AlertDialogDescription",rtu=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,...t}=e,n=ll(a);return d.jsx(Em,{...n,...t,ref:u})});rtu.displayName=ntu;var kwe="AlertDialogAction",itu=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,...t}=e,n=ll(a);return d.jsx(o2,{...n,...t,ref:u})});itu.displayName=kwe;var otu="AlertDialogCancel",stu=C.forwardRef((e,u)=>{const{__scopeAlertDialog:a,...t}=e,{cancelRef:n}=Cwe(otu,a),r=ll(a),i=Xe(u,n);return d.jsx(o2,{...r,...t,ref:i})});stu.displayName=otu;var vwe=({contentRef:e})=>{const u=`\`${Vc}\` requires a description for the component to be accessible for screen reader users.
|
|
540
540
|
|
|
541
541
|
You can add a description to the \`${Vc}\` by passing a \`${ntu}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
542
542
|
|
|
@@ -554,7 +554,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
|
|
|
554
554
|
`);const u=new x5("!xml");let a=u,t="",n="";for(let r=0;r<e.length;r++)if(e[r]==="<")if(e[r+1]==="/"){const o=A4(e,">",r,"Closing Tag is not closed.");let s=e.substring(r+2,o).trim();if(this.options.removeNSPrefix){const c=s.indexOf(":");c!==-1&&(s=s.substr(c+1))}this.options.transformTagName&&(s=this.options.transformTagName(s)),a&&(t=this.saveTextToParentTag(t,a,n));const l=n.substring(n.lastIndexOf(".")+1);if(s&&this.options.unpairedTags.indexOf(s)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${s}>`);let E=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(E=n.lastIndexOf(".",n.lastIndexOf(".")-1),this.tagsNodeStack.pop()):E=n.lastIndexOf("."),n=n.substring(0,E),a=this.tagsNodeStack.pop(),t="",r=o}else if(e[r+1]==="?"){let o=u9(e,r,!1,"?>");if(!o)throw new Error("Pi Tag is not closed.");if(t=this.saveTextToParentTag(t,a,n),!(this.options.ignoreDeclaration&&o.tagName==="?xml"||this.options.ignorePiTags)){const s=new x5(o.tagName);s.add(this.options.textNodeName,""),o.tagName!==o.tagExp&&o.attrExpPresent&&(s[":@"]=this.buildAttributesMap(o.tagExp,n,o.tagName)),this.addChild(a,s,n)}r=o.closeIndex+1}else if(e.substr(r+1,3)==="!--"){const o=A4(e,"-->",r+4,"Comment is not closed.");if(this.options.commentPropName){const s=e.substring(r+4,o-2);t=this.saveTextToParentTag(t,a,n),a.add(this.options.commentPropName,[{[this.options.textNodeName]:s}])}r=o}else if(e.substr(r+1,2)==="!D"){const o=KRe(e,r);this.docTypeEntities=o.entities,r=o.i}else if(e.substr(r+1,2)==="!["){const o=A4(e,"]]>",r,"CDATA is not closed.")-2,s=e.substring(r+9,o);t=this.saveTextToParentTag(t,a,n);let l=this.parseTextData(s,a.tagname,n,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?a.add(this.options.cdataPropName,[{[this.options.textNodeName]:s}]):a.add(this.options.textNodeName,l),r=o+2}else{let o=u9(e,r,this.options.removeNSPrefix),s=o.tagName;const l=o.rawTagName;let E=o.tagExp,c=o.attrExpPresent,D=o.closeIndex;this.options.transformTagName&&(s=this.options.transformTagName(s)),a&&t&&a.tagname!=="!xml"&&(t=this.saveTextToParentTag(t,a,n,!1));const h=a;if(h&&this.options.unpairedTags.indexOf(h.tagname)!==-1&&(a=this.tagsNodeStack.pop(),n=n.substring(0,n.lastIndexOf("."))),s!==u.tagname&&(n+=n?"."+s:s),this.isItStopNode(this.options.stopNodes,n,s)){let m="";if(E.length>0&&E.lastIndexOf("/")===E.length-1)s[s.length-1]==="/"?(s=s.substr(0,s.length-1),n=n.substr(0,n.length-1),E=s):E=E.substr(0,E.length-1),r=o.closeIndex;else if(this.options.unpairedTags.indexOf(s)!==-1)r=o.closeIndex;else{const p=this.readStopNodeData(e,l,D+1);if(!p)throw new Error(`Unexpected end of ${l}`);r=p.i,m=p.tagContent}const x=new x5(s);s!==E&&c&&(x[":@"]=this.buildAttributesMap(E,n,s)),m&&(m=this.parseTextData(m,s,n,!0,c,!0,!0)),n=n.substr(0,n.lastIndexOf(".")),x.add(this.options.textNodeName,m),this.addChild(a,x,n)}else{if(E.length>0&&E.lastIndexOf("/")===E.length-1){s[s.length-1]==="/"?(s=s.substr(0,s.length-1),n=n.substr(0,n.length-1),E=s):E=E.substr(0,E.length-1),this.options.transformTagName&&(s=this.options.transformTagName(s));const m=new x5(s);s!==E&&c&&(m[":@"]=this.buildAttributesMap(E,n,s)),this.addChild(a,m,n),n=n.substr(0,n.lastIndexOf("."))}else{const m=new x5(s);this.tagsNodeStack.push(a),s!==E&&c&&(m[":@"]=this.buildAttributesMap(E,n,s)),this.addChild(a,m,n),a=m}t="",r=D}}else t+=e[r];return u.child};function qRe(e,u,a){const t=this.options.updateTag(u.tagname,a,u[":@"]);t===!1||(typeof t=="string"&&(u.tagname=t),e.addChild(u))}const YRe=function(e){if(this.options.processEntities){for(let u in this.docTypeEntities){const a=this.docTypeEntities[u];e=e.replace(a.regx,a.val)}for(let u in this.lastEntities){const a=this.lastEntities[u];e=e.replace(a.regex,a.val)}if(this.options.htmlEntities)for(let u in this.htmlEntities){const a=this.htmlEntities[u];e=e.replace(a.regex,a.val)}e=e.replace(this.ampEntity.regex,this.ampEntity.val)}return e};function XRe(e,u,a,t){return e&&(t===void 0&&(t=Object.keys(u.child).length===0),e=this.parseTextData(e,u.tagname,a,!1,u[":@"]?Object.keys(u[":@"]).length!==0:!1,t),e!==void 0&&e!==""&&u.add(this.options.textNodeName,e),e=""),e}function uLe(e,u,a){const t="*."+a;for(const n in e){const r=e[n];if(t===r||u===r)return!0}return!1}function eLe(e,u,a=">"){let t,n="";for(let r=u;r<e.length;r++){let i=e[r];if(t)i===t&&(t="");else if(i==='"'||i==="'")t=i;else if(i===a[0])if(a[1]){if(e[r+1]===a[1])return{data:n,index:r}}else return{data:n,index:r};else i===" "&&(i=" ");n+=i}}function A4(e,u,a,t){const n=e.indexOf(u,a);if(n===-1)throw new Error(t);return n+u.length-1}function u9(e,u,a,t=">"){const n=eLe(e,u+1,t);if(!n)return;let r=n.data;const i=n.index,o=r.search(/\s/);let s=r,l=!0;o!==-1&&(s=r.substring(0,o),r=r.substring(o+1).trimStart());const E=s;if(a){const c=s.indexOf(":");c!==-1&&(s=s.substr(c+1),l=s!==n.data.substr(c+1))}return{tagName:s,tagExp:r,closeIndex:i,attrExpPresent:l,rawTagName:E}}function aLe(e,u,a){const t=a;let n=1;for(;a<e.length;a++)if(e[a]==="<")if(e[a+1]==="/"){const r=A4(e,">",a,`${u} is not closed`);if(e.substring(a+2,r).trim()===u&&(n--,n===0))return{tagContent:e.substring(t,a),i:r};a=r}else if(e[a+1]==="?")a=A4(e,"?>",a+1,"StopNode is not closed.");else if(e.substr(a+1,3)==="!--")a=A4(e,"-->",a+3,"StopNode is not closed.");else if(e.substr(a+1,2)==="![")a=A4(e,"]]>",a,"StopNode is not closed.")-2;else{const r=u9(e,a,">");r&&((r&&r.tagName)===u&&r.tagExp[r.tagExp.length-1]!=="/"&&n++,a=r.closeIndex)}}function e9(e,u,a){if(u&&typeof e=="string"){const t=e.trim();return t==="true"?!0:t==="false"?!1:$Re(e,a)}else return Snu.isExist(e)?e:""}var tLe=HRe,znu={};function nLe(e,u){return Onu(e,u)}function Onu(e,u,a){let t;const n={};for(let r=0;r<e.length;r++){const i=e[r],o=rLe(i);let s="";if(a===void 0?s=o:s=a+"."+o,o===u.textNodeName)t===void 0?t=i[o]:t+=""+i[o];else{if(o===void 0)continue;if(i[o]){let l=Onu(i[o],u,s);const E=oLe(l,u);i[":@"]?iLe(l,i[":@"],s,u):Object.keys(l).length===1&&l[u.textNodeName]!==void 0&&!u.alwaysCreateTextNode?l=l[u.textNodeName]:Object.keys(l).length===0&&(u.alwaysCreateTextNode?l[u.textNodeName]="":l=""),n[o]!==void 0&&n.hasOwnProperty(o)?(Array.isArray(n[o])||(n[o]=[n[o]]),n[o].push(l)):u.isArray(o,s,E)?n[o]=[l]:n[o]=l}}}return typeof t=="string"?t.length>0&&(n[u.textNodeName]=t):t!==void 0&&(n[u.textNodeName]=t),n}function rLe(e){const u=Object.keys(e);for(let a=0;a<u.length;a++){const t=u[a];if(t!==":@")return t}}function iLe(e,u,a,t){if(u){const n=Object.keys(u),r=n.length;for(let i=0;i<r;i++){const o=n[i];t.isArray(o,a+"."+o,!0,!0)?e[o]=[u[o]]:e[o]=u[o]}}}function oLe(e,u){const{textNodeName:a}=u,t=Object.keys(e).length;return!!(t===0||t===1&&(e[a]||typeof e[a]=="boolean"||e[a]===0))}znu.prettify=nLe;const{buildOptions:sLe}=_z,lLe=tLe,{prettify:ELe}=znu,cLe=Rz;let dLe=class{constructor(u){this.externalEntities={},this.options=sLe(u)}parse(u,a){if(typeof u!="string")if(u.toString)u=u.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(a){a===!0&&(a={});const r=cLe.validate(u,a);if(r!==!0)throw Error(`${r.err.msg}:${r.err.line}:${r.err.col}`)}const t=new lLe(this.options);t.addExternalEntities(this.externalEntities);const n=t.parseXml(u);return this.options.preserveOrder||n===void 0?n:ELe(n,this.options)}addEntity(u,a){if(a.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(u.indexOf("&")!==-1||u.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(a==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[u]=a}};var DLe=dLe;const hLe=`
|
|
555
555
|
`;function mLe(e,u){let a="";return u.format&&u.indentBy.length>0&&(a=hLe),wnu(e,u,"",a)}function wnu(e,u,a,t){let n="",r=!1;for(let i=0;i<e.length;i++){const o=e[i],s=xLe(o);if(s===void 0)continue;let l="";if(a.length===0?l=s:l=`${a}.${s}`,s===u.textNodeName){let m=o[s];fLe(l,u)||(m=u.tagValueProcessor(s,m),m=Mnu(m,u)),r&&(n+=t),n+=m,r=!1;continue}else if(s===u.cdataPropName){r&&(n+=t),n+=`<![CDATA[${o[s][0][u.textNodeName]}]]>`,r=!1;continue}else if(s===u.commentPropName){n+=t+`<!--${o[s][0][u.textNodeName]}-->`,r=!0;continue}else if(s[0]==="?"){const m=kN(o[":@"],u),x=s==="?xml"?"":t;let p=o[s][0][u.textNodeName];p=p.length!==0?" "+p:"",n+=x+`<${s}${p}${m}?>`,r=!0;continue}let E=t;E!==""&&(E+=u.indentBy);const c=kN(o[":@"],u),D=t+`<${s}${c}`,h=wnu(o[s],u,l,E);u.unpairedTags.indexOf(s)!==-1?u.suppressUnpairedNode?n+=D+">":n+=D+"/>":(!h||h.length===0)&&u.suppressEmptyNode?n+=D+"/>":h&&h.endsWith(">")?n+=D+`>${h}${t}</${s}>`:(n+=D+">",h&&t!==""&&(h.includes("/>")||h.includes("</"))?n+=t+u.indentBy+h+t:n+=h,n+=`</${s}>`),r=!0}return n}function xLe(e){const u=Object.keys(e);for(let a=0;a<u.length;a++){const t=u[a];if(e.hasOwnProperty(t)&&t!==":@")return t}}function kN(e,u){let a="";if(e&&!u.ignoreAttributes)for(let t in e){if(!e.hasOwnProperty(t))continue;let n=u.attributeValueProcessor(t,e[t]);n=Mnu(n,u),n===!0&&u.suppressBooleanAttributes?a+=` ${t.substr(u.attributeNamePrefix.length)}`:a+=` ${t.substr(u.attributeNamePrefix.length)}="${n}"`}return a}function fLe(e,u){e=e.substr(0,e.length-u.textNodeName.length-1);let a=e.substr(e.lastIndexOf(".")+1);for(let t in u.stopNodes)if(u.stopNodes[t]===e||u.stopNodes[t]==="*."+a)return!0;return!1}function Mnu(e,u){if(e&&e.length>0&&u.processEntities)for(let a=0;a<u.entities.length;a++){const t=u.entities[a];e=e.replace(t.regex,t.val)}return e}var pLe=mLe;const gLe=pLe,CLe=Bnu,FLe={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(e,u){return u},attributeValueProcessor:function(e,u){return u},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function U1(e){this.options=Object.assign({},FLe,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=CLe(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=ALe),this.processTextOrObjNode=kLe,this.options.format?(this.indentate=vLe,this.tagEndChar=`>
|
|
556
556
|
`,this.newLine=`
|
|
557
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}U1.prototype.build=function(e){return this.options.preserveOrder?gLe(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)};U1.prototype.j2x=function(e,u,a){let t="",n="";const r=a.join(".");for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i))if(typeof e[i]>"u")this.isAttribute(i)&&(n+="");else if(e[i]===null)this.isAttribute(i)?n+="":i[0]==="?"?n+=this.indentate(u)+"<"+i+"?"+this.tagEndChar:n+=this.indentate(u)+"<"+i+"/"+this.tagEndChar;else if(e[i]instanceof Date)n+=this.buildTextValNode(e[i],i,"",u);else if(typeof e[i]!="object"){const o=this.isAttribute(i);if(o&&!this.ignoreAttributesFn(o,r))t+=this.buildAttrPairStr(o,""+e[i]);else if(!o)if(i===this.options.textNodeName){let s=this.options.tagValueProcessor(i,""+e[i]);n+=this.replaceEntitiesValue(s)}else n+=this.buildTextValNode(e[i],i,"",u)}else if(Array.isArray(e[i])){const o=e[i].length;let s="",l="";for(let E=0;E<o;E++){const c=e[i][E];if(!(typeof c>"u"))if(c===null)i[0]==="?"?n+=this.indentate(u)+"<"+i+"?"+this.tagEndChar:n+=this.indentate(u)+"<"+i+"/"+this.tagEndChar;else if(typeof c=="object")if(this.options.oneListGroup){const D=this.j2x(c,u+1,a.concat(i));s+=D.val,this.options.attributesGroupName&&c.hasOwnProperty(this.options.attributesGroupName)&&(l+=D.attrStr)}else s+=this.processTextOrObjNode(c,i,u,a);else if(this.options.oneListGroup){let D=this.options.tagValueProcessor(i,c);D=this.replaceEntitiesValue(D),s+=D}else s+=this.buildTextValNode(c,i,"",u)}this.options.oneListGroup&&(s=this.buildObjectNode(s,i,l,u)),n+=s}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const o=Object.keys(e[i]),s=o.length;for(let l=0;l<s;l++)t+=this.buildAttrPairStr(o[l],""+e[i][o[l]])}else n+=this.processTextOrObjNode(e[i],i,u,a);return{attrStr:t,val:n}};U1.prototype.buildAttrPairStr=function(e,u){return u=this.options.attributeValueProcessor(e,""+u),u=this.replaceEntitiesValue(u),this.options.suppressBooleanAttributes&&u==="true"?" "+e:" "+e+'="'+u+'"'};function kLe(e,u,a,t){const n=this.j2x(e,a+1,t.concat(u));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],u,n.attrStr,a):this.buildObjectNode(n.val,u,n.attrStr,a)}U1.prototype.buildObjectNode=function(e,u,a,t){if(e==="")return u[0]==="?"?this.indentate(t)+"<"+u+a+"?"+this.tagEndChar:this.indentate(t)+"<"+u+a+this.closeTag(u)+this.tagEndChar;{let n="</"+u+this.tagEndChar,r="";return u[0]==="?"&&(r="?",n=""),(a||a==="")&&e.indexOf("<")===-1?this.indentate(t)+"<"+u+a+r+">"+e+n:this.options.commentPropName!==!1&&u===this.options.commentPropName&&r.length===0?this.indentate(t)+`<!--${e}-->`+this.newLine:this.indentate(t)+"<"+u+a+r+this.tagEndChar+e+this.indentate(t)+n}};U1.prototype.closeTag=function(e){let u="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(u="/"):this.options.suppressEmptyNode?u="/":u=`></${e}`,u};U1.prototype.buildTextValNode=function(e,u,a,t){if(this.options.cdataPropName!==!1&&u===this.options.cdataPropName)return this.indentate(t)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&u===this.options.commentPropName)return this.indentate(t)+`<!--${e}-->`+this.newLine;if(u[0]==="?")return this.indentate(t)+"<"+u+a+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(u,e);return n=this.replaceEntitiesValue(n),n===""?this.indentate(t)+"<"+u+a+this.closeTag(u)+this.tagEndChar:this.indentate(t)+"<"+u+a+">"+n+"</"+u+this.tagEndChar}};U1.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let u=0;u<this.options.entities.length;u++){const a=this.options.entities[u];e=e.replace(a.regex,a.val)}return e};function vLe(e){return this.options.indentBy.repeat(e)}function ALe(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}var bLe=U1;const yLe=Rz,BLe=DLe,SLe=bLe;var zLe={XMLParser:BLe,XMLValidator:yLe,XMLBuilder:SLe};function Tnu(e,u,a){const t=u??0;let n=a??0;const r=[];for(const i of e)if("#text"in i)r.push({node:i["#text"],depth:t,isText:!0,hasChildren:!1,index:n,lastChildIndex:n}),n++;else{const o=Object.entries(i[":@"]||{}).map(([m,x])=>[m,JSON.stringify(x)]),s=Object.fromEntries(o),l=new Set(Object.keys(i));l.delete(":@"),l.delete("#text");const E=Array.from(l)[0];if(!E)continue;let c=[];const D=i[E];D&&D.length>0&&(c=Tnu(D,t+1,n+1));const h=c.length;r.push({node:E,depth:t,attributes:s,isText:!1,hasChildren:h>0,index:n,lastChildIndex:n+h}),r.push(...c),n+=h+1}return r}function OLe(e){const a=new zLe.XMLParser({allowBooleanAttributes:!0,ignoreAttributes:!1,attributeNamePrefix:"",alwaysCreateTextNode:!0,preserveOrder:!0,unpairedTags:["hr","br","link","meta"],stopNodes:["*.pre","*.script"],processEntities:!0,htmlEntities:!0,parseAttributeValue:!1}).parse(e);return Tnu(a)}const Pnu=20,vN=8,wLe=10;function MLe(e){const u=e.depth*Pnu;if(e.isText)return u+e.node.length*vN;const a=[e.node.length];for(const[n,r]of Object.entries(e.attributes||{}))a.push(n.length),r&&a.push(r.length+1);const t=a.reduce((n,r)=>n+r,0);return u+t*vN}function TLe({node:e,isCollapsed:u,toggleCollapsed:a,height:t,translateY:n}){return d.jsxs("div",{className:"m-0 flex h-[20px] items-center gap-2 whitespace-nowrap p-0 text-sm",style:{position:"absolute",top:0,left:0,width:"100%",height:t,transform:`translateY(${n}px)`,paddingLeft:e.depth*Pnu},children:[e.hasChildren?d.jsx("div",{className:"cursor-pointer",onClick:a,children:u?d.jsx(rm,{className:"h-4 w-4"}):d.jsx(od,{className:"h-4 w-4"})}):null,e.isText?d.jsx("span",{children:e.node}):d.jsxs(d.Fragment,{children:[d.jsx("span",{style:{color:"hsl(var(--chart-3))"},children:e.node}),e.attributes&&Object.entries(e.attributes).map(([r,i])=>d.jsxs("span",{children:[d.jsx("span",{style:{color:"hsl(var(--chart-2))"},children:r}),i&&d.jsxs(d.Fragment,{children:["=",d.jsx("span",{style:{color:"hsl(var(--chart-1))"},children:i})]})]},r))]})]})}function PLe(e){const{dataType:u,xmlTree:a,height:t}=e,n=C.useMemo(()=>{switch(u){case"html":return OLe(a);case"a11y":return cRe(a)}},[u,a]),[r,i]=C.useState(new Set),o=C.useMemo(()=>{const c=Array.from(r).sort((m,x)=>m-x),D=[];let h=0;for(const m of c){if(m<h)continue;D.push(...n.slice(h,m+1));const x=n[m];x&&(h=x.lastChildIndex+1)}return D.push(...n.slice(h)),D},[r,n]),s=C.useMemo(()=>o.map((D,h)=>({index:h,length:MLe(D)})).sort((D,h)=>h.length-D.length).slice(0,wLe).map(D=>D.index),[o]),l=C.useRef(null),E=Anu({count:o.length,getScrollElement:()=>l.current,estimateSize:()=>20,rangeExtractor:c=>{const D=knu(c);return Array.from(new Set([...D,...s]))}});return d.jsx("div",{ref:l,style:{height:t,overflow:"auto"},children:d.jsx("div",{style:{height:`${E.getTotalSize()}px`,width:"100%",position:"relative"},children:E.getVirtualItems().map(c=>{const D=o[c.index];return d.jsx(TLe,{node:D,height:c.size,translateY:c.start,isCollapsed:r.has(c.index),toggleCollapsed:()=>{if(D.hasChildren){const h=new Set(r);r.has(D.index)?h.delete(D.index):h.add(D.index),i(h)}}},c.key)})})})}function jLe({dataType:e,xml:u}){return d.jsx(Fnu,{disableWidth:!0,children:({height:a})=>d.jsx(PLe,{dataType:e,xmlTree:u,height:a})})}var NLe="Expected a function",AN=NaN,RLe="[object Symbol]",LLe=/^\s+|\s+$/g,_Le=/^[-+]0x[0-9a-f]+$/i,ILe=/^0b[01]+$/i,KLe=/^0o[0-7]+$/i,$Le=parseInt,VLe=typeof Ga=="object"&&Ga&&Ga.Object===Object&&Ga,HLe=typeof self=="object"&&self&&self.Object===Object&&self,GLe=VLe||HLe||Function("return this")(),JLe=Object.prototype,WLe=JLe.toString,ULe=Math.max,ZLe=Math.min,Mv=function(){return GLe.Date.now()};function QLe(e,u,a){var t,n,r,i,o,s,l=0,E=!1,c=!1,D=!0;if(typeof e!="function")throw new TypeError(NLe);u=bN(u)||0,a9(a)&&(E=!!a.leading,c="maxWait"in a,r=c?ULe(bN(a.maxWait)||0,u):r,D="trailing"in a?!!a.trailing:D);function h(v){var A=t,B=n;return t=n=void 0,l=v,i=e.apply(B,A),i}function m(v){return l=v,o=setTimeout(f,u),E?h(v):i}function x(v){var A=v-s,B=v-l,j=u-A;return c?ZLe(j,r-B):j}function p(v){var A=v-s,B=v-l;return s===void 0||A>=u||A<0||c&&B>=r}function f(){var v=Mv();if(p(v))return g(v);o=setTimeout(f,x(v))}function g(v){return o=void 0,D&&t?h(v):(t=n=void 0,i)}function F(){o!==void 0&&clearTimeout(o),l=0,t=s=n=o=void 0}function b(){return o===void 0?i:g(Mv())}function y(){var v=Mv(),A=p(v);if(t=arguments,n=this,s=v,A){if(o===void 0)return m(s);if(c)return o=setTimeout(f,u),h(s)}return o===void 0&&(o=setTimeout(f,u)),i}return y.cancel=F,y.flush=b,y}function a9(e){var u=typeof e;return!!e&&(u=="object"||u=="function")}function qLe(e){return!!e&&typeof e=="object"}function YLe(e){return typeof e=="symbol"||qLe(e)&&WLe.call(e)==RLe}function bN(e){if(typeof e=="number")return e;if(YLe(e))return AN;if(a9(e)){var u=typeof e.valueOf=="function"?e.valueOf():e;e=a9(u)?u+"":u}if(typeof e!="string")return e===0?e:+e;e=e.replace(LLe,"");var a=ILe.test(e);return a||KLe.test(e)?$Le(e.slice(2),a?2:8):_Le.test(e)?AN:+e}var XLe=QLe;const yN=al(XLe);function u_e(e){const u=C.useRef(e);u.current=e,C.useEffect(()=>()=>{u.current()},[])}function e_e(e,u=500,a){const t=C.useRef();u_e(()=>{t.current&&t.current.cancel()});const n=C.useMemo(()=>{const r=yN(e,u,a),i=(...o)=>r(...o);return i.cancel=()=>{r.cancel()},i.isPending=()=>!!t.current,i.flush=()=>r.flush(),i},[e,u,a]);return C.useEffect(()=>{t.current=yN(e,u,a)},[e,u,a]),n}function a_e(e,u,a){const t=(a==null?void 0:a.equalityFn)??((l,E)=>l===E),n=e instanceof Function?e():e,[r,i]=C.useState(n),o=C.useRef(n),s=e_e(i,u,a);return t(o.current,n)||(s(n),o.current=n),[r,s]}function t_e(e){return S({name:V1,description:k().min(1),retries:uu().int().min(0).optional(),channel:k().optional(),tag:k().optional(),autoGrantPermissions:cu().optional(),disableMomenticAccessibilityTree:cu().optional(),region:KS.or(J(Ba)).optional(),remoteEmulatorSettings:S({androidVersion:Ku(_l).optional()}).optional(),defaultApkFilePath:k().trim().optional(),localEmulatorSettings:S({avdId:k().trim().optional()}).optional(),latitude:z3(u=>{if(u===""||u===void 0||u===null)return null;const a=Number(u);return isNaN(a)?null:a},uu().refine(u=>u>=-90&&u<=90,{message:"Latitude must be between -90 and 90 degrees"}).nullable()),longitude:z3(u=>{if(u===""||u===void 0||u===null)return null;const a=Number(u);return isNaN(a)?null:a},uu().refine(u=>u>=-180&&u<=180,{message:"Longitude must be between -180 and 180 degrees"}).nullable()),useMemory:tr(["inherit","enabled","disabled"])}).superRefine((u,a)=>{var r;if(u.latitude!==null&&u.longitude===null&&a.addIssue({code:gu.custom,message:"Longitude is required when latitude is provided.",path:["longitude"]}),u.longitude!==null&&u.latitude===null&&a.addIssue({code:gu.custom,message:"Latitude is required when longitude is provided.",path:["latitude"]}),!(u.region===Bt.LOCAL))return;const n=((r=u.localEmulatorSettings)==null?void 0:r.avdId)??"";if(n.includes(" ")){a.addIssue({code:gu.custom,message:"The AVD ID should not contain spaces.",path:["localEmulatorSettings","avdId"]});return}!n&&!e&&a.addIssue({code:gu.custom,message:`Set a Local AVD ID here, or choose an environment with a valid ${P3} key.`,path:["localEmulatorSettings","avdId"]})})}function n_e(e){var F,b,y,v,A,B,j,R,w,O,T,z,N,M,I,P,L,K,W,_,Q,eu,U,iu,tu;const u=Ci(),{data:a}=Pm(e.testPath),{data:t=[]}=fC(),n=(F=a==null?void 0:a.settings)==null?void 0:F.defaultEnv,r=C.useMemo(()=>{if(n)return t.find(Y=>Y.name===n)},[t,n]),{envLocalAvdId:i}=o0u(r),o=C.useMemo(()=>t_e(i),[i]),s=pd({mode:"onChange",resolver:gd(o),defaultValues:{name:(a==null?void 0:a.name)??"",description:a==null?void 0:a.description,retries:(b=a==null?void 0:a.settings)==null?void 0:b.retries,channel:((y=a==null?void 0:a.settings)==null?void 0:y.defaultChannel)??"",tag:((v=a==null?void 0:a.settings)==null?void 0:v.defaultTag)??"",defaultApkFilePath:((A=a==null?void 0:a.settings)==null?void 0:A.defaultApkFilePath)??"",autoGrantPermissions:(j=(B=a==null?void 0:a.settings)==null?void 0:B.emulator)==null?void 0:j.autoGrantPermissions,disableMomenticAccessibilityTree:(w=(R=a==null?void 0:a.settings)==null?void 0:R.emulator)==null?void 0:w.disableMomenticAccessibilityTree,region:(T=(O=a==null?void 0:a.settings)==null?void 0:O.emulator)==null?void 0:T.region,localEmulatorSettings:((N=(z=a==null?void 0:a.settings)==null?void 0:z.emulator)==null?void 0:N.region)===Bt.LOCAL?((I=(M=a==null?void 0:a.settings)==null?void 0:M.emulator)==null?void 0:I.localEmulatorSettings)??{avdId:""}:void 0,remoteEmulatorSettings:((L=(P=a==null?void 0:a.settings)==null?void 0:P.emulator)==null?void 0:L.region)!==Bt.LOCAL?((W=(K=a==null?void 0:a.settings)==null?void 0:K.emulator)==null?void 0:W.remoteEmulatorSettings)??{androidVersion:_l.ANDROID_14}:void 0,latitude:((eu=(Q=(_=a==null?void 0:a.settings)==null?void 0:_.emulator)==null?void 0:Q.geolocation)==null?void 0:eu.latitude)??null,longitude:((tu=(iu=(U=a==null?void 0:a.settings)==null?void 0:U.emulator)==null?void 0:iu.geolocation)==null?void 0:tu.longitude)??null,useMemory:BN(a)}}),l=s.watch("channel"),E=s.watch("region"),c=E===Bt.LOCAL,{data:D}=ns("/api/assets",u),h=C.useMemo(()=>{const Y=new Set;for(const ou of(D==null?void 0:D.assets)||[])Y.add(ou.channel);return Array.from(Y).sort()},[D]),m=C.useMemo(()=>{const Y=l&&l!==Ba?l:void 0;if(!Y)return[];const ou=new Set;for(const Cu of(D==null?void 0:D.assets)||[])Cu.channel===Y&&ou.add(Cu.tag);return Array.from(ou).sort()},[D,l]),[x,p]=Ws(async Y=>{var le,Yu,ve,Ie,Zu,Gu;const ou=Y.region===Bt.LOCAL,Cu=(le=Y.defaultApkFilePath)==null?void 0:le.trim(),Au=Y.autoGrantPermissions,mu={retries:Y.retries,defaultChannel:Y.channel===Ba?void 0:Y.channel||void 0,defaultTag:Y.tag===Ba?void 0:Y.tag||void 0,defaultApkFilePath:Cu||void 0,emulator:{autoGrantPermissions:Au||void 0,disableMomenticAccessibilityTree:Y.disableMomenticAccessibilityTree||void 0,region:Y.region===Ba?void 0:Y.region||void 0,remoteEmulatorSettings:Y.region===Bt.LOCAL?void 0:{androidVersion:(Yu=Y.remoteEmulatorSettings)==null?void 0:Yu.androidVersion},geolocation:Y.latitude!==null&&Y.longitude!==null?{latitude:Y.latitude,longitude:Y.longitude}:void 0},ai:{useMemory:r_e(Y.useMemory)}};if(Object.values(mu.ai??{}).every(fe=>fe===void 0)&&(mu.ai=void 0),((Ie=(ve=mu.emulator)==null?void 0:ve.remoteEmulatorSettings)==null?void 0:Ie.androidVersion)===_8u&&(mu.emulator.remoteEmulatorSettings.androidVersion=void 0),mu.emulator&&Object.values(((Zu=mu.emulator)==null?void 0:Zu.remoteEmulatorSettings)??{}).every(fe=>fe===void 0)&&(mu.emulator.remoteEmulatorSettings=void 0),ou&&Y.localEmulatorSettings){const fe=(Gu=Y.localEmulatorSettings.avdId)==null?void 0:Gu.trim();fe&&(mu.emulator=mu.emulator??{},mu.emulator.localEmulatorSettings={avdId:fe})}Object.values(mu.emulator??{}).every(fe=>fe===void 0)&&(mu.emulator=void 0);const Nu={name:Y.name??(a==null?void 0:a.name),description:Y.description??(a==null?void 0:a.description)??"",settings:{...a==null?void 0:a.settings,...mu}};try{const fe=await u(`/api/mobile-tests/${encodeURIComponent(e.testPath)}/metadata`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(Nu)}),V=PBe.parse(fe);await FC(),e.onSuccess(),V.newRelativeTestPath&&window.location.replace(`/tests/${V.newRelativeTestPath}`)}catch(fe){Ca.error("Failed to save test.",{description:`${fe}`})}},[i,u,e.testPath,e.onSuccess,n]),{isDirty:f,isValid:g}=s.formState;return C.useEffect(()=>{var Y,ou,Cu,Au,mu,Nu,le,Yu,ve,Ie,Zu,Gu,fe,V,au,du,bu,pu,xu,Lu,He,yu,Ke,t0,N0,ja,Xt;x.loading||s.reset({name:(a==null?void 0:a.name)??"",description:a==null?void 0:a.description,retries:(Y=a==null?void 0:a.settings)==null?void 0:Y.retries,channel:((ou=a==null?void 0:a.settings)==null?void 0:ou.defaultChannel)||"",tag:((Cu=a==null?void 0:a.settings)==null?void 0:Cu.defaultTag)||"",autoGrantPermissions:(mu=(Au=a==null?void 0:a.settings)==null?void 0:Au.emulator)==null?void 0:mu.autoGrantPermissions,disableMomenticAccessibilityTree:(le=(Nu=a==null?void 0:a.settings)==null?void 0:Nu.emulator)==null?void 0:le.disableMomenticAccessibilityTree,region:(ve=(Yu=a==null?void 0:a.settings)==null?void 0:Yu.emulator)==null?void 0:ve.region,localEmulatorSettings:((Zu=(Ie=a==null?void 0:a.settings)==null?void 0:Ie.emulator)==null?void 0:Zu.region)===Bt.LOCAL?((fe=(Gu=a==null?void 0:a.settings)==null?void 0:Gu.emulator)==null?void 0:fe.localEmulatorSettings)??{avdId:""}:void 0,remoteEmulatorSettings:((au=(V=a==null?void 0:a.settings)==null?void 0:V.emulator)==null?void 0:au.region)!==Bt.LOCAL?((bu=(du=a==null?void 0:a.settings)==null?void 0:du.emulator)==null?void 0:bu.remoteEmulatorSettings)??{androidVersion:((Lu=(xu=(pu=a==null?void 0:a.settings)==null?void 0:pu.emulator)==null?void 0:xu.remoteEmulatorSettings)==null?void 0:Lu.androidVersion)??_l.ANDROID_14}:void 0,defaultApkFilePath:((He=a==null?void 0:a.settings)==null?void 0:He.defaultApkFilePath)??"",latitude:(t0=(Ke=(yu=a==null?void 0:a.settings)==null?void 0:yu.emulator)==null?void 0:Ke.geolocation)==null?void 0:t0.latitude,longitude:(Xt=(ja=(N0=a==null?void 0:a.settings)==null?void 0:N0.emulator)==null?void 0:ja.geolocation)==null?void 0:Xt.longitude,useMemory:BN(a)})},[s,a,x.loading]),d.jsxs(bE,{children:[d.jsx(yE,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",children:[d.jsx(_7,{className:"h-4 w-4"}),"Options"]})}),d.jsxs(_1,{children:[d.jsxs(I1,{children:[d.jsx(K1,{children:"Test options"}),d.jsx($1,{children:"Once you save these settings, the editor session will reload."})]}),d.jsx(Cd,{...s,children:d.jsxs("form",{onSubmit:s.handleSubmit(p),className:"space-y-4",children:[d.jsxs(Tm,{defaultValue:"general",children:[d.jsxs(Od,{children:[d.jsx(On,{value:"general",children:"General"}),d.jsx(On,{value:"emulator",children:"Emulator"}),d.jsx(On,{value:"ai",className:"space-x-2",children:"AI"})]}),d.jsxs(wn,{value:"general",className:"space-y-4",children:[d.jsx(_0,{control:s.control,name:"name",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Name"}),d.jsx(T0,{children:d.jsx(SE,{placeholder:"example-test-name",value:Y.value??"",onChange:ou=>Y.onChange(ou)})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:s.control,name:"description",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Description"}),d.jsx(T0,{children:d.jsx(zd,{placeholder:"Test description",rows:4,...Y,value:Y.value||""})}),d.jsx(P0,{})]})}),!c&&d.jsxs(d.Fragment,{children:[d.jsx(_0,{control:s.control,name:"channel",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Channel"}),d.jsx(T0,{children:d.jsxs(Ka,{onValueChange:ou=>{Y.onChange(ou),s.setValue("tag",Ba,{shouldDirty:!0})},value:Y.value,children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select channel..."})}),d.jsxs(wa,{children:[h.map(ou=>d.jsx(Re,{value:ou,children:ou},ou)),d.jsx(Re,{value:Ba,children:"None"})]})]})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:s.control,name:"tag",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Tag"}),d.jsx(T0,{children:d.jsxs(Ka,{onValueChange:Y.onChange,value:Y.value,children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select tag..."})}),d.jsxs(wa,{children:[m.map(ou=>d.jsx(Re,{value:ou,children:ou},ou)),d.jsx(Re,{value:Ba,children:"Latest available"})]})]})}),d.jsx(P0,{})]})})]}),d.jsx(_0,{control:s.control,name:"retries",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:"Number of retries allowed when running this test non-interactively. If unset, defaults to 1.",children:"Retries"}),d.jsx(T0,{children:d.jsx(gt,{type:"number",min:0,step:1,max:5,value:Y.value??"",onChange:ou=>{const Cu=ou.target.value;Y.onChange(Cu===""?void 0:Number(Cu))},onBlur:Y.onBlur,name:Y.name,ref:Y.ref})}),d.jsx(P0,{})]})})]}),d.jsxs(wn,{value:"emulator",className:"space-y-4",children:[d.jsx(_0,{control:s.control,name:"autoGrantPermissions",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Auto grant permissions"}),d.jsx(T0,{children:d.jsx("div",{children:d.jsx(Ch,{checked:!!Y.value,onCheckedChange:ou=>Y.onChange(ou)})})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:s.control,name:"disableMomenticAccessibilityTree",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:"Use Android's native implementation for computing the accessibility tree in webviews instead of Momentic's custom implementation. This degrades AI performance but may improve latency.",children:"Use native tree for webviews"}),d.jsx(T0,{children:d.jsx("div",{children:d.jsx(Ch,{checked:!!Y.value,onCheckedChange:ou=>Y.onChange(ou)})})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:s.control,name:"region",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Region"}),d.jsx(T0,{children:d.jsxs(Ka,{value:Y.value??Ba,onValueChange:ou=>{Y.onChange(ou),ou!==Bt.LOCAL?(s.setValue("defaultApkFilePath","",{shouldDirty:!0}),s.setValue("remoteEmulatorSettings.androidVersion",void 0,{shouldDirty:!0})):(s.setValue("channel","",{shouldDirty:!0}),s.setValue("tag","",{shouldDirty:!0}),s.setValue("localEmulatorSettings.avdId","",{shouldDirty:!0,shouldValidate:!0}))},children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select region..."})}),d.jsxs(wa,{children:[r0u.map(ou=>d.jsx(Re,{value:ou,children:i0u[ou]??ou},ou)),d.jsx(Re,{value:Ba,children:"Closest Region"})]})]})}),d.jsxs(op,{children:["Choose whether tests execute using remote or local emulators."," ",d.jsx(xh,{slug:"/mobile-cli/emulators#choosing-a-platform"})]}),d.jsx(P0,{})]})}),E===Bt.LOCAL?d.jsxs("div",{className:"space-y-4",children:[d.jsx(_0,{control:s.control,name:"localEmulatorSettings.avdId",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:`The ID of the AVD to use for the local emulator. If unset, Momentic will use ${P3} from the selected environment (if any).`,children:"Local AVD ID"}),d.jsx(T0,{children:d.jsx(gt,{value:Y.value,onChange:ou=>Y.onChange(ou.target.value),onBlur:Y.onBlur,name:Y.name,ref:Y.ref,placeholder:"Pixel_9_API_35"})}),d.jsx(P0,{})]},"avd-id-item")},"avd-id-field"),d.jsx(_0,{control:s.control,name:"defaultApkFilePath",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:`Local path to the APK that should be installed when using a local emulator. If unset, Momentic will use ${Eh} from the selected environment (if any).`,children:"Local APK file path"}),d.jsx(T0,{children:d.jsx(gt,{value:Y.value,onChange:ou=>Y.onChange(ou.target.value),onBlur:Y.onBlur,name:Y.name,ref:Y.ref,placeholder:"/Users/me/app/build/app.apk"})}),d.jsx(P0,{})]})})]},"local-emulator-settings"):d.jsx(_0,{control:s.control,name:"remoteEmulatorSettings.androidVersion",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Android Version"}),d.jsx(T0,{children:d.jsxs(Ka,{value:Y.value??_l.ANDROID_14,onValueChange:ou=>{Y.onChange(ou)},children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select OS version..."})}),d.jsx(wa,{children:Object.values(_l).map(ou=>d.jsx(Re,{value:ou,children:I8u[ou]},ou))})]})}),d.jsx(P0,{})]},"android-version-item")},"android-version-field"),d.jsx(_0,{control:s.control,name:"latitude",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:"Latitude between -90 and 90.",children:"Latitude"}),d.jsx(T0,{children:d.jsx(gt,{...Y,type:"number",value:Y.value||"",onChange:ou=>{isNaN(ou.target.valueAsNumber)?Y.onChange(null):Y.onChange(ou.target.valueAsNumber)},placeholder:wP.latitude.toString()})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:s.control,name:"longitude",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:"Longitude between -180 and 180.",children:"Longitude"}),d.jsx(T0,{children:d.jsx(gt,{...Y,type:"number",value:Y.value||"",onChange:ou=>{isNaN(ou.target.valueAsNumber)?Y.onChange(null):Y.onChange(ou.target.valueAsNumber)},placeholder:wP.longitude.toString()})}),d.jsx(P0,{})]})})]}),d.jsx(wn,{value:"ai",className:"space-y-4",children:d.jsx(_0,{control:s.control,name:"useMemory",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:"Allow Momentic to store and reuse past AI results to ensure consistency over time.",children:"Memory"}),d.jsx(T0,{children:d.jsxs(Ka,{value:Y.value,onValueChange:ou=>{Y.onChange(ou)},children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select option..."})}),d.jsxs(wa,{children:[d.jsx(Re,{value:"enabled",children:"Enabled"}),d.jsx(Re,{value:"disabled",children:"Disabled"}),d.jsx(Re,{value:"inherit",children:"Inherit organization setting"})]})]})}),d.jsx(P0,{})]})})})]}),d.jsx(BE,{children:d.jsx(Ve,{type:"submit",disabled:x.loading||!f||!g,children:"Save test options"})})]})})]})]})}function BN(e){var u,a,t,n;return((a=(u=e==null?void 0:e.settings)==null?void 0:u.ai)==null?void 0:a.useMemory)===void 0?"inherit":((n=(t=e==null?void 0:e.settings)==null?void 0:t.ai)==null?void 0:n.useMemory)===!0?"enabled":"disabled"}function r_e(e){if(e!=="inherit")return e==="enabled"}const i_e=e=>{const u=e.value||P5;return d.jsxs(Ka,{value:u,onValueChange:a=>{if(a===P5){e.onChange(void 0);return}e.onChange(a)},children:[d.jsxs(Oa,{className:"space-x-2",children:[d.jsx("span",{className:"text-muted-foreground",children:"Default environment:"}),d.jsx($a,{placeholder:"Select environment"})]}),d.jsxs(wa,{children:[d.jsx(Re,{value:P5,children:P5}),e.options.map(a=>d.jsx(Re,{value:a.name,children:a.name},a.name))]})]})},jnu="http://localhost:58890",o_e=aku(jnu);function s_e(e,u){const a=URL.createObjectURL(u),t=document.createElement("a");t.href=a,t.download=e,document.body.appendChild(t),t.click(),document.body.removeChild(t),URL.revokeObjectURL(a)}const l_e=[Tu.AI_ACTION,...Object.values(G)],Iz=({open:e,children:u,modules:a,onOpenChange:t,onSelect:n})=>{const[r,i]=C.useState(""),o=C.useMemo(()=>l_e.map(g=>({type:"STEP",name:vb[g],description:NSu[g],onSelect:()=>{if(g===Tu.AI_ACTION){n==null||n({type:Tu.AI_ACTION});return}n==null||n({type:Tu.PRESET,command:g})}})),[n]),s=C.useMemo(()=>a.map(g=>({type:"MODULE",name:g.name,description:g.description,onSelect:()=>{n==null||n({...g,type:I0.MODULE})}})),[a,n]),l=C.useMemo(()=>new J1([...s,...o],{keys:[{name:"name",weight:1},{name:"description",weight:.8}],threshold:.4,includeScore:!0,findAllMatches:!0,ignoreLocation:!0,useExtendedSearch:!0,shouldSort:!0,includeMatches:!0,distance:100,ignoreFieldNorm:!1}),[s,o]),E=C.useMemo(()=>{const g=r.trim().replace(/-/g," ");if(!g)return[...o,...s];const F=g.toLowerCase().split(/\s+/);return F.push(g),l.search({$and:F.map(y=>({$or:[{name:y},{description:y},{containingFolderPath:y}]}))}).map(y=>y.item)},[l,s,r,o]),c=C.useMemo(()=>E.filter(g=>g.type==="STEP"),[E]),D=C.useMemo(()=>E.filter(g=>g.type==="MODULE"),[E]),h=C.useRef(null),m=C.useRef(null),x=C.useRef(null),p=C.useRef(null),f=()=>{window.setTimeout(()=>{var g,F,b;(g=m.current)==null||g.scrollTo({top:0,behavior:"instant"}),(F=x.current)==null||F.scrollTo({top:0,behavior:"instant"}),(b=p.current)==null||b.scrollTo({top:0,behavior:"instant"})},0)};return C.useEffect(()=>{e||i("")},[e]),d.jsxs(kSe,{open:e,onOpenChange:t,modal:!1,trigger:u,commandProps:{shouldFilter:!1},dialogContentProps:{className:"max-w-2xl translate-y-0 top-[20%] data-[state=closed]:!slide-out-to-top-[0%] data-[state=open]:!slide-in-from-top-[0%]",onFocusOutside(g){g.preventDefault()}},children:[d.jsx(gC,{ref:h,autoFocus:!0,placeholder:"Search by describing what you want to do...",value:r,onValueChange:g=>{i(g),f()}}),d.jsxs(Tm,{defaultValue:"steps",onValueChange:()=>{window.setTimeout(()=>{var g;(g=h.current)==null||g.focus()},0),f()},children:[d.jsxs(Od,{className:"m-2",children:[d.jsx(On,{value:"all",children:"All"}),d.jsx(On,{value:"steps",children:"Steps"}),d.jsx(On,{value:"modules",children:"Modules"})]}),d.jsx(wn,{value:"all",className:"border-border mt-0 border-t",children:d.jsxs(j4,{className:"max-h-[500px]",ref:m,children:[E.length?null:d.jsx(t1,{children:"No items found."}),E.length?E.map(g=>d.jsx(Ps,{onSelect:g.onSelect,children:d.jsxs("div",{children:[d.jsx("div",{className:"text-base font-medium",children:g.name}),d.jsx("div",{className:"text-muted-foreground text-sm",children:g.description})]})},g.name)):null]})}),d.jsx(wn,{value:"steps",className:"border-border mt-0 border-t",children:d.jsxs(j4,{className:"max-h-[500px]",ref:x,children:[c.length?null:d.jsx(t1,{children:"No steps found."}),c.length?c.map(g=>d.jsx(Ps,{onSelect:g.onSelect,children:d.jsxs("div",{children:[d.jsx("div",{className:"text-base font-medium",children:g.name}),d.jsx("div",{className:"text-muted-foreground text-sm",children:g.description})]})},g.name)):null]})}),d.jsx(wn,{value:"modules",className:"border-border mt-0 border-t",children:d.jsxs(j4,{className:"max-h-[500px]",ref:p,children:[D.length?null:d.jsx(t1,{children:"No modules found."}),D.length?D.map(g=>d.jsx(Ps,{onSelect:g.onSelect,children:d.jsxs("div",{children:[d.jsx("div",{className:"text-base font-medium",children:g.name}),d.jsx("div",{className:"text-muted-foreground text-sm",children:g.description})]})},g.name)):null]})})]})]})},E_e=e=>{const[u,a]=C.useState(!1);return d.jsx(Iz,{open:u,modules:e.modules,onOpenChange:a,onSelect:t=>{var n;(n=e.onAdd)==null||n.call(e,t),a(!1)},children:d.jsxs(Ve,{variant:"outline",children:[d.jsx(im,{className:"h-4 w-4"})," Add new step"]})})},es=Object.create(null);es.open="0";es.close="1";es.ping="2";es.pong="3";es.message="4";es.upgrade="5";es.noop="6";const U6=Object.create(null);Object.keys(es).forEach(e=>{U6[es[e]]=e});const t9={type:"error",data:"parser error"},Nnu=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Rnu=typeof ArrayBuffer=="function",Lnu=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Kz=({type:e,data:u},a,t)=>Nnu&&u instanceof Blob?a?t(u):SN(u,t):Rnu&&(u instanceof ArrayBuffer||Lnu(u))?a?t(u):SN(new Blob([u]),t):t(es[e]+(u||"")),SN=(e,u)=>{const a=new FileReader;return a.onload=function(){const t=a.result.split(",")[1];u("b"+(t||""))},a.readAsDataURL(e)};function zN(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Tv;function c_e(e,u){if(Nnu&&e.data instanceof Blob)return e.data.arrayBuffer().then(zN).then(u);if(Rnu&&(e.data instanceof ArrayBuffer||Lnu(e.data)))return u(zN(e.data));Kz(e,!1,a=>{Tv||(Tv=new TextEncoder),u(Tv.encode(a))})}const ON="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",L5=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<ON.length;e++)L5[ON.charCodeAt(e)]=e;const d_e=e=>{let u=e.length*.75,a=e.length,t,n=0,r,i,o,s;e[e.length-1]==="="&&(u--,e[e.length-2]==="="&&u--);const l=new ArrayBuffer(u),E=new Uint8Array(l);for(t=0;t<a;t+=4)r=L5[e.charCodeAt(t)],i=L5[e.charCodeAt(t+1)],o=L5[e.charCodeAt(t+2)],s=L5[e.charCodeAt(t+3)],E[n++]=r<<2|i>>4,E[n++]=(i&15)<<4|o>>2,E[n++]=(o&3)<<6|s&63;return l},D_e=typeof ArrayBuffer=="function",$z=(e,u)=>{if(typeof e!="string")return{type:"message",data:_nu(e,u)};const a=e.charAt(0);return a==="b"?{type:"message",data:h_e(e.substring(1),u)}:U6[a]?e.length>1?{type:U6[a],data:e.substring(1)}:{type:U6[a]}:t9},h_e=(e,u)=>{if(D_e){const a=d_e(e);return _nu(a,u)}else return{base64:!0,data:e}},_nu=(e,u)=>{switch(u){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Inu="",m_e=(e,u)=>{const a=e.length,t=new Array(a);let n=0;e.forEach((r,i)=>{Kz(r,!1,o=>{t[i]=o,++n===a&&u(t.join(Inu))})})},x_e=(e,u)=>{const a=e.split(Inu),t=[];for(let n=0;n<a.length;n++){const r=$z(a[n],u);if(t.push(r),r.type==="error")break}return t};function f_e(){return new TransformStream({transform(e,u){c_e(e,a=>{const t=a.length;let n;if(t<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,t);else if(t<65536){n=new Uint8Array(3);const r=new DataView(n.buffer);r.setUint8(0,126),r.setUint16(1,t)}else{n=new Uint8Array(9);const r=new DataView(n.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(t))}e.data&&typeof e.data!="string"&&(n[0]|=128),u.enqueue(n),u.enqueue(a)})}})}let Pv;function Gx(e){return e.reduce((u,a)=>u+a.length,0)}function Jx(e,u){if(e[0].length===u)return e.shift();const a=new Uint8Array(u);let t=0;for(let n=0;n<u;n++)a[n]=e[0][t++],t===e[0].length&&(e.shift(),t=0);return e.length&&t<e[0].length&&(e[0]=e[0].slice(t)),a}function p_e(e,u){Pv||(Pv=new TextDecoder);const a=[];let t=0,n=-1,r=!1;return new TransformStream({transform(i,o){for(a.push(i);;){if(t===0){if(Gx(a)<1)break;const s=Jx(a,1);r=(s[0]&128)===128,n=s[0]&127,n<126?t=3:n===126?t=1:t=2}else if(t===1){if(Gx(a)<2)break;const s=Jx(a,2);n=new DataView(s.buffer,s.byteOffset,s.length).getUint16(0),t=3}else if(t===2){if(Gx(a)<8)break;const s=Jx(a,8),l=new DataView(s.buffer,s.byteOffset,s.length),E=l.getUint32(0);if(E>Math.pow(2,21)-1){o.enqueue(t9);break}n=E*Math.pow(2,32)+l.getUint32(4),t=3}else{if(Gx(a)<n)break;const s=Jx(a,n);o.enqueue($z(r?s:Pv.decode(s),u)),t=0}if(n===0||n>e){o.enqueue(t9);break}}}})}const Knu=4;function lt(e){if(e)return g_e(e)}function g_e(e){for(var u in lt.prototype)e[u]=lt.prototype[u];return e}lt.prototype.on=lt.prototype.addEventListener=function(e,u){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(u),this};lt.prototype.once=function(e,u){function a(){this.off(e,a),u.apply(this,arguments)}return a.fn=u,this.on(e,a),this};lt.prototype.off=lt.prototype.removeListener=lt.prototype.removeAllListeners=lt.prototype.removeEventListener=function(e,u){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var a=this._callbacks["$"+e];if(!a)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var t,n=0;n<a.length;n++)if(t=a[n],t===u||t.fn===u){a.splice(n,1);break}return a.length===0&&delete this._callbacks["$"+e],this};lt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var u=new Array(arguments.length-1),a=this._callbacks["$"+e],t=1;t<arguments.length;t++)u[t-1]=arguments[t];if(a){a=a.slice(0);for(var t=0,n=a.length;t<n;++t)a[t].apply(this,u)}return this};lt.prototype.emitReserved=lt.prototype.emit;lt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};lt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const KC=typeof Promise=="function"&&typeof Promise.resolve=="function"?u=>Promise.resolve().then(u):(u,a)=>a(u,0),ai=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),C_e="arraybuffer";function $nu(e,...u){return u.reduce((a,t)=>(e.hasOwnProperty(t)&&(a[t]=e[t]),a),{})}const F_e=ai.setTimeout,k_e=ai.clearTimeout;function $C(e,u){u.useNativeTimers?(e.setTimeoutFn=F_e.bind(ai),e.clearTimeoutFn=k_e.bind(ai)):(e.setTimeoutFn=ai.setTimeout.bind(ai),e.clearTimeoutFn=ai.clearTimeout.bind(ai))}const v_e=1.33;function A_e(e){return typeof e=="string"?b_e(e):Math.ceil((e.byteLength||e.size)*v_e)}function b_e(e){let u=0,a=0;for(let t=0,n=e.length;t<n;t++)u=e.charCodeAt(t),u<128?a+=1:u<2048?a+=2:u<55296||u>=57344?a+=3:(t++,a+=4);return a}function Vnu(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function y_e(e){let u="";for(let a in e)e.hasOwnProperty(a)&&(u.length&&(u+="&"),u+=encodeURIComponent(a)+"="+encodeURIComponent(e[a]));return u}function B_e(e){let u={},a=e.split("&");for(let t=0,n=a.length;t<n;t++){let r=a[t].split("=");u[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return u}class S_e extends Error{constructor(u,a,t){super(u),this.description=a,this.context=t,this.type="TransportError"}}class Vz extends lt{constructor(u){super(),this.writable=!1,$C(this,u),this.opts=u,this.query=u.query,this.socket=u.socket,this.supportsBinary=!u.forceBase64}onError(u,a,t){return super.emitReserved("error",new S_e(u,a,t)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(u){this.readyState==="open"&&this.write(u)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(u){const a=$z(u,this.socket.binaryType);this.onPacket(a)}onPacket(u){super.emitReserved("packet",u)}onClose(u){this.readyState="closed",super.emitReserved("close",u)}pause(u){}createUri(u,a={}){return u+"://"+this._hostname()+this._port()+this.opts.path+this._query(a)}_hostname(){const u=this.opts.hostname;return u.indexOf(":")===-1?u:"["+u+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(u){const a=y_e(u);return a.length?"?"+a:""}}class z_e extends Vz{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(u){this.readyState="pausing";const a=()=>{this.readyState="paused",u()};if(this._polling||!this.writable){let t=0;this._polling&&(t++,this.once("pollComplete",function(){--t||a()})),this.writable||(t++,this.once("drain",function(){--t||a()}))}else a()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(u){const a=t=>{if(this.readyState==="opening"&&t.type==="open"&&this.onOpen(),t.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)};x_e(u,this.socket.binaryType).forEach(a),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const u=()=>{this.write([{type:"close"}])};this.readyState==="open"?u():this.once("open",u)}write(u){this.writable=!1,m_e(u,a=>{this.doWrite(a,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const u=this.opts.secure?"https":"http",a=this.query||{};return this.opts.timestampRequests!==!1&&(a[this.opts.timestampParam]=Vnu()),!this.supportsBinary&&!a.sid&&(a.b64=1),this.createUri(u,a)}}let Hnu=!1;try{Hnu=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const O_e=Hnu;function w_e(){}class M_e extends z_e{constructor(u){if(super(u),typeof location<"u"){const a=location.protocol==="https:";let t=location.port;t||(t=a?"443":"80"),this.xd=typeof location<"u"&&u.hostname!==location.hostname||t!==u.port}}doWrite(u,a){const t=this.request({method:"POST",data:u});t.on("success",a),t.on("error",(n,r)=>{this.onError("xhr post error",n,r)})}doPoll(){const u=this.request();u.on("data",this.onData.bind(this)),u.on("error",(a,t)=>{this.onError("xhr poll error",a,t)}),this.pollXhr=u}}let Hc=class Z6 extends lt{constructor(u,a,t){super(),this.createRequest=u,$C(this,t),this._opts=t,this._method=t.method||"GET",this._uri=a,this._data=t.data!==void 0?t.data:null,this._create()}_create(){var u;const a=$nu(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");a.xdomain=!!this._opts.xd;const t=this._xhr=this.createRequest(a);try{t.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&t.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{t.setRequestHeader("Accept","*/*")}catch{}(u=this._opts.cookieJar)===null||u===void 0||u.addCookies(t),"withCredentials"in t&&(t.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(t.timeout=this._opts.requestTimeout),t.onreadystatechange=()=>{var n;t.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(t.getResponseHeader("set-cookie"))),t.readyState===4&&(t.status===200||t.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof t.status=="number"?t.status:0)},0))},t.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=Z6.requestsCount++,Z6.requests[this._index]=this)}_onError(u){this.emitReserved("error",u,this._xhr),this._cleanup(!0)}_cleanup(u){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=w_e,u)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Z6.requests[this._index],this._xhr=null}}_onLoad(){const u=this._xhr.responseText;u!==null&&(this.emitReserved("data",u),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Hc.requestsCount=0;Hc.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",wN);else if(typeof addEventListener=="function"){const e="onpagehide"in ai?"pagehide":"unload";addEventListener(e,wN,!1)}}function wN(){for(let e in Hc.requests)Hc.requests.hasOwnProperty(e)&&Hc.requests[e].abort()}const T_e=function(){const e=Gnu({xdomain:!1});return e&&e.responseType!==null}();class P_e extends M_e{constructor(u){super(u);const a=u&&u.forceBase64;this.supportsBinary=T_e&&!a}request(u={}){return Object.assign(u,{xd:this.xd},this.opts),new Hc(Gnu,this.uri(),u)}}function Gnu(e){const u=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!u||O_e))return new XMLHttpRequest}catch{}if(!u)try{return new ai[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Jnu=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class j_e extends Vz{get name(){return"websocket"}doOpen(){const u=this.uri(),a=this.opts.protocols,t=Jnu?{}:$nu(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(t.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(u,a,t)}catch(n){return this.emitReserved("error",n)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=u=>this.onClose({description:"websocket connection closed",context:u}),this.ws.onmessage=u=>this.onData(u.data),this.ws.onerror=u=>this.onError("websocket error",u)}write(u){this.writable=!1;for(let a=0;a<u.length;a++){const t=u[a],n=a===u.length-1;Kz(t,this.supportsBinary,r=>{try{this.doWrite(t,r)}catch{}n&&KC(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const u=this.opts.secure?"wss":"ws",a=this.query||{};return this.opts.timestampRequests&&(a[this.opts.timestampParam]=Vnu()),this.supportsBinary||(a.b64=1),this.createUri(u,a)}}const jv=ai.WebSocket||ai.MozWebSocket;class N_e extends j_e{createSocket(u,a,t){return Jnu?new jv(u,a,t):a?new jv(u,a):new jv(u)}doWrite(u,a){this.ws.send(a)}}class R_e extends Vz{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(u){return this.emitReserved("error",u)}this._transport.closed.then(()=>{this.onClose()}).catch(u=>{this.onError("webtransport error",u)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(u=>{const a=p_e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),t=u.readable.pipeThrough(a).getReader(),n=f_e();n.readable.pipeTo(u.writable),this._writer=n.writable.getWriter();const r=()=>{t.read().then(({done:o,value:s})=>{o||(this.onPacket(s),r())}).catch(o=>{})};r();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then(()=>this.onOpen())})})}write(u){this.writable=!1;for(let a=0;a<u.length;a++){const t=u[a],n=a===u.length-1;this._writer.write(t).then(()=>{n&&KC(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var u;(u=this._transport)===null||u===void 0||u.close()}}const L_e={websocket:N_e,webtransport:R_e,polling:P_e},__e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,I_e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function n9(e){if(e.length>8e3)throw"URI too long";const u=e,a=e.indexOf("["),t=e.indexOf("]");a!=-1&&t!=-1&&(e=e.substring(0,a)+e.substring(a,t).replace(/:/g,";")+e.substring(t,e.length));let n=__e.exec(e||""),r={},i=14;for(;i--;)r[I_e[i]]=n[i]||"";return a!=-1&&t!=-1&&(r.source=u,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=K_e(r,r.path),r.queryKey=$_e(r,r.query),r}function K_e(e,u){const a=/\/{2,9}/g,t=u.replace(a,"/").split("/");return(u.slice(0,1)=="/"||u.length===0)&&t.splice(0,1),u.slice(-1)=="/"&&t.splice(t.length-1,1),t}function $_e(e,u){const a={};return u.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,n,r){n&&(a[n]=r)}),a}const r9=typeof addEventListener=="function"&&typeof removeEventListener=="function",Q6=[];r9&&addEventListener("offline",()=>{Q6.forEach(e=>e())},!1);class r1 extends lt{constructor(u,a){if(super(),this.binaryType=C_e,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,u&&typeof u=="object"&&(a=u,u=null),u){const t=n9(u);a.hostname=t.host,a.secure=t.protocol==="https"||t.protocol==="wss",a.port=t.port,t.query&&(a.query=t.query)}else a.host&&(a.hostname=n9(a.host).host);$C(this,a),this.secure=a.secure!=null?a.secure:typeof location<"u"&&location.protocol==="https:",a.hostname&&!a.port&&(a.port=this.secure?"443":"80"),this.hostname=a.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=a.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},a.transports.forEach(t=>{const n=t.prototype.name;this.transports.push(n),this._transportsByName[n]=t}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},a),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=B_e(this.opts.query)),r9&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Q6.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(u){const a=Object.assign({},this.opts.query);a.EIO=Knu,a.transport=u,this.id&&(a.sid=this.id);const t=Object.assign({},this.opts,{query:a,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[u]);return new this._transportsByName[u](t)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const u=this.opts.rememberUpgrade&&r1.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const a=this.createTransport(u);a.open(),this.setTransport(a)}setTransport(u){this.transport&&this.transport.removeAllListeners(),this.transport=u,u.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",a=>this._onClose("transport close",a))}onOpen(){this.readyState="open",r1.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(u){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",u),this.emitReserved("heartbeat"),u.type){case"open":this.onHandshake(JSON.parse(u.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const a=new Error("server error");a.code=u.data,this._onError(a);break;case"message":this.emitReserved("data",u.data),this.emitReserved("message",u.data);break}}onHandshake(u){this.emitReserved("handshake",u),this.id=u.sid,this.transport.query.sid=u.sid,this._pingInterval=u.pingInterval,this._pingTimeout=u.pingTimeout,this._maxPayload=u.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const u=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+u,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},u),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const u=this._getWritablePackets();this.transport.send(u),this._prevBufferLen=u.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let a=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(a+=A_e(n)),t>0&&a>this._maxPayload)return this.writeBuffer.slice(0,t);a+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const u=Date.now()>this._pingTimeoutTime;return u&&(this._pingTimeoutTime=0,KC(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),u}write(u,a,t){return this._sendPacket("message",u,a,t),this}send(u,a,t){return this._sendPacket("message",u,a,t),this}_sendPacket(u,a,t,n){if(typeof a=="function"&&(n=a,a=void 0),typeof t=="function"&&(n=t,t=null),this.readyState==="closing"||this.readyState==="closed")return;t=t||{},t.compress=t.compress!==!1;const r={type:u,data:a,options:t};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),n&&this.once("flush",n),this.flush()}close(){const u=()=>{this._onClose("forced close"),this.transport.close()},a=()=>{this.off("upgrade",a),this.off("upgradeError",a),u()},t=()=>{this.once("upgrade",a),this.once("upgradeError",a)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?t():u()}):this.upgrading?t():u()),this}_onError(u){if(r1.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",u),this._onClose("transport error",u)}_onClose(u,a){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),r9&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const t=Q6.indexOf(this._offlineEventListener);t!==-1&&Q6.splice(t,1)}this.readyState="closed",this.id=null,this.emitReserved("close",u,a),this.writeBuffer=[],this._prevBufferLen=0}}}r1.protocol=Knu;class V_e extends r1{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let u=0;u<this._upgrades.length;u++)this._probe(this._upgrades[u])}_probe(u){let a=this.createTransport(u),t=!1;r1.priorWebsocketSuccess=!1;const n=()=>{t||(a.send([{type:"ping",data:"probe"}]),a.once("packet",c=>{if(!t)if(c.type==="pong"&&c.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",a),!a)return;r1.priorWebsocketSuccess=a.name==="websocket",this.transport.pause(()=>{t||this.readyState!=="closed"&&(E(),this.setTransport(a),a.send([{type:"upgrade"}]),this.emitReserved("upgrade",a),a=null,this.upgrading=!1,this.flush())})}else{const D=new Error("probe error");D.transport=a.name,this.emitReserved("upgradeError",D)}}))};function r(){t||(t=!0,E(),a.close(),a=null)}const i=c=>{const D=new Error("probe error: "+c);D.transport=a.name,r(),this.emitReserved("upgradeError",D)};function o(){i("transport closed")}function s(){i("socket closed")}function l(c){a&&c.name!==a.name&&r()}const E=()=>{a.removeListener("open",n),a.removeListener("error",i),a.removeListener("close",o),this.off("close",s),this.off("upgrading",l)};a.once("open",n),a.once("error",i),a.once("close",o),this.once("close",s),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&u!=="webtransport"?this.setTimeoutFn(()=>{t||a.open()},200):a.open()}onHandshake(u){this._upgrades=this._filterUpgrades(u.upgrades),super.onHandshake(u)}_filterUpgrades(u){const a=[];for(let t=0;t<u.length;t++)~this.transports.indexOf(u[t])&&a.push(u[t]);return a}}let H_e=class extends V_e{constructor(u,a={}){const t=typeof u=="object"?u:a;(!t.transports||t.transports&&typeof t.transports[0]=="string")&&(t.transports=(t.transports||["polling","websocket","webtransport"]).map(n=>L_e[n]).filter(n=>!!n)),super(u,t)}};function G_e(e,u="",a){let t=e;a=a||typeof location<"u"&&location,e==null&&(e=a.protocol+"//"+a.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=a.protocol+e:e=a.host+e),/^(https?|wss?):\/\//.test(e)||(typeof a<"u"?e=a.protocol+"//"+e:e="https://"+e),t=n9(e)),t.port||(/^(http|ws)$/.test(t.protocol)?t.port="80":/^(http|ws)s$/.test(t.protocol)&&(t.port="443")),t.path=t.path||"/";const r=t.host.indexOf(":")!==-1?"["+t.host+"]":t.host;return t.id=t.protocol+"://"+r+":"+t.port+u,t.href=t.protocol+"://"+r+(a&&a.port===t.port?"":":"+t.port),t}const J_e=typeof ArrayBuffer=="function",W_e=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Wnu=Object.prototype.toString,U_e=typeof Blob=="function"||typeof Blob<"u"&&Wnu.call(Blob)==="[object BlobConstructor]",Z_e=typeof File=="function"||typeof File<"u"&&Wnu.call(File)==="[object FileConstructor]";function Hz(e){return J_e&&(e instanceof ArrayBuffer||W_e(e))||U_e&&e instanceof Blob||Z_e&&e instanceof File}function q6(e,u){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let a=0,t=e.length;a<t;a++)if(q6(e[a]))return!0;return!1}if(Hz(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return q6(e.toJSON(),!0);for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&q6(e[a]))return!0;return!1}function Q_e(e){const u=[],a=e.data,t=e;return t.data=i9(a,u),t.attachments=u.length,{packet:t,buffers:u}}function i9(e,u){if(!e)return e;if(Hz(e)){const a={_placeholder:!0,num:u.length};return u.push(e),a}else if(Array.isArray(e)){const a=new Array(e.length);for(let t=0;t<e.length;t++)a[t]=i9(e[t],u);return a}else if(typeof e=="object"&&!(e instanceof Date)){const a={};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=i9(e[t],u));return a}return e}function q_e(e,u){return e.data=o9(e.data,u),delete e.attachments,e}function o9(e,u){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<u.length)return u[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let a=0;a<e.length;a++)e[a]=o9(e[a],u);else if(typeof e=="object")for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(e[a]=o9(e[a],u));return e}const Y_e=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],X_e=5;var h0;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(h0||(h0={}));class uIe{constructor(u){this.replacer=u}encode(u){return(u.type===h0.EVENT||u.type===h0.ACK)&&q6(u)?this.encodeAsBinary({type:u.type===h0.EVENT?h0.BINARY_EVENT:h0.BINARY_ACK,nsp:u.nsp,data:u.data,id:u.id}):[this.encodeAsString(u)]}encodeAsString(u){let a=""+u.type;return(u.type===h0.BINARY_EVENT||u.type===h0.BINARY_ACK)&&(a+=u.attachments+"-"),u.nsp&&u.nsp!=="/"&&(a+=u.nsp+","),u.id!=null&&(a+=u.id),u.data!=null&&(a+=JSON.stringify(u.data,this.replacer)),a}encodeAsBinary(u){const a=Q_e(u),t=this.encodeAsString(a.packet),n=a.buffers;return n.unshift(t),n}}function MN(e){return Object.prototype.toString.call(e)==="[object Object]"}class Gz extends lt{constructor(u){super(),this.reviver=u}add(u){let a;if(typeof u=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");a=this.decodeString(u);const t=a.type===h0.BINARY_EVENT;t||a.type===h0.BINARY_ACK?(a.type=t?h0.EVENT:h0.ACK,this.reconstructor=new eIe(a),a.attachments===0&&super.emitReserved("decoded",a)):super.emitReserved("decoded",a)}else if(Hz(u)||u.base64)if(this.reconstructor)a=this.reconstructor.takeBinaryData(u),a&&(this.reconstructor=null,super.emitReserved("decoded",a));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+u)}decodeString(u){let a=0;const t={type:Number(u.charAt(0))};if(h0[t.type]===void 0)throw new Error("unknown packet type "+t.type);if(t.type===h0.BINARY_EVENT||t.type===h0.BINARY_ACK){const r=a+1;for(;u.charAt(++a)!=="-"&&a!=u.length;);const i=u.substring(r,a);if(i!=Number(i)||u.charAt(a)!=="-")throw new Error("Illegal attachments");t.attachments=Number(i)}if(u.charAt(a+1)==="/"){const r=a+1;for(;++a&&!(u.charAt(a)===","||a===u.length););t.nsp=u.substring(r,a)}else t.nsp="/";const n=u.charAt(a+1);if(n!==""&&Number(n)==n){const r=a+1;for(;++a;){const i=u.charAt(a);if(i==null||Number(i)!=i){--a;break}if(a===u.length)break}t.id=Number(u.substring(r,a+1))}if(u.charAt(++a)){const r=this.tryParse(u.substr(a));if(Gz.isPayloadValid(t.type,r))t.data=r;else throw new Error("invalid payload")}return t}tryParse(u){try{return JSON.parse(u,this.reviver)}catch{return!1}}static isPayloadValid(u,a){switch(u){case h0.CONNECT:return MN(a);case h0.DISCONNECT:return a===void 0;case h0.CONNECT_ERROR:return typeof a=="string"||MN(a);case h0.EVENT:case h0.BINARY_EVENT:return Array.isArray(a)&&(typeof a[0]=="number"||typeof a[0]=="string"&&Y_e.indexOf(a[0])===-1);case h0.ACK:case h0.BINARY_ACK:return Array.isArray(a)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class eIe{constructor(u){this.packet=u,this.buffers=[],this.reconPack=u}takeBinaryData(u){if(this.buffers.push(u),this.buffers.length===this.reconPack.attachments){const a=q_e(this.reconPack,this.buffers);return this.finishedReconstruction(),a}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const aIe=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Gz,Encoder:uIe,get PacketType(){return h0},protocol:X_e},Symbol.toStringTag,{value:"Module"}));function Ni(e,u,a){return e.on(u,a),function(){e.off(u,a)}}const tIe=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Unu extends lt{constructor(u,a,t){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=u,this.nsp=a,t&&t.auth&&(this.auth=t.auth),this._opts=Object.assign({},t),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const u=this.io;this.subs=[Ni(u,"open",this.onopen.bind(this)),Ni(u,"packet",this.onpacket.bind(this)),Ni(u,"error",this.onerror.bind(this)),Ni(u,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...u){return u.unshift("message"),this.emit.apply(this,u),this}emit(u,...a){var t,n,r;if(tIe.hasOwnProperty(u))throw new Error('"'+u.toString()+'" is a reserved event name');if(a.unshift(u),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(a),this;const i={type:h0.EVENT,data:a};if(i.options={},i.options.compress=this.flags.compress!==!1,typeof a[a.length-1]=="function"){const E=this.ids++,c=a.pop();this._registerAckCallback(E,c),i.id=E}const o=(n=(t=this.io.engine)===null||t===void 0?void 0:t.transport)===null||n===void 0?void 0:n.writable,s=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!o||(s?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(u,a){var t;const n=(t=this.flags.timeout)!==null&&t!==void 0?t:this._opts.ackTimeout;if(n===void 0){this.acks[u]=a;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[u];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===u&&this.sendBuffer.splice(o,1);a.call(this,new Error("operation has timed out"))},n),i=(...o)=>{this.io.clearTimeoutFn(r),a.apply(this,o)};i.withError=!0,this.acks[u]=i}emitWithAck(u,...a){return new Promise((t,n)=>{const r=(i,o)=>i?n(i):t(o);r.withError=!0,a.push(r),this.emit(u,...a)})}_addToQueue(u){let a;typeof u[u.length-1]=="function"&&(a=u.pop());const t={id:this._queueSeq++,tryCount:0,pending:!1,args:u,flags:Object.assign({fromQueue:!0},this.flags)};u.push((n,...r)=>t!==this._queue[0]?void 0:(n!==null?t.tryCount>this._opts.retries&&(this._queue.shift(),a&&a(n)):(this._queue.shift(),a&&a(null,...r)),t.pending=!1,this._drainQueue())),this._queue.push(t),this._drainQueue()}_drainQueue(u=!1){if(!this.connected||this._queue.length===0)return;const a=this._queue[0];a.pending&&!u||(a.pending=!0,a.tryCount++,this.flags=a.flags,this.emit.apply(this,a.args))}packet(u){u.nsp=this.nsp,this.io._packet(u)}onopen(){typeof this.auth=="function"?this.auth(u=>{this._sendConnectPacket(u)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(u){this.packet({type:h0.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},u):u})}onerror(u){this.connected||this.emitReserved("connect_error",u)}onclose(u,a){this.connected=!1,delete this.id,this.emitReserved("disconnect",u,a),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(u=>{if(!this.sendBuffer.some(t=>String(t.id)===u)){const t=this.acks[u];delete this.acks[u],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(u){if(u.nsp===this.nsp)switch(u.type){case h0.CONNECT:u.data&&u.data.sid?this.onconnect(u.data.sid,u.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case h0.EVENT:case h0.BINARY_EVENT:this.onevent(u);break;case h0.ACK:case h0.BINARY_ACK:this.onack(u);break;case h0.DISCONNECT:this.ondisconnect();break;case h0.CONNECT_ERROR:this.destroy();const t=new Error(u.data.message);t.data=u.data.data,this.emitReserved("connect_error",t);break}}onevent(u){const a=u.data||[];u.id!=null&&a.push(this.ack(u.id)),this.connected?this.emitEvent(a):this.receiveBuffer.push(Object.freeze(a))}emitEvent(u){if(this._anyListeners&&this._anyListeners.length){const a=this._anyListeners.slice();for(const t of a)t.apply(this,u)}super.emit.apply(this,u),this._pid&&u.length&&typeof u[u.length-1]=="string"&&(this._lastOffset=u[u.length-1])}ack(u){const a=this;let t=!1;return function(...n){t||(t=!0,a.packet({type:h0.ACK,id:u,data:n}))}}onack(u){const a=this.acks[u.id];typeof a=="function"&&(delete this.acks[u.id],a.withError&&u.data.unshift(null),a.apply(this,u.data))}onconnect(u,a){this.id=u,this.recovered=a&&this._pid===a,this._pid=a,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(u=>this.emitEvent(u)),this.receiveBuffer=[],this.sendBuffer.forEach(u=>{this.notifyOutgoingListeners(u),this.packet(u)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(u=>u()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:h0.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(u){return this.flags.compress=u,this}get volatile(){return this.flags.volatile=!0,this}timeout(u){return this.flags.timeout=u,this}onAny(u){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(u),this}prependAny(u){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(u),this}offAny(u){if(!this._anyListeners)return this;if(u){const a=this._anyListeners;for(let t=0;t<a.length;t++)if(u===a[t])return a.splice(t,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(u){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(u),this}prependAnyOutgoing(u){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(u),this}offAnyOutgoing(u){if(!this._anyOutgoingListeners)return this;if(u){const a=this._anyOutgoingListeners;for(let t=0;t<a.length;t++)if(u===a[t])return a.splice(t,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(u){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const a=this._anyOutgoingListeners.slice();for(const t of a)t.apply(this,u.data)}}}function Md(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Md.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var u=Math.random(),a=Math.floor(u*this.jitter*e);e=Math.floor(u*10)&1?e+a:e-a}return Math.min(e,this.max)|0};Md.prototype.reset=function(){this.attempts=0};Md.prototype.setMin=function(e){this.ms=e};Md.prototype.setMax=function(e){this.max=e};Md.prototype.setJitter=function(e){this.jitter=e};class s9 extends lt{constructor(u,a){var t;super(),this.nsps={},this.subs=[],u&&typeof u=="object"&&(a=u,u=void 0),a=a||{},a.path=a.path||"/socket.io",this.opts=a,$C(this,a),this.reconnection(a.reconnection!==!1),this.reconnectionAttempts(a.reconnectionAttempts||1/0),this.reconnectionDelay(a.reconnectionDelay||1e3),this.reconnectionDelayMax(a.reconnectionDelayMax||5e3),this.randomizationFactor((t=a.randomizationFactor)!==null&&t!==void 0?t:.5),this.backoff=new Md({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(a.timeout==null?2e4:a.timeout),this._readyState="closed",this.uri=u;const n=a.parser||aIe;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=a.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(u){return arguments.length?(this._reconnection=!!u,u||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(u){return u===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=u,this)}reconnectionDelay(u){var a;return u===void 0?this._reconnectionDelay:(this._reconnectionDelay=u,(a=this.backoff)===null||a===void 0||a.setMin(u),this)}randomizationFactor(u){var a;return u===void 0?this._randomizationFactor:(this._randomizationFactor=u,(a=this.backoff)===null||a===void 0||a.setJitter(u),this)}reconnectionDelayMax(u){var a;return u===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=u,(a=this.backoff)===null||a===void 0||a.setMax(u),this)}timeout(u){return arguments.length?(this._timeout=u,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(u){if(~this._readyState.indexOf("open"))return this;this.engine=new H_e(this.uri,this.opts);const a=this.engine,t=this;this._readyState="opening",this.skipReconnect=!1;const n=Ni(a,"open",function(){t.onopen(),u&&u()}),r=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),u?u(o):this.maybeReconnectOnOpen()},i=Ni(a,"error",r);if(this._timeout!==!1){const o=this._timeout,s=this.setTimeoutFn(()=>{n(),r(new Error("timeout")),a.close()},o);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}return this.subs.push(n),this.subs.push(i),this}connect(u){return this.open(u)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const u=this.engine;this.subs.push(Ni(u,"ping",this.onping.bind(this)),Ni(u,"data",this.ondata.bind(this)),Ni(u,"error",this.onerror.bind(this)),Ni(u,"close",this.onclose.bind(this)),Ni(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(u){try{this.decoder.add(u)}catch(a){this.onclose("parse error",a)}}ondecoded(u){KC(()=>{this.emitReserved("packet",u)},this.setTimeoutFn)}onerror(u){this.emitReserved("error",u)}socket(u,a){let t=this.nsps[u];return t?this._autoConnect&&!t.active&&t.connect():(t=new Unu(this,u,a),this.nsps[u]=t),t}_destroy(u){const a=Object.keys(this.nsps);for(const t of a)if(this.nsps[t].active)return;this._close()}_packet(u){const a=this.encoder.encode(u);for(let t=0;t<a.length;t++)this.engine.write(a[t],u.options)}cleanup(){this.subs.forEach(u=>u()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(u,a){var t;this.cleanup(),(t=this.engine)===null||t===void 0||t.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",u,a),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const u=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const a=this.backoff.duration();this._reconnecting=!0;const t=this.setTimeoutFn(()=>{u.skipReconnect||(this.emitReserved("reconnect_attempt",u.backoff.attempts),!u.skipReconnect&&u.open(n=>{n?(u._reconnecting=!1,u.reconnect(),this.emitReserved("reconnect_error",n)):u.onreconnect()}))},a);this.opts.autoUnref&&t.unref(),this.subs.push(()=>{this.clearTimeoutFn(t)})}}onreconnect(){const u=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",u)}}const f5={};function Y6(e,u){typeof e=="object"&&(u=e,e=void 0),u=u||{};const a=G_e(e,u.path||"/socket.io"),t=a.source,n=a.id,r=a.path,i=f5[n]&&r in f5[n].nsps,o=u.forceNew||u["force new connection"]||u.multiplex===!1||i;let s;return o?s=new s9(t,u):(f5[n]||(f5[n]=new s9(t,u)),s=f5[n]),a.query&&!u.query&&(u.query=a.queryKey),s.socket(a.path,u)}Object.assign(Y6,{Manager:s9,Socket:Unu,io:Y6,connect:Y6});var Znu=Symbol.for("immer-nothing"),TN=Symbol.for("immer-draftable"),jr=Symbol.for("immer-state");function Hi(e,...u){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var _3=Object.getPrototypeOf;function I3(e){return!!e&&!!e[jr]}function nE(e){var u;return e?Qnu(e)||Array.isArray(e)||!!e[TN]||!!((u=e.constructor)!=null&&u[TN])||HC(e)||GC(e):!1}var nIe=Object.prototype.constructor.toString();function Qnu(e){if(!e||typeof e!="object")return!1;const u=_3(e);if(u===null)return!0;const a=Object.hasOwnProperty.call(u,"constructor")&&u.constructor;return a===Object?!0:typeof a=="function"&&Function.toString.call(a)===nIe}function Rp(e,u){VC(e)===0?Reflect.ownKeys(e).forEach(a=>{u(a,e[a],e)}):e.forEach((a,t)=>u(t,a,e))}function VC(e){const u=e[jr];return u?u.type_:Array.isArray(e)?1:HC(e)?2:GC(e)?3:0}function l9(e,u){return VC(e)===2?e.has(u):Object.prototype.hasOwnProperty.call(e,u)}function qnu(e,u,a){const t=VC(e);t===2?e.set(u,a):t===3?e.add(a):e[u]=a}function rIe(e,u){return e===u?e!==0||1/e===1/u:e!==e&&u!==u}function HC(e){return e instanceof Map}function GC(e){return e instanceof Set}function l4(e){return e.copy_||e.base_}function E9(e,u){if(HC(e))return new Map(e);if(GC(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const a=Qnu(e);if(u===!0||u==="class_only"&&!a){const t=Object.getOwnPropertyDescriptors(e);delete t[jr];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const i=n[r],o=t[i];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(_3(e),t)}else{const t=_3(e);if(t!==null&&a)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function yh(e,u=!1){return JC(e)||I3(e)||!nE(e)||(VC(e)>1&&(e.set=e.add=e.clear=e.delete=iIe),Object.freeze(e),u&&Object.entries(e).forEach(([a,t])=>yh(t,!0))),e}function iIe(){Hi(2)}function JC(e){return Object.isFrozen(e)}var oIe={};function rE(e){const u=oIe[e];return u||Hi(0,e),u}var Bh;function Ynu(){return Bh}function sIe(e,u){return{drafts_:[],parent_:e,immer_:u,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function PN(e,u){u&&(rE("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=u)}function c9(e){d9(e),e.drafts_.forEach(lIe),e.drafts_=null}function d9(e){e===Bh&&(Bh=e.parent_)}function jN(e){return Bh=sIe(Bh,e)}function lIe(e){const u=e[jr];u.type_===0||u.type_===1?u.revoke_():u.revoked_=!0}function NN(e,u){u.unfinalizedDrafts_=u.drafts_.length;const a=u.drafts_[0];return e!==void 0&&e!==a?(a[jr].modified_&&(c9(u),Hi(4)),nE(e)&&(e=Lp(u,e),u.parent_||_p(u,e)),u.patches_&&rE("Patches").generateReplacementPatches_(a[jr].base_,e,u.patches_,u.inversePatches_)):e=Lp(u,a,[]),c9(u),u.patches_&&u.patchListener_(u.patches_,u.inversePatches_),e!==Znu?e:void 0}function Lp(e,u,a){if(JC(u))return u;const t=u[jr];if(!t)return Rp(u,(n,r)=>RN(e,t,u,n,r,a)),u;if(t.scope_!==e)return u;if(!t.modified_)return _p(e,t.base_,!0),t.base_;if(!t.finalized_){t.finalized_=!0,t.scope_.unfinalizedDrafts_--;const n=t.copy_;let r=n,i=!1;t.type_===3&&(r=new Set(n),n.clear(),i=!0),Rp(r,(o,s)=>RN(e,t,n,o,s,a,i)),_p(e,n,!1),a&&e.patches_&&rE("Patches").generatePatches_(t,a,e.patches_,e.inversePatches_)}return t.copy_}function RN(e,u,a,t,n,r,i){if(I3(n)){const o=r&&u&&u.type_!==3&&!l9(u.assigned_,t)?r.concat(t):void 0,s=Lp(e,n,o);if(qnu(a,t,s),I3(s))e.canAutoFreeze_=!1;else return}else i&&a.add(n);if(nE(n)&&!JC(n)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Lp(e,n),(!u||!u.scope_.parent_)&&typeof t!="symbol"&&Object.prototype.propertyIsEnumerable.call(a,t)&&_p(e,n)}}function _p(e,u,a=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&yh(u,a)}function EIe(e,u){const a=Array.isArray(e),t={type_:a?1:0,scope_:u?u.scope_:Ynu(),modified_:!1,finalized_:!1,assigned_:{},parent_:u,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=t,r=Jz;a&&(n=[t],r=Sh);const{revoke:i,proxy:o}=Proxy.revocable(n,r);return t.draft_=o,t.revoke_=i,o}var Jz={get(e,u){if(u===jr)return e;const a=l4(e);if(!l9(a,u))return cIe(e,a,u);const t=a[u];return e.finalized_||!nE(t)?t:t===Nv(e.base_,u)?(Rv(e),e.copy_[u]=h9(t,e)):t},has(e,u){return u in l4(e)},ownKeys(e){return Reflect.ownKeys(l4(e))},set(e,u,a){const t=Xnu(l4(e),u);if(t!=null&&t.set)return t.set.call(e.draft_,a),!0;if(!e.modified_){const n=Nv(l4(e),u),r=n==null?void 0:n[jr];if(r&&r.base_===a)return e.copy_[u]=a,e.assigned_[u]=!1,!0;if(rIe(a,n)&&(a!==void 0||l9(e.base_,u)))return!0;Rv(e),D9(e)}return e.copy_[u]===a&&(a!==void 0||u in e.copy_)||Number.isNaN(a)&&Number.isNaN(e.copy_[u])||(e.copy_[u]=a,e.assigned_[u]=!0),!0},deleteProperty(e,u){return Nv(e.base_,u)!==void 0||u in e.base_?(e.assigned_[u]=!1,Rv(e),D9(e)):delete e.assigned_[u],e.copy_&&delete e.copy_[u],!0},getOwnPropertyDescriptor(e,u){const a=l4(e),t=Reflect.getOwnPropertyDescriptor(a,u);return t&&{writable:!0,configurable:e.type_!==1||u!=="length",enumerable:t.enumerable,value:a[u]}},defineProperty(){Hi(11)},getPrototypeOf(e){return _3(e.base_)},setPrototypeOf(){Hi(12)}},Sh={};Rp(Jz,(e,u)=>{Sh[e]=function(){return arguments[0]=arguments[0][0],u.apply(this,arguments)}});Sh.deleteProperty=function(e,u){return Sh.set.call(this,e,u,void 0)};Sh.set=function(e,u,a){return Jz.set.call(this,e[0],u,a,e[0])};function Nv(e,u){const a=e[jr];return(a?l4(a):e)[u]}function cIe(e,u,a){var n;const t=Xnu(u,a);return t?"value"in t?t.value:(n=t.get)==null?void 0:n.call(e.draft_):void 0}function Xnu(e,u){if(!(u in e))return;let a=_3(e);for(;a;){const t=Object.getOwnPropertyDescriptor(a,u);if(t)return t;a=_3(a)}}function D9(e){e.modified_||(e.modified_=!0,e.parent_&&D9(e.parent_))}function Rv(e){e.copy_||(e.copy_=E9(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var dIe=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(u,a,t)=>{if(typeof u=="function"&&typeof a!="function"){const r=a;a=u;const i=this;return function(s=r,...l){return i.produce(s,E=>a.call(this,E,...l))}}typeof a!="function"&&Hi(6),t!==void 0&&typeof t!="function"&&Hi(7);let n;if(nE(u)){const r=jN(this),i=h9(u,void 0);let o=!0;try{n=a(i),o=!1}finally{o?c9(r):d9(r)}return PN(r,t),NN(n,r)}else if(!u||typeof u!="object"){if(n=a(u),n===void 0&&(n=u),n===Znu&&(n=void 0),this.autoFreeze_&&yh(n,!0),t){const r=[],i=[];rE("Patches").generateReplacementPatches_(u,n,r,i),t(r,i)}return n}else Hi(1,u)},this.produceWithPatches=(u,a)=>{if(typeof u=="function")return(i,...o)=>this.produceWithPatches(i,s=>u(s,...o));let t,n;return[this.produce(u,a,(i,o)=>{t=i,n=o}),t,n]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){nE(e)||Hi(8),I3(e)&&(e=A0(e));const u=jN(this),a=h9(e,void 0);return a[jr].isManual_=!0,d9(u),a}finishDraft(e,u){const a=e&&e[jr];(!a||!a.isManual_)&&Hi(9);const{scope_:t}=a;return PN(t,u),NN(void 0,t)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,u){let a;for(a=u.length-1;a>=0;a--){const n=u[a];if(n.path.length===0&&n.op==="replace"){e=n.value;break}}a>-1&&(u=u.slice(a+1));const t=rE("Patches").applyPatches_;return I3(e)?t(e,u):this.produce(e,n=>t(n,u))}};function h9(e,u){const a=HC(e)?rE("MapSet").proxyMap_(e,u):GC(e)?rE("MapSet").proxySet_(e,u):EIe(e,u);return(u?u.scope_:Ynu()).drafts_.push(a),a}function A0(e){return I3(e)||Hi(10,e),uru(e)}function uru(e){if(!nE(e)||JC(e))return e;const u=e[jr];let a;if(u){if(!u.modified_)return u.base_;u.finalized_=!0,a=E9(e,u.scope_.immer_.useStrictShallowCopy_)}else a=E9(e,!0);return Rp(a,(t,n)=>{qnu(a,t,uru(n))}),u&&(u.finalized_=!1),a}var Nr=new dIe,DIe=Nr.produce;Nr.produceWithPatches.bind(Nr);Nr.setAutoFreeze.bind(Nr);Nr.setUseStrictShallowCopy.bind(Nr);Nr.applyPatches.bind(Nr);Nr.createDraft.bind(Nr);Nr.finishDraft.bind(Nr);function m9(e){var u=C.useState(function(){return yh(typeof e=="function"?e():e,!0)}),a=u[1];return[u[0],C.useCallback(function(t){a(typeof t=="function"?DIe(t):yh(t))},[])]}const LN=1e4,hIe=5*60*1e3,mIe=10*60*1e3,eru=">>",at=(e,u)=>u?`${u}${eru}${e}`:e,E4=e=>{const u=e.split(eru);if(u.length>2)throw new Error("Only 1 level of nesting is supported");if(u.length===1)return{stepId:u[0],parentStepIdChain:[]};const[a,t]=u;return{stepId:t,parentStepIdChain:a?[a]:[]}},L4=e=>{var u;switch(e.type){case"STEP_STATE":return e.step;case"MODULE_STATE":return{...e.step,steps:(u=e.step.steps)==null?void 0:u.map(a=>L4(a))}}},Oi=(e,u,a)=>{if(u.length>1)throw new Error("Only 1 level of nesting is supported");if(u.length===0){const r=at(a);return e.steps[r]||e.modules[r]}const t=at(u[0]),n=e.modules[t];if(n)return n.step.steps.find(r=>r.step.id===a)},p5=(e,u)=>{const a=e.modules[u];a&&Object.values(e.modules).forEach(t=>{t&&t.uniqueId!==u&&t.step.moduleId===a.step.moduleId&&(t.step.name=a.step.name,t.step.description=a.step.description,t.step.parameters=a.step.parameters,t.step.steps=a.step.steps.map(n=>({uniqueId:at(t.step.id,n.step.id),type:"STEP_STATE",step:n.step,status:E0.IDLE})),ks(t))})},ks=e=>{e.status=E0.IDLE,e.message=void 0,e.data=void 0,e.attempt=void 0,e.trace=void 0,e.type==="MODULE_STATE"?e.step.steps.forEach(u=>{ks(u)}):e.aiActionEventLogs=void 0};function xIe({test:e,websocketUrl:u,testPath:a}){const[t,n]=C.useState(!1),[r,i]=C.useState(),[o,s]=C.useState(),[l,E]=C.useState(!1),[c,D]=C.useState(),[h,m]=C.useState(!1),[x,p]=C.useState(!1),[f,g]=C.useState(),[F,b]=m9({rootIds:[],steps:{},modules:{}}),[y,v]=C.useState(null),[A,B]=C.useState(),[j,R]=C.useState([]),[w,O]=C.useState(),[T,z]=C.useState(),[N,M]=m9([]),[I,P]=C.useState(void 0),[L,K]=C.useState(!1),W=C.useRef(x);W.current=x;const _=C.useRef(r);_.current=r;const Q=C.useRef(Date.now()),eu=C.useRef(0),U=y0(()=>{var fu;Q.current=Date.now(),(fu=au.current)==null||fu.emit("keepalive")}),iu=C.useRef();C.useEffect(()=>{const fu=[],Bu={},_u={};e.steps.forEach(Xu=>{const Ru=at(Xu.id);if(fu.push(Ru),Xu.type===I0.MODULE){_u[Ru]={uniqueId:Ru,type:"MODULE_STATE",step:{...Xu,steps:Xu.steps.filter(H=>H.type!==I0.MODULE).map(H=>({uniqueId:at(H.id,Xu.id),type:"STEP_STATE",step:H,status:E0.IDLE}))},status:E0.IDLE};return}Bu[Ru]={uniqueId:Ru,type:"STEP_STATE",step:Xu,status:E0.IDLE}}),b({rootIds:fu,steps:Bu,modules:_u})},[b,e.steps]);const tu=!x&&!h&&t&&l,Y=y0(()=>{n(!0),s(void 0),g(void 0),iu.current&&window.clearInterval(iu.current),iu.current=window.setInterval(()=>{var fu,Bu;if(W.current){U();return}if(_.current&&!(Q.current>Date.now()-hIe)){if(Q.current>Date.now()-mIe){eu.current<=Q.current&&(Ca.warning("You've been inactive for a while. Please interact with the editor to avoid being disconnected.",{duration:6e4}),eu.current=Date.now());return}clearInterval(iu.current),(fu=au.current)!=null&&fu.active&&!W.current&&(g("You've been disconnected due to inactivity. Please refresh the page to start a new session."),Ca.error("Disconnected due to inactivity.",{duration:3e5}),(Bu=au.current)==null||Bu.disconnect())}},6e4)}),ou=y0((fu,Bu)=>{if(clearInterval(iu.current),f){p(!1);return}if(fu==="transport close"||fu==="transport error"||fu==="ping timeout")s({type:cD.DISCONNECTED,message:"Connection lost. Attempting to reconnect..."});else{let _u="";typeof Bu=="string"?_u=Bu:Bu&&(_u=JSON.stringify(Bu)),g(`Disconnected from server: ${fu} ${_u}`.trim())}p(!1)}),Cu=y0(fu=>{s(void 0);let Bu;fu instanceof Error?Bu=fu.message:fu&&typeof fu=="object"&&"message"in fu?Bu=String(fu.message):Bu=JSON.stringify(fu),g(Bu),Ca.error(Bu)}),Au=y0(fu=>{s(void 0),v(fu.viewportBounds),E(!0),D(fu.sessionId),fu.limbarToken&&fu.limbarUrl?i({token:fu.limbarToken,rtcUrl:fu.limbarUrl,testId:fu.testId}):s({message:"Local session started. Please use the launched emulator window for control.",type:cD.INFO})}),mu=y0(fu=>{fu.type===cD.CONNECTED?s(void 0):s(fu)}),Nu=y0(({attempt:fu,parentStepIdChain:Bu,stepId:_u})=>{U(),b(Xu=>{const Ru=Oi(Xu,Bu,_u);Ru&&(Ru.status=E0.RUNNING,Ru.data=void 0,Ru.message=void 0,Ru.attempt=fu)})}),le=y0(({result:fu,parentStepIdChain:Bu,trace:_u})=>{m(!1),b(Xu=>{const Ru=Oi(Xu,Bu,fu.id);Ru&&(Ru.status=E0.SUCCESS,Ru.message=fu.message,Ru.data=fu.data,Ru.trace=_u,fu.type===Tu.PRESET&&Ru.step.type===Tu.PRESET&&(Ru.step.command=fu.command))})}),Yu=y0(({result:fu,parentStepIdChain:Bu,trace:_u})=>{m(!1),b(Xu=>{const Ru=Oi(Xu,Bu,fu.id);Ru&&(Ru.status=E0.FAILED,Ru.message=fu.message,Ru.data=fu.data,Ru.trace=_u)})}),ve=y0(({result:fu,parentStepIdChain:Bu,trace:_u})=>{m(!1),b(Xu=>{const Ru=Oi(Xu,Bu,fu.id);Ru&&(Ru.status=E0.CANCELLED,Ru.message=fu.message,Ru.data=fu.data,Ru.trace=_u)})}),Ie=y0(()=>{U(),p(!1),m(!1)}),Zu=y0(fu=>{M(Bu=>{for(const _u of fu)try{const Xu=CSu(_u);Xu&&Bu.push(Xu)}catch{}Bu.length>LN&&Bu.splice(0,Bu.length-LN)})}),Gu=y0(({context:fu})=>{z(fu)}),fe=y0(()=>{var fu;K(!0),P(void 0),(fu=au.current)==null||fu.emit("fetchA11yTree",void 0,Bu=>{P(Bu),K(!1)})}),V=y0(({rootStep:fu,...Bu})=>{const{stepId:_u,parentStepIdChain:Xu}=fu;b(Ru=>{const H=Oi(Ru,Xu,_u);H&&H.type==="STEP_STATE"&&(H.aiActionEventLogs=H.aiActionEventLogs||[],H.aiActionEventLogs.push(Bu),H.aiActionEventLogs=H.aiActionEventLogs.reduce((X,Eu)=>{const Fu=X[X.length-1];return Fu&&Fu.type===Dh.LLM_TEXT_OUTPUT&&Eu.type===Dh.LLM_TEXT_OUTPUT?(Fu.text+=Eu.text,X):(X.push(Eu),X)},[]))})}),au=C.useRef(),du=y0(()=>{const Bu={testMetadata:JSON.stringify({...e,steps:void 0}),fileName:a},_u=Y6(u,{transports:["websocket"],query:Bu,reconnection:!0,reconnectionAttempts:500,reconnectionDelay:1e3,reconnectionDelayMax:3e4,autoConnect:!0});return _u.on("connect",Y),_u.on("disconnect",ou),_u.on("connect_error",Cu),_u.on("error",Cu),_u.on("session",Au),_u.on("connectionStatusUpdate",mu),_u.on("started",Nu),_u.on("success",le),_u.on("failure",Yu),_u.on("cancelled",ve),_u.on("finished",Ie),_u.on("logcatLogs",Zu),_u.on("emulatorState",Gu),_u.on("aiActionEvent",V),_u}),bu=y0(()=>{var fu,Bu;(fu=au.current)!=null&&fu.connected&&((Bu=au.current)==null||Bu.disconnect(),iu.current&&window.clearInterval(iu.current))});C.useEffect(()=>(window.addEventListener("beforeunload",bu),()=>{window.removeEventListener("beforeunload",bu)}),[bu]),C.useEffect(()=>(au.current||(au.current=du()),bu),[bu,du]);const pu=y0(()=>{U(),au.current&&(au.current.emit("cancel"),m(!0))}),xu=y0(fu=>{if(U(),!au.current||!tu)return;const{parentStepIdChain:Bu,stepId:_u}=E4(fu);b(X=>{const Eu=Oi(X,Bu,_u);Eu&&ks(Eu)});const{steps:Xu,...Ru}=e,H=F.rootIds.map(X=>F.steps[X]||F.modules[X]).filter(J6);au.current.emit("execute",{steps:H.map(L4),testMetadata:Ru,fromStep:{fromStepId:_u,parentStepIdChain:Bu},toStep:{toStepId:_u,parentStepIdChain:Bu}}),p(!0)}),Lu=y0(fu=>{if(U(),!au.current||!tu)return;const{parentStepIdChain:Bu,stepId:_u}=E4(fu);b(X=>{const Eu=Oi(X,Bu,_u);if(!Eu)return;if(ks(Eu),Bu.length){const Pu=at(Bu[0]),me=X.modules[Pu];if(me){let pe=!1;me.step.steps.forEach(ge=>{pe&&ks(ge),ge.step.id===_u&&(pe=!0)})}}let Fu=!1;X.rootIds.forEach(Pu=>{const me=X.steps[Pu]||X.modules[Pu];me&&(Fu&&ks(me),me.step.id===_u&&(Fu=!0))})});const{steps:Xu,...Ru}=e,H=F.rootIds.map(X=>F.steps[X]||F.modules[X]).filter(J6);au.current.emit("execute",{steps:H.map(L4),testMetadata:Ru,fromStep:{fromStepId:_u,parentStepIdChain:Bu}}),p(!0)}),He=y0(()=>{if(U(),!au.current||!tu)return;b(Xu=>{Object.values(Xu.steps).forEach(Ru=>{Ru&&ks(Ru)}),Object.values(Xu.modules).forEach(Ru=>{Ru&&ks(Ru)})});const{steps:fu,...Bu}=e,_u=F.rootIds.map(Xu=>F.steps[Xu]||F.modules[Xu]).filter(J6);au.current.emit("execute",{steps:_u.map(L4),testMetadata:Bu}),p(!0)}),yu=y0(fu=>{U(),B(fu)}),Ke=y0(fu=>{U(),b(Bu=>{const{parentStepIdChain:_u,stepId:Xu}=E4(fu);if(!_u.length){const Ru=at(Xu);Bu.rootIds=Bu.rootIds.filter(H=>H!==Ru),delete Bu.steps[Ru],delete Bu.modules[Ru];return}if(_u.length===1){const Ru=at(_u[0]),H=Bu.modules[Ru];if(!H)return;H.step.steps=H.step.steps.filter(X=>X.step.id!==Xu),p5(Bu,Ru)}})}),t0=(fu,Bu,_u)=>fu.type===I0.MODULE?{uniqueId:_u,type:"MODULE_STATE",step:{id:Bu,...fu,steps:fu.steps.filter(Xu=>Xu.type!==I0.MODULE).map(Xu=>({uniqueId:at(Xu.id,Bu),type:"STEP_STATE",step:Xu,status:E0.IDLE}))},status:E0.IDLE}:fu.type===Tu.AI_ACTION?{uniqueId:_u,type:"STEP_STATE",step:{id:Bu,type:Tu.AI_ACTION,text:""},status:E0.IDLE}:{uniqueId:_u,type:"STEP_STATE",step:{id:Bu,type:Tu.PRESET,command:sq(fu.command)},status:E0.IDLE},N0=y0((fu,Bu,_u="after")=>{if(U(),!Bu){const Pu=_a(),me=at(Pu),pe=t0(fu,Pu,me);b(ge=>{ge.rootIds.push(me),pe.type==="MODULE_STATE"?ge.modules[me]=pe:ge.steps[me]=pe}),B(pe.uniqueId),R([pe.uniqueId]);return}const{parentStepIdChain:Xu,stepId:Ru}=E4(Bu),H=_a(),X=at(H,Xu[0]),Eu=t0(fu,H,X),Fu=_u==="after"?1:0;b(Pu=>{const me=Oi(Pu,Xu,Ru);if(!me)return;if(Xu.length===1){if(me.type==="MODULE_STATE"||Eu.type==="MODULE_STATE")return;const ge=at(Xu[0]),ke=Pu.modules[ge];if(!ke)return;const i0=ke.step.steps.findIndex(Xa=>Xa.step.id===Ru);if(i0===-1)return;ke.step.steps.splice(i0+Fu,0,Eu),p5(Pu,ge);return}const pe=Pu.rootIds.indexOf(Bu);pe!==-1&&(Eu.type==="MODULE_STATE"?Pu.modules[Eu.uniqueId]=Eu:Pu.steps[Eu.uniqueId]=Eu,Pu.rootIds.splice(pe+Fu,0,Eu.uniqueId))}),B(Eu.uniqueId),R([Eu.uniqueId])}),ja=y0((fu,Bu)=>{U();const{parentStepIdChain:_u,stepId:Xu}=E4(fu),Ru=at(Bu.id,_u[0]);b(H=>{const X=Oi(H,_u,Xu);if(!X)return;const Eu=X.step;if(Bu.type===I0.MODULE&&Eu.type===I0.MODULE){const{steps:Fu,...Pu}=Bu;X.type="MODULE_STATE",X.step={...Eu,...Pu}}else if(Bu.type===I0.MODULE){const{steps:Fu,...Pu}=Bu;X.type="MODULE_STATE",X.step={...Pu,steps:Fu.filter(me=>me.type!==I0.MODULE).map(me=>({uniqueId:at(me.id,Bu.id),type:"STEP_STATE",step:me,status:E0.IDLE}))}}else X.type="STEP_STATE",X.step=Bu;if(X.uniqueId=Ru,ks(X),H.rootIds=H.rootIds.map(Fu=>Fu===fu?Ru:Fu),delete H.steps[fu],delete H.modules[fu],X.type==="MODULE_STATE"?H.modules[Ru]=X:H.steps[Ru]=X,_u.length===1){const Fu=at(_u[0]);p5(H,Fu)}}),B(Ru),R([Ru])}),Xt=y0(fu=>{U();const{parentStepIdChain:Bu,stepId:_u}=E4(fu),Xu=_a(),Ru=at(Xu,Bu[0]);b(H=>{const X=Oi(H,Bu,_u);if(!X)return;if(Bu.length===1){if(X.type==="MODULE_STATE")return;const Fu=at(Bu[0]),Pu=H.modules[Fu];if(!Pu)return;const me=Pu.step.steps.findIndex(ge=>ge.step.id===_u);if(me===-1)return;const pe={uniqueId:Ru,type:"STEP_STATE",step:{...X.step,id:Xu},status:E0.IDLE};Pu.step.steps.splice(me+1,0,pe),p5(H,Fu);return}const Eu=H.rootIds.indexOf(fu);Eu!==-1&&(X.type==="MODULE_STATE"?H.modules[Ru]={uniqueId:Ru,type:"MODULE_STATE",status:E0.IDLE,step:{...X.step,id:Xu,steps:X.step.steps.map(Fu=>({type:"STEP_STATE",uniqueId:at(Fu.step.id,Xu),step:Fu.step,status:E0.IDLE}))}}:H.steps[Ru]={uniqueId:Ru,type:"STEP_STATE",step:{...X.step,id:Xu},status:E0.IDLE},H.rootIds.splice(Eu+1,0,Ru))})}),$r=y0((fu,Bu,_u)=>{U(),b(Xu=>{if(_u){const H=Xu.modules[_u];if(!H)return;const X=H.step.steps[fu];H.step.steps.splice(fu,1),H.step.steps.splice(Bu,0,X),p5(Xu,_u);return}const Ru=Xu.rootIds[fu];Xu.rootIds.splice(fu,1),Xu.rootIds.splice(Bu,0,Ru)})}),PE=y0((fu,Bu,_u)=>{U();const{shiftKey:Xu,metaKey:Ru}=Bu;if(_u){O(_u),R([fu]);return}if(Xu&&w){const H=F.rootIds.indexOf(w),X=F.rootIds.indexOf(fu);if(H===-1||X===-1)return;const[Eu,Fu]=H<X?[H,X]:[X,H],Pu=F.rootIds.slice(Eu,Fu+1);R(Pu);return}if(Xu&&!w){O(fu),R([fu]);return}O(fu),R(Ru?H=>H.includes(fu)?H.filter(X=>X!==fu):[...H,fu]:[fu])}),Dl=y0(fu=>{U(),console.log("Creating module in editor:",fu);const Bu=_a(),_u=at(Bu);b(Xu=>{let Ru=null;for(const H of j){if(!Xu.steps[H])continue;const X=Xu.rootIds.indexOf(H);X!==-1&&(Ru===null||X<Ru)&&(Ru=X)}console.log("First index for module insertion:",Ru),Ru!==null&&(j.forEach(H=>{delete Xu.steps[H],Xu.steps[H]&&(Xu.rootIds=Xu.rootIds.filter(Eu=>Eu!==H))}),Xu.modules[_u]={uniqueId:_u,type:"MODULE_STATE",step:{...fu,type:I0.MODULE,id:Bu,steps:fu.steps.filter(H=>H.type!==I0.MODULE).map(H=>({uniqueId:at(H.id,Bu),type:"STEP_STATE",step:H,status:E0.IDLE}))},status:E0.IDLE},Xu.rootIds.splice(Ru,0,_u))}),B(_u),R([_u])});return{initialized:t,limbar:r,canceling:h,executing:x,canExecute:tu,error:f,connectionStatusUpdate:o,editorState:F,logcatLogs:N,a11yTreeResponse:I,isLoadingA11yTree:L,sessionLoaded:l,sessionId:c,testContext:T,viewport:y,editingUniqueId:A,selectedUniqueIds:j,handleCancel:pu,handleRunSingleStep:xu,handleRunFromStep:Lu,handleRunAllSteps:He,handleEdit:yu,handleDelete:Ke,handleAddStep:N0,handleStepChange:ja,handleDuplicate:Xt,handleFetchA11yTree:fe,handleMove:$r,handleSelect:PE,handleCreateModuleSuccess:Dl,setLastUserEventTime:U}}const fIe=S({name:V1,description:k()}),pIe=e=>{const u=Ci(),[a,t]=C.useState(!1),n=pd({resolver:gd(fIe),defaultValues:{name:"",description:""},mode:"onChange"}),[r,i]=Ws(async l=>{var c;const E={name:l.name,description:l.description,enabled:!0,steps:e.steps,testFilePath:e.testPath};try{const D=await u("/api/mobile-modules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)});(c=e.onSuccess)==null||c.call(e,D),t(!1)}catch(D){Ca.error("Failed to create module.",{description:`${D}`})}},[e.steps,e.onSuccess]),{isDirty:o,isValid:s}=n.formState;return C.useEffect(()=>{n.reset()},[n,a]),d.jsxs(bE,{open:a,onOpenChange:t,children:[d.jsx(yE,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",disabled:e.disabled,children:[d.jsx(r8,{className:"h-4 w-4"}),"Create module"]})}),d.jsxs(_1,{children:[d.jsxs(I1,{children:[d.jsx(K1,{children:"Create module"}),d.jsx($1,{children:"Group and reuse steps across different tests."})]}),d.jsx(Cd,{...n,children:d.jsxs("form",{onSubmit:n.handleSubmit(i),className:"space-y-4",children:[d.jsx(_0,{control:n.control,name:"name",render:({field:l})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Name"}),d.jsx(T0,{children:d.jsx(SE,{placeholder:"example-module-name",...l})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:n.control,name:"description",render:({field:l})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Description"}),d.jsx(T0,{children:d.jsx(zd,{...l})}),d.jsx(P0,{})]})}),d.jsx(BE,{children:d.jsx(Ve,{type:"submit",disabled:!o||!s||r.loading,children:"Create module"})})]})})]})]})},b4={[ia.EQUALS]:"equals",[ia.CONTAINS]:"contains",[ia.STARTS_WITH]:"starts with",[ia.EXISTS]:"exists"},y4={[ia.EQUALS]:"does not equal",[ia.CONTAINS]:"does not contain",[ia.STARTS_WITH]:"does not start with",[ia.EXISTS]:"does not exist"},aru={[sn.EXISTS]:"exists",[sn.VISIBLE]:"is visible",[sn.ENABLED]:"is enabled",[sn.EDITABLE]:"is editable",[sn.FOCUSED]:"is focused"},tru={[sn.EXISTS]:"does not exist",[sn.VISIBLE]:"is not visible",[sn.ENABLED]:"is disabled",[sn.EDITABLE]:"is not editable",[sn.FOCUSED]:"is not focused"};uZ.CONTENT+"";function nru(e,u){if(e!=="0.0.1"&&e!==u[u.length-1].toVersion)throw new Error("Please bump latestSchemaVersion in types package after adding a migration");u.forEach((a,t)=>{if(!H6.valid(a.toVersion)||!H6.valid(a.fromVersion))throw new Error(`Migration '${a.name}' has invalid version`);if(!H6.gt(a.toVersion,a.fromVersion))throw new Error(`Migration '${a.name}' has toVersion <= fromVersion`);if(t===0)return;if(u[t-1].toVersion!==a.fromVersion)throw new Error(`Migration '${a.name}' at index ${t} is not contiguous with previous migration`)})}var gIe={exports:{}};/*!
|
|
557
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}U1.prototype.build=function(e){return this.options.preserveOrder?gLe(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)};U1.prototype.j2x=function(e,u,a){let t="",n="";const r=a.join(".");for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i))if(typeof e[i]>"u")this.isAttribute(i)&&(n+="");else if(e[i]===null)this.isAttribute(i)?n+="":i[0]==="?"?n+=this.indentate(u)+"<"+i+"?"+this.tagEndChar:n+=this.indentate(u)+"<"+i+"/"+this.tagEndChar;else if(e[i]instanceof Date)n+=this.buildTextValNode(e[i],i,"",u);else if(typeof e[i]!="object"){const o=this.isAttribute(i);if(o&&!this.ignoreAttributesFn(o,r))t+=this.buildAttrPairStr(o,""+e[i]);else if(!o)if(i===this.options.textNodeName){let s=this.options.tagValueProcessor(i,""+e[i]);n+=this.replaceEntitiesValue(s)}else n+=this.buildTextValNode(e[i],i,"",u)}else if(Array.isArray(e[i])){const o=e[i].length;let s="",l="";for(let E=0;E<o;E++){const c=e[i][E];if(!(typeof c>"u"))if(c===null)i[0]==="?"?n+=this.indentate(u)+"<"+i+"?"+this.tagEndChar:n+=this.indentate(u)+"<"+i+"/"+this.tagEndChar;else if(typeof c=="object")if(this.options.oneListGroup){const D=this.j2x(c,u+1,a.concat(i));s+=D.val,this.options.attributesGroupName&&c.hasOwnProperty(this.options.attributesGroupName)&&(l+=D.attrStr)}else s+=this.processTextOrObjNode(c,i,u,a);else if(this.options.oneListGroup){let D=this.options.tagValueProcessor(i,c);D=this.replaceEntitiesValue(D),s+=D}else s+=this.buildTextValNode(c,i,"",u)}this.options.oneListGroup&&(s=this.buildObjectNode(s,i,l,u)),n+=s}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const o=Object.keys(e[i]),s=o.length;for(let l=0;l<s;l++)t+=this.buildAttrPairStr(o[l],""+e[i][o[l]])}else n+=this.processTextOrObjNode(e[i],i,u,a);return{attrStr:t,val:n}};U1.prototype.buildAttrPairStr=function(e,u){return u=this.options.attributeValueProcessor(e,""+u),u=this.replaceEntitiesValue(u),this.options.suppressBooleanAttributes&&u==="true"?" "+e:" "+e+'="'+u+'"'};function kLe(e,u,a,t){const n=this.j2x(e,a+1,t.concat(u));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],u,n.attrStr,a):this.buildObjectNode(n.val,u,n.attrStr,a)}U1.prototype.buildObjectNode=function(e,u,a,t){if(e==="")return u[0]==="?"?this.indentate(t)+"<"+u+a+"?"+this.tagEndChar:this.indentate(t)+"<"+u+a+this.closeTag(u)+this.tagEndChar;{let n="</"+u+this.tagEndChar,r="";return u[0]==="?"&&(r="?",n=""),(a||a==="")&&e.indexOf("<")===-1?this.indentate(t)+"<"+u+a+r+">"+e+n:this.options.commentPropName!==!1&&u===this.options.commentPropName&&r.length===0?this.indentate(t)+`<!--${e}-->`+this.newLine:this.indentate(t)+"<"+u+a+r+this.tagEndChar+e+this.indentate(t)+n}};U1.prototype.closeTag=function(e){let u="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(u="/"):this.options.suppressEmptyNode?u="/":u=`></${e}`,u};U1.prototype.buildTextValNode=function(e,u,a,t){if(this.options.cdataPropName!==!1&&u===this.options.cdataPropName)return this.indentate(t)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&u===this.options.commentPropName)return this.indentate(t)+`<!--${e}-->`+this.newLine;if(u[0]==="?")return this.indentate(t)+"<"+u+a+"?"+this.tagEndChar;{let n=this.options.tagValueProcessor(u,e);return n=this.replaceEntitiesValue(n),n===""?this.indentate(t)+"<"+u+a+this.closeTag(u)+this.tagEndChar:this.indentate(t)+"<"+u+a+">"+n+"</"+u+this.tagEndChar}};U1.prototype.replaceEntitiesValue=function(e){if(e&&e.length>0&&this.options.processEntities)for(let u=0;u<this.options.entities.length;u++){const a=this.options.entities[u];e=e.replace(a.regex,a.val)}return e};function vLe(e){return this.options.indentBy.repeat(e)}function ALe(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}var bLe=U1;const yLe=Rz,BLe=DLe,SLe=bLe;var zLe={XMLParser:BLe,XMLValidator:yLe,XMLBuilder:SLe};function Tnu(e,u,a){const t=u??0;let n=a??0;const r=[];for(const i of e)if("#text"in i)r.push({node:i["#text"],depth:t,isText:!0,hasChildren:!1,index:n,lastChildIndex:n}),n++;else{const o=Object.entries(i[":@"]||{}).map(([m,x])=>[m,JSON.stringify(x)]),s=Object.fromEntries(o),l=new Set(Object.keys(i));l.delete(":@"),l.delete("#text");const E=Array.from(l)[0];if(!E)continue;let c=[];const D=i[E];D&&D.length>0&&(c=Tnu(D,t+1,n+1));const h=c.length;r.push({node:E,depth:t,attributes:s,isText:!1,hasChildren:h>0,index:n,lastChildIndex:n+h}),r.push(...c),n+=h+1}return r}function OLe(e){const a=new zLe.XMLParser({allowBooleanAttributes:!0,ignoreAttributes:!1,attributeNamePrefix:"",alwaysCreateTextNode:!0,preserveOrder:!0,unpairedTags:["hr","br","link","meta"],stopNodes:["*.pre","*.script"],processEntities:!0,htmlEntities:!0,parseAttributeValue:!1}).parse(e);return Tnu(a)}const Pnu=20,vN=8,wLe=10;function MLe(e){const u=e.depth*Pnu;if(e.isText)return u+e.node.length*vN;const a=[e.node.length];for(const[n,r]of Object.entries(e.attributes||{}))a.push(n.length),r&&a.push(r.length+1);const t=a.reduce((n,r)=>n+r,0);return u+t*vN}function TLe({node:e,isCollapsed:u,toggleCollapsed:a,height:t,translateY:n}){return d.jsxs("div",{className:"m-0 flex h-[20px] items-center gap-2 whitespace-nowrap p-0 text-sm",style:{position:"absolute",top:0,left:0,width:"100%",height:t,transform:`translateY(${n}px)`,paddingLeft:e.depth*Pnu},children:[e.hasChildren?d.jsx("div",{className:"cursor-pointer",onClick:a,children:u?d.jsx(rm,{className:"h-4 w-4"}):d.jsx(od,{className:"h-4 w-4"})}):null,e.isText?d.jsx("span",{children:e.node}):d.jsxs(d.Fragment,{children:[d.jsx("span",{style:{color:"hsl(var(--chart-3))"},children:e.node}),e.attributes&&Object.entries(e.attributes).map(([r,i])=>d.jsxs("span",{children:[d.jsx("span",{style:{color:"hsl(var(--chart-2))"},children:r}),i&&d.jsxs(d.Fragment,{children:["=",d.jsx("span",{style:{color:"hsl(var(--chart-1))"},children:i})]})]},r))]})]})}function PLe(e){const{dataType:u,xmlTree:a,height:t}=e,n=C.useMemo(()=>{switch(u){case"html":return OLe(a);case"a11y":return cRe(a)}},[u,a]),[r,i]=C.useState(new Set),o=C.useMemo(()=>{const c=Array.from(r).sort((m,x)=>m-x),D=[];let h=0;for(const m of c){if(m<h)continue;D.push(...n.slice(h,m+1));const x=n[m];x&&(h=x.lastChildIndex+1)}return D.push(...n.slice(h)),D},[r,n]),s=C.useMemo(()=>o.map((D,h)=>({index:h,length:MLe(D)})).sort((D,h)=>h.length-D.length).slice(0,wLe).map(D=>D.index),[o]),l=C.useRef(null),E=Anu({count:o.length,getScrollElement:()=>l.current,estimateSize:()=>20,rangeExtractor:c=>{const D=knu(c);return Array.from(new Set([...D,...s]))}});return d.jsx("div",{ref:l,style:{height:t,overflow:"auto"},children:d.jsx("div",{style:{height:`${E.getTotalSize()}px`,width:"100%",position:"relative"},children:E.getVirtualItems().map(c=>{const D=o[c.index];return d.jsx(TLe,{node:D,height:c.size,translateY:c.start,isCollapsed:r.has(c.index),toggleCollapsed:()=>{if(D.hasChildren){const h=new Set(r);r.has(D.index)?h.delete(D.index):h.add(D.index),i(h)}}},c.key)})})})}function jLe({dataType:e,xml:u}){return d.jsx(Fnu,{disableWidth:!0,children:({height:a})=>d.jsx(PLe,{dataType:e,xmlTree:u,height:a})})}var NLe="Expected a function",AN=NaN,RLe="[object Symbol]",LLe=/^\s+|\s+$/g,_Le=/^[-+]0x[0-9a-f]+$/i,ILe=/^0b[01]+$/i,KLe=/^0o[0-7]+$/i,$Le=parseInt,VLe=typeof Ga=="object"&&Ga&&Ga.Object===Object&&Ga,HLe=typeof self=="object"&&self&&self.Object===Object&&self,GLe=VLe||HLe||Function("return this")(),JLe=Object.prototype,WLe=JLe.toString,ULe=Math.max,ZLe=Math.min,Mv=function(){return GLe.Date.now()};function QLe(e,u,a){var t,n,r,i,o,s,l=0,E=!1,c=!1,D=!0;if(typeof e!="function")throw new TypeError(NLe);u=bN(u)||0,a9(a)&&(E=!!a.leading,c="maxWait"in a,r=c?ULe(bN(a.maxWait)||0,u):r,D="trailing"in a?!!a.trailing:D);function h(v){var A=t,B=n;return t=n=void 0,l=v,i=e.apply(B,A),i}function m(v){return l=v,o=setTimeout(f,u),E?h(v):i}function x(v){var A=v-s,B=v-l,j=u-A;return c?ZLe(j,r-B):j}function p(v){var A=v-s,B=v-l;return s===void 0||A>=u||A<0||c&&B>=r}function f(){var v=Mv();if(p(v))return g(v);o=setTimeout(f,x(v))}function g(v){return o=void 0,D&&t?h(v):(t=n=void 0,i)}function F(){o!==void 0&&clearTimeout(o),l=0,t=s=n=o=void 0}function b(){return o===void 0?i:g(Mv())}function y(){var v=Mv(),A=p(v);if(t=arguments,n=this,s=v,A){if(o===void 0)return m(s);if(c)return o=setTimeout(f,u),h(s)}return o===void 0&&(o=setTimeout(f,u)),i}return y.cancel=F,y.flush=b,y}function a9(e){var u=typeof e;return!!e&&(u=="object"||u=="function")}function qLe(e){return!!e&&typeof e=="object"}function YLe(e){return typeof e=="symbol"||qLe(e)&&WLe.call(e)==RLe}function bN(e){if(typeof e=="number")return e;if(YLe(e))return AN;if(a9(e)){var u=typeof e.valueOf=="function"?e.valueOf():e;e=a9(u)?u+"":u}if(typeof e!="string")return e===0?e:+e;e=e.replace(LLe,"");var a=ILe.test(e);return a||KLe.test(e)?$Le(e.slice(2),a?2:8):_Le.test(e)?AN:+e}var XLe=QLe;const yN=al(XLe);function u_e(e){const u=C.useRef(e);u.current=e,C.useEffect(()=>()=>{u.current()},[])}function e_e(e,u=500,a){const t=C.useRef();u_e(()=>{t.current&&t.current.cancel()});const n=C.useMemo(()=>{const r=yN(e,u,a),i=(...o)=>r(...o);return i.cancel=()=>{r.cancel()},i.isPending=()=>!!t.current,i.flush=()=>r.flush(),i},[e,u,a]);return C.useEffect(()=>{t.current=yN(e,u,a)},[e,u,a]),n}function a_e(e,u,a){const t=(a==null?void 0:a.equalityFn)??((l,E)=>l===E),n=e instanceof Function?e():e,[r,i]=C.useState(n),o=C.useRef(n),s=e_e(i,u,a);return t(o.current,n)||(s(n),o.current=n),[r,s]}function t_e(e){return S({name:V1,description:k().min(1),retries:uu().int().min(0).optional(),channel:k().optional(),tag:k().optional(),autoGrantPermissions:cu().optional(),disableMomenticAccessibilityTree:cu().optional(),region:KS.or(J(Ba)).optional(),remoteEmulatorSettings:S({androidVersion:Ku(_l).optional()}).optional(),defaultApkFilePath:k().trim().optional(),localEmulatorSettings:S({avdId:k().trim().optional()}).optional(),latitude:z3(u=>{if(u===""||u===void 0||u===null)return null;const a=Number(u);return isNaN(a)?null:a},uu().refine(u=>u>=-90&&u<=90,{message:"Latitude must be between -90 and 90 degrees"}).nullable()),longitude:z3(u=>{if(u===""||u===void 0||u===null)return null;const a=Number(u);return isNaN(a)?null:a},uu().refine(u=>u>=-180&&u<=180,{message:"Longitude must be between -180 and 180 degrees"}).nullable()),useMemory:tr(["inherit","enabled","disabled"])}).superRefine((u,a)=>{var r;if(u.latitude!==null&&u.longitude===null&&a.addIssue({code:gu.custom,message:"Longitude is required when latitude is provided.",path:["longitude"]}),u.longitude!==null&&u.latitude===null&&a.addIssue({code:gu.custom,message:"Latitude is required when longitude is provided.",path:["latitude"]}),!(u.region===Bt.LOCAL))return;const n=((r=u.localEmulatorSettings)==null?void 0:r.avdId)??"";if(n.includes(" ")){a.addIssue({code:gu.custom,message:"The AVD ID should not contain spaces.",path:["localEmulatorSettings","avdId"]});return}!n&&!e&&a.addIssue({code:gu.custom,message:`Set a Local AVD ID here, or choose an environment with a valid ${P3} key.`,path:["localEmulatorSettings","avdId"]})})}function n_e(e){var F,b,y,v,A,B,j,R,w,O,T,z,N,M,I,P,L,K,W,_,Q,eu,U,iu,tu;const u=Ci(),{data:a}=Pm(e.testPath),{data:t=[]}=fC(),n=(F=a==null?void 0:a.settings)==null?void 0:F.defaultEnv,r=C.useMemo(()=>{if(n)return t.find(Y=>Y.name===n)},[t,n]),{envLocalAvdId:i}=o0u(r),o=C.useMemo(()=>t_e(i),[i]),s=pd({mode:"onChange",resolver:gd(o),defaultValues:{name:(a==null?void 0:a.name)??"",description:a==null?void 0:a.description,retries:(b=a==null?void 0:a.settings)==null?void 0:b.retries,channel:((y=a==null?void 0:a.settings)==null?void 0:y.defaultChannel)??"",tag:((v=a==null?void 0:a.settings)==null?void 0:v.defaultTag)??"",defaultApkFilePath:((A=a==null?void 0:a.settings)==null?void 0:A.defaultApkFilePath)??"",autoGrantPermissions:(j=(B=a==null?void 0:a.settings)==null?void 0:B.emulator)==null?void 0:j.autoGrantPermissions,disableMomenticAccessibilityTree:(w=(R=a==null?void 0:a.settings)==null?void 0:R.emulator)==null?void 0:w.disableMomenticAccessibilityTree,region:(T=(O=a==null?void 0:a.settings)==null?void 0:O.emulator)==null?void 0:T.region,localEmulatorSettings:((N=(z=a==null?void 0:a.settings)==null?void 0:z.emulator)==null?void 0:N.region)===Bt.LOCAL?((I=(M=a==null?void 0:a.settings)==null?void 0:M.emulator)==null?void 0:I.localEmulatorSettings)??{avdId:""}:void 0,remoteEmulatorSettings:((L=(P=a==null?void 0:a.settings)==null?void 0:P.emulator)==null?void 0:L.region)!==Bt.LOCAL?((W=(K=a==null?void 0:a.settings)==null?void 0:K.emulator)==null?void 0:W.remoteEmulatorSettings)??{androidVersion:_l.ANDROID_14}:void 0,latitude:((eu=(Q=(_=a==null?void 0:a.settings)==null?void 0:_.emulator)==null?void 0:Q.geolocation)==null?void 0:eu.latitude)??null,longitude:((tu=(iu=(U=a==null?void 0:a.settings)==null?void 0:U.emulator)==null?void 0:iu.geolocation)==null?void 0:tu.longitude)??null,useMemory:BN(a)}}),l=s.watch("channel"),E=s.watch("region"),c=E===Bt.LOCAL,{data:D}=ns("/api/assets",u),h=C.useMemo(()=>{const Y=new Set;for(const ou of(D==null?void 0:D.assets)||[])Y.add(ou.channel);return Array.from(Y).sort()},[D]),m=C.useMemo(()=>{const Y=l&&l!==Ba?l:void 0;if(!Y)return[];const ou=new Set;for(const Cu of(D==null?void 0:D.assets)||[])Cu.channel===Y&&ou.add(Cu.tag);return Array.from(ou).sort()},[D,l]),[x,p]=Ws(async Y=>{var le,Yu,ve,Ie,Zu,Gu;const ou=Y.region===Bt.LOCAL,Cu=(le=Y.defaultApkFilePath)==null?void 0:le.trim(),Au=Y.autoGrantPermissions,mu={retries:Y.retries,defaultChannel:Y.channel===Ba?void 0:Y.channel||void 0,defaultTag:Y.tag===Ba?void 0:Y.tag||void 0,defaultApkFilePath:Cu||void 0,emulator:{autoGrantPermissions:Au||void 0,disableMomenticAccessibilityTree:Y.disableMomenticAccessibilityTree||void 0,region:Y.region===Ba?void 0:Y.region||void 0,remoteEmulatorSettings:Y.region===Bt.LOCAL?void 0:{androidVersion:(Yu=Y.remoteEmulatorSettings)==null?void 0:Yu.androidVersion},geolocation:Y.latitude!==null&&Y.longitude!==null?{latitude:Y.latitude,longitude:Y.longitude}:void 0},ai:{useMemory:r_e(Y.useMemory)}};if(Object.values(mu.ai??{}).every(fe=>fe===void 0)&&(mu.ai=void 0),((Ie=(ve=mu.emulator)==null?void 0:ve.remoteEmulatorSettings)==null?void 0:Ie.androidVersion)===_8u&&(mu.emulator.remoteEmulatorSettings.androidVersion=void 0),mu.emulator&&Object.values(((Zu=mu.emulator)==null?void 0:Zu.remoteEmulatorSettings)??{}).every(fe=>fe===void 0)&&(mu.emulator.remoteEmulatorSettings=void 0),ou&&Y.localEmulatorSettings){const fe=(Gu=Y.localEmulatorSettings.avdId)==null?void 0:Gu.trim();fe&&(mu.emulator=mu.emulator??{},mu.emulator.localEmulatorSettings={avdId:fe})}Object.values(mu.emulator??{}).every(fe=>fe===void 0)&&(mu.emulator=void 0);const Nu={name:Y.name??(a==null?void 0:a.name),description:Y.description??(a==null?void 0:a.description)??"",settings:{...a==null?void 0:a.settings,...mu}};try{const fe=await u(`/api/mobile-tests/${encodeURIComponent(e.testPath)}/metadata`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(Nu)}),V=PBe.parse(fe);await FC(),e.onSuccess(),V.newRelativeTestPath&&window.location.replace(`/tests/${V.newRelativeTestPath}`)}catch(fe){Ca.error("Failed to save test.",{description:`${fe}`})}},[i,u,e.testPath,e.onSuccess,n]),{isDirty:f,isValid:g}=s.formState;return C.useEffect(()=>{var Y,ou,Cu,Au,mu,Nu,le,Yu,ve,Ie,Zu,Gu,fe,V,au,du,bu,pu,xu,Ru,He,yu,Ke,t0,N0,ja,Xt;x.loading||s.reset({name:(a==null?void 0:a.name)??"",description:a==null?void 0:a.description,retries:(Y=a==null?void 0:a.settings)==null?void 0:Y.retries,channel:((ou=a==null?void 0:a.settings)==null?void 0:ou.defaultChannel)||"",tag:((Cu=a==null?void 0:a.settings)==null?void 0:Cu.defaultTag)||"",autoGrantPermissions:(mu=(Au=a==null?void 0:a.settings)==null?void 0:Au.emulator)==null?void 0:mu.autoGrantPermissions,disableMomenticAccessibilityTree:(le=(Nu=a==null?void 0:a.settings)==null?void 0:Nu.emulator)==null?void 0:le.disableMomenticAccessibilityTree,region:(ve=(Yu=a==null?void 0:a.settings)==null?void 0:Yu.emulator)==null?void 0:ve.region,localEmulatorSettings:((Zu=(Ie=a==null?void 0:a.settings)==null?void 0:Ie.emulator)==null?void 0:Zu.region)===Bt.LOCAL?((fe=(Gu=a==null?void 0:a.settings)==null?void 0:Gu.emulator)==null?void 0:fe.localEmulatorSettings)??{avdId:""}:void 0,remoteEmulatorSettings:((au=(V=a==null?void 0:a.settings)==null?void 0:V.emulator)==null?void 0:au.region)!==Bt.LOCAL?((bu=(du=a==null?void 0:a.settings)==null?void 0:du.emulator)==null?void 0:bu.remoteEmulatorSettings)??{androidVersion:((Ru=(xu=(pu=a==null?void 0:a.settings)==null?void 0:pu.emulator)==null?void 0:xu.remoteEmulatorSettings)==null?void 0:Ru.androidVersion)??_l.ANDROID_14}:void 0,defaultApkFilePath:((He=a==null?void 0:a.settings)==null?void 0:He.defaultApkFilePath)??"",latitude:(t0=(Ke=(yu=a==null?void 0:a.settings)==null?void 0:yu.emulator)==null?void 0:Ke.geolocation)==null?void 0:t0.latitude,longitude:(Xt=(ja=(N0=a==null?void 0:a.settings)==null?void 0:N0.emulator)==null?void 0:ja.geolocation)==null?void 0:Xt.longitude,useMemory:BN(a)})},[s,a,x.loading]),d.jsxs(bE,{children:[d.jsx(yE,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",children:[d.jsx(_7,{className:"h-4 w-4"}),"Options"]})}),d.jsxs(_1,{children:[d.jsxs(I1,{children:[d.jsx(K1,{children:"Test options"}),d.jsx($1,{children:"Once you save these settings, the editor session will reload."})]}),d.jsx(Cd,{...s,children:d.jsxs("form",{onSubmit:s.handleSubmit(p),className:"space-y-4",children:[d.jsxs(Tm,{defaultValue:"general",children:[d.jsxs(Od,{children:[d.jsx(On,{value:"general",children:"General"}),d.jsx(On,{value:"emulator",children:"Emulator"}),d.jsx(On,{value:"ai",className:"space-x-2",children:"AI"})]}),d.jsxs(wn,{value:"general",className:"space-y-4",children:[d.jsx(_0,{control:s.control,name:"name",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Name"}),d.jsx(T0,{children:d.jsx(SE,{placeholder:"example-test-name",value:Y.value??"",onChange:ou=>Y.onChange(ou)})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:s.control,name:"description",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Description"}),d.jsx(T0,{children:d.jsx(zd,{placeholder:"Test description",rows:4,...Y,value:Y.value||""})}),d.jsx(P0,{})]})}),!c&&d.jsxs(d.Fragment,{children:[d.jsx(_0,{control:s.control,name:"channel",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Channel"}),d.jsx(T0,{children:d.jsxs(Ka,{onValueChange:ou=>{Y.onChange(ou),s.setValue("tag",Ba,{shouldDirty:!0})},value:Y.value,children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select channel..."})}),d.jsxs(wa,{children:[h.map(ou=>d.jsx(Re,{value:ou,children:ou},ou)),d.jsx(Re,{value:Ba,children:"None"})]})]})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:s.control,name:"tag",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Tag"}),d.jsx(T0,{children:d.jsxs(Ka,{onValueChange:Y.onChange,value:Y.value,children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select tag..."})}),d.jsxs(wa,{children:[m.map(ou=>d.jsx(Re,{value:ou,children:ou},ou)),d.jsx(Re,{value:Ba,children:"Latest available"})]})]})}),d.jsx(P0,{})]})})]}),d.jsx(_0,{control:s.control,name:"retries",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:"Number of retries allowed when running this test non-interactively. If unset, defaults to 1.",children:"Retries"}),d.jsx(T0,{children:d.jsx(gt,{type:"number",min:0,step:1,max:5,value:Y.value??"",onChange:ou=>{const Cu=ou.target.value;Y.onChange(Cu===""?void 0:Number(Cu))},onBlur:Y.onBlur,name:Y.name,ref:Y.ref})}),d.jsx(P0,{})]})})]}),d.jsxs(wn,{value:"emulator",className:"space-y-4",children:[d.jsx(_0,{control:s.control,name:"autoGrantPermissions",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Auto grant permissions"}),d.jsx(T0,{children:d.jsx("div",{children:d.jsx(Ch,{checked:!!Y.value,onCheckedChange:ou=>Y.onChange(ou)})})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:s.control,name:"disableMomenticAccessibilityTree",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:"Use Android's native implementation for computing the accessibility tree in webviews instead of Momentic's custom implementation. This degrades AI performance but may improve latency.",children:"Use native tree for webviews"}),d.jsx(T0,{children:d.jsx("div",{children:d.jsx(Ch,{checked:!!Y.value,onCheckedChange:ou=>Y.onChange(ou)})})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:s.control,name:"region",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Region"}),d.jsx(T0,{children:d.jsxs(Ka,{value:Y.value??Ba,onValueChange:ou=>{Y.onChange(ou),ou!==Bt.LOCAL?(s.setValue("defaultApkFilePath","",{shouldDirty:!0}),s.setValue("remoteEmulatorSettings.androidVersion",void 0,{shouldDirty:!0})):(s.setValue("channel","",{shouldDirty:!0}),s.setValue("tag","",{shouldDirty:!0}),s.setValue("localEmulatorSettings.avdId","",{shouldDirty:!0,shouldValidate:!0}))},children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select region..."})}),d.jsxs(wa,{children:[r0u.map(ou=>d.jsx(Re,{value:ou,children:i0u[ou]??ou},ou)),d.jsx(Re,{value:Ba,children:"Closest Region"})]})]})}),d.jsxs(op,{children:["Choose whether tests execute using remote or local emulators."," ",d.jsx(xh,{slug:"/mobile-cli/emulators#choosing-a-platform"})]}),d.jsx(P0,{})]})}),E===Bt.LOCAL?d.jsxs(d.Fragment,{children:[d.jsx(_0,{control:s.control,name:"localEmulatorSettings.avdId",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:`The ID of the AVD to use for the local emulator. If unset, Momentic will use ${P3} from the selected environment (if any).`,children:"Local AVD ID"}),d.jsx(T0,{children:d.jsx(gt,{value:Y.value,onChange:ou=>Y.onChange(ou.target.value),onBlur:Y.onBlur,name:Y.name,ref:Y.ref,placeholder:"Pixel_9_API_35"})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:s.control,name:"defaultApkFilePath",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:`Local path to the APK that should be installed when using a local emulator. If unset, Momentic will use ${Eh} from the selected environment (if any).`,children:"Local APK file path"}),d.jsx(T0,{children:d.jsx(gt,{value:Y.value,onChange:ou=>Y.onChange(ou.target.value),onBlur:Y.onBlur,name:Y.name,ref:Y.ref,placeholder:"/Users/me/app/build/app.apk"})}),d.jsx(P0,{})]})})]}):d.jsx(_0,{control:s.control,name:"remoteEmulatorSettings.androidVersion",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Android Version"}),d.jsx(T0,{children:d.jsxs(Ka,{value:Y.value??_l.ANDROID_14,onValueChange:ou=>{Y.onChange(ou)},children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select OS version..."})}),d.jsx(wa,{children:Object.values(_l).map(ou=>d.jsx(Re,{value:ou,children:I8u[ou]},ou))})]})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:s.control,name:"latitude",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:"Latitude between -90 and 90.",children:"Latitude"}),d.jsx(T0,{children:d.jsx(gt,{...Y,type:"number",value:Y.value||"",onChange:ou=>{isNaN(ou.target.valueAsNumber)?Y.onChange(null):Y.onChange(ou.target.valueAsNumber)},placeholder:wP.latitude.toString()})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:s.control,name:"longitude",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:"Longitude between -180 and 180.",children:"Longitude"}),d.jsx(T0,{children:d.jsx(gt,{...Y,type:"number",value:Y.value||"",onChange:ou=>{isNaN(ou.target.valueAsNumber)?Y.onChange(null):Y.onChange(ou.target.valueAsNumber)},placeholder:wP.longitude.toString()})}),d.jsx(P0,{})]})})]}),d.jsx(wn,{value:"ai",className:"space-y-4",children:d.jsx(_0,{control:s.control,name:"useMemory",render:({field:Y})=>d.jsxs(M0,{children:[d.jsx(bo,{tooltip:"Allow Momentic to store and reuse past AI results to ensure consistency over time.",children:"Memory"}),d.jsx(T0,{children:d.jsxs(Ka,{value:Y.value,onValueChange:ou=>{Y.onChange(ou)},children:[d.jsx(Oa,{className:"space-x-2",children:d.jsx($a,{placeholder:"Select option..."})}),d.jsxs(wa,{children:[d.jsx(Re,{value:"enabled",children:"Enabled"}),d.jsx(Re,{value:"disabled",children:"Disabled"}),d.jsx(Re,{value:"inherit",children:"Inherit organization setting"})]})]})}),d.jsx(P0,{})]})})})]}),d.jsx(BE,{children:d.jsx(Ve,{type:"submit",disabled:x.loading||!f||!g,children:"Save test options"})})]})})]})]})}function BN(e){var u,a,t,n;return((a=(u=e==null?void 0:e.settings)==null?void 0:u.ai)==null?void 0:a.useMemory)===void 0?"inherit":((n=(t=e==null?void 0:e.settings)==null?void 0:t.ai)==null?void 0:n.useMemory)===!0?"enabled":"disabled"}function r_e(e){if(e!=="inherit")return e==="enabled"}const i_e=e=>{const u=e.value||P5;return d.jsxs(Ka,{value:u,onValueChange:a=>{if(a===P5){e.onChange(void 0);return}e.onChange(a)},children:[d.jsxs(Oa,{className:"space-x-2",children:[d.jsx("span",{className:"text-muted-foreground",children:"Default environment:"}),d.jsx($a,{placeholder:"Select environment"})]}),d.jsxs(wa,{children:[d.jsx(Re,{value:P5,children:P5}),e.options.map(a=>d.jsx(Re,{value:a.name,children:a.name},a.name))]})]})},jnu="http://localhost:58890",o_e=aku(jnu);function s_e(e,u){const a=URL.createObjectURL(u),t=document.createElement("a");t.href=a,t.download=e,document.body.appendChild(t),t.click(),document.body.removeChild(t),URL.revokeObjectURL(a)}const l_e=[Tu.AI_ACTION,...Object.values(G)],Iz=({open:e,children:u,modules:a,onOpenChange:t,onSelect:n})=>{const[r,i]=C.useState(""),o=C.useMemo(()=>l_e.map(g=>({type:"STEP",name:vb[g],description:NSu[g],onSelect:()=>{if(g===Tu.AI_ACTION){n==null||n({type:Tu.AI_ACTION});return}n==null||n({type:Tu.PRESET,command:g})}})),[n]),s=C.useMemo(()=>a.map(g=>({type:"MODULE",name:g.name,description:g.description,onSelect:()=>{n==null||n({...g,type:I0.MODULE})}})),[a,n]),l=C.useMemo(()=>new J1([...s,...o],{keys:[{name:"name",weight:1},{name:"description",weight:.8}],threshold:.4,includeScore:!0,findAllMatches:!0,ignoreLocation:!0,useExtendedSearch:!0,shouldSort:!0,includeMatches:!0,distance:100,ignoreFieldNorm:!1}),[s,o]),E=C.useMemo(()=>{const g=r.trim().replace(/-/g," ");if(!g)return[...o,...s];const F=g.toLowerCase().split(/\s+/);return F.push(g),l.search({$and:F.map(y=>({$or:[{name:y},{description:y},{containingFolderPath:y}]}))}).map(y=>y.item)},[l,s,r,o]),c=C.useMemo(()=>E.filter(g=>g.type==="STEP"),[E]),D=C.useMemo(()=>E.filter(g=>g.type==="MODULE"),[E]),h=C.useRef(null),m=C.useRef(null),x=C.useRef(null),p=C.useRef(null),f=()=>{window.setTimeout(()=>{var g,F,b;(g=m.current)==null||g.scrollTo({top:0,behavior:"instant"}),(F=x.current)==null||F.scrollTo({top:0,behavior:"instant"}),(b=p.current)==null||b.scrollTo({top:0,behavior:"instant"})},0)};return C.useEffect(()=>{e||i("")},[e]),d.jsxs(kSe,{open:e,onOpenChange:t,modal:!1,trigger:u,commandProps:{shouldFilter:!1},dialogContentProps:{className:"max-w-2xl translate-y-0 top-[20%] data-[state=closed]:!slide-out-to-top-[0%] data-[state=open]:!slide-in-from-top-[0%]",onFocusOutside(g){g.preventDefault()}},children:[d.jsx(gC,{ref:h,autoFocus:!0,placeholder:"Search by describing what you want to do...",value:r,onValueChange:g=>{i(g),f()}}),d.jsxs(Tm,{defaultValue:"steps",onValueChange:()=>{window.setTimeout(()=>{var g;(g=h.current)==null||g.focus()},0),f()},children:[d.jsxs(Od,{className:"m-2",children:[d.jsx(On,{value:"all",children:"All"}),d.jsx(On,{value:"steps",children:"Steps"}),d.jsx(On,{value:"modules",children:"Modules"})]}),d.jsx(wn,{value:"all",className:"border-border mt-0 border-t",children:d.jsxs(j4,{className:"max-h-[500px]",ref:m,children:[E.length?null:d.jsx(t1,{children:"No items found."}),E.length?E.map(g=>d.jsx(Ps,{onSelect:g.onSelect,children:d.jsxs("div",{children:[d.jsx("div",{className:"text-base font-medium",children:g.name}),d.jsx("div",{className:"text-muted-foreground text-sm",children:g.description})]})},g.name)):null]})}),d.jsx(wn,{value:"steps",className:"border-border mt-0 border-t",children:d.jsxs(j4,{className:"max-h-[500px]",ref:x,children:[c.length?null:d.jsx(t1,{children:"No steps found."}),c.length?c.map(g=>d.jsx(Ps,{onSelect:g.onSelect,children:d.jsxs("div",{children:[d.jsx("div",{className:"text-base font-medium",children:g.name}),d.jsx("div",{className:"text-muted-foreground text-sm",children:g.description})]})},g.name)):null]})}),d.jsx(wn,{value:"modules",className:"border-border mt-0 border-t",children:d.jsxs(j4,{className:"max-h-[500px]",ref:p,children:[D.length?null:d.jsx(t1,{children:"No modules found."}),D.length?D.map(g=>d.jsx(Ps,{onSelect:g.onSelect,children:d.jsxs("div",{children:[d.jsx("div",{className:"text-base font-medium",children:g.name}),d.jsx("div",{className:"text-muted-foreground text-sm",children:g.description})]})},g.name)):null]})})]})]})},E_e=e=>{const[u,a]=C.useState(!1);return d.jsx(Iz,{open:u,modules:e.modules,onOpenChange:a,onSelect:t=>{var n;(n=e.onAdd)==null||n.call(e,t),a(!1)},children:d.jsxs(Ve,{variant:"outline",children:[d.jsx(im,{className:"h-4 w-4"})," Add new step"]})})},es=Object.create(null);es.open="0";es.close="1";es.ping="2";es.pong="3";es.message="4";es.upgrade="5";es.noop="6";const U6=Object.create(null);Object.keys(es).forEach(e=>{U6[es[e]]=e});const t9={type:"error",data:"parser error"},Nnu=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Rnu=typeof ArrayBuffer=="function",Lnu=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Kz=({type:e,data:u},a,t)=>Nnu&&u instanceof Blob?a?t(u):SN(u,t):Rnu&&(u instanceof ArrayBuffer||Lnu(u))?a?t(u):SN(new Blob([u]),t):t(es[e]+(u||"")),SN=(e,u)=>{const a=new FileReader;return a.onload=function(){const t=a.result.split(",")[1];u("b"+(t||""))},a.readAsDataURL(e)};function zN(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Tv;function c_e(e,u){if(Nnu&&e.data instanceof Blob)return e.data.arrayBuffer().then(zN).then(u);if(Rnu&&(e.data instanceof ArrayBuffer||Lnu(e.data)))return u(zN(e.data));Kz(e,!1,a=>{Tv||(Tv=new TextEncoder),u(Tv.encode(a))})}const ON="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",L5=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<ON.length;e++)L5[ON.charCodeAt(e)]=e;const d_e=e=>{let u=e.length*.75,a=e.length,t,n=0,r,i,o,s;e[e.length-1]==="="&&(u--,e[e.length-2]==="="&&u--);const l=new ArrayBuffer(u),E=new Uint8Array(l);for(t=0;t<a;t+=4)r=L5[e.charCodeAt(t)],i=L5[e.charCodeAt(t+1)],o=L5[e.charCodeAt(t+2)],s=L5[e.charCodeAt(t+3)],E[n++]=r<<2|i>>4,E[n++]=(i&15)<<4|o>>2,E[n++]=(o&3)<<6|s&63;return l},D_e=typeof ArrayBuffer=="function",$z=(e,u)=>{if(typeof e!="string")return{type:"message",data:_nu(e,u)};const a=e.charAt(0);return a==="b"?{type:"message",data:h_e(e.substring(1),u)}:U6[a]?e.length>1?{type:U6[a],data:e.substring(1)}:{type:U6[a]}:t9},h_e=(e,u)=>{if(D_e){const a=d_e(e);return _nu(a,u)}else return{base64:!0,data:e}},_nu=(e,u)=>{switch(u){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Inu="",m_e=(e,u)=>{const a=e.length,t=new Array(a);let n=0;e.forEach((r,i)=>{Kz(r,!1,o=>{t[i]=o,++n===a&&u(t.join(Inu))})})},x_e=(e,u)=>{const a=e.split(Inu),t=[];for(let n=0;n<a.length;n++){const r=$z(a[n],u);if(t.push(r),r.type==="error")break}return t};function f_e(){return new TransformStream({transform(e,u){c_e(e,a=>{const t=a.length;let n;if(t<126)n=new Uint8Array(1),new DataView(n.buffer).setUint8(0,t);else if(t<65536){n=new Uint8Array(3);const r=new DataView(n.buffer);r.setUint8(0,126),r.setUint16(1,t)}else{n=new Uint8Array(9);const r=new DataView(n.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(t))}e.data&&typeof e.data!="string"&&(n[0]|=128),u.enqueue(n),u.enqueue(a)})}})}let Pv;function Gx(e){return e.reduce((u,a)=>u+a.length,0)}function Jx(e,u){if(e[0].length===u)return e.shift();const a=new Uint8Array(u);let t=0;for(let n=0;n<u;n++)a[n]=e[0][t++],t===e[0].length&&(e.shift(),t=0);return e.length&&t<e[0].length&&(e[0]=e[0].slice(t)),a}function p_e(e,u){Pv||(Pv=new TextDecoder);const a=[];let t=0,n=-1,r=!1;return new TransformStream({transform(i,o){for(a.push(i);;){if(t===0){if(Gx(a)<1)break;const s=Jx(a,1);r=(s[0]&128)===128,n=s[0]&127,n<126?t=3:n===126?t=1:t=2}else if(t===1){if(Gx(a)<2)break;const s=Jx(a,2);n=new DataView(s.buffer,s.byteOffset,s.length).getUint16(0),t=3}else if(t===2){if(Gx(a)<8)break;const s=Jx(a,8),l=new DataView(s.buffer,s.byteOffset,s.length),E=l.getUint32(0);if(E>Math.pow(2,21)-1){o.enqueue(t9);break}n=E*Math.pow(2,32)+l.getUint32(4),t=3}else{if(Gx(a)<n)break;const s=Jx(a,n);o.enqueue($z(r?s:Pv.decode(s),u)),t=0}if(n===0||n>e){o.enqueue(t9);break}}}})}const Knu=4;function lt(e){if(e)return g_e(e)}function g_e(e){for(var u in lt.prototype)e[u]=lt.prototype[u];return e}lt.prototype.on=lt.prototype.addEventListener=function(e,u){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(u),this};lt.prototype.once=function(e,u){function a(){this.off(e,a),u.apply(this,arguments)}return a.fn=u,this.on(e,a),this};lt.prototype.off=lt.prototype.removeListener=lt.prototype.removeAllListeners=lt.prototype.removeEventListener=function(e,u){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var a=this._callbacks["$"+e];if(!a)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var t,n=0;n<a.length;n++)if(t=a[n],t===u||t.fn===u){a.splice(n,1);break}return a.length===0&&delete this._callbacks["$"+e],this};lt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var u=new Array(arguments.length-1),a=this._callbacks["$"+e],t=1;t<arguments.length;t++)u[t-1]=arguments[t];if(a){a=a.slice(0);for(var t=0,n=a.length;t<n;++t)a[t].apply(this,u)}return this};lt.prototype.emitReserved=lt.prototype.emit;lt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};lt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const KC=typeof Promise=="function"&&typeof Promise.resolve=="function"?u=>Promise.resolve().then(u):(u,a)=>a(u,0),ai=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),C_e="arraybuffer";function $nu(e,...u){return u.reduce((a,t)=>(e.hasOwnProperty(t)&&(a[t]=e[t]),a),{})}const F_e=ai.setTimeout,k_e=ai.clearTimeout;function $C(e,u){u.useNativeTimers?(e.setTimeoutFn=F_e.bind(ai),e.clearTimeoutFn=k_e.bind(ai)):(e.setTimeoutFn=ai.setTimeout.bind(ai),e.clearTimeoutFn=ai.clearTimeout.bind(ai))}const v_e=1.33;function A_e(e){return typeof e=="string"?b_e(e):Math.ceil((e.byteLength||e.size)*v_e)}function b_e(e){let u=0,a=0;for(let t=0,n=e.length;t<n;t++)u=e.charCodeAt(t),u<128?a+=1:u<2048?a+=2:u<55296||u>=57344?a+=3:(t++,a+=4);return a}function Vnu(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function y_e(e){let u="";for(let a in e)e.hasOwnProperty(a)&&(u.length&&(u+="&"),u+=encodeURIComponent(a)+"="+encodeURIComponent(e[a]));return u}function B_e(e){let u={},a=e.split("&");for(let t=0,n=a.length;t<n;t++){let r=a[t].split("=");u[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return u}class S_e extends Error{constructor(u,a,t){super(u),this.description=a,this.context=t,this.type="TransportError"}}class Vz extends lt{constructor(u){super(),this.writable=!1,$C(this,u),this.opts=u,this.query=u.query,this.socket=u.socket,this.supportsBinary=!u.forceBase64}onError(u,a,t){return super.emitReserved("error",new S_e(u,a,t)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(u){this.readyState==="open"&&this.write(u)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(u){const a=$z(u,this.socket.binaryType);this.onPacket(a)}onPacket(u){super.emitReserved("packet",u)}onClose(u){this.readyState="closed",super.emitReserved("close",u)}pause(u){}createUri(u,a={}){return u+"://"+this._hostname()+this._port()+this.opts.path+this._query(a)}_hostname(){const u=this.opts.hostname;return u.indexOf(":")===-1?u:"["+u+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(u){const a=y_e(u);return a.length?"?"+a:""}}class z_e extends Vz{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(u){this.readyState="pausing";const a=()=>{this.readyState="paused",u()};if(this._polling||!this.writable){let t=0;this._polling&&(t++,this.once("pollComplete",function(){--t||a()})),this.writable||(t++,this.once("drain",function(){--t||a()}))}else a()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(u){const a=t=>{if(this.readyState==="opening"&&t.type==="open"&&this.onOpen(),t.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(t)};x_e(u,this.socket.binaryType).forEach(a),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const u=()=>{this.write([{type:"close"}])};this.readyState==="open"?u():this.once("open",u)}write(u){this.writable=!1,m_e(u,a=>{this.doWrite(a,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const u=this.opts.secure?"https":"http",a=this.query||{};return this.opts.timestampRequests!==!1&&(a[this.opts.timestampParam]=Vnu()),!this.supportsBinary&&!a.sid&&(a.b64=1),this.createUri(u,a)}}let Hnu=!1;try{Hnu=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const O_e=Hnu;function w_e(){}class M_e extends z_e{constructor(u){if(super(u),typeof location<"u"){const a=location.protocol==="https:";let t=location.port;t||(t=a?"443":"80"),this.xd=typeof location<"u"&&u.hostname!==location.hostname||t!==u.port}}doWrite(u,a){const t=this.request({method:"POST",data:u});t.on("success",a),t.on("error",(n,r)=>{this.onError("xhr post error",n,r)})}doPoll(){const u=this.request();u.on("data",this.onData.bind(this)),u.on("error",(a,t)=>{this.onError("xhr poll error",a,t)}),this.pollXhr=u}}let Hc=class Z6 extends lt{constructor(u,a,t){super(),this.createRequest=u,$C(this,t),this._opts=t,this._method=t.method||"GET",this._uri=a,this._data=t.data!==void 0?t.data:null,this._create()}_create(){var u;const a=$nu(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");a.xdomain=!!this._opts.xd;const t=this._xhr=this.createRequest(a);try{t.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&t.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{t.setRequestHeader("Accept","*/*")}catch{}(u=this._opts.cookieJar)===null||u===void 0||u.addCookies(t),"withCredentials"in t&&(t.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(t.timeout=this._opts.requestTimeout),t.onreadystatechange=()=>{var n;t.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(t.getResponseHeader("set-cookie"))),t.readyState===4&&(t.status===200||t.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof t.status=="number"?t.status:0)},0))},t.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=Z6.requestsCount++,Z6.requests[this._index]=this)}_onError(u){this.emitReserved("error",u,this._xhr),this._cleanup(!0)}_cleanup(u){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=w_e,u)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Z6.requests[this._index],this._xhr=null}}_onLoad(){const u=this._xhr.responseText;u!==null&&(this.emitReserved("data",u),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Hc.requestsCount=0;Hc.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",wN);else if(typeof addEventListener=="function"){const e="onpagehide"in ai?"pagehide":"unload";addEventListener(e,wN,!1)}}function wN(){for(let e in Hc.requests)Hc.requests.hasOwnProperty(e)&&Hc.requests[e].abort()}const T_e=function(){const e=Gnu({xdomain:!1});return e&&e.responseType!==null}();class P_e extends M_e{constructor(u){super(u);const a=u&&u.forceBase64;this.supportsBinary=T_e&&!a}request(u={}){return Object.assign(u,{xd:this.xd},this.opts),new Hc(Gnu,this.uri(),u)}}function Gnu(e){const u=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!u||O_e))return new XMLHttpRequest}catch{}if(!u)try{return new ai[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Jnu=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class j_e extends Vz{get name(){return"websocket"}doOpen(){const u=this.uri(),a=this.opts.protocols,t=Jnu?{}:$nu(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(t.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(u,a,t)}catch(n){return this.emitReserved("error",n)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=u=>this.onClose({description:"websocket connection closed",context:u}),this.ws.onmessage=u=>this.onData(u.data),this.ws.onerror=u=>this.onError("websocket error",u)}write(u){this.writable=!1;for(let a=0;a<u.length;a++){const t=u[a],n=a===u.length-1;Kz(t,this.supportsBinary,r=>{try{this.doWrite(t,r)}catch{}n&&KC(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const u=this.opts.secure?"wss":"ws",a=this.query||{};return this.opts.timestampRequests&&(a[this.opts.timestampParam]=Vnu()),this.supportsBinary||(a.b64=1),this.createUri(u,a)}}const jv=ai.WebSocket||ai.MozWebSocket;class N_e extends j_e{createSocket(u,a,t){return Jnu?new jv(u,a,t):a?new jv(u,a):new jv(u)}doWrite(u,a){this.ws.send(a)}}class R_e extends Vz{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(u){return this.emitReserved("error",u)}this._transport.closed.then(()=>{this.onClose()}).catch(u=>{this.onError("webtransport error",u)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(u=>{const a=p_e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),t=u.readable.pipeThrough(a).getReader(),n=f_e();n.readable.pipeTo(u.writable),this._writer=n.writable.getWriter();const r=()=>{t.read().then(({done:o,value:s})=>{o||(this.onPacket(s),r())}).catch(o=>{})};r();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then(()=>this.onOpen())})})}write(u){this.writable=!1;for(let a=0;a<u.length;a++){const t=u[a],n=a===u.length-1;this._writer.write(t).then(()=>{n&&KC(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var u;(u=this._transport)===null||u===void 0||u.close()}}const L_e={websocket:N_e,webtransport:R_e,polling:P_e},__e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,I_e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function n9(e){if(e.length>8e3)throw"URI too long";const u=e,a=e.indexOf("["),t=e.indexOf("]");a!=-1&&t!=-1&&(e=e.substring(0,a)+e.substring(a,t).replace(/:/g,";")+e.substring(t,e.length));let n=__e.exec(e||""),r={},i=14;for(;i--;)r[I_e[i]]=n[i]||"";return a!=-1&&t!=-1&&(r.source=u,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=K_e(r,r.path),r.queryKey=$_e(r,r.query),r}function K_e(e,u){const a=/\/{2,9}/g,t=u.replace(a,"/").split("/");return(u.slice(0,1)=="/"||u.length===0)&&t.splice(0,1),u.slice(-1)=="/"&&t.splice(t.length-1,1),t}function $_e(e,u){const a={};return u.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(t,n,r){n&&(a[n]=r)}),a}const r9=typeof addEventListener=="function"&&typeof removeEventListener=="function",Q6=[];r9&&addEventListener("offline",()=>{Q6.forEach(e=>e())},!1);class r1 extends lt{constructor(u,a){if(super(),this.binaryType=C_e,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,u&&typeof u=="object"&&(a=u,u=null),u){const t=n9(u);a.hostname=t.host,a.secure=t.protocol==="https"||t.protocol==="wss",a.port=t.port,t.query&&(a.query=t.query)}else a.host&&(a.hostname=n9(a.host).host);$C(this,a),this.secure=a.secure!=null?a.secure:typeof location<"u"&&location.protocol==="https:",a.hostname&&!a.port&&(a.port=this.secure?"443":"80"),this.hostname=a.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=a.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},a.transports.forEach(t=>{const n=t.prototype.name;this.transports.push(n),this._transportsByName[n]=t}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},a),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=B_e(this.opts.query)),r9&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Q6.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(u){const a=Object.assign({},this.opts.query);a.EIO=Knu,a.transport=u,this.id&&(a.sid=this.id);const t=Object.assign({},this.opts,{query:a,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[u]);return new this._transportsByName[u](t)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const u=this.opts.rememberUpgrade&&r1.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const a=this.createTransport(u);a.open(),this.setTransport(a)}setTransport(u){this.transport&&this.transport.removeAllListeners(),this.transport=u,u.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",a=>this._onClose("transport close",a))}onOpen(){this.readyState="open",r1.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(u){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",u),this.emitReserved("heartbeat"),u.type){case"open":this.onHandshake(JSON.parse(u.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const a=new Error("server error");a.code=u.data,this._onError(a);break;case"message":this.emitReserved("data",u.data),this.emitReserved("message",u.data);break}}onHandshake(u){this.emitReserved("handshake",u),this.id=u.sid,this.transport.query.sid=u.sid,this._pingInterval=u.pingInterval,this._pingTimeout=u.pingTimeout,this._maxPayload=u.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const u=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+u,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},u),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const u=this._getWritablePackets();this.transport.send(u),this._prevBufferLen=u.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let a=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(a+=A_e(n)),t>0&&a>this._maxPayload)return this.writeBuffer.slice(0,t);a+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const u=Date.now()>this._pingTimeoutTime;return u&&(this._pingTimeoutTime=0,KC(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),u}write(u,a,t){return this._sendPacket("message",u,a,t),this}send(u,a,t){return this._sendPacket("message",u,a,t),this}_sendPacket(u,a,t,n){if(typeof a=="function"&&(n=a,a=void 0),typeof t=="function"&&(n=t,t=null),this.readyState==="closing"||this.readyState==="closed")return;t=t||{},t.compress=t.compress!==!1;const r={type:u,data:a,options:t};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),n&&this.once("flush",n),this.flush()}close(){const u=()=>{this._onClose("forced close"),this.transport.close()},a=()=>{this.off("upgrade",a),this.off("upgradeError",a),u()},t=()=>{this.once("upgrade",a),this.once("upgradeError",a)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?t():u()}):this.upgrading?t():u()),this}_onError(u){if(r1.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",u),this._onClose("transport error",u)}_onClose(u,a){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),r9&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const t=Q6.indexOf(this._offlineEventListener);t!==-1&&Q6.splice(t,1)}this.readyState="closed",this.id=null,this.emitReserved("close",u,a),this.writeBuffer=[],this._prevBufferLen=0}}}r1.protocol=Knu;class V_e extends r1{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let u=0;u<this._upgrades.length;u++)this._probe(this._upgrades[u])}_probe(u){let a=this.createTransport(u),t=!1;r1.priorWebsocketSuccess=!1;const n=()=>{t||(a.send([{type:"ping",data:"probe"}]),a.once("packet",c=>{if(!t)if(c.type==="pong"&&c.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",a),!a)return;r1.priorWebsocketSuccess=a.name==="websocket",this.transport.pause(()=>{t||this.readyState!=="closed"&&(E(),this.setTransport(a),a.send([{type:"upgrade"}]),this.emitReserved("upgrade",a),a=null,this.upgrading=!1,this.flush())})}else{const D=new Error("probe error");D.transport=a.name,this.emitReserved("upgradeError",D)}}))};function r(){t||(t=!0,E(),a.close(),a=null)}const i=c=>{const D=new Error("probe error: "+c);D.transport=a.name,r(),this.emitReserved("upgradeError",D)};function o(){i("transport closed")}function s(){i("socket closed")}function l(c){a&&c.name!==a.name&&r()}const E=()=>{a.removeListener("open",n),a.removeListener("error",i),a.removeListener("close",o),this.off("close",s),this.off("upgrading",l)};a.once("open",n),a.once("error",i),a.once("close",o),this.once("close",s),this.once("upgrading",l),this._upgrades.indexOf("webtransport")!==-1&&u!=="webtransport"?this.setTimeoutFn(()=>{t||a.open()},200):a.open()}onHandshake(u){this._upgrades=this._filterUpgrades(u.upgrades),super.onHandshake(u)}_filterUpgrades(u){const a=[];for(let t=0;t<u.length;t++)~this.transports.indexOf(u[t])&&a.push(u[t]);return a}}let H_e=class extends V_e{constructor(u,a={}){const t=typeof u=="object"?u:a;(!t.transports||t.transports&&typeof t.transports[0]=="string")&&(t.transports=(t.transports||["polling","websocket","webtransport"]).map(n=>L_e[n]).filter(n=>!!n)),super(u,t)}};function G_e(e,u="",a){let t=e;a=a||typeof location<"u"&&location,e==null&&(e=a.protocol+"//"+a.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=a.protocol+e:e=a.host+e),/^(https?|wss?):\/\//.test(e)||(typeof a<"u"?e=a.protocol+"//"+e:e="https://"+e),t=n9(e)),t.port||(/^(http|ws)$/.test(t.protocol)?t.port="80":/^(http|ws)s$/.test(t.protocol)&&(t.port="443")),t.path=t.path||"/";const r=t.host.indexOf(":")!==-1?"["+t.host+"]":t.host;return t.id=t.protocol+"://"+r+":"+t.port+u,t.href=t.protocol+"://"+r+(a&&a.port===t.port?"":":"+t.port),t}const J_e=typeof ArrayBuffer=="function",W_e=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Wnu=Object.prototype.toString,U_e=typeof Blob=="function"||typeof Blob<"u"&&Wnu.call(Blob)==="[object BlobConstructor]",Z_e=typeof File=="function"||typeof File<"u"&&Wnu.call(File)==="[object FileConstructor]";function Hz(e){return J_e&&(e instanceof ArrayBuffer||W_e(e))||U_e&&e instanceof Blob||Z_e&&e instanceof File}function q6(e,u){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let a=0,t=e.length;a<t;a++)if(q6(e[a]))return!0;return!1}if(Hz(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return q6(e.toJSON(),!0);for(const a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&q6(e[a]))return!0;return!1}function Q_e(e){const u=[],a=e.data,t=e;return t.data=i9(a,u),t.attachments=u.length,{packet:t,buffers:u}}function i9(e,u){if(!e)return e;if(Hz(e)){const a={_placeholder:!0,num:u.length};return u.push(e),a}else if(Array.isArray(e)){const a=new Array(e.length);for(let t=0;t<e.length;t++)a[t]=i9(e[t],u);return a}else if(typeof e=="object"&&!(e instanceof Date)){const a={};for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=i9(e[t],u));return a}return e}function q_e(e,u){return e.data=o9(e.data,u),delete e.attachments,e}function o9(e,u){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<u.length)return u[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let a=0;a<e.length;a++)e[a]=o9(e[a],u);else if(typeof e=="object")for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&(e[a]=o9(e[a],u));return e}const Y_e=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],X_e=5;var h0;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(h0||(h0={}));class uIe{constructor(u){this.replacer=u}encode(u){return(u.type===h0.EVENT||u.type===h0.ACK)&&q6(u)?this.encodeAsBinary({type:u.type===h0.EVENT?h0.BINARY_EVENT:h0.BINARY_ACK,nsp:u.nsp,data:u.data,id:u.id}):[this.encodeAsString(u)]}encodeAsString(u){let a=""+u.type;return(u.type===h0.BINARY_EVENT||u.type===h0.BINARY_ACK)&&(a+=u.attachments+"-"),u.nsp&&u.nsp!=="/"&&(a+=u.nsp+","),u.id!=null&&(a+=u.id),u.data!=null&&(a+=JSON.stringify(u.data,this.replacer)),a}encodeAsBinary(u){const a=Q_e(u),t=this.encodeAsString(a.packet),n=a.buffers;return n.unshift(t),n}}function MN(e){return Object.prototype.toString.call(e)==="[object Object]"}class Gz extends lt{constructor(u){super(),this.reviver=u}add(u){let a;if(typeof u=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");a=this.decodeString(u);const t=a.type===h0.BINARY_EVENT;t||a.type===h0.BINARY_ACK?(a.type=t?h0.EVENT:h0.ACK,this.reconstructor=new eIe(a),a.attachments===0&&super.emitReserved("decoded",a)):super.emitReserved("decoded",a)}else if(Hz(u)||u.base64)if(this.reconstructor)a=this.reconstructor.takeBinaryData(u),a&&(this.reconstructor=null,super.emitReserved("decoded",a));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+u)}decodeString(u){let a=0;const t={type:Number(u.charAt(0))};if(h0[t.type]===void 0)throw new Error("unknown packet type "+t.type);if(t.type===h0.BINARY_EVENT||t.type===h0.BINARY_ACK){const r=a+1;for(;u.charAt(++a)!=="-"&&a!=u.length;);const i=u.substring(r,a);if(i!=Number(i)||u.charAt(a)!=="-")throw new Error("Illegal attachments");t.attachments=Number(i)}if(u.charAt(a+1)==="/"){const r=a+1;for(;++a&&!(u.charAt(a)===","||a===u.length););t.nsp=u.substring(r,a)}else t.nsp="/";const n=u.charAt(a+1);if(n!==""&&Number(n)==n){const r=a+1;for(;++a;){const i=u.charAt(a);if(i==null||Number(i)!=i){--a;break}if(a===u.length)break}t.id=Number(u.substring(r,a+1))}if(u.charAt(++a)){const r=this.tryParse(u.substr(a));if(Gz.isPayloadValid(t.type,r))t.data=r;else throw new Error("invalid payload")}return t}tryParse(u){try{return JSON.parse(u,this.reviver)}catch{return!1}}static isPayloadValid(u,a){switch(u){case h0.CONNECT:return MN(a);case h0.DISCONNECT:return a===void 0;case h0.CONNECT_ERROR:return typeof a=="string"||MN(a);case h0.EVENT:case h0.BINARY_EVENT:return Array.isArray(a)&&(typeof a[0]=="number"||typeof a[0]=="string"&&Y_e.indexOf(a[0])===-1);case h0.ACK:case h0.BINARY_ACK:return Array.isArray(a)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class eIe{constructor(u){this.packet=u,this.buffers=[],this.reconPack=u}takeBinaryData(u){if(this.buffers.push(u),this.buffers.length===this.reconPack.attachments){const a=q_e(this.reconPack,this.buffers);return this.finishedReconstruction(),a}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const aIe=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Gz,Encoder:uIe,get PacketType(){return h0},protocol:X_e},Symbol.toStringTag,{value:"Module"}));function Ni(e,u,a){return e.on(u,a),function(){e.off(u,a)}}const tIe=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Unu extends lt{constructor(u,a,t){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=u,this.nsp=a,t&&t.auth&&(this.auth=t.auth),this._opts=Object.assign({},t),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const u=this.io;this.subs=[Ni(u,"open",this.onopen.bind(this)),Ni(u,"packet",this.onpacket.bind(this)),Ni(u,"error",this.onerror.bind(this)),Ni(u,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...u){return u.unshift("message"),this.emit.apply(this,u),this}emit(u,...a){var t,n,r;if(tIe.hasOwnProperty(u))throw new Error('"'+u.toString()+'" is a reserved event name');if(a.unshift(u),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(a),this;const i={type:h0.EVENT,data:a};if(i.options={},i.options.compress=this.flags.compress!==!1,typeof a[a.length-1]=="function"){const E=this.ids++,c=a.pop();this._registerAckCallback(E,c),i.id=E}const o=(n=(t=this.io.engine)===null||t===void 0?void 0:t.transport)===null||n===void 0?void 0:n.writable,s=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!o||(s?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(u,a){var t;const n=(t=this.flags.timeout)!==null&&t!==void 0?t:this._opts.ackTimeout;if(n===void 0){this.acks[u]=a;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[u];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===u&&this.sendBuffer.splice(o,1);a.call(this,new Error("operation has timed out"))},n),i=(...o)=>{this.io.clearTimeoutFn(r),a.apply(this,o)};i.withError=!0,this.acks[u]=i}emitWithAck(u,...a){return new Promise((t,n)=>{const r=(i,o)=>i?n(i):t(o);r.withError=!0,a.push(r),this.emit(u,...a)})}_addToQueue(u){let a;typeof u[u.length-1]=="function"&&(a=u.pop());const t={id:this._queueSeq++,tryCount:0,pending:!1,args:u,flags:Object.assign({fromQueue:!0},this.flags)};u.push((n,...r)=>t!==this._queue[0]?void 0:(n!==null?t.tryCount>this._opts.retries&&(this._queue.shift(),a&&a(n)):(this._queue.shift(),a&&a(null,...r)),t.pending=!1,this._drainQueue())),this._queue.push(t),this._drainQueue()}_drainQueue(u=!1){if(!this.connected||this._queue.length===0)return;const a=this._queue[0];a.pending&&!u||(a.pending=!0,a.tryCount++,this.flags=a.flags,this.emit.apply(this,a.args))}packet(u){u.nsp=this.nsp,this.io._packet(u)}onopen(){typeof this.auth=="function"?this.auth(u=>{this._sendConnectPacket(u)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(u){this.packet({type:h0.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},u):u})}onerror(u){this.connected||this.emitReserved("connect_error",u)}onclose(u,a){this.connected=!1,delete this.id,this.emitReserved("disconnect",u,a),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(u=>{if(!this.sendBuffer.some(t=>String(t.id)===u)){const t=this.acks[u];delete this.acks[u],t.withError&&t.call(this,new Error("socket has been disconnected"))}})}onpacket(u){if(u.nsp===this.nsp)switch(u.type){case h0.CONNECT:u.data&&u.data.sid?this.onconnect(u.data.sid,u.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case h0.EVENT:case h0.BINARY_EVENT:this.onevent(u);break;case h0.ACK:case h0.BINARY_ACK:this.onack(u);break;case h0.DISCONNECT:this.ondisconnect();break;case h0.CONNECT_ERROR:this.destroy();const t=new Error(u.data.message);t.data=u.data.data,this.emitReserved("connect_error",t);break}}onevent(u){const a=u.data||[];u.id!=null&&a.push(this.ack(u.id)),this.connected?this.emitEvent(a):this.receiveBuffer.push(Object.freeze(a))}emitEvent(u){if(this._anyListeners&&this._anyListeners.length){const a=this._anyListeners.slice();for(const t of a)t.apply(this,u)}super.emit.apply(this,u),this._pid&&u.length&&typeof u[u.length-1]=="string"&&(this._lastOffset=u[u.length-1])}ack(u){const a=this;let t=!1;return function(...n){t||(t=!0,a.packet({type:h0.ACK,id:u,data:n}))}}onack(u){const a=this.acks[u.id];typeof a=="function"&&(delete this.acks[u.id],a.withError&&u.data.unshift(null),a.apply(this,u.data))}onconnect(u,a){this.id=u,this.recovered=a&&this._pid===a,this._pid=a,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(u=>this.emitEvent(u)),this.receiveBuffer=[],this.sendBuffer.forEach(u=>{this.notifyOutgoingListeners(u),this.packet(u)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(u=>u()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:h0.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(u){return this.flags.compress=u,this}get volatile(){return this.flags.volatile=!0,this}timeout(u){return this.flags.timeout=u,this}onAny(u){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(u),this}prependAny(u){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(u),this}offAny(u){if(!this._anyListeners)return this;if(u){const a=this._anyListeners;for(let t=0;t<a.length;t++)if(u===a[t])return a.splice(t,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(u){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(u),this}prependAnyOutgoing(u){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(u),this}offAnyOutgoing(u){if(!this._anyOutgoingListeners)return this;if(u){const a=this._anyOutgoingListeners;for(let t=0;t<a.length;t++)if(u===a[t])return a.splice(t,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(u){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const a=this._anyOutgoingListeners.slice();for(const t of a)t.apply(this,u.data)}}}function Md(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Md.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var u=Math.random(),a=Math.floor(u*this.jitter*e);e=Math.floor(u*10)&1?e+a:e-a}return Math.min(e,this.max)|0};Md.prototype.reset=function(){this.attempts=0};Md.prototype.setMin=function(e){this.ms=e};Md.prototype.setMax=function(e){this.max=e};Md.prototype.setJitter=function(e){this.jitter=e};class s9 extends lt{constructor(u,a){var t;super(),this.nsps={},this.subs=[],u&&typeof u=="object"&&(a=u,u=void 0),a=a||{},a.path=a.path||"/socket.io",this.opts=a,$C(this,a),this.reconnection(a.reconnection!==!1),this.reconnectionAttempts(a.reconnectionAttempts||1/0),this.reconnectionDelay(a.reconnectionDelay||1e3),this.reconnectionDelayMax(a.reconnectionDelayMax||5e3),this.randomizationFactor((t=a.randomizationFactor)!==null&&t!==void 0?t:.5),this.backoff=new Md({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(a.timeout==null?2e4:a.timeout),this._readyState="closed",this.uri=u;const n=a.parser||aIe;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=a.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(u){return arguments.length?(this._reconnection=!!u,u||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(u){return u===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=u,this)}reconnectionDelay(u){var a;return u===void 0?this._reconnectionDelay:(this._reconnectionDelay=u,(a=this.backoff)===null||a===void 0||a.setMin(u),this)}randomizationFactor(u){var a;return u===void 0?this._randomizationFactor:(this._randomizationFactor=u,(a=this.backoff)===null||a===void 0||a.setJitter(u),this)}reconnectionDelayMax(u){var a;return u===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=u,(a=this.backoff)===null||a===void 0||a.setMax(u),this)}timeout(u){return arguments.length?(this._timeout=u,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(u){if(~this._readyState.indexOf("open"))return this;this.engine=new H_e(this.uri,this.opts);const a=this.engine,t=this;this._readyState="opening",this.skipReconnect=!1;const n=Ni(a,"open",function(){t.onopen(),u&&u()}),r=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),u?u(o):this.maybeReconnectOnOpen()},i=Ni(a,"error",r);if(this._timeout!==!1){const o=this._timeout,s=this.setTimeoutFn(()=>{n(),r(new Error("timeout")),a.close()},o);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}return this.subs.push(n),this.subs.push(i),this}connect(u){return this.open(u)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const u=this.engine;this.subs.push(Ni(u,"ping",this.onping.bind(this)),Ni(u,"data",this.ondata.bind(this)),Ni(u,"error",this.onerror.bind(this)),Ni(u,"close",this.onclose.bind(this)),Ni(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(u){try{this.decoder.add(u)}catch(a){this.onclose("parse error",a)}}ondecoded(u){KC(()=>{this.emitReserved("packet",u)},this.setTimeoutFn)}onerror(u){this.emitReserved("error",u)}socket(u,a){let t=this.nsps[u];return t?this._autoConnect&&!t.active&&t.connect():(t=new Unu(this,u,a),this.nsps[u]=t),t}_destroy(u){const a=Object.keys(this.nsps);for(const t of a)if(this.nsps[t].active)return;this._close()}_packet(u){const a=this.encoder.encode(u);for(let t=0;t<a.length;t++)this.engine.write(a[t],u.options)}cleanup(){this.subs.forEach(u=>u()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(u,a){var t;this.cleanup(),(t=this.engine)===null||t===void 0||t.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",u,a),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const u=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const a=this.backoff.duration();this._reconnecting=!0;const t=this.setTimeoutFn(()=>{u.skipReconnect||(this.emitReserved("reconnect_attempt",u.backoff.attempts),!u.skipReconnect&&u.open(n=>{n?(u._reconnecting=!1,u.reconnect(),this.emitReserved("reconnect_error",n)):u.onreconnect()}))},a);this.opts.autoUnref&&t.unref(),this.subs.push(()=>{this.clearTimeoutFn(t)})}}onreconnect(){const u=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",u)}}const f5={};function Y6(e,u){typeof e=="object"&&(u=e,e=void 0),u=u||{};const a=G_e(e,u.path||"/socket.io"),t=a.source,n=a.id,r=a.path,i=f5[n]&&r in f5[n].nsps,o=u.forceNew||u["force new connection"]||u.multiplex===!1||i;let s;return o?s=new s9(t,u):(f5[n]||(f5[n]=new s9(t,u)),s=f5[n]),a.query&&!u.query&&(u.query=a.queryKey),s.socket(a.path,u)}Object.assign(Y6,{Manager:s9,Socket:Unu,io:Y6,connect:Y6});var Znu=Symbol.for("immer-nothing"),TN=Symbol.for("immer-draftable"),jr=Symbol.for("immer-state");function Hi(e,...u){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var _3=Object.getPrototypeOf;function I3(e){return!!e&&!!e[jr]}function nE(e){var u;return e?Qnu(e)||Array.isArray(e)||!!e[TN]||!!((u=e.constructor)!=null&&u[TN])||HC(e)||GC(e):!1}var nIe=Object.prototype.constructor.toString();function Qnu(e){if(!e||typeof e!="object")return!1;const u=_3(e);if(u===null)return!0;const a=Object.hasOwnProperty.call(u,"constructor")&&u.constructor;return a===Object?!0:typeof a=="function"&&Function.toString.call(a)===nIe}function Rp(e,u){VC(e)===0?Reflect.ownKeys(e).forEach(a=>{u(a,e[a],e)}):e.forEach((a,t)=>u(t,a,e))}function VC(e){const u=e[jr];return u?u.type_:Array.isArray(e)?1:HC(e)?2:GC(e)?3:0}function l9(e,u){return VC(e)===2?e.has(u):Object.prototype.hasOwnProperty.call(e,u)}function qnu(e,u,a){const t=VC(e);t===2?e.set(u,a):t===3?e.add(a):e[u]=a}function rIe(e,u){return e===u?e!==0||1/e===1/u:e!==e&&u!==u}function HC(e){return e instanceof Map}function GC(e){return e instanceof Set}function l4(e){return e.copy_||e.base_}function E9(e,u){if(HC(e))return new Map(e);if(GC(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const a=Qnu(e);if(u===!0||u==="class_only"&&!a){const t=Object.getOwnPropertyDescriptors(e);delete t[jr];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){const i=n[r],o=t[i];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(t[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:e[i]})}return Object.create(_3(e),t)}else{const t=_3(e);if(t!==null&&a)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function yh(e,u=!1){return JC(e)||I3(e)||!nE(e)||(VC(e)>1&&(e.set=e.add=e.clear=e.delete=iIe),Object.freeze(e),u&&Object.entries(e).forEach(([a,t])=>yh(t,!0))),e}function iIe(){Hi(2)}function JC(e){return Object.isFrozen(e)}var oIe={};function rE(e){const u=oIe[e];return u||Hi(0,e),u}var Bh;function Ynu(){return Bh}function sIe(e,u){return{drafts_:[],parent_:e,immer_:u,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function PN(e,u){u&&(rE("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=u)}function c9(e){d9(e),e.drafts_.forEach(lIe),e.drafts_=null}function d9(e){e===Bh&&(Bh=e.parent_)}function jN(e){return Bh=sIe(Bh,e)}function lIe(e){const u=e[jr];u.type_===0||u.type_===1?u.revoke_():u.revoked_=!0}function NN(e,u){u.unfinalizedDrafts_=u.drafts_.length;const a=u.drafts_[0];return e!==void 0&&e!==a?(a[jr].modified_&&(c9(u),Hi(4)),nE(e)&&(e=Lp(u,e),u.parent_||_p(u,e)),u.patches_&&rE("Patches").generateReplacementPatches_(a[jr].base_,e,u.patches_,u.inversePatches_)):e=Lp(u,a,[]),c9(u),u.patches_&&u.patchListener_(u.patches_,u.inversePatches_),e!==Znu?e:void 0}function Lp(e,u,a){if(JC(u))return u;const t=u[jr];if(!t)return Rp(u,(n,r)=>RN(e,t,u,n,r,a)),u;if(t.scope_!==e)return u;if(!t.modified_)return _p(e,t.base_,!0),t.base_;if(!t.finalized_){t.finalized_=!0,t.scope_.unfinalizedDrafts_--;const n=t.copy_;let r=n,i=!1;t.type_===3&&(r=new Set(n),n.clear(),i=!0),Rp(r,(o,s)=>RN(e,t,n,o,s,a,i)),_p(e,n,!1),a&&e.patches_&&rE("Patches").generatePatches_(t,a,e.patches_,e.inversePatches_)}return t.copy_}function RN(e,u,a,t,n,r,i){if(I3(n)){const o=r&&u&&u.type_!==3&&!l9(u.assigned_,t)?r.concat(t):void 0,s=Lp(e,n,o);if(qnu(a,t,s),I3(s))e.canAutoFreeze_=!1;else return}else i&&a.add(n);if(nE(n)&&!JC(n)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Lp(e,n),(!u||!u.scope_.parent_)&&typeof t!="symbol"&&Object.prototype.propertyIsEnumerable.call(a,t)&&_p(e,n)}}function _p(e,u,a=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&yh(u,a)}function EIe(e,u){const a=Array.isArray(e),t={type_:a?1:0,scope_:u?u.scope_:Ynu(),modified_:!1,finalized_:!1,assigned_:{},parent_:u,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let n=t,r=Jz;a&&(n=[t],r=Sh);const{revoke:i,proxy:o}=Proxy.revocable(n,r);return t.draft_=o,t.revoke_=i,o}var Jz={get(e,u){if(u===jr)return e;const a=l4(e);if(!l9(a,u))return cIe(e,a,u);const t=a[u];return e.finalized_||!nE(t)?t:t===Nv(e.base_,u)?(Rv(e),e.copy_[u]=h9(t,e)):t},has(e,u){return u in l4(e)},ownKeys(e){return Reflect.ownKeys(l4(e))},set(e,u,a){const t=Xnu(l4(e),u);if(t!=null&&t.set)return t.set.call(e.draft_,a),!0;if(!e.modified_){const n=Nv(l4(e),u),r=n==null?void 0:n[jr];if(r&&r.base_===a)return e.copy_[u]=a,e.assigned_[u]=!1,!0;if(rIe(a,n)&&(a!==void 0||l9(e.base_,u)))return!0;Rv(e),D9(e)}return e.copy_[u]===a&&(a!==void 0||u in e.copy_)||Number.isNaN(a)&&Number.isNaN(e.copy_[u])||(e.copy_[u]=a,e.assigned_[u]=!0),!0},deleteProperty(e,u){return Nv(e.base_,u)!==void 0||u in e.base_?(e.assigned_[u]=!1,Rv(e),D9(e)):delete e.assigned_[u],e.copy_&&delete e.copy_[u],!0},getOwnPropertyDescriptor(e,u){const a=l4(e),t=Reflect.getOwnPropertyDescriptor(a,u);return t&&{writable:!0,configurable:e.type_!==1||u!=="length",enumerable:t.enumerable,value:a[u]}},defineProperty(){Hi(11)},getPrototypeOf(e){return _3(e.base_)},setPrototypeOf(){Hi(12)}},Sh={};Rp(Jz,(e,u)=>{Sh[e]=function(){return arguments[0]=arguments[0][0],u.apply(this,arguments)}});Sh.deleteProperty=function(e,u){return Sh.set.call(this,e,u,void 0)};Sh.set=function(e,u,a){return Jz.set.call(this,e[0],u,a,e[0])};function Nv(e,u){const a=e[jr];return(a?l4(a):e)[u]}function cIe(e,u,a){var n;const t=Xnu(u,a);return t?"value"in t?t.value:(n=t.get)==null?void 0:n.call(e.draft_):void 0}function Xnu(e,u){if(!(u in e))return;let a=_3(e);for(;a;){const t=Object.getOwnPropertyDescriptor(a,u);if(t)return t;a=_3(a)}}function D9(e){e.modified_||(e.modified_=!0,e.parent_&&D9(e.parent_))}function Rv(e){e.copy_||(e.copy_=E9(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var dIe=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(u,a,t)=>{if(typeof u=="function"&&typeof a!="function"){const r=a;a=u;const i=this;return function(s=r,...l){return i.produce(s,E=>a.call(this,E,...l))}}typeof a!="function"&&Hi(6),t!==void 0&&typeof t!="function"&&Hi(7);let n;if(nE(u)){const r=jN(this),i=h9(u,void 0);let o=!0;try{n=a(i),o=!1}finally{o?c9(r):d9(r)}return PN(r,t),NN(n,r)}else if(!u||typeof u!="object"){if(n=a(u),n===void 0&&(n=u),n===Znu&&(n=void 0),this.autoFreeze_&&yh(n,!0),t){const r=[],i=[];rE("Patches").generateReplacementPatches_(u,n,r,i),t(r,i)}return n}else Hi(1,u)},this.produceWithPatches=(u,a)=>{if(typeof u=="function")return(i,...o)=>this.produceWithPatches(i,s=>u(s,...o));let t,n;return[this.produce(u,a,(i,o)=>{t=i,n=o}),t,n]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){nE(e)||Hi(8),I3(e)&&(e=A0(e));const u=jN(this),a=h9(e,void 0);return a[jr].isManual_=!0,d9(u),a}finishDraft(e,u){const a=e&&e[jr];(!a||!a.isManual_)&&Hi(9);const{scope_:t}=a;return PN(t,u),NN(void 0,t)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,u){let a;for(a=u.length-1;a>=0;a--){const n=u[a];if(n.path.length===0&&n.op==="replace"){e=n.value;break}}a>-1&&(u=u.slice(a+1));const t=rE("Patches").applyPatches_;return I3(e)?t(e,u):this.produce(e,n=>t(n,u))}};function h9(e,u){const a=HC(e)?rE("MapSet").proxyMap_(e,u):GC(e)?rE("MapSet").proxySet_(e,u):EIe(e,u);return(u?u.scope_:Ynu()).drafts_.push(a),a}function A0(e){return I3(e)||Hi(10,e),uru(e)}function uru(e){if(!nE(e)||JC(e))return e;const u=e[jr];let a;if(u){if(!u.modified_)return u.base_;u.finalized_=!0,a=E9(e,u.scope_.immer_.useStrictShallowCopy_)}else a=E9(e,!0);return Rp(a,(t,n)=>{qnu(a,t,uru(n))}),u&&(u.finalized_=!1),a}var Nr=new dIe,DIe=Nr.produce;Nr.produceWithPatches.bind(Nr);Nr.setAutoFreeze.bind(Nr);Nr.setUseStrictShallowCopy.bind(Nr);Nr.applyPatches.bind(Nr);Nr.createDraft.bind(Nr);Nr.finishDraft.bind(Nr);function m9(e){var u=C.useState(function(){return yh(typeof e=="function"?e():e,!0)}),a=u[1];return[u[0],C.useCallback(function(t){a(typeof t=="function"?DIe(t):yh(t))},[])]}const LN=1e4,hIe=5*60*1e3,mIe=10*60*1e3,eru=">>",at=(e,u)=>u?`${u}${eru}${e}`:e,E4=e=>{const u=e.split(eru);if(u.length>2)return{stepId:u[u.length-1],parentStepIdChain:u.slice(0,u.length-1)};if(u.length===1)return{stepId:u[0],parentStepIdChain:[]};const[a,t]=u;return{stepId:t,parentStepIdChain:a?[a]:[]}},L4=e=>{var u;switch(e.type){case"STEP_STATE":return e.step;case"MODULE_STATE":return{...e.step,steps:(u=e.step.steps)==null?void 0:u.map(a=>L4(a))}}},Oi=(e,u,a)=>{if(u.length>1)return;if(u.length===0){const r=at(a);return e.steps[r]||e.modules[r]}const t=at(u[0]),n=e.modules[t];if(n)return n.step.steps.find(r=>r.step.id===a)},p5=(e,u)=>{const a=e.modules[u];a&&Object.values(e.modules).forEach(t=>{t&&t.uniqueId!==u&&t.step.moduleId===a.step.moduleId&&(t.step.name=a.step.name,t.step.description=a.step.description,t.step.parameters=a.step.parameters,t.step.steps=a.step.steps.map(n=>({uniqueId:at(t.step.id,n.step.id),type:"STEP_STATE",step:n.step,status:E0.IDLE})),ks(t))})},ks=e=>{e.status=E0.IDLE,e.message=void 0,e.data=void 0,e.attempt=void 0,e.trace=void 0,e.type==="MODULE_STATE"?e.step.steps.forEach(u=>{ks(u)}):e.aiActionEventLogs=void 0};function xIe({test:e,websocketUrl:u,testPath:a}){const[t,n]=C.useState(!1),[r,i]=C.useState(),[o,s]=C.useState(),[l,E]=C.useState(!1),[c,D]=C.useState(),[h,m]=C.useState(!1),[x,p]=C.useState(!1),[f,g]=C.useState(),[F,b]=m9({rootIds:[],steps:{},modules:{}}),[y,v]=C.useState(null),[A,B]=C.useState(),[j,R]=C.useState([]),[w,O]=C.useState(),[T,z]=C.useState(),[N,M]=m9([]),[I,P]=C.useState(void 0),[L,K]=C.useState(!1),W=C.useRef(x);W.current=x;const _=C.useRef(r);_.current=r;const Q=C.useRef(Date.now()),eu=C.useRef(0),U=y0(()=>{var fu;Q.current=Date.now(),(fu=au.current)==null||fu.emit("keepalive")}),iu=C.useRef();C.useEffect(()=>{const fu=[],Bu={},_u={};e.steps.forEach(Xu=>{const Lu=at(Xu.id);if(fu.push(Lu),Xu.type===I0.MODULE){_u[Lu]={uniqueId:Lu,type:"MODULE_STATE",step:{...Xu,steps:Xu.steps.filter(H=>H.type!==I0.MODULE).map(H=>({uniqueId:at(H.id,Xu.id),type:"STEP_STATE",step:H,status:E0.IDLE}))},status:E0.IDLE};return}Bu[Lu]={uniqueId:Lu,type:"STEP_STATE",step:Xu,status:E0.IDLE}}),b({rootIds:fu,steps:Bu,modules:_u})},[b,e.steps]);const tu=!x&&!h&&t&&l,Y=y0(()=>{n(!0),s(void 0),g(void 0),iu.current&&window.clearInterval(iu.current),iu.current=window.setInterval(()=>{var fu,Bu;if(W.current){U();return}if(_.current&&!(Q.current>Date.now()-hIe)){if(Q.current>Date.now()-mIe){eu.current<=Q.current&&(Ca.warning("You've been inactive for a while. Please interact with the editor to avoid being disconnected.",{duration:6e4}),eu.current=Date.now());return}clearInterval(iu.current),(fu=au.current)!=null&&fu.active&&!W.current&&(g("You've been disconnected due to inactivity. Please refresh the page to start a new session."),Ca.error("Disconnected due to inactivity.",{duration:3e5}),(Bu=au.current)==null||Bu.disconnect())}},6e4)}),ou=y0((fu,Bu)=>{if(clearInterval(iu.current),f){p(!1);return}if(fu==="transport close"||fu==="transport error"||fu==="ping timeout")s({type:cD.DISCONNECTED,message:"Connection lost. Attempting to reconnect..."});else{let _u="";typeof Bu=="string"?_u=Bu:Bu&&(_u=JSON.stringify(Bu)),g(`Disconnected from server: ${fu} ${_u}`.trim())}p(!1)}),Cu=y0(fu=>{s(void 0);let Bu;fu instanceof Error?Bu=fu.message:fu&&typeof fu=="object"&&"message"in fu?Bu=String(fu.message):Bu=JSON.stringify(fu),g(Bu),Ca.error(Bu)}),Au=y0(fu=>{s(void 0),v(fu.viewportBounds),E(!0),D(fu.sessionId),fu.limbarToken&&fu.limbarUrl?i({token:fu.limbarToken,rtcUrl:fu.limbarUrl,testId:fu.testId}):s({message:"Local session started. Please use the launched emulator window for control.",type:cD.INFO})}),mu=y0(fu=>{fu.type===cD.CONNECTED?s(void 0):s(fu)}),Nu=y0(({attempt:fu,parentStepIdChain:Bu,stepId:_u})=>{U(),b(Xu=>{const Lu=Oi(Xu,Bu,_u);Lu&&(Lu.status=E0.RUNNING,Lu.data=void 0,Lu.message=void 0,Lu.attempt=fu)})}),le=y0(({result:fu,parentStepIdChain:Bu,trace:_u})=>{m(!1),b(Xu=>{const Lu=Oi(Xu,Bu,fu.id);Lu&&(Lu.status=E0.SUCCESS,Lu.message=fu.message,Lu.data=fu.data,Lu.trace=_u,fu.type===Tu.PRESET&&Lu.step.type===Tu.PRESET&&(Lu.step.command=fu.command))})}),Yu=y0(({result:fu,parentStepIdChain:Bu,trace:_u})=>{m(!1),b(Xu=>{const Lu=Oi(Xu,Bu,fu.id);Lu&&(Lu.status=E0.FAILED,Lu.message=fu.message,Lu.data=fu.data,Lu.trace=_u)})}),ve=y0(({result:fu,parentStepIdChain:Bu,trace:_u})=>{m(!1),b(Xu=>{const Lu=Oi(Xu,Bu,fu.id);Lu&&(Lu.status=E0.CANCELLED,Lu.message=fu.message,Lu.data=fu.data,Lu.trace=_u)})}),Ie=y0(()=>{U(),p(!1),m(!1)}),Zu=y0(fu=>{M(Bu=>{for(const _u of fu)try{const Xu=CSu(_u);Xu&&Bu.push(Xu)}catch{}Bu.length>LN&&Bu.splice(0,Bu.length-LN)})}),Gu=y0(({context:fu})=>{z(fu)}),fe=y0(()=>{var fu;K(!0),P(void 0),(fu=au.current)==null||fu.emit("fetchA11yTree",void 0,Bu=>{P(Bu),K(!1)})}),V=y0(({rootStep:fu,...Bu})=>{const{stepId:_u,parentStepIdChain:Xu}=fu;b(Lu=>{const H=Oi(Lu,Xu,_u);H&&H.type==="STEP_STATE"&&(H.aiActionEventLogs=H.aiActionEventLogs||[],H.aiActionEventLogs.push(Bu),H.aiActionEventLogs=H.aiActionEventLogs.reduce((X,Eu)=>{const Fu=X[X.length-1];return Fu&&Fu.type===Dh.LLM_TEXT_OUTPUT&&Eu.type===Dh.LLM_TEXT_OUTPUT?(Fu.text+=Eu.text,X):(X.push(Eu),X)},[]))})}),au=C.useRef(),du=y0(()=>{const Bu={testMetadata:JSON.stringify({...e,steps:void 0}),fileName:a},_u=Y6(u,{transports:["websocket"],query:Bu,reconnection:!0,reconnectionAttempts:500,reconnectionDelay:1e3,reconnectionDelayMax:3e4,autoConnect:!0});return _u.on("connect",Y),_u.on("disconnect",ou),_u.on("connect_error",Cu),_u.on("error",Cu),_u.on("session",Au),_u.on("connectionStatusUpdate",mu),_u.on("started",Nu),_u.on("success",le),_u.on("failure",Yu),_u.on("cancelled",ve),_u.on("finished",Ie),_u.on("logcatLogs",Zu),_u.on("emulatorState",Gu),_u.on("aiActionEvent",V),_u}),bu=y0(()=>{var fu,Bu;(fu=au.current)!=null&&fu.connected&&((Bu=au.current)==null||Bu.disconnect(),iu.current&&window.clearInterval(iu.current))});C.useEffect(()=>(window.addEventListener("beforeunload",bu),()=>{window.removeEventListener("beforeunload",bu)}),[bu]),C.useEffect(()=>(au.current||(au.current=du()),bu),[bu,du]);const pu=y0(()=>{U(),au.current&&(au.current.emit("cancel"),m(!0))}),xu=y0(fu=>{if(U(),!au.current||!tu)return;const{parentStepIdChain:Bu,stepId:_u}=E4(fu);b(X=>{const Eu=Oi(X,Bu,_u);Eu&&ks(Eu)});const{steps:Xu,...Lu}=e,H=F.rootIds.map(X=>F.steps[X]||F.modules[X]).filter(J6);au.current.emit("execute",{steps:H.map(L4),testMetadata:Lu,fromStep:{fromStepId:_u,parentStepIdChain:Bu},toStep:{toStepId:_u,parentStepIdChain:Bu}}),p(!0)}),Ru=y0(fu=>{if(U(),!au.current||!tu)return;const{parentStepIdChain:Bu,stepId:_u}=E4(fu);b(X=>{const Eu=Oi(X,Bu,_u);if(!Eu)return;if(ks(Eu),Bu.length){const Pu=at(Bu[0]),me=X.modules[Pu];if(me){let pe=!1;me.step.steps.forEach(ge=>{pe&&ks(ge),ge.step.id===_u&&(pe=!0)})}}let Fu=!1;X.rootIds.forEach(Pu=>{const me=X.steps[Pu]||X.modules[Pu];me&&(Fu&&ks(me),me.step.id===_u&&(Fu=!0))})});const{steps:Xu,...Lu}=e,H=F.rootIds.map(X=>F.steps[X]||F.modules[X]).filter(J6);au.current.emit("execute",{steps:H.map(L4),testMetadata:Lu,fromStep:{fromStepId:_u,parentStepIdChain:Bu}}),p(!0)}),He=y0(()=>{if(U(),!au.current||!tu)return;b(Xu=>{Object.values(Xu.steps).forEach(Lu=>{Lu&&ks(Lu)}),Object.values(Xu.modules).forEach(Lu=>{Lu&&ks(Lu)})});const{steps:fu,...Bu}=e,_u=F.rootIds.map(Xu=>F.steps[Xu]||F.modules[Xu]).filter(J6);au.current.emit("execute",{steps:_u.map(L4),testMetadata:Bu}),p(!0)}),yu=y0(fu=>{U(),B(fu)}),Ke=y0(fu=>{U(),b(Bu=>{const{parentStepIdChain:_u,stepId:Xu}=E4(fu);if(!_u.length){const Lu=at(Xu);Bu.rootIds=Bu.rootIds.filter(H=>H!==Lu),delete Bu.steps[Lu],delete Bu.modules[Lu];return}if(_u.length===1){const Lu=at(_u[0]),H=Bu.modules[Lu];if(!H)return;H.step.steps=H.step.steps.filter(X=>X.step.id!==Xu),p5(Bu,Lu)}})}),t0=(fu,Bu,_u)=>fu.type===I0.MODULE?{uniqueId:_u,type:"MODULE_STATE",step:{id:Bu,...fu,steps:fu.steps.filter(Xu=>Xu.type!==I0.MODULE).map(Xu=>({uniqueId:at(Xu.id,Bu),type:"STEP_STATE",step:Xu,status:E0.IDLE}))},status:E0.IDLE}:fu.type===Tu.AI_ACTION?{uniqueId:_u,type:"STEP_STATE",step:{id:Bu,type:Tu.AI_ACTION,text:""},status:E0.IDLE}:{uniqueId:_u,type:"STEP_STATE",step:{id:Bu,type:Tu.PRESET,command:sq(fu.command)},status:E0.IDLE},N0=y0((fu,Bu,_u="after")=>{if(U(),!Bu){const Pu=_a(),me=at(Pu),pe=t0(fu,Pu,me);b(ge=>{ge.rootIds.push(me),pe.type==="MODULE_STATE"?ge.modules[me]=pe:ge.steps[me]=pe}),B(pe.uniqueId),R([pe.uniqueId]);return}const{parentStepIdChain:Xu,stepId:Lu}=E4(Bu),H=_a(),X=at(H,Xu[0]),Eu=t0(fu,H,X),Fu=_u==="after"?1:0;b(Pu=>{const me=Oi(Pu,Xu,Lu);if(!me)return;if(Xu.length===1){if(me.type==="MODULE_STATE"||Eu.type==="MODULE_STATE")return;const ge=at(Xu[0]),ke=Pu.modules[ge];if(!ke)return;const i0=ke.step.steps.findIndex(Xa=>Xa.step.id===Lu);if(i0===-1)return;ke.step.steps.splice(i0+Fu,0,Eu),p5(Pu,ge);return}const pe=Pu.rootIds.indexOf(Bu);pe!==-1&&(Eu.type==="MODULE_STATE"?Pu.modules[Eu.uniqueId]=Eu:Pu.steps[Eu.uniqueId]=Eu,Pu.rootIds.splice(pe+Fu,0,Eu.uniqueId))}),B(Eu.uniqueId),R([Eu.uniqueId])}),ja=y0((fu,Bu)=>{U();const{parentStepIdChain:_u,stepId:Xu}=E4(fu),Lu=at(Bu.id,_u[0]);b(H=>{const X=Oi(H,_u,Xu);if(!X)return;const Eu=X.step;if(Bu.type===I0.MODULE&&Eu.type===I0.MODULE){const{steps:Fu,...Pu}=Bu;X.type="MODULE_STATE",X.step={...Eu,...Pu}}else if(Bu.type===I0.MODULE){const{steps:Fu,...Pu}=Bu;X.type="MODULE_STATE",X.step={...Pu,steps:Fu.filter(me=>me.type!==I0.MODULE).map(me=>({uniqueId:at(me.id,Bu.id),type:"STEP_STATE",step:me,status:E0.IDLE}))}}else X.type="STEP_STATE",X.step=Bu;if(X.uniqueId=Lu,ks(X),H.rootIds=H.rootIds.map(Fu=>Fu===fu?Lu:Fu),delete H.steps[fu],delete H.modules[fu],X.type==="MODULE_STATE"?H.modules[Lu]=X:H.steps[Lu]=X,_u.length===1){const Fu=at(_u[0]);p5(H,Fu)}}),B(Lu),R([Lu])}),Xt=y0(fu=>{U();const{parentStepIdChain:Bu,stepId:_u}=E4(fu),Xu=_a(),Lu=at(Xu,Bu[0]);b(H=>{const X=Oi(H,Bu,_u);if(!X)return;if(Bu.length===1){if(X.type==="MODULE_STATE")return;const Fu=at(Bu[0]),Pu=H.modules[Fu];if(!Pu)return;const me=Pu.step.steps.findIndex(ge=>ge.step.id===_u);if(me===-1)return;const pe={uniqueId:Lu,type:"STEP_STATE",step:{...X.step,id:Xu},status:E0.IDLE};Pu.step.steps.splice(me+1,0,pe),p5(H,Fu);return}const Eu=H.rootIds.indexOf(fu);Eu!==-1&&(X.type==="MODULE_STATE"?H.modules[Lu]={uniqueId:Lu,type:"MODULE_STATE",status:E0.IDLE,step:{...X.step,id:Xu,steps:X.step.steps.map(Fu=>({type:"STEP_STATE",uniqueId:at(Fu.step.id,Xu),step:Fu.step,status:E0.IDLE}))}}:H.steps[Lu]={uniqueId:Lu,type:"STEP_STATE",step:{...X.step,id:Xu},status:E0.IDLE},H.rootIds.splice(Eu+1,0,Lu))})}),$r=y0((fu,Bu,_u)=>{U(),b(Xu=>{if(_u){const H=Xu.modules[_u];if(!H)return;const X=H.step.steps[fu];H.step.steps.splice(fu,1),H.step.steps.splice(Bu,0,X),p5(Xu,_u);return}const Lu=Xu.rootIds[fu];Xu.rootIds.splice(fu,1),Xu.rootIds.splice(Bu,0,Lu)})}),PE=y0((fu,Bu,_u)=>{U();const{shiftKey:Xu,metaKey:Lu}=Bu;if(_u){O(_u),R([fu]);return}if(Xu&&w){const H=F.rootIds.indexOf(w),X=F.rootIds.indexOf(fu);if(H===-1||X===-1)return;const[Eu,Fu]=H<X?[H,X]:[X,H],Pu=F.rootIds.slice(Eu,Fu+1);R(Pu);return}if(Xu&&!w){O(fu),R([fu]);return}O(fu),R(Lu?H=>H.includes(fu)?H.filter(X=>X!==fu):[...H,fu]:[fu])}),Dl=y0(fu=>{U();const Bu=_a(),_u=at(Bu);b(Xu=>{let Lu=null;for(const H of j){if(!Xu.steps[H])continue;const X=Xu.rootIds.indexOf(H);X!==-1&&(Lu===null||X<Lu)&&(Lu=X)}Lu!==null&&(j.forEach(H=>{delete Xu.steps[H],Xu.steps[H]&&(Xu.rootIds=Xu.rootIds.filter(Eu=>Eu!==H))}),Xu.modules[_u]={uniqueId:_u,type:"MODULE_STATE",step:{...fu,type:I0.MODULE,id:Bu,steps:fu.steps.filter(H=>H.type!==I0.MODULE).map(H=>({uniqueId:at(H.id,Bu),type:"STEP_STATE",step:H,status:E0.IDLE}))},status:E0.IDLE},Xu.rootIds.splice(Lu,0,_u))}),B(_u),R([_u])});return{initialized:t,limbar:r,canceling:h,executing:x,canExecute:tu,error:f,connectionStatusUpdate:o,editorState:F,logcatLogs:N,a11yTreeResponse:I,isLoadingA11yTree:L,sessionLoaded:l,sessionId:c,testContext:T,viewport:y,editingUniqueId:A,selectedUniqueIds:j,handleCancel:pu,handleRunSingleStep:xu,handleRunFromStep:Ru,handleRunAllSteps:He,handleEdit:yu,handleDelete:Ke,handleAddStep:N0,handleStepChange:ja,handleDuplicate:Xt,handleFetchA11yTree:fe,handleMove:$r,handleSelect:PE,handleCreateModuleSuccess:Dl,setLastUserEventTime:U}}const fIe=S({name:V1,description:k()}),pIe=e=>{const u=Ci(),[a,t]=C.useState(!1),n=pd({resolver:gd(fIe),defaultValues:{name:"",description:""},mode:"onChange"}),[r,i]=Ws(async l=>{var c;const E={name:l.name,description:l.description,enabled:!0,steps:e.steps,testFilePath:e.testPath};try{const D=await u("/api/mobile-modules",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(E)});(c=e.onSuccess)==null||c.call(e,D),t(!1)}catch(D){Ca.error("Failed to create module.",{description:`${D}`})}},[e.steps,e.onSuccess]),{isDirty:o,isValid:s}=n.formState;return C.useEffect(()=>{n.reset()},[n,a]),d.jsxs(bE,{open:a,onOpenChange:t,children:[d.jsx(yE,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",disabled:e.disabled,children:[d.jsx(r8,{className:"h-4 w-4"}),"Create module"]})}),d.jsxs(_1,{children:[d.jsxs(I1,{children:[d.jsx(K1,{children:"Create module"}),d.jsx($1,{children:"Group and reuse steps across different tests."})]}),d.jsx(Cd,{...n,children:d.jsxs("form",{onSubmit:n.handleSubmit(i),className:"space-y-4",children:[d.jsx(_0,{control:n.control,name:"name",render:({field:l})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Name"}),d.jsx(T0,{children:d.jsx(SE,{placeholder:"example-module-name",...l})}),d.jsx(P0,{})]})}),d.jsx(_0,{control:n.control,name:"description",render:({field:l})=>d.jsxs(M0,{children:[d.jsx(Va,{children:"Description"}),d.jsx(T0,{children:d.jsx(zd,{...l})}),d.jsx(P0,{})]})}),d.jsx(BE,{children:d.jsx(Ve,{type:"submit",disabled:!o||!s||r.loading,children:"Create module"})})]})})]})]})},b4={[ia.EQUALS]:"equals",[ia.CONTAINS]:"contains",[ia.STARTS_WITH]:"starts with",[ia.EXISTS]:"exists"},y4={[ia.EQUALS]:"does not equal",[ia.CONTAINS]:"does not contain",[ia.STARTS_WITH]:"does not start with",[ia.EXISTS]:"does not exist"},aru={[sn.EXISTS]:"exists",[sn.VISIBLE]:"is visible",[sn.ENABLED]:"is enabled",[sn.EDITABLE]:"is editable",[sn.FOCUSED]:"is focused"},tru={[sn.EXISTS]:"does not exist",[sn.VISIBLE]:"is not visible",[sn.ENABLED]:"is disabled",[sn.EDITABLE]:"is not editable",[sn.FOCUSED]:"is not focused"};uZ.CONTENT+"";function nru(e,u){if(e!=="0.0.1"&&e!==u[u.length-1].toVersion)throw new Error("Please bump latestSchemaVersion in types package after adding a migration");u.forEach((a,t)=>{if(!H6.valid(a.toVersion)||!H6.valid(a.fromVersion))throw new Error(`Migration '${a.name}' has invalid version`);if(!H6.gt(a.toVersion,a.fromVersion))throw new Error(`Migration '${a.name}' has toVersion <= fromVersion`);if(t===0)return;if(u[t-1].toVersion!==a.fromVersion)throw new Error(`Migration '${a.name}' at index ${t} is not contiguous with previous migration`)})}var gIe={exports:{}};/*!
|
|
558
558
|
|
|
559
559
|
diff v3.5.0
|
|
560
560
|
|
|
@@ -741,4 +741,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
741
741
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ls(e,u){return YXe(e)||XXe(e,u)||a1u(e,u)||uu0()}function ds(e,u){if(e==null)return{};var a=H8e(e,u),t,n;if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)t=r[n],!(u.indexOf(t)>=0)&&Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}function eu0(e,u){return u||(u=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(u)}}))}const au0=Math.min,tu0=Math.max,Bg=Math.round,k6=Math.floor,Sg=e=>({x:e,y:e});function nu0(e){return{...e,top:e.y,left:e.x,right:e.x+e.width,bottom:e.y+e.height}}function p1u(e){return C1u(e)?(e.nodeName||"").toLowerCase():"#document"}function Yi(e){var u;return(e==null||(u=e.ownerDocument)==null?void 0:u.defaultView)||window}function g1u(e){var u;return(u=(C1u(e)?e.ownerDocument:e.document)||window.document)==null?void 0:u.documentElement}function C1u(e){return e instanceof Node||e instanceof Yi(e).Node}function qy(e){return e instanceof Element||e instanceof Yi(e).Element}function Ew(e){return e instanceof HTMLElement||e instanceof Yi(e).HTMLElement}function xI(e){return typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Yi(e).ShadowRoot}function F1u(e){const{overflow:u,overflowX:a,overflowY:t,display:n}=cw(e);return/auto|scroll|overlay|hidden|clip/.test(u+t+a)&&!["inline","contents"].includes(n)}function ru0(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function iu0(e){return["html","body","#document"].includes(p1u(e))}function cw(e){return Yi(e).getComputedStyle(e)}function ou0(e){if(p1u(e)==="html")return e;const u=e.assignedSlot||e.parentNode||xI(e)&&e.host||g1u(e);return xI(u)?u.host:u}function k1u(e){const u=ou0(e);return iu0(u)?e.ownerDocument?e.ownerDocument.body:e.body:Ew(u)&&F1u(u)?u:k1u(u)}function Yy(e,u){var a;u===void 0&&(u=[]);const t=k1u(e),n=t===((a=e.ownerDocument)==null?void 0:a.body),r=Yi(t);return n?u.concat(r,r.visualViewport||[],F1u(t)?t:[]):u.concat(t,Yy(t))}function su0(e){const u=cw(e);let a=parseFloat(u.width)||0,t=parseFloat(u.height)||0;const n=Ew(e),r=n?e.offsetWidth:a,i=n?e.offsetHeight:t,o=Bg(a)!==r||Bg(t)!==i;return o&&(a=r,t=i),{width:a,height:t,$:o}}function dw(e){return qy(e)?e:e.contextElement}function FA(e){const u=dw(e);if(!Ew(u))return Sg(1);const a=u.getBoundingClientRect(),{width:t,height:n,$:r}=su0(u);let i=(r?Bg(a.width):a.width)/t,o=(r?Bg(a.height):a.height)/n;return(!i||!Number.isFinite(i))&&(i=1),(!o||!Number.isFinite(o))&&(o=1),{x:i,y:o}}const lu0=Sg(0);function Eu0(e){const u=Yi(e);return!ru0()||!u.visualViewport?lu0:{x:u.visualViewport.offsetLeft,y:u.visualViewport.offsetTop}}function cu0(e,u,a){return u===void 0&&(u=!1),!a||u&&a!==Yi(e)?!1:u}function fI(e,u,a,t){u===void 0&&(u=!1),a===void 0&&(a=!1);const n=e.getBoundingClientRect(),r=dw(e);let i=Sg(1);u&&(t?qy(t)&&(i=FA(t)):i=FA(e));const o=cu0(r,a,t)?Eu0(r):Sg(0);let s=(n.left+o.x)/i.x,l=(n.top+o.y)/i.y,E=n.width/i.x,c=n.height/i.y;if(r){const D=Yi(r),h=t&&qy(t)?Yi(t):t;let m=D.frameElement;for(;m&&t&&h!==D;){const x=FA(m),p=m.getBoundingClientRect(),f=cw(m),g=p.left+(m.clientLeft+parseFloat(f.paddingLeft))*x.x,F=p.top+(m.clientTop+parseFloat(f.paddingTop))*x.y;s*=x.x,l*=x.y,E*=x.x,c*=x.y,s+=g,l+=F,m=Yi(m).frameElement}}return nu0({width:E,height:c,x:s,y:l})}function du0(e,u){let a=null,t;const n=g1u(e);function r(){clearTimeout(t),a&&a.disconnect(),a=null}function i(o,s){o===void 0&&(o=!1),s===void 0&&(s=1),r();const{left:l,top:E,width:c,height:D}=e.getBoundingClientRect();if(o||u(),!c||!D)return;const h=k6(E),m=k6(n.clientWidth-(l+c)),x=k6(n.clientHeight-(E+D)),p=k6(l),g={rootMargin:-h+"px "+-m+"px "+-x+"px "+-p+"px",threshold:tu0(0,au0(1,s))||1};let F=!0;function b(y){const v=y[0].intersectionRatio;if(v!==s){if(!F)return i();v?i(!1,v):t=setTimeout(()=>{i(!1,1e-7)},100)}F=!1}try{a=new IntersectionObserver(b,{...g,root:n.ownerDocument})}catch{a=new IntersectionObserver(b,g)}a.observe(e)}return i(!0),r}function Du0(e,u,a,t){t===void 0&&(t={});const{ancestorScroll:n=!0,ancestorResize:r=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:s=!1}=t,l=dw(e),E=n||r?[...l?Yy(l):[],...Yy(u)]:[];E.forEach(f=>{n&&f.addEventListener("scroll",a,{passive:!0}),r&&f.addEventListener("resize",a)});const c=l&&o?du0(l,a):null;let D=-1,h=null;i&&(h=new ResizeObserver(f=>{let[g]=f;g&&g.target===l&&h&&(h.unobserve(u),cancelAnimationFrame(D),D=requestAnimationFrame(()=>{h&&h.observe(u)})),a()}),l&&!s&&h.observe(l),h.observe(u));let m,x=s?fI(e):null;s&&p();function p(){const f=fI(e);x&&(f.x!==x.x||f.y!==x.y||f.width!==x.width||f.height!==x.height)&&a(),x=f,m=requestAnimationFrame(p)}return a(),()=>{E.forEach(f=>{n&&f.removeEventListener("scroll",a),r&&f.removeEventListener("resize",a)}),c&&c(),h&&h.disconnect(),h=null,s&&cancelAnimationFrame(m)}}var Xy=C.useLayoutEffect,hu0=["className","clearValue","cx","getStyles","getClassNames","getValue","hasValue","isMulti","isRtl","options","selectOption","selectProps","setValue","theme"],zg=function(){};function mu0(e,u){return u?u[0]==="-"?e+u:e+"__"+u:e}function xu0(e,u){for(var a=arguments.length,t=new Array(a>2?a-2:0),n=2;n<a;n++)t[n-2]=arguments[n];var r=[].concat(t);if(u&&e)for(var i in u)u.hasOwnProperty(i)&&u[i]&&r.push("".concat(mu0(e,i)));return r.filter(function(o){return o}).map(function(o){return String(o).trim()}).join(" ")}var Og=function(u){return bu0(u)?u.filter(Boolean):aE(u)==="object"&&u!==null?[u]:[]},v1u=function(u){u.className,u.clearValue,u.cx,u.getStyles,u.getClassNames,u.getValue,u.hasValue,u.isMulti,u.isRtl,u.options,u.selectOption,u.selectProps,u.setValue,u.theme;var a=ds(u,hu0);return ye({},a)},Ma=function(u,a,t){var n=u.cx,r=u.getStyles,i=u.getClassNames,o=u.className;return{css:r(a,u),className:n(t??{},i(a,u),o)}};function PF(e){return[document.documentElement,document.body,window].indexOf(e)>-1}function fu0(e){return PF(e)?window.innerHeight:e.clientHeight}function A1u(e){return PF(e)?window.pageYOffset:e.scrollTop}function wg(e,u){if(PF(e)){window.scrollTo(0,u);return}e.scrollTop=u}function pu0(e){var u=getComputedStyle(e),a=u.position==="absolute",t=/(auto|scroll)/;if(u.position==="fixed")return document.documentElement;for(var n=e;n=n.parentElement;)if(u=getComputedStyle(n),!(a&&u.position==="static")&&t.test(u.overflow+u.overflowY+u.overflowX))return n;return document.documentElement}function gu0(e,u,a,t){return a*((e=e/t-1)*e*e+1)+u}function v6(e,u){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:200,t=arguments.length>3&&arguments[3]!==void 0?arguments[3]:zg,n=A1u(e),r=u-n,i=10,o=0;function s(){o+=i;var l=gu0(o,n,r,a);wg(e,l),o<a?window.requestAnimationFrame(s):t(e)}s()}function pI(e,u){var a=e.getBoundingClientRect(),t=u.getBoundingClientRect(),n=u.offsetHeight/3;t.bottom+n>a.bottom?wg(e,Math.min(u.offsetTop+u.clientHeight-e.offsetHeight+n,e.scrollHeight)):t.top-n<a.top&&wg(e,Math.max(u.offsetTop-n,0))}function Cu0(e){var u=e.getBoundingClientRect();return{bottom:u.bottom,height:u.height,left:u.left,right:u.right,top:u.top,width:u.width}}function gI(){try{return document.createEvent("TouchEvent"),!0}catch{return!1}}function Fu0(){try{return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)}catch{return!1}}var b1u=!1,ku0={get passive(){return b1u=!0}},A6=typeof window<"u"?window:{};A6.addEventListener&&A6.removeEventListener&&(A6.addEventListener("p",zg,ku0),A6.removeEventListener("p",zg,!1));var vu0=b1u;function Au0(e){return e!=null}function bu0(e){return Array.isArray(e)}function q5(e,u,a){return e?u:a}var yu0=function(u){for(var a=arguments.length,t=new Array(a>1?a-1:0),n=1;n<a;n++)t[n-1]=arguments[n];var r=Object.entries(u).filter(function(i){var o=Ls(i,1),s=o[0];return!t.includes(s)});return r.reduce(function(i,o){var s=Ls(o,2),l=s[0],E=s[1];return i[l]=E,i},{})},Bu0=["children","innerProps"],Su0=["children","innerProps"];function zu0(e){var u=e.maxHeight,a=e.menuEl,t=e.minHeight,n=e.placement,r=e.shouldScroll,i=e.isFixedPosition,o=e.controlHeight,s=pu0(a),l={placement:"bottom",maxHeight:u};if(!a||!a.offsetParent)return l;var E=s.getBoundingClientRect(),c=E.height,D=a.getBoundingClientRect(),h=D.bottom,m=D.height,x=D.top,p=a.offsetParent.getBoundingClientRect(),f=p.top,g=i?window.innerHeight:fu0(s),F=A1u(s),b=parseInt(getComputedStyle(a).marginBottom,10),y=parseInt(getComputedStyle(a).marginTop,10),v=f-y,A=g-x,B=v+F,j=c-F-x,R=h-g+F+b,w=F+x-y,O=160;switch(n){case"auto":case"bottom":if(A>=m)return{placement:"bottom",maxHeight:u};if(j>=m&&!i)return r&&v6(s,R,O),{placement:"bottom",maxHeight:u};if(!i&&j>=t||i&&A>=t){r&&v6(s,R,O);var T=i?A-b:j-b;return{placement:"bottom",maxHeight:T}}if(n==="auto"||i){var z=u,N=i?v:B;return N>=t&&(z=Math.min(N-b-o,u)),{placement:"top",maxHeight:z}}if(n==="bottom")return r&&wg(s,R),{placement:"bottom",maxHeight:u};break;case"top":if(v>=m)return{placement:"top",maxHeight:u};if(B>=m&&!i)return r&&v6(s,w,O),{placement:"top",maxHeight:u};if(!i&&B>=t||i&&v>=t){var M=u;return(!i&&B>=t||i&&v>=t)&&(M=i?v-y:B-y),r&&v6(s,w,O),{placement:"top",maxHeight:M}}return{placement:"bottom",maxHeight:u};default:throw new Error('Invalid placement provided "'.concat(n,'".'))}return l}function Ou0(e){var u={bottom:"top",top:"bottom"};return e?u[e]:"bottom"}var y1u=function(u){return u==="auto"?"bottom":u},wu0=function(u,a){var t,n=u.placement,r=u.theme,i=r.borderRadius,o=r.spacing,s=r.colors;return ye((t={label:"menu"},R5(t,Ou0(n),"100%"),R5(t,"position","absolute"),R5(t,"width","100%"),R5(t,"zIndex",1),t),a?{}:{backgroundColor:s.neutral0,borderRadius:i,boxShadow:"0 0 0 1px hsla(0, 0%, 0%, 0.1), 0 4px 11px hsla(0, 0%, 0%, 0.1)",marginBottom:o.menuGutter,marginTop:o.menuGutter})},B1u=C.createContext(null),Mu0=function(u){var a=u.children,t=u.minMenuHeight,n=u.maxMenuHeight,r=u.menuPlacement,i=u.menuPosition,o=u.menuShouldScrollIntoView,s=u.theme,l=C.useContext(B1u)||{},E=l.setPortalPlacement,c=C.useRef(null),D=C.useState(n),h=Ls(D,2),m=h[0],x=h[1],p=C.useState(null),f=Ls(p,2),g=f[0],F=f[1],b=s.spacing.controlHeight;return Xy(function(){var y=c.current;if(y){var v=i==="fixed",A=o&&!v,B=zu0({maxHeight:n,menuEl:y,minHeight:t,placement:r,shouldScroll:A,isFixedPosition:v,controlHeight:b});x(B.maxHeight),F(B.placement),E==null||E(B.placement)}},[n,r,i,o,t,E,b]),a({ref:c,placerProps:ye(ye({},u),{},{placement:g||y1u(r),maxHeight:m})})},Tu0=function(u){var a=u.children,t=u.innerRef,n=u.innerProps;return ze("div",Me({},Ma(u,"menu",{menu:!0}),{ref:t},n),a)},Pu0=Tu0,ju0=function(u,a){var t=u.maxHeight,n=u.theme.spacing.baseUnit;return ye({maxHeight:t,overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},a?{}:{paddingBottom:n,paddingTop:n})},Nu0=function(u){var a=u.children,t=u.innerProps,n=u.innerRef,r=u.isMulti;return ze("div",Me({},Ma(u,"menuList",{"menu-list":!0,"menu-list--is-multi":r}),{ref:n},t),a)},S1u=function(u,a){var t=u.theme,n=t.spacing.baseUnit,r=t.colors;return ye({textAlign:"center"},a?{}:{color:r.neutral40,padding:"".concat(n*2,"px ").concat(n*3,"px")})},Ru0=S1u,Lu0=S1u,_u0=function(u){var a=u.children,t=a===void 0?"No options":a,n=u.innerProps,r=ds(u,Bu0);return ze("div",Me({},Ma(ye(ye({},r),{},{children:t,innerProps:n}),"noOptionsMessage",{"menu-notice":!0,"menu-notice--no-options":!0}),n),t)},Iu0=function(u){var a=u.children,t=a===void 0?"Loading...":a,n=u.innerProps,r=ds(u,Su0);return ze("div",Me({},Ma(ye(ye({},r),{},{children:t,innerProps:n}),"loadingMessage",{"menu-notice":!0,"menu-notice--loading":!0}),n),t)},Ku0=function(u){var a=u.rect,t=u.offset,n=u.position;return{left:a.left,position:n,top:t,width:a.width,zIndex:1}},$u0=function(u){var a=u.appendTo,t=u.children,n=u.controlElement,r=u.innerProps,i=u.menuPlacement,o=u.menuPosition,s=C.useRef(null),l=C.useRef(null),E=C.useState(y1u(i)),c=Ls(E,2),D=c[0],h=c[1],m=C.useMemo(function(){return{setPortalPlacement:h}},[]),x=C.useState(null),p=Ls(x,2),f=p[0],g=p[1],F=C.useCallback(function(){if(n){var A=Cu0(n),B=o==="fixed"?0:window.pageYOffset,j=A[D]+B;(j!==(f==null?void 0:f.offset)||A.left!==(f==null?void 0:f.rect.left)||A.width!==(f==null?void 0:f.rect.width))&&g({offset:j,rect:A})}},[n,o,D,f==null?void 0:f.offset,f==null?void 0:f.rect.left,f==null?void 0:f.rect.width]);Xy(function(){F()},[F]);var b=C.useCallback(function(){typeof l.current=="function"&&(l.current(),l.current=null),n&&s.current&&(l.current=Du0(n,s.current,F,{elementResize:"ResizeObserver"in window}))},[n,F]);Xy(function(){b()},[b]);var y=C.useCallback(function(A){s.current=A,b()},[b]);if(!a&&o!=="fixed"||!f)return null;var v=ze("div",Me({ref:y},Ma(ye(ye({},u),{},{offset:f.offset,position:o,rect:f.rect}),"menuPortal",{"menu-portal":!0}),r),t);return ze(B1u.Provider,{value:m},a?nl.createPortal(v,a):v)},Vu0=function(u){var a=u.isDisabled,t=u.isRtl;return{label:"container",direction:t?"rtl":void 0,pointerEvents:a?"none":void 0,position:"relative"}},Hu0=function(u){var a=u.children,t=u.innerProps,n=u.isDisabled,r=u.isRtl;return ze("div",Me({},Ma(u,"container",{"--is-disabled":n,"--is-rtl":r}),t),a)},Gu0=function(u,a){var t=u.theme.spacing,n=u.isMulti,r=u.hasValue,i=u.selectProps.controlShouldRenderValue;return ye({alignItems:"center",display:n&&r&&i?"flex":"grid",flex:1,flexWrap:"wrap",WebkitOverflowScrolling:"touch",position:"relative",overflow:"hidden"},a?{}:{padding:"".concat(t.baseUnit/2,"px ").concat(t.baseUnit*2,"px")})},Ju0=function(u){var a=u.children,t=u.innerProps,n=u.isMulti,r=u.hasValue;return ze("div",Me({},Ma(u,"valueContainer",{"value-container":!0,"value-container--is-multi":n,"value-container--has-value":r}),t),a)},Wu0=function(){return{alignItems:"center",alignSelf:"stretch",display:"flex",flexShrink:0}},Uu0=function(u){var a=u.children,t=u.innerProps;return ze("div",Me({},Ma(u,"indicatorsContainer",{indicators:!0}),t),a)},CI,Zu0=["size"],Qu0=["innerProps","isRtl","size"],qu0={name:"8mmkcg",styles:"display:inline-block;fill:currentColor;line-height:1;stroke:currentColor;stroke-width:0"},z1u=function(u){var a=u.size,t=ds(u,Zu0);return ze("svg",Me({height:a,width:a,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",css:qu0},t))},Dw=function(u){return ze(z1u,Me({size:20},u),ze("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"}))},O1u=function(u){return ze(z1u,Me({size:20},u),ze("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"}))},w1u=function(u,a){var t=u.isFocused,n=u.theme,r=n.spacing.baseUnit,i=n.colors;return ye({label:"indicatorContainer",display:"flex",transition:"color 150ms"},a?{}:{color:t?i.neutral60:i.neutral20,padding:r*2,":hover":{color:t?i.neutral80:i.neutral40}})},Yu0=w1u,Xu0=function(u){var a=u.children,t=u.innerProps;return ze("div",Me({},Ma(u,"dropdownIndicator",{indicator:!0,"dropdown-indicator":!0}),t),a||ze(O1u,null))},ue0=w1u,ee0=function(u){var a=u.children,t=u.innerProps;return ze("div",Me({},Ma(u,"clearIndicator",{indicator:!0,"clear-indicator":!0}),t),a||ze(Dw,null))},ae0=function(u,a){var t=u.isDisabled,n=u.theme,r=n.spacing.baseUnit,i=n.colors;return ye({label:"indicatorSeparator",alignSelf:"stretch",width:1},a?{}:{backgroundColor:t?i.neutral10:i.neutral20,marginBottom:r*2,marginTop:r*2})},te0=function(u){var a=u.innerProps;return ze("span",Me({},a,Ma(u,"indicatorSeparator",{"indicator-separator":!0})))},ne0=qXe(CI||(CI=eu0([`
|
|
742
742
|
0%, 80%, 100% { opacity: 0; }
|
|
743
743
|
40% { opacity: 1; }
|
|
744
|
-
`]))),re0=function(u,a){var t=u.isFocused,n=u.size,r=u.theme,i=r.colors,o=r.spacing.baseUnit;return ye({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:n,lineHeight:1,marginRight:n,textAlign:"center",verticalAlign:"middle"},a?{}:{color:t?i.neutral60:i.neutral20,padding:o*2})},kA=function(u){var a=u.delay,t=u.offset;return ze("span",{css:lw({animation:"".concat(ne0," 1s ease-in-out ").concat(a,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:t?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},ie0=function(u){var a=u.innerProps,t=u.isRtl,n=u.size,r=n===void 0?4:n,i=ds(u,Qu0);return ze("div",Me({},Ma(ye(ye({},i),{},{innerProps:a,isRtl:t,size:r}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),a),ze(kA,{delay:0,offset:t}),ze(kA,{delay:160,offset:!0}),ze(kA,{delay:320,offset:!t}))},oe0=function(u,a){var t=u.isDisabled,n=u.isFocused,r=u.theme,i=r.colors,o=r.borderRadius,s=r.spacing;return ye({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:s.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},a?{}:{backgroundColor:t?i.neutral5:i.neutral0,borderColor:t?i.neutral10:n?i.primary:i.neutral20,borderRadius:o,borderStyle:"solid",borderWidth:1,boxShadow:n?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:n?i.primary:i.neutral30}})},se0=function(u){var a=u.children,t=u.isDisabled,n=u.isFocused,r=u.innerRef,i=u.innerProps,o=u.menuIsOpen;return ze("div",Me({ref:r},Ma(u,"control",{control:!0,"control--is-disabled":t,"control--is-focused":n,"control--menu-is-open":o}),i,{"aria-disabled":t||void 0}),a)},le0=se0,Ee0=["data"],ce0=function(u,a){var t=u.theme.spacing;return a?{}:{paddingBottom:t.baseUnit*2,paddingTop:t.baseUnit*2}},de0=function(u){var a=u.children,t=u.cx,n=u.getStyles,r=u.getClassNames,i=u.Heading,o=u.headingProps,s=u.innerProps,l=u.label,E=u.theme,c=u.selectProps;return ze("div",Me({},Ma(u,"group",{group:!0}),s),ze(i,Me({},o,{selectProps:c,theme:E,getStyles:n,getClassNames:r,cx:t}),l),ze("div",null,a))},De0=function(u,a){var t=u.theme,n=t.colors,r=t.spacing;return ye({label:"group",cursor:"default",display:"block"},a?{}:{color:n.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:r.baseUnit*3,paddingRight:r.baseUnit*3,textTransform:"uppercase"})},he0=function(u){var a=v1u(u);a.data;var t=ds(a,Ee0);return ze("div",Me({},Ma(u,"groupHeading",{"group-heading":!0}),t))},me0=de0,xe0=["innerRef","isDisabled","isHidden","inputClassName"],fe0=function(u,a){var t=u.isDisabled,n=u.value,r=u.theme,i=r.spacing,o=r.colors;return ye(ye({visibility:t?"hidden":"visible",transform:n?"translateZ(0)":""},pe0),a?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:o.neutral80})},M1u={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},pe0={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":ye({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},M1u)},ge0=function(u){return ye({label:"input",color:"inherit",background:0,opacity:u?0:1,width:"100%"},M1u)},Ce0=function(u){var a=u.cx,t=u.value,n=v1u(u),r=n.innerRef,i=n.isDisabled,o=n.isHidden,s=n.inputClassName,l=ds(n,xe0);return ze("div",Me({},Ma(u,"input",{"input-container":!0}),{"data-value":t||""}),ze("input",Me({className:a({input:!0},s),ref:r,style:ge0(o),disabled:i},l)))},Fe0=Ce0,ke0=function(u,a){var t=u.theme,n=t.spacing,r=t.borderRadius,i=t.colors;return ye({label:"multiValue",display:"flex",minWidth:0},a?{}:{backgroundColor:i.neutral10,borderRadius:r/2,margin:n.baseUnit/2})},ve0=function(u,a){var t=u.theme,n=t.borderRadius,r=t.colors,i=u.cropWithEllipsis;return ye({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},a?{}:{borderRadius:n/2,color:r.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},Ae0=function(u,a){var t=u.theme,n=t.spacing,r=t.borderRadius,i=t.colors,o=u.isFocused;return ye({alignItems:"center",display:"flex"},a?{}:{borderRadius:r/2,backgroundColor:o?i.dangerLight:void 0,paddingLeft:n.baseUnit,paddingRight:n.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},T1u=function(u){var a=u.children,t=u.innerProps;return ze("div",t,a)},be0=T1u,ye0=T1u;function Be0(e){var u=e.children,a=e.innerProps;return ze("div",Me({role:"button"},a),u||ze(Dw,{size:14}))}var Se0=function(u){var a=u.children,t=u.components,n=u.data,r=u.innerProps,i=u.isDisabled,o=u.removeProps,s=u.selectProps,l=t.Container,E=t.Label,c=t.Remove;return ze(l,{data:n,innerProps:ye(ye({},Ma(u,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),r),selectProps:s},ze(E,{data:n,innerProps:ye({},Ma(u,"multiValueLabel",{"multi-value__label":!0})),selectProps:s},a),ze(c,{data:n,innerProps:ye(ye({},Ma(u,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(a||"option")},o),selectProps:s}))},ze0=Se0,Oe0=function(u,a){var t=u.isDisabled,n=u.isFocused,r=u.isSelected,i=u.theme,o=i.spacing,s=i.colors;return ye({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},a?{}:{backgroundColor:r?s.primary:n?s.primary25:"transparent",color:t?s.neutral20:r?s.neutral0:"inherit",padding:"".concat(o.baseUnit*2,"px ").concat(o.baseUnit*3,"px"),":active":{backgroundColor:t?void 0:r?s.primary:s.primary50}})},we0=function(u){var a=u.children,t=u.isDisabled,n=u.isFocused,r=u.isSelected,i=u.innerRef,o=u.innerProps;return ze("div",Me({},Ma(u,"option",{option:!0,"option--is-disabled":t,"option--is-focused":n,"option--is-selected":r}),{ref:i,"aria-disabled":t},o),a)},Me0=we0,Te0=function(u,a){var t=u.theme,n=t.spacing,r=t.colors;return ye({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},a?{}:{color:r.neutral50,marginLeft:n.baseUnit/2,marginRight:n.baseUnit/2})},Pe0=function(u){var a=u.children,t=u.innerProps;return ze("div",Me({},Ma(u,"placeholder",{placeholder:!0}),t),a)},je0=Pe0,Ne0=function(u,a){var t=u.isDisabled,n=u.theme,r=n.spacing,i=n.colors;return ye({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},a?{}:{color:t?i.neutral40:i.neutral80,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2})},Re0=function(u){var a=u.children,t=u.isDisabled,n=u.innerProps;return ze("div",Me({},Ma(u,"singleValue",{"single-value":!0,"single-value--is-disabled":t}),n),a)},Le0=Re0,_e0={ClearIndicator:ee0,Control:le0,DropdownIndicator:Xu0,DownChevron:O1u,CrossIcon:Dw,Group:me0,GroupHeading:he0,IndicatorsContainer:Uu0,IndicatorSeparator:te0,Input:Fe0,LoadingIndicator:ie0,Menu:Pu0,MenuList:Nu0,MenuPortal:$u0,LoadingMessage:Iu0,NoOptionsMessage:_u0,MultiValue:ze0,MultiValueContainer:be0,MultiValueLabel:ye0,MultiValueRemove:Be0,Option:Me0,Placeholder:je0,SelectContainer:Hu0,SingleValue:Le0,ValueContainer:Ju0},Ie0=function(u){return ye(ye({},_e0),u.components)},FI=Number.isNaN||function(u){return typeof u=="number"&&u!==u};function Ke0(e,u){return!!(e===u||FI(e)&&FI(u))}function $e0(e,u){if(e.length!==u.length)return!1;for(var a=0;a<e.length;a++)if(!Ke0(e[a],u[a]))return!1;return!0}function Ve0(e,u){u===void 0&&(u=$e0);var a=null;function t(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(a&&a.lastThis===this&&u(n,a.lastArgs))return a.lastResult;var i=e.apply(this,n);return a={lastResult:i,lastArgs:n,lastThis:this},i}return t.clear=function(){a=null},t}var He0={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},Ge0=function(u){return ze("span",Me({css:He0},u))},kI=Ge0,Je0={guidance:function(u){var a=u.isSearchable,t=u.isMulti,n=u.tabSelectsValue,r=u.context,i=u.isInitialFocus;switch(r){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(n?", press Tab to select the option and exit the menu":"",".");case"input":return i?"".concat(u["aria-label"]||"Select"," is focused ").concat(a?",type to refine list":"",", press Down to open the menu, ").concat(t?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(u){var a=u.action,t=u.label,n=t===void 0?"":t,r=u.labels,i=u.isDisabled;switch(a){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(n,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(r.length>1?"s":""," ").concat(r.join(","),", selected.");case"select-option":return i?"option ".concat(n," is disabled. Select another option."):"option ".concat(n,", selected.");default:return""}},onFocus:function(u){var a=u.context,t=u.focused,n=u.options,r=u.label,i=r===void 0?"":r,o=u.selectValue,s=u.isDisabled,l=u.isSelected,E=u.isAppleDevice,c=function(x,p){return x&&x.length?"".concat(x.indexOf(p)+1," of ").concat(x.length):""};if(a==="value"&&o)return"value ".concat(i," focused, ").concat(c(o,t),".");if(a==="menu"&&E){var D=s?" disabled":"",h="".concat(l?" selected":"").concat(D);return"".concat(i).concat(h,", ").concat(c(n,t),".")}return""},onFilter:function(u){var a=u.inputValue,t=u.resultsMessage;return"".concat(t).concat(a?" for search term "+a:"",".")}},We0=function(u){var a=u.ariaSelection,t=u.focusedOption,n=u.focusedValue,r=u.focusableOptions,i=u.isFocused,o=u.selectValue,s=u.selectProps,l=u.id,E=u.isAppleDevice,c=s.ariaLiveMessages,D=s.getOptionLabel,h=s.inputValue,m=s.isMulti,x=s.isOptionDisabled,p=s.isSearchable,f=s.menuIsOpen,g=s.options,F=s.screenReaderStatus,b=s.tabSelectsValue,y=s.isLoading,v=s["aria-label"],A=s["aria-live"],B=C.useMemo(function(){return ye(ye({},Je0),c||{})},[c]),j=C.useMemo(function(){var N="";if(a&&B.onChange){var M=a.option,I=a.options,P=a.removedValue,L=a.removedValues,K=a.value,W=function(Y){return Array.isArray(Y)?null:Y},_=P||M||W(K),Q=_?D(_):"",eu=I||L||void 0,U=eu?eu.map(D):[],iu=ye({isDisabled:_&&x(_,o),label:Q,labels:U},a);N=B.onChange(iu)}return N},[a,B,x,o,D]),R=C.useMemo(function(){var N="",M=t||n,I=!!(t&&o&&o.includes(t));if(M&&B.onFocus){var P={focused:M,label:D(M),isDisabled:x(M,o),isSelected:I,options:r,context:M===t?"menu":"value",selectValue:o,isAppleDevice:E};N=B.onFocus(P)}return N},[t,n,D,x,B,r,o,E]),w=C.useMemo(function(){var N="";if(f&&g.length&&!y&&B.onFilter){var M=F({count:r.length});N=B.onFilter({inputValue:h,resultsMessage:M})}return N},[r,h,f,B,g,F,y]),O=(a==null?void 0:a.action)==="initial-input-focus",T=C.useMemo(function(){var N="";if(B.guidance){var M=n?"value":f?"menu":"input";N=B.guidance({"aria-label":v,context:M,isDisabled:t&&x(t,o),isMulti:m,isSearchable:p,tabSelectsValue:b,isInitialFocus:O})}return N},[v,t,n,m,x,p,f,B,o,b,O]),z=ze(C.Fragment,null,ze("span",{id:"aria-selection"},j),ze("span",{id:"aria-focused"},R),ze("span",{id:"aria-results"},w),ze("span",{id:"aria-guidance"},T));return ze(C.Fragment,null,ze(kI,{id:l},O&&z),ze(kI,{"aria-live":A,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!O&&z))},Ue0=We0,uB=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],Ze0=new RegExp("["+uB.map(function(e){return e.letters}).join("")+"]","g"),P1u={};for(var vA=0;vA<uB.length;vA++)for(var AA=uB[vA],bA=0;bA<AA.letters.length;bA++)P1u[AA.letters[bA]]=AA.base;var j1u=function(u){return u.replace(Ze0,function(a){return P1u[a]})},Qe0=Ve0(j1u),vI=function(u){return u.replace(/^\s+|\s+$/g,"")},qe0=function(u){return"".concat(u.label," ").concat(u.value)},Ye0=function(u){return function(a,t){if(a.data.__isNew__)return!0;var n=ye({ignoreCase:!0,ignoreAccents:!0,stringify:qe0,trim:!0,matchFrom:"any"},u),r=n.ignoreCase,i=n.ignoreAccents,o=n.stringify,s=n.trim,l=n.matchFrom,E=s?vI(t):t,c=s?vI(o(a)):o(a);return r&&(E=E.toLowerCase(),c=c.toLowerCase()),i&&(E=Qe0(E),c=j1u(c)),l==="start"?c.substr(0,E.length)===E:c.indexOf(E)>-1}},Xe0=["innerRef"];function u00(e){var u=e.innerRef,a=ds(e,Xe0),t=yu0(a,"onExited","in","enter","exit","appear");return ze("input",Me({ref:u},t,{css:lw({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var e00=function(u){u.cancelable&&u.preventDefault(),u.stopPropagation()};function a00(e){var u=e.isEnabled,a=e.onBottomArrive,t=e.onBottomLeave,n=e.onTopArrive,r=e.onTopLeave,i=C.useRef(!1),o=C.useRef(!1),s=C.useRef(0),l=C.useRef(null),E=C.useCallback(function(p,f){if(l.current!==null){var g=l.current,F=g.scrollTop,b=g.scrollHeight,y=g.clientHeight,v=l.current,A=f>0,B=b-y-F,j=!1;B>f&&i.current&&(t&&t(p),i.current=!1),A&&o.current&&(r&&r(p),o.current=!1),A&&f>B?(a&&!i.current&&a(p),v.scrollTop=b,j=!0,i.current=!0):!A&&-f>F&&(n&&!o.current&&n(p),v.scrollTop=0,j=!0,o.current=!0),j&&e00(p)}},[a,t,n,r]),c=C.useCallback(function(p){E(p,p.deltaY)},[E]),D=C.useCallback(function(p){s.current=p.changedTouches[0].clientY},[]),h=C.useCallback(function(p){var f=s.current-p.changedTouches[0].clientY;E(p,f)},[E]),m=C.useCallback(function(p){if(p){var f=vu0?{passive:!1}:!1;p.addEventListener("wheel",c,f),p.addEventListener("touchstart",D,f),p.addEventListener("touchmove",h,f)}},[h,D,c]),x=C.useCallback(function(p){p&&(p.removeEventListener("wheel",c,!1),p.removeEventListener("touchstart",D,!1),p.removeEventListener("touchmove",h,!1))},[h,D,c]);return C.useEffect(function(){if(u){var p=l.current;return m(p),function(){x(p)}}},[u,m,x]),function(p){l.current=p}}var AI=["boxSizing","height","overflow","paddingRight","position"],bI={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function yI(e){e.preventDefault()}function BI(e){e.stopPropagation()}function SI(){var e=this.scrollTop,u=this.scrollHeight,a=e+this.offsetHeight;e===0?this.scrollTop=1:a===u&&(this.scrollTop=e-1)}function zI(){return"ontouchstart"in window||navigator.maxTouchPoints}var OI=!!(typeof window<"u"&&window.document&&window.document.createElement),y5=0,YE={capture:!1,passive:!1};function t00(e){var u=e.isEnabled,a=e.accountForScrollbars,t=a===void 0?!0:a,n=C.useRef({}),r=C.useRef(null),i=C.useCallback(function(s){if(OI){var l=document.body,E=l&&l.style;if(t&&AI.forEach(function(m){var x=E&&E[m];n.current[m]=x}),t&&y5<1){var c=parseInt(n.current.paddingRight,10)||0,D=document.body?document.body.clientWidth:0,h=window.innerWidth-D+c||0;Object.keys(bI).forEach(function(m){var x=bI[m];E&&(E[m]=x)}),E&&(E.paddingRight="".concat(h,"px"))}l&&zI()&&(l.addEventListener("touchmove",yI,YE),s&&(s.addEventListener("touchstart",SI,YE),s.addEventListener("touchmove",BI,YE))),y5+=1}},[t]),o=C.useCallback(function(s){if(OI){var l=document.body,E=l&&l.style;y5=Math.max(y5-1,0),t&&y5<1&&AI.forEach(function(c){var D=n.current[c];E&&(E[c]=D)}),l&&zI()&&(l.removeEventListener("touchmove",yI,YE),s&&(s.removeEventListener("touchstart",SI,YE),s.removeEventListener("touchmove",BI,YE)))}},[t]);return C.useEffect(function(){if(u){var s=r.current;return i(s),function(){o(s)}}},[u,i,o]),function(s){r.current=s}}var n00=function(u){var a=u.target;return a.ownerDocument.activeElement&&a.ownerDocument.activeElement.blur()},r00={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function i00(e){var u=e.children,a=e.lockEnabled,t=e.captureEnabled,n=t===void 0?!0:t,r=e.onBottomArrive,i=e.onBottomLeave,o=e.onTopArrive,s=e.onTopLeave,l=a00({isEnabled:n,onBottomArrive:r,onBottomLeave:i,onTopArrive:o,onTopLeave:s}),E=t00({isEnabled:a}),c=function(h){l(h),E(h)};return ze(C.Fragment,null,a&&ze("div",{onClick:n00,css:r00}),u(c))}var o00={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},s00=function(u){var a=u.name,t=u.onFocus;return ze("input",{required:!0,name:a,tabIndex:-1,"aria-hidden":"true",onFocus:t,css:o00,value:"",onChange:function(){}})},l00=s00;function hw(e){var u;return typeof window<"u"&&window.navigator!=null?e.test(((u=window.navigator.userAgentData)===null||u===void 0?void 0:u.platform)||window.navigator.platform):!1}function E00(){return hw(/^iPhone/i)}function N1u(){return hw(/^Mac/i)}function c00(){return hw(/^iPad/i)||N1u()&&navigator.maxTouchPoints>1}function d00(){return E00()||c00()}function D00(){return N1u()||d00()}var h00=function(u){return u.label},R1u=function(u){return u.label},L1u=function(u){return u.value},m00=function(u){return!!u.isDisabled},x00={clearIndicator:ue0,container:Vu0,control:oe0,dropdownIndicator:Yu0,group:ce0,groupHeading:De0,indicatorsContainer:Wu0,indicatorSeparator:ae0,input:fe0,loadingIndicator:re0,loadingMessage:Lu0,menu:wu0,menuList:ju0,menuPortal:Ku0,multiValue:ke0,multiValueLabel:ve0,multiValueRemove:Ae0,noOptionsMessage:Ru0,option:Oe0,placeholder:Te0,singleValue:Ne0,valueContainer:Gu0},f00={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},p00=4,_1u=4,g00=38,C00=_1u*2,F00={baseUnit:_1u,controlHeight:g00,menuGutter:C00},yA={borderRadius:p00,colors:f00,spacing:F00},k00={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:gI(),captureMenuScroll:!gI(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:Ye0(),formatGroupLabel:h00,getOptionLabel:R1u,getOptionValue:L1u,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:m00,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!Fu0(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(u){var a=u.count;return"".concat(a," result").concat(a!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function wI(e,u,a,t){var n=$1u(e,u,a),r=V1u(e,u,a),i=K1u(e,u),o=Mg(e,u);return{type:"option",data:u,isDisabled:n,isSelected:r,label:i,value:o,index:t}}function pf(e,u){return e.options.map(function(a,t){if("options"in a){var n=a.options.map(function(i,o){return wI(e,i,u,o)}).filter(function(i){return TI(e,i)});return n.length>0?{type:"group",data:a,options:n,index:t}:void 0}var r=wI(e,a,u,t);return TI(e,r)?r:void 0}).filter(Au0)}function I1u(e){return e.reduce(function(u,a){return a.type==="group"?u.push.apply(u,e3(a.options.map(function(t){return t.data}))):u.push(a.data),u},[])}function MI(e,u){return e.reduce(function(a,t){return t.type==="group"?a.push.apply(a,e3(t.options.map(function(n){return{data:n.data,id:"".concat(u,"-").concat(t.index,"-").concat(n.index)}}))):a.push({data:t.data,id:"".concat(u,"-").concat(t.index)}),a},[])}function v00(e,u){return I1u(pf(e,u))}function TI(e,u){var a=e.inputValue,t=a===void 0?"":a,n=u.data,r=u.isSelected,i=u.label,o=u.value;return(!G1u(e)||!r)&&H1u(e,{label:i,value:o,data:n},t)}function A00(e,u){var a=e.focusedValue,t=e.selectValue,n=t.indexOf(a);if(n>-1){var r=u.indexOf(a);if(r>-1)return a;if(n<u.length)return u[n]}return null}function b00(e,u){var a=e.focusedOption;return a&&u.indexOf(a)>-1?a:u[0]}var BA=function(u,a){var t,n=(t=u.find(function(r){return r.data===a}))===null||t===void 0?void 0:t.id;return n||null},K1u=function(u,a){return u.getOptionLabel(a)},Mg=function(u,a){return u.getOptionValue(a)};function $1u(e,u,a){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(u,a):!1}function V1u(e,u,a){if(a.indexOf(u)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(u,a);var t=Mg(e,u);return a.some(function(n){return Mg(e,n)===t})}function H1u(e,u,a){return e.filterOption?e.filterOption(u,a):!0}var G1u=function(u){var a=u.hideSelectedOptions,t=u.isMulti;return a===void 0?t:a},y00=1,J1u=function(e){VYe(a,e);var u=JYe(a);function a(t){var n;if(KYe(this,a),n=u.call(this,t),n.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:""},n.blockOptionHover=!1,n.isComposing=!1,n.commonProps=void 0,n.initialTouchX=0,n.initialTouchY=0,n.openAfterFocus=!1,n.scrollToFocusedOptionOnUpdate=!1,n.userIsDragging=void 0,n.isAppleDevice=D00(),n.controlRef=null,n.getControlRef=function(s){n.controlRef=s},n.focusedOptionRef=null,n.getFocusedOptionRef=function(s){n.focusedOptionRef=s},n.menuListRef=null,n.getMenuListRef=function(s){n.menuListRef=s},n.inputRef=null,n.getInputRef=function(s){n.inputRef=s},n.focus=n.focusInput,n.blur=n.blurInput,n.onChange=function(s,l){var E=n.props,c=E.onChange,D=E.name;l.name=D,n.ariaOnChange(s,l),c(s,l)},n.setValue=function(s,l,E){var c=n.props,D=c.closeMenuOnSelect,h=c.isMulti,m=c.inputValue;n.onInputChange("",{action:"set-value",prevInputValue:m}),D&&(n.setState({inputIsHiddenAfterUpdate:!h}),n.onMenuClose()),n.setState({clearFocusValueOnUpdate:!0}),n.onChange(s,{action:l,option:E})},n.selectOption=function(s){var l=n.props,E=l.blurInputOnSelect,c=l.isMulti,D=l.name,h=n.state.selectValue,m=c&&n.isOptionSelected(s,h),x=n.isOptionDisabled(s,h);if(m){var p=n.getOptionValue(s);n.setValue(h.filter(function(f){return n.getOptionValue(f)!==p}),"deselect-option",s)}else if(!x)c?n.setValue([].concat(e3(h),[s]),"select-option",s):n.setValue(s,"select-option");else{n.ariaOnChange(s,{action:"select-option",option:s,name:D});return}E&&n.blurInput()},n.removeValue=function(s){var l=n.props.isMulti,E=n.state.selectValue,c=n.getOptionValue(s),D=E.filter(function(m){return n.getOptionValue(m)!==c}),h=q5(l,D,D[0]||null);n.onChange(h,{action:"remove-value",removedValue:s}),n.focusInput()},n.clearValue=function(){var s=n.state.selectValue;n.onChange(q5(n.props.isMulti,[],null),{action:"clear",removedValues:s})},n.popValue=function(){var s=n.props.isMulti,l=n.state.selectValue,E=l[l.length-1],c=l.slice(0,l.length-1),D=q5(s,c,c[0]||null);n.onChange(D,{action:"pop-value",removedValue:E})},n.getFocusedOptionId=function(s){return BA(n.state.focusableOptionsWithIds,s)},n.getFocusableOptionsWithIds=function(){return MI(pf(n.props,n.state.selectValue),n.getElementId("option"))},n.getValue=function(){return n.state.selectValue},n.cx=function(){for(var s=arguments.length,l=new Array(s),E=0;E<s;E++)l[E]=arguments[E];return xu0.apply(void 0,[n.props.classNamePrefix].concat(l))},n.getOptionLabel=function(s){return K1u(n.props,s)},n.getOptionValue=function(s){return Mg(n.props,s)},n.getStyles=function(s,l){var E=n.props.unstyled,c=x00[s](l,E);c.boxSizing="border-box";var D=n.props.styles[s];return D?D(c,l):c},n.getClassNames=function(s,l){var E,c;return(E=(c=n.props.classNames)[s])===null||E===void 0?void 0:E.call(c,l)},n.getElementId=function(s){return"".concat(n.state.instancePrefix,"-").concat(s)},n.getComponents=function(){return Ie0(n.props)},n.buildCategorizedOptions=function(){return pf(n.props,n.state.selectValue)},n.getCategorizedOptions=function(){return n.props.menuIsOpen?n.buildCategorizedOptions():[]},n.buildFocusableOptions=function(){return I1u(n.buildCategorizedOptions())},n.getFocusableOptions=function(){return n.props.menuIsOpen?n.buildFocusableOptions():[]},n.ariaOnChange=function(s,l){n.setState({ariaSelection:ye({value:s},l)})},n.onMenuMouseDown=function(s){s.button===0&&(s.stopPropagation(),s.preventDefault(),n.focusInput())},n.onMenuMouseMove=function(s){n.blockOptionHover=!1},n.onControlMouseDown=function(s){if(!s.defaultPrevented){var l=n.props.openMenuOnClick;n.state.isFocused?n.props.menuIsOpen?s.target.tagName!=="INPUT"&&s.target.tagName!=="TEXTAREA"&&n.onMenuClose():l&&n.openMenu("first"):(l&&(n.openAfterFocus=!0),n.focusInput()),s.target.tagName!=="INPUT"&&s.target.tagName!=="TEXTAREA"&&s.preventDefault()}},n.onDropdownIndicatorMouseDown=function(s){if(!(s&&s.type==="mousedown"&&s.button!==0)&&!n.props.isDisabled){var l=n.props,E=l.isMulti,c=l.menuIsOpen;n.focusInput(),c?(n.setState({inputIsHiddenAfterUpdate:!E}),n.onMenuClose()):n.openMenu("first"),s.preventDefault()}},n.onClearIndicatorMouseDown=function(s){s&&s.type==="mousedown"&&s.button!==0||(n.clearValue(),s.preventDefault(),n.openAfterFocus=!1,s.type==="touchend"?n.focusInput():setTimeout(function(){return n.focusInput()}))},n.onScroll=function(s){typeof n.props.closeMenuOnScroll=="boolean"?s.target instanceof HTMLElement&&PF(s.target)&&n.props.onMenuClose():typeof n.props.closeMenuOnScroll=="function"&&n.props.closeMenuOnScroll(s)&&n.props.onMenuClose()},n.onCompositionStart=function(){n.isComposing=!0},n.onCompositionEnd=function(){n.isComposing=!1},n.onTouchStart=function(s){var l=s.touches,E=l&&l.item(0);E&&(n.initialTouchX=E.clientX,n.initialTouchY=E.clientY,n.userIsDragging=!1)},n.onTouchMove=function(s){var l=s.touches,E=l&&l.item(0);if(E){var c=Math.abs(E.clientX-n.initialTouchX),D=Math.abs(E.clientY-n.initialTouchY),h=5;n.userIsDragging=c>h||D>h}},n.onTouchEnd=function(s){n.userIsDragging||(n.controlRef&&!n.controlRef.contains(s.target)&&n.menuListRef&&!n.menuListRef.contains(s.target)&&n.blurInput(),n.initialTouchX=0,n.initialTouchY=0)},n.onControlTouchEnd=function(s){n.userIsDragging||n.onControlMouseDown(s)},n.onClearIndicatorTouchEnd=function(s){n.userIsDragging||n.onClearIndicatorMouseDown(s)},n.onDropdownIndicatorTouchEnd=function(s){n.userIsDragging||n.onDropdownIndicatorMouseDown(s)},n.handleInputChange=function(s){var l=n.props.inputValue,E=s.currentTarget.value;n.setState({inputIsHiddenAfterUpdate:!1}),n.onInputChange(E,{action:"input-change",prevInputValue:l}),n.props.menuIsOpen||n.onMenuOpen()},n.onInputFocus=function(s){n.props.onFocus&&n.props.onFocus(s),n.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(n.openAfterFocus||n.props.openMenuOnFocus)&&n.openMenu("first"),n.openAfterFocus=!1},n.onInputBlur=function(s){var l=n.props.inputValue;if(n.menuListRef&&n.menuListRef.contains(document.activeElement)){n.inputRef.focus();return}n.props.onBlur&&n.props.onBlur(s),n.onInputChange("",{action:"input-blur",prevInputValue:l}),n.onMenuClose(),n.setState({focusedValue:null,isFocused:!1})},n.onOptionHover=function(s){if(!(n.blockOptionHover||n.state.focusedOption===s)){var l=n.getFocusableOptions(),E=l.indexOf(s);n.setState({focusedOption:s,focusedOptionId:E>-1?n.getFocusedOptionId(s):null})}},n.shouldHideSelectedOptions=function(){return G1u(n.props)},n.onValueInputFocus=function(s){s.preventDefault(),s.stopPropagation(),n.focus()},n.onKeyDown=function(s){var l=n.props,E=l.isMulti,c=l.backspaceRemovesValue,D=l.escapeClearsValue,h=l.inputValue,m=l.isClearable,x=l.isDisabled,p=l.menuIsOpen,f=l.onKeyDown,g=l.tabSelectsValue,F=l.openMenuOnFocus,b=n.state,y=b.focusedOption,v=b.focusedValue,A=b.selectValue;if(!x&&!(typeof f=="function"&&(f(s),s.defaultPrevented))){switch(n.blockOptionHover=!0,s.key){case"ArrowLeft":if(!E||h)return;n.focusValue("previous");break;case"ArrowRight":if(!E||h)return;n.focusValue("next");break;case"Delete":case"Backspace":if(h)return;if(v)n.removeValue(v);else{if(!c)return;E?n.popValue():m&&n.clearValue()}break;case"Tab":if(n.isComposing||s.shiftKey||!p||!g||!y||F&&n.isOptionSelected(y,A))return;n.selectOption(y);break;case"Enter":if(s.keyCode===229)break;if(p){if(!y||n.isComposing)return;n.selectOption(y);break}return;case"Escape":p?(n.setState({inputIsHiddenAfterUpdate:!1}),n.onInputChange("",{action:"menu-close",prevInputValue:h}),n.onMenuClose()):m&&D&&n.clearValue();break;case" ":if(h)return;if(!p){n.openMenu("first");break}if(!y)return;n.selectOption(y);break;case"ArrowUp":p?n.focusOption("up"):n.openMenu("last");break;case"ArrowDown":p?n.focusOption("down"):n.openMenu("first");break;case"PageUp":if(!p)return;n.focusOption("pageup");break;case"PageDown":if(!p)return;n.focusOption("pagedown");break;case"Home":if(!p)return;n.focusOption("first");break;case"End":if(!p)return;n.focusOption("last");break;default:return}s.preventDefault()}},n.state.instancePrefix="react-select-"+(n.props.instanceId||++y00),n.state.selectValue=Og(t.value),t.menuIsOpen&&n.state.selectValue.length){var r=n.getFocusableOptionsWithIds(),i=n.buildFocusableOptions(),o=i.indexOf(n.state.selectValue[0]);n.state.focusableOptionsWithIds=r,n.state.focusedOption=i[o],n.state.focusedOptionId=BA(r,i[o])}return n}return $Ye(a,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&pI(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(n){var r=this.props,i=r.isDisabled,o=r.menuIsOpen,s=this.state.isFocused;(s&&!i&&n.isDisabled||s&&o&&!n.menuIsOpen)&&this.focusInput(),s&&i&&!n.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!s&&!i&&n.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(pI(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(n,r){this.props.onInputChange(n,r)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(n){var r=this,i=this.state,o=i.selectValue,s=i.isFocused,l=this.buildFocusableOptions(),E=n==="first"?0:l.length-1;if(!this.props.isMulti){var c=l.indexOf(o[0]);c>-1&&(E=c)}this.scrollToFocusedOptionOnUpdate=!(s&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:l[E],focusedOptionId:this.getFocusedOptionId(l[E])},function(){return r.onMenuOpen()})}},{key:"focusValue",value:function(n){var r=this.state,i=r.selectValue,o=r.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var s=i.indexOf(o);o||(s=-1);var l=i.length-1,E=-1;if(i.length){switch(n){case"previous":s===0?E=0:s===-1?E=l:E=s-1;break;case"next":s>-1&&s<l&&(E=s+1);break}this.setState({inputIsHidden:E!==-1,focusedValue:i[E]})}}}},{key:"focusOption",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",r=this.props.pageSize,i=this.state.focusedOption,o=this.getFocusableOptions();if(o.length){var s=0,l=o.indexOf(i);i||(l=-1),n==="up"?s=l>0?l-1:o.length-1:n==="down"?s=(l+1)%o.length:n==="pageup"?(s=l-r,s<0&&(s=0)):n==="pagedown"?(s=l+r,s>o.length-1&&(s=o.length-1)):n==="last"&&(s=o.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:o[s],focusedValue:null,focusedOptionId:this.getFocusedOptionId(o[s])})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(yA):ye(ye({},yA),this.props.theme):yA}},{key:"getCommonProps",value:function(){var n=this.clearValue,r=this.cx,i=this.getStyles,o=this.getClassNames,s=this.getValue,l=this.selectOption,E=this.setValue,c=this.props,D=c.isMulti,h=c.isRtl,m=c.options,x=this.hasValue();return{clearValue:n,cx:r,getStyles:i,getClassNames:o,getValue:s,hasValue:x,isMulti:D,isRtl:h,options:m,selectOption:l,selectProps:c,setValue:E,theme:this.getTheme()}}},{key:"hasValue",value:function(){var n=this.state.selectValue;return n.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var n=this.props,r=n.isClearable,i=n.isMulti;return r===void 0?i:r}},{key:"isOptionDisabled",value:function(n,r){return $1u(this.props,n,r)}},{key:"isOptionSelected",value:function(n,r){return V1u(this.props,n,r)}},{key:"filterOption",value:function(n,r){return H1u(this.props,n,r)}},{key:"formatOptionLabel",value:function(n,r){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,o=this.state.selectValue;return this.props.formatOptionLabel(n,{context:r,inputValue:i,selectValue:o})}else return this.getOptionLabel(n)}},{key:"formatGroupLabel",value:function(n){return this.props.formatGroupLabel(n)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var n=this.props,r=n.isDisabled,i=n.isSearchable,o=n.inputId,s=n.inputValue,l=n.tabIndex,E=n.form,c=n.menuIsOpen,D=n.required,h=this.getComponents(),m=h.Input,x=this.state,p=x.inputIsHidden,f=x.ariaSelection,g=this.commonProps,F=o||this.getElementId("input"),b=ye(ye(ye({"aria-autocomplete":"list","aria-expanded":c,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":D,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},c&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?(f==null?void 0:f.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?C.createElement(m,Me({},g,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:F,innerRef:this.getInputRef,isDisabled:r,isHidden:p,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:l,form:E,type:"text",value:s},b)):C.createElement(u00,Me({id:F,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:zg,onFocus:this.onInputFocus,disabled:r,tabIndex:l,inputMode:"none",form:E,value:""},b))}},{key:"renderPlaceholderOrValue",value:function(){var n=this,r=this.getComponents(),i=r.MultiValue,o=r.MultiValueContainer,s=r.MultiValueLabel,l=r.MultiValueRemove,E=r.SingleValue,c=r.Placeholder,D=this.commonProps,h=this.props,m=h.controlShouldRenderValue,x=h.isDisabled,p=h.isMulti,f=h.inputValue,g=h.placeholder,F=this.state,b=F.selectValue,y=F.focusedValue,v=F.isFocused;if(!this.hasValue()||!m)return f?null:C.createElement(c,Me({},D,{key:"placeholder",isDisabled:x,isFocused:v,innerProps:{id:this.getElementId("placeholder")}}),g);if(p)return b.map(function(B,j){var R=B===y,w="".concat(n.getOptionLabel(B),"-").concat(n.getOptionValue(B));return C.createElement(i,Me({},D,{components:{Container:o,Label:s,Remove:l},isFocused:R,isDisabled:x,key:w,index:j,removeProps:{onClick:function(){return n.removeValue(B)},onTouchEnd:function(){return n.removeValue(B)},onMouseDown:function(T){T.preventDefault()}},data:B}),n.formatOptionLabel(B,"value"))});if(f)return null;var A=b[0];return C.createElement(E,Me({},D,{data:A,isDisabled:x}),this.formatOptionLabel(A,"value"))}},{key:"renderClearIndicator",value:function(){var n=this.getComponents(),r=n.ClearIndicator,i=this.commonProps,o=this.props,s=o.isDisabled,l=o.isLoading,E=this.state.isFocused;if(!this.isClearable()||!r||s||!this.hasValue()||l)return null;var c={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return C.createElement(r,Me({},i,{innerProps:c,isFocused:E}))}},{key:"renderLoadingIndicator",value:function(){var n=this.getComponents(),r=n.LoadingIndicator,i=this.commonProps,o=this.props,s=o.isDisabled,l=o.isLoading,E=this.state.isFocused;if(!r||!l)return null;var c={"aria-hidden":"true"};return C.createElement(r,Me({},i,{innerProps:c,isDisabled:s,isFocused:E}))}},{key:"renderIndicatorSeparator",value:function(){var n=this.getComponents(),r=n.DropdownIndicator,i=n.IndicatorSeparator;if(!r||!i)return null;var o=this.commonProps,s=this.props.isDisabled,l=this.state.isFocused;return C.createElement(i,Me({},o,{isDisabled:s,isFocused:l}))}},{key:"renderDropdownIndicator",value:function(){var n=this.getComponents(),r=n.DropdownIndicator;if(!r)return null;var i=this.commonProps,o=this.props.isDisabled,s=this.state.isFocused,l={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return C.createElement(r,Me({},i,{innerProps:l,isDisabled:o,isFocused:s}))}},{key:"renderMenu",value:function(){var n=this,r=this.getComponents(),i=r.Group,o=r.GroupHeading,s=r.Menu,l=r.MenuList,E=r.MenuPortal,c=r.LoadingMessage,D=r.NoOptionsMessage,h=r.Option,m=this.commonProps,x=this.state.focusedOption,p=this.props,f=p.captureMenuScroll,g=p.inputValue,F=p.isLoading,b=p.loadingMessage,y=p.minMenuHeight,v=p.maxMenuHeight,A=p.menuIsOpen,B=p.menuPlacement,j=p.menuPosition,R=p.menuPortalTarget,w=p.menuShouldBlockScroll,O=p.menuShouldScrollIntoView,T=p.noOptionsMessage,z=p.onMenuScrollToTop,N=p.onMenuScrollToBottom;if(!A)return null;var M=function(Q,eu){var U=Q.type,iu=Q.data,tu=Q.isDisabled,Y=Q.isSelected,ou=Q.label,Cu=Q.value,Au=x===iu,mu=tu?void 0:function(){return n.onOptionHover(iu)},Nu=tu?void 0:function(){return n.selectOption(iu)},le="".concat(n.getElementId("option"),"-").concat(eu),Yu={id:le,onClick:Nu,onMouseMove:mu,onMouseOver:mu,tabIndex:-1,role:"option","aria-selected":n.isAppleDevice?void 0:Y};return C.createElement(h,Me({},m,{innerProps:Yu,data:iu,isDisabled:tu,isSelected:Y,key:le,label:ou,type:U,value:Cu,isFocused:Au,innerRef:Au?n.getFocusedOptionRef:void 0}),n.formatOptionLabel(Q.data,"menu"))},I;if(this.hasOptions())I=this.getCategorizedOptions().map(function(_){if(_.type==="group"){var Q=_.data,eu=_.options,U=_.index,iu="".concat(n.getElementId("group"),"-").concat(U),tu="".concat(iu,"-heading");return C.createElement(i,Me({},m,{key:iu,data:Q,options:eu,Heading:o,headingProps:{id:tu,data:_.data},label:n.formatGroupLabel(_.data)}),_.options.map(function(Y){return M(Y,"".concat(U,"-").concat(Y.index))}))}else if(_.type==="option")return M(_,"".concat(_.index))});else if(F){var P=b({inputValue:g});if(P===null)return null;I=C.createElement(c,m,P)}else{var L=T({inputValue:g});if(L===null)return null;I=C.createElement(D,m,L)}var K={minMenuHeight:y,maxMenuHeight:v,menuPlacement:B,menuPosition:j,menuShouldScrollIntoView:O},W=C.createElement(Mu0,Me({},m,K),function(_){var Q=_.ref,eu=_.placerProps,U=eu.placement,iu=eu.maxHeight;return C.createElement(s,Me({},m,K,{innerRef:Q,innerProps:{onMouseDown:n.onMenuMouseDown,onMouseMove:n.onMenuMouseMove},isLoading:F,placement:U}),C.createElement(i00,{captureEnabled:f,onTopArrive:z,onBottomArrive:N,lockEnabled:w},function(tu){return C.createElement(l,Me({},m,{innerRef:function(ou){n.getMenuListRef(ou),tu(ou)},innerProps:{role:"listbox","aria-multiselectable":m.isMulti,id:n.getElementId("listbox")},isLoading:F,maxHeight:iu,focusedOption:x}),I)}))});return R||j==="fixed"?C.createElement(E,Me({},m,{appendTo:R,controlElement:this.controlRef,menuPlacement:B,menuPosition:j}),W):W}},{key:"renderFormField",value:function(){var n=this,r=this.props,i=r.delimiter,o=r.isDisabled,s=r.isMulti,l=r.name,E=r.required,c=this.state.selectValue;if(E&&!this.hasValue()&&!o)return C.createElement(l00,{name:l,onFocus:this.onValueInputFocus});if(!(!l||o))if(s)if(i){var D=c.map(function(x){return n.getOptionValue(x)}).join(i);return C.createElement("input",{name:l,type:"hidden",value:D})}else{var h=c.length>0?c.map(function(x,p){return C.createElement("input",{key:"i-".concat(p),name:l,type:"hidden",value:n.getOptionValue(x)})}):C.createElement("input",{name:l,type:"hidden",value:""});return C.createElement("div",null,h)}else{var m=c[0]?this.getOptionValue(c[0]):"";return C.createElement("input",{name:l,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var n=this.commonProps,r=this.state,i=r.ariaSelection,o=r.focusedOption,s=r.focusedValue,l=r.isFocused,E=r.selectValue,c=this.getFocusableOptions();return C.createElement(Ue0,Me({},n,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:o,focusedValue:s,isFocused:l,selectValue:E,focusableOptions:c,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var n=this.getComponents(),r=n.Control,i=n.IndicatorsContainer,o=n.SelectContainer,s=n.ValueContainer,l=this.props,E=l.className,c=l.id,D=l.isDisabled,h=l.menuIsOpen,m=this.state.isFocused,x=this.commonProps=this.getCommonProps();return C.createElement(o,Me({},x,{className:E,innerProps:{id:c,onKeyDown:this.onKeyDown},isDisabled:D,isFocused:m}),this.renderLiveRegion(),C.createElement(r,Me({},x,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:D,isFocused:m,menuIsOpen:h}),C.createElement(s,Me({},x,{isDisabled:D}),this.renderPlaceholderOrValue(),this.renderInput()),C.createElement(i,Me({},x,{isDisabled:D}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(n,r){var i=r.prevProps,o=r.clearFocusValueOnUpdate,s=r.inputIsHiddenAfterUpdate,l=r.ariaSelection,E=r.isFocused,c=r.prevWasFocused,D=r.instancePrefix,h=n.options,m=n.value,x=n.menuIsOpen,p=n.inputValue,f=n.isMulti,g=Og(m),F={};if(i&&(m!==i.value||h!==i.options||x!==i.menuIsOpen||p!==i.inputValue)){var b=x?v00(n,g):[],y=x?MI(pf(n,g),"".concat(D,"-option")):[],v=o?A00(r,g):null,A=b00(r,b),B=BA(y,A);F={selectValue:g,focusedOption:A,focusedOptionId:B,focusableOptionsWithIds:y,focusedValue:v,clearFocusValueOnUpdate:!1}}var j=s!=null&&n!==i?{inputIsHidden:s,inputIsHiddenAfterUpdate:void 0}:{},R=l,w=E&&c;return E&&!w&&(R={value:q5(f,g,g[0]||null),options:g,action:"initial-input-focus"},w=!c),(l==null?void 0:l.action)==="initial-input-focus"&&(R=null),ye(ye(ye({},F),j),{},{prevProps:n,ariaSelection:R,prevWasFocused:w})}}]),a}(C.Component);J1u.defaultProps=k00;var B00=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function S00(e){var u=e.defaultInputValue,a=u===void 0?"":u,t=e.defaultMenuIsOpen,n=t===void 0?!1:t,r=e.defaultValue,i=r===void 0?null:r,o=e.inputValue,s=e.menuIsOpen,l=e.onChange,E=e.onInputChange,c=e.onMenuClose,D=e.onMenuOpen,h=e.value,m=ds(e,B00),x=C.useState(o!==void 0?o:a),p=Ls(x,2),f=p[0],g=p[1],F=C.useState(s!==void 0?s:n),b=Ls(F,2),y=b[0],v=b[1],A=C.useState(h!==void 0?h:i),B=Ls(A,2),j=B[0],R=B[1],w=C.useCallback(function(P,L){typeof l=="function"&&l(P,L),R(P)},[l]),O=C.useCallback(function(P,L){var K;typeof E=="function"&&(K=E(P,L)),g(K!==void 0?K:P)},[E]),T=C.useCallback(function(){typeof D=="function"&&D(),v(!0)},[D]),z=C.useCallback(function(){typeof c=="function"&&c(),v(!1)},[c]),N=o!==void 0?o:f,M=s!==void 0?s:y,I=h!==void 0?h:j;return ye(ye({},m),{},{inputValue:N,menuIsOpen:M,onChange:w,onInputChange:O,onMenuClose:z,onMenuOpen:T,value:I})}var z00=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],PI=function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0,n=String(u).toLowerCase(),r=String(t.getOptionValue(a)).toLowerCase(),i=String(t.getOptionLabel(a)).toLowerCase();return r===n||i===n},SA={formatCreateLabel:function(u){return'Create "'.concat(u,'"')},isValidNewOption:function(u,a,t,n){return!(!u||a.some(function(r){return PI(u,r,n)})||t.some(function(r){return PI(u,r,n)}))},getNewOptionData:function(u,a){return{label:a,value:u,__isNew__:!0}}};function O00(e){var u=e.allowCreateWhileLoading,a=u===void 0?!1:u,t=e.createOptionPosition,n=t===void 0?"last":t,r=e.formatCreateLabel,i=r===void 0?SA.formatCreateLabel:r,o=e.isValidNewOption,s=o===void 0?SA.isValidNewOption:o,l=e.getNewOptionData,E=l===void 0?SA.getNewOptionData:l,c=e.onCreateOption,D=e.options,h=D===void 0?[]:D,m=e.onChange,x=ds(e,z00),p=x.getOptionValue,f=p===void 0?L1u:p,g=x.getOptionLabel,F=g===void 0?R1u:g,b=x.inputValue,y=x.isLoading,v=x.isMulti,A=x.value,B=x.name,j=C.useMemo(function(){return s(b,Og(A),h,{getOptionValue:f,getOptionLabel:F})?E(b,i(b)):void 0},[i,E,F,f,b,s,h,A]),R=C.useMemo(function(){return(a||!y)&&j?n==="first"?[j].concat(e3(h)):[].concat(e3(h),[j]):h},[a,n,y,j,h]),w=C.useCallback(function(O,T){if(T.action!=="select-option")return m(O,T);var z=Array.isArray(O)?O:[O];if(z[z.length-1]===j){if(c)c(b);else{var N=E(b,b),M={action:"create-option",name:B,option:N};m(q5(v,[].concat(e3(Og(A)),[N]),N),M)}return}m(O,T)},[E,b,v,B,j,c,m,A]);return ye(ye({},x),{},{options:R,onChange:w})}var w00=C.forwardRef(function(e,u){var a=S00(e),t=O00(a);return C.createElement(J1u,Me({ref:u},t))}),M00=w00;ym.pick({parameters:!0,defaultParameters:!0,parameterEnums:!0,defaultCacheKey:!0,defaultCacheTtl:!0,defaultCacheAllInvocations:!0,autoAuth:!0,advanced:!0});const T00=({value:e,onChange:u})=>{var a,t;return d.jsxs(AC,{children:[d.jsx(bC,{children:d.jsxs(Wo,{children:[d.jsx(Io,{children:"Name"}),d.jsx(Io,{className:"w-1/2",children:"Options"}),d.jsx(Io,{className:"w-1/2",children:"Default value"}),d.jsx(Io,{className:"w-8"})]})}),d.jsxs(yC,{children:[(a=e.parameters)==null?void 0:a.map((n,r)=>{var i,o,s;return d.jsxs(Wo,{children:[d.jsx(gr,{className:"whitespace-nowrap",children:n}),d.jsx(gr,{children:d.jsx(M00,{className:"my-react-select-container",classNamePrefix:"my-react-select",placeholder:"Add options...",formatCreateLabel:l=>`Add ${l}`,isMulti:!0,isClearable:!1,styles:{menuPortal:l=>({...l,zIndex:9999})},menuPortalTarget:document.body,value:(o=(i=e.parameterEnums)==null?void 0:i[n])==null?void 0:o.map(l=>({label:l,value:l})),onChange:l=>{u({...e,parameterEnums:{...e.parameterEnums,[n]:(l==null?void 0:l.map(E=>E.value))||[]}})}})}),d.jsx(gr,{children:d.jsx(wlu,{singleLine:!0,value:((s=e.defaultParameters)==null?void 0:s[n])||"",language:"template-string",placeholder:"JavaScript expression",onChange:l=>{u({...e,defaultParameters:{...e.defaultParameters,[n]:l}})}})}),d.jsx(gr,{children:d.jsx(Ve,{type:"button",variant:"ghost",size:"smIcon",className:"text-destructive hover:text-destructive hover:bg-transparent",onClick:()=>{var c;const l={...e.defaultParameters};delete l[n];const E={...e.parameterEnums};delete E[n],u({...e,parameters:(c=e.parameters)==null?void 0:c.filter(D=>D!==n),defaultParameters:l,parameterEnums:E})},children:d.jsx(FE,{className:"h-4 w-4"})})})]},r)}),(t=e.parameters)!=null&&t.length?null:d.jsx(Wo,{children:d.jsx(gr,{colSpan:4,className:"h-24 text-center",children:"No parameters."})})]})]})},P00=e=>{var t,n,r;const[u,a]=C.useState("");return d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(gt,{placeholder:"PARAMETER_NAME",value:u,onChange:i=>a(i.target.value)}),d.jsxs(Ve,{variant:"outline",disabled:!u,onClick:()=>{var i,o,s;a(""),e.onChange({...e.step,parameters:{parameterNames:[...((i=e.step.parameters)==null?void 0:i.parameterNames)||[],u],defaultParameters:(o=e.step.parameters)==null?void 0:o.defaultParameters,parameterEnums:(s=e.step.parameters)==null?void 0:s.parameterEnums}})},children:[d.jsx(im,{}),"Add"]})]}),d.jsx(T00,{value:{parameters:(t=e.step.parameters)==null?void 0:t.parameterNames,defaultParameters:(n=e.step.parameters)==null?void 0:n.defaultParameters,parameterEnums:(r=e.step.parameters)==null?void 0:r.parameterEnums},onChange:i=>{e.onChange({...e.step,parameters:{parameterNames:i.parameters??[],defaultParameters:i.defaultParameters??void 0,parameterEnums:i.parameterEnums??void 0}})}})]})};function jI({value:e,onChange:u,onBlur:a}){const t=n=>{n===W0.CUSTOM?u({type:W0.CUSTOM,target:{type:"description",description:""}}):n===W0.CUSTOM_COORDINATES?u({type:W0.CUSTOM_COORDINATES,startX:0,startY:0,deltaPixels:100}):u({type:n})};return d.jsxs(d.Fragment,{children:[d.jsxs(Ka,{value:e.type,onValueChange:t,children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select a container"})}),d.jsxs(wa,{children:[d.jsx(Re,{value:W0.SCREEN,children:"Screen"}),d.jsx(Re,{value:W0.OPEN_APP,children:"Currently open app"}),d.jsx(Re,{value:W0.OPEN_WEBVIEW,children:"Active webview"}),d.jsx(Re,{value:W0.CUSTOM,children:"Custom container"}),d.jsx(Re,{value:W0.CUSTOM_COORDINATES,children:"Custom coordinates"})]})]}),e.type===W0.CUSTOM&&d.jsxs(we,{children:[d.jsx(tt,{value:e.target.description,onChange:n=>{u({type:W0.CUSTOM,target:{type:"description",description:n.target.value}})},onBlur:a}),d.jsx(Ou,{children:d.jsx(te,{children:"Container"})})]}),e.type===W0.CUSTOM_COORDINATES&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsxs(we,{children:[d.jsx(ht,{value:e.startX,min:0,onChange:n=>{u({...e,startX:n??0})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Start X"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"px"})})]}),d.jsxs(we,{children:[d.jsx(ht,{value:e.startY,min:0,onChange:n=>{u({...e,startY:n??0})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Start Y"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"px"})})]})]}),d.jsxs(we,{children:[d.jsx(ht,{value:e.deltaPixels,min:1,onChange:n=>{u({...e,deltaPixels:n??1})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Delta"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"px"})})]})]})]})}const zA=[{name:"Download",path:"/sdcard/Download/"},{name:"Documents",path:"/sdcard/Documents/"},{name:"Pictures",path:"/sdcard/Pictures/"},{name:"Music",path:"/sdcard/Music/"},{name:"Movies",path:"/sdcard/Movies/"}],b6="Custom path",j00=({value:e,onChange:u,onBlur:a})=>{const t=C.useRef(!1),n=C.useMemo(()=>zA.find(l=>e.startsWith(l.path)),[e]),r=(n==null?void 0:n.name)??b6,i=C.useMemo(()=>n?e.substring(n.path.length):e,[n,e]),o=C.useCallback(l=>{if(!n){u(l);return}u(n.path+l)},[u,n]),s=C.useCallback(l=>{t.current=!0;const E=i;if(l===b6){n&&u(E);return}const c=zA.find(D=>D.name===l);c&&u(c.path+E)},[i,u,n]);return C.useEffect(()=>{t.current&&(t.current=!1,a())},[e,a]),d.jsxs(we,{children:[d.jsx(tt,{className:"pl-1",placeholder:n?"android.jpg":"/sdcard/Download/android.jpg",value:i,onChange:l=>o(l.target.value),onBlur:a}),d.jsx(Ou,{children:d.jsxs(VW,{children:[d.jsx(HW,{asChild:!0,children:d.jsxs(Y0,{variant:"ghost","aria-label":"Select folder",children:[d.jsx(te,{children:r}),d.jsx(od,{className:"h-4 w-4"})]})}),d.jsxs(J8,{align:"end",children:[d.jsx(M4,{onSelect:()=>s(b6),children:b6}),zA.map(l=>d.jsx(M4,{onSelect:()=>s(l.name),children:l.name},l.name))]})]})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsxs(n0,{className:"max-w-xs",children:[e,d.jsx("br",{}),d.jsx("br",{}),"Location on the device where the file should be stored. This should be a file name."]})]})})]})},NI=e=>{var u,a,t;switch(e.type){case Tu.AI_ACTION:return e.text.trim().length>0;case I0.MODULE:return e.name.trim().length>0;case Tu.PRESET:{const n=e.command;switch(n.type){case G.AI_CHECK:return n.assertion.trim().length>0;case G.TAP:return n.target.type==="description"?n.target.description.trim().length>0:!0;case G.TYPE:return n.text.trim().length>0;case G.OPEN_APP:if((u=n.intentExtras)!=null&&u.length)try{JSON.parse(n.intentExtras)}catch{return!1}return n.packageName.trim().length>0;case G.JAVASCRIPT:return n.code.trim().length>0;case G.REQUEST:return n.url.trim().length>0;case G.WAIT:return n.timeoutSecs>0;case G.ADD_FILE:return!0;case G.INSTALL_APP:return n.uri.trim().length>0;case G.UNINSTALL_APP:return n.packageName.trim().length>0;case G.ADB:if((t=(a=n.jsonArgs)==null?void 0:a.trim())!=null&&t.length)try{JSON.parse(n.jsonArgs.trim())}catch{return!1}return n.command.trim().length>0;case G.SWIPE:return n.scrollableElement.type===W0.CUSTOM?n.scrollableElement.target.description.trim().length>0:!0;case G.SCREEN_CHECK:return n.assertion.value.trim().length>0;case G.ELEMENT_CHECK:return n.target.type==="description"?n.target.description.trim().length>0:!0;case G.KILL_APP:case G.OPEN_NOTIFICATION_DRAWER:case G.PRESS:case G.PRESS_KEYBOARD:case G.STATE:return!0;case G.SCROLL_TO:return n.scrollableElement.type===W0.CUSTOM?n.target.description.trim().length>0&&n.scrollableElement.target.description.trim().length>0:n.target.description.trim().length>0;case G.DRAG_AND_DROP:return!0;case G.TOGGLE_SETTINGS:return!0;default:return!0}}}return!0},Co="NEGATED_PREFIX__",RI=YU.filter(e=>e!==sn.VISIBLE),N00={[Qr.BACK]:"Back",[Qr.HOME]:"Home",[Qr.APP_SWITCHER]:"App switcher",[Qr.POWER]:"Power",[Qr.SEARCH]:"Search",[Qr.VOLUME_UP]:"Volume up",[Qr.VOLUME_DOWN]:"Volume down",[Qr.VOLUME_MUTE]:"Volume mute"},R00={[$c.BACKSPACE]:"Backspace",[$c.CLOSE_KEYBOARD]:"Close keyboard",[$c.ENTER]:"Enter"},he=(e,u)=>e.type===u,be=(e,u)=>e.type===u,B5=e=>{if(!e)return"";switch(e.type){case"description":return e.description;case"coordinates":return`${e.xPercent}%, ${e.yPercent}%`}},L00=e=>e.flatMap((u,a)=>a===0?[u]:[d.jsx(om,{},`separator-${a}`),u]),XE=({title:e,children:u})=>d.jsxs("div",{className:"grid gap-1 px-2 py-1",children:[d.jsx("div",{className:"flex h-9 items-center",children:d.jsx(xt,{children:e})}),u]}),_00=({state:e,modules:u,onChange:a,onExecute:t,sessionId:n})=>{var g,F,b,y;const r=C.useMemo(()=>L4(e),[e]),i=C.useMemo(()=>{switch(r.type){case Tu.AI_ACTION:return{type:Tu.AI_ACTION};case Tu.PRESET:return{type:Tu.PRESET,command:r.command.type};case I0.MODULE:return{...r,type:I0.MODULE}}},[r]),[o,s]=m9(r),l=()=>{if(NI(o)&&Object.keys(Tp(r,o)).length>0){a==null||a(o);return}},E=v=>{NI(v)&&Object.keys(Tp(r,v)).length>0&&(a==null||a(v))};C.useEffect(()=>{s(r)},[r,s]);const c=[],D=[],h=[],m=[],x=[];switch(o.type){case Tu.AI_ACTION:D.push(d.jsxs(we,{children:[d.jsx(Hr,{placeholder:"Re-enable 2FA in account settings and confirm it is active.",value:o.text,autoFocus:!0,onChange:v=>{const A=v.target.value;s(B=>{he(B,Tu.AI_ACTION)&&(B.text=A)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Goal"})})]},"ai-action-goal"));break;case I0.MODULE:m.push(d.jsxs(we,{children:[d.jsx(tt,{value:o.name,onChange:v=>{const A=v.target.value;s(B=>{he(B,I0.MODULE)&&(B.name=A)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Name"})})]},"module-name"),d.jsxs(we,{children:[d.jsx(Hr,{value:o.description,onChange:v=>{const A=v.target.value;s(B=>{he(B,I0.MODULE)&&(B.description=A)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Description"})})]},"module-description"),d.jsxs(ph,{onOpenChange:()=>{s(v=>{var A,B;if(he(v,I0.MODULE)){const j=(A=v.parameters)==null?void 0:A.defaultParameters;j&&(Object.keys(j).forEach(w=>{j[w].trim()||delete j[w]}),Object.keys(j||{}).length||(v.parameters.defaultParameters=void 0));const R=(B=v.parameters)==null?void 0:B.parameterEnums;R&&(Object.keys(R).forEach(w=>{R[w].length||delete R[w]}),Object.keys(R||{}).length||(v.parameters.parameterEnums=void 0)),E(A0(v))}})},children:[d.jsx(gh,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",className:"w-fit",children:[d.jsx(_7,{}),"Configure parameters"]})}),d.jsx(R3,{className:"w-[700px]",side:"right",align:"start",children:d.jsx(P00,{step:o,onChange:v=>{s(A=>{he(A,I0.MODULE)&&(A.parameters=v.parameters)})}})})]},"module-parameters")),(g=o.parameters)==null||g.parameterNames.forEach(v=>{var A,B,j;x.push(d.jsxs(we,{children:[d.jsx(tt,{placeholder:((B=(A=o.parameters)==null?void 0:A.defaultParameters)==null?void 0:B[v])||"'hello world'",value:((j=o.inputs)==null?void 0:j[v])||"",onChange:R=>{const w=R.target.value;s(O=>{he(O,I0.MODULE)&&(O.inputs={...O.inputs||{}},w?O.inputs[v]=w:delete O.inputs[v],Object.keys(O.inputs).length===0&&(O.inputs=void 0))})},onBlur:()=>{s(R=>{he(R,I0.MODULE)&&(R.inputs={...R.inputs||{}},Object.keys(R.inputs).forEach(w=>{var T,z;const O=(T=R.inputs)==null?void 0:T[w].trim();O?R.inputs[w]=O:(z=R.inputs)==null||delete z[w]}),Object.keys(R.inputs).length===0&&(R.inputs=void 0),E(A0(R)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:v})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:'JavaScript expression to pass into the module that can be referenced inside the module using the `env` variable. You should quote strings ("hello") and reference variables directly without {{ }} (e.g. `env.CURRENT_URL`)'})]})})]},`module-param-${v}`))}),h.push(d.jsxs(we,{children:[d.jsx(tt,{placeholder:"ENV_VAR_NAME",value:o.envKey||"",onChange:v=>{const A=v.target.value.trim();s(B=>{he(B,I0.MODULE)&&(B.envKey=A||void 0)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Variable name"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Store the output of this step onto the environment with the given variable name."})]})})]},"module-env"));break;case Tu.PRESET:switch(o.command.type){case G.AI_CHECK:D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.assertion,autoFocus:!0,onChange:v=>{const A=v.target.value;s(B=>{he(B,Tu.PRESET)&&be(B.command,G.AI_CHECK)&&(B.command.id=_a(),B.command.assertion=A)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Assertion"})})]},"ai-check-assertion"),d.jsxs(we,{children:[d.jsx(ht,{value:o.command.timeoutSecs??null,min:0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.AI_CHECK)&&(A.command.timeoutSecs=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Timeout"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"s"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Maximum numer of seconds to wait for the assertion to pass. At least two attempts will be made. Defaults to 5 seconds."})]})})]},"ai-check-timeout"));break;case G.TAP:{c.push(d.jsxs(we,{children:[d.jsx(tt,{value:B5(o.command.target),autoFocus:!0,onChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&(w.command.id=_a(),w.command.target={type:"description",description:R.target.value})})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Element"})})]},"tap-element"));let v;(R=>{R.SINGLE="SINGLE",R.DOUBLE="DOUBLE",R.LONG_PRESS="LONG_PRESS"})(v||(v={}));const A=o.command.longPress?"LONG_PRESS":o.command.doubleTap?"DOUBLE":"SINGLE";let B;(R=>{R.CENTER="CENTER",R.CUSTOM="CUSTOM"})(B||(B={}));const j=((F=o.command.relativePosition)==null?void 0:F.x)!==void 0&&o.command.relativePosition.y!==void 0?"CUSTOM":"CENTER";D.push(d.jsxs(Q5,{type:"single",variant:"outline",className:"justify-start",value:A,onValueChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&(w.command.longPress=R==="LONG_PRESS"||void 0,w.command.doubleTap=R==="DOUBLE"||void 0,w.command.longPressDurationMs=void 0,w.command.doubleTapDelayMs=void 0,E(A0(w)))})},children:[d.jsx(Wr,{value:"SINGLE",children:"Single tap"}),d.jsx(Wr,{value:"DOUBLE",children:"Double tap"}),d.jsx(Wr,{value:"LONG_PRESS",children:"Long press"})]},"tap-type"),A==="LONG_PRESS"&&d.jsxs(we,{children:[d.jsx(ht,{value:o.command.longPressDurationMs??null,min:0,onChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&(w.command.longPressDurationMs=R??void 0,E(A0(w)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Press duration"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"ms"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Milliseconds to hold the tap before releasing. Defaults to 2000 milliseconds."})]})})]},"press-duration"),A==="DOUBLE"&&d.jsxs(we,{children:[d.jsx(ht,{value:o.command.doubleTapDelayMs??null,min:0,onChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&(w.command.doubleTapDelayMs=R??void 0,E(A0(w)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Tap delay"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"ms"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Milliseconds to wait between taps. Defaults to 100 milliseconds."})]})})]},"double-tap-delay"),d.jsxs("div",{className:"flex h-9 items-center gap-2",children:[d.jsx(Vlu,{id:"position",checked:j==="CUSTOM",onCheckedChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&(w.command.relativePosition=R?{x:0,y:0}:void 0,E(A0(w)))})}}),d.jsx(xt,{htmlFor:"position",children:"Specify relative position"})]},"tap-position"),j==="CUSTOM"&&d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsxs(we,{children:[d.jsx(ht,{value:((b=o.command.relativePosition)==null?void 0:b.x)??null,onChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&w.command.relativePosition&&(w.command.relativePosition.x=R??0,E(A0(w)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"X offset"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"px"})})]}),d.jsxs(we,{children:[d.jsx(ht,{value:((y=o.command.relativePosition)==null?void 0:y.y)??null,onChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&w.command.relativePosition&&(w.command.relativePosition.y=R??0,E(A0(w)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Y offset"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"px"})})]})]},"tap-position-inputs"));break}case G.TYPE:{c.push(d.jsxs(we,{children:[d.jsx(tt,{autoFocus:!0,value:B5(o.command.target),onChange:v=>{s(A=>{if(he(A,Tu.PRESET)&&be(A.command,G.TYPE)){if(A.command.id=_a(),!v.target.value){A.command.target=void 0;return}A.command.target={type:"description",description:v.target.value}}})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Element"})})]},"type-element")),D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.text,onChange:v=>{const A=v.target.value;s(B=>{he(B,Tu.PRESET)&&be(B.command,G.TYPE)&&(B.command.text=A)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Value"})})]},"type-value"),d.jsxs(we,{children:[d.jsx(ht,{value:o.command.keyPressDelayMs??null,min:0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.TYPE)&&(A.command.keyPressDelayMs=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Key press delay"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"ms"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Milliseconds to wait between each key press. Defaults to 25 milliseconds."})]})})]},"type-delay"),d.jsxs(Ka,{value:D8u(o.command),onValueChange:v=>{s(A=>{if(he(A,Tu.PRESET)&&be(A.command,G.TYPE)){switch(v){case Fo.INPUT_TEXTAREAS:A.command.clearContent=!0,A.command.forceClearContent=void 0;break;case Fo.ALWAYS:A.command.clearContent=!0,A.command.forceClearContent=!0;break;case Fo.NEVER:A.command.clearContent=!1,A.command.forceClearContent=void 0;break}E(A0(A))}})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select a mode"})}),d.jsxs(wa,{children:[d.jsx(Re,{value:Fo.NEVER,children:Yk[Fo.NEVER]}),d.jsx(Re,{value:Fo.ALWAYS,children:Yk[Fo.ALWAYS]}),d.jsx(Re,{value:Fo.INPUT_TEXTAREAS,children:Yk[Fo.INPUT_TEXTAREAS]})]})]},"type-clear-content-mode"));break}case G.PRESS:D.push(d.jsxs(Ka,{value:o.command.key,onValueChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.PRESS)&&(A.command.key=v,E(A0(A)))})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select a button"})}),d.jsx(wa,{children:Object.values(Qr).map(v=>d.jsx(Re,{value:v,children:N00[v]},v))})]},"press-key"));break;case G.PRESS_KEYBOARD:D.push(d.jsxs(Ka,{value:o.command.key,onValueChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.PRESS_KEYBOARD)&&(A.command.key=v,E(A0(A)))})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select a key"})}),d.jsx(wa,{children:Object.values($c).map(v=>d.jsx(Re,{value:v,children:R00[v]},v))})]},"press-keyboard"));break;case G.SWIPE:{D.push(d.jsxs(Q5,{type:"single",variant:"outline",className:"justify-start",value:o.command.direction,onValueChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SWIPE)&&(A.command.direction=v,E(A0(A)))})},children:[d.jsx(Wr,{value:"up",children:"Up"}),d.jsx(Wr,{value:"down",children:"Down"}),d.jsx(Wr,{value:"left",children:"Left"}),d.jsx(Wr,{value:"right",children:"Right"})]},"swipe-direction"),d.jsx(jI,{value:o.command.scrollableElement,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SWIPE)&&(A.command.scrollableElement=v,A.command.cache=void 0,v.type===W0.CUSTOM_COORDINATES&&(A.command.viewportPercent=void 0),v.type!==W0.CUSTOM&&E(A0(A)))})},onBlur:l},"swipe-container"),o.command.scrollableElement.type!==W0.CUSTOM_COORDINATES&&d.jsxs(we,{children:[d.jsx(ht,{value:o.command.viewportPercent!==void 0?o.command.viewportPercent*100:null,min:0,max:100,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SWIPE)&&(A.command.viewportPercent=v!==null?v/100:void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:o.command.direction==="down"||o.command.direction==="up"?"Height":"Width"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"%"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"The amount to scroll, as a percentage of the height for vertical swipes and the width for horizontal swipes. Defaults to 80%."})]})})]},"swipe-percentage"),d.jsxs(we,{children:[d.jsx(ht,{value:o.command.durationMs??null,min:0,max:1e4,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SWIPE)&&(A.command.durationMs=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Duration"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"ms"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"The duration of the swipe in milliseconds. Defaults to 500 milliseconds."})]})})]},"swipe-duration"));break}case G.SCREEN_CHECK:{D.push(d.jsxs(Q5,{type:"single",variant:"outline",className:"justify-start",value:o.command.assertion.negated?"negated":"contains",onValueChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCREEN_CHECK)&&(A.command.assertion.negated=v==="negated",E(A0(A)))})},children:[d.jsx(Wr,{value:"contains",children:b4[ia.CONTAINS]}),d.jsx(Wr,{value:"negated",children:y4[ia.CONTAINS]})]},"tap-type"),d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.assertion.value,autoFocus:!0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCREEN_CHECK)&&(A.command.assertion.value=v.target.value)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Value"})})]},"screen-check-assertion-value"),d.jsxs(we,{children:[d.jsx(ht,{value:o.command.timeout??null,min:0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCREEN_CHECK)&&(A.command.timeout=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Timeout"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"s"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Maximum number of seconds to wait for the assertion to pass. At least two attempts will be made. Defaults to 5 seconds."})]})})]},"screen-check-timeout"));break}case G.ELEMENT_CHECK:{c.push(d.jsxs(we,{children:[d.jsx(tt,{value:B5(o.command.target),onChange:A=>{s(B=>{if(he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)){if(!A.target.value){B.command.target={type:"description",description:""};return}B.command.target={type:"description",description:A.target.value}}})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Element"})})]},"element-check-target"));const v=o.command.assertion;D.push(d.jsxs(Ka,{value:v.type??H0.ELEMENT_CONTENT,onValueChange:A=>{s(B=>{he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&Tvu(A)&&(B.command.assertion=lq(A,B.command.assertion),E(A0(B)))})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select an assertion type"})}),d.jsx(wa,{children:qU.map(A=>d.jsx(Re,{value:A,children:Pvu[A]},A))})]},"element-check-assertion-type")),v.type===H0.ELEMENT_ATTRIBUTE&&D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:v.attr,onChange:A=>{s(B=>{he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&B.command.assertion.type===H0.ELEMENT_ATTRIBUTE&&(B.command.assertion.attr=A.target.value)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Attribute"})})]},"element-check-attribute-value")),v.type===H0.ELEMENT_STYLE&&D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:v.property,onChange:A=>{s(B=>{he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&B.command.assertion.type===H0.ELEMENT_STYLE&&(B.command.assertion.property=A.target.value)})},onBlur:l}),d.jsxs(Ou,{align:"block-start",className:"justify-between",children:[d.jsx(te,{children:"Property"}),d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Warning",size:"icon-xs",children:d.jsx(Gf,{className:"text-yellow-600"})})}),d.jsx(n0,{className:"max-w-xs",children:"Computed style checks are not supported on native elements."})]})]})]},"element-check-property-value")),v.type!==H0.ELEMENT_EXISTENCE&&D.push(d.jsxs(Ka,{value:v.negated?Co+v.operation:v.operation,onValueChange:A=>{s(B=>{if(he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&B.command.assertion.type!==H0.ELEMENT_EXISTENCE){const j=A.startsWith(Co),R=j?A.slice(Co.length):A;if(!Mvu(R))return;B.command.assertion.operation=R,B.command.assertion.negated=j,E(A0(B))}})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select an operation"})}),d.jsxs(wa,{children:[fb.map(A=>d.jsx(Re,{value:A,children:b4[A]},A)),fb.map(A=>d.jsx(Re,{value:Co+A,children:y4[A]},Co+A))]})]},"element-check-assertion-operation")),v.type!==H0.ELEMENT_EXISTENCE&&v.operation!==ia.EXISTS&&D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:v.value,onChange:A=>{s(B=>{he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&B.command.assertion.type!==H0.ELEMENT_EXISTENCE&&(B.command.assertion.value=A.target.value)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Value"})})]},"element-check-assertion-value")),v.type===H0.ELEMENT_EXISTENCE&&D.push(d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Ka,{value:v.condition?v.negated?Co+v.condition:v.condition:sn.EXISTS,onValueChange:A=>{s(B=>{if(he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&B.command.assertion.type===H0.ELEMENT_EXISTENCE){const j=A.startsWith(Co),R=j?A.slice(Co.length):A;if(!_vu(R))return;B.command.assertion.type=H0.ELEMENT_EXISTENCE,B.command.assertion.condition=R,B.command.assertion.negated=j,E(A0(B))}})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select an assertion type"})}),d.jsxs(wa,{children:[RI.map(A=>d.jsx(Re,{value:A,children:aru[A]},A)),RI.map(A=>d.jsx(Re,{value:Co+A,children:tru[A]},Co+A))]})]}),v.condition===sn.EDITABLE&&d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Warning",size:"icon-xs",children:d.jsx(Gf,{className:"text-yellow-600"})})}),d.jsx(n0,{className:"max-w-xs",children:"Editable checks are not supported on native elements."})]})]},"element-check-assertion-condition")),D.push(d.jsxs(we,{children:[d.jsx(ht,{value:o.command.timeout??null,min:0,onChange:A=>{s(B=>{he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&(B.command.timeout=A??void 0,E(A0(B)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Timeout"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"s"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Maximum number of seconds to wait for the assertion to pass. At least two attempts will be made. Defaults to 5 seconds."})]})})]},"screen-check-timeout"));break}case G.DRAG_AND_DROP:{c.push(d.jsxs(we,{children:[d.jsx(tt,{value:B5(o.command.fromTarget),autoFocus:!0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.DRAG_AND_DROP)&&(A.command.id=_a(),A.command.fromTarget={type:"description",description:v.target.value})})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"From"})})]},"drag-from"),d.jsxs(we,{children:[d.jsx(tt,{value:B5(o.command.toTarget),onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.DRAG_AND_DROP)&&(A.command.id=_a(),A.command.toTarget={type:"description",description:v.target.value})})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"To"})})]},"drag-to")),D.push(d.jsxs(we,{children:[d.jsx(ht,{value:o.command.hoverDuration??null,min:0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.DRAG_AND_DROP)&&(A.command.hoverDuration=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Hover duration"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"ms"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Number of milliseconds to hold the element after finishing the drag. Defaults to 500ms."})]})})]},"drag-hover-duration"),d.jsxs(we,{children:[d.jsx(ht,{value:o.command.dragDuration??null,min:0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.DRAG_AND_DROP)&&(A.command.dragDuration=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Drag duration"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"ms"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Number of milliseconds to take for the drag movement. Defaults to 1000ms."})]})})]},"drag-duration"));break}case G.OPEN_APP:D.push(d.jsx(IYe,{value:o.command.packageName,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.OPEN_APP)&&(A.command.packageName=v)})},onBlur:l,sessionId:n},"open-app-package-name"),d.jsxs(we,{children:[d.jsx(tt,{value:o.command.activityName,onChange:v=>{s(A=>{if(he(A,Tu.PRESET)&&be(A.command,G.OPEN_APP)){if(!v.target.value){A.command.activityName=void 0;return}A.command.activityName=v.target.value}})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Activity"})})]},"open-app-activity-name"),d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.intentExtras||"",onChange:v=>{s(A=>{if(he(A,Tu.PRESET)&&be(A.command,G.OPEN_APP)){const B=v.target.value.trim();A.command.intentExtras=B||void 0}})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Intent extras"})})]},"open-app-intent-extras"));break;case G.OPEN_NOTIFICATION_DRAWER:break;case G.ADB:D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.command,autoFocus:!0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.ADB)&&(A.command.command=v.target.value)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Command"})})]},"adb-command"),d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.jsonArgs||"",onChange:v=>{s(A=>{if(he(A,Tu.PRESET)&&be(A.command,G.ADB)){const B=v.target.value.trim();A.command.jsonArgs=B||void 0}})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Arguments"})})]},"adb-args"));break;case G.JAVASCRIPT:D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.code,autoFocus:!0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.JAVASCRIPT)&&(A.command.code=v.target.value)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Code"})})]},"javascript-code"),d.jsxs(we,{children:[d.jsx(ht,{value:o.command.timeout??null,min:0,max:120,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.JAVASCRIPT)&&(A.command.timeout=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Timeout"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"s"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"The maximum amount of time to wait for the code to complete in seconds. Defaults to 15 seconds."})]})})]},"javascript-timeout")),h.push(d.jsxs(we,{children:[d.jsx(tt,{placeholder:"ENV_VAR_NAME",value:o.envKey||"",onChange:v=>{const A=v.target.value.trim();s(B=>{he(B,Tu.PRESET)&&be(B.command,G.JAVASCRIPT)&&(B.envKey=A||void 0)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Variable name"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Store the output of this step onto the environment with the given variable name."})]})})]},"javascript-env"));break;case G.WAIT:D.push(d.jsxs(we,{children:[d.jsx(ht,{value:o.command.timeoutSecs,min:0,max:1800,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.WAIT)&&(A.command.timeoutSecs=v??0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Duration"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"s"})})]},"wait-timeout"));break;case G.REQUEST:D.push(d.jsxs(ph,{onOpenChange:l,children:[d.jsx(gh,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",className:"w-fit",children:[d.jsx(_7,{}),"Configure request"]})}),d.jsx(R3,{className:"w-[700px]",side:"right",align:"start",children:d.jsx(FYe,{command:o.command,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.REQUEST)&&(A.command={...v,type:G.REQUEST})})}})})]},"request-config")),h.push(d.jsxs(we,{children:[d.jsx(tt,{placeholder:"ENV_VAR_NAME",value:o.envKey||"",onChange:v=>{const A=v.target.value.trim();s(B=>{he(B,Tu.PRESET)&&be(B.command,G.REQUEST)&&(B.envKey=A||void 0)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Variable name"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Store the output of this step onto the environment with the given variable name."})]})})]},"request-env"));break;case G.ADD_FILE:D.push(d.jsxs(we,{children:[d.jsx(tt,{placeholder:"https://example.com/file.txt",autoFocus:!0,value:o.command.file,onChange:v=>{const A=v.target.value;s(B=>{he(B,Tu.PRESET)&&be(B.command,G.ADD_FILE)&&(B.command.file=A)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"File"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsxs(n0,{className:"max-w-xs",children:["File to upload. This can either be a path on the local filesystem, or a URL.",d.jsx("br",{}),d.jsx("br",{}),"Accepted formats:",d.jsx("br",{}),"/Users/Name/Downloads/example.txt",d.jsx("br",{}),"https://example.com/example.txt"]})]})})]},"file-path"),d.jsx(j00,{value:o.command.storageLocation,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.ADD_FILE)&&(A.command.storageLocation=v)})},onBlur:l},"storage-location"));break;case G.INSTALL_APP:D.push(d.jsxs(we,{children:[d.jsx(tt,{placeholder:"/Users/wwu/Download/app.apk",autoFocus:!0,value:o.command.uri,onChange:v=>{const A=v.target.value;s(B=>{he(B,Tu.PRESET)&&be(B.command,G.INSTALL_APP)&&(B.command.uri=A)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"APK URI"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"A publicly accessible URL to an APK, or a path to a file on disk. Non-absolute paths are resolved relative to the Momentic project root."})]})})]},"storage-location"));break;case G.UNINSTALL_APP:D.push(d.jsxs(we,{children:[d.jsx(tt,{autoFocus:!0,placeholder:"com.android.chrome",value:o.command.packageName,onChange:v=>{const A=v.target.value;s(B=>{he(B,Tu.PRESET)&&be(B.command,G.UNINSTALL_APP)&&(B.command.packageName=A)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Package name"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"The package name of the APK package to uninstall."})]})})]},"package-name"));break;case G.KILL_APP:break;case G.STATE:break;case G.TOGGLE_SETTINGS:D.push(d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Ka,{value:o.command.settingsType,onValueChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.TOGGLE_SETTINGS)&&(A.command.settingsType=v,E(A0(A)))})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select setting"})}),d.jsxs(wa,{children:[d.jsx(Re,{value:ui.AIRPLANE_MODE,children:"Airplane mode"}),d.jsx(Re,{value:ui.DATA,children:"Data"}),d.jsx(Re,{value:ui.WIFI,children:"Wi-Fi"}),d.jsx(Re,{value:ui.LOCATION,children:"Location"})]})]}),[ui.AIRPLANE_MODE,ui.WIFI].includes(o.command.settingsType)&&d.jsx("div",{className:"flex items-center gap-1 text-xs text-gray-500",children:d.jsx("span",{children:"Local emulator only"})})]},"settings-type"));break;case G.SCROLL_TO:{c.push(d.jsxs(we,{children:[d.jsx(tt,{value:o.command.target.description,autoFocus:!0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCROLL_TO)&&(A.command.id=_a(),A.command.target={type:"description",description:v.target.value})})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Element"})})]},"scroll-to-element")),D.push(d.jsxs(Q5,{type:"single",variant:"outline",className:"justify-start",value:o.command.direction,onValueChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCROLL_TO)&&(A.command.direction=v,E(A0(A)))})},children:[d.jsx(Wr,{value:"up",children:"Up"}),d.jsx(Wr,{value:"down",children:"Down"})]},"scroll-to-direction"),d.jsx(jI,{value:o.command.scrollableElement,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCROLL_TO)&&(A.command.scrollableElement=v,A.command.scrollableElement.type!==W0.CUSTOM&&E(A0(A)))})},onBlur:l},"scroll-to-container"),o.command.scrollableElement.type!==W0.CUSTOM_COORDINATES&&d.jsxs(we,{children:[d.jsx(ht,{value:o.command.scrollStepPercent!==void 0?o.command.scrollStepPercent*100:null,min:10,max:100,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCROLL_TO)&&(A.command.scrollStepPercent=v!==null?v/100:void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Scroll step"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"%"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"How much of the container height to scroll at each step while searching for the element. Defaults to 80%. Smaller values are more precise but take longer."})]})})]},"scroll-to-step-percent"));break}default:o.command}break}const f=[d.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 py-1",children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsx(PYe,{value:i,modules:u,onSwitch:v=>{switch(v.type){case Tu.AI_ACTION:a==null||a({id:_a(),type:Tu.AI_ACTION,text:""});break;case Tu.PRESET:a==null||a({id:_a(),type:Tu.PRESET,command:sq(v.command)});break;case I0.MODULE:a==null||a({...v,id:_a(),type:I0.MODULE});break}}})}),d.jsx(Ve,{variant:"outline",size:"icon",onClick:t,"aria-label":"Run step",children:d.jsx(KV,{className:"h-4 w-4"})})]},"header"),m.length?d.jsx(XE,{title:"Module",children:m},"module"):null,x.length?d.jsx(XE,{title:"Inputs",children:x},"inputs"):null,c.length?d.jsx(XE,{title:"Target",children:c},"target"):null,D.length?d.jsx(XE,{title:"Action",children:D},"action"):null,h.length?d.jsxs(XE,{title:"Output",children:[h,e.data!==void 0&&d.jsx(Itu,{data:{data:e.data}})]},"output"):null,d.jsx(LYe,{step:r,onChange:a},"execution"),e.type==="STEP_STATE"&&e.aiActionEventLogs&&e.aiActionEventLogs.length>0?d.jsx("div",{className:"px-2 py-1",children:d.jsxs(ZO,{defaultOpen:!0,children:[d.jsx(QO,{className:"h-9",children:d.jsx(xt,{children:"Agent trajectory"})}),d.jsx(qO,{children:e.aiActionEventLogs.map((v,A,B)=>{const j=A===B.length-1?"active":"complete";switch(v.type){case Dh.LLM_TEXT_OUTPUT:return d.jsx(vg,{label:v.text,status:j,icon:d.jsx(jV,{className:"size-4"})},A);case Dh.SUBSTEP_CREATED:return d.jsx(vg,{label:"Running step",icon:kb(v.step)?Bc[v.step.command.type]:Bc[v.step.type],status:j,children:d.jsx(g9,{step:v.step})},A)}})})]})},"agent-trajectory"):null,[E0.SUCCESS,E0.FAILED,E0.CANCELLED].includes(e.status)?d.jsx(XE,{title:"Result",children:d.jsxs("div",{className:"flex items-center",children:[d.jsx("div",{className:"shrink-0 self-start pl-1 pr-2",children:e.status===E0.SUCCESS?d.jsx(d1,{className:"size-4 text-green-500"}):e.status===E0.FAILED?d.jsx(FE,{className:"text-destructive size-4"}):d.jsx(lDu,{className:"size-4 text-yellow-600"})}),d.jsx("div",{className:"text-sm",children:e.message??Zyu(e.status)})]})},"result"):null,e.trace?d.jsx(NYe,{trace:e.trace},"trace"):null].filter(Boolean);return d.jsx(d.Fragment,{children:L00(f)})},I00=2e3,K00=({testPath:e,test:u,pathSegments:a})=>{var Ie;const t=Ci(),{data:n=[]}=fC(),{limbar:r,canceling:i,executing:o,canExecute:s,error:l,connectionStatusUpdate:E,editorState:c,editingUniqueId:D,selectedUniqueIds:h,logcatLogs:m,a11yTreeResponse:x,isLoadingA11yTree:p,sessionLoaded:f,sessionId:g,testContext:F,viewport:b,handleCancel:y,handleRunSingleStep:v,handleRunFromStep:A,handleRunAllSteps:B,handleEdit:j,handleDelete:R,handleAddStep:w,handleStepChange:O,handleDuplicate:T,handleFetchA11yTree:z,handleMove:N,handleSelect:M,handleCreateModuleSuccess:I,setLastUserEventTime:P}=xIe({websocketUrl:jnu,test:u,testPath:e}),{data:L}=mz(),K=C.useMemo(()=>(L==null?void 0:L.modules.map(Zu=>Zu.content))||[],[L==null?void 0:L.modules]),W=C.useMemo(()=>c.rootIds.map(Gu=>c.steps[Gu]||c.modules[Gu]).filter(J6).map(L4),[c]),[_,Q]=C.useState(W),eu=C.useMemo(()=>{const Zu=Tp(_,W);return Object.keys(Zu).length>0},[_,W]),[U,iu]=a_e(W,I00);C.useEffect(()=>{iu(W)},[iu,W]);const[tu,Y]=Ws(async(Zu=!0)=>{if(!eu)return;const Gu={steps:W};try{await t(`/api/mobile-tests/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(Gu)}),Zu&&Ca.success("Test saved!"),Q(Gu.steps||[])}catch(fe){Ca.error("Failed to save test.",{description:`${fe}`})}},[e,W,eu]),[,ou]=Ws(async Zu=>{const Gu={...u.settings??{}};Zu?Gu.defaultEnv=Zu:delete Gu.defaultEnv;const fe={settings:Gu};try{await t(`/api/mobile-tests/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)}),Ca.success("Default environment updated!"),window.location.reload()}catch(V){Ca.error("Failed to update environment.",{description:`${V}`})}},[t,u.settings,e]),Cu=[];for(let Zu=0;Zu<a.length-1;Zu++)Cu.push(d.jsx(Ro,{children:d.jsx(QD,{asChild:!0,children:d.jsx(uo,{to:`/browse/${a.slice(0,Zu+1).join("/")}`,children:a[Zu]})})},Zu)),Cu.push(d.jsx(qD,{},`separator-${Zu}`));const Au=y0(Y);C.useEffect(()=>{Au(!1)},[Au,U]);const mu=C.useMemo(()=>{if(!D)return null;const{stepId:Zu,parentStepIdChain:Gu}=E4(D);return Oi(c,Gu,Zu)},[D,c]),Nu=C.useMemo(()=>{const Zu=[];return h.forEach(Gu=>{const fe=c.steps[Gu];if(!fe)return;const V=L4(fe);Zu.push(V)}),Zu},[h,c]),[le,Yu]=C.useState(void 0),ve=C.useCallback(Zu=>{if(P(),!b){Yu(void 0);return}const Gu=Zu.currentTarget.getBoundingClientRect(),fe=b.right-b.left,V=b.bottom-b.top;if(!Gu.width||!Gu.height||fe<=0||V<=0){Yu(void 0);return}const au=fe/V,du=Gu.width/Gu.height,bu=du>au?Gu.height*au:Gu.width,pu=du>au?Gu.height:Gu.width/au,xu=(Gu.width-bu)/2,Lu=(Gu.height-pu)/2,He=Zu.clientX-Gu.left-xu,yu=Zu.clientY-Gu.top-Lu;if(He<0||yu<0||He>bu||yu>pu){Yu(void 0);return}const Ke=He/bu,t0=yu/pu,N0=Math.min(Math.max(Ke,0),1),ja=Math.min(Math.max(t0,0),1);Yu({x:Math.round(b.left+N0*fe),y:Math.round(b.top+ja*V)})},[b,P]);return d.jsxs("div",{className:"grid h-full max-h-screen min-h-screen w-full grid-rows-[auto_minmax(0px,_1fr)] overflow-hidden",children:[d.jsxs("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[d.jsx(hm,{children:d.jsxs(mm,{children:[d.jsx(Ro,{children:d.jsx(QD,{asChild:!0,children:d.jsx(uo,{to:"/browse",children:"Repository"})})}),d.jsx(qD,{}),Cu,d.jsx(Ro,{children:d.jsx(m3,{children:a[a.length-1]})})]})}),d.jsx(Hwe,{}),d.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[d.jsx(i_e,{value:(Ie=u.settings)==null?void 0:Ie.defaultEnv,options:n,onChange:Zu=>{ou(Zu)}}),d.jsx(n_e,{testPath:e,onSuccess:()=>{window.location.reload()}})]})]}),d.jsxs("div",{className:lu("grid h-full w-full grid-cols-[auto_auto_minmax(0px,_1fr)]",{"grid-cols-[auto_minmax(0px,_1fr)]":!mu}),children:[d.jsxs("div",{className:"grid w-[20vw] min-w-[350px] grid-rows-[auto_auto_auto_1fr] overflow-auto border-r",children:[d.jsx("div",{className:"flex flex-col border-b",children:d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[d.jsx(Ve,{variant:"outline",size:"icon",className:"ml-auto",onClick:()=>void Y(),disabled:!eu||tu.loading,children:tu.loading?d.jsx(zDu,{className:"h-4 w-4 animate-spin"}):d.jsx(wDu,{className:"h-4 w-4"})}),d.jsx(pIe,{testId:u.id,testPath:e,disabled:Nu.length===0,steps:Nu,onSuccess:I}),i?d.jsxs(o0,{defaultOpen:!0,children:[d.jsx(s0,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",className:"text-destructive hover:text-destructive",children:[d.jsx(L7,{className:"h-4 w-4"}),"Canceling"]})}),d.jsx(n0,{side:"bottom",className:"max-w-xs",children:"Waiting for the current step to finish executing. This may take a few seconds."})]}):o?d.jsxs(Ve,{variant:"outline",className:"text-destructive hover:text-destructive",onClick:y,children:[d.jsx(L7,{className:"h-4 w-4"}),"Cancel"]}):d.jsxs(Ve,{onClick:B,disabled:!s||!f,children:[d.jsx(KV,{className:"h-4 w-4"}),"Run"]})]})}),d.jsx(Hje,{backend:jNe,children:d.jsx("div",{className:"overflow-auto",children:c.rootIds.map((Zu,Gu)=>{const fe=c.steps[Zu]||c.modules[Zu];return fe?d.jsx(mru,{index:Gu,state:fe,editingUniqueId:D,selectedUniqueIds:h,droppableUniqueIds:c.rootIds,modules:K,onEdit:j,onSelect:M,onChange:O,onDuplicate:T,onDelete:R,onExecute:v,onExecuteFrom:A,onMove:N,onAddBefore:(V,au)=>{w(V,au,"before")},onAddAfter:(V,au)=>{w(V,au,"after")}},Zu):null})})}),d.jsx("div",{className:"my-2 flex items-center justify-center",children:d.jsx(E_e,{modules:K,onAdd:Zu=>{w(Zu,null,"after")}})}),d.jsx("div",{})]}),D&&mu&&d.jsx("div",{className:"w-[20vw] min-w-[350px] overflow-auto border-r",children:d.jsx(_00,{state:mu,modules:K,onChange:Zu=>{O(D,Zu)},onClose:()=>{j(void 0)},onExecute:()=>{v(D)},sessionId:g})}),d.jsx("div",{className:"h-full overflow-hidden",children:d.jsxs(Mau,{direction:"vertical",className:"h-full",children:[d.jsx(zp,{defaultSize:75,children:l?d.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2",children:[d.jsx("h2",{className:"text-xl font-semibold",children:"An unexpected error happened!"}),d.jsxs("div",{className:"text-destructive max-w-lg",children:["Error:"," ",typeof l=="string"?l:JSON.stringify(l)]}),d.jsxs("div",{className:"text-muted-foreground max-w-lg text-center",children:["We apologize for the inconvenience. We have been notified of this problem. If the issue persists please contact"," ",d.jsx("a",{href:"mailto:support@momentic.ai",className:"text-primary hover:underline",children:"support@momentic.ai"}),"."]}),d.jsx(Ve,{variant:"outline",onClick:()=>{window.location.reload()},children:"Reconnect"})]}):r?d.jsxs("div",{className:"relative mx-auto h-full max-h-full max-w-full",onPointerMove:ve,children:[d.jsx(Iwe,{token:r.token,url:r.rtcUrl,sessionId:g}),b&&le?d.jsxs("div",{className:"bg-foreground text-background pointer-events-none absolute bottom-1 right-1 rounded p-1 text-xs opacity-50",children:["X: ",le.x,", Y: ",le.y]}):null,E&&E.type===cD.DISCONNECTED&&d.jsx("div",{className:"bg-background/80 absolute inset-0 z-10 flex items-center justify-center backdrop-blur-sm",children:d.jsx("div",{className:"bg-card mx-auto max-w-md rounded-lg border p-6 shadow-lg",children:d.jsxs("div",{className:"flex flex-col items-center gap-4",children:[d.jsx(Gf,{className:"h-8 w-8 text-yellow-500"}),d.jsx("p",{className:"text-center text-sm",children:E.message}),d.jsx(Ve,{variant:"outline",onClick:()=>{window.location.reload()},children:"Reconnect"})]})})})]}):d.jsx("div",{className:"flex h-full w-full items-center justify-center",children:d.jsx("h2",{className:"text-xl font-semibold",children:(E==null?void 0:E.message)||"Connecting to emulator..."})})}),d.jsx(Tau,{withHandle:!0}),d.jsx(zp,{defaultSize:25,children:d.jsxs(Tm,{defaultValue:"context",className:"flex h-full flex-col p-2",children:[d.jsxs(Od,{className:"self-start",children:[d.jsx(On,{value:"context",children:"Context"}),d.jsx(On,{value:"logcat",children:"Logcat"}),d.jsx(On,{value:"accessibility",children:"Accessibility"})]}),d.jsx(wn,{value:"context",className:"flex-1 overflow-auto",children:d.jsxs("div",{className:"grid h-full grid-rows-[auto_1fr] gap-2",children:[d.jsxs("p",{className:"text-muted-foreground text-sm",children:["You can access these values directly in a JavaScript step, or using the special"," ",d.jsx("span",{className:"text-foreground whitespace-nowrap font-mono",children:"{{ }}"})," ","syntax in other steps. For example, you can get the current URL with"," ",d.jsxs("span",{className:"text-foreground whitespace-nowrap font-mono",children:["{{ env.CURRENT_URL }}","."]})," ",d.jsx(xh,{slug:"/variables"})]}),F&&d.jsx(Itu,{data:F})]})}),d.jsx(wn,{value:"logcat",className:"h-full flex-1 overflow-hidden",children:d.jsx(dN,{FallbackComponent:NT,children:d.jsx(oRe,{logs:m})})}),d.jsx(wn,{value:"accessibility",className:"h-full flex-1 overflow-hidden",children:d.jsxs("div",{className:"flex h-full flex-col gap-2",children:[d.jsxs("div",{className:"flex flex-row gap-2",children:[d.jsxs(Ve,{onClick:z,disabled:p||!s||!f,variant:"secondary",size:"sm",children:[p&&d.jsx(n8,{className:"h-4 w-4 animate-spin"})," ","Load current page accessibility tree"]}),(x==null?void 0:x.a11yTree)&&d.jsx(Ve,{onClick:()=>{const Zu=new Blob([x.a11yTree],{type:"application/xml"});s_e("snapshot.xml",Zu)},variant:"secondary",size:"sm",children:"Download accessibility tree"})]}),d.jsx("div",{className:"flex-1",children:x!=null&&x.a11yTree?d.jsx(dN,{FallbackComponent:NT,children:d.jsx(jLe,{xml:x.a11yTree,dataType:"html"})}):x!=null&&x.err?d.jsxs("div",{className:"pl-2",children:[d.jsx("p",{className:"text-muted-foreground text-sm",children:"An error occurred while fetching the a11y tree."}),d.jsxs("p",{className:"text-destructive text-sm",children:["Error: ",x.err]})]}):x&&!x.a11yTree?d.jsx("p",{className:"text-muted-foreground pl-2 text-sm",children:"No a11y tree snapshot available."}):null})]})})]})})]})})]})]})};function $00(){const{"*":e=""}=cV(),{data:u,error:a}=Pm(e);return a?d.jsx(jwe,{err:a}):u?d.jsx(K00,{test:u,testPath:e,pathSegments:e.split("/")}):null}const V00=U3u([{path:"/",errorElement:d.jsx(Ugu,{}),children:[{index:!0,element:d.jsx(xV,{to:"/browse",replace:!0})},{element:d.jsx(Pwe,{}),children:[{path:"search",element:d.jsx(iOe,{})},{path:"assets",element:d.jsx(pvu,{})},{path:"environments",element:d.jsx(Hze,{})},{path:"browse/*",element:d.jsx($ze,{})}]},{path:"tests/*",element:d.jsx($00,{})}]}]);S7.createRoot(document.getElementById("root")).render(d.jsx(nu.StrictMode,{children:d.jsx(ldu,{children:d.jsx(Hdu,{value:{fetcher:o_e},children:d.jsx(kG,{sidebarWidth:"auto",children:d.jsxs(CG,{delayDuration:0,children:[d.jsx(tdu,{router:V00}),d.jsx(Jgu,{richColors:!0,closeButton:!0})]})})})})}));
|
|
744
|
+
`]))),re0=function(u,a){var t=u.isFocused,n=u.size,r=u.theme,i=r.colors,o=r.spacing.baseUnit;return ye({label:"loadingIndicator",display:"flex",transition:"color 150ms",alignSelf:"center",fontSize:n,lineHeight:1,marginRight:n,textAlign:"center",verticalAlign:"middle"},a?{}:{color:t?i.neutral60:i.neutral20,padding:o*2})},kA=function(u){var a=u.delay,t=u.offset;return ze("span",{css:lw({animation:"".concat(ne0," 1s ease-in-out ").concat(a,"ms infinite;"),backgroundColor:"currentColor",borderRadius:"1em",display:"inline-block",marginLeft:t?"1em":void 0,height:"1em",verticalAlign:"top",width:"1em"},"","")})},ie0=function(u){var a=u.innerProps,t=u.isRtl,n=u.size,r=n===void 0?4:n,i=ds(u,Qu0);return ze("div",Me({},Ma(ye(ye({},i),{},{innerProps:a,isRtl:t,size:r}),"loadingIndicator",{indicator:!0,"loading-indicator":!0}),a),ze(kA,{delay:0,offset:t}),ze(kA,{delay:160,offset:!0}),ze(kA,{delay:320,offset:!t}))},oe0=function(u,a){var t=u.isDisabled,n=u.isFocused,r=u.theme,i=r.colors,o=r.borderRadius,s=r.spacing;return ye({label:"control",alignItems:"center",cursor:"default",display:"flex",flexWrap:"wrap",justifyContent:"space-between",minHeight:s.controlHeight,outline:"0 !important",position:"relative",transition:"all 100ms"},a?{}:{backgroundColor:t?i.neutral5:i.neutral0,borderColor:t?i.neutral10:n?i.primary:i.neutral20,borderRadius:o,borderStyle:"solid",borderWidth:1,boxShadow:n?"0 0 0 1px ".concat(i.primary):void 0,"&:hover":{borderColor:n?i.primary:i.neutral30}})},se0=function(u){var a=u.children,t=u.isDisabled,n=u.isFocused,r=u.innerRef,i=u.innerProps,o=u.menuIsOpen;return ze("div",Me({ref:r},Ma(u,"control",{control:!0,"control--is-disabled":t,"control--is-focused":n,"control--menu-is-open":o}),i,{"aria-disabled":t||void 0}),a)},le0=se0,Ee0=["data"],ce0=function(u,a){var t=u.theme.spacing;return a?{}:{paddingBottom:t.baseUnit*2,paddingTop:t.baseUnit*2}},de0=function(u){var a=u.children,t=u.cx,n=u.getStyles,r=u.getClassNames,i=u.Heading,o=u.headingProps,s=u.innerProps,l=u.label,E=u.theme,c=u.selectProps;return ze("div",Me({},Ma(u,"group",{group:!0}),s),ze(i,Me({},o,{selectProps:c,theme:E,getStyles:n,getClassNames:r,cx:t}),l),ze("div",null,a))},De0=function(u,a){var t=u.theme,n=t.colors,r=t.spacing;return ye({label:"group",cursor:"default",display:"block"},a?{}:{color:n.neutral40,fontSize:"75%",fontWeight:500,marginBottom:"0.25em",paddingLeft:r.baseUnit*3,paddingRight:r.baseUnit*3,textTransform:"uppercase"})},he0=function(u){var a=v1u(u);a.data;var t=ds(a,Ee0);return ze("div",Me({},Ma(u,"groupHeading",{"group-heading":!0}),t))},me0=de0,xe0=["innerRef","isDisabled","isHidden","inputClassName"],fe0=function(u,a){var t=u.isDisabled,n=u.value,r=u.theme,i=r.spacing,o=r.colors;return ye(ye({visibility:t?"hidden":"visible",transform:n?"translateZ(0)":""},pe0),a?{}:{margin:i.baseUnit/2,paddingBottom:i.baseUnit/2,paddingTop:i.baseUnit/2,color:o.neutral80})},M1u={gridArea:"1 / 2",font:"inherit",minWidth:"2px",border:0,margin:0,outline:0,padding:0},pe0={flex:"1 1 auto",display:"inline-grid",gridArea:"1 / 1 / 2 / 3",gridTemplateColumns:"0 min-content","&:after":ye({content:'attr(data-value) " "',visibility:"hidden",whiteSpace:"pre"},M1u)},ge0=function(u){return ye({label:"input",color:"inherit",background:0,opacity:u?0:1,width:"100%"},M1u)},Ce0=function(u){var a=u.cx,t=u.value,n=v1u(u),r=n.innerRef,i=n.isDisabled,o=n.isHidden,s=n.inputClassName,l=ds(n,xe0);return ze("div",Me({},Ma(u,"input",{"input-container":!0}),{"data-value":t||""}),ze("input",Me({className:a({input:!0},s),ref:r,style:ge0(o),disabled:i},l)))},Fe0=Ce0,ke0=function(u,a){var t=u.theme,n=t.spacing,r=t.borderRadius,i=t.colors;return ye({label:"multiValue",display:"flex",minWidth:0},a?{}:{backgroundColor:i.neutral10,borderRadius:r/2,margin:n.baseUnit/2})},ve0=function(u,a){var t=u.theme,n=t.borderRadius,r=t.colors,i=u.cropWithEllipsis;return ye({overflow:"hidden",textOverflow:i||i===void 0?"ellipsis":void 0,whiteSpace:"nowrap"},a?{}:{borderRadius:n/2,color:r.neutral80,fontSize:"85%",padding:3,paddingLeft:6})},Ae0=function(u,a){var t=u.theme,n=t.spacing,r=t.borderRadius,i=t.colors,o=u.isFocused;return ye({alignItems:"center",display:"flex"},a?{}:{borderRadius:r/2,backgroundColor:o?i.dangerLight:void 0,paddingLeft:n.baseUnit,paddingRight:n.baseUnit,":hover":{backgroundColor:i.dangerLight,color:i.danger}})},T1u=function(u){var a=u.children,t=u.innerProps;return ze("div",t,a)},be0=T1u,ye0=T1u;function Be0(e){var u=e.children,a=e.innerProps;return ze("div",Me({role:"button"},a),u||ze(Dw,{size:14}))}var Se0=function(u){var a=u.children,t=u.components,n=u.data,r=u.innerProps,i=u.isDisabled,o=u.removeProps,s=u.selectProps,l=t.Container,E=t.Label,c=t.Remove;return ze(l,{data:n,innerProps:ye(ye({},Ma(u,"multiValue",{"multi-value":!0,"multi-value--is-disabled":i})),r),selectProps:s},ze(E,{data:n,innerProps:ye({},Ma(u,"multiValueLabel",{"multi-value__label":!0})),selectProps:s},a),ze(c,{data:n,innerProps:ye(ye({},Ma(u,"multiValueRemove",{"multi-value__remove":!0})),{},{"aria-label":"Remove ".concat(a||"option")},o),selectProps:s}))},ze0=Se0,Oe0=function(u,a){var t=u.isDisabled,n=u.isFocused,r=u.isSelected,i=u.theme,o=i.spacing,s=i.colors;return ye({label:"option",cursor:"default",display:"block",fontSize:"inherit",width:"100%",userSelect:"none",WebkitTapHighlightColor:"rgba(0, 0, 0, 0)"},a?{}:{backgroundColor:r?s.primary:n?s.primary25:"transparent",color:t?s.neutral20:r?s.neutral0:"inherit",padding:"".concat(o.baseUnit*2,"px ").concat(o.baseUnit*3,"px"),":active":{backgroundColor:t?void 0:r?s.primary:s.primary50}})},we0=function(u){var a=u.children,t=u.isDisabled,n=u.isFocused,r=u.isSelected,i=u.innerRef,o=u.innerProps;return ze("div",Me({},Ma(u,"option",{option:!0,"option--is-disabled":t,"option--is-focused":n,"option--is-selected":r}),{ref:i,"aria-disabled":t},o),a)},Me0=we0,Te0=function(u,a){var t=u.theme,n=t.spacing,r=t.colors;return ye({label:"placeholder",gridArea:"1 / 1 / 2 / 3"},a?{}:{color:r.neutral50,marginLeft:n.baseUnit/2,marginRight:n.baseUnit/2})},Pe0=function(u){var a=u.children,t=u.innerProps;return ze("div",Me({},Ma(u,"placeholder",{placeholder:!0}),t),a)},je0=Pe0,Ne0=function(u,a){var t=u.isDisabled,n=u.theme,r=n.spacing,i=n.colors;return ye({label:"singleValue",gridArea:"1 / 1 / 2 / 3",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},a?{}:{color:t?i.neutral40:i.neutral80,marginLeft:r.baseUnit/2,marginRight:r.baseUnit/2})},Re0=function(u){var a=u.children,t=u.isDisabled,n=u.innerProps;return ze("div",Me({},Ma(u,"singleValue",{"single-value":!0,"single-value--is-disabled":t}),n),a)},Le0=Re0,_e0={ClearIndicator:ee0,Control:le0,DropdownIndicator:Xu0,DownChevron:O1u,CrossIcon:Dw,Group:me0,GroupHeading:he0,IndicatorsContainer:Uu0,IndicatorSeparator:te0,Input:Fe0,LoadingIndicator:ie0,Menu:Pu0,MenuList:Nu0,MenuPortal:$u0,LoadingMessage:Iu0,NoOptionsMessage:_u0,MultiValue:ze0,MultiValueContainer:be0,MultiValueLabel:ye0,MultiValueRemove:Be0,Option:Me0,Placeholder:je0,SelectContainer:Hu0,SingleValue:Le0,ValueContainer:Ju0},Ie0=function(u){return ye(ye({},_e0),u.components)},FI=Number.isNaN||function(u){return typeof u=="number"&&u!==u};function Ke0(e,u){return!!(e===u||FI(e)&&FI(u))}function $e0(e,u){if(e.length!==u.length)return!1;for(var a=0;a<e.length;a++)if(!Ke0(e[a],u[a]))return!1;return!0}function Ve0(e,u){u===void 0&&(u=$e0);var a=null;function t(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(a&&a.lastThis===this&&u(n,a.lastArgs))return a.lastResult;var i=e.apply(this,n);return a={lastResult:i,lastArgs:n,lastThis:this},i}return t.clear=function(){a=null},t}var He0={name:"7pg0cj-a11yText",styles:"label:a11yText;z-index:9999;border:0;clip:rect(1px, 1px, 1px, 1px);height:1px;width:1px;position:absolute;overflow:hidden;padding:0;white-space:nowrap"},Ge0=function(u){return ze("span",Me({css:He0},u))},kI=Ge0,Je0={guidance:function(u){var a=u.isSearchable,t=u.isMulti,n=u.tabSelectsValue,r=u.context,i=u.isInitialFocus;switch(r){case"menu":return"Use Up and Down to choose options, press Enter to select the currently focused option, press Escape to exit the menu".concat(n?", press Tab to select the option and exit the menu":"",".");case"input":return i?"".concat(u["aria-label"]||"Select"," is focused ").concat(a?",type to refine list":"",", press Down to open the menu, ").concat(t?" press left to focus selected values":""):"";case"value":return"Use left and right to toggle between focused values, press Backspace to remove the currently focused value";default:return""}},onChange:function(u){var a=u.action,t=u.label,n=t===void 0?"":t,r=u.labels,i=u.isDisabled;switch(a){case"deselect-option":case"pop-value":case"remove-value":return"option ".concat(n,", deselected.");case"clear":return"All selected options have been cleared.";case"initial-input-focus":return"option".concat(r.length>1?"s":""," ").concat(r.join(","),", selected.");case"select-option":return i?"option ".concat(n," is disabled. Select another option."):"option ".concat(n,", selected.");default:return""}},onFocus:function(u){var a=u.context,t=u.focused,n=u.options,r=u.label,i=r===void 0?"":r,o=u.selectValue,s=u.isDisabled,l=u.isSelected,E=u.isAppleDevice,c=function(x,p){return x&&x.length?"".concat(x.indexOf(p)+1," of ").concat(x.length):""};if(a==="value"&&o)return"value ".concat(i," focused, ").concat(c(o,t),".");if(a==="menu"&&E){var D=s?" disabled":"",h="".concat(l?" selected":"").concat(D);return"".concat(i).concat(h,", ").concat(c(n,t),".")}return""},onFilter:function(u){var a=u.inputValue,t=u.resultsMessage;return"".concat(t).concat(a?" for search term "+a:"",".")}},We0=function(u){var a=u.ariaSelection,t=u.focusedOption,n=u.focusedValue,r=u.focusableOptions,i=u.isFocused,o=u.selectValue,s=u.selectProps,l=u.id,E=u.isAppleDevice,c=s.ariaLiveMessages,D=s.getOptionLabel,h=s.inputValue,m=s.isMulti,x=s.isOptionDisabled,p=s.isSearchable,f=s.menuIsOpen,g=s.options,F=s.screenReaderStatus,b=s.tabSelectsValue,y=s.isLoading,v=s["aria-label"],A=s["aria-live"],B=C.useMemo(function(){return ye(ye({},Je0),c||{})},[c]),j=C.useMemo(function(){var N="";if(a&&B.onChange){var M=a.option,I=a.options,P=a.removedValue,L=a.removedValues,K=a.value,W=function(Y){return Array.isArray(Y)?null:Y},_=P||M||W(K),Q=_?D(_):"",eu=I||L||void 0,U=eu?eu.map(D):[],iu=ye({isDisabled:_&&x(_,o),label:Q,labels:U},a);N=B.onChange(iu)}return N},[a,B,x,o,D]),R=C.useMemo(function(){var N="",M=t||n,I=!!(t&&o&&o.includes(t));if(M&&B.onFocus){var P={focused:M,label:D(M),isDisabled:x(M,o),isSelected:I,options:r,context:M===t?"menu":"value",selectValue:o,isAppleDevice:E};N=B.onFocus(P)}return N},[t,n,D,x,B,r,o,E]),w=C.useMemo(function(){var N="";if(f&&g.length&&!y&&B.onFilter){var M=F({count:r.length});N=B.onFilter({inputValue:h,resultsMessage:M})}return N},[r,h,f,B,g,F,y]),O=(a==null?void 0:a.action)==="initial-input-focus",T=C.useMemo(function(){var N="";if(B.guidance){var M=n?"value":f?"menu":"input";N=B.guidance({"aria-label":v,context:M,isDisabled:t&&x(t,o),isMulti:m,isSearchable:p,tabSelectsValue:b,isInitialFocus:O})}return N},[v,t,n,m,x,p,f,B,o,b,O]),z=ze(C.Fragment,null,ze("span",{id:"aria-selection"},j),ze("span",{id:"aria-focused"},R),ze("span",{id:"aria-results"},w),ze("span",{id:"aria-guidance"},T));return ze(C.Fragment,null,ze(kI,{id:l},O&&z),ze(kI,{"aria-live":A,"aria-atomic":"false","aria-relevant":"additions text",role:"log"},i&&!O&&z))},Ue0=We0,uB=[{base:"A",letters:"AⒶAÀÁÂẦẤẪẨÃĀĂẰẮẴẲȦǠÄǞẢÅǺǍȀȂẠẬẶḀĄȺⱯ"},{base:"AA",letters:"Ꜳ"},{base:"AE",letters:"ÆǼǢ"},{base:"AO",letters:"Ꜵ"},{base:"AU",letters:"Ꜷ"},{base:"AV",letters:"ꜸꜺ"},{base:"AY",letters:"Ꜽ"},{base:"B",letters:"BⒷBḂḄḆɃƂƁ"},{base:"C",letters:"CⒸCĆĈĊČÇḈƇȻꜾ"},{base:"D",letters:"DⒹDḊĎḌḐḒḎĐƋƊƉꝹ"},{base:"DZ",letters:"DZDŽ"},{base:"Dz",letters:"DzDž"},{base:"E",letters:"EⒺEÈÉÊỀẾỄỂẼĒḔḖĔĖËẺĚȄȆẸỆȨḜĘḘḚƐƎ"},{base:"F",letters:"FⒻFḞƑꝻ"},{base:"G",letters:"GⒼGǴĜḠĞĠǦĢǤƓꞠꝽꝾ"},{base:"H",letters:"HⒽHĤḢḦȞḤḨḪĦⱧⱵꞍ"},{base:"I",letters:"IⒾIÌÍÎĨĪĬİÏḮỈǏȈȊỊĮḬƗ"},{base:"J",letters:"JⒿJĴɈ"},{base:"K",letters:"KⓀKḰǨḲĶḴƘⱩꝀꝂꝄꞢ"},{base:"L",letters:"LⓁLĿĹĽḶḸĻḼḺŁȽⱢⱠꝈꝆꞀ"},{base:"LJ",letters:"LJ"},{base:"Lj",letters:"Lj"},{base:"M",letters:"MⓂMḾṀṂⱮƜ"},{base:"N",letters:"NⓃNǸŃÑṄŇṆŅṊṈȠƝꞐꞤ"},{base:"NJ",letters:"NJ"},{base:"Nj",letters:"Nj"},{base:"O",letters:"OⓄOÒÓÔỒỐỖỔÕṌȬṎŌṐṒŎȮȰÖȪỎŐǑȌȎƠỜỚỠỞỢỌỘǪǬØǾƆƟꝊꝌ"},{base:"OI",letters:"Ƣ"},{base:"OO",letters:"Ꝏ"},{base:"OU",letters:"Ȣ"},{base:"P",letters:"PⓅPṔṖƤⱣꝐꝒꝔ"},{base:"Q",letters:"QⓆQꝖꝘɊ"},{base:"R",letters:"RⓇRŔṘŘȐȒṚṜŖṞɌⱤꝚꞦꞂ"},{base:"S",letters:"SⓈSẞŚṤŜṠŠṦṢṨȘŞⱾꞨꞄ"},{base:"T",letters:"TⓉTṪŤṬȚŢṰṮŦƬƮȾꞆ"},{base:"TZ",letters:"Ꜩ"},{base:"U",letters:"UⓊUÙÚÛŨṸŪṺŬÜǛǗǕǙỦŮŰǓȔȖƯỪỨỮỬỰỤṲŲṶṴɄ"},{base:"V",letters:"VⓋVṼṾƲꝞɅ"},{base:"VY",letters:"Ꝡ"},{base:"W",letters:"WⓌWẀẂŴẆẄẈⱲ"},{base:"X",letters:"XⓍXẊẌ"},{base:"Y",letters:"YⓎYỲÝŶỸȲẎŸỶỴƳɎỾ"},{base:"Z",letters:"ZⓏZŹẐŻŽẒẔƵȤⱿⱫꝢ"},{base:"a",letters:"aⓐaẚàáâầấẫẩãāăằắẵẳȧǡäǟảåǻǎȁȃạậặḁąⱥɐ"},{base:"aa",letters:"ꜳ"},{base:"ae",letters:"æǽǣ"},{base:"ao",letters:"ꜵ"},{base:"au",letters:"ꜷ"},{base:"av",letters:"ꜹꜻ"},{base:"ay",letters:"ꜽ"},{base:"b",letters:"bⓑbḃḅḇƀƃɓ"},{base:"c",letters:"cⓒcćĉċčçḉƈȼꜿↄ"},{base:"d",letters:"dⓓdḋďḍḑḓḏđƌɖɗꝺ"},{base:"dz",letters:"dzdž"},{base:"e",letters:"eⓔeèéêềếễểẽēḕḗĕėëẻěȅȇẹệȩḝęḙḛɇɛǝ"},{base:"f",letters:"fⓕfḟƒꝼ"},{base:"g",letters:"gⓖgǵĝḡğġǧģǥɠꞡᵹꝿ"},{base:"h",letters:"hⓗhĥḣḧȟḥḩḫẖħⱨⱶɥ"},{base:"hv",letters:"ƕ"},{base:"i",letters:"iⓘiìíîĩīĭïḯỉǐȉȋịįḭɨı"},{base:"j",letters:"jⓙjĵǰɉ"},{base:"k",letters:"kⓚkḱǩḳķḵƙⱪꝁꝃꝅꞣ"},{base:"l",letters:"lⓛlŀĺľḷḹļḽḻſłƚɫⱡꝉꞁꝇ"},{base:"lj",letters:"lj"},{base:"m",letters:"mⓜmḿṁṃɱɯ"},{base:"n",letters:"nⓝnǹńñṅňṇņṋṉƞɲʼnꞑꞥ"},{base:"nj",letters:"nj"},{base:"o",letters:"oⓞoòóôồốỗổõṍȭṏōṑṓŏȯȱöȫỏőǒȍȏơờớỡởợọộǫǭøǿɔꝋꝍɵ"},{base:"oi",letters:"ƣ"},{base:"ou",letters:"ȣ"},{base:"oo",letters:"ꝏ"},{base:"p",letters:"pⓟpṕṗƥᵽꝑꝓꝕ"},{base:"q",letters:"qⓠqɋꝗꝙ"},{base:"r",letters:"rⓡrŕṙřȑȓṛṝŗṟɍɽꝛꞧꞃ"},{base:"s",letters:"sⓢsßśṥŝṡšṧṣṩșşȿꞩꞅẛ"},{base:"t",letters:"tⓣtṫẗťṭțţṱṯŧƭʈⱦꞇ"},{base:"tz",letters:"ꜩ"},{base:"u",letters:"uⓤuùúûũṹūṻŭüǜǘǖǚủůűǔȕȗưừứữửựụṳųṷṵʉ"},{base:"v",letters:"vⓥvṽṿʋꝟʌ"},{base:"vy",letters:"ꝡ"},{base:"w",letters:"wⓦwẁẃŵẇẅẘẉⱳ"},{base:"x",letters:"xⓧxẋẍ"},{base:"y",letters:"yⓨyỳýŷỹȳẏÿỷẙỵƴɏỿ"},{base:"z",letters:"zⓩzźẑżžẓẕƶȥɀⱬꝣ"}],Ze0=new RegExp("["+uB.map(function(e){return e.letters}).join("")+"]","g"),P1u={};for(var vA=0;vA<uB.length;vA++)for(var AA=uB[vA],bA=0;bA<AA.letters.length;bA++)P1u[AA.letters[bA]]=AA.base;var j1u=function(u){return u.replace(Ze0,function(a){return P1u[a]})},Qe0=Ve0(j1u),vI=function(u){return u.replace(/^\s+|\s+$/g,"")},qe0=function(u){return"".concat(u.label," ").concat(u.value)},Ye0=function(u){return function(a,t){if(a.data.__isNew__)return!0;var n=ye({ignoreCase:!0,ignoreAccents:!0,stringify:qe0,trim:!0,matchFrom:"any"},u),r=n.ignoreCase,i=n.ignoreAccents,o=n.stringify,s=n.trim,l=n.matchFrom,E=s?vI(t):t,c=s?vI(o(a)):o(a);return r&&(E=E.toLowerCase(),c=c.toLowerCase()),i&&(E=Qe0(E),c=j1u(c)),l==="start"?c.substr(0,E.length)===E:c.indexOf(E)>-1}},Xe0=["innerRef"];function u00(e){var u=e.innerRef,a=ds(e,Xe0),t=yu0(a,"onExited","in","enter","exit","appear");return ze("input",Me({ref:u},t,{css:lw({label:"dummyInput",background:0,border:0,caretColor:"transparent",fontSize:"inherit",gridArea:"1 / 1 / 2 / 3",outline:0,padding:0,width:1,color:"transparent",left:-100,opacity:0,position:"relative",transform:"scale(.01)"},"","")}))}var e00=function(u){u.cancelable&&u.preventDefault(),u.stopPropagation()};function a00(e){var u=e.isEnabled,a=e.onBottomArrive,t=e.onBottomLeave,n=e.onTopArrive,r=e.onTopLeave,i=C.useRef(!1),o=C.useRef(!1),s=C.useRef(0),l=C.useRef(null),E=C.useCallback(function(p,f){if(l.current!==null){var g=l.current,F=g.scrollTop,b=g.scrollHeight,y=g.clientHeight,v=l.current,A=f>0,B=b-y-F,j=!1;B>f&&i.current&&(t&&t(p),i.current=!1),A&&o.current&&(r&&r(p),o.current=!1),A&&f>B?(a&&!i.current&&a(p),v.scrollTop=b,j=!0,i.current=!0):!A&&-f>F&&(n&&!o.current&&n(p),v.scrollTop=0,j=!0,o.current=!0),j&&e00(p)}},[a,t,n,r]),c=C.useCallback(function(p){E(p,p.deltaY)},[E]),D=C.useCallback(function(p){s.current=p.changedTouches[0].clientY},[]),h=C.useCallback(function(p){var f=s.current-p.changedTouches[0].clientY;E(p,f)},[E]),m=C.useCallback(function(p){if(p){var f=vu0?{passive:!1}:!1;p.addEventListener("wheel",c,f),p.addEventListener("touchstart",D,f),p.addEventListener("touchmove",h,f)}},[h,D,c]),x=C.useCallback(function(p){p&&(p.removeEventListener("wheel",c,!1),p.removeEventListener("touchstart",D,!1),p.removeEventListener("touchmove",h,!1))},[h,D,c]);return C.useEffect(function(){if(u){var p=l.current;return m(p),function(){x(p)}}},[u,m,x]),function(p){l.current=p}}var AI=["boxSizing","height","overflow","paddingRight","position"],bI={boxSizing:"border-box",overflow:"hidden",position:"relative",height:"100%"};function yI(e){e.preventDefault()}function BI(e){e.stopPropagation()}function SI(){var e=this.scrollTop,u=this.scrollHeight,a=e+this.offsetHeight;e===0?this.scrollTop=1:a===u&&(this.scrollTop=e-1)}function zI(){return"ontouchstart"in window||navigator.maxTouchPoints}var OI=!!(typeof window<"u"&&window.document&&window.document.createElement),y5=0,YE={capture:!1,passive:!1};function t00(e){var u=e.isEnabled,a=e.accountForScrollbars,t=a===void 0?!0:a,n=C.useRef({}),r=C.useRef(null),i=C.useCallback(function(s){if(OI){var l=document.body,E=l&&l.style;if(t&&AI.forEach(function(m){var x=E&&E[m];n.current[m]=x}),t&&y5<1){var c=parseInt(n.current.paddingRight,10)||0,D=document.body?document.body.clientWidth:0,h=window.innerWidth-D+c||0;Object.keys(bI).forEach(function(m){var x=bI[m];E&&(E[m]=x)}),E&&(E.paddingRight="".concat(h,"px"))}l&&zI()&&(l.addEventListener("touchmove",yI,YE),s&&(s.addEventListener("touchstart",SI,YE),s.addEventListener("touchmove",BI,YE))),y5+=1}},[t]),o=C.useCallback(function(s){if(OI){var l=document.body,E=l&&l.style;y5=Math.max(y5-1,0),t&&y5<1&&AI.forEach(function(c){var D=n.current[c];E&&(E[c]=D)}),l&&zI()&&(l.removeEventListener("touchmove",yI,YE),s&&(s.removeEventListener("touchstart",SI,YE),s.removeEventListener("touchmove",BI,YE)))}},[t]);return C.useEffect(function(){if(u){var s=r.current;return i(s),function(){o(s)}}},[u,i,o]),function(s){r.current=s}}var n00=function(u){var a=u.target;return a.ownerDocument.activeElement&&a.ownerDocument.activeElement.blur()},r00={name:"1kfdb0e",styles:"position:fixed;left:0;bottom:0;right:0;top:0"};function i00(e){var u=e.children,a=e.lockEnabled,t=e.captureEnabled,n=t===void 0?!0:t,r=e.onBottomArrive,i=e.onBottomLeave,o=e.onTopArrive,s=e.onTopLeave,l=a00({isEnabled:n,onBottomArrive:r,onBottomLeave:i,onTopArrive:o,onTopLeave:s}),E=t00({isEnabled:a}),c=function(h){l(h),E(h)};return ze(C.Fragment,null,a&&ze("div",{onClick:n00,css:r00}),u(c))}var o00={name:"1a0ro4n-requiredInput",styles:"label:requiredInput;opacity:0;pointer-events:none;position:absolute;bottom:0;left:0;right:0;width:100%"},s00=function(u){var a=u.name,t=u.onFocus;return ze("input",{required:!0,name:a,tabIndex:-1,"aria-hidden":"true",onFocus:t,css:o00,value:"",onChange:function(){}})},l00=s00;function hw(e){var u;return typeof window<"u"&&window.navigator!=null?e.test(((u=window.navigator.userAgentData)===null||u===void 0?void 0:u.platform)||window.navigator.platform):!1}function E00(){return hw(/^iPhone/i)}function N1u(){return hw(/^Mac/i)}function c00(){return hw(/^iPad/i)||N1u()&&navigator.maxTouchPoints>1}function d00(){return E00()||c00()}function D00(){return N1u()||d00()}var h00=function(u){return u.label},R1u=function(u){return u.label},L1u=function(u){return u.value},m00=function(u){return!!u.isDisabled},x00={clearIndicator:ue0,container:Vu0,control:oe0,dropdownIndicator:Yu0,group:ce0,groupHeading:De0,indicatorsContainer:Wu0,indicatorSeparator:ae0,input:fe0,loadingIndicator:re0,loadingMessage:Lu0,menu:wu0,menuList:ju0,menuPortal:Ku0,multiValue:ke0,multiValueLabel:ve0,multiValueRemove:Ae0,noOptionsMessage:Ru0,option:Oe0,placeholder:Te0,singleValue:Ne0,valueContainer:Gu0},f00={primary:"#2684FF",primary75:"#4C9AFF",primary50:"#B2D4FF",primary25:"#DEEBFF",danger:"#DE350B",dangerLight:"#FFBDAD",neutral0:"hsl(0, 0%, 100%)",neutral5:"hsl(0, 0%, 95%)",neutral10:"hsl(0, 0%, 90%)",neutral20:"hsl(0, 0%, 80%)",neutral30:"hsl(0, 0%, 70%)",neutral40:"hsl(0, 0%, 60%)",neutral50:"hsl(0, 0%, 50%)",neutral60:"hsl(0, 0%, 40%)",neutral70:"hsl(0, 0%, 30%)",neutral80:"hsl(0, 0%, 20%)",neutral90:"hsl(0, 0%, 10%)"},p00=4,_1u=4,g00=38,C00=_1u*2,F00={baseUnit:_1u,controlHeight:g00,menuGutter:C00},yA={borderRadius:p00,colors:f00,spacing:F00},k00={"aria-live":"polite",backspaceRemovesValue:!0,blurInputOnSelect:gI(),captureMenuScroll:!gI(),classNames:{},closeMenuOnSelect:!0,closeMenuOnScroll:!1,components:{},controlShouldRenderValue:!0,escapeClearsValue:!1,filterOption:Ye0(),formatGroupLabel:h00,getOptionLabel:R1u,getOptionValue:L1u,isDisabled:!1,isLoading:!1,isMulti:!1,isRtl:!1,isSearchable:!0,isOptionDisabled:m00,loadingMessage:function(){return"Loading..."},maxMenuHeight:300,minMenuHeight:140,menuIsOpen:!1,menuPlacement:"bottom",menuPosition:"absolute",menuShouldBlockScroll:!1,menuShouldScrollIntoView:!Fu0(),noOptionsMessage:function(){return"No options"},openMenuOnFocus:!1,openMenuOnClick:!0,options:[],pageSize:5,placeholder:"Select...",screenReaderStatus:function(u){var a=u.count;return"".concat(a," result").concat(a!==1?"s":""," available")},styles:{},tabIndex:0,tabSelectsValue:!0,unstyled:!1};function wI(e,u,a,t){var n=$1u(e,u,a),r=V1u(e,u,a),i=K1u(e,u),o=Mg(e,u);return{type:"option",data:u,isDisabled:n,isSelected:r,label:i,value:o,index:t}}function pf(e,u){return e.options.map(function(a,t){if("options"in a){var n=a.options.map(function(i,o){return wI(e,i,u,o)}).filter(function(i){return TI(e,i)});return n.length>0?{type:"group",data:a,options:n,index:t}:void 0}var r=wI(e,a,u,t);return TI(e,r)?r:void 0}).filter(Au0)}function I1u(e){return e.reduce(function(u,a){return a.type==="group"?u.push.apply(u,e3(a.options.map(function(t){return t.data}))):u.push(a.data),u},[])}function MI(e,u){return e.reduce(function(a,t){return t.type==="group"?a.push.apply(a,e3(t.options.map(function(n){return{data:n.data,id:"".concat(u,"-").concat(t.index,"-").concat(n.index)}}))):a.push({data:t.data,id:"".concat(u,"-").concat(t.index)}),a},[])}function v00(e,u){return I1u(pf(e,u))}function TI(e,u){var a=e.inputValue,t=a===void 0?"":a,n=u.data,r=u.isSelected,i=u.label,o=u.value;return(!G1u(e)||!r)&&H1u(e,{label:i,value:o,data:n},t)}function A00(e,u){var a=e.focusedValue,t=e.selectValue,n=t.indexOf(a);if(n>-1){var r=u.indexOf(a);if(r>-1)return a;if(n<u.length)return u[n]}return null}function b00(e,u){var a=e.focusedOption;return a&&u.indexOf(a)>-1?a:u[0]}var BA=function(u,a){var t,n=(t=u.find(function(r){return r.data===a}))===null||t===void 0?void 0:t.id;return n||null},K1u=function(u,a){return u.getOptionLabel(a)},Mg=function(u,a){return u.getOptionValue(a)};function $1u(e,u,a){return typeof e.isOptionDisabled=="function"?e.isOptionDisabled(u,a):!1}function V1u(e,u,a){if(a.indexOf(u)>-1)return!0;if(typeof e.isOptionSelected=="function")return e.isOptionSelected(u,a);var t=Mg(e,u);return a.some(function(n){return Mg(e,n)===t})}function H1u(e,u,a){return e.filterOption?e.filterOption(u,a):!0}var G1u=function(u){var a=u.hideSelectedOptions,t=u.isMulti;return a===void 0?t:a},y00=1,J1u=function(e){VYe(a,e);var u=JYe(a);function a(t){var n;if(KYe(this,a),n=u.call(this,t),n.state={ariaSelection:null,focusedOption:null,focusedOptionId:null,focusableOptionsWithIds:[],focusedValue:null,inputIsHidden:!1,isFocused:!1,selectValue:[],clearFocusValueOnUpdate:!1,prevWasFocused:!1,inputIsHiddenAfterUpdate:void 0,prevProps:void 0,instancePrefix:""},n.blockOptionHover=!1,n.isComposing=!1,n.commonProps=void 0,n.initialTouchX=0,n.initialTouchY=0,n.openAfterFocus=!1,n.scrollToFocusedOptionOnUpdate=!1,n.userIsDragging=void 0,n.isAppleDevice=D00(),n.controlRef=null,n.getControlRef=function(s){n.controlRef=s},n.focusedOptionRef=null,n.getFocusedOptionRef=function(s){n.focusedOptionRef=s},n.menuListRef=null,n.getMenuListRef=function(s){n.menuListRef=s},n.inputRef=null,n.getInputRef=function(s){n.inputRef=s},n.focus=n.focusInput,n.blur=n.blurInput,n.onChange=function(s,l){var E=n.props,c=E.onChange,D=E.name;l.name=D,n.ariaOnChange(s,l),c(s,l)},n.setValue=function(s,l,E){var c=n.props,D=c.closeMenuOnSelect,h=c.isMulti,m=c.inputValue;n.onInputChange("",{action:"set-value",prevInputValue:m}),D&&(n.setState({inputIsHiddenAfterUpdate:!h}),n.onMenuClose()),n.setState({clearFocusValueOnUpdate:!0}),n.onChange(s,{action:l,option:E})},n.selectOption=function(s){var l=n.props,E=l.blurInputOnSelect,c=l.isMulti,D=l.name,h=n.state.selectValue,m=c&&n.isOptionSelected(s,h),x=n.isOptionDisabled(s,h);if(m){var p=n.getOptionValue(s);n.setValue(h.filter(function(f){return n.getOptionValue(f)!==p}),"deselect-option",s)}else if(!x)c?n.setValue([].concat(e3(h),[s]),"select-option",s):n.setValue(s,"select-option");else{n.ariaOnChange(s,{action:"select-option",option:s,name:D});return}E&&n.blurInput()},n.removeValue=function(s){var l=n.props.isMulti,E=n.state.selectValue,c=n.getOptionValue(s),D=E.filter(function(m){return n.getOptionValue(m)!==c}),h=q5(l,D,D[0]||null);n.onChange(h,{action:"remove-value",removedValue:s}),n.focusInput()},n.clearValue=function(){var s=n.state.selectValue;n.onChange(q5(n.props.isMulti,[],null),{action:"clear",removedValues:s})},n.popValue=function(){var s=n.props.isMulti,l=n.state.selectValue,E=l[l.length-1],c=l.slice(0,l.length-1),D=q5(s,c,c[0]||null);n.onChange(D,{action:"pop-value",removedValue:E})},n.getFocusedOptionId=function(s){return BA(n.state.focusableOptionsWithIds,s)},n.getFocusableOptionsWithIds=function(){return MI(pf(n.props,n.state.selectValue),n.getElementId("option"))},n.getValue=function(){return n.state.selectValue},n.cx=function(){for(var s=arguments.length,l=new Array(s),E=0;E<s;E++)l[E]=arguments[E];return xu0.apply(void 0,[n.props.classNamePrefix].concat(l))},n.getOptionLabel=function(s){return K1u(n.props,s)},n.getOptionValue=function(s){return Mg(n.props,s)},n.getStyles=function(s,l){var E=n.props.unstyled,c=x00[s](l,E);c.boxSizing="border-box";var D=n.props.styles[s];return D?D(c,l):c},n.getClassNames=function(s,l){var E,c;return(E=(c=n.props.classNames)[s])===null||E===void 0?void 0:E.call(c,l)},n.getElementId=function(s){return"".concat(n.state.instancePrefix,"-").concat(s)},n.getComponents=function(){return Ie0(n.props)},n.buildCategorizedOptions=function(){return pf(n.props,n.state.selectValue)},n.getCategorizedOptions=function(){return n.props.menuIsOpen?n.buildCategorizedOptions():[]},n.buildFocusableOptions=function(){return I1u(n.buildCategorizedOptions())},n.getFocusableOptions=function(){return n.props.menuIsOpen?n.buildFocusableOptions():[]},n.ariaOnChange=function(s,l){n.setState({ariaSelection:ye({value:s},l)})},n.onMenuMouseDown=function(s){s.button===0&&(s.stopPropagation(),s.preventDefault(),n.focusInput())},n.onMenuMouseMove=function(s){n.blockOptionHover=!1},n.onControlMouseDown=function(s){if(!s.defaultPrevented){var l=n.props.openMenuOnClick;n.state.isFocused?n.props.menuIsOpen?s.target.tagName!=="INPUT"&&s.target.tagName!=="TEXTAREA"&&n.onMenuClose():l&&n.openMenu("first"):(l&&(n.openAfterFocus=!0),n.focusInput()),s.target.tagName!=="INPUT"&&s.target.tagName!=="TEXTAREA"&&s.preventDefault()}},n.onDropdownIndicatorMouseDown=function(s){if(!(s&&s.type==="mousedown"&&s.button!==0)&&!n.props.isDisabled){var l=n.props,E=l.isMulti,c=l.menuIsOpen;n.focusInput(),c?(n.setState({inputIsHiddenAfterUpdate:!E}),n.onMenuClose()):n.openMenu("first"),s.preventDefault()}},n.onClearIndicatorMouseDown=function(s){s&&s.type==="mousedown"&&s.button!==0||(n.clearValue(),s.preventDefault(),n.openAfterFocus=!1,s.type==="touchend"?n.focusInput():setTimeout(function(){return n.focusInput()}))},n.onScroll=function(s){typeof n.props.closeMenuOnScroll=="boolean"?s.target instanceof HTMLElement&&PF(s.target)&&n.props.onMenuClose():typeof n.props.closeMenuOnScroll=="function"&&n.props.closeMenuOnScroll(s)&&n.props.onMenuClose()},n.onCompositionStart=function(){n.isComposing=!0},n.onCompositionEnd=function(){n.isComposing=!1},n.onTouchStart=function(s){var l=s.touches,E=l&&l.item(0);E&&(n.initialTouchX=E.clientX,n.initialTouchY=E.clientY,n.userIsDragging=!1)},n.onTouchMove=function(s){var l=s.touches,E=l&&l.item(0);if(E){var c=Math.abs(E.clientX-n.initialTouchX),D=Math.abs(E.clientY-n.initialTouchY),h=5;n.userIsDragging=c>h||D>h}},n.onTouchEnd=function(s){n.userIsDragging||(n.controlRef&&!n.controlRef.contains(s.target)&&n.menuListRef&&!n.menuListRef.contains(s.target)&&n.blurInput(),n.initialTouchX=0,n.initialTouchY=0)},n.onControlTouchEnd=function(s){n.userIsDragging||n.onControlMouseDown(s)},n.onClearIndicatorTouchEnd=function(s){n.userIsDragging||n.onClearIndicatorMouseDown(s)},n.onDropdownIndicatorTouchEnd=function(s){n.userIsDragging||n.onDropdownIndicatorMouseDown(s)},n.handleInputChange=function(s){var l=n.props.inputValue,E=s.currentTarget.value;n.setState({inputIsHiddenAfterUpdate:!1}),n.onInputChange(E,{action:"input-change",prevInputValue:l}),n.props.menuIsOpen||n.onMenuOpen()},n.onInputFocus=function(s){n.props.onFocus&&n.props.onFocus(s),n.setState({inputIsHiddenAfterUpdate:!1,isFocused:!0}),(n.openAfterFocus||n.props.openMenuOnFocus)&&n.openMenu("first"),n.openAfterFocus=!1},n.onInputBlur=function(s){var l=n.props.inputValue;if(n.menuListRef&&n.menuListRef.contains(document.activeElement)){n.inputRef.focus();return}n.props.onBlur&&n.props.onBlur(s),n.onInputChange("",{action:"input-blur",prevInputValue:l}),n.onMenuClose(),n.setState({focusedValue:null,isFocused:!1})},n.onOptionHover=function(s){if(!(n.blockOptionHover||n.state.focusedOption===s)){var l=n.getFocusableOptions(),E=l.indexOf(s);n.setState({focusedOption:s,focusedOptionId:E>-1?n.getFocusedOptionId(s):null})}},n.shouldHideSelectedOptions=function(){return G1u(n.props)},n.onValueInputFocus=function(s){s.preventDefault(),s.stopPropagation(),n.focus()},n.onKeyDown=function(s){var l=n.props,E=l.isMulti,c=l.backspaceRemovesValue,D=l.escapeClearsValue,h=l.inputValue,m=l.isClearable,x=l.isDisabled,p=l.menuIsOpen,f=l.onKeyDown,g=l.tabSelectsValue,F=l.openMenuOnFocus,b=n.state,y=b.focusedOption,v=b.focusedValue,A=b.selectValue;if(!x&&!(typeof f=="function"&&(f(s),s.defaultPrevented))){switch(n.blockOptionHover=!0,s.key){case"ArrowLeft":if(!E||h)return;n.focusValue("previous");break;case"ArrowRight":if(!E||h)return;n.focusValue("next");break;case"Delete":case"Backspace":if(h)return;if(v)n.removeValue(v);else{if(!c)return;E?n.popValue():m&&n.clearValue()}break;case"Tab":if(n.isComposing||s.shiftKey||!p||!g||!y||F&&n.isOptionSelected(y,A))return;n.selectOption(y);break;case"Enter":if(s.keyCode===229)break;if(p){if(!y||n.isComposing)return;n.selectOption(y);break}return;case"Escape":p?(n.setState({inputIsHiddenAfterUpdate:!1}),n.onInputChange("",{action:"menu-close",prevInputValue:h}),n.onMenuClose()):m&&D&&n.clearValue();break;case" ":if(h)return;if(!p){n.openMenu("first");break}if(!y)return;n.selectOption(y);break;case"ArrowUp":p?n.focusOption("up"):n.openMenu("last");break;case"ArrowDown":p?n.focusOption("down"):n.openMenu("first");break;case"PageUp":if(!p)return;n.focusOption("pageup");break;case"PageDown":if(!p)return;n.focusOption("pagedown");break;case"Home":if(!p)return;n.focusOption("first");break;case"End":if(!p)return;n.focusOption("last");break;default:return}s.preventDefault()}},n.state.instancePrefix="react-select-"+(n.props.instanceId||++y00),n.state.selectValue=Og(t.value),t.menuIsOpen&&n.state.selectValue.length){var r=n.getFocusableOptionsWithIds(),i=n.buildFocusableOptions(),o=i.indexOf(n.state.selectValue[0]);n.state.focusableOptionsWithIds=r,n.state.focusedOption=i[o],n.state.focusedOptionId=BA(r,i[o])}return n}return $Ye(a,[{key:"componentDidMount",value:function(){this.startListeningComposition(),this.startListeningToTouch(),this.props.closeMenuOnScroll&&document&&document.addEventListener&&document.addEventListener("scroll",this.onScroll,!0),this.props.autoFocus&&this.focusInput(),this.props.menuIsOpen&&this.state.focusedOption&&this.menuListRef&&this.focusedOptionRef&&pI(this.menuListRef,this.focusedOptionRef)}},{key:"componentDidUpdate",value:function(n){var r=this.props,i=r.isDisabled,o=r.menuIsOpen,s=this.state.isFocused;(s&&!i&&n.isDisabled||s&&o&&!n.menuIsOpen)&&this.focusInput(),s&&i&&!n.isDisabled?this.setState({isFocused:!1},this.onMenuClose):!s&&!i&&n.isDisabled&&this.inputRef===document.activeElement&&this.setState({isFocused:!0}),this.menuListRef&&this.focusedOptionRef&&this.scrollToFocusedOptionOnUpdate&&(pI(this.menuListRef,this.focusedOptionRef),this.scrollToFocusedOptionOnUpdate=!1)}},{key:"componentWillUnmount",value:function(){this.stopListeningComposition(),this.stopListeningToTouch(),document.removeEventListener("scroll",this.onScroll,!0)}},{key:"onMenuOpen",value:function(){this.props.onMenuOpen()}},{key:"onMenuClose",value:function(){this.onInputChange("",{action:"menu-close",prevInputValue:this.props.inputValue}),this.props.onMenuClose()}},{key:"onInputChange",value:function(n,r){this.props.onInputChange(n,r)}},{key:"focusInput",value:function(){this.inputRef&&this.inputRef.focus()}},{key:"blurInput",value:function(){this.inputRef&&this.inputRef.blur()}},{key:"openMenu",value:function(n){var r=this,i=this.state,o=i.selectValue,s=i.isFocused,l=this.buildFocusableOptions(),E=n==="first"?0:l.length-1;if(!this.props.isMulti){var c=l.indexOf(o[0]);c>-1&&(E=c)}this.scrollToFocusedOptionOnUpdate=!(s&&this.menuListRef),this.setState({inputIsHiddenAfterUpdate:!1,focusedValue:null,focusedOption:l[E],focusedOptionId:this.getFocusedOptionId(l[E])},function(){return r.onMenuOpen()})}},{key:"focusValue",value:function(n){var r=this.state,i=r.selectValue,o=r.focusedValue;if(this.props.isMulti){this.setState({focusedOption:null});var s=i.indexOf(o);o||(s=-1);var l=i.length-1,E=-1;if(i.length){switch(n){case"previous":s===0?E=0:s===-1?E=l:E=s-1;break;case"next":s>-1&&s<l&&(E=s+1);break}this.setState({inputIsHidden:E!==-1,focusedValue:i[E]})}}}},{key:"focusOption",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"first",r=this.props.pageSize,i=this.state.focusedOption,o=this.getFocusableOptions();if(o.length){var s=0,l=o.indexOf(i);i||(l=-1),n==="up"?s=l>0?l-1:o.length-1:n==="down"?s=(l+1)%o.length:n==="pageup"?(s=l-r,s<0&&(s=0)):n==="pagedown"?(s=l+r,s>o.length-1&&(s=o.length-1)):n==="last"&&(s=o.length-1),this.scrollToFocusedOptionOnUpdate=!0,this.setState({focusedOption:o[s],focusedValue:null,focusedOptionId:this.getFocusedOptionId(o[s])})}}},{key:"getTheme",value:function(){return this.props.theme?typeof this.props.theme=="function"?this.props.theme(yA):ye(ye({},yA),this.props.theme):yA}},{key:"getCommonProps",value:function(){var n=this.clearValue,r=this.cx,i=this.getStyles,o=this.getClassNames,s=this.getValue,l=this.selectOption,E=this.setValue,c=this.props,D=c.isMulti,h=c.isRtl,m=c.options,x=this.hasValue();return{clearValue:n,cx:r,getStyles:i,getClassNames:o,getValue:s,hasValue:x,isMulti:D,isRtl:h,options:m,selectOption:l,selectProps:c,setValue:E,theme:this.getTheme()}}},{key:"hasValue",value:function(){var n=this.state.selectValue;return n.length>0}},{key:"hasOptions",value:function(){return!!this.getFocusableOptions().length}},{key:"isClearable",value:function(){var n=this.props,r=n.isClearable,i=n.isMulti;return r===void 0?i:r}},{key:"isOptionDisabled",value:function(n,r){return $1u(this.props,n,r)}},{key:"isOptionSelected",value:function(n,r){return V1u(this.props,n,r)}},{key:"filterOption",value:function(n,r){return H1u(this.props,n,r)}},{key:"formatOptionLabel",value:function(n,r){if(typeof this.props.formatOptionLabel=="function"){var i=this.props.inputValue,o=this.state.selectValue;return this.props.formatOptionLabel(n,{context:r,inputValue:i,selectValue:o})}else return this.getOptionLabel(n)}},{key:"formatGroupLabel",value:function(n){return this.props.formatGroupLabel(n)}},{key:"startListeningComposition",value:function(){document&&document.addEventListener&&(document.addEventListener("compositionstart",this.onCompositionStart,!1),document.addEventListener("compositionend",this.onCompositionEnd,!1))}},{key:"stopListeningComposition",value:function(){document&&document.removeEventListener&&(document.removeEventListener("compositionstart",this.onCompositionStart),document.removeEventListener("compositionend",this.onCompositionEnd))}},{key:"startListeningToTouch",value:function(){document&&document.addEventListener&&(document.addEventListener("touchstart",this.onTouchStart,!1),document.addEventListener("touchmove",this.onTouchMove,!1),document.addEventListener("touchend",this.onTouchEnd,!1))}},{key:"stopListeningToTouch",value:function(){document&&document.removeEventListener&&(document.removeEventListener("touchstart",this.onTouchStart),document.removeEventListener("touchmove",this.onTouchMove),document.removeEventListener("touchend",this.onTouchEnd))}},{key:"renderInput",value:function(){var n=this.props,r=n.isDisabled,i=n.isSearchable,o=n.inputId,s=n.inputValue,l=n.tabIndex,E=n.form,c=n.menuIsOpen,D=n.required,h=this.getComponents(),m=h.Input,x=this.state,p=x.inputIsHidden,f=x.ariaSelection,g=this.commonProps,F=o||this.getElementId("input"),b=ye(ye(ye({"aria-autocomplete":"list","aria-expanded":c,"aria-haspopup":!0,"aria-errormessage":this.props["aria-errormessage"],"aria-invalid":this.props["aria-invalid"],"aria-label":this.props["aria-label"],"aria-labelledby":this.props["aria-labelledby"],"aria-required":D,role:"combobox","aria-activedescendant":this.isAppleDevice?void 0:this.state.focusedOptionId||""},c&&{"aria-controls":this.getElementId("listbox")}),!i&&{"aria-readonly":!0}),this.hasValue()?(f==null?void 0:f.action)==="initial-input-focus"&&{"aria-describedby":this.getElementId("live-region")}:{"aria-describedby":this.getElementId("placeholder")});return i?C.createElement(m,Me({},g,{autoCapitalize:"none",autoComplete:"off",autoCorrect:"off",id:F,innerRef:this.getInputRef,isDisabled:r,isHidden:p,onBlur:this.onInputBlur,onChange:this.handleInputChange,onFocus:this.onInputFocus,spellCheck:"false",tabIndex:l,form:E,type:"text",value:s},b)):C.createElement(u00,Me({id:F,innerRef:this.getInputRef,onBlur:this.onInputBlur,onChange:zg,onFocus:this.onInputFocus,disabled:r,tabIndex:l,inputMode:"none",form:E,value:""},b))}},{key:"renderPlaceholderOrValue",value:function(){var n=this,r=this.getComponents(),i=r.MultiValue,o=r.MultiValueContainer,s=r.MultiValueLabel,l=r.MultiValueRemove,E=r.SingleValue,c=r.Placeholder,D=this.commonProps,h=this.props,m=h.controlShouldRenderValue,x=h.isDisabled,p=h.isMulti,f=h.inputValue,g=h.placeholder,F=this.state,b=F.selectValue,y=F.focusedValue,v=F.isFocused;if(!this.hasValue()||!m)return f?null:C.createElement(c,Me({},D,{key:"placeholder",isDisabled:x,isFocused:v,innerProps:{id:this.getElementId("placeholder")}}),g);if(p)return b.map(function(B,j){var R=B===y,w="".concat(n.getOptionLabel(B),"-").concat(n.getOptionValue(B));return C.createElement(i,Me({},D,{components:{Container:o,Label:s,Remove:l},isFocused:R,isDisabled:x,key:w,index:j,removeProps:{onClick:function(){return n.removeValue(B)},onTouchEnd:function(){return n.removeValue(B)},onMouseDown:function(T){T.preventDefault()}},data:B}),n.formatOptionLabel(B,"value"))});if(f)return null;var A=b[0];return C.createElement(E,Me({},D,{data:A,isDisabled:x}),this.formatOptionLabel(A,"value"))}},{key:"renderClearIndicator",value:function(){var n=this.getComponents(),r=n.ClearIndicator,i=this.commonProps,o=this.props,s=o.isDisabled,l=o.isLoading,E=this.state.isFocused;if(!this.isClearable()||!r||s||!this.hasValue()||l)return null;var c={onMouseDown:this.onClearIndicatorMouseDown,onTouchEnd:this.onClearIndicatorTouchEnd,"aria-hidden":"true"};return C.createElement(r,Me({},i,{innerProps:c,isFocused:E}))}},{key:"renderLoadingIndicator",value:function(){var n=this.getComponents(),r=n.LoadingIndicator,i=this.commonProps,o=this.props,s=o.isDisabled,l=o.isLoading,E=this.state.isFocused;if(!r||!l)return null;var c={"aria-hidden":"true"};return C.createElement(r,Me({},i,{innerProps:c,isDisabled:s,isFocused:E}))}},{key:"renderIndicatorSeparator",value:function(){var n=this.getComponents(),r=n.DropdownIndicator,i=n.IndicatorSeparator;if(!r||!i)return null;var o=this.commonProps,s=this.props.isDisabled,l=this.state.isFocused;return C.createElement(i,Me({},o,{isDisabled:s,isFocused:l}))}},{key:"renderDropdownIndicator",value:function(){var n=this.getComponents(),r=n.DropdownIndicator;if(!r)return null;var i=this.commonProps,o=this.props.isDisabled,s=this.state.isFocused,l={onMouseDown:this.onDropdownIndicatorMouseDown,onTouchEnd:this.onDropdownIndicatorTouchEnd,"aria-hidden":"true"};return C.createElement(r,Me({},i,{innerProps:l,isDisabled:o,isFocused:s}))}},{key:"renderMenu",value:function(){var n=this,r=this.getComponents(),i=r.Group,o=r.GroupHeading,s=r.Menu,l=r.MenuList,E=r.MenuPortal,c=r.LoadingMessage,D=r.NoOptionsMessage,h=r.Option,m=this.commonProps,x=this.state.focusedOption,p=this.props,f=p.captureMenuScroll,g=p.inputValue,F=p.isLoading,b=p.loadingMessage,y=p.minMenuHeight,v=p.maxMenuHeight,A=p.menuIsOpen,B=p.menuPlacement,j=p.menuPosition,R=p.menuPortalTarget,w=p.menuShouldBlockScroll,O=p.menuShouldScrollIntoView,T=p.noOptionsMessage,z=p.onMenuScrollToTop,N=p.onMenuScrollToBottom;if(!A)return null;var M=function(Q,eu){var U=Q.type,iu=Q.data,tu=Q.isDisabled,Y=Q.isSelected,ou=Q.label,Cu=Q.value,Au=x===iu,mu=tu?void 0:function(){return n.onOptionHover(iu)},Nu=tu?void 0:function(){return n.selectOption(iu)},le="".concat(n.getElementId("option"),"-").concat(eu),Yu={id:le,onClick:Nu,onMouseMove:mu,onMouseOver:mu,tabIndex:-1,role:"option","aria-selected":n.isAppleDevice?void 0:Y};return C.createElement(h,Me({},m,{innerProps:Yu,data:iu,isDisabled:tu,isSelected:Y,key:le,label:ou,type:U,value:Cu,isFocused:Au,innerRef:Au?n.getFocusedOptionRef:void 0}),n.formatOptionLabel(Q.data,"menu"))},I;if(this.hasOptions())I=this.getCategorizedOptions().map(function(_){if(_.type==="group"){var Q=_.data,eu=_.options,U=_.index,iu="".concat(n.getElementId("group"),"-").concat(U),tu="".concat(iu,"-heading");return C.createElement(i,Me({},m,{key:iu,data:Q,options:eu,Heading:o,headingProps:{id:tu,data:_.data},label:n.formatGroupLabel(_.data)}),_.options.map(function(Y){return M(Y,"".concat(U,"-").concat(Y.index))}))}else if(_.type==="option")return M(_,"".concat(_.index))});else if(F){var P=b({inputValue:g});if(P===null)return null;I=C.createElement(c,m,P)}else{var L=T({inputValue:g});if(L===null)return null;I=C.createElement(D,m,L)}var K={minMenuHeight:y,maxMenuHeight:v,menuPlacement:B,menuPosition:j,menuShouldScrollIntoView:O},W=C.createElement(Mu0,Me({},m,K),function(_){var Q=_.ref,eu=_.placerProps,U=eu.placement,iu=eu.maxHeight;return C.createElement(s,Me({},m,K,{innerRef:Q,innerProps:{onMouseDown:n.onMenuMouseDown,onMouseMove:n.onMenuMouseMove},isLoading:F,placement:U}),C.createElement(i00,{captureEnabled:f,onTopArrive:z,onBottomArrive:N,lockEnabled:w},function(tu){return C.createElement(l,Me({},m,{innerRef:function(ou){n.getMenuListRef(ou),tu(ou)},innerProps:{role:"listbox","aria-multiselectable":m.isMulti,id:n.getElementId("listbox")},isLoading:F,maxHeight:iu,focusedOption:x}),I)}))});return R||j==="fixed"?C.createElement(E,Me({},m,{appendTo:R,controlElement:this.controlRef,menuPlacement:B,menuPosition:j}),W):W}},{key:"renderFormField",value:function(){var n=this,r=this.props,i=r.delimiter,o=r.isDisabled,s=r.isMulti,l=r.name,E=r.required,c=this.state.selectValue;if(E&&!this.hasValue()&&!o)return C.createElement(l00,{name:l,onFocus:this.onValueInputFocus});if(!(!l||o))if(s)if(i){var D=c.map(function(x){return n.getOptionValue(x)}).join(i);return C.createElement("input",{name:l,type:"hidden",value:D})}else{var h=c.length>0?c.map(function(x,p){return C.createElement("input",{key:"i-".concat(p),name:l,type:"hidden",value:n.getOptionValue(x)})}):C.createElement("input",{name:l,type:"hidden",value:""});return C.createElement("div",null,h)}else{var m=c[0]?this.getOptionValue(c[0]):"";return C.createElement("input",{name:l,type:"hidden",value:m})}}},{key:"renderLiveRegion",value:function(){var n=this.commonProps,r=this.state,i=r.ariaSelection,o=r.focusedOption,s=r.focusedValue,l=r.isFocused,E=r.selectValue,c=this.getFocusableOptions();return C.createElement(Ue0,Me({},n,{id:this.getElementId("live-region"),ariaSelection:i,focusedOption:o,focusedValue:s,isFocused:l,selectValue:E,focusableOptions:c,isAppleDevice:this.isAppleDevice}))}},{key:"render",value:function(){var n=this.getComponents(),r=n.Control,i=n.IndicatorsContainer,o=n.SelectContainer,s=n.ValueContainer,l=this.props,E=l.className,c=l.id,D=l.isDisabled,h=l.menuIsOpen,m=this.state.isFocused,x=this.commonProps=this.getCommonProps();return C.createElement(o,Me({},x,{className:E,innerProps:{id:c,onKeyDown:this.onKeyDown},isDisabled:D,isFocused:m}),this.renderLiveRegion(),C.createElement(r,Me({},x,{innerRef:this.getControlRef,innerProps:{onMouseDown:this.onControlMouseDown,onTouchEnd:this.onControlTouchEnd},isDisabled:D,isFocused:m,menuIsOpen:h}),C.createElement(s,Me({},x,{isDisabled:D}),this.renderPlaceholderOrValue(),this.renderInput()),C.createElement(i,Me({},x,{isDisabled:D}),this.renderClearIndicator(),this.renderLoadingIndicator(),this.renderIndicatorSeparator(),this.renderDropdownIndicator())),this.renderMenu(),this.renderFormField())}}],[{key:"getDerivedStateFromProps",value:function(n,r){var i=r.prevProps,o=r.clearFocusValueOnUpdate,s=r.inputIsHiddenAfterUpdate,l=r.ariaSelection,E=r.isFocused,c=r.prevWasFocused,D=r.instancePrefix,h=n.options,m=n.value,x=n.menuIsOpen,p=n.inputValue,f=n.isMulti,g=Og(m),F={};if(i&&(m!==i.value||h!==i.options||x!==i.menuIsOpen||p!==i.inputValue)){var b=x?v00(n,g):[],y=x?MI(pf(n,g),"".concat(D,"-option")):[],v=o?A00(r,g):null,A=b00(r,b),B=BA(y,A);F={selectValue:g,focusedOption:A,focusedOptionId:B,focusableOptionsWithIds:y,focusedValue:v,clearFocusValueOnUpdate:!1}}var j=s!=null&&n!==i?{inputIsHidden:s,inputIsHiddenAfterUpdate:void 0}:{},R=l,w=E&&c;return E&&!w&&(R={value:q5(f,g,g[0]||null),options:g,action:"initial-input-focus"},w=!c),(l==null?void 0:l.action)==="initial-input-focus"&&(R=null),ye(ye(ye({},F),j),{},{prevProps:n,ariaSelection:R,prevWasFocused:w})}}]),a}(C.Component);J1u.defaultProps=k00;var B00=["defaultInputValue","defaultMenuIsOpen","defaultValue","inputValue","menuIsOpen","onChange","onInputChange","onMenuClose","onMenuOpen","value"];function S00(e){var u=e.defaultInputValue,a=u===void 0?"":u,t=e.defaultMenuIsOpen,n=t===void 0?!1:t,r=e.defaultValue,i=r===void 0?null:r,o=e.inputValue,s=e.menuIsOpen,l=e.onChange,E=e.onInputChange,c=e.onMenuClose,D=e.onMenuOpen,h=e.value,m=ds(e,B00),x=C.useState(o!==void 0?o:a),p=Ls(x,2),f=p[0],g=p[1],F=C.useState(s!==void 0?s:n),b=Ls(F,2),y=b[0],v=b[1],A=C.useState(h!==void 0?h:i),B=Ls(A,2),j=B[0],R=B[1],w=C.useCallback(function(P,L){typeof l=="function"&&l(P,L),R(P)},[l]),O=C.useCallback(function(P,L){var K;typeof E=="function"&&(K=E(P,L)),g(K!==void 0?K:P)},[E]),T=C.useCallback(function(){typeof D=="function"&&D(),v(!0)},[D]),z=C.useCallback(function(){typeof c=="function"&&c(),v(!1)},[c]),N=o!==void 0?o:f,M=s!==void 0?s:y,I=h!==void 0?h:j;return ye(ye({},m),{},{inputValue:N,menuIsOpen:M,onChange:w,onInputChange:O,onMenuClose:z,onMenuOpen:T,value:I})}var z00=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],PI=function(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0,t=arguments.length>2?arguments[2]:void 0,n=String(u).toLowerCase(),r=String(t.getOptionValue(a)).toLowerCase(),i=String(t.getOptionLabel(a)).toLowerCase();return r===n||i===n},SA={formatCreateLabel:function(u){return'Create "'.concat(u,'"')},isValidNewOption:function(u,a,t,n){return!(!u||a.some(function(r){return PI(u,r,n)})||t.some(function(r){return PI(u,r,n)}))},getNewOptionData:function(u,a){return{label:a,value:u,__isNew__:!0}}};function O00(e){var u=e.allowCreateWhileLoading,a=u===void 0?!1:u,t=e.createOptionPosition,n=t===void 0?"last":t,r=e.formatCreateLabel,i=r===void 0?SA.formatCreateLabel:r,o=e.isValidNewOption,s=o===void 0?SA.isValidNewOption:o,l=e.getNewOptionData,E=l===void 0?SA.getNewOptionData:l,c=e.onCreateOption,D=e.options,h=D===void 0?[]:D,m=e.onChange,x=ds(e,z00),p=x.getOptionValue,f=p===void 0?L1u:p,g=x.getOptionLabel,F=g===void 0?R1u:g,b=x.inputValue,y=x.isLoading,v=x.isMulti,A=x.value,B=x.name,j=C.useMemo(function(){return s(b,Og(A),h,{getOptionValue:f,getOptionLabel:F})?E(b,i(b)):void 0},[i,E,F,f,b,s,h,A]),R=C.useMemo(function(){return(a||!y)&&j?n==="first"?[j].concat(e3(h)):[].concat(e3(h),[j]):h},[a,n,y,j,h]),w=C.useCallback(function(O,T){if(T.action!=="select-option")return m(O,T);var z=Array.isArray(O)?O:[O];if(z[z.length-1]===j){if(c)c(b);else{var N=E(b,b),M={action:"create-option",name:B,option:N};m(q5(v,[].concat(e3(Og(A)),[N]),N),M)}return}m(O,T)},[E,b,v,B,j,c,m,A]);return ye(ye({},x),{},{options:R,onChange:w})}var w00=C.forwardRef(function(e,u){var a=S00(e),t=O00(a);return C.createElement(J1u,Me({ref:u},t))}),M00=w00;ym.pick({parameters:!0,defaultParameters:!0,parameterEnums:!0,defaultCacheKey:!0,defaultCacheTtl:!0,defaultCacheAllInvocations:!0,autoAuth:!0,advanced:!0});const T00=({value:e,onChange:u})=>{var a,t;return d.jsxs(AC,{children:[d.jsx(bC,{children:d.jsxs(Wo,{children:[d.jsx(Io,{children:"Name"}),d.jsx(Io,{className:"w-1/2",children:"Options"}),d.jsx(Io,{className:"w-1/2",children:"Default value"}),d.jsx(Io,{className:"w-8"})]})}),d.jsxs(yC,{children:[(a=e.parameters)==null?void 0:a.map((n,r)=>{var i,o,s;return d.jsxs(Wo,{children:[d.jsx(gr,{className:"whitespace-nowrap",children:n}),d.jsx(gr,{children:d.jsx(M00,{className:"my-react-select-container",classNamePrefix:"my-react-select",placeholder:"Add options...",formatCreateLabel:l=>`Add ${l}`,isMulti:!0,isClearable:!1,styles:{menuPortal:l=>({...l,zIndex:9999})},menuPortalTarget:document.body,value:(o=(i=e.parameterEnums)==null?void 0:i[n])==null?void 0:o.map(l=>({label:l,value:l})),onChange:l=>{u({...e,parameterEnums:{...e.parameterEnums,[n]:(l==null?void 0:l.map(E=>E.value))||[]}})}})}),d.jsx(gr,{children:d.jsx(wlu,{singleLine:!0,value:((s=e.defaultParameters)==null?void 0:s[n])||"",language:"template-string",placeholder:"JavaScript expression",onChange:l=>{u({...e,defaultParameters:{...e.defaultParameters,[n]:l}})}})}),d.jsx(gr,{children:d.jsx(Ve,{type:"button",variant:"ghost",size:"smIcon",className:"text-destructive hover:text-destructive hover:bg-transparent",onClick:()=>{var c;const l={...e.defaultParameters};delete l[n];const E={...e.parameterEnums};delete E[n],u({...e,parameters:(c=e.parameters)==null?void 0:c.filter(D=>D!==n),defaultParameters:l,parameterEnums:E})},children:d.jsx(FE,{className:"h-4 w-4"})})})]},r)}),(t=e.parameters)!=null&&t.length?null:d.jsx(Wo,{children:d.jsx(gr,{colSpan:4,className:"h-24 text-center",children:"No parameters."})})]})]})},P00=e=>{var t,n,r;const[u,a]=C.useState("");return d.jsxs("div",{className:"space-y-4",children:[d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsx(gt,{placeholder:"PARAMETER_NAME",value:u,onChange:i=>a(i.target.value)}),d.jsxs(Ve,{variant:"outline",disabled:!u,onClick:()=>{var i,o,s;a(""),e.onChange({...e.step,parameters:{parameterNames:[...((i=e.step.parameters)==null?void 0:i.parameterNames)||[],u],defaultParameters:(o=e.step.parameters)==null?void 0:o.defaultParameters,parameterEnums:(s=e.step.parameters)==null?void 0:s.parameterEnums}})},children:[d.jsx(im,{}),"Add"]})]}),d.jsx(T00,{value:{parameters:(t=e.step.parameters)==null?void 0:t.parameterNames,defaultParameters:(n=e.step.parameters)==null?void 0:n.defaultParameters,parameterEnums:(r=e.step.parameters)==null?void 0:r.parameterEnums},onChange:i=>{e.onChange({...e.step,parameters:{parameterNames:i.parameters??[],defaultParameters:i.defaultParameters??void 0,parameterEnums:i.parameterEnums??void 0}})}})]})};function jI({value:e,onChange:u,onBlur:a}){const t=n=>{n===W0.CUSTOM?u({type:W0.CUSTOM,target:{type:"description",description:""}}):n===W0.CUSTOM_COORDINATES?u({type:W0.CUSTOM_COORDINATES,startX:0,startY:0,deltaPixels:100}):u({type:n})};return d.jsxs(d.Fragment,{children:[d.jsxs(Ka,{value:e.type,onValueChange:t,children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select a container"})}),d.jsxs(wa,{children:[d.jsx(Re,{value:W0.SCREEN,children:"Screen"}),d.jsx(Re,{value:W0.OPEN_APP,children:"Currently open app"}),d.jsx(Re,{value:W0.OPEN_WEBVIEW,children:"Active webview"}),d.jsx(Re,{value:W0.CUSTOM,children:"Custom container"}),d.jsx(Re,{value:W0.CUSTOM_COORDINATES,children:"Custom coordinates"})]})]}),e.type===W0.CUSTOM&&d.jsxs(we,{children:[d.jsx(tt,{value:e.target.description,onChange:n=>{u({type:W0.CUSTOM,target:{type:"description",description:n.target.value}})},onBlur:a}),d.jsx(Ou,{children:d.jsx(te,{children:"Container"})})]}),e.type===W0.CUSTOM_COORDINATES&&d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsxs(we,{children:[d.jsx(ht,{value:e.startX,min:0,onChange:n=>{u({...e,startX:n??0})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Start X"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"px"})})]}),d.jsxs(we,{children:[d.jsx(ht,{value:e.startY,min:0,onChange:n=>{u({...e,startY:n??0})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Start Y"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"px"})})]})]}),d.jsxs(we,{children:[d.jsx(ht,{value:e.deltaPixels,min:1,onChange:n=>{u({...e,deltaPixels:n??1})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Delta"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"px"})})]})]})]})}const zA=[{name:"Download",path:"/sdcard/Download/"},{name:"Documents",path:"/sdcard/Documents/"},{name:"Pictures",path:"/sdcard/Pictures/"},{name:"Music",path:"/sdcard/Music/"},{name:"Movies",path:"/sdcard/Movies/"}],b6="Custom path",j00=({value:e,onChange:u,onBlur:a})=>{const t=C.useRef(!1),n=C.useMemo(()=>zA.find(l=>e.startsWith(l.path)),[e]),r=(n==null?void 0:n.name)??b6,i=C.useMemo(()=>n?e.substring(n.path.length):e,[n,e]),o=C.useCallback(l=>{if(!n){u(l);return}u(n.path+l)},[u,n]),s=C.useCallback(l=>{t.current=!0;const E=i;if(l===b6){n&&u(E);return}const c=zA.find(D=>D.name===l);c&&u(c.path+E)},[i,u,n]);return C.useEffect(()=>{t.current&&(t.current=!1,a())},[e,a]),d.jsxs(we,{children:[d.jsx(tt,{className:"pl-1",placeholder:n?"android.jpg":"/sdcard/Download/android.jpg",value:i,onChange:l=>o(l.target.value),onBlur:a}),d.jsx(Ou,{children:d.jsxs(VW,{children:[d.jsx(HW,{asChild:!0,children:d.jsxs(Y0,{variant:"ghost","aria-label":"Select folder",children:[d.jsx(te,{children:r}),d.jsx(od,{className:"h-4 w-4"})]})}),d.jsxs(J8,{align:"end",children:[d.jsx(M4,{onSelect:()=>s(b6),children:b6}),zA.map(l=>d.jsx(M4,{onSelect:()=>s(l.name),children:l.name},l.name))]})]})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsxs(n0,{className:"max-w-xs",children:[e,d.jsx("br",{}),d.jsx("br",{}),"Location on the device where the file should be stored. This should be a file name."]})]})})]})},NI=e=>{var u,a,t;switch(e.type){case Tu.AI_ACTION:return e.text.trim().length>0;case I0.MODULE:return e.name.trim().length>0;case Tu.PRESET:{const n=e.command;switch(n.type){case G.AI_CHECK:return n.assertion.trim().length>0;case G.TAP:return n.target.type==="description"?n.target.description.trim().length>0:!0;case G.TYPE:return n.text.trim().length>0;case G.OPEN_APP:if((u=n.intentExtras)!=null&&u.length)try{JSON.parse(n.intentExtras)}catch{return!1}return n.packageName.trim().length>0;case G.JAVASCRIPT:return n.code.trim().length>0;case G.REQUEST:return n.url.trim().length>0;case G.WAIT:return n.timeoutSecs>0;case G.ADD_FILE:return!0;case G.INSTALL_APP:return n.uri.trim().length>0;case G.UNINSTALL_APP:return n.packageName.trim().length>0;case G.ADB:if((t=(a=n.jsonArgs)==null?void 0:a.trim())!=null&&t.length)try{JSON.parse(n.jsonArgs.trim())}catch{return!1}return n.command.trim().length>0;case G.SWIPE:return n.scrollableElement.type===W0.CUSTOM?n.scrollableElement.target.description.trim().length>0:!0;case G.SCREEN_CHECK:return n.assertion.value.trim().length>0;case G.ELEMENT_CHECK:return n.target.type==="description"?n.target.description.trim().length>0:!0;case G.KILL_APP:case G.OPEN_NOTIFICATION_DRAWER:case G.PRESS:case G.PRESS_KEYBOARD:case G.STATE:return!0;case G.SCROLL_TO:return n.scrollableElement.type===W0.CUSTOM?n.target.description.trim().length>0&&n.scrollableElement.target.description.trim().length>0:n.target.description.trim().length>0;case G.DRAG_AND_DROP:return!0;case G.TOGGLE_SETTINGS:return!0;default:return!0}}}return!0},Co="NEGATED_PREFIX__",RI=YU.filter(e=>e!==sn.VISIBLE),N00={[Qr.BACK]:"Back",[Qr.HOME]:"Home",[Qr.APP_SWITCHER]:"App switcher",[Qr.POWER]:"Power",[Qr.SEARCH]:"Search",[Qr.VOLUME_UP]:"Volume up",[Qr.VOLUME_DOWN]:"Volume down",[Qr.VOLUME_MUTE]:"Volume mute"},R00={[$c.BACKSPACE]:"Backspace",[$c.CLOSE_KEYBOARD]:"Close keyboard",[$c.ENTER]:"Enter"},he=(e,u)=>e.type===u,be=(e,u)=>e.type===u,B5=e=>{if(!e)return"";switch(e.type){case"description":return e.description;case"coordinates":return`${e.xPercent}%, ${e.yPercent}%`}},L00=e=>e.flatMap((u,a)=>a===0?[u]:[d.jsx(om,{},`separator-${a}`),u]),XE=({title:e,children:u})=>d.jsxs("div",{className:"grid gap-1 px-2 py-1",children:[d.jsx("div",{className:"flex h-9 items-center",children:d.jsx(xt,{children:e})}),u]}),_00=({state:e,modules:u,onChange:a,onExecute:t,sessionId:n})=>{var g,F,b,y;const r=C.useMemo(()=>L4(e),[e]),i=C.useMemo(()=>{switch(r.type){case Tu.AI_ACTION:return{type:Tu.AI_ACTION};case Tu.PRESET:return{type:Tu.PRESET,command:r.command.type};case I0.MODULE:return{...r,type:I0.MODULE}}},[r]),[o,s]=m9(r),l=()=>{if(NI(o)&&Object.keys(Tp(r,o)).length>0){a==null||a(o);return}},E=v=>{NI(v)&&Object.keys(Tp(r,v)).length>0&&(a==null||a(v))};C.useEffect(()=>{s(r)},[r,s]);const c=[],D=[],h=[],m=[],x=[];switch(o.type){case Tu.AI_ACTION:D.push(d.jsxs(we,{children:[d.jsx(Hr,{placeholder:"Re-enable 2FA in account settings and confirm it is active.",value:o.text,autoFocus:!0,onChange:v=>{const A=v.target.value;s(B=>{he(B,Tu.AI_ACTION)&&(B.text=A)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Goal"})})]},"ai-action-goal"));break;case I0.MODULE:m.push(d.jsxs(we,{children:[d.jsx(tt,{value:o.name,onChange:v=>{const A=v.target.value;s(B=>{he(B,I0.MODULE)&&(B.name=A)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Name"})})]},"module-name"),d.jsxs(we,{children:[d.jsx(Hr,{value:o.description,onChange:v=>{const A=v.target.value;s(B=>{he(B,I0.MODULE)&&(B.description=A)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Description"})})]},"module-description"),d.jsxs(ph,{onOpenChange:()=>{s(v=>{var A,B;if(he(v,I0.MODULE)){const j=(A=v.parameters)==null?void 0:A.defaultParameters;j&&(Object.keys(j).forEach(w=>{j[w].trim()||delete j[w]}),Object.keys(j||{}).length||(v.parameters.defaultParameters=void 0));const R=(B=v.parameters)==null?void 0:B.parameterEnums;R&&(Object.keys(R).forEach(w=>{R[w].length||delete R[w]}),Object.keys(R||{}).length||(v.parameters.parameterEnums=void 0)),E(A0(v))}})},children:[d.jsx(gh,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",className:"w-fit",children:[d.jsx(_7,{}),"Configure parameters"]})}),d.jsx(R3,{className:"w-[700px]",side:"right",align:"start",children:d.jsx(P00,{step:o,onChange:v=>{s(A=>{he(A,I0.MODULE)&&(A.parameters=v.parameters)})}})})]},"module-parameters")),(g=o.parameters)==null||g.parameterNames.forEach(v=>{var A,B,j;x.push(d.jsxs(we,{children:[d.jsx(tt,{placeholder:((B=(A=o.parameters)==null?void 0:A.defaultParameters)==null?void 0:B[v])||"'hello world'",value:((j=o.inputs)==null?void 0:j[v])||"",onChange:R=>{const w=R.target.value;s(O=>{he(O,I0.MODULE)&&(O.inputs={...O.inputs||{}},w?O.inputs[v]=w:delete O.inputs[v],Object.keys(O.inputs).length===0&&(O.inputs=void 0))})},onBlur:()=>{s(R=>{he(R,I0.MODULE)&&(R.inputs={...R.inputs||{}},Object.keys(R.inputs).forEach(w=>{var T,z;const O=(T=R.inputs)==null?void 0:T[w].trim();O?R.inputs[w]=O:(z=R.inputs)==null||delete z[w]}),Object.keys(R.inputs).length===0&&(R.inputs=void 0),E(A0(R)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:v})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:'JavaScript expression to pass into the module that can be referenced inside the module using the `env` variable. You should quote strings ("hello") and reference variables directly without {{ }} (e.g. `env.CURRENT_URL`)'})]})})]},`module-param-${v}`))}),h.push(d.jsxs(we,{children:[d.jsx(tt,{placeholder:"ENV_VAR_NAME",value:o.envKey||"",onChange:v=>{const A=v.target.value.trim();s(B=>{he(B,I0.MODULE)&&(B.envKey=A||void 0)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Variable name"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Store the output of this step onto the environment with the given variable name."})]})})]},"module-env"));break;case Tu.PRESET:switch(o.command.type){case G.AI_CHECK:D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.assertion,autoFocus:!0,onChange:v=>{const A=v.target.value;s(B=>{he(B,Tu.PRESET)&&be(B.command,G.AI_CHECK)&&(B.command.id=_a(),B.command.assertion=A)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Assertion"})})]},"ai-check-assertion"),d.jsxs(we,{children:[d.jsx(ht,{value:o.command.timeoutSecs??null,min:0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.AI_CHECK)&&(A.command.timeoutSecs=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Timeout"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"s"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Maximum numer of seconds to wait for the assertion to pass. At least two attempts will be made. Defaults to 5 seconds."})]})})]},"ai-check-timeout"));break;case G.TAP:{c.push(d.jsxs(we,{children:[d.jsx(tt,{value:B5(o.command.target),autoFocus:!0,onChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&(w.command.id=_a(),w.command.target={type:"description",description:R.target.value})})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Element"})})]},"tap-element"));let v;(R=>{R.SINGLE="SINGLE",R.DOUBLE="DOUBLE",R.LONG_PRESS="LONG_PRESS"})(v||(v={}));const A=o.command.longPress?"LONG_PRESS":o.command.doubleTap?"DOUBLE":"SINGLE";let B;(R=>{R.CENTER="CENTER",R.CUSTOM="CUSTOM"})(B||(B={}));const j=((F=o.command.relativePosition)==null?void 0:F.x)!==void 0&&o.command.relativePosition.y!==void 0?"CUSTOM":"CENTER";D.push(d.jsxs(Q5,{type:"single",variant:"outline",className:"justify-start",value:A,onValueChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&(w.command.longPress=R==="LONG_PRESS"||void 0,w.command.doubleTap=R==="DOUBLE"||void 0,w.command.longPressDurationMs=void 0,w.command.doubleTapDelayMs=void 0,E(A0(w)))})},children:[d.jsx(Wr,{value:"SINGLE",children:"Single tap"}),d.jsx(Wr,{value:"DOUBLE",children:"Double tap"}),d.jsx(Wr,{value:"LONG_PRESS",children:"Long press"})]},"tap-type"),A==="LONG_PRESS"&&d.jsxs(we,{children:[d.jsx(ht,{value:o.command.longPressDurationMs??null,min:0,onChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&(w.command.longPressDurationMs=R??void 0,E(A0(w)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Press duration"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"ms"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Milliseconds to hold the tap before releasing. Defaults to 2000 milliseconds."})]})})]},"press-duration"),A==="DOUBLE"&&d.jsxs(we,{children:[d.jsx(ht,{value:o.command.doubleTapDelayMs??null,min:0,onChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&(w.command.doubleTapDelayMs=R??void 0,E(A0(w)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Tap delay"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"ms"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Milliseconds to wait between taps. Defaults to 100 milliseconds."})]})})]},"double-tap-delay"),d.jsxs("div",{className:"flex h-9 items-center gap-2",children:[d.jsx(Vlu,{id:"position",checked:j==="CUSTOM",onCheckedChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&(w.command.relativePosition=R?{x:0,y:0}:void 0,E(A0(w)))})}}),d.jsx(xt,{htmlFor:"position",children:"Specify relative position"})]},"tap-position"),j==="CUSTOM"&&d.jsxs("div",{className:"flex items-center gap-1",children:[d.jsxs(we,{children:[d.jsx(ht,{value:((b=o.command.relativePosition)==null?void 0:b.x)??null,onChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&w.command.relativePosition&&(w.command.relativePosition.x=R??0,E(A0(w)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"X offset"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"px"})})]}),d.jsxs(we,{children:[d.jsx(ht,{value:((y=o.command.relativePosition)==null?void 0:y.y)??null,onChange:R=>{s(w=>{he(w,Tu.PRESET)&&be(w.command,G.TAP)&&w.command.relativePosition&&(w.command.relativePosition.y=R??0,E(A0(w)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Y offset"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"px"})})]})]},"tap-position-inputs"));break}case G.TYPE:{c.push(d.jsxs(we,{children:[d.jsx(tt,{autoFocus:!0,value:B5(o.command.target),onChange:v=>{s(A=>{if(he(A,Tu.PRESET)&&be(A.command,G.TYPE)){if(A.command.id=_a(),!v.target.value){A.command.target=void 0;return}A.command.target={type:"description",description:v.target.value}}})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Element"})})]},"type-element")),D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.text,onChange:v=>{const A=v.target.value;s(B=>{he(B,Tu.PRESET)&&be(B.command,G.TYPE)&&(B.command.text=A)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Value"})})]},"type-value"),d.jsxs(we,{children:[d.jsx(ht,{value:o.command.keyPressDelayMs??null,min:0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.TYPE)&&(A.command.keyPressDelayMs=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Key press delay"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"ms"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Milliseconds to wait between each key press. Defaults to 25 milliseconds."})]})})]},"type-delay"),d.jsxs(Ka,{value:D8u(o.command),onValueChange:v=>{s(A=>{if(he(A,Tu.PRESET)&&be(A.command,G.TYPE)){switch(v){case Fo.INPUT_TEXTAREAS:A.command.clearContent=!0,A.command.forceClearContent=void 0;break;case Fo.ALWAYS:A.command.clearContent=!0,A.command.forceClearContent=!0;break;case Fo.NEVER:A.command.clearContent=!1,A.command.forceClearContent=void 0;break}E(A0(A))}})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select a mode"})}),d.jsxs(wa,{children:[d.jsx(Re,{value:Fo.NEVER,children:Yk[Fo.NEVER]}),d.jsx(Re,{value:Fo.ALWAYS,children:Yk[Fo.ALWAYS]}),d.jsx(Re,{value:Fo.INPUT_TEXTAREAS,children:Yk[Fo.INPUT_TEXTAREAS]})]})]},"type-clear-content-mode"));break}case G.PRESS:D.push(d.jsxs(Ka,{value:o.command.key,onValueChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.PRESS)&&(A.command.key=v,E(A0(A)))})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select a button"})}),d.jsx(wa,{children:Object.values(Qr).map(v=>d.jsx(Re,{value:v,children:N00[v]},v))})]},"press-key"));break;case G.PRESS_KEYBOARD:D.push(d.jsxs(Ka,{value:o.command.key,onValueChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.PRESS_KEYBOARD)&&(A.command.key=v,E(A0(A)))})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select a key"})}),d.jsx(wa,{children:Object.values($c).map(v=>d.jsx(Re,{value:v,children:R00[v]},v))})]},"press-keyboard"));break;case G.SWIPE:{D.push(d.jsxs(Q5,{type:"single",variant:"outline",className:"justify-start",value:o.command.direction,onValueChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SWIPE)&&(A.command.direction=v,E(A0(A)))})},children:[d.jsx(Wr,{value:"up",children:"Up"}),d.jsx(Wr,{value:"down",children:"Down"}),d.jsx(Wr,{value:"left",children:"Left"}),d.jsx(Wr,{value:"right",children:"Right"})]},"swipe-direction"),d.jsx(jI,{value:o.command.scrollableElement,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SWIPE)&&(A.command.scrollableElement=v,A.command.cache=void 0,v.type===W0.CUSTOM_COORDINATES&&(A.command.viewportPercent=void 0),v.type!==W0.CUSTOM&&E(A0(A)))})},onBlur:l},"swipe-container"),o.command.scrollableElement.type!==W0.CUSTOM_COORDINATES&&d.jsxs(we,{children:[d.jsx(ht,{value:o.command.viewportPercent!==void 0?o.command.viewportPercent*100:null,min:0,max:100,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SWIPE)&&(A.command.viewportPercent=v!==null?v/100:void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:o.command.direction==="down"||o.command.direction==="up"?"Height":"Width"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"%"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"The amount to scroll, as a percentage of the height for vertical swipes and the width for horizontal swipes. Defaults to 80%."})]})})]},"swipe-percentage"),d.jsxs(we,{children:[d.jsx(ht,{value:o.command.durationMs??null,min:0,max:1e4,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SWIPE)&&(A.command.durationMs=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Duration"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"ms"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"The duration of the swipe in milliseconds. Defaults to 500 milliseconds."})]})})]},"swipe-duration"));break}case G.SCREEN_CHECK:{D.push(d.jsxs(Q5,{type:"single",variant:"outline",className:"justify-start",value:o.command.assertion.negated?"negated":"contains",onValueChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCREEN_CHECK)&&(A.command.assertion.negated=v==="negated",E(A0(A)))})},children:[d.jsx(Wr,{value:"contains",children:b4[ia.CONTAINS]}),d.jsx(Wr,{value:"negated",children:y4[ia.CONTAINS]})]},"tap-type"),d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.assertion.value,autoFocus:!0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCREEN_CHECK)&&(A.command.assertion.value=v.target.value)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Value"})})]},"screen-check-assertion-value"),d.jsxs(we,{children:[d.jsx(ht,{value:o.command.timeout??null,min:0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCREEN_CHECK)&&(A.command.timeout=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Timeout"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"s"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Maximum number of seconds to wait for the assertion to pass. At least two attempts will be made. Defaults to 5 seconds."})]})})]},"screen-check-timeout"));break}case G.ELEMENT_CHECK:{c.push(d.jsxs(we,{children:[d.jsx(tt,{value:B5(o.command.target),onChange:A=>{s(B=>{if(he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)){if(!A.target.value){B.command.target={type:"description",description:""};return}B.command.target={type:"description",description:A.target.value}}})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Element"})})]},"element-check-target"));const v=o.command.assertion;D.push(d.jsxs(Ka,{value:v.type??H0.ELEMENT_CONTENT,onValueChange:A=>{s(B=>{he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&Tvu(A)&&(B.command.assertion=lq(A,B.command.assertion),E(A0(B)))})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select an assertion type"})}),d.jsx(wa,{children:qU.map(A=>d.jsx(Re,{value:A,children:Pvu[A]},A))})]},"element-check-assertion-type")),v.type===H0.ELEMENT_ATTRIBUTE&&D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:v.attr,onChange:A=>{s(B=>{he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&B.command.assertion.type===H0.ELEMENT_ATTRIBUTE&&(B.command.assertion.attr=A.target.value)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Attribute"})})]},"element-check-attribute-value")),v.type===H0.ELEMENT_STYLE&&D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:v.property,onChange:A=>{s(B=>{he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&B.command.assertion.type===H0.ELEMENT_STYLE&&(B.command.assertion.property=A.target.value)})},onBlur:l}),d.jsxs(Ou,{align:"block-start",className:"justify-between",children:[d.jsx(te,{children:"Property"}),d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Warning",size:"icon-xs",children:d.jsx(Gf,{className:"text-yellow-600"})})}),d.jsx(n0,{className:"max-w-xs",children:"Computed style checks are not supported on native elements."})]})]})]},"element-check-property-value")),v.type!==H0.ELEMENT_EXISTENCE&&D.push(d.jsxs(Ka,{value:v.negated?Co+v.operation:v.operation,onValueChange:A=>{s(B=>{if(he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&B.command.assertion.type!==H0.ELEMENT_EXISTENCE){const j=A.startsWith(Co),R=j?A.slice(Co.length):A;if(!Mvu(R))return;B.command.assertion.operation=R,B.command.assertion.negated=j,E(A0(B))}})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select an operation"})}),d.jsxs(wa,{children:[fb.map(A=>d.jsx(Re,{value:A,children:b4[A]},A)),fb.map(A=>d.jsx(Re,{value:Co+A,children:y4[A]},Co+A))]})]},"element-check-assertion-operation")),v.type!==H0.ELEMENT_EXISTENCE&&v.operation!==ia.EXISTS&&D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:v.value,onChange:A=>{s(B=>{he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&B.command.assertion.type!==H0.ELEMENT_EXISTENCE&&(B.command.assertion.value=A.target.value)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Value"})})]},"element-check-assertion-value")),v.type===H0.ELEMENT_EXISTENCE&&D.push(d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Ka,{value:v.condition?v.negated?Co+v.condition:v.condition:sn.EXISTS,onValueChange:A=>{s(B=>{if(he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&B.command.assertion.type===H0.ELEMENT_EXISTENCE){const j=A.startsWith(Co),R=j?A.slice(Co.length):A;if(!_vu(R))return;B.command.assertion.type=H0.ELEMENT_EXISTENCE,B.command.assertion.condition=R,B.command.assertion.negated=j,E(A0(B))}})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select an assertion type"})}),d.jsxs(wa,{children:[RI.map(A=>d.jsx(Re,{value:A,children:aru[A]},A)),RI.map(A=>d.jsx(Re,{value:Co+A,children:tru[A]},Co+A))]})]}),v.condition===sn.EDITABLE&&d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Warning",size:"icon-xs",children:d.jsx(Gf,{className:"text-yellow-600"})})}),d.jsx(n0,{className:"max-w-xs",children:"Editable checks are not supported on native elements."})]})]},"element-check-assertion-condition")),D.push(d.jsxs(we,{children:[d.jsx(ht,{value:o.command.timeout??null,min:0,onChange:A=>{s(B=>{he(B,Tu.PRESET)&&be(B.command,G.ELEMENT_CHECK)&&(B.command.timeout=A??void 0,E(A0(B)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Timeout"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"s"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Maximum number of seconds to wait for the assertion to pass. At least two attempts will be made. Defaults to 5 seconds."})]})})]},"screen-check-timeout"));break}case G.DRAG_AND_DROP:{c.push(d.jsxs(we,{children:[d.jsx(tt,{value:B5(o.command.fromTarget),autoFocus:!0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.DRAG_AND_DROP)&&(A.command.id=_a(),A.command.fromTarget={type:"description",description:v.target.value})})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"From"})})]},"drag-from"),d.jsxs(we,{children:[d.jsx(tt,{value:B5(o.command.toTarget),onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.DRAG_AND_DROP)&&(A.command.id=_a(),A.command.toTarget={type:"description",description:v.target.value})})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"To"})})]},"drag-to")),D.push(d.jsxs(we,{children:[d.jsx(ht,{value:o.command.hoverDuration??null,min:0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.DRAG_AND_DROP)&&(A.command.hoverDuration=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Hover duration"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"ms"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Number of milliseconds to hold the element after finishing the drag. Defaults to 500ms."})]})})]},"drag-hover-duration"),d.jsxs(we,{children:[d.jsx(ht,{value:o.command.dragDuration??null,min:0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.DRAG_AND_DROP)&&(A.command.dragDuration=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Drag duration"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"ms"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Number of milliseconds to take for the drag movement. Defaults to 1000ms."})]})})]},"drag-duration"));break}case G.OPEN_APP:D.push(d.jsx(IYe,{value:o.command.packageName,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.OPEN_APP)&&(A.command.packageName=v)})},onBlur:l,sessionId:n},"open-app-package-name"),d.jsxs(we,{children:[d.jsx(tt,{value:o.command.activityName,onChange:v=>{s(A=>{if(he(A,Tu.PRESET)&&be(A.command,G.OPEN_APP)){if(!v.target.value){A.command.activityName=void 0;return}A.command.activityName=v.target.value}})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Activity"})})]},"open-app-activity-name"),d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.intentExtras||"",onChange:v=>{s(A=>{if(he(A,Tu.PRESET)&&be(A.command,G.OPEN_APP)){const B=v.target.value.trim();A.command.intentExtras=B||void 0}})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Intent extras"})})]},"open-app-intent-extras"));break;case G.OPEN_NOTIFICATION_DRAWER:break;case G.ADB:D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.command,autoFocus:!0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.ADB)&&(A.command.command=v.target.value)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Command"})})]},"adb-command"),d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.jsonArgs||"",onChange:v=>{s(A=>{if(he(A,Tu.PRESET)&&be(A.command,G.ADB)){const B=v.target.value.trim();A.command.jsonArgs=B||void 0}})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Arguments"})})]},"adb-args"));break;case G.JAVASCRIPT:D.push(d.jsxs(we,{children:[d.jsx(Hr,{value:o.command.code,autoFocus:!0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.JAVASCRIPT)&&(A.command.code=v.target.value)})},onBlur:l}),d.jsx(Ou,{align:"block-start",children:d.jsx(te,{children:"Code"})})]},"javascript-code"),d.jsxs(we,{children:[d.jsx(ht,{value:o.command.timeout??null,min:0,max:120,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.JAVASCRIPT)&&(A.command.timeout=v??void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Timeout"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"s"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"The maximum amount of time to wait for the code to complete in seconds. Defaults to 15 seconds."})]})})]},"javascript-timeout")),h.push(d.jsxs(we,{children:[d.jsx(tt,{placeholder:"ENV_VAR_NAME",value:o.envKey||"",onChange:v=>{const A=v.target.value.trim();s(B=>{he(B,Tu.PRESET)&&be(B.command,G.JAVASCRIPT)&&(B.envKey=A||void 0)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Variable name"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Store the output of this step onto the environment with the given variable name."})]})})]},"javascript-env"));break;case G.WAIT:D.push(d.jsxs(we,{children:[d.jsx(ht,{value:o.command.timeoutSecs,min:0,max:1800,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.WAIT)&&(A.command.timeoutSecs=v??0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Duration"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"s"})})]},"wait-timeout"));break;case G.REQUEST:D.push(d.jsxs(ph,{onOpenChange:l,children:[d.jsx(gh,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",className:"w-fit",children:[d.jsx(_7,{}),"Configure request"]})}),d.jsx(R3,{className:"w-[700px]",side:"right",align:"start",children:d.jsx(FYe,{command:o.command,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.REQUEST)&&(A.command={...v,type:G.REQUEST})})}})})]},"request-config")),h.push(d.jsxs(we,{children:[d.jsx(tt,{placeholder:"ENV_VAR_NAME",value:o.envKey||"",onChange:v=>{const A=v.target.value.trim();s(B=>{he(B,Tu.PRESET)&&be(B.command,G.REQUEST)&&(B.envKey=A||void 0)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Variable name"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"Store the output of this step onto the environment with the given variable name."})]})})]},"request-env"));break;case G.ADD_FILE:D.push(d.jsxs(we,{children:[d.jsx(tt,{placeholder:"https://example.com/file.txt",autoFocus:!0,value:o.command.file,onChange:v=>{const A=v.target.value;s(B=>{he(B,Tu.PRESET)&&be(B.command,G.ADD_FILE)&&(B.command.file=A)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"File"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsxs(n0,{className:"max-w-xs",children:["File to upload. This can either be a path on the local filesystem, or a URL.",d.jsx("br",{}),d.jsx("br",{}),"Accepted formats:",d.jsx("br",{}),"/Users/Name/Downloads/example.txt",d.jsx("br",{}),"https://example.com/example.txt"]})]})})]},"file-path"),d.jsx(j00,{value:o.command.storageLocation,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.ADD_FILE)&&(A.command.storageLocation=v)})},onBlur:l},"storage-location"));break;case G.INSTALL_APP:D.push(d.jsxs(we,{children:[d.jsx(tt,{placeholder:"/Users/wwu/Download/app.apk",autoFocus:!0,value:o.command.uri,onChange:v=>{const A=v.target.value;s(B=>{he(B,Tu.PRESET)&&be(B.command,G.INSTALL_APP)&&(B.command.uri=A)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"APK URI"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"A publicly accessible URL to an APK, or a path to a file on disk. Non-absolute paths are resolved relative to the Momentic project root."})]})})]},"storage-location"));break;case G.UNINSTALL_APP:D.push(d.jsxs(we,{children:[d.jsx(tt,{autoFocus:!0,placeholder:"com.android.chrome",value:o.command.packageName,onChange:v=>{const A=v.target.value;s(B=>{he(B,Tu.PRESET)&&be(B.command,G.UNINSTALL_APP)&&(B.command.packageName=A)})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Package name"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"The package name of the APK package to uninstall."})]})})]},"package-name"));break;case G.KILL_APP:break;case G.STATE:break;case G.TOGGLE_SETTINGS:D.push(d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(Ka,{value:o.command.settingsType,onValueChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.TOGGLE_SETTINGS)&&(A.command.settingsType=v,E(A0(A)))})},children:[d.jsx(Oa,{className:"w-fit space-x-2",children:d.jsx($a,{placeholder:"Select setting"})}),d.jsxs(wa,{children:[d.jsx(Re,{value:ui.AIRPLANE_MODE,children:"Airplane mode"}),d.jsx(Re,{value:ui.DATA,children:"Data"}),d.jsx(Re,{value:ui.WIFI,children:"Wi-Fi"}),d.jsx(Re,{value:ui.LOCATION,children:"Location"})]})]}),[ui.AIRPLANE_MODE,ui.WIFI].includes(o.command.settingsType)&&d.jsx("div",{className:"flex items-center gap-1 text-xs text-gray-500",children:d.jsx("span",{children:"Local emulator only"})})]},"settings-type"));break;case G.SCROLL_TO:{c.push(d.jsxs(we,{children:[d.jsx(tt,{value:o.command.target.description,autoFocus:!0,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCROLL_TO)&&(A.command.id=_a(),A.command.target={type:"description",description:v.target.value})})},onBlur:l}),d.jsx(Ou,{children:d.jsx(te,{children:"Element"})})]},"scroll-to-element")),D.push(d.jsxs(Q5,{type:"single",variant:"outline",className:"justify-start",value:o.command.direction,onValueChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCROLL_TO)&&(A.command.direction=v,E(A0(A)))})},children:[d.jsx(Wr,{value:"up",children:"Up"}),d.jsx(Wr,{value:"down",children:"Down"})]},"scroll-to-direction"),d.jsx(jI,{value:o.command.scrollableElement,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCROLL_TO)&&(A.command.scrollableElement=v,A.command.scrollableElement.type!==W0.CUSTOM&&E(A0(A)))})},onBlur:l},"scroll-to-container"),o.command.scrollableElement.type!==W0.CUSTOM_COORDINATES&&d.jsxs(we,{children:[d.jsx(ht,{value:o.command.scrollStepPercent!==void 0?o.command.scrollStepPercent*100:null,min:10,max:100,onChange:v=>{s(A=>{he(A,Tu.PRESET)&&be(A.command,G.SCROLL_TO)&&(A.command.scrollStepPercent=v!==null?v/100:void 0,E(A0(A)))})}}),d.jsx(Ou,{children:d.jsx(te,{children:"Scroll step"})}),d.jsx(Ou,{align:"inline-end",children:d.jsx(te,{children:"%"})}),d.jsx(Ou,{align:"inline-end",children:d.jsxs(o0,{children:[d.jsx(s0,{asChild:!0,children:d.jsx(Y0,{variant:"ghost","aria-label":"Help",size:"icon-xs",children:d.jsx(ba,{})})}),d.jsx(n0,{className:"max-w-xs",children:"How much of the container height to scroll at each step while searching for the element. Defaults to 80%. Smaller values are more precise but take longer."})]})})]},"scroll-to-step-percent"));break}default:o.command}break}const f=[d.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 py-1",children:[d.jsx("div",{className:"flex items-center gap-2",children:d.jsx(PYe,{value:i,modules:u,onSwitch:v=>{switch(v.type){case Tu.AI_ACTION:a==null||a({id:_a(),type:Tu.AI_ACTION,text:""});break;case Tu.PRESET:a==null||a({id:_a(),type:Tu.PRESET,command:sq(v.command)});break;case I0.MODULE:a==null||a({...v,id:_a(),type:I0.MODULE});break}}})}),d.jsx(Ve,{variant:"outline",size:"icon",onClick:t,"aria-label":"Run step",children:d.jsx(KV,{className:"h-4 w-4"})})]},"header"),m.length?d.jsx(XE,{title:"Module",children:m},"module"):null,x.length?d.jsx(XE,{title:"Inputs",children:x},"inputs"):null,c.length?d.jsx(XE,{title:"Target",children:c},"target"):null,D.length?d.jsx(XE,{title:"Action",children:D},"action"):null,h.length?d.jsxs(XE,{title:"Output",children:[h,e.data!==void 0&&d.jsx(Itu,{data:{data:e.data}})]},"output"):null,d.jsx(LYe,{step:r,onChange:a},"execution"),e.type==="STEP_STATE"&&e.aiActionEventLogs&&e.aiActionEventLogs.length>0?d.jsx("div",{className:"px-2 py-1",children:d.jsxs(ZO,{defaultOpen:!0,children:[d.jsx(QO,{className:"h-9",children:d.jsx(xt,{children:"Agent trajectory"})}),d.jsx(qO,{children:e.aiActionEventLogs.map((v,A,B)=>{const j=A===B.length-1?"active":"complete";switch(v.type){case Dh.LLM_TEXT_OUTPUT:return d.jsx(vg,{label:v.text,status:j,icon:d.jsx(jV,{className:"size-4"})},A);case Dh.SUBSTEP_CREATED:return d.jsx(vg,{label:"Running step",icon:kb(v.step)?Bc[v.step.command.type]:Bc[v.step.type],status:j,children:d.jsx(g9,{step:v.step})},A)}})})]})},"agent-trajectory"):null,[E0.SUCCESS,E0.FAILED,E0.CANCELLED].includes(e.status)?d.jsx(XE,{title:"Result",children:d.jsxs("div",{className:"flex items-center",children:[d.jsx("div",{className:"shrink-0 self-start pl-1 pr-2",children:e.status===E0.SUCCESS?d.jsx(d1,{className:"size-4 text-green-500"}):e.status===E0.FAILED?d.jsx(FE,{className:"text-destructive size-4"}):d.jsx(lDu,{className:"size-4 text-yellow-600"})}),d.jsx("div",{className:"text-sm",children:e.message??Zyu(e.status)})]})},"result"):null,e.trace?d.jsx(NYe,{trace:e.trace},"trace"):null].filter(Boolean);return d.jsx(d.Fragment,{children:L00(f)})},I00=2e3,K00=({testPath:e,test:u,pathSegments:a})=>{var Ie;const t=Ci(),{data:n=[]}=fC(),{limbar:r,canceling:i,executing:o,canExecute:s,error:l,connectionStatusUpdate:E,editorState:c,editingUniqueId:D,selectedUniqueIds:h,logcatLogs:m,a11yTreeResponse:x,isLoadingA11yTree:p,sessionLoaded:f,sessionId:g,testContext:F,viewport:b,handleCancel:y,handleRunSingleStep:v,handleRunFromStep:A,handleRunAllSteps:B,handleEdit:j,handleDelete:R,handleAddStep:w,handleStepChange:O,handleDuplicate:T,handleFetchA11yTree:z,handleMove:N,handleSelect:M,handleCreateModuleSuccess:I,setLastUserEventTime:P}=xIe({websocketUrl:jnu,test:u,testPath:e}),{data:L}=mz(),K=C.useMemo(()=>(L==null?void 0:L.modules.map(Zu=>Zu.content))||[],[L==null?void 0:L.modules]),W=C.useMemo(()=>c.rootIds.map(Gu=>c.steps[Gu]||c.modules[Gu]).filter(J6).map(L4),[c]),[_,Q]=C.useState(W),eu=C.useMemo(()=>{const Zu=Tp(_,W);return Object.keys(Zu).length>0},[_,W]),[U,iu]=a_e(W,I00);C.useEffect(()=>{iu(W)},[iu,W]);const[tu,Y]=Ws(async(Zu=!0)=>{if(!eu)return;const Gu={steps:W};try{await t(`/api/mobile-tests/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(Gu)}),Zu&&Ca.success("Test saved!"),Q(Gu.steps||[])}catch(fe){Ca.error("Failed to save test.",{description:`${fe}`})}},[e,W,eu]),[,ou]=Ws(async Zu=>{const Gu={...u.settings??{}};Zu?Gu.defaultEnv=Zu:delete Gu.defaultEnv;const fe={settings:Gu};try{await t(`/api/mobile-tests/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(fe)}),Ca.success("Default environment updated!"),window.location.reload()}catch(V){Ca.error("Failed to update environment.",{description:`${V}`})}},[t,u.settings,e]),Cu=[];for(let Zu=0;Zu<a.length-1;Zu++)Cu.push(d.jsx(Ro,{children:d.jsx(QD,{asChild:!0,children:d.jsx(uo,{to:`/browse/${a.slice(0,Zu+1).join("/")}`,children:a[Zu]})})},Zu)),Cu.push(d.jsx(qD,{},`separator-${Zu}`));const Au=y0(Y);C.useEffect(()=>{Au(!1)},[Au,U]);const mu=C.useMemo(()=>{if(!D)return null;const{stepId:Zu,parentStepIdChain:Gu}=E4(D);return Oi(c,Gu,Zu)},[D,c]),Nu=C.useMemo(()=>{const Zu=[];return h.forEach(Gu=>{const fe=c.steps[Gu];if(!fe)return;const V=L4(fe);Zu.push(V)}),Zu},[h,c]),[le,Yu]=C.useState(void 0),ve=C.useCallback(Zu=>{if(P(),!b){Yu(void 0);return}const Gu=Zu.currentTarget.getBoundingClientRect(),fe=b.right-b.left,V=b.bottom-b.top;if(!Gu.width||!Gu.height||fe<=0||V<=0){Yu(void 0);return}const au=fe/V,du=Gu.width/Gu.height,bu=du>au?Gu.height*au:Gu.width,pu=du>au?Gu.height:Gu.width/au,xu=(Gu.width-bu)/2,Ru=(Gu.height-pu)/2,He=Zu.clientX-Gu.left-xu,yu=Zu.clientY-Gu.top-Ru;if(He<0||yu<0||He>bu||yu>pu){Yu(void 0);return}const Ke=He/bu,t0=yu/pu,N0=Math.min(Math.max(Ke,0),1),ja=Math.min(Math.max(t0,0),1);Yu({x:Math.round(b.left+N0*fe),y:Math.round(b.top+ja*V)})},[b,P]);return d.jsxs("div",{className:"grid h-full max-h-screen min-h-screen w-full grid-rows-[auto_minmax(0px,_1fr)] overflow-hidden",children:[d.jsxs("header",{className:"flex h-16 shrink-0 items-center gap-2 border-b px-4",children:[d.jsx(hm,{children:d.jsxs(mm,{children:[d.jsx(Ro,{children:d.jsx(QD,{asChild:!0,children:d.jsx(uo,{to:"/browse",children:"Repository"})})}),d.jsx(qD,{}),Cu,d.jsx(Ro,{children:d.jsx(m3,{children:a[a.length-1]})})]})}),d.jsx(Hwe,{}),d.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[d.jsx(i_e,{value:(Ie=u.settings)==null?void 0:Ie.defaultEnv,options:n,onChange:Zu=>{ou(Zu)}}),d.jsx(n_e,{testPath:e,onSuccess:()=>{window.location.reload()}})]})]}),d.jsxs("div",{className:lu("grid h-full w-full grid-cols-[auto_auto_minmax(0px,_1fr)]",{"grid-cols-[auto_minmax(0px,_1fr)]":!mu}),children:[d.jsxs("div",{className:"grid w-[20vw] min-w-[350px] grid-rows-[auto_auto_auto_1fr] overflow-auto border-r",children:[d.jsx("div",{className:"flex flex-col border-b",children:d.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[d.jsx(Ve,{variant:"outline",size:"icon",className:"ml-auto",onClick:()=>void Y(),disabled:!eu||tu.loading,children:tu.loading?d.jsx(zDu,{className:"h-4 w-4 animate-spin"}):d.jsx(wDu,{className:"h-4 w-4"})}),d.jsx(pIe,{testId:u.id,testPath:e,disabled:Nu.length===0,steps:Nu,onSuccess:I}),i?d.jsxs(o0,{defaultOpen:!0,children:[d.jsx(s0,{asChild:!0,children:d.jsxs(Ve,{variant:"outline",className:"text-destructive hover:text-destructive",children:[d.jsx(L7,{className:"h-4 w-4"}),"Canceling"]})}),d.jsx(n0,{side:"bottom",className:"max-w-xs",children:"Waiting for the current step to finish executing. This may take a few seconds."})]}):o?d.jsxs(Ve,{variant:"outline",className:"text-destructive hover:text-destructive",onClick:y,children:[d.jsx(L7,{className:"h-4 w-4"}),"Cancel"]}):d.jsxs(Ve,{onClick:B,disabled:!s||!f,children:[d.jsx(KV,{className:"h-4 w-4"}),"Run"]})]})}),d.jsx(Hje,{backend:jNe,children:d.jsx("div",{className:"overflow-auto",children:c.rootIds.map((Zu,Gu)=>{const fe=c.steps[Zu]||c.modules[Zu];return fe?d.jsx(mru,{index:Gu,state:fe,editingUniqueId:D,selectedUniqueIds:h,droppableUniqueIds:c.rootIds,modules:K,onEdit:j,onSelect:M,onChange:O,onDuplicate:T,onDelete:R,onExecute:v,onExecuteFrom:A,onMove:N,onAddBefore:(V,au)=>{w(V,au,"before")},onAddAfter:(V,au)=>{w(V,au,"after")}},Zu):null})})}),d.jsx("div",{className:"my-2 flex items-center justify-center",children:d.jsx(E_e,{modules:K,onAdd:Zu=>{w(Zu,null,"after")}})}),d.jsx("div",{})]}),D&&mu&&d.jsx("div",{className:"w-[20vw] min-w-[350px] overflow-auto border-r",children:d.jsx(_00,{state:mu,modules:K,onChange:Zu=>{O(D,Zu)},onClose:()=>{j(void 0)},onExecute:()=>{v(D)},sessionId:g})}),d.jsx("div",{className:"h-full overflow-hidden",children:d.jsxs(Mau,{direction:"vertical",className:"h-full",children:[d.jsx(zp,{defaultSize:75,children:l?d.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-2",children:[d.jsx("h2",{className:"text-xl font-semibold",children:"An unexpected error happened!"}),d.jsxs("div",{className:"text-destructive max-w-lg",children:["Error:"," ",typeof l=="string"?l:JSON.stringify(l)]}),d.jsxs("div",{className:"text-muted-foreground max-w-lg text-center",children:["We apologize for the inconvenience. We have been notified of this problem. If the issue persists please contact"," ",d.jsx("a",{href:"mailto:support@momentic.ai",className:"text-primary hover:underline",children:"support@momentic.ai"}),"."]}),d.jsx(Ve,{variant:"outline",onClick:()=>{window.location.reload()},children:"Reconnect"})]}):r?d.jsxs("div",{className:"relative mx-auto h-full max-h-full max-w-full",onPointerMove:ve,children:[d.jsx(Iwe,{token:r.token,url:r.rtcUrl,sessionId:g}),b&&le?d.jsxs("div",{className:"bg-foreground text-background pointer-events-none absolute bottom-1 right-1 rounded p-1 text-xs opacity-50",children:["X: ",le.x,", Y: ",le.y]}):null,E&&E.type===cD.DISCONNECTED&&d.jsx("div",{className:"bg-background/80 absolute inset-0 z-10 flex items-center justify-center backdrop-blur-sm",children:d.jsx("div",{className:"bg-card mx-auto max-w-md rounded-lg border p-6 shadow-lg",children:d.jsxs("div",{className:"flex flex-col items-center gap-4",children:[d.jsx(Gf,{className:"h-8 w-8 text-yellow-500"}),d.jsx("p",{className:"text-center text-sm",children:E.message}),d.jsx(Ve,{variant:"outline",onClick:()=>{window.location.reload()},children:"Reconnect"})]})})})]}):d.jsx("div",{className:"flex h-full w-full items-center justify-center",children:d.jsx("h2",{className:"text-xl font-semibold",children:(E==null?void 0:E.message)||"Connecting to emulator..."})})}),d.jsx(Tau,{withHandle:!0}),d.jsx(zp,{defaultSize:25,children:d.jsxs(Tm,{defaultValue:"context",className:"flex h-full flex-col p-2",children:[d.jsxs(Od,{className:"self-start",children:[d.jsx(On,{value:"context",children:"Context"}),d.jsx(On,{value:"logcat",children:"Logcat"}),d.jsx(On,{value:"accessibility",children:"Accessibility"})]}),d.jsx(wn,{value:"context",className:"flex-1 overflow-auto",children:d.jsxs("div",{className:"grid h-full grid-rows-[auto_1fr] gap-2",children:[d.jsxs("p",{className:"text-muted-foreground text-sm",children:["You can access these values directly in a JavaScript step, or using the special"," ",d.jsx("span",{className:"text-foreground whitespace-nowrap font-mono",children:"{{ }}"})," ","syntax in other steps. For example, you can get the current URL with"," ",d.jsxs("span",{className:"text-foreground whitespace-nowrap font-mono",children:["{{ env.CURRENT_URL }}","."]})," ",d.jsx(xh,{slug:"/variables"})]}),F&&d.jsx(Itu,{data:F})]})}),d.jsx(wn,{value:"logcat",className:"h-full flex-1 overflow-hidden",children:d.jsx(dN,{FallbackComponent:NT,children:d.jsx(oRe,{logs:m})})}),d.jsx(wn,{value:"accessibility",className:"h-full flex-1 overflow-hidden",children:d.jsxs("div",{className:"flex h-full flex-col gap-2",children:[d.jsxs("div",{className:"flex flex-row gap-2",children:[d.jsxs(Ve,{onClick:z,disabled:p||!s||!f,variant:"secondary",size:"sm",children:[p&&d.jsx(n8,{className:"h-4 w-4 animate-spin"})," ","Load current page accessibility tree"]}),(x==null?void 0:x.a11yTree)&&d.jsx(Ve,{onClick:()=>{const Zu=new Blob([x.a11yTree],{type:"application/xml"});s_e("snapshot.xml",Zu)},variant:"secondary",size:"sm",children:"Download accessibility tree"})]}),d.jsx("div",{className:"flex-1",children:x!=null&&x.a11yTree?d.jsx(dN,{FallbackComponent:NT,children:d.jsx(jLe,{xml:x.a11yTree,dataType:"html"})}):x!=null&&x.err?d.jsxs("div",{className:"pl-2",children:[d.jsx("p",{className:"text-muted-foreground text-sm",children:"An error occurred while fetching the a11y tree."}),d.jsxs("p",{className:"text-destructive text-sm",children:["Error: ",x.err]})]}):x&&!x.a11yTree?d.jsx("p",{className:"text-muted-foreground pl-2 text-sm",children:"No a11y tree snapshot available."}):null})]})})]})})]})})]})]})};function $00(){const{"*":e=""}=cV(),{data:u,error:a}=Pm(e);return a?d.jsx(jwe,{err:a}):u?d.jsx(K00,{test:u,testPath:e,pathSegments:e.split("/")}):null}const V00=U3u([{path:"/",errorElement:d.jsx(Ugu,{}),children:[{index:!0,element:d.jsx(xV,{to:"/browse",replace:!0})},{element:d.jsx(Pwe,{}),children:[{path:"search",element:d.jsx(iOe,{})},{path:"assets",element:d.jsx(pvu,{})},{path:"environments",element:d.jsx(Hze,{})},{path:"browse/*",element:d.jsx($ze,{})}]},{path:"tests/*",element:d.jsx($00,{})}]}]);S7.createRoot(document.getElementById("root")).render(d.jsx(nu.StrictMode,{children:d.jsx(ldu,{children:d.jsx(Hdu,{value:{fetcher:o_e},children:d.jsx(kG,{sidebarWidth:"auto",children:d.jsxs(CG,{delayDuration:0,children:[d.jsx(tdu,{router:V00}),d.jsx(Jgu,{richColors:!0,closeButton:!0})]})})})})}));
|