@graphprotocol/hypergraph 0.11.2 → 0.12.0
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.
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/connect/smart-account.js +3 -2
- package/dist/connect/smart-account.js.map +1 -1
- package/dist/entity/find-many-public.js +1 -1
- package/dist/entity/find-many-public.js.map +1 -1
- package/dist/entity/find-one-public.js +1 -1
- package/dist/entity/find-one-public.js.map +1 -1
- package/dist/entity/search-many-public.js +1 -1
- package/dist/entity/search-many-public.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mapping/Mapping.d.ts +2 -2
- package/dist/mapping/Mapping.d.ts.map +1 -1
- package/dist/mapping/Mapping.js +2 -2
- package/dist/mapping/Mapping.js.map +1 -1
- package/dist/space/find-many-public.js +2 -2
- package/dist/space/find-many-public.js.map +1 -1
- package/dist/typesync-studio/dist/assets/{authenticate-callback-BV2rlMr8.js → authenticate-callback-DffCNmxZ.js} +1 -1
- package/dist/typesync-studio/dist/assets/authenticate-callback-DffCNmxZ.js.map +1 -0
- package/dist/typesync-studio/dist/assets/{ccip-BbFvINjv.js → ccip-BJ7g8YE6.js} +1 -1
- package/dist/typesync-studio/dist/assets/ccip-BJ7g8YE6.js.map +1 -0
- package/dist/typesync-studio/dist/assets/{index-aqIlSDjR.js → index-B5RxXGeM.js} +111 -111
- package/dist/typesync-studio/dist/assets/index-B5RxXGeM.js.map +1 -0
- package/dist/typesync-studio/dist/assets/{index-BVtd9x2J.js → index-CHTDYpLG.js} +2 -2
- package/dist/typesync-studio/dist/assets/index-CHTDYpLG.js.map +1 -0
- package/dist/typesync-studio/dist/assets/index.web-BzOyYK7K.js.map +1 -0
- package/dist/typesync-studio/dist/index.html +1 -1
- package/package.json +2 -2
- package/src/config.ts +1 -1
- package/src/connect/smart-account.ts +2 -2
- package/src/entity/find-many-public.ts +1 -1
- package/src/entity/find-one-public.ts +1 -1
- package/src/entity/search-many-public.ts +1 -1
- package/src/index.ts +1 -1
- package/src/mapping/Mapping.ts +2 -2
- package/src/space/find-many-public.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as ua,b as yl,e as bl,c as xl,f as wl,g as El,t as yi,h as Sl,i as Y,k as ke,l as ee,I as nt,m as kl,D as Ml,C as Cl,T as hs,P as bi,n as Tl,E as Fl,o as Ol,p as Rl,q as Il,s as Al,v as Vl,B as Pl,w as jl,x as Nl,F as Dl,y as Ll,z as $l,A as Hl,G as _l,H as Bl,J as da,S as Re,K as ft,U as ps,L as yn,M as St,O as Ht,N as De,Q as Je,V as se,W as Zl,X as me,Y as Bn,Z as zr,_ as zl,$ as Ul,a0 as ve,a1 as Gl,a2 as Ur,a3 as Gr,a4 as qr,a5 as mt,a6 as ms,a7 as ql,a8 as rn,a9 as rr,aa as sr,ab as gs,ac as Ir,ad as xi,ae as fa,af as wi,ag as He,ah as Zn,ai as sn,aj as zn,ak as Kr,al as Ei,am as Kl,an as Wl,ao as Yl,ap as Si,aq as ir,ar as ki,as as Ql,r as o,at as ha,au as pa,av as Mn,aw as Cn,u as vs,ax as Xl,ay as ma,az as Jl,aA as Te,aB as ga,j as d,aC as ys,aD as bs,aE as Xe,aF as Un,aG as bt,aH as jt,aI as _e,aJ as Oe,aK as Nn,aL as ec,aM as oe,aN as Ce,aO as xs,aP as _t,aQ as xt,aR as ws,aS as Fe,aT as Es,aU as Ar,aV as tc,aW as nc,aX as va,aY as rc,aZ as We,a_ as Vr,a$ as sc,b0 as ic,b1 as ac,b2 as oc,b3 as lc,b4 as ya,b5 as ba,b6 as cc,b7 as Ke,b8 as K,b9 as le,ba as he,bb as Gt,bc as Z,bd as xa,be as ar,bf as or,bg as qt,bh as lr,bi as cr,bj as te,bk as Kt,bl as Wt,bm as ur,bn as rt,bo as dr,bp as Mi,bq as un,br as uc,bs as wa,bt as ne,bu as ye,bv as bn,bw as Ea,bx as Nt,by as Sa,bz as Ss,bA as xn,bB as ae,bC as Se,bD as ka,bE as dt,bF as Ma,bG as Qe,bH as Bt,bI as ks,bJ as Ms,bK as Ca,bL as Ta,bM as Fa,bN as Ct,bO as fr,bP as ge,bQ as Cs,bR as Ts,bS as Fs,bT as Ee,bU as dc,bV as hr,bW as Wr,bX as Os,bY as Oa,bZ as fc,b_ as Ra,b$ as Rs,c0 as Ia,c1 as Aa,c2 as pr,c3 as st,c4 as Is,c5 as As,c6 as an,c7 as hc,c8 as mr,c9 as on,ca as ze,cb as et,cc as Va,cd as Ci,ce as wt,cf as pc,cg as mc,ch as gc,ci as vc,cj as Pa,ck as Ti,cl as yc,cm as bc,cn as Pr,co as xc,cp as wc,cq as Ec,cr as Sc,cs as kc,ct as Mc,cu as Cc,cv as Tc,cw as Fc,cx as Oc,cy as Vs,cz as Rc,cA as Ic,cB as Ac,cC as Vc,cD as Pc,cE as jc,cF as Nc,cG as Dc,cH as Yr,cI as Lc,cJ as Fi,cK as Ze,cL as $c,cM as Gn,cN as be,cO as ja,cP as Na,cQ as Da,cR as Zt,cS as La,cT as $a,cU as Ha,cV as Qr,cW as gr,cX as Hc,cY as Tn,cZ as _c,c_ as Bc,c$ as Zc,d0 as Fn,d1 as jr,d2 as On,d3 as zc,d4 as Uc,d5 as Gc,d6 as Oi}from"./index-aqIlSDjR.js";function qc(e){return{type:"createEntity",id:e.id,values:e.values??[]}}function zt(e){return{type:"createRelation",...e}}function Ie(e){return ua(`grc20:genesis:language:${e.toLowerCase()}`)}const Nr={english:()=>Ie("en"),spanish:()=>Ie("es"),french:()=>Ie("fr"),german:()=>Ie("de"),chinese:()=>Ie("zh"),japanese:()=>Ie("ja"),korean:()=>Ie("ko"),portuguese:()=>Ie("pt"),italian:()=>Ie("it"),russian:()=>Ie("ru"),arabic:()=>Ie("ar"),hindi:()=>Ie("hi"),fromCode:e=>Ie(e)},qn=e=>e.toUpperCase(),kt=e=>e.toLowerCase(),Kn=e=>e.length===0,tt=e=>e.length>0,Dt=e=>e.length;class Ri extends Error{_tag="IpfsUploadError"}function Kc(e){return ua(e)}async function Wc(e){const{name:n,ops:t,author:r,network:s="MAINNET"}=e,i=yl(),a={id:i,name:n,authors:[Kc(r)],createdAt:BigInt(Date.now())*1000n,ops:t},l=bl(a),c=new Uint8Array(l),f=new Blob([c],{type:"application/octet-stream"}),h=new FormData;h.append("file",f);const g=await xl(Yc(h,s)),u=wl(i);return{cid:g,editId:u}}function Yc(e,n){return El(function*(){const t=yield*yi({try:()=>fetch(`${Sl(n)}/ipfs/upload-edit`,{method:"POST",body:e}),catch:s=>new Ri(`Could not upload data to IPFS: ${s}`)});return yield*yi({try:async()=>{const{cid:s}=await t.json();return s},catch:s=>new Ri(`Could not parse response from IPFS: ${s}`)})})}const Dn=({id:e,fromEntity:n,toEntity:t,position:r,fromSpace:s,toSpace:i,fromVersion:a,toVersion:l,type:c,entityId:f,entityName:h,entityDescription:g,entityCover:u,entityValues:m,entityRelations:p,entityTypes:v})=>{e&&Y(e,"`id` in `createRelation`"),n&&Y(n,"`fromEntity` in `createRelation`"),t&&Y(t,"`toEntity` in `createRelation`"),s&&Y(s,"`fromSpace` in `createRelation`"),i&&Y(i,"`toSpace` in `createRelation`"),a&&Y(a,"`fromVersion` in `createRelation`"),l&&Y(l,"`toVersion` in `createRelation`"),c&&Y(c,"`type` in `createRelation`"),f&&Y(f,"`entityId` in `createRelation`"),u&&Y(u,"`entityCover` in `createRelation`");for(const x of m??[])Y(x.property,"`entityValues` in `createRelation`"),x.type==="text"&&x.language&&Y(x.language,"`language` in `entityValues` in `createRelation`"),x.type==="float64"&&x.unit&&Y(x.unit,"`unit` in `entityValues` in `createRelation`");for(const[x]of Object.entries(p??{}))Y(x,"`entityRelations` in `createRelation`");for(const x of v??[])Y(x,"`entityTypes` in `createRelation`");const y=e??ke(),S=f??ke(),E=[];if(E.push(zt({id:ee(y),entity:ee(S),from:ee(n),to:ee(t),relationType:ee(c),...s?{fromSpace:ee(s)}:{},...a?{fromVersion:ee(a)}:{},...i?{toSpace:ee(i)}:{},...l?{toVersion:ee(l)}:{},...r!==void 0?{position:r}:{}})),h||g||u||m||p||v){const{ops:x}=Ps({id:S,name:h,description:g,cover:u,values:m,relations:p,types:v});E.push(...x)}return{id:nt(y),ops:E}},Ps=({id:e,name:n,description:t,cover:r,values:s,relations:i,types:a})=>{e&&Y(e,"`id` in `createEntity`"),r&&Y(r,"`cover` in `createEntity`");for(const h of s??[])Y(h.property,"`values` in `createEntity`"),h.type==="text"&&h.language&&Y(h.language,"`language` in `values` in `createEntity`"),h.type==="float64"&&h.unit&&Y(h.unit,"`unit` in `values` in `createEntity`");for(const[h,g]of Object.entries(i??{}))if(Y(h,"`relations` in `createEntity`"),Array.isArray(g))for(const u of g)Y(u.toEntity,"`toEntity` in `relations` in `createEntity`"),u.toSpace&&Y(u.toSpace,"`toSpace` in `relations` in `createEntity`"),u.fromSpace&&Y(u.fromSpace,"`fromSpace` in `relations` in `createEntity`"),u.fromVersion&&Y(u.fromVersion,"`fromVersion` in `relations` in `createEntity`"),u.toVersion&&Y(u.toVersion,"`toVersion` in `relations` in `createEntity`"),u.entityId&&Y(u.entityId,"`entityId` in `relations` in `createEntity`"),u.entityCover&&Y(u.entityCover,"`entityCover` in `relations` in `createEntity`");else Y(g.toEntity,"`toEntity` in `relations` in `createEntity`"),g.toSpace&&Y(g.toSpace,"`toSpace` in `relations` in `createEntity`"),g.fromSpace&&Y(g.fromSpace,"`fromSpace` in `relations` in `createEntity`"),g.fromVersion&&Y(g.fromVersion,"`fromVersion` in `relations` in `createEntity`"),g.toVersion&&Y(g.toVersion,"`toVersion` in `relations` in `createEntity`"),g.entityId&&Y(g.entityId,"`entityId` in `relations` in `createEntity`"),g.entityCover&&Y(g.entityCover,"`entityCover` in `relations` in `createEntity`");for(const h of a??[])Y(h,"`types` in `createEntity`");const l=e??ke();let c=[];const f=[];n&&f.push({property:ee(kl),value:{type:"text",value:n,language:Nr.english()}}),t&&f.push({property:ee(Ml),value:{type:"text",value:t,language:Nr.english()}});for(const h of s??[]){const g=ee(h.property);if(h.type==="text")f.push({property:g,value:{type:"text",value:h.value,language:h.language?ee(h.language):Nr.english()}});else if(h.type==="float64")f.push({property:g,value:{type:"float64",value:h.value,...h.unit?{unit:ee(h.unit)}:{}}});else if(h.type==="bool")f.push({property:g,value:{type:"bool",value:h.value}});else if(h.type==="point")f.push({property:g,value:{type:"point",lon:h.lon,lat:h.lat,...h.alt!==void 0?{alt:h.alt}:{}}});else if(h.type==="date")f.push({property:g,value:{type:"date",value:h.value}});else if(h.type==="time")f.push({property:g,value:{type:"time",value:h.value}});else if(h.type==="datetime")f.push({property:g,value:{type:"datetime",value:h.value}});else if(h.type==="schedule")f.push({property:g,value:{type:"schedule",value:h.value}});else{const u=h;throw new Error(`Unsupported value type: ${u.type}`)}}if(c.push(qc({id:ee(l),values:f})),r&&c.push(zt({id:ee(ke()),entity:ee(ke()),from:ee(l),to:ee(r),relationType:ee(Cl)})),a)for(const h of a)c.push(zt({id:ee(ke()),entity:ee(ke()),from:ee(l),to:ee(h),relationType:ee(hs)}));for(const[h,g]of Object.entries(i??{})){const u=Array.isArray(g)?g:[g];for(const m of u){const p=m.id??ke(),v=m.entityId??ke(),{ops:y}=Dn({id:p,fromEntity:l,toEntity:m.toEntity,type:nt(h),position:m.position,fromSpace:m.fromSpace,toSpace:m.toSpace,fromVersion:m.fromVersion,toVersion:m.toVersion,entityId:v,entityName:m.entityName,entityDescription:m.entityDescription,entityCover:m.entityCover,entityValues:m.entityValues,entityRelations:m.entityRelations,entityTypes:m.entityTypes});c=c.concat(y)}}return{id:nt(l),ops:c}},Qc={BOOLEAN:$l,INT64:Ll,FLOAT64:Dl,DECIMAL:Nl,TEXT:jl,BYTES:Pl,DATE:Vl,TIME:Al,DATETIME:Il,SCHEDULE:Rl,POINT:Ol,EMBEDDING:Fl},Xr=e=>{const{id:n,name:t,description:r,cover:s}=e;if(n&&Y(n,"`id` in `createProperty`"),s&&Y(s,"`cover` in `createProperty`"),e.dataType==="RELATION"){for(const c of e.properties??[])Y(c,"`properties` in `createProperty`");for(const c of e.relationValueTypes??[])Y(c,"`relationValueTypes` in `createProperty`")}const i=n??ke(),a=[],{ops:l}=Ps({id:i,name:t,description:r,cover:s});if(a.push(...l),a.push(zt({id:ee(ke()),entity:ee(ke()),from:ee(i),to:ee(bi),relationType:ee(hs)})),e.dataType==="RELATION"){if(e.properties)for(const c of e.properties){Y(c);const{ops:f}=Dn({fromEntity:i,toEntity:c,type:bi});a.push(...f)}if(e.relationValueTypes)for(const c of e.relationValueTypes){Y(c);const{ops:f}=Dn({fromEntity:i,toEntity:c,type:Tl});a.push(...f)}}else{const c=Qc[e.dataType],{ops:f}=Dn({fromEntity:i,toEntity:c,type:Hl});a.push(...f)}return{id:nt(i),ops:a}},_a=({id:e,name:n,description:t,cover:r,properties:s})=>{e&&Y(e,"`id` in `createType`");for(const l of s??[])Y(l,"`properties` in `createType`");const i=e??ke(),{ops:a}=Ps({id:i,name:n,description:t,cover:r});if(Y(i),a.push(zt({id:ee(ke()),entity:ee(ke()),from:ee(i),to:ee(_l),relationType:ee(hs)})),s)for(const l of s)Y(l,"`propertyId` in `createType`"),a.push(zt({id:ee(ke()),entity:ee(ke()),from:ee(i),to:ee(l),relationType:ee(Bl)}));return{id:nt(i),ops:a}};function Ba(e){if(Kn(e))throw new Za({input:e,cause:"Input is empty"});let n="",t=!1,r=0;for(;r<Dt(e)&&!/[a-zA-Z0-9]/.test(e[r]);)r++;for(;r<Dt(e);r++){const s=e[r];/[a-zA-Z0-9]/.test(s)?t?(n+=qn(s),t=!1):Dt(n)===0?n+=kt(s):/[A-Z]/.test(s)&&r>0&&/[a-z0-9]/.test(e[r-1])?n+=qn(s):n+=kt(s):t=Dt(n)>0}return n}function Jr(e){if(Kn(e))throw new Za({input:e,cause:"Input is empty"});let n="",t=!0,r=0;for(;r<Dt(e)&&!/[a-zA-Z0-9]/.test(e[r]);)r++;for(;r<Dt(e);r++){const s=e[r];/[a-zA-Z0-9]/.test(s)?t?(n+=qn(s),t=!1):/[A-Z]/.test(s)&&r>0&&/[a-z0-9]/.test(e[r-1])?n+=qn(s):n+=kt(s):t=!0}return n}class Za extends da("/typesync/errors/InvalidInputError"){}function vr(e){const n=new Set;for(const t of e){const r=kt(t.name);if(n.has(r))return!1;n.add(r)}return!0}function ut(e){return/^Relation\((.+)\)$/.test(e)}const za=De.pipe(St(e=>ut(e))),Ua=ms("String","Number","Boolean","Date","Point");ps(Ua,za);const Ga=Re({name:De,knowledgeGraphId:Ht(rn),optional:zr(zl(ql))}),qa=Re({...Ga.fields,dataType:za,relationType:De.annotations({identifier:"SchemaTypePropertyRelation.relationType",description:"name of the type within the schema that this property is related to",examples:["Account"]})}),Ka=Re({...Ga.fields,dataType:Ua});function dn(e){return ut(e.dataType)}const Wa=Re({name:De,knowledgeGraphId:Ht(rn),properties:ft(ps(Ka,qa)).pipe(yn(1),St(vr,{identifier:"DuplicatePropertyNames",jsonSchema:{},description:"The property.name must be unique across all properties in the type"}))}),Ya=Re({types:ft(Wa).pipe(yn(1),St(vr,{identifier:"DuplicateTypeNames",jsonSchema:{},description:"The type.name must be unique across all types in the schema"}),St(Qa,{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:"a5fd07b1120f46c6b46f387ef98396a6",properties:[{name:"name",optional:!0,knowledgeGraphId:"a126ca530c8e48d5b88882c734c38935",dataType:"String"}]}]}]}),Xc=Ul(Ya);rr(Ya);function Qa(e){const n=Je(e,new Set,(t,r)=>t.add(r.name));return se(e,Bn(t=>t.properties),me(t=>dn(t)),Zl(t=>n.has(t.relationType)))}function es(e){return se(e,Je({},(n,{propName:t,id:r})=>(n[Ba(t)]=r,n)))}function ts(e){return se(e,Je({},(n,{propName:t,id:r})=>(n[Ba(t)]=r,n)))}function Jc(e,n){if(e.knowledgeGraphId)return{type:"resolved",mapping:{propName:e.name,id:nt(e.knowledgeGraphId)},ops:[]};if(dn(e)){const s=n.get(e.relationType);if(s==null)return{type:"deferred",property:e};const{id:i,ops:a}=Xr({name:e.name,dataType:"RELATION",relationValueTypes:[s]});return{type:"resolved",mapping:{propName:e.name,id:i},ops:a}}const{id:t,ops:r}=Xr({name:e.name,dataType:ru(e.dataType)});return{type:"resolved",mapping:{propName:e.name,id:t},ops:r}}function eu(e,n){const t=se(e.properties,ve(u=>Jc(u,n))),r=se(t,Ur(u=>u.type==="resolved"?qr(u):Gr())),s=se(t,Ur(u=>u.type==="deferred"?qr(u.property):Gr())),i=se(r,me(u=>{const m=e.properties.find(p=>p.name===u.mapping.propName);return m?!dn(m):!1}),ve(u=>u.mapping)),a=se(r,me(u=>{const m=e.properties.find(p=>p.name===u.mapping.propName);return m?dn(m):!1}),ve(u=>u.mapping)),l=se(r,Bn(u=>u.ops));if(e.knowledgeGraphId){const u={typeName:Jr(e.name),typeIds:[nt(e.knowledgeGraphId)]};return mt(i)&&(u.properties=es(i)),mt(a)&&(u.relations=ts(a)),{type:"complete",entry:u,ops:l}}if(mt(s))return{type:"deferred",schemaType:e,properties:i,relations:a};const c=[...i,...a],{id:f,ops:h}=_a({name:e.name,properties:se(c,ve(u=>u.id))});n.set(e.name,f);const g={typeName:Jr(e.name),typeIds:[f]};return mt(i)&&(g.properties=es(i)),mt(a)&&(g.relations=ts(a)),{type:"complete",entry:g,ops:[...l,...h]}}function tu(e){const n=Xc(e),t=se(n.types,Je(new Map,(g,u)=>g.set(u.name,u.knowledgeGraphId!=null?nt(u.knowledgeGraphId):null))),r=se(n.types,ve(g=>eu(g,t))),[s,i]=se(r,Gl(g=>g.type==="complete")),a=se(i,Bn(g=>g.ops)),{entries:l,ops:c}=se(s,Je({entries:[],ops:[]},(g,u)=>{const m=se(u.schemaType.properties,Ur(M=>{if(!dn(M)||M.knowledgeGraphId!=null)return Gr();const V=t.get(M.relationType);if(V==null)throw new nu({message:`Failed to resolve type ID for relation type: ${M.relationType}`,property:M.name,relatedType:M.relationType});const{id:b,ops:F}=Xr({name:M.name,dataType:"RELATION",relationValueTypes:[V]});return qr({mapping:{propName:M.name,id:b},ops:F})})),p=[...u.relations,...se(m,ve(M=>M.mapping))],v=[...u.properties,...p],{id:y,ops:S}=_a({name:u.schemaType.name,properties:se(v,ve(M=>M.id))});t.set(u.schemaType.name,y);const E=[...se(m,Bn(M=>M.ops)),...S],x={typeName:Jr(u.schemaType.name),typeIds:[y]};return mt(u.properties)&&(x.properties=es(u.properties)),mt(p)&&(x.relations=ts(p)),{entries:[...g.entries,x],ops:[...g.ops,...E]}})),f=[...se(i,ve(g=>g.entry)),...l];return[se(f,Je({},(g,u)=>{const{typeName:m,...p}=u;return g[m]=p,g})),[...a,...c]]}class nu extends da("/typesync/errors/RelationValueTypeDoesNotExistError"){}function ru(e){switch(!0){case e==="Boolean":return"BOOLEAN";case e==="Date":return"TIME";case e==="Number":return"FLOAT64";case e==="Point":return"POINT";case ut(e):return"RELATION";default:return"TEXT"}}const Xa=Ht(ms("published","synced","published_not_synced")),su=ps(Ka,qa).pipe(gs(Re({status:Xa})));class ns extends sr("/Hypergraph/cli/models/TypesyncHypergraphSchemaType")({...Wa.omit("properties").fields,status:Xa,properties:ft(su).pipe(yn(1),St(vr,{identifier:"DuplicatePropertyNames",jsonSchema:{},description:"The property.name must be unique across all properties in the type"}))}){}class wn extends sr("/Hypergraph/cli/models/TypesyncHypergraphSchema")({types:ft(ns).pipe(yn(1),St(vr,{identifier:"DuplicateTypeNames",jsonSchema:{},description:"The type.name must be unique across all types in the schema"}),St(Qa,{identifier:"AllRelationTypesExist",jsonSchema:{},description:"Each type property of dataType RELATION must have a type of the same name in the schema"}))}){}Ir({key:De,value:Re({typeIds:ft(rn).pipe(yn(1)),properties:zr(xi(Ir({key:De,value:rn}))),relations:zr(xi(Ir({key:De,value:rn})))})});const iu=(e,...n)=>e.reduce((t,r,s)=>`${t}${r}${s in n?String(n[s]):""}`,"");var au=class extends fa{constructor(e,n){super(),this.options=n,this.#n=e,this.#o=null,this.#a=wi(),this.bindMethods(),this.setOptions(n)}#n;#e=void 0;#r=void 0;#t=void 0;#s;#i;#a;#o;#m;#f;#h;#c;#u;#l;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Ii(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rs(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rs(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#e.removeObserver(this)}setOptions(e){const n=this.options,t=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 He(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&&!Zn(this.options,n)&&this.#n.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&Ai(this.#e,t,this.options,n)&&this.#d(),this.updateResult(),r&&(this.#e!==t||He(this.options.enabled,this.#e)!==He(n.enabled,this.#e)||sn(this.options.staleTime,this.#e)!==sn(n.staleTime,this.#e))&&this.#g();const s=this.#v();r&&(this.#e!==t||He(this.options.enabled,this.#e)!==He(n.enabled,this.#e)||s!==this.#l)&&this.#y(s)}getOptimisticResult(e){const n=this.#n.getQueryCache().build(this.#n,e),t=this.createResult(n,e);return lu(this,t)&&(this.#t=t,this.#i=this.options,this.#s=this.#e.state),t}getCurrentResult(){return this.#t}trackResult(e,n){return new Proxy(e,{get:(t,r)=>(this.trackProp(r),n?.(r),r==="promise"&&!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(t,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=this.#n.defaultQueryOptions(e),t=this.#n.getQueryCache().build(this.#n,n);return t.fetch().then(()=>this.createResult(t,n))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#d(e){this.#E();let n=this.#e.fetch(this.options,e);return e?.throwOnError||(n=n.catch(zn)),n}#g(){this.#x();const e=sn(this.options.staleTime,this.#e);if(Kr||this.#t.isStale||!Ei(e))return;const t=Kl(this.#t.dataUpdatedAt,e)+1;this.#c=setTimeout(()=>{this.#t.isStale||this.updateResult()},t)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#l=e,!(Kr||He(this.options.enabled,this.#e)===!1||!Ei(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||Wl.isFocused())&&this.#d()},this.#l))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(e,n){const t=this.#e,r=this.options,s=this.#t,i=this.#s,a=this.#i,c=e!==t?e.state:this.#r,{state:f}=e;let h={...f},g=!1,u;if(n._optimisticResults){const k=this.hasListeners(),N=!k&&Ii(e,n),T=k&&Ai(e,t,n,r);(N||T)&&(h={...h,...Yl(f.data,e.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:m,errorUpdatedAt:p,status:v}=h;u=h.data;let y=!1;if(n.placeholderData!==void 0&&u===void 0&&v==="pending"){let k;s?.isPlaceholderData&&n.placeholderData===a?.placeholderData?(k=s.data,y=!0):k=typeof n.placeholderData=="function"?n.placeholderData(this.#h?.state.data,this.#h):n.placeholderData,k!==void 0&&(v="success",u=Si(s?.data,k,n),g=!0)}if(n.select&&u!==void 0&&!y)if(s&&u===i?.data&&n.select===this.#m)u=this.#f;else try{this.#m=n.select,u=n.select(u),u=Si(s?.data,u,n),this.#f=u,this.#o=null}catch(k){this.#o=k}this.#o&&(m=this.#o,u=this.#f,p=Date.now(),v="error");const S=h.fetchStatus==="fetching",E=v==="pending",x=v==="error",M=E&&S,V=u!==void 0,F={status:v,fetchStatus:h.fetchStatus,isPending:E,isSuccess:v==="success",isError:x,isInitialLoading:M,isLoading:M,data:u,dataUpdatedAt:h.dataUpdatedAt,error:m,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:S,isRefetching:S&&!E,isLoadingError:x&&!V,isPaused:h.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:x&&V,isStale:js(e,n),refetch:this.refetch,promise:this.#a,isEnabled:He(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=R=>{F.status==="error"?R.reject(F.error):F.data!==void 0&&R.resolve(F.data)},N=()=>{const R=this.#a=F.promise=wi();k(R)},T=this.#a;switch(T.status){case"pending":e.queryHash===t.queryHash&&k(T);break;case"fulfilled":(F.status==="error"||F.data!==T.value)&&N();break;case"rejected":(F.status!=="error"||F.error!==T.reason)&&N();break}}return F}updateResult(){const e=this.#t,n=this.createResult(this.#e,this.options);if(this.#s=this.#e.state,this.#i=this.options,this.#s.data!==void 0&&(this.#h=this.#e),Zn(n,e))return;this.#t=n;const t=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#p.size)return!0;const i=new Set(s??this.#p);return this.options.throwOnError&&i.add("error"),Object.keys(this.#t).some(a=>{const l=a;return this.#t[l]!==e[l]&&i.has(l)})};this.#S({listeners:t()})}#E(){const e=this.#n.getQueryCache().build(this.#n,this.options);if(e===this.#e)return;const n=this.#e;this.#e=e,this.#r=e.state,this.hasListeners()&&(n?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){ir.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(this.#t)}),this.#n.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function ou(e,n){return He(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&n.retryOnMount===!1)}function Ii(e,n){return ou(e,n)||e.state.data!==void 0&&rs(e,n,n.refetchOnMount)}function rs(e,n,t){if(He(n.enabled,e)!==!1&&sn(n.staleTime,e)!=="static"){const r=typeof t=="function"?t(e):t;return r==="always"||r!==!1&&js(e,n)}return!1}function Ai(e,n,t,r){return(e!==n||He(r.enabled,e)===!1)&&(!t.suspense||e.state.status!=="error")&&js(e,t)}function js(e,n){return He(n.enabled,e)!==!1&&e.isStaleByTime(sn(n.staleTime,e))}function lu(e,n){return!Zn(e.getCurrentResult(),n)}var cu=class extends fa{#n;#e=void 0;#r;#t;constructor(e,n){super(),this.#n=e,this.setOptions(n),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const n=this.options;this.options=this.#n.defaultMutationOptions(e),Zn(this.options,n)||this.#n.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),n?.mutationKey&&this.options.mutationKey&&ki(n.mutationKey)!==ki(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(e){this.#s(),this.#i(e)}getCurrentResult(){return this.#e}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#s(),this.#i()}mutate(e,n){return this.#t=n,this.#r?.removeObserver(this),this.#r=this.#n.getMutationCache().build(this.#n,this.options),this.#r.addObserver(this),this.#r.execute(e)}#s(){const e=this.#r?.state??Ql();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}}#i(e){ir.batch(()=>{if(this.#t&&this.hasListeners()){const n=this.#e.variables,t=this.#e.context;e?.type==="success"?(this.#t.onSuccess?.(e.data,n,t),this.#t.onSettled?.(e.data,null,n,t)):e?.type==="error"&&(this.#t.onError?.(e.error,n,t),this.#t.onSettled?.(void 0,e.error,n,t))}this.listeners.forEach(n=>{n(this.#e)})})}},Ja=o.createContext(!1),uu=()=>o.useContext(Ja);Ja.Provider;function du(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fu=o.createContext(du()),hu=()=>o.useContext(fu),pu=(e,n)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(n.isReset()||(e.retryOnMount=!1))},mu=e=>{o.useEffect(()=>{e.clearReset()},[e])},gu=({result:e,errorResetBoundary:n,throwOnError:t,query:r,suspense:s})=>e.isError&&!n.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||ha(t,[e.error,r])),vu=e=>{if(e.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),t=e.staleTime;e.staleTime=typeof t=="function"?(...r)=>n(t(...r)):n(t),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},yu=(e,n)=>e.isLoading&&e.isFetching&&!n,bu=(e,n)=>e?.suspense&&n.isPending,Vi=(e,n,t)=>n.fetchOptimistic(e).catch(()=>{t.clearReset()});function xu(e,n,t){const r=uu(),s=hu(),i=pa(),a=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=r?"isRestoring":"optimistic",vu(a),pu(a,s),mu(s);const l=!i.getQueryCache().get(a.queryHash),[c]=o.useState(()=>new n(i,a)),f=c.getOptimisticResult(a),h=!r&&e.subscribed!==!1;if(o.useSyncExternalStore(o.useCallback(g=>{const u=h?c.subscribe(ir.batchCalls(g)):zn;return c.updateResult(),u},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),o.useEffect(()=>{c.setOptions(a)},[a,c]),bu(a,f))throw Vi(a,c,s);if(gu({result:f,errorResetBoundary:s,throwOnError:a.throwOnError,query:i.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw f.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(a,f),a.experimental_prefetchInRender&&!Kr&&yu(f,r)&&(l?Vi(a,c,s):i.getQueryCache().get(a.queryHash)?.promise)?.catch(zn).finally(()=>{c.updateResult()}),a.notifyOnChangeProps?f:c.trackResult(f)}function Ns(e,n){return xu(e,au)}function eo(e,n){const t=pa(),[r]=o.useState(()=>new cu(t,e));o.useEffect(()=>{r.setOptions(e)},[r,e]);const s=o.useSyncExternalStore(o.useCallback(a=>r.subscribe(ir.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=o.useCallback((a,l)=>{r.mutate(a,l).catch(zn)},[r]);if(s.error&&ha(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}const wu=iu`
|
|
1
|
+
import{d as ua,b as yl,e as bl,c as xl,f as wl,g as El,t as yi,h as Sl,i as Y,k as ke,l as ee,I as nt,m as kl,D as Ml,C as Cl,T as hs,P as bi,n as Tl,E as Fl,o as Ol,p as Rl,q as Il,s as Al,v as Vl,B as Pl,w as jl,x as Nl,F as Dl,y as Ll,z as $l,A as Hl,G as _l,H as Bl,J as da,S as Re,K as ft,U as ps,L as yn,M as St,O as Ht,N as De,Q as Je,V as se,W as Zl,X as me,Y as Bn,Z as zr,_ as zl,$ as Ul,a0 as ve,a1 as Gl,a2 as Ur,a3 as Gr,a4 as qr,a5 as mt,a6 as ms,a7 as ql,a8 as rn,a9 as rr,aa as sr,ab as gs,ac as Ir,ad as xi,ae as fa,af as wi,ag as He,ah as Zn,ai as sn,aj as zn,ak as Kr,al as Ei,am as Kl,an as Wl,ao as Yl,ap as Si,aq as ir,ar as ki,as as Ql,r as o,at as ha,au as pa,av as Mn,aw as Cn,u as vs,ax as Xl,ay as ma,az as Jl,aA as Te,aB as ga,j as d,aC as ys,aD as bs,aE as Xe,aF as Un,aG as bt,aH as jt,aI as _e,aJ as Oe,aK as Nn,aL as ec,aM as oe,aN as Ce,aO as xs,aP as _t,aQ as xt,aR as ws,aS as Fe,aT as Es,aU as Ar,aV as tc,aW as nc,aX as va,aY as rc,aZ as We,a_ as Vr,a$ as sc,b0 as ic,b1 as ac,b2 as oc,b3 as lc,b4 as ya,b5 as ba,b6 as cc,b7 as Ke,b8 as K,b9 as le,ba as he,bb as Gt,bc as Z,bd as xa,be as ar,bf as or,bg as qt,bh as lr,bi as cr,bj as te,bk as Kt,bl as Wt,bm as ur,bn as rt,bo as dr,bp as Mi,bq as un,br as uc,bs as wa,bt as ne,bu as ye,bv as bn,bw as Ea,bx as Nt,by as Sa,bz as Ss,bA as xn,bB as ae,bC as Se,bD as ka,bE as dt,bF as Ma,bG as Qe,bH as Bt,bI as ks,bJ as Ms,bK as Ca,bL as Ta,bM as Fa,bN as Ct,bO as fr,bP as ge,bQ as Cs,bR as Ts,bS as Fs,bT as Ee,bU as dc,bV as hr,bW as Wr,bX as Os,bY as Oa,bZ as fc,b_ as Ra,b$ as Rs,c0 as Ia,c1 as Aa,c2 as pr,c3 as st,c4 as Is,c5 as As,c6 as an,c7 as hc,c8 as mr,c9 as on,ca as ze,cb as et,cc as Va,cd as Ci,ce as wt,cf as pc,cg as mc,ch as gc,ci as vc,cj as Pa,ck as Ti,cl as yc,cm as bc,cn as Pr,co as xc,cp as wc,cq as Ec,cr as Sc,cs as kc,ct as Mc,cu as Cc,cv as Tc,cw as Fc,cx as Oc,cy as Vs,cz as Rc,cA as Ic,cB as Ac,cC as Vc,cD as Pc,cE as jc,cF as Nc,cG as Dc,cH as Yr,cI as Lc,cJ as Fi,cK as Ze,cL as $c,cM as Gn,cN as be,cO as ja,cP as Na,cQ as Da,cR as Zt,cS as La,cT as $a,cU as Ha,cV as Qr,cW as gr,cX as Hc,cY as Tn,cZ as _c,c_ as Bc,c$ as Zc,d0 as Fn,d1 as jr,d2 as On,d3 as zc,d4 as Uc,d5 as Gc,d6 as Oi}from"./index-B5RxXGeM.js";function qc(e){return{type:"createEntity",id:e.id,values:e.values??[]}}function zt(e){return{type:"createRelation",...e}}function Ie(e){return ua(`grc20:genesis:language:${e.toLowerCase()}`)}const Nr={english:()=>Ie("en"),spanish:()=>Ie("es"),french:()=>Ie("fr"),german:()=>Ie("de"),chinese:()=>Ie("zh"),japanese:()=>Ie("ja"),korean:()=>Ie("ko"),portuguese:()=>Ie("pt"),italian:()=>Ie("it"),russian:()=>Ie("ru"),arabic:()=>Ie("ar"),hindi:()=>Ie("hi"),fromCode:e=>Ie(e)},qn=e=>e.toUpperCase(),kt=e=>e.toLowerCase(),Kn=e=>e.length===0,tt=e=>e.length>0,Dt=e=>e.length;class Ri extends Error{_tag="IpfsUploadError"}function Kc(e){return ua(e)}async function Wc(e){const{name:n,ops:t,author:r,network:s="TESTNET"}=e,i=yl(),a={id:i,name:n,authors:[Kc(r)],createdAt:BigInt(Date.now())*1000n,ops:t},l=bl(a),c=new Uint8Array(l),f=new Blob([c],{type:"application/octet-stream"}),h=new FormData;h.append("file",f);const g=await xl(Yc(h,s)),u=wl(i);return{cid:g,editId:u}}function Yc(e,n="TESTNET"){return El(function*(){const t=yield*yi({try:()=>fetch(`${Sl(n)}/ipfs/upload-edit`,{method:"POST",body:e}),catch:s=>new Ri(`Could not upload data to IPFS: ${s}`)});return yield*yi({try:async()=>{const{cid:s}=await t.json();return s},catch:s=>new Ri(`Could not parse response from IPFS: ${s}`)})})}const Dn=({id:e,fromEntity:n,toEntity:t,position:r,fromSpace:s,toSpace:i,fromVersion:a,toVersion:l,type:c,entityId:f,entityName:h,entityDescription:g,entityCover:u,entityValues:m,entityRelations:p,entityTypes:v})=>{e&&Y(e,"`id` in `createRelation`"),n&&Y(n,"`fromEntity` in `createRelation`"),t&&Y(t,"`toEntity` in `createRelation`"),s&&Y(s,"`fromSpace` in `createRelation`"),i&&Y(i,"`toSpace` in `createRelation`"),a&&Y(a,"`fromVersion` in `createRelation`"),l&&Y(l,"`toVersion` in `createRelation`"),c&&Y(c,"`type` in `createRelation`"),f&&Y(f,"`entityId` in `createRelation`"),u&&Y(u,"`entityCover` in `createRelation`");for(const x of m??[])Y(x.property,"`entityValues` in `createRelation`"),x.type==="text"&&x.language&&Y(x.language,"`language` in `entityValues` in `createRelation`"),x.type==="float64"&&x.unit&&Y(x.unit,"`unit` in `entityValues` in `createRelation`");for(const[x]of Object.entries(p??{}))Y(x,"`entityRelations` in `createRelation`");for(const x of v??[])Y(x,"`entityTypes` in `createRelation`");const y=e??ke(),S=f??ke(),E=[];if(E.push(zt({id:ee(y),entity:ee(S),from:ee(n),to:ee(t),relationType:ee(c),...s?{fromSpace:ee(s)}:{},...a?{fromVersion:ee(a)}:{},...i?{toSpace:ee(i)}:{},...l?{toVersion:ee(l)}:{},...r!==void 0?{position:r}:{}})),h||g||u||m||p||v){const{ops:x}=Ps({id:S,name:h,description:g,cover:u,values:m,relations:p,types:v});E.push(...x)}return{id:nt(y),ops:E}},Ps=({id:e,name:n,description:t,cover:r,values:s,relations:i,types:a})=>{e&&Y(e,"`id` in `createEntity`"),r&&Y(r,"`cover` in `createEntity`");for(const h of s??[])Y(h.property,"`values` in `createEntity`"),h.type==="text"&&h.language&&Y(h.language,"`language` in `values` in `createEntity`"),h.type==="float64"&&h.unit&&Y(h.unit,"`unit` in `values` in `createEntity`");for(const[h,g]of Object.entries(i??{}))if(Y(h,"`relations` in `createEntity`"),Array.isArray(g))for(const u of g)Y(u.toEntity,"`toEntity` in `relations` in `createEntity`"),u.toSpace&&Y(u.toSpace,"`toSpace` in `relations` in `createEntity`"),u.fromSpace&&Y(u.fromSpace,"`fromSpace` in `relations` in `createEntity`"),u.fromVersion&&Y(u.fromVersion,"`fromVersion` in `relations` in `createEntity`"),u.toVersion&&Y(u.toVersion,"`toVersion` in `relations` in `createEntity`"),u.entityId&&Y(u.entityId,"`entityId` in `relations` in `createEntity`"),u.entityCover&&Y(u.entityCover,"`entityCover` in `relations` in `createEntity`");else Y(g.toEntity,"`toEntity` in `relations` in `createEntity`"),g.toSpace&&Y(g.toSpace,"`toSpace` in `relations` in `createEntity`"),g.fromSpace&&Y(g.fromSpace,"`fromSpace` in `relations` in `createEntity`"),g.fromVersion&&Y(g.fromVersion,"`fromVersion` in `relations` in `createEntity`"),g.toVersion&&Y(g.toVersion,"`toVersion` in `relations` in `createEntity`"),g.entityId&&Y(g.entityId,"`entityId` in `relations` in `createEntity`"),g.entityCover&&Y(g.entityCover,"`entityCover` in `relations` in `createEntity`");for(const h of a??[])Y(h,"`types` in `createEntity`");const l=e??ke();let c=[];const f=[];n&&f.push({property:ee(kl),value:{type:"text",value:n,language:Nr.english()}}),t&&f.push({property:ee(Ml),value:{type:"text",value:t,language:Nr.english()}});for(const h of s??[]){const g=ee(h.property);if(h.type==="text")f.push({property:g,value:{type:"text",value:h.value,language:h.language?ee(h.language):Nr.english()}});else if(h.type==="float64")f.push({property:g,value:{type:"float64",value:h.value,...h.unit?{unit:ee(h.unit)}:{}}});else if(h.type==="bool")f.push({property:g,value:{type:"bool",value:h.value}});else if(h.type==="point")f.push({property:g,value:{type:"point",lon:h.lon,lat:h.lat,...h.alt!==void 0?{alt:h.alt}:{}}});else if(h.type==="date")f.push({property:g,value:{type:"date",value:h.value}});else if(h.type==="time")f.push({property:g,value:{type:"time",value:h.value}});else if(h.type==="datetime")f.push({property:g,value:{type:"datetime",value:h.value}});else if(h.type==="schedule")f.push({property:g,value:{type:"schedule",value:h.value}});else{const u=h;throw new Error(`Unsupported value type: ${u.type}`)}}if(c.push(qc({id:ee(l),values:f})),r&&c.push(zt({id:ee(ke()),entity:ee(ke()),from:ee(l),to:ee(r),relationType:ee(Cl)})),a)for(const h of a)c.push(zt({id:ee(ke()),entity:ee(ke()),from:ee(l),to:ee(h),relationType:ee(hs)}));for(const[h,g]of Object.entries(i??{})){const u=Array.isArray(g)?g:[g];for(const m of u){const p=m.id??ke(),v=m.entityId??ke(),{ops:y}=Dn({id:p,fromEntity:l,toEntity:m.toEntity,type:nt(h),position:m.position,fromSpace:m.fromSpace,toSpace:m.toSpace,fromVersion:m.fromVersion,toVersion:m.toVersion,entityId:v,entityName:m.entityName,entityDescription:m.entityDescription,entityCover:m.entityCover,entityValues:m.entityValues,entityRelations:m.entityRelations,entityTypes:m.entityTypes});c=c.concat(y)}}return{id:nt(l),ops:c}},Qc={BOOLEAN:$l,INT64:Ll,FLOAT64:Dl,DECIMAL:Nl,TEXT:jl,BYTES:Pl,DATE:Vl,TIME:Al,DATETIME:Il,SCHEDULE:Rl,POINT:Ol,EMBEDDING:Fl},Xr=e=>{const{id:n,name:t,description:r,cover:s}=e;if(n&&Y(n,"`id` in `createProperty`"),s&&Y(s,"`cover` in `createProperty`"),e.dataType==="RELATION"){for(const c of e.properties??[])Y(c,"`properties` in `createProperty`");for(const c of e.relationValueTypes??[])Y(c,"`relationValueTypes` in `createProperty`")}const i=n??ke(),a=[],{ops:l}=Ps({id:i,name:t,description:r,cover:s});if(a.push(...l),a.push(zt({id:ee(ke()),entity:ee(ke()),from:ee(i),to:ee(bi),relationType:ee(hs)})),e.dataType==="RELATION"){if(e.properties)for(const c of e.properties){Y(c);const{ops:f}=Dn({fromEntity:i,toEntity:c,type:bi});a.push(...f)}if(e.relationValueTypes)for(const c of e.relationValueTypes){Y(c);const{ops:f}=Dn({fromEntity:i,toEntity:c,type:Tl});a.push(...f)}}else{const c=Qc[e.dataType],{ops:f}=Dn({fromEntity:i,toEntity:c,type:Hl});a.push(...f)}return{id:nt(i),ops:a}},_a=({id:e,name:n,description:t,cover:r,properties:s})=>{e&&Y(e,"`id` in `createType`");for(const l of s??[])Y(l,"`properties` in `createType`");const i=e??ke(),{ops:a}=Ps({id:i,name:n,description:t,cover:r});if(Y(i),a.push(zt({id:ee(ke()),entity:ee(ke()),from:ee(i),to:ee(_l),relationType:ee(hs)})),s)for(const l of s)Y(l,"`propertyId` in `createType`"),a.push(zt({id:ee(ke()),entity:ee(ke()),from:ee(i),to:ee(l),relationType:ee(Bl)}));return{id:nt(i),ops:a}};function Ba(e){if(Kn(e))throw new Za({input:e,cause:"Input is empty"});let n="",t=!1,r=0;for(;r<Dt(e)&&!/[a-zA-Z0-9]/.test(e[r]);)r++;for(;r<Dt(e);r++){const s=e[r];/[a-zA-Z0-9]/.test(s)?t?(n+=qn(s),t=!1):Dt(n)===0?n+=kt(s):/[A-Z]/.test(s)&&r>0&&/[a-z0-9]/.test(e[r-1])?n+=qn(s):n+=kt(s):t=Dt(n)>0}return n}function Jr(e){if(Kn(e))throw new Za({input:e,cause:"Input is empty"});let n="",t=!0,r=0;for(;r<Dt(e)&&!/[a-zA-Z0-9]/.test(e[r]);)r++;for(;r<Dt(e);r++){const s=e[r];/[a-zA-Z0-9]/.test(s)?t?(n+=qn(s),t=!1):/[A-Z]/.test(s)&&r>0&&/[a-z0-9]/.test(e[r-1])?n+=qn(s):n+=kt(s):t=!0}return n}class Za extends da("/typesync/errors/InvalidInputError"){}function vr(e){const n=new Set;for(const t of e){const r=kt(t.name);if(n.has(r))return!1;n.add(r)}return!0}function ut(e){return/^Relation\((.+)\)$/.test(e)}const za=De.pipe(St(e=>ut(e))),Ua=ms("String","Number","Boolean","Date","Point");ps(Ua,za);const Ga=Re({name:De,knowledgeGraphId:Ht(rn),optional:zr(zl(ql))}),qa=Re({...Ga.fields,dataType:za,relationType:De.annotations({identifier:"SchemaTypePropertyRelation.relationType",description:"name of the type within the schema that this property is related to",examples:["Account"]})}),Ka=Re({...Ga.fields,dataType:Ua});function dn(e){return ut(e.dataType)}const Wa=Re({name:De,knowledgeGraphId:Ht(rn),properties:ft(ps(Ka,qa)).pipe(yn(1),St(vr,{identifier:"DuplicatePropertyNames",jsonSchema:{},description:"The property.name must be unique across all properties in the type"}))}),Ya=Re({types:ft(Wa).pipe(yn(1),St(vr,{identifier:"DuplicateTypeNames",jsonSchema:{},description:"The type.name must be unique across all types in the schema"}),St(Qa,{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:"a5fd07b1120f46c6b46f387ef98396a6",properties:[{name:"name",optional:!0,knowledgeGraphId:"a126ca530c8e48d5b88882c734c38935",dataType:"String"}]}]}]}),Xc=Ul(Ya);rr(Ya);function Qa(e){const n=Je(e,new Set,(t,r)=>t.add(r.name));return se(e,Bn(t=>t.properties),me(t=>dn(t)),Zl(t=>n.has(t.relationType)))}function es(e){return se(e,Je({},(n,{propName:t,id:r})=>(n[Ba(t)]=r,n)))}function ts(e){return se(e,Je({},(n,{propName:t,id:r})=>(n[Ba(t)]=r,n)))}function Jc(e,n){if(e.knowledgeGraphId)return{type:"resolved",mapping:{propName:e.name,id:nt(e.knowledgeGraphId)},ops:[]};if(dn(e)){const s=n.get(e.relationType);if(s==null)return{type:"deferred",property:e};const{id:i,ops:a}=Xr({name:e.name,dataType:"RELATION",relationValueTypes:[s]});return{type:"resolved",mapping:{propName:e.name,id:i},ops:a}}const{id:t,ops:r}=Xr({name:e.name,dataType:ru(e.dataType)});return{type:"resolved",mapping:{propName:e.name,id:t},ops:r}}function eu(e,n){const t=se(e.properties,ve(u=>Jc(u,n))),r=se(t,Ur(u=>u.type==="resolved"?qr(u):Gr())),s=se(t,Ur(u=>u.type==="deferred"?qr(u.property):Gr())),i=se(r,me(u=>{const m=e.properties.find(p=>p.name===u.mapping.propName);return m?!dn(m):!1}),ve(u=>u.mapping)),a=se(r,me(u=>{const m=e.properties.find(p=>p.name===u.mapping.propName);return m?dn(m):!1}),ve(u=>u.mapping)),l=se(r,Bn(u=>u.ops));if(e.knowledgeGraphId){const u={typeName:Jr(e.name),typeIds:[nt(e.knowledgeGraphId)]};return mt(i)&&(u.properties=es(i)),mt(a)&&(u.relations=ts(a)),{type:"complete",entry:u,ops:l}}if(mt(s))return{type:"deferred",schemaType:e,properties:i,relations:a};const c=[...i,...a],{id:f,ops:h}=_a({name:e.name,properties:se(c,ve(u=>u.id))});n.set(e.name,f);const g={typeName:Jr(e.name),typeIds:[f]};return mt(i)&&(g.properties=es(i)),mt(a)&&(g.relations=ts(a)),{type:"complete",entry:g,ops:[...l,...h]}}function tu(e){const n=Xc(e),t=se(n.types,Je(new Map,(g,u)=>g.set(u.name,u.knowledgeGraphId!=null?nt(u.knowledgeGraphId):null))),r=se(n.types,ve(g=>eu(g,t))),[s,i]=se(r,Gl(g=>g.type==="complete")),a=se(i,Bn(g=>g.ops)),{entries:l,ops:c}=se(s,Je({entries:[],ops:[]},(g,u)=>{const m=se(u.schemaType.properties,Ur(M=>{if(!dn(M)||M.knowledgeGraphId!=null)return Gr();const V=t.get(M.relationType);if(V==null)throw new nu({message:`Failed to resolve type ID for relation type: ${M.relationType}`,property:M.name,relatedType:M.relationType});const{id:b,ops:F}=Xr({name:M.name,dataType:"RELATION",relationValueTypes:[V]});return qr({mapping:{propName:M.name,id:b},ops:F})})),p=[...u.relations,...se(m,ve(M=>M.mapping))],v=[...u.properties,...p],{id:y,ops:S}=_a({name:u.schemaType.name,properties:se(v,ve(M=>M.id))});t.set(u.schemaType.name,y);const E=[...se(m,Bn(M=>M.ops)),...S],x={typeName:Jr(u.schemaType.name),typeIds:[y]};return mt(u.properties)&&(x.properties=es(u.properties)),mt(p)&&(x.relations=ts(p)),{entries:[...g.entries,x],ops:[...g.ops,...E]}})),f=[...se(i,ve(g=>g.entry)),...l];return[se(f,Je({},(g,u)=>{const{typeName:m,...p}=u;return g[m]=p,g})),[...a,...c]]}class nu extends da("/typesync/errors/RelationValueTypeDoesNotExistError"){}function ru(e){switch(!0){case e==="Boolean":return"BOOLEAN";case e==="Date":return"TIME";case e==="Number":return"FLOAT64";case e==="Point":return"POINT";case ut(e):return"RELATION";default:return"TEXT"}}const Xa=Ht(ms("published","synced","published_not_synced")),su=ps(Ka,qa).pipe(gs(Re({status:Xa})));class ns extends sr("/Hypergraph/cli/models/TypesyncHypergraphSchemaType")({...Wa.omit("properties").fields,status:Xa,properties:ft(su).pipe(yn(1),St(vr,{identifier:"DuplicatePropertyNames",jsonSchema:{},description:"The property.name must be unique across all properties in the type"}))}){}class wn extends sr("/Hypergraph/cli/models/TypesyncHypergraphSchema")({types:ft(ns).pipe(yn(1),St(vr,{identifier:"DuplicateTypeNames",jsonSchema:{},description:"The type.name must be unique across all types in the schema"}),St(Qa,{identifier:"AllRelationTypesExist",jsonSchema:{},description:"Each type property of dataType RELATION must have a type of the same name in the schema"}))}){}Ir({key:De,value:Re({typeIds:ft(rn).pipe(yn(1)),properties:zr(xi(Ir({key:De,value:rn}))),relations:zr(xi(Ir({key:De,value:rn})))})});const iu=(e,...n)=>e.reduce((t,r,s)=>`${t}${r}${s in n?String(n[s]):""}`,"");var au=class extends fa{constructor(e,n){super(),this.options=n,this.#n=e,this.#o=null,this.#a=wi(),this.bindMethods(),this.setOptions(n)}#n;#e=void 0;#r=void 0;#t=void 0;#s;#i;#a;#o;#m;#f;#h;#c;#u;#l;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),Ii(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return rs(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return rs(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#x(),this.#w(),this.#e.removeObserver(this)}setOptions(e){const n=this.options,t=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 He(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&&!Zn(this.options,n)&&this.#n.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&Ai(this.#e,t,this.options,n)&&this.#d(),this.updateResult(),r&&(this.#e!==t||He(this.options.enabled,this.#e)!==He(n.enabled,this.#e)||sn(this.options.staleTime,this.#e)!==sn(n.staleTime,this.#e))&&this.#g();const s=this.#v();r&&(this.#e!==t||He(this.options.enabled,this.#e)!==He(n.enabled,this.#e)||s!==this.#l)&&this.#y(s)}getOptimisticResult(e){const n=this.#n.getQueryCache().build(this.#n,e),t=this.createResult(n,e);return lu(this,t)&&(this.#t=t,this.#i=this.options,this.#s=this.#e.state),t}getCurrentResult(){return this.#t}trackResult(e,n){return new Proxy(e,{get:(t,r)=>(this.trackProp(r),n?.(r),r==="promise"&&!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),Reflect.get(t,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=this.#n.defaultQueryOptions(e),t=this.#n.getQueryCache().build(this.#n,n);return t.fetch().then(()=>this.createResult(t,n))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#t))}#d(e){this.#E();let n=this.#e.fetch(this.options,e);return e?.throwOnError||(n=n.catch(zn)),n}#g(){this.#x();const e=sn(this.options.staleTime,this.#e);if(Kr||this.#t.isStale||!Ei(e))return;const t=Kl(this.#t.dataUpdatedAt,e)+1;this.#c=setTimeout(()=>{this.#t.isStale||this.updateResult()},t)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#l=e,!(Kr||He(this.options.enabled,this.#e)===!1||!Ei(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||Wl.isFocused())&&this.#d()},this.#l))}#b(){this.#g(),this.#y(this.#v())}#x(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(e,n){const t=this.#e,r=this.options,s=this.#t,i=this.#s,a=this.#i,c=e!==t?e.state:this.#r,{state:f}=e;let h={...f},g=!1,u;if(n._optimisticResults){const k=this.hasListeners(),N=!k&&Ii(e,n),T=k&&Ai(e,t,n,r);(N||T)&&(h={...h,...Yl(f.data,e.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:m,errorUpdatedAt:p,status:v}=h;u=h.data;let y=!1;if(n.placeholderData!==void 0&&u===void 0&&v==="pending"){let k;s?.isPlaceholderData&&n.placeholderData===a?.placeholderData?(k=s.data,y=!0):k=typeof n.placeholderData=="function"?n.placeholderData(this.#h?.state.data,this.#h):n.placeholderData,k!==void 0&&(v="success",u=Si(s?.data,k,n),g=!0)}if(n.select&&u!==void 0&&!y)if(s&&u===i?.data&&n.select===this.#m)u=this.#f;else try{this.#m=n.select,u=n.select(u),u=Si(s?.data,u,n),this.#f=u,this.#o=null}catch(k){this.#o=k}this.#o&&(m=this.#o,u=this.#f,p=Date.now(),v="error");const S=h.fetchStatus==="fetching",E=v==="pending",x=v==="error",M=E&&S,V=u!==void 0,F={status:v,fetchStatus:h.fetchStatus,isPending:E,isSuccess:v==="success",isError:x,isInitialLoading:M,isLoading:M,data:u,dataUpdatedAt:h.dataUpdatedAt,error:m,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:S,isRefetching:S&&!E,isLoadingError:x&&!V,isPaused:h.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:x&&V,isStale:js(e,n),refetch:this.refetch,promise:this.#a,isEnabled:He(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const k=R=>{F.status==="error"?R.reject(F.error):F.data!==void 0&&R.resolve(F.data)},N=()=>{const R=this.#a=F.promise=wi();k(R)},T=this.#a;switch(T.status){case"pending":e.queryHash===t.queryHash&&k(T);break;case"fulfilled":(F.status==="error"||F.data!==T.value)&&N();break;case"rejected":(F.status!=="error"||F.error!==T.reason)&&N();break}}return F}updateResult(){const e=this.#t,n=this.createResult(this.#e,this.options);if(this.#s=this.#e.state,this.#i=this.options,this.#s.data!==void 0&&(this.#h=this.#e),Zn(n,e))return;this.#t=n;const t=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#p.size)return!0;const i=new Set(s??this.#p);return this.options.throwOnError&&i.add("error"),Object.keys(this.#t).some(a=>{const l=a;return this.#t[l]!==e[l]&&i.has(l)})};this.#S({listeners:t()})}#E(){const e=this.#n.getQueryCache().build(this.#n,this.options);if(e===this.#e)return;const n=this.#e;this.#e=e,this.#r=e.state,this.hasListeners()&&(n?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){ir.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(this.#t)}),this.#n.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function ou(e,n){return He(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&n.retryOnMount===!1)}function Ii(e,n){return ou(e,n)||e.state.data!==void 0&&rs(e,n,n.refetchOnMount)}function rs(e,n,t){if(He(n.enabled,e)!==!1&&sn(n.staleTime,e)!=="static"){const r=typeof t=="function"?t(e):t;return r==="always"||r!==!1&&js(e,n)}return!1}function Ai(e,n,t,r){return(e!==n||He(r.enabled,e)===!1)&&(!t.suspense||e.state.status!=="error")&&js(e,t)}function js(e,n){return He(n.enabled,e)!==!1&&e.isStaleByTime(sn(n.staleTime,e))}function lu(e,n){return!Zn(e.getCurrentResult(),n)}var cu=class extends fa{#n;#e=void 0;#r;#t;constructor(e,n){super(),this.#n=e,this.setOptions(n),this.bindMethods(),this.#s()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){const n=this.options;this.options=this.#n.defaultMutationOptions(e),Zn(this.options,n)||this.#n.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),n?.mutationKey&&this.options.mutationKey&&ki(n.mutationKey)!==ki(this.options.mutationKey)?this.reset():this.#r?.state.status==="pending"&&this.#r.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#r?.removeObserver(this)}onMutationUpdate(e){this.#s(),this.#i(e)}getCurrentResult(){return this.#e}reset(){this.#r?.removeObserver(this),this.#r=void 0,this.#s(),this.#i()}mutate(e,n){return this.#t=n,this.#r?.removeObserver(this),this.#r=this.#n.getMutationCache().build(this.#n,this.options),this.#r.addObserver(this),this.#r.execute(e)}#s(){const e=this.#r?.state??Ql();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}}#i(e){ir.batch(()=>{if(this.#t&&this.hasListeners()){const n=this.#e.variables,t=this.#e.context;e?.type==="success"?(this.#t.onSuccess?.(e.data,n,t),this.#t.onSettled?.(e.data,null,n,t)):e?.type==="error"&&(this.#t.onError?.(e.error,n,t),this.#t.onSettled?.(void 0,e.error,n,t))}this.listeners.forEach(n=>{n(this.#e)})})}},Ja=o.createContext(!1),uu=()=>o.useContext(Ja);Ja.Provider;function du(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var fu=o.createContext(du()),hu=()=>o.useContext(fu),pu=(e,n)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(n.isReset()||(e.retryOnMount=!1))},mu=e=>{o.useEffect(()=>{e.clearReset()},[e])},gu=({result:e,errorResetBoundary:n,throwOnError:t,query:r,suspense:s})=>e.isError&&!n.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||ha(t,[e.error,r])),vu=e=>{if(e.suspense){const n=r=>r==="static"?r:Math.max(r??1e3,1e3),t=e.staleTime;e.staleTime=typeof t=="function"?(...r)=>n(t(...r)):n(t),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},yu=(e,n)=>e.isLoading&&e.isFetching&&!n,bu=(e,n)=>e?.suspense&&n.isPending,Vi=(e,n,t)=>n.fetchOptimistic(e).catch(()=>{t.clearReset()});function xu(e,n,t){const r=uu(),s=hu(),i=pa(),a=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=r?"isRestoring":"optimistic",vu(a),pu(a,s),mu(s);const l=!i.getQueryCache().get(a.queryHash),[c]=o.useState(()=>new n(i,a)),f=c.getOptimisticResult(a),h=!r&&e.subscribed!==!1;if(o.useSyncExternalStore(o.useCallback(g=>{const u=h?c.subscribe(ir.batchCalls(g)):zn;return c.updateResult(),u},[c,h]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),o.useEffect(()=>{c.setOptions(a)},[a,c]),bu(a,f))throw Vi(a,c,s);if(gu({result:f,errorResetBoundary:s,throwOnError:a.throwOnError,query:i.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw f.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(a,f),a.experimental_prefetchInRender&&!Kr&&yu(f,r)&&(l?Vi(a,c,s):i.getQueryCache().get(a.queryHash)?.promise)?.catch(zn).finally(()=>{c.updateResult()}),a.notifyOnChangeProps?f:c.trackResult(f)}function Ns(e,n){return xu(e,au)}function eo(e,n){const t=pa(),[r]=o.useState(()=>new cu(t,e));o.useEffect(()=>{r.setOptions(e)},[r,e]);const s=o.useSyncExternalStore(o.useCallback(a=>r.subscribe(ir.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=o.useCallback((a,l)=>{r.mutate(a,l).catch(zn)},[r]);if(s.error&&ha(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}const wu=iu`
|
|
2
2
|
query Spaces($memberId: UUID!) {
|
|
3
3
|
spaces(filter: {members: {some: {memberSpaceId: {is: $memberId}}}}) {
|
|
4
4
|
id
|
|
@@ -7,7 +7,7 @@ query Spaces($memberId: UUID!) {
|
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
`,Eu=e=>{const n=Mn(Cn,f=>f.context.identity?.accountAddress),t=Mn(Cn,f=>f.context.privyIdentity?.accountAddress),r=n||t,s=Ns({queryKey:["hypergraph-public-spaces",e.mode],queryFn:async()=>{const f=await Xl(`${ma()}/v2/graphql`,wu,{accountAddress:r});return f?.spaces?f.spaces.map(h=>({id:h.id,name:h.page?.name})):[]},enabled:e.mode==="public"&&!!r}),{isConnecting:i,listSpaces:a}=vs();o.useEffect(()=>{e.mode==="private"&&!i&&a()},[e.mode,a,i]);const l=Mn(Cn,f=>f.context.spaces),c=Mn(Cn,f=>f.context.spacesLoadingIsPending);return e.mode==="private"?{data:l,isPending:c}:s},Su=async({name:e,ops:n,walletClient:t,space:r})=>{const s=t.account?.address;if(!s)throw new Error("No address found");const i=t.chain.id===Jl.id?"TESTNET":"MAINNET",l=(await Wc({name:e,ops:n,author:s,network:i})).cid,c=await fetch(`${ma()}/space/${r}/edit/calldata`,{method:"POST",body:JSON.stringify({cid:l})}),{to:f,data:h}=await c.json();return{txResult:await t.sendUserOperation({calls:[{to:f,value:0n,data:h}]}),to:f,data:h,cid:l}};function ln(e,n,t=!0){return e.filter(s=>s.parentId===n&&(!t||s.context?.open)).flatMap(s=>[s,...ln(e,s.id,t)])}function ku(e){return"nativeEvent"in e}function Wn(e,n){const t=["mouse","pen"];return t.push("",void 0),t.includes(e)}const to={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},Dr=o.forwardRef(function(n,t){const[r,s]=o.useState();Te(()=>{ga&&s("button")},[]);const i={ref:t,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,style:to};return d.jsx("span",{...n,...i,"data-base-ui-focus-guard":""})}),Mu=o.createContext(void 0);function Pi(e,n,t,r){const s=ys(no).current;return Tu(s,e,n,t,r)&&ro(s,[e,n,t,r]),s.callback}function Cu(e){const n=ys(no).current;return Fu(n,e)&&ro(n,e),n.callback}function no(){return{callback:null,cleanup:null,refs:[]}}function Tu(e,n,t,r,s){return e.refs[0]!==n||e.refs[1]!==t||e.refs[2]!==r||e.refs[3]!==s}function Fu(e,n){return e.refs.length!==n.length||e.refs.some((t,r)=>t!==n[r])}function ro(e,n){if(e.refs=n,n.every(t=>t==null)){e.callback=null;return}e.callback=t=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),t!=null){const r=Array(n.length).fill(null);for(let s=0;s<n.length;s+=1){const i=n[s];if(i!=null)switch(typeof i){case"function":{const a=i(t);typeof a=="function"&&(r[s]=a);break}case"object":{i.current=t;break}}}e.cleanup=()=>{for(let s=0;s<n.length;s+=1){const i=n[s];if(i!=null)switch(typeof i){case"function":{const a=r[s];typeof a=="function"?a():i(null);break}case"object":{i.current=null;break}}}}}}}const Ou=parseInt(o.version,10);function so(e){return Ou>=e}function io(e,n){if(e&&!n)return e;if(!e&&n)return n;if(e||n)return{...e,...n}}function Ru(e,n){const t={};for(const r in e){const s=e[r];if(n?.hasOwnProperty(r)){const i=n[r](s);i!=null&&Object.assign(t,i);continue}s===!0?t[`data-${r.toLowerCase()}`]="":s&&(t[`data-${r.toLowerCase()}`]=s.toString())}return t}function Iu(e,n){return typeof e=="function"?e(n):e}const cn={};function ao(e,n,t,r,s){let i={...ss(e,cn)};return n&&(i=Ln(i,n)),t&&(i=Ln(i,t)),r&&(i=Ln(i,r)),i}function Au(e){if(e.length===0)return cn;if(e.length===1)return ss(e[0],cn);let n={...ss(e[0],cn)};for(let t=1;t<e.length;t+=1)n=Ln(n,e[t]);return n}function Ln(e,n){return oo(n)?n(e):Vu(e,n)}function Vu(e,n){if(!n)return e;for(const t in n){const r=n[t];switch(t){case"style":{e[t]=io(e.style,r);break}case"className":{e[t]=lo(e.className,r);break}default:Pu(t,r)?e[t]=ju(e[t],r):e[t]=r}}return e}function Pu(e,n){const t=e.charCodeAt(0),r=e.charCodeAt(1),s=e.charCodeAt(2);return t===111&&r===110&&s>=65&&s<=90&&(typeof n=="function"||typeof n>"u")}function oo(e){return typeof e=="function"}function ss(e,n){return oo(e)?e(n):e??cn}function ju(e,n){return n?e?t=>{if(Nu(t)){const s=t;is(s);const i=n(s);return s.baseUIHandlerPrevented||e?.(s),i}const r=n(t);return e?.(t),r}:n:e}function is(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function lo(e,n){return n?e?n+" "+e:n:e}function Nu(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}const Du={style:{transition:"none"}},gt={},Lu={fallbackAxisSide:"end"};function at(e,n,t={}){const r=n.render,s=$u(n,t);if(t.enabled===!1)return null;const i=t.state??gt;return Hu(e,r,s,i)}function $u(e,n={}){const{className:t,render:r}=e,{state:s=gt,ref:i,props:a,disableStyleHooks:l,customStyleHookMapping:c,enabled:f=!0}=n,h=f?Iu(t,s):void 0;let g;l!==!0&&(g=o.useMemo(()=>f?Ru(s,c):gt,[s,c,f]));const u=f?io(g,Array.isArray(a)?Au(a):a)??gt:gt;return typeof document<"u"&&(f?Array.isArray(i)?u.ref=Cu([u.ref,ji(r),...i]):u.ref=Pi(u.ref,ji(r),i):Pi(null,null)),f?(h!==void 0&&(u.className=lo(u.className,h)),u):gt}function Hu(e,n,t,r){if(n){if(typeof n=="function")return n(t,r);const s=ao(t,n.props);return s.ref=t.ref,o.cloneElement(n,s)}if(e&&typeof e=="string")return _u(e,t);throw new Error("Base UI: Render element or function are not defined.")}function _u(e,n){return e==="button"?d.jsx("button",{type:"button",...n}):e==="img"?d.jsx("img",{alt:"",...n}):o.createElement(e,n)}function ji(e){return e&&typeof e!="function"?so(19)?e.props.ref:e.ref:null}const Bu=o.forwardRef(function(n,t){const{render:r,className:s,children:i,...a}=n,{toasts:l,pauseTimers:c,resumeTimers:f,setHovering:h,setFocused:g,viewportRef:u,windowFocusedRef:m,prevFocusElement:p,setPrevFocusElement:v,hovering:y,focused:S,hasDifferingHeights:E}=bs(),x=o.useRef(!1),M=Xe(S),V=l.length;o.useEffect(()=>{if(!u.current)return;function D(B){V!==0&&B.key==="F6"&&B.target!==u.current&&(B.preventDefault(),v(bt(jt(u.current))),u.current?.focus(),c(),g(!0))}const j=Un(u.current);return j.addEventListener("keydown",D),()=>{j.removeEventListener("keydown",D)}},[c,g,v,V,u]),o.useEffect(()=>{if(!u.current||!V)return;const D=Un(u.current);function j(G){G.target===D&&(m.current=!1,c())}function B(G){if(G.relatedTarget||G.target===D)return;const W=_e(G),z=bt(jt(u.current));(!Oe(u.current,W)||!Nn(z))&&f(),setTimeout(()=>{m.current=!0})}return D.addEventListener("blur",j,!0),D.addEventListener("focus",B,!0),()=>{D.removeEventListener("blur",j,!0),D.removeEventListener("focus",B,!0)}},[c,f,u,m,g,M,V]);function b(D){u.current&&(x.current=!0,D.relatedTarget===u.current?l[0]?.ref?.current?.focus():p?.focus({preventScroll:!0}))}function F(D){D.key==="Tab"&&D.shiftKey&&D.target===u.current&&(D.preventDefault(),p?.focus({preventScroll:!0}),f())}function k(){c(),h(!0)}function N(){const D=bt(jt(u.current));Oe(u.current,D)&&Nn(D)||(f(),h(!1))}function T(){if(x.current){x.current=!1;return}if(S)return;const D=bt(jt(u.current));!m.current&&!Nn(D)||(g(!0),c())}function R(D){!S||Oe(u.current,D.relatedTarget)||(g(!1),f())}const C={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:k,onMouseMove:k,onMouseLeave:N,onFocus:T,onBlur:R,onKeyDown:F,onClick:T},w=o.useMemo(()=>({expanded:y||S||E}),[y,S,E]),A=at("div",n,{ref:[t,u],state:w,props:[C,{...a,children:d.jsxs(o.Fragment,{children:[V>0&&p&&d.jsx(Dr,{onFocus:b}),i,V>0&&p&&d.jsx(Dr,{onFocus:b})]})}]}),P=o.useMemo(()=>({viewportRef:u}),[u]),q=o.useMemo(()=>l.filter(D=>D.priority==="high"),[l]);return d.jsxs(Mu.Provider,{value:P,children:[V>0&&p&&d.jsx(Dr,{onFocus:b}),A,!S&&q.length>0&&d.jsx("div",{style:to,children:q.map(D=>d.jsxs("div",{role:"alert","aria-atomic":!0,children:[d.jsx("div",{children:D.title}),d.jsx("div",{children:D.description})]},D.id))})]})});function Zu(e){return so(19)?e:e?"true":void 0}const co=o.createContext(void 0);function fn(){const e=o.useContext(co);if(!e)throw new Error("Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.");return e}let Yn=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const zu={[Yn.startingStyle]:""},Uu={[Yn.endingStyle]:""},uo={transitionStatus(e){return e==="starting"?zu:e==="ending"?Uu:null}},Rn=null;class Gu{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=n=>{this.isScheduled=!1;const t=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s<t.length;s+=1)t[s]?.(n)};request(n){const t=this.nextId;return this.nextId+=1,this.callbacks.push(n),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),t}cancel(n){const t=n-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,this.callbacksCount-=1)}}const In=new Gu;class Ye{static create(){return new Ye}static request(n){return In.request(n)}static cancel(n){return In.cancel(n)}currentId=Rn;request(n){this.cancel(),this.currentId=In.request(()=>{this.currentId=Rn,n()})}cancel=()=>{this.currentId!==Rn&&(In.cancel(this.currentId),this.currentId=Rn)};disposeEffect=()=>this.cancel}function qu(){const e=ys(Ye.create).current;return ec(e.disposeEffect),e}function Ku(e,n=!1){const t=qu();return oe((r,s=null)=>{if(t.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?r():t.request(()=>{function a(){i&&Promise.allSettled(i.getAnimations().map(l=>l.finished)).then(()=>{s!=null&&s.aborted||Ce.flushSync(r)})}n?t.request(a):a()})})}function Ds(e){const{enabled:n=!0,open:t,ref:r,onComplete:s}=e,i=Xe(t),a=oe(s),l=Ku(r,t);o.useEffect(()=>{n&&l(()=>{t===i.current&&a()})},[n,t,a,l,i])}let It=(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 Wu={...uo,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},en=40,Yu=10,ct=.5,Qu=1;function Ni(e,n,t){switch(e){case"up":return-t;case"down":return t;case"left":return-n;case"right":return n;default:return 0}}function Xu(e){const t=window.getComputedStyle(e).transform;let r=0,s=0,i=1;if(t&&t!=="none"){const a=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(a){const l=a[1].split(", ").map(parseFloat);l.length===6?(r=l[4],s=l[5],i=Math.sqrt(l[0]*l[0]+l[1]*l[1])):l.length===16&&(r=l[12],s=l[13],i=l[0])}}return{x:r,y:s,scale:i}}const Ju=o.forwardRef(function(n,t){const{toast:r,render:s,className:i,swipeDirection:a=["down","right"],...l}=n,c=Array.isArray(a)?a:[a],{toasts:f,hovering:h,focused:g,close:u,remove:m,setToasts:p,pauseTimers:v,resumeTimers:y,hasDifferingHeights:S}=bs(),[E,x]=o.useState(void 0),[M,V]=o.useState(!1),[b,F]=o.useState(!1),[k,N]=o.useState(!1),[T,R]=o.useState({x:0,y:0}),[C,w]=o.useState({x:0,y:0,scale:1}),[A,P]=o.useState(),[q,D]=o.useState(),[j,B]=o.useState(null),G=o.useRef(null),W=o.useRef({x:0,y:0}),z=o.useRef({x:0,y:0,scale:1}),$=o.useRef(void 0),_=o.useRef(0),X=o.useRef(!1),I=o.useRef({x:0,y:0}),O=o.useRef(!1),L=o.useMemo(()=>f.indexOf(r),[r,f]),H=o.useMemo(()=>f.filter(Q=>Q.transitionStatus!=="ending").indexOf(r),[r,f]),U=o.useMemo(()=>f.slice(0,f.indexOf(r)).reduce((Q,J)=>Q+(J.height||0),0),[f,r]);Ds({open:r.transitionStatus!=="ending",ref:G,onComplete(){r.transitionStatus==="ending"&&m(r.id)}}),o.useEffect(()=>{if(!G.current)return;function Q(){const J=G.current?.offsetHeight;p(ue=>ue.map(de=>de.id===r.id?{...de,ref:G,height:J,transitionStatus:void 0}:de))}if(Q(),typeof ResizeObserver=="function"){const J=new ResizeObserver(Q);return J.observe(G.current),()=>{J.disconnect()}}},[r.id,p]);function ce(Q,J){let ue=Q,de=J;return!c.includes("left")&&!c.includes("right")?ue=Q>0?Q**ct:-(Math.abs(Q)**ct):(!c.includes("right")&&Q>0&&(ue=Q**ct),!c.includes("left")&&Q<0&&(ue=-(Math.abs(Q)**ct))),!c.includes("up")&&!c.includes("down")?de=J>0?J**ct:-(Math.abs(J)**ct):(!c.includes("down")&&J>0&&(de=J**ct),!c.includes("up")&&J<0&&(de=-(Math.abs(J)**ct))),{x:ue,y:de}}function pe(Q){if(Q.button!==0)return;Q.pointerType==="touch"&&v();const J=_e(Q.nativeEvent);if(!(J&&J.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(X.current=!1,$.current=void 0,_.current=0,W.current={x:Q.clientX,y:Q.clientY},I.current=W.current,G.current){const de=Xu(G.current);z.current=de,w(de),R({x:de.x,y:de.y})}V(!0),F(!1),B(null),O.current=!0,G.current?.setPointerCapture(Q.pointerId)}}function Be(Q){if(!M)return;Q.preventDefault(),O.current&&(W.current={x:Q.clientX,y:Q.clientY},O.current=!1);const{clientY:J,clientX:ue,movementX:de,movementY:$e}=Q;($e<0&&J>I.current.y||$e>0&&J<I.current.y)&&(I.current={x:I.current.x,y:J}),(de<0&&ue>I.current.x||de>0&&ue<I.current.x)&&(I.current={x:ue,y:I.current.y});const ie=ue-W.current.x,fe=J-W.current.y,je=J-I.current.y,Ne=ue-I.current.x;if(!b&&Math.sqrt(ie*ie+fe*fe)>=Qu&&(F(!0),j===null)){const Rt=c.includes("left")||c.includes("right"),Tr=c.includes("up")||c.includes("down");if(Rt&&Tr){const Fr=Math.abs(ie),Or=Math.abs(fe);B(Fr>Or?"horizontal":"vertical")}}let Me;if(!$.current)j==="vertical"?fe>0?Me="down":fe<0&&(Me="up"):j==="horizontal"?ie>0?Me="right":ie<0&&(Me="left"):Math.abs(ie)>=Math.abs(fe)?Me=ie>0?"right":"left":Me=fe>0?"down":"up",Me&&c.includes(Me)&&($.current=Me,_.current=Ni(Me,ie,fe),x(Me));else{const Ot=$.current,Rt=Ni(Ot,Ne,je);Rt>en?(X.current=!1,x(Ot)):_.current-Rt>=Yu&&(X.current=!0)}const lt=ce(ie,fe);let Ft=z.current.x,Jt=z.current.y;j==="horizontal"?(c.includes("left")||c.includes("right"))&&(Ft+=lt.x):(j==="vertical"||(c.includes("left")||c.includes("right"))&&(Ft+=lt.x),(c.includes("up")||c.includes("down"))&&(Jt+=lt.y)),R({x:Ft,y:Jt})}function Tt(Q){if(!M)return;if(Q.pointerType==="touch"&&!g&&y(),V(!1),F(!1),B(null),G.current?.releasePointerCapture(Q.pointerId),X.current){R({x:C.x,y:C.y}),x(void 0);return}let J=!1;const ue=T.x-C.x,de=T.y-C.y;let $e;for(const ie of c){switch(ie){case"right":ue>en&&(J=!0,$e="right");break;case"left":ue<-en&&(J=!0,$e="left");break;case"down":de>en&&(J=!0,$e="down");break;case"up":de<-en&&(J=!0,$e="up");break}if(J)break}J?(x($e),N(!0),u(r.id)):(R({x:C.x,y:C.y}),x(void 0))}function ht(Q){if(Q.key==="Escape"){if(!G.current||!Oe(G.current,bt(jt(G.current))))return;u(r.id)}}o.useEffect(()=>{const Q=G.current;if(!Q)return;function J(ue){Oe(Q,ue.target)&&ue.preventDefault()}return Q.addEventListener("touchmove",J,{passive:!1}),()=>{Q.removeEventListener("touchmove",J)}},[]);function xe(){if(!M&&T.x===C.x&&T.y===C.y&&!k)return{[It.swipeMovementX]:"0px",[It.swipeMovementY]:"0px"};const Q=T.x-C.x,J=T.y-C.y;return{transition:M?"none":void 0,[It.swipeMovementX]:`${Q}px`,[It.swipeMovementY]:`${J}px`}}const Pe=r.priority==="high",pt={role:Pe?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":A,"aria-describedby":q,"aria-hidden":Pe&&!g?!0:void 0,onPointerDown:pe,onPointerMove:Be,onPointerUp:Tt,onKeyDown:ht,inert:Zu(r.limited),style:{...xe(),[It.index]:r.transitionStatus==="ending"?L:H,[It.offsetY]:`${U}px`}},Le=o.useMemo(()=>({rootRef:G,toast:r,titleId:A,setTitleId:P,descriptionId:q,setDescriptionId:D,swiping:M,swipeDirection:E}),[r,A,q,M,E]),ot=o.useMemo(()=>({transitionStatus:r.transitionStatus,expanded:h||g||S,limited:r.limited||!1,type:r.type,swiping:Le.swiping,swipeDirection:Le.swipeDirection}),[h,g,S,r.transitionStatus,r.limited,r.type,Le.swiping,Le.swipeDirection]),Xt=at("div",n,{ref:[t,Le.rootRef],state:ot,customStyleHookMapping:Wu,props:[pt,l]});return d.jsx(co.Provider,{value:Le,children:Xt})}),ed=o.forwardRef(function(n,t){const{render:r,className:s,id:i,children:a,...l}=n,{toast:c}=fn(),f=a??c.description,h=!!f,g=xs(i),{setDescriptionId:u}=fn();Te(()=>{if(h)return u(g),()=>{u(void 0)}},[h,g,u]);const m=o.useMemo(()=>({type:c.type}),[c.type]),p=at("p",n,{ref:t,state:m,props:{...l,id:g,children:f}});return h?p:null}),td=o.forwardRef(function(n,t){const{render:r,className:s,id:i,children:a,...l}=n,{toast:c}=fn(),f=a??c.title,h=!!f,g=xs(i),{setTitleId:u}=fn();Te(()=>{if(h)return u(g),()=>{u(void 0)}},[h,g,u]);const m=o.useMemo(()=>({type:c.type}),[c.type]),p=at("h2",n,{ref:t,state:m,props:{...l,id:g,children:f}});return h?p:null}),nd=o.createContext(void 0);function rd(e=!1){const n=o.useContext(nd);if(n===void 0&&!e)throw new Error("Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.");return n}function sd(e){const{focusableWhenDisabled:n,disabled:t,composite:r=!1,tabIndex:s=0,isNativeButton:i}=e,a=r&&n!==!1,l=r&&n===!1;return{props:o.useMemo(()=>{const f={onKeyDown(h){t&&n&&h.key!=="Tab"&&h.preventDefault()}};return r||(f.tabIndex=s,!i&&t&&(f.tabIndex=n?s:-1)),(i&&(n||a)||!i&&t)&&(f["aria-disabled"]=t),i&&(!n||l)&&(f.disabled=t),f},[r,t,n,a,l,i,s])}}function id(e={}){const{disabled:n=!1,focusableWhenDisabled:t,tabIndex:r=0,native:s=!0}=e,i=o.useRef(null),a=rd(!0)!==void 0,l=oe(()=>{const h=i.current;return!!(h?.tagName==="A"&&h?.href)}),{props:c}=sd({focusableWhenDisabled:t,disabled:n,composite:a,tabIndex:r,isNativeButton:s});return Te(()=>{const h=i.current;h instanceof HTMLButtonElement&&a&&n&&c.disabled===void 0&&h.disabled&&(h.disabled=!1)},[n,c.disabled,a]),{getButtonProps:o.useCallback((h={})=>{const{onClick:g,onMouseDown:u,onKeyUp:m,onKeyDown:p,onPointerDown:v,...y}=h;return ao({type:s?"button":void 0,onClick(E){if(n){E.preventDefault();return}g?.(E)},onMouseDown(E){n||u?.(E)},onKeyDown(E){if(n||(is(E),p?.(E)),E.baseUIHandlerPrevented)return;const x=E.target===E.currentTarget&&!s&&!l()&&!n,M=E.key==="Enter",V=E.key===" ";x&&((V||M)&&E.preventDefault(),M&&g?.(E))},onKeyUp(E){n||(is(E),m?.(E)),!E.baseUIHandlerPrevented&&E.target===E.currentTarget&&!s&&!n&&E.key===" "&&g?.(E)},onPointerDown(E){if(n){E.preventDefault();return}v?.(E)}},s?void 0:{role:"button"},c,y)},[n,c,s,l]),buttonRef:i}}const ad=o.forwardRef(function(n,t){const{render:r,className:s,disabled:i,nativeButton:a=!0,...l}=n,{close:c,focused:f}=bs(),{toast:h}=fn(),{getButtonProps:g,buttonRef:u}=id({disabled:i,native:a}),m=o.useMemo(()=>({type:h.type}),[h.type]);return at("button",n,{ref:[t,u],state:m,props:[{"aria-hidden":!f||void 0,onClick(){c(h.id)}},l,g]})});function od(){const e=new Map;return{emit(n,t){e.get(n)?.forEach(r=>r(t))},on(n,t){e.has(n)||e.set(n,new Set),e.get(n).add(t)},off(n,t){e.get(n)?.delete(t)}}}const ld=o.createContext(null),cd=o.createContext(null),fo=()=>o.useContext(ld)?.id||null,Ls=()=>o.useContext(cd),Di=ws("safe-polygon");function $n(e,n,t){if(t&&!Wn(t))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[n]}return e?.[n]}function Lr(e){return typeof e=="function"?e():e}function ud(e,n={}){const{open:t,onOpenChange:r,dataRef:s,events:i,elements:a}=e,{enabled:l=!0,delay:c=0,handleClose:f=null,mouseOnly:h=!1,restMs:g=0,move:u=!0}=n,m=Ls(),p=fo(),v=Xe(f),y=Xe(c),S=Xe(t),E=Xe(g),x=o.useRef(void 0),M=_t(),V=o.useRef(void 0),b=_t(),F=o.useRef(!0),k=o.useRef(!1),N=o.useRef(()=>{}),T=o.useRef(!1),R=oe(()=>{const D=s.current.openEvent?.type;return D?.includes("mouse")&&D!=="mousedown"});o.useEffect(()=>{if(!l)return;function D({open:j}){j||(M.clear(),b.clear(),F.current=!0,T.current=!1)}return i.on("openchange",D),()=>{i.off("openchange",D)}},[l,i,M,b]),o.useEffect(()=>{if(!l||!v.current||!t)return;function D(B){R()&&r(!1,B,"hover")}const j=xt(a.floating).documentElement;return j.addEventListener("mouseleave",D),()=>{j.removeEventListener("mouseleave",D)}},[a.floating,t,r,l,v,R]);const C=o.useCallback((D,j=!0,B="hover")=>{const G=$n(y.current,"close",x.current);G&&!V.current?M.start(G,()=>r(!1,D,B)):j&&(M.clear(),r(!1,D,B))},[y,r,M]),w=oe(()=>{N.current(),V.current=void 0}),A=oe(()=>{if(k.current){const D=xt(a.floating).body;D.style.pointerEvents="",D.removeAttribute(Di),k.current=!1}}),P=oe(()=>s.current.openEvent?["click","mousedown"].includes(s.current.openEvent.type):!1);o.useEffect(()=>{if(!l)return;function D(z){if(M.clear(),F.current=!1,h&&!Wn(x.current)||Lr(E.current)>0&&!$n(y.current,"open"))return;const $=$n(y.current,"open",x.current);$?M.start($,()=>{S.current||r(!0,z,"hover")}):t||r(!0,z,"hover")}function j(z){if(P()){A();return}N.current();const $=xt(a.floating);if(b.clear(),T.current=!1,v.current&&s.current.floatingContext){t||M.clear(),V.current=v.current({...s.current.floatingContext,tree:m,x:z.clientX,y:z.clientY,onClose(){A(),w(),P()||C(z,!0,"safe-polygon")}});const X=V.current;$.addEventListener("mousemove",X),N.current=()=>{$.removeEventListener("mousemove",X)};return}(x.current==="touch"?!Oe(a.floating,z.relatedTarget):!0)&&C(z)}function B(z){P()||s.current.floatingContext&&v.current?.({...s.current.floatingContext,tree:m,x:z.clientX,y:z.clientY,onClose(){A(),w(),P()||C(z)}})(z)}function G(){M.clear()}function W(z){P()||C(z,!1)}if(Fe(a.domReference)){const z=a.domReference,$=a.floating;return t&&z.addEventListener("mouseleave",B),u&&z.addEventListener("mousemove",D,{once:!0}),z.addEventListener("mouseenter",D),z.addEventListener("mouseleave",j),$&&($.addEventListener("mouseleave",B),$.addEventListener("mouseenter",G),$.addEventListener("mouseleave",W)),()=>{t&&z.removeEventListener("mouseleave",B),u&&z.removeEventListener("mousemove",D),z.removeEventListener("mouseenter",D),z.removeEventListener("mouseleave",j),$&&($.removeEventListener("mouseleave",B),$.removeEventListener("mouseenter",G),$.removeEventListener("mouseleave",W))}}},[a,l,e,h,u,C,w,A,r,t,S,m,y,v,s,P,E,M,b]),Te(()=>{if(l&&t&&v.current?.__options?.blockPointerEvents&&R()){k.current=!0;const D=a.floating;if(Fe(a.domReference)&&D){const j=xt(a.floating).body;j.setAttribute(Di,"");const B=a.domReference,G=m?.nodesRef.current.find(W=>W.id===p)?.context?.elements.floating;return G&&(G.style.pointerEvents=""),j.style.pointerEvents="none",B.style.pointerEvents="auto",D.style.pointerEvents="auto",()=>{j.style.pointerEvents="",B.style.pointerEvents="",D.style.pointerEvents=""}}}},[l,t,p,a,m,v,R]),Te(()=>{t||(x.current=void 0,T.current=!1,w(),A())},[t,w,A]),o.useEffect(()=>()=>{w(),M.clear(),b.clear(),A()},[l,a.domReference,w,A,M,b]);const q=o.useMemo(()=>{function D(j){x.current=j.pointerType}return{onPointerDown:D,onPointerEnter:D,onMouseMove(j){const{nativeEvent:B}=j;function G(){!F.current&&!S.current&&r(!0,B,"hover")}h&&!Wn(x.current)||t||Lr(E.current)===0||T.current&&j.movementX**2+j.movementY**2<2||(b.clear(),x.current==="touch"?G():(T.current=!0,b.start(Lr(E.current),G)))}}},[h,r,t,S,E,b]);return o.useMemo(()=>l?{reference:q}:{},[l,q])}const ho=o.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Es,currentIdRef:{current:null},currentContextRef:{current:null}});function dd(e){const{children:n,delay:t,timeoutMs:r=0}=e,s=o.useRef(t),i=o.useRef(t),a=o.useRef(null),l=o.useRef(null),c=_t();return d.jsx(ho.Provider,{value:o.useMemo(()=>({hasProvider:!0,delayRef:s,initialDelayRef:i,currentIdRef:a,timeoutMs:r,currentContextRef:l,timeout:c}),[r,c]),children:n})}function fd(e,n={}){const{open:t,onOpenChange:r,floatingId:s}=e,{enabled:i=!0}=n,a=o.useContext(ho),{currentIdRef:l,delayRef:c,timeoutMs:f,initialDelayRef:h,currentContextRef:g,hasProvider:u,timeout:m}=a,[p,v]=o.useState(!1);return Te(()=>{function y(){v(!1),g.current?.setIsInstantPhase(!1),l.current=null,g.current=null,c.current=h.current}if(i&&l.current&&!t&&l.current===s){if(v(!1),f)return m.start(f,y),()=>{m.clear()};y()}},[i,t,s,l,c,f,h,g,m]),Te(()=>{if(!i||!t)return;const y=g.current,S=l.current;g.current={onOpenChange:r,setIsInstantPhase:v},l.current=s,c.current={open:0,close:$n(h.current,"close")},S!==null&&S!==s?(m.clear(),v(!0),y?.setIsInstantPhase(!0),y?.onOpenChange(!1)):(v(!1),y?.setIsInstantPhase(!1))},[i,t,s,r,l,c,f,h,g,m]),Te(()=>()=>{g.current=null},[g]),o.useMemo(()=>({hasProvider:u,delayRef:c,isInstantPhase:p}),[u,c,p])}function hd(e,n){let t=null,r=null,s=!1;return{contextElement:e||void 0,getBoundingClientRect(){const i=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},a=n.axis==="x"||n.axis==="both",l=n.axis==="y"||n.axis==="both",c=["mouseenter","mousemove"].includes(n.dataRef.current.openEvent?.type||"")&&n.pointerType!=="touch";let f=i.width,h=i.height,g=i.x,u=i.y;return t==null&&n.x&&a&&(t=i.x-n.x),r==null&&n.y&&l&&(r=i.y-n.y),g-=t||0,u-=r||0,f=0,h=0,!s||c?(f=n.axis==="y"?i.width:0,h=n.axis==="x"?i.height:0,g=a&&n.x!=null?n.x:g,u=l&&n.y!=null?n.y:u):s&&!c&&(h=n.axis==="x"?i.height:h,f=n.axis==="y"?i.width:f),s=!0,{width:f,height:h,x:g,y:u,top:u,right:g+f,bottom:u+h,left:g}}}}function Li(e){return e!=null&&e.clientX!=null}function pd(e,n={}){const{open:t,dataRef:r,elements:{floating:s,domReference:i},refs:a}=e,{enabled:l=!0,axis:c="both",x:f=null,y:h=null}=n,g=o.useRef(!1),u=o.useRef(null),[m,p]=o.useState(),[v,y]=o.useState([]),S=oe((b,F)=>{g.current||r.current.openEvent&&!Li(r.current.openEvent)||a.setPositionReference(hd(i,{x:b,y:F,axis:c,dataRef:r,pointerType:m}))}),E=oe(b=>{f!=null||h!=null||(t?u.current||y([]):S(b.clientX,b.clientY))}),x=Wn(m)?s:t,M=o.useCallback(()=>{if(!x||!l||f!=null||h!=null)return;const b=Un(s);function F(k){const N=_e(k);Oe(s,N)?(b.removeEventListener("mousemove",F),u.current=null):S(k.clientX,k.clientY)}if(!r.current.openEvent||Li(r.current.openEvent)){b.addEventListener("mousemove",F);const k=()=>{b.removeEventListener("mousemove",F),u.current=null};return u.current=k,k}a.setPositionReference(i)},[x,l,f,h,s,r,a,i,S]);o.useEffect(()=>M(),[M,v]),o.useEffect(()=>{l&&!s&&(g.current=!1)},[l,s]),o.useEffect(()=>{!l&&t&&(g.current=!0)},[l,t]),Te(()=>{l&&(f!=null||h!=null)&&(g.current=!1,S(f,h))},[l,f,h,S]);const V=o.useMemo(()=>{function b(F){p(F.pointerType)}return{onPointerDown:b,onPointerEnter:b,onMouseMove:E,onMouseEnter:E}},[E]);return o.useMemo(()=>l?{reference:V}:{},[l,V])}const md={intentional:"onClick",sloppy:"onPointerDown"};function $i(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function gd(e,n={}){const{open:t,onOpenChange:r,elements:s,dataRef:i}=e,{enabled:a=!0,escapeKey:l=!0,outsidePress:c=!0,outsidePressEvent:f="sloppy",referencePress:h=!1,referencePressEvent:g="sloppy",ancestorScroll:u=!1,bubbles:m,capture:p}=n,v=Ls(),y=oe(typeof c=="function"?c:()=>!1),S=typeof c=="function"?y:c,E=o.useRef(!1),{escapeKey:x,outsidePress:M}=$i(m),{escapeKey:V,outsidePress:b}=$i(p),F=o.useRef(null),k=_t(),N=_t(),T=o.useRef(!1),R=o.useRef(""),C=oe(I=>{R.current=I.pointerType}),w=oe(()=>{const I=R.current,O=I==="pen"||!I?"mouse":I;return typeof f=="string"?f:f[O]}),A=oe(I=>{if(!t||!a||!l||I.key!=="Escape"||T.current)return;const O=i.current.floatingContext?.nodeId,L=v?ln(v.nodesRef.current,O):[];if(!x&&(I.stopPropagation(),L.length>0)){let H=!0;if(L.forEach(U=>{U.context?.open&&!U.context.dataRef.current.__escapeKeyBubbles&&(H=!1)}),!H)return}r(!1,ku(I)?I.nativeEvent:I,"escape-key")}),P=oe(I=>{const O=w();return O==="intentional"&&I.type!=="click"||O==="sloppy"&&I.type==="click"}),q=oe(I=>{const O=()=>{A(I),_e(I)?.removeEventListener("keydown",O)};_e(I)?.addEventListener("keydown",O)}),D=oe(I=>{if(P(I))return;const O=i.current.insideReactTree;i.current.insideReactTree=!1;const L=E.current;if(E.current=!1,w()==="intentional"&&L||O||typeof S=="function"&&!S(I))return;const H=_e(I),U=`[${ws("inert")}]`,ce=xt(s.floating).querySelectorAll(U);let pe=Fe(H)?H:null;for(;pe&&!Ar(pe);){const xe=tc(pe);if(Ar(xe)||!Fe(xe))break;pe=xe}if(ce.length&&Fe(H)&&!nc(H)&&!Oe(H,s.floating)&&Array.from(ce).every(xe=>!Oe(pe,xe)))return;if(va(H)){const xe=Ar(H),Pe=rc(H),pt=/auto|scroll/,Le=xe||pt.test(Pe.overflowX),ot=xe||pt.test(Pe.overflowY),Xt=Le&&H.clientWidth>0&&H.scrollWidth>H.clientWidth,Q=ot&&H.clientHeight>0&&H.scrollHeight>H.clientHeight,J=Pe.direction==="rtl",ue=Q&&(J?I.offsetX<=H.offsetWidth-H.clientWidth:I.offsetX>H.clientWidth),de=Xt&&I.offsetY>H.clientHeight;if(ue||de)return}const Be=i.current.floatingContext?.nodeId,Tt=v&&ln(v.nodesRef.current,Be).some(xe=>We(I,xe.context?.elements.floating));if(We(I,s.floating)||We(I,s.domReference)||Tt)return;const ht=v?ln(v.nodesRef.current,Be):[];if(ht.length>0){let xe=!0;if(ht.forEach(Pe=>{Pe.context?.open&&!Pe.context.dataRef.current.__outsidePressBubbles&&(xe=!1)}),!xe)return}r(!1,I,"outside-press")}),j=oe(I=>{if(!(w()!=="sloppy"||!t||!a||We(I,s.floating)||We(I,s.domReference))){if(I.pointerType==="touch"){F.current={startTime:Date.now(),startX:I.clientX,startY:I.clientY,dismissOnPointerUp:!1,dismissOnMouseDown:!0},k.start(1e3,()=>{F.current&&(F.current.dismissOnPointerUp=!1,F.current.dismissOnMouseDown=!1)});return}D(I)}}),B=oe(I=>{if(P(I)||(k.clear(),I.type==="mousedown"&&F.current&&!F.current.dismissOnMouseDown))return;const O=()=>{I.type==="pointerdown"?j(I):D(I),_e(I)?.removeEventListener(I.type,O)};_e(I)?.addEventListener(I.type,O)}),G=oe(I=>{if(w()!=="sloppy"||I.pointerType!=="touch"||!F.current||We(I,s.floating)||We(I,s.domReference))return;const O=Math.abs(I.clientX-F.current.startX),L=Math.abs(I.clientY-F.current.startY),H=Math.sqrt(O*O+L*L);H>5&&(F.current.dismissOnPointerUp=!0),H>10&&(D(I),k.clear(),F.current=null)}),W=oe(I=>{w()!=="sloppy"||I.pointerType!=="touch"||!F.current||We(I,s.floating)||We(I,s.domReference)||(F.current.dismissOnPointerUp&&D(I),k.clear(),F.current=null)});o.useEffect(()=>{if(!t||!a)return;i.current.__escapeKeyBubbles=x,i.current.__outsidePressBubbles=M;const I=new Es;function O(pe){r(!1,pe,"ancestor-scroll")}function L(){I.clear(),T.current=!0}function H(){I.start(sc()?5:0,()=>{T.current=!1})}const U=xt(s.floating);U.addEventListener("pointerdown",C,!0),l&&(U.addEventListener("keydown",V?q:A,V),U.addEventListener("compositionstart",L),U.addEventListener("compositionend",H)),S&&(U.addEventListener("click",b?B:D,b),U.addEventListener("pointerdown",b?B:D,b),U.addEventListener("pointermove",G,b),U.addEventListener("pointerup",W,b),U.addEventListener("mousedown",B,b));let ce=[];return u&&(Fe(s.domReference)&&(ce=Vr(s.domReference)),Fe(s.floating)&&(ce=ce.concat(Vr(s.floating))),!Fe(s.reference)&&s.reference&&s.reference.contextElement&&(ce=ce.concat(Vr(s.reference.contextElement)))),ce=ce.filter(pe=>pe!==U.defaultView?.visualViewport),ce.forEach(pe=>{pe.addEventListener("scroll",O,{passive:!0})}),()=>{U.removeEventListener("pointerdown",C,!0),l&&(U.removeEventListener("keydown",V?q:A,V),U.removeEventListener("compositionstart",L),U.removeEventListener("compositionend",H)),S&&(U.removeEventListener("click",b?B:D,b),U.removeEventListener("pointerdown",b?B:D,b),U.removeEventListener("pointermove",G,b),U.removeEventListener("pointerup",W,b),U.removeEventListener("mousedown",B,b)),ce.forEach(pe=>{pe.removeEventListener("scroll",O)}),I.clear()}},[i,s,l,S,f,t,r,u,a,x,M,A,V,q,D,b,B,j,G,W,C]),o.useEffect(()=>{i.current.insideReactTree=!1},[i,S]);const z=o.useMemo(()=>({onKeyDown:A,...h&&{[md[g]]:I=>{r(!1,I.nativeEvent,"reference-press")},...g!=="intentional"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[A,r,h,g]),$=oe(I=>{const O=_e(I.nativeEvent);Oe(s.floating,O)&&(E.current=!0)}),_=oe(()=>{i.current.insideReactTree=!0,N.start(0,()=>{i.current.insideReactTree=!1})}),X=o.useMemo(()=>({onKeyDown:A,onMouseDown:$,onMouseUp:$,onPointerDownCapture:_,onMouseDownCapture:_,onClickCapture:_}),[A,$,_]);return o.useMemo(()=>a?{reference:z,floating:X}:{},[a,z,X])}function po(e){const{open:n=!1,onOpenChange:t,elements:r}=e,s=xs(),i=o.useRef({}),[a]=o.useState(()=>od()),l=fo()!=null,[c,f]=o.useState(r.reference),h=oe((m,p,v)=>{i.current.openEvent=m?p:void 0,a.emit("openchange",{open:m,event:p,reason:v,nested:l}),t?.(m,p,v)}),g=o.useMemo(()=>({setPositionReference:f}),[]),u=o.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return o.useMemo(()=>({dataRef:i,open:n,onOpenChange:h,elements:u,events:a,floatingId:s,refs:g}),[n,h,u,a,s,g])}function vd(e={}){const{nodeId:n}=e,t=po({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||t,s=r.elements,[i,a]=o.useState(null),[l,c]=o.useState(null),h=s?.domReference||i,g=o.useRef(null),u=Ls();Te(()=>{h&&(g.current=h)},[h]);const m=ic({...e,elements:{...s,...l&&{reference:l}}}),p=o.useCallback(x=>{const M=Fe(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),getClientRects:()=>x.getClientRects(),contextElement:x}:x;c(M),m.refs.setReference(M)},[m.refs]),v=o.useCallback(x=>{(Fe(x)||x===null)&&(g.current=x,a(x)),(Fe(m.refs.reference.current)||m.refs.reference.current===null||x!==null&&!Fe(x))&&m.refs.setReference(x)},[m.refs]),y=o.useMemo(()=>({...m.refs,setReference:v,setPositionReference:p,domReference:g}),[m.refs,v,p]),S=o.useMemo(()=>({...m.elements,domReference:h}),[m.elements,h]),E=o.useMemo(()=>({...m,...r,refs:y,elements:S,nodeId:n}),[m,y,S,n,r]);return Te(()=>{r.dataRef.current.floatingContext=E;const x=u?.nodesRef.current.find(M=>M.id===n);x&&(x.context=E)}),o.useMemo(()=>({...m,context:E,refs:y,elements:S}),[m,y,S,E])}const $r=oc&&ga;function yd(e,n={}){const{open:t,onOpenChange:r,events:s,dataRef:i,elements:a}=e,{enabled:l=!0,visibleOnly:c=!0}=n,f=o.useRef(!1),h=_t(),g=o.useRef(!0);o.useEffect(()=>{if(!l)return;const m=Un(a.domReference);function p(){!t&&va(a.domReference)&&a.domReference===bt(xt(a.domReference))&&(f.current=!0)}function v(){g.current=!0}function y(){g.current=!1}return m.addEventListener("blur",p),$r&&(m.addEventListener("keydown",v,!0),m.addEventListener("pointerdown",y,!0)),()=>{m.removeEventListener("blur",p),$r&&(m.removeEventListener("keydown",v,!0),m.removeEventListener("pointerdown",y,!0))}},[a.domReference,t,l]),o.useEffect(()=>{if(!l)return;function m({reason:p}){(p==="reference-press"||p==="escape-key")&&(f.current=!0)}return s.on("openchange",m),()=>{s.off("openchange",m)}},[s,l]);const u=o.useMemo(()=>({onMouseLeave(){f.current=!1},onFocus(m){if(f.current)return;const p=_e(m.nativeEvent);if(c&&Fe(p)){if($r&&!m.relatedTarget){if(!g.current&&!ac(p))return}else if(!Nn(p))return}r(!0,m.nativeEvent,"focus")},onBlur(m){f.current=!1;const p=m.relatedTarget,v=m.nativeEvent,y=Fe(p)&&p.hasAttribute(ws("focus-guard"))&&p.getAttribute("data-type")==="outside";h.start(0,()=>{const S=bt(a.domReference?a.domReference.ownerDocument:document);!p&&S===a.domReference||Oe(i.current.floatingContext?.refs.floating.current,S)||Oe(a.domReference,S)||y||r(!1,v,"focus")})}}),[i,a.domReference,r,c,h]);return o.useMemo(()=>l?{reference:u}:{},[l,u])}function bd(e=[]){const n=e.map(l=>l?.reference),t=e.map(l=>l?.floating),r=e.map(l=>l?.item),s=o.useCallback(l=>Hr(l,e,"reference"),n),i=o.useCallback(l=>Hr(l,e,"floating"),t),a=o.useCallback(l=>Hr(l,e,"item"),r);return o.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a}),[s,i,a])}function Hr(e,n,t){const r=new Map,s=t==="item",i={};t==="floating"&&(i.tabIndex=-1,i[lc]="");for(const a in e)s&&e&&(a===ya||a===ba)||(i[a]=e[a]);for(let a=0;a<n.length;a+=1){let l;const c=n[a]?.[t];typeof c=="function"?l=e?c(e):null:l=c,l&&Hi(i,l,s,r)}return Hi(i,e,s,r),i}function Hi(e,n,t,r){for(const s in n){const i=n[s];t&&(s===ya||s===ba)||(s.startsWith("on")?(r.has(s)||r.set(s,[]),typeof i=="function"&&(r.get(s)?.push(i),e[s]=(...a)=>r.get(s)?.map(l=>l(...a)).find(l=>l!==void 0))):e[s]=i)}}function _i(e,n){const[t,r]=e;let s=!1;const i=n.length;for(let a=0,l=i-1;a<i;l=a++){const[c,f]=n[a]||[0,0],[h,g]=n[l]||[0,0];f>=r!=g>=r&&t<=(h-c)*(r-f)/(g-f)+c&&(s=!s)}return s}function xd(e,n){return e[0]>=n.x&&e[0]<=n.x+n.width&&e[1]>=n.y&&e[1]<=n.y+n.height}function wd(e={}){const{buffer:n=.5,blockPointerEvents:t=!1,requireIntent:r=!0}=e,s=new Es;let i=!1,a=null,l=null,c=typeof performance<"u"?performance.now():0;function f(g,u){const m=performance.now(),p=m-c;if(a===null||l===null||p===0)return a=g,l=u,c=m,null;const v=g-a,y=u-l,E=Math.sqrt(v*v+y*y)/p;return a=g,l=u,c=m,E}const h=({x:g,y:u,placement:m,elements:p,onClose:v,nodeId:y,tree:S})=>function(x){function M(){s.clear(),v()}if(s.clear(),!p.domReference||!p.floating||m==null||g==null||u==null)return;const{clientX:V,clientY:b}=x,F=[V,b],k=_e(x),N=x.type==="mouseleave",T=Oe(p.floating,k),R=Oe(p.domReference,k),C=p.domReference.getBoundingClientRect(),w=p.floating.getBoundingClientRect(),A=m.split("-")[0],P=g>w.right-w.width/2,q=u>w.bottom-w.height/2,D=xd(F,C),j=w.width>C.width,B=w.height>C.height,G=(j?C:w).left,W=(j?C:w).right,z=(B?C:w).top,$=(B?C:w).bottom;if(T&&(i=!0,!N))return;if(R&&(i=!1),R&&!N){i=!0;return}if(N&&Fe(x.relatedTarget)&&Oe(p.floating,x.relatedTarget)||S&&ln(S.nodesRef.current,y).some(({context:I})=>I?.open))return;if(A==="top"&&u>=C.bottom-1||A==="bottom"&&u<=C.top+1||A==="left"&&g>=C.right-1||A==="right"&&g<=C.left+1)return M();let _=[];switch(A){case"top":_=[[G,C.top+1],[G,w.bottom-1],[W,w.bottom-1],[W,C.top+1]];break;case"bottom":_=[[G,w.top+1],[G,C.bottom-1],[W,C.bottom-1],[W,w.top+1]];break;case"left":_=[[w.right-1,$],[w.right-1,z],[C.left+1,z],[C.left+1,$]];break;case"right":_=[[C.right-1,$],[C.right-1,z],[w.left+1,z],[w.left+1,$]];break}function X([I,O]){switch(A){case"top":{const L=[j?I+n/2:P?I+n*4:I-n*4,O+n+1],H=[j?I-n/2:P?I+n*4:I-n*4,O+n+1],U=[[w.left,P||j?w.bottom-n:w.top],[w.right,P?j?w.bottom-n:w.top:w.bottom-n]];return[L,H,...U]}case"bottom":{const L=[j?I+n/2:P?I+n*4:I-n*4,O-n],H=[j?I-n/2:P?I+n*4:I-n*4,O-n],U=[[w.left,P||j?w.top+n:w.bottom],[w.right,P?j?w.top+n:w.bottom:w.top+n]];return[L,H,...U]}case"left":{const L=[I+n+1,B?O+n/2:q?O+n*4:O-n*4],H=[I+n+1,B?O-n/2:q?O+n*4:O-n*4];return[...[[q||B?w.right-n:w.left,w.top],[q?B?w.right-n:w.left:w.right-n,w.bottom]],L,H]}case"right":{const L=[I-n,B?O+n/2:q?O+n*4:O-n*4],H=[I-n,B?O-n/2:q?O+n*4:O-n*4],U=[[q||B?w.left+n:w.right,w.top],[q?B?w.left+n:w.right:w.left+n,w.bottom]];return[L,H,...U]}default:return[]}}if(!_i([V,b],_)){if(i&&!D)return M();if(!N&&r){const I=f(x.clientX,x.clientY);if(I!==null&&I<.1)return M()}_i([V,b],X([g,u]))?!i&&r&&s.start(40,M):M()}};return h.__options={blockPointerEvents:t},h}function Ed(){const e=o.useContext(cc);if(!e)throw new Error("Base UI: useToast must be used within <Toast.Provider>.");const{toasts:n,add:t,close:r,update:s,promise:i}=e;return o.useMemo(()=>({toasts:n,add:t,close:r,update:s,promise:i}),[n,t,r,s,i])}const Sd=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),kd=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Md=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Cd=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.createElement("path",{d:"M80,176h96l-48,48ZM128,32,80,80h96Z",opacity:"0.2"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Td=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Fd=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Od=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Rd=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Id=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Ad=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),mo=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Sd}));mo.displayName="ArrowCounterClockwiseIcon";const go=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:kd}));go.displayName="CaretDownIcon";const vo=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Md}));vo.displayName="CaretRightIcon";const yr=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Cd}));yr.displayName="CaretUpDownIcon";const it=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Td}));it.displayName="CheckIcon";const Qn=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Fd}));Qn.displayName="ExclamationMarkIcon";const Xn=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Od}));Xn.displayName="PlusIcon";const as=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Rd}));as.displayName="TrashIcon";const $s=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Id}));$s.displayName="WarningIcon";const Hs=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Ad}));Hs.displayName="XIcon";function _s(e,n,t){let[r,s]=o.useState(t),i=e!==void 0,a=o.useRef(i),l=o.useRef(!1),c=o.useRef(!1);return i&&!a.current&&!l.current?(l.current=!0,a.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&&a.current&&!c.current&&(c.current=!0,a.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:r,K(f=>(i||s(f),n?.(f)))]}function Bs(e){let[n]=o.useState(e);return n}function yo(e={},n=null,t=[]){for(let[r,s]of Object.entries(e))xo(t,bo(n,r),s);return t}function bo(e,n){return e?e+"["+n+"]":n}function xo(e,n,t){if(Array.isArray(t))for(let[r,s]of t.entries())xo(e,bo(n,r.toString()),s);else t instanceof Date?e.push([n,t.toISOString()]):typeof t=="boolean"?e.push([n,t?"1":"0"]):typeof t=="string"?e.push([n,t]):typeof t=="number"?e.push([n,`${t}`]):t==null?e.push([n,""]):yo(t,n,e)}function wo(e){var n,t;let r=(n=e?.form)!=null?n:e.closest("form");if(r){for(let s of r.elements)if(s!==e&&(s.tagName==="INPUT"&&s.type==="submit"||s.tagName==="BUTTON"&&s.type==="submit"||s.nodeName==="INPUT"&&s.type==="image")){s.click();return}(t=r.requestSubmit)==null||t.call(r)}}let Vd="span";var Ut=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Ut||{});function Pd(e,n){var t;let{features:r=1,...s}=e,i={ref:n,"aria-hidden":(r&2)===2?!0:(t=s["aria-hidden"])!=null?t:void 0,hidden:(r&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",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return he()({ourProps:i,theirProps:s,slot:{},defaultTag:Vd,name:"Hidden"})}let hn=le(Pd),jd=o.createContext(null);function Nd({children:e}){let n=o.useContext(jd);if(!n)return Z.createElement(Z.Fragment,null,e);let{target:t}=n;return t?Ce.createPortal(Z.createElement(Z.Fragment,null,e),t):null}function Zs({data:e,form:n,disabled:t,onReset:r,overrides:s}){let[i,a]=o.useState(null),l=Gt();return o.useEffect(()=>{if(r&&i)return l.addEventListener(i,"reset",r)},[i,n,r]),Z.createElement(Nd,null,Z.createElement(Dd,{setForm:a,formId:n}),yo(e).map(([c,f])=>Z.createElement(hn,{features:Ut.Hidden,...xa({key:c,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:n,disabled:t,name:c,value:f,...s})})))}function Dd({setForm:e,formId:n}){return o.useEffect(()=>{if(n){let t=document.getElementById(n);t&&e(t)}},[e,n]),n?null:Z.createElement(hn,{features:Ut.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:t=>{if(!t)return;let r=t.closest("form");r&&e(r)}})}let Ld="span";function $d(e,n){let t=o.useId(),r=ar(),s=or(),{id:i=r||`headlessui-checkbox-${t}`,disabled:a=s||!1,autoFocus:l=!1,checked:c,defaultChecked:f,onChange:h,name:g,value:u,form:m,indeterminate:p=!1,tabIndex:v=0,...y}=e,S=Bs(f),[E,x]=_s(c,h,S??!1),M=qt(),V=lr(),b=Gt(),[F,k]=o.useState(!1),N=K(()=>{k(!0),x?.(!E),b.nextFrame(()=>{k(!1)})}),T=K($=>{if(cr($.currentTarget))return $.preventDefault();$.preventDefault(),N()}),R=K($=>{$.key===te.Space?($.preventDefault(),N()):$.key===te.Enter&&wo($.currentTarget)}),C=K($=>$.preventDefault()),{isFocusVisible:w,focusProps:A}=Kt({autoFocus:l}),{isHovered:P,hoverProps:q}=Wt({isDisabled:a}),{pressed:D,pressProps:j}=ur({disabled:a}),B=rt({ref:n,id:i,role:"checkbox","aria-checked":p?"mixed":E?"true":"false","aria-labelledby":M,"aria-describedby":V,"aria-disabled":a?!0:void 0,indeterminate:p?"true":void 0,tabIndex:a?void 0:v,onKeyUp:a?void 0:R,onKeyPress:a?void 0:C,onClick:a?void 0:T},A,q,j),G=o.useMemo(()=>({checked:E,disabled:a,hover:P,focus:w,active:D,indeterminate:p,changing:F,autofocus:l}),[E,p,a,P,w,D,F,l]),W=o.useCallback(()=>{if(S!==void 0)return x?.(S)},[x,S]),z=he();return Z.createElement(Z.Fragment,null,g!=null&&Z.createElement(Zs,{disabled:a,data:{[g]:u||"on"},overrides:{type:"checkbox",checked:E},form:m,onReset:W}),z({ourProps:B,theirProps:y,slot:G,defaultTag:Ld,name:"Checkbox"}))}let Hd=le($d),_d=o.createContext(()=>{});function Eo({value:e,children:n}){return Z.createElement(_d.Provider,{value:e},n)}function At(e,n,t){let r=t.initialDeps??[],s;function i(){var a,l,c,f;let h;t.key&&((a=t.debug)!=null&&a.call(t))&&(h=Date.now());const g=e();if(!(g.length!==r.length||g.some((p,v)=>r[v]!==p)))return s;r=g;let m;if(t.key&&((l=t.debug)!=null&&l.call(t))&&(m=Date.now()),s=n(...g),t.key&&((c=t.debug)!=null&&c.call(t))){const p=Math.round((Date.now()-h)*100)/100,v=Math.round((Date.now()-m)*100)/100,y=v/16,S=(E,x)=>{for(E=String(E);E.length<x;)E=" "+E;return E};console.info(`%c⏱ ${S(v,5)} /${S(p,5)} ms`,`
|
|
10
|
+
`,Eu=e=>{const n=Mn(Cn,f=>f.context.identity?.accountAddress),t=Mn(Cn,f=>f.context.privyIdentity?.accountAddress),r=n||t,s=Ns({queryKey:["hypergraph-public-spaces",e.mode],queryFn:async()=>{const f=await Xl(`${ma()}/graphql`,wu,{accountAddress:r});return f?.spaces?f.spaces.map(h=>({id:h.id,name:h.page?.name})):[]},enabled:e.mode==="public"&&!!r}),{isConnecting:i,listSpaces:a}=vs();o.useEffect(()=>{e.mode==="private"&&!i&&a()},[e.mode,a,i]);const l=Mn(Cn,f=>f.context.spaces),c=Mn(Cn,f=>f.context.spacesLoadingIsPending);return e.mode==="private"?{data:l,isPending:c}:s},Su=async({name:e,ops:n,walletClient:t,space:r})=>{const s=t.account?.address;if(!s)throw new Error("No address found");const i=(t.chain.id===Jl.id,"TESTNET"),l=(await Wc({name:e,ops:n,author:s,network:i})).cid,c=await fetch(`${ma()}/space/${r}/edit/calldata`,{method:"POST",body:JSON.stringify({cid:l})}),{to:f,data:h}=await c.json();return{txResult:await t.sendUserOperation({calls:[{to:f,value:0n,data:h}]}),to:f,data:h,cid:l}};function ln(e,n,t=!0){return e.filter(s=>s.parentId===n&&(!t||s.context?.open)).flatMap(s=>[s,...ln(e,s.id,t)])}function ku(e){return"nativeEvent"in e}function Wn(e,n){const t=["mouse","pen"];return t.push("",void 0),t.includes(e)}const to={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},Dr=o.forwardRef(function(n,t){const[r,s]=o.useState();Te(()=>{ga&&s("button")},[]);const i={ref:t,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,style:to};return d.jsx("span",{...n,...i,"data-base-ui-focus-guard":""})}),Mu=o.createContext(void 0);function Pi(e,n,t,r){const s=ys(no).current;return Tu(s,e,n,t,r)&&ro(s,[e,n,t,r]),s.callback}function Cu(e){const n=ys(no).current;return Fu(n,e)&&ro(n,e),n.callback}function no(){return{callback:null,cleanup:null,refs:[]}}function Tu(e,n,t,r,s){return e.refs[0]!==n||e.refs[1]!==t||e.refs[2]!==r||e.refs[3]!==s}function Fu(e,n){return e.refs.length!==n.length||e.refs.some((t,r)=>t!==n[r])}function ro(e,n){if(e.refs=n,n.every(t=>t==null)){e.callback=null;return}e.callback=t=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),t!=null){const r=Array(n.length).fill(null);for(let s=0;s<n.length;s+=1){const i=n[s];if(i!=null)switch(typeof i){case"function":{const a=i(t);typeof a=="function"&&(r[s]=a);break}case"object":{i.current=t;break}}}e.cleanup=()=>{for(let s=0;s<n.length;s+=1){const i=n[s];if(i!=null)switch(typeof i){case"function":{const a=r[s];typeof a=="function"?a():i(null);break}case"object":{i.current=null;break}}}}}}}const Ou=parseInt(o.version,10);function so(e){return Ou>=e}function io(e,n){if(e&&!n)return e;if(!e&&n)return n;if(e||n)return{...e,...n}}function Ru(e,n){const t={};for(const r in e){const s=e[r];if(n?.hasOwnProperty(r)){const i=n[r](s);i!=null&&Object.assign(t,i);continue}s===!0?t[`data-${r.toLowerCase()}`]="":s&&(t[`data-${r.toLowerCase()}`]=s.toString())}return t}function Iu(e,n){return typeof e=="function"?e(n):e}const cn={};function ao(e,n,t,r,s){let i={...ss(e,cn)};return n&&(i=Ln(i,n)),t&&(i=Ln(i,t)),r&&(i=Ln(i,r)),i}function Au(e){if(e.length===0)return cn;if(e.length===1)return ss(e[0],cn);let n={...ss(e[0],cn)};for(let t=1;t<e.length;t+=1)n=Ln(n,e[t]);return n}function Ln(e,n){return oo(n)?n(e):Vu(e,n)}function Vu(e,n){if(!n)return e;for(const t in n){const r=n[t];switch(t){case"style":{e[t]=io(e.style,r);break}case"className":{e[t]=lo(e.className,r);break}default:Pu(t,r)?e[t]=ju(e[t],r):e[t]=r}}return e}function Pu(e,n){const t=e.charCodeAt(0),r=e.charCodeAt(1),s=e.charCodeAt(2);return t===111&&r===110&&s>=65&&s<=90&&(typeof n=="function"||typeof n>"u")}function oo(e){return typeof e=="function"}function ss(e,n){return oo(e)?e(n):e??cn}function ju(e,n){return n?e?t=>{if(Nu(t)){const s=t;is(s);const i=n(s);return s.baseUIHandlerPrevented||e?.(s),i}const r=n(t);return e?.(t),r}:n:e}function is(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function lo(e,n){return n?e?n+" "+e:n:e}function Nu(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}const Du={style:{transition:"none"}},gt={},Lu={fallbackAxisSide:"end"};function at(e,n,t={}){const r=n.render,s=$u(n,t);if(t.enabled===!1)return null;const i=t.state??gt;return Hu(e,r,s,i)}function $u(e,n={}){const{className:t,render:r}=e,{state:s=gt,ref:i,props:a,disableStyleHooks:l,customStyleHookMapping:c,enabled:f=!0}=n,h=f?Iu(t,s):void 0;let g;l!==!0&&(g=o.useMemo(()=>f?Ru(s,c):gt,[s,c,f]));const u=f?io(g,Array.isArray(a)?Au(a):a)??gt:gt;return typeof document<"u"&&(f?Array.isArray(i)?u.ref=Cu([u.ref,ji(r),...i]):u.ref=Pi(u.ref,ji(r),i):Pi(null,null)),f?(h!==void 0&&(u.className=lo(u.className,h)),u):gt}function Hu(e,n,t,r){if(n){if(typeof n=="function")return n(t,r);const s=ao(t,n.props);return s.ref=t.ref,o.cloneElement(n,s)}if(e&&typeof e=="string")return _u(e,t);throw new Error("Base UI: Render element or function are not defined.")}function _u(e,n){return e==="button"?d.jsx("button",{type:"button",...n}):e==="img"?d.jsx("img",{alt:"",...n}):o.createElement(e,n)}function ji(e){return e&&typeof e!="function"?so(19)?e.props.ref:e.ref:null}const Bu=o.forwardRef(function(n,t){const{render:r,className:s,children:i,...a}=n,{toasts:l,pauseTimers:c,resumeTimers:f,setHovering:h,setFocused:g,viewportRef:u,windowFocusedRef:m,prevFocusElement:p,setPrevFocusElement:v,hovering:y,focused:S,hasDifferingHeights:E}=bs(),x=o.useRef(!1),M=Xe(S),V=l.length;o.useEffect(()=>{if(!u.current)return;function D(B){V!==0&&B.key==="F6"&&B.target!==u.current&&(B.preventDefault(),v(bt(jt(u.current))),u.current?.focus(),c(),g(!0))}const j=Un(u.current);return j.addEventListener("keydown",D),()=>{j.removeEventListener("keydown",D)}},[c,g,v,V,u]),o.useEffect(()=>{if(!u.current||!V)return;const D=Un(u.current);function j(G){G.target===D&&(m.current=!1,c())}function B(G){if(G.relatedTarget||G.target===D)return;const W=_e(G),z=bt(jt(u.current));(!Oe(u.current,W)||!Nn(z))&&f(),setTimeout(()=>{m.current=!0})}return D.addEventListener("blur",j,!0),D.addEventListener("focus",B,!0),()=>{D.removeEventListener("blur",j,!0),D.removeEventListener("focus",B,!0)}},[c,f,u,m,g,M,V]);function b(D){u.current&&(x.current=!0,D.relatedTarget===u.current?l[0]?.ref?.current?.focus():p?.focus({preventScroll:!0}))}function F(D){D.key==="Tab"&&D.shiftKey&&D.target===u.current&&(D.preventDefault(),p?.focus({preventScroll:!0}),f())}function k(){c(),h(!0)}function N(){const D=bt(jt(u.current));Oe(u.current,D)&&Nn(D)||(f(),h(!1))}function T(){if(x.current){x.current=!1;return}if(S)return;const D=bt(jt(u.current));!m.current&&!Nn(D)||(g(!0),c())}function R(D){!S||Oe(u.current,D.relatedTarget)||(g(!1),f())}const C={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:k,onMouseMove:k,onMouseLeave:N,onFocus:T,onBlur:R,onKeyDown:F,onClick:T},w=o.useMemo(()=>({expanded:y||S||E}),[y,S,E]),A=at("div",n,{ref:[t,u],state:w,props:[C,{...a,children:d.jsxs(o.Fragment,{children:[V>0&&p&&d.jsx(Dr,{onFocus:b}),i,V>0&&p&&d.jsx(Dr,{onFocus:b})]})}]}),P=o.useMemo(()=>({viewportRef:u}),[u]),q=o.useMemo(()=>l.filter(D=>D.priority==="high"),[l]);return d.jsxs(Mu.Provider,{value:P,children:[V>0&&p&&d.jsx(Dr,{onFocus:b}),A,!S&&q.length>0&&d.jsx("div",{style:to,children:q.map(D=>d.jsxs("div",{role:"alert","aria-atomic":!0,children:[d.jsx("div",{children:D.title}),d.jsx("div",{children:D.description})]},D.id))})]})});function Zu(e){return so(19)?e:e?"true":void 0}const co=o.createContext(void 0);function fn(){const e=o.useContext(co);if(!e)throw new Error("Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.");return e}let Yn=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const zu={[Yn.startingStyle]:""},Uu={[Yn.endingStyle]:""},uo={transitionStatus(e){return e==="starting"?zu:e==="ending"?Uu:null}},Rn=null;class Gu{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=n=>{this.isScheduled=!1;const t=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s<t.length;s+=1)t[s]?.(n)};request(n){const t=this.nextId;return this.nextId+=1,this.callbacks.push(n),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),t}cancel(n){const t=n-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,this.callbacksCount-=1)}}const In=new Gu;class Ye{static create(){return new Ye}static request(n){return In.request(n)}static cancel(n){return In.cancel(n)}currentId=Rn;request(n){this.cancel(),this.currentId=In.request(()=>{this.currentId=Rn,n()})}cancel=()=>{this.currentId!==Rn&&(In.cancel(this.currentId),this.currentId=Rn)};disposeEffect=()=>this.cancel}function qu(){const e=ys(Ye.create).current;return ec(e.disposeEffect),e}function Ku(e,n=!1){const t=qu();return oe((r,s=null)=>{if(t.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?r():t.request(()=>{function a(){i&&Promise.allSettled(i.getAnimations().map(l=>l.finished)).then(()=>{s!=null&&s.aborted||Ce.flushSync(r)})}n?t.request(a):a()})})}function Ds(e){const{enabled:n=!0,open:t,ref:r,onComplete:s}=e,i=Xe(t),a=oe(s),l=Ku(r,t);o.useEffect(()=>{n&&l(()=>{t===i.current&&a()})},[n,t,a,l,i])}let It=(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 Wu={...uo,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},en=40,Yu=10,ct=.5,Qu=1;function Ni(e,n,t){switch(e){case"up":return-t;case"down":return t;case"left":return-n;case"right":return n;default:return 0}}function Xu(e){const t=window.getComputedStyle(e).transform;let r=0,s=0,i=1;if(t&&t!=="none"){const a=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(a){const l=a[1].split(", ").map(parseFloat);l.length===6?(r=l[4],s=l[5],i=Math.sqrt(l[0]*l[0]+l[1]*l[1])):l.length===16&&(r=l[12],s=l[13],i=l[0])}}return{x:r,y:s,scale:i}}const Ju=o.forwardRef(function(n,t){const{toast:r,render:s,className:i,swipeDirection:a=["down","right"],...l}=n,c=Array.isArray(a)?a:[a],{toasts:f,hovering:h,focused:g,close:u,remove:m,setToasts:p,pauseTimers:v,resumeTimers:y,hasDifferingHeights:S}=bs(),[E,x]=o.useState(void 0),[M,V]=o.useState(!1),[b,F]=o.useState(!1),[k,N]=o.useState(!1),[T,R]=o.useState({x:0,y:0}),[C,w]=o.useState({x:0,y:0,scale:1}),[A,P]=o.useState(),[q,D]=o.useState(),[j,B]=o.useState(null),G=o.useRef(null),W=o.useRef({x:0,y:0}),z=o.useRef({x:0,y:0,scale:1}),$=o.useRef(void 0),_=o.useRef(0),X=o.useRef(!1),I=o.useRef({x:0,y:0}),O=o.useRef(!1),L=o.useMemo(()=>f.indexOf(r),[r,f]),H=o.useMemo(()=>f.filter(Q=>Q.transitionStatus!=="ending").indexOf(r),[r,f]),U=o.useMemo(()=>f.slice(0,f.indexOf(r)).reduce((Q,J)=>Q+(J.height||0),0),[f,r]);Ds({open:r.transitionStatus!=="ending",ref:G,onComplete(){r.transitionStatus==="ending"&&m(r.id)}}),o.useEffect(()=>{if(!G.current)return;function Q(){const J=G.current?.offsetHeight;p(ue=>ue.map(de=>de.id===r.id?{...de,ref:G,height:J,transitionStatus:void 0}:de))}if(Q(),typeof ResizeObserver=="function"){const J=new ResizeObserver(Q);return J.observe(G.current),()=>{J.disconnect()}}},[r.id,p]);function ce(Q,J){let ue=Q,de=J;return!c.includes("left")&&!c.includes("right")?ue=Q>0?Q**ct:-(Math.abs(Q)**ct):(!c.includes("right")&&Q>0&&(ue=Q**ct),!c.includes("left")&&Q<0&&(ue=-(Math.abs(Q)**ct))),!c.includes("up")&&!c.includes("down")?de=J>0?J**ct:-(Math.abs(J)**ct):(!c.includes("down")&&J>0&&(de=J**ct),!c.includes("up")&&J<0&&(de=-(Math.abs(J)**ct))),{x:ue,y:de}}function pe(Q){if(Q.button!==0)return;Q.pointerType==="touch"&&v();const J=_e(Q.nativeEvent);if(!(J&&J.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(X.current=!1,$.current=void 0,_.current=0,W.current={x:Q.clientX,y:Q.clientY},I.current=W.current,G.current){const de=Xu(G.current);z.current=de,w(de),R({x:de.x,y:de.y})}V(!0),F(!1),B(null),O.current=!0,G.current?.setPointerCapture(Q.pointerId)}}function Be(Q){if(!M)return;Q.preventDefault(),O.current&&(W.current={x:Q.clientX,y:Q.clientY},O.current=!1);const{clientY:J,clientX:ue,movementX:de,movementY:$e}=Q;($e<0&&J>I.current.y||$e>0&&J<I.current.y)&&(I.current={x:I.current.x,y:J}),(de<0&&ue>I.current.x||de>0&&ue<I.current.x)&&(I.current={x:ue,y:I.current.y});const ie=ue-W.current.x,fe=J-W.current.y,je=J-I.current.y,Ne=ue-I.current.x;if(!b&&Math.sqrt(ie*ie+fe*fe)>=Qu&&(F(!0),j===null)){const Rt=c.includes("left")||c.includes("right"),Tr=c.includes("up")||c.includes("down");if(Rt&&Tr){const Fr=Math.abs(ie),Or=Math.abs(fe);B(Fr>Or?"horizontal":"vertical")}}let Me;if(!$.current)j==="vertical"?fe>0?Me="down":fe<0&&(Me="up"):j==="horizontal"?ie>0?Me="right":ie<0&&(Me="left"):Math.abs(ie)>=Math.abs(fe)?Me=ie>0?"right":"left":Me=fe>0?"down":"up",Me&&c.includes(Me)&&($.current=Me,_.current=Ni(Me,ie,fe),x(Me));else{const Ot=$.current,Rt=Ni(Ot,Ne,je);Rt>en?(X.current=!1,x(Ot)):_.current-Rt>=Yu&&(X.current=!0)}const lt=ce(ie,fe);let Ft=z.current.x,Jt=z.current.y;j==="horizontal"?(c.includes("left")||c.includes("right"))&&(Ft+=lt.x):(j==="vertical"||(c.includes("left")||c.includes("right"))&&(Ft+=lt.x),(c.includes("up")||c.includes("down"))&&(Jt+=lt.y)),R({x:Ft,y:Jt})}function Tt(Q){if(!M)return;if(Q.pointerType==="touch"&&!g&&y(),V(!1),F(!1),B(null),G.current?.releasePointerCapture(Q.pointerId),X.current){R({x:C.x,y:C.y}),x(void 0);return}let J=!1;const ue=T.x-C.x,de=T.y-C.y;let $e;for(const ie of c){switch(ie){case"right":ue>en&&(J=!0,$e="right");break;case"left":ue<-en&&(J=!0,$e="left");break;case"down":de>en&&(J=!0,$e="down");break;case"up":de<-en&&(J=!0,$e="up");break}if(J)break}J?(x($e),N(!0),u(r.id)):(R({x:C.x,y:C.y}),x(void 0))}function ht(Q){if(Q.key==="Escape"){if(!G.current||!Oe(G.current,bt(jt(G.current))))return;u(r.id)}}o.useEffect(()=>{const Q=G.current;if(!Q)return;function J(ue){Oe(Q,ue.target)&&ue.preventDefault()}return Q.addEventListener("touchmove",J,{passive:!1}),()=>{Q.removeEventListener("touchmove",J)}},[]);function xe(){if(!M&&T.x===C.x&&T.y===C.y&&!k)return{[It.swipeMovementX]:"0px",[It.swipeMovementY]:"0px"};const Q=T.x-C.x,J=T.y-C.y;return{transition:M?"none":void 0,[It.swipeMovementX]:`${Q}px`,[It.swipeMovementY]:`${J}px`}}const Pe=r.priority==="high",pt={role:Pe?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":A,"aria-describedby":q,"aria-hidden":Pe&&!g?!0:void 0,onPointerDown:pe,onPointerMove:Be,onPointerUp:Tt,onKeyDown:ht,inert:Zu(r.limited),style:{...xe(),[It.index]:r.transitionStatus==="ending"?L:H,[It.offsetY]:`${U}px`}},Le=o.useMemo(()=>({rootRef:G,toast:r,titleId:A,setTitleId:P,descriptionId:q,setDescriptionId:D,swiping:M,swipeDirection:E}),[r,A,q,M,E]),ot=o.useMemo(()=>({transitionStatus:r.transitionStatus,expanded:h||g||S,limited:r.limited||!1,type:r.type,swiping:Le.swiping,swipeDirection:Le.swipeDirection}),[h,g,S,r.transitionStatus,r.limited,r.type,Le.swiping,Le.swipeDirection]),Xt=at("div",n,{ref:[t,Le.rootRef],state:ot,customStyleHookMapping:Wu,props:[pt,l]});return d.jsx(co.Provider,{value:Le,children:Xt})}),ed=o.forwardRef(function(n,t){const{render:r,className:s,id:i,children:a,...l}=n,{toast:c}=fn(),f=a??c.description,h=!!f,g=xs(i),{setDescriptionId:u}=fn();Te(()=>{if(h)return u(g),()=>{u(void 0)}},[h,g,u]);const m=o.useMemo(()=>({type:c.type}),[c.type]),p=at("p",n,{ref:t,state:m,props:{...l,id:g,children:f}});return h?p:null}),td=o.forwardRef(function(n,t){const{render:r,className:s,id:i,children:a,...l}=n,{toast:c}=fn(),f=a??c.title,h=!!f,g=xs(i),{setTitleId:u}=fn();Te(()=>{if(h)return u(g),()=>{u(void 0)}},[h,g,u]);const m=o.useMemo(()=>({type:c.type}),[c.type]),p=at("h2",n,{ref:t,state:m,props:{...l,id:g,children:f}});return h?p:null}),nd=o.createContext(void 0);function rd(e=!1){const n=o.useContext(nd);if(n===void 0&&!e)throw new Error("Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.");return n}function sd(e){const{focusableWhenDisabled:n,disabled:t,composite:r=!1,tabIndex:s=0,isNativeButton:i}=e,a=r&&n!==!1,l=r&&n===!1;return{props:o.useMemo(()=>{const f={onKeyDown(h){t&&n&&h.key!=="Tab"&&h.preventDefault()}};return r||(f.tabIndex=s,!i&&t&&(f.tabIndex=n?s:-1)),(i&&(n||a)||!i&&t)&&(f["aria-disabled"]=t),i&&(!n||l)&&(f.disabled=t),f},[r,t,n,a,l,i,s])}}function id(e={}){const{disabled:n=!1,focusableWhenDisabled:t,tabIndex:r=0,native:s=!0}=e,i=o.useRef(null),a=rd(!0)!==void 0,l=oe(()=>{const h=i.current;return!!(h?.tagName==="A"&&h?.href)}),{props:c}=sd({focusableWhenDisabled:t,disabled:n,composite:a,tabIndex:r,isNativeButton:s});return Te(()=>{const h=i.current;h instanceof HTMLButtonElement&&a&&n&&c.disabled===void 0&&h.disabled&&(h.disabled=!1)},[n,c.disabled,a]),{getButtonProps:o.useCallback((h={})=>{const{onClick:g,onMouseDown:u,onKeyUp:m,onKeyDown:p,onPointerDown:v,...y}=h;return ao({type:s?"button":void 0,onClick(E){if(n){E.preventDefault();return}g?.(E)},onMouseDown(E){n||u?.(E)},onKeyDown(E){if(n||(is(E),p?.(E)),E.baseUIHandlerPrevented)return;const x=E.target===E.currentTarget&&!s&&!l()&&!n,M=E.key==="Enter",V=E.key===" ";x&&((V||M)&&E.preventDefault(),M&&g?.(E))},onKeyUp(E){n||(is(E),m?.(E)),!E.baseUIHandlerPrevented&&E.target===E.currentTarget&&!s&&!n&&E.key===" "&&g?.(E)},onPointerDown(E){if(n){E.preventDefault();return}v?.(E)}},s?void 0:{role:"button"},c,y)},[n,c,s,l]),buttonRef:i}}const ad=o.forwardRef(function(n,t){const{render:r,className:s,disabled:i,nativeButton:a=!0,...l}=n,{close:c,focused:f}=bs(),{toast:h}=fn(),{getButtonProps:g,buttonRef:u}=id({disabled:i,native:a}),m=o.useMemo(()=>({type:h.type}),[h.type]);return at("button",n,{ref:[t,u],state:m,props:[{"aria-hidden":!f||void 0,onClick(){c(h.id)}},l,g]})});function od(){const e=new Map;return{emit(n,t){e.get(n)?.forEach(r=>r(t))},on(n,t){e.has(n)||e.set(n,new Set),e.get(n).add(t)},off(n,t){e.get(n)?.delete(t)}}}const ld=o.createContext(null),cd=o.createContext(null),fo=()=>o.useContext(ld)?.id||null,Ls=()=>o.useContext(cd),Di=ws("safe-polygon");function $n(e,n,t){if(t&&!Wn(t))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r?.[n]}return e?.[n]}function Lr(e){return typeof e=="function"?e():e}function ud(e,n={}){const{open:t,onOpenChange:r,dataRef:s,events:i,elements:a}=e,{enabled:l=!0,delay:c=0,handleClose:f=null,mouseOnly:h=!1,restMs:g=0,move:u=!0}=n,m=Ls(),p=fo(),v=Xe(f),y=Xe(c),S=Xe(t),E=Xe(g),x=o.useRef(void 0),M=_t(),V=o.useRef(void 0),b=_t(),F=o.useRef(!0),k=o.useRef(!1),N=o.useRef(()=>{}),T=o.useRef(!1),R=oe(()=>{const D=s.current.openEvent?.type;return D?.includes("mouse")&&D!=="mousedown"});o.useEffect(()=>{if(!l)return;function D({open:j}){j||(M.clear(),b.clear(),F.current=!0,T.current=!1)}return i.on("openchange",D),()=>{i.off("openchange",D)}},[l,i,M,b]),o.useEffect(()=>{if(!l||!v.current||!t)return;function D(B){R()&&r(!1,B,"hover")}const j=xt(a.floating).documentElement;return j.addEventListener("mouseleave",D),()=>{j.removeEventListener("mouseleave",D)}},[a.floating,t,r,l,v,R]);const C=o.useCallback((D,j=!0,B="hover")=>{const G=$n(y.current,"close",x.current);G&&!V.current?M.start(G,()=>r(!1,D,B)):j&&(M.clear(),r(!1,D,B))},[y,r,M]),w=oe(()=>{N.current(),V.current=void 0}),A=oe(()=>{if(k.current){const D=xt(a.floating).body;D.style.pointerEvents="",D.removeAttribute(Di),k.current=!1}}),P=oe(()=>s.current.openEvent?["click","mousedown"].includes(s.current.openEvent.type):!1);o.useEffect(()=>{if(!l)return;function D(z){if(M.clear(),F.current=!1,h&&!Wn(x.current)||Lr(E.current)>0&&!$n(y.current,"open"))return;const $=$n(y.current,"open",x.current);$?M.start($,()=>{S.current||r(!0,z,"hover")}):t||r(!0,z,"hover")}function j(z){if(P()){A();return}N.current();const $=xt(a.floating);if(b.clear(),T.current=!1,v.current&&s.current.floatingContext){t||M.clear(),V.current=v.current({...s.current.floatingContext,tree:m,x:z.clientX,y:z.clientY,onClose(){A(),w(),P()||C(z,!0,"safe-polygon")}});const X=V.current;$.addEventListener("mousemove",X),N.current=()=>{$.removeEventListener("mousemove",X)};return}(x.current==="touch"?!Oe(a.floating,z.relatedTarget):!0)&&C(z)}function B(z){P()||s.current.floatingContext&&v.current?.({...s.current.floatingContext,tree:m,x:z.clientX,y:z.clientY,onClose(){A(),w(),P()||C(z)}})(z)}function G(){M.clear()}function W(z){P()||C(z,!1)}if(Fe(a.domReference)){const z=a.domReference,$=a.floating;return t&&z.addEventListener("mouseleave",B),u&&z.addEventListener("mousemove",D,{once:!0}),z.addEventListener("mouseenter",D),z.addEventListener("mouseleave",j),$&&($.addEventListener("mouseleave",B),$.addEventListener("mouseenter",G),$.addEventListener("mouseleave",W)),()=>{t&&z.removeEventListener("mouseleave",B),u&&z.removeEventListener("mousemove",D),z.removeEventListener("mouseenter",D),z.removeEventListener("mouseleave",j),$&&($.removeEventListener("mouseleave",B),$.removeEventListener("mouseenter",G),$.removeEventListener("mouseleave",W))}}},[a,l,e,h,u,C,w,A,r,t,S,m,y,v,s,P,E,M,b]),Te(()=>{if(l&&t&&v.current?.__options?.blockPointerEvents&&R()){k.current=!0;const D=a.floating;if(Fe(a.domReference)&&D){const j=xt(a.floating).body;j.setAttribute(Di,"");const B=a.domReference,G=m?.nodesRef.current.find(W=>W.id===p)?.context?.elements.floating;return G&&(G.style.pointerEvents=""),j.style.pointerEvents="none",B.style.pointerEvents="auto",D.style.pointerEvents="auto",()=>{j.style.pointerEvents="",B.style.pointerEvents="",D.style.pointerEvents=""}}}},[l,t,p,a,m,v,R]),Te(()=>{t||(x.current=void 0,T.current=!1,w(),A())},[t,w,A]),o.useEffect(()=>()=>{w(),M.clear(),b.clear(),A()},[l,a.domReference,w,A,M,b]);const q=o.useMemo(()=>{function D(j){x.current=j.pointerType}return{onPointerDown:D,onPointerEnter:D,onMouseMove(j){const{nativeEvent:B}=j;function G(){!F.current&&!S.current&&r(!0,B,"hover")}h&&!Wn(x.current)||t||Lr(E.current)===0||T.current&&j.movementX**2+j.movementY**2<2||(b.clear(),x.current==="touch"?G():(T.current=!0,b.start(Lr(E.current),G)))}}},[h,r,t,S,E,b]);return o.useMemo(()=>l?{reference:q}:{},[l,q])}const ho=o.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Es,currentIdRef:{current:null},currentContextRef:{current:null}});function dd(e){const{children:n,delay:t,timeoutMs:r=0}=e,s=o.useRef(t),i=o.useRef(t),a=o.useRef(null),l=o.useRef(null),c=_t();return d.jsx(ho.Provider,{value:o.useMemo(()=>({hasProvider:!0,delayRef:s,initialDelayRef:i,currentIdRef:a,timeoutMs:r,currentContextRef:l,timeout:c}),[r,c]),children:n})}function fd(e,n={}){const{open:t,onOpenChange:r,floatingId:s}=e,{enabled:i=!0}=n,a=o.useContext(ho),{currentIdRef:l,delayRef:c,timeoutMs:f,initialDelayRef:h,currentContextRef:g,hasProvider:u,timeout:m}=a,[p,v]=o.useState(!1);return Te(()=>{function y(){v(!1),g.current?.setIsInstantPhase(!1),l.current=null,g.current=null,c.current=h.current}if(i&&l.current&&!t&&l.current===s){if(v(!1),f)return m.start(f,y),()=>{m.clear()};y()}},[i,t,s,l,c,f,h,g,m]),Te(()=>{if(!i||!t)return;const y=g.current,S=l.current;g.current={onOpenChange:r,setIsInstantPhase:v},l.current=s,c.current={open:0,close:$n(h.current,"close")},S!==null&&S!==s?(m.clear(),v(!0),y?.setIsInstantPhase(!0),y?.onOpenChange(!1)):(v(!1),y?.setIsInstantPhase(!1))},[i,t,s,r,l,c,f,h,g,m]),Te(()=>()=>{g.current=null},[g]),o.useMemo(()=>({hasProvider:u,delayRef:c,isInstantPhase:p}),[u,c,p])}function hd(e,n){let t=null,r=null,s=!1;return{contextElement:e||void 0,getBoundingClientRect(){const i=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},a=n.axis==="x"||n.axis==="both",l=n.axis==="y"||n.axis==="both",c=["mouseenter","mousemove"].includes(n.dataRef.current.openEvent?.type||"")&&n.pointerType!=="touch";let f=i.width,h=i.height,g=i.x,u=i.y;return t==null&&n.x&&a&&(t=i.x-n.x),r==null&&n.y&&l&&(r=i.y-n.y),g-=t||0,u-=r||0,f=0,h=0,!s||c?(f=n.axis==="y"?i.width:0,h=n.axis==="x"?i.height:0,g=a&&n.x!=null?n.x:g,u=l&&n.y!=null?n.y:u):s&&!c&&(h=n.axis==="x"?i.height:h,f=n.axis==="y"?i.width:f),s=!0,{width:f,height:h,x:g,y:u,top:u,right:g+f,bottom:u+h,left:g}}}}function Li(e){return e!=null&&e.clientX!=null}function pd(e,n={}){const{open:t,dataRef:r,elements:{floating:s,domReference:i},refs:a}=e,{enabled:l=!0,axis:c="both",x:f=null,y:h=null}=n,g=o.useRef(!1),u=o.useRef(null),[m,p]=o.useState(),[v,y]=o.useState([]),S=oe((b,F)=>{g.current||r.current.openEvent&&!Li(r.current.openEvent)||a.setPositionReference(hd(i,{x:b,y:F,axis:c,dataRef:r,pointerType:m}))}),E=oe(b=>{f!=null||h!=null||(t?u.current||y([]):S(b.clientX,b.clientY))}),x=Wn(m)?s:t,M=o.useCallback(()=>{if(!x||!l||f!=null||h!=null)return;const b=Un(s);function F(k){const N=_e(k);Oe(s,N)?(b.removeEventListener("mousemove",F),u.current=null):S(k.clientX,k.clientY)}if(!r.current.openEvent||Li(r.current.openEvent)){b.addEventListener("mousemove",F);const k=()=>{b.removeEventListener("mousemove",F),u.current=null};return u.current=k,k}a.setPositionReference(i)},[x,l,f,h,s,r,a,i,S]);o.useEffect(()=>M(),[M,v]),o.useEffect(()=>{l&&!s&&(g.current=!1)},[l,s]),o.useEffect(()=>{!l&&t&&(g.current=!0)},[l,t]),Te(()=>{l&&(f!=null||h!=null)&&(g.current=!1,S(f,h))},[l,f,h,S]);const V=o.useMemo(()=>{function b(F){p(F.pointerType)}return{onPointerDown:b,onPointerEnter:b,onMouseMove:E,onMouseEnter:E}},[E]);return o.useMemo(()=>l?{reference:V}:{},[l,V])}const md={intentional:"onClick",sloppy:"onPointerDown"};function $i(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function gd(e,n={}){const{open:t,onOpenChange:r,elements:s,dataRef:i}=e,{enabled:a=!0,escapeKey:l=!0,outsidePress:c=!0,outsidePressEvent:f="sloppy",referencePress:h=!1,referencePressEvent:g="sloppy",ancestorScroll:u=!1,bubbles:m,capture:p}=n,v=Ls(),y=oe(typeof c=="function"?c:()=>!1),S=typeof c=="function"?y:c,E=o.useRef(!1),{escapeKey:x,outsidePress:M}=$i(m),{escapeKey:V,outsidePress:b}=$i(p),F=o.useRef(null),k=_t(),N=_t(),T=o.useRef(!1),R=o.useRef(""),C=oe(I=>{R.current=I.pointerType}),w=oe(()=>{const I=R.current,O=I==="pen"||!I?"mouse":I;return typeof f=="string"?f:f[O]}),A=oe(I=>{if(!t||!a||!l||I.key!=="Escape"||T.current)return;const O=i.current.floatingContext?.nodeId,L=v?ln(v.nodesRef.current,O):[];if(!x&&(I.stopPropagation(),L.length>0)){let H=!0;if(L.forEach(U=>{U.context?.open&&!U.context.dataRef.current.__escapeKeyBubbles&&(H=!1)}),!H)return}r(!1,ku(I)?I.nativeEvent:I,"escape-key")}),P=oe(I=>{const O=w();return O==="intentional"&&I.type!=="click"||O==="sloppy"&&I.type==="click"}),q=oe(I=>{const O=()=>{A(I),_e(I)?.removeEventListener("keydown",O)};_e(I)?.addEventListener("keydown",O)}),D=oe(I=>{if(P(I))return;const O=i.current.insideReactTree;i.current.insideReactTree=!1;const L=E.current;if(E.current=!1,w()==="intentional"&&L||O||typeof S=="function"&&!S(I))return;const H=_e(I),U=`[${ws("inert")}]`,ce=xt(s.floating).querySelectorAll(U);let pe=Fe(H)?H:null;for(;pe&&!Ar(pe);){const xe=tc(pe);if(Ar(xe)||!Fe(xe))break;pe=xe}if(ce.length&&Fe(H)&&!nc(H)&&!Oe(H,s.floating)&&Array.from(ce).every(xe=>!Oe(pe,xe)))return;if(va(H)){const xe=Ar(H),Pe=rc(H),pt=/auto|scroll/,Le=xe||pt.test(Pe.overflowX),ot=xe||pt.test(Pe.overflowY),Xt=Le&&H.clientWidth>0&&H.scrollWidth>H.clientWidth,Q=ot&&H.clientHeight>0&&H.scrollHeight>H.clientHeight,J=Pe.direction==="rtl",ue=Q&&(J?I.offsetX<=H.offsetWidth-H.clientWidth:I.offsetX>H.clientWidth),de=Xt&&I.offsetY>H.clientHeight;if(ue||de)return}const Be=i.current.floatingContext?.nodeId,Tt=v&&ln(v.nodesRef.current,Be).some(xe=>We(I,xe.context?.elements.floating));if(We(I,s.floating)||We(I,s.domReference)||Tt)return;const ht=v?ln(v.nodesRef.current,Be):[];if(ht.length>0){let xe=!0;if(ht.forEach(Pe=>{Pe.context?.open&&!Pe.context.dataRef.current.__outsidePressBubbles&&(xe=!1)}),!xe)return}r(!1,I,"outside-press")}),j=oe(I=>{if(!(w()!=="sloppy"||!t||!a||We(I,s.floating)||We(I,s.domReference))){if(I.pointerType==="touch"){F.current={startTime:Date.now(),startX:I.clientX,startY:I.clientY,dismissOnPointerUp:!1,dismissOnMouseDown:!0},k.start(1e3,()=>{F.current&&(F.current.dismissOnPointerUp=!1,F.current.dismissOnMouseDown=!1)});return}D(I)}}),B=oe(I=>{if(P(I)||(k.clear(),I.type==="mousedown"&&F.current&&!F.current.dismissOnMouseDown))return;const O=()=>{I.type==="pointerdown"?j(I):D(I),_e(I)?.removeEventListener(I.type,O)};_e(I)?.addEventListener(I.type,O)}),G=oe(I=>{if(w()!=="sloppy"||I.pointerType!=="touch"||!F.current||We(I,s.floating)||We(I,s.domReference))return;const O=Math.abs(I.clientX-F.current.startX),L=Math.abs(I.clientY-F.current.startY),H=Math.sqrt(O*O+L*L);H>5&&(F.current.dismissOnPointerUp=!0),H>10&&(D(I),k.clear(),F.current=null)}),W=oe(I=>{w()!=="sloppy"||I.pointerType!=="touch"||!F.current||We(I,s.floating)||We(I,s.domReference)||(F.current.dismissOnPointerUp&&D(I),k.clear(),F.current=null)});o.useEffect(()=>{if(!t||!a)return;i.current.__escapeKeyBubbles=x,i.current.__outsidePressBubbles=M;const I=new Es;function O(pe){r(!1,pe,"ancestor-scroll")}function L(){I.clear(),T.current=!0}function H(){I.start(sc()?5:0,()=>{T.current=!1})}const U=xt(s.floating);U.addEventListener("pointerdown",C,!0),l&&(U.addEventListener("keydown",V?q:A,V),U.addEventListener("compositionstart",L),U.addEventListener("compositionend",H)),S&&(U.addEventListener("click",b?B:D,b),U.addEventListener("pointerdown",b?B:D,b),U.addEventListener("pointermove",G,b),U.addEventListener("pointerup",W,b),U.addEventListener("mousedown",B,b));let ce=[];return u&&(Fe(s.domReference)&&(ce=Vr(s.domReference)),Fe(s.floating)&&(ce=ce.concat(Vr(s.floating))),!Fe(s.reference)&&s.reference&&s.reference.contextElement&&(ce=ce.concat(Vr(s.reference.contextElement)))),ce=ce.filter(pe=>pe!==U.defaultView?.visualViewport),ce.forEach(pe=>{pe.addEventListener("scroll",O,{passive:!0})}),()=>{U.removeEventListener("pointerdown",C,!0),l&&(U.removeEventListener("keydown",V?q:A,V),U.removeEventListener("compositionstart",L),U.removeEventListener("compositionend",H)),S&&(U.removeEventListener("click",b?B:D,b),U.removeEventListener("pointerdown",b?B:D,b),U.removeEventListener("pointermove",G,b),U.removeEventListener("pointerup",W,b),U.removeEventListener("mousedown",B,b)),ce.forEach(pe=>{pe.removeEventListener("scroll",O)}),I.clear()}},[i,s,l,S,f,t,r,u,a,x,M,A,V,q,D,b,B,j,G,W,C]),o.useEffect(()=>{i.current.insideReactTree=!1},[i,S]);const z=o.useMemo(()=>({onKeyDown:A,...h&&{[md[g]]:I=>{r(!1,I.nativeEvent,"reference-press")},...g!=="intentional"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[A,r,h,g]),$=oe(I=>{const O=_e(I.nativeEvent);Oe(s.floating,O)&&(E.current=!0)}),_=oe(()=>{i.current.insideReactTree=!0,N.start(0,()=>{i.current.insideReactTree=!1})}),X=o.useMemo(()=>({onKeyDown:A,onMouseDown:$,onMouseUp:$,onPointerDownCapture:_,onMouseDownCapture:_,onClickCapture:_}),[A,$,_]);return o.useMemo(()=>a?{reference:z,floating:X}:{},[a,z,X])}function po(e){const{open:n=!1,onOpenChange:t,elements:r}=e,s=xs(),i=o.useRef({}),[a]=o.useState(()=>od()),l=fo()!=null,[c,f]=o.useState(r.reference),h=oe((m,p,v)=>{i.current.openEvent=m?p:void 0,a.emit("openchange",{open:m,event:p,reason:v,nested:l}),t?.(m,p,v)}),g=o.useMemo(()=>({setPositionReference:f}),[]),u=o.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return o.useMemo(()=>({dataRef:i,open:n,onOpenChange:h,elements:u,events:a,floatingId:s,refs:g}),[n,h,u,a,s,g])}function vd(e={}){const{nodeId:n}=e,t=po({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||t,s=r.elements,[i,a]=o.useState(null),[l,c]=o.useState(null),h=s?.domReference||i,g=o.useRef(null),u=Ls();Te(()=>{h&&(g.current=h)},[h]);const m=ic({...e,elements:{...s,...l&&{reference:l}}}),p=o.useCallback(x=>{const M=Fe(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),getClientRects:()=>x.getClientRects(),contextElement:x}:x;c(M),m.refs.setReference(M)},[m.refs]),v=o.useCallback(x=>{(Fe(x)||x===null)&&(g.current=x,a(x)),(Fe(m.refs.reference.current)||m.refs.reference.current===null||x!==null&&!Fe(x))&&m.refs.setReference(x)},[m.refs]),y=o.useMemo(()=>({...m.refs,setReference:v,setPositionReference:p,domReference:g}),[m.refs,v,p]),S=o.useMemo(()=>({...m.elements,domReference:h}),[m.elements,h]),E=o.useMemo(()=>({...m,...r,refs:y,elements:S,nodeId:n}),[m,y,S,n,r]);return Te(()=>{r.dataRef.current.floatingContext=E;const x=u?.nodesRef.current.find(M=>M.id===n);x&&(x.context=E)}),o.useMemo(()=>({...m,context:E,refs:y,elements:S}),[m,y,S,E])}const $r=oc&&ga;function yd(e,n={}){const{open:t,onOpenChange:r,events:s,dataRef:i,elements:a}=e,{enabled:l=!0,visibleOnly:c=!0}=n,f=o.useRef(!1),h=_t(),g=o.useRef(!0);o.useEffect(()=>{if(!l)return;const m=Un(a.domReference);function p(){!t&&va(a.domReference)&&a.domReference===bt(xt(a.domReference))&&(f.current=!0)}function v(){g.current=!0}function y(){g.current=!1}return m.addEventListener("blur",p),$r&&(m.addEventListener("keydown",v,!0),m.addEventListener("pointerdown",y,!0)),()=>{m.removeEventListener("blur",p),$r&&(m.removeEventListener("keydown",v,!0),m.removeEventListener("pointerdown",y,!0))}},[a.domReference,t,l]),o.useEffect(()=>{if(!l)return;function m({reason:p}){(p==="reference-press"||p==="escape-key")&&(f.current=!0)}return s.on("openchange",m),()=>{s.off("openchange",m)}},[s,l]);const u=o.useMemo(()=>({onMouseLeave(){f.current=!1},onFocus(m){if(f.current)return;const p=_e(m.nativeEvent);if(c&&Fe(p)){if($r&&!m.relatedTarget){if(!g.current&&!ac(p))return}else if(!Nn(p))return}r(!0,m.nativeEvent,"focus")},onBlur(m){f.current=!1;const p=m.relatedTarget,v=m.nativeEvent,y=Fe(p)&&p.hasAttribute(ws("focus-guard"))&&p.getAttribute("data-type")==="outside";h.start(0,()=>{const S=bt(a.domReference?a.domReference.ownerDocument:document);!p&&S===a.domReference||Oe(i.current.floatingContext?.refs.floating.current,S)||Oe(a.domReference,S)||y||r(!1,v,"focus")})}}),[i,a.domReference,r,c,h]);return o.useMemo(()=>l?{reference:u}:{},[l,u])}function bd(e=[]){const n=e.map(l=>l?.reference),t=e.map(l=>l?.floating),r=e.map(l=>l?.item),s=o.useCallback(l=>Hr(l,e,"reference"),n),i=o.useCallback(l=>Hr(l,e,"floating"),t),a=o.useCallback(l=>Hr(l,e,"item"),r);return o.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:a}),[s,i,a])}function Hr(e,n,t){const r=new Map,s=t==="item",i={};t==="floating"&&(i.tabIndex=-1,i[lc]="");for(const a in e)s&&e&&(a===ya||a===ba)||(i[a]=e[a]);for(let a=0;a<n.length;a+=1){let l;const c=n[a]?.[t];typeof c=="function"?l=e?c(e):null:l=c,l&&Hi(i,l,s,r)}return Hi(i,e,s,r),i}function Hi(e,n,t,r){for(const s in n){const i=n[s];t&&(s===ya||s===ba)||(s.startsWith("on")?(r.has(s)||r.set(s,[]),typeof i=="function"&&(r.get(s)?.push(i),e[s]=(...a)=>r.get(s)?.map(l=>l(...a)).find(l=>l!==void 0))):e[s]=i)}}function _i(e,n){const[t,r]=e;let s=!1;const i=n.length;for(let a=0,l=i-1;a<i;l=a++){const[c,f]=n[a]||[0,0],[h,g]=n[l]||[0,0];f>=r!=g>=r&&t<=(h-c)*(r-f)/(g-f)+c&&(s=!s)}return s}function xd(e,n){return e[0]>=n.x&&e[0]<=n.x+n.width&&e[1]>=n.y&&e[1]<=n.y+n.height}function wd(e={}){const{buffer:n=.5,blockPointerEvents:t=!1,requireIntent:r=!0}=e,s=new Es;let i=!1,a=null,l=null,c=typeof performance<"u"?performance.now():0;function f(g,u){const m=performance.now(),p=m-c;if(a===null||l===null||p===0)return a=g,l=u,c=m,null;const v=g-a,y=u-l,E=Math.sqrt(v*v+y*y)/p;return a=g,l=u,c=m,E}const h=({x:g,y:u,placement:m,elements:p,onClose:v,nodeId:y,tree:S})=>function(x){function M(){s.clear(),v()}if(s.clear(),!p.domReference||!p.floating||m==null||g==null||u==null)return;const{clientX:V,clientY:b}=x,F=[V,b],k=_e(x),N=x.type==="mouseleave",T=Oe(p.floating,k),R=Oe(p.domReference,k),C=p.domReference.getBoundingClientRect(),w=p.floating.getBoundingClientRect(),A=m.split("-")[0],P=g>w.right-w.width/2,q=u>w.bottom-w.height/2,D=xd(F,C),j=w.width>C.width,B=w.height>C.height,G=(j?C:w).left,W=(j?C:w).right,z=(B?C:w).top,$=(B?C:w).bottom;if(T&&(i=!0,!N))return;if(R&&(i=!1),R&&!N){i=!0;return}if(N&&Fe(x.relatedTarget)&&Oe(p.floating,x.relatedTarget)||S&&ln(S.nodesRef.current,y).some(({context:I})=>I?.open))return;if(A==="top"&&u>=C.bottom-1||A==="bottom"&&u<=C.top+1||A==="left"&&g>=C.right-1||A==="right"&&g<=C.left+1)return M();let _=[];switch(A){case"top":_=[[G,C.top+1],[G,w.bottom-1],[W,w.bottom-1],[W,C.top+1]];break;case"bottom":_=[[G,w.top+1],[G,C.bottom-1],[W,C.bottom-1],[W,w.top+1]];break;case"left":_=[[w.right-1,$],[w.right-1,z],[C.left+1,z],[C.left+1,$]];break;case"right":_=[[C.right-1,$],[C.right-1,z],[w.left+1,z],[w.left+1,$]];break}function X([I,O]){switch(A){case"top":{const L=[j?I+n/2:P?I+n*4:I-n*4,O+n+1],H=[j?I-n/2:P?I+n*4:I-n*4,O+n+1],U=[[w.left,P||j?w.bottom-n:w.top],[w.right,P?j?w.bottom-n:w.top:w.bottom-n]];return[L,H,...U]}case"bottom":{const L=[j?I+n/2:P?I+n*4:I-n*4,O-n],H=[j?I-n/2:P?I+n*4:I-n*4,O-n],U=[[w.left,P||j?w.top+n:w.bottom],[w.right,P?j?w.top+n:w.bottom:w.top+n]];return[L,H,...U]}case"left":{const L=[I+n+1,B?O+n/2:q?O+n*4:O-n*4],H=[I+n+1,B?O-n/2:q?O+n*4:O-n*4];return[...[[q||B?w.right-n:w.left,w.top],[q?B?w.right-n:w.left:w.right-n,w.bottom]],L,H]}case"right":{const L=[I-n,B?O+n/2:q?O+n*4:O-n*4],H=[I-n,B?O-n/2:q?O+n*4:O-n*4],U=[[q||B?w.left+n:w.right,w.top],[q?B?w.left+n:w.right:w.left+n,w.bottom]];return[L,H,...U]}default:return[]}}if(!_i([V,b],_)){if(i&&!D)return M();if(!N&&r){const I=f(x.clientX,x.clientY);if(I!==null&&I<.1)return M()}_i([V,b],X([g,u]))?!i&&r&&s.start(40,M):M()}};return h.__options={blockPointerEvents:t},h}function Ed(){const e=o.useContext(cc);if(!e)throw new Error("Base UI: useToast must be used within <Toast.Provider>.");const{toasts:n,add:t,close:r,update:s,promise:i}=e;return o.useMemo(()=>({toasts:n,add:t,close:r,update:s,promise:i}),[n,t,r,s,i])}const Sd=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),kd=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Md=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Cd=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.createElement("path",{d:"M80,176h96l-48,48ZM128,32,80,80h96Z",opacity:"0.2"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Td=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Fd=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Od=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Rd=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Id=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),Ad=new Map([["bold",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}),o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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",o.createElement(o.Fragment,null,o.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"}))]]),mo=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Sd}));mo.displayName="ArrowCounterClockwiseIcon";const go=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:kd}));go.displayName="CaretDownIcon";const vo=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Md}));vo.displayName="CaretRightIcon";const yr=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Cd}));yr.displayName="CaretUpDownIcon";const it=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Td}));it.displayName="CheckIcon";const Qn=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Fd}));Qn.displayName="ExclamationMarkIcon";const Xn=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Od}));Xn.displayName="PlusIcon";const as=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Rd}));as.displayName="TrashIcon";const $s=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Id}));$s.displayName="WarningIcon";const Hs=o.forwardRef((e,n)=>o.createElement(Ke,{ref:n,...e,weights:Ad}));Hs.displayName="XIcon";function _s(e,n,t){let[r,s]=o.useState(t),i=e!==void 0,a=o.useRef(i),l=o.useRef(!1),c=o.useRef(!1);return i&&!a.current&&!l.current?(l.current=!0,a.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&&a.current&&!c.current&&(c.current=!0,a.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:r,K(f=>(i||s(f),n?.(f)))]}function Bs(e){let[n]=o.useState(e);return n}function yo(e={},n=null,t=[]){for(let[r,s]of Object.entries(e))xo(t,bo(n,r),s);return t}function bo(e,n){return e?e+"["+n+"]":n}function xo(e,n,t){if(Array.isArray(t))for(let[r,s]of t.entries())xo(e,bo(n,r.toString()),s);else t instanceof Date?e.push([n,t.toISOString()]):typeof t=="boolean"?e.push([n,t?"1":"0"]):typeof t=="string"?e.push([n,t]):typeof t=="number"?e.push([n,`${t}`]):t==null?e.push([n,""]):yo(t,n,e)}function wo(e){var n,t;let r=(n=e?.form)!=null?n:e.closest("form");if(r){for(let s of r.elements)if(s!==e&&(s.tagName==="INPUT"&&s.type==="submit"||s.tagName==="BUTTON"&&s.type==="submit"||s.nodeName==="INPUT"&&s.type==="image")){s.click();return}(t=r.requestSubmit)==null||t.call(r)}}let Vd="span";var Ut=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Ut||{});function Pd(e,n){var t;let{features:r=1,...s}=e,i={ref:n,"aria-hidden":(r&2)===2?!0:(t=s["aria-hidden"])!=null?t:void 0,hidden:(r&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",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return he()({ourProps:i,theirProps:s,slot:{},defaultTag:Vd,name:"Hidden"})}let hn=le(Pd),jd=o.createContext(null);function Nd({children:e}){let n=o.useContext(jd);if(!n)return Z.createElement(Z.Fragment,null,e);let{target:t}=n;return t?Ce.createPortal(Z.createElement(Z.Fragment,null,e),t):null}function Zs({data:e,form:n,disabled:t,onReset:r,overrides:s}){let[i,a]=o.useState(null),l=Gt();return o.useEffect(()=>{if(r&&i)return l.addEventListener(i,"reset",r)},[i,n,r]),Z.createElement(Nd,null,Z.createElement(Dd,{setForm:a,formId:n}),yo(e).map(([c,f])=>Z.createElement(hn,{features:Ut.Hidden,...xa({key:c,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:n,disabled:t,name:c,value:f,...s})})))}function Dd({setForm:e,formId:n}){return o.useEffect(()=>{if(n){let t=document.getElementById(n);t&&e(t)}},[e,n]),n?null:Z.createElement(hn,{features:Ut.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:t=>{if(!t)return;let r=t.closest("form");r&&e(r)}})}let Ld="span";function $d(e,n){let t=o.useId(),r=ar(),s=or(),{id:i=r||`headlessui-checkbox-${t}`,disabled:a=s||!1,autoFocus:l=!1,checked:c,defaultChecked:f,onChange:h,name:g,value:u,form:m,indeterminate:p=!1,tabIndex:v=0,...y}=e,S=Bs(f),[E,x]=_s(c,h,S??!1),M=qt(),V=lr(),b=Gt(),[F,k]=o.useState(!1),N=K(()=>{k(!0),x?.(!E),b.nextFrame(()=>{k(!1)})}),T=K($=>{if(cr($.currentTarget))return $.preventDefault();$.preventDefault(),N()}),R=K($=>{$.key===te.Space?($.preventDefault(),N()):$.key===te.Enter&&wo($.currentTarget)}),C=K($=>$.preventDefault()),{isFocusVisible:w,focusProps:A}=Kt({autoFocus:l}),{isHovered:P,hoverProps:q}=Wt({isDisabled:a}),{pressed:D,pressProps:j}=ur({disabled:a}),B=rt({ref:n,id:i,role:"checkbox","aria-checked":p?"mixed":E?"true":"false","aria-labelledby":M,"aria-describedby":V,"aria-disabled":a?!0:void 0,indeterminate:p?"true":void 0,tabIndex:a?void 0:v,onKeyUp:a?void 0:R,onKeyPress:a?void 0:C,onClick:a?void 0:T},A,q,j),G=o.useMemo(()=>({checked:E,disabled:a,hover:P,focus:w,active:D,indeterminate:p,changing:F,autofocus:l}),[E,p,a,P,w,D,F,l]),W=o.useCallback(()=>{if(S!==void 0)return x?.(S)},[x,S]),z=he();return Z.createElement(Z.Fragment,null,g!=null&&Z.createElement(Zs,{disabled:a,data:{[g]:u||"on"},overrides:{type:"checkbox",checked:E},form:m,onReset:W}),z({ourProps:B,theirProps:y,slot:G,defaultTag:Ld,name:"Checkbox"}))}let Hd=le($d),_d=o.createContext(()=>{});function Eo({value:e,children:n}){return Z.createElement(_d.Provider,{value:e},n)}function At(e,n,t){let r=t.initialDeps??[],s;function i(){var a,l,c,f;let h;t.key&&((a=t.debug)!=null&&a.call(t))&&(h=Date.now());const g=e();if(!(g.length!==r.length||g.some((p,v)=>r[v]!==p)))return s;r=g;let m;if(t.key&&((l=t.debug)!=null&&l.call(t))&&(m=Date.now()),s=n(...g),t.key&&((c=t.debug)!=null&&c.call(t))){const p=Math.round((Date.now()-h)*100)/100,v=Math.round((Date.now()-m)*100)/100,y=v/16,S=(E,x)=>{for(E=String(E);E.length<x;)E=" "+E;return E};console.info(`%c⏱ ${S(v,5)} /${S(p,5)} ms`,`
|
|
11
11
|
font-size: .6rem;
|
|
12
12
|
font-weight: bold;
|
|
13
13
|
color: hsl(${Math.max(0,Math.min(120-120*y,120))}deg 100% 31%);`,t?.key)}return(f=t?.onChange)==null||f.call(t,s),s}return i.updateDeps=a=>{r=a},i}function Bi(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const Bd=(e,n)=>Math.abs(e-n)<1.01,Zd=(e,n,t)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>n.apply(this,s),t)}},Zi=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},zd=e=>e,Ud=e=>{const n=Math.max(e.startIndex-e.overscan,0),t=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let s=n;s<=t;s++)r.push(s);return r},Gd=(e,n)=>{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;const s=a=>{const{width:l,height:c}=a;n({width:Math.round(l),height:Math.round(c)})};if(s(Zi(t)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(a=>{const l=()=>{const c=a[0];if(c?.borderBoxSize){const f=c.borderBoxSize[0];if(f){s({width:f.inlineSize,height:f.blockSize});return}}s(Zi(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},zi={passive:!0},Ui=typeof window>"u"?!0:"onscrollend"in window,qd=(e,n)=>{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;let s=0;const i=e.options.useScrollendEvent&&Ui?()=>{}:Zd(r,()=>{n(s,!1)},e.options.isScrollingResetDelay),a=h=>()=>{const{horizontal:g,isRtl:u}=e.options;s=g?t.scrollLeft*(u&&-1||1):t.scrollTop,i(),n(s,h)},l=a(!0),c=a(!1);c(),t.addEventListener("scroll",l,zi);const f=e.options.useScrollendEvent&&Ui;return f&&t.addEventListener("scrollend",c,zi),()=>{t.removeEventListener("scroll",l),f&&t.removeEventListener("scrollend",c)}},Kd=(e,n,t)=>{if(n?.borderBoxSize){const r=n.borderBoxSize[0];if(r)return Math.round(r[t.options.horizontal?"inlineSize":"blockSize"])}return e[t.options.horizontal?"offsetWidth":"offsetHeight"]},Wd=(e,{adjustments:n=0,behavior:t},r)=>{var s,i;const a=e+n;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:a,behavior:t})};class Yd{constructor(n){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,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 t=null;const r=()=>t||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:t=new this.targetWindow.ResizeObserver(s=>{s.forEach(i=>{const a=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(a):a()})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),t=null},observe:s=>{var i;return(i=r())==null?void 0:i.observe(s,{box:"border-box"})},unobserve:s=>{var i;return(i=r())==null?void 0:i.unobserve(s)}}})(),this.range=null,this.setOptions=t=>{Object.entries(t).forEach(([r,s])=>{typeof s>"u"&&delete t[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:zd,rangeExtractor:Ud,onChange:()=>{},measureElement:Kd,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,...t}},this.notify=t=>{var r,s;(s=(r=this.options).onChange)==null||s.call(r,this,t)},this.maybeNotify=At(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),t=>{this.notify(t)},{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(t=>t()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var t;const r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((t=this.scrollElement)==null?void 0:t.window)??null,this.elementsCache.forEach(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,i)=>{this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,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=(t,r)=>{const s=new Map,i=new Map;for(let a=r-1;a>=0;a--){const l=t[a];if(s.has(l.lane))continue;const c=i.get(l.lane);if(c==null||l.end>c.end?i.set(l.lane,l):l.end<c.end&&s.set(l.lane,!0),s.size===this.options.lanes)break}return i.size===this.options.lanes?Array.from(i.values()).sort((a,l)=>a.end===l.end?a.index-l.index:a.end-l.end)[0]:void 0},this.getMeasurementOptions=At(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(t,r,s,i,a)=>(this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a}),{key:!1}),this.getMeasurements=At(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:a},l)=>{if(!a)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 f=this.measurementsCache.slice(0,c);for(let h=c;h<t;h++){const g=i(h),u=this.options.lanes===1?f[h-1]:this.getFurthestMeasurement(f,h),m=u?u.end+this.options.gap:r+s,p=l.get(g),v=typeof p=="number"?p:this.options.estimateSize(h),y=m+v,S=u?u.lane:h%this.options.lanes;f[h]={index:h,start:m,size:v,end:y,key:g,lane:S}}return this.measurementsCache=f,f},{key:!1,debug:()=>this.options.debug}),this.calculateRange=At(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,i)=>this.range=t.length>0&&r>0?Qd({measurements:t,outerSize:r,scrollOffset:s,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=At(()=>{let t=null,r=null;const s=this.calculateRange();return s&&(t=s.startIndex,r=s.endIndex),this.maybeNotify.updateDeps([this.isScrolling,t,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,t,r]},(t,r,s,i,a)=>i===null||a===null?[]:t({startIndex:i,endIndex:a,overscan:r,count:s}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=t=>{const r=this.options.indexAttribute,s=t.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(t,r)=>{const s=this.indexFromElement(t),i=this.measurementsCache[s];if(!i)return;const a=i.key,l=this.elementsCache.get(a);l!==t&&(l&&this.observer.unobserve(l),this.observer.observe(t),this.elementsCache.set(a,t)),t.isConnected&&this.resizeItem(s,this.options.measureElement(t,r,this))},this.resizeItem=(t,r)=>{const s=this.measurementsCache[t];if(!s)return;const i=this.itemSizeCache.get(s.key)??s.size,a=r-i;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,a,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=t=>{if(!t){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(t,void 0)},this.getVirtualItems=At(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let i=0,a=t.length;i<a;i++){const l=t[i],c=r[l];s.push(c)}return s},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=t=>{const r=this.getMeasurements();if(r.length!==0)return Bi(r[So(0,r.length-1,s=>Bi(r[s]).start,t)])},this.getOffsetForAlignment=(t,r,s=0)=>{const i=this.getSize(),a=this.getScrollOffset();r==="auto"&&(r=t>=a+i?"end":"start"),r==="center"?t+=(s-i)/2:r==="end"&&(t-=i);const l=this.getTotalSize()+this.options.scrollMargin-i;return Math.max(Math.min(l,t),0)},this.getOffsetForIndex=(t,r="auto")=>{t=Math.max(0,Math.min(t,this.options.count-1));const s=this.measurementsCache[t];if(!s)return;const i=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(s.end>=a+i-this.options.scrollPaddingEnd)r="end";else if(s.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const l=r==="end"?s.end+this.options.scrollPaddingEnd:s.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(l,r,s.size),r]},this.isDynamicMode=()=>this.elementsCache.size>0,this.scrollToOffset=(t,{align:r="start",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(t,r),{adjustments:void 0,behavior:s})},this.scrollToIndex=(t,{align:r="auto",behavior:s}={})=>{s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),t=Math.max(0,Math.min(t,this.options.count-1));let i=0;const a=10,l=f=>{if(!this.targetWindow)return;const h=this.getOffsetForIndex(t,f);if(!h){console.warn("Failed to get offset for index:",t);return}const[g,u]=h;this._scrollToOffset(g,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const m=this.getScrollOffset(),p=this.getOffsetForIndex(t,u);if(!p){console.warn("Failed to get offset for index:",t);return}Bd(p[0],m)||c(u)})},c=f=>{this.targetWindow&&(i++,i<a?this.targetWindow.requestAnimationFrame(()=>l(f)):console.warn(`Failed to scroll to index ${t} after ${a} attempts.`))};l(r)},this.scrollBy=(t,{behavior:r}={})=>{r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+t,{adjustments:void 0,behavior:r})},this.getTotalSize=()=>{var t;const r=this.getMeasurements();let s;if(r.length===0)s=this.options.paddingStart;else if(this.options.lanes===1)s=((t=r[r.length-1])==null?void 0:t.end)??0;else{const i=Array(this.options.lanes).fill(null);let a=r.length-1;for(;a>=0&&i.some(l=>l===null);){const l=r[a];i[l.lane]===null&&(i[l.lane]=l.end),a--}s=Math.max(...i.filter(l=>l!==null))}return Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(t,{adjustments:r,behavior:s})=>{this.options.scrollToFn(t,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(n)}}const So=(e,n,t,r)=>{for(;e<=n;){const s=(e+n)/2|0,i=t(s);if(i<r)e=s+1;else if(i>r)n=s-1;else return s}return e>0?e-1:0};function Qd({measurements:e,outerSize:n,scrollOffset:t,lanes:r}){const s=e.length-1,i=c=>e[c].start;if(e.length<=r)return{startIndex:0,endIndex:s};let a=So(0,s,i,t),l=a;if(r===1)for(;l<s&&e[l].end<t+n;)l++;else if(r>1){const c=Array(r).fill(0);for(;l<s&&c.some(h=>h<t+n);){const h=e[l];c[h.lane]=h.end,l++}const f=Array(r).fill(t+n);for(;a>=0&&f.some(h=>h>=t);){const h=e[a];f[h.lane]=h.start,a--}a=Math.max(0,a-a%r),l=Math.min(s,l+(r-1-l%r))}return{startIndex:a,endIndex:l}}const Gi=typeof document<"u"?o.useLayoutEffect:o.useEffect;function Xd(e){const n=o.useReducer(()=>({}),{})[1],t={...e,onChange:(s,i)=>{var a;i?Ce.flushSync(n):n(),(a=e.onChange)==null||a.call(e,s,i)}},[r]=o.useState(()=>new Yd(t));return r.setOptions(t),Gi(()=>r._didMount(),[]),Gi(()=>r._willUpdate()),r}function Jd(e){return Xd({observeElementRect:Gd,observeElementOffset:qd,scrollToFn:Wd,...e})}function ef(e,n){return e!==null&&n!==null&&typeof e=="object"&&typeof n=="object"&&"id"in e&&"id"in n?e.id===n.id:e===n}function ko(e=ef){return o.useCallback((n,t)=>{if(typeof e=="string"){let r=e;return n?.[r]===t?.[r]}return e(n,t)},[e])}function zs(e,n,t,r){let s=dr(t);o.useEffect(()=>{e=e??window;function i(a){s.current(a)}return e.addEventListener(n,i,r),()=>e.removeEventListener(n,i,r)},[e,n,r])}function Mo(e){let n=o.useRef({value:"",selectionStart:null,selectionEnd:null});return zs(e,"blur",t=>{let r=t.target;Mi(r)&&(n.current={value:r.value,selectionStart:r.selectionStart,selectionEnd:r.selectionEnd})}),K(()=>{if(document.activeElement!==e&&Mi(e)&&e.isConnected){if(e.focus({preventScroll:!0}),e.value!==n.current.value)e.setSelectionRange(e.value.length,e.value.length);else{let{selectionStart:t,selectionEnd:r}=n.current;t!==null&&r!==null&&e.setSelectionRange(t,r)}n.current={value:"",selectionStart:null,selectionEnd:null}}})}function pn(e,n){let t=o.useRef([]),r=K(e);o.useEffect(()=>{let s=[...t.current];for(let[i,a]of n.entries())if(t.current[i]!==a){let l=r(n,s);return t.current=n,l}},[r,...n])}function tf({children:e,freeze:n}){let t=Jn(n,e);return Z.createElement(Z.Fragment,null,t)}function Jn(e,n){let[t,r]=o.useState(n);return!e&&t!==n&&r(n),e?t:n}function nf(e){function n(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",n))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",n),n())}let Ue=[];nf(()=>{function e(n){if(!un(n.target)||n.target===document.body||Ue[0]===n.target)return;let t=n.target;t=t.closest(uc),Ue.unshift(t??n.target),Ue=Ue.filter(r=>r!=null&&r.isConnected),Ue.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 rf=Object.defineProperty,sf=(e,n,t)=>n in e?rf(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,qi=(e,n,t)=>(sf(e,typeof n!="symbol"?n+"":n,t),t),re=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(re||{}),Ae=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ae||{}),qe=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(qe||{}),Co=(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))(Co||{});function _r(e,n=t=>t){let t=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=n(e.options.slice()),s=r.length>0&&r[0].dataRef.current.order!==null?r.sort((a,l)=>a.dataRef.current.order-l.dataRef.current.order):Sa(r,a=>a.dataRef.current.domRef.current),i=t?s.indexOf(t):null;return i===-1&&(i=null),{options:s,activeOptionIndex:i}}let af={1(e){var n;return(n=e.dataRef.current)!=null&&n.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1,isTyping:!1,activationTrigger:2,__demoMode:!1}},0(e){var n,t;if((n=e.dataRef.current)!=null&&n.disabled||e.comboboxState===0)return e;if((t=e.dataRef.current)!=null&&t.value){let r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0,__demoMode:!1}}return{...e,comboboxState:0,__demoMode:!1}},3(e,n){return e.isTyping===n.isTyping?e:{...e,isTyping:n.isTyping}},2(e,n){var t,r,s,i;if((t=e.dataRef.current)!=null&&t.disabled||e.optionsElement&&!((r=e.dataRef.current)!=null&&r.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let{options:f,disabled:h}=e.virtual,g=n.focus===ne.Specific?n.idx:Nt(n,{resolveItems:()=>f,resolveActiveIndex:()=>{var m,p;return(p=(m=e.activeOptionIndex)!=null?m:f.findIndex(v=>!h(v)))!=null?p:null},resolveDisabled:h,resolveId(){throw new Error("Function not implemented.")}}),u=(s=n.trigger)!=null?s:2;return e.activeOptionIndex===g&&e.activationTrigger===u?e:{...e,activeOptionIndex:g,activationTrigger:u,isTyping:!1,__demoMode:!1}}let a=_r(e);if(a.activeOptionIndex===null){let f=a.options.findIndex(h=>!h.dataRef.current.disabled);f!==-1&&(a.activeOptionIndex=f)}let l=n.focus===ne.Specific?n.idx:Nt(n,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled}),c=(i=n.trigger)!=null?i:2;return e.activeOptionIndex===l&&e.activationTrigger===c?e:{...e,...a,isTyping:!1,activeOptionIndex:l,activationTrigger:c,__demoMode:!1}},4:(e,n)=>{var t,r,s,i;if((t=e.dataRef.current)!=null&&t.virtual)return{...e,options:[...e.options,n.payload]};let a=n.payload,l=_r(e,f=>(f.push(a),f));e.activeOptionIndex===null&&(s=(r=e.dataRef.current).isSelected)!=null&&s.call(r,n.payload.dataRef.current.value)&&(l.activeOptionIndex=l.options.indexOf(a));let c={...e,...l,activationTrigger:2};return(i=e.dataRef.current)!=null&&i.__demoMode&&e.dataRef.current.value===void 0&&(c.activeOptionIndex=0),c},5:(e,n)=>{var t;if((t=e.dataRef.current)!=null&&t.virtual)return{...e,options:e.options.filter(s=>s.id!==n.id)};let r=_r(e,s=>{let i=s.findIndex(a=>a.id===n.id);return i!==-1&&s.splice(i,1),s});return{...e,...r,activationTrigger:2}},6:(e,n)=>e.defaultToFirstOption===n.value?e:{...e,defaultToFirstOption:n.value},7:(e,n)=>e.activationTrigger===n.trigger?e:{...e,activationTrigger:n.trigger},8:(e,n)=>{var t,r;if(e.virtual===null)return{...e,virtual:{options:n.options,disabled:(t=n.disabled)!=null?t:()=>!1}};if(e.virtual.options===n.options&&e.virtual.disabled===n.disabled)return e;let s=e.activeOptionIndex;if(e.activeOptionIndex!==null){let i=n.options.indexOf(e.virtual.options[e.activeOptionIndex]);i!==-1?s=i:s=null}return{...e,activeOptionIndex:s,virtual:{options:n.options,disabled:(r=n.disabled)!=null?r:()=>!1}}},9:(e,n)=>e.inputElement===n.element?e:{...e,inputElement:n.element},10:(e,n)=>e.buttonElement===n.element?e:{...e,buttonElement:n.element},11:(e,n)=>e.optionsElement===n.element?e:{...e,optionsElement:n.element}},of=class To extends wa{constructor(n){super(n),qi(this,"actions",{onChange:t=>{let{onChange:r,compare:s,mode:i,value:a}=this.state.dataRef.current;return ye(i,{0:()=>r?.(t),1:()=>{let l=a.slice(),c=l.findIndex(f=>s(f,t));return c===-1?l.push(t):l.splice(c,1),r?.(l)}})},registerOption:(t,r)=>(this.send({type:4,payload:{id:t,dataRef:r}}),()=>{this.state.activeOptionIndex===this.state.dataRef.current.calculateIndex(r.current.value)&&this.send({type:6,value:!0}),this.send({type:5,id:t})}),goToOption:(t,r)=>(this.send({type:6,value:!1}),this.send({type:2,...t,trigger:r})),setIsTyping:t=>{this.send({type:3,isTyping:t})},closeCombobox:()=>{var t,r;this.send({type:1}),this.send({type:6,value:!1}),(r=(t=this.state.dataRef.current).onClose)==null||r.call(t)},openCombobox:()=>{this.send({type:0}),this.send({type:6,value:!0})},setActivationTrigger:t=>{this.send({type:7,trigger:t})},selectActiveOption:()=>{let t=this.selectors.activeOptionIndex(this.state);if(t!==null){if(this.actions.setIsTyping(!1),this.state.virtual)this.actions.onChange(this.state.virtual.options[t]);else{let{dataRef:r}=this.state.options[t];this.actions.onChange(r.current.value)}this.actions.goToOption({focus:ne.Specific,idx:t})}},setInputElement:t=>{this.send({type:9,element:t})},setButtonElement:t=>{this.send({type:10,element:t})},setOptionsElement:t=>{this.send({type:11,element:t})}}),qi(this,"selectors",{activeDescendantId:t=>{var r,s;let i=this.selectors.activeOptionIndex(t);if(i!==null)return t.virtual?(s=t.options.find(a=>!a.dataRef.current.disabled&&t.dataRef.current.compare(a.dataRef.current.value,t.virtual.options[i])))==null?void 0:s.id:(r=t.options[i])==null?void 0:r.id},activeOptionIndex:t=>{if(t.defaultToFirstOption&&t.activeOptionIndex===null&&(t.virtual?t.virtual.options.length>0:t.options.length>0)){if(t.virtual){let{options:s,disabled:i}=t.virtual,a=s.findIndex(l=>{var c;return!((c=i?.(l))!=null&&c)});if(a!==-1)return a}let r=t.options.findIndex(s=>!s.dataRef.current.disabled);if(r!==-1)return r}return t.activeOptionIndex},activeOption:t=>{var r,s;let i=this.selectors.activeOptionIndex(t);return i===null?null:t.virtual?t.virtual.options[i??0]:(s=(r=t.options[i])==null?void 0:r.dataRef.current.value)!=null?s:null},isActive:(t,r,s)=>{var i;let a=this.selectors.activeOptionIndex(t);return a===null?!1:t.virtual?a===t.dataRef.current.calculateIndex(r):((i=t.options[a])==null?void 0:i.id)===s},shouldScrollIntoView:(t,r,s)=>!(t.virtual||t.__demoMode||t.comboboxState!==0||t.activationTrigger===0||!this.selectors.isActive(t,r,s))});{let t=this.state.id,r=bn.get(null);this.disposables.add(r.on(Ea.Push,s=>{!r.selectors.isTop(s,t)&&this.state.comboboxState===0&&this.actions.closeCombobox()})),this.on(0,()=>r.actions.push(t)),this.on(1,()=>r.actions.pop(t))}}static new({id:n,virtual:t=null,__demoMode:r=!1}){var s;return new To({id:n,dataRef:{current:{}},comboboxState:r?0:1,isTyping:!1,options:[],virtual:t?{options:t.options,disabled:(s=t.disabled)!=null?s:()=>!1}:null,activeOptionIndex:null,activationTrigger:2,inputElement:null,buttonElement:null,optionsElement:null,__demoMode:r})}reduce(n,t){return ye(t.type,af,n,t)}};const Fo=o.createContext(null);function En(e){let n=o.useContext(Fo);if(n===null){let t=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Oo),t}return n}function Oo({id:e,virtual:n=null,__demoMode:t=!1}){let r=o.useMemo(()=>of.new({id:e,virtual:n,__demoMode:t}),[]);return Ss(()=>r.dispose()),r}let mn=o.createContext(null);mn.displayName="ComboboxDataContext";function Yt(e){let n=o.useContext(mn);if(n===null){let t=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Yt),t}return n}let Ro=o.createContext(null);function lf(e){let n=En("VirtualProvider"),t=Yt("VirtualProvider"),{options:r}=t.virtual,s=ae(n,m=>m.optionsElement),[i,a]=o.useMemo(()=>{let m=s;if(!m)return[0,0];let p=window.getComputedStyle(m);return[parseFloat(p.paddingBlockStart||p.paddingTop),parseFloat(p.paddingBlockEnd||p.paddingBottom)]},[s]),l=Jd({enabled:r.length!==0,scrollPaddingStart:i,scrollPaddingEnd:a,count:r.length,estimateSize(){return 40},getScrollElement(){return n.state.optionsElement},overscan:12}),[c,f]=o.useState(0);Ee(()=>{f(m=>m+1)},[r]);let h=l.getVirtualItems(),g=ae(n,m=>m.activationTrigger===qe.Pointer),u=ae(n,n.selectors.activeOptionIndex);return h.length===0?null:Z.createElement(Ro.Provider,{value:l},Z.createElement("div",{style:{position:"relative",width:"100%",height:`${l.getTotalSize()}px`},ref:m=>{m&&(g||u!==null&&r.length>u&&l.scrollToIndex(u))}},h.map(m=>{var p;return Z.createElement(o.Fragment,{key:m.key},Z.cloneElement((p=e.children)==null?void 0:p.call(e,{...e.slot,option:r[m.index]}),{key:`${c}-${m.key}`,"data-index":m.index,"aria-setsize":r.length,"aria-posinset":m.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${m.start}px)`,overflowAnchor:"none"}}))})))}let cf=o.Fragment;function uf(e,n){let t=o.useId(),r=or(),{value:s,defaultValue:i,onChange:a,form:l,name:c,by:f,invalid:h=!1,disabled:g=r||!1,onClose:u,__demoMode:m=!1,multiple:p=!1,immediate:v=!1,virtual:y=null,nullable:S,...E}=e,x=Bs(i),[M=p?[]:void 0,V]=_s(s,a,x),b=Oo({id:t,virtual:y,__demoMode:m}),F=o.useRef({static:!1,hold:!1}),k=ko(f),N=K(L=>y?f===null?y.options.indexOf(L):y.options.findIndex(H=>k(H,L)):b.state.options.findIndex(H=>k(H.dataRef.current.value,L))),T=o.useCallback(L=>ye(w.mode,{[Ae.Multi]:()=>M.some(H=>k(H,L)),[Ae.Single]:()=>k(M,L)}),[M]),R=ae(b,L=>L.virtual),C=K(()=>u?.()),w=o.useMemo(()=>({__demoMode:m,immediate:v,optionsPropsRef:F,value:M,defaultValue:x,disabled:g,invalid:h,mode:p?Ae.Multi:Ae.Single,virtual:y?R:null,onChange:V,isSelected:T,calculateIndex:N,compare:k,onClose:C}),[M,x,g,h,p,V,T,m,b,y,R,C]);Ee(()=>{var L;y&&b.send({type:Co.UpdateVirtualConfiguration,options:y.options,disabled:(L=y.disabled)!=null?L:null})},[y,y?.options,y?.disabled]),Ee(()=>{b.state.dataRef.current=w},[w]);let[A,P,q,D]=ae(b,L=>[L.comboboxState,L.buttonElement,L.inputElement,L.optionsElement]),j=bn.get(null),B=ae(j,o.useCallback(L=>j.selectors.isTop(L,t),[j,t]));Rs(B,[P,q,D],()=>b.actions.closeCombobox());let G=ae(b,b.selectors.activeOptionIndex),W=ae(b,b.selectors.activeOption),z=o.useMemo(()=>({open:A===re.Open,disabled:g,invalid:h,activeIndex:G,activeOption:W,value:M}),[w,g,M,h,W,A]),[$,_]=Ia(),X=n===null?{}:{ref:n},I=o.useCallback(()=>{if(x!==void 0)return V?.(x)},[V,x]),O=he();return Z.createElement(_,{value:$,props:{htmlFor:q?.id},slot:{open:A===re.Open,disabled:g}},Z.createElement(Aa,null,Z.createElement(mn.Provider,{value:w},Z.createElement(Fo.Provider,{value:b},Z.createElement(pr,{value:ye(A,{[re.Open]:ge.Open,[re.Closed]:ge.Closed})},c!=null&&Z.createElement(Zs,{disabled:g,data:M!=null?{[c]:M}:{},form:l,onReset:I}),O({ourProps:X,theirProps:E,slot:z,defaultTag:cf,name:"Combobox"}))))))}let df="input";function ff(e,n){var t,r;let s=En("Combobox.Input"),i=Yt("Combobox.Input"),a=o.useId(),l=ar(),{id:c=l||`headlessui-combobox-input-${a}`,onChange:f,displayValue:h,disabled:g=i.disabled||!1,autoFocus:u=!1,type:m="text",...p}=e,[v]=ae(s,_=>[_.inputElement]),y=o.useRef(null),S=Se(y,n,ka(),s.actions.setInputElement),E=dt(v),[x,M]=ae(s,_=>[_.comboboxState,_.isTyping]),V=Gt(),b=K(()=>{s.actions.onChange(null),s.state.optionsElement&&(s.state.optionsElement.scrollTop=0),s.actions.goToOption({focus:ne.Nothing})}),F=o.useMemo(()=>{var _;return typeof h=="function"&&i.value!==void 0?(_=h(i.value))!=null?_:"":typeof i.value=="string"?i.value:""},[i.value,h]);pn(([_,X],[I,O])=>{if(s.state.isTyping)return;let L=y.current;L&&((O===re.Open&&X===re.Closed||_!==I)&&(L.value=_),requestAnimationFrame(()=>{if(s.state.isTyping||!L||E?.activeElement!==L)return;let{selectionStart:H,selectionEnd:U}=L;Math.abs((U??0)-(H??0))===0&&H===0&&L.setSelectionRange(L.value.length,L.value.length)}))},[F,x,E,M]),pn(([_],[X])=>{if(_===re.Open&&X===re.Closed){if(s.state.isTyping)return;let I=y.current;if(!I)return;let O=I.value,{selectionStart:L,selectionEnd:H,selectionDirection:U}=I;I.value="",I.value=O,U!==null?I.setSelectionRange(L,H,U):I.setSelectionRange(L,H)}},[x]);let k=o.useRef(!1),N=K(()=>{k.current=!0}),T=K(()=>{V.nextFrame(()=>{k.current=!1})}),R=K(_=>{switch(s.actions.setIsTyping(!0),_.key){case te.Enter:if(s.state.comboboxState!==re.Open||k.current)return;if(_.preventDefault(),_.stopPropagation(),s.selectors.activeOptionIndex(s.state)===null){s.actions.closeCombobox();return}s.actions.selectActiveOption(),i.mode===Ae.Single&&s.actions.closeCombobox();break;case te.ArrowDown:return _.preventDefault(),_.stopPropagation(),ye(s.state.comboboxState,{[re.Open]:()=>s.actions.goToOption({focus:ne.Next}),[re.Closed]:()=>s.actions.openCombobox()});case te.ArrowUp:return _.preventDefault(),_.stopPropagation(),ye(s.state.comboboxState,{[re.Open]:()=>s.actions.goToOption({focus:ne.Previous}),[re.Closed]:()=>{Ce.flushSync(()=>s.actions.openCombobox()),i.value||s.actions.goToOption({focus:ne.Last})}});case te.Home:if(_.shiftKey)break;return _.preventDefault(),_.stopPropagation(),s.actions.goToOption({focus:ne.First});case te.PageUp:return _.preventDefault(),_.stopPropagation(),s.actions.goToOption({focus:ne.First});case te.End:if(_.shiftKey)break;return _.preventDefault(),_.stopPropagation(),s.actions.goToOption({focus:ne.Last});case te.PageDown:return _.preventDefault(),_.stopPropagation(),s.actions.goToOption({focus:ne.Last});case te.Escape:return s.state.comboboxState!==re.Open?void 0:(_.preventDefault(),s.state.optionsElement&&!i.optionsPropsRef.current.static&&_.stopPropagation(),i.mode===Ae.Single&&i.value===null&&b(),s.actions.closeCombobox());case te.Tab:if(s.state.comboboxState!==re.Open)return;i.mode===Ae.Single&&s.state.activationTrigger!==qe.Focus&&s.actions.selectActiveOption(),s.actions.closeCombobox();break}}),C=K(_=>{f?.(_),i.mode===Ae.Single&&_.target.value===""&&b(),s.actions.openCombobox()}),w=K(_=>{var X,I,O;let L=(X=_.relatedTarget)!=null?X:Ue.find(H=>H!==_.currentTarget);if(!((I=s.state.optionsElement)!=null&&I.contains(L))&&!((O=s.state.buttonElement)!=null&&O.contains(L))&&s.state.comboboxState===re.Open)return _.preventDefault(),i.mode===Ae.Single&&i.value===null&&b(),s.actions.closeCombobox()}),A=K(_=>{var X,I,O;let L=(X=_.relatedTarget)!=null?X:Ue.find(H=>H!==_.currentTarget);(I=s.state.buttonElement)!=null&&I.contains(L)||(O=s.state.optionsElement)!=null&&O.contains(L)||i.disabled||i.immediate&&s.state.comboboxState!==re.Open&&V.microTask(()=>{Ce.flushSync(()=>s.actions.openCombobox()),s.actions.setActivationTrigger(qe.Focus)})}),P=qt(),q=lr(),{isFocused:D,focusProps:j}=Kt({autoFocus:u}),{isHovered:B,hoverProps:G}=Wt({isDisabled:g}),W=ae(s,_=>_.optionsElement),z=o.useMemo(()=>({open:x===re.Open,disabled:g,invalid:i.invalid,hover:B,focus:D,autofocus:u}),[i,B,D,u,g,i.invalid]),$=rt({ref:S,id:c,role:"combobox",type:m,"aria-controls":W?.id,"aria-expanded":x===re.Open,"aria-activedescendant":ae(s,s.selectors.activeDescendantId),"aria-labelledby":P,"aria-describedby":q,"aria-autocomplete":"list",defaultValue:(r=(t=e.defaultValue)!=null?t:i.defaultValue!==void 0?h?.(i.defaultValue):null)!=null?r:i.defaultValue,disabled:g||void 0,autoFocus:u,onCompositionStart:N,onCompositionEnd:T,onKeyDown:R,onChange:C,onFocus:A,onBlur:w},j,G);return he()({ourProps:$,theirProps:p,slot:z,defaultTag:df,name:"Combobox.Input"})}let hf="button";function pf(e,n){let t=En("Combobox.Button"),r=Yt("Combobox.Button"),[s,i]=o.useState(null),a=Se(n,i,t.actions.setButtonElement),l=o.useId(),{id:c=`headlessui-combobox-button-${l}`,disabled:f=r.disabled||!1,autoFocus:h=!1,...g}=e,[u,m,p]=ae(t,C=>[C.comboboxState,C.inputElement,C.optionsElement]),v=Mo(m),y=u===re.Open;Ma(y,{trigger:s,action:o.useCallback(C=>{if(s!=null&&s.contains(C.target))return Qe.Ignore;if(m!=null&&m.contains(C.target))return Qe.Ignore;let w=C.target.closest('[role="option"]:not([data-disabled])');return Bt(w)?Qe.Select(w):p!=null&&p.contains(C.target)?Qe.Ignore:Qe.Close},[s,m,p]),close:t.actions.closeCombobox,select:t.actions.selectActiveOption});let S=K(C=>{switch(C.key){case te.Space:case te.Enter:C.preventDefault(),C.stopPropagation(),t.state.comboboxState===re.Closed&&Ce.flushSync(()=>t.actions.openCombobox()),v();return;case te.ArrowDown:C.preventDefault(),C.stopPropagation(),t.state.comboboxState===re.Closed&&(Ce.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:ne.First})),v();return;case te.ArrowUp:C.preventDefault(),C.stopPropagation(),t.state.comboboxState===re.Closed&&(Ce.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:ne.Last})),v();return;case te.Escape:if(t.state.comboboxState!==re.Open)return;C.preventDefault(),t.state.optionsElement&&!r.optionsPropsRef.current.static&&C.stopPropagation(),Ce.flushSync(()=>t.actions.closeCombobox()),v();return;default:return}}),E=K(C=>{C.preventDefault(),!cr(C.currentTarget)&&(C.button===ks.Left&&(t.state.comboboxState===re.Open?t.actions.closeCombobox():t.actions.openCombobox()),v())}),x=qt([c]),{isFocusVisible:M,focusProps:V}=Kt({autoFocus:h}),{isHovered:b,hoverProps:F}=Wt({isDisabled:f}),{pressed:k,pressProps:N}=ur({disabled:f}),T=o.useMemo(()=>({open:u===re.Open,active:k||u===re.Open,disabled:f,invalid:r.invalid,value:r.value,hover:b,focus:M}),[r,b,M,k,f,u]),R=rt({ref:a,id:c,type:Ms(e,s),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":p?.id,"aria-expanded":u===re.Open,"aria-labelledby":x,disabled:f||void 0,autoFocus:h,onPointerDown:E,onKeyDown:S},V,F,N);return he()({ourProps:R,theirProps:g,slot:T,defaultTag:hf,name:"Combobox.Button"})}let mf="div",gf=st.RenderStrategy|st.Static;function vf(e,n){var t,r,s;let i=o.useId(),{id:a=`headlessui-combobox-options-${i}`,hold:l=!1,anchor:c,portal:f=!1,modal:h=!0,transition:g=!1,...u}=e,m=En("Combobox.Options"),p=Yt("Combobox.Options"),v=Ca(c);v&&(f=!0);let[y,S]=Ta(v),[E,x]=o.useState(null),M=Fa(),V=Se(n,v?y:null,m.actions.setOptionsElement,x),[b,F,k,N,T]=ae(m,U=>[U.comboboxState,U.inputElement,U.buttonElement,U.optionsElement,U.activationTrigger]),R=dt(F||k),C=dt(N),w=Ct(),[A,P]=fr(g,E,w!==null?(w&ge.Open)===ge.Open:b===re.Open);Cs(A,F,m.actions.closeCombobox);let q=p.__demoMode?!1:h&&b===re.Open;Ts(q,C);let D=p.__demoMode?!1:h&&b===re.Open;Fs(D,{allowed:o.useCallback(()=>[F,k,N],[F,k,N])}),Ee(()=>{var U;p.optionsPropsRef.current.static=(U=e.static)!=null?U:!1},[p.optionsPropsRef,e.static]),Ee(()=>{p.optionsPropsRef.current.hold=l},[p.optionsPropsRef,l]),dc(b===re.Open,{container:N,accept(U){return U.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:U.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(U){U.setAttribute("role","none")}});let j=qt([k?.id]),B=o.useMemo(()=>({open:b===re.Open,option:void 0}),[b]),G=K(()=>{m.actions.setActivationTrigger(qe.Pointer)}),W=K(U=>{U.preventDefault(),m.actions.setActivationTrigger(qe.Pointer)}),z=rt(v?M():{},{"aria-labelledby":j,role:"listbox","aria-multiselectable":p.mode===Ae.Multi?!0:void 0,id:a,ref:V,style:{...u.style,...S,"--input-width":Wr(F,!0).width,"--button-width":Wr(k,!0).width},onWheel:T===qe.Pointer?void 0:G,onMouseDown:W,...hr(P)}),$=A&&b===re.Closed,_=Jn($,(t=p.virtual)==null?void 0:t.options),X=Jn($,p.value),I=K(U=>p.compare(X,U)),O=o.useMemo(()=>{if(!p.virtual)return p;if(_===void 0)throw new Error("Missing `options` in virtual mode");return _!==p.virtual.options?{...p,virtual:{...p.virtual,options:_}}:p},[p,_,(r=p.virtual)==null?void 0:r.options]);p.virtual&&Object.assign(u,{children:Z.createElement(mn.Provider,{value:O},Z.createElement(lf,{slot:B},u.children))});let L=he(),H=o.useMemo(()=>p.mode===Ae.Multi?p:{...p,isSelected:I},[p,I]);return Z.createElement(Os,{enabled:f?e.static||A:!1,ownerDocument:R},Z.createElement(mn.Provider,{value:H},L({ourProps:z,theirProps:{...u,children:Z.createElement(tf,{freeze:$},typeof u.children=="function"?(s=u.children)==null?void 0:s.call(u,B):u.children)},slot:B,defaultTag:mf,features:gf,visible:A,name:"Combobox.Options"})))}let yf="div";function bf(e,n){var t,r,s;let i=Yt("Combobox.Option"),a=En("Combobox.Option"),l=o.useId(),{id:c=`headlessui-combobox-option-${l}`,value:f,disabled:h=(s=(r=(t=i.virtual)==null?void 0:t.disabled)==null?void 0:r.call(t,f))!=null?s:!1,order:g=null,...u}=e,[m]=ae(a,P=>[P.inputElement]),p=Mo(m),v=ae(a,o.useCallback(P=>a.selectors.isActive(P,f,c),[f,c])),y=i.isSelected(f),S=o.useRef(null),E=dr({disabled:h,value:f,domRef:S,order:g}),x=o.useContext(Ro),M=Se(n,S,x?x.measureElement:null),V=K(()=>{a.actions.setIsTyping(!1),a.actions.onChange(f)});Ee(()=>a.actions.registerOption(c,E),[E,c]);let b=ae(a,o.useCallback(P=>a.selectors.shouldScrollIntoView(P,f,c),[f,c]));Ee(()=>{if(b)return Oa().requestAnimationFrame(()=>{var P,q;(q=(P=S.current)==null?void 0:P.scrollIntoView)==null||q.call(P,{block:"nearest"})})},[b,S]);let F=K(P=>{P.preventDefault(),P.button===ks.Left&&(h||(V(),fc()||requestAnimationFrame(()=>p()),i.mode===Ae.Single&&a.actions.closeCombobox()))}),k=K(()=>{if(h)return a.actions.goToOption({focus:ne.Nothing});let P=i.calculateIndex(f);a.actions.goToOption({focus:ne.Specific,idx:P})}),N=Ra(),T=K(P=>N.update(P)),R=K(P=>{if(!N.wasMoved(P)||h||v&&a.state.activationTrigger===qe.Pointer)return;let q=i.calculateIndex(f);a.actions.goToOption({focus:ne.Specific,idx:q},qe.Pointer)}),C=K(P=>{N.wasMoved(P)&&(h||v&&(i.optionsPropsRef.current.hold||a.state.activationTrigger===qe.Pointer&&a.actions.goToOption({focus:ne.Nothing})))}),w=o.useMemo(()=>({active:v,focus:v,selected:y,disabled:h}),[v,y,h]),A={id:c,ref:M,role:"option",tabIndex:h===!0?void 0:-1,"aria-disabled":h===!0?!0:void 0,"aria-selected":y,disabled:void 0,onMouseDown:F,onFocus:k,onPointerEnter:T,onMouseEnter:T,onPointerMove:R,onMouseMove:R,onPointerLeave:C,onMouseLeave:C};return he()({ourProps:A,theirProps:u,slot:w,defaultTag:yf,name:"Combobox.Option"})}let xf=le(uf),Us=le(pf),Gs=le(ff),wf=xn,qs=le(vf),gn=le(bf),Io=Object.assign(xf,{Input:Gs,Button:Us,Label:wf,Options:qs,Option:gn});function Ef(e,n=typeof document<"u"?document.defaultView:null,t){let r=Is(e,"escape");zs(n,"keydown",s=>{r&&(s.defaultPrevented||s.key===te.Escape&&t(s))})}function Sf(){var e;let[n]=o.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[t,r]=o.useState((e=n?.matches)!=null?e:!1);return Ee(()=>{if(!n)return;function s(i){r(i.matches)}return n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[n]),t}function kf({defaultContainers:e=[],portals:n,mainTreeNode:t}={}){let r=dt(t),s=K(()=>{var i,a;let l=[];for(let c of e)c!==null&&(an(c)?l.push(c):"current"in c&&an(c.current)&&l.push(c.current));if(n!=null&&n.current)for(let c of n.current)l.push(c);for(let c of(i=r?.querySelectorAll("html > *, body > *"))!=null?i:[])c!==document.body&&c!==document.head&&an(c)&&c.id!=="headlessui-portal-root"&&(t&&(c.contains(t)||c.contains((a=t?.getRootNode())==null?void 0:a.host))||l.some(f=>c.contains(f))||l.push(c));return l});return{resolveContainers:s,contains:K(i=>s().some(a=>a.contains(i)))}}let Ao=o.createContext(null);function Ki({children:e,node:n}){let[t,r]=o.useState(null),s=Vo(n??t);return Z.createElement(Ao.Provider,{value:s},e,s===null&&Z.createElement(hn,{features:Ut.Hidden,ref:i=>{var a,l;if(i){for(let c of(l=(a=As(i))==null?void 0:a.querySelectorAll("html > *, body > *"))!=null?l:[])if(c!==document.body&&c!==document.head&&an(c)&&c!=null&&c.contains(i)){r(c);break}}}}))}function Vo(e=null){var n;return(n=o.useContext(Ao))!=null?n:e}function Ks(){let e=o.useRef(!1);return Ee(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var nn=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(nn||{});function Mf(){let e=o.useRef(0);return hc(!0,"keydown",n=>{n.key==="Tab"&&(e.current=n.shiftKey?1:0)},!0),e}function Po(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let n=new Set;for(let t of e.current)an(t.current)&&n.add(t.current);return n}let Cf="div";var vt=(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))(vt||{});function Tf(e,n){let t=o.useRef(null),r=Se(t,n),{initialFocus:s,initialFocusFallback:i,containers:a,features:l=15,...c}=e;mr()||(l=0);let f=dt(t);If(l,{ownerDocument:f});let h=Af(l,{ownerDocument:f,container:t,initialFocus:s,initialFocusFallback:i});Vf(l,{ownerDocument:f,container:t,containers:a,previousActiveElement:h});let g=Mf(),u=K(E=>{if(!Bt(t.current))return;let x=t.current;(M=>M())(()=>{ye(g.current,{[nn.Forwards]:()=>{on(x,ze.First,{skipElements:[E.relatedTarget,i]})},[nn.Backwards]:()=>{on(x,ze.Last,{skipElements:[E.relatedTarget,i]})}})})}),m=Is(!!(l&2),"focus-trap#tab-lock"),p=Gt(),v=o.useRef(!1),y={ref:r,onKeyDown(E){E.key=="Tab"&&(v.current=!0,p.requestAnimationFrame(()=>{v.current=!1}))},onBlur(E){if(!(l&4))return;let x=Po(a);Bt(t.current)&&x.add(t.current);let M=E.relatedTarget;un(M)&&M.dataset.headlessuiFocusGuard!=="true"&&(jo(x,M)||(v.current?on(t.current,ye(g.current,{[nn.Forwards]:()=>ze.Next,[nn.Backwards]:()=>ze.Previous})|ze.WrapAround,{relativeTo:E.target}):un(E.target)&&et(E.target)))}},S=he();return Z.createElement(Z.Fragment,null,m&&Z.createElement(hn,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:u,features:Ut.Focusable}),S({ourProps:y,theirProps:c,defaultTag:Cf,name:"FocusTrap"}),m&&Z.createElement(hn,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:u,features:Ut.Focusable}))}let Ff=le(Tf),Of=Object.assign(Ff,{features:vt});function Rf(e=!0){let n=o.useRef(Ue.slice());return pn(([t],[r])=>{r===!0&&t===!1&&Va(()=>{n.current.splice(0)}),r===!1&&t===!0&&(n.current=Ue.slice())},[e,Ue,n]),K(()=>{var t;return(t=n.current.find(r=>r!=null&&r.isConnected))!=null?t:null})}function If(e,{ownerDocument:n}){let t=!!(e&8),r=Rf(t);pn(()=>{t||n?.activeElement===n?.body&&et(r())},[t]),Ss(()=>{t&&et(r())})}function Af(e,{ownerDocument:n,container:t,initialFocus:r,initialFocusFallback:s}){let i=o.useRef(null),a=Is(!!(e&1),"focus-trap#initial-focus"),l=Ks();return pn(()=>{if(e===0)return;if(!a){s!=null&&s.current&&et(s.current);return}let c=t.current;c&&Va(()=>{if(!l.current)return;let f=n?.activeElement;if(r!=null&&r.current){if(r?.current===f){i.current=f;return}}else if(c.contains(f)){i.current=f;return}if(r!=null&&r.current)et(r.current);else{if(e&16){if(on(c,ze.First|ze.AutoFocus)!==Ci.Error)return}else if(on(c,ze.First)!==Ci.Error)return;if(s!=null&&s.current&&(et(s.current),n?.activeElement===s.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}i.current=n?.activeElement})},[s,a,e]),i}function Vf(e,{ownerDocument:n,container:t,containers:r,previousActiveElement:s}){let i=Ks(),a=!!(e&4);zs(n?.defaultView,"focus",l=>{if(!a||!i.current)return;let c=Po(r);Bt(t.current)&&c.add(t.current);let f=s.current;if(!f)return;let h=l.target;Bt(h)?jo(c,h)?(s.current=h,et(h)):(l.preventDefault(),l.stopPropagation(),et(f)):et(s.current)},!0)}function jo(e,n){for(let t of e)if(t.contains(n))return!0;return!1}function No(e){var n;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((n=e.as)!=null?n:Lo)!==o.Fragment||Z.Children.count(e.children)===1}let br=o.createContext(null);br.displayName="TransitionContext";var Pf=(e=>(e.Visible="visible",e.Hidden="hidden",e))(Pf||{});function jf(){let e=o.useContext(br);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Nf(){let e=o.useContext(xr);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let xr=o.createContext(null);xr.displayName="NestingContext";function wr(e){return"children"in e?wr(e.children):e.current.filter(({el:n})=>n.current!==null).filter(({state:n})=>n==="visible").length>0}function Do(e,n){let t=dr(e),r=o.useRef([]),s=Ks(),i=Gt(),a=K((m,p=wt.Hidden)=>{let v=r.current.findIndex(({el:y})=>y===m);v!==-1&&(ye(p,{[wt.Unmount](){r.current.splice(v,1)},[wt.Hidden](){r.current[v].state="hidden"}}),i.microTask(()=>{var y;!wr(r)&&s.current&&((y=t.current)==null||y.call(t))}))}),l=K(m=>{let p=r.current.find(({el:v})=>v===m);return p?p.state!=="visible"&&(p.state="visible"):r.current.push({el:m,state:"visible"}),()=>a(m,wt.Unmount)}),c=o.useRef([]),f=o.useRef(Promise.resolve()),h=o.useRef({enter:[],leave:[]}),g=K((m,p,v)=>{c.current.splice(0),n&&(n.chains.current[p]=n.chains.current[p].filter(([y])=>y!==m)),n?.chains.current[p].push([m,new Promise(y=>{c.current.push(y)})]),n?.chains.current[p].push([m,new Promise(y=>{Promise.all(h.current[p].map(([S,E])=>E)).then(()=>y())})]),p==="enter"?f.current=f.current.then(()=>n?.wait.current).then(()=>v(p)):v(p)}),u=K((m,p,v)=>{Promise.all(h.current[p].splice(0).map(([y,S])=>S)).then(()=>{var y;(y=c.current.shift())==null||y()}).then(()=>v(p))});return o.useMemo(()=>({children:r,register:l,unregister:a,onStart:g,onStop:u,wait:f,chains:h}),[l,a,r,g,u,h,f])}let Lo=o.Fragment,$o=st.RenderStrategy;function Df(e,n){var t,r;let{transition:s=!0,beforeEnter:i,afterEnter:a,beforeLeave:l,afterLeave:c,enter:f,enterFrom:h,enterTo:g,entered:u,leave:m,leaveFrom:p,leaveTo:v,...y}=e,[S,E]=o.useState(null),x=o.useRef(null),M=No(e),V=Se(...M?[x,n,E]:n===null?[]:[n]),b=(t=y.unmount)==null||t?wt.Unmount:wt.Hidden,{show:F,appear:k,initial:N}=jf(),[T,R]=o.useState(F?"visible":"hidden"),C=Nf(),{register:w,unregister:A}=C;Ee(()=>w(x),[w,x]),Ee(()=>{if(b===wt.Hidden&&x.current){if(F&&T!=="visible"){R("visible");return}return ye(T,{hidden:()=>A(x),visible:()=>w(x)})}},[T,x,w,A,F,b]);let P=mr();Ee(()=>{if(M&&P&&T==="visible"&&x.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[x,T,P,M]);let q=N&&!k,D=k&&F&&N,j=o.useRef(!1),B=Do(()=>{j.current||(R("hidden"),A(x))},C),G=K(O=>{j.current=!0;let L=O?"enter":"leave";B.onStart(x,L,H=>{H==="enter"?i?.():H==="leave"&&l?.()})}),W=K(O=>{let L=O?"enter":"leave";j.current=!1,B.onStop(x,L,H=>{H==="enter"?a?.():H==="leave"&&c?.()}),L==="leave"&&!wr(B)&&(R("hidden"),A(x))});o.useEffect(()=>{M&&s||(G(F),W(F))},[F,M,s]);let z=!(!s||!M||!P||q),[,$]=fr(z,S,F,{start:G,end:W}),_=xa({ref:V,className:((r=pc(y.className,D&&f,D&&h,$.enter&&f,$.enter&&$.closed&&h,$.enter&&!$.closed&&g,$.leave&&m,$.leave&&!$.closed&&p,$.leave&&$.closed&&v,!$.transition&&F&&u))==null?void 0:r.trim())||void 0,...hr($)}),X=0;T==="visible"&&(X|=ge.Open),T==="hidden"&&(X|=ge.Closed),F&&T==="hidden"&&(X|=ge.Opening),!F&&T==="visible"&&(X|=ge.Closing);let I=he();return Z.createElement(xr.Provider,{value:B},Z.createElement(pr,{value:X},I({ourProps:_,theirProps:y,defaultTag:Lo,features:$o,visible:T==="visible",name:"Transition.Child"})))}function Lf(e,n){let{show:t,appear:r=!1,unmount:s=!0,...i}=e,a=o.useRef(null),l=No(e),c=Se(...l?[a,n]:n===null?[]:[n]);mr();let f=Ct();if(t===void 0&&f!==null&&(t=(f&ge.Open)===ge.Open),t===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[h,g]=o.useState(t?"visible":"hidden"),u=Do(()=>{t||g("hidden")}),[m,p]=o.useState(!0),v=o.useRef([t]);Ee(()=>{m!==!1&&v.current[v.current.length-1]!==t&&(v.current.push(t),p(!1))},[v,t]);let y=o.useMemo(()=>({show:t,appear:r,initial:m}),[t,r,m]);Ee(()=>{t?g("visible"):!wr(u)&&a.current!==null&&g("hidden")},[t,u]);let S={unmount:s},E=K(()=>{var V;m&&p(!1),(V=e.beforeEnter)==null||V.call(e)}),x=K(()=>{var V;m&&p(!1),(V=e.beforeLeave)==null||V.call(e)}),M=he();return Z.createElement(xr.Provider,{value:u},Z.createElement(br.Provider,{value:y},M({ourProps:{...S,as:o.Fragment,children:Z.createElement(Ho,{ref:c,...S,...i,beforeEnter:E,beforeLeave:x})},theirProps:{},defaultTag:o.Fragment,features:$o,visible:h==="visible",name:"Transition"})))}function $f(e,n){let t=o.useContext(br)!==null,r=Ct()!==null;return Z.createElement(Z.Fragment,null,!t&&r?Z.createElement(os,{ref:n,...e}):Z.createElement(Ho,{ref:n,...e}))}let os=le(Lf),Ho=le(Df),Ws=le($f),Hf=Object.assign(os,{Child:Ws,Root:os});var _f=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(_f||{}),Bf=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(Bf||{});let Zf={0(e,n){return e.titleId===n.id?e:{...e,titleId:n.id}}},Ys=o.createContext(null);Ys.displayName="DialogContext";function Er(e){let n=o.useContext(Ys);if(n===null){let t=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Er),t}return n}function zf(e,n){return ye(n.type,Zf,e,n)}let Wi=le(function(e,n){let t=o.useId(),{id:r=`headlessui-dialog-${t}`,open:s,onClose:i,initialFocus:a,role:l="dialog",autoFocus:c=!0,__demoMode:f=!1,unmount:h=!1,...g}=e,u=o.useRef(!1);l=(function(){return l==="dialog"||l==="alertdialog"?l:(u.current||(u.current=!0,console.warn(`Invalid role [${l}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let m=Ct();s===void 0&&m!==null&&(s=(m&ge.Open)===ge.Open);let p=o.useRef(null),v=Se(p,n),y=dt(p),S=s?0:1,[E,x]=o.useReducer(zf,{titleId:null,descriptionId:null,panelRef:o.createRef()}),M=K(()=>i(!1)),V=K($=>x({type:0,id:$})),b=mr()?S===0:!1,[F,k]=gc(),N={get current(){var $;return($=E.panelRef.current)!=null?$:p.current}},T=Vo(),{resolveContainers:R}=kf({mainTreeNode:T,portals:F,defaultContainers:[N]}),C=m!==null?(m&ge.Closing)===ge.Closing:!1;Fs(f||C?!1:b,{allowed:K(()=>{var $,_;return[(_=($=p.current)==null?void 0:$.closest("[data-headlessui-portal]"))!=null?_:null]}),disallowed:K(()=>{var $;return[($=T?.closest("body > *:not(#headlessui-portal-root)"))!=null?$:null]})});let w=bn.get(null);Ee(()=>{if(b)return w.actions.push(r),()=>w.actions.pop(r)},[w,r,b]);let A=ae(w,o.useCallback($=>w.selectors.isTop($,r),[w,r]));Rs(A,R,$=>{$.preventDefault(),M()}),Ef(A,y?.defaultView,$=>{$.preventDefault(),$.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),M()}),Ts(f||C?!1:b,y,R),Cs(b,p,M);let[P,q]=vc(),D=o.useMemo(()=>[{dialogState:S,close:M,setTitleId:V,unmount:h},E],[S,E,M,V,h]),j=o.useMemo(()=>({open:S===0}),[S]),B={ref:v,id:r,role:l,tabIndex:-1,"aria-modal":f?void 0:S===0?!0:void 0,"aria-labelledby":E.titleId,"aria-describedby":P,unmount:h},G=!Sf(),W=vt.None;b&&!f&&(W|=vt.RestoreFocus,W|=vt.TabLock,c&&(W|=vt.AutoFocus),G&&(W|=vt.InitialFocus));let z=he();return Z.createElement(Pa,null,Z.createElement(Ti,{force:!0},Z.createElement(Os,null,Z.createElement(Ys.Provider,{value:D},Z.createElement(yc,{target:p},Z.createElement(Ti,{force:!1},Z.createElement(q,{slot:j},Z.createElement(k,null,Z.createElement(Of,{initialFocus:a,initialFocusFallback:p,containers:R,features:W},Z.createElement(Eo,{value:M},z({ourProps:B,theirProps:g,slot:j,defaultTag:Uf,features:Gf,visible:S===0,name:"Dialog"})))))))))))}),Uf="div",Gf=st.RenderStrategy|st.Static;function qf(e,n){let{transition:t=!1,open:r,...s}=e,i=Ct(),a=e.hasOwnProperty("open")||i!==null,l=e.hasOwnProperty("onClose");if(!a&&!l)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!a)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!l)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(r!==void 0||t)&&!s.static?Z.createElement(Ki,null,Z.createElement(Hf,{show:r,transition:t,unmount:s.unmount},Z.createElement(Wi,{ref:n,...s}))):Z.createElement(Ki,null,Z.createElement(Wi,{ref:n,open:r,...s}))}let Kf="div";function Wf(e,n){let t=o.useId(),{id:r=`headlessui-dialog-panel-${t}`,transition:s=!1,...i}=e,[{dialogState:a,unmount:l},c]=Er("Dialog.Panel"),f=Se(n,c.panelRef),h=o.useMemo(()=>({open:a===0}),[a]),g=K(y=>{y.stopPropagation()}),u={ref:f,id:r,onClick:g},m=s?Ws:o.Fragment,p=s?{unmount:l}:{},v=he();return Z.createElement(m,{...p},v({ourProps:u,theirProps:i,slot:h,defaultTag:Kf,name:"Dialog.Panel"}))}let Yf="div";function Qf(e,n){let{transition:t=!1,...r}=e,[{dialogState:s,unmount:i}]=Er("Dialog.Backdrop"),a=o.useMemo(()=>({open:s===0}),[s]),l={ref:n,"aria-hidden":!0},c=t?Ws:o.Fragment,f=t?{unmount:i}:{},h=he();return Z.createElement(c,{...f},h({ourProps:l,theirProps:r,slot:a,defaultTag:Yf,name:"Dialog.Backdrop"}))}let Xf="h2";function Jf(e,n){let t=o.useId(),{id:r=`headlessui-dialog-title-${t}`,...s}=e,[{dialogState:i,setTitleId:a}]=Er("Dialog.Title"),l=Se(n);o.useEffect(()=>(a(r),()=>a(null)),[r,a]);let c=o.useMemo(()=>({open:i===0}),[i]),f={ref:l,id:r};return he()({ourProps:f,theirProps:s,slot:c,defaultTag:Xf,name:"Dialog.Title"})}let eh=le(qf),_o=le(Wf),th=le(Qf),Bo=le(Jf),nh=Object.assign(eh,{Panel:_o,Title:Bo,Description:mc});var Yi;let rh=(Yi=Z.startTransition)!=null?Yi:function(e){e()};var sh=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(sh||{}),ih=(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))(ih||{});let ah={0:e=>({...e,disclosureState:ye(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},2(e,n){return e.buttonId===n.buttonId?e:{...e,buttonId:n.buttonId}},3(e,n){return e.panelId===n.panelId?e:{...e,panelId:n.panelId}},4(e,n){return e.buttonElement===n.element?e:{...e,buttonElement:n.element}},5(e,n){return e.panelElement===n.element?e:{...e,panelElement:n.element}}},Qs=o.createContext(null);Qs.displayName="DisclosureContext";function Xs(e){let n=o.useContext(Qs);if(n===null){let t=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Xs),t}return n}let Js=o.createContext(null);Js.displayName="DisclosureAPIContext";function Zo(e){let n=o.useContext(Js);if(n===null){let t=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Zo),t}return n}let ei=o.createContext(null);ei.displayName="DisclosurePanelContext";function oh(){return o.useContext(ei)}function lh(e,n){return ye(n.type,ah,e,n)}let ch=o.Fragment;function uh(e,n){let{defaultOpen:t=!1,...r}=e,s=o.useRef(null),i=Se(n,bc(v=>{s.current=v},e.as===void 0||e.as===o.Fragment)),a=o.useReducer(lh,{disclosureState:t?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:l,buttonId:c},f]=a,h=K(v=>{f({type:1});let y=As(s);if(!y||!c)return;let S=v?un(v)?v:"current"in v&&un(v.current)?v.current:y.getElementById(c):y.getElementById(c);S?.focus()}),g=o.useMemo(()=>({close:h}),[h]),u=o.useMemo(()=>({open:l===0,close:h}),[l,h]),m={ref:i},p=he();return Z.createElement(Qs.Provider,{value:a},Z.createElement(Js.Provider,{value:g},Z.createElement(Eo,{value:h},Z.createElement(pr,{value:ye(l,{0:ge.Open,1:ge.Closed})},p({ourProps:m,theirProps:r,slot:u,defaultTag:ch,name:"Disclosure"})))))}let dh="button";function fh(e,n){let t=o.useId(),{id:r=`headlessui-disclosure-button-${t}`,disabled:s=!1,autoFocus:i=!1,...a}=e,[l,c]=Xs("Disclosure.Button"),f=oh(),h=f===null?!1:f===l.panelId,g=o.useRef(null),u=Se(g,n,K(N=>{if(!h)return c({type:4,element:N})}));o.useEffect(()=>{if(!h)return c({type:2,buttonId:r}),()=>{c({type:2,buttonId:null})}},[r,c,h]);let m=K(N=>{var T;if(h){if(l.disclosureState===1)return;switch(N.key){case te.Space:case te.Enter:N.preventDefault(),N.stopPropagation(),c({type:0}),(T=l.buttonElement)==null||T.focus();break}}else switch(N.key){case te.Space:case te.Enter:N.preventDefault(),N.stopPropagation(),c({type:0});break}}),p=K(N=>{switch(N.key){case te.Space:N.preventDefault();break}}),v=K(N=>{var T;cr(N.currentTarget)||s||(h?(c({type:0}),(T=l.buttonElement)==null||T.focus()):c({type:0}))}),{isFocusVisible:y,focusProps:S}=Kt({autoFocus:i}),{isHovered:E,hoverProps:x}=Wt({isDisabled:s}),{pressed:M,pressProps:V}=ur({disabled:s}),b=o.useMemo(()=>({open:l.disclosureState===0,hover:E,active:M,disabled:s,focus:y,autofocus:i}),[l,E,M,y,s,i]),F=Ms(e,l.buttonElement),k=h?rt({ref:u,type:F,disabled:s||void 0,autoFocus:i,onKeyDown:m,onClick:v},S,x,V):rt({ref:u,id:r,type:F,"aria-expanded":l.disclosureState===0,"aria-controls":l.panelElement?l.panelId:void 0,disabled:s||void 0,autoFocus:i,onKeyDown:m,onKeyUp:p,onClick:v},S,x,V);return he()({ourProps:k,theirProps:a,slot:b,defaultTag:dh,name:"Disclosure.Button"})}let hh="div",ph=st.RenderStrategy|st.Static;function mh(e,n){let t=o.useId(),{id:r=`headlessui-disclosure-panel-${t}`,transition:s=!1,...i}=e,[a,l]=Xs("Disclosure.Panel"),{close:c}=Zo("Disclosure.Panel"),[f,h]=o.useState(null),g=Se(n,K(E=>{rh(()=>l({type:5,element:E}))}),h);o.useEffect(()=>(l({type:3,panelId:r}),()=>{l({type:3,panelId:null})}),[r,l]);let u=Ct(),[m,p]=fr(s,f,u!==null?(u&ge.Open)===ge.Open:a.disclosureState===0),v=o.useMemo(()=>({open:a.disclosureState===0,close:c}),[a.disclosureState,c]),y={ref:g,id:r,...hr(p)},S=he();return Z.createElement(Pa,null,Z.createElement(ei.Provider,{value:a.panelId},S({ourProps:y,theirProps:i,slot:v,defaultTag:hh,features:ph,visible:m,name:"Disclosure.Panel"})))}let gh=le(uh),zo=le(fh),Uo=le(mh),vh=Object.assign(gh,{Button:zo,Panel:Uo}),yh="input";function bh(e,n){let t=o.useId(),r=ar(),s=or(),{id:i=r||`headlessui-input-${t}`,disabled:a=s||!1,autoFocus:l=!1,invalid:c=!1,...f}=e,h=qt(),g=lr(),{isFocused:u,focusProps:m}=Kt({autoFocus:l}),{isHovered:p,hoverProps:v}=Wt({isDisabled:a}),y=rt({ref:n,id:i,"aria-labelledby":h,"aria-describedby":g,"aria-invalid":c?"true":void 0,disabled:a||void 0,autoFocus:l},m,v),S=o.useMemo(()=>({disabled:a,invalid:c,hover:p,focus:u,autofocus:l}),[a,c,p,u,l]);return he()({ourProps:y,theirProps:f,slot:S,defaultTag:yh,name:"Input"})}let xh=le(bh);var wh=Object.defineProperty,Eh=(e,n,t)=>n in e?wh(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Qi=(e,n,t)=>(Eh(e,typeof n!="symbol"?n+"":n,t),t),we=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(we||{}),Ge=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ge||{}),Hn=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(Hn||{}),Go=(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))(Go||{});function Xi(e,n=t=>t){let t=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Sa(n(e.options.slice()),i=>i.dataRef.current.domRef.current),s=t?r.indexOf(t):null;return s===-1&&(s=null),{options:r,activeOptionIndex:s}}let Sh={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ne.Nothing},listboxState:1,__demoMode:!1}},0(e,n){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,s=e.options.findIndex(i=>r(i.dataRef.current.value));return s!==-1&&(t=s),{...e,pendingFocus:n.focus,listboxState:0,activeOptionIndex:t,__demoMode:!1}},2(e,n){var t,r,s,i,a;if(e.dataRef.current.disabled||e.listboxState===1)return e;let l={...e,searchQuery:"",activationTrigger:(t=n.trigger)!=null?t:1,__demoMode:!1};if(n.focus===ne.Nothing)return{...l,activeOptionIndex:null};if(n.focus===ne.Specific)return{...l,activeOptionIndex:e.options.findIndex(h=>h.id===n.id)};if(n.focus===ne.Previous){let h=e.activeOptionIndex;if(h!==null){let g=e.options[h].dataRef.current.domRef,u=Nt(n,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:m=>m.id,resolveDisabled:m=>m.dataRef.current.disabled});if(u!==null){let m=e.options[u].dataRef.current.domRef;if(((r=g.current)==null?void 0:r.previousElementSibling)===m.current||((s=m.current)==null?void 0:s.previousElementSibling)===null)return{...l,activeOptionIndex:u}}}}else if(n.focus===ne.Next){let h=e.activeOptionIndex;if(h!==null){let g=e.options[h].dataRef.current.domRef,u=Nt(n,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:m=>m.id,resolveDisabled:m=>m.dataRef.current.disabled});if(u!==null){let m=e.options[u].dataRef.current.domRef;if(((i=g.current)==null?void 0:i.nextElementSibling)===m.current||((a=m.current)==null?void 0:a.nextElementSibling)===null)return{...l,activeOptionIndex:u}}}}let c=Xi(e),f=Nt(n,{resolveItems:()=>c.options,resolveActiveIndex:()=>c.activeOptionIndex,resolveId:h=>h.id,resolveDisabled:h=>h.dataRef.current.disabled});return{...l,...c,activeOptionIndex:f}},3:(e,n)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let t=e.searchQuery!==""?0:1,r=e.searchQuery+n.value.toLowerCase(),s=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+t).concat(e.options.slice(0,e.activeOptionIndex+t)):e.options).find(a=>{var l;return!a.dataRef.current.disabled&&((l=a.dataRef.current.textValue)==null?void 0:l.startsWith(r))}),i=s?e.options.indexOf(s):-1;return i===-1||i===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:i,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,n)=>{let t=e.options.concat(n.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==ne.Nothing&&(r=Nt(e.pendingFocus,{resolveItems:()=>t,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:s=>s.id,resolveDisabled:s=>s.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:s}=e.dataRef.current;if(s){let i=t.findIndex(a=>s?.(a.dataRef.current.value));i!==-1&&(r=i)}}return{...e,options:t,activeOptionIndex:r,pendingFocus:{focus:ne.Nothing},pendingShouldSort:!0}},6:(e,n)=>{let t=e.options,r=[],s=new Set(n.options);for(let[i,a]of t.entries())if(s.has(a.id)&&(r.push(i),s.delete(a.id),s.size===0))break;if(r.length>0){t=t.slice();for(let i of r.reverse())t.splice(i,1)}return{...e,options:t,activationTrigger:1}},7:(e,n)=>e.buttonElement===n.element?e:{...e,buttonElement:n.element},8:(e,n)=>e.optionsElement===n.element?e:{...e,optionsElement:n.element},9:e=>e.pendingShouldSort?{...e,...Xi(e),pendingShouldSort:!1}:e};class ti extends wa{constructor(n){super(n),Qi(this,"actions",{onChange:t=>{let{onChange:r,compare:s,mode:i,value:a}=this.state.dataRef.current;return ye(i,{0:()=>r?.(t),1:()=>{let l=a.slice(),c=l.findIndex(f=>s(f,t));return c===-1?l.push(t):l.splice(c,1),r?.(l)}})},registerOption:Pr(()=>{let t=[],r=new Set;return[(s,i)=>{r.has(i)||(r.add(i),t.push({id:s,dataRef:i}))},()=>(r.clear(),this.send({type:5,options:t.splice(0)}))]}),unregisterOption:Pr(()=>{let t=[];return[r=>t.push(r),()=>{this.send({type:6,options:t.splice(0)})}]}),goToOption:Pr(()=>{let t=null;return[(r,s)=>{t={type:2,...r,trigger:s}},()=>t&&this.send(t)]}),closeListbox:()=>{this.send({type:1})},openListbox:t=>{this.send({type:0,focus:t})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:t,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(t.current.value),this.send({type:2,focus:ne.Specific,id:r})}},selectOption:t=>{let r=this.state.options.find(s=>s.id===t);r&&this.actions.onChange(r.dataRef.current.value)},search:t=>{this.send({type:3,value:t})},clearSearch:()=>{this.send({type:4})},setButtonElement:t=>{this.send({type:7,element:t})},setOptionsElement:t=>{this.send({type:8,element:t})}}),Qi(this,"selectors",{activeDescendantId(t){var r;let s=t.activeOptionIndex,i=t.options;return s===null||(r=i[s])==null?void 0:r.id},isActive(t,r){var s;let i=t.activeOptionIndex,a=t.options;return i!==null?((s=a[i])==null?void 0:s.id)===r:!1},shouldScrollIntoView(t,r){return t.__demoMode||t.listboxState!==0||t.activationTrigger===0?!1:this.isActive(t,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let t=this.state.id,r=bn.get(null);this.disposables.add(r.on(Ea.Push,s=>{!r.selectors.isTop(s,t)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(t)),this.on(1,()=>r.actions.pop(t))}}static new({id:n,__demoMode:t=!1}){return new ti({id:n,dataRef:{current:{}},listboxState:t?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ne.Nothing},__demoMode:t})}reduce(n,t){return ye(t.type,Sh,n,t)}}const qo=o.createContext(null);function ni(e){let n=o.useContext(qo);if(n===null){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Ko),t}return n}function Ko({id:e,__demoMode:n=!1}){let t=o.useMemo(()=>ti.new({id:e,__demoMode:n}),[]);return Ss(()=>t.dispose()),t}let Sr=o.createContext(null);Sr.displayName="ListboxDataContext";function Sn(e){let n=o.useContext(Sr);if(n===null){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Sn),t}return n}let kh=o.Fragment;function Mh(e,n){let t=o.useId(),r=or(),{value:s,defaultValue:i,form:a,name:l,onChange:c,by:f,invalid:h=!1,disabled:g=r||!1,horizontal:u=!1,multiple:m=!1,__demoMode:p=!1,...v}=e;const y=u?"horizontal":"vertical";let S=Se(n),E=Bs(i),[x=m?[]:void 0,M]=_s(s,c,E),V=Ko({id:t,__demoMode:p}),b=o.useRef({static:!1,hold:!1}),F=o.useRef(new Map),k=ko(f),N=o.useCallback(z=>ye(T.mode,{[Ge.Multi]:()=>x.some($=>k($,z)),[Ge.Single]:()=>k(x,z)}),[x]),T=o.useMemo(()=>({value:x,disabled:g,invalid:h,mode:m?Ge.Multi:Ge.Single,orientation:y,onChange:M,compare:k,isSelected:N,optionsPropsRef:b,listRef:F}),[x,g,h,m,y,M,k,N,b,F]);Ee(()=>{V.state.dataRef.current=T},[T]);let R=ae(V,z=>z.listboxState),C=bn.get(null),w=ae(C,o.useCallback(z=>C.selectors.isTop(z,t),[C,t])),[A,P]=ae(V,z=>[z.buttonElement,z.optionsElement]);Rs(w,[A,P],(z,$)=>{V.send({type:Go.CloseListbox}),kc($,Mc.Loose)||(z.preventDefault(),A?.focus())});let q=o.useMemo(()=>({open:R===we.Open,disabled:g,invalid:h,value:x}),[R,g,h,x]),[D,j]=Ia({inherit:!0}),B={ref:S},G=o.useCallback(()=>{if(E!==void 0)return M?.(E)},[M,E]),W=he();return Z.createElement(j,{value:D,props:{htmlFor:A?.id},slot:{open:R===we.Open,disabled:g}},Z.createElement(Aa,null,Z.createElement(qo.Provider,{value:V},Z.createElement(Sr.Provider,{value:T},Z.createElement(pr,{value:ye(R,{[we.Open]:ge.Open,[we.Closed]:ge.Closed})},l!=null&&x!=null&&Z.createElement(Zs,{disabled:g,data:{[l]:x},form:a,onReset:G}),W({ourProps:B,theirProps:v,slot:q,defaultTag:kh,name:"Listbox"}))))))}let Ch="button";function Th(e,n){let t=o.useId(),r=ar(),s=Sn("Listbox.Button"),i=ni("Listbox.Button"),{id:a=r||`headlessui-listbox-button-${t}`,disabled:l=s.disabled||!1,autoFocus:c=!1,...f}=e,h=Se(n,ka(),i.actions.setButtonElement),g=xc(),[u,m,p]=ae(i,j=>[j.listboxState,j.buttonElement,j.optionsElement]),v=u===we.Open;Ma(v,{trigger:m,action:o.useCallback(j=>{if(m!=null&&m.contains(j.target))return Qe.Ignore;let B=j.target.closest('[role="option"]:not([data-disabled])');return Bt(B)?Qe.Select(B):p!=null&&p.contains(j.target)?Qe.Ignore:Qe.Close},[m,p]),close:i.actions.closeListbox,select:i.actions.selectActiveOption});let y=K(j=>{switch(j.key){case te.Enter:wo(j.currentTarget);break;case te.Space:case te.ArrowDown:j.preventDefault(),i.actions.openListbox({focus:s.value?ne.Nothing:ne.First});break;case te.ArrowUp:j.preventDefault(),i.actions.openListbox({focus:s.value?ne.Nothing:ne.Last});break}}),S=K(j=>{switch(j.key){case te.Space:j.preventDefault();break}}),E=K(j=>{var B;if(j.button===ks.Left){if(cr(j.currentTarget))return j.preventDefault();i.state.listboxState===we.Open?(Ce.flushSync(()=>i.actions.closeListbox()),(B=i.state.buttonElement)==null||B.focus({preventScroll:!0})):(j.preventDefault(),i.actions.openListbox({focus:ne.Nothing}))}}),x=o.useRef(null),M=K(j=>{x.current=j.pointerType,j.pointerType==="mouse"&&E(j)}),V=K(j=>{x.current!=="mouse"&&E(j)}),b=K(j=>j.preventDefault()),F=qt([a]),k=lr(),{isFocusVisible:N,focusProps:T}=Kt({autoFocus:c}),{isHovered:R,hoverProps:C}=Wt({isDisabled:l}),{pressed:w,pressProps:A}=ur({disabled:l}),P=o.useMemo(()=>({open:u===we.Open,active:w||u===we.Open,disabled:l,invalid:s.invalid,value:s.value,hover:R,focus:N,autofocus:c}),[u,s.value,l,R,N,w,s.invalid,c]),q=ae(i,j=>j.listboxState===we.Open),D=rt(g(),{ref:h,id:a,type:Ms(e,m),"aria-haspopup":"listbox","aria-controls":p?.id,"aria-expanded":q,"aria-labelledby":F,"aria-describedby":k,disabled:l||void 0,autoFocus:c,onKeyDown:y,onKeyUp:S,onKeyPress:b,onPointerDown:M,onClick:V},T,C,A);return he()({ourProps:D,theirProps:f,slot:P,defaultTag:Ch,name:"Listbox.Button"})}let Wo=o.createContext(!1),Fh="div",Oh=st.RenderStrategy|st.Static;function Rh(e,n){let t=o.useId(),{id:r=`headlessui-listbox-options-${t}`,anchor:s,portal:i=!1,modal:a=!0,transition:l=!1,...c}=e,f=Ca(s),[h,g]=o.useState(null);f&&(i=!0);let u=Sn("Listbox.Options"),m=ni("Listbox.Options"),[p,v,y,S]=ae(m,O=>[O.listboxState,O.buttonElement,O.optionsElement,O.__demoMode]),E=dt(v),x=dt(y),M=Ct(),[V,b]=fr(l,h,M!==null?(M&ge.Open)===ge.Open:p===we.Open);Cs(V,v,m.actions.closeListbox);let F=S?!1:a&&p===we.Open;Ts(F,x);let k=S?!1:a&&p===we.Open;Fs(k,{allowed:o.useCallback(()=>[v,y],[v,y])});let N=p!==we.Open,T=wc(N,v)?!1:V,R=V&&p===we.Closed,C=Jn(R,u.value),w=K(O=>u.compare(C,O)),A=ae(m,O=>{var L;if(f==null||!((L=f?.to)!=null&&L.includes("selection")))return null;let H=O.options.findIndex(U=>w(U.dataRef.current.value));return H===-1&&(H=0),H}),P=(()=>{if(f==null)return;if(A===null)return{...f,inner:void 0};let O=Array.from(u.listRef.current.values());return{...f,inner:{listRef:{current:O},index:A}}})(),[q,D]=Ta(P),j=Fa(),B=Se(n,f?q:null,m.actions.setOptionsElement,g),G=Gt();o.useEffect(()=>{var O;let L=y;L&&p===we.Open&&L!==((O=As(L))==null?void 0:O.activeElement)&&L?.focus({preventScroll:!0})},[p,y]);let W=K(O=>{var L,H;switch(G.dispose(),O.key){case te.Space:if(m.state.searchQuery!=="")return O.preventDefault(),O.stopPropagation(),m.actions.search(O.key);case te.Enter:if(O.preventDefault(),O.stopPropagation(),m.state.activeOptionIndex!==null){let{dataRef:U}=m.state.options[m.state.activeOptionIndex];m.actions.onChange(U.current.value)}u.mode===Ge.Single&&(Ce.flushSync(()=>m.actions.closeListbox()),(L=m.state.buttonElement)==null||L.focus({preventScroll:!0}));break;case ye(u.orientation,{vertical:te.ArrowDown,horizontal:te.ArrowRight}):return O.preventDefault(),O.stopPropagation(),m.actions.goToOption({focus:ne.Next});case ye(u.orientation,{vertical:te.ArrowUp,horizontal:te.ArrowLeft}):return O.preventDefault(),O.stopPropagation(),m.actions.goToOption({focus:ne.Previous});case te.Home:case te.PageUp:return O.preventDefault(),O.stopPropagation(),m.actions.goToOption({focus:ne.First});case te.End:case te.PageDown:return O.preventDefault(),O.stopPropagation(),m.actions.goToOption({focus:ne.Last});case te.Escape:O.preventDefault(),O.stopPropagation(),Ce.flushSync(()=>m.actions.closeListbox()),(H=m.state.buttonElement)==null||H.focus({preventScroll:!0});return;case te.Tab:O.preventDefault(),O.stopPropagation(),Ce.flushSync(()=>m.actions.closeListbox()),Ec(m.state.buttonElement,O.shiftKey?ze.Previous:ze.Next);break;default:O.key.length===1&&(m.actions.search(O.key),G.setTimeout(()=>m.actions.clearSearch(),350));break}}),z=ae(m,O=>{var L;return(L=O.buttonElement)==null?void 0:L.id}),$=o.useMemo(()=>({open:p===we.Open}),[p]),_=rt(f?j():{},{id:r,ref:B,"aria-activedescendant":ae(m,m.selectors.activeDescendantId),"aria-multiselectable":u.mode===Ge.Multi?!0:void 0,"aria-labelledby":z,"aria-orientation":u.orientation,onKeyDown:W,role:"listbox",tabIndex:p===we.Open?0:void 0,style:{...c.style,...D,"--button-width":Wr(v,!0).width},...hr(b)}),X=he(),I=o.useMemo(()=>u.mode===Ge.Multi?u:{...u,isSelected:w},[u,w]);return Z.createElement(Os,{enabled:i?e.static||V:!1,ownerDocument:E},Z.createElement(Sr.Provider,{value:I},X({ourProps:_,theirProps:c,slot:$,defaultTag:Fh,features:Oh,visible:T,name:"Listbox.Options"})))}let Ih="div";function Ah(e,n){let t=o.useId(),{id:r=`headlessui-listbox-option-${t}`,disabled:s=!1,value:i,...a}=e,l=o.useContext(Wo)===!0,c=Sn("Listbox.Option"),f=ni("Listbox.Option"),h=ae(f,T=>f.selectors.isActive(T,r)),g=c.isSelected(i),u=o.useRef(null),m=Sc(u),p=dr({disabled:s,value:i,domRef:u,get textValue(){return m()}}),v=Se(n,u,T=>{T?c.listRef.current.set(r,T):c.listRef.current.delete(r)}),y=ae(f,T=>f.selectors.shouldScrollIntoView(T,r));Ee(()=>{if(y)return Oa().requestAnimationFrame(()=>{var T,R;(R=(T=u.current)==null?void 0:T.scrollIntoView)==null||R.call(T,{block:"nearest"})})},[y,u]),Ee(()=>{if(!l)return f.actions.registerOption(r,p),()=>f.actions.unregisterOption(r)},[p,r,l]);let S=K(T=>{var R;if(s)return T.preventDefault();f.actions.onChange(i),c.mode===Ge.Single&&(Ce.flushSync(()=>f.actions.closeListbox()),(R=f.state.buttonElement)==null||R.focus({preventScroll:!0}))}),E=K(()=>{if(s)return f.actions.goToOption({focus:ne.Nothing});f.actions.goToOption({focus:ne.Specific,id:r})}),x=Ra(),M=K(T=>x.update(T)),V=K(T=>{x.wasMoved(T)&&(s||h&&f.state.activationTrigger===Hn.Pointer||f.actions.goToOption({focus:ne.Specific,id:r},Hn.Pointer))}),b=K(T=>{x.wasMoved(T)&&(s||h&&f.state.activationTrigger===Hn.Pointer&&f.actions.goToOption({focus:ne.Nothing}))}),F=o.useMemo(()=>({active:h,focus:h,selected:g,disabled:s,selectedOption:g&&l}),[h,g,s,l]),k=l?{}:{id:r,ref:v,role:"option",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-selected":g,disabled:void 0,onClick:S,onFocus:E,onPointerEnter:M,onMouseEnter:M,onPointerMove:V,onMouseMove:V,onPointerLeave:b,onMouseLeave:b},N=he();return!g&&l?null:N({ourProps:k,theirProps:a,slot:F,defaultTag:Ih,name:"Listbox.Option"})}let Vh=o.Fragment;function Ph(e,n){let{options:t,placeholder:r,...s}=e,i={ref:Se(n)},a=Sn("ListboxSelectedOption"),l=o.useMemo(()=>({}),[]),c=a.value===void 0||a.value===null||a.mode===Ge.Multi&&Array.isArray(a.value)&&a.value.length===0,f=he();return Z.createElement(Wo.Provider,{value:!0},f({ourProps:i,theirProps:{...s,children:Z.createElement(Z.Fragment,null,r&&c?r:t)},slot:l,defaultTag:Vh,name:"ListboxSelectedOption"}))}let jh=le(Mh),Yo=le(Th),Nh=xn,Qo=le(Rh),ls=le(Ah),Dh=le(Ph),Lh=Object.assign(jh,{Button:Yo,Label:Nh,Options:Qo,Option:ls,SelectedOption:Dh});function $h({controlled:e,default:n,name:t,state:r="value"}){const{current:s}=o.useRef(e!==void 0),[i,a]=o.useState(n),l=s?e:i,c=o.useCallback(f=>{s||a(f)},[]);return[l,c]}const Xo=o.createContext(void 0);function kr(){const e=o.useContext(Xo);if(e===void 0)throw new Error("Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>.");return e}function Hh(e,n=!1,t=!1){const[r,s]=o.useState(e&&n?"idle":void 0),[i,a]=o.useState(e);return e&&!i&&(a(!0),s("starting")),!e&&i&&r!=="ending"&&!t&&s("ending"),!e&&!i&&r==="ending"&&s(void 0),Te(()=>{if(!e&&i&&r!=="ending"&&t){const l=Ye.request(()=>{s("ending")});return()=>{Ye.cancel(l)}}},[e,i,r,t]),Te(()=>{if(!e||n)return;const l=Ye.request(()=>{Ce.flushSync(()=>{s(void 0)})});return()=>{Ye.cancel(l)}},[n,e]),Te(()=>{if(!e||!n)return;e&&i&&r!=="idle"&&s("starting");const l=Ye.request(()=>{s("idle")});return()=>{Ye.cancel(l)}},[n,e,i,s,r]),o.useMemo(()=>({mounted:i,setMounted:a,transitionStatus:r}),[i,r])}const _h=600;function Bh(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 Jo=o.createContext(void 0);function Zh(){return o.useContext(Jo)}function ri(e){const{disabled:n=!1,defaultOpen:t=!1,onOpenChange:r,open:s,delay:i,closeDelay:a,hoverable:l=!0,trackCursorAxis:c="none",actionsRef:f,onOpenChangeComplete:h}=e,g=i??_h,u=a??0,[m,p]=o.useState(null),[v,y]=o.useState(null),[S,E]=o.useState(),x=o.useRef(null),[M,V]=$h({controlled:s,default:t,name:"Tooltip",state:"open"}),b=!n&&M;function F(O,L,H){const U=H==="trigger-hover",ce=O&&H==="trigger-focus",pe=!O&&(H==="trigger-press"||H==="escape-key");function Be(){r?.(O,L,H),V(O)}U?Ce.flushSync(Be):Be(),ce||pe?E(ce?"focus":"dismiss"):H==="trigger-hover"&&E(void 0)}const k=oe(F);M&&n&&F(!1,void 0,"disabled");const{mounted:N,setMounted:T,transitionStatus:R}=Hh(b),C=oe(()=>{T(!1),h?.(!1)});Ds({enabled:!f,open:b,ref:x,onComplete(){b||C()}}),o.useImperativeHandle(f,()=>({unmount:C}),[C]);const w=po({elements:{reference:m,floating:v},open:b,onOpenChange(O,L,H){k(O,L,Bh(H))}}),A=Zh(),{delayRef:P,isInstantPhase:q,hasProvider:D}=fd(w),j=q?"delay":S,B=ud(w,{enabled:!n,mouseOnly:!0,move:!1,handleClose:l&&c!=="both"?wd():null,restMs(){const O=A?.delay,L=typeof P.current=="object"?P.current.open:void 0;let H=g;return D&&(L!==0?H=i??O??g:H=0),H},delay(){const O=typeof P.current=="object"?P.current.close:void 0;let L=u;return a==null&&D&&(L=O),{close:L}}}),G=yd(w,{enabled:!n}),W=gd(w,{enabled:!n,referencePress:!0}),z=pd(w,{enabled:!n&&c!=="none",axis:c==="none"?void 0:c}),{getReferenceProps:$,getFloatingProps:_}=bd([B,G,W,z]),X=o.useMemo(()=>({open:b,setOpen:k,mounted:N,setMounted:T,setTriggerElement:p,positionerElement:v,setPositionerElement:y,popupRef:x,triggerProps:$(),popupProps:_(),floatingRootContext:w,instantType:j,transitionStatus:R,onOpenChangeComplete:h}),[b,k,N,T,p,v,y,x,$,_,w,j,R,h]),I=o.useMemo(()=>({...X,delay:g,closeDelay:u,trackCursorAxis:c,hoverable:l}),[X,g,u,c,l]);return d.jsx(Xo.Provider,{value:I,children:e.children})}let si=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Yn.startingStyle]="startingStyle",e[e.endingStyle=Yn.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),zh=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const Uh={[zh.popupOpen]:""},Gh={[si.open]:""},qh={[si.closed]:""},Kh={[si.anchorHidden]:""},Wh={open(e){return e?Uh:null}},ii={open(e){return e?Gh:qh},anchorHidden(e){return e?Kh:null}},ai=o.forwardRef(function(n,t){const{className:r,render:s,...i}=n,{open:a,setTriggerElement:l,triggerProps:c}=kr(),f=o.useMemo(()=>({open:a}),[a]);return at("button",n,{state:f,ref:[t,l],props:[c,i],customStyleHookMapping:Wh})}),el=o.createContext(void 0);function Yh(){const e=o.useContext(el);if(e===void 0)throw new Error("Base UI: <Tooltip.Portal> is missing.");return e}function oi(e){const{children:n,keepMounted:t=!1,container:r}=e,{mounted:s}=kr();return s||t?d.jsx(el.Provider,{value:t,children:d.jsx(Cc,{root:r,children:n})}):null}const tl=o.createContext(void 0);function nl(){const e=o.useContext(tl);if(e===void 0)throw new Error("Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>.");return e}const Qh=o.createContext(void 0);function Xh(e=!0){const n=o.useContext(Qh);if(n===void 0&&!e)throw new Error("Base UI: DirectionContext is missing.");return n?.direction??"ltr"}const Jh=e=>({name:"arrow",options:e,async fn(n){const{x:t,y:r,placement:s,rects:i,platform:a,elements:l,middlewareData:c}=n,{element:f,padding:h=0,offsetParent:g="real"}=Tc(e,n)||{};if(f==null)return{};const u=Fc(h),m={x:t,y:r},p=Oc(s),v=Ic(p),y=await a.getDimensions(f),S=p==="y",E=S?"top":"left",x=S?"bottom":"right",M=S?"clientHeight":"clientWidth",V=i.reference[v]+i.reference[p]-m[p]-i.floating[v],b=m[p]-i.reference[p],F=g==="real"?await a.getOffsetParent?.(f):l.floating;let k=l.floating[M]||i.floating[v];(!k||!await a.isElement?.(F))&&(k=l.floating[M]||i.floating[v]);const N=V/2-b/2,T=k/2-y[v]/2-1,R=Math.min(u[E],T),C=Math.min(u[x],T),w=R,A=k-y[v]-C,P=k/2-y[v]/2+N,q=Rc(w,P,A),D=!c.arrow&&Vs(s)!=null&&P!==q&&i.reference[v]/2-(P<w?R:C)-y[v]/2<0,j=D?P<w?P-w:P-A:0;return{[p]:m[p]+j,data:{[p]:q,centerOffset:P-q-j,...D&&{alignmentOffset:j}},reset:D}}}),e0=(e,n)=>({...Jh(e),options:[e,n]});function rl(e,n,t){const r=e==="inline-start"||e==="inline-end";return{top:"top",right:r?t?"inline-start":"inline-end":"right",bottom:"bottom",left:r?t?"inline-end":"inline-start":"left"}[n]}function Ji(e,n,t){const{rects:r,placement:s}=e;return{side:rl(n,Yr(s),t),align:Vs(s)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function t0(e){const{anchor:n,positionMethod:t="absolute",side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:a=0,collisionBoundary:l,collisionPadding:c=5,sticky:f=!1,arrowPadding:h=5,trackAnchor:g=!0,keepMounted:u=!1,floatingRootContext:m,mounted:p,collisionAvoidance:v,shiftCrossAxis:y=!1,nodeId:S,adaptiveOrigin:E}=e,x=v.side||"flip",M=v.align||"flip",V=v.fallbackAxisSide||"end",b=typeof n=="function"?n:void 0,F=oe(b),k=b?F:n,N=Xe(n),R=Xh()==="rtl",C={top:"top",right:"right",bottom:"bottom",left:"left","inline-end":R?"left":"right","inline-start":R?"right":"left"}[r],w=i==="center"?C:`${C}-${i}`,A={boundary:l==="clipping-ancestors"?"clippingAncestors":l,padding:c},P=o.useRef(null),q=Xe(s),D=Xe(a),G=[Ac(ie=>{const fe=Ji(ie,r,R),je=typeof q.current=="function"?q.current(fe):q.current,Ne=typeof D.current=="function"?D.current(fe):D.current;return{mainAxis:je,crossAxis:Ne,alignmentAxis:Ne}},[typeof s!="function"?s:0,typeof a!="function"?a:0,R,r])],W=M==="none"&&x!=="shift",z=!W&&(f||y||x==="shift"),$=x==="none"?null:Vc({...A,mainAxis:!y&&x==="flip",crossAxis:M==="flip"?"alignment":!1,fallbackAxisSideDirection:V}),_=W?null:Pc(ie=>{const fe=jt(ie.elements.floating).documentElement;return{...A,rootBoundary:y?{x:0,y:0,width:fe.clientWidth,height:fe.clientHeight}:void 0,mainAxis:M!=="none",crossAxis:z,limiter:f||y?void 0:jc(()=>{if(!P.current)return{};const{height:je}=P.current.getBoundingClientRect();return{offset:je/2+(typeof c=="number"?c:0)}})}},[A,f,y,c,M]);x==="shift"||M==="shift"||i==="center"?G.push(_,$):G.push($,_),G.push(Nc({...A,apply({elements:{floating:ie},rects:{reference:fe},availableWidth:je,availableHeight:Ne}){Object.entries({"--available-width":`${je}px`,"--available-height":`${Ne}px`,"--anchor-width":`${fe.width}px`,"--anchor-height":`${fe.height}px`}).forEach(([Me,lt])=>{ie.style.setProperty(Me,lt)})}}),e0(()=>({element:P.current||document.createElement("div"),padding:h,offsetParent:"floating"}),[h]),Dc(),{name:"transformOrigin",fn(ie){const{elements:fe,middlewareData:je,placement:Ne,rects:Me,y:lt}=ie,Ft=Yr(Ne),Jt=Lc(Ft),Ot=P.current,Rt=je.arrow?.x||0,Tr=je.arrow?.y||0,Fr=Ot?.clientWidth||0,Or=Ot?.clientHeight||0,Rr=Rt+Fr/2,vi=Tr+Or/2,hl=Math.abs(je.shift?.y||0),pl=Me.reference.height/2,ml=hl>(typeof s=="function"?s(Ji(ie,r,R)):s),gl={top:`${Rr}px calc(100% + ${s}px)`,bottom:`${Rr}px ${-s}px`,left:`calc(100% + ${s}px) ${vi}px`,right:`${-s}px ${vi}px`}[Ft],vl=`${Rr}px ${Me.reference.y+pl-lt}px`;return fe.floating.style.setProperty("--transform-origin",z&&Jt==="y"&&ml?vl:gl),{}}},E);let X=m;!p&&m&&(X={...m,elements:{reference:null,floating:null,domReference:null}});const I=o.useMemo(()=>({elementResize:g&&typeof ResizeObserver<"u",layoutShift:g&&typeof IntersectionObserver<"u"}),[g]),{refs:O,elements:L,x:H,y:U,middlewareData:ce,update:pe,placement:Be,context:Tt,isPositioned:ht,floatingStyles:xe}=vd({rootContext:X,placement:w,middleware:G,strategy:t,whileElementsMounted:u?void 0:(...ie)=>Fi(...ie,I),nodeId:S}),{sideX:Pe,sideY:pt}=ce.adaptiveOrigin||{},Le=o.useMemo(()=>E?{position:t,[Pe]:`${H}px`,[pt]:`${U}px`}:xe,[E,Pe,pt,t,H,U,xe]),ot=o.useRef(null);Te(()=>{if(!p)return;const ie=N.current,fe=typeof ie=="function"?ie():ie,Ne=(ea(fe)?fe.current:fe)||null||null;Ne!==ot.current&&(O.setPositionReference(Ne),ot.current=Ne)},[p,O,k,N]),o.useEffect(()=>{if(!p)return;const ie=N.current;typeof ie!="function"&&ea(ie)&&ie.current!==ot.current&&(O.setPositionReference(ie.current),ot.current=ie.current)},[p,O,k,N]),o.useEffect(()=>{if(u&&p&&L.domReference&&L.floating)return Fi(L.domReference,L.floating,pe,I)},[u,p,L,pe,I]);const Xt=Yr(Be),Q=rl(r,Xt,R),J=Vs(Be)||"center",ue=!!ce.hide?.referenceHidden,de=o.useMemo(()=>({position:"absolute",top:ce.arrow?.y,left:ce.arrow?.x}),[ce.arrow]),$e=ce.arrow?.centerOffset!==0;return o.useMemo(()=>({positionerStyles:Le,arrowStyles:de,arrowRef:P,arrowUncentered:$e,side:Q,align:J,anchorHidden:ue,refs:O,context:Tt,isPositioned:ht,update:pe}),[Le,de,P,$e,Q,J,ue,O,Tt,ht,pe])}function ea(e){return e!=null&&"current"in e}const li=o.forwardRef(function(n,t){const{render:r,className:s,anchor:i,positionMethod:a="absolute",side:l="top",align:c="center",sideOffset:f=0,alignOffset:h=0,collisionBoundary:g="clipping-ancestors",collisionPadding:u=5,arrowPadding:m=5,sticky:p=!1,trackAnchor:v=!0,collisionAvoidance:y=Lu,...S}=n,{open:E,setPositionerElement:x,mounted:M,floatingRootContext:V,trackCursorAxis:b,hoverable:F}=kr(),k=Yh(),N=t0({anchor:i,positionMethod:a,floatingRootContext:V,mounted:M,side:l,sideOffset:f,align:c,alignOffset:h,collisionBoundary:g,collisionPadding:u,sticky:p,arrowPadding:m,trackAnchor:v,keepMounted:k,collisionAvoidance:y}),T=o.useMemo(()=>{const P={};return(!E||b==="both"||!F)&&(P.pointerEvents="none"),{role:"presentation",hidden:!M,style:{...N.positionerStyles,...P}}},[E,b,F,M,N.positionerStyles]),R=o.useMemo(()=>({props:T,...N}),[T,N]),C=o.useMemo(()=>({open:E,side:R.side,align:R.align,anchorHidden:R.anchorHidden}),[E,R.side,R.align,R.anchorHidden]),w=o.useMemo(()=>({...C,arrowRef:R.arrowRef,arrowStyles:R.arrowStyles,arrowUncentered:R.arrowUncentered}),[C,R.arrowRef,R.arrowStyles,R.arrowUncentered]),A=at("div",n,{state:C,props:[R.props,S],ref:[t,x],customStyleHookMapping:ii});return d.jsx(tl.Provider,{value:w,children:A})}),n0={...ii,...uo},ci=o.forwardRef(function(n,t){const{className:r,render:s,...i}=n,{open:a,instantType:l,transitionStatus:c,popupProps:f,popupRef:h,onOpenChangeComplete:g}=kr(),{side:u,align:m}=nl();Ds({open:a,ref:h,onComplete(){a&&g?.(!0)}});const p=o.useMemo(()=>({open:a,side:u,align:m,instant:l,transitionStatus:c}),[a,u,m,l,c]);return at("div",n,{state:p,ref:[t,h],props:[f,c==="starting"?Du:gt,i],customStyleHookMapping:n0})}),ui=o.forwardRef(function(n,t){const{className:r,render:s,...i}=n,{open:a,arrowRef:l,side:c,align:f,arrowUncentered:h,arrowStyles:g}=nl(),u=o.useMemo(()=>({open:a,side:c,align:f,uncentered:h}),[a,c,f,h]);return at("div",n,{state:u,ref:[t,l],props:[{style:g,"aria-hidden":!0},i],customStyleHookMapping:ii})}),di=function(n){const{delay:t,closeDelay:r,timeout:s=400}=n,i=o.useMemo(()=>({delay:t,closeDelay:r}),[t,r]),a=o.useMemo(()=>({open:t,close:r}),[t,r]);return d.jsx(Jo.Provider,{value:i,children:d.jsx(dd,{delay:a,timeoutMs:s,children:n.children})})};function kn(e,n){return typeof e=="function"?e(n):e}function Et(e,n){return Mr(n).reduce((r,s)=>{if(r===null)return null;if(typeof r<"u")return r[s]},e)}function An(e,n,t){const r=Mr(n);function s(i){if(!r.length)return kn(t,i);const a=r.shift();if(typeof a=="string"||typeof a=="number"&&!Array.isArray(i))return typeof i=="object"?(i===null&&(i={}),{...i,[a]:s(i[a])}):{[a]:s()};if(Array.isArray(i)&&typeof a=="number"){const l=i.slice(0,a);return[...l.length?l:new Array(a),s(i[a]),...i.slice(a+1)]}return[...new Array(a),s()]}return s(e)}function r0(e,n){const t=Mr(n);function r(s){if(!s)return;if(t.length===1){const a=t[0];if(Array.isArray(s)&&typeof a=="number")return s.filter((f,h)=>h!==a);const{[a]:l,...c}=s;return c}const i=t.shift();if(typeof i=="string"&&typeof s=="object")return{...s,[i]:r(s[i])};if(typeof i=="number"&&Array.isArray(s)){if(i>=s.length)return s;const a=s.slice(0,i);return[...a.length?a:new Array(i),r(s[i]),...s.slice(i+1)]}throw new Error("It seems we have created an infinite loop in deleteBy. ")}return r(e)}const s0=/^(\d+)$/gm,i0=/\.(\d+)(?=\.)/gm,a0=/^(\d+)\./gm,o0=/\.(\d+$)/gm,l0=/\.{2,}/gm,cs="__int__",Vn=`${cs}$1`;function Mr(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(s0,Vn).replace(i0,`.${Vn}.`).replace(a0,`${Vn}.`).replace(o0,`.${Vn}`).replace(l0,".").split(".").map(n=>{if(n.startsWith(cs)){const t=n.substring(cs.length),r=parseInt(t,10);return String(r)===t?r:t}return n})}function ta(e,n){return e.length===0?n:n.length===0?e:n.startsWith("[")||n.startsWith(".")?e+n:`${e}.${n}`}function c0(e){return!(Array.isArray(e)&&e.length===0)}function us(e,n){const t=r=>r.validators.filter(Boolean).map(s=>({cause:s.cause,validate:s.fn}));return n.validationLogic({form:n.form,validators:n.validators,event:{type:e,async:!1},runValidation:t})}function ds(e,n){const{asyncDebounceMs:t}=n,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:s,onDynamicAsyncDebounceMs:i}=n.validators||{},a=t??0,l=c=>c.validators.filter(Boolean).map(f=>{const h=f?.cause||e;let g=a;switch(h){case"change":g=s??a;break;case"blur":g=r??a;break;case"dynamic":g=i??a;break;case"submit":g=0;break}return e==="submit"&&(g=0),{cause:h,validate:f.fn,debounceMs:g}});return n.validationLogic({form:n.form,validators:n.validators,event:{type:e,async:!0},runValidation:l})}const fs=e=>!!e&&typeof e=="object"&&"fields"in e;function Vt(e,n){if(Object.is(e,n))return!0;if(typeof e!="object"||e===null||typeof n!="object"||n===null)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[s,i]of e)if(!n.has(s)||!Object.is(i,n.get(s)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const s of e)if(!n.has(s))return!1;return!0}const t=Object.keys(e),r=Object.keys(n);if(t.length!==r.length)return!1;for(const s of t)if(!r.includes(s)||!Vt(e[s],n[s]))return!1;return!0}const na=({newFormValidatorError:e,isPreviousErrorFromFormValidator:n,previousErrorValue:t})=>e?{newErrorValue:e,newSource:"form"}:n?{newErrorValue:void 0,newSource:void 0}:t?{newErrorValue:t,newSource:"field"}:{newErrorValue:void 0,newSource:void 0},ra=({formLevelError:e,fieldLevelError:n})=>n?{newErrorValue:n,newSource:"field"}:e?{newErrorValue:e,newSource:"form"}:{newErrorValue:void 0,newSource:void 0},Lt=e=>{if(!e.validators)return e.runValidation({validators:[],form:e.form});const n=e.event.async,t=n?void 0:{fn:e.validators.onMount,cause:"mount"},r={fn:n?e.validators.onChangeAsync:e.validators.onChange,cause:"change"},s={fn:n?e.validators.onBlurAsync:e.validators.onBlur,cause:"blur"},i={fn:n?e.validators.onSubmitAsync:e.validators.onSubmit,cause:"submit"},a=n?void 0:{fn:()=>{},cause:"server"};switch(e.event.type){case"mount":return e.runValidation({validators:[t],form:e.form});case"submit":return e.runValidation({validators:[r,s,i,a],form:e.form});case"server":return e.runValidation({validators:[],form:e.form});case"blur":return e.runValidation({validators:[s,a],form:e.form});case"change":return e.runValidation({validators:[r,a],form:e.form});default:throw new Error(`Unknown validation event type: ${e.event.type}`)}};function u0(e){const n=new Map;for(const t of e){const r=[...t.path??[]].map(s=>{const i=typeof s=="object"?s.key:s;return typeof i=="number"?`[${i}]`:i}).join(".").replace(/\.\[/g,"[");n.set(r,(n.get(r)??[]).concat(t))}return Object.fromEntries(n)}const sa=e=>{const n=u0(e);return{form:n,fields:n}},$t={validate({value:e,validationSource:n},t){const r=t["~standard"].validate(e);if(r instanceof Promise)throw new Error("async function passed to sync validator");if(r.issues)return n==="field"?r.issues:sa(r.issues)},async validateAsync({value:e,validationSource:n},t){const r=await t["~standard"].validate(e);if(r.issues)return n==="field"?r.issues:sa(r.issues)}},sl=e=>!!e&&"~standard"in e,er={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function Pn(e){function n(g,u,m,p){const v=r(g,u,m,p);({insert:()=>l(v,g,u),remove:()=>c(v),swap:()=>p!==void 0&&h(v,g,u,p),move:()=>p!==void 0&&f(v,g,u,p)})[m]()}function t(g,u){return`${g}[${u}]`}function r(g,u,m,p){const v=[t(g,u)];if(m==="swap")v.push(t(g,p));else if(m==="move"){const[y,S]=[Math.min(u,p),Math.max(u,p)];for(let E=y;E<=S;E++)v.push(t(g,E))}else{const y=e.getFieldValue(g),S=Array.isArray(y)?y.length:0;for(let E=u+1;E<S;E++)v.push(t(g,E))}return Object.keys(e.fieldInfo).filter(y=>v.some(S=>y.startsWith(S)))}function s(g,u){return g.replace(/\[(\d+)\]/,(m,p)=>{const v=parseInt(p,10);return`[${u==="up"?v+1:Math.max(0,v-1)}]`})}function i(g,u){(u==="up"?g:[...g].reverse()).forEach(p=>{const v=s(p.toString(),u),y=e.getFieldMeta(v);y?e.setFieldMeta(p,y):e.setFieldMeta(p,a())})}const a=()=>er,l=(g,u,m)=>{i(g,"down"),g.forEach(p=>{p.toString().startsWith(t(u,m))&&e.setFieldMeta(p,a())})},c=g=>{i(g,"up")},f=(g,u,m,p)=>{const v=new Map(Object.keys(e.fieldInfo).filter(y=>y.startsWith(t(u,m))).map(y=>[y,e.getFieldMeta(y)]));i(g,m<p?"up":"down"),Object.keys(e.fieldInfo).filter(y=>y.startsWith(t(u,p))).forEach(y=>{const S=y.replace(t(u,p),t(u,m)),E=v.get(S);E&&e.setFieldMeta(y,E)})},h=(g,u,m,p)=>{g.forEach(v=>{if(!v.toString().startsWith(t(u,m)))return;const y=v.toString().replace(t(u,m),t(u,p)),[S,E]=[e.getFieldMeta(v),e.getFieldMeta(y)];S&&e.setFieldMeta(y,S),E&&e.setFieldMeta(v,E)})};return{handleArrayFieldMetaShift:n}}function Br(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 d0{constructor(n){this.options={},this.fieldInfo={},this.prevTransformArray=[],this.mount=()=>{const t=this.fieldMetaDerived.mount(),r=this.store.mount(),s=()=>{t(),r()};this.options.listeners?.onMount?.({formApi:this});const{onMount:i}=this.options.validators||{};return i&&this.validateSync("mount"),s},this.update=t=>{if(!t)return;const r=this.options;this.options=t;const s=!!t.transform?.deps?.some((l,c)=>l!==this.prevTransformArray[c]),i=t.defaultValues&&!Vt(t.defaultValues,r.defaultValues)&&!this.state.isTouched,a=!Vt(t.defaultState,r.defaultState)&&!this.state.isTouched;!i&&!a&&!s||Ze(()=>{this.baseStore.setState(()=>Br(Object.assign({},this.state,a?t.defaultState:{},i?{values:t.defaultValues}:{},s?{_force_re_eval:!this.state._force_re_eval}:{})))})},this.reset=(t,r)=>{const{fieldMeta:s}=this.state,i=this.resetFieldMeta(s);t&&!r?.keepDefaultValues&&(this.options={...this.options,defaultValues:t}),this.baseStore.setState(()=>Br({...this.options.defaultState,values:t??this.options.defaultValues??this.options.defaultState?.values,fieldMetaBase:i}))},this.validateAllFields=async t=>{const r=[];return Ze(()=>{Object.values(this.fieldInfo).forEach(i=>{if(!i.instance)return;const a=i.instance;r.push(Promise.resolve().then(()=>a.validate(t,{skipFormValidation:!0}))),i.instance.state.meta.isTouched||i.instance.setMeta(l=>({...l,isTouched:!0}))})}),(await Promise.all(r)).flat()},this.validateArrayFieldsStartingFrom=async(t,r,s)=>{const i=this.getFieldValue(t),a=Array.isArray(i)?Math.max(i.length-1,0):null,l=[`${t}[${r}]`];for(let g=r+1;g<=(a??0);g++)l.push(`${t}[${g}]`);const c=Object.keys(this.fieldInfo).filter(g=>l.some(u=>g.startsWith(u))),f=[];return Ze(()=>{c.forEach(g=>{f.push(Promise.resolve().then(()=>this.validateField(g,s)))})}),(await Promise.all(f)).flat()},this.validateField=(t,r)=>{const s=this.fieldInfo[t]?.instance;return s?(s.state.meta.isTouched||s.setMeta(i=>({...i,isTouched:!0})),s.validate(r)):[]},this.validateSync=t=>{const r=us(t,{...this.options,form:this,validationLogic:this.options.validationLogic||Lt});let s=!1;const i={};return Ze(()=>{for(const c of r){if(!c.validate)continue;const f=this.runValidator({validate:c.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:h,fieldErrors:g}=_n(f),u=tn(c.cause);for(const m of Object.keys(this.state.fieldMeta)){const p=this.getFieldMeta(m);if(!p)continue;const{errorMap:v,errorSourceMap:y}=p,S=g?.[m],{newErrorValue:E,newSource:x}=na({newFormValidatorError:S,isPreviousErrorFromFormValidator:y?.[u]==="form",previousErrorValue:v?.[u]});x==="form"&&(i[m]={...i[m],[u]:S}),v?.[u]!==E&&this.setFieldMeta(m,M=>({...M,errorMap:{...M.errorMap,[u]:E},errorSourceMap:{...M.errorSourceMap,[u]:x}}))}this.state.errorMap?.[u]!==h&&this.baseStore.setState(m=>({...m,errorMap:{...m.errorMap,[u]:h}})),(h||g)&&(s=!0)}const a=tn("submit");this.state.errorMap?.[a]&&t!=="submit"&&!s&&this.baseStore.setState(c=>({...c,errorMap:{...c.errorMap,[a]:void 0}}));const l=tn("server");this.state.errorMap?.[l]&&t!=="server"&&!s&&this.baseStore.setState(c=>({...c,errorMap:{...c.errorMap,[l]:void 0}}))}),{hasErrored:s,fieldsErrorMap:i}},this.validateAsync=async t=>{const r=ds(t,{...this.options,form:this,validationLogic:this.options.validationLogic||Lt});this.state.isFormValidating||this.baseStore.setState(c=>({...c,isFormValidating:!0}));const s=[];let i;for(const c of r){if(!c.validate)continue;const f=tn(c.cause);this.state.validationMetaMap[f]?.lastAbortController.abort();const g=new AbortController;this.state.validationMetaMap[f]={lastAbortController:g},s.push(new Promise(async u=>{let m;try{m=await new Promise((S,E)=>{setTimeout(async()=>{if(g.signal.aborted)return S(void 0);try{S(await this.runValidator({validate:c.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:g.signal},type:"validateAsync"}))}catch(x){E(x)}},c.debounceMs)})}catch(S){m=S}const{formError:p,fieldErrors:v}=_n(m);v&&(i=i?{...i,...v}:v);const y=tn(c.cause);for(const S of Object.keys(this.state.fieldMeta)){const E=this.getFieldMeta(S);if(!E)continue;const{errorMap:x,errorSourceMap:M}=E,V=i?.[S],{newErrorValue:b,newSource:F}=na({newFormValidatorError:V,isPreviousErrorFromFormValidator:M?.[y]==="form",previousErrorValue:x?.[y]});x?.[y]!==b&&this.setFieldMeta(S,k=>({...k,errorMap:{...k.errorMap,[y]:b},errorSourceMap:{...k.errorSourceMap,[y]:F}}))}this.baseStore.setState(S=>({...S,errorMap:{...S.errorMap,[y]:p}})),u(i?{fieldErrors:i,errorMapKey:y}:void 0)}))}let a=[];const l={};if(s.length){a=await Promise.all(s);for(const c of a)if(c?.fieldErrors){const{errorMapKey:f}=c;for(const[h,g]of Object.entries(c.fieldErrors)){const m={...l[h]||{},[f]:g};l[h]=m}}}return this.baseStore.setState(c=>({...c,isFormValidating:!1})),l},this.validate=t=>{const{hasErrored:r,fieldsErrorMap:s}=this.validateSync(t);return r&&!this.options.asyncAlways?s:this.validateAsync(t)},this.getFieldValue=t=>Et(this.state.values,t),this.getFieldMeta=t=>this.state.fieldMeta[t],this.getFieldInfo=t=>this.fieldInfo[t]||={instance:null,validationMetaMap:{onChange:void 0,onBlur:void 0,onSubmit:void 0,onMount:void 0,onServer:void 0,onDynamic:void 0}},this.setFieldMeta=(t,r)=>{this.baseStore.setState(s=>({...s,fieldMetaBase:{...s.fieldMetaBase,[t]:kn(r,s.fieldMetaBase[t])}}))},this.resetFieldMeta=t=>Object.keys(t).reduce((r,s)=>{const i=s;return r[i]=er,r},{}),this.setFieldValue=(t,r,s)=>{const i=s?.dontUpdateMeta??!1;Ze(()=>{i||this.setFieldMeta(t,a=>({...a,isTouched:!0,isDirty:!0,errorMap:{...a?.errorMap,onMount:void 0}})),this.baseStore.setState(a=>({...a,values:An(a.values,t,r)}))})},this.deleteField=t=>{const s=[...Object.keys(this.fieldInfo).filter(i=>{const a=t.toString();return i!==a&&i.startsWith(a)}),t];this.baseStore.setState(i=>{const a={...i};return s.forEach(l=>{a.values=r0(a.values,l),delete this.fieldInfo[l],delete a.fieldMetaBase[l]}),a})},this.pushFieldValue=(t,r,s)=>{this.setFieldValue(t,i=>[...Array.isArray(i)?i:[],r],s),this.validateField(t,"change")},this.insertFieldValue=async(t,r,s,i)=>{this.setFieldValue(t,a=>[...a.slice(0,r),s,...a.slice(r)],i),await this.validateField(t,"change"),Pn(this).handleArrayFieldMetaShift(t,r,"insert"),await this.validateArrayFieldsStartingFrom(t,r,"change")},this.replaceFieldValue=async(t,r,s,i)=>{this.setFieldValue(t,a=>a.map((l,c)=>c===r?s:l),i),await this.validateField(t,"change"),await this.validateArrayFieldsStartingFrom(t,r,"change")},this.removeFieldValue=async(t,r,s)=>{const i=this.getFieldValue(t),a=Array.isArray(i)?Math.max(i.length-1,0):null;if(this.setFieldValue(t,l=>l.filter((c,f)=>f!==r),s),Pn(this).handleArrayFieldMetaShift(t,r,"remove"),a!==null){const l=`${t}[${a}]`;this.deleteField(l)}await this.validateField(t,"change"),await this.validateArrayFieldsStartingFrom(t,r,"change")},this.swapFieldValues=(t,r,s,i)=>{this.setFieldValue(t,a=>{const l=a[r],c=a[s];return An(An(a,`${r}`,c),`${s}`,l)},i),Pn(this).handleArrayFieldMetaShift(t,r,"swap",s),this.validateField(t,"change"),this.validateField(`${t}[${r}]`,"change"),this.validateField(`${t}[${s}]`,"change")},this.moveFieldValues=(t,r,s,i)=>{this.setFieldValue(t,a=>{const l=[...a];return l.splice(s,0,l.splice(r,1)[0]),l},i),Pn(this).handleArrayFieldMetaShift(t,r,"move",s),this.validateField(t,"change"),this.validateField(`${t}[${r}]`,"change"),this.validateField(`${t}[${s}]`,"change")},this.clearFieldValues=(t,r)=>{const s=this.getFieldValue(t),i=Array.isArray(s)?Math.max(s.length-1,0):null;if(this.setFieldValue(t,[],r),i!==null)for(let a=0;a<=i;a++){const l=`${t}[${a}]`;this.deleteField(l)}this.validateField(t,"change")},this.resetField=t=>{this.baseStore.setState(r=>({...r,fieldMetaBase:{...r.fieldMetaBase,[t]:er},values:this.options.defaultValues?An(r.values,t,Et(this.options.defaultValues,t)):r.values}))},this.getAllErrors=()=>({form:{errors:this.state.errors,errorMap:this.state.errorMap},fields:Object.entries(this.state.fieldMeta).reduce((t,[r,s])=>(Object.keys(s).length&&s.errors.length&&(t[r]={errors:s.errors,errorMap:s.errorMap}),t),{})}),this.parseValuesWithSchema=t=>$t.validate({value:this.state.values,validationSource:"form"},t),this.parseValuesWithSchemaAsync=t=>$t.validateAsync({value:this.state.values,validationSource:"form"},t),this.baseStore=new $c(Br({...n?.defaultState,values:n?.defaultValues??n?.defaultState?.values})),this.fieldMetaDerived=new Gn({deps:[this.baseStore],fn:({prevDepVals:t,currDepVals:r,prevVal:s})=>{const i=s,a=t?.[0],l=r[0];let c=0;const f={};for(const h of Object.keys(l.fieldMetaBase)){const g=l.fieldMetaBase[h],u=a?.fieldMetaBase[h],m=i?.[h],p=Et(l.values,h);let v=m?.errors;if(!u||g.errorMap!==u.errorMap){v=Object.values(g.errorMap??{}).filter(M=>M!==void 0);const x=this.getFieldInfo(h)?.instance;x&&!x.options.disableErrorFlat&&(v=v?.flat(1))}const y=!c0(v??[]),S=!g.isDirty,E=Vt(p,Et(this.options.defaultValues,h))||Vt(p,this.getFieldInfo(h)?.instance?.options.defaultValue);if(m&&m.isPristine===S&&m.isValid===y&&m.isDefaultValue===E&&m.errors===v&&g===u){f[h]=m,c++;continue}f[h]={...g,errors:v,isPristine:S,isValid:y,isDefaultValue:E}}return Object.keys(l.fieldMetaBase).length&&i&&c===Object.keys(l.fieldMetaBase).length?i:f}}),this.store=new Gn({deps:[this.baseStore,this.fieldMetaDerived],fn:({prevDepVals:t,currDepVals:r,prevVal:s})=>{const i=s,a=t?.[0],l=r[0],c=r[1],f=Object.values(c).filter(Boolean),h=f.some(w=>w.isValidating),g=f.every(w=>w.isValid),u=f.some(w=>w.isTouched),m=f.some(w=>w.isBlurred),p=f.every(w=>w.isDefaultValue),v=u&&l.errorMap?.onMount,y=f.some(w=>w.isDirty),S=!y,E=!!(l.errorMap?.onMount||f.some(w=>w?.errorMap?.onMount)),x=!!h;let M=i?.errors??[];(!a||l.errorMap!==a.errorMap)&&(M=Object.values(l.errorMap).reduce((w,A)=>A===void 0?w:A&&fs(A)?(w.push(A.form),w):(w.push(A),w),[]));const V=M.length===0,b=g&&V,F=this.options.canSubmitWhenInvalid??!1,k=l.submissionAttempts===0&&!u&&!E||!x&&!l.isSubmitting&&b||F;let N=l.errorMap;if(v&&(M=M.filter(w=>w!==l.errorMap.onMount),N=Object.assign(N,{onMount:void 0})),i&&a&&i.errorMap===N&&i.fieldMeta===this.fieldMetaDerived.state&&i.errors===M&&i.isFieldsValidating===h&&i.isFieldsValid===g&&i.isFormValid===V&&i.isValid===b&&i.canSubmit===k&&i.isTouched===u&&i.isBlurred===m&&i.isPristine===S&&i.isDefaultValue===p&&i.isDirty===y&&Vt(a,l))return i;let T={...l,errorMap:N,fieldMeta:this.fieldMetaDerived.state,errors:M,isFieldsValidating:h,isFieldsValid:g,isFormValid:V,isValid:b,canSubmit:k,isTouched:u,isBlurred:m,isPristine:S,isDefaultValue:p,isDirty:y};const R=this.options.transform?.deps??[];if(R.length!==this.prevTransformArray.length||R.some((w,A)=>w!==this.prevTransformArray[A])){const w=Object.assign({},this,{state:T});this.options.transform?.fn(w),T=w.state,this.prevTransformArray=R}return T}}),this.handleSubmit=this.handleSubmit.bind(this),this.update(n||{})}get state(){return this.store.state}get formId(){return this.options.formId}runValidator(n){return sl(n.validate)?$t[n.type](n.value,n.validate):n.validate(n.value)}async handleSubmit(n){if(this.baseStore.setState(s=>({...s,isSubmitted:!1,submissionAttempts:s.submissionAttempts+1,isSubmitSuccessful:!1})),Ze(()=>{Object.values(this.fieldInfo).forEach(s=>{s.instance&&(s.instance.state.meta.isTouched||s.instance.setMeta(i=>({...i,isTouched:!0})))})}),!this.state.canSubmit)return;const t=n??this.options.onSubmitMeta;this.baseStore.setState(s=>({...s,isSubmitting:!0}));const r=()=>{this.baseStore.setState(s=>({...s,isSubmitting:!1}))};if(await this.validateAllFields("submit"),!this.state.isFieldsValid){r(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}if(await this.validate("submit"),!this.state.isValid){r(),this.options.onSubmitInvalid?.({value:this.state.values,formApi:this,meta:t});return}Ze(()=>{Object.values(this.fieldInfo).forEach(s=>{s.instance?.options.listeners?.onSubmit?.({value:s.instance.state.value,fieldApi:s.instance})})}),this.options.listeners?.onSubmit?.({formApi:this,meta:t});try{await this.options.onSubmit?.({value:this.state.values,formApi:this,meta:t}),Ze(()=>{this.baseStore.setState(s=>({...s,isSubmitted:!0,isSubmitSuccessful:!0})),r()})}catch(s){throw this.baseStore.setState(i=>({...i,isSubmitSuccessful:!1})),r(),s}}setErrorMap(n){Ze(()=>{Object.entries(n).forEach(([t,r])=>{const s=t;if(fs(r)){const{formError:i,fieldErrors:a}=_n(r);for(const l of Object.keys(this.fieldInfo))this.getFieldMeta(l)&&this.setFieldMeta(l,f=>({...f,errorMap:{...f.errorMap,[s]:a?.[l]},errorSourceMap:{...f.errorSourceMap,[s]:"form"}}));this.baseStore.setState(l=>({...l,errorMap:{...l.errorMap,[s]:i}}))}else this.baseStore.setState(i=>({...i,errorMap:{...i.errorMap,[s]:r}}))})})}}function _n(e){if(e){if(fs(e)){const n=_n(e.form).formError,t=e.fields;return{formError:n,fieldErrors:t}}return{formError:e}}return{formError:void 0}}function tn(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 f0{constructor(n){this.options={},this.mount=()=>{const t=this.store.mount();this.options.defaultValue!==void 0&&this.form.setFieldValue(this.name,this.options.defaultValue,{dontUpdateMeta:!0});const r=this.getInfo();r.instance=this,this.update(this.options);const{onMount:s}=this.options.validators||{};if(s){const i=this.runValidator({validate:s,value:{value:this.state.value,fieldApi:this,validationSource:"field"},type:"validate"});i&&this.setMeta(a=>({...a,errorMap:{...a?.errorMap,onMount:i},errorSourceMap:{...a?.errorSourceMap,onMount:"field"}}))}return this.options.listeners?.onMount?.({value:this.state.value,fieldApi:this}),t},this.update=t=>{this.options=t;const r=this.name!==t.name;if(this.name=t.name,this.state.value===void 0){const s=Et(t.form.options.defaultValues,t.name),i=t.defaultValue??s;r?this.setValue(a=>a||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=(t,r)=>{this.form.setFieldValue(this.name,t,r),this.triggerOnChangeListener(),this.validate("change")},this.getMeta=()=>this.store.state.meta,this.setMeta=t=>this.form.setFieldMeta(this.name,t),this.getInfo=()=>this.form.getFieldInfo(this.name),this.pushValue=(t,r)=>{this.form.pushFieldValue(this.name,t,r),this.triggerOnChangeListener()},this.insertValue=(t,r,s)=>{this.form.insertFieldValue(this.name,t,r,s),this.triggerOnChangeListener()},this.replaceValue=(t,r,s)=>{this.form.replaceFieldValue(this.name,t,r,s),this.triggerOnChangeListener()},this.removeValue=(t,r)=>{this.form.removeFieldValue(this.name,t,r),this.triggerOnChangeListener()},this.swapValues=(t,r,s)=>{this.form.swapFieldValues(this.name,t,r,s),this.triggerOnChangeListener()},this.moveValue=(t,r,s)=>{this.form.moveFieldValues(this.name,t,r,s),this.triggerOnChangeListener()},this.clearValues=t=>{this.form.clearFieldValues(this.name,t),this.triggerOnChangeListener()},this.getLinkedFields=t=>{const r=Object.values(this.form.fieldInfo),s=[];for(const i of r){if(!i.instance)continue;const{onChangeListenTo:a,onBlurListenTo:l}=i.instance.options.validators||{};t==="change"&&a?.includes(this.name)&&s.push(i.instance),t==="blur"&&l?.includes(this.name)&&s.push(i.instance)}return s},this.validateSync=(t,r)=>{const s=us(t,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||Lt}),a=this.getLinkedFields(t).reduce((f,h)=>{const g=us(t,{...h.options,form:h.form,validationLogic:h.form.options.validationLogic||Lt});return g.forEach(u=>{u.field=h}),f.concat(g)},[]);let l=!1;Ze(()=>{const f=(h,g)=>{const u=jn(g.cause),m=g.validate?ia(h.runValidator({validate:g.validate,value:{value:h.store.state.value,validationSource:"field",fieldApi:h},type:"validate"})):void 0,p=r[u],{newErrorValue:v,newSource:y}=ra({formLevelError:p,fieldLevelError:m});h.state.meta.errorMap?.[u]!==v&&h.setMeta(S=>({...S,errorMap:{...S.errorMap,[u]:v},errorSourceMap:{...S.errorSourceMap,[u]:y}})),v&&(l=!0)};for(const h of s)f(this,h);for(const h of a)h.validate&&f(h.field,h)});const c=jn("submit");return this.state.meta.errorMap?.[c]&&t!=="submit"&&!l&&this.setMeta(f=>({...f,errorMap:{...f.errorMap,[c]:void 0},errorSourceMap:{...f.errorSourceMap,[c]:void 0}})),{hasErrored:l}},this.validateAsync=async(t,r)=>{const s=ds(t,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||Lt}),i=await r,a=this.getLinkedFields(t),l=a.reduce((u,m)=>{const p=ds(t,{...m.options,form:m.form,validationLogic:m.form.options.validationLogic||Lt});return p.forEach(v=>{v.field=m}),u.concat(p)},[]);this.state.meta.isValidating||this.setMeta(u=>({...u,isValidating:!0}));for(const u of a)u.setMeta(m=>({...m,isValidating:!0}));const c=[],f=[],h=(u,m,p)=>{const v=jn(m.cause);u.getInfo().validationMetaMap[v]?.lastAbortController.abort();const S=new AbortController;this.getInfo().validationMetaMap[v]={lastAbortController:S},p.push(new Promise(async E=>{let x;try{x=await new Promise((k,N)=>{this.timeoutIds.validations[m.cause]&&clearTimeout(this.timeoutIds.validations[m.cause]),this.timeoutIds.validations[m.cause]=setTimeout(async()=>{if(S.signal.aborted)return k(void 0);try{k(await this.runValidator({validate:m.validate,value:{value:u.store.state.value,fieldApi:u,signal:S.signal,validationSource:"field"},type:"validateAsync"}))}catch(T){N(T)}},m.debounceMs)})}catch(k){x=k}if(S.signal.aborted)return E(void 0);const M=ia(x),V=i[this.name]?.[v],{newErrorValue:b,newSource:F}=ra({formLevelError:V,fieldLevelError:M});u.setMeta(k=>({...k,errorMap:{...k?.errorMap,[v]:b},errorSourceMap:{...k.errorSourceMap,[v]:F}})),E(b)}))};for(const u of s)u.validate&&h(this,u,c);for(const u of l)u.validate&&h(u.field,u,f);let g=[];(c.length||f.length)&&(g=await Promise.all(c),await Promise.all(f)),this.setMeta(u=>({...u,isValidating:!1}));for(const u of a)u.setMeta(m=>({...m,isValidating:!1}));return g.filter(Boolean)},this.validate=(t,r)=>{if(!this.state.meta.isTouched)return[];const{fieldsErrorMap:s}=r?.skipFormValidation?{fieldsErrorMap:{}}:this.form.validateSync(t),{hasErrored:i}=this.validateSync(t,s[this.name]??{});if(i&&!this.options.asyncAlways)return this.getInfo().validationMetaMap[jn(t)]?.lastAbortController.abort(),this.state.meta.errors;const a=r?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(t);return this.validateAsync(t,a)},this.handleChange=t=>{this.setValue(t)},this.handleBlur=()=>{this.state.meta.isTouched||this.setMeta(r=>({...r,isTouched:!0})),this.state.meta.isBlurred||this.setMeta(r=>({...r,isBlurred:!0})),this.validate("blur"),this.triggerOnBlurListener()},this.parseValueWithSchema=t=>$t.validate({value:this.state.value,validationSource:"field"},t),this.parseValueWithSchemaAsync=t=>$t.validateAsync({value:this.state.value,validationSource:"field"},t),this.form=n.form,this.name=n.name,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=new Gn({deps:[this.form.store],fn:()=>{const t=this.form.getFieldValue(this.name),r=this.form.getFieldMeta(this.name)??{...er,...n.defaultMeta};return{value:t,meta:r}}}),this.options=n}get state(){return this.store.state}runValidator(n){return sl(n.validate)?$t[n.type](n.value,n.validate):n.validate(n.value)}setErrorMap(n){this.setMeta(t=>({...t,errorMap:{...t.errorMap,...n}}))}triggerOnBlurListener(){const n=this.form.options.listeners?.onBlurDebounceMs;n&&n>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})},n)):this.form.options.listeners?.onBlur?.({formApi:this.form,fieldApi:this});const t=this.options.listeners?.onBlurDebounceMs;t&&t>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})},t)):this.options.listeners?.onBlur?.({value:this.state.value,fieldApi:this})}triggerOnChangeListener(){const n=this.form.options.listeners?.onChangeDebounceMs;n&&n>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})},n)):this.form.options.listeners?.onChange?.({formApi:this.form,fieldApi:this});const t=this.options.listeners?.onChangeDebounceMs;t&&t>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})},t)):this.options.listeners?.onChange?.({value:this.state.value,fieldApi:this})}}function ia(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 tr{constructor(n){if(this.getFormFieldName=t=>{if(typeof this.fieldsMap=="string")return ta(this.fieldsMap,t);const r=Mr(t)[0];if(typeof r!="string")return"";const s=t.slice(r.length),i=this.fieldsMap[r];return ta(i,s)},this.mount=()=>this.store.mount(),this.validateArrayFieldsStartingFrom=async(t,r,s)=>this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(t),r,s),this.validateField=(t,r)=>this.form.validateField(this.getFormFieldName(t),r),this.getFieldValue=t=>this.form.getFieldValue(this.getFormFieldName(t)),this.getFieldMeta=t=>this.form.getFieldMeta(this.getFormFieldName(t)),this.setFieldMeta=(t,r)=>this.form.setFieldMeta(this.getFormFieldName(t),r),this.setFieldValue=(t,r,s)=>this.form.setFieldValue(this.getFormFieldName(t),r,s),this.deleteField=t=>this.form.deleteField(this.getFormFieldName(t)),this.pushFieldValue=(t,r,s)=>this.form.pushFieldValue(this.getFormFieldName(t),r,s),this.insertFieldValue=async(t,r,s,i)=>this.form.insertFieldValue(this.getFormFieldName(t),r,s,i),this.replaceFieldValue=async(t,r,s,i)=>this.form.replaceFieldValue(this.getFormFieldName(t),r,s,i),this.removeFieldValue=async(t,r,s)=>this.form.removeFieldValue(this.getFormFieldName(t),r,s),this.swapFieldValues=(t,r,s,i)=>this.form.swapFieldValues(this.getFormFieldName(t),r,s,i),this.moveFieldValues=(t,r,s,i)=>this.form.moveFieldValues(this.getFormFieldName(t),r,s,i),this.clearFieldValues=(t,r)=>this.form.clearFieldValues(this.getFormFieldName(t),r),this.resetField=t=>this.form.resetField(this.getFormFieldName(t)),this.validateAllFields=t=>this.form.validateAllFields(t),n.form instanceof tr){const t=n.form;if(this.form=t.form,typeof n.fields=="string")this.fieldsMap=t.getFormFieldName(n.fields);else{const r={...n.fields};for(const s in r)r[s]=t.getFormFieldName(r[s]);this.fieldsMap=r}}else this.form=n.form,this.fieldsMap=n.fields;this.store=new Gn({deps:[this.form.store],fn:({currDepVals:t})=>{const r=t[0];let s;if(typeof this.fieldsMap=="string")s=Et(r.values,this.fieldsMap);else{s={};const i=this.fieldsMap;for(const a in i)s[a]=Et(r.values,i[a])}return{values:s}}})}get state(){return this.store.state}async handleSubmit(n){return this.form.handleSubmit(n)}}const vn=typeof window<"u"?o.useLayoutEffect:o.useEffect;function h0(e){const[n]=o.useState(()=>{const r=new f0({...e,form:e.form,name:e.name});return r.Field=il,r});return vn(n.mount,[n]),vn(()=>{n.update(e)}),be(n.store,e.mode==="array"?t=>[t.meta,Object.keys(t.value??[]).length]:void 0),n}const il=({children:e,...n})=>{const t=h0(n),r=o.useMemo(()=>kn(e,t),[e,t,t.state.value,t.state.meta]);return d.jsx(d.Fragment,{children:r})};function p0({form:e,selector:n,children:t}){const r=be(e.store,n);return kn(t,r)}function m0(e){const[n]=o.useState(()=>{const t=new d0(e),r=t;return r.Field=function(i){return d.jsx(il,{...i,form:t})},r.Subscribe=function(i){return d.jsx(p0,{form:t,selector:i.selector,children:i.children})},r});return vn(n.mount,[]),vn(()=>{n.update(e)}),n}function g0({lens:e,selector:n,children:t}){const r=be(e.store,n);return kn(t,r)}function v0(e){const[n]=o.useState(()=>{const t=new tr(e),r=e.form instanceof tr?e.form.form:e.form,s=t;return s.AppForm=function(a){return d.jsx(r.AppForm,{...a})},s.AppField=function({name:a,...l}){return d.jsx(r.AppField,{name:n.getFormFieldName(a),...l})},s.Field=function({name:a,...l}){return d.jsx(r.Field,{name:n.getFormFieldName(a),...l})},s.Subscribe=function(a){return d.jsx(g0,{lens:n,selector:a.selector,children:a.children})},Object.assign(s,{...e.formComponents})});return vn(n.mount,[n]),n}const aa=o.createContext(null),oa=o.createContext(null);function y0(){function e(){const t=o.useContext(aa);if(!t)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return t}function n(){const t=o.useContext(oa);if(!t)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return t}return{fieldContext:aa,useFieldContext:e,useFormContext:n,formContext:oa}}function fi({fieldComponents:e,fieldContext:n,formContext:t,formComponents:r}){function s(l){const c=m0(l),f=o.useMemo(()=>({children:m})=>d.jsx(t.Provider,{value:c,children:m}),[c]),h=o.useMemo(()=>({children:m,...p})=>d.jsx(c.Field,{...p,children:v=>d.jsx(n.Provider,{value:v,children:m(Object.assign(v,e))})}),[c]);return o.useMemo(()=>Object.assign(c,{AppField:h,AppForm:f,...r}),[c,h,f])}function i({render:l,props:c}){return f=>l({...c,...f})}function a({render:l,props:c,defaultValues:f}){return function(g){const u=o.useMemo(()=>({form:g.form,fields:g.fields,defaultValues:f,formComponents:r}),[g.form,g.fields]),m=v0(u);return l({...c,...g,group:m})}}return{useAppForm:s,withForm:i,withFieldGroup:a}}function hi(e){return d.jsxs("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...e,children:[d.jsx("title",{children:"Tooltip positioner arrow"}),d.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"}),d.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"}),d.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:pi,useFieldContext:Qt,formContext:mi,useFormContext:b0}=y0();function x0({id:e,name:n,label:t,...r}){const s=Qt();return d.jsxs("fieldset",{children:[d.jsx("legend",{className:"sr-only",children:n}),d.jsxs("div",{className:"flex items-center gap-3",children:[d.jsx("div",{className:"flex h-6 shrink-0 items-center",children:d.jsx("div",{className:"group grid size-4 grid-cols-1",children:d.jsx(Hd,{...r,id:e,name:n,checked:s.state.value||!1,onBlur:s.handleBlur,onChange:s.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:d.jsx(it,{className:"group-data-checked:opacity-100 stroke-white text-white opacity-0 size-4","aria-hidden":"true"})})})}),d.jsx("div",{className:"text-sm/6 mt-1",children:d.jsx("label",{htmlFor:n||e,className:"font-medium text-gray-900 dark:text-white",children:t})})]})]})}function Mt(...e){return e.filter(Boolean).join(" ")}function nr(){return d.jsx("div",{className:"flex items-center justify-center",children:d.jsx("div",{className:"w-6 h-6 border-4 border-gray-600 rounded-full animate-spin border-t-transparent"})})}function al({status:e,tooltip:n,children:t}){const r=b0();return d.jsx(r.Subscribe,{selector:s=>({canSubmit:s.canSubmit,isSubmitting:s.isSubmitting,valid:s.isValid&&s.errors.length===0,dirty:s.isDirty}),children:({canSubmit:s,isSubmitting:i,valid:a,dirty:l})=>n?d.jsx(di,{delay:300,closeDelay:1e3,children:d.jsxs(ri,{disabled:n.disabled||!1,children:[d.jsx(ai,{type:"submit",disabled:!s||!a||!l||i,"data-state":e,className:Mt("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"?d.jsx(nr,{}):e==="success"?d.jsxs(d.Fragment,{children:[d.jsx(it,{className:"size-5 text-white","aria-hidden":"true"}),t]}):e==="error"?d.jsxs(d.Fragment,{children:[d.jsx(Qn,{className:"size-5 text-white","aria-hidden":"true"}),"Error"]}):t}),d.jsx(oi,{children:d.jsx(li,{side:"top",sideOffset:10,children:d.jsxs(ci,{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:[d.jsx(ui,{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:d.jsx(hi,{})}),d.jsx("span",{className:"text-xs text-gray-700 dark:text-white whitespace-break-spaces w-full",children:n.content})]})})})]})}):d.jsx("button",{type:"submit",disabled:!s||!a||!l||i,"data-state":e,className:Mt("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"?d.jsx(nr,{}):e==="success"?d.jsxs(d.Fragment,{children:[d.jsx(it,{className:"size-5 text-white","aria-hidden":"true"}),t]}):e==="error"?d.jsxs(d.Fragment,{children:[d.jsx(Qn,{className:"size-5 text-white","aria-hidden":"true"}),"Error"]}):t})})}function Cr({id:e,errors:n}){return d.jsx("div",{id:e,className:"mt-2 flex flex-col gap-y-1 w-full",children:n.map((t,r)=>{const s=`${e}__errorMessage__${r}`;return d.jsx("div",{className:"text-sm text-red-600 dark:text-red-500 w-full",children:typeof t=="string"?t:t.message},s)})})}function ol({id:e,label:n,hint:t,...r}){const s=Qt(),i=be(s.store,c=>c.meta.errors),a=be(s.store,c=>c.meta.isTouched),l=i.length>0&&a;return d.jsxs("div",{children:[n!=null?d.jsxs("label",{htmlFor:r.name,className:"block text-sm/6 font-medium text-gray-900 dark:text-white",children:[n,r.required?"*":""]}):null,d.jsxs("div",{className:Mt("grid grid-cols-1",n!=null?"mt-2":"mt-0"),children:[d.jsx("div",{"data-state":l?"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:d.jsx(xh,{...r,value:s.state.value,onBlur:s.handleBlur,onChange:c=>{s.handleChange(c.target.value),r.onChange?.(c)},"data-state":l?"invalid":void 0,"aria-invalid":l?"true":void 0,"aria-describedby":l?`${e}-invalid`:t!=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"})}),l?d.jsx(Cr,{id:`${e}-invalid`,errors:i}):null,t!=null&&!l?d.jsx("p",{id:`${e}-hint`,className:"mt-3 text-sm/6 text-gray-400",children:t}):null]})]})}function Ve({children:e,...n}){return d.jsx("span",{...n,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 w0=Re({spaceId:Zt,name:Zt}),{useAppForm:E0}=fi({fieldComponents:{SchemaSpaceSelect:k0},formComponents:{SubmitButton:al},fieldContext:pi,formContext:mi});function S0({open:e,setOpen:n,spaceSubmitted:t}){const{setAppSchemaSpace:r}=ja(),s=o.useId(),a=E0({defaultValues:{spaceId:"",name:""},validators:{onChange:Na(w0)},onSubmit({value:c}){const f={id:nt(c.spaceId),name:c.name};r(f),t(f)}}),l=be(a.store,c=>c.values.name);return d.jsxs(nh,{open:e,onClose:n,className:"relative z-10",children:[d.jsx(th,{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"}),d.jsx("form",{noValidate:!0,className:"fixed inset-0 z-10 w-screen overflow-y-auto",onSubmit:c=>{c.preventDefault(),c.stopPropagation(),a.handleSubmit()},children:d.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:d.jsxs(_o,{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:[d.jsx("div",{className:"absolute top-0 right-0 hidden pt-4 pr-4 sm:block",children:d.jsxs("button",{type:"button",onClick:()=>n(!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:[d.jsx("span",{className:"sr-only",children:"Close"}),d.jsx(Hs,{"aria-hidden":"true",className:"size-6"})]})}),d.jsxs("div",{className:"sm:flex sm:items-start",children:[d.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:d.jsx($s,{"aria-hidden":"true",className:"size-6 text-yellow-600 dark:text-yellow-400"})}),d.jsxs("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[d.jsx(Bo,{as:"h3",className:"text-base font-semibold text-gray-900 dark:text-white",children:"Select Space"}),d.jsx("div",{className:"mt-2 flex flex-col gap-y-4 w-full",children:d.jsx(a.AppField,{name:"spaceId",children:c=>d.jsx(c.SchemaSpaceSelect,{id:s,name:"spaceId",spaceSelected:f=>{a.setFieldValue("name",f.name||f.id),a.setFieldValue("spaceId",f.id)}})})})]})]}),d.jsxs("div",{className:"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse sm:gap-x-2",children:[d.jsx(a.AppForm,{children:d.jsxs(a.SubmitButton,{status:"idle",children:["Select Space ",d.jsx(Ve,{children:l})," & Publish"]})}),d.jsx("button",{type:"button",onClick:()=>{a.reset(void 0,{keepDefaultValues:!0}),n(!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 k0({id:e,name:n,spaceSelected:t}){const{redirectToConnect:r}=vs(),{authenticated:s}=Da(),{data:i=[],isPending:a}=Eu({mode:"public"}),l=Qt(),c=be(l.store,u=>u.value),f=be(l.store,u=>u.meta.errors),h=be(l.store,u=>u.meta.isTouched),g=f.length>0&&h;return s?!a&&i.length===0?d.jsxs("div",{className:"w-full flex flex-col gap-y-2",children:[d.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"}),d.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300",children:"Reconnect to Geo connect and connect public spaces"}),d.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:()=>r({storage:localStorage,connectUrl:"https://connect.geobrowser.io/",successUrl:`${window.location.origin}/authenticate-callback`,redirectFn(u){window.location.href=u.toString()}}),children:"Connect Spaces"})]}):d.jsxs("div",{className:"relative flex flex-col gap-y-2 w-full",children:[d.jsxs("fieldset",{id:e,name:n,"aria-label":"App Schema Space",onBlur:l.handleBlur,className:"relative -space-y-px rounded-md bg-white dark:bg-gray-800/50 w-full flex flex-col gap-y-2",children:[d.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=>d.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:[d.jsx("input",{value:u.id,checked:u.id===c,onChange:m=>{m.target.checked&&(l.handleChange(u.id),t(u))},name:n,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"}),d.jsxs("span",{className:"ml-3 flex flex-col gap-y-1",children:[d.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}),d.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?d.jsx(Ve,{children:u.id}):null})]})]},u.id))]}),g?d.jsx(Cr,{id:`${e}-invalid`,errors:f}):null]}):d.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:()=>r({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"})}function M0(e){return d.jsx("span",{className:"hidden dark:inline-block",children:d.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:[d.jsx("title",{children:"Published to Knowledge Graph"}),d.jsxs("g",{clipPath:"url(#clip0_59284_4458)",children:[d.jsx("circle",{cx:"8.0032",cy:"1.75",r:"1.25",stroke:"white"}),d.jsx("circle",{cx:"8.0032",cy:"14.25",r:"1.25",stroke:"white"}),d.jsx("path",{d:"M7.99641 13.255L8.0032 2.75",stroke:"white"}),d.jsx("circle",{cx:"13.4159",cy:"5.125",r:"1.25",transform:"rotate(60 13.4159 5.125)",stroke:"white"}),d.jsx("circle",{cx:"2.59055",cy:"11.375",r:"1.25",transform:"rotate(60 2.59055 11.375)",stroke:"white"}),d.jsx("path",{d:"M3.44885 10.8716L12.5498 5.625",stroke:"white"}),d.jsx("circle",{cx:"13.4159",cy:"11.375",r:"1.25",transform:"rotate(120 13.4159 11.375)",stroke:"white"}),d.jsx("circle",{cx:"2.59055",cy:"5.125",r:"1.25",transform:"rotate(120 2.59055 5.125)",stroke:"white"}),d.jsx("path",{d:"M3.45564 5.61662L12.5498 10.875",stroke:"white"})]}),d.jsx("defs",{children:d.jsx("clipPath",{id:"clip0_59284_4458",children:d.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})})}function C0(e){return d.jsx("span",{className:"inline-block dark:hidden",children:d.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:[d.jsx("title",{children:"Published to Knowledge Graph"}),d.jsxs("g",{clipPath:"url(#clip0_59285_4572)",children:[d.jsx("circle",{cx:"8.0032",cy:"1.75",r:"1.25",stroke:"#2A2A2A"}),d.jsx("circle",{cx:"8.0032",cy:"14.25",r:"1.25",stroke:"#2A2A2A"}),d.jsx("path",{d:"M7.99641 13.255L8.0032 2.75",stroke:"#2A2A2A"}),d.jsx("circle",{cx:"13.4159",cy:"5.125",r:"1.25",transform:"rotate(60 13.4159 5.125)",stroke:"#2A2A2A"}),d.jsx("circle",{cx:"2.59055",cy:"11.375",r:"1.25",transform:"rotate(60 2.59055 11.375)",stroke:"#2A2A2A"}),d.jsx("path",{d:"M3.44885 10.8716L12.5498 5.625",stroke:"#2A2A2A"}),d.jsx("circle",{cx:"13.4159",cy:"11.375",r:"1.25",transform:"rotate(120 13.4159 11.375)",stroke:"#2A2A2A"}),d.jsx("circle",{cx:"2.59055",cy:"5.125",r:"1.25",transform:"rotate(120 2.59055 5.125)",stroke:"#2A2A2A"}),d.jsx("path",{d:"M3.45564 5.61662L12.5498 10.875",stroke:"#2A2A2A"})]}),d.jsx("defs",{children:d.jsx("clipPath",{id:"clip0_59285_4572",children:d.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})})}function ll(e){return d.jsxs(d.Fragment,{children:[d.jsx(M0,{...e}),d.jsx(C0,{...e})]})}const T0={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"}}]}}]}}]}}]}}]}}]},F0={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"}}]}}]}}]}}]}}]}}]},O0={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"}}]}}]}}]}}]}}]},R0={"\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":T0,'\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':F0,"\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":O0};function gi(e){return R0[e]??{}}const I0=gi(`
|