@monotykamary/localterm 1.13.0 → 1.13.1

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.
@@ -111,6 +111,6 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
111
111
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=RC,s=!CC.jitless,c=s&&zC.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?aE([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function cE(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=>!tw(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=>iw(e,r,wC())))}),t)}var lE=$(`$ZodUnion`,(e,t)=>{xT.init(e,t),MC(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),MC(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),MC(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),MC(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=>kC(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=>cE(t,i,e,a)):cE(s,i,e,a)}}),uE=$(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,lE.init(e,t);let n=e._zod.parse;MC(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=DC(()=>{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(!RC(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)}}),dE=$(`$ZodIntersection`,(e,t)=>{xT.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])=>pE(e,t,n)):pE(e,i,a)}});function fE(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(BC(e)&&BC(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=fE(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=fE(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 pE(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}),tw(e))return e;let o=fE(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var mE=$(`$ZodEnum`,(e,t)=>{xT.init(e,t);let n=TC(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>HC.has(typeof e)).map(e=>typeof e==`string`?UC(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}}),hE=$(`$ZodLiteral`,(e,t)=>{if(xT.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`?UC(e):e?UC(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}}),gE=$(`$ZodTransform`,(e,t)=>{xT.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new SC(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 xC;return n.value=i,n}});function _E(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var vE=$(`$ZodOptional`,(e,t)=>{xT.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,MC(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),MC(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${kC(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=>_E(t,e.value)):_E(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),yE=$(`$ZodExactOptional`,(e,t)=>{vE.init(e,t),MC(e._zod,`values`,()=>t.innerType._zod.values),MC(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),bE=$(`$ZodNullable`,(e,t)=>{xT.init(e,t),MC(e._zod,`optin`,()=>t.innerType._zod.optin),MC(e._zod,`optout`,()=>t.innerType._zod.optout),MC(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${kC(e.source)}|null)$`):void 0}),MC(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)}),xE=$(`$ZodDefault`,(e,t)=>{xT.init(e,t),e._zod.optin=`optional`,MC(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=>SE(e,t)):SE(r,t)}});function SE(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var CE=$(`$ZodPrefault`,(e,t)=>{xT.init(e,t),e._zod.optin=`optional`,MC(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))}),wE=$(`$ZodNonOptional`,(e,t)=>{xT.init(e,t),MC(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=>TE(t,e)):TE(i,e)}});function TE(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 EE=$(`$ZodCatch`,(e,t)=>{xT.init(e,t),MC(e._zod,`optin`,()=>t.innerType._zod.optin),MC(e._zod,`optout`,()=>t.innerType._zod.optout),MC(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=>iw(e,n,wC()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>iw(e,n,wC()))},input:e.value}),e.issues=[]),e)}}),DE=$(`$ZodPipe`,(e,t)=>{xT.init(e,t),MC(e._zod,`values`,()=>t.in._zod.values),MC(e._zod,`optin`,()=>t.in._zod.optin),MC(e._zod,`optout`,()=>t.out._zod.optout),MC(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=>OE(e,t.in,n)):OE(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>OE(e,t.out,n)):OE(r,t.out,n)}});function OE(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var kE=$(`$ZodReadonly`,(e,t)=>{xT.init(e,t),MC(e._zod,`propValues`,()=>t.innerType._zod.propValues),MC(e._zod,`values`,()=>t.innerType._zod.values),MC(e._zod,`optin`,()=>t.innerType?._zod?.optin),MC(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(AE):AE(r)}});function AE(e){return e.value=Object.freeze(e.value),e}var jE=$(`$ZodCustom`,(e,t)=>{nT.init(e,t),xT.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=>ME(t,n,r,e));ME(i,n,r,e)}});function ME(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(ow(e))}}var NE,PE=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 FE(){return new PE}(NE=globalThis).__zod_globalRegistry??(NE.__zod_globalRegistry=FE());var IE=globalThis.__zod_globalRegistry;function LE(e,t){return new e({type:`string`,...GC(t)})}function RE(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...GC(t)})}function zE(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...GC(t)})}function BE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...GC(t)})}function VE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...GC(t)})}function HE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...GC(t)})}function UE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...GC(t)})}function WE(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...GC(t)})}function GE(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...GC(t)})}function KE(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...GC(t)})}function qE(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...GC(t)})}function JE(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...GC(t)})}function YE(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...GC(t)})}function XE(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...GC(t)})}function ZE(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...GC(t)})}function QE(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...GC(t)})}function $E(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...GC(t)})}function eD(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...GC(t)})}function tD(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...GC(t)})}function nD(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...GC(t)})}function rD(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...GC(t)})}function iD(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...GC(t)})}function aD(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...GC(t)})}function oD(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...GC(t)})}function sD(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...GC(t)})}function cD(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...GC(t)})}function lD(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...GC(t)})}function uD(e,t){return new e({type:`number`,checks:[],...GC(t)})}function dD(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...GC(t)})}function fD(e,t){return new e({type:`boolean`,...GC(t)})}function pD(e){return new e({type:`unknown`})}function mD(e,t){return new e({type:`never`,...GC(t)})}function hD(e,t){return new iT({check:`less_than`,...GC(t),value:e,inclusive:!1})}function gD(e,t){return new iT({check:`less_than`,...GC(t),value:e,inclusive:!0})}function _D(e,t){return new aT({check:`greater_than`,...GC(t),value:e,inclusive:!1})}function vD(e,t){return new aT({check:`greater_than`,...GC(t),value:e,inclusive:!0})}function yD(e,t){return new oT({check:`multiple_of`,...GC(t),value:e})}function bD(e,t){return new cT({check:`max_length`,...GC(t),maximum:e})}function xD(e,t){return new lT({check:`min_length`,...GC(t),minimum:e})}function SD(e,t){return new uT({check:`length_equals`,...GC(t),length:e})}function CD(e,t){return new fT({check:`string_format`,format:`regex`,...GC(t),pattern:e})}function wD(e){return new pT({check:`string_format`,format:`lowercase`,...GC(e)})}function TD(e){return new mT({check:`string_format`,format:`uppercase`,...GC(e)})}function ED(e,t){return new hT({check:`string_format`,format:`includes`,...GC(t),includes:e})}function DD(e,t){return new gT({check:`string_format`,format:`starts_with`,...GC(t),prefix:e})}function OD(e,t){return new _T({check:`string_format`,format:`ends_with`,...GC(t),suffix:e})}function kD(e){return new vT({check:`overwrite`,tx:e})}function AD(e){return kD(t=>t.normalize(e))}function jD(){return kD(e=>e.trim())}function MD(){return kD(e=>e.toLowerCase())}function ND(){return kD(e=>e.toUpperCase())}function PD(){return kD(e=>IC(e))}function FD(e,t,n){return new e({type:`array`,element:t,...GC(n)})}function ID(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...GC(n)})}function LD(e){let t=RD(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(ow(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(ow(r))}},e(n.value,n)));return t}function RD(e,t){let n=new nT({check:`custom`,...GC(t)});return n._zod.check=e,n}function zD(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??IE,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 BD(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,BD(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`&&UD(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 VD(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>
112
112
 
113
113
  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 HD(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:GD(t,`input`,e.processors),output:GD(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function UD(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 UD(r.element,n);if(r.type===`set`)return UD(r.valueType,n);if(r.type===`lazy`)return UD(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 UD(r.innerType,n);if(r.type===`intersection`)return UD(r.left,n)||UD(r.right,n);if(r.type===`record`||r.type===`map`)return UD(r.keyType,n)||UD(r.valueType,n);if(r.type===`pipe`)return UD(r.in,n)||UD(r.out,n);if(r.type===`object`){for(let e in r.shape)if(UD(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(UD(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(UD(e,n))return!0;return!!(r.rest&&UD(r.rest,n))}return!1}var WD=(e,t={})=>n=>{let r=zD({...n,processors:t});return BD(e,r),VD(r,e),HD(r,e)},GD=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=zD({...i??{},target:a,io:t,processors:n});return BD(e,o),VD(o,e),HD(o,e)},KD={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},qD=(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=KD[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}))])}},JD=(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)},YD=(e,t,n,r)=>{n.type=`boolean`},XD=(e,t,n,r)=>{n.not={}},ZD=(e,t,n,r)=>{let i=e._zod.def,a=TC(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},QD=(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},$D=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},eO=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},tO=(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=BD(a.element,t,{...r,path:[...r.path,`items`]})},nO=(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]=BD(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=BD(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},rO=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>BD(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},iO=(e,t,n,r)=>{let i=e._zod.def,a=BD(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=BD(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]]},aO=(e,t,n,r)=>{let i=e._zod.def,a=BD(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`}]},oO=(e,t,n,r)=>{let i=e._zod.def;BD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},sO=(e,t,n,r)=>{let i=e._zod.def;BD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},cO=(e,t,n,r)=>{let i=e._zod.def;BD(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)))},lO=(e,t,n,r)=>{let i=e._zod.def;BD(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},uO=(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;BD(a,t,r);let o=t.seen.get(e);o.ref=a},dO=(e,t,n,r)=>{let i=e._zod.def;BD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},fO=(e,t,n,r)=>{let i=e._zod.def;BD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},pO=$(`ZodISODateTime`,(e,t)=>{FT.init(e,t),zO.init(e,t)});function mO(e){return oD(pO,e)}var hO=$(`ZodISODate`,(e,t)=>{IT.init(e,t),zO.init(e,t)});function gO(e){return sD(hO,e)}var _O=$(`ZodISOTime`,(e,t)=>{LT.init(e,t),zO.init(e,t)});function vO(e){return cD(_O,e)}var yO=$(`ZodISODuration`,(e,t)=>{RT.init(e,t),zO.init(e,t)});function bO(e){return lD(yO,e)}var xO=(e,t)=>{cw.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>dw(e,t)},flatten:{value:t=>uw(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,EC,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,EC,2)}},isEmpty:{get(){return e.issues.length===0}}})};$(`ZodError`,xO);var SO=$(`ZodError`,xO,{Parent:Error}),CO=fw(SO),wO=pw(SO),TO=mw(SO),EO=gw(SO),DO=vw(SO),OO=yw(SO),kO=bw(SO),AO=xw(SO),jO=Sw(SO),MO=Cw(SO),NO=ww(SO),PO=Tw(SO),FO=$(`ZodType`,(e,t)=>(xT.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:GD(e,`input`),output:GD(e,`output`)}}),e.toJSONSchema=WD(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(PC(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)=>WC(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>CO(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>TO(e,t,n),e.parseAsync=async(t,n)=>wO(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>EO(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>DO(e,t,n),e.decode=(t,n)=>OO(e,t,n),e.encodeAsync=async(t,n)=>kO(e,t,n),e.decodeAsync=async(t,n)=>AO(e,t,n),e.safeEncode=(t,n)=>jO(e,t,n),e.safeDecode=(t,n)=>MO(e,t,n),e.safeEncodeAsync=async(t,n)=>NO(e,t,n),e.safeDecodeAsync=async(t,n)=>PO(e,t,n),e.refine=(t,n)=>e.check(Xk(t,n)),e.superRefine=t=>e.check(Zk(t)),e.overwrite=t=>e.check(kD(t)),e.optional=()=>Mk(e),e.exactOptional=()=>Pk(e),e.nullable=()=>Ik(e),e.nullish=()=>Mk(Ik(e)),e.nonoptional=t=>Hk(e,t),e.array=()=>gk(e),e.or=t=>bk([e,t]),e.and=t=>wk(e,t),e.transform=t=>Kk(e,Ak(t)),e.default=t=>Rk(e,t),e.prefault=t=>Bk(e,t),e.catch=t=>Wk(e,t),e.pipe=t=>Kk(e,t),e.readonly=()=>Jk(e),e.describe=t=>{let n=e.clone();return IE.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return IE.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return IE.get(e);let n=e.clone();return IE.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),IO=$(`_ZodString`,(e,t)=>{ST.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qD(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(CD(...t)),e.includes=(...t)=>e.check(ED(...t)),e.startsWith=(...t)=>e.check(DD(...t)),e.endsWith=(...t)=>e.check(OD(...t)),e.min=(...t)=>e.check(xD(...t)),e.max=(...t)=>e.check(bD(...t)),e.length=(...t)=>e.check(SD(...t)),e.nonempty=(...t)=>e.check(xD(1,...t)),e.lowercase=t=>e.check(wD(t)),e.uppercase=t=>e.check(TD(t)),e.trim=()=>e.check(jD()),e.normalize=(...t)=>e.check(AD(...t)),e.toLowerCase=()=>e.check(MD()),e.toUpperCase=()=>e.check(ND()),e.slugify=()=>e.check(PD())}),LO=$(`ZodString`,(e,t)=>{ST.init(e,t),IO.init(e,t),e.email=t=>e.check(RE(BO,t)),e.url=t=>e.check(WE(UO,t)),e.jwt=t=>e.check(aD(ik,t)),e.emoji=t=>e.check(GE(WO,t)),e.guid=t=>e.check(zE(VO,t)),e.uuid=t=>e.check(BE(HO,t)),e.uuidv4=t=>e.check(VE(HO,t)),e.uuidv6=t=>e.check(HE(HO,t)),e.uuidv7=t=>e.check(UE(HO,t)),e.nanoid=t=>e.check(KE(GO,t)),e.guid=t=>e.check(zE(VO,t)),e.cuid=t=>e.check(qE(KO,t)),e.cuid2=t=>e.check(JE(qO,t)),e.ulid=t=>e.check(YE(JO,t)),e.base64=t=>e.check(nD(tk,t)),e.base64url=t=>e.check(rD(nk,t)),e.xid=t=>e.check(XE(YO,t)),e.ksuid=t=>e.check(ZE(XO,t)),e.ipv4=t=>e.check(QE(ZO,t)),e.ipv6=t=>e.check($E(QO,t)),e.cidrv4=t=>e.check(eD($O,t)),e.cidrv6=t=>e.check(tD(ek,t)),e.e164=t=>e.check(iD(rk,t)),e.datetime=t=>e.check(mO(t)),e.date=t=>e.check(gO(t)),e.time=t=>e.check(vO(t)),e.duration=t=>e.check(bO(t))});function RO(e){return LE(LO,e)}var zO=$(`ZodStringFormat`,(e,t)=>{CT.init(e,t),IO.init(e,t)}),BO=$(`ZodEmail`,(e,t)=>{ET.init(e,t),zO.init(e,t)}),VO=$(`ZodGUID`,(e,t)=>{wT.init(e,t),zO.init(e,t)}),HO=$(`ZodUUID`,(e,t)=>{TT.init(e,t),zO.init(e,t)}),UO=$(`ZodURL`,(e,t)=>{DT.init(e,t),zO.init(e,t)}),WO=$(`ZodEmoji`,(e,t)=>{OT.init(e,t),zO.init(e,t)}),GO=$(`ZodNanoID`,(e,t)=>{kT.init(e,t),zO.init(e,t)}),KO=$(`ZodCUID`,(e,t)=>{AT.init(e,t),zO.init(e,t)}),qO=$(`ZodCUID2`,(e,t)=>{jT.init(e,t),zO.init(e,t)}),JO=$(`ZodULID`,(e,t)=>{MT.init(e,t),zO.init(e,t)}),YO=$(`ZodXID`,(e,t)=>{NT.init(e,t),zO.init(e,t)}),XO=$(`ZodKSUID`,(e,t)=>{PT.init(e,t),zO.init(e,t)}),ZO=$(`ZodIPv4`,(e,t)=>{zT.init(e,t),zO.init(e,t)}),QO=$(`ZodIPv6`,(e,t)=>{BT.init(e,t),zO.init(e,t)}),$O=$(`ZodCIDRv4`,(e,t)=>{VT.init(e,t),zO.init(e,t)}),ek=$(`ZodCIDRv6`,(e,t)=>{HT.init(e,t),zO.init(e,t)}),tk=$(`ZodBase64`,(e,t)=>{WT.init(e,t),zO.init(e,t)}),nk=$(`ZodBase64URL`,(e,t)=>{KT.init(e,t),zO.init(e,t)}),rk=$(`ZodE164`,(e,t)=>{qT.init(e,t),zO.init(e,t)}),ik=$(`ZodJWT`,(e,t)=>{YT.init(e,t),zO.init(e,t)}),ak=$(`ZodNumber`,(e,t)=>{XT.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>JD(e,t,n,r),e.gt=(t,n)=>e.check(_D(t,n)),e.gte=(t,n)=>e.check(vD(t,n)),e.min=(t,n)=>e.check(vD(t,n)),e.lt=(t,n)=>e.check(hD(t,n)),e.lte=(t,n)=>e.check(gD(t,n)),e.max=(t,n)=>e.check(gD(t,n)),e.int=t=>e.check(ck(t)),e.safe=t=>e.check(ck(t)),e.positive=t=>e.check(_D(0,t)),e.nonnegative=t=>e.check(vD(0,t)),e.negative=t=>e.check(hD(0,t)),e.nonpositive=t=>e.check(gD(0,t)),e.multipleOf=(t,n)=>e.check(yD(t,n)),e.step=(t,n)=>e.check(yD(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 ok(e){return uD(ak,e)}var sk=$(`ZodNumberFormat`,(e,t)=>{ZT.init(e,t),ak.init(e,t)});function ck(e){return dD(sk,e)}var lk=$(`ZodBoolean`,(e,t)=>{QT.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>YD(e,t,n,r)});function uk(e){return fD(lk,e)}var dk=$(`ZodUnknown`,(e,t)=>{$T.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function fk(){return pD(dk)}var pk=$(`ZodNever`,(e,t)=>{eE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>XD(e,t,n,r)});function mk(e){return mD(pk,e)}var hk=$(`ZodArray`,(e,t)=>{nE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>tO(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(xD(t,n)),e.nonempty=t=>e.check(xD(1,t)),e.max=(t,n)=>e.check(bD(t,n)),e.length=(t,n)=>e.check(SD(t,n)),e.unwrap=()=>e.element});function gk(e,t){return FD(hk,e,t)}var _k=$(`ZodObject`,(e,t)=>{sE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>nO(e,t,n,r),MC(e,`shape`,()=>t.shape),e.keyof=()=>Ek(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:fk()}),e.loose=()=>e.clone({...e._zod.def,catchall:fk()}),e.strict=()=>e.clone({...e._zod.def,catchall:mk()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>XC(e,t),e.safeExtend=t=>ZC(e,t),e.merge=t=>QC(e,t),e.pick=t=>JC(e,t),e.omit=t=>YC(e,t),e.partial=(...t)=>$C(jk,e,t[0]),e.required=(...t)=>ew(Vk,e,t[0])});function vk(e,t){return new _k({type:`object`,shape:e??{},...GC(t)})}var yk=$(`ZodUnion`,(e,t)=>{lE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>rO(e,t,n,r),e.options=t.options});function bk(e,t){return new yk({type:`union`,options:e,...GC(t)})}var xk=$(`ZodDiscriminatedUnion`,(e,t)=>{yk.init(e,t),uE.init(e,t)});function Sk(e,t,n){return new xk({type:`union`,options:t,discriminator:e,...GC(n)})}var Ck=$(`ZodIntersection`,(e,t)=>{dE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>iO(e,t,n,r)});function wk(e,t){return new Ck({type:`intersection`,left:e,right:t})}var Tk=$(`ZodEnum`,(e,t)=>{mE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ZD(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 Tk({...t,checks:[],...GC(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 Tk({...t,checks:[],...GC(r),entries:i})}});function Ek(e,t){return new Tk({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...GC(t)})}var Dk=$(`ZodLiteral`,(e,t)=>{hE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>QD(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 Ok(e,t){return new Dk({type:`literal`,values:Array.isArray(e)?e:[e],...GC(t)})}var kk=$(`ZodTransform`,(e,t)=>{gE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eO(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new SC(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(ow(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(ow(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function Ak(e){return new kk({type:`transform`,transform:e})}var jk=$(`ZodOptional`,(e,t)=>{vE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Mk(e){return new jk({type:`optional`,innerType:e})}var Nk=$(`ZodExactOptional`,(e,t)=>{yE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Pk(e){return new Nk({type:`optional`,innerType:e})}var Fk=$(`ZodNullable`,(e,t)=>{bE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>aO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ik(e){return new Fk({type:`nullable`,innerType:e})}var Lk=$(`ZodDefault`,(e,t)=>{xE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>sO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Rk(e,t){return new Lk({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():VC(t)}})}var zk=$(`ZodPrefault`,(e,t)=>{CE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>cO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Bk(e,t){return new zk({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():VC(t)}})}var Vk=$(`ZodNonOptional`,(e,t)=>{wE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Hk(e,t){return new Vk({type:`nonoptional`,innerType:e,...GC(t)})}var Uk=$(`ZodCatch`,(e,t)=>{EE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Wk(e,t){return new Uk({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Gk=$(`ZodPipe`,(e,t)=>{DE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uO(e,t,n,r),e.in=t.in,e.out=t.out});function Kk(e,t){return new Gk({type:`pipe`,in:e,out:t})}var qk=$(`ZodReadonly`,(e,t)=>{kE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>dO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Jk(e){return new qk({type:`readonly`,innerType:e})}var Yk=$(`ZodCustom`,(e,t)=>{jE.init(e,t),FO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$D(e,t,n,r)});function Xk(e,t={}){return ID(Yk,e,t)}function Zk(e){return LD(e)}vk({ok:uk(),sessions:ok().int().nonnegative()}).strict(),Sk(`type`,[vk({type:Ok(`input`),data:RO().max(hC)}).strict(),vk({type:Ok(`resize`),cols:ok().int().positive().max(yC),rows:ok().int().positive().max(bC),pixelWidth:ok().int().nonnegative().optional(),pixelHeight:ok().int().nonnegative().optional()}).strict()]);var Qk=Sk(`type`,[vk({type:Ok(`output`),data:RO().max(gC)}).strict(),vk({type:Ok(`exit`),code:ok().int().nullable()}).strict(),vk({type:Ok(`title`),title:RO().max(_C)}).strict(),vk({type:Ok(`session`),shell:RO().min(1),shellName:RO().min(1),pid:ok().int().nonnegative(),cwd:RO().min(1),title:RO().max(_C)}).strict(),vk({type:Ok(`cwd`),cwd:RO().min(1)}).strict(),vk({type:Ok(`foreground`),process:RO().max(256).nullable()}).strict(),vk({type:Ok(`notification`),body:RO().min(1).max(vC)}).strict()]),$k=Ek([`modified`,`added`,`deleted`,`renamed`,`untracked`]),eA=vk({isRepo:uk(),files:ok().int().nonnegative(),additions:ok().int().nonnegative(),deletions:ok().int().nonnegative(),binaries:ok().int().nonnegative()}).strict(),tA=vk({path:RO().min(1),oldPath:RO().min(1).nullable(),status:$k,additions:ok().int().nonnegative(),deletions:ok().int().nonnegative(),binary:uk(),patch:RO().nullable(),patchOmitted:uk()}).strict(),nA=vk({isRepo:uk(),files:gk(tA)}).strict(),rA=`/api/git/diff-summary`,iA=`/api/git/diff`,aA=(e,t)=>{let n=new URL(e,window.location.href);return n.searchParams.set(`cwd`,t),n.toString()},oA=async(e,t)=>{try{let n=await fetch(aA(rA,e),{signal:t});if(!n.ok)return null;let r=eA.safeParse(await n.json());return r.success?r.data:null}catch{return null}},sA=async(e,t)=>{try{let n=await fetch(aA(iA,e),{signal:t});if(!n.ok)return null;let r=nA.safeParse(await n.json());return r.success?r.data:null}catch{return null}},cA=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)$/,lA=e=>{let t=[],n=null,r=0,i=0,a=e.split(`
114
- `);a.length>0&&a[a.length-1]===``&&a.pop();for(let e of a){let a=cA.exec(e);if(a){r=Number.parseInt(a[1],10),i=Number.parseInt(a[2],10),n={header:e,lines:[]},t.push(n);continue}if(!n)continue;let o=e[0];if(o===`\\`){let e=n.lines[n.lines.length-1];e&&(e.noNewline=!0);continue}if(o===`+`){n.lines.push({type:`add`,text:e.slice(1),oldLine:null,newLine:i,noNewline:!1}),i+=1;continue}if(o===`-`){n.lines.push({type:`del`,text:e.slice(1),oldLine:r,newLine:null,noNewline:!1}),r+=1;continue}n.lines.push({type:`context`,text:o===` `?e.slice(1):e,oldLine:r,newLine:i,noNewline:!1}),r+=1,i+=1}return t},uA=e=>e.reduce((e,t)=>e+t.lines.length,0),dA=e=>{if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);return t===null||t.trim()===``?null:t}catch{return null}},fA=(e,t)=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,t)}catch{}},pA=(e,t,n)=>({load:()=>{let r=dA(e);if(r===null)return t;let i=Number(r);return Number.isFinite(i)?n(i):t},store:t=>fA(e,String(t))}),mA=(e,t)=>({load:()=>{let n=dA(e);return n===`true`?!0:n===`false`?!1:t},store:t=>fA(e,String(t))}),hA=(e,t,n)=>({load:()=>{let r=dA(e);return r!==null&&n(r)?r:t},store:t=>fA(e,t)}),gA=(e,t,n)=>({load:()=>t(dA(e)),store:t=>fA(e,n(t))}),_A=hA(US,`unified`,e=>e===`unified`||e===`split`),vA=_A.load,yA=_A.store,bA={modified:{letter:`M`,className:`text-amber-400`},added:{letter:`A`,className:`text-emerald-400`},deleted:{letter:`D`,className:`text-red-400`},renamed:{letter:`R`,className:`text-sky-400`},untracked:{letter:`U`,className:`text-emerald-400`}},xA=`text-emerald-400`,SA=`text-red-400`,CA=`w-12 shrink-0 select-none px-2 text-right text-muted-foreground/50 tabular-nums`,wA=e=>{let t=e.lastIndexOf(`/`);return t===-1?{directory:``,basename:e}:{directory:e.slice(0,t+1),basename:e.slice(t+1)}},TA=e=>e===`add`?`bg-emerald-500/10`:e===`del`?`bg-red-500/10`:``,EA=e=>e===`context`?`text-muted-foreground`:`text-foreground/90`,DA=({line:e})=>(0,y.jsxs)(`div`,{className:Qf(`flex`,TA(e.type)),children:[(0,y.jsx)(`span`,{className:CA,children:e.oldLine??``}),(0,y.jsx)(`span`,{className:CA,children:e.newLine??``}),(0,y.jsx)(`span`,{className:Qf(`w-5 shrink-0 select-none text-center`,e.type===`add`&&xA,e.type===`del`&&SA),children:e.type===`add`?`+`:e.type===`del`?`-`:``}),(0,y.jsxs)(`span`,{className:Qf(`whitespace-pre pr-4`,EA(e.type)),children:[e.text,e.noNewline?(0,y.jsx)(`span`,{className:`select-none text-muted-foreground/50`,title:`No newline at end of file`,children:` ⊘`}):null]})]}),OA=({line:e,side:t})=>{if(!e)return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:CA}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 bg-muted/20`})]});let n=e.type===`context`?`context`:t===`left`?`del`:`add`;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:Qf(CA,TA(n)),children:t===`left`?e.oldLine??``:e.newLine??``}),(0,y.jsx)(`span`,{className:Qf(`min-w-0 flex-1 overflow-x-clip whitespace-pre pr-2`,TA(n),EA(e.type)),children:e.text})]})},kA=({hunk:e})=>(0,y.jsx)(`div`,{className:`select-none bg-muted/30 px-4 py-0.5 text-muted-foreground/60`,children:e.header}),AA=({file:e,viewMode:t})=>{let[n,r]=(0,b.useState)(!1),i=(0,b.useMemo)(()=>e.patch?lA(e.patch):[],[e.patch]),a=(0,b.useMemo)(()=>uA(i),[i]);if((0,b.useEffect)(()=>{r(!1)},[e.path]),e.binary)return(0,y.jsx)(jA,{icon:!0,children:`Binary file — no text diff to show.`});if(e.patchOmitted)return(0,y.jsx)(jA,{icon:!0,children:`Diff too large to display.`});if(i.length===0)return(0,y.jsx)(jA,{children:e.status===`renamed`?`Renamed without content changes.`:e.status===`untracked`&&e.additions===0?`Empty file.`:`No content changes.`});let o=n?1/0:HS,s=0,c=[];for(let e of i){if(s>=o)break;let t=o-s,n=e.lines.length<=t?e.lines:e.lines.slice(0,t);c.push(n===e.lines?e:{header:e.header,lines:n}),s+=n.length}let l=a-s;return(0,y.jsxs)(`div`,{className:Qf(`pb-4 font-mono text-xs leading-5`,t===`unified`&&`min-w-max`),children:[c.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(kA,{hunk:e}),t===`unified`?e.lines.map((e,t)=>(0,y.jsx)(DA,{line:e},t)):mC(e).map((e,t)=>(0,y.jsxs)(`div`,{className:`flex`,children:[(0,y.jsx)(`div`,{className:`flex w-1/2 min-w-0 border-r border-border/40`,children:(0,y.jsx)(OA,{line:e.left,side:`left`})}),(0,y.jsx)(`div`,{className:`flex w-1/2 min-w-0`,children:(0,y.jsx)(OA,{line:e.right,side:`right`})})]},t))]},e.header+String(e.lines[0]?.newLine??e.lines[0]?.oldLine??``))),l>0?(0,y.jsx)(`div`,{className:`px-4 py-2`,children:(0,y.jsxs)(Gx,{variant:`outline`,size:`xs`,onClick:()=>r(!0),children:[`Show `,l.toLocaleString(),` more lines`]})}):null]})},jA=({children:e,icon:t})=>(0,y.jsxs)(`div`,{className:`flex h-full min-h-32 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[t?(0,y.jsx)(gd,{className:`size-4`,"aria-hidden":`true`}):null,e]}),MA=({open:e,cwd:t,onClose:n})=>{let[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(null),[h,g]=(0,b.useState)(()=>vA()),[_,v]=(0,b.useState)(0),x=(0,b.useRef)(null),S=(0,b.useRef)(null);(0,b.useEffect)(()=>{if(e){i(!0);let e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}if(o(!1),r){let e=window.setTimeout(()=>i(!1),150);return()=>window.clearTimeout(e)}},[e]),(0,b.useEffect)(()=>{if(!e||!t)return;let n=new AbortController;return u(!0),f(!1),sA(t,n.signal).then(e=>{if(!n.signal.aborted){if(u(!1),!e){f(!0);return}c(e)}}),()=>n.abort()},[e,t,_]);let C=s?.files??[];(0,b.useEffect)(()=>{s&&(p&&s.files.some(e=>e.path===p)||m(s.files[0]?.path??null))},[s,p]);let w=C.find(e=>e.path===p)??null,T=w?C.indexOf(w):-1,E=(0,b.useMemo)(()=>{let e=0,t=0,n=0;for(let r of C)e+=r.additions,t+=r.deletions,r.binary&&(n+=1);return{additions:e,deletions:t,binaries:n}},[C]),D=(0,b.useCallback)(e=>{if(C.length===0)return;let t=Math.min(C.length-1,Math.max(0,(T===-1?0:T)+e));m(C[t].path),(S.current?.children[t])?.scrollIntoView({block:`nearest`})},[C,T]);(0,b.useEffect)(()=>{if(!e||!r)return;let t=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n();return}let t=e.target;t instanceof HTMLElement&&t.tagName===`INPUT`||(e.key===`ArrowDown`||e.key===`j`?(e.preventDefault(),D(1)):(e.key===`ArrowUp`||e.key===`k`)&&(e.preventDefault(),D(-1)))};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[e,r,n,D]),(0,b.useEffect)(()=>{e&&a&&x.current?.focus()},[e,a]);let O=(0,b.useCallback)(e=>{g(e),yA(e)},[]);if(!r)return null;let k=e&&a,A=s?.isRepo??!0,j=s!==null&&A&&C.length===0;return(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6`,children:[(0,y.jsx)(`div`,{"data-open":k||void 0,"data-closed":!k||void 0,className:Qf(Rx),onClick:n}),(0,y.jsxs)(`div`,{ref:x,role:`dialog`,"aria-label":`git diff viewer`,"aria-modal":!0,tabIndex:-1,"data-open":k||void 0,"data-closed":!k||void 0,className:Qf(`relative z-10 flex h-full w-full max-w-7xl flex-col overflow-hidden rounded-xl outline-none`,Ix,zx),children:[(0,y.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-border/40 px-4 py-2.5`,children:[(0,y.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Changes`}),(0,y.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-muted-foreground`,children:[(0,y.jsxs)(`span`,{className:xA,children:[`+`,E.additions.toLocaleString()]}),` `,(0,y.jsxs)(`span`,{className:SA,children:[`−`,E.deletions.toLocaleString()]}),E.binaries>0?(0,y.jsxs)(`span`,{className:`text-muted-foreground/70`,children:[` · `,E.binaries,` binary`]}):null]}),l?(0,y.jsx)(jS,{className:`size-3.5`,"aria-label":`loading diff`}):null,(0,y.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,y.jsx)(`div`,{role:`radiogroup`,"aria-label":`diff layout`,className:`flex items-center rounded-md border border-border/60 p-0.5`,children:[`unified`,`split`].map(e=>(0,y.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":h===e,onClick:()=>O(e),className:Qf(`rounded-sm px-2 py-0.5 text-xs capitalize transition-colors`,h===e?`bg-foreground/10 text-foreground`:`text-muted-foreground hover:text-foreground`),children:e},e))}),(0,y.jsx)(Gx,{variant:`ghost`,size:`icon-sm`,onClick:()=>v(e=>e+1),"aria-label":`refresh diff`,className:`hover:text-foreground`,children:(0,y.jsx)(xd,{})}),(0,y.jsx)(Gx,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":`close diff viewer`,className:`hover:text-foreground`,children:(0,y.jsx)(wd,{})})]})]}),d?(0,y.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-sm text-muted-foreground`,children:[`Couldn't load the diff from the localterm daemon.`,(0,y.jsx)(Gx,{variant:`outline`,size:`xs`,onClick:()=>v(e=>e+1),children:`Retry`})]}):A?j?(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Working tree clean — nothing to diff.`}):s===null?(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,y.jsx)(jS,{"aria-label":`loading diff`})}):(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,y.jsx)(`div`,{ref:S,role:`listbox`,"aria-label":`changed files`,className:`w-72 shrink-0 overflow-y-auto overscroll-contain border-r border-border/40 p-1.5`,children:C.map(e=>{let t=bA[e.status],{directory:n,basename:r}=wA(e.path),i=e.path===p;return(0,y.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i,onClick:()=>m(e.path),className:Qf(`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs outline-none transition-colors`,i?`bg-foreground/10 text-foreground`:`text-muted-foreground hover:bg-foreground/5`),children:[(0,y.jsx)(`span`,{className:Qf(`w-3 shrink-0 font-mono font-semibold`,t.className),title:e.status,children:t.letter}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,dir:`rtl`,children:(0,y.jsxs)(`bdi`,{children:[(0,y.jsx)(`span`,{className:`text-muted-foreground/60`,children:n}),(0,y.jsx)(`span`,{className:i?`text-foreground`:``,children:r})]})}),e.binary?(0,y.jsx)(`span`,{className:`shrink-0 rounded border border-border/40 px-1 font-mono text-[10px] text-muted-foreground/70`,children:`BIN`}):(0,y.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,y.jsxs)(`span`,{className:xA,children:[`+`,e.additions]}),` `,(0,y.jsxs)(`span`,{className:SA,children:[`−`,e.deletions]})]})]},e.path)})}),(0,y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:w?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border/40 px-4 py-1.5 font-mono text-xs text-muted-foreground`,children:[w.oldPath?(0,y.jsxs)(`span`,{className:`truncate`,children:[w.oldPath,(0,y.jsx)(`span`,{className:`text-muted-foreground/50`,children:` → `}),(0,y.jsx)(`span`,{className:`text-foreground`,children:w.path})]}):(0,y.jsx)(`span`,{className:`truncate text-foreground`,children:w.path}),w.binary?null:(0,y.jsxs)(`span`,{className:`ml-auto shrink-0 tabular-nums`,children:[(0,y.jsxs)(`span`,{className:xA,children:[`+`,w.additions]}),` `,(0,y.jsxs)(`span`,{className:SA,children:[`−`,w.deletions]})]})]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto overscroll-contain`,children:(0,y.jsx)(AA,{file:w,viewMode:h})})]}):(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Select a file to view its diff.`})})]}):(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Not a git repository.`})]})]})},NA=b.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return y_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function PA({className:e,orientation:t=`horizontal`,...n}){return(0,y.jsx)(NA,{"data-slot":`separator`,orientation:t,className:Qf(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}var FA=Ux(`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 IA({className:e,orientation:t,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:Qf(FA({orientation:t}),e),...n})}function LA({className:e,render:t,...n}){return tS({defaultTagName:`div`,props:a_({className:Qf(`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 RA=e=>String(e),zA=`size-7 rounded-none border-0 bg-transparent text-foreground hover:bg-foreground/10 hover:text-foreground disabled:opacity-30 [&_svg]:size-3.5`,BA=`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`,VA={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1},HA=({value:e,min:t,max:n,step:r,ariaLabel:i,decrementAriaLabel:a,incrementAriaLabel:o,formatDisplay:s=RA,onValueChange:c})=>{let l=(0,b.useRef)(null),u=(0,b.useRef)(e),d=t=>{if(t.button===0){try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}l.current=t.clientX,u.current=e}},f=e=>{let t=l.current;if(t===null)return;let n=e.clientX-t,i=Math.round(n/5);i!==0&&c(u.current+i*r)},p=e=>{if(l.current!==null){try{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}catch{}l.current=null}};return(0,y.jsxs)(IA,{"aria-label":i,className:`h-7 overflow-hidden rounded-md border border-border/60`,children:[(0,y.jsx)(Gx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e-r),disabled:e<=t,"aria-label":a,className:zA,children:(0,y.jsx)(vd,{})}),(0,y.jsx)(LA,{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:BA,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,onPointerLeave:e=>{if(l.current===null)return;let t=!1;try{t=e.currentTarget.hasPointerCapture(e.pointerId)}catch{}t||(l.current=null)},onKeyDown:i=>{if(i.key===`Home`){i.preventDefault(),c(t);return}if(i.key===`End`){i.preventDefault(),c(n);return}let a=VA[i.key];a!==void 0&&(i.preventDefault(),c(e+a*r))},children:s(e)}),(0,y.jsx)(Gx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e+r),disabled:e>=n,"aria-label":o,className:zA,children:(0,y.jsx)(bd,{})})]})};function UA(e){let[t,n]=b.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}var WA=b.createContext(null),GA=b.createContext(null);function KA(){let e=b.useContext(WA);if(e===null)throw Error(Xg(60));return e}function qA(){let e=b.useContext(GA);if(e===null)throw Error(Xg(61));return e}var JA=(e,t)=>Object.is(e,t);function YA(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function XA(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:YA(t,e,n))}function ZA(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:YA(e,t,n))}function QA(e,t,n){return e.filter(e=>!YA(t,e,n))}function $A(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function ej(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function tj(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(ej(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 nj(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 $A(e)}function rj(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?$A(e.value):$A(e)}function ij(e,t,n){function r(){return nj(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=ej(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 aj(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,y.jsx)(b.Fragment,{children:ij(r,t,n)},i)),e),[])}var oj={id:Q(e=>e.id),labelId:Q(e=>e.labelId),modal:Q(e=>e.modal),multiple:Q(e=>e.multiple),items:Q(e=>e.items),itemToStringLabel:Q(e=>e.itemToStringLabel),itemToStringValue:Q(e=>e.itemToStringValue),isItemEqualToValue:Q(e=>e.isItemEqualToValue),value:Q(e=>e.value),hasSelectedValue:Q(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:rj(t,r)!==``}),hasNullItemLabel:Q((e,t)=>t?tj(e.items):!1),open:Q(e=>e.open),mounted:Q(e=>e.mounted),forceMount:Q(e=>e.forceMount),transitionStatus:Q(e=>e.transitionStatus),openMethod:Q(e=>e.openMethod),activeIndex:Q(e=>e.activeIndex),selectedIndex:Q(e=>e.selectedIndex),isActive:Q((e,t)=>e.activeIndex===t),isSelected:Q((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>YA(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:YA(n,i,r)}),isSelectedByFocus:Q((e,t)=>e.selectedIndex===t),popupProps:Q(e=>e.popupProps),triggerProps:Q(e=>e.triggerProps),triggerElement:Q(e=>e.triggerElement),positionerElement:Q(e=>e.positionerElement),listElement:Q(e=>e.listElement),scrollUpArrowVisible:Q(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Q(e=>e.scrollDownArrowVisible),hasScrollArrows:Q(e=>e.hasScrollArrows)};function sj(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function cj(e,t){return Math.max(0,e-t)}function lj(e,t){if(t<=0)return 0;let n=sj(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 uj(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=JA,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=fS(),{setDirty:O,setTouched:k,setFocused:A,shouldValidateOnChange:j,validityData:M,setFilled:N,name:P,disabled:F,validation:I,validationMode:L}=uS(),R=vS({id:t}),z=F||d,B=P??c,[V,ee]=yS({controlled:n,default:x?r??Qp:r,name:`Select`,state:`value`}),[H,te]=yS({controlled:a,default:o,name:`Select`,state:`open`}),ne=b.useRef([]),U=b.useRef([]),W=b.useRef(null),re=b.useRef(null),ie=b.useRef(0),ae=b.useRef(null),oe=b.useRef([]),se=b.useRef(!1),ce=b.useRef(!1),le=b.useRef(null),ue=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),de=b.useRef(!1),{mounted:fe,setMounted:pe,transitionStatus:me}=By(H),{openMethod:he,triggerProps:ge}=Rb(H),_e=Vp(()=>new Iy({id:R,labelId:void 0,modal:m,multiple:x,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:V,open:H,mounted:fe,transitionStatus:me,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,ve=My(_e,oj.activeIndex),ye=My(_e,oj.selectedIndex),be=My(_e,oj.triggerElement),xe=My(_e,oj.positionerElement),Se=UA(he),Ce=he??Se,we=b.useMemo(()=>x&&Array.isArray(V)&&V.length===0?``:rj(V,C),[x,V,C]),Te=b.useMemo(()=>x&&Array.isArray(V)?V.map(e=>rj(e,C)):rj(V,C),[x,V,C]);bS(Um(_e.state.triggerElement),{id:R,value:V,getValue:Z(()=>Te)});let Ee=b.useRef(V);X(()=>{V!==Ee.current&&_e.set(`forceMount`,!0)},[_e,V]),X(()=>{N(x?Array.isArray(V)&&V.length>0:V!=null)},[x,V,N]),X(function(){if(H)return;let e=oe.current;if(x){let t=Array.isArray(V)?V:[];if(t.length===0){_e.set(`selectedIndex`,null);return}let n=t[t.length-1],r=ZA(e,n,w);_e.set(`selectedIndex`,r===-1?null:r);return}let t=ZA(e,V,w);_e.set(`selectedIndex`,t===-1?null:t)},[x,H,V,oe,w,_e]),Lb(V,()=>{D(B),O(V!==M.initialValue),j()?I.commit(V):I.commit(V,!0)});let De=Z((e,t)=>{if(s?.(e,t),!t.isCanceled&&(te(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(V)),!e&&_e.state.activeIndex!==null)){let e=ne.current[_e.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Oe=Z(()=>{pe(!1),_e.update({activeIndex:null,openMethod:null}),_?.(!1)});Ky({enabled:!h,open:H,ref:W,onComplete(){H||Oe()}}),b.useImperativeHandle(h,()=>({unmount:Oe}),[Oe]);let ke=Z((e,t)=>{i?.(e,t),!t.isCanceled&&ee(e)}),Ae=Z(()=>{let e=_e.state.listElement||W.current;if(!e)return;let t=cj(e.scrollHeight,e.clientHeight),n=lj(e.scrollTop,t),r=n>0,i=n<t;_e.state.scrollUpArrowVisible!==r&&_e.set(`scrollUpArrowVisible`,r),_e.state.scrollDownArrowVisible!==i&&_e.set(`scrollDownArrowVisible`,i)}),je=nb({open:H,onOpenChange:De,elements:{reference:be,floating:xe}}),{getReferenceProps:Me,getFloatingProps:Ne,getItemProps:Pe}=hb([tv(je,{enabled:!f&&!z,event:`mousedown`}),cv(je,{bubbles:!1}),wb(je,{enabled:!f&&!z,listRef:ne,activeIndex:ve,selectedIndex:ye,disabledIndices:Qp,onNavigate(e){e===null&&!H||_e.set(`activeIndex`,e)},focusItemOnHover:T}),Db(je,{enabled:!f&&!z&&(H||!x),listRef:U,activeIndex:ve,selectedIndex:ye,onMatch(e){H?_e.set(`activeIndex`,e):ke(oe.current[e],Mm(`none`))},onTypingChange(e){se.current=e}})]),Fe=b.useMemo(()=>a_(Me(),ge,R?{id:R}:$p),[Me,ge,R]);$f(()=>{_e.update({popupProps:Ne(),triggerProps:Fe})}),X(()=>{_e.update({id:R,modal:m,multiple:x,value:V,open:H,mounted:fe,transitionStatus:me,popupProps:Ne(),triggerProps:Fe,items:v,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ce})},[_e,R,m,x,V,H,fe,me,Ne,Fe,v,S,C,w,Ce]);let Ie=b.useMemo(()=>({store:_e,name:B,required:p,disabled:z,readOnly:f,multiple:x,highlightItemOnHover:T,setValue:ke,setOpen:De,listRef:ne,popupRef:W,scrollHandlerRef:re,handleScrollArrowVisibility:Ae,scrollArrowsMountedCountRef:ie,getItemProps:Pe,events:je.context.events,valueRef:ae,valuesRef:oe,labelsRef:U,typingRef:se,selectionRef:ue,selectedItemTextRef:le,validation:I,onOpenChangeComplete:_,keyboardActiveRef:ce,alignItemWithTriggerActiveRef:de,initialValueRef:Ee}),[_e,B,p,z,f,x,T,ke,De,Pe,je.context.events,I,_,Ae]),Le=Lm(g,I.inputRef),Re=x&&Array.isArray(V)&&V.length>0,ze=x?void 0:B,Be=b.useMemo(()=>!x||!Array.isArray(V)||!B?null:V.map(e=>{let t=rj(e,C);return(0,y.jsx)(`input`,{type:`hidden`,form:l,name:B,value:t},t)}),[x,V,l,B,C]);return(0,y.jsx)(WA.Provider,{value:Ie,children:(0,y.jsxs)(GA.Provider,{value:je,children:[E,(0,y.jsx)(`input`,{...I.getInputValidationProps({onFocus(){_e.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.currentTarget.value,n=Mm(ym,e.nativeEvent);function r(){if(x)return;let e=oe.current.find(e=>rj(e,C).toLowerCase()===t.toLowerCase()||nj(e,S).toLowerCase()===t.toLowerCase());e!=null&&(O(e!==M.initialValue),ke(e,n),j()&&I.commit(e))}_e.set(`forceMount`,!0),queueMicrotask(r)}}),id:R&&ze==null?`${R}-hidden-input`:void 0,form:l,name:ze,autoComplete:u,value:we,disabled:z,required:p&&!Re,readOnly:f,ref:Le,style:B?Zm:Xm,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Be]})})}function dj(e,t){return e??t}function fj(e){let t=e.getBoundingClientRect(),n=np(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 pj=2,mj=400,hj=200,gj={...tx,...cS,value:()=>null},_j=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}=uS(),{labelId:m}=mS(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=KA(),T=p||C||a,E=My(h,oj.open),D=My(h,oj.value),O=My(h,oj.triggerProps),k=My(h,oj.positionerElement),A=My(h,oj.listElement),j=My(h,oj.id),M=My(h,oj.labelId),N=My(h,oj.hasSelectedValue),P=!N&&E,F=My(h,oj.hasNullItemLabel,P),I=i??j,L=dj(m,M);vS({id:I});let R=Um(k),z=b.useRef(null),{getButtonProps:B,buttonRef:V}=cx({disabled:T,native:o}),ee=Lm(t,z,V,Z(e=>{h.set(`triggerElement`,e)})),H=Kp(),te=Kp(),ne=Kp(),U=Kp();b.useEffect(()=>{if(E)return N||F?U.start(hj,()=>{_.current.allowUnselectedMouseUp=!0,ne.start(hj,()=>{_.current.allowSelectedMouseUp=!0})}):ne.start(mj,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{ne.clear(),U.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},te.clear()},[E,N,F,_,te,ne,U]);let W=b.useMemo(()=>A?.id??hh(k)?.id,[A,k]),re=a_(O,{id:I,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?W:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:ee,onFocus(e){u(!0),E&&S.current&&g(!1,Mm(ym,e.nativeEvent)),H.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){oh(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=zp(e.currentTarget);function n(e){if(!z.current)return;let t=e.target;if(oh(z.current,t)||oh(R.current,t)||t===z.current)return;let n=fj(z.current);e.clientX>=n.left-pj&&e.clientX<=n.right+pj&&e.clientY>=n.top-pj&&e.clientY<=n.bottom+pj||g(!1,Mm(Om,e))}te.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,B);re.role=`combobox`;let ie={...f,open:E,disabled:T,value:D,readOnly:y,placeholder:!N};return y_(`button`,e,{ref:[t,z],state:ie,stateAttributesMapping:gj,props:re})}),vj={value:()=>null},yj=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=KA(),u=My(c,oj.value),d=My(c,oj.items),f=My(c,oj.itemToStringLabel),p=My(c,oj.hasSelectedValue),m=!p&&a!=null&&i==null,h=My(c,oj.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?aj(u,d,f):ij(u,d,f)),y_(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:vj})}),bj=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o}=KA();return y_(`span`,e,{state:{open:My(o,oj.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:ex})}),xj=b.createContext(void 0),Sj=b.forwardRef(function(e,t){let{store:n}=KA(),r=My(n,oj.mounted),i=My(n,oj.forceMount);return r||i?(0,y.jsx)(xj.Provider,{value:!0,children:(0,y.jsx)(F_,{ref:t,...e})}):null}),Cj=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function wj(){return b.useContext(Cj)}function Tj(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),o=b.useRef(0),s=Vp(Dj).current,c=Vp(Ej).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(Oj).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);X(()=>{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]),X(()=>{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]),X(()=>()=>{n.current=[]},[n]),X(()=>()=>{r&&(r.current=[])},[r]);let h=Z(e=>(s.add(e),()=>{s.delete(e)}));X(()=>{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)(Cj.Provider,{value:g,children:t})}function Ej(){return new Map}function Dj(){return new Set}function Oj(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 kj=b.createContext(void 0);function Aj(){return b.useContext(kj)?.direction??`ltr`}var jj=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`}=wh(e,t)||{};if(l==null)return{};let f=Hh(u),p={x:n,y:r},m=Ah(i),h=Oh(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=Ch(k,j,A),N=!c.arrow&&Eh(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}}}),Mj=(e,t)=>({...jj(e),options:[e,t]}),Nj={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 _y().fn(e)).data?.referenceHidden||a}}}},Pj={sideX:`left`,sideY:`top`},Fj={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=np(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:Pj};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=zp(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=Th(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`:Pj.sideX,g=f===`top`?`bottom`:Pj.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function Ij(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 Lj(e,t,n){let{rects:r,placement:i}=e;return{side:Ij(t,Th(i),n),align:Eh(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Rj(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=Um(t),j=Um(m),M=Aj()===`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`),R=+(r===`right`),z=+(r===`left`);typeof F==`number`?F={top:F+I,right:F+z,bottom:F+L,left:F+R}:F&&={top:(F.top||0)+I,right:(F.right||0)+z,bottom:(F.bottom||0)+L,left:(F.left||0)+R};let B={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:F},V=b.useRef(null),ee=Um(i),H=Um(o),te=[fy(e=>{let t=Lj(e,r,M),n=typeof ee.current==`function`?ee.current(t):ee.current,i=typeof H.current==`function`?H.current(t):H.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,M,r])],ne=T===`none`&&w!==`shift`,U=!ne&&(l||g||w===`shift`),W=w===`none`?null:hy({...B,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}),re=ne?null:py(e=>{let t=zp(e.elements.floating).documentElement;return{...B,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:U,limiter:l||g?void 0:my(e=>{if(!V.current)return{};let{width:t,height:n}=V.current.getBoundingClientRect(),r=kh(Th(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})}},[B,l,g,F,T]);w===`shift`||T===`shift`||a===`center`?te.push(re,W):te.push(W,re),te.push(gy({...B,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=np(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`)}}),Mj(()=>({element:V.current||zp(V.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=Th(a),l=kh(c),u=V.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(Lj(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`,U&&l===`y`&&b?S:x),{}}},Nj,v),X(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,p]);let ie=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:ae,elements:oe,x:se,y:ce,middlewareData:le,update:ue,placement:de,context:fe,isPositioned:pe,floatingStyles:me}=rb({rootContext:p,open:f?m:void 0,placement:P,middleware:te,strategy:n,whileElementsMounted:f?void 0:(...e)=>Qv(...e,ie),nodeId:_,externalTree:x}),{sideX:he,sideY:ge}=le.adaptiveOrigin||Pj,_e=pe?n:`fixed`,ve=b.useMemo(()=>{let e=v?{position:_e,[he]:se,[ge]:ce}:{position:_e,...me};return pe||(e.opacity=0),e},[v,_e,he,se,ge,ce,me,pe]),ye=b.useRef(null);X(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(zj(t)?t.current:t)||null;n!==ye.current&&(ae.setPositionReference(n),ye.current=n)},[m,ae,k,A]),b.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&zj(e)&&e.current!==ye.current&&(ae.setPositionReference(e.current),ye.current=e.current)},[m,ae,k,A]),b.useEffect(()=>{if(f&&m&&oe.domReference&&oe.floating)return Qv(oe.domReference,oe.floating,ue,ie)},[f,m,oe,ue,ie]);let be=Th(de),xe=Ij(r,be,M),Se=Eh(de)||`center`,Ce=!!le.hide?.referenceHidden;X(()=>{y&&m&&pe&&C(be)},[y,m,pe,be]);let we=b.useMemo(()=>({position:`absolute`,top:le.arrow?.y,left:le.arrow?.x}),[le.arrow]),Te=le.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:ve,arrowStyles:we,arrowRef:V,arrowUncentered:Te,side:xe,align:Se,physicalSide:be,anchorHidden:Ce,refs:ae,context:fe,isPositioned:pe,update:ue}),[ve,we,V,Te,xe,Se,be,Ce,ae,fe,pe,ue])}function zj(e){return e!=null&&`current`in e}var Bj=b.createContext(void 0);function Vj(){let e=b.useContext(Bj);if(!e)throw Error(Xg(59));return e}function Hj(e,t){e&&Object.assign(e.style,t)}var Uj={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function Wj(e){return e===`starting`?T_:$p}function Gj(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),y_(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Wj(r),i],stateAttributesMapping:nx})}var Kj=20;function qj(e,t,n,r){let[i,a]=b.useState(!1);X(()=>{if(!e||!t||n==null){a(!1);return}let r=zp(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-Kj)},[e,t,n]),cm(e&&(!t||i),r)}var Jj={position:`fixed`},Yj=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=D_,style:_,...v}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=KA(),A=qA(),j=My(x,oj.open),M=My(x,oj.mounted),N=My(x,oj.modal),P=My(x,oj.value),F=My(x,oj.openMethod),I=My(x,oj.positionerElement),L=My(x,oj.triggerElement),R=My(x,oj.isItemEqualToValue),z=My(x,oj.transitionStatus),B=b.useRef(null),V=b.useRef(null),[ee,H]=b.useState(h),te=M&&ee&&F!==`touch`;!M&&ee!==h&&H(h),X(()=>{M||(oj.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),oj.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),b.useImperativeHandle(w,()=>te),qj((te||N)&&j,F===`touch`,I,L);let ne=Rj({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??te,collisionAvoidance:g,keepMounted:!0}),U=te?`none`:ne.side,W=te?Jj:ne.positionerStyles,re=Gj(e,{open:j,side:U,align:ne.align,anchorHidden:ne.anchorHidden},{styles:W,transitionStatus:z,props:v,refs:[t,Z(e=>{x.set(`positionerElement`,e)})],hidden:!M,inert:!j}),ie=b.useRef(0),ae=Z(e=>{if(e.size===0&&ie.current===0||E.current.length===0)return;let t=ie.current;if(ie.current=e.size,e.size===t)return;let n=Mm(ym);if(t!==0&&!x.state.multiple&&P!==null&&ZA(E.current,P,R)===-1){let e=D.current,t=e!=null&&ZA(E.current,e,R)!==-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=>ZA(E.current,e,R)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!XA(P,e,R)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&te){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};Hj(I,e),Hj(O.current,e)}}),oe=b.useMemo(()=>({...ne,side:U,alignItemWithTriggerActive:te,setControlledAlignItemWithTrigger:H,scrollUpArrowRef:B,scrollDownArrowRef:V}),[ne,U,te,H]);return(0,y.jsx)(Tj,{elementsRef:S,labelsRef:C,onMapChange:ae,children:(0,y.jsxs)(Bj.Provider,{value:oe,children:[M&&N&&(0,y.jsx)(kx,{inert:Ox(!j),cutout:L}),re]})})}),Xj=`base-ui-disable-scrollbar`,Zj={className:Xj,getElement(e){return(0,y.jsx)(`style`,{nonce:e,href:Xj,precedence:`base-ui:low`,children:`.${Xj}{scrollbar-width:none}.${Xj}::-webkit-scrollbar{display:none}`})}},Qj=b.createContext(void 0);function $j(e){let t=b.useContext(Qj);if(t===void 0&&!e)throw Error(Xg(69));return t}var eM=b.createContext(void 0),tM={disableStyleElements:!1};function nM(){return b.useContext(eM)??tM}var rM={...nx,...Wy},iM=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}=KA(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=Vj(),O=$j(!0)!=null,k=qA(),A=Aj(),{nonce:j,disableStyleElements:M}=nM(),N=My(s,oj.id),P=My(s,oj.open),F=My(s,oj.mounted),I=My(s,oj.popupProps),L=My(s,oj.transitionStatus),R=My(s,oj.triggerElement),z=My(s,oj.positionerElement),B=My(s,oj.listElement),V=b.useRef(!1),ee=b.useRef(!1),H=b.useRef({}),te=Xp(),ne=Z(e=>{if(!z||!c.current||!ee.current)return;if(V.current||!C){h();return}let t=z.style.top===`0px`,n=z.style.bottom===`0px`;if(!t&&!n){h();return}let r=sM(z),i=cM(z.getBoundingClientRect().height,`y`,r),a=zp(z),o=getComputedStyle(z),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=aM(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=oM(e),m=0,g=null,_=!1,v=!1,y=e=>{z.style.height=`${e}px`},b=(t,n)=>{let r=sj(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(V.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=oM(e),n=v?t:sj(g,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(V.current=!0),h()});b.useImperativeHandle(g,()=>ne,[ne]),Ky({open:P,ref:c,onComplete(){P&&l?.(!0)}});let U={open:P,transitionStatus:L,side:x,align:S};X(()=>{!z||!c.current||Object.keys(H.current).length||(H.current={top:z.style.top||`0`,left:z.style.left||`0`,right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[c,z]),X(()=>{P||C||(ee.current=!1,V.current=!1,Hj(z,H.current))},[P,C,z,c]),X(()=>{let e=c.current;if(!P||!R||!z||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){ee.current=!0,te.request(h),e.style.removeProperty(`--transform-origin`);return}let t=dM(e);e.style.removeProperty(`--transform-origin`);try{let t=f.current,n=d.current,r=getComputedStyle(z),i=getComputedStyle(e),a=zp(R),o=np(z),c=sM(R),l=lM(R.getBoundingClientRect(),c),u=lM(z.getBoundingClientRect(),c),p=l.height,m=B||e,g=m.scrollHeight,y=parseFloat(i.borderBottomWidth),b=parseFloat(r.marginTop)||10,x=parseFloat(r.marginBottom)||10,S=parseFloat(r.minHeight)||100,C=aM(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=lM(n.getBoundingClientRect(),c);O=lM(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;z.style.left=`${sj(k,5,I-u.width)}px`,z.style.height=`${N}px`,z.style.maxHeight=`auto`,z.style.marginTop=`${b}px`,z.style.marginBottom=`${x}px`,e.style.height=`100%`;let L=oM(m),te=F>=L-1;te&&(N=Math.min(w,u.height)-(F-L));let ne=l.top<20||l.bottom>w-20||Math.ceil(N)+1<Math.min(g,S),U=(o.visualViewport?.scale??1)!==1&&Ap;if(ne||U){ee.current=!0,Hj(z,H.current),T(!1);return}let W=Math.max(S,N);if(te){let e=Math.max(0,w-M);z.style.top=u.height>=P?`0`:`${e}px`,z.style.height=`${N}px`,m.scrollTop=oM(m)}else z.style.bottom=`0`,m.scrollTop=F;if(O){let t=u.top,n=u.height,r=O.top+O.height/2,i=sj(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(W===w||N>=C)&&(V.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),ee.current=!0}finally{t()}},[s,P,z,R,d,f,c,h,C,T,te,E,D,B,_,v,A,w]),b.useEffect(()=>{if(!C||!z||!P)return;let e=np(z);function t(e){u(!1,Mm(jm,e))}return Tp(e,`resize`,t)},[u,C,z,P]);let W={...B?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(e){p.current=!0,O&&Tx.has(e.key)&&e.stopPropagation()},onMouseMove(){p.current=!1},onScroll(e){B||ne(e.currentTarget)},...C&&{style:B?{height:`100%`}:Uj}},re=y_(`div`,e,{ref:[t,c],state:U,stateAttributesMapping:rM,props:[I,W,Wj(L),{className:!B&&C?Zj.className:void 0},o]});return(0,y.jsxs)(b.Fragment,{children:[!M&&Zj.getElement(j),(0,y.jsx)(ev,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:re})]})});function aM(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function oM(e){return cj(e.scrollHeight,e.clientHeight)}function sM(e){return Yv.getScale(e)}function cM(e,t,n){return e/n[t]}function lM(e,t){return Uh({x:cM(e.x,`x`,t),y:cM(e.y,`y`,t),width:cM(e.width,`x`,t),height:cM(e.height,`y`,t)})}var uM=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function dM(e){let{style:t}=e,n={};for(let[e,r]of uM)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of uM){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var fM=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=KA(),{alignItemWithTriggerActive:c}=Vj(),l=My(o,oj.hasScrollArrows),u=My(o,oj.openMethod),d=My(o,oj.multiple),f={id:`${My(o,oj.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:Uj},className:l&&u!==`touch`?Zj.className:void 0};return y_(`div`,e,{ref:[t,Z(e=>{o.set(`listElement`,e)})],props:[f,a]})}),pM=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function mM(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}=wj(),f=b.useRef(-1),[p,m]=b.useState(a??(i===pM.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 X(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),X(()=>{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 hM=b.createContext(void 0);function gM(){let e=b.useContext(hM);if(!e)throw Error(Xg(57));return e}var _M=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=mM({label:a,textRef:u,indexGuessBehavior:pM.GuessFromOrder}),{store:f,getItemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:x,selectedItemTextRef:S}=KA(),C=My(f,oj.isActive,d.index),w=My(f,oj.isSelected,d.index,i),T=My(f,oj.isSelectedByFocus,d.index),E=My(f,oj.isItemEqualToValue),D=d.index,O=D!==-1,k=b.useRef(null),A=Um(D);X(()=>{if(!O)return;let e=v.current;return e[D]=i,()=>{delete e[D]}},[O,D,i,v]),X(()=>{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&&YA(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}=cx({disabled:o,focusableWhenDisabled:!0,native:s,composite:!0});function R(e){let t=f.state.value;if(x){let n=Array.isArray(t)?t:[];h(w?QA(n,i,E):[...n,i],Mm(wm,e))}else h(i,Mm(wm,e)),m(!1,Mm(wm,e))}let z={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,R(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()}},B=y_(`div`,e,{ref:[L,t,d.ref,k],state:j,props:[M,z,l,I]}),V=b.useMemo(()=>({selected:w,indexRef:A,textRef:u,selectedByFocus:T,hasRegistered:O}),[w,A,u,T,O]);return(0,y.jsx)(hM.Provider,{value:V,children:B})})),vM=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=gM();return n||r?(0,y.jsx)(yM,{...e,ref:t}):null}),yM=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=gM(),c=b.useRef(null),{transitionStatus:l,setMounted:u}=By(s),d=y_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:Wy});return Ky({open:s,ref:c,onComplete(){s||u(!1)}}),d})),bM=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=gM(),{selectedItemTextRef:o}=KA(),{className:s,render:c,style:l,...u}=e;return y_(`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})})),xM=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}=KA(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=Vj(),_=My(l,c?oj.scrollUpArrowVisible:oj.scrollDownArrowVisible),v=My(l,oj.openMethod),y=_&&v!==`touch`,b=Kp(),x=c?g:h,{transitionStatus:S,setMounted:C}=By(y);X(()=>(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]),Ky({open:y,ref:x,onComplete(){y||C(!1)}});let w=y_(`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=cj(e.scrollHeight,e.clientHeight),r=lj(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=SM(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 SM(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?lj(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?lj(l.offsetTop+l.offsetHeight-r+i,a):a}var CM=b.forwardRef(function(e,t){return(0,y.jsx)(xM,{...e,ref:t,direction:`down`})}),wM=b.forwardRef(function(e,t){return(0,y.jsx)(xM,{...e,ref:t,direction:`up`})}),TM=uj;function EM({className:e,...t}){return(0,y.jsx)(yj,{"data-slot":`select-value`,className:Qf(`flex flex-1 text-left`,e),...t})}function DM({className:e,size:t=`default`,children:n,...r}){return(0,y.jsxs)(_j,{"data-slot":`select-trigger`,"data-size":t,className:Qf(`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)(bj,{render:(0,y.jsx)(fd,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function OM({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)(Sj,{children:(0,y.jsx)(Yj,{side:r,sideOffset:i,align:a,alignOffset:o,alignItemWithTrigger:s,className:`isolate z-50`,children:(0,y.jsxs)(iM,{"data-slot":`select-content`,"data-align-trigger":s,className:Qf(`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)(AM,{}),(0,y.jsx)(fM,{children:t}),(0,y.jsx)(jM,{}),n]})})})}function kM({className:e,children:t,...n}){return(0,y.jsxs)(_M,{"data-slot":`select-item`,className:Qf(`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)(bM,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(vM,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(dd,{className:`pointer-events-none`})})]})}function AM({className:e,...t}){return(0,y.jsx)(wM,{"data-slot":`select-scroll-up-button`,className:Qf(`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)(pd,{})})}function jM({className:e,...t}){return(0,y.jsx)(CM,{"data-slot":`select-scroll-down-button`,className:Qf(`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)(fd,{})})}var MM=`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`,NM=`max-h-72 w-(--anchor-width) origin-(--transform-origin) gap-0 overflow-x-hidden p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,PM=`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`,FM=({value:e,items:t,ariaLabel:n,placeholder:r,onValueChange:i,open:a,onOpenChange:o,onItemHover:s,triggerClassName:c,triggerStyle:l,footerSlot:u})=>{let d=t.find(t=>t.id===e),f=d?.itemStyle?{...d.itemStyle,...l}:l;return(0,y.jsxs)(TM,{value:e,onValueChange:i,open:a,onOpenChange:o,children:[(0,y.jsx)(DM,{size:`sm`,"aria-label":n,className:Qf(MM,`w-full`,c),style:f,children:(0,y.jsx)(EM,{placeholder:r,children:()=>d?.label||r})}),(0,y.jsx)(OM,{alignItemWithTrigger:!1,sideOffset:4,className:Qf(NM,Mx,Nx),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)(kM,{value:e.id,className:PM,style:e.itemStyle,onPointerEnter:s?()=>s(e.id):void 0,onFocus:s?()=>s(e.id):void 0,children:e.label},e.id))})]})};function IM(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=yS({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=By(o,!0,!0),[d,f]=b.useState(o),[{height:p,width:m},h]=b.useState({height:void 0,width:void 0}),g=dx(),[_,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=Gy(O,!1),A=Z(e=>{let t=!o,n=Mm(bm,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 X(()=>{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 LM=b.createContext(void 0);function RM(){let e=b.useContext(LM);if(e===void 0)throw Error(Xg(15));return e}var zM=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Vy.startingStyle]=`startingStyle`,e[e.endingStyle=Vy.endingStyle]=`endingStyle`,e}({}),BM=function(e){return e.panelOpen=`data-panel-open`,e}({}),VM={[zM.open]:``},HM={[zM.closed]:``},UM={open(e){return e?{[BM.panelOpen]:``}:null}},WM={open(e){return e?VM:HM},...Wy},GM=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=IM({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=y_(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:WM});return(0,y.jsx)(LM.Provider,{value:p,children:m})}),KM={...UM,...Wy},qM=b.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=RM(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=cx({disabled:c,focusableWhenDisabled:!0,native:d}),g=b.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return y_(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:KM})}),JM=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function YM(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=Xp(),E=b.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=Lm(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(JM.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=Yp.request(()=>{w.current=!1,r=Yp.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{Yp.cancel(t),Yp.cancel(r)}}));return X(()=>{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(zM.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=Yp.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=zM.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()=>{Yp.cancel(r)}},[t,n,T,a,o,c,u,d,f,p,m]),X(()=>{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]),Up(()=>{let e=Yp.request(()=>{C.current=!1});return()=>Yp.cancel(e)}),X(()=>{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=Yp.request(()=>{x.current=!1,n=Yp.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{Yp.cancel(t),Yp.cancel(n)}},[a,u,d,p]),X(()=>{let e=d.current;e&&a&&E&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(zM.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,Mm(ym,e))}return Tp(e,`beforematch`,t)},[l,d,h]),b.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var XM=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),ZM=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}=RM(),j=r??!1,M=i??!1;X(()=>{if(o)return C(o),()=>{C(void 0)}},[o,C]),X(()=>{y(j)},[y,j]),X(()=>{x(M)},[x,M]);let{props:N}=YM({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});Ky({open:m&&A===`idle`,ref:g,onComplete(){m&&v({height:void 0,width:void 0})}});let P=y_(`div`,e,{state:b.useMemo(()=>({...E,transitionStatus:A}),[E,A]),ref:[t,g],props:[N,{style:{[XM.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[XM.collapsiblePanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:WM});return M||j||f?P:null});function QM({...e}){return(0,y.jsx)(GM,{"data-slot":`collapsible`,...e})}function $M({...e}){return(0,y.jsx)(qM,{"data-slot":`collapsible-trigger`,...e})}function eN({...e}){return(0,y.jsx)(ZM,{"data-slot":`collapsible-content`,...e})}function tN({className:e,...t}){return(0,y.jsx)(`label`,{"data-slot":`label`,className:Qf(`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})}function nN({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`field-group`,className:Qf(`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 rN=Ux(`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 iN({className:e,orientation:t=`vertical`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:Qf(rN({orientation:t}),e),...n})}function aN({className:e,...t}){return(0,y.jsx)(tN,{"data-slot":`field-label`,className:Qf(`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 oN=b.createContext(void 0);function sN(e){let t=b.useContext(oN);if(t===void 0&&!e)throw Error(Xg(47));return t}function cN(){return{...$y(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var lN={...tb,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),openMethod:Q(e=>e.openMethod),openChangeReason:Q(e=>e.openChangeReason),modal:Q(e=>e.modal),focusManagerModal:Q(e=>e.focusManagerModal),stickIfOpen:Q(e=>e.stickIfOpen),titleElementId:Q(e=>e.titleElementId),descriptionElementId:Q(e=>e.descriptionElementId),openOnHover:Q(e=>e.openOnHover),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},uN=class e extends Ly{constructor(e){let t={...cN(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),stickIfOpenTimeout:new Gp,triggerElements:new Zy},lN)}setOpen=(e,t)=>{let n=t.reason===xm,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let a=()=>{let n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),A_.flushSync(a)):a(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let r=Vp(()=>new e(n)).current,i=t??r;return Up(r.disposeEffect),i}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function dN({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=uN.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});$f(()=>{n===void 0&&u.state.open===!1&&r===!0&&u.update({open:!0,activeTriggerId:l})}),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a);let{openMethod:p,triggerProps:m}=Rb(d);Yy(u);let{forceUnmount:h}=Xy(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});b.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=b.useCallback(()=>{u.setOpen(!1,Mm(Am))},[u]);b.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=ib({popupStore:u,onOpenChange:u.setOpen}),{getReferenceProps:v,getFloatingProps:x,getTriggerProps:S}=hb([cv(_,{outsidePressEvent:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),Eb(_)]),C=b.useMemo(()=>v(m),[v,m]),w=b.useMemo(()=>S(m),[S,m]),T=b.useMemo(()=>x(),[x]);u.useSyncedValues({modal:o,openMethod:p,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:T,floatingRootContext:_,nested:B_()!=null});let E=b.useMemo(()=>({store:u}),[u]);return(0,y.jsx)(oN.Provider,{value:E,children:typeof t==`function`?t({payload:f}):t})}function fN(e){return sN(!0)?(0,y.jsx)(dN,{props:e}):(0,y.jsx)(W_,{children:(0,y.jsx)(dN,{props:e})})}function pN(e,t){let n=b.useRef(null);return{preFocusGuardRef:n,handlePreFocusGuardFocus:Z(t=>{A_.flushSync(()=>{e.setOpen(!1,Mm(Tm,t.nativeEvent,t.currentTarget))}),Cg(n.current)?.focus()}),handleFocusTargetFocus:Z(n=>{let r=e.select(`positionerElement`);if(r&&wg(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{A_.flushSync(()=>{e.setOpen(!1,Mm(Tm,n.nativeEvent,n.currentTarget))});let i=Sg(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&oh(r,i);){let e=i;if(i=yg(i),i===e)break}i?.focus()}})}}var mN=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,handle:o,payload:s,openOnHover:c=!1,delay:l=300,closeDelay:u=0,id:d,style:f,...p}=e,m=sN(!0),h=o?.store??m?.store;if(!h)throw Error(Xg(74));let g=dx(d),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),x=h.useState(`isOpenedByTrigger`,g),S=b.useRef(null),{registerTrigger:C,isMountedByThisTrigger:w}=Jy(g,S,h,{payload:s,disabled:i,openOnHover:c,closeDelay:u}),T=h.useState(`openChangeReason`),E=h.useState(`stickIfOpen`),D=h.useState(`openMethod`),O=h.useState(`focusManagerModal`),k=mb(v,{enabled:v!=null&&c&&(D!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Fb(),restMs:l,delay:{close:u},triggerElementRef:S,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=hb([tv(v,{enabled:v!=null,stickIfOpen:E})]),j=h.useState(`triggerProps`,w),M={disabled:i,open:x},{getButtonProps:N,buttonRef:P}=cx({disabled:i,native:a}),F=b.useMemo(()=>({open(e){return e&&T===`trigger-press`?tx.open(e):ex.open(e)}}),[T]),I=y_(`button`,e,{state:M,ref:[P,t,C,S],props:[A.getReferenceProps(),k,j,{[E_]:``,id:g},p,N],stateAttributesMapping:F}),{preFocusGuardRef:L,handlePreFocusGuardFocus:R,handleFocusTargetFocus:z}=pN(h,S);return _&&!O?(0,y.jsxs)(b.Fragment,{children:[(0,y.jsx)(Qm,{ref:L,onFocus:R}),(0,y.jsx)(b.Fragment,{children:I},g),(0,y.jsx)(Qm,{ref:h.context.triggerFocusTargetRef,onFocus:z})]}):(0,y.jsx)(b.Fragment,{children:I},g)}),hN=b.createContext(void 0);function gN(){let e=b.useContext(hN);if(e===void 0)throw Error(Xg(45));return e}var _N=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=sN();return i.useState(`mounted`)||n?(0,y.jsx)(hN.Provider,{value:n,children:(0,y.jsx)(F_,{ref:t,...r})}):null}),vN=b.createContext(void 0);function yN(){let e=b.useContext(vN);if(!e)throw Error(Xg(46));return e}var bN=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,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=O_,style:g,..._}=e,{store:v}=sN(),x=gN(),S=H_(),C=v.useState(`floatingRootContext`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`openChangeReason`),D=v.useState(`activeTriggerElement`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`transitionStatus`),N=v.useState(`hasViewport`),P=b.useRef(null),F=Gy(A,!1,!1),I=Rj({anchor:i,floatingRootContext:C,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:x,nodeId:S,collisionAvoidance:h,adaptiveOrigin:N?Fj:void 0}),L=C.useState(`domReferenceElement`);X(()=>{let e=L,t=P.current;if(e&&(P.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return F(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,F,v]);let R={open:T,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:j};qj(T&&O===!0&&E!==`trigger-hover`,k===`touch`,A,D);let z=b.useCallback(e=>{v.set(`positionerElement`,e)},[v]),B=Gj(e,R,{styles:I.positionerStyles,transitionStatus:M,props:_,refs:[t,z],hidden:!w,inert:!T});return(0,y.jsxs)(vN.Provider,{value:I,children:[w&&O===!0&&E!==`trigger-hover`&&(0,y.jsx)(kx,{ref:v.context.internalBackdropRef,inert:Ox(!T),cutout:D}),(0,y.jsx)(U_,{id:S,children:B})]})}),xN=b.createContext(void 0);function SN(){let[e,t]=b.useState(0),n=Z(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:b.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function CN(e){let{value:t,children:n}=e;return(0,y.jsx)(xN.Provider,{value:t,children:n})}var wN={...nx,...Wy},TN=b.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:a,style:o,...s}=e,{store:c}=sN(),l=yN(),u=$j(!0)!=null,{context:d,hasClosePart:f}=SN(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),x=c.useState(`descriptionElementId`),S=c.useState(`modal`),C=c.useState(`mounted`),w=c.useState(`openChangeReason`),T=c.useState(`activeTriggerElement`),E=c.useState(`floatingRootContext`);Ky({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}});let D=c.useState(`disabled`),O=c.useState(`openOnHover`),k=c.useState(`closeDelay`);fb(E,{enabled:O&&!D,closeDelay:k});function A(e){return e===`touch`?c.context.popupRef.current:!0}let j=i===void 0?A:i,M={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},N=S!==!1&&f;c.useSyncedValue(`focusManagerModal`,N);let P=b.useCallback(e=>{c.set(`popupElement`,e)},[c]),F=y_(`div`,e,{state:M,ref:[t,c.context.popupRef,P],props:[_,{"aria-labelledby":v,"aria-describedby":x,onKeyDown(e){u&&Tx.has(e.key)&&e.stopPropagation()}},Wj(g),s],stateAttributesMapping:wN});return(0,y.jsx)(ev,{context:E,openInteractionType:m,modal:N,disabled:!C||w===`trigger-hover`,initialFocus:j,returnFocus:a,restoreFocus:`popup`,previousFocusableElement:op(T)?T:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,y.jsx)(CN,{value:d,children:F})})});function EN({...e}){return(0,y.jsx)(fN,{"data-slot":`popover`,...e})}function DN({...e}){return(0,y.jsx)(mN,{"data-slot":`popover-trigger`,...e})}function ON({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,y.jsx)(_N,{children:(0,y.jsx)(bN,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,y.jsx)(TN,{"data-slot":`popover-content`,className:Qf(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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),...a})})})}var kN=b.createContext(void 0);function AN(){let e=b.useContext(kN);if(e===void 0)throw Error(Xg(63));return e}var jN=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}({}),MN={...cS,checked(e){return e?{[jN.checked]:``}:{[jN.unchecked]:``}}},NN=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}=fS(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,shouldValidateOnChange:k,validationMode:A,disabled:j,name:M,validation:N}=uS(),{labelId:P}=mS(),F=j||m,I=M??l,L=Z(d),R=b.useRef(null),z=Lm(R,c,N.inputRef),B=b.useRef(null),V=dx(),ee=vS({id:s,implicit:!1,controlRef:B}),H=u?void 0:ee,[te,ne]=yS({controlled:n,default:!!i,name:`Switch`,state:`checked`});bS(B,{id:V,value:te}),X(()=>{R.current&&D(R.current.checked)},[R,D]),Lb(te,()=>{S(I),T(te!==E.initialValue),D(te),k()?N.commit(te):N.commit(te,!0)});let{getButtonProps:U,buttonRef:W}=cx({disabled:F,native:u}),re=hS(a,P,R,!u,H),ie={id:u?ee:V,role:`switch`,"aria-checked":te,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":re,onFocus(){F||O(!0)},onBlur(){let e=R.current;!e||F||(w(!0),O(!1),A===`onBlur`&&N.commit(e.checked))},onClick(e){f||F||(e.preventDefault(),R.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},ae=b.useMemo(()=>a_({checked:te,disabled:F,form:o,id:H,name:I,required:p,style:I?Zm:Xm,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:z,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=Mm(ym,e.nativeEvent);L?.(t,n),!n.isCanceled&&ne(t)},onFocus(){B.current?.focus()}},N.getInputValidationProps,_===void 0?$p:{value:_}),[te,F,o,z,H,I,L,f,p,ne,N,_]),oe=b.useMemo(()=>({...C,checked:te,disabled:F,readOnly:f,required:p}),[C,te,F,f,p]),se=y_(`span`,e,{state:oe,ref:[t,B,W],props:[ie,N.getValidationProps,x,U],stateAttributesMapping:MN});return(0,y.jsxs)(kN.Provider,{value:oe,children:[se,!te&&I&&g!==void 0&&(0,y.jsx)(`input`,{type:`hidden`,form:o,name:I,value:g}),(0,y.jsx)(`input`,{...ae,suppressHydrationWarning:!0})]})}),PN=b.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=uS(),s=AN();return y_(`span`,e,{state:{...o,...s},ref:t,stateAttributesMapping:MN,props:a})});function FN({className:e,size:t=`default`,...n}){return(0,y.jsx)(NN,{"data-slot":`switch`,"data-size":t,className:Qf(`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)(PN,{"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 IN=b.createContext(void 0);function LN(e){let t=b.useContext(IN);if(t===void 0&&!e)throw Error(Xg(72));return t}var RN={...tb,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),isInstantPhase:Q(e=>e.isInstantPhase),trackCursorAxis:Q(e=>e.trackCursorAxis),disableHoverablePopup:Q(e=>e.disableHoverablePopup),lastOpenChangeReason:Q(e=>e.openChangeReason),closeOnClick:Q(e=>e.closeOnClick),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},zN=class e extends Ly{constructor(e){super({...BN(),...e},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Zy},RN)}setOpen=(e,t)=>{let n=t.reason,r=n===xm,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?A_.flushSync(o):o()};static useStore(t,n){let r=Vp(()=>new e(n)).current,i=t??r,a=ib({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=a,i}};function BN(){return{...$y(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var VN=Ey(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=zN.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});$f(()=>{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}),X(()=>{m&&t&&p.setOpen(!1,Mm(km))},[m,t,p]),p.useSyncedValue(`disabled`,t),Yy(p);let{forceUnmount:v,transitionStatus:x}=Xy(h,p),S=p.select(`floatingRootContext`),C=p.useState(`isInstantPhase`),w=p.useState(`instantType`),T=p.useState(`lastOpenChangeReason`),E=b.useRef(null);X(()=>{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]),X(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let D=b.useCallback(()=>{p.setOpen(!1,Mm(Am))},[p]);b.useImperativeHandle(o,()=>({unmount:v,close:D}),[v,D]);let{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=hb([cv(S,{enabled:!t,referencePress:()=>p.select(`closeOnClick`)}),iv(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)(IN.Provider,{value:p,children:typeof f==`function`?f({payload:_}):f})}),HN=b.createContext(void 0);function UN(){return b.useContext(HN)}var WN=function(e){return e[e.popupOpen=Jb.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),GN=Dy(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=LN(!0),m=i?.store??p;if(!m)throw Error(Xg(82));let h=dx(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}=Jy(h,y,m,{payload:a,closeOnClick:c,closeDelay:S}),T=UN(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Fm(v,{open:_});m.useSyncedValue(`isInstantPhase`,D);let k=m.useState(`disabled`),A=o??k,j=m.useState(`trackCursorAxis`),M=m.useState(`disableHoverablePopup`),N=mb(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!M&&j!==`both`?Fb():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=ob(v,{enabled:!A}).reference,F={open:_},I=m.useState(`triggerProps`,w);return y_(`button`,e,{state:F,ref:[t,C,y],props:[N,P,I,{onPointerDown(){m.set(`closeOnClick`,c)},id:h,[WN.triggerDisabled]:A?``:void 0},f],stateAttributesMapping:ex})}),KN=b.createContext(void 0);function qN(){let e=b.useContext(KN);if(e===void 0)throw Error(Xg(70));return e}var JN=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=P_({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,y.jsxs)(b.Fragment,{children:[l,c&&A_.createPortal(n,c)]})}),YN=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return LN().useState(`mounted`)||n?(0,y.jsx)(KN.Provider,{value:n,children:(0,y.jsx)(JN,{ref:t,...r})}):null}),XN=b.createContext(void 0);function ZN(){let e=b.useContext(XN);if(e===void 0)throw Error(Xg(71));return e}var QN=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=O_,style:g,..._}=e,v=LN(),x=qN(),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=Rj({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`)?Fj:void 0}),A=Gj(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)(XN.Provider,{value:k,children:A})}),$N={...nx,...Wy},eP=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=LN(),{side:s,align:c}=ZN(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);Ky({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=o.useState(`disabled`),h=o.useState(`closeDelay`);return fb(p,{enabled:!m,closeDelay:h}),y_(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,Wj(d),a],stateAttributesMapping:$N})}),tP=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=LN(),s=o.useState(`open`),c=o.useState(`instantType`),{arrowRef:l,side:u,align:d,arrowUncentered:f,arrowStyles:p}=ZN();return y_(`div`,e,{state:{open:s,side:u,align:d,uncentered:f,instant:c},ref:[t,l],props:[{style:p,"aria-hidden":!0},a],stateAttributesMapping:nx})}),nP=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)(HN.Provider,{value:i,children:(0,y.jsx)(Pm,{delay:a,timeoutMs:r,children:e.children})})};function rP({delay:e=0,...t}){return(0,y.jsx)(nP,{"data-slot":`tooltip-provider`,delay:e,...t})}function iP({...e}){return(0,y.jsx)(VN,{"data-slot":`tooltip`,...e})}function aP({...e}){return(0,y.jsx)(GN,{"data-slot":`tooltip-trigger`,...e})}function oP({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,y.jsx)(YN,{children:(0,y.jsx)(QN,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,y.jsxs)(eP,{"data-slot":`tooltip-content`,className:Qf(`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)(tP,{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 sP=[{id:`block`,name:`Block`},{id:`bar`,name:`Bar`},{id:`underline`,name:`Underline`}],cP=`block`,lP=sP.map(e=>e.id),uP=e=>typeof e==`string`&&lP.includes(e),dP=e=>e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`),fP=`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,pP=`"Symbols Nerd Font"`,mP=(e,t)=>`"${dP(e)}"${t?`, ${pP}`:``}, ${fP}`,hP=(e,t,n)=>({id:e,name:t,family:mP(t,!0),source:n}),gP=hP(`geist-mono`,`Geist Mono`,`fontsource`),_P=hP(`jetbrains-mono`,`JetBrains Mono`,`google`),vP=hP(`fira-code`,`Fira Code`,`google`),yP=hP(`ibm-plex-mono`,`IBM Plex Mono`,`google`),bP=hP(`source-code-pro`,`Source Code Pro`,`google`),xP=hP(`roboto-mono`,`Roboto Mono`,`google`),SP=hP(`dm-mono`,`DM Mono`,`google`),CP=hP(`inconsolata`,`Inconsolata`,`google`),wP=hP(`space-mono`,`Space Mono`,`google`),TP=hP(`ubuntu-mono`,`Ubuntu Mono`,`google`),EP=[gP,hP(`anonymous-pro`,`Anonymous Pro`,`google`),SP,vP,yP,CP,_P,xP,bP,wP,TP];gP.id;var DP=e=>e?EP.find(t=>t.id===e)??gP:gP,OP=(e,t)=>mP(e.name,t),kP=()=>{let e=EP.filter(e=>e.source===`google`);return e.length===0?``:`https://fonts.googleapis.com/css2?${e.map(e=>`family=${e.name.replace(/ /g,`+`)}:wght@400;700`).join(`&`)}&display=swap`},AP=[{value:1e3,label:`1k lines`},{value:1e4,label:`10k lines`},{value:5e4,label:`50k lines`},{value:1e5,label:`100k lines`}],jP=1e4,MP=AP.map(e=>e.value),NP=e=>MP.includes(e),PP={id:`vesper`,name:`Vesper`,source:`raunofreiberg/vesper`,colors:{background:`#101010`,foreground:`#ffffff`,cursor:`#ffc799`,cursorAccent:`#101010`,selectionBackground:`#2a2a2a`,selectionForeground:`#ffffff`,black:`#101010`,red:`#ff8080`,green:`#99ffe4`,yellow:`#ffc799`,blue:`#a0a0a0`,magenta:`#ffc799`,cyan:`#99ffe4`,white:`#ffffff`,brightBlack:`#505050`,brightRed:`#ff9999`,brightGreen:`#b3ffe4`,brightYellow:`#ffd1a8`,brightBlue:`#b0b0b0`,brightMagenta:`#ffc799`,brightCyan:`#66ddcc`,brightWhite:`#ffffff`}},FP=[PP,{id:`ayu-mirage`,name:`Ayu Mirage`,source:`ayu-theme/vscode-ayu`,colors:{background:`#1f2430`,foreground:`#cccac2`,cursor:`#ffcc66`,cursorAccent:`#1f2430`,selectionBackground:`#34455a`,selectionForeground:`#cccac2`,black:`#171b24`,red:`#f28273`,green:`#87d96c`,yellow:`#fcca60`,blue:`#6acdff`,magenta:`#ddbbff`,cyan:`#93e2c8`,white:`#c7c7c7`,brightBlack:`#686868`,brightRed:`#f28779`,brightGreen:`#d5ff80`,brightYellow:`#ffcd66`,brightBlue:`#73d0ff`,brightMagenta:`#dfbfff`,brightCyan:`#95e6cb`,brightWhite:`#ffffff`}},{id:`catppuccin-frappe`,name:`Catppuccin Frappé`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#303446`,foreground:`#c6d0f5`,cursor:`#f2d5cf`,cursorAccent:`#232634`,selectionBackground:`#626880`,selectionForeground:`#c6d0f5`,black:`#51576d`,red:`#e78284`,green:`#a6d189`,yellow:`#e5c890`,blue:`#8caaee`,magenta:`#f4b8e4`,cyan:`#81c8be`,white:`#b5bfe2`,brightBlack:`#626880`,brightRed:`#e78284`,brightGreen:`#a6d189`,brightYellow:`#e5c890`,brightBlue:`#8caaee`,brightMagenta:`#f4b8e4`,brightCyan:`#81c8be`,brightWhite:`#a5adce`}},{id:`catppuccin-macchiato`,name:`Catppuccin Macchiato`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#24273a`,foreground:`#cad3f5`,cursor:`#f4dbd6`,cursorAccent:`#181926`,selectionBackground:`#5b6078`,selectionForeground:`#cad3f5`,black:`#494d64`,red:`#ed8796`,green:`#a6da95`,yellow:`#eed49f`,blue:`#8aadf4`,magenta:`#f5bde6`,cyan:`#8bd5ca`,white:`#b8c0e0`,brightBlack:`#5b6078`,brightRed:`#ed8796`,brightGreen:`#a6da95`,brightYellow:`#eed49f`,brightBlue:`#8aadf4`,brightMagenta:`#f5bde6`,brightCyan:`#8bd5ca`,brightWhite:`#a5adcb`}},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#1e1e2e`,foreground:`#cdd6f4`,cursor:`#f5e0dc`,cursorAccent:`#11111b`,selectionBackground:`#585b70`,selectionForeground:`#cdd6f4`,black:`#45475a`,red:`#f38ba8`,green:`#a6e3a1`,yellow:`#f9e2af`,blue:`#89b4fa`,magenta:`#f5c2e7`,cyan:`#94e2d5`,white:`#bac2de`,brightBlack:`#585b70`,brightRed:`#f38ba8`,brightGreen:`#a6e3a1`,brightYellow:`#f9e2af`,brightBlue:`#89b4fa`,brightMagenta:`#f5c2e7`,brightCyan:`#94e2d5`,brightWhite:`#a6adc8`}},{id:`dracula`,name:`Dracula`,source:`dracula/visual-studio-code`,colors:{background:`#282a36`,foreground:`#f8f8f2`,cursor:`#f8f8f2`,cursorAccent:`#282a36`,selectionBackground:`#44475a`,selectionForeground:`#f8f8f2`,black:`#21222c`,red:`#ff5555`,green:`#50fa7b`,yellow:`#f1fa8c`,blue:`#bd93f9`,magenta:`#ff79c6`,cyan:`#8be9fd`,white:`#f8f8f2`,brightBlack:`#6272a4`,brightRed:`#ff6e6e`,brightGreen:`#69ff94`,brightYellow:`#ffffa5`,brightBlue:`#d6acff`,brightMagenta:`#ff92df`,brightCyan:`#a4ffff`,brightWhite:`#ffffff`}},{id:`github-dark`,name:`GitHub Dark Default`,source:`primer/github-vscode-theme + @primer/primitives`,colors:{background:`#0d1117`,foreground:`#e6edf3`,cursor:`#e6edf3`,cursorAccent:`#0d1117`,selectionBackground:`#264f78`,selectionForeground:`#e6edf3`,black:`#484f58`,red:`#ff7b72`,green:`#3fb950`,yellow:`#d29922`,blue:`#58a6ff`,magenta:`#bc8cff`,cyan:`#39c5cf`,white:`#b1bac4`,brightBlack:`#6e7681`,brightRed:`#ffa198`,brightGreen:`#56d364`,brightYellow:`#e3b341`,brightBlue:`#79c0ff`,brightMagenta:`#d2a8ff`,brightCyan:`#56d4dd`,brightWhite:`#ffffff`}},{id:`gruvbox-dark`,name:`Gruvbox Dark (Medium)`,source:`jdinhify/vscode-theme-gruvbox`,colors:{background:`#282828`,foreground:`#ebdbb2`,cursor:`#ebdbb2`,cursorAccent:`#282828`,selectionBackground:`#504945`,selectionForeground:`#ebdbb2`,black:`#3c3836`,red:`#cc241d`,green:`#98971a`,yellow:`#d79921`,blue:`#458588`,magenta:`#b16286`,cyan:`#689d6a`,white:`#a89984`,brightBlack:`#928374`,brightRed:`#fb4934`,brightGreen:`#b8bb26`,brightYellow:`#fabd2f`,brightBlue:`#83a598`,brightMagenta:`#d3869b`,brightCyan:`#8ec07c`,brightWhite:`#ebdbb2`}},{id:`monokai`,name:`Monokai`,source:`vscode/extensions/theme-monokai`,colors:{background:`#272822`,foreground:`#f8f8f2`,cursor:`#f8f8f0`,cursorAccent:`#272822`,selectionBackground:`#878b91`,selectionForeground:`#f8f8f2`,black:`#333333`,red:`#c4265e`,green:`#86b42b`,yellow:`#b3b42b`,blue:`#6a7ec8`,magenta:`#8c6bc8`,cyan:`#56adbc`,white:`#e3e3dd`,brightBlack:`#666666`,brightRed:`#f92672`,brightGreen:`#a6e22e`,brightYellow:`#e2e22e`,brightBlue:`#819aff`,brightMagenta:`#ae81ff`,brightCyan:`#66d9ef`,brightWhite:`#f8f8f2`}},{id:`night-owl`,name:`Night Owl`,source:`sdras/night-owl-vscode-theme`,colors:{background:`#011627`,foreground:`#d6deeb`,cursor:`#80a4c2`,cursorAccent:`#011627`,selectionBackground:`#1b90dd`,selectionForeground:`#d6deeb`,black:`#011627`,red:`#ef5350`,green:`#22da6e`,yellow:`#c5e478`,blue:`#82aaff`,magenta:`#c792ea`,cyan:`#21c7a8`,white:`#ffffff`,brightBlack:`#575656`,brightRed:`#ef5350`,brightGreen:`#22da6e`,brightYellow:`#ffeb95`,brightBlue:`#82aaff`,brightMagenta:`#c792ea`,brightCyan:`#7fdbca`,brightWhite:`#ffffff`}},{id:`nord`,name:`Nord`,source:`arcticicestudio/nord-visual-studio-code`,colors:{background:`#2e3440`,foreground:`#d8dee9`,cursor:`#d8dee9`,cursorAccent:`#2e3440`,selectionBackground:`#434c5e`,selectionForeground:`#eceff4`,black:`#3b4252`,red:`#bf616a`,green:`#a3be8c`,yellow:`#ebcb8b`,blue:`#81a1c1`,magenta:`#b48ead`,cyan:`#88c0d0`,white:`#e5e9f0`,brightBlack:`#4c566a`,brightRed:`#bf616a`,brightGreen:`#a3be8c`,brightYellow:`#ebcb8b`,brightBlue:`#81a1c1`,brightMagenta:`#b48ead`,brightCyan:`#8fbcbb`,brightWhite:`#eceff4`}},{id:`one-dark-pro`,name:`One Dark Pro`,source:`Binaryify/OneDark-Pro`,colors:{background:`#282c34`,foreground:`#abb2bf`,cursor:`#abb2bf`,cursorAccent:`#282c34`,selectionBackground:`#3e4452`,selectionForeground:`#abb2bf`,black:`#3f4451`,red:`#e05561`,green:`#8cc265`,yellow:`#d18f52`,blue:`#4aa5f0`,magenta:`#c162de`,cyan:`#42b3c2`,white:`#d7dae0`,brightBlack:`#4f5666`,brightRed:`#ff616e`,brightGreen:`#a5e075`,brightYellow:`#f0a45d`,brightBlue:`#4dc4ff`,brightMagenta:`#de73ff`,brightCyan:`#4cd1e0`,brightWhite:`#e6e6e6`}},{id:`solarized-dark`,name:`Solarized Dark`,source:`vscode/extensions/theme-solarized-dark`,colors:{background:`#002b36`,foreground:`#839496`,cursor:`#d30102`,cursorAccent:`#002b36`,selectionBackground:`#274642`,selectionForeground:`#93a1a1`,black:`#073642`,red:`#dc322f`,green:`#859900`,yellow:`#b58900`,blue:`#268bd2`,magenta:`#d33682`,cyan:`#2aa198`,white:`#eee8d5`,brightBlack:`#002b36`,brightRed:`#cb4b16`,brightGreen:`#586e75`,brightYellow:`#657b83`,brightBlue:`#839496`,brightMagenta:`#6c71c4`,brightCyan:`#93a1a1`,brightWhite:`#fdf6e3`}},{id:`synthwave-84`,name:`SynthWave '84`,source:`robb0wen/synthwave-vscode`,colors:{background:`#262335`,foreground:`#ffffff`,cursor:`#03edf9`,cursorAccent:`#262335`,selectionBackground:`#463465`,selectionForeground:`#ffffff`,black:`#2a2139`,red:`#fe4450`,green:`#72f1b8`,yellow:`#f3e70f`,blue:`#03edf9`,magenta:`#ff7edb`,cyan:`#03edf9`,white:`#ffffff`,brightBlack:`#495495`,brightRed:`#fe4450`,brightGreen:`#72f1b8`,brightYellow:`#fede5d`,brightBlue:`#03edf9`,brightMagenta:`#ff7edb`,brightCyan:`#03edf9`,brightWhite:`#ffffff`}},{id:`tokyo-night`,name:`Tokyo Night`,source:`enkia/tokyo-night-vscode-theme`,colors:{background:`#1a1b26`,foreground:`#a9b1d6`,cursor:`#c0caf5`,cursorAccent:`#1a1b26`,selectionBackground:`#515c7e`,selectionForeground:`#c0caf5`,black:`#363b54`,red:`#f7768e`,green:`#73daca`,yellow:`#e0af68`,blue:`#7aa2f7`,magenta:`#bb9af7`,cyan:`#7dcfff`,white:`#787c99`,brightBlack:`#363b54`,brightRed:`#f7768e`,brightGreen:`#73daca`,brightYellow:`#e0af68`,brightBlue:`#7aa2f7`,brightMagenta:`#bb9af7`,brightCyan:`#7dcfff`,brightWhite:`#acb0d0`}},{id:`tokyo-night-storm`,name:`Tokyo Night Storm`,source:`enkia/tokyo-night-vscode-theme`,colors:{background:`#24283b`,foreground:`#a9b1d6`,cursor:`#c0caf5`,cursorAccent:`#24283b`,selectionBackground:`#6f7bb6`,selectionForeground:`#c0caf5`,black:`#414868`,red:`#f7768e`,green:`#73daca`,yellow:`#e0af68`,blue:`#7aa2f7`,magenta:`#bb9af7`,cyan:`#7dcfff`,white:`#8089b3`,brightBlack:`#414868`,brightRed:`#f7768e`,brightGreen:`#73daca`,brightYellow:`#e0af68`,brightBlue:`#7aa2f7`,brightMagenta:`#bb9af7`,brightCyan:`#7dcfff`,brightWhite:`#a9b1d6`}}];PP.id;var IP=e=>e?FP.find(t=>t.id===e)??PP:PP,LP=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,RP=`text-xs font-normal text-muted-foreground`,zP=Object.fromEntries(EP.map(e=>[e.id,{fontFamily:e.family}])),BP=FP.map(e=>({id:e.id,label:e.name})),VP=EP.map(e=>({id:e.id,label:e.name,itemStyle:zP[e.id]})),HP=sP.map(e=>({id:e.id,label:e.name})),UP=AP.map(e=>({id:String(e.value),label:e.label})),WP=e=>e.toFixed(1),GP=({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:RP,children:e}),(0,y.jsx)(`dd`,{title:n??t,className:Qf(`min-w-0 truncate text-right text-foreground/90`,r),children:t})]}),KP=({themeId:e,onThemeChange:t,onThemePreview:n,fontId:r,onFontChange:i,onFontPreview:a,nerdFontEnabled:o,onNerdFontEnabledChange:s,fontSize:c,onFontSizeChange:l,lineHeight:u,onLineHeightChange:d,paddingX:f,onPaddingXChange:p,paddingY:m,onPaddingYChange:h,cursorStyle:g,onCursorStyleChange:_,onCursorStylePreview:v,cursorBlink:x,onCursorBlinkChange:S,scrollback:C,onScrollbackChange:w,scrollOnUserInput:T,onScrollOnUserInputChange:E,notificationsPermission:D,onNotificationsPermissionRequest:O,sessionInfo:k,onPopoverOpenChange:A,onClose:j})=>{let[M,N]=(0,b.useState)(!1),[P,F]=(0,b.useState)(!1),I=(0,b.useRef)(null);return(0,y.jsxs)(EN,{open:M,onOpenChange:e=>{N(e),A?.(e),e||(F(!1),n?.(null),a?.(null),v?.(null),j?.())},children:[(0,y.jsxs)(iP,{children:[(0,y.jsx)(aP,{render:(0,y.jsx)(DN,{render:(0,y.jsx)(Gx,{variant:`ghost`,size:`icon-sm`,"aria-label":`terminal settings`,className:`hover:text-foreground`})}),children:(0,y.jsx)(Cd,{})}),M?null:(0,y.jsx)(oP,{side:`bottom`,sideOffset:8,children:`Settings`})]}),(0,y.jsx)(ON,{ref:I,side:`bottom`,align:`end`,sideOffset:8,className:Qf(`w-64 gap-0 overflow-hidden p-3`,Mx,Nx),children:(0,y.jsxs)(nN,{className:`gap-3`,children:[(0,y.jsxs)(iN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(aN,{className:LP,children:`Theme`}),(0,y.jsx)(FM,{value:e,items:BP,ariaLabel:`select theme`,placeholder:`Theme`,onValueChange:e=>{e&&t(e)},onOpenChange:e=>{e||n?.(null)},onItemHover:n?e=>n(e):void 0})]}),(0,y.jsx)(PA,{className:`bg-border/40`}),(0,y.jsxs)(iN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(aN,{className:LP,children:`Font`}),(0,y.jsx)(FM,{value:r,items:VP,ariaLabel:`select font`,placeholder:`Font`,open:P,onValueChange:e=>{e&&i(e)},onOpenChange:e=>{F(e),e||a?.(null)},onItemHover:a?e=>a(e):void 0}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:RP,children:`Size`}),(0,y.jsx)(HA,{value:c,min:9,max:24,step:1,ariaLabel:`terminal font size`,decrementAriaLabel:`decrease font size`,incrementAriaLabel:`increase font size`,onValueChange:l})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:RP,children:`Line height`}),(0,y.jsx)(HA,{value:u,min:1,max:2,step:PS,ariaLabel:`terminal line height`,decrementAriaLabel:`decrease line height`,incrementAriaLabel:`increase line height`,formatDisplay:WP,onValueChange:d})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(iP,{children:[(0,y.jsx)(aP,{render:(0,y.jsx)(`span`,{className:RP}),children:`Nerd Font icons`}),(0,y.jsx)(oP,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`Appends a Symbols Only Nerd Font to the font stack. Icon glyphs (Private Use Area codepoints) are resolved by the symbols font while all other characters render from the primary font above.`})]}),(0,y.jsx)(FN,{"aria-label":`toggle nerd font icons`,checked:o,onCheckedChange:s})]})]}),(0,y.jsx)(PA,{className:`bg-border/40`}),(0,y.jsxs)(iN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(aN,{className:LP,children:`Window`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:RP,children:`Pad X`}),(0,y.jsx)(HA,{value:f,min:0,max:48,step:1,ariaLabel:`terminal horizontal padding`,decrementAriaLabel:`decrease horizontal padding`,incrementAriaLabel:`increase horizontal padding`,onValueChange:p})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:RP,children:`Pad Y`}),(0,y.jsx)(HA,{value:m,min:0,max:48,step:1,ariaLabel:`terminal vertical padding`,decrementAriaLabel:`decrease vertical padding`,incrementAriaLabel:`increase vertical padding`,onValueChange:h})]})]}),(0,y.jsx)(PA,{className:`bg-border/40`}),(0,y.jsxs)(iN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(aN,{className:LP,children:`Notifications`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(iP,{children:[(0,y.jsx)(aP,{render:(0,y.jsx)(`span`,{className:RP}),children:`Desktop alerts`}),(0,y.jsx)(oP,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, OSC 9 sequences from the shell trigger browser notifications. Enable to receive alerts when the tab is in the background. Blocked permissions must be changed in browser settings.`})]}),(0,y.jsx)(FN,{"aria-label":`toggle desktop notifications`,checked:D===`granted`,disabled:D===`unsupported`||D===`denied`,onCheckedChange:e=>{e&&O()}})]})]}),(0,y.jsx)(PA,{className:`bg-border/40`}),(0,y.jsxs)(iN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(aN,{className:LP,children:`Cursor`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:RP,children:`Style`}),(0,y.jsx)(FM,{value:g,items:HP,ariaLabel:`select cursor style`,placeholder:`Cursor style`,triggerClassName:`w-fit min-w-[7rem]`,onValueChange:e=>{uP(e)&&_(e)},onOpenChange:e=>{e||v?.(null)},onItemHover:v?e=>{uP(e)&&v?.(e)}:void 0})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:RP,children:`Blink`}),(0,y.jsx)(FN,{"aria-label":`toggle cursor blink`,checked:x,onCheckedChange:S})]})]}),(0,y.jsx)(PA,{className:`bg-border/40`}),(0,y.jsxs)(iN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(aN,{className:LP,children:`Scrollback`}),(0,y.jsx)(FM,{value:String(C),items:UP,ariaLabel:`select scrollback`,placeholder:`Scrollback`,onValueChange:e=>{if(e===null)return;let t=Number(e);NP(t)&&w(t)}}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(iP,{children:[(0,y.jsx)(aP,{render:(0,y.jsx)(`span`,{className:RP}),children:`Pin to bottom on input`}),(0,y.jsx)(oP,{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)(FN,{"aria-label":`toggle pin to bottom on input`,checked:T,onCheckedChange:E})]})]}),k?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(PA,{className:`bg-border/40`}),(0,y.jsxs)(QM,{defaultOpen:!1,children:[(0,y.jsx)($M,{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:LP,children:`Shell`}),(0,y.jsx)(fd,{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)(eN,{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)(GP,{label:`Name`,value:k.shellName}),(0,y.jsx)(GP,{label:`Path`,value:k.shell,title:k.shell}),(0,y.jsx)(GP,{label:`PID`,value:String(k.pid),valueClassName:`tabular-nums`}),(0,y.jsx)(GP,{label:`Cwd`,value:k.cwd,title:k.cwd})]})})]})]}):null]})})]})},qP=e=>{let[t,n]=(0,b.useState)(null);return(0,b.useEffect)(()=>{if(n(null),!e)return;let t=!1,r=null,i=null,a=()=>{t||(r!==null&&window.clearTimeout(r),r=window.setTimeout(o,VS))},o=()=>{if(r!==null&&(window.clearTimeout(r),r=null),!t){if(document.hidden){a();return}i?.abort(),i=new AbortController,oA(e,i.signal).then(e=>{t||(e&&n(e),a())})}},s=()=>{document.hidden||o()};return document.addEventListener(`visibilitychange`,s),o(),()=>{t=!0,document.removeEventListener(`visibilitychange`,s),r!==null&&window.clearTimeout(r),i?.abort()}},[e]),t},JP=2.4,YP=.04045,XP=12.92,ZP=.055,QP=1.055,$P=.0031308,eF=24389/27,tF=216/24389,nF=.95047,rF=1,iF=1.08883,aF=.008856,oF=7.787,sF=e=>{let t=e/255;return t<=YP?t/XP:((t+ZP)/QP)**+JP},cF=e=>e<=0?0:e>=1?255:Math.round(e<=$P?XP*e*255:(QP*e**(1/JP)-ZP)*255),lF=e=>e>aF?Math.cbrt(e):oF*e+16/116,uF=e=>{let t=sF(e.r),n=sF(e.g),r=sF(e.b);return{x:.4124564*t+.3575761*n+.1804375*r,y:.2126729*t+.7151522*n+.072175*r,z:.0193339*t+.119192*n+.9503041*r}},dF=e=>{let t=3.2404542*e.x-1.5371385*e.y-.4985314*e.z,n=-.969266*e.x+1.8760108*e.y+.041556*e.z,r=.0556434*e.x-.2040259*e.y+1.0572252*e.z;return{r:cF(t),g:cF(n),b:cF(r)}},fF=e=>{let t=e.x/nF,n=e.y/rF,r=e.z/iF,i=lF(t),a=lF(n),o=lF(r);return{l:116*a-16,a:500*(i-a),b:200*(a-o)}},pF=(e,t)=>{let n=e*e*e;return n>tF?t*n:t*((116*e-16)/eF)},mF=e=>{let t=(e.l+16)/116,n=e.a/500+t,r=t-e.b/200;return{x:pF(n,nF),y:pF(t,rF),z:pF(r,iF)}},hF=e=>fF(uF(e)),gF=e=>dF(mF(e)),_F=e=>{let t=e.replace(/^#/,``);return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}},vF=e=>{let t=Math.max(0,Math.min(255,Math.round(e.r))),n=Math.max(0,Math.min(255,Math.round(e.g))),r=Math.max(0,Math.min(255,Math.round(e.b)));return`#${t.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`},yF=e=>hF(_F(e)),bF=e=>vF(gF(e)),xF=6,SF=5,CF=24,wF=25,TF=(e,t,n)=>({l:t.l+e*(n.l-t.l),a:t.a+e*(n.a-t.a),b:t.b+e*(n.b-t.b)}),EF=(e,t=!1)=>{let n=e.background??`#000000`,r=e.foreground??`#ffffff`,i=[yF(n),yF(e.red??`#ff0000`),yF(e.green??`#00ff00`),yF(e.yellow??`#ffff00`),yF(e.blue??`#0000ff`),yF(e.magenta??`#ff00ff`),yF(e.cyan??`#00ffff`),yF(r)];if(i[7].l<i[0].l&&!t){let e=i[0];i[0]=i[7],i[7]=e}let a=[];for(let e=0;e<xF;e++){let t=TF(e/SF,i[0],i[1]),n=TF(e/SF,i[2],i[3]),r=TF(e/SF,i[4],i[5]),o=TF(e/SF,i[6],i[7]);for(let e=0;e<xF;e++){let i=TF(e/SF,t,n),s=TF(e/SF,r,o);for(let e=0;e<xF;e++){let t=TF(e/SF,i,s);a.push(bF(t))}}}for(let e=0;e<CF;e++){let t=(e+1)/wF;a.push(bF(TF(t,i[0],i[7])))}return a},DF=`Symbols Nerd Font`,OF=``,kF=async e=>{if(!(typeof document>`u`)&&e.name)try{await document.fonts.ready;let t=[document.fonts.load(`16px "${e.name}"`),document.fonts.load(`bold 16px "${e.name}"`),document.fonts.load(`16px "${DF}"`,OF),document.fonts.load(`bold 16px "${DF}"`,OF)];await Promise.all(t)}catch{}},AF=(e,t)=>`\x1b[${e};${t+1}u`,jF=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},MF=[[127995,127999],[128732,128735],[129008,129008],[129401,129401],[129484,129484],[129653,129655],[129659,129660],[129671,129672],[129705,129711],[129719,129725],[129727,129727],[129731,129733],[129742,129743],[129751,129755],[129760,129768],[129776,129784]],NF=e=>{if(e<127995||e>129784)return!1;for(let[t,n]of MF)if(e>=t&&e<=n)return!0;return!1},PF=6,FF=4,IF=class{version=`15-graphemes-emoji`;base;constructor(e){this.base=e}wcwidth(e){return NF(e)?2:this.base.wcwidth(e)}charProperties(e,t){let n=this.base.charProperties(e,t);return NF(e)?n&~PF|FF:n}},LF=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),RF=(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=t.baseY-r-t.viewportY;n!==0&&e.scrollLines(n)}catch{}return!0},zF=(e,t)=>`\r\n\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,BF={block:{blink:`\x1B[1 q`,steady:`\x1B[2 q`},underline:{blink:`\x1B[3 q`,steady:`\x1B[4 q`},bar:{blink:`\x1B[5 q`,steady:`\x1B[6 q`}},VF=(e,t)=>{let n=t?`blink`:`steady`;return`\x1b[?25h${BF[e][n]}`},HF=(e,t)=>`${VF(e,t)}\r\n\x1b[2;32m[reconnected]\x1b[0m\r\n\r\n`,UF=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,WF=55296,GF=56319,KF=(e,t)=>{if(e.length<=t)return[e];let n=[],r=0;for(;r<e.length;){let i=Math.min(r+t,e.length);if(i<e.length){let t=e.charCodeAt(i-1);t>=WF&&t<=GF&&--i}i===r&&(i=r+t),n.push(e.slice(r,i)),r=i}return n},qF=(e,t)=>{if(t.wasAtBottom){e.scrollToBottom();return}let n=e.buffer.active;if(t.distanceFromBottom>n.baseY){e.scrollToBottom();return}let r=n.baseY-t.distanceFromBottom-n.viewportY;r!==0&&e.scrollLines(r)},JF=new class{terminal=null;chunks=[];scheduled=!1;afterFlush=null;attach(e){this.terminal=e}setAfterFlush(e){this.afterFlush=e}detach(){this.flush(),this.terminal=null,this.afterFlush=null}push(e){this.chunks.push(e),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush()))}flush(){this.scheduled=!1;let e=this.chunks,t=this.terminal;this.chunks=[],!(!t||e.length===0)&&(e.length===1?t.write(e[0]):t.write(e.join(``)),this.afterFlush?.())}},YF=e=>e[0]===3,XF=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},ZF=1/PS,QF=e=>Math.round(e*ZF)/ZF,$F=e=>{if(!Number.isFinite(e))return NS;let t=QF(e);return t<1?1:t>2?2:t},eI=1/1,tI=e=>Math.round(e*eI)/eI,nI=e=>{if(!Number.isFinite(e))return 0;let t=tI(e);return t<0?0:t>48?48:t},rI=e=>{if(!Number.isFinite(e))return 0;let t=tI(e);return t<0?0:t>48?48:t},iI=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},aI=e=>e<1e3?String(e):e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}k`:`${Math.round(e/1e3)}k`,oI=(e,t,n)=>e.key!==t&&e.key!==t.toUpperCase()?!1:n?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,sI=(e,t)=>oI(e,`k`,t),cI=(e,t)=>oI(e,`g`,t),lI=(e,t)=>oI(e,`f`,t),uI=(e,t)=>e.code===`Backslash`?e.altKey&&!e.metaKey&&!e.ctrlKey?!0:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey:!1,dI=mA(QS,!0),fI=dI.load,pI=dI.store,mI=hA(ZS,cP,uP),hI=mI.load,gI=mI.store,_I=gA(JS,e=>DP(e).id,e=>e),vI=_I.load,yI=_I.store,bI=pA(YS,13,XF),xI=bI.load,SI=bI.store,CI=pA(XS,NS,$F),wI=CI.load,TI=CI.store,EI=pA($S,jP,e=>NP(e)?e:jP),DI=EI.load,OI=EI.store,kI=mA(eC,!0),AI=kI.load,jI=kI.store,MI=gA(qS,e=>IP(e).id,e=>e),NI=MI.load,PI=MI.store,FI=pA(tC,0,nI),II=FI.load,LI=FI.store,RI=pA(nC,0,rI),zI=RI.load,BI=RI.store,VI=mA(iC,!1),HI=VI.load,UI=VI.store,WI=`<path d='m6 8 4 4-4 4M12 16h6'/>`,GI=[`<circle cx='7' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='12' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='17' cy='12' r='1.5' fill='currentColor' stroke='none'/>`].join(``),KI={ready:`hsl(220 8% 46%)`,running:`hsl(142 72% 45%)`,"alive-quiet":`hsl(210 65% 50%)`,dead:`hsl(0 72% 50%)`},qI={ready:`hsl(220 10% 16%)`,running:`hsl(142 85% 12%)`,"alive-quiet":`hsl(210 70% 14%)`,dead:`hsl(0 80% 12%)`},JI={ready:WI,running:GI,"alive-quiet":WI,dead:WI},YI=`<circle cx='19' cy='7' r='3.5' fill='hsl(0 72% 50%)' stroke='white' stroke-width='1.5'/>`,XI=(e,t=!1)=>{let n=KI[e],r=qI[e],i=JI[e],a=t?YI:``;return[`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' color='${r}' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='${e===`dead`?BS:1}'>`,`<rect x='2' y='4' width='20' height='16' rx='2' fill='${n}'/>`,i,a,`</svg>`].join(``)},ZI=`ready`,QI=null,$I=!1,eL=(e,t)=>QI===null||e!==ZI||t!==$I,tL=(e,t)=>{ZI=e,QI=e,$I=t},nL=()=>{ZI=`ready`,QI=null,$I=!1},rL=(e,t=!1)=>{if(typeof document>`u`||!eL(e,t))return;tL(e,t);let n=`data:image/svg+xml,${encodeURIComponent(XI(e,t))}`,r=document.querySelector(`link[rel="icon"]`);r||(r=document.createElement(`link`),r.rel=`icon`,document.head.appendChild(r)),r.type=`image/svg+xml`,r.href=n},iL=`/api/health`,aL=async()=>{try{return(await fetch(iL)).ok}catch{return!1}},oL=(e,t)=>t.buffer.active.type!==`alternate`||t.modes.mouseTrackingMode!==`none`?!1:e.deltaMode===WheelEvent.DOM_DELTA_PIXEL,sL=e=>e||`localterm`,cL=e=>`${IS}${e||`localterm`}`,lL={matchBackground:WS,activeMatchBackground:GS,activeMatchBorder:KS,matchOverviewRuler:GS,activeMatchColorOverviewRuler:KS},uL=`cwd`,dL=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(uL);return n&&t.searchParams.set(uL,n),t.toString()},fL=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(uL,e),t.toString()},pL=({onModalOpenChange:e,onForegroundProcessChange:t}={})=>{let n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=(0,b.useRef)(!1),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)(null),d=(0,b.useRef)(null),f=(0,b.useRef)(NI()),p=(0,b.useRef)(vI()),m=(0,b.useRef)(xI()),h=(0,b.useRef)(wI()),g=(0,b.useRef)(hI()),_=(0,b.useRef)(fI()),v=(0,b.useRef)(DI()),x=(0,b.useRef)(AI()),C=(0,b.useRef)(II()),w=(0,b.useRef)(zI()),T=(0,b.useRef)(HI()),E=(0,b.useRef)(null),O=(0,b.useRef)(null),k=(0,b.useRef)(null),A=(0,b.useRef)(null),j=(0,b.useRef)(null),[M,N]=(0,b.useState)(null),[P,F]=(0,b.useState)(0),[I,L]=(0,b.useState)(!1),[R,z]=(0,b.useState)(!1),[B,V]=(0,b.useState)(!1),[ee,H]=(0,b.useState)(!1),te=(0,b.useRef)(null),[ne,U]=(0,b.useState)(0),[W,re]=(0,b.useState)(!1),[ie,ae]=(0,b.useState)(!1),oe=(0,b.useRef)(null),se=(0,b.useRef)(!1),ce=W||ie;se.current=ie;let[le,ue]=(0,b.useState)(``),[de,fe]=(0,b.useState)({resultIndex:-1,resultCount:0}),[pe,me]=(0,b.useState)(f.current),[he,ge]=(0,b.useState)(null),_e=he??pe,ve=(0,b.useMemo)(()=>IP(_e),[_e]),ye=(0,b.useMemo)(()=>({...ve.colors,extendedAnsi:EF(ve.colors)}),[ve]),[be,xe]=(0,b.useState)(p.current),[Se,Ce]=(0,b.useState)(null),we=Se??be,[Te,Ee]=(0,b.useState)(T.current),De=(0,b.useMemo)(()=>DP(we),[we]),[Oe,ke]=(0,b.useState)(m.current),[Ae,je]=(0,b.useState)(h.current),[Me,Ne]=(0,b.useState)(g.current),[Pe,Fe]=(0,b.useState)(null),Ie=Pe??Me,[Le,Re]=(0,b.useState)(_.current),[ze,Be]=(0,b.useState)(v.current),[Ve,He]=(0,b.useState)(x.current),[Ue,We]=(0,b.useState)(C.current),[Ge,qe]=(0,b.useState)(w.current),[Ye,Xe]=(0,b.useState)(null),[Ze,Qe]=(0,b.useState)(`Notification`in window?Notification.permission:`unsupported`),[$e,et]=(0,b.useState)(null),tt=(0,b.useRef)(null),nt=(0,b.useRef)(!1),rt=(0,b.useMemo)(iI,[]),[it,at]=(0,b.useState)(!1),ot=qP($e),st=ot!==null&&ot.isRepo&&ot.files>0;(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let c=!1,l=!1,u=!1,y=``,b=null,C=null,w=null,M=null,P=null,I=0,L=`ready`,R=!1,z=!1,B=[0],V=()=>B[B.length-1]??0,ee=()=>{let e=performance.now()-I;if(e<750){P=window.setTimeout(ee,750-e);return}P=null,M!==null&&(window.clearTimeout(M),M=null),L===`running`&&(document.hidden&&(R=!0),z?(L=`alive-quiet`,rL(`alive-quiet`,R)):(L=`ready`,rL(`ready`,R)))},H=()=>{L!==`running`&&M===null&&(M=window.setTimeout(()=>{M=null,!(c||l)&&(L=`running`,R=!1,rL(`running`))},250)),I=performance.now(),P===null&&(P=window.setTimeout(ee,750))},ne=()=>{M!==null&&(window.clearTimeout(M),M=null),P!==null&&(window.clearTimeout(P),P=null),(L!==`ready`||R)&&(L=`ready`,R=!1,rL(`ready`))},U=DP(p.current);kF(U).then(()=>{if(c)return;let e=r.current;e&&e.clearTextureAtlas(),W._core._charSizeService.measure(),Ae()});let W=new $u({allowProposedApi:!0,cursorBlink:_.current,cursorStyle:g.current,fontFamily:OP(U,T.current),fontSize:m.current,lineHeight:h.current,scrollback:v.current,theme:{...IP(f.current).colors,extendedAnsi:EF(IP(f.current).colors)},macOptionIsMeta:!0,scrollOnUserInput:x.current,windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0},scrollbar:{showScrollbar:!1}});r.current=W,JF.attach(W);let re=new D;E.current=re,W.loadAddon(re),W.loadAddon(new Mn),W.loadAddon(new S),W.loadAddon(new Ke),W.loadAddon(new Je),W.loadAddon(new En);let ie=W._core.unicodeService._activeProvider;W.unicode.register(new IF(ie)),W.unicode.activeVersion=`15-graphemes-emoji`;let ae=new lt;W.loadAddon(ae),o.current=ae;let oe=ae.onDidChangeResults(fe);W.open(e),re.proposeDimensions&&=()=>{if(!W||!W.element||!W.element.parentElement)return;let e=W,t=e._core._renderService.dimensions.css.cell.width,n=e._core._renderService.dimensions.css.cell.height;if(t===0||n===0)return;let r=window.getComputedStyle(W.element.parentElement),i=window.getComputedStyle(W.element),a=Math.max(0,parseInt(r.getPropertyValue(`width`)))-(parseInt(i.getPropertyValue(`padding-right`))+parseInt(i.getPropertyValue(`padding-left`))),o=parseInt(r.getPropertyValue(`height`))-(parseInt(i.getPropertyValue(`padding-top`))+parseInt(i.getPropertyValue(`padding-bottom`)));return{cols:Math.max(2,Math.floor(a/t)),rows:Math.max(1,Math.floor(o/n))}};let se=()=>{let e=W.buffer.active,t=e.length,n=W.rows,r=e.viewportY+n>=t,i=t>n,a=A.current,o=j.current;if(!(!a||!o)&&(a.classList.toggle(`xterm-scrollbar-visible`,!r&&i),i)){let r=n/t,i=e.viewportY/t;o.style.height=`${r*100}%`,o.style.top=`${i*100}%`}};se();let ce=W.onScroll(se);JF.setAfterFlush(se);let le=!1,ue=0,de=0,pe=e=>{if(e.button===0){le=!0,ue=e.clientY,de=W.buffer.active.viewportY;try{e.target.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}},me=e=>{if(!le)return;let t=A.current;if(!t)return;let n=t.clientHeight,r=W.buffer.active.length-W.rows;if(r<=0||n<=0)return;let i=n/r,a=e.clientY-ue,o=Math.max(0,Math.min(r,de+Math.round(a/i)));o!==W.buffer.active.viewportY&&W.scrollLines(o-W.buffer.active.viewportY)},he=()=>{le=!1},ge=e=>{if(e.button!==0||e.target===j.current)return;let t=A.current;if(!t)return;let n=t.getBoundingClientRect(),r=(e.clientY-n.top)/n.height,i=W.buffer.active,a=i.length,o=Math.max(0,Math.min(a-W.rows,Math.round(r*a)-Math.floor(W.rows/2)));W.scrollLines(o-i.viewportY)},_e=j.current,ve=A.current;_e&&(_e.addEventListener(`pointerdown`,pe),_e.addEventListener(`pointermove`,me),_e.addEventListener(`pointerup`,he),_e.addEventListener(`pointercancel`,he)),ve&&ve.addEventListener(`pointerdown`,ge);try{let e=new ia;e.onContextLoss(()=>e.dispose()),W.loadAddon(e)}catch{}let ye=W.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let t=e[0],n=typeof t==`number`?t:1;return B.push(n),!0}),be=W.parser.registerCsiHandler({prefix:`<`,final:`u`},e=>{let t=e[0],n=typeof t==`number`&&t>0?t:1;for(let e=0;e<n&&B.length>1;e+=1)B.pop();return!0}),xe=W.parser.registerCsiHandler({prefix:`=`,final:`u`},e=>{let t=e[0],n=e[1];if(typeof t!=`number`)return!0;let r=t,i=typeof n==`number`&&n>0?n:1,a=B.length-1,o=B[a]??0;return i===1?B[a]=r:i===2?B[a]=o|r:i===3&&(B[a]=o&~r),!0}),Se=W.parser.registerCsiHandler({final:`J`},YF),Ce=W.parser.registerCsiHandler({prefix:`?`,final:`J`},YF),we=e=>{b?.readyState===WebSocket.OPEN&&b.send(JSON.stringify(e))},Te=()=>{let e=d.current;e&&cancelAnimationFrame(e.frameId),d.current=null},Ee=()=>{let e=d.current;e&&qF(W,e.anchor)},De=e=>{Te(),d.current={anchor:e,frameId:requestAnimationFrame(()=>{Ee(),d.current=null})}};W.attachCustomWheelEventHandler(e=>oL(e,W)?(e.preventDefault(),!1):!0),W.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(uI(e,rt)){if(e.type===`keydown`){e.preventDefault();let t=document.getElementById(`new-shell-link`);t instanceof HTMLAnchorElement&&t.click()}return!1}if(sI(e,rt))return e.type===`keydown`&&(e.preventDefault(),te.current?.()),!1;if(cI(e,rt))return e.type===`keydown`&&(e.preventDefault(),k.current?.()),!1;if(lI(e,rt))return e.type===`keydown`&&(e.preventDefault(),O.current?.()),!1;if(e.type===`keydown`&&e.key===`Enter`){let t=LF(e),n=(V()&1)!=0;if(t!==0&&n)return e.preventDefault(),we({type:`input`,data:AF(13,t)}),!1;if(t===1)return e.preventDefault(),we({type:`input`,data:`
114
+ `);a.length>0&&a[a.length-1]===``&&a.pop();for(let e of a){let a=cA.exec(e);if(a){r=Number.parseInt(a[1],10),i=Number.parseInt(a[2],10),n={header:e,lines:[]},t.push(n);continue}if(!n)continue;let o=e[0];if(o===`\\`){let e=n.lines[n.lines.length-1];e&&(e.noNewline=!0);continue}if(o===`+`){n.lines.push({type:`add`,text:e.slice(1),oldLine:null,newLine:i,noNewline:!1}),i+=1;continue}if(o===`-`){n.lines.push({type:`del`,text:e.slice(1),oldLine:r,newLine:null,noNewline:!1}),r+=1;continue}n.lines.push({type:`context`,text:o===` `?e.slice(1):e,oldLine:r,newLine:i,noNewline:!1}),r+=1,i+=1}return t},uA=e=>e.reduce((e,t)=>e+t.lines.length,0),dA=e=>{if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);return t===null||t.trim()===``?null:t}catch{return null}},fA=(e,t)=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,t)}catch{}},pA=(e,t,n)=>({load:()=>{let r=dA(e);if(r===null)return t;let i=Number(r);return Number.isFinite(i)?n(i):t},store:t=>fA(e,String(t))}),mA=(e,t)=>({load:()=>{let n=dA(e);return n===`true`?!0:n===`false`?!1:t},store:t=>fA(e,String(t))}),hA=(e,t,n)=>({load:()=>{let r=dA(e);return r!==null&&n(r)?r:t},store:t=>fA(e,t)}),gA=(e,t,n)=>({load:()=>t(dA(e)),store:t=>fA(e,n(t))}),_A=hA(US,`unified`,e=>e===`unified`||e===`split`),vA=_A.load,yA=_A.store,bA={modified:{letter:`M`,className:`text-amber-400`},added:{letter:`A`,className:`text-emerald-400`},deleted:{letter:`D`,className:`text-red-400`},renamed:{letter:`R`,className:`text-sky-400`},untracked:{letter:`U`,className:`text-emerald-400`}},xA=`text-emerald-400`,SA=`text-red-400`,CA=`w-12 shrink-0 select-none px-2 text-right text-muted-foreground/50 tabular-nums`,wA=e=>{let t=e.lastIndexOf(`/`);return t===-1?{directory:``,basename:e}:{directory:e.slice(0,t+1),basename:e.slice(t+1)}},TA=e=>e===`add`?`bg-emerald-500/10`:e===`del`?`bg-red-500/10`:``,EA=e=>e===`context`?`text-muted-foreground`:`text-foreground/90`,DA=({line:e})=>(0,y.jsxs)(`div`,{className:Qf(`flex`,TA(e.type)),children:[(0,y.jsx)(`span`,{className:CA,children:e.oldLine??``}),(0,y.jsx)(`span`,{className:CA,children:e.newLine??``}),(0,y.jsx)(`span`,{className:Qf(`w-5 shrink-0 select-none text-center`,e.type===`add`&&xA,e.type===`del`&&SA),children:e.type===`add`?`+`:e.type===`del`?`-`:``}),(0,y.jsxs)(`span`,{className:Qf(`whitespace-pre pr-4`,EA(e.type)),children:[e.text,e.noNewline?(0,y.jsx)(`span`,{className:`select-none text-muted-foreground/50`,title:`No newline at end of file`,children:` ⊘`}):null]})]}),OA=({line:e,side:t})=>{if(!e)return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:CA}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 bg-muted/20`})]});let n=e.type===`context`?`context`:t===`left`?`del`:`add`;return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:Qf(CA,TA(n)),children:t===`left`?e.oldLine??``:e.newLine??``}),(0,y.jsx)(`span`,{className:Qf(`min-w-0 flex-1 overflow-x-clip whitespace-pre pr-2`,TA(n),EA(e.type)),children:e.text})]})},kA=({hunk:e})=>(0,y.jsx)(`div`,{className:`select-none bg-muted/30 px-4 py-0.5 text-muted-foreground/60`,children:e.header}),AA=({file:e,viewMode:t})=>{let[n,r]=(0,b.useState)(!1),i=(0,b.useMemo)(()=>e.patch?lA(e.patch):[],[e.patch]),a=(0,b.useMemo)(()=>uA(i),[i]);if((0,b.useEffect)(()=>{r(!1)},[e.path]),e.binary)return(0,y.jsx)(jA,{icon:!0,children:`Binary file — no text diff to show.`});if(e.patchOmitted)return(0,y.jsx)(jA,{icon:!0,children:`Diff too large to display.`});if(i.length===0)return(0,y.jsx)(jA,{children:e.status===`renamed`?`Renamed without content changes.`:e.status===`untracked`&&e.additions===0?`Empty file.`:`No content changes.`});let o=n?1/0:HS,s=0,c=[];for(let e of i){if(s>=o)break;let t=o-s,n=e.lines.length<=t?e.lines:e.lines.slice(0,t);c.push(n===e.lines?e:{header:e.header,lines:n}),s+=n.length}let l=a-s;return(0,y.jsxs)(`div`,{className:Qf(`pb-4 font-mono text-xs leading-5`,t===`unified`&&`min-w-max`),children:[c.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(kA,{hunk:e}),t===`unified`?e.lines.map((e,t)=>(0,y.jsx)(DA,{line:e},t)):mC(e).map((e,t)=>(0,y.jsxs)(`div`,{className:`flex`,children:[(0,y.jsx)(`div`,{className:`flex w-1/2 min-w-0 border-r border-border/40`,children:(0,y.jsx)(OA,{line:e.left,side:`left`})}),(0,y.jsx)(`div`,{className:`flex w-1/2 min-w-0`,children:(0,y.jsx)(OA,{line:e.right,side:`right`})})]},t))]},e.header+String(e.lines[0]?.newLine??e.lines[0]?.oldLine??``))),l>0?(0,y.jsx)(`div`,{className:`px-4 py-2`,children:(0,y.jsxs)(Gx,{variant:`outline`,size:`xs`,onClick:()=>r(!0),children:[`Show `,l.toLocaleString(),` more lines`]})}):null]})},jA=({children:e,icon:t})=>(0,y.jsxs)(`div`,{className:`flex h-full min-h-32 items-center justify-center gap-2 text-sm text-muted-foreground`,children:[t?(0,y.jsx)(gd,{className:`size-4`,"aria-hidden":`true`}):null,e]}),MA=({open:e,cwd:t,onClose:n})=>{let[r,i]=(0,b.useState)(!1),[a,o]=(0,b.useState)(!1),[s,c]=(0,b.useState)(null),[l,u]=(0,b.useState)(!1),[d,f]=(0,b.useState)(!1),[p,m]=(0,b.useState)(null),[h,g]=(0,b.useState)(()=>vA()),[_,v]=(0,b.useState)(0),x=(0,b.useRef)(null),S=(0,b.useRef)(null);(0,b.useEffect)(()=>{if(e){i(!0);let e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)}if(o(!1),r){let e=window.setTimeout(()=>i(!1),150);return()=>window.clearTimeout(e)}},[e]),(0,b.useEffect)(()=>{if(!e||!t)return;let n=new AbortController;return u(!0),f(!1),sA(t,n.signal).then(e=>{if(!n.signal.aborted){if(u(!1),!e){f(!0);return}c(e)}}),()=>n.abort()},[e,t,_]);let C=s?.files??[];(0,b.useEffect)(()=>{s&&(p&&s.files.some(e=>e.path===p)||m(s.files[0]?.path??null))},[s,p]);let w=C.find(e=>e.path===p)??null,T=w?C.indexOf(w):-1,E=(0,b.useMemo)(()=>{let e=0,t=0,n=0;for(let r of C)e+=r.additions,t+=r.deletions,r.binary&&(n+=1);return{additions:e,deletions:t,binaries:n}},[C]),D=(0,b.useCallback)(e=>{if(C.length===0)return;let t=Math.min(C.length-1,Math.max(0,(T===-1?0:T)+e));m(C[t].path),(S.current?.children[t])?.scrollIntoView({block:`nearest`})},[C,T]);(0,b.useEffect)(()=>{if(!e||!r)return;let t=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n();return}let t=e.target;t instanceof HTMLElement&&t.tagName===`INPUT`||(e.key===`ArrowDown`||e.key===`j`?(e.preventDefault(),D(1)):(e.key===`ArrowUp`||e.key===`k`)&&(e.preventDefault(),D(-1)))};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[e,r,n,D]),(0,b.useEffect)(()=>{e&&a&&x.current?.focus()},[e,a]);let O=(0,b.useCallback)(e=>{g(e),yA(e)},[]);if(!r)return null;let k=e&&a,A=s?.isRepo??!0,j=s!==null&&A&&C.length===0;return(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6`,children:[(0,y.jsx)(`div`,{"data-open":k||void 0,"data-closed":!k||void 0,className:Qf(Rx),onClick:n}),(0,y.jsxs)(`div`,{ref:x,role:`dialog`,"aria-label":`git diff viewer`,"aria-modal":!0,tabIndex:-1,"data-open":k||void 0,"data-closed":!k||void 0,className:Qf(`relative z-10 flex h-full w-full max-w-7xl flex-col overflow-hidden rounded-xl outline-none`,Ix,zx),children:[(0,y.jsxs)(`header`,{className:`flex shrink-0 items-center gap-3 border-b border-border/40 px-4 py-2.5`,children:[(0,y.jsx)(`h2`,{className:`text-sm font-medium text-foreground`,children:`Changes`}),(0,y.jsxs)(`span`,{className:`font-mono text-xs tabular-nums text-muted-foreground`,children:[(0,y.jsxs)(`span`,{className:xA,children:[`+`,E.additions.toLocaleString()]}),` `,(0,y.jsxs)(`span`,{className:SA,children:[`−`,E.deletions.toLocaleString()]}),E.binaries>0?(0,y.jsxs)(`span`,{className:`text-muted-foreground/70`,children:[` · `,E.binaries,` binary`]}):null]}),l?(0,y.jsx)(jS,{className:`size-3.5`,"aria-label":`loading diff`}):null,(0,y.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,y.jsx)(`div`,{role:`radiogroup`,"aria-label":`diff layout`,className:`flex items-center rounded-md border border-border/60 p-0.5`,children:[`unified`,`split`].map(e=>(0,y.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":h===e,onClick:()=>O(e),className:Qf(`rounded-sm px-2 py-0.5 text-xs capitalize transition-colors`,h===e?`bg-foreground/10 text-foreground`:`text-muted-foreground hover:text-foreground`),children:e},e))}),(0,y.jsx)(Gx,{variant:`ghost`,size:`icon-sm`,onClick:()=>v(e=>e+1),"aria-label":`refresh diff`,className:`hover:text-foreground`,children:(0,y.jsx)(xd,{})}),(0,y.jsx)(Gx,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":`close diff viewer`,className:`hover:text-foreground`,children:(0,y.jsx)(wd,{})})]})]}),d?(0,y.jsxs)(`div`,{className:`flex flex-1 flex-col items-center justify-center gap-3 text-sm text-muted-foreground`,children:[`Couldn't load the diff from the localterm daemon.`,(0,y.jsx)(Gx,{variant:`outline`,size:`xs`,onClick:()=>v(e=>e+1),children:`Retry`})]}):A?j?(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Working tree clean — nothing to diff.`}):s===null?(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,y.jsx)(jS,{"aria-label":`loading diff`})}):(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,y.jsx)(`div`,{ref:S,role:`listbox`,"aria-label":`changed files`,className:`w-72 shrink-0 overflow-y-auto overscroll-contain border-r border-border/40 p-1.5`,children:C.map(e=>{let t=bA[e.status],{directory:n,basename:r}=wA(e.path),i=e.path===p;return(0,y.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i,onClick:()=>m(e.path),className:Qf(`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-xs outline-none transition-colors`,i?`bg-foreground/10 text-foreground`:`text-muted-foreground hover:bg-foreground/5`),children:[(0,y.jsx)(`span`,{className:Qf(`w-3 shrink-0 font-mono font-semibold`,t.className),title:e.status,children:t.letter}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono`,dir:`rtl`,children:(0,y.jsxs)(`bdi`,{children:[(0,y.jsx)(`span`,{className:`text-muted-foreground/60`,children:n}),(0,y.jsx)(`span`,{className:i?`text-foreground`:``,children:r})]})}),e.binary?(0,y.jsx)(`span`,{className:`shrink-0 rounded border border-border/40 px-1 font-mono text-[10px] text-muted-foreground/70`,children:`BIN`}):(0,y.jsxs)(`span`,{className:`shrink-0 font-mono tabular-nums`,children:[(0,y.jsxs)(`span`,{className:xA,children:[`+`,e.additions]}),` `,(0,y.jsxs)(`span`,{className:SA,children:[`−`,e.deletions]})]})]},e.path)})}),(0,y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:w?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-border/40 px-4 py-1.5 font-mono text-xs text-muted-foreground`,children:[w.oldPath?(0,y.jsxs)(`span`,{className:`truncate`,children:[w.oldPath,(0,y.jsx)(`span`,{className:`text-muted-foreground/50`,children:` → `}),(0,y.jsx)(`span`,{className:`text-foreground`,children:w.path})]}):(0,y.jsx)(`span`,{className:`truncate text-foreground`,children:w.path}),w.binary?null:(0,y.jsxs)(`span`,{className:`ml-auto shrink-0 tabular-nums`,children:[(0,y.jsxs)(`span`,{className:xA,children:[`+`,w.additions]}),` `,(0,y.jsxs)(`span`,{className:SA,children:[`−`,w.deletions]})]})]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto overscroll-contain`,children:(0,y.jsx)(AA,{file:w,viewMode:h})})]}):(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Select a file to view its diff.`})})]}):(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Not a git repository.`})]})]})},NA=b.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return y_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function PA({className:e,orientation:t=`horizontal`,...n}){return(0,y.jsx)(NA,{"data-slot":`separator`,orientation:t,className:Qf(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}var FA=Ux(`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 IA({className:e,orientation:t,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:Qf(FA({orientation:t}),e),...n})}function LA({className:e,render:t,...n}){return tS({defaultTagName:`div`,props:a_({className:Qf(`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 RA=e=>String(e),zA=`size-7 rounded-none border-0 bg-transparent text-foreground hover:bg-foreground/10 hover:text-foreground disabled:opacity-30 [&_svg]:size-3.5`,BA=`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`,VA={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1},HA=({value:e,min:t,max:n,step:r,ariaLabel:i,decrementAriaLabel:a,incrementAriaLabel:o,formatDisplay:s=RA,onValueChange:c})=>{let l=(0,b.useRef)(null),u=(0,b.useRef)(e),d=t=>{if(t.button===0){try{t.currentTarget.setPointerCapture(t.pointerId)}catch{}l.current=t.clientX,u.current=e}},f=e=>{let t=l.current;if(t===null)return;let n=e.clientX-t,i=Math.round(n/5);i!==0&&c(u.current+i*r)},p=e=>{if(l.current!==null){try{e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId)}catch{}l.current=null}};return(0,y.jsxs)(IA,{"aria-label":i,className:`h-7 overflow-hidden rounded-md border border-border/60`,children:[(0,y.jsx)(Gx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e-r),disabled:e<=t,"aria-label":a,className:zA,children:(0,y.jsx)(vd,{})}),(0,y.jsx)(LA,{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:BA,onPointerDown:d,onPointerMove:f,onPointerUp:p,onPointerCancel:p,onPointerLeave:e=>{if(l.current===null)return;let t=!1;try{t=e.currentTarget.hasPointerCapture(e.pointerId)}catch{}t||(l.current=null)},onKeyDown:i=>{if(i.key===`Home`){i.preventDefault(),c(t);return}if(i.key===`End`){i.preventDefault(),c(n);return}let a=VA[i.key];a!==void 0&&(i.preventDefault(),c(e+a*r))},children:s(e)}),(0,y.jsx)(Gx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e+r),disabled:e>=n,"aria-label":o,className:zA,children:(0,y.jsx)(bd,{})})]})};function UA(e){let[t,n]=b.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}var WA=b.createContext(null),GA=b.createContext(null);function KA(){let e=b.useContext(WA);if(e===null)throw Error(Xg(60));return e}function qA(){let e=b.useContext(GA);if(e===null)throw Error(Xg(61));return e}var JA=(e,t)=>Object.is(e,t);function YA(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function XA(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:YA(t,e,n))}function ZA(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:YA(e,t,n))}function QA(e,t,n){return e.filter(e=>!YA(t,e,n))}function $A(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function ej(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function tj(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(ej(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 nj(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 $A(e)}function rj(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?$A(e.value):$A(e)}function ij(e,t,n){function r(){return nj(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=ej(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 aj(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,y.jsx)(b.Fragment,{children:ij(r,t,n)},i)),e),[])}var oj={id:Q(e=>e.id),labelId:Q(e=>e.labelId),modal:Q(e=>e.modal),multiple:Q(e=>e.multiple),items:Q(e=>e.items),itemToStringLabel:Q(e=>e.itemToStringLabel),itemToStringValue:Q(e=>e.itemToStringValue),isItemEqualToValue:Q(e=>e.isItemEqualToValue),value:Q(e=>e.value),hasSelectedValue:Q(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:rj(t,r)!==``}),hasNullItemLabel:Q((e,t)=>t?tj(e.items):!1),open:Q(e=>e.open),mounted:Q(e=>e.mounted),forceMount:Q(e=>e.forceMount),transitionStatus:Q(e=>e.transitionStatus),openMethod:Q(e=>e.openMethod),activeIndex:Q(e=>e.activeIndex),selectedIndex:Q(e=>e.selectedIndex),isActive:Q((e,t)=>e.activeIndex===t),isSelected:Q((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>YA(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:YA(n,i,r)}),isSelectedByFocus:Q((e,t)=>e.selectedIndex===t),popupProps:Q(e=>e.popupProps),triggerProps:Q(e=>e.triggerProps),triggerElement:Q(e=>e.triggerElement),positionerElement:Q(e=>e.positionerElement),listElement:Q(e=>e.listElement),scrollUpArrowVisible:Q(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Q(e=>e.scrollDownArrowVisible),hasScrollArrows:Q(e=>e.hasScrollArrows)};function sj(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function cj(e,t){return Math.max(0,e-t)}function lj(e,t){if(t<=0)return 0;let n=sj(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 uj(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=JA,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=fS(),{setDirty:O,setTouched:k,setFocused:A,shouldValidateOnChange:j,validityData:M,setFilled:N,name:P,disabled:F,validation:I,validationMode:L}=uS(),R=vS({id:t}),z=F||d,B=P??c,[V,ee]=yS({controlled:n,default:x?r??Qp:r,name:`Select`,state:`value`}),[H,te]=yS({controlled:a,default:o,name:`Select`,state:`open`}),ne=b.useRef([]),U=b.useRef([]),W=b.useRef(null),re=b.useRef(null),ie=b.useRef(0),ae=b.useRef(null),oe=b.useRef([]),se=b.useRef(!1),ce=b.useRef(!1),le=b.useRef(null),ue=b.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),de=b.useRef(!1),{mounted:fe,setMounted:pe,transitionStatus:me}=By(H),{openMethod:he,triggerProps:ge}=Rb(H),_e=Vp(()=>new Iy({id:R,labelId:void 0,modal:m,multiple:x,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:V,open:H,mounted:fe,transitionStatus:me,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,ve=My(_e,oj.activeIndex),ye=My(_e,oj.selectedIndex),be=My(_e,oj.triggerElement),xe=My(_e,oj.positionerElement),Se=UA(he),Ce=he??Se,we=b.useMemo(()=>x&&Array.isArray(V)&&V.length===0?``:rj(V,C),[x,V,C]),Te=b.useMemo(()=>x&&Array.isArray(V)?V.map(e=>rj(e,C)):rj(V,C),[x,V,C]);bS(Um(_e.state.triggerElement),{id:R,value:V,getValue:Z(()=>Te)});let Ee=b.useRef(V);X(()=>{V!==Ee.current&&_e.set(`forceMount`,!0)},[_e,V]),X(()=>{N(x?Array.isArray(V)&&V.length>0:V!=null)},[x,V,N]),X(function(){if(H)return;let e=oe.current;if(x){let t=Array.isArray(V)?V:[];if(t.length===0){_e.set(`selectedIndex`,null);return}let n=t[t.length-1],r=ZA(e,n,w);_e.set(`selectedIndex`,r===-1?null:r);return}let t=ZA(e,V,w);_e.set(`selectedIndex`,t===-1?null:t)},[x,H,V,oe,w,_e]),Lb(V,()=>{D(B),O(V!==M.initialValue),j()?I.commit(V):I.commit(V,!0)});let De=Z((e,t)=>{if(s?.(e,t),!t.isCanceled&&(te(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(V)),!e&&_e.state.activeIndex!==null)){let e=ne.current[_e.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Oe=Z(()=>{pe(!1),_e.update({activeIndex:null,openMethod:null}),_?.(!1)});Ky({enabled:!h,open:H,ref:W,onComplete(){H||Oe()}}),b.useImperativeHandle(h,()=>({unmount:Oe}),[Oe]);let ke=Z((e,t)=>{i?.(e,t),!t.isCanceled&&ee(e)}),Ae=Z(()=>{let e=_e.state.listElement||W.current;if(!e)return;let t=cj(e.scrollHeight,e.clientHeight),n=lj(e.scrollTop,t),r=n>0,i=n<t;_e.state.scrollUpArrowVisible!==r&&_e.set(`scrollUpArrowVisible`,r),_e.state.scrollDownArrowVisible!==i&&_e.set(`scrollDownArrowVisible`,i)}),je=nb({open:H,onOpenChange:De,elements:{reference:be,floating:xe}}),{getReferenceProps:Me,getFloatingProps:Ne,getItemProps:Pe}=hb([tv(je,{enabled:!f&&!z,event:`mousedown`}),cv(je,{bubbles:!1}),wb(je,{enabled:!f&&!z,listRef:ne,activeIndex:ve,selectedIndex:ye,disabledIndices:Qp,onNavigate(e){e===null&&!H||_e.set(`activeIndex`,e)},focusItemOnHover:T}),Db(je,{enabled:!f&&!z&&(H||!x),listRef:U,activeIndex:ve,selectedIndex:ye,onMatch(e){H?_e.set(`activeIndex`,e):ke(oe.current[e],Mm(`none`))},onTypingChange(e){se.current=e}})]),Fe=b.useMemo(()=>a_(Me(),ge,R?{id:R}:$p),[Me,ge,R]);$f(()=>{_e.update({popupProps:Ne(),triggerProps:Fe})}),X(()=>{_e.update({id:R,modal:m,multiple:x,value:V,open:H,mounted:fe,transitionStatus:me,popupProps:Ne(),triggerProps:Fe,items:v,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ce})},[_e,R,m,x,V,H,fe,me,Ne,Fe,v,S,C,w,Ce]);let Ie=b.useMemo(()=>({store:_e,name:B,required:p,disabled:z,readOnly:f,multiple:x,highlightItemOnHover:T,setValue:ke,setOpen:De,listRef:ne,popupRef:W,scrollHandlerRef:re,handleScrollArrowVisibility:Ae,scrollArrowsMountedCountRef:ie,getItemProps:Pe,events:je.context.events,valueRef:ae,valuesRef:oe,labelsRef:U,typingRef:se,selectionRef:ue,selectedItemTextRef:le,validation:I,onOpenChangeComplete:_,keyboardActiveRef:ce,alignItemWithTriggerActiveRef:de,initialValueRef:Ee}),[_e,B,p,z,f,x,T,ke,De,Pe,je.context.events,I,_,Ae]),Le=Lm(g,I.inputRef),Re=x&&Array.isArray(V)&&V.length>0,ze=x?void 0:B,Be=b.useMemo(()=>!x||!Array.isArray(V)||!B?null:V.map(e=>{let t=rj(e,C);return(0,y.jsx)(`input`,{type:`hidden`,form:l,name:B,value:t},t)}),[x,V,l,B,C]);return(0,y.jsx)(WA.Provider,{value:Ie,children:(0,y.jsxs)(GA.Provider,{value:je,children:[E,(0,y.jsx)(`input`,{...I.getInputValidationProps({onFocus(){_e.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented)return;let t=e.currentTarget.value,n=Mm(ym,e.nativeEvent);function r(){if(x)return;let e=oe.current.find(e=>rj(e,C).toLowerCase()===t.toLowerCase()||nj(e,S).toLowerCase()===t.toLowerCase());e!=null&&(O(e!==M.initialValue),ke(e,n),j()&&I.commit(e))}_e.set(`forceMount`,!0),queueMicrotask(r)}}),id:R&&ze==null?`${R}-hidden-input`:void 0,form:l,name:ze,autoComplete:u,value:we,disabled:z,required:p&&!Re,readOnly:f,ref:Le,style:B?Zm:Xm,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Be]})})}function dj(e,t){return e??t}function fj(e){let t=e.getBoundingClientRect(),n=np(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 pj=2,mj=400,hj=200,gj={...tx,...cS,value:()=>null},_j=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}=uS(),{labelId:m}=mS(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=KA(),T=p||C||a,E=My(h,oj.open),D=My(h,oj.value),O=My(h,oj.triggerProps),k=My(h,oj.positionerElement),A=My(h,oj.listElement),j=My(h,oj.id),M=My(h,oj.labelId),N=My(h,oj.hasSelectedValue),P=!N&&E,F=My(h,oj.hasNullItemLabel,P),I=i??j,L=dj(m,M);vS({id:I});let R=Um(k),z=b.useRef(null),{getButtonProps:B,buttonRef:V}=cx({disabled:T,native:o}),ee=Lm(t,z,V,Z(e=>{h.set(`triggerElement`,e)})),H=Kp(),te=Kp(),ne=Kp(),U=Kp();b.useEffect(()=>{if(E)return N||F?U.start(hj,()=>{_.current.allowUnselectedMouseUp=!0,ne.start(hj,()=>{_.current.allowSelectedMouseUp=!0})}):ne.start(mj,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{ne.clear(),U.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},te.clear()},[E,N,F,_,te,ne,U]);let W=b.useMemo(()=>A?.id??hh(k)?.id,[A,k]),re=a_(O,{id:I,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?W:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:ee,onFocus(e){u(!0),E&&S.current&&g(!1,Mm(ym,e.nativeEvent)),H.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){oh(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=zp(e.currentTarget);function n(e){if(!z.current)return;let t=e.target;if(oh(z.current,t)||oh(R.current,t)||t===z.current)return;let n=fj(z.current);e.clientX>=n.left-pj&&e.clientX<=n.right+pj&&e.clientY>=n.top-pj&&e.clientY<=n.bottom+pj||g(!1,Mm(Om,e))}te.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,B);re.role=`combobox`;let ie={...f,open:E,disabled:T,value:D,readOnly:y,placeholder:!N};return y_(`button`,e,{ref:[t,z],state:ie,stateAttributesMapping:gj,props:re})}),vj={value:()=>null},yj=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=KA(),u=My(c,oj.value),d=My(c,oj.items),f=My(c,oj.itemToStringLabel),p=My(c,oj.hasSelectedValue),m=!p&&a!=null&&i==null,h=My(c,oj.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?aj(u,d,f):ij(u,d,f)),y_(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:vj})}),bj=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o}=KA();return y_(`span`,e,{state:{open:My(o,oj.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:ex})}),xj=b.createContext(void 0),Sj=b.forwardRef(function(e,t){let{store:n}=KA(),r=My(n,oj.mounted),i=My(n,oj.forceMount);return r||i?(0,y.jsx)(xj.Provider,{value:!0,children:(0,y.jsx)(F_,{ref:t,...e})}):null}),Cj=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function wj(){return b.useContext(Cj)}function Tj(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),o=b.useRef(0),s=Vp(Dj).current,c=Vp(Ej).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(Oj).forEach((t,n)=>{let r=c.get(t)??{};e.set(t,{...r,index:n})}),e},[c,l]);X(()=>{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]),X(()=>{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]),X(()=>()=>{n.current=[]},[n]),X(()=>()=>{r&&(r.current=[])},[r]);let h=Z(e=>(s.add(e),()=>{s.delete(e)}));X(()=>{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)(Cj.Provider,{value:g,children:t})}function Ej(){return new Map}function Dj(){return new Set}function Oj(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 kj=b.createContext(void 0);function Aj(){return b.useContext(kj)?.direction??`ltr`}var jj=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`}=wh(e,t)||{};if(l==null)return{};let f=Hh(u),p={x:n,y:r},m=Ah(i),h=Oh(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=Ch(k,j,A),N=!c.arrow&&Eh(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}}}),Mj=(e,t)=>({...jj(e),options:[e,t]}),Nj={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 _y().fn(e)).data?.referenceHidden||a}}}},Pj={sideX:`left`,sideY:`top`},Fj={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=np(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:Pj};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=zp(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=Th(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`:Pj.sideX,g=f===`top`?`bottom`:Pj.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function Ij(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 Lj(e,t,n){let{rects:r,placement:i}=e;return{side:Ij(t,Th(i),n),align:Eh(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Rj(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=Um(t),j=Um(m),M=Aj()===`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`),R=+(r===`right`),z=+(r===`left`);typeof F==`number`?F={top:F+I,right:F+z,bottom:F+L,left:F+R}:F&&={top:(F.top||0)+I,right:(F.right||0)+z,bottom:(F.bottom||0)+L,left:(F.left||0)+R};let B={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:F},V=b.useRef(null),ee=Um(i),H=Um(o),te=[fy(e=>{let t=Lj(e,r,M),n=typeof ee.current==`function`?ee.current(t):ee.current,i=typeof H.current==`function`?H.current(t):H.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,M,r])],ne=T===`none`&&w!==`shift`,U=!ne&&(l||g||w===`shift`),W=w===`none`?null:hy({...B,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}),re=ne?null:py(e=>{let t=zp(e.elements.floating).documentElement;return{...B,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:U,limiter:l||g?void 0:my(e=>{if(!V.current)return{};let{width:t,height:n}=V.current.getBoundingClientRect(),r=kh(Th(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})}},[B,l,g,F,T]);w===`shift`||T===`shift`||a===`center`?te.push(re,W):te.push(W,re),te.push(gy({...B,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=np(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`)}}),Mj(()=>({element:V.current||zp(V.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=Th(a),l=kh(c),u=V.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(Lj(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`,U&&l===`y`&&b?S:x),{}}},Nj,v),X(()=>{!m&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[m,p]);let ie=b.useMemo(()=>({elementResize:!d&&typeof ResizeObserver<`u`,layoutShift:!d&&typeof IntersectionObserver<`u`}),[d]),{refs:ae,elements:oe,x:se,y:ce,middlewareData:le,update:ue,placement:de,context:fe,isPositioned:pe,floatingStyles:me}=rb({rootContext:p,open:f?m:void 0,placement:P,middleware:te,strategy:n,whileElementsMounted:f?void 0:(...e)=>Qv(...e,ie),nodeId:_,externalTree:x}),{sideX:he,sideY:ge}=le.adaptiveOrigin||Pj,_e=pe?n:`fixed`,ve=b.useMemo(()=>{let e=v?{position:_e,[he]:se,[ge]:ce}:{position:_e,...me};return pe||(e.opacity=0),e},[v,_e,he,se,ge,ce,me,pe]),ye=b.useRef(null);X(()=>{if(!m)return;let e=A.current,t=typeof e==`function`?e():e,n=(zj(t)?t.current:t)||null;n!==ye.current&&(ae.setPositionReference(n),ye.current=n)},[m,ae,k,A]),b.useEffect(()=>{if(!m)return;let e=A.current;typeof e!=`function`&&zj(e)&&e.current!==ye.current&&(ae.setPositionReference(e.current),ye.current=e.current)},[m,ae,k,A]),b.useEffect(()=>{if(f&&m&&oe.domReference&&oe.floating)return Qv(oe.domReference,oe.floating,ue,ie)},[f,m,oe,ue,ie]);let be=Th(de),xe=Ij(r,be,M),Se=Eh(de)||`center`,Ce=!!le.hide?.referenceHidden;X(()=>{y&&m&&pe&&C(be)},[y,m,pe,be]);let we=b.useMemo(()=>({position:`absolute`,top:le.arrow?.y,left:le.arrow?.x}),[le.arrow]),Te=le.arrow?.centerOffset!==0;return b.useMemo(()=>({positionerStyles:ve,arrowStyles:we,arrowRef:V,arrowUncentered:Te,side:xe,align:Se,physicalSide:be,anchorHidden:Ce,refs:ae,context:fe,isPositioned:pe,update:ue}),[ve,we,V,Te,xe,Se,be,Ce,ae,fe,pe,ue])}function zj(e){return e!=null&&`current`in e}var Bj=b.createContext(void 0);function Vj(){let e=b.useContext(Bj);if(!e)throw Error(Xg(59));return e}function Hj(e,t){e&&Object.assign(e.style,t)}var Uj={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function Wj(e){return e===`starting`?T_:$p}function Gj(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),y_(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},Wj(r),i],stateAttributesMapping:nx})}var Kj=20;function qj(e,t,n,r){let[i,a]=b.useState(!1);X(()=>{if(!e||!t||n==null){a(!1);return}let r=zp(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-Kj)},[e,t,n]),cm(e&&(!t||i),r)}var Jj={position:`fixed`},Yj=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=D_,style:_,...v}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=KA(),A=qA(),j=My(x,oj.open),M=My(x,oj.mounted),N=My(x,oj.modal),P=My(x,oj.value),F=My(x,oj.openMethod),I=My(x,oj.positionerElement),L=My(x,oj.triggerElement),R=My(x,oj.isItemEqualToValue),z=My(x,oj.transitionStatus),B=b.useRef(null),V=b.useRef(null),[ee,H]=b.useState(h),te=M&&ee&&F!==`touch`;!M&&ee!==h&&H(h),X(()=>{M||(oj.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),oj.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),b.useImperativeHandle(w,()=>te),qj((te||N)&&j,F===`touch`,I,L);let ne=Rj({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??te,collisionAvoidance:g,keepMounted:!0}),U=te?`none`:ne.side,W=te?Jj:ne.positionerStyles,re=Gj(e,{open:j,side:U,align:ne.align,anchorHidden:ne.anchorHidden},{styles:W,transitionStatus:z,props:v,refs:[t,Z(e=>{x.set(`positionerElement`,e)})],hidden:!M,inert:!j}),ie=b.useRef(0),ae=Z(e=>{if(e.size===0&&ie.current===0||E.current.length===0)return;let t=ie.current;if(ie.current=e.size,e.size===t)return;let n=Mm(ym);if(t!==0&&!x.state.multiple&&P!==null&&ZA(E.current,P,R)===-1){let e=D.current,t=e!=null&&ZA(E.current,e,R)!==-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=>ZA(E.current,e,R)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!XA(P,e,R)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&te){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};Hj(I,e),Hj(O.current,e)}}),oe=b.useMemo(()=>({...ne,side:U,alignItemWithTriggerActive:te,setControlledAlignItemWithTrigger:H,scrollUpArrowRef:B,scrollDownArrowRef:V}),[ne,U,te,H]);return(0,y.jsx)(Tj,{elementsRef:S,labelsRef:C,onMapChange:ae,children:(0,y.jsxs)(Bj.Provider,{value:oe,children:[M&&N&&(0,y.jsx)(kx,{inert:Ox(!j),cutout:L}),re]})})}),Xj=`base-ui-disable-scrollbar`,Zj={className:Xj,getElement(e){return(0,y.jsx)(`style`,{nonce:e,href:Xj,precedence:`base-ui:low`,children:`.${Xj}{scrollbar-width:none}.${Xj}::-webkit-scrollbar{display:none}`})}},Qj=b.createContext(void 0);function $j(e){let t=b.useContext(Qj);if(t===void 0&&!e)throw Error(Xg(69));return t}var eM=b.createContext(void 0),tM={disableStyleElements:!1};function nM(){return b.useContext(eM)??tM}var rM={...nx,...Wy},iM=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}=KA(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=Vj(),O=$j(!0)!=null,k=qA(),A=Aj(),{nonce:j,disableStyleElements:M}=nM(),N=My(s,oj.id),P=My(s,oj.open),F=My(s,oj.mounted),I=My(s,oj.popupProps),L=My(s,oj.transitionStatus),R=My(s,oj.triggerElement),z=My(s,oj.positionerElement),B=My(s,oj.listElement),V=b.useRef(!1),ee=b.useRef(!1),H=b.useRef({}),te=Xp(),ne=Z(e=>{if(!z||!c.current||!ee.current)return;if(V.current||!C){h();return}let t=z.style.top===`0px`,n=z.style.bottom===`0px`;if(!t&&!n){h();return}let r=sM(z),i=cM(z.getBoundingClientRect().height,`y`,r),a=zp(z),o=getComputedStyle(z),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=aM(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=oM(e),m=0,g=null,_=!1,v=!1,y=e=>{z.style.height=`${e}px`},b=(t,n)=>{let r=sj(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(V.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=oM(e),n=v?t:sj(g,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(V.current=!0),h()});b.useImperativeHandle(g,()=>ne,[ne]),Ky({open:P,ref:c,onComplete(){P&&l?.(!0)}});let U={open:P,transitionStatus:L,side:x,align:S};X(()=>{!z||!c.current||Object.keys(H.current).length||(H.current={top:z.style.top||`0`,left:z.style.left||`0`,right:z.style.right,height:z.style.height,bottom:z.style.bottom,minHeight:z.style.minHeight,maxHeight:z.style.maxHeight,marginTop:z.style.marginTop,marginBottom:z.style.marginBottom})},[c,z]),X(()=>{P||C||(ee.current=!1,V.current=!1,Hj(z,H.current))},[P,C,z,c]),X(()=>{let e=c.current;if(!P||!R||!z||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){ee.current=!0,te.request(h),e.style.removeProperty(`--transform-origin`);return}let t=dM(e);e.style.removeProperty(`--transform-origin`);try{let t=f.current,n=d.current,r=getComputedStyle(z),i=getComputedStyle(e),a=zp(R),o=np(z),c=sM(R),l=lM(R.getBoundingClientRect(),c),u=lM(z.getBoundingClientRect(),c),p=l.height,m=B||e,g=m.scrollHeight,y=parseFloat(i.borderBottomWidth),b=parseFloat(r.marginTop)||10,x=parseFloat(r.marginBottom)||10,S=parseFloat(r.minHeight)||100,C=aM(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=lM(n.getBoundingClientRect(),c);O=lM(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;z.style.left=`${sj(k,5,I-u.width)}px`,z.style.height=`${N}px`,z.style.maxHeight=`auto`,z.style.marginTop=`${b}px`,z.style.marginBottom=`${x}px`,e.style.height=`100%`;let L=oM(m),te=F>=L-1;te&&(N=Math.min(w,u.height)-(F-L));let ne=l.top<20||l.bottom>w-20||Math.ceil(N)+1<Math.min(g,S),U=(o.visualViewport?.scale??1)!==1&&Ap;if(ne||U){ee.current=!0,Hj(z,H.current),T(!1);return}let W=Math.max(S,N);if(te){let e=Math.max(0,w-M);z.style.top=u.height>=P?`0`:`${e}px`,z.style.height=`${N}px`,m.scrollTop=oM(m)}else z.style.bottom=`0`,m.scrollTop=F;if(O){let t=u.top,n=u.height,r=O.top+O.height/2,i=sj(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(W===w||N>=C)&&(V.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),ee.current=!0}finally{t()}},[s,P,z,R,d,f,c,h,C,T,te,E,D,B,_,v,A,w]),b.useEffect(()=>{if(!C||!z||!P)return;let e=np(z);function t(e){u(!1,Mm(jm,e))}return Tp(e,`resize`,t)},[u,C,z,P]);let W={...B?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(e){p.current=!0,O&&Tx.has(e.key)&&e.stopPropagation()},onMouseMove(){p.current=!1},onScroll(e){B||ne(e.currentTarget)},...C&&{style:B?{height:`100%`}:Uj}},re=y_(`div`,e,{ref:[t,c],state:U,stateAttributesMapping:rM,props:[I,W,Wj(L),{className:!B&&C?Zj.className:void 0},o]});return(0,y.jsxs)(b.Fragment,{children:[!M&&Zj.getElement(j),(0,y.jsx)(ev,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:re})]})});function aM(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function oM(e){return cj(e.scrollHeight,e.clientHeight)}function sM(e){return Yv.getScale(e)}function cM(e,t,n){return e/n[t]}function lM(e,t){return Uh({x:cM(e.x,`x`,t),y:cM(e.y,`y`,t),width:cM(e.width,`x`,t),height:cM(e.height,`y`,t)})}var uM=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function dM(e){let{style:t}=e,n={};for(let[e,r]of uM)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of uM){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var fM=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=KA(),{alignItemWithTriggerActive:c}=Vj(),l=My(o,oj.hasScrollArrows),u=My(o,oj.openMethod),d=My(o,oj.multiple),f={id:`${My(o,oj.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:Uj},className:l&&u!==`touch`?Zj.className:void 0};return y_(`div`,e,{ref:[t,Z(e=>{o.set(`listElement`,e)})],props:[f,a]})}),pM=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function mM(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}=wj(),f=b.useRef(-1),[p,m]=b.useState(a??(i===pM.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 X(()=>{if(a!=null)return;let e=h.current;if(e)return o(e,n),()=>{s(e)}},[a,o,s,n]),X(()=>{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 hM=b.createContext(void 0);function gM(){let e=b.useContext(hM);if(!e)throw Error(Xg(57));return e}var _M=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=mM({label:a,textRef:u,indexGuessBehavior:pM.GuessFromOrder}),{store:f,getItemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:x,selectedItemTextRef:S}=KA(),C=My(f,oj.isActive,d.index),w=My(f,oj.isSelected,d.index,i),T=My(f,oj.isSelectedByFocus,d.index),E=My(f,oj.isItemEqualToValue),D=d.index,O=D!==-1,k=b.useRef(null),A=Um(D);X(()=>{if(!O)return;let e=v.current;return e[D]=i,()=>{delete e[D]}},[O,D,i,v]),X(()=>{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&&YA(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}=cx({disabled:o,focusableWhenDisabled:!0,native:s,composite:!0});function R(e){let t=f.state.value;if(x){let n=Array.isArray(t)?t:[];h(w?QA(n,i,E):[...n,i],Mm(wm,e))}else h(i,Mm(wm,e)),m(!1,Mm(wm,e))}let z={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,R(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()}},B=y_(`div`,e,{ref:[L,t,d.ref,k],state:j,props:[M,z,l,I]}),V=b.useMemo(()=>({selected:w,indexRef:A,textRef:u,selectedByFocus:T,hasRegistered:O}),[w,A,u,T,O]);return(0,y.jsx)(hM.Provider,{value:V,children:B})})),vM=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=gM();return n||r?(0,y.jsx)(yM,{...e,ref:t}):null}),yM=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=gM(),c=b.useRef(null),{transitionStatus:l,setMounted:u}=By(s),d=y_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:Wy});return Ky({open:s,ref:c,onComplete(){s||u(!1)}}),d})),bM=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=gM(),{selectedItemTextRef:o}=KA(),{className:s,render:c,style:l,...u}=e;return y_(`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})})),xM=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}=KA(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=Vj(),_=My(l,c?oj.scrollUpArrowVisible:oj.scrollDownArrowVisible),v=My(l,oj.openMethod),y=_&&v!==`touch`,b=Kp(),x=c?g:h,{transitionStatus:S,setMounted:C}=By(y);X(()=>(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]),Ky({open:y,ref:x,onComplete(){y||C(!1)}});let w=y_(`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=cj(e.scrollHeight,e.clientHeight),r=lj(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=SM(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 SM(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?lj(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?lj(l.offsetTop+l.offsetHeight-r+i,a):a}var CM=b.forwardRef(function(e,t){return(0,y.jsx)(xM,{...e,ref:t,direction:`down`})}),wM=b.forwardRef(function(e,t){return(0,y.jsx)(xM,{...e,ref:t,direction:`up`})}),TM=uj;function EM({className:e,...t}){return(0,y.jsx)(yj,{"data-slot":`select-value`,className:Qf(`flex flex-1 text-left`,e),...t})}function DM({className:e,size:t=`default`,children:n,...r}){return(0,y.jsxs)(_j,{"data-slot":`select-trigger`,"data-size":t,className:Qf(`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)(bj,{render:(0,y.jsx)(fd,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function OM({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)(Sj,{children:(0,y.jsx)(Yj,{side:r,sideOffset:i,align:a,alignOffset:o,alignItemWithTrigger:s,className:`isolate z-50`,children:(0,y.jsxs)(iM,{"data-slot":`select-content`,"data-align-trigger":s,className:Qf(`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)(AM,{}),(0,y.jsx)(fM,{children:t}),(0,y.jsx)(jM,{}),n]})})})}function kM({className:e,children:t,...n}){return(0,y.jsxs)(_M,{"data-slot":`select-item`,className:Qf(`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)(bM,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(vM,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(dd,{className:`pointer-events-none`})})]})}function AM({className:e,...t}){return(0,y.jsx)(wM,{"data-slot":`select-scroll-up-button`,className:Qf(`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)(pd,{})})}function jM({className:e,...t}){return(0,y.jsx)(CM,{"data-slot":`select-scroll-down-button`,className:Qf(`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)(fd,{})})}var MM=`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`,NM=`max-h-72 w-(--anchor-width) origin-(--transform-origin) gap-0 overflow-x-hidden p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,PM=`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`,FM=({value:e,items:t,ariaLabel:n,placeholder:r,onValueChange:i,open:a,onOpenChange:o,onItemHover:s,triggerClassName:c,triggerStyle:l,footerSlot:u})=>{let d=t.find(t=>t.id===e),f=d?.itemStyle?{...d.itemStyle,...l}:l;return(0,y.jsxs)(TM,{value:e,onValueChange:i,open:a,onOpenChange:o,children:[(0,y.jsx)(DM,{size:`sm`,"aria-label":n,className:Qf(MM,`w-full`,c),style:f,children:(0,y.jsx)(EM,{placeholder:r,children:()=>d?.label||r})}),(0,y.jsx)(OM,{alignItemWithTrigger:!1,sideOffset:4,className:Qf(NM,Mx,Nx),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)(kM,{value:e.id,className:PM,style:e.itemStyle,onPointerEnter:s?()=>s(e.id):void 0,onFocus:s?()=>s(e.id):void 0,children:e.label},e.id))})]})};function IM(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=yS({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=By(o,!0,!0),[d,f]=b.useState(o),[{height:p,width:m},h]=b.useState({height:void 0,width:void 0}),g=dx(),[_,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=Gy(O,!1),A=Z(e=>{let t=!o,n=Mm(bm,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 X(()=>{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 LM=b.createContext(void 0);function RM(){let e=b.useContext(LM);if(e===void 0)throw Error(Xg(15));return e}var zM=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Vy.startingStyle]=`startingStyle`,e[e.endingStyle=Vy.endingStyle]=`endingStyle`,e}({}),BM=function(e){return e.panelOpen=`data-panel-open`,e}({}),VM={[zM.open]:``},HM={[zM.closed]:``},UM={open(e){return e?{[BM.panelOpen]:``}:null}},WM={open(e){return e?VM:HM},...Wy},GM=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=IM({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=y_(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:WM});return(0,y.jsx)(LM.Provider,{value:p,children:m})}),KM={...UM,...Wy},qM=b.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=RM(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=cx({disabled:c,focusableWhenDisabled:!0,native:d}),g=b.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return y_(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:KM})}),JM=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function YM(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=Xp(),E=b.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=Lm(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(JM.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=Yp.request(()=>{w.current=!1,r=Yp.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{Yp.cancel(t),Yp.cancel(r)}}));return X(()=>{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(zM.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=Yp.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=zM.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()=>{Yp.cancel(r)}},[t,n,T,a,o,c,u,d,f,p,m]),X(()=>{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]),Up(()=>{let e=Yp.request(()=>{C.current=!1});return()=>Yp.cancel(e)}),X(()=>{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=Yp.request(()=>{x.current=!1,n=Yp.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{Yp.cancel(t),Yp.cancel(n)}},[a,u,d,p]),X(()=>{let e=d.current;e&&a&&E&&(e.setAttribute(`hidden`,`until-found`),n.current===`css-transition`&&e.setAttribute(zM.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,Mm(ym,e))}return Tp(e,`beforematch`,t)},[l,d,h]),b.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var XM=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),ZM=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}=RM(),j=r??!1,M=i??!1;X(()=>{if(o)return C(o),()=>{C(void 0)}},[o,C]),X(()=>{y(j)},[y,j]),X(()=>{x(M)},[x,M]);let{props:N}=YM({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});Ky({open:m&&A===`idle`,ref:g,onComplete(){m&&v({height:void 0,width:void 0})}});let P=y_(`div`,e,{state:b.useMemo(()=>({...E,transitionStatus:A}),[E,A]),ref:[t,g],props:[N,{style:{[XM.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[XM.collapsiblePanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:WM});return M||j||f?P:null});function QM({...e}){return(0,y.jsx)(GM,{"data-slot":`collapsible`,...e})}function $M({...e}){return(0,y.jsx)(qM,{"data-slot":`collapsible-trigger`,...e})}function eN({...e}){return(0,y.jsx)(ZM,{"data-slot":`collapsible-content`,...e})}function tN({className:e,...t}){return(0,y.jsx)(`label`,{"data-slot":`label`,className:Qf(`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})}function nN({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`field-group`,className:Qf(`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 rN=Ux(`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 iN({className:e,orientation:t=`vertical`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:Qf(rN({orientation:t}),e),...n})}function aN({className:e,...t}){return(0,y.jsx)(tN,{"data-slot":`field-label`,className:Qf(`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 oN=b.createContext(void 0);function sN(e){let t=b.useContext(oN);if(t===void 0&&!e)throw Error(Xg(47));return t}function cN(){return{...$y(),disabled:!1,modal:!1,focusManagerModal:!1,instantType:void 0,openMethod:null,openChangeReason:null,titleElementId:void 0,descriptionElementId:void 0,stickIfOpen:!0,nested:!1,openOnHover:!1,closeDelay:0,hasViewport:!1}}var lN={...tb,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),openMethod:Q(e=>e.openMethod),openChangeReason:Q(e=>e.openChangeReason),modal:Q(e=>e.modal),focusManagerModal:Q(e=>e.focusManagerModal),stickIfOpen:Q(e=>e.stickIfOpen),titleElementId:Q(e=>e.titleElementId),descriptionElementId:Q(e=>e.descriptionElementId),openOnHover:Q(e=>e.openOnHover),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},uN=class e extends Ly{constructor(e){let t={...cN(),...e};t.open&&e?.mounted===void 0&&(t.mounted=!0),super(t,{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerFocusTargetRef:b.createRef(),beforeContentFocusGuardRef:b.createRef(),stickIfOpenTimeout:new Gp,triggerElements:new Zy},lN)}setOpen=(e,t)=>{let n=t.reason===xm,r=t.reason===`trigger-press`&&t.event.detail===0,i=!e&&(t.reason===`escape-key`||t.reason==null);if(t.preventUnmountOnClose=()=>{this.set(`preventUnmountingOnClose`,!0)},this.context.onOpenChange?.(e,t),t.isCanceled)return;this.state.floatingRootContext.dispatchOpenChange(e,t);let a=()=>{let n={open:e,openChangeReason:t.reason},r=t.trigger?.id??null;(r||e)&&(n.activeTriggerId=r,n.activeTriggerElement=t.trigger??null),this.update(n)};n?(this.set(`stickIfOpen`,!0),this.context.stickIfOpenTimeout.start(500,()=>{this.set(`stickIfOpen`,!1)}),A_.flushSync(a)):a(),r||i?this.set(`instantType`,r?`click`:`dismiss`):t.reason===`focus-out`?this.set(`instantType`,`focus`):this.set(`instantType`,void 0)};static useStore(t,n){let r=Vp(()=>new e(n)).current,i=t??r;return Up(r.disposeEffect),i}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function dN({props:e}){let{children:t,open:n,defaultOpen:r=!1,onOpenChange:i,onOpenChangeComplete:a,modal:o=!1,handle:s,triggerId:c,defaultTriggerId:l=null}=e,u=uN.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});$f(()=>{n===void 0&&u.state.open===!1&&r===!0&&u.update({open:!0,activeTriggerId:l})}),u.useControlledProp(`openProp`,n),u.useControlledProp(`triggerIdProp`,c);let d=u.useState(`open`),f=u.useState(`payload`);u.useContextCallback(`onOpenChange`,i),u.useContextCallback(`onOpenChangeComplete`,a);let{openMethod:p,triggerProps:m}=Rb(d);Yy(u);let{forceUnmount:h}=Xy(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});b.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=b.useCallback(()=>{u.setOpen(!1,Mm(Am))},[u]);b.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=ib({popupStore:u,onOpenChange:u.setOpen}),{getReferenceProps:v,getFloatingProps:x,getTriggerProps:S}=hb([cv(_,{outsidePressEvent:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),Eb(_)]),C=b.useMemo(()=>v(m),[v,m]),w=b.useMemo(()=>S(m),[S,m]),T=b.useMemo(()=>x(),[x]);u.useSyncedValues({modal:o,openMethod:p,activeTriggerProps:C,inactiveTriggerProps:w,popupProps:T,floatingRootContext:_,nested:B_()!=null});let E=b.useMemo(()=>({store:u}),[u]);return(0,y.jsx)(oN.Provider,{value:E,children:typeof t==`function`?t({payload:f}):t})}function fN(e){return sN(!0)?(0,y.jsx)(dN,{props:e}):(0,y.jsx)(W_,{children:(0,y.jsx)(dN,{props:e})})}function pN(e,t){let n=b.useRef(null);return{preFocusGuardRef:n,handlePreFocusGuardFocus:Z(t=>{A_.flushSync(()=>{e.setOpen(!1,Mm(Tm,t.nativeEvent,t.currentTarget))}),Cg(n.current)?.focus()}),handleFocusTargetFocus:Z(n=>{let r=e.select(`positionerElement`);if(r&&wg(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{A_.flushSync(()=>{e.setOpen(!1,Mm(Tm,n.nativeEvent,n.currentTarget))});let i=Sg(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&oh(r,i);){let e=i;if(i=yg(i),i===e)break}i?.focus()}})}}var mN=b.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,handle:o,payload:s,openOnHover:c=!1,delay:l=300,closeDelay:u=0,id:d,style:f,...p}=e,m=sN(!0),h=o?.store??m?.store;if(!h)throw Error(Xg(74));let g=dx(d),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),x=h.useState(`isOpenedByTrigger`,g),S=b.useRef(null),{registerTrigger:C,isMountedByThisTrigger:w}=Jy(g,S,h,{payload:s,disabled:i,openOnHover:c,closeDelay:u}),T=h.useState(`openChangeReason`),E=h.useState(`stickIfOpen`),D=h.useState(`openMethod`),O=h.useState(`focusManagerModal`),k=mb(v,{enabled:v!=null&&c&&(D!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Fb(),restMs:l,delay:{close:u},triggerElementRef:S,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=hb([tv(v,{enabled:v!=null,stickIfOpen:E})]),j=h.useState(`triggerProps`,w),M={disabled:i,open:x},{getButtonProps:N,buttonRef:P}=cx({disabled:i,native:a}),F=b.useMemo(()=>({open(e){return e&&T===`trigger-press`?tx.open(e):ex.open(e)}}),[T]),I=y_(`button`,e,{state:M,ref:[P,t,C,S],props:[A.getReferenceProps(),k,j,{[E_]:``,id:g},p,N],stateAttributesMapping:F}),{preFocusGuardRef:L,handlePreFocusGuardFocus:R,handleFocusTargetFocus:z}=pN(h,S);return _&&!O?(0,y.jsxs)(b.Fragment,{children:[(0,y.jsx)(Qm,{ref:L,onFocus:R}),(0,y.jsx)(b.Fragment,{children:I},g),(0,y.jsx)(Qm,{ref:h.context.triggerFocusTargetRef,onFocus:z})]}):(0,y.jsx)(b.Fragment,{children:I},g)}),hN=b.createContext(void 0);function gN(){let e=b.useContext(hN);if(e===void 0)throw Error(Xg(45));return e}var _N=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=sN();return i.useState(`mounted`)||n?(0,y.jsx)(hN.Provider,{value:n,children:(0,y.jsx)(F_,{ref:t,...r})}):null}),vN=b.createContext(void 0);function yN(){let e=b.useContext(vN);if(!e)throw Error(Xg(46));return e}var bN=b.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,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=O_,style:g,..._}=e,{store:v}=sN(),x=gN(),S=H_(),C=v.useState(`floatingRootContext`),w=v.useState(`mounted`),T=v.useState(`open`),E=v.useState(`openChangeReason`),D=v.useState(`activeTriggerElement`),O=v.useState(`modal`),k=v.useState(`openMethod`),A=v.useState(`positionerElement`),j=v.useState(`instantType`),M=v.useState(`transitionStatus`),N=v.useState(`hasViewport`),P=b.useRef(null),F=Gy(A,!1,!1),I=Rj({anchor:i,floatingRootContext:C,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:x,nodeId:S,collisionAvoidance:h,adaptiveOrigin:N?Fj:void 0}),L=C.useState(`domReferenceElement`);X(()=>{let e=L,t=P.current;if(e&&(P.current=e),t&&e&&e!==t){v.set(`instantType`,void 0);let e=new AbortController;return F(()=>{v.set(`instantType`,`trigger-change`)},e.signal),()=>{e.abort()}}},[L,F,v]);let R={open:T,side:I.side,align:I.align,anchorHidden:I.anchorHidden,instant:j};qj(T&&O===!0&&E!==`trigger-hover`,k===`touch`,A,D);let z=b.useCallback(e=>{v.set(`positionerElement`,e)},[v]),B=Gj(e,R,{styles:I.positionerStyles,transitionStatus:M,props:_,refs:[t,z],hidden:!w,inert:!T});return(0,y.jsxs)(vN.Provider,{value:I,children:[w&&O===!0&&E!==`trigger-hover`&&(0,y.jsx)(kx,{ref:v.context.internalBackdropRef,inert:Ox(!T),cutout:D}),(0,y.jsx)(U_,{id:S,children:B})]})}),xN=b.createContext(void 0);function SN(){let[e,t]=b.useState(0),n=Z(()=>(t(e=>e+1),()=>{t(e=>Math.max(0,e-1))}));return{context:b.useMemo(()=>({register:n}),[n]),hasClosePart:e>0}}function CN(e){let{value:t,children:n}=e;return(0,y.jsx)(xN.Provider,{value:t,children:n})}var wN={...nx,...Wy},TN=b.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:a,style:o,...s}=e,{store:c}=sN(),l=yN(),u=$j(!0)!=null,{context:d,hasClosePart:f}=SN(),p=c.useState(`open`),m=c.useState(`openMethod`),h=c.useState(`instantType`),g=c.useState(`transitionStatus`),_=c.useState(`popupProps`),v=c.useState(`titleElementId`),x=c.useState(`descriptionElementId`),S=c.useState(`modal`),C=c.useState(`mounted`),w=c.useState(`openChangeReason`),T=c.useState(`activeTriggerElement`),E=c.useState(`floatingRootContext`);Ky({open:p,ref:c.context.popupRef,onComplete(){p&&c.context.onOpenChangeComplete?.(!0)}});let D=c.useState(`disabled`),O=c.useState(`openOnHover`),k=c.useState(`closeDelay`);fb(E,{enabled:O&&!D,closeDelay:k});function A(e){return e===`touch`?c.context.popupRef.current:!0}let j=i===void 0?A:i,M={open:p,side:l.side,align:l.align,instant:h,transitionStatus:g},N=S!==!1&&f;c.useSyncedValue(`focusManagerModal`,N);let P=b.useCallback(e=>{c.set(`popupElement`,e)},[c]),F=y_(`div`,e,{state:M,ref:[t,c.context.popupRef,P],props:[_,{"aria-labelledby":v,"aria-describedby":x,onKeyDown(e){u&&Tx.has(e.key)&&e.stopPropagation()}},Wj(g),s],stateAttributesMapping:wN});return(0,y.jsx)(ev,{context:E,openInteractionType:m,modal:N,disabled:!C||w===`trigger-hover`,initialFocus:j,returnFocus:a,restoreFocus:`popup`,previousFocusableElement:op(T)?T:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,y.jsx)(CN,{value:d,children:F})})});function EN({...e}){return(0,y.jsx)(fN,{"data-slot":`popover`,...e})}function DN({...e}){return(0,y.jsx)(mN,{"data-slot":`popover-trigger`,...e})}function ON({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,y.jsx)(_N,{children:(0,y.jsx)(bN,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,y.jsx)(TN,{"data-slot":`popover-content`,className:Qf(`z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 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),...a})})})}var kN=b.createContext(void 0);function AN(){let e=b.useContext(kN);if(e===void 0)throw Error(Xg(63));return e}var jN=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}({}),MN={...cS,checked(e){return e?{[jN.checked]:``}:{[jN.unchecked]:``}}},NN=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}=fS(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,shouldValidateOnChange:k,validationMode:A,disabled:j,name:M,validation:N}=uS(),{labelId:P}=mS(),F=j||m,I=M??l,L=Z(d),R=b.useRef(null),z=Lm(R,c,N.inputRef),B=b.useRef(null),V=dx(),ee=vS({id:s,implicit:!1,controlRef:B}),H=u?void 0:ee,[te,ne]=yS({controlled:n,default:!!i,name:`Switch`,state:`checked`});bS(B,{id:V,value:te}),X(()=>{R.current&&D(R.current.checked)},[R,D]),Lb(te,()=>{S(I),T(te!==E.initialValue),D(te),k()?N.commit(te):N.commit(te,!0)});let{getButtonProps:U,buttonRef:W}=cx({disabled:F,native:u}),re=hS(a,P,R,!u,H),ie={id:u?ee:V,role:`switch`,"aria-checked":te,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":re,onFocus(){F||O(!0)},onBlur(){let e=R.current;!e||F||(w(!0),O(!1),A===`onBlur`&&N.commit(e.checked))},onClick(e){f||F||(e.preventDefault(),R.current?.dispatchEvent(new PointerEvent(`click`,{bubbles:!0,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey})))}},ae=b.useMemo(()=>a_({checked:te,disabled:F,form:o,id:H,name:I,required:p,style:I?Zm:Xm,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:z,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(f){e.preventDefault();return}let t=e.currentTarget.checked,n=Mm(ym,e.nativeEvent);L?.(t,n),!n.isCanceled&&ne(t)},onFocus(){B.current?.focus()}},N.getInputValidationProps,_===void 0?$p:{value:_}),[te,F,o,z,H,I,L,f,p,ne,N,_]),oe=b.useMemo(()=>({...C,checked:te,disabled:F,readOnly:f,required:p}),[C,te,F,f,p]),se=y_(`span`,e,{state:oe,ref:[t,B,W],props:[ie,N.getValidationProps,x,U],stateAttributesMapping:MN});return(0,y.jsxs)(kN.Provider,{value:oe,children:[se,!te&&I&&g!==void 0&&(0,y.jsx)(`input`,{type:`hidden`,form:o,name:I,value:g}),(0,y.jsx)(`input`,{...ae,suppressHydrationWarning:!0})]})}),PN=b.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=uS(),s=AN();return y_(`span`,e,{state:{...o,...s},ref:t,stateAttributesMapping:MN,props:a})});function FN({className:e,size:t=`default`,...n}){return(0,y.jsx)(NN,{"data-slot":`switch`,"data-size":t,className:Qf(`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)(PN,{"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 IN=b.createContext(void 0);function LN(e){let t=b.useContext(IN);if(t===void 0&&!e)throw Error(Xg(72));return t}var RN={...tb,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),isInstantPhase:Q(e=>e.isInstantPhase),trackCursorAxis:Q(e=>e.trackCursorAxis),disableHoverablePopup:Q(e=>e.disableHoverablePopup),lastOpenChangeReason:Q(e=>e.openChangeReason),closeOnClick:Q(e=>e.closeOnClick),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)},zN=class e extends Ly{constructor(e){super({...BN(),...e},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Zy},RN)}setOpen=(e,t)=>{let n=t.reason,r=n===xm,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?A_.flushSync(o):o()};static useStore(t,n){let r=Vp(()=>new e(n)).current,i=t??r,a=ib({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=a,i}};function BN(){return{...$y(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var VN=Ey(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=zN.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});$f(()=>{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}),X(()=>{m&&t&&p.setOpen(!1,Mm(km))},[m,t,p]),p.useSyncedValue(`disabled`,t),Yy(p);let{forceUnmount:v,transitionStatus:x}=Xy(h,p),S=p.select(`floatingRootContext`),C=p.useState(`isInstantPhase`),w=p.useState(`instantType`),T=p.useState(`lastOpenChangeReason`),E=b.useRef(null);X(()=>{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]),X(()=>{h&&(g??p.set(`payload`,void 0))},[p,g,h]);let D=b.useCallback(()=>{p.setOpen(!1,Mm(Am))},[p]);b.useImperativeHandle(o,()=>({unmount:v,close:D}),[v,D]);let{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=hb([cv(S,{enabled:!t,referencePress:()=>p.select(`closeOnClick`)}),iv(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)(IN.Provider,{value:p,children:typeof f==`function`?f({payload:_}):f})}),HN=b.createContext(void 0);function UN(){return b.useContext(HN)}var WN=function(e){return e[e.popupOpen=Jb.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),GN=Dy(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=LN(!0),m=i?.store??p;if(!m)throw Error(Xg(82));let h=dx(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}=Jy(h,y,m,{payload:a,closeOnClick:c,closeDelay:S}),T=UN(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Fm(v,{open:_});m.useSyncedValue(`isInstantPhase`,D);let k=m.useState(`disabled`),A=o??k,j=m.useState(`trackCursorAxis`),M=m.useState(`disableHoverablePopup`),N=mb(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!M&&j!==`both`?Fb():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=ob(v,{enabled:!A}).reference,F={open:_},I=m.useState(`triggerProps`,w);return y_(`button`,e,{state:F,ref:[t,C,y],props:[N,P,I,{onPointerDown(){m.set(`closeOnClick`,c)},id:h,[WN.triggerDisabled]:A?``:void 0},f],stateAttributesMapping:ex})}),KN=b.createContext(void 0);function qN(){let e=b.useContext(KN);if(e===void 0)throw Error(Xg(70));return e}var JN=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=P_({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,y.jsxs)(b.Fragment,{children:[l,c&&A_.createPortal(n,c)]})}),YN=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return LN().useState(`mounted`)||n?(0,y.jsx)(KN.Provider,{value:n,children:(0,y.jsx)(JN,{ref:t,...r})}):null}),XN=b.createContext(void 0);function ZN(){let e=b.useContext(XN);if(e===void 0)throw Error(Xg(71));return e}var QN=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=O_,style:g,..._}=e,v=LN(),x=qN(),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=Rj({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`)?Fj:void 0}),A=Gj(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)(XN.Provider,{value:k,children:A})}),$N={...nx,...Wy},eP=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=LN(),{side:s,align:c}=ZN(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);Ky({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=o.useState(`disabled`),h=o.useState(`closeDelay`);return fb(p,{enabled:!m,closeDelay:h}),y_(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,Wj(d),a],stateAttributesMapping:$N})}),tP=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=LN(),s=o.useState(`open`),c=o.useState(`instantType`),{arrowRef:l,side:u,align:d,arrowUncentered:f,arrowStyles:p}=ZN();return y_(`div`,e,{state:{open:s,side:u,align:d,uncentered:f,instant:c},ref:[t,l],props:[{style:p,"aria-hidden":!0},a],stateAttributesMapping:nx})}),nP=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)(HN.Provider,{value:i,children:(0,y.jsx)(Pm,{delay:a,timeoutMs:r,children:e.children})})};function rP({delay:e=0,...t}){return(0,y.jsx)(nP,{"data-slot":`tooltip-provider`,delay:e,...t})}function iP({...e}){return(0,y.jsx)(VN,{"data-slot":`tooltip`,...e})}function aP({...e}){return(0,y.jsx)(GN,{"data-slot":`tooltip-trigger`,...e})}function oP({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,y.jsx)(YN,{children:(0,y.jsx)(QN,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,y.jsxs)(eP,{"data-slot":`tooltip-content`,className:Qf(`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)(tP,{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 sP=[{id:`block`,name:`Block`},{id:`bar`,name:`Bar`},{id:`underline`,name:`Underline`}],cP=`block`,lP=sP.map(e=>e.id),uP=e=>typeof e==`string`&&lP.includes(e),dP=e=>e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`),fP=`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,pP=`"Symbols Nerd Font"`,mP=(e,t)=>`"${dP(e)}"${t?`, ${pP}`:``}, ${fP}`,hP=(e,t,n)=>({id:e,name:t,family:mP(t,!0),source:n}),gP=hP(`geist-mono`,`Geist Mono`,`fontsource`),_P=hP(`jetbrains-mono`,`JetBrains Mono`,`google`),vP=hP(`fira-code`,`Fira Code`,`google`),yP=hP(`ibm-plex-mono`,`IBM Plex Mono`,`google`),bP=hP(`source-code-pro`,`Source Code Pro`,`google`),xP=hP(`roboto-mono`,`Roboto Mono`,`google`),SP=hP(`dm-mono`,`DM Mono`,`google`),CP=hP(`inconsolata`,`Inconsolata`,`google`),wP=hP(`space-mono`,`Space Mono`,`google`),TP=hP(`ubuntu-mono`,`Ubuntu Mono`,`google`),EP=[gP,hP(`anonymous-pro`,`Anonymous Pro`,`google`),SP,vP,yP,CP,_P,xP,bP,wP,TP];gP.id;var DP=e=>e?EP.find(t=>t.id===e)??gP:gP,OP=(e,t)=>mP(e.name,t),kP=()=>{let e=EP.filter(e=>e.source===`google`);return e.length===0?``:`https://fonts.googleapis.com/css2?${e.map(e=>`family=${e.name.replace(/ /g,`+`)}:wght@400;700`).join(`&`)}&display=swap`},AP=[{value:1e3,label:`1k lines`},{value:1e4,label:`10k lines`},{value:5e4,label:`50k lines`},{value:1e5,label:`100k lines`}],jP=1e4,MP=AP.map(e=>e.value),NP=e=>MP.includes(e),PP={id:`vesper`,name:`Vesper`,source:`raunofreiberg/vesper`,colors:{background:`#101010`,foreground:`#ffffff`,cursor:`#ffc799`,cursorAccent:`#101010`,selectionBackground:`#2a2a2a`,selectionForeground:`#ffffff`,black:`#101010`,red:`#ff8080`,green:`#99ffe4`,yellow:`#ffc799`,blue:`#a0a0a0`,magenta:`#ffc799`,cyan:`#99ffe4`,white:`#ffffff`,brightBlack:`#505050`,brightRed:`#ff9999`,brightGreen:`#b3ffe4`,brightYellow:`#ffd1a8`,brightBlue:`#b0b0b0`,brightMagenta:`#ffc799`,brightCyan:`#66ddcc`,brightWhite:`#ffffff`}},FP=[PP,{id:`ayu-mirage`,name:`Ayu Mirage`,source:`ayu-theme/vscode-ayu`,colors:{background:`#1f2430`,foreground:`#cccac2`,cursor:`#ffcc66`,cursorAccent:`#1f2430`,selectionBackground:`#34455a`,selectionForeground:`#cccac2`,black:`#171b24`,red:`#f28273`,green:`#87d96c`,yellow:`#fcca60`,blue:`#6acdff`,magenta:`#ddbbff`,cyan:`#93e2c8`,white:`#c7c7c7`,brightBlack:`#686868`,brightRed:`#f28779`,brightGreen:`#d5ff80`,brightYellow:`#ffcd66`,brightBlue:`#73d0ff`,brightMagenta:`#dfbfff`,brightCyan:`#95e6cb`,brightWhite:`#ffffff`}},{id:`catppuccin-frappe`,name:`Catppuccin Frappé`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#303446`,foreground:`#c6d0f5`,cursor:`#f2d5cf`,cursorAccent:`#232634`,selectionBackground:`#626880`,selectionForeground:`#c6d0f5`,black:`#51576d`,red:`#e78284`,green:`#a6d189`,yellow:`#e5c890`,blue:`#8caaee`,magenta:`#f4b8e4`,cyan:`#81c8be`,white:`#b5bfe2`,brightBlack:`#626880`,brightRed:`#e78284`,brightGreen:`#a6d189`,brightYellow:`#e5c890`,brightBlue:`#8caaee`,brightMagenta:`#f4b8e4`,brightCyan:`#81c8be`,brightWhite:`#a5adce`}},{id:`catppuccin-macchiato`,name:`Catppuccin Macchiato`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#24273a`,foreground:`#cad3f5`,cursor:`#f4dbd6`,cursorAccent:`#181926`,selectionBackground:`#5b6078`,selectionForeground:`#cad3f5`,black:`#494d64`,red:`#ed8796`,green:`#a6da95`,yellow:`#eed49f`,blue:`#8aadf4`,magenta:`#f5bde6`,cyan:`#8bd5ca`,white:`#b8c0e0`,brightBlack:`#5b6078`,brightRed:`#ed8796`,brightGreen:`#a6da95`,brightYellow:`#eed49f`,brightBlue:`#8aadf4`,brightMagenta:`#f5bde6`,brightCyan:`#8bd5ca`,brightWhite:`#a5adcb`}},{id:`catppuccin-mocha`,name:`Catppuccin Mocha`,source:`catppuccin/wezterm + style-guide`,colors:{background:`#1e1e2e`,foreground:`#cdd6f4`,cursor:`#f5e0dc`,cursorAccent:`#11111b`,selectionBackground:`#585b70`,selectionForeground:`#cdd6f4`,black:`#45475a`,red:`#f38ba8`,green:`#a6e3a1`,yellow:`#f9e2af`,blue:`#89b4fa`,magenta:`#f5c2e7`,cyan:`#94e2d5`,white:`#bac2de`,brightBlack:`#585b70`,brightRed:`#f38ba8`,brightGreen:`#a6e3a1`,brightYellow:`#f9e2af`,brightBlue:`#89b4fa`,brightMagenta:`#f5c2e7`,brightCyan:`#94e2d5`,brightWhite:`#a6adc8`}},{id:`dracula`,name:`Dracula`,source:`dracula/visual-studio-code`,colors:{background:`#282a36`,foreground:`#f8f8f2`,cursor:`#f8f8f2`,cursorAccent:`#282a36`,selectionBackground:`#44475a`,selectionForeground:`#f8f8f2`,black:`#21222c`,red:`#ff5555`,green:`#50fa7b`,yellow:`#f1fa8c`,blue:`#bd93f9`,magenta:`#ff79c6`,cyan:`#8be9fd`,white:`#f8f8f2`,brightBlack:`#6272a4`,brightRed:`#ff6e6e`,brightGreen:`#69ff94`,brightYellow:`#ffffa5`,brightBlue:`#d6acff`,brightMagenta:`#ff92df`,brightCyan:`#a4ffff`,brightWhite:`#ffffff`}},{id:`github-dark`,name:`GitHub Dark Default`,source:`primer/github-vscode-theme + @primer/primitives`,colors:{background:`#0d1117`,foreground:`#e6edf3`,cursor:`#e6edf3`,cursorAccent:`#0d1117`,selectionBackground:`#264f78`,selectionForeground:`#e6edf3`,black:`#484f58`,red:`#ff7b72`,green:`#3fb950`,yellow:`#d29922`,blue:`#58a6ff`,magenta:`#bc8cff`,cyan:`#39c5cf`,white:`#b1bac4`,brightBlack:`#6e7681`,brightRed:`#ffa198`,brightGreen:`#56d364`,brightYellow:`#e3b341`,brightBlue:`#79c0ff`,brightMagenta:`#d2a8ff`,brightCyan:`#56d4dd`,brightWhite:`#ffffff`}},{id:`gruvbox-dark`,name:`Gruvbox Dark (Medium)`,source:`jdinhify/vscode-theme-gruvbox`,colors:{background:`#282828`,foreground:`#ebdbb2`,cursor:`#ebdbb2`,cursorAccent:`#282828`,selectionBackground:`#504945`,selectionForeground:`#ebdbb2`,black:`#3c3836`,red:`#cc241d`,green:`#98971a`,yellow:`#d79921`,blue:`#458588`,magenta:`#b16286`,cyan:`#689d6a`,white:`#a89984`,brightBlack:`#928374`,brightRed:`#fb4934`,brightGreen:`#b8bb26`,brightYellow:`#fabd2f`,brightBlue:`#83a598`,brightMagenta:`#d3869b`,brightCyan:`#8ec07c`,brightWhite:`#ebdbb2`}},{id:`monokai`,name:`Monokai`,source:`vscode/extensions/theme-monokai`,colors:{background:`#272822`,foreground:`#f8f8f2`,cursor:`#f8f8f0`,cursorAccent:`#272822`,selectionBackground:`#878b91`,selectionForeground:`#f8f8f2`,black:`#333333`,red:`#c4265e`,green:`#86b42b`,yellow:`#b3b42b`,blue:`#6a7ec8`,magenta:`#8c6bc8`,cyan:`#56adbc`,white:`#e3e3dd`,brightBlack:`#666666`,brightRed:`#f92672`,brightGreen:`#a6e22e`,brightYellow:`#e2e22e`,brightBlue:`#819aff`,brightMagenta:`#ae81ff`,brightCyan:`#66d9ef`,brightWhite:`#f8f8f2`}},{id:`night-owl`,name:`Night Owl`,source:`sdras/night-owl-vscode-theme`,colors:{background:`#011627`,foreground:`#d6deeb`,cursor:`#80a4c2`,cursorAccent:`#011627`,selectionBackground:`#1b90dd`,selectionForeground:`#d6deeb`,black:`#011627`,red:`#ef5350`,green:`#22da6e`,yellow:`#c5e478`,blue:`#82aaff`,magenta:`#c792ea`,cyan:`#21c7a8`,white:`#ffffff`,brightBlack:`#575656`,brightRed:`#ef5350`,brightGreen:`#22da6e`,brightYellow:`#ffeb95`,brightBlue:`#82aaff`,brightMagenta:`#c792ea`,brightCyan:`#7fdbca`,brightWhite:`#ffffff`}},{id:`nord`,name:`Nord`,source:`arcticicestudio/nord-visual-studio-code`,colors:{background:`#2e3440`,foreground:`#d8dee9`,cursor:`#d8dee9`,cursorAccent:`#2e3440`,selectionBackground:`#434c5e`,selectionForeground:`#eceff4`,black:`#3b4252`,red:`#bf616a`,green:`#a3be8c`,yellow:`#ebcb8b`,blue:`#81a1c1`,magenta:`#b48ead`,cyan:`#88c0d0`,white:`#e5e9f0`,brightBlack:`#4c566a`,brightRed:`#bf616a`,brightGreen:`#a3be8c`,brightYellow:`#ebcb8b`,brightBlue:`#81a1c1`,brightMagenta:`#b48ead`,brightCyan:`#8fbcbb`,brightWhite:`#eceff4`}},{id:`one-dark-pro`,name:`One Dark Pro`,source:`Binaryify/OneDark-Pro`,colors:{background:`#282c34`,foreground:`#abb2bf`,cursor:`#abb2bf`,cursorAccent:`#282c34`,selectionBackground:`#3e4452`,selectionForeground:`#abb2bf`,black:`#3f4451`,red:`#e05561`,green:`#8cc265`,yellow:`#d18f52`,blue:`#4aa5f0`,magenta:`#c162de`,cyan:`#42b3c2`,white:`#d7dae0`,brightBlack:`#4f5666`,brightRed:`#ff616e`,brightGreen:`#a5e075`,brightYellow:`#f0a45d`,brightBlue:`#4dc4ff`,brightMagenta:`#de73ff`,brightCyan:`#4cd1e0`,brightWhite:`#e6e6e6`}},{id:`solarized-dark`,name:`Solarized Dark`,source:`vscode/extensions/theme-solarized-dark`,colors:{background:`#002b36`,foreground:`#839496`,cursor:`#d30102`,cursorAccent:`#002b36`,selectionBackground:`#274642`,selectionForeground:`#93a1a1`,black:`#073642`,red:`#dc322f`,green:`#859900`,yellow:`#b58900`,blue:`#268bd2`,magenta:`#d33682`,cyan:`#2aa198`,white:`#eee8d5`,brightBlack:`#002b36`,brightRed:`#cb4b16`,brightGreen:`#586e75`,brightYellow:`#657b83`,brightBlue:`#839496`,brightMagenta:`#6c71c4`,brightCyan:`#93a1a1`,brightWhite:`#fdf6e3`}},{id:`synthwave-84`,name:`SynthWave '84`,source:`robb0wen/synthwave-vscode`,colors:{background:`#262335`,foreground:`#ffffff`,cursor:`#03edf9`,cursorAccent:`#262335`,selectionBackground:`#463465`,selectionForeground:`#ffffff`,black:`#2a2139`,red:`#fe4450`,green:`#72f1b8`,yellow:`#f3e70f`,blue:`#03edf9`,magenta:`#ff7edb`,cyan:`#03edf9`,white:`#ffffff`,brightBlack:`#495495`,brightRed:`#fe4450`,brightGreen:`#72f1b8`,brightYellow:`#fede5d`,brightBlue:`#03edf9`,brightMagenta:`#ff7edb`,brightCyan:`#03edf9`,brightWhite:`#ffffff`}},{id:`tokyo-night`,name:`Tokyo Night`,source:`enkia/tokyo-night-vscode-theme`,colors:{background:`#1a1b26`,foreground:`#a9b1d6`,cursor:`#c0caf5`,cursorAccent:`#1a1b26`,selectionBackground:`#515c7e`,selectionForeground:`#c0caf5`,black:`#363b54`,red:`#f7768e`,green:`#73daca`,yellow:`#e0af68`,blue:`#7aa2f7`,magenta:`#bb9af7`,cyan:`#7dcfff`,white:`#787c99`,brightBlack:`#363b54`,brightRed:`#f7768e`,brightGreen:`#73daca`,brightYellow:`#e0af68`,brightBlue:`#7aa2f7`,brightMagenta:`#bb9af7`,brightCyan:`#7dcfff`,brightWhite:`#acb0d0`}},{id:`tokyo-night-storm`,name:`Tokyo Night Storm`,source:`enkia/tokyo-night-vscode-theme`,colors:{background:`#24283b`,foreground:`#a9b1d6`,cursor:`#c0caf5`,cursorAccent:`#24283b`,selectionBackground:`#6f7bb6`,selectionForeground:`#c0caf5`,black:`#414868`,red:`#f7768e`,green:`#73daca`,yellow:`#e0af68`,blue:`#7aa2f7`,magenta:`#bb9af7`,cyan:`#7dcfff`,white:`#8089b3`,brightBlack:`#414868`,brightRed:`#f7768e`,brightGreen:`#73daca`,brightYellow:`#e0af68`,brightBlue:`#7aa2f7`,brightMagenta:`#bb9af7`,brightCyan:`#7dcfff`,brightWhite:`#a9b1d6`}}];PP.id;var IP=e=>e?FP.find(t=>t.id===e)??PP:PP,LP=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,RP=`text-xs font-normal text-muted-foreground`,zP=Object.fromEntries(EP.map(e=>[e.id,{fontFamily:e.family}])),BP=FP.map(e=>({id:e.id,label:e.name})),VP=EP.map(e=>({id:e.id,label:e.name,itemStyle:zP[e.id]})),HP=sP.map(e=>({id:e.id,label:e.name})),UP=AP.map(e=>({id:String(e.value),label:e.label})),WP=e=>e.toFixed(1),GP=({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:RP,children:e}),(0,y.jsx)(`dd`,{title:n??t,className:Qf(`min-w-0 truncate text-right text-foreground/90`,r),children:t})]}),KP=({themeId:e,onThemeChange:t,onThemePreview:n,fontId:r,onFontChange:i,onFontPreview:a,nerdFontEnabled:o,onNerdFontEnabledChange:s,fontSize:c,onFontSizeChange:l,lineHeight:u,onLineHeightChange:d,paddingX:f,onPaddingXChange:p,paddingY:m,onPaddingYChange:h,cursorStyle:g,onCursorStyleChange:_,onCursorStylePreview:v,cursorBlink:x,onCursorBlinkChange:S,scrollback:C,onScrollbackChange:w,scrollOnUserInput:T,onScrollOnUserInputChange:E,notificationsPermission:D,onNotificationsPermissionRequest:O,sessionInfo:k,onPopoverOpenChange:A,onClose:j})=>{let[M,N]=(0,b.useState)(!1),[P,F]=(0,b.useState)(!1),I=(0,b.useRef)(null);return(0,y.jsxs)(EN,{open:M,onOpenChange:e=>{N(e),A?.(e),e||(F(!1),n?.(null),a?.(null),v?.(null),j?.())},children:[(0,y.jsx)(DN,{render:(0,y.jsx)(Gx,{variant:`ghost`,size:`icon-sm`,"aria-label":`terminal settings`,className:`hover:text-foreground`}),children:(0,y.jsx)(Cd,{})}),(0,y.jsx)(ON,{ref:I,side:`bottom`,align:`end`,sideOffset:8,className:Qf(`w-64 gap-0 overflow-hidden p-3`,Mx,Nx),children:(0,y.jsxs)(nN,{className:`gap-3`,children:[(0,y.jsxs)(iN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(aN,{className:LP,children:`Theme`}),(0,y.jsx)(FM,{value:e,items:BP,ariaLabel:`select theme`,placeholder:`Theme`,onValueChange:e=>{e&&t(e)},onOpenChange:e=>{e||n?.(null)},onItemHover:n?e=>n(e):void 0})]}),(0,y.jsx)(PA,{className:`bg-border/40`}),(0,y.jsxs)(iN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(aN,{className:LP,children:`Font`}),(0,y.jsx)(FM,{value:r,items:VP,ariaLabel:`select font`,placeholder:`Font`,open:P,onValueChange:e=>{e&&i(e)},onOpenChange:e=>{F(e),e||a?.(null)},onItemHover:a?e=>a(e):void 0}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:RP,children:`Size`}),(0,y.jsx)(HA,{value:c,min:9,max:24,step:1,ariaLabel:`terminal font size`,decrementAriaLabel:`decrease font size`,incrementAriaLabel:`increase font size`,onValueChange:l})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:RP,children:`Line height`}),(0,y.jsx)(HA,{value:u,min:1,max:2,step:PS,ariaLabel:`terminal line height`,decrementAriaLabel:`decrease line height`,incrementAriaLabel:`increase line height`,formatDisplay:WP,onValueChange:d})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(iP,{children:[(0,y.jsx)(aP,{render:(0,y.jsx)(`span`,{className:RP}),children:`Nerd Font icons`}),(0,y.jsx)(oP,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`Appends a Symbols Only Nerd Font to the font stack. Icon glyphs (Private Use Area codepoints) are resolved by the symbols font while all other characters render from the primary font above.`})]}),(0,y.jsx)(FN,{"aria-label":`toggle nerd font icons`,checked:o,onCheckedChange:s})]})]}),(0,y.jsx)(PA,{className:`bg-border/40`}),(0,y.jsxs)(iN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(aN,{className:LP,children:`Window`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:RP,children:`Pad X`}),(0,y.jsx)(HA,{value:f,min:0,max:48,step:1,ariaLabel:`terminal horizontal padding`,decrementAriaLabel:`decrease horizontal padding`,incrementAriaLabel:`increase horizontal padding`,onValueChange:p})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:RP,children:`Pad Y`}),(0,y.jsx)(HA,{value:m,min:0,max:48,step:1,ariaLabel:`terminal vertical padding`,decrementAriaLabel:`decrease vertical padding`,incrementAriaLabel:`increase vertical padding`,onValueChange:h})]})]}),(0,y.jsx)(PA,{className:`bg-border/40`}),(0,y.jsxs)(iN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(aN,{className:LP,children:`Notifications`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(iP,{children:[(0,y.jsx)(aP,{render:(0,y.jsx)(`span`,{className:RP}),children:`Desktop alerts`}),(0,y.jsx)(oP,{side:`bottom`,sideOffset:8,className:`max-w-xs`,children:`When on, OSC 9 sequences from the shell trigger browser notifications. Enable to receive alerts when the tab is in the background. Blocked permissions must be changed in browser settings.`})]}),(0,y.jsx)(FN,{"aria-label":`toggle desktop notifications`,checked:D===`granted`,disabled:D===`unsupported`||D===`denied`,onCheckedChange:e=>{e&&O()}})]})]}),(0,y.jsx)(PA,{className:`bg-border/40`}),(0,y.jsxs)(iN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(aN,{className:LP,children:`Cursor`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:RP,children:`Style`}),(0,y.jsx)(FM,{value:g,items:HP,ariaLabel:`select cursor style`,placeholder:`Cursor style`,triggerClassName:`w-fit min-w-[7rem]`,onValueChange:e=>{uP(e)&&_(e)},onOpenChange:e=>{e||v?.(null)},onItemHover:v?e=>{uP(e)&&v?.(e)}:void 0})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:RP,children:`Blink`}),(0,y.jsx)(FN,{"aria-label":`toggle cursor blink`,checked:x,onCheckedChange:S})]})]}),(0,y.jsx)(PA,{className:`bg-border/40`}),(0,y.jsxs)(iN,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(aN,{className:LP,children:`Scrollback`}),(0,y.jsx)(FM,{value:String(C),items:UP,ariaLabel:`select scrollback`,placeholder:`Scrollback`,onValueChange:e=>{if(e===null)return;let t=Number(e);NP(t)&&w(t)}}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(iP,{children:[(0,y.jsx)(aP,{render:(0,y.jsx)(`span`,{className:RP}),children:`Pin to bottom on input`}),(0,y.jsx)(oP,{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)(FN,{"aria-label":`toggle pin to bottom on input`,checked:T,onCheckedChange:E})]})]}),k?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(PA,{className:`bg-border/40`}),(0,y.jsxs)(QM,{defaultOpen:!1,children:[(0,y.jsx)($M,{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:LP,children:`Shell`}),(0,y.jsx)(fd,{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)(eN,{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)(GP,{label:`Name`,value:k.shellName}),(0,y.jsx)(GP,{label:`Path`,value:k.shell,title:k.shell}),(0,y.jsx)(GP,{label:`PID`,value:String(k.pid),valueClassName:`tabular-nums`}),(0,y.jsx)(GP,{label:`Cwd`,value:k.cwd,title:k.cwd})]})})]})]}):null]})})]})},qP=e=>{let[t,n]=(0,b.useState)(null);return(0,b.useEffect)(()=>{if(n(null),!e)return;let t=!1,r=null,i=null,a=()=>{t||(r!==null&&window.clearTimeout(r),r=window.setTimeout(o,VS))},o=()=>{if(r!==null&&(window.clearTimeout(r),r=null),!t){if(document.hidden){a();return}i?.abort(),i=new AbortController,oA(e,i.signal).then(e=>{t||(e&&n(e),a())})}},s=()=>{document.hidden||o()};return document.addEventListener(`visibilitychange`,s),o(),()=>{t=!0,document.removeEventListener(`visibilitychange`,s),r!==null&&window.clearTimeout(r),i?.abort()}},[e]),t},JP=2.4,YP=.04045,XP=12.92,ZP=.055,QP=1.055,$P=.0031308,eF=24389/27,tF=216/24389,nF=.95047,rF=1,iF=1.08883,aF=.008856,oF=7.787,sF=e=>{let t=e/255;return t<=YP?t/XP:((t+ZP)/QP)**+JP},cF=e=>e<=0?0:e>=1?255:Math.round(e<=$P?XP*e*255:(QP*e**(1/JP)-ZP)*255),lF=e=>e>aF?Math.cbrt(e):oF*e+16/116,uF=e=>{let t=sF(e.r),n=sF(e.g),r=sF(e.b);return{x:.4124564*t+.3575761*n+.1804375*r,y:.2126729*t+.7151522*n+.072175*r,z:.0193339*t+.119192*n+.9503041*r}},dF=e=>{let t=3.2404542*e.x-1.5371385*e.y-.4985314*e.z,n=-.969266*e.x+1.8760108*e.y+.041556*e.z,r=.0556434*e.x-.2040259*e.y+1.0572252*e.z;return{r:cF(t),g:cF(n),b:cF(r)}},fF=e=>{let t=e.x/nF,n=e.y/rF,r=e.z/iF,i=lF(t),a=lF(n),o=lF(r);return{l:116*a-16,a:500*(i-a),b:200*(a-o)}},pF=(e,t)=>{let n=e*e*e;return n>tF?t*n:t*((116*e-16)/eF)},mF=e=>{let t=(e.l+16)/116,n=e.a/500+t,r=t-e.b/200;return{x:pF(n,nF),y:pF(t,rF),z:pF(r,iF)}},hF=e=>fF(uF(e)),gF=e=>dF(mF(e)),_F=e=>{let t=e.replace(/^#/,``);return{r:parseInt(t.slice(0,2),16),g:parseInt(t.slice(2,4),16),b:parseInt(t.slice(4,6),16)}},vF=e=>{let t=Math.max(0,Math.min(255,Math.round(e.r))),n=Math.max(0,Math.min(255,Math.round(e.g))),r=Math.max(0,Math.min(255,Math.round(e.b)));return`#${t.toString(16).padStart(2,`0`)}${n.toString(16).padStart(2,`0`)}${r.toString(16).padStart(2,`0`)}`},yF=e=>hF(_F(e)),bF=e=>vF(gF(e)),xF=6,SF=5,CF=24,wF=25,TF=(e,t,n)=>({l:t.l+e*(n.l-t.l),a:t.a+e*(n.a-t.a),b:t.b+e*(n.b-t.b)}),EF=(e,t=!1)=>{let n=e.background??`#000000`,r=e.foreground??`#ffffff`,i=[yF(n),yF(e.red??`#ff0000`),yF(e.green??`#00ff00`),yF(e.yellow??`#ffff00`),yF(e.blue??`#0000ff`),yF(e.magenta??`#ff00ff`),yF(e.cyan??`#00ffff`),yF(r)];if(i[7].l<i[0].l&&!t){let e=i[0];i[0]=i[7],i[7]=e}let a=[];for(let e=0;e<xF;e++){let t=TF(e/SF,i[0],i[1]),n=TF(e/SF,i[2],i[3]),r=TF(e/SF,i[4],i[5]),o=TF(e/SF,i[6],i[7]);for(let e=0;e<xF;e++){let i=TF(e/SF,t,n),s=TF(e/SF,r,o);for(let e=0;e<xF;e++){let t=TF(e/SF,i,s);a.push(bF(t))}}}for(let e=0;e<CF;e++){let t=(e+1)/wF;a.push(bF(TF(t,i[0],i[7])))}return a},DF=`Symbols Nerd Font`,OF=``,kF=async e=>{if(!(typeof document>`u`)&&e.name)try{await document.fonts.ready;let t=[document.fonts.load(`16px "${e.name}"`),document.fonts.load(`bold 16px "${e.name}"`),document.fonts.load(`16px "${DF}"`,OF),document.fonts.load(`bold 16px "${DF}"`,OF)];await Promise.all(t)}catch{}},AF=(e,t)=>`\x1b[${e};${t+1}u`,jF=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},MF=[[127995,127999],[128732,128735],[129008,129008],[129401,129401],[129484,129484],[129653,129655],[129659,129660],[129671,129672],[129705,129711],[129719,129725],[129727,129727],[129731,129733],[129742,129743],[129751,129755],[129760,129768],[129776,129784]],NF=e=>{if(e<127995||e>129784)return!1;for(let[t,n]of MF)if(e>=t&&e<=n)return!0;return!1},PF=6,FF=4,IF=class{version=`15-graphemes-emoji`;base;constructor(e){this.base=e}wcwidth(e){return NF(e)?2:this.base.wcwidth(e)}charProperties(e,t){let n=this.base.charProperties(e,t);return NF(e)?n&~PF|FF:n}},LF=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),RF=(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=t.baseY-r-t.viewportY;n!==0&&e.scrollLines(n)}catch{}return!0},zF=(e,t)=>`\r\n\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,BF={block:{blink:`\x1B[1 q`,steady:`\x1B[2 q`},underline:{blink:`\x1B[3 q`,steady:`\x1B[4 q`},bar:{blink:`\x1B[5 q`,steady:`\x1B[6 q`}},VF=(e,t)=>{let n=t?`blink`:`steady`;return`\x1b[?25h${BF[e][n]}`},HF=(e,t)=>`${VF(e,t)}\r\n\x1b[2;32m[reconnected]\x1b[0m\r\n\r\n`,UF=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,WF=55296,GF=56319,KF=(e,t)=>{if(e.length<=t)return[e];let n=[],r=0;for(;r<e.length;){let i=Math.min(r+t,e.length);if(i<e.length){let t=e.charCodeAt(i-1);t>=WF&&t<=GF&&--i}i===r&&(i=r+t),n.push(e.slice(r,i)),r=i}return n},qF=(e,t)=>{if(t.wasAtBottom){e.scrollToBottom();return}let n=e.buffer.active;if(t.distanceFromBottom>n.baseY){e.scrollToBottom();return}let r=n.baseY-t.distanceFromBottom-n.viewportY;r!==0&&e.scrollLines(r)},JF=new class{terminal=null;chunks=[];scheduled=!1;afterFlush=null;attach(e){this.terminal=e}setAfterFlush(e){this.afterFlush=e}detach(){this.flush(),this.terminal=null,this.afterFlush=null}push(e){this.chunks.push(e),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush()))}flush(){this.scheduled=!1;let e=this.chunks,t=this.terminal;this.chunks=[],!(!t||e.length===0)&&(e.length===1?t.write(e[0]):t.write(e.join(``)),this.afterFlush?.())}},YF=e=>e[0]===3,XF=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},ZF=1/PS,QF=e=>Math.round(e*ZF)/ZF,$F=e=>{if(!Number.isFinite(e))return NS;let t=QF(e);return t<1?1:t>2?2:t},eI=1/1,tI=e=>Math.round(e*eI)/eI,nI=e=>{if(!Number.isFinite(e))return 0;let t=tI(e);return t<0?0:t>48?48:t},rI=e=>{if(!Number.isFinite(e))return 0;let t=tI(e);return t<0?0:t>48?48:t},iI=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},aI=e=>e<1e3?String(e):e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}k`:`${Math.round(e/1e3)}k`,oI=(e,t,n)=>e.key!==t&&e.key!==t.toUpperCase()?!1:n?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,sI=(e,t)=>oI(e,`k`,t),cI=(e,t)=>oI(e,`g`,t),lI=(e,t)=>oI(e,`f`,t),uI=(e,t)=>e.code===`Backslash`?e.altKey&&!e.metaKey&&!e.ctrlKey?!0:t?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey:!1,dI=mA(QS,!0),fI=dI.load,pI=dI.store,mI=hA(ZS,cP,uP),hI=mI.load,gI=mI.store,_I=gA(JS,e=>DP(e).id,e=>e),vI=_I.load,yI=_I.store,bI=pA(YS,13,XF),xI=bI.load,SI=bI.store,CI=pA(XS,NS,$F),wI=CI.load,TI=CI.store,EI=pA($S,jP,e=>NP(e)?e:jP),DI=EI.load,OI=EI.store,kI=mA(eC,!0),AI=kI.load,jI=kI.store,MI=gA(qS,e=>IP(e).id,e=>e),NI=MI.load,PI=MI.store,FI=pA(tC,0,nI),II=FI.load,LI=FI.store,RI=pA(nC,0,rI),zI=RI.load,BI=RI.store,VI=mA(iC,!1),HI=VI.load,UI=VI.store,WI=`<path d='m6 8 4 4-4 4M12 16h6'/>`,GI=[`<circle cx='7' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='12' cy='12' r='1.5' fill='currentColor' stroke='none'/>`,`<circle cx='17' cy='12' r='1.5' fill='currentColor' stroke='none'/>`].join(``),KI={ready:`hsl(220 8% 46%)`,running:`hsl(142 72% 45%)`,"alive-quiet":`hsl(210 65% 50%)`,dead:`hsl(0 72% 50%)`},qI={ready:`hsl(220 10% 16%)`,running:`hsl(142 85% 12%)`,"alive-quiet":`hsl(210 70% 14%)`,dead:`hsl(0 80% 12%)`},JI={ready:WI,running:GI,"alive-quiet":WI,dead:WI},YI=`<circle cx='19' cy='7' r='3.5' fill='hsl(0 72% 50%)' stroke='white' stroke-width='1.5'/>`,XI=(e,t=!1)=>{let n=KI[e],r=qI[e],i=JI[e],a=t?YI:``;return[`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' color='${r}' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' opacity='${e===`dead`?BS:1}'>`,`<rect x='2' y='4' width='20' height='16' rx='2' fill='${n}'/>`,i,a,`</svg>`].join(``)},ZI=`ready`,QI=null,$I=!1,eL=(e,t)=>QI===null||e!==ZI||t!==$I,tL=(e,t)=>{ZI=e,QI=e,$I=t},nL=()=>{ZI=`ready`,QI=null,$I=!1},rL=(e,t=!1)=>{if(typeof document>`u`||!eL(e,t))return;tL(e,t);let n=`data:image/svg+xml,${encodeURIComponent(XI(e,t))}`,r=document.querySelector(`link[rel="icon"]`);r||(r=document.createElement(`link`),r.rel=`icon`,document.head.appendChild(r)),r.type=`image/svg+xml`,r.href=n},iL=`/api/health`,aL=async()=>{try{return(await fetch(iL)).ok}catch{return!1}},oL=(e,t)=>t.buffer.active.type!==`alternate`||t.modes.mouseTrackingMode!==`none`?!1:e.deltaMode===WheelEvent.DOM_DELTA_PIXEL,sL=e=>e||`localterm`,cL=e=>`${IS}${e||`localterm`}`,lL={matchBackground:WS,activeMatchBackground:GS,activeMatchBorder:KS,matchOverviewRuler:GS,activeMatchColorOverviewRuler:KS},uL=`cwd`,dL=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(uL);return n&&t.searchParams.set(uL,n),t.toString()},fL=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(uL,e),t.toString()},pL=({onModalOpenChange:e,onForegroundProcessChange:t}={})=>{let n=(0,b.useRef)(null),r=(0,b.useRef)(null),i=(0,b.useRef)(!1),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)(null),d=(0,b.useRef)(null),f=(0,b.useRef)(NI()),p=(0,b.useRef)(vI()),m=(0,b.useRef)(xI()),h=(0,b.useRef)(wI()),g=(0,b.useRef)(hI()),_=(0,b.useRef)(fI()),v=(0,b.useRef)(DI()),x=(0,b.useRef)(AI()),C=(0,b.useRef)(II()),w=(0,b.useRef)(zI()),T=(0,b.useRef)(HI()),E=(0,b.useRef)(null),O=(0,b.useRef)(null),k=(0,b.useRef)(null),A=(0,b.useRef)(null),j=(0,b.useRef)(null),[M,N]=(0,b.useState)(null),[P,F]=(0,b.useState)(0),[I,L]=(0,b.useState)(!1),[R,z]=(0,b.useState)(!1),[B,V]=(0,b.useState)(!1),[ee,H]=(0,b.useState)(!1),te=(0,b.useRef)(null),[ne,U]=(0,b.useState)(0),[W,re]=(0,b.useState)(!1),[ie,ae]=(0,b.useState)(!1),oe=(0,b.useRef)(null),se=(0,b.useRef)(!1),ce=W||ie;se.current=ie;let[le,ue]=(0,b.useState)(``),[de,fe]=(0,b.useState)({resultIndex:-1,resultCount:0}),[pe,me]=(0,b.useState)(f.current),[he,ge]=(0,b.useState)(null),_e=he??pe,ve=(0,b.useMemo)(()=>IP(_e),[_e]),ye=(0,b.useMemo)(()=>({...ve.colors,extendedAnsi:EF(ve.colors)}),[ve]),[be,xe]=(0,b.useState)(p.current),[Se,Ce]=(0,b.useState)(null),we=Se??be,[Te,Ee]=(0,b.useState)(T.current),De=(0,b.useMemo)(()=>DP(we),[we]),[Oe,ke]=(0,b.useState)(m.current),[Ae,je]=(0,b.useState)(h.current),[Me,Ne]=(0,b.useState)(g.current),[Pe,Fe]=(0,b.useState)(null),Ie=Pe??Me,[Le,Re]=(0,b.useState)(_.current),[ze,Be]=(0,b.useState)(v.current),[Ve,He]=(0,b.useState)(x.current),[Ue,We]=(0,b.useState)(C.current),[Ge,qe]=(0,b.useState)(w.current),[Ye,Xe]=(0,b.useState)(null),[Ze,Qe]=(0,b.useState)(`Notification`in window?Notification.permission:`unsupported`),[$e,et]=(0,b.useState)(null),tt=(0,b.useRef)(null),nt=(0,b.useRef)(!1),rt=(0,b.useMemo)(iI,[]),[it,at]=(0,b.useState)(!1),ot=qP($e),st=ot!==null&&ot.isRepo&&ot.files>0;(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let c=!1,l=!1,u=!1,y=``,b=null,C=null,w=null,M=null,P=null,I=0,L=`ready`,R=!1,z=!1,B=[0],V=()=>B[B.length-1]??0,ee=()=>{let e=performance.now()-I;if(e<750){P=window.setTimeout(ee,750-e);return}P=null,M!==null&&(window.clearTimeout(M),M=null),L===`running`&&(document.hidden&&(R=!0),z?(L=`alive-quiet`,rL(`alive-quiet`,R)):(L=`ready`,rL(`ready`,R)))},H=()=>{L!==`running`&&M===null&&(M=window.setTimeout(()=>{M=null,!(c||l)&&(L=`running`,R=!1,rL(`running`))},250)),I=performance.now(),P===null&&(P=window.setTimeout(ee,750))},ne=()=>{M!==null&&(window.clearTimeout(M),M=null),P!==null&&(window.clearTimeout(P),P=null),(L!==`ready`||R)&&(L=`ready`,R=!1,rL(`ready`))},U=DP(p.current);kF(U).then(()=>{if(c)return;let e=r.current;e&&e.clearTextureAtlas(),W._core._charSizeService.measure(),Ae()});let W=new $u({allowProposedApi:!0,cursorBlink:_.current,cursorStyle:g.current,fontFamily:OP(U,T.current),fontSize:m.current,lineHeight:h.current,scrollback:v.current,theme:{...IP(f.current).colors,extendedAnsi:EF(IP(f.current).colors)},macOptionIsMeta:!0,scrollOnUserInput:x.current,windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0},scrollbar:{showScrollbar:!1}});r.current=W,JF.attach(W);let re=new D;E.current=re,W.loadAddon(re),W.loadAddon(new Mn),W.loadAddon(new S),W.loadAddon(new Ke),W.loadAddon(new Je),W.loadAddon(new En);let ie=W._core.unicodeService._activeProvider;W.unicode.register(new IF(ie)),W.unicode.activeVersion=`15-graphemes-emoji`;let ae=new lt;W.loadAddon(ae),o.current=ae;let oe=ae.onDidChangeResults(fe);W.open(e),re.proposeDimensions&&=()=>{if(!W||!W.element||!W.element.parentElement)return;let e=W,t=e._core._renderService.dimensions.css.cell.width,n=e._core._renderService.dimensions.css.cell.height;if(t===0||n===0)return;let r=window.getComputedStyle(W.element.parentElement),i=window.getComputedStyle(W.element),a=Math.max(0,parseInt(r.getPropertyValue(`width`)))-(parseInt(i.getPropertyValue(`padding-right`))+parseInt(i.getPropertyValue(`padding-left`))),o=parseInt(r.getPropertyValue(`height`))-(parseInt(i.getPropertyValue(`padding-top`))+parseInt(i.getPropertyValue(`padding-bottom`)));return{cols:Math.max(2,Math.floor(a/t)),rows:Math.max(1,Math.floor(o/n))}};let se=()=>{let e=W.buffer.active,t=e.length,n=W.rows,r=e.viewportY+n>=t,i=t>n,a=A.current,o=j.current;if(!(!a||!o)&&(a.classList.toggle(`xterm-scrollbar-visible`,!r&&i),i)){let r=n/t,i=e.viewportY/t;o.style.height=`${r*100}%`,o.style.top=`${i*100}%`}};se();let ce=W.onScroll(se);JF.setAfterFlush(se);let le=!1,ue=0,de=0,pe=e=>{if(e.button===0){le=!0,ue=e.clientY,de=W.buffer.active.viewportY;try{e.target.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}},me=e=>{if(!le)return;let t=A.current;if(!t)return;let n=t.clientHeight,r=W.buffer.active.length-W.rows;if(r<=0||n<=0)return;let i=n/r,a=e.clientY-ue,o=Math.max(0,Math.min(r,de+Math.round(a/i)));o!==W.buffer.active.viewportY&&W.scrollLines(o-W.buffer.active.viewportY)},he=()=>{le=!1},ge=e=>{if(e.button!==0||e.target===j.current)return;let t=A.current;if(!t)return;let n=t.getBoundingClientRect(),r=(e.clientY-n.top)/n.height,i=W.buffer.active,a=i.length,o=Math.max(0,Math.min(a-W.rows,Math.round(r*a)-Math.floor(W.rows/2)));W.scrollLines(o-i.viewportY)},_e=j.current,ve=A.current;_e&&(_e.addEventListener(`pointerdown`,pe),_e.addEventListener(`pointermove`,me),_e.addEventListener(`pointerup`,he),_e.addEventListener(`pointercancel`,he)),ve&&ve.addEventListener(`pointerdown`,ge);try{let e=new ia;e.onContextLoss(()=>e.dispose()),W.loadAddon(e)}catch{}let ye=W.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let t=e[0],n=typeof t==`number`?t:1;return B.push(n),!0}),be=W.parser.registerCsiHandler({prefix:`<`,final:`u`},e=>{let t=e[0],n=typeof t==`number`&&t>0?t:1;for(let e=0;e<n&&B.length>1;e+=1)B.pop();return!0}),xe=W.parser.registerCsiHandler({prefix:`=`,final:`u`},e=>{let t=e[0],n=e[1];if(typeof t!=`number`)return!0;let r=t,i=typeof n==`number`&&n>0?n:1,a=B.length-1,o=B[a]??0;return i===1?B[a]=r:i===2?B[a]=o|r:i===3&&(B[a]=o&~r),!0}),Se=W.parser.registerCsiHandler({final:`J`},YF),Ce=W.parser.registerCsiHandler({prefix:`?`,final:`J`},YF),we=e=>{b?.readyState===WebSocket.OPEN&&b.send(JSON.stringify(e))},Te=()=>{let e=d.current;e&&cancelAnimationFrame(e.frameId),d.current=null},Ee=()=>{let e=d.current;e&&qF(W,e.anchor)},De=e=>{Te(),d.current={anchor:e,frameId:requestAnimationFrame(()=>{Ee(),d.current=null})}};W.attachCustomWheelEventHandler(e=>oL(e,W)?(e.preventDefault(),!1):!0),W.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(uI(e,rt)){if(e.type===`keydown`){e.preventDefault();let t=document.getElementById(`new-shell-link`);t instanceof HTMLAnchorElement&&t.click()}return!1}if(sI(e,rt))return e.type===`keydown`&&(e.preventDefault(),te.current?.()),!1;if(cI(e,rt))return e.type===`keydown`&&(e.preventDefault(),k.current?.()),!1;if(lI(e,rt))return e.type===`keydown`&&(e.preventDefault(),O.current?.()),!1;if(e.type===`keydown`&&e.key===`Enter`){let t=LF(e),n=(V()&1)!=0;if(t!==0&&n)return e.preventDefault(),we({type:`input`,data:AF(13,t)}),!1;if(t===1)return e.preventDefault(),we({type:`input`,data:`
115
115
  `}),!1}return!0});let Oe=e=>{if(l)return;let t=e.trim();t&&(y=t,document.title=sL(t))};s.current=()=>W.focus();let ke=(e,t)=>{let n=W,r=n._core._renderService?.dimensions?.css?.canvas?.width,i=n._core._renderService?.dimensions?.css?.canvas?.height;we({type:`resize`,cols:e,rows:t,...r!=null&&i!=null?{pixelWidth:Math.round(r),pixelHeight:Math.round(i)}:{}})},Ae=()=>{let e=jF(W);RF(W,re)&&(De(e),ke(W.cols,W.rows))},je=()=>{w!==null&&window.clearTimeout(w),w=window.setTimeout(()=>{w=null,Ae()},80)};W.onData(e=>{for(let t of KF(e,hC))we({type:`input`,data:t})}),W.onResize(({cols:e,rows:t})=>{ke(e,t),se()});let Me=new ResizeObserver(je),Ne=()=>{!document.hidden&&R&&(R=!1,rL(L))};document.addEventListener(`visibilitychange`,Ne),Me.observe(e),Ae(),requestAnimationFrame(()=>W.focus());let Pe=e=>{if(!l){if(l=!0,e===null||e===0){window.close(),setTimeout(()=>{c||(ne(),rL(`dead`),W.write(UF(e)),document.title=cL(y),N({reason:`shell-exited`,exitCode:e}),Xe(null))},100);return}ne(),rL(`dead`),W.write(UF(e)),document.title=cL(y),N({reason:`shell-exited`,exitCode:e}),Xe(null)}},Fe=(e,t,n)=>{l||(l=!0,ne(),rL(`dead`),W.write(zF(e,t)),document.title=cL(y),N({reason:`connection-lost`,closeCode:e,closeReason:t,wasClean:n}),Xe(null))},Ie=()=>{if(c)return;let e=new WebSocket(dL(tt.current));b=e,e.addEventListener(`open`,()=>{c||b!==e||(u=!0,nt.current=!0,F(0),ke(W.cols,W.rows))}),e.addEventListener(`message`,n=>{if(c||b!==e)return;let r;try{r=JSON.parse(typeof n.data==`string`?n.data:String(n.data))}catch{return}if(typeof r==`object`&&r&&r.type===`output`&&typeof r.data==`string`){let e=r.data;JF.push(e),H();return}let i=Qk.safeParse(r);if(!i.success)return;let a=i.data;if(a.type===`title`)Oe(a.title);else if(a.type===`session`)Xe({shell:a.shell,shellName:a.shellName,pid:a.pid,cwd:a.cwd,title:a.title}),et(a.cwd),Oe(a.title);else if(a.type===`cwd`)et(a.cwd);else if(a.type===`foreground`){let e=a.process!==null;t?.(e),!e&&L===`alive-quiet`&&(L=`ready`,rL(`ready`,R)),z=e}else a.type===`notification`?`Notification`in window&&Notification.permission===`granted`&&new Notification(a.body):a.type===`exit`&&(ne(),Pe(a.code))}),e.addEventListener(`close`,t=>{if(b===e&&(b=null,nt.current=!1,!c&&!l)){if(u){console.warn(`[localterm] websocket closed: code=${t.code} reason=${JSON.stringify(t.reason)} wasClean=${t.wasClean}`),Fe(t.code,t.reason,t.wasClean);return}F(e=>e+1),C=window.setTimeout(Ie,MS)}}),e.addEventListener(`error`,t=>{console.warn(`[localterm] websocket error`,t);try{e.close()}catch{}})};return a.current=()=>{if(!c){l=!1,u=!1,nt.current=!1,N(null),Xe(null),F(0),rL(`ready`),t?.(!1),C!==null&&(window.clearTimeout(C),C=null);try{b?.close()}catch{}b=null,Ie()}},Ie(),i.current=!0,()=>{c=!0,i.current=!1,_e&&(_e.removeEventListener(`pointerdown`,pe),_e.removeEventListener(`pointermove`,me),_e.removeEventListener(`pointerup`,he),_e.removeEventListener(`pointercancel`,he)),ve&&ve.removeEventListener(`pointerdown`,ge),oe.dispose(),ce.dispose(),ye.dispose(),be.dispose(),xe.dispose(),Se.dispose(),Ce.dispose(),C!==null&&window.clearTimeout(C),w!==null&&window.clearTimeout(w),Te(),ne(),document.removeEventListener(`visibilitychange`,Ne),Me.disconnect();try{b?.close()}catch{}b=null,JF.detach(),W.dispose(),document.title=FS}},[]),(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.theme=ye)},[ye]),(0,b.useEffect)(()=>{if(!i.current||!r.current)return;let e=!1;return kF(De).then(()=>{if(e)return;let t=r.current;if(!t)return;t.options.fontFamily=OP(De,Te),t.clearTextureAtlas();let n=E.current;n&&RF(t,n)}),()=>{e=!0}},[De,Te]);let ct=(0,b.useCallback)(e=>{me(e),ge(null),PI(e)},[]),ut=(0,b.useCallback)(e=>{xe(e),Ce(null),yI(e)},[]),dt=(0,b.useCallback)(e=>{Ee(e),UI(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.fontSize=Oe;let t=E.current;t&&RF(e,t)},[Oe]);let ft=(0,b.useCallback)(e=>{let t=XF(e);ke(t),SI(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.lineHeight=Ae;let t=E.current;t&&RF(e,t)},[Ae]);let pt=(0,b.useCallback)(e=>{let t=$F(e);je(t),TI(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorStyle=Ie)},[Ie]);let mt=(0,b.useCallback)(e=>{Ne(e),Fe(null),gI(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorBlink=Le)},[Le]);let ht=(0,b.useCallback)(e=>{Re(e),pI(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollback=ze)},[ze]);let gt=(0,b.useCallback)(e=>{Be(e),OI(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollOnUserInput=Ve)},[Ve]);let _t=(0,b.useCallback)(e=>{He(e),jI(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;let t=E.current;t&&RF(e,t)},[Ue,Ge]);let vt=(0,b.useCallback)(e=>{let t=nI(e);We(t),LI(t)},[]),yt=(0,b.useCallback)(e=>{let t=rI(e);qe(t),BI(t)},[]),bt=(0,b.useCallback)(()=>{`Notification`in window&&Notification.requestPermission().then(e=>{Qe(e)})},[]);(0,b.useEffect)(()=>{if(!B)return;let e=c.current;e&&(e.focus(),e.select())},[B,ne]);let xt=(0,b.useCallback)(e=>{if(!e){o.current?.clearDecorations(),fe({resultIndex:-1,resultCount:0});return}o.current?.findNext(e,{decorations:lL})},[]),St=(0,b.useCallback)(e=>{e&&o.current?.findPrevious(e,{decorations:lL})},[]),Ct=(0,b.useCallback)(()=>{V(!1),ue(``),fe({resultIndex:-1,resultCount:0}),o.current?.clearDecorations(),s.current?.()},[]),wt=(0,b.useCallback)(()=>{oe.current!==null&&(window.clearTimeout(oe.current),oe.current=null),re(!0)},[]),Tt=(0,b.useCallback)(()=>{oe.current=window.setTimeout(()=>{oe.current=null,se.current||re(!1)},200)},[]),Et=(0,b.useCallback)(e=>{ae(e),e||(oe.current!==null&&window.clearTimeout(oe.current),oe.current=window.setTimeout(()=>{oe.current=null,re(!1)},200))},[]);te.current=(0,b.useCallback)(()=>{H(e=>!e)},[]);let Dt=(0,b.useCallback)(()=>{H(!1),s.current?.()},[]),Ot=(0,b.useCallback)(()=>{V(!0),H(!1),U(e=>e+1)},[]);O.current=Ot;let kt=(0,b.useCallback)(()=>{at(!0),H(!1)},[]);k.current=kt;let At=(0,b.useCallback)(()=>{at(!1),s.current?.()},[]),jt=(0,b.useCallback)(e=>{let t=e.target.value;ue(t),xt(t)},[xt]),Mt=(0,b.useCallback)(e=>{if(lI(e.nativeEvent,rt)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),Ct();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?St(le):xt(le))},[Ct,xt,St,rt,le]),Nt=(0,b.useCallback)(()=>{z(!0),a.current?.(),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{l.current=null,z(!1)},800)},[]),Pt=(0,b.useCallback)(()=>{navigator.clipboard.writeText(LS).then(()=>{L(!0),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,L(!1)},RS)}).catch(()=>{})},[]);(0,b.useEffect)(()=>()=>{oe.current!==null&&(window.clearTimeout(oe.current),oe.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),u.current!==null&&(window.clearTimeout(u.current),u.current=null)},[]),(0,b.useEffect)(()=>{if(tt.current=$e,!$e)return;let e=new URL(window.location.href);if(e.searchParams.get(uL)!==$e){e.searchParams.set(uL,$e);try{window.history.replaceState(null,``,e)}catch{}}},[$e]);let Ft=fL($e),It=M!==null,Lt=!It&&P>=2,Rt=It||Lt,zt=M!==null&&M.reason!==`shell-exited`||Lt;(0,b.useEffect)(()=>{if(!zt)return;let e=Date.now(),t=!1,n=null,i=i=>{if(t||nt.current)return;if(i){let e=r.current;e&&(e.write(HF(Ie,Le)),e.refresh(0,e.rows-1),e.focus()),a.current?.();return}let s=Date.now()-e<5e3?250:zS;n=window.setTimeout(o,s)},o=()=>{aL().then(i)};return o(),()=>{t=!0,n!==null&&window.clearTimeout(n)}},[zt,Ie,Le]),(0,b.useEffect)(()=>{e?.(Rt),Rt&&(H(!1),at(!1))},[Rt,e]);let Bt=de.resultCount===0?`0/0`:`${de.resultIndex+1}/${de.resultCount}`,Vt=ve.colors.background??`#101010`,Ht=(0,b.useMemo)(()=>{let e=rt?`⌘`:`Ctrl+`;return[{id:`find`,label:`Find in terminal`,category:`Actions`,shortcut:`${e}F`,icon:(0,y.jsx)(Sd,{className:`size-3.5`}),action:Ot},{id:`git-diff`,label:`View git diff`,category:`Actions`,shortcut:`${e}G`,icon:(0,y.jsx)(hd,{className:`size-3.5`}),action:kt},{id:`new-shell`,label:`Open new shell`,category:`Actions`,shortcut:`Alt+T`,icon:(0,y.jsx)(bd,{className:`size-3.5`}),action:()=>{let e=document.getElementById(`new-shell-link`);e instanceof HTMLAnchorElement&&e.click()}},{id:`font-size-up`,label:`Increase font size`,category:`Settings`,shortcut:`${e}+`,icon:(0,y.jsx)(yd,{className:`size-3.5`}),action:()=>ft(Oe+1)},{id:`font-size-down`,label:`Decrease font size`,category:`Settings`,shortcut:`${e}-`,icon:(0,y.jsx)(yd,{className:`size-3.5`}),action:()=>ft(Oe-1)},{id:`cursor-blink`,label:`Cursor blink`,category:`Settings`,checked:Le,action:()=>ht(!Le)},{id:`scroll-on-input`,label:`Pin to bottom on input`,category:`Settings`,checked:Ve,action:()=>_t(!Ve)},...sP.map(e=>({id:`cursor:${e.id}`,label:e.name,category:`Cursor`,checked:e.id===Me,action:()=>mt(e.id)})),...EP.map(e=>({id:`font:${e.id}`,label:e.name,category:`Font`,checked:e.id===be,action:()=>ut(e.id)})),...FP.map(e=>({id:`theme:${e.id}`,label:e.name,category:`Theme`,checked:e.id===pe,action:()=>ct(e.id)}))]},[rt,ct,ut,Ot,kt,mt,Le,ht,Oe,ft,Ve,_t,pe,be,Me]),Ut=(0,b.useCallback)(e=>{let t=e?.id??``;ge(t.startsWith(`theme:`)?t.slice(6):null),Ce(t.startsWith(`font:`)?t.slice(5):null);let n=t.startsWith(`cursor:`)?t.slice(7):null;Fe(uP(n)?n:null)},[]);return(0,y.jsxs)(`div`,{className:`h-dvh w-dvw`,style:{background:Vt},children:[(0,y.jsxs)(`div`,{className:`relative h-full w-full`,children:[(0,y.jsx)(`div`,{ref:n,"aria-label":`terminal session`,className:`absolute`,style:{top:Ge,right:Ue,bottom:Ge,left:Ue}}),(0,y.jsx)(`div`,{ref:A,className:`xterm-scrollbar-track`,style:{top:Ge,right:Ue,bottom:Ge},children:(0,y.jsx)(`div`,{ref:j,className:`xterm-scrollbar-thumb`})}),M===null?null:(0,y.jsx)(rS,{variant:`destructive`,role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10`,children:M.reason===`shell-exited`?M.exitCode===null?`exited`:`exited · code ${M.exitCode}`:`disconnected · code ${M.closeCode}`}),(0,y.jsxs)(`div`,{className:Qf(`absolute right-0 top-0 z-10 flex flex-col items-end pr-3 pt-1`,ce||st?`pointer-events-auto`:`pointer-events-none`),onMouseEnter:wt,onMouseLeave:Tt,children:[(0,y.jsx)(`div`,{"aria-hidden":`true`,className:Qf(`pointer-events-auto mr-0.5 h-[2px] w-5 rounded-full bg-muted-foreground/25 transition-opacity duration-150`,ce||B||st?`opacity-0`:`opacity-100`)}),!B&&(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,className:Qf(`mt-1 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`,`transition-[opacity,transform] duration-200 ease-snappy`,ce||st?`translate-y-0 opacity-100`:`pointer-events-none -translate-y-1 opacity-0`),onMouseDown:e=>e.preventDefault(),onKeyDown:()=>s.current?.(),children:[(0,y.jsx)(`div`,{className:Qf(`grid`,st&&`transition-[grid-template-columns] duration-200 ease-snappy`,st&&!ce?`grid-cols-[0fr]`:`grid-cols-[1fr]`),children:(0,y.jsxs)(`div`,{className:Qf(`flex min-w-0 items-center gap-0.5 overflow-hidden`,st&&`transition-opacity duration-200 ease-snappy`,st&&!ce?`pointer-events-none opacity-0`:`opacity-100`),children:[(0,y.jsx)(KP,{themeId:pe,onThemeChange:ct,onThemePreview:ge,fontId:be,onFontChange:ut,onFontPreview:Ce,nerdFontEnabled:Te,onNerdFontEnabledChange:dt,fontSize:Oe,onFontSizeChange:ft,lineHeight:Ae,onLineHeightChange:pt,cursorStyle:Me,onCursorStyleChange:mt,onCursorStylePreview:Fe,cursorBlink:Le,onCursorBlinkChange:ht,scrollback:ze,onScrollbackChange:gt,scrollOnUserInput:Ve,onScrollOnUserInputChange:_t,paddingX:Ue,onPaddingXChange:vt,paddingY:Ge,onPaddingYChange:yt,notificationsPermission:Ze,onNotificationsPermissionRequest:bt,sessionInfo:Ye,onPopoverOpenChange:Et,onClose:s.current??void 0}),(0,y.jsx)(Gx,{variant:`ghost`,size:`icon-sm`,onClick:Ot,"aria-label":`find in terminal`,className:`hover:text-foreground`,children:(0,y.jsx)(Sd,{})}),(0,y.jsx)(Gx,{variant:`ghost`,size:`icon-sm`,nativeButton:!1,"aria-label":`open a new shell in a new browser tab`,render:(0,y.jsx)(`a`,{id:`new-shell-link`,href:Ft,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`,children:(0,y.jsx)(bd,{})})]})}),st&&ot!==null?(0,y.jsxs)(`button`,{type:`button`,onClick:kt,"aria-label":`view git diff: ${ot.additions} additions, ${ot.deletions} deletions${ot.binaries>0?`, ${ot.binaries} binary files changed`:``}`,title:`${rt?`⌘`:`Ctrl+`}G`,className:`flex h-8 items-center gap-1 rounded-[min(var(--radius-md),10px)] px-2 font-mono text-xs tabular-nums outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50`,children:[(0,y.jsxs)(`span`,{className:`text-emerald-400`,children:[`+`,aI(ot.additions)]}),(0,y.jsxs)(`span`,{className:`text-red-400`,children:[`−`,aI(ot.deletions)]}),ot.binaries>0?(0,y.jsxs)(`span`,{className:`flex items-center gap-0.5 text-muted-foreground`,children:[(0,y.jsx)(ud,{className:`size-3`,"aria-hidden":`true`}),ot.binaries]}):null]}):null]}),B&&(0,y.jsxs)(wS,{role:`search`,"aria-label":`find in terminal`,className:`mt-1 w-80 border-border/60 bg-background/70 text-muted-foreground shadow-xs backdrop-blur-md dark:bg-background/70`,children:[(0,y.jsx)(AS,{ref:c,type:`search`,value:le,onChange:jt,onKeyDown:Mt,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(ES,{align:`inline-end`,children:[(0,y.jsx)(kS,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:Bt}),(0,y.jsx)(OS,{size:`icon-xs`,onClick:()=>St(le),disabled:de.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(pd,{})}),(0,y.jsx)(OS,{size:`icon-xs`,onClick:()=>xt(le),disabled:de.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(fd,{})})]})]})]})]}),(0,y.jsx)(pC,{open:ee,onClose:Dt,commands:Ht,onActiveItemChange:Ut}),(0,y.jsx)(MA,{open:it,cwd:$e,onClose:At}),(0,y.jsx)(Kx,{open:Rt,children:(0,y.jsx)(Yx,{children:M===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Xx,{children:[(0,y.jsxs)(Qx,{className:`flex items-center gap-2`,children:[(0,y.jsx)(jS,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Lost connection`]}),(0,y.jsx)($x,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(wS,{children:[(0,y.jsx)(AS,{readOnly:!0,value:LS,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(ES,{align:`inline-end`,children:(0,y.jsx)(OS,{size:`icon-xs`,onClick:Pt,"aria-label":I?`Copied`:`Copy restart command`,children:I?(0,y.jsx)(dd,{}):(0,y.jsx)(md,{})})})]}),(0,y.jsx)(Zx,{children:(0,y.jsxs)(eS,{onClick:Nt,disabled:R,children:[R?(0,y.jsx)(jS,{"data-icon":`inline-start`}):null,`Retry`]})})]}):M.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Xx,{children:[(0,y.jsx)(Qx,{children:`Shell ended`}),(0,y.jsx)($x,{children:M.exitCode===null||M.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${M.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(Zx,{children:(0,y.jsx)(eS,{onClick:()=>window.open(Ft,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(Xx,{children:[(0,y.jsxs)(Qx,{className:`flex items-center gap-2`,children:[(0,y.jsx)(jS,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Connection lost`]}),(0,y.jsxs)($x,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,M.closeCode,M.closeReason?` · ${M.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(Zx,{children:(0,y.jsxs)(eS,{onClick:Nt,disabled:R,children:[R?(0,y.jsx)(jS,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})})]})},mL=()=>{let e=(0,b.useRef)(!1),t=(0,b.useRef)(!1);return(0,b.useEffect)(()=>{let n=n=>{e.current||t.current&&n.preventDefault()},r=()=>window.addEventListener(`beforeunload`,n);return window.addEventListener(`keydown`,r,{once:!0}),()=>{window.removeEventListener(`keydown`,r),window.removeEventListener(`beforeunload`,n)}},[]),(0,y.jsx)(pL,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[]),onForegroundProcessChange:(0,b.useCallback)(e=>{t.current=e},[])})};nL(),rL(`ready`),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=kP();if(!e)return;let t=document.createElement(`link`);t.id=rC,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})();var hL=document.getElementById(`root`);if(!hL)throw Error(`Root element not found`);(0,x.createRoot)(hL).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(rP,{delay:300,children:(0,y.jsx)(mL,{})})}));
116
- //# sourceMappingURL=index-BKfEp1q4.js.map
116
+ //# sourceMappingURL=index-QlnM2zzt.js.map