@monotykamary/localterm 1.17.1 → 1.17.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/terminal/assets/index-KsjmOJeR.css +1 -0
- package/terminal/assets/{index-D8QWSjQd.js → index-_QplI2Jp.js} +3 -3
- package/terminal/assets/index-_QplI2Jp.js.map +1 -0
- package/terminal/index.html +2 -2
- package/terminal/assets/index-17jerE6z.css +0 -1
- package/terminal/assets/index-D8QWSjQd.js.map +0 -1
|
@@ -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=EC,s=!dC.jitless,c=s&&DC.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?qT([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function XT(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=>!UC(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=>KC(e,r,fC())))}),t)}var ZT=$(`$ZodUnion`,(e,t)=>{lT.init(e,t),bC(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),bC(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),bC(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),bC(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=>_C(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=>XT(t,i,e,a)):XT(s,i,e,a)}}),QT=$(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,ZT.init(e,t);let n=e._zod.parse;bC(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=hC(()=>{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(!EC(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)}}),$T=$(`$ZodIntersection`,(e,t)=>{lT.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])=>tE(e,t,n)):tE(e,i,a)}});function eE(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(OC(e)&&OC(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=eE(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=eE(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 tE(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}),UC(e))return e;let o=eE(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var nE=$(`$ZodEnum`,(e,t)=>{lT.init(e,t);let n=pC(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>AC.has(typeof e)).map(e=>typeof e==`string`?jC(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}}),rE=$(`$ZodLiteral`,(e,t)=>{if(lT.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`?jC(e):e?jC(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}}),iE=$(`$ZodTransform`,(e,t)=>{lT.init(e,t),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new uC(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 lC;return n.value=i,n}});function aE(e,t){return e.issues.length&&t===void 0?{issues:[],value:void 0}:e}var oE=$(`$ZodOptional`,(e,t)=>{lT.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,bC(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),bC(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${_C(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=>aE(t,e.value)):aE(r,e.value)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),sE=$(`$ZodExactOptional`,(e,t)=>{oE.init(e,t),bC(e._zod,`values`,()=>t.innerType._zod.values),bC(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),cE=$(`$ZodNullable`,(e,t)=>{lT.init(e,t),bC(e._zod,`optin`,()=>t.innerType._zod.optin),bC(e._zod,`optout`,()=>t.innerType._zod.optout),bC(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${_C(e.source)}|null)$`):void 0}),bC(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)}),lE=$(`$ZodDefault`,(e,t)=>{lT.init(e,t),e._zod.optin=`optional`,bC(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=>uE(e,t)):uE(r,t)}});function uE(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var dE=$(`$ZodPrefault`,(e,t)=>{lT.init(e,t),e._zod.optin=`optional`,bC(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))}),fE=$(`$ZodNonOptional`,(e,t)=>{lT.init(e,t),bC(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=>pE(t,e)):pE(i,e)}});function pE(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 mE=$(`$ZodCatch`,(e,t)=>{lT.init(e,t),bC(e._zod,`optin`,()=>t.innerType._zod.optin),bC(e._zod,`optout`,()=>t.innerType._zod.optout),bC(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=>KC(e,n,fC()))},input:e.value}),e.issues=[]),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>KC(e,n,fC()))},input:e.value}),e.issues=[]),e)}}),hE=$(`$ZodPipe`,(e,t)=>{lT.init(e,t),bC(e._zod,`values`,()=>t.in._zod.values),bC(e._zod,`optin`,()=>t.in._zod.optin),bC(e._zod,`optout`,()=>t.out._zod.optout),bC(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=>gE(e,t.in,n)):gE(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>gE(e,t.out,n)):gE(r,t.out,n)}});function gE(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var _E=$(`$ZodReadonly`,(e,t)=>{lT.init(e,t),bC(e._zod,`propValues`,()=>t.innerType._zod.propValues),bC(e._zod,`values`,()=>t.innerType._zod.values),bC(e._zod,`optin`,()=>t.innerType?._zod?.optin),bC(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(vE):vE(r)}});function vE(e){return e.value=Object.freeze(e.value),e}var yE=$(`$ZodCustom`,(e,t)=>{Ww.init(e,t),lT.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=>bE(t,n,r,e));bE(i,n,r,e)}});function bE(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(JC(e))}}var xE,SE=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 CE(){return new SE}(xE=globalThis).__zod_globalRegistry??(xE.__zod_globalRegistry=CE());var wE=globalThis.__zod_globalRegistry;function TE(e,t){return new e({type:`string`,...NC(t)})}function EE(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...NC(t)})}function DE(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...NC(t)})}function OE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...NC(t)})}function kE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...NC(t)})}function AE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...NC(t)})}function jE(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...NC(t)})}function ME(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...NC(t)})}function NE(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...NC(t)})}function PE(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...NC(t)})}function FE(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...NC(t)})}function IE(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...NC(t)})}function LE(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...NC(t)})}function RE(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...NC(t)})}function zE(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...NC(t)})}function BE(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...NC(t)})}function VE(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...NC(t)})}function HE(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...NC(t)})}function UE(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...NC(t)})}function WE(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...NC(t)})}function GE(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...NC(t)})}function KE(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...NC(t)})}function qE(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...NC(t)})}function JE(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...NC(t)})}function YE(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...NC(t)})}function XE(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...NC(t)})}function ZE(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...NC(t)})}function QE(e,t){return new e({type:`number`,checks:[],...NC(t)})}function $E(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...NC(t)})}function eD(e,t){return new e({type:`boolean`,...NC(t)})}function tD(e){return new e({type:`unknown`})}function nD(e,t){return new e({type:`never`,...NC(t)})}function rD(e,t){return new Kw({check:`less_than`,...NC(t),value:e,inclusive:!1})}function iD(e,t){return new Kw({check:`less_than`,...NC(t),value:e,inclusive:!0})}function aD(e,t){return new qw({check:`greater_than`,...NC(t),value:e,inclusive:!1})}function oD(e,t){return new qw({check:`greater_than`,...NC(t),value:e,inclusive:!0})}function sD(e,t){return new Jw({check:`multiple_of`,...NC(t),value:e})}function cD(e,t){return new Xw({check:`max_length`,...NC(t),maximum:e})}function lD(e,t){return new Zw({check:`min_length`,...NC(t),minimum:e})}function uD(e,t){return new Qw({check:`length_equals`,...NC(t),length:e})}function dD(e,t){return new eT({check:`string_format`,format:`regex`,...NC(t),pattern:e})}function fD(e){return new tT({check:`string_format`,format:`lowercase`,...NC(e)})}function pD(e){return new nT({check:`string_format`,format:`uppercase`,...NC(e)})}function mD(e,t){return new rT({check:`string_format`,format:`includes`,...NC(t),includes:e})}function hD(e,t){return new iT({check:`string_format`,format:`starts_with`,...NC(t),prefix:e})}function gD(e,t){return new aT({check:`string_format`,format:`ends_with`,...NC(t),suffix:e})}function _D(e){return new oT({check:`overwrite`,tx:e})}function vD(e){return _D(t=>t.normalize(e))}function yD(){return _D(e=>e.trim())}function bD(){return _D(e=>e.toLowerCase())}function xD(){return _D(e=>e.toUpperCase())}function SD(){return _D(e=>wC(e))}function CD(e,t,n){return new e({type:`array`,element:t,...NC(n)})}function wD(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...NC(n)})}function TD(e){let t=ED(n=>(n.addIssue=e=>{if(typeof e==`string`)n.issues.push(JC(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(JC(r))}},e(n.value,n)));return t}function ED(e,t){let n=new Ww({check:`custom`,...NC(t)});return n._zod.check=e,n}function DD(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??wE,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 OD(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,OD(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`&&jD(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 kD(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 AD(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:ND(t,`input`,e.processors),output:ND(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function jD(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 jD(r.element,n);if(r.type===`set`)return jD(r.valueType,n);if(r.type===`lazy`)return jD(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 jD(r.innerType,n);if(r.type===`intersection`)return jD(r.left,n)||jD(r.right,n);if(r.type===`record`||r.type===`map`)return jD(r.keyType,n)||jD(r.valueType,n);if(r.type===`pipe`)return jD(r.in,n)||jD(r.out,n);if(r.type===`object`){for(let e in r.shape)if(jD(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(jD(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(jD(e,n))return!0;return!!(r.rest&&jD(r.rest,n))}return!1}var MD=(e,t={})=>n=>{let r=DD({...n,processors:t});return OD(e,r),kD(r,e),AD(r,e)},ND=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=DD({...i??{},target:a,io:t,processors:n});return OD(e,o),kD(o,e),AD(o,e)},PD={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},FD=(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=PD[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}))])}},ID=(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)},LD=(e,t,n,r)=>{n.type=`boolean`},RD=(e,t,n,r)=>{n.not={}},zD=(e,t,n,r)=>{let i=e._zod.def,a=pC(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},BD=(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},VD=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},HD=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},UD=(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=OD(a.element,t,{...r,path:[...r.path,`items`]})},WD=(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]=OD(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=OD(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},GD=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>OD(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},KD=(e,t,n,r)=>{let i=e._zod.def,a=OD(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=OD(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]]},qD=(e,t,n,r)=>{let i=e._zod.def,a=OD(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`}]},JD=(e,t,n,r)=>{let i=e._zod.def;OD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},YD=(e,t,n,r)=>{let i=e._zod.def;OD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},XD=(e,t,n,r)=>{let i=e._zod.def;OD(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)))},ZD=(e,t,n,r)=>{let i=e._zod.def;OD(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},QD=(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;OD(a,t,r);let o=t.seen.get(e);o.ref=a},$D=(e,t,n,r)=>{let i=e._zod.def;OD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},eO=(e,t,n,r)=>{let i=e._zod.def;OD(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},tO=$(`ZodISODateTime`,(e,t)=>{CT.init(e,t),DO.init(e,t)});function nO(e){return JE(tO,e)}var rO=$(`ZodISODate`,(e,t)=>{wT.init(e,t),DO.init(e,t)});function iO(e){return YE(rO,e)}var aO=$(`ZodISOTime`,(e,t)=>{TT.init(e,t),DO.init(e,t)});function oO(e){return XE(aO,e)}var sO=$(`ZodISODuration`,(e,t)=>{ET.init(e,t),DO.init(e,t)});function cO(e){return ZE(sO,e)}var lO=(e,t)=>{XC.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>$C(e,t)},flatten:{value:t=>QC(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,mC,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,mC,2)}},isEmpty:{get(){return e.issues.length===0}}})};$(`ZodError`,lO);var uO=$(`ZodError`,lO,{Parent:Error}),dO=ew(uO),fO=tw(uO),pO=nw(uO),mO=iw(uO),hO=ow(uO),gO=sw(uO),_O=cw(uO),vO=lw(uO),yO=uw(uO),bO=dw(uO),xO=fw(uO),SO=pw(uO),CO=$(`ZodType`,(e,t)=>(lT.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ND(e,`input`),output:ND(e,`output`)}}),e.toJSONSchema=MD(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.check=(...n)=>e.clone(SC(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)=>MC(e,t,n),e.brand=()=>e,e.register=((t,n)=>(t.add(e,n),e)),e.parse=(t,n)=>dO(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>pO(e,t,n),e.parseAsync=async(t,n)=>fO(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>mO(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>hO(e,t,n),e.decode=(t,n)=>gO(e,t,n),e.encodeAsync=async(t,n)=>_O(e,t,n),e.decodeAsync=async(t,n)=>vO(e,t,n),e.safeEncode=(t,n)=>yO(e,t,n),e.safeDecode=(t,n)=>bO(e,t,n),e.safeEncodeAsync=async(t,n)=>xO(e,t,n),e.safeDecodeAsync=async(t,n)=>SO(e,t,n),e.refine=(t,n)=>e.check(Rk(t,n)),e.superRefine=t=>e.check(zk(t)),e.overwrite=t=>e.check(_D(t)),e.optional=()=>bk(e),e.exactOptional=()=>Sk(e),e.nullable=()=>wk(e),e.nullish=()=>bk(wk(e)),e.nonoptional=t=>Ak(e,t),e.array=()=>ik(e),e.or=t=>ck([e,t]),e.and=t=>fk(e,t),e.transform=t=>Pk(e,vk(t)),e.default=t=>Ek(e,t),e.prefault=t=>Ok(e,t),e.catch=t=>Mk(e,t),e.pipe=t=>Pk(e,t),e.readonly=()=>Ik(e),e.describe=t=>{let n=e.clone();return wE.add(n,{description:t}),n},Object.defineProperty(e,`description`,{get(){return wE.get(e)?.description},configurable:!0}),e.meta=(...t)=>{if(t.length===0)return wE.get(e);let n=e.clone();return wE.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),wO=$(`_ZodString`,(e,t)=>{uT.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>FD(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(dD(...t)),e.includes=(...t)=>e.check(mD(...t)),e.startsWith=(...t)=>e.check(hD(...t)),e.endsWith=(...t)=>e.check(gD(...t)),e.min=(...t)=>e.check(lD(...t)),e.max=(...t)=>e.check(cD(...t)),e.length=(...t)=>e.check(uD(...t)),e.nonempty=(...t)=>e.check(lD(1,...t)),e.lowercase=t=>e.check(fD(t)),e.uppercase=t=>e.check(pD(t)),e.trim=()=>e.check(yD()),e.normalize=(...t)=>e.check(vD(...t)),e.toLowerCase=()=>e.check(bD()),e.toUpperCase=()=>e.check(xD()),e.slugify=()=>e.check(SD())}),TO=$(`ZodString`,(e,t)=>{uT.init(e,t),wO.init(e,t),e.email=t=>e.check(EE(OO,t)),e.url=t=>e.check(ME(jO,t)),e.jwt=t=>e.check(qE(KO,t)),e.emoji=t=>e.check(NE(MO,t)),e.guid=t=>e.check(DE(kO,t)),e.uuid=t=>e.check(OE(AO,t)),e.uuidv4=t=>e.check(kE(AO,t)),e.uuidv6=t=>e.check(AE(AO,t)),e.uuidv7=t=>e.check(jE(AO,t)),e.nanoid=t=>e.check(PE(NO,t)),e.guid=t=>e.check(DE(kO,t)),e.cuid=t=>e.check(FE(PO,t)),e.cuid2=t=>e.check(IE(FO,t)),e.ulid=t=>e.check(LE(IO,t)),e.base64=t=>e.check(WE(UO,t)),e.base64url=t=>e.check(GE(WO,t)),e.xid=t=>e.check(RE(LO,t)),e.ksuid=t=>e.check(zE(RO,t)),e.ipv4=t=>e.check(BE(zO,t)),e.ipv6=t=>e.check(VE(BO,t)),e.cidrv4=t=>e.check(HE(VO,t)),e.cidrv6=t=>e.check(UE(HO,t)),e.e164=t=>e.check(KE(GO,t)),e.datetime=t=>e.check(nO(t)),e.date=t=>e.check(iO(t)),e.time=t=>e.check(oO(t)),e.duration=t=>e.check(cO(t))});function EO(e){return TE(TO,e)}var DO=$(`ZodStringFormat`,(e,t)=>{dT.init(e,t),wO.init(e,t)}),OO=$(`ZodEmail`,(e,t)=>{mT.init(e,t),DO.init(e,t)}),kO=$(`ZodGUID`,(e,t)=>{fT.init(e,t),DO.init(e,t)}),AO=$(`ZodUUID`,(e,t)=>{pT.init(e,t),DO.init(e,t)}),jO=$(`ZodURL`,(e,t)=>{hT.init(e,t),DO.init(e,t)}),MO=$(`ZodEmoji`,(e,t)=>{gT.init(e,t),DO.init(e,t)}),NO=$(`ZodNanoID`,(e,t)=>{_T.init(e,t),DO.init(e,t)}),PO=$(`ZodCUID`,(e,t)=>{vT.init(e,t),DO.init(e,t)}),FO=$(`ZodCUID2`,(e,t)=>{yT.init(e,t),DO.init(e,t)}),IO=$(`ZodULID`,(e,t)=>{bT.init(e,t),DO.init(e,t)}),LO=$(`ZodXID`,(e,t)=>{xT.init(e,t),DO.init(e,t)}),RO=$(`ZodKSUID`,(e,t)=>{ST.init(e,t),DO.init(e,t)}),zO=$(`ZodIPv4`,(e,t)=>{DT.init(e,t),DO.init(e,t)}),BO=$(`ZodIPv6`,(e,t)=>{OT.init(e,t),DO.init(e,t)}),VO=$(`ZodCIDRv4`,(e,t)=>{kT.init(e,t),DO.init(e,t)}),HO=$(`ZodCIDRv6`,(e,t)=>{AT.init(e,t),DO.init(e,t)}),UO=$(`ZodBase64`,(e,t)=>{MT.init(e,t),DO.init(e,t)}),WO=$(`ZodBase64URL`,(e,t)=>{PT.init(e,t),DO.init(e,t)}),GO=$(`ZodE164`,(e,t)=>{FT.init(e,t),DO.init(e,t)}),KO=$(`ZodJWT`,(e,t)=>{LT.init(e,t),DO.init(e,t)}),qO=$(`ZodNumber`,(e,t)=>{RT.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ID(e,t,n,r),e.gt=(t,n)=>e.check(aD(t,n)),e.gte=(t,n)=>e.check(oD(t,n)),e.min=(t,n)=>e.check(oD(t,n)),e.lt=(t,n)=>e.check(rD(t,n)),e.lte=(t,n)=>e.check(iD(t,n)),e.max=(t,n)=>e.check(iD(t,n)),e.int=t=>e.check(XO(t)),e.safe=t=>e.check(XO(t)),e.positive=t=>e.check(aD(0,t)),e.nonnegative=t=>e.check(oD(0,t)),e.negative=t=>e.check(rD(0,t)),e.nonpositive=t=>e.check(iD(0,t)),e.multipleOf=(t,n)=>e.check(sD(t,n)),e.step=(t,n)=>e.check(sD(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 JO(e){return QE(qO,e)}var YO=$(`ZodNumberFormat`,(e,t)=>{zT.init(e,t),qO.init(e,t)});function XO(e){return $E(YO,e)}var ZO=$(`ZodBoolean`,(e,t)=>{BT.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>LD(e,t,n,r)});function QO(e){return eD(ZO,e)}var $O=$(`ZodUnknown`,(e,t)=>{VT.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ek(){return tD($O)}var tk=$(`ZodNever`,(e,t)=>{HT.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>RD(e,t,n,r)});function nk(e){return nD(tk,e)}var rk=$(`ZodArray`,(e,t)=>{WT.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>UD(e,t,n,r),e.element=t.element,e.min=(t,n)=>e.check(lD(t,n)),e.nonempty=t=>e.check(lD(1,t)),e.max=(t,n)=>e.check(cD(t,n)),e.length=(t,n)=>e.check(uD(t,n)),e.unwrap=()=>e.element});function ik(e,t){return CD(rk,e,t)}var ak=$(`ZodObject`,(e,t)=>{YT.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>WD(e,t,n,r),bC(e,`shape`,()=>t.shape),e.keyof=()=>mk(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:ek()}),e.loose=()=>e.clone({...e._zod.def,catchall:ek()}),e.strict=()=>e.clone({...e._zod.def,catchall:nk()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>RC(e,t),e.safeExtend=t=>zC(e,t),e.merge=t=>BC(e,t),e.pick=t=>IC(e,t),e.omit=t=>LC(e,t),e.partial=(...t)=>VC(yk,e,t[0]),e.required=(...t)=>HC(kk,e,t[0])});function ok(e,t){return new ak({type:`object`,shape:e??{},...NC(t)})}var sk=$(`ZodUnion`,(e,t)=>{ZT.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>GD(e,t,n,r),e.options=t.options});function ck(e,t){return new sk({type:`union`,options:e,...NC(t)})}var lk=$(`ZodDiscriminatedUnion`,(e,t)=>{sk.init(e,t),QT.init(e,t)});function uk(e,t,n){return new lk({type:`union`,options:t,discriminator:e,...NC(n)})}var dk=$(`ZodIntersection`,(e,t)=>{$T.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>KD(e,t,n,r)});function fk(e,t){return new dk({type:`intersection`,left:e,right:t})}var pk=$(`ZodEnum`,(e,t)=>{nE.init(e,t),CO.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 pk({...t,checks:[],...NC(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 pk({...t,checks:[],...NC(r),entries:i})}});function mk(e,t){return new pk({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...NC(t)})}var hk=$(`ZodLiteral`,(e,t)=>{rE.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>BD(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 gk(e,t){return new hk({type:`literal`,values:Array.isArray(e)?e:[e],...NC(t)})}var _k=$(`ZodTransform`,(e,t)=>{iE.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>HD(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new uC(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(JC(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(JC(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function vk(e){return new _k({type:`transform`,transform:e})}var yk=$(`ZodOptional`,(e,t)=>{oE.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function bk(e){return new yk({type:`optional`,innerType:e})}var xk=$(`ZodExactOptional`,(e,t)=>{sE.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>eO(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sk(e){return new xk({type:`optional`,innerType:e})}var Ck=$(`ZodNullable`,(e,t)=>{cE.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>qD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function wk(e){return new Ck({type:`nullable`,innerType:e})}var Tk=$(`ZodDefault`,(e,t)=>{lE.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>YD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Ek(e,t){return new Tk({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():kC(t)}})}var Dk=$(`ZodPrefault`,(e,t)=>{dE.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>XD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ok(e,t){return new Dk({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():kC(t)}})}var kk=$(`ZodNonOptional`,(e,t)=>{fE.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>JD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ak(e,t){return new kk({type:`nonoptional`,innerType:e,...NC(t)})}var jk=$(`ZodCatch`,(e,t)=>{mE.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ZD(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Mk(e,t){return new jk({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Nk=$(`ZodPipe`,(e,t)=>{hE.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>QD(e,t,n,r),e.in=t.in,e.out=t.out});function Pk(e,t){return new Nk({type:`pipe`,in:e,out:t})}var Fk=$(`ZodReadonly`,(e,t)=>{_E.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$D(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ik(e){return new Fk({type:`readonly`,innerType:e})}var Lk=$(`ZodCustom`,(e,t)=>{yE.init(e,t),CO.init(e,t),e._zod.processJSONSchema=(t,n,r)=>VD(e,t,n,r)});function Rk(e,t={}){return wD(Lk,e,t)}function zk(e){return TD(e)}ok({ok:QO(),sessions:JO().int().nonnegative()}).strict(),uk(`type`,[ok({type:gk(`input`),data:EO().max(BS)}).strict(),ok({type:gk(`resize`),cols:JO().int().positive().max(WS),rows:JO().int().positive().max(GS),pixelWidth:JO().int().nonnegative().optional(),pixelHeight:JO().int().nonnegative().optional()}).strict()]);var Bk=ok({type:gk(`output`),data:EO().max(VS)}).strict(),Vk=ok({type:gk(`exit`),code:JO().int().nullable()}).strict(),Hk=ok({type:gk(`title`),title:EO().max(HS)}).strict(),Uk=ok({type:gk(`session`),shell:EO().min(1),shellName:EO().min(1),pid:JO().int().nonnegative(),cwd:EO().min(1),title:EO().max(HS)}).strict(),Wk=ok({type:gk(`cwd`),cwd:EO().min(1)}).strict(),Gk=ok({type:gk(`foreground`),process:EO().max(256).nullable()}).strict(),Kk=ok({type:gk(`notification`),body:EO().min(1).max(US)}).strict(),qk=mk([`modified`,`added`,`deleted`,`renamed`,`untracked`]),Jk=ok({isRepo:QO(),files:JO().int().nonnegative(),additions:JO().int().nonnegative(),deletions:JO().int().nonnegative(),binaries:JO().int().nonnegative()}).strict(),Yk=ok({type:gk(`git-diff-summary`),summary:Jk}).strict(),Xk=mk([`launched`,`running`,`completed`,`failed`,`missed`]),Zk=ok({runId:EO().min(1),at:JO().int().nonnegative(),status:Xk,exitCode:JO().int().nullable()}).strict(),Qk={id:EO().min(1),name:EO().min(1).max(120),schedule:EO().min(1).max(256),cwd:EO().min(1),command:EO().min(1).max(KS),enabled:QO(),createdAt:JO().int().nonnegative(),updatedAt:JO().int().nonnegative(),lastRun:Zk.nullable()},$k=ok(Qk).strict(),eA=ok({...Qk,nextRunAt:JO().int().nullable()}).strict();ok({version:gk(1),automations:ik($k)}).strict(),ok({name:EO().min(1).max(120),schedule:EO().min(1).max(256),cwd:EO().min(1),command:EO().min(1).max(KS),enabled:QO().optional()}).strict(),ok({name:EO().min(1).max(120).optional(),schedule:EO().min(1).max(256).optional(),cwd:EO().min(1).optional(),command:EO().min(1).max(KS).optional(),enabled:QO().optional()}).strict();var tA=ok({automations:ik(eA)}).strict(),nA=uk(`type`,[Bk,Vk,Hk,Uk,Wk,Gk,Kk,Yk,ok({type:gk(`automations`),automations:ik(eA)}).strict()]),rA=ok({path:EO().min(1),oldPath:EO().min(1).nullable(),status:qk,additions:JO().int().nonnegative(),deletions:JO().int().nonnegative(),binary:QO(),patch:EO().nullable(),patchOmitted:QO()}).strict(),iA=ok({isRepo:QO(),files:ik(rA)}).strict(),aA=b.createContext(void 0);function oA(e){let t=b.useContext(aA);if(t===void 0&&!e)throw Error(r_(47));return t}function sA(){return{...ob(),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 cA={...cb,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)},lA=class e extends Wy{constructor(e){let t={...sA(),...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 Qp,triggerElements:new ib},cA)}setOpen=(e,t)=>{let n=t.reason===Om,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)}),L_.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=Jp(()=>new e(n)).current,i=t??r;return Xp(r.disposeEffect),i}disposeEffect=()=>this.context.stickIfOpenTimeout.disposeEffect()};function uA({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=lA.useStore(s?.store,{modal:o,open:r,openProp:n,activeTriggerId:l,triggerIdProp:c});op(()=>{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}=Gb(d);nb(u);let{forceUnmount:h}=rb(d,u,()=>{u.update({stickIfOpen:!0,openChangeReason:null})});b.useEffect(()=>{d||u.context.stickIfOpenTimeout.clear()},[u,d]);let g=b.useCallback(()=>{u.setOpen(!1,zm(Lm))},[u]);b.useImperativeHandle(e.actionsRef,()=>({unmount:h,close:g}),[h,g]);let _=db({popupStore:u,onOpenChange:u.setOpen}),{getReferenceProps:v,getFloatingProps:x,getTriggerProps:S}=Sb([hv(_,{outsidePressEvent:{mouse:o===`trap-focus`?`sloppy`:`intentional`,touch:`sloppy`}}),Nb(_)]),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:q_()!=null});let E=b.useMemo(()=>({store:u}),[u]);return(0,y.jsx)(aA.Provider,{value:E,children:typeof t==`function`?t({payload:f}):t})}function dA(e){return oA(!0)?(0,y.jsx)(uA,{props:e}):(0,y.jsx)(Z_,{children:(0,y.jsx)(uA,{props:e})})}function fA(e,t){let n=b.useRef(null);return{preFocusGuardRef:n,handlePreFocusGuardFocus:Z(t=>{L_.flushSync(()=>{e.setOpen(!1,zm(Mm,t.nativeEvent,t.currentTarget))}),Ag(n.current)?.focus()}),handleFocusTargetFocus:Z(n=>{let r=e.select(`positionerElement`);if(r&&jg(n,r))e.context.beforeContentFocusGuardRef.current?.focus();else{L_.flushSync(()=>{e.setOpen(!1,zm(Mm,n.nativeEvent,n.currentTarget))});let i=kg(e.context.triggerFocusTargetRef.current||t.current);for(;i!==null&&ph(r,i);){let e=i;if(i=Eg(i),i===e)break}i?.focus()}})}}var pA=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=oA(!0),h=o?.store??m?.store;if(!h)throw Error(r_(74));let g=vx(d),_=h.useState(`isTriggerActive`,g),v=h.useState(`floatingRootContext`),x=h.useState(`isOpenedByTrigger`,g),S=b.useRef(null),{registerTrigger:C,isMountedByThisTrigger:w}=tb(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=xb(v,{enabled:v!=null&&c&&(D!==`touch`||T!==`trigger-press`),mouseOnly:!0,move:!1,handleClose:Hb(),restMs:l,delay:{close:u},triggerElementRef:S,isActiveTrigger:_,isClosing:()=>h.select(`transitionStatus`)===`ending`}),A=Sb([cv(v,{enabled:v!=null,stickIfOpen:E})]),j=h.useState(`triggerProps`,w),M={disabled:i,open:x},{getButtonProps:N,buttonRef:P}=hx({disabled:i,native:a}),F=b.useMemo(()=>({open(e){return e&&T===`trigger-press`?cx.open(e):sx.open(e)}}),[T]),I=E_(`button`,e,{state:M,ref:[P,t,C,S],props:[A.getReferenceProps(),k,j,{[N_]:``,id:g},p,N],stateAttributesMapping:F}),{preFocusGuardRef:L,handlePreFocusGuardFocus:R,handleFocusTargetFocus:z}=fA(h,S);return _&&!O?(0,y.jsxs)(b.Fragment,{children:[(0,y.jsx)(ah,{ref:L,onFocus:R}),(0,y.jsx)(b.Fragment,{children:I},g),(0,y.jsx)(ah,{ref:h.context.triggerFocusTargetRef,onFocus:z})]}):(0,y.jsx)(b.Fragment,{children:I},g)}),mA=b.createContext(void 0);function hA(){let e=b.useContext(mA);if(e===void 0)throw Error(r_(45));return e}var gA=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,{store:i}=oA();return i.useState(`mounted`)||n?(0,y.jsx)(mA.Provider,{value:n,children:(0,y.jsx)(H_,{ref:t,...r})}):null}),_A=b.createContext(void 0);function vA(){let e=b.useContext(_A);if(!e)throw Error(r_(46));return e}var yA=b.createContext(void 0);function bA(){return b.useContext(yA)?.direction??`ltr`}var xA=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`}=jh(e,t)||{};if(l==null)return{};let f=Yh(u),p={x:n,y:r},m=Lh(i),h=Fh(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=Ah(k,j,A),N=!c.arrow&&Nh(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}}}),SA=(e,t)=>({...xA(e),options:[e,t]}),CA={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 wy().fn(e)).data?.referenceHidden||a}}}},wA={sideX:`left`,sideY:`top`},TA={name:`adaptiveOrigin`,async fn(e){let{x:t,y:n,rects:{floating:r},elements:{floating:i},platform:a,strategy:o,placement:s}=e,c=lp(i),l=c.getComputedStyle(i);if(!(l.transitionDuration!==`0s`&&l.transitionDuration!==``))return{x:t,y:n,data:wA};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=Kp(i);d={width:e.documentElement.clientWidth,height:e.documentElement.clientHeight}}else await a.isElement?.(u)&&(d=await a.getDimensions(u));let f=Mh(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`:wA.sideX,g=f===`top`?`bottom`:wA.sideY;return{x:p,y:m,data:{sideX:h,sideY:g}}}};function EA(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 DA(e,t,n){let{rects:r,placement:i}=e;return{side:EA(t,Mh(i),n),align:Nh(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function OA(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=Xm(t),j=Xm(m),M=bA()===`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 ee={boundary:s===`clipping-ancestors`?`clippingAncestors`:s,padding:F},B=b.useRef(null),te=Xm(i),V=Xm(o),H=[yy(e=>{let t=DA(e,r,M),n=typeof te.current==`function`?te.current(t):te.current,i=typeof V.current==`function`?V.current(t):V.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[typeof i==`function`?0:i,typeof o==`function`?0:o,M,r])],ne=T===`none`&&w!==`shift`,U=!ne&&(l||g||w===`shift`),re=w===`none`?null:Sy({...ee,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}),W=ne?null:by(e=>{let t=Kp(e.elements.floating).documentElement;return{...ee,rootBoundary:g?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:T!==`none`,crossAxis:U,limiter:l||g?void 0:xy(e=>{if(!B.current)return{};let{width:t,height:n}=B.current.getBoundingClientRect(),r=Ih(Mh(e.placement)),i=r===`y`?t:n,a=r===`y`?F.left+F.right:F.top+F.bottom;return{offset:i/2+a/2}})}},[ee,l,g,F,T]);w===`shift`||T===`shift`||a===`center`?H.push(W,re):H.push(re,W),H.push(Cy({...ee,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=lp(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`)}}),SA(()=>({element:B.current||Kp(B.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=Mh(a),l=Ih(c),u=B.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(DA(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),{}}},CA,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}=ub({rootContext:p,open:f?m:void 0,placement:P,middleware:H,strategy:n,whileElementsMounted:f?void 0:(...e)=>ay(...e,ie),nodeId:_,externalTree:x}),{sideX:he,sideY:ge}=le.adaptiveOrigin||wA,_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=(kA(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`&&kA(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 ay(oe.domReference,oe.floating,ue,ie)},[f,m,oe,ue,ie]);let be=Mh(de),xe=EA(r,be,M),Se=Nh(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:B,arrowUncentered:Te,side:xe,align:Se,physicalSide:be,anchorHidden:Ce,refs:ae,context:fe,isPositioned:pe,update:ue}),[ve,we,B,Te,xe,Se,be,Ce,ae,fe,pe,ue])}function kA(e){return e!=null&&`current`in e}function AA(e){return e===`starting`?M_:om}function jA(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let c={...n};return s&&(c.pointerEvents=`none`),E_(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:c},AA(r),i],stateAttributesMapping:lx})}var MA=20;function NA(e,t,n,r){let[i,a]=b.useState(!1);X(()=>{if(!e||!t||n==null){a(!1);return}let r=Kp(n).documentElement.clientWidth,i=n.offsetWidth;a(r>0&&i>0&&i>=r-MA)},[e,t,n]),hm(e&&(!t||i),r)}var PA=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=F_,style:g,..._}=e,{store:v}=oA(),x=hA(),S=Y_(),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=Qy(A,!1,!1),I=OA({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?TA: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};NA(T&&O===!0&&E!==`trigger-hover`,k===`touch`,A,D);let z=b.useCallback(e=>{v.set(`positionerElement`,e)},[v]),ee=jA(e,R,{styles:I.positionerStyles,transitionStatus:M,props:_,refs:[t,z],hidden:!w,inert:!T});return(0,y.jsxs)(_A.Provider,{value:I,children:[w&&O===!0&&E!==`trigger-hover`&&(0,y.jsx)(Ix,{ref:v.context.internalBackdropRef,inert:Fx(!T),cutout:D}),(0,y.jsx)(X_,{id:S,children:ee})]})}),FA=b.createContext(void 0);function IA(e){let t=b.useContext(FA);if(t===void 0&&!e)throw Error(r_(69));return t}var LA=b.createContext(void 0);function RA(){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 zA(e){let{value:t,children:n}=e;return(0,y.jsx)(LA.Provider,{value:t,children:n})}var BA={...lx,...Zy},VA=b.forwardRef(function(e,t){let{className:n,render:r,initialFocus:i,finalFocus:a,style:o,...s}=e,{store:c}=oA(),l=vA(),u=IA(!0)!=null,{context:d,hasClosePart:f}=RA(),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`);$y({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`);yb(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=E_(`div`,e,{state:M,ref:[t,c.context.popupRef,P],props:[_,{"aria-labelledby":v,"aria-describedby":x,onKeyDown(e){u&&Mx.has(e.key)&&e.stopPropagation()}},AA(g),s],stateAttributesMapping:BA});return(0,y.jsx)(sv,{context:E,openInteractionType:m,modal:N,disabled:!C||w===`trigger-hover`,initialFocus:j,returnFocus:a,restoreFocus:`popup`,previousFocusableElement:pp(T)?T:void 0,nextFocusableElement:c.context.triggerFocusTargetRef,beforeContentFocusGuardRef:c.context.beforeContentFocusGuardRef,children:(0,y.jsx)(zA,{value:d,children:F})})});function HA(e){let[t,n]=b.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function UA({...e}){return(0,y.jsx)(dA,{"data-slot":`popover`,...e})}function WA({...e}){return(0,y.jsx)(pA,{"data-slot":`popover-trigger`,...e})}function GA({className:e,align:t=`center`,alignOffset:n=0,side:r=`bottom`,sideOffset:i=4,...a}){return(0,y.jsx)(gA,{children:(0,y.jsx)(PA,{align:t,alignOffset:n,side:r,sideOffset:i,className:`isolate z-50`,children:(0,y.jsx)(VA,{"data-slot":`popover-content`,className:ap(`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 KA=b.forwardRef(function(e,t){let{className:n,render:r,orientation:i=`horizontal`,style:a,...o}=e;return E_(`div`,e,{state:{orientation:i},ref:t,props:[{role:`separator`,"aria-orientation":i},o]})});function qA({className:e,orientation:t=`horizontal`,...n}){return(0,y.jsx)(KA,{"data-slot":`separator`,orientation:t,className:ap(`shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch`,e),...n})}var JA=b.createContext(void 0);function YA(){let e=b.useContext(JA);if(e===void 0)throw Error(r_(63));return e}var XA=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}({}),ZA={...hS,checked(e){return e?{[XA.checked]:``}:{[XA.unchecked]:``}}},QA=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}=yS(),{state:C,setTouched:w,setDirty:T,validityData:E,setFilled:D,setFocused:O,shouldValidateOnChange:k,validationMode:A,disabled:j,name:M,validation:N}=_S(),{labelId:P}=xS(),F=j||m,I=M??l,L=Z(d),R=b.useRef(null),z=Wm(R,c,N.inputRef),ee=b.useRef(null),B=vx(),te=TS({id:s,implicit:!1,controlRef:ee}),V=u?void 0:te,[H,ne]=ES({controlled:n,default:!!i,name:`Switch`,state:`checked`});DS(ee,{id:B,value:H}),X(()=>{R.current&&D(R.current.checked)},[R,D]),Wb(H,()=>{S(I),T(H!==E.initialValue),D(H),k()?N.commit(H):N.commit(H,!0)});let{getButtonProps:U,buttonRef:re}=hx({disabled:F,native:u}),W=SS(a,P,R,!u,V),ie={id:u?te:B,role:`switch`,"aria-checked":H,"aria-readonly":f||void 0,"aria-required":p||void 0,"aria-labelledby":W,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(()=>f_({checked:H,disabled:F,form:o,id:V,name:I,required:p,style:I?ih:rh,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=zm(Em,e.nativeEvent);L?.(t,n),!n.isCanceled&&ne(t)},onFocus(){ee.current?.focus()}},N.getInputValidationProps,_===void 0?om:{value:_}),[H,F,o,z,V,I,L,f,p,ne,N,_]),oe=b.useMemo(()=>({...C,checked:H,disabled:F,readOnly:f,required:p}),[C,H,F,f,p]),se=E_(`span`,e,{state:oe,ref:[t,ee,re],props:[ie,N.getValidationProps,x,U],stateAttributesMapping:ZA});return(0,y.jsxs)(JA.Provider,{value:oe,children:[se,!H&&I&&g!==void 0&&(0,y.jsx)(`input`,{type:`hidden`,form:o,name:I,value:g}),(0,y.jsx)(`input`,{...ae,suppressHydrationWarning:!0})]})}),$A=b.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{state:o}=_S(),s=YA();return E_(`span`,e,{state:{...o,...s},ref:t,stateAttributesMapping:ZA,props:a})});function ej({className:e,size:t=`default`,...n}){return(0,y.jsx)(QA,{"data-slot":`switch`,"data-size":t,className:ap(`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)($A,{"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 tj=1e3,nj=1.2,rj=.1,ij=`localterm`,aj=`† `,oj=`npx @monotykamary/localterm@latest start`,sj=1500,cj=5e3,lj=.35,uj=2e3,dj=`localterm:diff-view-mode`,fj=3e4,pj=1500,mj=`#ffc79944`,hj=`#ffc799`,gj=`#ff8080`,_j=`localterm:terminal-theme-id`,vj=`localterm:terminal-font-id`,yj=`localterm:terminal-font-size`,bj=`localterm:terminal-line-height`,xj=`localterm:terminal-cursor-style`,Sj=`localterm:terminal-cursor-blink`,Cj=`localterm:terminal-scrollback`,wj=`localterm:terminal-scroll-on-user-input`,Tj=`localterm:terminal-padding-x`,Ej=`localterm:terminal-padding-y`,Dj=`localterm-google-fonts`,Oj=`localterm:nerd-font-enabled`,kj=`/api/automations`,Aj=async e=>{try{let t=await fetch(new URL(kj,window.location.href),{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return null;let n=await t.json(),r=eA.safeParse(n&&typeof n==`object`?Reflect.get(n,`automation`):null);return r.success?r.data:null}catch{return null}},jj=`/api/automations`,Mj=async e=>{try{return(await fetch(new URL(`${jj}/${encodeURIComponent(e)}`,window.location.href),{method:`DELETE`})).ok}catch{return!1}},Nj=`/api/automations`,Pj=async e=>{try{let t=await fetch(new URL(Nj,window.location.href),{signal:e});if(!t.ok)return null;let n=tA.safeParse(await t.json());return n.success?n.data.automations:null}catch{return null}},Fj=60*1e3,Ij=60*Fj,Lj=24*Ij,Rj=e=>e<Fj?`<1m`:e<Ij?`${Math.floor(e/Fj)}m`:e<Lj?`${Math.floor(e/Ij)}h`:`${Math.floor(e/Lj)}d`,zj=(e,t)=>{let n=e-t;return n>=0?`in ${Rj(n)}`:`${Rj(-n)} ago`},Bj=`/api/automations`,Vj=async e=>{try{return(await fetch(new URL(`${Bj}/${encodeURIComponent(e)}/run`,window.location.href),{method:`POST`})).ok}catch{return!1}},Hj=`/api/automations`,Uj=async(e,t)=>{try{let n=await fetch(new URL(`${Hj}/${encodeURIComponent(e)}`,window.location.href),{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify(t)});if(!n.ok)return null;let r=await n.json(),i=eA.safeParse(r&&typeof r==`object`?Reflect.get(r,`automation`):null);return i.success?i.data:null}catch{return null}},Wj=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,Gj=`h-7 px-2 text-xs md:text-xs`,Kj=e=>e.status===`launched`?{label:`launching…`,className:`text-amber-400`}:e.status===`running`?{label:`running…`,className:`text-sky-400`}:e.status===`completed`?{label:`ok`,className:`text-emerald-400`}:e.status===`failed`?{label:e.exitCode===null?`failed`:`exit ${e.exitCode}`,className:`text-red-400`}:{label:`missed`,className:`text-muted-foreground`},qj=e=>({id:null,name:``,schedule:``,cwd:e??``,command:``,enabled:!0}),Jj=e=>({id:e.id,name:e.name,schedule:e.schedule,cwd:e.cwd,command:e.command,enabled:e.enabled}),Yj=({open:e,onOpenChange:t,automations:n,onAutomationsLoaded:r,defaultCwd:i,isMac:a})=>{let[o,s]=(0,b.useState)(null),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(null),[m,h]=(0,b.useState)(()=>Date.now()),g=(0,b.useCallback)(async()=>{let e=await Pj();e&&r(e)},[r]);(0,b.useEffect)(()=>{if(!e){s(null),d(!1),p(null);return}h(Date.now()),g();let t=window.setInterval(()=>h(Date.now()),fj);return()=>window.clearInterval(t)},[e,g]);let _=async()=>{if(!o)return;l(!0),d(!1);let e={name:o.name.trim(),schedule:o.schedule.trim(),cwd:o.cwd.trim(),command:o.command.trim(),enabled:o.enabled},t=o.id?await Uj(o.id,e):await Aj(e);if(l(!1),!t){d(!0);return}s(null),await g()},v=async(e,t)=>{await Uj(e.id,{enabled:t}),await g()},x=async e=>{await Vj(e.id),await g()},S=async e=>{if(f!==e.id){p(e.id);return}p(null),await Mj(e.id),await g()},C=o?oC(o.schedule.trim()):null,w=o?.schedule.trim()??``,T=C?cC(C,new Date(m))?.getTime()??null:null,E=o!==null&&o.name.trim().length>0&&o.command.trim().length>0&&o.cwd.trim().length>0&&C!==null;return(0,y.jsxs)(UA,{open:e,onOpenChange:t,children:[(0,y.jsx)(WA,{render:(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-sm`,"aria-label":`automations`,title:`${a?`⌘`:`Ctrl+`}J`,className:`hover:text-foreground`}),children:(0,y.jsx)(dd,{})}),(0,y.jsxs)(GA,{side:`bottom`,align:`end`,sideOffset:8,className:ap(`w-96 gap-0 overflow-hidden p-3`,zx,Bx),children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(`span`,{className:Wj,children:`Automations`}),o===null?(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-sm`,"aria-label":`new automation`,className:`hover:text-foreground`,onClick:()=>s(qj(i)),children:(0,y.jsx)(Td,{})}):null]}),o===null?(0,y.jsx)(`div`,{className:`mt-2 flex max-h-80 flex-col gap-1 overflow-y-auto`,children:n===null?(0,y.jsx)(`p`,{className:`py-4 text-center text-xs text-muted-foreground`,children:`Loading…`}):n.length===0?(0,y.jsx)(`p`,{className:`py-4 text-center text-xs text-muted-foreground`,children:`No automations yet. Scheduled commands open a new tab when they run.`}):n.map(e=>(0,y.jsxs)(`div`,{className:`group/automation flex flex-col gap-0.5 rounded-md px-2 py-1.5 hover:bg-muted/50`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:ap(`min-w-0 truncate text-xs text-foreground/90`,!e.enabled&&`text-muted-foreground line-through`),title:e.name,children:e.name}),(0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-xs`,"aria-label":`run ${e.name} now`,className:`opacity-0 transition-opacity group-hover/automation:opacity-100 hover:text-foreground`,onClick:()=>void x(e),children:(0,y.jsx)(wd,{})}),(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-xs`,"aria-label":`edit ${e.name}`,className:`opacity-0 transition-opacity group-hover/automation:opacity-100 hover:text-foreground`,onClick:()=>s(Jj(e)),children:(0,y.jsx)(Cd,{})}),(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-xs`,"aria-label":f===e.id?`confirm delete ${e.name}`:`delete ${e.name}`,className:ap(`opacity-0 transition-opacity group-hover/automation:opacity-100`,f===e.id?`text-red-400 opacity-100 hover:text-red-400`:`hover:text-foreground`),onClick:()=>void S(e),children:(0,y.jsx)(Ad,{})}),(0,y.jsx)(ej,{size:`sm`,"aria-label":`toggle ${e.name}`,checked:e.enabled,onCheckedChange:t=>void v(e,t)})]})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2 font-mono text-[10px] text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`min-w-0 truncate`,title:e.command,children:e.command}),(0,y.jsx)(`span`,{className:`shrink-0 tabular-nums`,children:e.schedule})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-[10px] text-muted-foreground`,children:[(0,y.jsx)(`span`,{className:`min-w-0 truncate`,title:e.cwd,children:e.cwd}),(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2 tabular-nums`,children:[e.lastRun?(0,y.jsx)(`span`,{className:Kj(e.lastRun).className,title:`last run ${zj(e.lastRun.at,m)}`,children:Kj(e.lastRun).label}):null,e.nextRunAt===null?(0,y.jsx)(`span`,{children:`paused`}):(0,y.jsx)(`span`,{children:zj(e.nextRunAt,m)})]})]})]},e.id))}):(0,y.jsxs)(`div`,{className:`mt-2 flex flex-col gap-2`,children:[(0,y.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-muted-foreground`,children:[`Name`,(0,y.jsx)(AS,{value:o.name,autoFocus:!0,placeholder:`nightly build`,"aria-label":`automation name`,className:Gj,onChange:e=>s({...o,name:e.target.value})})]}),(0,y.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-muted-foreground`,children:[`Command`,(0,y.jsx)(AS,{value:o.command,placeholder:`pnpm build`,"aria-label":`automation command`,className:ap(Gj,`font-mono`),onChange:e=>s({...o,command:e.target.value})})]}),(0,y.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-muted-foreground`,children:[`Directory`,(0,y.jsx)(AS,{value:o.cwd,placeholder:`/path/to/project`,"aria-label":`automation directory`,className:ap(Gj,`font-mono`),onChange:e=>s({...o,cwd:e.target.value})})]}),(0,y.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-muted-foreground`,children:[`Schedule (cron)`,(0,y.jsx)(AS,{value:o.schedule,placeholder:`0 9 * * mon-fri`,"aria-label":`automation schedule`,className:ap(Gj,`font-mono`),onChange:e=>s({...o,schedule:e.target.value})}),(0,y.jsx)(`span`,{className:`text-[10px] tabular-nums`,children:w.length===0?`minute hour day month weekday — or @hourly, @daily, @weekly`:C===null?`invalid cron expression`:T===null?`schedule never fires`:`next run ${zj(T,m)}`})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[`Enabled`,(0,y.jsx)(ej,{"aria-label":`automation enabled`,checked:o.enabled,onCheckedChange:e=>s({...o,enabled:e})})]}),u?(0,y.jsx)(`p`,{className:`text-[10px] text-red-400`,children:`Couldn't save — check the schedule and that the directory exists.`}):null,(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,y.jsx)(Qx,{variant:`ghost`,size:`xs`,onClick:()=>{s(null),d(!1)},children:`Cancel`}),(0,y.jsx)(Qx,{variant:`secondary`,size:`xs`,disabled:!E||c,onClick:()=>void _(),children:o.id?`Save`:`Create`})]})]})]})]})},Xj=`flex w-full items-center gap-2.5 rounded-sm px-2.5 py-2 text-sm text-muted-foreground outline-none transition-colors`,Zj=10,Qj=(e,t)=>{let n=e.toLowerCase(),r=t.toLowerCase(),i=r.indexOf(n);if(i!==-1){let e=Array.from({length:n.length},(e,t)=>i+t);return r===n?{score:1,indices:e}:i===0?{score:2,indices:e}:{score:3,indices:e}}let a=eM(n,r);return a?{score:4+(1-a.score/$j(n.length)),indices:a.indices}:null},$j=e=>{let t=e;return t+=(e-1)*.5,t+=e*.5,t},eM=(e,t)=>{let n=0,r=0,i=-1,a=[];for(let o=0;o<t.length&&n<e.length;o++)t[o]===e[n]&&(r+=1,i===o-1&&(r+=.5),(o===0||t[o-1]===` `||t[o-1]===`-`)&&(r+=.5),i=o,a.push(o),n++);return n===e.length?{score:r,indices:a}:null},tM=(e,t)=>t?e.flatMap(e=>{let n=Qj(t,e.label);if(n)return[{cmd:e,score:n.score,indices:n.indices}];let r=Qj(t,`${e.category} ${e.label}`);return r?[{cmd:e,score:Zj+r.score,indices:null}]:[]}).sort((e,t)=>e.score-t.score).map(({cmd:e,indices:t})=>({cmd:e,indices:t})):e.map(e=>({cmd:e,indices:null})),nM=({label:e,indices:t})=>{if(!t||t.length===0)return(0,y.jsx)(y.Fragment,{children:e});let n=new Set(t),r=[];for(let t=0;t<e.length;t++){let i=n.has(t),a=r[r.length-1];a&&a.hit===i?a.text+=e[t]:r.push({text:e[t],hit:i})}return(0,y.jsx)(y.Fragment,{children:r.map((e,t)=>(0,y.jsx)(`span`,{className:e.hit?`font-semibold text-foreground`:void 0,children:e.text},t))})},rM=({keys:e,label:t})=>(0,y.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,y.jsx)(`kbd`,{className:`rounded border border-border/40 bg-muted/30 px-1 font-mono text-[10px]`,children:e}),t]}),iM=({open:e,onClose:t,commands:n,onActiveItemChange:r})=>{let[i,a]=(0,b.useState)(``),[o,s]=(0,b.useState)(0),[c,l]=(0,b.useState)(!1),[u,d]=(0,b.useState)(!1),f=(0,b.useRef)(null),p=(0,b.useId)(),m=(0,b.useMemo)(()=>tM(n,i),[n,i]),h=(0,b.useMemo)(()=>{let e=[];return m.forEach((t,n)=>{let r=e[e.length-1];r&&r.category===t.cmd.category?r.entries.push({entry:t,index:n}):e.push({category:t.cmd.category,entries:[{entry:t,index:n}]})}),e},[m]);(0,b.useEffect)(()=>{if(e){l(!0),a(``),s(0);let e=requestAnimationFrame(()=>{d(!0),f.current?.focus()});return()=>cancelAnimationFrame(e)}if(d(!1),c){let e=window.setTimeout(()=>l(!1),150);return()=>window.clearTimeout(e)}},[e]),(0,b.useEffect)(()=>{s(0)},[i]),(0,b.useEffect)(()=>{r&&r(e?m[o]?.cmd??null:null)},[e,m,o,r]),(0,b.useEffect)(()=>{let t=m[o]?.cmd;!e||!t||document.getElementById(`${p}-${t.id}`)?.scrollIntoView?.({block:`nearest`})},[o,m,e,p]),(0,b.useEffect)(()=>{if(!e||!c)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())};return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e,c,t]);let g=(0,b.useCallback)(()=>{let e=m[o]?.cmd;e&&(t(),e.action())},[o,m,t]),_=(0,b.useCallback)(e=>{let t=m.length,n=e.key===`ArrowDown`||e.ctrlKey&&e.key===`n`,r=e.key===`ArrowUp`||e.ctrlKey&&e.key===`p`;if(n||r){if(e.preventDefault(),t===0)return;s(e=>(e+(n?1:-1)+t)%t);return}if(e.key===`Enter`){e.preventDefault(),g();return}},[g,m.length]);if(!c)return null;let v=e&&u,x=(e,n,r)=>{let{cmd:i,indices:a}=e;return(0,y.jsxs)(`button`,{id:`${p}-${i.id}`,type:`button`,role:`option`,"aria-selected":n===o,className:ap(Xj,n===o&&`bg-foreground/10 text-foreground`),onMouseMove:()=>{n!==o&&s(n)},onClick:()=>{t(),i.action()},children:[i.icon?(0,y.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70`,children:i.icon}):(0,y.jsx)(`span`,{className:`w-4 shrink-0`}),(0,y.jsx)(`span`,{className:`flex-1 truncate text-left`,children:(0,y.jsx)(nM,{label:i.label,indices:a})}),r?(0,y.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wide text-muted-foreground/50`,children:i.category}):null,i.checked?(0,y.jsx)(fd,{"aria-label":`active`,className:`size-3.5 shrink-0`}):null,i.shortcut?(0,y.jsx)(`kbd`,{className:`shrink-0 rounded border border-border/40 bg-muted/30 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground/70`,children:i.shortcut}):null]},i.id)};return(0,y.jsxs)(`div`,{className:`fixed inset-0 z-50 flex items-start justify-center pt-[18vh]`,children:[(0,y.jsx)(`div`,{"data-open":v||void 0,"data-closed":!v||void 0,className:ap(Gx),onClick:t}),(0,y.jsxs)(`div`,{role:`dialog`,"aria-label":`command palette`,"aria-modal":!0,"data-open":v||void 0,"data-closed":!v||void 0,className:ap(`relative z-10 flex max-h-[400px] w-[520px] max-w-[calc(100vw-2rem)] flex-col overflow-hidden rounded-xl`,Ux,Kx),children:[(0,y.jsxs)(`div`,{className:`flex items-center border-b border-border/40 px-3`,children:[(0,y.jsx)(Dd,{className:`size-4 shrink-0 text-muted-foreground/60`}),(0,y.jsx)(`input`,{ref:f,autoFocus:!0,type:`text`,value:i,onChange:e=>a(e.target.value),onKeyDown:_,placeholder:`Type a command…`,"aria-label":`search commands`,"aria-activedescendant":m[o]?`${p}-${m[o].cmd.id}`:void 0,"aria-controls":p,"aria-expanded":!0,"aria-haspopup":`listbox`,role:`combobox`,className:`h-10 w-full bg-transparent px-2.5 text-sm text-foreground outline-none placeholder:text-muted-foreground/70`})]}),(0,y.jsx)(`div`,{id:p,role:`listbox`,className:`flex-1 overflow-y-auto overscroll-contain p-1.5 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:m.length===0?(0,y.jsxs)(`div`,{className:`px-2.5 py-6 text-center text-sm text-muted-foreground/70`,children:[`No commands match “`,i,`”`]}):i?m.map((e,t)=>x(e,t,!0)):h.map(e=>(0,y.jsxs)(`div`,{role:`group`,"aria-label":e.category,children:[(0,y.jsx)(`div`,{className:`px-2.5 pb-1 pt-2 text-[10px] font-medium uppercase tracking-wide text-muted-foreground/50`,children:e.category}),e.entries.map(({entry:e,index:t})=>x(e,t,!1))]},e.category))}),(0,y.jsxs)(`div`,{className:`flex items-center gap-3 border-t border-border/40 px-3 py-1.5 text-[10px] text-muted-foreground/60`,children:[(0,y.jsx)(rM,{keys:`↑↓`,label:`navigate`}),(0,y.jsx)(rM,{keys:`↵`,label:`run`}),(0,y.jsx)(rM,{keys:`esc`,label:`close`}),(0,y.jsxs)(`span`,{className:`ml-auto`,children:[m.length,` `,m.length===1?`command`:`commands`]})]})]})]})},aM=e=>{let t=[],n=[],r=[],i=()=>{let e=Math.max(n.length,r.length);for(let i=0;i<e;i+=1)t.push({left:n[i]??null,right:r[i]??null});n=[],r=[]};for(let a of e.lines){if(a.type===`del`){n.push(a);continue}if(a.type===`add`){r.push(a);continue}i(),t.push({left:a,right:a})}return i(),t},oM=e=>e.type===`del`?e.oldLine===null?null:{side:`old`,lineNumber:e.oldLine}:e.newLine===null?null:{side:`new`,lineNumber:e.newLine},sM=e=>`${e.side}:${e.lineNumber}`,cM=e=>{let t=[],n=new Map;return e.forEach((e,r)=>{for(let i of e.lines){let e=oM(i);if(!e)continue;let a={target:e,hunkIndex:r,order:t.length};t.push(a),n.set(sM(e),a)}}),{ordered:t,byKey:n}},lM=(e,t)=>{let n=t;for(let r=t.order+1;r<e.ordered.length&&e.ordered[r].hunkIndex===t.hunkIndex;r+=1)n=e.ordered[r];return n},uM=(e,t)=>{let n=t;for(let r=t.order-1;r>=0&&e.ordered[r].hunkIndex===t.hunkIndex;--r)n=e.ordered[r];return n},dM=(e,t,n)=>{let r=e.byKey.get(sM(t)),i=e.byKey.get(sM(n));if(!r||!i)return null;let a=r.order<=i.order?r:i,o=r.order<=i.order?i:r;return a.hunkIndex!==o.hunkIndex&&(a===r?o=lM(e,r):a=uM(e,r)),{start:a.target,end:o.target}},fM=(e,t)=>{let n=new Set,r=e.byKey.get(sM(t.start)),i=e.byKey.get(sM(t.end));if(!r||!i||r.order>i.order)return n;for(let t=r.order;t<=i.order;t+=1)n.add(sM(e.ordered[t].target));return n},pM=`/api/git/diff`,mM=(e,t)=>{let n=new URL(e,window.location.href);return n.searchParams.set(`cwd`,t),n.toString()},hM=async(e,t)=>{try{let n=await fetch(mM(pM,e),{signal:t});if(!n.ok)return null;let r=iA.safeParse(await n.json());return r.success?r.data:null}catch{return null}},gM=e=>`${e.filePath}\u0000${e.side}:${e.lineNumber}`,_M=e=>{let{startSide:t,startLineNumber:n}=e;return t===void 0||n===void 0||t===e.side&&n===e.lineNumber?null:{side:t,lineNumber:n}},vM="Please address the following code review comments. Run `git diff` (or `git diff HEAD`) to see the full context of any changes, especially for deleted lines.\n",yM=e=>{let{filePath:t,side:n,lineNumber:r}=e,i=_M(e);if(!i)return n===`old`?`${t} (deleted, was L${r} — see \`git diff\`)`:`${t} L${r}`;if(i.side===`new`&&n===`new`)return`${t} L${i.lineNumber}-L${r}`;if(i.side===`old`&&n===`old`)return`${t} (deleted, was L${i.lineNumber}-L${r} — see \`git diff\`)`;let a=(e,t)=>e===`old`?`old L${t}`:`L${t}`;return`${t} ${a(i.side,i.lineNumber)} through ${a(n,r)} (range spans removed lines — see \`git diff\`)`},bM=e=>{let t=[...e].sort((e,t)=>e.filePath.localeCompare(t.filePath)||(e.startLineNumber??e.lineNumber)-(t.startLineNumber??t.lineNumber)||e.lineNumber-t.lineNumber),n=vM;for(let e of t)n+=`\n- ${yM(e)}: ${e.comment}`;return n},xM=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@(.*)$/,SM=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=xM.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},CM=e=>e.reduce((e,t)=>e+t.lines.length,0),wM=e=>{if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);return t===null||t.trim()===``?null:t}catch{return null}},TM=(e,t)=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,t)}catch{}},EM=(e,t,n)=>({load:()=>{let r=wM(e);if(r===null)return t;let i=Number(r);return Number.isFinite(i)?n(i):t},store:t=>TM(e,String(t))}),DM=(e,t)=>({load:()=>{let n=wM(e);return n===`true`?!0:n===`false`?!1:t},store:t=>TM(e,String(t))}),OM=(e,t,n)=>({load:()=>{let r=wM(e);return r!==null&&n(r)?r:t},store:t=>TM(e,t)}),kM=(e,t,n)=>({load:()=>t(wM(e)),store:t=>TM(e,n(t))}),AM=OM(dj,`unified`,e=>e===`unified`||e===`split`),jM=AM.load,MM=AM.store,NM=(e,t)=>{let n=e=>`${e.side===`old`?`old `:``}L${e.lineNumber}`;return e.side===t.side?`${e.side===`old`?`old `:``}L${e.lineNumber}–L${t.lineNumber}`:`${n(e)} – ${n(t)}`},PM=()=>(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 border-l-2 border-primary/60 bg-primary/10`}),FM={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`}},IM=`text-emerald-400`,LM=`text-red-400`,RM=`w-12 shrink-0 select-none px-2 text-right text-muted-foreground/50 tabular-nums`,zM=e=>{let t=e.lastIndexOf(`/`);return t===-1?{directory:``,basename:e}:{directory:e.slice(0,t+1),basename:e.slice(t+1)}},BM=e=>e===`add`?`bg-emerald-500/10`:e===`del`?`bg-red-500/10`:``,VM=e=>e===`context`?`text-muted-foreground`:`text-foreground/90`,HM=({onClick:e,onDragStart:t})=>(0,y.jsx)(`button`,{type:`button`,onClick:e,onPointerDown:e=>{e.button===0&&(e.preventDefault(),t())},"aria-label":`comment on line — drag to select multiple lines`,className:`absolute top-1/2 left-1 z-10 hidden size-4 -translate-y-1/2 items-center justify-center rounded-sm bg-primary text-primary-foreground transition-transform group-hover/line:flex hover:scale-110`,children:(0,y.jsx)(yd,{className:`size-3`,"aria-hidden":`true`})}),UM=({initialComment:e,onSave:t,onCancel:n})=>{let[r,i]=(0,b.useState)(e),a=r.trim(),o=()=>{a&&t(a)};return(0,y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,y.jsx)(jS,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),n()):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),o())},placeholder:`Leave a comment on this line…`,"aria-label":`line comment`,className:`min-h-12 text-xs`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,y.jsx)(Qx,{size:`xs`,onClick:o,disabled:!a,children:`Save comment`}),(0,y.jsx)(Qx,{size:`xs`,variant:`ghost`,onClick:n,children:`Cancel`})]})]})},WM=({annotation:e,isEditing:t,rangeLabel:n,onEdit:r,onSave:i,onCancel:a,onDelete:o})=>(0,y.jsx)(`div`,{className:`border-y border-border/40 bg-muted/20 py-2 pr-4 pl-3 font-sans`,children:(0,y.jsxs)(`div`,{className:`sticky left-3 max-w-xl`,children:[n?(0,y.jsx)(`div`,{className:`mb-1 font-mono text-[10px] tracking-wide text-muted-foreground/80`,children:n}):null,t?(0,y.jsx)(UM,{initialComment:e?.comment??``,onSave:i,onCancel:a}):e?(0,y.jsxs)(`div`,{className:`group/comment flex items-start gap-2`,children:[(0,y.jsx)(bd,{className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,y.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap text-foreground/90`,children:e.comment}),(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/comment:opacity-100`,children:[(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-xs`,onClick:r,"aria-label":`edit comment`,className:`hover:text-foreground`,children:(0,y.jsx)(Cd,{})}),(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-xs`,onClick:o,"aria-label":`delete comment`,className:`hover:text-destructive`,children:(0,y.jsx)(Ad,{})})]})]}):null]})}),GM=({line:e,highlighted:t,onAnnotate:n,onDragStart:r,onDragEnter:i})=>(0,y.jsxs)(`div`,{className:ap(`group/line relative flex`,BM(e.type)),onPointerEnter:i,children:[n&&r?(0,y.jsx)(HM,{onClick:n,onDragStart:r}):null,(0,y.jsx)(`span`,{className:RM,children:e.oldLine??``}),(0,y.jsx)(`span`,{className:RM,children:e.newLine??``}),(0,y.jsx)(`span`,{className:ap(`w-5 shrink-0 select-none text-center`,e.type===`add`&&IM,e.type===`del`&&LM),children:e.type===`add`?`+`:e.type===`del`?`-`:``}),(0,y.jsxs)(`span`,{className:ap(`whitespace-pre pr-4`,VM(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]}),t?(0,y.jsx)(PM,{}):null]}),KM=({line:e,side:t,onAnnotate:n,onDragStart:r})=>{if(!e)return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:RM}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 bg-muted/20`})]});let i=e.type===`context`?`context`:t===`left`?`del`:`add`;return(0,y.jsxs)(y.Fragment,{children:[n&&r?(0,y.jsx)(HM,{onClick:n,onDragStart:r}):null,(0,y.jsx)(`span`,{className:ap(RM,BM(i)),children:t===`left`?e.oldLine??``:e.newLine??``}),(0,y.jsx)(`span`,{className:ap(`min-w-0 flex-1 overflow-x-clip whitespace-pre pr-2`,BM(i),VM(e.type)),children:e.text})]})},qM=({hunk:e})=>(0,y.jsx)(`div`,{className:`select-none bg-muted/30 px-4 py-0.5 text-muted-foreground/60`,children:e.header}),JM=({file:e,viewMode:t,annotations:n,editingKey:r,pendingRange:i,dragCancelRef:a,onOpenEditor:o,onSaveAnnotation:s,onCancelEditor:c,onDeleteAnnotation:l})=>{let[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(null),m=(0,b.useMemo)(()=>e.patch?SM(e.patch):[],[e.patch]),h=(0,b.useMemo)(()=>CM(m),[m]),g=(0,b.useMemo)(()=>cM(m),[m]),_=f!==null,v=f?dM(g,f.anchor,f.focus):null,x=(0,b.useRef)(v);x.current=v;let S=e=>p({anchor:e,focus:e}),C=e=>p(t=>t&&{...t,focus:e});(0,b.useEffect)(()=>{d(!1),p(null)},[e.path]),(0,b.useEffect)(()=>{if(!_)return;let t=()=>p(null);a.current=t;let n=()=>{p(null);let t=x.current;t&&o(gM({filePath:e.path,...t.end}),sM(t.start)===sM(t.end)?void 0:{filePath:e.path,...t})};return window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,t),()=>{a.current=null,window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,t)}},[_,e.path,o,a]);let w=(0,b.useMemo)(()=>{let t=new Set,r=e=>{if(e)for(let n of fM(g,e))t.add(n)};r(v),i&&i.filePath===e.path&&r(i);for(let t of Object.values(n)){if(t.filePath!==e.path)continue;let n=_M(t);n&&r({start:n,end:{side:t.side,lineNumber:t.lineNumber}})}return t},[g,v,i,n,e.path]);if(e.binary)return(0,y.jsx)(YM,{icon:!0,children:`Binary file — no text diff to show.`});if(e.patchOmitted)return(0,y.jsx)(YM,{icon:!0,children:`Diff too large to display.`});if(m.length===0)return(0,y.jsx)(YM,{children:e.status===`renamed`?`Renamed without content changes.`:e.status===`untracked`&&e.additions===0?`Empty file.`:`No content changes.`});let T=u?1/0:uj,E=0,D=[];for(let e of m){if(E>=T)break;let t=T-E,n=e.lines.length<=t?e.lines:e.lines.slice(0,t);D.push(n===e.lines?e:{header:e.header,lines:n}),E+=n.length}let O=h-E,k=t=>{let a=oM(t);if(!a)return null;let o=gM({filePath:e.path,...a}),c=n[o],l=r===o,u=l&&i&&i.filePath===e.path?i.start:c?_M(c):null;return{key:o,target:a,saved:c,isEditing:l,rangeStart:u,save:t=>s({filePath:e.path,...a,...u?{startSide:u.side,startLineNumber:u.lineNumber}:{},comment:t})}},A=e=>e&&(e.saved||e.isEditing)?(0,y.jsx)(WM,{annotation:e.saved,isEditing:e.isEditing,rangeLabel:e.rangeStart?NM(e.rangeStart,e.target):null,onEdit:()=>o(e.key),onSave:e.save,onCancel:c,onDelete:()=>l(e.key)}):null;return(0,y.jsxs)(`div`,{className:ap(`pb-4 font-mono text-xs leading-5`,t===`unified`&&`min-w-max`,_&&`select-none`),children:[D.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(qM,{hunk:e}),t===`unified`?e.lines.map((e,t)=>{let n=k(e);return(0,y.jsxs)(b.Fragment,{children:[(0,y.jsx)(GM,{line:e,highlighted:n!==null&&w.has(sM(n.target)),onAnnotate:n?()=>o(n.key):void 0,onDragStart:n?()=>S(n.target):void 0,onDragEnter:_&&n?()=>C(n.target):void 0}),A(n)]},t)}):aM(e).map((e,t)=>{let n=e.left?k(e.left):null,r=e.right?k(e.right):null,i=n!==null&&n.key===r?.key;return(0,y.jsxs)(b.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex`,children:[(0,y.jsxs)(`div`,{className:`group/line relative flex w-1/2 min-w-0 border-r border-border/40`,onPointerEnter:_&&n?()=>C(n.target):void 0,children:[(0,y.jsx)(KM,{line:e.left,side:`left`,onAnnotate:n?()=>o(n.key):void 0,onDragStart:n?()=>S(n.target):void 0}),n&&w.has(sM(n.target))?(0,y.jsx)(PM,{}):null]}),(0,y.jsxs)(`div`,{className:`group/line relative flex w-1/2 min-w-0`,onPointerEnter:_&&r?()=>C(r.target):void 0,children:[(0,y.jsx)(KM,{line:e.right,side:`right`,onAnnotate:r?()=>o(r.key):void 0,onDragStart:r?()=>S(r.target):void 0}),r&&w.has(sM(r.target))?(0,y.jsx)(PM,{}):null]})]}),A(n),i?null:A(r)]},t)})]},e.header+String(e.lines[0]?.newLine??e.lines[0]?.oldLine??``))),O>0?(0,y.jsx)(`div`,{className:`px-4 py-2`,children:(0,y.jsxs)(Qx,{variant:`outline`,size:`xs`,onClick:()=>d(!0),children:[`Show `,O.toLocaleString(),` more lines`]})}):null]})},YM=({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)(_d,{className:`size-4`,"aria-hidden":`true`}):null,e]}),XM=({open:e,cwd:t,onClose:n,onSendToTerminal:r})=>{let[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(null),[g,_]=(0,b.useState)(()=>jM()),[v,x]=(0,b.useState)(0),[S,C]=(0,b.useState)({}),[w,T]=(0,b.useState)(null),[E,D]=(0,b.useState)(null),O=(0,b.useRef)(null),k=(0,b.useRef)(null),A=(0,b.useRef)(null);(0,b.useEffect)(()=>{if(e){a(!0);let e=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(e)}if(s(!1),i){let e=window.setTimeout(()=>a(!1),150);return()=>window.clearTimeout(e)}},[e]),(0,b.useEffect)(()=>{if(!e||!t)return;let n=new AbortController;return d(!0),p(!1),hM(t,n.signal).then(e=>{if(!n.signal.aborted){if(d(!1),!e){p(!0);return}l(e)}}),()=>n.abort()},[e,t,v]);let j=c?.files??[];(0,b.useEffect)(()=>{c&&(m&&c.files.some(e=>e.path===m)||h(c.files[0]?.path??null))},[c,m]);let M=j.find(e=>e.path===m)??null,N=M?j.indexOf(M):-1,P=(0,b.useMemo)(()=>{let e=0,t=0,n=0;for(let r of j)e+=r.additions,t+=r.deletions,r.binary&&(n+=1);return{additions:e,deletions:t,binaries:n}},[j]),F=(0,b.useCallback)(e=>{if(j.length===0)return;let t=Math.min(j.length-1,Math.max(0,(N===-1?0:N)+e));h(j[t].path),(A.current?.children[t])?.scrollIntoView({block:`nearest`})},[j,N]);(0,b.useEffect)(()=>{if(!e||!i)return;let t=e=>{let t=e.target,r=t instanceof HTMLElement&&t.tagName===`TEXTAREA`;if(e.key===`Escape`){if(r)return;if(e.preventDefault(),e.stopPropagation(),O.current){O.current();return}n();return}r||t instanceof HTMLElement&&t.tagName===`INPUT`||(e.key===`ArrowDown`||e.key===`j`?(e.preventDefault(),F(1)):(e.key===`ArrowUp`||e.key===`k`)&&(e.preventDefault(),F(-1)))};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[e,i,n,F]),(0,b.useEffect)(()=>{e&&o&&k.current?.focus()},[e,o]);let I=(0,b.useCallback)(e=>{_(e),MM(e)},[]),L=(0,b.useCallback)((e,t)=>{T(e),D(t??null)},[]),R=(0,b.useCallback)(()=>{T(null),D(null)},[]),z=(0,b.useCallback)(e=>{C(t=>({...t,[gM(e)]:e})),T(null),D(null)},[]),ee=(0,b.useCallback)(e=>{C(t=>{let{[e]:n,...r}=t;return r}),T(t=>t===e?null:t),D(t=>t&&gM({filePath:t.filePath,...t.end})===e?null:t)},[]),B=(0,b.useMemo)(()=>Object.values(S),[S]),te=(0,b.useMemo)(()=>{let e=new Map;for(let t of B)e.set(t.filePath,(e.get(t.filePath)??0)+1);return e},[B]),V=(0,b.useCallback)(()=>{C({}),T(null),D(null)},[]),H=(0,b.useCallback)(()=>{!r||B.length===0||(r(bM(B)),C({}),T(null),D(null),n())},[r,B,n]);if(!i)return null;let ne=e&&o,U=c?.isRepo??!0,re=c!==null&&U&&j.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":ne||void 0,"data-closed":!ne||void 0,className:ap(Gx),onClick:n}),(0,y.jsxs)(`div`,{ref:k,role:`dialog`,"aria-label":`git diff viewer`,"aria-modal":!0,tabIndex:-1,"data-open":ne||void 0,"data-closed":!ne||void 0,className:ap(`relative z-10 flex h-full w-full max-w-7xl flex-col overflow-hidden rounded-xl outline-none`,Ux,Kx),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:IM,children:[`+`,P.additions.toLocaleString()]}),` `,(0,y.jsxs)(`span`,{className:LM,children:[`−`,P.deletions.toLocaleString()]}),P.binaries>0?(0,y.jsxs)(`span`,{className:`text-muted-foreground/70`,children:[` · `,P.binaries,` binary`]}):null]}),u?(0,y.jsx)(zS,{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":g===e,onClick:()=>I(e),className:ap(`rounded-sm px-2 py-0.5 text-xs capitalize transition-colors`,g===e?`bg-foreground/10 text-foreground`:`text-muted-foreground hover:text-foreground`),children:e},e))}),(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-sm`,onClick:()=>x(e=>e+1),"aria-label":`refresh diff`,className:`hover:text-foreground`,children:(0,y.jsx)(Ed,{})}),(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":`close diff viewer`,className:`hover:text-foreground`,children:(0,y.jsx)(jd,{})})]})]}),f?(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)(Qx,{variant:`outline`,size:`xs`,onClick:()=>x(e=>e+1),children:`Retry`})]}):U?re?(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Working tree clean — nothing to diff.`}):c===null?(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,y.jsx)(zS,{"aria-label":`loading diff`})}):(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,y.jsx)(`div`,{ref:A,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:j.map(e=>{let t=FM[e.status],{directory:n,basename:r}=zM(e.path),i=e.path===m,a=te.get(e.path)??0;return(0,y.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i,onClick:()=>h(e.path),className:ap(`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:ap(`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})]})}),a>0?(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 font-mono text-[10px] tabular-nums text-muted-foreground`,title:`${a} pending comment${a===1?``:`s`}`,children:[(0,y.jsx)(bd,{className:`size-2.5`,"aria-hidden":`true`}),a]}):null,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:IM,children:[`+`,e.additions]}),` `,(0,y.jsxs)(`span`,{className:LM,children:[`−`,e.deletions]})]})]},e.path)})}),(0,y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:M?(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:[M.oldPath?(0,y.jsxs)(`span`,{className:`truncate`,children:[M.oldPath,(0,y.jsx)(`span`,{className:`text-muted-foreground/50`,children:` → `}),(0,y.jsx)(`span`,{className:`text-foreground`,children:M.path})]}):(0,y.jsx)(`span`,{className:`truncate text-foreground`,children:M.path}),M.binary?null:(0,y.jsxs)(`span`,{className:`ml-auto shrink-0 tabular-nums`,children:[(0,y.jsxs)(`span`,{className:IM,children:[`+`,M.additions]}),` `,(0,y.jsxs)(`span`,{className:LM,children:[`−`,M.deletions]})]})]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto overscroll-contain`,children:(0,y.jsx)(JM,{file:M,viewMode:g,annotations:S,editingKey:w,pendingRange:E,dragCancelRef:O,onOpenEditor:L,onSaveAnnotation:z,onCancelEditor:R,onDeleteAnnotation:ee})})]}):(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.`}),B.length>0?(0,y.jsxs)(`footer`,{className:`flex shrink-0 items-center gap-2 border-t border-border/40 px-4 py-2`,children:[(0,y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[B.length,` pending comment`,B.length===1?``:`s`]}),(0,y.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,y.jsx)(Qx,{variant:`ghost`,size:`xs`,onClick:V,children:`Clear all`}),r?(0,y.jsxs)(Qx,{size:`xs`,onClick:H,children:[(0,y.jsx)(Od,{"aria-hidden":`true`}),`Send to terminal`]}):null]})]}):null]})]})},ZM=Xx(`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 QM({className:e,orientation:t,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:ap(ZM({orientation:t}),e),...n})}function $M({className:e,render:t,...n}){return cS({defaultTagName:`div`,props:f_({className:ap(`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 eN=e=>String(e),tN=`size-7 rounded-none border-0 bg-transparent text-foreground hover:bg-foreground/10 hover:text-foreground disabled:opacity-30 [&_svg]:size-3.5`,nN=`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`,rN={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1},iN=({value:e,min:t,max:n,step:r,ariaLabel:i,decrementAriaLabel:a,incrementAriaLabel:o,formatDisplay:s=eN,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)(QM,{"aria-label":i,className:`h-7 overflow-hidden rounded-md border border-border/60`,children:[(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e-r),disabled:e<=t,"aria-label":a,className:tN,children:(0,y.jsx)(xd,{})}),(0,y.jsx)($M,{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:nN,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=rN[i.key];a!==void 0&&(i.preventDefault(),c(e+a*r))},children:s(e)}),(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e+r),disabled:e>=n,"aria-label":o,className:tN,children:(0,y.jsx)(Td,{})})]})},aN=b.createContext(null),oN=b.createContext(null);function sN(){let e=b.useContext(aN);if(e===null)throw Error(r_(60));return e}function cN(){let e=b.useContext(oN);if(e===null)throw Error(r_(61));return e}var lN=(e,t)=>Object.is(e,t);function uN(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function dN(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:uN(t,e,n))}function fN(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:uN(e,t,n))}function pN(e,t,n){return e.filter(e=>!uN(t,e,n))}function mN(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function hN(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function gN(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(hN(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 _N(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 mN(e)}function vN(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?mN(e.value):mN(e)}function yN(e,t,n){function r(){return _N(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=hN(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 bN(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,y.jsx)(b.Fragment,{children:yN(r,t,n)},i)),e),[])}var xN={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:vN(t,r)!==``}),hasNullItemLabel:Q((e,t)=>t?gN(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=>uN(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:uN(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 SN(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function CN(e,t){return Math.max(0,e-t)}function wN(e,t){if(t<=0)return 0;let n=SN(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 TN(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=lN,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=yS(),{setDirty:O,setTouched:k,setFocused:A,shouldValidateOnChange:j,validityData:M,setFilled:N,name:P,disabled:F,validation:I,validationMode:L}=_S(),R=TS({id:t}),z=F||d,ee=P??c,[B,te]=ES({controlled:n,default:x?r??am:r,name:`Select`,state:`value`}),[V,H]=ES({controlled:a,default:o,name:`Select`,state:`open`}),ne=b.useRef([]),U=b.useRef([]),re=b.useRef(null),W=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}=qy(V),{openMethod:he,triggerProps:ge}=Gb(V),_e=Jp(()=>new Uy({id:R,labelId:void 0,modal:m,multiple:x,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:B,open:V,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=zy(_e,xN.activeIndex),ye=zy(_e,xN.selectedIndex),be=zy(_e,xN.triggerElement),xe=zy(_e,xN.positionerElement),Se=HA(he),Ce=he??Se,we=b.useMemo(()=>x&&Array.isArray(B)&&B.length===0?``:vN(B,C),[x,B,C]),Te=b.useMemo(()=>x&&Array.isArray(B)?B.map(e=>vN(e,C)):vN(B,C),[x,B,C]);DS(Xm(_e.state.triggerElement),{id:R,value:B,getValue:Z(()=>Te)});let Ee=b.useRef(B);X(()=>{B!==Ee.current&&_e.set(`forceMount`,!0)},[_e,B]),X(()=>{N(x?Array.isArray(B)&&B.length>0:B!=null)},[x,B,N]),X(function(){if(V)return;let e=oe.current;if(x){let t=Array.isArray(B)?B:[];if(t.length===0){_e.set(`selectedIndex`,null);return}let n=t[t.length-1],r=fN(e,n,w);_e.set(`selectedIndex`,r===-1?null:r);return}let t=fN(e,B,w);_e.set(`selectedIndex`,t===-1?null:t)},[x,V,B,oe,w,_e]),Wb(B,()=>{D(ee),O(B!==M.initialValue),j()?I.commit(B):I.commit(B,!0)});let De=Z((e,t)=>{if(s?.(e,t),!t.isCanceled&&(H(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(B)),!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)});$y({enabled:!h,open:V,ref:re,onComplete(){V||Oe()}}),b.useImperativeHandle(h,()=>({unmount:Oe}),[Oe]);let ke=Z((e,t)=>{i?.(e,t),!t.isCanceled&&te(e)}),Ae=Z(()=>{let e=_e.state.listElement||re.current;if(!e)return;let t=CN(e.scrollHeight,e.clientHeight),n=wN(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=lb({open:V,onOpenChange:De,elements:{reference:be,floating:xe}}),{getReferenceProps:Me,getFloatingProps:Ne,getItemProps:Pe}=Sb([cv(je,{enabled:!f&&!z,event:`mousedown`}),hv(je,{bubbles:!1}),jb(je,{enabled:!f&&!z,listRef:ne,activeIndex:ve,selectedIndex:ye,disabledIndices:am,onNavigate(e){e===null&&!V||_e.set(`activeIndex`,e)},focusItemOnHover:T}),Pb(je,{enabled:!f&&!z&&(V||!x),listRef:U,activeIndex:ve,selectedIndex:ye,onMatch(e){V?_e.set(`activeIndex`,e):ke(oe.current[e],zm(`none`))},onTypingChange(e){se.current=e}})]),Fe=b.useMemo(()=>f_(Me(),ge,R?{id:R}:om),[Me,ge,R]);op(()=>{_e.update({popupProps:Ne(),triggerProps:Fe})}),X(()=>{_e.update({id:R,modal:m,multiple:x,value:B,open:V,mounted:fe,transitionStatus:me,popupProps:Ne(),triggerProps:Fe,items:v,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ce})},[_e,R,m,x,B,V,fe,me,Ne,Fe,v,S,C,w,Ce]);let Ie=b.useMemo(()=>({store:_e,name:ee,required:p,disabled:z,readOnly:f,multiple:x,highlightItemOnHover:T,setValue:ke,setOpen:De,listRef:ne,popupRef:re,scrollHandlerRef:W,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,ee,p,z,f,x,T,ke,De,Pe,je.context.events,I,_,Ae]),Le=Wm(g,I.inputRef),Re=x&&Array.isArray(B)&&B.length>0,ze=x?void 0:ee,Be=b.useMemo(()=>!x||!Array.isArray(B)||!ee?null:B.map(e=>{let t=vN(e,C);return(0,y.jsx)(`input`,{type:`hidden`,form:l,name:ee,value:t},t)}),[x,B,l,ee,C]);return(0,y.jsx)(aN.Provider,{value:Ie,children:(0,y.jsxs)(oN.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=zm(Em,e.nativeEvent);function r(){if(x)return;let e=oe.current.find(e=>vN(e,C).toLowerCase()===t.toLowerCase()||_N(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:ee?ih:rh,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Be]})})}function EN(e,t){return e??t}function DN(e){let t=e.getBoundingClientRect(),n=lp(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 ON=2,kN=400,AN=200,jN={...cx,...hS,value:()=>null},MN=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}=_S(),{labelId:m}=xS(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=sN(),T=p||C||a,E=zy(h,xN.open),D=zy(h,xN.value),O=zy(h,xN.triggerProps),k=zy(h,xN.positionerElement),A=zy(h,xN.listElement),j=zy(h,xN.id),M=zy(h,xN.labelId),N=zy(h,xN.hasSelectedValue),P=!N&&E,F=zy(h,xN.hasNullItemLabel,P),I=i??j,L=EN(m,M);TS({id:I});let R=Xm(k),z=b.useRef(null),{getButtonProps:ee,buttonRef:B}=hx({disabled:T,native:o}),te=Wm(t,z,B,Z(e=>{h.set(`triggerElement`,e)})),V=$p(),H=$p(),ne=$p(),U=$p();b.useEffect(()=>{if(E)return N||F?U.start(AN,()=>{_.current.allowUnselectedMouseUp=!0,ne.start(AN,()=>{_.current.allowSelectedMouseUp=!0})}):ne.start(kN,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{ne.clear(),U.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},H.clear()},[E,N,F,_,H,ne,U]);let re=b.useMemo(()=>A?.id??Sh(k)?.id,[A,k]),W=f_(O,{id:I,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?re:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:te,onFocus(e){u(!0),E&&S.current&&g(!1,zm(Em,e.nativeEvent)),V.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){ph(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=Kp(e.currentTarget);function n(e){if(!z.current)return;let t=e.target;if(ph(z.current,t)||ph(R.current,t)||t===z.current)return;let n=DN(z.current);e.clientX>=n.left-ON&&e.clientX<=n.right+ON&&e.clientY>=n.top-ON&&e.clientY<=n.bottom+ON||g(!1,zm(Fm,e))}H.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,ee);W.role=`combobox`;let ie={...f,open:E,disabled:T,value:D,readOnly:y,placeholder:!N};return E_(`button`,e,{ref:[t,z],state:ie,stateAttributesMapping:jN,props:W})}),NN={value:()=>null},PN=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=sN(),u=zy(c,xN.value),d=zy(c,xN.items),f=zy(c,xN.itemToStringLabel),p=zy(c,xN.hasSelectedValue),m=!p&&a!=null&&i==null,h=zy(c,xN.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?bN(u,d,f):yN(u,d,f)),E_(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:NN})}),FN=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o}=sN();return E_(`span`,e,{state:{open:zy(o,xN.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:sx})}),IN=b.createContext(void 0),LN=b.forwardRef(function(e,t){let{store:n}=sN(),r=zy(n,xN.mounted),i=zy(n,xN.forceMount);return r||i?(0,y.jsx)(IN.Provider,{value:!0,children:(0,y.jsx)(H_,{ref:t,...e})}):null}),RN=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function zN(){return b.useContext(RN)}function BN(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),o=b.useRef(0),s=Jp(HN).current,c=Jp(VN).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(UN).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)(RN.Provider,{value:g,children:t})}function VN(){return new Map}function HN(){return new Set}function UN(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 WN=b.createContext(void 0);function GN(){let e=b.useContext(WN);if(!e)throw Error(r_(59));return e}function KN(e,t){e&&Object.assign(e.style,t)}var qN={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},JN={position:`fixed`},YN=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=P_,style:_,...v}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=sN(),A=cN(),j=zy(x,xN.open),M=zy(x,xN.mounted),N=zy(x,xN.modal),P=zy(x,xN.value),F=zy(x,xN.openMethod),I=zy(x,xN.positionerElement),L=zy(x,xN.triggerElement),R=zy(x,xN.isItemEqualToValue),z=zy(x,xN.transitionStatus),ee=b.useRef(null),B=b.useRef(null),[te,V]=b.useState(h),H=M&&te&&F!==`touch`;!M&&te!==h&&V(h),X(()=>{M||(xN.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),xN.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),b.useImperativeHandle(w,()=>H),NA((H||N)&&j,F===`touch`,I,L);let ne=OA({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??H,collisionAvoidance:g,keepMounted:!0}),U=H?`none`:ne.side,re=H?JN:ne.positionerStyles,W=jA(e,{open:j,side:U,align:ne.align,anchorHidden:ne.anchorHidden},{styles:re,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=zm(Em);if(t!==0&&!x.state.multiple&&P!==null&&fN(E.current,P,R)===-1){let e=D.current,t=e!=null&&fN(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=>fN(E.current,e,R)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!dN(P,e,R)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&H){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};KN(I,e),KN(O.current,e)}}),oe=b.useMemo(()=>({...ne,side:U,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:ee,scrollDownArrowRef:B}),[ne,U,H,V]);return(0,y.jsx)(BN,{elementsRef:S,labelsRef:C,onMapChange:ae,children:(0,y.jsxs)(WN.Provider,{value:oe,children:[M&&N&&(0,y.jsx)(Ix,{inert:Fx(!j),cutout:L}),W]})})}),XN=`base-ui-disable-scrollbar`,ZN={className:XN,getElement(e){return(0,y.jsx)(`style`,{nonce:e,href:XN,precedence:`base-ui:low`,children:`.${XN}{scrollbar-width:none}.${XN}::-webkit-scrollbar{display:none}`})}},QN=b.createContext(void 0),$N={disableStyleElements:!1};function eP(){return b.useContext(QN)??$N}var tP={...lx,...Zy},nP=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}=sN(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=GN(),O=IA(!0)!=null,k=cN(),A=bA(),{nonce:j,disableStyleElements:M}=eP(),N=zy(s,xN.id),P=zy(s,xN.open),F=zy(s,xN.mounted),I=zy(s,xN.popupProps),L=zy(s,xN.transitionStatus),R=zy(s,xN.triggerElement),z=zy(s,xN.positionerElement),ee=zy(s,xN.listElement),B=b.useRef(!1),te=b.useRef(!1),V=b.useRef({}),H=rm(),ne=Z(e=>{if(!z||!c.current||!te.current)return;if(B.current||!C){h();return}let t=z.style.top===`0px`,n=z.style.bottom===`0px`;if(!t&&!n){h();return}let r=aP(z),i=oP(z.getBoundingClientRect().height,`y`,r),a=Kp(z),o=getComputedStyle(z),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=rP(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=iP(e),m=0,g=null,_=!1,v=!1,y=e=>{z.style.height=`${e}px`},b=(t,n)=>{let r=SN(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(B.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=iP(e),n=v?t:SN(g,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(B.current=!0),h()});b.useImperativeHandle(g,()=>ne,[ne]),$y({open:P,ref:c,onComplete(){P&&l?.(!0)}});let U={open:P,transitionStatus:L,side:x,align:S};X(()=>{!z||!c.current||Object.keys(V.current).length||(V.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||(te.current=!1,B.current=!1,KN(z,V.current))},[P,C,z,c]),X(()=>{let e=c.current;if(!P||!R||!z||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){te.current=!0,H.request(h),e.style.removeProperty(`--transform-origin`);return}let t=lP(e);e.style.removeProperty(`--transform-origin`);try{let t=f.current,n=d.current,r=getComputedStyle(z),i=getComputedStyle(e),a=Kp(R),o=lp(z),c=aP(R),l=sP(R.getBoundingClientRect(),c),u=sP(z.getBoundingClientRect(),c),p=l.height,m=ee||e,g=m.scrollHeight,y=parseFloat(i.borderBottomWidth),b=parseFloat(r.marginTop)||10,x=parseFloat(r.marginBottom)||10,S=parseFloat(r.minHeight)||100,C=rP(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=sP(n.getBoundingClientRect(),c);O=sP(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=`${SN(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=iP(m),H=F>=L-1;H&&(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&&Lp;if(ne||U){te.current=!0,KN(z,V.current),T(!1);return}let re=Math.max(S,N);if(H){let e=Math.max(0,w-M);z.style.top=u.height>=P?`0`:`${e}px`,z.style.height=`${N}px`,m.scrollTop=iP(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=SN(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(re===w||N>=C)&&(B.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),te.current=!0}finally{t()}},[s,P,z,R,d,f,c,h,C,T,H,E,D,ee,_,v,A,w]),b.useEffect(()=>{if(!C||!z||!P)return;let e=lp(z);function t(e){u(!1,zm(Rm,e))}return Mp(e,`resize`,t)},[u,C,z,P]);let re={...ee?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(e){p.current=!0,O&&Mx.has(e.key)&&e.stopPropagation()},onMouseMove(){p.current=!1},onScroll(e){ee||ne(e.currentTarget)},...C&&{style:ee?{height:`100%`}:qN}},W=E_(`div`,e,{ref:[t,c],state:U,stateAttributesMapping:tP,props:[I,re,AA(L),{className:!ee&&C?ZN.className:void 0},o]});return(0,y.jsxs)(b.Fragment,{children:[!M&&ZN.getElement(j),(0,y.jsx)(sv,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:W})]})});function rP(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function iP(e){return CN(e.scrollHeight,e.clientHeight)}function aP(e){return ny.getScale(e)}function oP(e,t,n){return e/n[t]}function sP(e,t){return Xh({x:oP(e.x,`x`,t),y:oP(e.y,`y`,t),width:oP(e.width,`x`,t),height:oP(e.height,`y`,t)})}var cP=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function lP(e){let{style:t}=e,n={};for(let[e,r]of cP)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of cP){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var uP=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=sN(),{alignItemWithTriggerActive:c}=GN(),l=zy(o,xN.hasScrollArrows),u=zy(o,xN.openMethod),d=zy(o,xN.multiple),f={id:`${zy(o,xN.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:qN},className:l&&u!==`touch`?ZN.className:void 0};return E_(`div`,e,{ref:[t,Z(e=>{o.set(`listElement`,e)})],props:[f,a]})}),dP=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function fP(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}=zN(),f=b.useRef(-1),[p,m]=b.useState(a??(i===dP.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 pP=b.createContext(void 0);function mP(){let e=b.useContext(pP);if(!e)throw Error(r_(57));return e}var hP=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=fP({label:a,textRef:u,indexGuessBehavior:dP.GuessFromOrder}),{store:f,getItemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:x,selectedItemTextRef:S}=sN(),C=zy(f,xN.isActive,d.index),w=zy(f,xN.isSelected,d.index,i),T=zy(f,xN.isSelectedByFocus,d.index),E=zy(f,xN.isItemEqualToValue),D=d.index,O=D!==-1,k=b.useRef(null),A=Xm(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&&uN(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}=hx({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?pN(n,i,E):[...n,i],zm(jm,e))}else h(i,zm(jm,e)),m(!1,zm(jm,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()}},ee=E_(`div`,e,{ref:[L,t,d.ref,k],state:j,props:[M,z,l,I]}),B=b.useMemo(()=>({selected:w,indexRef:A,textRef:u,selectedByFocus:T,hasRegistered:O}),[w,A,u,T,O]);return(0,y.jsx)(pP.Provider,{value:B,children:ee})})),gP=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=mP();return n||r?(0,y.jsx)(_P,{...e,ref:t}):null}),_P=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=mP(),c=b.useRef(null),{transitionStatus:l,setMounted:u}=qy(s),d=E_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:Zy});return $y({open:s,ref:c,onComplete(){s||u(!1)}}),d})),vP=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=mP(),{selectedItemTextRef:o}=sN(),{className:s,render:c,style:l,...u}=e;return E_(`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})})),yP=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}=sN(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=GN(),_=zy(l,c?xN.scrollUpArrowVisible:xN.scrollDownArrowVisible),v=zy(l,xN.openMethod),y=_&&v!==`touch`,b=$p(),x=c?g:h,{transitionStatus:S,setMounted:C}=qy(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]),$y({open:y,ref:x,onComplete(){y||C(!1)}});let w=E_(`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=CN(e.scrollHeight,e.clientHeight),r=wN(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=bP(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 bP(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?wN(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?wN(l.offsetTop+l.offsetHeight-r+i,a):a}var xP=b.forwardRef(function(e,t){return(0,y.jsx)(yP,{...e,ref:t,direction:`down`})}),SP=b.forwardRef(function(e,t){return(0,y.jsx)(yP,{...e,ref:t,direction:`up`})}),CP=TN;function wP({className:e,...t}){return(0,y.jsx)(PN,{"data-slot":`select-value`,className:ap(`flex flex-1 text-left`,e),...t})}function TP({className:e,size:t=`default`,children:n,...r}){return(0,y.jsxs)(MN,{"data-slot":`select-trigger`,"data-size":t,className:ap(`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)(FN,{render:(0,y.jsx)(pd,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function EP({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)(LN,{children:(0,y.jsx)(YN,{side:r,sideOffset:i,align:a,alignOffset:o,alignItemWithTrigger:s,className:`isolate z-50`,children:(0,y.jsxs)(nP,{"data-slot":`select-content`,"data-align-trigger":s,className:ap(`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)(OP,{}),(0,y.jsx)(uP,{children:t}),(0,y.jsx)(kP,{}),n]})})})}function DP({className:e,children:t,...n}){return(0,y.jsxs)(hP,{"data-slot":`select-item`,className:ap(`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)(vP,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(gP,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(fd,{className:`pointer-events-none`})})]})}function OP({className:e,...t}){return(0,y.jsx)(SP,{"data-slot":`select-scroll-up-button`,className:ap(`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)(md,{})})}function kP({className:e,...t}){return(0,y.jsx)(xP,{"data-slot":`select-scroll-down-button`,className:ap(`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)(pd,{})})}var AP=`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`,jP=`max-h-72 w-(--anchor-width) origin-(--transform-origin) gap-0 overflow-x-hidden p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,MP=`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`,NP=({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)(CP,{value:e,onValueChange:i,open:a,onOpenChange:o,children:[(0,y.jsx)(TP,{size:`sm`,"aria-label":n,className:ap(AP,`w-full`,c),style:f,children:(0,y.jsx)(wP,{placeholder:r,children:()=>d?.label||r})}),(0,y.jsx)(EP,{alignItemWithTrigger:!1,sideOffset:4,className:ap(jP,zx,Bx),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)(DP,{value:e.id,className:MP,style:e.itemStyle,onPointerEnter:s?()=>s(e.id):void 0,onFocus:s?()=>s(e.id):void 0,children:e.label},e.id))})]})};function PP(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=ES({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=qy(o,!0,!0),[d,f]=b.useState(o),[{height:p,width:m},h]=b.useState({height:void 0,width:void 0}),g=vx(),[_,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=Qy(O,!1),A=Z(e=>{let t=!o,n=zm(Dm,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 FP=b.createContext(void 0);function IP(){let e=b.useContext(FP);if(e===void 0)throw Error(r_(15));return e}var LP=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Jy.startingStyle]=`startingStyle`,e[e.endingStyle=Jy.endingStyle]=`endingStyle`,e}({}),RP=function(e){return e.panelOpen=`data-panel-open`,e}({}),zP={[LP.open]:``},BP={[LP.closed]:``},VP={open(e){return e?{[RP.panelOpen]:``}:null}},HP={open(e){return e?zP:BP},...Zy},UP=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=PP({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=E_(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:HP});return(0,y.jsx)(FP.Provider,{value:p,children:m})}),WP={...VP,...Zy},GP=b.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=IP(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=hx({disabled:c,focusableWhenDisabled:!0,native:d}),g=b.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return E_(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:WP})}),KP=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function qP(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=rm(),E=b.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=Wm(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(KP.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=nm.request(()=>{w.current=!1,r=nm.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{nm.cancel(t),nm.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(LP.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=nm.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=LP.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()=>{nm.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]),Xp(()=>{let e=nm.request(()=>{C.current=!1});return()=>nm.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=nm.request(()=>{x.current=!1,n=nm.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{nm.cancel(t),nm.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(LP.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,zm(Em,e))}return Mp(e,`beforematch`,t)},[l,d,h]),b.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var JP=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),YP=b.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{abortControllerRef:l,animationTypeRef:u,height:d,mounted:f,onOpenChange:p,open:m,panelId:h,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setHiddenUntilFound:y,setKeepMounted:x,setMounted:S,setPanelIdState:C,setOpen:w,setVisible:T,state:E,transitionDimensionRef:D,visible:O,width:k,transitionStatus:A}=IP(),j=r??!1,M=i??!1;X(()=>{if(o)return C(o),()=>{C(void 0)}},[o,C]),X(()=>{y(j)},[y,j]),X(()=>{x(M)},[x,M]);let{props:N}=qP({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});$y({open:m&&A===`idle`,ref:g,onComplete(){m&&v({height:void 0,width:void 0})}});let P=E_(`div`,e,{state:b.useMemo(()=>({...E,transitionStatus:A}),[E,A]),ref:[t,g],props:[N,{style:{[JP.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[JP.collapsiblePanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:HP});return M||j||f?P:null});function XP({...e}){return(0,y.jsx)(UP,{"data-slot":`collapsible`,...e})}function ZP({...e}){return(0,y.jsx)(GP,{"data-slot":`collapsible-trigger`,...e})}function QP({...e}){return(0,y.jsx)(YP,{"data-slot":`collapsible-content`,...e})}function $P({className:e,...t}){return(0,y.jsx)(`label`,{"data-slot":`label`,className:ap(`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 eF({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`field-group`,className:ap(`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 tF=Xx(`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 nF({className:e,orientation:t=`vertical`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:ap(tF({orientation:t}),e),...n})}function rF({className:e,...t}){return(0,y.jsx)($P,{"data-slot":`field-label`,className:ap(`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 iF=b.createContext(void 0);function aF(e){let t=b.useContext(iF);if(t===void 0&&!e)throw Error(r_(72));return t}var oF={...cb,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)},sF=class e extends Wy{constructor(e){super({...cF(),...e},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new ib},oF)}setOpen=(e,t)=>{let n=t.reason,r=n===Om,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?L_.flushSync(o):o()};static useStore(t,n){let r=Jp(()=>new e(n)).current,i=t??r,a=db({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=a,i}};function cF(){return{...ob(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var lF=Ny(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=sF.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});op(()=>{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,zm(Im))},[m,t,p]),p.useSyncedValue(`disabled`,t),nb(p);let{forceUnmount:v,transitionStatus:x}=rb(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,zm(Lm))},[p]);b.useImperativeHandle(o,()=>({unmount:v,close:D}),[v,D]);let{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=Sb([hv(S,{enabled:!t,referencePress:()=>p.select(`closeOnClick`)}),dv(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)(iF.Provider,{value:p,children:typeof f==`function`?f({payload:_}):f})}),uF=b.createContext(void 0);function dF(){return b.useContext(uF)}var fF=function(e){return e[e.popupOpen=tx.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),pF=Py(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=aF(!0),m=i?.store??p;if(!m)throw Error(r_(82));let h=vx(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}=tb(h,y,m,{payload:a,closeOnClick:c,closeDelay:S}),T=dF(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Hm(v,{open:_});m.useSyncedValue(`isInstantPhase`,D);let k=m.useState(`disabled`),A=o??k,j=m.useState(`trackCursorAxis`),M=m.useState(`disableHoverablePopup`),N=xb(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!M&&j!==`both`?Hb():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=pb(v,{enabled:!A}).reference,F={open:_},I=m.useState(`triggerProps`,w);return E_(`button`,e,{state:F,ref:[t,C,y],props:[N,P,I,{onPointerDown(){m.set(`closeOnClick`,c)},id:h,[fF.triggerDisabled]:A?``:void 0},f],stateAttributesMapping:sx})}),mF=b.createContext(void 0);function hF(){let e=b.useContext(mF);if(e===void 0)throw Error(r_(70));return e}var gF=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=V_({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,y.jsxs)(b.Fragment,{children:[l,c&&L_.createPortal(n,c)]})}),_F=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return aF().useState(`mounted`)||n?(0,y.jsx)(mF.Provider,{value:n,children:(0,y.jsx)(gF,{ref:t,...r})}):null}),vF=b.createContext(void 0);function yF(){let e=b.useContext(vF);if(e===void 0)throw Error(r_(71));return e}var bF=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=F_,style:g,..._}=e,v=aF(),x=hF(),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=OA({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`)?TA:void 0}),A=jA(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)(vF.Provider,{value:k,children:A})}),xF={...lx,...Zy},SF=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=aF(),{side:s,align:c}=yF(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);$y({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=o.useState(`disabled`),h=o.useState(`closeDelay`);return yb(p,{enabled:!m,closeDelay:h}),E_(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,AA(d),a],stateAttributesMapping:xF})}),CF=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=aF(),s=o.useState(`open`),c=o.useState(`instantType`),{arrowRef:l,side:u,align:d,arrowUncentered:f,arrowStyles:p}=yF();return E_(`div`,e,{state:{open:s,side:u,align:d,uncentered:f,instant:c},ref:[t,l],props:[{style:p,"aria-hidden":!0},a],stateAttributesMapping:lx})}),wF=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)(uF.Provider,{value:i,children:(0,y.jsx)(Vm,{delay:a,timeoutMs:r,children:e.children})})};function TF({delay:e=0,...t}){return(0,y.jsx)(wF,{"data-slot":`tooltip-provider`,delay:e,...t})}function EF({...e}){return(0,y.jsx)(lF,{"data-slot":`tooltip`,...e})}function DF({...e}){return(0,y.jsx)(pF,{"data-slot":`tooltip-trigger`,...e})}function OF({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,y.jsx)(_F,{children:(0,y.jsx)(bF,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,y.jsxs)(SF,{"data-slot":`tooltip-content`,className:ap(`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)(CF,{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 kF=[{id:`block`,name:`Block`},{id:`bar`,name:`Bar`},{id:`underline`,name:`Underline`}],AF=`block`,jF=kF.map(e=>e.id),MF=e=>typeof e==`string`&&jF.includes(e),NF=e=>e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`),PF=`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,FF=`"Symbols Nerd Font"`,IF=(e,t)=>`"${NF(e)}"${t?`, ${FF}`:``}, ${PF}`,LF=(e,t,n)=>({id:e,name:t,family:IF(t,!0),source:n}),RF=LF(`geist-mono`,`Geist Mono`,`fontsource`),zF=LF(`jetbrains-mono`,`JetBrains Mono`,`google`),BF=LF(`fira-code`,`Fira Code`,`google`),VF=LF(`ibm-plex-mono`,`IBM Plex Mono`,`google`),HF=LF(`source-code-pro`,`Source Code Pro`,`google`),UF=LF(`roboto-mono`,`Roboto Mono`,`google`),WF=LF(`dm-mono`,`DM Mono`,`google`),GF=LF(`inconsolata`,`Inconsolata`,`google`),KF=LF(`space-mono`,`Space Mono`,`google`),qF=LF(`ubuntu-mono`,`Ubuntu Mono`,`google`),JF=[RF,LF(`anonymous-pro`,`Anonymous Pro`,`google`),WF,BF,VF,GF,zF,UF,HF,KF,qF];RF.id;var YF=e=>e?JF.find(t=>t.id===e)??RF:RF,XF=(e,t)=>IF(e.name,t),ZF=()=>{let e=JF.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`},QF=[{value:1e3,label:`1k lines`},{value:1e4,label:`10k lines`},{value:5e4,label:`50k lines`},{value:1e5,label:`100k lines`}],$F=1e4,eI=QF.map(e=>e.value),tI=e=>eI.includes(e),nI={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`}},rI=[nI,{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`}}];nI.id;var iI=e=>e?rI.find(t=>t.id===e)??nI:nI,aI=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,oI=`text-xs font-normal text-muted-foreground`,sI=Object.fromEntries(JF.map(e=>[e.id,{fontFamily:e.family}])),cI=rI.map(e=>({id:e.id,label:e.name})),lI=JF.map(e=>({id:e.id,label:e.name,itemStyle:sI[e.id]})),uI=kF.map(e=>({id:e.id,label:e.name})),dI=QF.map(e=>({id:String(e.value),label:e.label})),fI=e=>e.toFixed(1),pI=({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:oI,children:e}),(0,y.jsx)(`dd`,{title:n??t,className:ap(`min-w-0 truncate text-right text-foreground/90`,r),children:t})]}),mI=({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)(UA,{open:M,onOpenChange:e=>{N(e),A?.(e),e||(F(!1),n?.(null),a?.(null),v?.(null),j?.())},children:[(0,y.jsx)(WA,{render:(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-sm`,"aria-label":`terminal settings`,className:`hover:text-foreground`}),children:(0,y.jsx)(kd,{})}),(0,y.jsx)(GA,{ref:I,side:`bottom`,align:`end`,sideOffset:8,className:ap(`w-64 gap-0 overflow-hidden p-3`,zx,Bx),children:(0,y.jsxs)(eF,{className:`gap-3`,children:[(0,y.jsxs)(nF,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(rF,{className:aI,children:`Theme`}),(0,y.jsx)(NP,{value:e,items:cI,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)(qA,{className:`bg-border/40`}),(0,y.jsxs)(nF,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(rF,{className:aI,children:`Font`}),(0,y.jsx)(NP,{value:r,items:lI,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:oI,children:`Size`}),(0,y.jsx)(iN,{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:oI,children:`Line height`}),(0,y.jsx)(iN,{value:u,min:1,max:2,step:rj,ariaLabel:`terminal line height`,decrementAriaLabel:`decrease line height`,incrementAriaLabel:`increase line height`,formatDisplay:fI,onValueChange:d})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(EF,{children:[(0,y.jsx)(DF,{render:(0,y.jsx)(`span`,{className:oI}),children:`Nerd Font icons`}),(0,y.jsx)(OF,{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)(ej,{"aria-label":`toggle nerd font icons`,checked:o,onCheckedChange:s})]})]}),(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsxs)(nF,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(rF,{className:aI,children:`Window`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:oI,children:`Pad X`}),(0,y.jsx)(iN,{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:oI,children:`Pad Y`}),(0,y.jsx)(iN,{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)(qA,{className:`bg-border/40`}),(0,y.jsxs)(nF,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(rF,{className:aI,children:`Notifications`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(EF,{children:[(0,y.jsx)(DF,{render:(0,y.jsx)(`span`,{className:oI}),children:`Desktop alerts`}),(0,y.jsx)(OF,{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)(ej,{"aria-label":`toggle desktop notifications`,checked:D===`granted`,disabled:D===`unsupported`||D===`denied`,onCheckedChange:e=>{e&&O()}})]})]}),(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsxs)(nF,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(rF,{className:aI,children:`Cursor`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:oI,children:`Style`}),(0,y.jsx)(NP,{value:g,items:uI,ariaLabel:`select cursor style`,placeholder:`Cursor style`,triggerClassName:`w-fit min-w-[7rem]`,onValueChange:e=>{MF(e)&&_(e)},onOpenChange:e=>{e||v?.(null)},onItemHover:v?e=>{MF(e)&&v?.(e)}:void 0})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:oI,children:`Blink`}),(0,y.jsx)(ej,{"aria-label":`toggle cursor blink`,checked:x,onCheckedChange:S})]})]}),(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsxs)(nF,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(rF,{className:aI,children:`Scrollback`}),(0,y.jsx)(NP,{value:String(C),items:dI,ariaLabel:`select scrollback`,placeholder:`Scrollback`,onValueChange:e=>{if(e===null)return;let t=Number(e);tI(t)&&w(t)}}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(EF,{children:[(0,y.jsx)(DF,{render:(0,y.jsx)(`span`,{className:oI}),children:`Pin to bottom on input`}),(0,y.jsx)(OF,{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)(ej,{"aria-label":`toggle pin to bottom on input`,checked:T,onCheckedChange:E})]})]}),k?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsxs)(XP,{defaultOpen:!1,children:[(0,y.jsx)(ZP,{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:aI,children:`Shell`}),(0,y.jsx)(pd,{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)(QP,{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)(pI,{label:`Name`,value:k.shellName}),(0,y.jsx)(pI,{label:`Path`,value:k.shell,title:k.shell}),(0,y.jsx)(pI,{label:`PID`,value:String(k.pid),valueClassName:`tabular-nums`}),(0,y.jsx)(pI,{label:`Cwd`,value:k.cwd,title:k.cwd})]})})]})]}):null]})})]})},hI=()=>{let[e,t]=(0,b.useState)(null);return{summary:e,setGitDiffSummary:t}},gI=2.4,_I=.04045,vI=12.92,yI=.055,bI=1.055,xI=.0031308,SI=24389/27,CI=216/24389,wI=.95047,TI=1,EI=1.08883,DI=.008856,OI=7.787,kI=e=>{let t=e/255;return t<=_I?t/vI:((t+yI)/bI)**+gI},AI=e=>e<=0?0:e>=1?255:Math.round(e<=xI?vI*e*255:(bI*e**(1/gI)-yI)*255),jI=e=>e>DI?Math.cbrt(e):OI*e+16/116,MI=e=>{let t=kI(e.r),n=kI(e.g),r=kI(e.b);return{x:.4124564*t+.3575761*n+.1804375*r,y:.2126729*t+.7151522*n+.072175*r,z:.0193339*t+.119192*n+.9503041*r}},NI=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:AI(t),g:AI(n),b:AI(r)}},PI=e=>{let t=e.x/wI,n=e.y/TI,r=e.z/EI,i=jI(t),a=jI(n),o=jI(r);return{l:116*a-16,a:500*(i-a),b:200*(a-o)}},FI=(e,t)=>{let n=e*e*e;return n>CI?t*n:t*((116*e-16)/SI)},II=e=>{let t=(e.l+16)/116,n=e.a/500+t,r=t-e.b/200;return{x:FI(n,wI),y:FI(t,TI),z:FI(r,EI)}},LI=e=>PI(MI(e)),RI=e=>NI(II(e)),zI=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)}},BI=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`)}`},VI=e=>LI(zI(e)),HI=e=>BI(RI(e)),UI=6,WI=5,GI=24,KI=25,qI=(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)}),JI=(e,t=!1)=>{let n=e.background??`#000000`,r=e.foreground??`#ffffff`,i=[VI(n),VI(e.red??`#ff0000`),VI(e.green??`#00ff00`),VI(e.yellow??`#ffff00`),VI(e.blue??`#0000ff`),VI(e.magenta??`#ff00ff`),VI(e.cyan??`#00ffff`),VI(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<UI;e++){let t=qI(e/WI,i[0],i[1]),n=qI(e/WI,i[2],i[3]),r=qI(e/WI,i[4],i[5]),o=qI(e/WI,i[6],i[7]);for(let e=0;e<UI;e++){let i=qI(e/WI,t,n),s=qI(e/WI,r,o);for(let e=0;e<UI;e++){let t=qI(e/WI,i,s);a.push(HI(t))}}}for(let e=0;e<GI;e++){let t=(e+1)/KI;a.push(HI(qI(t,i[0],i[7])))}return a},YI=`Symbols Nerd Font`,XI=``,ZI=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 "${YI}"`,XI),document.fonts.load(`bold 16px "${YI}"`,XI)];await Promise.all(t)}catch{}},QI=(e,t)=>`\x1b[${e};${t+1}u`,$I=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},eL=[[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]],tL=e=>{if(e<127995||e>129784)return!1;for(let[t,n]of eL)if(e>=t&&e<=n)return!0;return!1},nL=6,rL=4,iL=class{version=`15-graphemes-emoji`;base;constructor(e){this.base=e}wcwidth(e){return tL(e)?2:this.base.wcwidth(e)}charProperties(e,t){let n=this.base.charProperties(e,t);return tL(e)?n&~nL|rL:n}},aL=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),oL=(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},sL=(e,t)=>`\r\n\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,cL={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`}},lL=(e,t)=>{let n=t?`blink`:`steady`;return`\x1b[?25h${cL[e][n]}`},uL=(e,t)=>`${lL(e,t)}\r\n\x1b[2;32m[reconnected]\x1b[0m\r\n\r\n`,dL=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,fL=55296,pL=56319,mL=(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>=fL&&t<=pL&&--i}i===r&&(i=r+t),n.push(e.slice(r,i)),r=i}return n},hL=(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)},gL=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?.())}},_L=e=>e[0]===3,vL=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},yL=1/rj,bL=e=>Math.round(e*yL)/yL,xL=e=>{if(!Number.isFinite(e))return nj;let t=bL(e);return t<1?1:t>2?2:t},SL=1/1,CL=e=>Math.round(e*SL)/SL,wL=e=>{if(!Number.isFinite(e))return 0;let t=CL(e);return t<0?0:t>48?48:t},TL=e=>{if(!Number.isFinite(e))return 0;let t=CL(e);return t<0?0:t>48?48:t},EL=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},DL=e=>e<1e3?String(e):e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}k`:`${Math.round(e/1e3)}k`,OL=(e,t,n)=>e.key!==t&&e.key!==t.toUpperCase()?!1:n?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,kL=(e,t)=>OL(e,`j`,t),AL=(e,t)=>OL(e,`k`,t),jL=(e,t)=>OL(e,`g`,t),ML=(e,t)=>OL(e,`f`,t),NL=(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,PL=()=>{let e=new URL(window.location.href);if(e.searchParams.has(`run`)){e.searchParams.delete(`run`);try{window.history.replaceState(null,``,e)}catch{}}},FL=DM(Sj,!0),IL=FL.load,LL=FL.store,RL=OM(xj,AF,MF),zL=RL.load,BL=RL.store,VL=kM(vj,e=>YF(e).id,e=>e),HL=VL.load,UL=VL.store,WL=EM(yj,13,vL),GL=WL.load,KL=WL.store,qL=EM(bj,nj,xL),JL=qL.load,YL=qL.store,XL=EM(Cj,$F,e=>tI(e)?e:$F),ZL=XL.load,QL=XL.store,$L=DM(wj,!0),eR=$L.load,tR=$L.store,nR=kM(_j,e=>iI(e).id,e=>e),rR=nR.load,iR=nR.store,aR=EM(Tj,0,wL),oR=aR.load,sR=aR.store,cR=EM(Ej,0,TL),lR=cR.load,uR=cR.store,dR=DM(Oj,!1),fR=dR.load,pR=dR.store,mR=`<path d='m6 8 4 4-4 4M12 16h6'/>`,hR=[`<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(``),gR={ready:`hsl(220 8% 46%)`,running:`hsl(142 72% 45%)`,"alive-quiet":`hsl(210 65% 50%)`,dead:`hsl(0 72% 50%)`},_R={ready:`hsl(220 10% 16%)`,running:`hsl(142 85% 12%)`,"alive-quiet":`hsl(210 70% 14%)`,dead:`hsl(0 80% 12%)`},vR={ready:mR,running:hR,"alive-quiet":mR,dead:mR},yR=`<circle cx='19' cy='7' r='3.5' fill='hsl(0 72% 50%)' stroke='white' stroke-width='1.5'/>`,bR=(e,t=!1)=>{let n=gR[e],r=_R[e],i=vR[e],a=t?yR:``;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`?lj:1}'>`,`<rect x='2' y='4' width='20' height='16' rx='2' fill='${n}'/>`,i,a,`</svg>`].join(``)},xR=`ready`,SR=null,CR=!1,wR=(e,t)=>SR===null||e!==xR||t!==CR,TR=(e,t)=>{xR=e,SR=e,CR=t},ER=()=>{xR=`ready`,SR=null,CR=!1},DR=(e,t=!1)=>{if(typeof document>`u`||!wR(e,t))return;TR(e,t);let n=`data:image/svg+xml,${encodeURIComponent(bR(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},OR=`/api/health`,kR=async()=>{try{return(await fetch(OR)).ok}catch{return!1}},AR=(e,t)=>t.buffer.active.type!==`alternate`||t.modes.mouseTrackingMode!==`none`?!1:e.deltaMode===WheelEvent.DOM_DELTA_PIXEL,jR=e=>e||`localterm`,MR=e=>`${aj}${e||`localterm`}`,NR={matchBackground:mj,activeMatchBackground:hj,activeMatchBorder:gj,matchOverviewRuler:hj,activeMatchColorOverviewRuler:gj},PR=`cwd`,FR=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(PR);n&&t.searchParams.set(PR,n);let r=new URLSearchParams(window.location.search).get(`run`);return r&&t.searchParams.set(`run`,r),t.toString()},IR=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(PR,e),t.toString()},LR=({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)(null),p=(0,b.useRef)(rR()),m=(0,b.useRef)(HL()),h=(0,b.useRef)(GL()),g=(0,b.useRef)(JL()),_=(0,b.useRef)(zL()),v=(0,b.useRef)(IL()),x=(0,b.useRef)(ZL()),C=(0,b.useRef)(eR()),w=(0,b.useRef)(oR()),T=(0,b.useRef)(lR()),E=(0,b.useRef)(fR()),O=(0,b.useRef)(null),k=(0,b.useRef)(null),A=(0,b.useRef)(null),j=(0,b.useRef)(null),M=(0,b.useRef)(null),[N,P]=(0,b.useState)(null),[F,I]=(0,b.useState)(0),[L,R]=(0,b.useState)(!1),[z,ee]=(0,b.useState)(!1),[B,te]=(0,b.useState)(!1),[V,H]=(0,b.useState)(!1),ne=(0,b.useRef)(null),[U,re]=(0,b.useState)(0),[W,ie]=(0,b.useState)(!1),[ae,oe]=(0,b.useState)(!1),[se,ce]=(0,b.useState)(!1),[le,ue]=(0,b.useState)(null),de=(0,b.useRef)(null),fe=(0,b.useRef)(null),pe=(0,b.useRef)(!1),me=(0,b.useRef)(!1),he=W||ae||se;pe.current=ae,me.current=se;let[ge,_e]=(0,b.useState)(``),[ve,ye]=(0,b.useState)({resultIndex:-1,resultCount:0}),[be,xe]=(0,b.useState)(p.current),[Se,Ce]=(0,b.useState)(null),we=Se??be,Te=(0,b.useMemo)(()=>iI(we),[we]),Ee=(0,b.useMemo)(()=>({...Te.colors,extendedAnsi:JI(Te.colors)}),[Te]),[De,Oe]=(0,b.useState)(m.current),[ke,Ae]=(0,b.useState)(null),je=ke??De,[Me,Ne]=(0,b.useState)(E.current),Pe=(0,b.useMemo)(()=>YF(je),[je]),[Fe,Ie]=(0,b.useState)(h.current),[Le,Re]=(0,b.useState)(g.current),[ze,Be]=(0,b.useState)(_.current),[Ve,He]=(0,b.useState)(null),Ue=Ve??ze,[We,Ge]=(0,b.useState)(v.current),[qe,Ye]=(0,b.useState)(x.current),[Xe,Ze]=(0,b.useState)(C.current),[Qe,$e]=(0,b.useState)(w.current),[et,tt]=(0,b.useState)(T.current),[nt,rt]=(0,b.useState)(null),[it,at]=(0,b.useState)(`Notification`in window?Notification.permission:`unsupported`),[ot,st]=(0,b.useState)(null),ct=(0,b.useRef)(null),ut=(0,b.useRef)(!1),dt=(0,b.useMemo)(EL,[]),[ft,pt]=(0,b.useState)(!1),{summary:mt,setGitDiffSummary:ht}=hI(),gt=mt!==null&&mt.isRepo&&mt.files>0;(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let l=!1,u=!1,d=!1,y=``,b=null,w=null,T=null,N=null,F=null,L=0,R=`ready`,z=!1,ee=!1,B=[0],te=()=>B[B.length-1]??0,V=()=>{let e=performance.now()-L;if(e<750){F=window.setTimeout(V,750-e);return}F=null,N!==null&&(window.clearTimeout(N),N=null),R===`running`&&(document.hidden&&(z=!0),ee?(R=`alive-quiet`,DR(`alive-quiet`,z)):(R=`ready`,DR(`ready`,z)))},H=()=>{R!==`running`&&N===null&&(N=window.setTimeout(()=>{N=null,!(l||u)&&(R=`running`,z=!1,DR(`running`))},250)),L=performance.now(),F===null&&(F=window.setTimeout(V,750))},U=()=>{N!==null&&(window.clearTimeout(N),N=null),F!==null&&(window.clearTimeout(F),F=null),(R!==`ready`||z)&&(R=`ready`,z=!1,DR(`ready`))},re=YF(m.current);ZI(re).then(()=>{if(l)return;let e=r.current;e&&e.clearTextureAtlas(),W._core._charSizeService.measure(),Ne()});let W=new $u({allowProposedApi:!0,cursorBlink:v.current,cursorStyle:_.current,fontFamily:XF(re,E.current),fontSize:h.current,lineHeight:g.current,scrollback:x.current,theme:{...iI(p.current).colors,extendedAnsi:JI(iI(p.current).colors)},macOptionIsMeta:!0,scrollOnUserInput:C.current,windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0},scrollbar:{showScrollbar:!1}});r.current=W,gL.attach(W);let ie=new D;O.current=ie,W.loadAddon(ie),W.loadAddon(new Mn),W.loadAddon(new S),W.loadAddon(new Ke),W.loadAddon(new Je),W.loadAddon(new En);let ae=W._core.unicodeService._activeProvider;W.unicode.register(new iL(ae)),W.unicode.activeVersion=`15-graphemes-emoji`;let oe=new lt;W.loadAddon(oe),o.current=oe;let se=oe.onDidChangeResults(ye);W.open(e),ie.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 ce=()=>{let e=W.buffer.active,t=e.length,n=W.rows,r=e.viewportY+n>=t,i=t>n,a=j.current,o=M.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}%`}};ce();let le=W.onScroll(ce);gL.setAfterFlush(ce);let fe=!1,pe=0,me=0,he=e=>{if(e.button===0){fe=!0,pe=e.clientY,me=W.buffer.active.viewportY;try{e.target.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}},ge=e=>{if(!fe)return;let t=j.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-pe,o=Math.max(0,Math.min(r,me+Math.round(a/i)));o!==W.buffer.active.viewportY&&W.scrollLines(o-W.buffer.active.viewportY)},_e=()=>{fe=!1},ve=e=>{if(e.button!==0||e.target===M.current)return;let t=j.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)},be=M.current,xe=j.current;be&&(be.addEventListener(`pointerdown`,he),be.addEventListener(`pointermove`,ge),be.addEventListener(`pointerup`,_e),be.addEventListener(`pointercancel`,_e)),xe&&xe.addEventListener(`pointerdown`,ve);try{let e=new ia;e.onContextLoss(()=>e.dispose()),W.loadAddon(e)}catch{}let Se=W.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let t=e[0],n=typeof t==`number`?t:1;return B.push(n),!0}),Ce=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}),we=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}),Te=W.parser.registerCsiHandler({final:`J`},_L),Ee=W.parser.registerCsiHandler({prefix:`?`,final:`J`},_L),De=e=>{b?.readyState===WebSocket.OPEN&&b.send(JSON.stringify(e))},Oe=()=>{let e=f.current;e&&cancelAnimationFrame(e.frameId),f.current=null},ke=()=>{let e=f.current;e&&hL(W,e.anchor)},Ae=e=>{Oe(),f.current={anchor:e,frameId:requestAnimationFrame(()=>{ke(),f.current=null})}};W.attachCustomWheelEventHandler(e=>AR(e,W)?(e.preventDefault(),!1):!0),W.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(NL(e,dt)){if(e.type===`keydown`){e.preventDefault();let t=document.getElementById(`new-shell-link`);t instanceof HTMLAnchorElement&&t.click()}return!1}if(AL(e,dt))return e.type===`keydown`&&(e.preventDefault(),ne.current?.()),!1;if(kL(e,dt))return e.type===`keydown`&&(e.preventDefault(),de.current?.()),!1;if(jL(e,dt))return e.type===`keydown`&&(e.preventDefault(),A.current?.()),!1;if(ML(e,dt))return e.type===`keydown`&&(e.preventDefault(),k.current?.()),!1;if(e.type===`keydown`&&e.key===`Enter`){let t=aL(e),n=(te()&1)!=0;if(t!==0&&n)return e.preventDefault(),De({type:`input`,data:QI(13,t)}),!1;if(t===1)return e.preventDefault(),De({type:`input`,data:`
|
|
115
|
-
`}),!1}return!0});let je=e=>{if(u)return;let t=e.trim();t&&(y=t,document.title=jR(t))};s.current=()=>W.focus(),c.current=e=>W.paste(e);let Me=(e,t)=>{let n=W,r=n._core._renderService?.dimensions?.css?.canvas?.width,i=n._core._renderService?.dimensions?.css?.canvas?.height;De({type:`resize`,cols:e,rows:t,...r!=null&&i!=null?{pixelWidth:Math.round(r),pixelHeight:Math.round(i)}:{}})},Ne=()=>{let e=$I(W);oL(W,ie)&&(Ae(e),Me(W.cols,W.rows))},Pe=()=>{T!==null&&window.clearTimeout(T),T=window.setTimeout(()=>{T=null,Ne()},80)};W.onData(e=>{for(let t of mL(e,BS))De({type:`input`,data:t})}),W.onResize(({cols:e,rows:t})=>{Me(e,t),ce()});let Fe=new ResizeObserver(Pe),Ie=()=>{!document.hidden&&z&&(z=!1,DR(R))};document.addEventListener(`visibilitychange`,Ie),Fe.observe(e),Ne(),requestAnimationFrame(()=>W.focus());let Le=e=>{if(!u){if(u=!0,e===null||e===0){window.close(),setTimeout(()=>{l||(U(),DR(`dead`),W.write(dL(e)),document.title=MR(y),P({reason:`shell-exited`,exitCode:e}),rt(null))},100);return}U(),DR(`dead`),W.write(dL(e)),document.title=MR(y),P({reason:`shell-exited`,exitCode:e}),rt(null)}},Re=(e,t,n)=>{u||(u=!0,U(),DR(`dead`),W.write(sL(e,t)),document.title=MR(y),P({reason:`connection-lost`,closeCode:e,closeReason:t,wasClean:n}),rt(null))},ze=()=>{if(l)return;let e=new WebSocket(FR(ct.current));b=e,e.addEventListener(`open`,()=>{l||b!==e||(d=!0,ut.current=!0,I(0),Me(W.cols,W.rows))}),e.addEventListener(`message`,n=>{if(l||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;gL.push(e),H();return}let i=nA.safeParse(r);if(!i.success)return;let a=i.data;if(a.type===`title`)je(a.title);else if(a.type===`session`)rt({shell:a.shell,shellName:a.shellName,pid:a.pid,cwd:a.cwd,title:a.title}),st(a.cwd),je(a.title),PL();else if(a.type===`automations`)ue(a.automations);else if(a.type===`cwd`)st(a.cwd),ht(null);else if(a.type===`git-diff-summary`)ht(a.summary);else if(a.type===`foreground`){let e=a.process!==null;t?.(e),!e&&R===`alive-quiet`&&(R=`ready`,DR(`ready`,z)),ee=e}else a.type===`notification`?`Notification`in window&&Notification.permission===`granted`&&new Notification(a.body):a.type===`exit`&&(U(),Le(a.code))}),e.addEventListener(`close`,t=>{if(b===e&&(b=null,ut.current=!1,!l&&!u)){if(d){console.warn(`[localterm] websocket closed: code=${t.code} reason=${JSON.stringify(t.reason)} wasClean=${t.wasClean}`),Re(t.code,t.reason,t.wasClean);return}I(e=>e+1),w=window.setTimeout(ze,tj)}}),e.addEventListener(`error`,t=>{console.warn(`[localterm] websocket error`,t);try{e.close()}catch{}})};return a.current=()=>{if(!l){u=!1,d=!1,ut.current=!1,P(null),rt(null),I(0),DR(`ready`),t?.(!1),w!==null&&(window.clearTimeout(w),w=null);try{b?.close()}catch{}b=null,ze()}},ze(),i.current=!0,()=>{l=!0,i.current=!1,be&&(be.removeEventListener(`pointerdown`,he),be.removeEventListener(`pointermove`,ge),be.removeEventListener(`pointerup`,_e),be.removeEventListener(`pointercancel`,_e)),xe&&xe.removeEventListener(`pointerdown`,ve),se.dispose(),le.dispose(),Se.dispose(),Ce.dispose(),we.dispose(),Te.dispose(),Ee.dispose(),w!==null&&window.clearTimeout(w),T!==null&&window.clearTimeout(T),Oe(),U(),document.removeEventListener(`visibilitychange`,Ie),Fe.disconnect();try{b?.close()}catch{}b=null,gL.detach(),W.dispose(),document.title=ij}},[]),(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.theme=Ee)},[Ee]),(0,b.useEffect)(()=>{if(!i.current||!r.current)return;let e=!1;return ZI(Pe).then(()=>{if(e)return;let t=r.current;if(!t)return;t.options.fontFamily=XF(Pe,Me),t.clearTextureAtlas();let n=O.current;n&&oL(t,n)}),()=>{e=!0}},[Pe,Me]);let _t=(0,b.useCallback)(e=>{xe(e),Ce(null),iR(e)},[]),vt=(0,b.useCallback)(e=>{Oe(e),Ae(null),UL(e)},[]),yt=(0,b.useCallback)(e=>{Ne(e),pR(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.fontSize=Fe;let t=O.current;t&&oL(e,t)},[Fe]);let bt=(0,b.useCallback)(e=>{let t=vL(e);Ie(t),KL(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.lineHeight=Le;let t=O.current;t&&oL(e,t)},[Le]);let xt=(0,b.useCallback)(e=>{let t=xL(e);Re(t),YL(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorStyle=Ue)},[Ue]);let St=(0,b.useCallback)(e=>{Be(e),He(null),BL(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorBlink=We)},[We]);let Ct=(0,b.useCallback)(e=>{Ge(e),LL(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollback=qe)},[qe]);let wt=(0,b.useCallback)(e=>{Ye(e),QL(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollOnUserInput=Xe)},[Xe]);let Tt=(0,b.useCallback)(e=>{Ze(e),tR(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;let t=O.current;t&&oL(e,t)},[Qe,et]);let Et=(0,b.useCallback)(e=>{let t=wL(e);$e(t),sR(t)},[]),Dt=(0,b.useCallback)(e=>{let t=TL(e);tt(t),uR(t)},[]),Ot=(0,b.useCallback)(()=>{`Notification`in window&&Notification.requestPermission().then(e=>{at(e)})},[]);(0,b.useEffect)(()=>{if(!B)return;let e=l.current;e&&(e.focus(),e.select())},[B,U]);let kt=(0,b.useCallback)(e=>{if(!e){o.current?.clearDecorations(),ye({resultIndex:-1,resultCount:0});return}o.current?.findNext(e,{decorations:NR})},[]),At=(0,b.useCallback)(e=>{e&&o.current?.findPrevious(e,{decorations:NR})},[]),jt=(0,b.useCallback)(()=>{te(!1),_e(``),ye({resultIndex:-1,resultCount:0}),o.current?.clearDecorations(),s.current?.()},[]),Mt=(0,b.useCallback)(()=>{fe.current!==null&&(window.clearTimeout(fe.current),fe.current=null),ie(!0)},[]),Nt=(0,b.useCallback)(e=>{let t=e.clientY<=0||e.clientX>=window.innerWidth-1?pj:200;fe.current=window.setTimeout(()=>{fe.current=null,!pe.current&&!me.current&&ie(!1)},t)},[]),Pt=(0,b.useCallback)(e=>{oe(e),e||(fe.current!==null&&window.clearTimeout(fe.current),fe.current=window.setTimeout(()=>{fe.current=null,ie(!1)},200))},[]),Ft=(0,b.useCallback)(e=>{if(ce(e),e){H(!1);return}fe.current!==null&&window.clearTimeout(fe.current),fe.current=window.setTimeout(()=>{fe.current=null,ie(!1)},200),s.current?.()},[]);de.current=(0,b.useCallback)(()=>{Ft(!me.current)},[Ft]),ne.current=(0,b.useCallback)(()=>{H(e=>!e)},[]);let It=(0,b.useCallback)(()=>{H(!1),s.current?.()},[]),Lt=(0,b.useCallback)(()=>{te(!0),H(!1),re(e=>e+1)},[]);k.current=Lt;let Rt=(0,b.useCallback)(()=>{pt(!0),H(!1)},[]);A.current=Rt;let zt=(0,b.useCallback)(()=>{pt(!1),s.current?.()},[]),Bt=(0,b.useCallback)(e=>{c.current?.(e)},[]),Vt=(0,b.useCallback)(e=>{let t=e.target.value;_e(t),kt(t)},[kt]),Ht=(0,b.useCallback)(e=>{if(ML(e.nativeEvent,dt)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),jt();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?At(ge):kt(ge))},[jt,kt,At,dt,ge]),Ut=(0,b.useCallback)(()=>{ee(!0),a.current?.(),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,ee(!1)},800)},[]),Wt=(0,b.useCallback)(()=>{navigator.clipboard.writeText(oj).then(()=>{R(!0),d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{d.current=null,R(!1)},sj)}).catch(()=>{})},[]);(0,b.useEffect)(()=>()=>{fe.current!==null&&(window.clearTimeout(fe.current),fe.current=null),u.current!==null&&(window.clearTimeout(u.current),u.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null)},[]),(0,b.useEffect)(()=>{if(ct.current=ot,!ot)return;let e=new URL(window.location.href);if(e.searchParams.get(PR)!==ot){e.searchParams.set(PR,ot);try{window.history.replaceState(null,``,e)}catch{}}},[ot]);let Gt=IR(ot),Kt=N!==null,qt=!Kt&&F>=2,Jt=Kt||qt,Yt=N!==null&&N.reason!==`shell-exited`||qt;(0,b.useEffect)(()=>{if(!Yt)return;let e=Date.now(),t=!1,n=null,i=i=>{if(t||ut.current)return;if(i){let e=r.current;e&&(e.write(uL(Ue,We)),e.refresh(0,e.rows-1),e.focus()),a.current?.();return}let s=Date.now()-e<5e3?250:cj;n=window.setTimeout(o,s)},o=()=>{kR().then(i)};return o(),()=>{t=!0,n!==null&&window.clearTimeout(n)}},[Yt,Ue,We]),(0,b.useEffect)(()=>{e?.(Jt),Jt&&(H(!1),pt(!1),ce(!1))},[Jt,e]);let Xt=ve.resultCount===0?`0/0`:`${ve.resultIndex+1}/${ve.resultCount}`,Zt=Te.colors.background??`#101010`,Qt=(0,b.useMemo)(()=>{let e=dt?`⌘`:`Ctrl+`;return[{id:`find`,label:`Find in terminal`,category:`Actions`,shortcut:`${e}F`,icon:(0,y.jsx)(Dd,{className:`size-3.5`}),action:Lt},{id:`git-diff`,label:`View git diff`,category:`Actions`,shortcut:`${e}G`,icon:(0,y.jsx)(gd,{className:`size-3.5`}),action:Rt},{id:`automations`,label:`Automations`,category:`Actions`,shortcut:`${e}J`,icon:(0,y.jsx)(dd,{className:`size-3.5`}),action:()=>Ft(!0)},{id:`new-shell`,label:`Open new shell`,category:`Actions`,shortcut:`Alt+T`,icon:(0,y.jsx)(Td,{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)(Sd,{className:`size-3.5`}),action:()=>bt(Fe+1)},{id:`font-size-down`,label:`Decrease font size`,category:`Settings`,shortcut:`${e}-`,icon:(0,y.jsx)(Sd,{className:`size-3.5`}),action:()=>bt(Fe-1)},{id:`cursor-blink`,label:`Cursor blink`,category:`Settings`,checked:We,action:()=>Ct(!We)},{id:`scroll-on-input`,label:`Pin to bottom on input`,category:`Settings`,checked:Xe,action:()=>Tt(!Xe)},...kF.map(e=>({id:`cursor:${e.id}`,label:e.name,category:`Cursor`,checked:e.id===ze,action:()=>St(e.id)})),...JF.map(e=>({id:`font:${e.id}`,label:e.name,category:`Font`,checked:e.id===De,action:()=>vt(e.id)})),...rI.map(e=>({id:`theme:${e.id}`,label:e.name,category:`Theme`,checked:e.id===be,action:()=>_t(e.id)}))]},[dt,_t,vt,Lt,Rt,Ft,St,We,Ct,Fe,bt,Xe,Tt,be,De,ze]),$t=(0,b.useCallback)(e=>{let t=e?.id??``;Ce(t.startsWith(`theme:`)?t.slice(6):null),Ae(t.startsWith(`font:`)?t.slice(5):null);let n=t.startsWith(`cursor:`)?t.slice(7):null;He(MF(n)?n:null)},[]);return(0,y.jsxs)(`div`,{className:`h-dvh w-dvw`,style:{background:Zt},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:et,right:Qe,bottom:et,left:Qe}}),(0,y.jsx)(`div`,{ref:j,className:`xterm-scrollbar-track`,style:{top:et,right:Qe,bottom:et},children:(0,y.jsx)(`div`,{ref:M,className:`xterm-scrollbar-thumb`})}),N===null?null:(0,y.jsx)(uS,{variant:`destructive`,role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10`,children:N.reason===`shell-exited`?N.exitCode===null?`exited`:`exited · code ${N.exitCode}`:`disconnected · code ${N.closeCode}`}),(0,y.jsxs)(`div`,{className:ap(`absolute right-0 top-0 z-10 flex flex-col items-end pr-3 pt-1`,he||B||gt?`pointer-events-auto`:`pointer-events-none`),onMouseEnter:Mt,onMouseLeave:Nt,children:[(0,y.jsx)(`div`,{"aria-hidden":`true`,className:ap(`pointer-events-auto mr-0.5 h-[2px] w-5 rounded-full bg-muted-foreground/25 transition-opacity duration-150`,he||B||gt?`opacity-0`:`opacity-100`)}),!B&&(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,className:ap(`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`,he||gt?`translate-y-0 opacity-100`:`pointer-events-none -translate-y-1 opacity-0`),onMouseDown:e=>{e.currentTarget.contains(e.target)&&e.preventDefault()},onKeyDown:e=>{e.currentTarget.contains(e.target)&&s.current?.()},children:[(0,y.jsx)(`div`,{className:ap(`grid`,gt&&`transition-[grid-template-columns] duration-200 ease-snappy`,gt&&!he?`grid-cols-[0fr]`:`grid-cols-[1fr]`),children:(0,y.jsxs)(`div`,{className:ap(`flex min-w-0 items-center gap-0.5 overflow-hidden`,gt&&`transition-opacity duration-200 ease-snappy`,gt&&!he?`pointer-events-none opacity-0`:`opacity-100`),children:[(0,y.jsx)(mI,{themeId:be,onThemeChange:_t,onThemePreview:Ce,fontId:De,onFontChange:vt,onFontPreview:Ae,nerdFontEnabled:Me,onNerdFontEnabledChange:yt,fontSize:Fe,onFontSizeChange:bt,lineHeight:Le,onLineHeightChange:xt,cursorStyle:ze,onCursorStyleChange:St,onCursorStylePreview:He,cursorBlink:We,onCursorBlinkChange:Ct,scrollback:qe,onScrollbackChange:wt,scrollOnUserInput:Xe,onScrollOnUserInputChange:Tt,paddingX:Qe,onPaddingXChange:Et,paddingY:et,onPaddingYChange:Dt,notificationsPermission:it,onNotificationsPermissionRequest:Ot,sessionInfo:nt,onPopoverOpenChange:Pt,onClose:s.current??void 0}),(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-sm`,onClick:Lt,"aria-label":`find in terminal`,className:`hover:text-foreground`,children:(0,y.jsx)(Dd,{})}),(0,y.jsx)(Yj,{open:se,onOpenChange:Ft,automations:le,onAutomationsLoaded:ue,defaultCwd:ot,isMac:dt}),(0,y.jsx)(Qx,{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:Gt,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`,children:(0,y.jsx)(Td,{})})]})}),gt&&mt!==null?(0,y.jsxs)(`button`,{type:`button`,onClick:Rt,"aria-label":`view git diff: ${mt.additions} additions, ${mt.deletions} deletions${mt.binaries>0?`, ${mt.binaries} binary files changed`:``}`,title:`${dt?`⌘`:`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:[`+`,DL(mt.additions)]}),(0,y.jsxs)(`span`,{className:`text-red-400`,children:[`−`,DL(mt.deletions)]}),mt.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`}),mt.binaries]}):null]}):null]}),B&&(0,y.jsxs)(MS,{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)(RS,{ref:l,type:`search`,value:ge,onChange:Vt,onKeyDown:Ht,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(PS,{align:`inline-end`,children:[(0,y.jsx)(LS,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:Xt}),(0,y.jsx)(IS,{size:`icon-xs`,onClick:()=>At(ge),disabled:ve.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(md,{})}),(0,y.jsx)(IS,{size:`icon-xs`,onClick:()=>kt(ge),disabled:ve.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(pd,{})})]})]})]})]}),(0,y.jsx)(iM,{open:V,onClose:It,commands:Qt,onActiveItemChange:$t}),(0,y.jsx)(XM,{open:ft,cwd:ot,onClose:zt,onSendToTerminal:Bt}),(0,y.jsx)($x,{open:Jt,children:(0,y.jsx)(nS,{children:N===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(rS,{children:[(0,y.jsxs)(aS,{className:`flex items-center gap-2`,children:[(0,y.jsx)(zS,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Lost connection`]}),(0,y.jsx)(oS,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(MS,{children:[(0,y.jsx)(RS,{readOnly:!0,value:oj,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(PS,{align:`inline-end`,children:(0,y.jsx)(IS,{size:`icon-xs`,onClick:Wt,"aria-label":L?`Copied`:`Copy restart command`,children:L?(0,y.jsx)(fd,{}):(0,y.jsx)(hd,{})})})]}),(0,y.jsx)(iS,{children:(0,y.jsxs)(sS,{onClick:Ut,disabled:z,children:[z?(0,y.jsx)(zS,{"data-icon":`inline-start`}):null,`Retry`]})})]}):N.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(rS,{children:[(0,y.jsx)(aS,{children:`Shell ended`}),(0,y.jsx)(oS,{children:N.exitCode===null||N.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${N.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(iS,{children:(0,y.jsx)(sS,{onClick:()=>window.open(Gt,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(rS,{children:[(0,y.jsxs)(aS,{className:`flex items-center gap-2`,children:[(0,y.jsx)(zS,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Connection lost`]}),(0,y.jsxs)(oS,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,N.closeCode,N.closeReason?` · ${N.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(iS,{children:(0,y.jsxs)(sS,{onClick:Ut,disabled:z,children:[z?(0,y.jsx)(zS,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})})]})},RR=()=>{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)(LR,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[]),onForegroundProcessChange:(0,b.useCallback)(e=>{t.current=e},[])})};ER(),DR(`ready`),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=ZF();if(!e)return;let t=document.createElement(`link`);t.id=Dj,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})();var zR=document.getElementById(`root`);if(!zR)throw Error(`Root element not found`);(0,x.createRoot)(zR).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(TF,{delay:300,children:(0,y.jsx)(RR,{})})}));
|
|
116
|
-
//# sourceMappingURL=index-
|
|
114
|
+
`);a.length>0&&a[a.length-1]===``&&a.pop();for(let e of a){let a=xM.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},CM=e=>e.reduce((e,t)=>e+t.lines.length,0),wM=e=>{if(typeof window>`u`)return null;try{let t=window.localStorage.getItem(e);return t===null||t.trim()===``?null:t}catch{return null}},TM=(e,t)=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,t)}catch{}},EM=(e,t,n)=>({load:()=>{let r=wM(e);if(r===null)return t;let i=Number(r);return Number.isFinite(i)?n(i):t},store:t=>TM(e,String(t))}),DM=(e,t)=>({load:()=>{let n=wM(e);return n===`true`?!0:n===`false`?!1:t},store:t=>TM(e,String(t))}),OM=(e,t,n)=>({load:()=>{let r=wM(e);return r!==null&&n(r)?r:t},store:t=>TM(e,t)}),kM=(e,t,n)=>({load:()=>t(wM(e)),store:t=>TM(e,n(t))}),AM=OM(dj,`unified`,e=>e===`unified`||e===`split`),jM=AM.load,MM=AM.store,NM=(e,t)=>{let n=e=>`${e.side===`old`?`old `:``}L${e.lineNumber}`;return e.side===t.side?`${e.side===`old`?`old `:``}L${e.lineNumber}–L${t.lineNumber}`:`${n(e)} – ${n(t)}`},PM=()=>(0,y.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 border-l-2 border-primary/60 bg-primary/10`}),FM={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`}},IM=`text-emerald-400`,LM=`text-red-400`,RM=`w-12 shrink-0 select-none px-2 text-right text-muted-foreground/50 tabular-nums`,zM=e=>{let t=e.lastIndexOf(`/`);return t===-1?{directory:``,basename:e}:{directory:e.slice(0,t+1),basename:e.slice(t+1)}},BM=e=>e===`add`?`bg-emerald-500/10`:e===`del`?`bg-red-500/10`:``,VM=e=>e===`context`?`text-muted-foreground`:`text-foreground/90`,HM=({onClick:e,onDragStart:t})=>(0,y.jsx)(`button`,{type:`button`,onClick:e,onPointerDown:e=>{e.button===0&&(e.preventDefault(),t())},"aria-label":`comment on line — drag to select multiple lines`,className:`absolute top-1/2 left-1 z-10 hidden size-4 -translate-y-1/2 items-center justify-center rounded-sm bg-primary text-primary-foreground transition-transform group-hover/line:flex hover:scale-110`,children:(0,y.jsx)(yd,{className:`size-3`,"aria-hidden":`true`})}),UM=({initialComment:e,onSave:t,onCancel:n})=>{let[r,i]=(0,b.useState)(e),a=r.trim(),o=()=>{a&&t(a)};return(0,y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,y.jsx)(jS,{autoFocus:!0,value:r,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),n()):e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),o())},placeholder:`Leave a comment on this line…`,"aria-label":`line comment`,className:`min-h-12 text-xs`}),(0,y.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,y.jsx)(Qx,{size:`xs`,onClick:o,disabled:!a,children:`Save comment`}),(0,y.jsx)(Qx,{size:`xs`,variant:`ghost`,onClick:n,children:`Cancel`})]})]})},WM=({annotation:e,isEditing:t,rangeLabel:n,onEdit:r,onSave:i,onCancel:a,onDelete:o})=>(0,y.jsx)(`div`,{className:`border-y border-border/40 bg-muted/20 py-2 pr-4 pl-3 font-sans`,children:(0,y.jsxs)(`div`,{className:`sticky left-3 max-w-xl`,children:[n?(0,y.jsx)(`div`,{className:`mb-1 font-mono text-[10px] tracking-wide text-muted-foreground/80`,children:n}):null,t?(0,y.jsx)(UM,{initialComment:e?.comment??``,onSave:i,onCancel:a}):e?(0,y.jsxs)(`div`,{className:`group/comment flex items-start gap-2`,children:[(0,y.jsx)(bd,{className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":`true`}),(0,y.jsx)(`p`,{className:`min-w-0 flex-1 whitespace-pre-wrap text-foreground/90`,children:e.comment}),(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 opacity-0 transition-opacity group-hover/comment:opacity-100`,children:[(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-xs`,onClick:r,"aria-label":`edit comment`,className:`hover:text-foreground`,children:(0,y.jsx)(Cd,{})}),(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-xs`,onClick:o,"aria-label":`delete comment`,className:`hover:text-destructive`,children:(0,y.jsx)(Ad,{})})]})]}):null]})}),GM=({line:e,highlighted:t,onAnnotate:n,onDragStart:r,onDragEnter:i})=>(0,y.jsxs)(`div`,{className:ap(`group/line relative flex`,BM(e.type)),onPointerEnter:i,children:[n&&r?(0,y.jsx)(HM,{onClick:n,onDragStart:r}):null,(0,y.jsx)(`span`,{className:RM,children:e.oldLine??``}),(0,y.jsx)(`span`,{className:RM,children:e.newLine??``}),(0,y.jsx)(`span`,{className:ap(`w-5 shrink-0 select-none text-center`,e.type===`add`&&IM,e.type===`del`&&LM),children:e.type===`add`?`+`:e.type===`del`?`-`:``}),(0,y.jsxs)(`span`,{className:ap(`whitespace-pre pr-4`,VM(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]}),t?(0,y.jsx)(PM,{}):null]}),KM=({line:e,side:t,onAnnotate:n,onDragStart:r})=>{if(!e)return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`span`,{className:RM}),(0,y.jsx)(`span`,{className:`min-w-0 flex-1 bg-muted/20`})]});let i=e.type===`context`?`context`:t===`left`?`del`:`add`;return(0,y.jsxs)(y.Fragment,{children:[n&&r?(0,y.jsx)(HM,{onClick:n,onDragStart:r}):null,(0,y.jsx)(`span`,{className:ap(RM,BM(i)),children:t===`left`?e.oldLine??``:e.newLine??``}),(0,y.jsx)(`span`,{className:ap(`min-w-0 flex-1 overflow-x-clip whitespace-pre pr-2`,BM(i),VM(e.type)),children:e.text})]})},qM=({hunk:e})=>(0,y.jsx)(`div`,{className:`select-none bg-muted/30 px-4 py-0.5 text-muted-foreground/60`,children:e.header}),JM=({file:e,viewMode:t,annotations:n,editingKey:r,pendingRange:i,dragCancelRef:a,onOpenEditor:o,onSaveAnnotation:s,onCancelEditor:c,onDeleteAnnotation:l})=>{let[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(null),m=(0,b.useMemo)(()=>e.patch?SM(e.patch):[],[e.patch]),h=(0,b.useMemo)(()=>CM(m),[m]),g=(0,b.useMemo)(()=>cM(m),[m]),_=f!==null,v=f?dM(g,f.anchor,f.focus):null,x=(0,b.useRef)(v);x.current=v;let S=e=>p({anchor:e,focus:e}),C=e=>p(t=>t&&{...t,focus:e});(0,b.useEffect)(()=>{d(!1),p(null)},[e.path]),(0,b.useEffect)(()=>{if(!_)return;let t=()=>p(null);a.current=t;let n=()=>{p(null);let t=x.current;t&&o(gM({filePath:e.path,...t.end}),sM(t.start)===sM(t.end)?void 0:{filePath:e.path,...t})};return window.addEventListener(`pointerup`,n),window.addEventListener(`pointercancel`,t),()=>{a.current=null,window.removeEventListener(`pointerup`,n),window.removeEventListener(`pointercancel`,t)}},[_,e.path,o,a]);let w=(0,b.useMemo)(()=>{let t=new Set,r=e=>{if(e)for(let n of fM(g,e))t.add(n)};r(v),i&&i.filePath===e.path&&r(i);for(let t of Object.values(n)){if(t.filePath!==e.path)continue;let n=_M(t);n&&r({start:n,end:{side:t.side,lineNumber:t.lineNumber}})}return t},[g,v,i,n,e.path]);if(e.binary)return(0,y.jsx)(YM,{icon:!0,children:`Binary file — no text diff to show.`});if(e.patchOmitted)return(0,y.jsx)(YM,{icon:!0,children:`Diff too large to display.`});if(m.length===0)return(0,y.jsx)(YM,{children:e.status===`renamed`?`Renamed without content changes.`:e.status===`untracked`&&e.additions===0?`Empty file.`:`No content changes.`});let T=u?1/0:uj,E=0,D=[];for(let e of m){if(E>=T)break;let t=T-E,n=e.lines.length<=t?e.lines:e.lines.slice(0,t);D.push(n===e.lines?e:{header:e.header,lines:n}),E+=n.length}let O=h-E,k=t=>{let a=oM(t);if(!a)return null;let o=gM({filePath:e.path,...a}),c=n[o],l=r===o,u=l&&i&&i.filePath===e.path?i.start:c?_M(c):null;return{key:o,target:a,saved:c,isEditing:l,rangeStart:u,save:t=>s({filePath:e.path,...a,...u?{startSide:u.side,startLineNumber:u.lineNumber}:{},comment:t})}},A=e=>e&&(e.saved||e.isEditing)?(0,y.jsx)(WM,{annotation:e.saved,isEditing:e.isEditing,rangeLabel:e.rangeStart?NM(e.rangeStart,e.target):null,onEdit:()=>o(e.key),onSave:e.save,onCancel:c,onDelete:()=>l(e.key)}):null;return(0,y.jsxs)(`div`,{className:ap(`pb-4 font-mono text-xs leading-5`,t===`unified`&&`min-w-max`,_&&`select-none`),children:[D.map(e=>(0,y.jsxs)(`div`,{children:[(0,y.jsx)(qM,{hunk:e}),t===`unified`?e.lines.map((e,t)=>{let n=k(e);return(0,y.jsxs)(b.Fragment,{children:[(0,y.jsx)(GM,{line:e,highlighted:n!==null&&w.has(sM(n.target)),onAnnotate:n?()=>o(n.key):void 0,onDragStart:n?()=>S(n.target):void 0,onDragEnter:_&&n?()=>C(n.target):void 0}),A(n)]},t)}):aM(e).map((e,t)=>{let n=e.left?k(e.left):null,r=e.right?k(e.right):null,i=n!==null&&n.key===r?.key;return(0,y.jsxs)(b.Fragment,{children:[(0,y.jsxs)(`div`,{className:`flex`,children:[(0,y.jsxs)(`div`,{className:`group/line relative flex w-1/2 min-w-0 border-r border-border/40`,onPointerEnter:_&&n?()=>C(n.target):void 0,children:[(0,y.jsx)(KM,{line:e.left,side:`left`,onAnnotate:n?()=>o(n.key):void 0,onDragStart:n?()=>S(n.target):void 0}),n&&w.has(sM(n.target))?(0,y.jsx)(PM,{}):null]}),(0,y.jsxs)(`div`,{className:`group/line relative flex w-1/2 min-w-0`,onPointerEnter:_&&r?()=>C(r.target):void 0,children:[(0,y.jsx)(KM,{line:e.right,side:`right`,onAnnotate:r?()=>o(r.key):void 0,onDragStart:r?()=>S(r.target):void 0}),r&&w.has(sM(r.target))?(0,y.jsx)(PM,{}):null]})]}),A(n),i?null:A(r)]},t)})]},e.header+String(e.lines[0]?.newLine??e.lines[0]?.oldLine??``))),O>0?(0,y.jsx)(`div`,{className:`px-4 py-2`,children:(0,y.jsxs)(Qx,{variant:`outline`,size:`xs`,onClick:()=>d(!0),children:[`Show `,O.toLocaleString(),` more lines`]})}):null]})},YM=({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)(_d,{className:`size-4`,"aria-hidden":`true`}):null,e]}),XM=({open:e,cwd:t,onClose:n,onSendToTerminal:r})=>{let[i,a]=(0,b.useState)(!1),[o,s]=(0,b.useState)(!1),[c,l]=(0,b.useState)(null),[u,d]=(0,b.useState)(!1),[f,p]=(0,b.useState)(!1),[m,h]=(0,b.useState)(null),[g,_]=(0,b.useState)(()=>jM()),[v,x]=(0,b.useState)(0),[S,C]=(0,b.useState)({}),[w,T]=(0,b.useState)(null),[E,D]=(0,b.useState)(null),O=(0,b.useRef)(null),k=(0,b.useRef)(null),A=(0,b.useRef)(null);(0,b.useEffect)(()=>{if(e){a(!0);let e=requestAnimationFrame(()=>s(!0));return()=>cancelAnimationFrame(e)}if(s(!1),i){let e=window.setTimeout(()=>a(!1),150);return()=>window.clearTimeout(e)}},[e]),(0,b.useEffect)(()=>{if(!e||!t)return;let n=new AbortController;return d(!0),p(!1),hM(t,n.signal).then(e=>{if(!n.signal.aborted){if(d(!1),!e){p(!0);return}l(e)}}),()=>n.abort()},[e,t,v]);let j=c?.files??[];(0,b.useEffect)(()=>{c&&(m&&c.files.some(e=>e.path===m)||h(c.files[0]?.path??null))},[c,m]);let M=j.find(e=>e.path===m)??null,N=M?j.indexOf(M):-1,P=(0,b.useMemo)(()=>{let e=0,t=0,n=0;for(let r of j)e+=r.additions,t+=r.deletions,r.binary&&(n+=1);return{additions:e,deletions:t,binaries:n}},[j]),F=(0,b.useCallback)(e=>{if(j.length===0)return;let t=Math.min(j.length-1,Math.max(0,(N===-1?0:N)+e));h(j[t].path),(A.current?.children[t])?.scrollIntoView({block:`nearest`})},[j,N]);(0,b.useEffect)(()=>{if(!e||!i)return;let t=e=>{let t=e.target,r=t instanceof HTMLElement&&t.tagName===`TEXTAREA`;if(e.key===`Escape`){if(r)return;if(e.preventDefault(),e.stopPropagation(),O.current){O.current();return}n();return}r||t instanceof HTMLElement&&t.tagName===`INPUT`||(e.key===`ArrowDown`||e.key===`j`?(e.preventDefault(),F(1)):(e.key===`ArrowUp`||e.key===`k`)&&(e.preventDefault(),F(-1)))};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[e,i,n,F]),(0,b.useEffect)(()=>{e&&o&&k.current?.focus()},[e,o]);let I=(0,b.useCallback)(e=>{_(e),MM(e)},[]),L=(0,b.useCallback)((e,t)=>{T(e),D(t??null)},[]),R=(0,b.useCallback)(()=>{T(null),D(null)},[]),z=(0,b.useCallback)(e=>{C(t=>({...t,[gM(e)]:e})),T(null),D(null)},[]),ee=(0,b.useCallback)(e=>{C(t=>{let{[e]:n,...r}=t;return r}),T(t=>t===e?null:t),D(t=>t&&gM({filePath:t.filePath,...t.end})===e?null:t)},[]),B=(0,b.useMemo)(()=>Object.values(S),[S]),te=(0,b.useMemo)(()=>{let e=new Map;for(let t of B)e.set(t.filePath,(e.get(t.filePath)??0)+1);return e},[B]),V=(0,b.useCallback)(()=>{C({}),T(null),D(null)},[]),H=(0,b.useCallback)(()=>{!r||B.length===0||(r(bM(B)),C({}),T(null),D(null),n())},[r,B,n]);if(!i)return null;let ne=e&&o,U=c?.isRepo??!0,re=c!==null&&U&&j.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":ne||void 0,"data-closed":!ne||void 0,className:ap(Gx),onClick:n}),(0,y.jsxs)(`div`,{ref:k,role:`dialog`,"aria-label":`git diff viewer`,"aria-modal":!0,tabIndex:-1,"data-open":ne||void 0,"data-closed":!ne||void 0,className:ap(`relative z-10 flex h-full w-full max-w-7xl flex-col overflow-hidden rounded-xl outline-none`,Ux,Kx),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:IM,children:[`+`,P.additions.toLocaleString()]}),` `,(0,y.jsxs)(`span`,{className:LM,children:[`−`,P.deletions.toLocaleString()]}),P.binaries>0?(0,y.jsxs)(`span`,{className:`text-muted-foreground/70`,children:[` · `,P.binaries,` binary`]}):null]}),u?(0,y.jsx)(zS,{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":g===e,onClick:()=>I(e),className:ap(`rounded-sm px-2 py-0.5 text-xs capitalize transition-colors`,g===e?`bg-foreground/10 text-foreground`:`text-muted-foreground hover:text-foreground`),children:e},e))}),(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-sm`,onClick:()=>x(e=>e+1),"aria-label":`refresh diff`,className:`hover:text-foreground`,children:(0,y.jsx)(Ed,{})}),(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-sm`,onClick:n,"aria-label":`close diff viewer`,className:`hover:text-foreground`,children:(0,y.jsx)(jd,{})})]})]}),f?(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)(Qx,{variant:`outline`,size:`xs`,onClick:()=>x(e=>e+1),children:`Retry`})]}):U?re?(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center text-sm text-muted-foreground`,children:`Working tree clean — nothing to diff.`}):c===null?(0,y.jsx)(`div`,{className:`flex flex-1 items-center justify-center`,children:(0,y.jsx)(zS,{"aria-label":`loading diff`})}):(0,y.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,y.jsx)(`div`,{ref:A,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:j.map(e=>{let t=FM[e.status],{directory:n,basename:r}=zM(e.path),i=e.path===m,a=te.get(e.path)??0;return(0,y.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":i,onClick:()=>h(e.path),className:ap(`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:ap(`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})]})}),a>0?(0,y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-0.5 font-mono text-[10px] tabular-nums text-muted-foreground`,title:`${a} pending comment${a===1?``:`s`}`,children:[(0,y.jsx)(bd,{className:`size-2.5`,"aria-hidden":`true`}),a]}):null,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:IM,children:[`+`,e.additions]}),` `,(0,y.jsxs)(`span`,{className:LM,children:[`−`,e.deletions]})]})]},e.path)})}),(0,y.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:M?(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:[M.oldPath?(0,y.jsxs)(`span`,{className:`truncate`,children:[M.oldPath,(0,y.jsx)(`span`,{className:`text-muted-foreground/50`,children:` → `}),(0,y.jsx)(`span`,{className:`text-foreground`,children:M.path})]}):(0,y.jsx)(`span`,{className:`truncate text-foreground`,children:M.path}),M.binary?null:(0,y.jsxs)(`span`,{className:`ml-auto shrink-0 tabular-nums`,children:[(0,y.jsxs)(`span`,{className:IM,children:[`+`,M.additions]}),` `,(0,y.jsxs)(`span`,{className:LM,children:[`−`,M.deletions]})]})]}),(0,y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto overscroll-contain`,children:(0,y.jsx)(JM,{file:M,viewMode:g,annotations:S,editingKey:w,pendingRange:E,dragCancelRef:O,onOpenEditor:L,onSaveAnnotation:z,onCancelEditor:R,onDeleteAnnotation:ee})})]}):(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.`}),B.length>0?(0,y.jsxs)(`footer`,{className:`flex shrink-0 items-center gap-2 border-t border-border/40 px-4 py-2`,children:[(0,y.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[B.length,` pending comment`,B.length===1?``:`s`]}),(0,y.jsxs)(`div`,{className:`ml-auto flex items-center gap-1.5`,children:[(0,y.jsx)(Qx,{variant:`ghost`,size:`xs`,onClick:V,children:`Clear all`}),r?(0,y.jsxs)(Qx,{size:`xs`,onClick:H,children:[(0,y.jsx)(Od,{"aria-hidden":`true`}),`Send to terminal`]}):null]})]}):null]})]})},ZM=Xx(`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 QM({className:e,orientation:t,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`button-group`,"data-orientation":t,className:ap(ZM({orientation:t}),e),...n})}function $M({className:e,render:t,...n}){return cS({defaultTagName:`div`,props:f_({className:ap(`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 eN=e=>String(e),tN=`size-7 rounded-none border-0 bg-transparent text-foreground hover:bg-foreground/10 hover:text-foreground disabled:opacity-30 [&_svg]:size-3.5`,nN=`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`,rN={ArrowRight:1,ArrowUp:1,ArrowLeft:-1,ArrowDown:-1},iN=({value:e,min:t,max:n,step:r,ariaLabel:i,decrementAriaLabel:a,incrementAriaLabel:o,formatDisplay:s=eN,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)(QM,{"aria-label":i,className:`h-7 overflow-hidden rounded-md border border-border/60`,children:[(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e-r),disabled:e<=t,"aria-label":a,className:tN,children:(0,y.jsx)(xd,{})}),(0,y.jsx)($M,{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:nN,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=rN[i.key];a!==void 0&&(i.preventDefault(),c(e+a*r))},children:s(e)}),(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-xs`,onClick:()=>c(e+r),disabled:e>=n,"aria-label":o,className:tN,children:(0,y.jsx)(Td,{})})]})},aN=b.createContext(null),oN=b.createContext(null);function sN(){let e=b.useContext(aN);if(e===null)throw Error(r_(60));return e}function cN(){let e=b.useContext(oN);if(e===null)throw Error(r_(61));return e}var lN=(e,t)=>Object.is(e,t);function uN(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function dN(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:uN(t,e,n))}function fN(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:uN(e,t,n))}function pN(e,t,n){return e.filter(e=>!uN(t,e,n))}function mN(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function hN(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function gN(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(hN(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 _N(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 mN(e)}function vN(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?mN(e.value):mN(e)}function yN(e,t,n){function r(){return _N(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=hN(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 bN(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,y.jsx)(b.Fragment,{children:yN(r,t,n)},i)),e),[])}var xN={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:vN(t,r)!==``}),hasNullItemLabel:Q((e,t)=>t?gN(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=>uN(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:uN(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 SN(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function CN(e,t){return Math.max(0,e-t)}function wN(e,t){if(t<=0)return 0;let n=SN(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 TN(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=lN,highlightItemOnHover:T=!0,children:E}=e,{clearErrors:D}=yS(),{setDirty:O,setTouched:k,setFocused:A,shouldValidateOnChange:j,validityData:M,setFilled:N,name:P,disabled:F,validation:I,validationMode:L}=_S(),R=TS({id:t}),z=F||d,ee=P??c,[B,te]=ES({controlled:n,default:x?r??am:r,name:`Select`,state:`value`}),[V,H]=ES({controlled:a,default:o,name:`Select`,state:`open`}),ne=b.useRef([]),U=b.useRef([]),re=b.useRef(null),W=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}=qy(V),{openMethod:he,triggerProps:ge}=Gb(V),_e=Jp(()=>new Uy({id:R,labelId:void 0,modal:m,multiple:x,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,value:B,open:V,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=zy(_e,xN.activeIndex),ye=zy(_e,xN.selectedIndex),be=zy(_e,xN.triggerElement),xe=zy(_e,xN.positionerElement),Se=HA(he),Ce=he??Se,we=b.useMemo(()=>x&&Array.isArray(B)&&B.length===0?``:vN(B,C),[x,B,C]),Te=b.useMemo(()=>x&&Array.isArray(B)?B.map(e=>vN(e,C)):vN(B,C),[x,B,C]);DS(Xm(_e.state.triggerElement),{id:R,value:B,getValue:Z(()=>Te)});let Ee=b.useRef(B);X(()=>{B!==Ee.current&&_e.set(`forceMount`,!0)},[_e,B]),X(()=>{N(x?Array.isArray(B)&&B.length>0:B!=null)},[x,B,N]),X(function(){if(V)return;let e=oe.current;if(x){let t=Array.isArray(B)?B:[];if(t.length===0){_e.set(`selectedIndex`,null);return}let n=t[t.length-1],r=fN(e,n,w);_e.set(`selectedIndex`,r===-1?null:r);return}let t=fN(e,B,w);_e.set(`selectedIndex`,t===-1?null:t)},[x,V,B,oe,w,_e]),Wb(B,()=>{D(ee),O(B!==M.initialValue),j()?I.commit(B):I.commit(B,!0)});let De=Z((e,t)=>{if(s?.(e,t),!t.isCanceled&&(H(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(k(!0),A(!1),L===`onBlur`&&I.commit(B)),!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)});$y({enabled:!h,open:V,ref:re,onComplete(){V||Oe()}}),b.useImperativeHandle(h,()=>({unmount:Oe}),[Oe]);let ke=Z((e,t)=>{i?.(e,t),!t.isCanceled&&te(e)}),Ae=Z(()=>{let e=_e.state.listElement||re.current;if(!e)return;let t=CN(e.scrollHeight,e.clientHeight),n=wN(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=lb({open:V,onOpenChange:De,elements:{reference:be,floating:xe}}),{getReferenceProps:Me,getFloatingProps:Ne,getItemProps:Pe}=Sb([cv(je,{enabled:!f&&!z,event:`mousedown`}),hv(je,{bubbles:!1}),jb(je,{enabled:!f&&!z,listRef:ne,activeIndex:ve,selectedIndex:ye,disabledIndices:am,onNavigate(e){e===null&&!V||_e.set(`activeIndex`,e)},focusItemOnHover:T}),Pb(je,{enabled:!f&&!z&&(V||!x),listRef:U,activeIndex:ve,selectedIndex:ye,onMatch(e){V?_e.set(`activeIndex`,e):ke(oe.current[e],zm(`none`))},onTypingChange(e){se.current=e}})]),Fe=b.useMemo(()=>f_(Me(),ge,R?{id:R}:om),[Me,ge,R]);op(()=>{_e.update({popupProps:Ne(),triggerProps:Fe})}),X(()=>{_e.update({id:R,modal:m,multiple:x,value:B,open:V,mounted:fe,transitionStatus:me,popupProps:Ne(),triggerProps:Fe,items:v,itemToStringLabel:S,itemToStringValue:C,isItemEqualToValue:w,openMethod:Ce})},[_e,R,m,x,B,V,fe,me,Ne,Fe,v,S,C,w,Ce]);let Ie=b.useMemo(()=>({store:_e,name:ee,required:p,disabled:z,readOnly:f,multiple:x,highlightItemOnHover:T,setValue:ke,setOpen:De,listRef:ne,popupRef:re,scrollHandlerRef:W,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,ee,p,z,f,x,T,ke,De,Pe,je.context.events,I,_,Ae]),Le=Wm(g,I.inputRef),Re=x&&Array.isArray(B)&&B.length>0,ze=x?void 0:ee,Be=b.useMemo(()=>!x||!Array.isArray(B)||!ee?null:B.map(e=>{let t=vN(e,C);return(0,y.jsx)(`input`,{type:`hidden`,form:l,name:ee,value:t},t)}),[x,B,l,ee,C]);return(0,y.jsx)(aN.Provider,{value:Ie,children:(0,y.jsxs)(oN.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=zm(Em,e.nativeEvent);function r(){if(x)return;let e=oe.current.find(e=>vN(e,C).toLowerCase()===t.toLowerCase()||_N(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:ee?ih:rh,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Be]})})}function EN(e,t){return e??t}function DN(e){let t=e.getBoundingClientRect(),n=lp(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 ON=2,kN=400,AN=200,jN={...cx,...hS,value:()=>null},MN=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}=_S(),{labelId:m}=xS(),{store:h,setOpen:g,selectionRef:_,validation:v,readOnly:y,required:x,alignItemWithTriggerActiveRef:S,disabled:C,keyboardActiveRef:w}=sN(),T=p||C||a,E=zy(h,xN.open),D=zy(h,xN.value),O=zy(h,xN.triggerProps),k=zy(h,xN.positionerElement),A=zy(h,xN.listElement),j=zy(h,xN.id),M=zy(h,xN.labelId),N=zy(h,xN.hasSelectedValue),P=!N&&E,F=zy(h,xN.hasNullItemLabel,P),I=i??j,L=EN(m,M);TS({id:I});let R=Xm(k),z=b.useRef(null),{getButtonProps:ee,buttonRef:B}=hx({disabled:T,native:o}),te=Wm(t,z,B,Z(e=>{h.set(`triggerElement`,e)})),V=$p(),H=$p(),ne=$p(),U=$p();b.useEffect(()=>{if(E)return N||F?U.start(AN,()=>{_.current.allowUnselectedMouseUp=!0,ne.start(AN,()=>{_.current.allowSelectedMouseUp=!0})}):ne.start(kN,()=>{_.current.allowUnselectedMouseUp=!0,_.current.allowSelectedMouseUp=!0}),()=>{ne.clear(),U.clear()};_.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},H.clear()},[E,N,F,_,H,ne,U]);let re=b.useMemo(()=>A?.id??Sh(k)?.id,[A,k]),W=f_(O,{id:I,role:`combobox`,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?re:void 0,"aria-labelledby":L,"aria-readonly":y||void 0,"aria-required":x||void 0,tabIndex:T?-1:0,ref:te,onFocus(e){u(!0),E&&S.current&&g(!1,zm(Em,e.nativeEvent)),V.start(0,()=>{h.set(`forceMount`,!0)})},onBlur(e){ph(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=Kp(e.currentTarget);function n(e){if(!z.current)return;let t=e.target;if(ph(z.current,t)||ph(R.current,t)||t===z.current)return;let n=DN(z.current);e.clientX>=n.left-ON&&e.clientX<=n.right+ON&&e.clientY>=n.top-ON&&e.clientY<=n.bottom+ON||g(!1,zm(Fm,e))}H.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},v.getValidationProps,c,ee);W.role=`combobox`;let ie={...f,open:E,disabled:T,value:D,readOnly:y,placeholder:!N};return E_(`button`,e,{ref:[t,z],state:ie,stateAttributesMapping:jN,props:W})}),NN={value:()=>null},PN=b.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:c,valueRef:l}=sN(),u=zy(c,xN.value),d=zy(c,xN.items),f=zy(c,xN.itemToStringLabel),p=zy(c,xN.hasSelectedValue),m=!p&&a!=null&&i==null,h=zy(c,xN.hasNullItemLabel,m),g={value:u,placeholder:!p},_=null;return _=typeof i==`function`?i(u):i??(!p&&a!=null&&!h?a:Array.isArray(u)?bN(u,d,f):yN(u,d,f)),E_(`span`,e,{state:g,ref:[t,l],props:[{children:_},s],stateAttributesMapping:NN})}),FN=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o}=sN();return E_(`span`,e,{state:{open:zy(o,xN.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:sx})}),IN=b.createContext(void 0),LN=b.forwardRef(function(e,t){let{store:n}=sN(),r=zy(n,xN.mounted),i=zy(n,xN.forceMount);return r||i?(0,y.jsx)(IN.Provider,{value:!0,children:(0,y.jsx)(H_,{ref:t,...e})}):null}),RN=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function zN(){return b.useContext(RN)}function BN(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,a=Z(i),o=b.useRef(0),s=Jp(HN).current,c=Jp(VN).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(UN).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)(RN.Provider,{value:g,children:t})}function VN(){return new Map}function HN(){return new Set}function UN(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 WN=b.createContext(void 0);function GN(){let e=b.useContext(WN);if(!e)throw Error(r_(59));return e}function KN(e,t){e&&Object.assign(e.style,t)}var qN={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`},JN={position:`fixed`},YN=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=P_,style:_,...v}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=sN(),A=cN(),j=zy(x,xN.open),M=zy(x,xN.mounted),N=zy(x,xN.modal),P=zy(x,xN.value),F=zy(x,xN.openMethod),I=zy(x,xN.positionerElement),L=zy(x,xN.triggerElement),R=zy(x,xN.isItemEqualToValue),z=zy(x,xN.transitionStatus),ee=b.useRef(null),B=b.useRef(null),[te,V]=b.useState(h),H=M&&te&&F!==`touch`;!M&&te!==h&&V(h),X(()=>{M||(xN.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),xN.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),b.useImperativeHandle(w,()=>H),NA((H||N)&&j,F===`touch`,I,L);let ne=OA({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??H,collisionAvoidance:g,keepMounted:!0}),U=H?`none`:ne.side,re=H?JN:ne.positionerStyles,W=jA(e,{open:j,side:U,align:ne.align,anchorHidden:ne.anchorHidden},{styles:re,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=zm(Em);if(t!==0&&!x.state.multiple&&P!==null&&fN(E.current,P,R)===-1){let e=D.current,t=e!=null&&fN(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=>fN(E.current,e,R)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!dN(P,e,R)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&H){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};KN(I,e),KN(O.current,e)}}),oe=b.useMemo(()=>({...ne,side:U,alignItemWithTriggerActive:H,setControlledAlignItemWithTrigger:V,scrollUpArrowRef:ee,scrollDownArrowRef:B}),[ne,U,H,V]);return(0,y.jsx)(BN,{elementsRef:S,labelsRef:C,onMapChange:ae,children:(0,y.jsxs)(WN.Provider,{value:oe,children:[M&&N&&(0,y.jsx)(Ix,{inert:Fx(!j),cutout:L}),W]})})}),XN=`base-ui-disable-scrollbar`,ZN={className:XN,getElement(e){return(0,y.jsx)(`style`,{nonce:e,href:XN,precedence:`base-ui:low`,children:`.${XN}{scrollbar-width:none}.${XN}::-webkit-scrollbar{display:none}`})}},QN=b.createContext(void 0),$N={disableStyleElements:!1};function eP(){return b.useContext(QN)??$N}var tP={...lx,...Zy},nP=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}=sN(),{side:x,align:S,alignItemWithTriggerActive:C,isPositioned:w,setControlledAlignItemWithTrigger:T,scrollDownArrowRef:E,scrollUpArrowRef:D}=GN(),O=IA(!0)!=null,k=cN(),A=bA(),{nonce:j,disableStyleElements:M}=eP(),N=zy(s,xN.id),P=zy(s,xN.open),F=zy(s,xN.mounted),I=zy(s,xN.popupProps),L=zy(s,xN.transitionStatus),R=zy(s,xN.triggerElement),z=zy(s,xN.positionerElement),ee=zy(s,xN.listElement),B=b.useRef(!1),te=b.useRef(!1),V=b.useRef({}),H=rm(),ne=Z(e=>{if(!z||!c.current||!te.current)return;if(B.current||!C){h();return}let t=z.style.top===`0px`,n=z.style.bottom===`0px`;if(!t&&!n){h();return}let r=aP(z),i=oP(z.getBoundingClientRect().height,`y`,r),a=Kp(z),o=getComputedStyle(z),s=parseFloat(o.marginTop),l=parseFloat(o.marginBottom),u=rP(getComputedStyle(c.current)),d=Math.min(a.documentElement.clientHeight-s-l,u),f=e.scrollTop,p=iP(e),m=0,g=null,_=!1,v=!1,y=e=>{z.style.height=`${e}px`},b=(t,n)=>{let r=SN(t,0,d-i);r>0&&y(i+r),e.scrollTop=n,d-(i+r)<=1&&(B.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=iP(e),n=v?t:SN(g,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(_||m>=d-1)&&(B.current=!0),h()});b.useImperativeHandle(g,()=>ne,[ne]),$y({open:P,ref:c,onComplete(){P&&l?.(!0)}});let U={open:P,transitionStatus:L,side:x,align:S};X(()=>{!z||!c.current||Object.keys(V.current).length||(V.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||(te.current=!1,B.current=!1,KN(z,V.current))},[P,C,z,c]),X(()=>{let e=c.current;if(!P||!R||!z||!e||C&&!w||s.state.transitionStatus===`ending`)return;if(!C){te.current=!0,H.request(h),e.style.removeProperty(`--transform-origin`);return}let t=lP(e);e.style.removeProperty(`--transform-origin`);try{let t=f.current,n=d.current,r=getComputedStyle(z),i=getComputedStyle(e),a=Kp(R),o=lp(z),c=aP(R),l=sP(R.getBoundingClientRect(),c),u=sP(z.getBoundingClientRect(),c),p=l.height,m=ee||e,g=m.scrollHeight,y=parseFloat(i.borderBottomWidth),b=parseFloat(r.marginTop)||10,x=parseFloat(r.marginBottom)||10,S=parseFloat(r.minHeight)||100,C=rP(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=sP(n.getBoundingClientRect(),c);O=sP(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=`${SN(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=iP(m),H=F>=L-1;H&&(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&&Lp;if(ne||U){te.current=!0,KN(z,V.current),T(!1);return}let re=Math.max(S,N);if(H){let e=Math.max(0,w-M);z.style.top=u.height>=P?`0`:`${e}px`,z.style.height=`${N}px`,m.scrollTop=iP(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=SN(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(re===w||N>=C)&&(B.current=!0),h(),v&&s.state.selectedIndex===null&&s.state.activeIndex===null&&_.current[0]!=null&&s.set(`activeIndex`,0),te.current=!0}finally{t()}},[s,P,z,R,d,f,c,h,C,T,H,E,D,ee,_,v,A,w]),b.useEffect(()=>{if(!C||!z||!P)return;let e=lp(z);function t(e){u(!1,zm(Rm,e))}return Mp(e,`resize`,t)},[u,C,z,P]);let re={...ee?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":m||void 0,id:`${N}-list`},onKeyDown(e){p.current=!0,O&&Mx.has(e.key)&&e.stopPropagation()},onMouseMove(){p.current=!1},onScroll(e){ee||ne(e.currentTarget)},...C&&{style:ee?{height:`100%`}:qN}},W=E_(`div`,e,{ref:[t,c],state:U,stateAttributesMapping:tP,props:[I,re,AA(L),{className:!ee&&C?ZN.className:void 0},o]});return(0,y.jsxs)(b.Fragment,{children:[!M&&ZN.getElement(j),(0,y.jsx)(sv,{context:k,modal:!1,disabled:!F,returnFocus:a,restoreFocus:!0,children:W})]})});function rP(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function iP(e){return CN(e.scrollHeight,e.clientHeight)}function aP(e){return ny.getScale(e)}function oP(e,t,n){return e/n[t]}function sP(e,t){return Xh({x:oP(e.x,`x`,t),y:oP(e.y,`y`,t),width:oP(e.width,`x`,t),height:oP(e.height,`y`,t)})}var cP=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function lP(e){let{style:t}=e,n={};for(let[e,r]of cP)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of cP){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var uP=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=sN(),{alignItemWithTriggerActive:c}=GN(),l=zy(o,xN.hasScrollArrows),u=zy(o,xN.openMethod),d=zy(o,xN.multiple),f={id:`${zy(o,xN.id)}-list`,role:`listbox`,"aria-multiselectable":d||void 0,onScroll(e){s.current?.(e.currentTarget)},...c&&{style:qN},className:l&&u!==`touch`?ZN.className:void 0};return E_(`div`,e,{ref:[t,Z(e=>{o.set(`listElement`,e)})],props:[f,a]})}),dP=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function fP(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}=zN(),f=b.useRef(-1),[p,m]=b.useState(a??(i===dP.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 pP=b.createContext(void 0);function mP(){let e=b.useContext(pP);if(!e)throw Error(r_(57));return e}var hP=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=fP({label:a,textRef:u,indexGuessBehavior:dP.GuessFromOrder}),{store:f,getItemProps:p,setOpen:m,setValue:h,selectionRef:g,typingRef:_,valuesRef:v,multiple:x,selectedItemTextRef:S}=sN(),C=zy(f,xN.isActive,d.index),w=zy(f,xN.isSelected,d.index,i),T=zy(f,xN.isSelectedByFocus,d.index),E=zy(f,xN.isItemEqualToValue),D=d.index,O=D!==-1,k=b.useRef(null),A=Xm(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&&uN(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}=hx({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?pN(n,i,E):[...n,i],zm(jm,e))}else h(i,zm(jm,e)),m(!1,zm(jm,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()}},ee=E_(`div`,e,{ref:[L,t,d.ref,k],state:j,props:[M,z,l,I]}),B=b.useMemo(()=>({selected:w,indexRef:A,textRef:u,selectedByFocus:T,hasRegistered:O}),[w,A,u,T,O]);return(0,y.jsx)(pP.Provider,{value:B,children:ee})})),gP=b.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=mP();return n||r?(0,y.jsx)(_P,{...e,ref:t}):null}),_P=b.memo(b.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=mP(),c=b.useRef(null),{transitionStatus:l,setMounted:u}=qy(s),d=E_(`span`,e,{ref:[t,c],state:{selected:s,transitionStatus:l},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:Zy});return $y({open:s,ref:c,onComplete(){s||u(!1)}}),d})),vP=b.memo(b.forwardRef(function(e,t){let{indexRef:n,textRef:r,selectedByFocus:i,hasRegistered:a}=mP(),{selectedItemTextRef:o}=sN(),{className:s,render:c,style:l,...u}=e;return E_(`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})})),yP=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}=sN(),{side:m,scrollDownArrowRef:h,scrollUpArrowRef:g}=GN(),_=zy(l,c?xN.scrollUpArrowVisible:xN.scrollDownArrowVisible),v=zy(l,xN.openMethod),y=_&&v!==`touch`,b=$p(),x=c?g:h,{transitionStatus:S,setMounted:C}=qy(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]),$y({open:y,ref:x,onComplete(){y||C(!1)}});let w=E_(`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=CN(e.scrollHeight,e.clientHeight),r=wN(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=bP(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 bP(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?wN(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?wN(l.offsetTop+l.offsetHeight-r+i,a):a}var xP=b.forwardRef(function(e,t){return(0,y.jsx)(yP,{...e,ref:t,direction:`down`})}),SP=b.forwardRef(function(e,t){return(0,y.jsx)(yP,{...e,ref:t,direction:`up`})}),CP=TN;function wP({className:e,...t}){return(0,y.jsx)(PN,{"data-slot":`select-value`,className:ap(`flex flex-1 text-left`,e),...t})}function TP({className:e,size:t=`default`,children:n,...r}){return(0,y.jsxs)(MN,{"data-slot":`select-trigger`,"data-size":t,className:ap(`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)(FN,{render:(0,y.jsx)(pd,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function EP({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)(LN,{children:(0,y.jsx)(YN,{side:r,sideOffset:i,align:a,alignOffset:o,alignItemWithTrigger:s,className:`isolate z-50`,children:(0,y.jsxs)(nP,{"data-slot":`select-content`,"data-align-trigger":s,className:ap(`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)(OP,{}),(0,y.jsx)(uP,{children:t}),(0,y.jsx)(kP,{}),n]})})})}function DP({className:e,children:t,...n}){return(0,y.jsxs)(hP,{"data-slot":`select-item`,className:ap(`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)(vP,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,y.jsx)(gP,{render:(0,y.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,y.jsx)(fd,{className:`pointer-events-none`})})]})}function OP({className:e,...t}){return(0,y.jsx)(SP,{"data-slot":`select-scroll-up-button`,className:ap(`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)(md,{})})}function kP({className:e,...t}){return(0,y.jsx)(xP,{"data-slot":`select-scroll-down-button`,className:ap(`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)(pd,{})})}var AP=`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`,jP=`max-h-72 w-(--anchor-width) origin-(--transform-origin) gap-0 overflow-x-hidden p-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,MP=`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`,NP=({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)(CP,{value:e,onValueChange:i,open:a,onOpenChange:o,children:[(0,y.jsx)(TP,{size:`sm`,"aria-label":n,className:ap(AP,`w-full`,c),style:f,children:(0,y.jsx)(wP,{placeholder:r,children:()=>d?.label||r})}),(0,y.jsx)(EP,{alignItemWithTrigger:!1,sideOffset:4,className:ap(jP,zx,Bx),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)(DP,{value:e.id,className:MP,style:e.itemStyle,onPointerEnter:s?()=>s(e.id):void 0,onFocus:s?()=>s(e.id):void 0,children:e.label},e.id))})]})};function PP(e){let{open:t,defaultOpen:n,onOpenChange:r,disabled:i}=e,a=t!==void 0,[o,s]=ES({controlled:t,default:n,name:`Collapsible`,state:`open`}),{mounted:c,setMounted:l,transitionStatus:u}=qy(o,!0,!0),[d,f]=b.useState(o),[{height:p,width:m},h]=b.useState({height:void 0,width:void 0}),g=vx(),[_,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=Qy(O,!1),A=Z(e=>{let t=!o,n=zm(Dm,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 FP=b.createContext(void 0);function IP(){let e=b.useContext(FP);if(e===void 0)throw Error(r_(15));return e}var LP=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=Jy.startingStyle]=`startingStyle`,e[e.endingStyle=Jy.endingStyle]=`endingStyle`,e}({}),RP=function(e){return e.panelOpen=`data-panel-open`,e}({}),zP={[LP.open]:``},BP={[LP.closed]:``},VP={open(e){return e?{[RP.panelOpen]:``}:null}},HP={open(e){return e?zP:BP},...Zy},UP=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=PP({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=E_(`div`,e,{state:f,ref:t,props:l,stateAttributesMapping:HP});return(0,y.jsx)(FP.Provider,{value:p,children:m})}),WP={...VP,...Zy},GP=b.forwardRef(function(e,t){let{panelId:n,open:r,handleTrigger:i,state:a,disabled:o}=IP(),{className:s,disabled:c=o,id:l,render:u,nativeButton:d=!0,style:f,...p}=e,{getButtonProps:m,buttonRef:h}=hx({disabled:c,focusableWhenDisabled:!0,native:d}),g=b.useMemo(()=>({"aria-controls":r?n:void 0,"aria-expanded":r,onClick:i}),[n,r,i]);return E_(`button`,e,{state:a,ref:[t,h],props:[g,p,m],stateAttributesMapping:WP})}),KP=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e}({});function qP(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=rm(),E=b.useMemo(()=>n.current===`css-animation`?!v:!u&&!c,[u,c,v,n]),D=Wm(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(KP.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=nm.request(()=>{w.current=!1,r=nm.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})}),()=>{nm.cancel(t),nm.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(LP.startingStyle,``),p({height:e.scrollHeight,width:e.scrollWidth}),r=nm.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=LP.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()=>{nm.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]),Xp(()=>{let e=nm.request(()=>{C.current=!1});return()=>nm.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=nm.request(()=>{x.current=!1,n=nm.request(()=>{setTimeout(()=>{e.style.removeProperty(`transition-duration`)})})})),()=>{nm.cancel(t),nm.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(LP.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,zm(Em,e))}return Mp(e,`beforematch`,t)},[l,d,h]),b.useMemo(()=>({props:{hidden:E,id:s,ref:D}}),[E,s,D])}var JP=function(e){return e.collapsiblePanelHeight=`--collapsible-panel-height`,e.collapsiblePanelWidth=`--collapsible-panel-width`,e}({}),YP=b.forwardRef(function(e,t){let{className:n,hiddenUntilFound:r,keepMounted:i,render:a,id:o,style:s,...c}=e,{abortControllerRef:l,animationTypeRef:u,height:d,mounted:f,onOpenChange:p,open:m,panelId:h,panelRef:g,runOnceAnimationsFinish:_,setDimensions:v,setHiddenUntilFound:y,setKeepMounted:x,setMounted:S,setPanelIdState:C,setOpen:w,setVisible:T,state:E,transitionDimensionRef:D,visible:O,width:k,transitionStatus:A}=IP(),j=r??!1,M=i??!1;X(()=>{if(o)return C(o),()=>{C(void 0)}},[o,C]),X(()=>{y(j)},[y,j]),X(()=>{x(M)},[x,M]);let{props:N}=qP({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});$y({open:m&&A===`idle`,ref:g,onComplete(){m&&v({height:void 0,width:void 0})}});let P=E_(`div`,e,{state:b.useMemo(()=>({...E,transitionStatus:A}),[E,A]),ref:[t,g],props:[N,{style:{[JP.collapsiblePanelHeight]:d===void 0?`auto`:`${d}px`,[JP.collapsiblePanelWidth]:k===void 0?`auto`:`${k}px`}},c],stateAttributesMapping:HP});return M||j||f?P:null});function XP({...e}){return(0,y.jsx)(UP,{"data-slot":`collapsible`,...e})}function ZP({...e}){return(0,y.jsx)(GP,{"data-slot":`collapsible-trigger`,...e})}function QP({...e}){return(0,y.jsx)(YP,{"data-slot":`collapsible-content`,...e})}function $P({className:e,...t}){return(0,y.jsx)(`label`,{"data-slot":`label`,className:ap(`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 eF({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`field-group`,className:ap(`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 tF=Xx(`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 nF({className:e,orientation:t=`vertical`,...n}){return(0,y.jsx)(`div`,{role:`group`,"data-slot":`field`,"data-orientation":t,className:ap(tF({orientation:t}),e),...n})}function rF({className:e,...t}){return(0,y.jsx)($P,{"data-slot":`field-label`,className:ap(`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 iF=b.createContext(void 0);function aF(e){let t=b.useContext(iF);if(t===void 0&&!e)throw Error(r_(72));return t}var oF={...cb,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)},sF=class e extends Wy{constructor(e){super({...cF(),...e},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new ib},oF)}setOpen=(e,t)=>{let n=t.reason,r=n===Om,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?L_.flushSync(o):o()};static useStore(t,n){let r=Jp(()=>new e(n)).current,i=t??r,a=db({popupStore:i,onOpenChange:i.setOpen});return i.state.floatingRootContext=a,i}};function cF(){return{...ob(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:`none`,disableHoverablePopup:!1,openChangeReason:null,closeOnClick:!0,closeDelay:0,hasViewport:!1}}var lF=Ny(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=sF.useStore(l?.store,{open:n,openProp:r,activeTriggerId:d,triggerIdProp:u});op(()=>{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,zm(Im))},[m,t,p]),p.useSyncedValue(`disabled`,t),nb(p);let{forceUnmount:v,transitionStatus:x}=rb(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,zm(Lm))},[p]);b.useImperativeHandle(o,()=>({unmount:v,close:D}),[v,D]);let{getReferenceProps:O,getFloatingProps:k,getTriggerProps:A}=Sb([hv(S,{enabled:!t,referencePress:()=>p.select(`closeOnClick`)}),dv(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)(iF.Provider,{value:p,children:typeof f==`function`?f({payload:_}):f})}),uF=b.createContext(void 0);function dF(){return b.useContext(uF)}var fF=function(e){return e[e.popupOpen=tx.popupOpen]=`popupOpen`,e.triggerDisabled=`data-trigger-disabled`,e}({}),pF=Py(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=aF(!0),m=i?.store??p;if(!m)throw Error(r_(82));let h=vx(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}=tb(h,y,m,{payload:a,closeOnClick:c,closeDelay:S}),T=dF(),{delayRef:E,isInstantPhase:D,hasProvider:O}=Hm(v,{open:_});m.useSyncedValue(`isInstantPhase`,D);let k=m.useState(`disabled`),A=o??k,j=m.useState(`trackCursorAxis`),M=m.useState(`disableHoverablePopup`),N=xb(v,{enabled:!A,mouseOnly:!0,move:!1,handleClose:!M&&j!==`both`?Hb():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=pb(v,{enabled:!A}).reference,F={open:_},I=m.useState(`triggerProps`,w);return E_(`button`,e,{state:F,ref:[t,C,y],props:[N,P,I,{onPointerDown(){m.set(`closeOnClick`,c)},id:h,[fF.triggerDisabled]:A?``:void 0},f],stateAttributesMapping:sx})}),mF=b.createContext(void 0);function hF(){let e=b.useContext(mF);if(e===void 0)throw Error(r_(70));return e}var gF=b.forwardRef(function(e,t){let{children:n,container:r,className:i,render:a,style:o,...s}=e,{portalNode:c,portalSubtree:l}=V_({container:r,ref:t,componentProps:e,elementProps:s});return!l&&!c?null:(0,y.jsxs)(b.Fragment,{children:[l,c&&L_.createPortal(n,c)]})}),_F=b.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e;return aF().useState(`mounted`)||n?(0,y.jsx)(mF.Provider,{value:n,children:(0,y.jsx)(gF,{ref:t,...r})}):null}),vF=b.createContext(void 0);function yF(){let e=b.useContext(vF);if(e===void 0)throw Error(r_(71));return e}var bF=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=F_,style:g,..._}=e,v=aF(),x=hF(),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=OA({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`)?TA:void 0}),A=jA(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)(vF.Provider,{value:k,children:A})}),xF={...lx,...Zy},SF=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=aF(),{side:s,align:c}=yF(),l=o.useState(`open`),u=o.useState(`instantType`),d=o.useState(`transitionStatus`),f=o.useState(`popupProps`),p=o.useState(`floatingRootContext`);$y({open:l,ref:o.context.popupRef,onComplete(){l&&o.context.onOpenChangeComplete?.(!0)}});let m=o.useState(`disabled`),h=o.useState(`closeDelay`);return yb(p,{enabled:!m,closeDelay:h}),E_(`div`,e,{state:{open:l,side:s,align:c,instant:u,transitionStatus:d},ref:[t,o.context.popupRef,o.useStateSetter(`popupElement`)],props:[f,AA(d),a],stateAttributesMapping:xF})}),CF=b.forwardRef(function(e,t){let{className:n,render:r,style:i,...a}=e,o=aF(),s=o.useState(`open`),c=o.useState(`instantType`),{arrowRef:l,side:u,align:d,arrowUncentered:f,arrowStyles:p}=yF();return E_(`div`,e,{state:{open:s,side:u,align:d,uncentered:f,instant:c},ref:[t,l],props:[{style:p,"aria-hidden":!0},a],stateAttributesMapping:lx})}),wF=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)(uF.Provider,{value:i,children:(0,y.jsx)(Vm,{delay:a,timeoutMs:r,children:e.children})})};function TF({delay:e=0,...t}){return(0,y.jsx)(wF,{"data-slot":`tooltip-provider`,delay:e,...t})}function EF({...e}){return(0,y.jsx)(lF,{"data-slot":`tooltip`,...e})}function DF({...e}){return(0,y.jsx)(pF,{"data-slot":`tooltip-trigger`,...e})}function OF({className:e,side:t=`top`,sideOffset:n=4,align:r=`center`,alignOffset:i=0,children:a,...o}){return(0,y.jsx)(_F,{children:(0,y.jsx)(bF,{align:r,alignOffset:i,side:t,sideOffset:n,className:`isolate z-50`,children:(0,y.jsxs)(SF,{"data-slot":`tooltip-content`,className:ap(`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)(CF,{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 kF=[{id:`block`,name:`Block`},{id:`bar`,name:`Bar`},{id:`underline`,name:`Underline`}],AF=`block`,jF=kF.map(e=>e.id),MF=e=>typeof e==`string`&&jF.includes(e),NF=e=>e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`),PF=`ui-monospace, SFMono-Regular, Menlo, Consolas, monospace`,FF=`"Symbols Nerd Font"`,IF=(e,t)=>`"${NF(e)}"${t?`, ${FF}`:``}, ${PF}`,LF=(e,t,n)=>({id:e,name:t,family:IF(t,!0),source:n}),RF=LF(`geist-mono`,`Geist Mono`,`fontsource`),zF=LF(`jetbrains-mono`,`JetBrains Mono`,`google`),BF=LF(`fira-code`,`Fira Code`,`google`),VF=LF(`ibm-plex-mono`,`IBM Plex Mono`,`google`),HF=LF(`source-code-pro`,`Source Code Pro`,`google`),UF=LF(`roboto-mono`,`Roboto Mono`,`google`),WF=LF(`dm-mono`,`DM Mono`,`google`),GF=LF(`inconsolata`,`Inconsolata`,`google`),KF=LF(`space-mono`,`Space Mono`,`google`),qF=LF(`ubuntu-mono`,`Ubuntu Mono`,`google`),JF=[RF,LF(`anonymous-pro`,`Anonymous Pro`,`google`),WF,BF,VF,GF,zF,UF,HF,KF,qF];RF.id;var YF=e=>e?JF.find(t=>t.id===e)??RF:RF,XF=(e,t)=>IF(e.name,t),ZF=()=>{let e=JF.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`},QF=[{value:1e3,label:`1k lines`},{value:1e4,label:`10k lines`},{value:5e4,label:`50k lines`},{value:1e5,label:`100k lines`}],$F=1e4,eI=QF.map(e=>e.value),tI=e=>eI.includes(e),nI={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`}},rI=[nI,{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`}}];nI.id;var iI=e=>e?rI.find(t=>t.id===e)??nI:nI,aI=`text-[10px] font-medium tracking-wide text-muted-foreground/70 uppercase`,oI=`text-xs font-normal text-muted-foreground`,sI=Object.fromEntries(JF.map(e=>[e.id,{fontFamily:e.family}])),cI=rI.map(e=>({id:e.id,label:e.name})),lI=JF.map(e=>({id:e.id,label:e.name,itemStyle:sI[e.id]})),uI=kF.map(e=>({id:e.id,label:e.name})),dI=QF.map(e=>({id:String(e.value),label:e.label})),fI=e=>e.toFixed(1),pI=({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:oI,children:e}),(0,y.jsx)(`dd`,{title:n??t,className:ap(`min-w-0 truncate text-right text-foreground/90`,r),children:t})]}),mI=({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)(UA,{open:M,onOpenChange:e=>{N(e),A?.(e),e||(F(!1),n?.(null),a?.(null),v?.(null),j?.())},children:[(0,y.jsx)(WA,{render:(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-sm`,"aria-label":`terminal settings`,className:`hover:text-foreground`}),children:(0,y.jsx)(kd,{})}),(0,y.jsx)(GA,{ref:I,side:`bottom`,align:`end`,sideOffset:8,className:ap(`w-64 gap-0 overflow-hidden p-3`,zx,Bx),children:(0,y.jsxs)(eF,{className:`gap-3`,children:[(0,y.jsxs)(nF,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(rF,{className:aI,children:`Theme`}),(0,y.jsx)(NP,{value:e,items:cI,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)(qA,{className:`bg-border/40`}),(0,y.jsxs)(nF,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(rF,{className:aI,children:`Font`}),(0,y.jsx)(NP,{value:r,items:lI,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:oI,children:`Size`}),(0,y.jsx)(iN,{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:oI,children:`Line height`}),(0,y.jsx)(iN,{value:u,min:1,max:2,step:rj,ariaLabel:`terminal line height`,decrementAriaLabel:`decrease line height`,incrementAriaLabel:`increase line height`,formatDisplay:fI,onValueChange:d})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(EF,{children:[(0,y.jsx)(DF,{render:(0,y.jsx)(`span`,{className:oI}),children:`Nerd Font icons`}),(0,y.jsx)(OF,{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)(ej,{"aria-label":`toggle nerd font icons`,checked:o,onCheckedChange:s})]})]}),(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsxs)(nF,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(rF,{className:aI,children:`Window`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:oI,children:`Pad X`}),(0,y.jsx)(iN,{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:oI,children:`Pad Y`}),(0,y.jsx)(iN,{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)(qA,{className:`bg-border/40`}),(0,y.jsxs)(nF,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(rF,{className:aI,children:`Notifications`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(EF,{children:[(0,y.jsx)(DF,{render:(0,y.jsx)(`span`,{className:oI}),children:`Desktop alerts`}),(0,y.jsx)(OF,{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)(ej,{"aria-label":`toggle desktop notifications`,checked:D===`granted`,disabled:D===`unsupported`||D===`denied`,onCheckedChange:e=>{e&&O()}})]})]}),(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsxs)(nF,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(rF,{className:aI,children:`Cursor`}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:oI,children:`Style`}),(0,y.jsx)(NP,{value:g,items:uI,ariaLabel:`select cursor style`,placeholder:`Cursor style`,triggerClassName:`w-fit min-w-[7rem]`,onValueChange:e=>{MF(e)&&_(e)},onOpenChange:e=>{e||v?.(null)},onItemHover:v?e=>{MF(e)&&v?.(e)}:void 0})]}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsx)(`span`,{className:oI,children:`Blink`}),(0,y.jsx)(ej,{"aria-label":`toggle cursor blink`,checked:x,onCheckedChange:S})]})]}),(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsxs)(nF,{orientation:`vertical`,className:`gap-1.5`,children:[(0,y.jsx)(rF,{className:aI,children:`Scrollback`}),(0,y.jsx)(NP,{value:String(C),items:dI,ariaLabel:`select scrollback`,placeholder:`Scrollback`,onValueChange:e=>{if(e===null)return;let t=Number(e);tI(t)&&w(t)}}),(0,y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,y.jsxs)(EF,{children:[(0,y.jsx)(DF,{render:(0,y.jsx)(`span`,{className:oI}),children:`Pin to bottom on input`}),(0,y.jsx)(OF,{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)(ej,{"aria-label":`toggle pin to bottom on input`,checked:T,onCheckedChange:E})]})]}),k?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(qA,{className:`bg-border/40`}),(0,y.jsxs)(XP,{defaultOpen:!1,children:[(0,y.jsx)(ZP,{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:aI,children:`Shell`}),(0,y.jsx)(pd,{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)(QP,{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)(pI,{label:`Name`,value:k.shellName}),(0,y.jsx)(pI,{label:`Path`,value:k.shell,title:k.shell}),(0,y.jsx)(pI,{label:`PID`,value:String(k.pid),valueClassName:`tabular-nums`}),(0,y.jsx)(pI,{label:`Cwd`,value:k.cwd,title:k.cwd})]})})]})]}):null]})})]})},hI=()=>{let[e,t]=(0,b.useState)(null);return{summary:e,setGitDiffSummary:t}},gI=2.4,_I=.04045,vI=12.92,yI=.055,bI=1.055,xI=.0031308,SI=24389/27,CI=216/24389,wI=.95047,TI=1,EI=1.08883,DI=.008856,OI=7.787,kI=e=>{let t=e/255;return t<=_I?t/vI:((t+yI)/bI)**+gI},AI=e=>e<=0?0:e>=1?255:Math.round(e<=xI?vI*e*255:(bI*e**(1/gI)-yI)*255),jI=e=>e>DI?Math.cbrt(e):OI*e+16/116,MI=e=>{let t=kI(e.r),n=kI(e.g),r=kI(e.b);return{x:.4124564*t+.3575761*n+.1804375*r,y:.2126729*t+.7151522*n+.072175*r,z:.0193339*t+.119192*n+.9503041*r}},NI=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:AI(t),g:AI(n),b:AI(r)}},PI=e=>{let t=e.x/wI,n=e.y/TI,r=e.z/EI,i=jI(t),a=jI(n),o=jI(r);return{l:116*a-16,a:500*(i-a),b:200*(a-o)}},FI=(e,t)=>{let n=e*e*e;return n>CI?t*n:t*((116*e-16)/SI)},II=e=>{let t=(e.l+16)/116,n=e.a/500+t,r=t-e.b/200;return{x:FI(n,wI),y:FI(t,TI),z:FI(r,EI)}},LI=e=>PI(MI(e)),RI=e=>NI(II(e)),zI=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)}},BI=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`)}`},VI=e=>LI(zI(e)),HI=e=>BI(RI(e)),UI=6,WI=5,GI=24,KI=25,qI=(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)}),JI=(e,t=!1)=>{let n=e.background??`#000000`,r=e.foreground??`#ffffff`,i=[VI(n),VI(e.red??`#ff0000`),VI(e.green??`#00ff00`),VI(e.yellow??`#ffff00`),VI(e.blue??`#0000ff`),VI(e.magenta??`#ff00ff`),VI(e.cyan??`#00ffff`),VI(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<UI;e++){let t=qI(e/WI,i[0],i[1]),n=qI(e/WI,i[2],i[3]),r=qI(e/WI,i[4],i[5]),o=qI(e/WI,i[6],i[7]);for(let e=0;e<UI;e++){let i=qI(e/WI,t,n),s=qI(e/WI,r,o);for(let e=0;e<UI;e++){let t=qI(e/WI,i,s);a.push(HI(t))}}}for(let e=0;e<GI;e++){let t=(e+1)/KI;a.push(HI(qI(t,i[0],i[7])))}return a},YI=`Symbols Nerd Font`,XI=``,ZI=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 "${YI}"`,XI),document.fonts.load(`bold 16px "${YI}"`,XI)];await Promise.all(t)}catch{}},QI=(e,t)=>`\x1b[${e};${t+1}u`,$I=e=>{let t=e.buffer.active,n=Math.max(0,t.baseY-t.viewportY);return{distanceFromBottom:n,wasAtBottom:n===0}},eL=[[12284,12287],[12783,12783],[110576,110579],[110581,110587],[110589,110590],[110879,110882],[110898,110898],[110933,110933],[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]],tL=e=>{if(e<12284||e>129784)return!1;for(let[t,n]of eL)if(e>=t&&e<=n)return!0;return!1},nL=[[173,173],[1536,1541],[1807,1807],[6849,6862],[7674,7674],[8203,8203],[8206,8207],[8288,8292],[65279,65279],[917504,917535]],rL=173,iL=917535,aL=e=>{if(e<rL||e>iL)return!1;for(let[t,n]of nL)if(e>=t&&e<=n)return!0;return!1},oL=6,sL=4,cL=1,lL=class{version=`15-graphemes-emoji`;base;constructor(e){this.base=e}wcwidth(e){return aL(e)?0:tL(e)?2:this.base.wcwidth(e)}charProperties(e,t){let n=this.base.charProperties(e,t);if(aL(e)){let e=t&oL;return n&~oL|e|cL}return tL(e)?n&~oL|sL:n}},uL=e=>!!e.shiftKey|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0),dL=(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},fL=(e,t)=>`\r\n\r\n\x1b[2;31m[connection lost · code ${e}${t?` · ${t}`:``}]\x1b[0m\r\n`,pL={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`}},mL=(e,t)=>{let n=t?`blink`:`steady`;return`\x1b[?25h${pL[e][n]}`},hL=(e,t)=>`${mL(e,t)}\r\n\x1b[2;32m[reconnected]\x1b[0m\r\n\r\n`,gL=e=>`\r\n\x1b[2;31m[${e===null?`shell exited`:`shell exited with code ${e}`}]\x1b[0m\r\n`,_L=55296,vL=56319,yL=(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>=_L&&t<=vL&&--i}i===r&&(i=r+t),n.push(e.slice(r,i)),r=i}return n},bL=(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)},xL=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?.())}},SL=e=>e[0]===3,CL=e=>{if(!Number.isFinite(e))return 13;let t=Math.round(e);return t<9?9:t>24?24:t},wL=1/rj,TL=e=>Math.round(e*wL)/wL,EL=e=>{if(!Number.isFinite(e))return nj;let t=TL(e);return t<1?1:t>2?2:t},DL=1/1,OL=e=>Math.round(e*DL)/DL,kL=e=>{if(!Number.isFinite(e))return 0;let t=OL(e);return t<0?0:t>48?48:t},AL=e=>{if(!Number.isFinite(e))return 0;let t=OL(e);return t<0?0:t>48?48:t},jL=()=>{if(typeof navigator>`u`)return!1;let e=navigator.platform||navigator.userAgent||``;return/Mac|iPhone|iPad|iPod/i.test(e)},ML=e=>e<1e3?String(e):e<1e4?`${(e/1e3).toFixed(1).replace(/\.0$/,``)}k`:`${Math.round(e/1e3)}k`,NL=(e,t,n)=>e.key!==t&&e.key!==t.toUpperCase()?!1:n?e.metaKey&&!e.ctrlKey&&!e.altKey:e.ctrlKey&&!e.metaKey&&!e.altKey,PL=(e,t)=>NL(e,`j`,t),FL=(e,t)=>NL(e,`k`,t),IL=(e,t)=>NL(e,`g`,t),LL=(e,t)=>NL(e,`f`,t),RL=(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,zL=()=>{let e=new URL(window.location.href);if(e.searchParams.has(`run`)){e.searchParams.delete(`run`);try{window.history.replaceState(null,``,e)}catch{}}},BL=DM(Sj,!0),VL=BL.load,HL=BL.store,UL=OM(xj,AF,MF),WL=UL.load,GL=UL.store,KL=kM(vj,e=>YF(e).id,e=>e),qL=KL.load,JL=KL.store,YL=EM(yj,13,CL),XL=YL.load,ZL=YL.store,QL=EM(bj,nj,EL),$L=QL.load,eR=QL.store,tR=EM(Cj,$F,e=>tI(e)?e:$F),nR=tR.load,rR=tR.store,iR=DM(wj,!0),aR=iR.load,oR=iR.store,sR=kM(_j,e=>iI(e).id,e=>e),cR=sR.load,lR=sR.store,uR=EM(Tj,0,kL),dR=uR.load,fR=uR.store,pR=EM(Ej,0,AL),mR=pR.load,hR=pR.store,gR=DM(Oj,!1),_R=gR.load,vR=gR.store,yR=`<path d='m6 8 4 4-4 4M12 16h6'/>`,bR=[`<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(``),xR={ready:`hsl(220 8% 46%)`,running:`hsl(142 72% 45%)`,"alive-quiet":`hsl(210 65% 50%)`,dead:`hsl(0 72% 50%)`},SR={ready:`hsl(220 10% 16%)`,running:`hsl(142 85% 12%)`,"alive-quiet":`hsl(210 70% 14%)`,dead:`hsl(0 80% 12%)`},CR={ready:yR,running:bR,"alive-quiet":yR,dead:yR},wR=`<circle cx='19' cy='7' r='3.5' fill='hsl(0 72% 50%)' stroke='white' stroke-width='1.5'/>`,TR=(e,t=!1)=>{let n=xR[e],r=SR[e],i=CR[e],a=t?wR:``;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`?lj:1}'>`,`<rect x='2' y='4' width='20' height='16' rx='2' fill='${n}'/>`,i,a,`</svg>`].join(``)},ER=`ready`,DR=null,OR=!1,kR=(e,t)=>DR===null||e!==ER||t!==OR,AR=(e,t)=>{ER=e,DR=e,OR=t},jR=()=>{ER=`ready`,DR=null,OR=!1},MR=(e,t=!1)=>{if(typeof document>`u`||!kR(e,t))return;AR(e,t);let n=`data:image/svg+xml,${encodeURIComponent(TR(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},NR=`/api/health`,PR=async()=>{try{return(await fetch(NR)).ok}catch{return!1}},FR=(e,t)=>t.buffer.active.type!==`alternate`||t.modes.mouseTrackingMode!==`none`?!1:e.deltaMode===WheelEvent.DOM_DELTA_PIXEL,IR=e=>e||`localterm`,LR=e=>`${aj}${e||`localterm`}`,RR={matchBackground:mj,activeMatchBackground:hj,activeMatchBorder:gj,matchOverviewRuler:hj,activeMatchColorOverviewRuler:gj},zR=`cwd`,BR=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(zR);n&&t.searchParams.set(zR,n);let r=new URLSearchParams(window.location.search).get(`run`);return r&&t.searchParams.set(`run`,r),t.toString()},VR=e=>{let t=new URL(window.location.origin);return e&&t.searchParams.set(zR,e),t.toString()},HR=({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)(null),p=(0,b.useRef)(cR()),m=(0,b.useRef)(qL()),h=(0,b.useRef)(XL()),g=(0,b.useRef)($L()),_=(0,b.useRef)(WL()),v=(0,b.useRef)(VL()),x=(0,b.useRef)(nR()),C=(0,b.useRef)(aR()),w=(0,b.useRef)(dR()),T=(0,b.useRef)(mR()),E=(0,b.useRef)(_R()),O=(0,b.useRef)(null),k=(0,b.useRef)(null),A=(0,b.useRef)(null),j=(0,b.useRef)(null),M=(0,b.useRef)(null),[N,P]=(0,b.useState)(null),[F,I]=(0,b.useState)(0),[L,R]=(0,b.useState)(!1),[z,ee]=(0,b.useState)(!1),[B,te]=(0,b.useState)(!1),[V,H]=(0,b.useState)(!1),ne=(0,b.useRef)(null),[U,re]=(0,b.useState)(0),[W,ie]=(0,b.useState)(!1),[ae,oe]=(0,b.useState)(!1),[se,ce]=(0,b.useState)(!1),[le,ue]=(0,b.useState)(null),de=(0,b.useRef)(null),fe=(0,b.useRef)(null),pe=(0,b.useRef)(!1),me=(0,b.useRef)(!1),he=W||ae||se;pe.current=ae,me.current=se;let[ge,_e]=(0,b.useState)(``),[ve,ye]=(0,b.useState)({resultIndex:-1,resultCount:0}),[be,xe]=(0,b.useState)(p.current),[Se,Ce]=(0,b.useState)(null),we=Se??be,Te=(0,b.useMemo)(()=>iI(we),[we]),Ee=(0,b.useMemo)(()=>({...Te.colors,extendedAnsi:JI(Te.colors)}),[Te]),[De,Oe]=(0,b.useState)(m.current),[ke,Ae]=(0,b.useState)(null),je=ke??De,[Me,Ne]=(0,b.useState)(E.current),Pe=(0,b.useMemo)(()=>YF(je),[je]),[Fe,Ie]=(0,b.useState)(h.current),[Le,Re]=(0,b.useState)(g.current),[ze,Be]=(0,b.useState)(_.current),[Ve,He]=(0,b.useState)(null),Ue=Ve??ze,[We,Ge]=(0,b.useState)(v.current),[qe,Ye]=(0,b.useState)(x.current),[Xe,Ze]=(0,b.useState)(C.current),[Qe,$e]=(0,b.useState)(w.current),[et,tt]=(0,b.useState)(T.current),[nt,rt]=(0,b.useState)(null),[it,at]=(0,b.useState)(`Notification`in window?Notification.permission:`unsupported`),[ot,st]=(0,b.useState)(null),ct=(0,b.useRef)(null),ut=(0,b.useRef)(!1),dt=(0,b.useMemo)(jL,[]),[ft,pt]=(0,b.useState)(!1),{summary:mt,setGitDiffSummary:ht}=hI(),gt=mt!==null&&mt.isRepo&&mt.files>0;(0,b.useEffect)(()=>{let e=n.current;if(!e)return;let l=!1,u=!1,d=!1,y=``,b=null,w=null,T=null,N=null,F=null,L=0,R=`ready`,z=!1,ee=!1,B=[0],te=()=>B[B.length-1]??0,V=()=>{let e=performance.now()-L;if(e<750){F=window.setTimeout(V,750-e);return}F=null,N!==null&&(window.clearTimeout(N),N=null),R===`running`&&(document.hidden&&(z=!0),ee?(R=`alive-quiet`,MR(`alive-quiet`,z)):(R=`ready`,MR(`ready`,z)))},H=()=>{R!==`running`&&N===null&&(N=window.setTimeout(()=>{N=null,!(l||u)&&(R=`running`,z=!1,MR(`running`))},250)),L=performance.now(),F===null&&(F=window.setTimeout(V,750))},U=()=>{N!==null&&(window.clearTimeout(N),N=null),F!==null&&(window.clearTimeout(F),F=null),(R!==`ready`||z)&&(R=`ready`,z=!1,MR(`ready`))},re=YF(m.current);ZI(re).then(()=>{if(l)return;let e=r.current;e&&e.clearTextureAtlas(),W._core._charSizeService.measure(),Ne()});let W=new $u({allowProposedApi:!0,cursorBlink:v.current,cursorStyle:_.current,fontFamily:XF(re,E.current),fontSize:h.current,lineHeight:g.current,scrollback:x.current,theme:{...iI(p.current).colors,extendedAnsi:JI(iI(p.current).colors)},macOptionIsMeta:!0,scrollOnUserInput:C.current,windowOptions:{getWinSizePixels:!0,getCellSizePixels:!0,getWinSizeChars:!0},scrollbar:{showScrollbar:!1}});r.current=W,xL.attach(W);let ie=new D;O.current=ie,W.loadAddon(ie),W.loadAddon(new Mn),W.loadAddon(new S),W.loadAddon(new Ke),W.loadAddon(new Je),W.loadAddon(new En);let ae=W._core.unicodeService._activeProvider;W.unicode.register(new lL(ae)),W.unicode.activeVersion=`15-graphemes-emoji`;let oe=new lt;W.loadAddon(oe),o.current=oe;let se=oe.onDidChangeResults(ye);W.open(e),ie.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 ce=()=>{let e=W.buffer.active,t=e.length,n=W.rows,r=e.viewportY+n>=t,i=t>n,a=j.current,o=M.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}%`}};ce();let le=W.onScroll(ce);xL.setAfterFlush(ce);let fe=!1,pe=0,me=0,he=e=>{if(e.button===0){fe=!0,pe=e.clientY,me=W.buffer.active.viewportY;try{e.target.setPointerCapture(e.pointerId)}catch{}e.preventDefault()}},ge=e=>{if(!fe)return;let t=j.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-pe,o=Math.max(0,Math.min(r,me+Math.round(a/i)));o!==W.buffer.active.viewportY&&W.scrollLines(o-W.buffer.active.viewportY)},_e=()=>{fe=!1},ve=e=>{if(e.button!==0||e.target===M.current)return;let t=j.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)},be=M.current,xe=j.current;be&&(be.addEventListener(`pointerdown`,he),be.addEventListener(`pointermove`,ge),be.addEventListener(`pointerup`,_e),be.addEventListener(`pointercancel`,_e)),xe&&xe.addEventListener(`pointerdown`,ve);try{let e=new ia;e.onContextLoss(()=>e.dispose()),W.loadAddon(e)}catch{}let Se=W.parser.registerCsiHandler({prefix:`>`,final:`u`},e=>{let t=e[0],n=typeof t==`number`?t:1;return B.push(n),!0}),Ce=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}),we=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}),Te=W.parser.registerCsiHandler({final:`J`},SL),Ee=W.parser.registerCsiHandler({prefix:`?`,final:`J`},SL),De=e=>{b?.readyState===WebSocket.OPEN&&b.send(JSON.stringify(e))},Oe=()=>{let e=f.current;e&&cancelAnimationFrame(e.frameId),f.current=null},ke=()=>{let e=f.current;e&&bL(W,e.anchor)},Ae=e=>{Oe(),f.current={anchor:e,frameId:requestAnimationFrame(()=>{ke(),f.current=null})}};W.attachCustomWheelEventHandler(e=>FR(e,W)?(e.preventDefault(),!1):!0),W.attachCustomKeyEventHandler(e=>{if(e.key===`Tab`&&(e.metaKey||e.ctrlKey))return!1;if(RL(e,dt)){if(e.type===`keydown`){e.preventDefault();let t=document.getElementById(`new-shell-link`);t instanceof HTMLAnchorElement&&t.click()}return!1}if(FL(e,dt))return e.type===`keydown`&&(e.preventDefault(),ne.current?.()),!1;if(PL(e,dt))return e.type===`keydown`&&(e.preventDefault(),de.current?.()),!1;if(IL(e,dt))return e.type===`keydown`&&(e.preventDefault(),A.current?.()),!1;if(LL(e,dt))return e.type===`keydown`&&(e.preventDefault(),k.current?.()),!1;if(e.type===`keydown`&&e.key===`Enter`){let t=uL(e),n=(te()&1)!=0;if(t!==0&&n)return e.preventDefault(),De({type:`input`,data:QI(13,t)}),!1;if(t===1)return e.preventDefault(),De({type:`input`,data:`
|
|
115
|
+
`}),!1}return!0});let je=e=>{if(u)return;let t=e.trim();t&&(y=t,document.title=IR(t))};s.current=()=>W.focus(),c.current=e=>W.paste(e);let Me=(e,t)=>{let n=W,r=n._core._renderService?.dimensions?.css?.canvas?.width,i=n._core._renderService?.dimensions?.css?.canvas?.height;De({type:`resize`,cols:e,rows:t,...r!=null&&i!=null?{pixelWidth:Math.round(r),pixelHeight:Math.round(i)}:{}})},Ne=()=>{let e=$I(W);dL(W,ie)&&(Ae(e),Me(W.cols,W.rows))},Pe=()=>{T!==null&&window.clearTimeout(T),T=window.setTimeout(()=>{T=null,Ne()},80)};W.onData(e=>{for(let t of yL(e,BS))De({type:`input`,data:t})}),W.onResize(({cols:e,rows:t})=>{Me(e,t),ce()});let Fe=new ResizeObserver(Pe),Ie=()=>{!document.hidden&&z&&(z=!1,MR(R))};document.addEventListener(`visibilitychange`,Ie),Fe.observe(e),Ne(),requestAnimationFrame(()=>W.focus());let Le=e=>{if(!u){if(u=!0,e===null||e===0){window.close(),setTimeout(()=>{l||(U(),MR(`dead`),W.write(gL(e)),document.title=LR(y),P({reason:`shell-exited`,exitCode:e}),rt(null))},100);return}U(),MR(`dead`),W.write(gL(e)),document.title=LR(y),P({reason:`shell-exited`,exitCode:e}),rt(null)}},Re=(e,t,n)=>{u||(u=!0,U(),MR(`dead`),W.write(fL(e,t)),document.title=LR(y),P({reason:`connection-lost`,closeCode:e,closeReason:t,wasClean:n}),rt(null))},ze=()=>{if(l)return;let e=new WebSocket(BR(ct.current));b=e,e.addEventListener(`open`,()=>{l||b!==e||(d=!0,ut.current=!0,I(0),Me(W.cols,W.rows))}),e.addEventListener(`message`,n=>{if(l||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;xL.push(e),H();return}let i=nA.safeParse(r);if(!i.success)return;let a=i.data;if(a.type===`title`)je(a.title);else if(a.type===`session`)rt({shell:a.shell,shellName:a.shellName,pid:a.pid,cwd:a.cwd,title:a.title}),st(a.cwd),je(a.title),zL();else if(a.type===`automations`)ue(a.automations);else if(a.type===`cwd`)st(a.cwd),ht(null);else if(a.type===`git-diff-summary`)ht(a.summary);else if(a.type===`foreground`){let e=a.process!==null;t?.(e),!e&&R===`alive-quiet`&&(R=`ready`,MR(`ready`,z)),ee=e}else a.type===`notification`?`Notification`in window&&Notification.permission===`granted`&&new Notification(a.body):a.type===`exit`&&(U(),Le(a.code))}),e.addEventListener(`close`,t=>{if(b===e&&(b=null,ut.current=!1,!l&&!u)){if(d){console.warn(`[localterm] websocket closed: code=${t.code} reason=${JSON.stringify(t.reason)} wasClean=${t.wasClean}`),Re(t.code,t.reason,t.wasClean);return}I(e=>e+1),w=window.setTimeout(ze,tj)}}),e.addEventListener(`error`,t=>{console.warn(`[localterm] websocket error`,t);try{e.close()}catch{}})};return a.current=()=>{if(!l){u=!1,d=!1,ut.current=!1,P(null),rt(null),I(0),MR(`ready`),t?.(!1),w!==null&&(window.clearTimeout(w),w=null);try{b?.close()}catch{}b=null,ze()}},ze(),i.current=!0,()=>{l=!0,i.current=!1,be&&(be.removeEventListener(`pointerdown`,he),be.removeEventListener(`pointermove`,ge),be.removeEventListener(`pointerup`,_e),be.removeEventListener(`pointercancel`,_e)),xe&&xe.removeEventListener(`pointerdown`,ve),se.dispose(),le.dispose(),Se.dispose(),Ce.dispose(),we.dispose(),Te.dispose(),Ee.dispose(),w!==null&&window.clearTimeout(w),T!==null&&window.clearTimeout(T),Oe(),U(),document.removeEventListener(`visibilitychange`,Ie),Fe.disconnect();try{b?.close()}catch{}b=null,xL.detach(),W.dispose(),document.title=ij}},[]),(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.theme=Ee)},[Ee]),(0,b.useEffect)(()=>{if(!i.current||!r.current)return;let e=!1;return ZI(Pe).then(()=>{if(e)return;let t=r.current;if(!t)return;t.options.fontFamily=XF(Pe,Me),t.clearTextureAtlas();let n=O.current;n&&dL(t,n)}),()=>{e=!0}},[Pe,Me]);let _t=(0,b.useCallback)(e=>{xe(e),Ce(null),lR(e)},[]),vt=(0,b.useCallback)(e=>{Oe(e),Ae(null),JL(e)},[]),yt=(0,b.useCallback)(e=>{Ne(e),vR(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.fontSize=Fe;let t=O.current;t&&dL(e,t)},[Fe]);let bt=(0,b.useCallback)(e=>{let t=CL(e);Ie(t),ZL(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;e.options.lineHeight=Le;let t=O.current;t&&dL(e,t)},[Le]);let xt=(0,b.useCallback)(e=>{let t=EL(e);Re(t),eR(t)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorStyle=Ue)},[Ue]);let St=(0,b.useCallback)(e=>{Be(e),He(null),GL(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.cursorBlink=We)},[We]);let Ct=(0,b.useCallback)(e=>{Ge(e),HL(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollback=qe)},[qe]);let wt=(0,b.useCallback)(e=>{Ye(e),rR(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;e&&(e.options.scrollOnUserInput=Xe)},[Xe]);let Tt=(0,b.useCallback)(e=>{Ze(e),oR(e)},[]);(0,b.useEffect)(()=>{if(!i.current)return;let e=r.current;if(!e)return;let t=O.current;t&&dL(e,t)},[Qe,et]);let Et=(0,b.useCallback)(e=>{let t=kL(e);$e(t),fR(t)},[]),Dt=(0,b.useCallback)(e=>{let t=AL(e);tt(t),hR(t)},[]),Ot=(0,b.useCallback)(()=>{`Notification`in window&&Notification.requestPermission().then(e=>{at(e)})},[]);(0,b.useEffect)(()=>{if(!B)return;let e=l.current;e&&(e.focus(),e.select())},[B,U]);let kt=(0,b.useCallback)(e=>{if(!e){o.current?.clearDecorations(),ye({resultIndex:-1,resultCount:0});return}o.current?.findNext(e,{decorations:RR})},[]),At=(0,b.useCallback)(e=>{e&&o.current?.findPrevious(e,{decorations:RR})},[]),jt=(0,b.useCallback)(()=>{te(!1),_e(``),ye({resultIndex:-1,resultCount:0}),o.current?.clearDecorations(),s.current?.()},[]),Mt=(0,b.useCallback)(()=>{fe.current!==null&&(window.clearTimeout(fe.current),fe.current=null),ie(!0)},[]),Nt=(0,b.useCallback)(e=>{let t=e.clientY<=0||e.clientX>=window.innerWidth-1?pj:200;fe.current=window.setTimeout(()=>{fe.current=null,!pe.current&&!me.current&&ie(!1)},t)},[]),Pt=(0,b.useCallback)(e=>{oe(e),e||(fe.current!==null&&window.clearTimeout(fe.current),fe.current=window.setTimeout(()=>{fe.current=null,ie(!1)},200))},[]),Ft=(0,b.useCallback)(e=>{if(ce(e),e){H(!1);return}fe.current!==null&&window.clearTimeout(fe.current),fe.current=window.setTimeout(()=>{fe.current=null,ie(!1)},200),s.current?.()},[]);de.current=(0,b.useCallback)(()=>{Ft(!me.current)},[Ft]),ne.current=(0,b.useCallback)(()=>{H(e=>!e)},[]);let It=(0,b.useCallback)(()=>{H(!1),s.current?.()},[]),Lt=(0,b.useCallback)(()=>{te(!0),H(!1),re(e=>e+1)},[]);k.current=Lt;let Rt=(0,b.useCallback)(()=>{pt(!0),H(!1)},[]);A.current=Rt;let zt=(0,b.useCallback)(()=>{pt(!1),s.current?.()},[]),Bt=(0,b.useCallback)(e=>{c.current?.(e)},[]),Vt=(0,b.useCallback)(e=>{let t=e.target.value;_e(t),kt(t)},[kt]),Ht=(0,b.useCallback)(e=>{if(LL(e.nativeEvent,dt)){e.preventDefault(),e.currentTarget.select();return}if(e.key===`Escape`){e.preventDefault(),jt();return}e.key===`Enter`&&(e.preventDefault(),e.shiftKey?At(ge):kt(ge))},[jt,kt,At,dt,ge]),Ut=(0,b.useCallback)(()=>{ee(!0),a.current?.(),u.current!==null&&window.clearTimeout(u.current),u.current=window.setTimeout(()=>{u.current=null,ee(!1)},800)},[]),Wt=(0,b.useCallback)(()=>{navigator.clipboard.writeText(oj).then(()=>{R(!0),d.current!==null&&window.clearTimeout(d.current),d.current=window.setTimeout(()=>{d.current=null,R(!1)},sj)}).catch(()=>{})},[]);(0,b.useEffect)(()=>()=>{fe.current!==null&&(window.clearTimeout(fe.current),fe.current=null),u.current!==null&&(window.clearTimeout(u.current),u.current=null),d.current!==null&&(window.clearTimeout(d.current),d.current=null)},[]),(0,b.useEffect)(()=>{if(ct.current=ot,!ot)return;let e=new URL(window.location.href);if(e.searchParams.get(zR)!==ot){e.searchParams.set(zR,ot);try{window.history.replaceState(null,``,e)}catch{}}},[ot]);let Gt=VR(ot),Kt=N!==null,qt=!Kt&&F>=2,Jt=Kt||qt,Yt=N!==null&&N.reason!==`shell-exited`||qt;(0,b.useEffect)(()=>{if(!Yt)return;let e=Date.now(),t=!1,n=null,i=i=>{if(t||ut.current)return;if(i){let e=r.current;e&&(e.write(hL(Ue,We)),e.refresh(0,e.rows-1),e.focus()),a.current?.();return}let s=Date.now()-e<5e3?250:cj;n=window.setTimeout(o,s)},o=()=>{PR().then(i)};return o(),()=>{t=!0,n!==null&&window.clearTimeout(n)}},[Yt,Ue,We]),(0,b.useEffect)(()=>{e?.(Jt),Jt&&(H(!1),pt(!1),ce(!1))},[Jt,e]);let Xt=ve.resultCount===0?`0/0`:`${ve.resultIndex+1}/${ve.resultCount}`,Zt=Te.colors.background??`#101010`,Qt=(0,b.useMemo)(()=>{let e=dt?`⌘`:`Ctrl+`;return[{id:`find`,label:`Find in terminal`,category:`Actions`,shortcut:`${e}F`,icon:(0,y.jsx)(Dd,{className:`size-3.5`}),action:Lt},{id:`git-diff`,label:`View git diff`,category:`Actions`,shortcut:`${e}G`,icon:(0,y.jsx)(gd,{className:`size-3.5`}),action:Rt},{id:`automations`,label:`Automations`,category:`Actions`,shortcut:`${e}J`,icon:(0,y.jsx)(dd,{className:`size-3.5`}),action:()=>Ft(!0)},{id:`new-shell`,label:`Open new shell`,category:`Actions`,shortcut:`Alt+T`,icon:(0,y.jsx)(Td,{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)(Sd,{className:`size-3.5`}),action:()=>bt(Fe+1)},{id:`font-size-down`,label:`Decrease font size`,category:`Settings`,shortcut:`${e}-`,icon:(0,y.jsx)(Sd,{className:`size-3.5`}),action:()=>bt(Fe-1)},{id:`cursor-blink`,label:`Cursor blink`,category:`Settings`,checked:We,action:()=>Ct(!We)},{id:`scroll-on-input`,label:`Pin to bottom on input`,category:`Settings`,checked:Xe,action:()=>Tt(!Xe)},...kF.map(e=>({id:`cursor:${e.id}`,label:e.name,category:`Cursor`,checked:e.id===ze,action:()=>St(e.id)})),...JF.map(e=>({id:`font:${e.id}`,label:e.name,category:`Font`,checked:e.id===De,action:()=>vt(e.id)})),...rI.map(e=>({id:`theme:${e.id}`,label:e.name,category:`Theme`,checked:e.id===be,action:()=>_t(e.id)}))]},[dt,_t,vt,Lt,Rt,Ft,St,We,Ct,Fe,bt,Xe,Tt,be,De,ze]),$t=(0,b.useCallback)(e=>{let t=e?.id??``;Ce(t.startsWith(`theme:`)?t.slice(6):null),Ae(t.startsWith(`font:`)?t.slice(5):null);let n=t.startsWith(`cursor:`)?t.slice(7):null;He(MF(n)?n:null)},[]);return(0,y.jsxs)(`div`,{className:`h-dvh w-dvw`,style:{background:Zt},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:et,right:Qe,bottom:et,left:Qe}}),(0,y.jsx)(`div`,{ref:j,className:`xterm-scrollbar-track`,style:{top:et,right:Qe,bottom:et},children:(0,y.jsx)(`div`,{ref:M,className:`xterm-scrollbar-thumb`})}),N===null?null:(0,y.jsx)(uS,{variant:`destructive`,role:`status`,"aria-live":`polite`,className:`absolute top-2 left-3 z-10`,children:N.reason===`shell-exited`?N.exitCode===null?`exited`:`exited · code ${N.exitCode}`:`disconnected · code ${N.closeCode}`}),(0,y.jsxs)(`div`,{className:ap(`absolute right-0 top-0 z-10 flex flex-col items-end pr-3 pt-1`,he||B||gt?`pointer-events-auto`:`pointer-events-none`),onMouseEnter:Mt,onMouseLeave:Nt,children:[(0,y.jsx)(`div`,{"aria-hidden":`true`,className:ap(`pointer-events-auto mr-0.5 h-[2px] w-5 rounded-full bg-muted-foreground/25 transition-opacity duration-150`,he||B||gt?`opacity-0`:`opacity-100`)}),!B&&(0,y.jsxs)(`div`,{role:`toolbar`,"aria-label":`terminal actions`,className:ap(`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`,he||gt?`translate-y-0 opacity-100`:`pointer-events-none -translate-y-1 opacity-0`),onMouseDown:e=>{e.currentTarget.contains(e.target)&&e.preventDefault()},onKeyDown:e=>{e.currentTarget.contains(e.target)&&s.current?.()},children:[(0,y.jsx)(`div`,{className:ap(`grid`,gt&&`transition-[grid-template-columns] duration-200 ease-snappy`,gt&&!he?`grid-cols-[0fr]`:`grid-cols-[1fr]`),children:(0,y.jsxs)(`div`,{className:ap(`flex min-w-0 items-center gap-0.5 overflow-hidden`,gt&&`transition-opacity duration-200 ease-snappy`,gt&&!he?`pointer-events-none opacity-0`:`opacity-100`),children:[(0,y.jsx)(mI,{themeId:be,onThemeChange:_t,onThemePreview:Ce,fontId:De,onFontChange:vt,onFontPreview:Ae,nerdFontEnabled:Me,onNerdFontEnabledChange:yt,fontSize:Fe,onFontSizeChange:bt,lineHeight:Le,onLineHeightChange:xt,cursorStyle:ze,onCursorStyleChange:St,onCursorStylePreview:He,cursorBlink:We,onCursorBlinkChange:Ct,scrollback:qe,onScrollbackChange:wt,scrollOnUserInput:Xe,onScrollOnUserInputChange:Tt,paddingX:Qe,onPaddingXChange:Et,paddingY:et,onPaddingYChange:Dt,notificationsPermission:it,onNotificationsPermissionRequest:Ot,sessionInfo:nt,onPopoverOpenChange:Pt,onClose:s.current??void 0}),(0,y.jsx)(Qx,{variant:`ghost`,size:`icon-sm`,onClick:Lt,"aria-label":`find in terminal`,className:`hover:text-foreground`,children:(0,y.jsx)(Dd,{})}),(0,y.jsx)(Yj,{open:se,onOpenChange:Ft,automations:le,onAutomationsLoaded:ue,defaultCwd:ot,isMac:dt}),(0,y.jsx)(Qx,{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:Gt,target:`_blank`,rel:`noopener noreferrer`}),className:`hover:text-foreground`,children:(0,y.jsx)(Td,{})})]})}),gt&&mt!==null?(0,y.jsxs)(`button`,{type:`button`,onClick:Rt,"aria-label":`view git diff: ${mt.additions} additions, ${mt.deletions} deletions${mt.binaries>0?`, ${mt.binaries} binary files changed`:``}`,title:`${dt?`⌘`:`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:[`+`,ML(mt.additions)]}),(0,y.jsxs)(`span`,{className:`text-red-400`,children:[`−`,ML(mt.deletions)]}),mt.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`}),mt.binaries]}):null]}):null]}),B&&(0,y.jsxs)(MS,{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)(RS,{ref:l,type:`search`,value:ge,onChange:Vt,onKeyDown:Ht,placeholder:`Find`,"aria-label":`find query`,className:`text-xs`}),(0,y.jsxs)(PS,{align:`inline-end`,children:[(0,y.jsx)(LS,{role:`status`,"aria-label":`match count`,className:`text-xs tabular-nums`,children:Xt}),(0,y.jsx)(IS,{size:`icon-xs`,onClick:()=>At(ge),disabled:ve.resultCount===0,"aria-label":`previous match`,children:(0,y.jsx)(md,{})}),(0,y.jsx)(IS,{size:`icon-xs`,onClick:()=>kt(ge),disabled:ve.resultCount===0,"aria-label":`next match`,children:(0,y.jsx)(pd,{})})]})]})]})]}),(0,y.jsx)(iM,{open:V,onClose:It,commands:Qt,onActiveItemChange:$t}),(0,y.jsx)(XM,{open:ft,cwd:ot,onClose:zt,onSendToTerminal:Bt}),(0,y.jsx)($x,{open:Jt,children:(0,y.jsx)(nS,{children:N===null?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(rS,{children:[(0,y.jsxs)(aS,{className:`flex items-center gap-2`,children:[(0,y.jsx)(zS,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Lost connection`]}),(0,y.jsx)(oS,{children:`The localterm server isn't responding. Start it again from your terminal, then retry.`})]}),(0,y.jsxs)(MS,{children:[(0,y.jsx)(RS,{readOnly:!0,value:oj,"aria-label":`restart command`,className:`font-mono`}),(0,y.jsx)(PS,{align:`inline-end`,children:(0,y.jsx)(IS,{size:`icon-xs`,onClick:Wt,"aria-label":L?`Copied`:`Copy restart command`,children:L?(0,y.jsx)(fd,{}):(0,y.jsx)(hd,{})})})]}),(0,y.jsx)(iS,{children:(0,y.jsxs)(sS,{onClick:Ut,disabled:z,children:[z?(0,y.jsx)(zS,{"data-icon":`inline-start`}):null,`Retry`]})})]}):N.reason===`shell-exited`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(rS,{children:[(0,y.jsx)(aS,{children:`Shell ended`}),(0,y.jsx)(oS,{children:N.exitCode===null||N.exitCode===0?`Open a new shell to keep going, or close this tab.`:`Exit code ${N.exitCode}. Open a new shell to keep going.`})]}),(0,y.jsx)(iS,{children:(0,y.jsx)(sS,{onClick:()=>window.open(Gt,`_blank`,`noopener,noreferrer`),children:`New shell`})})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(rS,{children:[(0,y.jsxs)(aS,{className:`flex items-center gap-2`,children:[(0,y.jsx)(zS,{"aria-hidden":`true`,role:`presentation`,"aria-label":void 0}),`Connection lost`]}),(0,y.jsxs)(oS,{children:[`The browser lost its connection to the localterm daemon (close code`,` `,N.closeCode,N.closeReason?` · ${N.closeReason}`:``,`). Reconnecting spawns a fresh shell. The previous one can't be reattached.`]})]}),(0,y.jsx)(iS,{children:(0,y.jsxs)(sS,{onClick:Ut,disabled:z,children:[z?(0,y.jsx)(zS,{"data-icon":`inline-start`}):null,`Reconnect`]})})]})})})]})},UR=()=>{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)(HR,{onModalOpenChange:(0,b.useCallback)(t=>{e.current=t},[]),onForegroundProcessChange:(0,b.useCallback)(e=>{t.current=e},[])})};jR(),MR(`ready`),(()=>{if(typeof document>`u`||document.getElementById(`localterm-google-fonts`))return;let e=ZF();if(!e)return;let t=document.createElement(`link`);t.id=Dj,t.rel=`stylesheet`,t.href=e,document.head.appendChild(t)})();var WR=document.getElementById(`root`);if(!WR)throw Error(`Root element not found`);(0,x.createRoot)(WR).render((0,y.jsx)(b.StrictMode,{children:(0,y.jsx)(TF,{delay:300,children:(0,y.jsx)(UR,{})})}));
|
|
116
|
+
//# sourceMappingURL=index-_QplI2Jp.js.map
|