@datnguyennnx/localterm 0.1.5 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -116,6 +116,6 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
116
116
 
117
117
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=jf,s=!gf.jitless,c=s&&Mf.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Qm([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function th(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Jf(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Zf(e,r,_f())))}),t)}var nh=J(`$ZodUnion`,(e,t)=>{mm.init(e,t),Tf(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),Tf(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),Tf(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),Tf(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Sf(e.source)).join(`|`)})$`)}});let n=t.options.length===1,r=t.options[0]._zod.run;e._zod.parse=(i,a)=>{if(n)return r(i,a);let o=!1,s=[];for(let e of t.options){let t=e._zod.run({value:i.value,issues:[]},a);if(t instanceof Promise)s.push(t),o=!0;else{if(t.issues.length===0)return t;s.push(t)}}return o?Promise.all(s).then(t=>th(t,i,e,a)):th(s,i,e,a)}}),rh=J(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,nh.init(e,t);let n=e._zod.parse;Tf(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=bf(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!jf(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,input:o,path:[t.discriminator],inst:e}),i)}}),ih=J(`$ZodIntersection`,(e,t)=>{mm.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>oh(e,t,n)):oh(e,i,a)}});function ah(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Nf(e)&&Nf(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=ah(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=ah(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function oh(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Jf(e))return e;let o=ah(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var sh=J(`$ZodRecord`,(e,t)=>{mm.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Nf(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let e of o)if(typeof e==`string`||typeof e==`number`||typeof e==`symbol`){s.add(typeof e==`number`?e.toString():e);let o=t.valueType._zod.run({value:i[e],issues:[]},r);o instanceof Promise?a.push(o.then(t=>{t.issues.length&&n.issues.push(...Yf(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...Yf(e,o.issues)),n.value[e]=o.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`)continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&Gp.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>Zf(e,r,_f())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...Yf(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...Yf(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),ch=J(`$ZodEnum`,(e,t)=>{mm.init(e,t);let n=vf(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>Ff.has(typeof e)).map(e=>typeof e==`string`?If(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),lh=J(`$ZodLiteral`,(e,t)=>{if(mm.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?If(e):e?If(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),uh=J(`$ZodTransform`,(e,t)=>{mm.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new hf(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new mf;return n.value=i,n}});function dh(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var fh=J(`$ZodOptional`,(e,t)=>{mm.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,Tf(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),Tf(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Sf(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(t=>dh(t,e.value)):dh(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),ph=J(`$ZodExactOptional`,(e,t)=>{fh.init(e,t),Tf(e._zod,`values`,()=>t.innerType._zod.values),Tf(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),mh=J(`$ZodNullable`,(e,t)=>{mm.init(e,t),Tf(e._zod,`optin`,()=>t.innerType._zod.optin),Tf(e._zod,`optout`,()=>t.innerType._zod.optout),Tf(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Sf(e.source)}|null)$`):void 0}),Tf(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),hh=J(`$ZodDefault`,(e,t)=>{mm.init(e,t),e._zod.optin=`optional`,Tf(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>gh(e,t)):gh(r,t)}});function gh(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var _h=J(`$ZodPrefault`,(e,t)=>{mm.init(e,t),e._zod.optin=`optional`,Tf(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),vh=J(`$ZodNonOptional`,(e,t)=>{mm.init(e,t),Tf(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>yh(t,e)):yh(i,e)}});function yh(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var bh=J(`$ZodCatch`,(e,t)=>{mm.init(e,t),Tf(e._zod,`optin`,()=>t.innerType._zod.optin),Tf(e._zod,`optout`,()=>t.innerType._zod.optout),Tf(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Zf(e,n,_f()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>Zf(e,n,_f()))},input:e.value}),e.issues=[]),e)}}),xh=J(`$ZodPipe`,(e,t)=>{mm.init(e,t),Tf(e._zod,`values`,()=>t.in._zod.values),Tf(e._zod,`optin`,()=>t.in._zod.optin),Tf(e._zod,`optout`,()=>t.out._zod.optout),Tf(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Sh(e,t.in,n)):Sh(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Sh(e,t.out,n)):Sh(r,t.out,n)}});function Sh(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var Ch=J(`$ZodReadonly`,(e,t)=>{mm.init(e,t),Tf(e._zod,`propValues`,()=>t.innerType._zod.propValues),Tf(e._zod,`values`,()=>t.innerType._zod.values),Tf(e._zod,`optin`,()=>t.innerType?._zod?.optin),Tf(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(wh):wh(r)}});function wh(e){return e.value=Object.freeze(e.value),e}var Th=J(`$ZodCustom`,(e,t)=>{Yp.init(e,t),mm.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Eh(t,n,r,e));Eh(i,n,r,e)}});function Eh(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push($f(e))}}var Dh,Oh=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function kh(){return new Oh}(Dh=globalThis).__zod_globalRegistry??(Dh.__zod_globalRegistry=kh());var Ah=globalThis.__zod_globalRegistry;function jh(e,t){return new e({type:`string`,...Rf(t)})}function Mh(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...Rf(t)})}function Nh(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...Rf(t)})}function Ph(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...Rf(t)})}function Fh(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...Rf(t)})}function Ih(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...Rf(t)})}function Lh(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...Rf(t)})}function Rh(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...Rf(t)})}function zh(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...Rf(t)})}function Bh(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...Rf(t)})}function Vh(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...Rf(t)})}function Hh(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...Rf(t)})}function Uh(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...Rf(t)})}function Wh(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...Rf(t)})}function Gh(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...Rf(t)})}function Kh(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...Rf(t)})}function qh(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...Rf(t)})}function Jh(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...Rf(t)})}function Yh(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...Rf(t)})}function Xh(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...Rf(t)})}function Zh(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...Rf(t)})}function Qh(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...Rf(t)})}function $h(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...Rf(t)})}function eg(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...Rf(t)})}function tg(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...Rf(t)})}function ng(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...Rf(t)})}function rg(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...Rf(t)})}function ig(e,t){return new e({type:`number`,checks:[],...Rf(t)})}function ag(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...Rf(t)})}function og(e,t){return new e({type:`boolean`,...Rf(t)})}function sg(e){return new e({type:`unknown`})}function cg(e,t){return new e({type:`never`,...Rf(t)})}function lg(e,t){return new Zp({check:`less_than`,...Rf(t),value:e,inclusive:!1})}function ug(e,t){return new Zp({check:`less_than`,...Rf(t),value:e,inclusive:!0})}function dg(e,t){return new Qp({check:`greater_than`,...Rf(t),value:e,inclusive:!1})}function fg(e,t){return new Qp({check:`greater_than`,...Rf(t),value:e,inclusive:!0})}function pg(e,t){return new $p({check:`multiple_of`,...Rf(t),value:e})}function mg(e,t){return new tm({check:`max_length`,...Rf(t),maximum:e})}function hg(e,t){return new nm({check:`min_length`,...Rf(t),minimum:e})}function gg(e,t){return new rm({check:`length_equals`,...Rf(t),length:e})}function _g(e,t){return new am({check:`string_format`,format:`regex`,...Rf(t),pattern:e})}function vg(e){return new om({check:`string_format`,format:`lowercase`,...Rf(e)})}function yg(e){return new sm({check:`string_format`,format:`uppercase`,...Rf(e)})}function bg(e,t){return new cm({check:`string_format`,format:`includes`,...Rf(t),includes:e})}function xg(e,t){return new lm({check:`string_format`,format:`starts_with`,...Rf(t),prefix:e})}function Sg(e,t){return new um({check:`string_format`,format:`ends_with`,...Rf(t),suffix:e})}function Cg(e){return new dm({check:`overwrite`,tx:e})}function wg(e){return Cg(t=>t.normalize(e))}function Tg(){return Cg(e=>e.trim())}function Eg(){return Cg(e=>e.toLowerCase())}function Dg(){return Cg(e=>e.toUpperCase())}function Og(){return Cg(e=>kf(e))}function kg(e,t,n){return new e({type:`array`,element:t,...Rf(n)})}function Ag(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...Rf(n)})}function jg(e){let t=Mg(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push($f(e,n.value,t._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=n.value,r.inst??=t,r.continue??=!t._zod.def.abort,n.issues.push($f(r))}},e(n.value,n)));return t}function Mg(e,t){let n=new Yp({check:`custom`,...Rf(t)});return n._zod.check=e,n}function Ng(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Ah,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function Pg(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,Pg(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&Lg(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&o.schema._prefault&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function Fg(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
118
118
 
119
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ig(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:zg(t,`input`,e.processors),output:zg(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Lg(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Lg(r.element,n);if(r.type===`set`)return Lg(r.valueType,n);if(r.type===`lazy`)return Lg(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Lg(r.innerType,n);if(r.type===`intersection`)return Lg(r.left,n)||Lg(r.right,n);if(r.type===`record`||r.type===`map`)return Lg(r.keyType,n)||Lg(r.valueType,n);if(r.type===`pipe`)return Lg(r.in,n)||Lg(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Lg(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Lg(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Lg(e,n))return!0;return!!(r.rest&&Lg(r.rest,n))}return!1}var Rg=(e,t={})=>n=>{let r=Ng({...n,processors:t});return Pg(e,r),Fg(r,e),Ig(r,e)},zg=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ng({...i??{},target:a,io:t,processors:n});return Pg(e,o),Fg(o,e),Ig(o,e)},Bg={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Vg=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Bg[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Hg=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Ug=(e,t,n,r)=>{n.type=`boolean`},Wg=(e,t,n,r)=>{n.not={}},Gg=(e,t,n,r)=>{let i=e._zod.def,a=vf(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Kg=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},qg=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Jg=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Yg=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Pg(a.element,t,{...r,path:[...r.path,`items`]})},Xg=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Pg(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Pg(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Zg=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Pg(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Qg=(e,t,n,r)=>{let i=e._zod.def,a=Pg(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Pg(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},$g=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Pg(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Pg(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Pg(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},e_=(e,t,n,r)=>{let i=e._zod.def,a=Pg(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},t_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},n_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},r_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},i_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},a_=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Pg(a,t,r);let o=t.seen.get(e);o.ref=a},o_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},s_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},c_=J(`ZodISODateTime`,(e,t)=>{Om.init(e,t),P_.init(e,t)});function l_(e){return eg(c_,e)}var u_=J(`ZodISODate`,(e,t)=>{km.init(e,t),P_.init(e,t)});function d_(e){return tg(u_,e)}var f_=J(`ZodISOTime`,(e,t)=>{Am.init(e,t),P_.init(e,t)});function p_(e){return ng(f_,e)}var m_=J(`ZodISODuration`,(e,t)=>{jm.init(e,t),P_.init(e,t)});function h_(e){return rg(m_,e)}var g_=(e,t)=>{tp.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ip(e,t)},flatten:{value:t=>rp(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,yf,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,yf,2)}},isEmpty:{get(){return e.issues.length===0}}})};J(`ZodError`,g_);var __=J(`ZodError`,g_,{Parent:Error}),v_=ap(__),y_=op(__),b_=sp(__),x_=lp(__),S_=dp(__),C_=fp(__),w_=pp(__),T_=mp(__),E_=hp(__),D_=gp(__),O_=_p(__),k_=vp(__),A_=J(`ZodType`,(e,t)=>(mm.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:zg(e,`input`),output:zg(e,`output`)}}),e.toJSONSchema=Rg(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(Df(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Lf(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>v_(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>b_(e,t,n),e.parseAsync=async(t,n)=>y_(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>x_(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>S_(e,t,n),e.decode=(t,n)=>C_(e,t,n),e.encodeAsync=async(t,n)=>w_(e,t,n),e.decodeAsync=async(t,n)=>T_(e,t,n),e.safeEncode=(t,n)=>E_(e,t,n),e.safeDecode=(t,n)=>D_(e,t,n),e.safeEncodeAsync=async(t,n)=>O_(e,t,n),e.safeDecodeAsync=async(t,n)=>k_(e,t,n),e.refine=(t,n)=>e.check(qv(t,n)),e.superRefine=t=>e.check(Jv(t)),e.overwrite=t=>e.check(Cg(t)),e.optional=()=>kv(e),e.exactOptional=()=>jv(e),e.nullable=()=>Nv(e),e.nullish=()=>kv(Nv(e)),e.nonoptional=t=>zv(e,t),e.array=()=>dv(e),e.or=t=>hv([e,t]),e.and=t=>yv(e,t),e.transform=t=>Uv(e,Dv(t)),e.default=t=>Fv(e,t),e.prefault=t=>Lv(e,t),e.catch=t=>Vv(e,t),e.pipe=t=>Uv(e,t),e.readonly=()=>Gv(e),e.describe=t=>{let n=e.clone();return Ah.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Ah.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Ah.get(e);let n=e.clone();return Ah.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),j_=J(`_ZodString`,(e,t)=>{hm.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vg(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(_g(...t)),e.includes=(...t)=>e.check(bg(...t)),e.startsWith=(...t)=>e.check(xg(...t)),e.endsWith=(...t)=>e.check(Sg(...t)),e.min=(...t)=>e.check(hg(...t)),e.max=(...t)=>e.check(mg(...t)),e.length=(...t)=>e.check(gg(...t)),e.nonempty=(...t)=>e.check(hg(1,...t)),e.lowercase=t=>e.check(vg(t)),e.uppercase=t=>e.check(yg(t)),e.trim=()=>e.check(Tg()),e.normalize=(...t)=>e.check(wg(...t)),e.toLowerCase=()=>e.check(Eg()),e.toUpperCase=()=>e.check(Dg()),e.slugify=()=>e.check(Og())}),M_=J(`ZodString`,(e,t)=>{hm.init(e,t),j_.init(e,t),e.email=t=>e.check(Mh(F_,t)),e.url=t=>e.check(Rh(R_,t)),e.jwt=t=>e.check($h($_,t)),e.emoji=t=>e.check(zh(z_,t)),e.guid=t=>e.check(Nh(I_,t)),e.uuid=t=>e.check(Ph(L_,t)),e.uuidv4=t=>e.check(Fh(L_,t)),e.uuidv6=t=>e.check(Ih(L_,t)),e.uuidv7=t=>e.check(Lh(L_,t)),e.nanoid=t=>e.check(Bh(B_,t)),e.guid=t=>e.check(Nh(I_,t)),e.cuid=t=>e.check(Vh(V_,t)),e.cuid2=t=>e.check(Hh(H_,t)),e.ulid=t=>e.check(Uh(U_,t)),e.base64=t=>e.check(Xh(X_,t)),e.base64url=t=>e.check(Zh(Z_,t)),e.xid=t=>e.check(Wh(W_,t)),e.ksuid=t=>e.check(Gh(G_,t)),e.ipv4=t=>e.check(Kh(K_,t)),e.ipv6=t=>e.check(qh(q_,t)),e.cidrv4=t=>e.check(Jh(J_,t)),e.cidrv6=t=>e.check(Yh(Y_,t)),e.e164=t=>e.check(Qh(Q_,t)),e.datetime=t=>e.check(l_(t)),e.date=t=>e.check(d_(t)),e.time=t=>e.check(p_(t)),e.duration=t=>e.check(h_(t))});function N_(e){return jh(M_,e)}var P_=J(`ZodStringFormat`,(e,t)=>{gm.init(e,t),j_.init(e,t)}),F_=J(`ZodEmail`,(e,t)=>{ym.init(e,t),P_.init(e,t)}),I_=J(`ZodGUID`,(e,t)=>{_m.init(e,t),P_.init(e,t)}),L_=J(`ZodUUID`,(e,t)=>{vm.init(e,t),P_.init(e,t)}),R_=J(`ZodURL`,(e,t)=>{bm.init(e,t),P_.init(e,t)}),z_=J(`ZodEmoji`,(e,t)=>{xm.init(e,t),P_.init(e,t)}),B_=J(`ZodNanoID`,(e,t)=>{Sm.init(e,t),P_.init(e,t)}),V_=J(`ZodCUID`,(e,t)=>{Cm.init(e,t),P_.init(e,t)}),H_=J(`ZodCUID2`,(e,t)=>{wm.init(e,t),P_.init(e,t)}),U_=J(`ZodULID`,(e,t)=>{Tm.init(e,t),P_.init(e,t)}),W_=J(`ZodXID`,(e,t)=>{Em.init(e,t),P_.init(e,t)}),G_=J(`ZodKSUID`,(e,t)=>{Dm.init(e,t),P_.init(e,t)}),K_=J(`ZodIPv4`,(e,t)=>{Mm.init(e,t),P_.init(e,t)}),q_=J(`ZodIPv6`,(e,t)=>{Nm.init(e,t),P_.init(e,t)}),J_=J(`ZodCIDRv4`,(e,t)=>{Pm.init(e,t),P_.init(e,t)}),Y_=J(`ZodCIDRv6`,(e,t)=>{Fm.init(e,t),P_.init(e,t)}),X_=J(`ZodBase64`,(e,t)=>{Lm.init(e,t),P_.init(e,t)}),Z_=J(`ZodBase64URL`,(e,t)=>{zm.init(e,t),P_.init(e,t)}),Q_=J(`ZodE164`,(e,t)=>{Bm.init(e,t),P_.init(e,t)}),$_=J(`ZodJWT`,(e,t)=>{Hm.init(e,t),P_.init(e,t)}),ev=J(`ZodNumber`,(e,t)=>{Um.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hg(e,t,n,r),e.gt=(t,n)=>e.check(dg(t,n)),e.gte=(t,n)=>e.check(fg(t,n)),e.min=(t,n)=>e.check(fg(t,n)),e.lt=(t,n)=>e.check(lg(t,n)),e.lte=(t,n)=>e.check(ug(t,n)),e.max=(t,n)=>e.check(ug(t,n)),e.int=t=>e.check(rv(t)),e.safe=t=>e.check(rv(t)),e.positive=t=>e.check(dg(0,t)),e.nonnegative=t=>e.check(fg(0,t)),e.negative=t=>e.check(lg(0,t)),e.nonpositive=t=>e.check(ug(0,t)),e.multipleOf=(t,n)=>e.check(pg(t,n)),e.step=(t,n)=>e.check(pg(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function tv(e){return ig(ev,e)}var nv=J(`ZodNumberFormat`,(e,t)=>{Wm.init(e,t),ev.init(e,t)});function rv(e){return ag(nv,e)}var iv=J(`ZodBoolean`,(e,t)=>{Gm.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ug(e,t,n,r)});function av(e){return og(iv,e)}var ov=J(`ZodUnknown`,(e,t)=>{Km.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function sv(){return sg(ov)}var cv=J(`ZodNever`,(e,t)=>{qm.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wg(e,t,n,r)});function lv(e){return cg(cv,e)}var uv=J(`ZodArray`,(e,t)=>{Ym.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yg(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(hg(t,n)),e.nonempty=t=>e.check(hg(1,t)),e.max=(t,n)=>e.check(mg(t,n)),e.length=(t,n)=>e.check(gg(t,n)),e.unwrap=()=>e.element});function dv(e,t){return kg(uv,e,t)}var fv=J(`ZodObject`,(e,t)=>{eh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xg(e,t,n,r),Tf(e,`shape`,()=>t.shape),e.keyof=()=>Cv(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:sv()}),e.loose=()=>e.clone({...e._zod.def,catchall:sv()}),e.strict=()=>e.clone({...e._zod.def,catchall:lv()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Uf(e,t),e.safeExtend=t=>Wf(e,t),e.merge=t=>Gf(e,t),e.pick=t=>Vf(e,t),e.omit=t=>Hf(e,t),e.partial=(...t)=>Kf(Ov,e,t[0]),e.required=(...t)=>qf(Rv,e,t[0])});function pv(e,t){return new fv({type:`object`,shape:e??{},...Rf(t)})}var mv=J(`ZodUnion`,(e,t)=>{nh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zg(e,t,n,r),e.options=t.options});function hv(e,t){return new mv({type:`union`,options:e,...Rf(t)})}var gv=J(`ZodDiscriminatedUnion`,(e,t)=>{mv.init(e,t),rh.init(e,t)});function _v(e,t,n){return new gv({type:`union`,options:t,discriminator:e,...Rf(n)})}var vv=J(`ZodIntersection`,(e,t)=>{ih.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qg(e,t,n,r)});function yv(e,t){return new vv({type:`intersection`,left:e,right:t})}var bv=J(`ZodRecord`,(e,t)=>{sh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$g(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function xv(e,t,n){return new bv({type:`record`,keyType:e,valueType:t,...Rf(n)})}var Sv=J(`ZodEnum`,(e,t)=>{ch.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gg(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Sv({...t,checks:[],...Rf(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Sv({...t,checks:[],...Rf(r),entries:i})}});function Cv(e,t){return new Sv({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Rf(t)})}var wv=J(`ZodLiteral`,(e,t)=>{lh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kg(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Tv(e,t){return new wv({type:`literal`,values:Array.isArray(e)?e:[e],...Rf(t)})}var Ev=J(`ZodTransform`,(e,t)=>{uh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jg(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new hf(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push($f(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push($f(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Dv(e){return new Ev({type:`transform`,transform:e})}var Ov=J(`ZodOptional`,(e,t)=>{fh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kv(e){return new Ov({type:`optional`,innerType:e})}var Av=J(`ZodExactOptional`,(e,t)=>{ph.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jv(e){return new Av({type:`optional`,innerType:e})}var Mv=J(`ZodNullable`,(e,t)=>{mh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>e_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nv(e){return new Mv({type:`nullable`,innerType:e})}var Pv=J(`ZodDefault`,(e,t)=>{hh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>n_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Fv(e,t){return new Pv({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pf(t)}})}var Iv=J(`ZodPrefault`,(e,t)=>{_h.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>r_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lv(e,t){return new Iv({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pf(t)}})}var Rv=J(`ZodNonOptional`,(e,t)=>{vh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zv(e,t){return new Rv({type:`nonoptional`,innerType:e,...Rf(t)})}var Bv=J(`ZodCatch`,(e,t)=>{bh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>i_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Vv(e,t){return new Bv({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Hv=J(`ZodPipe`,(e,t)=>{xh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>a_(e,t,n,r),e.in=t.in,e.out=t.out});function Uv(e,t){return new Hv({type:`pipe`,in:e,out:t})}var Wv=J(`ZodReadonly`,(e,t)=>{Ch.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>o_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gv(e){return new Wv({type:`readonly`,innerType:e})}var Kv=J(`ZodCustom`,(e,t)=>{Th.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qg(e,t,n,r)});function qv(e,t={}){return Ag(Kv,e,t)}function Jv(e){return jg(e)}pv({ok:av(),sessions:tv().int().nonnegative()}).strict(),_v(`type`,[pv({type:Tv(`input`),data:N_().max(lf)}).strict(),pv({type:Tv(`resize`),cols:tv().int().positive().max(ff),rows:tv().int().positive().max(pf)}).strict(),pv({type:Tv(`flow-pause`)}).strict(),pv({type:Tv(`flow-resume`)}).strict(),pv({type:Tv(`rpc`),id:N_().min(1).max(64),method:Cv([`spawn_session`,`list_sessions`,`write_input`,`read_output`,`wait_for_boundary`,`exec`]),params:xv(N_(),sv()).optional()}).strict()]),_v(`type`,[pv({type:Tv(`output`),data:N_().max(uf)}).strict(),pv({type:Tv(`exit`),code:tv().int().nullable()}).strict(),pv({type:Tv(`title`),title:N_().max(df)}).strict(),pv({type:Tv(`session`),shell:N_().min(1),shellName:N_().min(1),pid:tv().int().nonnegative(),cwd:N_().min(1)}).strict(),pv({type:Tv(`cwd`),cwd:N_().min(1)}).strict(),pv({type:Tv(`agent-output`),text:N_().max(uf)}).strict(),pv({type:Tv(`command-boundary`),phase:Cv([`prompt-start`,`command-start`,`output-start`,`command-end`]),exitCode:tv().int().optional()}).strict(),pv({type:Tv(`rpc-response`),id:N_().min(1).max(64),result:sv().optional(),error:N_().optional()}).strict()]);var Yv=e=>typeof e==`string`?e.length:e.byteLength,Xv=`cwd`,Zv=e=>{let t=new URL(`/ws`,window.location.href);t.protocol=t.protocol===`https:`?`wss:`:`ws:`;let n=e??new URLSearchParams(window.location.search).get(Xv);return n&&t.searchParams.set(Xv,n),t.toString()},Qv=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(Xv,e),t.toString()},$v=e=>{let t=0,n=0,r=!1,i=t=>{if(e.hasScrollRestore()){e.restoreScrollFromResize();return}t.wasAtBottom&&e.restoreScrollAnchor(t)};return{write:a=>{if(e.isExited())return;let o=e.captureScrollAnchor(),s=Yv(a),c=t;t+=s,!r&&n>=4&&(e.sendFlowPause(),r=!0),e.terminalWrite(a,()=>{n=Math.max(0,n-1),r&&n<1&&(e.sendFlowResume(),r=!1),i(o)}),n++,c<131072&&t>=131072&&(t=0)},clear:()=>{t=0,n=0,r=!1}}},ey=(e,t)=>`\x1b[${e};${t+1}u`,ty=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),ny=(e,t)=>e.key!==`f`&&e.key!==`F`?!1:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,ry=(e,t)=>t.buffer.active.type!==`alternate`||t.modes.mouseTrackingMode!==`none`?!1:e.deltaMode===WheelEvent.DOM_DELTA_PIXEL,iy=e=>{let t=[0];return e.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let n=e[0],r=typeof n==`number`?n:1;return t.push(r),!0}),e.parser.registerCsiHandler({prefix:`<`,final:`u`},e=>{let n=e[0],r=typeof n==`number`&&n>0?n:1;for(let e=0;e<r&&t.length>1;e+=1)t.pop();return!0}),e.parser.registerCsiHandler({prefix:`=`,final:`u`},e=>{let n=e[0],r=e[1];if(typeof n!=`number`)return!0;let i=n,a=typeof r==`number`&&r>0?r:1,o=t.length-1,s=t[o]??0;return a===1?t[o]=i:a===2?t[o]=s|i:a===3&&(t[o]=s&~i),!0}),{getFlags:()=>t[t.length-1]??0}},ay=(e,t)=>{e.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(ny(e,t.isMac))return e.type===`keydown`&&(e.preventDefault(),t.openFindOverlay()),!1;if(e.type===`keydown`&&e.key===`Enter`){let n=ty(e),r=(t.getKittyFlags()&1)!=0;if(n!==0&&r)return e.preventDefault(),t.sendInput(ey(13,n)),!1;if(n===1)return e.preventDefault(),t.sendInput(`
120
- `),!1}return!0})},oy=e=>{e.attachCustomWheelEventHandler(t=>ry(t,e)?(t.preventDefault(),!1):!0)},sy=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},cy=(e,t)=>{if(t.wasAtBottom){e.scrollToBottom();return}let n=e.buffer.active,r=Math.max(0,n.baseY-t.distanceFromBottom)-n.viewportY;r!==0&&e.scrollLines(r)},ly=(e,t)=>{let n=e.buffer.active,r=Math.max(0,n.baseY-n.viewportY),i=r===0;try{t.fit()}catch{return!1}try{if(i)return e.scrollToBottom(),!0;let t=e.buffer.active;if(r>t.baseY)return e.scrollToBottom(),!0;let n=Math.max(0,t.baseY-r)-t.viewportY;n!==0&&e.scrollLines(n)}catch{}return!0},uy=e=>{let t=null,n=null,r=null,i=()=>sy(e.terminal),a=t=>{cy(e.terminal,t)},o=()=>{r&&window.clearTimeout(r.timer),n!==null&&(window.cancelAnimationFrame(n),n=null),r=null},s=()=>{r&&a(r.anchor)},c=e=>{o(),r={anchor:e,timer:window.setTimeout(()=>{s(),r=null},rd)},n=window.requestAnimationFrame(()=>{n=null,s()})},l=()=>{let t=i();ly(e.terminal,e.fitAddon)&&c(t)};return{captureAnchor:i,restoreAnchor:a,fitToContainer:l,scheduleFit:()=>{t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{t=null,l()},e.resizeDebounceMs)},beginResizeScrollRestore:c,clearResizeScrollRestore:o,restoreResizeScroll:s,hasResizeRestore:()=>r!==null,cleanupResizeScroll:()=>{t!==null&&window.clearTimeout(t),o()}}},dy=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),fy=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),py=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),my=e=>{let t=py(e);return t.charAt(0).toUpperCase()+t.slice(1)},hy={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},gy=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},_y=(0,b.createContext)({}),vy=()=>(0,b.useContext)(_y),yy=(0,b.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=vy()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,b.createElement)(`svg`,{ref:c,...hy,width:t??l??hy.width,height:t??l??hy.height,stroke:e??f,strokeWidth:m,className:dy(`lucide`,p,i),...!a&&!gy(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),by=(e,t)=>{let n=(0,b.forwardRef)(({className:n,...r},i)=>(0,b.createElement)(yy,{ref:i,iconNode:t,className:dy(`lucide-${fy(my(e))}`,`lucide-${e}`,n),...r}));return n.displayName=my(e),n},xy=by(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Sy=by(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Cy=by(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),wy=by(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Ty=by(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),Ey=by(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Dy=by(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),Oy=by(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),ky=by(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),Ay=by(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),jy=by(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function My(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=My(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Ny(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=My(e))&&(r&&(r+=` `),r+=t);return r}var Py=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Fy=Ny,Iy=(e,t)=>n=>{if(t?.variants==null)return Fy(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Py(t)||Py(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Fy(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Ly=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Ry=(e,t)=>({classGroupId:e,validator:t}),zy=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),By=`-`,Vy=[],Hy=`arbitrary..`,Uy=e=>{let t=Ky(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Gy(e);let n=e.split(By);return Wy(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ly(i,t):t:i||Vy}return n[e]||Vy}}},Wy=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Wy(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(By):e.slice(t).join(By),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Gy=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Hy+r:void 0})(),Ky=e=>{let{theme:t,classGroups:n}=e;return qy(n,t)},qy=(e,t)=>{let n=zy();for(let r in e){let i=e[r];Jy(i,n,r,t)}return n},Jy=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Yy(i,t,n,r)}},Yy=(e,t,n,r)=>{if(typeof e==`string`){Xy(e,t,n);return}if(typeof e==`function`){Zy(e,t,n,r);return}Qy(e,t,n,r)},Xy=(e,t,n)=>{let r=e===``?t:$y(t,e);r.classGroupId=n},Zy=(e,t,n,r)=>{if(eb(e)){Jy(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Ry(n,e))},Qy=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Jy(o,$y(t,a),n,r)}},$y=(e,t)=>{let n=e,r=t.split(By),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=zy(),n.nextPart.set(t,i)),n=i}return n},eb=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,tb=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},nb=`!`,rb=`:`,ib=[],ab=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),ob=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===rb){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(nb)?(c=s.slice(0,-1),l=!0):s.startsWith(nb)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return ab(t,l,c,u)};if(t){let e=t+rb,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):ab(ib,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},sb=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},cb=e=>({cache:tb(e.cacheSize),parseClassName:ob(e),sortModifiers:sb(e),...Uy(e)}),lb=/\s+/,ub=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(lb),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+nb:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},db=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=fb(n))&&(i&&(i+=` `),i+=r);return i},fb=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=fb(e[r]))&&(n&&(n+=` `),n+=t);return n},pb=(e,...t)=>{let n,r,i,a,o=o=>(n=cb(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=ub(e,n);return i(e,a),a};return a=o,(...e)=>a(db(...e))},mb=[],hb=e=>{let t=t=>t[e]||mb;return t.isThemeGetter=!0,t},gb=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,_b=/^\((?:(\w[\w-]*):)?(.+)\)$/i,vb=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,yb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,bb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,xb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Sb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Cb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,wb=e=>vb.test(e),Tb=e=>!!e&&!Number.isNaN(Number(e)),Eb=e=>!!e&&Number.isInteger(Number(e)),Db=e=>e.endsWith(`%`)&&Tb(e.slice(0,-1)),Ob=e=>yb.test(e),kb=()=>!0,Ab=e=>bb.test(e)&&!xb.test(e),jb=()=>!1,Mb=e=>Sb.test(e),Nb=e=>Cb.test(e),Pb=e=>!Y(e)&&!X(e),Fb=e=>Xb(e,ex,jb),Y=e=>gb.test(e),Ib=e=>Xb(e,tx,Ab),Lb=e=>Xb(e,nx,Tb),Rb=e=>Xb(e,ix,kb),zb=e=>Xb(e,rx,jb),Bb=e=>Xb(e,Qb,jb),Vb=e=>Xb(e,$b,Nb),Hb=e=>Xb(e,ax,Mb),X=e=>_b.test(e),Ub=e=>Zb(e,tx),Wb=e=>Zb(e,rx),Gb=e=>Zb(e,Qb),Kb=e=>Zb(e,ex),qb=e=>Zb(e,$b),Jb=e=>Zb(e,ax,!0),Yb=e=>Zb(e,ix,!0),Xb=(e,t,n)=>{let r=gb.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Zb=(e,t,n=!1)=>{let r=_b.exec(e);return r?r[1]?t(r[1]):n:!1},Qb=e=>e===`position`||e===`percentage`,$b=e=>e===`image`||e===`url`,ex=e=>e===`length`||e===`size`||e===`bg-size`,tx=e=>e===`length`,nx=e=>e===`number`,rx=e=>e===`family-name`,ix=e=>e===`number`||e===`weight`,ax=e=>e===`shadow`,ox=pb(()=>{let e=hb(`color`),t=hb(`font`),n=hb(`text`),r=hb(`font-weight`),i=hb(`tracking`),a=hb(`leading`),o=hb(`breakpoint`),s=hb(`container`),c=hb(`spacing`),l=hb(`radius`),u=hb(`shadow`),d=hb(`inset-shadow`),f=hb(`text-shadow`),p=hb(`drop-shadow`),m=hb(`blur`),h=hb(`perspective`),g=hb(`aspect`),_=hb(`ease`),v=hb(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),X,Y],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[X,Y,c],T=()=>[wb,`full`,`auto`,...w()],E=()=>[Eb,`none`,`subgrid`,X,Y],D=()=>[`auto`,{span:[`full`,Eb,X,Y]},Eb,X,Y],O=()=>[Eb,`auto`,X,Y],k=()=>[`auto`,`min`,`max`,`fr`,X,Y],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[wb,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[wb,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[wb,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,X,Y],L=()=>[...b(),Gb,Bb,{position:[X,Y]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],R=()=>[`auto`,`cover`,`contain`,Kb,Fb,{size:[X,Y]}],te=()=>[Db,Ub,Ib],z=()=>[``,`none`,`full`,l,X,Y],B=()=>[``,Tb,Ub,Ib],V=()=>[`solid`,`dashed`,`dotted`,`double`],ne=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],re=()=>[Tb,Db,Gb,Bb],H=()=>[``,`none`,m,X,Y],ie=()=>[`none`,Tb,X,Y],ae=()=>[`none`,Tb,X,Y],oe=()=>[Tb,X,Y],se=()=>[wb,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Ob],breakpoint:[Ob],color:[kb],container:[Ob],"drop-shadow":[Ob],ease:[`in`,`out`,`in-out`],font:[Pb],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Ob],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Ob],shadow:[Ob],spacing:[`px`,Tb],text:[Ob],"text-shadow":[Ob],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,wb,Y,X,g]}],container:[`container`],columns:[{columns:[Tb,Y,X,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Eb,`auto`,X,Y]}],basis:[{basis:[wb,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Tb,wb,`auto`,`initial`,`none`,Y]}],grow:[{grow:[``,Tb,X,Y]}],shrink:[{shrink:[``,Tb,X,Y]}],order:[{order:[Eb,`first`,`last`,`none`,X,Y]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,Ub,Ib]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Yb,Rb]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Db,Y]}],"font-family":[{font:[Wb,zb,t]}],"font-features":[{"font-features":[Y]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,X,Y]}],"line-clamp":[{"line-clamp":[Tb,`none`,X,Lb]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,X,Y]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,X,Y]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[Tb,`from-font`,`auto`,X,Ib]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Tb,`auto`,X,Y]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,X,Y]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,X,Y]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:R()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Eb,X,Y],radial:[``,X,Y],conic:[Eb,X,Y]},qb,Vb]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":B()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Tb,X,Y]}],"outline-w":[{outline:[``,Tb,Ub,Ib]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Jb,Hb]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Jb,Hb]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Tb,Ib]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Jb,Hb]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Tb,X,Y]}],"mix-blend":[{"mix-blend":[...ne(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Tb]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[X,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Tb]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,X,Y]}],filter:[{filter:[``,`none`,X,Y]}],blur:[{blur:H()}],brightness:[{brightness:[Tb,X,Y]}],contrast:[{contrast:[Tb,X,Y]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Jb,Hb]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Tb,X,Y]}],"hue-rotate":[{"hue-rotate":[Tb,X,Y]}],invert:[{invert:[``,Tb,X,Y]}],saturate:[{saturate:[Tb,X,Y]}],sepia:[{sepia:[``,Tb,X,Y]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,X,Y]}],"backdrop-blur":[{"backdrop-blur":H()}],"backdrop-brightness":[{"backdrop-brightness":[Tb,X,Y]}],"backdrop-contrast":[{"backdrop-contrast":[Tb,X,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Tb,X,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Tb,X,Y]}],"backdrop-invert":[{"backdrop-invert":[``,Tb,X,Y]}],"backdrop-opacity":[{"backdrop-opacity":[Tb,X,Y]}],"backdrop-saturate":[{"backdrop-saturate":[Tb,X,Y]}],"backdrop-sepia":[{"backdrop-sepia":[``,Tb,X,Y]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,X,Y]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Tb,`initial`,X,Y]}],ease:[{ease:[`linear`,`initial`,_,X,Y]}],delay:[{delay:[Tb,X,Y]}],animate:[{animate:[`none`,v,X,Y]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,X,Y]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ie()}],"rotate-x":[{"rotate-x":ie()}],"rotate-y":[{"rotate-y":ie()}],"rotate-z":[{"rotate-z":ie()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":[`scale-3d`],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[X,Y,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,X,Y]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,X,Y]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Tb,Ub,Ib,Lb]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function sx(...e){return ox(Ny(e))}function cx(){return typeof window<`u`}function lx(e){return fx(e)?(e.nodeName||``).toLowerCase():`#document`}function ux(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function dx(e){return((fx(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function fx(e){return cx()?e instanceof Node||e instanceof ux(e).Node:!1}function px(e){return cx()?e instanceof Element||e instanceof ux(e).Element:!1}function mx(e){return cx()?e instanceof HTMLElement||e instanceof ux(e).HTMLElement:!1}function hx(e){return!cx()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof ux(e).ShadowRoot}function gx(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Dx(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function _x(e){return/^(table|td|th)$/.test(lx(e))}function vx(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var yx=/transform|translate|scale|rotate|perspective|filter/,bx=/paint|layout|strict|content/,xx=e=>!!e&&e!==`none`,Sx;function Cx(e){let t=px(e)?Dx(e):e;return xx(t.transform)||xx(t.translate)||xx(t.scale)||xx(t.rotate)||xx(t.perspective)||!Tx()&&(xx(t.backdropFilter)||xx(t.filter))||yx.test(t.willChange||``)||bx.test(t.contain||``)}function wx(e){let t=kx(e);for(;mx(t)&&!Ex(t);){if(Cx(t))return t;if(vx(t))return null;t=kx(t)}return null}function Tx(){return Sx??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Sx}function Ex(e){return/^(html|body|#document)$/.test(lx(e))}function Dx(e){return ux(e).getComputedStyle(e)}function Ox(e){return px(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function kx(e){if(lx(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||hx(e)&&e.host||dx(e);return hx(t)?t.host:t}function Ax(e){let t=kx(e);return Ex(t)?e.ownerDocument?e.ownerDocument.body:e.body:mx(t)&&gx(t)?t:Ax(t)}function jx(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ax(e),i=r===e.ownerDocument?.body,a=ux(r);if(i){let e=Mx(a);return t.concat(a,a.visualViewport||[],gx(r)?r:[],e&&n?jx(e):[])}else return t.concat(r,jx(r,[],n))}function Mx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Nx={};function Px(e,t){let n=b.useRef(Nx);return n.current===Nx&&(n.current=e(t)),n}var Fx=b[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Ix=Fx&&Fx!==b.useLayoutEffect?Fx:e=>e();function Z(e){let t=Px(Lx).current;return t.next=e,Ix(t.effect),t.trampoline}function Lx(){let e={next:void 0,callback:Rx,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function Rx(){}var zx={...b},Q=typeof document<`u`?b.useLayoutEffect:()=>{};function Bx(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var Vx={};function Hx(e,t,n,r,i){if(!n&&!r&&!i&&!e)return Wx(t);let a=Wx(e);return t&&(a=Gx(a,t)),n&&(a=Gx(a,n)),r&&(a=Gx(a,r)),i&&(a=Gx(a,i)),a}function Ux(e){if(e.length===0)return Vx;if(e.length===1)return Wx(e[0]);let t=Wx(e[0]);for(let n=1;n<e.length;n+=1)t=Gx(t,e[n]);return t}function Wx(e){return Yx(e)?{...Xx(e,Vx)}:Kx(e)}function Gx(e,t){return Yx(t)?Xx(t,e):qx(e,t)}function Kx(e){let t={...e};for(let e in t){let n=t[e];Jx(e,n)&&(t[e]=Qx(n))}return t}function qx(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Bx(e.style,r);break;case`className`:e[n]=eS(e.className,r);break;default:Jx(n,r)?e[n]=Zx(e[n],r):e[n]=r}}return e}function Jx(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function Yx(e){return typeof e==`function`}function Xx(e,t){return Yx(e)?e(t):e??Vx}function Zx(e,t){return t?e?(...n)=>{let r=n[0];if(tS(r)){let i=r;$x(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:Qx(t):e}function Qx(e){return e&&((...t)=>{let n=t[0];return tS(n)&&$x(n),e(...t)})}function $x(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function eS(e,t){return t?e?t+` `+e:t:e}function tS(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function nS(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var rS=nS(`https://base-ui.com/production-error`,`Base UI`),iS=b.createContext(void 0);function aS(e=!1){let t=b.useContext(iS);if(t===void 0&&!e)throw Error(rS(16));return t}function oS(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:b.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function sS(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=b.useRef(null),s=aS(!0),c=a??s!==void 0,{props:l}=oS({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=b.useCallback(()=>{let e=o.current;cS(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Q(u,[u]),{getButtonProps:b.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return Hx({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||($x(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=cS(a),l=!i&&lS(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if($x(e),a?.(e),e.target===e.currentTarget&&i&&c&&cS(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Z(e=>{o.current=e,u()})}}function cS(e){return mx(e)&&e.tagName===`BUTTON`}function lS(e){return!!(e?.tagName===`A`&&e?.href)}function uS(e,t,n,r){let i=Px(fS).current;return pS(i,e,t,n,r)&&hS(i,[e,t,n,r]),i.callback}function dS(e){let t=Px(fS).current;return mS(t,e)&&hS(t,e),t.callback}function fS(){return{callback:null,cleanup:null,refs:[]}}function pS(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function mS(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function hS(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var gS=19;function _S(e){return gS>=e}function vS(e){if(!b.isValidElement(e))return null;let t=e,n=t.props;return(_S(19)?n?.ref:t.ref)??null}function yS(){}var bS=Object.freeze([]),xS=Object.freeze({});function SS(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function CS(e,t){return typeof e==`function`?e(t):e}function wS(e,t){return typeof e==`function`?e(t):e}function TS(e,t,n={}){let r=t.render,i=ES(t,n);return n.enabled===!1?null:kS(e,r,i,n.state??xS)}function ES(e,t={}){let{className:n,style:r,render:i}=e,{state:a=xS,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?CS(n,a):void 0,d=l?wS(r,a):void 0,f=l?SS(a,c):xS,p=l&&s?DS(s):void 0,m=l?Bx(f,p)??{}:xS;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=dS([m.ref,vS(i),...o]):m.ref=uS(m.ref,vS(i),o):uS(null,null)),l?(u!==void 0&&(m.className=eS(m.className,u)),d!==void 0&&(m.style=Bx(m.style,d)),m):xS}function DS(e){return Array.isArray(e)?Ux(e):Hx(void 0,e)}var OS=Symbol.for(`react.lazy`);function kS(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Hx(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===OS&&(i=b.Children.toArray(t)[0]),b.cloneElement(i,e)}if(e&&typeof e==`string`)return AS(e,n);throw Error(rS(8))}function AS(e,t){return e===`button`?(0,b.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,b.createElement)(`img`,{alt:``,...t,key:t.key}):b.createElement(e,t)}var jS=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=sS({disabled:i,focusableWhenDisabled:a,native:o});return TS(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),MS=Iy(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5`,lg:`h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function NS({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,y.jsx)(jS,{"data-slot":`button`,className:sx(MS({variant:t,size:n,className:e})),...r})}var PS=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),FS={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},IS={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},LS={disabled:!1,...IS},RS={valid(e){return e===null?null:e?{[PS.valid]:``}:{[PS.invalid]:``}}},zS=b.createContext({invalid:void 0,name:void 0,validityData:{state:FS,errors:[],error:``,value:``,initialValue:null},setValidityData:yS,disabled:void 0,touched:IS.touched,setTouched:yS,dirty:IS.dirty,setDirty:yS,filled:IS.filled,setFilled:yS,focused:IS.focused,setFocused:yS,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:LS,markedDirtyRef:{current:!1},registerFieldControl:yS,validation:{getValidationProps:(e=xS)=>e,getInputValidationProps:(e=xS)=>e,inputRef:{current:null},commit:async()=>{}}});function BS(e=!0){let t=b.useContext(zS);if(t.setValidityData===yS&&!e)throw Error(rS(28));return t}var VS=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:yS,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function HS(){return b.useContext(VS)}var US=0;function WS(e,t=`mui`){let[n,r]=b.useState(e),i=e||n;return b.useEffect(()=>{n??(US+=1,r(`${t}-${US}`))},[n,t]),i}var GS=zx.useId;function KS(e,t){if(GS!==void 0){let n=GS();return e??(t?`${t}-${n}`:n)}return WS(e,t)}function qS(e){return KS(e,`base-ui`)}var JS=b.createContext({controlId:void 0,registerControlId:yS,labelId:void 0,setLabelId:yS,messageIds:[],setMessageIds:yS,getDescriptionProps:e=>e});function YS(){return b.useContext(JS)}function XS(e,t,n,r=!0,i){let[a,o]=b.useState(),s=qS(i?`${i}-label`:void 0),c=e??t??a;return Q(()=>{let i=e||t||!r?void 0:ZS(n.current,s);a!==i&&o(i)}),c}function ZS(e,t){let n=QS(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function QS(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function $S(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=YS(),o=qS(t),s=n?i:void 0,c=Px(()=>Symbol(`labelable-control`)),l=b.useRef(!1),u=b.useRef(t!=null),d=Z(()=>{!l.current||a===yS||(l.current=!1,a(c.current,void 0))});return Q(()=>{if(a===yS)return;let e;if(n){let n=r?.current;e=px(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),b.useEffect(()=>d,[d]),i??o}function eC(e){return e?.ownerDocument||document}var tC=typeof navigator<`u`,nC=dC(),rC=pC(),iC=fC(),aC=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),oC=nC.platform===`MacIntel`&&nC.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(nC.platform);tC&&/firefox/i.test(iC);var sC=tC&&/apple/i.test(navigator.vendor);tC&&/Edg/i.test(iC);var cC=tC&&/android/i.test(rC)||/android/i.test(iC),lC=tC&&rC.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,uC=iC.includes(`jsdom/`);function dC(){if(!tC)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function fC(){if(!tC)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function pC(){if(!tC)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}var mC=`data-base-ui-focusable`,hC=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,gC=`ArrowLeft`,_C=`ArrowRight`,vC=`ArrowUp`,yC=`ArrowDown`;function bC(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function xC(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&hx(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function SC(e){return`composedPath`in e?e.composedPath()[0]:e.target}function CC(e,t){if(!px(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(xC(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function wC(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function TC(e){return e.matches(`html,body`)}function EC(e){return mx(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function DC(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${hC}`)!=null}function OC(e){return e?e.getAttribute(`role`)===`combobox`&&EC(e):!1}function kC(e){if(!e||uC)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function AC(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function jC(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...jC(e,t.id,n)])}function MC(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function NC(e){e.preventDefault(),e.stopPropagation()}function PC(e){return`nativeEvent`in e}function FC(e){return e.pointerType===``&&e.isTrusted?!0:cC&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function IC(e){return uC?!1:!cC&&e.width===0&&e.height===0||cC&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function LC(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function RC(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var zC=[`top`,`right`,`bottom`,`left`],BC=Math.min,VC=Math.max,HC=Math.round,UC=Math.floor,WC=e=>({x:e,y:e}),GC={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function KC(e,t,n){return VC(e,BC(t,n))}function qC(e,t){return typeof e==`function`?e(t):e}function JC(e){return e.split(`-`)[0]}function YC(e){return e.split(`-`)[1]}function XC(e){return e===`x`?`y`:`x`}function ZC(e){return e===`y`?`height`:`width`}function QC(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function $C(e){return XC(QC(e))}function ew(e,t,n){n===void 0&&(n=!1);let r=YC(e),i=$C(e),a=ZC(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=lw(o)),[o,lw(o)]}function tw(e){let t=lw(e);return[nw(e),t,nw(t)]}function nw(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var rw=[`left`,`right`],iw=[`right`,`left`],aw=[`top`,`bottom`],ow=[`bottom`,`top`];function sw(e,t,n){switch(e){case`top`:case`bottom`:return n?t?iw:rw:t?rw:iw;case`left`:case`right`:return t?aw:ow;default:return[]}}function cw(e,t,n,r){let i=YC(e),a=sw(JC(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(nw)))),a}function lw(e){let t=JC(e);return GC[t]+e.slice(t.length)}function uw(e){return{top:0,right:0,bottom:0,left:0,...e}}function dw(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:uw(e)}function fw(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function pw(e,t,n){return Math.floor(e/t)!==n}function mw(e,t){return t<0||t>=e.length}function hw(e,t){return _w(e.current,{disabledIndices:t})}function gw(e,t){return _w(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function _w(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Sw(e,a,r));return a}function vw(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!Sw(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=UC(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!Sw(e,r,s))return r}};d&&NC(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=_w(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=_w(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}mw(e,f)&&(f=u)}if(n===`both`){let n=UC(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&NC(t),u%o===o-1?r&&(f=_w(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=_w(e,{startingIndex:u,disabledIndices:s}),r&&pw(f,o,n)&&(f=_w(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),pw(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&NC(t),u%o===0?r&&(f=_w(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=_w(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&pw(f,o,n)&&(f=_w(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),pw(f,o,n)&&(f=u));let c=UC(l/o)===n;mw(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:_w(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function yw(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function bw(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function xw(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function Sw(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?ww(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function Cw(e){return e.visibility===`hidden`||e.visibility===`collapse`}function ww(e,t=e?Dx(e):null){return!e||!e.isConnected||!t||Cw(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Tw=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Ew(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return hx(n)?n.host:null}function Dw(e){for(let t of Array.from(e.children))if(lx(t)===`summary`)return t;return null}function Ow(e,t){let n=Dw(t);return!!n&&(e===n||xC(n,e))}function kw(e){let t=e?lx(e):``;return e!=null&&e.matches(Tw)&&(t!==`summary`||e.parentElement!=null&&lx(e.parentElement)===`details`&&Dw(e.parentElement)===e)&&(t!==`details`||Dw(e)==null)&&(t!==`input`||e.type!==`hidden`)}function Aw(e){if(!kw(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Ew(t)){let n=t!==e,r=lx(t)===`slot`;if(t.hasAttribute(`inert`)||n&&lx(t)===`details`&&!t.open&&!Ow(e,t)||t.hasAttribute(`hidden`)||!r&&!jw(t,n))return!1}return!0}function jw(e,t){let n=Dx(e);return t?n.display!==`none`:ww(e,n)}function Mw(e){let t=e.tabIndex;if(t<0){let t=lx(e);if(t===`details`||t===`audio`||t===`video`||mx(e)&&e.isContentEditable)return 0}return t}function Nw(e){if(lx(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Pw(e,t){let n=Nw(e);if(!n)return!0;let r=t.find(e=>{let t=Nw(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Nw(e);return t?.name===n.name&&t.form===n.form})===n}function Fw(e){if(mx(e)&&lx(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return mx(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Iw(e,t){Fw(e).forEach(e=>{kw(e)&&t.push(e),Iw(e,t)})}function Lw(e,t,n){Fw(e).forEach(e=>{mx(e)&&e.matches(t)&&n.push(e),Lw(e,t,n)})}function Rw(e){return Aw(e)&&Mw(e)>=0}function zw(e){let t=[];return Iw(e,t),t.filter(Aw)}function Bw(e){let t=zw(e);return t.filter(e=>Mw(e)>=0&&Pw(e,t))}function Vw(e,t){let n=Bw(e),r=n.length;if(r===0)return;let i=bC(eC(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Hw(e){return Vw(eC(e).body,1)||e}function Uw(e){return Vw(eC(e).body,-1)||e}function Ww(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!xC(n,r)}function Gw(e){Bw(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Kw(e){let t=[];Lw(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var qw=[];function Jw(e){b.useEffect(e,qw)}var Yw=0,Xw=class e{static create(){return new e}currentId=Yw;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Yw,t()},e)}isStarted(){return this.currentId!==Yw}clear=()=>{this.currentId!==Yw&&(clearTimeout(this.currentId),this.currentId=Yw)};disposeEffect=()=>this.clear};function Zw(){let e=Px(Xw.create).current;return Jw(e.disposeEffect),e}var Qw=null;globalThis.requestAnimationFrame;var $w=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},eT=class e{static create(){return new e}static request(e){return $w.request(e)}static cancel(e){return $w.cancel(e)}currentId=Qw;request(e){this.cancel(),this.currentId=$w.request(()=>{this.currentId=Qw,e()})}cancel=()=>{this.currentId!==Qw&&($w.cancel(this.currentId),this.currentId=Qw)};disposeEffect=()=>this.cancel};function tT(){let e=Px(eT.create).current;return Jw(e.disposeEffect),e}function nT(e){return e==null?e:`current`in e?e.current:e}var rT=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),iT={[rT.startingStyle]:``},aT={[rT.endingStyle]:``},oT={transitionStatus(e){return e===`starting`?iT:e===`ending`?aT:null}},sT=c(g());function cT(e,t=!1,n=!0){let r=tT();return Z((i,a=null)=>{r.cancel();let o=nT(e);if(o==null)return;let s=o,c=()=>{sT.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=rT.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function lT(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=Z(i),o=cT(r,n,!1);b.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}function uT(e,t=!1,n=!1){let[r,i]=b.useState(e&&t?`idle`:void 0),[a,o]=b.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),Q(()=>{if(!e&&a&&r!==`ending`&&n){let e=eT.request(()=>{i(`ending`)});return()=>{eT.cancel(e)}}},[e,a,r,n]),Q(()=>{if(!e||t)return;let n=eT.request(()=>{i(void 0)});return()=>{eT.cancel(n)}},[t,e]),Q(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=eT.request(()=>{i(`idle`)});return()=>{eT.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function dT({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=b.useRef(e!==void 0),[a,o]=b.useState(t);return[i?e:a,b.useCallback(e=>{i||o(e)},[])]}function fT(e,t){let{enabled:n=!0,getValue:r,id:i,value:a}=t,{registerFieldControl:o}=BS(),s=b.useRef(null);s.current||=Symbol(),Q(()=>{let t=s.current;if(!(!t||!n))return o(t,{controlRef:e,getValue:r,id:i,value:a}),()=>{o(t,void 0)}},[e,n,r,i,o,a])}var pT=`none`,mT=`trigger-press`,hT=`trigger-hover`,gT=`trigger-focus`,_T=`outside-press`,vT=`item-press`,yT=`close-press`,bT=`focus-out`,xT=`escape-key`,ST=`list-navigation`,CT=`cancel-open`,wT=`disabled`,TT=`imperative-action`,ET=`window-resize`;function DT(e,t,n,r){let i=!1,a=!1,o=r??xS;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var OT=b.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:x,validationMode:S,validation:C}=BS(),w=h||s,T=m??a,E={...p,disabled:w},{labelId:D}=YS(),O=$S({id:i});Q(()=>{let e=o!=null;C.inputRef.current?.value||e&&o!==``?x(!0):e&&o===``&&x(!1)},[C.inputRef,x,o]);let k=b.useRef(null);Q(()=>{u&&k.current===bC(eC(k.current))&&y(!0)},[u,y]);let[A]=dT({controlled:o,default:l,name:`FieldControl`,state:`value`}),j=o!==void 0,M=j?A:void 0,N=Z(()=>C.inputRef.current?.value);return fT(C.inputRef,{id:O,value:M,getValue:N}),TS(`input`,e,{ref:[t,k],state:E,props:[{id:O,disabled:w,name:T,ref:C.inputRef,"aria-labelledby":D,autoFocus:u,...j?{value:M}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,DT(pT,e.nativeEvent)),_(t!==v.initialValue),x(t!==``)},onFocus(){y(!0)},onBlur(e){g(!0),y(!1),S===`onBlur`&&C.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(g(!0),C.commit(e.currentTarget.value))}},C.getInputValidationProps(),f],stateAttributesMapping:RS})}),kT=b.forwardRef(function(e,t){return(0,y.jsx)(OT,{ref:t,...e})});function AT({className:e,type:t,...n}){return(0,y.jsx)(kT,{type:t,"data-slot":`input`,className:sx(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function jT({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:sx(`group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var MT=Iy(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function NT({className:e,align:t=`inline-start`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:sx(MT({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var PT=Iy(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function FT({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,y.jsx)(NS,{type:t,"data-size":r,variant:n,className:sx(PT({size:r}),e),...i})}function IT({className:e,...t}){return(0,y.jsx)(`span`,{className:sx(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function LT({className:e,...t}){return(0,y.jsx)(AT,{"data-slot":`input-group-control`,className:sx(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}var RT=({searchInputRef:e,searchQuery:t,searchResults:n,onSearchChange:r,onKeyDown:i,onFindNext:a,onFindPrevious:o})=>{let s=n.resultCount===0?`0/0`:`${n.resultIndex+1}/${n.resultCount}`;return(0,y.jsxs)(jT,{role:`search`,"aria-label":`find in terminal`,className:`absolute top-2 right-3 z-10 w-[min(20rem,calc(100vw-1.5rem))] border-border/60 bg-background/70 text-muted-foreground shadow-xs backdrop-blur-md dark:bg-background/70`,children:[(0,y.jsx)(LT,{ref:e,type:`search`,value:t,onChange:r,onKeyDown:i,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(NT,{align:`inline-end`,children:[(0,y.jsx)(IT,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:s}),(0,y.jsx)(FT,{size:`icon-xs`,onClick:o,disabled:n.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(Cy,{})}),(0,y.jsx)(FT,{size:`icon-xs`,onClick:a,disabled:n.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(Sy,{})})]})]})};function zT(e){let t=b.useRef(!0);t.current&&(t.current=!1,e())}function BT(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var VT={},HT={},UT=``;function WT(e){if(typeof document>`u`)return!1;let t=eC(e);return ux(t).innerWidth-t.documentElement.clientWidth>0}function GT(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=eC(e),n=t.documentElement,r=t.body,i=gx(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function KT(e){let t=eC(e),n=t.documentElement,r=t.body,i=gx(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function qT(e){let t=eC(e),n=t.documentElement,r=t.body,i=ux(n),a=0,o=0,s=!1,c=eT.create();if(aC&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,VT={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},UT=n.style.scrollBehavior,HT={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=gx(n)?n:r;if(s=GT(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,VT),Object.assign(r.style,HT),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=UT)}function d(){u(),c.request(l)}l();let f=BT(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var JT=new class{lockCount=0;restore=null;timeoutLock=Xw.create();timeoutUnlock=Xw.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=eC(e).documentElement,n=ux(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=yS;return}let r=oC||!WT(e);this.restore=r?KT(e):qT(e)}};function YT(e=!0,t=null){Q(()=>{if(e)return JT.acquire(t)},[e,t])}function XT(e,t){return t!=null&&!LC(t)?0:typeof e==`function`?e():e}function ZT(e,t,n){let r=XT(e,n);return typeof r==`number`?r:r?.[t]}function QT(e){return typeof e==`function`?e():e}function $T(e,t){return t||e===`click`||e===`mousedown`}var eE=b.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Xw,currentIdRef:{current:null},currentContextRef:{current:null}});function tE(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=b.useRef(n),a=b.useRef(n),o=b.useRef(null),s=b.useRef(null),c=Zw();return(0,y.jsx)(eE.Provider,{value:b.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function nE(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{open:i}=t,{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=b.useContext(eE),[f,p]=b.useState(!1);return Q(()=>{function e(){p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current}if(a.current&&!i&&a.current===r){if(p(!1),s){let t=r;return d.start(s,()=>{n.select(`open`)||a.current&&a.current!==t||e()}),()=>{d.clear()}}e()}},[i,r,a,o,s,c,l,d,n]),Q(()=>{if(!i)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:n.setOpen,setIsInstantPhase:p},a.current=r,o.current={open:0,close:ZT(c.current,`close`)},t!==null&&t!==r?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,DT(pT))):(p(!1),e?.setIsInstantPhase(!1))},[i,r,n,a,o,s,c,l,d]),Q(()=>()=>{l.current=null},[l]),b.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function rE(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function iE(e){let t=Px(aE,e).current;return t.next=e,Q(t.effect),t}function aE(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var oE={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},sE={...oE,position:`fixed`,top:0,left:0},cE={...oE,position:`absolute`},lE=b.forwardRef(function(e,t){let[n,r]=b.useState();Q(()=>{sC&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,y.jsx)(`span`,{...e,ref:t,style:sE,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})});function uE(e){return`data-base-ui-${e}`}var dE=0;function fE(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(dE);let a=()=>e?.focus({preventScroll:n});if(i)return a(),yS;let o=requestAnimationFrame(a);return dE=o,()=>{dE===o&&(cancelAnimationFrame(o),dE=0)}}var pE={inert:new WeakMap,"aria-hidden":new WeakMap},mE=`data-base-ui-inert`,hE={inert:new WeakSet,"aria-hidden":new WeakSet},gE=new WeakMap,_E=0;function vE(e){return hE[e]}function yE(e){return e?hx(e)?e.host:yE(e.parentNode):null}var bE=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=yE(t);return e.contains(n)?n:null}).filter(e=>e!=null),xE=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},SE=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{lx(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function CE(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=bE(t,e),u=i?bE(t,a):[],d=new Set(u),f=i?SE(t,xE(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=pE[o],n=vE(o);c=n,s=e;let r=bE(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);SE(t,xE(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(gE.get(e)||0)+1;gE.set(e,t),m.push(e),t===1&&e.setAttribute(mE,``)}),_E+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(gE.get(e)||0)-1;gE.set(e,t),t||e.removeAttribute(mE)}),--_E,_E||(pE.inert=new WeakMap,pE[`aria-hidden`]=new WeakMap,hE.inert=new WeakSet,hE[`aria-hidden`]=new WeakSet,gE=new WeakMap)}}function wE(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=eC(e[0]).body;return CE(e,o,n,r,{mark:i,markerIgnoreElements:a})}var TE={style:{transition:`none`}},EE=`data-base-ui-click-trigger`,DE={fallbackAxisSide:`none`},OE={fallbackAxisSide:`end`},kE={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},AE=b.createContext(null),jE=()=>b.useContext(AE),ME=uE(`portal`);function NE(e={}){let{ref:t,container:n,componentProps:r=xS,elementProps:i}=e,a=KS(),o=jE()?.portalNode,[s,c]=b.useState(null),[l,u]=b.useState(null),d=Z(e=>{e!==null&&u(e)}),f=b.useRef(null);Q(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(fx(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=TS(`div`,r,{ref:[t,d],props:[{id:a,[ME]:``},i]});return{portalNode:l,portalSubtree:s&&p?sT.createPortal(p,s):null}}var PE=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,style:s,...c}=e,{portalNode:l,portalSubtree:u}=NE({container:r,ref:t,componentProps:e,elementProps:c}),d=b.useRef(null),f=b.useRef(null),p=b.useRef(null),m=b.useRef(null),[h,g]=b.useState(null),_=b.useRef(!1),v=h?.modal,x=h?.open,S=typeof o==`boolean`?o:!!h&&!h.modal&&h.open&&!!l;b.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&Ww(e)&&(e.type===`focusin`?_.current&&=(Kw(l),!1):(Gw(l),_.current=!0))}return rE(BT(l,`focusin`,e,!0),BT(l,`focusout`,e,!0))},[l,v]),b.useEffect(()=>{!l||x!==!1||(Kw(l),_.current=!1)},[x,l]);let C=b.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,y.jsxs)(b.Fragment,{children:[u,(0,y.jsxs)(AE.Provider,{value:C,children:[S&&l&&(0,y.jsx)(lE,{"data-type":`outside`,ref:d,onFocus:e=>{Ww(e,l)?p.current?.focus():Uw(h?h.domReference:null)?.focus()}}),S&&l&&(0,y.jsx)(`span`,{"aria-owns":l.id,style:kE}),l&&sT.createPortal(n,l),S&&l&&(0,y.jsx)(lE,{"data-type":`outside`,ref:f,onFocus:e=>{Ww(e,l)?m.current?.focus():(Hw(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,DT(`focus-out`,e.nativeEvent)))}})]})]})});function FE(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var IE=b.createContext(null),LE=b.createContext(null),RE=()=>b.useContext(IE)?.id||null,zE=e=>{let t=b.useContext(LE);return e??t};function BE(e,t){let n=ux(SC(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var VE=20,HE=[];function UE(){HE=HE.filter(e=>e.deref()?.isConnected)}function WE(e){UE(),e&&lx(e)!==`body`&&(HE.push(new WeakRef(e)),HE.length>VE&&(HE=HE.slice(-VE)))}function GE(){return UE(),HE[HE.length-1]?.deref()}function KE(e){return e?Rw(e)?e:Bw(e)[0]||e:null}function qE(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=zw(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return Rw(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function JE(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:x,dataRef:S}=h.context,C=Z(()=>S.current.floatingContext?.nodeId),w=i===!1,T=OC(_)&&w,E=b.useRef([`content`]),D=iE(i),O=iE(a),k=iE(l),A=zE(p),j=jE(),M=b.useRef(!1),N=b.useRef(!1),P=b.useRef(!1),F=b.useRef(null),I=b.useRef(``),L=b.useRef(``),ee=b.useRef(null),R=b.useRef(null),te=uS(ee,f,j?.beforeInsideRef),z=uS(R,j?.afterInsideRef),B=Zw(),V=Zw(),ne=tT(),re=j!=null,H=AC(v),ie=Z((e=H)=>e?Bw(e):[]),ae=Z(()=>m?.().filter(e=>e!=null)??[]);b.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&xC(H,bC(eC(H)))&&ie().length===0&&!T&&NC(e)}return BT(eC(H),`keydown`,e)},[r,_,H,s,E,T,ie]),b.useEffect(()=>{if(r||!g)return;let e=eC(H);function t(){P.current=!1}function n(e){let t=SC(e),n=ae();P.current=!(xC(v,t)||xC(_,t)||xC(j?.portalNode,t)||n.some(e=>e===t||xC(e,t))),L.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(N.current=!0)}function i(){L.current=`keyboard`}return rE(BT(e,`pointerdown`,n,!0),BT(e,`pointerup`,t,!0),BT(e,`pointercancel`,t,!0),BT(e,`keydown`,i,!0))},[r,v,_,H,g,j,ae]),b.useEffect(()=>{if(r||!c)return;let e=eC(H);function t(){N.current=!0,V.start(0,()=>{N.current=!1})}function n(e){let t=SC(e);Rw(t)&&(F.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=SC(t);queueMicrotask(()=>{let a=C(),c=h.context.triggerElements,l=ae(),f=n?.hasAttribute(uE(`focus-guard`))&&[ee.current,R.current,j?.beforeInsideRef.current,j?.afterInsideRef.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,nT(d),nT(u)].includes(n),p=!(xC(_,n)||xC(v,n)||xC(n,v)||xC(j?.portalNode,n)||l.some(e=>e===n||xC(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>xC(e,n))||f||A&&(jC(A.nodesRef.current,a).find(e=>xC(e.context?.elements.floating,n)||xC(e.context?.elements.domReference,n))||MC(A.nodesRef.current,a).find(e=>[e.context?.elements.floating,AC(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&H&&qE(H,E),o&&r!==_&&!ww(i)&&bC(e)===e.body){if(mx(H)&&(H.focus(),o===`popup`)){ne.request(()=>{H.focus()});return}let e=ie(),t=F.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||H;mx(n)&&n.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(T||!s)&&n&&p&&!N.current&&(T||n!==GE())&&(M.current=!0,h.setOpen(!1,DT(bT,t)))})}function a(){P.current||(S.current.insideReactTree=!0,B.start(0,()=>{S.current.insideReactTree=!1}))}let l=mx(_)?_:null;if(!(!v&&!l))return rE(l&&BT(l,`focusout`,i),l&&BT(l,`pointerdown`,t),v&&BT(v,`focusin`,n),v&&BT(v,`focusout`,i),v&&j&&BT(v,`focusout`,a,!0))},[r,_,v,H,s,A,j,h,c,o,ie,T,C,E,S,B,V,ne,u,d,ae]),b.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(j?.portalNode?.querySelectorAll(`[${uE(`portal`)}]`)||[]),t=(A?MC(A.nodesRef.current,C()):[]).find(e=>OC(e.context?.elements.domReference||null))?.context?.elements.domReference,n=wE([...[v,...e,ee.current,R.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,...ae()],t,nT(d),nT(u),T?_:null].filter(e=>e!=null),{ariaHidden:s||T,mark:!1}),i=wE([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,E,j,T,A,C,u,d,ae]),Q(()=>{if(!g||r||!mx(H))return;let e=bC(eC(H));queueMicrotask(()=>{let t=D.current,n=typeof t==`function`?t(k.current||``):t;if(n===void 0||n===!1||xC(H,e))return;let r=null,i=()=>(r??=ie(H),r[0]||H),a;a=n===!0||n===null?i():nT(n),a||=i(),fE(a,{preventScroll:a===H})})},[r,g,H,w,ie,D,k]),Q(()=>{if(r||!H)return;let e=eC(H);WE(bC(e));function t(e){if(e.open||(I.current=BE(e.nativeEvent,L.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(M.current=!0),e.reason===`outside-press`)if(e.nested)M.current=!1;else if(FC(e.nativeEvent)||IC(e.nativeEvent))M.current=!1;else{let e=!1;eC(H).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?M.current=!1:M.current=!0}}x.on(`openchange`,t);function n(){let e=O.current,t=typeof e==`function`?e(I.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=_||GE();return e&&e.isConnected?e:null}let n=_||GE();return nT(t)||n||null}return()=>{x.off(`openchange`,t);let r=bC(e),i=ae(),a=xC(v,r)||i.some(e=>e===r||xC(e,r))||A&&jC(A.nodesRef.current,C(),!1).some(e=>xC(e.context?.elements.floating,r)),o=O.current,s=n();queueMicrotask(()=>{let t=KE(s),n=typeof o!=`boolean`;o&&!M.current&&mx(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),M.current=!1})}},[r,v,H,O,S,x,A,_,C,ae]),Q(()=>{if(!aC||g||!v)return;let e=bC(eC(v));!mx(e)||!EC(e)||xC(v,e)&&e.blur()},[g,v]),Q(()=>{if(!(r||!j))return j.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{j.setFocusManagerState(null)}},[r,j,s,g,h,c,_]),Q(()=>{if(!(r||!H))return qE(H,E),()=>{queueMicrotask(UE)}},[r,H,E]);let oe=!r&&(s?!T:!0)&&(re||s);return(0,y.jsxs)(b.Fragment,{children:[oe&&(0,y.jsx)(lE,{"data-type":`inside`,ref:te,onFocus:e=>{if(s){let e=ie();fE(e[e.length-1])}else j?.portalNode&&(M.current=!1,Ww(e,j.portalNode)?Hw(_)?.focus():nT(d??j.beforeOutsideRef)?.focus())}}),n,oe&&(0,y.jsx)(lE,{"data-type":`inside`,ref:z,onFocus:e=>{s?fE(ie()[0]):j?.portalNode&&(c&&(M.current=!0),Ww(e,j.portalNode)?Uw(_)?.focus():nT(u??j.afterOutsideRef)?.focus())}})]})}function YE(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0,reason:u=mT}=t,d=b.useRef(void 0),f=tT(),p=Zw(),m=b.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){let t=d.current,i=e.nativeEvent,m=n.select(`open`);if(e.button!==0||a===`click`||LC(t,!0)&&s)return;let h=r.current.openEvent,g=h?.type,_=n.select(`domReferenceElement`)!==e.currentTarget,v=m&&_||!(m&&o&&(!(h&&c)||g===`click`||g===`mousedown`)),y=SC(i);if(EC(y)){let e=DT(u,i,y);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e);return}let b=e.currentTarget;f.request(()=>{let e=DT(u,i,b);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e)})},onClick(e){if(a===`mousedown-only`)return;let t=d.current;if(a===`mousedown`&&t){d.current=void 0;return}if(LC(t,!0)&&s)return;let i=n.select(`open`),f=r.current.openEvent,m=n.select(`domReferenceElement`)!==e.currentTarget,h=i&&m||!(i&&o&&(!(f&&c)||RC(f))),g=DT(u,e.nativeEvent,e.currentTarget);h&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,g)}):n.setOpen(h,g)},onKeyDown(){d.current=void 0}}),[r,a,s,n,c,o,f,p,l,u]);return b.useMemo(()=>i?{reference:m}:xS,[i,m])}function XE(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function ZE(e){return e!=null&&e.clientX!=null}function QE(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`}=t,l=b.useRef(!1),u=b.useRef(null),[d,f]=b.useState(),[p,m]=b.useState([]),h=Z((e,t,r)=>{l.current||o.current.openEvent&&!ZE(o.current.openEvent)||n.set(`positionReference`,XE(r??a,{x:e,y:t,axis:c,dataRef:o,pointerType:d}))}),g=Z(e=>{r?u.current||m([]):h(e.clientX,e.clientY,e.currentTarget)}),_=LC(d)?i:r,v=b.useCallback(()=>{if(!_||!s)return;let e=ux(i);function t(e){xC(i,SC(e))?(u.current?.(),u.current=null):h(e.clientX,e.clientY)}if(!o.current.openEvent||ZE(o.current.openEvent))return u.current=BT(e,`mousemove`,t),()=>{u.current?.(),u.current=null};n.set(`positionReference`,a)},[_,s,i,o,a,n,h]);b.useEffect(()=>v(),[v,p]),b.useEffect(()=>{s&&!i&&(l.current=!1)},[s,i]),b.useEffect(()=>{!s&&r&&(l.current=!0)},[s,r]);let y=b.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:g,onMouseEnter:g}},[g]);return b.useMemo(()=>s?{reference:y,trigger:y}:{},[s,y])}var $E={intentional:`onClick`,sloppy:`onPointerDown`};function eD(){return!1}function tD(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function nD(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),{dataRef:a}=n.context,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`sloppy`,referencePress:u=eD,referencePressEvent:d=`sloppy`,bubbles:f,externalTree:p}=t,m=zE(p),h=Z(typeof c==`function`?c:()=>!1),g=typeof c==`function`?h:c,_=g!==!1,v=Z(()=>l),y=b.useRef(!1),x=b.useRef(!1),S=b.useRef(!1),{escapeKey:C,outsidePress:w}=tD(f),T=b.useRef(null),E=Zw(),D=Zw(),O=Z(()=>{D.clear(),a.current.insideReactTree=!1}),k=b.useRef(!1),A=b.useRef(``),j=Z(u),M=Z(e=>{if(!r||!o||!s||e.key!==`Escape`||k.current)return;let t=a.current.floatingContext?.nodeId,i=m?jC(m.nodesRef.current,t):[];if(!C&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let c=DT(xT,PC(e)?e.nativeEvent:e);n.setOpen(!1,c),!C&&!c.isPropagationAllowed&&e.stopPropagation()}),N=Z(()=>{a.current.insideReactTree=!0,D.start(0,O)});b.useEffect(()=>{if(!r||!o)return;a.current.__escapeKeyBubbles=C,a.current.__outsidePressBubbles=w;let e=new Xw,t=new Xw;function c(){e.clear(),k.current=!0}function l(){e.start(Tx()?5:0,()=>{k.current=!1})}function u(){S.current=!0,t.start(0,()=>{S.current=!1})}function d(){y.current=!1,x.current=!1}function f(){let e=A.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function p(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=a.current.floatingContext?.nodeId,r=m&&jC(m.nodesRef.current,t).some(t=>wC(e,t.context?.elements.floating));return wC(e,n.select(`floatingElement`))||wC(e,n.select(`domReferenceElement`))||r}function b(e){if(p(e)){O();return}if(a.current.insideReactTree){O();return}let r=SC(e),i=`[${uE(`inert`)}]`,o=px(r)?r.getRootNode():null,s=Array.from((hx(o)?o:eC(n.select(`floatingElement`))).querySelectorAll(i)),c=n.context.triggerElements;if(r&&(c.hasElement(r)||c.hasMatchingElement(e=>xC(e,r))))return;let l=px(r)?r:null;for(;l&&!Ex(l);){let e=kx(l);if(Ex(e)||!px(e))break;l=e}if(s.length&&px(r)&&!TC(r)&&!xC(r,n.select(`floatingElement`))&&s.every(e=>!xC(l,e)))return;if(mx(r)&&!(`touches`in e)){let t=Ex(r),n=Dx(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}if(h(e))return;if(f()===`intentional`&&S.current){t.clear(),S.current=!1;return}if(typeof g==`function`&&!g(e))return;let u=a.current.floatingContext?.nodeId,d=m?jC(m.nodesRef.current,u):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,DT(_T,e)),O()}function D(e){f()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!o||wC(e,n.select(`floatingElement`))||wC(e,n.select(`domReferenceElement`))||b(e)}function j(e){if(f()!==`sloppy`||!n.select(`open`)||!o||wC(e,n.select(`floatingElement`))||wC(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function N(e,t){let n=SC(e);if(!n)return;let r=BT(n,e.type,()=>{t(e),r()})}function P(e){A.current=`touch`,N(e,j)}function F(e){E.clear(),e.type===`pointerdown`&&(A.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&N(e,e=>{e.type===`pointerdown`?D(e):b(e)})}function I(e){if(!y.current)return;let n=x.current;if(d(),f()===`intentional`){if(e.type===`pointercancel`){n&&u();return}if(!h(e)){if(n){u();return}typeof g==`function`&&!g(e)||(t.clear(),S.current=!0,O())}}}function L(e){if(f()!==`sloppy`||!T.current||wC(e,n.select(`floatingElement`))||wC(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-T.current.startX),i=Math.abs(t.clientY-T.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(T.current.dismissOnTouchEnd=!0),a>10&&(b(e),E.clear(),T.current=null)}function ee(e){N(e,L)}function R(e){f()!==`sloppy`||!T.current||wC(e,n.select(`floatingElement`))||wC(e,n.select(`domReferenceElement`))||(T.current.dismissOnTouchEnd&&b(e),E.clear(),T.current=null)}function te(e){N(e,R)}let z=eC(i),B=rE(s&&rE(BT(z,`keydown`,M),BT(z,`compositionstart`,c),BT(z,`compositionend`,l)),_&&rE(BT(z,`click`,F,!0),BT(z,`pointerdown`,F,!0),BT(z,`pointerup`,I,!0),BT(z,`pointercancel`,I,!0),BT(z,`mousedown`,F,!0),BT(z,`mouseup`,I,!0),BT(z,`touchstart`,P,!0),BT(z,`touchmove`,ee,!0),BT(z,`touchend`,te,!0)));return()=>{B(),e.clear(),t.clear(),d(),S.current=!1}},[a,i,s,_,g,r,o,C,w,M,O,v,m,n,E]),b.useEffect(O,[g,O]);let P=b.useMemo(()=>({onKeyDown:M,[$E[d]]:e=>{j()&&n.setOpen(!1,DT(mT,e.nativeEvent))},...d!==`intentional`&&{onClick(e){j()&&n.setOpen(!1,DT(`trigger-press`,e.nativeEvent))}}}),[M,n,d,j]),F=Z(e=>{if(!r||!o||e.button!==0)return;let t=SC(e.nativeEvent);xC(n.select(`floatingElement`),t)&&(y.current||(y.current=!0,x.current=!1))}),I=Z(e=>{!r||!o||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&y.current&&(x.current=!0)}),L=b.useMemo(()=>({onKeyDown:M,onPointerDown:I,onMouseDown:I,onClickCapture:N,onMouseDownCapture(e){N(),F(e)},onPointerDownCapture(e){N(),F(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,F,I]);return b.useMemo(()=>o?{reference:P,floating:L,trigger:P}:{},[o,P,L])}function rD(e,t,n){let{reference:r,floating:i}=e,a=QC(t),o=$C(t),s=ZC(o),c=JC(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(YC(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function iD(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=qC(t,e),p=dw(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=fw(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=fw(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var aD=50,oD=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:iD},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=rD(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<aD&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=rD(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},sD=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=qC(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=JC(r),_=QC(o),v=JC(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[lw(o)]:tw(o)),x=p!==`none`;!d&&x&&b.push(...cw(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ew(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==QC(t))||T.every(e=>QC(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=QC(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function cD(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function lD(e){return zC.some(t=>e[t]>=0)}var uD=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=qC(e,t);switch(i){case`referenceHidden`:{let e=cD(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:lD(e)}}}case`escaped`:{let e=cD(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:lD(e)}}}default:return{}}}}},dD=new Set([`left`,`top`]);async function fD(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=JC(n),s=YC(n),c=QC(n)===`y`,l=dD.has(o)?-1:1,u=a&&c?-1:1,d=qC(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var pD=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await fD(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},mD=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=qC(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=QC(JC(i)),p=XC(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=KC(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=KC(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},hD=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=qC(e,t),u={x:n,y:r},d=QC(i),f=XC(d),p=u[f],m=u[d],h=qC(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=dD.has(JC(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},gD=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=qC(e,t),u=await o.detectOverflow(t,l),d=JC(i),f=YC(i),p=QC(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=BC(h-u[g],v),x=BC(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=VC(u.left,0),t=VC(u.right,0),n=VC(u.top,0),r=VC(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:VC(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:VC(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function _D(e){let t=Dx(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=mx(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=HC(n)!==a||HC(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function vD(e){return px(e)?e:e.contextElement}function yD(e){let t=vD(e);if(!mx(t))return WC(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=_D(t),o=(a?HC(n.width):n.width)/r,s=(a?HC(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var bD=WC(0);function xD(e){let t=ux(e);return!Tx()||!t.visualViewport?bD:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function SD(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ux(e)?!1:t}function CD(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=vD(e),o=WC(1);t&&(r?px(r)&&(o=yD(r)):o=yD(e));let s=SD(a,n,r)?xD(a):WC(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=ux(a),t=r&&px(r)?ux(r):r,n=e,i=Mx(n);for(;i&&r&&t!==n;){let e=yD(i),t=i.getBoundingClientRect(),r=Dx(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=ux(i),i=Mx(n)}}return fw({width:u,height:d,x:c,y:l})}function wD(e,t){let n=Ox(e).scrollLeft;return t?t.left+n:CD(dx(e)).left+n}function TD(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-wD(e,n),y:n.top+t.scrollTop}}function ED(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=dx(r),s=t?vx(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=WC(1),u=WC(0),d=mx(r);if((d||!d&&!a)&&((lx(r)!==`body`||gx(o))&&(c=Ox(r)),d)){let e=CD(r);l=yD(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?TD(o,c):WC(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function DD(e){return Array.from(e.getClientRects())}function OD(e){let t=dx(e),n=Ox(e),r=e.ownerDocument.body,i=VC(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=VC(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+wD(e),s=-n.scrollTop;return Dx(r).direction===`rtl`&&(o+=VC(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var kD=25;function AD(e,t){let n=ux(e),r=dx(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Tx();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=wD(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=kD&&(a-=o)}else l<=kD&&(a+=l);return{width:a,height:o,x:s,y:c}}function jD(e,t){let n=CD(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=mx(e)?yD(e):WC(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function MD(e,t,n){let r;if(t===`viewport`)r=AD(e,n);else if(t===`document`)r=OD(dx(e));else if(px(t))r=jD(t,n);else{let n=xD(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return fw(r)}function ND(e,t){let n=kx(e);return n===t||!px(n)||Ex(n)?!1:Dx(n).position===`fixed`||ND(n,t)}function PD(e,t){let n=t.get(e);if(n)return n;let r=jx(e,[],!1).filter(e=>px(e)&&lx(e)!==`body`),i=null,a=Dx(e).position===`fixed`,o=a?kx(e):e;for(;px(o)&&!Ex(o);){let t=Dx(o),n=Cx(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||gx(o)&&!n&&ND(e,o))?r=r.filter(e=>e!==o):i=t,o=kx(o)}return t.set(e,r),r}function FD(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?vx(t)?[]:PD(t,this._c):[].concat(n),r],o=MD(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=MD(t,a[e],i);s=VC(n.top,s),c=BC(n.right,c),l=BC(n.bottom,l),u=VC(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function ID(e){let{width:t,height:n}=_D(e);return{width:t,height:n}}function LD(e,t,n){let r=mx(t),i=dx(t),a=n===`fixed`,o=CD(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=WC(0);function l(){c.x=wD(i)}if(r||!r&&!a)if((lx(t)!==`body`||gx(i))&&(s=Ox(t)),r){let e=CD(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?TD(i,s):WC(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function RD(e){return Dx(e).position===`static`}function zD(e,t){if(!mx(e)||Dx(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return dx(e)===n&&(n=n.ownerDocument.body),n}function BD(e,t){let n=ux(e);if(vx(e))return n;if(!mx(e)){let t=kx(e);for(;t&&!Ex(t);){if(px(t)&&!RD(t))return t;t=kx(t)}return n}let r=zD(e,t);for(;r&&_x(r)&&RD(r);)r=zD(r,t);return r&&Ex(r)&&RD(r)&&!Cx(r)?n:r||wx(e)||n}var VD=async function(e){let t=this.getOffsetParent||BD,n=this.getDimensions,r=await n(e.floating);return{reference:LD(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function HD(e){return Dx(e).direction===`rtl`}var UD={convertOffsetParentRelativeRectToViewportRelativeRect:ED,getDocumentElement:dx,getClippingRect:FD,getOffsetParent:BD,getElementRects:VD,getClientRects:DD,getDimensions:ID,getScale:yD,isElement:px,isRTL:HD};function WD(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function GD(e,t){let n=null,r,i=dx(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=UC(d),h=UC(i.clientWidth-(u+f)),g=UC(i.clientHeight-(d+p)),_=UC(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:VC(0,BC(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!WD(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function KD(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=vD(e),u=i||a?[...l?jx(l):[],...t?jx(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?GD(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?CD(e):null;c&&g();function g(){let t=CD(e);h&&!WD(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var qD=pD,JD=mD,YD=sD,XD=gD,ZD=uD,QD=hD,$D=(e,t,n)=>{let r=new Map,i={platform:UD,...n},a={...i.platform,_c:r};return oD(e,t,{...i,platform:a})},eO=typeof document<`u`?b.useLayoutEffect:function(){};function tO(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!tO(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!tO(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function nO(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function rO(e,t){let n=nO(e);return Math.round(t*n)/n}function iO(e){let t=b.useRef(e);return eO(()=>{t.current=e}),t}function aO(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=b.useState(r);tO(f,r)||p(r);let[m,h]=b.useState(null),[g,_]=b.useState(null),v=b.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=b.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=b.useRef(null),w=b.useRef(null),T=b.useRef(u),E=c!=null,D=iO(c),O=iO(i),k=iO(l),A=b.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),$D(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!tO(T.current,t)&&(T.current=t,sT.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);eO(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=b.useRef(!1);eO(()=>(j.current=!0,()=>{j.current=!1}),[]),eO(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=b.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=b.useMemo(()=>({reference:x,floating:S}),[x,S]),P=b.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=rO(N.floating,u.x),r=rO(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...nO(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var oO=(e,t)=>{let n=qD(e);return{name:n.name,fn:n.fn,options:[e,t]}},sO=(e,t)=>{let n=JD(e);return{name:n.name,fn:n.fn,options:[e,t]}},cO=(e,t)=>({fn:QD(e).fn,options:[e,t]}),lO=(e,t)=>{let n=YD(e);return{name:n.name,fn:n.fn,options:[e,t]}},uO=(e,t)=>{let n=XD(e);return{name:n.name,fn:n.fn,options:[e,t]}},dO=(e,t)=>{let n=ZD(e);return{name:n.name,fn:n.fn,options:[e,t]}},$=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(rS(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},fO=o((e=>{var t=f();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),pO=o(((e,t)=>{t.exports=fO()})),mO=o((e=>{var t=f(),n=pO();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),hO=o(((e,t)=>{t.exports=mO()})),gO=[],_O=void 0;function vO(){return _O}function yO(e){gO.push(e)}function bO(e){let t=(t,n)=>{let r=Px(SO).current,i;try{_O=r;for(let e of gO)e.before(r);i=e(t,n);for(let e of gO)e.after(r);r.didInitialize=!0}finally{_O=void 0}return i};return t.displayName=e.displayName||e.name,t}function xO(e){return b.forwardRef(bO(e))}function SO(){return{didInitialize:!1}}var CO=pO(),wO=hO(),TO=_S(19)?OO:kO;function EO(e,t,n,r,i){return TO(e,t,n,r,i)}function DO(e,t,n,r,i){let a=b.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,CO.useSyncExternalStore)(e.subscribe,a,a)}yO({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,CO.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function OO(e,t,n,r,i){let a=vO();if(!a)return DO(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function kO(e,t,n,r,i){return(0,wO.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var AO=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return EO(this,e,t,n,r)}},jO=class extends AO{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){b.useDebugValue(e),Q(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;Q(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Q(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){b.useDebugValue(e);let n=t!==void 0;Q(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return b.useDebugValue(e),EO(this,this.selectors[e],t,n,r)}useContextCallback(e,t){b.useDebugValue(e);let n=Z(t??yS);this.context[e]=n}useStateSetter(e){let t=b.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},MO={open:$(e=>e.open),transitionStatus:$(e=>e.transitionStatus),domReferenceElement:$(e=>e.domReferenceElement),referenceElement:$(e=>e.positionReference??e.referenceElement),floatingElement:$(e=>e.floatingElement),floatingId:$(e=>e.floatingId)},NO=class extends jO{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:FE(),nested:n,triggerElements:i},MO),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&RC(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function PO(e,t){let n=b.useRef(null),r=b.useRef(null);return b.useCallback(i=>{if(e!==void 0){if(n.current!==null){let e=n.current,i=r.current,a=t.context.triggerElements.getById(e);i&&a===i&&t.context.triggerElements.delete(e),n.current=null,r.current=null}i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i))}},[t,e])}function FO(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=PO(e,n),o=Z(t=>{if(a(t),!t||!n.select(`open`))return;let i=n.select(`activeTriggerId`);if(i===e){n.update({activeTriggerElement:t,...r});return}i??n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return Q(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function IO(e){let t=e.useState(`open`);Q(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function LO(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=uT(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=Z(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return lT({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var RO=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function zO(){return new NO({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new RO,floatingId:``,syncOnly:!1,nested:!1,onOpenChange:void 0})}function BO(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:zO(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:xS,inactiveTriggerProps:xS,popupProps:xS}}var VO=$(e=>e.triggerIdProp??e.activeTriggerId),HO={open:$(e=>e.openProp??e.open),mounted:$(e=>e.mounted),transitionStatus:$(e=>e.transitionStatus),floatingRootContext:$(e=>e.floatingRootContext),preventUnmountingOnClose:$(e=>e.preventUnmountingOnClose),payload:$(e=>e.payload),activeTriggerId:VO,activeTriggerElement:$(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:$((e,t)=>t!==void 0&&VO(e)===t),isOpenedByTrigger:$((e,t)=>t!==void 0&&VO(e)===t&&e.open),isMountedByTrigger:$((e,t)=>t!==void 0&&VO(e)===t&&e.mounted),triggerProps:$((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:$(e=>e.popupProps),popupElement:$(e=>e.popupElement),positionerElement:$(e=>e.positionerElement)};function UO(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=KS(),a=RE()!=null,o=Px(()=>new NO({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new RO,floatingId:i,syncOnly:!1,nested:a})).current;return Q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=px(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function WO(e={}){let{nodeId:t,externalTree:n}=e,r=UO(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=b.useState(null),c=b.useRef(null),l=zE(n);Q(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let u=aO({...e,elements:{...a,...o&&{reference:o}}}),d=b.useCallback(e=>{let t=px(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),u.refs.setReference(t)},[u.refs]),[f,p]=b.useState(void 0),[m,h]=b.useState(null);i.useSyncedValue(`referenceElement`,f??null);let g=px(f)?f:null;i.useSyncedValue(`domReferenceElement`,f===void 0?a.domReference:g),i.useSyncedValue(`floatingElement`,m);let _=b.useCallback(e=>{(px(e)||e===null)&&(c.current=e,p(e)),(px(u.refs.reference.current)||u.refs.reference.current===null||e!==null&&!px(e))&&u.refs.setReference(e)},[u.refs,p]),v=b.useCallback(e=>{h(e),u.refs.setFloating(e)},[u.refs]),y=b.useMemo(()=>({...u.refs,setReference:_,setFloating:v,setPositionReference:d,domReference:c}),[u.refs,_,v,d]),x=b.useMemo(()=>({...u.elements,domReference:a.domReference}),[u.elements,a.domReference]),S=i.useState(`open`),C=i.useState(`floatingId`),w=b.useMemo(()=>({...u,dataRef:i.context.dataRef,open:S,onOpenChange:i.setOpen,events:i.context.events,floatingId:C,refs:y,elements:x,nodeId:t,rootStore:i}),[u,y,x,t,i,S,C]);return Q(()=>{i.context.dataRef.current.floatingContext=w;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=w)}),b.useMemo(()=>({...u,context:w,refs:y,elements:x,rootStore:i}),[u,y,x,w,i])}function GO(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,i=KS(),a=RE()!=null,o=t.useState(`open`),s=t.useState(`activeTriggerElement`),c=t.useState(n?`popupElement`:`positionerElement`),l=t.context.triggerElements,u=Px(()=>new NO({open:o,transitionStatus:void 0,referenceElement:s,floatingElement:c,triggerElements:l,onOpenChange:r,floatingId:i,syncOnly:!0,nested:a})).current;return Q(()=>{let e={open:o,floatingId:i,referenceElement:s,floatingElement:c};px(s)&&(e.domReferenceElement=s),u.state.positionReference===u.state.referenceElement&&(e.positionReference=s),u.update(e)},[o,i,s,c,u]),u.context.onOpenChange=r,u.context.nested=a,u}var KO=lC&&sC;function qO(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,delay:o}=t,s=b.useRef(!1),c=b.useRef(null),l=Zw(),u=b.useRef(!0);b.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=ux(e);function r(){let e=n.select(`domReferenceElement`);!n.select(`open`)&&mx(e)&&e===bC(eC(e))&&(s.current=!0)}function i(){u.current=!0}function o(){u.current=!1}return rE(BT(t,`blur`,r),KO&&BT(t,`keydown`,i,!0),KO&&BT(t,`pointerdown`,o,!0))},[n,a]),b.useEffect(()=>{if(!a)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=n.select(`domReferenceElement`);px(e)&&(c.current=e,s.current=!0)}}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a,n]);let d=b.useMemo(()=>({onMouseLeave(){s.current=!1,c.current=null},onFocus(e){let t=e.currentTarget;if(s.current){if(c.current===t)return;s.current=!1,c.current=null}let r=SC(e.nativeEvent);if(px(r)){if(KO&&!e.relatedTarget){if(!u.current&&!EC(r))return}else if(!kC(r))return}let i=CC(e.relatedTarget,n.context.triggerElements),{nativeEvent:a,currentTarget:d}=e,f=typeof o==`function`?o():o;if(n.select(`open`)&&i||f===0||f===void 0){n.setOpen(!0,DT(gT,a,d));return}l.start(f,()=>{s.current||n.setOpen(!0,DT(gT,a,d))})},onBlur(e){s.current=!1,c.current=null;let t=e.relatedTarget,r=e.nativeEvent,a=px(t)&&t.hasAttribute(uE(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let e=n.select(`domReferenceElement`),o=bC(eC(e));!t&&o===e||xC(i.current.floatingContext?.refs.floating.current,o)||xC(e,o)||a||CC(t??o,n.context.triggerElements)||n.setOpen(!1,DT(gT,r))})}}),[i,n,l,o]);return b.useMemo(()=>a?{reference:d,trigger:d}:{},[a,d])}var JO=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Xw,this.restTimeout=new Xw,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},YO=new WeakMap;function XO(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&YO.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),YO.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function ZO(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=YO.get(n);a&&a!==e&&XO(a),XO(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,YO.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function QO(e){let t=Px(JO.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||=t,Jw(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function $O(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,nodeId:l}=t,u=QO(n),d=zE(),f=RE(),p=Z(()=>$T(o.current.openEvent?.type,u.interactedInside)),m=Z(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),h=Z(e=>CC(e,n.context.triggerElements)),g=b.useCallback(e=>{let t=ZT(c,`close`,u.pointerType),r=()=>{n.setOpen(!1,DT(hT,e)),d?.events.emit(`floating.closed`,e)};t?u.openChangeTimeout.start(t,r):(u.openChangeTimeout.clear(),r())},[c,n,u,d]),_=Z(()=>{XO(u)}),v=Z(e=>{let t=SC(e);if(!DC(t)){u.interactedInside=!1;return}u.interactedInside=t?.closest(`[aria-haspopup]`)!=null});Q(()=>{r||(u.pointerType=void 0,u.restTimeoutPending=!1,u.interactedInside=!1,_())},[r,u,_]),b.useEffect(()=>_,[_]),Q(()=>{if(s&&r&&u.handleCloseOptions?.blockPointerEvents&&m()&&px(a)&&i){let e=a,t=i,n=eC(i),r=d?.nodesRef.current.find(e=>e.id===f)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),ZO(u,{scopeElement:u.handleCloseOptions?.getScope?.()??u.pointerEventsScopeElement??r??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{_()}}},[s,r,a,i,u,m,d,f,_]);let y=Zw();b.useEffect(()=>{if(!s)return;function e(){u.openChangeTimeout.clear(),y.clear(),d?.events.off(`floating.closed`,r),_()}function t(e){if(d&&f&&jC(d.nodesRef.current,f).length>0){d.events.on(`floating.closed`,r);return}if(h(e.relatedTarget))return;let t=o.current.floatingContext?.nodeId??l,n=e.relatedTarget;if(!(d&&t&&px(n)&&jC(d.nodesRef.current,t,!1).some(e=>xC(e.context?.elements.floating,n)))){if(u.handler){u.handler(e);return}_(),p()||g(e)}}function r(e){!d||!f||jC(d.nodesRef.current,f).length>0||y.start(0,()=>{d.events.off(`floating.closed`,r),n.setOpen(!1,DT(hT,e)),d.events.emit(`floating.closed`,e)})}let a=i;return rE(a&&BT(a,`mouseenter`,e),a&&BT(a,`mouseleave`,t),a&&BT(a,`pointerdown`,v,!0),()=>{d?.events.off(`floating.closed`,r)})},[s,i,n,o,l,p,h,g,_,v,u,d,f,y])}var ek={current:null};function tk(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:d=ek,externalTree:f,isActiveTrigger:p=!0,getHandleCloseContext:m,isClosing:h}=t,g=zE(f),_=QO(n),v=b.useRef(!1),y=iE(s),x=iE(o),S=iE(l),C=iE(a),w=iE(h);p&&(_.handleCloseOptions=y.current?.__options);let T=Z(()=>$T(r.current.openEvent?.type,_.interactedInside)),E=Z(e=>CC(e,n.context.triggerElements)),D=Z((e,t,r)=>{let i=n.context.triggerElements;if(i.hasElement(t))return!e||!xC(e,t);if(!px(r))return!1;let a=r;return i.hasMatchingElement(e=>xC(e,a))&&(!e||!xC(e,a))}),O=Z((e,t=!0)=>{let r=ZT(x.current,`close`,_.pointerType);r?_.openChangeTimeout.start(r,()=>{n.setOpen(!1,DT(hT,e)),g?.events.emit(`floating.closed`,e)}):t&&(_.openChangeTimeout.clear(),n.setOpen(!1,DT(hT,e)),g?.events.emit(`floating.closed`,e))}),k=Z(()=>{_.handler&&=(eC(n.select(`domReferenceElement`)).removeEventListener(`mousemove`,_.handler),void 0)}),A=Z(()=>{XO(_)});return b.useEffect(()=>k,[k]),b.useEffect(()=>{if(!a)return;function e(e){e.open?v.current=!1:(v.current=e.reason===hT,k(),_.openChangeTimeout.clear(),_.restTimeout.clear(),_.blockMouseMove=!0,_.restTimeoutPending=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,_,k]),b.useEffect(()=>{if(!a)return;let e=d.current??(p?n.select(`domReferenceElement`):null);if(!px(e))return;function t(e){if(_.openChangeTimeout.clear(),_.blockMouseMove=!1,c&&!LC(_.pointerType))return;let t=QT(S.current),r=ZT(x.current,`open`,_.pointerType),i=SC(e),a=e.currentTarget??null,o=n.select(`domReferenceElement`),s=a;if(px(i)&&!n.context.triggerElements.hasElement(i)){for(let e of n.context.triggerElements.elements())if(xC(e,i)){s=e;break}}px(a)&&px(o)&&!n.context.triggerElements.hasElement(a)&&xC(a,o)&&(s=o);let l=s==null?!1:D(o,s,i),u=n.select(`open`),d=w.current?.()??n.select(`transitionStatus`)===`ending`,f=!u&&d&&v.current,p=!l&&px(s)&&px(o)&&xC(o,s)&&f,m=t>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){n.setOpen(!0,DT(hT,e,s));return}m||(r?_.openChangeTimeout.start(r,()=>{g&&n.setOpen(!0,DT(hT,e,s))}):g&&n.setOpen(!0,DT(hT,e,s)))}function i(e){if(T()){A();return}k();let t=eC(n.select(`domReferenceElement`));_.restTimeout.clear(),_.restTimeoutPending=!1;let i=r.current.floatingContext??m?.();if(!E(e.relatedTarget)){if(y.current&&i){n.select(`open`)||_.openChangeTimeout.clear();let r=d.current;_.handler=y.current({...i,tree:g,x:e.clientX,y:e.clientY,onClose(){A(),k(),C.current&&!T()&&r===n.select(`domReferenceElement`)&&O(e,!0)}}),t.addEventListener(`mousemove`,_.handler),_.handler(e);return}(_.pointerType!==`touch`||!xC(n.select(`floatingElement`),e.relatedTarget))&&O(e)}}return u?rE(BT(e,`mousemove`,t,{once:!0}),BT(e,`mouseenter`,t),BT(e,`mouseleave`,i)):rE(BT(e,`mouseenter`,t),BT(e,`mouseleave`,i))},[k,A,r,x,O,n,a,y,_,p,D,T,E,c,u,S,d,g,C,m,w]),b.useMemo(()=>{if(!a)return;function e(e){_.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.select(`open`),o=D(i,r,e.target);if(c&&!LC(_.pointerType))return;if(a&&o&&_.handleCloseOptions?.blockPointerEvents){let e=n.select(`floatingElement`);e&&ZO(_,{scopeElement:_.handleCloseOptions?.getScope?.()??r.ownerDocument.body,referenceElement:r,floatingElement:e})}let s=QT(S.current);if(a&&!o||s===0||!o&&_.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;_.restTimeout.clear();function l(){if(_.restTimeoutPending=!1,T())return;let e=n.select(`open`);!_.blockMouseMove&&(!e||o)&&n.setOpen(!0,DT(hT,t,r))}_.pointerType===`touch`?sT.flushSync(()=>{l()}):o&&a?l():(_.restTimeoutPending=!0,_.restTimeout.start(s,l))}}},[a,_,T,D,c,n,S])}function nk(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=b.useCallback(t=>rk(t,e,`reference`),t),o=b.useCallback(t=>rk(t,e,`floating`),n),s=b.useCallback(t=>rk(t,e,`item`),r),c=b.useCallback(t=>rk(t,e,`trigger`),i);return b.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function rk(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[mC]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&ik(a,s,i,r)}return ik(a,e,i,r),a}function ik(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var ak=`Escape`;function ok(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function sk(e,t){return ok(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function ck(e,t,n){return ok(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function lk(e,t,n){return ok(t,n?e===gC:e===_C,e===yC)}function uk(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===ak:ok(t,n?e===_C:e===gC,e===vC)}function dk(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:v=!0,openOnArrowKeyDown:y=!0,disabledIndices:x=void 0,orientation:S=`vertical`,parentOrientation:C,cols:w=1,id:T,resetOnPointerLeave:E=!0,externalTree:D}=t,O=iE(AC(i)),k=RE(),A=zE(D);Q(()=>{o.current.orientation=S},[o,S]);let j=OC(a),M=b.useRef(_),N=b.useRef(d??-1),P=b.useRef(null),F=b.useRef(!0),I=Z(e=>{l(N.current===-1?null:N.current,e)}),L=b.useRef(I),ee=b.useRef(!!i),R=b.useRef(r),te=b.useRef(!1),z=b.useRef(!1),B=b.useRef(null),V=iE(x),ne=iE(r),re=iE(d),H=iE(E),ie=Z(()=>{function e(e){g?A?.events.emit(`virtualfocus`,e):B.current=fE(e,{sync:te.current,preventScroll:!0})}let t=s.current[N.current],n=z.current;t&&e(t),(te.current?e=>e():requestAnimationFrame)(()=>{let r=s.current[N.current]||t;r&&(t||e(r),se&&(n||!F.current)&&r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Q(()=>{u&&(r&&i?(N.current=d??-1,M.current&&d!=null&&(z.current=!0,I())):ee.current&&(N.current=-1,L.current()))},[u,r,i,d,I]),Q(()=>{if(u){if(!r){te.current=!1;return}if(i)if(c==null){if(te.current=!1,re.current!=null)return;if(ee.current&&(N.current=-1,ie()),(!R.current||!ee.current)&&M.current&&(P.current!=null||M.current===!0&&P.current==null)){let e=0,t=()=>{s.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(N.current=P.current==null||ck(P.current,S,h)||m?hw(s):gw(s),P.current=null,I())};t()}}else mw(s.current,c)||(N.current=c,ie(),z.current=!1)}},[u,r,i,c,re,m,s,S,h,I,ie,V]),Q(()=>{if(!u||i||!A||g||!ee.current)return;let e=A.nodesRef.current,t=e.find(e=>e.id===k)?.context?.elements.floating,n=bC(eC(i)),r=e.some(e=>e.context&&xC(e.context.elements.floating,n));t&&!r&&F.current&&t.focus({preventScroll:!0})},[u,i,A,k,g]),Q(()=>{L.current=I,R.current=r,ee.current=!!i}),Q(()=>{r||(P.current=null,M.current=_)},[r,_]);let ae=c!=null,oe=Z(e=>{if(!ne.current)return;let t=s.current.indexOf(e.currentTarget);t!==-1&&(N.current!==t||c!==t)&&(N.current=t,I(e))}),se=b.useMemo(()=>({onFocus(e){te.current=!0,oe(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){te.current=!0,z.current=!1,v&&oe(e)},onPointerLeave(e){if(!ne.current||!F.current||e.pointerType===`touch`)return;te.current=!0;let t=e.relatedTarget;if(!(!v||s.current.includes(t))&&H.current&&(B.current?.(),B.current=null,N.current=-1,I(e),!g)){let e=O.current,t=bC(eC(e));e&&xC(e,t)&&e.focus({preventScroll:!0})}}}),[oe,ne,O,v,s,I,H,g]),ce=b.useCallback(()=>C??A?.nodesRef.current.find(e=>e.id===k)?.context?.dataRef?.current.orientation,[k,A,C]),le=Z(e=>{if(F.current=!1,te.current=!0,e.which===229||!ne.current&&e.currentTarget===O.current)return;if(m&&uk(e.key,S,h,w)){sk(e.key,ce())||NC(e),n.setOpen(!1,DT(ST,e.nativeEvent)),mx(a)&&(g?A?.events.emit(`virtualfocus`,a):a.focus());return}let t=N.current,i=hw(s,x),o=gw(s,x);if(j||(e.key===`Home`&&(NC(e),N.current=i,I(e)),e.key===`End`&&(NC(e),N.current=o,I(e))),w>1){let t=Array.from({length:s.current.length},()=>({width:1,height:1})),n=yw(t,w,!1),r=n.findIndex(e=>e!=null&&!Sw(s.current,e,x)),a=n.reduce((e,t,n)=>t!=null&&!Sw(s.current,t,x)?n:e,-1),c=n[vw(n.map(e=>e==null?null:s.current[e]),{event:e,orientation:S,loopFocus:p,rtl:h,cols:w,disabledIndices:xw([...(typeof x==`function`?null:x)||s.current.map((e,t)=>Sw(s.current,t,x)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:bw(N.current>o?i:N.current,t,n,w,e.key===`ArrowDown`?`bl`:e.key===(h?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(N.current=c,I(e)),S===`both`)return}if(sk(e.key,S)){if(NC(e),r&&!g&&bC(e.currentTarget.ownerDocument)===e.currentTarget){N.current=ck(e.key,S,h)?i:o,I(e);return}ck(e.key,S,h)?p?t>=o?f&&t!==s.current.length?N.current=-1:(te.current=!1,N.current=i):N.current=_w(s.current,{startingIndex:t,disabledIndices:x}):N.current=Math.min(o,_w(s.current,{startingIndex:t,disabledIndices:x})):p?t<=i?f&&t!==-1?N.current=s.current.length:(te.current=!1,N.current=o):N.current=_w(s.current,{startingIndex:t,decrement:!0,disabledIndices:x}):N.current=Math.max(i,_w(s.current,{startingIndex:t,decrement:!0,disabledIndices:x})),mw(s.current,N.current)&&(N.current=-1),I(e)}}),ue=b.useMemo(()=>g&&r&&ae&&{"aria-activedescendant":`${T}-${c}`},[g,r,ae,T,c]),de=b.useMemo(()=>({"aria-orientation":S===`both`?void 0:S,...j?{}:ue,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!g){let t=SC(e.nativeEvent);if(t&&!xC(O.current,t))return;NC(e),n.setOpen(!1,DT(bT,e.nativeEvent)),mx(a)&&a.focus();return}le(e)},onPointerMove(){F.current=!0}}),[ue,le,O,S,j,n,r,g,a]),fe=b.useMemo(()=>{function e(e){_===`auto`&&FC(e.nativeEvent)&&(M.current=!g)}function t(e){M.current=_,_===`auto`&&IC(e.nativeEvent)&&(M.current=!0)}return{onKeyDown(e){let t=n.select(`open`);F.current=!1;let r=e.key.startsWith(`Arrow`),i=lk(e.key,ce(),h),a=sk(e.key,S),o=(m?i:a)||e.key===`Enter`||e.key.trim()===``;if(g&&t)return le(e);if(!(!t&&!y&&r)){if(o){let t=sk(e.key,ce());P.current=m&&t?null:e.key}if(m){i&&(NC(e),t?(N.current=hw(s,V.current),I(e)):n.setOpen(!0,DT(ST,e.nativeEvent,e.currentTarget)));return}a&&(re.current!=null&&(N.current=re.current),NC(e),!t&&y?n.setOpen(!0,DT(ST,e.nativeEvent,e.currentTarget)):le(e),t&&I(e))}},onFocus(e){n.select(`open`)&&!g&&(N.current=-1,I(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[le,V,_,s,m,I,n,y,S,ce,h,re,g]),pe=b.useMemo(()=>({...ue,...fe}),[ue,fe]);return b.useMemo(()=>u?{reference:pe,floating:de,item:se,trigger:fe}:{},[u,pe,de,fe,se])}var fk=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function pk(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{role:s=`dialog`}=t,c=KS(),l=a?.id||c,u=b.useMemo(()=>AC(o)?.id||i,[o,i]),d=fk.get(s)??s,f=RE()!=null,p=b.useMemo(()=>d===`tooltip`||s===`label`?xS:{"aria-haspopup":d===`alertdialog`?`dialog`:d,"aria-expanded":`false`,...d===`listbox`&&{role:`combobox`},...d===`menu`&&f&&{role:`menuitem`},...s===`select`&&{"aria-autocomplete":`none`},...s===`combobox`&&{"aria-autocomplete":`list`}},[d,f,s]),m=b.useMemo(()=>d===`tooltip`||s===`label`?{[`aria-${s===`label`?`labelledby`:`describedby`}`]:r?u:void 0}:{...p,"aria-expanded":r?`true`:`false`,"aria-controls":r?u:void 0,...d===`menu`&&{id:l}},[d,u,r,l,s,p]),h=b.useMemo(()=>{let e={id:u,...d&&{role:d}};return d===`tooltip`||s===`label`?e:{...e,...d===`menu`&&{"aria-labelledby":l}}},[d,u,l,s]),g=b.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${u}-fui-option`}};switch(s){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[u,s]);return b.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}function mk(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,i=n.useState(`open`),{listRef:a,elementsRef:o,activeIndex:s,onMatch:c,onTypingChange:l,enabled:u=!0,resetMs:d=750,selectedIndex:f=null}=t,p=Zw(),m=b.useRef(``),h=b.useRef(f??s??-1),g=b.useRef(null);Q(()=>{!i&&f!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[i,f,p]),Q(()=>{i&&m.current===``&&(h.current=f??s??-1)},[i,f,s]);let _=Z(e=>{e?r.current.typing||(r.current.typing=e,l?.(e)):r.current.typing&&(r.current.typing=e,l?.(e))}),v=Z(e=>{function t(e){let t=o?.current[e];return!t||ww(t)}function n(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let r=a.current;if(m.current.length>0&&e.key===` `&&(NC(e),_(!0)),m.current.length>0&&m.current[0]!==` `&&n(r,m.current)===-1&&e.key!==` `&&_(!1),r==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;i&&e.key!==` `&&(NC(e),_(!0));let l=m.current===``;l&&(h.current=f??s??-1),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(d,()=>{m.current=``,h.current=g.current,_(!1)});let u=((l?f??s??-1:h.current)??0)+1,v=n(r,m.current,u);v===-1?e.key!==` `&&(m.current=``,_(!1)):(c?.(v),g.current=v)}),y=Z(e=>{let t=e.relatedTarget,r=n.select(`domReferenceElement`),i=n.select(`floatingElement`),a=xC(r,t),o=xC(i,t);a||o||(p.clear(),m.current=``,h.current=g.current,_(!1))}),x=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]),S=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return b.useMemo(()=>u?{reference:x,floating:S}:{},[u,x,S])}var hk=.1,gk=hk*hk,_k=.5;function vk(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function yk(e,t,n,r,i,a,o,s,c,l){let u=!1;return vk(e,t,n,r,i,a)&&(u=!u),vk(e,t,i,a,o,s)&&(u=!u),vk(e,t,o,s,c,l)&&(u=!u),vk(e,t,c,l,n,r)&&(u=!u),u}function bk(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function xk(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Sk(e={}){let{blockPointerEvents:t=!1}=e,n=new Xw,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*gk;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=SC(r),g=r.type===`mouseleave`,_=xC(u,h),v=xC(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&px(r.relatedTarget)&&xC(u,r.relatedTarget))return;function y(){return!!(s&&jC(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=xk(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=xk(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=xk(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=xk(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!bk(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?_k/2:_k*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+_k+1,o=C||T?S.bottom-_k:S.top,s=C?T?S.bottom-_k:S.top:S.bottom-_k;M=yk(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?_k/2:_k*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-_k,o=C||T?S.top+_k:S.bottom,s=C?T?S.top+_k:S.bottom:S.top+_k;M=yk(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?_k/2:_k*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+_k+1,o=w||E?S.right-_k:S.left,s=w?E?S.right-_k:S.left:S.right-_k;M=yk(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?_k/2:_k*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-_k,o=w||E?S.left+_k:S.right,s=w?E?S.left+_k:S.right:S.left+_k;M=yk(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function Ck(e){let t=b.useRef(``),n=b.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:b.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function wk(e,t){let n=b.useRef(e),r=Z(t);Q(()=>{n.current!==e&&r(n.current)},[e,r]),Q(()=>{n.current=e},[e])}function Tk(e){let[t,n]=b.useState(null),r=Z((t,r)=>{e||n(r||(oC?`touch`:``))});wk(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=Ck(r);return b.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function Ek(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),c=t.useState(`popupElement`),{openMethod:l,triggerProps:u}=Tk(a);IO(t);let{forceUnmount:d}=LO(a,t),f=b.useCallback(()=>{t.setOpen(!1,DT(TT))},[t]);b.useImperativeHandle(r,()=>({unmount:d,close:f}),[d,f]);let p=GO({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[m,h]=b.useState(0),[g,_]=b.useState(0),v=m===0,y=pk(p),x=nD(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=SC(e);if(v&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||xC(e,c)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:v});YT(a&&s===!0,c);let{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=nk([y,x]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{h(e),_(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{h(0),_(0)}),b.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(m+1,g+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,m,g,n]);let T=b.useMemo(()=>S(u),[S,u]),E=b.useMemo(()=>w(u),[w,u]),D=b.useMemo(()=>C(),[C]);t.useSyncedValues({openMethod:l,activeTriggerProps:T,inactiveTriggerProps:E,popupProps:D,floatingRootContext:p,nestedOpenDialogCount:m,nestedOpenDrawerCount:g})}var Dk=b.createContext(void 0);function Ok(e){let t=b.useContext(Dk);if(e===!1&&t===void 0)throw Error(rS(27));return t}var kk={...HO,modal:$(e=>e.modal),nested:$(e=>e.nested),nestedOpenDialogCount:$(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:$(e=>e.nestedOpenDrawerCount),disablePointerDismissal:$(e=>e.disablePointerDismissal),openMethod:$(e=>e.openMethod),descriptionElementId:$(e=>e.descriptionElementId),titleElementId:$(e=>e.titleElementId),viewportElement:$(e=>e.viewportElement),role:$(e=>e.role)},Ak=class e extends jO{constructor(e){super(jk(e),{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new RO,onOpenChange:void 0,onOpenChangeComplete:void 0},kk)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};static useStore(t,n){let r=Px(()=>new e(n)).current;return t??r}};function jk(e={}){return{...BO(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}var Mk=b.createContext(!1);function Nk(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=Ok(!0),p=b.useContext(Mk),m=!!f,h=Ak.useStore(l?.store,{open:r,openProp:n,activeTriggerId:d,triggerIdProp:u,modal:s,disablePointerDismissal:o,nested:m});zT(()=>{n===void 0&&h.state.open===!1&&r===!0&&h.update({open:!0,activeTriggerId:d})}),h.useControlledProp(`openProp`,n),h.useControlledProp(`triggerIdProp`,u),h.useSyncedValues({disablePointerDismissal:o,nested:m,modal:s}),h.useContextCallback(`onOpenChange`,i),h.useContextCallback(`onOpenChangeComplete`,a);let g=h.useState(`payload`);Ek({store:h,actionsRef:c,parentContext:f?.store.context,isDrawer:p,onOpenChange:i,triggerIdProp:u});let _=b.useMemo(()=>({store:h}),[h]);return(0,y.jsx)(Mk.Provider,{value:!1,children:(0,y.jsx)(Dk.Provider,{value:_,children:typeof t==`function`?t({payload:g}):t})})}function Pk(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:o,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=Ok(!0),d=!!u,f=Ak.useStore(s?.store,{open:r,openProp:n,activeTriggerId:l,triggerIdProp:c,modal:!0,disablePointerDismissal:!0,nested:d,role:`alertdialog`});f.useControlledProp(`openProp`,n),f.useControlledProp(`triggerIdProp`,c),f.useSyncedValue(`nested`,d),f.useContextCallback(`onOpenChange`,i),f.useContextCallback(`onOpenChangeComplete`,a);let p=f.useState(`payload`);Ek({store:f,actionsRef:o,parentContext:u?.store.context,isDrawer:!1,onOpenChange:i,triggerIdProp:c});let m=b.useMemo(()=>({store:f}),[f]);return(0,y.jsx)(Mk.Provider,{value:!1,children:(0,y.jsx)(Dk.Provider,{value:m,children:typeof t==`function`?t({payload:p}):t})})}var Fk=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=rT.startingStyle]=`startingStyle`,e[e.endingStyle=rT.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),Ik=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),Lk={[Ik.popupOpen]:``},Rk={[Ik.popupOpen]:``,[Ik.pressed]:``},zk={[Fk.open]:``},Bk={[Fk.closed]:``},Vk={[Fk.anchorHidden]:``},Hk={open(e){return e?Lk:null}},Uk={open(e){return e?Rk:null}},Wk={open(e){return e?zk:Bk},anchorHidden(e){return e?Vk:null}},Gk={...Wk,...oT},Kk=b.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=Ok(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return TS(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Gk,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),qk=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,style:o,...s}=e,{store:c}=Ok(),l=c.useState(`open`);function u(e){l&&c.setOpen(!1,DT(yT,e.nativeEvent))}let{getButtonProps:d,buttonRef:f}=sS({disabled:i,native:a});return TS(`button`,e,{state:{disabled:i},ref:[t,f],props:[{onClick:u},s,d]})}),Jk=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Ok(),c=qS(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),TS(`p`,e,{ref:t,props:[{id:c},o]})}),Yk=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),Xk=function(e){return e[e.open=Fk.open]=`open`,e[e.closed=Fk.closed]=`closed`,e[e.startingStyle=Fk.startingStyle]=`startingStyle`,e[e.endingStyle=Fk.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),Zk=b.createContext(void 0);function Qk(){let e=b.useContext(Zk);if(e===void 0)throw Error(rS(26));return e}var $k=`ArrowUp`,eA=`ArrowDown`,tA=`ArrowLeft`,nA=`ArrowRight`,rA=`Home`,iA=new Set([tA,nA]),aA=new Set([$k,eA]),oA=new Set([...iA,...aA]);new Set([...oA,rA,`End`]);var sA=new Set([$k,eA,tA,nA,rA,`End`]),cA={...Wk,...oT,nestedDialogOpen(e){return e?{[Xk.nestedDialogOpen]:``}:null}},lA=b.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:o,...s}=e,{store:c}=Ok(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`);Qk(),lT({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?c.context.popupRef.current:!0}let w=i===void 0?C:i,T=TS(`div`,e,{state:{open:_,nested:h,transitionStatus:x,nestedDialogOpen:g>0},props:[f,{"aria-labelledby":b??void 0,"aria-describedby":l??void 0,role:S,tabIndex:-1,hidden:!m,onKeyDown(e){sA.has(e.key)&&e.stopPropagation()},style:{[Yk.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:cA});return(0,y.jsx)(JE,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:r,modal:p!==!1,restoreFocus:`popup`,children:T})});function uA(e){return _S(19)?e:e?`true`:void 0}var dA=b.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,y.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),fA=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=Ok(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,y.jsx)(Zk.Provider,{value:n,children:(0,y.jsxs)(PE,{ref:t,...r,children:[a&&o===!0&&(0,y.jsx)(dA,{ref:i.context.internalBackdropRef,inert:uA(!s)}),e.children]})}):null}),pA=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=Ok(),c=qS(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),TS(`h2`,e,{ref:t,props:[{id:c},o]})}),mA=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,id:o,payload:s,handle:c,style:l,...u}=e,d=Ok(!0),f=c?.store??d?.store;if(!f)throw Error(rS(79));let p=qS(o),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=b.useRef(null),{registerTrigger:_,isMountedByThisTrigger:v}=FO(p,g,f,{payload:s}),{getButtonProps:y,buttonRef:x}=sS({disabled:i,native:a}),S=nk([YE(m,{enabled:m!=null})]),C={disabled:i,open:h},w=f.useState(`triggerProps`,v);return TS(`button`,e,{state:C,ref:[x,t,_,g],props:[S.getReferenceProps(),w,{[EE]:``,id:p},u,y],stateAttributesMapping:Hk})});function hA({...e}){return(0,y.jsx)(Pk,{"data-slot":`alert-dialog`,...e})}function gA({...e}){return(0,y.jsx)(fA,{"data-slot":`alert-dialog-portal`,...e})}function _A({className:e,...t}){return(0,y.jsx)(Kk,{"data-slot":`alert-dialog-overlay`,className:sx(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function vA({className:e,size:t=`default`,...n}){return(0,y.jsxs)(gA,{children:[(0,y.jsx)(_A,{}),(0,y.jsx)(lA,{"data-slot":`alert-dialog-content`,"data-size":t,className:sx(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function yA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:sx(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function bA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:sx(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function xA({className:e,...t}){return(0,y.jsx)(pA,{"data-slot":`alert-dialog-title`,className:sx(`font-heading text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function SA({className:e,...t}){return(0,y.jsx)(Jk,{"data-slot":`alert-dialog-description`,className:sx(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function CA({className:e,...t}){return(0,y.jsx)(NS,{"data-slot":`alert-dialog-action`,className:sx(e),...t})}function wA({className:e,...t}){return(0,y.jsx)(Ty,{role:`status`,"aria-label":`Loading`,className:sx(`spinner-line-fade size-4`,e),...t})}var TA=({isModalOpen:e,exitInfo:t,isRetryingConnection:n,hasCopiedRestartCommand:r,newTabUrl:i,onReconnect:a,onCopyRestartCommand:o})=>(0,y.jsx)(hA,{open:e,children:(0,y.jsx)(vA,{children:t===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(yA,{children:[(0,y.jsxs)(xA,{className:`flex items-center gap-2`,children:[(0,y.jsx)(wA,{"aria-hidden":`true`,role:`presentation`}),`Lost connection`]}),(0,y.jsx)(SA,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(jT,{children:[(0,y.jsx)(LT,{readOnly:!0,value:od,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(NT,{align:`inline-end`,children:(0,y.jsx)(FT,{size:`icon-xs`,onClick:o,"aria-label":r?`Copied`:`Copy restart command`,children:r?(0,y.jsx)(xy,{}):(0,y.jsx)(wy,{})})})]}),(0,y.jsx)(bA,{children:(0,y.jsxs)(CA,{onClick:a,disabled:n,children:[n?(0,y.jsx)(wA,{"data-icon":`inline-start`}):null,`Retry`]})})]}):t.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(yA,{children:[(0,y.jsx)(xA,{children:`Shell ended`}),(0,y.jsx)(SA,{children:t.exitCode===null||t.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${t.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(bA,{children:(0,y.jsx)(CA,{onClick:()=>window.open(i,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(yA,{children:[(0,y.jsxs)(xA,{className:`flex items-center gap-2`,children:[(0,y.jsx)(wA,{"aria-hidden":`true`,role:`presentation`}),`Connection lost`]}),(0,y.jsxs)(SA,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,t.closeCode,t.closeReason?` · ${t.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(bA,{children:(0,y.jsxs)(CA,{onClick:a,disabled:n,children:[n?(0,y.jsx)(wA,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})});function EA({...e}){return(0,y.jsx)(Nk,{"data-slot":`dialog`,...e})}function DA({...e}){return(0,y.jsx)(mA,{"data-slot":`dialog-trigger`,...e})}function OA({...e}){return(0,y.jsx)(fA,{"data-slot":`dialog-portal`,...e})}function kA({className:e,...t}){return(0,y.jsx)(Kk,{"data-slot":`dialog-overlay`,className:sx(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function AA({className:e,children:t,showCloseButton:n=!0,...r}){return(0,y.jsxs)(OA,{children:[(0,y.jsx)(kA,{}),(0,y.jsxs)(lA,{"data-slot":`dialog-content`,className:sx(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n?(0,y.jsxs)(qk,{"data-slot":`dialog-close`,render:(0,y.jsx)(NS,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`}),children:[(0,y.jsx)(jy,{}),(0,y.jsx)(`span`,{className:`sr-only`,children:`Close`})]}):null]})]})}function jA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`dialog-header`,className:sx(`flex flex-col gap-2`,e),...t})}function MA({className:e,...t}){return(0,y.jsx)(pA,{"data-slot":`dialog-title`,className:sx(`font-heading leading-none font-medium`,e),...t})}var NA=`border border-border/60 bg-background/70 text-muted-foreground shadow-xs ring-0 backdrop-blur-md`,PA=`duration-150 ease-snappy data-closed:duration-100 data-closed:fade-out-0 data-closed:zoom-out-95 data-closed:blur-out-[5px] data-closed:slide-out-to-top-2 data-open:fade-in-0 data-open:zoom-in-95 data-open:blur-in-[5px] data-open:slide-in-from-top-2`,FA=()=>typeof window<`u`&&typeof window.queryLocalFonts==`function`,IA=async()=>{if(typeof window>`u`)return[];let e=window.queryLocalFonts;if(typeof e!=`function`)return[];try{let t=await e(),n=new Set;for(let e of t)e.family&&n.add(e.family);return[...n].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}catch{return[]}},LA=async()=>{if(typeof navigator>`u`||!navigator.permissions)return`unsupported`;try{return(await navigator.permissions.query({name:`local-fonts`})).state}catch{return`unsupported`}},RA=(e,t)=>{let n=t.trim().toLowerCase();return n?e.filter(e=>e.toLowerCase().includes(n)):e},zA=({open:e,onFontSelect:t})=>{let[n,r]=(0,b.useState)({kind:`loading`}),[i,a]=(0,b.useState)(``),o=(0,b.useDeferredValue)(i);(0,b.useEffect)(()=>{if(!e)return;a(``);let t=!1;return r({kind:`loading`}),(async()=>{if(!FA()){t||r({kind:`unsupported`});return}let e=await LA();if(!t)if(e===`granted`){let e=await IA();t||r({kind:`ready`,families:e})}else r(e===`denied`?{kind:`denied`}:{kind:`prompt`})})(),()=>{t=!0}},[e]);let s=(0,b.useCallback)(async()=>{r({kind:`loading`});let e=await IA();if(e.length===0){r({kind:`denied`});return}r({kind:`ready`,families:e})},[]),c=(0,b.useCallback)(e=>{t(e)},[t]);return{state:n,searchQuery:i,setSearchQuery:a,deferredQuery:o,filteredFamilies:(0,b.useMemo)(()=>n.kind===`ready`?RA(n.families,o):[],[n.kind,n.kind===`ready`?n.families:void 0,o]),handleApply:c,requestPermission:s}},BA=`flex w-full items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-foreground/90 outline-none transition-colors hover:bg-foreground/10 focus-visible:bg-foreground/10`,VA={contentVisibility:`auto`,containIntrinsicSize:`auto 28px`},HA=`text-xs leading-snug text-muted-foreground/80`,UA=({initialValue:e,onApply:t})=>{let[n,r]=(0,b.useState)(e),i=n.trim(),a=(0,b.useCallback)(()=>{i&&t(i)},[i,t]);return(0,y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,y.jsx)(AT,{autoFocus:!0,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),a())},placeholder:`Family name (e.g. Iosevka)`,className:`h-8 text-xs`}),(0,y.jsx)(NS,{type:`button`,size:`sm`,variant:`secondary`,disabled:!i,onClick:a,className:`h-7 text-xs`,children:`Apply`})]})},WA=({open:e,onOpenChange:t,currentFamily:n,onApply:r})=>{let{state:i,searchQuery:a,setSearchQuery:o,deferredQuery:s,filteredFamilies:c,handleApply:l,requestPermission:u}=zA({open:e,onFontSelect:e=>{r(e),t(!1)}});return(0,y.jsx)(EA,{open:e,onOpenChange:t,children:(0,y.jsxs)(AA,{className:sx(`max-h-[calc(100dvh-2rem)] gap-2 overflow-hidden p-4 sm:max-w-sm`,NA),children:[(0,y.jsx)(jA,{className:`pr-8`,children:(0,y.jsx)(MA,{children:`Local font`})}),i.kind===`loading`?(0,y.jsx)(`p`,{className:HA,children:`Loading…`}):i.kind===`unsupported`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:HA,children:`This browser doesn't expose installed fonts. Type a family name to use any installed font.`}),(0,y.jsx)(UA,{initialValue:n??``,onApply:l})]}):i.kind===`denied`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:HA,children:`Permission denied. Re-allow in browser site settings, or type a family name.`}),(0,y.jsx)(UA,{initialValue:n??``,onApply:l})]}):i.kind===`prompt`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:HA,children:`Allow localterm to read your installed fonts to preview them.`}),(0,y.jsx)(NS,{type:`button`,size:`sm`,variant:`secondary`,onClick:u,className:`h-7 text-xs`,children:`Allow access`}),(0,y.jsx)(`div`,{className:`my-1 border-t border-border/40`}),(0,y.jsx)(`p`,{className:HA,children:`Or type a family name:`}),(0,y.jsx)(UA,{initialValue:n??``,onApply:l})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(ky,{className:`pointer-events-none absolute top-1/2 left-2 size-3 -translate-y-1/2 text-muted-foreground/70`}),(0,y.jsx)(AT,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:`Search installed fonts`,className:`h-8 pl-7 text-xs`})]}),(0,y.jsx)(`div`,{className:`-mx-1 max-h-72 overflow-y-auto pr-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:c.length===0?(0,y.jsxs)(`p`,{className:sx(HA,`px-2 py-2`),children:[`No fonts match "`,a,`".`]}):c.map(e=>(0,y.jsx)(`button`,{type:`button`,onClick:()=>l(e),className:sx(BA,e===n&&`bg-foreground/5`),style:{...VA,fontFamily:`"${wd(e)}", ui-monospace, monospace`},children:(0,y.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,y.jsx)(`p`,{className:sx(HA,`px-1 tabular-nums`),children:s?`${c.length} of ${i.families.length}`:`${i.families.length} fonts`})]})]})})};function GA({className:e,...t}){return(0,y.jsx)(`label`,{"data-slot":`label`,className:sx(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var KA=b.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return TS(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function qA({className:e,orientation:t=`horizontal`,...n}){return(0,y.jsx)(KA,{"data-slot":`separator`,orientation:t,className:sx(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}function JA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`field-group`,className:sx(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var YA=Iy(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function XA({className:e,orientation:t=`vertical`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:sx(YA({orientation:t}),e),...n})}function ZA({className:e,...t}){return(0,y.jsx)(GA,{"data-slot":`field-label`,className:sx(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}var QA=b.createContext(void 0);function $A(e){let t=b.useContext(QA);if(t===void 0&&!e)throw Error(rS(72));return t}var ej={...HO,disabled:$(e=>e.disabled),instantType:$(e=>e.instantType),isInstantPhase:$(e=>e.isInstantPhase),trackCursorAxis:$(e=>e.trackCursorAxis),disableHoverablePopup:$(e=>e.disableHoverablePopup),lastOpenChangeReason:$(e=>e.openChangeReason),closeOnClick:$(e=>e.closeOnClick),closeDelay:$(e=>e.closeDelay),hasViewport:$(e=>e.hasViewport)},tj=class e extends jO{constructor(e){super({...nj(),...e},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new RO},ej)}setOpen=(e,t)=>{let n=t.reason,r=n===hT,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?sT.flushSync(o):o()};static useStore(t,n){let r=Px(()=>new e(n)).current,i=t??r,a=GO({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=a,i}};function nj(){return{...BO(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var rj=bO(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=tj.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});zT(()=>{r===void 0&&p.state.open===!1&&n===!0&&p.update({open:!0,activeTriggerId:d})}),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),Q(()=>{m&&t&&p.setOpen(!1,DT(wT))},[m,t,p]),p.useSyncedValue(`disabled`,t),IO(p);let{forceUnmount:v,transitionStatus:x}=LO(h,p),S=p.select(`floatingRootContext`),C=p.useState(`isInstantPhase`),w=p.useState(`instantType`),T=p.useState(`lastOpenChangeReason`),E=b.useRef(null);Q(()=>{x===`ending`&&T===`none`||x!==`ending`&&C?(w!==`delay`&&(E.current=w),p.set(`instantType`,`delay`)):E.current!==null&&(p.set(`instantType`,E.current),E.current=null)},[x,C,T,w,p]),Q(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let D=b.useCallback(()=>{p.setOpen(!1,DT(TT))},[p]);b.useImperativeHandle(o,()=>({unmount:v,close:D}),[v,D]);let{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=nk([nD(S,{enabled:!t,referencePress:()=>p.select(`closeOnClick`)}),QE(S,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),j=b.useMemo(()=>O(),[O]),M=b.useMemo(()=>A(),[A]),N=b.useMemo(()=>k(),[k]);return p.useSyncedValues({activeTriggerProps:j,inactiveTriggerProps:M,popupProps:N}),(0,y.jsx)(QA.Provider,{value:p,children:typeof f==`function`?f({payload:_}):f})}),ij=b.createContext(void 0);function aj(){return b.useContext(ij)}var oj=function(e){return e[e.popupOpen=Ik.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),sj=xO(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeOnClick:c=!0,closeDelay:l,id:u,style:d,...f}=e,p=$A(!0),m=i?.store??p;if(!m)throw Error(rS(82));let h=qS(u),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=b.useRef(null),x=s??600,S=l??0,{registerTrigger:C,isMountedByThisTrigger:w}=FO(h,y,m,{payload:a,closeOnClick:c,closeDelay:S}),T=aj(),{delayRef:E,isInstantPhase:D,hasProvider:O}=nE(v,{open:_});m.useSyncedValue(`isInstantPhase`,D);let k=m.useState(`disabled`),A=o??k,j=m.useState(`trackCursorAxis`),M=m.useState(`disableHoverablePopup`),N=tk(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!M&&j!==`both`?Sk():null,restMs(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:s??e??x),n},delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return l==null&&O&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`}),P=qO(v,{enabled:!A}).reference,F={open:_},I=m.useState(`triggerProps`,w);return TS(`button`,e,{state:F,ref:[t,C,y],props:[N,P,I,{onPointerDown(){m.set(`closeOnClick`,c)},id:h,[oj.triggerDisabled]:A?``:void 0},f],stateAttributesMapping:Hk})}),cj=b.createContext(void 0);function lj(){let e=b.useContext(cj);if(e===void 0)throw Error(rS(70));return e}var uj=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=NE({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,y.jsxs)(b.Fragment,{children:[l,c&&sT.createPortal(n,c)]})}),dj=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return $A().useState(`mounted`)||n?(0,y.jsx)(cj.Provider,{value:n,children:(0,y.jsx)(uj,{ref:t,...r})}):null}),fj=b.createContext(void 0);function pj(){let e=b.useContext(fj);if(e===void 0)throw Error(rS(71));return e}var mj=b.createContext(void 0);function hj(){return b.useContext(mj)?.direction??`ltr`}var gj=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=qC(e,t)||{};if(l==null)return{};let f=dw(u),p={x:n,y:r},m=$C(i),h=ZC(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=KC(k,j,A),N=!c.arrow&&YC(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),_j=(e,t)=>({...gj(e),options:[e,t]}),vj={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await dO().fn(e)).data?.referenceHidden||a}}}},yj={sideX:`left`,sideY:`top`},bj={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=ux(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:yj};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=eC(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=JC(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:yj.sideX,g=f===`top`?`bottom`:yj.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function xj(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Sj(e,t,n){let{rects:r,placement:i}=e;return{side:xj(t,JC(i),n),align:YC(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Cj(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:x}=e,[S,C]=b.useState(null);!m&&S!==null&&C(null);let w=h.side||`flip`,T=h.align||`flip`,E=h.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=Z(D),k=D?O:t,A=iE(t),j=iE(m),M=hj()===`rtl`,N=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":M?`left`:`right`,"inline-start":M?`right`:`left`}[r],P=a===`center`?N:`${N}-${a}`,F=c,I=+(r===`bottom`),L=+(r===`top`),ee=+(r===`right`),R=+(r===`left`);typeof F==`number`?F={top:F+I,right:F+R,bottom:F+L,left:F+ee}:F&&={top:(F.top||0)+I,right:(F.right||0)+R,bottom:(F.bottom||0)+L,left:(F.left||0)+ee};let te={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:F},z=b.useRef(null),B=iE(i),V=iE(o),ne=[oO(e=>{let t=Sj(e,r,M),n=typeof B.current==`function`?B.current(t):B.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,M,r])],re=T===`none`&&w!==`shift`,H=!re&&(l||g||w===`shift`),ie=w===`none`?null:lO({...te,padding:{top:F.top+1,right:F.right+1,bottom:F.bottom+1,left:F.left+1},mainAxis:!g&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),ae=re?null:sO(e=>{let t=eC(e.elements.floating).documentElement;return{...te,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:H,limiter:l||g?void 0:cO(e=>{if(!z.current)return{};let{width:t,height:n}=z.current.getBoundingClientRect(),r=QC(JC(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})}},[te,l,g,F,T]);w===`shift`||T===`shift`||a===`center`?ne.push(ae,ie):ne.push(ie,ae),ne.push(uO({...te,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!j.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=ux(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),_j(()=>({element:z.current||eC(z.current).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=JC(a),l=QC(c),u=z.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(Sj(e,r,M)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,H&&l===`y`&&b?S:x),{}}},vj,v),Q(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,p]);let oe=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:se,elements:ce,x:le,y:ue,middlewareData:de,update:fe,placement:pe,context:me,isPositioned:he,floatingStyles:ge}=WO({rootContext:p,open:f?m:void 0,placement:P,middleware:ne,strategy:n,whileElementsMounted:f?void 0:(...e)=>KD(...e,oe),nodeId:_,externalTree:x}),{sideX:_e,sideY:ve}=de.adaptiveOrigin||yj,ye=he?n:`fixed`,be=b.useMemo(()=>{let e=v?{position:ye,[_e]:le,[ve]:ue}:{position:ye,...ge};return he||(e.opacity=0),e},[v,ye,_e,le,ve,ue,ge,he]),xe=b.useRef(null);Q(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(wj(t)?t.current:t)||null;n!==xe.current&&(se.setPositionReference(n),xe.current=n)},[m,se,k,A]),b.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&wj(e)&&e.current!==xe.current&&(se.setPositionReference(e.current),xe.current=e.current)},[m,se,k,A]),b.useEffect(()=>{if(f&&m&&ce.domReference&&ce.floating)return KD(ce.domReference,ce.floating,fe,oe)},[f,m,ce,fe,oe]);let Se=JC(pe),Ce=xj(r,Se,M),we=YC(pe)||`center`,Te=!!de.hide?.referenceHidden;Q(()=>{y&&m&&he&&C(Se)},[y,m,he,Se]);let Ee=b.useMemo(()=>({position:`absolute`,top:de.arrow?.y,left:de.arrow?.x}),[de.arrow]),De=de.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:be,arrowStyles:Ee,arrowRef:z,arrowUncentered:De,side:Ce,align:we,physicalSide:Se,anchorHidden:Te,refs:se,context:me,isPositioned:he,update:fe}),[be,Ee,z,De,Ce,we,Se,Te,se,me,he,fe])}function wj(e){return e!=null&&`current`in e}function Tj(e){return e===`starting`?TE:xS}function Ej(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),TS(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Tj(r),i],stateAttributesMapping:Wk})}var Dj=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=OE,style:g,..._}=e,v=$A(),x=lj(),S=v.useState(`open`),C=v.useState(`mounted`),w=v.useState(`trackCursorAxis`),T=v.useState(`disableHoverablePopup`),E=v.useState(`floatingRootContext`),D=v.useState(`instantType`),O=v.useState(`transitionStatus`),k=Cj({anchor:i,positionMethod:a,floatingRootContext:E,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:x,collisionAvoidance:h,adaptiveOrigin:v.useState(`hasViewport`)?bj:void 0}),A=Ej(e,b.useMemo(()=>({open:S,side:k.side,align:k.align,anchorHidden:k.anchorHidden,instant:w===`none`?D:`tracking-cursor`}),[S,k.side,k.align,k.anchorHidden,w,D]),{styles:k.positionerStyles,transitionStatus:O,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!C,inert:!S||w===`both`||T});return(0,y.jsx)(fj.Provider,{value:k,children:A})}),Oj={...Wk,...oT},kj=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=$A(),{side:s,align:c}=pj(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);lT({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=o.useState(`disabled`),h=o.useState(`closeDelay`);return $O(p,{enabled:!m,closeDelay:h}),TS(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,Tj(d),a],stateAttributesMapping:Oj})}),Aj=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=$A(),s=o.useState(`open`),c=o.useState(`instantType`),{arrowRef:l,side:u,align:d,arrowUncentered:f,arrowStyles:p}=pj();return TS(`div`,e,{state:{open:s,side:u,align:d,uncentered:f,instant:c},ref:[t,l],props:[{style:p,"aria-hidden":!0},a],stateAttributesMapping:Wk})}),jj=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=b.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=b.useMemo(()=>({open:t,close:n}),[t,n]);return(0,y.jsx)(ij.Provider,{value:i,children:(0,y.jsx)(tE,{delay:a,timeoutMs:r,children:e.children})})};function Mj(e){let[t,n]=b.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Nj({delay:e=0,...t}){return(0,y.jsx)(jj,{"data-slot":`tooltip-provider`,delay:e,...t})}function Pj({...e}){return(0,y.jsx)(rj,{"data-slot":`tooltip`,...e})}function Fj({...e}){return(0,y.jsx)(sj,{"data-slot":`tooltip-trigger`,...e})}function Ij({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,y.jsx)(dj,{children:(0,y.jsx)(Dj,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,y.jsxs)(kj,{"data-slot":`tooltip-content`,className:sx(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,y.jsx)(Aj,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var Lj=b.createContext(null),Rj=b.createContext(null);function zj(){let e=b.useContext(Lj);if(e===null)throw Error(rS(60));return e}function Bj(){let e=b.useContext(Rj);if(e===null)throw Error(rS(61));return e}var Vj=(e,t)=>Object.is(e,t);function Hj(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Uj(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:Hj(t,e,n))}function Wj(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:Hj(e,t,n))}function Gj(e,t,n){return e.filter(e=>!Hj(t,e,n))}function Kj(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function qj(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Jj(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(qj(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Yj(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return Kj(e)}function Xj(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?Kj(e.value):Kj(e)}function Zj(e,t,n){function r(){return Yj(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=qj(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function Qj(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,y.jsx)(b.Fragment,{children:Zj(r,t,n)},i)),e),[])}var $j={id:$(e=>e.id),labelId:$(e=>e.labelId),modal:$(e=>e.modal),multiple:$(e=>e.multiple),items:$(e=>e.items),itemToStringLabel:$(e=>e.itemToStringLabel),itemToStringValue:$(e=>e.itemToStringValue),isItemEqualToValue:$(e=>e.isItemEqualToValue),value:$(e=>e.value),hasSelectedValue:$(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Xj(t,r)!==``}),hasNullItemLabel:$((e,t)=>t?Jj(e.items):!1),open:$(e=>e.open),mounted:$(e=>e.mounted),forceMount:$(e=>e.forceMount),transitionStatus:$(e=>e.transitionStatus),openMethod:$(e=>e.openMethod),activeIndex:$(e=>e.activeIndex),selectedIndex:$(e=>e.selectedIndex),isActive:$((e,t)=>e.activeIndex===t),isSelected:$((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>Hj(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Hj(n,i,r)}),isSelectedByFocus:$((e,t)=>e.selectedIndex===t),popupProps:$(e=>e.popupProps),triggerProps:$(e=>e.triggerProps),triggerElement:$(e=>e.triggerElement),positionerElement:$(e=>e.positionerElement),listElement:$(e=>e.listElement),scrollUpArrowVisible:$(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:$(e=>e.scrollDownArrowVisible),hasScrollArrows:$(e=>e.hasScrollArrows)};function eM(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function tM(e,t){return Math.max(0,e-t)}function nM(e,t){if(t<=0)return 0;let n=eM(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function rM(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:x=!1,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w=Vj,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=HS(),{setDirty:O,setTouched:k,setFocused:A,shouldValidateOnChange:j,validityData:M,setFilled:N,name:P,disabled:F,validation:I,validationMode:L}=BS(),ee=$S({id:t}),R=F||d,te=P??c,[z,B]=dT({controlled:n,default:x?r??bS:r,name:`Select`,state:`value`}),[V,ne]=dT({controlled:a,default:o,name:`Select`,state:`open`}),re=b.useRef([]),H=b.useRef([]),ie=b.useRef(null),ae=b.useRef(null),oe=b.useRef(0),se=b.useRef(null),ce=b.useRef([]),le=b.useRef(!1),ue=b.useRef(!1),de=b.useRef(null),fe=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),pe=b.useRef(!1),{mounted:me,setMounted:he,transitionStatus:ge}=uT(V),{openMethod:_e,triggerProps:ve}=Tk(V),ye=Px(()=>new AO({id:ee,labelId:void 0,modal:m,multiple:x,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:z,open:V,mounted:me,transitionStatus:ge,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,be=EO(ye,$j.activeIndex),xe=EO(ye,$j.selectedIndex),Se=EO(ye,$j.triggerElement),Ce=EO(ye,$j.positionerElement),we=Mj(_e),Te=_e??we,Ee=b.useMemo(()=>x&&Array.isArray(z)&&z.length===0?``:Xj(z,C),[x,z,C]),De=b.useMemo(()=>x&&Array.isArray(z)?z.map(e=>Xj(e,C)):Xj(z,C),[x,z,C]);fT(iE(ye.state.triggerElement),{id:ee,value:z,getValue:Z(()=>De)});let Oe=b.useRef(z);Q(()=>{z!==Oe.current&&ye.set(`forceMount`,!0)},[ye,z]),Q(()=>{N(x?Array.isArray(z)&&z.length>0:z!=null)},[x,z,N]),Q(function(){if(V)return;let e=ce.current;if(x){let t=Array.isArray(z)?z:[];if(t.length===0){ye.set(`selectedIndex`,null);return}let n=t[t.length-1],r=Wj(e,n,w);ye.set(`selectedIndex`,r===-1?null:r);return}let t=Wj(e,z,w);ye.set(`selectedIndex`,t===-1?null:t)},[x,V,z,ce,w,ye]),wk(z,()=>{D(te),O(z!==M.initialValue),j()?I.commit(z):I.commit(z,!0)});let ke=Z((e,t)=>{if(s?.(e,t),!t.isCanceled&&(ne(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(z)),!e&&ye.state.activeIndex!==null)){let e=re.current[ye.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Ae=Z(()=>{he(!1),ye.update({activeIndex:null,openMethod:null}),_?.(!1)});lT({enabled:!h,open:V,ref:ie,onComplete(){V||Ae()}}),b.useImperativeHandle(h,()=>({unmount:Ae}),[Ae]);let je=Z((e,t)=>{i?.(e,t),!t.isCanceled&&B(e)}),Me=Z(()=>{let e=ye.state.listElement||ie.current;if(!e)return;let t=tM(e.scrollHeight,e.clientHeight),n=nM(e.scrollTop,t),r=n>0,i=n<t;ye.state.scrollUpArrowVisible!==r&&ye.set(`scrollUpArrowVisible`,r),ye.state.scrollDownArrowVisible!==i&&ye.set(`scrollDownArrowVisible`,i)}),Ne=UO({open:V,onOpenChange:ke,elements:{reference:Se,floating:Ce}}),{getReferenceProps:Pe,getFloatingProps:Fe,getItemProps:Ie}=nk([YE(Ne,{enabled:!f&&!R,event:`mousedown`}),nD(Ne,{bubbles:!1}),dk(Ne,{enabled:!f&&!R,listRef:re,activeIndex:be,selectedIndex:xe,disabledIndices:bS,onNavigate(e){e===null&&!V||ye.set(`activeIndex`,e)},focusItemOnHover:T}),mk(Ne,{enabled:!f&&!R&&(V||!x),listRef:H,activeIndex:be,selectedIndex:xe,onMatch(e){V?ye.set(`activeIndex`,e):je(ce.current[e],DT(`none`))},onTypingChange(e){le.current=e}})]),Le=b.useMemo(()=>Hx(Pe(),ve,ee?{id:ee}:xS),[Pe,ve,ee]);zT(()=>{ye.update({popupProps:Fe(),triggerProps:Le})}),Q(()=>{ye.update({id:ee,modal:m,multiple:x,value:z,open:V,mounted:me,transitionStatus:ge,popupProps:Fe(),triggerProps:Le,items:v,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:Te})},[ye,ee,m,x,z,V,me,ge,Fe,Le,v,S,C,w,Te]);let Re=b.useMemo(()=>({store:ye,name:te,required:p,disabled:R,readOnly:f,multiple:x,highlightItemOnHover:T,setValue:je,setOpen:ke,listRef:re,popupRef:ie,scrollHandlerRef:ae,handleScrollArrowVisibility:Me,scrollArrowsMountedCountRef:oe,getItemProps:Ie,events:Ne.context.events,valueRef:se,valuesRef:ce,labelsRef:H,typingRef:le,selectionRef:fe,selectedItemTextRef:de,validation:I,onOpenChangeComplete:_,keyboardActiveRef:ue,alignItemWithTriggerActiveRef:pe,initialValueRef:Oe}),[ye,te,p,R,f,x,T,je,ke,Ie,Ne.context.events,I,_,Me]),ze=uS(g,I.inputRef),Be=x&&Array.isArray(z)&&z.length>0,Ve=x?void 0:te,He=b.useMemo(()=>!x||!Array.isArray(z)||!te?null:z.map(e=>{let t=Xj(e,C);return(0,y.jsx)(`input`,{type:`hidden`,form:l,name:te,value:t},t)}),[x,z,l,te,C]);return(0,y.jsx)(Lj.Provider,{value:Re,children:(0,y.jsxs)(Rj.Provider,{value:Ne,children:[E,(0,y.jsx)(`input`,{...I.getInputValidationProps({onFocus(){ye.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.currentTarget.value,n=DT(pT,e.nativeEvent);function r(){if(x)return;let e=ce.current.find(e=>Xj(e,C).toLowerCase()===t.toLowerCase()||Yj(e,S).toLowerCase()===t.toLowerCase());e!=null&&(O(e!==M.initialValue),je(e,n),j()&&I.commit(e))}ye.set(`forceMount`,!0),queueMicrotask(r)}}),id:ee&&Ve==null?`${ee}-hidden-input`:void 0,form:l,name:Ve,autoComplete:u,value:Ee,disabled:R,required:p&&!Be,readOnly:f,ref:ze,style:te?cE:sE,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),He]})})}function iM(e,t){return e??t}function aM(e){let t=e.getBoundingClientRect(),n=ux(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var oM=2,sM=400,cM=200,lM={...Uk,...RS,value:()=>null},uM=b.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=BS(),{labelId:m}=YS(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=zj(),T=p||C||a,E=EO(h,$j.open),D=EO(h,$j.value),O=EO(h,$j.triggerProps),k=EO(h,$j.positionerElement),A=EO(h,$j.listElement),j=EO(h,$j.id),M=EO(h,$j.labelId),N=EO(h,$j.hasSelectedValue),P=!N&&E,F=EO(h,$j.hasNullItemLabel,P),I=i??j,L=iM(m,M);$S({id:I});let ee=iE(k),R=b.useRef(null),{getButtonProps:te,buttonRef:z}=sS({disabled:T,native:o}),B=uS(t,R,z,Z(e=>{h.set(`triggerElement`,e)})),V=Zw(),ne=Zw(),re=Zw(),H=Zw();b.useEffect(()=>{if(E)return N||F?H.start(cM,()=>{_.current.allowUnselectedMouseUp=!0,re.start(cM,()=>{_.current.allowSelectedMouseUp=!0})}):re.start(sM,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{re.clear(),H.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},ne.clear()},[E,N,F,_,ne,re,H]);let ie=b.useMemo(()=>A?.id??AC(k)?.id,[A,k]),ae=Hx(O,{id:I,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?ie:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:B,onFocus(e){u(!0),E&&S.current&&g(!1,DT(pT,e.nativeEvent)),V.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){xC(k,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(D))},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(e){if(E)return;let t=eC(e.currentTarget);function n(e){if(!R.current)return;let t=e.target;if(xC(R.current,t)||xC(ee.current,t)||t===R.current)return;let n=aM(R.current);e.clientX>=n.left-oM&&e.clientX<=n.right+oM&&e.clientY>=n.top-oM&&e.clientY<=n.bottom+oM||g(!1,DT(CT,e))}ne.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,te);ae.role=`combobox`;let oe={...f,open:E,disabled:T,value:D,readOnly:y,placeholder:!N};return TS(`button`,e,{ref:[t,R],state:oe,stateAttributesMapping:lM,props:ae})}),dM={value:()=>null},fM=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=zj(),u=EO(c,$j.value),d=EO(c,$j.items),f=EO(c,$j.itemToStringLabel),p=EO(c,$j.hasSelectedValue),m=!p&&a!=null&&i==null,h=EO(c,$j.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?Qj(u,d,f):Zj(u,d,f)),TS(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:dM})}),pM=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o}=zj();return TS(`span`,e,{state:{open:EO(o,$j.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:Hk})}),mM=b.createContext(void 0),hM=b.forwardRef(function(e,t){let{store:n}=zj(),r=EO(n,$j.mounted),i=EO(n,$j.forceMount);return r||i?(0,y.jsx)(mM.Provider,{value:!0,children:(0,y.jsx)(PE,{ref:t,...e})}):null}),gM=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function _M(){return b.useContext(gM)}function vM(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),o=b.useRef(0),s=Px(bM).current,c=Px(yM).current,[l,u]=b.useState(0),d=b.useRef(l),f=Z((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=Z(e=>{c.delete(e),d.current+=1,u(d.current)}),m=b.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(xM).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);Q(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),Q(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),Q(()=>()=>{n.current=[]},[n]),Q(()=>()=>{r&&(r.current=[])},[r]);let h=Z(e=>(s.add(e),()=>{s.delete(e)}));Q(()=>{s.forEach(e=>e(m))},[s,m]);let g=b.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,y.jsx)(gM.Provider,{value:g,children:t})}function yM(){return new Map}function bM(){return new Set}function xM(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var SM=b.createContext(void 0);function CM(){let e=b.useContext(SM);if(!e)throw Error(rS(59));return e}function wM(e,t){e&&Object.assign(e.style,t)}var TM={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},EM=20;function DM(e,t,n,r){let[i,a]=b.useState(!1);Q(()=>{if(!e||!t||n==null){a(!1);return}let r=eC(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-EM)},[e,t,n]),YT(e&&(!t||i),r)}var OM={position:`fixed`},kM=b.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=DE,style:_,...v}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=zj(),A=Bj(),j=EO(x,$j.open),M=EO(x,$j.mounted),N=EO(x,$j.modal),P=EO(x,$j.value),F=EO(x,$j.openMethod),I=EO(x,$j.positionerElement),L=EO(x,$j.triggerElement),ee=EO(x,$j.isItemEqualToValue),R=EO(x,$j.transitionStatus),te=b.useRef(null),z=b.useRef(null),[B,V]=b.useState(h),ne=M&&B&&F!==`touch`;!M&&B!==h&&V(h),Q(()=>{M||($j.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),$j.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),b.useImperativeHandle(w,()=>ne),DM((ne||N)&&j,F===`touch`,I,L);let re=Cj({anchor:n,floatingRootContext:A,positionMethod:r,mounted:M,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??ne,collisionAvoidance:g,keepMounted:!0}),H=ne?`none`:re.side,ie=ne?OM:re.positionerStyles,ae=Ej(e,{open:j,side:H,align:re.align,anchorHidden:re.anchorHidden},{styles:ie,transitionStatus:R,props:v,refs:[t,Z(e=>{x.set(`positionerElement`,e)})],hidden:!M,inert:!j}),oe=b.useRef(0),se=Z(e=>{if(e.size===0&&oe.current===0||E.current.length===0)return;let t=oe.current;if(oe.current=e.size,e.size===t)return;let n=DT(pT);if(t!==0&&!x.state.multiple&&P!==null&&Wj(E.current,P,ee)===-1){let e=D.current,t=e!=null&&Wj(E.current,e,ee)!==-1?e:null;k(t,n),t===null&&(x.set(`selectedIndex`,null),T.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(P)){let e=e=>Wj(E.current,e,ee)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!Uj(P,e,ee)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&ne){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};wM(I,e),wM(O.current,e)}}),ce=b.useMemo(()=>({...re,side:H,alignItemWithTriggerActive:ne,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:te,scrollDownArrowRef:z}),[re,H,ne,V]);return(0,y.jsx)(vM,{elementsRef:S,labelsRef:C,onMapChange:se,children:(0,y.jsxs)(SM.Provider,{value:ce,children:[M&&N&&(0,y.jsx)(dA,{inert:uA(!j),cutout:L}),ae]})})}),AM=`base-ui-disable-scrollbar`,jM={className:AM,getElement(e){return(0,y.jsx)(`style`,{nonce:e,href:AM,precedence:`base-ui:low`,children:`.${AM}{scrollbar-width:none}.${AM}::-webkit-scrollbar{display:none}`})}},MM=b.createContext(void 0);function NM(e){let t=b.useContext(MM);if(t===void 0&&!e)throw Error(rS(69));return t}var PM=b.createContext(void 0),FM={disableStyleElements:!1};function IM(){return b.useContext(PM)??FM}var LM={...Wk,...oT},RM=b.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,selectedItemTextRef:f,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v}=zj(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=CM(),O=NM(!0)!=null,k=Bj(),A=hj(),{nonce:j,disableStyleElements:M}=IM(),N=EO(s,$j.id),P=EO(s,$j.open),F=EO(s,$j.mounted),I=EO(s,$j.popupProps),L=EO(s,$j.transitionStatus),ee=EO(s,$j.triggerElement),R=EO(s,$j.positionerElement),te=EO(s,$j.listElement),z=b.useRef(!1),B=b.useRef(!1),V=b.useRef({}),ne=tT(),re=Z(e=>{if(!R||!c.current||!B.current)return;if(z.current||!C){h();return}let t=R.style.top===`0px`,n=R.style.bottom===`0px`;if(!t&&!n){h();return}let r=VM(R),i=HM(R.getBoundingClientRect().height,`y`,r),a=eC(R),o=getComputedStyle(R),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=zM(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=BM(e),m=0,g=null,_=!1,v=!1,y=e=>{R.style.height=`${e}px`},b=(t,n)=>{let r=eM(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(z.current=!0),h()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?v=!0:g=0:(_=!0,n&&f<p&&(g=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&y(m),v||g!=null){let t=BM(e),n=v?t:eM(g,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(z.current=!0),h()});b.useImperativeHandle(g,()=>re,[re]),lT({open:P,ref:c,onComplete(){P&&l?.(!0)}});let H={open:P,transitionStatus:L,side:x,align:S};Q(()=>{!R||!c.current||Object.keys(V.current).length||(V.current={top:R.style.top||`0`,left:R.style.left||`0`,right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),Q(()=>{P||C||(B.current=!1,z.current=!1,wM(R,V.current))},[P,C,R,c]),Q(()=>{let e=c.current;if(!P||!ee||!R||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){B.current=!0,ne.request(h),e.style.removeProperty(`--transform-origin`);return}let t=GM(e);e.style.removeProperty(`--transform-origin`);try{let t=f.current,n=d.current,r=getComputedStyle(R),i=getComputedStyle(e),a=eC(ee),o=ux(R),c=VM(ee),l=UM(ee.getBoundingClientRect(),c),u=UM(R.getBoundingClientRect(),c),p=l.height,m=te||e,g=m.scrollHeight,y=parseFloat(i.borderBottomWidth),b=parseFloat(r.marginTop)||10,x=parseFloat(r.marginBottom)||10,S=parseFloat(r.minHeight)||100,C=zM(i),w=a.documentElement.clientHeight-b-x,E=a.documentElement.clientWidth,D=w-l.bottom+p,O,k=A===`rtl`?l.right-u.width:l.left,j=0;if(t&&n){let e=UM(n.getBoundingClientRect(),c);O=UM(t.getBoundingClientRect(),c),k=u.left+(A===`rtl`?e.right-O.right:e.left-O.left);let r=e.top-l.top+e.height/2;j=O.top-u.top+O.height/2-r}let M=D+j+x+y,N=Math.min(w,M),P=w-b-x,F=M-N,I=E-5;R.style.left=`${eM(k,5,I-u.width)}px`,R.style.height=`${N}px`,R.style.maxHeight=`auto`,R.style.marginTop=`${b}px`,R.style.marginBottom=`${x}px`,e.style.height=`100%`;let L=BM(m),ne=F>=L-1;ne&&(N=Math.min(w,u.height)-(F-L));let re=l.top<20||l.bottom>w-20||Math.ceil(N)+1<Math.min(g,S),H=(o.visualViewport?.scale??1)!==1&&aC;if(re||H){B.current=!0,wM(R,V.current),T(!1);return}let ie=Math.max(S,N);if(ne){let e=Math.max(0,w-M);R.style.top=u.height>=P?`0`:`${e}px`,R.style.height=`${N}px`,m.scrollTop=BM(m)}else R.style.bottom=`0`,m.scrollTop=F;if(O){let t=u.top,n=u.height,r=O.top+O.height/2,i=eM(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ie===w||N>=C)&&(z.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),B.current=!0}finally{t()}},[s,P,R,ee,d,f,c,h,C,T,ne,E,D,te,_,v,A,w]),b.useEffect(()=>{if(!C||!R||!P)return;let e=ux(R);function t(e){u(!1,DT(ET,e))}return BT(e,`resize`,t)},[u,C,R,P]);let ie={...te?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(e){p.current=!0,O&&sA.has(e.key)&&e.stopPropagation()},onMouseMove(){p.current=!1},onScroll(e){te||re(e.currentTarget)},...C&&{style:te?{height:`100%`}:TM}},ae=TS(`div`,e,{ref:[t,c],state:H,stateAttributesMapping:LM,props:[I,ie,Tj(L),{className:!te&&C?jM.className:void 0},o]});return(0,y.jsxs)(b.Fragment,{children:[!M&&jM.getElement(j),(0,y.jsx)(JE,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:ae})]})});function zM(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function BM(e){return tM(e.scrollHeight,e.clientHeight)}function VM(e){return UD.getScale(e)}function HM(e,t,n){return e/n[t]}function UM(e,t){return fw({x:HM(e.x,`x`,t),y:HM(e.y,`y`,t),width:HM(e.width,`x`,t),height:HM(e.height,`y`,t)})}var WM=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function GM(e){let{style:t}=e,n={};for(let[e,r]of WM)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of WM){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var KM=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=zj(),{alignItemWithTriggerActive:c}=CM(),l=EO(o,$j.hasScrollArrows),u=EO(o,$j.openMethod),d=EO(o,$j.multiple),f={id:`${EO(o,$j.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:TM},className:l&&u!==`touch`?jM.className:void 0};return TS(`div`,e,{ref:[t,Z(e=>{o.set(`listElement`,e)})],props:[f,a]})}),qM=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function JM(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=_M(),f=b.useRef(-1),[p,m]=b.useState(a??(i===qM.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=b.useRef(null),g=b.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return Q(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),Q(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),b.useMemo(()=>({ref:g,index:p}),[p,g])}var YM=b.createContext(void 0);function XM(){let e=b.useContext(YM);if(!e)throw Error(rS(57));return e}var ZM=b.memo(b.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,style:c,...l}=e,u=b.useRef(null),d=JM({label:a,textRef:u,indexGuessBehavior:qM.GuessFromOrder}),{store:f,getItemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:x,selectedItemTextRef:S}=zj(),C=EO(f,$j.isActive,d.index),w=EO(f,$j.isSelected,d.index,i),T=EO(f,$j.isSelectedByFocus,d.index),E=EO(f,$j.isItemEqualToValue),D=d.index,O=D!==-1,k=b.useRef(null),A=iE(D);Q(()=>{if(!O)return;let e=v.current;return e[D]=i,()=>{delete e[D]}},[O,D,i,v]),Q(()=>{if(!O)return;let e=f.state.value,t=e;x&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&Hj(i,t,E)&&(f.set(`selectedIndex`,D),u.current&&(S.current=u.current))},[O,D,x,E,f,i,S]);let j={disabled:o,selected:w,highlighted:C},M=p({active:C,selected:w});M.id=void 0;let N=b.useRef(null),P=b.useRef(`mouse`),F=b.useRef(!1),{getButtonProps:I,buttonRef:L}=sS({disabled:o,focusableWhenDisabled:!0,native:s,composite:!0});function ee(e){let t=f.state.value;if(x){let n=Array.isArray(t)?t:[];h(w?Gj(n,i,E):[...n,i],DT(vT,e))}else h(i,DT(vT,e)),m(!1,DT(vT,e))}let R={role:`option`,"aria-selected":w,tabIndex:C?0:-1,onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(e){N.current=e.key,f.set(`activeIndex`,D),e.key===` `&&_.current&&e.preventDefault()},onClick(e){F.current=!1,!(e.type===`keydown`&&N.current===null)&&(o||e.type===`keydown`&&N.current===` `&&_.current||P.current!==`touch`&&!C||(N.current=null,ee(e.nativeEvent)))},onPointerEnter(e){P.current=e.pointerType},onPointerDown(e){P.current=e.pointerType,F.current=!0},onMouseUp(){if(o)return;if(F.current){F.current=!1;return}let e=!g.current.allowSelectedMouseUp&&w,t=!g.current.allowUnselectedMouseUp&&!w;e||t||P.current!==`touch`&&!C||k.current?.click()}},te=TS(`div`,e,{ref:[L,t,d.ref,k],state:j,props:[M,R,l,I]}),z=b.useMemo(()=>({selected:w,indexRef:A,textRef:u,selectedByFocus:T,hasRegistered:O}),[w,A,u,T,O]);return(0,y.jsx)(YM.Provider,{value:z,children:te})})),QM=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=XM();return n||r?(0,y.jsx)($M,{...e,ref:t}):null}),$M=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=XM(),c=b.useRef(null),{transitionStatus:l,setMounted:u}=uT(s),d=TS(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:oT});return lT({open:s,ref:c,onComplete(){s||u(!1)}}),d})),eN=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=XM(),{selectedItemTextRef:o}=zj(),{className:s,render:c,style:l,...u}=e;return TS(`div`,e,{ref:[b.useCallback(e=>{if(!e||!a)return;let t=o.current===null||!o.current.isConnected;(i||t&&n.current===0)&&(o.current=e)},[o,n,i,a]),t,r],props:u})})),tN=b.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=zj(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=CM(),_=EO(l,c?$j.scrollUpArrowVisible:$j.scrollDownArrowVisible),v=EO(l,$j.openMethod),y=_&&v!==`touch`,b=Zw(),x=c?g:h,{transitionStatus:S,setMounted:C}=uT(y);Q(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),lT({open:y,ref:x,onComplete(){y||C(!1)}});let w=TS(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=tM(e.scrollHeight,e.clientHeight),r=nM(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=nN(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s]});return y||o?w:null});function nN(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?nM(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?nM(l.offsetTop+l.offsetHeight-r+i,a):a}var rN=b.forwardRef(function(e,t){return(0,y.jsx)(tN,{...e,ref:t,direction:`down`})}),iN=b.forwardRef(function(e,t){return(0,y.jsx)(tN,{...e,ref:t,direction:`up`})}),aN=rM;function oN({className:e,...t}){return(0,y.jsx)(fM,{"data-slot":`select-value`,className:sx(`flex flex-1 text-left`,e),...t})}function sN({className:e,size:t=`default`,children:n,...r}){return(0,y.jsxs)(uM,{"data-slot":`select-trigger`,"data-size":t,className:sx(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,y.jsx)(pM,{render:(0,y.jsx)(Sy,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function cN({className:e,children:t,footer:n,side:r=`bottom`,sideOffset:i=4,align:a=`center`,alignOffset:o=0,alignItemWithTrigger:s=!0,...c}){return(0,y.jsx)(hM,{children:(0,y.jsx)(kM,{side:r,sideOffset:i,align:a,alignOffset:o,alignItemWithTrigger:s,className:`isolate z-50`,children:(0,y.jsxs)(RM,{"data-slot":`select-content`,"data-align-trigger":s,className:sx(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...c,children:[(0,y.jsx)(uN,{}),(0,y.jsx)(KM,{children:t}),(0,y.jsx)(dN,{}),n]})})})}function lN({className:e,children:t,...n}){return(0,y.jsxs)(ZM,{"data-slot":`select-item`,className:sx(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,y.jsx)(eN,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(QM,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(xy,{className:`pointer-events-none`})})]})}function uN({className:e,...t}){return(0,y.jsx)(iN,{"data-slot":`select-scroll-up-button`,className:sx(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(Cy,{})})}function dN({className:e,...t}){return(0,y.jsx)(rN,{"data-slot":`select-scroll-down-button`,className:sx(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(Sy,{})})}var fN=`h-7 justify-between gap-1.5 rounded-md border-border/60 bg-transparent px-2 text-xs font-normal text-foreground shadow-none focus-visible:border-ring/40 focus-visible:ring-1 focus-visible:ring-ring/40 dark:bg-transparent`,pN=`max-h-72 w-(--anchor-width) origin-(--transform-origin) gap-0 overflow-hidden p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,mN=`rounded-sm py-1.5 pr-7 pl-2 text-xs hover:bg-foreground/10 hover:text-foreground focus:bg-foreground/10 focus:text-foreground`,hN=({value:e,items:t,ariaLabel:n,placeholder:r,onValueChange:i,open:a,onOpenChange:o,onItemHover:s,triggerClassName:c,triggerStyle:l,footerSlot:u})=>{let d=(0,b.useMemo)(()=>t.find(t=>t.id===e),[t,e]),f=(0,b.useMemo)(()=>d?.itemStyle?{...d.itemStyle,...l}:l,[d?.itemStyle,l]);return(0,y.jsxs)(aN,{value:e,onValueChange:i,open:a,onOpenChange:o,children:[(0,y.jsx)(sN,{size:`sm`,"aria-label":n,className:sx(fN,`w-full`,c),style:f,children:(0,y.jsx)(oN,{placeholder:r,children:()=>d?.label||r})}),(0,y.jsx)(cN,{alignItemWithTrigger:!1,sideOffset:4,className:sx(pN,NA,PA),footer:u?(0,y.jsx)(`div`,{className:`border-t border-border/40 p-1`,children:u}):void 0,children:t.map(e=>(0,y.jsx)(lN,{value:e.id,className:mN,style:e.itemStyle,onPointerEnter:s?()=>s(e.id):void 0,onFocus:s?()=>s(e.id):void 0,children:e.label},e.id))})]})},gN=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,_N=Fd.map(e=>({id:e.id,label:e.name})),vN=({themeId:e,onThemeChange:t,onThemePreview:n,onOpenChange:r})=>(0,y.jsxs)(XA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(ZA,{className:gN,children:`Theme`}),(0,y.jsx)(hN,{value:e,items:_N,ariaLabel:`select theme`,placeholder:`Theme`,onValueChange:t,onOpenChange:r,onItemHover:n})]});function yN(e){return TS(e.defaultTagName??`div`,e,e)}var bN=Iy(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function xN({className:e,orientation:t,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:sx(bN({orientation:t}),e),...n})}function SN({className:e,render:t,...n}){return yN({defaultTagName:`div`,props:Hx({className:sx(`flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e)},n),render:t,state:{slot:`button-group-text`}})}var CN={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1};function wN({value:e,min:t,max:n,step:r,onChange:i}){let a=(0,b.useRef)(null),o=(0,b.useRef)(e);return{onPointerDown:t=>{if(t.button===0){try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}a.current=t.clientX,o.current=e}},onPointerMove:e=>{let s=a.current;if(s===null)return;let c=e.clientX-s,l=Math.round(c/5);if(l===0)return;let u=o.current+l*r;i(Math.max(t,Math.min(n,u)))},onPointerUp:e=>{if(a.current!==null){try{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}catch{}a.current=null}},onPointerLeave:e=>{if(a.current===null)return;let t=!1;try{t=e.currentTarget.hasPointerCapture(e.pointerId)}catch{}t||(a.current=null)},onKeyDown:a=>{if(a.key===`Home`){a.preventDefault(),i(t);return}if(a.key===`End`){a.preventDefault(),i(n);return}let o=CN[a.key];o!==void 0&&(a.preventDefault(),i(Math.max(t,Math.min(n,e+o*r))))}}}var TN=e=>String(e),EN=`size-7 rounded-none border-0 bg-transparent text-foreground hover:bg-foreground/10 hover:text-foreground disabled:opacity-30 [&_svg]:size-3.5`,DN=`h-7 min-w-[3rem] cursor-ew-resize touch-none justify-center border-y-0 border-r border-l! border-border/60 bg-transparent px-1.5 text-xs font-medium tabular-nums text-foreground select-none hover:bg-foreground/5 focus-visible:outline-none focus-visible:bg-foreground/5`,ON=({value:e,min:t,max:n,step:r,ariaLabel:i,decrementAriaLabel:a,incrementAriaLabel:o,formatDisplay:s=TN,onValueChange:c})=>{let l=wN({value:e,min:t,max:n,step:r,onChange:c});return(0,y.jsxs)(xN,{"aria-label":i,className:`h-7 overflow-hidden rounded-md border border-border/60`,children:[(0,y.jsx)(NS,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e-r),disabled:e<=t,"aria-label":a,className:EN,children:(0,y.jsx)(Ey,{})}),(0,y.jsx)(SN,{role:`slider`,tabIndex:0,"aria-label":i,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-valuetext":s(e),"aria-orientation":`horizontal`,title:`Drag or use arrow keys to adjust`,className:DN,...l,onPointerCancel:l.onPointerUp,children:s(e)}),(0,y.jsx)(NS,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e+r),disabled:e>=n,"aria-label":o,className:EN,children:(0,y.jsx)(Oy,{})})]})},kN=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,AN=`text-xs font-normal text-muted-foreground`,jN=e=>e.toFixed(1),MN=({fontId:e,fontItems:t,isFontSelectOpen:n,onFontChange:r,onFontPreview:i,onFontSelectOpenChange:a,onOpenLocalFontPicker:o,fontSize:s,onFontSizeChange:c,lineHeight:l,onLineHeightChange:u})=>(0,y.jsxs)(XA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(ZA,{className:kN,children:`Font`}),(0,y.jsx)(hN,{value:e,items:t,ariaLabel:`select font`,placeholder:`Font`,open:n,onValueChange:r,onOpenChange:a,onItemHover:i,footerSlot:(0,y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs text-muted-foreground outline-none transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:bg-foreground/10 focus-visible:text-foreground`,onClick:o,children:[(0,y.jsx)(Dy,{className:`size-3`}),(0,y.jsx)(`span`,{children:`Local font…`})]})}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:AN,children:`Size`}),(0,y.jsx)(ON,{value:s,min:9,max:24,step:1,ariaLabel:`terminal font size`,decrementAriaLabel:`decrease font size`,incrementAriaLabel:`increase font size`,onValueChange:c})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:AN,children:`Line height`}),(0,y.jsx)(ON,{value:l,min:1,max:2,step:ad,ariaLabel:`terminal line height`,decrementAriaLabel:`decrease line height`,incrementAriaLabel:`increase line height`,formatDisplay:jN,onValueChange:u})]})]}),NN=b.createContext(void 0);function PN(){let e=b.useContext(NN);if(e===void 0)throw Error(rS(63));return e}var FN=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),IN={...RS,checked(e){return e?{[FN.checked]:``}:{[FN.unchecked]:``}}},LN=b.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...x}=e,{clearErrors:S}=HS(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,shouldValidateOnChange:k,validationMode:A,disabled:j,name:M,validation:N}=BS(),{labelId:P}=YS(),F=j||m,I=M??l,L=Z(d),ee=b.useRef(null),R=uS(ee,c,N.inputRef),te=b.useRef(null),z=qS(),B=$S({id:s,implicit:!1,controlRef:te}),V=u?void 0:B,[ne,re]=dT({controlled:n,default:!!i,name:`Switch`,state:`checked`});fT(te,{id:z,value:ne}),Q(()=>{ee.current&&D(ee.current.checked)},[ee,D]),wk(ne,()=>{S(I),T(ne!==E.initialValue),D(ne),k()?N.commit(ne):N.commit(ne,!0)});let{getButtonProps:H,buttonRef:ie}=sS({disabled:F,native:u}),ae=XS(a,P,ee,!u,V),oe={id:u?B:z,role:`switch`,"aria-checked":ne,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ae,onFocus(){F||O(!0)},onBlur(){let e=ee.current;!e||F||(w(!0),O(!1),A===`onBlur`&&N.commit(e.checked))},onClick(e){f||F||(e.preventDefault(),ee.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},se=b.useMemo(()=>Hx({checked:ne,disabled:F,form:o,id:V,name:I,required:p,style:I?cE:sE,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:R,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=DT(pT,e.nativeEvent);L?.(t,n),!n.isCanceled&&re(t)},onFocus(){te.current?.focus()}},N.getInputValidationProps,_===void 0?xS:{value:_}),[ne,F,o,R,V,I,L,f,p,re,N,_]),ce=b.useMemo(()=>({...C,checked:ne,disabled:F,readOnly:f,required:p}),[C,ne,F,f,p]),le=TS(`span`,e,{state:ce,ref:[t,te,ie],props:[oe,N.getValidationProps,x,H],stateAttributesMapping:IN});return(0,y.jsxs)(NN.Provider,{value:ce,children:[le,!ne&&I&&g!==void 0&&(0,y.jsx)(`input`,{type:`hidden`,form:o,name:I,value:g}),(0,y.jsx)(`input`,{...se,suppressHydrationWarning:!0})]})}),RN=b.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=BS(),s=PN();return TS(`span`,e,{state:{...o,...s},ref:t,stateAttributesMapping:IN,props:a})});function zN({className:e,size:t=`default`,...n}){return(0,y.jsx)(LN,{"data-slot":`switch`,"data-size":t,className:sx(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,y.jsx)(RN,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%_-_2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%_-_2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}var BN=[{id:`block`,name:`Block`},{id:`bar`,name:`Bar`},{id:`underline`,name:`Underline`}],VN=`block`,HN=BN.map(e=>e.id),UN=e=>typeof e==`string`&&HN.includes(e),WN=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,GN=`text-xs font-normal text-muted-foreground`,KN=BN.map(e=>({id:e.id,label:e.name})),qN=({cursorStyle:e,onCursorStyleChange:t,onCursorStyleSelectOpenChange:n,onCursorStyleHover:r,cursorBlink:i,onCursorBlinkChange:a})=>(0,y.jsxs)(XA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(ZA,{className:WN,children:`Cursor`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:GN,children:`Style`}),(0,y.jsx)(hN,{value:e,items:KN,ariaLabel:`select cursor style`,placeholder:`Cursor style`,triggerClassName:`w-fit min-w-[7rem]`,onValueChange:t,onOpenChange:n,onItemHover:r})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:GN,children:`Blink`}),(0,y.jsx)(zN,{"aria-label":`toggle cursor blink`,checked:i,onCheckedChange:a})]})]}),JN=[{value:1e3,label:`1k lines`},{value:1e4,label:`10k lines`},{value:5e4,label:`50k lines`},{value:1e5,label:`100k lines`}],YN=1e4,XN=JN.map(e=>e.value),ZN=e=>XN.includes(e),QN=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,$N=`text-xs font-normal text-muted-foreground`,eP=JN.map(e=>({id:String(e.value),label:e.label})),tP=({scrollback:e,onScrollbackChange:t,scrollOnUserInput:n,onScrollOnUserInputChange:r})=>(0,y.jsxs)(XA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(ZA,{className:QN,children:`Scrollback`}),(0,y.jsx)(hN,{value:String(e),items:eP,ariaLabel:`select scrollback`,placeholder:`Scrollback`,onValueChange:t}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(Pj,{children:[(0,y.jsx)(Fj,{render:(0,y.jsx)(`span`,{className:$N}),children:`Pin to bottom on input`}),(0,y.jsx)(Ij,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, typing scrolls the viewport back to the bottom. When off, the viewport stays where you scrolled — useful for reading history while typing.`})]}),(0,y.jsx)(zN,{"aria-label":`toggle pin to bottom on input`,checked:n,onCheckedChange:r})]})]});function nP(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=dT({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=uT(o,!0,!0),[d,f]=b.useState(o),[{height:p,width:m},h]=b.useState({height:void 0,width:void 0}),g=qS(),[_,v]=b.useState(),y=_??g,[x,S]=b.useState(!1),[C,w]=b.useState(!1),T=b.useRef(null),E=b.useRef(null),D=b.useRef(null),O=b.useRef(null),k=cT(O,!1),A=Z(e=>{let t=!o,n=DT(mT,e.nativeEvent);if(r(t,n),n.isCanceled)return;let i=O.current;E.current===`css-animation`&&i!=null&&i.style.removeProperty(`animation-name`),!x&&!C&&(E.current!=null&&E.current!==`css-animation`&&!c&&t&&l(!0),E.current===`css-animation`&&(!d&&t&&f(!0),!c&&t&&l(!0))),s(t),E.current===`none`&&c&&!t&&l(!1)});return Q(()=>{a&&E.current===`none`&&!o&&l(!1)},[a,o,t,l]),b.useMemo(()=>({abortControllerRef:T,animationTypeRef:E,disabled:i,handleTrigger:A,height:p,mounted:c,open:o,panelId:y,panelRef:O,runOnceAnimationsFinish:k,setDimensions:h,setHiddenUntilFound:S,setKeepMounted:w,setMounted:l,setOpen:s,setPanelIdState:v,setVisible:f,transitionDimensionRef:D,transitionStatus:u,visible:d,width:m}),[T,E,i,A,p,c,o,y,O,k,h,S,w,l,s,f,D,u,d,m])}var rP=b.createContext(void 0);function iP(){let e=b.useContext(rP);if(e===void 0)throw Error(rS(15));return e}var aP=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=rT.startingStyle]=`startingStyle`,e[e.endingStyle=rT.endingStyle]=`endingStyle`,e}({}),oP=function(e){return e.panelOpen=`data-panel-open`,e}({}),sP={[aP.open]:``},cP={[aP.closed]:``},lP={open(e){return e?{[oP.panelOpen]:``}:null}},uP={open(e){return e?sP:cP},...oT},dP=b.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=Z(o),d=nP({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=b.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=b.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=TS(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:uP});return(0,y.jsx)(rP.Provider,{value:p,children:m})}),fP={...lP,...oT},pP=b.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=iP(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=sS({disabled:c,focusableWhenDisabled:!0,native:d}),g=b.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return TS(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:fP})}),mP=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function hP(e){let{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:a,keepMounted:o,id:s,mounted:c,onOpenChange:l,open:u,panelRef:d,runOnceAnimationsFinish:f,setDimensions:p,setMounted:m,setOpen:h,setVisible:g,transitionDimensionRef:_,visible:v,width:y}=e,x=b.useRef(!1),S=b.useRef(null),C=b.useRef(u),w=b.useRef(u),T=tT(),E=b.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=uS(r,d,Z(e=>{if(!e)return;if(n.current==null||_.current==null){let t=getComputedStyle(e),r=t.animationName!==`none`&&t.animationName!==``,i=t.transitionDuration!==`0s`&&t.transitionDuration!==``;r&&i||(t.animationName===`none`&&t.transitionDuration!==`0s`?n.current=`css-transition`:t.animationName!==`none`&&t.transitionDuration===`0s`?n.current=`css-animation`:n.current=`none`),e.getAttribute(mP.orientation)===`horizontal`||t.transitionProperty.indexOf(`width`)>-1?_.current=`width`:_.current=`height`}if(n.current!==`css-transition`)return;(i===void 0||y===void 0)&&(p({height:e.scrollHeight,width:e.scrollWidth}),w.current&&e.style.setProperty(`transition-duration`,`0s`));let t=-1,r=-1;return t=eT.request(()=>{w.current=!1,r=eT.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{eT.cancel(t),eT.cancel(r)}}));return Q(()=>{if(n.current!==`css-transition`)return;let e=d.current;if(!e)return;let r=-1;if(t.current!=null&&(t.current.abort(),t.current=null),u){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)}),!w.current&&!o&&e.setAttribute(aP.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=eT.request(()=>{Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})})}else{if(e.scrollHeight===0&&e.scrollWidth===0)return;p({height:e.scrollHeight,width:e.scrollWidth});let n=new AbortController;t.current=n;let r=n.signal,i=null,a=aP.endingStyle;return i=new MutationObserver(o=>{o.some(e=>e.type===`attributes`&&e.attributeName===a)&&(i?.disconnect(),i=null,f(()=>{p({height:0,width:0}),e.style.removeProperty(`content-visibility`),m(!1),t.current===n&&(t.current=null)},r))}),i.observe(e,{attributes:!0,attributeFilter:[a]}),()=>{i?.disconnect(),T.cancel(),t.current===n&&(n.abort(),t.current=null)}}return()=>{eT.cancel(r)}},[t,n,T,a,o,c,u,d,f,p,m]),Q(()=>{if(n.current!==`css-animation`)return;let e=d.current;e&&(S.current=e.style.animationName||S.current,e.style.setProperty(`animation-name`,`none`),p({height:e.scrollHeight,width:e.scrollWidth}),!C.current&&!x.current&&e.style.removeProperty(`animation-name`),u?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),g(!0)):(t.current=new AbortController,f(()=>{m(!1),g(!1),t.current=null},t.current.signal)))},[t,n,u,d,f,p,m,g,v]),Jw(()=>{let e=eT.request(()=>{C.current=!1});return()=>eT.cancel(e)}),Q(()=>{if(!a)return;let e=d.current;if(!e)return;let t=-1,n=-1;return u&&x.current&&(e.style.transitionDuration=`0s`,p({height:e.scrollHeight,width:e.scrollWidth}),t=eT.request(()=>{x.current=!1,n=eT.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{eT.cancel(t),eT.cancel(n)}},[a,u,d,p]),Q(()=>{let e=d.current;e&&a&&E&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(aP.startingStyle,``))},[a,E,n,d]),b.useEffect(function(){let e=d.current;if(!e)return;function t(e){x.current=!0,h(!0),l(!0,DT(pT,e))}return BT(e,`beforematch`,t)},[l,d,h]),b.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var gP=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),_P=b.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{abortControllerRef:l,animationTypeRef:u,height:d,mounted:f,onOpenChange:p,open:m,panelId:h,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setHiddenUntilFound:y,setKeepMounted:x,setMounted:S,setPanelIdState:C,setOpen:w,setVisible:T,state:E,transitionDimensionRef:D,visible:O,width:k,transitionStatus:A}=iP(),j=r??!1,M=i??!1;Q(()=>{if(o)return C(o),()=>{C(void 0)}},[o,C]),Q(()=>{y(j)},[y,j]),Q(()=>{x(M)},[x,M]);let{props:N}=hP({abortControllerRef:l,animationTypeRef:u,externalRef:t,height:d,hiddenUntilFound:j,id:h,keepMounted:M,mounted:f,onOpenChange:p,open:m,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setMounted:S,setOpen:w,setVisible:T,transitionDimensionRef:D,visible:O,width:k});lT({open:m&&A===`idle`,ref:g,onComplete(){m&&v({height:void 0,width:void 0})}});let P=TS(`div`,e,{state:b.useMemo(()=>({...E,transitionStatus:A}),[E,A]),ref:[t,g],props:[N,{style:{[gP.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[gP.collapsiblePanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:uP});return M||j||f?P:null});function vP({...e}){return(0,y.jsx)(dP,{"data-slot":`collapsible`,...e})}function yP({...e}){return(0,y.jsx)(pP,{"data-slot":`collapsible-trigger`,...e})}function bP({...e}){return(0,y.jsx)(_P,{"data-slot":`collapsible-content`,...e})}var xP=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,SP=`text-xs font-normal text-muted-foreground`,CP=({label:e,value:t,title:n,valueClassName:r})=>(0,y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,y.jsx)(`dt`,{className:SP,children:e}),(0,y.jsx)(`dd`,{title:n??t,className:sx(`min-w-0 truncate text-right text-foreground/90`,r),children:t})]}),wP=({sessionInfo:e})=>e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsxs)(vP,{defaultOpen:!1,children:[(0,y.jsx)(yP,{render:(0,y.jsxs)(`button`,{type:`button`,className:`group/shell flex w-full items-center justify-between gap-2 rounded-sm py-1 text-left transition-colors outline-none hover:text-foreground/90 focus-visible:text-foreground/90`,children:[(0,y.jsx)(`span`,{className:xP,children:`Shell`}),(0,y.jsx)(Sy,{className:`size-3 text-muted-foreground/60 transition-transform duration-200 ease-snappy will-change-transform group-aria-expanded/shell:rotate-180`})]})}),(0,y.jsx)(bP,{className:`h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-snappy data-closed:h-0`,children:(0,y.jsxs)(`dl`,{className:`flex flex-col gap-1 pt-2 text-xs`,children:[(0,y.jsx)(CP,{label:`Name`,value:e.shellName}),(0,y.jsx)(CP,{label:`Path`,value:e.shell,title:e.shell}),(0,y.jsx)(CP,{label:`PID`,value:String(e.pid),valueClassName:`tabular-nums`}),(0,y.jsx)(CP,{label:`Cwd`,value:e.cwd,title:e.cwd})]})})]})]}):null,TP=Iy(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function EP({className:e,variant:t=`default`,render:n,...r}){return yN({defaultTagName:`span`,props:Hx({className:sx(TP({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var DP=Object.fromEntries(Ad.map(e=>[e.id,{fontFamily:e.family}])),OP=Ad.map(e=>({id:e.id,label:e.name,itemStyle:DP[e.id]})),kP=e=>({id:md,label:(0,y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,y.jsx)(`span`,{className:`truncate`,children:e}),(0,y.jsx)(EP,{variant:`secondary`,className:`h-4 px-1.5 text-[10px] font-medium`,children:`Local`})]}),itemStyle:{fontFamily:`"${wd(e)}", ui-monospace, monospace`}}),AP=({onThemeChange:e,onThemePreview:t,fontId:n,onFontChange:r,onFontPreview:i,localFontFamily:a,onCursorStyleChange:o,onCursorStylePreview:s,onScrollbackChange:c})=>{let[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(!1);return{isDialogOpen:l,isFontSelectOpen:d,isLocalFontPickerOpen:p,setIsLocalFontPickerOpen:m,fontItems:(0,b.useMemo)(()=>n!==`local`||!a?OP:[...OP,kP(a)],[n,a]),handleDialogOpenChange:e=>{u(e),e||(f(!1),m(!1),t?.(null),i?.(null),s?.(null))},openLocalFontPicker:()=>{f(!1),m(!0)},handleThemeChange:t=>{t&&e(t)},handleFontChange:e=>{e&&r(e)},handleCursorStyleChange:e=>{UN(e)&&o(e)},handleScrollbackChange:e=>{if(e===null)return;let t=Number(e);ZN(t)&&c(t)},handleThemeSelectOpenChange:e=>{e||t?.(null)},handleFontSelectOpenChange:e=>{f(e),e||i?.(null)},handleCursorStyleSelectOpenChange:e=>{e||s?.(null)},handleCursorStyleHover:e=>{UN(e)&&s?.(e)}}},jP=e=>{let{isDialogOpen:t,isFontSelectOpen:n,isLocalFontPickerOpen:r,setIsLocalFontPickerOpen:i,fontItems:a,handleDialogOpenChange:o,openLocalFontPicker:s,handleThemeChange:c,handleFontChange:l,handleCursorStyleChange:u,handleScrollbackChange:d,handleThemeSelectOpenChange:f,handleFontSelectOpenChange:p,handleCursorStyleSelectOpenChange:m,handleCursorStyleHover:h}=AP(e),{themeId:g,onThemePreview:_,fontId:v,onFontPreview:b,localFontFamily:x,onLocalFontChange:S,fontSize:C,onFontSizeChange:w,lineHeight:T,onLineHeightChange:E,cursorStyle:D,onCursorStylePreview:O,cursorBlink:k,onCursorBlinkChange:A,scrollback:j,scrollOnUserInput:M,onScrollOnUserInputChange:N,sessionInfo:P}=e;return(0,y.jsxs)(EA,{open:t,onOpenChange:o,children:[(0,y.jsxs)(Pj,{children:[(0,y.jsx)(Fj,{render:(0,y.jsx)(DA,{render:(0,y.jsx)(NS,{variant:`ghost`,size:`icon-sm`,"aria-label":`terminal settings`,className:`hover:text-foreground`})}),children:(0,y.jsx)(Ay,{})}),t?null:(0,y.jsx)(Ij,{side:`bottom`,sideOffset:8,children:`Settings`})]}),(0,y.jsxs)(AA,{className:sx(`max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto p-4 sm:max-w-md`,NA),children:[(0,y.jsx)(jA,{className:`mb-4 pr-8`,children:(0,y.jsx)(MA,{children:`Settings`})}),(0,y.jsxs)(JA,{className:`gap-3`,children:[(0,y.jsx)(vN,{themeId:g,onThemeChange:c,onThemePreview:_,onOpenChange:f}),(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsx)(MN,{fontId:v,fontItems:a,isFontSelectOpen:n,onFontChange:l,onFontPreview:b,onFontSelectOpenChange:p,onOpenLocalFontPicker:s,fontSize:C,onFontSizeChange:w,lineHeight:T,onLineHeightChange:E}),(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsx)(qN,{cursorStyle:D,onCursorStyleChange:u,onCursorStyleSelectOpenChange:m,onCursorStyleHover:O?h:void 0,cursorBlink:k,onCursorBlinkChange:A}),(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsx)(tP,{scrollback:j,onScrollbackChange:d,scrollOnUserInput:M,onScrollOnUserInputChange:N}),(0,y.jsx)(wP,{sessionInfo:P??null})]})]}),(0,y.jsx)(WA,{open:r,onOpenChange:i,currentFamily:x,onApply:S})]})},MP=({activeThemeId:e,onThemeChange:t,onThemePreview:n,activeFontId:r,onFontChange:i,onFontPreview:a,activeLocalFontFamily:o,onLocalFontChange:s,activeFontSize:c,onFontSizeChange:l,activeLineHeight:u,onLineHeightChange:d,activeCursorStyle:f,onCursorStyleChange:p,onCursorStylePreview:m,activeCursorBlink:h,onCursorBlinkChange:g,activeScrollback:_,onScrollbackChange:v,activeScrollOnUserInput:b,onScrollOnUserInputChange:x,sessionInfo:S,newTabUrl:C,onOpenSearch:w,isMac:T,isSearchOpen:E})=>E?null:(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,"data-terminal-toolbar":!0,className:`absolute top-2 right-3 z-10 flex items-center gap-0.5 rounded-md border border-border/60 bg-background/70 p-0.5 text-muted-foreground shadow-xs backdrop-blur-md`,children:[(0,y.jsx)(jP,{themeId:e,onThemeChange:t,onThemePreview:n,fontId:r,onFontChange:i,onFontPreview:a,localFontFamily:o,onLocalFontChange:s,fontSize:c,onFontSizeChange:l,lineHeight:u,onLineHeightChange:d,cursorStyle:f,onCursorStyleChange:p,onCursorStylePreview:m,cursorBlink:h,onCursorBlinkChange:g,scrollback:_,onScrollbackChange:v,scrollOnUserInput:b,onScrollOnUserInputChange:x,sessionInfo:S}),(0,y.jsxs)(Pj,{children:[(0,y.jsx)(Fj,{render:(0,y.jsx)(NS,{variant:`ghost`,size:`icon-sm`,onClick:w,"aria-label":`find in terminal`,className:`hover:text-foreground`}),children:(0,y.jsx)(ky,{})}),(0,y.jsxs)(Ij,{side:`bottom`,sideOffset:8,children:[`Find `,T?`(⌘F)`:`(Ctrl+F)`]})]}),(0,y.jsxs)(Pj,{children:[(0,y.jsx)(Fj,{render:(0,y.jsx)(NS,{variant:`ghost`,size:`icon-sm`,nativeButton:!1,"aria-label":`open a new shell in a new browser tab`,render:(0,y.jsx)(`a`,{href:C,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`}),children:(0,y.jsx)(Oy,{})}),(0,y.jsx)(Ij,{side:`bottom`,sideOffset:8,children:`New shell (new tab)`})]})]}),NP=({exitInfo:e})=>e?(0,y.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10 inline-flex items-center rounded-md border border-red-500/30 bg-red-500/10 px-2 py-0.5 text-xs font-medium text-red-400`,children:e.reason===`shell-exited`?e.exitCode===null?`exited`:`exited · code ${e.exitCode}`:`disconnected · code ${e.closeCode}`}):null,PP=(e,t)=>{let n=null,r=()=>{n=null,e.style.height=`${t.height}px`,e.style.transform=t.offsetTop?`translateY(${t.offsetTop}px)`:``},i=()=>{n===null&&(n=window.requestAnimationFrame(r))};return i(),t.addEventListener(`resize`,i),t.addEventListener(`scroll`,i),()=>{n!==null&&window.cancelAnimationFrame(n),t.removeEventListener(`resize`,i),t.removeEventListener(`scroll`,i),e.style.height=``,e.style.transform=``}},FP=(e,t,n)=>{(0,b.useEffect)(()=>{if(!t||!n)return;let r=e.current,i=window.visualViewport;if(!(!r||!i))return PP(r,i)},[t,n,e])},IP=e=>{(0,b.useEffect)(()=>{if(!e)return;let t=new URL(window.location.href);t.searchParams.set(`cwd`,e),window.history.replaceState(null,``,t)},[e])},LP=(e,t)=>{(0,b.useEffect)(()=>{t?.(e)},[e,t])},RP=()=>typeof navigator<`u`&&navigator.vendor===`Apple Computer, Inc.`,zP=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},BP=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,VP=()=>({isMac:(0,b.useMemo)(zP,[]),isTouchDevice:(0,b.useMemo)(BP,[]),isAppleWebKit:(0,b.useMemo)(RP,[])}),HP=(e,t,n)=>{(0,b.useEffect)(()=>{if(!e)return;let r=window.setInterval(()=>{t()},n);return()=>window.clearInterval(r)},[e,t,n])},UP=(e,t,n)=>{let[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(0),[s,c]=(0,b.useState)(``),[l,u]=(0,b.useState)({resultIndex:-1,resultCount:0}),d=(0,b.useRef)(null),f=(0,b.useCallback)(t=>{if(!t){e.current?.clearDecorations(),u({resultIndex:-1,resultCount:0});return}e.current?.findNext(t)},[e]),p=(0,b.useCallback)(t=>{t&&e.current?.findPrevious(t)},[e]),m=(0,b.useCallback)(()=>{i(!1),c(``),u({resultIndex:-1,resultCount:0}),e.current?.clearDecorations(),t.current?.()},[e,t]),h=(0,b.useCallback)(()=>{i(!0),o(e=>e+1)},[]);return d.current=h,{isSearchOpen:r,setIsSearchOpen:i,searchOpenAttempt:a,searchQuery:s,searchResults:l,setSearchResults:u,openSearchOverlayRef:d,openSearchOverlay:h,handleSearchInputChange:(0,b.useCallback)(e=>{let t=e.target.value;c(t),f(t)},[f]),handleSearchKeyDown:(0,b.useCallback)(e=>{if(ny(e.nativeEvent,n)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),m();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?p(s):f(s))},[m,f,p,n,s]),handleSearchClose:m,findNextMatch:f,findPreviousMatch:p}},WP=(e,t,n)=>{(0,b.useEffect)(()=>{if(!e)return;let t=n.current;t&&(t.focus(),t.select())},[e,t,n])},GP=async e=>{if(!(typeof document>`u`)&&e.name)try{await Promise.all([document.fonts.load(`16px "${e.name}"`),document.fonts.load(`bold 16px "${e.name}"`)])}catch{}},KP=(e,t,n,r)=>{n?.clearTextureAtlas(),e.options.fontFamily=``,e.options.fontFamily=r,ly(e,t),n?.clearTextureAtlas()},qP=(e,t,n,r)=>{(0,b.useEffect)(()=>{if(!e.current)return;let i=!1;return GP(r).then(()=>{if(i)return;let a=e.current;if(!a)return;let o=t.current;o&&KP(a,o,n.current,r.family)}),()=>{i=!0}},[r,e,t,n])},JP=(e,t,n,r)=>{(0,b.useEffect)(()=>{let i=e.current;if(!i)return;i.options.fontSize=n,i.options.lineHeight=r;let a=t.current;a&&ly(i,a)},[n,r,e,t])},YP=(e,t,n,r,i,a)=>{(0,b.useEffect)(()=>{let o=e.current;o&&(o.options.theme=t.colors,o.options.cursorStyle=n,o.options.cursorBlink=r,o.options.scrollback=i,o.options.scrollOnUserInput=a)},[t,n,r,i,a,e])},XP=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},ZP=1/ad,QP=e=>Math.round(e*ZP)/ZP,$P=e=>{if(!Number.isFinite(e))return id;let t=QP(e);return t<1?1:t>2?2:t},eF=(e,t,n)=>({load:()=>{if(typeof window>`u`)return t;try{let r=window.localStorage.getItem(e);return r===null||r===``?t:n?n(r):r}catch{return t}},store:t=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,String(t))}catch{}}}),tF=eF(pd,null,e=>e.trim()||null),nF=()=>tF.load(),rF=e=>tF.store(e),iF=eF(dd,Id,e=>Ld(e).id),aF=()=>iF.load(),oF=e=>iF.store(e),sF=eF(fd,jd,e=>e===`local`?tF.load()?md:jd:Md(e).id),cF=()=>sF.load(),lF=e=>sF.store(e),uF=eF(hd,13,e=>XP(Number(e))),dF=()=>uF.load(),fF=e=>uF.store(e),pF=eF(gd,id,e=>$P(Number(e))),mF=()=>pF.load(),hF=e=>pF.store(e),gF=eF(_d,VN,e=>UN(e)?e:VN),_F=()=>gF.load(),vF=e=>gF.store(e),yF=eF(vd,!0,e=>e===`true`?!0:e!==`false`),bF=()=>yF.load(),xF=e=>yF.store(e),SF=eF(yd,YN,e=>{let t=Number(e);return ZN(t)?t:YN}),CF=()=>SF.load(),wF=e=>SF.store(e),TF=eF(bd,!0,e=>e===`true`?!0:e!==`false`),EF=()=>TF.load(),DF=e=>TF.store(e),OF=(e,t,n)=>{let r=(0,b.useRef)(aF()),i=(0,b.useRef)(cF()),a=(0,b.useRef)(nF()),o=(0,b.useRef)(dF()),s=(0,b.useRef)(mF()),c=(0,b.useRef)(_F()),l=(0,b.useRef)(bF()),u=(0,b.useRef)(CF()),d=(0,b.useRef)(EF()),[f,p]=(0,b.useState)(r.current),[m,h]=(0,b.useState)(null),[g,_]=(0,b.useState)(i.current),[v,y]=(0,b.useState)(a.current),[x,S]=(0,b.useState)(null),[C,w]=(0,b.useState)(o.current),[T,E]=(0,b.useState)(s.current),[D,O]=(0,b.useState)(c.current),[k,A]=(0,b.useState)(null),[j,M]=(0,b.useState)(l.current),[N,P]=(0,b.useState)(u.current),[F,I]=(0,b.useState)(d.current),L=m??f,ee=(0,b.useMemo)(()=>Ld(L),[L]),R=x??g;return{initialThemeIdRef:r,initialFontIdRef:i,initialLocalFontFamilyRef:a,initialFontSizeRef:o,initialLineHeightRef:s,initialCursorStyleRef:c,initialCursorBlinkRef:l,initialScrollbackRef:u,initialScrollOnUserInputRef:d,activeThemeId:f,setActiveThemeId:p,previewThemeId:m,setPreviewThemeId:h,activeFontId:g,setActiveFontId:_,activeLocalFontFamily:v,setActiveLocalFontFamily:y,previewFontId:x,setPreviewFontId:S,activeFontSize:C,setActiveFontSize:w,activeLineHeight:T,setActiveLineHeight:E,activeCursorStyle:D,setActiveCursorStyle:O,previewCursorStyle:k,setPreviewCursorStyle:A,activeCursorBlink:j,setActiveCursorBlink:M,activeScrollback:N,setActiveScrollback:P,activeScrollOnUserInput:F,setActiveScrollOnUserInput:I,effectiveTheme:ee,effectiveFont:(0,b.useMemo)(()=>Md(R,v),[R,v]),newTabUrl:(0,b.useMemo)(()=>Qv(n),[n]),handleThemeChange:(0,b.useCallback)(e=>{p(e),h(null),oF(e)},[]),handlePreviewTheme:(0,b.useCallback)(e=>{h(e)},[]),handleFontChange:(0,b.useCallback)(e=>{_(e),S(null),lF(e)},[]),handlePreviewFont:(0,b.useCallback)(e=>{S(e)},[]),handleLocalFontChange:(0,b.useCallback)(e=>{y(e),_(md),S(null),rF(e),lF(md)},[]),handleFontSizeChange:(0,b.useCallback)(e=>{let t=XP(e);w(t),fF(t)},[]),handleLineHeightChange:(0,b.useCallback)(e=>{let t=$P(e);E(t),hF(t)},[]),handleCursorStyleChange:(0,b.useCallback)(e=>{O(e),A(null),vF(e)},[]),handlePreviewCursor:(0,b.useCallback)(e=>{A(e)},[]),handleCursorBlinkChange:(0,b.useCallback)(e=>{M(e),xF(e)},[]),handleScrollbackChange:(0,b.useCallback)(e=>{P(e),wF(e)},[]),handleScrollOnUserInputChange:(0,b.useCallback)(e=>{I(e),DF(e)},[])}},kF=(e,t,n)=>{(0,b.useEffect)(()=>{let r=e.current;if(!r)return;let i=0,a=0,o=!1,s=new AbortController,c=()=>{r.textarea&&(r.textarea.inputMode=``),r.focus()},l=()=>{t&&r.textarea&&(r.textarea.inputMode=`none`),r.focus()};if(n.current=l,t){let e=s.signal,t=()=>{r.textarea&&(r.textarea.inputMode=`none`)},n=()=>{r.textarea&&(r.textarea.blur(),r.textarea.inputMode=`none`)};t(),r.textarea?.addEventListener(`blur`,t,{signal:e});let l=window.visualViewport;if(l){let t=l.height,r=l.width;l.addEventListener(`resize`,()=>{let e=l.height,i=l.width,a=e>t+150,o=Math.abs(i-r)<20;a&&o&&n(),t=e,r=i},{signal:e})}r.element?.addEventListener(`touchstart`,e=>{if(e.touches.length!==1){o=!0;return}i=e.touches[0].clientX,a=e.touches[0].clientY,o=!1},{capture:!0,passive:!0,signal:e}),r.element?.addEventListener(`touchmove`,e=>{if(e.touches.length!==1){o=!0;return}Math.hypot(e.touches[0].clientX-i,e.touches[0].clientY-a)>10&&(o=!0)},{capture:!0,passive:!0,signal:e}),r.element?.addEventListener(`touchend`,e=>{if(o){e.preventDefault();return}c()},{capture:!0,passive:!1,signal:e})}return l(),()=>{s.abort(),n.current=null}},[e,t,n])},AF=(e,t)=>{(0,b.useEffect)(()=>()=>{e.current!==null&&(window.clearTimeout(e.current),e.current=null),t.current!==null&&(window.clearTimeout(t.current),t.current=null)},[e,t])},jF=(e,t)=>`\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,MF=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,NF=({terminalRef:e,flowControllerRef:t,exitedRef:n,lastTitleRef:r,resetFaviconRef:i,noteOutputActivityRef:a,liveCwdRef:o,isReconnectingRef:s,retryFeedbackTimerRef:c,copyFeedbackTimerRef:l,setExitInfo:u,setSessionInfo:d,setConsecutiveFailures:f,setHasCopiedRestartCommand:p,setIsRetryingConnection:m,setLiveCwd:h})=>{let g=(0,b.useRef)(null),_=(0,b.useRef)(null),v=(0,b.useCallback)(e=>{g.current?.readyState===WebSocket.OPEN&&g.current.send(JSON.stringify(e))},[]);return(0,b.useEffect)(()=>{let c=!1,l=!1,p=null,m=()=>{if(t.current?.clear(),c)return;let u=new WebSocket(Zv(o.current));u.binaryType=`arraybuffer`,g.current=u,u.addEventListener(`open`,()=>{c||g.current!==u||(l=!0,f(0),e.current&&v({type:`resize`,cols:e.current.cols,rows:e.current.rows}),s.current=!1)}),u.addEventListener(`message`,e=>{if(c||g.current!==u)return;if(e.data instanceof ArrayBuffer){t.current?.write(new Uint8Array(e.data)),a.current?.();return}if(typeof e.data!=`string`)return;let n;try{n=JSON.parse(e.data)}catch{return}if(typeof n!=`object`||!n||typeof n.type!=`string`)return;let o=n;if(o.type===`output`)t.current?.write(o.data),a.current?.();else if(o.type===`title`){let e=o.title.trim();if(!e)return;r.current=e,document.title=e}else o.type===`session`?(d({shell:o.shell,shellName:o.shellName,pid:o.pid,cwd:o.cwd}),h(o.cwd)):o.type===`cwd`?h(o.cwd):o.type===`exit`&&(i.current?.(),y(o.code))}),u.addEventListener(`close`,e=>{if(g.current===u&&(g.current=null,s.current=!1,!c&&!n.current)){if(l){console.warn(`[localterm] websocket closed: code=${e.code} reason=${JSON.stringify(e.reason)} wasClean=${e.wasClean}`),b(e.code,e.reason,e.wasClean);return}f(e=>e+1),p=window.setTimeout(m,nd)}}),u.addEventListener(`error`,()=>{console.warn(`[localterm] websocket error`);try{u.close()}catch{}})},y=t=>{n.current||(n.current=!0,i.current?.(),sf(`dead`),e.current?.write(MF(t)),document.title=`† ${r.current||`localterm`}`,u({reason:`shell-exited`,exitCode:t}),d(null))},b=(t,a,o)=>{n.current||(n.current=!0,i.current?.(),sf(`dead`),e.current?.write(jF(t,a)),document.title=`† ${r.current||`localterm`}`,u({reason:`connection-lost`,closeCode:t,closeReason:a,wasClean:o}),d(null))};return _.current=()=>{if(!c){n.current=!1,l=!1,u(null),d(null),f(0),sf(`idle`),p!==null&&(window.clearTimeout(p),p=null);try{g.current?.close()}catch{}g.current=null,m()}},m(),()=>{c=!0,_.current=null,p!==null&&window.clearTimeout(p);try{g.current?.close()}catch{}g.current=null}},[]),{send:v,triggerManualReconnect:(0,b.useCallback)(()=>{s.current||(s.current=!0,m(!0),_.current?.(),c.current!==null&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{c.current=null,m(!1)},800))},[]),copyRestartCommand:(0,b.useCallback)(()=>{navigator.clipboard.writeText(od).then(()=>{p(!0),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{l.current=null,p(!1)},sd)}).catch(()=>{})},[])}},PF=({onModalOpenChange:e}={})=>{let t=(0,b.useRef)(null),n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=(0,b.useRef)(null),a=(0,b.useRef)(null),o=(0,b.useRef)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(!1),d=(0,b.useRef)(null),f=(0,b.useRef)(null),p=(0,b.useRef)(!1),m=(0,b.useRef)(``),h=(0,b.useRef)(null),g=(0,b.useRef)(null),_=(0,b.useRef)(null),[v,x]=(0,b.useState)(null),[C,w]=(0,b.useState)(0),[T,E]=(0,b.useState)(!1),[O,k]=(0,b.useState)(!1),[A,j]=(0,b.useState)(null),[M,N]=(0,b.useState)(null),{initialThemeIdRef:P,initialFontIdRef:F,initialLocalFontFamilyRef:I,initialFontSizeRef:L,initialLineHeightRef:ee,initialCursorStyleRef:R,initialCursorBlinkRef:te,initialScrollbackRef:z,initialScrollOnUserInputRef:B,activeThemeId:V,setActiveThemeId:ne,activeFontId:re,setActiveFontId:H,activeLocalFontFamily:ie,setActiveLocalFontFamily:ae,activeFontSize:oe,setActiveFontSize:se,activeLineHeight:ce,setActiveLineHeight:le,activeCursorStyle:ue,setActiveCursorStyle:de,previewCursorStyle:fe,activeCursorBlink:pe,setActiveCursorBlink:me,activeScrollback:he,setActiveScrollback:ge,activeScrollOnUserInput:_e,setActiveScrollOnUserInput:ve,effectiveTheme:ye,effectiveFont:be,newTabUrl:xe,handleThemeChange:Se,handlePreviewTheme:Ce,handleFontChange:we,handlePreviewFont:Te,handleLocalFontChange:Ee,handleFontSizeChange:De,handleLineHeightChange:Oe,handleCursorStyleChange:ke,handlePreviewCursor:Ae,handleCursorBlinkChange:je,handleScrollbackChange:Me,handleScrollOnUserInputChange:Ne}=OF(r,i,M),{isMac:Pe,isTouchDevice:Fe,isAppleWebKit:Ie}=VP();FP(t,Fe,Ie),kF(r,Fe,d);let{isSearchOpen:Le,searchOpenAttempt:Re,searchQuery:ze,searchResults:Be,setSearchResults:Ve,openSearchOverlay:He,handleSearchInputChange:Ue,handleSearchKeyDown:We,findNextMatch:Ge,findPreviousMatch:Ke,openSearchOverlayRef:qe}=UP(o,d,Pe),Ye=fe??ue,Ze=ye.colors.background??`#101010`,{send:Qe,triggerManualReconnect:$e,copyRestartCommand:et}=NF({terminalRef:r,flowControllerRef:g,exitedRef:p,lastTitleRef:m,resetFaviconRef:h,noteOutputActivityRef:_,liveCwdRef:f,isReconnectingRef:u,retryFeedbackTimerRef:c,copyFeedbackTimerRef:l,setExitInfo:x,setSessionInfo:j,setConsecutiveFailures:w,setHasCopiedRestartCommand:E,setIsRetryingConnection:k,setLiveCwd:N,setActiveThemeId:ne,setActiveFontId:H,setActiveLocalFontFamily:ae,setActiveFontSize:se,setActiveLineHeight:le,setActiveCursorStyle:de,setActiveCursorBlink:me,setActiveScrollback:ge,setActiveScrollOnUserInput:ve,initialThemeIdRef:P,initialFontIdRef:F,initialLocalFontFamilyRef:I,initialFontSizeRef:L,initialLineHeightRef:ee,initialCursorStyleRef:R,initialCursorBlinkRef:te,initialScrollbackRef:z,initialScrollOnUserInputRef:B});(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let t=!1;p.current=!1,m.current=``;let s=null,c=null,l=`idle`;_.current=()=>{c!==null&&(window.clearTimeout(c),c=null),l===`idle`&&s===null&&(s=window.setTimeout(()=>{s=null,!(t||p.current)&&(l=`active`,sf(`active`))},250)),c=window.setTimeout(()=>{c=null,s!==null&&(window.clearTimeout(s),s=null),l===`active`&&(l=`idle`,sf(`idle`))},750)};let u=()=>{s!==null&&(window.clearTimeout(s),s=null),c!==null&&(window.clearTimeout(c),c=null),l===`active`&&(l=`idle`,sf(`idle`))};h.current=u;let f=Md(F.current,I.current),v=new td({allowProposedApi:!0,cursorBlink:te.current,cursorStyle:R.current,fontFamily:f.family,fontSize:L.current,lineHeight:ee.current,scrollback:z.current,theme:Ld(P.current).colors,macOptionIsMeta:!0,scrollOnUserInput:B.current});r.current=v;let y=new D;i.current=y,v.loadAddon(y),v.loadAddon(new Pn),v.loadAddon(new S),v.loadAddon(new Je),v.loadAddon(new Xe),v.loadAddon(new On);let b=new dt;v.loadAddon(b),o.current=b;let x=b.onDidChangeResults(Ve);v.open(e);try{let e=new oa;e.onContextLoss(()=>{a.current===e&&(a.current=null),e.dispose()}),v.loadAddon(e),a.current=e}catch{a.current=null}let C=v.textarea;C&&(C.autocomplete=`off`,C.setAttribute(`autocapitalize`,`off`),C.setAttribute(`autocorrect`,`off`),C.spellcheck=!1);let w=iy(v);v.parser.registerCsiHandler({final:`J`},cf),v.parser.registerCsiHandler({prefix:`?`,final:`J`},cf);let T=uy({terminal:v,fitAddon:y,sendResize:(e,t)=>Qe({type:`resize`,cols:e,rows:t}),resizeDebounceMs:80});g.current=$v({terminalWrite:(e,t)=>v.write(e,t),sendFlowPause:()=>Qe({type:`flow-pause`}),sendFlowResume:()=>Qe({type:`flow-resume`}),captureScrollAnchor:()=>T.captureAnchor(),restoreScrollAnchor:e=>T.restoreAnchor(e),hasScrollRestore:()=>T.hasResizeRestore(),restoreScrollFromResize:()=>T.restoreResizeScroll(),isExited:()=>p.current}),ay(v,{isMac:Pe,getKittyFlags:()=>w.getFlags(),openFindOverlay:()=>qe.current?.(),sendInput:e=>Qe({type:`input`,data:e}),isTouchDevice:Fe}),oy(v);let E=v.onTitleChange(e=>{if(p.current)return;let t=e.trim();t&&(m.current=t,document.title=t||`localterm`)});v.onData(e=>{for(let t of Rd(e,lf))Qe({type:`input`,data:t})}),v.onResize(({cols:e,rows:t})=>Qe({type:`resize`,cols:e,rows:t}));let O=new ResizeObserver(()=>T.scheduleFit());return O.observe(e),T.fitToContainer(),()=>{t=!0,d.current=null,qe.current=null,o.current=null,r.current=null,i.current=null,a.current=null,E.dispose(),x.dispose(),T.cleanupResizeScroll(),u(),O.disconnect(),v.dispose(),document.title=`localterm`}},[]),JP(r,i,oe,ce),YP(r,ye,Ye,pe,he,_e),qP(r,i,a,be),WP(Le,Re,s),AF(c,l),(0,b.useEffect)(()=>{f.current=M},[M]),IP(M);let tt=v!==null,nt=tt||!tt&&C>=2;return HP(v!==null&&v.reason!==`shell-exited`,$e,cd),LP(nt,e),(0,y.jsxs)(`main`,{ref:t,className:`h-dvh w-dvw pt-[env(safe-area-inset-top)] pr-[env(safe-area-inset-right)] pb-[env(safe-area-inset-bottom)] pl-[env(safe-area-inset-left)]`,style:{background:Ze},children:[(0,y.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,y.jsx)(`div`,{ref:n,"aria-label":`terminal session`,className:`absolute inset-0`}),(0,y.jsx)(NP,{exitInfo:v}),(0,y.jsx)(MP,{activeThemeId:V,onThemeChange:Se,onThemePreview:Ce,activeFontId:re,onFontChange:we,onFontPreview:Te,activeLocalFontFamily:ie,onLocalFontChange:Ee,activeFontSize:oe,onFontSizeChange:De,activeLineHeight:ce,onLineHeightChange:Oe,activeCursorStyle:ue,onCursorStyleChange:ke,onCursorStylePreview:Ae,activeCursorBlink:pe,onCursorBlinkChange:je,activeScrollback:he,onScrollbackChange:Me,activeScrollOnUserInput:_e,onScrollOnUserInputChange:Ne,sessionInfo:A,newTabUrl:xe,onOpenSearch:He,isMac:Pe,isSearchOpen:Le}),Le&&(0,y.jsx)(RT,{searchInputRef:s,searchQuery:ze,searchResults:Be,onSearchChange:Ue,onKeyDown:We,onFindNext:()=>Ge(ze),onFindPrevious:()=>Ke(ze),isSearchOpen:Le})]}),(0,y.jsx)(TA,{isModalOpen:nt,exitInfo:v,isRetryingConnection:O,hasCopiedRestartCommand:T,newTabUrl:xe,onReconnect:$e,onCopyRestartCommand:et})]})},FF=()=>{let e=(0,b.useRef)(!1);return(0,b.useEffect)(()=>{let t=t=>{e.current||(t.preventDefault(),t.returnValue=``)};return window.addEventListener(`beforeunload`,t),()=>{window.removeEventListener(`beforeunload`,t)}},[]),(0,y.jsx)(PF,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[])})},IF=null,LF=null,RF=()=>IF||(typeof BroadcastChannel>`u`||typeof crypto>`u`||typeof crypto.randomUUID!=`function`?null:(LF=crypto.randomUUID(),IF=new BroadcastChannel(ud),IF.addEventListener(`message`,e=>{let t=e.data,n=ef();t.type===`ping`&&t.tabId!==LF&&t.hue===n&&IF&&LF&&IF.postMessage({type:`claimed`,tabId:LF,hue:n})}),IF));of(),sf(`idle`),(()=>{let e=RF();if(!e||!LF)return()=>{};let t=ef(),n=new Set,r=e=>{let r=e.data;r.type===`claimed`&&r.tabId!==LF&&r.hue===t&&n.add(r.hue)};e.addEventListener(`message`,r),e.postMessage({type:`ping`,tabId:LF,hue:t});let i=setTimeout(()=>{if(e.removeEventListener(`message`,r),n.size===0)return;let i=tf([...n]);i!==t&&(nf(i),sf(`idle`))},250);return()=>{clearTimeout(i),e.removeEventListener(`message`,r),IF?.close(),IF=null,LF=null}})(),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=Nd();if(!e)return;let t=document.createElement(`link`);t.id=xd,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})(),((e=!1)=>{e||typeof navigator>`u`||!(`serviceWorker`in navigator)||navigator.serviceWorker.register(`/sw.js`,{scope:`/`}).catch(e=>{console.warn(`[localterm] service worker registration failed`,e)})})();var zF=document.getElementById(`root`);if(!zF)throw Error(`Root element not found`);(0,x.createRoot)(zF,{onCaughtError(e,t){console.error(`[localterm] React caught error:`,e,t)},onUncaughtError(e,t){console.error(`[localterm] React uncaught error:`,e,t)},onRecoverableError(e,t){console.error(`[localterm] React recoverable error:`,e,t)}}).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(Nj,{delay:300,children:(0,y.jsx)(FF,{})})}));
121
- //# sourceMappingURL=index-CFUT9wQf.js.map
119
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function Ig(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(a[e.defId]=e.def)}e.external||Object.keys(a).length>0&&(e.target===`draft-2020-12`?i.$defs=a:i.definitions=a);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:zg(t,`input`,e.processors),output:zg(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function Lg(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return Lg(r.element,n);if(r.type===`set`)return Lg(r.valueType,n);if(r.type===`lazy`)return Lg(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return Lg(r.innerType,n);if(r.type===`intersection`)return Lg(r.left,n)||Lg(r.right,n);if(r.type===`record`||r.type===`map`)return Lg(r.keyType,n)||Lg(r.valueType,n);if(r.type===`pipe`)return Lg(r.in,n)||Lg(r.out,n);if(r.type===`object`){for(let e in r.shape)if(Lg(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(Lg(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(Lg(e,n))return!0;return!!(r.rest&&Lg(r.rest,n))}return!1}var Rg=(e,t={})=>n=>{let r=Ng({...n,processors:t});return Pg(e,r),Fg(r,e),Ig(r,e)},zg=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Ng({...i??{},target:a,io:t,processors:n});return Pg(e,o),Fg(o,e),Ig(o,e)},Bg={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},Vg=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=Bg[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Hg=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`,typeof u==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u),typeof a==`number`&&(i.minimum=a,typeof u==`number`&&t.target!==`draft-04`&&(u>=a?delete i.minimum:delete i.exclusiveMinimum)),typeof l==`number`&&(t.target===`draft-04`||t.target===`openapi-3.0`?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l),typeof o==`number`&&(i.maximum=o,typeof l==`number`&&t.target!==`draft-04`&&(l<=o?delete i.maximum:delete i.exclusiveMaximum)),typeof c==`number`&&(i.multipleOf=c)},Ug=(e,t,n,r)=>{n.type=`boolean`},Wg=(e,t,n,r)=>{n.not={}},Gg=(e,t,n,r)=>{let i=e._zod.def,a=vf(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Kg=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},qg=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},Jg=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Yg=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=Pg(a.element,t,{...r,path:[...r.path,`items`]})},Xg=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=Pg(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=Pg(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Zg=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>Pg(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Qg=(e,t,n,r)=>{let i=e._zod.def,a=Pg(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=Pg(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},$g=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=Pg(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=Pg(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=Pg(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},e_=(e,t,n,r)=>{let i=e._zod.def,a=Pg(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},t_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},n_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},r_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},i_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},a_=(e,t,n,r)=>{let i=e._zod.def,a=t.io===`input`?i.in._zod.def.type===`transform`?i.out:i.in:i.out;Pg(a,t,r);let o=t.seen.get(e);o.ref=a},o_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},s_=(e,t,n,r)=>{let i=e._zod.def;Pg(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},c_=J(`ZodISODateTime`,(e,t)=>{Om.init(e,t),P_.init(e,t)});function l_(e){return eg(c_,e)}var u_=J(`ZodISODate`,(e,t)=>{km.init(e,t),P_.init(e,t)});function d_(e){return tg(u_,e)}var f_=J(`ZodISOTime`,(e,t)=>{Am.init(e,t),P_.init(e,t)});function p_(e){return ng(f_,e)}var m_=J(`ZodISODuration`,(e,t)=>{jm.init(e,t),P_.init(e,t)});function h_(e){return rg(m_,e)}var g_=(e,t)=>{tp.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>ip(e,t)},flatten:{value:t=>rp(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,yf,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,yf,2)}},isEmpty:{get(){return e.issues.length===0}}})};J(`ZodError`,g_);var __=J(`ZodError`,g_,{Parent:Error}),v_=ap(__),y_=op(__),b_=sp(__),x_=lp(__),S_=dp(__),C_=fp(__),w_=pp(__),T_=mp(__),E_=hp(__),D_=gp(__),O_=_p(__),k_=vp(__),A_=J(`ZodType`,(e,t)=>(mm.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:zg(e,`input`),output:zg(e,`output`)}}),e.toJSONSchema=Rg(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(Df(t,{checks:[...t.checks??[],...n.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>Lf(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>v_(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>b_(e,t,n),e.parseAsync=async(t,n)=>y_(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>x_(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>S_(e,t,n),e.decode=(t,n)=>C_(e,t,n),e.encodeAsync=async(t,n)=>w_(e,t,n),e.decodeAsync=async(t,n)=>T_(e,t,n),e.safeEncode=(t,n)=>E_(e,t,n),e.safeDecode=(t,n)=>D_(e,t,n),e.safeEncodeAsync=async(t,n)=>O_(e,t,n),e.safeDecodeAsync=async(t,n)=>k_(e,t,n),e.refine=(t,n)=>e.check(qv(t,n)),e.superRefine=t=>e.check(Jv(t)),e.overwrite=t=>e.check(Cg(t)),e.optional=()=>kv(e),e.exactOptional=()=>jv(e),e.nullable=()=>Nv(e),e.nullish=()=>kv(Nv(e)),e.nonoptional=t=>zv(e,t),e.array=()=>dv(e),e.or=t=>hv([e,t]),e.and=t=>yv(e,t),e.transform=t=>Uv(e,Dv(t)),e.default=t=>Fv(e,t),e.prefault=t=>Lv(e,t),e.catch=t=>Vv(e,t),e.pipe=t=>Uv(e,t),e.readonly=()=>Gv(e),e.describe=t=>{let n=e.clone();return Ah.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return Ah.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return Ah.get(e);let n=e.clone();return Ah.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),j_=J(`_ZodString`,(e,t)=>{hm.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Vg(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(_g(...t)),e.includes=(...t)=>e.check(bg(...t)),e.startsWith=(...t)=>e.check(xg(...t)),e.endsWith=(...t)=>e.check(Sg(...t)),e.min=(...t)=>e.check(hg(...t)),e.max=(...t)=>e.check(mg(...t)),e.length=(...t)=>e.check(gg(...t)),e.nonempty=(...t)=>e.check(hg(1,...t)),e.lowercase=t=>e.check(vg(t)),e.uppercase=t=>e.check(yg(t)),e.trim=()=>e.check(Tg()),e.normalize=(...t)=>e.check(wg(...t)),e.toLowerCase=()=>e.check(Eg()),e.toUpperCase=()=>e.check(Dg()),e.slugify=()=>e.check(Og())}),M_=J(`ZodString`,(e,t)=>{hm.init(e,t),j_.init(e,t),e.email=t=>e.check(Mh(F_,t)),e.url=t=>e.check(Rh(R_,t)),e.jwt=t=>e.check($h($_,t)),e.emoji=t=>e.check(zh(z_,t)),e.guid=t=>e.check(Nh(I_,t)),e.uuid=t=>e.check(Ph(L_,t)),e.uuidv4=t=>e.check(Fh(L_,t)),e.uuidv6=t=>e.check(Ih(L_,t)),e.uuidv7=t=>e.check(Lh(L_,t)),e.nanoid=t=>e.check(Bh(B_,t)),e.guid=t=>e.check(Nh(I_,t)),e.cuid=t=>e.check(Vh(V_,t)),e.cuid2=t=>e.check(Hh(H_,t)),e.ulid=t=>e.check(Uh(U_,t)),e.base64=t=>e.check(Xh(X_,t)),e.base64url=t=>e.check(Zh(Z_,t)),e.xid=t=>e.check(Wh(W_,t)),e.ksuid=t=>e.check(Gh(G_,t)),e.ipv4=t=>e.check(Kh(K_,t)),e.ipv6=t=>e.check(qh(q_,t)),e.cidrv4=t=>e.check(Jh(J_,t)),e.cidrv6=t=>e.check(Yh(Y_,t)),e.e164=t=>e.check(Qh(Q_,t)),e.datetime=t=>e.check(l_(t)),e.date=t=>e.check(d_(t)),e.time=t=>e.check(p_(t)),e.duration=t=>e.check(h_(t))});function N_(e){return jh(M_,e)}var P_=J(`ZodStringFormat`,(e,t)=>{gm.init(e,t),j_.init(e,t)}),F_=J(`ZodEmail`,(e,t)=>{ym.init(e,t),P_.init(e,t)}),I_=J(`ZodGUID`,(e,t)=>{_m.init(e,t),P_.init(e,t)}),L_=J(`ZodUUID`,(e,t)=>{vm.init(e,t),P_.init(e,t)}),R_=J(`ZodURL`,(e,t)=>{bm.init(e,t),P_.init(e,t)}),z_=J(`ZodEmoji`,(e,t)=>{xm.init(e,t),P_.init(e,t)}),B_=J(`ZodNanoID`,(e,t)=>{Sm.init(e,t),P_.init(e,t)}),V_=J(`ZodCUID`,(e,t)=>{Cm.init(e,t),P_.init(e,t)}),H_=J(`ZodCUID2`,(e,t)=>{wm.init(e,t),P_.init(e,t)}),U_=J(`ZodULID`,(e,t)=>{Tm.init(e,t),P_.init(e,t)}),W_=J(`ZodXID`,(e,t)=>{Em.init(e,t),P_.init(e,t)}),G_=J(`ZodKSUID`,(e,t)=>{Dm.init(e,t),P_.init(e,t)}),K_=J(`ZodIPv4`,(e,t)=>{Mm.init(e,t),P_.init(e,t)}),q_=J(`ZodIPv6`,(e,t)=>{Nm.init(e,t),P_.init(e,t)}),J_=J(`ZodCIDRv4`,(e,t)=>{Pm.init(e,t),P_.init(e,t)}),Y_=J(`ZodCIDRv6`,(e,t)=>{Fm.init(e,t),P_.init(e,t)}),X_=J(`ZodBase64`,(e,t)=>{Lm.init(e,t),P_.init(e,t)}),Z_=J(`ZodBase64URL`,(e,t)=>{zm.init(e,t),P_.init(e,t)}),Q_=J(`ZodE164`,(e,t)=>{Bm.init(e,t),P_.init(e,t)}),$_=J(`ZodJWT`,(e,t)=>{Hm.init(e,t),P_.init(e,t)}),ev=J(`ZodNumber`,(e,t)=>{Um.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Hg(e,t,n,r),e.gt=(t,n)=>e.check(dg(t,n)),e.gte=(t,n)=>e.check(fg(t,n)),e.min=(t,n)=>e.check(fg(t,n)),e.lt=(t,n)=>e.check(lg(t,n)),e.lte=(t,n)=>e.check(ug(t,n)),e.max=(t,n)=>e.check(ug(t,n)),e.int=t=>e.check(rv(t)),e.safe=t=>e.check(rv(t)),e.positive=t=>e.check(dg(0,t)),e.nonnegative=t=>e.check(fg(0,t)),e.negative=t=>e.check(lg(0,t)),e.nonpositive=t=>e.check(ug(0,t)),e.multipleOf=(t,n)=>e.check(pg(t,n)),e.step=(t,n)=>e.check(pg(t,n)),e.finite=()=>e;let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function tv(e){return ig(ev,e)}var nv=J(`ZodNumberFormat`,(e,t)=>{Wm.init(e,t),ev.init(e,t)});function rv(e){return ag(nv,e)}var iv=J(`ZodBoolean`,(e,t)=>{Gm.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ug(e,t,n,r)});function av(e){return og(iv,e)}var ov=J(`ZodUnknown`,(e,t)=>{Km.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function sv(){return sg(ov)}var cv=J(`ZodNever`,(e,t)=>{qm.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wg(e,t,n,r)});function lv(e){return cg(cv,e)}var uv=J(`ZodArray`,(e,t)=>{Ym.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yg(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(hg(t,n)),e.nonempty=t=>e.check(hg(1,t)),e.max=(t,n)=>e.check(mg(t,n)),e.length=(t,n)=>e.check(gg(t,n)),e.unwrap=()=>e.element});function dv(e,t){return kg(uv,e,t)}var fv=J(`ZodObject`,(e,t)=>{eh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xg(e,t,n,r),Tf(e,`shape`,()=>t.shape),e.keyof=()=>Cv(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:sv()}),e.loose=()=>e.clone({...e._zod.def,catchall:sv()}),e.strict=()=>e.clone({...e._zod.def,catchall:lv()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>Uf(e,t),e.safeExtend=t=>Wf(e,t),e.merge=t=>Gf(e,t),e.pick=t=>Vf(e,t),e.omit=t=>Hf(e,t),e.partial=(...t)=>Kf(Ov,e,t[0]),e.required=(...t)=>qf(Rv,e,t[0])});function pv(e,t){return new fv({type:`object`,shape:e??{},...Rf(t)})}var mv=J(`ZodUnion`,(e,t)=>{nh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zg(e,t,n,r),e.options=t.options});function hv(e,t){return new mv({type:`union`,options:e,...Rf(t)})}var gv=J(`ZodDiscriminatedUnion`,(e,t)=>{mv.init(e,t),rh.init(e,t)});function _v(e,t,n){return new gv({type:`union`,options:t,discriminator:e,...Rf(n)})}var vv=J(`ZodIntersection`,(e,t)=>{ih.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qg(e,t,n,r)});function yv(e,t){return new vv({type:`intersection`,left:e,right:t})}var bv=J(`ZodRecord`,(e,t)=>{sh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$g(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function xv(e,t,n){return new bv({type:`record`,keyType:e,valueType:t,...Rf(n)})}var Sv=J(`ZodEnum`,(e,t)=>{ch.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Gg(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Sv({...t,checks:[],...Rf(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Sv({...t,checks:[],...Rf(r),entries:i})}});function Cv(e,t){return new Sv({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...Rf(t)})}var wv=J(`ZodLiteral`,(e,t)=>{lh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Kg(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function Tv(e,t){return new wv({type:`literal`,values:Array.isArray(e)?e:[e],...Rf(t)})}var Ev=J(`ZodTransform`,(e,t)=>{uh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jg(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new hf(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push($f(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push($f(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Dv(e){return new Ev({type:`transform`,transform:e})}var Ov=J(`ZodOptional`,(e,t)=>{fh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function kv(e){return new Ov({type:`optional`,innerType:e})}var Av=J(`ZodExactOptional`,(e,t)=>{ph.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>s_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function jv(e){return new Av({type:`optional`,innerType:e})}var Mv=J(`ZodNullable`,(e,t)=>{mh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>e_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nv(e){return new Mv({type:`nullable`,innerType:e})}var Pv=J(`ZodDefault`,(e,t)=>{hh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>n_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Fv(e,t){return new Pv({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pf(t)}})}var Iv=J(`ZodPrefault`,(e,t)=>{_h.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>r_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Lv(e,t){return new Iv({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Pf(t)}})}var Rv=J(`ZodNonOptional`,(e,t)=>{vh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>t_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function zv(e,t){return new Rv({type:`nonoptional`,innerType:e,...Rf(t)})}var Bv=J(`ZodCatch`,(e,t)=>{bh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>i_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Vv(e,t){return new Bv({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Hv=J(`ZodPipe`,(e,t)=>{xh.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>a_(e,t,n,r),e.in=t.in,e.out=t.out});function Uv(e,t){return new Hv({type:`pipe`,in:e,out:t})}var Wv=J(`ZodReadonly`,(e,t)=>{Ch.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>o_(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Gv(e){return new Wv({type:`readonly`,innerType:e})}var Kv=J(`ZodCustom`,(e,t)=>{Th.init(e,t),A_.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qg(e,t,n,r)});function qv(e,t={}){return Ag(Kv,e,t)}function Jv(e){return jg(e)}pv({ok:av(),sessions:tv().int().nonnegative()}).strict(),_v(`type`,[pv({type:Tv(`input`),data:N_().max(lf)}).strict(),pv({type:Tv(`resize`),cols:tv().int().positive().max(ff),rows:tv().int().positive().max(pf)}).strict(),pv({type:Tv(`flow-pause`)}).strict(),pv({type:Tv(`flow-resume`)}).strict(),pv({type:Tv(`rpc`),id:N_().min(1).max(64),method:Cv([`spawn_session`,`list_sessions`,`write_input`,`read_output`,`wait_for_boundary`,`exec`]),params:xv(N_(),sv()).optional()}).strict()]),_v(`type`,[pv({type:Tv(`output`),data:N_().max(uf)}).strict(),pv({type:Tv(`exit`),code:tv().int().nullable()}).strict(),pv({type:Tv(`title`),title:N_().max(df)}).strict(),pv({type:Tv(`session`),id:N_(),shell:N_().min(1),shellName:N_().min(1),pid:tv().int().nonnegative(),cwd:N_().min(1)}).strict(),pv({type:Tv(`cwd`),cwd:N_().min(1)}).strict(),pv({type:Tv(`agent-output`),text:N_().max(uf)}).strict(),pv({type:Tv(`command-boundary`),phase:Cv([`prompt-start`,`command-start`,`output-start`,`command-end`]),exitCode:tv().int().optional()}).strict(),pv({type:Tv(`rpc-response`),id:N_().min(1).max(64),result:sv().optional(),error:N_().optional()}).strict()]);var Yv=e=>typeof e==`string`?e.length:e.byteLength,Xv=`cwd`,Zv=(e,t)=>{let n=new URL(`/ws`,window.location.href);n.protocol=n.protocol===`https:`?`wss:`:`ws:`;let r=e??new URLSearchParams(window.location.search).get(Xv);return r&&n.searchParams.set(Xv,r),t&&n.searchParams.set(`sessionId`,t),n.toString()},Qv=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(Xv,e),t.toString()},$v=16384,ey=e=>{let t=0,n=!1,r=t=>{if(e.hasScrollRestore()){e.restoreScrollFromResize();return}t.wasAtBottom&&e.restoreScrollAnchor(t)};return{write:i=>{if(e.isExited())return;let a=Yv(i);if(a>=$v){let o=[],s=0;for(;s<a;){let e=Math.min(s+$v,a);o.push(typeof i==`string`?i.slice(s,e):i.subarray(s,e)),s=e}let c=e.captureScrollAnchor(),l=0,u=()=>{if(l>=o.length)return;let i=o[l];l++,!n&&t>=4&&(e.sendFlowPause(),n=!0),e.terminalWrite(i,()=>{t=Math.max(0,t-1),n&&t<1&&(e.sendFlowResume(),n=!1),l>=o.length?r(c):e.restoreScrollFromResize(),setTimeout(u,0)}),t++};u();return}let o=e.captureScrollAnchor();!n&&t>=4&&(e.sendFlowPause(),n=!0),e.terminalWrite(i,()=>{t=Math.max(0,t-1),n&&t<1&&(e.sendFlowResume(),n=!1),r(o)}),t++},clear:()=>{t=0,n=!1}}},ty=(e,t)=>`\x1b[${e};${t+1}u`,ny=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),ry=(e,t)=>e.key!==`f`&&e.key!==`F`?!1:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,iy=(e,t)=>t.buffer.active.type!==`alternate`||t.modes.mouseTrackingMode!==`none`?!1:e.deltaMode===WheelEvent.DOM_DELTA_PIXEL,ay=e=>{let t=[0];return e.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let n=e[0],r=typeof n==`number`?n:1;return t.push(r),!0}),e.parser.registerCsiHandler({prefix:`<`,final:`u`},e=>{let n=e[0],r=typeof n==`number`&&n>0?n:1;for(let e=0;e<r&&t.length>1;e+=1)t.pop();return!0}),e.parser.registerCsiHandler({prefix:`=`,final:`u`},e=>{let n=e[0],r=e[1];if(typeof n!=`number`)return!0;let i=n,a=typeof r==`number`&&r>0?r:1,o=t.length-1,s=t[o]??0;return a===1?t[o]=i:a===2?t[o]=s|i:a===3&&(t[o]=s&~i),!0}),{getFlags:()=>t[t.length-1]??0}},oy=(e,t)=>{e.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(ry(e,t.isMac))return e.type===`keydown`&&(e.preventDefault(),t.openFindOverlay()),!1;if(e.type===`keydown`&&e.key===`Enter`){let n=ny(e),r=(t.getKittyFlags()&1)!=0;if(n!==0&&r)return e.preventDefault(),t.sendInput(ty(13,n)),!1;if(n===1)return e.preventDefault(),t.sendInput(`
120
+ `),!1}return!0})},sy=e=>{e.attachCustomWheelEventHandler(t=>iy(t,e)?(t.preventDefault(),!1):!0)},cy=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},ly=(e,t)=>{if(t.wasAtBottom){e.scrollToBottom();return}let n=e.buffer.active,r=Math.max(0,n.baseY-t.distanceFromBottom)-n.viewportY;r!==0&&e.scrollLines(r)},uy=(e,t)=>{let n=e.buffer.active,r=Math.max(0,n.baseY-n.viewportY),i=r===0;try{t.fit()}catch{return!1}try{if(i)return e.scrollToBottom(),!0;let t=e.buffer.active;if(r>t.baseY)return e.scrollToBottom(),!0;let n=Math.max(0,t.baseY-r)-t.viewportY;n!==0&&e.scrollLines(n)}catch{}return!0},dy=e=>{let t=null,n=null,r=null,i=()=>cy(e.terminal),a=t=>{ly(e.terminal,t)},o=()=>{r&&window.clearTimeout(r.timer),n!==null&&(window.cancelAnimationFrame(n),n=null),r=null},s=()=>{r&&a(r.anchor)},c=e=>{o(),r={anchor:e,timer:window.setTimeout(()=>{s(),r=null},rd)},n=window.requestAnimationFrame(()=>{n=null,s()})},l=()=>{let t=i();uy(e.terminal,e.fitAddon)&&c(t)};return{captureAnchor:i,restoreAnchor:a,fitToContainer:l,scheduleFit:()=>{t!==null&&window.clearTimeout(t),t=window.setTimeout(()=>{t=null,l()},e.resizeDebounceMs)},beginResizeScrollRestore:c,clearResizeScrollRestore:o,restoreResizeScroll:s,hasResizeRestore:()=>r!==null,cleanupResizeScroll:()=>{t!==null&&window.clearTimeout(t),o()}}},fy=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),py=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),my=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),hy=e=>{let t=my(e);return t.charAt(0).toUpperCase()+t.slice(1)},gy={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},_y=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0;return!1},vy=(0,b.createContext)({}),yy=()=>(0,b.useContext)(vy),by=(0,b.forwardRef)(({color:e,size:t,strokeWidth:n,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>{let{size:l=24,strokeWidth:u=2,absoluteStrokeWidth:d=!1,color:f=`currentColor`,className:p=``}=yy()??{},m=r??d?Number(n??u)*24/Number(t??l):n??u;return(0,b.createElement)(`svg`,{ref:c,...gy,width:t??l??gy.width,height:t??l??gy.height,stroke:e??f,strokeWidth:m,className:fy(`lucide`,p,i),...!a&&!_y(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,b.createElement)(e,t)),...Array.isArray(a)?a:[a]])}),xy=(e,t)=>{let n=(0,b.forwardRef)(({className:n,...r},i)=>(0,b.createElement)(by,{ref:i,iconNode:t,className:fy(`lucide-${py(hy(e))}`,`lucide-${e}`,n),...r}));return n.displayName=hy(e),n},Sy=xy(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Cy=xy(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),wy=xy(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Ty=xy(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Ey=xy(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),Dy=xy(`minus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]),Oy=xy(`monitor-cog`,[[`path`,{d:`M12 17v4`,key:`1riwvh`}],[`path`,{d:`m14.305 7.53.923-.382`,key:`1mlnsw`}],[`path`,{d:`m15.228 4.852-.923-.383`,key:`82mpwg`}],[`path`,{d:`m16.852 3.228-.383-.924`,key:`ln4sir`}],[`path`,{d:`m16.852 8.772-.383.923`,key:`1dejw0`}],[`path`,{d:`m19.148 3.228.383-.924`,key:`192kgf`}],[`path`,{d:`m19.53 9.696-.382-.924`,key:`fiavlr`}],[`path`,{d:`m20.772 4.852.924-.383`,key:`1j8mgp`}],[`path`,{d:`m20.772 7.148.924.383`,key:`zix9be`}],[`path`,{d:`M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7`,key:`1tnzv8`}],[`path`,{d:`M8 21h8`,key:`1ev6f3`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}]]),ky=xy(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Ay=xy(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),jy=xy(`settings`,[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),My=xy(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Ny(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Ny(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Py(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Ny(e))&&(r&&(r+=` `),r+=t);return r}var Fy=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,Iy=Py,Ly=(e,t)=>n=>{if(t?.variants==null)return Iy(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Fy(t)||Fy(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return Iy(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Ry=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},zy=(e,t)=>({classGroupId:e,validator:t}),By=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),Vy=`-`,Hy=[],Uy=`arbitrary..`,Wy=e=>{let t=qy(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return Ky(e);let n=e.split(Vy);return Gy(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Ry(i,t):t:i||Hy}return n[e]||Hy}}},Gy=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=Gy(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(Vy):e.slice(t).join(Vy),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},Ky=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?Uy+r:void 0})(),qy=e=>{let{theme:t,classGroups:n}=e;return Jy(n,t)},Jy=(e,t)=>{let n=By();for(let r in e){let i=e[r];Yy(i,n,r,t)}return n},Yy=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];Xy(i,t,n,r)}},Xy=(e,t,n,r)=>{if(typeof e==`string`){Zy(e,t,n);return}if(typeof e==`function`){Qy(e,t,n,r);return}$y(e,t,n,r)},Zy=(e,t,n)=>{let r=e===``?t:eb(t,e);r.classGroupId=n},Qy=(e,t,n,r)=>{if(tb(e)){Yy(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(zy(n,e))},$y=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];Yy(o,eb(t,a),n,r)}},eb=(e,t)=>{let n=e,r=t.split(Vy),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=By(),n.nextPart.set(t,i)),n=i}return n},tb=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,nb=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},rb=`!`,ib=`:`,ab=[],ob=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),sb=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===ib){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(rb)?(c=s.slice(0,-1),l=!0):s.startsWith(rb)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return ob(t,l,c,u)};if(t){let e=t+ib,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):ob(ab,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},cb=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},lb=e=>({cache:nb(e.cacheSize),parseClassName:sb(e),sortModifiers:cb(e),...Wy(e)}),ub=/\s+/,db=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(ub),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+rb:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},fb=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=pb(n))&&(i&&(i+=` `),i+=r);return i},pb=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=pb(e[r]))&&(n&&(n+=` `),n+=t);return n},mb=(e,...t)=>{let n,r,i,a,o=o=>(n=lb(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=db(e,n);return i(e,a),a};return a=o,(...e)=>a(fb(...e))},hb=[],gb=e=>{let t=t=>t[e]||hb;return t.isThemeGetter=!0,t},_b=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,vb=/^\((?:(\w[\w-]*):)?(.+)\)$/i,yb=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,bb=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,xb=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Sb=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Cb=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,wb=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Tb=e=>yb.test(e),Eb=e=>!!e&&!Number.isNaN(Number(e)),Db=e=>!!e&&Number.isInteger(Number(e)),Ob=e=>e.endsWith(`%`)&&Eb(e.slice(0,-1)),kb=e=>bb.test(e),Ab=()=>!0,jb=e=>xb.test(e)&&!Sb.test(e),Mb=()=>!1,Nb=e=>Cb.test(e),Pb=e=>wb.test(e),Fb=e=>!Y(e)&&!X(e),Ib=e=>Zb(e,tx,Mb),Y=e=>_b.test(e),Lb=e=>Zb(e,nx,jb),Rb=e=>Zb(e,rx,Eb),zb=e=>Zb(e,ax,Ab),Bb=e=>Zb(e,ix,Mb),Vb=e=>Zb(e,$b,Mb),Hb=e=>Zb(e,ex,Pb),Ub=e=>Zb(e,ox,Nb),X=e=>vb.test(e),Wb=e=>Qb(e,nx),Gb=e=>Qb(e,ix),Kb=e=>Qb(e,$b),qb=e=>Qb(e,tx),Jb=e=>Qb(e,ex),Yb=e=>Qb(e,ox,!0),Xb=e=>Qb(e,ax,!0),Zb=(e,t,n)=>{let r=_b.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},Qb=(e,t,n=!1)=>{let r=vb.exec(e);return r?r[1]?t(r[1]):n:!1},$b=e=>e===`position`||e===`percentage`,ex=e=>e===`image`||e===`url`,tx=e=>e===`length`||e===`size`||e===`bg-size`,nx=e=>e===`length`,rx=e=>e===`number`,ix=e=>e===`family-name`,ax=e=>e===`number`||e===`weight`,ox=e=>e===`shadow`,sx=mb(()=>{let e=gb(`color`),t=gb(`font`),n=gb(`text`),r=gb(`font-weight`),i=gb(`tracking`),a=gb(`leading`),o=gb(`breakpoint`),s=gb(`container`),c=gb(`spacing`),l=gb(`radius`),u=gb(`shadow`),d=gb(`inset-shadow`),f=gb(`text-shadow`),p=gb(`drop-shadow`),m=gb(`blur`),h=gb(`perspective`),g=gb(`aspect`),_=gb(`ease`),v=gb(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),X,Y],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[X,Y,c],T=()=>[Tb,`full`,`auto`,...w()],E=()=>[Db,`none`,`subgrid`,X,Y],D=()=>[`auto`,{span:[`full`,Db,X,Y]},Db,X,Y],O=()=>[Db,`auto`,X,Y],k=()=>[`auto`,`min`,`max`,`fr`,X,Y],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Tb,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Tb,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],F=()=>[Tb,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],I=()=>[e,X,Y],L=()=>[...b(),Kb,Vb,{position:[X,Y]}],ee=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],R=()=>[`auto`,`cover`,`contain`,qb,Ib,{size:[X,Y]}],te=()=>[Ob,Wb,Lb],z=()=>[``,`none`,`full`,l,X,Y],B=()=>[``,Eb,Wb,Lb],V=()=>[`solid`,`dashed`,`dotted`,`double`],ne=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],re=()=>[Eb,Ob,Kb,Vb],H=()=>[``,`none`,m,X,Y],ie=()=>[`none`,Eb,X,Y],ae=()=>[`none`,Eb,X,Y],oe=()=>[Eb,X,Y],se=()=>[Tb,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[kb],breakpoint:[kb],color:[Ab],container:[kb],"drop-shadow":[kb],ease:[`in`,`out`,`in-out`],font:[Fb],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[kb],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[kb],shadow:[kb],spacing:[`px`,Eb],text:[kb],"text-shadow":[kb],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Tb,Y,X,g]}],container:[`container`],columns:[{columns:[Eb,Y,X,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Db,`auto`,X,Y]}],basis:[{basis:[Tb,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[Eb,Tb,`auto`,`initial`,`none`,Y]}],grow:[{grow:[``,Eb,X,Y]}],shrink:[{shrink:[``,Eb,X,Y]}],order:[{order:[Db,`first`,`last`,`none`,X,Y]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...F()]}],"min-block-size":[{"min-block":[`auto`,...F()]}],"max-block-size":[{"max-block":[`none`,...F()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,Wb,Lb]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,Xb,zb]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Ob,Y]}],"font-family":[{font:[Gb,Bb,t]}],"font-features":[{"font-features":[Y]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,X,Y]}],"line-clamp":[{"line-clamp":[Eb,`none`,X,Rb]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,X,Y]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,X,Y]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:I()}],"text-color":[{text:I()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...V(),`wavy`]}],"text-decoration-thickness":[{decoration:[Eb,`from-font`,`auto`,X,Lb]}],"text-decoration-color":[{decoration:I()}],"underline-offset":[{"underline-offset":[Eb,`auto`,X,Y]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,X,Y]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,X,Y]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:ee()}],"bg-size":[{bg:R()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Db,X,Y],radial:[``,X,Y],conic:[Db,X,Y]},Jb,Hb]}],"bg-color":[{bg:I()}],"gradient-from-pos":[{from:te()}],"gradient-via-pos":[{via:te()}],"gradient-to-pos":[{to:te()}],"gradient-from":[{from:I()}],"gradient-via":[{via:I()}],"gradient-to":[{to:I()}],rounded:[{rounded:z()}],"rounded-s":[{"rounded-s":z()}],"rounded-e":[{"rounded-e":z()}],"rounded-t":[{"rounded-t":z()}],"rounded-r":[{"rounded-r":z()}],"rounded-b":[{"rounded-b":z()}],"rounded-l":[{"rounded-l":z()}],"rounded-ss":[{"rounded-ss":z()}],"rounded-se":[{"rounded-se":z()}],"rounded-ee":[{"rounded-ee":z()}],"rounded-es":[{"rounded-es":z()}],"rounded-tl":[{"rounded-tl":z()}],"rounded-tr":[{"rounded-tr":z()}],"rounded-br":[{"rounded-br":z()}],"rounded-bl":[{"rounded-bl":z()}],"border-w":[{border:B()}],"border-w-x":[{"border-x":B()}],"border-w-y":[{"border-y":B()}],"border-w-s":[{"border-s":B()}],"border-w-e":[{"border-e":B()}],"border-w-bs":[{"border-bs":B()}],"border-w-be":[{"border-be":B()}],"border-w-t":[{"border-t":B()}],"border-w-r":[{"border-r":B()}],"border-w-b":[{"border-b":B()}],"border-w-l":[{"border-l":B()}],"divide-x":[{"divide-x":B()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":B()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...V(),`hidden`,`none`]}],"divide-style":[{divide:[...V(),`hidden`,`none`]}],"border-color":[{border:I()}],"border-color-x":[{"border-x":I()}],"border-color-y":[{"border-y":I()}],"border-color-s":[{"border-s":I()}],"border-color-e":[{"border-e":I()}],"border-color-bs":[{"border-bs":I()}],"border-color-be":[{"border-be":I()}],"border-color-t":[{"border-t":I()}],"border-color-r":[{"border-r":I()}],"border-color-b":[{"border-b":I()}],"border-color-l":[{"border-l":I()}],"divide-color":[{divide:I()}],"outline-style":[{outline:[...V(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[Eb,X,Y]}],"outline-w":[{outline:[``,Eb,Wb,Lb]}],"outline-color":[{outline:I()}],shadow:[{shadow:[``,`none`,u,Yb,Ub]}],"shadow-color":[{shadow:I()}],"inset-shadow":[{"inset-shadow":[`none`,d,Yb,Ub]}],"inset-shadow-color":[{"inset-shadow":I()}],"ring-w":[{ring:B()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:I()}],"ring-offset-w":[{"ring-offset":[Eb,Lb]}],"ring-offset-color":[{"ring-offset":I()}],"inset-ring-w":[{"inset-ring":B()}],"inset-ring-color":[{"inset-ring":I()}],"text-shadow":[{"text-shadow":[`none`,f,Yb,Ub]}],"text-shadow-color":[{"text-shadow":I()}],opacity:[{opacity:[Eb,X,Y]}],"mix-blend":[{"mix-blend":[...ne(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ne()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[Eb]}],"mask-image-linear-from-pos":[{"mask-linear-from":re()}],"mask-image-linear-to-pos":[{"mask-linear-to":re()}],"mask-image-linear-from-color":[{"mask-linear-from":I()}],"mask-image-linear-to-color":[{"mask-linear-to":I()}],"mask-image-t-from-pos":[{"mask-t-from":re()}],"mask-image-t-to-pos":[{"mask-t-to":re()}],"mask-image-t-from-color":[{"mask-t-from":I()}],"mask-image-t-to-color":[{"mask-t-to":I()}],"mask-image-r-from-pos":[{"mask-r-from":re()}],"mask-image-r-to-pos":[{"mask-r-to":re()}],"mask-image-r-from-color":[{"mask-r-from":I()}],"mask-image-r-to-color":[{"mask-r-to":I()}],"mask-image-b-from-pos":[{"mask-b-from":re()}],"mask-image-b-to-pos":[{"mask-b-to":re()}],"mask-image-b-from-color":[{"mask-b-from":I()}],"mask-image-b-to-color":[{"mask-b-to":I()}],"mask-image-l-from-pos":[{"mask-l-from":re()}],"mask-image-l-to-pos":[{"mask-l-to":re()}],"mask-image-l-from-color":[{"mask-l-from":I()}],"mask-image-l-to-color":[{"mask-l-to":I()}],"mask-image-x-from-pos":[{"mask-x-from":re()}],"mask-image-x-to-pos":[{"mask-x-to":re()}],"mask-image-x-from-color":[{"mask-x-from":I()}],"mask-image-x-to-color":[{"mask-x-to":I()}],"mask-image-y-from-pos":[{"mask-y-from":re()}],"mask-image-y-to-pos":[{"mask-y-to":re()}],"mask-image-y-from-color":[{"mask-y-from":I()}],"mask-image-y-to-color":[{"mask-y-to":I()}],"mask-image-radial":[{"mask-radial":[X,Y]}],"mask-image-radial-from-pos":[{"mask-radial-from":re()}],"mask-image-radial-to-pos":[{"mask-radial-to":re()}],"mask-image-radial-from-color":[{"mask-radial-from":I()}],"mask-image-radial-to-color":[{"mask-radial-to":I()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[Eb]}],"mask-image-conic-from-pos":[{"mask-conic-from":re()}],"mask-image-conic-to-pos":[{"mask-conic-to":re()}],"mask-image-conic-from-color":[{"mask-conic-from":I()}],"mask-image-conic-to-color":[{"mask-conic-to":I()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:ee()}],"mask-size":[{mask:R()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,X,Y]}],filter:[{filter:[``,`none`,X,Y]}],blur:[{blur:H()}],brightness:[{brightness:[Eb,X,Y]}],contrast:[{contrast:[Eb,X,Y]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,Yb,Ub]}],"drop-shadow-color":[{"drop-shadow":I()}],grayscale:[{grayscale:[``,Eb,X,Y]}],"hue-rotate":[{"hue-rotate":[Eb,X,Y]}],invert:[{invert:[``,Eb,X,Y]}],saturate:[{saturate:[Eb,X,Y]}],sepia:[{sepia:[``,Eb,X,Y]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,X,Y]}],"backdrop-blur":[{"backdrop-blur":H()}],"backdrop-brightness":[{"backdrop-brightness":[Eb,X,Y]}],"backdrop-contrast":[{"backdrop-contrast":[Eb,X,Y]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,Eb,X,Y]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Eb,X,Y]}],"backdrop-invert":[{"backdrop-invert":[``,Eb,X,Y]}],"backdrop-opacity":[{"backdrop-opacity":[Eb,X,Y]}],"backdrop-saturate":[{"backdrop-saturate":[Eb,X,Y]}],"backdrop-sepia":[{"backdrop-sepia":[``,Eb,X,Y]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,X,Y]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[Eb,`initial`,X,Y]}],ease:[{ease:[`linear`,`initial`,_,X,Y]}],delay:[{delay:[Eb,X,Y]}],animate:[{animate:[`none`,v,X,Y]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,X,Y]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:ie()}],"rotate-x":[{"rotate-x":ie()}],"rotate-y":[{"rotate-y":ie()}],"rotate-z":[{"rotate-z":ie()}],scale:[{scale:ae()}],"scale-x":[{"scale-x":ae()}],"scale-y":[{"scale-y":ae()}],"scale-z":[{"scale-z":ae()}],"scale-3d":[`scale-3d`],skew:[{skew:oe()}],"skew-x":[{"skew-x":oe()}],"skew-y":[{"skew-y":oe()}],transform:[{transform:[X,Y,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:se()}],"translate-x":[{"translate-x":se()}],"translate-y":[{"translate-y":se()}],"translate-z":[{"translate-z":se()}],"translate-none":[`translate-none`],accent:[{accent:I()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:I()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,X,Y]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,X,Y]}],fill:[{fill:[`none`,...I()]}],"stroke-w":[{stroke:[Eb,Wb,Lb,Rb]}],stroke:[{stroke:[`none`,...I()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}});function cx(...e){return sx(Py(e))}function lx(){return typeof window<`u`}function ux(e){return px(e)?(e.nodeName||``).toLowerCase():`#document`}function dx(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function fx(e){return((px(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function px(e){return lx()?e instanceof Node||e instanceof dx(e).Node:!1}function mx(e){return lx()?e instanceof Element||e instanceof dx(e).Element:!1}function hx(e){return lx()?e instanceof HTMLElement||e instanceof dx(e).HTMLElement:!1}function gx(e){return!lx()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof dx(e).ShadowRoot}function _x(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Ox(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function vx(e){return/^(table|td|th)$/.test(ux(e))}function yx(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var bx=/transform|translate|scale|rotate|perspective|filter/,xx=/paint|layout|strict|content/,Sx=e=>!!e&&e!==`none`,Cx;function wx(e){let t=mx(e)?Ox(e):e;return Sx(t.transform)||Sx(t.translate)||Sx(t.scale)||Sx(t.rotate)||Sx(t.perspective)||!Ex()&&(Sx(t.backdropFilter)||Sx(t.filter))||bx.test(t.willChange||``)||xx.test(t.contain||``)}function Tx(e){let t=Ax(e);for(;hx(t)&&!Dx(t);){if(wx(t))return t;if(yx(t))return null;t=Ax(t)}return null}function Ex(){return Cx??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Cx}function Dx(e){return/^(html|body|#document)$/.test(ux(e))}function Ox(e){return dx(e).getComputedStyle(e)}function kx(e){return mx(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ax(e){if(ux(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||gx(e)&&e.host||fx(e);return gx(t)?t.host:t}function jx(e){let t=Ax(e);return Dx(t)?e.ownerDocument?e.ownerDocument.body:e.body:hx(t)&&_x(t)?t:jx(t)}function Mx(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=jx(e),i=r===e.ownerDocument?.body,a=dx(r);if(i){let e=Nx(a);return t.concat(a,a.visualViewport||[],_x(r)?r:[],e&&n?Mx(e):[])}else return t.concat(r,Mx(r,[],n))}function Nx(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}var Px={};function Fx(e,t){let n=b.useRef(Px);return n.current===Px&&(n.current=e(t)),n}var Ix=b[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],Lx=Ix&&Ix!==b.useLayoutEffect?Ix:e=>e();function Z(e){let t=Fx(Rx).current;return t.next=e,Lx(t.effect),t.trampoline}function Rx(){let e={next:void 0,callback:zx,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function zx(){}var Bx={...b},Q=typeof document<`u`?b.useLayoutEffect:()=>{};function Vx(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}var Hx={};function Ux(e,t,n,r,i){if(!n&&!r&&!i&&!e)return Gx(t);let a=Gx(e);return t&&(a=Kx(a,t)),n&&(a=Kx(a,n)),r&&(a=Kx(a,r)),i&&(a=Kx(a,i)),a}function Wx(e){if(e.length===0)return Hx;if(e.length===1)return Gx(e[0]);let t=Gx(e[0]);for(let n=1;n<e.length;n+=1)t=Kx(t,e[n]);return t}function Gx(e){return Xx(e)?{...Zx(e,Hx)}:qx(e)}function Kx(e,t){return Xx(t)?Zx(t,e):Jx(e,t)}function qx(e){let t={...e};for(let e in t){let n=t[e];Yx(e,n)&&(t[e]=$x(n))}return t}function Jx(e,t){if(!t)return e;for(let n in t){let r=t[n];switch(n){case`style`:e[n]=Vx(e.style,r);break;case`className`:e[n]=tS(e.className,r);break;default:Yx(n,r)?e[n]=Qx(e[n],r):e[n]=r}}return e}function Yx(e,t){let n=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2);return n===111&&r===110&&i>=65&&i<=90&&(typeof t==`function`||t===void 0)}function Xx(e){return typeof e==`function`}function Zx(e,t){return Xx(e)?e(t):e??Hx}function Qx(e,t){return t?e?(...n)=>{let r=n[0];if(nS(r)){let i=r;eS(i);let a=t(...n);return i.baseUIHandlerPrevented||e?.(...n),a}let i=t(...n);return e?.(...n),i}:$x(t):e}function $x(e){return e&&((...t)=>{let n=t[0];return nS(n)&&eS(n),e(...t)})}function eS(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function tS(e,t){return t?e?t+` `+e:t:e}function nS(e){return typeof e==`object`&&!!e&&`nativeEvent`in e}function rS(e,t){return function(n,...r){let i=new URL(e);return i.searchParams.set(`code`,n.toString()),r.forEach(e=>i.searchParams.append(`args[]`,e)),`${t} error #${n}; visit ${i} for the full message.`}}var iS=rS(`https://base-ui.com/production-error`,`Base UI`),aS=b.createContext(void 0);function oS(e=!1){let t=b.useContext(aS);if(t===void 0&&!e)throw Error(iS(16));return t}function sS(e){let{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:i=0,isNativeButton:a}=e,o=r&&t!==!1,s=r&&t===!1;return{props:b.useMemo(()=>{let e={onKeyDown(e){n&&t&&e.key!==`Tab`&&e.preventDefault()}};return r||(e.tabIndex=i,!a&&n&&(e.tabIndex=t?i:-1)),(a&&(t||o)||!a&&n)&&(e[`aria-disabled`]=n),a&&(!t||s)&&(e.disabled=n),e},[r,n,t,o,s,a,i])}}function cS(e={}){let{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:i=!0,composite:a}=e,o=b.useRef(null),s=oS(!0),c=a??s!==void 0,{props:l}=sS({focusableWhenDisabled:n,disabled:t,composite:c,tabIndex:r,isNativeButton:i}),u=b.useCallback(()=>{let e=o.current;lS(e)&&c&&t&&l.disabled===void 0&&e.disabled&&(e.disabled=!1)},[t,l.disabled,c]);return Q(u,[u]),{getButtonProps:b.useCallback((e={})=>{let{onClick:n,onMouseDown:r,onKeyUp:a,onKeyDown:o,onPointerDown:s,...u}=e;return Ux({type:i?`button`:void 0,onClick(e){if(t){e.preventDefault();return}n?.(e)},onMouseDown(e){t||r?.(e)},onKeyDown(e){if(t||(eS(e),o?.(e),e.baseUIHandlerPrevented))return;let r=e.target===e.currentTarget,a=e.currentTarget,s=lS(a),l=!i&&uS(a),u=r&&(i?s:!l),d=e.key===`Enter`,f=e.key===` `,p=a.getAttribute(`role`),m=p?.startsWith(`menuitem`)||p===`option`||p===`gridcell`;if(r&&c&&f){if(e.defaultPrevented&&m)return;e.preventDefault(),l||i&&s?(a.click(),e.preventBaseUIHandler()):u&&(n?.(e),e.preventBaseUIHandler());return}u&&(!i&&(f||d)&&e.preventDefault(),!i&&d&&n?.(e))},onKeyUp(e){if(!t){if(eS(e),a?.(e),e.target===e.currentTarget&&i&&c&&lS(e.currentTarget)&&e.key===` `){e.preventDefault();return}e.baseUIHandlerPrevented||e.target===e.currentTarget&&!i&&!c&&e.key===` `&&n?.(e)}},onPointerDown(e){if(t){e.preventDefault();return}s?.(e)}},i?void 0:{role:`button`},l,u)},[t,l,c,i]),buttonRef:Z(e=>{o.current=e,u()})}}function lS(e){return hx(e)&&e.tagName===`BUTTON`}function uS(e){return!!(e?.tagName===`A`&&e?.href)}function dS(e,t,n,r){let i=Fx(pS).current;return mS(i,e,t,n,r)&&gS(i,[e,t,n,r]),i.callback}function fS(e){let t=Fx(pS).current;return hS(t,e)&&gS(t,e),t.callback}function pS(){return{callback:null,cleanup:null,refs:[]}}function mS(e,t,n,r,i){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==i}function hS(e,t){return e.refs.length!==t.length||e.refs.some((e,n)=>e!==t[n])}function gS(e,t){if(e.refs=t,t.every(e=>e==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&=(e.cleanup(),null),n!=null){let r=Array(t.length).fill(null);for(let e=0;e<t.length;e+=1){let i=t[e];if(i!=null)switch(typeof i){case`function`:{let t=i(n);typeof t==`function`&&(r[e]=t);break}case`object`:i.current=n;break;default:}}e.cleanup=()=>{for(let e=0;e<t.length;e+=1){let n=t[e];if(n!=null)switch(typeof n){case`function`:{let t=r[e];typeof t==`function`?t():n(null);break}case`object`:n.current=null;break;default:}}}}}}var _S=19;function vS(e){return _S>=e}function yS(e){if(!b.isValidElement(e))return null;let t=e,n=t.props;return(vS(19)?n?.ref:t.ref)??null}function bS(){}var xS=Object.freeze([]),SS=Object.freeze({});function CS(e,t){let n={};for(let r in e){let i=e[r];if(t?.hasOwnProperty(r)){let e=t[r](i);e!=null&&Object.assign(n,e);continue}i===!0?n[`data-${r.toLowerCase()}`]=``:i&&(n[`data-${r.toLowerCase()}`]=i.toString())}return n}function wS(e,t){return typeof e==`function`?e(t):e}function TS(e,t){return typeof e==`function`?e(t):e}function ES(e,t,n={}){let r=t.render,i=DS(t,n);return n.enabled===!1?null:AS(e,r,i,n.state??SS)}function DS(e,t={}){let{className:n,style:r,render:i}=e,{state:a=SS,ref:o,props:s,stateAttributesMapping:c,enabled:l=!0}=t,u=l?wS(n,a):void 0,d=l?TS(r,a):void 0,f=l?CS(a,c):SS,p=l&&s?OS(s):void 0,m=l?Vx(f,p)??{}:SS;return typeof document<`u`&&(l?Array.isArray(o)?m.ref=fS([m.ref,yS(i),...o]):m.ref=dS(m.ref,yS(i),o):dS(null,null)),l?(u!==void 0&&(m.className=tS(m.className,u)),d!==void 0&&(m.style=Vx(m.style,d)),m):SS}function OS(e){return Array.isArray(e)?Wx(e):Ux(void 0,e)}var kS=Symbol.for(`react.lazy`);function AS(e,t,n,r){if(t){if(typeof t==`function`)return t(n,r);let e=Ux(n,t.props);e.ref=n.ref;let i=t;return i?.$$typeof===kS&&(i=b.Children.toArray(t)[0]),b.cloneElement(i,e)}if(e&&typeof e==`string`)return jS(e,n);throw Error(iS(8))}function jS(e,t){return e===`button`?(0,b.createElement)(`button`,{type:`button`,...t,key:t.key}):e===`img`?(0,b.createElement)(`img`,{alt:``,...t,key:t.key}):b.createElement(e,t)}var MS=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,focusableWhenDisabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{getButtonProps:l,buttonRef:u}=cS({disabled:i,focusableWhenDisabled:a,native:o});return ES(`button`,e,{state:{disabled:i},ref:[t,u],props:[c,l]})}),NS=Ly(`group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/80`,outline:`border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80 aria-expanded:bg-secondary aria-expanded:text-secondary-foreground`,ghost:`hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50`,destructive:`bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,xs:`h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3`,sm:`h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5`,lg:`h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,icon:`size-9`,"icon-xs":`size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md`,"icon-lg":`size-10`}},defaultVariants:{variant:`default`,size:`default`}});function PS({className:e,variant:t=`default`,size:n=`default`,...r}){return(0,y.jsx)(MS,{"data-slot":`button`,className:cx(NS({variant:t,size:n,className:e})),...r})}var FS=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),IS={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},LS={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},RS={disabled:!1,...LS},zS={valid(e){return e===null?null:e?{[FS.valid]:``}:{[FS.invalid]:``}}},BS=b.createContext({invalid:void 0,name:void 0,validityData:{state:IS,errors:[],error:``,value:``,initialValue:null},setValidityData:bS,disabled:void 0,touched:LS.touched,setTouched:bS,dirty:LS.dirty,setDirty:bS,filled:LS.filled,setFilled:bS,focused:LS.focused,setFocused:bS,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:RS,markedDirtyRef:{current:!1},registerFieldControl:bS,validation:{getValidationProps:(e=SS)=>e,getInputValidationProps:(e=SS)=>e,inputRef:{current:null},commit:async()=>{}}});function VS(e=!0){let t=b.useContext(BS);if(t.setValidityData===bS&&!e)throw Error(iS(28));return t}var HS=b.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:bS,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function US(){return b.useContext(HS)}var WS=0;function GS(e,t=`mui`){let[n,r]=b.useState(e),i=e||n;return b.useEffect(()=>{n??(WS+=1,r(`${t}-${WS}`))},[n,t]),i}var KS=Bx.useId;function qS(e,t){if(KS!==void 0){let n=KS();return e??(t?`${t}-${n}`:n)}return GS(e,t)}function JS(e){return qS(e,`base-ui`)}var YS=b.createContext({controlId:void 0,registerControlId:bS,labelId:void 0,setLabelId:bS,messageIds:[],setMessageIds:bS,getDescriptionProps:e=>e});function XS(){return b.useContext(YS)}function ZS(e,t,n,r=!0,i){let[a,o]=b.useState(),s=JS(i?`${i}-label`:void 0),c=e??t??a;return Q(()=>{let i=e||t||!r?void 0:QS(n.current,s);a!==i&&o(i)}),c}function QS(e,t){let n=$S(e);if(n)return!n.id&&t&&(n.id=t),n.id||void 0}function $S(e){if(!e)return;let t=e.parentElement;if(t&&t.tagName===`LABEL`)return t;let n=e.id;if(n){let t=e.nextElementSibling;if(t&&t.htmlFor===n)return t}let r=e.labels;return r&&r[0]}function eC(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:a}=XS(),o=JS(t),s=n?i:void 0,c=Fx(()=>Symbol(`labelable-control`)),l=b.useRef(!1),u=b.useRef(t!=null),d=Z(()=>{!l.current||a===bS||(l.current=!1,a(c.current,void 0))});return Q(()=>{if(a===bS)return;let e;if(n){let n=r?.current;e=mx(n)&&n.closest(`label`)!=null?t??null:s??o}else if(t!=null)u.current=!0,e=t;else if(u.current)e=o;else{d();return}if(e===void 0){d();return}l.current=!0,a(c.current,e)},[t,r,s,a,n,o,c,d]),b.useEffect(()=>d,[d]),i??o}function tC(e){return e?.ownerDocument||document}var nC=typeof navigator<`u`,rC=fC(),iC=mC(),aC=pC(),oC=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),sC=rC.platform===`MacIntel`&&rC.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(rC.platform);nC&&/firefox/i.test(aC);var cC=nC&&/apple/i.test(navigator.vendor);nC&&/Edg/i.test(aC);var lC=nC&&/android/i.test(iC)||/android/i.test(aC),uC=nC&&iC.toLowerCase().startsWith(`mac`)&&!navigator.maxTouchPoints,dC=aC.includes(`jsdom/`);function fC(){if(!nC)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function pC(){if(!nC)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function mC(){if(!nC)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}var hC=`data-base-ui-focusable`,gC=`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`,_C=`ArrowLeft`,vC=`ArrowRight`,yC=`ArrowUp`,bC=`ArrowDown`;function xC(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function SC(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&gx(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function CC(e){return`composedPath`in e?e.composedPath()[0]:e.target}function wC(e,t){if(!mx(e))return!1;let n=e;if(t.hasElement(n))return!n.hasAttribute(`data-trigger-disabled`);for(let[,e]of t.entries())if(SC(e,n))return!e.hasAttribute(`data-trigger-disabled`);return!1}function TC(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function EC(e){return e.matches(`html,body`)}function DC(e){return hx(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function OC(e){return e?.closest(`button,a[href],[role="button"],select,[tabindex]:not([tabindex="-1"]),${gC}`)!=null}function kC(e){return e?e.getAttribute(`role`)===`combobox`&&DC(e):!1}function AC(e){if(!e||dC)return!0;try{return e.matches(`:focus-visible`)}catch{return!0}}function jC(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function MC(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...MC(e,t.id,n)])}function NC(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function PC(e){e.preventDefault(),e.stopPropagation()}function FC(e){return`nativeEvent`in e}function IC(e){return e.pointerType===``&&e.isTrusted?!0:lC&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function LC(e){return dC?!1:!lC&&e.width===0&&e.height===0||lC&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function RC(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function zC(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var BC=[`top`,`right`,`bottom`,`left`],VC=Math.min,HC=Math.max,UC=Math.round,WC=Math.floor,GC=e=>({x:e,y:e}),KC={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function qC(e,t,n){return HC(e,VC(t,n))}function JC(e,t){return typeof e==`function`?e(t):e}function YC(e){return e.split(`-`)[0]}function XC(e){return e.split(`-`)[1]}function ZC(e){return e===`x`?`y`:`x`}function QC(e){return e===`y`?`height`:`width`}function $C(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function ew(e){return ZC($C(e))}function tw(e,t,n){n===void 0&&(n=!1);let r=XC(e),i=ew(e),a=QC(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=uw(o)),[o,uw(o)]}function nw(e){let t=uw(e);return[rw(e),t,rw(t)]}function rw(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var iw=[`left`,`right`],aw=[`right`,`left`],ow=[`top`,`bottom`],sw=[`bottom`,`top`];function cw(e,t,n){switch(e){case`top`:case`bottom`:return n?t?aw:iw:t?iw:aw;case`left`:case`right`:return t?ow:sw;default:return[]}}function lw(e,t,n,r){let i=XC(e),a=cw(YC(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(rw)))),a}function uw(e){let t=YC(e);return KC[t]+e.slice(t.length)}function dw(e){return{top:0,right:0,bottom:0,left:0,...e}}function fw(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:dw(e)}function pw(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function mw(e,t,n){return Math.floor(e/t)!==n}function hw(e,t){return t<0||t>=e.length}function gw(e,t){return vw(e.current,{disabledIndices:t})}function _w(e,t){return vw(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function vw(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&Cw(e,a,r));return a}function yw(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!Cw(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=WC(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!Cw(e,r,s))return r}};d&&PC(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=vw(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=vw(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}hw(e,f)&&(f=u)}if(n===`both`){let n=WC(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&PC(t),u%o===o-1?r&&(f=vw(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=vw(e,{startingIndex:u,disabledIndices:s}),r&&mw(f,o,n)&&(f=vw(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),mw(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&PC(t),u%o===0?r&&(f=vw(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=vw(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&mw(f,o,n)&&(f=vw(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),mw(f,o,n)&&(f=u));let c=WC(l/o)===n;hw(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:vw(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function bw(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function xw(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function Sw(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function Cw(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?Tw(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function ww(e){return e.visibility===`hidden`||e.visibility===`collapse`}function Tw(e,t=e?Ox(e):null){return!e||!e.isConnected||!t||ww(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var Ew=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function Dw(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return gx(n)?n.host:null}function Ow(e){for(let t of Array.from(e.children))if(ux(t)===`summary`)return t;return null}function kw(e,t){let n=Ow(t);return!!n&&(e===n||SC(n,e))}function Aw(e){let t=e?ux(e):``;return e!=null&&e.matches(Ew)&&(t!==`summary`||e.parentElement!=null&&ux(e.parentElement)===`details`&&Ow(e.parentElement)===e)&&(t!==`details`||Ow(e)==null)&&(t!==`input`||e.type!==`hidden`)}function jw(e){if(!Aw(e)||!e.isConnected||e.matches(`:disabled`))return!1;for(let t=e;t;t=Dw(t)){let n=t!==e,r=ux(t)===`slot`;if(t.hasAttribute(`inert`)||n&&ux(t)===`details`&&!t.open&&!kw(e,t)||t.hasAttribute(`hidden`)||!r&&!Mw(t,n))return!1}return!0}function Mw(e,t){let n=Ox(e);return t?n.display!==`none`:Tw(e,n)}function Nw(e){let t=e.tabIndex;if(t<0){let t=ux(e);if(t===`details`||t===`audio`||t===`video`||hx(e)&&e.isContentEditable)return 0}return t}function Pw(e){if(ux(e)!==`input`)return null;let t=e;return t.type===`radio`&&t.name!==``?t:null}function Fw(e,t){let n=Pw(e);if(!n)return!0;let r=t.find(e=>{let t=Pw(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=Pw(e);return t?.name===n.name&&t.form===n.form})===n}function Iw(e){if(hx(e)&&ux(e)===`slot`){let t=e.assignedElements({flatten:!0});if(t.length>0)return t}return hx(e)&&e.shadowRoot?Array.from(e.shadowRoot.children):Array.from(e.children)}function Lw(e,t){Iw(e).forEach(e=>{Aw(e)&&t.push(e),Lw(e,t)})}function Rw(e,t,n){Iw(e).forEach(e=>{hx(e)&&e.matches(t)&&n.push(e),Rw(e,t,n)})}function zw(e){return jw(e)&&Nw(e)>=0}function Bw(e){let t=[];return Lw(e,t),t.filter(jw)}function Vw(e){let t=Bw(e);return t.filter(e=>Nw(e)>=0&&Fw(e,t))}function Hw(e,t){let n=Vw(e),r=n.length;if(r===0)return;let i=xC(tC(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function Uw(e){return Hw(tC(e).body,1)||e}function Ww(e){return Hw(tC(e).body,-1)||e}function Gw(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!SC(n,r)}function Kw(e){Vw(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function qw(e){let t=[];Rw(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var Jw=[];function Yw(e){b.useEffect(e,Jw)}var Xw=0,Zw=class e{static create(){return new e}currentId=Xw;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Xw,t()},e)}isStarted(){return this.currentId!==Xw}clear=()=>{this.currentId!==Xw&&(clearTimeout(this.currentId),this.currentId=Xw)};disposeEffect=()=>this.clear};function Qw(){let e=Fx(Zw.create).current;return Yw(e.disposeEffect),e}var $w=null;globalThis.requestAnimationFrame;var eT=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},tT=class e{static create(){return new e}static request(e){return eT.request(e)}static cancel(e){return eT.cancel(e)}currentId=$w;request(e){this.cancel(),this.currentId=eT.request(()=>{this.currentId=$w,e()})}cancel=()=>{this.currentId!==$w&&(eT.cancel(this.currentId),this.currentId=$w)};disposeEffect=()=>this.cancel};function nT(){let e=Fx(tT.create).current;return Yw(e.disposeEffect),e}function rT(e){return e==null?e:`current`in e?e.current:e}var iT=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),aT={[iT.startingStyle]:``},oT={[iT.endingStyle]:``},sT={transitionStatus(e){return e===`starting`?aT:e===`ending`?oT:null}},cT=c(g());function lT(e,t=!1,n=!0){let r=nT();return Z((i,a=null)=>{r.cancel();let o=rT(e);if(o==null)return;let s=o,c=()=>{cT.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=iT.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function uT(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=Z(i),o=lT(r,n,!1);b.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}function dT(e,t=!1,n=!1){let[r,i]=b.useState(e&&t?`idle`:void 0),[a,o]=b.useState(e);return e&&!a&&(o(!0),i(`starting`)),!e&&a&&r!==`ending`&&!n&&i(`ending`),!e&&!a&&r===`ending`&&i(void 0),Q(()=>{if(!e&&a&&r!==`ending`&&n){let e=tT.request(()=>{i(`ending`)});return()=>{tT.cancel(e)}}},[e,a,r,n]),Q(()=>{if(!e||t)return;let n=tT.request(()=>{i(void 0)});return()=>{tT.cancel(n)}},[t,e]),Q(()=>{if(!e||!t)return;e&&a&&r!==`idle`&&i(`starting`);let n=tT.request(()=>{i(`idle`)});return()=>{tT.cancel(n)}},[t,e,a,r]),{mounted:a,setMounted:o,transitionStatus:r}}function fT({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=b.useRef(e!==void 0),[a,o]=b.useState(t);return[i?e:a,b.useCallback(e=>{i||o(e)},[])]}function pT(e,t){let{enabled:n=!0,getValue:r,id:i,value:a}=t,{registerFieldControl:o}=VS(),s=b.useRef(null);s.current||=Symbol(),Q(()=>{let t=s.current;if(!(!t||!n))return o(t,{controlRef:e,getValue:r,id:i,value:a}),()=>{o(t,void 0)}},[e,n,r,i,o,a])}var mT=`none`,hT=`trigger-press`,gT=`trigger-hover`,_T=`trigger-focus`,vT=`outside-press`,yT=`item-press`,bT=`close-press`,xT=`focus-out`,ST=`escape-key`,CT=`list-navigation`,wT=`cancel-open`,TT=`disabled`,ET=`imperative-action`,DT=`window-resize`;function OT(e,t,n,r){let i=!1,a=!1,o=r??SS;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var kT=b.forwardRef(function(e,t){let{render:n,className:r,id:i,name:a,value:o,disabled:s=!1,onValueChange:c,defaultValue:l,autoFocus:u=!1,style:d,...f}=e,{state:p,name:m,disabled:h,setTouched:g,setDirty:_,validityData:v,setFocused:y,setFilled:x,validationMode:S,validation:C}=VS(),w=h||s,T=m??a,E={...p,disabled:w},{labelId:D}=XS(),O=eC({id:i});Q(()=>{let e=o!=null;C.inputRef.current?.value||e&&o!==``?x(!0):e&&o===``&&x(!1)},[C.inputRef,x,o]);let k=b.useRef(null);Q(()=>{u&&k.current===xC(tC(k.current))&&y(!0)},[u,y]);let[A]=fT({controlled:o,default:l,name:`FieldControl`,state:`value`}),j=o!==void 0,M=j?A:void 0,N=Z(()=>C.inputRef.current?.value);return pT(C.inputRef,{id:O,value:M,getValue:N}),ES(`input`,e,{ref:[t,k],state:E,props:[{id:O,disabled:w,name:T,ref:C.inputRef,"aria-labelledby":D,autoFocus:u,...j?{value:M}:{defaultValue:l},onChange(e){let t=e.currentTarget.value;c?.(t,OT(mT,e.nativeEvent)),_(t!==v.initialValue),x(t!==``)},onFocus(){y(!0)},onBlur(e){g(!0),y(!1),S===`onBlur`&&C.commit(e.currentTarget.value)},onKeyDown(e){e.currentTarget.tagName===`INPUT`&&e.key===`Enter`&&(g(!0),C.commit(e.currentTarget.value))}},C.getInputValidationProps(),f],stateAttributesMapping:zS})}),AT=b.forwardRef(function(e,t){return(0,y.jsx)(kT,{ref:t,...e})});function jT({className:e,type:t,...n}){return(0,y.jsx)(AT,{type:t,"data-slot":`input`,className:cx(`h-9 w-full min-w-0 rounded-md border border-input bg-transparent px-2.5 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40`,e),...n})}function MT({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:cx(`group/input-group relative flex h-9 w-full min-w-0 items-center rounded-md border border-input shadow-xs transition-[color,box-shadow] outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:bg-input/30 dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var NT=Ly(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:-ml-1 has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:-mr-1 has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function PT({className:e,align:t=`inline-start`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:cx(NT({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...n})}var FT=Ly(`flex items-center gap-2 text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 rounded-[calc(var(--radius)-5px)] px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 rounded-[calc(var(--radius)-5px)] p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function IT({className:e,type:t=`button`,variant:n=`ghost`,size:r=`xs`,...i}){return(0,y.jsx)(PS,{type:t,"data-size":r,variant:n,className:cx(FT({size:r}),e),...i})}function LT({className:e,...t}){return(0,y.jsx)(`span`,{className:cx(`flex items-center gap-2 text-sm text-muted-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e),...t})}function RT({className:e,...t}){return(0,y.jsx)(jT,{"data-slot":`input-group-control`,className:cx(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 aria-invalid:ring-0 dark:bg-transparent`,e),...t})}var zT=({searchInputRef:e,searchQuery:t,searchResults:n,onSearchChange:r,onKeyDown:i,onFindNext:a,onFindPrevious:o})=>{let s=n.resultCount===0?`0/0`:`${n.resultIndex+1}/${n.resultCount}`;return(0,y.jsxs)(MT,{role:`search`,"aria-label":`find in terminal`,className:`absolute top-2 right-3 z-10 w-[min(20rem,calc(100vw-1.5rem))] border-border/60 bg-background/70 text-muted-foreground shadow-xs backdrop-blur-md dark:bg-background/70`,children:[(0,y.jsx)(RT,{ref:e,type:`search`,value:t,onChange:r,onKeyDown:i,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(PT,{align:`inline-end`,children:[(0,y.jsx)(LT,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:s}),(0,y.jsx)(IT,{size:`icon-xs`,onClick:o,disabled:n.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(wy,{})}),(0,y.jsx)(IT,{size:`icon-xs`,onClick:a,disabled:n.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(Cy,{})})]})]})};function BT(e){let t=b.useRef(!0);t.current&&(t.current=!1,e())}function VT(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var HT={},UT={},WT=``;function GT(e){if(typeof document>`u`)return!1;let t=tC(e);return dx(t).innerWidth-t.documentElement.clientWidth>0}function KT(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=tC(e),n=t.documentElement,r=t.body,i=_x(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function qT(e){let t=tC(e),n=t.documentElement,r=t.body,i=_x(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function JT(e){let t=tC(e),n=t.documentElement,r=t.body,i=dx(n),a=0,o=0,s=!1,c=tT.create();if(oC&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,HT={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},WT=n.style.scrollBehavior,UT={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=_x(n)?n:r;if(s=KT(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,HT),Object.assign(r.style,UT),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=WT)}function d(){u(),c.request(l)}l();let f=VT(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var YT=new class{lockCount=0;restore=null;timeoutLock=Zw.create();timeoutUnlock=Zw.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=tC(e).documentElement,n=dx(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=bS;return}let r=sC||!GT(e);this.restore=r?qT(e):JT(e)}};function XT(e=!0,t=null){Q(()=>{if(e)return YT.acquire(t)},[e,t])}function ZT(e,t){return t!=null&&!RC(t)?0:typeof e==`function`?e():e}function QT(e,t,n){let r=ZT(e,n);return typeof r==`number`?r:r?.[t]}function $T(e){return typeof e==`function`?e():e}function eE(e,t){return t||e===`click`||e===`mousedown`}var tE=b.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Zw,currentIdRef:{current:null},currentContextRef:{current:null}});function nE(e){let{children:t,delay:n,timeoutMs:r=0}=e,i=b.useRef(n),a=b.useRef(n),o=b.useRef(null),s=b.useRef(null),c=Qw();return(0,y.jsx)(tE.Provider,{value:b.useMemo(()=>({hasProvider:!0,delayRef:i,initialDelayRef:a,currentIdRef:o,timeoutMs:r,currentContextRef:s,timeout:c}),[r,c]),children:t})}function rE(e,t={open:!1}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`floatingId`),{open:i}=t,{currentIdRef:a,delayRef:o,timeoutMs:s,initialDelayRef:c,currentContextRef:l,hasProvider:u,timeout:d}=b.useContext(tE),[f,p]=b.useState(!1);return Q(()=>{function e(){p(!1),l.current?.setIsInstantPhase(!1),a.current=null,l.current=null,o.current=c.current}if(a.current&&!i&&a.current===r){if(p(!1),s){let t=r;return d.start(s,()=>{n.select(`open`)||a.current&&a.current!==t||e()}),()=>{d.clear()}}e()}},[i,r,a,o,s,c,l,d,n]),Q(()=>{if(!i)return;let e=l.current,t=a.current;d.clear(),l.current={onOpenChange:n.setOpen,setIsInstantPhase:p},a.current=r,o.current={open:0,close:QT(c.current,`close`)},t!==null&&t!==r?(p(!0),e?.setIsInstantPhase(!0),e?.onOpenChange(!1,OT(mT))):(p(!1),e?.setIsInstantPhase(!1))},[i,r,n,a,o,s,c,l,d]),Q(()=>()=>{l.current=null},[l]),b.useMemo(()=>({hasProvider:u,delayRef:o,isInstantPhase:f}),[u,o,f])}function iE(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function aE(e){let t=Fx(oE,e).current;return t.next=e,Q(t.effect),t}function oE(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var sE={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},cE={...sE,position:`fixed`,top:0,left:0},lE={...sE,position:`absolute`},uE=b.forwardRef(function(e,t){let[n,r]=b.useState();Q(()=>{cC&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,y.jsx)(`span`,{...e,ref:t,style:cE,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})});function dE(e){return`data-base-ui-${e}`}var fE=0;function pE(e,t={}){let{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=t;r&&cancelAnimationFrame(fE);let a=()=>e?.focus({preventScroll:n});if(i)return a(),bS;let o=requestAnimationFrame(a);return fE=o,()=>{fE===o&&(cancelAnimationFrame(o),fE=0)}}var mE={inert:new WeakMap,"aria-hidden":new WeakMap},hE=`data-base-ui-inert`,gE={inert:new WeakSet,"aria-hidden":new WeakSet},_E=new WeakMap,vE=0;function yE(e){return gE[e]}function bE(e){return e?gx(e)?e.host:bE(e.parentNode):null}var xE=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=bE(t);return e.contains(n)?n:null}).filter(e=>e!=null),SE=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},CE=(e,t,n)=>{let r=[],i=e=>{!e||n.has(e)||Array.from(e.children).forEach(e=>{ux(e)!==`script`&&(t.has(e)?i(e):r.push(e))})};return i(e),r};function wE(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=xE(t,e),u=i?xE(t,a):[],d=new Set(u),f=i?CE(t,SE(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=mE[o],n=yE(o);c=n,s=e;let r=xE(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);CE(t,SE(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(_E.get(e)||0)+1;_E.set(e,t),m.push(e),t===1&&e.setAttribute(hE,``)}),vE+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(_E.get(e)||0)-1;_E.set(e,t),t||e.removeAttribute(hE)}),--vE,vE||(mE.inert=new WeakMap,mE[`aria-hidden`]=new WeakMap,gE.inert=new WeakSet,gE[`aria-hidden`]=new WeakSet,_E=new WeakMap)}}function TE(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=tC(e[0]).body;return wE(e,o,n,r,{mark:i,markerIgnoreElements:a})}var EE={style:{transition:`none`}},DE=`data-base-ui-click-trigger`,OE={fallbackAxisSide:`none`},kE={fallbackAxisSide:`end`},AE={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},jE=b.createContext(null),ME=()=>b.useContext(jE),NE=dE(`portal`);function PE(e={}){let{ref:t,container:n,componentProps:r=SS,elementProps:i}=e,a=qS(),o=ME()?.portalNode,[s,c]=b.useState(null),[l,u]=b.useState(null),d=Z(e=>{e!==null&&u(e)}),f=b.useRef(null);Q(()=>{if(n===null){f.current&&(f.current=null,u(null),c(null));return}if(a==null)return;let e=(n&&(px(n)?n:n.current))??o??document.body;if(e==null){f.current&&(f.current=null,u(null),c(null));return}f.current!==e&&(f.current=e,u(null),c(e))},[n,o,a]);let p=ES(`div`,r,{ref:[t,d],props:[{id:a,[NE]:``},i]});return{portalNode:l,portalSubtree:s&&p?cT.createPortal(p,s):null}}var FE=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,renderGuards:o,style:s,...c}=e,{portalNode:l,portalSubtree:u}=PE({container:r,ref:t,componentProps:e,elementProps:c}),d=b.useRef(null),f=b.useRef(null),p=b.useRef(null),m=b.useRef(null),[h,g]=b.useState(null),_=b.useRef(!1),v=h?.modal,x=h?.open,S=typeof o==`boolean`?o:!!h&&!h.modal&&h.open&&!!l;b.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&Gw(e)&&(e.type===`focusin`?_.current&&=(qw(l),!1):(Kw(l),_.current=!0))}return iE(VT(l,`focusin`,e,!0),VT(l,`focusout`,e,!0))},[l,v]),b.useEffect(()=>{!l||x!==!1||(qw(l),_.current=!1)},[x,l]);let C=b.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,y.jsxs)(b.Fragment,{children:[u,(0,y.jsxs)(jE.Provider,{value:C,children:[S&&l&&(0,y.jsx)(uE,{"data-type":`outside`,ref:d,onFocus:e=>{Gw(e,l)?p.current?.focus():Ww(h?h.domReference:null)?.focus()}}),S&&l&&(0,y.jsx)(`span`,{"aria-owns":l.id,style:AE}),l&&cT.createPortal(n,l),S&&l&&(0,y.jsx)(uE,{"data-type":`outside`,ref:f,onFocus:e=>{Gw(e,l)?m.current?.focus():(Uw(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,OT(`focus-out`,e.nativeEvent)))}})]})]})});function IE(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var LE=b.createContext(null),RE=b.createContext(null),zE=()=>b.useContext(LE)?.id||null,BE=e=>{let t=b.useContext(RE);return e??t};function VE(e,t){let n=dx(CC(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var HE=20,UE=[];function WE(){UE=UE.filter(e=>e.deref()?.isConnected)}function GE(e){WE(),e&&ux(e)!==`body`&&(UE.push(new WeakRef(e)),UE.length>HE&&(UE=UE.slice(-HE)))}function KE(){return WE(),UE[UE.length-1]?.deref()}function qE(e){return e?zw(e)?e:Vw(e)[0]||e:null}function JE(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=Bw(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return zw(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function YE(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:a=!0,restoreFocus:o=!1,modal:s=!0,closeOnFocusOut:c=!0,openInteractionType:l=``,nextFocusableElement:u,previousFocusableElement:d,beforeContentFocusGuardRef:f,externalTree:p,getInsideElements:m}=e,h=`rootStore`in t?t.rootStore:t,g=h.useState(`open`),_=h.useState(`domReferenceElement`),v=h.useState(`floatingElement`),{events:x,dataRef:S}=h.context,C=Z(()=>S.current.floatingContext?.nodeId),w=i===!1,T=kC(_)&&w,E=b.useRef([`content`]),D=aE(i),O=aE(a),k=aE(l),A=BE(p),j=ME(),M=b.useRef(!1),N=b.useRef(!1),P=b.useRef(!1),F=b.useRef(null),I=b.useRef(``),L=b.useRef(``),ee=b.useRef(null),R=b.useRef(null),te=dS(ee,f,j?.beforeInsideRef),z=dS(R,j?.afterInsideRef),B=Qw(),V=Qw(),ne=nT(),re=j!=null,H=jC(v),ie=Z((e=H)=>e?Vw(e):[]),ae=Z(()=>m?.().filter(e=>e!=null)??[]);b.useEffect(()=>{if(r||!s)return;function e(e){e.key===`Tab`&&SC(H,xC(tC(H)))&&ie().length===0&&!T&&PC(e)}return VT(tC(H),`keydown`,e)},[r,_,H,s,E,T,ie]),b.useEffect(()=>{if(r||!g)return;let e=tC(H);function t(){P.current=!1}function n(e){let t=CC(e),n=ae();P.current=!(SC(v,t)||SC(_,t)||SC(j?.portalNode,t)||n.some(e=>e===t||SC(e,t))),L.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(N.current=!0)}function i(){L.current=`keyboard`}return iE(VT(e,`pointerdown`,n,!0),VT(e,`pointerup`,t,!0),VT(e,`pointercancel`,t,!0),VT(e,`keydown`,i,!0))},[r,v,_,H,g,j,ae]),b.useEffect(()=>{if(r||!c)return;let e=tC(H);function t(){N.current=!0,V.start(0,()=>{N.current=!1})}function n(e){let t=CC(e);zw(t)&&(F.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=CC(t);queueMicrotask(()=>{let a=C(),c=h.context.triggerElements,l=ae(),f=n?.hasAttribute(dE(`focus-guard`))&&[ee.current,R.current,j?.beforeInsideRef.current,j?.afterInsideRef.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,rT(d),rT(u)].includes(n),p=!(SC(_,n)||SC(v,n)||SC(n,v)||SC(j?.portalNode,n)||l.some(e=>e===n||SC(e,n))||n!=null&&c.hasElement(n)||c.hasMatchingElement(e=>SC(e,n))||f||A&&(MC(A.nodesRef.current,a).find(e=>SC(e.context?.elements.floating,n)||SC(e.context?.elements.domReference,n))||NC(A.nodesRef.current,a).find(e=>[e.context?.elements.floating,jC(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===_&&H&&JE(H,E),o&&r!==_&&!Tw(i)&&xC(e)===e.body){if(hx(H)&&(H.focus(),o===`popup`)){ne.request(()=>{H.focus()});return}let e=ie(),t=F.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||H;hx(n)&&n.focus()}if(S.current.insideReactTree){S.current.insideReactTree=!1;return}(T||!s)&&n&&p&&!N.current&&(T||n!==KE())&&(M.current=!0,h.setOpen(!1,OT(xT,t)))})}function a(){P.current||(S.current.insideReactTree=!0,B.start(0,()=>{S.current.insideReactTree=!1}))}let l=hx(_)?_:null;if(!(!v&&!l))return iE(l&&VT(l,`focusout`,i),l&&VT(l,`pointerdown`,t),v&&VT(v,`focusin`,n),v&&VT(v,`focusout`,i),v&&j&&VT(v,`focusout`,a,!0))},[r,_,v,H,s,A,j,h,c,o,ie,T,C,E,S,B,V,ne,u,d,ae]),b.useEffect(()=>{if(r||!v||!g)return;let e=Array.from(j?.portalNode?.querySelectorAll(`[${dE(`portal`)}]`)||[]),t=(A?NC(A.nodesRef.current,C()):[]).find(e=>kC(e.context?.elements.domReference||null))?.context?.elements.domReference,n=TE([...[v,...e,ee.current,R.current,j?.beforeOutsideRef.current,j?.afterOutsideRef.current,...ae()],t,rT(d),rT(u),T?_:null].filter(e=>e!=null),{ariaHidden:s||T,mark:!1}),i=TE([v,...e].filter(e=>e!=null));return()=>{i(),n()}},[g,r,_,v,s,E,j,T,A,C,u,d,ae]),Q(()=>{if(!g||r||!hx(H))return;let e=xC(tC(H));queueMicrotask(()=>{let t=D.current,n=typeof t==`function`?t(k.current||``):t;if(n===void 0||n===!1||SC(H,e))return;let r=null,i=()=>(r??=ie(H),r[0]||H),a;a=n===!0||n===null?i():rT(n),a||=i(),pE(a,{preventScroll:a===H})})},[r,g,H,w,ie,D,k]),Q(()=>{if(r||!H)return;let e=tC(H);GE(xC(e));function t(e){if(e.open||(I.current=VE(e.nativeEvent,L.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(M.current=!0),e.reason===`outside-press`)if(e.nested)M.current=!1;else if(IC(e.nativeEvent)||LC(e.nativeEvent))M.current=!1;else{let e=!1;tC(H).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?M.current=!1:M.current=!0}}x.on(`openchange`,t);function n(){let e=O.current,t=typeof e==`function`?e(I.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`){let e=_||KE();return e&&e.isConnected?e:null}let n=_||KE();return rT(t)||n||null}return()=>{x.off(`openchange`,t);let r=xC(e),i=ae(),a=SC(v,r)||i.some(e=>e===r||SC(e,r))||A&&MC(A.nodesRef.current,C(),!1).some(e=>SC(e.context?.elements.floating,r)),o=O.current,s=n();queueMicrotask(()=>{let t=qE(s),n=typeof o!=`boolean`;o&&!M.current&&hx(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),M.current=!1})}},[r,v,H,O,S,x,A,_,C,ae]),Q(()=>{if(!oC||g||!v)return;let e=xC(tC(v));!hx(e)||!DC(e)||SC(v,e)&&e.blur()},[g,v]),Q(()=>{if(!(r||!j))return j.setFocusManagerState({modal:s,closeOnFocusOut:c,open:g,onOpenChange:h.setOpen,domReference:_}),()=>{j.setFocusManagerState(null)}},[r,j,s,g,h,c,_]),Q(()=>{if(!(r||!H))return JE(H,E),()=>{queueMicrotask(WE)}},[r,H,E]);let oe=!r&&(s?!T:!0)&&(re||s);return(0,y.jsxs)(b.Fragment,{children:[oe&&(0,y.jsx)(uE,{"data-type":`inside`,ref:te,onFocus:e=>{if(s){let e=ie();pE(e[e.length-1])}else j?.portalNode&&(M.current=!1,Gw(e,j.portalNode)?Uw(_)?.focus():rT(d??j.beforeOutsideRef)?.focus())}}),n,oe&&(0,y.jsx)(uE,{"data-type":`inside`,ref:z,onFocus:e=>{s?pE(ie()[0]):j?.portalNode&&(c&&(M.current=!0),Gw(e,j.portalNode)?Ww(_)?.focus():rT(u??j.afterOutsideRef)?.focus())}})]})}function XE(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,{enabled:i=!0,event:a=`click`,toggle:o=!0,ignoreMouse:s=!1,stickIfOpen:c=!0,touchOpenDelay:l=0,reason:u=hT}=t,d=b.useRef(void 0),f=nT(),p=Qw(),m=b.useMemo(()=>({onPointerDown(e){d.current=e.pointerType},onMouseDown(e){let t=d.current,i=e.nativeEvent,m=n.select(`open`);if(e.button!==0||a===`click`||RC(t,!0)&&s)return;let h=r.current.openEvent,g=h?.type,_=n.select(`domReferenceElement`)!==e.currentTarget,v=m&&_||!(m&&o&&(!(h&&c)||g===`click`||g===`mousedown`)),y=CC(i);if(DC(y)){let e=OT(u,i,y);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e);return}let b=e.currentTarget;f.request(()=>{let e=OT(u,i,b);v&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,e)}):n.setOpen(v,e)})},onClick(e){if(a===`mousedown-only`)return;let t=d.current;if(a===`mousedown`&&t){d.current=void 0;return}if(RC(t,!0)&&s)return;let i=n.select(`open`),f=r.current.openEvent,m=n.select(`domReferenceElement`)!==e.currentTarget,h=i&&m||!(i&&o&&(!(f&&c)||zC(f))),g=OT(u,e.nativeEvent,e.currentTarget);h&&t===`touch`&&l>0?p.start(l,()=>{n.setOpen(!0,g)}):n.setOpen(h,g)},onKeyDown(){d.current=void 0}}),[r,a,s,n,c,o,f,p,l,u]);return b.useMemo(()=>i?{reference:m}:SS,[i,m])}function ZE(e,t){let n=null,r=null,i=!1;return{contextElement:e||void 0,getBoundingClientRect(){let a=e?.getBoundingClientRect()||{width:0,height:0,x:0,y:0},o=t.axis===`x`||t.axis===`both`,s=t.axis===`y`||t.axis===`both`,c=[`mouseenter`,`mousemove`].includes(t.dataRef.current.openEvent?.type||``)&&t.pointerType!==`touch`,l=a.width,u=a.height,d=a.x,f=a.y;return n==null&&t.x&&o&&(n=a.x-t.x),r==null&&t.y&&s&&(r=a.y-t.y),d-=n||0,f-=r||0,l=0,u=0,!i||c?(l=t.axis===`y`?a.width:0,u=t.axis===`x`?a.height:0,d=o&&t.x!=null?t.x:d,f=s&&t.y!=null?t.y:f):i&&!c&&(u=t.axis===`x`?a.height:u,l=t.axis===`y`?a.width:l),i=!0,{width:l,height:u,x:d,y:f,top:f,right:d+l,bottom:f+u,left:d}}}}function QE(e){return e!=null&&e.clientX!=null}function $E(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{enabled:s=!0,axis:c=`both`}=t,l=b.useRef(!1),u=b.useRef(null),[d,f]=b.useState(),[p,m]=b.useState([]),h=Z((e,t,r)=>{l.current||o.current.openEvent&&!QE(o.current.openEvent)||n.set(`positionReference`,ZE(r??a,{x:e,y:t,axis:c,dataRef:o,pointerType:d}))}),g=Z(e=>{r?u.current||m([]):h(e.clientX,e.clientY,e.currentTarget)}),_=RC(d)?i:r,v=b.useCallback(()=>{if(!_||!s)return;let e=dx(i);function t(e){SC(i,CC(e))?(u.current?.(),u.current=null):h(e.clientX,e.clientY)}if(!o.current.openEvent||QE(o.current.openEvent))return u.current=VT(e,`mousemove`,t),()=>{u.current?.(),u.current=null};n.set(`positionReference`,a)},[_,s,i,o,a,n,h]);b.useEffect(()=>v(),[v,p]),b.useEffect(()=>{s&&!i&&(l.current=!1)},[s,i]),b.useEffect(()=>{!s&&r&&(l.current=!0)},[s,r]);let y=b.useMemo(()=>{function e(e){f(e.pointerType)}return{onPointerDown:e,onPointerEnter:e,onMouseMove:g,onMouseEnter:g}},[g]);return b.useMemo(()=>s?{reference:y,trigger:y}:{},[s,y])}var eD={intentional:`onClick`,sloppy:`onPointerDown`};function tD(){return!1}function nD(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function rD(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),{dataRef:a}=n.context,{enabled:o=!0,escapeKey:s=!0,outsidePress:c=!0,outsidePressEvent:l=`sloppy`,referencePress:u=tD,referencePressEvent:d=`sloppy`,bubbles:f,externalTree:p}=t,m=BE(p),h=Z(typeof c==`function`?c:()=>!1),g=typeof c==`function`?h:c,_=g!==!1,v=Z(()=>l),y=b.useRef(!1),x=b.useRef(!1),S=b.useRef(!1),{escapeKey:C,outsidePress:w}=nD(f),T=b.useRef(null),E=Qw(),D=Qw(),O=Z(()=>{D.clear(),a.current.insideReactTree=!1}),k=b.useRef(!1),A=b.useRef(``),j=Z(u),M=Z(e=>{if(!r||!o||!s||e.key!==`Escape`||k.current)return;let t=a.current.floatingContext?.nodeId,i=m?MC(m.nodesRef.current,t):[];if(!C&&i.length>0){let e=!0;if(i.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__escapeKeyBubbles&&(e=!1)}),!e)return}let c=OT(ST,FC(e)?e.nativeEvent:e);n.setOpen(!1,c),!C&&!c.isPropagationAllowed&&e.stopPropagation()}),N=Z(()=>{a.current.insideReactTree=!0,D.start(0,O)});b.useEffect(()=>{if(!r||!o)return;a.current.__escapeKeyBubbles=C,a.current.__outsidePressBubbles=w;let e=new Zw,t=new Zw;function c(){e.clear(),k.current=!0}function l(){e.start(Ex()?5:0,()=>{k.current=!1})}function u(){S.current=!0,t.start(0,()=>{S.current=!1})}function d(){y.current=!1,x.current=!1}function f(){let e=A.current,t=e===`pen`||!e?`mouse`:e,n=v(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function p(e){let t=f();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function h(e){let t=a.current.floatingContext?.nodeId,r=m&&MC(m.nodesRef.current,t).some(t=>TC(e,t.context?.elements.floating));return TC(e,n.select(`floatingElement`))||TC(e,n.select(`domReferenceElement`))||r}function b(e){if(p(e)){O();return}if(a.current.insideReactTree){O();return}let r=CC(e),i=`[${dE(`inert`)}]`,o=mx(r)?r.getRootNode():null,s=Array.from((gx(o)?o:tC(n.select(`floatingElement`))).querySelectorAll(i)),c=n.context.triggerElements;if(r&&(c.hasElement(r)||c.hasMatchingElement(e=>SC(e,r))))return;let l=mx(r)?r:null;for(;l&&!Dx(l);){let e=Ax(l);if(Dx(e)||!mx(e))break;l=e}if(s.length&&mx(r)&&!EC(r)&&!SC(r,n.select(`floatingElement`))&&s.every(e=>!SC(l,e)))return;if(hx(r)&&!(`touches`in e)){let t=Dx(r),n=Ox(r),i=/auto|scroll/,a=t||i.test(n.overflowX),o=t||i.test(n.overflowY),s=a&&r.clientWidth>0&&r.scrollWidth>r.clientWidth,c=o&&r.clientHeight>0&&r.scrollHeight>r.clientHeight,l=n.direction===`rtl`,u=c&&(l?e.offsetX<=r.offsetWidth-r.clientWidth:e.offsetX>r.clientWidth),d=s&&e.offsetY>r.clientHeight;if(u||d)return}if(h(e))return;if(f()===`intentional`&&S.current){t.clear(),S.current=!1;return}if(typeof g==`function`&&!g(e))return;let u=a.current.floatingContext?.nodeId,d=m?MC(m.nodesRef.current,u):[];if(d.length>0){let e=!0;if(d.forEach(t=>{t.context?.open&&!t.context.dataRef.current.__outsidePressBubbles&&(e=!1)}),!e)return}n.setOpen(!1,OT(vT,e)),O()}function D(e){f()!==`sloppy`||e.pointerType===`touch`||!n.select(`open`)||!o||TC(e,n.select(`floatingElement`))||TC(e,n.select(`domReferenceElement`))||b(e)}function j(e){if(f()!==`sloppy`||!n.select(`open`)||!o||TC(e,n.select(`floatingElement`))||TC(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];t&&(T.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},E.start(1e3,()=>{T.current&&(T.current.dismissOnTouchEnd=!1,T.current.dismissOnMouseDown=!1)}))}function N(e,t){let n=CC(e);if(!n)return;let r=VT(n,e.type,()=>{t(e),r()})}function P(e){A.current=`touch`,N(e,j)}function F(e){E.clear(),e.type===`pointerdown`&&(A.current=e.pointerType),!(e.type===`mousedown`&&T.current&&!T.current.dismissOnMouseDown)&&N(e,e=>{e.type===`pointerdown`?D(e):b(e)})}function I(e){if(!y.current)return;let n=x.current;if(d(),f()===`intentional`){if(e.type===`pointercancel`){n&&u();return}if(!h(e)){if(n){u();return}typeof g==`function`&&!g(e)||(t.clear(),S.current=!0,O())}}}function L(e){if(f()!==`sloppy`||!T.current||TC(e,n.select(`floatingElement`))||TC(e,n.select(`domReferenceElement`)))return;let t=e.touches[0];if(!t)return;let r=Math.abs(t.clientX-T.current.startX),i=Math.abs(t.clientY-T.current.startY),a=Math.sqrt(r*r+i*i);a>5&&(T.current.dismissOnTouchEnd=!0),a>10&&(b(e),E.clear(),T.current=null)}function ee(e){N(e,L)}function R(e){f()!==`sloppy`||!T.current||TC(e,n.select(`floatingElement`))||TC(e,n.select(`domReferenceElement`))||(T.current.dismissOnTouchEnd&&b(e),E.clear(),T.current=null)}function te(e){N(e,R)}let z=tC(i),B=iE(s&&iE(VT(z,`keydown`,M),VT(z,`compositionstart`,c),VT(z,`compositionend`,l)),_&&iE(VT(z,`click`,F,!0),VT(z,`pointerdown`,F,!0),VT(z,`pointerup`,I,!0),VT(z,`pointercancel`,I,!0),VT(z,`mousedown`,F,!0),VT(z,`mouseup`,I,!0),VT(z,`touchstart`,P,!0),VT(z,`touchmove`,ee,!0),VT(z,`touchend`,te,!0)));return()=>{B(),e.clear(),t.clear(),d(),S.current=!1}},[a,i,s,_,g,r,o,C,w,M,O,v,m,n,E]),b.useEffect(O,[g,O]);let P=b.useMemo(()=>({onKeyDown:M,[eD[d]]:e=>{j()&&n.setOpen(!1,OT(hT,e.nativeEvent))},...d!==`intentional`&&{onClick(e){j()&&n.setOpen(!1,OT(`trigger-press`,e.nativeEvent))}}}),[M,n,d,j]),F=Z(e=>{if(!r||!o||e.button!==0)return;let t=CC(e.nativeEvent);SC(n.select(`floatingElement`),t)&&(y.current||(y.current=!0,x.current=!1))}),I=Z(e=>{!r||!o||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&y.current&&(x.current=!0)}),L=b.useMemo(()=>({onKeyDown:M,onPointerDown:I,onMouseDown:I,onClickCapture:N,onMouseDownCapture(e){N(),F(e)},onPointerDownCapture(e){N(),F(e)},onMouseUpCapture:N,onTouchEndCapture:N,onTouchMoveCapture:N}),[M,N,F,I]);return b.useMemo(()=>o?{reference:P,floating:L,trigger:P}:{},[o,P,L])}function iD(e,t,n){let{reference:r,floating:i}=e,a=$C(t),o=ew(t),s=QC(o),c=YC(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(XC(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function aD(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=JC(t,e),p=fw(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=pw(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=pw(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var oD=50,sD=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:aD},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=iD(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<oD&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=iD(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},cD=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=JC(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=YC(r),_=$C(o),v=YC(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[uw(o)]:nw(o)),x=p!==`none`;!d&&x&&b.push(...lw(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=tw(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==$C(t))||T.every(e=>$C(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=$C(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function lD(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function uD(e){return BC.some(t=>e[t]>=0)}var dD=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=JC(e,t);switch(i){case`referenceHidden`:{let e=lD(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:uD(e)}}}case`escaped`:{let e=lD(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:uD(e)}}}default:return{}}}}},fD=new Set([`left`,`top`]);async function pD(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=YC(n),s=XC(n),c=$C(n)===`y`,l=fD.has(o)?-1:1,u=a&&c?-1:1,d=JC(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var mD=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await pD(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},hD=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=JC(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=$C(YC(i)),p=ZC(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=qC(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=qC(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},gD=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=JC(e,t),u={x:n,y:r},d=$C(i),f=ZC(d),p=u[f],m=u[d],h=JC(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=fD.has(YC(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},_D=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=JC(e,t),u=await o.detectOverflow(t,l),d=YC(i),f=XC(i),p=$C(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=VC(h-u[g],v),x=VC(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=HC(u.left,0),t=HC(u.right,0),n=HC(u.top,0),r=HC(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:HC(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:HC(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function vD(e){let t=Ox(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=hx(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=UC(n)!==a||UC(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function yD(e){return mx(e)?e:e.contextElement}function bD(e){let t=yD(e);if(!hx(t))return GC(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=vD(t),o=(a?UC(n.width):n.width)/r,s=(a?UC(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var xD=GC(0);function SD(e){let t=dx(e);return!Ex()||!t.visualViewport?xD:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function CD(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==dx(e)?!1:t}function wD(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=yD(e),o=GC(1);t&&(r?mx(r)&&(o=bD(r)):o=bD(e));let s=CD(a,n,r)?SD(a):GC(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=dx(a),t=r&&mx(r)?dx(r):r,n=e,i=Nx(n);for(;i&&r&&t!==n;){let e=bD(i),t=i.getBoundingClientRect(),r=Ox(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=dx(i),i=Nx(n)}}return pw({width:u,height:d,x:c,y:l})}function TD(e,t){let n=kx(e).scrollLeft;return t?t.left+n:wD(fx(e)).left+n}function ED(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-TD(e,n),y:n.top+t.scrollTop}}function DD(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=fx(r),s=t?yx(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=GC(1),u=GC(0),d=hx(r);if((d||!d&&!a)&&((ux(r)!==`body`||_x(o))&&(c=kx(r)),d)){let e=wD(r);l=bD(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?ED(o,c):GC(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function OD(e){return Array.from(e.getClientRects())}function kD(e){let t=fx(e),n=kx(e),r=e.ownerDocument.body,i=HC(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=HC(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+TD(e),s=-n.scrollTop;return Ox(r).direction===`rtl`&&(o+=HC(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var AD=25;function jD(e,t){let n=dx(e),r=fx(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ex();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=TD(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=AD&&(a-=o)}else l<=AD&&(a+=l);return{width:a,height:o,x:s,y:c}}function MD(e,t){let n=wD(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=hx(e)?bD(e):GC(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function ND(e,t,n){let r;if(t===`viewport`)r=jD(e,n);else if(t===`document`)r=kD(fx(e));else if(mx(t))r=MD(t,n);else{let n=SD(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return pw(r)}function PD(e,t){let n=Ax(e);return n===t||!mx(n)||Dx(n)?!1:Ox(n).position===`fixed`||PD(n,t)}function FD(e,t){let n=t.get(e);if(n)return n;let r=Mx(e,[],!1).filter(e=>mx(e)&&ux(e)!==`body`),i=null,a=Ox(e).position===`fixed`,o=a?Ax(e):e;for(;mx(o)&&!Dx(o);){let t=Ox(o),n=wx(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||_x(o)&&!n&&PD(e,o))?r=r.filter(e=>e!==o):i=t,o=Ax(o)}return t.set(e,r),r}function ID(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?yx(t)?[]:FD(t,this._c):[].concat(n),r],o=ND(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=ND(t,a[e],i);s=HC(n.top,s),c=VC(n.right,c),l=VC(n.bottom,l),u=HC(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function LD(e){let{width:t,height:n}=vD(e);return{width:t,height:n}}function RD(e,t,n){let r=hx(t),i=fx(t),a=n===`fixed`,o=wD(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=GC(0);function l(){c.x=TD(i)}if(r||!r&&!a)if((ux(t)!==`body`||_x(i))&&(s=kx(t)),r){let e=wD(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?ED(i,s):GC(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function zD(e){return Ox(e).position===`static`}function BD(e,t){if(!hx(e)||Ox(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return fx(e)===n&&(n=n.ownerDocument.body),n}function VD(e,t){let n=dx(e);if(yx(e))return n;if(!hx(e)){let t=Ax(e);for(;t&&!Dx(t);){if(mx(t)&&!zD(t))return t;t=Ax(t)}return n}let r=BD(e,t);for(;r&&vx(r)&&zD(r);)r=BD(r,t);return r&&Dx(r)&&zD(r)&&!wx(r)?n:r||Tx(e)||n}var HD=async function(e){let t=this.getOffsetParent||VD,n=this.getDimensions,r=await n(e.floating);return{reference:RD(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function UD(e){return Ox(e).direction===`rtl`}var WD={convertOffsetParentRelativeRectToViewportRelativeRect:DD,getDocumentElement:fx,getClippingRect:ID,getOffsetParent:VD,getElementRects:HD,getClientRects:OD,getDimensions:LD,getScale:bD,isElement:mx,isRTL:UD};function GD(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function KD(e,t){let n=null,r,i=fx(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=WC(d),h=WC(i.clientWidth-(u+f)),g=WC(i.clientHeight-(d+p)),_=WC(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:HC(0,VC(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!GD(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function qD(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=yD(e),u=i||a?[...l?Mx(l):[],...t?Mx(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?KD(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?wD(e):null;c&&g();function g(){let t=wD(e);h&&!GD(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var JD=mD,YD=hD,XD=cD,ZD=_D,QD=dD,$D=gD,eO=(e,t,n)=>{let r=new Map,i={platform:WD,...n},a={...i.platform,_c:r};return sD(e,t,{...i,platform:a})},tO=typeof document<`u`?b.useLayoutEffect:function(){};function nO(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!nO(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!nO(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function rO(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function iO(e,t){let n=rO(e);return Math.round(t*n)/n}function aO(e){let t=b.useRef(e);return tO(()=>{t.current=e}),t}function oO(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=b.useState(r);nO(f,r)||p(r);let[m,h]=b.useState(null),[g,_]=b.useState(null),v=b.useCallback(e=>{e!==C.current&&(C.current=e,h(e))},[]),y=b.useCallback(e=>{e!==w.current&&(w.current=e,_(e))},[]),x=a||m,S=o||g,C=b.useRef(null),w=b.useRef(null),T=b.useRef(u),E=c!=null,D=aO(c),O=aO(i),k=aO(l),A=b.useCallback(()=>{if(!C.current||!w.current)return;let e={placement:t,strategy:n,middleware:f};O.current&&(e.platform=O.current),eO(C.current,w.current,e).then(e=>{let t={...e,isPositioned:k.current!==!1};j.current&&!nO(T.current,t)&&(T.current=t,cT.flushSync(()=>{d(t)}))})},[f,t,n,O,k]);tO(()=>{l===!1&&T.current.isPositioned&&(T.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let j=b.useRef(!1);tO(()=>(j.current=!0,()=>{j.current=!1}),[]),tO(()=>{if(x&&(C.current=x),S&&(w.current=S),x&&S){if(D.current)return D.current(x,S,A);A()}},[x,S,A,D,E]);let M=b.useMemo(()=>({reference:C,floating:w,setReference:v,setFloating:y}),[v,y]),N=b.useMemo(()=>({reference:x,floating:S}),[x,S]),P=b.useMemo(()=>{let e={position:n,left:0,top:0};if(!N.floating)return e;let t=iO(N.floating,u.x),r=iO(N.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...rO(N.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,N.floating,u.x,u.y]);return b.useMemo(()=>({...u,update:A,refs:M,elements:N,floatingStyles:P}),[u,A,M,N,P])}var sO=(e,t)=>{let n=JD(e);return{name:n.name,fn:n.fn,options:[e,t]}},cO=(e,t)=>{let n=YD(e);return{name:n.name,fn:n.fn,options:[e,t]}},lO=(e,t)=>({fn:$D(e).fn,options:[e,t]}),uO=(e,t)=>{let n=XD(e);return{name:n.name,fn:n.fn,options:[e,t]}},dO=(e,t)=>{let n=ZD(e);return{name:n.name,fn:n.fn,options:[e,t]}},fO=(e,t)=>{let n=QD(e);return{name:n.name,fn:n.fn,options:[e,t]}},$=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(iS(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},pO=o((e=>{var t=f();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,s=t.useDebugValue;function c(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),c=r[0].inst,u=r[1];return o(function(){c.value=n,c.getSnapshot=t,l(c)&&u({inst:c})},[e,n,t]),a(function(){return l(c)&&u({inst:c}),e(function(){l(c)&&u({inst:c})})},[e]),s(n),n}function l(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function u(e,t){return t()}var d=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?u:c;e.useSyncExternalStore=t.useSyncExternalStore===void 0?d:t.useSyncExternalStore})),mO=o(((e,t)=>{t.exports=pO()})),hO=o((e=>{var t=f(),n=mO();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,l=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,u){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=c(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),u!==void 0&&f.hasValue){var t=f.value;if(u(t,e))return s=t}return s=e}if(t=s,i(o,e))return t;var n=r(e);return u!==void 0&&u(t,n)?(o=e,t):(o=e,s=n)}var a=!1,o,s,c=n===void 0?null:n;return[function(){return e(t())},c===null?void 0:function(){return e(c())}]},[t,n,r,u]);var p=a(e,d[0],d[1]);return s(function(){f.hasValue=!0,f.value=p},[p]),l(p),p}})),gO=o(((e,t)=>{t.exports=hO()})),_O=[],vO=void 0;function yO(){return vO}function bO(e){_O.push(e)}function xO(e){let t=(t,n)=>{let r=Fx(CO).current,i;try{vO=r;for(let e of _O)e.before(r);i=e(t,n);for(let e of _O)e.after(r);r.didInitialize=!0}finally{vO=void 0}return i};return t.displayName=e.displayName||e.name,t}function SO(e){return b.forwardRef(xO(e))}function CO(){return{didInitialize:!1}}var wO=mO(),TO=gO(),EO=vS(19)?kO:AO;function DO(e,t,n,r,i){return EO(e,t,n,r,i)}function OO(e,t,n,r,i){let a=b.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,wO.useSyncExternalStore)(e.subscribe,a,a)}bO({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,wO.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function kO(e,t,n,r,i){let a=yO();if(!a)return OO(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function AO(e,t,n,r,i){return(0,TO.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var jO=class{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return DO(this,e,t,n,r)}},MO=class extends jO{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){b.useDebugValue(e),Q(()=>{this.state[e]!==t&&this.set(e,t)},[e,t])}useSyncedValueWithCleanup(e,t){let n=this;Q(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;Q(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){b.useDebugValue(e);let n=t!==void 0;Q(()=>{n&&!Object.is(this.state[e],t)&&super.setState({...this.state,[e]:t})},[e,t,n])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return b.useDebugValue(e),DO(this,this.selectors[e],t,n,r)}useContextCallback(e,t){b.useDebugValue(e);let n=Z(t??bS);this.context[e]=n}useStateSetter(e){let t=b.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}},NO={open:$(e=>e.open),transitionStatus:$(e=>e.transitionStatus),domReferenceElement:$(e=>e.domReferenceElement),referenceElement:$(e=>e.positionReference??e.referenceElement),floatingElement:$(e=>e.floatingElement),floatingId:$(e=>e.floatingId)},PO=class extends MO{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:IE(),nested:n,triggerElements:i},NO),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&&zC(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}};function FO(e,t){let n=b.useRef(null),r=b.useRef(null);return b.useCallback(i=>{if(e!==void 0){if(n.current!==null){let e=n.current,i=r.current,a=t.context.triggerElements.getById(e);i&&a===i&&t.context.triggerElements.delete(e),n.current=null,r.current=null}i!==null&&(n.current=e,r.current=i,t.context.triggerElements.add(e,i))}},[t,e])}function IO(e,t,n,r){let i=n.useState(`isMountedByTrigger`,e),a=FO(e,n),o=Z(t=>{if(a(t),!t||!n.select(`open`))return;let i=n.select(`activeTriggerId`);if(i===e){n.update({activeTriggerElement:t,...r});return}i??n.update({activeTriggerId:e,activeTriggerElement:t,...r})});return Q(()=>{i&&n.update({activeTriggerElement:t.current,...r})},[i,n,t,...Object.values(r)]),{registerTrigger:o,isMountedByThisTrigger:i}}function LO(e){let t=e.useState(`open`);Q(()=>{if(t&&!e.select(`activeTriggerId`)&&e.context.triggerElements.size===1){let t=e.context.triggerElements.entries().next();if(!t.done){let[n,r]=t.value;e.update({activeTriggerId:n,activeTriggerElement:r})}}},[t,e])}function RO(e,t,n){let{mounted:r,setMounted:i,transitionStatus:a}=dT(e);t.useSyncedValues({mounted:r,transitionStatus:a});let o=Z(()=>{i(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),t.context.onOpenChangeComplete?.(!1)});return uT({enabled:!t.useState(`preventUnmountingOnClose`),open:e,ref:t.context.popupRef,onComplete(){e||o()}}),{forceUnmount:o,transitionStatus:a}}var zO=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}};function BO(){return new PO({open:!1,transitionStatus:void 0,floatingElement:null,referenceElement:null,triggerElements:new zO,floatingId:``,syncOnly:!1,nested:!1,onOpenChange:void 0})}function VO(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:void 0,floatingRootContext:BO(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:SS,inactiveTriggerProps:SS,popupProps:SS}}var HO=$(e=>e.triggerIdProp??e.activeTriggerId),UO={open:$(e=>e.openProp??e.open),mounted:$(e=>e.mounted),transitionStatus:$(e=>e.transitionStatus),floatingRootContext:$(e=>e.floatingRootContext),preventUnmountingOnClose:$(e=>e.preventUnmountingOnClose),payload:$(e=>e.payload),activeTriggerId:HO,activeTriggerElement:$(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:$((e,t)=>t!==void 0&&HO(e)===t),isOpenedByTrigger:$((e,t)=>t!==void 0&&HO(e)===t&&e.open),isMountedByTrigger:$((e,t)=>t!==void 0&&HO(e)===t&&e.mounted),triggerProps:$((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:$(e=>e.popupProps),popupElement:$(e=>e.popupElement),positionerElement:$(e=>e.positionerElement)};function WO(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=qS(),a=zE()!=null,o=Fx(()=>new PO({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new zO,floatingId:i,syncOnly:!1,nested:a})).current;return Q(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=mx(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),o.update(e)},[t,i,r.reference,r.floating,o]),o.context.onOpenChange=n,o.context.nested=a,o}function GO(e={}){let{nodeId:t,externalTree:n}=e,r=WO(e),i=e.rootContext||r,a={reference:i.useState(`referenceElement`),floating:i.useState(`floatingElement`),domReference:i.useState(`domReferenceElement`)},[o,s]=b.useState(null),c=b.useRef(null),l=BE(n);Q(()=>{a.domReference&&(c.current=a.domReference)},[a.domReference]);let u=oO({...e,elements:{...a,...o&&{reference:o}}}),d=b.useCallback(e=>{let t=mx(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;s(t),u.refs.setReference(t)},[u.refs]),[f,p]=b.useState(void 0),[m,h]=b.useState(null);i.useSyncedValue(`referenceElement`,f??null);let g=mx(f)?f:null;i.useSyncedValue(`domReferenceElement`,f===void 0?a.domReference:g),i.useSyncedValue(`floatingElement`,m);let _=b.useCallback(e=>{(mx(e)||e===null)&&(c.current=e,p(e)),(mx(u.refs.reference.current)||u.refs.reference.current===null||e!==null&&!mx(e))&&u.refs.setReference(e)},[u.refs,p]),v=b.useCallback(e=>{h(e),u.refs.setFloating(e)},[u.refs]),y=b.useMemo(()=>({...u.refs,setReference:_,setFloating:v,setPositionReference:d,domReference:c}),[u.refs,_,v,d]),x=b.useMemo(()=>({...u.elements,domReference:a.domReference}),[u.elements,a.domReference]),S=i.useState(`open`),C=i.useState(`floatingId`),w=b.useMemo(()=>({...u,dataRef:i.context.dataRef,open:S,onOpenChange:i.setOpen,events:i.context.events,floatingId:C,refs:y,elements:x,nodeId:t,rootStore:i}),[u,y,x,t,i,S,C]);return Q(()=>{i.context.dataRef.current.floatingContext=w;let e=l?.nodesRef.current.find(e=>e.id===t);e&&(e.context=w)}),b.useMemo(()=>({...u,context:w,refs:y,elements:x,rootStore:i}),[u,y,x,w,i])}function KO(e){let{popupStore:t,treatPopupAsFloatingElement:n=!1,onOpenChange:r}=e,i=qS(),a=zE()!=null,o=t.useState(`open`),s=t.useState(`activeTriggerElement`),c=t.useState(n?`popupElement`:`positionerElement`),l=t.context.triggerElements,u=Fx(()=>new PO({open:o,transitionStatus:void 0,referenceElement:s,floatingElement:c,triggerElements:l,onOpenChange:r,floatingId:i,syncOnly:!0,nested:a})).current;return Q(()=>{let e={open:o,floatingId:i,referenceElement:s,floatingElement:c};mx(s)&&(e.domReferenceElement=s),u.state.positionReference===u.state.referenceElement&&(e.positionReference=s),u.update(e)},[o,i,s,c,u]),u.context.onOpenChange=r,u.context.nested=a,u}var qO=uC&&cC;function JO(e,t={}){let n=`rootStore`in e?e.rootStore:e,{events:r,dataRef:i}=n.context,{enabled:a=!0,delay:o}=t,s=b.useRef(!1),c=b.useRef(null),l=Qw(),u=b.useRef(!0);b.useEffect(()=>{let e=n.select(`domReferenceElement`);if(!a)return;let t=dx(e);function r(){let e=n.select(`domReferenceElement`);!n.select(`open`)&&hx(e)&&e===xC(tC(e))&&(s.current=!0)}function i(){u.current=!0}function o(){u.current=!1}return iE(VT(t,`blur`,r),qO&&VT(t,`keydown`,i,!0),qO&&VT(t,`pointerdown`,o,!0))},[n,a]),b.useEffect(()=>{if(!a)return;function e(e){if(e.reason===`trigger-press`||e.reason===`escape-key`){let e=n.select(`domReferenceElement`);mx(e)&&(c.current=e,s.current=!0)}}return r.on(`openchange`,e),()=>{r.off(`openchange`,e)}},[r,a,n]);let d=b.useMemo(()=>({onMouseLeave(){s.current=!1,c.current=null},onFocus(e){let t=e.currentTarget;if(s.current){if(c.current===t)return;s.current=!1,c.current=null}let r=CC(e.nativeEvent);if(mx(r)){if(qO&&!e.relatedTarget){if(!u.current&&!DC(r))return}else if(!AC(r))return}let i=wC(e.relatedTarget,n.context.triggerElements),{nativeEvent:a,currentTarget:d}=e,f=typeof o==`function`?o():o;if(n.select(`open`)&&i||f===0||f===void 0){n.setOpen(!0,OT(_T,a,d));return}l.start(f,()=>{s.current||n.setOpen(!0,OT(_T,a,d))})},onBlur(e){s.current=!1,c.current=null;let t=e.relatedTarget,r=e.nativeEvent,a=mx(t)&&t.hasAttribute(dE(`focus-guard`))&&t.getAttribute(`data-type`)===`outside`;l.start(0,()=>{let e=n.select(`domReferenceElement`),o=xC(tC(e));!t&&o===e||SC(i.current.floatingContext?.refs.floating.current,o)||SC(e,o)||a||wC(t??o,n.context.triggerElements)||n.setOpen(!1,OT(_T,r))})}}),[i,n,l,o]);return b.useMemo(()=>a?{reference:d,trigger:d}:{},[a,d])}var YO=class e{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new Zw,this.restTimeout=new Zw,this.handleCloseOptions=void 0}static create(){return new e}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose},XO=new WeakMap;function ZO(e){if(!e.performedPointerEventsMutation)return;let t=e.pointerEventsScopeElement;t&&XO.get(t)===e&&(e.pointerEventsScopeElement?.style.removeProperty(`pointer-events`),e.pointerEventsReferenceElement?.style.removeProperty(`pointer-events`),e.pointerEventsFloatingElement?.style.removeProperty(`pointer-events`),XO.delete(t)),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null}function QO(e,t){let{scopeElement:n,referenceElement:r,floatingElement:i}=t,a=XO.get(n);a&&a!==e&&ZO(a),ZO(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=n,e.pointerEventsReferenceElement=r,e.pointerEventsFloatingElement=i,XO.set(n,e),n.style.pointerEvents=`none`,r.style.pointerEvents=`auto`,i.style.pointerEvents=`auto`}function $O(e){let t=Fx(YO.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||=t,Yw(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}function ek(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),{dataRef:o}=n.context,{enabled:s=!0,closeDelay:c=0,nodeId:l}=t,u=$O(n),d=BE(),f=zE(),p=Z(()=>eE(o.current.openEvent?.type,u.interactedInside)),m=Z(()=>{let e=o.current.openEvent?.type;return e?.includes(`mouse`)&&e!==`mousedown`}),h=Z(e=>wC(e,n.context.triggerElements)),g=b.useCallback(e=>{let t=QT(c,`close`,u.pointerType),r=()=>{n.setOpen(!1,OT(gT,e)),d?.events.emit(`floating.closed`,e)};t?u.openChangeTimeout.start(t,r):(u.openChangeTimeout.clear(),r())},[c,n,u,d]),_=Z(()=>{ZO(u)}),v=Z(e=>{let t=CC(e);if(!OC(t)){u.interactedInside=!1;return}u.interactedInside=t?.closest(`[aria-haspopup]`)!=null});Q(()=>{r||(u.pointerType=void 0,u.restTimeoutPending=!1,u.interactedInside=!1,_())},[r,u,_]),b.useEffect(()=>_,[_]),Q(()=>{if(s&&r&&u.handleCloseOptions?.blockPointerEvents&&m()&&mx(a)&&i){let e=a,t=i,n=tC(i),r=d?.nodesRef.current.find(e=>e.id===f)?.context?.elements.floating;return r&&(r.style.pointerEvents=``),QO(u,{scopeElement:u.handleCloseOptions?.getScope?.()??u.pointerEventsScopeElement??r??e.closest(`[data-rootownerid]`)??n.body,referenceElement:e,floatingElement:t}),()=>{_()}}},[s,r,a,i,u,m,d,f,_]);let y=Qw();b.useEffect(()=>{if(!s)return;function e(){u.openChangeTimeout.clear(),y.clear(),d?.events.off(`floating.closed`,r),_()}function t(e){if(d&&f&&MC(d.nodesRef.current,f).length>0){d.events.on(`floating.closed`,r);return}if(h(e.relatedTarget))return;let t=o.current.floatingContext?.nodeId??l,n=e.relatedTarget;if(!(d&&t&&mx(n)&&MC(d.nodesRef.current,t,!1).some(e=>SC(e.context?.elements.floating,n)))){if(u.handler){u.handler(e);return}_(),p()||g(e)}}function r(e){!d||!f||MC(d.nodesRef.current,f).length>0||y.start(0,()=>{d.events.off(`floating.closed`,r),n.setOpen(!1,OT(gT,e)),d.events.emit(`floating.closed`,e)})}let a=i;return iE(a&&VT(a,`mouseenter`,e),a&&VT(a,`mouseleave`,t),a&&VT(a,`pointerdown`,v,!0),()=>{d?.events.off(`floating.closed`,r)})},[s,i,n,o,l,p,h,g,_,v,u,d,f,y])}var tk={current:null};function nk(e,t={}){let n=`rootStore`in e?e.rootStore:e,{dataRef:r,events:i}=n.context,{enabled:a=!0,delay:o=0,handleClose:s=null,mouseOnly:c=!1,restMs:l=0,move:u=!0,triggerElementRef:d=tk,externalTree:f,isActiveTrigger:p=!0,getHandleCloseContext:m,isClosing:h}=t,g=BE(f),_=$O(n),v=b.useRef(!1),y=aE(s),x=aE(o),S=aE(l),C=aE(a),w=aE(h);p&&(_.handleCloseOptions=y.current?.__options);let T=Z(()=>eE(r.current.openEvent?.type,_.interactedInside)),E=Z(e=>wC(e,n.context.triggerElements)),D=Z((e,t,r)=>{let i=n.context.triggerElements;if(i.hasElement(t))return!e||!SC(e,t);if(!mx(r))return!1;let a=r;return i.hasMatchingElement(e=>SC(e,a))&&(!e||!SC(e,a))}),O=Z((e,t=!0)=>{let r=QT(x.current,`close`,_.pointerType);r?_.openChangeTimeout.start(r,()=>{n.setOpen(!1,OT(gT,e)),g?.events.emit(`floating.closed`,e)}):t&&(_.openChangeTimeout.clear(),n.setOpen(!1,OT(gT,e)),g?.events.emit(`floating.closed`,e))}),k=Z(()=>{_.handler&&=(tC(n.select(`domReferenceElement`)).removeEventListener(`mousemove`,_.handler),void 0)}),A=Z(()=>{ZO(_)});return b.useEffect(()=>k,[k]),b.useEffect(()=>{if(!a)return;function e(e){e.open?v.current=!1:(v.current=e.reason===gT,k(),_.openChangeTimeout.clear(),_.restTimeout.clear(),_.blockMouseMove=!0,_.restTimeoutPending=!1)}return i.on(`openchange`,e),()=>{i.off(`openchange`,e)}},[a,i,_,k]),b.useEffect(()=>{if(!a)return;let e=d.current??(p?n.select(`domReferenceElement`):null);if(!mx(e))return;function t(e){if(_.openChangeTimeout.clear(),_.blockMouseMove=!1,c&&!RC(_.pointerType))return;let t=$T(S.current),r=QT(x.current,`open`,_.pointerType),i=CC(e),a=e.currentTarget??null,o=n.select(`domReferenceElement`),s=a;if(mx(i)&&!n.context.triggerElements.hasElement(i)){for(let e of n.context.triggerElements.elements())if(SC(e,i)){s=e;break}}mx(a)&&mx(o)&&!n.context.triggerElements.hasElement(a)&&SC(a,o)&&(s=o);let l=s==null?!1:D(o,s,i),u=n.select(`open`),d=w.current?.()??n.select(`transitionStatus`)===`ending`,f=!u&&d&&v.current,p=!l&&mx(s)&&mx(o)&&SC(o,s)&&f,m=t>0&&!r,h=l&&(u||f)||p,g=!u||l;if(h){n.setOpen(!0,OT(gT,e,s));return}m||(r?_.openChangeTimeout.start(r,()=>{g&&n.setOpen(!0,OT(gT,e,s))}):g&&n.setOpen(!0,OT(gT,e,s)))}function i(e){if(T()){A();return}k();let t=tC(n.select(`domReferenceElement`));_.restTimeout.clear(),_.restTimeoutPending=!1;let i=r.current.floatingContext??m?.();if(!E(e.relatedTarget)){if(y.current&&i){n.select(`open`)||_.openChangeTimeout.clear();let r=d.current;_.handler=y.current({...i,tree:g,x:e.clientX,y:e.clientY,onClose(){A(),k(),C.current&&!T()&&r===n.select(`domReferenceElement`)&&O(e,!0)}}),t.addEventListener(`mousemove`,_.handler),_.handler(e);return}(_.pointerType!==`touch`||!SC(n.select(`floatingElement`),e.relatedTarget))&&O(e)}}return u?iE(VT(e,`mousemove`,t,{once:!0}),VT(e,`mouseenter`,t),VT(e,`mouseleave`,i)):iE(VT(e,`mouseenter`,t),VT(e,`mouseleave`,i))},[k,A,r,x,O,n,a,y,_,p,D,T,E,c,u,S,d,g,C,m,w]),b.useMemo(()=>{if(!a)return;function e(e){_.pointerType=e.pointerType}return{onPointerDown:e,onPointerEnter:e,onMouseMove(e){let{nativeEvent:t}=e,r=e.currentTarget,i=n.select(`domReferenceElement`),a=n.select(`open`),o=D(i,r,e.target);if(c&&!RC(_.pointerType))return;if(a&&o&&_.handleCloseOptions?.blockPointerEvents){let e=n.select(`floatingElement`);e&&QO(_,{scopeElement:_.handleCloseOptions?.getScope?.()??r.ownerDocument.body,referenceElement:r,floatingElement:e})}let s=$T(S.current);if(a&&!o||s===0||!o&&_.restTimeoutPending&&e.movementX**2+e.movementY**2<2)return;_.restTimeout.clear();function l(){if(_.restTimeoutPending=!1,T())return;let e=n.select(`open`);!_.blockMouseMove&&(!e||o)&&n.setOpen(!0,OT(gT,t,r))}_.pointerType===`touch`?cT.flushSync(()=>{l()}):o&&a?l():(_.restTimeoutPending=!0,_.restTimeout.start(s,l))}}},[a,_,T,D,c,n,S])}function rk(e=[]){let t=e.map(e=>e?.reference),n=e.map(e=>e?.floating),r=e.map(e=>e?.item),i=e.map(e=>e?.trigger),a=b.useCallback(t=>ik(t,e,`reference`),t),o=b.useCallback(t=>ik(t,e,`floating`),n),s=b.useCallback(t=>ik(t,e,`item`),r),c=b.useCallback(t=>ik(t,e,`trigger`),i);return b.useMemo(()=>({getReferenceProps:a,getFloatingProps:o,getItemProps:s,getTriggerProps:c}),[a,o,s,c])}function ik(e,t,n){let r=new Map,i=n===`item`,a={};n===`floating`&&(a.tabIndex=-1,a[hC]=``);for(let t in e)i&&e&&(t===`active`||t===`selected`)||(a[t]=e[t]);for(let o=0;o<t.length;o+=1){let s,c=t[o]?.[n];s=typeof c==`function`?e?c(e):null:c,s&&ak(a,s,i,r)}return ak(a,e,i,r),a}function ak(e,t,n,r){for(let i in t){let a=t[i];n&&(i===`active`||i===`selected`)||(i.startsWith(`on`)?(r.has(i)||r.set(i,[]),typeof a==`function`&&(r.get(i)?.push(a),e[i]=(...e)=>r.get(i)?.map(t=>t(...e)).find(e=>e!==void 0))):e[i]=a)}}var ok=`Escape`;function sk(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function ck(e,t){return sk(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function lk(e,t,n){return sk(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function uk(e,t,n){return sk(t,n?e===_C:e===vC,e===bC)}function dk(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===ok:sk(t,n?e===vC:e===_C,e===yC)}function fk(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingElement`),a=n.useState(`domReferenceElement`),o=n.context.dataRef,{listRef:s,activeIndex:c,onNavigate:l=()=>{},enabled:u=!0,selectedIndex:d=null,allowEscape:f=!1,loopFocus:p=!1,nested:m=!1,rtl:h=!1,virtual:g=!1,focusItemOnOpen:_=`auto`,focusItemOnHover:v=!0,openOnArrowKeyDown:y=!0,disabledIndices:x=void 0,orientation:S=`vertical`,parentOrientation:C,cols:w=1,id:T,resetOnPointerLeave:E=!0,externalTree:D}=t,O=aE(jC(i)),k=zE(),A=BE(D);Q(()=>{o.current.orientation=S},[o,S]);let j=kC(a),M=b.useRef(_),N=b.useRef(d??-1),P=b.useRef(null),F=b.useRef(!0),I=Z(e=>{l(N.current===-1?null:N.current,e)}),L=b.useRef(I),ee=b.useRef(!!i),R=b.useRef(r),te=b.useRef(!1),z=b.useRef(!1),B=b.useRef(null),V=aE(x),ne=aE(r),re=aE(d),H=aE(E),ie=Z(()=>{function e(e){g?A?.events.emit(`virtualfocus`,e):B.current=pE(e,{sync:te.current,preventScroll:!0})}let t=s.current[N.current],n=z.current;t&&e(t),(te.current?e=>e():requestAnimationFrame)(()=>{let r=s.current[N.current]||t;r&&(t||e(r),se&&(n||!F.current)&&r.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});Q(()=>{u&&(r&&i?(N.current=d??-1,M.current&&d!=null&&(z.current=!0,I())):ee.current&&(N.current=-1,L.current()))},[u,r,i,d,I]),Q(()=>{if(u){if(!r){te.current=!1;return}if(i)if(c==null){if(te.current=!1,re.current!=null)return;if(ee.current&&(N.current=-1,ie()),(!R.current||!ee.current)&&M.current&&(P.current!=null||M.current===!0&&P.current==null)){let e=0,t=()=>{s.current[0]==null?(e<2&&(e?requestAnimationFrame:queueMicrotask)(t),e+=1):(N.current=P.current==null||lk(P.current,S,h)||m?gw(s):_w(s),P.current=null,I())};t()}}else hw(s.current,c)||(N.current=c,ie(),z.current=!1)}},[u,r,i,c,re,m,s,S,h,I,ie,V]),Q(()=>{if(!u||i||!A||g||!ee.current)return;let e=A.nodesRef.current,t=e.find(e=>e.id===k)?.context?.elements.floating,n=xC(tC(i)),r=e.some(e=>e.context&&SC(e.context.elements.floating,n));t&&!r&&F.current&&t.focus({preventScroll:!0})},[u,i,A,k,g]),Q(()=>{L.current=I,R.current=r,ee.current=!!i}),Q(()=>{r||(P.current=null,M.current=_)},[r,_]);let ae=c!=null,oe=Z(e=>{if(!ne.current)return;let t=s.current.indexOf(e.currentTarget);t!==-1&&(N.current!==t||c!==t)&&(N.current=t,I(e))}),se=b.useMemo(()=>({onFocus(e){te.current=!0,oe(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){te.current=!0,z.current=!1,v&&oe(e)},onPointerLeave(e){if(!ne.current||!F.current||e.pointerType===`touch`)return;te.current=!0;let t=e.relatedTarget;if(!(!v||s.current.includes(t))&&H.current&&(B.current?.(),B.current=null,N.current=-1,I(e),!g)){let e=O.current,t=xC(tC(e));e&&SC(e,t)&&e.focus({preventScroll:!0})}}}),[oe,ne,O,v,s,I,H,g]),ce=b.useCallback(()=>C??A?.nodesRef.current.find(e=>e.id===k)?.context?.dataRef?.current.orientation,[k,A,C]),le=Z(e=>{if(F.current=!1,te.current=!0,e.which===229||!ne.current&&e.currentTarget===O.current)return;if(m&&dk(e.key,S,h,w)){ck(e.key,ce())||PC(e),n.setOpen(!1,OT(CT,e.nativeEvent)),hx(a)&&(g?A?.events.emit(`virtualfocus`,a):a.focus());return}let t=N.current,i=gw(s,x),o=_w(s,x);if(j||(e.key===`Home`&&(PC(e),N.current=i,I(e)),e.key===`End`&&(PC(e),N.current=o,I(e))),w>1){let t=Array.from({length:s.current.length},()=>({width:1,height:1})),n=bw(t,w,!1),r=n.findIndex(e=>e!=null&&!Cw(s.current,e,x)),a=n.reduce((e,t,n)=>t!=null&&!Cw(s.current,t,x)?n:e,-1),c=n[yw(n.map(e=>e==null?null:s.current[e]),{event:e,orientation:S,loopFocus:p,rtl:h,cols:w,disabledIndices:Sw([...(typeof x==`function`?null:x)||s.current.map((e,t)=>Cw(s.current,t,x)?t:void 0),void 0],n),minIndex:r,maxIndex:a,prevIndex:xw(N.current>o?i:N.current,t,n,w,e.key===`ArrowDown`?`bl`:e.key===(h?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(N.current=c,I(e)),S===`both`)return}if(ck(e.key,S)){if(PC(e),r&&!g&&xC(e.currentTarget.ownerDocument)===e.currentTarget){N.current=lk(e.key,S,h)?i:o,I(e);return}lk(e.key,S,h)?p?t>=o?f&&t!==s.current.length?N.current=-1:(te.current=!1,N.current=i):N.current=vw(s.current,{startingIndex:t,disabledIndices:x}):N.current=Math.min(o,vw(s.current,{startingIndex:t,disabledIndices:x})):p?t<=i?f&&t!==-1?N.current=s.current.length:(te.current=!1,N.current=o):N.current=vw(s.current,{startingIndex:t,decrement:!0,disabledIndices:x}):N.current=Math.max(i,vw(s.current,{startingIndex:t,decrement:!0,disabledIndices:x})),hw(s.current,N.current)&&(N.current=-1),I(e)}}),ue=b.useMemo(()=>g&&r&&ae&&{"aria-activedescendant":`${T}-${c}`},[g,r,ae,T,c]),de=b.useMemo(()=>({"aria-orientation":S===`both`?void 0:S,...j?{}:ue,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&r&&!g){let t=CC(e.nativeEvent);if(t&&!SC(O.current,t))return;PC(e),n.setOpen(!1,OT(xT,e.nativeEvent)),hx(a)&&a.focus();return}le(e)},onPointerMove(){F.current=!0}}),[ue,le,O,S,j,n,r,g,a]),fe=b.useMemo(()=>{function e(e){_===`auto`&&IC(e.nativeEvent)&&(M.current=!g)}function t(e){M.current=_,_===`auto`&&LC(e.nativeEvent)&&(M.current=!0)}return{onKeyDown(e){let t=n.select(`open`);F.current=!1;let r=e.key.startsWith(`Arrow`),i=uk(e.key,ce(),h),a=ck(e.key,S),o=(m?i:a)||e.key===`Enter`||e.key.trim()===``;if(g&&t)return le(e);if(!(!t&&!y&&r)){if(o){let t=ck(e.key,ce());P.current=m&&t?null:e.key}if(m){i&&(PC(e),t?(N.current=gw(s,V.current),I(e)):n.setOpen(!0,OT(CT,e.nativeEvent,e.currentTarget)));return}a&&(re.current!=null&&(N.current=re.current),PC(e),!t&&y?n.setOpen(!0,OT(CT,e.nativeEvent,e.currentTarget)):le(e),t&&I(e))}},onFocus(e){n.select(`open`)&&!g&&(N.current=-1,I(e))},onPointerDown:t,onPointerEnter:t,onMouseDown:e,onClick:e}},[le,V,_,s,m,I,n,y,S,ce,h,re,g]),pe=b.useMemo(()=>({...ue,...fe}),[ue,fe]);return b.useMemo(()=>u?{reference:pe,floating:de,item:se,trigger:fe}:{},[u,pe,de,fe,se])}var pk=new Map([[`select`,`listbox`],[`combobox`,`listbox`],[`label`,!1]]);function mk(e,t={}){let n=`rootStore`in e?e.rootStore:e,r=n.useState(`open`),i=n.useState(`floatingId`),a=n.useState(`domReferenceElement`),o=n.useState(`floatingElement`),{role:s=`dialog`}=t,c=qS(),l=a?.id||c,u=b.useMemo(()=>jC(o)?.id||i,[o,i]),d=pk.get(s)??s,f=zE()!=null,p=b.useMemo(()=>d===`tooltip`||s===`label`?SS:{"aria-haspopup":d===`alertdialog`?`dialog`:d,"aria-expanded":`false`,...d===`listbox`&&{role:`combobox`},...d===`menu`&&f&&{role:`menuitem`},...s===`select`&&{"aria-autocomplete":`none`},...s===`combobox`&&{"aria-autocomplete":`list`}},[d,f,s]),m=b.useMemo(()=>d===`tooltip`||s===`label`?{[`aria-${s===`label`?`labelledby`:`describedby`}`]:r?u:void 0}:{...p,"aria-expanded":r?`true`:`false`,"aria-controls":r?u:void 0,...d===`menu`&&{id:l}},[d,u,r,l,s,p]),h=b.useMemo(()=>{let e={id:u,...d&&{role:d}};return d===`tooltip`||s===`label`?e:{...e,...d===`menu`&&{"aria-labelledby":l}}},[d,u,l,s]),g=b.useCallback(({active:e,selected:t})=>{let n={role:`option`,...e&&{id:`${u}-fui-option`}};switch(s){case`select`:case`combobox`:return{...n,"aria-selected":t};default:}return{}},[u,s]);return b.useMemo(()=>({reference:m,floating:h,item:g,trigger:p}),[m,h,p,g])}function hk(e,t){let n=`rootStore`in e?e.rootStore:e,r=n.context.dataRef,i=n.useState(`open`),{listRef:a,elementsRef:o,activeIndex:s,onMatch:c,onTypingChange:l,enabled:u=!0,resetMs:d=750,selectedIndex:f=null}=t,p=Qw(),m=b.useRef(``),h=b.useRef(f??s??-1),g=b.useRef(null);Q(()=>{!i&&f!==null||(p.clear(),g.current=null,m.current!==``&&(m.current=``))},[i,f,p]),Q(()=>{i&&m.current===``&&(h.current=f??s??-1)},[i,f,s]);let _=Z(e=>{e?r.current.typing||(r.current.typing=e,l?.(e)):r.current.typing&&(r.current.typing=e,l?.(e))}),v=Z(e=>{function t(e){let t=o?.current[e];return!t||Tw(t)}function n(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let r=a.current;if(m.current.length>0&&e.key===` `&&(PC(e),_(!0)),m.current.length>0&&m.current[0]!==` `&&n(r,m.current)===-1&&e.key!==` `&&_(!1),r==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;i&&e.key!==` `&&(PC(e),_(!0));let l=m.current===``;l&&(h.current=f??s??-1),r.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&m.current===e.key&&(m.current=``,h.current=g.current),m.current+=e.key,p.start(d,()=>{m.current=``,h.current=g.current,_(!1)});let u=((l?f??s??-1:h.current)??0)+1,v=n(r,m.current,u);v===-1?e.key!==` `&&(m.current=``,_(!1)):(c?.(v),g.current=v)}),y=Z(e=>{let t=e.relatedTarget,r=n.select(`domReferenceElement`),i=n.select(`floatingElement`),a=SC(r,t),o=SC(i,t);a||o||(p.clear(),m.current=``,h.current=g.current,_(!1))}),x=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]),S=b.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return b.useMemo(()=>u?{reference:x,floating:S}:{},[u,x,S])}var gk=.1,_k=gk*gk,vk=.5;function yk(e,t,n,r,i,a){return r>=t!=a>=t&&e<=(i-n)*(t-r)/(a-r)+n}function bk(e,t,n,r,i,a,o,s,c,l){let u=!1;return yk(e,t,n,r,i,a)&&(u=!u),yk(e,t,i,a,o,s)&&(u=!u),yk(e,t,o,s,c,l)&&(u=!u),yk(e,t,c,l,n,r)&&(u=!u),u}function xk(e,t,n){return e>=n.x&&e<=n.x+n.width&&t>=n.y&&t<=n.y+n.height}function Sk(e,t,n,r,i,a){return e>=Math.min(n,i)&&e<=Math.max(n,i)&&t>=Math.min(r,a)&&t<=Math.max(r,a)}function Ck(e={}){let{blockPointerEvents:t=!1}=e,n=new Zw,r=({x:e,y:t,placement:r,elements:i,onClose:a,nodeId:o,tree:s})=>{let c=r?.split(`-`)[0],l=!1,u=null,d=null,f=typeof performance<`u`?performance.now():0;function p(e,t){let n=performance.now(),r=n-f;if(u===null||d===null||r===0)return u=e,d=t,f=n,!1;let i=e-u,a=t-d,o=i*i+a*a,s=r*r*_k;return u=e,d=t,f=n,o<s}function m(){n.clear(),a()}return function(r){n.clear();let a=i.domReference,u=i.floating;if(!a||!u||c==null||e==null||t==null)return;let{clientX:d,clientY:f}=r,h=CC(r),g=r.type===`mouseleave`,_=SC(u,h),v=SC(a,h);if(_&&(l=!0,!g))return;if(v&&(l=!1,!g)){l=!0;return}if(g&&mx(r.relatedTarget)&&SC(u,r.relatedTarget))return;function y(){return!!(s&&MC(s.nodesRef.current,o).length>0)}function b(){y()||m()}if(y())return;let x=a.getBoundingClientRect(),S=u.getBoundingClientRect(),C=e>S.right-S.width/2,w=t>S.bottom-S.height/2,T=S.width>x.width,E=S.height>x.height,D=(T?x:S).left,O=(T?x:S).right,k=(E?x:S).top,A=(E?x:S).bottom;if(c===`top`&&t>=x.bottom-1||c===`bottom`&&t<=x.top+1||c===`left`&&e>=x.right-1||c===`right`&&e<=x.left+1){b();return}let j=!1;switch(c){case`top`:j=Sk(d,f,D,x.top+1,O,S.bottom-1);break;case`bottom`:j=Sk(d,f,D,S.top+1,O,x.bottom-1);break;case`left`:j=Sk(d,f,S.right-1,A,x.left+1,k);break;case`right`:j=Sk(d,f,x.right-1,A,S.left+1,k);break;default:}if(j)return;if(l&&!xk(d,f,x)){b();return}if(!g&&p(d,f)){b();return}let M=!1;switch(c){case`top`:{let n=T?vk/2:vk*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t+vk+1,o=C||T?S.bottom-vk:S.top,s=C?T?S.bottom-vk:S.top:S.bottom-vk;M=bk(d,f,r,a,i,a,S.left,o,S.right,s);break}case`bottom`:{let n=T?vk/2:vk*4,r=T||C?e+n:e-n,i=T?e-n:C?e+n:e-n,a=t-vk,o=C||T?S.top+vk:S.bottom,s=C?T?S.top+vk:S.bottom:S.top+vk;M=bk(d,f,r,a,i,a,S.left,o,S.right,s);break}case`left`:{let n=E?vk/2:vk*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e+vk+1,o=w||E?S.right-vk:S.left,s=w?E?S.right-vk:S.left:S.right-vk;M=bk(d,f,o,S.top,s,S.bottom,a,r,a,i);break}case`right`:{let n=E?vk/2:vk*4,r=E||w?t+n:t-n,i=E?t-n:w?t+n:t-n,a=e-vk,o=w||E?S.left+vk:S.right,s=w?E?S.left+vk:S.right:S.left+vk;M=bk(d,f,a,r,a,i,o,S.top,s,S.bottom);break}default:}M?l||n.start(40,b):b()}};return r.__options={...e,blockPointerEvents:t},r}function wk(e){let t=b.useRef(``),n=b.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:b.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function Tk(e,t){let n=b.useRef(e),r=Z(t);Q(()=>{n.current!==e&&r(n.current)},[e,r]),Q(()=>{n.current=e},[e])}function Ek(e){let[t,n]=b.useState(null),r=Z((t,r)=>{e||n(r||(sC?`touch`:``))});Tk(e,t=>{t&&!e&&n(null)});let{onClick:i,onPointerDown:a}=wk(r);return b.useMemo(()=>({openMethod:t,triggerProps:{onClick:i,onPointerDown:a}}),[t,i,a])}function Dk(e){let{store:t,parentContext:n,actionsRef:r,isDrawer:i}=e,a=t.useState(`open`),o=t.useState(`disablePointerDismissal`),s=t.useState(`modal`),c=t.useState(`popupElement`),{openMethod:l,triggerProps:u}=Ek(a);LO(t);let{forceUnmount:d}=RO(a,t),f=b.useCallback(()=>{t.setOpen(!1,OT(ET))},[t]);b.useImperativeHandle(r,()=>({unmount:d,close:f}),[d,f]);let p=KO({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0}),[m,h]=b.useState(0),[g,_]=b.useState(0),v=m===0,y=mk(p),x=rD(p,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?`intentional`:{mouse:s===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}},outsidePress(e){if(!t.context.outsidePressEnabledRef.current||`button`in e&&e.button!==0||`touches`in e&&e.touches.length!==1)return!1;let n=CC(e);if(v&&!o){let e=n;return s&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===e||t.context.backdropRef.current===e||SC(e,c)&&!e?.hasAttribute(`data-base-ui-portal`):!0}return!1},escapeKey:v});XT(a&&s===!0,c);let{getReferenceProps:S,getFloatingProps:C,getTriggerProps:w}=rk([y,x]);t.useContextCallback(`onNestedDialogOpen`,(e,t)=>{h(e),_(t)}),t.useContextCallback(`onNestedDialogClose`,()=>{h(0),_(0)}),b.useEffect(()=>(n?.onNestedDialogOpen&&a&&n.onNestedDialogOpen(m+1,g+ +!!i),n?.onNestedDialogClose&&!a&&n.onNestedDialogClose(),()=>{n?.onNestedDialogClose&&a&&n.onNestedDialogClose()}),[i,a,m,g,n]);let T=b.useMemo(()=>S(u),[S,u]),E=b.useMemo(()=>w(u),[w,u]),D=b.useMemo(()=>C(),[C]);t.useSyncedValues({openMethod:l,activeTriggerProps:T,inactiveTriggerProps:E,popupProps:D,floatingRootContext:p,nestedOpenDialogCount:m,nestedOpenDrawerCount:g})}var Ok=b.createContext(void 0);function kk(e){let t=b.useContext(Ok);if(e===!1&&t===void 0)throw Error(iS(27));return t}var Ak={...UO,modal:$(e=>e.modal),nested:$(e=>e.nested),nestedOpenDialogCount:$(e=>e.nestedOpenDialogCount),nestedOpenDrawerCount:$(e=>e.nestedOpenDrawerCount),disablePointerDismissal:$(e=>e.disablePointerDismissal),openMethod:$(e=>e.openMethod),descriptionElementId:$(e=>e.descriptionElementId),titleElementId:$(e=>e.titleElementId),viewportElement:$(e=>e.viewportElement),role:$(e=>e.role)},jk=class e extends MO{constructor(e){super(Mk(e),{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new zO,onOpenChange:void 0,onOpenChangeComplete:void 0},Ak)}setOpen=(e,t)=>{if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},!e&&t.trigger==null&&this.state.activeTriggerId!=null&&(t.trigger=this.state.activeTriggerElement??void 0),this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let n={open:e},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};static useStore(t,n){let r=Fx(()=>new e(n)).current;return t??r}};function Mk(e={}){return{...VO(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,nestedOpenDrawerCount:0,role:`dialog`,...e}}var Nk=b.createContext(!1);function Pk(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,disablePointerDismissal:o=!1,modal:s=!0,actionsRef:c,handle:l,triggerId:u,defaultTriggerId:d=null}=e,f=kk(!0),p=b.useContext(Nk),m=!!f,h=jk.useStore(l?.store,{open:r,openProp:n,activeTriggerId:d,triggerIdProp:u,modal:s,disablePointerDismissal:o,nested:m});BT(()=>{n===void 0&&h.state.open===!1&&r===!0&&h.update({open:!0,activeTriggerId:d})}),h.useControlledProp(`openProp`,n),h.useControlledProp(`triggerIdProp`,u),h.useSyncedValues({disablePointerDismissal:o,nested:m,modal:s}),h.useContextCallback(`onOpenChange`,i),h.useContextCallback(`onOpenChangeComplete`,a);let g=h.useState(`payload`);Dk({store:h,actionsRef:c,parentContext:f?.store.context,isDrawer:p,onOpenChange:i,triggerIdProp:u});let _=b.useMemo(()=>({store:h}),[h]);return(0,y.jsx)(Nk.Provider,{value:!1,children:(0,y.jsx)(Ok.Provider,{value:_,children:typeof t==`function`?t({payload:g}):t})})}function Fk(e){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,actionsRef:o,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=kk(!0),d=!!u,f=jk.useStore(s?.store,{open:r,openProp:n,activeTriggerId:l,triggerIdProp:c,modal:!0,disablePointerDismissal:!0,nested:d,role:`alertdialog`});f.useControlledProp(`openProp`,n),f.useControlledProp(`triggerIdProp`,c),f.useSyncedValue(`nested`,d),f.useContextCallback(`onOpenChange`,i),f.useContextCallback(`onOpenChangeComplete`,a);let p=f.useState(`payload`);Dk({store:f,actionsRef:o,parentContext:u?.store.context,isDrawer:!1,onOpenChange:i,triggerIdProp:c});let m=b.useMemo(()=>({store:f}),[f]);return(0,y.jsx)(Nk.Provider,{value:!1,children:(0,y.jsx)(Ok.Provider,{value:m,children:typeof t==`function`?t({payload:p}):t})})}var Ik=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=iT.startingStyle]=`startingStyle`,e[e.endingStyle=iT.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),Lk=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),Rk={[Lk.popupOpen]:``},zk={[Lk.popupOpen]:``,[Lk.pressed]:``},Bk={[Ik.open]:``},Vk={[Ik.closed]:``},Hk={[Ik.anchorHidden]:``},Uk={open(e){return e?Rk:null}},Wk={open(e){return e?zk:null}},Gk={open(e){return e?Bk:Vk},anchorHidden(e){return e?Hk:null}},Kk={...Gk,...sT},qk=b.forwardRef(function(e,t){let{render:n,className:r,style:i,forceRender:a=!1,...o}=e,{store:s}=kk(),c=s.useState(`open`),l=s.useState(`nested`),u=s.useState(`mounted`);return ES(`div`,e,{state:{open:c,transitionStatus:s.useState(`transitionStatus`)},ref:[s.context.backdropRef,t],stateAttributesMapping:Kk,props:[{role:`presentation`,hidden:!u,style:{userSelect:`none`,WebkitUserSelect:`none`}},o],enabled:a||!l})}),Jk=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,style:o,...s}=e,{store:c}=kk(),l=c.useState(`open`);function u(e){l&&c.setOpen(!1,OT(bT,e.nativeEvent))}let{getButtonProps:d,buttonRef:f}=cS({disabled:i,native:a});return ES(`button`,e,{state:{disabled:i},ref:[t,f],props:[{onClick:u},s,d]})}),Yk=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=kk(),c=JS(a);return s.useSyncedValueWithCleanup(`descriptionElementId`,c),ES(`p`,e,{ref:t,props:[{id:c},o]})}),Xk=function(e){return e.nestedDialogs=`--nested-dialogs`,e}({}),Zk=function(e){return e[e.open=Ik.open]=`open`,e[e.closed=Ik.closed]=`closed`,e[e.startingStyle=Ik.startingStyle]=`startingStyle`,e[e.endingStyle=Ik.endingStyle]=`endingStyle`,e.nested=`data-nested`,e.nestedDialogOpen=`data-nested-dialog-open`,e}({}),Qk=b.createContext(void 0);function $k(){let e=b.useContext(Qk);if(e===void 0)throw Error(iS(26));return e}var eA=`ArrowUp`,tA=`ArrowDown`,nA=`ArrowLeft`,rA=`ArrowRight`,iA=`Home`,aA=new Set([nA,rA]),oA=new Set([eA,tA]),sA=new Set([...aA,...oA]);new Set([...sA,iA,`End`]);var cA=new Set([eA,tA,nA,rA,iA,`End`]),lA={...Gk,...sT,nestedDialogOpen(e){return e?{[Zk.nestedDialogOpen]:``}:null}},uA=b.forwardRef(function(e,t){let{className:n,finalFocus:r,initialFocus:i,render:a,style:o,...s}=e,{store:c}=kk(),l=c.useState(`descriptionElementId`),u=c.useState(`disablePointerDismissal`),d=c.useState(`floatingRootContext`),f=c.useState(`popupProps`),p=c.useState(`modal`),m=c.useState(`mounted`),h=c.useState(`nested`),g=c.useState(`nestedOpenDialogCount`),_=c.useState(`open`),v=c.useState(`openMethod`),b=c.useState(`titleElementId`),x=c.useState(`transitionStatus`),S=c.useState(`role`);$k(),uT({open:_,ref:c.context.popupRef,onComplete(){_&&c.context.onOpenChangeComplete?.(!0)}});function C(e){return e===`touch`?c.context.popupRef.current:!0}let w=i===void 0?C:i,T=ES(`div`,e,{state:{open:_,nested:h,transitionStatus:x,nestedDialogOpen:g>0},props:[f,{"aria-labelledby":b??void 0,"aria-describedby":l??void 0,role:S,tabIndex:-1,hidden:!m,onKeyDown(e){cA.has(e.key)&&e.stopPropagation()},style:{[Xk.nestedDialogs]:g}},s],ref:[t,c.context.popupRef,c.useStateSetter(`popupElement`)],stateAttributesMapping:lA});return(0,y.jsx)(YE,{context:d,openInteractionType:v,disabled:!m,closeOnFocusOut:!u,initialFocus:w,returnFocus:r,modal:p!==!1,restoreFocus:`popup`,children:T})});function dA(e){return vS(19)?e:e?`true`:void 0}var fA=b.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,y.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})}),pA=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=kk(),a=i.useState(`mounted`),o=i.useState(`modal`),s=i.useState(`open`);return a||n?(0,y.jsx)(Qk.Provider,{value:n,children:(0,y.jsxs)(FE,{ref:t,...r,children:[a&&o===!0&&(0,y.jsx)(fA,{ref:i.context.internalBackdropRef,inert:dA(!s)}),e.children]})}):null}),mA=b.forwardRef(function(e,t){let{render:n,className:r,style:i,id:a,...o}=e,{store:s}=kk(),c=JS(a);return s.useSyncedValueWithCleanup(`titleElementId`,c),ES(`h2`,e,{ref:t,props:[{id:c},o]})}),hA=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,id:o,payload:s,handle:c,style:l,...u}=e,d=kk(!0),f=c?.store??d?.store;if(!f)throw Error(iS(79));let p=JS(o),m=f.useState(`floatingRootContext`),h=f.useState(`isOpenedByTrigger`,p),g=b.useRef(null),{registerTrigger:_,isMountedByThisTrigger:v}=IO(p,g,f,{payload:s}),{getButtonProps:y,buttonRef:x}=cS({disabled:i,native:a}),S=rk([XE(m,{enabled:m!=null})]),C={disabled:i,open:h},w=f.useState(`triggerProps`,v);return ES(`button`,e,{state:C,ref:[x,t,_,g],props:[S.getReferenceProps(),w,{[DE]:``,id:p},u,y],stateAttributesMapping:Uk})});function gA({...e}){return(0,y.jsx)(Fk,{"data-slot":`alert-dialog`,...e})}function _A({...e}){return(0,y.jsx)(pA,{"data-slot":`alert-dialog-portal`,...e})}function vA({className:e,...t}){return(0,y.jsx)(qk,{"data-slot":`alert-dialog-overlay`,className:cx(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function yA({className:e,size:t=`default`,...n}){return(0,y.jsxs)(_A,{children:[(0,y.jsx)(vA,{}),(0,y.jsx)(uA,{"data-slot":`alert-dialog-content`,"data-size":t,className:cx(`group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...n})]})}function bA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-header`,className:cx(`grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]`,e),...t})}function xA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`alert-dialog-footer`,className:cx(`flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end`,e),...t})}function SA({className:e,...t}){return(0,y.jsx)(mA,{"data-slot":`alert-dialog-title`,className:cx(`font-heading text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2`,e),...t})}function CA({className:e,...t}){return(0,y.jsx)(Yk,{"data-slot":`alert-dialog-description`,className:cx(`text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground`,e),...t})}function wA({className:e,...t}){return(0,y.jsx)(PS,{"data-slot":`alert-dialog-action`,className:cx(e),...t})}function TA({className:e,...t}){return(0,y.jsx)(Ey,{role:`status`,"aria-label":`Loading`,className:cx(`spinner-line-fade size-4`,e),...t})}var EA=({isModalOpen:e,exitInfo:t,isRetryingConnection:n,hasCopiedRestartCommand:r,newTabUrl:i,onReconnect:a,onCopyRestartCommand:o})=>(0,y.jsx)(gA,{open:e,children:(0,y.jsx)(yA,{children:t===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(bA,{children:[(0,y.jsxs)(SA,{className:`flex items-center gap-2`,children:[(0,y.jsx)(TA,{"aria-hidden":`true`,role:`presentation`}),`Lost connection`]}),(0,y.jsx)(CA,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(MT,{children:[(0,y.jsx)(RT,{readOnly:!0,value:od,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(PT,{align:`inline-end`,children:(0,y.jsx)(IT,{size:`icon-xs`,onClick:o,"aria-label":r?`Copied`:`Copy restart command`,children:r?(0,y.jsx)(Sy,{}):(0,y.jsx)(Ty,{})})})]}),(0,y.jsx)(xA,{children:(0,y.jsxs)(wA,{onClick:a,disabled:n,children:[n?(0,y.jsx)(TA,{"data-icon":`inline-start`}):null,`Retry`]})})]}):t.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(bA,{children:[(0,y.jsx)(SA,{children:`Shell ended`}),(0,y.jsx)(CA,{children:t.exitCode===null||t.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${t.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(xA,{children:(0,y.jsx)(wA,{onClick:()=>window.open(i,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(bA,{children:[(0,y.jsxs)(SA,{className:`flex items-center gap-2`,children:[(0,y.jsx)(TA,{"aria-hidden":`true`,role:`presentation`}),`Connection lost`]}),(0,y.jsxs)(CA,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,t.closeCode,t.closeReason?` · ${t.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(xA,{children:(0,y.jsxs)(wA,{onClick:a,disabled:n,children:[n?(0,y.jsx)(TA,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})});function DA({...e}){return(0,y.jsx)(Pk,{"data-slot":`dialog`,...e})}function OA({...e}){return(0,y.jsx)(hA,{"data-slot":`dialog-trigger`,...e})}function kA({...e}){return(0,y.jsx)(pA,{"data-slot":`dialog-portal`,...e})}function AA({className:e,...t}){return(0,y.jsx)(qk,{"data-slot":`dialog-overlay`,className:cx(`fixed inset-0 isolate z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function jA({className:e,children:t,showCloseButton:n=!0,...r}){return(0,y.jsxs)(kA,{children:[(0,y.jsx)(AA,{}),(0,y.jsxs)(uA,{"data-slot":`dialog-content`,className:cx(`fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-md data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...r,children:[t,n?(0,y.jsxs)(Jk,{"data-slot":`dialog-close`,render:(0,y.jsx)(PS,{variant:`ghost`,className:`absolute top-4 right-4`,size:`icon-sm`}),children:[(0,y.jsx)(My,{}),(0,y.jsx)(`span`,{className:`sr-only`,children:`Close`})]}):null]})]})}function MA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`dialog-header`,className:cx(`flex flex-col gap-2`,e),...t})}function NA({className:e,...t}){return(0,y.jsx)(mA,{"data-slot":`dialog-title`,className:cx(`font-heading leading-none font-medium`,e),...t})}var PA=`border border-border/60 bg-background/70 text-muted-foreground shadow-xs ring-0 backdrop-blur-md`,FA=`duration-150 ease-snappy data-closed:duration-100 data-closed:fade-out-0 data-closed:zoom-out-95 data-closed:blur-out-[5px] data-closed:slide-out-to-top-2 data-open:fade-in-0 data-open:zoom-in-95 data-open:blur-in-[5px] data-open:slide-in-from-top-2`,IA=()=>typeof window<`u`&&typeof window.queryLocalFonts==`function`,LA=async()=>{if(typeof window>`u`)return[];let e=window.queryLocalFonts;if(typeof e!=`function`)return[];try{let t=await e(),n=new Set;for(let e of t)e.family&&n.add(e.family);return[...n].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}catch{return[]}},RA=async()=>{if(typeof navigator>`u`||!navigator.permissions)return`unsupported`;try{return(await navigator.permissions.query({name:`local-fonts`})).state}catch{return`unsupported`}},zA=(e,t)=>{let n=t.trim().toLowerCase();return n?e.filter(e=>e.toLowerCase().includes(n)):e},BA=({open:e,onFontSelect:t})=>{let[n,r]=(0,b.useState)({kind:`loading`}),[i,a]=(0,b.useState)(``),o=(0,b.useDeferredValue)(i);(0,b.useEffect)(()=>{if(!e)return;a(``);let t=!1;return r({kind:`loading`}),(async()=>{if(!IA()){t||r({kind:`unsupported`});return}let e=await RA();if(!t)if(e===`granted`){let e=await LA();t||r({kind:`ready`,families:e})}else r(e===`denied`?{kind:`denied`}:{kind:`prompt`})})(),()=>{t=!0}},[e]);let s=(0,b.useCallback)(async()=>{r({kind:`loading`});let e=await LA();if(e.length===0){r({kind:`denied`});return}r({kind:`ready`,families:e})},[]),c=(0,b.useCallback)(e=>{t(e)},[t]);return{state:n,searchQuery:i,setSearchQuery:a,deferredQuery:o,filteredFamilies:(0,b.useMemo)(()=>n.kind===`ready`?zA(n.families,o):[],[n.kind,n.kind===`ready`?n.families:void 0,o]),handleApply:c,requestPermission:s}},VA=`flex w-full items-center justify-between gap-2 rounded-sm px-2 py-1.5 text-left text-xs text-foreground/90 outline-none transition-colors hover:bg-foreground/10 focus-visible:bg-foreground/10`,HA={contentVisibility:`auto`,containIntrinsicSize:`auto 28px`},UA=`text-xs leading-snug text-muted-foreground/80`,WA=({initialValue:e,onApply:t})=>{let[n,r]=(0,b.useState)(e),i=n.trim(),a=(0,b.useCallback)(()=>{i&&t(i)},[i,t]);return(0,y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,y.jsx)(jT,{autoFocus:!0,value:n,onChange:e=>r(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),a())},placeholder:`Family name (e.g. Iosevka)`,className:`h-8 text-xs`}),(0,y.jsx)(PS,{type:`button`,size:`sm`,variant:`secondary`,disabled:!i,onClick:a,className:`h-7 text-xs`,children:`Apply`})]})},GA=({open:e,onOpenChange:t,currentFamily:n,onApply:r})=>{let{state:i,searchQuery:a,setSearchQuery:o,deferredQuery:s,filteredFamilies:c,handleApply:l,requestPermission:u}=BA({open:e,onFontSelect:e=>{r(e),t(!1)}});return(0,y.jsx)(DA,{open:e,onOpenChange:t,children:(0,y.jsxs)(jA,{className:cx(`max-h-[calc(100dvh-2rem)] gap-2 overflow-hidden p-4 sm:max-w-sm`,PA),children:[(0,y.jsx)(MA,{className:`pr-8`,children:(0,y.jsx)(NA,{children:`Local font`})}),i.kind===`loading`?(0,y.jsx)(`p`,{className:UA,children:`Loading…`}):i.kind===`unsupported`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:UA,children:`This browser doesn't expose installed fonts. Type a family name to use any installed font.`}),(0,y.jsx)(WA,{initialValue:n??``,onApply:l})]}):i.kind===`denied`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:UA,children:`Permission denied. Re-allow in browser site settings, or type a family name.`}),(0,y.jsx)(WA,{initialValue:n??``,onApply:l})]}):i.kind===`prompt`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`p`,{className:UA,children:`Allow localterm to read your installed fonts to preview them.`}),(0,y.jsx)(PS,{type:`button`,size:`sm`,variant:`secondary`,onClick:u,className:`h-7 text-xs`,children:`Allow access`}),(0,y.jsx)(`div`,{className:`my-1 border-t border-border/40`}),(0,y.jsx)(`p`,{className:UA,children:`Or type a family name:`}),(0,y.jsx)(WA,{initialValue:n??``,onApply:l})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`relative`,children:[(0,y.jsx)(Ay,{className:`pointer-events-none absolute top-1/2 left-2 size-3 -translate-y-1/2 text-muted-foreground/70`}),(0,y.jsx)(jT,{autoFocus:!0,value:a,onChange:e=>o(e.target.value),placeholder:`Search installed fonts`,className:`h-8 pl-7 text-xs`})]}),(0,y.jsx)(`div`,{className:`-mx-1 max-h-72 overflow-y-auto pr-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:c.length===0?(0,y.jsxs)(`p`,{className:cx(UA,`px-2 py-2`),children:[`No fonts match "`,a,`".`]}):c.map(e=>(0,y.jsx)(`button`,{type:`button`,onClick:()=>l(e),className:cx(VA,e===n&&`bg-foreground/5`),style:{...HA,fontFamily:`"${wd(e)}", ui-monospace, monospace`},children:(0,y.jsx)(`span`,{className:`truncate`,children:e})},e))}),(0,y.jsx)(`p`,{className:cx(UA,`px-1 tabular-nums`),children:s?`${c.length} of ${i.families.length}`:`${i.families.length} fonts`})]})]})})};function KA({className:e,...t}){return(0,y.jsx)(`label`,{"data-slot":`label`,className:cx(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}var qA=b.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return ES(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function JA({className:e,orientation:t=`horizontal`,...n}){return(0,y.jsx)(qA,{"data-slot":`separator`,orientation:t,className:cx(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}function YA({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`field-group`,className:cx(`group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 *:data-[slot=field-group]:gap-4`,e),...t})}var XA=Ly(`group/field flex w-full gap-3 data-[invalid=true]:text-destructive`,{variants:{orientation:{vertical:`flex-col *:w-full [&>.sr-only]:w-auto`,horizontal:`flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`,responsive:`flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px`}},defaultVariants:{orientation:`vertical`}});function ZA({className:e,orientation:t=`vertical`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:cx(XA({orientation:t}),e),...n})}function QA({className:e,...t}){return(0,y.jsx)(KA,{"data-slot":`field-label`,className:cx(`group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border *:data-[slot=field]:p-3 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10`,`has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col`,e),...t})}var $A=b.createContext(void 0);function ej(e){let t=b.useContext($A);if(t===void 0&&!e)throw Error(iS(72));return t}var tj={...UO,disabled:$(e=>e.disabled),instantType:$(e=>e.instantType),isInstantPhase:$(e=>e.isInstantPhase),trackCursorAxis:$(e=>e.trackCursorAxis),disableHoverablePopup:$(e=>e.disableHoverablePopup),lastOpenChangeReason:$(e=>e.openChangeReason),closeOnClick:$(e=>e.closeOnClick),closeDelay:$(e=>e.closeDelay),hasViewport:$(e=>e.hasViewport)},nj=class e extends MO{constructor(e){super({...rj(),...e},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new zO},tj)}setOpen=(e,t)=>{let n=t.reason,r=n===gT,i=e&&n===`trigger-focus`,a=!e&&(n===`trigger-press`||n===`escape-key`);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let o=()=>{let r={open:e,openChangeReason:n};i?r.instantType=`focus`:a?r.instantType=`dismiss`:n===`trigger-hover`&&(r.instantType=void 0);let o=t.trigger?.id??null;(o||e)&&(r.activeTriggerId=o,r.activeTriggerElement=t.trigger??null),this.update(r)};r?cT.flushSync(o):o()};static useStore(t,n){let r=Fx(()=>new e(n)).current,i=t??r,a=KO({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=a,i}};function rj(){return{...VO(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var ij=xO(function(e){let{disabled:t=!1,defaultOpen:n=!1,open:r,disableHoverablePopup:i=!1,trackCursorAxis:a=`none`,actionsRef:o,onOpenChange:s,onOpenChangeComplete:c,handle:l,triggerId:u,defaultTriggerId:d=null,children:f}=e,p=nj.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});BT(()=>{r===void 0&&p.state.open===!1&&n===!0&&p.update({open:!0,activeTriggerId:d})}),p.useControlledProp(`openProp`,r),p.useControlledProp(`triggerIdProp`,u),p.useContextCallback(`onOpenChange`,s),p.useContextCallback(`onOpenChangeComplete`,c);let m=p.useState(`open`),h=!t&&m,g=p.useState(`activeTriggerId`),_=p.useState(`payload`);p.useSyncedValues({trackCursorAxis:a,disableHoverablePopup:i}),Q(()=>{m&&t&&p.setOpen(!1,OT(TT))},[m,t,p]),p.useSyncedValue(`disabled`,t),LO(p);let{forceUnmount:v,transitionStatus:x}=RO(h,p),S=p.select(`floatingRootContext`),C=p.useState(`isInstantPhase`),w=p.useState(`instantType`),T=p.useState(`lastOpenChangeReason`),E=b.useRef(null);Q(()=>{x===`ending`&&T===`none`||x!==`ending`&&C?(w!==`delay`&&(E.current=w),p.set(`instantType`,`delay`)):E.current!==null&&(p.set(`instantType`,E.current),E.current=null)},[x,C,T,w,p]),Q(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let D=b.useCallback(()=>{p.setOpen(!1,OT(ET))},[p]);b.useImperativeHandle(o,()=>({unmount:v,close:D}),[v,D]);let{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=rk([rD(S,{enabled:!t,referencePress:()=>p.select(`closeOnClick`)}),$E(S,{enabled:!t&&a!==`none`,axis:a===`none`?void 0:a})]),j=b.useMemo(()=>O(),[O]),M=b.useMemo(()=>A(),[A]),N=b.useMemo(()=>k(),[k]);return p.useSyncedValues({activeTriggerProps:j,inactiveTriggerProps:M,popupProps:N}),(0,y.jsx)($A.Provider,{value:p,children:typeof f==`function`?f({payload:_}):f})}),aj=b.createContext(void 0);function oj(){return b.useContext(aj)}var sj=function(e){return e[e.popupOpen=Lk.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),cj=SO(function(e,t){let{className:n,render:r,handle:i,payload:a,disabled:o,delay:s,closeOnClick:c=!0,closeDelay:l,id:u,style:d,...f}=e,p=ej(!0),m=i?.store??p;if(!m)throw Error(iS(82));let h=JS(u),g=m.useState(`isTriggerActive`,h),_=m.useState(`isOpenedByTrigger`,h),v=m.useState(`floatingRootContext`),y=b.useRef(null),x=s??600,S=l??0,{registerTrigger:C,isMountedByThisTrigger:w}=IO(h,y,m,{payload:a,closeOnClick:c,closeDelay:S}),T=oj(),{delayRef:E,isInstantPhase:D,hasProvider:O}=rE(v,{open:_});m.useSyncedValue(`isInstantPhase`,D);let k=m.useState(`disabled`),A=o??k,j=m.useState(`trackCursorAxis`),M=m.useState(`disableHoverablePopup`),N=nk(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!M&&j!==`both`?Ck():null,restMs(){let e=T?.delay,t=typeof E.current==`object`?E.current.open:void 0,n=x;return O&&(n=t===0?0:s??e??x),n},delay(){let e=typeof E.current==`object`?E.current.close:void 0,t=S;return l==null&&O&&(t=e),{close:t}},triggerElementRef:y,isActiveTrigger:g,isClosing:()=>m.select(`transitionStatus`)===`ending`}),P=JO(v,{enabled:!A}).reference,F={open:_},I=m.useState(`triggerProps`,w);return ES(`button`,e,{state:F,ref:[t,C,y],props:[N,P,I,{onPointerDown(){m.set(`closeOnClick`,c)},id:h,[sj.triggerDisabled]:A?``:void 0},f],stateAttributesMapping:Uk})}),lj=b.createContext(void 0);function uj(){let e=b.useContext(lj);if(e===void 0)throw Error(iS(70));return e}var dj=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=PE({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,y.jsxs)(b.Fragment,{children:[l,c&&cT.createPortal(n,c)]})}),fj=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return ej().useState(`mounted`)||n?(0,y.jsx)(lj.Provider,{value:n,children:(0,y.jsx)(dj,{ref:t,...r})}):null}),pj=b.createContext(void 0);function mj(){let e=b.useContext(pj);if(e===void 0)throw Error(iS(71));return e}var hj=b.createContext(void 0);function gj(){return b.useContext(hj)?.direction??`ltr`}var _j=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=JC(e,t)||{};if(l==null)return{};let f=fw(u),p={x:n,y:r},m=ew(i),h=QC(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=qC(k,j,A),N=!c.arrow&&XC(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),vj=(e,t)=>({..._j(e),options:[e,t]}),yj={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await fO().fn(e)).data?.referenceHidden||a}}}},bj={sideX:`left`,sideY:`top`},xj={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=dx(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:bj};let u=await a.getOffsetParent?.(i),d={width:0,height:0};if(o===`fixed`&&c?.visualViewport)d={width:c.visualViewport.width,height:c.visualViewport.height};else if(u===c){let e=tC(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=YC(s),p=t,m=n;f===`left`&&(p=d.width-(t+r.width)),f===`top`&&(m=d.height-(n+r.height));let h=f===`left`?`right`:bj.sideX,g=f===`top`?`bottom`:bj.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function Sj(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Cj(e,t,n){let{rects:r,placement:i}=e;return{side:Sj(t,YC(i),n),align:XC(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function wj(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,collisionBoundary:s,collisionPadding:c=5,sticky:l=!1,arrowPadding:u=5,disableAnchorTracking:d=!1,keepMounted:f=!1,floatingRootContext:p,mounted:m,collisionAvoidance:h,shiftCrossAxis:g=!1,nodeId:_,adaptiveOrigin:v,lazyFlip:y=!1,externalTree:x}=e,[S,C]=b.useState(null);!m&&S!==null&&C(null);let w=h.side||`flip`,T=h.align||`flip`,E=h.fallbackAxisSide||`end`,D=typeof t==`function`?t:void 0,O=Z(D),k=D?O:t,A=aE(t),j=aE(m),M=gj()===`rtl`,N=S||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":M?`left`:`right`,"inline-start":M?`right`:`left`}[r],P=a===`center`?N:`${N}-${a}`,F=c,I=+(r===`bottom`),L=+(r===`top`),ee=+(r===`right`),R=+(r===`left`);typeof F==`number`?F={top:F+I,right:F+R,bottom:F+L,left:F+ee}:F&&={top:(F.top||0)+I,right:(F.right||0)+R,bottom:(F.bottom||0)+L,left:(F.left||0)+ee};let te={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:F},z=b.useRef(null),B=aE(i),V=aE(o),ne=[sO(e=>{let t=Cj(e,r,M),n=typeof B.current==`function`?B.current(t):B.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,M,r])],re=T===`none`&&w!==`shift`,H=!re&&(l||g||w===`shift`),ie=w===`none`?null:uO({...te,padding:{top:F.top+1,right:F.right+1,bottom:F.bottom+1,left:F.left+1},mainAxis:!g&&w===`flip`,crossAxis:T===`flip`?`alignment`:!1,fallbackAxisSideDirection:E}),ae=re?null:cO(e=>{let t=tC(e.elements.floating).documentElement;return{...te,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:H,limiter:l||g?void 0:lO(e=>{if(!z.current)return{};let{width:t,height:n}=z.current.getBoundingClientRect(),r=$C(YC(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})}},[te,l,g,F,T]);w===`shift`||T===`shift`||a===`center`?ne.push(ae,ie):ne.push(ie,ae),ne.push(dO({...te,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!j.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=dx(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),vj(()=>({element:z.current||tC(z.current).createElement(`div`),padding:u,offsetParent:`floating`}),[u]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=YC(a),l=$C(c),u=z.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(Cj(e,r,M)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,H&&l===`y`&&b?S:x),{}}},yj,v),Q(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,p]);let oe=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:se,elements:ce,x:le,y:ue,middlewareData:de,update:fe,placement:pe,context:me,isPositioned:he,floatingStyles:ge}=GO({rootContext:p,open:f?m:void 0,placement:P,middleware:ne,strategy:n,whileElementsMounted:f?void 0:(...e)=>qD(...e,oe),nodeId:_,externalTree:x}),{sideX:_e,sideY:ve}=de.adaptiveOrigin||bj,ye=he?n:`fixed`,be=b.useMemo(()=>{let e=v?{position:ye,[_e]:le,[ve]:ue}:{position:ye,...ge};return he||(e.opacity=0),e},[v,ye,_e,le,ve,ue,ge,he]),xe=b.useRef(null);Q(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(Tj(t)?t.current:t)||null;n!==xe.current&&(se.setPositionReference(n),xe.current=n)},[m,se,k,A]),b.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&Tj(e)&&e.current!==xe.current&&(se.setPositionReference(e.current),xe.current=e.current)},[m,se,k,A]),b.useEffect(()=>{if(f&&m&&ce.domReference&&ce.floating)return qD(ce.domReference,ce.floating,fe,oe)},[f,m,ce,fe,oe]);let Se=YC(pe),Ce=Sj(r,Se,M),we=XC(pe)||`center`,Te=!!de.hide?.referenceHidden;Q(()=>{y&&m&&he&&C(Se)},[y,m,he,Se]);let Ee=b.useMemo(()=>({position:`absolute`,top:de.arrow?.y,left:de.arrow?.x}),[de.arrow]),De=de.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:be,arrowStyles:Ee,arrowRef:z,arrowUncentered:De,side:Ce,align:we,physicalSide:Se,anchorHidden:Te,refs:se,context:me,isPositioned:he,update:fe}),[be,Ee,z,De,Ce,we,Se,Te,se,me,he,fe])}function Tj(e){return e!=null&&`current`in e}function Ej(e){return e===`starting`?EE:SS}function Dj(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),ES(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Ej(r),i],stateAttributesMapping:Gk})}var Oj=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`top`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=kE,style:g,..._}=e,v=ej(),x=uj(),S=v.useState(`open`),C=v.useState(`mounted`),w=v.useState(`trackCursorAxis`),T=v.useState(`disableHoverablePopup`),E=v.useState(`floatingRootContext`),D=v.useState(`instantType`),O=v.useState(`transitionStatus`),k=wj({anchor:i,positionMethod:a,floatingRootContext:E,mounted:C,side:o,sideOffset:c,align:s,alignOffset:l,collisionBoundary:u,collisionPadding:d,sticky:p,arrowPadding:f,disableAnchorTracking:m,keepMounted:x,collisionAvoidance:h,adaptiveOrigin:v.useState(`hasViewport`)?xj:void 0}),A=Dj(e,b.useMemo(()=>({open:S,side:k.side,align:k.align,anchorHidden:k.anchorHidden,instant:w===`none`?D:`tracking-cursor`}),[S,k.side,k.align,k.anchorHidden,w,D]),{styles:k.positionerStyles,transitionStatus:O,props:_,refs:[t,v.useStateSetter(`positionerElement`)],hidden:!C,inert:!S||w===`both`||T});return(0,y.jsx)(pj.Provider,{value:k,children:A})}),kj={...Gk,...sT},Aj=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=ej(),{side:s,align:c}=mj(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);uT({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=o.useState(`disabled`),h=o.useState(`closeDelay`);return ek(p,{enabled:!m,closeDelay:h}),ES(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,Ej(d),a],stateAttributesMapping:kj})}),jj=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=ej(),s=o.useState(`open`),c=o.useState(`instantType`),{arrowRef:l,side:u,align:d,arrowUncentered:f,arrowStyles:p}=mj();return ES(`div`,e,{state:{open:s,side:u,align:d,uncentered:f,instant:c},ref:[t,l],props:[{style:p,"aria-hidden":!0},a],stateAttributesMapping:Gk})}),Mj=function(e){let{delay:t,closeDelay:n,timeout:r=400}=e,i=b.useMemo(()=>({delay:t,closeDelay:n}),[t,n]),a=b.useMemo(()=>({open:t,close:n}),[t,n]);return(0,y.jsx)(aj.Provider,{value:i,children:(0,y.jsx)(nE,{delay:a,timeoutMs:r,children:e.children})})};function Nj(e){let[t,n]=b.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function Pj({delay:e=0,...t}){return(0,y.jsx)(Mj,{"data-slot":`tooltip-provider`,delay:e,...t})}function Fj({...e}){return(0,y.jsx)(ij,{"data-slot":`tooltip`,...e})}function Ij({...e}){return(0,y.jsx)(cj,{"data-slot":`tooltip-trigger`,...e})}function Lj({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,y.jsx)(fj,{children:(0,y.jsx)(Oj,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,y.jsxs)(Aj,{"data-slot":`tooltip-content`,className:cx(`z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...o,children:[a,(0,y.jsx)(jj,{className:`z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5`})]})})})}var Rj=b.createContext(null),zj=b.createContext(null);function Bj(){let e=b.useContext(Rj);if(e===null)throw Error(iS(60));return e}function Vj(){let e=b.useContext(zj);if(e===null)throw Error(iS(61));return e}var Hj=(e,t)=>Object.is(e,t);function Uj(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Wj(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:Uj(t,e,n))}function Gj(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:Uj(e,t,n))}function Kj(e,t,n){return e.filter(e=>!Uj(t,e,n))}function qj(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Jj(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Yj(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Jj(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Xj(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return qj(e)}function Zj(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?qj(e.value):qj(e)}function Qj(e,t,n){function r(){return Xj(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=Jj(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function $j(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,y.jsx)(b.Fragment,{children:Qj(r,t,n)},i)),e),[])}var eM={id:$(e=>e.id),labelId:$(e=>e.labelId),modal:$(e=>e.modal),multiple:$(e=>e.multiple),items:$(e=>e.items),itemToStringLabel:$(e=>e.itemToStringLabel),itemToStringValue:$(e=>e.itemToStringValue),isItemEqualToValue:$(e=>e.isItemEqualToValue),value:$(e=>e.value),hasSelectedValue:$(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Zj(t,r)!==``}),hasNullItemLabel:$((e,t)=>t?Yj(e.items):!1),open:$(e=>e.open),mounted:$(e=>e.mounted),forceMount:$(e=>e.forceMount),transitionStatus:$(e=>e.transitionStatus),openMethod:$(e=>e.openMethod),activeIndex:$(e=>e.activeIndex),selectedIndex:$(e=>e.selectedIndex),isActive:$((e,t)=>e.activeIndex===t),isSelected:$((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>Uj(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Uj(n,i,r)}),isSelectedByFocus:$((e,t)=>e.selectedIndex===t),popupProps:$(e=>e.popupProps),triggerProps:$(e=>e.triggerProps),triggerElement:$(e=>e.triggerElement),positionerElement:$(e=>e.positionerElement),listElement:$(e=>e.listElement),scrollUpArrowVisible:$(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:$(e=>e.scrollDownArrowVisible),hasScrollArrows:$(e=>e.hasScrollArrows)};function tM(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function nM(e,t){return Math.max(0,e-t)}function rM(e,t){if(t<=0)return 0;let n=tM(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function iM(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:a,defaultOpen:o=!1,onOpenChange:s,name:c,form:l,autoComplete:u,disabled:d=!1,readOnly:f=!1,required:p=!1,modal:m=!0,actionsRef:h,inputRef:g,onOpenChangeComplete:_,items:v,multiple:x=!1,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w=Hj,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=US(),{setDirty:O,setTouched:k,setFocused:A,shouldValidateOnChange:j,validityData:M,setFilled:N,name:P,disabled:F,validation:I,validationMode:L}=VS(),ee=eC({id:t}),R=F||d,te=P??c,[z,B]=fT({controlled:n,default:x?r??xS:r,name:`Select`,state:`value`}),[V,ne]=fT({controlled:a,default:o,name:`Select`,state:`open`}),re=b.useRef([]),H=b.useRef([]),ie=b.useRef(null),ae=b.useRef(null),oe=b.useRef(0),se=b.useRef(null),ce=b.useRef([]),le=b.useRef(!1),ue=b.useRef(!1),de=b.useRef(null),fe=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),pe=b.useRef(!1),{mounted:me,setMounted:he,transitionStatus:ge}=dT(V),{openMethod:_e,triggerProps:ve}=Ek(V),ye=Fx(()=>new jO({id:ee,labelId:void 0,modal:m,multiple:x,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:z,open:V,mounted:me,transitionStatus:ge,items:v,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,be=DO(ye,eM.activeIndex),xe=DO(ye,eM.selectedIndex),Se=DO(ye,eM.triggerElement),Ce=DO(ye,eM.positionerElement),we=Nj(_e),Te=_e??we,Ee=b.useMemo(()=>x&&Array.isArray(z)&&z.length===0?``:Zj(z,C),[x,z,C]),De=b.useMemo(()=>x&&Array.isArray(z)?z.map(e=>Zj(e,C)):Zj(z,C),[x,z,C]);pT(aE(ye.state.triggerElement),{id:ee,value:z,getValue:Z(()=>De)});let Oe=b.useRef(z);Q(()=>{z!==Oe.current&&ye.set(`forceMount`,!0)},[ye,z]),Q(()=>{N(x?Array.isArray(z)&&z.length>0:z!=null)},[x,z,N]),Q(function(){if(V)return;let e=ce.current;if(x){let t=Array.isArray(z)?z:[];if(t.length===0){ye.set(`selectedIndex`,null);return}let n=t[t.length-1],r=Gj(e,n,w);ye.set(`selectedIndex`,r===-1?null:r);return}let t=Gj(e,z,w);ye.set(`selectedIndex`,t===-1?null:t)},[x,V,z,ce,w,ye]),Tk(z,()=>{D(te),O(z!==M.initialValue),j()?I.commit(z):I.commit(z,!0)});let ke=Z((e,t)=>{if(s?.(e,t),!t.isCanceled&&(ne(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(z)),!e&&ye.state.activeIndex!==null)){let e=re.current[ye.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Ae=Z(()=>{he(!1),ye.update({activeIndex:null,openMethod:null}),_?.(!1)});uT({enabled:!h,open:V,ref:ie,onComplete(){V||Ae()}}),b.useImperativeHandle(h,()=>({unmount:Ae}),[Ae]);let je=Z((e,t)=>{i?.(e,t),!t.isCanceled&&B(e)}),Me=Z(()=>{let e=ye.state.listElement||ie.current;if(!e)return;let t=nM(e.scrollHeight,e.clientHeight),n=rM(e.scrollTop,t),r=n>0,i=n<t;ye.state.scrollUpArrowVisible!==r&&ye.set(`scrollUpArrowVisible`,r),ye.state.scrollDownArrowVisible!==i&&ye.set(`scrollDownArrowVisible`,i)}),Ne=WO({open:V,onOpenChange:ke,elements:{reference:Se,floating:Ce}}),{getReferenceProps:Pe,getFloatingProps:Fe,getItemProps:Ie}=rk([XE(Ne,{enabled:!f&&!R,event:`mousedown`}),rD(Ne,{bubbles:!1}),fk(Ne,{enabled:!f&&!R,listRef:re,activeIndex:be,selectedIndex:xe,disabledIndices:xS,onNavigate(e){e===null&&!V||ye.set(`activeIndex`,e)},focusItemOnHover:T}),hk(Ne,{enabled:!f&&!R&&(V||!x),listRef:H,activeIndex:be,selectedIndex:xe,onMatch(e){V?ye.set(`activeIndex`,e):je(ce.current[e],OT(`none`))},onTypingChange(e){le.current=e}})]),Le=b.useMemo(()=>Ux(Pe(),ve,ee?{id:ee}:SS),[Pe,ve,ee]);BT(()=>{ye.update({popupProps:Fe(),triggerProps:Le})}),Q(()=>{ye.update({id:ee,modal:m,multiple:x,value:z,open:V,mounted:me,transitionStatus:ge,popupProps:Fe(),triggerProps:Le,items:v,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:Te})},[ye,ee,m,x,z,V,me,ge,Fe,Le,v,S,C,w,Te]);let Re=b.useMemo(()=>({store:ye,name:te,required:p,disabled:R,readOnly:f,multiple:x,highlightItemOnHover:T,setValue:je,setOpen:ke,listRef:re,popupRef:ie,scrollHandlerRef:ae,handleScrollArrowVisibility:Me,scrollArrowsMountedCountRef:oe,getItemProps:Ie,events:Ne.context.events,valueRef:se,valuesRef:ce,labelsRef:H,typingRef:le,selectionRef:fe,selectedItemTextRef:de,validation:I,onOpenChangeComplete:_,keyboardActiveRef:ue,alignItemWithTriggerActiveRef:pe,initialValueRef:Oe}),[ye,te,p,R,f,x,T,je,ke,Ie,Ne.context.events,I,_,Me]),ze=dS(g,I.inputRef),Be=x&&Array.isArray(z)&&z.length>0,Ve=x?void 0:te,He=b.useMemo(()=>!x||!Array.isArray(z)||!te?null:z.map(e=>{let t=Zj(e,C);return(0,y.jsx)(`input`,{type:`hidden`,form:l,name:te,value:t},t)}),[x,z,l,te,C]);return(0,y.jsx)(Rj.Provider,{value:Re,children:(0,y.jsxs)(zj.Provider,{value:Ne,children:[E,(0,y.jsx)(`input`,{...I.getInputValidationProps({onFocus(){ye.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.currentTarget.value,n=OT(mT,e.nativeEvent);function r(){if(x)return;let e=ce.current.find(e=>Zj(e,C).toLowerCase()===t.toLowerCase()||Xj(e,S).toLowerCase()===t.toLowerCase());e!=null&&(O(e!==M.initialValue),je(e,n),j()&&I.commit(e))}ye.set(`forceMount`,!0),queueMicrotask(r)}}),id:ee&&Ve==null?`${ee}-hidden-input`:void 0,form:l,name:Ve,autoComplete:u,value:Ee,disabled:R,required:p&&!Be,readOnly:f,ref:ze,style:te?lE:cE,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),He]})})}function aM(e,t){return e??t}function oM(e){let t=e.getBoundingClientRect(),n=dx(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var sM=2,cM=400,lM=200,uM={...Wk,...zS,value:()=>null},dM=b.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:o=!0,style:s,...c}=e,{setTouched:l,setFocused:u,validationMode:d,state:f,disabled:p}=VS(),{labelId:m}=XS(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=Bj(),T=p||C||a,E=DO(h,eM.open),D=DO(h,eM.value),O=DO(h,eM.triggerProps),k=DO(h,eM.positionerElement),A=DO(h,eM.listElement),j=DO(h,eM.id),M=DO(h,eM.labelId),N=DO(h,eM.hasSelectedValue),P=!N&&E,F=DO(h,eM.hasNullItemLabel,P),I=i??j,L=aM(m,M);eC({id:I});let ee=aE(k),R=b.useRef(null),{getButtonProps:te,buttonRef:z}=cS({disabled:T,native:o}),B=dS(t,R,z,Z(e=>{h.set(`triggerElement`,e)})),V=Qw(),ne=Qw(),re=Qw(),H=Qw();b.useEffect(()=>{if(E)return N||F?H.start(lM,()=>{_.current.allowUnselectedMouseUp=!0,re.start(lM,()=>{_.current.allowSelectedMouseUp=!0})}):re.start(cM,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{re.clear(),H.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},ne.clear()},[E,N,F,_,ne,re,H]);let ie=b.useMemo(()=>A?.id??jC(k)?.id,[A,k]),ae=Ux(O,{id:I,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?ie:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:B,onFocus(e){u(!0),E&&S.current&&g(!1,OT(mT,e.nativeEvent)),V.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){SC(k,e.relatedTarget)||(l(!0),u(!1),d===`onBlur`&&v.commit(D))},onPointerMove(){w.current=!1},onKeyDown(){w.current=!0},onMouseDown(e){if(E)return;let t=tC(e.currentTarget);function n(e){if(!R.current)return;let t=e.target;if(SC(R.current,t)||SC(ee.current,t)||t===R.current)return;let n=oM(R.current);e.clientX>=n.left-sM&&e.clientX<=n.right+sM&&e.clientY>=n.top-sM&&e.clientY<=n.bottom+sM||g(!1,OT(wT,e))}ne.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,te);ae.role=`combobox`;let oe={...f,open:E,disabled:T,value:D,readOnly:y,placeholder:!N};return ES(`button`,e,{ref:[t,R],state:oe,stateAttributesMapping:uM,props:ae})}),fM={value:()=>null},pM=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=Bj(),u=DO(c,eM.value),d=DO(c,eM.items),f=DO(c,eM.itemToStringLabel),p=DO(c,eM.hasSelectedValue),m=!p&&a!=null&&i==null,h=DO(c,eM.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?$j(u,d,f):Qj(u,d,f)),ES(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:fM})}),mM=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o}=Bj();return ES(`span`,e,{state:{open:DO(o,eM.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:Uk})}),hM=b.createContext(void 0),gM=b.forwardRef(function(e,t){let{store:n}=Bj(),r=DO(n,eM.mounted),i=DO(n,eM.forceMount);return r||i?(0,y.jsx)(hM.Provider,{value:!0,children:(0,y.jsx)(FE,{ref:t,...e})}):null}),_M=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function vM(){return b.useContext(_M)}function yM(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),o=b.useRef(0),s=Fx(xM).current,c=Fx(bM).current,[l,u]=b.useState(0),d=b.useRef(l),f=Z((e,t)=>{c.set(e,t??null),d.current+=1,u(d.current)}),p=Z(e=>{c.delete(e),d.current+=1,u(d.current)}),m=b.useMemo(()=>{let e=new Map;return Array.from(c.keys()).filter(e=>e.isConnected).sort(SM).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);Q(()=>{if(typeof MutationObserver!=`function`||m.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(d.current+=1,u(d.current))});return m.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[m]),Q(()=>{d.current===l&&(n.current.length!==m.size&&(n.current.length=m.size),r&&r.current.length!==m.size&&(r.current.length=m.size),o.current=m.size),a(m)},[a,m,n,r,l]),Q(()=>()=>{n.current=[]},[n]),Q(()=>()=>{r&&(r.current=[])},[r]);let h=Z(e=>(s.add(e),()=>{s.delete(e)}));Q(()=>{s.forEach(e=>e(m))},[s,m]);let g=b.useMemo(()=>({register:f,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:o}),[f,p,h,n,r,o]);return(0,y.jsx)(_M.Provider,{value:g,children:t})}function bM(){return new Map}function xM(){return new Set}function SM(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var CM=b.createContext(void 0);function wM(){let e=b.useContext(CM);if(!e)throw Error(iS(59));return e}function TM(e,t){e&&Object.assign(e.style,t)}var EM={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},DM=20;function OM(e,t,n,r){let[i,a]=b.useState(!1);Q(()=>{if(!e||!t||n==null){a(!1);return}let r=tC(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-DM)},[e,t,n]),XT(e&&(!t||i),r)}var kM={position:`fixed`},AM=b.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:a,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m,alignItemWithTrigger:h=!0,collisionAvoidance:g=OE,style:_,...v}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=Bj(),A=Vj(),j=DO(x,eM.open),M=DO(x,eM.mounted),N=DO(x,eM.modal),P=DO(x,eM.value),F=DO(x,eM.openMethod),I=DO(x,eM.positionerElement),L=DO(x,eM.triggerElement),ee=DO(x,eM.isItemEqualToValue),R=DO(x,eM.transitionStatus),te=b.useRef(null),z=b.useRef(null),[B,V]=b.useState(h),ne=M&&B&&F!==`touch`;!M&&B!==h&&V(h),Q(()=>{M||(eM.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),eM.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),b.useImperativeHandle(w,()=>ne),OM((ne||N)&&j,F===`touch`,I,L);let re=wj({anchor:n,floatingRootContext:A,positionMethod:r,mounted:M,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m??ne,collisionAvoidance:g,keepMounted:!0}),H=ne?`none`:re.side,ie=ne?kM:re.positionerStyles,ae=Dj(e,{open:j,side:H,align:re.align,anchorHidden:re.anchorHidden},{styles:ie,transitionStatus:R,props:v,refs:[t,Z(e=>{x.set(`positionerElement`,e)})],hidden:!M,inert:!j}),oe=b.useRef(0),se=Z(e=>{if(e.size===0&&oe.current===0||E.current.length===0)return;let t=oe.current;if(oe.current=e.size,e.size===t)return;let n=OT(mT);if(t!==0&&!x.state.multiple&&P!==null&&Gj(E.current,P,ee)===-1){let e=D.current,t=e!=null&&Gj(E.current,e,ee)!==-1?e:null;k(t,n),t===null&&(x.set(`selectedIndex`,null),T.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(P)){let e=e=>Gj(E.current,e,ee)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!Wj(P,e,ee)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&ne){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};TM(I,e),TM(O.current,e)}}),ce=b.useMemo(()=>({...re,side:H,alignItemWithTriggerActive:ne,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:te,scrollDownArrowRef:z}),[re,H,ne,V]);return(0,y.jsx)(yM,{elementsRef:S,labelsRef:C,onMapChange:se,children:(0,y.jsxs)(CM.Provider,{value:ce,children:[M&&N&&(0,y.jsx)(fA,{inert:dA(!j),cutout:L}),ae]})})}),jM=`base-ui-disable-scrollbar`,MM={className:jM,getElement(e){return(0,y.jsx)(`style`,{nonce:e,href:jM,precedence:`base-ui:low`,children:`.${jM}{scrollbar-width:none}.${jM}::-webkit-scrollbar{display:none}`})}},NM=b.createContext(void 0);function PM(e){let t=b.useContext(NM);if(t===void 0&&!e)throw Error(iS(69));return t}var FM=b.createContext(void 0),IM={disableStyleElements:!1};function LM(){return b.useContext(FM)??IM}var RM={...Gk,...sT},zM=b.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:a,...o}=e,{store:s,popupRef:c,onOpenChangeComplete:l,setOpen:u,valueRef:d,selectedItemTextRef:f,keyboardActiveRef:p,multiple:m,handleScrollArrowVisibility:h,scrollHandlerRef:g,listRef:_,highlightItemOnHover:v}=Bj(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=wM(),O=PM(!0)!=null,k=Vj(),A=gj(),{nonce:j,disableStyleElements:M}=LM(),N=DO(s,eM.id),P=DO(s,eM.open),F=DO(s,eM.mounted),I=DO(s,eM.popupProps),L=DO(s,eM.transitionStatus),ee=DO(s,eM.triggerElement),R=DO(s,eM.positionerElement),te=DO(s,eM.listElement),z=b.useRef(!1),B=b.useRef(!1),V=b.useRef({}),ne=nT(),re=Z(e=>{if(!R||!c.current||!B.current)return;if(z.current||!C){h();return}let t=R.style.top===`0px`,n=R.style.bottom===`0px`;if(!t&&!n){h();return}let r=HM(R),i=UM(R.getBoundingClientRect().height,`y`,r),a=tC(R),o=getComputedStyle(R),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=BM(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=VM(e),m=0,g=null,_=!1,v=!1,y=e=>{R.style.height=`${e}px`},b=(t,n)=>{let r=tM(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(z.current=!0),h()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?v=!0:g=0:(_=!0,n&&f<p&&(g=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&y(m),v||g!=null){let t=VM(e),n=v?t:tM(g,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(z.current=!0),h()});b.useImperativeHandle(g,()=>re,[re]),uT({open:P,ref:c,onComplete(){P&&l?.(!0)}});let H={open:P,transitionStatus:L,side:x,align:S};Q(()=>{!R||!c.current||Object.keys(V.current).length||(V.current={top:R.style.top||`0`,left:R.style.left||`0`,right:R.style.right,height:R.style.height,bottom:R.style.bottom,minHeight:R.style.minHeight,maxHeight:R.style.maxHeight,marginTop:R.style.marginTop,marginBottom:R.style.marginBottom})},[c,R]),Q(()=>{P||C||(B.current=!1,z.current=!1,TM(R,V.current))},[P,C,R,c]),Q(()=>{let e=c.current;if(!P||!ee||!R||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){B.current=!0,ne.request(h),e.style.removeProperty(`--transform-origin`);return}let t=KM(e);e.style.removeProperty(`--transform-origin`);try{let t=f.current,n=d.current,r=getComputedStyle(R),i=getComputedStyle(e),a=tC(ee),o=dx(R),c=HM(ee),l=WM(ee.getBoundingClientRect(),c),u=WM(R.getBoundingClientRect(),c),p=l.height,m=te||e,g=m.scrollHeight,y=parseFloat(i.borderBottomWidth),b=parseFloat(r.marginTop)||10,x=parseFloat(r.marginBottom)||10,S=parseFloat(r.minHeight)||100,C=BM(i),w=a.documentElement.clientHeight-b-x,E=a.documentElement.clientWidth,D=w-l.bottom+p,O,k=A===`rtl`?l.right-u.width:l.left,j=0;if(t&&n){let e=WM(n.getBoundingClientRect(),c);O=WM(t.getBoundingClientRect(),c),k=u.left+(A===`rtl`?e.right-O.right:e.left-O.left);let r=e.top-l.top+e.height/2;j=O.top-u.top+O.height/2-r}let M=D+j+x+y,N=Math.min(w,M),P=w-b-x,F=M-N,I=E-5;R.style.left=`${tM(k,5,I-u.width)}px`,R.style.height=`${N}px`,R.style.maxHeight=`auto`,R.style.marginTop=`${b}px`,R.style.marginBottom=`${x}px`,e.style.height=`100%`;let L=VM(m),ne=F>=L-1;ne&&(N=Math.min(w,u.height)-(F-L));let re=l.top<20||l.bottom>w-20||Math.ceil(N)+1<Math.min(g,S),H=(o.visualViewport?.scale??1)!==1&&oC;if(re||H){B.current=!0,TM(R,V.current),T(!1);return}let ie=Math.max(S,N);if(ne){let e=Math.max(0,w-M);R.style.top=u.height>=P?`0`:`${e}px`,R.style.height=`${N}px`,m.scrollTop=VM(m)}else R.style.bottom=`0`,m.scrollTop=F;if(O){let t=u.top,n=u.height,r=O.top+O.height/2,i=tM(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(ie===w||N>=C)&&(z.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),B.current=!0}finally{t()}},[s,P,R,ee,d,f,c,h,C,T,ne,E,D,te,_,v,A,w]),b.useEffect(()=>{if(!C||!R||!P)return;let e=dx(R);function t(e){u(!1,OT(DT,e))}return VT(e,`resize`,t)},[u,C,R,P]);let ie={...te?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(e){p.current=!0,O&&cA.has(e.key)&&e.stopPropagation()},onMouseMove(){p.current=!1},onScroll(e){te||re(e.currentTarget)},...C&&{style:te?{height:`100%`}:EM}},ae=ES(`div`,e,{ref:[t,c],state:H,stateAttributesMapping:RM,props:[I,ie,Ej(L),{className:!te&&C?MM.className:void 0},o]});return(0,y.jsxs)(b.Fragment,{children:[!M&&MM.getElement(j),(0,y.jsx)(YE,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:ae})]})});function BM(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function VM(e){return nM(e.scrollHeight,e.clientHeight)}function HM(e){return WD.getScale(e)}function UM(e,t,n){return e/n[t]}function WM(e,t){return pw({x:UM(e.x,`x`,t),y:UM(e.y,`y`,t),width:UM(e.width,`x`,t),height:UM(e.height,`y`,t)})}var GM=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function KM(e){let{style:t}=e,n={};for(let[e,r]of GM)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of GM){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var qM=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=Bj(),{alignItemWithTriggerActive:c}=wM(),l=DO(o,eM.hasScrollArrows),u=DO(o,eM.openMethod),d=DO(o,eM.multiple),f={id:`${DO(o,eM.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:EM},className:l&&u!==`touch`?MM.className:void 0};return ES(`div`,e,{ref:[t,Z(e=>{o.set(`listElement`,e)})],props:[f,a]})}),JM=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function YM(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:a}=e,{register:o,unregister:s,subscribeMapChange:c,elementsRef:l,labelsRef:u,nextIndexRef:d}=vM(),f=b.useRef(-1),[p,m]=b.useState(a??(i===JM.GuessFromOrder?()=>{if(f.current===-1){let e=d.current;d.current+=1,f.current=e}return f.current}:-1)),h=b.useRef(null),g=b.useCallback(e=>{if(h.current=e,p!==-1&&e!==null&&(l.current[p]=e,u)){let n=t!==void 0;u.current[p]=n?t:r?.current?.textContent??e.textContent}},[p,l,u,t,r]);return Q(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),Q(()=>{if(a==null)return c(e=>{let t=h.current?e.get(h.current)?.index:null;t!=null&&m(t)})},[a,c,m]),b.useMemo(()=>({ref:g,index:p}),[p,g])}var XM=b.createContext(void 0);function ZM(){let e=b.useContext(XM);if(!e)throw Error(iS(57));return e}var QM=b.memo(b.forwardRef(function(e,t){let{render:n,className:r,value:i=null,label:a,disabled:o=!1,nativeButton:s=!1,style:c,...l}=e,u=b.useRef(null),d=YM({label:a,textRef:u,indexGuessBehavior:JM.GuessFromOrder}),{store:f,getItemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:x,selectedItemTextRef:S}=Bj(),C=DO(f,eM.isActive,d.index),w=DO(f,eM.isSelected,d.index,i),T=DO(f,eM.isSelectedByFocus,d.index),E=DO(f,eM.isItemEqualToValue),D=d.index,O=D!==-1,k=b.useRef(null),A=aE(D);Q(()=>{if(!O)return;let e=v.current;return e[D]=i,()=>{delete e[D]}},[O,D,i,v]),Q(()=>{if(!O)return;let e=f.state.value,t=e;x&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&Uj(i,t,E)&&(f.set(`selectedIndex`,D),u.current&&(S.current=u.current))},[O,D,x,E,f,i,S]);let j={disabled:o,selected:w,highlighted:C},M=p({active:C,selected:w});M.id=void 0;let N=b.useRef(null),P=b.useRef(`mouse`),F=b.useRef(!1),{getButtonProps:I,buttonRef:L}=cS({disabled:o,focusableWhenDisabled:!0,native:s,composite:!0});function ee(e){let t=f.state.value;if(x){let n=Array.isArray(t)?t:[];h(w?Kj(n,i,E):[...n,i],OT(yT,e))}else h(i,OT(yT,e)),m(!1,OT(yT,e))}let R={role:`option`,"aria-selected":w,tabIndex:C?0:-1,onTouchStart(){g.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(e){N.current=e.key,f.set(`activeIndex`,D),e.key===` `&&_.current&&e.preventDefault()},onClick(e){F.current=!1,!(e.type===`keydown`&&N.current===null)&&(o||e.type===`keydown`&&N.current===` `&&_.current||P.current!==`touch`&&!C||(N.current=null,ee(e.nativeEvent)))},onPointerEnter(e){P.current=e.pointerType},onPointerDown(e){P.current=e.pointerType,F.current=!0},onMouseUp(){if(o)return;if(F.current){F.current=!1;return}let e=!g.current.allowSelectedMouseUp&&w,t=!g.current.allowUnselectedMouseUp&&!w;e||t||P.current!==`touch`&&!C||k.current?.click()}},te=ES(`div`,e,{ref:[L,t,d.ref,k],state:j,props:[M,R,l,I]}),z=b.useMemo(()=>({selected:w,indexRef:A,textRef:u,selectedByFocus:T,hasRegistered:O}),[w,A,u,T,O]);return(0,y.jsx)(XM.Provider,{value:z,children:te})})),$M=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=ZM();return n||r?(0,y.jsx)(eN,{...e,ref:t}):null}),eN=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=ZM(),c=b.useRef(null),{transitionStatus:l,setMounted:u}=dT(s),d=ES(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:sT});return uT({open:s,ref:c,onComplete(){s||u(!1)}}),d})),tN=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=ZM(),{selectedItemTextRef:o}=Bj(),{className:s,render:c,style:l,...u}=e;return ES(`div`,e,{ref:[b.useCallback(e=>{if(!e||!a)return;let t=o.current===null||!o.current.isConnected;(i||t&&n.current===0)&&(o.current=e)},[o,n,i,a]),t,r],props:u})})),nN=b.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:a,keepMounted:o=!1,...s}=e,c=a===`up`,{store:l,popupRef:u,listRef:d,handleScrollArrowVisibility:f,scrollArrowsMountedCountRef:p}=Bj(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=wM(),_=DO(l,c?eM.scrollUpArrowVisible:eM.scrollDownArrowVisible),v=DO(l,eM.openMethod),y=_&&v!==`touch`,b=Qw(),x=c?g:h,{transitionStatus:S,setMounted:C}=dT(y);Q(()=>(p.current+=1,l.state.hasScrollArrows||l.set(`hasScrollArrows`,!0),()=>{p.current=Math.max(0,p.current-1),p.current===0&&l.state.hasScrollArrows&&l.set(`hasScrollArrows`,!1)}),[l,p]),uT({open:y,ref:x,onComplete(){y||C(!1)}});let w=ES(`div`,e,{ref:[t,x],state:{direction:a,visible:y,side:m,transitionStatus:S},props:[{"aria-hidden":!0,children:c?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||b.isStarted())return;l.set(`activeIndex`,null);function t(){let e=l.state.listElement??u.current;if(!e)return;l.set(`activeIndex`,null),f();let n=nM(e.scrollHeight,e.clientHeight),r=rM(e.scrollTop,n),i=r===(c?0:n),a=d.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&l.set(c?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){b.clear();return}if(a.length>0){let t=x.current?.offsetHeight||0;e.scrollTop=rN(a,c,r,e.clientHeight,t,n)}b.start(40,t)}b.start(40,t)},onMouseLeave(){b.clear()}},s]});return y||o?w:null});function rN(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?rM(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?rM(l.offsetTop+l.offsetHeight-r+i,a):a}var iN=b.forwardRef(function(e,t){return(0,y.jsx)(nN,{...e,ref:t,direction:`down`})}),aN=b.forwardRef(function(e,t){return(0,y.jsx)(nN,{...e,ref:t,direction:`up`})}),oN=iM;function sN({className:e,...t}){return(0,y.jsx)(pM,{"data-slot":`select-value`,className:cx(`flex flex-1 text-left`,e),...t})}function cN({className:e,size:t=`default`,children:n,...r}){return(0,y.jsxs)(dM,{"data-slot":`select-trigger`,"data-size":t,className:cx(`flex w-fit items-center justify-between gap-1.5 rounded-md border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,y.jsx)(mM,{render:(0,y.jsx)(Cy,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function lN({className:e,children:t,footer:n,side:r=`bottom`,sideOffset:i=4,align:a=`center`,alignOffset:o=0,alignItemWithTrigger:s=!0,...c}){return(0,y.jsx)(gM,{children:(0,y.jsx)(AM,{side:r,sideOffset:i,align:a,alignOffset:o,alignItemWithTrigger:s,className:`isolate z-50`,children:(0,y.jsxs)(zM,{"data-slot":`select-content`,"data-align-trigger":s,className:cx(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[align-trigger=true]:animate-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,e),...c,children:[(0,y.jsx)(dN,{}),(0,y.jsx)(qM,{children:t}),(0,y.jsx)(fN,{}),n]})})})}function uN({className:e,children:t,...n}){return(0,y.jsxs)(QM,{"data-slot":`select-item`,className:cx(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,y.jsx)(tN,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)($M,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(Sy,{className:`pointer-events-none`})})]})}function dN({className:e,...t}){return(0,y.jsx)(aN,{"data-slot":`select-scroll-up-button`,className:cx(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(wy,{})})}function fN({className:e,...t}){return(0,y.jsx)(iN,{"data-slot":`select-scroll-down-button`,className:cx(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,y.jsx)(Cy,{})})}var pN=`h-7 justify-between gap-1.5 rounded-md border-border/60 bg-transparent px-2 text-xs font-normal text-foreground shadow-none focus-visible:border-ring/40 focus-visible:ring-1 focus-visible:ring-ring/40 dark:bg-transparent`,mN=`max-h-72 w-(--anchor-width) origin-(--transform-origin) gap-0 overflow-hidden p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,hN=`rounded-sm py-1.5 pr-7 pl-2 text-xs hover:bg-foreground/10 hover:text-foreground focus:bg-foreground/10 focus:text-foreground`,gN=({value:e,items:t,ariaLabel:n,placeholder:r,onValueChange:i,open:a,onOpenChange:o,onItemHover:s,triggerClassName:c,triggerStyle:l,footerSlot:u})=>{let d=(0,b.useMemo)(()=>t.find(t=>t.id===e),[t,e]),f=(0,b.useMemo)(()=>d?.itemStyle?{...d.itemStyle,...l}:l,[d?.itemStyle,l]);return(0,y.jsxs)(oN,{value:e,onValueChange:i,open:a,onOpenChange:o,children:[(0,y.jsx)(cN,{size:`sm`,"aria-label":n,className:cx(pN,`w-full`,c),style:f,children:(0,y.jsx)(sN,{placeholder:r,children:()=>d?.label||r})}),(0,y.jsx)(lN,{alignItemWithTrigger:!1,sideOffset:4,className:cx(mN,PA,FA),footer:u?(0,y.jsx)(`div`,{className:`border-t border-border/40 p-1`,children:u}):void 0,children:t.map(e=>(0,y.jsx)(uN,{value:e.id,className:hN,style:e.itemStyle,onPointerEnter:s?()=>s(e.id):void 0,onFocus:s?()=>s(e.id):void 0,children:e.label},e.id))})]})},_N=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,vN=Fd.map(e=>({id:e.id,label:e.name})),yN=({themeId:e,onThemeChange:t,onThemePreview:n,onOpenChange:r})=>(0,y.jsxs)(ZA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(QA,{className:_N,children:`Theme`}),(0,y.jsx)(gN,{value:e,items:vN,ariaLabel:`select theme`,placeholder:`Theme`,onValueChange:t,onOpenChange:r,onItemHover:n})]});function bN(e){return ES(e.defaultTagName??`div`,e,e)}var xN=Ly(`flex w-fit items-stretch *:focus-visible:relative *:focus-visible:z-10 has-[>[data-slot=button-group]]:gap-2 has-[select[aria-hidden=true]:last-child]:[&>[data-slot=select-trigger]:last-of-type]:rounded-r-md [&>[data-slot=select-trigger]:not([class*='w-'])]:w-fit [&>input]:flex-1`,{variants:{orientation:{horizontal:`*:data-slot:rounded-r-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-r-md! [&>[data-slot]~[data-slot]]:rounded-l-none [&>[data-slot]~[data-slot]]:border-l-0`,vertical:`flex-col *:data-slot:rounded-b-none [&>[data-slot]:not(:has(~[data-slot]))]:rounded-b-md! [&>[data-slot]~[data-slot]]:rounded-t-none [&>[data-slot]~[data-slot]]:border-t-0`}},defaultVariants:{orientation:`horizontal`}});function SN({className:e,orientation:t,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:cx(xN({orientation:t}),e),...n})}function CN({className:e,render:t,...n}){return bN({defaultTagName:`div`,props:Ux({className:cx(`flex items-center gap-2 rounded-md border bg-muted px-2.5 text-sm font-medium shadow-xs [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4`,e)},n),render:t,state:{slot:`button-group-text`}})}var wN={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1};function TN({value:e,min:t,max:n,step:r,onChange:i}){let a=(0,b.useRef)(null),o=(0,b.useRef)(e);return{onPointerDown:t=>{if(t.button===0){try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}a.current=t.clientX,o.current=e}},onPointerMove:e=>{let s=a.current;if(s===null)return;let c=e.clientX-s,l=Math.round(c/5);if(l===0)return;let u=o.current+l*r;i(Math.max(t,Math.min(n,u)))},onPointerUp:e=>{if(a.current!==null){try{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}catch{}a.current=null}},onPointerLeave:e=>{if(a.current===null)return;let t=!1;try{t=e.currentTarget.hasPointerCapture(e.pointerId)}catch{}t||(a.current=null)},onKeyDown:a=>{if(a.key===`Home`){a.preventDefault(),i(t);return}if(a.key===`End`){a.preventDefault(),i(n);return}let o=wN[a.key];o!==void 0&&(a.preventDefault(),i(Math.max(t,Math.min(n,e+o*r))))}}}var EN=e=>String(e),DN=`size-7 rounded-none border-0 bg-transparent text-foreground hover:bg-foreground/10 hover:text-foreground disabled:opacity-30 [&_svg]:size-3.5`,ON=`h-7 min-w-[3rem] cursor-ew-resize touch-none justify-center border-y-0 border-r border-l! border-border/60 bg-transparent px-1.5 text-xs font-medium tabular-nums text-foreground select-none hover:bg-foreground/5 focus-visible:outline-none focus-visible:bg-foreground/5`,kN=({value:e,min:t,max:n,step:r,ariaLabel:i,decrementAriaLabel:a,incrementAriaLabel:o,formatDisplay:s=EN,onValueChange:c})=>{let l=TN({value:e,min:t,max:n,step:r,onChange:c});return(0,y.jsxs)(SN,{"aria-label":i,className:`h-7 overflow-hidden rounded-md border border-border/60`,children:[(0,y.jsx)(PS,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e-r),disabled:e<=t,"aria-label":a,className:DN,children:(0,y.jsx)(Dy,{})}),(0,y.jsx)(CN,{role:`slider`,tabIndex:0,"aria-label":i,"aria-valuemin":t,"aria-valuemax":n,"aria-valuenow":e,"aria-valuetext":s(e),"aria-orientation":`horizontal`,title:`Drag or use arrow keys to adjust`,className:ON,...l,onPointerCancel:l.onPointerUp,children:s(e)}),(0,y.jsx)(PS,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e+r),disabled:e>=n,"aria-label":o,className:DN,children:(0,y.jsx)(ky,{})})]})},AN=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,jN=`text-xs font-normal text-muted-foreground`,MN=e=>e.toFixed(1),NN=({fontId:e,fontItems:t,isFontSelectOpen:n,onFontChange:r,onFontPreview:i,onFontSelectOpenChange:a,onOpenLocalFontPicker:o,fontSize:s,onFontSizeChange:c,lineHeight:l,onLineHeightChange:u})=>(0,y.jsxs)(ZA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(QA,{className:AN,children:`Font`}),(0,y.jsx)(gN,{value:e,items:t,ariaLabel:`select font`,placeholder:`Font`,open:n,onValueChange:r,onOpenChange:a,onItemHover:i,footerSlot:(0,y.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs text-muted-foreground outline-none transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:bg-foreground/10 focus-visible:text-foreground`,onClick:o,children:[(0,y.jsx)(Oy,{className:`size-3`}),(0,y.jsx)(`span`,{children:`Local font…`})]})}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:jN,children:`Size`}),(0,y.jsx)(kN,{value:s,min:9,max:24,step:1,ariaLabel:`terminal font size`,decrementAriaLabel:`decrease font size`,incrementAriaLabel:`increase font size`,onValueChange:c})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:jN,children:`Line height`}),(0,y.jsx)(kN,{value:l,min:1,max:2,step:ad,ariaLabel:`terminal line height`,decrementAriaLabel:`decrease line height`,incrementAriaLabel:`increase line height`,formatDisplay:MN,onValueChange:u})]})]}),PN=b.createContext(void 0);function FN(){let e=b.useContext(PN);if(e===void 0)throw Error(iS(63));return e}var IN=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.readonly=`data-readonly`,e.required=`data-required`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),LN={...zS,checked(e){return e?{[IN.checked]:``}:{[IN.unchecked]:``}}},RN=b.forwardRef(function(e,t){let{checked:n,className:r,defaultChecked:i,"aria-labelledby":a,form:o,id:s,inputRef:c,name:l,nativeButton:u=!1,onCheckedChange:d,readOnly:f=!1,required:p=!1,disabled:m=!1,render:h,uncheckedValue:g,value:_,style:v,...x}=e,{clearErrors:S}=US(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,shouldValidateOnChange:k,validationMode:A,disabled:j,name:M,validation:N}=VS(),{labelId:P}=XS(),F=j||m,I=M??l,L=Z(d),ee=b.useRef(null),R=dS(ee,c,N.inputRef),te=b.useRef(null),z=JS(),B=eC({id:s,implicit:!1,controlRef:te}),V=u?void 0:B,[ne,re]=fT({controlled:n,default:!!i,name:`Switch`,state:`checked`});pT(te,{id:z,value:ne}),Q(()=>{ee.current&&D(ee.current.checked)},[ee,D]),Tk(ne,()=>{S(I),T(ne!==E.initialValue),D(ne),k()?N.commit(ne):N.commit(ne,!0)});let{getButtonProps:H,buttonRef:ie}=cS({disabled:F,native:u}),ae=ZS(a,P,ee,!u,V),oe={id:u?B:z,role:`switch`,"aria-checked":ne,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":ae,onFocus(){F||O(!0)},onBlur(){let e=ee.current;!e||F||(w(!0),O(!1),A===`onBlur`&&N.commit(e.checked))},onClick(e){f||F||(e.preventDefault(),ee.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},se=b.useMemo(()=>Ux({checked:ne,disabled:F,form:o,id:V,name:I,required:p,style:I?lE:cE,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:R,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=OT(mT,e.nativeEvent);L?.(t,n),!n.isCanceled&&re(t)},onFocus(){te.current?.focus()}},N.getInputValidationProps,_===void 0?SS:{value:_}),[ne,F,o,R,V,I,L,f,p,re,N,_]),ce=b.useMemo(()=>({...C,checked:ne,disabled:F,readOnly:f,required:p}),[C,ne,F,f,p]),le=ES(`span`,e,{state:ce,ref:[t,te,ie],props:[oe,N.getValidationProps,x,H],stateAttributesMapping:LN});return(0,y.jsxs)(PN.Provider,{value:ce,children:[le,!ne&&I&&g!==void 0&&(0,y.jsx)(`input`,{type:`hidden`,form:o,name:I,value:g}),(0,y.jsx)(`input`,{...se,suppressHydrationWarning:!0})]})}),zN=b.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=VS(),s=FN();return ES(`span`,e,{state:{...o,...s},ref:t,stateAttributesMapping:LN,props:a})});function BN({className:e,size:t=`default`,...n}){return(0,y.jsx)(RN,{"data-slot":`switch`,"data-size":t,className:cx(`peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50`,e),...n,children:(0,y.jsx)(zN,{"data-slot":`switch-thumb`,className:`pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%_-_2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%_-_2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground`})})}var VN=[{id:`block`,name:`Block`},{id:`bar`,name:`Bar`},{id:`underline`,name:`Underline`}],HN=`block`,UN=VN.map(e=>e.id),WN=e=>typeof e==`string`&&UN.includes(e),GN=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,KN=`text-xs font-normal text-muted-foreground`,qN=VN.map(e=>({id:e.id,label:e.name})),JN=({cursorStyle:e,onCursorStyleChange:t,onCursorStyleSelectOpenChange:n,onCursorStyleHover:r,cursorBlink:i,onCursorBlinkChange:a})=>(0,y.jsxs)(ZA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(QA,{className:GN,children:`Cursor`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:KN,children:`Style`}),(0,y.jsx)(gN,{value:e,items:qN,ariaLabel:`select cursor style`,placeholder:`Cursor style`,triggerClassName:`w-fit min-w-[7rem]`,onValueChange:t,onOpenChange:n,onItemHover:r})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:KN,children:`Blink`}),(0,y.jsx)(BN,{"aria-label":`toggle cursor blink`,checked:i,onCheckedChange:a})]})]}),YN=[{value:1e3,label:`1k lines`},{value:1e4,label:`10k lines`},{value:5e4,label:`50k lines`},{value:1e5,label:`100k lines`}],XN=1e4,ZN=YN.map(e=>e.value),QN=e=>ZN.includes(e),$N=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,eP=`text-xs font-normal text-muted-foreground`,tP=YN.map(e=>({id:String(e.value),label:e.label})),nP=({scrollback:e,onScrollbackChange:t,scrollOnUserInput:n,onScrollOnUserInputChange:r})=>(0,y.jsxs)(ZA,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(QA,{className:$N,children:`Scrollback`}),(0,y.jsx)(gN,{value:String(e),items:tP,ariaLabel:`select scrollback`,placeholder:`Scrollback`,onValueChange:t}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(Fj,{children:[(0,y.jsx)(Ij,{render:(0,y.jsx)(`span`,{className:eP}),children:`Pin to bottom on input`}),(0,y.jsx)(Lj,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, typing scrolls the viewport back to the bottom. When off, the viewport stays where you scrolled — useful for reading history while typing.`})]}),(0,y.jsx)(BN,{"aria-label":`toggle pin to bottom on input`,checked:n,onCheckedChange:r})]})]});function rP(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=fT({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=dT(o,!0,!0),[d,f]=b.useState(o),[{height:p,width:m},h]=b.useState({height:void 0,width:void 0}),g=JS(),[_,v]=b.useState(),y=_??g,[x,S]=b.useState(!1),[C,w]=b.useState(!1),T=b.useRef(null),E=b.useRef(null),D=b.useRef(null),O=b.useRef(null),k=lT(O,!1),A=Z(e=>{let t=!o,n=OT(hT,e.nativeEvent);if(r(t,n),n.isCanceled)return;let i=O.current;E.current===`css-animation`&&i!=null&&i.style.removeProperty(`animation-name`),!x&&!C&&(E.current!=null&&E.current!==`css-animation`&&!c&&t&&l(!0),E.current===`css-animation`&&(!d&&t&&f(!0),!c&&t&&l(!0))),s(t),E.current===`none`&&c&&!t&&l(!1)});return Q(()=>{a&&E.current===`none`&&!o&&l(!1)},[a,o,t,l]),b.useMemo(()=>({abortControllerRef:T,animationTypeRef:E,disabled:i,handleTrigger:A,height:p,mounted:c,open:o,panelId:y,panelRef:O,runOnceAnimationsFinish:k,setDimensions:h,setHiddenUntilFound:S,setKeepMounted:w,setMounted:l,setOpen:s,setPanelIdState:v,setVisible:f,transitionDimensionRef:D,transitionStatus:u,visible:d,width:m}),[T,E,i,A,p,c,o,y,O,k,h,S,w,l,s,f,D,u,d,m])}var iP=b.createContext(void 0);function aP(){let e=b.useContext(iP);if(e===void 0)throw Error(iS(15));return e}var oP=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=iT.startingStyle]=`startingStyle`,e[e.endingStyle=iT.endingStyle]=`endingStyle`,e}({}),sP=function(e){return e.panelOpen=`data-panel-open`,e}({}),cP={[oP.open]:``},lP={[oP.closed]:``},uP={open(e){return e?{[sP.panelOpen]:``}:null}},dP={open(e){return e?cP:lP},...sT},fP=b.forwardRef(function(e,t){let{render:n,className:r,defaultOpen:i=!1,disabled:a=!1,onOpenChange:o,open:s,style:c,...l}=e,u=Z(o),d=rP({open:s,defaultOpen:i,onOpenChange:u,disabled:a}),f=b.useMemo(()=>({open:d.open,disabled:d.disabled,transitionStatus:d.transitionStatus}),[d.open,d.disabled,d.transitionStatus]),p=b.useMemo(()=>({...d,onOpenChange:u,state:f}),[d,u,f]),m=ES(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:dP});return(0,y.jsx)(iP.Provider,{value:p,children:m})}),pP={...uP,...sT},mP=b.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=aP(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=cS({disabled:c,focusableWhenDisabled:!0,native:d}),g=b.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return ES(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:pP})}),hP=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function gP(e){let{abortControllerRef:t,animationTypeRef:n,externalRef:r,height:i,hiddenUntilFound:a,keepMounted:o,id:s,mounted:c,onOpenChange:l,open:u,panelRef:d,runOnceAnimationsFinish:f,setDimensions:p,setMounted:m,setOpen:h,setVisible:g,transitionDimensionRef:_,visible:v,width:y}=e,x=b.useRef(!1),S=b.useRef(null),C=b.useRef(u),w=b.useRef(u),T=nT(),E=b.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=dS(r,d,Z(e=>{if(!e)return;if(n.current==null||_.current==null){let t=getComputedStyle(e),r=t.animationName!==`none`&&t.animationName!==``,i=t.transitionDuration!==`0s`&&t.transitionDuration!==``;r&&i||(t.animationName===`none`&&t.transitionDuration!==`0s`?n.current=`css-transition`:t.animationName!==`none`&&t.transitionDuration===`0s`?n.current=`css-animation`:n.current=`none`),e.getAttribute(hP.orientation)===`horizontal`||t.transitionProperty.indexOf(`width`)>-1?_.current=`width`:_.current=`height`}if(n.current!==`css-transition`)return;(i===void 0||y===void 0)&&(p({height:e.scrollHeight,width:e.scrollWidth}),w.current&&e.style.setProperty(`transition-duration`,`0s`));let t=-1,r=-1;return t=tT.request(()=>{w.current=!1,r=tT.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{tT.cancel(t),tT.cancel(r)}}));return Q(()=>{if(n.current!==`css-transition`)return;let e=d.current;if(!e)return;let r=-1;if(t.current!=null&&(t.current.abort(),t.current=null),u){let t={"justify-content":e.style.justifyContent,"align-items":e.style.alignItems,"align-content":e.style.alignContent,"justify-items":e.style.justifyItems};Object.keys(t).forEach(t=>{e.style.setProperty(t,`initial`,`important`)}),!w.current&&!o&&e.setAttribute(oP.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=tT.request(()=>{Object.entries(t).forEach(([t,n])=>{n===``?e.style.removeProperty(t):e.style.setProperty(t,n)})})}else{if(e.scrollHeight===0&&e.scrollWidth===0)return;p({height:e.scrollHeight,width:e.scrollWidth});let n=new AbortController;t.current=n;let r=n.signal,i=null,a=oP.endingStyle;return i=new MutationObserver(o=>{o.some(e=>e.type===`attributes`&&e.attributeName===a)&&(i?.disconnect(),i=null,f(()=>{p({height:0,width:0}),e.style.removeProperty(`content-visibility`),m(!1),t.current===n&&(t.current=null)},r))}),i.observe(e,{attributes:!0,attributeFilter:[a]}),()=>{i?.disconnect(),T.cancel(),t.current===n&&(n.abort(),t.current=null)}}return()=>{tT.cancel(r)}},[t,n,T,a,o,c,u,d,f,p,m]),Q(()=>{if(n.current!==`css-animation`)return;let e=d.current;e&&(S.current=e.style.animationName||S.current,e.style.setProperty(`animation-name`,`none`),p({height:e.scrollHeight,width:e.scrollWidth}),!C.current&&!x.current&&e.style.removeProperty(`animation-name`),u?(t.current!=null&&(t.current.abort(),t.current=null),m(!0),g(!0)):(t.current=new AbortController,f(()=>{m(!1),g(!1),t.current=null},t.current.signal)))},[t,n,u,d,f,p,m,g,v]),Yw(()=>{let e=tT.request(()=>{C.current=!1});return()=>tT.cancel(e)}),Q(()=>{if(!a)return;let e=d.current;if(!e)return;let t=-1,n=-1;return u&&x.current&&(e.style.transitionDuration=`0s`,p({height:e.scrollHeight,width:e.scrollWidth}),t=tT.request(()=>{x.current=!1,n=tT.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{tT.cancel(t),tT.cancel(n)}},[a,u,d,p]),Q(()=>{let e=d.current;e&&a&&E&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(oP.startingStyle,``))},[a,E,n,d]),b.useEffect(function(){let e=d.current;if(!e)return;function t(e){x.current=!0,h(!0),l(!0,OT(mT,e))}return VT(e,`beforematch`,t)},[l,d,h]),b.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var _P=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),vP=b.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{abortControllerRef:l,animationTypeRef:u,height:d,mounted:f,onOpenChange:p,open:m,panelId:h,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setHiddenUntilFound:y,setKeepMounted:x,setMounted:S,setPanelIdState:C,setOpen:w,setVisible:T,state:E,transitionDimensionRef:D,visible:O,width:k,transitionStatus:A}=aP(),j=r??!1,M=i??!1;Q(()=>{if(o)return C(o),()=>{C(void 0)}},[o,C]),Q(()=>{y(j)},[y,j]),Q(()=>{x(M)},[x,M]);let{props:N}=gP({abortControllerRef:l,animationTypeRef:u,externalRef:t,height:d,hiddenUntilFound:j,id:h,keepMounted:M,mounted:f,onOpenChange:p,open:m,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setMounted:S,setOpen:w,setVisible:T,transitionDimensionRef:D,visible:O,width:k});uT({open:m&&A===`idle`,ref:g,onComplete(){m&&v({height:void 0,width:void 0})}});let P=ES(`div`,e,{state:b.useMemo(()=>({...E,transitionStatus:A}),[E,A]),ref:[t,g],props:[N,{style:{[_P.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[_P.collapsiblePanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:dP});return M||j||f?P:null});function yP({...e}){return(0,y.jsx)(fP,{"data-slot":`collapsible`,...e})}function bP({...e}){return(0,y.jsx)(mP,{"data-slot":`collapsible-trigger`,...e})}function xP({...e}){return(0,y.jsx)(vP,{"data-slot":`collapsible-content`,...e})}var SP=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,CP=`text-xs font-normal text-muted-foreground`,wP=({label:e,value:t,title:n,valueClassName:r})=>(0,y.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,y.jsx)(`dt`,{className:CP,children:e}),(0,y.jsx)(`dd`,{title:n??t,className:cx(`min-w-0 truncate text-right text-foreground/90`,r),children:t})]}),TP=({sessionInfo:e})=>e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(JA,{className:`bg-border/40`}),(0,y.jsxs)(yP,{defaultOpen:!1,children:[(0,y.jsx)(bP,{render:(0,y.jsxs)(`button`,{type:`button`,className:`group/shell flex w-full items-center justify-between gap-2 rounded-sm py-1 text-left transition-colors outline-none hover:text-foreground/90 focus-visible:text-foreground/90`,children:[(0,y.jsx)(`span`,{className:SP,children:`Shell`}),(0,y.jsx)(Cy,{className:`size-3 text-muted-foreground/60 transition-transform duration-200 ease-snappy will-change-transform group-aria-expanded/shell:rotate-180`})]})}),(0,y.jsx)(xP,{className:`h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-snappy data-closed:h-0`,children:(0,y.jsxs)(`dl`,{className:`flex flex-col gap-1 pt-2 text-xs`,children:[(0,y.jsx)(wP,{label:`Name`,value:e.shellName}),(0,y.jsx)(wP,{label:`Path`,value:e.shell,title:e.shell}),(0,y.jsx)(wP,{label:`PID`,value:String(e.pid),valueClassName:`tabular-nums`}),(0,y.jsx)(wP,{label:`Cwd`,value:e.cwd,title:e.cwd})]})})]})]}):null,EP=Ly(`group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!`,{variants:{variant:{default:`bg-primary text-primary-foreground [a]:hover:bg-primary/80`,secondary:`bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80`,destructive:`bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20`,outline:`border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground`,ghost:`hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50`,link:`text-primary underline-offset-4 hover:underline`}},defaultVariants:{variant:`default`}});function DP({className:e,variant:t=`default`,render:n,...r}){return bN({defaultTagName:`span`,props:Ux({className:cx(EP({variant:t}),e)},r),render:n,state:{slot:`badge`,variant:t}})}var OP=Object.fromEntries(Ad.map(e=>[e.id,{fontFamily:e.family}])),kP=Ad.map(e=>({id:e.id,label:e.name,itemStyle:OP[e.id]})),AP=e=>({id:md,label:(0,y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,y.jsx)(`span`,{className:`truncate`,children:e}),(0,y.jsx)(DP,{variant:`secondary`,className:`h-4 px-1.5 text-[10px] font-medium`,children:`Local`})]}),itemStyle:{fontFamily:`"${wd(e)}", ui-monospace, monospace`}}),jP=({onThemeChange:e,onThemePreview:t,fontId:n,onFontChange:r,onFontPreview:i,localFontFamily:a,onCursorStyleChange:o,onCursorStylePreview:s,onScrollbackChange:c})=>{let[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(!1);return{isDialogOpen:l,isFontSelectOpen:d,isLocalFontPickerOpen:p,setIsLocalFontPickerOpen:m,fontItems:(0,b.useMemo)(()=>n!==`local`||!a?kP:[...kP,AP(a)],[n,a]),handleDialogOpenChange:e=>{u(e),e||(f(!1),m(!1),t?.(null),i?.(null),s?.(null))},openLocalFontPicker:()=>{f(!1),m(!0)},handleThemeChange:t=>{t&&e(t)},handleFontChange:e=>{e&&r(e)},handleCursorStyleChange:e=>{WN(e)&&o(e)},handleScrollbackChange:e=>{if(e===null)return;let t=Number(e);QN(t)&&c(t)},handleThemeSelectOpenChange:e=>{e||t?.(null)},handleFontSelectOpenChange:e=>{f(e),e||i?.(null)},handleCursorStyleSelectOpenChange:e=>{e||s?.(null)},handleCursorStyleHover:e=>{WN(e)&&s?.(e)}}},MP=e=>{let{isDialogOpen:t,isFontSelectOpen:n,isLocalFontPickerOpen:r,setIsLocalFontPickerOpen:i,fontItems:a,handleDialogOpenChange:o,openLocalFontPicker:s,handleThemeChange:c,handleFontChange:l,handleCursorStyleChange:u,handleScrollbackChange:d,handleThemeSelectOpenChange:f,handleFontSelectOpenChange:p,handleCursorStyleSelectOpenChange:m,handleCursorStyleHover:h}=jP(e),{themeId:g,onThemePreview:_,fontId:v,onFontPreview:b,localFontFamily:x,onLocalFontChange:S,fontSize:C,onFontSizeChange:w,lineHeight:T,onLineHeightChange:E,cursorStyle:D,onCursorStylePreview:O,cursorBlink:k,onCursorBlinkChange:A,scrollback:j,scrollOnUserInput:M,onScrollOnUserInputChange:N,sessionInfo:P}=e;return(0,y.jsxs)(DA,{open:t,onOpenChange:o,children:[(0,y.jsxs)(Fj,{children:[(0,y.jsx)(Ij,{render:(0,y.jsx)(OA,{render:(0,y.jsx)(PS,{variant:`ghost`,size:`icon-sm`,"aria-label":`terminal settings`,className:`hover:text-foreground`})}),children:(0,y.jsx)(jy,{})}),t?null:(0,y.jsx)(Lj,{side:`bottom`,sideOffset:8,children:`Settings`})]}),(0,y.jsxs)(jA,{className:cx(`max-h-[calc(100dvh-2rem)] gap-0 overflow-y-auto p-4 sm:max-w-md`,PA),children:[(0,y.jsx)(MA,{className:`mb-4 pr-8`,children:(0,y.jsx)(NA,{children:`Settings`})}),(0,y.jsxs)(YA,{className:`gap-3`,children:[(0,y.jsx)(yN,{themeId:g,onThemeChange:c,onThemePreview:_,onOpenChange:f}),(0,y.jsx)(JA,{className:`bg-border/40`}),(0,y.jsx)(NN,{fontId:v,fontItems:a,isFontSelectOpen:n,onFontChange:l,onFontPreview:b,onFontSelectOpenChange:p,onOpenLocalFontPicker:s,fontSize:C,onFontSizeChange:w,lineHeight:T,onLineHeightChange:E}),(0,y.jsx)(JA,{className:`bg-border/40`}),(0,y.jsx)(JN,{cursorStyle:D,onCursorStyleChange:u,onCursorStyleSelectOpenChange:m,onCursorStyleHover:O?h:void 0,cursorBlink:k,onCursorBlinkChange:A}),(0,y.jsx)(JA,{className:`bg-border/40`}),(0,y.jsx)(nP,{scrollback:j,onScrollbackChange:d,scrollOnUserInput:M,onScrollOnUserInputChange:N}),(0,y.jsx)(TP,{sessionInfo:P??null})]})]}),(0,y.jsx)(GA,{open:r,onOpenChange:i,currentFamily:x,onApply:S})]})},NP=({activeThemeId:e,onThemeChange:t,onThemePreview:n,activeFontId:r,onFontChange:i,onFontPreview:a,activeLocalFontFamily:o,onLocalFontChange:s,activeFontSize:c,onFontSizeChange:l,activeLineHeight:u,onLineHeightChange:d,activeCursorStyle:f,onCursorStyleChange:p,onCursorStylePreview:m,activeCursorBlink:h,onCursorBlinkChange:g,activeScrollback:_,onScrollbackChange:v,activeScrollOnUserInput:b,onScrollOnUserInputChange:x,sessionInfo:S,newTabUrl:C,onOpenSearch:w,isMac:T,isSearchOpen:E})=>E?null:(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,"data-terminal-toolbar":!0,className:`absolute top-2 right-3 z-10 flex items-center gap-0.5 rounded-md border border-border/60 bg-background/70 p-0.5 text-muted-foreground shadow-xs backdrop-blur-md`,children:[(0,y.jsx)(MP,{themeId:e,onThemeChange:t,onThemePreview:n,fontId:r,onFontChange:i,onFontPreview:a,localFontFamily:o,onLocalFontChange:s,fontSize:c,onFontSizeChange:l,lineHeight:u,onLineHeightChange:d,cursorStyle:f,onCursorStyleChange:p,onCursorStylePreview:m,cursorBlink:h,onCursorBlinkChange:g,scrollback:_,onScrollbackChange:v,scrollOnUserInput:b,onScrollOnUserInputChange:x,sessionInfo:S}),(0,y.jsxs)(Fj,{children:[(0,y.jsx)(Ij,{render:(0,y.jsx)(PS,{variant:`ghost`,size:`icon-sm`,onClick:w,"aria-label":`find in terminal`,className:`hover:text-foreground`}),children:(0,y.jsx)(Ay,{})}),(0,y.jsxs)(Lj,{side:`bottom`,sideOffset:8,children:[`Find `,T?`(⌘F)`:`(Ctrl+F)`]})]}),(0,y.jsxs)(Fj,{children:[(0,y.jsx)(Ij,{render:(0,y.jsx)(PS,{variant:`ghost`,size:`icon-sm`,nativeButton:!1,"aria-label":`open a new shell in a new browser tab`,render:(0,y.jsx)(`a`,{href:C,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`}),children:(0,y.jsx)(ky,{})}),(0,y.jsx)(Lj,{side:`bottom`,sideOffset:8,children:`New shell (new tab)`})]})]}),PP=({exitInfo:e})=>e?(0,y.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10 inline-flex items-center rounded-md border border-red-500/30 bg-red-500/10 px-2 py-0.5 text-xs font-medium text-red-400`,children:e.reason===`shell-exited`?e.exitCode===null?`exited`:`exited · code ${e.exitCode}`:`disconnected · code ${e.closeCode}`}):null,FP=(e,t)=>{let n=null,r=()=>{n=null,e.style.height=`${t.height}px`,e.style.transform=t.offsetTop?`translateY(${t.offsetTop}px)`:``},i=()=>{n===null&&(n=window.requestAnimationFrame(r))};return i(),t.addEventListener(`resize`,i),t.addEventListener(`scroll`,i),()=>{n!==null&&window.cancelAnimationFrame(n),t.removeEventListener(`resize`,i),t.removeEventListener(`scroll`,i),e.style.height=``,e.style.transform=``}},IP=(e,t,n)=>{(0,b.useEffect)(()=>{if(!t||!n)return;let r=e.current,i=window.visualViewport;if(!(!r||!i))return FP(r,i)},[t,n,e])},LP=e=>{(0,b.useEffect)(()=>{if(!e)return;let t=new URL(window.location.href);t.searchParams.set(`cwd`,e),window.history.replaceState(null,``,t)},[e])},RP=(e,t)=>{(0,b.useEffect)(()=>{t?.(e)},[e,t])},zP=()=>typeof navigator<`u`&&navigator.vendor===`Apple Computer, Inc.`,BP=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},VP=()=>typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(pointer: coarse)`).matches,HP=()=>({isMac:(0,b.useMemo)(BP,[]),isTouchDevice:(0,b.useMemo)(VP,[]),isAppleWebKit:(0,b.useMemo)(zP,[])}),UP=(e,t,n)=>{(0,b.useEffect)(()=>{if(!e)return;let r=window.setInterval(()=>{t()},n);return()=>window.clearInterval(r)},[e,t,n])},WP=(e,t,n)=>{let[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(0),[s,c]=(0,b.useState)(``),[l,u]=(0,b.useState)({resultIndex:-1,resultCount:0}),d=(0,b.useRef)(null),f=(0,b.useCallback)(t=>{if(!t){e.current?.clearDecorations(),u({resultIndex:-1,resultCount:0});return}e.current?.findNext(t)},[e]),p=(0,b.useCallback)(t=>{t&&e.current?.findPrevious(t)},[e]),m=(0,b.useCallback)(()=>{i(!1),c(``),u({resultIndex:-1,resultCount:0}),e.current?.clearDecorations(),t.current?.()},[e,t]),h=(0,b.useCallback)(()=>{i(!0),o(e=>e+1)},[]);return d.current=h,{isSearchOpen:r,setIsSearchOpen:i,searchOpenAttempt:a,searchQuery:s,searchResults:l,setSearchResults:u,openSearchOverlayRef:d,openSearchOverlay:h,handleSearchInputChange:(0,b.useCallback)(e=>{let t=e.target.value;c(t),f(t)},[f]),handleSearchKeyDown:(0,b.useCallback)(e=>{if(ry(e.nativeEvent,n)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),m();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?p(s):f(s))},[m,f,p,n,s]),handleSearchClose:m,findNextMatch:f,findPreviousMatch:p}},GP=(e,t,n)=>{(0,b.useEffect)(()=>{if(!e)return;let t=n.current;t&&(t.focus(),t.select())},[e,t,n])},KP=async e=>{if(!(typeof document>`u`)&&e.name)try{await Promise.all([document.fonts.load(`16px "${e.name}"`),document.fonts.load(`bold 16px "${e.name}"`)])}catch{}},qP=(e,t,n,r)=>{n?.clearTextureAtlas(),e.options.fontFamily=``,e.options.fontFamily=r,uy(e,t),n?.clearTextureAtlas()},JP=(e,t,n,r)=>{(0,b.useEffect)(()=>{if(!e.current)return;let i=!1;return KP(r).then(()=>{if(i)return;let a=e.current;if(!a)return;let o=t.current;o&&qP(a,o,n.current,r.family)}),()=>{i=!0}},[r,e,t,n])},YP=(e,t,n,r)=>{(0,b.useEffect)(()=>{let i=e.current;if(!i)return;i.options.fontSize=n,i.options.lineHeight=r;let a=t.current;a&&uy(i,a)},[n,r,e,t])},XP=(e,t,n,r,i,a)=>{(0,b.useEffect)(()=>{let o=e.current;o&&(o.options.theme=t.colors,o.options.cursorStyle=n,o.options.cursorBlink=r,o.options.scrollback=i,o.options.scrollOnUserInput=a)},[t,n,r,i,a,e])},ZP=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},QP=1/ad,$P=e=>Math.round(e*QP)/QP,eF=e=>{if(!Number.isFinite(e))return id;let t=$P(e);return t<1?1:t>2?2:t},tF=(e,t,n)=>({load:()=>{if(typeof window>`u`)return t;try{let r=window.localStorage.getItem(e);return r===null||r===``?t:n?n(r):r}catch{return t}},store:t=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,String(t))}catch{}}}),nF=tF(pd,null,e=>e.trim()||null),rF=()=>nF.load(),iF=e=>nF.store(e),aF=tF(dd,Id,e=>Ld(e).id),oF=()=>aF.load(),sF=e=>aF.store(e),cF=tF(fd,jd,e=>e===`local`?nF.load()?md:jd:Md(e).id),lF=()=>cF.load(),uF=e=>cF.store(e),dF=tF(hd,13,e=>ZP(Number(e))),fF=()=>dF.load(),pF=e=>dF.store(e),mF=tF(gd,id,e=>eF(Number(e))),hF=()=>mF.load(),gF=e=>mF.store(e),_F=tF(_d,HN,e=>WN(e)?e:HN),vF=()=>_F.load(),yF=e=>_F.store(e),bF=tF(vd,!0,e=>e===`true`?!0:e!==`false`),xF=()=>bF.load(),SF=e=>bF.store(e),CF=tF(yd,XN,e=>{let t=Number(e);return QN(t)?t:XN}),wF=()=>CF.load(),TF=e=>CF.store(e),EF=tF(bd,!0,e=>e===`true`?!0:e!==`false`),DF=()=>EF.load(),OF=e=>EF.store(e),kF=(e,t,n)=>{let r=(0,b.useRef)(oF()),i=(0,b.useRef)(lF()),a=(0,b.useRef)(rF()),o=(0,b.useRef)(fF()),s=(0,b.useRef)(hF()),c=(0,b.useRef)(vF()),l=(0,b.useRef)(xF()),u=(0,b.useRef)(wF()),d=(0,b.useRef)(DF()),[f,p]=(0,b.useState)(r.current),[m,h]=(0,b.useState)(null),[g,_]=(0,b.useState)(i.current),[v,y]=(0,b.useState)(a.current),[x,S]=(0,b.useState)(null),[C,w]=(0,b.useState)(o.current),[T,E]=(0,b.useState)(s.current),[D,O]=(0,b.useState)(c.current),[k,A]=(0,b.useState)(null),[j,M]=(0,b.useState)(l.current),[N,P]=(0,b.useState)(u.current),[F,I]=(0,b.useState)(d.current),L=m??f,ee=(0,b.useMemo)(()=>Ld(L),[L]),R=x??g;return{initialThemeIdRef:r,initialFontIdRef:i,initialLocalFontFamilyRef:a,initialFontSizeRef:o,initialLineHeightRef:s,initialCursorStyleRef:c,initialCursorBlinkRef:l,initialScrollbackRef:u,initialScrollOnUserInputRef:d,activeThemeId:f,setActiveThemeId:p,previewThemeId:m,setPreviewThemeId:h,activeFontId:g,setActiveFontId:_,activeLocalFontFamily:v,setActiveLocalFontFamily:y,previewFontId:x,setPreviewFontId:S,activeFontSize:C,setActiveFontSize:w,activeLineHeight:T,setActiveLineHeight:E,activeCursorStyle:D,setActiveCursorStyle:O,previewCursorStyle:k,setPreviewCursorStyle:A,activeCursorBlink:j,setActiveCursorBlink:M,activeScrollback:N,setActiveScrollback:P,activeScrollOnUserInput:F,setActiveScrollOnUserInput:I,effectiveTheme:ee,effectiveFont:(0,b.useMemo)(()=>Md(R,v),[R,v]),newTabUrl:(0,b.useMemo)(()=>Qv(n),[n]),handleThemeChange:(0,b.useCallback)(e=>{p(e),h(null),sF(e)},[]),handlePreviewTheme:(0,b.useCallback)(e=>{h(e)},[]),handleFontChange:(0,b.useCallback)(e=>{_(e),S(null),uF(e)},[]),handlePreviewFont:(0,b.useCallback)(e=>{S(e)},[]),handleLocalFontChange:(0,b.useCallback)(e=>{y(e),_(md),S(null),iF(e),uF(md)},[]),handleFontSizeChange:(0,b.useCallback)(e=>{let t=ZP(e);w(t),pF(t)},[]),handleLineHeightChange:(0,b.useCallback)(e=>{let t=eF(e);E(t),gF(t)},[]),handleCursorStyleChange:(0,b.useCallback)(e=>{O(e),A(null),yF(e)},[]),handlePreviewCursor:(0,b.useCallback)(e=>{A(e)},[]),handleCursorBlinkChange:(0,b.useCallback)(e=>{M(e),SF(e)},[]),handleScrollbackChange:(0,b.useCallback)(e=>{P(e),TF(e)},[]),handleScrollOnUserInputChange:(0,b.useCallback)(e=>{I(e),OF(e)},[])}},AF=(e,t,n)=>{(0,b.useEffect)(()=>{let r=e.current;if(!r)return;let i=0,a=0,o=!1,s=new AbortController,c=()=>{r.textarea&&(r.textarea.inputMode=``),r.focus()},l=()=>{t&&r.textarea&&(r.textarea.inputMode=`none`),r.focus()};if(n.current=l,t){let e=s.signal,t=()=>{r.textarea&&(r.textarea.inputMode=`none`)},n=()=>{r.textarea&&(r.textarea.blur(),r.textarea.inputMode=`none`)};t(),r.textarea?.addEventListener(`blur`,t,{signal:e});let l=window.visualViewport;if(l){let t=l.height,r=l.width;l.addEventListener(`resize`,()=>{let e=l.height,i=l.width,a=e>t+150,o=Math.abs(i-r)<20;a&&o&&n(),t=e,r=i},{signal:e})}r.element?.addEventListener(`touchstart`,e=>{if(e.touches.length!==1){o=!0;return}i=e.touches[0].clientX,a=e.touches[0].clientY,o=!1},{capture:!0,passive:!0,signal:e}),r.element?.addEventListener(`touchmove`,e=>{if(e.touches.length!==1){o=!0;return}Math.hypot(e.touches[0].clientX-i,e.touches[0].clientY-a)>10&&(o=!0)},{capture:!0,passive:!0,signal:e}),r.element?.addEventListener(`touchend`,e=>{if(o){e.preventDefault();return}c()},{capture:!0,passive:!1,signal:e})}return l(),()=>{s.abort(),n.current=null}},[e,t,n])},jF=(e,t)=>{(0,b.useEffect)(()=>()=>{e.current!==null&&(window.clearTimeout(e.current),e.current=null),t.current!==null&&(window.clearTimeout(t.current),t.current=null)},[e,t])},MF=(e,t)=>`\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,NF=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,PF=({terminalRef:e,flowControllerRef:t,exitedRef:n,lastTitleRef:r,resetFaviconRef:i,noteOutputActivityRef:a,liveCwdRef:o,isReconnectingRef:s,retryFeedbackTimerRef:c,copyFeedbackTimerRef:l,setExitInfo:u,setSessionInfo:d,setConsecutiveFailures:f,setHasCopiedRestartCommand:p,setIsRetryingConnection:m,setLiveCwd:h})=>{let g=(0,b.useRef)(null),_=(0,b.useRef)(null),v=(0,b.useRef)(null),y=(0,b.useCallback)(e=>{g.current?.readyState===WebSocket.OPEN&&g.current.send(JSON.stringify(e))},[]);return(0,b.useEffect)(()=>{let c=!1,l=!1,p=null,m=()=>{if(t.current?.clear(),c)return;let u=new WebSocket(Zv(o.current,_.current));u.binaryType=`arraybuffer`,g.current=u,u.addEventListener(`open`,()=>{c||g.current!==u||(l=!0,f(0),e.current&&y({type:`resize`,cols:e.current.cols,rows:e.current.rows}),s.current=!1)}),u.addEventListener(`message`,e=>{if(c||g.current!==u)return;if(e.data instanceof ArrayBuffer){t.current?.write(new Uint8Array(e.data)),a.current?.();return}if(typeof e.data!=`string`)return;let n;try{n=JSON.parse(e.data)}catch{return}if(typeof n!=`object`||!n||typeof n.type!=`string`)return;let o=n;if(o.type===`output`)t.current?.write(o.data),a.current?.();else if(o.type===`title`){let e=o.title.trim();if(!e)return;r.current=e,document.title=e}else o.type===`session`?(_.current=o.id,d({id:o.id,shell:o.shell,shellName:o.shellName,pid:o.pid,cwd:o.cwd}),h(o.cwd)):o.type===`cwd`?h(o.cwd):o.type===`exit`&&(i.current?.(),b(o.code))}),u.addEventListener(`close`,e=>{if(g.current===u&&(g.current=null,s.current=!1,!c&&!n.current)){if(l){console.warn(`[localterm] websocket closed: code=${e.code} reason=${JSON.stringify(e.reason)} wasClean=${e.wasClean}`),x(e.code,e.reason,e.wasClean);return}f(e=>e+1),p=window.setTimeout(m,nd)}}),u.addEventListener(`error`,()=>{console.warn(`[localterm] websocket error`);try{u.close()}catch{}})},b=t=>{n.current||(n.current=!0,i.current?.(),sf(`dead`),e.current?.write(NF(t)),document.title=`† ${r.current||`localterm`}`,u({reason:`shell-exited`,exitCode:t}),d(null))},x=(t,a,o)=>{n.current||(n.current=!0,i.current?.(),sf(`dead`),e.current?.write(MF(t,a)),document.title=`† ${r.current||`localterm`}`,u({reason:`connection-lost`,closeCode:t,closeReason:a,wasClean:o}),d(null))};return v.current=()=>{if(!c){n.current=!1,l=!1,u(null),d(null),f(0),sf(`idle`),p!==null&&(window.clearTimeout(p),p=null);try{g.current?.close()}catch{}g.current=null,m()}},m(),()=>{c=!0,v.current=null,p!==null&&window.clearTimeout(p);try{g.current?.close()}catch{}g.current=null}},[]),{send:y,triggerManualReconnect:(0,b.useCallback)(()=>{s.current||(s.current=!0,m(!0),v.current?.(),c.current!==null&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{c.current=null,m(!1)},800))},[]),copyRestartCommand:(0,b.useCallback)(()=>{navigator.clipboard.writeText(od).then(()=>{p(!0),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{l.current=null,p(!1)},sd)}).catch(()=>{})},[])}},FF=({onModalOpenChange:e}={})=>{let t=(0,b.useRef)(null),n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=(0,b.useRef)(null),a=(0,b.useRef)(null),o=(0,b.useRef)(null),s=(0,b.useRef)(null),c=(0,b.useRef)(null),l=(0,b.useRef)(null),u=(0,b.useRef)(!1),d=(0,b.useRef)(null),f=(0,b.useRef)(null),p=(0,b.useRef)(!1),m=(0,b.useRef)(``),h=(0,b.useRef)(null),g=(0,b.useRef)(null),_=(0,b.useRef)(null),[v,x]=(0,b.useState)(null),[C,w]=(0,b.useState)(0),[T,E]=(0,b.useState)(!1),[O,k]=(0,b.useState)(!1),[A,j]=(0,b.useState)(null),[M,N]=(0,b.useState)(null),{initialThemeIdRef:P,initialFontIdRef:F,initialLocalFontFamilyRef:I,initialFontSizeRef:L,initialLineHeightRef:ee,initialCursorStyleRef:R,initialCursorBlinkRef:te,initialScrollbackRef:z,initialScrollOnUserInputRef:B,activeThemeId:V,setActiveThemeId:ne,activeFontId:re,setActiveFontId:H,activeLocalFontFamily:ie,setActiveLocalFontFamily:ae,activeFontSize:oe,setActiveFontSize:se,activeLineHeight:ce,setActiveLineHeight:le,activeCursorStyle:ue,setActiveCursorStyle:de,previewCursorStyle:fe,activeCursorBlink:pe,setActiveCursorBlink:me,activeScrollback:he,setActiveScrollback:ge,activeScrollOnUserInput:_e,setActiveScrollOnUserInput:ve,effectiveTheme:ye,effectiveFont:be,newTabUrl:xe,handleThemeChange:Se,handlePreviewTheme:Ce,handleFontChange:we,handlePreviewFont:Te,handleLocalFontChange:Ee,handleFontSizeChange:De,handleLineHeightChange:Oe,handleCursorStyleChange:ke,handlePreviewCursor:Ae,handleCursorBlinkChange:je,handleScrollbackChange:Me,handleScrollOnUserInputChange:Ne}=kF(r,i,M),{isMac:Pe,isTouchDevice:Fe,isAppleWebKit:Ie}=HP();IP(t,Fe,Ie),AF(r,Fe,d);let{isSearchOpen:Le,searchOpenAttempt:Re,searchQuery:ze,searchResults:Be,setSearchResults:Ve,openSearchOverlay:He,handleSearchInputChange:Ue,handleSearchKeyDown:We,findNextMatch:Ge,findPreviousMatch:Ke,openSearchOverlayRef:qe}=WP(o,d,Pe),Ye=fe??ue,Ze=ye.colors.background??`#101010`,{send:Qe,triggerManualReconnect:$e,copyRestartCommand:et}=PF({terminalRef:r,flowControllerRef:g,exitedRef:p,lastTitleRef:m,resetFaviconRef:h,noteOutputActivityRef:_,liveCwdRef:f,isReconnectingRef:u,retryFeedbackTimerRef:c,copyFeedbackTimerRef:l,setExitInfo:x,setSessionInfo:j,setConsecutiveFailures:w,setHasCopiedRestartCommand:E,setIsRetryingConnection:k,setLiveCwd:N,setActiveThemeId:ne,setActiveFontId:H,setActiveLocalFontFamily:ae,setActiveFontSize:se,setActiveLineHeight:le,setActiveCursorStyle:de,setActiveCursorBlink:me,setActiveScrollback:ge,setActiveScrollOnUserInput:ve,initialThemeIdRef:P,initialFontIdRef:F,initialLocalFontFamilyRef:I,initialFontSizeRef:L,initialLineHeightRef:ee,initialCursorStyleRef:R,initialCursorBlinkRef:te,initialScrollbackRef:z,initialScrollOnUserInputRef:B});(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let t=!1;p.current=!1,m.current=``;let s=null,c=null,l=`idle`;_.current=()=>{c!==null&&(window.clearTimeout(c),c=null),l===`idle`&&s===null&&(s=window.setTimeout(()=>{s=null,!(t||p.current)&&(l=`active`,sf(`active`))},250)),c=window.setTimeout(()=>{c=null,s!==null&&(window.clearTimeout(s),s=null),l===`active`&&(l=`idle`,sf(`idle`))},750)};let u=()=>{s!==null&&(window.clearTimeout(s),s=null),c!==null&&(window.clearTimeout(c),c=null),l===`active`&&(l=`idle`,sf(`idle`))};h.current=u;let f=Md(F.current,I.current),v=new td({allowProposedApi:!0,cursorBlink:te.current,cursorStyle:R.current,fontFamily:f.family,fontSize:L.current,lineHeight:ee.current,scrollback:z.current,theme:Ld(P.current).colors,macOptionIsMeta:!0,scrollOnUserInput:B.current});r.current=v;let y=new D;i.current=y,v.loadAddon(y),v.loadAddon(new Pn),v.loadAddon(new S),v.loadAddon(new Je),v.loadAddon(new Xe),v.loadAddon(new On);let b=new dt;v.loadAddon(b),o.current=b;let x=b.onDidChangeResults(Ve);v.open(e);try{let e=new oa;e.onContextLoss(()=>{a.current===e&&(a.current=null),e.dispose()}),v.loadAddon(e),a.current=e}catch{a.current=null}let C=v.textarea;C&&(C.autocomplete=`off`,C.setAttribute(`autocapitalize`,`off`),C.setAttribute(`autocorrect`,`off`),C.spellcheck=!1);let w=ay(v);v.parser.registerCsiHandler({final:`J`},cf),v.parser.registerCsiHandler({prefix:`?`,final:`J`},cf);let T=dy({terminal:v,fitAddon:y,sendResize:(e,t)=>Qe({type:`resize`,cols:e,rows:t}),resizeDebounceMs:80});g.current=ey({terminalWrite:(e,t)=>v.write(e,t),sendFlowPause:()=>Qe({type:`flow-pause`}),sendFlowResume:()=>Qe({type:`flow-resume`}),captureScrollAnchor:()=>T.captureAnchor(),restoreScrollAnchor:e=>T.restoreAnchor(e),hasScrollRestore:()=>T.hasResizeRestore(),restoreScrollFromResize:()=>T.restoreResizeScroll(),isExited:()=>p.current}),oy(v,{isMac:Pe,getKittyFlags:()=>w.getFlags(),openFindOverlay:()=>qe.current?.(),sendInput:e=>Qe({type:`input`,data:e}),isTouchDevice:Fe}),sy(v);let E=v.onTitleChange(e=>{if(p.current)return;let t=e.trim();t&&(m.current=t,document.title=t||`localterm`)});v.onData(e=>{for(let t of Rd(e,lf))Qe({type:`input`,data:t})}),v.onResize(({cols:e,rows:t})=>Qe({type:`resize`,cols:e,rows:t}));let O=new ResizeObserver(()=>T.scheduleFit());return O.observe(e),T.fitToContainer(),()=>{t=!0,d.current=null,qe.current=null,o.current=null,r.current=null,i.current=null,a.current=null,E.dispose(),x.dispose(),T.cleanupResizeScroll(),u(),O.disconnect(),v.dispose(),document.title=`localterm`}},[]),YP(r,i,oe,ce),XP(r,ye,Ye,pe,he,_e),JP(r,i,a,be),GP(Le,Re,s),jF(c,l),(0,b.useEffect)(()=>{f.current=M},[M]),LP(M);let tt=v!==null,nt=tt||!tt&&C>=2;return UP(v!==null&&v.reason!==`shell-exited`,$e,cd),RP(nt,e),(0,y.jsxs)(`main`,{ref:t,className:`h-dvh w-dvw pt-[env(safe-area-inset-top)] pr-[env(safe-area-inset-right)] pb-[env(safe-area-inset-bottom)] pl-[env(safe-area-inset-left)]`,style:{background:Ze},children:[(0,y.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,y.jsx)(`div`,{ref:n,"aria-label":`terminal session`,className:`absolute inset-0`}),(0,y.jsx)(PP,{exitInfo:v}),(0,y.jsx)(NP,{activeThemeId:V,onThemeChange:Se,onThemePreview:Ce,activeFontId:re,onFontChange:we,onFontPreview:Te,activeLocalFontFamily:ie,onLocalFontChange:Ee,activeFontSize:oe,onFontSizeChange:De,activeLineHeight:ce,onLineHeightChange:Oe,activeCursorStyle:ue,onCursorStyleChange:ke,onCursorStylePreview:Ae,activeCursorBlink:pe,onCursorBlinkChange:je,activeScrollback:he,onScrollbackChange:Me,activeScrollOnUserInput:_e,onScrollOnUserInputChange:Ne,sessionInfo:A,newTabUrl:xe,onOpenSearch:He,isMac:Pe,isSearchOpen:Le}),Le&&(0,y.jsx)(zT,{searchInputRef:s,searchQuery:ze,searchResults:Be,onSearchChange:Ue,onKeyDown:We,onFindNext:()=>Ge(ze),onFindPrevious:()=>Ke(ze),isSearchOpen:Le})]}),(0,y.jsx)(EA,{isModalOpen:nt,exitInfo:v,isRetryingConnection:O,hasCopiedRestartCommand:T,newTabUrl:xe,onReconnect:$e,onCopyRestartCommand:et})]})},IF=()=>{let e=(0,b.useRef)(!1);return(0,b.useEffect)(()=>{let t=t=>{e.current||(t.preventDefault(),t.returnValue=``)};return window.addEventListener(`beforeunload`,t),()=>{window.removeEventListener(`beforeunload`,t)}},[]),(0,y.jsx)(FF,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[])})},LF=null,RF=null,zF=()=>LF||(typeof BroadcastChannel>`u`||typeof crypto>`u`||typeof crypto.randomUUID!=`function`?null:(RF=crypto.randomUUID(),LF=new BroadcastChannel(ud),LF.addEventListener(`message`,e=>{let t=e.data,n=ef();t.type===`ping`&&t.tabId!==RF&&t.hue===n&&LF&&RF&&LF.postMessage({type:`claimed`,tabId:RF,hue:n})}),LF));of(),sf(`idle`),(()=>{let e=zF();if(!e||!RF)return()=>{};let t=ef(),n=new Set,r=e=>{let r=e.data;r.type===`claimed`&&r.tabId!==RF&&r.hue===t&&n.add(r.hue)};e.addEventListener(`message`,r),e.postMessage({type:`ping`,tabId:RF,hue:t});let i=setTimeout(()=>{if(e.removeEventListener(`message`,r),n.size===0)return;let i=tf([...n]);i!==t&&(nf(i),sf(`idle`))},250);return()=>{clearTimeout(i),e.removeEventListener(`message`,r),LF?.close(),LF=null,RF=null}})(),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=Nd();if(!e)return;let t=document.createElement(`link`);t.id=xd,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})(),((e=!1)=>{e||typeof navigator>`u`||!(`serviceWorker`in navigator)||navigator.serviceWorker.register(`/sw.js`,{scope:`/`}).catch(e=>{console.warn(`[localterm] service worker registration failed`,e)})})();var BF=document.getElementById(`root`);if(!BF)throw Error(`Root element not found`);(0,x.createRoot)(BF,{onCaughtError(e,t){console.error(`[localterm] React caught error:`,e,t)},onUncaughtError(e,t){console.error(`[localterm] React uncaught error:`,e,t)},onRecoverableError(e,t){console.error(`[localterm] React recoverable error:`,e,t)}}).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(Pj,{delay:300,children:(0,y.jsx)(IF,{})})}));
121
+ //# sourceMappingURL=index-BvGM-LOc.js.map