@graphprotocol/hypergraph 0.5.0-alpha.2 → 0.5.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,88 +0,0 @@
1
- import{E as Ra,t as mr,g as Kc,O as Tt,U as Wc,b as Qc,c as Yc,d as Xc,P as Jc,e as eu,f as ge,I as uo,h as tu,i as nu,k as su,l as fo,T as Kr,M as ru,m as Q,n as Te,o as ie,C as iu,p as Wr,q as ou,D as au,s as ho,v as lu,w as cu,x as uu,y as Oa,S as Ie,A as Et,z as Qr,B as Ln,F as Lt,G as rn,N as De,H as at,J as se,K as du,L as ye,Q as ls,V as gr,W as fu,X as hu,Y as be,Z as pu,_ as yr,$ as vr,a0 as br,a1 as Rt,a2 as Yr,a3 as mu,a4 as lt,a5 as Cs,a6 as ks,a7 as Xr,a8 as Xs,a9 as po,aa as gu,ab as mo,ac as Ke,ad as xr,ae as es,af as yu,ag as wr,ah as go,ai as vu,aj as bu,ak as xu,al as yo,am as Fa,r as l,an as wu,ao as Eu,ap as Su,aq as Cu,ar as ku,as as Js,at as er,u as Jr,au as Tu,av as Ia,aw as vo,ax as Be,ay as cs,az as Sn,aA as us,aB as Er,aC as bo,aD as Mu,aE as Ru,aF as Ou,aG as xo,aH as Ts,aI as wo,aJ as Fu,aK as Aa,aL as Pa,aM as Oe,aN as Va,j as g,aO as ei,aP as ti,aQ as ot,aR as Ue,aS as At,aT as Qt,aU as qe,aV as Fe,aW as ts,aX as Iu,aY as ae,aZ as Me,a_ as ni,a$ as on,b0 as Pt,b1 as si,b2 as he,b3 as ri,b4 as en,b5 as pt,b6 as Eo,b7 as et,b8 as tt,b9 as ii,ba as oi,bb as an,bc as jt,bd as Au,be as Na,bf as Pu,bg as ai,bh as li,bi as Ms,bj as Vu,bk as st,bl as Nu,bm as ju,bn as Lu,bo as ja,bp as La,bq as Du,br as nt,bs as K,bt as le,bu as pe,bv as fn,bw as U,bx as Da,by as Rs,bz as Os,bA as hn,bB as Fs,bC as Is,bD as ee,bE as pn,bF as mn,bG as As,bH as dt,bI as Ps,bJ as So,bK as Rn,bL as $u,bM as $a,bN as te,bO as xe,bP as Dn,bQ as Ha,bR as Yt,bS as _a,bT as ci,bU as $n,bV as oe,bW as ke,bX as Ba,bY as xt,bZ as qa,b_ as it,b$ as ln,c0 as ui,c1 as di,c2 as Za,c3 as Ua,c4 as za,c5 as _t,c6 as Vs,c7 as ve,c8 as fi,c9 as hi,ca as pi,cb as Ce,cc as Hu,cd as Ns,ce as Sr,cf as mi,cg as Ga,ch as _u,ci as Ka,cj as gi,ck as Wa,cl as Qa,cm as js,cn as ft,co as yi,cp as vi,cq as Cn,cr as Bu,cs as Ls,ct as kn,cu as We,cv as ct,cw as Ya,cx as Co,cy as Vt,cz as qu,cA as Zu,cB as Uu,cC as zu,cD as Xa,cE as ko,cF as Gu,cG as Ku,cH as tr,cI as Wu,cJ as Qu,cK as Yu,cL as Xu,cM as Ju,cN as ed,cO as td,cP as Ge,cQ as nd,cR as ds,cS as we,cT as Ja,cU as el,cV as tl,cW as cn,cX as nl,cY as sl,cZ as rl,c_ as Cr,c$ as sd,d0 as Zn,d1 as rd,d2 as id,d3 as od,d4 as Un,d5 as nr,d6 as zn,d7 as ad,d8 as ld,d9 as cd,da as To}from"./index-bioTPE3q.js";const fs=e=>e.toUpperCase(),Dt=e=>e.toLowerCase(),hs=e=>e.length===0,ut=e=>e.length>0,Xt=e=>e.length;function ud(e){let t=e;if(t.startsWith("0x")&&(t=t.slice(2)),e.length%2!==0)throw new Error("Invalid hex string: must have an even length");const n=new Uint8Array(e.length/2);for(let s=0;s<e.length;s+=2)n[s/2]=Number.parseInt(e.slice(s,s+2),16);return n}function dd({name:e,ops:t,author:n,language:s}){return new Ra({id:mr(Kc()),name:e,ops:vd(t),authors:[ud(n)],language:s?mr(s):void 0}).toBinary()}function fd(e){const t={id:ge(e.id),type:ge(e.type),from_entity:ge(e.fromEntity),to_entity:ge(e.toEntity),entity:ge(e.entity)};return e.fromSpace&&(t.from_space=ge(e.fromSpace)),e.fromVersion&&(t.from_version=ge(e.fromVersion)),e.toSpace&&(t.to_space=ge(e.toSpace)),e.toVersion&&(t.to_version=ge(e.toVersion)),e.position!==void 0&&(t.position=e.position),e.verified!==void 0&&(t.verified=e.verified),t}function hd(e){return{id:ge(e.id),properties:e.properties.map(t=>ge(t))}}function pd(e){const t={id:ge(e.id)};return e.fromSpace&&(t.from_space=ge(e.fromSpace)),e.fromVersion&&(t.from_version=ge(e.fromVersion)),e.toSpace&&(t.to_space=ge(e.toSpace)),e.toVersion&&(t.to_version=ge(e.toVersion)),e.position!==void 0&&(t.position=e.position),e.verified!==void 0&&(t.verified=e.verified),t}function md(e){const t={id:ge(e.id)};return e.fromSpace!==void 0&&(t.from_space=e.fromSpace),e.fromVersion!==void 0&&(t.from_version=e.fromVersion),e.toSpace!==void 0&&(t.to_space=e.toSpace),e.toVersion!==void 0&&(t.to_version=e.toVersion),e.position!==void 0&&(t.position=e.position),e.verified!==void 0&&(t.verified=e.verified),t}function gd(e){return{id:ge(e.id).toString(),values:e.values.map(t=>{let n;t.options&&(t.options.text?n={text:{...t.options.text.language?{language:ge(uo(t.options.text.language)).toString()}:null}}:t.options.number&&(n={number:{...t.options.number.unit?{unit:ge(uo(t.options.number.unit)).toString()}:{}}}));const s={property:ge(t.property).toString(),value:t.value};return n&&(s.options=n),s})}}function yd(e){return{id:ge(e.id).toString(),dataType:e.dataType}}function vd(e){return e.map(t=>{switch(t.type){case"CREATE_RELATION":return new Tt({payload:{case:"createRelation",value:eu.fromJson(fd(t.relation))}});case"CREATE_PROPERTY":return new Tt({payload:{case:"createProperty",value:Jc.fromJson(yd(t.property))}});case"DELETE_RELATION":return new Tt({payload:{case:"deleteRelation",value:mr(t.id)}});case"UPDATE_ENTITY":return new Tt({payload:{case:"updateEntity",value:Xc.fromJson(gd(t.entity))}});case"UNSET_ENTITY_VALUES":return new Tt({payload:{case:"unsetEntityValues",value:Yc.fromJson(hd(t.unsetEntityValues))}});case"UPDATE_RELATION":return new Tt({payload:{case:"updateRelation",value:Qc.fromJson(pd(t.relation))}});case"UNSET_RELATION_FIELDS":return new Tt({payload:{case:"unsetRelationFields",value:Wc.fromJson(md(t.unsetRelationFields))}})}})}class Mo extends Error{_tag="IpfsUploadError"}async function bd(e){const{name:t,ops:n,author:s,network:r="MAINNET"}=e,i=dd({name:t,ops:n,author:s}),o=new Blob([i],{type:"application/octet-stream"}),a=new FormData;a.append("file",o);const c=await tu(xd(a,r)),d=Ra.fromBinary(i);return{cid:c,editId:nu(d.id)}}function xd(e,t){return su(function*(){const n=yield*fo({try:()=>fetch(`${t==="TESTNET"?Kr:ru}/ipfs/upload-edit`,{method:"POST",body:e}),catch:r=>new Mo(`Could not upload data to IPFS: ${r}`)});return yield*fo({try:async()=>{const{cid:r}=await n.json();return r},catch:r=>new Mo(`Could not parse response from IPFS: ${r}`)})})}const kr=({id:e,fromEntity:t,toEntity:n,position:s,fromSpace:r,toSpace:i,fromVersion:o,toVersion:a,verified:c,type:d,entityId:h,entityName:m,entityDescription:u,entityCover:f,entityValues:p,entityRelations:y,entityTypes:v})=>{e&&Q(e,"`id` in `createRelation`"),t&&Q(t,"`fromEntity` in `createRelation`"),n&&Q(n,"`toEntity` in `createRelation`"),r&&Q(r,"`fromSpace` in `createRelation`"),i&&Q(i,"`toSpace` in `createRelation`"),o&&Q(o,"`fromVersion` in `createRelation`"),a&&Q(a,"`toVersion` in `createRelation`"),d&&Q(d,"`type` in `createRelation`"),h&&Q(h,"`entityId` in `createRelation`"),f&&Q(f,"`entityCover` in `createRelation`");for(const S of p??[])if(Q(S.property,"`entityValues` in `createRelation`"),S.options){const C=S.options;switch(C.type){case"text":C.language&&Q(C.language,"`language` in `options` in `entityValues` in `createRelation`");break;case"number":C.unit&&Q(C.unit,"`unit` in `options` in `entityValues` in `createRelation`");break;default:throw new Error(`Invalid option type: ${C.type}`)}}for(const[S]of Object.entries(y??{}))Q(S,"`entityRelations` in `createRelation`");for(const S of v??[])Q(S,"`entityTypes` in `createRelation`");const b=e??Te(),x=h??Te(),E=[];if(E.push({type:"CREATE_RELATION",relation:{id:ie(b),entity:ie(x),fromEntity:ie(t),fromSpace:r?ie(r):void 0,fromVersion:o?ie(o):void 0,position:s,toEntity:ie(n),toSpace:i?ie(i):void 0,toVersion:a?ie(a):void 0,verified:c,type:ie(d)}}),m||u||f||p||y||v){const{ops:S}=bi({id:x,name:m,description:u,cover:f,values:p,relations:y,types:v});E.push(...S)}return{id:ie(b),ops:E}},bi=({id:e,name:t,description:n,cover:s,values:r,relations:i,types:o})=>{e&&Q(e,"`id` in `createEntity`"),s&&Q(s,"`cover` in `createEntity`");for(const m of r??[]){if(Q(m.property,"`values` in `createEntity`"),m.options){const u=m.options;switch(u.type){case"text":u.language&&Q(u.language,"`language` in `options` in `values` in `createEntity`");break;case"number":u.unit&&Q(u.unit,"`unit` in `options` in `values` in `createEntity`");break;default:throw new Error(`Invalid option type: ${u.type}`)}}for(const[u,f]of Object.entries(i??{}))if(Q(u,"`relations` in `createEntity`"),Array.isArray(f))for(const p of f)Q(p.toEntity,"`toEntity` in `relations` in `createEntity`"),p.toSpace&&Q(p.toSpace,"`toSpace` in `relations` in `createEntity`"),p.fromSpace&&Q(p.fromSpace,"`fromSpace` in `relations` in `createEntity`"),p.fromVersion&&Q(p.fromVersion,"`fromVersion` in `relations` in `createEntity`"),p.toVersion&&Q(p.toVersion,"`toVersion` in `relations` in `createEntity`"),p.entityId&&Q(p.entityId,"`entityId` in `relations` in `createEntity`"),p.entityCover&&Q(p.entityCover,"`entityCover` in `relations` in `createEntity`");else Q(f.toEntity,"`toEntity` in `relations` in `createEntity`"),f.toSpace&&Q(f.toSpace,"`toSpace` in `relations` in `createEntity`"),f.fromSpace&&Q(f.fromSpace,"`fromSpace` in `relations` in `createEntity`"),f.fromVersion&&Q(f.fromVersion,"`fromVersion` in `relations` in `createEntity`"),f.toVersion&&Q(f.toVersion,"`toVersion` in `relations` in `createEntity`"),f.entityId&&Q(f.entityId,"`entityId` in `relations` in `createEntity`"),f.entityCover&&Q(f.entityCover,"`entityCover` in `relations` in `createEntity`")}for(const m of o??[])Q(m,"`types` in `createEntity`");const a=e??Te();let c=[];const d=[];t&&d.push({property:ou,value:t}),n&&d.push({property:au,value:n});for(const m of r??[]){let u;if(m.options){const f=m.options;switch(f.type){case"text":u={text:{language:f.language}};break;case"number":u={number:{unit:f.unit}};break}}d.push({property:ie(m.property),value:m.value,options:u})}const h={type:"UPDATE_ENTITY",entity:{id:ie(a),values:d}};if(c.push(h),s&&c.push({type:"CREATE_RELATION",relation:{id:Te(),entity:Te(),fromEntity:ie(a),toEntity:ie(s),type:iu}}),o)for(const m of o)c.push({type:"CREATE_RELATION",relation:{id:Te(),entity:Te(),fromEntity:ie(a),toEntity:ie(m),type:Wr}});for(const[m,u]of Object.entries(i??{})){const f=Array.isArray(u)?u:[u];for(const p of f){const y=p.id??Te(),v=p.entityId??Te(),{ops:b}=kr({id:y,fromEntity:a,toEntity:p.toEntity,type:ie(m),position:p.position,fromSpace:p.fromSpace,toSpace:p.toSpace,fromVersion:p.fromVersion,toVersion:p.toVersion,verified:p.verified,entityId:v,entityName:p.entityName,entityDescription:p.entityDescription,entityCover:p.entityCover,entityValues:p.entityValues,entityRelations:p.entityRelations,entityTypes:p.entityTypes});c=c.concat(b)}}return{id:ie(a),ops:c}},Tr=e=>{const{id:t,name:n,description:s,cover:r}=e;if(t&&Q(t,"`id` in `createProperty`"),r&&Q(r,"`cover` in `createProperty`"),e.dataType==="RELATION"){for(const c of e.properties??[])Q(c,"`properties` in `createProperty`");for(const c of e.relationValueTypes??[])Q(c,"`relationValueTypes` in `createProperty`")}const i=t??Te(),o=[];o.push({type:"CREATE_PROPERTY",property:{id:ie(i),dataType:e.dataType}});const{ops:a}=bi({id:i,name:n,description:s,cover:r});if(o.push(...a),o.push({type:"CREATE_RELATION",relation:{id:Te(),entity:Te(),fromEntity:ie(i),toEntity:ho,type:Wr}}),e.dataType==="RELATION"){if(e.properties)for(const c of e.properties){Q(c);const{ops:d}=kr({fromEntity:i,toEntity:c,type:ho});o.push(...d)}if(e.relationValueTypes)for(const c of e.relationValueTypes){Q(c);const{ops:d}=kr({fromEntity:i,toEntity:c,type:lu});o.push(...d)}}return{id:ie(i),ops:o}},il=({id:e,name:t,description:n,cover:s,properties:r})=>{e&&Q(e,"`id` in `createType`");for(const a of r??[])Q(a,"`properties` in `createType`");const i=e??Te(),{ops:o}=bi({id:i,name:t,description:n,cover:s});if(Q(i),o.push({type:"CREATE_RELATION",relation:{id:Te(),entity:Te(),fromEntity:ie(i),toEntity:cu,type:Wr}}),r)for(const a of r)Q(a,"`propertyId` in `createType`"),o.push({type:"CREATE_RELATION",relation:{id:Te(),entity:Te(),fromEntity:ie(i),toEntity:ie(a),type:uu}});return{id:ie(i),ops:o}};function ol(e){if(hs(e))throw new al({input:e,cause:"Input is empty"});let t="",n=!1,s=0;for(;s<Xt(e)&&!/[a-zA-Z0-9]/.test(e[s]);)s++;for(;s<Xt(e);s++){const r=e[s];/[a-zA-Z0-9]/.test(r)?n?(t+=fs(r),n=!1):Xt(t)===0?t+=Dt(r):/[A-Z]/.test(r)&&s>0&&/[a-z0-9]/.test(e[s-1])?t+=fs(r):t+=Dt(r):n=Xt(t)>0}return t}function Mr(e){if(hs(e))throw new al({input:e,cause:"Input is empty"});let t="",n=!0,s=0;for(;s<Xt(e)&&!/[a-zA-Z0-9]/.test(e[s]);)s++;for(;s<Xt(e);s++){const r=e[s];/[a-zA-Z0-9]/.test(r)?n?(t+=fs(r),n=!1):/[A-Z]/.test(r)&&s>0&&/[a-z0-9]/.test(e[s-1])?t+=fs(r):t+=Dt(r):n=!0}return t}class al extends Oa("/typesync/errors/InvalidInputError"){}function Ds(e){const t=new Set;for(const n of e){const s=Dt(n.name);if(t.has(s))return!1;t.add(s)}return!0}function bt(e){return/^Relation\((.+)\)$/.test(e)}const ll=De.pipe(Lt(e=>bt(e))),cl=Yr("String","Number","Boolean","Date","Point");Qr(cl,ll);const ul=Ie({name:De,knowledgeGraphId:rn(lt),optional:gr(fu(mu))}),dl=Ie({...ul.fields,dataType:ll,relationType:De.annotations({identifier:"SchemaTypePropertyRelation.relationType",description:"name of the type within the schema that this property is related to",examples:["Account"]})}),fl=Ie({...ul.fields,dataType:cl});function On(e){return bt(e.dataType)}const hl=Ie({name:De,knowledgeGraphId:rn(lt),properties:Et(Qr(fl,dl)).pipe(Ln(1),Lt(Ds,{identifier:"DuplicatePropertyNames",jsonSchema:{},description:"The property.name must be unique across all properties in the type"}))}),pl=Ie({types:Et(hl).pipe(Ln(1),Lt(Ds,{identifier:"DuplicateTypeNames",jsonSchema:{},description:"The type.name must be unique across all types in the schema"}),Lt(ml,{identifier:"AllRelationTypesExist",jsonSchema:{},description:"Each type property of dataType RELATION must have a type of the same name in the schema"}))}).annotations({identifier:"typesync/Schema",title:"TypeSync app Schema",description:"An array of types in the schema defined by the user to generate a Mapping object for",examples:[{types:[{name:"Account",knowledgeGraphId:null,properties:[{name:"username",optional:null,knowledgeGraphId:null,dataType:"String"}]}]},{types:[{name:"Account",knowledgeGraphId:"a5fd07b1-120f-46c6-b46f-387ef98396a6",properties:[{name:"name",optional:!0,knowledgeGraphId:"a126ca53-0c8e-48d5-b888-82c734c38935",dataType:"String"}]}]}]}),wd=hu(pl);Cs(pl);function ml(e){const t=at(e,new Set,(n,s)=>n.add(s.name));return se(e,ls(n=>n.properties),ye(n=>On(n)),du(n=>t.has(n.relationType)))}function Rr(e){return se(e,at({},(t,{propName:n,id:s})=>(t[ol(n)]=s,t)))}function Or(e){return se(e,at({},(t,{propName:n,id:s})=>(t[ol(n)]=s,t)))}function Ed(e,t){if(e.knowledgeGraphId)return{type:"resolved",mapping:{propName:e.name,id:ie(e.knowledgeGraphId)},ops:[]};if(On(e)){const r=t.get(e.relationType);if(r==null)return{type:"deferred",property:e};const{id:i,ops:o}=Tr({name:e.name,dataType:"RELATION",relationValueTypes:[r]});return{type:"resolved",mapping:{propName:e.name,id:i},ops:o}}const{id:n,ops:s}=Tr({name:e.name,dataType:Td(e.dataType)});return{type:"resolved",mapping:{propName:e.name,id:n},ops:s}}function Sd(e,t){const n=se(e.properties,be(u=>Ed(u,t))),s=se(n,yr(u=>u.type==="resolved"?br(u):vr())),r=se(n,yr(u=>u.type==="deferred"?br(u.property):vr())),i=se(s,ye(u=>{const f=e.properties.find(p=>p.name===u.mapping.propName);return f?!On(f):!1}),be(u=>u.mapping)),o=se(s,ye(u=>{const f=e.properties.find(p=>p.name===u.mapping.propName);return f?On(f):!1}),be(u=>u.mapping)),a=se(s,ls(u=>u.ops));if(e.knowledgeGraphId){const u={typeName:Mr(e.name),typeIds:[ie(e.knowledgeGraphId)]};return Rt(i)&&(u.properties=Rr(i)),Rt(o)&&(u.relations=Or(o)),{type:"complete",entry:u,ops:a}}if(Rt(r))return{type:"deferred",schemaType:e,properties:i,relations:o};const c=[...i,...o],{id:d,ops:h}=il({name:e.name,properties:se(c,be(u=>u.id))});t.set(e.name,d);const m={typeName:Mr(e.name),typeIds:[d]};return Rt(i)&&(m.properties=Rr(i)),Rt(o)&&(m.relations=Or(o)),{type:"complete",entry:m,ops:[...a,...h]}}function Cd(e){const t=wd(e),n=se(t.types,at(new Map,(m,u)=>m.set(u.name,u.knowledgeGraphId!=null?ie(u.knowledgeGraphId):null))),s=se(t.types,be(m=>Sd(m,n))),[r,i]=se(s,pu(m=>m.type==="complete")),o=se(i,ls(m=>m.ops)),{entries:a,ops:c}=se(r,at({entries:[],ops:[]},(m,u)=>{const f=se(u.schemaType.properties,yr(S=>{if(!On(S)||S.knowledgeGraphId!=null)return vr();const C=n.get(S.relationType);if(C==null)throw new kd({message:`Failed to resolve type ID for relation type: ${S.relationType}`,property:S.name,relatedType:S.relationType});const{id:k,ops:V}=Tr({name:S.name,dataType:"RELATION",relationValueTypes:[C]});return br({mapping:{propName:S.name,id:k},ops:V})})),p=[...u.relations,...se(f,be(S=>S.mapping))],y=[...u.properties,...p],{id:v,ops:b}=il({name:u.schemaType.name,properties:se(y,be(S=>S.id))});n.set(u.schemaType.name,v);const x=[...se(f,ls(S=>S.ops)),...b],E={typeName:Mr(u.schemaType.name),typeIds:[v]};return Rt(u.properties)&&(E.properties=Rr(u.properties)),Rt(p)&&(E.relations=Or(p)),{entries:[...m.entries,E],ops:[...m.ops,...x]}})),d=[...se(i,be(m=>m.entry)),...a];return[se(d,at({},(m,u)=>{const{typeName:f,...p}=u;return m[f]=p,m})),[...o,...c]]}class kd extends Oa("/typesync/errors/RelationValueTypeDoesNotExistError"){}function Td(e){switch(!0){case e==="Boolean":return"BOOLEAN";case e==="Date":return"TIME";case e==="Number":return"NUMBER";case e==="Point":return"POINT";case bt(e):return"RELATION";default:return"STRING"}}const gl=rn(Yr("published","synced","published_not_synced")),Md=Qr(fl,dl).pipe(Xr(Ie({status:gl})));class Fr extends ks("/Hypergraph/cli/models/TypesyncHypergraphSchemaType")({...hl.omit("properties").fields,status:gl,properties:Et(Md).pipe(Ln(1),Lt(Ds,{identifier:"DuplicatePropertyNames",jsonSchema:{},description:"The property.name must be unique across all properties in the type"}))}){}class Hn extends ks("/Hypergraph/cli/models/TypesyncHypergraphSchema")({types:Et(Fr).pipe(Ln(1),Lt(Ds,{identifier:"DuplicateTypeNames",jsonSchema:{},description:"The type.name must be unique across all types in the schema"}),Lt(ml,{identifier:"AllRelationTypesExist",jsonSchema:{},description:"Each type property of dataType RELATION must have a type of the same name in the schema"}))}){}Xs({key:De,value:Ie({typeIds:Et(lt).pipe(Ln(1)),properties:gr(po(Xs({key:De,value:lt}))),relations:gr(po(Xs({key:De,value:lt})))})});var Rd=class extends gu{constructor(t,n){super(),this.options=n,this.#n=t,this.#o=null,this.#i=mo(),this.options.experimental_prefetchInRender||this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}#n;#e=void 0;#s=void 0;#t=void 0;#r;#l;#i;#o;#m;#f;#h;#c;#u;#a;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Ro(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Ir(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Ir(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#e.removeObserver(this)}setOptions(t){const n=this.options,s=this.#e;if(this.options=this.#n.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ke(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#E(),this.#e.setOptions(this.options),n._defaulted&&!xr(this.options,n)&&this.#n.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&Oo(this.#e,s,this.options,n)&&this.#d(),this.updateResult(),r&&(this.#e!==s||Ke(this.options.enabled,this.#e)!==Ke(n.enabled,this.#e)||es(this.options.staleTime,this.#e)!==es(n.staleTime,this.#e))&&this.#g();const i=this.#y();r&&(this.#e!==s||Ke(this.options.enabled,this.#e)!==Ke(n.enabled,this.#e)||i!==this.#a)&&this.#v(i)}getOptimisticResult(t){const n=this.#n.getQueryCache().build(this.#n,t),s=this.createResult(n,t);return Fd(this,s)&&(this.#t=s,this.#l=this.options,this.#r=this.#e.state),s}getCurrentResult(){return this.#t}trackResult(t,n){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),n?.(r),Reflect.get(s,r))})}trackProp(t){this.#p.add(t)}getCurrentQuery(){return this.#e}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=this.#n.defaultQueryOptions(t),s=this.#n.getQueryCache().build(this.#n,n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return this.#d({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#d(t){this.#E();let n=this.#e.fetch(this.options,t);return t?.throwOnError||(n=n.catch(yu)),n}#g(){this.#x();const t=es(this.options.staleTime,this.#e);if(wr||this.#t.isStale||!go(t))return;const s=vu(this.#t.dataUpdatedAt,t)+1;this.#c=setTimeout(()=>{this.#t.isStale||this.updateResult()},s)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#v(t){this.#w(),this.#a=t,!(wr||Ke(this.options.enabled,this.#e)===!1||!go(this.#a)||this.#a===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||bu.isFocused())&&this.#d()},this.#a))}#b(){this.#g(),this.#v(this.#y())}#x(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(t,n){const s=this.#e,r=this.options,i=this.#t,o=this.#r,a=this.#l,d=t!==s?t.state:this.#s,{state:h}=t;let m={...h},u=!1,f;if(n._optimisticResults){const T=this.hasListeners(),M=!T&&Ro(t,n),F=T&&Oo(t,s,n,r);(M||F)&&(m={...m,...xu(h.data,t.options)}),n._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:p,errorUpdatedAt:y,status:v}=m;f=m.data;let b=!1;if(n.placeholderData!==void 0&&f===void 0&&v==="pending"){let T;i?.isPlaceholderData&&n.placeholderData===a?.placeholderData?(T=i.data,b=!0):T=typeof n.placeholderData=="function"?n.placeholderData(this.#h?.state.data,this.#h):n.placeholderData,T!==void 0&&(v="success",f=yo(i?.data,T,n),u=!0)}if(n.select&&f!==void 0&&!b)if(i&&f===o?.data&&n.select===this.#m)f=this.#f;else try{this.#m=n.select,f=n.select(f),f=yo(i?.data,f,n),this.#f=f,this.#o=null}catch(T){this.#o=T}this.#o&&(p=this.#o,f=this.#f,y=Date.now(),v="error");const x=m.fetchStatus==="fetching",E=v==="pending",S=v==="error",C=E&&x,k=f!==void 0,A={status:v,fetchStatus:m.fetchStatus,isPending:E,isSuccess:v==="success",isError:S,isInitialLoading:C,isLoading:C,data:f,dataUpdatedAt:m.dataUpdatedAt,error:p,errorUpdatedAt:y,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:m.dataUpdateCount>0||m.errorUpdateCount>0,isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:x,isRefetching:x&&!E,isLoadingError:S&&!k,isPaused:m.fetchStatus==="paused",isPlaceholderData:u,isRefetchError:S&&k,isStale:xi(t,n),refetch:this.refetch,promise:this.#i};if(this.options.experimental_prefetchInRender){const T=I=>{A.status==="error"?I.reject(A.error):A.data!==void 0&&I.resolve(A.data)},M=()=>{const I=this.#i=A.promise=mo();T(I)},F=this.#i;switch(F.status){case"pending":t.queryHash===s.queryHash&&T(F);break;case"fulfilled":(A.status==="error"||A.data!==F.value)&&M();break;case"rejected":(A.status!=="error"||A.error!==F.reason)&&M();break}}return A}updateResult(){const t=this.#t,n=this.createResult(this.#e,this.options);if(this.#r=this.#e.state,this.#l=this.options,this.#r.data!==void 0&&(this.#h=this.#e),xr(n,t))return;this.#t=n;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#p.size)return!0;const o=new Set(i??this.#p);return this.options.throwOnError&&o.add("error"),Object.keys(this.#t).some(a=>{const c=a;return this.#t[c]!==t[c]&&o.has(c)})};this.#S({listeners:s()})}#E(){const t=this.#n.getQueryCache().build(this.#n,this.options);if(t===this.#e)return;const n=this.#e;this.#e=t,this.#s=t.state,this.hasListeners()&&(n?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(t){Fa.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(this.#t)}),this.#n.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function Od(e,t){return Ke(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ro(e,t){return Od(e,t)||e.state.data!==void 0&&Ir(e,t,t.refetchOnMount)}function Ir(e,t,n){if(Ke(t.enabled,e)!==!1){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&xi(e,t)}return!1}function Oo(e,t,n,s){return(e!==t||Ke(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&xi(e,n)}function xi(e,t){return Ke(t.enabled,e)!==!1&&e.isStaleByTime(es(t.staleTime,e))}function Fd(e,t){return!xr(e.getCurrentResult(),t)}var yl=l.createContext(!1),Id=()=>l.useContext(yl);yl.Provider;function Ad(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Pd=l.createContext(Ad()),Vd=()=>l.useContext(Pd);function Nd(e,t){return typeof e=="function"?e(...t):!!e}function Fo(){}var jd=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},Ld=e=>{l.useEffect(()=>{e.clearReset()},[e])},Dd=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(r&&e.data===void 0||Nd(n,[e.error,s])),$d=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},Hd=(e,t)=>e.isLoading&&e.isFetching&&!t,_d=(e,t)=>e?.suspense&&t.isPending,Io=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Bd(e,t,n){const s=wu(),r=Id(),i=Vd(),o=s.defaultQueryOptions(e);s.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=r?"isRestoring":"optimistic",$d(o),jd(o,i),Ld(i);const a=!s.getQueryCache().get(o.queryHash),[c]=l.useState(()=>new t(s,o)),d=c.getOptimisticResult(o),h=!r&&e.subscribed!==!1;if(l.useSyncExternalStore(l.useCallback(m=>{const u=h?c.subscribe(Fa.batchCalls(m)):Fo;return c.updateResult(),u},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),l.useEffect(()=>{c.setOptions(o)},[o,c]),_d(o,d))throw Io(o,c,i);if(Dd({result:d,errorResetBoundary:i,throwOnError:o.throwOnError,query:s.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw d.error;return s.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!wr&&Hd(d,r)&&(a?Io(o,c,i):s.getQueryCache().get(o.queryHash)?.promise)?.catch(Fo).finally(()=>{c.updateResult()}),o.notifyOnChangeProps?d:c.trackResult(d)}function qd(e,t){return Bd(e,Rd)}class tn extends Error{response;request;constructor(t,n){const s=`${tn.extractMessage(t)}: ${JSON.stringify({response:t,request:n})}`;super(s),Object.setPrototypeOf(this,tn.prototype),this.response=t,this.request=n,typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,tn)}static extractMessage(t){return t.errors?.[0]?.message??`GraphQL Error (Code: ${String(t.status)})`}}const Ao=e=>e.toUpperCase(),sr=e=>typeof e=="function"?e():e,vl=(e,t)=>e.map((n,s)=>[n,t[s]]),zt=e=>{let t={};return e instanceof Headers?t=Zd(e):Array.isArray(e)?e.forEach(([n,s])=>{n&&s!==void 0&&(t[n]=s)}):e&&(t=e),t},Zd=e=>{const t={};return e.forEach((n,s)=>{t[s]=n}),t},Ud=e=>{try{const t=e();return zd(t)?t.catch(n=>Po(n)):t}catch(t){return Po(t)}},Po=e=>e instanceof Error?e:new Error(String(e)),zd=e=>typeof e=="object"&&e!==null&&"then"in e&&typeof e.then=="function"&&"catch"in e&&typeof e.catch=="function"&&"finally"in e&&typeof e.finally=="function",wi=e=>{throw new Error(`Unhandled case: ${String(e)}`)},ns=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),Gd=(e,t)=>e.documents?e:{documents:e,requestHeaders:t,signal:void 0},Kd=(e,t,n)=>e.query?e:{query:e,variables:t,requestHeaders:n,signal:void 0},Vo="Accept",Ar="Content-Type",Pr="application/json",bl="application/graphql-response+json",No=e=>e.replace(/([\s,]|#[^\n\r]+)+/g," ").trim(),Wd=e=>{const t=e.toLowerCase();return t.includes(bl)||t.includes(Pr)},jo=e=>{try{if(Array.isArray(e))return{_tag:"Batch",executionResults:e.map(Lo)};if(ns(e))return{_tag:"Single",executionResult:Lo(e)};throw new Error(`Invalid execution result: result is not object or array.
2
- Got:
3
- ${String(e)}`)}catch(t){return t}},Lo=e=>{if(typeof e!="object"||e===null)throw new Error("Invalid execution result: result is not object");let t,n,s;if("errors"in e){if(!ns(e.errors)&&!Array.isArray(e.errors))throw new Error("Invalid execution result: errors is not plain object OR array");t=e.errors}if("data"in e){if(!ns(e.data)&&e.data!==null)throw new Error("Invalid execution result: data is not plain object");n=e.data}if("extensions"in e){if(!ns(e.extensions))throw new Error("Invalid execution result: extensions is not plain object");s=e.extensions}return{data:n,errors:t,extensions:s}},Qd=e=>e._tag==="Batch"?e.executionResults.some(Do):Do(e.executionResult),Do=e=>Array.isArray(e.errors)?e.errors.length>0:!!e.errors,xl=e=>typeof e=="object"&&e!==null&&"kind"in e&&e.kind===Eu.OPERATION_DEFINITION,Yd=e=>{let t;const n=e.definitions.filter(xl);return n.length===1&&(t=n[0].name?.value),t},Xd=e=>{let t=!1;const n=e.definitions.filter(xl);return n.length===1&&(t=n[0].operation===ku.MUTATION),t},rr=(e,t)=>{const n=typeof e=="string"?e:Su(e);let s=!1,r;if(t)return{expression:n,isMutation:s,operationName:r};const i=Ud(()=>typeof e=="string"?Cu(e):e);return i instanceof Error?{expression:n,isMutation:s,operationName:r}:(r=Yd(i),s=Xd(i),{expression:n,operationName:r,isMutation:s})},Ei=JSON,ir=async e=>{const t={...e,method:e.request._tag==="Single"?e.request.document.isMutation?"POST":Ao(e.method??"post"):e.request.hasMutations?"POST":Ao(e.method??"post"),fetchOptions:{...e.fetchOptions,errorPolicy:e.fetchOptions.errorPolicy??"none"}},s=await ef(t.method)(t);if(!s.ok)return new tn({status:s.status,headers:s.headers},{query:e.request._tag==="Single"?e.request.document.expression:e.request.query,variables:e.request.variables});const r=await Jd(s,e.fetchOptions.jsonSerializer??Ei);if(r instanceof Error)throw r;const i={status:s.status,headers:s.headers};if(Qd(r)&&t.fetchOptions.errorPolicy==="none"){const o=r._tag==="Batch"?{...r.executionResults,...i}:{...r.executionResult,...i};return new tn(o,{query:e.request._tag==="Single"?e.request.document.expression:e.request.query,variables:e.request.variables})}switch(r._tag){case"Single":return{...i,...$o(t)(r.executionResult)};case"Batch":return{...i,data:r.executionResults.map($o(t))};default:wi(r)}},$o=e=>t=>({extensions:t.extensions,data:t.data,errors:e.fetchOptions.errorPolicy==="all"?t.errors:void 0}),Jd=async(e,t)=>{const n=e.headers.get(Ar),s=await e.text();return n&&Wd(n)?jo(t.parse(s)):jo(s)},ef=e=>async t=>{const n=new Headers(t.headers);let s=null,r;n.has(Vo)||n.set(Vo,[bl,Pr].join(", ")),e==="POST"?(r=(t.fetchOptions.jsonSerializer??Ei).stringify(tf(t)),typeof r=="string"&&!n.has(Ar)&&n.set(Ar,Pr)):s=nf(t);const i={method:e,headers:n,body:r,...t.fetchOptions};let o=new URL(t.url),a=i;if(t.middleware){const d=await Promise.resolve(t.middleware({...i,url:t.url,operationName:t.request._tag==="Single"?t.request.document.operationName:void 0,variables:t.request.variables})),{url:h,...m}=d;o=new URL(h),a=m}return s&&s.forEach((d,h)=>{o.searchParams.append(h,d)}),await(t.fetch??fetch)(o,a)},tf=e=>{switch(e.request._tag){case"Single":return{query:e.request.document.expression,variables:e.request.variables,operationName:e.request.document.operationName};case"Batch":return vl(e.request.query,e.request.variables??[]).map(([t,n])=>({query:t,variables:n}));default:throw wi(e.request)}},nf=e=>{const t=e.fetchOptions.jsonSerializer??Ei,n=new URLSearchParams;switch(e.request._tag){case"Single":return n.append("query",No(e.request.document.expression)),e.request.variables&&n.append("variables",t.stringify(e.request.variables)),e.request.document.operationName&&n.append("operationName",e.request.document.operationName),n;case"Batch":{const s=e.request.variables?.map(o=>t.stringify(o))??[],r=e.request.query.map(No),i=vl(r,s).map(([o,a])=>({query:o,variables:a}));return n.append("query",t.stringify(i)),n}default:throw wi(e.request)}};class sf{url;requestConfig;constructor(t,n={}){this.url=t,this.requestConfig=n}rawRequest=async(...t)=>{const[n,s,r]=t,i=Kd(n,s,r),{headers:o,fetch:a=globalThis.fetch,method:c="POST",requestMiddleware:d,responseMiddleware:h,excludeOperationName:m,...u}=this.requestConfig,{url:f}=this;i.signal!==void 0&&(u.signal=i.signal);const p=rr(i.query,m),y=await ir({url:f,request:{_tag:"Single",document:p,variables:i.variables},headers:{...zt(sr(o)),...zt(i.requestHeaders)},fetch:a,method:c,fetchOptions:u,middleware:d});if(h&&await h(y,{operationName:p.operationName,variables:s,url:this.url}),y instanceof Error)throw y;return y};async request(t,...n){const[s,r]=n,i=of(t,s,r),{headers:o,fetch:a=globalThis.fetch,method:c="POST",requestMiddleware:d,responseMiddleware:h,excludeOperationName:m,...u}=this.requestConfig,{url:f}=this;i.signal!==void 0&&(u.signal=i.signal);const p=rr(i.document,m),y=await ir({url:f,request:{_tag:"Single",document:p,variables:i.variables},headers:{...zt(sr(o)),...zt(i.requestHeaders)},fetch:a,method:c,fetchOptions:u,middleware:d});if(h&&await h(y,{operationName:p.operationName,variables:i.variables,url:this.url}),y instanceof Error)throw y;return y.data}async batchRequests(t,n){const s=Gd(t,n),{headers:r,excludeOperationName:i,...o}=this.requestConfig;s.signal!==void 0&&(o.signal=s.signal);const a=s.documents.map(({document:u})=>rr(u,i)),c=a.map(({expression:u})=>u),d=a.some(({isMutation:u})=>u),h=s.documents.map(({variables:u})=>u),m=await ir({url:this.url,request:{_tag:"Batch",operationName:void 0,query:c,hasMutations:d,variables:h},headers:{...zt(sr(r)),...zt(s.requestHeaders)},fetch:this.requestConfig.fetch??globalThis.fetch,method:this.requestConfig.method||"POST",fetchOptions:o,middleware:this.requestConfig.requestMiddleware});if(this.requestConfig.responseMiddleware&&await this.requestConfig.responseMiddleware(m,{operationName:void 0,variables:h,url:this.url}),m instanceof Error)throw m;return m.data}setHeaders(t){return this.requestConfig.headers=t,this}setHeader(t,n){const{headers:s}=this.requestConfig;return s?s[t]=n:this.requestConfig.headers={[t]:n},this}setEndpoint(t){return this.url=t,this}}async function rf(e,t,...n){const s=af(e,t,...n);return new sf(s.url).request({...s})}const of=(e,t,n)=>e.document?e:{document:e,variables:t,requestHeaders:n,signal:void 0},af=(e,t,...n)=>{const[s,r]=n;return typeof e=="string"?{url:e,document:t,variables:s,requestHeaders:r,signal:void 0}:e},lf=(e,...t)=>e.reduce((n,s,r)=>`${n}${s}${r in t?String(t[r]):""}`,""),cf=lf`
4
- query Spaces($accountAddress: String!) {
5
- spaces(filter: {members: {some: {address: {is: $accountAddress}}}}) {
6
- id
7
- spaceAddress
8
- page {
9
- name
10
- }
11
- }
12
- }
13
- `,uf=e=>{const t=Js(er,a=>a.context.identity?.accountAddress),n=qd({queryKey:["hypergraph-spaces",e.mode],queryFn:async()=>{const a=await rf(`${Kr}/graphql`,cf,{accountAddress:t});return a?.spaces?a.spaces.map(c=>({id:c.id,name:c.page?.name,spaceAddress:c.spaceAddress})):[]},enabled:e.mode==="public"&&!!t}),{isConnecting:s,listSpaces:r}=Jr();l.useEffect(()=>{e.mode==="private"&&!s&&r()},[e.mode,r,s]);const i=Js(er,a=>a.context.spaces),o=Js(er,a=>a.context.spacesLoadingIsPending);return e.mode==="private"?{data:i,isPending:o}:n},df=async({name:e,ops:t,walletClient:n,space:s})=>{const r=n.account?.address;if(!r)throw new Error("No address found");const i=n.chain.id===Tu.id?"TESTNET":"MAINNET",a=(await bd({name:e,ops:t,author:r,network:i})).cid,c=await fetch(`${Kr}/space/${s}/edit/calldata`,{method:"POST",body:JSON.stringify({cid:a})}),{to:d,data:h}=await c.json();return{txResult:await n.sendUserOperation({calls:[{to:d,value:0n,data:h}]}),to:d,data:h,cid:a}};var ff=class extends Ia{constructor(e,t){super(),this.options=t,this.#n=e,this.#o=null,this.#i=vo(),this.options.experimental_prefetchInRender||this.#i.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#n;#e=void 0;#s=void 0;#t=void 0;#r;#l;#i;#o;#m;#f;#h;#c;#u;#a;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Ho(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Vr(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Vr(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,n=this.#e;if(this.options=this.#n.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Be(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#E(),this.#e.setOptions(this.options),t._defaulted&&!cs(this.options,t)&&this.#n.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const s=this.hasListeners();s&&_o(this.#e,n,this.options,t)&&this.#d(),this.updateResult(),s&&(this.#e!==n||Be(this.options.enabled,this.#e)!==Be(t.enabled,this.#e)||Sn(this.options.staleTime,this.#e)!==Sn(t.staleTime,this.#e))&&this.#g();const r=this.#y();s&&(this.#e!==n||Be(this.options.enabled,this.#e)!==Be(t.enabled,this.#e)||r!==this.#a)&&this.#v(r)}getOptimisticResult(e){const t=this.#n.getQueryCache().build(this.#n,e),n=this.createResult(t,e);return pf(this,n)&&(this.#t=n,this.#l=this.options,this.#r=this.#e.state),n}getCurrentResult(){return this.#t}trackResult(e,t){return new Proxy(e,{get:(n,s)=>(this.trackProp(s),t?.(s),Reflect.get(n,s))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#n.defaultQueryOptions(e),n=this.#n.getQueryCache().build(this.#n,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#d(e){this.#E();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(us)),t}#g(){this.#x();const e=Sn(this.options.staleTime,this.#e);if(Er||this.#t.isStale||!bo(e))return;const n=Mu(this.#t.dataUpdatedAt,e)+1;this.#c=setTimeout(()=>{this.#t.isStale||this.updateResult()},n)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#v(e){this.#w(),this.#a=e,!(Er||Be(this.options.enabled,this.#e)===!1||!bo(this.#a)||this.#a===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||Ru.isFocused())&&this.#d()},this.#a))}#b(){this.#g(),this.#v(this.#y())}#x(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#e,s=this.options,r=this.#t,i=this.#r,o=this.#l,c=e!==n?e.state:this.#s,{state:d}=e;let h={...d},m=!1,u;if(t._optimisticResults){const A=this.hasListeners(),T=!A&&Ho(e,t),M=A&&_o(e,n,t,s);(T||M)&&(h={...h,...Ou(d.data,e.options)}),t._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:f,errorUpdatedAt:p,status:y}=h;u=h.data;let v=!1;if(t.placeholderData!==void 0&&u===void 0&&y==="pending"){let A;r?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(A=r.data,v=!0):A=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,A!==void 0&&(y="success",u=xo(r?.data,A,t),m=!0)}if(t.select&&u!==void 0&&!v)if(r&&u===i?.data&&t.select===this.#m)u=this.#f;else try{this.#m=t.select,u=t.select(u),u=xo(r?.data,u,t),this.#f=u,this.#o=null}catch(A){this.#o=A}this.#o&&(f=this.#o,u=this.#f,p=Date.now(),y="error");const b=h.fetchStatus==="fetching",x=y==="pending",E=y==="error",S=x&&b,C=u!==void 0,V={status:y,fetchStatus:h.fetchStatus,isPending:x,isSuccess:y==="success",isError:E,isInitialLoading:S,isLoading:S,data:u,dataUpdatedAt:h.dataUpdatedAt,error:f,errorUpdatedAt:p,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>c.dataUpdateCount||h.errorUpdateCount>c.errorUpdateCount,isFetching:b,isRefetching:b&&!x,isLoadingError:E&&!C,isPaused:h.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:E&&C,isStale:Si(e,t),refetch:this.refetch,promise:this.#i,isEnabled:Be(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const A=F=>{V.status==="error"?F.reject(V.error):V.data!==void 0&&F.resolve(V.data)},T=()=>{const F=this.#i=V.promise=vo();A(F)},M=this.#i;switch(M.status){case"pending":e.queryHash===n.queryHash&&A(M);break;case"fulfilled":(V.status==="error"||V.data!==M.value)&&T();break;case"rejected":(V.status!=="error"||V.error!==M.reason)&&T();break}}return V}updateResult(){const e=this.#t,t=this.createResult(this.#e,this.options);if(this.#r=this.#e.state,this.#l=this.options,this.#r.data!==void 0&&(this.#h=this.#e),cs(t,e))return;this.#t=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,r=typeof s=="function"?s():s;if(r==="all"||!r&&!this.#p.size)return!0;const i=new Set(r??this.#p);return this.options.throwOnError&&i.add("error"),Object.keys(this.#t).some(o=>{const a=o;return this.#t[a]!==e[a]&&i.has(a)})};this.#S({listeners:n()})}#E(){const e=this.#n.getQueryCache().build(this.#n,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#s=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){Ts.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#t)}),this.#n.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function hf(e,t){return Be(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function Ho(e,t){return hf(e,t)||e.state.data!==void 0&&Vr(e,t,t.refetchOnMount)}function Vr(e,t,n){if(Be(t.enabled,e)!==!1&&Sn(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&Si(e,t)}return!1}function _o(e,t,n,s){return(e!==t||Be(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&Si(e,n)}function Si(e,t){return Be(t.enabled,e)!==!1&&e.isStaleByTime(Sn(t.staleTime,e))}function pf(e,t){return!cs(e.getCurrentResult(),t)}var mf=class extends Ia{#n;#e=void 0;#s;#t;constructor(e,t){super(),this.#n=e,this.setOptions(t),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const t=this.options;this.options=this.#n.defaultMutationOptions(e),cs(this.options,t)||this.#n.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#s,observer:this}),t?.mutationKey&&this.options.mutationKey&&wo(t.mutationKey)!==wo(this.options.mutationKey)?this.reset():this.#s?.state.status==="pending"&&this.#s.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#s?.removeObserver(this)}onMutationUpdate(e){this.#r(),this.#l(e)}getCurrentResult(){return this.#e}reset(){this.#s?.removeObserver(this),this.#s=void 0,this.#r(),this.#l()}mutate(e,t){return this.#t=t,this.#s?.removeObserver(this),this.#s=this.#n.getMutationCache().build(this.#n,this.options),this.#s.addObserver(this),this.#s.execute(e)}#r(){const e=this.#s?.state??Fu();this.#e={...e,isPending:e.status==="pending",isSuccess:e.status==="success",isError:e.status==="error",isIdle:e.status==="idle",mutate:this.mutate,reset:this.reset}}#l(e){Ts.batch(()=>{if(this.#t&&this.hasListeners()){const t=this.#e.variables,n=this.#e.context;e?.type==="success"?(this.#t.onSuccess?.(e.data,t,n),this.#t.onSettled?.(e.data,null,t,n)):e?.type==="error"&&(this.#t.onError?.(e.error,t,n),this.#t.onSettled?.(void 0,e.error,t,n))}this.listeners.forEach(t=>{t(this.#e)})})}},wl=l.createContext(!1),gf=()=>l.useContext(wl);wl.Provider;function yf(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var vf=l.createContext(yf()),bf=()=>l.useContext(vf),xf=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},wf=e=>{l.useEffect(()=>{e.clearReset()},[e])},Ef=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:r})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(r&&e.data===void 0||Aa(n,[e.error,s])),Sf=e=>{if(e.suspense){const t=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>t(n(...s)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Cf=(e,t)=>e.isLoading&&e.isFetching&&!t,kf=(e,t)=>e?.suspense&&t.isPending,Bo=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function Tf(e,t,n){const s=gf(),r=bf(),i=Pa(),o=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=s?"isRestoring":"optimistic",Sf(o),xf(o,r),wf(r);const a=!i.getQueryCache().get(o.queryHash),[c]=l.useState(()=>new t(i,o)),d=c.getOptimisticResult(o),h=!s&&e.subscribed!==!1;if(l.useSyncExternalStore(l.useCallback(m=>{const u=h?c.subscribe(Ts.batchCalls(m)):us;return c.updateResult(),u},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),l.useEffect(()=>{c.setOptions(o)},[o,c]),kf(o,d))throw Bo(o,c,r);if(Ef({result:d,errorResetBoundary:r,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw d.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(o,d),o.experimental_prefetchInRender&&!Er&&Cf(d,s)&&(a?Bo(o,c,r):i.getQueryCache().get(o.queryHash)?.promise)?.catch(us).finally(()=>{c.updateResult()}),o.notifyOnChangeProps?d:c.trackResult(d)}function El(e,t){return Tf(e,ff)}function Sl(e,t){const n=Pa(),[s]=l.useState(()=>new mf(n,e));l.useEffect(()=>{s.setOptions(e)},[s,e]);const r=l.useSyncExternalStore(l.useCallback(o=>s.subscribe(Ts.batchCalls(o)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),i=l.useCallback((o,a)=>{s.mutate(o,a).catch(us)},[s]);if(r.error&&Aa(s.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:i,mutateAsync:r.mutate}}function Tn(e,t,n=!0){return e.filter(r=>r.parentId===t&&(!n||r.context?.open)).flatMap(r=>[r,...Tn(e,r.id,n)])}function Mf(e){return"nativeEvent"in e}function ps(e,t){const n=["mouse","pen"];return n.push("",void 0),n.includes(e)}const Rf=["top","right","bottom","left"],un=Math.min,Ae=Math.max,ms=Math.round,Gn=Math.floor,Xe=e=>({x:e,y:e}),Of={left:"right",right:"left",bottom:"top",top:"bottom"},Ff={start:"end",end:"start"};function Nr(e,t,n){return Ae(e,un(t,n))}function ht(e,t){return typeof e=="function"?e(t):e}function $e(e){return e.split("-")[0]}function St(e){return e.split("-")[1]}function Ci(e){return e==="x"?"y":"x"}function ki(e){return e==="y"?"height":"width"}const If=new Set(["top","bottom"]);function Ze(e){return If.has($e(e))?"y":"x"}function Ti(e){return Ci(Ze(e))}function Af(e,t,n){n===void 0&&(n=!1);const s=St(e),r=Ti(e),i=ki(r);let o=r==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[i]>t.floating[i]&&(o=gs(o)),[o,gs(o)]}function Pf(e){const t=gs(e);return[jr(e),t,jr(t)]}function jr(e){return e.replace(/start|end/g,t=>Ff[t])}const qo=["left","right"],Zo=["right","left"],Vf=["top","bottom"],Nf=["bottom","top"];function jf(e,t,n){switch(e){case"top":case"bottom":return n?t?Zo:qo:t?qo:Zo;case"left":case"right":return t?Vf:Nf;default:return[]}}function Lf(e,t,n,s){const r=St(e);let i=jf($e(e),n==="start",s);return r&&(i=i.map(o=>o+"-"+r),t&&(i=i.concat(i.map(jr)))),i}function gs(e){return e.replace(/left|right|bottom|top/g,t=>Of[t])}function Df(e){return{top:0,right:0,bottom:0,left:0,...e}}function Cl(e){return typeof e!="number"?Df(e):{top:e,right:e,bottom:e,left:e}}function ys(e){const{x:t,y:n,width:s,height:r}=e;return{width:s,height:r,top:n,left:t,right:t+s,bottom:n+r,x:t,y:n}}const kl={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1},or=l.forwardRef(function(t,n){const[s,r]=l.useState();Oe(()=>{Va&&r("button")},[]);const i={ref:n,tabIndex:0,role:s,"aria-hidden":s?void 0:!0,style:kl};return g.jsx("span",{...t,...i,"data-base-ui-focus-guard":""})}),$f=l.createContext(void 0);function Uo(e,t,n,s){const r=ei(Tl).current;return _f(r,e,t,n,s)&&Ml(r,[e,t,n,s]),r.callback}function Hf(e){const t=ei(Tl).current;return Bf(t,e)&&Ml(t,e),t.callback}function Tl(){return{callback:null,cleanup:null,refs:[]}}function _f(e,t,n,s,r){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==s||e.refs[3]!==r}function Bf(e,t){return e.refs.length!==t.length||e.refs.some((n,s)=>n!==t[s])}function Ml(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const s=Array(t.length).fill(null);for(let r=0;r<t.length;r+=1){const i=t[r];if(i!=null)switch(typeof i){case"function":{const o=i(n);typeof o=="function"&&(s[r]=o);break}case"object":{i.current=n;break}}}e.cleanup=()=>{for(let r=0;r<t.length;r+=1){const i=t[r];if(i!=null)switch(typeof i){case"function":{const o=s[r];typeof o=="function"?o():i(null);break}case"object":{i.current=null;break}}}}}}}const qf=parseInt(l.version,10);function Rl(e){return qf>=e}function Ol(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Zf(e,t){const n={};for(const s in e){const r=e[s];if(t?.hasOwnProperty(s)){const i=t[s](r);i!=null&&Object.assign(n,i);continue}r===!0?n[`data-${s.toLowerCase()}`]="":r&&(n[`data-${s.toLowerCase()}`]=r.toString())}return n}function Uf(e,t){return typeof e=="function"?e(t):e}const Mn={};function Fl(e,t,n,s,r){let i={...Lr(e,Mn)};return t&&(i=ss(i,t)),n&&(i=ss(i,n)),s&&(i=ss(i,s)),i}function zf(e){if(e.length===0)return Mn;if(e.length===1)return Lr(e[0],Mn);let t={...Lr(e[0],Mn)};for(let n=1;n<e.length;n+=1)t=ss(t,e[n]);return t}function ss(e,t){return Il(t)?t(e):Gf(e,t)}function Gf(e,t){if(!t)return e;for(const n in t){const s=t[n];switch(n){case"style":{e[n]=Ol(e.style,s);break}case"className":{e[n]=Al(e.className,s);break}default:Kf(n,s)?e[n]=Wf(e[n],s):e[n]=s}}return e}function Kf(e,t){const n=e.charCodeAt(0),s=e.charCodeAt(1),r=e.charCodeAt(2);return n===111&&s===110&&r>=65&&r<=90&&(typeof t=="function"||typeof t>"u")}function Il(e){return typeof e=="function"}function Lr(e,t){return Il(e)?e(t):e??Mn}function Wf(e,t){return t?e?n=>{if(Qf(n)){const r=n;Dr(r);const i=t(r);return r.baseUIHandlerPrevented||e?.(r),i}const s=t(n);return e?.(n),s}:t:e}function Dr(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Al(e,t){return t?e?t+" "+e:t:e}function Qf(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}const Yf={style:{transition:"none"}},Ot={},Xf={fallbackAxisSide:"end"};function mt(e,t,n={}){const s=t.render,r=Jf(t,n);if(n.enabled===!1)return null;const i=n.state??Ot;return eh(e,s,r,i)}function Jf(e,t={}){const{className:n,render:s}=e,{state:r=Ot,ref:i,props:o,disableStyleHooks:a,customStyleHookMapping:c,enabled:d=!0}=t,h=d?Uf(n,r):void 0;let m;a!==!0&&(m=l.useMemo(()=>d?Zf(r,c):Ot,[r,c,d]));const u=d?Ol(m,Array.isArray(o)?zf(o):o)??Ot:Ot;return typeof document<"u"&&(d?Array.isArray(i)?u.ref=Hf([u.ref,zo(s),...i]):u.ref=Uo(u.ref,zo(s),i):Uo(null,null)),d?(h!==void 0&&(u.className=Al(u.className,h)),u):Ot}function eh(e,t,n,s){if(t){if(typeof t=="function")return t(n,s);const r=Fl(n,t.props);return r.ref=n.ref,l.cloneElement(t,r)}if(e&&typeof e=="string")return th(e,n);throw new Error("Base UI: Render element or function are not defined.")}function th(e,t){return e==="button"?g.jsx("button",{type:"button",...t}):e==="img"?g.jsx("img",{alt:"",...t}):l.createElement(e,t)}function zo(e){return e&&typeof e!="function"?Rl(19)?e.props.ref:e.ref:null}const nh=l.forwardRef(function(t,n){const{render:s,className:r,children:i,...o}=t,{toasts:a,pauseTimers:c,resumeTimers:d,setHovering:h,setFocused:m,viewportRef:u,windowFocusedRef:f,prevFocusElement:p,setPrevFocusElement:y,hovering:v,focused:b,hasDifferingHeights:x}=ti(),E=l.useRef(!1),S=ot(b),C=a.length;l.useEffect(()=>{if(!u.current)return;function O(H){C!==0&&H.key==="F6"&&H.target!==u.current&&(H.preventDefault(),y(At(Qt(u.current))),u.current?.focus(),c(),m(!0))}const R=Ue(u.current);return R.addEventListener("keydown",O),()=>{R.removeEventListener("keydown",O)}},[c,m,y,C,u]),l.useEffect(()=>{if(!u.current||!C)return;const O=Ue(u.current);function R(Z){Z.target===O&&(f.current=!1,c())}function H(Z){if(Z.relatedTarget||Z.target===O)return;const W=qe(Z),z=At(Qt(u.current));(!Fe(u.current,W)||!ts(z))&&d(),setTimeout(()=>{f.current=!0})}return O.addEventListener("blur",R,!0),O.addEventListener("focus",H,!0),()=>{O.removeEventListener("blur",R,!0),O.removeEventListener("focus",H,!0)}},[c,d,u,f,m,S,C]);function k(O){u.current&&(E.current=!0,O.relatedTarget===u.current?a[0]?.ref?.current?.focus():p?.focus({preventScroll:!0}))}function V(O){O.key==="Tab"&&O.shiftKey&&O.target===u.current&&(O.preventDefault(),p?.focus({preventScroll:!0}),d())}function A(){c(),h(!0)}function T(){const O=At(Qt(u.current));Fe(u.current,O)&&ts(O)||(d(),h(!1))}function M(){if(E.current){E.current=!1;return}if(b)return;const O=At(Qt(u.current));!f.current&&!ts(O)||(m(!0),c())}function F(O){!b||Fe(u.current,O.relatedTarget)||(m(!1),d())}const I={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:A,onMouseMove:A,onMouseLeave:T,onFocus:M,onBlur:F,onKeyDown:V,onClick:M},w=l.useMemo(()=>({expanded:v||b||x}),[v,b,x]),P=mt("div",t,{ref:[n,u],state:w,props:[I,{...o,children:g.jsxs(l.Fragment,{children:[C>0&&p&&g.jsx(or,{onFocus:k}),i,C>0&&p&&g.jsx(or,{onFocus:k})]})}]}),L=l.useMemo(()=>({viewportRef:u}),[u]),$=l.useMemo(()=>a.filter(O=>O.priority==="high"),[a]);return g.jsxs($f.Provider,{value:L,children:[C>0&&p&&g.jsx(or,{onFocus:k}),P,!b&&$.length>0&&g.jsx("div",{style:kl,children:$.map(O=>g.jsxs("div",{role:"alert","aria-atomic":!0,children:[g.jsx("div",{children:O.title}),g.jsx("div",{children:O.description})]},O.id))})]})});function sh(e){return Rl(19)?e:e?"true":void 0}const Pl=l.createContext(void 0);function Fn(){const e=l.useContext(Pl);if(!e)throw new Error("Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.");return e}let vs=function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e}({});const rh={[vs.startingStyle]:""},ih={[vs.endingStyle]:""},Vl={transitionStatus(e){return e==="starting"?rh:e==="ending"?ih:null}},Kn=null;class oh{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const n=this.callbacks,s=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,s>0)for(let r=0;r<n.length;r+=1)n[r]?.(t)};request(t){const n=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const Wn=new oh;class rt{static create(){return new rt}static request(t){return Wn.request(t)}static cancel(t){return Wn.cancel(t)}currentId=Kn;request(t){this.cancel(),this.currentId=Wn.request(()=>{this.currentId=Kn,t()})}cancel=()=>{this.currentId!==Kn&&(Wn.cancel(this.currentId),this.currentId=Kn)};disposeEffect=()=>this.cancel}function ah(){const e=ei(rt.create).current;return Iu(e.disposeEffect),e}function lh(e,t=!1){const n=ah();return ae((s,r=null)=>{if(n.cancel(),e==null)return;let i;if("current"in e){if(e.current==null)return;i=e.current}else i=e;typeof i.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?s():n.request(()=>{function o(){i&&Promise.allSettled(i.getAnimations().map(a=>a.finished)).then(()=>{r!=null&&r.aborted||Me.flushSync(s)})}t?n.request(o):o()})})}function Mi(e){const{enabled:t=!0,open:n,ref:s,onComplete:r}=e,i=ot(n),o=ae(r),a=lh(s,n);l.useEffect(()=>{t&&a(()=>{n===i.current&&o()})},[t,n,o,a,i])}let Gt=function(e){return e.index="--toast-index",e.offsetY="--toast-offset-y",e.swipeMovementX="--toast-swipe-movement-x",e.swipeMovementY="--toast-swipe-movement-y",e}({});const ch={...Vl,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},xn=40,uh=10,vt=.5,dh=1;function Go(e,t,n){switch(e){case"up":return-n;case"down":return n;case"left":return-t;case"right":return t;default:return 0}}function fh(e){const n=window.getComputedStyle(e).transform;let s=0,r=0,i=1;if(n&&n!=="none"){const o=n.match(/matrix(?:3d)?\(([^)]+)\)/);if(o){const a=o[1].split(", ").map(parseFloat);a.length===6?(s=a[4],r=a[5],i=Math.sqrt(a[0]*a[0]+a[1]*a[1])):a.length===16&&(s=a[12],r=a[13],i=a[0])}}return{x:s,y:r,scale:i}}const hh=l.forwardRef(function(t,n){const{toast:s,render:r,className:i,swipeDirection:o=["down","right"],...a}=t,c=Array.isArray(o)?o:[o],{toasts:d,hovering:h,focused:m,close:u,remove:f,setToasts:p,pauseTimers:y,resumeTimers:v,hasDifferingHeights:b}=ti(),[x,E]=l.useState(void 0),[S,C]=l.useState(!1),[k,V]=l.useState(!1),[A,T]=l.useState(!1),[M,F]=l.useState({x:0,y:0}),[I,w]=l.useState({x:0,y:0,scale:1}),[P,L]=l.useState(),[$,O]=l.useState(),[R,H]=l.useState(null),Z=l.useRef(null),W=l.useRef({x:0,y:0}),z=l.useRef({x:0,y:0,scale:1}),_=l.useRef(void 0),q=l.useRef(0),X=l.useRef(!1),j=l.useRef({x:0,y:0}),N=l.useRef(!1),D=l.useMemo(()=>d.indexOf(s),[s,d]),B=l.useMemo(()=>d.filter(Y=>Y.transitionStatus!=="ending").indexOf(s),[s,d]),G=l.useMemo(()=>d.slice(0,d.indexOf(s)).reduce((Y,J)=>Y+(J.height||0),0),[d,s]);Mi({open:s.transitionStatus!=="ending",ref:Z,onComplete(){s.transitionStatus==="ending"&&f(s.id)}}),l.useEffect(()=>{if(!Z.current)return;function Y(){const J=Z.current?.offsetHeight;p(ue=>ue.map(de=>de.id===s.id?{...de,ref:Z,height:J,transitionStatus:void 0}:de))}if(Y(),typeof ResizeObserver=="function"){const J=new ResizeObserver(Y);return J.observe(Z.current),()=>{J.disconnect()}}},[s.id,p]);function ce(Y,J){let ue=Y,de=J;return!c.includes("left")&&!c.includes("right")?ue=Y>0?Y**vt:-(Math.abs(Y)**vt):(!c.includes("right")&&Y>0&&(ue=Y**vt),!c.includes("left")&&Y<0&&(ue=-(Math.abs(Y)**vt))),!c.includes("up")&&!c.includes("down")?de=J>0?J**vt:-(Math.abs(J)**vt):(!c.includes("down")&&J>0&&(de=J**vt),!c.includes("up")&&J<0&&(de=-(Math.abs(J)**vt))),{x:ue,y:de}}function me(Y){if(Y.button!==0)return;Y.pointerType==="touch"&&y();const J=qe(Y.nativeEvent);if(!(J&&J.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(X.current=!1,_.current=void 0,q.current=0,W.current={x:Y.clientX,y:Y.clientY},j.current=W.current,Z.current){const de=fh(Z.current);z.current=de,w(de),F({x:de.x,y:de.y})}C(!0),V(!1),H(null),N.current=!0,Z.current?.setPointerCapture(Y.pointerId)}}function ze(Y){if(!S)return;Y.preventDefault(),N.current&&(W.current={x:Y.clientX,y:Y.clientY},N.current=!1);const{clientY:J,clientX:ue,movementX:de,movementY:_e}=Y;(_e<0&&J>j.current.y||_e>0&&J<j.current.y)&&(j.current={x:j.current.x,y:J}),(de<0&&ue>j.current.x||de>0&&ue<j.current.x)&&(j.current={x:ue,y:j.current.y});const re=ue-W.current.x,fe=J-W.current.y,je=J-j.current.y,Le=ue-j.current.x;if(!k&&Math.sqrt(re*re+fe*fe)>=dh&&(V(!0),R===null)){const Ut=c.includes("left")||c.includes("right"),Ks=c.includes("up")||c.includes("down");if(Ut&&Ks){const Ws=Math.abs(re),Qs=Math.abs(fe);H(Ws>Qs?"horizontal":"vertical")}}let Re;if(!_.current)R==="vertical"?fe>0?Re="down":fe<0&&(Re="up"):R==="horizontal"?re>0?Re="right":re<0&&(Re="left"):Math.abs(re)>=Math.abs(fe)?Re=re>0?"right":"left":Re=fe>0?"down":"up",Re&&c.includes(Re)&&(_.current=Re,q.current=Go(Re,re,fe),E(Re));else{const Zt=_.current,Ut=Go(Zt,Le,je);Ut>xn?(X.current=!1,E(Zt)):q.current-Ut>=uh&&(X.current=!0)}const yt=ce(re,fe);let qt=z.current.x,bn=z.current.y;R==="horizontal"?(c.includes("left")||c.includes("right"))&&(qt+=yt.x):(R==="vertical"||(c.includes("left")||c.includes("right"))&&(qt+=yt.x),(c.includes("up")||c.includes("down"))&&(bn+=yt.y)),F({x:qt,y:bn})}function Bt(Y){if(!S)return;if(Y.pointerType==="touch"&&!m&&v(),C(!1),V(!1),H(null),Z.current?.releasePointerCapture(Y.pointerId),X.current){F({x:I.x,y:I.y}),E(void 0);return}let J=!1;const ue=M.x-I.x,de=M.y-I.y;let _e;for(const re of c){switch(re){case"right":ue>xn&&(J=!0,_e="right");break;case"left":ue<-xn&&(J=!0,_e="left");break;case"down":de>xn&&(J=!0,_e="down");break;case"up":de<-xn&&(J=!0,_e="up");break}if(J)break}J?(E(_e),T(!0),u(s.id)):(F({x:I.x,y:I.y}),E(void 0))}function Ct(Y){if(Y.key==="Escape"){if(!Z.current||!Fe(Z.current,At(Qt(Z.current))))return;u(s.id)}}l.useEffect(()=>{const Y=Z.current;if(!Y)return;function J(ue){Fe(Y,ue.target)&&ue.preventDefault()}return Y.addEventListener("touchmove",J,{passive:!1}),()=>{Y.removeEventListener("touchmove",J)}},[]);function Ee(){if(!S&&M.x===I.x&&M.y===I.y&&!A)return{[Gt.swipeMovementX]:"0px",[Gt.swipeMovementY]:"0px"};const Y=M.x-I.x,J=M.y-I.y;return{transition:S?"none":void 0,[Gt.swipeMovementX]:`${Y}px`,[Gt.swipeMovementY]:`${J}px`}}const Ne=s.priority==="high",kt={role:Ne?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":P,"aria-describedby":$,"aria-hidden":Ne&&!m?!0:void 0,onPointerDown:me,onPointerMove:ze,onPointerUp:Bt,onKeyDown:Ct,inert:sh(s.limited),style:{...Ee(),[Gt.index]:s.transitionStatus==="ending"?D:B,[Gt.offsetY]:`${G}px`}},He=l.useMemo(()=>({rootRef:Z,toast:s,titleId:P,setTitleId:L,descriptionId:$,setDescriptionId:O,swiping:S,swipeDirection:x}),[s,P,$,S,x]),gt=l.useMemo(()=>({transitionStatus:s.transitionStatus,expanded:h||m||b,limited:s.limited||!1,type:s.type,swiping:He.swiping,swipeDirection:He.swipeDirection}),[h,m,b,s.transitionStatus,s.limited,s.type,He.swiping,He.swipeDirection]),vn=mt("div",t,{ref:[n,He.rootRef],state:gt,customStyleHookMapping:ch,props:[kt,a]});return g.jsx(Pl.Provider,{value:He,children:vn})}),ph=l.forwardRef(function(t,n){const{render:s,className:r,id:i,children:o,...a}=t,{toast:c}=Fn(),d=o??c.description,h=!!d,m=ni(i),{setDescriptionId:u}=Fn();Oe(()=>{if(h)return u(m),()=>{u(void 0)}},[h,m,u]);const f=l.useMemo(()=>({type:c.type}),[c.type]),p=mt("p",t,{ref:n,state:f,props:{...a,id:m,children:d}});return h?p:null}),mh=l.forwardRef(function(t,n){const{render:s,className:r,id:i,children:o,...a}=t,{toast:c}=Fn(),d=o??c.title,h=!!d,m=ni(i),{setTitleId:u}=Fn();Oe(()=>{if(h)return u(m),()=>{u(void 0)}},[h,m,u]);const f=l.useMemo(()=>({type:c.type}),[c.type]),p=mt("h2",t,{ref:n,state:f,props:{...a,id:m,children:d}});return h?p:null}),gh=l.createContext(void 0);function yh(e=!1){const t=l.useContext(gh);if(t===void 0&&!e)throw new Error("Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.");return t}function vh(e){const{focusableWhenDisabled:t,disabled:n,composite:s=!1,tabIndex:r=0,isNativeButton:i}=e,o=s&&t!==!1,a=s&&t===!1;return{props:l.useMemo(()=>{const d={onKeyDown(h){n&&t&&h.key!=="Tab"&&h.preventDefault()}};return s||(d.tabIndex=r,!i&&n&&(d.tabIndex=t?r:-1)),(i&&(t||o)||!i&&n)&&(d["aria-disabled"]=n),i&&(!t||a)&&(d.disabled=n),d},[s,n,t,o,a,i,r])}}function bh(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:s=0,native:r=!0}=e,i=l.useRef(null),o=yh(!0)!==void 0,a=ae(()=>{const h=i.current;return!!(h?.tagName==="A"&&h?.href)}),{props:c}=vh({focusableWhenDisabled:n,disabled:t,composite:o,tabIndex:s,isNativeButton:r});return Oe(()=>{const h=i.current;h instanceof HTMLButtonElement&&o&&t&&c.disabled===void 0&&h.disabled&&(h.disabled=!1)},[t,c.disabled,o]),{getButtonProps:l.useCallback((h={})=>{const{onClick:m,onMouseDown:u,onKeyUp:f,onKeyDown:p,onPointerDown:y,...v}=h;return Fl({type:r?"button":void 0,onClick(x){if(t){x.preventDefault();return}m?.(x)},onMouseDown(x){t||u?.(x)},onKeyDown(x){if(t||(Dr(x),p?.(x)),x.baseUIHandlerPrevented)return;const E=x.target===x.currentTarget&&!r&&!a()&&!t,S=x.key==="Enter",C=x.key===" ";E&&((C||S)&&x.preventDefault(),S&&m?.(x))},onKeyUp(x){t||(Dr(x),f?.(x)),!x.baseUIHandlerPrevented&&x.target===x.currentTarget&&!r&&!t&&x.key===" "&&m?.(x)},onPointerDown(x){if(t){x.preventDefault();return}y?.(x)}},r?void 0:{role:"button"},c,v)},[t,c,r,a]),buttonRef:i}}const xh=l.forwardRef(function(t,n){const{render:s,className:r,disabled:i,nativeButton:o=!0,...a}=t,{close:c,focused:d}=ti(),{toast:h}=Fn(),{getButtonProps:m,buttonRef:u}=bh({disabled:i,native:o}),f=l.useMemo(()=>({type:h.type}),[h.type]);return mt("button",t,{ref:[n,u],state:f,props:[{"aria-hidden":!d||void 0,onClick(){c(h.id)}},a,m]})});function wh(){const e=new Map;return{emit(t,n){e.get(t)?.forEach(s=>s(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}const Eh=l.createContext(null),Sh=l.createContext(null),Nl=()=>l.useContext(Eh)?.id||null,Ri=()=>l.useContext(Sh),Ko=si("safe-polygon");function rs(e,t,n){if(n&&!ps(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const s=e();return typeof s=="number"?s:s?.[t]}return e?.[t]}function ar(e){return typeof e=="function"?e():e}function Ch(e,t={}){const{open:n,onOpenChange:s,dataRef:r,events:i,elements:o}=e,{enabled:a=!0,delay:c=0,handleClose:d=null,mouseOnly:h=!1,restMs:m=0,move:u=!0}=t,f=Ri(),p=Nl(),y=ot(d),v=ot(c),b=ot(n),x=ot(m),E=l.useRef(void 0),S=on(),C=l.useRef(void 0),k=on(),V=l.useRef(!0),A=l.useRef(!1),T=l.useRef(()=>{}),M=l.useRef(!1),F=ae(()=>{const O=r.current.openEvent?.type;return O?.includes("mouse")&&O!=="mousedown"});l.useEffect(()=>{if(!a)return;function O({open:R}){R||(S.clear(),k.clear(),V.current=!0,M.current=!1)}return i.on("openchange",O),()=>{i.off("openchange",O)}},[a,i,S,k]),l.useEffect(()=>{if(!a||!y.current||!n)return;function O(H){F()&&s(!1,H,"hover")}const R=Pt(o.floating).documentElement;return R.addEventListener("mouseleave",O),()=>{R.removeEventListener("mouseleave",O)}},[o.floating,n,s,a,y,F]);const I=l.useCallback((O,R=!0,H="hover")=>{const Z=rs(v.current,"close",E.current);Z&&!C.current?S.start(Z,()=>s(!1,O,H)):R&&(S.clear(),s(!1,O,H))},[v,s,S]),w=ae(()=>{T.current(),C.current=void 0}),P=ae(()=>{if(A.current){const O=Pt(o.floating).body;O.style.pointerEvents="",O.removeAttribute(Ko),A.current=!1}}),L=ae(()=>r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1);l.useEffect(()=>{if(!a)return;function O(z){if(S.clear(),V.current=!1,h&&!ps(E.current)||ar(x.current)>0&&!rs(v.current,"open"))return;const _=rs(v.current,"open",E.current);_?S.start(_,()=>{b.current||s(!0,z,"hover")}):n||s(!0,z,"hover")}function R(z){if(L()){P();return}T.current();const _=Pt(o.floating);if(k.clear(),M.current=!1,y.current&&r.current.floatingContext){n||S.clear(),C.current=y.current({...r.current.floatingContext,tree:f,x:z.clientX,y:z.clientY,onClose(){P(),w(),L()||I(z,!0,"safe-polygon")}});const X=C.current;_.addEventListener("mousemove",X),T.current=()=>{_.removeEventListener("mousemove",X)};return}(E.current==="touch"?!Fe(o.floating,z.relatedTarget):!0)&&I(z)}function H(z){L()||r.current.floatingContext&&y.current?.({...r.current.floatingContext,tree:f,x:z.clientX,y:z.clientY,onClose(){P(),w(),L()||I(z)}})(z)}function Z(){S.clear()}function W(z){L()||I(z,!1)}if(he(o.domReference)){const z=o.domReference,_=o.floating;return n&&z.addEventListener("mouseleave",H),u&&z.addEventListener("mousemove",O,{once:!0}),z.addEventListener("mouseenter",O),z.addEventListener("mouseleave",R),_&&(_.addEventListener("mouseleave",H),_.addEventListener("mouseenter",Z),_.addEventListener("mouseleave",W)),()=>{n&&z.removeEventListener("mouseleave",H),u&&z.removeEventListener("mousemove",O),z.removeEventListener("mouseenter",O),z.removeEventListener("mouseleave",R),_&&(_.removeEventListener("mouseleave",H),_.removeEventListener("mouseenter",Z),_.removeEventListener("mouseleave",W))}}},[o,a,e,h,u,I,w,P,s,n,b,f,v,y,r,L,x,S,k]),Oe(()=>{if(a&&n&&y.current?.__options?.blockPointerEvents&&F()){A.current=!0;const O=o.floating;if(he(o.domReference)&&O){const R=Pt(o.floating).body;R.setAttribute(Ko,"");const H=o.domReference,Z=f?.nodesRef.current.find(W=>W.id===p)?.context?.elements.floating;return Z&&(Z.style.pointerEvents=""),R.style.pointerEvents="none",H.style.pointerEvents="auto",O.style.pointerEvents="auto",()=>{R.style.pointerEvents="",H.style.pointerEvents="",O.style.pointerEvents=""}}}},[a,n,p,o,f,y,F]),Oe(()=>{n||(E.current=void 0,M.current=!1,w(),P())},[n,w,P]),l.useEffect(()=>()=>{w(),S.clear(),k.clear(),P()},[a,o.domReference,w,P,S,k]);const $=l.useMemo(()=>{function O(R){E.current=R.pointerType}return{onPointerDown:O,onPointerEnter:O,onMouseMove(R){const{nativeEvent:H}=R;function Z(){!V.current&&!b.current&&s(!0,H,"hover")}h&&!ps(E.current)||n||ar(x.current)===0||M.current&&R.movementX**2+R.movementY**2<2||(k.clear(),E.current==="touch"?Z():(M.current=!0,k.start(ar(x.current),Z)))}}},[h,s,n,b,x,k]);return l.useMemo(()=>a?{reference:$}:{},[a,$])}const jl=l.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ri,currentIdRef:{current:null},currentContextRef:{current:null}});function kh(e){const{children:t,delay:n,timeoutMs:s=0}=e,r=l.useRef(n),i=l.useRef(n),o=l.useRef(null),a=l.useRef(null),c=on();return g.jsx(jl.Provider,{value:l.useMemo(()=>({hasProvider:!0,delayRef:r,initialDelayRef:i,currentIdRef:o,timeoutMs:s,currentContextRef:a,timeout:c}),[s,c]),children:t})}function Th(e,t={}){const{open:n,onOpenChange:s,floatingId:r}=e,{enabled:i=!0}=t,o=l.useContext(jl),{currentIdRef:a,delayRef:c,timeoutMs:d,initialDelayRef:h,currentContextRef:m,hasProvider:u,timeout:f}=o,[p,y]=l.useState(!1);return Oe(()=>{function v(){y(!1),m.current?.setIsInstantPhase(!1),a.current=null,m.current=null,c.current=h.current}if(i&&a.current&&!n&&a.current===r){if(y(!1),d)return f.start(d,v),()=>{f.clear()};v()}},[i,n,r,a,c,d,h,m,f]),Oe(()=>{if(!i||!n)return;const v=m.current,b=a.current;m.current={onOpenChange:s,setIsInstantPhase:y},a.current=r,c.current={open:0,close:rs(h.current,"close")},b!==null&&b!==r?(f.clear(),y(!0),v?.setIsInstantPhase(!0),v?.onOpenChange(!1)):(y(!1),v?.setIsInstantPhase(!1))},[i,n,r,s,a,c,d,h,m,f]),Oe(()=>()=>{m.current=null},[m]),l.useMemo(()=>({hasProvider:u,delayRef:c,isInstantPhase:p}),[u,c,p])}function Mh(e,t){let n=null,s=null,r=!1;return{contextElement:e||void 0,getBoundingClientRect(){const i=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis==="x"||t.axis==="both",a=t.axis==="y"||t.axis==="both",c=["mouseenter","mousemove"].includes(t.dataRef.current.openEvent?.type||"")&&t.pointerType!=="touch";let d=i.width,h=i.height,m=i.x,u=i.y;return n==null&&t.x&&o&&(n=i.x-t.x),s==null&&t.y&&a&&(s=i.y-t.y),m-=n||0,u-=s||0,d=0,h=0,!r||c?(d=t.axis==="y"?i.width:0,h=t.axis==="x"?i.height:0,m=o&&t.x!=null?t.x:m,u=a&&t.y!=null?t.y:u):r&&!c&&(h=t.axis==="x"?i.height:h,d=t.axis==="y"?i.width:d),r=!0,{width:d,height:h,x:m,y:u,top:u,right:m+d,bottom:u+h,left:m}}}}function Wo(e){return e!=null&&e.clientX!=null}function Rh(e,t={}){const{open:n,dataRef:s,elements:{floating:r,domReference:i},refs:o}=e,{enabled:a=!0,axis:c="both",x:d=null,y:h=null}=t,m=l.useRef(!1),u=l.useRef(null),[f,p]=l.useState(),[y,v]=l.useState([]),b=ae((k,V)=>{m.current||s.current.openEvent&&!Wo(s.current.openEvent)||o.setPositionReference(Mh(i,{x:k,y:V,axis:c,dataRef:s,pointerType:f}))}),x=ae(k=>{d!=null||h!=null||(n?u.current||v([]):b(k.clientX,k.clientY))}),E=ps(f)?r:n,S=l.useCallback(()=>{if(!E||!a||d!=null||h!=null)return;const k=Ue(r);function V(A){const T=qe(A);Fe(r,T)?(k.removeEventListener("mousemove",V),u.current=null):b(A.clientX,A.clientY)}if(!s.current.openEvent||Wo(s.current.openEvent)){k.addEventListener("mousemove",V);const A=()=>{k.removeEventListener("mousemove",V),u.current=null};return u.current=A,A}o.setPositionReference(i)},[E,a,d,h,r,s,o,i,b]);l.useEffect(()=>S(),[S,y]),l.useEffect(()=>{a&&!r&&(m.current=!1)},[a,r]),l.useEffect(()=>{!a&&n&&(m.current=!0)},[a,n]),Oe(()=>{a&&(d!=null||h!=null)&&(m.current=!1,b(d,h))},[a,d,h,b]);const C=l.useMemo(()=>{function k(V){p(V.pointerType)}return{onPointerDown:k,onPointerEnter:k,onMouseMove:x,onMouseEnter:x}},[x]);return l.useMemo(()=>a?{reference:C}:{},[a,C])}function Qo(e,t,n){let{reference:s,floating:r}=e;const i=Ze(t),o=Ti(t),a=ki(o),c=$e(t),d=i==="y",h=s.x+s.width/2-r.width/2,m=s.y+s.height/2-r.height/2,u=s[a]/2-r[a]/2;let f;switch(c){case"top":f={x:h,y:s.y-r.height};break;case"bottom":f={x:h,y:s.y+s.height};break;case"right":f={x:s.x+s.width,y:m};break;case"left":f={x:s.x-r.width,y:m};break;default:f={x:s.x,y:s.y}}switch(St(t)){case"start":f[o]-=u*(n&&d?-1:1);break;case"end":f[o]+=u*(n&&d?-1:1);break}return f}const Oh=async(e,t,n)=>{const{placement:s="bottom",strategy:r="absolute",middleware:i=[],platform:o}=n,a=i.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t));let d=await o.getElementRects({reference:e,floating:t,strategy:r}),{x:h,y:m}=Qo(d,s,c),u=s,f={},p=0;for(let y=0;y<a.length;y++){const{name:v,fn:b}=a[y],{x,y:E,data:S,reset:C}=await b({x:h,y:m,initialPlacement:s,placement:u,strategy:r,middlewareData:f,rects:d,platform:o,elements:{reference:e,floating:t}});h=x??h,m=E??m,f={...f,[v]:{...f[v],...S}},C&&p<=50&&(p++,typeof C=="object"&&(C.placement&&(u=C.placement),C.rects&&(d=C.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:r}):C.rects),{x:h,y:m}=Qo(d,u,c)),y=-1)}return{x:h,y:m,placement:u,strategy:r,middlewareData:f}};async function In(e,t){var n;t===void 0&&(t={});const{x:s,y:r,platform:i,rects:o,elements:a,strategy:c}=e,{boundary:d="clippingAncestors",rootBoundary:h="viewport",elementContext:m="floating",altBoundary:u=!1,padding:f=0}=ht(t,e),p=Cl(f),v=a[u?m==="floating"?"reference":"floating":m],b=ys(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:d,rootBoundary:h,strategy:c})),x=m==="floating"?{x:s,y:r,width:o.floating.width,height:o.floating.height}:o.reference,E=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),S=await(i.isElement==null?void 0:i.isElement(E))?await(i.getScale==null?void 0:i.getScale(E))||{x:1,y:1}:{x:1,y:1},C=ys(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:x,offsetParent:E,strategy:c}):x);return{top:(b.top-C.top+p.top)/S.y,bottom:(C.bottom-b.bottom+p.bottom)/S.y,left:(b.left-C.left+p.left)/S.x,right:(C.right-b.right+p.right)/S.x}}const Fh=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,s;const{placement:r,middlewareData:i,rects:o,initialPlacement:a,platform:c,elements:d}=t,{mainAxis:h=!0,crossAxis:m=!0,fallbackPlacements:u,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:y=!0,...v}=ht(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=$e(r),x=Ze(a),E=$e(a)===a,S=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=u||(E||!y?[gs(a)]:Pf(a)),k=p!=="none";!u&&k&&C.push(...Lf(a,y,p,S));const V=[a,...C],A=await In(t,v),T=[];let M=((s=i.flip)==null?void 0:s.overflows)||[];if(h&&T.push(A[b]),m){const P=Af(r,o,S);T.push(A[P[0]],A[P[1]])}if(M=[...M,{placement:r,overflows:T}],!T.every(P=>P<=0)){var F,I;const P=(((F=i.flip)==null?void 0:F.index)||0)+1,L=V[P];if(L&&(!(m==="alignment"?x!==Ze(L):!1)||M.every(R=>Ze(R.placement)===x?R.overflows[0]>0:!0)))return{data:{index:P,overflows:M},reset:{placement:L}};let $=(I=M.filter(O=>O.overflows[0]<=0).sort((O,R)=>O.overflows[1]-R.overflows[1])[0])==null?void 0:I.placement;if(!$)switch(f){case"bestFit":{var w;const O=(w=M.filter(R=>{if(k){const H=Ze(R.placement);return H===x||H==="y"}return!0}).map(R=>[R.placement,R.overflows.filter(H=>H>0).reduce((H,Z)=>H+Z,0)]).sort((R,H)=>R[1]-H[1])[0])==null?void 0:w[0];O&&($=O);break}case"initialPlacement":$=a;break}if(r!==$)return{reset:{placement:$}}}return{}}}};function Yo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Xo(e){return Rf.some(t=>e[t]>=0)}const Ih=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:s="referenceHidden",...r}=ht(e,t);switch(s){case"referenceHidden":{const i=await In(t,{...r,elementContext:"reference"}),o=Yo(i,n.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:Xo(o)}}}case"escaped":{const i=await In(t,{...r,altBoundary:!0}),o=Yo(i,n.floating);return{data:{escapedOffsets:o,escaped:Xo(o)}}}default:return{}}}}},Ll=new Set(["left","top"]);async function Ah(e,t){const{placement:n,platform:s,elements:r}=e,i=await(s.isRTL==null?void 0:s.isRTL(r.floating)),o=$e(n),a=St(n),c=Ze(n)==="y",d=Ll.has(o)?-1:1,h=i&&c?-1:1,m=ht(t,e);let{mainAxis:u,crossAxis:f,alignmentAxis:p}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return a&&typeof p=="number"&&(f=a==="end"?p*-1:p),c?{x:f*h,y:u*d}:{x:u*d,y:f*h}}const Ph=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:r,y:i,placement:o,middlewareData:a}=t,c=await Ah(t,e);return o===((n=a.offset)==null?void 0:n.placement)&&(s=a.arrow)!=null&&s.alignmentOffset?{}:{x:r+c.x,y:i+c.y,data:{...c,placement:o}}}}},Vh=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:r}=t,{mainAxis:i=!0,crossAxis:o=!1,limiter:a={fn:v=>{let{x:b,y:x}=v;return{x:b,y:x}}},...c}=ht(e,t),d={x:n,y:s},h=await In(t,c),m=Ze($e(r)),u=Ci(m);let f=d[u],p=d[m];if(i){const v=u==="y"?"top":"left",b=u==="y"?"bottom":"right",x=f+h[v],E=f-h[b];f=Nr(x,f,E)}if(o){const v=m==="y"?"top":"left",b=m==="y"?"bottom":"right",x=p+h[v],E=p-h[b];p=Nr(x,p,E)}const y=a.fn({...t,[u]:f,[m]:p});return{...y,data:{x:y.x-n,y:y.y-s,enabled:{[u]:i,[m]:o}}}}}},Nh=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:r,rects:i,middlewareData:o}=t,{offset:a=0,mainAxis:c=!0,crossAxis:d=!0}=ht(e,t),h={x:n,y:s},m=Ze(r),u=Ci(m);let f=h[u],p=h[m];const y=ht(a,t),v=typeof y=="number"?{mainAxis:y,crossAxis:0}:{mainAxis:0,crossAxis:0,...y};if(c){const E=u==="y"?"height":"width",S=i.reference[u]-i.floating[E]+v.mainAxis,C=i.reference[u]+i.reference[E]-v.mainAxis;f<S?f=S:f>C&&(f=C)}if(d){var b,x;const E=u==="y"?"width":"height",S=Ll.has($e(r)),C=i.reference[m]-i.floating[E]+(S&&((b=o.offset)==null?void 0:b[m])||0)+(S?0:v.crossAxis),k=i.reference[m]+i.reference[E]+(S?0:((x=o.offset)==null?void 0:x[m])||0)-(S?v.crossAxis:0);p<C?p=C:p>k&&(p=k)}return{[u]:f,[m]:p}}}},jh=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:r,rects:i,platform:o,elements:a}=t,{apply:c=()=>{},...d}=ht(e,t),h=await In(t,d),m=$e(r),u=St(r),f=Ze(r)==="y",{width:p,height:y}=i.floating;let v,b;m==="top"||m==="bottom"?(v=m,b=u===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(b=m,v=u==="end"?"top":"bottom");const x=y-h.top-h.bottom,E=p-h.left-h.right,S=un(y-h[v],x),C=un(p-h[b],E),k=!t.middlewareData.shift;let V=S,A=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(A=E),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(V=x),k&&!u){const M=Ae(h.left,0),F=Ae(h.right,0),I=Ae(h.top,0),w=Ae(h.bottom,0);f?A=p-2*(M!==0||F!==0?M+F:Ae(h.left,h.right)):V=y-2*(I!==0||w!==0?I+w:Ae(h.top,h.bottom))}await c({...t,availableWidth:A,availableHeight:V});const T=await o.getDimensions(a.floating);return p!==T.width||y!==T.height?{reset:{rects:!0}}:{}}}};function Dl(e){const t=et(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const r=tt(e),i=r?e.offsetWidth:n,o=r?e.offsetHeight:s,a=ms(n)!==i||ms(s)!==o;return a&&(n=i,s=o),{width:n,height:s,$:a}}function Oi(e){return he(e)?e:e.contextElement}function nn(e){const t=Oi(e);if(!tt(t))return Xe(1);const n=t.getBoundingClientRect(),{width:s,height:r,$:i}=Dl(t);let o=(i?ms(n.width):n.width)/s,a=(i?ms(n.height):n.height)/r;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const Lh=Xe(0);function $l(e){const t=Ue(e);return!ii()||!t.visualViewport?Lh:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Dh(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ue(e)?!1:t}function $t(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=Oi(e);let o=Xe(1);t&&(s?he(s)&&(o=nn(s)):o=nn(e));const a=Dh(i,n,s)?$l(i):Xe(0);let c=(r.left+a.x)/o.x,d=(r.top+a.y)/o.y,h=r.width/o.x,m=r.height/o.y;if(i){const u=Ue(i),f=s&&he(s)?Ue(s):s;let p=u,y=Eo(p);for(;y&&s&&f!==p;){const v=nn(y),b=y.getBoundingClientRect(),x=et(y),E=b.left+(y.clientLeft+parseFloat(x.paddingLeft))*v.x,S=b.top+(y.clientTop+parseFloat(x.paddingTop))*v.y;c*=v.x,d*=v.y,h*=v.x,m*=v.y,c+=E,d+=S,p=Ue(y),y=Eo(p)}}return ys({width:h,height:m,x:c,y:d})}function Fi(e,t){const n=Ms(e).scrollLeft;return t?t.left+n:$t(pt(e)).left+n}function Hl(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),r=s.left+t.scrollLeft-(n?0:Fi(e,s)),i=s.top+t.scrollTop;return{x:r,y:i}}function $h(e){let{elements:t,rect:n,offsetParent:s,strategy:r}=e;const i=r==="fixed",o=pt(s),a=t?oi(t.floating):!1;if(s===o||a&&i)return n;let c={scrollLeft:0,scrollTop:0},d=Xe(1);const h=Xe(0),m=tt(s);if((m||!m&&!i)&&((ai(s)!=="body"||li(o))&&(c=Ms(s)),tt(s))){const f=$t(s);d=nn(s),h.x=f.x+s.clientLeft,h.y=f.y+s.clientTop}const u=o&&!m&&!i?Hl(o,c,!0):Xe(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+h.x+u.x,y:n.y*d.y-c.scrollTop*d.y+h.y+u.y}}function Hh(e){return Array.from(e.getClientRects())}function _h(e){const t=pt(e),n=Ms(e),s=e.ownerDocument.body,r=Ae(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),i=Ae(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let o=-n.scrollLeft+Fi(e);const a=-n.scrollTop;return et(s).direction==="rtl"&&(o+=Ae(t.clientWidth,s.clientWidth)-r),{width:r,height:i,x:o,y:a}}function Bh(e,t){const n=Ue(e),s=pt(e),r=n.visualViewport;let i=s.clientWidth,o=s.clientHeight,a=0,c=0;if(r){i=r.width,o=r.height;const d=ii();(!d||d&&t==="fixed")&&(a=r.offsetLeft,c=r.offsetTop)}return{width:i,height:o,x:a,y:c}}const qh=new Set(["absolute","fixed"]);function Zh(e,t){const n=$t(e,!0,t==="fixed"),s=n.top+e.clientTop,r=n.left+e.clientLeft,i=tt(e)?nn(e):Xe(1),o=e.clientWidth*i.x,a=e.clientHeight*i.y,c=r*i.x,d=s*i.y;return{width:o,height:a,x:c,y:d}}function Jo(e,t,n){let s;if(t==="viewport")s=Bh(e,n);else if(t==="document")s=_h(pt(e));else if(he(t))s=Zh(t,n);else{const r=$l(e);s={x:t.x-r.x,y:t.y-r.y,width:t.width,height:t.height}}return ys(s)}function _l(e,t){const n=an(e);return n===t||!he(n)||jt(n)?!1:et(n).position==="fixed"||_l(n,t)}function Uh(e,t){const n=t.get(e);if(n)return n;let s=en(e,[],!1).filter(a=>he(a)&&ai(a)!=="body"),r=null;const i=et(e).position==="fixed";let o=i?an(e):e;for(;he(o)&&!jt(o);){const a=et(o),c=Na(o);!c&&a.position==="fixed"&&(r=null),(i?!c&&!r:!c&&a.position==="static"&&!!r&&qh.has(r.position)||li(o)&&!c&&_l(e,o))?s=s.filter(h=>h!==o):r=a,o=an(o)}return t.set(e,s),s}function zh(e){let{element:t,boundary:n,rootBoundary:s,strategy:r}=e;const o=[...n==="clippingAncestors"?oi(t)?[]:Uh(t,this._c):[].concat(n),s],a=o[0],c=o.reduce((d,h)=>{const m=Jo(t,h,r);return d.top=Ae(m.top,d.top),d.right=un(m.right,d.right),d.bottom=un(m.bottom,d.bottom),d.left=Ae(m.left,d.left),d},Jo(t,a,r));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Gh(e){const{width:t,height:n}=Dl(e);return{width:t,height:n}}function Kh(e,t,n){const s=tt(t),r=pt(t),i=n==="fixed",o=$t(e,!0,i,t);let a={scrollLeft:0,scrollTop:0};const c=Xe(0);function d(){c.x=Fi(r)}if(s||!s&&!i)if((ai(t)!=="body"||li(r))&&(a=Ms(t)),s){const f=$t(t,!0,i,t);c.x=f.x+t.clientLeft,c.y=f.y+t.clientTop}else r&&d();i&&!s&&r&&d();const h=r&&!s&&!i?Hl(r,a):Xe(0),m=o.left+a.scrollLeft-c.x-h.x,u=o.top+a.scrollTop-c.y-h.y;return{x:m,y:u,width:o.width,height:o.height}}function lr(e){return et(e).position==="static"}function ea(e,t){if(!tt(e)||et(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return pt(e)===n&&(n=n.ownerDocument.body),n}function Bl(e,t){const n=Ue(e);if(oi(e))return n;if(!tt(e)){let r=an(e);for(;r&&!jt(r);){if(he(r)&&!lr(r))return r;r=an(r)}return n}let s=ea(e,t);for(;s&&Au(s)&&lr(s);)s=ea(s,t);return s&&jt(s)&&lr(s)&&!Na(s)?n:s||Pu(e)||n}const Wh=async function(e){const t=this.getOffsetParent||Bl,n=this.getDimensions,s=await n(e.floating);return{reference:Kh(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function Qh(e){return et(e).direction==="rtl"}const Yh={convertOffsetParentRelativeRectToViewportRelativeRect:$h,getDocumentElement:pt,getClippingRect:zh,getOffsetParent:Bl,getElementRects:Wh,getClientRects:Hh,getDimensions:Gh,getScale:nn,isElement:he,isRTL:Qh};function ql(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Xh(e,t){let n=null,s;const r=pt(e);function i(){var a;clearTimeout(s),(a=n)==null||a.disconnect(),n=null}function o(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),i();const d=e.getBoundingClientRect(),{left:h,top:m,width:u,height:f}=d;if(a||t(),!u||!f)return;const p=Gn(m),y=Gn(r.clientWidth-(h+u)),v=Gn(r.clientHeight-(m+f)),b=Gn(h),E={rootMargin:-p+"px "+-y+"px "+-v+"px "+-b+"px",threshold:Ae(0,un(1,c))||1};let S=!0;function C(k){const V=k[0].intersectionRatio;if(V!==c){if(!S)return o();V?o(!1,V):s=setTimeout(()=>{o(!1,1e-7)},1e3)}V===1&&!ql(d,e.getBoundingClientRect())&&o(),S=!1}try{n=new IntersectionObserver(C,{...E,root:r.ownerDocument})}catch{n=new IntersectionObserver(C,E)}n.observe(e)}return o(!0),i}function ta(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=s,d=Oi(e),h=r||i?[...d?en(d):[],...en(t)]:[];h.forEach(b=>{r&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const m=d&&a?Xh(d,n):null;let u=-1,f=null;o&&(f=new ResizeObserver(b=>{let[x]=b;x&&x.target===d&&f&&(f.unobserve(t),cancelAnimationFrame(u),u=requestAnimationFrame(()=>{var E;(E=f)==null||E.observe(t)})),n()}),d&&!c&&f.observe(d),f.observe(t));let p,y=c?$t(e):null;c&&v();function v(){const b=$t(e);y&&!ql(y,b)&&n(),y=b,p=requestAnimationFrame(v)}return n(),()=>{var b;h.forEach(x=>{r&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),m?.(),(b=f)==null||b.disconnect(),f=null,c&&cancelAnimationFrame(p)}}const Jh=Ph,ep=Vh,tp=Fh,np=jh,sp=Ih,rp=Nh,ip=(e,t,n)=>{const s=new Map,r={platform:Yh,...n},i={...r.platform,_c:s};return Oh(e,t,{...r,platform:i})};var op=typeof document<"u",ap=function(){},is=op?l.useLayoutEffect:ap;function bs(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,r;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!bs(e[s],t[s]))return!1;return!0}if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,r[s]))return!1;for(s=n;s--!==0;){const i=r[s];if(!(i==="_owner"&&e.$$typeof)&&!bs(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function Zl(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function na(e,t){const n=Zl(e);return Math.round(t*n)/n}function cr(e){const t=l.useRef(e);return is(()=>{t.current=e}),t}function lp(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:r,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:c,open:d}=e,[h,m]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[u,f]=l.useState(s);bs(u,s)||f(s);const[p,y]=l.useState(null),[v,b]=l.useState(null),x=l.useCallback(R=>{R!==k.current&&(k.current=R,y(R))},[]),E=l.useCallback(R=>{R!==V.current&&(V.current=R,b(R))},[]),S=i||p,C=o||v,k=l.useRef(null),V=l.useRef(null),A=l.useRef(h),T=c!=null,M=cr(c),F=cr(r),I=cr(d),w=l.useCallback(()=>{if(!k.current||!V.current)return;const R={placement:t,strategy:n,middleware:u};F.current&&(R.platform=F.current),ip(k.current,V.current,R).then(H=>{const Z={...H,isPositioned:I.current!==!1};P.current&&!bs(A.current,Z)&&(A.current=Z,Me.flushSync(()=>{m(Z)}))})},[u,t,n,F,I]);is(()=>{d===!1&&A.current.isPositioned&&(A.current.isPositioned=!1,m(R=>({...R,isPositioned:!1})))},[d]);const P=l.useRef(!1);is(()=>(P.current=!0,()=>{P.current=!1}),[]),is(()=>{if(S&&(k.current=S),C&&(V.current=C),S&&C){if(M.current)return M.current(S,C,w);w()}},[S,C,w,M,T]);const L=l.useMemo(()=>({reference:k,floating:V,setReference:x,setFloating:E}),[x,E]),$=l.useMemo(()=>({reference:S,floating:C}),[S,C]),O=l.useMemo(()=>{const R={position:n,left:0,top:0};if(!$.floating)return R;const H=na($.floating,h.x),Z=na($.floating,h.y);return a?{...R,transform:"translate("+H+"px, "+Z+"px)",...Zl($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:H,top:Z}},[n,a,$.floating,h.x,h.y]);return l.useMemo(()=>({...h,update:w,refs:L,elements:$,floatingStyles:O}),[h,w,L,$,O])}const cp=(e,t)=>({...Jh(e),options:[e,t]}),up=(e,t)=>({...ep(e),options:[e,t]}),dp=(e,t)=>({...rp(e),options:[e,t]}),fp=(e,t)=>({...tp(e),options:[e,t]}),hp=(e,t)=>({...np(e),options:[e,t]}),pp=(e,t)=>({...sp(e),options:[e,t]}),mp={intentional:"onClick",sloppy:"onPointerDown"};function sa(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function gp(e,t={}){const{open:n,onOpenChange:s,elements:r,dataRef:i}=e,{enabled:o=!0,escapeKey:a=!0,outsidePress:c=!0,outsidePressEvent:d="sloppy",referencePress:h=!1,referencePressEvent:m="sloppy",ancestorScroll:u=!1,bubbles:f,capture:p}=t,y=Ri(),v=ae(typeof c=="function"?c:()=>!1),b=typeof c=="function"?v:c,x=l.useRef(!1),{escapeKey:E,outsidePress:S}=sa(f),{escapeKey:C,outsidePress:k}=sa(p),V=l.useRef(null),A=on(),T=on(),M=l.useRef(!1),F=l.useRef(""),I=ae(j=>{F.current=j.pointerType}),w=ae(()=>{const j=F.current,N=j==="pen"||!j?"mouse":j;return typeof d=="string"?d:d[N]}),P=ae(j=>{if(!n||!o||!a||j.key!=="Escape"||M.current)return;const N=i.current.floatingContext?.nodeId,D=y?Tn(y.nodesRef.current,N):[];if(!E&&(j.stopPropagation(),D.length>0)){let B=!0;if(D.forEach(G=>{G.context?.open&&!G.context.dataRef.current.__escapeKeyBubbles&&(B=!1)}),!B)return}s(!1,Mf(j)?j.nativeEvent:j,"escape-key")}),L=ae(j=>{const N=w();return N==="intentional"&&j.type!=="click"||N==="sloppy"&&j.type==="click"}),$=ae(j=>{const N=()=>{P(j),qe(j)?.removeEventListener("keydown",N)};qe(j)?.addEventListener("keydown",N)}),O=ae(j=>{if(L(j))return;const N=i.current.insideReactTree;i.current.insideReactTree=!1;const D=x.current;if(x.current=!1,w()==="intentional"&&D||N||typeof b=="function"&&!b(j))return;const B=qe(j),G=`[${si("inert")}]`,ce=Pt(r.floating).querySelectorAll(G);let me=he(B)?B:null;for(;me&&!jt(me);){const Ee=an(me);if(jt(Ee)||!he(Ee))break;me=Ee}if(ce.length&&he(B)&&!Vu(B)&&!Fe(B,r.floating)&&Array.from(ce).every(Ee=>!Fe(me,Ee)))return;if(tt(B)){const Ee=jt(B),Ne=et(B),kt=/auto|scroll/,He=Ee||kt.test(Ne.overflowX),gt=Ee||kt.test(Ne.overflowY),vn=He&&B.clientWidth>0&&B.scrollWidth>B.clientWidth,Y=gt&&B.clientHeight>0&&B.scrollHeight>B.clientHeight,J=Ne.direction==="rtl",ue=Y&&(J?j.offsetX<=B.offsetWidth-B.clientWidth:j.offsetX>B.clientWidth),de=vn&&j.offsetY>B.clientHeight;if(ue||de)return}const ze=i.current.floatingContext?.nodeId,Bt=y&&Tn(y.nodesRef.current,ze).some(Ee=>st(j,Ee.context?.elements.floating));if(st(j,r.floating)||st(j,r.domReference)||Bt)return;const Ct=y?Tn(y.nodesRef.current,ze):[];if(Ct.length>0){let Ee=!0;if(Ct.forEach(Ne=>{Ne.context?.open&&!Ne.context.dataRef.current.__outsidePressBubbles&&(Ee=!1)}),!Ee)return}s(!1,j,"outside-press")}),R=ae(j=>{if(!(w()!=="sloppy"||!n||!o||st(j,r.floating)||st(j,r.domReference))){if(j.pointerType==="touch"){V.current={startTime:Date.now(),startX:j.clientX,startY:j.clientY,dismissOnPointerUp:!1,dismissOnMouseDown:!0},A.start(1e3,()=>{V.current&&(V.current.dismissOnPointerUp=!1,V.current.dismissOnMouseDown=!1)});return}O(j)}}),H=ae(j=>{if(L(j)||(A.clear(),j.type==="mousedown"&&V.current&&!V.current.dismissOnMouseDown))return;const N=()=>{j.type==="pointerdown"?R(j):O(j),qe(j)?.removeEventListener(j.type,N)};qe(j)?.addEventListener(j.type,N)}),Z=ae(j=>{if(w()!=="sloppy"||j.pointerType!=="touch"||!V.current||st(j,r.floating)||st(j,r.domReference))return;const N=Math.abs(j.clientX-V.current.startX),D=Math.abs(j.clientY-V.current.startY),B=Math.sqrt(N*N+D*D);B>5&&(V.current.dismissOnPointerUp=!0),B>10&&(O(j),A.clear(),V.current=null)}),W=ae(j=>{w()!=="sloppy"||j.pointerType!=="touch"||!V.current||st(j,r.floating)||st(j,r.domReference)||(V.current.dismissOnPointerUp&&O(j),A.clear(),V.current=null)});l.useEffect(()=>{if(!n||!o)return;i.current.__escapeKeyBubbles=E,i.current.__outsidePressBubbles=S;const j=new ri;function N(me){s(!1,me,"ancestor-scroll")}function D(){j.clear(),M.current=!0}function B(){j.start(ii()?5:0,()=>{M.current=!1})}const G=Pt(r.floating);G.addEventListener("pointerdown",I,!0),a&&(G.addEventListener("keydown",C?$:P,C),G.addEventListener("compositionstart",D),G.addEventListener("compositionend",B)),b&&(G.addEventListener("click",k?H:O,k),G.addEventListener("pointerdown",k?H:O,k),G.addEventListener("pointermove",Z,k),G.addEventListener("pointerup",W,k),G.addEventListener("mousedown",H,k));let ce=[];return u&&(he(r.domReference)&&(ce=en(r.domReference)),he(r.floating)&&(ce=ce.concat(en(r.floating))),!he(r.reference)&&r.reference&&r.reference.contextElement&&(ce=ce.concat(en(r.reference.contextElement)))),ce=ce.filter(me=>me!==G.defaultView?.visualViewport),ce.forEach(me=>{me.addEventListener("scroll",N,{passive:!0})}),()=>{G.removeEventListener("pointerdown",I,!0),a&&(G.removeEventListener("keydown",C?$:P,C),G.removeEventListener("compositionstart",D),G.removeEventListener("compositionend",B)),b&&(G.removeEventListener("click",k?H:O,k),G.removeEventListener("pointerdown",k?H:O,k),G.removeEventListener("pointermove",Z,k),G.removeEventListener("pointerup",W,k),G.removeEventListener("mousedown",H,k)),ce.forEach(me=>{me.removeEventListener("scroll",N)}),j.clear()}},[i,r,a,b,d,n,s,u,o,E,S,P,C,$,O,k,H,R,Z,W,I]),l.useEffect(()=>{i.current.insideReactTree=!1},[i,b]);const z=l.useMemo(()=>({onKeyDown:P,...h&&{[mp[m]]:j=>{s(!1,j.nativeEvent,"reference-press")},...m!=="intentional"&&{onClick(j){s(!1,j.nativeEvent,"reference-press")}}}}),[P,s,h,m]),_=ae(j=>{const N=qe(j.nativeEvent);Fe(r.floating,N)&&(x.current=!0)}),q=ae(()=>{i.current.insideReactTree=!0,T.start(0,()=>{i.current.insideReactTree=!1})}),X=l.useMemo(()=>({onKeyDown:P,onMouseDown:_,onMouseUp:_,onPointerDownCapture:q,onMouseDownCapture:q,onClickCapture:q}),[P,_,q]);return l.useMemo(()=>o?{reference:z,floating:X}:{},[o,z,X])}function Ul(e){const{open:t=!1,onOpenChange:n,elements:s}=e,r=ni(),i=l.useRef({}),[o]=l.useState(()=>wh()),a=Nl()!=null,[c,d]=l.useState(s.reference),h=ae((f,p,y)=>{i.current.openEvent=f?p:void 0,o.emit("openchange",{open:f,event:p,reason:y,nested:a}),n?.(f,p,y)}),m=l.useMemo(()=>({setPositionReference:d}),[]),u=l.useMemo(()=>({reference:c||s.reference||null,floating:s.floating||null,domReference:s.reference}),[c,s.reference,s.floating]);return l.useMemo(()=>({dataRef:i,open:t,onOpenChange:h,elements:u,events:o,floatingId:r,refs:m}),[t,h,u,o,r,m])}function yp(e={}){const{nodeId:t}=e,n=Ul({...e,elements:{reference:null,floating:null,...e.elements}}),s=e.rootContext||n,r=s.elements,[i,o]=l.useState(null),[a,c]=l.useState(null),h=r?.domReference||i,m=l.useRef(null),u=Ri();Oe(()=>{h&&(m.current=h)},[h]);const f=lp({...e,elements:{...r,...a&&{reference:a}}}),p=l.useCallback(E=>{const S=he(E)?{getBoundingClientRect:()=>E.getBoundingClientRect(),getClientRects:()=>E.getClientRects(),contextElement:E}:E;c(S),f.refs.setReference(S)},[f.refs]),y=l.useCallback(E=>{(he(E)||E===null)&&(m.current=E,o(E)),(he(f.refs.reference.current)||f.refs.reference.current===null||E!==null&&!he(E))&&f.refs.setReference(E)},[f.refs]),v=l.useMemo(()=>({...f.refs,setReference:y,setPositionReference:p,domReference:m}),[f.refs,y,p]),b=l.useMemo(()=>({...f.elements,domReference:h}),[f.elements,h]),x=l.useMemo(()=>({...f,...s,refs:v,elements:b,nodeId:t}),[f,v,b,t,s]);return Oe(()=>{s.dataRef.current.floatingContext=x;const E=u?.nodesRef.current.find(S=>S.id===t);E&&(E.context=x)}),l.useMemo(()=>({...f,context:x,refs:v,elements:b}),[f,v,b,x])}const ur=ju&&Va;function vp(e,t={}){const{open:n,onOpenChange:s,events:r,dataRef:i,elements:o}=e,{enabled:a=!0,visibleOnly:c=!0}=t,d=l.useRef(!1),h=on(),m=l.useRef(!0);l.useEffect(()=>{if(!a)return;const f=Ue(o.domReference);function p(){!n&&tt(o.domReference)&&o.domReference===At(Pt(o.domReference))&&(d.current=!0)}function y(){m.current=!0}function v(){m.current=!1}return f.addEventListener("blur",p),ur&&(f.addEventListener("keydown",y,!0),f.addEventListener("pointerdown",v,!0)),()=>{f.removeEventListener("blur",p),ur&&(f.removeEventListener("keydown",y,!0),f.removeEventListener("pointerdown",v,!0))}},[o.domReference,n,a]),l.useEffect(()=>{if(!a)return;function f({reason:p}){(p==="reference-press"||p==="escape-key")&&(d.current=!0)}return r.on("openchange",f),()=>{r.off("openchange",f)}},[r,a]);const u=l.useMemo(()=>({onMouseLeave(){d.current=!1},onFocus(f){if(d.current)return;const p=qe(f.nativeEvent);if(c&&he(p)){if(ur&&!f.relatedTarget){if(!m.current&&!Nu(p))return}else if(!ts(p))return}s(!0,f.nativeEvent,"focus")},onBlur(f){d.current=!1;const p=f.relatedTarget,y=f.nativeEvent,v=he(p)&&p.hasAttribute(si("focus-guard"))&&p.getAttribute("data-type")==="outside";h.start(0,()=>{const b=At(o.domReference?o.domReference.ownerDocument:document);!p&&b===o.domReference||Fe(i.current.floatingContext?.refs.floating.current,b)||Fe(o.domReference,b)||v||s(!1,y,"focus")})}}),[i,o.domReference,s,c,h]);return l.useMemo(()=>a?{reference:u}:{},[a,u])}function bp(e=[]){const t=e.map(a=>a?.reference),n=e.map(a=>a?.floating),s=e.map(a=>a?.item),r=l.useCallback(a=>dr(a,e,"reference"),t),i=l.useCallback(a=>dr(a,e,"floating"),n),o=l.useCallback(a=>dr(a,e,"item"),s);return l.useMemo(()=>({getReferenceProps:r,getFloatingProps:i,getItemProps:o}),[r,i,o])}function dr(e,t,n){const s=new Map,r=n==="item",i={};n==="floating"&&(i.tabIndex=-1,i[Lu]="");for(const o in e)r&&e&&(o===ja||o===La)||(i[o]=e[o]);for(let o=0;o<t.length;o+=1){let a;const c=t[o]?.[n];typeof c=="function"?a=e?c(e):null:a=c,a&&ra(i,a,r,s)}return ra(i,e,r,s),i}function ra(e,t,n,s){for(const r in t){const i=t[r];n&&(r===ja||r===La)||(r.startsWith("on")?(s.has(r)||s.set(r,[]),typeof i=="function"&&(s.get(r)?.push(i),e[r]=(...o)=>s.get(r)?.map(a=>a(...o)).find(a=>a!==void 0))):e[r]=i)}}function ia(e,t){const[n,s]=e;let r=!1;const i=t.length;for(let o=0,a=i-1;o<i;a=o++){const[c,d]=t[o]||[0,0],[h,m]=t[a]||[0,0];d>=s!=m>=s&&n<=(h-c)*(s-d)/(m-d)+c&&(r=!r)}return r}function xp(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function wp(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:s=!0}=e,r=new ri;let i=!1,o=null,a=null,c=typeof performance<"u"?performance.now():0;function d(m,u){const f=performance.now(),p=f-c;if(o===null||a===null||p===0)return o=m,a=u,c=f,null;const y=m-o,v=u-a,x=Math.sqrt(y*y+v*v)/p;return o=m,a=u,c=f,x}const h=({x:m,y:u,placement:f,elements:p,onClose:y,nodeId:v,tree:b})=>function(E){function S(){r.clear(),y()}if(r.clear(),!p.domReference||!p.floating||f==null||m==null||u==null)return;const{clientX:C,clientY:k}=E,V=[C,k],A=qe(E),T=E.type==="mouseleave",M=Fe(p.floating,A),F=Fe(p.domReference,A),I=p.domReference.getBoundingClientRect(),w=p.floating.getBoundingClientRect(),P=f.split("-")[0],L=m>w.right-w.width/2,$=u>w.bottom-w.height/2,O=xp(V,I),R=w.width>I.width,H=w.height>I.height,Z=(R?I:w).left,W=(R?I:w).right,z=(H?I:w).top,_=(H?I:w).bottom;if(M&&(i=!0,!T))return;if(F&&(i=!1),F&&!T){i=!0;return}if(T&&he(E.relatedTarget)&&Fe(p.floating,E.relatedTarget)||b&&Tn(b.nodesRef.current,v).some(({context:j})=>j?.open))return;if(P==="top"&&u>=I.bottom-1||P==="bottom"&&u<=I.top+1||P==="left"&&m>=I.right-1||P==="right"&&m<=I.left+1)return S();let q=[];switch(P){case"top":q=[[Z,I.top+1],[Z,w.bottom-1],[W,w.bottom-1],[W,I.top+1]];break;case"bottom":q=[[Z,w.top+1],[Z,I.bottom-1],[W,I.bottom-1],[W,w.top+1]];break;case"left":q=[[w.right-1,_],[w.right-1,z],[I.left+1,z],[I.left+1,_]];break;case"right":q=[[I.right-1,_],[I.right-1,z],[w.left+1,z],[w.left+1,_]];break}function X([j,N]){switch(P){case"top":{const D=[R?j+t/2:L?j+t*4:j-t*4,N+t+1],B=[R?j-t/2:L?j+t*4:j-t*4,N+t+1],G=[[w.left,L||R?w.bottom-t:w.top],[w.right,L?R?w.bottom-t:w.top:w.bottom-t]];return[D,B,...G]}case"bottom":{const D=[R?j+t/2:L?j+t*4:j-t*4,N-t],B=[R?j-t/2:L?j+t*4:j-t*4,N-t],G=[[w.left,L||R?w.top+t:w.bottom],[w.right,L?R?w.top+t:w.bottom:w.top+t]];return[D,B,...G]}case"left":{const D=[j+t+1,H?N+t/2:$?N+t*4:N-t*4],B=[j+t+1,H?N-t/2:$?N+t*4:N-t*4];return[...[[$||H?w.right-t:w.left,w.top],[$?H?w.right-t:w.left:w.right-t,w.bottom]],D,B]}case"right":{const D=[j-t,H?N+t/2:$?N+t*4:N-t*4],B=[j-t,H?N-t/2:$?N+t*4:N-t*4],G=[[$||H?w.left+t:w.right,w.top],[$?H?w.left+t:w.right:w.left+t,w.bottom]];return[D,B,...G]}default:return[]}}if(!ia([C,k],q)){if(i&&!O)return S();if(!T&&s){const j=d(E.clientX,E.clientY);if(j!==null&&j<.1)return S()}ia([C,k],X([m,u]))?!i&&s&&r.start(40,S):S()}};return h.__options={blockPointerEvents:n},h}function Ep(){const e=l.useContext(Du);if(!e)throw new Error("Base UI: useToast must be used within <Toast.Provider>.");const{toasts:t,add:n,close:s,update:r,promise:i}=e;return l.useMemo(()=>({toasts:t,add:n,close:s,update:r,promise:i}),[t,n,s,r,i])}const Sp=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M228,128a100,100,0,0,1-98.66,100H128a99.39,99.39,0,0,1-68.62-27.29,12,12,0,0,1,16.48-17.45,76,76,0,1,0-1.57-109c-.13.13-.25.25-.39.37L54.89,92H72a12,12,0,0,1,0,24H24a12,12,0,0,1-12-12V56a12,12,0,0,1,24,0V76.72L57.48,57.06A100,100,0,0,1,228,128Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L60.63,81.29l17,17A8,8,0,0,1,72,112H24a8,8,0,0,1-8-8V56A8,8,0,0,1,29.66,50.3L49.31,70,60.25,60A96,96,0,0,1,224,128Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M222,128a94,94,0,0,1-92.74,94H128a93.43,93.43,0,0,1-64.5-25.65,6,6,0,1,1,8.24-8.72A82,82,0,1,0,70,70l-.19.19L39.44,98H72a6,6,0,0,1,0,12H24a6,6,0,0,1-6-6V56a6,6,0,0,1,12,0V90.34L61.63,61.4A94,94,0,0,1,222,128Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M220,128a92,92,0,0,1-90.77,92H128a91.47,91.47,0,0,1-63.13-25.1,4,4,0,1,1,5.5-5.82A84,84,0,1,0,68.6,68.57l-.13.12L34.3,100H72a4,4,0,0,1,0,8H24a4,4,0,0,1-4-4V56a4,4,0,0,1,8,0V94.89l35-32A92,92,0,0,1,220,128Z"}))]]),Cp=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),l.createElement("path",{d:"M215.39,92.94A8,8,0,0,0,208,88H48a8,8,0,0,0-5.66,13.66l80,80a8,8,0,0,0,11.32,0l80-80A8,8,0,0,0,215.39,92.94ZM128,164.69,67.31,104H188.69Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,48,88H208a8,8,0,0,1,5.66,13.66Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M212.24,100.24l-80,80a6,6,0,0,1-8.48,0l-80-80a6,6,0,0,1,8.48-8.48L128,167.51l75.76-75.75a6,6,0,0,1,8.48,8.48Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z"}))]]),kp=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M184.49,136.49l-80,80a12,12,0,0,1-17-17L159,128,87.51,56.49a12,12,0,1,1,17-17l80,80A12,12,0,0,1,184.49,136.49Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),l.createElement("path",{d:"M181.66,122.34l-80-80A8,8,0,0,0,88,48V208a8,8,0,0,0,13.66,5.66l80-80A8,8,0,0,0,181.66,122.34ZM104,188.69V67.31L164.69,128Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M181.66,133.66l-80,80A8,8,0,0,1,88,208V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,181.66,133.66Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M180.24,132.24l-80,80a6,6,0,0,1-8.48-8.48L167.51,128,91.76,52.24a6,6,0,0,1,8.48-8.48l80,80A6,6,0,0,1,180.24,132.24Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M178.83,130.83l-80,80a4,4,0,0,1-5.66-5.66L170.34,128,93.17,50.83a4,4,0,0,1,5.66-5.66l80,80A4,4,0,0,1,178.83,130.83Z"}))]]),Tp=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M184.49,167.51a12,12,0,0,1,0,17l-48,48a12,12,0,0,1-17,0l-48-48a12,12,0,0,1,17-17L128,207l39.51-39.52A12,12,0,0,1,184.49,167.51Zm-96-79L128,49l39.51,39.52a12,12,0,0,0,17-17l-48-48a12,12,0,0,0-17,0l-48,48a12,12,0,0,0,17,17Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M80,176h96l-48,48ZM128,32,80,80h96Z",opacity:"0.2"}),l.createElement("path",{d:"M176,168H80a8,8,0,0,0-5.66,13.66l48,48a8,8,0,0,0,11.32,0l48-48A8,8,0,0,0,176,168Zm-48,44.69L99.31,184h57.38ZM80,88h96a8,8,0,0,0,5.66-13.66l-48-48a8,8,0,0,0-11.32,0l-48,48A8,8,0,0,0,80,88Zm48-44.69L156.69,72H99.31Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M72.61,83.06a8,8,0,0,1,1.73-8.72l48-48a8,8,0,0,1,11.32,0l48,48A8,8,0,0,1,176,88H80A8,8,0,0,1,72.61,83.06ZM176,168H80a8,8,0,0,0-5.66,13.66l48,48a8,8,0,0,0,11.32,0l48-48A8,8,0,0,0,176,168Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M180.24,171.76a6,6,0,0,1,0,8.48l-48,48a6,6,0,0,1-8.48,0l-48-48a6,6,0,0,1,8.48-8.48L128,215.51l43.76-43.75A6,6,0,0,1,180.24,171.76Zm-96-87.52L128,40.49l43.76,43.75a6,6,0,0,0,8.48-8.48l-48-48a6,6,0,0,0-8.48,0l-48,48a6,6,0,0,0,8.48,8.48Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M181.66,170.34a8,8,0,0,1,0,11.32l-48,48a8,8,0,0,1-11.32,0l-48-48a8,8,0,0,1,11.32-11.32L128,212.69l42.34-42.35A8,8,0,0,1,181.66,170.34Zm-96-84.68L128,43.31l42.34,42.35a8,8,0,0,0,11.32-11.32l-48-48a8,8,0,0,0-11.32,0l-48,48A8,8,0,0,0,85.66,85.66Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M178.83,173.17a4,4,0,0,1,0,5.66l-48,48a4,4,0,0,1-5.66,0l-48-48a4,4,0,0,1,5.66-5.66L128,218.34l45.17-45.17A4,4,0,0,1,178.83,173.17Zm-96-90.34L128,37.66l45.17,45.17a4,4,0,1,0,5.66-5.66l-48-48a4,4,0,0,0-5.66,0l-48,48a4,4,0,0,0,5.66,5.66Z"}))]]),Mp=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M232,56V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56Z",opacity:"0.2"}),l.createElement("path",{d:"M205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM205.66,85.66l-96,96a8,8,0,0,1-11.32,0l-40-40a8,8,0,0,1,11.32-11.32L104,164.69l90.34-90.35a8,8,0,0,1,11.32,11.32Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M228.24,76.24l-128,128a6,6,0,0,1-8.48,0l-56-56a6,6,0,0,1,8.48-8.48L96,191.51,219.76,67.76a6,6,0,0,1,8.48,8.48Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M226.83,74.83l-128,128a4,4,0,0,1-5.66,0l-56-56a4,4,0,0,1,5.66-5.66L96,194.34,221.17,69.17a4,4,0,1,1,5.66,5.66Z"}))]]),Rp=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M148,200a20,20,0,1,1-20-20A20,20,0,0,1,148,200Zm-20-40a12,12,0,0,0,12-12V48a12,12,0,0,0-24,0V148A12,12,0,0,0,128,160Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,40V216a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V40A16,16,0,0,1,56,24H200A16,16,0,0,1,216,40Z",opacity:"0.2"}),l.createElement("path",{d:"M144,200a16,16,0,1,1-16-16A16,16,0,0,1,144,200Zm-16-40a8,8,0,0,0,8-8V48a8,8,0,0,0-16,0V152A8,8,0,0,0,128,160Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M200,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V40A16,16,0,0,0,200,24ZM128,160a12,12,0,1,1-12,12A12,12,0,0,1,128,160Zm-8-24V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M142,200a14,14,0,1,1-14-14A14,14,0,0,1,142,200Zm-14-42a6,6,0,0,0,6-6V48a6,6,0,0,0-12,0V152A6,6,0,0,0,128,158Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M144,200a16,16,0,1,1-16-16A16,16,0,0,1,144,200Zm-16-40a8,8,0,0,0,8-8V48a8,8,0,0,0-16,0V152A8,8,0,0,0,128,160Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M140,200a12,12,0,1,1-12-12A12,12,0,0,1,140,200Zm-12-44a4,4,0,0,0,4-4V48a4,4,0,0,0-8,0V152A4,4,0,0,0,128,156Z"}))]]),Op=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M228,128a12,12,0,0,1-12,12H140v76a12,12,0,0,1-24,0V140H40a12,12,0,0,1,0-24h76V40a12,12,0,0,1,24,0v76h76A12,12,0,0,1,228,128Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),l.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM184,136H136v48a8,8,0,0,1-16,0V136H72a8,8,0,0,1,0-16h48V72a8,8,0,0,1,16,0v48h48a8,8,0,0,1,0,16Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M222,128a6,6,0,0,1-6,6H134v82a6,6,0,0,1-12,0V134H40a6,6,0,0,1,0-12h82V40a6,6,0,0,1,12,0v82h82A6,6,0,0,1,222,128Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M220,128a4,4,0,0,1-4,4H132v84a4,4,0,0,1-8,0V132H40a4,4,0,0,1,0-8h84V40a4,4,0,0,1,8,0v84h84A4,4,0,0,1,220,128Z"}))]]),Fp=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,48H180V36A28,28,0,0,0,152,8H104A28,28,0,0,0,76,36V48H40a12,12,0,0,0,0,24h4V208a20,20,0,0,0,20,20H192a20,20,0,0,0,20-20V72h4a12,12,0,0,0,0-24ZM100,36a4,4,0,0,1,4-4h48a4,4,0,0,1,4,4V48H100Zm88,168H68V72H188ZM116,104v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Zm48,0v64a12,12,0,0,1-24,0V104a12,12,0,0,1,24,0Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),l.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM112,168a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm0-120H96V40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,50H174V40a22,22,0,0,0-22-22H104A22,22,0,0,0,82,40V50H40a6,6,0,0,0,0,12H50V208a14,14,0,0,0,14,14H192a14,14,0,0,0,14-14V62h10a6,6,0,0,0,0-12ZM94,40a10,10,0,0,1,10-10h48a10,10,0,0,1,10,10V50H94ZM194,208a2,2,0,0,1-2,2H64a2,2,0,0,1-2-2V62H194ZM110,104v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Zm48,0v64a6,6,0,0,1-12,0V104a6,6,0,0,1,12,0Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,52H172V40a20,20,0,0,0-20-20H104A20,20,0,0,0,84,40V52H40a4,4,0,0,0,0,8H52V208a12,12,0,0,0,12,12H192a12,12,0,0,0,12-12V60h12a4,4,0,0,0,0-8ZM92,40a12,12,0,0,1,12-12h48a12,12,0,0,1,12,12V52H92ZM196,208a4,4,0,0,1-4,4H64a4,4,0,0,1-4-4V60H196ZM108,104v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Zm48,0v64a4,4,0,0,1-8,0V104a4,4,0,0,1,8,0Z"}))]]),Ip=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M240.26,186.1,152.81,34.23h0a28.74,28.74,0,0,0-49.62,0L15.74,186.1a27.45,27.45,0,0,0,0,27.71A28.31,28.31,0,0,0,40.55,228h174.9a28.31,28.31,0,0,0,24.79-14.19A27.45,27.45,0,0,0,240.26,186.1Zm-20.8,15.7a4.46,4.46,0,0,1-4,2.2H40.55a4.46,4.46,0,0,1-4-2.2,3.56,3.56,0,0,1,0-3.73L124,46.2a4.77,4.77,0,0,1,8,0l87.44,151.87A3.56,3.56,0,0,1,219.46,201.8ZM116,136V104a12,12,0,0,1,24,0v32a12,12,0,0,1-24,0Zm28,40a16,16,0,1,1-16-16A16,16,0,0,1,144,176Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M215.46,216H40.54C27.92,216,20,202.79,26.13,192.09L113.59,40.22c6.3-11,22.52-11,28.82,0l87.46,151.87C236,202.79,228.08,216,215.46,216Z",opacity:"0.2"}),l.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM120,104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,192Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M235.07,189.09,147.61,37.22h0a22.75,22.75,0,0,0-39.22,0L20.93,189.09a21.53,21.53,0,0,0,0,21.72A22.35,22.35,0,0,0,40.55,222h174.9a22.35,22.35,0,0,0,19.6-11.19A21.53,21.53,0,0,0,235.07,189.09ZM224.66,204.8a10.46,10.46,0,0,1-9.21,5.2H40.55a10.46,10.46,0,0,1-9.21-5.2,9.51,9.51,0,0,1,0-9.72L118.79,43.21a10.75,10.75,0,0,1,18.42,0l87.46,151.87A9.51,9.51,0,0,1,224.66,204.8ZM122,144V104a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm16,36a10,10,0,1,1-10-10A10,10,0,0,1,138,180Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M236.8,188.09,149.35,36.22h0a24.76,24.76,0,0,0-42.7,0L19.2,188.09a23.51,23.51,0,0,0,0,23.72A24.35,24.35,0,0,0,40.55,224h174.9a24.35,24.35,0,0,0,21.33-12.19A23.51,23.51,0,0,0,236.8,188.09ZM222.93,203.8a8.5,8.5,0,0,1-7.48,4.2H40.55a8.5,8.5,0,0,1-7.48-4.2,7.59,7.59,0,0,1,0-7.72L120.52,44.21a8.75,8.75,0,0,1,15,0l87.45,151.87A7.59,7.59,0,0,1,222.93,203.8ZM120,144V104a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm20,36a12,12,0,1,1-12-12A12,12,0,0,1,140,180Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M233.34,190.09,145.88,38.22h0a20.75,20.75,0,0,0-35.76,0L22.66,190.09a19.52,19.52,0,0,0,0,19.71A20.36,20.36,0,0,0,40.54,220H215.46a20.36,20.36,0,0,0,17.86-10.2A19.52,19.52,0,0,0,233.34,190.09ZM226.4,205.8a12.47,12.47,0,0,1-10.94,6.2H40.54a12.47,12.47,0,0,1-10.94-6.2,11.45,11.45,0,0,1,0-11.72L117.05,42.21a12.76,12.76,0,0,1,21.9,0L226.4,194.08A11.45,11.45,0,0,1,226.4,205.8ZM124,144V104a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm12,36a8,8,0,1,1-8-8A8,8,0,0,1,136,180Z"}))]]),Ap=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z",opacity:"0.2"}),l.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M208,32H48A16,16,0,0,0,32,48V208a16,16,0,0,0,16,16H208a16,16,0,0,0,16-16V48A16,16,0,0,0,208,32ZM181.66,170.34a8,8,0,0,1-11.32,11.32L128,139.31,85.66,181.66a8,8,0,0,1-11.32-11.32L116.69,128,74.34,85.66A8,8,0,0,1,85.66,74.34L128,116.69l42.34-42.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M204.24,195.76a6,6,0,1,1-8.48,8.48L128,136.49,60.24,204.24a6,6,0,0,1-8.48-8.48L119.51,128,51.76,60.24a6,6,0,0,1,8.48-8.48L128,119.51l67.76-67.75a6,6,0,0,1,8.48,8.48L136.49,128Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M202.83,197.17a4,4,0,0,1-5.66,5.66L128,133.66,58.83,202.83a4,4,0,0,1-5.66-5.66L122.34,128,53.17,58.83a4,4,0,0,1,5.66-5.66L128,122.34l69.17-69.17a4,4,0,1,1,5.66,5.66L133.66,128Z"}))]]),zl=l.forwardRef((e,t)=>l.createElement(nt,{ref:t,...e,weights:Sp}));zl.displayName="ArrowCounterClockwiseIcon";const Gl=l.forwardRef((e,t)=>l.createElement(nt,{ref:t,...e,weights:Cp}));Gl.displayName="CaretDownIcon";const Kl=l.forwardRef((e,t)=>l.createElement(nt,{ref:t,...e,weights:kp}));Kl.displayName="CaretRightIcon";const $s=l.forwardRef((e,t)=>l.createElement(nt,{ref:t,...e,weights:Tp}));$s.displayName="CaretUpDownIcon";const wt=l.forwardRef((e,t)=>l.createElement(nt,{ref:t,...e,weights:Mp}));wt.displayName="CheckIcon";const $r=l.forwardRef((e,t)=>l.createElement(nt,{ref:t,...e,weights:Rp}));$r.displayName="ExclamationMarkIcon";const xs=l.forwardRef((e,t)=>l.createElement(nt,{ref:t,...e,weights:Op}));xs.displayName="PlusIcon";const Hr=l.forwardRef((e,t)=>l.createElement(nt,{ref:t,...e,weights:Fp}));Hr.displayName="TrashIcon";const Ii=l.forwardRef((e,t)=>l.createElement(nt,{ref:t,...e,weights:Ip}));Ii.displayName="WarningIcon";const Ai=l.forwardRef((e,t)=>l.createElement(nt,{ref:t,...e,weights:Ap}));Ai.displayName="XIcon";function Pi(e,t,n){let[s,r]=l.useState(n),i=e!==void 0,o=l.useRef(i),a=l.useRef(!1),c=l.useRef(!1);return i&&!o.current&&!a.current?(a.current=!0,o.current=i,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!i&&o.current&&!c.current&&(c.current=!0,o.current=i,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[i?e:s,K(d=>(i||r(d),t?.(d)))]}function Vi(e){let[t]=l.useState(e);return t}function Wl(e={},t=null,n=[]){for(let[s,r]of Object.entries(e))Yl(n,Ql(t,s),r);return n}function Ql(e,t){return e?e+"["+t+"]":t}function Yl(e,t,n){if(Array.isArray(n))for(let[s,r]of n.entries())Yl(e,Ql(t,s.toString()),r);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):Wl(n,t,e)}function Xl(e){var t,n;let s=(t=e?.form)!=null?t:e.closest("form");if(s){for(let r of s.elements)if(r!==e&&(r.tagName==="INPUT"&&r.type==="submit"||r.tagName==="BUTTON"&&r.type==="submit"||r.nodeName==="INPUT"&&r.type==="image")){r.click();return}(n=s.requestSubmit)==null||n.call(s)}}let Pp="span";var dn=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(dn||{});function Vp(e,t){var n;let{features:s=1,...r}=e,i={ref:t,"aria-hidden":(s&2)===2?!0:(n=r["aria-hidden"])!=null?n:void 0,hidden:(s&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(s&4)===4&&(s&2)!==2&&{display:"none"}}};return pe()({ourProps:i,theirProps:r,slot:{},defaultTag:Pp,name:"Hidden"})}let An=le(Vp),Np=l.createContext(null);function jp({children:e}){let t=l.useContext(Np);if(!t)return U.createElement(U.Fragment,null,e);let{target:n}=t;return n?Me.createPortal(U.createElement(U.Fragment,null,e),n):null}function Ni({data:e,form:t,disabled:n,onReset:s,overrides:r}){let[i,o]=l.useState(null),a=fn();return l.useEffect(()=>{if(s&&i)return a.addEventListener(i,"reset",s)},[i,t,s]),U.createElement(jp,null,U.createElement(Lp,{setForm:o,formId:t}),Wl(e).map(([c,d])=>U.createElement(An,{features:dn.Hidden,...Da({key:c,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:c,value:d,...r})})))}function Lp({setForm:e,formId:t}){return l.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:U.createElement(An,{features:dn.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let s=n.closest("form");s&&e(s)}})}let Dp="span";function $p(e,t){let n=l.useId(),s=Rs(),r=Os(),{id:i=s||`headlessui-checkbox-${n}`,disabled:o=r||!1,autoFocus:a=!1,checked:c,defaultChecked:d,onChange:h,name:m,value:u,form:f,indeterminate:p=!1,tabIndex:y=0,...v}=e,b=Vi(d),[x,E]=Pi(c,h,b??!1),S=hn(),C=Fs(),k=fn(),[V,A]=l.useState(!1),T=K(()=>{A(!0),E?.(!x),k.nextFrame(()=>{A(!1)})}),M=K(_=>{if(Is(_.currentTarget))return _.preventDefault();_.preventDefault(),T()}),F=K(_=>{_.key===ee.Space?(_.preventDefault(),T()):_.key===ee.Enter&&Xl(_.currentTarget)}),I=K(_=>_.preventDefault()),{isFocusVisible:w,focusProps:P}=pn({autoFocus:a}),{isHovered:L,hoverProps:$}=mn({isDisabled:o}),{pressed:O,pressProps:R}=As({disabled:o}),H=dt({ref:t,id:i,role:"checkbox","aria-checked":p?"mixed":x?"true":"false","aria-labelledby":S,"aria-describedby":C,"aria-disabled":o?!0:void 0,indeterminate:p?"true":void 0,tabIndex:o?void 0:y,onKeyUp:o?void 0:F,onKeyPress:o?void 0:I,onClick:o?void 0:M},P,$,R),Z=l.useMemo(()=>({checked:x,disabled:o,hover:L,focus:w,active:O,indeterminate:p,changing:V,autofocus:a}),[x,p,o,L,w,O,V,a]),W=l.useCallback(()=>{if(b!==void 0)return E?.(b)},[E,b]),z=pe();return U.createElement(U.Fragment,null,m!=null&&U.createElement(Ni,{disabled:o,data:{[m]:u||"on"},overrides:{type:"checkbox",checked:x},form:f,onReset:W}),z({ourProps:H,theirProps:v,slot:Z,defaultTag:Dp,name:"Checkbox"}))}let Hp=le($p),_p=l.createContext(()=>{});function Jl({value:e,children:t}){return U.createElement(_p.Provider,{value:e},t)}function Kt(e,t,n){let s=n.initialDeps??[],r;function i(){var o,a,c,d;let h;n.key&&((o=n.debug)!=null&&o.call(n))&&(h=Date.now());const m=e();if(!(m.length!==s.length||m.some((p,y)=>s[y]!==p)))return r;s=m;let f;if(n.key&&((a=n.debug)!=null&&a.call(n))&&(f=Date.now()),r=t(...m),n.key&&((c=n.debug)!=null&&c.call(n))){const p=Math.round((Date.now()-h)*100)/100,y=Math.round((Date.now()-f)*100)/100,v=y/16,b=(x,E)=>{for(x=String(x);x.length<E;)x=" "+x;return x};console.info(`%c⏱ ${b(y,5)} /${b(p,5)} ms`,`
14
- font-size: .6rem;
15
- font-weight: bold;
16
- color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,n?.key)}return(d=n?.onChange)==null||d.call(n,r),r}return i.updateDeps=o=>{s=o},i}function oa(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const Bp=(e,t)=>Math.abs(e-t)<=1,qp=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}},aa=e=>{const{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},Zp=e=>e,Up=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),s=[];for(let r=t;r<=n;r++)s.push(r);return s},zp=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=o=>{const{width:a,height:c}=o;t({width:Math.round(a),height:Math.round(c)})};if(r(aa(n)),!s.ResizeObserver)return()=>{};const i=new s.ResizeObserver(o=>{const a=()=>{const c=o[0];if(c?.borderBoxSize){const d=c.borderBoxSize[0];if(d){r({width:d.inlineSize,height:d.blockSize});return}}r(aa(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()});return i.observe(n,{box:"border-box"}),()=>{i.unobserve(n)}},la={passive:!0},ca=typeof window>"u"?!0:"onscrollend"in window,Gp=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;let r=0;const i=e.options.useScrollendEvent&&ca?()=>{}:qp(s,()=>{t(r,!1)},e.options.isScrollingResetDelay),o=h=>()=>{const{horizontal:m,isRtl:u}=e.options;r=m?n.scrollLeft*(u&&-1||1):n.scrollTop,i(),t(r,h)},a=o(!0),c=o(!1);c(),n.addEventListener("scroll",a,la);const d=e.options.useScrollendEvent&&ca;return d&&n.addEventListener("scrollend",c,la),()=>{n.removeEventListener("scroll",a),d&&n.removeEventListener("scrollend",c)}},Kp=(e,t,n)=>{if(t?.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return e[n.options.horizontal?"offsetWidth":"offsetHeight"]},Wp=(e,{adjustments:t=0,behavior:n},s)=>{var r,i;const o=e+t;(i=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||i.call(r,{[s.options.horizontal?"left":"top"]:o,behavior:n})};class Qp{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(i=>{const o=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var i;return(i=s())==null?void 0:i.observe(r,{box:"border-box"})},unobserve:r=>{var i;return(i=s())==null?void 0:i.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([s,r])=>{typeof r>"u"&&delete n[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:Zp,rangeExtractor:Up,onChange:()=>{},measureElement:Kp,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,...n}},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=Kt(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=i,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const r=new Map,i=new Map;for(let o=s-1;o>=0;o--){const a=n[o];if(r.has(a.lane))continue;const c=i.get(a.lane);if(c==null||a.end>c.end?i.set(a.lane,a):a.end<c.end&&r.set(a.lane,!0),r.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((o,a)=>o.end===a.end?o.index-a.index:o.end-a.end)[0]:void 0},this.getMeasurementOptions=Kt(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,s,r,i,o)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o}),{key:!1}),this.getMeasurements=Kt(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:s,scrollMargin:r,getItemKey:i,enabled:o},a)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(h=>{this.itemSizeCache.set(h.key,h.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const d=this.measurementsCache.slice(0,c);for(let h=c;h<n;h++){const m=i(h),u=this.options.lanes===1?d[h-1]:this.getFurthestMeasurement(d,h),f=u?u.end+this.options.gap:s+r,p=a.get(m),y=typeof p=="number"?p:this.options.estimateSize(h),v=f+y,b=u?u.lane:h%this.options.lanes;d[h]={index:h,start:f,size:y,end:v,key:m,lane:b}}return this.measurementsCache=d,d},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Kt(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,s,r,i)=>this.range=n.length>0&&s>0?Yp({measurements:n,outerSize:s,scrollOffset:r,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Kt(()=>{let n=null,s=null;const r=this.calculateRange();return r&&(n=r.startIndex,s=r.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,s]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,s]},(n,s,r,i,o)=>i===null||o===null?[]:n({startIndex:i,endIndex:o,overscan:s,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(n,s)=>{const r=this.indexFromElement(n),i=this.measurementsCache[r];if(!i)return;const o=i.key,a=this.elementsCache.get(o);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(o,n)),n.isConnected&&this.resizeItem(r,this.options.measureElement(n,s,this))},this.resizeItem=(n,s)=>{const r=this.measurementsCache[n];if(!r)return;const i=this.itemSizeCache.get(r.key)??r.size,o=s-i;o!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,o,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,s)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((s,r)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(r))});return}this._measureElement(n,void 0)},this.getVirtualItems=Kt(()=>[this.getVirtualIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let i=0,o=n.length;i<o;i++){const a=n[i],c=s[a];r.push(c)}return r},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length!==0)return oa(s[ec(0,s.length-1,r=>oa(s[r]).start,n)])},this.getOffsetForAlignment=(n,s,r=0)=>{const i=this.getSize(),o=this.getScrollOffset();s==="auto"&&(s=n>=o+i?"end":"start"),s==="center"?n+=(r-i)/2:s==="end"&&(n-=i);const a=this.getTotalSize()-i;return Math.max(Math.min(a,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.measurementsCache[n];if(!r)return;const i=this.getSize(),o=this.getScrollOffset();if(s==="auto")if(r.end>=o+i-this.options.scrollPaddingEnd)s="end";else if(r.start<=o+this.options.scrollPaddingStart)s="start";else return[o,s];const a=s==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s,r.size),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:s="start",behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,s),{adjustments:void 0,behavior:r})},this.scrollToIndex=(n,{align:s="auto",behavior:r}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const i=this.getOffsetForIndex(n,s);if(!i)return;const[o,a]=i;this._scrollToOffset(o,{adjustments:void 0,behavior:r}),r!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const d=this.getOffsetForIndex(n,a);if(!d)return;const[h]=d,m=this.getScrollOffset();Bp(h,m)||this.scrollToIndex(n,{align:a,behavior:r})}else this.scrollToIndex(n,{align:a,behavior:r})}))},this.scrollBy=(n,{behavior:s}={})=>{this.cancelScrollToIndex(),s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let r;if(s.length===0)r=this.options.paddingStart;else if(this.options.lanes===1)r=((n=s[s.length-1])==null?void 0:n.end)??0;else{const i=Array(this.options.lanes).fill(null);let o=s.length-1;for(;o>=0&&i.some(a=>a===null);){const a=s[o];i[a.lane]===null&&(i[a.lane]=a.end),o--}r=Math.max(...i.filter(a=>a!==null))}return Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this.options.scrollToFn(n,{behavior:r,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const ec=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,i=n(r);if(i<s)e=r+1;else if(i>s)t=r-1;else return r}return e>0?e-1:0};function Yp({measurements:e,outerSize:t,scrollOffset:n,lanes:s}){const r=e.length-1,i=c=>e[c].start;if(e.length<=s)return{startIndex:0,endIndex:r};let o=ec(0,r,i,n),a=o;if(s===1)for(;a<r&&e[a].end<n+t;)a++;else if(s>1){const c=Array(s).fill(0);for(;a<r&&c.some(h=>h<n+t);){const h=e[a];c[h.lane]=h.end,a++}const d=Array(s).fill(n+t);for(;o>=0&&d.some(h=>h>=n);){const h=e[o];d[h.lane]=h.start,o--}o=Math.max(0,o-o%s),a=Math.min(r,a+(s-1-a%s))}return{startIndex:o,endIndex:a}}const ua=typeof document<"u"?l.useLayoutEffect:l.useEffect;function Xp(e){const t=l.useReducer(()=>({}),{})[1],n={...e,onChange:(r,i)=>{var o;i?Me.flushSync(t):t(),(o=e.onChange)==null||o.call(e,r,i)}},[s]=l.useState(()=>new Qp(n));return s.setOptions(n),ua(()=>s._didMount(),[]),ua(()=>s._willUpdate()),s}function Jp(e){return Xp({observeElementRect:zp,observeElementOffset:Gp,scrollToFn:Wp,...e})}function em(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function tc(e=em){return l.useCallback((t,n)=>{if(typeof e=="string"){let s=e;return t?.[s]===n?.[s]}return e(t,n)},[e])}function ji(e,t,n,s){let r=Ps(n);l.useEffect(()=>{e=e??window;function i(o){r.current(o)}return e.addEventListener(t,i,s),()=>e.removeEventListener(t,i,s)},[e,t,s])}function nc(e){let t=l.useRef({value:"",selectionStart:null,selectionEnd:null});return ji(e,"blur",n=>{let s=n.target;So(s)&&(t.current={value:s.value,selectionStart:s.selectionStart,selectionEnd:s.selectionEnd})}),K(()=>{if(document.activeElement!==e&&So(e)&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==t.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:n,selectionEnd:s}=t.current;n!==null&&s!==null&&e.setSelectionRange(n,s)}t.current={value:"",selectionStart:null,selectionEnd:null}}})}function Pn(e,t){let n=l.useRef([]),s=K(e);l.useEffect(()=>{let r=[...n.current];for(let[i,o]of t.entries())if(n.current[i]!==o){let a=s(t,r);return n.current=t,a}},[s,...t])}function tm({children:e,freeze:t}){let n=ws(t,e);return U.createElement(U.Fragment,null,n)}function ws(e,t){let[n,s]=l.useState(t);return!e&&n!==t&&s(t),e?n:t}function nm(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Qe=[];nm(()=>{function e(t){if(!Rn(t.target)||t.target===document.body||Qe[0]===t.target)return;let n=t.target;n=n.closest($u),Qe.unshift(n??t.target),Qe=Qe.filter(s=>s!=null&&s.isConnected),Qe.splice(10)}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});var sm=Object.defineProperty,rm=(e,t,n)=>t in e?sm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,da=(e,t,n)=>(rm(e,typeof t!="symbol"?t+"":t,n),n),ne=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ne||{}),Pe=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Pe||{}),Je=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(Je||{}),sc=(e=>(e[e.OpenCombobox=0]="OpenCombobox",e[e.CloseCombobox=1]="CloseCombobox",e[e.GoToOption=2]="GoToOption",e[e.SetTyping=3]="SetTyping",e[e.RegisterOption=4]="RegisterOption",e[e.UnregisterOption=5]="UnregisterOption",e[e.DefaultToFirstOption=6]="DefaultToFirstOption",e[e.SetActivationTrigger=7]="SetActivationTrigger",e[e.UpdateVirtualConfiguration=8]="UpdateVirtualConfiguration",e[e.SetInputElement=9]="SetInputElement",e[e.SetButtonElement=10]="SetButtonElement",e[e.SetOptionsElement=11]="SetOptionsElement",e))(sc||{});function fr(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=t(e.options.slice()),r=s.length>0&&s[0].dataRef.current.order!==null?s.sort((o,a)=>o.dataRef.current.order-a.dataRef.current.order):_a(s,o=>o.dataRef.current.domRef.current),i=n?r.indexOf(n):null;return i===-1&&(i=null),{options:r,activeOptionIndex:i}}let im={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,__demoMode:!1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let s=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(s!==-1)return{...e,activeOptionIndex:s,comboboxState:0,__demoMode:!1}}return{...e,comboboxState:0,__demoMode:!1}},3(e,t){return e.isTyping===t.isTyping?e:{...e,isTyping:t.isTyping}},2(e,t){var n,s,r,i;if((n=e.dataRef.current)!=null&&n.disabled||e.optionsElement&&!((s=e.dataRef.current)!=null&&s.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:d,disabled:h}=e.virtual,m=t.focus===te.Specific?t.idx:Yt(t,{resolveItems:()=>d,resolveActiveIndex:()=>{var f,p;return(p=(f=e.activeOptionIndex)!=null?f:d.findIndex(y=>!h(y)))!=null?p:null},resolveDisabled:h,resolveId(){throw new Error("Function not implemented.")}}),u=(r=t.trigger)!=null?r:2;return e.activeOptionIndex===m&&e.activationTrigger===u?e:{...e,activeOptionIndex:m,activationTrigger:u,isTyping:!1,__demoMode:!1}}let o=fr(e);if(o.activeOptionIndex===null){let d=o.options.findIndex(h=>!h.dataRef.current.disabled);d!==-1&&(o.activeOptionIndex=d)}let a=t.focus===te.Specific?t.idx:Yt(t,{resolveItems:()=>o.options,resolveActiveIndex:()=>o.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled}),c=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===a&&e.activationTrigger===c?e:{...e,...o,isTyping:!1,activeOptionIndex:a,activationTrigger:c,__demoMode:!1}},4:(e,t)=>{var n,s,r,i;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,a=fr(e,d=>(d.push(o),d));e.activeOptionIndex===null&&(r=(s=e.dataRef.current).isSelected)!=null&&r.call(s,t.payload.dataRef.current.value)&&(a.activeOptionIndex=a.options.indexOf(o));let c={...e,...a,activationTrigger:2};return(i=e.dataRef.current)!=null&&i.__demoMode&&e.dataRef.current.value===void 0&&(c.activeOptionIndex=0),c},5:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(r=>r.id!==t.id)};let s=fr(e,r=>{let i=r.findIndex(o=>o.id===t.id);return i!==-1&&r.splice(i,1),r});return{...e,...s,activationTrigger:2}},6:(e,t)=>e.defaultToFirstOption===t.value?e:{...e,defaultToFirstOption:t.value},7:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},8:(e,t)=>{var n,s;if(e.virtual===null)return{...e,virtual:{options:t.options,disabled:(n=t.disabled)!=null?n:()=>!1}};if(e.virtual.options===t.options&&e.virtual.disabled===t.disabled)return e;let r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let i=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);i!==-1?r=i:r=null}return{...e,activeOptionIndex:r,virtual:{options:t.options,disabled:(s=t.disabled)!=null?s:()=>!1}}},9:(e,t)=>e.inputElement===t.element?e:{...e,inputElement:t.element},10:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},11:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element}},om=class rc extends $a{constructor(t){super(t),da(this,"actions",{onChange:n=>{let{onChange:s,compare:r,mode:i,value:o}=this.state.dataRef.current;return xe(i,{0:()=>s?.(n),1:()=>{let a=o.slice(),c=a.findIndex(d=>r(d,n));return c===-1?a.push(n):a.splice(c,1),s?.(a)}})},registerOption:(n,s)=>(this.send({type:4,payload:{id:n,dataRef:s}}),()=>{this.state.activeOptionIndex===this.state.dataRef.current.calculateIndex(s.current.value)&&this.send({type:6,value:!0}),this.send({type:5,id:n})}),goToOption:(n,s)=>(this.send({type:6,value:!1}),this.send({type:2,...n,trigger:s})),setIsTyping:n=>{this.send({type:3,isTyping:n})},closeCombobox:()=>{var n,s;this.send({type:1}),this.send({type:6,value:!1}),(s=(n=this.state.dataRef.current).onClose)==null||s.call(n)},openCombobox:()=>{this.send({type:0}),this.send({type:6,value:!0})},setActivationTrigger:n=>{this.send({type:7,trigger:n})},selectActiveOption:()=>{let n=this.selectors.activeOptionIndex(this.state);if(n!==null){if(this.actions.setIsTyping(!1),this.state.virtual)this.actions.onChange(this.state.virtual.options[n]);else{let{dataRef:s}=this.state.options[n];this.actions.onChange(s.current.value)}this.actions.goToOption({focus:te.Specific,idx:n})}},setInputElement:n=>{this.send({type:9,element:n})},setButtonElement:n=>{this.send({type:10,element:n})},setOptionsElement:n=>{this.send({type:11,element:n})}}),da(this,"selectors",{activeDescendantId:n=>{var s,r;let i=this.selectors.activeOptionIndex(n);if(i!==null)return n.virtual?(r=n.options.find(o=>!o.dataRef.current.disabled&&n.dataRef.current.compare(o.dataRef.current.value,n.virtual.options[i])))==null?void 0:r.id:(s=n.options[i])==null?void 0:s.id},activeOptionIndex:n=>{if(n.defaultToFirstOption&&n.activeOptionIndex===null&&(n.virtual?n.virtual.options.length>0:n.options.length>0)){if(n.virtual){let{options:r,disabled:i}=n.virtual,o=r.findIndex(a=>{var c;return!((c=i?.(a))!=null&&c)});if(o!==-1)return o}let s=n.options.findIndex(r=>!r.dataRef.current.disabled);if(s!==-1)return s}return n.activeOptionIndex},activeOption:n=>{var s,r;let i=this.selectors.activeOptionIndex(n);return i===null?null:n.virtual?n.virtual.options[i??0]:(r=(s=n.options[i])==null?void 0:s.dataRef.current.value)!=null?r:null},isActive:(n,s,r)=>{var i;let o=this.selectors.activeOptionIndex(n);return o===null?!1:n.virtual?o===n.dataRef.current.calculateIndex(s):((i=n.options[o])==null?void 0:i.id)===r},shouldScrollIntoView:(n,s,r)=>!(n.virtual||n.__demoMode||n.comboboxState!==0||n.activationTrigger===0||!this.selectors.isActive(n,s,r))});{let n=this.state.id,s=Dn.get(null);this.disposables.add(s.on(Ha.Push,r=>{!s.selectors.isTop(r,n)&&this.state.comboboxState===0&&this.actions.closeCombobox()})),this.on(0,()=>s.actions.push(n)),this.on(1,()=>s.actions.pop(n))}}static new({id:t,virtual:n=null,__demoMode:s=!1}){var r;return new rc({id:t,dataRef:{current:{}},comboboxState:s?0:1,isTyping:!1,options:[],virtual:n?{options:n.options,disabled:(r=n.disabled)!=null?r:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:s})}reduce(t,n){return xe(n.type,im,t,n)}};const ic=l.createContext(null);function _n(e){let t=l.useContext(ic);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,oc),n}return t}function oc({id:e,virtual:t=null,__demoMode:n=!1}){let s=l.useMemo(()=>om.new({id:e,virtual:t,__demoMode:n}),[]);return ci(()=>s.dispose()),s}let Vn=l.createContext(null);Vn.displayName="ComboboxDataContext";function gn(e){let t=l.useContext(Vn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,gn),n}return t}let ac=l.createContext(null);function am(e){let t=_n("VirtualProvider"),n=gn("VirtualProvider"),{options:s}=n.virtual,r=oe(t,f=>f.optionsElement),[i,o]=l.useMemo(()=>{let f=r;if(!f)return[0,0];let p=window.getComputedStyle(f);return[parseFloat(p.paddingBlockStart||p.paddingTop),parseFloat(p.paddingBlockEnd||p.paddingBottom)]},[r]),a=Jp({enabled:s.length!==0,scrollPaddingStart:i,scrollPaddingEnd:o,count:s.length,estimateSize(){return 40},getScrollElement(){return t.state.optionsElement},overscan:12}),[c,d]=l.useState(0);Ce(()=>{d(f=>f+1)},[s]);let h=a.getVirtualItems(),m=oe(t,f=>f.activationTrigger===Je.Pointer),u=oe(t,t.selectors.activeOptionIndex);return h.length===0?null:U.createElement(ac.Provider,{value:a},U.createElement("div",{style:{position:"relative",width:"100%",height:`${a.getTotalSize()}px`},ref:f=>{f&&(m||u!==null&&s.length>u&&a.scrollToIndex(u))}},h.map(f=>{var p;return U.createElement(l.Fragment,{key:f.key},U.cloneElement((p=e.children)==null?void 0:p.call(e,{...e.slot,option:s[f.index]}),{key:`${c}-${f.key}`,"data-index":f.index,"aria-setsize":s.length,"aria-posinset":f.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${f.start}px)`,overflowAnchor:"none"}}))})))}let lm=l.Fragment;function cm(e,t){let n=l.useId(),s=Os(),{value:r,defaultValue:i,onChange:o,form:a,name:c,by:d,invalid:h=!1,disabled:m=s||!1,onClose:u,__demoMode:f=!1,multiple:p=!1,immediate:y=!1,virtual:v=null,nullable:b,...x}=e,E=Vi(i),[S=p?[]:void 0,C]=Pi(r,o,E),k=oc({id:n,virtual:v,__demoMode:f}),V=l.useRef({static:!1,hold:!1}),A=tc(d),T=K(D=>v?d===null?v.options.indexOf(D):v.options.findIndex(B=>A(B,D)):k.state.options.findIndex(B=>A(B.dataRef.current.value,D))),M=l.useCallback(D=>xe(w.mode,{[Pe.Multi]:()=>S.some(B=>A(B,D)),[Pe.Single]:()=>A(S,D)}),[S]),F=oe(k,D=>D.virtual),I=K(()=>u?.()),w=l.useMemo(()=>({__demoMode:f,immediate:y,optionsPropsRef:V,value:S,defaultValue:E,disabled:m,invalid:h,mode:p?Pe.Multi:Pe.Single,virtual:v?F:null,onChange:C,isSelected:M,calculateIndex:T,compare:A,onClose:I}),[S,E,m,h,p,C,M,f,k,v,F,I]);Ce(()=>{var D;v&&k.send({type:sc.UpdateVirtualConfiguration,options:v.options,disabled:(D=v.disabled)!=null?D:null})},[v,v?.options,v?.disabled]),Ce(()=>{k.state.dataRef.current=w},[w]);let[P,L,$,O]=oe(k,D=>[D.comboboxState,D.buttonElement,D.inputElement,D.optionsElement]),R=Dn.get(null),H=oe(R,l.useCallback(D=>R.selectors.isTop(D,n),[R,n]));gi(H,[L,$,O],()=>k.actions.closeCombobox());let Z=oe(k,k.selectors.activeOptionIndex),W=oe(k,k.selectors.activeOption),z=l.useMemo(()=>({open:P===ne.Open,disabled:m,invalid:h,activeIndex:Z,activeOption:W,value:S}),[w,m,S,h,W,P]),[_,q]=Wa(),X=t===null?{}:{ref:t},j=l.useCallback(()=>{if(E!==void 0)return C?.(E)},[C,E]),N=pe();return U.createElement(q,{value:_,props:{htmlFor:$?.id},slot:{open:P===ne.Open,disabled:m}},U.createElement(Qa,null,U.createElement(Vn.Provider,{value:w},U.createElement(ic.Provider,{value:k},U.createElement(js,{value:xe(P,{[ne.Open]:ve.Open,[ne.Closed]:ve.Closed})},c!=null&&U.createElement(Ni,{disabled:m,data:S!=null?{[c]:S}:{},form:a,onReset:j}),N({ourProps:X,theirProps:x,slot:z,defaultTag:lm,name:"Combobox"}))))))}let um="input";function dm(e,t){var n,s;let r=_n("Combobox.Input"),i=gn("Combobox.Input"),o=l.useId(),a=Rs(),{id:c=a||`headlessui-combobox-input-${o}`,onChange:d,displayValue:h,disabled:m=i.disabled||!1,autoFocus:u=!1,type:f="text",...p}=e,[y]=oe(r,q=>[q.inputElement]),v=l.useRef(null),b=ke(v,t,Ba(),r.actions.setInputElement),x=xt(y),[E,S]=oe(r,q=>[q.comboboxState,q.isTyping]),C=fn(),k=K(()=>{r.actions.onChange(null),r.state.optionsElement&&(r.state.optionsElement.scrollTop=0),r.actions.goToOption({focus:te.Nothing})}),V=l.useMemo(()=>{var q;return typeof h=="function"&&i.value!==void 0?(q=h(i.value))!=null?q:"":typeof i.value=="string"?i.value:""},[i.value,h]);Pn(([q,X],[j,N])=>{if(r.state.isTyping)return;let D=v.current;D&&((N===ne.Open&&X===ne.Closed||q!==j)&&(D.value=q),requestAnimationFrame(()=>{if(r.state.isTyping||!D||x?.activeElement!==D)return;let{selectionStart:B,selectionEnd:G}=D;Math.abs((G??0)-(B??0))===0&&B===0&&D.setSelectionRange(D.value.length,D.value.length)}))},[V,E,x,S]),Pn(([q],[X])=>{if(q===ne.Open&&X===ne.Closed){if(r.state.isTyping)return;let j=v.current;if(!j)return;let N=j.value,{selectionStart:D,selectionEnd:B,selectionDirection:G}=j;j.value="",j.value=N,G!==null?j.setSelectionRange(D,B,G):j.setSelectionRange(D,B)}},[E]);let A=l.useRef(!1),T=K(()=>{A.current=!0}),M=K(()=>{C.nextFrame(()=>{A.current=!1})}),F=K(q=>{switch(r.actions.setIsTyping(!0),q.key){case ee.Enter:if(r.state.comboboxState!==ne.Open||A.current)return;if(q.preventDefault(),q.stopPropagation(),r.selectors.activeOptionIndex(r.state)===null){r.actions.closeCombobox();return}r.actions.selectActiveOption(),i.mode===Pe.Single&&r.actions.closeCombobox();break;case ee.ArrowDown:return q.preventDefault(),q.stopPropagation(),xe(r.state.comboboxState,{[ne.Open]:()=>r.actions.goToOption({focus:te.Next}),[ne.Closed]:()=>r.actions.openCombobox()});case ee.ArrowUp:return q.preventDefault(),q.stopPropagation(),xe(r.state.comboboxState,{[ne.Open]:()=>r.actions.goToOption({focus:te.Previous}),[ne.Closed]:()=>{Me.flushSync(()=>r.actions.openCombobox()),i.value||r.actions.goToOption({focus:te.Last})}});case ee.Home:if(q.shiftKey)break;return q.preventDefault(),q.stopPropagation(),r.actions.goToOption({focus:te.First});case ee.PageUp:return q.preventDefault(),q.stopPropagation(),r.actions.goToOption({focus:te.First});case ee.End:if(q.shiftKey)break;return q.preventDefault(),q.stopPropagation(),r.actions.goToOption({focus:te.Last});case ee.PageDown:return q.preventDefault(),q.stopPropagation(),r.actions.goToOption({focus:te.Last});case ee.Escape:return r.state.comboboxState!==ne.Open?void 0:(q.preventDefault(),r.state.optionsElement&&!i.optionsPropsRef.current.static&&q.stopPropagation(),i.mode===Pe.Single&&i.value===null&&k(),r.actions.closeCombobox());case ee.Tab:if(r.state.comboboxState!==ne.Open)return;i.mode===Pe.Single&&r.state.activationTrigger!==Je.Focus&&r.actions.selectActiveOption(),r.actions.closeCombobox();break}}),I=K(q=>{d?.(q),i.mode===Pe.Single&&q.target.value===""&&k(),r.actions.openCombobox()}),w=K(q=>{var X,j,N;let D=(X=q.relatedTarget)!=null?X:Qe.find(B=>B!==q.currentTarget);if(!((j=r.state.optionsElement)!=null&&j.contains(D))&&!((N=r.state.buttonElement)!=null&&N.contains(D))&&r.state.comboboxState===ne.Open)return q.preventDefault(),i.mode===Pe.Single&&i.value===null&&k(),r.actions.closeCombobox()}),P=K(q=>{var X,j,N;let D=(X=q.relatedTarget)!=null?X:Qe.find(B=>B!==q.currentTarget);(j=r.state.buttonElement)!=null&&j.contains(D)||(N=r.state.optionsElement)!=null&&N.contains(D)||i.disabled||i.immediate&&r.state.comboboxState!==ne.Open&&C.microTask(()=>{Me.flushSync(()=>r.actions.openCombobox()),r.actions.setActivationTrigger(Je.Focus)})}),L=hn(),$=Fs(),{isFocused:O,focusProps:R}=pn({autoFocus:u}),{isHovered:H,hoverProps:Z}=mn({isDisabled:m}),W=oe(r,q=>q.optionsElement),z=l.useMemo(()=>({open:E===ne.Open,disabled:m,invalid:i.invalid,hover:H,focus:O,autofocus:u}),[i,H,O,u,m,i.invalid]),_=dt({ref:b,id:c,role:"combobox",type:f,"aria-controls":W?.id,"aria-expanded":E===ne.Open,"aria-activedescendant":oe(r,r.selectors.activeDescendantId),"aria-labelledby":L,"aria-describedby":$,"aria-autocomplete":"list",defaultValue:(s=(n=e.defaultValue)!=null?n:i.defaultValue!==void 0?h?.(i.defaultValue):null)!=null?s:i.defaultValue,disabled:m||void 0,autoFocus:u,onCompositionStart:T,onCompositionEnd:M,onKeyDown:F,onChange:I,onFocus:P,onBlur:w},R,Z);return pe()({ourProps:_,theirProps:p,slot:z,defaultTag:um,name:"Combobox.Input"})}let fm="button";function hm(e,t){let n=_n("Combobox.Button"),s=gn("Combobox.Button"),[r,i]=l.useState(null),o=ke(t,i,n.actions.setButtonElement),a=l.useId(),{id:c=`headlessui-combobox-button-${a}`,disabled:d=s.disabled||!1,autoFocus:h=!1,...m}=e,[u,f,p]=oe(n,I=>[I.comboboxState,I.inputElement,I.optionsElement]),y=nc(f),v=u===ne.Open;qa(v,{trigger:r,action:l.useCallback(I=>{if(r!=null&&r.contains(I.target))return it.Ignore;if(f!=null&&f.contains(I.target))return it.Ignore;let w=I.target.closest('[role="option"]:not([data-disabled])');return ln(w)?it.Select(w):p!=null&&p.contains(I.target)?it.Ignore:it.Close},[r,f,p]),close:n.actions.closeCombobox,select:n.actions.selectActiveOption});let b=K(I=>{switch(I.key){case ee.Space:case ee.Enter:I.preventDefault(),I.stopPropagation(),n.state.comboboxState===ne.Closed&&Me.flushSync(()=>n.actions.openCombobox()),y();return;case ee.ArrowDown:I.preventDefault(),I.stopPropagation(),n.state.comboboxState===ne.Closed&&(Me.flushSync(()=>n.actions.openCombobox()),n.state.dataRef.current.value||n.actions.goToOption({focus:te.First})),y();return;case ee.ArrowUp:I.preventDefault(),I.stopPropagation(),n.state.comboboxState===ne.Closed&&(Me.flushSync(()=>n.actions.openCombobox()),n.state.dataRef.current.value||n.actions.goToOption({focus:te.Last})),y();return;case ee.Escape:if(n.state.comboboxState!==ne.Open)return;I.preventDefault(),n.state.optionsElement&&!s.optionsPropsRef.current.static&&I.stopPropagation(),Me.flushSync(()=>n.actions.closeCombobox()),y();return;default:return}}),x=K(I=>{I.preventDefault(),!Is(I.currentTarget)&&(I.button===ui.Left&&(n.state.comboboxState===ne.Open?n.actions.closeCombobox():n.actions.openCombobox()),y())}),E=hn([c]),{isFocusVisible:S,focusProps:C}=pn({autoFocus:h}),{isHovered:k,hoverProps:V}=mn({isDisabled:d}),{pressed:A,pressProps:T}=As({disabled:d}),M=l.useMemo(()=>({open:u===ne.Open,active:A||u===ne.Open,disabled:d,invalid:s.invalid,value:s.value,hover:k,focus:S}),[s,k,S,A,d,u]),F=dt({ref:o,id:c,type:di(e,r),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":p?.id,"aria-expanded":u===ne.Open,"aria-labelledby":E,disabled:d||void 0,autoFocus:h,onPointerDown:x,onKeyDown:b},C,V,T);return pe()({ourProps:F,theirProps:m,slot:M,defaultTag:fm,name:"Combobox.Button"})}let pm="div",mm=ft.RenderStrategy|ft.Static;function gm(e,t){var n,s,r;let i=l.useId(),{id:o=`headlessui-combobox-options-${i}`,hold:a=!1,anchor:c,portal:d=!1,modal:h=!0,transition:m=!1,...u}=e,f=_n("Combobox.Options"),p=gn("Combobox.Options"),y=Za(c);y&&(d=!0);let[v,b]=Ua(y),[x,E]=l.useState(null),S=za(),C=ke(t,y?v:null,f.actions.setOptionsElement,E),[k,V,A,T,M]=oe(f,G=>[G.comboboxState,G.inputElement,G.buttonElement,G.optionsElement,G.activationTrigger]),F=xt(V||A),I=xt(T),w=_t(),[P,L]=Vs(m,x,w!==null?(w&ve.Open)===ve.Open:k===ne.Open);fi(P,V,f.actions.closeCombobox);let $=p.__demoMode?!1:h&&k===ne.Open;hi($,I);let O=p.__demoMode?!1:h&&k===ne.Open;pi(O,{allowed:l.useCallback(()=>[V,A,T],[V,A,T])}),Ce(()=>{var G;p.optionsPropsRef.current.static=(G=e.static)!=null?G:!1},[p.optionsPropsRef,e.static]),Ce(()=>{p.optionsPropsRef.current.hold=a},[p.optionsPropsRef,a]),Hu(k===ne.Open,{container:T,accept(G){return G.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:G.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(G){G.setAttribute("role","none")}});let R=hn([A?.id]),H=l.useMemo(()=>({open:k===ne.Open,option:void 0}),[k]),Z=K(()=>{f.actions.setActivationTrigger(Je.Pointer)}),W=K(G=>{G.preventDefault(),f.actions.setActivationTrigger(Je.Pointer)}),z=dt(y?S():{},{"aria-labelledby":R,role:"listbox","aria-multiselectable":p.mode===Pe.Multi?!0:void 0,id:o,ref:C,style:{...u.style,...b,"--input-width":Sr(V,!0).width,"--button-width":Sr(A,!0).width},onWheel:M===Je.Pointer?void 0:Z,onMouseDown:W,...Ns(L)}),_=P&&k===ne.Closed,q=ws(_,(n=p.virtual)==null?void 0:n.options),X=ws(_,p.value),j=K(G=>p.compare(X,G)),N=l.useMemo(()=>{if(!p.virtual)return p;if(q===void 0)throw new Error("Missing `options` in virtual mode");return q!==p.virtual.options?{...p,virtual:{...p.virtual,options:q}}:p},[p,q,(s=p.virtual)==null?void 0:s.options]);p.virtual&&Object.assign(u,{children:U.createElement(Vn.Provider,{value:N},U.createElement(am,{slot:H},u.children))});let D=pe(),B=l.useMemo(()=>p.mode===Pe.Multi?p:{...p,isSelected:j},[p,j]);return U.createElement(mi,{enabled:d?e.static||P:!1,ownerDocument:F},U.createElement(Vn.Provider,{value:B},D({ourProps:z,theirProps:{...u,children:U.createElement(tm,{freeze:_},typeof u.children=="function"?(r=u.children)==null?void 0:r.call(u,H):u.children)},slot:H,defaultTag:pm,features:mm,visible:P,name:"Combobox.Options"})))}let ym="div";function vm(e,t){var n,s,r;let i=gn("Combobox.Option"),o=_n("Combobox.Option"),a=l.useId(),{id:c=`headlessui-combobox-option-${a}`,value:d,disabled:h=(r=(s=(n=i.virtual)==null?void 0:n.disabled)==null?void 0:s.call(n,d))!=null?r:!1,order:m=null,...u}=e,[f]=oe(o,L=>[L.inputElement]),p=nc(f),y=oe(o,l.useCallback(L=>o.selectors.isActive(L,d,c),[d,c])),v=i.isSelected(d),b=l.useRef(null),x=Ps({disabled:h,value:d,domRef:b,order:m}),E=l.useContext(ac),S=ke(t,b,E?E.measureElement:null),C=K(()=>{o.actions.setIsTyping(!1),o.actions.onChange(d)});Ce(()=>o.actions.registerOption(c,x),[x,c]);let k=oe(o,l.useCallback(L=>o.selectors.shouldScrollIntoView(L,d,c),[d,c]));Ce(()=>{if(k)return Ga().requestAnimationFrame(()=>{var L,$;($=(L=b.current)==null?void 0:L.scrollIntoView)==null||$.call(L,{block:"nearest"})})},[k,b]);let V=K(L=>{L.preventDefault(),L.button===ui.Left&&(h||(C(),_u()||requestAnimationFrame(()=>p()),i.mode===Pe.Single&&o.actions.closeCombobox()))}),A=K(()=>{if(h)return o.actions.goToOption({focus:te.Nothing});let L=i.calculateIndex(d);o.actions.goToOption({focus:te.Specific,idx:L})}),T=Ka(),M=K(L=>T.update(L)),F=K(L=>{if(!T.wasMoved(L)||h||y&&o.state.activationTrigger===Je.Pointer)return;let $=i.calculateIndex(d);o.actions.goToOption({focus:te.Specific,idx:$},Je.Pointer)}),I=K(L=>{T.wasMoved(L)&&(h||y&&(i.optionsPropsRef.current.hold||o.state.activationTrigger===Je.Pointer&&o.actions.goToOption({focus:te.Nothing})))}),w=l.useMemo(()=>({active:y,focus:y,selected:v,disabled:h}),[y,v,h]),P={id:c,ref:S,role:"option",tabIndex:h===!0?void 0:-1,"aria-disabled":h===!0?!0:void 0,"aria-selected":v,disabled:void 0,onMouseDown:V,onFocus:A,onPointerEnter:M,onMouseEnter:M,onPointerMove:F,onMouseMove:F,onPointerLeave:I,onMouseLeave:I};return pe()({ourProps:P,theirProps:u,slot:w,defaultTag:ym,name:"Combobox.Option"})}let bm=le(cm),Li=le(hm),Di=le(dm),xm=$n,$i=le(gm),Nn=le(vm),lc=Object.assign(bm,{Input:Di,Button:Li,Label:xm,Options:$i,Option:Nn});function wm(e,t=typeof document<"u"?document.defaultView:null,n){let s=yi(e,"escape");ji(t,"keydown",r=>{s&&(r.defaultPrevented||r.key===ee.Escape&&n(r))})}function Em(){var e;let[t]=l.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[n,s]=l.useState((e=t?.matches)!=null?e:!1);return Ce(()=>{if(!t)return;function r(i){s(i.matches)}return t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[t]),n}function Sm({defaultContainers:e=[],portals:t,mainTreeNode:n}={}){let s=xt(n),r=K(()=>{var i,o;let a=[];for(let c of e)c!==null&&(Cn(c)?a.push(c):"current"in c&&Cn(c.current)&&a.push(c.current));if(t!=null&&t.current)for(let c of t.current)a.push(c);for(let c of(i=s?.querySelectorAll("html > *, body > *"))!=null?i:[])c!==document.body&&c!==document.head&&Cn(c)&&c.id!=="headlessui-portal-root"&&(n&&(c.contains(n)||c.contains((o=n?.getRootNode())==null?void 0:o.host))||a.some(d=>c.contains(d))||a.push(c));return a});return{resolveContainers:r,contains:K(i=>r().some(o=>o.contains(i)))}}let cc=l.createContext(null);function fa({children:e,node:t}){let[n,s]=l.useState(null),r=uc(t??n);return U.createElement(cc.Provider,{value:r},e,r===null&&U.createElement(An,{features:dn.Hidden,ref:i=>{var o,a;if(i){for(let c of(a=(o=vi(i))==null?void 0:o.querySelectorAll("html > *, body > *"))!=null?a:[])if(c!==document.body&&c!==document.head&&Cn(c)&&c!=null&&c.contains(i)){s(c);break}}}}))}function uc(e=null){var t;return(t=l.useContext(cc))!=null?t:e}function Hi(){let e=l.useRef(!1);return Ce(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var En=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(En||{});function Cm(){let e=l.useRef(0);return Bu(!0,"keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}function dc(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let t=new Set;for(let n of e.current)Cn(n.current)&&t.add(n.current);return t}let km="div";var Ft=(e=>(e[e.None=0]="None",e[e.InitialFocus=1]="InitialFocus",e[e.TabLock=2]="TabLock",e[e.FocusLock=4]="FocusLock",e[e.RestoreFocus=8]="RestoreFocus",e[e.AutoFocus=16]="AutoFocus",e))(Ft||{});function Tm(e,t){let n=l.useRef(null),s=ke(n,t),{initialFocus:r,initialFocusFallback:i,containers:o,features:a=15,...c}=e;Ls()||(a=0);let d=xt(n);Fm(a,{ownerDocument:d});let h=Im(a,{ownerDocument:d,container:n,initialFocus:r,initialFocusFallback:i});Am(a,{ownerDocument:d,container:n,containers:o,previousActiveElement:h});let m=Cm(),u=K(x=>{if(!ln(n.current))return;let E=n.current;(S=>S())(()=>{xe(m.current,{[En.Forwards]:()=>{kn(E,We.First,{skipElements:[x.relatedTarget,i]})},[En.Backwards]:()=>{kn(E,We.Last,{skipElements:[x.relatedTarget,i]})}})})}),f=yi(!!(a&2),"focus-trap#tab-lock"),p=fn(),y=l.useRef(!1),v={ref:s,onKeyDown(x){x.key=="Tab"&&(y.current=!0,p.requestAnimationFrame(()=>{y.current=!1}))},onBlur(x){if(!(a&4))return;let E=dc(o);ln(n.current)&&E.add(n.current);let S=x.relatedTarget;Rn(S)&&S.dataset.headlessuiFocusGuard!=="true"&&(fc(E,S)||(y.current?kn(n.current,xe(m.current,{[En.Forwards]:()=>We.Next,[En.Backwards]:()=>We.Previous})|We.WrapAround,{relativeTo:x.target}):Rn(x.target)&&ct(x.target)))}},b=pe();return U.createElement(U.Fragment,null,f&&U.createElement(An,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:u,features:dn.Focusable}),b({ourProps:v,theirProps:c,defaultTag:km,name:"FocusTrap"}),f&&U.createElement(An,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:u,features:dn.Focusable}))}let Mm=le(Tm),Rm=Object.assign(Mm,{features:Ft});function Om(e=!0){let t=l.useRef(Qe.slice());return Pn(([n],[s])=>{s===!0&&n===!1&&Ya(()=>{t.current.splice(0)}),s===!1&&n===!0&&(t.current=Qe.slice())},[e,Qe,t]),K(()=>{var n;return(n=t.current.find(s=>s!=null&&s.isConnected))!=null?n:null})}function Fm(e,{ownerDocument:t}){let n=!!(e&8),s=Om(n);Pn(()=>{n||t?.activeElement===t?.body&&ct(s())},[n]),ci(()=>{n&&ct(s())})}function Im(e,{ownerDocument:t,container:n,initialFocus:s,initialFocusFallback:r}){let i=l.useRef(null),o=yi(!!(e&1),"focus-trap#initial-focus"),a=Hi();return Pn(()=>{if(e===0)return;if(!o){r!=null&&r.current&&ct(r.current);return}let c=n.current;c&&Ya(()=>{if(!a.current)return;let d=t?.activeElement;if(s!=null&&s.current){if(s?.current===d){i.current=d;return}}else if(c.contains(d)){i.current=d;return}if(s!=null&&s.current)ct(s.current);else{if(e&16){if(kn(c,We.First|We.AutoFocus)!==Co.Error)return}else if(kn(c,We.First)!==Co.Error)return;if(r!=null&&r.current&&(ct(r.current),t?.activeElement===r.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}i.current=t?.activeElement})},[r,o,e]),i}function Am(e,{ownerDocument:t,container:n,containers:s,previousActiveElement:r}){let i=Hi(),o=!!(e&4);ji(t?.defaultView,"focus",a=>{if(!o||!i.current)return;let c=dc(s);ln(n.current)&&c.add(n.current);let d=r.current;if(!d)return;let h=a.target;ln(h)?fc(c,h)?(r.current=h,ct(h)):(a.preventDefault(),a.stopPropagation(),ct(d)):ct(r.current)},!0)}function fc(e,t){for(let n of e)if(n.contains(t))return!0;return!1}function hc(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:mc)!==l.Fragment||U.Children.count(e.children)===1}let Hs=l.createContext(null);Hs.displayName="TransitionContext";var Pm=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Pm||{});function Vm(){let e=l.useContext(Hs);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Nm(){let e=l.useContext(_s);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let _s=l.createContext(null);_s.displayName="NestingContext";function Bs(e){return"children"in e?Bs(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function pc(e,t){let n=Ps(e),s=l.useRef([]),r=Hi(),i=fn(),o=K((f,p=Vt.Hidden)=>{let y=s.current.findIndex(({el:v})=>v===f);y!==-1&&(xe(p,{[Vt.Unmount](){s.current.splice(y,1)},[Vt.Hidden](){s.current[y].state="hidden"}}),i.microTask(()=>{var v;!Bs(s)&&r.current&&((v=n.current)==null||v.call(n))}))}),a=K(f=>{let p=s.current.find(({el:y})=>y===f);return p?p.state!=="visible"&&(p.state="visible"):s.current.push({el:f,state:"visible"}),()=>o(f,Vt.Unmount)}),c=l.useRef([]),d=l.useRef(Promise.resolve()),h=l.useRef({enter:[],leave:[]}),m=K((f,p,y)=>{c.current.splice(0),t&&(t.chains.current[p]=t.chains.current[p].filter(([v])=>v!==f)),t?.chains.current[p].push([f,new Promise(v=>{c.current.push(v)})]),t?.chains.current[p].push([f,new Promise(v=>{Promise.all(h.current[p].map(([b,x])=>x)).then(()=>v())})]),p==="enter"?d.current=d.current.then(()=>t?.wait.current).then(()=>y(p)):y(p)}),u=K((f,p,y)=>{Promise.all(h.current[p].splice(0).map(([v,b])=>b)).then(()=>{var v;(v=c.current.shift())==null||v()}).then(()=>y(p))});return l.useMemo(()=>({children:s,register:a,unregister:o,onStart:m,onStop:u,wait:d,chains:h}),[a,o,s,m,u,h,d])}let mc=l.Fragment,gc=ft.RenderStrategy;function jm(e,t){var n,s;let{transition:r=!0,beforeEnter:i,afterEnter:o,beforeLeave:a,afterLeave:c,enter:d,enterFrom:h,enterTo:m,entered:u,leave:f,leaveFrom:p,leaveTo:y,...v}=e,[b,x]=l.useState(null),E=l.useRef(null),S=hc(e),C=ke(...S?[E,t,x]:t===null?[]:[t]),k=(n=v.unmount)==null||n?Vt.Unmount:Vt.Hidden,{show:V,appear:A,initial:T}=Vm(),[M,F]=l.useState(V?"visible":"hidden"),I=Nm(),{register:w,unregister:P}=I;Ce(()=>w(E),[w,E]),Ce(()=>{if(k===Vt.Hidden&&E.current){if(V&&M!=="visible"){F("visible");return}return xe(M,{hidden:()=>P(E),visible:()=>w(E)})}},[M,E,w,P,V,k]);let L=Ls();Ce(()=>{if(S&&L&&M==="visible"&&E.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[E,M,L,S]);let $=T&&!A,O=A&&V&&T,R=l.useRef(!1),H=pc(()=>{R.current||(F("hidden"),P(E))},I),Z=K(N=>{R.current=!0;let D=N?"enter":"leave";H.onStart(E,D,B=>{B==="enter"?i?.():B==="leave"&&a?.()})}),W=K(N=>{let D=N?"enter":"leave";R.current=!1,H.onStop(E,D,B=>{B==="enter"?o?.():B==="leave"&&c?.()}),D==="leave"&&!Bs(H)&&(F("hidden"),P(E))});l.useEffect(()=>{S&&r||(Z(V),W(V))},[V,S,r]);let z=!(!r||!S||!L||$),[,_]=Vs(z,b,V,{start:Z,end:W}),q=Da({ref:C,className:((s=qu(v.className,O&&d,O&&h,_.enter&&d,_.enter&&_.closed&&h,_.enter&&!_.closed&&m,_.leave&&f,_.leave&&!_.closed&&p,_.leave&&_.closed&&y,!_.transition&&V&&u))==null?void 0:s.trim())||void 0,...Ns(_)}),X=0;M==="visible"&&(X|=ve.Open),M==="hidden"&&(X|=ve.Closed),V&&M==="hidden"&&(X|=ve.Opening),!V&&M==="visible"&&(X|=ve.Closing);let j=pe();return U.createElement(_s.Provider,{value:H},U.createElement(js,{value:X},j({ourProps:q,theirProps:v,defaultTag:mc,features:gc,visible:M==="visible",name:"Transition.Child"})))}function Lm(e,t){let{show:n,appear:s=!1,unmount:r=!0,...i}=e,o=l.useRef(null),a=hc(e),c=ke(...a?[o,t]:t===null?[]:[t]);Ls();let d=_t();if(n===void 0&&d!==null&&(n=(d&ve.Open)===ve.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[h,m]=l.useState(n?"visible":"hidden"),u=pc(()=>{n||m("hidden")}),[f,p]=l.useState(!0),y=l.useRef([n]);Ce(()=>{f!==!1&&y.current[y.current.length-1]!==n&&(y.current.push(n),p(!1))},[y,n]);let v=l.useMemo(()=>({show:n,appear:s,initial:f}),[n,s,f]);Ce(()=>{n?m("visible"):!Bs(u)&&o.current!==null&&m("hidden")},[n,u]);let b={unmount:r},x=K(()=>{var C;f&&p(!1),(C=e.beforeEnter)==null||C.call(e)}),E=K(()=>{var C;f&&p(!1),(C=e.beforeLeave)==null||C.call(e)}),S=pe();return U.createElement(_s.Provider,{value:u},U.createElement(Hs.Provider,{value:v},S({ourProps:{...b,as:l.Fragment,children:U.createElement(yc,{ref:c,...b,...i,beforeEnter:x,beforeLeave:E})},theirProps:{},defaultTag:l.Fragment,features:gc,visible:h==="visible",name:"Transition"})))}function Dm(e,t){let n=l.useContext(Hs)!==null,s=_t()!==null;return U.createElement(U.Fragment,null,!n&&s?U.createElement(_r,{ref:t,...e}):U.createElement(yc,{ref:t,...e}))}let _r=le(Lm),yc=le(jm),_i=le(Dm),$m=Object.assign(_r,{Child:_i,Root:_r});var Hm=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Hm||{}),_m=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(_m||{});let Bm={0(e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},Bi=l.createContext(null);Bi.displayName="DialogContext";function qs(e){let t=l.useContext(Bi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,qs),n}return t}function qm(e,t){return xe(t.type,Bm,e,t)}let ha=le(function(e,t){let n=l.useId(),{id:s=`headlessui-dialog-${n}`,open:r,onClose:i,initialFocus:o,role:a="dialog",autoFocus:c=!0,__demoMode:d=!1,unmount:h=!1,...m}=e,u=l.useRef(!1);a=function(){return a==="dialog"||a==="alertdialog"?a:(u.current||(u.current=!0,console.warn(`Invalid role [${a}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")}();let f=_t();r===void 0&&f!==null&&(r=(f&ve.Open)===ve.Open);let p=l.useRef(null),y=ke(p,t),v=xt(p),b=r?0:1,[x,E]=l.useReducer(qm,{titleId:null,descriptionId:null,panelRef:l.createRef()}),S=K(()=>i(!1)),C=K(_=>E({type:0,id:_})),k=Ls()?b===0:!1,[V,A]=Uu(),T={get current(){var _;return(_=x.panelRef.current)!=null?_:p.current}},M=uc(),{resolveContainers:F}=Sm({mainTreeNode:M,portals:V,defaultContainers:[T]}),I=f!==null?(f&ve.Closing)===ve.Closing:!1;pi(d||I?!1:k,{allowed:K(()=>{var _,q;return[(q=(_=p.current)==null?void 0:_.closest("[data-headlessui-portal]"))!=null?q:null]}),disallowed:K(()=>{var _;return[(_=M?.closest("body > *:not(#headlessui-portal-root)"))!=null?_:null]})});let w=Dn.get(null);Ce(()=>{if(k)return w.actions.push(s),()=>w.actions.pop(s)},[w,s,k]);let P=oe(w,l.useCallback(_=>w.selectors.isTop(_,s),[w,s]));gi(P,F,_=>{_.preventDefault(),S()}),wm(P,v?.defaultView,_=>{_.preventDefault(),_.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),S()}),hi(d||I?!1:k,v,F),fi(k,p,S);let[L,$]=zu(),O=l.useMemo(()=>[{dialogState:b,close:S,setTitleId:C,unmount:h},x],[b,x,S,C,h]),R=l.useMemo(()=>({open:b===0}),[b]),H={ref:y,id:s,role:a,tabIndex:-1,"aria-modal":d?void 0:b===0?!0:void 0,"aria-labelledby":x.titleId,"aria-describedby":L,unmount:h},Z=!Em(),W=Ft.None;k&&!d&&(W|=Ft.RestoreFocus,W|=Ft.TabLock,c&&(W|=Ft.AutoFocus),Z&&(W|=Ft.InitialFocus));let z=pe();return U.createElement(Xa,null,U.createElement(ko,{force:!0},U.createElement(mi,null,U.createElement(Bi.Provider,{value:O},U.createElement(Gu,{target:p},U.createElement(ko,{force:!1},U.createElement($,{slot:R},U.createElement(A,null,U.createElement(Rm,{initialFocus:o,initialFocusFallback:p,containers:F,features:W},U.createElement(Jl,{value:S},z({ourProps:H,theirProps:m,slot:R,defaultTag:Zm,features:Um,visible:b===0,name:"Dialog"})))))))))))}),Zm="div",Um=ft.RenderStrategy|ft.Static;function zm(e,t){let{transition:n=!1,open:s,...r}=e,i=_t(),o=e.hasOwnProperty("open")||i!==null,a=e.hasOwnProperty("onClose");if(!o&&!a)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!o)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!a)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(!i&&typeof e.open!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${e.open}`);if(typeof e.onClose!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${e.onClose}`);return(s!==void 0||n)&&!r.static?U.createElement(fa,null,U.createElement($m,{show:s,transition:n,unmount:r.unmount},U.createElement(ha,{ref:t,...r}))):U.createElement(fa,null,U.createElement(ha,{ref:t,open:s,...r}))}let Gm="div";function Km(e,t){let n=l.useId(),{id:s=`headlessui-dialog-panel-${n}`,transition:r=!1,...i}=e,[{dialogState:o,unmount:a},c]=qs("Dialog.Panel"),d=ke(t,c.panelRef),h=l.useMemo(()=>({open:o===0}),[o]),m=K(v=>{v.stopPropagation()}),u={ref:d,id:s,onClick:m},f=r?_i:l.Fragment,p=r?{unmount:a}:{},y=pe();return U.createElement(f,{...p},y({ourProps:u,theirProps:i,slot:h,defaultTag:Gm,name:"Dialog.Panel"}))}let Wm="div";function Qm(e,t){let{transition:n=!1,...s}=e,[{dialogState:r,unmount:i}]=qs("Dialog.Backdrop"),o=l.useMemo(()=>({open:r===0}),[r]),a={ref:t,"aria-hidden":!0},c=n?_i:l.Fragment,d=n?{unmount:i}:{},h=pe();return U.createElement(c,{...d},h({ourProps:a,theirProps:s,slot:o,defaultTag:Wm,name:"Dialog.Backdrop"}))}let Ym="h2";function Xm(e,t){let n=l.useId(),{id:s=`headlessui-dialog-title-${n}`,...r}=e,[{dialogState:i,setTitleId:o}]=qs("Dialog.Title"),a=ke(t);l.useEffect(()=>(o(s),()=>o(null)),[s,o]);let c=l.useMemo(()=>({open:i===0}),[i]),d={ref:a,id:s};return pe()({ourProps:d,theirProps:r,slot:c,defaultTag:Ym,name:"Dialog.Title"})}let Jm=le(zm),vc=le(Km),e0=le(Qm),bc=le(Xm),t0=Object.assign(Jm,{Panel:vc,Title:bc,Description:Zu});var pa;let n0=(pa=U.startTransition)!=null?pa:function(e){e()};var s0=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(s0||{}),r0=(e=>(e[e.ToggleDisclosure=0]="ToggleDisclosure",e[e.CloseDisclosure=1]="CloseDisclosure",e[e.SetButtonId=2]="SetButtonId",e[e.SetPanelId=3]="SetPanelId",e[e.SetButtonElement=4]="SetButtonElement",e[e.SetPanelElement=5]="SetPanelElement",e))(r0||{});let i0={0:e=>({...e,disclosureState:xe(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},2(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},3(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}},4(e,t){return e.buttonElement===t.element?e:{...e,buttonElement:t.element}},5(e,t){return e.panelElement===t.element?e:{...e,panelElement:t.element}}},qi=l.createContext(null);qi.displayName="DisclosureContext";function Zi(e){let t=l.useContext(qi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Zi),n}return t}let Ui=l.createContext(null);Ui.displayName="DisclosureAPIContext";function xc(e){let t=l.useContext(Ui);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,xc),n}return t}let zi=l.createContext(null);zi.displayName="DisclosurePanelContext";function o0(){return l.useContext(zi)}function a0(e,t){return xe(t.type,i0,e,t)}let l0=l.Fragment;function c0(e,t){let{defaultOpen:n=!1,...s}=e,r=l.useRef(null),i=ke(t,Ku(y=>{r.current=y},e.as===void 0||e.as===l.Fragment)),o=l.useReducer(a0,{disclosureState:n?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:a,buttonId:c},d]=o,h=K(y=>{d({type:1});let v=vi(r);if(!v||!c)return;let b=y?Rn(y)?y:"current"in y&&Rn(y.current)?y.current:v.getElementById(c):v.getElementById(c);b?.focus()}),m=l.useMemo(()=>({close:h}),[h]),u=l.useMemo(()=>({open:a===0,close:h}),[a,h]),f={ref:i},p=pe();return U.createElement(qi.Provider,{value:o},U.createElement(Ui.Provider,{value:m},U.createElement(Jl,{value:h},U.createElement(js,{value:xe(a,{0:ve.Open,1:ve.Closed})},p({ourProps:f,theirProps:s,slot:u,defaultTag:l0,name:"Disclosure"})))))}let u0="button";function d0(e,t){let n=l.useId(),{id:s=`headlessui-disclosure-button-${n}`,disabled:r=!1,autoFocus:i=!1,...o}=e,[a,c]=Zi("Disclosure.Button"),d=o0(),h=d===null?!1:d===a.panelId,m=l.useRef(null),u=ke(m,t,K(T=>{if(!h)return c({type:4,element:T})}));l.useEffect(()=>{if(!h)return c({type:2,buttonId:s}),()=>{c({type:2,buttonId:null})}},[s,c,h]);let f=K(T=>{var M;if(h){if(a.disclosureState===1)return;switch(T.key){case ee.Space:case ee.Enter:T.preventDefault(),T.stopPropagation(),c({type:0}),(M=a.buttonElement)==null||M.focus();break}}else switch(T.key){case ee.Space:case ee.Enter:T.preventDefault(),T.stopPropagation(),c({type:0});break}}),p=K(T=>{switch(T.key){case ee.Space:T.preventDefault();break}}),y=K(T=>{var M;Is(T.currentTarget)||r||(h?(c({type:0}),(M=a.buttonElement)==null||M.focus()):c({type:0}))}),{isFocusVisible:v,focusProps:b}=pn({autoFocus:i}),{isHovered:x,hoverProps:E}=mn({isDisabled:r}),{pressed:S,pressProps:C}=As({disabled:r}),k=l.useMemo(()=>({open:a.disclosureState===0,hover:x,active:S,disabled:r,focus:v,autofocus:i}),[a,x,S,v,r,i]),V=di(e,a.buttonElement),A=h?dt({ref:u,type:V,disabled:r||void 0,autoFocus:i,onKeyDown:f,onClick:y},b,E,C):dt({ref:u,id:s,type:V,"aria-expanded":a.disclosureState===0,"aria-controls":a.panelElement?a.panelId:void 0,disabled:r||void 0,autoFocus:i,onKeyDown:f,onKeyUp:p,onClick:y},b,E,C);return pe()({ourProps:A,theirProps:o,slot:k,defaultTag:u0,name:"Disclosure.Button"})}let f0="div",h0=ft.RenderStrategy|ft.Static;function p0(e,t){let n=l.useId(),{id:s=`headlessui-disclosure-panel-${n}`,transition:r=!1,...i}=e,[o,a]=Zi("Disclosure.Panel"),{close:c}=xc("Disclosure.Panel"),[d,h]=l.useState(null),m=ke(t,K(x=>{n0(()=>a({type:5,element:x}))}),h);l.useEffect(()=>(a({type:3,panelId:s}),()=>{a({type:3,panelId:null})}),[s,a]);let u=_t(),[f,p]=Vs(r,d,u!==null?(u&ve.Open)===ve.Open:o.disclosureState===0),y=l.useMemo(()=>({open:o.disclosureState===0,close:c}),[o.disclosureState,c]),v={ref:m,id:s,...Ns(p)},b=pe();return U.createElement(Xa,null,U.createElement(zi.Provider,{value:o.panelId},b({ourProps:v,theirProps:i,slot:y,defaultTag:f0,features:h0,visible:f,name:"Disclosure.Panel"})))}let m0=le(c0),wc=le(d0),Ec=le(p0),g0=Object.assign(m0,{Button:wc,Panel:Ec}),y0="input";function v0(e,t){let n=l.useId(),s=Rs(),r=Os(),{id:i=s||`headlessui-input-${n}`,disabled:o=r||!1,autoFocus:a=!1,invalid:c=!1,...d}=e,h=hn(),m=Fs(),{isFocused:u,focusProps:f}=pn({autoFocus:a}),{isHovered:p,hoverProps:y}=mn({isDisabled:o}),v=dt({ref:t,id:i,"aria-labelledby":h,"aria-describedby":m,"aria-invalid":c?"true":void 0,disabled:o||void 0,autoFocus:a},f,y),b=l.useMemo(()=>({disabled:o,invalid:c,hover:p,focus:u,autofocus:a}),[o,c,p,u,a]);return pe()({ourProps:v,theirProps:d,slot:b,defaultTag:y0,name:"Input"})}let b0=le(v0);var x0=Object.defineProperty,w0=(e,t,n)=>t in e?x0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ma=(e,t,n)=>(w0(e,typeof t!="symbol"?t+"":t,n),n),Se=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Se||{}),Ye=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ye||{}),os=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(os||{}),Sc=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(Sc||{});function ga(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=_a(t(e.options.slice()),i=>i.dataRef.current.domRef.current),r=n?s.indexOf(n):null;return r===-1&&(r=null),{options:s,activeOptionIndex:r}}let E0={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:te.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:s}=e.dataRef.current,r=e.options.findIndex(i=>s(i.dataRef.current.value));return r!==-1&&(n=r),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,s,r,i,o;if(e.dataRef.current.disabled||e.listboxState===1)return e;let a={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===te.Nothing)return{...a,activeOptionIndex:null};if(t.focus===te.Specific)return{...a,activeOptionIndex:e.options.findIndex(h=>h.id===t.id)};if(t.focus===te.Previous){let h=e.activeOptionIndex;if(h!==null){let m=e.options[h].dataRef.current.domRef,u=Yt(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(u!==null){let f=e.options[u].dataRef.current.domRef;if(((s=m.current)==null?void 0:s.previousElementSibling)===f.current||((r=f.current)==null?void 0:r.previousElementSibling)===null)return{...a,activeOptionIndex:u}}}}else if(t.focus===te.Next){let h=e.activeOptionIndex;if(h!==null){let m=e.options[h].dataRef.current.domRef,u=Yt(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(u!==null){let f=e.options[u].dataRef.current.domRef;if(((i=m.current)==null?void 0:i.nextElementSibling)===f.current||((o=f.current)==null?void 0:o.nextElementSibling)===null)return{...a,activeOptionIndex:u}}}}let c=ga(e),d=Yt(t,{resolveItems:()=>c.options,resolveActiveIndex:()=>c.activeOptionIndex,resolveId:h=>h.id,resolveDisabled:h=>h.dataRef.current.disabled});return{...a,...c,activeOptionIndex:d}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,s=e.searchQuery+t.value.toLowerCase(),r=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(o=>{var a;return!o.dataRef.current.disabled&&((a=o.dataRef.current.textValue)==null?void 0:a.startsWith(s))}),i=r?e.options.indexOf(r):-1;return i===-1||i===e.activeOptionIndex?{...e,searchQuery:s}:{...e,searchQuery:s,activeOptionIndex:i,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),s=e.activeOptionIndex;if(e.pendingFocus.focus!==te.Nothing&&(s=Yt(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:r=>r.id,resolveDisabled:r=>r.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:r}=e.dataRef.current;if(r){let i=n.findIndex(o=>r?.(o.dataRef.current.value));i!==-1&&(s=i)}}return{...e,options:n,activeOptionIndex:s,pendingFocus:{focus:te.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,s=[],r=new Set(t.options);for(let[i,o]of n.entries())if(r.has(o.id)&&(s.push(i),r.delete(o.id),r.size===0))break;if(s.length>0){n=n.slice();for(let i of s.reverse())n.splice(i,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...ga(e),pendingShouldSort:!1}:e};class Gi extends $a{constructor(t){super(t),ma(this,"actions",{onChange:n=>{let{onChange:s,compare:r,mode:i,value:o}=this.state.dataRef.current;return xe(i,{0:()=>s?.(n),1:()=>{let a=o.slice(),c=a.findIndex(d=>r(d,n));return c===-1?a.push(n):a.splice(c,1),s?.(a)}})},registerOption:tr(()=>{let n=[],s=new Set;return[(r,i)=>{s.has(i)||(s.add(i),n.push({id:r,dataRef:i}))},()=>(s.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:tr(()=>{let n=[];return[s=>n.push(s),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:tr(()=>{let n=null;return[(s,r)=>{n={type:2,...s,trigger:r}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:s}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:te.Specific,id:s})}},selectOption:n=>{let s=this.state.options.find(r=>r.id===n);s&&this.actions.onChange(s.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),ma(this,"selectors",{activeDescendantId(n){var s;let r=n.activeOptionIndex,i=n.options;return r===null||(s=i[r])==null?void 0:s.id},isActive(n,s){var r;let i=n.activeOptionIndex,o=n.options;return i!==null?((r=o[i])==null?void 0:r.id)===s:!1},shouldScrollIntoView(n,s){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,s)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,s=Dn.get(null);this.disposables.add(s.on(Ha.Push,r=>{!s.selectors.isTop(r,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>s.actions.push(n)),this.on(1,()=>s.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new Gi({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:te.Nothing},__demoMode:n})}reduce(t,n){return xe(n.type,E0,t,n)}}const Cc=l.createContext(null);function Ki(e){let t=l.useContext(Cc);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,kc),n}return t}function kc({id:e,__demoMode:t=!1}){let n=l.useMemo(()=>Gi.new({id:e,__demoMode:t}),[]);return ci(()=>n.dispose()),n}let Zs=l.createContext(null);Zs.displayName="ListboxDataContext";function Bn(e){let t=l.useContext(Zs);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Bn),n}return t}let S0=l.Fragment;function C0(e,t){let n=l.useId(),s=Os(),{value:r,defaultValue:i,form:o,name:a,onChange:c,by:d,invalid:h=!1,disabled:m=s||!1,horizontal:u=!1,multiple:f=!1,__demoMode:p=!1,...y}=e;const v=u?"horizontal":"vertical";let b=ke(t),x=Vi(i),[E=f?[]:void 0,S]=Pi(r,c,x),C=kc({id:n,__demoMode:p}),k=l.useRef({static:!1,hold:!1}),V=l.useRef(new Map),A=tc(d),T=l.useCallback(z=>xe(M.mode,{[Ye.Multi]:()=>E.some(_=>A(_,z)),[Ye.Single]:()=>A(E,z)}),[E]),M=l.useMemo(()=>({value:E,disabled:m,invalid:h,mode:f?Ye.Multi:Ye.Single,orientation:v,onChange:S,compare:A,isSelected:T,optionsPropsRef:k,listRef:V}),[E,m,h,f,v,S,A,T,k,V]);Ce(()=>{C.state.dataRef.current=M},[M]);let F=oe(C,z=>z.listboxState),I=Dn.get(null),w=oe(I,l.useCallback(z=>I.selectors.isTop(z,n),[I,n])),[P,L]=oe(C,z=>[z.buttonElement,z.optionsElement]);gi(w,[P,L],(z,_)=>{C.send({type:Sc.CloseListbox}),Ju(_,ed.Loose)||(z.preventDefault(),P?.focus())});let $=l.useMemo(()=>({open:F===Se.Open,disabled:m,invalid:h,value:E}),[F,m,h,E]),[O,R]=Wa({inherit:!0}),H={ref:b},Z=l.useCallback(()=>{if(x!==void 0)return S?.(x)},[S,x]),W=pe();return U.createElement(R,{value:O,props:{htmlFor:P?.id},slot:{open:F===Se.Open,disabled:m}},U.createElement(Qa,null,U.createElement(Cc.Provider,{value:C},U.createElement(Zs.Provider,{value:M},U.createElement(js,{value:xe(F,{[Se.Open]:ve.Open,[Se.Closed]:ve.Closed})},a!=null&&E!=null&&U.createElement(Ni,{disabled:m,data:{[a]:E},form:o,onReset:Z}),W({ourProps:H,theirProps:y,slot:$,defaultTag:S0,name:"Listbox"}))))))}let k0="button";function T0(e,t){let n=l.useId(),s=Rs(),r=Bn("Listbox.Button"),i=Ki("Listbox.Button"),{id:o=s||`headlessui-listbox-button-${n}`,disabled:a=r.disabled||!1,autoFocus:c=!1,...d}=e,h=ke(t,Ba(),i.actions.setButtonElement),m=Wu(),[u,f,p]=oe(i,R=>[R.listboxState,R.buttonElement,R.optionsElement]),y=u===Se.Open;qa(y,{trigger:f,action:l.useCallback(R=>{if(f!=null&&f.contains(R.target))return it.Ignore;let H=R.target.closest('[role="option"]:not([data-disabled])');return ln(H)?it.Select(H):p!=null&&p.contains(R.target)?it.Ignore:it.Close},[f,p]),close:i.actions.closeListbox,select:i.actions.selectActiveOption});let v=K(R=>{switch(R.key){case ee.Enter:Xl(R.currentTarget);break;case ee.Space:case ee.ArrowDown:R.preventDefault(),i.actions.openListbox({focus:r.value?te.Nothing:te.First});break;case ee.ArrowUp:R.preventDefault(),i.actions.openListbox({focus:r.value?te.Nothing:te.Last});break}}),b=K(R=>{switch(R.key){case ee.Space:R.preventDefault();break}}),x=K(R=>{var H;if(R.button===ui.Left){if(Is(R.currentTarget))return R.preventDefault();i.state.listboxState===Se.Open?(Me.flushSync(()=>i.actions.closeListbox()),(H=i.state.buttonElement)==null||H.focus({preventScroll:!0})):(R.preventDefault(),i.actions.openListbox({focus:te.Nothing}))}}),E=l.useRef(null),S=K(R=>{E.current=R.pointerType,R.pointerType==="mouse"&&x(R)}),C=K(R=>{E.current!=="mouse"&&x(R)}),k=K(R=>R.preventDefault()),V=hn([o]),A=Fs(),{isFocusVisible:T,focusProps:M}=pn({autoFocus:c}),{isHovered:F,hoverProps:I}=mn({isDisabled:a}),{pressed:w,pressProps:P}=As({disabled:a}),L=l.useMemo(()=>({open:u===Se.Open,active:w||u===Se.Open,disabled:a,invalid:r.invalid,value:r.value,hover:F,focus:T,autofocus:c}),[u,r.value,a,F,T,w,r.invalid,c]),$=oe(i,R=>R.listboxState===Se.Open),O=dt(m(),{ref:h,id:o,type:di(e,f),"aria-haspopup":"listbox","aria-controls":p?.id,"aria-expanded":$,"aria-labelledby":V,"aria-describedby":A,disabled:a||void 0,autoFocus:c,onKeyDown:v,onKeyUp:b,onKeyPress:k,onPointerDown:S,onClick:C},M,I,P);return pe()({ourProps:O,theirProps:d,slot:L,defaultTag:k0,name:"Listbox.Button"})}let Tc=l.createContext(!1),M0="div",R0=ft.RenderStrategy|ft.Static;function O0(e,t){let n=l.useId(),{id:s=`headlessui-listbox-options-${n}`,anchor:r,portal:i=!1,modal:o=!0,transition:a=!1,...c}=e,d=Za(r),[h,m]=l.useState(null);d&&(i=!0);let u=Bn("Listbox.Options"),f=Ki("Listbox.Options"),[p,y,v,b]=oe(f,N=>[N.listboxState,N.buttonElement,N.optionsElement,N.__demoMode]),x=xt(y),E=xt(v),S=_t(),[C,k]=Vs(a,h,S!==null?(S&ve.Open)===ve.Open:p===Se.Open);fi(C,y,f.actions.closeListbox);let V=b?!1:o&&p===Se.Open;hi(V,E);let A=b?!1:o&&p===Se.Open;pi(A,{allowed:l.useCallback(()=>[y,v],[y,v])});let T=p!==Se.Open,M=Qu(T,y)?!1:C,F=C&&p===Se.Closed,I=ws(F,u.value),w=K(N=>u.compare(I,N)),P=oe(f,N=>{var D;if(d==null||!((D=d?.to)!=null&&D.includes("selection")))return null;let B=N.options.findIndex(G=>w(G.dataRef.current.value));return B===-1&&(B=0),B}),L=(()=>{if(d==null)return;if(P===null)return{...d,inner:void 0};let N=Array.from(u.listRef.current.values());return{...d,inner:{listRef:{current:N},index:P}}})(),[$,O]=Ua(L),R=za(),H=ke(t,d?$:null,f.actions.setOptionsElement,m),Z=fn();l.useEffect(()=>{var N;let D=v;D&&p===Se.Open&&D!==((N=vi(D))==null?void 0:N.activeElement)&&D?.focus({preventScroll:!0})},[p,v]);let W=K(N=>{var D,B;switch(Z.dispose(),N.key){case ee.Space:if(f.state.searchQuery!=="")return N.preventDefault(),N.stopPropagation(),f.actions.search(N.key);case ee.Enter:if(N.preventDefault(),N.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:G}=f.state.options[f.state.activeOptionIndex];f.actions.onChange(G.current.value)}u.mode===Ye.Single&&(Me.flushSync(()=>f.actions.closeListbox()),(D=f.state.buttonElement)==null||D.focus({preventScroll:!0}));break;case xe(u.orientation,{vertical:ee.ArrowDown,horizontal:ee.ArrowRight}):return N.preventDefault(),N.stopPropagation(),f.actions.goToOption({focus:te.Next});case xe(u.orientation,{vertical:ee.ArrowUp,horizontal:ee.ArrowLeft}):return N.preventDefault(),N.stopPropagation(),f.actions.goToOption({focus:te.Previous});case ee.Home:case ee.PageUp:return N.preventDefault(),N.stopPropagation(),f.actions.goToOption({focus:te.First});case ee.End:case ee.PageDown:return N.preventDefault(),N.stopPropagation(),f.actions.goToOption({focus:te.Last});case ee.Escape:N.preventDefault(),N.stopPropagation(),Me.flushSync(()=>f.actions.closeListbox()),(B=f.state.buttonElement)==null||B.focus({preventScroll:!0});return;case ee.Tab:N.preventDefault(),N.stopPropagation(),Me.flushSync(()=>f.actions.closeListbox()),Yu(f.state.buttonElement,N.shiftKey?We.Previous:We.Next);break;default:N.key.length===1&&(f.actions.search(N.key),Z.setTimeout(()=>f.actions.clearSearch(),350));break}}),z=oe(f,N=>{var D;return(D=N.buttonElement)==null?void 0:D.id}),_=l.useMemo(()=>({open:p===Se.Open}),[p]),q=dt(d?R():{},{id:s,ref:H,"aria-activedescendant":oe(f,f.selectors.activeDescendantId),"aria-multiselectable":u.mode===Ye.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":u.orientation,onKeyDown:W,role:"listbox",tabIndex:p===Se.Open?0:void 0,style:{...c.style,...O,"--button-width":Sr(y,!0).width},...Ns(k)}),X=pe(),j=l.useMemo(()=>u.mode===Ye.Multi?u:{...u,isSelected:w},[u,w]);return U.createElement(mi,{enabled:i?e.static||C:!1,ownerDocument:x},U.createElement(Zs.Provider,{value:j},X({ourProps:q,theirProps:c,slot:_,defaultTag:M0,features:R0,visible:M,name:"Listbox.Options"})))}let F0="div";function I0(e,t){let n=l.useId(),{id:s=`headlessui-listbox-option-${n}`,disabled:r=!1,value:i,...o}=e,a=l.useContext(Tc)===!0,c=Bn("Listbox.Option"),d=Ki("Listbox.Option"),h=oe(d,M=>d.selectors.isActive(M,s)),m=c.isSelected(i),u=l.useRef(null),f=Xu(u),p=Ps({disabled:r,value:i,domRef:u,get textValue(){return f()}}),y=ke(t,u,M=>{M?c.listRef.current.set(s,M):c.listRef.current.delete(s)}),v=oe(d,M=>d.selectors.shouldScrollIntoView(M,s));Ce(()=>{if(v)return Ga().requestAnimationFrame(()=>{var M,F;(F=(M=u.current)==null?void 0:M.scrollIntoView)==null||F.call(M,{block:"nearest"})})},[v,u]),Ce(()=>{if(!a)return d.actions.registerOption(s,p),()=>d.actions.unregisterOption(s)},[p,s,a]);let b=K(M=>{var F;if(r)return M.preventDefault();d.actions.onChange(i),c.mode===Ye.Single&&(Me.flushSync(()=>d.actions.closeListbox()),(F=d.state.buttonElement)==null||F.focus({preventScroll:!0}))}),x=K(()=>{if(r)return d.actions.goToOption({focus:te.Nothing});d.actions.goToOption({focus:te.Specific,id:s})}),E=Ka(),S=K(M=>E.update(M)),C=K(M=>{E.wasMoved(M)&&(r||h&&d.state.activationTrigger===os.Pointer||d.actions.goToOption({focus:te.Specific,id:s},os.Pointer))}),k=K(M=>{E.wasMoved(M)&&(r||h&&d.state.activationTrigger===os.Pointer&&d.actions.goToOption({focus:te.Nothing}))}),V=l.useMemo(()=>({active:h,focus:h,selected:m,disabled:r,selectedOption:m&&a}),[h,m,r,a]),A=a?{}:{id:s,ref:y,role:"option",tabIndex:r===!0?void 0:-1,"aria-disabled":r===!0?!0:void 0,"aria-selected":m,disabled:void 0,onClick:b,onFocus:x,onPointerEnter:S,onMouseEnter:S,onPointerMove:C,onMouseMove:C,onPointerLeave:k,onMouseLeave:k},T=pe();return!m&&a?null:T({ourProps:A,theirProps:o,slot:V,defaultTag:F0,name:"Listbox.Option"})}let A0=l.Fragment;function P0(e,t){let{options:n,placeholder:s,...r}=e,i={ref:ke(t)},o=Bn("ListboxSelectedOption"),a=l.useMemo(()=>({}),[]),c=o.value===void 0||o.value===null||o.mode===Ye.Multi&&Array.isArray(o.value)&&o.value.length===0,d=pe();return U.createElement(Tc.Provider,{value:!0},d({ourProps:i,theirProps:{...r,children:U.createElement(U.Fragment,null,s&&c?s:n)},slot:a,defaultTag:A0,name:"ListboxSelectedOption"}))}let V0=le(C0),Mc=le(T0),N0=$n,Rc=le(O0),Br=le(I0),j0=le(P0),L0=Object.assign(V0,{Button:Mc,Label:N0,Options:Rc,Option:Br,SelectedOption:j0});function D0({controlled:e,default:t,name:n,state:s="value"}){const{current:r}=l.useRef(e!==void 0),[i,o]=l.useState(t),a=r?e:i,c=l.useCallback(d=>{r||o(d)},[]);return[a,c]}const Oc=l.createContext(void 0);function Us(){const e=l.useContext(Oc);if(e===void 0)throw new Error("Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>.");return e}function $0(e,t=!1,n=!1){const[s,r]=l.useState(e&&t?"idle":void 0),[i,o]=l.useState(e);return e&&!i&&(o(!0),r("starting")),!e&&i&&s!=="ending"&&!n&&r("ending"),!e&&!i&&s==="ending"&&r(void 0),Oe(()=>{if(!e&&i&&s!=="ending"&&n){const a=rt.request(()=>{r("ending")});return()=>{rt.cancel(a)}}},[e,i,s,n]),Oe(()=>{if(!e||t)return;const a=rt.request(()=>{Me.flushSync(()=>{r(void 0)})});return()=>{rt.cancel(a)}},[t,e]),Oe(()=>{if(!e||!t)return;e&&i&&s!=="idle"&&r("starting");const a=rt.request(()=>{r("idle")});return()=>{rt.cancel(a)}},[t,e,i,r,s]),l.useMemo(()=>({mounted:i,setMounted:o,transitionStatus:s}),[i,s])}const H0=600;function _0(e){if(e)return{"focus-out":"focus-out","escape-key":"escape-key","outside-press":"outside-press","list-navigation":"list-navigation",click:"trigger-press",hover:"trigger-hover",focus:"trigger-focus","reference-press":"trigger-press","safe-polygon":"trigger-hover","ancestor-scroll":void 0}[e]}const Fc=l.createContext(void 0);function B0(){return l.useContext(Fc)}function Wi(e){const{disabled:t=!1,defaultOpen:n=!1,onOpenChange:s,open:r,delay:i,closeDelay:o,hoverable:a=!0,trackCursorAxis:c="none",actionsRef:d,onOpenChangeComplete:h}=e,m=i??H0,u=o??0,[f,p]=l.useState(null),[y,v]=l.useState(null),[b,x]=l.useState(),E=l.useRef(null),[S,C]=D0({controlled:r,default:n,name:"Tooltip",state:"open"}),k=!t&&S;function V(N,D,B){const G=B==="trigger-hover",ce=N&&B==="trigger-focus",me=!N&&(B==="trigger-press"||B==="escape-key");function ze(){s?.(N,D,B),C(N)}G?Me.flushSync(ze):ze(),ce||me?x(ce?"focus":"dismiss"):B==="trigger-hover"&&x(void 0)}const A=ae(V);S&&t&&V(!1,void 0,"disabled");const{mounted:T,setMounted:M,transitionStatus:F}=$0(k),I=ae(()=>{M(!1),h?.(!1)});Mi({enabled:!d,open:k,ref:E,onComplete(){k||I()}}),l.useImperativeHandle(d,()=>({unmount:I}),[I]);const w=Ul({elements:{reference:f,floating:y},open:k,onOpenChange(N,D,B){A(N,D,_0(B))}}),P=B0(),{delayRef:L,isInstantPhase:$,hasProvider:O}=Th(w),R=$?"delay":b,H=Ch(w,{enabled:!t,mouseOnly:!0,move:!1,handleClose:a&&c!=="both"?wp():null,restMs(){const N=P?.delay,D=typeof L.current=="object"?L.current.open:void 0;let B=m;return O&&(D!==0?B=i??N??m:B=0),B},delay(){const N=typeof L.current=="object"?L.current.close:void 0;let D=u;return o==null&&O&&(D=N),{close:D}}}),Z=vp(w,{enabled:!t}),W=gp(w,{enabled:!t,referencePress:!0}),z=Rh(w,{enabled:!t&&c!=="none",axis:c==="none"?void 0:c}),{getReferenceProps:_,getFloatingProps:q}=bp([H,Z,W,z]),X=l.useMemo(()=>({open:k,setOpen:A,mounted:T,setMounted:M,setTriggerElement:p,positionerElement:y,setPositionerElement:v,popupRef:E,triggerProps:_(),popupProps:q(),floatingRootContext:w,instantType:R,transitionStatus:F,onOpenChangeComplete:h}),[k,A,T,M,p,y,v,E,_,q,w,R,F,h]),j=l.useMemo(()=>({...X,delay:m,closeDelay:u,trackCursorAxis:c,hoverable:a}),[X,m,u,c,a]);return g.jsx(Oc.Provider,{value:j,children:e.children})}let Qi=function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=vs.startingStyle]="startingStyle",e[e.endingStyle=vs.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e}({}),q0=function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e}({});const Z0={[q0.popupOpen]:""},U0={[Qi.open]:""},z0={[Qi.closed]:""},G0={[Qi.anchorHidden]:""},K0={open(e){return e?Z0:null}},Yi={open(e){return e?U0:z0},anchorHidden(e){return e?G0:null}},Xi=l.forwardRef(function(t,n){const{className:s,render:r,...i}=t,{open:o,setTriggerElement:a,triggerProps:c}=Us(),d=l.useMemo(()=>({open:o}),[o]);return mt("button",t,{state:d,ref:[n,a],props:[c,i],customStyleHookMapping:K0})}),Ic=l.createContext(void 0);function W0(){const e=l.useContext(Ic);if(e===void 0)throw new Error("Base UI: <Tooltip.Portal> is missing.");return e}function Ji(e){const{children:t,keepMounted:n=!1,container:s}=e,{mounted:r}=Us();return r||n?g.jsx(Ic.Provider,{value:n,children:g.jsx(td,{root:s,children:t})}):null}const Ac=l.createContext(void 0);function Pc(){const e=l.useContext(Ac);if(e===void 0)throw new Error("Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>.");return e}const Q0=l.createContext(void 0);function Y0(e=!0){const t=l.useContext(Q0);if(t===void 0&&!e)throw new Error("Base UI: DirectionContext is missing.");return t?.direction??"ltr"}const X0=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:r,rects:i,platform:o,elements:a,middlewareData:c}=t,{element:d,padding:h=0,offsetParent:m="real"}=ht(e,t)||{};if(d==null)return{};const u=Cl(h),f={x:n,y:s},p=Ti(r),y=ki(p),v=await o.getDimensions(d),b=p==="y",x=b?"top":"left",E=b?"bottom":"right",S=b?"clientHeight":"clientWidth",C=i.reference[y]+i.reference[p]-f[p]-i.floating[y],k=f[p]-i.reference[p],V=m==="real"?await o.getOffsetParent?.(d):a.floating;let A=a.floating[S]||i.floating[y];(!A||!await o.isElement?.(V))&&(A=a.floating[S]||i.floating[y]);const T=C/2-k/2,M=A/2-v[y]/2-1,F=Math.min(u[x],M),I=Math.min(u[E],M),w=F,P=A-v[y]-I,L=A/2-v[y]/2+T,$=Nr(w,L,P),O=!c.arrow&&St(r)!=null&&L!==$&&i.reference[y]/2-(L<w?F:I)-v[y]/2<0,R=O?L<w?L-w:L-P:0;return{[p]:f[p]+R,data:{[p]:$,centerOffset:L-$-R,...O&&{alignmentOffset:R}},reset:O}}}),J0=(e,t)=>({...X0(e),options:[e,t]});function Vc(e,t,n){const s=e==="inline-start"||e==="inline-end";return{top:"top",right:s?n?"inline-start":"inline-end":"right",bottom:"bottom",left:s?n?"inline-end":"inline-start":"left"}[t]}function ya(e,t,n){const{rects:s,placement:r}=e;return{side:Vc(t,$e(r),n),align:St(r)||"center",anchor:{width:s.reference.width,height:s.reference.height},positioner:{width:s.floating.width,height:s.floating.height}}}function e1(e){const{anchor:t,positionMethod:n="absolute",side:s="bottom",sideOffset:r=0,align:i="center",alignOffset:o=0,collisionBoundary:a,collisionPadding:c=5,sticky:d=!1,arrowPadding:h=5,trackAnchor:m=!0,keepMounted:u=!1,floatingRootContext:f,mounted:p,collisionAvoidance:y,shiftCrossAxis:v=!1,nodeId:b,adaptiveOrigin:x}=e,E=y.side||"flip",S=y.align||"flip",C=y.fallbackAxisSide||"end",k=typeof t=="function"?t:void 0,V=ae(k),A=k?V:t,T=ot(t),F=Y0()==="rtl",I={top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[s],w=i==="center"?I:`${I}-${i}`,P={boundary:a==="clipping-ancestors"?"clippingAncestors":a,padding:c},L=l.useRef(null),$=ot(r),O=ot(o),Z=[cp(re=>{const fe=ya(re,s,F),je=typeof $.current=="function"?$.current(fe):$.current,Le=typeof O.current=="function"?O.current(fe):O.current;return{mainAxis:je,crossAxis:Le,alignmentAxis:Le}},[typeof r!="function"?r:0,typeof o!="function"?o:0,F,s])],W=S==="none"&&E!=="shift",z=!W&&(d||v||E==="shift"),_=E==="none"?null:fp({...P,mainAxis:!v&&E==="flip",crossAxis:S==="flip"?"alignment":!1,fallbackAxisSideDirection:C}),q=W?null:up(re=>{const fe=Qt(re.elements.floating).documentElement;return{...P,rootBoundary:v?{x:0,y:0,width:fe.clientWidth,height:fe.clientHeight}:void 0,mainAxis:S!=="none",crossAxis:z,limiter:d||v?void 0:dp(()=>{if(!L.current)return{};const{height:je}=L.current.getBoundingClientRect();return{offset:je/2+(typeof c=="number"?c:0)}})}},[P,d,v,c,S]);E==="shift"||S==="shift"||i==="center"?Z.push(q,_):Z.push(_,q),Z.push(hp({...P,apply({elements:{floating:re},rects:{reference:fe},availableWidth:je,availableHeight:Le}){Object.entries({"--available-width":`${je}px`,"--available-height":`${Le}px`,"--anchor-width":`${fe.width}px`,"--anchor-height":`${fe.height}px`}).forEach(([Re,yt])=>{re.style.setProperty(Re,yt)})}}),J0(()=>({element:L.current||document.createElement("div"),padding:h,offsetParent:"floating"}),[h]),pp(),{name:"transformOrigin",fn(re){const{elements:fe,middlewareData:je,placement:Le,rects:Re,y:yt}=re,qt=$e(Le),bn=Ze(qt),Zt=L.current,Ut=je.arrow?.x||0,Ks=je.arrow?.y||0,Ws=Zt?.clientWidth||0,Qs=Zt?.clientHeight||0,Ys=Ut+Ws/2,co=Ks+Qs/2,qc=Math.abs(je.shift?.y||0),Zc=Re.reference.height/2,Uc=qc>(typeof r=="function"?r(ya(re,s,F)):r),zc={top:`${Ys}px calc(100% + ${r}px)`,bottom:`${Ys}px ${-r}px`,left:`calc(100% + ${r}px) ${co}px`,right:`${-r}px ${co}px`}[qt],Gc=`${Ys}px ${Re.reference.y+Zc-yt}px`;return fe.floating.style.setProperty("--transform-origin",z&&bn==="y"&&Uc?Gc:zc),{}}},x);let X=f;!p&&f&&(X={...f,elements:{reference:null,floating:null,domReference:null}});const j=l.useMemo(()=>({elementResize:m&&typeof ResizeObserver<"u",layoutShift:m&&typeof IntersectionObserver<"u"}),[m]),{refs:N,elements:D,x:B,y:G,middlewareData:ce,update:me,placement:ze,context:Bt,isPositioned:Ct,floatingStyles:Ee}=yp({rootContext:X,placement:w,middleware:Z,strategy:n,whileElementsMounted:u?void 0:(...re)=>ta(...re,j),nodeId:b}),{sideX:Ne,sideY:kt}=ce.adaptiveOrigin||{},He=l.useMemo(()=>x?{position:n,[Ne]:`${B}px`,[kt]:`${G}px`}:Ee,[x,Ne,kt,n,B,G,Ee]),gt=l.useRef(null);Oe(()=>{if(!p)return;const re=T.current,fe=typeof re=="function"?re():re,Le=(va(fe)?fe.current:fe)||null||null;Le!==gt.current&&(N.setPositionReference(Le),gt.current=Le)},[p,N,A,T]),l.useEffect(()=>{if(!p)return;const re=T.current;typeof re!="function"&&va(re)&&re.current!==gt.current&&(N.setPositionReference(re.current),gt.current=re.current)},[p,N,A,T]),l.useEffect(()=>{if(u&&p&&D.domReference&&D.floating)return ta(D.domReference,D.floating,me,j)},[u,p,D,me,j]);const vn=$e(ze),Y=Vc(s,vn,F),J=St(ze)||"center",ue=!!ce.hide?.referenceHidden,de=l.useMemo(()=>({position:"absolute",top:ce.arrow?.y,left:ce.arrow?.x}),[ce.arrow]),_e=ce.arrow?.centerOffset!==0;return l.useMemo(()=>({positionerStyles:He,arrowStyles:de,arrowRef:L,arrowUncentered:_e,side:Y,align:J,anchorHidden:ue,refs:N,context:Bt,isPositioned:Ct,update:me}),[He,de,L,_e,Y,J,ue,N,Bt,Ct,me])}function va(e){return e!=null&&"current"in e}const eo=l.forwardRef(function(t,n){const{render:s,className:r,anchor:i,positionMethod:o="absolute",side:a="top",align:c="center",sideOffset:d=0,alignOffset:h=0,collisionBoundary:m="clipping-ancestors",collisionPadding:u=5,arrowPadding:f=5,sticky:p=!1,trackAnchor:y=!0,collisionAvoidance:v=Xf,...b}=t,{open:x,setPositionerElement:E,mounted:S,floatingRootContext:C,trackCursorAxis:k,hoverable:V}=Us(),A=W0(),T=e1({anchor:i,positionMethod:o,floatingRootContext:C,mounted:S,side:a,sideOffset:d,align:c,alignOffset:h,collisionBoundary:m,collisionPadding:u,sticky:p,arrowPadding:f,trackAnchor:y,keepMounted:A,collisionAvoidance:v}),M=l.useMemo(()=>{const L={};return(!x||k==="both"||!V)&&(L.pointerEvents="none"),{role:"presentation",hidden:!S,style:{...T.positionerStyles,...L}}},[x,k,V,S,T.positionerStyles]),F=l.useMemo(()=>({props:M,...T}),[M,T]),I=l.useMemo(()=>({open:x,side:F.side,align:F.align,anchorHidden:F.anchorHidden}),[x,F.side,F.align,F.anchorHidden]),w=l.useMemo(()=>({...I,arrowRef:F.arrowRef,arrowStyles:F.arrowStyles,arrowUncentered:F.arrowUncentered}),[I,F.arrowRef,F.arrowStyles,F.arrowUncentered]),P=mt("div",t,{state:I,props:[F.props,b],ref:[n,E],customStyleHookMapping:Yi});return g.jsx(Ac.Provider,{value:w,children:P})}),t1={...Yi,...Vl},to=l.forwardRef(function(t,n){const{className:s,render:r,...i}=t,{open:o,instantType:a,transitionStatus:c,popupProps:d,popupRef:h,onOpenChangeComplete:m}=Us(),{side:u,align:f}=Pc();Mi({open:o,ref:h,onComplete(){o&&m?.(!0)}});const p=l.useMemo(()=>({open:o,side:u,align:f,instant:a,transitionStatus:c}),[o,u,f,a,c]);return mt("div",t,{state:p,ref:[n,h],props:[d,c==="starting"?Yf:Ot,i],customStyleHookMapping:t1})}),no=l.forwardRef(function(t,n){const{className:s,render:r,...i}=t,{open:o,arrowRef:a,side:c,align:d,arrowUncentered:h,arrowStyles:m}=Pc(),u=l.useMemo(()=>({open:o,side:c,align:d,uncentered:h}),[o,c,d,h]);return mt("div",t,{state:u,ref:[n,a],props:[{style:m,"aria-hidden":!0},i],customStyleHookMapping:Yi})}),so=function(t){const{delay:n,closeDelay:s,timeout:r=400}=t,i=l.useMemo(()=>({delay:n,closeDelay:s}),[n,s]),o=l.useMemo(()=>({open:n,close:s}),[n,s]);return g.jsx(Fc.Provider,{value:i,children:g.jsx(kh,{delay:o,timeoutMs:r,children:t.children})})};function qn(e,t){return typeof e=="function"?e(t):e}function Nt(e,t){return zs(t).reduce((s,r)=>{if(s===null)return null;if(typeof s<"u")return s[r]},e)}function Qn(e,t,n){const s=zs(t);function r(i){if(!s.length)return qn(n,i);const o=s.shift();if(typeof o=="string"||typeof o=="number"&&!Array.isArray(i))return typeof i=="object"?(i===null&&(i={}),{...i,[o]:r(i[o])}):{[o]:r()};if(Array.isArray(i)&&typeof o=="number"){const a=i.slice(0,o);return[...a.length?a:new Array(o),r(i[o]),...i.slice(o+1)]}return[...new Array(o),r()]}return r(e)}function n1(e,t){const n=zs(t);function s(r){if(!r)return;if(n.length===1){const o=n[0];if(Array.isArray(r)&&typeof o=="number")return r.filter((d,h)=>h!==o);const{[o]:a,...c}=r;return c}const i=n.shift();if(typeof i=="string"&&typeof r=="object")return{...r,[i]:s(r[i])};if(typeof i=="number"&&Array.isArray(r)){if(i>=r.length)return r;const o=r.slice(0,i);return[...o.length?o:new Array(i),s(r[i]),...r.slice(i+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return s(e)}const s1=/^(\d+)$/gm,r1=/\.(\d+)(?=\.)/gm,i1=/^(\d+)\./gm,o1=/\.(\d+$)/gm,a1=/\.{2,}/gm,qr="__int__",Yn=`${qr}$1`;function zs(e){if(Array.isArray(e))return[...e];if(typeof e!="string")throw new Error("Path must be a string.");return e.replace(/(^\[)|]/gm,"").replace(/\[/g,".").replace(s1,Yn).replace(r1,`.${Yn}.`).replace(i1,`${Yn}.`).replace(o1,`.${Yn}`).replace(a1,".").split(".").map(t=>{if(t.startsWith(qr)){const n=t.substring(qr.length),s=parseInt(n,10);return String(s)===n?s:n}return t})}function ba(e,t){return e.length===0?t:t.length===0?e:t.startsWith("[")||t.startsWith(".")?e+t:`${e}.${t}`}function l1(e){return!(Array.isArray(e)&&e.length===0)}function Zr(e,t){const n=s=>s.validators.filter(Boolean).map(r=>({cause:r.cause,validate:r.fn}));return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,async:!1},runValidation:n})}function Ur(e,t){const{asyncDebounceMs:n}=t,{onBlurAsyncDebounceMs:s,onChangeAsyncDebounceMs:r,onDynamicAsyncDebounceMs:i}=t.validators||{},o=n??0,a=c=>c.validators.filter(Boolean).map(d=>{const h=d?.cause||e;let m=o;switch(h){case"change":m=r??o;break;case"blur":m=s??o;break;case"dynamic":m=i??o;break;case"submit":m=0;break}return e==="submit"&&(m=0),{cause:h,validate:d.fn,debounceMs:m}});return t.validationLogic({form:t.form,validators:t.validators,event:{type:e,async:!0},runValidation:a})}const zr=e=>!!e&&typeof e=="object"&&"fields"in e;function Wt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!t.has(r)||!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e),s=Object.keys(t);if(n.length!==s.length)return!1;for(const r of n)if(!s.includes(r)||!Wt(e[r],t[r]))return!1;return!0}const xa=({newFormValidatorError:e,isPreviousErrorFromFormValidator:t,previousErrorValue:n})=>e?{newErrorValue:e,newSource:"form"}:t?{newErrorValue:void 0,newSource:void 0}:n?{newErrorValue:n,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},wa=({formLevelError:e,fieldLevelError:t})=>t?{newErrorValue:t,newSource:"field"}:e?{newErrorValue:e,newSource:"form"}:{newErrorValue:void 0,newSource:void 0},Jt=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});const t=e.event.async,n=t?void 0:{fn:e.validators.onMount,cause:"mount"},s={fn:t?e.validators.onChangeAsync:e.validators.onChange,cause:"change"},r={fn:t?e.validators.onBlurAsync:e.validators.onBlur,cause:"blur"},i={fn:t?e.validators.onSubmitAsync:e.validators.onSubmit,cause:"submit"},o=t?void 0:{fn:()=>{},cause:"server"};switch(e.event.type){case"mount":return e.runValidation({validators:[n],form:e.form});case"submit":return e.runValidation({validators:[s,r,i,o],form:e.form});case"server":return e.runValidation({validators:[],form:e.form});case"blur":return e.runValidation({validators:[r,o],form:e.form});case"change":return e.runValidation({validators:[s,o],form:e.form});default:throw new Error(`Unknown validation event type: ${e.event.type}`)}};function c1(e){const t=new Map;for(const n of e){const s=[...n.path??[]].map(r=>{const i=typeof r=="object"?r.key:r;return typeof i=="number"?`[${i}]`:i}).join(".").replace(/\.\[/g,"[");t.set(s,(t.get(s)??[]).concat(n))}return Object.fromEntries(t)}const Ea=e=>{const t=c1(e);return{form:t,fields:t}},sn={validate({value:e,validationSource:t},n){const s=n["~standard"].validate(e);if(s instanceof Promise)throw new Error("async function passed to sync validator");if(s.issues)return t==="field"?s.issues:Ea(s.issues)},async validateAsync({value:e,validationSource:t},n){const s=await n["~standard"].validate(e);if(s.issues)return t==="field"?s.issues:Ea(s.issues)}},Nc=e=>!!e&&"~standard"in e,Es={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function Xn(e){function t(m,u,f,p){const y=s(m,u,f,p);({insert:()=>a(y,m,u),remove:()=>c(y),swap:()=>p!==void 0&&h(y,m,u,p),move:()=>p!==void 0&&d(y,m,u,p)})[f]()}function n(m,u){return`${m}[${u}]`}function s(m,u,f,p){const y=[n(m,u)];if(f==="swap")y.push(n(m,p));else if(f==="move"){const[v,b]=[Math.min(u,p),Math.max(u,p)];for(let x=v;x<=b;x++)y.push(n(m,x))}else{const v=e.getFieldValue(m),b=Array.isArray(v)?v.length:0;for(let x=u+1;x<b;x++)y.push(n(m,x))}return Object.keys(e.fieldInfo).filter(v=>y.some(b=>v.startsWith(b)))}function r(m,u){return m.replace(/\[(\d+)\]/,(f,p)=>{const y=parseInt(p,10);return`[${u==="up"?y+1:Math.max(0,y-1)}]`})}function i(m,u){(u==="up"?m:[...m].reverse()).forEach(p=>{const y=r(p.toString(),u),v=e.getFieldMeta(y);v?e.setFieldMeta(p,v):e.setFieldMeta(p,o())})}const o=()=>Es,a=(m,u,f)=>{i(m,"down"),m.forEach(p=>{p.toString().startsWith(n(u,f))&&e.setFieldMeta(p,o())})},c=m=>{i(m,"up")},d=(m,u,f,p)=>{const y=new Map(Object.keys(e.fieldInfo).filter(v=>v.startsWith(n(u,f))).map(v=>[v,e.getFieldMeta(v)]));i(m,f<p?"up":"down"),Object.keys(e.fieldInfo).filter(v=>v.startsWith(n(u,p))).forEach(v=>{const b=v.replace(n(u,p),n(u,f)),x=y.get(b);x&&e.setFieldMeta(v,x)})},h=(m,u,f,p)=>{m.forEach(y=>{if(!y.toString().startsWith(n(u,f)))return;const v=y.toString().replace(n(u,f),n(u,p)),[b,x]=[e.getFieldMeta(y),e.getFieldMeta(v)];b&&e.setFieldMeta(v,b),x&&e.setFieldMeta(y,x)})};return{handleArrayFieldMetaShift:t}}function hr(e){return{values:e.values??{},errorMap:e.errorMap??{},fieldMetaBase:e.fieldMetaBase??{},isSubmitted:e.isSubmitted??!1,isSubmitting:e.isSubmitting??!1,isValidating:e.isValidating??!1,submissionAttempts:e.submissionAttempts??0,isSubmitSuccessful:e.isSubmitSuccessful??!1,validationMetaMap:e.validationMetaMap??{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}}}class u1{constructor(t){this.options={},this.fieldInfo={},this.prevTransformArray=[],this.mount=()=>{const n=this.fieldMetaDerived.mount(),s=this.store.mount(),r=()=>{n(),s()};this.options.listeners?.onMount?.({formApi:this});const{onMount:i}=this.options.validators||{};return i&&this.validateSync("mount"),r},this.update=n=>{if(!n)return;const s=this.options;this.options=n;const r=!!n.transform?.deps?.some((a,c)=>a!==this.prevTransformArray[c]),i=n.defaultValues&&!Wt(n.defaultValues,s.defaultValues)&&!this.state.isTouched,o=!Wt(n.defaultState,s.defaultState)&&!this.state.isTouched;!i&&!o&&!r||Ge(()=>{this.baseStore.setState(()=>hr(Object.assign({},this.state,o?n.defaultState:{},i?{values:n.defaultValues}:{},r?{_force_re_eval:!this.state._force_re_eval}:{})))})},this.reset=(n,s)=>{const{fieldMeta:r}=this.state,i=this.resetFieldMeta(r);n&&!s?.keepDefaultValues&&(this.options={...this.options,defaultValues:n}),this.baseStore.setState(()=>hr({...this.options.defaultState,values:n??this.options.defaultValues??this.options.defaultState?.values,fieldMetaBase:i}))},this.validateAllFields=async n=>{const s=[];return Ge(()=>{Object.values(this.fieldInfo).forEach(i=>{if(!i.instance)return;const o=i.instance;s.push(Promise.resolve().then(()=>o.validate(n,{skipFormValidation:!0}))),i.instance.state.meta.isTouched||i.instance.setMeta(a=>({...a,isTouched:!0}))})}),(await Promise.all(s)).flat()},this.validateArrayFieldsStartingFrom=async(n,s,r)=>{const i=this.getFieldValue(n),o=Array.isArray(i)?Math.max(i.length-1,0):null,a=[`${n}[${s}]`];for(let m=s+1;m<=(o??0);m++)a.push(`${n}[${m}]`);const c=Object.keys(this.fieldInfo).filter(m=>a.some(u=>m.startsWith(u))),d=[];return Ge(()=>{c.forEach(m=>{d.push(Promise.resolve().then(()=>this.validateField(m,r)))})}),(await Promise.all(d)).flat()},this.validateField=(n,s)=>{const r=this.fieldInfo[n]?.instance;return r?(r.state.meta.isTouched||r.setMeta(i=>({...i,isTouched:!0})),r.validate(s)):[]},this.validateSync=n=>{const s=Zr(n,{...this.options,form:this,validationLogic:this.options.validationLogic||Jt});let r=!1;const i={};return Ge(()=>{for(const c of s){if(!c.validate)continue;const d=this.runValidator({validate:c.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:h,fieldErrors:m}=as(d),u=wn(c.cause);for(const f of Object.keys(this.state.fieldMeta)){const p=this.getFieldMeta(f);if(!p)continue;const{errorMap:y,errorSourceMap:v}=p,b=m?.[f],{newErrorValue:x,newSource:E}=xa({newFormValidatorError:b,isPreviousErrorFromFormValidator:v?.[u]==="form",previousErrorValue:y?.[u]});E==="form"&&(i[f]={...i[f],[u]:b}),y?.[u]!==x&&this.setFieldMeta(f,S=>({...S,errorMap:{...S.errorMap,[u]:x},errorSourceMap:{...S.errorSourceMap,[u]:E}}))}this.state.errorMap?.[u]!==h&&this.baseStore.setState(f=>({...f,errorMap:{...f.errorMap,[u]:h}})),(h||m)&&(r=!0)}const o=wn("submit");this.state.errorMap?.[o]&&n!=="submit"&&!r&&this.baseStore.setState(c=>({...c,errorMap:{...c.errorMap,[o]:void 0}}));const a=wn("server");this.state.errorMap?.[a]&&n!=="server"&&!r&&this.baseStore.setState(c=>({...c,errorMap:{...c.errorMap,[a]:void 0}}))}),{hasErrored:r,fieldsErrorMap:i}},this.validateAsync=async n=>{const s=Ur(n,{...this.options,form:this,validationLogic:this.options.validationLogic||Jt});this.state.isFormValidating||this.baseStore.setState(c=>({...c,isFormValidating:!0}));const r=[];let i;for(const c of s){if(!c.validate)continue;const d=wn(c.cause);this.state.validationMetaMap[d]?.lastAbortController.abort();const m=new AbortController;this.state.validationMetaMap[d]={lastAbortController:m},r.push(new Promise(async u=>{let f;try{f=await new Promise((b,x)=>{setTimeout(async()=>{if(m.signal.aborted)return b(void 0);try{b(await this.runValidator({validate:c.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:m.signal},type:"validateAsync"}))}catch(E){x(E)}},c.debounceMs)})}catch(b){f=b}const{formError:p,fieldErrors:y}=as(f);y&&(i=i?{...i,...y}:y);const v=wn(c.cause);for(const b of Object.keys(this.state.fieldMeta)){const x=this.getFieldMeta(b);if(!x)continue;const{errorMap:E,errorSourceMap:S}=x,C=i?.[b],{newErrorValue:k,newSource:V}=xa({newFormValidatorError:C,isPreviousErrorFromFormValidator:S?.[v]==="form",previousErrorValue:E?.[v]});E?.[v]!==k&&this.setFieldMeta(b,A=>({...A,errorMap:{...A.errorMap,[v]:k},errorSourceMap:{...A.errorSourceMap,[v]:V}}))}this.baseStore.setState(b=>({...b,errorMap:{...b.errorMap,[v]:p}})),u(i?{fieldErrors:i,errorMapKey:v}:void 0)}))}let o=[];const a={};if(r.length){o=await Promise.all(r);for(const c of o)if(c?.fieldErrors){const{errorMapKey:d}=c;for(const[h,m]of Object.entries(c.fieldErrors)){const f={...a[h]||{},[d]:m};a[h]=f}}}return this.baseStore.setState(c=>({...c,isFormValidating:!1})),a},this.validate=n=>{const{hasErrored:s,fieldsErrorMap:r}=this.validateSync(n);return s&&!this.options.asyncAlways?r:this.validateAsync(n)},this.getFieldValue=n=>Nt(this.state.values,n),this.getFieldMeta=n=>this.state.fieldMeta[n],this.getFieldInfo=n=>this.fieldInfo[n]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(n,s)=>{this.baseStore.setState(r=>({...r,fieldMetaBase:{...r.fieldMetaBase,[n]:qn(s,r.fieldMetaBase[n])}}))},this.resetFieldMeta=n=>Object.keys(n).reduce((s,r)=>{const i=r;return s[i]=Es,s},{}),this.setFieldValue=(n,s,r)=>{const i=r?.dontUpdateMeta??!1;Ge(()=>{i||this.setFieldMeta(n,o=>({...o,isTouched:!0,isDirty:!0,errorMap:{...o?.errorMap,onMount:void 0}})),this.baseStore.setState(o=>({...o,values:Qn(o.values,n,s)}))})},this.deleteField=n=>{const r=[...Object.keys(this.fieldInfo).filter(i=>{const o=n.toString();return i!==o&&i.startsWith(o)}),n];this.baseStore.setState(i=>{const o={...i};return r.forEach(a=>{o.values=n1(o.values,a),delete this.fieldInfo[a],delete o.fieldMetaBase[a]}),o})},this.pushFieldValue=(n,s,r)=>{this.setFieldValue(n,i=>[...Array.isArray(i)?i:[],s],r),this.validateField(n,"change")},this.insertFieldValue=async(n,s,r,i)=>{this.setFieldValue(n,o=>[...o.slice(0,s),r,...o.slice(s)],i),await this.validateField(n,"change"),Xn(this).handleArrayFieldMetaShift(n,s,"insert"),await this.validateArrayFieldsStartingFrom(n,s,"change")},this.replaceFieldValue=async(n,s,r,i)=>{this.setFieldValue(n,o=>o.map((a,c)=>c===s?r:a),i),await this.validateField(n,"change"),await this.validateArrayFieldsStartingFrom(n,s,"change")},this.removeFieldValue=async(n,s,r)=>{const i=this.getFieldValue(n),o=Array.isArray(i)?Math.max(i.length-1,0):null;if(this.setFieldValue(n,a=>a.filter((c,d)=>d!==s),r),Xn(this).handleArrayFieldMetaShift(n,s,"remove"),o!==null){const a=`${n}[${o}]`;this.deleteField(a)}await this.validateField(n,"change"),await this.validateArrayFieldsStartingFrom(n,s,"change")},this.swapFieldValues=(n,s,r,i)=>{this.setFieldValue(n,o=>{const a=o[s],c=o[r];return Qn(Qn(o,`${s}`,c),`${r}`,a)},i),Xn(this).handleArrayFieldMetaShift(n,s,"swap",r),this.validateField(n,"change"),this.validateField(`${n}[${s}]`,"change"),this.validateField(`${n}[${r}]`,"change")},this.moveFieldValues=(n,s,r,i)=>{this.setFieldValue(n,o=>{const a=[...o];return a.splice(r,0,a.splice(s,1)[0]),a},i),Xn(this).handleArrayFieldMetaShift(n,s,"move",r),this.validateField(n,"change"),this.validateField(`${n}[${s}]`,"change"),this.validateField(`${n}[${r}]`,"change")},this.clearFieldValues=(n,s)=>{const r=this.getFieldValue(n),i=Array.isArray(r)?Math.max(r.length-1,0):null;if(this.setFieldValue(n,[],s),i!==null)for(let o=0;o<=i;o++){const a=`${n}[${o}]`;this.deleteField(a)}this.validateField(n,"change")},this.resetField=n=>{this.baseStore.setState(s=>({...s,fieldMetaBase:{...s.fieldMetaBase,[n]:Es},values:this.options.defaultValues?Qn(s.values,n,Nt(this.options.defaultValues,n)):s.values}))},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((n,[s,r])=>(Object.keys(r).length&&r.errors.length&&(n[s]={errors:r.errors,errorMap:r.errorMap}),n),{})}),this.parseValuesWithSchema=n=>sn.validate({value:this.state.values,validationSource:"form"},n),this.parseValuesWithSchemaAsync=n=>sn.validateAsync({value:this.state.values,validationSource:"form"},n),this.baseStore=new nd(hr({...t?.defaultState,values:t?.defaultValues??t?.defaultState?.values})),this.fieldMetaDerived=new ds({deps:[this.baseStore],fn:({prevDepVals:n,currDepVals:s,prevVal:r})=>{const i=r,o=n?.[0],a=s[0];let c=0;const d={};for(const h of Object.keys(a.fieldMetaBase)){const m=a.fieldMetaBase[h],u=o?.fieldMetaBase[h],f=i?.[h],p=Nt(a.values,h);let y=f?.errors;if(!u||m.errorMap!==u.errorMap){y=Object.values(m.errorMap??{}).filter(S=>S!==void 0);const E=this.getFieldInfo(h)?.instance;E&&!E.options.disableErrorFlat&&(y=y?.flat(1))}const v=!l1(y??[]),b=!m.isDirty,x=Wt(p,Nt(this.options.defaultValues,h))||Wt(p,this.getFieldInfo(h)?.instance?.options.defaultValue);if(f&&f.isPristine===b&&f.isValid===v&&f.isDefaultValue===x&&f.errors===y&&m===u){d[h]=f,c++;continue}d[h]={...m,errors:y,isPristine:b,isValid:v,isDefaultValue:x}}return Object.keys(a.fieldMetaBase).length&&i&&c===Object.keys(a.fieldMetaBase).length?i:d}}),this.store=new ds({deps:[this.baseStore,this.fieldMetaDerived],fn:({prevDepVals:n,currDepVals:s,prevVal:r})=>{const i=r,o=n?.[0],a=s[0],c=s[1],d=Object.values(c).filter(Boolean),h=d.some(w=>w.isValidating),m=d.every(w=>w.isValid),u=d.some(w=>w.isTouched),f=d.some(w=>w.isBlurred),p=d.every(w=>w.isDefaultValue),y=u&&a.errorMap?.onMount,v=d.some(w=>w.isDirty),b=!v,x=!!(a.errorMap?.onMount||d.some(w=>w?.errorMap?.onMount)),E=!!h;let S=i?.errors??[];(!o||a.errorMap!==o.errorMap)&&(S=Object.values(a.errorMap).reduce((w,P)=>P===void 0?w:P&&zr(P)?(w.push(P.form),w):(w.push(P),w),[]));const C=S.length===0,k=m&&C,V=this.options.canSubmitWhenInvalid??!1,A=a.submissionAttempts===0&&!u&&!x||!E&&!a.isSubmitting&&k||V;let T=a.errorMap;if(y&&(S=S.filter(w=>w!==a.errorMap.onMount),T=Object.assign(T,{onMount:void 0})),i&&o&&i.errorMap===T&&i.fieldMeta===this.fieldMetaDerived.state&&i.errors===S&&i.isFieldsValidating===h&&i.isFieldsValid===m&&i.isFormValid===C&&i.isValid===k&&i.canSubmit===A&&i.isTouched===u&&i.isBlurred===f&&i.isPristine===b&&i.isDefaultValue===p&&i.isDirty===v&&Wt(o,a))return i;let M={...a,errorMap:T,fieldMeta:this.fieldMetaDerived.state,errors:S,isFieldsValidating:h,isFieldsValid:m,isFormValid:C,isValid:k,canSubmit:A,isTouched:u,isBlurred:f,isPristine:b,isDefaultValue:p,isDirty:v};const F=this.options.transform?.deps??[];if(F.length!==this.prevTransformArray.length||F.some((w,P)=>w!==this.prevTransformArray[P])){const w=Object.assign({},this,{state:M});this.options.transform?.fn(w),M=w.state,this.prevTransformArray=F}return M}}),this.handleSubmit=this.handleSubmit.bind(this),this.update(t||{})}get state(){return this.store.state}get formId(){return this.options.formId}runValidator(t){return Nc(t.validate)?sn[t.type](t.value,t.validate):t.validate(t.value)}async handleSubmit(t){if(this.baseStore.setState(r=>({...r,isSubmitted:!1,submissionAttempts:r.submissionAttempts+1,isSubmitSuccessful:!1})),Ge(()=>{Object.values(this.fieldInfo).forEach(r=>{r.instance&&(r.instance.state.meta.isTouched||r.instance.setMeta(i=>({...i,isTouched:!0})))})}),!this.state.canSubmit)return;const n=t??this.options.onSubmitMeta;this.baseStore.setState(r=>({...r,isSubmitting:!0}));const s=()=>{this.baseStore.setState(r=>({...r,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){s(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:n});return}if(await this.validate("submit"),!this.state.isValid){s(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:n});return}Ge(()=>{Object.values(this.fieldInfo).forEach(r=>{r.instance?.options.listeners?.onSubmit?.({value:r.instance.state.value,fieldApi:r.instance})})}),this.options.listeners?.onSubmit?.({formApi:this,meta:n});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:n}),Ge(()=>{this.baseStore.setState(r=>({...r,isSubmitted:!0,isSubmitSuccessful:!0})),s()})}catch(r){throw this.baseStore.setState(i=>({...i,isSubmitSuccessful:!1})),s(),r}}setErrorMap(t){Ge(()=>{Object.entries(t).forEach(([n,s])=>{const r=n;if(zr(s)){const{formError:i,fieldErrors:o}=as(s);for(const a of Object.keys(this.fieldInfo))this.getFieldMeta(a)&&this.setFieldMeta(a,d=>({...d,errorMap:{...d.errorMap,[r]:o?.[a]},errorSourceMap:{...d.errorSourceMap,[r]:"form"}}));this.baseStore.setState(a=>({...a,errorMap:{...a.errorMap,[r]:i}}))}else this.baseStore.setState(i=>({...i,errorMap:{...i.errorMap,[r]:s}}))})})}}function as(e){if(e){if(zr(e)){const t=as(e.form).formError,n=e.fields;return{formError:t,fieldErrors:n}}return{formError:e}}return{formError:void 0}}function wn(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class d1{constructor(t){this.options={},this.mount=()=>{const n=this.store.mount();this.options.defaultValue!==void 0&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const s=this.getInfo();s.instance=this,this.update(this.options);const{onMount:r}=this.options.validators||{};if(r){const i=this.runValidator({validate:r,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});i&&this.setMeta(o=>({...o,errorMap:{...o?.errorMap,onMount:i},errorSourceMap:{...o?.errorSourceMap,onMount:"field"}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),n},this.update=n=>{this.options=n;const s=this.name!==n.name;if(this.name=n.name,this.state.value===void 0){const r=Nt(n.form.options.defaultValues,n.name),i=n.defaultValue??r;s?this.setValue(o=>o||i,{dontUpdateMeta:!0}):i!==void 0&&this.setValue(i,{dontUpdateMeta:!0})}this.form.getFieldMeta(this.name)===void 0&&this.setMeta(this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(n,s)=>{this.form.setFieldValue(this.name,n,s),this.triggerOnChangeListener(),this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=n=>this.form.setFieldMeta(this.name,n),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(n,s)=>{this.form.pushFieldValue(this.name,n,s),this.triggerOnChangeListener()},this.insertValue=(n,s,r)=>{this.form.insertFieldValue(this.name,n,s,r),this.triggerOnChangeListener()},this.replaceValue=(n,s,r)=>{this.form.replaceFieldValue(this.name,n,s,r),this.triggerOnChangeListener()},this.removeValue=(n,s)=>{this.form.removeFieldValue(this.name,n,s),this.triggerOnChangeListener()},this.swapValues=(n,s,r)=>{this.form.swapFieldValues(this.name,n,s,r),this.triggerOnChangeListener()},this.moveValue=(n,s,r)=>{this.form.moveFieldValues(this.name,n,s,r),this.triggerOnChangeListener()},this.clearValues=n=>{this.form.clearFieldValues(this.name,n),this.triggerOnChangeListener()},this.getLinkedFields=n=>{const s=Object.values(this.form.fieldInfo),r=[];for(const i of s){if(!i.instance)continue;const{onChangeListenTo:o,onBlurListenTo:a}=i.instance.options.validators||{};n==="change"&&o?.includes(this.name)&&r.push(i.instance),n==="blur"&&a?.includes(this.name)&&r.push(i.instance)}return r},this.validateSync=(n,s)=>{const r=Zr(n,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||Jt}),o=this.getLinkedFields(n).reduce((d,h)=>{const m=Zr(n,{...h.options,form:h.form,validationLogic:h.form.options.validationLogic||Jt});return m.forEach(u=>{u.field=h}),d.concat(m)},[]);let a=!1;Ge(()=>{const d=(h,m)=>{const u=Jn(m.cause),f=m.validate?Sa(h.runValidator({validate:m.validate,value:{value:h.store.state.value,validationSource:"field",fieldApi:h},type:"validate"})):void 0,p=s[u],{newErrorValue:y,newSource:v}=wa({formLevelError:p,fieldLevelError:f});h.state.meta.errorMap?.[u]!==y&&h.setMeta(b=>({...b,errorMap:{...b.errorMap,[u]:y},errorSourceMap:{...b.errorSourceMap,[u]:v}})),y&&(a=!0)};for(const h of r)d(this,h);for(const h of o)h.validate&&d(h.field,h)});const c=Jn("submit");return this.state.meta.errorMap?.[c]&&n!=="submit"&&!a&&this.setMeta(d=>({...d,errorMap:{...d.errorMap,[c]:void 0},errorSourceMap:{...d.errorSourceMap,[c]:void 0}})),{hasErrored:a}},this.validateAsync=async(n,s)=>{const r=Ur(n,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||Jt}),i=await s,o=this.getLinkedFields(n),a=o.reduce((u,f)=>{const p=Ur(n,{...f.options,form:f.form,validationLogic:f.form.options.validationLogic||Jt});return p.forEach(y=>{y.field=f}),u.concat(p)},[]);this.state.meta.isValidating||this.setMeta(u=>({...u,isValidating:!0}));for(const u of o)u.setMeta(f=>({...f,isValidating:!0}));const c=[],d=[],h=(u,f,p)=>{const y=Jn(f.cause);u.getInfo().validationMetaMap[y]?.lastAbortController.abort();const b=new AbortController;this.getInfo().validationMetaMap[y]={lastAbortController:b},p.push(new Promise(async x=>{let E;try{E=await new Promise((A,T)=>{this.timeoutIds.validations[f.cause]&&clearTimeout(this.timeoutIds.validations[f.cause]),this.timeoutIds.validations[f.cause]=setTimeout(async()=>{if(b.signal.aborted)return A(void 0);try{A(await this.runValidator({validate:f.validate,value:{value:u.store.state.value,fieldApi:u,signal:b.signal,validationSource:"field"},type:"validateAsync"}))}catch(M){T(M)}},f.debounceMs)})}catch(A){E=A}if(b.signal.aborted)return x(void 0);const S=Sa(E),C=i[this.name]?.[y],{newErrorValue:k,newSource:V}=wa({formLevelError:C,fieldLevelError:S});u.setMeta(A=>({...A,errorMap:{...A?.errorMap,[y]:k},errorSourceMap:{...A.errorSourceMap,[y]:V}})),x(k)}))};for(const u of r)u.validate&&h(this,u,c);for(const u of a)u.validate&&h(u.field,u,d);let m=[];(c.length||d.length)&&(m=await Promise.all(c),await Promise.all(d)),this.setMeta(u=>({...u,isValidating:!1}));for(const u of o)u.setMeta(f=>({...f,isValidating:!1}));return m.filter(Boolean)},this.validate=(n,s)=>{if(!this.state.meta.isTouched)return[];const{fieldsErrorMap:r}=s?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(n),{hasErrored:i}=this.validateSync(n,r[this.name]??{});if(i&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[Jn(n)]?.lastAbortController.abort(),this.state.meta.errors;const o=s?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(n);return this.validateAsync(n,o)},this.handleChange=n=>{this.setValue(n)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(s=>({...s,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(s=>({...s,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.parseValueWithSchema=n=>sn.validate({value:this.state.value,validationSource:"field"},n),this.parseValueWithSchemaAsync=n=>sn.validateAsync({value:this.state.value,validationSource:"field"},n),this.form=t.form,this.name=t.name,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=new ds({deps:[this.form.store],fn:()=>{const n=this.form.getFieldValue(this.name),s=this.form.getFieldMeta(this.name)??{...Es,...t.defaultMeta};return{value:n,meta:s}}}),this.options=t}get state(){return this.store.state}runValidator(t){return Nc(t.validate)?sn[t.type](t.value,t.validate):t.validate(t.value)}setErrorMap(t){this.setMeta(n=>({...n,errorMap:{...n.errorMap,...t}}))}triggerOnBlurListener(){const t=this.form.options.listeners?.onBlurDebounceMs;t&&t>0?(this.timeoutIds.formListeners.blur&&clearTimeout(this.timeoutIds.formListeners.blur),this.timeoutIds.formListeners.blur=setTimeout(()=>{this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this})},t)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});const n=this.options.listeners?.onBlurDebounceMs;n&&n>0?(this.timeoutIds.listeners.blur&&clearTimeout(this.timeoutIds.listeners.blur),this.timeoutIds.listeners.blur=setTimeout(()=>{this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})},n)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})}triggerOnChangeListener(){const t=this.form.options.listeners?.onChangeDebounceMs;t&&t>0?(this.timeoutIds.formListeners.change&&clearTimeout(this.timeoutIds.formListeners.change),this.timeoutIds.formListeners.change=setTimeout(()=>{this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this})},t)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});const n=this.options.listeners?.onChangeDebounceMs;n&&n>0?(this.timeoutIds.listeners.change&&clearTimeout(this.timeoutIds.listeners.change),this.timeoutIds.listeners.change=setTimeout(()=>{this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})},n)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})}}function Sa(e){if(e)return e}function Jn(e){switch(e){case"submit":return"onSubmit";case"blur":return"onBlur";case"mount":return"onMount";case"server":return"onServer";case"dynamic":return"onDynamic";case"change":default:return"onChange"}}class Ss{constructor(t){if(this.getFormFieldName=n=>{if(typeof this.fieldsMap=="string")return ba(this.fieldsMap,n);const s=zs(n)[0];if(typeof s!="string")return"";const r=n.slice(s.length),i=this.fieldsMap[s];return ba(i,r)},this.mount=()=>this.store.mount(),this.validateArrayFieldsStartingFrom=async(n,s,r)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(n),s,r),this.validateField=(n,s)=>this.form.validateField(this.getFormFieldName(n),s),this.getFieldValue=n=>this.form.getFieldValue(this.getFormFieldName(n)),this.getFieldMeta=n=>this.form.getFieldMeta(this.getFormFieldName(n)),this.setFieldMeta=(n,s)=>this.form.setFieldMeta(this.getFormFieldName(n),s),this.setFieldValue=(n,s,r)=>this.form.setFieldValue(this.getFormFieldName(n),s,r),this.deleteField=n=>this.form.deleteField(this.getFormFieldName(n)),this.pushFieldValue=(n,s,r)=>this.form.pushFieldValue(this.getFormFieldName(n),s,r),this.insertFieldValue=async(n,s,r,i)=>this.form.insertFieldValue(this.getFormFieldName(n),s,r,i),this.replaceFieldValue=async(n,s,r,i)=>this.form.replaceFieldValue(this.getFormFieldName(n),s,r,i),this.removeFieldValue=async(n,s,r)=>this.form.removeFieldValue(this.getFormFieldName(n),s,r),this.swapFieldValues=(n,s,r,i)=>this.form.swapFieldValues(this.getFormFieldName(n),s,r,i),this.moveFieldValues=(n,s,r,i)=>this.form.moveFieldValues(this.getFormFieldName(n),s,r,i),this.clearFieldValues=(n,s)=>this.form.clearFieldValues(this.getFormFieldName(n),s),this.resetField=n=>this.form.resetField(this.getFormFieldName(n)),this.validateAllFields=n=>this.form.validateAllFields(n),t.form instanceof Ss){const n=t.form;if(this.form=n.form,typeof t.fields=="string")this.fieldsMap=n.getFormFieldName(t.fields);else{const s={...t.fields};for(const r in s)s[r]=n.getFormFieldName(s[r]);this.fieldsMap=s}}else this.form=t.form,this.fieldsMap=t.fields;this.store=new ds({deps:[this.form.store],fn:({currDepVals:n})=>{const s=n[0];let r;if(typeof this.fieldsMap=="string")r=Nt(s.values,this.fieldsMap);else{r={};const i=this.fieldsMap;for(const o in i)r[o]=Nt(s.values,i[o])}return{values:r}}})}get state(){return this.store.state}async handleSubmit(t){return this.form.handleSubmit(t)}}const jn=typeof window<"u"?l.useLayoutEffect:l.useEffect;function f1(e){const[t]=l.useState(()=>{const s=new d1({...e,form:e.form,name:e.name});return s.Field=jc,s});return jn(t.mount,[t]),jn(()=>{t.update(e)}),we(t.store,e.mode==="array"?n=>[n.meta,Object.keys(n.value??[]).length]:void 0),t}const jc=({children:e,...t})=>{const n=f1(t),s=l.useMemo(()=>qn(e,n),[e,n,n.state.value,n.state.meta]);return g.jsx(g.Fragment,{children:s})};function h1({form:e,selector:t,children:n}){const s=we(e.store,t);return qn(n,s)}function p1(e){const[t]=l.useState(()=>{const n=new u1(e),s=n;return s.Field=function(i){return g.jsx(jc,{...i,form:n})},s.Subscribe=function(i){return g.jsx(h1,{form:n,selector:i.selector,children:i.children})},s});return jn(t.mount,[]),jn(()=>{t.update(e)}),t}function m1({lens:e,selector:t,children:n}){const s=we(e.store,t);return qn(n,s)}function g1(e){const[t]=l.useState(()=>{const n=new Ss(e),s=e.form instanceof Ss?e.form.form:e.form,r=n;return r.AppForm=function(o){return g.jsx(s.AppForm,{...o})},r.AppField=function({name:o,...a}){return g.jsx(s.AppField,{name:t.getFormFieldName(o),...a})},r.Field=function({name:o,...a}){return g.jsx(s.Field,{name:t.getFormFieldName(o),...a})},r.Subscribe=function(o){return g.jsx(m1,{lens:t,selector:o.selector,children:o.children})},Object.assign(r,{...e.formComponents})});return jn(t.mount,[t]),t}const Ca=l.createContext(null),ka=l.createContext(null);function y1(){function e(){const n=l.useContext(Ca);if(!n)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return n}function t(){const n=l.useContext(ka);if(!n)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return n}return{fieldContext:Ca,useFieldContext:e,useFormContext:t,formContext:ka}}function ro({fieldComponents:e,fieldContext:t,formContext:n,formComponents:s}){function r(a){const c=p1(a),d=l.useMemo(()=>({children:f})=>g.jsx(n.Provider,{value:c,children:f}),[c]),h=l.useMemo(()=>({children:f,...p})=>g.jsx(c.Field,{...p,children:y=>g.jsx(t.Provider,{value:y,children:f(Object.assign(y,e))})}),[c]);return l.useMemo(()=>Object.assign(c,{AppField:h,AppForm:d,...s}),[c,h,d])}function i({render:a,props:c}){return d=>a({...c,...d})}function o({render:a,props:c,defaultValues:d}){return function(m){const u=l.useMemo(()=>({form:m.form,fields:m.fields,defaultValues:d,formComponents:s}),[m.form,m.fields]),f=g1(u);return a({...c,...m,group:f})}}return{useAppForm:r,withForm:i,withFieldGroup:o}}function io(e){return g.jsxs("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...e,children:[g.jsx("title",{children:"Tooltip positioner arrow"}),g.jsx("path",{d:"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",className:"fill-gray-100 dark:fill-slate-900"}),g.jsx("path",{d:"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",className:"fill-gray-200 dark:fill-slate-900"}),g.jsx("path",{d:"M10.3333 3.34539L5.47654 7.71648C4.55842 8.54279 3.36693 9 2.13172 9H0V8H2.13172C3.11989 8 4.07308 7.63423 4.80758 6.97318L9.66437 2.60207C10.0447 2.25979 10.622 2.2598 11.0023 2.60207L15.8591 6.97318C16.5936 7.63423 17.5468 8 18.5349 8H20V9H18.5349C17.2998 9 16.1083 8.54278 15.1901 7.71648L10.3333 3.34539Z",className:"fill-gray-300 dark:fill-slate-900"})]})}const{fieldContext:oo,useFieldContext:yn,formContext:ao,useFormContext:v1}=y1();function b1({id:e,name:t,label:n,...s}){const r=yn();return g.jsxs("fieldset",{children:[g.jsx("legend",{className:"sr-only",children:t}),g.jsxs("div",{className:"flex items-center gap-3",children:[g.jsx("div",{className:"flex h-6 shrink-0 items-center",children:g.jsx("div",{className:"group grid size-4 grid-cols-1",children:g.jsx(Hp,{...s,id:e,name:t,checked:r.state.value||!1,onBlur:r.handleBlur,onChange:r.handleChange,className:"group col-start-1 row-start-1 appearance-none rounded-sm border border-gray-300 dark:border-slate-800 bg-white dark:bg-slate-700 checked:border-indigo-600 data-[checked]:border-indigo-600 checked:bg-indigo-600 data-[checked]:bg-indigo-600 indeterminate:border-indigo-600 indeterminate:bg-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:border-gray-300 disabled:bg-gray-100 disabled:checked:bg-gray-100 forced-colors:appearance-auto size-5 inline-flex items-center justify-center",children:g.jsx(wt,{className:"group-data-checked:opacity-100 stroke-white text-white opacity-0 size-4","aria-hidden":"true"})})})}),g.jsx("div",{className:"text-sm/6 mt-1",children:g.jsx("label",{htmlFor:t||e,className:"font-medium text-gray-900 dark:text-white",children:n})})]})]})}function Ht(...e){return e.filter(Boolean).join(" ")}function Gr(){return g.jsx("div",{className:"flex items-center justify-center",children:g.jsx("div",{className:"w-6 h-6 border-4 border-gray-600 rounded-full animate-spin border-t-transparent"})})}function Lc({status:e,tooltip:t,children:n}){const s=v1();return g.jsx(s.Subscribe,{selector:r=>({canSubmit:r.canSubmit,isSubmitting:r.isSubmitting,valid:r.isValid&&r.errors.length===0,dirty:r.isDirty}),children:({canSubmit:r,isSubmitting:i,valid:o,dirty:a})=>t?g.jsx(so,{delay:300,closeDelay:1e3,children:g.jsxs(Wi,{disabled:t.disabled||!1,children:[g.jsx(Xi,{type:"submit",disabled:!r||!o||!a||i,"data-state":e,className:Ht("rounded-md bg-indigo-600 dark:bg-indigo-500 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-indigo-500 dark:hover:bg-indigo-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500 inline-flex items-center gap-x-2 cursor-pointer","disabled:bg-gray-400 disabled:text-gray-900 disabled:hover:bg-gray-400 disabled:focus-visible:outline-gray-400 disabled:cursor-not-allowed","data-[state=error]:bg-red-600 data-[state=error]:hover:bg-red-500 data-[state=error]:focus-visible:bg-red-500 data-[state=success]:focus-visible:bg-green-500","data-[state=success]:bg-green-600 data-[state=success]:hover:bg-green-500"),children:e==="submitting"?g.jsx(Gr,{}):e==="success"?g.jsxs(g.Fragment,{children:[g.jsx(wt,{className:"size-5 text-white","aria-hidden":"true"}),n]}):e==="error"?g.jsxs(g.Fragment,{children:[g.jsx($r,{className:"size-5 text-white","aria-hidden":"true"}),"Error"]}):n}),g.jsx(Ji,{children:g.jsx(eo,{side:"top",sideOffset:10,children:g.jsxs(to,{className:"box-border text-sm flex flex-col px-2 py-3 rounded-lg bg-gray-100 dark:bg-slate-900 transform-content data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 w-fit max-w-xs",children:[g.jsx(no,{className:"flex data-[side=top]:-bottom-2 data-[side=top]:rotate-180 data-[side=bottom]:-top-2 data-[side=bottom]:rotate-0 data-[side=left]:-right-3 data-[side=left]:rotate-90 data-[side=right]:-left-3 data-[side=right]:-rotate-90",children:g.jsx(io,{})}),g.jsx("span",{className:"text-xs text-gray-700 dark:text-white whitespace-break-spaces w-full",children:t.content})]})})})]})}):g.jsx("button",{type:"submit",disabled:!r||!o||!a||i,"data-state":e,className:Ht("rounded-md bg-indigo-600 dark:bg-indigo-500 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-indigo-500 dark:hover:bg-indigo-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500 inline-flex items-center gap-x-2 cursor-pointer","disabled:bg-gray-400 disabled:text-gray-900 disabled:hover:bg-gray-400 disabled:focus-visible:outline-gray-400 disabled:cursor-not-allowed","data-[state=error]:bg-red-600 data-[state=error]:hover:bg-red-500 data-[state=error]:focus-visible:bg-red-500 data-[state=success]:focus-visible:bg-green-500","data-[state=success]:bg-green-600 data-[state=success]:hover:bg-green-500"),children:e==="submitting"?g.jsx(Gr,{}):e==="success"?g.jsxs(g.Fragment,{children:[g.jsx(wt,{className:"size-5 text-white","aria-hidden":"true"}),n]}):e==="error"?g.jsxs(g.Fragment,{children:[g.jsx($r,{className:"size-5 text-white","aria-hidden":"true"}),"Error"]}):n})})}function Gs({id:e,errors:t}){return g.jsx("div",{id:e,className:"mt-2 flex flex-col gap-y-1 w-full",children:t.map((n,s)=>{const r=`${e}__errorMessage__${s}`;return g.jsx("div",{className:"text-sm text-red-600 dark:text-red-500 w-full",children:typeof n=="string"?n:n.message},r)})})}function Dc({id:e,label:t,hint:n,...s}){const r=yn(),i=we(r.store,c=>c.meta.errors),o=we(r.store,c=>c.meta.isTouched),a=i.length>0&&o;return g.jsxs("div",{children:[t!=null?g.jsxs("label",{htmlFor:s.name,className:"block text-sm/6 font-medium text-gray-900 dark:text-white",children:[t,s.required?"*":""]}):null,g.jsxs("div",{className:Ht("grid grid-cols-1",t!=null?"mt-2":"mt-0"),children:[g.jsx("div",{"data-state":a?"invalid":void 0,className:"col-start-1 row-start-1 flex items-center rounded-md bg-white dark:bg-white/5 pl-3 outline -outline-offset-1 outline-gray-300 dark:outline-white/10 data-[state=invalid]:outline-red-300 dark:data-[state=invalid]:outline-red-600 focus-within:outline-2 focus-within:-outline-offset-2 focus-within:outline-indigo-600 dark:focus-within:outline-indigo-500 data-[state=invalid]:focus-within:outline-red-600 dark:data-[state=invalid]:focus-within:outline-red-400",children:g.jsx(b0,{...s,value:r.state.value,onBlur:r.handleBlur,onChange:c=>{r.handleChange(c.target.value),s.onChange?.(c)},"data-state":a?"invalid":void 0,"aria-invalid":a?"true":void 0,"aria-describedby":a?`${e}-invalid`:n!=null?`${e}-hint`:void 0,className:"block min-w-0 grow py-1.5 pl-1 pr-3 data-[state=invalid]:pr-10 text-base text-gray-900 dark:text-white data-[state=invalid]:text-red-900 dark:data-[state=invalid]:text-red-700 placeholder:text-gray-400 dark:placeholder:text-gray-500 data-[state=invalid]:placeholder:text-red-700 dark:data-[state=invalid]:placeholder:text-red-400 focus:outline sm:text-sm/6 focus-visible:outline-none"})}),a?g.jsx(Gs,{id:`${e}-invalid`,errors:i}):null,n!=null&&!a?g.jsx("p",{id:`${e}-hint`,className:"mt-3 text-sm/6 text-gray-400",children:n}):null]})]})}function Ve({children:e,...t}){return g.jsx("span",{...t,className:"text-xs inline font-light text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-slate-600 ring-gray-500/10 rounded-md px-1.5 py-0.5 whitespace-nowrap ring-1 ring-inset",children:e})}const x1=Ie({spaceId:cn,name:cn}),{useAppForm:w1}=ro({fieldComponents:{SchemaSpaceSelect:S1},formComponents:{SubmitButton:Lc},fieldContext:oo,formContext:ao});function E1({open:e,setOpen:t,spaceSubmitted:n}){const{setAppSchemaSpace:s}=Ja(),i=w1({defaultValues:{spaceId:"",name:""},validators:{onChange:el(x1)},onSubmit({value:a}){const c={id:ie(a.spaceId),name:a.name};s(c),n(c)}}),o=we(i.store,a=>a.values.name);return g.jsxs(t0,{open:e,onClose:t,className:"relative z-10",children:[g.jsx(e0,{transition:!0,className:"fixed inset-0 bg-gray-500/75 transition-opacity data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in dark:bg-gray-900/50"}),g.jsx("form",{noValidate:!0,className:"fixed inset-0 z-10 w-screen overflow-y-auto",onSubmit:a=>{a.preventDefault(),a.stopPropagation(),i.handleSubmit()},children:g.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:g.jsxs(vc,{transition:!0,className:"relative transform overflow-hidden rounded-lg bg-white px-4 pt-5 pb-4 text-left shadow-xl transition-all data-closed:translate-y-4 data-closed:opacity-0 data-enter:duration-300 data-enter:ease-out data-leave:duration-200 data-leave:ease-in sm:my-8 sm:w-full sm:max-w-lg sm:p-6 data-closed:sm:translate-y-0 data-closed:sm:scale-95 dark:bg-gray-800 dark:outline dark:-outline-offset-1 dark:outline-white/10",children:[g.jsx("div",{className:"absolute top-0 right-0 hidden pt-4 pr-4 sm:block",children:g.jsxs("button",{type:"button",onClick:()=>t(!1),className:"rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-2 focus:outline-offset-2 focus:outline-indigo-600 dark:bg-gray-800 dark:hover:text-gray-300 dark:focus:outline-white",children:[g.jsx("span",{className:"sr-only",children:"Close"}),g.jsx(Ai,{"aria-hidden":"true",className:"size-6"})]})}),g.jsxs("div",{className:"sm:flex sm:items-start",children:[g.jsx("div",{className:"mx-auto flex size-12 shrink-0 items-center justify-center rounded-full bg-yellow-100 sm:mx-0 sm:size-10 dark:bg-yellow-500/10",children:g.jsx(Ii,{"aria-hidden":"true",className:"size-6 text-yellow-600 dark:text-yellow-400"})}),g.jsxs("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[g.jsx(bc,{as:"h3",className:"text-base font-semibold text-gray-900 dark:text-white",children:"Select Space"}),g.jsx("div",{className:"mt-2 flex flex-col gap-y-4 w-full",children:g.jsx(i.AppField,{name:"spaceId",children:a=>g.jsx(a.SchemaSpaceSelect,{id:"spaceId",name:"spaceId",spaceSelected:c=>{i.setFieldValue("name",c.name||c.id),i.setFieldValue("spaceId",c.id)}})})})]})]}),g.jsxs("div",{className:"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse sm:gap-x-2",children:[g.jsx(i.AppForm,{children:g.jsxs(i.SubmitButton,{status:"idle",children:["Select Space ",g.jsx(Ve,{children:o})," & Publish"]})}),g.jsx("button",{type:"button",onClick:()=>{i.reset(void 0,{keepDefaultValues:!0}),t(!1)},className:"mt-3 inline-flex w-full justify-center rounded-md bg-white px-3 py-2 text-sm font-semibold text-gray-900 shadow-xs inset-ring-1 inset-ring-gray-300 hover:bg-gray-50 sm:mt-0 sm:w-auto dark:bg-white/10 dark:text-white dark:shadow-none dark:inset-ring-white/5 dark:hover:bg-white/20",children:"Cancel"})]})]})})})]})}function S1({id:e,name:t,spaceSelected:n}){const{redirectToConnect:s}=Jr(),{authenticated:r}=tl(),{data:i=[],isPending:o}=uf({mode:"public"}),a=yn(),c=we(a.store,u=>u.value),d=we(a.store,u=>u.meta.errors),h=we(a.store,u=>u.meta.isTouched),m=d.length>0&&h;return r?!o&&i.length===0?g.jsxs("div",{className:"w-full flex flex-col gap-y-2",children:[g.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300",children:"Schemas need to be published to a public Space you have granted access to this app"}),g.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300",children:"Reconnect to Geo connect and connect public spaces"}),g.jsx("button",{type:"button",className:"rounded-full bg-slate-900 flex items-center justify-center px-3 py-1.5 text-sm font-semibold text-white shadow-xs ring-1 ring-white/10 ring-inset hover:bg-white/10 cursor-pointer w-full",onClick:()=>s({storage:localStorage,connectUrl:"https://connect.geobrowser.io/",successUrl:`${window.location.origin}/authenticate-callback`,redirectFn(u){window.location.href=u.toString()}}),children:"Connect Spaces"})]}):g.jsxs("div",{className:"relative flex flex-col gap-y-2 w-full",children:[g.jsxs("fieldset",{id:e,name:t,"aria-label":"App Schema Space",onBlur:a.handleBlur,className:"relative -space-y-px rounded-md bg-white dark:bg-gray-800/50 w-full flex flex-col gap-y-2",children:[g.jsx("legend",{className:"mt-1 text-sm/6 text-gray-600 dark:text-gray-400",children:"Select the Space to publish your Hypergraph shema to."}),i.map(u=>g.jsxs("label",{"aria-label":u.name||u.id,"aria-description":`space-${u.id}`,className:"group flex border border-gray-200 p-4 first:rounded-tl-md first:rounded-tr-md last:rounded-br-md last:rounded-bl-md focus:outline-hidden has-checked:relative has-checked:border-indigo-200 has-checked:bg-indigo-50 dark:border-gray-700 dark:has-checked:border-indigo-800 dark:has-checked:bg-indigo-500/10 w-full cursor-pointer",children:[g.jsx("input",{value:u.id,checked:u.id===c,onChange:f=>{f.target.checked&&(a.handleChange(u.id),n(u))},name:t,type:"radio",className:"relative mt-0.5 size-4 shrink-0 appearance-none rounded-full border border-gray-300 bg-white before:absolute before:inset-1 before:rounded-full before:bg-white not-checked:before:hidden checked:border-indigo-600 checked:bg-indigo-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:border-gray-300 disabled:bg-gray-100 disabled:before:bg-gray-400 dark:border-white/10 dark:bg-white/5 dark:checked:border-indigo-500 dark:checked:bg-indigo-500 dark:focus-visible:outline-indigo-500 dark:disabled:border-white/5 dark:disabled:bg-white/10 dark:disabled:before:bg-white/20 forced-colors:appearance-auto forced-colors:before:hidden"}),g.jsxs("span",{className:"ml-3 flex flex-col gap-y-1",children:[g.jsx("span",{className:"flex items-center gap-x-2 text-sm font-medium text-gray-900 group-has-checked:text-indigo-900 dark:text-white dark:group-has-checked:text-indigo-300",children:u.name||u.id}),g.jsx("span",{className:"block text-sm text-gray-500 group-has-checked:text-indigo-700 dark:text-gray-400 dark:group-has-checked:text-indigo-300/75",children:u.name!=null?g.jsx(Ve,{children:u.id}):null})]})]},u.id))]}),m?g.jsx(Gs,{id:`${e}-invalid`,errors:d}):null]}):g.jsx("button",{type:"button",className:"rounded-full bg-slate-900 flex items-center justify-center px-3 py-1.5 text-sm font-semibold text-white shadow-xs ring-1 ring-white/10 ring-inset hover:bg-white/10 cursor-pointer w-full",onClick:()=>s({storage:localStorage,connectUrl:"https://connect.geobrowser.io/",successUrl:`${window.location.origin}/authenticate-callback`,redirectFn(u){window.location.href=u.toString()}}),children:"Sign in to Geo Account"})}const C1={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"SchemaBrowserTypes"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"first"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"typesList"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"Variable",name:{kind:"Name",value:"first"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"properties"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"dataType"}},{kind:"Field",name:{kind:"Name",value:"relationValueTypes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"properties"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"dataType"}}]}}]}}]}}]}}]}}]},k1={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"TypeSearch"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"String"}}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"first"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",alias:{kind:"Name",value:"typesList"},name:{kind:"Name",value:"search"},arguments:[{kind:"Argument",name:{kind:"Name",value:"query"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}},{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"Variable",name:{kind:"Name",value:"first"}}},{kind:"Argument",name:{kind:"Name",value:"filter"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"backlinksExist"},value:{kind:"BooleanValue",value:!0}},{kind:"ObjectField",name:{kind:"Name",value:"typeIds"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"in"},value:{kind:"ListValue",values:[{kind:"StringValue",value:"e7d737c5-3676-4c60-9fa1-6aa64a8c90ad",block:!1}]}}]}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"properties"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"dataType"}},{kind:"Field",name:{kind:"Name",value:"relationValueTypes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"properties"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"dataType"}}]}}]}}]}}]}}]}}]},T1={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"query",name:{kind:"Name",value:"Properties"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"query"}},type:{kind:"NamedType",name:{kind:"Name",value:"String"}}},{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"first"}},type:{kind:"NamedType",name:{kind:"Name",value:"Int"}}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"properties"},arguments:[{kind:"Argument",name:{kind:"Name",value:"first"},value:{kind:"Variable",name:{kind:"Name",value:"first"}}},{kind:"Argument",name:{kind:"Name",value:"filter"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"or"},value:{kind:"ListValue",values:[{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"name"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"includesInsensitive"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}}]}}]},{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"description"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"includesInsensitive"},value:{kind:"Variable",name:{kind:"Name",value:"query"}}}]}}]}]}}]}}],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"dataType"}},{kind:"Field",name:{kind:"Name",value:"relationValueTypes"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"name"}},{kind:"Field",name:{kind:"Name",value:"description"}},{kind:"Field",name:{kind:"Name",value:"properties"},selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"}},{kind:"Field",name:{kind:"Name",value:"dataType"}},{kind:"Field",name:{kind:"Name",value:"name"}}]}}]}}]}}]}}]},M1={"\n query SchemaBrowserTypes($first: Int) {\n typesList(first: $first) {\n id\n name\n description\n properties {\n id\n name\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n name\n dataType\n }\n }\n }\n }\n }\n":C1,'\n query TypeSearch($query: String!, $first: Int) {\n typesList: search(\n query: $query\n first: $first\n filter: {backlinksExist: true, typeIds: {in: ["e7d737c5-3676-4c60-9fa1-6aa64a8c90ad"]}}\n ) {\n id\n name\n description\n properties {\n id\n name\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n name\n dataType\n }\n }\n }\n }\n }\n':k1,"\n query Properties($query: String, $first: Int) {\n properties(\n first: $first\n filter: {or: [{name: {includesInsensitive: $query}}, {description: {includesInsensitive: $query}}]}\n ) {\n id\n name\n description\n dataType\n relationValueTypes {\n id\n name\n description\n properties {\n id\n dataType\n name\n }\n }\n }\n }\n":T1};function lo(e){return M1[e]??{}}const R1=lo(`
17
- query SchemaBrowserTypes($first: Int) {
18
- typesList(first: $first) {
19
- id
20
- name
21
- description
22
- properties {
23
- id
24
- name
25
- dataType
26
- relationValueTypes {
27
- id
28
- name
29
- description
30
- properties {
31
- id
32
- name
33
- dataType
34
- }
35
- }
36
- }
37
- }
38
- }
39
- `),O1=lo(`
40
- query TypeSearch($query: String!, $first: Int) {
41
- typesList: search(
42
- query: $query
43
- first: $first
44
- filter: {backlinksExist: true, typeIds: {in: ["e7d737c5-3676-4c60-9fa1-6aa64a8c90ad"]}}
45
- ) {
46
- id
47
- name
48
- description
49
- properties {
50
- id
51
- name
52
- dataType
53
- relationValueTypes {
54
- id
55
- name
56
- description
57
- properties {
58
- id
59
- name
60
- dataType
61
- }
62
- }
63
- }
64
- }
65
- }
66
- `);async function F1(e=null,t=100){try{return e?await Cr.request(O1,{query:e,first:t}):await Cr.request(R1,{first:t})}catch{return console.error("failure fetching schema types"),{__typename:"Query",typesList:[]}}}const $c=Ie({id:lt,dataType:Yr("STRING","NUMBER","BOOLEAN","TIME","POINT","RELATION"),name:cn}),I1=Ie({id:lt,name:cn,description:rn(cn),properties:rn(Et($c))}),Hc=Ie({...$c.fields,relationValueTypes:Et(I1)}),A1=Ie({id:lt,name:cn,properties:Et(Hc)});A1.pipe(Xr(Ie({slug:De})));const P1=nl(sl,e=>e.name||e.id);function V1(e){const t=se(e.properties??[],ye(n=>n!=null),at("",(n,s)=>`${n}${s.name}`));return`${e.name||""}${t}`.toLowerCase()}const N1=e=>({queryKey:["Hypergraph","Typesync","Studio","Schema","types",e],async queryFn(){return await F1(e.query,e.first||void 0).then(t=>t.typesList??[]).then(t=>se(t,ye(n=>n!=null&&n.name!=null),be(n=>{const s=se(n.properties??[],ye(o=>o!=null&&o.name!=null),be(o=>({id:o.id,dataType:o.dataType,name:o.name,relationValueTypes:se(o.relationValueTypes??[],ye(a=>a!=null&&a.name!=null),be(a=>({id:a.id,name:a.name,description:a.description||null,properties:se(a.properties??[],ye(c=>c.name!=null),be(c=>({id:c.id,dataType:c.dataType,name:c.name})))})))}))),r={id:n.id,name:n.name,properties:s},i=V1(r);return{...r,slug:i}}),rl(P1)))}});function _c(e={query:null,first:100},t={}){return El({...N1(e),...t})}const j1=lo(`
67
- query Properties($query: String, $first: Int) {
68
- properties(
69
- first: $first
70
- filter: {or: [{name: {includesInsensitive: $query}}, {description: {includesInsensitive: $query}}]}
71
- ) {
72
- id
73
- name
74
- description
75
- dataType
76
- relationValueTypes {
77
- id
78
- name
79
- description
80
- properties {
81
- id
82
- dataType
83
- name
84
- }
85
- }
86
- }
87
- }
88
- `);async function L1(e=null,t=100){try{return await Cr.request(j1,{query:e,first:t})}catch{return console.error("failure fetching schema types"),{__typename:"Query",properties:[]}}}Hc.pipe(Xr(Ie({description:rn(De),slug:sd})));const D1=nl(sl,e=>e.name||e.id),$1=e=>({queryKey:["Hypergraph","Typesync","Studio","Schema","properties",e],async queryFn(){return await L1(e.query,e.first||void 0).then(t=>t.properties??[]).then(t=>se(t,ye(n=>n.name!=null),be(n=>{const s=`${n.dataType}${n.name||""}${n.id}`.toLowerCase();return{id:n.id,dataType:n.dataType,name:n.name,description:n.description||null,relationValueTypes:se(n.relationValueTypes??[],ye(i=>i!=null&&i.name!=null),be(i=>({id:i.id,name:i.name,description:i.description||null,properties:se(i.properties??[],ye(o=>o.name!=null),be(o=>({id:o.id,dataType:o.dataType,name:o.name})))}))),slug:s}}),rl(D1)))}});function H1(e={query:null,first:100},t={}){return El({...$1(e),...t})}function It(e,t){switch(e){case"BOOLEAN":return"Boolean";case"NUMBER":return"Number";case"POINT":return"Point";case"TIME":return"Date";case"RELATION":return`Relation(${t})`;default:return"String"}}const{useAppForm:_1}=ro({fieldComponents:{TextField:Dc},formComponents:{},fieldContext:oo,formContext:ao});function B1({typeSelected:e}){const[t,n]=l.useState(""),s=_1({defaultValues:{search:""},asyncDebounceMs:300}),{data:r,isLoading:i}=_c({query:ut(t)?Dt(t):null,first:100},{refetchOnMount:!1,refetchOnWindowFocus:!1});return g.jsxs("div",{className:"flex flex-col gap-y-6",children:[g.jsxs("div",{className:"border-b border-gray-200 dark:border-white/20 pb-5 h-20",children:[g.jsxs("h3",{className:"text-sm/6 font-semibold text-gray-900 dark:text-white flex items-center gap-x-3",children:["Schema Browser",i?g.jsx(Gr,{}):null]}),g.jsx("p",{className:"mt-2 max-w-4xl text-sm text-gray-500 dark:text-gray-200",children:"Browse existing schemas/types from the Knowledge Graph to add to your schema."})]}),g.jsxs("div",{className:"bg-gray-100 dark:bg-slate-900 rounded-lg flex flex-col gap-y-3 pt-2",children:[g.jsx("div",{className:"px-3 mt-2",children:g.jsx(s.AppField,{name:"search",listeners:{onChangeDebounceMs:300,onChange({value:o}){n(o)}},children:o=>g.jsx(o.TextField,{id:"search",name:"search",type:"search",placeholder:"Search Knowledge Graph types..."})})}),g.jsx("ul",{className:"px-4 divide-y divide-gray-100 dark:divide-gray-700 overflow-y-auto h-[500px] 2xl:h-[850px]",children:(r??[]).map(o=>{const a=ye(o.properties??[],c=>c!=null);return g.jsxs(g0,{as:"li",className:"py-3 flex flex-col gap-y-2",children:[g.jsxs("div",{className:"flex items-center justify-between gap-x-6",children:[g.jsx(wc,{as:"div","data-interactive":"clickable",className:"min-w-0 data-[interactive=clickable]:cursor-pointer group",children:g.jsxs("div",{className:"flex items-center gap-x-2",children:[g.jsx(Gl,{className:"size-4 hidden group-data-open:flex","aria-hidden":"true"}),g.jsx(Kl,{className:"size-4 flex group-data-open:hidden","aria-hidden":"true"}),g.jsx("p",{className:"text-sm/6 font-semibold text-gray-900 dark:text-white",children:o.name||o.id}),g.jsx("div",{className:"hidden 2xl:block",children:g.jsx(Ve,{children:o.id})}),g.jsx("div",{className:"block 2xl:hidden",children:g.jsx(Ve,{children:`${o.id.substring(0,6)}...${o.id.substring(o.id.length-6,o.id.length)}`})})]})}),g.jsx("div",{className:"flex flex-none items-center justify-end",children:g.jsx("button",{type:"button",className:"rounded-md bg-white dark:bg-black p-2 cursor-pointer text-sm font-semibold text-gray-900 dark:text-white shadow-xs ring-1 ring-gray-300 dark:ring-black/15 ring-inset hover:bg-gray-50 dark:hover:bg-slate-950 inline-flex flex-col items-center justify-center",onClick:()=>e(o),children:g.jsx(xs,{className:"size-5 text-gray-400 dark:text-gray-200 group-data-focus:text-gray-500 dark:group-data-focus:text-gray-200","aria-hidden":"true"})})})]}),g.jsx(Ec,{as:"div",transition:!0,className:"w-full origin-top transition duration-200 ease-out data-closed:-translate-y-6 data-closed:opacity-0 py-1.5 flex flex-col gap-y-1",children:g.jsx("ul",{className:"w-full pl-6 pr-3 divide-y divide-gray-300 dark:divide-gray-800",children:a.map(c=>g.jsxs("li",{className:"w-full text-xs py-1.5 flex items-center gap-x-2 list-disc",children:[c.name||c.id,c.dataType!=null?g.jsx(Ve,{children:It(c.dataType,c.name||c.id)}):null]},c.id))})})]},o.id)})})]})]})}var pr,Ta;function q1(){if(Ta)return pr;Ta=1;var e="Expected a function",t=NaN,n="[object Symbol]",s=/^\s+|\s+$/g,r=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,a=parseInt,c=typeof Zn=="object"&&Zn&&Zn.Object===Object&&Zn,d=typeof self=="object"&&self&&self.Object===Object&&self,h=c||d||Function("return this")(),m=Object.prototype,u=m.toString,f=Math.max,p=Math.min,y=function(){return h.Date.now()};function v(C,k,V){var A,T,M,F,I,w,P=0,L=!1,$=!1,O=!0;if(typeof C!="function")throw new TypeError(e);k=S(k)||0,b(V)&&(L=!!V.leading,$="maxWait"in V,M=$?f(S(V.maxWait)||0,k):M,O="trailing"in V?!!V.trailing:O);function R(N){var D=A,B=T;return A=T=void 0,P=N,F=C.apply(B,D),F}function H(N){return P=N,I=setTimeout(z,k),L?R(N):F}function Z(N){var D=N-w,B=N-P,G=k-D;return $?p(G,M-B):G}function W(N){var D=N-w,B=N-P;return w===void 0||D>=k||D<0||$&&B>=M}function z(){var N=y();if(W(N))return _(N);I=setTimeout(z,Z(N))}function _(N){return I=void 0,O&&A?R(N):(A=T=void 0,F)}function q(){I!==void 0&&clearTimeout(I),P=0,A=w=T=I=void 0}function X(){return I===void 0?F:_(y())}function j(){var N=y(),D=W(N);if(A=arguments,T=this,w=N,D){if(I===void 0)return H(w);if($)return I=setTimeout(z,k),R(w)}return I===void 0&&(I=setTimeout(z,k)),F}return j.cancel=q,j.flush=X,j}function b(C){var k=typeof C;return!!C&&(k=="object"||k=="function")}function x(C){return!!C&&typeof C=="object"}function E(C){return typeof C=="symbol"||x(C)&&u.call(C)==n}function S(C){if(typeof C=="number")return C;if(E(C))return t;if(b(C)){var k=typeof C.valueOf=="function"?C.valueOf():C;C=b(k)?k+"":k}if(typeof C!="string")return C===0?C:+C;C=C.replace(s,"");var V=i.test(C);return V||o.test(C)?a(C.slice(2),V?2:8):r.test(C)?t:+C}return pr=v,pr}var Z1=q1();const Bc=rd(Z1);function U1({id:e,label:t,propertySelected:n,...s}){const r=yn(),i=we(r.store,p=>p.value),o=we(r.store,p=>p.meta.errors),a=we(r.store,p=>p.meta.isTouched),c=o.length>0&&a,[d,h]=l.useState(""),m=Bc(p=>{h(p)},300),{data:u}=H1({query:ut(d)?Dt(d):null,first:50},{refetchOnMount:!1,refetchOnWindowFocus:!1}),f=u??[];return g.jsxs(lc,{value:i,onChange:p=>{if(p==null){r.handleChange("");return}if(typeof p=="string"){r.handleChange(p);return}r.handleChange(p.name||p.id),n(p)},onClose:()=>m(""),immediate:!0,children:[t!=null?g.jsxs($n,{htmlFor:s.name||e,className:"block text-sm/6 font-medium text-gray-900 dark:text-white",children:[t,s.required?"*":""]}):null,g.jsxs("div",{className:Ht("grid grid-cols-1 relative",t!=null?"mt-2":"mt-0"),children:[g.jsx(Di,{className:"block min-w-0 grow py-1.5 pr-12 data-[state=invalid]:pr-10 text-base bg-white dark:bg-white/5 pl-3 outline -outline-offset-1 outline-gray-300 dark:outline-white/10 rounded-md text-gray-900 dark:text-white data-[state=invalid]:text-red-900 dark:data-[state=invalid]:text-red-700 placeholder:text-gray-400 dark:placeholder:text-gray-500 data-[state=invalid]:placeholder:text-red-700 dark:data-[state=invalid]:placeholder:text-red-400 focus:outline sm:text-sm/6 focus-visible:outline-none",onChange:p=>{const y=p.target.value;m(y),r.handleChange(y)},onBlur:()=>h(""),displayValue:p=>p}),g.jsx(Li,{className:"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-hidden cursor-pointer",children:g.jsx($s,{className:"size-5 text-gray-400 dark:text-gray-50","aria-hidden":"true"})}),f.length>0||ut(d)?g.jsxs($i,{className:"absolute z-10 mt-10 max-h-60 w-fit max-w-lg 2xl:max-w-xl overflow-auto rounded-md bg-white dark:bg-slate-700 py-1 text-base shadow-lg ring-1 ring-black/5 dark:ring-black/10 focus:outline-hidden sm:text-sm",children:[f.map(p=>g.jsxs(Nn,{value:p,"data-selected":i===p.name||i===p.id?!0:void 0,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",children:[g.jsxs("div",{className:"flex-auto flex flex-col gap-y-1",children:[g.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[g.jsxs("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-100 group-data-focus:text-gray-900 dark:group-data-focus:text-white flex items-center gap-x-1.5",children:[p.name||p.id,g.jsx(Ve,{children:It(p.dataType,p.name||p.id)})]}),g.jsx("p",{className:"hidden 2xl:block 2xl:w-fit",children:g.jsx(Ve,{children:p.id})}),g.jsx("p",{className:"w-fit block 2xl:hidden",children:g.jsx(Ve,{children:id(p.id)})})]}),g.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-300 group-data-focus:text-gray-700 dark:group-data-focus:text-gray-50",children:p.description})]}),g.jsx("span",{className:"absolute inset-y-0 right-0 hidden items-center pr-4 text-indigo-600 group-data-focus:text-white group-data-selected:flex",children:g.jsx(wt,{className:"size-5","aria-hidden":"true"})})]},p.id)),ut(d)?g.jsx(Nn,{value:d,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden border-t border-gray-300 dark:border-white/10",children:g.jsxs("span",{className:"flex items-center gap-x-1.5 truncate group-data-selected:font-semibold",children:["New Property: ",g.jsx(Ve,{children:d})]})},"user_entered"):null]}):null]}),c?g.jsx(Gs,{id:`${e}-invalid`,errors:o}):null]})}function Ma({status:e}){const t=ig[e||"typesync_ui"];return g.jsx(so,{delay:500,closeDelay:500,children:g.jsxs(Wi,{children:[g.jsx(Xi,{"aria-label":e||void 0,children:g.jsx(z1,{status:e})}),g.jsx(Ji,{children:g.jsx(eo,{side:"top",sideOffset:10,children:g.jsxs(to,{className:"box-border text-sm flex flex-col px-2 py-3 rounded-lg bg-gray-100 dark:bg-slate-900 transform-content data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 w-fit max-w-xs",children:[g.jsx(no,{className:"flex data-[side=top]:-bottom-2 data-[side=top]:rotate-180 data-[side=bottom]:-top-2 data-[side=bottom]:rotate-0 data-[side=left]:-right-3 data-[side=left]:rotate-90 data-[side=right]:-left-3 data-[side=right]:-rotate-90",children:g.jsx(io,{})}),g.jsx("span",{className:"text-xs text-gray-700 dark:text-white whitespace-break-spaces w-full",children:t})]})})})]})})}function z1({status:e}){return e==="published"?g.jsx(W1,{className:"size-4 text-inherit","aria-hidden":"true"}):e==="published_not_synced"?g.jsx(rg,{className:"size-4 text-inherit","aria-hidden":"true"}):e==="synced"?g.jsx(tg,{className:"size-4 text-inherit","aria-hidden":"true"}):g.jsx(X1,{className:"size-4 text-inherit","aria-hidden":"true"})}function G1(e){return g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"hidden dark:inline-block",...e,children:[g.jsx("title",{children:"Exists in Knowledge Graph | Dark Mode"}),g.jsxs("g",{clipPath:"url(#clip0_59284_4458)",children:[g.jsx("circle",{cx:"8.0032",cy:"1.75",r:"1.25",stroke:"white"}),g.jsx("circle",{cx:"8.0032",cy:"14.25",r:"1.25",stroke:"white"}),g.jsx("path",{d:"M7.99641 13.255L8.0032 2.75",stroke:"white"}),g.jsx("circle",{cx:"13.4159",cy:"5.125",r:"1.25",transform:"rotate(60 13.4159 5.125)",stroke:"white"}),g.jsx("circle",{cx:"2.59055",cy:"11.375",r:"1.25",transform:"rotate(60 2.59055 11.375)",stroke:"white"}),g.jsx("path",{d:"M3.44885 10.8716L12.5498 5.625",stroke:"white"}),g.jsx("circle",{cx:"13.4159",cy:"11.375",r:"1.25",transform:"rotate(120 13.4159 11.375)",stroke:"white"}),g.jsx("circle",{cx:"2.59055",cy:"5.125",r:"1.25",transform:"rotate(120 2.59055 5.125)",stroke:"white"}),g.jsx("path",{d:"M3.45564 5.61662L12.5498 10.875",stroke:"white"})]}),g.jsx("defs",{children:g.jsx("clipPath",{id:"clip0_59284_4458",children:g.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function K1(e){return g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"inline-block dark:hidden",...e,children:[g.jsx("title",{children:"Exists in Knowledge Graph | Light Mode"}),g.jsxs("g",{clipPath:"url(#clip0_59285_4572)",children:[g.jsx("circle",{cx:"8.0032",cy:"1.75",r:"1.25",stroke:"#2A2A2A"}),g.jsx("circle",{cx:"8.0032",cy:"14.25",r:"1.25",stroke:"#2A2A2A"}),g.jsx("path",{d:"M7.99641 13.255L8.0032 2.75",stroke:"#2A2A2A"}),g.jsx("circle",{cx:"13.4159",cy:"5.125",r:"1.25",transform:"rotate(60 13.4159 5.125)",stroke:"#2A2A2A"}),g.jsx("circle",{cx:"2.59055",cy:"11.375",r:"1.25",transform:"rotate(60 2.59055 11.375)",stroke:"#2A2A2A"}),g.jsx("path",{d:"M3.44885 10.8716L12.5498 5.625",stroke:"#2A2A2A"}),g.jsx("circle",{cx:"13.4159",cy:"11.375",r:"1.25",transform:"rotate(120 13.4159 11.375)",stroke:"#2A2A2A"}),g.jsx("circle",{cx:"2.59055",cy:"5.125",r:"1.25",transform:"rotate(120 2.59055 5.125)",stroke:"#2A2A2A"}),g.jsx("path",{d:"M3.45564 5.61662L12.5498 10.875",stroke:"#2A2A2A"})]}),g.jsx("defs",{children:g.jsx("clipPath",{id:"clip0_59285_4572",children:g.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function W1(e){return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"hidden dark:inline-block",children:g.jsx(G1,{...e})}),g.jsx("span",{className:"inline-block dark:hidden",children:g.jsx(K1,{...e})})]})}function Q1(e){return g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("title",{children:"Exists in the Typesync UI | Light Mode"}),g.jsxs("g",{clipPath:"url(#clip0_59285_4556)",children:[g.jsx("path",{d:"M2 15.0588V14.3091C2 14.029 2.23019 13.8035 2.5103 13.8092V13.8092C2.78237 13.8148 3 14.037 3 14.3091V15H3.63191C3.90805 15 4.13191 15.2239 4.13191 15.5V15.5C4.13191 15.7761 3.90805 16 3.63191 16H2.92308C2.41328 16 2 15.5786 2 15.0588ZM7.01683 15C7.29297 15 7.51683 15.2239 7.51683 15.5V15.5C7.51683 15.7761 7.29297 16 7.01683 16H5.59916C5.32302 16 5.09916 15.7761 5.09916 15.5V15.5C5.09916 15.2239 5.32302 15 5.59916 15H7.01683ZM10.4008 15C10.677 15 10.9008 15.2239 10.9008 15.5V15.5C10.9008 15.7761 10.677 16 10.4008 16H8.98317C8.70703 16 8.48317 15.7761 8.48317 15.5V15.5C8.48317 15.2239 8.70703 15 8.98317 15H10.4008ZM13 15V14.3244C13 14.0483 13.2239 13.8244 13.5 13.8244V13.8244C13.7761 13.8244 14 14.0483 14 14.3244V15.0588C14 15.5786 13.5867 16 13.0769 16H12.3681C12.0919 16 11.8681 15.7761 11.8681 15.5V15.5C11.8681 15.2239 12.0919 15 12.3681 15H13ZM13.4897 10.3772C13.7698 10.3715 14 10.597 14 10.8771V12.3466C14 12.6187 13.7824 12.8409 13.5103 12.8465V12.8465C13.2302 12.8523 13 12.6268 13 12.3466V10.8771C13 10.605 13.2176 10.3829 13.4897 10.3772V10.3772ZM2.5 10.2693C2.77614 10.2693 3 10.4932 3 10.7693V12.2895C3 12.5657 2.77614 12.7895 2.5 12.7895V12.7895C2.22386 12.7895 2 12.5657 2 12.2895V10.7693C2 10.4932 2.22386 10.2693 2.5 10.2693V10.2693ZM13.4409 6.93133C13.7462 6.91964 14 7.16393 14 7.46939V8.86135C14 9.15072 13.7713 9.38835 13.4821 9.39942V9.39942C13.1769 9.4111 12.9231 9.16681 12.9231 8.86135V7.46939C12.9231 7.18002 13.1518 6.9424 13.4409 6.93133V6.93133ZM2.5103 6.75041C2.78237 6.75602 3 6.97817 3 7.2503V8.77031C3 9.05048 2.76981 9.27598 2.4897 9.2702V9.2702C2.21763 9.2646 2 9.04244 2 8.77031V7.2503C2 6.97013 2.23019 6.74463 2.5103 6.75041V6.75041ZM13 4.6875C13 4.5446 13.0133 4.40913 12.9038 4.31985L12.5418 4.02492C12.3444 3.86411 12.3122 3.57483 12.4694 3.37453V3.37453C12.6307 3.16885 12.9295 3.13568 13.1321 3.30096L13.4808 3.58548C13.809 3.85336 14 4.25884 14 4.6875V5.42188C14 5.69802 13.7761 5.92188 13.5 5.92188V5.92188C13.2239 5.92188 13 5.69802 13 5.42187V4.6875ZM2.5 3.21048C2.77614 3.21048 3 3.43434 3 3.71048V5.2307C3 5.50684 2.77614 5.7307 2.5 5.7307V5.7307C2.22386 5.7307 2 5.50684 2 5.2307V3.71048C2 3.43434 2.22386 3.21048 2.5 3.21048V3.21048ZM11.8346 2.24245C12.0319 2.40333 12.064 2.69258 11.9069 2.89288V2.89288C11.7455 3.09859 11.4467 3.13178 11.2441 2.96649L10.5409 2.39283C10.3398 2.22878 10.3071 1.93395 10.4672 1.72978V1.72978V1.72978C10.6251 1.52795 10.918 1.49516 11.1166 1.65707L11.8346 2.24245ZM2 0.941176C2 0.421379 2.41328 1.13692e-08 2.92308 0H3.4363C3.71244 0 3.9363 0.223858 3.9363 0.5V0.5C3.9363 0.776142 3.71244 1 3.4363 1H2.92308V1.73975C2.92308 1.99465 2.71644 2.20129 2.46154 2.20129V2.20129C2.20664 2.20129 2 1.99465 2 1.73975V0.941176ZM8.59946 0C8.9138 4.16766e-05 9.21848 0.109521 9.46394 0.309743L9.82608 0.604764C10.0234 0.765522 10.0556 1.05471 9.89852 1.25496V1.25496C9.73712 1.46066 9.43828 1.49374 9.2358 1.32832L8.88792 1.04412C8.80613 0.977403 8.7042 1.00004 8.59946 1H8.08534C7.80919 1 7.58534 0.776142 7.58534 0.5V0.5C7.58534 0.223858 7.80919 0 8.08534 0H8.59946ZM6.27494 0C6.55108 0 6.77494 0.223858 6.77494 0.5V0.5C6.77494 0.776142 6.55108 1 6.27494 1H5.2476C4.97145 1 4.7476 0.776142 4.7476 0.5V0.5C4.7476 0.223858 4.97145 0 5.2476 0H6.27494Z",fill:"#2A2A2A"}),g.jsx("path",{d:"M8.01689 0L8.00154 4.99847C8.00069 5.27521 8.2248 5.5 8.50154 5.5H14",stroke:"#2A2A2A"})]}),g.jsx("defs",{children:g.jsx("clipPath",{id:"clip0_59285_4556",children:g.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function Y1(e){return g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("title",{children:"Exists in the Typesync UI | Dark Mode"}),g.jsxs("g",{clipPath:"url(#clip0_59284_4447)",children:[g.jsx("path",{d:"M2 15.0588V14.3091C2 14.029 2.23019 13.8035 2.5103 13.8092V13.8092C2.78237 13.8148 3 14.037 3 14.3091V15H3.63191C3.90805 15 4.13191 15.2239 4.13191 15.5V15.5C4.13191 15.7761 3.90805 16 3.63191 16H2.92308C2.41328 16 2 15.5786 2 15.0588ZM7.01683 15C7.29297 15 7.51683 15.2239 7.51683 15.5V15.5C7.51683 15.7761 7.29297 16 7.01683 16H5.59916C5.32302 16 5.09916 15.7761 5.09916 15.5V15.5C5.09916 15.2239 5.32302 15 5.59916 15H7.01683ZM10.4008 15C10.677 15 10.9008 15.2239 10.9008 15.5V15.5C10.9008 15.7761 10.677 16 10.4008 16H8.98317C8.70703 16 8.48317 15.7761 8.48317 15.5V15.5C8.48317 15.2239 8.70703 15 8.98317 15H10.4008ZM13 15V14.3244C13 14.0483 13.2239 13.8244 13.5 13.8244V13.8244C13.7761 13.8244 14 14.0483 14 14.3244V15.0588C14 15.5786 13.5867 16 13.0769 16H12.3681C12.0919 16 11.8681 15.7761 11.8681 15.5V15.5C11.8681 15.2239 12.0919 15 12.3681 15H13ZM13.4897 10.3772C13.7698 10.3715 14 10.597 14 10.8771V12.3466C14 12.6187 13.7824 12.8409 13.5103 12.8465V12.8465C13.2302 12.8523 13 12.6268 13 12.3466V10.8771C13 10.605 13.2176 10.3829 13.4897 10.3772V10.3772ZM2.5 10.2693C2.77614 10.2693 3 10.4932 3 10.7693V12.2895C3 12.5657 2.77614 12.7895 2.5 12.7895V12.7895C2.22386 12.7895 2 12.5657 2 12.2895V10.7693C2 10.4932 2.22386 10.2693 2.5 10.2693V10.2693ZM13.4409 6.93133C13.7462 6.91964 14 7.16393 14 7.46939V8.86135C14 9.15072 13.7713 9.38835 13.4821 9.39942V9.39942C13.1769 9.4111 12.9231 9.16681 12.9231 8.86135V7.46939C12.9231 7.18002 13.1518 6.9424 13.4409 6.93133V6.93133ZM2.5103 6.75041C2.78237 6.75602 3 6.97817 3 7.2503V8.77031C3 9.05048 2.76981 9.27598 2.4897 9.2702V9.2702C2.21763 9.2646 2 9.04244 2 8.77031V7.2503C2 6.97013 2.23019 6.74463 2.5103 6.75041V6.75041ZM13 4.6875C13 4.5446 13.0133 4.40913 12.9038 4.31985L12.5418 4.02492C12.3444 3.86411 12.3122 3.57483 12.4694 3.37453V3.37453C12.6307 3.16885 12.9295 3.13568 13.1321 3.30096L13.4808 3.58548C13.809 3.85336 14 4.25884 14 4.6875V5.42188C14 5.69802 13.7761 5.92188 13.5 5.92188V5.92188C13.2239 5.92188 13 5.69802 13 5.42187V4.6875ZM2.5 3.21048C2.77614 3.21048 3 3.43434 3 3.71048V5.2307C3 5.50684 2.77614 5.7307 2.5 5.7307V5.7307C2.22386 5.7307 2 5.50684 2 5.2307V3.71048C2 3.43434 2.22386 3.21048 2.5 3.21048V3.21048ZM11.8346 2.24245C12.0319 2.40333 12.064 2.69258 11.9069 2.89288V2.89288C11.7455 3.09859 11.4467 3.13178 11.2441 2.96649L10.5409 2.39283C10.3398 2.22878 10.3071 1.93395 10.4672 1.72978V1.72978V1.72978C10.6251 1.52795 10.918 1.49516 11.1166 1.65707L11.8346 2.24245ZM2 0.941176C2 0.421379 2.41328 1.13692e-08 2.92308 0H3.4363C3.71244 0 3.9363 0.223858 3.9363 0.5V0.5C3.9363 0.776142 3.71244 1 3.4363 1H2.92308V1.73975C2.92308 1.99465 2.71644 2.20129 2.46154 2.20129V2.20129C2.20664 2.20129 2 1.99465 2 1.73975V0.941176ZM8.59946 0C8.9138 4.16766e-05 9.21848 0.109521 9.46394 0.309743L9.82608 0.604764C10.0234 0.765522 10.0556 1.05471 9.89852 1.25496V1.25496C9.73712 1.46066 9.43828 1.49374 9.2358 1.32832L8.88792 1.04412C8.80613 0.977403 8.7042 1.00004 8.59946 1H8.08534C7.80919 1 7.58534 0.776142 7.58534 0.5V0.5C7.58534 0.223858 7.80919 0 8.08534 0H8.59946ZM6.27494 0C6.55108 0 6.77494 0.223858 6.77494 0.5V0.5C6.77494 0.776142 6.55108 1 6.27494 1H5.2476C4.97145 1 4.7476 0.776142 4.7476 0.5V0.5C4.7476 0.223858 4.97145 0 5.2476 0H6.27494Z",fill:"white"}),g.jsx("path",{d:"M8.01689 0L8.00154 4.99847C8.00069 5.27521 8.2248 5.5 8.50154 5.5H14",stroke:"white"})]}),g.jsx("defs",{children:g.jsx("clipPath",{id:"clip0_59284_4447",children:g.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function X1(e){return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"hidden dark:inline-block",children:g.jsx(Y1,{...e})}),g.jsx("span",{className:"inline-block dark:hidden",children:g.jsx(Q1,{...e})})]})}function J1(e){return g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("title",{children:"Synced to the schema file, requires publishing | Light Mode"}),g.jsxs("g",{clipPath:"url(#clip0_59285_4566)",children:[g.jsx("path",{d:"M8 5V0.5H9L13.5 4.5V5H8Z",fill:"#2A2A2A"}),g.jsx("path",{d:"M3.5 0.5H8.61621C8.73973 0.5 8.85936 0.545299 8.95117 0.62793L13.335 4.57324C13.4403 4.66805 13.5 4.8036 13.5 4.94531V14.5C13.5 15.0523 13.0523 15.5 12.5 15.5H3.5C2.94772 15.5 2.5 15.0523 2.5 14.5V1.5C2.5 0.947715 2.94772 0.5 3.5 0.5Z",stroke:"#2A2A2A"}),g.jsx("path",{d:"M7.67993 12.0595H8.86631C8.99425 12.4899 9.37807 12.7109 9.88984 12.7109C10.4249 12.7109 10.7738 12.5015 10.7738 12.0944C10.7738 11.8153 10.5993 11.6641 10.169 11.5594L9.09893 11.3035C8.36617 11.129 7.81951 10.7336 7.81951 9.88451C7.81951 8.95402 8.64531 8.26778 9.77353 8.26778C10.9832 8.26778 11.6694 8.84934 11.8439 9.79146H10.704C10.5993 9.45416 10.2969 9.22154 9.7619 9.22154C9.35481 9.22154 8.93609 9.40763 8.93609 9.81472C8.93609 10.0473 9.09893 10.1985 9.47112 10.2916L10.5644 10.5475C11.4484 10.7568 11.8904 11.257 11.8904 12.013C11.8904 13.0365 11.0413 13.6646 9.87821 13.6646C8.66858 13.6646 7.83114 13.0598 7.67993 12.0595Z",fill:"#2A2A2A"}),g.jsx("path",{d:"M4.81418 12.1526V9.34949H4V8.3841H4.81418V7H5.97729V8.3841H7.1404V9.34949H5.97729V12.0246C5.97729 12.4434 6.20991 12.6295 6.59374 12.6295C6.82636 12.6295 7.09388 12.5364 7.25671 12.4201V13.4785C7.05898 13.5948 6.74494 13.6646 6.38438 13.6646C5.46552 13.6646 4.81418 13.1761 4.81418 12.1526Z",fill:"#2A2A2A"}),g.jsx("path",{d:"M8.01689 0L8.00169 4.49831C8.00076 4.77511 8.22489 5 8.50169 5H13.75",stroke:"#2A2A2A"})]}),g.jsx("defs",{children:g.jsx("clipPath",{id:"clip0_59285_4566",children:g.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function eg(e){return g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("title",{children:"Synced to the schema file, requires publishing | Dark Mode"}),g.jsxs("g",{clipPath:"url(#clip0_59288_4647)",children:[g.jsx("path",{d:"M8 5V0.5H9L13.5 4.5V5H8Z",fill:"white"}),g.jsx("path",{d:"M3.5 0.5H8.61621C8.73973 0.5 8.85936 0.545299 8.95117 0.62793L13.335 4.57324C13.4403 4.66805 13.5 4.8036 13.5 4.94531V14.5C13.5 15.0523 13.0523 15.5 12.5 15.5H3.5C2.94772 15.5 2.5 15.0523 2.5 14.5V1.5C2.5 0.947715 2.94772 0.5 3.5 0.5Z",stroke:"white"}),g.jsx("path",{d:"M7.67993 12.0595H8.86631C8.99425 12.4899 9.37807 12.7109 9.88984 12.7109C10.4249 12.7109 10.7738 12.5015 10.7738 12.0944C10.7738 11.8153 10.5993 11.6641 10.169 11.5594L9.09893 11.3035C8.36617 11.129 7.81951 10.7336 7.81951 9.88451C7.81951 8.95402 8.64531 8.26778 9.77353 8.26778C10.9832 8.26778 11.6694 8.84934 11.8439 9.79146H10.704C10.5993 9.45416 10.2969 9.22154 9.7619 9.22154C9.35481 9.22154 8.93609 9.40763 8.93609 9.81472C8.93609 10.0473 9.09893 10.1985 9.47112 10.2916L10.5644 10.5475C11.4484 10.7568 11.8904 11.257 11.8904 12.013C11.8904 13.0365 11.0413 13.6646 9.87821 13.6646C8.66858 13.6646 7.83114 13.0598 7.67993 12.0595Z",fill:"white"}),g.jsx("path",{d:"M4.81418 12.1526V9.34949H4V8.3841H4.81418V7H5.97729V8.3841H7.1404V9.34949H5.97729V12.0246C5.97729 12.4434 6.20991 12.6295 6.59374 12.6295C6.82636 12.6295 7.09388 12.5364 7.25671 12.4201V13.4785C7.05898 13.5948 6.74494 13.6646 6.38438 13.6646C5.46552 13.6646 4.81418 13.1761 4.81418 12.1526Z",fill:"white"}),g.jsx("path",{d:"M8.01689 0L8.00169 4.49831C8.00076 4.77511 8.22489 5 8.50169 5H13.75",stroke:"white"})]}),g.jsx("defs",{children:g.jsx("clipPath",{id:"clip0_59288_4647",children:g.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function tg(e){return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"hidden dark:inline-block",children:g.jsx(eg,{...e})}),g.jsx("span",{className:"inline-block dark:hidden",children:g.jsx(J1,{...e})})]})}function ng(e){return g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("title",{children:"Published to the Knowledge Graph, but requires syncing to the schema file | Light Mode"}),g.jsx("path",{d:"M14.0291 8.02593C14.0291 4.53221 11.2275 1.7 7.77153 1.7C5.64507 1.7 3.76635 2.77226 2.63557 4.41111",stroke:"#2A2A2A","stroke-linecap":"round"}),g.jsx("path",{d:"M14.0291 8.47779L15.37 7.12223",stroke:"#2A2A2A","stroke-linecap":"round"}),g.jsx("path",{d:"M14.0291 8.47779L12.6882 7.12223",stroke:"#2A2A2A","stroke-linecap":"round"}),g.jsx("path",{d:"M1.96091 7.97407C1.96091 11.4678 4.76252 14.3 8.21848 14.3C10.3449 14.3 12.2237 13.2277 13.3544 11.5889",stroke:"#2A2A2A","stroke-linecap":"round"}),g.jsx("path",{d:"M1.96091 7.52222L0.620003 8.87778",stroke:"#2A2A2A","stroke-linecap":"round"}),g.jsx("path",{d:"M1.96091 7.52222L3.30182 8.87778",stroke:"#2A2A2A","stroke-linecap":"round"}),g.jsx("path",{d:"M6 4.5H8.11621C8.23973 4.5 8.35936 4.5453 8.45117 4.62793L10.335 6.32324C10.4403 6.41805 10.5 6.5536 10.5 6.69531V11C10.5 11.2761 10.2761 11.5 10 11.5H6C5.72386 11.5 5.5 11.2761 5.5 11V5C5.5 4.72386 5.72386 4.5 6 4.5Z",stroke:"#2A2A2A"}),g.jsx("path",{d:"M8 6.5V4.5L10.5 7H8.5C8.22386 7 8 6.77614 8 6.5Z",fill:"#2A2A2A"})]})}function sg(e){return g.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[g.jsx("title",{children:"Published to the Knowledge Graph, but requires syncing to the schema file | Dark Mode"}),g.jsx("path",{d:"M14.0291 8.02593C14.0291 4.53221 11.2275 1.7 7.77153 1.7C5.64507 1.7 3.76635 2.77226 2.63557 4.41111",stroke:"white","stroke-linecap":"round"}),g.jsx("path",{d:"M14.0291 8.47779L15.37 7.12223",stroke:"white","stroke-linecap":"round"}),g.jsx("path",{d:"M14.0291 8.47779L12.6882 7.12223",stroke:"white","stroke-linecap":"round"}),g.jsx("path",{d:"M1.96091 7.97407C1.96091 11.4678 4.76252 14.3 8.21848 14.3C10.3449 14.3 12.2237 13.2277 13.3544 11.5889",stroke:"white","stroke-linecap":"round"}),g.jsx("path",{d:"M1.96091 7.52222L0.620003 8.87778",stroke:"white","stroke-linecap":"round"}),g.jsx("path",{d:"M1.96091 7.52222L3.30182 8.87778",stroke:"white","stroke-linecap":"round"}),g.jsx("path",{d:"M6 4.5H8.11621C8.23973 4.5 8.35936 4.5453 8.45117 4.62793L10.335 6.32324C10.4403 6.41805 10.5 6.5536 10.5 6.69531V11C10.5 11.2761 10.2761 11.5 10 11.5H6C5.72386 11.5 5.5 11.2761 5.5 11V5C5.5 4.72386 5.72386 4.5 6 4.5Z",stroke:"white"}),g.jsx("path",{d:"M8 6.5V4.5L10.5 7H8.5C8.22386 7 8 6.77614 8 6.5Z",fill:"white"})]})}function rg(e){return g.jsxs(g.Fragment,{children:[g.jsx("span",{className:"hidden dark:inline-block",children:g.jsx(sg,{...e})}),g.jsx("span",{className:"inline-block dark:hidden",children:g.jsx(ng,{...e})})]})}const ig={published:"Published to the Knowledge Graph",synced:"Synced with the schema file, but needs published",typesync_ui:"Requires syncing to the schema file",published_not_synced:"Published to the Knowledge Graph, but requires syncing to the schema file"};function og({id:e,label:t,typeSelected:n,...s}){const r=yn(),i=we(r.store,p=>p.value),o=we(r.store,p=>p.meta.errors),a=we(r.store,p=>p.meta.isTouched),c=o.length>0&&a,[d,h]=l.useState(""),m=Bc(p=>{h(p)},300),{data:u}=_c({query:ut(d)?Dt(d):null,first:50},{refetchOnMount:!1,refetchOnWindowFocus:!1}),f=u??[];return g.jsxs(lc,{value:i,onChange:p=>{if(p==null){r.handleChange("");return}if(typeof p=="string"){r.handleChange(p);return}r.handleChange(p.name||p.id),n(p)},onClose:()=>{m("")},immediate:!0,children:[t!=null?g.jsxs($n,{htmlFor:s.name||e,className:"block text-sm/6 font-medium text-gray-900 dark:text-white",children:[t,s.required?"*":""]}):null,g.jsxs("div",{className:Ht("grid grid-cols-1 relative",t!=null?"mt-2":"mt-0"),children:[g.jsx(Di,{className:"block min-w-0 grow py-1.5 pr-12 data-[state=invalid]:pr-10 text-base bg-white dark:bg-white/5 pl-3 outline -outline-offset-1 outline-gray-300 dark:outline-white/10 rounded-md text-gray-900 dark:text-white data-[state=invalid]:text-red-900 dark:data-[state=invalid]:text-red-700 placeholder:text-gray-400 dark:placeholder:text-gray-500 data-[state=invalid]:placeholder:text-red-700 dark:data-[state=invalid]:placeholder:text-red-400 focus:outline sm:text-sm/6 focus-visible:outline-none",onChange:p=>{const y=p.target.value;m(y),r.handleChange(y)},onBlur:()=>h(""),displayValue:p=>p,type:"search"}),g.jsx(Li,{className:"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-hidden cursor-pointer",children:g.jsx($s,{className:"size-5 text-gray-400 dark:text-gray-50","aria-hidden":"true"})}),f.length>0||ut(d)?g.jsxs($i,{className:"absolute z-10 mt-10 max-h-60 w-fit min-w-md 2xl:min-w-xl overflow-auto rounded-md bg-white dark:bg-slate-700 py-1 text-base shadow-lg ring-1 ring-black/5 dark:ring-black/10 focus:outline-hidden sm:text-sm",children:[f.map(p=>g.jsxs(Nn,{value:p,"data-selected":i===p.name||i===p.id?!0:void 0,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",children:[g.jsxs("span",{className:"flex items-center gap-x-1.5 truncate group-data-selected:font-semibold",children:[p.name||p.id,g.jsx(Ve,{children:p.id})]}),g.jsx("span",{className:"absolute inset-y-0 right-0 hidden items-center pr-4 text-indigo-600 group-data-focus:text-white group-data-selected:flex",children:g.jsx(wt,{className:"size-5","aria-hidden":"true"})})]},p.id)),ut(d)?g.jsx(Nn,{value:d,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",children:g.jsxs("span",{className:"flex items-center gap-x-1.5 truncate group-data-selected:font-semibold",children:["New Type: ",g.jsx(Ve,{children:d})]})},"user_entered"):null]}):null]}),c?g.jsx(Gs,{id:`${e}-invalid`,errors:o}):null]})}class Mt extends ks("/hypergraph/typesync/models/TypeOption")({id:De,name:De}){}class ag extends ks("/hypergraph/typesync/models/RelationTypeOption")({...Mt.fields,relationType:De}){}const lg=[Mt.make({id:"DefaultEntityString",name:"String"}),Mt.make({id:"DefaultEntityNumber",name:"Number"}),Mt.make({id:"DefaultEntityBoolean",name:"Boolean"}),Mt.make({id:"DefaultEntityDate",name:"Date"}),Mt.make({id:"DefaultEntityUrl",name:"Url"}),Mt.make({id:"DefaultEntityPoint",name:"Point"})];function cg({id:e,name:t,schemaTypes:n=[],disabled:s=!1,relationTypeSelected:r}){const i=yn(),o=se(n,ye(a=>ut(a.type)),be(a=>ag.make({id:`Relation(${a.type})`,name:`Relation(${a.type})`,relationType:a.type})));return g.jsxs(L0,{as:"div",id:e,name:t,value:i.state.value,onBlur:i.handleBlur,disabled:s,onChange:a=>{if(a){if(typeof a=="string"){i.handleChange(a);return}i.handleChange(a.name),r(a.relationType)}},children:[g.jsx($n,{className:"sr-only",children:"Prop type"}),g.jsxs("div",{className:"relative",children:[g.jsxs(Mc,{className:"grid w-full cursor-default grid-cols-1 rounded-md bg-white dark:bg-slate-900 disabled:bg-gray-100 dark:disabled:bg-slate-700 py-1.5 pr-2 pl-3 text-left text-white outline-1 -outline-offset-1 outline-gray-500 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6 disabled:cursor-not-allowed",children:[g.jsx("span",{className:"col-start-1 row-start-1 truncate pr-6 text-gray-950 dark:text-white",children:i.state.value}),s?null:g.jsx($s,{"aria-hidden":"true",className:"col-start-1 row-start-1 size-5 self-center justify-self-end text-gray-300 dark:text-gray-50 sm:size-4"})]}),g.jsxs(Rc,{transition:!0,className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-gray-50 dark:bg-slate-800 py-1 text-base shadow-lg ring-1 ring-gray-200 dark:ring-black/5 focus:outline-hidden data-leave:transition data-leave:duration-100 data-leave:ease-in data-closed:data-leave:opacity-0 sm:text-sm",children:[lg.map(a=>g.jsxs(Br,{value:a.name,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-800 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",children:[g.jsx("span",{className:"block truncate font-normal group-data-selected:font-semibold",children:a.name}),g.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-4 text-indigo-600 group-not-data-selected:hidden group-data-focus:text-white",children:g.jsx(wt,{"aria-hidden":"true",className:"size-5"})})]},a.id)),o.map((a,c)=>g.jsxs(Br,{value:a,className:Ht("group relative cursor-default py-2 pr-9 pl-3 text-gray-800 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",c===0?"border-t border-gray-400 dark:border-white/10":""),children:[g.jsx("span",{className:"block truncate font-normal group-data-selected:font-semibold",children:a.name}),g.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-4 text-indigo-600 group-not-data-selected:hidden group-data-focus:text-white",children:g.jsx(wt,{"aria-hidden":"true",className:"size-5"})})]},a.id))]})]})]})}const ug=Cs(od(Hn));function dg(e,t){switch(t.type){case"FETCHING":return{...e,status:"fetching",error:null};case"ERROR":return{...e,error:t.payload,status:"error"};case"SUCCESS":return{...e,data:t.payload,status:"success"};case"RESET":return{...e,data:{types:[]},error:void 0,status:"idle"};default:return e}}function fg({enabled:e=!0,onError:t,onSuccess:n,retry:s=!0,retryDelay:r=1e3}={}){const[i,o]=l.useReducer(dg,{data:{types:[]},error:void 0,status:"idle"}),a=l.useRef(null),c=l.useRef(null),d=l.useRef(!0),h=l.useRef({onSuccess:n,onError:t,retry:s,retryDelay:r,enabled:e});l.useEffect(()=>{h.current={onSuccess:n,onError:t,retry:s,retryDelay:r,enabled:e}});const m=l.useCallback(()=>{a.current&&(a.current.close(),a.current=null),c.current&&clearTimeout(c.current)},[]),u=l.useCallback(()=>{if(m(),!!h.current.enabled&&d.current){o({type:"FETCHING"});try{const f=new EventSource("http://localhost:3000/api/v1/schema/events"),p=v=>{if(d.current)try{const b=ug(v.data);o({type:"SUCCESS",payload:b}),h.current.onSuccess?.(b)}catch(b){const x=b instanceof Error?b:new Error("Failed to parse SSE data");o({type:"ERROR",payload:x}),h.current.onError?.(x)}},y=()=>{if(!d.current)return;const v=new Error("SSE connection error");o({type:"ERROR",payload:v}),h.current.onError?.(v),m(),h.current.retry&&h.current.enabled&&(c.current=setTimeout(u,h.current.retryDelay))};f.addEventListener("message",p),f.addEventListener("error",y),a.current=f}catch(f){if(!d.current)return;const p=f instanceof Error?f:new Error("Failed to create SSE connection");o({type:"ERROR",payload:p}),h.current.onError?.(p)}}},[m]);return l.useEffect(()=>(d.current=!0,u(),()=>{d.current=!1,m()}),[u,m]),l.useEffect(()=>{e?u():m()},[e,u,m]),{data:i.data,error:i.error,isLoading:i.status==="fetching",isError:i.status==="error",isSuccess:i.status==="success",refetch:u}}const hg=Cs(Hn);Ie({schema:Hn,space:lt});function pg(e={}){const{getSmartSessionClient:t}=Jr();return Sl({mutationKey:["Hypergraph","Typesync","Studio","Mapping","sync"],async mutationFn(n){try{const s=await t();if(!s)throw new Error("Missing smartSessionClient");const[r,i]=Cd(n.schema);await df({ops:i.map(c=>c),space:n.space,name:"Schema Publish updates",walletClient:s});const o=await fetch("http://localhost:3000/api/v1/mapping/sync",{method:"POST",body:JSON.stringify({schema:n.schema,mapping:r}),headers:{"Content-Type":"application/json",Accept:"application/json"}});if(o.status!==200)throw new Error(`Failure posting Typesync Hypergraph Schema [${o.status}]`);const a=await o.json();return hg(a)}catch(s){throw console.error("Failure syncing Typesync Hypergraph Schema to schema.ts file",{err:s}),s}},...e})}const mg=Cs(Hn),gg={mutationKey:["Hypergraph","Typesync","Studio","Schema","sync"],async mutationFn(e){try{const t=await fetch("http://localhost:3000/api/v1/schema/sync",{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",Accept:"application/json"}});if(t.status!==200)throw new Error(`Failure posting Typesync Hypergraph Schema [${t.status}]`);const n=await t.json();return mg(n)}catch(t){throw console.error("Failure syncing Typesync Hypergraph Schema to schema.ts file",{err:t}),t}}};function yg(e={}){return Sl({...gg,...e})}const{useAppForm:vg}=ro({fieldComponents:{Checkbox:b1,PropertyCombobox:U1,TextField:Dc,TypeCombobox:og,TypeSelect:cg},formComponents:{SubmitButton:Lc},fieldContext:oo,formContext:ao}),wg=function(){const{authenticated:t}=tl(),[n,s]=l.useState(!1),{spaceId:r}=Ja(),{data:i}=fg(),o=Ep(),{mutateAsync:a,isError:c,isPending:d,isSuccess:h,reset:m}=yg({onError(T){o.add({title:"Failure syncing Schema to file",description:T.message})}}),{mutateAsync:u,isError:f,isPending:p,isSuccess:y,reset:v}=pg({onError(T){o.add({title:"Failure publishing Schema to Knowledge Graph",description:T.message})}}),b=vg({defaultValues:i,validators:{onChangeAsyncDebounceMs:100,onChange:el(Hn)},async onSubmit({value:T,formApi:M}){await a(T).then(F=>{setTimeout(async()=>{M.reset(F),m()},1500)})}}),x=we(b.store,T=>se(T.values.types,ye(M=>ut(M.name)),be((M,F)=>({type:M.name,knowledgeGraphId:M.knowledgeGraphId,schemaTypeIdx:F})))),E=se(x,be(T=>T.type),at(new Set,(T,M)=>T.add(M))),S=we(b.store,T=>T.values),C=we(b.store,T=>T.isDirty&&Un(T.values.types,M=>M.status==="published_not_synced"||M.status==null||Un(M.properties,F=>F.status==="published_not_synced"||F.status==null))),k=we(b.store,T=>Un(T.values.types,M=>M.status==="synced"||Un(M.properties,F=>F.status==="synced"))),V=(T,M=[])=>{const F=[...M];function I(P){return To(ye(F,({name:L})=>L===P.name))>0&&!E.has(P.name)}const w=se(T.properties,ye(P=>P.dataType==="RELATION"),ye(P=>!I({name:P.name})));for(const P of w){if(ad(P.relationValueTypes)){F.push({name:P.name,knowledgeGraphId:null,properties:[],status:null});continue}const L=P.relationValueTypes[0];if(I({name:L.name}))continue;F.push({name:L.name,knowledgeGraphId:L.id,status:"published_not_synced",properties:be(L.properties??[],O=>{const R=It(O.dataType,O.name);return bt(R)?{name:O.name,knowledgeGraphId:O.id,dataType:R,relationType:O.name,status:"published_not_synced"}:{name:O.name,knowledgeGraphId:O.id,dataType:R,status:"published_not_synced"}})});const $=V({...L,properties:se(L.properties??[],ye(O=>O!=null),be(O=>({...O,relationValueTypes:[]})))},F);for(const O of $)I({name:O.name})||F.push(O)}return at(F,[],(P,L)=>{const $=ld(P,({name:O})=>O===L.name);return cd($)&&P.push(L),P})},A=(T,M=[])=>{const F=[...M];function I(w){return To(ye(F,({name:P})=>P===w.name))>0&&!E.has(w.name)}for(const w of ye(T.relationValueTypes,P=>P!=null)){if(w.name==null||I({name:w.name}))continue;const P=se(w.properties??[],ye(L=>L.name!=null),be(L=>{const $=L.name,O=It(L.dataType,$);return bt(O)?(I({name:$})||F.push({name:$,knowledgeGraphId:null,properties:[],status:null}),{name:$,knowledgeGraphId:L.id,dataType:O,relationType:$,status:"published_not_synced"}):{name:$,knowledgeGraphId:L.id,dataType:O,status:"published_not_synced"}}));F.push({name:w.name,knowledgeGraphId:w.id,status:"published_not_synced",properties:P})}return F};return g.jsxs("form",{noValidate:!0,"aria-disabled":d?"true":void 0,onSubmit:T=>{T.preventDefault(),T.stopPropagation(),b.handleSubmit()},children:[g.jsx(b.AppField,{name:"types",mode:"array",children:T=>g.jsxs("div",{className:"grid grid-cols-2 2xl:grid-cols-5 gap-x-4 2xl:gap-x-8 h-full",children:[g.jsx("div",{className:"w-full flex flex-col gap-y-4 pb-10 2xl:col-span-2 h-full",children:g.jsx(B1,{typeSelected:M=>{if(M.name==null)return;const F=V(M),I=Fr.make({name:M.name,knowledgeGraphId:M.id,status:"published_not_synced",properties:(M.properties??[]).filter(w=>w!=null).map(w=>{const P=It(w.dataType,w.name||w.id);return bt(P)?{name:w.name||w.id,knowledgeGraphId:w.id,dataType:P,relationType:w.name||w.id,status:"published_not_synced"}:{name:w.name||w.id,knowledgeGraphId:w.id,dataType:P,status:"published_not_synced"}})});if(T.state.value.length===1){const w=T.state.value[0],P=w.properties;if(hs(w.name)&&P.length===1&&hs(w.properties[0].name)){nr(F,{onEmpty(){T.replaceValue(0,I)},onNonEmpty(L){zn(L,($,O)=>{if(O===0){T.replaceValue(0,{name:$.name,knowledgeGraphId:$.knowledgeGraphId,properties:$.properties});return}T.pushValue($)}),T.pushValue(I)}});return}}nr(F,{onEmpty(){T.pushValue(I)},onNonEmpty(w){zn(w,P=>{T.pushValue({name:P.name,knowledgeGraphId:P.knowledgeGraphId,properties:P.properties})}),T.pushValue(I)}})}})}),g.jsxs("div",{className:"w-full flex flex-col gap-y-4 pb-10 2xl:col-span-3",children:[g.jsxs("div",{className:"border-b border-gray-200 dark:border-white/20 pb-5 h-20",children:[g.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Schema"}),g.jsxs("p",{className:"mt-2 max-w-4xl text-sm text-gray-500 dark:text-gray-200",children:["This is parsed from the Hypergraph Schema defined in your ",g.jsx(Ve,{children:"schema.ts"})]})]}),g.jsxs("div",{children:[T.state.value.map((M,F)=>{const I=`createSchemaForm__type[${F}]`;return g.jsxs("div",{className:"border-l-2 border-indigo-600 dark:border-indigo-400 pl-2 py-2 flex flex-col gap-y-4",children:[g.jsxs("div",{className:"flex items-start justify-between gap-x-3",children:[g.jsx("div",{className:"h-16 w-8 flex flex-col items-center justify-end",children:g.jsx(Ma,{status:M.status})}),g.jsx("div",{className:"flex-1 shrink-0",children:g.jsx(b.AppField,{name:`types[${F}].name`,children:w=>g.jsx(w.TypeCombobox,{id:`types[${F}].name`,name:`types[${F}].name`,required:!0,label:"Type Name",typeSelected:P=>{const L=V(P),$=Fr.make({name:P.name,knowledgeGraphId:P.id,status:"published_not_synced",properties:(P.properties??[]).filter(O=>O!=null).map(O=>{const R=It(O.dataType,O.name||O.id);return bt(R)?{name:O.name||O.id,knowledgeGraphId:O.id,dataType:R,relationType:O.name||O.id,status:"published_not_synced"}:{name:O.name||O.id,knowledgeGraphId:O.id,dataType:R,status:"published_not_synced"}})});nr(L,{onEmpty(){T.replaceValue(F,$)},onNonEmpty(O){zn(O,R=>{T.pushValue({name:R.name,knowledgeGraphId:R.knowledgeGraphId,properties:R.properties})}),T.replaceValue(F,$)}})}})})}),g.jsx("button",{type:"button",className:"min-w-fit rounded-md bg-transparent p-2 shadow-xs hover:bg-gray-100 dark:hover:bg-white/10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600 cursor-pointer mt-8 text-red-700 dark:text-red-400 disabled:text-gray-400 disabled:cursor-not-allowed disabled:hover:bg-transparent",onClick:()=>T.removeValue(F),disabled:T.state.value.length===1,children:g.jsx(Hr,{"aria-hidden":"true",className:"size-5"})})]}),g.jsx(b.AppField,{name:`types[${F}].properties`,mode:"array",children:w=>g.jsxs("div",{className:"flex flex-col gap-y-1 pl-2 ml-1 border-l border-indigo-300",children:[g.jsx("h4",{className:"text-md font-mono text-gray-800 dark:text-gray-200",children:"Properties"}),g.jsxs("div",{className:"w-full flex flex-col gap-y-2",children:[w.state.value.map((P,L)=>{const $=`createAppForm__type[${F}]__prop[${L}]`;return g.jsxs("div",{className:"grid grid-cols-11 gap-2",children:[g.jsxs("div",{className:"col-span-5 flex items-start gap-x-1",children:[g.jsx("div",{className:"w-8 h-full flex flex-col items-center justify-center",children:g.jsx(Ma,{status:P.status})}),g.jsx("div",{className:"w-full",children:g.jsx(b.AppField,{name:`types[${F}].properties[${L}].name`,children:O=>g.jsx(O.PropertyCombobox,{id:`types[${F}].properties[${L}].name`,name:`types[${F}].properties[${L}].name`,required:!0,propertySelected:R=>{const H=It(R.dataType,R.name||R.id),Z={name:R.name||R.id,knowledgeGraphId:R.id,status:"published_not_synced",dataType:H,...bt(H)?{relationType:R.name||R.id}:{}};if(R.dataType==="RELATION"){const W=A(R);zn(W,z=>{T.pushValue({name:z.name,knowledgeGraphId:z.knowledgeGraphId,properties:z.properties})}),w.replaceValue(L,Z);return}w.replaceValue(L,Z)}})})})]}),g.jsx("div",{className:"col-span-3 2xl:col-span-4",children:g.jsx(b.AppField,{name:`types[${F}].properties[${L}].dataType`,children:O=>g.jsx(O.TypeSelect,{id:`types[${F}].properties[${L}].dataType`,name:`types[${F}].properties[${L}].dataType`,schemaTypes:ye(x,R=>R.type!==M.name),disabled:P.knowledgeGraphId!=null,relationTypeSelected:R=>w.replaceValue(L,{...w.state.value[L],relationType:R})})})}),g.jsx("div",{className:"col-span-2 2xl:col-span-1",children:g.jsx(b.AppField,{name:`types[${F}].properties[${L}].optional`,children:O=>g.jsx(O.Checkbox,{id:`types[${F}].properties[${L}].optional`,name:`types[${F}].properties[${L}].optional`,label:"Optional"})})}),g.jsx("div",{className:"col-span-1 flex items-start justify-end h-full",children:g.jsx("button",{type:"button",className:"min-w-fit rounded-md bg-transparent p-2 text-white shadow-xs hover:bg-gray-100 dark:hover:bg-white/10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600 cursor-pointer",onClick:()=>w.removeValue(L),children:g.jsx(Hr,{"aria-hidden":"true",className:"size-5 text-red-700 dark:text-red-400"})})})]},$)}),g.jsx("div",{className:"w-full flex items-center justify-end mt-1",children:g.jsxs("button",{type:"button",className:"inline-flex items-center gap-x-1.5 text-sm/4 font-semibold text-gray-900 dark:text-white cursor-pointer hover:bg-gray-100 dark:hover:bg-white/10 rounded-md px-2 py-1.5",onClick:()=>w.pushValue({name:"",knowledgeGraphId:null,dataType:"String",status:null}),children:[g.jsx(xs,{"aria-hidden":"true",className:"-ml-0.5 size-4"}),"Add Property"]})})]})]})})]},I)}),g.jsxs("div",{className:"w-full flex items-center justify-between border-t border-gray-500 dark:border-gray-400 mt-4 pt-2",children:[g.jsxs("button",{type:"button",className:"inline-flex items-center gap-x-1.5 text-sm/6 font-semibold text-gray-600 dark:text-gray-200 cursor-pointer hover:bg-gray-100 dark:hover:bg-white/10 rounded-md px-2 py-1.5",onClick:()=>{b.resetField("types")},children:[g.jsx(zl,{"aria-hidden":"true",className:"-ml-0.5 size-4"}),"Reset"]}),g.jsxs("button",{type:"button",className:"inline-flex items-center gap-x-1.5 text-sm/6 font-semibold text-gray-900 dark:text-white cursor-pointer hover:bg-gray-100 dark:hover:bg-white/10 rounded-md px-2 py-1.5",onClick:()=>T.pushValue({name:"",knowledgeGraphId:null,status:null,properties:[{name:"",knowledgeGraphId:null,dataType:"String",status:null}]}),children:[g.jsx(xs,{"aria-hidden":"true",className:"-ml-0.5 size-5"}),"Add Type"]})]})]}),g.jsxs("div",{className:"mt-6 flex items-center justify-end gap-x-6 bg-white dark:bg-inherit p-4 rounded-lg",children:[g.jsx(b.AppForm,{children:g.jsxs(b.SubmitButton,{status:d?"submitting":c?"error":h?"success":"idle",children:["Sync with ",g.jsx(Ve,{children:"schema.ts"})]})}),g.jsx(so,{delay:300,closeDelay:1e3,children:g.jsxs(Wi,{children:[g.jsx(Xi,{type:"button",disabled:!k||!t,"data-state":p?"submitting":f?"error":y?"success":"idle",className:Ht("rounded-md bg-indigo-600 dark:bg-indigo-500 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-indigo-500 dark:hover:bg-indigo-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500 inline-flex items-center gap-x-2 cursor-pointer","disabled:bg-gray-400 disabled:text-gray-900 disabled:hover:bg-gray-400 disabled:focus-visible:outline-gray-400 disabled:cursor-not-allowed","data-[state=error]:bg-red-600 data-[state=error]:hover:bg-red-500 data-[state=error]:focus-visible:bg-red-500 data-[state=success]:focus-visible:bg-green-500","data-[state=success]:bg-green-600 data-[state=success]:hover:bg-green-500"),onClick:async()=>{if(!(!t||!k||C)){if(!r){s(!0);return}await u({schema:S,space:r}).then(M=>{setTimeout(async()=>{b.reset(M,{keepDefaultValues:!1}),v()},1500)})}},children:"Publish Schema"}),g.jsx(Ji,{children:g.jsx(eo,{side:"top",sideOffset:10,children:g.jsxs(to,{className:"box-border text-sm flex flex-col px-2 py-3 rounded-lg bg-gray-100 dark:bg-slate-900 transform-content data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 w-fit max-w-xs",children:[g.jsx(no,{className:"flex data-[side=top]:-bottom-2 data-[side=top]:rotate-180 data-[side=bottom]:-top-2 data-[side=bottom]:rotate-0 data-[side=left]:-right-3 data-[side=left]:rotate-90 data-[side=right]:-left-3 data-[side=right]:-rotate-90",children:g.jsx(io,{})}),g.jsx("span",{className:"text-xs text-gray-700 dark:text-white whitespace-break-spaces w-full",children:t?C?"Please sync your Schema to the schema.ts file first. Then Publish to the Knowledge Graph":k?"Publish your Schema changes to the Knowledge Graph":"Add types/properties to your Schema and sync with your schema file before Publishing to the Knowledge Graph":"Must be authenticated to Publish"})]})})})]})})]})]})]})}),g.jsx(E1,{open:n,setOpen:s,spaceSubmitted:async T=>{s(!1),await u({schema:S,space:T.id}).then(M=>{setTimeout(async()=>{b.reset(M,{keepDefaultValues:!1}),v()},1500)})}}),g.jsx(nh,{className:"fixed z-10 w-sm mx-0 my-auto bottom-4 md:bottom-8 right-4 md:right-8 left-auto top-auto",children:o.toasts.map(T=>g.jsx(hh,{toast:T,className:"pointer-events-auto w-full max-w-md rounded-lg bg-white shadow-lg outline-1 outline-black/5 transition data-closed:opacity-0 data-enter:transform data-enter:duration-300 data-enter:ease-out data-closed:data-enter:translate-y-2 data-leave:duration-100 data-leave:ease-in data-closed:data-enter:sm:translate-x-2 data-closed:data-enter:sm:translate-y-0 dark:bg-gray-800 dark:-outline-offset-1 dark:outline-white/10 p-4",children:g.jsx("div",{className:"p-4",children:g.jsxs("div",{className:"flex items-start",children:[g.jsx("div",{className:"shrink-0",children:g.jsx(Ii,{"aria-hidden":"true",className:"size-6 text-red-400"})}),g.jsxs("div",{className:"ml-3 w-0 flex-1 pt-0.5",children:[g.jsx(mh,{className:"text-sm font-medium text-gray-900 dark:text-white"}),g.jsx(ph,{className:"mt-1 text-sm text-gray-500 dark:text-gray-400"})]}),g.jsx("div",{className:"ml-4 flex shrink-0",children:g.jsx(xh,{"aria-label":"Close",className:"inline-flex rounded-md text-gray-400 hover:text-gray-500 focus:outline-2 focus:outline-offset-2 focus:outline-red-600 dark:hover:text-white dark:focus:outline-red-500",children:g.jsx(Ai,{className:"size-4","aria-hidden":"true"})})})]})})},T.id))})]})};export{wg as component};