@graphprotocol/hypergraph 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/cli/Cli.js +1 -1
  2. package/dist/cli/services/Typesync.d.ts +1 -1
  3. package/dist/cli/subcommands/typesync.js +1 -1
  4. package/dist/cli/subcommands/typesync.js.map +1 -1
  5. package/dist/connect/login.d.ts.map +1 -1
  6. package/dist/connect/login.js +0 -2
  7. package/dist/connect/login.js.map +1 -1
  8. package/dist/connect/parse-auth-params.d.ts.map +1 -1
  9. package/dist/connect/parse-auth-params.js +1 -0
  10. package/dist/connect/parse-auth-params.js.map +1 -1
  11. package/dist/entity/entity.d.ts +4 -4
  12. package/dist/typesync-studio/dist/assets/authenticate-callback-CKVajO3w.js +1 -0
  13. package/dist/typesync-studio/dist/assets/{ccip-Dy0vD6Om.js → ccip-DmgXwxAw.js} +1 -1
  14. package/dist/typesync-studio/dist/assets/index-BY93eSrW.css +1 -0
  15. package/dist/typesync-studio/dist/assets/index-CrNCJiob.js +91 -0
  16. package/dist/typesync-studio/dist/assets/index-wHD9vHCV.js +215 -0
  17. package/dist/typesync-studio/dist/index.html +2 -2
  18. package/package.json +10 -10
  19. package/src/cli/Cli.ts +1 -1
  20. package/src/cli/subcommands/typesync.ts +1 -1
  21. package/src/connect/login.ts +0 -2
  22. package/src/connect/parse-auth-params.ts +1 -0
  23. package/dist/typesync-studio/dist/assets/authenticate-callback-DN5-Vy9K.js +0 -1
  24. package/dist/typesync-studio/dist/assets/authenticate-callback-DN5-Vy9K.js.map +0 -1
  25. package/dist/typesync-studio/dist/assets/ccip-Dy0vD6Om.js.map +0 -1
  26. package/dist/typesync-studio/dist/assets/index-C9YLgP33.js +0 -215
  27. package/dist/typesync-studio/dist/assets/index-C9YLgP33.js.map +0 -1
  28. package/dist/typesync-studio/dist/assets/index-CgfQUe9o.js +0 -88
  29. package/dist/typesync-studio/dist/assets/index-CgfQUe9o.js.map +0 -1
  30. package/dist/typesync-studio/dist/assets/index-VJZgO5f3.css +0 -1
@@ -0,0 +1,91 @@
1
+ import{e as $c,E as ua,g as da,b as Sr,f as rr,t as _c,p as Zs,s as fa,c as ha,n as Hc,d as pa,h as zs,i as ma,k as Kt,l as Bc,m as Zc,y as zc,o as Uc,Y as qc,q as Gc,v as Wc,w as Kc,x as Yc,z as ga,A as ps,B as Qc,O as wt,U as Xc,C as Jc,D as eu,F as tu,P as nu,G as ru,H as ge,I as oo,J as su,T as Us,M as iu,K as Y,L as Te,Q as ie,V as ou,W as qs,X as au,Z as lu,_ as ao,$ as cu,a0 as uu,a1 as du,a2 as ya,S as Ve,a3 as vt,a4 as Gs,a5 as Pn,a6 as It,a7 as en,N as De,a8 as st,a9 as re,aa as fu,ab as ye,ac as sr,ad as ms,ae as hu,af as pu,ag as xe,ah as mu,ai as gs,aj as ys,ak as vs,al as Et,am as Ws,an as gu,ao as it,ap as kr,aq as Mr,ar as Ks,as as Jr,at as lo,au as va,av as co,aw as He,ax as ir,ay as xn,az as or,aA as bs,aB as uo,aC as yu,aD as vu,aE as bu,aF as fo,aG as Cr,aH as ho,aI as xu,r as a,aJ as ba,aK as xa,aL as es,aM as ts,u as Ys,aN as wu,aO as Eu,aP as Fe,aQ as wa,j as f,aR as Qs,aS as Xs,aT as rt,aU as Ze,aV as Ct,aW as zt,aX as Be,aY as Ie,aZ as Qn,a_ as Su,a$ as ae,b0 as Re,b1 as Js,b2 as tn,b3 as Tt,b4 as ei,b5 as he,b6 as ti,b7 as ku,b8 as Mu,b9 as Cu,ba as Tu,bb as Ru,bc as Ou,bd as Yt,be as dt,bf as Ke,bg as po,bh as Qe,bi as Ea,bj as Fu,bk as Hn,bl as Qt,bm as Xe,bn as ar,bo as ni,bp as ri,bq as nn,br as Ft,bs as Iu,bt as Sa,bu as Vu,bv as xs,bw as si,bx as ii,by as Tr,bz as Au,bA as et,bB as Pu,bC as ju,bD as Nu,bE as ka,bF as Ma,bG as Lu,bH as Je,bI as W,bJ as le,bK as pe,bL as ln,bM as Z,bN as Ca,bO as Rr,bP as Or,bQ as cn,bR as Fr,bS as Ir,bT as ee,bU as un,bV as dn,bW as Vr,bX as lt,bY as Ar,bZ as mo,b_ as Cn,b$ as Du,c0 as Ta,c1 as te,c2 as we,c3 as jn,c4 as Ra,c5 as Ut,c6 as Oa,c7 as oi,c8 as Nn,c9 as oe,ca as Ce,cb as Fa,cc as yt,cd as Ia,ce as nt,cf as rn,cg as ai,ch as li,ci as Va,cj as Aa,ck as Pa,cl as jt,cm as Pr,cn as ve,co as ci,cp as ui,cq as di,cr as Me,cs as $u,ct as jr,cu as ws,cv as fi,cw as ja,cx as _u,cy as Na,cz as hi,cA as La,cB as Da,cC as Nr,cD as ct,cE as pi,cF as mi,cG as wn,cH as Hu,cI as Lr,cJ as En,cK as qe,cL as ot,cM as $a,cN as go,cO as Rt,cP as Bu,cQ as Zu,cR as zu,cS as Uu,cT as _a,cU as yo,cV as qu,cW as Gu,cX as ns,cY as Wu,cZ as Ku,c_ as Yu,c$ as Qu,d0 as Xu,d1 as Ju,d2 as ed,d3 as td,d4 as nd,d5 as rd,d6 as gi,d7 as sd,d8 as id,d9 as Es,da as od,db as Ue,dc as ad,dd as lr,de as Ee,df as Ha,dg as Ba,dh as Za,di as sn,dj as za,dk as Ua,dl as qa,dm as Ss,dn as ld,dp as Bn,dq as cd,dr as ud,ds as dd,dt as Zn,du as rs,dv as zn,dw as fd,dx as hd,dy as pd,dz as vo}from"./index-wHD9vHCV.js";const md=Symbol.for("effect/Context/Tag"),bo=Symbol.for("effect/Context/Reference"),gd="effect/STM",yd=Symbol.for(gd),vd={...ua,_op:"Tag",[yd]:$c,[md]:{_Service:e=>e,_Identifier:e=>e},toString(){return rr(this.toJSON())},toJSON(){return{_id:"Tag",key:this.key,stack:this.stack}},[Sr](){return this.toJSON()},of(e){return e},context(e){return kd(this,e)}},bd={...vd,[bo]:bo},xd=()=>(e,n)=>{const t=Error.stackTraceLimit;Error.stackTraceLimit=2;const r=new Error;Error.stackTraceLimit=t;function s(){}return Object.setPrototypeOf(s,bd),s.key=e,s.defaultValue=n.defaultValue,Object.defineProperty(s,"stack",{get(){return r.stack}}),s},Ga=Symbol.for("effect/Context"),wd={[Ga]:{_Services:e=>e},[pa](e){if(Sd(e)&&this.unsafeMap.size===e.unsafeMap.size){for(const n of this.unsafeMap.keys())if(!e.unsafeMap.has(n)||!ma(this.unsafeMap.get(n),e.unsafeMap.get(n)))return!1;return!0}return!1},[fa](){return ha(this,Hc(this.unsafeMap.size))},pipe(){return Zs(this,arguments)},toString(){return rr(this.toJSON())},toJSON(){return{_id:"Context",services:Array.from(this.unsafeMap).map(_c)}},[Sr](){return this.toJSON()}},Ed=e=>{const n=Object.create(wd);return n.unsafeMap=e,n},Sd=e=>zs(e,Ga),kd=(e,n)=>Ed(new Map([[e.key,n]])),ss=da("effect/Context/defaultValueCache",()=>new Map),Md=e=>{if(ss.has(e.key))return ss.get(e.key);const n=e.defaultValue();return ss.set(e.key,n),n},Cd=(e,n)=>e.unsafeMap.has(n.key)?e.unsafeMap.get(n.key):Md(n),Wa=xd,Td=ua,Rd=Symbol.for("effect/Micro"),cr=Symbol.for("effect/Micro/MicroExit"),xo=Symbol.for("effect/Micro/MicroCause"),Od={_E:Kt};class yi extends globalThis.Error{_tag;traces;[xo];constructor(n,t,r){const s=`MicroCause.${n}`;let i,o,l;if(t instanceof globalThis.Error){i=`(${s}) ${t.name}`,o=t.message;const c=o.split(`
2
+ `).length;l=t.stack?`(${s}) ${t.stack.split(`
3
+ `).slice(0,c+3).join(`
4
+ `)}`:`${i}: ${o}`}else i=s,o=Gc(t,0),l=`${i}: ${o}`;r.length>0&&(l+=`
5
+ ${r.join(`
6
+ `)}`),super(o),this._tag=n,this.traces=r,this[xo]=Od,this.name=i,this.stack=l}pipe(){return Zs(this,arguments)}toString(){return this.stack}[Sr](){return this.stack}}class Fd extends yi{error;constructor(n,t=[]){super("Fail",n,t),this.error=n}}const Id=(e,n=[])=>new Fd(e,n);class Vd extends yi{defect;constructor(n,t=[]){super("Die",n,t),this.defect=n}}const Ad=(e,n=[])=>new Vd(e,n);class Pd extends yi{constructor(n=[]){super("Interrupt","interrupted",n)}}const jd=(e=[])=>new Pd(e),Ka=e=>e._tag==="Interrupt",wo=Symbol.for("effect/Micro/MicroFiber"),Nd={_A:Kt,_E:Kt};class Ld{context;interruptible;[wo];_stack=[];_observers=[];_exit;_children;currentOpCount=0;constructor(n,t=!0){this.context=n,this.interruptible=t,this[wo]=Nd}getRef(n){return Cd(this.context,n)}addObserver(n){return this._exit?(n(this._exit),Bc):(this._observers.push(n),()=>{const t=this._observers.indexOf(n);t>=0&&this._observers.splice(t,1)})}_interrupted=!1;unsafeInterrupt(){this._exit||(this._interrupted=!0,this.interruptible&&this.evaluate(Ja))}unsafePoll(){return this._exit}evaluate(n){if(this._exit)return;if(this._yielded!==void 0){const s=this._yielded;this._yielded=void 0,s()}const t=this.runLoop(n);if(t===qt)return;const r=Eo.interruptChildren&&Eo.interruptChildren(this);if(r!==void 0)return this.evaluate(Ms(r,()=>t));this._exit=t;for(let s=0;s<this._observers.length;s++)this._observers[s](t);this._observers.length=0}runLoop(n){let t=!1,r=n;this.currentOpCount=0;try{for(;;){if(this.currentOpCount++,!t&&this.getRef(xi).shouldYield(this)){t=!0;const s=r;r=Ms(Zd,()=>s)}if(r=r[ks](this),r===qt){const s=this._yielded;return cr in s?(this._yielded=void 0,s):qt}}}catch(s){return zs(r,ks)?Cs(s):Cs(`MicroFiber.runLoop: Not a valid effect: ${String(r)}`)}}getCont(n){for(;;){const t=this._stack.pop();if(!t)return;const r=t[ur]&&t[ur](this);if(r)return{[n]:r};if(t[n])return t}}_yielded=void 0;yieldWith(n){return this._yielded=n,qt}children(){return this._children??=new Set}}const Eo=da("effect/Micro/fiberMiddleware",()=>({interruptChildren:void 0})),Ya=Symbol.for("effect/Micro/identifier"),be=Symbol.for("effect/Micro/args"),ks=Symbol.for("effect/Micro/evaluate"),on=Symbol.for("effect/Micro/successCont"),Sn=Symbol.for("effect/Micro/failureCont"),ur=Symbol.for("effect/Micro/ensureCont"),qt=Symbol.for("effect/Micro/Yield"),Dd={_A:Kt,_E:Kt,_R:Kt},$d={...Td,_op:"Micro",[Rd]:Dd,pipe(){return Zs(this,arguments)},[Symbol.iterator](){return new Uc(new qc(this))},toJSON(){return{_id:"Micro",op:this[Ya],...be in this?{args:this[be]}:void 0}},toString(){return rr(this)},[Sr](){return rr(this)}};function _d(e){return Cs("Micro.evaluate: Not implemented")}const vi=e=>({...$d,[Ya]:e.op,[ks]:e.eval??_d,[on]:e.contA,[Sn]:e.contE,[ur]:e.ensure}),fn=e=>{const n=vi(e);return function(){const t=Object.create(n);return t[be]=e.single===!1?arguments:arguments[0],t}},Qa=e=>{const n={...vi(e),[cr]:cr,_tag:e.op,get[e.prop](){return this[be]},toJSON(){return{_id:"MicroExit",_tag:e.op,[e.prop]:this[be]}},[pa](t){return Kd(t)&&t._tag===e.op&&ma(this[be],t[be])},[fa](){return ha(this,Wc(Kc(e.op))(Yc(this[be])))}};return function(t){const r=Object.create(n);return r[be]=t,r[on]=void 0,r[Sn]=void 0,r[ur]=void 0,r}},bi=Qa({op:"Success",prop:"value",eval(e){const n=e.getCont(on);return n?n[on](this[be],e):e.yieldWith(this)}}),dr=Qa({op:"Failure",prop:"cause",eval(e){let n=e.getCont(Sn);for(;Ka(this[be])&&n&&e.interruptible;)n=e.getCont(Sn);return n?n[Sn](this[be],e):e.yieldWith(this)}}),So=e=>dr(Id(e)),Hd=fn({op:"Suspend",eval(e){return this[be]()}}),Bd=fn({op:"Yield",eval(e){let n=!1;return e.getRef(xi).scheduleTask(()=>{n||e.evaluate(el)},this[be]??0),e.yieldWith(()=>{n=!0})}}),Zd=Bd(0),ko=e=>zd(function(n,t){try{e.try(t).then(r=>n(bi(r)),r=>n(So(e.catch(r))))}catch(r){n(So(e.catch(r)))}},e.try.length!==0),zd=fn({op:"Async",single:!1,eval(e){const n=this[be][0];let t=!1,r=!1;const s=this[be][1]?new AbortController:void 0,i=n(o=>{t||(t=!0,r?e.evaluate(o):r=o)},s?.signal);return r!==!1?r:(r=!0,e._yielded=()=>{t=!0},s===void 0&&i===void 0||e._stack.push(Ud(()=>(t=!0,s?.abort(),i??el))),qt)}}),Ud=fn({op:"AsyncFinalizer",ensure(e){e.interruptible&&(e.interruptible=!1,e._stack.push(Jd(!0)))},contE(e,n){return Ka(e)?Ms(this[be](),()=>dr(e)):dr(e)}}),qd=(...e)=>Hd(()=>Gd(e.length===1?e[0]():e[1].call(e[0]))),Gd=fn({op:"Iterator",contA(e,n){const t=this[be].next(e);return t.done?bi(t.value):(n._stack.push(this),zc(t.value))},eval(e){return this[on](void 0,e)}}),Ms=Zc(2,(e,n)=>{const t=Object.create(Wd);return t[be]=e,t[on]=n,t}),Wd=vi({op:"OnSuccess",eval(e){return e._stack.push(this),this[be]}}),Kd=e=>zs(e,cr),Yd=bi,Xa=dr,Ja=Xa(jd()),Cs=e=>Xa(Ad(e)),el=Yd(void 0),Qd="setImmediate"in globalThis?globalThis.setImmediate:e=>setTimeout(e,0);class tl{tasks=[];running=!1;scheduleTask(n,t){this.tasks.push(n),this.running||(this.running=!0,Qd(this.afterScheduled))}afterScheduled=()=>{this.running=!1,this.runTasks()};runTasks(){const n=this.tasks;this.tasks=[];for(let t=0,r=n.length;t<r;t++)n[t]()}shouldYield(n){return n.currentOpCount>=n.getRef(Xd)}flush(){for(;this.tasks.length>0;)this.runTasks()}}class Xd extends Wa()("effect/Micro/currentMaxOpsBeforeYield",{defaultValue:()=>2048}){}class xi extends Wa()("effect/Micro/currentScheduler",{defaultValue:()=>new tl}){}const Jd=fn({op:"SetInterruptible",ensure(e){if(e.interruptible=this[be],e._interrupted&&e.interruptible)return()=>Ja}}),ef=(e,n)=>{const t=new Ld(xi.context(new tl));return t.evaluate(e),t},tf=(e,n)=>new Promise((t,r)=>{ef(e).addObserver(t)}),nf=(e,n)=>tf(e).then(t=>{if(t._tag==="Failure")throw t.cause;return t.value});function rf(e){let n=e;if(n.startsWith("0x")&&(n=n.slice(2)),e.length%2!==0)throw new Error("Invalid hex string: must have an even length");const t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r/2]=Number.parseInt(e.slice(r,r+2),16);return t}function sf({name:e,ops:n,author:t,language:r}){return new ga({id:ps(Qc()),name:e,ops:ff(n),authors:[rf(t)],language:r?ps(r):void 0}).toBinary()}function of(e){const n={id:ge(e.id),type:ge(e.type),from_entity:ge(e.fromEntity),to_entity:ge(e.toEntity),entity:ge(e.entity)};return e.fromSpace&&(n.from_space=ge(e.fromSpace)),e.fromVersion&&(n.from_version=ge(e.fromVersion)),e.toSpace&&(n.to_space=ge(e.toSpace)),e.toVersion&&(n.to_version=ge(e.toVersion)),e.position!==void 0&&(n.position=e.position),e.verified!==void 0&&(n.verified=e.verified),n}function af(e){return{id:ge(e.id),properties:e.properties.map(n=>ge(n))}}function lf(e){const n={id:ge(e.id)};return e.fromSpace&&(n.from_space=ge(e.fromSpace)),e.fromVersion&&(n.from_version=ge(e.fromVersion)),e.toSpace&&(n.to_space=ge(e.toSpace)),e.toVersion&&(n.to_version=ge(e.toVersion)),e.position!==void 0&&(n.position=e.position),e.verified!==void 0&&(n.verified=e.verified),n}function cf(e){const n={id:ge(e.id)};return e.fromSpace!==void 0&&(n.from_space=e.fromSpace),e.fromVersion!==void 0&&(n.from_version=e.fromVersion),e.toSpace!==void 0&&(n.to_space=e.toSpace),e.toVersion!==void 0&&(n.to_version=e.toVersion),e.position!==void 0&&(n.position=e.position),e.verified!==void 0&&(n.verified=e.verified),n}function uf(e){return{id:ge(e.id).toString(),values:e.values.map(n=>{let t;n.options&&(n.options.text?t={text:{...n.options.text.language?{language:ge(oo(n.options.text.language)).toString()}:null}}:n.options.number&&(t={number:{...n.options.number.unit?{unit:ge(oo(n.options.number.unit)).toString()}:{}}}));const r={property:ge(n.property).toString(),value:n.value};return t&&(r.options=t),r})}}function df(e){return{id:ge(e.id).toString(),dataType:e.dataType}}function ff(e){return e.map(n=>{switch(n.type){case"CREATE_RELATION":return new wt({payload:{case:"createRelation",value:ru.fromJson(of(n.relation))}});case"CREATE_PROPERTY":return new wt({payload:{case:"createProperty",value:nu.fromJson(df(n.property))}});case"DELETE_RELATION":return new wt({payload:{case:"deleteRelation",value:ps(n.id)}});case"UPDATE_ENTITY":return new wt({payload:{case:"updateEntity",value:tu.fromJson(uf(n.entity))}});case"UNSET_ENTITY_VALUES":return new wt({payload:{case:"unsetEntityValues",value:eu.fromJson(af(n.unsetEntityValues))}});case"UPDATE_RELATION":return new wt({payload:{case:"updateRelation",value:Jc.fromJson(lf(n.relation))}});case"UNSET_RELATION_FIELDS":return new wt({payload:{case:"unsetRelationFields",value:Xc.fromJson(cf(n.unsetRelationFields))}})}})}class Mo extends Error{_tag="IpfsUploadError"}async function hf(e){const{name:n,ops:t,author:r,network:s="MAINNET"}=e,i=sf({name:n,ops:t,author:r}),o=new Blob([i],{type:"application/octet-stream"}),l=new FormData;l.append("file",o);const c=await nf(pf(l,s)),u=ga.fromBinary(i);return{cid:c,editId:su(u.id)}}function pf(e,n){return qd(function*(){const t=yield*ko({try:()=>fetch(`${n==="TESTNET"?Us:iu}/ipfs/upload-edit`,{method:"POST",body:e}),catch:s=>new Mo(`Could not upload data to IPFS: ${s}`)});return yield*ko({try:async()=>{const{cid:s}=await t.json();return s},catch:s=>new Mo(`Could not parse response from IPFS: ${s}`)})})}const Ts=({id:e,fromEntity:n,toEntity:t,position:r,fromSpace:s,toSpace:i,fromVersion:o,toVersion:l,verified:c,type:u,entityId:m,entityName:g,entityDescription:d,entityCover:p,entityValues:h,entityRelations:y,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`"),o&&Y(o,"`fromVersion` in `createRelation`"),l&&Y(l,"`toVersion` in `createRelation`"),u&&Y(u,"`type` in `createRelation`"),m&&Y(m,"`entityId` in `createRelation`"),p&&Y(p,"`entityCover` in `createRelation`");for(const k of h??[])if(Y(k.property,"`entityValues` in `createRelation`"),k.options){const O=k.options;switch(O.type){case"text":O.language&&Y(O.language,"`language` in `options` in `entityValues` in `createRelation`");break;case"number":O.unit&&Y(O.unit,"`unit` in `options` in `entityValues` in `createRelation`");break;default:throw new Error(`Invalid option type: ${O.type}`)}}for(const[k]of Object.entries(y??{}))Y(k,"`entityRelations` in `createRelation`");for(const k of v??[])Y(k,"`entityTypes` in `createRelation`");const x=e??Te(),w=m??Te(),S=[];if(S.push({type:"CREATE_RELATION",relation:{id:ie(x),entity:ie(w),fromEntity:ie(n),fromSpace:s?ie(s):void 0,fromVersion:o?ie(o):void 0,position:r,toEntity:ie(t),toSpace:i?ie(i):void 0,toVersion:l?ie(l):void 0,verified:c,type:ie(u)}}),g||d||p||h||y||v){const{ops:k}=wi({id:w,name:g,description:d,cover:p,values:h,relations:y,types:v});S.push(...k)}return{id:ie(x),ops:S}},wi=({id:e,name:n,description:t,cover:r,values:s,relations:i,types:o})=>{e&&Y(e,"`id` in `createEntity`"),r&&Y(r,"`cover` in `createEntity`");for(const g of s??[]){if(Y(g.property,"`values` in `createEntity`"),g.options){const d=g.options;switch(d.type){case"text":d.language&&Y(d.language,"`language` in `options` in `values` in `createEntity`");break;case"number":d.unit&&Y(d.unit,"`unit` in `options` in `values` in `createEntity`");break;default:throw new Error(`Invalid option type: ${d.type}`)}}for(const[d,p]of Object.entries(i??{}))if(Y(d,"`relations` in `createEntity`"),Array.isArray(p))for(const h of p)Y(h.toEntity,"`toEntity` in `relations` in `createEntity`"),h.toSpace&&Y(h.toSpace,"`toSpace` in `relations` in `createEntity`"),h.fromSpace&&Y(h.fromSpace,"`fromSpace` in `relations` in `createEntity`"),h.fromVersion&&Y(h.fromVersion,"`fromVersion` in `relations` in `createEntity`"),h.toVersion&&Y(h.toVersion,"`toVersion` in `relations` in `createEntity`"),h.entityId&&Y(h.entityId,"`entityId` in `relations` in `createEntity`"),h.entityCover&&Y(h.entityCover,"`entityCover` in `relations` in `createEntity`");else Y(p.toEntity,"`toEntity` in `relations` in `createEntity`"),p.toSpace&&Y(p.toSpace,"`toSpace` in `relations` in `createEntity`"),p.fromSpace&&Y(p.fromSpace,"`fromSpace` in `relations` in `createEntity`"),p.fromVersion&&Y(p.fromVersion,"`fromVersion` in `relations` in `createEntity`"),p.toVersion&&Y(p.toVersion,"`toVersion` in `relations` in `createEntity`"),p.entityId&&Y(p.entityId,"`entityId` in `relations` in `createEntity`"),p.entityCover&&Y(p.entityCover,"`entityCover` in `relations` in `createEntity`")}for(const g of o??[])Y(g,"`types` in `createEntity`");const l=e??Te();let c=[];const u=[];n&&u.push({property:au,value:n}),t&&u.push({property:lu,value:t});for(const g of s??[]){let d;if(g.options){const p=g.options;switch(p.type){case"text":d={text:{language:p.language}};break;case"number":d={number:{unit:p.unit}};break}}u.push({property:ie(g.property),value:g.value,options:d})}const m={type:"UPDATE_ENTITY",entity:{id:ie(l),values:u}};if(c.push(m),r&&c.push({type:"CREATE_RELATION",relation:{id:Te(),entity:Te(),fromEntity:ie(l),toEntity:ie(r),type:ou}}),o)for(const g of o)c.push({type:"CREATE_RELATION",relation:{id:Te(),entity:Te(),fromEntity:ie(l),toEntity:ie(g),type:qs}});for(const[g,d]of Object.entries(i??{})){const p=Array.isArray(d)?d:[d];for(const h of p){const y=h.id??Te(),v=h.entityId??Te(),{ops:x}=Ts({id:y,fromEntity:l,toEntity:h.toEntity,type:ie(g),position:h.position,fromSpace:h.fromSpace,toSpace:h.toSpace,fromVersion:h.fromVersion,toVersion:h.toVersion,verified:h.verified,entityId:v,entityName:h.entityName,entityDescription:h.entityDescription,entityCover:h.entityCover,entityValues:h.entityValues,entityRelations:h.entityRelations,entityTypes:h.entityTypes});c=c.concat(x)}}return{id:ie(l),ops:c}},Rs=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??Te(),o=[];o.push({type:"CREATE_PROPERTY",property:{id:ie(i),dataType:e.dataType}});const{ops:l}=wi({id:i,name:t,description:r,cover:s});if(o.push(...l),o.push({type:"CREATE_RELATION",relation:{id:Te(),entity:Te(),fromEntity:ie(i),toEntity:ao,type:qs}}),e.dataType==="RELATION"){if(e.properties)for(const c of e.properties){Y(c);const{ops:u}=Ts({fromEntity:i,toEntity:c,type:ao});o.push(...u)}if(e.relationValueTypes)for(const c of e.relationValueTypes){Y(c);const{ops:u}=Ts({fromEntity:i,toEntity:c,type:cu});o.push(...u)}}return{id:ie(i),ops:o}},nl=({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??Te(),{ops:o}=wi({id:i,name:n,description:t,cover:r});if(Y(i),o.push({type:"CREATE_RELATION",relation:{id:Te(),entity:Te(),fromEntity:ie(i),toEntity:uu,type:qs}}),s)for(const l of s)Y(l,"`propertyId` in `createType`"),o.push({type:"CREATE_RELATION",relation:{id:Te(),entity:Te(),fromEntity:ie(i),toEntity:ie(l),type:du}});return{id:ie(i),ops:o}},fr=e=>e.toUpperCase(),Vt=e=>e.toLowerCase(),hr=e=>e.length===0,at=e=>e.length>0,Gt=e=>e.length;function rl(e){if(hr(e))throw new sl({input:e,cause:"Input is empty"});let n="",t=!1,r=0;for(;r<Gt(e)&&!/[a-zA-Z0-9]/.test(e[r]);)r++;for(;r<Gt(e);r++){const s=e[r];/[a-zA-Z0-9]/.test(s)?t?(n+=fr(s),t=!1):Gt(n)===0?n+=Vt(s):/[A-Z]/.test(s)&&r>0&&/[a-z0-9]/.test(e[r-1])?n+=fr(s):n+=Vt(s):t=Gt(n)>0}return n}function Os(e){if(hr(e))throw new sl({input:e,cause:"Input is empty"});let n="",t=!0,r=0;for(;r<Gt(e)&&!/[a-zA-Z0-9]/.test(e[r]);)r++;for(;r<Gt(e);r++){const s=e[r];/[a-zA-Z0-9]/.test(s)?t?(n+=fr(s),t=!1):/[A-Z]/.test(s)&&r>0&&/[a-z0-9]/.test(e[r-1])?n+=fr(s):n+=Vt(s):t=!0}return n}class sl extends ya("/typesync/errors/InvalidInputError"){}function Dr(e){const n=new Set;for(const t of e){const r=Vt(t.name);if(n.has(r))return!1;n.add(r)}return!0}function gt(e){return/^Relation\((.+)\)$/.test(e)}const il=De.pipe(It(e=>gt(e))),ol=Ws("String","Number","Boolean","Date","Point");Gs(ol,il);const al=Ve({name:De,knowledgeGraphId:en(it),optional:ms(hu(gu))}),ll=Ve({...al.fields,dataType:il,relationType:De.annotations({identifier:"SchemaTypePropertyRelation.relationType",description:"name of the type within the schema that this property is related to",examples:["Account"]})}),cl=Ve({...al.fields,dataType:ol});function Tn(e){return gt(e.dataType)}const ul=Ve({name:De,knowledgeGraphId:en(it),properties:vt(Gs(cl,ll)).pipe(Pn(1),It(Dr,{identifier:"DuplicatePropertyNames",jsonSchema:{},description:"The property.name must be unique across all properties in the type"}))}),dl=Ve({types:vt(ul).pipe(Pn(1),It(Dr,{identifier:"DuplicateTypeNames",jsonSchema:{},description:"The type.name must be unique across all types in the schema"}),It(fl,{identifier:"AllRelationTypesExist",jsonSchema:{},description:"Each type property of dataType RELATION must have a type of the same name in the schema"}))}).annotations({identifier:"typesync/Schema",title:"TypeSync app Schema",description:"An array of types in the schema defined by the user to generate a Mapping object for",examples:[{types:[{name:"Account",knowledgeGraphId:null,properties:[{name:"username",optional:null,knowledgeGraphId:null,dataType:"String"}]}]},{types:[{name:"Account",knowledgeGraphId:"a5fd07b1-120f-46c6-b46f-387ef98396a6",properties:[{name:"name",optional:!0,knowledgeGraphId:"a126ca53-0c8e-48d5-b888-82c734c38935",dataType:"String"}]}]}]}),mf=pu(dl);kr(dl);function fl(e){const n=st(e,new Set,(t,r)=>t.add(r.name));return re(e,sr(t=>t.properties),ye(t=>Tn(t)),fu(t=>n.has(t.relationType)))}function Fs(e){return re(e,st({},(n,{propName:t,id:r})=>(n[rl(t)]=r,n)))}function Is(e){return re(e,st({},(n,{propName:t,id:r})=>(n[rl(t)]=r,n)))}function gf(e,n){if(e.knowledgeGraphId)return{type:"resolved",mapping:{propName:e.name,id:ie(e.knowledgeGraphId)},ops:[]};if(Tn(e)){const s=n.get(e.relationType);if(s==null)return{type:"deferred",property:e};const{id:i,ops:o}=Rs({name:e.name,dataType:"RELATION",relationValueTypes:[s]});return{type:"resolved",mapping:{propName:e.name,id:i},ops:o}}const{id:t,ops:r}=Rs({name:e.name,dataType:xf(e.dataType)});return{type:"resolved",mapping:{propName:e.name,id:t},ops:r}}function yf(e,n){const t=re(e.properties,xe(d=>gf(d,n))),r=re(t,gs(d=>d.type==="resolved"?vs(d):ys())),s=re(t,gs(d=>d.type==="deferred"?vs(d.property):ys())),i=re(r,ye(d=>{const p=e.properties.find(h=>h.name===d.mapping.propName);return p?!Tn(p):!1}),xe(d=>d.mapping)),o=re(r,ye(d=>{const p=e.properties.find(h=>h.name===d.mapping.propName);return p?Tn(p):!1}),xe(d=>d.mapping)),l=re(r,sr(d=>d.ops));if(e.knowledgeGraphId){const d={typeName:Os(e.name),typeIds:[ie(e.knowledgeGraphId)]};return Et(i)&&(d.properties=Fs(i)),Et(o)&&(d.relations=Is(o)),{type:"complete",entry:d,ops:l}}if(Et(s))return{type:"deferred",schemaType:e,properties:i,relations:o};const c=[...i,...o],{id:u,ops:m}=nl({name:e.name,properties:re(c,xe(d=>d.id))});n.set(e.name,u);const g={typeName:Os(e.name),typeIds:[u]};return Et(i)&&(g.properties=Fs(i)),Et(o)&&(g.relations=Is(o)),{type:"complete",entry:g,ops:[...l,...m]}}function vf(e){const n=mf(e),t=re(n.types,st(new Map,(g,d)=>g.set(d.name,d.knowledgeGraphId!=null?ie(d.knowledgeGraphId):null))),r=re(n.types,xe(g=>yf(g,t))),[s,i]=re(r,mu(g=>g.type==="complete")),o=re(i,sr(g=>g.ops)),{entries:l,ops:c}=re(s,st({entries:[],ops:[]},(g,d)=>{const p=re(d.schemaType.properties,gs(k=>{if(!Tn(k)||k.knowledgeGraphId!=null)return ys();const O=t.get(k.relationType);if(O==null)throw new bf({message:`Failed to resolve type ID for relation type: ${k.relationType}`,property:k.name,relatedType:k.relationType});const{id:b,ops:C}=Rs({name:k.name,dataType:"RELATION",relationValueTypes:[O]});return vs({mapping:{propName:k.name,id:b},ops:C})})),h=[...d.relations,...re(p,xe(k=>k.mapping))],y=[...d.properties,...h],{id:v,ops:x}=nl({name:d.schemaType.name,properties:re(y,xe(k=>k.id))});t.set(d.schemaType.name,v);const w=[...re(p,sr(k=>k.ops)),...x],S={typeName:Os(d.schemaType.name),typeIds:[v]};return Et(d.properties)&&(S.properties=Fs(d.properties)),Et(h)&&(S.relations=Is(h)),{entries:[...g.entries,S],ops:[...g.ops,...w]}})),u=[...re(i,xe(g=>g.entry)),...l];return[re(u,st({},(g,d)=>{const{typeName:p,...h}=d;return g[p]=h,g})),[...o,...c]]}class bf extends ya("/typesync/errors/RelationValueTypeDoesNotExistError"){}function xf(e){switch(!0){case e==="Boolean":return"BOOLEAN";case e==="Date":return"TIME";case e==="Number":return"NUMBER";case e==="Point":return"POINT";case gt(e):return"RELATION";default:return"STRING"}}const hl=en(Ws("published","synced","published_not_synced")),wf=Gs(cl,ll).pipe(Ks(Ve({status:hl})));class Vs extends Mr("/Hypergraph/cli/models/TypesyncHypergraphSchemaType")({...ul.omit("properties").fields,status:hl,properties:vt(wf).pipe(Pn(1),It(Dr,{identifier:"DuplicatePropertyNames",jsonSchema:{},description:"The property.name must be unique across all properties in the type"}))}){}class Ln extends Mr("/Hypergraph/cli/models/TypesyncHypergraphSchema")({types:vt(Vs).pipe(Pn(1),It(Dr,{identifier:"DuplicateTypeNames",jsonSchema:{},description:"The type.name must be unique across all types in the schema"}),It(fl,{identifier:"AllRelationTypesExist",jsonSchema:{},description:"Each type property of dataType RELATION must have a type of the same name in the schema"}))}){}Jr({key:De,value:Ve({typeIds:vt(it).pipe(Pn(1)),properties:ms(lo(Jr({key:De,value:it}))),relations:ms(lo(Jr({key:De,value:it})))})});var Ef=class extends va{constructor(e,n){super(),this.options=n,this.#n=e,this.#a=null,this.#o=co(),this.bindMethods(),this.setOptions(n)}#n;#e=void 0;#r=void 0;#t=void 0;#s;#i;#o;#a;#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),Co(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return As(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return As(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&&!ir(this.options,n)&&this.#n.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&To(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)||xn(this.options.staleTime,this.#e)!==xn(n.staleTime,this.#e))&&this.#g();const s=this.#y();r&&(this.#e!==t||He(this.options.enabled,this.#e)!==He(n.enabled,this.#e)||s!==this.#l)&&this.#v(s)}getOptimisticResult(e){const n=this.#n.getQueryCache().build(this.#n,e),t=this.createResult(n,e);return kf(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.#o.status==="pending"&&this.#o.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(or)),n}#g(){this.#x();const e=xn(this.options.staleTime,this.#e);if(bs||this.#t.isStale||!uo(e))return;const t=yu(this.#t.dataUpdatedAt,e)+1;this.#c=setTimeout(()=>{this.#t.isStale||this.updateResult()},t)}#y(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#v(e){this.#w(),this.#l=e,!(bs||He(this.options.enabled,this.#e)===!1||!uo(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||vu.isFocused())&&this.#d()},this.#l))}#b(){this.#g(),this.#v(this.#y())}#x(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(e,n){const t=this.#e,r=this.options,s=this.#t,i=this.#s,o=this.#i,c=e!==t?e.state:this.#r,{state:u}=e;let m={...u},g=!1,d;if(n._optimisticResults){const M=this.hasListeners(),N=!M&&Co(e,n),R=M&&To(e,t,n,r);(N||R)&&(m={...m,...bu(u.data,e.options)}),n._optimisticResults==="isRestoring"&&(m.fetchStatus="idle")}let{error:p,errorUpdatedAt:h,status:y}=m;d=m.data;let v=!1;if(n.placeholderData!==void 0&&d===void 0&&y==="pending"){let M;s?.isPlaceholderData&&n.placeholderData===o?.placeholderData?(M=s.data,v=!0):M=typeof n.placeholderData=="function"?n.placeholderData(this.#h?.state.data,this.#h):n.placeholderData,M!==void 0&&(y="success",d=fo(s?.data,M,n),g=!0)}if(n.select&&d!==void 0&&!v)if(s&&d===i?.data&&n.select===this.#m)d=this.#f;else try{this.#m=n.select,d=n.select(d),d=fo(s?.data,d,n),this.#f=d,this.#a=null}catch(M){this.#a=M}this.#a&&(p=this.#a,d=this.#f,h=Date.now(),y="error");const x=m.fetchStatus==="fetching",w=y==="pending",S=y==="error",k=w&&x,O=d!==void 0,C={status:y,fetchStatus:m.fetchStatus,isPending:w,isSuccess:y==="success",isError:S,isInitialLoading:k,isLoading:k,data:d,dataUpdatedAt:m.dataUpdatedAt,error:p,errorUpdatedAt:h,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:m.dataUpdateCount>0||m.errorUpdateCount>0,isFetchedAfterMount:m.dataUpdateCount>c.dataUpdateCount||m.errorUpdateCount>c.errorUpdateCount,isFetching:x,isRefetching:x&&!w,isLoadingError:S&&!O,isPaused:m.fetchStatus==="paused",isPlaceholderData:g,isRefetchError:S&&O,isStale:Ei(e,n),refetch:this.refetch,promise:this.#o,isEnabled:He(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const M=F=>{C.status==="error"?F.reject(C.error):C.data!==void 0&&F.resolve(C.data)},N=()=>{const F=this.#o=C.promise=co();M(F)},R=this.#o;switch(R.status){case"pending":e.queryHash===t.queryHash&&M(R);break;case"fulfilled":(C.status==="error"||C.data!==R.value)&&N();break;case"rejected":(C.status!=="error"||C.error!==R.reason)&&N();break}}return C}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),ir(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(o=>{const l=o;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){Cr.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(this.#t)}),this.#n.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function Sf(e,n){return He(n.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&n.retryOnMount===!1)}function Co(e,n){return Sf(e,n)||e.state.data!==void 0&&As(e,n,n.refetchOnMount)}function As(e,n,t){if(He(n.enabled,e)!==!1&&xn(n.staleTime,e)!=="static"){const r=typeof t=="function"?t(e):t;return r==="always"||r!==!1&&Ei(e,n)}return!1}function To(e,n,t,r){return(e!==n||He(r.enabled,e)===!1)&&(!t.suspense||e.state.status!=="error")&&Ei(e,t)}function Ei(e,n){return He(n.enabled,e)!==!1&&e.isStaleByTime(xn(n.staleTime,e))}function kf(e,n){return!ir(e.getCurrentResult(),n)}var Mf=class extends va{#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),ir(this.options,n)||this.#n.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#r,observer:this}),n?.mutationKey&&this.options.mutationKey&&ho(n.mutationKey)!==ho(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??xu();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){Cr.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)})})}},pl=a.createContext(!1),Cf=()=>a.useContext(pl);pl.Provider;function Tf(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var Rf=a.createContext(Tf()),Of=()=>a.useContext(Rf),Ff=(e,n)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(n.isReset()||(e.retryOnMount=!1))},If=e=>{a.useEffect(()=>{e.clearReset()},[e])},Vf=({result:e,errorResetBoundary:n,throwOnError:t,query:r,suspense:s})=>e.isError&&!n.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||ba(t,[e.error,r])),Af=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))}},Pf=(e,n)=>e.isLoading&&e.isFetching&&!n,jf=(e,n)=>e?.suspense&&n.isPending,Ro=(e,n,t)=>n.fetchOptimistic(e).catch(()=>{t.clearReset()});function Nf(e,n,t){const r=Cf(),s=Of(),i=xa(),o=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=r?"isRestoring":"optimistic",Af(o),Ff(o,s),If(s);const l=!i.getQueryCache().get(o.queryHash),[c]=a.useState(()=>new n(i,o)),u=c.getOptimisticResult(o),m=!r&&e.subscribed!==!1;if(a.useSyncExternalStore(a.useCallback(g=>{const d=m?c.subscribe(Cr.batchCalls(g)):or;return c.updateResult(),d},[c,m]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),a.useEffect(()=>{c.setOptions(o)},[o,c]),jf(o,u))throw Ro(o,c,s);if(Vf({result:u,errorResetBoundary:s,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw u.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(o,u),o.experimental_prefetchInRender&&!bs&&Pf(u,r)&&(l?Ro(o,c,s):i.getQueryCache().get(o.queryHash)?.promise)?.catch(or).finally(()=>{c.updateResult()}),o.notifyOnChangeProps?u:c.trackResult(u)}function Si(e,n){return Nf(e,Ef)}function ml(e,n){const t=xa(),[r]=a.useState(()=>new Mf(t,e));a.useEffect(()=>{r.setOptions(e)},[r,e]);const s=a.useSyncExternalStore(a.useCallback(o=>r.subscribe(Cr.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=a.useCallback((o,l)=>{r.mutate(o,l).catch(or)},[r]);if(s.error&&ba(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}const Lf=(e,...n)=>e.reduce((t,r,s)=>`${t}${r}${s in n?String(n[s]):""}`,""),Df=Lf`
7
+ query Spaces($accountAddress: String!) {
8
+ spaces(filter: {members: {some: {address: {is: $accountAddress}}}}) {
9
+ id
10
+ spaceAddress
11
+ page {
12
+ name
13
+ }
14
+ }
15
+ }
16
+ `,$f=e=>{const n=es(ts,l=>l.context.identity?.accountAddress),t=Si({queryKey:["hypergraph-spaces",e.mode],queryFn:async()=>{const l=await wu(`${Us}/graphql`,Df,{accountAddress:n});return l?.spaces?l.spaces.map(c=>({id:c.id,name:c.page?.name,spaceAddress:c.spaceAddress})):[]},enabled:e.mode==="public"&&!!n}),{isConnecting:r,listSpaces:s}=Ys();a.useEffect(()=>{e.mode==="private"&&!r&&s()},[e.mode,s,r]);const i=es(ts,l=>l.context.spaces),o=es(ts,l=>l.context.spacesLoadingIsPending);return e.mode==="private"?{data:i,isPending:o}:t},_f=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===Eu.id?"TESTNET":"MAINNET",l=(await hf({name:e,ops:n,author:s,network:i})).cid,c=await fetch(`${Us}/space/${r}/edit/calldata`,{method:"POST",body:JSON.stringify({cid:l})}),{to:u,data:m}=await c.json();return{txResult:await t.sendUserOperation({calls:[{to:u,value:0n,data:m}]}),to:u,data:m,cid:l}};function kn(e,n,t=!0){return e.filter(s=>s.parentId===n&&(!t||s.context?.open)).flatMap(s=>[s,...kn(e,s.id,t)])}function Hf(e){return"nativeEvent"in e}function pr(e,n){const t=["mouse","pen"];return t.push("",void 0),t.includes(e)}const gl={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},is=a.forwardRef(function(n,t){const[r,s]=a.useState();Fe(()=>{wa&&s("button")},[]);const i={ref:t,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,style:gl};return f.jsx("span",{...n,...i,"data-base-ui-focus-guard":""})}),Bf=a.createContext(void 0);function Oo(e,n,t,r){const s=Qs(yl).current;return zf(s,e,n,t,r)&&vl(s,[e,n,t,r]),s.callback}function Zf(e){const n=Qs(yl).current;return Uf(n,e)&&vl(n,e),n.callback}function yl(){return{callback:null,cleanup:null,refs:[]}}function zf(e,n,t,r,s){return e.refs[0]!==n||e.refs[1]!==t||e.refs[2]!==r||e.refs[3]!==s}function Uf(e,n){return e.refs.length!==n.length||e.refs.some((t,r)=>t!==n[r])}function vl(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 o=i(t);typeof o=="function"&&(r[s]=o);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 o=r[s];typeof o=="function"?o():i(null);break}case"object":{i.current=null;break}}}}}}}const qf=parseInt(a.version,10);function bl(e){return qf>=e}function xl(e,n){if(e&&!n)return e;if(!e&&n)return n;if(e||n)return{...e,...n}}function Gf(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 Wf(e,n){return typeof e=="function"?e(n):e}const Mn={};function wl(e,n,t,r,s){let i={...Ps(e,Mn)};return n&&(i=Xn(i,n)),t&&(i=Xn(i,t)),r&&(i=Xn(i,r)),i}function Kf(e){if(e.length===0)return Mn;if(e.length===1)return Ps(e[0],Mn);let n={...Ps(e[0],Mn)};for(let t=1;t<e.length;t+=1)n=Xn(n,e[t]);return n}function Xn(e,n){return El(n)?n(e):Yf(e,n)}function Yf(e,n){if(!n)return e;for(const t in n){const r=n[t];switch(t){case"style":{e[t]=xl(e.style,r);break}case"className":{e[t]=Sl(e.className,r);break}default:Qf(t,r)?e[t]=Xf(e[t],r):e[t]=r}}return e}function Qf(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 El(e){return typeof e=="function"}function Ps(e,n){return El(e)?e(n):e??Mn}function Xf(e,n){return n?e?t=>{if(Jf(t)){const s=t;js(s);const i=n(s);return s.baseUIHandlerPrevented||e?.(s),i}const r=n(t);return e?.(t),r}:n:e}function js(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function Sl(e,n){return n?e?n+" "+e:n:e}function Jf(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}const eh={style:{transition:"none"}},St={},th={fallbackAxisSide:"end"};function ft(e,n,t={}){const r=n.render,s=nh(n,t);if(t.enabled===!1)return null;const i=t.state??St;return rh(e,r,s,i)}function nh(e,n={}){const{className:t,render:r}=e,{state:s=St,ref:i,props:o,disableStyleHooks:l,customStyleHookMapping:c,enabled:u=!0}=n,m=u?Wf(t,s):void 0;let g;l!==!0&&(g=a.useMemo(()=>u?Gf(s,c):St,[s,c,u]));const d=u?xl(g,Array.isArray(o)?Kf(o):o)??St:St;return typeof document<"u"&&(u?Array.isArray(i)?d.ref=Zf([d.ref,Fo(r),...i]):d.ref=Oo(d.ref,Fo(r),i):Oo(null,null)),u?(m!==void 0&&(d.className=Sl(d.className,m)),d):St}function rh(e,n,t,r){if(n){if(typeof n=="function")return n(t,r);const s=wl(t,n.props);return s.ref=t.ref,a.cloneElement(n,s)}if(e&&typeof e=="string")return sh(e,t);throw new Error("Base UI: Render element or function are not defined.")}function sh(e,n){return e==="button"?f.jsx("button",{type:"button",...n}):e==="img"?f.jsx("img",{alt:"",...n}):a.createElement(e,n)}function Fo(e){return e&&typeof e!="function"?bl(19)?e.props.ref:e.ref:null}const ih=a.forwardRef(function(n,t){const{render:r,className:s,children:i,...o}=n,{toasts:l,pauseTimers:c,resumeTimers:u,setHovering:m,setFocused:g,viewportRef:d,windowFocusedRef:p,prevFocusElement:h,setPrevFocusElement:y,hovering:v,focused:x,hasDifferingHeights:w}=Xs(),S=a.useRef(!1),k=rt(x),O=l.length;a.useEffect(()=>{if(!d.current)return;function L(H){O!==0&&H.key==="F6"&&H.target!==d.current&&(H.preventDefault(),y(Ct(zt(d.current))),d.current?.focus(),c(),g(!0))}const P=Ze(d.current);return P.addEventListener("keydown",L),()=>{P.removeEventListener("keydown",L)}},[c,g,y,O,d]),a.useEffect(()=>{if(!d.current||!O)return;const L=Ze(d.current);function P(z){z.target===L&&(p.current=!1,c())}function H(z){if(z.relatedTarget||z.target===L)return;const K=Be(z),q=Ct(zt(d.current));(!Ie(d.current,K)||!Qn(q))&&u(),setTimeout(()=>{p.current=!0})}return L.addEventListener("blur",P,!0),L.addEventListener("focus",H,!0),()=>{L.removeEventListener("blur",P,!0),L.removeEventListener("focus",H,!0)}},[c,u,d,p,g,k,O]);function b(L){d.current&&(S.current=!0,L.relatedTarget===d.current?l[0]?.ref?.current?.focus():h?.focus({preventScroll:!0}))}function C(L){L.key==="Tab"&&L.shiftKey&&L.target===d.current&&(L.preventDefault(),h?.focus({preventScroll:!0}),u())}function M(){c(),m(!0)}function N(){const L=Ct(zt(d.current));Ie(d.current,L)&&Qn(L)||(u(),m(!1))}function R(){if(S.current){S.current=!1;return}if(x)return;const L=Ct(zt(d.current));!p.current&&!Qn(L)||(g(!0),c())}function F(L){!x||Ie(d.current,L.relatedTarget)||(g(!1),u())}const T={tabIndex:-1,role:"region","aria-live":"polite","aria-atomic":!1,"aria-relevant":"additions text","aria-label":"Notifications",onMouseEnter:M,onMouseMove:M,onMouseLeave:N,onFocus:R,onBlur:F,onKeyDown:C,onClick:R},E=a.useMemo(()=>({expanded:v||x||w}),[v,x,w]),I=ft("div",n,{ref:[t,d],state:E,props:[T,{...o,children:f.jsxs(a.Fragment,{children:[O>0&&h&&f.jsx(is,{onFocus:b}),i,O>0&&h&&f.jsx(is,{onFocus:b})]})}]}),j=a.useMemo(()=>({viewportRef:d}),[d]),U=a.useMemo(()=>l.filter(L=>L.priority==="high"),[l]);return f.jsxs(Bf.Provider,{value:j,children:[O>0&&h&&f.jsx(is,{onFocus:b}),I,!x&&U.length>0&&f.jsx("div",{style:gl,children:U.map(L=>f.jsxs("div",{role:"alert","aria-atomic":!0,children:[f.jsx("div",{children:L.title}),f.jsx("div",{children:L.description})]},L.id))})]})});function oh(e){return bl(19)?e:e?"true":void 0}const kl=a.createContext(void 0);function Rn(){const e=a.useContext(kl);if(!e)throw new Error("Base UI: ToastRootContext is missing. Toast parts must be used within <Toast.Root>.");return e}let mr=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const ah={[mr.startingStyle]:""},lh={[mr.endingStyle]:""},Ml={transitionStatus(e){return e==="starting"?ah:e==="ending"?lh:null}},Un=null;class ch{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 qn=new ch;class tt{static create(){return new tt}static request(n){return qn.request(n)}static cancel(n){return qn.cancel(n)}currentId=Un;request(n){this.cancel(),this.currentId=qn.request(()=>{this.currentId=Un,n()})}cancel=()=>{this.currentId!==Un&&(qn.cancel(this.currentId),this.currentId=Un)};disposeEffect=()=>this.cancel}function uh(){const e=Qs(tt.create).current;return Su(e.disposeEffect),e}function dh(e,n=!1){const t=uh();return ae((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 o(){i&&Promise.allSettled(i.getAnimations().map(l=>l.finished)).then(()=>{s!=null&&s.aborted||Re.flushSync(r)})}n?t.request(o):o()})})}function ki(e){const{enabled:n=!0,open:t,ref:r,onComplete:s}=e,i=rt(t),o=ae(s),l=dh(r,t);a.useEffect(()=>{n&&l(()=>{t===i.current&&o()})},[n,t,o,l,i])}let _t=(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 fh={...Ml,swipeDirection(e){return e?{"data-swipe-direction":e}:null}},yn=40,hh=10,mt=.5,ph=1;function Io(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 mh(e){const t=window.getComputedStyle(e).transform;let r=0,s=0,i=1;if(t&&t!=="none"){const o=t.match(/matrix(?:3d)?\(([^)]+)\)/);if(o){const l=o[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 gh=a.forwardRef(function(n,t){const{toast:r,render:s,className:i,swipeDirection:o=["down","right"],...l}=n,c=Array.isArray(o)?o:[o],{toasts:u,hovering:m,focused:g,close:d,remove:p,setToasts:h,pauseTimers:y,resumeTimers:v,hasDifferingHeights:x}=Xs(),[w,S]=a.useState(void 0),[k,O]=a.useState(!1),[b,C]=a.useState(!1),[M,N]=a.useState(!1),[R,F]=a.useState({x:0,y:0}),[T,E]=a.useState({x:0,y:0,scale:1}),[I,j]=a.useState(),[U,L]=a.useState(),[P,H]=a.useState(null),z=a.useRef(null),K=a.useRef({x:0,y:0}),q=a.useRef({x:0,y:0,scale:1}),$=a.useRef(void 0),B=a.useRef(0),X=a.useRef(!1),A=a.useRef({x:0,y:0}),V=a.useRef(!1),D=a.useMemo(()=>u.indexOf(r),[r,u]),_=a.useMemo(()=>u.filter(Q=>Q.transitionStatus!=="ending").indexOf(r),[r,u]),G=a.useMemo(()=>u.slice(0,u.indexOf(r)).reduce((Q,J)=>Q+(J.height||0),0),[u,r]);ki({open:r.transitionStatus!=="ending",ref:z,onComplete(){r.transitionStatus==="ending"&&p(r.id)}}),a.useEffect(()=>{if(!z.current)return;function Q(){const J=z.current?.offsetHeight;h(ue=>ue.map(de=>de.id===r.id?{...de,ref:z,height:J,transitionStatus:void 0}:de))}if(Q(),typeof ResizeObserver=="function"){const J=new ResizeObserver(Q);return J.observe(z.current),()=>{J.disconnect()}}},[r.id,h]);function ce(Q,J){let ue=Q,de=J;return!c.includes("left")&&!c.includes("right")?ue=Q>0?Q**mt:-(Math.abs(Q)**mt):(!c.includes("right")&&Q>0&&(ue=Q**mt),!c.includes("left")&&Q<0&&(ue=-(Math.abs(Q)**mt))),!c.includes("up")&&!c.includes("down")?de=J>0?J**mt:-(Math.abs(J)**mt):(!c.includes("down")&&J>0&&(de=J**mt),!c.includes("up")&&J<0&&(de=-(Math.abs(J)**mt))),{x:ue,y:de}}function me(Q){if(Q.button!==0)return;Q.pointerType==="touch"&&y();const J=Be(Q.nativeEvent);if(!(J&&J.closest('button,a,input,textarea,[role="button"],[data-swipe-ignore]'))){if(X.current=!1,$.current=void 0,B.current=0,K.current={x:Q.clientX,y:Q.clientY},A.current=K.current,z.current){const de=mh(z.current);q.current=de,E(de),F({x:de.x,y:de.y})}O(!0),C(!1),H(null),V.current=!0,z.current?.setPointerCapture(Q.pointerId)}}function ze(Q){if(!k)return;Q.preventDefault(),V.current&&(K.current={x:Q.clientX,y:Q.clientY},V.current=!1);const{clientY:J,clientX:ue,movementX:de,movementY:_e}=Q;(_e<0&&J>A.current.y||_e>0&&J<A.current.y)&&(A.current={x:A.current.x,y:J}),(de<0&&ue>A.current.x||de>0&&ue<A.current.x)&&(A.current={x:ue,y:A.current.y});const se=ue-K.current.x,fe=J-K.current.y,Ne=J-A.current.y,Le=ue-A.current.x;if(!b&&Math.sqrt(se*se+fe*fe)>=ph&&(C(!0),P===null)){const $t=c.includes("left")||c.includes("right"),Kr=c.includes("up")||c.includes("down");if($t&&Kr){const Yr=Math.abs(se),Qr=Math.abs(fe);H(Yr>Qr?"horizontal":"vertical")}}let Oe;if(!$.current)P==="vertical"?fe>0?Oe="down":fe<0&&(Oe="up"):P==="horizontal"?se>0?Oe="right":se<0&&(Oe="left"):Math.abs(se)>=Math.abs(fe)?Oe=se>0?"right":"left":Oe=fe>0?"down":"up",Oe&&c.includes(Oe)&&($.current=Oe,B.current=Io(Oe,se,fe),S(Oe));else{const Dt=$.current,$t=Io(Dt,Le,Ne);$t>yn?(X.current=!1,S(Dt)):B.current-$t>=hh&&(X.current=!0)}const pt=ce(se,fe);let Lt=q.current.x,gn=q.current.y;P==="horizontal"?(c.includes("left")||c.includes("right"))&&(Lt+=pt.x):(P==="vertical"||(c.includes("left")||c.includes("right"))&&(Lt+=pt.x),(c.includes("up")||c.includes("down"))&&(gn+=pt.y)),F({x:Lt,y:gn})}function Nt(Q){if(!k)return;if(Q.pointerType==="touch"&&!g&&v(),O(!1),C(!1),H(null),z.current?.releasePointerCapture(Q.pointerId),X.current){F({x:T.x,y:T.y}),S(void 0);return}let J=!1;const ue=R.x-T.x,de=R.y-T.y;let _e;for(const se of c){switch(se){case"right":ue>yn&&(J=!0,_e="right");break;case"left":ue<-yn&&(J=!0,_e="left");break;case"down":de>yn&&(J=!0,_e="down");break;case"up":de<-yn&&(J=!0,_e="up");break}if(J)break}J?(S(_e),N(!0),d(r.id)):(F({x:T.x,y:T.y}),S(void 0))}function bt(Q){if(Q.key==="Escape"){if(!z.current||!Ie(z.current,Ct(zt(z.current))))return;d(r.id)}}a.useEffect(()=>{const Q=z.current;if(!Q)return;function J(ue){Ie(Q,ue.target)&&ue.preventDefault()}return Q.addEventListener("touchmove",J,{passive:!1}),()=>{Q.removeEventListener("touchmove",J)}},[]);function Se(){if(!k&&R.x===T.x&&R.y===T.y&&!M)return{[_t.swipeMovementX]:"0px",[_t.swipeMovementY]:"0px"};const Q=R.x-T.x,J=R.y-T.y;return{transition:k?"none":void 0,[_t.swipeMovementX]:`${Q}px`,[_t.swipeMovementY]:`${J}px`}}const je=r.priority==="high",xt={role:je?"alertdialog":"dialog",tabIndex:0,"aria-modal":!1,"aria-labelledby":I,"aria-describedby":U,"aria-hidden":je&&!g?!0:void 0,onPointerDown:me,onPointerMove:ze,onPointerUp:Nt,onKeyDown:bt,inert:oh(r.limited),style:{...Se(),[_t.index]:r.transitionStatus==="ending"?D:_,[_t.offsetY]:`${G}px`}},$e=a.useMemo(()=>({rootRef:z,toast:r,titleId:I,setTitleId:j,descriptionId:U,setDescriptionId:L,swiping:k,swipeDirection:w}),[r,I,U,k,w]),ht=a.useMemo(()=>({transitionStatus:r.transitionStatus,expanded:m||g||x,limited:r.limited||!1,type:r.type,swiping:$e.swiping,swipeDirection:$e.swipeDirection}),[m,g,x,r.transitionStatus,r.limited,r.type,$e.swiping,$e.swipeDirection]),mn=ft("div",n,{ref:[t,$e.rootRef],state:ht,customStyleHookMapping:fh,props:[xt,l]});return f.jsx(kl.Provider,{value:$e,children:mn})}),yh=a.forwardRef(function(n,t){const{render:r,className:s,id:i,children:o,...l}=n,{toast:c}=Rn(),u=o??c.description,m=!!u,g=Js(i),{setDescriptionId:d}=Rn();Fe(()=>{if(m)return d(g),()=>{d(void 0)}},[m,g,d]);const p=a.useMemo(()=>({type:c.type}),[c.type]),h=ft("p",n,{ref:t,state:p,props:{...l,id:g,children:u}});return m?h:null}),vh=a.forwardRef(function(n,t){const{render:r,className:s,id:i,children:o,...l}=n,{toast:c}=Rn(),u=o??c.title,m=!!u,g=Js(i),{setTitleId:d}=Rn();Fe(()=>{if(m)return d(g),()=>{d(void 0)}},[m,g,d]);const p=a.useMemo(()=>({type:c.type}),[c.type]),h=ft("h2",n,{ref:t,state:p,props:{...l,id:g,children:u}});return m?h:null}),bh=a.createContext(void 0);function xh(e=!1){const n=a.useContext(bh);if(n===void 0&&!e)throw new Error("Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.");return n}function wh(e){const{focusableWhenDisabled:n,disabled:t,composite:r=!1,tabIndex:s=0,isNativeButton:i}=e,o=r&&n!==!1,l=r&&n===!1;return{props:a.useMemo(()=>{const u={onKeyDown(m){t&&n&&m.key!=="Tab"&&m.preventDefault()}};return r||(u.tabIndex=s,!i&&t&&(u.tabIndex=n?s:-1)),(i&&(n||o)||!i&&t)&&(u["aria-disabled"]=t),i&&(!n||l)&&(u.disabled=t),u},[r,t,n,o,l,i,s])}}function Eh(e={}){const{disabled:n=!1,focusableWhenDisabled:t,tabIndex:r=0,native:s=!0}=e,i=a.useRef(null),o=xh(!0)!==void 0,l=ae(()=>{const m=i.current;return!!(m?.tagName==="A"&&m?.href)}),{props:c}=wh({focusableWhenDisabled:t,disabled:n,composite:o,tabIndex:r,isNativeButton:s});return Fe(()=>{const m=i.current;m instanceof HTMLButtonElement&&o&&n&&c.disabled===void 0&&m.disabled&&(m.disabled=!1)},[n,c.disabled,o]),{getButtonProps:a.useCallback((m={})=>{const{onClick:g,onMouseDown:d,onKeyUp:p,onKeyDown:h,onPointerDown:y,...v}=m;return wl({type:s?"button":void 0,onClick(w){if(n){w.preventDefault();return}g?.(w)},onMouseDown(w){n||d?.(w)},onKeyDown(w){if(n||(js(w),h?.(w)),w.baseUIHandlerPrevented)return;const S=w.target===w.currentTarget&&!s&&!l()&&!n,k=w.key==="Enter",O=w.key===" ";S&&((O||k)&&w.preventDefault(),k&&g?.(w))},onKeyUp(w){n||(js(w),p?.(w)),!w.baseUIHandlerPrevented&&w.target===w.currentTarget&&!s&&!n&&w.key===" "&&g?.(w)},onPointerDown(w){if(n){w.preventDefault();return}y?.(w)}},s?void 0:{role:"button"},c,v)},[n,c,s,l]),buttonRef:i}}const Sh=a.forwardRef(function(n,t){const{render:r,className:s,disabled:i,nativeButton:o=!0,...l}=n,{close:c,focused:u}=Xs(),{toast:m}=Rn(),{getButtonProps:g,buttonRef:d}=Eh({disabled:i,native:o}),p=a.useMemo(()=>({type:m.type}),[m.type]);return ft("button",n,{ref:[t,d],state:p,props:[{"aria-hidden":!u||void 0,onClick(){c(m.id)}},l,g]})});function kh(){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 Mh=a.createContext(null),Ch=a.createContext(null),Cl=()=>a.useContext(Mh)?.id||null,Mi=()=>a.useContext(Ch),Vo=ei("safe-polygon");function Jn(e,n,t){if(t&&!pr(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 os(e){return typeof e=="function"?e():e}function Th(e,n={}){const{open:t,onOpenChange:r,dataRef:s,events:i,elements:o}=e,{enabled:l=!0,delay:c=0,handleClose:u=null,mouseOnly:m=!1,restMs:g=0,move:d=!0}=n,p=Mi(),h=Cl(),y=rt(u),v=rt(c),x=rt(t),w=rt(g),S=a.useRef(void 0),k=tn(),O=a.useRef(void 0),b=tn(),C=a.useRef(!0),M=a.useRef(!1),N=a.useRef(()=>{}),R=a.useRef(!1),F=ae(()=>{const L=s.current.openEvent?.type;return L?.includes("mouse")&&L!=="mousedown"});a.useEffect(()=>{if(!l)return;function L({open:P}){P||(k.clear(),b.clear(),C.current=!0,R.current=!1)}return i.on("openchange",L),()=>{i.off("openchange",L)}},[l,i,k,b]),a.useEffect(()=>{if(!l||!y.current||!t)return;function L(H){F()&&r(!1,H,"hover")}const P=Tt(o.floating).documentElement;return P.addEventListener("mouseleave",L),()=>{P.removeEventListener("mouseleave",L)}},[o.floating,t,r,l,y,F]);const T=a.useCallback((L,P=!0,H="hover")=>{const z=Jn(v.current,"close",S.current);z&&!O.current?k.start(z,()=>r(!1,L,H)):P&&(k.clear(),r(!1,L,H))},[v,r,k]),E=ae(()=>{N.current(),O.current=void 0}),I=ae(()=>{if(M.current){const L=Tt(o.floating).body;L.style.pointerEvents="",L.removeAttribute(Vo),M.current=!1}}),j=ae(()=>s.current.openEvent?["click","mousedown"].includes(s.current.openEvent.type):!1);a.useEffect(()=>{if(!l)return;function L(q){if(k.clear(),C.current=!1,m&&!pr(S.current)||os(w.current)>0&&!Jn(v.current,"open"))return;const $=Jn(v.current,"open",S.current);$?k.start($,()=>{x.current||r(!0,q,"hover")}):t||r(!0,q,"hover")}function P(q){if(j()){I();return}N.current();const $=Tt(o.floating);if(b.clear(),R.current=!1,y.current&&s.current.floatingContext){t||k.clear(),O.current=y.current({...s.current.floatingContext,tree:p,x:q.clientX,y:q.clientY,onClose(){I(),E(),j()||T(q,!0,"safe-polygon")}});const X=O.current;$.addEventListener("mousemove",X),N.current=()=>{$.removeEventListener("mousemove",X)};return}(S.current==="touch"?!Ie(o.floating,q.relatedTarget):!0)&&T(q)}function H(q){j()||s.current.floatingContext&&y.current?.({...s.current.floatingContext,tree:p,x:q.clientX,y:q.clientY,onClose(){I(),E(),j()||T(q)}})(q)}function z(){k.clear()}function K(q){j()||T(q,!1)}if(he(o.domReference)){const q=o.domReference,$=o.floating;return t&&q.addEventListener("mouseleave",H),d&&q.addEventListener("mousemove",L,{once:!0}),q.addEventListener("mouseenter",L),q.addEventListener("mouseleave",P),$&&($.addEventListener("mouseleave",H),$.addEventListener("mouseenter",z),$.addEventListener("mouseleave",K)),()=>{t&&q.removeEventListener("mouseleave",H),d&&q.removeEventListener("mousemove",L),q.removeEventListener("mouseenter",L),q.removeEventListener("mouseleave",P),$&&($.removeEventListener("mouseleave",H),$.removeEventListener("mouseenter",z),$.removeEventListener("mouseleave",K))}}},[o,l,e,m,d,T,E,I,r,t,x,p,v,y,s,j,w,k,b]),Fe(()=>{if(l&&t&&y.current?.__options?.blockPointerEvents&&F()){M.current=!0;const L=o.floating;if(he(o.domReference)&&L){const P=Tt(o.floating).body;P.setAttribute(Vo,"");const H=o.domReference,z=p?.nodesRef.current.find(K=>K.id===h)?.context?.elements.floating;return z&&(z.style.pointerEvents=""),P.style.pointerEvents="none",H.style.pointerEvents="auto",L.style.pointerEvents="auto",()=>{P.style.pointerEvents="",H.style.pointerEvents="",L.style.pointerEvents=""}}}},[l,t,h,o,p,y,F]),Fe(()=>{t||(S.current=void 0,R.current=!1,E(),I())},[t,E,I]),a.useEffect(()=>()=>{E(),k.clear(),b.clear(),I()},[l,o.domReference,E,I,k,b]);const U=a.useMemo(()=>{function L(P){S.current=P.pointerType}return{onPointerDown:L,onPointerEnter:L,onMouseMove(P){const{nativeEvent:H}=P;function z(){!C.current&&!x.current&&r(!0,H,"hover")}m&&!pr(S.current)||t||os(w.current)===0||R.current&&P.movementX**2+P.movementY**2<2||(b.clear(),S.current==="touch"?z():(R.current=!0,b.start(os(w.current),z)))}}},[m,r,t,x,w,b]);return a.useMemo(()=>l?{reference:U}:{},[l,U])}const Tl=a.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new ti,currentIdRef:{current:null},currentContextRef:{current:null}});function Rh(e){const{children:n,delay:t,timeoutMs:r=0}=e,s=a.useRef(t),i=a.useRef(t),o=a.useRef(null),l=a.useRef(null),c=tn();return f.jsx(Tl.Provider,{value:a.useMemo(()=>({hasProvider:!0,delayRef:s,initialDelayRef:i,currentIdRef:o,timeoutMs:r,currentContextRef:l,timeout:c}),[r,c]),children:n})}function Oh(e,n={}){const{open:t,onOpenChange:r,floatingId:s}=e,{enabled:i=!0}=n,o=a.useContext(Tl),{currentIdRef:l,delayRef:c,timeoutMs:u,initialDelayRef:m,currentContextRef:g,hasProvider:d,timeout:p}=o,[h,y]=a.useState(!1);return Fe(()=>{function v(){y(!1),g.current?.setIsInstantPhase(!1),l.current=null,g.current=null,c.current=m.current}if(i&&l.current&&!t&&l.current===s){if(y(!1),u)return p.start(u,v),()=>{p.clear()};v()}},[i,t,s,l,c,u,m,g,p]),Fe(()=>{if(!i||!t)return;const v=g.current,x=l.current;g.current={onOpenChange:r,setIsInstantPhase:y},l.current=s,c.current={open:0,close:Jn(m.current,"close")},x!==null&&x!==s?(p.clear(),y(!0),v?.setIsInstantPhase(!0),v?.onOpenChange(!1)):(y(!1),v?.setIsInstantPhase(!1))},[i,t,s,r,l,c,u,m,g,p]),Fe(()=>()=>{g.current=null},[g]),a.useMemo(()=>({hasProvider:d,delayRef:c,isInstantPhase:h}),[d,c,h])}function Fh(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},o=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 u=i.width,m=i.height,g=i.x,d=i.y;return t==null&&n.x&&o&&(t=i.x-n.x),r==null&&n.y&&l&&(r=i.y-n.y),g-=t||0,d-=r||0,u=0,m=0,!s||c?(u=n.axis==="y"?i.width:0,m=n.axis==="x"?i.height:0,g=o&&n.x!=null?n.x:g,d=l&&n.y!=null?n.y:d):s&&!c&&(m=n.axis==="x"?i.height:m,u=n.axis==="y"?i.width:u),s=!0,{width:u,height:m,x:g,y:d,top:d,right:g+u,bottom:d+m,left:g}}}}function Ao(e){return e!=null&&e.clientX!=null}function Ih(e,n={}){const{open:t,dataRef:r,elements:{floating:s,domReference:i},refs:o}=e,{enabled:l=!0,axis:c="both",x:u=null,y:m=null}=n,g=a.useRef(!1),d=a.useRef(null),[p,h]=a.useState(),[y,v]=a.useState([]),x=ae((b,C)=>{g.current||r.current.openEvent&&!Ao(r.current.openEvent)||o.setPositionReference(Fh(i,{x:b,y:C,axis:c,dataRef:r,pointerType:p}))}),w=ae(b=>{u!=null||m!=null||(t?d.current||v([]):x(b.clientX,b.clientY))}),S=pr(p)?s:t,k=a.useCallback(()=>{if(!S||!l||u!=null||m!=null)return;const b=Ze(s);function C(M){const N=Be(M);Ie(s,N)?(b.removeEventListener("mousemove",C),d.current=null):x(M.clientX,M.clientY)}if(!r.current.openEvent||Ao(r.current.openEvent)){b.addEventListener("mousemove",C);const M=()=>{b.removeEventListener("mousemove",C),d.current=null};return d.current=M,M}o.setPositionReference(i)},[S,l,u,m,s,r,o,i,x]);a.useEffect(()=>k(),[k,y]),a.useEffect(()=>{l&&!s&&(g.current=!1)},[l,s]),a.useEffect(()=>{!l&&t&&(g.current=!0)},[l,t]),Fe(()=>{l&&(u!=null||m!=null)&&(g.current=!1,x(u,m))},[l,u,m,x]);const O=a.useMemo(()=>{function b(C){h(C.pointerType)}return{onPointerDown:b,onPointerEnter:b,onMouseMove:w,onMouseEnter:w}},[w]);return a.useMemo(()=>l?{reference:O}:{},[l,O])}function Rl(e){const n=Qe(e);let t=parseFloat(n.width)||0,r=parseFloat(n.height)||0;const s=Xe(e),i=s?e.offsetWidth:t,o=s?e.offsetHeight:r,l=ar(t)!==i||ar(r)!==o;return l&&(t=i,r=o),{width:t,height:r,$:l}}function Ci(e){return he(e)?e:e.contextElement}function Xt(e){const n=Ci(e);if(!Xe(n))return Ke(1);const t=n.getBoundingClientRect(),{width:r,height:s,$:i}=Rl(n);let o=(i?ar(t.width):t.width)/r,l=(i?ar(t.height):t.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const Vh=Ke(0);function Ol(e){const n=Ze(e);return!ni()||!n.visualViewport?Vh:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function Ah(e,n,t){return n===void 0&&(n=!1),!t||n&&t!==Ze(e)?!1:n}function At(e,n,t,r){n===void 0&&(n=!1),t===void 0&&(t=!1);const s=e.getBoundingClientRect(),i=Ci(e);let o=Ke(1);n&&(r?he(r)&&(o=Xt(r)):o=Xt(e));const l=Ah(i,t,r)?Ol(i):Ke(0);let c=(s.left+l.x)/o.x,u=(s.top+l.y)/o.y,m=s.width/o.x,g=s.height/o.y;if(i){const d=Ze(i),p=r&&he(r)?Ze(r):r;let h=d,y=po(h);for(;y&&r&&p!==h;){const v=Xt(y),x=y.getBoundingClientRect(),w=Qe(y),S=x.left+(y.clientLeft+parseFloat(w.paddingLeft))*v.x,k=x.top+(y.clientTop+parseFloat(w.paddingTop))*v.y;c*=v.x,u*=v.y,m*=v.x,g*=v.y,c+=S,u+=k,h=Ze(y),y=po(h)}}return Ea({width:m,height:g,x:c,y:u})}function $r(e,n){const t=Tr(e).scrollLeft;return n?n.left+t:At(dt(e)).left+t}function Fl(e,n){const t=e.getBoundingClientRect(),r=t.left+n.scrollLeft-$r(e,t),s=t.top+n.scrollTop;return{x:r,y:s}}function Ph(e){let{elements:n,rect:t,offsetParent:r,strategy:s}=e;const i=s==="fixed",o=dt(r),l=n?ri(n.floating):!1;if(r===o||l&&i)return t;let c={scrollLeft:0,scrollTop:0},u=Ke(1);const m=Ke(0),g=Xe(r);if((g||!g&&!i)&&((si(r)!=="body"||ii(o))&&(c=Tr(r)),Xe(r))){const p=At(r);u=Xt(r),m.x=p.x+r.clientLeft,m.y=p.y+r.clientTop}const d=o&&!g&&!i?Fl(o,c):Ke(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-c.scrollLeft*u.x+m.x+d.x,y:t.y*u.y-c.scrollTop*u.y+m.y+d.y}}function jh(e){return Array.from(e.getClientRects())}function Nh(e){const n=dt(e),t=Tr(e),r=e.ownerDocument.body,s=Qt(n.scrollWidth,n.clientWidth,r.scrollWidth,r.clientWidth),i=Qt(n.scrollHeight,n.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+$r(e);const l=-t.scrollTop;return Qe(r).direction==="rtl"&&(o+=Qt(n.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}const Po=25;function Lh(e,n){const t=Ze(e),r=dt(e),s=t.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;const m=ni();(!m||m&&n==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const u=$r(r);if(u<=0){const m=r.ownerDocument,g=m.body,d=getComputedStyle(g),p=m.compatMode==="CSS1Compat"&&parseFloat(d.marginLeft)+parseFloat(d.marginRight)||0,h=Math.abs(r.clientWidth-g.clientWidth-p);h<=Po&&(i-=h)}else u<=Po&&(i+=u);return{width:i,height:o,x:l,y:c}}const Dh=new Set(["absolute","fixed"]);function $h(e,n){const t=At(e,!0,n==="fixed"),r=t.top+e.clientTop,s=t.left+e.clientLeft,i=Xe(e)?Xt(e):Ke(1),o=e.clientWidth*i.x,l=e.clientHeight*i.y,c=s*i.x,u=r*i.y;return{width:o,height:l,x:c,y:u}}function jo(e,n,t){let r;if(n==="viewport")r=Lh(e,t);else if(n==="document")r=Nh(dt(e));else if(he(n))r=$h(n,t);else{const s=Ol(e);r={x:n.x-s.x,y:n.y-s.y,width:n.width,height:n.height}}return Ea(r)}function Il(e,n){const t=nn(e);return t===n||!he(t)||Ft(t)?!1:Qe(t).position==="fixed"||Il(t,n)}function _h(e,n){const t=n.get(e);if(t)return t;let r=Yt(e,[],!1).filter(l=>he(l)&&si(l)!=="body"),s=null;const i=Qe(e).position==="fixed";let o=i?nn(e):e;for(;he(o)&&!Ft(o);){const l=Qe(o),c=Sa(o);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&Dh.has(s.position)||ii(o)&&!c&&Il(e,o))?r=r.filter(m=>m!==o):s=l,o=nn(o)}return n.set(e,r),r}function Hh(e){let{element:n,boundary:t,rootBoundary:r,strategy:s}=e;const o=[...t==="clippingAncestors"?ri(n)?[]:_h(n,this._c):[].concat(t),r],l=o[0],c=o.reduce((u,m)=>{const g=jo(n,m,s);return u.top=Qt(g.top,u.top),u.right=xs(g.right,u.right),u.bottom=xs(g.bottom,u.bottom),u.left=Qt(g.left,u.left),u},jo(n,l,s));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Bh(e){const{width:n,height:t}=Rl(e);return{width:n,height:t}}function Zh(e,n,t){const r=Xe(n),s=dt(n),i=t==="fixed",o=At(e,!0,i,n);let l={scrollLeft:0,scrollTop:0};const c=Ke(0);function u(){c.x=$r(s)}if(r||!r&&!i)if((si(n)!=="body"||ii(s))&&(l=Tr(n)),r){const p=At(n,!0,i,n);c.x=p.x+n.clientLeft,c.y=p.y+n.clientTop}else s&&u();i&&!r&&s&&u();const m=s&&!r&&!i?Fl(s,l):Ke(0),g=o.left+l.scrollLeft-c.x-m.x,d=o.top+l.scrollTop-c.y-m.y;return{x:g,y:d,width:o.width,height:o.height}}function as(e){return Qe(e).position==="static"}function No(e,n){if(!Xe(e)||Qe(e).position==="fixed")return null;if(n)return n(e);let t=e.offsetParent;return dt(e)===t&&(t=t.ownerDocument.body),t}function Vl(e,n){const t=Ze(e);if(ri(e))return t;if(!Xe(e)){let s=nn(e);for(;s&&!Ft(s);){if(he(s)&&!as(s))return s;s=nn(s)}return t}let r=No(e,n);for(;r&&Iu(r)&&as(r);)r=No(r,n);return r&&Ft(r)&&as(r)&&!Sa(r)?t:r||Vu(e)||t}const zh=async function(e){const n=this.getOffsetParent||Vl,t=this.getDimensions,r=await t(e.floating);return{reference:Zh(e.reference,await n(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Uh(e){return Qe(e).direction==="rtl"}const qh={convertOffsetParentRelativeRectToViewportRelativeRect:Ph,getDocumentElement:dt,getClippingRect:Hh,getOffsetParent:Vl,getElementRects:zh,getClientRects:jh,getDimensions:Bh,getScale:Xt,isElement:he,isRTL:Uh};function Al(e,n){return e.x===n.x&&e.y===n.y&&e.width===n.width&&e.height===n.height}function Gh(e,n){let t=null,r;const s=dt(e);function i(){var l;clearTimeout(r),(l=t)==null||l.disconnect(),t=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const u=e.getBoundingClientRect(),{left:m,top:g,width:d,height:p}=u;if(l||n(),!d||!p)return;const h=Hn(g),y=Hn(s.clientWidth-(m+d)),v=Hn(s.clientHeight-(g+p)),x=Hn(m),S={rootMargin:-h+"px "+-y+"px "+-v+"px "+-x+"px",threshold:Qt(0,xs(1,c))||1};let k=!0;function O(b){const C=b[0].intersectionRatio;if(C!==c){if(!k)return o();C?o(!1,C):r=setTimeout(()=>{o(!1,1e-7)},1e3)}C===1&&!Al(u,e.getBoundingClientRect())&&o(),k=!1}try{t=new IntersectionObserver(O,{...S,root:s.ownerDocument})}catch{t=new IntersectionObserver(O,S)}t.observe(e)}return o(!0),i}function Lo(e,n,t,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,u=Ci(e),m=s||i?[...u?Yt(u):[],...Yt(n)]:[];m.forEach(x=>{s&&x.addEventListener("scroll",t,{passive:!0}),i&&x.addEventListener("resize",t)});const g=u&&l?Gh(u,t):null;let d=-1,p=null;o&&(p=new ResizeObserver(x=>{let[w]=x;w&&w.target===u&&p&&(p.unobserve(n),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var S;(S=p)==null||S.observe(n)})),t()}),u&&!c&&p.observe(u),p.observe(n));let h,y=c?At(e):null;c&&v();function v(){const x=At(e);y&&!Al(y,x)&&t(),y=x,h=requestAnimationFrame(v)}return t(),()=>{var x;m.forEach(w=>{s&&w.removeEventListener("scroll",t),i&&w.removeEventListener("resize",t)}),g?.(),(x=p)==null||x.disconnect(),p=null,c&&cancelAnimationFrame(h)}}const Wh=ku,Kh=Cu,Yh=Mu,Qh=Ru,Xh=Ou,Jh=Tu,ep=(e,n,t)=>{const r=new Map,s={platform:qh,...t},i={...s.platform,_c:r};return Fu(e,n,{...s,platform:i})};var tp=typeof document<"u",np=function(){},er=tp?a.useLayoutEffect:np;function gr(e,n){if(e===n)return!0;if(typeof e!=typeof n)return!1;if(typeof e=="function"&&e.toString()===n.toString())return!0;let t,r,s;if(e&&n&&typeof e=="object"){if(Array.isArray(e)){if(t=e.length,t!==n.length)return!1;for(r=t;r--!==0;)if(!gr(e[r],n[r]))return!1;return!0}if(s=Object.keys(e),t=s.length,t!==Object.keys(n).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(n,s[r]))return!1;for(r=t;r--!==0;){const i=s[r];if(!(i==="_owner"&&e.$$typeof)&&!gr(e[i],n[i]))return!1}return!0}return e!==e&&n!==n}function Pl(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Do(e,n){const t=Pl(e);return Math.round(n*t)/t}function ls(e){const n=a.useRef(e);return er(()=>{n.current=e}),n}function rp(e){e===void 0&&(e={});const{placement:n="bottom",strategy:t="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:u}=e,[m,g]=a.useState({x:0,y:0,strategy:t,placement:n,middlewareData:{},isPositioned:!1}),[d,p]=a.useState(r);gr(d,r)||p(r);const[h,y]=a.useState(null),[v,x]=a.useState(null),w=a.useCallback(P=>{P!==b.current&&(b.current=P,y(P))},[]),S=a.useCallback(P=>{P!==C.current&&(C.current=P,x(P))},[]),k=i||h,O=o||v,b=a.useRef(null),C=a.useRef(null),M=a.useRef(m),N=c!=null,R=ls(c),F=ls(s),T=ls(u),E=a.useCallback(()=>{if(!b.current||!C.current)return;const P={placement:n,strategy:t,middleware:d};F.current&&(P.platform=F.current),ep(b.current,C.current,P).then(H=>{const z={...H,isPositioned:T.current!==!1};I.current&&!gr(M.current,z)&&(M.current=z,Re.flushSync(()=>{g(z)}))})},[d,n,t,F,T]);er(()=>{u===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,g(P=>({...P,isPositioned:!1})))},[u]);const I=a.useRef(!1);er(()=>(I.current=!0,()=>{I.current=!1}),[]),er(()=>{if(k&&(b.current=k),O&&(C.current=O),k&&O){if(R.current)return R.current(k,O,E);E()}},[k,O,E,R,N]);const j=a.useMemo(()=>({reference:b,floating:C,setReference:w,setFloating:S}),[w,S]),U=a.useMemo(()=>({reference:k,floating:O}),[k,O]),L=a.useMemo(()=>{const P={position:t,left:0,top:0};if(!U.floating)return P;const H=Do(U.floating,m.x),z=Do(U.floating,m.y);return l?{...P,transform:"translate("+H+"px, "+z+"px)",...Pl(U.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:H,top:z}},[t,l,U.floating,m.x,m.y]);return a.useMemo(()=>({...m,update:E,refs:j,elements:U,floatingStyles:L}),[m,E,j,U,L])}const sp=(e,n)=>({...Wh(e),options:[e,n]}),ip=(e,n)=>({...Kh(e),options:[e,n]}),op=(e,n)=>({...Jh(e),options:[e,n]}),ap=(e,n)=>({...Yh(e),options:[e,n]}),lp=(e,n)=>({...Qh(e),options:[e,n]}),cp=(e,n)=>({...Xh(e),options:[e,n]}),up={intentional:"onClick",sloppy:"onPointerDown"};function $o(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function dp(e,n={}){const{open:t,onOpenChange:r,elements:s,dataRef:i}=e,{enabled:o=!0,escapeKey:l=!0,outsidePress:c=!0,outsidePressEvent:u="sloppy",referencePress:m=!1,referencePressEvent:g="sloppy",ancestorScroll:d=!1,bubbles:p,capture:h}=n,y=Mi(),v=ae(typeof c=="function"?c:()=>!1),x=typeof c=="function"?v:c,w=a.useRef(!1),{escapeKey:S,outsidePress:k}=$o(p),{escapeKey:O,outsidePress:b}=$o(h),C=a.useRef(null),M=tn(),N=tn(),R=a.useRef(!1),F=a.useRef(""),T=ae(A=>{F.current=A.pointerType}),E=ae(()=>{const A=F.current,V=A==="pen"||!A?"mouse":A;return typeof u=="string"?u:u[V]}),I=ae(A=>{if(!t||!o||!l||A.key!=="Escape"||R.current)return;const V=i.current.floatingContext?.nodeId,D=y?kn(y.nodesRef.current,V):[];if(!S&&(A.stopPropagation(),D.length>0)){let _=!0;if(D.forEach(G=>{G.context?.open&&!G.context.dataRef.current.__escapeKeyBubbles&&(_=!1)}),!_)return}r(!1,Hf(A)?A.nativeEvent:A,"escape-key")}),j=ae(A=>{const V=E();return V==="intentional"&&A.type!=="click"||V==="sloppy"&&A.type==="click"}),U=ae(A=>{const V=()=>{I(A),Be(A)?.removeEventListener("keydown",V)};Be(A)?.addEventListener("keydown",V)}),L=ae(A=>{if(j(A))return;const V=i.current.insideReactTree;i.current.insideReactTree=!1;const D=w.current;if(w.current=!1,E()==="intentional"&&D||V||typeof x=="function"&&!x(A))return;const _=Be(A),G=`[${ei("inert")}]`,ce=Tt(s.floating).querySelectorAll(G);let me=he(_)?_:null;for(;me&&!Ft(me);){const Se=nn(me);if(Ft(Se)||!he(Se))break;me=Se}if(ce.length&&he(_)&&!Au(_)&&!Ie(_,s.floating)&&Array.from(ce).every(Se=>!Ie(me,Se)))return;if(Xe(_)){const Se=Ft(_),je=Qe(_),xt=/auto|scroll/,$e=Se||xt.test(je.overflowX),ht=Se||xt.test(je.overflowY),mn=$e&&_.clientWidth>0&&_.scrollWidth>_.clientWidth,Q=ht&&_.clientHeight>0&&_.scrollHeight>_.clientHeight,J=je.direction==="rtl",ue=Q&&(J?A.offsetX<=_.offsetWidth-_.clientWidth:A.offsetX>_.clientWidth),de=mn&&A.offsetY>_.clientHeight;if(ue||de)return}const ze=i.current.floatingContext?.nodeId,Nt=y&&kn(y.nodesRef.current,ze).some(Se=>et(A,Se.context?.elements.floating));if(et(A,s.floating)||et(A,s.domReference)||Nt)return;const bt=y?kn(y.nodesRef.current,ze):[];if(bt.length>0){let Se=!0;if(bt.forEach(je=>{je.context?.open&&!je.context.dataRef.current.__outsidePressBubbles&&(Se=!1)}),!Se)return}r(!1,A,"outside-press")}),P=ae(A=>{if(!(E()!=="sloppy"||!t||!o||et(A,s.floating)||et(A,s.domReference))){if(A.pointerType==="touch"){C.current={startTime:Date.now(),startX:A.clientX,startY:A.clientY,dismissOnPointerUp:!1,dismissOnMouseDown:!0},M.start(1e3,()=>{C.current&&(C.current.dismissOnPointerUp=!1,C.current.dismissOnMouseDown=!1)});return}L(A)}}),H=ae(A=>{if(j(A)||(M.clear(),A.type==="mousedown"&&C.current&&!C.current.dismissOnMouseDown))return;const V=()=>{A.type==="pointerdown"?P(A):L(A),Be(A)?.removeEventListener(A.type,V)};Be(A)?.addEventListener(A.type,V)}),z=ae(A=>{if(E()!=="sloppy"||A.pointerType!=="touch"||!C.current||et(A,s.floating)||et(A,s.domReference))return;const V=Math.abs(A.clientX-C.current.startX),D=Math.abs(A.clientY-C.current.startY),_=Math.sqrt(V*V+D*D);_>5&&(C.current.dismissOnPointerUp=!0),_>10&&(L(A),M.clear(),C.current=null)}),K=ae(A=>{E()!=="sloppy"||A.pointerType!=="touch"||!C.current||et(A,s.floating)||et(A,s.domReference)||(C.current.dismissOnPointerUp&&L(A),M.clear(),C.current=null)});a.useEffect(()=>{if(!t||!o)return;i.current.__escapeKeyBubbles=S,i.current.__outsidePressBubbles=k;const A=new ti;function V(me){r(!1,me,"ancestor-scroll")}function D(){A.clear(),R.current=!0}function _(){A.start(ni()?5:0,()=>{R.current=!1})}const G=Tt(s.floating);G.addEventListener("pointerdown",T,!0),l&&(G.addEventListener("keydown",O?U:I,O),G.addEventListener("compositionstart",D),G.addEventListener("compositionend",_)),x&&(G.addEventListener("click",b?H:L,b),G.addEventListener("pointerdown",b?H:L,b),G.addEventListener("pointermove",z,b),G.addEventListener("pointerup",K,b),G.addEventListener("mousedown",H,b));let ce=[];return d&&(he(s.domReference)&&(ce=Yt(s.domReference)),he(s.floating)&&(ce=ce.concat(Yt(s.floating))),!he(s.reference)&&s.reference&&s.reference.contextElement&&(ce=ce.concat(Yt(s.reference.contextElement)))),ce=ce.filter(me=>me!==G.defaultView?.visualViewport),ce.forEach(me=>{me.addEventListener("scroll",V,{passive:!0})}),()=>{G.removeEventListener("pointerdown",T,!0),l&&(G.removeEventListener("keydown",O?U:I,O),G.removeEventListener("compositionstart",D),G.removeEventListener("compositionend",_)),x&&(G.removeEventListener("click",b?H:L,b),G.removeEventListener("pointerdown",b?H:L,b),G.removeEventListener("pointermove",z,b),G.removeEventListener("pointerup",K,b),G.removeEventListener("mousedown",H,b)),ce.forEach(me=>{me.removeEventListener("scroll",V)}),A.clear()}},[i,s,l,x,u,t,r,d,o,S,k,I,O,U,L,b,H,P,z,K,T]),a.useEffect(()=>{i.current.insideReactTree=!1},[i,x]);const q=a.useMemo(()=>({onKeyDown:I,...m&&{[up[g]]:A=>{r(!1,A.nativeEvent,"reference-press")},...g!=="intentional"&&{onClick(A){r(!1,A.nativeEvent,"reference-press")}}}}),[I,r,m,g]),$=ae(A=>{const V=Be(A.nativeEvent);Ie(s.floating,V)&&(w.current=!0)}),B=ae(()=>{i.current.insideReactTree=!0,N.start(0,()=>{i.current.insideReactTree=!1})}),X=a.useMemo(()=>({onKeyDown:I,onMouseDown:$,onMouseUp:$,onPointerDownCapture:B,onMouseDownCapture:B,onClickCapture:B}),[I,$,B]);return a.useMemo(()=>o?{reference:q,floating:X}:{},[o,q,X])}function jl(e){const{open:n=!1,onOpenChange:t,elements:r}=e,s=Js(),i=a.useRef({}),[o]=a.useState(()=>kh()),l=Cl()!=null,[c,u]=a.useState(r.reference),m=ae((p,h,y)=>{i.current.openEvent=p?h:void 0,o.emit("openchange",{open:p,event:h,reason:y,nested:l}),t?.(p,h,y)}),g=a.useMemo(()=>({setPositionReference:u}),[]),d=a.useMemo(()=>({reference:c||r.reference||null,floating:r.floating||null,domReference:r.reference}),[c,r.reference,r.floating]);return a.useMemo(()=>({dataRef:i,open:n,onOpenChange:m,elements:d,events:o,floatingId:s,refs:g}),[n,m,d,o,s,g])}function fp(e={}){const{nodeId:n}=e,t=jl({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||t,s=r.elements,[i,o]=a.useState(null),[l,c]=a.useState(null),m=s?.domReference||i,g=a.useRef(null),d=Mi();Fe(()=>{m&&(g.current=m)},[m]);const p=rp({...e,elements:{...s,...l&&{reference:l}}}),h=a.useCallback(S=>{const k=he(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),getClientRects:()=>S.getClientRects(),contextElement:S}:S;c(k),p.refs.setReference(k)},[p.refs]),y=a.useCallback(S=>{(he(S)||S===null)&&(g.current=S,o(S)),(he(p.refs.reference.current)||p.refs.reference.current===null||S!==null&&!he(S))&&p.refs.setReference(S)},[p.refs]),v=a.useMemo(()=>({...p.refs,setReference:y,setPositionReference:h,domReference:g}),[p.refs,y,h]),x=a.useMemo(()=>({...p.elements,domReference:m}),[p.elements,m]),w=a.useMemo(()=>({...p,...r,refs:v,elements:x,nodeId:n}),[p,v,x,n,r]);return Fe(()=>{r.dataRef.current.floatingContext=w;const S=d?.nodesRef.current.find(k=>k.id===n);S&&(S.context=w)}),a.useMemo(()=>({...p,context:w,refs:v,elements:x}),[p,v,x,w])}const cs=ju&&wa;function hp(e,n={}){const{open:t,onOpenChange:r,events:s,dataRef:i,elements:o}=e,{enabled:l=!0,visibleOnly:c=!0}=n,u=a.useRef(!1),m=tn(),g=a.useRef(!0);a.useEffect(()=>{if(!l)return;const p=Ze(o.domReference);function h(){!t&&Xe(o.domReference)&&o.domReference===Ct(Tt(o.domReference))&&(u.current=!0)}function y(){g.current=!0}function v(){g.current=!1}return p.addEventListener("blur",h),cs&&(p.addEventListener("keydown",y,!0),p.addEventListener("pointerdown",v,!0)),()=>{p.removeEventListener("blur",h),cs&&(p.removeEventListener("keydown",y,!0),p.removeEventListener("pointerdown",v,!0))}},[o.domReference,t,l]),a.useEffect(()=>{if(!l)return;function p({reason:h}){(h==="reference-press"||h==="escape-key")&&(u.current=!0)}return s.on("openchange",p),()=>{s.off("openchange",p)}},[s,l]);const d=a.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(p){if(u.current)return;const h=Be(p.nativeEvent);if(c&&he(h)){if(cs&&!p.relatedTarget){if(!g.current&&!Pu(h))return}else if(!Qn(h))return}r(!0,p.nativeEvent,"focus")},onBlur(p){u.current=!1;const h=p.relatedTarget,y=p.nativeEvent,v=he(h)&&h.hasAttribute(ei("focus-guard"))&&h.getAttribute("data-type")==="outside";m.start(0,()=>{const x=Ct(o.domReference?o.domReference.ownerDocument:document);!h&&x===o.domReference||Ie(i.current.floatingContext?.refs.floating.current,x)||Ie(o.domReference,x)||v||r(!1,y,"focus")})}}),[i,o.domReference,r,c,m]);return a.useMemo(()=>l?{reference:d}:{},[l,d])}function pp(e=[]){const n=e.map(l=>l?.reference),t=e.map(l=>l?.floating),r=e.map(l=>l?.item),s=a.useCallback(l=>us(l,e,"reference"),n),i=a.useCallback(l=>us(l,e,"floating"),t),o=a.useCallback(l=>us(l,e,"item"),r);return a.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:o}),[s,i,o])}function us(e,n,t){const r=new Map,s=t==="item",i={};t==="floating"&&(i.tabIndex=-1,i[Nu]="");for(const o in e)s&&e&&(o===ka||o===Ma)||(i[o]=e[o]);for(let o=0;o<n.length;o+=1){let l;const c=n[o]?.[t];typeof c=="function"?l=e?c(e):null:l=c,l&&_o(i,l,s,r)}return _o(i,e,s,r),i}function _o(e,n,t,r){for(const s in n){const i=n[s];t&&(s===ka||s===Ma)||(s.startsWith("on")?(r.has(s)||r.set(s,[]),typeof i=="function"&&(r.get(s)?.push(i),e[s]=(...o)=>r.get(s)?.map(l=>l(...o)).find(l=>l!==void 0))):e[s]=i)}}function Ho(e,n){const[t,r]=e;let s=!1;const i=n.length;for(let o=0,l=i-1;o<i;l=o++){const[c,u]=n[o]||[0,0],[m,g]=n[l]||[0,0];u>=r!=g>=r&&t<=(m-c)*(r-u)/(g-u)+c&&(s=!s)}return s}function mp(e,n){return e[0]>=n.x&&e[0]<=n.x+n.width&&e[1]>=n.y&&e[1]<=n.y+n.height}function gp(e={}){const{buffer:n=.5,blockPointerEvents:t=!1,requireIntent:r=!0}=e,s=new ti;let i=!1,o=null,l=null,c=typeof performance<"u"?performance.now():0;function u(g,d){const p=performance.now(),h=p-c;if(o===null||l===null||h===0)return o=g,l=d,c=p,null;const y=g-o,v=d-l,w=Math.sqrt(y*y+v*v)/h;return o=g,l=d,c=p,w}const m=({x:g,y:d,placement:p,elements:h,onClose:y,nodeId:v,tree:x})=>function(S){function k(){s.clear(),y()}if(s.clear(),!h.domReference||!h.floating||p==null||g==null||d==null)return;const{clientX:O,clientY:b}=S,C=[O,b],M=Be(S),N=S.type==="mouseleave",R=Ie(h.floating,M),F=Ie(h.domReference,M),T=h.domReference.getBoundingClientRect(),E=h.floating.getBoundingClientRect(),I=p.split("-")[0],j=g>E.right-E.width/2,U=d>E.bottom-E.height/2,L=mp(C,T),P=E.width>T.width,H=E.height>T.height,z=(P?T:E).left,K=(P?T:E).right,q=(H?T:E).top,$=(H?T:E).bottom;if(R&&(i=!0,!N))return;if(F&&(i=!1),F&&!N){i=!0;return}if(N&&he(S.relatedTarget)&&Ie(h.floating,S.relatedTarget)||x&&kn(x.nodesRef.current,v).some(({context:A})=>A?.open))return;if(I==="top"&&d>=T.bottom-1||I==="bottom"&&d<=T.top+1||I==="left"&&g>=T.right-1||I==="right"&&g<=T.left+1)return k();let B=[];switch(I){case"top":B=[[z,T.top+1],[z,E.bottom-1],[K,E.bottom-1],[K,T.top+1]];break;case"bottom":B=[[z,E.top+1],[z,T.bottom-1],[K,T.bottom-1],[K,E.top+1]];break;case"left":B=[[E.right-1,$],[E.right-1,q],[T.left+1,q],[T.left+1,$]];break;case"right":B=[[T.right-1,$],[T.right-1,q],[E.left+1,q],[E.left+1,$]];break}function X([A,V]){switch(I){case"top":{const D=[P?A+n/2:j?A+n*4:A-n*4,V+n+1],_=[P?A-n/2:j?A+n*4:A-n*4,V+n+1],G=[[E.left,j||P?E.bottom-n:E.top],[E.right,j?P?E.bottom-n:E.top:E.bottom-n]];return[D,_,...G]}case"bottom":{const D=[P?A+n/2:j?A+n*4:A-n*4,V-n],_=[P?A-n/2:j?A+n*4:A-n*4,V-n],G=[[E.left,j||P?E.top+n:E.bottom],[E.right,j?P?E.top+n:E.bottom:E.top+n]];return[D,_,...G]}case"left":{const D=[A+n+1,H?V+n/2:U?V+n*4:V-n*4],_=[A+n+1,H?V-n/2:U?V+n*4:V-n*4];return[...[[U||H?E.right-n:E.left,E.top],[U?H?E.right-n:E.left:E.right-n,E.bottom]],D,_]}case"right":{const D=[A-n,H?V+n/2:U?V+n*4:V-n*4],_=[A-n,H?V-n/2:U?V+n*4:V-n*4],G=[[U||H?E.left+n:E.right,E.top],[U?H?E.left+n:E.right:E.left+n,E.bottom]];return[D,_,...G]}default:return[]}}if(!Ho([O,b],B)){if(i&&!L)return k();if(!N&&r){const A=u(S.clientX,S.clientY);if(A!==null&&A<.1)return k()}Ho([O,b],X([g,d]))?!i&&r&&s.start(40,k):k()}};return m.__options={blockPointerEvents:t},m}function yp(){const e=a.useContext(Lu);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 a.useMemo(()=>({toasts:n,add:t,close:r,update:s,promise:i}),[n,t,r,s,i])}const vp=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.createElement("path",{d:"M216,128a88,88,0,1,1-88-88A88,88,0,0,1,216,128Z",opacity:"0.2"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}))]]),bp=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.createElement("path",{d:"M208,96l-80,80L48,96Z",opacity:"0.2"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}))]]),xp=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.createElement("path",{d:"M176,128,96,208V48Z",opacity:"0.2"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}))]]),wp=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.createElement("path",{d:"M80,176h96l-48,48ZM128,32,80,80h96Z",opacity:"0.2"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}))]]),Ep=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}))]]),Sp=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}))]]),kp=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}))]]),Mp=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.createElement("path",{d:"M200,56V208a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V56Z",opacity:"0.2"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}))]]),Cp=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}))]]),Tp=new Map([["bold",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}),a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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",a.createElement(a.Fragment,null,a.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"}))]]),Nl=a.forwardRef((e,n)=>a.createElement(Je,{ref:n,...e,weights:vp}));Nl.displayName="ArrowCounterClockwiseIcon";const Ll=a.forwardRef((e,n)=>a.createElement(Je,{ref:n,...e,weights:bp}));Ll.displayName="CaretDownIcon";const Dl=a.forwardRef((e,n)=>a.createElement(Je,{ref:n,...e,weights:xp}));Dl.displayName="CaretRightIcon";const _r=a.forwardRef((e,n)=>a.createElement(Je,{ref:n,...e,weights:wp}));_r.displayName="CaretUpDownIcon";const ut=a.forwardRef((e,n)=>a.createElement(Je,{ref:n,...e,weights:Ep}));ut.displayName="CheckIcon";const yr=a.forwardRef((e,n)=>a.createElement(Je,{ref:n,...e,weights:Sp}));yr.displayName="ExclamationMarkIcon";const vr=a.forwardRef((e,n)=>a.createElement(Je,{ref:n,...e,weights:kp}));vr.displayName="PlusIcon";const Ns=a.forwardRef((e,n)=>a.createElement(Je,{ref:n,...e,weights:Mp}));Ns.displayName="TrashIcon";const Ti=a.forwardRef((e,n)=>a.createElement(Je,{ref:n,...e,weights:Cp}));Ti.displayName="WarningIcon";const Ri=a.forwardRef((e,n)=>a.createElement(Je,{ref:n,...e,weights:Tp}));Ri.displayName="XIcon";function Oi(e,n,t){let[r,s]=a.useState(t),i=e!==void 0,o=a.useRef(i),l=a.useRef(!1),c=a.useRef(!1);return i&&!o.current&&!l.current?(l.current=!0,o.current=i,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!i&&o.current&&!c.current&&(c.current=!0,o.current=i,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[i?e:r,W(u=>(i||s(u),n?.(u)))]}function Fi(e){let[n]=a.useState(e);return n}function $l(e={},n=null,t=[]){for(let[r,s]of Object.entries(e))Hl(t,_l(n,r),s);return t}function _l(e,n){return e?e+"["+n+"]":n}function Hl(e,n,t){if(Array.isArray(t))for(let[r,s]of t.entries())Hl(e,_l(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,""]):$l(t,n,e)}function Bl(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 Rp="span";var an=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(an||{});function Op(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 pe()({ourProps:i,theirProps:s,slot:{},defaultTag:Rp,name:"Hidden"})}let On=le(Op),Fp=a.createContext(null);function Ip({children:e}){let n=a.useContext(Fp);if(!n)return Z.createElement(Z.Fragment,null,e);let{target:t}=n;return t?Re.createPortal(Z.createElement(Z.Fragment,null,e),t):null}function Ii({data:e,form:n,disabled:t,onReset:r,overrides:s}){let[i,o]=a.useState(null),l=ln();return a.useEffect(()=>{if(r&&i)return l.addEventListener(i,"reset",r)},[i,n,r]),Z.createElement(Ip,null,Z.createElement(Vp,{setForm:o,formId:n}),$l(e).map(([c,u])=>Z.createElement(On,{features:an.Hidden,...Ca({key:c,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:n,disabled:t,name:c,value:u,...s})})))}function Vp({setForm:e,formId:n}){return a.useEffect(()=>{if(n){let t=document.getElementById(n);t&&e(t)}},[e,n]),n?null:Z.createElement(On,{features:an.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:t=>{if(!t)return;let r=t.closest("form");r&&e(r)}})}let Ap="span";function Pp(e,n){let t=a.useId(),r=Rr(),s=Or(),{id:i=r||`headlessui-checkbox-${t}`,disabled:o=s||!1,autoFocus:l=!1,checked:c,defaultChecked:u,onChange:m,name:g,value:d,form:p,indeterminate:h=!1,tabIndex:y=0,...v}=e,x=Fi(u),[w,S]=Oi(c,m,x??!1),k=cn(),O=Fr(),b=ln(),[C,M]=a.useState(!1),N=W(()=>{M(!0),S?.(!w),b.nextFrame(()=>{M(!1)})}),R=W($=>{if(Ir($.currentTarget))return $.preventDefault();$.preventDefault(),N()}),F=W($=>{$.key===ee.Space?($.preventDefault(),N()):$.key===ee.Enter&&Bl($.currentTarget)}),T=W($=>$.preventDefault()),{isFocusVisible:E,focusProps:I}=un({autoFocus:l}),{isHovered:j,hoverProps:U}=dn({isDisabled:o}),{pressed:L,pressProps:P}=Vr({disabled:o}),H=lt({ref:n,id:i,role:"checkbox","aria-checked":h?"mixed":w?"true":"false","aria-labelledby":k,"aria-describedby":O,"aria-disabled":o?!0:void 0,indeterminate:h?"true":void 0,tabIndex:o?void 0:y,onKeyUp:o?void 0:F,onKeyPress:o?void 0:T,onClick:o?void 0:R},I,U,P),z=a.useMemo(()=>({checked:w,disabled:o,hover:j,focus:E,active:L,indeterminate:h,changing:C,autofocus:l}),[w,h,o,j,E,L,C,l]),K=a.useCallback(()=>{if(x!==void 0)return S?.(x)},[S,x]),q=pe();return Z.createElement(Z.Fragment,null,g!=null&&Z.createElement(Ii,{disabled:o,data:{[g]:d||"on"},overrides:{type:"checkbox",checked:w},form:p,onReset:K}),q({ourProps:H,theirProps:v,slot:z,defaultTag:Ap,name:"Checkbox"}))}let jp=le(Pp),Np=a.createContext(()=>{});function Zl({value:e,children:n}){return Z.createElement(Np.Provider,{value:e},n)}function Ht(e,n,t){let r=t.initialDeps??[],s;function i(){var o,l,c,u;let m;t.key&&((o=t.debug)!=null&&o.call(t))&&(m=Date.now());const g=e();if(!(g.length!==r.length||g.some((h,y)=>r[y]!==h)))return s;r=g;let p;if(t.key&&((l=t.debug)!=null&&l.call(t))&&(p=Date.now()),s=n(...g),t.key&&((c=t.debug)!=null&&c.call(t))){const h=Math.round((Date.now()-m)*100)/100,y=Math.round((Date.now()-p)*100)/100,v=y/16,x=(w,S)=>{for(w=String(w);w.length<S;)w=" "+w;return w};console.info(`%c⏱ ${x(y,5)} /${x(h,5)} ms`,`
17
+ font-size: .6rem;
18
+ font-weight: bold;
19
+ color: hsl(${Math.max(0,Math.min(120-120*v,120))}deg 100% 31%);`,t?.key)}return(u=t?.onChange)==null||u.call(t,s),s}return i.updateDeps=o=>{r=o},i}function Bo(e,n){if(e===void 0)throw new Error("Unexpected undefined");return e}const Lp=(e,n)=>Math.abs(e-n)<1.01,Dp=(e,n,t)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>n.apply(this,s),t)}},Zo=e=>{const{offsetWidth:n,offsetHeight:t}=e;return{width:n,height:t}},$p=e=>e,_p=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},Hp=(e,n)=>{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;const s=o=>{const{width:l,height:c}=o;n({width:Math.round(l),height:Math.round(c)})};if(s(Zo(t)),!r.ResizeObserver)return()=>{};const i=new r.ResizeObserver(o=>{const l=()=>{const c=o[0];if(c?.borderBoxSize){const u=c.borderBoxSize[0];if(u){s({width:u.inlineSize,height:u.blockSize});return}}s(Zo(t))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(l):l()});return i.observe(t,{box:"border-box"}),()=>{i.unobserve(t)}},zo={passive:!0},Uo=typeof window>"u"?!0:"onscrollend"in window,Bp=(e,n)=>{const t=e.scrollElement;if(!t)return;const r=e.targetWindow;if(!r)return;let s=0;const i=e.options.useScrollendEvent&&Uo?()=>{}:Dp(r,()=>{n(s,!1)},e.options.isScrollingResetDelay),o=m=>()=>{const{horizontal:g,isRtl:d}=e.options;s=g?t.scrollLeft*(d&&-1||1):t.scrollTop,i(),n(s,m)},l=o(!0),c=o(!1);c(),t.addEventListener("scroll",l,zo);const u=e.options.useScrollendEvent&&Uo;return u&&t.addEventListener("scrollend",c,zo),()=>{t.removeEventListener("scroll",l),u&&t.removeEventListener("scrollend",c)}},Zp=(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"]},zp=(e,{adjustments:n=0,behavior:t},r)=>{var s,i;const o=e+n;(i=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||i.call(s,{[r.options.horizontal?"left":"top"]:o,behavior:t})};class Up{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 o=()=>{this._measureElement(i.target,i)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(o):o()})}));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:$p,rangeExtractor:_p,onChange:()=>{},measureElement:Zp,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=Ht(()=>(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 o=r-1;o>=0;o--){const l=t[o];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((o,l)=>o.end===l.end?o.index-l.index:o.end-l.end)[0]:void 0},this.getMeasurementOptions=Ht(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(t,r,s,i,o)=>(this.pendingMeasuredCacheIndexes=[],{count:t,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:o}),{key:!1}),this.getMeasurements=Ht(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:t,paddingStart:r,scrollMargin:s,getItemKey:i,enabled:o},l)=>{if(!o)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(m=>{this.itemSizeCache.set(m.key,m.size)}));const c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,c);for(let m=c;m<t;m++){const g=i(m),d=this.options.lanes===1?u[m-1]:this.getFurthestMeasurement(u,m),p=d?d.end+this.options.gap:r+s,h=l.get(g),y=typeof h=="number"?h:this.options.estimateSize(m),v=p+y,x=d?d.lane:m%this.options.lanes;u[m]={index:m,start:p,size:y,end:v,key:g,lane:x}}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Ht(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(t,r,s,i)=>this.range=t.length>0&&r>0?qp({measurements:t,outerSize:r,scrollOffset:s,lanes:i}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Ht(()=>{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,o)=>i===null||o===null?[]:t({startIndex:i,endIndex:o,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 o=i.key,l=this.elementsCache.get(o);l!==t&&(l&&this.observer.unobserve(l),this.observer.observe(t),this.elementsCache.set(o,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,o=r-i;o!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,o,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=o,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=Ht(()=>[this.getVirtualIndexes(),this.getMeasurements()],(t,r)=>{const s=[];for(let i=0,o=t.length;i<o;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 Bo(r[zl(0,r.length-1,s=>Bo(r[s]).start,t)])},this.getOffsetForAlignment=(t,r,s=0)=>{const i=this.getSize(),o=this.getScrollOffset();r==="auto"&&(r=t>=o+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(),o=this.getScrollOffset();if(r==="auto")if(s.end>=o+i-this.options.scrollPaddingEnd)r="end";else if(s.start<=o+this.options.scrollPaddingStart)r="start";else return[o,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 o=10,l=u=>{if(!this.targetWindow)return;const m=this.getOffsetForIndex(t,u);if(!m){console.warn("Failed to get offset for index:",t);return}const[g,d]=m;this._scrollToOffset(g,{adjustments:void 0,behavior:s}),this.targetWindow.requestAnimationFrame(()=>{const p=this.getScrollOffset(),h=this.getOffsetForIndex(t,d);if(!h){console.warn("Failed to get offset for index:",t);return}Lp(h[0],p)||c(d)})},c=u=>{this.targetWindow&&(i++,i<o?this.targetWindow.requestAnimationFrame(()=>l(u)):console.warn(`Failed to scroll to index ${t} after ${o} 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 o=r.length-1;for(;o>=0&&i.some(l=>l===null);){const l=r[o];i[l.lane]===null&&(i[l.lane]=l.end),o--}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 zl=(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 qp({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 o=zl(0,s,i,t),l=o;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(m=>m<t+n);){const m=e[l];c[m.lane]=m.end,l++}const u=Array(r).fill(t+n);for(;o>=0&&u.some(m=>m>=t);){const m=e[o];u[m.lane]=m.start,o--}o=Math.max(0,o-o%r),l=Math.min(s,l+(r-1-l%r))}return{startIndex:o,endIndex:l}}const qo=typeof document<"u"?a.useLayoutEffect:a.useEffect;function Gp(e){const n=a.useReducer(()=>({}),{})[1],t={...e,onChange:(s,i)=>{var o;i?Re.flushSync(n):n(),(o=e.onChange)==null||o.call(e,s,i)}},[r]=a.useState(()=>new Up(t));return r.setOptions(t),qo(()=>r._didMount(),[]),qo(()=>r._willUpdate()),r}function Wp(e){return Gp({observeElementRect:Hp,observeElementOffset:Bp,scrollToFn:zp,...e})}function Kp(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 Ul(e=Kp){return a.useCallback((n,t)=>{if(typeof e=="string"){let r=e;return n?.[r]===t?.[r]}return e(n,t)},[e])}function Vi(e,n,t,r){let s=Ar(t);a.useEffect(()=>{e=e??window;function i(o){s.current(o)}return e.addEventListener(n,i,r),()=>e.removeEventListener(n,i,r)},[e,n,r])}function ql(e){let n=a.useRef({value:"",selectionStart:null,selectionEnd:null});return Vi(e,"blur",t=>{let r=t.target;mo(r)&&(n.current={value:r.value,selectionStart:r.selectionStart,selectionEnd:r.selectionEnd})}),W(()=>{if(document.activeElement!==e&&mo(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 Fn(e,n){let t=a.useRef([]),r=W(e);a.useEffect(()=>{let s=[...t.current];for(let[i,o]of n.entries())if(t.current[i]!==o){let l=r(n,s);return t.current=n,l}},[r,...n])}function Yp({children:e,freeze:n}){let t=br(n,e);return Z.createElement(Z.Fragment,null,t)}function br(e,n){let[t,r]=a.useState(n);return!e&&t!==n&&r(n),e?t:n}function Qp(e){function n(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",n))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",n),n())}let Ge=[];Qp(()=>{function e(n){if(!Cn(n.target)||n.target===document.body||Ge[0]===n.target)return;let t=n.target;t=t.closest(Du),Ge.unshift(t??n.target),Ge=Ge.filter(r=>r!=null&&r.isConnected),Ge.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 Xp=Object.defineProperty,Jp=(e,n,t)=>n in e?Xp(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Go=(e,n,t)=>(Jp(e,typeof n!="symbol"?n+"":n,t),t),ne=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ne||{}),Ae=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ae||{}),Ye=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(Ye||{}),Gl=(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))(Gl||{});function ds(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((o,l)=>o.dataRef.current.order-l.dataRef.current.order):Oa(r,o=>o.dataRef.current.domRef.current),i=t?s.indexOf(t):null;return i===-1&&(i=null),{options:s,activeOptionIndex:i}}let e0={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:u,disabled:m}=e.virtual,g=n.focus===te.Specific?n.idx:Ut(n,{resolveItems:()=>u,resolveActiveIndex:()=>{var p,h;return(h=(p=e.activeOptionIndex)!=null?p:u.findIndex(y=>!m(y)))!=null?h:null},resolveDisabled:m,resolveId(){throw new Error("Function not implemented.")}}),d=(s=n.trigger)!=null?s:2;return e.activeOptionIndex===g&&e.activationTrigger===d?e:{...e,activeOptionIndex:g,activationTrigger:d,isTyping:!1,__demoMode:!1}}let o=ds(e);if(o.activeOptionIndex===null){let u=o.options.findIndex(m=>!m.dataRef.current.disabled);u!==-1&&(o.activeOptionIndex=u)}let l=n.focus===te.Specific?n.idx:Ut(n,{resolveItems:()=>o.options,resolveActiveIndex:()=>o.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled}),c=(i=n.trigger)!=null?i:2;return e.activeOptionIndex===l&&e.activationTrigger===c?e:{...e,...o,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 o=n.payload,l=ds(e,u=>(u.push(o),u));e.activeOptionIndex===null&&(s=(r=e.dataRef.current).isSelected)!=null&&s.call(r,n.payload.dataRef.current.value)&&(l.activeOptionIndex=l.options.indexOf(o));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=ds(e,s=>{let i=s.findIndex(o=>o.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}},t0=class Wl extends Ta{constructor(n){super(n),Go(this,"actions",{onChange:t=>{let{onChange:r,compare:s,mode:i,value:o}=this.state.dataRef.current;return we(i,{0:()=>r?.(t),1:()=>{let l=o.slice(),c=l.findIndex(u=>s(u,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:te.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})}}),Go(this,"selectors",{activeDescendantId:t=>{var r,s;let i=this.selectors.activeOptionIndex(t);if(i!==null)return t.virtual?(s=t.options.find(o=>!o.dataRef.current.disabled&&t.dataRef.current.compare(o.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,o=s.findIndex(l=>{var c;return!((c=i?.(l))!=null&&c)});if(o!==-1)return o}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 o=this.selectors.activeOptionIndex(t);return o===null?!1:t.virtual?o===t.dataRef.current.calculateIndex(r):((i=t.options[o])==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=jn.get(null);this.disposables.add(r.on(Ra.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 Wl({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 we(t.type,e0,n,t)}};const Kl=a.createContext(null);function Dn(e){let n=a.useContext(Kl);if(n===null){let t=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,Yl),t}return n}function Yl({id:e,virtual:n=null,__demoMode:t=!1}){let r=a.useMemo(()=>t0.new({id:e,virtual:n,__demoMode:t}),[]);return oi(()=>r.dispose()),r}let In=a.createContext(null);In.displayName="ComboboxDataContext";function hn(e){let n=a.useContext(In);if(n===null){let t=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,hn),t}return n}let Ql=a.createContext(null);function n0(e){let n=Dn("VirtualProvider"),t=hn("VirtualProvider"),{options:r}=t.virtual,s=oe(n,p=>p.optionsElement),[i,o]=a.useMemo(()=>{let p=s;if(!p)return[0,0];let h=window.getComputedStyle(p);return[parseFloat(h.paddingBlockStart||h.paddingTop),parseFloat(h.paddingBlockEnd||h.paddingBottom)]},[s]),l=Wp({enabled:r.length!==0,scrollPaddingStart:i,scrollPaddingEnd:o,count:r.length,estimateSize(){return 40},getScrollElement(){return n.state.optionsElement},overscan:12}),[c,u]=a.useState(0);Me(()=>{u(p=>p+1)},[r]);let m=l.getVirtualItems(),g=oe(n,p=>p.activationTrigger===Ye.Pointer),d=oe(n,n.selectors.activeOptionIndex);return m.length===0?null:Z.createElement(Ql.Provider,{value:l},Z.createElement("div",{style:{position:"relative",width:"100%",height:`${l.getTotalSize()}px`},ref:p=>{p&&(g||d!==null&&r.length>d&&l.scrollToIndex(d))}},m.map(p=>{var h;return Z.createElement(a.Fragment,{key:p.key},Z.cloneElement((h=e.children)==null?void 0:h.call(e,{...e.slot,option:r[p.index]}),{key:`${c}-${p.key}`,"data-index":p.index,"aria-setsize":r.length,"aria-posinset":p.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${p.start}px)`,overflowAnchor:"none"}}))})))}let r0=a.Fragment;function s0(e,n){let t=a.useId(),r=Or(),{value:s,defaultValue:i,onChange:o,form:l,name:c,by:u,invalid:m=!1,disabled:g=r||!1,onClose:d,__demoMode:p=!1,multiple:h=!1,immediate:y=!1,virtual:v=null,nullable:x,...w}=e,S=Fi(i),[k=h?[]:void 0,O]=Oi(s,o,S),b=Yl({id:t,virtual:v,__demoMode:p}),C=a.useRef({static:!1,hold:!1}),M=Ul(u),N=W(D=>v?u===null?v.options.indexOf(D):v.options.findIndex(_=>M(_,D)):b.state.options.findIndex(_=>M(_.dataRef.current.value,D))),R=a.useCallback(D=>we(E.mode,{[Ae.Multi]:()=>k.some(_=>M(_,D)),[Ae.Single]:()=>M(k,D)}),[k]),F=oe(b,D=>D.virtual),T=W(()=>d?.()),E=a.useMemo(()=>({__demoMode:p,immediate:y,optionsPropsRef:C,value:k,defaultValue:S,disabled:g,invalid:m,mode:h?Ae.Multi:Ae.Single,virtual:v?F:null,onChange:O,isSelected:R,calculateIndex:N,compare:M,onClose:T}),[k,S,g,m,h,O,R,p,b,v,F,T]);Me(()=>{var D;v&&b.send({type:Gl.UpdateVirtualConfiguration,options:v.options,disabled:(D=v.disabled)!=null?D:null})},[v,v?.options,v?.disabled]),Me(()=>{b.state.dataRef.current=E},[E]);let[I,j,U,L]=oe(b,D=>[D.comboboxState,D.buttonElement,D.inputElement,D.optionsElement]),P=jn.get(null),H=oe(P,a.useCallback(D=>P.selectors.isTop(D,t),[P,t]));hi(H,[j,U,L],()=>b.actions.closeCombobox());let z=oe(b,b.selectors.activeOptionIndex),K=oe(b,b.selectors.activeOption),q=a.useMemo(()=>({open:I===ne.Open,disabled:g,invalid:m,activeIndex:z,activeOption:K,value:k}),[E,g,k,m,K,I]),[$,B]=La(),X=n===null?{}:{ref:n},A=a.useCallback(()=>{if(S!==void 0)return O?.(S)},[O,S]),V=pe();return Z.createElement(B,{value:$,props:{htmlFor:U?.id},slot:{open:I===ne.Open,disabled:g}},Z.createElement(Da,null,Z.createElement(In.Provider,{value:E},Z.createElement(Kl.Provider,{value:b},Z.createElement(Nr,{value:we(I,{[ne.Open]:ve.Open,[ne.Closed]:ve.Closed})},c!=null&&Z.createElement(Ii,{disabled:g,data:k!=null?{[c]:k}:{},form:l,onReset:A}),V({ourProps:X,theirProps:w,slot:q,defaultTag:r0,name:"Combobox"}))))))}let i0="input";function o0(e,n){var t,r;let s=Dn("Combobox.Input"),i=hn("Combobox.Input"),o=a.useId(),l=Rr(),{id:c=l||`headlessui-combobox-input-${o}`,onChange:u,displayValue:m,disabled:g=i.disabled||!1,autoFocus:d=!1,type:p="text",...h}=e,[y]=oe(s,B=>[B.inputElement]),v=a.useRef(null),x=Ce(v,n,Fa(),s.actions.setInputElement),w=yt(y),[S,k]=oe(s,B=>[B.comboboxState,B.isTyping]),O=ln(),b=W(()=>{s.actions.onChange(null),s.state.optionsElement&&(s.state.optionsElement.scrollTop=0),s.actions.goToOption({focus:te.Nothing})}),C=a.useMemo(()=>{var B;return typeof m=="function"&&i.value!==void 0?(B=m(i.value))!=null?B:"":typeof i.value=="string"?i.value:""},[i.value,m]);Fn(([B,X],[A,V])=>{if(s.state.isTyping)return;let D=v.current;D&&((V===ne.Open&&X===ne.Closed||B!==A)&&(D.value=B),requestAnimationFrame(()=>{if(s.state.isTyping||!D||w?.activeElement!==D)return;let{selectionStart:_,selectionEnd:G}=D;Math.abs((G??0)-(_??0))===0&&_===0&&D.setSelectionRange(D.value.length,D.value.length)}))},[C,S,w,k]),Fn(([B],[X])=>{if(B===ne.Open&&X===ne.Closed){if(s.state.isTyping)return;let A=v.current;if(!A)return;let V=A.value,{selectionStart:D,selectionEnd:_,selectionDirection:G}=A;A.value="",A.value=V,G!==null?A.setSelectionRange(D,_,G):A.setSelectionRange(D,_)}},[S]);let M=a.useRef(!1),N=W(()=>{M.current=!0}),R=W(()=>{O.nextFrame(()=>{M.current=!1})}),F=W(B=>{switch(s.actions.setIsTyping(!0),B.key){case ee.Enter:if(s.state.comboboxState!==ne.Open||M.current)return;if(B.preventDefault(),B.stopPropagation(),s.selectors.activeOptionIndex(s.state)===null){s.actions.closeCombobox();return}s.actions.selectActiveOption(),i.mode===Ae.Single&&s.actions.closeCombobox();break;case ee.ArrowDown:return B.preventDefault(),B.stopPropagation(),we(s.state.comboboxState,{[ne.Open]:()=>s.actions.goToOption({focus:te.Next}),[ne.Closed]:()=>s.actions.openCombobox()});case ee.ArrowUp:return B.preventDefault(),B.stopPropagation(),we(s.state.comboboxState,{[ne.Open]:()=>s.actions.goToOption({focus:te.Previous}),[ne.Closed]:()=>{Re.flushSync(()=>s.actions.openCombobox()),i.value||s.actions.goToOption({focus:te.Last})}});case ee.Home:if(B.shiftKey)break;return B.preventDefault(),B.stopPropagation(),s.actions.goToOption({focus:te.First});case ee.PageUp:return B.preventDefault(),B.stopPropagation(),s.actions.goToOption({focus:te.First});case ee.End:if(B.shiftKey)break;return B.preventDefault(),B.stopPropagation(),s.actions.goToOption({focus:te.Last});case ee.PageDown:return B.preventDefault(),B.stopPropagation(),s.actions.goToOption({focus:te.Last});case ee.Escape:return s.state.comboboxState!==ne.Open?void 0:(B.preventDefault(),s.state.optionsElement&&!i.optionsPropsRef.current.static&&B.stopPropagation(),i.mode===Ae.Single&&i.value===null&&b(),s.actions.closeCombobox());case ee.Tab:if(s.state.comboboxState!==ne.Open)return;i.mode===Ae.Single&&s.state.activationTrigger!==Ye.Focus&&s.actions.selectActiveOption(),s.actions.closeCombobox();break}}),T=W(B=>{u?.(B),i.mode===Ae.Single&&B.target.value===""&&b(),s.actions.openCombobox()}),E=W(B=>{var X,A,V;let D=(X=B.relatedTarget)!=null?X:Ge.find(_=>_!==B.currentTarget);if(!((A=s.state.optionsElement)!=null&&A.contains(D))&&!((V=s.state.buttonElement)!=null&&V.contains(D))&&s.state.comboboxState===ne.Open)return B.preventDefault(),i.mode===Ae.Single&&i.value===null&&b(),s.actions.closeCombobox()}),I=W(B=>{var X,A,V;let D=(X=B.relatedTarget)!=null?X:Ge.find(_=>_!==B.currentTarget);(A=s.state.buttonElement)!=null&&A.contains(D)||(V=s.state.optionsElement)!=null&&V.contains(D)||i.disabled||i.immediate&&s.state.comboboxState!==ne.Open&&O.microTask(()=>{Re.flushSync(()=>s.actions.openCombobox()),s.actions.setActivationTrigger(Ye.Focus)})}),j=cn(),U=Fr(),{isFocused:L,focusProps:P}=un({autoFocus:d}),{isHovered:H,hoverProps:z}=dn({isDisabled:g}),K=oe(s,B=>B.optionsElement),q=a.useMemo(()=>({open:S===ne.Open,disabled:g,invalid:i.invalid,hover:H,focus:L,autofocus:d}),[i,H,L,d,g,i.invalid]),$=lt({ref:x,id:c,role:"combobox",type:p,"aria-controls":K?.id,"aria-expanded":S===ne.Open,"aria-activedescendant":oe(s,s.selectors.activeDescendantId),"aria-labelledby":j,"aria-describedby":U,"aria-autocomplete":"list",defaultValue:(r=(t=e.defaultValue)!=null?t:i.defaultValue!==void 0?m?.(i.defaultValue):null)!=null?r:i.defaultValue,disabled:g||void 0,autoFocus:d,onCompositionStart:N,onCompositionEnd:R,onKeyDown:F,onChange:T,onFocus:I,onBlur:E},P,z);return pe()({ourProps:$,theirProps:h,slot:q,defaultTag:i0,name:"Combobox.Input"})}let a0="button";function l0(e,n){let t=Dn("Combobox.Button"),r=hn("Combobox.Button"),[s,i]=a.useState(null),o=Ce(n,i,t.actions.setButtonElement),l=a.useId(),{id:c=`headlessui-combobox-button-${l}`,disabled:u=r.disabled||!1,autoFocus:m=!1,...g}=e,[d,p,h]=oe(t,T=>[T.comboboxState,T.inputElement,T.optionsElement]),y=ql(p),v=d===ne.Open;Ia(v,{trigger:s,action:a.useCallback(T=>{if(s!=null&&s.contains(T.target))return nt.Ignore;if(p!=null&&p.contains(T.target))return nt.Ignore;let E=T.target.closest('[role="option"]:not([data-disabled])');return rn(E)?nt.Select(E):h!=null&&h.contains(T.target)?nt.Ignore:nt.Close},[s,p,h]),close:t.actions.closeCombobox,select:t.actions.selectActiveOption});let x=W(T=>{switch(T.key){case ee.Space:case ee.Enter:T.preventDefault(),T.stopPropagation(),t.state.comboboxState===ne.Closed&&Re.flushSync(()=>t.actions.openCombobox()),y();return;case ee.ArrowDown:T.preventDefault(),T.stopPropagation(),t.state.comboboxState===ne.Closed&&(Re.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:te.First})),y();return;case ee.ArrowUp:T.preventDefault(),T.stopPropagation(),t.state.comboboxState===ne.Closed&&(Re.flushSync(()=>t.actions.openCombobox()),t.state.dataRef.current.value||t.actions.goToOption({focus:te.Last})),y();return;case ee.Escape:if(t.state.comboboxState!==ne.Open)return;T.preventDefault(),t.state.optionsElement&&!r.optionsPropsRef.current.static&&T.stopPropagation(),Re.flushSync(()=>t.actions.closeCombobox()),y();return;default:return}}),w=W(T=>{T.preventDefault(),!Ir(T.currentTarget)&&(T.button===ai.Left&&(t.state.comboboxState===ne.Open?t.actions.closeCombobox():t.actions.openCombobox()),y())}),S=cn([c]),{isFocusVisible:k,focusProps:O}=un({autoFocus:m}),{isHovered:b,hoverProps:C}=dn({isDisabled:u}),{pressed:M,pressProps:N}=Vr({disabled:u}),R=a.useMemo(()=>({open:d===ne.Open,active:M||d===ne.Open,disabled:u,invalid:r.invalid,value:r.value,hover:b,focus:k}),[r,b,k,M,u,d]),F=lt({ref:o,id:c,type:li(e,s),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":h?.id,"aria-expanded":d===ne.Open,"aria-labelledby":S,disabled:u||void 0,autoFocus:m,onPointerDown:w,onKeyDown:x},O,C,N);return pe()({ourProps:F,theirProps:g,slot:R,defaultTag:a0,name:"Combobox.Button"})}let c0="div",u0=ct.RenderStrategy|ct.Static;function d0(e,n){var t,r,s;let i=a.useId(),{id:o=`headlessui-combobox-options-${i}`,hold:l=!1,anchor:c,portal:u=!1,modal:m=!0,transition:g=!1,...d}=e,p=Dn("Combobox.Options"),h=hn("Combobox.Options"),y=Va(c);y&&(u=!0);let[v,x]=Aa(y),[w,S]=a.useState(null),k=Pa(),O=Ce(n,y?v:null,p.actions.setOptionsElement,S),[b,C,M,N,R]=oe(p,G=>[G.comboboxState,G.inputElement,G.buttonElement,G.optionsElement,G.activationTrigger]),F=yt(C||M),T=yt(N),E=jt(),[I,j]=Pr(g,w,E!==null?(E&ve.Open)===ve.Open:b===ne.Open);ci(I,C,p.actions.closeCombobox);let U=h.__demoMode?!1:m&&b===ne.Open;ui(U,T);let L=h.__demoMode?!1:m&&b===ne.Open;di(L,{allowed:a.useCallback(()=>[C,M,N],[C,M,N])}),Me(()=>{var G;h.optionsPropsRef.current.static=(G=e.static)!=null?G:!1},[h.optionsPropsRef,e.static]),Me(()=>{h.optionsPropsRef.current.hold=l},[h.optionsPropsRef,l]),$u(b===ne.Open,{container:N,accept(G){return G.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:G.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(G){G.setAttribute("role","none")}});let P=cn([M?.id]),H=a.useMemo(()=>({open:b===ne.Open,option:void 0}),[b]),z=W(()=>{p.actions.setActivationTrigger(Ye.Pointer)}),K=W(G=>{G.preventDefault(),p.actions.setActivationTrigger(Ye.Pointer)}),q=lt(y?k():{},{"aria-labelledby":P,role:"listbox","aria-multiselectable":h.mode===Ae.Multi?!0:void 0,id:o,ref:O,style:{...d.style,...x,"--input-width":ws(C,!0).width,"--button-width":ws(M,!0).width},onWheel:R===Ye.Pointer?void 0:z,onMouseDown:K,...jr(j)}),$=I&&b===ne.Closed,B=br($,(t=h.virtual)==null?void 0:t.options),X=br($,h.value),A=W(G=>h.compare(X,G)),V=a.useMemo(()=>{if(!h.virtual)return h;if(B===void 0)throw new Error("Missing `options` in virtual mode");return B!==h.virtual.options?{...h,virtual:{...h.virtual,options:B}}:h},[h,B,(r=h.virtual)==null?void 0:r.options]);h.virtual&&Object.assign(d,{children:Z.createElement(In.Provider,{value:V},Z.createElement(n0,{slot:H},d.children))});let D=pe(),_=a.useMemo(()=>h.mode===Ae.Multi?h:{...h,isSelected:A},[h,A]);return Z.createElement(fi,{enabled:u?e.static||I:!1,ownerDocument:F},Z.createElement(In.Provider,{value:_},D({ourProps:q,theirProps:{...d,children:Z.createElement(Yp,{freeze:$},typeof d.children=="function"?(s=d.children)==null?void 0:s.call(d,H):d.children)},slot:H,defaultTag:c0,features:u0,visible:I,name:"Combobox.Options"})))}let f0="div";function h0(e,n){var t,r,s;let i=hn("Combobox.Option"),o=Dn("Combobox.Option"),l=a.useId(),{id:c=`headlessui-combobox-option-${l}`,value:u,disabled:m=(s=(r=(t=i.virtual)==null?void 0:t.disabled)==null?void 0:r.call(t,u))!=null?s:!1,order:g=null,...d}=e,[p]=oe(o,j=>[j.inputElement]),h=ql(p),y=oe(o,a.useCallback(j=>o.selectors.isActive(j,u,c),[u,c])),v=i.isSelected(u),x=a.useRef(null),w=Ar({disabled:m,value:u,domRef:x,order:g}),S=a.useContext(Ql),k=Ce(n,x,S?S.measureElement:null),O=W(()=>{o.actions.setIsTyping(!1),o.actions.onChange(u)});Me(()=>o.actions.registerOption(c,w),[w,c]);let b=oe(o,a.useCallback(j=>o.selectors.shouldScrollIntoView(j,u,c),[u,c]));Me(()=>{if(b)return ja().requestAnimationFrame(()=>{var j,U;(U=(j=x.current)==null?void 0:j.scrollIntoView)==null||U.call(j,{block:"nearest"})})},[b,x]);let C=W(j=>{j.preventDefault(),j.button===ai.Left&&(m||(O(),_u()||requestAnimationFrame(()=>h()),i.mode===Ae.Single&&o.actions.closeCombobox()))}),M=W(()=>{if(m)return o.actions.goToOption({focus:te.Nothing});let j=i.calculateIndex(u);o.actions.goToOption({focus:te.Specific,idx:j})}),N=Na(),R=W(j=>N.update(j)),F=W(j=>{if(!N.wasMoved(j)||m||y&&o.state.activationTrigger===Ye.Pointer)return;let U=i.calculateIndex(u);o.actions.goToOption({focus:te.Specific,idx:U},Ye.Pointer)}),T=W(j=>{N.wasMoved(j)&&(m||y&&(i.optionsPropsRef.current.hold||o.state.activationTrigger===Ye.Pointer&&o.actions.goToOption({focus:te.Nothing})))}),E=a.useMemo(()=>({active:y,focus:y,selected:v,disabled:m}),[y,v,m]),I={id:c,ref:k,role:"option",tabIndex:m===!0?void 0:-1,"aria-disabled":m===!0?!0:void 0,"aria-selected":v,disabled:void 0,onMouseDown:C,onFocus:M,onPointerEnter:R,onMouseEnter:R,onPointerMove:F,onMouseMove:F,onPointerLeave:T,onMouseLeave:T};return pe()({ourProps:I,theirProps:d,slot:E,defaultTag:f0,name:"Combobox.Option"})}let p0=le(s0),Ai=le(l0),Pi=le(o0),m0=Nn,ji=le(d0),Vn=le(h0),Xl=Object.assign(p0,{Input:Pi,Button:Ai,Label:m0,Options:ji,Option:Vn});function g0(e,n=typeof document<"u"?document.defaultView:null,t){let r=pi(e,"escape");Vi(n,"keydown",s=>{r&&(s.defaultPrevented||s.key===ee.Escape&&t(s))})}function y0(){var e;let[n]=a.useState(()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(pointer: coarse)"):null),[t,r]=a.useState((e=n?.matches)!=null?e:!1);return Me(()=>{if(!n)return;function s(i){r(i.matches)}return n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[n]),t}function v0({defaultContainers:e=[],portals:n,mainTreeNode:t}={}){let r=yt(t),s=W(()=>{var i,o;let l=[];for(let c of e)c!==null&&(wn(c)?l.push(c):"current"in c&&wn(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&&wn(c)&&c.id!=="headlessui-portal-root"&&(t&&(c.contains(t)||c.contains((o=t?.getRootNode())==null?void 0:o.host))||l.some(u=>c.contains(u))||l.push(c));return l});return{resolveContainers:s,contains:W(i=>s().some(o=>o.contains(i)))}}let Jl=a.createContext(null);function Wo({children:e,node:n}){let[t,r]=a.useState(null),s=ec(n??t);return Z.createElement(Jl.Provider,{value:s},e,s===null&&Z.createElement(On,{features:an.Hidden,ref:i=>{var o,l;if(i){for(let c of(l=(o=mi(i))==null?void 0:o.querySelectorAll("html > *, body > *"))!=null?l:[])if(c!==document.body&&c!==document.head&&wn(c)&&c!=null&&c.contains(i)){r(c);break}}}}))}function ec(e=null){var n;return(n=a.useContext(Jl))!=null?n:e}function Ni(){let e=a.useRef(!1);return Me(()=>(e.current=!0,()=>{e.current=!1}),[]),e}var bn=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(bn||{});function b0(){let e=a.useRef(0);return Hu(!0,"keydown",n=>{n.key==="Tab"&&(e.current=n.shiftKey?1:0)},!0),e}function tc(e){if(!e)return new Set;if(typeof e=="function")return new Set(e());let n=new Set;for(let t of e.current)wn(t.current)&&n.add(t.current);return n}let x0="div";var kt=(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))(kt||{});function w0(e,n){let t=a.useRef(null),r=Ce(t,n),{initialFocus:s,initialFocusFallback:i,containers:o,features:l=15,...c}=e;Lr()||(l=0);let u=yt(t);M0(l,{ownerDocument:u});let m=C0(l,{ownerDocument:u,container:t,initialFocus:s,initialFocusFallback:i});T0(l,{ownerDocument:u,container:t,containers:o,previousActiveElement:m});let g=b0(),d=W(w=>{if(!rn(t.current))return;let S=t.current;(k=>k())(()=>{we(g.current,{[bn.Forwards]:()=>{En(S,qe.First,{skipElements:[w.relatedTarget,i]})},[bn.Backwards]:()=>{En(S,qe.Last,{skipElements:[w.relatedTarget,i]})}})})}),p=pi(!!(l&2),"focus-trap#tab-lock"),h=ln(),y=a.useRef(!1),v={ref:r,onKeyDown(w){w.key=="Tab"&&(y.current=!0,h.requestAnimationFrame(()=>{y.current=!1}))},onBlur(w){if(!(l&4))return;let S=tc(o);rn(t.current)&&S.add(t.current);let k=w.relatedTarget;Cn(k)&&k.dataset.headlessuiFocusGuard!=="true"&&(nc(S,k)||(y.current?En(t.current,we(g.current,{[bn.Forwards]:()=>qe.Next,[bn.Backwards]:()=>qe.Previous})|qe.WrapAround,{relativeTo:w.target}):Cn(w.target)&&ot(w.target)))}},x=pe();return Z.createElement(Z.Fragment,null,p&&Z.createElement(On,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:d,features:an.Focusable}),x({ourProps:v,theirProps:c,defaultTag:x0,name:"FocusTrap"}),p&&Z.createElement(On,{as:"button",type:"button","data-headlessui-focus-guard":!0,onFocus:d,features:an.Focusable}))}let E0=le(w0),S0=Object.assign(E0,{features:kt});function k0(e=!0){let n=a.useRef(Ge.slice());return Fn(([t],[r])=>{r===!0&&t===!1&&$a(()=>{n.current.splice(0)}),r===!1&&t===!0&&(n.current=Ge.slice())},[e,Ge,n]),W(()=>{var t;return(t=n.current.find(r=>r!=null&&r.isConnected))!=null?t:null})}function M0(e,{ownerDocument:n}){let t=!!(e&8),r=k0(t);Fn(()=>{t||n?.activeElement===n?.body&&ot(r())},[t]),oi(()=>{t&&ot(r())})}function C0(e,{ownerDocument:n,container:t,initialFocus:r,initialFocusFallback:s}){let i=a.useRef(null),o=pi(!!(e&1),"focus-trap#initial-focus"),l=Ni();return Fn(()=>{if(e===0)return;if(!o){s!=null&&s.current&&ot(s.current);return}let c=t.current;c&&$a(()=>{if(!l.current)return;let u=n?.activeElement;if(r!=null&&r.current){if(r?.current===u){i.current=u;return}}else if(c.contains(u)){i.current=u;return}if(r!=null&&r.current)ot(r.current);else{if(e&16){if(En(c,qe.First|qe.AutoFocus)!==go.Error)return}else if(En(c,qe.First)!==go.Error)return;if(s!=null&&s.current&&(ot(s.current),n?.activeElement===s.current))return;console.warn("There are no focusable elements inside the <FocusTrap />")}i.current=n?.activeElement})},[s,o,e]),i}function T0(e,{ownerDocument:n,container:t,containers:r,previousActiveElement:s}){let i=Ni(),o=!!(e&4);Vi(n?.defaultView,"focus",l=>{if(!o||!i.current)return;let c=tc(r);rn(t.current)&&c.add(t.current);let u=s.current;if(!u)return;let m=l.target;rn(m)?nc(c,m)?(s.current=m,ot(m)):(l.preventDefault(),l.stopPropagation(),ot(u)):ot(s.current)},!0)}function nc(e,n){for(let t of e)if(t.contains(n))return!0;return!1}function rc(e){var n;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((n=e.as)!=null?n:ic)!==a.Fragment||Z.Children.count(e.children)===1}let Hr=a.createContext(null);Hr.displayName="TransitionContext";var R0=(e=>(e.Visible="visible",e.Hidden="hidden",e))(R0||{});function O0(){let e=a.useContext(Hr);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function F0(){let e=a.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}let Br=a.createContext(null);Br.displayName="NestingContext";function Zr(e){return"children"in e?Zr(e.children):e.current.filter(({el:n})=>n.current!==null).filter(({state:n})=>n==="visible").length>0}function sc(e,n){let t=Ar(e),r=a.useRef([]),s=Ni(),i=ln(),o=W((p,h=Rt.Hidden)=>{let y=r.current.findIndex(({el:v})=>v===p);y!==-1&&(we(h,{[Rt.Unmount](){r.current.splice(y,1)},[Rt.Hidden](){r.current[y].state="hidden"}}),i.microTask(()=>{var v;!Zr(r)&&s.current&&((v=t.current)==null||v.call(t))}))}),l=W(p=>{let h=r.current.find(({el:y})=>y===p);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:p,state:"visible"}),()=>o(p,Rt.Unmount)}),c=a.useRef([]),u=a.useRef(Promise.resolve()),m=a.useRef({enter:[],leave:[]}),g=W((p,h,y)=>{c.current.splice(0),n&&(n.chains.current[h]=n.chains.current[h].filter(([v])=>v!==p)),n?.chains.current[h].push([p,new Promise(v=>{c.current.push(v)})]),n?.chains.current[h].push([p,new Promise(v=>{Promise.all(m.current[h].map(([x,w])=>w)).then(()=>v())})]),h==="enter"?u.current=u.current.then(()=>n?.wait.current).then(()=>y(h)):y(h)}),d=W((p,h,y)=>{Promise.all(m.current[h].splice(0).map(([v,x])=>x)).then(()=>{var v;(v=c.current.shift())==null||v()}).then(()=>y(h))});return a.useMemo(()=>({children:r,register:l,unregister:o,onStart:g,onStop:d,wait:u,chains:m}),[l,o,r,g,d,m,u])}let ic=a.Fragment,oc=ct.RenderStrategy;function I0(e,n){var t,r;let{transition:s=!0,beforeEnter:i,afterEnter:o,beforeLeave:l,afterLeave:c,enter:u,enterFrom:m,enterTo:g,entered:d,leave:p,leaveFrom:h,leaveTo:y,...v}=e,[x,w]=a.useState(null),S=a.useRef(null),k=rc(e),O=Ce(...k?[S,n,w]:n===null?[]:[n]),b=(t=v.unmount)==null||t?Rt.Unmount:Rt.Hidden,{show:C,appear:M,initial:N}=O0(),[R,F]=a.useState(C?"visible":"hidden"),T=F0(),{register:E,unregister:I}=T;Me(()=>E(S),[E,S]),Me(()=>{if(b===Rt.Hidden&&S.current){if(C&&R!=="visible"){F("visible");return}return we(R,{hidden:()=>I(S),visible:()=>E(S)})}},[R,S,E,I,C,b]);let j=Lr();Me(()=>{if(k&&j&&R==="visible"&&S.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[S,R,j,k]);let U=N&&!M,L=M&&C&&N,P=a.useRef(!1),H=sc(()=>{P.current||(F("hidden"),I(S))},T),z=W(V=>{P.current=!0;let D=V?"enter":"leave";H.onStart(S,D,_=>{_==="enter"?i?.():_==="leave"&&l?.()})}),K=W(V=>{let D=V?"enter":"leave";P.current=!1,H.onStop(S,D,_=>{_==="enter"?o?.():_==="leave"&&c?.()}),D==="leave"&&!Zr(H)&&(F("hidden"),I(S))});a.useEffect(()=>{k&&s||(z(C),K(C))},[C,k,s]);let q=!(!s||!k||!j||U),[,$]=Pr(q,x,C,{start:z,end:K}),B=Ca({ref:O,className:((r=Bu(v.className,L&&u,L&&m,$.enter&&u,$.enter&&$.closed&&m,$.enter&&!$.closed&&g,$.leave&&p,$.leave&&!$.closed&&h,$.leave&&$.closed&&y,!$.transition&&C&&d))==null?void 0:r.trim())||void 0,...jr($)}),X=0;R==="visible"&&(X|=ve.Open),R==="hidden"&&(X|=ve.Closed),C&&R==="hidden"&&(X|=ve.Opening),!C&&R==="visible"&&(X|=ve.Closing);let A=pe();return Z.createElement(Br.Provider,{value:H},Z.createElement(Nr,{value:X},A({ourProps:B,theirProps:v,defaultTag:ic,features:oc,visible:R==="visible",name:"Transition.Child"})))}function V0(e,n){let{show:t,appear:r=!1,unmount:s=!0,...i}=e,o=a.useRef(null),l=rc(e),c=Ce(...l?[o,n]:n===null?[]:[n]);Lr();let u=jt();if(t===void 0&&u!==null&&(t=(u&ve.Open)===ve.Open),t===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[m,g]=a.useState(t?"visible":"hidden"),d=sc(()=>{t||g("hidden")}),[p,h]=a.useState(!0),y=a.useRef([t]);Me(()=>{p!==!1&&y.current[y.current.length-1]!==t&&(y.current.push(t),h(!1))},[y,t]);let v=a.useMemo(()=>({show:t,appear:r,initial:p}),[t,r,p]);Me(()=>{t?g("visible"):!Zr(d)&&o.current!==null&&g("hidden")},[t,d]);let x={unmount:s},w=W(()=>{var O;p&&h(!1),(O=e.beforeEnter)==null||O.call(e)}),S=W(()=>{var O;p&&h(!1),(O=e.beforeLeave)==null||O.call(e)}),k=pe();return Z.createElement(Br.Provider,{value:d},Z.createElement(Hr.Provider,{value:v},k({ourProps:{...x,as:a.Fragment,children:Z.createElement(ac,{ref:c,...x,...i,beforeEnter:w,beforeLeave:S})},theirProps:{},defaultTag:a.Fragment,features:oc,visible:m==="visible",name:"Transition"})))}function A0(e,n){let t=a.useContext(Hr)!==null,r=jt()!==null;return Z.createElement(Z.Fragment,null,!t&&r?Z.createElement(Ls,{ref:n,...e}):Z.createElement(ac,{ref:n,...e}))}let Ls=le(V0),ac=le(I0),Li=le(A0),P0=Object.assign(Ls,{Child:Li,Root:Ls});var j0=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(j0||{}),N0=(e=>(e[e.SetTitleId=0]="SetTitleId",e))(N0||{});let L0={0(e,n){return e.titleId===n.id?e:{...e,titleId:n.id}}},Di=a.createContext(null);Di.displayName="DialogContext";function zr(e){let n=a.useContext(Di);if(n===null){let t=new Error(`<${e} /> is missing a parent <Dialog /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,zr),t}return n}function D0(e,n){return we(n.type,L0,e,n)}let Ko=le(function(e,n){let t=a.useId(),{id:r=`headlessui-dialog-${t}`,open:s,onClose:i,initialFocus:o,role:l="dialog",autoFocus:c=!0,__demoMode:u=!1,unmount:m=!1,...g}=e,d=a.useRef(!1);l=(function(){return l==="dialog"||l==="alertdialog"?l:(d.current||(d.current=!0,console.warn(`Invalid role [${l}] passed to <Dialog />. Only \`dialog\` and and \`alertdialog\` are supported. Using \`dialog\` instead.`)),"dialog")})();let p=jt();s===void 0&&p!==null&&(s=(p&ve.Open)===ve.Open);let h=a.useRef(null),y=Ce(h,n),v=yt(h),x=s?0:1,[w,S]=a.useReducer(D0,{titleId:null,descriptionId:null,panelRef:a.createRef()}),k=W(()=>i(!1)),O=W($=>S({type:0,id:$})),b=Lr()?x===0:!1,[C,M]=zu(),N={get current(){var $;return($=w.panelRef.current)!=null?$:h.current}},R=ec(),{resolveContainers:F}=v0({mainTreeNode:R,portals:C,defaultContainers:[N]}),T=p!==null?(p&ve.Closing)===ve.Closing:!1;di(u||T?!1:b,{allowed:W(()=>{var $,B;return[(B=($=h.current)==null?void 0:$.closest("[data-headlessui-portal]"))!=null?B:null]}),disallowed:W(()=>{var $;return[($=R?.closest("body > *:not(#headlessui-portal-root)"))!=null?$:null]})});let E=jn.get(null);Me(()=>{if(b)return E.actions.push(r),()=>E.actions.pop(r)},[E,r,b]);let I=oe(E,a.useCallback($=>E.selectors.isTop($,r),[E,r]));hi(I,F,$=>{$.preventDefault(),k()}),g0(I,v?.defaultView,$=>{$.preventDefault(),$.stopPropagation(),document.activeElement&&"blur"in document.activeElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur(),k()}),ui(u||T?!1:b,v,F),ci(b,h,k);let[j,U]=Uu(),L=a.useMemo(()=>[{dialogState:x,close:k,setTitleId:O,unmount:m},w],[x,w,k,O,m]),P=a.useMemo(()=>({open:x===0}),[x]),H={ref:y,id:r,role:l,tabIndex:-1,"aria-modal":u?void 0:x===0?!0:void 0,"aria-labelledby":w.titleId,"aria-describedby":j,unmount:m},z=!y0(),K=kt.None;b&&!u&&(K|=kt.RestoreFocus,K|=kt.TabLock,c&&(K|=kt.AutoFocus),z&&(K|=kt.InitialFocus));let q=pe();return Z.createElement(_a,null,Z.createElement(yo,{force:!0},Z.createElement(fi,null,Z.createElement(Di.Provider,{value:L},Z.createElement(qu,{target:h},Z.createElement(yo,{force:!1},Z.createElement(U,{slot:P},Z.createElement(M,null,Z.createElement(S0,{initialFocus:o,initialFocusFallback:h,containers:F,features:K},Z.createElement(Zl,{value:k},q({ourProps:H,theirProps:g,slot:P,defaultTag:$0,features:_0,visible:x===0,name:"Dialog"})))))))))))}),$0="div",_0=ct.RenderStrategy|ct.Static;function H0(e,n){let{transition:t=!1,open:r,...s}=e,i=jt(),o=e.hasOwnProperty("open")||i!==null,l=e.hasOwnProperty("onClose");if(!o&&!l)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!o)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!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(Wo,null,Z.createElement(P0,{show:r,transition:t,unmount:s.unmount},Z.createElement(Ko,{ref:n,...s}))):Z.createElement(Wo,null,Z.createElement(Ko,{ref:n,open:r,...s}))}let B0="div";function Z0(e,n){let t=a.useId(),{id:r=`headlessui-dialog-panel-${t}`,transition:s=!1,...i}=e,[{dialogState:o,unmount:l},c]=zr("Dialog.Panel"),u=Ce(n,c.panelRef),m=a.useMemo(()=>({open:o===0}),[o]),g=W(v=>{v.stopPropagation()}),d={ref:u,id:r,onClick:g},p=s?Li:a.Fragment,h=s?{unmount:l}:{},y=pe();return Z.createElement(p,{...h},y({ourProps:d,theirProps:i,slot:m,defaultTag:B0,name:"Dialog.Panel"}))}let z0="div";function U0(e,n){let{transition:t=!1,...r}=e,[{dialogState:s,unmount:i}]=zr("Dialog.Backdrop"),o=a.useMemo(()=>({open:s===0}),[s]),l={ref:n,"aria-hidden":!0},c=t?Li:a.Fragment,u=t?{unmount:i}:{},m=pe();return Z.createElement(c,{...u},m({ourProps:l,theirProps:r,slot:o,defaultTag:z0,name:"Dialog.Backdrop"}))}let q0="h2";function G0(e,n){let t=a.useId(),{id:r=`headlessui-dialog-title-${t}`,...s}=e,[{dialogState:i,setTitleId:o}]=zr("Dialog.Title"),l=Ce(n);a.useEffect(()=>(o(r),()=>o(null)),[r,o]);let c=a.useMemo(()=>({open:i===0}),[i]),u={ref:l,id:r};return pe()({ourProps:u,theirProps:s,slot:c,defaultTag:q0,name:"Dialog.Title"})}let W0=le(H0),lc=le(Z0),K0=le(U0),cc=le(G0),Y0=Object.assign(W0,{Panel:lc,Title:cc,Description:Zu});var Yo;let Q0=(Yo=Z.startTransition)!=null?Yo:function(e){e()};var X0=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(X0||{}),J0=(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))(J0||{});let em={0:e=>({...e,disclosureState:we(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}}},$i=a.createContext(null);$i.displayName="DisclosureContext";function _i(e){let n=a.useContext($i);if(n===null){let t=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,_i),t}return n}let Hi=a.createContext(null);Hi.displayName="DisclosureAPIContext";function uc(e){let n=a.useContext(Hi);if(n===null){let t=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,uc),t}return n}let Bi=a.createContext(null);Bi.displayName="DisclosurePanelContext";function tm(){return a.useContext(Bi)}function nm(e,n){return we(n.type,em,e,n)}let rm=a.Fragment;function sm(e,n){let{defaultOpen:t=!1,...r}=e,s=a.useRef(null),i=Ce(n,Gu(y=>{s.current=y},e.as===void 0||e.as===a.Fragment)),o=a.useReducer(nm,{disclosureState:t?0:1,buttonElement:null,panelElement:null,buttonId:null,panelId:null}),[{disclosureState:l,buttonId:c},u]=o,m=W(y=>{u({type:1});let v=mi(s);if(!v||!c)return;let x=y?Cn(y)?y:"current"in y&&Cn(y.current)?y.current:v.getElementById(c):v.getElementById(c);x?.focus()}),g=a.useMemo(()=>({close:m}),[m]),d=a.useMemo(()=>({open:l===0,close:m}),[l,m]),p={ref:i},h=pe();return Z.createElement($i.Provider,{value:o},Z.createElement(Hi.Provider,{value:g},Z.createElement(Zl,{value:m},Z.createElement(Nr,{value:we(l,{0:ve.Open,1:ve.Closed})},h({ourProps:p,theirProps:r,slot:d,defaultTag:rm,name:"Disclosure"})))))}let im="button";function om(e,n){let t=a.useId(),{id:r=`headlessui-disclosure-button-${t}`,disabled:s=!1,autoFocus:i=!1,...o}=e,[l,c]=_i("Disclosure.Button"),u=tm(),m=u===null?!1:u===l.panelId,g=a.useRef(null),d=Ce(g,n,W(N=>{if(!m)return c({type:4,element:N})}));a.useEffect(()=>{if(!m)return c({type:2,buttonId:r}),()=>{c({type:2,buttonId:null})}},[r,c,m]);let p=W(N=>{var R;if(m){if(l.disclosureState===1)return;switch(N.key){case ee.Space:case ee.Enter:N.preventDefault(),N.stopPropagation(),c({type:0}),(R=l.buttonElement)==null||R.focus();break}}else switch(N.key){case ee.Space:case ee.Enter:N.preventDefault(),N.stopPropagation(),c({type:0});break}}),h=W(N=>{switch(N.key){case ee.Space:N.preventDefault();break}}),y=W(N=>{var R;Ir(N.currentTarget)||s||(m?(c({type:0}),(R=l.buttonElement)==null||R.focus()):c({type:0}))}),{isFocusVisible:v,focusProps:x}=un({autoFocus:i}),{isHovered:w,hoverProps:S}=dn({isDisabled:s}),{pressed:k,pressProps:O}=Vr({disabled:s}),b=a.useMemo(()=>({open:l.disclosureState===0,hover:w,active:k,disabled:s,focus:v,autofocus:i}),[l,w,k,v,s,i]),C=li(e,l.buttonElement),M=m?lt({ref:d,type:C,disabled:s||void 0,autoFocus:i,onKeyDown:p,onClick:y},x,S,O):lt({ref:d,id:r,type:C,"aria-expanded":l.disclosureState===0,"aria-controls":l.panelElement?l.panelId:void 0,disabled:s||void 0,autoFocus:i,onKeyDown:p,onKeyUp:h,onClick:y},x,S,O);return pe()({ourProps:M,theirProps:o,slot:b,defaultTag:im,name:"Disclosure.Button"})}let am="div",lm=ct.RenderStrategy|ct.Static;function cm(e,n){let t=a.useId(),{id:r=`headlessui-disclosure-panel-${t}`,transition:s=!1,...i}=e,[o,l]=_i("Disclosure.Panel"),{close:c}=uc("Disclosure.Panel"),[u,m]=a.useState(null),g=Ce(n,W(w=>{Q0(()=>l({type:5,element:w}))}),m);a.useEffect(()=>(l({type:3,panelId:r}),()=>{l({type:3,panelId:null})}),[r,l]);let d=jt(),[p,h]=Pr(s,u,d!==null?(d&ve.Open)===ve.Open:o.disclosureState===0),y=a.useMemo(()=>({open:o.disclosureState===0,close:c}),[o.disclosureState,c]),v={ref:g,id:r,...jr(h)},x=pe();return Z.createElement(_a,null,Z.createElement(Bi.Provider,{value:o.panelId},x({ourProps:v,theirProps:i,slot:y,defaultTag:am,features:lm,visible:p,name:"Disclosure.Panel"})))}let um=le(sm),dc=le(om),fc=le(cm),dm=Object.assign(um,{Button:dc,Panel:fc}),fm="input";function hm(e,n){let t=a.useId(),r=Rr(),s=Or(),{id:i=r||`headlessui-input-${t}`,disabled:o=s||!1,autoFocus:l=!1,invalid:c=!1,...u}=e,m=cn(),g=Fr(),{isFocused:d,focusProps:p}=un({autoFocus:l}),{isHovered:h,hoverProps:y}=dn({isDisabled:o}),v=lt({ref:n,id:i,"aria-labelledby":m,"aria-describedby":g,"aria-invalid":c?"true":void 0,disabled:o||void 0,autoFocus:l},p,y),x=a.useMemo(()=>({disabled:o,invalid:c,hover:h,focus:d,autofocus:l}),[o,c,h,d,l]);return pe()({ourProps:v,theirProps:u,slot:x,defaultTag:fm,name:"Input"})}let pm=le(hm);var mm=Object.defineProperty,gm=(e,n,t)=>n in e?mm(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,Qo=(e,n,t)=>(gm(e,typeof n!="symbol"?n+"":n,t),t),ke=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ke||{}),We=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(We||{}),tr=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(tr||{}),hc=(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))(hc||{});function Xo(e,n=t=>t){let t=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Oa(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 ym={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:te.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,o;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===te.Nothing)return{...l,activeOptionIndex:null};if(n.focus===te.Specific)return{...l,activeOptionIndex:e.options.findIndex(m=>m.id===n.id)};if(n.focus===te.Previous){let m=e.activeOptionIndex;if(m!==null){let g=e.options[m].dataRef.current.domRef,d=Ut(n,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(d!==null){let p=e.options[d].dataRef.current.domRef;if(((r=g.current)==null?void 0:r.previousElementSibling)===p.current||((s=p.current)==null?void 0:s.previousElementSibling)===null)return{...l,activeOptionIndex:d}}}}else if(n.focus===te.Next){let m=e.activeOptionIndex;if(m!==null){let g=e.options[m].dataRef.current.domRef,d=Ut(n,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:p=>p.id,resolveDisabled:p=>p.dataRef.current.disabled});if(d!==null){let p=e.options[d].dataRef.current.domRef;if(((i=g.current)==null?void 0:i.nextElementSibling)===p.current||((o=p.current)==null?void 0:o.nextElementSibling)===null)return{...l,activeOptionIndex:d}}}}let c=Xo(e),u=Ut(n,{resolveItems:()=>c.options,resolveActiveIndex:()=>c.activeOptionIndex,resolveId:m=>m.id,resolveDisabled:m=>m.dataRef.current.disabled});return{...l,...c,activeOptionIndex:u}},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(o=>{var l;return!o.dataRef.current.disabled&&((l=o.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!==te.Nothing&&(r=Ut(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(o=>s?.(o.dataRef.current.value));i!==-1&&(r=i)}}return{...e,options:t,activeOptionIndex:r,pendingFocus:{focus:te.Nothing},pendingShouldSort:!0}},6:(e,n)=>{let t=e.options,r=[],s=new Set(n.options);for(let[i,o]of t.entries())if(s.has(o.id)&&(r.push(i),s.delete(o.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,...Xo(e),pendingShouldSort:!1}:e};class Zi extends Ta{constructor(n){super(n),Qo(this,"actions",{onChange:t=>{let{onChange:r,compare:s,mode:i,value:o}=this.state.dataRef.current;return we(i,{0:()=>r?.(t),1:()=>{let l=o.slice(),c=l.findIndex(u=>s(u,t));return c===-1?l.push(t):l.splice(c,1),r?.(l)}})},registerOption:ns(()=>{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:ns(()=>{let t=[];return[r=>t.push(r),()=>{this.send({type:6,options:t.splice(0)})}]}),goToOption:ns(()=>{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:te.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})}}),Qo(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,o=t.options;return i!==null?((s=o[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=jn.get(null);this.disposables.add(r.on(Ra.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 Zi({id:n,dataRef:{current:{}},listboxState:t?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:te.Nothing},__demoMode:t})}reduce(n,t){return we(t.type,ym,n,t)}}const pc=a.createContext(null);function zi(e){let n=a.useContext(pc);if(n===null){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,mc),t}return n}function mc({id:e,__demoMode:n=!1}){let t=a.useMemo(()=>Zi.new({id:e,__demoMode:n}),[]);return oi(()=>t.dispose()),t}let Ur=a.createContext(null);Ur.displayName="ListboxDataContext";function $n(e){let n=a.useContext(Ur);if(n===null){let t=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(t,$n),t}return n}let vm=a.Fragment;function bm(e,n){let t=a.useId(),r=Or(),{value:s,defaultValue:i,form:o,name:l,onChange:c,by:u,invalid:m=!1,disabled:g=r||!1,horizontal:d=!1,multiple:p=!1,__demoMode:h=!1,...y}=e;const v=d?"horizontal":"vertical";let x=Ce(n),w=Fi(i),[S=p?[]:void 0,k]=Oi(s,c,w),O=mc({id:t,__demoMode:h}),b=a.useRef({static:!1,hold:!1}),C=a.useRef(new Map),M=Ul(u),N=a.useCallback(q=>we(R.mode,{[We.Multi]:()=>S.some($=>M($,q)),[We.Single]:()=>M(S,q)}),[S]),R=a.useMemo(()=>({value:S,disabled:g,invalid:m,mode:p?We.Multi:We.Single,orientation:v,onChange:k,compare:M,isSelected:N,optionsPropsRef:b,listRef:C}),[S,g,m,p,v,k,M,N,b,C]);Me(()=>{O.state.dataRef.current=R},[R]);let F=oe(O,q=>q.listboxState),T=jn.get(null),E=oe(T,a.useCallback(q=>T.selectors.isTop(q,t),[T,t])),[I,j]=oe(O,q=>[q.buttonElement,q.optionsElement]);hi(E,[I,j],(q,$)=>{O.send({type:hc.CloseListbox}),Xu($,Ju.Loose)||(q.preventDefault(),I?.focus())});let U=a.useMemo(()=>({open:F===ke.Open,disabled:g,invalid:m,value:S}),[F,g,m,S]),[L,P]=La({inherit:!0}),H={ref:x},z=a.useCallback(()=>{if(w!==void 0)return k?.(w)},[k,w]),K=pe();return Z.createElement(P,{value:L,props:{htmlFor:I?.id},slot:{open:F===ke.Open,disabled:g}},Z.createElement(Da,null,Z.createElement(pc.Provider,{value:O},Z.createElement(Ur.Provider,{value:R},Z.createElement(Nr,{value:we(F,{[ke.Open]:ve.Open,[ke.Closed]:ve.Closed})},l!=null&&S!=null&&Z.createElement(Ii,{disabled:g,data:{[l]:S},form:o,onReset:z}),K({ourProps:H,theirProps:y,slot:U,defaultTag:vm,name:"Listbox"}))))))}let xm="button";function wm(e,n){let t=a.useId(),r=Rr(),s=$n("Listbox.Button"),i=zi("Listbox.Button"),{id:o=r||`headlessui-listbox-button-${t}`,disabled:l=s.disabled||!1,autoFocus:c=!1,...u}=e,m=Ce(n,Fa(),i.actions.setButtonElement),g=Wu(),[d,p,h]=oe(i,P=>[P.listboxState,P.buttonElement,P.optionsElement]),y=d===ke.Open;Ia(y,{trigger:p,action:a.useCallback(P=>{if(p!=null&&p.contains(P.target))return nt.Ignore;let H=P.target.closest('[role="option"]:not([data-disabled])');return rn(H)?nt.Select(H):h!=null&&h.contains(P.target)?nt.Ignore:nt.Close},[p,h]),close:i.actions.closeListbox,select:i.actions.selectActiveOption});let v=W(P=>{switch(P.key){case ee.Enter:Bl(P.currentTarget);break;case ee.Space:case ee.ArrowDown:P.preventDefault(),i.actions.openListbox({focus:s.value?te.Nothing:te.First});break;case ee.ArrowUp:P.preventDefault(),i.actions.openListbox({focus:s.value?te.Nothing:te.Last});break}}),x=W(P=>{switch(P.key){case ee.Space:P.preventDefault();break}}),w=W(P=>{var H;if(P.button===ai.Left){if(Ir(P.currentTarget))return P.preventDefault();i.state.listboxState===ke.Open?(Re.flushSync(()=>i.actions.closeListbox()),(H=i.state.buttonElement)==null||H.focus({preventScroll:!0})):(P.preventDefault(),i.actions.openListbox({focus:te.Nothing}))}}),S=a.useRef(null),k=W(P=>{S.current=P.pointerType,P.pointerType==="mouse"&&w(P)}),O=W(P=>{S.current!=="mouse"&&w(P)}),b=W(P=>P.preventDefault()),C=cn([o]),M=Fr(),{isFocusVisible:N,focusProps:R}=un({autoFocus:c}),{isHovered:F,hoverProps:T}=dn({isDisabled:l}),{pressed:E,pressProps:I}=Vr({disabled:l}),j=a.useMemo(()=>({open:d===ke.Open,active:E||d===ke.Open,disabled:l,invalid:s.invalid,value:s.value,hover:F,focus:N,autofocus:c}),[d,s.value,l,F,N,E,s.invalid,c]),U=oe(i,P=>P.listboxState===ke.Open),L=lt(g(),{ref:m,id:o,type:li(e,p),"aria-haspopup":"listbox","aria-controls":h?.id,"aria-expanded":U,"aria-labelledby":C,"aria-describedby":M,disabled:l||void 0,autoFocus:c,onKeyDown:v,onKeyUp:x,onKeyPress:b,onPointerDown:k,onClick:O},R,T,I);return pe()({ourProps:L,theirProps:u,slot:j,defaultTag:xm,name:"Listbox.Button"})}let gc=a.createContext(!1),Em="div",Sm=ct.RenderStrategy|ct.Static;function km(e,n){let t=a.useId(),{id:r=`headlessui-listbox-options-${t}`,anchor:s,portal:i=!1,modal:o=!0,transition:l=!1,...c}=e,u=Va(s),[m,g]=a.useState(null);u&&(i=!0);let d=$n("Listbox.Options"),p=zi("Listbox.Options"),[h,y,v,x]=oe(p,V=>[V.listboxState,V.buttonElement,V.optionsElement,V.__demoMode]),w=yt(y),S=yt(v),k=jt(),[O,b]=Pr(l,m,k!==null?(k&ve.Open)===ve.Open:h===ke.Open);ci(O,y,p.actions.closeListbox);let C=x?!1:o&&h===ke.Open;ui(C,S);let M=x?!1:o&&h===ke.Open;di(M,{allowed:a.useCallback(()=>[y,v],[y,v])});let N=h!==ke.Open,R=Ku(N,y)?!1:O,F=O&&h===ke.Closed,T=br(F,d.value),E=W(V=>d.compare(T,V)),I=oe(p,V=>{var D;if(u==null||!((D=u?.to)!=null&&D.includes("selection")))return null;let _=V.options.findIndex(G=>E(G.dataRef.current.value));return _===-1&&(_=0),_}),j=(()=>{if(u==null)return;if(I===null)return{...u,inner:void 0};let V=Array.from(d.listRef.current.values());return{...u,inner:{listRef:{current:V},index:I}}})(),[U,L]=Aa(j),P=Pa(),H=Ce(n,u?U:null,p.actions.setOptionsElement,g),z=ln();a.useEffect(()=>{var V;let D=v;D&&h===ke.Open&&D!==((V=mi(D))==null?void 0:V.activeElement)&&D?.focus({preventScroll:!0})},[h,v]);let K=W(V=>{var D,_;switch(z.dispose(),V.key){case ee.Space:if(p.state.searchQuery!=="")return V.preventDefault(),V.stopPropagation(),p.actions.search(V.key);case ee.Enter:if(V.preventDefault(),V.stopPropagation(),p.state.activeOptionIndex!==null){let{dataRef:G}=p.state.options[p.state.activeOptionIndex];p.actions.onChange(G.current.value)}d.mode===We.Single&&(Re.flushSync(()=>p.actions.closeListbox()),(D=p.state.buttonElement)==null||D.focus({preventScroll:!0}));break;case we(d.orientation,{vertical:ee.ArrowDown,horizontal:ee.ArrowRight}):return V.preventDefault(),V.stopPropagation(),p.actions.goToOption({focus:te.Next});case we(d.orientation,{vertical:ee.ArrowUp,horizontal:ee.ArrowLeft}):return V.preventDefault(),V.stopPropagation(),p.actions.goToOption({focus:te.Previous});case ee.Home:case ee.PageUp:return V.preventDefault(),V.stopPropagation(),p.actions.goToOption({focus:te.First});case ee.End:case ee.PageDown:return V.preventDefault(),V.stopPropagation(),p.actions.goToOption({focus:te.Last});case ee.Escape:V.preventDefault(),V.stopPropagation(),Re.flushSync(()=>p.actions.closeListbox()),(_=p.state.buttonElement)==null||_.focus({preventScroll:!0});return;case ee.Tab:V.preventDefault(),V.stopPropagation(),Re.flushSync(()=>p.actions.closeListbox()),Yu(p.state.buttonElement,V.shiftKey?qe.Previous:qe.Next);break;default:V.key.length===1&&(p.actions.search(V.key),z.setTimeout(()=>p.actions.clearSearch(),350));break}}),q=oe(p,V=>{var D;return(D=V.buttonElement)==null?void 0:D.id}),$=a.useMemo(()=>({open:h===ke.Open}),[h]),B=lt(u?P():{},{id:r,ref:H,"aria-activedescendant":oe(p,p.selectors.activeDescendantId),"aria-multiselectable":d.mode===We.Multi?!0:void 0,"aria-labelledby":q,"aria-orientation":d.orientation,onKeyDown:K,role:"listbox",tabIndex:h===ke.Open?0:void 0,style:{...c.style,...L,"--button-width":ws(y,!0).width},...jr(b)}),X=pe(),A=a.useMemo(()=>d.mode===We.Multi?d:{...d,isSelected:E},[d,E]);return Z.createElement(fi,{enabled:i?e.static||O:!1,ownerDocument:w},Z.createElement(Ur.Provider,{value:A},X({ourProps:B,theirProps:c,slot:$,defaultTag:Em,features:Sm,visible:R,name:"Listbox.Options"})))}let Mm="div";function Cm(e,n){let t=a.useId(),{id:r=`headlessui-listbox-option-${t}`,disabled:s=!1,value:i,...o}=e,l=a.useContext(gc)===!0,c=$n("Listbox.Option"),u=zi("Listbox.Option"),m=oe(u,R=>u.selectors.isActive(R,r)),g=c.isSelected(i),d=a.useRef(null),p=Qu(d),h=Ar({disabled:s,value:i,domRef:d,get textValue(){return p()}}),y=Ce(n,d,R=>{R?c.listRef.current.set(r,R):c.listRef.current.delete(r)}),v=oe(u,R=>u.selectors.shouldScrollIntoView(R,r));Me(()=>{if(v)return ja().requestAnimationFrame(()=>{var R,F;(F=(R=d.current)==null?void 0:R.scrollIntoView)==null||F.call(R,{block:"nearest"})})},[v,d]),Me(()=>{if(!l)return u.actions.registerOption(r,h),()=>u.actions.unregisterOption(r)},[h,r,l]);let x=W(R=>{var F;if(s)return R.preventDefault();u.actions.onChange(i),c.mode===We.Single&&(Re.flushSync(()=>u.actions.closeListbox()),(F=u.state.buttonElement)==null||F.focus({preventScroll:!0}))}),w=W(()=>{if(s)return u.actions.goToOption({focus:te.Nothing});u.actions.goToOption({focus:te.Specific,id:r})}),S=Na(),k=W(R=>S.update(R)),O=W(R=>{S.wasMoved(R)&&(s||m&&u.state.activationTrigger===tr.Pointer||u.actions.goToOption({focus:te.Specific,id:r},tr.Pointer))}),b=W(R=>{S.wasMoved(R)&&(s||m&&u.state.activationTrigger===tr.Pointer&&u.actions.goToOption({focus:te.Nothing}))}),C=a.useMemo(()=>({active:m,focus:m,selected:g,disabled:s,selectedOption:g&&l}),[m,g,s,l]),M=l?{}:{id:r,ref:y,role:"option",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-selected":g,disabled:void 0,onClick:x,onFocus:w,onPointerEnter:k,onMouseEnter:k,onPointerMove:O,onMouseMove:O,onPointerLeave:b,onMouseLeave:b},N=pe();return!g&&l?null:N({ourProps:M,theirProps:o,slot:C,defaultTag:Mm,name:"Listbox.Option"})}let Tm=a.Fragment;function Rm(e,n){let{options:t,placeholder:r,...s}=e,i={ref:Ce(n)},o=$n("ListboxSelectedOption"),l=a.useMemo(()=>({}),[]),c=o.value===void 0||o.value===null||o.mode===We.Multi&&Array.isArray(o.value)&&o.value.length===0,u=pe();return Z.createElement(gc.Provider,{value:!0},u({ourProps:i,theirProps:{...s,children:Z.createElement(Z.Fragment,null,r&&c?r:t)},slot:l,defaultTag:Tm,name:"ListboxSelectedOption"}))}let Om=le(bm),yc=le(wm),Fm=Nn,vc=le(km),Ds=le(Cm),Im=le(Rm),Vm=Object.assign(Om,{Button:yc,Label:Fm,Options:vc,Option:Ds,SelectedOption:Im});function Am({controlled:e,default:n,name:t,state:r="value"}){const{current:s}=a.useRef(e!==void 0),[i,o]=a.useState(n),l=s?e:i,c=a.useCallback(u=>{s||o(u)},[]);return[l,c]}const bc=a.createContext(void 0);function qr(){const e=a.useContext(bc);if(e===void 0)throw new Error("Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>.");return e}function Pm(e,n=!1,t=!1){const[r,s]=a.useState(e&&n?"idle":void 0),[i,o]=a.useState(e);return e&&!i&&(o(!0),s("starting")),!e&&i&&r!=="ending"&&!t&&s("ending"),!e&&!i&&r==="ending"&&s(void 0),Fe(()=>{if(!e&&i&&r!=="ending"&&t){const l=tt.request(()=>{s("ending")});return()=>{tt.cancel(l)}}},[e,i,r,t]),Fe(()=>{if(!e||n)return;const l=tt.request(()=>{Re.flushSync(()=>{s(void 0)})});return()=>{tt.cancel(l)}},[n,e]),Fe(()=>{if(!e||!n)return;e&&i&&r!=="idle"&&s("starting");const l=tt.request(()=>{s("idle")});return()=>{tt.cancel(l)}},[n,e,i,s,r]),a.useMemo(()=>({mounted:i,setMounted:o,transitionStatus:r}),[i,r])}const jm=600;function Nm(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 xc=a.createContext(void 0);function Lm(){return a.useContext(xc)}function Ui(e){const{disabled:n=!1,defaultOpen:t=!1,onOpenChange:r,open:s,delay:i,closeDelay:o,hoverable:l=!0,trackCursorAxis:c="none",actionsRef:u,onOpenChangeComplete:m}=e,g=i??jm,d=o??0,[p,h]=a.useState(null),[y,v]=a.useState(null),[x,w]=a.useState(),S=a.useRef(null),[k,O]=Am({controlled:s,default:t,name:"Tooltip",state:"open"}),b=!n&&k;function C(V,D,_){const G=_==="trigger-hover",ce=V&&_==="trigger-focus",me=!V&&(_==="trigger-press"||_==="escape-key");function ze(){r?.(V,D,_),O(V)}G?Re.flushSync(ze):ze(),ce||me?w(ce?"focus":"dismiss"):_==="trigger-hover"&&w(void 0)}const M=ae(C);k&&n&&C(!1,void 0,"disabled");const{mounted:N,setMounted:R,transitionStatus:F}=Pm(b),T=ae(()=>{R(!1),m?.(!1)});ki({enabled:!u,open:b,ref:S,onComplete(){b||T()}}),a.useImperativeHandle(u,()=>({unmount:T}),[T]);const E=jl({elements:{reference:p,floating:y},open:b,onOpenChange(V,D,_){M(V,D,Nm(_))}}),I=Lm(),{delayRef:j,isInstantPhase:U,hasProvider:L}=Oh(E),P=U?"delay":x,H=Th(E,{enabled:!n,mouseOnly:!0,move:!1,handleClose:l&&c!=="both"?gp():null,restMs(){const V=I?.delay,D=typeof j.current=="object"?j.current.open:void 0;let _=g;return L&&(D!==0?_=i??V??g:_=0),_},delay(){const V=typeof j.current=="object"?j.current.close:void 0;let D=d;return o==null&&L&&(D=V),{close:D}}}),z=hp(E,{enabled:!n}),K=dp(E,{enabled:!n,referencePress:!0}),q=Ih(E,{enabled:!n&&c!=="none",axis:c==="none"?void 0:c}),{getReferenceProps:$,getFloatingProps:B}=pp([H,z,K,q]),X=a.useMemo(()=>({open:b,setOpen:M,mounted:N,setMounted:R,setTriggerElement:h,positionerElement:y,setPositionerElement:v,popupRef:S,triggerProps:$(),popupProps:B(),floatingRootContext:E,instantType:P,transitionStatus:F,onOpenChangeComplete:m}),[b,M,N,R,h,y,v,S,$,B,E,P,F,m]),A=a.useMemo(()=>({...X,delay:g,closeDelay:d,trackCursorAxis:c,hoverable:l}),[X,g,d,c,l]);return f.jsx(bc.Provider,{value:A,children:e.children})}let qi=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=mr.startingStyle]="startingStyle",e[e.endingStyle=mr.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e})({}),Dm=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const $m={[Dm.popupOpen]:""},_m={[qi.open]:""},Hm={[qi.closed]:""},Bm={[qi.anchorHidden]:""},Zm={open(e){return e?$m:null}},Gi={open(e){return e?_m:Hm},anchorHidden(e){return e?Bm:null}},Wi=a.forwardRef(function(n,t){const{className:r,render:s,...i}=n,{open:o,setTriggerElement:l,triggerProps:c}=qr(),u=a.useMemo(()=>({open:o}),[o]);return ft("button",n,{state:u,ref:[t,l],props:[c,i],customStyleHookMapping:Zm})}),wc=a.createContext(void 0);function zm(){const e=a.useContext(wc);if(e===void 0)throw new Error("Base UI: <Tooltip.Portal> is missing.");return e}function Ki(e){const{children:n,keepMounted:t=!1,container:r}=e,{mounted:s}=qr();return s||t?f.jsx(wc.Provider,{value:t,children:f.jsx(ed,{root:r,children:n})}):null}const Ec=a.createContext(void 0);function Sc(){const e=a.useContext(Ec);if(e===void 0)throw new Error("Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>.");return e}const Um=a.createContext(void 0);function qm(e=!0){const n=a.useContext(Um);if(n===void 0&&!e)throw new Error("Base UI: DirectionContext is missing.");return n?.direction??"ltr"}const Gm=e=>({name:"arrow",options:e,async fn(n){const{x:t,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=n,{element:u,padding:m=0,offsetParent:g="real"}=td(e,n)||{};if(u==null)return{};const d=nd(m),p={x:t,y:r},h=rd(s),y=id(h),v=await o.getDimensions(u),x=h==="y",w=x?"top":"left",S=x?"bottom":"right",k=x?"clientHeight":"clientWidth",O=i.reference[y]+i.reference[h]-p[h]-i.floating[y],b=p[h]-i.reference[h],C=g==="real"?await o.getOffsetParent?.(u):l.floating;let M=l.floating[k]||i.floating[y];(!M||!await o.isElement?.(C))&&(M=l.floating[k]||i.floating[y]);const N=O/2-b/2,R=M/2-v[y]/2-1,F=Math.min(d[w],R),T=Math.min(d[S],R),E=F,I=M-v[y]-T,j=M/2-v[y]/2+N,U=sd(E,j,I),L=!c.arrow&&gi(s)!=null&&j!==U&&i.reference[y]/2-(j<E?F:T)-v[y]/2<0,P=L?j<E?j-E:j-I:0;return{[h]:p[h]+P,data:{[h]:U,centerOffset:j-U-P,...L&&{alignmentOffset:P}},reset:L}}}),Wm=(e,n)=>({...Gm(e),options:[e,n]});function kc(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 Jo(e,n,t){const{rects:r,placement:s}=e;return{side:kc(n,Es(s),t),align:gi(s)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Km(e){const{anchor:n,positionMethod:t="absolute",side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,collisionBoundary:l,collisionPadding:c=5,sticky:u=!1,arrowPadding:m=5,trackAnchor:g=!0,keepMounted:d=!1,floatingRootContext:p,mounted:h,collisionAvoidance:y,shiftCrossAxis:v=!1,nodeId:x,adaptiveOrigin:w}=e,S=y.side||"flip",k=y.align||"flip",O=y.fallbackAxisSide||"end",b=typeof n=="function"?n:void 0,C=ae(b),M=b?C:n,N=rt(n),F=qm()==="rtl",T={top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[r],E=i==="center"?T:`${T}-${i}`,I={boundary:l==="clipping-ancestors"?"clippingAncestors":l,padding:c},j=a.useRef(null),U=rt(s),L=rt(o),z=[sp(se=>{const fe=Jo(se,r,F),Ne=typeof U.current=="function"?U.current(fe):U.current,Le=typeof L.current=="function"?L.current(fe):L.current;return{mainAxis:Ne,crossAxis:Le,alignmentAxis:Le}},[typeof s!="function"?s:0,typeof o!="function"?o:0,F,r])],K=k==="none"&&S!=="shift",q=!K&&(u||v||S==="shift"),$=S==="none"?null:ap({...I,mainAxis:!v&&S==="flip",crossAxis:k==="flip"?"alignment":!1,fallbackAxisSideDirection:O}),B=K?null:ip(se=>{const fe=zt(se.elements.floating).documentElement;return{...I,rootBoundary:v?{x:0,y:0,width:fe.clientWidth,height:fe.clientHeight}:void 0,mainAxis:k!=="none",crossAxis:q,limiter:u||v?void 0:op(()=>{if(!j.current)return{};const{height:Ne}=j.current.getBoundingClientRect();return{offset:Ne/2+(typeof c=="number"?c:0)}})}},[I,u,v,c,k]);S==="shift"||k==="shift"||i==="center"?z.push(B,$):z.push($,B),z.push(lp({...I,apply({elements:{floating:se},rects:{reference:fe},availableWidth:Ne,availableHeight:Le}){Object.entries({"--available-width":`${Ne}px`,"--available-height":`${Le}px`,"--anchor-width":`${fe.width}px`,"--anchor-height":`${fe.height}px`}).forEach(([Oe,pt])=>{se.style.setProperty(Oe,pt)})}}),Wm(()=>({element:j.current||document.createElement("div"),padding:m,offsetParent:"floating"}),[m]),cp(),{name:"transformOrigin",fn(se){const{elements:fe,middlewareData:Ne,placement:Le,rects:Oe,y:pt}=se,Lt=Es(Le),gn=od(Lt),Dt=j.current,$t=Ne.arrow?.x||0,Kr=Ne.arrow?.y||0,Yr=Dt?.clientWidth||0,Qr=Dt?.clientHeight||0,Xr=$t+Yr/2,io=Kr+Qr/2,Pc=Math.abs(Ne.shift?.y||0),jc=Oe.reference.height/2,Nc=Pc>(typeof s=="function"?s(Jo(se,r,F)):s),Lc={top:`${Xr}px calc(100% + ${s}px)`,bottom:`${Xr}px ${-s}px`,left:`calc(100% + ${s}px) ${io}px`,right:`${-s}px ${io}px`}[Lt],Dc=`${Xr}px ${Oe.reference.y+jc-pt}px`;return fe.floating.style.setProperty("--transform-origin",q&&gn==="y"&&Nc?Dc:Lc),{}}},w);let X=p;!h&&p&&(X={...p,elements:{reference:null,floating:null,domReference:null}});const A=a.useMemo(()=>({elementResize:g&&typeof ResizeObserver<"u",layoutShift:g&&typeof IntersectionObserver<"u"}),[g]),{refs:V,elements:D,x:_,y:G,middlewareData:ce,update:me,placement:ze,context:Nt,isPositioned:bt,floatingStyles:Se}=fp({rootContext:X,placement:E,middleware:z,strategy:t,whileElementsMounted:d?void 0:(...se)=>Lo(...se,A),nodeId:x}),{sideX:je,sideY:xt}=ce.adaptiveOrigin||{},$e=a.useMemo(()=>w?{position:t,[je]:`${_}px`,[xt]:`${G}px`}:Se,[w,je,xt,t,_,G,Se]),ht=a.useRef(null);Fe(()=>{if(!h)return;const se=N.current,fe=typeof se=="function"?se():se,Le=(ea(fe)?fe.current:fe)||null||null;Le!==ht.current&&(V.setPositionReference(Le),ht.current=Le)},[h,V,M,N]),a.useEffect(()=>{if(!h)return;const se=N.current;typeof se!="function"&&ea(se)&&se.current!==ht.current&&(V.setPositionReference(se.current),ht.current=se.current)},[h,V,M,N]),a.useEffect(()=>{if(d&&h&&D.domReference&&D.floating)return Lo(D.domReference,D.floating,me,A)},[d,h,D,me,A]);const mn=Es(ze),Q=kc(r,mn,F),J=gi(ze)||"center",ue=!!ce.hide?.referenceHidden,de=a.useMemo(()=>({position:"absolute",top:ce.arrow?.y,left:ce.arrow?.x}),[ce.arrow]),_e=ce.arrow?.centerOffset!==0;return a.useMemo(()=>({positionerStyles:$e,arrowStyles:de,arrowRef:j,arrowUncentered:_e,side:Q,align:J,anchorHidden:ue,refs:V,context:Nt,isPositioned:bt,update:me}),[$e,de,j,_e,Q,J,ue,V,Nt,bt,me])}function ea(e){return e!=null&&"current"in e}const Yi=a.forwardRef(function(n,t){const{render:r,className:s,anchor:i,positionMethod:o="absolute",side:l="top",align:c="center",sideOffset:u=0,alignOffset:m=0,collisionBoundary:g="clipping-ancestors",collisionPadding:d=5,arrowPadding:p=5,sticky:h=!1,trackAnchor:y=!0,collisionAvoidance:v=th,...x}=n,{open:w,setPositionerElement:S,mounted:k,floatingRootContext:O,trackCursorAxis:b,hoverable:C}=qr(),M=zm(),N=Km({anchor:i,positionMethod:o,floatingRootContext:O,mounted:k,side:l,sideOffset:u,align:c,alignOffset:m,collisionBoundary:g,collisionPadding:d,sticky:h,arrowPadding:p,trackAnchor:y,keepMounted:M,collisionAvoidance:v}),R=a.useMemo(()=>{const j={};return(!w||b==="both"||!C)&&(j.pointerEvents="none"),{role:"presentation",hidden:!k,style:{...N.positionerStyles,...j}}},[w,b,C,k,N.positionerStyles]),F=a.useMemo(()=>({props:R,...N}),[R,N]),T=a.useMemo(()=>({open:w,side:F.side,align:F.align,anchorHidden:F.anchorHidden}),[w,F.side,F.align,F.anchorHidden]),E=a.useMemo(()=>({...T,arrowRef:F.arrowRef,arrowStyles:F.arrowStyles,arrowUncentered:F.arrowUncentered}),[T,F.arrowRef,F.arrowStyles,F.arrowUncentered]),I=ft("div",n,{state:T,props:[F.props,x],ref:[t,S],customStyleHookMapping:Gi});return f.jsx(Ec.Provider,{value:E,children:I})}),Ym={...Gi,...Ml},Qi=a.forwardRef(function(n,t){const{className:r,render:s,...i}=n,{open:o,instantType:l,transitionStatus:c,popupProps:u,popupRef:m,onOpenChangeComplete:g}=qr(),{side:d,align:p}=Sc();ki({open:o,ref:m,onComplete(){o&&g?.(!0)}});const h=a.useMemo(()=>({open:o,side:d,align:p,instant:l,transitionStatus:c}),[o,d,p,l,c]);return ft("div",n,{state:h,ref:[t,m],props:[u,c==="starting"?eh:St,i],customStyleHookMapping:Ym})}),Xi=a.forwardRef(function(n,t){const{className:r,render:s,...i}=n,{open:o,arrowRef:l,side:c,align:u,arrowUncentered:m,arrowStyles:g}=Sc(),d=a.useMemo(()=>({open:o,side:c,align:u,uncentered:m}),[o,c,u,m]);return ft("div",n,{state:d,ref:[t,l],props:[{style:g,"aria-hidden":!0},i],customStyleHookMapping:Gi})}),Ji=function(n){const{delay:t,closeDelay:r,timeout:s=400}=n,i=a.useMemo(()=>({delay:t,closeDelay:r}),[t,r]),o=a.useMemo(()=>({open:t,close:r}),[t,r]);return f.jsx(xc.Provider,{value:i,children:f.jsx(Rh,{delay:o,timeoutMs:s,children:n.children})})};function _n(e,n){return typeof e=="function"?e(n):e}function Ot(e,n){return Gr(n).reduce((r,s)=>{if(r===null)return null;if(typeof r<"u")return r[s]},e)}function Gn(e,n,t){const r=Gr(n);function s(i){if(!r.length)return _n(t,i);const o=r.shift();if(typeof o=="string"||typeof o=="number"&&!Array.isArray(i))return typeof i=="object"?(i===null&&(i={}),{...i,[o]:s(i[o])}):{[o]:s()};if(Array.isArray(i)&&typeof o=="number"){const l=i.slice(0,o);return[...l.length?l:new Array(o),s(i[o]),...i.slice(o+1)]}return[...new Array(o),s()]}return s(e)}function Qm(e,n){const t=Gr(n);function r(s){if(!s)return;if(t.length===1){const o=t[0];if(Array.isArray(s)&&typeof o=="number")return s.filter((u,m)=>m!==o);const{[o]: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 o=s.slice(0,i);return[...o.length?o: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 Xm=/^(\d+)$/gm,Jm=/\.(\d+)(?=\.)/gm,e1=/^(\d+)\./gm,t1=/\.(\d+$)/gm,n1=/\.{2,}/gm,$s="__int__",Wn=`${$s}$1`;function Gr(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(Xm,Wn).replace(Jm,`.${Wn}.`).replace(e1,`${Wn}.`).replace(t1,`.${Wn}`).replace(n1,".").split(".").map(n=>{if(n.startsWith($s)){const t=n.substring($s.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 r1(e){return!(Array.isArray(e)&&e.length===0)}function _s(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 Hs(e,n){const{asyncDebounceMs:t}=n,{onBlurAsyncDebounceMs:r,onChangeAsyncDebounceMs:s,onDynamicAsyncDebounceMs:i}=n.validators||{},o=t??0,l=c=>c.validators.filter(Boolean).map(u=>{const m=u?.cause||e;let g=o;switch(m){case"change":g=s??o;break;case"blur":g=r??o;break;case"dynamic":g=i??o;break;case"submit":g=0;break}return e==="submit"&&(g=0),{cause:m,validate:u.fn,debounceMs:g}});return n.validationLogic({form:n.form,validators:n.validators,event:{type:e,async:!0},runValidation:l})}const Bs=e=>!!e&&typeof e=="object"&&"fields"in e;function Bt(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)||!Bt(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},Wt=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"},o=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,o],form:e.form});case"server":return e.runValidation({validators:[],form:e.form});case"blur":return e.runValidation({validators:[s,o],form:e.form});case"change":return e.runValidation({validators:[r,o],form:e.form});default:throw new Error(`Unknown validation event type: ${e.event.type}`)}};function s1(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=s1(e);return{form:n,fields:n}},Jt={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)}},Mc=e=>!!e&&"~standard"in e,xr={isValidating:!1,isTouched:!1,isBlurred:!1,isDirty:!1,isPristine:!0,isValid:!0,isDefaultValue:!0,errors:[],errorMap:{},errorSourceMap:{}};function Kn(e){function n(g,d,p,h){const y=r(g,d,p,h);({insert:()=>l(y,g,d),remove:()=>c(y),swap:()=>h!==void 0&&m(y,g,d,h),move:()=>h!==void 0&&u(y,g,d,h)})[p]()}function t(g,d){return`${g}[${d}]`}function r(g,d,p,h){const y=[t(g,d)];if(p==="swap")y.push(t(g,h));else if(p==="move"){const[v,x]=[Math.min(d,h),Math.max(d,h)];for(let w=v;w<=x;w++)y.push(t(g,w))}else{const v=e.getFieldValue(g),x=Array.isArray(v)?v.length:0;for(let w=d+1;w<x;w++)y.push(t(g,w))}return Object.keys(e.fieldInfo).filter(v=>y.some(x=>v.startsWith(x)))}function s(g,d){return g.replace(/\[(\d+)\]/,(p,h)=>{const y=parseInt(h,10);return`[${d==="up"?y+1:Math.max(0,y-1)}]`})}function i(g,d){(d==="up"?g:[...g].reverse()).forEach(h=>{const y=s(h.toString(),d),v=e.getFieldMeta(y);v?e.setFieldMeta(h,v):e.setFieldMeta(h,o())})}const o=()=>xr,l=(g,d,p)=>{i(g,"down"),g.forEach(h=>{h.toString().startsWith(t(d,p))&&e.setFieldMeta(h,o())})},c=g=>{i(g,"up")},u=(g,d,p,h)=>{const y=new Map(Object.keys(e.fieldInfo).filter(v=>v.startsWith(t(d,p))).map(v=>[v,e.getFieldMeta(v)]));i(g,p<h?"up":"down"),Object.keys(e.fieldInfo).filter(v=>v.startsWith(t(d,h))).forEach(v=>{const x=v.replace(t(d,h),t(d,p)),w=y.get(x);w&&e.setFieldMeta(v,w)})},m=(g,d,p,h)=>{g.forEach(y=>{if(!y.toString().startsWith(t(d,p)))return;const v=y.toString().replace(t(d,p),t(d,h)),[x,w]=[e.getFieldMeta(y),e.getFieldMeta(v)];x&&e.setFieldMeta(v,x),w&&e.setFieldMeta(y,w)})};return{handleArrayFieldMetaShift:n}}function fs(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 i1{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&&!Bt(t.defaultValues,r.defaultValues)&&!this.state.isTouched,o=!Bt(t.defaultState,r.defaultState)&&!this.state.isTouched;!i&&!o&&!s||Ue(()=>{this.baseStore.setState(()=>fs(Object.assign({},this.state,o?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(()=>fs({...this.options.defaultState,values:t??this.options.defaultValues??this.options.defaultState?.values,fieldMetaBase:i}))},this.validateAllFields=async t=>{const r=[];return Ue(()=>{Object.values(this.fieldInfo).forEach(i=>{if(!i.instance)return;const o=i.instance;r.push(Promise.resolve().then(()=>o.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),o=Array.isArray(i)?Math.max(i.length-1,0):null,l=[`${t}[${r}]`];for(let g=r+1;g<=(o??0);g++)l.push(`${t}[${g}]`);const c=Object.keys(this.fieldInfo).filter(g=>l.some(d=>g.startsWith(d))),u=[];return Ue(()=>{c.forEach(g=>{u.push(Promise.resolve().then(()=>this.validateField(g,s)))})}),(await Promise.all(u)).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=_s(t,{...this.options,form:this,validationLogic:this.options.validationLogic||Wt});let s=!1;const i={};return Ue(()=>{for(const c of r){if(!c.validate)continue;const u=this.runValidator({validate:c.validate,value:{value:this.state.values,formApi:this,validationSource:"form"},type:"validate"}),{formError:m,fieldErrors:g}=nr(u),d=vn(c.cause);for(const p of Object.keys(this.state.fieldMeta)){const h=this.getFieldMeta(p);if(!h)continue;const{errorMap:y,errorSourceMap:v}=h,x=g?.[p],{newErrorValue:w,newSource:S}=na({newFormValidatorError:x,isPreviousErrorFromFormValidator:v?.[d]==="form",previousErrorValue:y?.[d]});S==="form"&&(i[p]={...i[p],[d]:x}),y?.[d]!==w&&this.setFieldMeta(p,k=>({...k,errorMap:{...k.errorMap,[d]:w},errorSourceMap:{...k.errorSourceMap,[d]:S}}))}this.state.errorMap?.[d]!==m&&this.baseStore.setState(p=>({...p,errorMap:{...p.errorMap,[d]:m}})),(m||g)&&(s=!0)}const o=vn("submit");this.state.errorMap?.[o]&&t!=="submit"&&!s&&this.baseStore.setState(c=>({...c,errorMap:{...c.errorMap,[o]:void 0}}));const l=vn("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=Hs(t,{...this.options,form:this,validationLogic:this.options.validationLogic||Wt});this.state.isFormValidating||this.baseStore.setState(c=>({...c,isFormValidating:!0}));const s=[];let i;for(const c of r){if(!c.validate)continue;const u=vn(c.cause);this.state.validationMetaMap[u]?.lastAbortController.abort();const g=new AbortController;this.state.validationMetaMap[u]={lastAbortController:g},s.push(new Promise(async d=>{let p;try{p=await new Promise((x,w)=>{setTimeout(async()=>{if(g.signal.aborted)return x(void 0);try{x(await this.runValidator({validate:c.validate,value:{value:this.state.values,formApi:this,validationSource:"form",signal:g.signal},type:"validateAsync"}))}catch(S){w(S)}},c.debounceMs)})}catch(x){p=x}const{formError:h,fieldErrors:y}=nr(p);y&&(i=i?{...i,...y}:y);const v=vn(c.cause);for(const x of Object.keys(this.state.fieldMeta)){const w=this.getFieldMeta(x);if(!w)continue;const{errorMap:S,errorSourceMap:k}=w,O=i?.[x],{newErrorValue:b,newSource:C}=na({newFormValidatorError:O,isPreviousErrorFromFormValidator:k?.[v]==="form",previousErrorValue:S?.[v]});S?.[v]!==b&&this.setFieldMeta(x,M=>({...M,errorMap:{...M.errorMap,[v]:b},errorSourceMap:{...M.errorSourceMap,[v]:C}}))}this.baseStore.setState(x=>({...x,errorMap:{...x.errorMap,[v]:h}})),d(i?{fieldErrors:i,errorMapKey:v}:void 0)}))}let o=[];const l={};if(s.length){o=await Promise.all(s);for(const c of o)if(c?.fieldErrors){const{errorMapKey:u}=c;for(const[m,g]of Object.entries(c.fieldErrors)){const p={...l[m]||{},[u]:g};l[m]=p}}}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=>Ot(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]:_n(r,s.fieldMetaBase[t])}}))},this.resetFieldMeta=t=>Object.keys(t).reduce((r,s)=>{const i=s;return r[i]=xr,r},{}),this.setFieldValue=(t,r,s)=>{const i=s?.dontUpdateMeta??!1;Ue(()=>{i||this.setFieldMeta(t,o=>({...o,isTouched:!0,isDirty:!0,errorMap:{...o?.errorMap,onMount:void 0}})),this.baseStore.setState(o=>({...o,values:Gn(o.values,t,r)}))})},this.deleteField=t=>{const s=[...Object.keys(this.fieldInfo).filter(i=>{const o=t.toString();return i!==o&&i.startsWith(o)}),t];this.baseStore.setState(i=>{const o={...i};return s.forEach(l=>{o.values=Qm(o.values,l),delete this.fieldInfo[l],delete o.fieldMetaBase[l]}),o})},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,o=>[...o.slice(0,r),s,...o.slice(r)],i),await this.validateField(t,"change"),Kn(this).handleArrayFieldMetaShift(t,r,"insert"),await this.validateArrayFieldsStartingFrom(t,r,"change")},this.replaceFieldValue=async(t,r,s,i)=>{this.setFieldValue(t,o=>o.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),o=Array.isArray(i)?Math.max(i.length-1,0):null;if(this.setFieldValue(t,l=>l.filter((c,u)=>u!==r),s),Kn(this).handleArrayFieldMetaShift(t,r,"remove"),o!==null){const l=`${t}[${o}]`;this.deleteField(l)}await this.validateField(t,"change"),await this.validateArrayFieldsStartingFrom(t,r,"change")},this.swapFieldValues=(t,r,s,i)=>{this.setFieldValue(t,o=>{const l=o[r],c=o[s];return Gn(Gn(o,`${r}`,c),`${s}`,l)},i),Kn(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,o=>{const l=[...o];return l.splice(s,0,l.splice(r,1)[0]),l},i),Kn(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 o=0;o<=i;o++){const l=`${t}[${o}]`;this.deleteField(l)}this.validateField(t,"change")},this.resetField=t=>{this.baseStore.setState(r=>({...r,fieldMetaBase:{...r.fieldMetaBase,[t]:xr},values:this.options.defaultValues?Gn(r.values,t,Ot(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=>Jt.validate({value:this.state.values,validationSource:"form"},t),this.parseValuesWithSchemaAsync=t=>Jt.validateAsync({value:this.state.values,validationSource:"form"},t),this.baseStore=new ad(fs({...n?.defaultState,values:n?.defaultValues??n?.defaultState?.values})),this.fieldMetaDerived=new lr({deps:[this.baseStore],fn:({prevDepVals:t,currDepVals:r,prevVal:s})=>{const i=s,o=t?.[0],l=r[0];let c=0;const u={};for(const m of Object.keys(l.fieldMetaBase)){const g=l.fieldMetaBase[m],d=o?.fieldMetaBase[m],p=i?.[m],h=Ot(l.values,m);let y=p?.errors;if(!d||g.errorMap!==d.errorMap){y=Object.values(g.errorMap??{}).filter(k=>k!==void 0);const S=this.getFieldInfo(m)?.instance;S&&!S.options.disableErrorFlat&&(y=y?.flat(1))}const v=!r1(y??[]),x=!g.isDirty,w=Bt(h,Ot(this.options.defaultValues,m))||Bt(h,this.getFieldInfo(m)?.instance?.options.defaultValue);if(p&&p.isPristine===x&&p.isValid===v&&p.isDefaultValue===w&&p.errors===y&&g===d){u[m]=p,c++;continue}u[m]={...g,errors:y,isPristine:x,isValid:v,isDefaultValue:w}}return Object.keys(l.fieldMetaBase).length&&i&&c===Object.keys(l.fieldMetaBase).length?i:u}}),this.store=new lr({deps:[this.baseStore,this.fieldMetaDerived],fn:({prevDepVals:t,currDepVals:r,prevVal:s})=>{const i=s,o=t?.[0],l=r[0],c=r[1],u=Object.values(c).filter(Boolean),m=u.some(E=>E.isValidating),g=u.every(E=>E.isValid),d=u.some(E=>E.isTouched),p=u.some(E=>E.isBlurred),h=u.every(E=>E.isDefaultValue),y=d&&l.errorMap?.onMount,v=u.some(E=>E.isDirty),x=!v,w=!!(l.errorMap?.onMount||u.some(E=>E?.errorMap?.onMount)),S=!!m;let k=i?.errors??[];(!o||l.errorMap!==o.errorMap)&&(k=Object.values(l.errorMap).reduce((E,I)=>I===void 0?E:I&&Bs(I)?(E.push(I.form),E):(E.push(I),E),[]));const O=k.length===0,b=g&&O,C=this.options.canSubmitWhenInvalid??!1,M=l.submissionAttempts===0&&!d&&!w||!S&&!l.isSubmitting&&b||C;let N=l.errorMap;if(y&&(k=k.filter(E=>E!==l.errorMap.onMount),N=Object.assign(N,{onMount:void 0})),i&&o&&i.errorMap===N&&i.fieldMeta===this.fieldMetaDerived.state&&i.errors===k&&i.isFieldsValidating===m&&i.isFieldsValid===g&&i.isFormValid===O&&i.isValid===b&&i.canSubmit===M&&i.isTouched===d&&i.isBlurred===p&&i.isPristine===x&&i.isDefaultValue===h&&i.isDirty===v&&Bt(o,l))return i;let R={...l,errorMap:N,fieldMeta:this.fieldMetaDerived.state,errors:k,isFieldsValidating:m,isFieldsValid:g,isFormValid:O,isValid:b,canSubmit:M,isTouched:d,isBlurred:p,isPristine:x,isDefaultValue:h,isDirty:v};const F=this.options.transform?.deps??[];if(F.length!==this.prevTransformArray.length||F.some((E,I)=>E!==this.prevTransformArray[I])){const E=Object.assign({},this,{state:R});this.options.transform?.fn(E),R=E.state,this.prevTransformArray=F}return R}}),this.handleSubmit=this.handleSubmit.bind(this),this.update(n||{})}get state(){return this.store.state}get formId(){return this.options.formId}runValidator(n){return Mc(n.validate)?Jt[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})),Ue(()=>{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}Ue(()=>{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}),Ue(()=>{this.baseStore.setState(s=>({...s,isSubmitted:!0,isSubmitSuccessful:!0})),r()})}catch(s){throw this.baseStore.setState(i=>({...i,isSubmitSuccessful:!1})),r(),s}}setErrorMap(n){Ue(()=>{Object.entries(n).forEach(([t,r])=>{const s=t;if(Bs(r)){const{formError:i,fieldErrors:o}=nr(r);for(const l of Object.keys(this.fieldInfo))this.getFieldMeta(l)&&this.setFieldMeta(l,u=>({...u,errorMap:{...u.errorMap,[s]:o?.[l]},errorSourceMap:{...u.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 nr(e){if(e){if(Bs(e)){const n=nr(e.form).formError,t=e.fields;return{formError:n,fieldErrors:t}}return{formError:e}}return{formError:void 0}}function vn(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 o1{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(o=>({...o,errorMap:{...o?.errorMap,onMount:i},errorSourceMap:{...o?.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=Ot(t.form.options.defaultValues,t.name),i=t.defaultValue??s;r?this.setValue(o=>o||i,{dontUpdateMeta:!0}):i!==void 0&&this.setValue(i,{dontUpdateMeta:!0})}this.form.getFieldMeta(this.name)===void 0&&this.setMeta(this.state.meta)},this.getValue=()=>this.form.getFieldValue(this.name),this.setValue=(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:o,onBlurListenTo:l}=i.instance.options.validators||{};t==="change"&&o?.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=_s(t,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||Wt}),o=this.getLinkedFields(t).reduce((u,m)=>{const g=_s(t,{...m.options,form:m.form,validationLogic:m.form.options.validationLogic||Wt});return g.forEach(d=>{d.field=m}),u.concat(g)},[]);let l=!1;Ue(()=>{const u=(m,g)=>{const d=Yn(g.cause),p=g.validate?ia(m.runValidator({validate:g.validate,value:{value:m.store.state.value,validationSource:"field",fieldApi:m},type:"validate"})):void 0,h=r[d],{newErrorValue:y,newSource:v}=ra({formLevelError:h,fieldLevelError:p});m.state.meta.errorMap?.[d]!==y&&m.setMeta(x=>({...x,errorMap:{...x.errorMap,[d]:y},errorSourceMap:{...x.errorSourceMap,[d]:v}})),y&&(l=!0)};for(const m of s)u(this,m);for(const m of o)m.validate&&u(m.field,m)});const c=Yn("submit");return this.state.meta.errorMap?.[c]&&t!=="submit"&&!l&&this.setMeta(u=>({...u,errorMap:{...u.errorMap,[c]:void 0},errorSourceMap:{...u.errorSourceMap,[c]:void 0}})),{hasErrored:l}},this.validateAsync=async(t,r)=>{const s=Hs(t,{...this.options,form:this.form,validationLogic:this.form.options.validationLogic||Wt}),i=await r,o=this.getLinkedFields(t),l=o.reduce((d,p)=>{const h=Hs(t,{...p.options,form:p.form,validationLogic:p.form.options.validationLogic||Wt});return h.forEach(y=>{y.field=p}),d.concat(h)},[]);this.state.meta.isValidating||this.setMeta(d=>({...d,isValidating:!0}));for(const d of o)d.setMeta(p=>({...p,isValidating:!0}));const c=[],u=[],m=(d,p,h)=>{const y=Yn(p.cause);d.getInfo().validationMetaMap[y]?.lastAbortController.abort();const x=new AbortController;this.getInfo().validationMetaMap[y]={lastAbortController:x},h.push(new Promise(async w=>{let S;try{S=await new Promise((M,N)=>{this.timeoutIds.validations[p.cause]&&clearTimeout(this.timeoutIds.validations[p.cause]),this.timeoutIds.validations[p.cause]=setTimeout(async()=>{if(x.signal.aborted)return M(void 0);try{M(await this.runValidator({validate:p.validate,value:{value:d.store.state.value,fieldApi:d,signal:x.signal,validationSource:"field"},type:"validateAsync"}))}catch(R){N(R)}},p.debounceMs)})}catch(M){S=M}if(x.signal.aborted)return w(void 0);const k=ia(S),O=i[this.name]?.[y],{newErrorValue:b,newSource:C}=ra({formLevelError:O,fieldLevelError:k});d.setMeta(M=>({...M,errorMap:{...M?.errorMap,[y]:b},errorSourceMap:{...M.errorSourceMap,[y]:C}})),w(b)}))};for(const d of s)d.validate&&m(this,d,c);for(const d of l)d.validate&&m(d.field,d,u);let g=[];(c.length||u.length)&&(g=await Promise.all(c),await Promise.all(u)),this.setMeta(d=>({...d,isValidating:!1}));for(const d of o)d.setMeta(p=>({...p,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[Yn(t)]?.lastAbortController.abort(),this.state.meta.errors;const o=r?.skipFormValidation?Promise.resolve({}):this.form.validateAsync(t);return this.validateAsync(t,o)},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=>Jt.validate({value:this.state.value,validationSource:"field"},t),this.parseValueWithSchemaAsync=t=>Jt.validateAsync({value:this.state.value,validationSource:"field"},t),this.form=n.form,this.name=n.name,this.timeoutIds={validations:{},listeners:{},formListeners:{}},this.store=new lr({deps:[this.form.store],fn:()=>{const t=this.form.getFieldValue(this.name),r=this.form.getFieldMeta(this.name)??{...xr,...n.defaultMeta};return{value:t,meta:r}}}),this.options=n}get state(){return this.store.state}runValidator(n){return Mc(n.validate)?Jt[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 Yn(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 wr{constructor(n){if(this.getFormFieldName=t=>{if(typeof this.fieldsMap=="string")return ta(this.fieldsMap,t);const r=Gr(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 wr){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 lr({deps:[this.form.store],fn:({currDepVals:t})=>{const r=t[0];let s;if(typeof this.fieldsMap=="string")s=Ot(r.values,this.fieldsMap);else{s={};const i=this.fieldsMap;for(const o in i)s[o]=Ot(r.values,i[o])}return{values:s}}})}get state(){return this.store.state}async handleSubmit(n){return this.form.handleSubmit(n)}}const An=typeof window<"u"?a.useLayoutEffect:a.useEffect;function a1(e){const[n]=a.useState(()=>{const r=new o1({...e,form:e.form,name:e.name});return r.Field=Cc,r});return An(n.mount,[n]),An(()=>{n.update(e)}),Ee(n.store,e.mode==="array"?t=>[t.meta,Object.keys(t.value??[]).length]:void 0),n}const Cc=({children:e,...n})=>{const t=a1(n),r=a.useMemo(()=>_n(e,t),[e,t,t.state.value,t.state.meta]);return f.jsx(f.Fragment,{children:r})};function l1({form:e,selector:n,children:t}){const r=Ee(e.store,n);return _n(t,r)}function c1(e){const[n]=a.useState(()=>{const t=new i1(e),r=t;return r.Field=function(i){return f.jsx(Cc,{...i,form:t})},r.Subscribe=function(i){return f.jsx(l1,{form:t,selector:i.selector,children:i.children})},r});return An(n.mount,[]),An(()=>{n.update(e)}),n}function u1({lens:e,selector:n,children:t}){const r=Ee(e.store,n);return _n(t,r)}function d1(e){const[n]=a.useState(()=>{const t=new wr(e),r=e.form instanceof wr?e.form.form:e.form,s=t;return s.AppForm=function(o){return f.jsx(r.AppForm,{...o})},s.AppField=function({name:o,...l}){return f.jsx(r.AppField,{name:n.getFormFieldName(o),...l})},s.Field=function({name:o,...l}){return f.jsx(r.Field,{name:n.getFormFieldName(o),...l})},s.Subscribe=function(o){return f.jsx(u1,{lens:n,selector:o.selector,children:o.children})},Object.assign(s,{...e.formComponents})});return An(n.mount,[n]),n}const oa=a.createContext(null),aa=a.createContext(null);function f1(){function e(){const t=a.useContext(oa);if(!t)throw new Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");return t}function n(){const t=a.useContext(aa);if(!t)throw new Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");return t}return{fieldContext:oa,useFieldContext:e,useFormContext:n,formContext:aa}}function eo({fieldComponents:e,fieldContext:n,formContext:t,formComponents:r}){function s(l){const c=c1(l),u=a.useMemo(()=>({children:p})=>f.jsx(t.Provider,{value:c,children:p}),[c]),m=a.useMemo(()=>({children:p,...h})=>f.jsx(c.Field,{...h,children:y=>f.jsx(n.Provider,{value:y,children:p(Object.assign(y,e))})}),[c]);return a.useMemo(()=>Object.assign(c,{AppField:m,AppForm:u,...r}),[c,m,u])}function i({render:l,props:c}){return u=>l({...c,...u})}function o({render:l,props:c,defaultValues:u}){return function(g){const d=a.useMemo(()=>({form:g.form,fields:g.fields,defaultValues:u,formComponents:r}),[g.form,g.fields]),p=d1(d);return l({...c,...g,group:p})}}return{useAppForm:s,withForm:i,withFieldGroup:o}}function to(e){return f.jsxs("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...e,children:[f.jsx("title",{children:"Tooltip positioner arrow"}),f.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"}),f.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"}),f.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:no,useFieldContext:pn,formContext:ro,useFormContext:h1}=f1();function p1({id:e,name:n,label:t,...r}){const s=pn();return f.jsxs("fieldset",{children:[f.jsx("legend",{className:"sr-only",children:n}),f.jsxs("div",{className:"flex items-center gap-3",children:[f.jsx("div",{className:"flex h-6 shrink-0 items-center",children:f.jsx("div",{className:"group grid size-4 grid-cols-1",children:f.jsx(jp,{...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:f.jsx(ut,{className:"group-data-checked:opacity-100 stroke-white text-white opacity-0 size-4","aria-hidden":"true"})})})}),f.jsx("div",{className:"text-sm/6 mt-1",children:f.jsx("label",{htmlFor:n||e,className:"font-medium text-gray-900 dark:text-white",children:t})})]})]})}function Pt(...e){return e.filter(Boolean).join(" ")}function Er(){return f.jsx("div",{className:"flex items-center justify-center",children:f.jsx("div",{className:"w-6 h-6 border-4 border-gray-600 rounded-full animate-spin border-t-transparent"})})}function Tc({status:e,tooltip:n,children:t}){const r=h1();return f.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:o,dirty:l})=>n?f.jsx(Ji,{delay:300,closeDelay:1e3,children:f.jsxs(Ui,{disabled:n.disabled||!1,children:[f.jsx(Wi,{type:"submit",disabled:!s||!o||!l||i,"data-state":e,className:Pt("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"?f.jsx(Er,{}):e==="success"?f.jsxs(f.Fragment,{children:[f.jsx(ut,{className:"size-5 text-white","aria-hidden":"true"}),t]}):e==="error"?f.jsxs(f.Fragment,{children:[f.jsx(yr,{className:"size-5 text-white","aria-hidden":"true"}),"Error"]}):t}),f.jsx(Ki,{children:f.jsx(Yi,{side:"top",sideOffset:10,children:f.jsxs(Qi,{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:[f.jsx(Xi,{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:f.jsx(to,{})}),f.jsx("span",{className:"text-xs text-gray-700 dark:text-white whitespace-break-spaces w-full",children:n.content})]})})})]})}):f.jsx("button",{type:"submit",disabled:!s||!o||!l||i,"data-state":e,className:Pt("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"?f.jsx(Er,{}):e==="success"?f.jsxs(f.Fragment,{children:[f.jsx(ut,{className:"size-5 text-white","aria-hidden":"true"}),t]}):e==="error"?f.jsxs(f.Fragment,{children:[f.jsx(yr,{className:"size-5 text-white","aria-hidden":"true"}),"Error"]}):t})})}function Wr({id:e,errors:n}){return f.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 f.jsx("div",{className:"text-sm text-red-600 dark:text-red-500 w-full",children:typeof t=="string"?t:t.message},s)})})}function Rc({id:e,label:n,hint:t,...r}){const s=pn(),i=Ee(s.store,c=>c.meta.errors),o=Ee(s.store,c=>c.meta.isTouched),l=i.length>0&&o;return f.jsxs("div",{children:[n!=null?f.jsxs("label",{htmlFor:r.name,className:"block text-sm/6 font-medium text-gray-900 dark:text-white",children:[n,r.required?"*":""]}):null,f.jsxs("div",{className:Pt("grid grid-cols-1",n!=null?"mt-2":"mt-0"),children:[f.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:f.jsx(pm,{...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?f.jsx(Wr,{id:`${e}-invalid`,errors:i}):null,t!=null&&!l?f.jsx("p",{id:`${e}-hint`,className:"mt-3 text-sm/6 text-gray-400",children:t}):null]})]})}function Pe({children:e,...n}){return f.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 m1=Ve({spaceId:sn,name:sn}),{useAppForm:g1}=eo({fieldComponents:{SchemaSpaceSelect:v1},formComponents:{SubmitButton:Tc},fieldContext:no,formContext:ro});function y1({open:e,setOpen:n,spaceSubmitted:t}){const{setAppSchemaSpace:r}=Ha(),s=a.useId(),o=g1({defaultValues:{spaceId:"",name:""},validators:{onChange:Ba(m1)},onSubmit({value:c}){const u={id:ie(c.spaceId),name:c.name};r(u),t(u)}}),l=Ee(o.store,c=>c.values.name);return f.jsxs(Y0,{open:e,onClose:n,className:"relative z-10",children:[f.jsx(K0,{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"}),f.jsx("form",{noValidate:!0,className:"fixed inset-0 z-10 w-screen overflow-y-auto",onSubmit:c=>{c.preventDefault(),c.stopPropagation(),o.handleSubmit()},children:f.jsx("div",{className:"flex min-h-full items-end justify-center p-4 text-center sm:items-center sm:p-0",children:f.jsxs(lc,{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:[f.jsx("div",{className:"absolute top-0 right-0 hidden pt-4 pr-4 sm:block",children:f.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:[f.jsx("span",{className:"sr-only",children:"Close"}),f.jsx(Ri,{"aria-hidden":"true",className:"size-6"})]})}),f.jsxs("div",{className:"sm:flex sm:items-start",children:[f.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:f.jsx(Ti,{"aria-hidden":"true",className:"size-6 text-yellow-600 dark:text-yellow-400"})}),f.jsxs("div",{className:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left",children:[f.jsx(cc,{as:"h3",className:"text-base font-semibold text-gray-900 dark:text-white",children:"Select Space"}),f.jsx("div",{className:"mt-2 flex flex-col gap-y-4 w-full",children:f.jsx(o.AppField,{name:"spaceId",children:c=>f.jsx(c.SchemaSpaceSelect,{id:s,name:"spaceId",spaceSelected:u=>{o.setFieldValue("name",u.name||u.id),o.setFieldValue("spaceId",u.id)}})})})]})]}),f.jsxs("div",{className:"mt-5 sm:mt-4 sm:flex sm:flex-row-reverse sm:gap-x-2",children:[f.jsx(o.AppForm,{children:f.jsxs(o.SubmitButton,{status:"idle",children:["Select Space ",f.jsx(Pe,{children:l})," & Publish"]})}),f.jsx("button",{type:"button",onClick:()=>{o.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 v1({id:e,name:n,spaceSelected:t}){const{redirectToConnect:r}=Ys(),{authenticated:s}=Za(),{data:i=[],isPending:o}=$f({mode:"public"}),l=pn(),c=Ee(l.store,d=>d.value),u=Ee(l.store,d=>d.meta.errors),m=Ee(l.store,d=>d.meta.isTouched),g=u.length>0&&m;return s?!o&&i.length===0?f.jsxs("div",{className:"w-full flex flex-col gap-y-2",children:[f.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"}),f.jsx("p",{className:"text-xs text-gray-700 dark:text-gray-300",children:"Reconnect to Geo connect and connect public spaces"}),f.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(d){window.location.href=d.toString()}}),children:"Connect Spaces"})]}):f.jsxs("div",{className:"relative flex flex-col gap-y-2 w-full",children:[f.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:[f.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(d=>f.jsxs("label",{"aria-label":d.name||d.id,"aria-description":`space-${d.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:[f.jsx("input",{value:d.id,checked:d.id===c,onChange:p=>{p.target.checked&&(l.handleChange(d.id),t(d))},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"}),f.jsxs("span",{className:"ml-3 flex flex-col gap-y-1",children:[f.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:d.name||d.id}),f.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:d.name!=null?f.jsx(Pe,{children:d.id}):null})]})]},d.id))]}),g?f.jsx(Wr,{id:`${e}-invalid`,errors:u}):null]}):f.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(d){window.location.href=d.toString()}}),children:"Sign in to Geo Account"})}function b1(e){return f.jsx("span",{className:"hidden dark:inline-block",children:f.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:[f.jsx("title",{children:"Published to Knowledge Graph"}),f.jsxs("g",{clipPath:"url(#clip0_59284_4458)",children:[f.jsx("circle",{cx:"8.0032",cy:"1.75",r:"1.25",stroke:"white"}),f.jsx("circle",{cx:"8.0032",cy:"14.25",r:"1.25",stroke:"white"}),f.jsx("path",{d:"M7.99641 13.255L8.0032 2.75",stroke:"white"}),f.jsx("circle",{cx:"13.4159",cy:"5.125",r:"1.25",transform:"rotate(60 13.4159 5.125)",stroke:"white"}),f.jsx("circle",{cx:"2.59055",cy:"11.375",r:"1.25",transform:"rotate(60 2.59055 11.375)",stroke:"white"}),f.jsx("path",{d:"M3.44885 10.8716L12.5498 5.625",stroke:"white"}),f.jsx("circle",{cx:"13.4159",cy:"11.375",r:"1.25",transform:"rotate(120 13.4159 11.375)",stroke:"white"}),f.jsx("circle",{cx:"2.59055",cy:"5.125",r:"1.25",transform:"rotate(120 2.59055 5.125)",stroke:"white"}),f.jsx("path",{d:"M3.45564 5.61662L12.5498 10.875",stroke:"white"})]}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_59284_4458",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})})}function x1(e){return f.jsx("span",{className:"inline-block dark:hidden",children:f.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:[f.jsx("title",{children:"Published to Knowledge Graph"}),f.jsxs("g",{clipPath:"url(#clip0_59285_4572)",children:[f.jsx("circle",{cx:"8.0032",cy:"1.75",r:"1.25",stroke:"#2A2A2A"}),f.jsx("circle",{cx:"8.0032",cy:"14.25",r:"1.25",stroke:"#2A2A2A"}),f.jsx("path",{d:"M7.99641 13.255L8.0032 2.75",stroke:"#2A2A2A"}),f.jsx("circle",{cx:"13.4159",cy:"5.125",r:"1.25",transform:"rotate(60 13.4159 5.125)",stroke:"#2A2A2A"}),f.jsx("circle",{cx:"2.59055",cy:"11.375",r:"1.25",transform:"rotate(60 2.59055 11.375)",stroke:"#2A2A2A"}),f.jsx("path",{d:"M3.44885 10.8716L12.5498 5.625",stroke:"#2A2A2A"}),f.jsx("circle",{cx:"13.4159",cy:"11.375",r:"1.25",transform:"rotate(120 13.4159 11.375)",stroke:"#2A2A2A"}),f.jsx("circle",{cx:"2.59055",cy:"5.125",r:"1.25",transform:"rotate(120 2.59055 5.125)",stroke:"#2A2A2A"}),f.jsx("path",{d:"M3.45564 5.61662L12.5498 10.875",stroke:"#2A2A2A"})]}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_59285_4572",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})})}function Oc(e){return f.jsxs(f.Fragment,{children:[f.jsx(b1,{...e}),f.jsx(x1,{...e})]})}const w1={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"}}]}}]}}]}}]}}]}}]},E1={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"}}]}}]}}]}}]}}]}}]},S1={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"}}]}}]}}]}}]}}]},k1={"\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":w1,'\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':E1,"\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":S1};function so(e){return k1[e]??{}}const M1=so(`
20
+ query SchemaBrowserTypes($first: Int) {
21
+ typesList(first: $first) {
22
+ id
23
+ name
24
+ description
25
+ properties {
26
+ id
27
+ name
28
+ dataType
29
+ relationValueTypes {
30
+ id
31
+ name
32
+ description
33
+ properties {
34
+ id
35
+ name
36
+ dataType
37
+ }
38
+ }
39
+ }
40
+ }
41
+ }
42
+ `),C1=so(`
43
+ query TypeSearch($query: String!, $first: Int) {
44
+ typesList: search(
45
+ query: $query
46
+ first: $first
47
+ filter: {backlinksExist: true, typeIds: {in: ["e7d737c5-3676-4c60-9fa1-6aa64a8c90ad"]}}
48
+ ) {
49
+ id
50
+ name
51
+ description
52
+ properties {
53
+ id
54
+ name
55
+ dataType
56
+ relationValueTypes {
57
+ id
58
+ name
59
+ description
60
+ properties {
61
+ id
62
+ name
63
+ dataType
64
+ }
65
+ }
66
+ }
67
+ }
68
+ }
69
+ `);async function T1(e=null,n=100){try{return e?await Ss.request(C1,{query:e,first:n}):await Ss.request(M1,{first:n})}catch{return console.error("failure fetching schema types"),{__typename:"Query",typesList:[]}}}const Fc=Ve({id:it,dataType:Ws("STRING","NUMBER","BOOLEAN","TIME","POINT","RELATION"),name:sn}),R1=Ve({id:it,name:sn,description:en(sn),properties:en(vt(Fc))}),Ic=Ve({...Fc.fields,relationValueTypes:vt(R1)}),O1=Ve({id:it,name:sn,properties:vt(Ic)});O1.pipe(Ks(Ve({slug:De})));const F1=za(Ua,e=>e.name||e.id);function I1(e){const n=re(e.properties??[],ye(t=>t!=null),st("",(t,r)=>`${t}${r.name}`));return`${e.name||""}${n}`.toLowerCase()}const V1=e=>({queryKey:["Hypergraph","Typesync","Studio","Schema","types",e],async queryFn(){return await T1(e.query,e.first||void 0).then(n=>n.typesList??[]).then(n=>re(n,ye(t=>t!=null&&t.name!=null),xe(t=>{const r=re(t.properties??[],ye(o=>o!=null&&o.name!=null),xe(o=>({id:o.id,dataType:o.dataType,name:o.name,relationValueTypes:re(o.relationValueTypes??[],ye(l=>l!=null&&l.name!=null),xe(l=>({id:l.id,name:l.name,description:l.description||null,properties:re(l.properties??[],ye(c=>c.name!=null),xe(c=>({id:c.id,dataType:c.dataType,name:c.name})))})))}))),s={id:t.id,name:t.name,properties:r},i=I1(s);return{...s,slug:i}}),qa(F1)))}});function Vc(e={query:null,first:100},n={}){return Si({...V1(e),...n})}const A1=so(`
70
+ query Properties($query: String, $first: Int) {
71
+ properties(
72
+ first: $first
73
+ filter: {or: [{name: {includesInsensitive: $query}}, {description: {includesInsensitive: $query}}]}
74
+ ) {
75
+ id
76
+ name
77
+ description
78
+ dataType
79
+ relationValueTypes {
80
+ id
81
+ name
82
+ description
83
+ properties {
84
+ id
85
+ dataType
86
+ name
87
+ }
88
+ }
89
+ }
90
+ }
91
+ `);async function P1(e=null,n=100){try{return await Ss.request(A1,{query:e,first:n})}catch{return console.error("failure fetching schema types"),{__typename:"Query",properties:[]}}}Ic.pipe(Ks(Ve({description:en(De),slug:ld})));const j1=za(Ua,e=>e.name||e.id),N1=e=>({queryKey:["Hypergraph","Typesync","Studio","Schema","properties",e],async queryFn(){return await P1(e.query,e.first||void 0).then(n=>n.properties??[]).then(n=>re(n,ye(t=>t.name!=null),xe(t=>{const r=`${t.dataType}${t.name||""}${t.id}`.toLowerCase();return{id:t.id,dataType:t.dataType,name:t.name,description:t.description||null,relationValueTypes:re(t.relationValueTypes??[],ye(i=>i!=null&&i.name!=null),xe(i=>({id:i.id,name:i.name,description:i.description||null,properties:re(i.properties??[],ye(o=>o.name!=null),xe(o=>({id:o.id,dataType:o.dataType,name:o.name})))}))),slug:r}}),qa(j1)))}});function L1(e={query:null,first:100},n={}){return Si({...N1(e),...n})}function Mt(e,n){switch(e){case"BOOLEAN":return"Boolean";case"NUMBER":return"Number";case"POINT":return"Point";case"TIME":return"Date";case"RELATION":return`Relation(${n})`;default:return"String"}}const{useAppForm:D1}=eo({fieldComponents:{TextField:Rc},formComponents:{},fieldContext:no,formContext:ro});function $1({typeSelected:e}){const[n,t]=a.useState(""),r=D1({defaultValues:{search:""},asyncDebounceMs:300}),{data:s,isLoading:i}=Vc({query:at(n)?Vt(n):null,first:100},{refetchOnMount:!1,refetchOnWindowFocus:!1}),o=a.useId();return f.jsxs("div",{className:"flex flex-col gap-y-6",children:[f.jsxs("div",{className:"border-b border-gray-200 dark:border-white/20 pb-5 h-20",children:[f.jsxs("h3",{className:"text-sm/6 font-semibold text-gray-900 dark:text-white flex items-center gap-x-3",children:["Schema Browser",i?f.jsx(Er,{}):null]}),f.jsx("p",{className:"mt-2 max-w-4xl text-sm text-gray-500 dark:text-gray-200",children:"Browse existing schemas/types from the Knowledge Graph to add to your schema."})]}),f.jsxs("div",{className:"bg-gray-100 dark:bg-slate-900 rounded-lg flex flex-col gap-y-3 pt-2",children:[f.jsx("div",{className:"px-3 mt-2",children:f.jsx(r.AppField,{name:"search",listeners:{onChangeDebounceMs:300,onChange({value:l}){t(l)}},children:l=>f.jsx(l.TextField,{id:o,name:"search",type:"search",placeholder:"Search Knowledge Graph types..."})})}),f.jsx("ul",{className:"px-4 divide-y divide-gray-100 dark:divide-gray-700 overflow-y-auto h-[500px] 2xl:h-[850px]",children:(s??[]).map(l=>{const c=ye(l.properties??[],u=>u!=null);return f.jsxs(dm,{as:"li",className:"py-3 flex flex-col gap-y-2",children:[f.jsxs("div",{className:"flex items-center justify-between gap-x-6",children:[f.jsx(dc,{as:"div","data-interactive":"clickable",className:"min-w-0 data-[interactive=clickable]:cursor-pointer group",children:f.jsxs("div",{className:"flex items-center gap-x-2",children:[f.jsx(Ll,{className:"size-4 hidden group-data-open:flex","aria-hidden":"true"}),f.jsx(Dl,{className:"size-4 flex group-data-open:hidden","aria-hidden":"true"}),f.jsx("p",{className:"text-sm/6 font-semibold text-gray-900 dark:text-white",children:l.name||l.id}),f.jsx("div",{className:"hidden 2xl:block",children:f.jsx(Pe,{children:l.id})}),f.jsx("div",{className:"block 2xl:hidden",children:f.jsx(Pe,{children:`${l.id.substring(0,6)}...${l.id.substring(l.id.length-6,l.id.length)}`})})]})}),f.jsx("div",{className:"flex flex-none items-center justify-end",children:f.jsx("button",{type:"button",className:"rounded-md bg-white dark:bg-black p-2 cursor-pointer text-sm font-semibold text-gray-900 dark:text-white shadow-xs ring-1 ring-gray-300 dark:ring-black/15 ring-inset hover:bg-gray-50 dark:hover:bg-slate-950 inline-flex flex-col items-center justify-center",onClick:()=>e(l),children:f.jsx(vr,{className:"size-5 text-gray-400 dark:text-gray-200 group-data-focus:text-gray-500 dark:group-data-focus:text-gray-200","aria-hidden":"true"})})})]}),f.jsx(fc,{as:"div",transition:!0,className:"w-full origin-top transition duration-200 ease-out data-closed:-translate-y-6 data-closed:opacity-0 py-1.5 flex flex-col gap-y-1",children:f.jsx("ul",{className:"w-full pl-6 pr-3 divide-y divide-gray-300 dark:divide-gray-800",children:c.map(u=>f.jsxs("li",{className:"w-full text-xs py-1.5 flex items-center gap-x-2 list-disc",children:[u.name||u.id,u.dataType!=null?f.jsx(Pe,{children:Mt(u.dataType,u.name||u.id)}):null]},u.id))})})]},l.id)})})]})]})}var hs,la;function _1(){if(la)return hs;la=1;var e="Expected a function",n=NaN,t="[object Symbol]",r=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,i=/^0b[01]+$/i,o=/^0o[0-7]+$/i,l=parseInt,c=typeof Bn=="object"&&Bn&&Bn.Object===Object&&Bn,u=typeof self=="object"&&self&&self.Object===Object&&self,m=c||u||Function("return this")(),g=Object.prototype,d=g.toString,p=Math.max,h=Math.min,y=function(){return m.Date.now()};function v(O,b,C){var M,N,R,F,T,E,I=0,j=!1,U=!1,L=!0;if(typeof O!="function")throw new TypeError(e);b=k(b)||0,x(C)&&(j=!!C.leading,U="maxWait"in C,R=U?p(k(C.maxWait)||0,b):R,L="trailing"in C?!!C.trailing:L);function P(V){var D=M,_=N;return M=N=void 0,I=V,F=O.apply(_,D),F}function H(V){return I=V,T=setTimeout(q,b),j?P(V):F}function z(V){var D=V-E,_=V-I,G=b-D;return U?h(G,R-_):G}function K(V){var D=V-E,_=V-I;return E===void 0||D>=b||D<0||U&&_>=R}function q(){var V=y();if(K(V))return $(V);T=setTimeout(q,z(V))}function $(V){return T=void 0,L&&M?P(V):(M=N=void 0,F)}function B(){T!==void 0&&clearTimeout(T),I=0,M=E=N=T=void 0}function X(){return T===void 0?F:$(y())}function A(){var V=y(),D=K(V);if(M=arguments,N=this,E=V,D){if(T===void 0)return H(E);if(U)return T=setTimeout(q,b),P(E)}return T===void 0&&(T=setTimeout(q,b)),F}return A.cancel=B,A.flush=X,A}function x(O){var b=typeof O;return!!O&&(b=="object"||b=="function")}function w(O){return!!O&&typeof O=="object"}function S(O){return typeof O=="symbol"||w(O)&&d.call(O)==t}function k(O){if(typeof O=="number")return O;if(S(O))return n;if(x(O)){var b=typeof O.valueOf=="function"?O.valueOf():O;O=x(b)?b+"":b}if(typeof O!="string")return O===0?O:+O;O=O.replace(r,"");var C=i.test(O);return C||o.test(O)?l(O.slice(2),C?2:8):s.test(O)?n:+O}return hs=v,hs}var H1=_1();const Ac=cd(H1);function B1({id:e,label:n,propertySelected:t,...r}){const s=pn(),i=Ee(s.store,h=>h.value),o=Ee(s.store,h=>h.meta.errors),l=Ee(s.store,h=>h.meta.isTouched),c=o.length>0&&l,[u,m]=a.useState(""),g=Ac(h=>{m(h)},300),{data:d}=L1({query:at(u)?Vt(u):null,first:50},{refetchOnMount:!1,refetchOnWindowFocus:!1}),p=d??[];return f.jsxs(Xl,{value:i,onChange:h=>{if(h==null){s.handleChange("");return}if(typeof h=="string"){s.handleChange(h);return}s.handleChange(h.name||h.id),t(h)},onClose:()=>g(""),immediate:!0,children:[n!=null?f.jsxs(Nn,{htmlFor:r.name||e,className:"block text-sm/6 font-medium text-gray-900 dark:text-white",children:[n,r.required?"*":""]}):null,f.jsxs("div",{className:Pt("grid grid-cols-1 relative",n!=null?"mt-2":"mt-0"),children:[f.jsx(Pi,{className:"block min-w-0 grow py-1.5 pr-12 data-[state=invalid]:pr-10 text-base bg-white dark:bg-white/5 pl-3 outline -outline-offset-1 outline-gray-300 dark:outline-white/10 rounded-md text-gray-900 dark:text-white data-[state=invalid]:text-red-900 dark:data-[state=invalid]:text-red-700 placeholder:text-gray-400 dark:placeholder:text-gray-500 data-[state=invalid]:placeholder:text-red-700 dark:data-[state=invalid]:placeholder:text-red-400 focus:outline sm:text-sm/6 focus-visible:outline-none",onChange:h=>{const y=h.target.value;g(y),s.handleChange(y)},onBlur:()=>m(""),displayValue:h=>h}),f.jsx(Ai,{className:"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-hidden cursor-pointer",children:f.jsx(_r,{className:"size-5 text-gray-400 dark:text-gray-50","aria-hidden":"true"})}),p.length>0||at(u)?f.jsxs(ji,{className:"absolute z-10 mt-10 max-h-60 w-fit max-w-lg 2xl:max-w-xl overflow-y-auto overflow-x-hidden rounded-md bg-white dark:bg-slate-700 py-1 text-base shadow-lg ring-1 ring-black/5 dark:ring-black/10 focus:outline-hidden sm:text-sm",children:[p.map(h=>f.jsxs(Vn,{value:h,"data-selected":i===h.name||i===h.id?!0:void 0,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",children:[f.jsxs("div",{className:"flex-auto flex flex-col gap-y-1",children:[f.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[f.jsxs("p",{className:"text-sm font-medium text-gray-700 dark:text-gray-100 group-data-focus:text-gray-900 dark:group-data-focus:text-white flex items-center gap-x-1.5",children:[h.name||h.id,f.jsx(Pe,{children:Mt(h.dataType,h.name||h.id)})]}),f.jsx("p",{className:"hidden 2xl:block 2xl:w-fit",children:f.jsx(Pe,{children:h.id})}),f.jsx("p",{className:"w-fit block 2xl:hidden",children:f.jsx(Pe,{children:ud(h.id)})})]}),f.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-300 group-data-focus:text-gray-700 dark:group-data-focus:text-gray-50",children:h.description})]}),f.jsx("span",{className:"absolute inset-y-0 right-0 hidden items-center pr-4 text-indigo-600 group-data-focus:text-white group-data-selected:flex",children:f.jsx(ut,{className:"size-5","aria-hidden":"true"})})]},h.id)),at(u)?f.jsx(Vn,{value:u,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden border-t border-gray-300 dark:border-white/10",children:f.jsxs("span",{className:"flex items-center gap-x-1.5 truncate group-data-selected:font-semibold",children:["New Property: ",f.jsx(Pe,{children:u})]})},"user_entered"):null]}):null]}),c?f.jsx(Wr,{id:`${e}-invalid`,errors:o}):null]})}function ca({status:e}){const n=J1[e||"typesync_ui"];return f.jsx(Ji,{delay:500,closeDelay:500,children:f.jsxs(Ui,{children:[f.jsx(Wi,{"aria-label":e||void 0,children:f.jsx(Z1,{status:e})}),f.jsx(Ki,{children:f.jsx(Yi,{side:"top",sideOffset:10,children:f.jsxs(Qi,{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:[f.jsx(Xi,{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:f.jsx(to,{})}),f.jsx("span",{className:"text-xs text-gray-700 dark:text-white whitespace-break-spaces w-full",children:n})]})})})]})})}function Z1({status:e}){return e==="published"?f.jsx(Oc,{className:"size-4 text-inherit","aria-hidden":"true"}):e==="published_not_synced"?f.jsx(X1,{className:"size-4 text-inherit","aria-hidden":"true"}):e==="synced"?f.jsx(K1,{className:"size-4 text-inherit","aria-hidden":"true"}):f.jsx(q1,{className:"size-4 text-inherit","aria-hidden":"true"})}function z1(e){return f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("title",{children:"Exists in the Typesync UI | Light Mode"}),f.jsxs("g",{clipPath:"url(#clip0_59285_4556)",children:[f.jsx("path",{d:"M2 15.0588V14.3091C2 14.029 2.23019 13.8035 2.5103 13.8092V13.8092C2.78237 13.8148 3 14.037 3 14.3091V15H3.63191C3.90805 15 4.13191 15.2239 4.13191 15.5V15.5C4.13191 15.7761 3.90805 16 3.63191 16H2.92308C2.41328 16 2 15.5786 2 15.0588ZM7.01683 15C7.29297 15 7.51683 15.2239 7.51683 15.5V15.5C7.51683 15.7761 7.29297 16 7.01683 16H5.59916C5.32302 16 5.09916 15.7761 5.09916 15.5V15.5C5.09916 15.2239 5.32302 15 5.59916 15H7.01683ZM10.4008 15C10.677 15 10.9008 15.2239 10.9008 15.5V15.5C10.9008 15.7761 10.677 16 10.4008 16H8.98317C8.70703 16 8.48317 15.7761 8.48317 15.5V15.5C8.48317 15.2239 8.70703 15 8.98317 15H10.4008ZM13 15V14.3244C13 14.0483 13.2239 13.8244 13.5 13.8244V13.8244C13.7761 13.8244 14 14.0483 14 14.3244V15.0588C14 15.5786 13.5867 16 13.0769 16H12.3681C12.0919 16 11.8681 15.7761 11.8681 15.5V15.5C11.8681 15.2239 12.0919 15 12.3681 15H13ZM13.4897 10.3772C13.7698 10.3715 14 10.597 14 10.8771V12.3466C14 12.6187 13.7824 12.8409 13.5103 12.8465V12.8465C13.2302 12.8523 13 12.6268 13 12.3466V10.8771C13 10.605 13.2176 10.3829 13.4897 10.3772V10.3772ZM2.5 10.2693C2.77614 10.2693 3 10.4932 3 10.7693V12.2895C3 12.5657 2.77614 12.7895 2.5 12.7895V12.7895C2.22386 12.7895 2 12.5657 2 12.2895V10.7693C2 10.4932 2.22386 10.2693 2.5 10.2693V10.2693ZM13.4409 6.93133C13.7462 6.91964 14 7.16393 14 7.46939V8.86135C14 9.15072 13.7713 9.38835 13.4821 9.39942V9.39942C13.1769 9.4111 12.9231 9.16681 12.9231 8.86135V7.46939C12.9231 7.18002 13.1518 6.9424 13.4409 6.93133V6.93133ZM2.5103 6.75041C2.78237 6.75602 3 6.97817 3 7.2503V8.77031C3 9.05048 2.76981 9.27598 2.4897 9.2702V9.2702C2.21763 9.2646 2 9.04244 2 8.77031V7.2503C2 6.97013 2.23019 6.74463 2.5103 6.75041V6.75041ZM13 4.6875C13 4.5446 13.0133 4.40913 12.9038 4.31985L12.5418 4.02492C12.3444 3.86411 12.3122 3.57483 12.4694 3.37453V3.37453C12.6307 3.16885 12.9295 3.13568 13.1321 3.30096L13.4808 3.58548C13.809 3.85336 14 4.25884 14 4.6875V5.42188C14 5.69802 13.7761 5.92188 13.5 5.92188V5.92188C13.2239 5.92188 13 5.69802 13 5.42187V4.6875ZM2.5 3.21048C2.77614 3.21048 3 3.43434 3 3.71048V5.2307C3 5.50684 2.77614 5.7307 2.5 5.7307V5.7307C2.22386 5.7307 2 5.50684 2 5.2307V3.71048C2 3.43434 2.22386 3.21048 2.5 3.21048V3.21048ZM11.8346 2.24245C12.0319 2.40333 12.064 2.69258 11.9069 2.89288V2.89288C11.7455 3.09859 11.4467 3.13178 11.2441 2.96649L10.5409 2.39283C10.3398 2.22878 10.3071 1.93395 10.4672 1.72978V1.72978V1.72978C10.6251 1.52795 10.918 1.49516 11.1166 1.65707L11.8346 2.24245ZM2 0.941176C2 0.421379 2.41328 1.13692e-08 2.92308 0H3.4363C3.71244 0 3.9363 0.223858 3.9363 0.5V0.5C3.9363 0.776142 3.71244 1 3.4363 1H2.92308V1.73975C2.92308 1.99465 2.71644 2.20129 2.46154 2.20129V2.20129C2.20664 2.20129 2 1.99465 2 1.73975V0.941176ZM8.59946 0C8.9138 4.16766e-05 9.21848 0.109521 9.46394 0.309743L9.82608 0.604764C10.0234 0.765522 10.0556 1.05471 9.89852 1.25496V1.25496C9.73712 1.46066 9.43828 1.49374 9.2358 1.32832L8.88792 1.04412C8.80613 0.977403 8.7042 1.00004 8.59946 1H8.08534C7.80919 1 7.58534 0.776142 7.58534 0.5V0.5C7.58534 0.223858 7.80919 0 8.08534 0H8.59946ZM6.27494 0C6.55108 0 6.77494 0.223858 6.77494 0.5V0.5C6.77494 0.776142 6.55108 1 6.27494 1H5.2476C4.97145 1 4.7476 0.776142 4.7476 0.5V0.5C4.7476 0.223858 4.97145 0 5.2476 0H6.27494Z",fill:"#2A2A2A"}),f.jsx("path",{d:"M8.01689 0L8.00154 4.99847C8.00069 5.27521 8.2248 5.5 8.50154 5.5H14",stroke:"#2A2A2A"})]}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_59285_4556",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function U1(e){return f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("title",{children:"Exists in the Typesync UI | Dark Mode"}),f.jsxs("g",{clipPath:"url(#clip0_59284_4447)",children:[f.jsx("path",{d:"M2 15.0588V14.3091C2 14.029 2.23019 13.8035 2.5103 13.8092V13.8092C2.78237 13.8148 3 14.037 3 14.3091V15H3.63191C3.90805 15 4.13191 15.2239 4.13191 15.5V15.5C4.13191 15.7761 3.90805 16 3.63191 16H2.92308C2.41328 16 2 15.5786 2 15.0588ZM7.01683 15C7.29297 15 7.51683 15.2239 7.51683 15.5V15.5C7.51683 15.7761 7.29297 16 7.01683 16H5.59916C5.32302 16 5.09916 15.7761 5.09916 15.5V15.5C5.09916 15.2239 5.32302 15 5.59916 15H7.01683ZM10.4008 15C10.677 15 10.9008 15.2239 10.9008 15.5V15.5C10.9008 15.7761 10.677 16 10.4008 16H8.98317C8.70703 16 8.48317 15.7761 8.48317 15.5V15.5C8.48317 15.2239 8.70703 15 8.98317 15H10.4008ZM13 15V14.3244C13 14.0483 13.2239 13.8244 13.5 13.8244V13.8244C13.7761 13.8244 14 14.0483 14 14.3244V15.0588C14 15.5786 13.5867 16 13.0769 16H12.3681C12.0919 16 11.8681 15.7761 11.8681 15.5V15.5C11.8681 15.2239 12.0919 15 12.3681 15H13ZM13.4897 10.3772C13.7698 10.3715 14 10.597 14 10.8771V12.3466C14 12.6187 13.7824 12.8409 13.5103 12.8465V12.8465C13.2302 12.8523 13 12.6268 13 12.3466V10.8771C13 10.605 13.2176 10.3829 13.4897 10.3772V10.3772ZM2.5 10.2693C2.77614 10.2693 3 10.4932 3 10.7693V12.2895C3 12.5657 2.77614 12.7895 2.5 12.7895V12.7895C2.22386 12.7895 2 12.5657 2 12.2895V10.7693C2 10.4932 2.22386 10.2693 2.5 10.2693V10.2693ZM13.4409 6.93133C13.7462 6.91964 14 7.16393 14 7.46939V8.86135C14 9.15072 13.7713 9.38835 13.4821 9.39942V9.39942C13.1769 9.4111 12.9231 9.16681 12.9231 8.86135V7.46939C12.9231 7.18002 13.1518 6.9424 13.4409 6.93133V6.93133ZM2.5103 6.75041C2.78237 6.75602 3 6.97817 3 7.2503V8.77031C3 9.05048 2.76981 9.27598 2.4897 9.2702V9.2702C2.21763 9.2646 2 9.04244 2 8.77031V7.2503C2 6.97013 2.23019 6.74463 2.5103 6.75041V6.75041ZM13 4.6875C13 4.5446 13.0133 4.40913 12.9038 4.31985L12.5418 4.02492C12.3444 3.86411 12.3122 3.57483 12.4694 3.37453V3.37453C12.6307 3.16885 12.9295 3.13568 13.1321 3.30096L13.4808 3.58548C13.809 3.85336 14 4.25884 14 4.6875V5.42188C14 5.69802 13.7761 5.92188 13.5 5.92188V5.92188C13.2239 5.92188 13 5.69802 13 5.42187V4.6875ZM2.5 3.21048C2.77614 3.21048 3 3.43434 3 3.71048V5.2307C3 5.50684 2.77614 5.7307 2.5 5.7307V5.7307C2.22386 5.7307 2 5.50684 2 5.2307V3.71048C2 3.43434 2.22386 3.21048 2.5 3.21048V3.21048ZM11.8346 2.24245C12.0319 2.40333 12.064 2.69258 11.9069 2.89288V2.89288C11.7455 3.09859 11.4467 3.13178 11.2441 2.96649L10.5409 2.39283C10.3398 2.22878 10.3071 1.93395 10.4672 1.72978V1.72978V1.72978C10.6251 1.52795 10.918 1.49516 11.1166 1.65707L11.8346 2.24245ZM2 0.941176C2 0.421379 2.41328 1.13692e-08 2.92308 0H3.4363C3.71244 0 3.9363 0.223858 3.9363 0.5V0.5C3.9363 0.776142 3.71244 1 3.4363 1H2.92308V1.73975C2.92308 1.99465 2.71644 2.20129 2.46154 2.20129V2.20129C2.20664 2.20129 2 1.99465 2 1.73975V0.941176ZM8.59946 0C8.9138 4.16766e-05 9.21848 0.109521 9.46394 0.309743L9.82608 0.604764C10.0234 0.765522 10.0556 1.05471 9.89852 1.25496V1.25496C9.73712 1.46066 9.43828 1.49374 9.2358 1.32832L8.88792 1.04412C8.80613 0.977403 8.7042 1.00004 8.59946 1H8.08534C7.80919 1 7.58534 0.776142 7.58534 0.5V0.5C7.58534 0.223858 7.80919 0 8.08534 0H8.59946ZM6.27494 0C6.55108 0 6.77494 0.223858 6.77494 0.5V0.5C6.77494 0.776142 6.55108 1 6.27494 1H5.2476C4.97145 1 4.7476 0.776142 4.7476 0.5V0.5C4.7476 0.223858 4.97145 0 5.2476 0H6.27494Z",fill:"white"}),f.jsx("path",{d:"M8.01689 0L8.00154 4.99847C8.00069 5.27521 8.2248 5.5 8.50154 5.5H14",stroke:"white"})]}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_59284_4447",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function q1(e){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"hidden dark:inline-block",children:f.jsx(U1,{...e})}),f.jsx("span",{className:"inline-block dark:hidden",children:f.jsx(z1,{...e})})]})}function G1(e){return f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("title",{children:"Synced to the schema file, requires publishing | Light Mode"}),f.jsxs("g",{clipPath:"url(#clip0_59285_4566)",children:[f.jsx("path",{d:"M8 5V0.5H9L13.5 4.5V5H8Z",fill:"#2A2A2A"}),f.jsx("path",{d:"M3.5 0.5H8.61621C8.73973 0.5 8.85936 0.545299 8.95117 0.62793L13.335 4.57324C13.4403 4.66805 13.5 4.8036 13.5 4.94531V14.5C13.5 15.0523 13.0523 15.5 12.5 15.5H3.5C2.94772 15.5 2.5 15.0523 2.5 14.5V1.5C2.5 0.947715 2.94772 0.5 3.5 0.5Z",stroke:"#2A2A2A"}),f.jsx("path",{d:"M7.67993 12.0595H8.86631C8.99425 12.4899 9.37807 12.7109 9.88984 12.7109C10.4249 12.7109 10.7738 12.5015 10.7738 12.0944C10.7738 11.8153 10.5993 11.6641 10.169 11.5594L9.09893 11.3035C8.36617 11.129 7.81951 10.7336 7.81951 9.88451C7.81951 8.95402 8.64531 8.26778 9.77353 8.26778C10.9832 8.26778 11.6694 8.84934 11.8439 9.79146H10.704C10.5993 9.45416 10.2969 9.22154 9.7619 9.22154C9.35481 9.22154 8.93609 9.40763 8.93609 9.81472C8.93609 10.0473 9.09893 10.1985 9.47112 10.2916L10.5644 10.5475C11.4484 10.7568 11.8904 11.257 11.8904 12.013C11.8904 13.0365 11.0413 13.6646 9.87821 13.6646C8.66858 13.6646 7.83114 13.0598 7.67993 12.0595Z",fill:"#2A2A2A"}),f.jsx("path",{d:"M4.81418 12.1526V9.34949H4V8.3841H4.81418V7H5.97729V8.3841H7.1404V9.34949H5.97729V12.0246C5.97729 12.4434 6.20991 12.6295 6.59374 12.6295C6.82636 12.6295 7.09388 12.5364 7.25671 12.4201V13.4785C7.05898 13.5948 6.74494 13.6646 6.38438 13.6646C5.46552 13.6646 4.81418 13.1761 4.81418 12.1526Z",fill:"#2A2A2A"}),f.jsx("path",{d:"M8.01689 0L8.00169 4.49831C8.00076 4.77511 8.22489 5 8.50169 5H13.75",stroke:"#2A2A2A"})]}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_59285_4566",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function W1(e){return f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("title",{children:"Synced to the schema file, requires publishing | Dark Mode"}),f.jsxs("g",{clipPath:"url(#clip0_59288_4647)",children:[f.jsx("path",{d:"M8 5V0.5H9L13.5 4.5V5H8Z",fill:"white"}),f.jsx("path",{d:"M3.5 0.5H8.61621C8.73973 0.5 8.85936 0.545299 8.95117 0.62793L13.335 4.57324C13.4403 4.66805 13.5 4.8036 13.5 4.94531V14.5C13.5 15.0523 13.0523 15.5 12.5 15.5H3.5C2.94772 15.5 2.5 15.0523 2.5 14.5V1.5C2.5 0.947715 2.94772 0.5 3.5 0.5Z",stroke:"white"}),f.jsx("path",{d:"M7.67993 12.0595H8.86631C8.99425 12.4899 9.37807 12.7109 9.88984 12.7109C10.4249 12.7109 10.7738 12.5015 10.7738 12.0944C10.7738 11.8153 10.5993 11.6641 10.169 11.5594L9.09893 11.3035C8.36617 11.129 7.81951 10.7336 7.81951 9.88451C7.81951 8.95402 8.64531 8.26778 9.77353 8.26778C10.9832 8.26778 11.6694 8.84934 11.8439 9.79146H10.704C10.5993 9.45416 10.2969 9.22154 9.7619 9.22154C9.35481 9.22154 8.93609 9.40763 8.93609 9.81472C8.93609 10.0473 9.09893 10.1985 9.47112 10.2916L10.5644 10.5475C11.4484 10.7568 11.8904 11.257 11.8904 12.013C11.8904 13.0365 11.0413 13.6646 9.87821 13.6646C8.66858 13.6646 7.83114 13.0598 7.67993 12.0595Z",fill:"white"}),f.jsx("path",{d:"M4.81418 12.1526V9.34949H4V8.3841H4.81418V7H5.97729V8.3841H7.1404V9.34949H5.97729V12.0246C5.97729 12.4434 6.20991 12.6295 6.59374 12.6295C6.82636 12.6295 7.09388 12.5364 7.25671 12.4201V13.4785C7.05898 13.5948 6.74494 13.6646 6.38438 13.6646C5.46552 13.6646 4.81418 13.1761 4.81418 12.1526Z",fill:"white"}),f.jsx("path",{d:"M8.01689 0L8.00169 4.49831C8.00076 4.77511 8.22489 5 8.50169 5H13.75",stroke:"white"})]}),f.jsx("defs",{children:f.jsx("clipPath",{id:"clip0_59288_4647",children:f.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function K1(e){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"hidden dark:inline-block",children:f.jsx(W1,{...e})}),f.jsx("span",{className:"inline-block dark:hidden",children:f.jsx(G1,{...e})})]})}function Y1(e){return f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("title",{children:"Published to the Knowledge Graph, but requires syncing to the schema file | Light Mode"}),f.jsx("path",{d:"M14.0291 8.02593C14.0291 4.53221 11.2275 1.7 7.77153 1.7C5.64507 1.7 3.76635 2.77226 2.63557 4.41111",stroke:"#2A2A2A","stroke-linecap":"round"}),f.jsx("path",{d:"M14.0291 8.47779L15.37 7.12223",stroke:"#2A2A2A","stroke-linecap":"round"}),f.jsx("path",{d:"M14.0291 8.47779L12.6882 7.12223",stroke:"#2A2A2A","stroke-linecap":"round"}),f.jsx("path",{d:"M1.96091 7.97407C1.96091 11.4678 4.76252 14.3 8.21848 14.3C10.3449 14.3 12.2237 13.2277 13.3544 11.5889",stroke:"#2A2A2A","stroke-linecap":"round"}),f.jsx("path",{d:"M1.96091 7.52222L0.620003 8.87778",stroke:"#2A2A2A","stroke-linecap":"round"}),f.jsx("path",{d:"M1.96091 7.52222L3.30182 8.87778",stroke:"#2A2A2A","stroke-linecap":"round"}),f.jsx("path",{d:"M6 4.5H8.11621C8.23973 4.5 8.35936 4.5453 8.45117 4.62793L10.335 6.32324C10.4403 6.41805 10.5 6.5536 10.5 6.69531V11C10.5 11.2761 10.2761 11.5 10 11.5H6C5.72386 11.5 5.5 11.2761 5.5 11V5C5.5 4.72386 5.72386 4.5 6 4.5Z",stroke:"#2A2A2A"}),f.jsx("path",{d:"M8 6.5V4.5L10.5 7H8.5C8.22386 7 8 6.77614 8 6.5Z",fill:"#2A2A2A"})]})}function Q1(e){return f.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[f.jsx("title",{children:"Published to the Knowledge Graph, but requires syncing to the schema file | Dark Mode"}),f.jsx("path",{d:"M14.0291 8.02593C14.0291 4.53221 11.2275 1.7 7.77153 1.7C5.64507 1.7 3.76635 2.77226 2.63557 4.41111",stroke:"white","stroke-linecap":"round"}),f.jsx("path",{d:"M14.0291 8.47779L15.37 7.12223",stroke:"white","stroke-linecap":"round"}),f.jsx("path",{d:"M14.0291 8.47779L12.6882 7.12223",stroke:"white","stroke-linecap":"round"}),f.jsx("path",{d:"M1.96091 7.97407C1.96091 11.4678 4.76252 14.3 8.21848 14.3C10.3449 14.3 12.2237 13.2277 13.3544 11.5889",stroke:"white","stroke-linecap":"round"}),f.jsx("path",{d:"M1.96091 7.52222L0.620003 8.87778",stroke:"white","stroke-linecap":"round"}),f.jsx("path",{d:"M1.96091 7.52222L3.30182 8.87778",stroke:"white","stroke-linecap":"round"}),f.jsx("path",{d:"M6 4.5H8.11621C8.23973 4.5 8.35936 4.5453 8.45117 4.62793L10.335 6.32324C10.4403 6.41805 10.5 6.5536 10.5 6.69531V11C10.5 11.2761 10.2761 11.5 10 11.5H6C5.72386 11.5 5.5 11.2761 5.5 11V5C5.5 4.72386 5.72386 4.5 6 4.5Z",stroke:"white"}),f.jsx("path",{d:"M8 6.5V4.5L10.5 7H8.5C8.22386 7 8 6.77614 8 6.5Z",fill:"white"})]})}function X1(e){return f.jsxs(f.Fragment,{children:[f.jsx("span",{className:"hidden dark:inline-block",children:f.jsx(Q1,{...e})}),f.jsx("span",{className:"inline-block dark:hidden",children:f.jsx(Y1,{...e})})]})}const J1={published:"Published to the Knowledge Graph",synced:"Synced with the schema file, but needs published",typesync_ui:"Requires syncing to the schema file",published_not_synced:"Published to the Knowledge Graph, but requires syncing to the schema file"};function eg({id:e,label:n,typeSelected:t,...r}){const s=pn(),i=Ee(s.store,h=>h.value),o=Ee(s.store,h=>h.meta.errors),l=Ee(s.store,h=>h.meta.isTouched),c=o.length>0&&l,[u,m]=a.useState(""),g=Ac(h=>{m(h)},300),{data:d}=Vc({query:at(u)?Vt(u):null,first:50},{refetchOnMount:!1,refetchOnWindowFocus:!1}),p=d??[];return f.jsxs(Xl,{value:i,onChange:h=>{if(h==null){s.handleChange("");return}if(typeof h=="string"){s.handleChange(h);return}s.handleChange(h.name||h.id),t(h)},onClose:()=>{g("")},immediate:!0,children:[n!=null?f.jsxs(Nn,{htmlFor:r.name||e,className:"block text-sm/6 font-medium text-gray-900 dark:text-white",children:[n,r.required?"*":""]}):null,f.jsxs("div",{className:Pt("grid grid-cols-1 relative",n!=null?"mt-2":"mt-0"),children:[f.jsx(Pi,{className:"block min-w-0 grow py-1.5 pr-12 data-[state=invalid]:pr-10 text-base bg-white dark:bg-white/5 pl-3 outline -outline-offset-1 outline-gray-300 dark:outline-white/10 rounded-md text-gray-900 dark:text-white data-[state=invalid]:text-red-900 dark:data-[state=invalid]:text-red-700 placeholder:text-gray-400 dark:placeholder:text-gray-500 data-[state=invalid]:placeholder:text-red-700 dark:data-[state=invalid]:placeholder:text-red-400 focus:outline sm:text-sm/6 focus-visible:outline-none",onChange:h=>{const y=h.target.value;g(y),s.handleChange(y)},onBlur:()=>m(""),displayValue:h=>h,type:"search"}),f.jsx(Ai,{className:"absolute inset-y-0 right-0 flex items-center rounded-r-md px-2 focus:outline-hidden cursor-pointer",children:f.jsx(_r,{className:"size-5 text-gray-400 dark:text-gray-50","aria-hidden":"true"})}),p.length>0||at(u)?f.jsxs(ji,{className:"absolute z-10 mt-10 max-h-60 w-fit min-w-md 2xl:min-w-xl overflow-auto rounded-md bg-white dark:bg-slate-700 py-1 text-base shadow-lg ring-1 ring-black/5 dark:ring-black/10 focus:outline-hidden sm:text-sm",children:[p.map(h=>f.jsxs(Vn,{value:h,"data-selected":i===h.name||i===h.id?!0:void 0,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",children:[f.jsxs("span",{className:"flex items-center gap-x-1.5 truncate group-data-selected:font-semibold",children:[h.name||h.id,f.jsx(Pe,{children:h.id})]}),f.jsx("span",{className:"absolute inset-y-0 right-0 hidden items-center pr-4 text-indigo-600 group-data-focus:text-white group-data-selected:flex",children:f.jsx(ut,{className:"size-5","aria-hidden":"true"})})]},h.id)),at(u)?f.jsx(Vn,{value:u,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-900 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",children:f.jsxs("span",{className:"flex items-center gap-x-1.5 truncate group-data-selected:font-semibold",children:["New Type: ",f.jsx(Pe,{children:u})]})},"user_entered"):null]}):null]}),c?f.jsx(Wr,{id:`${e}-invalid`,errors:o}):null]})}class Zt extends Mr("/hypergraph/typesync/models/TypeOption")({id:De,name:De}){}class tg extends Mr("/hypergraph/typesync/models/RelationTypeOption")({...Zt.fields,relationType:De}){}const ng=[Zt.make({id:"DefaultEntityString",name:"String"}),Zt.make({id:"DefaultEntityNumber",name:"Number"}),Zt.make({id:"DefaultEntityBoolean",name:"Boolean"}),Zt.make({id:"DefaultEntityDate",name:"Date"}),Zt.make({id:"DefaultEntityPoint",name:"Point"})];function rg({id:e,name:n,schemaTypes:t=[],disabled:r=!1,relationTypeSelected:s}){const i=pn(),o=re(t,ye(l=>at(l.type)),xe(l=>tg.make({id:`Relation(${l.type})`,name:`Relation(${l.type})`,relationType:l.type})));return f.jsxs(Vm,{as:"div",id:e,name:n,value:i.state.value,onBlur:i.handleBlur,disabled:r,onChange:l=>{if(l){if(typeof l=="string"){i.handleChange(l);return}i.handleChange(l.name),s(l.relationType)}},children:[f.jsx(Nn,{className:"sr-only",children:"Prop type"}),f.jsxs("div",{className:"relative",children:[f.jsxs(yc,{className:"grid w-full cursor-default grid-cols-1 rounded-md bg-white dark:bg-slate-900 disabled:bg-gray-100 dark:disabled:bg-slate-700 py-1.5 pr-2 pl-3 text-left text-white outline-1 -outline-offset-1 outline-gray-500 focus:outline-2 focus:-outline-offset-2 focus:outline-indigo-600 sm:text-sm/6 disabled:cursor-not-allowed",children:[f.jsx("span",{className:"col-start-1 row-start-1 truncate pr-6 text-gray-950 dark:text-white",children:i.state.value}),r?null:f.jsx(_r,{"aria-hidden":"true",className:"col-start-1 row-start-1 size-5 self-center justify-self-end text-gray-300 dark:text-gray-50 sm:size-4"})]}),f.jsxs(vc,{transition:!0,className:"absolute z-10 mt-1 max-h-60 w-full overflow-auto rounded-md bg-gray-50 dark:bg-slate-800 py-1 text-base shadow-lg ring-1 ring-gray-200 dark:ring-black/5 focus:outline-hidden data-leave:transition data-leave:duration-100 data-leave:ease-in data-closed:data-leave:opacity-0 sm:text-sm",children:[ng.map(l=>f.jsxs(Ds,{value:l.name,className:"group relative cursor-default py-2 pr-9 pl-3 text-gray-800 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",children:[f.jsx("span",{className:"block truncate font-normal group-data-selected:font-semibold",children:l.name}),f.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-4 text-indigo-600 group-not-data-selected:hidden group-data-focus:text-white",children:f.jsx(ut,{"aria-hidden":"true",className:"size-5"})})]},l.id)),o.map((l,c)=>f.jsxs(Ds,{value:l,className:Pt("group relative cursor-default py-2 pr-9 pl-3 text-gray-800 dark:text-white select-none data-focus:bg-indigo-600 data-focus:text-white data-focus:outline-hidden",c===0?"border-t border-gray-400 dark:border-white/10":""),children:[f.jsx("span",{className:"block truncate font-normal group-data-selected:font-semibold",children:l.name}),f.jsx("span",{className:"absolute inset-y-0 right-0 flex items-center pr-4 text-indigo-600 group-not-data-selected:hidden group-data-focus:text-white",children:f.jsx(ut,{"aria-hidden":"true",className:"size-5"})})]},l.id))]})]})]})}const sg=kr(dd(Ln));function ig(e,n){switch(n.type){case"FETCHING":return{...e,status:"fetching",error:null};case"ERROR":return{...e,error:n.payload,status:"error"};case"SUCCESS":return{...e,data:n.payload,status:"success"};case"RESET":return{...e,data:{types:[]},error:void 0,status:"idle"};default:return e}}function og({enabled:e=!0,onError:n,onSuccess:t,retry:r=!0,retryDelay:s=1e3}={}){const[i,o]=a.useReducer(ig,{data:{types:[]},error:void 0,status:"idle"}),l=a.useRef(null),c=a.useRef(null),u=a.useRef(!0),m=a.useRef({onSuccess:t,onError:n,retry:r,retryDelay:s,enabled:e});a.useEffect(()=>{m.current={onSuccess:t,onError:n,retry:r,retryDelay:s,enabled:e}});const g=a.useCallback(()=>{l.current&&(l.current.close(),l.current=null),c.current&&clearTimeout(c.current)},[]),d=a.useCallback(()=>{if(g(),!!m.current.enabled&&u.current){o({type:"FETCHING"});try{const p=new EventSource("http://localhost:3000/api/v1/schema/events"),h=v=>{if(u.current)try{const x=sg(v.data);o({type:"SUCCESS",payload:x}),m.current.onSuccess?.(x)}catch(x){const w=x instanceof Error?x:new Error("Failed to parse SSE data");o({type:"ERROR",payload:w}),m.current.onError?.(w)}},y=()=>{if(!u.current)return;const v=new Error("SSE connection error");o({type:"ERROR",payload:v}),m.current.onError?.(v),g(),m.current.retry&&m.current.enabled&&(c.current=setTimeout(d,m.current.retryDelay))};p.addEventListener("message",h),p.addEventListener("error",y),l.current=p}catch(p){if(!u.current)return;const h=p instanceof Error?p:new Error("Failed to create SSE connection");o({type:"ERROR",payload:h}),m.current.onError?.(h)}}},[g]);return a.useEffect(()=>(u.current=!0,d(),()=>{u.current=!1,g()}),[d,g]),a.useEffect(()=>{e?d():g()},[e,d,g]),{data:i.data,error:i.error,isLoading:i.status==="fetching",isError:i.status==="error",isSuccess:i.status==="success",refetch:d}}const ag=kr(Ln);Ve({schema:Ln,space:it});function lg(e={}){const{getSmartSessionClient:n}=Ys();return ml({mutationKey:["Hypergraph","Typesync","Studio","Mapping","sync"],async mutationFn(t){try{const r=await n();if(!r)throw new Error("Missing smartSessionClient");const[s,i]=vf(t.schema);await _f({ops:i.map(c=>c),space:t.space,name:"Schema Publish updates",walletClient:r});const o=await fetch("http://localhost:3000/api/v1/mapping/sync",{method:"POST",body:JSON.stringify({schema:t.schema,mapping:s}),headers:{"Content-Type":"application/json",Accept:"application/json"}});if(o.status!==200)throw new Error(`Failure posting Typesync Hypergraph Schema [${o.status}]`);const l=await o.json();return ag(l)}catch(r){throw console.error("Failure syncing Typesync Hypergraph Schema to schema.ts file",{err:r}),r}},...e})}const cg=kr(Ln),ug={mutationKey:["Hypergraph","Typesync","Studio","Schema","sync"],async mutationFn(e){try{const n=await fetch("http://localhost:3000/api/v1/schema/sync",{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json",Accept:"application/json"}});if(n.status!==200)throw new Error(`Failure posting Typesync Hypergraph Schema [${n.status}]`);const t=await n.json();return cg(t)}catch(n){throw console.error("Failure syncing Typesync Hypergraph Schema to schema.ts file",{err:n}),n}}};function dg(e={}){return ml({...ug,...e})}const{useAppForm:fg}=eo({fieldComponents:{Checkbox:p1,PropertyCombobox:B1,TextField:Rc,TypeCombobox:eg,TypeSelect:rg},formComponents:{SubmitButton:Tc},fieldContext:no,formContext:ro});function pg(){const{authenticated:e}=Za(),[n,t]=a.useState(!1),{spaceId:r}=Ha(),{data:s}=og(),i=yp(),{mutateAsync:o,isError:l,isPending:c,isSuccess:u,reset:m}=dg({onError(b){i.add({title:"Failure syncing Schema to file",description:b.message})}}),{mutateAsync:g,reset:d,status:p}=lg({onError(b){i.add({title:"Failure publishing Schema to Knowledge Graph",description:b.message})}}),h=fg({defaultValues:s,validators:{onChangeAsyncDebounceMs:100,onChange:Ba(Ln)},async onSubmit({value:b,formApi:C}){await o(b).then(M=>{setTimeout(async()=>{C.reset(M),m()},1500)})}}),y=Ee(h.store,b=>re(b.values.types,ye(C=>at(C.name)),xe((C,M)=>({type:C.name,knowledgeGraphId:C.knowledgeGraphId,schemaTypeIdx:M})))),v=re(y,xe(b=>b.type),st(new Set,(b,C)=>b.add(C))),x=Ee(h.store,b=>b.values),w=Ee(h.store,b=>b.isDirty&&Zn(b.values.types,C=>C.status==="published_not_synced"||C.status==null||Zn(C.properties,M=>M.status==="published_not_synced"||M.status==null))),S=Ee(h.store,b=>Zn(b.values.types,C=>C.status==="synced"||Zn(C.properties,M=>M.status==="synced"))),k=(b,C=[])=>{const M=[...C];function N(F){return vo(ye(M,({name:T})=>T===F.name))>0&&!v.has(F.name)}const R=re(b.properties,ye(F=>F.dataType==="RELATION"),ye(F=>!N({name:F.name})));for(const F of R){if(fd(F.relationValueTypes)){M.push({name:F.name,knowledgeGraphId:null,properties:[],status:null});continue}const T=F.relationValueTypes[0];if(N({name:T.name}))continue;M.push({name:T.name,knowledgeGraphId:T.id,status:"published_not_synced",properties:xe(T.properties??[],I=>{const j=Mt(I.dataType,I.name);return gt(j)?{name:I.name,knowledgeGraphId:I.id,dataType:j,relationType:I.name,status:"published_not_synced"}:{name:I.name,knowledgeGraphId:I.id,dataType:j,status:"published_not_synced"}})});const E=k({...T,properties:re(T.properties??[],ye(I=>I!=null),xe(I=>({...I,relationValueTypes:[]})))},M);for(const I of E)N({name:I.name})||M.push(I)}return st(M,[],(F,T)=>{const E=hd(F,({name:I})=>I===T.name);return pd(E)&&F.push(T),F})},O=(b,C=[])=>{const M=[...C];function N(R){return vo(ye(M,({name:F})=>F===R.name))>0&&!v.has(R.name)}for(const R of ye(b.relationValueTypes,F=>F!=null)){if(R.name==null||N({name:R.name}))continue;const F=re(R.properties??[],ye(T=>T.name!=null),xe(T=>{const E=T.name,I=Mt(T.dataType,E);return gt(I)?(N({name:E})||M.push({name:E,knowledgeGraphId:null,properties:[],status:null}),{name:E,knowledgeGraphId:T.id,dataType:I,relationType:E,status:"published_not_synced"}):{name:E,knowledgeGraphId:T.id,dataType:I,status:"published_not_synced"}}));M.push({name:R.name,knowledgeGraphId:R.id,status:"published_not_synced",properties:F})}return M};return f.jsxs("form",{noValidate:!0,"aria-disabled":c?"true":void 0,onSubmit:b=>{b.preventDefault(),b.stopPropagation(),h.handleSubmit()},className:"px-4",children:[f.jsx(h.AppField,{name:"types",mode:"array",children:b=>f.jsxs("div",{className:"grid grid-cols-2 2xl:grid-cols-5 gap-x-4 2xl:gap-x-8 h-full",children:[f.jsx("div",{className:"w-full flex flex-col gap-y-4 pb-10 2xl:col-span-2 h-full",children:f.jsx($1,{typeSelected:C=>{if(C.name==null)return;const M=k(C),N=Vs.make({name:C.name,knowledgeGraphId:C.id,status:"published_not_synced",properties:(C.properties??[]).filter(R=>R!=null).map(R=>{const F=Mt(R.dataType,R.name||R.id);return gt(F)?{name:R.name||R.id,knowledgeGraphId:R.id,dataType:F,relationType:R.name||R.id,status:"published_not_synced"}:{name:R.name||R.id,knowledgeGraphId:R.id,dataType:F,status:"published_not_synced"}})});if(b.state.value.length===1){const R=b.state.value[0],F=R.properties;if(hr(R.name)&&F.length===1&&hr(R.properties[0].name)){rs(M,{onEmpty(){b.replaceValue(0,N)},onNonEmpty(T){zn(T,(E,I)=>{if(I===0){b.replaceValue(0,{name:E.name,knowledgeGraphId:E.knowledgeGraphId,properties:E.properties});return}b.pushValue(E)}),b.pushValue(N)}});return}}rs(M,{onEmpty(){b.pushValue(N)},onNonEmpty(R){zn(R,F=>{b.pushValue({name:F.name,knowledgeGraphId:F.knowledgeGraphId,properties:F.properties})}),b.pushValue(N)}})}})}),f.jsxs("div",{className:"w-full flex flex-col gap-y-4 pb-10 2xl:col-span-3",children:[f.jsxs("div",{className:"border-b border-gray-200 dark:border-white/20 pb-5 h-20",children:[f.jsx("h3",{className:"text-base font-semibold text-gray-900 dark:text-white",children:"Schema"}),f.jsxs("p",{className:"mt-2 max-w-4xl text-sm text-gray-500 dark:text-gray-200",children:["This is parsed from the Hypergraph Schema defined in your ",f.jsx(Pe,{children:"schema.ts"})]})]}),f.jsxs("div",{children:[b.state.value.map((C,M)=>{const N=`createSchemaForm__type[${M}]`;return f.jsxs("div",{className:"border-l-2 border-indigo-600 dark:border-indigo-400 pl-2 py-2 flex flex-col gap-y-4",children:[f.jsxs("div",{className:"flex items-start justify-between gap-x-3",children:[f.jsx("div",{className:"h-16 w-8 flex flex-col items-center justify-end",children:f.jsx(ca,{status:C.status})}),f.jsx("div",{className:"flex-1 shrink-0",children:f.jsx(h.AppField,{name:`types[${M}].name`,children:R=>f.jsx(R.TypeCombobox,{id:`types[${M}].name`,name:`types[${M}].name`,required:!0,label:"Type Name",typeSelected:F=>{const T=k(F),E=Vs.make({name:F.name,knowledgeGraphId:F.id,status:"published_not_synced",properties:(F.properties??[]).filter(I=>I!=null).map(I=>{const j=Mt(I.dataType,I.name||I.id);return gt(j)?{name:I.name||I.id,knowledgeGraphId:I.id,dataType:j,relationType:I.name||I.id,status:"published_not_synced"}:{name:I.name||I.id,knowledgeGraphId:I.id,dataType:j,status:"published_not_synced"}})});rs(T,{onEmpty(){b.replaceValue(M,E)},onNonEmpty(I){zn(I,j=>{b.pushValue({name:j.name,knowledgeGraphId:j.knowledgeGraphId,properties:j.properties})}),b.replaceValue(M,E)}})}})})}),f.jsx("button",{type:"button",className:"min-w-fit rounded-md bg-transparent p-2 shadow-xs hover:bg-gray-100 dark:hover:bg-white/10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600 cursor-pointer mt-8 text-red-700 dark:text-red-400 disabled:text-gray-400 disabled:cursor-not-allowed disabled:hover:bg-transparent",onClick:()=>b.removeValue(M),disabled:b.state.value.length===1,children:f.jsx(Ns,{"aria-hidden":"true",className:"size-5"})})]}),f.jsx(h.AppField,{name:`types[${M}].properties`,mode:"array",children:R=>f.jsxs("div",{className:"flex flex-col gap-y-1 pl-2 ml-1 border-l border-indigo-300",children:[f.jsx("h4",{className:"text-md font-mono text-gray-800 dark:text-gray-200",children:"Properties"}),f.jsxs("div",{className:"w-full flex flex-col gap-y-2",children:[R.state.value.map((F,T)=>{const E=`createAppForm__type[${M}]__prop[${T}]`;return f.jsxs("div",{className:"grid grid-cols-11 gap-2",children:[f.jsxs("div",{className:"col-span-5 flex items-start gap-x-1",children:[f.jsx("div",{className:"w-8 h-full flex flex-col items-center justify-center",children:f.jsx(ca,{status:F.status})}),f.jsx("div",{className:"w-full",children:f.jsx(h.AppField,{name:`types[${M}].properties[${T}].name`,children:I=>f.jsx(I.PropertyCombobox,{id:`types[${M}].properties[${T}].name`,name:`types[${M}].properties[${T}].name`,required:!0,propertySelected:j=>{const U=Mt(j.dataType,j.name||j.id),L={name:j.name||j.id,knowledgeGraphId:j.id,status:"published_not_synced",dataType:U,...gt(U)?{relationType:j.name||j.id}:{}};if(j.dataType==="RELATION"){const P=O(j);zn(P,H=>{b.pushValue({name:H.name,knowledgeGraphId:H.knowledgeGraphId,properties:H.properties})}),R.replaceValue(T,L);return}R.replaceValue(T,L)}})})})]}),f.jsx("div",{className:"col-span-3 2xl:col-span-4",children:f.jsx(h.AppField,{name:`types[${M}].properties[${T}].dataType`,children:I=>f.jsx(I.TypeSelect,{id:`types[${M}].properties[${T}].dataType`,name:`types[${M}].properties[${T}].dataType`,schemaTypes:ye(y,j=>j.type!==C.name),disabled:F.knowledgeGraphId!=null,relationTypeSelected:j=>R.replaceValue(T,{...R.state.value[T],relationType:j})})})}),f.jsx("div",{className:"col-span-2 2xl:col-span-1",children:f.jsx(h.AppField,{name:`types[${M}].properties[${T}].optional`,children:I=>f.jsx(I.Checkbox,{id:`types[${M}].properties[${T}].optional`,name:`types[${M}].properties[${T}].optional`,label:"Optional"})})}),f.jsx("div",{className:"col-span-1 flex items-start justify-end h-full",children:f.jsx("button",{type:"button",className:"min-w-fit rounded-md bg-transparent p-2 text-white shadow-xs hover:bg-gray-100 dark:hover:bg-white/10 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600 cursor-pointer",onClick:()=>R.removeValue(T),children:f.jsx(Ns,{"aria-hidden":"true",className:"size-5 text-red-700 dark:text-red-400"})})})]},E)}),f.jsx("div",{className:"w-full flex items-center justify-end mt-1",children:f.jsxs("button",{type:"button",className:"inline-flex items-center gap-x-1.5 text-sm/4 font-semibold text-gray-900 dark:text-white cursor-pointer hover:bg-gray-100 dark:hover:bg-white/10 rounded-md px-2 py-1.5",onClick:()=>R.pushValue({name:"",knowledgeGraphId:null,dataType:"String",status:null}),children:[f.jsx(vr,{"aria-hidden":"true",className:"-ml-0.5 size-4"}),"Add Property"]})})]})]})})]},N)}),f.jsxs("div",{className:"w-full flex items-center justify-between border-t border-gray-500 dark:border-gray-400 mt-4 pt-2",children:[f.jsxs("button",{type:"button",className:"inline-flex items-center gap-x-1.5 text-sm/6 font-semibold text-gray-600 dark:text-gray-200 cursor-pointer hover:bg-gray-100 dark:hover:bg-white/10 rounded-md px-2 py-1.5",onClick:()=>{h.resetField("types")},children:[f.jsx(Nl,{"aria-hidden":"true",className:"-ml-0.5 size-4"}),"Reset"]}),f.jsxs("button",{type:"button",className:"inline-flex items-center gap-x-1.5 text-sm/6 font-semibold text-gray-900 dark:text-white cursor-pointer hover:bg-gray-100 dark:hover:bg-white/10 rounded-md px-2 py-1.5",onClick:()=>b.pushValue({name:"",knowledgeGraphId:null,status:null,properties:[{name:"",knowledgeGraphId:null,dataType:"String",status:null}]}),children:[f.jsx(vr,{"aria-hidden":"true",className:"-ml-0.5 size-5"}),"Add Type"]})]})]}),f.jsxs("div",{className:"mt-6 flex items-center justify-end gap-x-6 bg-white dark:bg-inherit p-4 rounded-lg",children:[f.jsx(h.AppForm,{children:f.jsxs(h.SubmitButton,{status:c?"submitting":l?"error":u?"success":"idle",children:["Sync with ",f.jsx(Pe,{children:"schema.ts"})]})}),f.jsx(Ji,{delay:300,closeDelay:1e3,children:f.jsxs(Ui,{children:[f.jsx(Wi,{type:"button",disabled:!S||!e,"data-state":p==="pending"?"submitting":p==="error"?"error":p==="success"?"success":"idle",className:Pt("rounded-md bg-indigo-600 dark:bg-indigo-500 px-3 py-2 text-sm font-semibold text-white shadow-xs hover:bg-indigo-500 dark:hover:bg-indigo-400 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 dark:focus-visible:outline-indigo-500 inline-flex items-center gap-x-2 cursor-pointer","disabled:bg-gray-400 disabled:text-gray-900 disabled:hover:bg-gray-400 disabled:focus-visible:outline-gray-400 disabled:cursor-not-allowed","data-[state=error]:bg-red-600 data-[state=error]:hover:bg-red-500 data-[state=error]:focus-visible:bg-red-500 data-[state=success]:focus-visible:bg-green-500","data-[state=success]:bg-green-600 data-[state=success]:hover:bg-green-500"),onClick:async()=>{if(!(!e||!S||w)){if(!r){t(!0);return}await g({schema:x,space:r}).then(C=>{setTimeout(async()=>{h.reset(C,{keepDefaultValues:!1}),d()},1500)})}},children:p==="pending"?f.jsxs(f.Fragment,{children:[f.jsx(Er,{}),"Publishing Schema"]}):p==="success"?f.jsxs(f.Fragment,{children:[f.jsx(ut,{className:"size-5 text-white","aria-hidden":"true"}),"Schema Published"]}):p==="error"?f.jsxs(f.Fragment,{children:[f.jsx(yr,{className:"size-5 text-white","aria-hidden":"true"}),"Error"]}):f.jsxs(f.Fragment,{children:[f.jsx(Oc,{className:"size-5","aria-hidden":"true"}),"Publish Schema"]})}),f.jsx(Ki,{children:f.jsx(Yi,{side:"top",sideOffset:10,children:f.jsxs(Qi,{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:[f.jsx(Xi,{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:f.jsx(to,{})}),f.jsx("span",{className:"text-xs text-gray-700 dark:text-white whitespace-break-spaces w-full",children:e?w?"Please sync your Schema to the schema.ts file first. Then Publish to the Knowledge Graph":S?"Publish your Schema changes to the Knowledge Graph":"Add types/properties to your Schema and sync with your schema file before Publishing to the Knowledge Graph":"Must be authenticated to Publish"})]})})})]})})]})]})]})}),f.jsx(y1,{open:n,setOpen:t,spaceSubmitted:async b=>{t(!1),await g({schema:x,space:b.id}).then(C=>{setTimeout(async()=>{h.reset(C,{keepDefaultValues:!1}),d()},1500)})}}),f.jsx(ih,{className:"fixed z-10 w-sm mx-0 my-auto bottom-4 md:bottom-8 right-4 md:right-8 left-auto top-auto",children:i.toasts.map(b=>f.jsx(gh,{toast:b,className:"pointer-events-auto w-full max-w-md rounded-lg bg-white shadow-lg outline-1 outline-black/5 transition data-closed:opacity-0 data-enter:transform data-enter:duration-300 data-enter:ease-out data-closed:data-enter:translate-y-2 data-leave:duration-100 data-leave:ease-in data-closed:data-enter:sm:translate-x-2 data-closed:data-enter:sm:translate-y-0 dark:bg-gray-800 dark:-outline-offset-1 dark:outline-white/10 p-4",children:f.jsx("div",{className:"p-4",children:f.jsxs("div",{className:"flex items-start",children:[f.jsx("div",{className:"shrink-0",children:f.jsx(Ti,{"aria-hidden":"true",className:"size-6 text-red-400"})}),f.jsxs("div",{className:"ml-3 w-0 flex-1 pt-0.5",children:[f.jsx(vh,{className:"text-sm font-medium text-gray-900 dark:text-white"}),f.jsx(yh,{className:"mt-1 text-sm text-gray-500 dark:text-gray-400"})]}),f.jsx("div",{className:"ml-4 flex shrink-0",children:f.jsx(Sh,{"aria-label":"Close",className:"inline-flex rounded-md text-gray-400 hover:text-gray-500 focus:outline-2 focus:outline-offset-2 focus:outline-red-600 dark:hover:text-white dark:focus:outline-red-500",children:f.jsx(Ri,{className:"size-4","aria-hidden":"true"})})})]})})},b.id))})]})}export{pg as component};